/* Generated by Cython 3.2.4 */

/* BEGIN: Cython Metadata
{
    "distutils": {
        "define_macros": [
            [
                "CYTHON_CLINE_IN_TRACEBACK",
                "0"
            ]
        ],
        "depends": [
            "/usr/include/libxml2/libxml/HTMLtree.h",
            "/usr/include/libxml2/libxml/chvalid.h",
            "/usr/include/libxml2/libxml/encoding.h",
            "/usr/include/libxml2/libxml/globals.h",
            "/usr/include/libxml2/libxml/hash.h",
            "/usr/include/libxml2/libxml/tree.h",
            "/usr/include/libxml2/libxml/uri.h",
            "/usr/include/libxml2/libxml/valid.h",
            "/usr/include/libxml2/libxml/xmlIO.h",
            "/usr/include/libxml2/libxml/xmlmemory.h",
            "/usr/include/libxml2/libxml/xmlsave.h",
            "/usr/include/libxml2/libxml/xmlstring.h",
            "/usr/include/libxml2/libxml/xmlversion.h",
            "src/lxml/apihelpers.pxi",
            "src/lxml/classlookup.pxi",
            "src/lxml/cleanup.pxi",
            "src/lxml/debug.pxi",
            "src/lxml/docloader.pxi",
            "src/lxml/dtd.pxi",
            "src/lxml/extensions.pxi",
            "src/lxml/includes/__init__.pxd",
            "src/lxml/includes/c14n.pxd",
            "src/lxml/includes/config.pxd",
            "src/lxml/includes/dtdvalid.pxd",
            "src/lxml/includes/etree_defs.h",
            "src/lxml/includes/htmlparser.pxd",
            "src/lxml/includes/lxml-version.h",
            "src/lxml/includes/relaxng.pxd",
            "src/lxml/includes/schematron.pxd",
            "src/lxml/includes/tree.pxd",
            "src/lxml/includes/uri.pxd",
            "src/lxml/includes/xinclude.pxd",
            "src/lxml/includes/xmlerror.pxd",
            "src/lxml/includes/xmlparser.pxd",
            "src/lxml/includes/xmlschema.pxd",
            "src/lxml/includes/xpath.pxd",
            "src/lxml/includes/xslt.pxd",
            "src/lxml/iterparse.pxi",
            "src/lxml/nsclasses.pxi",
            "src/lxml/parser.pxi",
            "src/lxml/parsertarget.pxi",
            "src/lxml/proxy.pxi",
            "src/lxml/public-api.pxi",
            "src/lxml/readonlytree.pxi",
            "src/lxml/relaxng.pxi",
            "src/lxml/saxparser.pxi",
            "src/lxml/schematron.pxi",
            "src/lxml/serializer.pxi",
            "src/lxml/xinclude.pxi",
            "src/lxml/xmlerror.pxi",
            "src/lxml/xmlid.pxi",
            "src/lxml/xmlschema.pxi",
            "src/lxml/xpath.pxi",
            "src/lxml/xslt.pxi",
            "src/lxml/xsltext.pxi"
        ],
        "include_dirs": [
            "src/lxml",
            "src/lxml/includes",
            "/usr/include/libxml2",
            "src"
        ],
        "libraries": [
            "xslt",
            "exslt",
            "xml2",
            "rt",
            "z",
            "m"
        ],
        "name": "lxml.etree",
        "sources": [
            "src/lxml/etree.pyx"
        ]
    },
    "module_name": "lxml.etree"
}
END: Cython Metadata */

#ifndef PY_SSIZE_T_CLEAN
#define PY_SSIZE_T_CLEAN
#endif /* PY_SSIZE_T_CLEAN */
/* InitLimitedAPI */
#if defined(Py_LIMITED_API)
  #if !defined(CYTHON_LIMITED_API)
  #define CYTHON_LIMITED_API 1
  #endif
#elif defined(CYTHON_LIMITED_API)
  #ifdef _MSC_VER
  #pragma message ("Limited API usage is enabled with 'CYTHON_LIMITED_API' but 'Py_LIMITED_API' does not define a Python target version. Consider setting 'Py_LIMITED_API' instead.")
  #else
  #warning Limited API usage is enabled with 'CYTHON_LIMITED_API' but 'Py_LIMITED_API' does not define a Python target version. Consider setting 'Py_LIMITED_API' instead.
  #endif
#endif

#include "Python.h"

    #if PY_VERSION_HEX >= 0x030C0000
      #undef PyUnicode_IS_READY
      #define PyUnicode_IS_READY(s)  (1)
      #undef PyUnicode_READY
      #define PyUnicode_READY(s)  (0)
      #undef PyUnicode_AS_DATA
      #define PyUnicode_AS_DATA(s)  (0)
      #undef PyUnicode_GET_DATA_SIZE
      #define PyUnicode_GET_DATA_SIZE(s)  (0)
      #undef PyUnicode_GET_SIZE
      #define PyUnicode_GET_SIZE(s)  (0)
    #endif
    
#ifndef Py_PYTHON_H
    #error Python headers needed to compile C extensions, please install development version of Python.
#elif PY_VERSION_HEX < 0x03080000
    #error Cython requires Python 3.8+.
#else
#define __PYX_ABI_VERSION "3_2_4"
#define CYTHON_HEX_VERSION 0x030204F0
#define CYTHON_FUTURE_DIVISION 1
/* CModulePreamble */
#include <stddef.h>
#ifndef offsetof
  #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif
#if !defined(_WIN32) && !defined(WIN32) && !defined(MS_WINDOWS)
  #ifndef __stdcall
    #define __stdcall
  #endif
  #ifndef __cdecl
    #define __cdecl
  #endif
  #ifndef __fastcall
    #define __fastcall
  #endif
#endif
#ifndef DL_IMPORT
  #define DL_IMPORT(t) t
#endif
#ifndef DL_EXPORT
  #define DL_EXPORT(t) t
#endif
#define __PYX_COMMA ,
#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif
#ifndef Py_HUGE_VAL
  #define Py_HUGE_VAL HUGE_VAL
#endif
#define __PYX_LIMITED_VERSION_HEX PY_VERSION_HEX
#if defined(GRAALVM_PYTHON)
  /* For very preliminary testing purposes. Most variables are set the same as PyPy.
     The existence of this section does not imply that anything works or is even tested */
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #define CYTHON_COMPILING_IN_LIMITED_API 0
  #define CYTHON_COMPILING_IN_GRAAL 1
  #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0
  #undef CYTHON_USE_TYPE_SLOTS
  #define CYTHON_USE_TYPE_SLOTS 0
  #undef CYTHON_USE_TYPE_SPECS
  #define CYTHON_USE_TYPE_SPECS 0
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #undef CYTHON_USE_UNICODE_INTERNALS
  #define CYTHON_USE_UNICODE_INTERNALS 0
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #undef CYTHON_AVOID_BORROWED_REFS
  #define CYTHON_AVOID_BORROWED_REFS 1
  #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
  #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0
  #undef CYTHON_ASSUME_SAFE_MACROS
  #define CYTHON_ASSUME_SAFE_MACROS 0
  #undef CYTHON_ASSUME_SAFE_SIZE
  #define CYTHON_ASSUME_SAFE_SIZE 0
  #undef CYTHON_UNPACK_METHODS
  #define CYTHON_UNPACK_METHODS 0
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_GIL
  #define CYTHON_FAST_GIL 0
  #undef CYTHON_METH_FASTCALL
  #define CYTHON_METH_FASTCALL 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #ifndef CYTHON_PEP487_INIT_SUBCLASS
    #define CYTHON_PEP487_INIT_SUBCLASS 1
  #endif
  #undef CYTHON_PEP489_MULTI_PHASE_INIT
  #define CYTHON_PEP489_MULTI_PHASE_INIT 1
  #undef CYTHON_USE_MODULE_STATE
  #define CYTHON_USE_MODULE_STATE 0
  #undef CYTHON_USE_SYS_MONITORING
  #define CYTHON_USE_SYS_MONITORING 0
  #undef CYTHON_USE_TP_FINALIZE
  #define CYTHON_USE_TP_FINALIZE 0
  #undef CYTHON_USE_AM_SEND
  #define CYTHON_USE_AM_SEND 0
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 1
  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
    #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
  #endif
  #undef CYTHON_USE_FREELISTS
  #define CYTHON_USE_FREELISTS 0
  #undef CYTHON_IMMORTAL_CONSTANTS
  #define CYTHON_IMMORTAL_CONSTANTS 0
#elif defined(PYPY_VERSION)
  #define CYTHON_COMPILING_IN_PYPY 1
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #define CYTHON_COMPILING_IN_LIMITED_API 0
  #define CYTHON_COMPILING_IN_GRAAL 0
  #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0
  #undef CYTHON_USE_TYPE_SLOTS
  #define CYTHON_USE_TYPE_SLOTS 1
  #ifndef CYTHON_USE_TYPE_SPECS
    #define CYTHON_USE_TYPE_SPECS 0
  #endif
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #undef CYTHON_USE_UNICODE_INTERNALS
  #define CYTHON_USE_UNICODE_INTERNALS 0
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #undef CYTHON_AVOID_BORROWED_REFS
  #define CYTHON_AVOID_BORROWED_REFS 1
  #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
  #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 1
  #undef CYTHON_ASSUME_SAFE_MACROS
  #define CYTHON_ASSUME_SAFE_MACROS 0
  #ifndef CYTHON_ASSUME_SAFE_SIZE
    #define CYTHON_ASSUME_SAFE_SIZE 1
  #endif
  #undef CYTHON_UNPACK_METHODS
  #define CYTHON_UNPACK_METHODS 0
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_GIL
  #define CYTHON_FAST_GIL 0
  #undef CYTHON_METH_FASTCALL
  #define CYTHON_METH_FASTCALL 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #ifndef CYTHON_PEP487_INIT_SUBCLASS
    #define CYTHON_PEP487_INIT_SUBCLASS 1
  #endif
  #if PY_VERSION_HEX < 0x03090000
    #undef CYTHON_PEP489_MULTI_PHASE_INIT
    #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT)
    #define CYTHON_PEP489_MULTI_PHASE_INIT 1
  #endif
  #undef CYTHON_USE_MODULE_STATE
  #define CYTHON_USE_MODULE_STATE 0
  #undef CYTHON_USE_SYS_MONITORING
  #define CYTHON_USE_SYS_MONITORING 0
  #ifndef CYTHON_USE_TP_FINALIZE
    #define CYTHON_USE_TP_FINALIZE (PYPY_VERSION_NUM >= 0x07030C00)
  #endif
  #undef CYTHON_USE_AM_SEND
  #define CYTHON_USE_AM_SEND 0
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 0
  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
    #define CYTHON_UPDATE_DESCRIPTOR_DOC (PYPY_VERSION_NUM >= 0x07031100)
  #endif
  #undef CYTHON_USE_FREELISTS
  #define CYTHON_USE_FREELISTS 0
  #undef CYTHON_IMMORTAL_CONSTANTS
  #define CYTHON_IMMORTAL_CONSTANTS 0
#elif defined(CYTHON_LIMITED_API)
  #ifdef Py_LIMITED_API
    #undef __PYX_LIMITED_VERSION_HEX
    #define __PYX_LIMITED_VERSION_HEX Py_LIMITED_API
  #endif
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #define CYTHON_COMPILING_IN_LIMITED_API 1
  #define CYTHON_COMPILING_IN_GRAAL 0
  #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0
  #undef CYTHON_USE_TYPE_SLOTS
  #define CYTHON_USE_TYPE_SLOTS 0
  #undef CYTHON_USE_TYPE_SPECS
  #define CYTHON_USE_TYPE_SPECS 1
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #undef CYTHON_USE_UNICODE_INTERNALS
  #define CYTHON_USE_UNICODE_INTERNALS 0
  #ifndef CYTHON_USE_UNICODE_WRITER
    #define CYTHON_USE_UNICODE_WRITER 0
  #endif
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
    #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0
  #endif
  #undef CYTHON_ASSUME_SAFE_MACROS
  #define CYTHON_ASSUME_SAFE_MACROS 0
  #undef CYTHON_ASSUME_SAFE_SIZE
  #define CYTHON_ASSUME_SAFE_SIZE 0
  #undef CYTHON_UNPACK_METHODS
  #define CYTHON_UNPACK_METHODS 0
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_GIL
  #define CYTHON_FAST_GIL 0
  #undef CYTHON_METH_FASTCALL
  #define CYTHON_METH_FASTCALL (__PYX_LIMITED_VERSION_HEX >= 0x030C0000)
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #ifndef CYTHON_PEP487_INIT_SUBCLASS
    #define CYTHON_PEP487_INIT_SUBCLASS 1
  #endif
  #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
    #define CYTHON_PEP489_MULTI_PHASE_INIT 1
  #endif
  #ifndef CYTHON_USE_MODULE_STATE
    #define CYTHON_USE_MODULE_STATE 0
  #endif
  #undef CYTHON_USE_SYS_MONITORING
  #define CYTHON_USE_SYS_MONITORING 0
  #ifndef CYTHON_USE_TP_FINALIZE
    #define CYTHON_USE_TP_FINALIZE 0
  #endif
  #ifndef CYTHON_USE_AM_SEND
    #define CYTHON_USE_AM_SEND (__PYX_LIMITED_VERSION_HEX >= 0x030A0000)
  #endif
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 0
  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
    #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
  #endif
  #ifndef CYTHON_USE_FREELISTS
  #define CYTHON_USE_FREELISTS 1
  #endif
  #undef CYTHON_IMMORTAL_CONSTANTS
  #define CYTHON_IMMORTAL_CONSTANTS 0
#else
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_CPYTHON 1
  #define CYTHON_COMPILING_IN_LIMITED_API 0
  #define CYTHON_COMPILING_IN_GRAAL 0
  #ifdef Py_GIL_DISABLED
    #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 1
  #else
    #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0
  #endif
  #if PY_VERSION_HEX < 0x030A0000
    #undef CYTHON_USE_TYPE_SLOTS
    #define CYTHON_USE_TYPE_SLOTS 1
  #elif !defined(CYTHON_USE_TYPE_SLOTS)
    #define CYTHON_USE_TYPE_SLOTS 1
  #endif
  #ifndef CYTHON_USE_TYPE_SPECS
    #define CYTHON_USE_TYPE_SPECS 0
  #endif
  #ifndef CYTHON_USE_PYTYPE_LOOKUP
    #define CYTHON_USE_PYTYPE_LOOKUP 1
  #endif
  #ifndef CYTHON_USE_PYLONG_INTERNALS
    #define CYTHON_USE_PYLONG_INTERNALS 1
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    #undef CYTHON_USE_PYLIST_INTERNALS
    #define CYTHON_USE_PYLIST_INTERNALS 0
  #elif !defined(CYTHON_USE_PYLIST_INTERNALS)
    #define CYTHON_USE_PYLIST_INTERNALS 1
  #endif
  #ifndef CYTHON_USE_UNICODE_INTERNALS
    #define CYTHON_USE_UNICODE_INTERNALS 1
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING || PY_VERSION_HEX >= 0x030B00A2
    #undef CYTHON_USE_UNICODE_WRITER
    #define CYTHON_USE_UNICODE_WRITER 0
  #elif !defined(CYTHON_USE_UNICODE_WRITER)
    #define CYTHON_USE_UNICODE_WRITER 1
  #endif
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
    #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 1
  #elif !defined(CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS)
    #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_ASSUME_SAFE_MACROS
    #define CYTHON_ASSUME_SAFE_MACROS 1
  #endif
  #ifndef CYTHON_ASSUME_SAFE_SIZE
    #define CYTHON_ASSUME_SAFE_SIZE 1
  #endif
  #ifndef CYTHON_UNPACK_METHODS
    #define CYTHON_UNPACK_METHODS 1
  #endif
  #ifndef CYTHON_FAST_THREAD_STATE
    #define CYTHON_FAST_THREAD_STATE 1
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    #undef CYTHON_FAST_GIL
    #define CYTHON_FAST_GIL 0
  #elif !defined(CYTHON_FAST_GIL)
    #define CYTHON_FAST_GIL (PY_VERSION_HEX < 0x030C00A6)
  #endif
  #ifndef CYTHON_METH_FASTCALL
    #define CYTHON_METH_FASTCALL 1
  #endif
  #ifndef CYTHON_FAST_PYCALL
    #define CYTHON_FAST_PYCALL 1
  #endif
  #ifndef CYTHON_PEP487_INIT_SUBCLASS
    #define CYTHON_PEP487_INIT_SUBCLASS 1
  #endif
  #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
    #define CYTHON_PEP489_MULTI_PHASE_INIT 1
  #endif
  #ifndef CYTHON_USE_MODULE_STATE
    #define CYTHON_USE_MODULE_STATE 0
  #endif
  #ifndef CYTHON_USE_SYS_MONITORING
    #define CYTHON_USE_SYS_MONITORING (PY_VERSION_HEX >= 0x030d00B1)
  #endif
  #ifndef CYTHON_USE_TP_FINALIZE
    #define CYTHON_USE_TP_FINALIZE 1
  #endif
  #ifndef CYTHON_USE_AM_SEND
    #define CYTHON_USE_AM_SEND 1
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    #undef CYTHON_USE_DICT_VERSIONS
    #define CYTHON_USE_DICT_VERSIONS 0
  #elif !defined(CYTHON_USE_DICT_VERSIONS)
    #define CYTHON_USE_DICT_VERSIONS  (PY_VERSION_HEX < 0x030C00A5 && !CYTHON_USE_MODULE_STATE)
  #endif
  #ifndef CYTHON_USE_EXC_INFO_STACK
    #define CYTHON_USE_EXC_INFO_STACK 1
  #endif
  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
    #define CYTHON_UPDATE_DESCRIPTOR_DOC 1
  #endif
  #ifndef CYTHON_USE_FREELISTS
    #define CYTHON_USE_FREELISTS (!CYTHON_COMPILING_IN_CPYTHON_FREETHREADING)
  #endif
  #if defined(CYTHON_IMMORTAL_CONSTANTS) && PY_VERSION_HEX < 0x030C0000
    #undef CYTHON_IMMORTAL_CONSTANTS
    #define CYTHON_IMMORTAL_CONSTANTS 0  // definitely won't work
  #elif !defined(CYTHON_IMMORTAL_CONSTANTS)
    #define CYTHON_IMMORTAL_CONSTANTS (PY_VERSION_HEX >= 0x030C0000 && !CYTHON_USE_MODULE_STATE && CYTHON_COMPILING_IN_CPYTHON_FREETHREADING)
  #endif
#endif
#ifndef CYTHON_COMPRESS_STRINGS
  #define CYTHON_COMPRESS_STRINGS 1
#endif
#ifndef CYTHON_FAST_PYCCALL
#define CYTHON_FAST_PYCCALL  CYTHON_FAST_PYCALL
#endif
#ifndef CYTHON_VECTORCALL
#if CYTHON_COMPILING_IN_LIMITED_API
#define CYTHON_VECTORCALL  (__PYX_LIMITED_VERSION_HEX >= 0x030C0000)
#else
#define CYTHON_VECTORCALL  (CYTHON_FAST_PYCCALL)
#endif
#endif
#if CYTHON_USE_PYLONG_INTERNALS
  #undef SHIFT
  #undef BASE
  #undef MASK
  #ifdef SIZEOF_VOID_P
    enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
  #endif
#endif
#ifndef __has_attribute
  #define __has_attribute(x) 0
#endif
#ifndef __has_cpp_attribute
  #define __has_cpp_attribute(x) 0
#endif
#ifndef CYTHON_RESTRICT
  #if defined(__GNUC__)
    #define CYTHON_RESTRICT __restrict__
  #elif defined(_MSC_VER) && _MSC_VER >= 1400
    #define CYTHON_RESTRICT __restrict
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_RESTRICT restrict
  #else
    #define CYTHON_RESTRICT
  #endif
#endif
#ifndef CYTHON_UNUSED
  #if defined(__cplusplus)
    /* for clang __has_cpp_attribute(maybe_unused) is true even before C++17
     * but leads to warnings with -pedantic, since it is a C++17 feature */
    #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
      #if __has_cpp_attribute(maybe_unused)
        #define CYTHON_UNUSED [[maybe_unused]]
      #endif
    #endif
  #endif
#endif
#ifndef CYTHON_UNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#     define CYTHON_UNUSED __attribute__ ((__unused__))
#   else
#     define CYTHON_UNUSED
#   endif
# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
#   define CYTHON_UNUSED __attribute__ ((__unused__))
# else
#   define CYTHON_UNUSED
# endif
#endif
#ifndef CYTHON_UNUSED_VAR
#  if defined(__cplusplus)
     template<class T> void CYTHON_UNUSED_VAR( const T& ) { }
#  else
#    define CYTHON_UNUSED_VAR(x) (void)(x)
#  endif
#endif
#ifndef CYTHON_MAYBE_UNUSED_VAR
  #define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x)
#endif
#ifndef CYTHON_NCP_UNUSED
# if CYTHON_COMPILING_IN_CPYTHON && !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
#  define CYTHON_NCP_UNUSED
# else
#  define CYTHON_NCP_UNUSED CYTHON_UNUSED
# endif
#endif
#ifndef CYTHON_USE_CPP_STD_MOVE
  #if defined(__cplusplus) && (\
    __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600))
    #define CYTHON_USE_CPP_STD_MOVE 1
  #else
    #define CYTHON_USE_CPP_STD_MOVE 0
  #endif
#endif
#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
#include <stdint.h>
typedef uintptr_t  __pyx_uintptr_t;
#ifndef CYTHON_FALLTHROUGH
  #if defined(__cplusplus)
    /* for clang __has_cpp_attribute(fallthrough) is true even before C++17
     * but leads to warnings with -pedantic, since it is a C++17 feature */
    #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
      #if __has_cpp_attribute(fallthrough)
        #define CYTHON_FALLTHROUGH [[fallthrough]]
      #endif
    #endif
    #ifndef CYTHON_FALLTHROUGH
      #if __has_cpp_attribute(clang::fallthrough)
        #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
      #elif __has_cpp_attribute(gnu::fallthrough)
        #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
      #endif
    #endif
  #endif
  #ifndef CYTHON_FALLTHROUGH
    #if __has_attribute(fallthrough)
      #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
    #else
      #define CYTHON_FALLTHROUGH
    #endif
  #endif
  #if defined(__clang__) && defined(__apple_build_version__)
    #if __apple_build_version__ < 7000000
      #undef  CYTHON_FALLTHROUGH
      #define CYTHON_FALLTHROUGH
    #endif
  #endif
#endif
#ifndef Py_UNREACHABLE
  #define Py_UNREACHABLE()  assert(0); abort()
#endif
#ifdef __cplusplus
  template <typename T>
  struct __PYX_IS_UNSIGNED_IMPL {static const bool value = T(0) < T(-1);};
  #define __PYX_IS_UNSIGNED(type) (__PYX_IS_UNSIGNED_IMPL<type>::value)
#else
  #define __PYX_IS_UNSIGNED(type) (((type)-1) > 0)
#endif
#if CYTHON_COMPILING_IN_PYPY == 1
  #define __PYX_NEED_TP_PRINT_SLOT  (PY_VERSION_HEX < 0x030A0000)
#else
  #define __PYX_NEED_TP_PRINT_SLOT  (PY_VERSION_HEX < 0x03090000)
#endif
#define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer))

/* CInitCode */
#ifndef CYTHON_INLINE
  #if defined(__clang__)
    #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
  #elif defined(__GNUC__)
    #define CYTHON_INLINE __inline__
  #elif defined(_MSC_VER)
    #define CYTHON_INLINE __inline
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_INLINE inline
  #else
    #define CYTHON_INLINE
  #endif
#endif

/* PythonCompatibility */
#define __PYX_BUILD_PY_SSIZE_T "n"
#define CYTHON_FORMAT_SSIZE_T "z"
#define __Pyx_BUILTIN_MODULE_NAME "builtins"
#define __Pyx_DefaultClassType PyType_Type
#if CYTHON_COMPILING_IN_LIMITED_API
    #ifndef CO_OPTIMIZED
    static int CO_OPTIMIZED;
    #endif
    #ifndef CO_NEWLOCALS
    static int CO_NEWLOCALS;
    #endif
    #ifndef CO_VARARGS
    static int CO_VARARGS;
    #endif
    #ifndef CO_VARKEYWORDS
    static int CO_VARKEYWORDS;
    #endif
    #ifndef CO_ASYNC_GENERATOR
    static int CO_ASYNC_GENERATOR;
    #endif
    #ifndef CO_GENERATOR
    static int CO_GENERATOR;
    #endif
    #ifndef CO_COROUTINE
    static int CO_COROUTINE;
    #endif
#else
    #ifndef CO_COROUTINE
      #define CO_COROUTINE 0x80
    #endif
    #ifndef CO_ASYNC_GENERATOR
      #define CO_ASYNC_GENERATOR 0x200
    #endif
#endif
static int __Pyx_init_co_variables(void);
#if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE)
  #define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type)
#else
  #define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type))
#endif
#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_Is)
  #define __Pyx_Py_Is(x, y)  Py_Is(x, y)
#else
  #define __Pyx_Py_Is(x, y) ((x) == (y))
#endif
#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsNone)
  #define __Pyx_Py_IsNone(ob) Py_IsNone(ob)
#else
  #define __Pyx_Py_IsNone(ob) __Pyx_Py_Is((ob), Py_None)
#endif
#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsTrue)
  #define __Pyx_Py_IsTrue(ob) Py_IsTrue(ob)
#else
  #define __Pyx_Py_IsTrue(ob) __Pyx_Py_Is((ob), Py_True)
#endif
#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsFalse)
  #define __Pyx_Py_IsFalse(ob) Py_IsFalse(ob)
#else
  #define __Pyx_Py_IsFalse(ob) __Pyx_Py_Is((ob), Py_False)
#endif
#define __Pyx_NoneAsNull(obj)  (__Pyx_Py_IsNone(obj) ? NULL : (obj))
#if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY
  #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o)
#else
  #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o)
#endif
#ifndef Py_TPFLAGS_CHECKTYPES
  #define Py_TPFLAGS_CHECKTYPES 0
#endif
#ifndef Py_TPFLAGS_HAVE_INDEX
  #define Py_TPFLAGS_HAVE_INDEX 0
#endif
#ifndef Py_TPFLAGS_HAVE_NEWBUFFER
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
#ifndef Py_TPFLAGS_HAVE_FINALIZE
  #define Py_TPFLAGS_HAVE_FINALIZE 0
#endif
#ifndef Py_TPFLAGS_SEQUENCE
  #define Py_TPFLAGS_SEQUENCE 0
#endif
#ifndef Py_TPFLAGS_MAPPING
  #define Py_TPFLAGS_MAPPING 0
#endif
#ifndef Py_TPFLAGS_IMMUTABLETYPE
  #define Py_TPFLAGS_IMMUTABLETYPE (1UL << 8)
#endif
#ifndef Py_TPFLAGS_DISALLOW_INSTANTIATION
  #define Py_TPFLAGS_DISALLOW_INSTANTIATION (1UL << 7)
#endif
#ifndef METH_STACKLESS
  #define METH_STACKLESS 0
#endif
#ifndef METH_FASTCALL
  #ifndef METH_FASTCALL
     #define METH_FASTCALL 0x80
  #endif
  typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
  typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
                                                          Py_ssize_t nargs, PyObject *kwnames);
#else
  #if PY_VERSION_HEX >= 0x030d00A4
  #  define __Pyx_PyCFunctionFast PyCFunctionFast
  #  define __Pyx_PyCFunctionFastWithKeywords PyCFunctionFastWithKeywords
  #else
  #  define __Pyx_PyCFunctionFast _PyCFunctionFast
  #  define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
  #endif
#endif
#if CYTHON_METH_FASTCALL
  #define __Pyx_METH_FASTCALL METH_FASTCALL
  #define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast
  #define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords
#else
  #define __Pyx_METH_FASTCALL METH_VARARGS
  #define __Pyx_PyCFunction_FastCall PyCFunction
  #define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords
#endif
#if CYTHON_VECTORCALL
  #define __pyx_vectorcallfunc vectorcallfunc
  #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET  PY_VECTORCALL_ARGUMENTS_OFFSET
  #define __Pyx_PyVectorcall_NARGS(n)  PyVectorcall_NARGS((size_t)(n))
#else
  #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET  0
  #define __Pyx_PyVectorcall_NARGS(n)  ((Py_ssize_t)(n))
#endif
#if PY_VERSION_HEX >= 0x030900B1
#define __Pyx_PyCFunction_CheckExact(func)  PyCFunction_CheckExact(func)
#else
#define __Pyx_PyCFunction_CheckExact(func)  PyCFunction_Check(func)
#endif
#define __Pyx_CyOrPyCFunction_Check(func)  PyCFunction_Check(func)
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_CyOrPyCFunction_GET_FUNCTION(func)  (((PyCFunctionObject*)(func))->m_ml->ml_meth)
#elif !CYTHON_COMPILING_IN_LIMITED_API
#define __Pyx_CyOrPyCFunction_GET_FUNCTION(func)  PyCFunction_GET_FUNCTION(func)
#endif
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_CyOrPyCFunction_GET_FLAGS(func)  (((PyCFunctionObject*)(func))->m_ml->ml_flags)
static CYTHON_INLINE PyObject* __Pyx_CyOrPyCFunction_GET_SELF(PyObject *func) {
    return (__Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_STATIC) ? NULL : ((PyCFunctionObject*)func)->m_self;
}
#endif
static CYTHON_INLINE int __Pyx__IsSameCFunction(PyObject *func, void (*cfunc)(void)) {
#if CYTHON_COMPILING_IN_LIMITED_API
    return PyCFunction_Check(func) && PyCFunction_GetFunction(func) == (PyCFunction) cfunc;
#else
    return PyCFunction_Check(func) && PyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc;
#endif
}
#define __Pyx_IsSameCFunction(func, cfunc)   __Pyx__IsSameCFunction(func, cfunc)
#if PY_VERSION_HEX < 0x03090000 || (CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000)
  #define __Pyx_PyType_FromModuleAndSpec(m, s, b)  ((void)m, PyType_FromSpecWithBases(s, b))
  typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, size_t, PyObject *);
#else
  #define __Pyx_PyType_FromModuleAndSpec(m, s, b)  PyType_FromModuleAndSpec(m, s, b)
  #define __Pyx_PyCMethod  PyCMethod
#endif
#ifndef METH_METHOD
  #define METH_METHOD 0x200
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
  #define PyObject_Malloc(s)   PyMem_Malloc(s)
  #define PyObject_Free(p)     PyMem_Free(p)
  #define PyObject_Realloc(p)  PyMem_Realloc(p)
#endif
#if CYTHON_COMPILING_IN_LIMITED_API
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno)
#elif CYTHON_COMPILING_IN_GRAAL && defined(GRAALPY_VERSION_NUM) && GRAALPY_VERSION_NUM > 0x19000000
  #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno) GraalPyFrame_SetLineNumber((frame), (lineno))
#elif CYTHON_COMPILING_IN_GRAAL
  #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno) _PyFrame_SetLineNumber((frame), (lineno))
#else
  #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
#endif
#if CYTHON_COMPILING_IN_LIMITED_API
  #define __Pyx_PyThreadState_Current PyThreadState_Get()
#elif !CYTHON_FAST_THREAD_STATE
  #define __Pyx_PyThreadState_Current PyThreadState_GET()
#elif PY_VERSION_HEX >= 0x030d00A1
  #define __Pyx_PyThreadState_Current PyThreadState_GetUnchecked()
#else
  #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
#endif
#if CYTHON_USE_MODULE_STATE
static CYTHON_INLINE void *__Pyx__PyModule_GetState(PyObject *op)
{
    void *result;
    result = PyModule_GetState(op);
    if (!result)
        Py_FatalError("Couldn't find the module state");
    return result;
}
#define __Pyx_PyModule_GetState(o) (__pyx_mstatetype *)__Pyx__PyModule_GetState(o)
#else
#define __Pyx_PyModule_GetState(op) ((void)op,__pyx_mstate_global)
#endif
#define __Pyx_PyObject_GetSlot(obj, name, func_ctype)  __Pyx_PyType_GetSlot(Py_TYPE((PyObject *) obj), name, func_ctype)
#define __Pyx_PyObject_TryGetSlot(obj, name, func_ctype) __Pyx_PyType_TryGetSlot(Py_TYPE(obj), name, func_ctype)
#define __Pyx_PyObject_GetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_GetSubSlot(Py_TYPE(obj), sub, name, func_ctype)
#define __Pyx_PyObject_TryGetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_TryGetSubSlot(Py_TYPE(obj), sub, name, func_ctype)
#if CYTHON_USE_TYPE_SLOTS
  #define __Pyx_PyType_GetSlot(type, name, func_ctype)  ((type)->name)
  #define __Pyx_PyType_TryGetSlot(type, name, func_ctype) __Pyx_PyType_GetSlot(type, name, func_ctype)
  #define __Pyx_PyType_GetSubSlot(type, sub, name, func_ctype) (((type)->sub) ? ((type)->sub->name) : NULL)
  #define __Pyx_PyType_TryGetSubSlot(type, sub, name, func_ctype) __Pyx_PyType_GetSubSlot(type, sub, name, func_ctype)
#else
  #define __Pyx_PyType_GetSlot(type, name, func_ctype)  ((func_ctype) PyType_GetSlot((type), Py_##name))
  #define __Pyx_PyType_TryGetSlot(type, name, func_ctype)\
    ((__PYX_LIMITED_VERSION_HEX >= 0x030A0000 ||\
     (PyType_GetFlags(type) & Py_TPFLAGS_HEAPTYPE) || __Pyx_get_runtime_version() >= 0x030A0000) ?\
     __Pyx_PyType_GetSlot(type, name, func_ctype) : NULL)
  #define __Pyx_PyType_GetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_GetSlot(obj, name, func_ctype)
  #define __Pyx_PyType_TryGetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_TryGetSlot(obj, name, func_ctype)
#endif
#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
#define __Pyx_PyDict_NewPresized(n)  ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
#else
#define __Pyx_PyDict_NewPresized(n)  PyDict_New()
#endif
#define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
#define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_UNICODE_INTERNALS
#define __Pyx_PyDict_GetItemStrWithError(dict, name)  _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) {
    PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name);
    if (res == NULL) PyErr_Clear();
    return res;
}
#elif !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000
#define __Pyx_PyDict_GetItemStrWithError  PyDict_GetItemWithError
#define __Pyx_PyDict_GetItemStr           PyDict_GetItem
#else
static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) {
#if CYTHON_COMPILING_IN_PYPY
    return PyDict_GetItem(dict, name);
#else
    PyDictEntry *ep;
    PyDictObject *mp = (PyDictObject*) dict;
    long hash = ((PyStringObject *) name)->ob_shash;
    assert(hash != -1);
    ep = (mp->ma_lookup)(mp, name, hash);
    if (ep == NULL) {
        return NULL;
    }
    return ep->me_value;
#endif
}
#define __Pyx_PyDict_GetItemStr           PyDict_GetItem
#endif
#if CYTHON_USE_TYPE_SLOTS
  #define __Pyx_PyType_GetFlags(tp)   (((PyTypeObject *)tp)->tp_flags)
  #define __Pyx_PyType_HasFeature(type, feature)  ((__Pyx_PyType_GetFlags(type) & (feature)) != 0)
#else
  #define __Pyx_PyType_GetFlags(tp)   (PyType_GetFlags((PyTypeObject *)tp))
  #define __Pyx_PyType_HasFeature(type, feature)  PyType_HasFeature(type, feature)
#endif
#define __Pyx_PyObject_GetIterNextFunc(iterator)  __Pyx_PyObject_GetSlot(iterator, tp_iternext, iternextfunc)
#if CYTHON_USE_TYPE_SPECS
#define __Pyx_PyHeapTypeObject_GC_Del(obj)  {\
    PyTypeObject *type = Py_TYPE((PyObject*)obj);\
    assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\
    PyObject_GC_Del(obj);\
    Py_DECREF(type);\
}
#else
#define __Pyx_PyHeapTypeObject_GC_Del(obj)  PyObject_GC_Del(obj)
#endif
#if CYTHON_COMPILING_IN_LIMITED_API
  #define __Pyx_PyUnicode_READY(op)       (0)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i)
  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   ((void)u, 1114111U)
  #define __Pyx_PyUnicode_KIND(u)         ((void)u, (0))
  #define __Pyx_PyUnicode_DATA(u)         ((void*)u)
  #define __Pyx_PyUnicode_READ(k, d, i)   ((void)k, PyUnicode_ReadChar((PyObject*)(d), i))
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GetLength(u))
#else
  #if PY_VERSION_HEX >= 0x030C0000
    #define __Pyx_PyUnicode_READY(op)       (0)
  #else
    #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
                                                0 : _PyUnicode_Ready((PyObject *)(op)))
  #endif
  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   PyUnicode_MAX_CHAR_VALUE(u)
  #define __Pyx_PyUnicode_KIND(u)         ((int)PyUnicode_KIND(u))
  #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
  #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
  #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  PyUnicode_WRITE(k, d, i, (Py_UCS4) ch)
  #if PY_VERSION_HEX >= 0x030C0000
    #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_LENGTH(u))
  #else
    #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000
    #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length))
    #else
    #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
    #endif
  #endif
#endif
#if CYTHON_COMPILING_IN_PYPY
  #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
#else
  #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
      PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
#endif
#if CYTHON_COMPILING_IN_PYPY
  #if !defined(PyUnicode_DecodeUnicodeEscape)
    #define PyUnicode_DecodeUnicodeEscape(s, size, errors)  PyUnicode_Decode(s, size, "unicode_escape", errors)
  #endif
  #if !defined(PyUnicode_Contains)
    #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
  #endif
  #if !defined(PyByteArray_Check)
    #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
  #endif
  #if !defined(PyObject_Format)
    #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
  #endif
#endif
#define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  #define __Pyx_PySequence_ListKeepNew(obj)\
    (likely(PyList_CheckExact(obj) && PyUnstable_Object_IsUniquelyReferenced(obj)) ? __Pyx_NewRef(obj) : PySequence_List(obj))
#elif CYTHON_COMPILING_IN_CPYTHON
  #define __Pyx_PySequence_ListKeepNew(obj)\
    (likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj))
#else
  #define __Pyx_PySequence_ListKeepNew(obj)  PySequence_List(obj)
#endif
#ifndef PySet_CheckExact
  #define PySet_CheckExact(obj)        __Pyx_IS_TYPE(obj, &PySet_Type)
#endif
#if PY_VERSION_HEX >= 0x030900A4
  #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
  #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
#else
  #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
  #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
#endif
enum __Pyx_ReferenceSharing {
  __Pyx_ReferenceSharing_DefinitelyUnique, // We created it so we know it's unshared - no need to check
  __Pyx_ReferenceSharing_OwnStrongReference,
  __Pyx_ReferenceSharing_FunctionArgument,
  __Pyx_ReferenceSharing_SharedReference, // Never trust it to be unshared because it's a global or similar
};
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && PY_VERSION_HEX >= 0x030E0000
#define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing)\
    (sharing == __Pyx_ReferenceSharing_DefinitelyUnique ? 1 :\
      (sharing == __Pyx_ReferenceSharing_FunctionArgument ? PyUnstable_Object_IsUniqueReferencedTemporary(o) :\
      (sharing == __Pyx_ReferenceSharing_OwnStrongReference ? PyUnstable_Object_IsUniquelyReferenced(o) : 0)))
#elif (CYTHON_COMPILING_IN_CPYTHON && !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING) || CYTHON_COMPILING_IN_LIMITED_API
#define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing) (((void)sharing), Py_REFCNT(o) == 1)
#else
#define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing) (((void)o), ((void)sharing), 0)
#endif
#if CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
  #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
    #define __Pyx_PyList_GetItemRef(o, i) PyList_GetItemRef(o, i)
  #elif CYTHON_COMPILING_IN_LIMITED_API || !CYTHON_ASSUME_SAFE_MACROS
    #define __Pyx_PyList_GetItemRef(o, i) (likely((i) >= 0) ? PySequence_GetItem(o, i) : (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
  #else
    #define __Pyx_PyList_GetItemRef(o, i) PySequence_ITEM(o, i)
  #endif
#elif CYTHON_COMPILING_IN_LIMITED_API || !CYTHON_ASSUME_SAFE_MACROS
  #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
    #define __Pyx_PyList_GetItemRef(o, i) PyList_GetItemRef(o, i)
  #else
    #define __Pyx_PyList_GetItemRef(o, i) __Pyx_XNewRef(PyList_GetItem(o, i))
  #endif
#else
  #define __Pyx_PyList_GetItemRef(o, i) __Pyx_NewRef(PyList_GET_ITEM(o, i))
#endif
#if CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS && !CYTHON_COMPILING_IN_LIMITED_API && CYTHON_ASSUME_SAFE_MACROS
  #define __Pyx_PyList_GetItemRefFast(o, i, unsafe_shared) (__Pyx_IS_UNIQUELY_REFERENCED(o, unsafe_shared) ?\
    __Pyx_NewRef(PyList_GET_ITEM(o, i)) : __Pyx_PyList_GetItemRef(o, i))
#else
  #define __Pyx_PyList_GetItemRefFast(o, i, unsafe_shared) __Pyx_PyList_GetItemRef(o, i)
#endif
#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
#define __Pyx_PyDict_GetItemRef(dict, key, result) PyDict_GetItemRef(dict, key, result)
#elif CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
static CYTHON_INLINE int __Pyx_PyDict_GetItemRef(PyObject *dict, PyObject *key, PyObject **result) {
  *result = PyObject_GetItem(dict, key);
  if (*result == NULL) {
    if (PyErr_ExceptionMatches(PyExc_KeyError)) {
      PyErr_Clear();
      return 0;
    }
    return -1;
  }
  return 1;
}
#else
static CYTHON_INLINE int __Pyx_PyDict_GetItemRef(PyObject *dict, PyObject *key, PyObject **result) {
  *result = PyDict_GetItemWithError(dict, key);
  if (*result == NULL) {
    return PyErr_Occurred() ? -1 : 0;
  }
  Py_INCREF(*result);
  return 1;
}
#endif
#if defined(CYTHON_DEBUG_VISIT_CONST) && CYTHON_DEBUG_VISIT_CONST
  #define __Pyx_VISIT_CONST(obj)  Py_VISIT(obj)
#else
  #define __Pyx_VISIT_CONST(obj)
#endif
#if CYTHON_ASSUME_SAFE_MACROS
  #define __Pyx_PySequence_ITEM(o, i) PySequence_ITEM(o, i)
  #define __Pyx_PySequence_SIZE(seq)  Py_SIZE(seq)
  #define __Pyx_PyTuple_SET_ITEM(o, i, v) (PyTuple_SET_ITEM(o, i, v), (0))
  #define __Pyx_PyTuple_GET_ITEM(o, i) PyTuple_GET_ITEM(o, i)
  #define __Pyx_PyList_SET_ITEM(o, i, v) (PyList_SET_ITEM(o, i, v), (0))
  #define __Pyx_PyList_GET_ITEM(o, i) PyList_GET_ITEM(o, i)
#else
  #define __Pyx_PySequence_ITEM(o, i) PySequence_GetItem(o, i)
  #define __Pyx_PySequence_SIZE(seq)  PySequence_Size(seq)
  #define __Pyx_PyTuple_SET_ITEM(o, i, v) PyTuple_SetItem(o, i, v)
  #define __Pyx_PyTuple_GET_ITEM(o, i) PyTuple_GetItem(o, i)
  #define __Pyx_PyList_SET_ITEM(o, i, v) PyList_SetItem(o, i, v)
  #define __Pyx_PyList_GET_ITEM(o, i) PyList_GetItem(o, i)
#endif
#if CYTHON_ASSUME_SAFE_SIZE
  #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_GET_SIZE(o)
  #define __Pyx_PyList_GET_SIZE(o) PyList_GET_SIZE(o)
  #define __Pyx_PySet_GET_SIZE(o) PySet_GET_SIZE(o)
  #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_GET_SIZE(o)
  #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_GET_SIZE(o)
  #define __Pyx_PyUnicode_GET_LENGTH(o) PyUnicode_GET_LENGTH(o)
#else
  #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_Size(o)
  #define __Pyx_PyList_GET_SIZE(o) PyList_Size(o)
  #define __Pyx_PySet_GET_SIZE(o) PySet_Size(o)
  #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_Size(o)
  #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_Size(o)
  #define __Pyx_PyUnicode_GET_LENGTH(o) PyUnicode_GetLength(o)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_InternFromString)
  #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
#endif
#define __Pyx_PyLong_FromHash_t PyLong_FromSsize_t
#define __Pyx_PyLong_AsHash_t   __Pyx_PyIndex_AsSsize_t
#if __PYX_LIMITED_VERSION_HEX >= 0x030A0000
    #define __Pyx_PySendResult PySendResult
#else
    typedef enum {
        PYGEN_RETURN = 0,
        PYGEN_ERROR = -1,
        PYGEN_NEXT = 1,
    } __Pyx_PySendResult;
#endif
#if CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX < 0x030A00A3
  typedef __Pyx_PySendResult (*__Pyx_pyiter_sendfunc)(PyObject *iter, PyObject *value, PyObject **result);
#else
  #define __Pyx_pyiter_sendfunc sendfunc
#endif
#if !CYTHON_USE_AM_SEND
#define __PYX_HAS_PY_AM_SEND 0
#elif __PYX_LIMITED_VERSION_HEX >= 0x030A0000
#define __PYX_HAS_PY_AM_SEND 1
#else
#define __PYX_HAS_PY_AM_SEND 2  // our own backported implementation
#endif
#if __PYX_HAS_PY_AM_SEND < 2
    #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
#else
    typedef struct {
        unaryfunc am_await;
        unaryfunc am_aiter;
        unaryfunc am_anext;
        __Pyx_pyiter_sendfunc am_send;
    } __Pyx_PyAsyncMethodsStruct;
    #define __Pyx_SlotTpAsAsync(s) ((PyAsyncMethods*)(s))
#endif
#if CYTHON_USE_AM_SEND && PY_VERSION_HEX < 0x030A00F0
    #define __Pyx_TPFLAGS_HAVE_AM_SEND (1UL << 21)
#else
    #define __Pyx_TPFLAGS_HAVE_AM_SEND (0)
#endif
#if PY_VERSION_HEX >= 0x03090000
#define __Pyx_PyInterpreterState_Get() PyInterpreterState_Get()
#else
#define __Pyx_PyInterpreterState_Get() PyThreadState_Get()->interp
#endif
#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030A0000
#ifdef __cplusplus
extern "C"
#endif
PyAPI_FUNC(void *) PyMem_Calloc(size_t nelem, size_t elsize);
#endif
#if CYTHON_COMPILING_IN_LIMITED_API
static int __Pyx_init_co_variable(PyObject *inspect, const char* name, int *write_to) {
    int value;
    PyObject *py_value = PyObject_GetAttrString(inspect, name);
    if (!py_value) return 0;
    value = (int) PyLong_AsLong(py_value);
    Py_DECREF(py_value);
    *write_to = value;
    return value != -1 || !PyErr_Occurred();
}
static int __Pyx_init_co_variables(void) {
    PyObject *inspect;
    int result;
    inspect = PyImport_ImportModule("inspect");
    result =
#if !defined(CO_OPTIMIZED)
        __Pyx_init_co_variable(inspect, "CO_OPTIMIZED", &CO_OPTIMIZED) &&
#endif
#if !defined(CO_NEWLOCALS)
        __Pyx_init_co_variable(inspect, "CO_NEWLOCALS", &CO_NEWLOCALS) &&
#endif
#if !defined(CO_VARARGS)
        __Pyx_init_co_variable(inspect, "CO_VARARGS", &CO_VARARGS) &&
#endif
#if !defined(CO_VARKEYWORDS)
        __Pyx_init_co_variable(inspect, "CO_VARKEYWORDS", &CO_VARKEYWORDS) &&
#endif
#if !defined(CO_ASYNC_GENERATOR)
        __Pyx_init_co_variable(inspect, "CO_ASYNC_GENERATOR", &CO_ASYNC_GENERATOR) &&
#endif
#if !defined(CO_GENERATOR)
        __Pyx_init_co_variable(inspect, "CO_GENERATOR", &CO_GENERATOR) &&
#endif
#if !defined(CO_COROUTINE)
        __Pyx_init_co_variable(inspect, "CO_COROUTINE", &CO_COROUTINE) &&
#endif
        1;
    Py_DECREF(inspect);
    return result ? 0 : -1;
}
#else
static int __Pyx_init_co_variables(void) {
    return 0;  // It's a limited API-only feature
}
#endif

/* MathInitCode */
#if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)
  #ifndef _USE_MATH_DEFINES
    #define _USE_MATH_DEFINES
  #endif
#endif
#include <math.h>
#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
#define __Pyx_truncl trunc
#else
#define __Pyx_truncl truncl
#endif

#ifndef CYTHON_CLINE_IN_TRACEBACK_RUNTIME
#define CYTHON_CLINE_IN_TRACEBACK_RUNTIME 0
#endif
#ifndef CYTHON_CLINE_IN_TRACEBACK
#define CYTHON_CLINE_IN_TRACEBACK CYTHON_CLINE_IN_TRACEBACK_RUNTIME
#endif
#if CYTHON_CLINE_IN_TRACEBACK
#define __PYX_MARK_ERR_POS(f_index, lineno)  { __pyx_filename = __pyx_f[f_index]; (void) __pyx_filename; __pyx_lineno = lineno; (void) __pyx_lineno; __pyx_clineno = __LINE__; (void) __pyx_clineno; }
#else
#define __PYX_MARK_ERR_POS(f_index, lineno)  { __pyx_filename = __pyx_f[f_index]; (void) __pyx_filename; __pyx_lineno = lineno; (void) __pyx_lineno; (void) __pyx_clineno; }
#endif
#define __PYX_ERR(f_index, lineno, Ln_error) \
    { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }

#ifdef CYTHON_EXTERN_C
    #undef __PYX_EXTERN_C
    #define __PYX_EXTERN_C CYTHON_EXTERN_C
#elif defined(__PYX_EXTERN_C)
    #ifdef _MSC_VER
    #pragma message ("Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.")
    #else
    #warning Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.
    #endif
#else
  #ifdef __cplusplus
    #define __PYX_EXTERN_C extern "C"
  #else
    #define __PYX_EXTERN_C extern
  #endif
#endif

#define __PYX_HAVE__lxml__etree
#define __PYX_HAVE_API__lxml__etree
/* Early includes */
#include <string.h>
#include <stdio.h>
#include "pythread.h"
#include "includes/etree_defs.h"

    #ifndef PY_BIG_ENDIAN

    #ifdef _MSC_VER
    typedef unsigned __int32 uint32_t;
    #else
    #include <stdint.h>
    #endif

    static CYTHON_INLINE int _lx__is_big_endian(void) {
        union {uint32_t i; char c[4];} x = {0x01020304};
        return x.c[0] == 1;
    }
    #define PY_BIG_ENDIAN _lx__is_big_endian()
    #endif
    
#include "lxml-version.h"
#include "libxml/xmlversion.h"

    static const char* const _lxml_lib_features[] = {
#ifdef LIBXML_HTML_ENABLED
        "html",
#endif
#ifdef LIBXML_FTP_ENABLED
        "ftp",
#endif
#ifdef LIBXML_HTTP_ENABLED
        "http",
#endif
#ifdef LIBXML_CATALOG_ENABLED
        "catalog",
#endif
#ifdef LIBXML_XPATH_ENABLED
        "xpath",
#endif
#ifdef LIBXML_ICONV_ENABLED
        "iconv",
#endif
#ifdef LIBXML_ICU_ENABLED
        "icu",
#endif
#ifdef LIBXML_REGEXP_ENABLED
        "regexp",
#endif
#ifdef LIBXML_SCHEMAS_ENABLED
        "xmlschema",
#endif
#ifdef LIBXML_SCHEMATRON_ENABLED
        "schematron",
#endif
#ifdef LIBXML_ZLIB_ENABLED
        "zlib",
#endif
#ifdef LIBXML_LZMA_ENABLED
        "lzma",
#endif
        0
    };
    
#include "libxml/xmlstring.h"
#include "libxml/encoding.h"
#include "libxml/chvalid.h"
#include "libxml/hash.h"
#include "libxml/tree.h"
#include "libxml/uri.h"
#include "libxml/HTMLtree.h"
#include "libxml/valid.h"
#include "libxml/xmlIO.h"
#include "libxml/xmlsave.h"
#include "libxml/globals.h"
#include "libxml/xmlmemory.h"
#include "etree_defs.h"
#include "libxml/xmlerror.h"
#include "libxml/xpath.h"
#include "libxml/xpathInternals.h"
#include "libxml/c14n.h"
#include <limits.h>
#include <stdlib.h>

    #ifdef ZLIB_VERNUM
      #define __lxml_zlib_version (ZLIB_VERNUM >> 4)
    #else
      #define __lxml_zlib_version 0
    #endif
    #ifdef _LIBICONV_VERSION
      #define __lxml_iconv_version (_LIBICONV_VERSION << 8)
    #else
      #define __lxml_iconv_version 0
    #endif
    
#include "stdarg.h"
#include "libxml/parser.h"
#include "libxml/SAX2.h"
#include "libxml/parserInternals.h"

    #if LIBXML_VERSION < 21400
    #define xmlNewInputFromMemory(url, mem, size, flags)  (NULL)
    #endif
    
#include "libxml/HTMLparser.h"
#include "libxml/xinclude.h"
#include "libxslt/xslt.h"
#include "libxslt/xsltconfig.h"
#include "libxslt/xsltInternals.h"
#include "libxslt/imports.h"
#include "libxslt/extensions.h"
#include "libxslt/documents.h"
#include "libxslt/transform.h"
#include "libxslt/xsltutils.h"
#include "libxslt/security.h"
#include "libxslt/variables.h"
#include "libxslt/extra.h"
#include "libexslt/exslt.h"
#include "libxml/relaxng.h"
#include "libxml/xmlschemas.h"
#include "libxml/schematron.h"
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
#define CYTHON_WITHOUT_ASSERTIONS
#endif

#ifdef CYTHON_FREETHREADING_COMPATIBLE
#if CYTHON_FREETHREADING_COMPATIBLE
#define __Pyx_FREETHREADING_COMPATIBLE Py_MOD_GIL_NOT_USED
#else
#define __Pyx_FREETHREADING_COMPATIBLE Py_MOD_GIL_USED
#endif
#else
#define __Pyx_FREETHREADING_COMPATIBLE Py_MOD_GIL_USED
#endif
#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
#define __PYX_DEFAULT_STRING_ENCODING ""
#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#define __Pyx_uchar_cast(c) ((unsigned char)c)
#define __Pyx_long_cast(x) ((long)x)
#define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (\
    (sizeof(type) < sizeof(Py_ssize_t))  ||\
    (sizeof(type) > sizeof(Py_ssize_t) &&\
          likely(v < (type)PY_SSIZE_T_MAX ||\
                 v == (type)PY_SSIZE_T_MAX)  &&\
          (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
                                v == (type)PY_SSIZE_T_MIN)))  ||\
    (sizeof(type) == sizeof(Py_ssize_t) &&\
          (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
                               v == (type)PY_SSIZE_T_MAX)))  )
static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
    return (size_t) i < (size_t) limit;
}
#if defined (__cplusplus) && __cplusplus >= 201103L
    #include <cstdlib>
    #define __Pyx_sst_abs(value) std::abs(value)
#elif SIZEOF_INT >= SIZEOF_SIZE_T
    #define __Pyx_sst_abs(value) abs(value)
#elif SIZEOF_LONG >= SIZEOF_SIZE_T
    #define __Pyx_sst_abs(value) labs(value)
#elif defined (_MSC_VER)
    #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define __Pyx_sst_abs(value) llabs(value)
#elif defined (__GNUC__)
    #define __Pyx_sst_abs(value) __builtin_llabs(value)
#else
    #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
#endif
static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s);
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char*);
#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
#define __Pyx_PyBytes_FromString        PyBytes_FromString
#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
#if CYTHON_ASSUME_SAFE_MACROS
    #define __Pyx_PyBytes_AsWritableString(s)     ((char*) PyBytes_AS_STRING(s))
    #define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AS_STRING(s))
    #define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AS_STRING(s))
    #define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AS_STRING(s))
    #define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AS_STRING(s))
    #define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AS_STRING(s))
    #define __Pyx_PyByteArray_AsString(s) PyByteArray_AS_STRING(s)
#else
    #define __Pyx_PyBytes_AsWritableString(s)     ((char*) PyBytes_AsString(s))
    #define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AsString(s))
    #define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AsString(s))
    #define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AsString(s))
    #define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AsString(s))
    #define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AsString(s))
    #define __Pyx_PyByteArray_AsString(s) PyByteArray_AsString(s)
#endif
#define __Pyx_PyObject_AsWritableString(s)    ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableSString(s)    ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableUString(s)    ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsSString(s)    ((const signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsUString(s)    ((const unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
#define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
#define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
#define __Pyx_PyUnicode_FromOrdinal(o)       PyUnicode_FromOrdinal((int)o)
#define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
static CYTHON_INLINE PyObject *__Pyx_NewRef(PyObject *obj) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030a0000 || defined(Py_NewRef)
    return Py_NewRef(obj);
#else
    Py_INCREF(obj);
    return obj;
#endif
}
static CYTHON_INLINE PyObject *__Pyx_XNewRef(PyObject *obj) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030a0000 || defined(Py_XNewRef)
    return Py_XNewRef(obj);
#else
    Py_XINCREF(obj);
    return obj;
#endif
}
static CYTHON_INLINE PyObject *__Pyx_Owned_Py_None(int b);
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Long(PyObject* x);
#define __Pyx_PySequence_Tuple(obj)\
    (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyLong_FromSize_t(size_t);
static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*);
#if CYTHON_ASSUME_SAFE_MACROS
#define __Pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
#define __Pyx_PyFloat_AS_DOUBLE(x) PyFloat_AS_DOUBLE(x)
#else
#define __Pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
#define __Pyx_PyFloat_AS_DOUBLE(x) PyFloat_AsDouble(x)
#endif
#define __Pyx_PyFloat_AsFloat(x) ((float) __Pyx_PyFloat_AsDouble(x))
#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
#if CYTHON_USE_PYLONG_INTERNALS
  #if PY_VERSION_HEX >= 0x030C00A7
  #ifndef _PyLong_SIGN_MASK
    #define _PyLong_SIGN_MASK 3
  #endif
  #ifndef _PyLong_NON_SIZE_BITS
    #define _PyLong_NON_SIZE_BITS 3
  #endif
  #define __Pyx_PyLong_Sign(x)  (((PyLongObject*)x)->long_value.lv_tag & _PyLong_SIGN_MASK)
  #define __Pyx_PyLong_IsNeg(x)  ((__Pyx_PyLong_Sign(x) & 2) != 0)
  #define __Pyx_PyLong_IsNonNeg(x)  (!__Pyx_PyLong_IsNeg(x))
  #define __Pyx_PyLong_IsZero(x)  (__Pyx_PyLong_Sign(x) & 1)
  #define __Pyx_PyLong_IsPos(x)  (__Pyx_PyLong_Sign(x) == 0)
  #define __Pyx_PyLong_CompactValueUnsigned(x)  (__Pyx_PyLong_Digits(x)[0])
  #define __Pyx_PyLong_DigitCount(x)  ((Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> _PyLong_NON_SIZE_BITS))
  #define __Pyx_PyLong_SignedDigitCount(x)\
        ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x))
  #if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue)
    #define __Pyx_PyLong_IsCompact(x)     PyUnstable_Long_IsCompact((PyLongObject*) x)
    #define __Pyx_PyLong_CompactValue(x)  PyUnstable_Long_CompactValue((PyLongObject*) x)
  #else
    #define __Pyx_PyLong_IsCompact(x)     (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS))
    #define __Pyx_PyLong_CompactValue(x)  ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0])
  #endif
  typedef Py_ssize_t  __Pyx_compact_pylong;
  typedef size_t  __Pyx_compact_upylong;
  #else
  #define __Pyx_PyLong_IsNeg(x)  (Py_SIZE(x) < 0)
  #define __Pyx_PyLong_IsNonNeg(x)  (Py_SIZE(x) >= 0)
  #define __Pyx_PyLong_IsZero(x)  (Py_SIZE(x) == 0)
  #define __Pyx_PyLong_IsPos(x)  (Py_SIZE(x) > 0)
  #define __Pyx_PyLong_CompactValueUnsigned(x)  ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0])
  #define __Pyx_PyLong_DigitCount(x)  __Pyx_sst_abs(Py_SIZE(x))
  #define __Pyx_PyLong_SignedDigitCount(x)  Py_SIZE(x)
  #define __Pyx_PyLong_IsCompact(x)  (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1)
  #define __Pyx_PyLong_CompactValue(x)\
        ((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0]))
  typedef sdigit  __Pyx_compact_pylong;
  typedef digit  __Pyx_compact_upylong;
  #endif
  #if PY_VERSION_HEX >= 0x030C00A5
  #define __Pyx_PyLong_Digits(x)  (((PyLongObject*)x)->long_value.ob_digit)
  #else
  #define __Pyx_PyLong_Digits(x)  (((PyLongObject*)x)->ob_digit)
  #endif
#endif
#if __PYX_DEFAULT_STRING_ENCODING_IS_UTF8
  #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
#elif __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeASCII(c_str, size, NULL)
#else
  #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
#endif


/* Test for GCC > 2.95 */
#if defined(__GNUC__)     && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
  #define likely(x)   __builtin_expect(!!(x), 1)
  #define unlikely(x) __builtin_expect(!!(x), 0)
#else /* !__GNUC__ or GCC < 2.95 */
  #define likely(x)   (x)
  #define unlikely(x) (x)
#endif /* __GNUC__ */
/* PretendToInitialize */
#ifdef __cplusplus
#if __cplusplus > 201103L
#include <type_traits>
#endif
template <typename T>
static void __Pyx_pretend_to_initialize(T* ptr) {
#if __cplusplus > 201103L
    if ((std::is_trivially_default_constructible<T>::value))
#endif
        *ptr = T();
    (void)ptr;
}
#else
static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
#endif


#if !CYTHON_USE_MODULE_STATE
static PyObject *__pyx_m = NULL;
#endif
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * const __pyx_cfilenm = __FILE__;
static const char *__pyx_filename;

/* #### Code section: filename_table ### */

static const char* const __pyx_f[] = {
  "src/lxml/etree.pyx",
  "src/lxml/xmlerror.pxi",
  "src/lxml/parser.pxi",
  "src/lxml/xslt.pxi",
  "src/lxml/apihelpers.pxi",
  "src/lxml/saxparser.pxi",
  "src/lxml/serializer.pxi",
  "<stringsource>",
  "src/lxml/proxy.pxi",
  "src/lxml/readonlytree.pxi",
  "src/lxml/classlookup.pxi",
  "src/lxml/nsclasses.pxi",
  "src/lxml/docloader.pxi",
  "src/lxml/parsertarget.pxi",
  "src/lxml/iterparse.pxi",
  "src/lxml/xmlid.pxi",
  "src/lxml/xinclude.pxi",
  "src/lxml/cleanup.pxi",
  "src/lxml/extensions.pxi",
  "src/lxml/xpath.pxi",
  "src/lxml/xsltext.pxi",
  "src/lxml/dtd.pxi",
  "src/lxml/relaxng.pxi",
  "src/lxml/xmlschema.pxi",
  "src/lxml/schematron.pxi",
  "src/lxml/public-api.pxi",
  "src/lxml/debug.pxi",
  "cpython/type.pxd",
};
/* #### Code section: utility_code_proto_before_types ### */
/* Atomics.proto (used by UnpackUnboundCMethod) */
#include <pythread.h>
#ifndef CYTHON_ATOMICS
    #define CYTHON_ATOMICS 1
#endif
#define __PYX_CYTHON_ATOMICS_ENABLED() CYTHON_ATOMICS
#define __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
#define __pyx_atomic_int_type int
#define __pyx_nonatomic_int_type int
#if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\
                        (__STDC_VERSION__ >= 201112L) &&\
                        !defined(__STDC_NO_ATOMICS__))
    #include <stdatomic.h>
#elif CYTHON_ATOMICS && (defined(__cplusplus) && (\
                    (__cplusplus >= 201103L) ||\
                    (defined(_MSC_VER) && _MSC_VER >= 1700)))
    #include <atomic>
#endif
#if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\
                        (__STDC_VERSION__ >= 201112L) &&\
                        !defined(__STDC_NO_ATOMICS__) &&\
                       ATOMIC_INT_LOCK_FREE == 2)
    #undef __pyx_atomic_int_type
    #define __pyx_atomic_int_type atomic_int
    #define __pyx_atomic_ptr_type atomic_uintptr_t
    #define __pyx_nonatomic_ptr_type uintptr_t
    #define __pyx_atomic_incr_relaxed(value) atomic_fetch_add_explicit(value, 1, memory_order_relaxed)
    #define __pyx_atomic_incr_acq_rel(value) atomic_fetch_add_explicit(value, 1, memory_order_acq_rel)
    #define __pyx_atomic_decr_acq_rel(value) atomic_fetch_sub_explicit(value, 1, memory_order_acq_rel)
    #define __pyx_atomic_sub(value, arg) atomic_fetch_sub(value, arg)
    #define __pyx_atomic_int_cmp_exchange(value, expected, desired) atomic_compare_exchange_strong(value, expected, desired)
    #define __pyx_atomic_load(value) atomic_load(value)
    #define __pyx_atomic_store(value, new_value) atomic_store(value, new_value)
    #define __pyx_atomic_pointer_load_relaxed(value) atomic_load_explicit(value, memory_order_relaxed)
    #define __pyx_atomic_pointer_load_acquire(value) atomic_load_explicit(value, memory_order_acquire)
    #define __pyx_atomic_pointer_exchange(value, new_value) atomic_exchange(value, (__pyx_nonatomic_ptr_type)new_value)
    #define __pyx_atomic_pointer_cmp_exchange(value, expected, desired) atomic_compare_exchange_strong(value, expected, desired)
    #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER)
        #pragma message ("Using standard C atomics")
    #elif defined(__PYX_DEBUG_ATOMICS)
        #warning "Using standard C atomics"
    #endif
#elif CYTHON_ATOMICS && (defined(__cplusplus) && (\
                    (__cplusplus >= 201103L) ||\
\
                    (defined(_MSC_VER) && _MSC_VER >= 1700)) &&\
                    ATOMIC_INT_LOCK_FREE == 2)
    #undef __pyx_atomic_int_type
    #define __pyx_atomic_int_type std::atomic_int
    #define __pyx_atomic_ptr_type std::atomic_uintptr_t
    #define __pyx_nonatomic_ptr_type uintptr_t
    #define __pyx_atomic_incr_relaxed(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_relaxed)
    #define __pyx_atomic_incr_acq_rel(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_acq_rel)
    #define __pyx_atomic_decr_acq_rel(value) std::atomic_fetch_sub_explicit(value, 1, std::memory_order_acq_rel)
    #define __pyx_atomic_sub(value, arg) std::atomic_fetch_sub(value, arg)
    #define __pyx_atomic_int_cmp_exchange(value, expected, desired) std::atomic_compare_exchange_strong(value, expected, desired)
    #define __pyx_atomic_load(value) std::atomic_load(value)
    #define __pyx_atomic_store(value, new_value) std::atomic_store(value, new_value)
    #define __pyx_atomic_pointer_load_relaxed(value) std::atomic_load_explicit(value, std::memory_order_relaxed)
    #define __pyx_atomic_pointer_load_acquire(value) std::atomic_load_explicit(value, std::memory_order_acquire)
    #define __pyx_atomic_pointer_exchange(value, new_value) std::atomic_exchange(value, (__pyx_nonatomic_ptr_type)new_value)
    #define __pyx_atomic_pointer_cmp_exchange(value, expected, desired) std::atomic_compare_exchange_strong(value, expected, desired)
    #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER)
        #pragma message ("Using standard C++ atomics")
    #elif defined(__PYX_DEBUG_ATOMICS)
        #warning "Using standard C++ atomics"
    #endif
#elif CYTHON_ATOMICS && (__GNUC__ >= 5 || (__GNUC__ == 4 &&\
                    (__GNUC_MINOR__ > 1 ||\
                    (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ >= 2))))
    #define __pyx_atomic_ptr_type void*
    #define __pyx_nonatomic_ptr_type void*
    #define __pyx_atomic_incr_relaxed(value) __sync_fetch_and_add(value, 1)
    #define __pyx_atomic_incr_acq_rel(value) __sync_fetch_and_add(value, 1)
    #define __pyx_atomic_decr_acq_rel(value) __sync_fetch_and_sub(value, 1)
    #define __pyx_atomic_sub(value, arg) __sync_fetch_and_sub(value, arg)
    static CYTHON_INLINE int __pyx_atomic_int_cmp_exchange(__pyx_atomic_int_type* value, __pyx_nonatomic_int_type* expected, __pyx_nonatomic_int_type desired) {
        __pyx_nonatomic_int_type old = __sync_val_compare_and_swap(value, *expected, desired);
        int result = old == *expected;
        *expected = old;
        return result;
    }
    #define __pyx_atomic_load(value) __sync_fetch_and_add(value, 0)
    #define __pyx_atomic_store(value, new_value) __sync_lock_test_and_set(value, new_value)
    #define __pyx_atomic_pointer_load_relaxed(value) __sync_fetch_and_add(value, 0)
    #define __pyx_atomic_pointer_load_acquire(value) __sync_fetch_and_add(value, 0)
    #define __pyx_atomic_pointer_exchange(value, new_value) __sync_lock_test_and_set(value, (__pyx_atomic_ptr_type)new_value)
    static CYTHON_INLINE int __pyx_atomic_pointer_cmp_exchange(__pyx_atomic_ptr_type* value, __pyx_nonatomic_ptr_type* expected, __pyx_nonatomic_ptr_type desired) {
        __pyx_nonatomic_ptr_type old = __sync_val_compare_and_swap(value, *expected, desired);
        int result = old == *expected;
        *expected = old;
        return result;
    }
    #ifdef __PYX_DEBUG_ATOMICS
        #warning "Using GNU atomics"
    #endif
#elif CYTHON_ATOMICS && defined(_MSC_VER)
    #include <intrin.h>
    #undef __pyx_atomic_int_type
    #define __pyx_atomic_int_type long
    #define __pyx_atomic_ptr_type void*
    #undef __pyx_nonatomic_int_type
    #define __pyx_nonatomic_int_type long
    #define __pyx_nonatomic_ptr_type void*
    #pragma intrinsic (_InterlockedExchangeAdd, _InterlockedExchange, _InterlockedCompareExchange, _InterlockedCompareExchangePointer, _InterlockedExchangePointer)
    #define __pyx_atomic_incr_relaxed(value) _InterlockedExchangeAdd(value, 1)
    #define __pyx_atomic_incr_acq_rel(value) _InterlockedExchangeAdd(value, 1)
    #define __pyx_atomic_decr_acq_rel(value) _InterlockedExchangeAdd(value, -1)
    #define __pyx_atomic_sub(value, arg) _InterlockedExchangeAdd(value, -arg)
    static CYTHON_INLINE int __pyx_atomic_int_cmp_exchange(__pyx_atomic_int_type* value, __pyx_nonatomic_int_type* expected, __pyx_nonatomic_int_type desired) {
        __pyx_nonatomic_int_type old = _InterlockedCompareExchange(value, desired, *expected);
        int result = old == *expected;
        *expected = old;
        return result;
    }
    #define __pyx_atomic_load(value) _InterlockedExchangeAdd(value, 0)
    #define __pyx_atomic_store(value, new_value) _InterlockedExchange(value, new_value)
    #define __pyx_atomic_pointer_load_relaxed(value) *(void * volatile *)value
    #define __pyx_atomic_pointer_load_acquire(value) _InterlockedCompareExchangePointer(value, 0, 0)
    #define __pyx_atomic_pointer_exchange(value, new_value) _InterlockedExchangePointer(value, (__pyx_atomic_ptr_type)new_value)
    static CYTHON_INLINE int __pyx_atomic_pointer_cmp_exchange(__pyx_atomic_ptr_type* value, __pyx_nonatomic_ptr_type* expected, __pyx_nonatomic_ptr_type desired) {
        __pyx_atomic_ptr_type old = _InterlockedCompareExchangePointer(value, desired, *expected);
        int result = old == *expected;
        *expected = old;
        return result;
    }
    #ifdef __PYX_DEBUG_ATOMICS
        #pragma message ("Using MSVC atomics")
    #endif
#else
    #undef CYTHON_ATOMICS
    #define CYTHON_ATOMICS 0
    #ifdef __PYX_DEBUG_ATOMICS
        #warning "Not using atomics"
    #endif
#endif

/* CriticalSectionsDefinition.proto (used by CriticalSections) */
#if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
#define __Pyx_PyCriticalSection void*
#define __Pyx_PyCriticalSection2 void*
#define __Pyx_PyCriticalSection_End(cs)
#define __Pyx_PyCriticalSection2_End(cs)
#else
#define __Pyx_PyCriticalSection PyCriticalSection
#define __Pyx_PyCriticalSection2 PyCriticalSection2
#define __Pyx_PyCriticalSection_End PyCriticalSection_End
#define __Pyx_PyCriticalSection2_End PyCriticalSection2_End
#endif

/* CriticalSections.proto (used by ParseKeywordsImpl) */
#if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
#define __Pyx_PyCriticalSection_Begin(cs, arg) (void)(cs)
#define __Pyx_PyCriticalSection2_Begin(cs, arg1, arg2) (void)(cs)
#else
#define __Pyx_PyCriticalSection_Begin PyCriticalSection_Begin
#define __Pyx_PyCriticalSection2_Begin PyCriticalSection2_Begin
#endif
#if PY_VERSION_HEX < 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API
#define __Pyx_BEGIN_CRITICAL_SECTION(o) {
#define __Pyx_END_CRITICAL_SECTION() }
#else
#define __Pyx_BEGIN_CRITICAL_SECTION Py_BEGIN_CRITICAL_SECTION
#define __Pyx_END_CRITICAL_SECTION Py_END_CRITICAL_SECTION
#endif

/* ForceInitThreads.proto */
#ifndef __PYX_FORCE_INIT_THREADS
  #define __PYX_FORCE_INIT_THREADS 0
#endif

/* NoFastGil.proto */
#define __Pyx_PyGILState_Ensure PyGILState_Ensure
#define __Pyx_PyGILState_Release PyGILState_Release
#define __Pyx_FastGIL_Remember()
#define __Pyx_FastGIL_Forget()
#define __Pyx_FastGilFuncInit()

/* IncludeStructmemberH.proto (used by FixUpExtensionType) */
#include <structmember.h>

/* BufferFormatStructs.proto */
struct __Pyx_StructField_;
#define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
typedef struct {
  const char* name;
  const struct __Pyx_StructField_* fields;
  size_t size;
  size_t arraysize[8];
  int ndim;
  char typegroup;
  char is_unsigned;
  int flags;
} __Pyx_TypeInfo;
typedef struct __Pyx_StructField_ {
  const __Pyx_TypeInfo* type;
  const char* name;
  size_t offset;
} __Pyx_StructField;
typedef struct {
  const __Pyx_StructField* field;
  size_t parent_offset;
} __Pyx_BufFmt_StackElem;
typedef struct {
  __Pyx_StructField root;
  __Pyx_BufFmt_StackElem* head;
  size_t fmt_offset;
  size_t new_count, enc_count;
  size_t struct_alignment;
  int is_complex;
  char enc_type;
  char new_packmode;
  char enc_packmode;
  char is_valid_array;
} __Pyx_BufFmt_Context;

/* MemviewSliceStruct.proto */
struct __pyx_memoryview_obj;
typedef struct {
  struct __pyx_memoryview_obj *memview;
  char *data;
  Py_ssize_t shape[8];
  Py_ssize_t strides[8];
  Py_ssize_t suboffsets[8];
} __Pyx_memviewslice;
#define __Pyx_MemoryView_Len(m)  (m.shape[0])
#define __Pyx_MEMVIEW_DIRECT   1
#define __Pyx_MEMVIEW_PTR      2
#define __Pyx_MEMVIEW_FULL     4
#define __Pyx_MEMVIEW_CONTIG   8
#define __Pyx_MEMVIEW_STRIDED  16
#define __Pyx_MEMVIEW_FOLLOW   32
#define __Pyx_IS_C_CONTIG 1
#define __Pyx_IS_F_CONTIG 2
#define __Pyx_MEMSLICE_INIT  { 0, 0, { 0 }, { 0 }, { 0 } }
#if CYTHON_ATOMICS
    #define __pyx_add_acquisition_count(memview)\
             __pyx_atomic_incr_relaxed(__pyx_get_slice_count_pointer(memview))
    #define __pyx_sub_acquisition_count(memview)\
            __pyx_atomic_decr_acq_rel(__pyx_get_slice_count_pointer(memview))
#else
    #define __pyx_add_acquisition_count(memview)\
            __pyx_add_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
    #define __pyx_sub_acquisition_count(memview)\
            __pyx_sub_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
#endif

/* #### Code section: numeric_typedefs ### */
/* #### Code section: complex_type_declarations ### */
/* #### Code section: type_declarations ### */

/*--- Type declarations ---*/
struct __pyx_obj_4lxml_5etree_Error;
struct __pyx_obj_4lxml_5etree_LxmlError;
struct __pyx_obj_4lxml_5etree_C14NError;
struct __pyx_obj_4lxml_5etree__TempStore;
struct __pyx_obj_4lxml_5etree__ExceptionContext;
struct __pyx_obj_4lxml_5etree__LogEntry;
struct __pyx_obj_4lxml_5etree__BaseErrorLog;
struct __pyx_obj_4lxml_5etree__ListErrorLog;
struct __pyx_obj_4lxml_5etree__ErrorLogContext;
struct __pyx_obj_4lxml_5etree__ErrorLog;
struct __pyx_obj_4lxml_5etree__DomainErrorLog;
struct __pyx_obj_4lxml_5etree__RotatingErrorLog;
struct __pyx_obj_4lxml_5etree_PyErrorLog;
struct LxmlDocument;
struct __pyx_obj_4lxml_5etree_DocInfo;
struct LxmlElement;
struct __pyx_obj_4lxml_5etree___ContentOnlyElement;
struct __pyx_obj_4lxml_5etree__Comment;
struct __pyx_obj_4lxml_5etree__ProcessingInstruction;
struct __pyx_obj_4lxml_5etree__Entity;
struct __pyx_obj_4lxml_5etree_QName;
struct LxmlElementTree;
struct __pyx_obj_4lxml_5etree__Attrib;
struct __pyx_obj_4lxml_5etree__AttribIterator;
struct LxmlElementTagMatcher;
struct LxmlElementIterator;
struct __pyx_obj_4lxml_5etree__MultiTagMatcher;
struct __pyx_obj_4lxml_5etree__ElementMatchIterator;
struct __pyx_obj_4lxml_5etree_ElementChildIterator;
struct __pyx_obj_4lxml_5etree_SiblingsIterator;
struct __pyx_obj_4lxml_5etree_AncestorsIterator;
struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator;
struct __pyx_obj_4lxml_5etree_ElementTextIterator;
struct __pyx_obj_4lxml_5etree_CDATA;
struct __pyx_obj_4lxml_5etree__ReadOnlyProxy;
struct __pyx_obj_4lxml_5etree__ReadOnlyPIProxy;
struct __pyx_obj_4lxml_5etree__ReadOnlyEntityProxy;
struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy;
struct __pyx_obj_4lxml_5etree__OpaqueNodeWrapper;
struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper;
struct __pyx_obj_4lxml_5etree__ModifyContentOnlyProxy;
struct __pyx_obj_4lxml_5etree__ModifyContentOnlyPIProxy;
struct __pyx_obj_4lxml_5etree__ModifyContentOnlyEntityProxy;
struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy;
struct LxmlElementBase;
struct __pyx_obj_4lxml_5etree_CommentBase;
struct __pyx_obj_4lxml_5etree_PIBase;
struct __pyx_obj_4lxml_5etree_EntityBase;
struct LxmlElementClassLookup;
struct LxmlFallbackElementClassLookup;
struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup;
struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup;
struct __pyx_obj_4lxml_5etree_ParserBasedElementClassLookup;
struct __pyx_obj_4lxml_5etree_CustomElementClassLookup;
struct __pyx_obj_4lxml_5etree_PythonElementClassLookup;
struct __pyx_obj_4lxml_5etree_LxmlRegistryError;
struct __pyx_obj_4lxml_5etree_NamespaceRegistryError;
struct __pyx_obj_4lxml_5etree__NamespaceRegistry;
struct __pyx_obj_4lxml_5etree__ClassNamespaceRegistry;
struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup;
struct __pyx_obj_4lxml_5etree__FunctionNamespaceRegistry;
struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry;
struct __pyx_obj_4lxml_5etree__InputDocument;
struct __pyx_obj_4lxml_5etree_Resolver;
struct __pyx_obj_4lxml_5etree__ResolverRegistry;
struct __pyx_obj_4lxml_5etree__ResolverContext;
struct __pyx_obj_4lxml_5etree_ParserError;
struct __pyx_obj_4lxml_5etree__ParserDictionaryContext;
struct __pyx_obj_4lxml_5etree__FileReaderContext;
struct __pyx_obj_4lxml_5etree__ParserContext;
struct __pyx_obj_4lxml_5etree__BaseParser;
struct __pyx_obj_4lxml_5etree__FeedParser;
struct __pyx_obj_4lxml_5etree_XMLParser;
struct __pyx_obj_4lxml_5etree_XMLPullParser;
struct __pyx_obj_4lxml_5etree_ETCompatXMLParser;
struct __pyx_obj_4lxml_5etree_HTMLParser;
struct __pyx_obj_4lxml_5etree_HTMLPullParser;
struct __pyx_obj_4lxml_5etree__SaxParserTarget;
struct __pyx_obj_4lxml_5etree__SaxParserContext;
struct __pyx_obj_4lxml_5etree__ParseEventsIterator;
struct __pyx_obj_4lxml_5etree_TreeBuilder;
struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget;
struct __pyx_obj_4lxml_5etree__TargetParserContext;
struct __pyx_obj_4lxml_5etree_SerialisationError;
struct __pyx_obj_4lxml_5etree__FilelikeWriter;
struct __pyx_obj_4lxml_5etree_C14NWriterTarget;
struct __pyx_obj_4lxml_5etree_xmlfile;
struct __pyx_obj_4lxml_5etree_htmlfile;
struct __pyx_obj_4lxml_5etree__IncrementalFileWriter;
struct __pyx_obj_4lxml_5etree__AsyncDataWriter;
struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter;
struct __pyx_obj_4lxml_5etree__AsyncFileWriterElement;
struct __pyx_obj_4lxml_5etree__FileWriterElement;
struct __pyx_obj_4lxml_5etree__MethodChanger;
struct __pyx_obj_4lxml_5etree_iterparse;
struct __pyx_obj_4lxml_5etree_iterwalk;
struct __pyx_obj_4lxml_5etree__IDDict;
struct __pyx_obj_4lxml_5etree_XIncludeError;
struct __pyx_obj_4lxml_5etree_XInclude;
struct __pyx_obj_4lxml_5etree_XPathError;
struct __pyx_obj_4lxml_5etree_XPathEvalError;
struct __pyx_obj_4lxml_5etree_XPathFunctionError;
struct __pyx_obj_4lxml_5etree_XPathResultError;
struct __pyx_obj_4lxml_5etree__BaseContext;
struct __pyx_obj_4lxml_5etree__ExsltRegExp;
struct __pyx_obj_4lxml_5etree__ElementUnicodeResult;
struct __pyx_obj_4lxml_5etree__XPathContext;
struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase;
struct __pyx_obj_4lxml_5etree_XPathElementEvaluator;
struct __pyx_obj_4lxml_5etree_XPathDocumentEvaluator;
struct __pyx_obj_4lxml_5etree_XPath;
struct __pyx_obj_4lxml_5etree_ETXPath;
struct __pyx_obj_4lxml_5etree_XSLTError;
struct __pyx_obj_4lxml_5etree_XSLTParseError;
struct __pyx_obj_4lxml_5etree_XSLTApplyError;
struct __pyx_obj_4lxml_5etree_XSLTExtensionError;
struct __pyx_obj_4lxml_5etree__XSLTResolverContext;
struct __pyx_obj_4lxml_5etree_XSLTAccessControl;
struct __pyx_obj_4lxml_5etree__XSLTContext;
struct __pyx_obj_4lxml_5etree__XSLTQuotedStringParam;
struct __pyx_obj_4lxml_5etree_XSLT;
struct __pyx_obj_4lxml_5etree__XSLTResultTree;
struct __pyx_obj_4lxml_5etree__XSLTProcessingInstruction;
struct __pyx_obj_4lxml_5etree_XSLTExtension;
struct __pyx_obj_4lxml_5etree_DocumentInvalid;
struct __pyx_obj_4lxml_5etree__Validator;
struct __pyx_obj_4lxml_5etree_DTDError;
struct __pyx_obj_4lxml_5etree_DTDParseError;
struct __pyx_obj_4lxml_5etree_DTDValidateError;
struct __pyx_obj_4lxml_5etree__DTDElementContentDecl;
struct __pyx_obj_4lxml_5etree__DTDAttributeDecl;
struct __pyx_obj_4lxml_5etree__DTDElementDecl;
struct __pyx_obj_4lxml_5etree__DTDEntityDecl;
struct __pyx_obj_4lxml_5etree_DTD;
struct __pyx_obj_4lxml_5etree_RelaxNGError;
struct __pyx_obj_4lxml_5etree_RelaxNGParseError;
struct __pyx_obj_4lxml_5etree_RelaxNGValidateError;
struct __pyx_obj_4lxml_5etree_RelaxNG;
struct __pyx_obj_4lxml_5etree_XMLSchemaError;
struct __pyx_obj_4lxml_5etree_XMLSchemaParseError;
struct __pyx_obj_4lxml_5etree_XMLSchemaValidateError;
struct __pyx_obj_4lxml_5etree_XMLSchema;
struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext;
struct __pyx_obj_4lxml_5etree_SchematronError;
struct __pyx_obj_4lxml_5etree_SchematronParseError;
struct __pyx_obj_4lxml_5etree_SchematronValidateError;
struct __pyx_obj_4lxml_5etree_Schematron;
struct __pyx_obj_4lxml_5etree__MemDebug;
struct __pyx_obj_4lxml_5etree___pyx_scope_struct___open_utf8_file;
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_1__iter_namespaces;
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_2___aenter__;
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_3___aexit__;
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_4_flush;
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_5_write_declaration;
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_6_write_doctype;
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_7_write;
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_8__close;
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_9___aenter__;
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_10___aexit__;
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_11___aenter__;
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_12___aexit__;
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_13_itervalues;
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_14_iterattributes;
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_15_iterelements;
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_16_iterentities;
struct __pyx_array_obj;
struct __pyx_MemviewEnum_obj;
struct __pyx_memoryview_obj;
struct __pyx_memoryviewslice_obj;
struct __pyx_t_4lxml_5etree_qname;
struct __pyx_opt_args_4lxml_5etree___unpackIntVersion;
struct __pyx_t_4lxml_5etree__ns_update_map;
typedef struct __pyx_t_4lxml_5etree__ns_update_map __pyx_t_4lxml_5etree__ns_update_map;
struct __pyx_t_4lxml_5etree__nscache;
typedef struct __pyx_t_4lxml_5etree__nscache __pyx_t_4lxml_5etree__nscache;
struct __pyx_opt_args_4lxml_5etree__adoptForeignDoc;
struct __pyx_t_4lxml_5etree__ns_node_ref;
typedef struct __pyx_t_4lxml_5etree__ns_node_ref __pyx_t_4lxml_5etree__ns_node_ref;
struct __pyx_opt_args_4lxml_5etree__hasNonWhitespaceText;
struct __pyx_opt_args_4lxml_5etree__connectGenericErrorLog;
struct __pyx_opt_args_4lxml_5etree_16_MultiTagMatcher_cacheTags;
struct __pyx_opt_args_4lxml_5etree_14_ParserContext_prepare;
struct __pyx_ctuple_int__and_int;
typedef struct __pyx_ctuple_int__and_int __pyx_ctuple_int__and_int;
struct __pyx_opt_args_4lxml_5etree_16C14NWriterTarget__qname;
struct __pyx_opt_args_4lxml_5etree_16C14NWriterTarget__start;

/* "src/lxml/apihelpers.pxi":1565
 * 
 * 
 * cdef enum:             # <<<<<<<<<<<<<<
 *     NO_FILE_PATH = 0
 *     ABS_UNIX_FILE_PATH = 1
*/
enum  {
  __pyx_e_4lxml_5etree_NO_FILE_PATH = 0,
  __pyx_e_4lxml_5etree_ABS_UNIX_FILE_PATH = 1,
  __pyx_e_4lxml_5etree_ABS_WIN_FILE_PATH = 2,
  __pyx_e_4lxml_5etree_REL_FILE_PATH = 3
};

/* "src/lxml/docloader.pxi":3
 * # Custom resolver API
 * 
 * ctypedef enum _InputDocumentDataType:             # <<<<<<<<<<<<<<
 *     PARSER_DATA_INVALID
 *     PARSER_DATA_EMPTY
*/
enum __pyx_t_4lxml_5etree__InputDocumentDataType {
  __pyx_e_4lxml_5etree_PARSER_DATA_INVALID,
  __pyx_e_4lxml_5etree_PARSER_DATA_EMPTY,
  __pyx_e_4lxml_5etree_PARSER_DATA_STRING,
  __pyx_e_4lxml_5etree_PARSER_DATA_FILENAME,
  __pyx_e_4lxml_5etree_PARSER_DATA_FILE
};
typedef enum __pyx_t_4lxml_5etree__InputDocumentDataType __pyx_t_4lxml_5etree__InputDocumentDataType;

/* "src/lxml/saxparser.pxi":14
 * 
 * 
 * ctypedef enum _SaxParserEvents:             # <<<<<<<<<<<<<<
 *     SAX_EVENT_START    = 1 << 0
 *     SAX_EVENT_END      = 1 << 1
*/
enum __pyx_t_4lxml_5etree__SaxParserEvents {

  /* "src/lxml/saxparser.pxi":22
 *     SAX_EVENT_COMMENT  = 1 << 5
 *     SAX_EVENT_START_NS = 1 << 6
 *     SAX_EVENT_END_NS   = 1 << 7             # <<<<<<<<<<<<<<
 * 
 * ctypedef enum _ParseEventFilter:
*/
  __pyx_e_4lxml_5etree_SAX_EVENT_START = (1 << 0),
  __pyx_e_4lxml_5etree_SAX_EVENT_END = (1 << 1),
  __pyx_e_4lxml_5etree_SAX_EVENT_DATA = (1 << 2),
  __pyx_e_4lxml_5etree_SAX_EVENT_DOCTYPE = (1 << 3),
  __pyx_e_4lxml_5etree_SAX_EVENT_PI = (1 << 4),
  __pyx_e_4lxml_5etree_SAX_EVENT_COMMENT = (1 << 5),
  __pyx_e_4lxml_5etree_SAX_EVENT_START_NS = (1 << 6),
  __pyx_e_4lxml_5etree_SAX_EVENT_END_NS = (1 << 7)
};
typedef enum __pyx_t_4lxml_5etree__SaxParserEvents __pyx_t_4lxml_5etree__SaxParserEvents;

/* "src/lxml/saxparser.pxi":24
 *     SAX_EVENT_END_NS   = 1 << 7
 * 
 * ctypedef enum _ParseEventFilter:             # <<<<<<<<<<<<<<
 *     PARSE_EVENT_FILTER_START     = 1 << 0
 *     PARSE_EVENT_FILTER_END       = 1 << 1
*/
enum __pyx_t_4lxml_5etree__ParseEventFilter {

  /* "src/lxml/saxparser.pxi":30
 *     PARSE_EVENT_FILTER_END_NS    = 1 << 3
 *     PARSE_EVENT_FILTER_COMMENT   = 1 << 4
 *     PARSE_EVENT_FILTER_PI        = 1 << 5             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_START = (1 << 0),
  __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_END = (1 << 1),
  __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_START_NS = (1 << 2),
  __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_END_NS = (1 << 3),
  __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_COMMENT = (1 << 4),
  __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_PI = (1 << 5)
};
typedef enum __pyx_t_4lxml_5etree__ParseEventFilter __pyx_t_4lxml_5etree__ParseEventFilter;

/* "src/lxml/serializer.pxi":12
 * 
 * 
 * cdef enum _OutputMethods:             # <<<<<<<<<<<<<<
 *     OUTPUT_METHOD_XML
 *     OUTPUT_METHOD_HTML
*/
enum __pyx_t_4lxml_5etree__OutputMethods {
  __pyx_e_4lxml_5etree_OUTPUT_METHOD_XML,
  __pyx_e_4lxml_5etree_OUTPUT_METHOD_HTML,
  __pyx_e_4lxml_5etree_OUTPUT_METHOD_TEXT
};

/* "src/lxml/serializer.pxi":1359
 * 
 * 
 * cdef enum _IncrementalFileWriterStatus:             # <<<<<<<<<<<<<<
 *     WRITER_STARTING = 0
 *     WRITER_DECL_WRITTEN = 1
*/
enum __pyx_t_4lxml_5etree__IncrementalFileWriterStatus {
  __pyx_e_4lxml_5etree_WRITER_STARTING = 0,
  __pyx_e_4lxml_5etree_WRITER_DECL_WRITTEN = 1,
  __pyx_e_4lxml_5etree_WRITER_DTD_WRITTEN = 2,
  __pyx_e_4lxml_5etree_WRITER_IN_ELEMENT = 3,
  __pyx_e_4lxml_5etree_WRITER_FINISHED = 4
};

/* "src/lxml/iterparse.pxi":232
 * 
 * 
 * cdef enum _IterwalkSkipStates:             # <<<<<<<<<<<<<<
 *     IWSKIP_NEXT_IS_START
 *     IWSKIP_SKIP_NEXT
*/
enum __pyx_t_4lxml_5etree__IterwalkSkipStates {
  __pyx_e_4lxml_5etree_IWSKIP_NEXT_IS_START,
  __pyx_e_4lxml_5etree_IWSKIP_SKIP_NEXT,
  __pyx_e_4lxml_5etree_IWSKIP_CAN_SKIP,
  __pyx_e_4lxml_5etree_IWSKIP_CANNOT_SKIP
};

/* "lxml/etree.pyx":139
 * # PyPy requires us to store a Python reference for the
 * # namespace in order to keep the byte buffer alive.
 * cdef struct qname:             # <<<<<<<<<<<<<<
 *     const_xmlChar* c_name
 *     python.PyObject* href
*/
struct __pyx_t_4lxml_5etree_qname {
  const xmlChar *c_name;
  PyObject *href;
};

/* "lxml/etree.pyx":261
 *     return tuple(version_list)
 * 
 * cdef tuple __unpackIntVersion(int c_version, int base=100):             # <<<<<<<<<<<<<<
 *     return (
 *         ((c_version // (base*base)) % base),
*/
struct __pyx_opt_args_4lxml_5etree___unpackIntVersion {
  int __pyx_n;
  int base;
};

/* "lxml/etree.pyx":456
 * 
 * # type of a function that steps from node to node
 * ctypedef public xmlNode* (*_node_to_node_function)(xmlNode*)             # <<<<<<<<<<<<<<
 * 
 * 
*/
typedef xmlNode *(*_node_to_node_function)(xmlNode *);

/* "src/lxml/proxy.pxi":218
 * 
 * 
 * ctypedef struct _ns_update_map:             # <<<<<<<<<<<<<<
 *     xmlNs* old
 *     xmlNs* new
*/
struct __pyx_t_4lxml_5etree__ns_update_map {
  xmlNs *old;
  xmlNs *__pyx_new;
};

/* "src/lxml/proxy.pxi":223
 * 
 * 
 * ctypedef struct _nscache:             # <<<<<<<<<<<<<<
 *     _ns_update_map* ns_map
 *     size_t size
*/
struct __pyx_t_4lxml_5etree__nscache {
  __pyx_t_4lxml_5etree__ns_update_map *ns_map;
  size_t size;
  size_t last;
};

/* "src/lxml/proxy.pxi":599
 * # adopt an xmlDoc from an external libxml2 document source
 * 
 * cdef _Document _adoptForeignDoc(xmlDoc* c_doc, _BaseParser parser=None, bint is_owned=True):             # <<<<<<<<<<<<<<
 *     """Convert and wrap an externally produced xmlDoc for use in lxml.
 *     Assures that all '_private' pointers are NULL to prevent accidental
*/
struct __pyx_opt_args_4lxml_5etree__adoptForeignDoc {
  int __pyx_n;
  struct __pyx_obj_4lxml_5etree__BaseParser *parser;
  int is_owned;
};

/* "src/lxml/apihelpers.pxi":361
 * 
 * 
 * ctypedef struct _ns_node_ref:             # <<<<<<<<<<<<<<
 *     xmlNs* ns
 *     xmlNode* node
*/
struct __pyx_t_4lxml_5etree__ns_node_ref {
  xmlNs *ns;
  xmlNode *node;
};

/* "src/lxml/apihelpers.pxi":688
 *     return _hasNonWhitespaceText(c_node, tail=True)
 * 
 * cdef bint _hasNonWhitespaceText(xmlNode* c_node, bint tail=False) except -1:             # <<<<<<<<<<<<<<
 *     c_text_node = c_node and _textNodeOrSkip(c_node.next if tail else c_node.children)
 *     if c_text_node is NULL:
*/
struct __pyx_opt_args_4lxml_5etree__hasNonWhitespaceText {
  int __pyx_n;
  int tail;
};

/* "src/lxml/xmlerror.pxi":683
 * 
 * 
 * cdef void _connectGenericErrorLog(log, int c_domain=-1) noexcept:             # <<<<<<<<<<<<<<
 *     cdef xmlerror.xmlGenericErrorFunc error_func = NULL
 *     c_log = <void*>log
*/
struct __pyx_opt_args_4lxml_5etree__connectGenericErrorLog {
  int __pyx_n;
  int c_domain;
};

/* "lxml/etree.pyx":2923
 *                 self._storeTags(item, seen)
 * 
 *     cdef inline int cacheTags(self, _Document doc, bint force_into_dict=False) except -1:             # <<<<<<<<<<<<<<
 *         """
 *         Look up the tag names in the doc dict to enable string pointer comparisons.
*/
struct __pyx_opt_args_4lxml_5etree_16_MultiTagMatcher_cacheTags {
  int __pyx_n;
  int force_into_dict;
};

/* "src/lxml/classlookup.pxi":210
 * # Element class lookup
 * 
 * ctypedef public object (*_element_class_lookup_function)(object, _Document, xmlNode*)             # <<<<<<<<<<<<<<
 * 
 * # class to store element class lookup functions
*/
typedef PyObject *(*_element_class_lookup_function)(PyObject *, struct LxmlDocument *, xmlNode *);

/* "src/lxml/parser.pxi":598
 *                 self._c_ctxt.nsNr = 0
 * 
 *     cdef int prepare(self, bint set_document_loader=True) except -1:             # <<<<<<<<<<<<<<
 *         cdef int result
 *         if config.ENABLE_THREADING and self._lock is not NULL:
*/
struct __pyx_opt_args_4lxml_5etree_14_ParserContext_prepare {
  int __pyx_n;
  int set_document_loader;
};

/* "src/lxml/parser.pxi":1526
 * 
 * 
 * cdef (int, int) _parse_data_chunk(xmlparser.xmlParserCtxt* c_ctxt,             # <<<<<<<<<<<<<<
 *                                   const char* char_data, int buffer_len):
 *     fixup_error = 0
*/
struct __pyx_ctuple_int__and_int {
  int f0;
  int f1;
};

/* "src/lxml/serializer.pxi":986
 *         raise ValueError(f'Prefix {prefix} of QName "{prefixed_name}" is not declared in scope')
 * 
 *     cdef _qname(self, qname, uri=None):             # <<<<<<<<<<<<<<
 *         if uri is None:
 *             uri, tag = qname[1:].rsplit('}', 1) if qname[:1] == '{' else ('', qname)
*/
struct __pyx_opt_args_4lxml_5etree_16C14NWriterTarget__qname {
  int __pyx_n;
  PyObject *uri;
};

/* "src/lxml/serializer.pxi":1066
 *         self._start(tag, attrs, new_namespaces)
 * 
 *     cdef _start(self, tag, attrs, new_namespaces, qname_text=None):             # <<<<<<<<<<<<<<
 *         if self._exclude_attrs is not None and attrs:
 *             attrs = {k: v for k, v in attrs.items() if k not in self._exclude_attrs}
*/
struct __pyx_opt_args_4lxml_5etree_16C14NWriterTarget__start {
  int __pyx_n;
  PyObject *qname_text;
};

/* "src/lxml/extensions.pxi":22
 * # forward declarations
 * 
 * ctypedef int (*_register_function)(void* ctxt, name_utf, ns_uri_utf)             # <<<<<<<<<<<<<<
 * cdef class _ExsltRegExp
 * 
*/
typedef int (*__pyx_t_4lxml_5etree__register_function)(void *, PyObject *, PyObject *);

/* "lxml/etree.pyx":210
 * 
 * # Error superclass for ElementTree compatibility
 * cdef class Error(Exception):             # <<<<<<<<<<<<<<
 *     pass
 * 
*/
struct __pyx_obj_4lxml_5etree_Error {
  PyBaseExceptionObject __pyx_base;
};


/* "lxml/etree.pyx":214
 * 
 * # module level superclass for all exceptions
 * cdef class LxmlError(Error):             # <<<<<<<<<<<<<<
 *     """Main exception base class for lxml.  All other exceptions inherit from
 *     this one.
*/
struct __pyx_obj_4lxml_5etree_LxmlError {
  struct __pyx_obj_4lxml_5etree_Error __pyx_base;
};


/* "lxml/etree.pyx":233
 *     """
 * 
 * cdef class C14NError(LxmlError):             # <<<<<<<<<<<<<<
 *     """Error during C14N serialisation.
 *     """
*/
struct __pyx_obj_4lxml_5etree_C14NError {
  struct __pyx_obj_4lxml_5etree_LxmlError __pyx_base;
};


/* "lxml/etree.pyx":400
 * # class for temporary storage of Python references,
 * # used e.g. for XPath results
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * cdef class _TempStore:
*/
struct __pyx_obj_4lxml_5etree__TempStore {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__TempStore *__pyx_vtab;
  PyObject *_storage;
};


/* "lxml/etree.pyx":417
 * 
 * # class for temporarily storing exceptions raised in extensions
 * @cython.internal             # <<<<<<<<<<<<<<
 * cdef class _ExceptionContext:
 *     cdef object _exc_info
*/
struct __pyx_obj_4lxml_5etree__ExceptionContext {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext *__pyx_vtab;
  PyObject *_exc_info;
};


/* "src/lxml/xmlerror.pxi":36
 * # Logging classes
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.freelist(16)
 * cdef class _LogEntry:
*/
struct __pyx_obj_4lxml_5etree__LogEntry {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__LogEntry *__pyx_vtab;
  int domain;
  int type;
  int level;
  long line;
  int column;
  PyObject *_message;
  PyObject *_filename;
  char *_c_message;
  xmlChar *_c_filename;
  xmlChar *_c_path;
};


/* "src/lxml/xmlerror.pxi":187
 * 
 * 
 * cdef class _BaseErrorLog:             # <<<<<<<<<<<<<<
 *     cdef _LogEntry _first_error
 *     cdef readonly object last_error
*/
struct __pyx_obj_4lxml_5etree__BaseErrorLog {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__BaseErrorLog *__pyx_vtab;
  struct __pyx_obj_4lxml_5etree__LogEntry *_first_error;
  PyObject *last_error;
};


/* "src/lxml/xmlerror.pxi":277
 *         return message
 * 
 * cdef class _ListErrorLog(_BaseErrorLog):             # <<<<<<<<<<<<<<
 *     "Immutable base version of a list based error log."
 *     cdef list _entries
*/
struct __pyx_obj_4lxml_5etree__ListErrorLog {
  struct __pyx_obj_4lxml_5etree__BaseErrorLog __pyx_base;
  PyObject *_entries;
  int _offset;
};


/* "src/lxml/xmlerror.pxi":393
 * 
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * cdef class _ErrorLogContext:
*/
struct __pyx_obj_4lxml_5etree__ErrorLogContext {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__ErrorLogContext *__pyx_vtab;
  xmlStructuredErrorFunc old_error_func;
  void *old_error_context;
  xmlGenericErrorFunc old_xslt_error_func;
  void *old_xslt_error_context;
  struct __pyx_obj_4lxml_5etree__BaseErrorLog *old_xslt_error_log;
};


/* "src/lxml/xmlerror.pxi":432
 * 
 * 
 * cdef class _ErrorLog(_ListErrorLog):             # <<<<<<<<<<<<<<
 *     cdef list _logContexts
 *     def __cinit__(self):
*/
struct __pyx_obj_4lxml_5etree__ErrorLog {
  struct __pyx_obj_4lxml_5etree__ListErrorLog __pyx_base;
  PyObject *_logContexts;
};


/* "src/lxml/xmlerror.pxi":485
 *         self._entries.append(entry)
 * 
 * cdef class _DomainErrorLog(_ErrorLog):             # <<<<<<<<<<<<<<
 *     def __init__(self, domains):
 *         _ErrorLog.__init__(self)
*/
struct __pyx_obj_4lxml_5etree__DomainErrorLog {
  struct __pyx_obj_4lxml_5etree__ErrorLog __pyx_base;
};


/* "src/lxml/xmlerror.pxi":494
 *             _ErrorLog.receive(self, entry)
 * 
 * cdef class _RotatingErrorLog(_ErrorLog):             # <<<<<<<<<<<<<<
 *     cdef int _max_len
 *     def __init__(self, max_len):
*/
struct __pyx_obj_4lxml_5etree__RotatingErrorLog {
  struct __pyx_obj_4lxml_5etree__ErrorLog __pyx_base;
  int _max_len;
};


/* "src/lxml/xmlerror.pxi":512
 *                 del self._entries[:offset]
 * 
 * cdef class PyErrorLog(_BaseErrorLog):             # <<<<<<<<<<<<<<
 *     """PyErrorLog(self, logger_name=None, logger=None)
 *     A global error log that connects to the Python stdlib logging package.
*/
struct __pyx_obj_4lxml_5etree_PyErrorLog {
  struct __pyx_obj_4lxml_5etree__BaseErrorLog __pyx_base;
  PyObject *level_map;
  PyObject *_map_level;
  PyObject *_log;
};


/* "lxml/etree.pyx":470
 * # Public Python API
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.freelist(8)
 * cdef public class _Document [ type LxmlDocumentType, object LxmlDocument ]:
*/
struct LxmlDocument {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__Document *__pyx_vtab;
  int _ns_counter;
  PyObject *_prefix_tail;
  xmlDoc *_c_doc;
  struct __pyx_obj_4lxml_5etree__BaseParser *_parser;
};

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) LxmlDocumentType;

/* "lxml/etree.pyx":648
 * 
 * 
 * cdef class DocInfo:             # <<<<<<<<<<<<<<
 *     "Document information provided by parser and DTD."
 *     cdef _Document _doc
*/
struct __pyx_obj_4lxml_5etree_DocInfo {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree_DocInfo *__pyx_vtab;
  struct LxmlDocument *_doc;
};


/* "lxml/etree.pyx":822
 * 
 * 
 * @cython.no_gc_clear             # <<<<<<<<<<<<<<
 * cdef public class _Element [ type LxmlElementType, object LxmlElement ]:
 *     """Element class.
*/
struct LxmlElement {
  PyObject_HEAD
  struct LxmlDocument *_doc;
  xmlNode *_c_node;
  PyObject *_tag;
};

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) LxmlElementType;

/* "lxml/etree.pyx":1772
 * 
 * 
 * @cython.internal             # <<<<<<<<<<<<<<
 * cdef class __ContentOnlyElement(_Element):
 *     cdef int _raiseImmutable(self) except -1:
*/
struct __pyx_obj_4lxml_5etree___ContentOnlyElement {
  struct LxmlElement __pyx_base;
  struct __pyx_vtabstruct_4lxml_5etree___ContentOnlyElement *__pyx_vtab;
};


/* "lxml/etree.pyx":1840
 *         return []
 * 
 * cdef class _Comment(__ContentOnlyElement):             # <<<<<<<<<<<<<<
 *     @property
 *     def tag(self):
*/
struct __pyx_obj_4lxml_5etree__Comment {
  struct __pyx_obj_4lxml_5etree___ContentOnlyElement __pyx_base;
};


/* "lxml/etree.pyx":1848
 *         return "<!--%s-->" % self.text
 * 
 * cdef class _ProcessingInstruction(__ContentOnlyElement):             # <<<<<<<<<<<<<<
 *     @property
 *     def tag(self):
*/
struct __pyx_obj_4lxml_5etree__ProcessingInstruction {
  struct __pyx_obj_4lxml_5etree___ContentOnlyElement __pyx_base;
};


/* "lxml/etree.pyx":1898
 * cdef object _FIND_PI_ATTRIBUTES = re.compile(r'\s+(\w+)\s*=\s*(?:\'([^\']*)\'|"([^"]*)")', re.U).findall
 * 
 * cdef class _Entity(__ContentOnlyElement):             # <<<<<<<<<<<<<<
 *     @property
 *     def tag(self):
*/
struct __pyx_obj_4lxml_5etree__Entity {
  struct __pyx_obj_4lxml_5etree___ContentOnlyElement __pyx_base;
};


/* "lxml/etree.pyx":1927
 * 
 * 
 * cdef class QName:             # <<<<<<<<<<<<<<
 *     """QName(text_or_uri_or_element, tag=None)
 * 
*/
struct __pyx_obj_4lxml_5etree_QName {
  PyObject_HEAD
  PyObject *text;
  PyObject *localname;
  PyObject *__pyx_namespace;
};


/* "lxml/etree.pyx":1996
 * 
 * 
 * cdef public class _ElementTree [ type LxmlElementTreeType,             # <<<<<<<<<<<<<<
 *                                  object LxmlElementTree ]:
 *     cdef _Document _doc
*/
struct LxmlElementTree {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__ElementTree *__pyx_vtab;
  struct LxmlDocument *_doc;
  struct LxmlElement *_context_node;
};

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) LxmlElementTreeType;

/* "lxml/etree.pyx":2586
 * 
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.freelist(16)
 * cdef class _Attrib:
*/
struct __pyx_obj_4lxml_5etree__Attrib {
  PyObject_HEAD
  struct LxmlElement *_element;
};


/* "lxml/etree.pyx":2727
 * 
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * cdef class _AttribIterator:
*/
struct __pyx_obj_4lxml_5etree__AttribIterator {
  PyObject_HEAD
  struct LxmlElement *_node;
  xmlAttr *_c_attr;
  int _keysvalues;
};


/* "lxml/etree.pyx":2770
 * 
 * 
 * cdef public class _ElementTagMatcher [ object LxmlElementTagMatcher,             # <<<<<<<<<<<<<<
 *                                        type LxmlElementTagMatcherType ]:
 *     """
*/
struct LxmlElementTagMatcher {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__ElementTagMatcher *__pyx_vtab;
  PyObject *_pystrings;
  int _node_type;
  char *_href;
  char *_name;
};

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) LxmlElementTagMatcherType;

/* "lxml/etree.pyx":2801
 *                 self._name = NULL
 * 
 * cdef public class _ElementIterator(_ElementTagMatcher) [             # <<<<<<<<<<<<<<
 *     object LxmlElementIterator, type LxmlElementIteratorType ]:
 *     """
*/
struct LxmlElementIterator {
  struct LxmlElementTagMatcher __pyx_base;
  struct LxmlElement *_node;
  _node_to_node_function _next_element;
};

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) LxmlElementIteratorType;

/* "lxml/etree.pyx":2836
 *         return current_node
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * cdef class _MultiTagMatcher:
*/
struct __pyx_obj_4lxml_5etree__MultiTagMatcher {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__MultiTagMatcher *__pyx_vtab;
  PyObject *_py_tags;
  struct __pyx_t_4lxml_5etree_qname *_cached_tags;
  size_t _tag_count;
  size_t _cached_size;
  struct LxmlDocument *_cached_doc;
  int _node_types;
};


/* "lxml/etree.pyx":2977
 *         return False
 * 
 * cdef class _ElementMatchIterator:             # <<<<<<<<<<<<<<
 *     cdef _Element _node
 *     cdef _node_to_node_function _next_element
*/
struct __pyx_obj_4lxml_5etree__ElementMatchIterator {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__ElementMatchIterator *__pyx_vtab;
  struct LxmlElement *_node;
  _node_to_node_function _next_element;
  struct __pyx_obj_4lxml_5etree__MultiTagMatcher *_matcher;
};


/* "lxml/etree.pyx":3006
 *         return current_node
 * 
 * cdef class ElementChildIterator(_ElementMatchIterator):             # <<<<<<<<<<<<<<
 *     """ElementChildIterator(self, node, tag=None, reversed=False)
 *     Iterates over the children of an element.
*/
struct __pyx_obj_4lxml_5etree_ElementChildIterator {
  struct __pyx_obj_4lxml_5etree__ElementMatchIterator __pyx_base;
};


/* "lxml/etree.pyx":3026
 *         self._node = _elementFactory(node._doc, c_node) if c_node is not NULL else None
 * 
 * cdef class SiblingsIterator(_ElementMatchIterator):             # <<<<<<<<<<<<<<
 *     """SiblingsIterator(self, node, tag=None, preceding=False)
 *     Iterates over the siblings of an element.
*/
struct __pyx_obj_4lxml_5etree_SiblingsIterator {
  struct __pyx_obj_4lxml_5etree__ElementMatchIterator __pyx_base;
};


/* "lxml/etree.pyx":3041
 *         self._storeNext(node)
 * 
 * cdef class AncestorsIterator(_ElementMatchIterator):             # <<<<<<<<<<<<<<
 *     """AncestorsIterator(self, node, tag=None)
 *     Iterates over the ancestors of an element (from parent to parent).
*/
struct __pyx_obj_4lxml_5etree_AncestorsIterator {
  struct __pyx_obj_4lxml_5etree__ElementMatchIterator __pyx_base;
};


/* "lxml/etree.pyx":3051
 *         self._storeNext(node)
 * 
 * cdef class ElementDepthFirstIterator:             # <<<<<<<<<<<<<<
 *     """ElementDepthFirstIterator(self, node, tag=None, inclusive=True)
 *     Iterates over an element and its sub-elements in document order (depth
*/
struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree_ElementDepthFirstIterator *__pyx_vtab;
  struct LxmlElement *_next_node;
  struct LxmlElement *_top_node;
  struct __pyx_obj_4lxml_5etree__MultiTagMatcher *_matcher;
};


/* "lxml/etree.pyx":3128
 * 
 * 
 * cdef class ElementTextIterator:             # <<<<<<<<<<<<<<
 *     """ElementTextIterator(self, element, tag=None, with_tail=True)
 *     Iterates over the text content of a subtree.
*/
struct __pyx_obj_4lxml_5etree_ElementTextIterator {
  PyObject_HEAD
  PyObject *_events;
  struct LxmlElement *_start_element;
};


/* "lxml/etree.pyx":3271
 * 
 * 
 * cdef class CDATA:             # <<<<<<<<<<<<<<
 *     """CDATA(data)
 * 
*/
struct __pyx_obj_4lxml_5etree_CDATA {
  PyObject_HEAD
  PyObject *_utf8_data;
};


/* "src/lxml/readonlytree.pxi":3
 * # read-only tree implementation
 * 
 * @cython.internal             # <<<<<<<<<<<<<<
 * cdef class _ReadOnlyProxy:
 *     "A read-only proxy class suitable for PIs/Comments (for internal use only!)."
*/
struct __pyx_obj_4lxml_5etree__ReadOnlyProxy {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *__pyx_vtab;
  int _free_after_use;
  xmlNode *_c_node;
  struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *_source_proxy;
  PyObject *_dependent_proxies;
};


/* "src/lxml/readonlytree.pxi":246
 * 
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * cdef class _ReadOnlyPIProxy(_ReadOnlyProxy):
*/
struct __pyx_obj_4lxml_5etree__ReadOnlyPIProxy {
  struct __pyx_obj_4lxml_5etree__ReadOnlyProxy __pyx_base;
};


/* "src/lxml/readonlytree.pxi":255
 *         return funicode(self._c_node.name)
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * cdef class _ReadOnlyEntityProxy(_ReadOnlyProxy):
*/
struct __pyx_obj_4lxml_5etree__ReadOnlyEntityProxy {
  struct __pyx_obj_4lxml_5etree__ReadOnlyProxy __pyx_base;
};


/* "src/lxml/readonlytree.pxi":274
 * 
 * 
 * @cython.internal             # <<<<<<<<<<<<<<
 * cdef class _ReadOnlyElementProxy(_ReadOnlyProxy):
 *     """The main read-only Element proxy class (for internal use only!)."""
*/
struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy {
  struct __pyx_obj_4lxml_5etree__ReadOnlyProxy __pyx_base;
};


/* "src/lxml/readonlytree.pxi":375
 * # read-only status of the node, so use with caution.
 * 
 * @cython.internal             # <<<<<<<<<<<<<<
 * cdef class _OpaqueNodeWrapper:
 *     cdef tree.xmlNode* _c_node
*/
struct __pyx_obj_4lxml_5etree__OpaqueNodeWrapper {
  PyObject_HEAD
  xmlNode *_c_node;
};


/* "src/lxml/readonlytree.pxi":381
 *         raise TypeError, "This type cannot be instantiated from Python"
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * cdef class _OpaqueDocumentWrapper(_OpaqueNodeWrapper):
*/
struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper {
  struct __pyx_obj_4lxml_5etree__OpaqueNodeWrapper __pyx_base;
  struct __pyx_vtabstruct_4lxml_5etree__OpaqueDocumentWrapper *__pyx_vtab;
};


/* "src/lxml/readonlytree.pxi":426
 * # element proxies that allow restricted modification
 * 
 * @cython.internal             # <<<<<<<<<<<<<<
 * cdef class _ModifyContentOnlyProxy(_ReadOnlyProxy):
 *     """A read-only proxy that allows changing the text content.
*/
struct __pyx_obj_4lxml_5etree__ModifyContentOnlyProxy {
  struct __pyx_obj_4lxml_5etree__ReadOnlyProxy __pyx_base;
};


/* "src/lxml/readonlytree.pxi":448
 *             tree.xmlNodeSetContent(self._c_node, c_text)
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * cdef class _ModifyContentOnlyPIProxy(_ModifyContentOnlyProxy):
*/
struct __pyx_obj_4lxml_5etree__ModifyContentOnlyPIProxy {
  struct __pyx_obj_4lxml_5etree__ModifyContentOnlyProxy __pyx_base;
};


/* "src/lxml/readonlytree.pxi":465
 *             tree.xmlNodeSetName(self._c_node, c_text)
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * cdef class _ModifyContentOnlyEntityProxy(_ModifyContentOnlyProxy):
*/
struct __pyx_obj_4lxml_5etree__ModifyContentOnlyEntityProxy {
  struct __pyx_obj_4lxml_5etree__ModifyContentOnlyProxy __pyx_base;
};


/* "src/lxml/readonlytree.pxi":481
 * 
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * cdef class _AppendOnlyElementProxy(_ReadOnlyElementProxy):
*/
struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy {
  struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy __pyx_base;
};


/* "src/lxml/classlookup.pxi":6
 * # Custom Element classes
 * 
 * cdef public class ElementBase(_Element) [ type LxmlElementBaseType,             # <<<<<<<<<<<<<<
 *                                           object LxmlElementBase ]:
 *     """ElementBase(*children, attrib=None, nsmap=None, **_extra)
*/
struct LxmlElementBase {
  struct LxmlElement __pyx_base;
};

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) LxmlElementBaseType;

/* "src/lxml/classlookup.pxi":97
 *                 raise TypeError, f"Invalid child type: {type(child)!r}"
 * 
 * cdef class CommentBase(_Comment):             # <<<<<<<<<<<<<<
 *     """All custom Comment classes must inherit from this one.
 * 
*/
struct __pyx_obj_4lxml_5etree_CommentBase {
  struct __pyx_obj_4lxml_5etree__Comment __pyx_base;
};


/* "src/lxml/classlookup.pxi":126
 *         self._init()
 * 
 * cdef class PIBase(_ProcessingInstruction):             # <<<<<<<<<<<<<<
 *     """All custom Processing Instruction classes must inherit from this one.
 * 
*/
struct __pyx_obj_4lxml_5etree_PIBase {
  struct __pyx_obj_4lxml_5etree__ProcessingInstruction __pyx_base;
};


/* "src/lxml/classlookup.pxi":157
 *         self._init()
 * 
 * cdef class EntityBase(_Entity):             # <<<<<<<<<<<<<<
 *     """All custom Entity classes must inherit from this one.
 * 
*/
struct __pyx_obj_4lxml_5etree_EntityBase {
  struct __pyx_obj_4lxml_5etree__Entity __pyx_base;
};


/* "src/lxml/classlookup.pxi":213
 * 
 * # class to store element class lookup functions
 * cdef public class ElementClassLookup [ type LxmlElementClassLookupType,             # <<<<<<<<<<<<<<
 *                                        object LxmlElementClassLookup ]:
 *     """ElementClassLookup(self)
*/
struct LxmlElementClassLookup {
  PyObject_HEAD
  _element_class_lookup_function _lookup_function;
};

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) LxmlElementClassLookupType;

/* "src/lxml/classlookup.pxi":221
 * 
 * 
 * cdef public class FallbackElementClassLookup(ElementClassLookup) \             # <<<<<<<<<<<<<<
 *          [ type LxmlFallbackElementClassLookupType,
 *            object LxmlFallbackElementClassLookup ]:
*/
struct LxmlFallbackElementClassLookup {
  struct LxmlElementClassLookup __pyx_base;
  struct __pyx_vtabstruct_4lxml_5etree_FallbackElementClassLookup *__pyx_vtab;
  struct LxmlElementClassLookup *fallback;
  _element_class_lookup_function _fallback_function;
};

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) LxmlFallbackElementClassLookupType;

/* "src/lxml/classlookup.pxi":263
 * # default lookup scheme
 * 
 * cdef class ElementDefaultClassLookup(ElementClassLookup):             # <<<<<<<<<<<<<<
 *     """ElementDefaultClassLookup(self, element=None, comment=None, pi=None, entity=None)
 *     Element class lookup scheme that always returns the default Element
*/
struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup {
  struct LxmlElementClassLookup __pyx_base;
  PyObject *element_class;
  PyObject *comment_class;
  PyObject *pi_class;
  PyObject *entity_class;
};


/* "src/lxml/classlookup.pxi":342
 * # attribute based lookup scheme
 * 
 * cdef class AttributeBasedElementClassLookup(FallbackElementClassLookup):             # <<<<<<<<<<<<<<
 *     """AttributeBasedElementClassLookup(self, attribute_name, class_mapping, fallback=None)
 *     Checks an attribute of an Element and looks up the value in a
*/
struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup {
  struct LxmlFallbackElementClassLookup __pyx_base;
  PyObject *_class_mapping;
  PyObject *_pytag;
  const xmlChar *_c_ns;
  const xmlChar *_c_name;
};


/* "src/lxml/classlookup.pxi":394
 * #  per-parser lookup scheme
 * 
 * cdef class ParserBasedElementClassLookup(FallbackElementClassLookup):             # <<<<<<<<<<<<<<
 *     """ParserBasedElementClassLookup(self, fallback=None)
 *     Element class lookup based on the XML parser.
*/
struct __pyx_obj_4lxml_5etree_ParserBasedElementClassLookup {
  struct LxmlFallbackElementClassLookup __pyx_base;
};


/* "src/lxml/classlookup.pxi":411
 * #  custom class lookup based on node type, namespace, name
 * 
 * cdef class CustomElementClassLookup(FallbackElementClassLookup):             # <<<<<<<<<<<<<<
 *     """CustomElementClassLookup(self, fallback=None)
 *     Element class lookup based on a subclass method.
*/
struct __pyx_obj_4lxml_5etree_CustomElementClassLookup {
  struct LxmlFallbackElementClassLookup __pyx_base;
};


/* "src/lxml/classlookup.pxi":466
 * # read-only tree based class lookup
 * 
 * cdef class PythonElementClassLookup(FallbackElementClassLookup):             # <<<<<<<<<<<<<<
 *     """PythonElementClassLookup(self, fallback=None)
 *     Element class lookup based on a subclass method.
*/
struct __pyx_obj_4lxml_5etree_PythonElementClassLookup {
  struct LxmlFallbackElementClassLookup __pyx_base;
};


/* "src/lxml/nsclasses.pxi":3
 * # module-level API for namespace implementations
 * 
 * cdef class LxmlRegistryError(LxmlError):             # <<<<<<<<<<<<<<
 *     """Base class of lxml registry errors.
 *     """
*/
struct __pyx_obj_4lxml_5etree_LxmlRegistryError {
  struct __pyx_obj_4lxml_5etree_LxmlError __pyx_base;
};


/* "src/lxml/nsclasses.pxi":7
 *     """
 * 
 * cdef class NamespaceRegistryError(LxmlRegistryError):             # <<<<<<<<<<<<<<
 *     """Error registering a namespace extension.
 *     """
*/
struct __pyx_obj_4lxml_5etree_NamespaceRegistryError {
  struct __pyx_obj_4lxml_5etree_LxmlRegistryError __pyx_base;
};


/* "src/lxml/nsclasses.pxi":12
 * 
 * 
 * @cython.internal             # <<<<<<<<<<<<<<
 * cdef class _NamespaceRegistry:
 *     "Dictionary-like namespace registry"
*/
struct __pyx_obj_4lxml_5etree__NamespaceRegistry {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__NamespaceRegistry *__pyx_vtab;
  PyObject *_ns_uri;
  PyObject *_ns_uri_utf;
  PyObject *_entries;
  char *_c_ns_uri_utf;
};


/* "src/lxml/nsclasses.pxi":104
 * 
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * cdef class _ClassNamespaceRegistry(_NamespaceRegistry):
*/
struct __pyx_obj_4lxml_5etree__ClassNamespaceRegistry {
  struct __pyx_obj_4lxml_5etree__NamespaceRegistry __pyx_base;
};


/* "src/lxml/nsclasses.pxi":120
 * 
 * 
 * cdef class ElementNamespaceClassLookup(FallbackElementClassLookup):             # <<<<<<<<<<<<<<
 *     """ElementNamespaceClassLookup(self, fallback=None)
 * 
*/
struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup {
  struct LxmlFallbackElementClassLookup __pyx_base;
  PyObject *_namespace_registries;
};


/* "src/lxml/nsclasses.pxi":236
 *         return registry
 * 
 * @cython.internal             # <<<<<<<<<<<<<<
 * cdef class _FunctionNamespaceRegistry(_NamespaceRegistry):
 *     def __setitem__(self, name, item):
*/
struct __pyx_obj_4lxml_5etree__FunctionNamespaceRegistry {
  struct __pyx_obj_4lxml_5etree__NamespaceRegistry __pyx_base;
};


/* "src/lxml/nsclasses.pxi":250
 *         return "FunctionNamespace(%r)" % self._ns_uri
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * cdef class _XPathFunctionNamespaceRegistry(_FunctionNamespaceRegistry):
*/
struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry {
  struct __pyx_obj_4lxml_5etree__FunctionNamespaceRegistry __pyx_base;
  PyObject *_prefix;
  PyObject *_prefix_utf;
};


/* "src/lxml/docloader.pxi":10
 *     PARSER_DATA_FILE
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * cdef class _InputDocument:
*/
struct __pyx_obj_4lxml_5etree__InputDocument {
  PyObject_HEAD
  __pyx_t_4lxml_5etree__InputDocumentDataType _type;
  PyObject *_data_bytes;
  PyObject *_filename;
  PyObject *_file;
  int _close_file;
};


/* "src/lxml/docloader.pxi":23
 * 
 * 
 * cdef class Resolver:             # <<<<<<<<<<<<<<
 *     "This is the base class of all resolvers."
 *     def resolve(self, system_url, public_id, context):
*/
struct __pyx_obj_4lxml_5etree_Resolver {
  PyObject_HEAD
};


/* "src/lxml/docloader.pxi":111
 *         return doc_ref
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * cdef class _ResolverRegistry:
*/
struct __pyx_obj_4lxml_5etree__ResolverRegistry {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__ResolverRegistry *__pyx_vtab;
  PyObject *_resolvers;
  struct __pyx_obj_4lxml_5etree_Resolver *_default_resolver;
};


/* "src/lxml/docloader.pxi":161
 * 
 * 
 * @cython.internal             # <<<<<<<<<<<<<<
 * cdef class _ResolverContext(_ExceptionContext):
 *     cdef _ResolverRegistry _resolvers
*/
struct __pyx_obj_4lxml_5etree__ResolverContext {
  struct __pyx_obj_4lxml_5etree__ExceptionContext __pyx_base;
  struct __pyx_obj_4lxml_5etree__ResolverRegistry *_resolvers;
  struct __pyx_obj_4lxml_5etree__TempStore *_storage;
};


/* "src/lxml/parser.pxi":42
 *     """
 * 
 * cdef class ParserError(LxmlError):             # <<<<<<<<<<<<<<
 *     """Internal lxml parser error.
 *     """
*/
struct __pyx_obj_4lxml_5etree_ParserError {
  struct __pyx_obj_4lxml_5etree_LxmlError __pyx_base;
};


/* "src/lxml/parser.pxi":47
 * 
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * cdef class _ParserDictionaryContext:
*/
struct __pyx_obj_4lxml_5etree__ParserDictionaryContext {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext *__pyx_vtab;
  xmlDict *_c_dict;
  struct __pyx_obj_4lxml_5etree__BaseParser *_default_parser;
  PyObject *_implied_parser_contexts;
};


/* "src/lxml/parser.pxi":288
 * ############################################################
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * cdef class _FileReaderContext:
*/
struct __pyx_obj_4lxml_5etree__FileReaderContext {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__FileReaderContext *__pyx_vtab;
  PyObject *_filelike;
  PyObject *_encoding;
  PyObject *_url;
  PyObject *_bytes;
  struct __pyx_obj_4lxml_5etree__ExceptionContext *_exc_context;
  Py_ssize_t _bytes_read;
  char *_c_url;
  int _close_file_after_read;
};


/* "src/lxml/parser.pxi":541
 * ############################################################
 * 
 * @cython.no_gc_clear  # May have to call "self._validator.disconnect()" on dealloc.             # <<<<<<<<<<<<<<
 * @cython.internal
 * cdef class _ParserContext(_ResolverContext):
*/
struct __pyx_obj_4lxml_5etree__ParserContext {
  struct __pyx_obj_4lxml_5etree__ResolverContext __pyx_base;
  struct __pyx_obj_4lxml_5etree__ErrorLog *_error_log;
  struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *_validator;
  xmlParserCtxt *_c_ctxt;
  xmlExternalEntityLoader _orig_loader;
  PyThread_type_lock _lock;
  struct LxmlDocument *_doc;
  int _collect_ids;
};


/* "src/lxml/parser.pxi":835
 * 
 * 
 * @cython.internal             # <<<<<<<<<<<<<<
 * cdef class _BaseParser:
 *     cdef ElementClassLookup _class_lookup
*/
struct __pyx_obj_4lxml_5etree__BaseParser {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__BaseParser *__pyx_vtab;
  struct LxmlElementClassLookup *_class_lookup;
  struct __pyx_obj_4lxml_5etree__ResolverRegistry *_resolvers;
  struct __pyx_obj_4lxml_5etree__ParserContext *_parser_context;
  struct __pyx_obj_4lxml_5etree__ParserContext *_push_parser_context;
  int _parse_options;
  int _for_html;
  int _remove_comments;
  int _remove_pis;
  int _strip_cdata;
  int _collect_ids;
  int _resolve_external_entities;
  struct __pyx_obj_4lxml_5etree_XMLSchema *_schema;
  PyObject *_filename;
  PyObject *target;
  PyObject *_default_encoding;
  PyObject *_events_to_collect;
};


/* "src/lxml/parser.pxi":1349
 * ############################################################
 * 
 * cdef class _FeedParser(_BaseParser):             # <<<<<<<<<<<<<<
 *     cdef bint _feed_parser_running
 * 
*/
struct __pyx_obj_4lxml_5etree__FeedParser {
  struct __pyx_obj_4lxml_5etree__BaseParser __pyx_base;
  int _feed_parser_running;
};


/* "src/lxml/parser.pxi":1583
 * )
 * 
 * cdef class XMLParser(_FeedParser):             # <<<<<<<<<<<<<<
 *     """XMLParser(self, encoding=None, attribute_defaults=False, dtd_validation=False, \
 *                  load_dtd=False, no_network=True, decompress=False, ns_clean=False, \
*/
struct __pyx_obj_4lxml_5etree_XMLParser {
  struct __pyx_obj_4lxml_5etree__FeedParser __pyx_base;
};


/* "src/lxml/parser.pxi":1687
 * 
 * 
 * cdef class XMLPullParser(XMLParser):             # <<<<<<<<<<<<<<
 *     """XMLPullParser(self, events=None, *, tag=None, **kwargs)
 * 
*/
struct __pyx_obj_4lxml_5etree_XMLPullParser {
  struct __pyx_obj_4lxml_5etree_XMLParser __pyx_base;
};


/* "src/lxml/parser.pxi":1716
 * 
 * 
 * cdef class ETCompatXMLParser(XMLParser):             # <<<<<<<<<<<<<<
 *     """ETCompatXMLParser(self, encoding=None, attribute_defaults=False, \
 *                  dtd_validation=False, load_dtd=False, no_network=True, decompress=False, \
*/
struct __pyx_obj_4lxml_5etree_ETCompatXMLParser {
  struct __pyx_obj_4lxml_5etree_XMLParser __pyx_base;
};


/* "src/lxml/parser.pxi":1799
 * cdef object _UNUSED = object()
 * 
 * cdef class HTMLParser(_FeedParser):             # <<<<<<<<<<<<<<
 *     """HTMLParser(self, encoding=None, remove_blank_text=False, \
 *                    remove_comments=False, remove_pis=False, \
*/
struct __pyx_obj_4lxml_5etree_HTMLParser {
  struct __pyx_obj_4lxml_5etree__FeedParser __pyx_base;
};


/* "src/lxml/parser.pxi":1876
 * 
 * 
 * cdef class HTMLPullParser(HTMLParser):             # <<<<<<<<<<<<<<
 *     """HTMLPullParser(self, events=None, *, tag=None, base_url=None, **kwargs)
 * 
*/
struct __pyx_obj_4lxml_5etree_HTMLPullParser {
  struct __pyx_obj_4lxml_5etree_HTMLParser __pyx_base;
};


/* "src/lxml/saxparser.pxi":53
 * 
 * 
 * cdef class _SaxParserTarget:             # <<<<<<<<<<<<<<
 *     cdef int _sax_event_filter
 * 
*/
struct __pyx_obj_4lxml_5etree__SaxParserTarget {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__SaxParserTarget *__pyx_vtab;
  int _sax_event_filter;
};


/* "src/lxml/saxparser.pxi":75
 * 
 * #@cython.final
 * @cython.internal             # <<<<<<<<<<<<<<
 * @cython.no_gc_clear  # Required because parent class uses it - Cython bug.
 * cdef class _SaxParserContext(_ParserContext):
*/
struct __pyx_obj_4lxml_5etree__SaxParserContext {
  struct __pyx_obj_4lxml_5etree__ParserContext __pyx_base;
  struct __pyx_obj_4lxml_5etree__SaxParserTarget *_target;
  struct __pyx_obj_4lxml_5etree__BaseParser *_parser;
  startElementNsSAX2Func _origSaxStart;
  endElementNsSAX2Func _origSaxEnd;
  startElementSAXFunc _origSaxStartNoNs;
  endElementSAXFunc _origSaxEndNoNs;
  charactersSAXFunc _origSaxData;
  cdataBlockSAXFunc _origSaxCData;
  internalSubsetSAXFunc _origSaxDoctype;
  commentSAXFunc _origSaxComment;
  processingInstructionSAXFunc _origSaxPI;
  startDocumentSAXFunc _origSaxStartDocument;
  int _event_filter;
  PyObject *_ns_stack;
  PyObject *_node_stack;
  struct __pyx_obj_4lxml_5etree__ParseEventsIterator *events_iterator;
  struct LxmlElement *_root;
  struct __pyx_obj_4lxml_5etree__MultiTagMatcher *_matcher;
};


/* "src/lxml/saxparser.pxi":251
 * 
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * cdef class _ParseEventsIterator:
*/
struct __pyx_obj_4lxml_5etree__ParseEventsIterator {
  PyObject_HEAD
  PyObject *_events;
  int _event_index;
};


/* "src/lxml/saxparser.pxi":708
 * ############################################################
 * 
 * cdef class TreeBuilder(_SaxParserTarget):             # <<<<<<<<<<<<<<
 *     """TreeBuilder(self, element_factory=None, parser=None,
 *                     comment_factory=None, pi_factory=None,
*/
struct __pyx_obj_4lxml_5etree_TreeBuilder {
  struct __pyx_obj_4lxml_5etree__SaxParserTarget __pyx_base;
  struct __pyx_obj_4lxml_5etree__BaseParser *_parser;
  PyObject *_factory;
  PyObject *_comment_factory;
  PyObject *_pi_factory;
  PyObject *_data;
  PyObject *_element_stack;
  PyObject *_element_stack_pop;
  struct LxmlElement *_last;
  int _in_tail;
  int _insert_comments;
  int _insert_pis;
};


/* "src/lxml/parsertarget.pxi":18
 * 
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * cdef class _PythonSaxParserTarget(_SaxParserTarget):
*/
struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget {
  struct __pyx_obj_4lxml_5etree__SaxParserTarget __pyx_base;
  PyObject *_target_start;
  PyObject *_target_end;
  PyObject *_target_data;
  PyObject *_target_start_ns;
  PyObject *_target_end_ns;
  PyObject *_target_doctype;
  PyObject *_target_pi;
  PyObject *_target_comment;
  int _start_takes_nsmap;
};


/* "src/lxml/parsertarget.pxi":120
 * 
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * @cython.no_gc_clear  # Required because parent class uses it - Cython bug.
*/
struct __pyx_obj_4lxml_5etree__TargetParserContext {
  struct __pyx_obj_4lxml_5etree__SaxParserContext __pyx_base;
  PyObject *_python_target;
};


/* "src/lxml/serializer.pxi":7
 * 
 * 
 * cdef class SerialisationError(LxmlError):             # <<<<<<<<<<<<<<
 *     """A libxml2 error that occurred during serialisation.
 *     """
*/
struct __pyx_obj_4lxml_5etree_SerialisationError {
  struct __pyx_obj_4lxml_5etree_LxmlError __pyx_base;
};


/* "src/lxml/serializer.pxi":559
 * 
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * cdef class _FilelikeWriter:
*/
struct __pyx_obj_4lxml_5etree__FilelikeWriter {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__FilelikeWriter *__pyx_vtab;
  PyObject *_filelike;
  PyObject *_close_filelike;
  struct __pyx_obj_4lxml_5etree__ExceptionContext *_exc_context;
  struct __pyx_obj_4lxml_5etree__ErrorLog *error_log;
};


/* "src/lxml/serializer.pxi":901
 * 
 * 
 * cdef class C14NWriterTarget:             # <<<<<<<<<<<<<<
 *     """
 *     Canonicalization writer target for the XMLParser.
*/
struct __pyx_obj_4lxml_5etree_C14NWriterTarget {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree_C14NWriterTarget *__pyx_vtab;
  PyObject *_write;
  PyObject *_data;
  PyObject *_qname_aware_tags;
  PyObject *_find_qname_aware_attrs;
  PyObject *_declared_ns_stack;
  PyObject *_ns_stack;
  PyObject *_prefix_map;
  PyObject *_preserve_space;
  PyObject *_pending_start;
  PyObject *_exclude_tags;
  PyObject *_exclude_attrs;
  Py_ssize_t _ignored_depth;
  int _with_comments;
  int _strip_text;
  int _rewrite_prefixes;
  int _root_seen;
  int _root_done;
};


/* "src/lxml/serializer.pxi":1259
 * # incremental serialisation
 * 
 * cdef class xmlfile:             # <<<<<<<<<<<<<<
 *     """xmlfile(self, output_file, encoding=None, compression=None, close=False, buffered=True)
 * 
*/
struct __pyx_obj_4lxml_5etree_xmlfile {
  PyObject_HEAD
  PyObject *output_file;
  PyObject *encoding;
  struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *writer;
  struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *async_writer;
  int compresslevel;
  int close;
  int buffered;
  int method;
};


/* "src/lxml/serializer.pxi":1348
 * 
 * 
 * cdef class htmlfile(xmlfile):             # <<<<<<<<<<<<<<
 *     """htmlfile(self, output_file, encoding=None, compression=None, close=False, buffered=True)
 * 
*/
struct __pyx_obj_4lxml_5etree_htmlfile {
  struct __pyx_obj_4lxml_5etree_xmlfile __pyx_base;
};


/* "src/lxml/serializer.pxi":1367
 * 
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * cdef class _IncrementalFileWriter:
*/
struct __pyx_obj_4lxml_5etree__IncrementalFileWriter {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__IncrementalFileWriter *__pyx_vtab;
  xmlOutputBuffer *_c_out;
  PyObject *_encoding;
  const char *_c_encoding;
  struct __pyx_obj_4lxml_5etree__FilelikeWriter *_target;
  PyObject *_element_stack;
  int _status;
  int _method;
  int _buffered;
};


/* "src/lxml/serializer.pxi":1680
 * 
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * cdef class _AsyncDataWriter:
*/
struct __pyx_obj_4lxml_5etree__AsyncDataWriter {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__AsyncDataWriter *__pyx_vtab;
  PyObject *_data;
};


/* "src/lxml/serializer.pxi":1699
 * 
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * cdef class _AsyncIncrementalFileWriter:
*/
struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__AsyncIncrementalFileWriter *__pyx_vtab;
  struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *_writer;
  struct __pyx_obj_4lxml_5etree__AsyncDataWriter *_buffer;
  PyObject *_async_outfile;
  int _flush_after_writes;
  int _should_close;
  int _buffered;
};


/* "src/lxml/serializer.pxi":1764
 * 
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * cdef class _AsyncFileWriterElement:
*/
struct __pyx_obj_4lxml_5etree__AsyncFileWriterElement {
  PyObject_HEAD
  struct __pyx_obj_4lxml_5etree__FileWriterElement *_element_writer;
  struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *_writer;
};


/* "src/lxml/serializer.pxi":1788
 * 
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * @cython.freelist(8)
*/
struct __pyx_obj_4lxml_5etree__FileWriterElement {
  PyObject_HEAD
  struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *_writer;
  PyObject *_element;
  int _new_method;
  int _old_method;
};


/* "src/lxml/serializer.pxi":1812
 * 
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * @cython.freelist(8)
*/
struct __pyx_obj_4lxml_5etree__MethodChanger {
  PyObject_HEAD
  struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *_writer;
  int _new_method;
  int _old_method;
  int _entered;
  int _exited;
};


/* "src/lxml/iterparse.pxi":5
 * DEF __ITERPARSE_CHUNK_SIZE = 32768
 * 
 * cdef class iterparse:             # <<<<<<<<<<<<<<
 *     """iterparse(self, source, events=("end",), tag=None, \
 *                   attribute_defaults=False, dtd_validation=False, \
*/
struct __pyx_obj_4lxml_5etree_iterparse {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree_iterparse *__pyx_vtab;
  struct __pyx_obj_4lxml_5etree__FeedParser *_parser;
  PyObject *_tag;
  PyObject *_events;
  PyObject *root;
  PyObject *_source;
  PyObject *_filename;
  PyObject *_error;
  int _close_source_after_read;
};


/* "src/lxml/iterparse.pxi":239
 * 
 * 
 * cdef class iterwalk:             # <<<<<<<<<<<<<<
 *     """iterwalk(self, element_or_tree, events=("end",), tag=None)
 * 
*/
struct __pyx_obj_4lxml_5etree_iterwalk {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree_iterwalk *__pyx_vtab;
  struct __pyx_obj_4lxml_5etree__MultiTagMatcher *_matcher;
  PyObject *_node_stack;
  PyObject *_events;
  PyObject *_pop_event;
  PyObject *_include_siblings;
  int _index;
  int _event_filter;
  enum __pyx_t_4lxml_5etree__IterwalkSkipStates _skip_state;
};


/* "src/lxml/xmlid.pxi":58
 *     return _elementTreeFactory(doc, None), _IDDict(doc)
 * 
 * cdef class _IDDict:             # <<<<<<<<<<<<<<
 *     """IDDict(self, etree)
 *     A dictionary-like proxy class that mapps ID attributes to elements.
*/
struct __pyx_obj_4lxml_5etree__IDDict {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__IDDict *__pyx_vtab;
  struct LxmlDocument *_doc;
  PyObject *_keys;
  PyObject *_items;
};


/* "src/lxml/xinclude.pxi":6
 * 
 * 
 * cdef class XIncludeError(LxmlError):             # <<<<<<<<<<<<<<
 *     """Error during XInclude processing.
 *     """
*/
struct __pyx_obj_4lxml_5etree_XIncludeError {
  struct __pyx_obj_4lxml_5etree_LxmlError __pyx_base;
};


/* "src/lxml/xinclude.pxi":11
 * 
 * 
 * cdef class XInclude:             # <<<<<<<<<<<<<<
 *     """XInclude(self)
 *     XInclude processor.
*/
struct __pyx_obj_4lxml_5etree_XInclude {
  PyObject_HEAD
  struct __pyx_obj_4lxml_5etree__ErrorLog *_error_log;
};


/* "src/lxml/extensions.pxi":3
 * # support for extension functions in XPath and XSLT
 * 
 * cdef class XPathError(LxmlError):             # <<<<<<<<<<<<<<
 *     """Base class of all XPath errors.
 *     """
*/
struct __pyx_obj_4lxml_5etree_XPathError {
  struct __pyx_obj_4lxml_5etree_LxmlError __pyx_base;
};


/* "src/lxml/extensions.pxi":7
 *     """
 * 
 * cdef class XPathEvalError(XPathError):             # <<<<<<<<<<<<<<
 *     """Error during XPath evaluation.
 *     """
*/
struct __pyx_obj_4lxml_5etree_XPathEvalError {
  struct __pyx_obj_4lxml_5etree_XPathError __pyx_base;
};


/* "src/lxml/extensions.pxi":11
 *     """
 * 
 * cdef class XPathFunctionError(XPathEvalError):             # <<<<<<<<<<<<<<
 *     """Internal error looking up an XPath extension function.
 *     """
*/
struct __pyx_obj_4lxml_5etree_XPathFunctionError {
  struct __pyx_obj_4lxml_5etree_XPathEvalError __pyx_base;
};


/* "src/lxml/extensions.pxi":15
 *     """
 * 
 * cdef class XPathResultError(XPathEvalError):             # <<<<<<<<<<<<<<
 *     """Error handling an XPath result.
 *     """
*/
struct __pyx_obj_4lxml_5etree_XPathResultError {
  struct __pyx_obj_4lxml_5etree_XPathEvalError __pyx_base;
};


/* "src/lxml/extensions.pxi":28
 * # Base class for XSLT and XPath evaluation contexts: functions, namespaces, ...
 * 
 * @cython.internal             # <<<<<<<<<<<<<<
 * cdef class _BaseContext:
 *     cdef xpath.xmlXPathContext* _xpathCtxt
*/
struct __pyx_obj_4lxml_5etree__BaseContext {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__BaseContext *__pyx_vtab;
  xmlXPathContext *_xpathCtxt;
  struct LxmlDocument *_doc;
  PyObject *_extensions;
  PyObject *_namespaces;
  PyObject *_global_namespaces;
  PyObject *_utf_refs;
  PyObject *_function_cache;
  PyObject *_eval_context_dict;
  int _build_smart_strings;
  struct __pyx_obj_4lxml_5etree__TempStore *_temp_refs;
  PyObject *_temp_documents;
  struct __pyx_obj_4lxml_5etree__ExceptionContext *_exc;
  struct __pyx_obj_4lxml_5etree__ErrorLog *_error_log;
};


/* "src/lxml/extensions.pxi":23
 * 
 * ctypedef int (*_register_function)(void* ctxt, name_utf, ns_uri_utf)
 * cdef class _ExsltRegExp             # <<<<<<<<<<<<<<
 * 
 * ################################################################################
*/
struct __pyx_obj_4lxml_5etree__ExsltRegExp {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__ExsltRegExp *__pyx_vtab;
  PyObject *_compile_map;
};


/* "src/lxml/extensions.pxi":720
 * # special str/unicode subclasses
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * cdef class _ElementUnicodeResult(unicode):
 *     cdef _Element _parent
*/
struct __pyx_obj_4lxml_5etree__ElementUnicodeResult {
  PyUnicodeObject __pyx_base;
  struct LxmlElement *_parent;
  PyObject *attrname;
  int is_tail;
};


/* "src/lxml/xpath.pxi":48
 * 
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * cdef class _XPathContext(_BaseContext):
*/
struct __pyx_obj_4lxml_5etree__XPathContext {
  struct __pyx_obj_4lxml_5etree__BaseContext __pyx_base;
  PyObject *_variables;
};


/* "src/lxml/xpath.pxi":116
 * 
 * 
 * cdef class _XPathEvaluatorBase:             # <<<<<<<<<<<<<<
 *     cdef xpath.xmlXPathContext* _xpathCtxt
 *     cdef _XPathContext _context
*/
struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__XPathEvaluatorBase *__pyx_vtab;
  xmlXPathContext *_xpathCtxt;
  struct __pyx_obj_4lxml_5etree__XPathContext *_context;
  PyThread_type_lock _eval_lock;
  struct __pyx_obj_4lxml_5etree__ErrorLog *_error_log;
};


/* "src/lxml/xpath.pxi":221
 * 
 * 
 * cdef class XPathElementEvaluator(_XPathEvaluatorBase):             # <<<<<<<<<<<<<<
 *     """XPathElementEvaluator(self, element, namespaces=None, extensions=None, regexp=True, smart_strings=True)
 *     Create an XPath evaluator for an element.
*/
struct __pyx_obj_4lxml_5etree_XPathElementEvaluator {
  struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase __pyx_base;
  struct LxmlElement *_element;
};


/* "src/lxml/xpath.pxi":298
 * 
 * 
 * cdef class XPathDocumentEvaluator(XPathElementEvaluator):             # <<<<<<<<<<<<<<
 *     """XPathDocumentEvaluator(self, etree, namespaces=None, extensions=None, regexp=True, smart_strings=True)
 *     Create an XPath evaluator for an ElementTree.
*/
struct __pyx_obj_4lxml_5etree_XPathDocumentEvaluator {
  struct __pyx_obj_4lxml_5etree_XPathElementEvaluator __pyx_base;
};


/* "src/lxml/xpath.pxi":377
 * 
 * 
 * cdef class XPath(_XPathEvaluatorBase):             # <<<<<<<<<<<<<<
 *     """XPath(self, path, namespaces=None, extensions=None, regexp=True, smart_strings=True)
 *     A compiled XPath expression that can be called on Elements and ElementTrees.
*/
struct __pyx_obj_4lxml_5etree_XPath {
  struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase __pyx_base;
  xmlXPathCompExpr *_xpath;
  PyObject *_path;
};


/* "src/lxml/xpath.pxi":451
 * cdef object _find_namespaces = re.compile(b'({[^}]+})').findall
 * 
 * cdef class ETXPath(XPath):             # <<<<<<<<<<<<<<
 *     """ETXPath(self, path, extensions=None, regexp=True, smart_strings=True)
 *     Special XPath class that supports the ElementTree {uri} notation for namespaces.
*/
struct __pyx_obj_4lxml_5etree_ETXPath {
  struct __pyx_obj_4lxml_5etree_XPath __pyx_base;
};


/* "src/lxml/xslt.pxi":5
 * 
 * 
 * cdef class XSLTError(LxmlError):             # <<<<<<<<<<<<<<
 *     """Base class of all XSLT errors.
 *     """
*/
struct __pyx_obj_4lxml_5etree_XSLTError {
  struct __pyx_obj_4lxml_5etree_LxmlError __pyx_base;
};


/* "src/lxml/xslt.pxi":9
 *     """
 * 
 * cdef class XSLTParseError(XSLTError):             # <<<<<<<<<<<<<<
 *     """Error parsing a stylesheet document.
 *     """
*/
struct __pyx_obj_4lxml_5etree_XSLTParseError {
  struct __pyx_obj_4lxml_5etree_XSLTError __pyx_base;
};


/* "src/lxml/xslt.pxi":13
 *     """
 * 
 * cdef class XSLTApplyError(XSLTError):             # <<<<<<<<<<<<<<
 *     """Error running an XSL transformation.
 *     """
*/
struct __pyx_obj_4lxml_5etree_XSLTApplyError {
  struct __pyx_obj_4lxml_5etree_XSLTError __pyx_base;
};


/* "src/lxml/xslt.pxi":21
 *     """
 * 
 * cdef class XSLTExtensionError(XSLTError):             # <<<<<<<<<<<<<<
 *     """Error registering an XSLT extension.
 *     """
*/
struct __pyx_obj_4lxml_5etree_XSLTExtensionError {
  struct __pyx_obj_4lxml_5etree_XSLTError __pyx_base;
};


/* "src/lxml/xslt.pxi":46
 * # XSLT document loaders
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * cdef class _XSLTResolverContext(_ResolverContext):
*/
struct __pyx_obj_4lxml_5etree__XSLTResolverContext {
  struct __pyx_obj_4lxml_5etree__ResolverContext __pyx_base;
  xmlDoc *_c_style_doc;
  struct __pyx_obj_4lxml_5etree__BaseParser *_parser;
};


/* "src/lxml/xslt.pxi":170
 * # XSLT file/network access control
 * 
 * cdef class XSLTAccessControl:             # <<<<<<<<<<<<<<
 *     """XSLTAccessControl(self, read_file=True, write_file=True, create_dir=True, read_network=True, write_network=True)
 * 
*/
struct __pyx_obj_4lxml_5etree_XSLTAccessControl {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree_XSLTAccessControl *__pyx_vtab;
  xsltSecurityPrefs *_prefs;
};


/* "src/lxml/xslt.pxi":271
 * cdef dict EMPTY_DICT = {}
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * cdef class _XSLTContext(_BaseContext):
*/
struct __pyx_obj_4lxml_5etree__XSLTContext {
  struct __pyx_obj_4lxml_5etree__BaseContext __pyx_base;
  xsltTransformContext *_xsltCtxt;
  struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *_extension_element_proxy;
  PyObject *_extension_elements;
};


/* "src/lxml/xslt.pxi":323
 * 
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * @cython.freelist(8)
*/
struct __pyx_obj_4lxml_5etree__XSLTQuotedStringParam {
  PyObject_HEAD
  PyObject *strval;
};


/* "src/lxml/xslt.pxi":335
 * 
 * 
 * @cython.no_gc_clear             # <<<<<<<<<<<<<<
 * cdef class XSLT:
 *     """XSLT(self, xslt_input, extensions=None, regexp=True, access_control=None)
*/
struct __pyx_obj_4lxml_5etree_XSLT {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree_XSLT *__pyx_vtab;
  struct __pyx_obj_4lxml_5etree__XSLTContext *_context;
  xsltStylesheet *_c_style;
  struct __pyx_obj_4lxml_5etree__XSLTResolverContext *_xslt_resolver_context;
  struct __pyx_obj_4lxml_5etree_XSLTAccessControl *_access_control;
  struct __pyx_obj_4lxml_5etree__ErrorLog *_error_log;
};


/* "src/lxml/xslt.pxi":707
 *     return new_xslt
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * cdef class _XSLTResultTree(_ElementTree):
 *     """The result of an XSLT evaluation.
*/
struct __pyx_obj_4lxml_5etree__XSLTResultTree {
  struct LxmlElementTree __pyx_base;
  struct __pyx_obj_4lxml_5etree_XSLT *_xslt;
  struct LxmlDocument *_profile;
  xmlChar *_buffer;
  Py_ssize_t _buffer_len;
  Py_ssize_t _buffer_refcnt;
};


/* "src/lxml/xslt.pxi":882
 *     return __findStylesheetByID(doc, id=id)
 * 
 * cdef class _XSLTProcessingInstruction(PIBase):             # <<<<<<<<<<<<<<
 *     def parseXSL(self, parser=None):
 *         """parseXSL(self, parser=None)
*/
struct __pyx_obj_4lxml_5etree__XSLTProcessingInstruction {
  struct __pyx_obj_4lxml_5etree_PIBase __pyx_base;
};


/* "src/lxml/xsltext.pxi":3
 * # XSLT extension elements
 * 
 * cdef class XSLTExtension:             # <<<<<<<<<<<<<<
 *     """Base class of an XSLT extension element.
 *     """
*/
struct __pyx_obj_4lxml_5etree_XSLTExtension {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree_XSLTExtension *__pyx_vtab;
};


/* "lxml/etree.pyx":3789
 * # Validation
 * 
 * cdef class DocumentInvalid(LxmlError):             # <<<<<<<<<<<<<<
 *     """Validation error.
 * 
*/
struct __pyx_obj_4lxml_5etree_DocumentInvalid {
  struct __pyx_obj_4lxml_5etree_LxmlError __pyx_base;
};


/* "lxml/etree.pyx":3797
 * 
 * 
 * cdef class _Validator:             # <<<<<<<<<<<<<<
 *     "Base class for XML validators."
 *     cdef _ErrorLog _error_log
*/
struct __pyx_obj_4lxml_5etree__Validator {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__Validator *__pyx_vtab;
  struct __pyx_obj_4lxml_5etree__ErrorLog *_error_log;
};


/* "src/lxml/dtd.pxi":4
 * from lxml.includes cimport dtdvalid
 * 
 * cdef class DTDError(LxmlError):             # <<<<<<<<<<<<<<
 *     """Base class for DTD errors.
 *     """
*/
struct __pyx_obj_4lxml_5etree_DTDError {
  struct __pyx_obj_4lxml_5etree_LxmlError __pyx_base;
};


/* "src/lxml/dtd.pxi":8
 *     """
 * 
 * cdef class DTDParseError(DTDError):             # <<<<<<<<<<<<<<
 *     """Error while parsing a DTD.
 *     """
*/
struct __pyx_obj_4lxml_5etree_DTDParseError {
  struct __pyx_obj_4lxml_5etree_DTDError __pyx_base;
};


/* "src/lxml/dtd.pxi":12
 *     """
 * 
 * cdef class DTDValidateError(DTDError):             # <<<<<<<<<<<<<<
 *     """Error while validating an XML document with a DTD.
 *     """
*/
struct __pyx_obj_4lxml_5etree_DTDValidateError {
  struct __pyx_obj_4lxml_5etree_DTDError __pyx_base;
};


/* "src/lxml/dtd.pxi":21
 * 
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * @cython.freelist(8)
*/
struct __pyx_obj_4lxml_5etree__DTDElementContentDecl {
  PyObject_HEAD
  struct __pyx_obj_4lxml_5etree_DTD *_dtd;
  xmlElementContent *_c_node;
};


/* "src/lxml/dtd.pxi":91
 * 
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * @cython.freelist(8)
*/
struct __pyx_obj_4lxml_5etree__DTDAttributeDecl {
  PyObject_HEAD
  struct __pyx_obj_4lxml_5etree_DTD *_dtd;
  xmlAttribute *_c_node;
};


/* "src/lxml/dtd.pxi":174
 * 
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * @cython.freelist(8)
*/
struct __pyx_obj_4lxml_5etree__DTDElementDecl {
  PyObject_HEAD
  struct __pyx_obj_4lxml_5etree_DTD *_dtd;
  xmlElement *_c_node;
};


/* "src/lxml/dtd.pxi":237
 * 
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * @cython.freelist(8)
*/
struct __pyx_obj_4lxml_5etree__DTDEntityDecl {
  PyObject_HEAD
  struct __pyx_obj_4lxml_5etree_DTD *_dtd;
  xmlEntity *_c_node;
};


/* "src/lxml/dtd.pxi":270
 * # DTD
 * 
 * cdef class DTD(_Validator):             # <<<<<<<<<<<<<<
 *     """DTD(self, file=None, external_id=None)
 *     A DTD validator.
*/
struct __pyx_obj_4lxml_5etree_DTD {
  struct __pyx_obj_4lxml_5etree__Validator __pyx_base;
  xmlDtd *_c_dtd;
};


/* "src/lxml/relaxng.pxi":18
 * 
 * 
 * cdef class RelaxNGError(LxmlError):             # <<<<<<<<<<<<<<
 *     """Base class for RelaxNG errors.
 *     """
*/
struct __pyx_obj_4lxml_5etree_RelaxNGError {
  struct __pyx_obj_4lxml_5etree_LxmlError __pyx_base;
};


/* "src/lxml/relaxng.pxi":22
 *     """
 * 
 * cdef class RelaxNGParseError(RelaxNGError):             # <<<<<<<<<<<<<<
 *     """Error while parsing an XML document as RelaxNG.
 *     """
*/
struct __pyx_obj_4lxml_5etree_RelaxNGParseError {
  struct __pyx_obj_4lxml_5etree_RelaxNGError __pyx_base;
};


/* "src/lxml/relaxng.pxi":26
 *     """
 * 
 * cdef class RelaxNGValidateError(RelaxNGError):             # <<<<<<<<<<<<<<
 *     """Error while validating an XML document with a RelaxNG schema.
 *     """
*/
struct __pyx_obj_4lxml_5etree_RelaxNGValidateError {
  struct __pyx_obj_4lxml_5etree_RelaxNGError __pyx_base;
};


/* "src/lxml/relaxng.pxi":34
 * # RelaxNG
 * 
 * cdef class RelaxNG(_Validator):             # <<<<<<<<<<<<<<
 *     """RelaxNG(self, etree=None, file=None)
 *     Turn a document into a Relax NG validator.
*/
struct __pyx_obj_4lxml_5etree_RelaxNG {
  struct __pyx_obj_4lxml_5etree__Validator __pyx_base;
  xmlRelaxNG *_c_schema;
};


/* "src/lxml/xmlschema.pxi":5
 * 
 * 
 * cdef class XMLSchemaError(LxmlError):             # <<<<<<<<<<<<<<
 *     """Base class of all XML Schema errors
 *     """
*/
struct __pyx_obj_4lxml_5etree_XMLSchemaError {
  struct __pyx_obj_4lxml_5etree_LxmlError __pyx_base;
};


/* "src/lxml/xmlschema.pxi":9
 *     """
 * 
 * cdef class XMLSchemaParseError(XMLSchemaError):             # <<<<<<<<<<<<<<
 *     """Error while parsing an XML document as XML Schema.
 *     """
*/
struct __pyx_obj_4lxml_5etree_XMLSchemaParseError {
  struct __pyx_obj_4lxml_5etree_XMLSchemaError __pyx_base;
};


/* "src/lxml/xmlschema.pxi":13
 *     """
 * 
 * cdef class XMLSchemaValidateError(XMLSchemaError):             # <<<<<<<<<<<<<<
 *     """Error while validating an XML document with an XML Schema.
 *     """
*/
struct __pyx_obj_4lxml_5etree_XMLSchemaValidateError {
  struct __pyx_obj_4lxml_5etree_XMLSchemaError __pyx_base;
};


/* "src/lxml/xmlschema.pxi":26
 * 
 * 
 * cdef class XMLSchema(_Validator):             # <<<<<<<<<<<<<<
 *     """XMLSchema(self, etree=None, file=None)
 *     Turn a document into an XML Schema validator.
*/
struct __pyx_obj_4lxml_5etree_XMLSchema {
  struct __pyx_obj_4lxml_5etree__Validator __pyx_base;
  xmlSchema *_c_schema;
  struct LxmlDocument *_doc;
  int _has_default_attributes;
  int _add_attribute_defaults;
};


/* "src/lxml/xmlschema.pxi":158
 *         return context
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * cdef class _ParserSchemaValidationContext:
*/
struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__ParserSchemaValidationContext *__pyx_vtab;
  struct __pyx_obj_4lxml_5etree_XMLSchema *_schema;
  xmlSchemaValidCtxt *_valid_ctxt;
  xmlSchemaSAXPlugStruct *_sax_plug;
  int _add_default_attributes;
};


/* "src/lxml/schematron.pxi":5
 * 
 * 
 * cdef class SchematronError(LxmlError):             # <<<<<<<<<<<<<<
 *     """Base class of all Schematron errors.
 *     """
*/
struct __pyx_obj_4lxml_5etree_SchematronError {
  struct __pyx_obj_4lxml_5etree_LxmlError __pyx_base;
};


/* "src/lxml/schematron.pxi":9
 *     """
 * 
 * cdef class SchematronParseError(SchematronError):             # <<<<<<<<<<<<<<
 *     """Error while parsing an XML document as Schematron schema.
 *     """
*/
struct __pyx_obj_4lxml_5etree_SchematronParseError {
  struct __pyx_obj_4lxml_5etree_SchematronError __pyx_base;
};


/* "src/lxml/schematron.pxi":13
 *     """
 * 
 * cdef class SchematronValidateError(SchematronError):             # <<<<<<<<<<<<<<
 *     """Error while validating an XML document with a Schematron schema.
 *     """
*/
struct __pyx_obj_4lxml_5etree_SchematronValidateError {
  struct __pyx_obj_4lxml_5etree_SchematronError __pyx_base;
};


/* "src/lxml/schematron.pxi":21
 * # Schematron
 * 
 * cdef class Schematron(_Validator):             # <<<<<<<<<<<<<<
 *     """Schematron(self, etree=None, file=None)
 *     A Schematron validator.
*/
struct __pyx_obj_4lxml_5etree_Schematron {
  struct __pyx_obj_4lxml_5etree__Validator __pyx_base;
  xmlSchematron *_c_schema;
  xmlDoc *_c_schema_doc;
};


/* "src/lxml/debug.pxi":1
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * cdef class _MemDebug:
*/
struct __pyx_obj_4lxml_5etree__MemDebug {
  PyObject_HEAD
};


/* "src/lxml/serializer.pxi":541
 * cdef object _open_utf8_file
 * 
 * @contextmanager             # <<<<<<<<<<<<<<
 * def _open_utf8_file(file, compression=0):
 *     file = _getFSPathOrObject(file)
*/
struct __pyx_obj_4lxml_5etree___pyx_scope_struct___open_utf8_file {
  PyObject_HEAD
  PyObject *__pyx_v_compression;
  PyObject *__pyx_v_f;
  PyObject *__pyx_v_file;
  PyObject *__pyx_v_zf;
  PyObject *__pyx_t_0;
  PyObject *__pyx_t_1;
  PyObject *__pyx_t_2;
  PyObject *__pyx_t_3;
};


/* "src/lxml/serializer.pxi":974
 *         self._root_done = False
 * 
 *     def _iter_namespaces(self, ns_stack):             # <<<<<<<<<<<<<<
 *         for namespaces in reversed(ns_stack):
 *             if namespaces:  # almost no element declares new namespaces
*/
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_1__iter_namespaces {
  PyObject_HEAD
  PyObject *__pyx_v_namespaces;
  PyObject *__pyx_v_ns_stack;
  struct __pyx_obj_4lxml_5etree_C14NWriterTarget *__pyx_v_self;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* "src/lxml/serializer.pxi":1328
 *                 self.output_file = None
 * 
 *     async def __aenter__(self):             # <<<<<<<<<<<<<<
 *         assert self.output_file is not None
 *         if isinstance(self.output_file, basestring):
*/
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_2___aenter__ {
  PyObject_HEAD
  struct __pyx_obj_4lxml_5etree_xmlfile *__pyx_v_self;
};


/* "src/lxml/serializer.pxi":1339
 *         return self.async_writer
 * 
 *     async def __aexit__(self, exc_type, exc_val, exc_tb):             # <<<<<<<<<<<<<<
 *         if self.async_writer is not None:
 *             old_writer, self.async_writer = self.async_writer, None
*/
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_3___aexit__ {
  PyObject_HEAD
  PyObject *__pyx_v_exc_tb;
  PyObject *__pyx_v_exc_type;
  PyObject *__pyx_v_exc_val;
  struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *__pyx_v_old_writer;
  PyObject *__pyx_v_raise_on_error;
  struct __pyx_obj_4lxml_5etree_xmlfile *__pyx_v_self;
};


/* "src/lxml/serializer.pxi":1724
 *         return None
 * 
 *     async def flush(self):             # <<<<<<<<<<<<<<
 *         self._writer.flush()
 *         data = self._buffer.collect()
*/
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_4_flush {
  PyObject_HEAD
  PyObject *__pyx_v_data;
  struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *__pyx_v_self;
};


/* "src/lxml/serializer.pxi":1730
 *             await self._async_outfile.write(data)
 * 
 *     async def write_declaration(self, version=None, standalone=None, doctype=None):             # <<<<<<<<<<<<<<
 *         self._writer.write_declaration(version, standalone, doctype)
 *         data = self._flush()
*/
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_5_write_declaration {
  PyObject_HEAD
  PyObject *__pyx_v_data;
  PyObject *__pyx_v_doctype;
  struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *__pyx_v_self;
  PyObject *__pyx_v_standalone;
  PyObject *__pyx_v_version;
};


/* "src/lxml/serializer.pxi":1736
 *             await self._async_outfile.write(data)
 * 
 *     async def write_doctype(self, doctype):             # <<<<<<<<<<<<<<
 *         self._writer.write_doctype(doctype)
 *         data = self._flush()
*/
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_6_write_doctype {
  PyObject_HEAD
  PyObject *__pyx_v_data;
  PyObject *__pyx_v_doctype;
  struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *__pyx_v_self;
};


/* "src/lxml/serializer.pxi":1742
 *             await self._async_outfile.write(data)
 * 
 *     async def write(self, *args, with_tail=True, pretty_print=False, method=None):             # <<<<<<<<<<<<<<
 *         self._writer.write(*args, with_tail=with_tail, pretty_print=pretty_print, method=method)
 *         data = self._flush()
*/
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_7_write {
  PyObject_HEAD
  PyObject *__pyx_v_args;
  PyObject *__pyx_v_data;
  PyObject *__pyx_v_method;
  PyObject *__pyx_v_pretty_print;
  struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *__pyx_v_self;
  PyObject *__pyx_v_with_tail;
};


/* "src/lxml/serializer.pxi":1755
 *         return _AsyncFileWriterElement(element_writer, self)
 * 
 *     async def _close(self, bint raise_on_error):             # <<<<<<<<<<<<<<
 *         self._writer._close(raise_on_error)
 *         data = self._buffer.collect()
*/
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_8__close {
  PyObject_HEAD
  PyObject *__pyx_v_data;
  int __pyx_v_raise_on_error;
  struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *__pyx_v_self;
};


/* "src/lxml/serializer.pxi":1775
 *         self._writer = writer
 * 
 *     async def __aenter__(self):             # <<<<<<<<<<<<<<
 *         self._element_writer.__enter__()
 *         data = self._writer._flush()
*/
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_9___aenter__ {
  PyObject_HEAD
  PyObject *__pyx_v_data;
  struct __pyx_obj_4lxml_5etree__AsyncFileWriterElement *__pyx_v_self;
};


/* "src/lxml/serializer.pxi":1781
 *             await self._writer._async_outfile.write(data)
 * 
 *     async def __aexit__(self, *args):             # <<<<<<<<<<<<<<
 *         self._element_writer.__exit__(*args)
 *         data = self._writer._flush()
*/
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_10___aexit__ {
  PyObject_HEAD
  PyObject *__pyx_v_args;
  PyObject *__pyx_v_data;
  struct __pyx_obj_4lxml_5etree__AsyncFileWriterElement *__pyx_v_self;
};


/* "src/lxml/serializer.pxi":1843
 *         self._exited = True
 * 
 *     async def __aenter__(self):             # <<<<<<<<<<<<<<
 *         # for your async convenience
 *         return self.__enter__()
*/
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_11___aenter__ {
  PyObject_HEAD
  struct __pyx_obj_4lxml_5etree__MethodChanger *__pyx_v_self;
};


/* "src/lxml/serializer.pxi":1847
 *         return self.__enter__()
 * 
 *     async def __aexit__(self, *args):             # <<<<<<<<<<<<<<
 *         # for your async convenience
 *         return self.__exit__(*args)
*/
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_12___aexit__ {
  PyObject_HEAD
  PyObject *__pyx_v_args;
  struct __pyx_obj_4lxml_5etree__MethodChanger *__pyx_v_self;
};


/* "src/lxml/dtd.pxi":163
 *        return funicodeOrNone(self._c_node.defaultValue)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         _assertValidDTDNode(self, self._c_node)
 *         cdef tree.xmlEnumeration *c_node = self._c_node.tree
*/
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_13_itervalues {
  PyObject_HEAD
  xmlEnumeration *__pyx_v_c_node;
  struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *__pyx_v_self;
};


/* "src/lxml/dtd.pxi":223
 *            return None
 * 
 *     def iterattributes(self):             # <<<<<<<<<<<<<<
 *         _assertValidDTDNode(self, self._c_node)
 *         cdef tree.xmlAttribute *c_node = self._c_node.attributes
*/
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_14_iterattributes {
  PyObject_HEAD
  xmlAttribute *__pyx_v_c_node;
  struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *__pyx_v_node;
  struct __pyx_obj_4lxml_5etree__DTDElementDecl *__pyx_v_self;
};


/* "src/lxml/dtd.pxi":327
 *        return funicodeOrNone(self._c_dtd.SystemID)
 * 
 *     def iterelements(self):             # <<<<<<<<<<<<<<
 *         cdef tree.xmlNode *c_node = self._c_dtd.children if self._c_dtd is not NULL else NULL
 *         while c_node is not NULL:
*/
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_15_iterelements {
  PyObject_HEAD
  xmlNode *__pyx_v_c_node;
  struct __pyx_obj_4lxml_5etree__DTDElementDecl *__pyx_v_node;
  struct __pyx_obj_4lxml_5etree_DTD *__pyx_v_self;
};


/* "src/lxml/dtd.pxi":340
 *         return list(self.iterelements())
 * 
 *     def iterentities(self):             # <<<<<<<<<<<<<<
 *         cdef tree.xmlNode *c_node = self._c_dtd.children if self._c_dtd is not NULL else NULL
 *         while c_node is not NULL:
*/
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_16_iterentities {
  PyObject_HEAD
  xmlNode *__pyx_v_c_node;
  struct __pyx_obj_4lxml_5etree__DTDEntityDecl *__pyx_v_node;
  struct __pyx_obj_4lxml_5etree_DTD *__pyx_v_self;
};


/* "View.MemoryView":110
 * 
 * 
 * @cython.collection_type("sequence")             # <<<<<<<<<<<<<<
 * @cname("__pyx_array")
 * cdef class array:
*/
struct __pyx_array_obj {
  PyObject_HEAD
  struct __pyx_vtabstruct_array *__pyx_vtab;
  char *data;
  Py_ssize_t len;
  char *format;
  int ndim;
  Py_ssize_t *_shape;
  Py_ssize_t *_strides;
  Py_ssize_t itemsize;
  PyObject *mode;
  PyObject *_format;
  void (*callback_free_data)(void *);
  int free_data;
  int dtype_is_object;
};


/* "View.MemoryView":299
 * 
 * 
 * @cname('__pyx_MemviewEnum')             # <<<<<<<<<<<<<<
 * cdef class Enum(object):
 *     cdef object name
*/
struct __pyx_MemviewEnum_obj {
  PyObject_HEAD
  PyObject *name;
};


/* "View.MemoryView":334
 * 
 * 
 * @cname('__pyx_memoryview')             # <<<<<<<<<<<<<<
 * cdef class memoryview:
 * 
*/
struct __pyx_memoryview_obj {
  PyObject_HEAD
  struct __pyx_vtabstruct_memoryview *__pyx_vtab;
  PyObject *obj;
  PyObject *_size;
  void *_unused;
  PyThread_type_lock lock;
  __pyx_atomic_int_type acquisition_count;
  Py_buffer view;
  int flags;
  int dtype_is_object;
  __Pyx_TypeInfo const *typeinfo;
};


/* "View.MemoryView":951
 * 
 * 
 * @cython.collection_type("sequence")             # <<<<<<<<<<<<<<
 * @cname('__pyx_memoryviewslice')
 * cdef class _memoryviewslice(memoryview):
*/
struct __pyx_memoryviewslice_obj {
  struct __pyx_memoryview_obj __pyx_base;
  __Pyx_memviewslice from_slice;
  PyObject *from_object;
  PyObject *(*to_object_func)(char *);
  int (*to_dtype_func)(char *, PyObject *);
};



/* "lxml/etree.pyx":400
 * # class for temporary storage of Python references,
 * # used e.g. for XPath results
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * cdef class _TempStore:
*/

struct __pyx_vtabstruct_4lxml_5etree__TempStore {
  int (*add)(struct __pyx_obj_4lxml_5etree__TempStore *, PyObject *);
  int (*clear)(struct __pyx_obj_4lxml_5etree__TempStore *);
};
static struct __pyx_vtabstruct_4lxml_5etree__TempStore *__pyx_vtabptr_4lxml_5etree__TempStore;
static int __pyx_f_4lxml_5etree_10_TempStore_add(struct __pyx_obj_4lxml_5etree__TempStore *, PyObject *);
static int __pyx_f_4lxml_5etree_10_TempStore_clear(struct __pyx_obj_4lxml_5etree__TempStore *);


/* "lxml/etree.pyx":417
 * 
 * # class for temporarily storing exceptions raised in extensions
 * @cython.internal             # <<<<<<<<<<<<<<
 * cdef class _ExceptionContext:
 *     cdef object _exc_info
*/

struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext {
  int (*clear)(struct __pyx_obj_4lxml_5etree__ExceptionContext *);
  void (*_store_raised)(struct __pyx_obj_4lxml_5etree__ExceptionContext *);
  int (*_store_exception)(struct __pyx_obj_4lxml_5etree__ExceptionContext *, PyObject *);
  int (*_has_raised)(struct __pyx_obj_4lxml_5etree__ExceptionContext *);
  int (*_raise_if_stored)(struct __pyx_obj_4lxml_5etree__ExceptionContext *);
};
static struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext *__pyx_vtabptr_4lxml_5etree__ExceptionContext;
static void __pyx_f_4lxml_5etree_17_ExceptionContext__store_raised(struct __pyx_obj_4lxml_5etree__ExceptionContext *);
static int __pyx_f_4lxml_5etree_17_ExceptionContext__store_exception(struct __pyx_obj_4lxml_5etree__ExceptionContext *, PyObject *);
static int __pyx_f_4lxml_5etree_17_ExceptionContext__has_raised(struct __pyx_obj_4lxml_5etree__ExceptionContext *);
static int __pyx_f_4lxml_5etree_17_ExceptionContext__raise_if_stored(struct __pyx_obj_4lxml_5etree__ExceptionContext *);


/* "src/lxml/xmlerror.pxi":36
 * # Logging classes
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.freelist(16)
 * cdef class _LogEntry:
*/

struct __pyx_vtabstruct_4lxml_5etree__LogEntry {
  int (*_setError)(struct __pyx_obj_4lxml_5etree__LogEntry *, xmlError const *);
  PyObject *(*_setGeneric)(struct __pyx_obj_4lxml_5etree__LogEntry *, int, int, int, long, PyObject *, PyObject *);
};
static struct __pyx_vtabstruct_4lxml_5etree__LogEntry *__pyx_vtabptr_4lxml_5etree__LogEntry;
static int __pyx_f_4lxml_5etree_9_LogEntry__setError(struct __pyx_obj_4lxml_5etree__LogEntry *, xmlError const *);
static PyObject *__pyx_f_4lxml_5etree_9_LogEntry__setGeneric(struct __pyx_obj_4lxml_5etree__LogEntry *, int, int, int, long, PyObject *, PyObject *);


/* "src/lxml/xmlerror.pxi":187
 * 
 * 
 * cdef class _BaseErrorLog:             # <<<<<<<<<<<<<<
 *     cdef _LogEntry _first_error
 *     cdef readonly object last_error
*/

struct __pyx_vtabstruct_4lxml_5etree__BaseErrorLog {
  PyObject *(*copy)(struct __pyx_obj_4lxml_5etree__BaseErrorLog *, int __pyx_skip_dispatch);
  PyObject *(*receive)(struct __pyx_obj_4lxml_5etree__BaseErrorLog *, struct __pyx_obj_4lxml_5etree__LogEntry *, int __pyx_skip_dispatch);
  int (*_receive)(struct __pyx_obj_4lxml_5etree__BaseErrorLog *, xmlError const *);
  int (*_receiveGeneric)(struct __pyx_obj_4lxml_5etree__BaseErrorLog *, int, int, int, long, PyObject *, PyObject *);
  PyObject *(*_buildParseException)(struct __pyx_obj_4lxml_5etree__BaseErrorLog *, PyObject *, PyObject *);
  PyObject *(*_buildExceptionMessage)(struct __pyx_obj_4lxml_5etree__BaseErrorLog *, PyObject *);
};
static struct __pyx_vtabstruct_4lxml_5etree__BaseErrorLog *__pyx_vtabptr_4lxml_5etree__BaseErrorLog;
static int __pyx_f_4lxml_5etree_13_BaseErrorLog__receive(struct __pyx_obj_4lxml_5etree__BaseErrorLog *, xmlError const *);
static int __pyx_f_4lxml_5etree_13_BaseErrorLog__receiveGeneric(struct __pyx_obj_4lxml_5etree__BaseErrorLog *, int, int, int, long, PyObject *, PyObject *);
static PyObject *__pyx_f_4lxml_5etree_13_BaseErrorLog__buildParseException(struct __pyx_obj_4lxml_5etree__BaseErrorLog *, PyObject *, PyObject *);
static PyObject *__pyx_f_4lxml_5etree_13_BaseErrorLog__buildExceptionMessage(struct __pyx_obj_4lxml_5etree__BaseErrorLog *, PyObject *);


/* "src/lxml/xmlerror.pxi":277
 *         return message
 * 
 * cdef class _ListErrorLog(_BaseErrorLog):             # <<<<<<<<<<<<<<
 *     "Immutable base version of a list based error log."
 *     cdef list _entries
*/

struct __pyx_vtabstruct_4lxml_5etree__ListErrorLog {
  struct __pyx_vtabstruct_4lxml_5etree__BaseErrorLog __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree__ListErrorLog *__pyx_vtabptr_4lxml_5etree__ListErrorLog;


/* "src/lxml/xmlerror.pxi":393
 * 
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * cdef class _ErrorLogContext:
*/

struct __pyx_vtabstruct_4lxml_5etree__ErrorLogContext {
  int (*push_error_log)(struct __pyx_obj_4lxml_5etree__ErrorLogContext *, struct __pyx_obj_4lxml_5etree__BaseErrorLog *);
  int (*pop_error_log)(struct __pyx_obj_4lxml_5etree__ErrorLogContext *);
};
static struct __pyx_vtabstruct_4lxml_5etree__ErrorLogContext *__pyx_vtabptr_4lxml_5etree__ErrorLogContext;
static int __pyx_f_4lxml_5etree_16_ErrorLogContext_push_error_log(struct __pyx_obj_4lxml_5etree__ErrorLogContext *, struct __pyx_obj_4lxml_5etree__BaseErrorLog *);
static int __pyx_f_4lxml_5etree_16_ErrorLogContext_pop_error_log(struct __pyx_obj_4lxml_5etree__ErrorLogContext *);


/* "src/lxml/xmlerror.pxi":432
 * 
 * 
 * cdef class _ErrorLog(_ListErrorLog):             # <<<<<<<<<<<<<<
 *     cdef list _logContexts
 *     def __cinit__(self):
*/

struct __pyx_vtabstruct_4lxml_5etree__ErrorLog {
  struct __pyx_vtabstruct_4lxml_5etree__ListErrorLog __pyx_base;
  int (*__pyx___enter__)(struct __pyx_obj_4lxml_5etree__ErrorLog *);
  int (*connect)(struct __pyx_obj_4lxml_5etree__ErrorLog *);
  int (*disconnect)(struct __pyx_obj_4lxml_5etree__ErrorLog *);
  PyObject *(*clear)(struct __pyx_obj_4lxml_5etree__ErrorLog *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *__pyx_vtabptr_4lxml_5etree__ErrorLog;
static int __pyx_f_4lxml_5etree_9_ErrorLog___enter__(struct __pyx_obj_4lxml_5etree__ErrorLog *);
static int __pyx_f_4lxml_5etree_9_ErrorLog_connect(struct __pyx_obj_4lxml_5etree__ErrorLog *);
static int __pyx_f_4lxml_5etree_9_ErrorLog_disconnect(struct __pyx_obj_4lxml_5etree__ErrorLog *);


/* "src/lxml/xmlerror.pxi":485
 *         self._entries.append(entry)
 * 
 * cdef class _DomainErrorLog(_ErrorLog):             # <<<<<<<<<<<<<<
 *     def __init__(self, domains):
 *         _ErrorLog.__init__(self)
*/

struct __pyx_vtabstruct_4lxml_5etree__DomainErrorLog {
  struct __pyx_vtabstruct_4lxml_5etree__ErrorLog __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree__DomainErrorLog *__pyx_vtabptr_4lxml_5etree__DomainErrorLog;


/* "src/lxml/xmlerror.pxi":494
 *             _ErrorLog.receive(self, entry)
 * 
 * cdef class _RotatingErrorLog(_ErrorLog):             # <<<<<<<<<<<<<<
 *     cdef int _max_len
 *     def __init__(self, max_len):
*/

struct __pyx_vtabstruct_4lxml_5etree__RotatingErrorLog {
  struct __pyx_vtabstruct_4lxml_5etree__ErrorLog __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree__RotatingErrorLog *__pyx_vtabptr_4lxml_5etree__RotatingErrorLog;


/* "src/lxml/xmlerror.pxi":512
 *                 del self._entries[:offset]
 * 
 * cdef class PyErrorLog(_BaseErrorLog):             # <<<<<<<<<<<<<<
 *     """PyErrorLog(self, logger_name=None, logger=None)
 *     A global error log that connects to the Python stdlib logging package.
*/

struct __pyx_vtabstruct_4lxml_5etree_PyErrorLog {
  struct __pyx_vtabstruct_4lxml_5etree__BaseErrorLog __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_PyErrorLog *__pyx_vtabptr_4lxml_5etree_PyErrorLog;

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) LxmlDocumentType;

/* "lxml/etree.pyx":470
 * # Public Python API
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.freelist(8)
 * cdef public class _Document [ type LxmlDocumentType, object LxmlDocument ]:
*/

struct __pyx_vtabstruct_4lxml_5etree__Document {
  PyObject *(*getroot)(struct LxmlDocument *);
  int (*hasdoctype)(struct LxmlDocument *);
  PyObject *(*getdoctype)(struct LxmlDocument *);
  PyObject *(*getxmlinfo)(struct LxmlDocument *);
  PyObject *(*isstandalone)(struct LxmlDocument *);
  PyObject *(*buildNewPrefix)(struct LxmlDocument *);
  xmlNs *(*_findOrBuildNodeNs)(struct LxmlDocument *, xmlNode *, const xmlChar *, const xmlChar *, int);
  int (*_setNodeNs)(struct LxmlDocument *, xmlNode *, const xmlChar *);
};
static struct __pyx_vtabstruct_4lxml_5etree__Document *__pyx_vtabptr_4lxml_5etree__Document;
static PyObject *__pyx_f_4lxml_5etree_9_Document_getroot(struct LxmlDocument *);
static int __pyx_f_4lxml_5etree_9_Document_hasdoctype(struct LxmlDocument *);
static PyObject *__pyx_f_4lxml_5etree_9_Document_getdoctype(struct LxmlDocument *);
static PyObject *__pyx_f_4lxml_5etree_9_Document_getxmlinfo(struct LxmlDocument *);
static PyObject *__pyx_f_4lxml_5etree_9_Document_isstandalone(struct LxmlDocument *);
static PyObject *__pyx_f_4lxml_5etree_9_Document_buildNewPrefix(struct LxmlDocument *);
static xmlNs *__pyx_f_4lxml_5etree_9_Document__findOrBuildNodeNs(struct LxmlDocument *, xmlNode *, const xmlChar *, const xmlChar *, int);
static int __pyx_f_4lxml_5etree_9_Document__setNodeNs(struct LxmlDocument *, xmlNode *, const xmlChar *);


/* "lxml/etree.pyx":648
 * 
 * 
 * cdef class DocInfo:             # <<<<<<<<<<<<<<
 *     "Document information provided by parser and DTD."
 *     cdef _Document _doc
*/

struct __pyx_vtabstruct_4lxml_5etree_DocInfo {
  xmlDtd *(*_get_c_dtd)(struct __pyx_obj_4lxml_5etree_DocInfo *);
};
static struct __pyx_vtabstruct_4lxml_5etree_DocInfo *__pyx_vtabptr_4lxml_5etree_DocInfo;
static xmlDtd *__pyx_f_4lxml_5etree_7DocInfo__get_c_dtd(struct __pyx_obj_4lxml_5etree_DocInfo *);


/* "lxml/etree.pyx":1772
 * 
 * 
 * @cython.internal             # <<<<<<<<<<<<<<
 * cdef class __ContentOnlyElement(_Element):
 *     cdef int _raiseImmutable(self) except -1:
*/

struct __pyx_vtabstruct_4lxml_5etree___ContentOnlyElement {
  int (*_raiseImmutable)(struct __pyx_obj_4lxml_5etree___ContentOnlyElement *);
};
static struct __pyx_vtabstruct_4lxml_5etree___ContentOnlyElement *__pyx_vtabptr_4lxml_5etree___ContentOnlyElement;


/* "lxml/etree.pyx":1840
 *         return []
 * 
 * cdef class _Comment(__ContentOnlyElement):             # <<<<<<<<<<<<<<
 *     @property
 *     def tag(self):
*/

struct __pyx_vtabstruct_4lxml_5etree__Comment {
  struct __pyx_vtabstruct_4lxml_5etree___ContentOnlyElement __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree__Comment *__pyx_vtabptr_4lxml_5etree__Comment;


/* "lxml/etree.pyx":1848
 *         return "<!--%s-->" % self.text
 * 
 * cdef class _ProcessingInstruction(__ContentOnlyElement):             # <<<<<<<<<<<<<<
 *     @property
 *     def tag(self):
*/

struct __pyx_vtabstruct_4lxml_5etree__ProcessingInstruction {
  struct __pyx_vtabstruct_4lxml_5etree___ContentOnlyElement __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree__ProcessingInstruction *__pyx_vtabptr_4lxml_5etree__ProcessingInstruction;


/* "lxml/etree.pyx":1898
 * cdef object _FIND_PI_ATTRIBUTES = re.compile(r'\s+(\w+)\s*=\s*(?:\'([^\']*)\'|"([^"]*)")', re.U).findall
 * 
 * cdef class _Entity(__ContentOnlyElement):             # <<<<<<<<<<<<<<
 *     @property
 *     def tag(self):
*/

struct __pyx_vtabstruct_4lxml_5etree__Entity {
  struct __pyx_vtabstruct_4lxml_5etree___ContentOnlyElement __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree__Entity *__pyx_vtabptr_4lxml_5etree__Entity;

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) LxmlElementTreeType;

/* "lxml/etree.pyx":1996
 * 
 * 
 * cdef public class _ElementTree [ type LxmlElementTreeType,             # <<<<<<<<<<<<<<
 *                                  object LxmlElementTree ]:
 *     cdef _Document _doc
*/

struct __pyx_vtabstruct_4lxml_5etree__ElementTree {
  int (*_assertHasRoot)(struct LxmlElementTree *);
};
static struct __pyx_vtabstruct_4lxml_5etree__ElementTree *__pyx_vtabptr_4lxml_5etree__ElementTree;
static int __pyx_f_4lxml_5etree_12_ElementTree__assertHasRoot(struct LxmlElementTree *);

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) LxmlElementTagMatcherType;

/* "lxml/etree.pyx":2770
 * 
 * 
 * cdef public class _ElementTagMatcher [ object LxmlElementTagMatcher,             # <<<<<<<<<<<<<<
 *                                        type LxmlElementTagMatcherType ]:
 *     """
*/

struct __pyx_vtabstruct_4lxml_5etree__ElementTagMatcher {
  PyObject *(*_initTagMatch)(struct LxmlElementTagMatcher *, PyObject *);
};
static struct __pyx_vtabstruct_4lxml_5etree__ElementTagMatcher *__pyx_vtabptr_4lxml_5etree__ElementTagMatcher;

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) LxmlElementIteratorType;

/* "lxml/etree.pyx":2801
 *                 self._name = NULL
 * 
 * cdef public class _ElementIterator(_ElementTagMatcher) [             # <<<<<<<<<<<<<<
 *     object LxmlElementIterator, type LxmlElementIteratorType ]:
 *     """
*/

struct __pyx_vtabstruct_4lxml_5etree__ElementIterator {
  struct __pyx_vtabstruct_4lxml_5etree__ElementTagMatcher __pyx_base;
  void (*_storeNext)(struct LxmlElementIterator *, struct LxmlElement *);
};
static struct __pyx_vtabstruct_4lxml_5etree__ElementIterator *__pyx_vtabptr_4lxml_5etree__ElementIterator;


/* "lxml/etree.pyx":2836
 *         return current_node
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * cdef class _MultiTagMatcher:
*/

struct __pyx_vtabstruct_4lxml_5etree__MultiTagMatcher {
  int (*rejectsAll)(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *);
  int (*rejectsAllAttributes)(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *);
  int (*matchesType)(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *, int);
  void (*_clear)(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *);
  PyObject *(*initTagMatch)(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *, PyObject *);
  PyObject *(*_storeTags)(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *, PyObject *, PyObject *);
  int (*cacheTags)(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *, struct LxmlDocument *, struct __pyx_opt_args_4lxml_5etree_16_MultiTagMatcher_cacheTags *__pyx_optional_args);
  int (*matches)(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *, xmlNode *);
  int (*matchesNsTag)(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *, const xmlChar *, const xmlChar *);
  int (*matchesAttribute)(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *, xmlAttr *);
};
static struct __pyx_vtabstruct_4lxml_5etree__MultiTagMatcher *__pyx_vtabptr_4lxml_5etree__MultiTagMatcher;
static int __pyx_f_4lxml_5etree_16_MultiTagMatcher_rejectsAll(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *);
static int __pyx_f_4lxml_5etree_16_MultiTagMatcher_rejectsAllAttributes(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *);
static int __pyx_f_4lxml_5etree_16_MultiTagMatcher_matchesType(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *, int);
static void __pyx_f_4lxml_5etree_16_MultiTagMatcher__clear(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *);
static PyObject *__pyx_f_4lxml_5etree_16_MultiTagMatcher_initTagMatch(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *, PyObject *);
static PyObject *__pyx_f_4lxml_5etree_16_MultiTagMatcher__storeTags(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *, PyObject *, PyObject *);
static CYTHON_INLINE int __pyx_f_4lxml_5etree_16_MultiTagMatcher_cacheTags(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *, struct LxmlDocument *, struct __pyx_opt_args_4lxml_5etree_16_MultiTagMatcher_cacheTags *__pyx_optional_args);
static CYTHON_INLINE int __pyx_f_4lxml_5etree_16_MultiTagMatcher_matches(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *, xmlNode *);
static CYTHON_INLINE int __pyx_f_4lxml_5etree_16_MultiTagMatcher_matchesNsTag(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *, const xmlChar *, const xmlChar *);
static CYTHON_INLINE int __pyx_f_4lxml_5etree_16_MultiTagMatcher_matchesAttribute(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *, xmlAttr *);


/* "lxml/etree.pyx":2977
 *         return False
 * 
 * cdef class _ElementMatchIterator:             # <<<<<<<<<<<<<<
 *     cdef _Element _node
 *     cdef _node_to_node_function _next_element
*/

struct __pyx_vtabstruct_4lxml_5etree__ElementMatchIterator {
  PyObject *(*_initTagMatcher)(struct __pyx_obj_4lxml_5etree__ElementMatchIterator *, PyObject *);
  int (*_storeNext)(struct __pyx_obj_4lxml_5etree__ElementMatchIterator *, struct LxmlElement *);
};
static struct __pyx_vtabstruct_4lxml_5etree__ElementMatchIterator *__pyx_vtabptr_4lxml_5etree__ElementMatchIterator;
static PyObject *__pyx_f_4lxml_5etree_21_ElementMatchIterator__initTagMatcher(struct __pyx_obj_4lxml_5etree__ElementMatchIterator *, PyObject *);
static int __pyx_f_4lxml_5etree_21_ElementMatchIterator__storeNext(struct __pyx_obj_4lxml_5etree__ElementMatchIterator *, struct LxmlElement *);


/* "lxml/etree.pyx":3006
 *         return current_node
 * 
 * cdef class ElementChildIterator(_ElementMatchIterator):             # <<<<<<<<<<<<<<
 *     """ElementChildIterator(self, node, tag=None, reversed=False)
 *     Iterates over the children of an element.
*/

struct __pyx_vtabstruct_4lxml_5etree_ElementChildIterator {
  struct __pyx_vtabstruct_4lxml_5etree__ElementMatchIterator __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_ElementChildIterator *__pyx_vtabptr_4lxml_5etree_ElementChildIterator;


/* "lxml/etree.pyx":3026
 *         self._node = _elementFactory(node._doc, c_node) if c_node is not NULL else None
 * 
 * cdef class SiblingsIterator(_ElementMatchIterator):             # <<<<<<<<<<<<<<
 *     """SiblingsIterator(self, node, tag=None, preceding=False)
 *     Iterates over the siblings of an element.
*/

struct __pyx_vtabstruct_4lxml_5etree_SiblingsIterator {
  struct __pyx_vtabstruct_4lxml_5etree__ElementMatchIterator __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_SiblingsIterator *__pyx_vtabptr_4lxml_5etree_SiblingsIterator;


/* "lxml/etree.pyx":3041
 *         self._storeNext(node)
 * 
 * cdef class AncestorsIterator(_ElementMatchIterator):             # <<<<<<<<<<<<<<
 *     """AncestorsIterator(self, node, tag=None)
 *     Iterates over the ancestors of an element (from parent to parent).
*/

struct __pyx_vtabstruct_4lxml_5etree_AncestorsIterator {
  struct __pyx_vtabstruct_4lxml_5etree__ElementMatchIterator __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_AncestorsIterator *__pyx_vtabptr_4lxml_5etree_AncestorsIterator;


/* "lxml/etree.pyx":3051
 *         self._storeNext(node)
 * 
 * cdef class ElementDepthFirstIterator:             # <<<<<<<<<<<<<<
 *     """ElementDepthFirstIterator(self, node, tag=None, inclusive=True)
 *     Iterates over an element and its sub-elements in document order (depth
*/

struct __pyx_vtabstruct_4lxml_5etree_ElementDepthFirstIterator {
  xmlNode *(*_nextNodeAnyTag)(struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *, xmlNode *);
  xmlNode *(*_nextNodeMatchTag)(struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *, xmlNode *);
};
static struct __pyx_vtabstruct_4lxml_5etree_ElementDepthFirstIterator *__pyx_vtabptr_4lxml_5etree_ElementDepthFirstIterator;
static xmlNode *__pyx_f_4lxml_5etree_25ElementDepthFirstIterator__nextNodeAnyTag(struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *, xmlNode *);
static xmlNode *__pyx_f_4lxml_5etree_25ElementDepthFirstIterator__nextNodeMatchTag(struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *, xmlNode *);


/* "src/lxml/readonlytree.pxi":3
 * # read-only tree implementation
 * 
 * @cython.internal             # <<<<<<<<<<<<<<
 * cdef class _ReadOnlyProxy:
 *     "A read-only proxy class suitable for PIs/Comments (for internal use only!)."
*/

struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy {
  int (*_assertNode)(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *);
  int (*_raise_unsupported_type)(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *);
  void (*free_after_use)(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *);
  PyObject *(*__pyx___copy__)(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *, int __pyx_skip_dispatch);
  PyObject *(*getchildren)(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *__pyx_vtabptr_4lxml_5etree__ReadOnlyProxy;


/* "src/lxml/readonlytree.pxi":246
 * 
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * cdef class _ReadOnlyPIProxy(_ReadOnlyProxy):
*/

struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyPIProxy {
  struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyPIProxy *__pyx_vtabptr_4lxml_5etree__ReadOnlyPIProxy;


/* "src/lxml/readonlytree.pxi":255
 *         return funicode(self._c_node.name)
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * cdef class _ReadOnlyEntityProxy(_ReadOnlyProxy):
*/

struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyEntityProxy {
  struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyEntityProxy *__pyx_vtabptr_4lxml_5etree__ReadOnlyEntityProxy;


/* "src/lxml/readonlytree.pxi":274
 * 
 * 
 * @cython.internal             # <<<<<<<<<<<<<<
 * cdef class _ReadOnlyElementProxy(_ReadOnlyProxy):
 *     """The main read-only Element proxy class (for internal use only!)."""
*/

struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyElementProxy {
  struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyElementProxy *__pyx_vtabptr_4lxml_5etree__ReadOnlyElementProxy;


/* "src/lxml/readonlytree.pxi":381
 *         raise TypeError, "This type cannot be instantiated from Python"
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * cdef class _OpaqueDocumentWrapper(_OpaqueNodeWrapper):
*/

struct __pyx_vtabstruct_4lxml_5etree__OpaqueDocumentWrapper {
  int (*_assertNode)(struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper *);
  PyObject *(*append)(struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper *, PyObject *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_4lxml_5etree__OpaqueDocumentWrapper *__pyx_vtabptr_4lxml_5etree__OpaqueDocumentWrapper;
static int __pyx_f_4lxml_5etree_22_OpaqueDocumentWrapper__assertNode(struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper *);
static PyObject *__pyx_f_4lxml_5etree_22_OpaqueDocumentWrapper_append(struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper *, PyObject *, int __pyx_skip_dispatch);


/* "src/lxml/readonlytree.pxi":426
 * # element proxies that allow restricted modification
 * 
 * @cython.internal             # <<<<<<<<<<<<<<
 * cdef class _ModifyContentOnlyProxy(_ReadOnlyProxy):
 *     """A read-only proxy that allows changing the text content.
*/

struct __pyx_vtabstruct_4lxml_5etree__ModifyContentOnlyProxy {
  struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree__ModifyContentOnlyProxy *__pyx_vtabptr_4lxml_5etree__ModifyContentOnlyProxy;


/* "src/lxml/readonlytree.pxi":448
 *             tree.xmlNodeSetContent(self._c_node, c_text)
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * cdef class _ModifyContentOnlyPIProxy(_ModifyContentOnlyProxy):
*/

struct __pyx_vtabstruct_4lxml_5etree__ModifyContentOnlyPIProxy {
  struct __pyx_vtabstruct_4lxml_5etree__ModifyContentOnlyProxy __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree__ModifyContentOnlyPIProxy *__pyx_vtabptr_4lxml_5etree__ModifyContentOnlyPIProxy;


/* "src/lxml/readonlytree.pxi":465
 *             tree.xmlNodeSetName(self._c_node, c_text)
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * cdef class _ModifyContentOnlyEntityProxy(_ModifyContentOnlyProxy):
*/

struct __pyx_vtabstruct_4lxml_5etree__ModifyContentOnlyEntityProxy {
  struct __pyx_vtabstruct_4lxml_5etree__ModifyContentOnlyProxy __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree__ModifyContentOnlyEntityProxy *__pyx_vtabptr_4lxml_5etree__ModifyContentOnlyEntityProxy;


/* "src/lxml/readonlytree.pxi":481
 * 
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * cdef class _AppendOnlyElementProxy(_ReadOnlyElementProxy):
*/

struct __pyx_vtabstruct_4lxml_5etree__AppendOnlyElementProxy {
  struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyElementProxy __pyx_base;
  PyObject *(*append)(struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *, PyObject *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_4lxml_5etree__AppendOnlyElementProxy *__pyx_vtabptr_4lxml_5etree__AppendOnlyElementProxy;
static PyObject *__pyx_f_4lxml_5etree_23_AppendOnlyElementProxy_append(struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *, PyObject *, int __pyx_skip_dispatch);


/* "src/lxml/classlookup.pxi":97
 *                 raise TypeError, f"Invalid child type: {type(child)!r}"
 * 
 * cdef class CommentBase(_Comment):             # <<<<<<<<<<<<<<
 *     """All custom Comment classes must inherit from this one.
 * 
*/

struct __pyx_vtabstruct_4lxml_5etree_CommentBase {
  struct __pyx_vtabstruct_4lxml_5etree__Comment __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_CommentBase *__pyx_vtabptr_4lxml_5etree_CommentBase;


/* "src/lxml/classlookup.pxi":126
 *         self._init()
 * 
 * cdef class PIBase(_ProcessingInstruction):             # <<<<<<<<<<<<<<
 *     """All custom Processing Instruction classes must inherit from this one.
 * 
*/

struct __pyx_vtabstruct_4lxml_5etree_PIBase {
  struct __pyx_vtabstruct_4lxml_5etree__ProcessingInstruction __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_PIBase *__pyx_vtabptr_4lxml_5etree_PIBase;


/* "src/lxml/classlookup.pxi":157
 *         self._init()
 * 
 * cdef class EntityBase(_Entity):             # <<<<<<<<<<<<<<
 *     """All custom Entity classes must inherit from this one.
 * 
*/

struct __pyx_vtabstruct_4lxml_5etree_EntityBase {
  struct __pyx_vtabstruct_4lxml_5etree__Entity __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_EntityBase *__pyx_vtabptr_4lxml_5etree_EntityBase;

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) LxmlFallbackElementClassLookupType;

/* "src/lxml/classlookup.pxi":221
 * 
 * 
 * cdef public class FallbackElementClassLookup(ElementClassLookup) \             # <<<<<<<<<<<<<<
 *          [ type LxmlFallbackElementClassLookupType,
 *            object LxmlFallbackElementClassLookup ]:
*/

struct __pyx_vtabstruct_4lxml_5etree_FallbackElementClassLookup {
  void (*_setFallback)(struct LxmlFallbackElementClassLookup *, struct LxmlElementClassLookup *);
};
static struct __pyx_vtabstruct_4lxml_5etree_FallbackElementClassLookup *__pyx_vtabptr_4lxml_5etree_FallbackElementClassLookup;


/* "src/lxml/classlookup.pxi":342
 * # attribute based lookup scheme
 * 
 * cdef class AttributeBasedElementClassLookup(FallbackElementClassLookup):             # <<<<<<<<<<<<<<
 *     """AttributeBasedElementClassLookup(self, attribute_name, class_mapping, fallback=None)
 *     Checks an attribute of an Element and looks up the value in a
*/

struct __pyx_vtabstruct_4lxml_5etree_AttributeBasedElementClassLookup {
  struct __pyx_vtabstruct_4lxml_5etree_FallbackElementClassLookup __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_AttributeBasedElementClassLookup *__pyx_vtabptr_4lxml_5etree_AttributeBasedElementClassLookup;


/* "src/lxml/classlookup.pxi":394
 * #  per-parser lookup scheme
 * 
 * cdef class ParserBasedElementClassLookup(FallbackElementClassLookup):             # <<<<<<<<<<<<<<
 *     """ParserBasedElementClassLookup(self, fallback=None)
 *     Element class lookup based on the XML parser.
*/

struct __pyx_vtabstruct_4lxml_5etree_ParserBasedElementClassLookup {
  struct __pyx_vtabstruct_4lxml_5etree_FallbackElementClassLookup __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_ParserBasedElementClassLookup *__pyx_vtabptr_4lxml_5etree_ParserBasedElementClassLookup;


/* "src/lxml/classlookup.pxi":411
 * #  custom class lookup based on node type, namespace, name
 * 
 * cdef class CustomElementClassLookup(FallbackElementClassLookup):             # <<<<<<<<<<<<<<
 *     """CustomElementClassLookup(self, fallback=None)
 *     Element class lookup based on a subclass method.
*/

struct __pyx_vtabstruct_4lxml_5etree_CustomElementClassLookup {
  struct __pyx_vtabstruct_4lxml_5etree_FallbackElementClassLookup __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_CustomElementClassLookup *__pyx_vtabptr_4lxml_5etree_CustomElementClassLookup;


/* "src/lxml/classlookup.pxi":466
 * # read-only tree based class lookup
 * 
 * cdef class PythonElementClassLookup(FallbackElementClassLookup):             # <<<<<<<<<<<<<<
 *     """PythonElementClassLookup(self, fallback=None)
 *     Element class lookup based on a subclass method.
*/

struct __pyx_vtabstruct_4lxml_5etree_PythonElementClassLookup {
  struct __pyx_vtabstruct_4lxml_5etree_FallbackElementClassLookup __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_PythonElementClassLookup *__pyx_vtabptr_4lxml_5etree_PythonElementClassLookup;


/* "src/lxml/nsclasses.pxi":12
 * 
 * 
 * @cython.internal             # <<<<<<<<<<<<<<
 * cdef class _NamespaceRegistry:
 *     "Dictionary-like namespace registry"
*/

struct __pyx_vtabstruct_4lxml_5etree__NamespaceRegistry {
  PyObject *(*_get)(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *, PyObject *);
  PyObject *(*_getForString)(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *, char *);
};
static struct __pyx_vtabstruct_4lxml_5etree__NamespaceRegistry *__pyx_vtabptr_4lxml_5etree__NamespaceRegistry;


/* "src/lxml/nsclasses.pxi":104
 * 
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * cdef class _ClassNamespaceRegistry(_NamespaceRegistry):
*/

struct __pyx_vtabstruct_4lxml_5etree__ClassNamespaceRegistry {
  struct __pyx_vtabstruct_4lxml_5etree__NamespaceRegistry __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree__ClassNamespaceRegistry *__pyx_vtabptr_4lxml_5etree__ClassNamespaceRegistry;


/* "src/lxml/nsclasses.pxi":120
 * 
 * 
 * cdef class ElementNamespaceClassLookup(FallbackElementClassLookup):             # <<<<<<<<<<<<<<
 *     """ElementNamespaceClassLookup(self, fallback=None)
 * 
*/

struct __pyx_vtabstruct_4lxml_5etree_ElementNamespaceClassLookup {
  struct __pyx_vtabstruct_4lxml_5etree_FallbackElementClassLookup __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_ElementNamespaceClassLookup *__pyx_vtabptr_4lxml_5etree_ElementNamespaceClassLookup;


/* "src/lxml/nsclasses.pxi":236
 *         return registry
 * 
 * @cython.internal             # <<<<<<<<<<<<<<
 * cdef class _FunctionNamespaceRegistry(_NamespaceRegistry):
 *     def __setitem__(self, name, item):
*/

struct __pyx_vtabstruct_4lxml_5etree__FunctionNamespaceRegistry {
  struct __pyx_vtabstruct_4lxml_5etree__NamespaceRegistry __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree__FunctionNamespaceRegistry *__pyx_vtabptr_4lxml_5etree__FunctionNamespaceRegistry;


/* "src/lxml/nsclasses.pxi":250
 *         return "FunctionNamespace(%r)" % self._ns_uri
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * cdef class _XPathFunctionNamespaceRegistry(_FunctionNamespaceRegistry):
*/

struct __pyx_vtabstruct_4lxml_5etree__XPathFunctionNamespaceRegistry {
  struct __pyx_vtabstruct_4lxml_5etree__FunctionNamespaceRegistry __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree__XPathFunctionNamespaceRegistry *__pyx_vtabptr_4lxml_5etree__XPathFunctionNamespaceRegistry;


/* "src/lxml/docloader.pxi":111
 *         return doc_ref
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * cdef class _ResolverRegistry:
*/

struct __pyx_vtabstruct_4lxml_5etree__ResolverRegistry {
  struct __pyx_obj_4lxml_5etree__ResolverRegistry *(*_copy)(struct __pyx_obj_4lxml_5etree__ResolverRegistry *);
};
static struct __pyx_vtabstruct_4lxml_5etree__ResolverRegistry *__pyx_vtabptr_4lxml_5etree__ResolverRegistry;
static struct __pyx_obj_4lxml_5etree__ResolverRegistry *__pyx_f_4lxml_5etree_17_ResolverRegistry__copy(struct __pyx_obj_4lxml_5etree__ResolverRegistry *);


/* "src/lxml/docloader.pxi":161
 * 
 * 
 * @cython.internal             # <<<<<<<<<<<<<<
 * cdef class _ResolverContext(_ExceptionContext):
 *     cdef _ResolverRegistry _resolvers
*/

struct __pyx_vtabstruct_4lxml_5etree__ResolverContext {
  struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree__ResolverContext *__pyx_vtabptr_4lxml_5etree__ResolverContext;


/* "src/lxml/parser.pxi":47
 * 
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * cdef class _ParserDictionaryContext:
*/

struct __pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext {
  int (*initMainParserContext)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *);
  struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *(*_findThreadParserContext)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *);
  int (*setDefaultParser)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, struct __pyx_obj_4lxml_5etree__BaseParser *);
  struct __pyx_obj_4lxml_5etree__BaseParser *(*getDefaultParser)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *);
  xmlDict *(*_getThreadDict)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, xmlDict *);
  int (*initThreadDictRef)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, xmlDict **);
  int (*initParserDict)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, xmlParserCtxt *);
  int (*initXPathParserDict)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, xmlXPathContext *);
  int (*initDocDict)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, xmlDoc *);
  struct __pyx_obj_4lxml_5etree__ParserContext *(*findImpliedContext)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *);
  int (*pushImpliedContextFromParser)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, struct __pyx_obj_4lxml_5etree__BaseParser *);
  int (*pushImpliedContext)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, struct __pyx_obj_4lxml_5etree__ParserContext *);
  int (*popImpliedContext)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *);
};
static struct __pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext *__pyx_vtabptr_4lxml_5etree__ParserDictionaryContext;
static int __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initMainParserContext(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *);
static struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_f_4lxml_5etree_24_ParserDictionaryContext__findThreadParserContext(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *);
static int __pyx_f_4lxml_5etree_24_ParserDictionaryContext_setDefaultParser(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, struct __pyx_obj_4lxml_5etree__BaseParser *);
static struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_f_4lxml_5etree_24_ParserDictionaryContext_getDefaultParser(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *);
static xmlDict *__pyx_f_4lxml_5etree_24_ParserDictionaryContext__getThreadDict(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, xmlDict *);
static int __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initThreadDictRef(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, xmlDict **);
static int __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initParserDict(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, xmlParserCtxt *);
static int __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initXPathParserDict(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, xmlXPathContext *);
static int __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initDocDict(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, xmlDoc *);
static struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_f_4lxml_5etree_24_ParserDictionaryContext_findImpliedContext(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *);
static int __pyx_f_4lxml_5etree_24_ParserDictionaryContext_pushImpliedContextFromParser(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, struct __pyx_obj_4lxml_5etree__BaseParser *);
static int __pyx_f_4lxml_5etree_24_ParserDictionaryContext_pushImpliedContext(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, struct __pyx_obj_4lxml_5etree__ParserContext *);
static int __pyx_f_4lxml_5etree_24_ParserDictionaryContext_popImpliedContext(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *);


/* "src/lxml/parser.pxi":288
 * ############################################################
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * cdef class _FileReaderContext:
*/

struct __pyx_vtabstruct_4lxml_5etree__FileReaderContext {
  PyObject *(*_close_file)(struct __pyx_obj_4lxml_5etree__FileReaderContext *);
  xmlParserInputBuffer *(*_createParserInputBuffer)(struct __pyx_obj_4lxml_5etree__FileReaderContext *);
  xmlParserInput *(*_createParserInput)(struct __pyx_obj_4lxml_5etree__FileReaderContext *, xmlParserCtxt *);
  xmlDtd *(*_readDtd)(struct __pyx_obj_4lxml_5etree__FileReaderContext *);
  xmlDoc *(*_readDoc)(struct __pyx_obj_4lxml_5etree__FileReaderContext *, xmlParserCtxt *, int);
  int (*copyToBuffer)(struct __pyx_obj_4lxml_5etree__FileReaderContext *, char *, int);
};
static struct __pyx_vtabstruct_4lxml_5etree__FileReaderContext *__pyx_vtabptr_4lxml_5etree__FileReaderContext;
static PyObject *__pyx_f_4lxml_5etree_18_FileReaderContext__close_file(struct __pyx_obj_4lxml_5etree__FileReaderContext *);
static xmlParserInputBuffer *__pyx_f_4lxml_5etree_18_FileReaderContext__createParserInputBuffer(struct __pyx_obj_4lxml_5etree__FileReaderContext *);
static xmlParserInput *__pyx_f_4lxml_5etree_18_FileReaderContext__createParserInput(struct __pyx_obj_4lxml_5etree__FileReaderContext *, xmlParserCtxt *);
static xmlDtd *__pyx_f_4lxml_5etree_18_FileReaderContext__readDtd(struct __pyx_obj_4lxml_5etree__FileReaderContext *);
static xmlDoc *__pyx_f_4lxml_5etree_18_FileReaderContext__readDoc(struct __pyx_obj_4lxml_5etree__FileReaderContext *, xmlParserCtxt *, int);
static int __pyx_f_4lxml_5etree_18_FileReaderContext_copyToBuffer(struct __pyx_obj_4lxml_5etree__FileReaderContext *, char *, int);


/* "src/lxml/parser.pxi":541
 * ############################################################
 * 
 * @cython.no_gc_clear  # May have to call "self._validator.disconnect()" on dealloc.             # <<<<<<<<<<<<<<
 * @cython.internal
 * cdef class _ParserContext(_ResolverContext):
*/

struct __pyx_vtabstruct_4lxml_5etree__ParserContext {
  struct __pyx_vtabstruct_4lxml_5etree__ResolverContext __pyx_base;
  struct __pyx_obj_4lxml_5etree__ParserContext *(*_copy)(struct __pyx_obj_4lxml_5etree__ParserContext *);
  void (*_initParserContext)(struct __pyx_obj_4lxml_5etree__ParserContext *, xmlParserCtxt *);
  void (*_resetParserContext)(struct __pyx_obj_4lxml_5etree__ParserContext *);
  int (*prepare)(struct __pyx_obj_4lxml_5etree__ParserContext *, struct __pyx_opt_args_4lxml_5etree_14_ParserContext_prepare *__pyx_optional_args);
  int (*cleanup)(struct __pyx_obj_4lxml_5etree__ParserContext *);
  PyObject *(*_handleParseResult)(struct __pyx_obj_4lxml_5etree__ParserContext *, struct __pyx_obj_4lxml_5etree__BaseParser *, xmlDoc *, PyObject *);
  xmlDoc *(*_handleParseResultDoc)(struct __pyx_obj_4lxml_5etree__ParserContext *, struct __pyx_obj_4lxml_5etree__BaseParser *, xmlDoc *, PyObject *);
};
static struct __pyx_vtabstruct_4lxml_5etree__ParserContext *__pyx_vtabptr_4lxml_5etree__ParserContext;


/* "src/lxml/parser.pxi":835
 * 
 * 
 * @cython.internal             # <<<<<<<<<<<<<<
 * cdef class _BaseParser:
 *     cdef ElementClassLookup _class_lookup
*/

struct __pyx_vtabstruct_4lxml_5etree__BaseParser {
  PyObject *(*_setBaseURL)(struct __pyx_obj_4lxml_5etree__BaseParser *, PyObject *);
  PyObject *(*_collectEvents)(struct __pyx_obj_4lxml_5etree__BaseParser *, PyObject *, PyObject *);
  struct __pyx_obj_4lxml_5etree__ParserContext *(*_getParserContext)(struct __pyx_obj_4lxml_5etree__BaseParser *);
  struct __pyx_obj_4lxml_5etree__ParserContext *(*_getPushParserContext)(struct __pyx_obj_4lxml_5etree__BaseParser *);
  struct __pyx_obj_4lxml_5etree__ParserContext *(*_createContext)(struct __pyx_obj_4lxml_5etree__BaseParser *, PyObject *, PyObject *);
  int (*_configureSaxContext)(struct __pyx_obj_4lxml_5etree__BaseParser *, xmlParserCtxt *);
  int (*_registerHtmlErrorHandler)(struct __pyx_obj_4lxml_5etree__BaseParser *, xmlParserCtxt *);
  xmlParserCtxt *(*_newParserCtxt)(struct __pyx_obj_4lxml_5etree__BaseParser *);
  xmlParserCtxt *(*_newPushParserCtxt)(struct __pyx_obj_4lxml_5etree__BaseParser *);
  struct __pyx_obj_4lxml_5etree__BaseParser *(*_copy)(struct __pyx_obj_4lxml_5etree__BaseParser *);
  xmlDoc *(*_parseUnicodeDoc)(struct __pyx_obj_4lxml_5etree__BaseParser *, PyObject *, char *);
  xmlDoc *(*_parseDoc)(struct __pyx_obj_4lxml_5etree__BaseParser *, char const *, int, char *);
  xmlDoc *(*_parseDocFromFile)(struct __pyx_obj_4lxml_5etree__BaseParser *, char *);
  xmlDoc *(*_parseDocFromFilelike)(struct __pyx_obj_4lxml_5etree__BaseParser *, PyObject *, PyObject *, PyObject *);
};
static struct __pyx_vtabstruct_4lxml_5etree__BaseParser *__pyx_vtabptr_4lxml_5etree__BaseParser;
static int __pyx_f_4lxml_5etree_11_BaseParser__configureSaxContext(struct __pyx_obj_4lxml_5etree__BaseParser *, xmlParserCtxt *);


/* "src/lxml/parser.pxi":1349
 * ############################################################
 * 
 * cdef class _FeedParser(_BaseParser):             # <<<<<<<<<<<<<<
 *     cdef bint _feed_parser_running
 * 
*/

struct __pyx_vtabstruct_4lxml_5etree__FeedParser {
  struct __pyx_vtabstruct_4lxml_5etree__BaseParser __pyx_base;
  PyObject *(*feed)(struct __pyx_obj_4lxml_5etree__FeedParser *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*close)(struct __pyx_obj_4lxml_5etree__FeedParser *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_4lxml_5etree__FeedParser *__pyx_vtabptr_4lxml_5etree__FeedParser;


/* "src/lxml/parser.pxi":1583
 * )
 * 
 * cdef class XMLParser(_FeedParser):             # <<<<<<<<<<<<<<
 *     """XMLParser(self, encoding=None, attribute_defaults=False, dtd_validation=False, \
 *                  load_dtd=False, no_network=True, decompress=False, ns_clean=False, \
*/

struct __pyx_vtabstruct_4lxml_5etree_XMLParser {
  struct __pyx_vtabstruct_4lxml_5etree__FeedParser __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_XMLParser *__pyx_vtabptr_4lxml_5etree_XMLParser;


/* "src/lxml/parser.pxi":1687
 * 
 * 
 * cdef class XMLPullParser(XMLParser):             # <<<<<<<<<<<<<<
 *     """XMLPullParser(self, events=None, *, tag=None, **kwargs)
 * 
*/

struct __pyx_vtabstruct_4lxml_5etree_XMLPullParser {
  struct __pyx_vtabstruct_4lxml_5etree_XMLParser __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_XMLPullParser *__pyx_vtabptr_4lxml_5etree_XMLPullParser;


/* "src/lxml/parser.pxi":1716
 * 
 * 
 * cdef class ETCompatXMLParser(XMLParser):             # <<<<<<<<<<<<<<
 *     """ETCompatXMLParser(self, encoding=None, attribute_defaults=False, \
 *                  dtd_validation=False, load_dtd=False, no_network=True, decompress=False, \
*/

struct __pyx_vtabstruct_4lxml_5etree_ETCompatXMLParser {
  struct __pyx_vtabstruct_4lxml_5etree_XMLParser __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_ETCompatXMLParser *__pyx_vtabptr_4lxml_5etree_ETCompatXMLParser;


/* "src/lxml/parser.pxi":1799
 * cdef object _UNUSED = object()
 * 
 * cdef class HTMLParser(_FeedParser):             # <<<<<<<<<<<<<<
 *     """HTMLParser(self, encoding=None, remove_blank_text=False, \
 *                    remove_comments=False, remove_pis=False, \
*/

struct __pyx_vtabstruct_4lxml_5etree_HTMLParser {
  struct __pyx_vtabstruct_4lxml_5etree__FeedParser __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_HTMLParser *__pyx_vtabptr_4lxml_5etree_HTMLParser;


/* "src/lxml/parser.pxi":1876
 * 
 * 
 * cdef class HTMLPullParser(HTMLParser):             # <<<<<<<<<<<<<<
 *     """HTMLPullParser(self, events=None, *, tag=None, base_url=None, **kwargs)
 * 
*/

struct __pyx_vtabstruct_4lxml_5etree_HTMLPullParser {
  struct __pyx_vtabstruct_4lxml_5etree_HTMLParser __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_HTMLPullParser *__pyx_vtabptr_4lxml_5etree_HTMLPullParser;


/* "src/lxml/saxparser.pxi":53
 * 
 * 
 * cdef class _SaxParserTarget:             # <<<<<<<<<<<<<<
 *     cdef int _sax_event_filter
 * 
*/

struct __pyx_vtabstruct_4lxml_5etree__SaxParserTarget {
  PyObject *(*_handleSaxStart)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *, PyObject *, PyObject *);
  PyObject *(*_handleSaxEnd)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *);
  int (*_handleSaxData)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *);
  int (*_handleSaxDoctype)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *, PyObject *, PyObject *);
  PyObject *(*_handleSaxPi)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *, PyObject *);
  PyObject *(*_handleSaxComment)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *);
  PyObject *(*_handleSaxStartNs)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *, PyObject *);
  PyObject *(*_handleSaxEndNs)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *);
};
static struct __pyx_vtabstruct_4lxml_5etree__SaxParserTarget *__pyx_vtabptr_4lxml_5etree__SaxParserTarget;


/* "src/lxml/saxparser.pxi":75
 * 
 * #@cython.final
 * @cython.internal             # <<<<<<<<<<<<<<
 * @cython.no_gc_clear  # Required because parent class uses it - Cython bug.
 * cdef class _SaxParserContext(_ParserContext):
*/

struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext {
  struct __pyx_vtabstruct_4lxml_5etree__ParserContext __pyx_base;
  void (*_setSaxParserTarget)(struct __pyx_obj_4lxml_5etree__SaxParserContext *, struct __pyx_obj_4lxml_5etree__SaxParserTarget *);
  void (*_connectTarget)(struct __pyx_obj_4lxml_5etree__SaxParserContext *, xmlParserCtxt *);
  void (*_connectEvents)(struct __pyx_obj_4lxml_5etree__SaxParserContext *, xmlParserCtxt *);
  PyObject *(*_setEventFilter)(struct __pyx_obj_4lxml_5etree__SaxParserContext *, PyObject *, PyObject *);
  int (*startDocument)(struct __pyx_obj_4lxml_5etree__SaxParserContext *, xmlDoc *);
  int (*pushEvent)(struct __pyx_obj_4lxml_5etree__SaxParserContext *, PyObject *, xmlNode *);
  int (*flushEvents)(struct __pyx_obj_4lxml_5etree__SaxParserContext *);
  void (*_handleSaxException)(struct __pyx_obj_4lxml_5etree__SaxParserContext *, xmlParserCtxt *);
};
static struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext *__pyx_vtabptr_4lxml_5etree__SaxParserContext;


/* "src/lxml/saxparser.pxi":708
 * ############################################################
 * 
 * cdef class TreeBuilder(_SaxParserTarget):             # <<<<<<<<<<<<<<
 *     """TreeBuilder(self, element_factory=None, parser=None,
 *                     comment_factory=None, pi_factory=None,
*/

struct __pyx_vtabstruct_4lxml_5etree_TreeBuilder {
  struct __pyx_vtabstruct_4lxml_5etree__SaxParserTarget __pyx_base;
  int (*_flush)(struct __pyx_obj_4lxml_5etree_TreeBuilder *);
};
static struct __pyx_vtabstruct_4lxml_5etree_TreeBuilder *__pyx_vtabptr_4lxml_5etree_TreeBuilder;
static int __pyx_f_4lxml_5etree_11TreeBuilder__flush(struct __pyx_obj_4lxml_5etree_TreeBuilder *);


/* "src/lxml/parsertarget.pxi":18
 * 
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * cdef class _PythonSaxParserTarget(_SaxParserTarget):
*/

struct __pyx_vtabstruct_4lxml_5etree__PythonSaxParserTarget {
  struct __pyx_vtabstruct_4lxml_5etree__SaxParserTarget __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree__PythonSaxParserTarget *__pyx_vtabptr_4lxml_5etree__PythonSaxParserTarget;


/* "src/lxml/parsertarget.pxi":120
 * 
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * @cython.no_gc_clear  # Required because parent class uses it - Cython bug.
*/

struct __pyx_vtabstruct_4lxml_5etree__TargetParserContext {
  struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext __pyx_base;
  int (*_setTarget)(struct __pyx_obj_4lxml_5etree__TargetParserContext *, PyObject *);
  void (*_cleanupTargetParserContext)(struct __pyx_obj_4lxml_5etree__TargetParserContext *, xmlDoc *);
};
static struct __pyx_vtabstruct_4lxml_5etree__TargetParserContext *__pyx_vtabptr_4lxml_5etree__TargetParserContext;
static int __pyx_f_4lxml_5etree_20_TargetParserContext__setTarget(struct __pyx_obj_4lxml_5etree__TargetParserContext *, PyObject *);
static void __pyx_f_4lxml_5etree_20_TargetParserContext__cleanupTargetParserContext(struct __pyx_obj_4lxml_5etree__TargetParserContext *, xmlDoc *);


/* "src/lxml/serializer.pxi":559
 * 
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * cdef class _FilelikeWriter:
*/

struct __pyx_vtabstruct_4lxml_5etree__FilelikeWriter {
  xmlOutputBuffer *(*_createOutputBuffer)(struct __pyx_obj_4lxml_5etree__FilelikeWriter *, xmlCharEncodingHandler *);
  int (*write)(struct __pyx_obj_4lxml_5etree__FilelikeWriter *, char *, int);
  int (*close)(struct __pyx_obj_4lxml_5etree__FilelikeWriter *);
};
static struct __pyx_vtabstruct_4lxml_5etree__FilelikeWriter *__pyx_vtabptr_4lxml_5etree__FilelikeWriter;
static xmlOutputBuffer *__pyx_f_4lxml_5etree_15_FilelikeWriter__createOutputBuffer(struct __pyx_obj_4lxml_5etree__FilelikeWriter *, xmlCharEncodingHandler *);
static int __pyx_f_4lxml_5etree_15_FilelikeWriter_write(struct __pyx_obj_4lxml_5etree__FilelikeWriter *, char *, int);
static int __pyx_f_4lxml_5etree_15_FilelikeWriter_close(struct __pyx_obj_4lxml_5etree__FilelikeWriter *);


/* "src/lxml/serializer.pxi":901
 * 
 * 
 * cdef class C14NWriterTarget:             # <<<<<<<<<<<<<<
 *     """
 *     Canonicalization writer target for the XMLParser.
*/

struct __pyx_vtabstruct_4lxml_5etree_C14NWriterTarget {
  PyObject *(*_resolve_prefix_name)(struct __pyx_obj_4lxml_5etree_C14NWriterTarget *, PyObject *);
  PyObject *(*_qname)(struct __pyx_obj_4lxml_5etree_C14NWriterTarget *, PyObject *, struct __pyx_opt_args_4lxml_5etree_16C14NWriterTarget__qname *__pyx_optional_args);
  PyObject *(*_flush)(struct __pyx_obj_4lxml_5etree_C14NWriterTarget *);
  PyObject *(*_start)(struct __pyx_obj_4lxml_5etree_C14NWriterTarget *, PyObject *, PyObject *, PyObject *, struct __pyx_opt_args_4lxml_5etree_16C14NWriterTarget__start *__pyx_optional_args);
};
static struct __pyx_vtabstruct_4lxml_5etree_C14NWriterTarget *__pyx_vtabptr_4lxml_5etree_C14NWriterTarget;


/* "src/lxml/serializer.pxi":1367
 * 
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * cdef class _IncrementalFileWriter:
*/

struct __pyx_vtabstruct_4lxml_5etree__IncrementalFileWriter {
  PyObject *(*_write_qname)(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *, PyObject *, PyObject *);
  PyObject *(*_write_start_element)(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *, PyObject *);
  PyObject *(*_write_attributes_and_namespaces)(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *, PyObject *, PyObject *, PyObject *);
  PyObject *(*_write_attributes_list)(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *, PyObject *);
  PyObject *(*_write_end_element)(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *, PyObject *);
  PyObject *(*_find_prefix)(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *, PyObject *, PyObject *, PyObject *);
  PyObject *(*_collect_namespaces)(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *, PyObject *);
  PyObject *(*_close)(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *, int);
  PyObject *(*_handle_error)(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *, int);
};
static struct __pyx_vtabstruct_4lxml_5etree__IncrementalFileWriter *__pyx_vtabptr_4lxml_5etree__IncrementalFileWriter;
static PyObject *__pyx_f_4lxml_5etree_22_IncrementalFileWriter__write_qname(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *, PyObject *, PyObject *);
static PyObject *__pyx_f_4lxml_5etree_22_IncrementalFileWriter__write_start_element(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *, PyObject *);
static PyObject *__pyx_f_4lxml_5etree_22_IncrementalFileWriter__write_attributes_and_namespaces(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *, PyObject *, PyObject *, PyObject *);
static PyObject *__pyx_f_4lxml_5etree_22_IncrementalFileWriter__write_attributes_list(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *, PyObject *);
static PyObject *__pyx_f_4lxml_5etree_22_IncrementalFileWriter__write_end_element(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *, PyObject *);
static PyObject *__pyx_f_4lxml_5etree_22_IncrementalFileWriter__find_prefix(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *, PyObject *, PyObject *, PyObject *);
static PyObject *__pyx_f_4lxml_5etree_22_IncrementalFileWriter__collect_namespaces(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *, PyObject *);
static PyObject *__pyx_f_4lxml_5etree_22_IncrementalFileWriter__close(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *, int);
static PyObject *__pyx_f_4lxml_5etree_22_IncrementalFileWriter__handle_error(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *, int);


/* "src/lxml/serializer.pxi":1680
 * 
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * cdef class _AsyncDataWriter:
*/

struct __pyx_vtabstruct_4lxml_5etree__AsyncDataWriter {
  PyObject *(*collect)(struct __pyx_obj_4lxml_5etree__AsyncDataWriter *);
};
static struct __pyx_vtabstruct_4lxml_5etree__AsyncDataWriter *__pyx_vtabptr_4lxml_5etree__AsyncDataWriter;
static PyObject *__pyx_f_4lxml_5etree_16_AsyncDataWriter_collect(struct __pyx_obj_4lxml_5etree__AsyncDataWriter *);


/* "src/lxml/serializer.pxi":1699
 * 
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * cdef class _AsyncIncrementalFileWriter:
*/

struct __pyx_vtabstruct_4lxml_5etree__AsyncIncrementalFileWriter {
  PyObject *(*_flush)(struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *);
};
static struct __pyx_vtabstruct_4lxml_5etree__AsyncIncrementalFileWriter *__pyx_vtabptr_4lxml_5etree__AsyncIncrementalFileWriter;
static PyObject *__pyx_f_4lxml_5etree_27_AsyncIncrementalFileWriter__flush(struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *);


/* "src/lxml/iterparse.pxi":5
 * DEF __ITERPARSE_CHUNK_SIZE = 32768
 * 
 * cdef class iterparse:             # <<<<<<<<<<<<<<
 *     """iterparse(self, source, events=("end",), tag=None, \
 *                   attribute_defaults=False, dtd_validation=False, \
*/

struct __pyx_vtabstruct_4lxml_5etree_iterparse {
  PyObject *(*_close_source)(struct __pyx_obj_4lxml_5etree_iterparse *);
  int (*_read_more_events)(struct __pyx_obj_4lxml_5etree_iterparse *, struct __pyx_obj_4lxml_5etree__SaxParserContext *);
};
static struct __pyx_vtabstruct_4lxml_5etree_iterparse *__pyx_vtabptr_4lxml_5etree_iterparse;
static PyObject *__pyx_f_4lxml_5etree_9iterparse__close_source(struct __pyx_obj_4lxml_5etree_iterparse *);
static int __pyx_f_4lxml_5etree_9iterparse__read_more_events(struct __pyx_obj_4lxml_5etree_iterparse *, struct __pyx_obj_4lxml_5etree__SaxParserContext *);


/* "src/lxml/iterparse.pxi":239
 * 
 * 
 * cdef class iterwalk:             # <<<<<<<<<<<<<<
 *     """iterwalk(self, element_or_tree, events=("end",), tag=None)
 * 
*/

struct __pyx_vtabstruct_4lxml_5etree_iterwalk {
  xmlNode *(*_process_non_elements)(struct __pyx_obj_4lxml_5etree_iterwalk *, struct LxmlDocument *, xmlNode *);
  PyObject *(*_next_event)(struct __pyx_obj_4lxml_5etree_iterwalk *);
  int (*_start_node)(struct __pyx_obj_4lxml_5etree_iterwalk *, struct LxmlElement *);
  struct LxmlElement *(*_end_node)(struct __pyx_obj_4lxml_5etree_iterwalk *);
};
static struct __pyx_vtabstruct_4lxml_5etree_iterwalk *__pyx_vtabptr_4lxml_5etree_iterwalk;
static xmlNode *__pyx_f_4lxml_5etree_8iterwalk__process_non_elements(struct __pyx_obj_4lxml_5etree_iterwalk *, struct LxmlDocument *, xmlNode *);
static PyObject *__pyx_f_4lxml_5etree_8iterwalk__next_event(struct __pyx_obj_4lxml_5etree_iterwalk *);
static int __pyx_f_4lxml_5etree_8iterwalk__start_node(struct __pyx_obj_4lxml_5etree_iterwalk *, struct LxmlElement *);
static struct LxmlElement *__pyx_f_4lxml_5etree_8iterwalk__end_node(struct __pyx_obj_4lxml_5etree_iterwalk *);


/* "src/lxml/xmlid.pxi":58
 *     return _elementTreeFactory(doc, None), _IDDict(doc)
 * 
 * cdef class _IDDict:             # <<<<<<<<<<<<<<
 *     """IDDict(self, etree)
 *     A dictionary-like proxy class that mapps ID attributes to elements.
*/

struct __pyx_vtabstruct_4lxml_5etree__IDDict {
  PyObject *(*_build_keys)(struct __pyx_obj_4lxml_5etree__IDDict *);
  PyObject *(*_build_items)(struct __pyx_obj_4lxml_5etree__IDDict *);
};
static struct __pyx_vtabstruct_4lxml_5etree__IDDict *__pyx_vtabptr_4lxml_5etree__IDDict;


/* "src/lxml/extensions.pxi":452
 * # EXSLT regexp implementation
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * cdef class _ExsltRegExp:
*/

struct __pyx_vtabstruct_4lxml_5etree__ExsltRegExp {
  PyObject *(*_make_string)(struct __pyx_obj_4lxml_5etree__ExsltRegExp *, PyObject *);
  PyObject *(*_compile)(struct __pyx_obj_4lxml_5etree__ExsltRegExp *, PyObject *, PyObject *);
  PyObject *(*_register_in_context)(struct __pyx_obj_4lxml_5etree__ExsltRegExp *, struct __pyx_obj_4lxml_5etree__BaseContext *);
};
static struct __pyx_vtabstruct_4lxml_5etree__ExsltRegExp *__pyx_vtabptr_4lxml_5etree__ExsltRegExp;
static PyObject *__pyx_f_4lxml_5etree_12_ExsltRegExp__make_string(struct __pyx_obj_4lxml_5etree__ExsltRegExp *, PyObject *);
static PyObject *__pyx_f_4lxml_5etree_12_ExsltRegExp__compile(struct __pyx_obj_4lxml_5etree__ExsltRegExp *, PyObject *, PyObject *);
static PyObject *__pyx_f_4lxml_5etree_12_ExsltRegExp__register_in_context(struct __pyx_obj_4lxml_5etree__ExsltRegExp *, struct __pyx_obj_4lxml_5etree__BaseContext *);


/* "src/lxml/extensions.pxi":28
 * # Base class for XSLT and XPath evaluation contexts: functions, namespaces, ...
 * 
 * @cython.internal             # <<<<<<<<<<<<<<
 * cdef class _BaseContext:
 *     cdef xpath.xmlXPathContext* _xpathCtxt
*/

struct __pyx_vtabstruct_4lxml_5etree__BaseContext {
  struct __pyx_obj_4lxml_5etree__BaseContext *(*_copy)(struct __pyx_obj_4lxml_5etree__BaseContext *);
  PyObject *(*_to_utf)(struct __pyx_obj_4lxml_5etree__BaseContext *, PyObject *);
  void (*_set_xpath_context)(struct __pyx_obj_4lxml_5etree__BaseContext *, xmlXPathContext *);
  PyObject *(*_register_context)(struct __pyx_obj_4lxml_5etree__BaseContext *, struct LxmlDocument *);
  PyObject *(*_cleanup_context)(struct __pyx_obj_4lxml_5etree__BaseContext *);
  PyObject *(*_release_context)(struct __pyx_obj_4lxml_5etree__BaseContext *);
  PyObject *(*addNamespace)(struct __pyx_obj_4lxml_5etree__BaseContext *, PyObject *, PyObject *);
  PyObject *(*registerNamespace)(struct __pyx_obj_4lxml_5etree__BaseContext *, PyObject *, PyObject *);
  PyObject *(*registerLocalNamespaces)(struct __pyx_obj_4lxml_5etree__BaseContext *);
  PyObject *(*registerGlobalNamespaces)(struct __pyx_obj_4lxml_5etree__BaseContext *);
  PyObject *(*unregisterGlobalNamespaces)(struct __pyx_obj_4lxml_5etree__BaseContext *);
  void (*_unregisterNamespace)(struct __pyx_obj_4lxml_5etree__BaseContext *, PyObject *);
  int (*_addLocalExtensionFunction)(struct __pyx_obj_4lxml_5etree__BaseContext *, PyObject *, PyObject *, PyObject *);
  PyObject *(*registerGlobalFunctions)(struct __pyx_obj_4lxml_5etree__BaseContext *, void *, __pyx_t_4lxml_5etree__register_function);
  PyObject *(*registerLocalFunctions)(struct __pyx_obj_4lxml_5etree__BaseContext *, void *, __pyx_t_4lxml_5etree__register_function);
  PyObject *(*unregisterAllFunctions)(struct __pyx_obj_4lxml_5etree__BaseContext *, void *, __pyx_t_4lxml_5etree__register_function);
  PyObject *(*unregisterGlobalFunctions)(struct __pyx_obj_4lxml_5etree__BaseContext *, void *, __pyx_t_4lxml_5etree__register_function);
  PyObject *(*_find_cached_function)(struct __pyx_obj_4lxml_5etree__BaseContext *, const xmlChar *, const xmlChar *);
  PyObject *(*_release_temp_refs)(struct __pyx_obj_4lxml_5etree__BaseContext *);
  PyObject *(*_hold)(struct __pyx_obj_4lxml_5etree__BaseContext *, PyObject *);
  struct LxmlDocument *(*_findDocumentForNode)(struct __pyx_obj_4lxml_5etree__BaseContext *, xmlNode *);
};
static struct __pyx_vtabstruct_4lxml_5etree__BaseContext *__pyx_vtabptr_4lxml_5etree__BaseContext;
static PyObject *__pyx_f_4lxml_5etree_12_BaseContext__register_context(struct __pyx_obj_4lxml_5etree__BaseContext *, struct LxmlDocument *);
static PyObject *__pyx_f_4lxml_5etree_12_BaseContext__cleanup_context(struct __pyx_obj_4lxml_5etree__BaseContext *);
static PyObject *__pyx_f_4lxml_5etree_12_BaseContext__release_context(struct __pyx_obj_4lxml_5etree__BaseContext *);
static PyObject *__pyx_f_4lxml_5etree_12_BaseContext__find_cached_function(struct __pyx_obj_4lxml_5etree__BaseContext *, const xmlChar *, const xmlChar *);
static PyObject *__pyx_f_4lxml_5etree_12_BaseContext__release_temp_refs(struct __pyx_obj_4lxml_5etree__BaseContext *);
static PyObject *__pyx_f_4lxml_5etree_12_BaseContext__hold(struct __pyx_obj_4lxml_5etree__BaseContext *, PyObject *);
static struct LxmlDocument *__pyx_f_4lxml_5etree_12_BaseContext__findDocumentForNode(struct __pyx_obj_4lxml_5etree__BaseContext *, xmlNode *);


/* "src/lxml/xpath.pxi":48
 * 
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * cdef class _XPathContext(_BaseContext):
*/

struct __pyx_vtabstruct_4lxml_5etree__XPathContext {
  struct __pyx_vtabstruct_4lxml_5etree__BaseContext __pyx_base;
  PyObject *(*set_context)(struct __pyx_obj_4lxml_5etree__XPathContext *, xmlXPathContext *);
  PyObject *(*register_context)(struct __pyx_obj_4lxml_5etree__XPathContext *, struct LxmlDocument *);
  PyObject *(*unregister_context)(struct __pyx_obj_4lxml_5etree__XPathContext *);
  void (*registerExsltFunctions)(struct __pyx_obj_4lxml_5etree__XPathContext *);
  PyObject *(*registerVariables)(struct __pyx_obj_4lxml_5etree__XPathContext *, PyObject *);
  PyObject *(*registerVariable)(struct __pyx_obj_4lxml_5etree__XPathContext *, PyObject *, PyObject *);
};
static struct __pyx_vtabstruct_4lxml_5etree__XPathContext *__pyx_vtabptr_4lxml_5etree__XPathContext;
static PyObject *__pyx_f_4lxml_5etree_13_XPathContext_set_context(struct __pyx_obj_4lxml_5etree__XPathContext *, xmlXPathContext *);
static PyObject *__pyx_f_4lxml_5etree_13_XPathContext_register_context(struct __pyx_obj_4lxml_5etree__XPathContext *, struct LxmlDocument *);
static PyObject *__pyx_f_4lxml_5etree_13_XPathContext_unregister_context(struct __pyx_obj_4lxml_5etree__XPathContext *);
static void __pyx_f_4lxml_5etree_13_XPathContext_registerExsltFunctions(struct __pyx_obj_4lxml_5etree__XPathContext *);
static PyObject *__pyx_f_4lxml_5etree_13_XPathContext_registerVariables(struct __pyx_obj_4lxml_5etree__XPathContext *, PyObject *);
static PyObject *__pyx_f_4lxml_5etree_13_XPathContext_registerVariable(struct __pyx_obj_4lxml_5etree__XPathContext *, PyObject *, PyObject *);


/* "src/lxml/xpath.pxi":116
 * 
 * 
 * cdef class _XPathEvaluatorBase:             # <<<<<<<<<<<<<<
 *     cdef xpath.xmlXPathContext* _xpathCtxt
 *     cdef _XPathContext _context
*/

struct __pyx_vtabstruct_4lxml_5etree__XPathEvaluatorBase {
  PyObject *(*set_context)(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *, xmlXPathContext *);
  int (*_checkAbsolutePath)(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *, char *);
  int (*_lock)(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *);
  void (*_unlock)(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *);
  PyObject *(*_build_parse_error)(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *);
  PyObject *(*_build_eval_error)(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *);
  PyObject *(*_handle_result)(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *, xmlXPathObject *, struct LxmlDocument *);
};
static struct __pyx_vtabstruct_4lxml_5etree__XPathEvaluatorBase *__pyx_vtabptr_4lxml_5etree__XPathEvaluatorBase;
static int __pyx_f_4lxml_5etree_19_XPathEvaluatorBase__lock(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *);
static void __pyx_f_4lxml_5etree_19_XPathEvaluatorBase__unlock(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *);


/* "src/lxml/xpath.pxi":221
 * 
 * 
 * cdef class XPathElementEvaluator(_XPathEvaluatorBase):             # <<<<<<<<<<<<<<
 *     """XPathElementEvaluator(self, element, namespaces=None, extensions=None, regexp=True, smart_strings=True)
 *     Create an XPath evaluator for an element.
*/

struct __pyx_vtabstruct_4lxml_5etree_XPathElementEvaluator {
  struct __pyx_vtabstruct_4lxml_5etree__XPathEvaluatorBase __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_XPathElementEvaluator *__pyx_vtabptr_4lxml_5etree_XPathElementEvaluator;


/* "src/lxml/xpath.pxi":298
 * 
 * 
 * cdef class XPathDocumentEvaluator(XPathElementEvaluator):             # <<<<<<<<<<<<<<
 *     """XPathDocumentEvaluator(self, etree, namespaces=None, extensions=None, regexp=True, smart_strings=True)
 *     Create an XPath evaluator for an ElementTree.
*/

struct __pyx_vtabstruct_4lxml_5etree_XPathDocumentEvaluator {
  struct __pyx_vtabstruct_4lxml_5etree_XPathElementEvaluator __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_XPathDocumentEvaluator *__pyx_vtabptr_4lxml_5etree_XPathDocumentEvaluator;


/* "src/lxml/xpath.pxi":377
 * 
 * 
 * cdef class XPath(_XPathEvaluatorBase):             # <<<<<<<<<<<<<<
 *     """XPath(self, path, namespaces=None, extensions=None, regexp=True, smart_strings=True)
 *     A compiled XPath expression that can be called on Elements and ElementTrees.
*/

struct __pyx_vtabstruct_4lxml_5etree_XPath {
  struct __pyx_vtabstruct_4lxml_5etree__XPathEvaluatorBase __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_XPath *__pyx_vtabptr_4lxml_5etree_XPath;


/* "src/lxml/xpath.pxi":451
 * cdef object _find_namespaces = re.compile(b'({[^}]+})').findall
 * 
 * cdef class ETXPath(XPath):             # <<<<<<<<<<<<<<
 *     """ETXPath(self, path, extensions=None, regexp=True, smart_strings=True)
 *     Special XPath class that supports the ElementTree {uri} notation for namespaces.
*/

struct __pyx_vtabstruct_4lxml_5etree_ETXPath {
  struct __pyx_vtabstruct_4lxml_5etree_XPath __pyx_base;
  PyObject *(*_nsextract_path)(struct __pyx_obj_4lxml_5etree_ETXPath *, PyObject *);
};
static struct __pyx_vtabstruct_4lxml_5etree_ETXPath *__pyx_vtabptr_4lxml_5etree_ETXPath;


/* "src/lxml/xslt.pxi":46
 * # XSLT document loaders
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * cdef class _XSLTResolverContext(_ResolverContext):
*/

struct __pyx_vtabstruct_4lxml_5etree__XSLTResolverContext {
  struct __pyx_vtabstruct_4lxml_5etree__ResolverContext __pyx_base;
  struct __pyx_obj_4lxml_5etree__XSLTResolverContext *(*_copy)(struct __pyx_obj_4lxml_5etree__XSLTResolverContext *);
};
static struct __pyx_vtabstruct_4lxml_5etree__XSLTResolverContext *__pyx_vtabptr_4lxml_5etree__XSLTResolverContext;
static struct __pyx_obj_4lxml_5etree__XSLTResolverContext *__pyx_f_4lxml_5etree_20_XSLTResolverContext__copy(struct __pyx_obj_4lxml_5etree__XSLTResolverContext *);


/* "src/lxml/xslt.pxi":170
 * # XSLT file/network access control
 * 
 * cdef class XSLTAccessControl:             # <<<<<<<<<<<<<<
 *     """XSLTAccessControl(self, read_file=True, write_file=True, create_dir=True, read_network=True, write_network=True)
 * 
*/

struct __pyx_vtabstruct_4lxml_5etree_XSLTAccessControl {
  PyObject *(*_setAccess)(struct __pyx_obj_4lxml_5etree_XSLTAccessControl *, xsltSecurityOption, int);
  void (*_register_in_context)(struct __pyx_obj_4lxml_5etree_XSLTAccessControl *, xsltTransformContext *);
  PyObject *(*_optval)(struct __pyx_obj_4lxml_5etree_XSLTAccessControl *, xsltSecurityOption);
};
static struct __pyx_vtabstruct_4lxml_5etree_XSLTAccessControl *__pyx_vtabptr_4lxml_5etree_XSLTAccessControl;
static PyObject *__pyx_f_4lxml_5etree_17XSLTAccessControl__setAccess(struct __pyx_obj_4lxml_5etree_XSLTAccessControl *, xsltSecurityOption, int);
static void __pyx_f_4lxml_5etree_17XSLTAccessControl__register_in_context(struct __pyx_obj_4lxml_5etree_XSLTAccessControl *, xsltTransformContext *);
static PyObject *__pyx_f_4lxml_5etree_17XSLTAccessControl__optval(struct __pyx_obj_4lxml_5etree_XSLTAccessControl *, xsltSecurityOption);


/* "src/lxml/xslt.pxi":271
 * cdef dict EMPTY_DICT = {}
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * cdef class _XSLTContext(_BaseContext):
*/

struct __pyx_vtabstruct_4lxml_5etree__XSLTContext {
  struct __pyx_vtabstruct_4lxml_5etree__BaseContext __pyx_base;
  PyObject *(*register_context)(struct __pyx_obj_4lxml_5etree__XSLTContext *, xsltTransformContext *, struct LxmlDocument *);
  PyObject *(*free_context)(struct __pyx_obj_4lxml_5etree__XSLTContext *);
};
static struct __pyx_vtabstruct_4lxml_5etree__XSLTContext *__pyx_vtabptr_4lxml_5etree__XSLTContext;
static PyObject *__pyx_f_4lxml_5etree_12_XSLTContext_register_context(struct __pyx_obj_4lxml_5etree__XSLTContext *, xsltTransformContext *, struct LxmlDocument *);
static PyObject *__pyx_f_4lxml_5etree_12_XSLTContext_free_context(struct __pyx_obj_4lxml_5etree__XSLTContext *);


/* "src/lxml/xslt.pxi":335
 * 
 * 
 * @cython.no_gc_clear             # <<<<<<<<<<<<<<
 * cdef class XSLT:
 *     """XSLT(self, xslt_input, extensions=None, regexp=True, access_control=None)
*/

struct __pyx_vtabstruct_4lxml_5etree_XSLT {
  xmlDoc *(*_run_transform)(struct __pyx_obj_4lxml_5etree_XSLT *, xmlDoc *, const char **, struct __pyx_obj_4lxml_5etree__XSLTContext *, xsltTransformContext *);
};
static struct __pyx_vtabstruct_4lxml_5etree_XSLT *__pyx_vtabptr_4lxml_5etree_XSLT;


/* "src/lxml/xslt.pxi":707
 *     return new_xslt
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * cdef class _XSLTResultTree(_ElementTree):
 *     """The result of an XSLT evaluation.
*/

struct __pyx_vtabstruct_4lxml_5etree__XSLTResultTree {
  struct __pyx_vtabstruct_4lxml_5etree__ElementTree __pyx_base;
  PyObject *(*_saveToStringAndSize)(struct __pyx_obj_4lxml_5etree__XSLTResultTree *, xmlChar **, int *);
};
static struct __pyx_vtabstruct_4lxml_5etree__XSLTResultTree *__pyx_vtabptr_4lxml_5etree__XSLTResultTree;
static PyObject *__pyx_f_4lxml_5etree_15_XSLTResultTree__saveToStringAndSize(struct __pyx_obj_4lxml_5etree__XSLTResultTree *, xmlChar **, int *);


/* "src/lxml/xslt.pxi":882
 *     return __findStylesheetByID(doc, id=id)
 * 
 * cdef class _XSLTProcessingInstruction(PIBase):             # <<<<<<<<<<<<<<
 *     def parseXSL(self, parser=None):
 *         """parseXSL(self, parser=None)
*/

struct __pyx_vtabstruct_4lxml_5etree__XSLTProcessingInstruction {
  struct __pyx_vtabstruct_4lxml_5etree_PIBase __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree__XSLTProcessingInstruction *__pyx_vtabptr_4lxml_5etree__XSLTProcessingInstruction;


/* "src/lxml/xsltext.pxi":3
 * # XSLT extension elements
 * 
 * cdef class XSLTExtension:             # <<<<<<<<<<<<<<
 *     """Base class of an XSLT extension element.
 *     """
*/

struct __pyx_vtabstruct_4lxml_5etree_XSLTExtension {
  PyObject *(*_collectXSLTResultContent)(struct __pyx_obj_4lxml_5etree_XSLTExtension *, struct __pyx_obj_4lxml_5etree__XSLTContext *, xmlNode *, int, int);
};
static struct __pyx_vtabstruct_4lxml_5etree_XSLTExtension *__pyx_vtabptr_4lxml_5etree_XSLTExtension;


/* "lxml/etree.pyx":3797
 * 
 * 
 * cdef class _Validator:             # <<<<<<<<<<<<<<
 *     "Base class for XML validators."
 *     cdef _ErrorLog _error_log
*/

struct __pyx_vtabstruct_4lxml_5etree__Validator {
  PyObject *(*_append_log_message)(struct __pyx_obj_4lxml_5etree__Validator *, int, int, int, int, PyObject *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*_clear_error_log)(struct __pyx_obj_4lxml_5etree__Validator *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_4lxml_5etree__Validator *__pyx_vtabptr_4lxml_5etree__Validator;


/* "src/lxml/dtd.pxi":270
 * # DTD
 * 
 * cdef class DTD(_Validator):             # <<<<<<<<<<<<<<
 *     """DTD(self, file=None, external_id=None)
 *     A DTD validator.
*/

struct __pyx_vtabstruct_4lxml_5etree_DTD {
  struct __pyx_vtabstruct_4lxml_5etree__Validator __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_DTD *__pyx_vtabptr_4lxml_5etree_DTD;


/* "src/lxml/relaxng.pxi":34
 * # RelaxNG
 * 
 * cdef class RelaxNG(_Validator):             # <<<<<<<<<<<<<<
 *     """RelaxNG(self, etree=None, file=None)
 *     Turn a document into a Relax NG validator.
*/

struct __pyx_vtabstruct_4lxml_5etree_RelaxNG {
  struct __pyx_vtabstruct_4lxml_5etree__Validator __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_RelaxNG *__pyx_vtabptr_4lxml_5etree_RelaxNG;


/* "src/lxml/xmlschema.pxi":26
 * 
 * 
 * cdef class XMLSchema(_Validator):             # <<<<<<<<<<<<<<
 *     """XMLSchema(self, etree=None, file=None)
 *     Turn a document into an XML Schema validator.
*/

struct __pyx_vtabstruct_4lxml_5etree_XMLSchema {
  struct __pyx_vtabstruct_4lxml_5etree__Validator __pyx_base;
  struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *(*_newSaxValidator)(struct __pyx_obj_4lxml_5etree_XMLSchema *, int);
};
static struct __pyx_vtabstruct_4lxml_5etree_XMLSchema *__pyx_vtabptr_4lxml_5etree_XMLSchema;


/* "src/lxml/xmlschema.pxi":158
 *         return context
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * @cython.internal
 * cdef class _ParserSchemaValidationContext:
*/

struct __pyx_vtabstruct_4lxml_5etree__ParserSchemaValidationContext {
  struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *(*copy)(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *);
  void (*inject_default_attributes)(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *, xmlDoc *);
  int (*connect)(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *, xmlParserCtxt *, struct __pyx_obj_4lxml_5etree__BaseErrorLog *);
  void (*disconnect)(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *);
  int (*isvalid)(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *);
};
static struct __pyx_vtabstruct_4lxml_5etree__ParserSchemaValidationContext *__pyx_vtabptr_4lxml_5etree__ParserSchemaValidationContext;
static struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *__pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_copy(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *);
static void __pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_inject_default_attributes(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *, xmlDoc *);
static int __pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_connect(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *, xmlParserCtxt *, struct __pyx_obj_4lxml_5etree__BaseErrorLog *);
static void __pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_disconnect(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *);
static int __pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_isvalid(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *);


/* "src/lxml/schematron.pxi":21
 * # Schematron
 * 
 * cdef class Schematron(_Validator):             # <<<<<<<<<<<<<<
 *     """Schematron(self, etree=None, file=None)
 *     A Schematron validator.
*/

struct __pyx_vtabstruct_4lxml_5etree_Schematron {
  struct __pyx_vtabstruct_4lxml_5etree__Validator __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_Schematron *__pyx_vtabptr_4lxml_5etree_Schematron;


/* "View.MemoryView":110
 * 
 * 
 * @cython.collection_type("sequence")             # <<<<<<<<<<<<<<
 * @cname("__pyx_array")
 * cdef class array:
*/

struct __pyx_vtabstruct_array {
  PyObject *(*get_memview)(struct __pyx_array_obj *);
};
static struct __pyx_vtabstruct_array *__pyx_vtabptr_array;


/* "View.MemoryView":334
 * 
 * 
 * @cname('__pyx_memoryview')             # <<<<<<<<<<<<<<
 * cdef class memoryview:
 * 
*/

struct __pyx_vtabstruct_memoryview {
  char *(*get_item_pointer)(struct __pyx_memoryview_obj *, PyObject *);
  PyObject *(*is_slice)(struct __pyx_memoryview_obj *, PyObject *);
  PyObject *(*setitem_slice_assignment)(struct __pyx_memoryview_obj *, PyObject *, PyObject *);
  PyObject *(*setitem_slice_assign_scalar)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *);
  PyObject *(*setitem_indexed)(struct __pyx_memoryview_obj *, PyObject *, PyObject *);
  PyObject *(*convert_item_to_object)(struct __pyx_memoryview_obj *, char *);
  PyObject *(*assign_item_from_object)(struct __pyx_memoryview_obj *, char *, PyObject *);
  PyObject *(*_get_base)(struct __pyx_memoryview_obj *);
};
static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview;


/* "View.MemoryView":951
 * 
 * 
 * @cython.collection_type("sequence")             # <<<<<<<<<<<<<<
 * @cname('__pyx_memoryviewslice')
 * cdef class _memoryviewslice(memoryview):
*/

struct __pyx_vtabstruct__memoryviewslice {
  struct __pyx_vtabstruct_memoryview __pyx_base;
};
static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice;
/* #### Code section: utility_code_proto ### */

/* --- Runtime support code (head) --- */
/* Refnanny.proto */
#ifndef CYTHON_REFNANNY
  #define CYTHON_REFNANNY 0
#endif
#if CYTHON_REFNANNY
  typedef struct {
    void (*INCREF)(void*, PyObject*, Py_ssize_t);
    void (*DECREF)(void*, PyObject*, Py_ssize_t);
    void (*GOTREF)(void*, PyObject*, Py_ssize_t);
    void (*GIVEREF)(void*, PyObject*, Py_ssize_t);
    void* (*SetupContext)(const char*, Py_ssize_t, const char*);
    void (*FinishContext)(void**);
  } __Pyx_RefNannyAPIStruct;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
          if (acquire_gil) {\
              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\
              PyGILState_Release(__pyx_gilstate_save);\
          } else {\
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\
          }
  #define __Pyx_RefNannyFinishContextNogil() {\
              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
              __Pyx_RefNannyFinishContext();\
              PyGILState_Release(__pyx_gilstate_save);\
          }
  #define __Pyx_RefNannyFinishContextNogil() {\
              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
              __Pyx_RefNannyFinishContext();\
              PyGILState_Release(__pyx_gilstate_save);\
          }
  #define __Pyx_RefNannyFinishContext()\
          __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
  #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
  #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
  #define __Pyx_XINCREF(r)  do { if((r) == NULL); else {__Pyx_INCREF(r); }} while(0)
  #define __Pyx_XDECREF(r)  do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0)
  #define __Pyx_XGOTREF(r)  do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0)
  #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0)
#else
  #define __Pyx_RefNannyDeclarations
  #define __Pyx_RefNannySetupContext(name, acquire_gil)
  #define __Pyx_RefNannyFinishContextNogil()
  #define __Pyx_RefNannyFinishContext()
  #define __Pyx_INCREF(r) Py_INCREF(r)
  #define __Pyx_DECREF(r) Py_DECREF(r)
  #define __Pyx_GOTREF(r)
  #define __Pyx_GIVEREF(r)
  #define __Pyx_XINCREF(r) Py_XINCREF(r)
  #define __Pyx_XDECREF(r) Py_XDECREF(r)
  #define __Pyx_XGOTREF(r)
  #define __Pyx_XGIVEREF(r)
#endif
#define __Pyx_Py_XDECREF_SET(r, v) do {\
        PyObject *tmp = (PyObject *) r;\
        r = v; Py_XDECREF(tmp);\
    } while (0)
#define __Pyx_XDECREF_SET(r, v) do {\
        PyObject *tmp = (PyObject *) r;\
        r = v; __Pyx_XDECREF(tmp);\
    } while (0)
#define __Pyx_DECREF_SET(r, v) do {\
        PyObject *tmp = (PyObject *) r;\
        r = v; __Pyx_DECREF(tmp);\
    } while (0)
#define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
#define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)

/* PyErrExceptionMatches.proto (used by PyObjectGetAttrStrNoError) */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
#else
#define __Pyx_PyErr_ExceptionMatches(err)  PyErr_ExceptionMatches(err)
#endif

/* PyThreadStateGet.proto (used by PyErrFetchRestore) */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
#define __Pyx_PyThreadState_assign  __pyx_tstate = __Pyx_PyThreadState_Current;
#if PY_VERSION_HEX >= 0x030C00A6
#define __Pyx_PyErr_Occurred()  (__pyx_tstate->current_exception != NULL)
#define __Pyx_PyErr_CurrentExceptionType()  (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL)
#else
#define __Pyx_PyErr_Occurred()  (__pyx_tstate->curexc_type != NULL)
#define __Pyx_PyErr_CurrentExceptionType()  (__pyx_tstate->curexc_type)
#endif
#else
#define __Pyx_PyThreadState_declare
#define __Pyx_PyThreadState_assign
#define __Pyx_PyErr_Occurred()  (PyErr_Occurred() != NULL)
#define __Pyx_PyErr_CurrentExceptionType()  PyErr_Occurred()
#endif

/* PyErrFetchRestore.proto (used by PyObjectGetAttrStrNoError) */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
#define __Pyx_ErrRestoreWithState(type, value, tb)  __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
#define __Pyx_ErrFetchWithState(type, value, tb)    __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
#define __Pyx_ErrRestore(type, value, tb)  __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
#define __Pyx_ErrFetch(type, value, tb)    __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A6
#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
#else
#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
#endif
#else
#define __Pyx_PyErr_Clear() PyErr_Clear()
#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
#define __Pyx_ErrRestoreWithState(type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetchWithState(type, value, tb)  PyErr_Fetch(type, value, tb)
#define __Pyx_ErrRestoreInState(tstate, type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetchInState(tstate, type, value, tb)  PyErr_Fetch(type, value, tb)
#define __Pyx_ErrRestore(type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetch(type, value, tb)  PyErr_Fetch(type, value, tb)
#endif

/* PyObjectGetAttrStr.proto (used by PyObjectGetAttrStrNoError) */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
#else
#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
#endif

/* PyObjectGetAttrStrNoError.proto (used by GetBuiltinName) */
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);

/* GetBuiltinName.proto */
static PyObject *__Pyx_GetBuiltinName(PyObject *name);

/* TupleAndListFromArray.proto (used by fastcall) */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n);
#endif
#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_METH_FASTCALL
static CYTHON_INLINE PyObject* __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n);
#endif

/* IncludeStringH.proto (used by BytesEquals) */
#include <string.h>

/* BytesEquals.proto (used by UnicodeEquals) */
static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);

/* UnicodeEquals.proto (used by fastcall) */
static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);

/* fastcall.proto */
#if CYTHON_AVOID_BORROWED_REFS
    #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_PySequence_ITEM(args, i)
#elif CYTHON_ASSUME_SAFE_MACROS
    #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_NewRef(__Pyx_PyTuple_GET_ITEM(args, i))
#else
    #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_XNewRef(PyTuple_GetItem(args, i))
#endif
#define __Pyx_NumKwargs_VARARGS(kwds) PyDict_Size(kwds)
#define __Pyx_KwValues_VARARGS(args, nargs) NULL
#define __Pyx_GetKwValue_VARARGS(kw, kwvalues, s) __Pyx_PyDict_GetItemStrWithError(kw, s)
#define __Pyx_KwargsAsDict_VARARGS(kw, kwvalues) PyDict_Copy(kw)
#if CYTHON_METH_FASTCALL
    #define __Pyx_ArgRef_FASTCALL(args, i) __Pyx_NewRef(args[i])
    #define __Pyx_NumKwargs_FASTCALL(kwds) __Pyx_PyTuple_GET_SIZE(kwds)
    #define __Pyx_KwValues_FASTCALL(args, nargs) ((args) + (nargs))
    static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API
    CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues);
  #else
    #define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw)
  #endif
#else
    #define __Pyx_ArgRef_FASTCALL __Pyx_ArgRef_VARARGS
    #define __Pyx_NumKwargs_FASTCALL __Pyx_NumKwargs_VARARGS
    #define __Pyx_KwValues_FASTCALL __Pyx_KwValues_VARARGS
    #define __Pyx_GetKwValue_FASTCALL __Pyx_GetKwValue_VARARGS
    #define __Pyx_KwargsAsDict_FASTCALL __Pyx_KwargsAsDict_VARARGS
#endif
#define __Pyx_ArgsSlice_VARARGS(args, start, stop) PyTuple_GetSlice(args, start, stop)
#if CYTHON_METH_FASTCALL || (CYTHON_COMPILING_IN_CPYTHON && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) __Pyx_PyTuple_FromArray(args + start, stop - start)
#else
#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) PyTuple_GetSlice(args, start, stop)
#endif

/* py_dict_items.proto (used by OwnedDictNext) */
static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d);

/* CallCFunction.proto (used by CallUnboundCMethod0) */
#define __Pyx_CallCFunction(cfunc, self, args)\
    ((PyCFunction)(void(*)(void))(cfunc)->func)(self, args)
#define __Pyx_CallCFunctionWithKeywords(cfunc, self, args, kwargs)\
    ((PyCFunctionWithKeywords)(void(*)(void))(cfunc)->func)(self, args, kwargs)
#define __Pyx_CallCFunctionFast(cfunc, self, args, nargs)\
    ((__Pyx_PyCFunctionFast)(void(*)(void))(PyCFunction)(cfunc)->func)(self, args, nargs)
#define __Pyx_CallCFunctionFastWithKeywords(cfunc, self, args, nargs, kwnames)\
    ((__Pyx_PyCFunctionFastWithKeywords)(void(*)(void))(PyCFunction)(cfunc)->func)(self, args, nargs, kwnames)

/* PyObjectCall.proto (used by PyObjectFastCall) */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
#else
#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
#endif

/* PyObjectCallMethO.proto (used by PyObjectFastCall) */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
#endif

/* PyObjectFastCall.proto (used by PyObjectCallOneArg) */
#define __Pyx_PyObject_FastCall(func, args, nargs)  __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL)
static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject * const*args, size_t nargs, PyObject *kwargs);

/* PyObjectCallOneArg.proto (used by CallUnboundCMethod0) */
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);

/* UnpackUnboundCMethod.proto (used by CallUnboundCMethod0) */
typedef struct {
    PyObject *type;
    PyObject **method_name;
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && CYTHON_ATOMICS
    __pyx_atomic_int_type initialized;
#endif
    PyCFunction func;
    PyObject *method;
    int flag;
} __Pyx_CachedCFunction;
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
static CYTHON_INLINE int __Pyx_CachedCFunction_GetAndSetInitializing(__Pyx_CachedCFunction *cfunc) {
#if !CYTHON_ATOMICS
    return 1;
#else
    __pyx_nonatomic_int_type expected = 0;
    if (__pyx_atomic_int_cmp_exchange(&cfunc->initialized, &expected, 1)) {
        return 0;
    }
    return expected;
#endif
}
static CYTHON_INLINE void __Pyx_CachedCFunction_SetFinishedInitializing(__Pyx_CachedCFunction *cfunc) {
#if CYTHON_ATOMICS
    __pyx_atomic_store(&cfunc->initialized, 2);
#endif
}
#else
#define __Pyx_CachedCFunction_GetAndSetInitializing(cfunc) 2
#define __Pyx_CachedCFunction_SetFinishedInitializing(cfunc)
#endif

/* CallUnboundCMethod0.proto */
CYTHON_UNUSED
static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self);
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self);
#else
#define __Pyx_CallUnboundCMethod0(cfunc, self)  __Pyx__CallUnboundCMethod0(cfunc, self)
#endif

/* py_dict_values.proto (used by OwnedDictNext) */
static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d);

/* OwnedDictNext.proto (used by ParseKeywordsImpl) */
#if CYTHON_AVOID_BORROWED_REFS
static int __Pyx_PyDict_NextRef(PyObject *p, PyObject **ppos, PyObject **pkey, PyObject **pvalue);
#else
CYTHON_INLINE
static int __Pyx_PyDict_NextRef(PyObject *p, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue);
#endif

/* RaiseDoubleKeywords.proto (used by ParseKeywordsImpl) */
static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);

/* ParseKeywordsImpl.export */
static int __Pyx_ParseKeywordsTuple(
    PyObject *kwds,
    PyObject * const *kwvalues,
    PyObject ** const argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    Py_ssize_t num_kwargs,
    const char* function_name,
    int ignore_unknown_kwargs
);
static int __Pyx_ParseKeywordDictToDict(
    PyObject *kwds,
    PyObject ** const argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    const char* function_name
);
static int __Pyx_ParseKeywordDict(
    PyObject *kwds,
    PyObject ** const argnames[],
    PyObject *values[],
    Py_ssize_t num_pos_args,
    Py_ssize_t num_kwargs,
    const char* function_name,
    int ignore_unknown_kwargs
);

/* CallUnboundCMethod2.proto */
CYTHON_UNUSED
static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2);
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2);
#else
#define __Pyx_CallUnboundCMethod2(cfunc, self, arg1, arg2)  __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2)
#endif

/* ParseKeywords.proto */
static CYTHON_INLINE int __Pyx_ParseKeywords(
    PyObject *kwds, PyObject *const *kwvalues, PyObject ** const argnames[],
    PyObject *kwds2, PyObject *values[],
    Py_ssize_t num_pos_args, Py_ssize_t num_kwargs,
    const char* function_name,
    int ignore_unknown_kwargs
);

/* RaiseArgTupleInvalid.proto */
static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
    Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);

/* ArgTypeTestFunc.export */
static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);

/* ArgTypeTest.proto */
#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
    ((likely(__Pyx_IS_TYPE(obj, type) | (none_allowed && (obj == Py_None)))) ? 1 :\
        __Pyx__ArgTypeTest(obj, type, name, exact))

/* PyValueError_Check.proto */
#define __Pyx_PyExc_ValueError_Check(obj)  __Pyx_TypeCheck(obj, PyExc_ValueError)

/* RaiseException.export */
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);

/* PyObjectFastCallMethod.proto */
#if CYTHON_VECTORCALL && PY_VERSION_HEX >= 0x03090000
#define __Pyx_PyObject_FastCallMethod(name, args, nargsf) PyObject_VectorcallMethod(name, args, nargsf, NULL)
#else
static PyObject *__Pyx_PyObject_FastCallMethod(PyObject *name, PyObject *const *args, size_t nargsf);
#endif

/* RaiseUnexpectedTypeError.proto */
static int __Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj);

/* PyMemoryError_Check.proto */
#define __Pyx_PyExc_MemoryError_Check(obj)  __Pyx_TypeCheck(obj, PyExc_MemoryError)

/* BuildPyUnicode.proto (used by COrdinalToPyUnicode) */
static PyObject* __Pyx_PyUnicode_BuildFromAscii(Py_ssize_t ulength, const char* chars, int clength,
                                                int prepend_sign, char padding_char);

/* COrdinalToPyUnicode.proto (used by CIntToPyUnicode) */
static CYTHON_INLINE int __Pyx_CheckUnicodeValue(int value);
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromOrdinal_Padded(int value, Py_ssize_t width, char padding_char);

/* GCCDiagnostics.proto (used by CIntToPyUnicode) */
#if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
#define __Pyx_HAS_GCC_DIAGNOSTIC
#endif

/* IncludeStdlibH.proto (used by CIntToPyUnicode) */
#include <stdlib.h>

/* CIntToPyUnicode.proto */
#define __Pyx_PyUnicode_From_int(value, width, padding_char, format_char) (\
    ((format_char) == ('c')) ?\
        __Pyx_uchar___Pyx_PyUnicode_From_int(value, width, padding_char) :\
        __Pyx____Pyx_PyUnicode_From_int(value, width, padding_char, format_char)\
    )
static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_int(int value, Py_ssize_t width, char padding_char);
static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_int(int value, Py_ssize_t width, char padding_char, char format_char);

/* CIntToPyUnicode.proto */
#define __Pyx_PyUnicode_From_Py_ssize_t(value, width, padding_char, format_char) (\
    ((format_char) == ('c')) ?\
        __Pyx_uchar___Pyx_PyUnicode_From_Py_ssize_t(value, width, padding_char) :\
        __Pyx____Pyx_PyUnicode_From_Py_ssize_t(value, width, padding_char, format_char)\
    )
static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char);
static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char, char format_char);

/* JoinPyUnicode.export */
static PyObject* __Pyx_PyUnicode_Join(PyObject** values, Py_ssize_t value_count, Py_ssize_t result_ulength,
                                      Py_UCS4 max_char);

/* PyObjectFormatSimple.proto */
#if CYTHON_COMPILING_IN_PYPY
    #define __Pyx_PyObject_FormatSimple(s, f) (\
        likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
        PyObject_Format(s, f))
#elif CYTHON_USE_TYPE_SLOTS
    #define __Pyx_PyObject_FormatSimple(s, f) (\
        likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
        likely(PyLong_CheckExact(s)) ? PyLong_Type.tp_repr(s) :\
        likely(PyFloat_CheckExact(s)) ? PyFloat_Type.tp_repr(s) :\
        PyObject_Format(s, f))
#else
    #define __Pyx_PyObject_FormatSimple(s, f) (\
        likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
        PyObject_Format(s, f))
#endif

CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *); /*proto*/
/* GetAttr.proto */
static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);

/* GetItemInt.proto */
#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck, unsafe_shared) :\
    (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
               __Pyx_GetItemInt_Generic(o, to_py_func(i))))
#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck, unsafe_shared) :\
    (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck, int unsafe_shared);
#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck, unsafe_shared) :\
    (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck, int unsafe_shared);
static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
                                                     int is_list, int wraparound, int boundscheck, int unsafe_shared);

/* ObjectGetItem.proto */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key);
#else
#define __Pyx_PyObject_GetItem(obj, key)  PyObject_GetItem(obj, key)
#endif

/* RejectKeywords.export */
static void __Pyx_RejectKeywords(const char* function_name, PyObject *kwds);

/* PyTypeError_Check.proto */
#define __Pyx_PyExc_TypeError_Check(obj)  __Pyx_TypeCheck(obj, PyExc_TypeError)

/* DivInt[Py_ssize_t].proto */
static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t, int b_is_constant);

/* UnaryNegOverflows.proto */
#define __Pyx_UNARY_NEG_WOULD_OVERFLOW(x)\
        (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x)))

/* GetAttr3.proto */
static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);

/* PyDictVersioning.proto (used by GetModuleGlobalName) */
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
#define __PYX_DICT_VERSION_INIT  ((PY_UINT64_T) -1)
#define __PYX_GET_DICT_VERSION(dict)  (((PyDictObject*)(dict))->ma_version_tag)
#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
    (version_var) = __PYX_GET_DICT_VERSION(dict);\
    (cache_var) = (value);
#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
    static PY_UINT64_T __pyx_dict_version = 0;\
    static PyObject *__pyx_dict_cached_value = NULL;\
    if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
        (VAR) = __Pyx_XNewRef(__pyx_dict_cached_value);\
    } else {\
        (VAR) = __pyx_dict_cached_value = (LOOKUP);\
        __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
    }\
}
static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
#else
#define __PYX_GET_DICT_VERSION(dict)  (0)
#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP)  (VAR) = (LOOKUP);
#endif

/* GetModuleGlobalName.proto */
#if CYTHON_USE_DICT_VERSIONS
#define __Pyx_GetModuleGlobalName(var, name)  do {\
    static PY_UINT64_T __pyx_dict_version = 0;\
    static PyObject *__pyx_dict_cached_value = NULL;\
    (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_mstate_global->__pyx_d))) ?\
        (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
        __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
} while(0)
#define __Pyx_GetModuleGlobalNameUncached(var, name)  do {\
    PY_UINT64_T __pyx_dict_version;\
    PyObject *__pyx_dict_cached_value;\
    (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
} while(0)
static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
#else
#define __Pyx_GetModuleGlobalName(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
#define __Pyx_GetModuleGlobalNameUncached(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
#endif

/* AssertionsEnabled.proto */
#if CYTHON_COMPILING_IN_LIMITED_API  ||  PY_VERSION_HEX >= 0x030C0000
  static int __pyx_assertions_enabled_flag;
  #define __pyx_assertions_enabled() (__pyx_assertions_enabled_flag)
  #if __clang__ || __GNUC__
  __attribute__((no_sanitize("thread")))
  #endif
  static int __Pyx_init_assertions_enabled(void) {
    PyObject *builtins, *debug, *debug_str;
    int flag;
    builtins = PyEval_GetBuiltins();
    if (!builtins) goto bad;
    debug_str = PyUnicode_FromStringAndSize("__debug__", 9);
    if (!debug_str) goto bad;
    debug = PyObject_GetItem(builtins, debug_str);
    Py_DECREF(debug_str);
    if (!debug) goto bad;
    flag = PyObject_IsTrue(debug);
    Py_DECREF(debug);
    if (flag == -1) goto bad;
    __pyx_assertions_enabled_flag = flag;
    return 0;
  bad:
    __pyx_assertions_enabled_flag = 1;
    return -1;
  }
#else
  #define __Pyx_init_assertions_enabled()  (0)
  #define __pyx_assertions_enabled()  (!Py_OptimizeFlag)
#endif

/* PyAssertionError_Check.proto */
#define __Pyx_PyExc_AssertionError_Check(obj)  __Pyx_TypeCheck(obj, PyExc_AssertionError)

/* RaiseTooManyValuesToUnpack.proto */
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);

/* RaiseNeedMoreValuesToUnpack.proto */
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);

/* RaiseNoneIterError.proto */
static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);

/* ExtTypeTest.proto */
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);

/* GetTopmostException.proto (used by SaveResetException) */
#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE
static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
#endif

/* SaveResetException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_ExceptionSave(type, value, tb)  __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#define __Pyx_ExceptionReset(type, value, tb)  __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
#else
#define __Pyx_ExceptionSave(type, value, tb)   PyErr_GetExcInfo(type, value, tb)
#define __Pyx_ExceptionReset(type, value, tb)  PyErr_SetExcInfo(type, value, tb)
#endif

/* GetException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_GetException(type, value, tb)  __Pyx__GetException(__pyx_tstate, type, value, tb)
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#else
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
#endif

/* SwapException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_ExceptionSwap(type, value, tb)  __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#else
static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
#endif

/* HasAttr.proto (used by ImportImpl) */
#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
#define __Pyx_HasAttr(o, n)  PyObject_HasAttrWithError(o, n)
#else
static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);
#endif

/* ImportImpl.export */
static PyObject *__Pyx__Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, PyObject *moddict, int level);

/* Import.proto */
static CYTHON_INLINE PyObject *__Pyx_Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, int level);

/* FastTypeChecks.proto */
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
#define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2)
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b);
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
#else
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
#define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2))
#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2) {
    return PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2);
}
#endif
#define __Pyx_PyErr_ExceptionMatches2(err1, err2)  __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2)
#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
#ifdef PyExceptionInstance_Check
  #define __Pyx_PyBaseException_Check(obj) PyExceptionInstance_Check(obj)
#else
  #define __Pyx_PyBaseException_Check(obj) __Pyx_TypeCheck(obj, PyExc_BaseException)
#endif

CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
/* ListCompAppend.proto */
#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
    PyListObject* L = (PyListObject*) list;
    Py_ssize_t len = Py_SIZE(list);
    if (likely(L->allocated > len)) {
        Py_INCREF(x);
        #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000
        L->ob_item[len] = x;
        #else
        PyList_SET_ITEM(list, len, x);
        #endif
        __Pyx_SET_SIZE(list, len + 1);
        return 0;
    }
    return PyList_Append(list, x);
}
#else
#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
#endif

/* PySequenceMultiply.proto */
#define __Pyx_PySequence_Multiply_Left(mul, seq)  __Pyx_PySequence_Multiply(seq, mul)
#if !CYTHON_USE_TYPE_SLOTS
#define  __Pyx_PySequence_Multiply PySequence_Repeat
#else
static CYTHON_INLINE PyObject* __Pyx_PySequence_Multiply(PyObject *seq, Py_ssize_t mul);
#endif

/* PyObjectFormatAndDecref.proto */
static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatSimpleAndDecref(PyObject* s, PyObject* f);
static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatAndDecref(PyObject* s, PyObject* f);

/* PyObjectFormat.proto */
#if CYTHON_USE_UNICODE_WRITER
static PyObject* __Pyx_PyObject_Format(PyObject* s, PyObject* f);
#else
#define __Pyx_PyObject_Format(s, f) PyObject_Format(s, f)
#endif

/* SetItemInt.proto */
#define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck, unsafe_shared) :\
    (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\
               __Pyx_SetItemInt_Generic(o, to_py_func(i), v)))
static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v);
static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v,
                                               int is_list, int wraparound, int boundscheck, int unsafe_shared);

/* RaiseUnboundLocalError.proto */
static void __Pyx_RaiseUnboundLocalError(const char *varname);

/* PyIndexError_Check.proto */
#define __Pyx_PyExc_IndexError_Check(obj)  __Pyx_TypeCheck(obj, PyExc_IndexError)

/* DivInt[long].proto */
static CYTHON_INLINE long __Pyx_div_long(long, long, int b_is_constant);

/* PyKeyError_Check.proto */
#define __Pyx_PyExc_KeyError_Check(obj)  __Pyx_TypeCheck(obj, PyExc_KeyError)

/* IterFinish.proto (used by dict_iter) */
static CYTHON_INLINE int __Pyx_IterFinish(void);

/* PyObjectCallNoArg.proto (used by PyObjectCallMethod0) */
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);

/* PyObjectGetMethod.proto (used by PyObjectCallMethod0) */
#if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000)))
static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method);
#endif

/* PyObjectCallMethod0.proto (used by dict_iter) */
static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name);

/* UnpackItemEndCheck.proto (used by UnpackTuple2) */
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);

/* UnpackTupleError.proto (used by UnpackTuple2) */
static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index);

/* UnpackTuple2.proto (used by dict_iter) */
static CYTHON_INLINE int __Pyx_unpack_tuple2(
    PyObject* tuple, PyObject** value1, PyObject** value2, int is_tuple, int has_known_size, int decref_tuple);
static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
    PyObject* tuple, PyObject** value1, PyObject** value2, int decref_tuple);
static int __Pyx_unpack_tuple2_generic(
    PyObject* tuple, PyObject** value1, PyObject** value2, int has_known_size, int decref_tuple);

/* dict_iter.proto */
static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* dict, int is_dict, PyObject* method_name,
                                                   Py_ssize_t* p_orig_length, int* p_is_dict);
static CYTHON_INLINE int __Pyx_dict_iter_next(PyObject* dict_or_iter, Py_ssize_t orig_length, Py_ssize_t* ppos,
                                              PyObject** pkey, PyObject** pvalue, PyObject** pitem, int is_dict);

/* decode_c_string_utf16.proto (used by decode_c_bytes) */
static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) {
    int byteorder = 0;
    return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
}
static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) {
    int byteorder = -1;
    return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
}
static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) {
    int byteorder = 1;
    return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
}

/* decode_c_bytes.proto (used by decode_bytes) */
static CYTHON_INLINE PyObject* __Pyx_decode_c_bytes(
         const char* cstring, Py_ssize_t length, Py_ssize_t start, Py_ssize_t stop,
         const char* encoding, const char* errors,
         PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors));

/* decode_bytes.proto */
static CYTHON_INLINE PyObject* __Pyx_decode_bytes(
         PyObject* string, Py_ssize_t start, Py_ssize_t stop,
         const char* encoding, const char* errors,
         PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
    char* as_c_string;
    Py_ssize_t size;
#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE
    as_c_string = PyBytes_AS_STRING(string);
    size = PyBytes_GET_SIZE(string);
#else
    if (PyBytes_AsStringAndSize(string, &as_c_string, &size) < 0) {
        return NULL;
    }
#endif
    return __Pyx_decode_c_bytes(
        as_c_string, size,
        start, stop, encoding, errors, decode_func);
}

/* PyObjectDelAttr.proto (used by PyObjectSetAttrStr) */
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030d0000
#define __Pyx_PyObject_DelAttr(o, n) PyObject_SetAttr(o, n, NULL)
#else
#define __Pyx_PyObject_DelAttr(o, n) PyObject_DelAttr(o, n)
#endif

/* PyObjectSetAttrStr.proto */
#if CYTHON_USE_TYPE_SLOTS
#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o, n, NULL)
static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value);
#else
#define __Pyx_PyObject_DelAttrStr(o,n)   __Pyx_PyObject_DelAttr(o,n)
#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
#endif

/* SliceObject.proto */
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(
        PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop,
        PyObject** py_start, PyObject** py_stop, PyObject** py_slice,
        int has_cstart, int has_cstop, int wraparound);

/* ListAppend.proto */
#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
    PyListObject* L = (PyListObject*) list;
    Py_ssize_t len = Py_SIZE(list);
    if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
        Py_INCREF(x);
        #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000
        L->ob_item[len] = x;
        #else
        PyList_SET_ITEM(list, len, x);
        #endif
        __Pyx_SET_SIZE(list, len + 1);
        return 0;
    }
    return PyList_Append(list, x);
}
#else
#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
#endif

/* ModInt[int].proto */
static CYTHON_INLINE int __Pyx_mod_int(int, int, int b_is_constant);

/* DivInt[int].proto */
static CYTHON_INLINE int __Pyx_div_int(int, int, int b_is_constant);

/* decode_c_string.proto */
static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
         const char* cstring, Py_ssize_t start, Py_ssize_t stop,
         const char* encoding, const char* errors,
         PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors));

/* SliceObject.proto */
#define __Pyx_PyObject_DelSlice(obj, cstart, cstop, py_start, py_stop, py_slice, has_cstart, has_cstop, wraparound)\
    __Pyx_PyObject_SetSlice(obj, (PyObject*)NULL, cstart, cstop, py_start, py_stop, py_slice, has_cstart, has_cstop, wraparound)
static CYTHON_INLINE int __Pyx_PyObject_SetSlice(
        PyObject* obj, PyObject* value, Py_ssize_t cstart, Py_ssize_t cstop,
        PyObject** py_start, PyObject** py_stop, PyObject** py_slice,
        int has_cstart, int has_cstop, int wraparound);

/* WriteUnraisableException.proto */
static void __Pyx_WriteUnraisable(const char *name, int clineno,
                                  int lineno, const char *filename,
                                  int full_traceback, int nogil);

/* PyLongBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static CYTHON_INLINE PyObject* __Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyLong_AddObjC(op1, op2, intval, inplace, zerodivision_check)\
    (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
#endif

/* PyLongCompare.proto */
static CYTHON_INLINE int __Pyx_PyLong_BoolEqObjC(PyObject *op1, PyObject *op2, long intval, long inplace);

/* CIntToPyUnicode.proto */
#define __Pyx_PyUnicode_From_xmlElementType(value, width, padding_char, format_char) (\
    ((format_char) == ('c')) ?\
        __Pyx_uchar___Pyx_PyUnicode_From_xmlElementType(value, width, padding_char) :\
        __Pyx____Pyx_PyUnicode_From_xmlElementType(value, width, padding_char, format_char)\
    )
static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_xmlElementType(xmlElementType value, Py_ssize_t width, char padding_char);
static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_xmlElementType(xmlElementType value, Py_ssize_t width, char padding_char, char format_char);

/* PyDictContains.proto */
static CYTHON_INLINE int __Pyx_PyDict_ContainsTF(PyObject* item, PyObject* dict, int eq) {
    int result = PyDict_Contains(dict, item);
    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
}

/* PySequenceContains.proto */
static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) {
    int result = PySequence_Contains(seq, item);
    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
}

/* pyfrozenset_new.proto (used by PySetContains) */
static CYTHON_INLINE PyObject* __Pyx_PyFrozenSet_New(PyObject* it);

/* PySetContains.proto */
static CYTHON_INLINE int __Pyx_PySet_ContainsTF(PyObject* key, PyObject* set, int eq);

/* PySliceAccessors.proto */
#if CYTHON_COMPILING_IN_LIMITED_API
#define __Pyx_PySlice_Start(o) PyObject_GetAttr(o, __pyx_mstate_global->__pyx_n_u_start)
#define __Pyx_PySlice_Stop(o) PyObject_GetAttr(o, __pyx_mstate_global->__pyx_n_u_stop)
#define __Pyx_PySlice_Step(o) PyObject_GetAttr(o, __pyx_mstate_global->__pyx_n_u_step)
#elif CYTHON_COMPILING_IN_GRAAL && defined(GRAALPY_VERSION_NUM) && GRAALPY_VERSION_NUM > 0x19000000
#define __Pyx_PySlice_Start(o) GraalPySlice_Start(o)
#define __Pyx_PySlice_Stop(o) GraalPySlice_Stop(o)
#define __Pyx_PySlice_Step(o) GraalPySlice_Step(o)
#elif CYTHON_COMPILING_IN_GRAAL
#define __Pyx_PySlice_Start(o) __Pyx_NewRef(PySlice_Start((PySliceObject*)o))
#define __Pyx_PySlice_Stop(o) __Pyx_NewRef(PySlice_Stop((PySliceObject*)o))
#define __Pyx_PySlice_Step(o) __Pyx_NewRef(PySlice_Step((PySliceObject*)o))
#else
#define __Pyx_PySlice_Start(o) __Pyx_NewRef(((PySliceObject*)o)->start)
#define __Pyx_PySlice_Stop(o) __Pyx_NewRef(((PySliceObject*)o)->stop)
#define __Pyx_PySlice_Step(o) __Pyx_NewRef(((PySliceObject*)o)->step)
#endif

/* PyUnicodeEncodeError_Check.proto */
#define __Pyx_PyExc_UnicodeEncodeError_Check(obj)  __Pyx_TypeCheck(obj, PyExc_UnicodeEncodeError)

/* PyUnicodeDecodeError_Check.proto */
#define __Pyx_PyExc_UnicodeDecodeError_Check(obj)  __Pyx_TypeCheck(obj, PyExc_UnicodeDecodeError)

/* PyUnicode_Unicode.proto */
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Unicode(PyObject *obj);

/* CIntToPyUnicode.proto */
#define __Pyx_PyUnicode_From_long(value, width, padding_char, format_char) (\
    ((format_char) == ('c')) ?\
        __Pyx_uchar___Pyx_PyUnicode_From_long(value, width, padding_char) :\
        __Pyx____Pyx_PyUnicode_From_long(value, width, padding_char, format_char)\
    )
static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_long(long value, Py_ssize_t width, char padding_char);
static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_long(long value, Py_ssize_t width, char padding_char, char format_char);

/* pop.proto */
static CYTHON_INLINE PyObject* __Pyx__PyObject_Pop(PyObject* L);
#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE
static CYTHON_INLINE PyObject* __Pyx_PyList_Pop(PyObject* L);
#define __Pyx_PyObject_Pop(L) (likely(PyList_CheckExact(L)) ?\
    __Pyx_PyList_Pop(L) : __Pyx__PyObject_Pop(L))
#else
#define __Pyx_PyList_Pop(L)  __Pyx__PyObject_Pop(L)
#define __Pyx_PyObject_Pop(L)  __Pyx__PyObject_Pop(L)
#endif

/* SliceTupleAndList.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyList_GetSlice(PyObject* src, Py_ssize_t start, Py_ssize_t stop);
static CYTHON_INLINE PyObject* __Pyx_PyTuple_GetSlice(PyObject* src, Py_ssize_t start, Py_ssize_t stop);
#else
#define __Pyx_PyList_GetSlice(seq, start, stop)   PySequence_GetSlice(seq, start, stop)
#define __Pyx_PyTuple_GetSlice(seq, start, stop)  PySequence_GetSlice(seq, start, stop)
#endif

/* pyint_simplify.proto */
static CYTHON_INLINE int __Pyx_PyInt_FromNumber(PyObject **number_var, const char *argname, int accept_none);

/* PyFutureWarning_Check.proto */
#define __Pyx_PyExc_FutureWarning_Check(obj)  __Pyx_TypeCheck(obj, PyExc_FutureWarning)

/* PyObjectVectorCallKwBuilder.proto */
CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n);
#if CYTHON_VECTORCALL
#if PY_VERSION_HEX >= 0x03090000
#define __Pyx_Object_Vectorcall_CallFromBuilder PyObject_Vectorcall
#else
#define __Pyx_Object_Vectorcall_CallFromBuilder _PyObject_Vectorcall
#endif
#define __Pyx_MakeVectorcallBuilderKwds(n) PyTuple_New(n)
static int __Pyx_VectorcallBuilder_AddArg(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n);
static int __Pyx_VectorcallBuilder_AddArgStr(const char *key, PyObject *value, PyObject *builder, PyObject **args, int n);
#else
#define __Pyx_Object_Vectorcall_CallFromBuilder __Pyx_PyObject_FastCallDict
#define __Pyx_MakeVectorcallBuilderKwds(n) __Pyx_PyDict_NewPresized(n)
#define __Pyx_VectorcallBuilder_AddArg(key, value, builder, args, n) PyDict_SetItem(builder, key, value)
#define __Pyx_VectorcallBuilder_AddArgStr(key, value, builder, args, n) PyDict_SetItemString(builder, key, value)
#endif

/* PyObjectVectorCallMethodKwBuilder.proto */
#if CYTHON_VECTORCALL && PY_VERSION_HEX >= 0x03090000
#define __Pyx_Object_VectorcallMethod_CallFromBuilder PyObject_VectorcallMethod
#else
static PyObject *__Pyx_Object_VectorcallMethod_CallFromBuilder(PyObject *name, PyObject *const *args, size_t nargsf, PyObject *kwnames);
#endif

/* ImportFrom.proto */
static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);

/* tp_new.proto */
#define __Pyx_tp_new(type_obj, args) __Pyx_tp_new_kwargs(type_obj, args, NULL)
static CYTHON_INLINE PyObject* __Pyx_tp_new_kwargs(PyObject* type_obj, PyObject* args, PyObject* kwargs);

/* PyObject_Unicode.proto */
#define __Pyx_PyObject_Unicode(obj)\
    (likely(PyUnicode_CheckExact(obj)) ? __Pyx_NewRef(obj) : PyObject_Str(obj))

/* PyObjectLookupSpecial.proto */
#if CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
#define __Pyx_PyObject_LookupSpecialNoError(obj, attr_name)  __Pyx__PyObject_LookupSpecial(obj, attr_name, 0)
#define __Pyx_PyObject_LookupSpecial(obj, attr_name)  __Pyx__PyObject_LookupSpecial(obj, attr_name, 1)
static CYTHON_INLINE PyObject* __Pyx__PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name, int with_error);
#else
#define __Pyx_PyObject_LookupSpecialNoError(o,n) __Pyx_PyObject_GetAttrStrNoError(o,n)
#define __Pyx_PyObject_LookupSpecial(o,n) __Pyx_PyObject_GetAttrStr(o,n)
#endif

/* PyDeprecationWarning_Check.proto */
#define __Pyx_PyExc_DeprecationWarning_Check(obj)  __Pyx_TypeCheck(obj, PyExc_DeprecationWarning)

/* UnicodeConcatInPlace.proto */
# if CYTHON_COMPILING_IN_CPYTHON
    #if CYTHON_REFNANNY
        #define __Pyx_PyUnicode_ConcatInPlace(left, right, unsafe_shared) __Pyx_PyUnicode_ConcatInPlaceImpl(&left, right, unsafe_shared, __pyx_refnanny)
    #else
        #define __Pyx_PyUnicode_ConcatInPlace(left, right, unsafe_shared) __Pyx_PyUnicode_ConcatInPlaceImpl(&left, right, unsafe_shared)
    #endif
    #define __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_DefinitelyUniqueInPlace(left, right) __Pyx_PyUnicode_ConcatInPlace(left, right, __Pyx_ReferenceSharing_DefinitelyUnique)
    #define __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_OwnStrongReferenceInPlace(left, right) __Pyx_PyUnicode_ConcatInPlace(left, right, __Pyx_ReferenceSharing_OwnStrongReference)
    #define __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_FunctionArgumentInPlace(left, right) __Pyx_PyUnicode_ConcatInPlace(left, right, __Pyx_ReferenceSharing_DefinitelyUnique)
    #define __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_SharedReferenceInPlace(left, right) __Pyx_PyUnicode_ConcatInPlace(left, right, __Pyx_ReferenceSharing_SharedReference)
    static CYTHON_INLINE PyObject *__Pyx_PyUnicode_ConcatInPlaceImpl(PyObject **p_left, PyObject *right, int unsafe_shared
        #if CYTHON_REFNANNY
        , void* __pyx_refnanny
        #endif
    );
#else
#define __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_DefinitelyUniqueInPlace __Pyx_PyUnicode_Concat
#define __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_OwnStrongReferenceInPlace __Pyx_PyUnicode_Concat
#define __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_FunctionArgumentInPlace __Pyx_PyUnicode_Concat
#define __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_SharedReferenceInPlace __Pyx_PyUnicode_Concat
#endif
#define __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_DefinitelyUniqueInPlaceSafe(left, right)\
    ((unlikely((left) == Py_None) || unlikely((right) == Py_None)) ?\
    PyNumber_InPlaceAdd(left, right) : __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_DefinitelyUniqueInPlace(left, right))
#define __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_OwnStrongReferenceInPlaceSafe(left, right)\
    ((unlikely((left) == Py_None) || unlikely((right) == Py_None)) ?\
    PyNumber_InPlaceAdd(left, right) : __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_OwnStrongReferenceInPlace(left, right))
#define __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_FunctionArgumentInPlaceSafe(left, right)\
    ((unlikely((left) == Py_None) || unlikely((right) == Py_None)) ?\
    PyNumber_InPlaceAdd(left, right) : __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_FunctionArgumentInPlace(left, right))
#define __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_SharedReferenceInPlaceSafe(left, right)\
    ((unlikely((left) == Py_None) || unlikely((right) == Py_None)) ?\
    PyNumber_InPlaceAdd(left, right) : __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_SharedReferenceInPlace(left, right))

/* IterNextPlain.proto (used by IterNext) */
static CYTHON_INLINE PyObject *__Pyx_PyIter_Next_Plain(PyObject *iterator);
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
static PyObject *__Pyx_GetBuiltinNext_LimitedAPI(void);
#endif

/* IterNext.proto */
#define __Pyx_PyIter_Next(obj) __Pyx_PyIter_Next2(obj, NULL)
static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject *, PyObject *);

/* PyReferenceError_Check.proto */
#define __Pyx_PyExc_ReferenceError_Check(obj)  __Pyx_TypeCheck(obj, PyExc_ReferenceError)

/* PyAttributeError_Check.proto */
#define __Pyx_PyExc_AttributeError_Check(obj)  __Pyx_TypeCheck(obj, PyExc_AttributeError)

/* PyObjectCall2Args.proto (used by CallUnboundCMethod1) */
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);

/* CallUnboundCMethod1.proto */
CYTHON_UNUSED
static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg);
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg);
#else
#define __Pyx_CallUnboundCMethod1(cfunc, self, arg)  __Pyx__CallUnboundCMethod1(cfunc, self, arg)
#endif

/* CallableCheck.proto */
#if CYTHON_USE_TYPE_SLOTS && !CYTHON_COMPILING_IN_PYPY
#define __Pyx_PyCallable_Check(obj)   (Py_TYPE(obj)->tp_call != NULL)
#else
#define __Pyx_PyCallable_Check(obj)   PyCallable_Check(obj)
#endif

/* py_dict_clear.proto */
#define __Pyx_PyDict_Clear(d) (PyDict_Clear(d), 0)

/* DictGetItem.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
#define __Pyx_PyObject_Dict_GetItem(obj, name)\
    (likely(PyDict_CheckExact(obj)) ?\
     __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
#else
#define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
#define __Pyx_PyObject_Dict_GetItem(obj, name)  PyObject_GetItem(obj, name)
#endif

/* PyLongBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static CYTHON_INLINE PyObject* __Pyx_PyLong_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyLong_SubtractObjC(op1, op2, intval, inplace, zerodivision_check)\
    (inplace ? PyNumber_InPlaceSubtract(op1, op2) : PyNumber_Subtract(op1, op2))
#endif

/* PyIOError_Check.proto */
#define __Pyx_PyExc_IOError_Check(obj)  __Pyx_TypeCheck(obj, PyExc_IOError)

/* PyLookupError_Check.proto */
#define __Pyx_PyExc_LookupError_Check(obj)  __Pyx_TypeCheck(obj, PyExc_LookupError)

/* PyUnicode_Substring.proto */
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Substring(
            PyObject* text, Py_ssize_t start, Py_ssize_t stop);

/* BufferIndexError.proto */
static void __Pyx_RaiseBufferIndexError(int axis);

/* pep479.proto */
static void __Pyx_Generator_Replace_StopIteration(int in_async_gen);

/* dict_setdefault.proto (used by FetchCommonType) */
static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value);

/* LimitedApiGetTypeDict.proto (used by SetItemOnTypeDict) */
#if CYTHON_COMPILING_IN_LIMITED_API
static PyObject *__Pyx_GetTypeDict(PyTypeObject *tp);
#endif

/* SetItemOnTypeDict.proto (used by FixUpExtensionType) */
static int __Pyx__SetItemOnTypeDict(PyTypeObject *tp, PyObject *k, PyObject *v);
#define __Pyx_SetItemOnTypeDict(tp, k, v) __Pyx__SetItemOnTypeDict((PyTypeObject*)tp, k, v)

/* FixUpExtensionType.proto (used by FetchCommonType) */
static CYTHON_INLINE int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type);

/* AddModuleRef.proto (used by FetchSharedCythonModule) */
#if ((CYTHON_COMPILING_IN_CPYTHON_FREETHREADING ) ||\
     __PYX_LIMITED_VERSION_HEX < 0x030d0000)
  static PyObject *__Pyx_PyImport_AddModuleRef(const char *name);
#else
  #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name)
#endif

/* FetchSharedCythonModule.proto (used by FetchCommonType) */
static PyObject *__Pyx_FetchSharedCythonABIModule(void);

/* FetchCommonType.proto (used by CommonTypesMetaclass) */
static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases);

/* CommonTypesMetaclass.proto (used by CoroutineBase) */
static int __pyx_CommonTypesMetaclass_init(PyObject *module);
#define __Pyx_CommonTypesMetaclass_USED

/* CallTypeTraverse.proto (used by CoroutineBase) */
#if !CYTHON_USE_TYPE_SPECS || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x03090000)
#define __Pyx_call_type_traverse(o, always_call, visit, arg) 0
#else
static int __Pyx_call_type_traverse(PyObject *o, int always_call, visitproc visit, void *arg);
#endif

/* PyObjectCallMethod1.proto (used by CoroutineBase) */
static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg);

/* ReturnWithStopIteration.proto (used by CoroutineBase) */
static CYTHON_INLINE void __Pyx_ReturnWithStopIteration(PyObject* value, int async, int iternext);

/* CoroutineBase.proto (used by Generator) */
struct __pyx_CoroutineObject;
typedef PyObject *(*__pyx_coroutine_body_t)(struct __pyx_CoroutineObject *, PyThreadState *, PyObject *);
#if CYTHON_USE_EXC_INFO_STACK
#define __Pyx_ExcInfoStruct  _PyErr_StackItem
#else
typedef struct {
    PyObject *exc_type;
    PyObject *exc_value;
    PyObject *exc_traceback;
} __Pyx_ExcInfoStruct;
#endif
typedef struct __pyx_CoroutineObject {
    PyObject_HEAD
    __pyx_coroutine_body_t body;
    PyObject *closure;
    __Pyx_ExcInfoStruct gi_exc_state;
#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
    PyObject *gi_weakreflist;
#endif
    PyObject *classobj;
    PyObject *yieldfrom;
    __Pyx_pyiter_sendfunc yieldfrom_am_send;
    PyObject *gi_name;
    PyObject *gi_qualname;
    PyObject *gi_modulename;
    PyObject *gi_code;
    PyObject *gi_frame;
#if CYTHON_USE_SYS_MONITORING && (CYTHON_PROFILE || CYTHON_TRACE)
    PyMonitoringState __pyx_pymonitoring_state[__Pyx_MonitoringEventTypes_CyGen_count];
    uint64_t __pyx_pymonitoring_version;
#endif
    int resume_label;
    char is_running;
} __pyx_CoroutineObject;
static __pyx_CoroutineObject *__Pyx__Coroutine_New(
    PyTypeObject *type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
    PyObject *name, PyObject *qualname, PyObject *module_name);
static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
            __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
            PyObject *name, PyObject *qualname, PyObject *module_name);
static CYTHON_INLINE void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *self);
static int __Pyx_Coroutine_clear(PyObject *self);
static __Pyx_PySendResult __Pyx_Coroutine_AmSend(PyObject *self, PyObject *value, PyObject **retval);
static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value);
static __Pyx_PySendResult __Pyx_Coroutine_Close(PyObject *self, PyObject **retval);
static PyObject *__Pyx_Coroutine_Throw(PyObject *gen, PyObject *args);
#if CYTHON_USE_EXC_INFO_STACK
#define __Pyx_Coroutine_SwapException(self)
#define __Pyx_Coroutine_ResetAndClearException(self)  __Pyx_Coroutine_ExceptionClear(&(self)->gi_exc_state)
#else
#define __Pyx_Coroutine_SwapException(self) {\
    __Pyx_ExceptionSwap(&(self)->gi_exc_state.exc_type, &(self)->gi_exc_state.exc_value, &(self)->gi_exc_state.exc_traceback);\
    __Pyx_Coroutine_ResetFrameBackpointer(&(self)->gi_exc_state);\
    }
#define __Pyx_Coroutine_ResetAndClearException(self) {\
    __Pyx_ExceptionReset((self)->gi_exc_state.exc_type, (self)->gi_exc_state.exc_value, (self)->gi_exc_state.exc_traceback);\
    (self)->gi_exc_state.exc_type = (self)->gi_exc_state.exc_value = (self)->gi_exc_state.exc_traceback = NULL;\
    }
#endif
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
    __Pyx_PyGen__FetchStopIterationValue(__pyx_tstate, pvalue)
#else
#define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
    __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, pvalue)
#endif
static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *tstate, PyObject **pvalue);
static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state);
static char __Pyx_Coroutine_test_and_set_is_running(__pyx_CoroutineObject *gen);
static void __Pyx_Coroutine_unset_is_running(__pyx_CoroutineObject *gen);
static char __Pyx_Coroutine_get_is_running(__pyx_CoroutineObject *gen);
static PyObject *__Pyx_Coroutine_get_is_running_getter(PyObject *gen, void *closure);
#if __PYX_HAS_PY_AM_SEND == 2
static void __Pyx_SetBackportTypeAmSend(PyTypeObject *type, __Pyx_PyAsyncMethodsStruct *static_amsend_methods, __Pyx_pyiter_sendfunc am_send);
#endif
static PyObject *__Pyx_Coroutine_fail_reduce_ex(PyObject *self, PyObject *arg);

/* Generator.proto (used by GeneratorYieldFrom) */
#define __Pyx_Generator_USED
#define __Pyx_Generator_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_mstate_global->__pyx_GeneratorType)
#define __Pyx_Generator_New(body, code, closure, name, qualname, module_name)\
    __Pyx__Coroutine_New(__pyx_mstate_global->__pyx_GeneratorType, body, code, closure, name, qualname, module_name)
static PyObject *__Pyx_Generator_Next(PyObject *self);
static int __pyx_Generator_init(PyObject *module);
static CYTHON_INLINE PyObject *__Pyx_Generator_GetInlinedResult(PyObject *self);

/* GeneratorYieldFrom.proto */
static CYTHON_INLINE __Pyx_PySendResult __Pyx_Generator_Yield_From(__pyx_CoroutineObject *gen, PyObject *source, PyObject **retval);

/* append.proto */
static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x);

/* PyUnicodeContains.proto */
static CYTHON_INLINE int __Pyx_PyUnicode_ContainsTF(PyObject* substring, PyObject* text, int eq) {
    int result = PyUnicode_Contains(text, substring);
    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
}

/* PySet_Update.proto */
static CYTHON_INLINE int __Pyx_PySet_Update(PyObject* set, PyObject* it);

/* PyMethodNew.proto (used by CythonFunctionShared) */
static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ);

/* PyVectorcallFastCallDict.proto (used by CythonFunctionShared) */
#if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL
static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw);
#endif

/* CythonFunctionShared.proto (used by CythonFunction) */
#define __Pyx_CyFunction_USED
#define __Pyx_CYFUNCTION_STATICMETHOD  0x01
#define __Pyx_CYFUNCTION_CLASSMETHOD   0x02
#define __Pyx_CYFUNCTION_CCLASS        0x04
#define __Pyx_CYFUNCTION_COROUTINE     0x08
#define __Pyx_CyFunction_GetClosure(f)\
    (((__pyx_CyFunctionObject *) (f))->func_closure)
#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
  #define __Pyx_CyFunction_GetClassObj(f)\
      (((__pyx_CyFunctionObject *) (f))->func_classobj)
#else
  #define __Pyx_CyFunction_GetClassObj(f)\
      ((PyObject*) ((PyCMethodObject *) (f))->mm_class)
#endif
#define __Pyx_CyFunction_SetClassObj(f, classobj)\
    __Pyx__CyFunction_SetClassObj((__pyx_CyFunctionObject *) (f), (classobj))
#define __Pyx_CyFunction_Defaults(type, f)\
    ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
    ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
typedef struct {
#if CYTHON_COMPILING_IN_LIMITED_API
    PyObject_HEAD
    PyObject *func;
#elif PY_VERSION_HEX < 0x030900B1
    PyCFunctionObject func;
#else
    PyCMethodObject func;
#endif
#if CYTHON_COMPILING_IN_LIMITED_API && CYTHON_METH_FASTCALL
    __pyx_vectorcallfunc func_vectorcall;
#endif
#if CYTHON_COMPILING_IN_LIMITED_API
    PyObject *func_weakreflist;
#endif
#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
    PyObject *func_dict;
#endif
    PyObject *func_name;
    PyObject *func_qualname;
    PyObject *func_doc;
    PyObject *func_globals;
    PyObject *func_code;
    PyObject *func_closure;
#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
    PyObject *func_classobj;
#endif
    PyObject *defaults;
    int flags;
    PyObject *defaults_tuple;
    PyObject *defaults_kwdict;
    PyObject *(*defaults_getter)(PyObject *);
    PyObject *func_annotations;
    PyObject *func_is_coroutine;
} __pyx_CyFunctionObject;
#undef __Pyx_CyOrPyCFunction_Check
#define __Pyx_CyFunction_Check(obj)  __Pyx_TypeCheck(obj, __pyx_mstate_global->__pyx_CyFunctionType)
#define __Pyx_CyOrPyCFunction_Check(obj)  __Pyx_TypeCheck2(obj, __pyx_mstate_global->__pyx_CyFunctionType, &PyCFunction_Type)
#define __Pyx_CyFunction_CheckExact(obj)  __Pyx_IS_TYPE(obj, __pyx_mstate_global->__pyx_CyFunctionType)
static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void));
#undef __Pyx_IsSameCFunction
#define __Pyx_IsSameCFunction(func, cfunc)   __Pyx__IsSameCyOrCFunction(func, cfunc)
static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml,
                                      int flags, PyObject* qualname,
                                      PyObject *closure,
                                      PyObject *module, PyObject *globals,
                                      PyObject* code);
static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj);
static CYTHON_INLINE PyObject *__Pyx_CyFunction_InitDefaults(PyObject *func,
                                                         PyTypeObject *defaults_type);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
                                                            PyObject *tuple);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
                                                             PyObject *dict);
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
                                                              PyObject *dict);
static int __pyx_CyFunction_init(PyObject *module);
#if CYTHON_METH_FASTCALL
static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
#if CYTHON_COMPILING_IN_LIMITED_API
#define __Pyx_CyFunction_func_vectorcall(f) (((__pyx_CyFunctionObject*)f)->func_vectorcall)
#else
#define __Pyx_CyFunction_func_vectorcall(f) (((PyCFunctionObject*)f)->vectorcall)
#endif
#endif

/* CythonFunction.proto */
static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml,
                                      int flags, PyObject* qualname,
                                      PyObject *closure,
                                      PyObject *module, PyObject *globals,
                                      PyObject* code);

/* unicode_iter.proto */
static CYTHON_INLINE int __Pyx_init_unicode_iteration(
    PyObject* ustring, Py_ssize_t *length, void** data, int *kind);

/* Coroutine.proto (used by CoroutineYieldFrom) */
#define __Pyx_Coroutine_USED
#define __Pyx_Coroutine_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_mstate_global->__pyx_CoroutineType)
#define __Pyx_Coroutine_Check(obj) __Pyx_Coroutine_CheckExact(obj)
#define __Pyx_CoroutineAwait_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_mstate_global->__pyx_CoroutineAwaitType)
#define __Pyx_Coroutine_New(body, code, closure, name, qualname, module_name)\
    __Pyx__Coroutine_New(__pyx_mstate_global->__pyx_CoroutineType, body, code, closure, name, qualname, module_name)
static int __pyx_Coroutine_init(PyObject *module);
static PyObject *__Pyx__Coroutine_await(PyObject *coroutine);
typedef struct {
    PyObject_HEAD
    PyObject *coroutine;
} __pyx_CoroutineAwaitObject;
static __Pyx_PySendResult __Pyx_CoroutineAwait_Close(__pyx_CoroutineAwaitObject *self);

/* Coro_CheckExact.proto (used by GetAwaitIter) */
#if CYTHON_COMPILING_IN_LIMITED_API
static int __Pyx_PyCoro_CheckExact(PyObject *o);
#else
#define __Pyx_PyCoro_CheckExact PyCoro_CheckExact
#endif

/* GetAwaitIter.proto (used by CoroutineYieldFrom) */
static CYTHON_INLINE PyObject *__Pyx_Coroutine_GetAwaitableIter(PyObject *o);
static PyObject *__Pyx__Coroutine_GetAwaitableIter(PyObject *o);

/* CoroutineYieldFrom.proto */
static CYTHON_INLINE __Pyx_PySendResult __Pyx_Coroutine_Yield_From(__pyx_CoroutineObject *gen, PyObject *source, PyObject **retval);

/* KeywordStringCheck.proto */
static CYTHON_INLINE int __Pyx_CheckKeywordStrings(const char* function_name, PyObject *kw);

/* dict_getitem_default.proto */
static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value);

/* StringJoin.proto */
static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values);

/* MergeKeywords.proto */
static int __Pyx_MergeKeywords(PyObject *kwdict, PyObject *source_mapping);

/* PyStopIteration_Check.proto */
#define __Pyx_PyExc_StopIteration_Check(obj)  __Pyx_TypeCheck(obj, PyExc_StopIteration)

/* set_iter.proto */
static CYTHON_INLINE PyObject* __Pyx_set_iterator(PyObject* iterable, int is_set,
                                                  Py_ssize_t* p_orig_length, int* p_source_is_set);
static CYTHON_INLINE int __Pyx_set_iter_next(
        PyObject* iter_obj, Py_ssize_t orig_length,
        Py_ssize_t* ppos, PyObject **value,
        int source_is_set);

/* PyNotImplementedError_Check.proto */
#define __Pyx_PyExc_NotImplementedError_Check(obj)  __Pyx_TypeCheck(obj, PyExc_NotImplementedError)

/* CIntToPyUnicode.proto */
#define __Pyx_PyUnicode_From_xmlXPathObjectType(value, width, padding_char, format_char) (\
    ((format_char) == ('c')) ?\
        __Pyx_uchar___Pyx_PyUnicode_From_xmlXPathObjectType(value, width, padding_char) :\
        __Pyx____Pyx_PyUnicode_From_xmlXPathObjectType(value, width, padding_char, format_char)\
    )
static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_xmlXPathObjectType(xmlXPathObjectType value, Py_ssize_t width, char padding_char);
static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_xmlXPathObjectType(xmlXPathObjectType value, Py_ssize_t width, char padding_char, char format_char);

/* AllocateExtensionType.proto */
static PyObject *__Pyx_AllocateExtensionType(PyTypeObject *t, int is_final);

/* CheckTypeForFreelists.proto */
#if CYTHON_USE_FREELISTS
#if CYTHON_USE_TYPE_SPECS
#define __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, expected_tp, expected_size) ((int) ((t) == (expected_tp)))
#define __PYX_CHECK_TYPE_FOR_FREELIST_FLAGS  Py_TPFLAGS_IS_ABSTRACT
#else
#define __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, expected_tp, expected_size) ((int) ((t)->tp_basicsize == (expected_size)))
#define __PYX_CHECK_TYPE_FOR_FREELIST_FLAGS  (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)
#endif
#define __PYX_CHECK_TYPE_FOR_FREELISTS(t, expected_tp, expected_size)\
    (__PYX_CHECK_FINAL_TYPE_FOR_FREELISTS((t), (expected_tp), (expected_size)) &\
     (int) (!__Pyx_PyType_HasFeature((t), __PYX_CHECK_TYPE_FOR_FREELIST_FLAGS)))
#endif

/* CallNextTpTraverse.proto */
static int __Pyx_call_next_tp_traverse(PyObject* obj, visitproc v, void *a, traverseproc current_tp_traverse);

/* CallNextTpClear.proto */
static void __Pyx_call_next_tp_clear(PyObject* obj, inquiry current_tp_clear);

/* FunctionExport.proto */
static int __Pyx_ExportFunction(PyObject *api_dict, const char *name, void (*f)(void), const char *sig);

/* GetApiDict.proto */
static PyObject *__Pyx_ApiExport_GetApiDict(void);

/* FormatTypeName.proto (used by ValidateExternBase) */
#if CYTHON_COMPILING_IN_LIMITED_API
typedef PyObject *__Pyx_TypeName;
#define __Pyx_FMT_TYPENAME "%U"
#define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj)
#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
#define __Pyx_PyType_GetFullyQualifiedName PyType_GetFullyQualifiedName
#else
static __Pyx_TypeName __Pyx_PyType_GetFullyQualifiedName(PyTypeObject* tp);
#endif
#else  // !LIMITED_API
typedef const char *__Pyx_TypeName;
#define __Pyx_FMT_TYPENAME "%.200s"
#define __Pyx_PyType_GetFullyQualifiedName(tp) ((tp)->tp_name)
#define __Pyx_DECREF_TypeName(obj)
#endif

/* ValidateExternBase.proto */
static int __Pyx_validate_extern_base(PyTypeObject *base);

/* ValidateBasesTuple.proto (used by PyType_Ready) */
#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS
static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases);
#endif

/* PyType_Ready.proto */
CYTHON_UNUSED static int __Pyx_PyType_Ready(PyTypeObject *t);

/* SetVTable.proto */
static int __Pyx_SetVtable(PyTypeObject* typeptr , void* vtable);

/* GetVTable.proto (used by MergeVTables) */
static void* __Pyx_GetVtable(PyTypeObject *type);

/* MergeVTables.proto */
static int __Pyx_MergeVtables(PyTypeObject *type);

/* DelItemOnTypeDict.proto (used by SetupReduce) */
static int __Pyx__DelItemOnTypeDict(PyTypeObject *tp, PyObject *k);
#define __Pyx_DelItemOnTypeDict(tp, k) __Pyx__DelItemOnTypeDict((PyTypeObject*)tp, k)

/* SetupReduce.proto */
static int __Pyx_setup_reduce(PyObject* type_obj);

/* TypeImport.proto */
#ifndef __PYX_HAVE_RT_ImportType_proto_3_2_4
#define __PYX_HAVE_RT_ImportType_proto_3_2_4
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
#include <stdalign.h>
#endif
#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || __cplusplus >= 201103L
#define __PYX_GET_STRUCT_ALIGNMENT_3_2_4(s) alignof(s)
#else
#define __PYX_GET_STRUCT_ALIGNMENT_3_2_4(s) sizeof(void*)
#endif
enum __Pyx_ImportType_CheckSize_3_2_4 {
   __Pyx_ImportType_CheckSize_Error_3_2_4 = 0,
   __Pyx_ImportType_CheckSize_Warn_3_2_4 = 1,
   __Pyx_ImportType_CheckSize_Ignore_3_2_4 = 2
};
static PyTypeObject *__Pyx_ImportType_3_2_4(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_2_4 check_size);
#endif

/* ListPack.proto */
static PyObject *__Pyx_PyList_Pack(Py_ssize_t n, ...);

/* Py3UpdateBases.proto */
static PyObject* __Pyx_PEP560_update_bases(PyObject *bases);

/* CalculateMetaclass.proto */
static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases);

/* SetNameInClass.proto */
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000
#define __Pyx_SetNameInClass(ns, name, value)\
    (likely(PyDict_CheckExact(ns)) ? _PyDict_SetItem_KnownHash(ns, name, value, ((PyASCIIObject *) name)->hash) : PyObject_SetItem(ns, name, value))
#elif CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_SetNameInClass(ns, name, value)\
    (likely(PyDict_CheckExact(ns)) ? PyDict_SetItem(ns, name, value) : PyObject_SetItem(ns, name, value))
#else
#define __Pyx_SetNameInClass(ns, name, value)  PyObject_SetItem(ns, name, value)
#endif

/* Py3ClassCreate.proto */
static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname,
                                           PyObject *mkw, PyObject *modname, PyObject *doc);
static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict,
                                      PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass);

/* PySyntaxError_Check.proto */
#define __Pyx_PyExc_SyntaxError_Check(obj)  __Pyx_TypeCheck(obj, PyExc_SyntaxError)

/* SetNewInClass.proto */
static int __Pyx_SetNewInClass(PyObject *ns, PyObject *name, PyObject *value);

/* PyImportError_Check.proto */
#define __Pyx_PyExc_ImportError_Check(obj)  __Pyx_TypeCheck(obj, PyExc_ImportError)

/* ClassMethod.proto */
#if !CYTHON_COMPILING_IN_LIMITED_API
#include "descrobject.h"
#endif
CYTHON_UNUSED static PyObject* __Pyx_Method_ClassMethod(PyObject *method);

/* GetNameInClass.proto */
#define __Pyx_GetNameInClass(var, nmspace, name)  (var) = __Pyx__GetNameInClass(nmspace, name)
static PyObject *__Pyx__GetNameInClass(PyObject *nmspace, PyObject *name);

/* RegisterModuleCleanup.proto */
static void __pyx_module_cleanup(PyObject *self);
#if CYTHON_COMPILING_IN_PYPY
static int __Pyx_RegisterCleanup(void);
#else
#define __Pyx_RegisterCleanup() (0)
#endif

/* CLineInTraceback.proto (used by AddTraceback) */
#if CYTHON_CLINE_IN_TRACEBACK && CYTHON_CLINE_IN_TRACEBACK_RUNTIME
static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
#else
#define __Pyx_CLineForTraceback(tstate, c_line)  (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
#endif

/* CodeObjectCache.proto (used by AddTraceback) */
#if CYTHON_COMPILING_IN_LIMITED_API
typedef PyObject __Pyx_CachedCodeObjectType;
#else
typedef PyCodeObject __Pyx_CachedCodeObjectType;
#endif
typedef struct {
    __Pyx_CachedCodeObjectType* code_object;
    int code_line;
} __Pyx_CodeObjectCacheEntry;
struct __Pyx_CodeObjectCache {
    int count;
    int max_count;
    __Pyx_CodeObjectCacheEntry* entries;
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    __pyx_atomic_int_type accessor_count;
  #endif
};
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
static __Pyx_CachedCodeObjectType *__pyx_find_code_object(int code_line);
static void __pyx_insert_code_object(int code_line, __Pyx_CachedCodeObjectType* code_object);

/* AddTraceback.proto */
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename);

/* BufferStructDeclare.proto */
typedef struct {
  Py_ssize_t shape, strides, suboffsets;
} __Pyx_Buf_DimInfo;
typedef struct {
  size_t refcount;
  Py_buffer pybuffer;
} __Pyx_Buffer;
typedef struct {
  __Pyx_Buffer *rcbuffer;
  char *data;
  __Pyx_Buf_DimInfo diminfo[8];
} __Pyx_LocalBuf_ND;

/* MemviewRefcount.proto */
static CYTHON_INLINE int __pyx_add_acquisition_count_locked(
    __pyx_atomic_int_type *acquisition_count, PyThread_type_lock lock);
static CYTHON_INLINE int __pyx_sub_acquisition_count_locked(
    __pyx_atomic_int_type *acquisition_count, PyThread_type_lock lock);
#define __pyx_get_slice_count_pointer(memview) (&memview->acquisition_count)
#define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__)
#define __PYX_XCLEAR_MEMVIEW(slice, have_gil) __Pyx_XCLEAR_MEMVIEW(slice, have_gil, __LINE__)
static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int);
static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *, int, int);

/* MemviewSliceIsContig.proto */
static int __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim);

/* OverlappingSlices.proto */
static int __pyx_slices_overlap(__Pyx_memviewslice *slice1,
                                __Pyx_memviewslice *slice2,
                                int ndim, size_t itemsize);

/* MemviewSliceInit.proto */
static int __Pyx_init_memviewslice(
                struct __pyx_memoryview_obj *memview,
                int ndim,
                __Pyx_memviewslice *memviewslice,
                int memview_is_new_reference);

/* IsLittleEndian.proto (used by BufferFormatCheck) */
static CYTHON_INLINE int __Pyx_Is_Little_Endian(void);

/* BufferFormatCheck.proto (used by MemviewSliceValidateAndInit) */
static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts);
static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
                              __Pyx_BufFmt_StackElem* stack,
                              const __Pyx_TypeInfo* type);

/* TypeInfoCompare.proto (used by MemviewSliceValidateAndInit) */
static int __pyx_typeinfo_cmp(const __Pyx_TypeInfo *a, const __Pyx_TypeInfo *b);

/* MemviewSliceValidateAndInit.export */
static int __Pyx_ValidateAndInit_memviewslice(
                int *axes_specs,
                int c_or_f_flag,
                int buf_flags,
                int ndim,
                const __Pyx_TypeInfo *dtype,
                __Pyx_BufFmt_StackElem stack[],
                __Pyx_memviewslice *memviewslice,
                PyObject *original_obj);

/* ObjectToMemviewSlice.proto */
static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_char__const__(PyObject *, int writable_flag);

/* MemviewDtypeToObject.proto */
static CYTHON_INLINE PyObject *__pyx_memview_get_unsigned_char__const__(const char *itemp);

/* UnicodeAsUCS4.proto */
static CYTHON_INLINE Py_UCS4 __Pyx_PyUnicode_AsPy_UCS4(PyObject*);

/* MemviewSliceCopy.proto */
static __Pyx_memviewslice
__pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
                                 const char *mode, int ndim,
                                 size_t sizeof_dtype, int contig_flag,
                                 int dtype_is_object);

/* CIntFromPy.proto */
static CYTHON_INLINE int __Pyx_PyLong_As_int(PyObject *);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_xmlParserErrors(xmlParserErrors value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_int(int value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_xmlFeature(xmlFeature value);

/* CIntFromPy.proto */
static CYTHON_INLINE xmlFeature __Pyx_PyLong_As_xmlFeature(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE size_t __Pyx_PyLong_As_size_t(PyObject *);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value);

/* CIntFromPy.proto */
static CYTHON_INLINE unsigned int __Pyx_PyLong_As_unsigned_int(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE unsigned char __Pyx_PyLong_As_unsigned_char(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE unsigned short __Pyx_PyLong_As_unsigned_short(PyObject *);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_char(char value);

/* CIntFromPy.proto */
static CYTHON_INLINE xmlChar __Pyx_PyLong_As_xmlChar(PyObject *);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_xmlErrorDomain(xmlErrorDomain value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_xmlErrorLevel(xmlErrorLevel value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_unsigned_char(unsigned char value);

/* BytesContains.proto */
static CYTHON_INLINE int __Pyx_BytesContains(PyObject* bytes, char character);

/* ObjectAsUCS4.proto */
static Py_UCS4 __Pyx__PyObject_AsPy_UCS4(PyObject*);
static CYTHON_INLINE Py_UCS4 __Pyx_PyObject_AsPy_UCS4(PyObject *x) {
    return (likely(PyUnicode_Check(x)) ? __Pyx_PyUnicode_AsPy_UCS4(x) : __Pyx__PyObject_AsPy_UCS4(x));
}

/* UpdateUnpickledDict.proto */
static int __Pyx_UpdateUnpickledDict(PyObject *obj, PyObject *state, Py_ssize_t index);

/* CheckUnpickleChecksum.proto */
static CYTHON_INLINE int __Pyx_CheckUnpickleChecksum(long checksum, long checksum1, long checksum2, long checksum3, const char *members);

/* CIntFromPy.proto */
static CYTHON_INLINE long __Pyx_PyLong_As_long(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE char __Pyx_PyLong_As_char(PyObject *);

/* GetRuntimeVersion.proto */
#if __PYX_LIMITED_VERSION_HEX < 0x030b0000
static unsigned long __Pyx_cached_runtime_version = 0;
static void __Pyx_init_runtime_version(void);
#else
#define __Pyx_init_runtime_version()
#endif
static unsigned long __Pyx_get_runtime_version(void);

/* CheckBinaryVersion.proto */
static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer);

/* DecompressString.proto */
static PyObject *__Pyx_DecompressString(const char *s, Py_ssize_t length, int algo);

/* MultiPhaseInitModuleState.proto */
#if CYTHON_PEP489_MULTI_PHASE_INIT && CYTHON_USE_MODULE_STATE
static PyObject *__Pyx_State_FindModule(void*);
static int __Pyx_State_AddModule(PyObject* module, void*);
static int __Pyx_State_RemoveModule(void*);
#elif CYTHON_USE_MODULE_STATE
#define __Pyx_State_FindModule PyState_FindModule
#define __Pyx_State_AddModule PyState_AddModule
#define __Pyx_State_RemoveModule PyState_RemoveModule
#endif

/* #### Code section: module_declarations ### */
/* CythonABIVersion.proto */
#if CYTHON_COMPILING_IN_LIMITED_API
    #if CYTHON_METH_FASTCALL
        #define __PYX_FASTCALL_ABI_SUFFIX  "_fastcall"
    #else
        #define __PYX_FASTCALL_ABI_SUFFIX
    #endif
    #define __PYX_LIMITED_ABI_SUFFIX "limited" __PYX_FASTCALL_ABI_SUFFIX __PYX_AM_SEND_ABI_SUFFIX
#else
    #define __PYX_LIMITED_ABI_SUFFIX
#endif
#if __PYX_HAS_PY_AM_SEND == 1
    #define __PYX_AM_SEND_ABI_SUFFIX
#elif __PYX_HAS_PY_AM_SEND == 2
    #define __PYX_AM_SEND_ABI_SUFFIX "amsendbackport"
#else
    #define __PYX_AM_SEND_ABI_SUFFIX "noamsend"
#endif
#ifndef __PYX_MONITORING_ABI_SUFFIX
    #define __PYX_MONITORING_ABI_SUFFIX
#endif
#if CYTHON_USE_TP_FINALIZE
    #define __PYX_TP_FINALIZE_ABI_SUFFIX
#else
    #define __PYX_TP_FINALIZE_ABI_SUFFIX "nofinalize"
#endif
#if CYTHON_USE_FREELISTS || !defined(__Pyx_AsyncGen_USED)
    #define __PYX_FREELISTS_ABI_SUFFIX
#else
    #define __PYX_FREELISTS_ABI_SUFFIX "nofreelists"
#endif
#define CYTHON_ABI  __PYX_ABI_VERSION __PYX_LIMITED_ABI_SUFFIX __PYX_MONITORING_ABI_SUFFIX __PYX_TP_FINALIZE_ABI_SUFFIX __PYX_FREELISTS_ABI_SUFFIX __PYX_AM_SEND_ABI_SUFFIX
#define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI
#define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "."

static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self); /* proto*/
static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto*/
static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj); /* proto*/
static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src); /* proto*/
static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value); /* proto*/
static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto*/
static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/
static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/
static PyObject *__pyx_memoryview__get_base(struct __pyx_memoryview_obj *__pyx_v_self); /* proto*/
static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/
static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/
static PyObject *__pyx_memoryviewslice__get_base(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto*/
static int __pyx_f_4lxml_5etree_10_TempStore_add(struct __pyx_obj_4lxml_5etree__TempStore *__pyx_v_self, PyObject *__pyx_v_obj); /* proto*/
static int __pyx_f_4lxml_5etree_10_TempStore_clear(struct __pyx_obj_4lxml_5etree__TempStore *__pyx_v_self); /* proto*/
static int __pyx_f_4lxml_5etree_17_ExceptionContext_clear(struct __pyx_obj_4lxml_5etree__ExceptionContext *__pyx_v_self); /* proto*/
static void __pyx_f_4lxml_5etree_17_ExceptionContext__store_raised(struct __pyx_obj_4lxml_5etree__ExceptionContext *__pyx_v_self); /* proto*/
static int __pyx_f_4lxml_5etree_17_ExceptionContext__store_exception(struct __pyx_obj_4lxml_5etree__ExceptionContext *__pyx_v_self, PyObject *__pyx_v_exception); /* proto*/
static int __pyx_f_4lxml_5etree_17_ExceptionContext__has_raised(struct __pyx_obj_4lxml_5etree__ExceptionContext *__pyx_v_self); /* proto*/
static int __pyx_f_4lxml_5etree_17_ExceptionContext__raise_if_stored(struct __pyx_obj_4lxml_5etree__ExceptionContext *__pyx_v_self); /* proto*/
static int __pyx_f_4lxml_5etree_9_LogEntry__setError(struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_self, xmlError const *__pyx_v_error); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_9_LogEntry__setGeneric(struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_self, int __pyx_v_domain, int __pyx_v_type, int __pyx_v_level, long __pyx_v_line, PyObject *__pyx_v_message, PyObject *__pyx_v_filename); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_13_BaseErrorLog_copy(struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_13_BaseErrorLog_receive(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_self, CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_entry, int __pyx_skip_dispatch); /* proto*/
static int __pyx_f_4lxml_5etree_13_BaseErrorLog__receive(struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_self, xmlError const *__pyx_v_error); /* proto*/
static int __pyx_f_4lxml_5etree_13_BaseErrorLog__receiveGeneric(struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_self, int __pyx_v_domain, int __pyx_v_type, int __pyx_v_level, long __pyx_v_line, PyObject *__pyx_v_message, PyObject *__pyx_v_filename); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_13_BaseErrorLog__buildParseException(struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_self, PyObject *__pyx_v_exctype, PyObject *__pyx_v_default_message); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_13_BaseErrorLog__buildExceptionMessage(struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_self, PyObject *__pyx_v_default_message); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_13_ListErrorLog_copy(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static int __pyx_f_4lxml_5etree_16_ErrorLogContext_push_error_log(struct __pyx_obj_4lxml_5etree__ErrorLogContext *__pyx_v_self, struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_log); /* proto*/
static int __pyx_f_4lxml_5etree_16_ErrorLogContext_pop_error_log(struct __pyx_obj_4lxml_5etree__ErrorLogContext *__pyx_v_self); /* proto*/
static int __pyx_f_4lxml_5etree_9_ErrorLog___enter__(struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_self); /* proto*/
static int __pyx_f_4lxml_5etree_9_ErrorLog_connect(struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_self); /* proto*/
static int __pyx_f_4lxml_5etree_9_ErrorLog_disconnect(struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_9_ErrorLog_clear(struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_9_ErrorLog_copy(struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_9_ErrorLog_receive(struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_self, struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_entry, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_15_DomainErrorLog_receive(struct __pyx_obj_4lxml_5etree__DomainErrorLog *__pyx_v_self, struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_entry, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_17_RotatingErrorLog_receive(struct __pyx_obj_4lxml_5etree__RotatingErrorLog *__pyx_v_self, struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_entry, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_10PyErrorLog_copy(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree_PyErrorLog *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_10PyErrorLog_receive(struct __pyx_obj_4lxml_5etree_PyErrorLog *__pyx_v_self, struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_log_entry, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_9_Document_getroot(struct LxmlDocument *__pyx_v_self); /* proto*/
static int __pyx_f_4lxml_5etree_9_Document_hasdoctype(struct LxmlDocument *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_9_Document_getdoctype(struct LxmlDocument *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_9_Document_getxmlinfo(struct LxmlDocument *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_9_Document_isstandalone(struct LxmlDocument *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_9_Document_buildNewPrefix(struct LxmlDocument *__pyx_v_self); /* proto*/
static xmlNs *__pyx_f_4lxml_5etree_9_Document__findOrBuildNodeNs(struct LxmlDocument *__pyx_v_self, xmlNode *__pyx_v_c_node, const xmlChar *__pyx_v_c_href, const xmlChar *__pyx_v_c_prefix, int __pyx_v_is_attribute); /* proto*/
static int __pyx_f_4lxml_5etree_9_Document__setNodeNs(struct LxmlDocument *__pyx_v_self, xmlNode *__pyx_v_c_node, const xmlChar *__pyx_v_c_href); /* proto*/
static xmlDtd *__pyx_f_4lxml_5etree_7DocInfo__get_c_dtd(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self); /* proto*/
static int __pyx_f_4lxml_5etree_20__ContentOnlyElement__raiseImmutable(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree___ContentOnlyElement *__pyx_v_self); /* proto*/
static int __pyx_f_4lxml_5etree_12_ElementTree__assertHasRoot(struct LxmlElementTree *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_18_ElementTagMatcher__initTagMatch(struct LxmlElementTagMatcher *__pyx_v_self, PyObject *__pyx_v_tag); /* proto*/
static void __pyx_f_4lxml_5etree_16_ElementIterator__storeNext(struct LxmlElementIterator *__pyx_v_self, struct LxmlElement *__pyx_v_node); /* proto*/
static int __pyx_f_4lxml_5etree_16_MultiTagMatcher_rejectsAll(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *__pyx_v_self); /* proto*/
static int __pyx_f_4lxml_5etree_16_MultiTagMatcher_rejectsAllAttributes(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *__pyx_v_self); /* proto*/
static int __pyx_f_4lxml_5etree_16_MultiTagMatcher_matchesType(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *__pyx_v_self, int __pyx_v_node_type); /* proto*/
static void __pyx_f_4lxml_5etree_16_MultiTagMatcher__clear(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_16_MultiTagMatcher_initTagMatch(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *__pyx_v_self, PyObject *__pyx_v_tags); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_16_MultiTagMatcher__storeTags(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_seen); /* proto*/
static CYTHON_INLINE int __pyx_f_4lxml_5etree_16_MultiTagMatcher_cacheTags(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *__pyx_v_self, struct LxmlDocument *__pyx_v_doc, struct __pyx_opt_args_4lxml_5etree_16_MultiTagMatcher_cacheTags *__pyx_optional_args); /* proto*/
static CYTHON_INLINE int __pyx_f_4lxml_5etree_16_MultiTagMatcher_matches(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *__pyx_v_self, xmlNode *__pyx_v_c_node); /* proto*/
static CYTHON_INLINE int __pyx_f_4lxml_5etree_16_MultiTagMatcher_matchesNsTag(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *__pyx_v_self, const xmlChar *__pyx_v_c_href, const xmlChar *__pyx_v_c_name); /* proto*/
static CYTHON_INLINE int __pyx_f_4lxml_5etree_16_MultiTagMatcher_matchesAttribute(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *__pyx_v_self, xmlAttr *__pyx_v_c_attr); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_21_ElementMatchIterator__initTagMatcher(struct __pyx_obj_4lxml_5etree__ElementMatchIterator *__pyx_v_self, PyObject *__pyx_v_tags); /* proto*/
static int __pyx_f_4lxml_5etree_21_ElementMatchIterator__storeNext(struct __pyx_obj_4lxml_5etree__ElementMatchIterator *__pyx_v_self, struct LxmlElement *__pyx_v_node); /* proto*/
static xmlNode *__pyx_f_4lxml_5etree_25ElementDepthFirstIterator__nextNodeAnyTag(struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *__pyx_v_self, xmlNode *__pyx_v_c_node); /* proto*/
static xmlNode *__pyx_f_4lxml_5etree_25ElementDepthFirstIterator__nextNodeMatchTag(struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *__pyx_v_self, xmlNode *__pyx_v_c_node); /* proto*/
static int __pyx_f_4lxml_5etree_14_ReadOnlyProxy__assertNode(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self); /* proto*/
static int __pyx_f_4lxml_5etree_14_ReadOnlyProxy__raise_unsupported_type(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self); /* proto*/
static void __pyx_f_4lxml_5etree_14_ReadOnlyProxy_free_after_use(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_14_ReadOnlyProxy___copy__(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_14_ReadOnlyProxy_getchildren(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static int __pyx_f_4lxml_5etree_22_OpaqueDocumentWrapper__assertNode(struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_22_OpaqueDocumentWrapper_append(struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper *__pyx_v_self, PyObject *__pyx_v_other_element, CYTHON_UNUSED int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_23_AppendOnlyElementProxy_append(struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *__pyx_v_self, PyObject *__pyx_v_other_element, CYTHON_UNUSED int __pyx_skip_dispatch); /* proto*/
static void __pyx_f_4lxml_5etree_26FallbackElementClassLookup__setFallback(struct LxmlFallbackElementClassLookup *__pyx_v_self, struct LxmlElementClassLookup *__pyx_v_lookup); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_18_NamespaceRegistry__get(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *__pyx_v_self, PyObject *__pyx_v_name); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_18_NamespaceRegistry__getForString(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *__pyx_v_self, char *__pyx_v_name); /* proto*/
static struct __pyx_obj_4lxml_5etree__ResolverRegistry *__pyx_f_4lxml_5etree_17_ResolverRegistry__copy(struct __pyx_obj_4lxml_5etree__ResolverRegistry *__pyx_v_self); /* proto*/
static int __pyx_f_4lxml_5etree_16_ResolverContext_clear(struct __pyx_obj_4lxml_5etree__ResolverContext *__pyx_v_self); /* proto*/
static int __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initMainParserContext(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self); /* proto*/
static struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_f_4lxml_5etree_24_ParserDictionaryContext__findThreadParserContext(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self); /* proto*/
static int __pyx_f_4lxml_5etree_24_ParserDictionaryContext_setDefaultParser(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser); /* proto*/
static struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_f_4lxml_5etree_24_ParserDictionaryContext_getDefaultParser(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self); /* proto*/
static xmlDict *__pyx_f_4lxml_5etree_24_ParserDictionaryContext__getThreadDict(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self, xmlDict *__pyx_v_default); /* proto*/
static int __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initThreadDictRef(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self, xmlDict **__pyx_v_c_dict_ref); /* proto*/
static int __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initParserDict(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self, xmlParserCtxt *__pyx_v_pctxt); /* proto*/
static int __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initXPathParserDict(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self, xmlXPathContext *__pyx_v_pctxt); /* proto*/
static int __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initDocDict(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self, xmlDoc *__pyx_v_result); /* proto*/
static struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_f_4lxml_5etree_24_ParserDictionaryContext_findImpliedContext(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self); /* proto*/
static int __pyx_f_4lxml_5etree_24_ParserDictionaryContext_pushImpliedContextFromParser(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser); /* proto*/
static int __pyx_f_4lxml_5etree_24_ParserDictionaryContext_pushImpliedContext(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self, struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_parser_context); /* proto*/
static int __pyx_f_4lxml_5etree_24_ParserDictionaryContext_popImpliedContext(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_18_FileReaderContext__close_file(struct __pyx_obj_4lxml_5etree__FileReaderContext *__pyx_v_self); /* proto*/
static xmlParserInputBuffer *__pyx_f_4lxml_5etree_18_FileReaderContext__createParserInputBuffer(struct __pyx_obj_4lxml_5etree__FileReaderContext *__pyx_v_self); /* proto*/
static xmlParserInput *__pyx_f_4lxml_5etree_18_FileReaderContext__createParserInput(struct __pyx_obj_4lxml_5etree__FileReaderContext *__pyx_v_self, xmlParserCtxt *__pyx_v_ctxt); /* proto*/
static xmlDtd *__pyx_f_4lxml_5etree_18_FileReaderContext__readDtd(struct __pyx_obj_4lxml_5etree__FileReaderContext *__pyx_v_self); /* proto*/
static xmlDoc *__pyx_f_4lxml_5etree_18_FileReaderContext__readDoc(struct __pyx_obj_4lxml_5etree__FileReaderContext *__pyx_v_self, xmlParserCtxt *__pyx_v_ctxt, int __pyx_v_options); /* proto*/
static int __pyx_f_4lxml_5etree_18_FileReaderContext_copyToBuffer(struct __pyx_obj_4lxml_5etree__FileReaderContext *__pyx_v_self, char *__pyx_v_c_buffer, int __pyx_v_c_requested); /* proto*/
static struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_f_4lxml_5etree_14_ParserContext__copy(struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_self); /* proto*/
static void __pyx_f_4lxml_5etree_14_ParserContext__initParserContext(struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_self, xmlParserCtxt *__pyx_v_c_ctxt); /* proto*/
static void __pyx_f_4lxml_5etree_14_ParserContext__resetParserContext(struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_self); /* proto*/
static int __pyx_f_4lxml_5etree_14_ParserContext_prepare(struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_self, struct __pyx_opt_args_4lxml_5etree_14_ParserContext_prepare *__pyx_optional_args); /* proto*/
static int __pyx_f_4lxml_5etree_14_ParserContext_cleanup(struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_14_ParserContext__handleParseResult(struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_self, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser, xmlDoc *__pyx_v_result, PyObject *__pyx_v_filename); /* proto*/
static xmlDoc *__pyx_f_4lxml_5etree_14_ParserContext__handleParseResultDoc(struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_self, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser, xmlDoc *__pyx_v_result, PyObject *__pyx_v_filename); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_11_BaseParser__setBaseURL(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self, PyObject *__pyx_v_base_url); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_11_BaseParser__collectEvents(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self, PyObject *__pyx_v_event_types, PyObject *__pyx_v_tag); /* proto*/
static struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_f_4lxml_5etree_11_BaseParser__getParserContext(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self); /* proto*/
static struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_f_4lxml_5etree_11_BaseParser__getPushParserContext(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self); /* proto*/
static struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_f_4lxml_5etree_11_BaseParser__createContext(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self, PyObject *__pyx_v_target, PyObject *__pyx_v_events_to_collect); /* proto*/
static int __pyx_f_4lxml_5etree_11_BaseParser__configureSaxContext(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self, xmlParserCtxt *__pyx_v_pctxt); /* proto*/
static int __pyx_f_4lxml_5etree_11_BaseParser__registerHtmlErrorHandler(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self, xmlParserCtxt *__pyx_v_c_ctxt); /* proto*/
static xmlParserCtxt *__pyx_f_4lxml_5etree_11_BaseParser__newParserCtxt(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self); /* proto*/
static xmlParserCtxt *__pyx_f_4lxml_5etree_11_BaseParser__newPushParserCtxt(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self); /* proto*/
static struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_f_4lxml_5etree_11_BaseParser__copy(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self); /* proto*/
static xmlDoc *__pyx_f_4lxml_5etree_11_BaseParser__parseUnicodeDoc(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self, PyObject *__pyx_v_utext, char *__pyx_v_c_filename); /* proto*/
static xmlDoc *__pyx_f_4lxml_5etree_11_BaseParser__parseDoc(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self, char const *__pyx_v_c_text, int __pyx_v_c_len, char *__pyx_v_c_filename); /* proto*/
static xmlDoc *__pyx_f_4lxml_5etree_11_BaseParser__parseDocFromFile(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self, char *__pyx_v_c_filename); /* proto*/
static xmlDoc *__pyx_f_4lxml_5etree_11_BaseParser__parseDocFromFilelike(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self, PyObject *__pyx_v_filelike, PyObject *__pyx_v_filename, PyObject *__pyx_v_encoding); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_11_FeedParser_feed(struct __pyx_obj_4lxml_5etree__FeedParser *__pyx_v_self, PyObject *__pyx_v_data, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_11_FeedParser_close(struct __pyx_obj_4lxml_5etree__FeedParser *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_16_SaxParserTarget__handleSaxStart(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__SaxParserTarget *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_tag, CYTHON_UNUSED PyObject *__pyx_v_attrib, CYTHON_UNUSED PyObject *__pyx_v_nsmap); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_16_SaxParserTarget__handleSaxEnd(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__SaxParserTarget *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_tag); /* proto*/
static int __pyx_f_4lxml_5etree_16_SaxParserTarget__handleSaxData(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__SaxParserTarget *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_data); /* proto*/
static int __pyx_f_4lxml_5etree_16_SaxParserTarget__handleSaxDoctype(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__SaxParserTarget *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_root_tag, CYTHON_UNUSED PyObject *__pyx_v_public_id, CYTHON_UNUSED PyObject *__pyx_v_system_id); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_16_SaxParserTarget__handleSaxPi(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__SaxParserTarget *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_target, CYTHON_UNUSED PyObject *__pyx_v_data); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_16_SaxParserTarget__handleSaxComment(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__SaxParserTarget *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_comment); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_16_SaxParserTarget__handleSaxStartNs(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__SaxParserTarget *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_prefix, CYTHON_UNUSED PyObject *__pyx_v_uri); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_16_SaxParserTarget__handleSaxEndNs(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__SaxParserTarget *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_prefix); /* proto*/
static void __pyx_f_4lxml_5etree_17_SaxParserContext__setSaxParserTarget(struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_self, struct __pyx_obj_4lxml_5etree__SaxParserTarget *__pyx_v_target); /* proto*/
static void __pyx_f_4lxml_5etree_17_SaxParserContext__initParserContext(struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_self, xmlParserCtxt *__pyx_v_c_ctxt); /* proto*/
static void __pyx_f_4lxml_5etree_17_SaxParserContext__connectTarget(struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_self, xmlParserCtxt *__pyx_v_c_ctxt); /* proto*/
static void __pyx_f_4lxml_5etree_17_SaxParserContext__connectEvents(struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_self, xmlParserCtxt *__pyx_v_c_ctxt); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_17_SaxParserContext__setEventFilter(struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_self, PyObject *__pyx_v_events, PyObject *__pyx_v_tag); /* proto*/
static int __pyx_f_4lxml_5etree_17_SaxParserContext_startDocument(struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_self, xmlDoc *__pyx_v_c_doc); /* proto*/
static int __pyx_f_4lxml_5etree_17_SaxParserContext_pushEvent(struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_self, PyObject *__pyx_v_event, xmlNode *__pyx_v_c_node); /* proto*/
static int __pyx_f_4lxml_5etree_17_SaxParserContext_flushEvents(struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_self); /* proto*/
static void __pyx_f_4lxml_5etree_17_SaxParserContext__handleSaxException(struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_self, xmlParserCtxt *__pyx_v_c_ctxt); /* proto*/
static int __pyx_f_4lxml_5etree_11TreeBuilder__flush(struct __pyx_obj_4lxml_5etree_TreeBuilder *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_11TreeBuilder__handleSaxStart(struct __pyx_obj_4lxml_5etree_TreeBuilder *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_attrib, PyObject *__pyx_v_nsmap); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_11TreeBuilder__handleSaxEnd(struct __pyx_obj_4lxml_5etree_TreeBuilder *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_tag); /* proto*/
static int __pyx_f_4lxml_5etree_11TreeBuilder__handleSaxData(struct __pyx_obj_4lxml_5etree_TreeBuilder *__pyx_v_self, PyObject *__pyx_v_data); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_11TreeBuilder__handleSaxPi(struct __pyx_obj_4lxml_5etree_TreeBuilder *__pyx_v_self, PyObject *__pyx_v_target, PyObject *__pyx_v_data); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_11TreeBuilder__handleSaxComment(struct __pyx_obj_4lxml_5etree_TreeBuilder *__pyx_v_self, PyObject *__pyx_v_comment); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxStart(struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_attrib, PyObject *__pyx_v_nsmap); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxEnd(struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *__pyx_v_self, PyObject *__pyx_v_tag); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxStartNs(struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *__pyx_v_self, PyObject *__pyx_v_prefix, PyObject *__pyx_v_uri); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxEndNs(struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *__pyx_v_self, PyObject *__pyx_v_prefix); /* proto*/
static int __pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxData(struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *__pyx_v_self, PyObject *__pyx_v_data); /* proto*/
static int __pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxDoctype(struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *__pyx_v_self, PyObject *__pyx_v_root_tag, PyObject *__pyx_v_public_id, PyObject *__pyx_v_system_id); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxPi(struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *__pyx_v_self, PyObject *__pyx_v_target, PyObject *__pyx_v_data); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxComment(struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *__pyx_v_self, PyObject *__pyx_v_comment); /* proto*/
static int __pyx_f_4lxml_5etree_20_TargetParserContext__setTarget(struct __pyx_obj_4lxml_5etree__TargetParserContext *__pyx_v_self, PyObject *__pyx_v_target); /* proto*/
static struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_f_4lxml_5etree_20_TargetParserContext__copy(struct __pyx_obj_4lxml_5etree__TargetParserContext *__pyx_v_self); /* proto*/
static void __pyx_f_4lxml_5etree_20_TargetParserContext__cleanupTargetParserContext(struct __pyx_obj_4lxml_5etree__TargetParserContext *__pyx_v_self, xmlDoc *__pyx_v_result); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_20_TargetParserContext__handleParseResult(struct __pyx_obj_4lxml_5etree__TargetParserContext *__pyx_v_self, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser, xmlDoc *__pyx_v_result, PyObject *__pyx_v_filename); /* proto*/
static xmlDoc *__pyx_f_4lxml_5etree_20_TargetParserContext__handleParseResultDoc(struct __pyx_obj_4lxml_5etree__TargetParserContext *__pyx_v_self, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser, xmlDoc *__pyx_v_result, PyObject *__pyx_v_filename); /* proto*/
static xmlOutputBuffer *__pyx_f_4lxml_5etree_15_FilelikeWriter__createOutputBuffer(struct __pyx_obj_4lxml_5etree__FilelikeWriter *__pyx_v_self, xmlCharEncodingHandler *__pyx_v_enchandler); /* proto*/
static int __pyx_f_4lxml_5etree_15_FilelikeWriter_write(struct __pyx_obj_4lxml_5etree__FilelikeWriter *__pyx_v_self, char *__pyx_v_c_buffer, int __pyx_v_size); /* proto*/
static int __pyx_f_4lxml_5etree_15_FilelikeWriter_close(struct __pyx_obj_4lxml_5etree__FilelikeWriter *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_16C14NWriterTarget__resolve_prefix_name(struct __pyx_obj_4lxml_5etree_C14NWriterTarget *__pyx_v_self, PyObject *__pyx_v_prefixed_name); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_16C14NWriterTarget__qname(struct __pyx_obj_4lxml_5etree_C14NWriterTarget *__pyx_v_self, PyObject *__pyx_v_qname, struct __pyx_opt_args_4lxml_5etree_16C14NWriterTarget__qname *__pyx_optional_args); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_16C14NWriterTarget__flush(struct __pyx_obj_4lxml_5etree_C14NWriterTarget *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_16C14NWriterTarget__start(struct __pyx_obj_4lxml_5etree_C14NWriterTarget *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_attrs, PyObject *__pyx_v_new_namespaces, struct __pyx_opt_args_4lxml_5etree_16C14NWriterTarget__start *__pyx_optional_args); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_22_IncrementalFileWriter__write_qname(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_prefix); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_22_IncrementalFileWriter__write_start_element(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_element_config); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_22_IncrementalFileWriter__write_attributes_and_namespaces(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_attributes, PyObject *__pyx_v_flat_namespace_map, PyObject *__pyx_v_new_namespaces); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_22_IncrementalFileWriter__write_attributes_list(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_attributes); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_22_IncrementalFileWriter__write_end_element(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_element_config); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_22_IncrementalFileWriter__find_prefix(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_href, PyObject *__pyx_v_flat_namespaces_map, PyObject *__pyx_v_new_namespaces); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_22_IncrementalFileWriter__collect_namespaces(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_nsmap); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_22_IncrementalFileWriter__close(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self, int __pyx_v_raise_on_error); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_22_IncrementalFileWriter__handle_error(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self, int __pyx_v_error_result); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_16_AsyncDataWriter_collect(struct __pyx_obj_4lxml_5etree__AsyncDataWriter *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_27_AsyncIncrementalFileWriter__flush(struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_9iterparse__close_source(struct __pyx_obj_4lxml_5etree_iterparse *__pyx_v_self); /* proto*/
static int __pyx_f_4lxml_5etree_9iterparse__read_more_events(struct __pyx_obj_4lxml_5etree_iterparse *__pyx_v_self, CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_context); /* proto*/
static xmlNode *__pyx_f_4lxml_5etree_8iterwalk__process_non_elements(struct __pyx_obj_4lxml_5etree_iterwalk *__pyx_v_self, struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_node); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_8iterwalk__next_event(struct __pyx_obj_4lxml_5etree_iterwalk *__pyx_v_self); /* proto*/
static int __pyx_f_4lxml_5etree_8iterwalk__start_node(struct __pyx_obj_4lxml_5etree_iterwalk *__pyx_v_self, struct LxmlElement *__pyx_v_node); /* proto*/
static struct LxmlElement *__pyx_f_4lxml_5etree_8iterwalk__end_node(struct __pyx_obj_4lxml_5etree_iterwalk *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_7_IDDict__build_keys(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_7_IDDict__build_items(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self); /* proto*/
static struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_f_4lxml_5etree_12_BaseContext__copy(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_12_BaseContext__to_utf(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, PyObject *__pyx_v_s); /* proto*/
static void __pyx_f_4lxml_5etree_12_BaseContext__set_xpath_context(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, xmlXPathContext *__pyx_v_xpathCtxt); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_12_BaseContext__register_context(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, struct LxmlDocument *__pyx_v_doc); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_12_BaseContext__cleanup_context(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_12_BaseContext__release_context(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_12_BaseContext_addNamespace(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, PyObject *__pyx_v_prefix, PyObject *__pyx_v_ns_uri); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_12_BaseContext_registerNamespace(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, PyObject *__pyx_v_prefix, PyObject *__pyx_v_ns_uri); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_12_BaseContext_registerLocalNamespaces(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_12_BaseContext_registerGlobalNamespaces(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_12_BaseContext_unregisterGlobalNamespaces(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self); /* proto*/
static void __pyx_f_4lxml_5etree_12_BaseContext__unregisterNamespace(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, PyObject *__pyx_v_prefix_utf); /* proto*/
static int __pyx_f_4lxml_5etree_12_BaseContext__addLocalExtensionFunction(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, PyObject *__pyx_v_ns_utf, PyObject *__pyx_v_name_utf, PyObject *__pyx_v_function); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_12_BaseContext_registerGlobalFunctions(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, void *__pyx_v_ctxt, __pyx_t_4lxml_5etree__register_function __pyx_v_reg_func); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_12_BaseContext_registerLocalFunctions(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, void *__pyx_v_ctxt, __pyx_t_4lxml_5etree__register_function __pyx_v_reg_func); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_12_BaseContext_unregisterAllFunctions(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, void *__pyx_v_ctxt, __pyx_t_4lxml_5etree__register_function __pyx_v_unreg_func); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_12_BaseContext_unregisterGlobalFunctions(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, void *__pyx_v_ctxt, __pyx_t_4lxml_5etree__register_function __pyx_v_unreg_func); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_12_BaseContext__find_cached_function(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, const xmlChar *__pyx_v_c_ns_uri, const xmlChar *__pyx_v_c_name); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_12_BaseContext__release_temp_refs(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_12_BaseContext__hold(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, PyObject *__pyx_v_obj); /* proto*/
static struct LxmlDocument *__pyx_f_4lxml_5etree_12_BaseContext__findDocumentForNode(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, xmlNode *__pyx_v_c_node); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_12_ExsltRegExp__make_string(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__ExsltRegExp *__pyx_v_self, PyObject *__pyx_v_value); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_12_ExsltRegExp__compile(struct __pyx_obj_4lxml_5etree__ExsltRegExp *__pyx_v_self, PyObject *__pyx_v_rexp, PyObject *__pyx_v_ignore_case); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_12_ExsltRegExp__register_in_context(struct __pyx_obj_4lxml_5etree__ExsltRegExp *__pyx_v_self, struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_context); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_13_XPathContext_set_context(struct __pyx_obj_4lxml_5etree__XPathContext *__pyx_v_self, xmlXPathContext *__pyx_v_xpathCtxt); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_13_XPathContext_register_context(struct __pyx_obj_4lxml_5etree__XPathContext *__pyx_v_self, struct LxmlDocument *__pyx_v_doc); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_13_XPathContext_unregister_context(struct __pyx_obj_4lxml_5etree__XPathContext *__pyx_v_self); /* proto*/
static void __pyx_f_4lxml_5etree_13_XPathContext_registerExsltFunctions(struct __pyx_obj_4lxml_5etree__XPathContext *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_13_XPathContext_registerVariables(struct __pyx_obj_4lxml_5etree__XPathContext *__pyx_v_self, PyObject *__pyx_v_variable_dict); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_13_XPathContext_registerVariable(struct __pyx_obj_4lxml_5etree__XPathContext *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_19_XPathEvaluatorBase_set_context(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *__pyx_v_self, xmlXPathContext *__pyx_v_xpathCtxt); /* proto*/
static int __pyx_f_4lxml_5etree_19_XPathEvaluatorBase__checkAbsolutePath(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *__pyx_v_self, char *__pyx_v_path); /* proto*/
static int __pyx_f_4lxml_5etree_19_XPathEvaluatorBase__lock(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *__pyx_v_self); /* proto*/
static void __pyx_f_4lxml_5etree_19_XPathEvaluatorBase__unlock(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_19_XPathEvaluatorBase__build_parse_error(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_19_XPathEvaluatorBase__build_eval_error(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_19_XPathEvaluatorBase__handle_result(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *__pyx_v_self, xmlXPathObject *__pyx_v_xpathObj, struct LxmlDocument *__pyx_v_doc); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_7ETXPath__nsextract_path(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree_ETXPath *__pyx_v_self, PyObject *__pyx_v_path); /* proto*/
static struct __pyx_obj_4lxml_5etree__XSLTResolverContext *__pyx_f_4lxml_5etree_20_XSLTResolverContext__copy(struct __pyx_obj_4lxml_5etree__XSLTResolverContext *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_17XSLTAccessControl__setAccess(struct __pyx_obj_4lxml_5etree_XSLTAccessControl *__pyx_v_self, xsltSecurityOption __pyx_v_option, int __pyx_v_allow); /* proto*/
static void __pyx_f_4lxml_5etree_17XSLTAccessControl__register_in_context(struct __pyx_obj_4lxml_5etree_XSLTAccessControl *__pyx_v_self, xsltTransformContext *__pyx_v_ctxt); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_17XSLTAccessControl__optval(struct __pyx_obj_4lxml_5etree_XSLTAccessControl *__pyx_v_self, xsltSecurityOption __pyx_v_option); /* proto*/
static struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_f_4lxml_5etree_12_XSLTContext__copy(struct __pyx_obj_4lxml_5etree__XSLTContext *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_12_XSLTContext_register_context(struct __pyx_obj_4lxml_5etree__XSLTContext *__pyx_v_self, xsltTransformContext *__pyx_v_xsltCtxt, struct LxmlDocument *__pyx_v_doc); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_12_XSLTContext_free_context(struct __pyx_obj_4lxml_5etree__XSLTContext *__pyx_v_self); /* proto*/
static xmlDoc *__pyx_f_4lxml_5etree_4XSLT__run_transform(struct __pyx_obj_4lxml_5etree_XSLT *__pyx_v_self, xmlDoc *__pyx_v_c_input_doc, const char **__pyx_v_params, CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__XSLTContext *__pyx_v_context, xsltTransformContext *__pyx_v_transform_ctxt); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_15_XSLTResultTree__saveToStringAndSize(struct __pyx_obj_4lxml_5etree__XSLTResultTree *__pyx_v_self, xmlChar **__pyx_v_s, int *__pyx_v_l); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_13XSLTExtension__collectXSLTResultContent(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree_XSLTExtension *__pyx_v_self, struct __pyx_obj_4lxml_5etree__XSLTContext *__pyx_v_context, xmlNode *__pyx_v_c_parent, int __pyx_v_elements_only, int __pyx_v_remove_blank_text); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_10_Validator__append_log_message(struct __pyx_obj_4lxml_5etree__Validator *__pyx_v_self, int __pyx_v_domain, int __pyx_v_type, int __pyx_v_level, int __pyx_v_line, PyObject *__pyx_v_message, PyObject *__pyx_v_filename, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_10_Validator__clear_error_log(struct __pyx_obj_4lxml_5etree__Validator *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *__pyx_f_4lxml_5etree_9XMLSchema__newSaxValidator(struct __pyx_obj_4lxml_5etree_XMLSchema *__pyx_v_self, int __pyx_v_add_default_attributes); /* proto*/
static struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *__pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_copy(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *__pyx_v_self); /* proto*/
static void __pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_inject_default_attributes(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *__pyx_v_self, xmlDoc *__pyx_v_c_doc); /* proto*/
static int __pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_connect(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *__pyx_v_self, xmlParserCtxt *__pyx_v_c_ctxt, struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_error_log); /* proto*/
static void __pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_disconnect(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *__pyx_v_self); /* proto*/
static int __pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_isvalid(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *__pyx_v_self); /* proto*/

/* Module declarations from "cython.view" */

/* Module declarations from "cython.dataclasses" */

/* Module declarations from "cython" */

/* Module declarations from "lxml" */

/* Module declarations from "libc" */

/* Module declarations from "libc.string" */

/* Module declarations from "libc.stdio" */

/* Module declarations from "lxml.python" */

/* Module declarations from "lxml.includes" */

/* Module declarations from "lxml.includes.tree" */

/* Module declarations from "lxml.includes.config" */

/* Module declarations from "lxml.includes.xmlerror" */

/* Module declarations from "lxml.includes.xpath" */

/* Module declarations from "lxml.includes.c14n" */

/* Module declarations from "cpython.mem" */

/* Module declarations from "__builtin__" */

/* Module declarations from "cpython.type" */

/* Module declarations from "cpython.object" */

/* Module declarations from "cpython.ref" */

/* Module declarations from "cpython" */

/* Module declarations from "libc.limits" */

/* Module declarations from "libc.stdlib" */

/* Module declarations from "lxml.includes.uri" */

/* Module declarations from "lxml.cvarargs" */

/* Module declarations from "lxml.includes.xmlparser" */

/* Module declarations from "lxml.includes.htmlparser" */

/* Module declarations from "lxml.includes.xinclude" */

/* Module declarations from "lxml.includes.xslt" */

/* Module declarations from "lxml.includes.dtdvalid" */

/* Module declarations from "lxml.includes.relaxng" */

/* Module declarations from "lxml.includes.xmlschema" */

/* Module declarations from "lxml.includes.schematron" */

/* Module declarations from "lxml.etree" */
static PyObject *__pyx_v_4lxml_5etree_os_path_abspath = 0;
static PyObject *__pyx_v_4lxml_5etree_BytesIO = 0;
static PyObject *__pyx_v_4lxml_5etree_StringIO = 0;
static PyObject *__pyx_v_4lxml_5etree_OrderedDict = 0;
static PyObject *__pyx_v_4lxml_5etree__elementpath = 0;
static PyObject *__pyx_v_4lxml_5etree_sys = 0;
static PyObject *__pyx_v_4lxml_5etree_re = 0;
static PyObject *__pyx_v_4lxml_5etree_partial = 0;
static PyObject *__pyx_v_4lxml_5etree_islice = 0;
static PyObject *__pyx_v_4lxml_5etree_ITER_EMPTY = 0;
static PyObject *__pyx_v_4lxml_5etree_MutableMapping = 0;
static PyObject *__pyx_v_4lxml_5etree_IMMUTABLE_EMPTY_MAPPING = 0;
static PyObject *__pyx_v_4lxml_5etree__FILENAME_ENCODING = 0;
static char *__pyx_v_4lxml_5etree__C_FILENAME_ENCODING;
static PyObject *__pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES = 0;
static PyObject *__pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES_ITEMS = 0;
static PyObject *__pyx_v_4lxml_5etree__check_internal_prefix = 0;
static PyObject *__pyx_v_4lxml_5etree__Error = 0;
static int __pyx_v_4lxml_5etree__LIBXML_VERSION_INT;
static int __pyx_v_4lxml_5etree_HAS_ZLIB_COMPRESSION;
static PyObject *__pyx_v_4lxml_5etree___RE_XML_ENCODING = 0;
static PyObject *__pyx_v_4lxml_5etree___REPLACE_XML_ENCODING = 0;
static PyObject *__pyx_v_4lxml_5etree___HAS_XML_ENCODING = 0;
static struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_4lxml_5etree___GLOBAL_ERROR_LOG = 0;
static PyObject *__pyx_v_4lxml_5etree___ERROR_LEVELS = 0;
static PyObject *__pyx_v_4lxml_5etree___ERROR_DOMAINS = 0;
static PyObject *__pyx_v_4lxml_5etree___PARSER_ERROR_TYPES = 0;
static PyObject *__pyx_v_4lxml_5etree___RELAXNG_ERROR_TYPES = 0;
static PyObject *__pyx_v_4lxml_5etree__PREFIX_CACHE = 0;
static PyObject *__pyx_v_4lxml_5etree__find_invalid_public_id_characters = 0;
static PyObject *__pyx_v_4lxml_5etree__FIND_PI_ATTRIBUTES = 0;
static _element_class_lookup_function __pyx_v_4lxml_5etree_LOOKUP_ELEMENT_CLASS;
static PyObject *__pyx_v_4lxml_5etree_ELEMENT_CLASS_LOOKUP_STATE = 0;
static struct __pyx_obj_4lxml_5etree_ParserBasedElementClassLookup *__pyx_v_4lxml_5etree_DEFAULT_ELEMENT_CLASS_LOOKUP = 0;
static PyObject *__pyx_v_4lxml_5etree___FUNCTION_NAMESPACE_REGISTRIES = 0;
static PyObject *__pyx_v_4lxml_5etree__GenericAlias = 0;
static PyObject *__pyx_v_4lxml_5etree__ParseError = 0;
static struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT = 0;
static const char *__pyx_v_4lxml_5etree__PY_UNICODE_ENCODING;
static xmlExternalEntityLoader __pyx_v_4lxml_5etree___DEFAULT_ENTITY_LOADER;
static int __pyx_v_4lxml_5etree__XML_DEFAULT_PARSE_OPTIONS;
static struct __pyx_obj_4lxml_5etree_XMLParser *__pyx_v_4lxml_5etree___DEFAULT_XML_PARSER = 0;
static int __pyx_v_4lxml_5etree__HTML_DEFAULT_PARSE_OPTIONS;
static PyObject *__pyx_v_4lxml_5etree__UNUSED = 0;
static struct __pyx_obj_4lxml_5etree_HTMLParser *__pyx_v_4lxml_5etree___DEFAULT_HTML_PARSER = 0;
static PyObject *__pyx_v_4lxml_5etree_inspect_getargspec = 0;
static PyObject *__pyx_v_4lxml_5etree_GzipFile = 0;
static PyObject *__pyx_v_4lxml_5etree_io_open = 0;
static PyObject *__pyx_v_4lxml_5etree_gzip = 0;
static PyObject *__pyx_v_4lxml_5etree_getwriter = 0;
static PyObject *__pyx_v_4lxml_5etree_utf8_writer = 0;
static PyObject *__pyx_v_4lxml_5etree_contextmanager = 0;
static PyObject *__pyx_v_4lxml_5etree__open_utf8_file = 0;
static PyObject *__pyx_v_4lxml_5etree__looks_like_prefix_name = 0;
static PyObject *__pyx_v_4lxml_5etree__find_id_attributes = 0;
static PyObject *__pyx_v_4lxml_5etree_LIBXML2_XPATH_ERROR_MESSAGES = 0;
static PyObject *__pyx_v_4lxml_5etree__XPATH_SYNTAX_ERRORS = 0;
static PyObject *__pyx_v_4lxml_5etree__XPATH_EVAL_ERRORS = 0;
static PyObject *__pyx_v_4lxml_5etree__replace_strings = 0;
static PyObject *__pyx_v_4lxml_5etree__find_namespaces = 0;
static xsltDocLoaderFunc __pyx_v_4lxml_5etree_XSLT_DOC_DEFAULT_LOADER;
static PyObject *__pyx_v_4lxml_5etree_EMPTY_DICT = 0;
static PyObject *__pyx_v_4lxml_5etree__RE_PI_HREF = 0;
static PyObject *__pyx_v_4lxml_5etree__FIND_PI_HREF = 0;
static PyObject *__pyx_v_4lxml_5etree__REPLACE_PI_HREF = 0;
static struct __pyx_obj_4lxml_5etree_XPath *__pyx_v_4lxml_5etree___findStylesheetByID = 0;
static PyObject *__pyx_v_4lxml_5etree__rnc2rng = 0;
static struct __pyx_obj_4lxml_5etree_XPath *__pyx_v_4lxml_5etree__check_for_default_attributes = 0;
static PyObject *__pyx_8genexpr1__pyx_v_4lxml_5etree_feature_id;
static PyObject *__pyx_8genexpr1__pyx_v_4lxml_5etree_feature_name;
static PyObject *__pyx_collections_abc_Sequence = 0;
static PyObject *generic = 0;
static PyObject *strided = 0;
static PyObject *indirect = 0;
static PyObject *contiguous = 0;
static PyObject *indirect_contiguous = 0;
static int __pyx_memoryview_thread_locks_used;
static PyThread_type_lock __pyx_memoryview_thread_locks[8];
static PyObject *__pyx_f_4lxml_5etree__update_default_namespace_prefixes_items(void); /*proto*/
static PyObject *__pyx_f_4lxml_5etree___unpackDottedVersion(PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree___unpackIntVersion(int, struct __pyx_opt_args_4lxml_5etree___unpackIntVersion *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__copy_lib_features(void); /*proto*/
static CYTHON_INLINE struct LxmlElement *__pyx_f_4lxml_5etree_getProxy(xmlNode *); /*proto*/
static CYTHON_INLINE int __pyx_f_4lxml_5etree_hasProxy(xmlNode *); /*proto*/
static CYTHON_INLINE int __pyx_f_4lxml_5etree__registerProxy(struct LxmlElement *, struct LxmlDocument *, xmlNode *); /*proto*/
static CYTHON_INLINE int __pyx_f_4lxml_5etree__unregisterProxy(struct LxmlElement *); /*proto*/
static xmlDoc *__pyx_f_4lxml_5etree__fakeRootDoc(xmlDoc *, xmlNode *); /*proto*/
static xmlDoc *__pyx_f_4lxml_5etree__plainFakeRootDoc(xmlDoc *, xmlNode *, int); /*proto*/
static void __pyx_f_4lxml_5etree__destroyFakeDoc(xmlDoc *, xmlDoc *); /*proto*/
static struct LxmlElement *__pyx_f_4lxml_5etree__fakeDocElementFactory(struct LxmlDocument *, xmlNode *); /*proto*/
static int __pyx_f_4lxml_5etree_attemptDeallocation(xmlNode *); /*proto*/
static xmlNode *__pyx_f_4lxml_5etree_getDeallocationTop(xmlNode *); /*proto*/
static int __pyx_f_4lxml_5etree_canDeallocateChildNodes(xmlNode *); /*proto*/
static void __pyx_f_4lxml_5etree__copyParentNamespaces(xmlNode *, xmlNode *); /*proto*/
static int __pyx_f_4lxml_5etree__growNsCache(__pyx_t_4lxml_5etree__nscache *); /*proto*/
static CYTHON_INLINE int __pyx_f_4lxml_5etree__appendToNsCache(__pyx_t_4lxml_5etree__nscache *, xmlNs *, xmlNs *); /*proto*/
static int __pyx_f_4lxml_5etree__stripRedundantNamespaceDeclarations(xmlNode *, __pyx_t_4lxml_5etree__nscache *, xmlNs **); /*proto*/
static void __pyx_f_4lxml_5etree__cleanUpFromNamespaceAdaptation(xmlNode *, __pyx_t_4lxml_5etree__nscache *, xmlNs *); /*proto*/
static int __pyx_f_4lxml_5etree_moveNodeToDocument(struct LxmlDocument *, xmlDoc *, xmlNode *); /*proto*/
static void __pyx_f_4lxml_5etree__setTreeDoc(xmlNode *, xmlDoc *); /*proto*/
static CYTHON_INLINE void __pyx_f_4lxml_5etree__fixDocChildren(xmlNode *, xmlDoc *); /*proto*/
static int __pyx_f_4lxml_5etree__fixCNs(struct LxmlDocument *, xmlNode *, xmlNode *, __pyx_t_4lxml_5etree__nscache *, xmlNs *); /*proto*/
static int __pyx_f_4lxml_5etree_fixElementDocument(xmlNode *, struct LxmlDocument *, size_t); /*proto*/
static void __pyx_f_4lxml_5etree_fixThreadDictNames(xmlNode *, xmlDict *, xmlDict *); /*proto*/
static CYTHON_INLINE void __pyx_f_4lxml_5etree__fixThreadDictPtr(const xmlChar **, xmlDict *, xmlDict *); /*proto*/
static void __pyx_f_4lxml_5etree_fixThreadDictNamesForNode(xmlNode *, xmlDict *, xmlDict *); /*proto*/
static CYTHON_INLINE void __pyx_f_4lxml_5etree_fixThreadDictNamesForAttributes(xmlAttr *, xmlDict *, xmlDict *); /*proto*/
static CYTHON_INLINE void __pyx_f_4lxml_5etree_fixThreadDictContentForNode(xmlNode *, xmlDict *, xmlDict *); /*proto*/
static CYTHON_INLINE void __pyx_f_4lxml_5etree_fixThreadDictNsForNode(xmlNode *, xmlDict *, xmlDict *); /*proto*/
static void __pyx_f_4lxml_5etree_fixThreadDictNamesForDtd(xmlDtd *, xmlDict *, xmlDict *); /*proto*/
static struct LxmlDocument *__pyx_f_4lxml_5etree__adoptForeignDoc(xmlDoc *, struct __pyx_opt_args_4lxml_5etree__adoptForeignDoc *__pyx_optional_args); /*proto*/
static void __pyx_f_4lxml_5etree_displayNode(xmlNode *, PyObject *); /*proto*/
static CYTHON_INLINE int __pyx_f_4lxml_5etree__isHtmlDocument(struct LxmlElement *); /*proto*/
static CYTHON_INLINE int __pyx_f_4lxml_5etree__assertValidNode(struct LxmlElement *); /*proto*/
static CYTHON_INLINE int __pyx_f_4lxml_5etree__assertValidDoc(struct LxmlDocument *); /*proto*/
static struct LxmlDocument *__pyx_f_4lxml_5etree__documentOrRaise(PyObject *); /*proto*/
static struct LxmlElement *__pyx_f_4lxml_5etree__rootNodeOrRaise(PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__isAncestorOrSame(xmlNode *, xmlNode *); /*proto*/
static struct LxmlElement *__pyx_f_4lxml_5etree__makeElement(PyObject *, xmlDoc *, struct LxmlDocument *, struct __pyx_obj_4lxml_5etree__BaseParser *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__initNewElement(struct LxmlElement *, int, PyObject *, PyObject *, struct __pyx_obj_4lxml_5etree__BaseParser *, PyObject *, PyObject *, PyObject *); /*proto*/
static struct LxmlElement *__pyx_f_4lxml_5etree__makeSubElement(struct LxmlElement *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__setNodeNamespaces(xmlNode *, struct LxmlDocument *, PyObject *, PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__build_nsmap(xmlNode *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__iter_nsmap(PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__iter_attrib(PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__initNodeAttributes(xmlNode *, struct LxmlDocument *, PyObject *, PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__addAttributeToNode(xmlNode *, struct LxmlDocument *, int, PyObject *, PyObject *, PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__collectNsDefs(xmlNode *, __pyx_t_4lxml_5etree__ns_node_ref **, size_t *, size_t *); /*proto*/
static int __pyx_f_4lxml_5etree__removeUnusedNamespaceDeclarations(xmlNode *, PyObject *); /*proto*/
static xmlNs *__pyx_f_4lxml_5etree__searchNsByHref(xmlNode *, const xmlChar *, int); /*proto*/
static int __pyx_f_4lxml_5etree__replaceNodeByChildren(struct LxmlDocument *, xmlNode *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__attributeValue(xmlNode *, xmlAttr *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__attributeValueFromNsName(xmlNode *, const xmlChar *, const xmlChar *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__getNodeAttributeValue(xmlNode *, PyObject *, PyObject *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_4lxml_5etree__getAttributeValue(struct LxmlElement *, PyObject *, PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__setAttributeValue(struct LxmlElement *, PyObject *, PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__delAttribute(struct LxmlElement *, PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__delAttributeFromNsName(xmlNode *, const xmlChar *, const xmlChar *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__collectAttributes(xmlNode *, int); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__stripEncodingDeclaration(PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__hasEncodingDeclaration(PyObject *); /*proto*/
static CYTHON_INLINE int __pyx_f_4lxml_5etree__hasText(xmlNode *); /*proto*/
static CYTHON_INLINE int __pyx_f_4lxml_5etree__hasTail(xmlNode *); /*proto*/
static CYTHON_INLINE int __pyx_f_4lxml_5etree__hasNonWhitespaceTail(xmlNode *); /*proto*/
static int __pyx_f_4lxml_5etree__hasNonWhitespaceText(xmlNode *, struct __pyx_opt_args_4lxml_5etree__hasNonWhitespaceText *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__collectText(xmlNode *); /*proto*/
static void __pyx_f_4lxml_5etree__removeText(xmlNode *); /*proto*/
static xmlNode *__pyx_f_4lxml_5etree__createTextNode(xmlDoc *, PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__setNodeText(xmlNode *, PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__setTailText(xmlNode *, PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__resolveQNameText(struct LxmlElement *, PyObject *); /*proto*/
static CYTHON_INLINE int __pyx_f_4lxml_5etree__hasChild(xmlNode *); /*proto*/
static CYTHON_INLINE Py_ssize_t __pyx_f_4lxml_5etree__countElements(xmlNode *); /*proto*/
static int __pyx_f_4lxml_5etree__findChildSlice(PyObject *, xmlNode *, xmlNode **, Py_ssize_t *, Py_ssize_t *); /*proto*/
static int __pyx_f_4lxml_5etree__isFullSlice(PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__collectChildren(struct LxmlElement *); /*proto*/
static CYTHON_INLINE xmlNode *__pyx_f_4lxml_5etree__findChild(xmlNode *, Py_ssize_t); /*proto*/
static CYTHON_INLINE xmlNode *__pyx_f_4lxml_5etree__findChildForwards(xmlNode *, Py_ssize_t); /*proto*/
static CYTHON_INLINE xmlNode *__pyx_f_4lxml_5etree__findChildBackwards(xmlNode *, Py_ssize_t); /*proto*/
static CYTHON_INLINE xmlNode *__pyx_f_4lxml_5etree__textNodeOrSkip(xmlNode *); /*proto*/
static CYTHON_INLINE xmlNode *__pyx_f_4lxml_5etree__nextElement(xmlNode *); /*proto*/
static CYTHON_INLINE xmlNode *__pyx_f_4lxml_5etree__previousElement(xmlNode *); /*proto*/
static CYTHON_INLINE xmlNode *__pyx_f_4lxml_5etree__parentElement(xmlNode *); /*proto*/
static CYTHON_INLINE int __pyx_f_4lxml_5etree__tagMatches(xmlNode *, const xmlChar *, const xmlChar *); /*proto*/
static CYTHON_INLINE int __pyx_f_4lxml_5etree__tagMatchesExactly(xmlNode *, struct __pyx_t_4lxml_5etree_qname *); /*proto*/
static CYTHON_INLINE int __pyx_f_4lxml_5etree__nsTagMatchesExactly(const xmlChar *, const xmlChar *, struct __pyx_t_4lxml_5etree_qname *); /*proto*/
static Py_ssize_t __pyx_f_4lxml_5etree__mapTagsToQnameMatchArray(xmlDoc *, PyObject *, struct __pyx_t_4lxml_5etree_qname *, int); /*proto*/
static int __pyx_f_4lxml_5etree__removeNode(struct LxmlDocument *, xmlNode *); /*proto*/
static int __pyx_f_4lxml_5etree__removeSiblings(xmlNode *, xmlElementType, int); /*proto*/
static void __pyx_f_4lxml_5etree__moveTail(xmlNode *, xmlNode *); /*proto*/
static int __pyx_f_4lxml_5etree__copyTail(xmlNode *, xmlNode *); /*proto*/
static int __pyx_f_4lxml_5etree__copyNonElementSiblings(xmlNode *, xmlNode *); /*proto*/
static int __pyx_f_4lxml_5etree__deleteSlice(struct LxmlDocument *, xmlNode *, Py_ssize_t, Py_ssize_t); /*proto*/
static int __pyx_f_4lxml_5etree__replaceSlice(struct LxmlElement *, xmlNode *, Py_ssize_t, Py_ssize_t, int, PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__linkChild(xmlNode *, xmlNode *); /*proto*/
static int __pyx_f_4lxml_5etree__appendChild(struct LxmlElement *, struct LxmlElement *); /*proto*/
static int __pyx_f_4lxml_5etree__prependChild(struct LxmlElement *, struct LxmlElement *); /*proto*/
static int __pyx_f_4lxml_5etree__appendSibling(struct LxmlElement *, struct LxmlElement *); /*proto*/
static int __pyx_f_4lxml_5etree__prependSibling(struct LxmlElement *, struct LxmlElement *); /*proto*/
static int __pyx_f_4lxml_5etree__addSibling(struct LxmlElement *, struct LxmlElement *, int); /*proto*/
static int __pyx_f_4lxml_5etree_isutf8l(const xmlChar *, size_t); /*proto*/
static int __pyx_f_4lxml_5etree__is_valid_xml_ascii(PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__is_valid_xml_utf8(PyObject *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_4lxml_5etree_funicodeOrNone(const xmlChar *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_4lxml_5etree_funicodeOrEmpty(const xmlChar *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree_funicode(const xmlChar *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__utf8(PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__utf8orNone(PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__isFilePath(const xmlChar *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__getFSPathOrObject(PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__encodeFilename(PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__decodeFilename(const xmlChar *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__decodeFilenameWithLength(const xmlChar *, size_t); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__encodeFilenameUTF8(PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__getNsTag(PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__getNsTagWithEmptyNs(PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree___getNsTag(PyObject *, int); /*proto*/
static CYTHON_INLINE int __pyx_f_4lxml_5etree__pyXmlNameIsValid(PyObject *); /*proto*/
static CYTHON_INLINE int __pyx_f_4lxml_5etree__pyHtmlNameIsValid(PyObject *); /*proto*/
static CYTHON_INLINE int __pyx_f_4lxml_5etree__xmlNameIsValid(const xmlChar *); /*proto*/
static int __pyx_f_4lxml_5etree__htmlNameIsValid(const xmlChar *); /*proto*/
static int __pyx_f_4lxml_5etree__characterReferenceIsValid(const xmlChar *); /*proto*/
static int __pyx_f_4lxml_5etree__tagValidOrRaise(PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__htmlTagValidOrRaise(PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__attributeValidOrRaise(PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__prefixValidOrRaise(PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__uriValidOrRaise(PyObject *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_4lxml_5etree__namespacedName(xmlNode *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__namespacedNameFromNsName(const xmlChar *, const xmlChar *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__getFilenameForFile(PyObject *); /*proto*/
static void __pyx_f_4lxml_5etree__initThreadLogging(void); /*proto*/
static struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_f_4lxml_5etree__getThreadErrorLog(PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__setThreadErrorLog(PyObject *, struct __pyx_obj_4lxml_5etree__BaseErrorLog *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree___copyGlobalErrorLog(void); /*proto*/
static void __pyx_f_4lxml_5etree__forwardError(void *, xmlError const *); /*proto*/
static void __pyx_f_4lxml_5etree__receiveError(void *, xmlError const *); /*proto*/
static void __pyx_f_4lxml_5etree__receiveXSLTError(void *, char *, ...); /*proto*/
static void __pyx_f_4lxml_5etree__receiveRelaxNGParseError(void *, char *, ...); /*proto*/
static void __pyx_f_4lxml_5etree__receiveRelaxNGValidationError(void *, char *, ...); /*proto*/
static void __pyx_f_4lxml_5etree__nullGenericErrorFunc(void *, char *, ...); /*proto*/
static void __pyx_f_4lxml_5etree__connectGenericErrorLog(PyObject *, struct __pyx_opt_args_4lxml_5etree__connectGenericErrorLog *__pyx_optional_args); /*proto*/
static void __pyx_f_4lxml_5etree__receiveGenericError(void *, int, char *, va_list); /*proto*/
static PyObject *__pyx_f_4lxml_5etree___initErrorConstants(void); /*proto*/
static PyObject *__pyx_f_4lxml_5etree___initPrefixCache(void); /*proto*/
static struct LxmlDocument *__pyx_f_4lxml_5etree__documentFactory(xmlDoc *, struct __pyx_obj_4lxml_5etree__BaseParser *); /*proto*/
static struct LxmlElement *__pyx_f_4lxml_5etree__elementFactory(struct LxmlDocument *, xmlNode *); /*proto*/
static struct LxmlElementTree *__pyx_f_4lxml_5etree__elementTreeFactory(struct LxmlDocument *, struct LxmlElement *); /*proto*/
static struct LxmlElementTree *__pyx_f_4lxml_5etree__newElementTree(struct LxmlDocument *, struct LxmlElement *, PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__attributeIteratorFactory(struct LxmlElement *, int); /*proto*/
static xmlNode *__pyx_f_4lxml_5etree__createElement(xmlDoc *, PyObject *); /*proto*/
static xmlNode *__pyx_f_4lxml_5etree__createComment(xmlDoc *, const xmlChar *); /*proto*/
static xmlNode *__pyx_f_4lxml_5etree__createPI(xmlDoc *, const xmlChar *, const xmlChar *); /*proto*/
static xmlNode *__pyx_f_4lxml_5etree__createEntity(xmlDoc *, const xmlChar *); /*proto*/
static int __pyx_f_4lxml_5etree__indent_children(xmlNode *, Py_ssize_t, PyObject *, PyObject *); /*proto*/
static struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_f_4lxml_5etree__newReadOnlyProxy(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *, xmlNode *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_4lxml_5etree__initReadOnlyProxy(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *, struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__freeReadOnlyProxies(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *); /*proto*/
static struct __pyx_obj_4lxml_5etree__OpaqueNodeWrapper *__pyx_f_4lxml_5etree__newOpaqueAppendOnlyNodeWrapper(xmlNode *); /*proto*/
static struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_f_4lxml_5etree__newAppendOnlyProxy(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *, xmlNode *); /*proto*/
static xmlNode *__pyx_f_4lxml_5etree__roNodeOf(PyObject *); /*proto*/
static xmlNode *__pyx_f_4lxml_5etree__nonRoNodeOf(PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__validateNodeClass(xmlNode *, PyObject *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_4lxml_5etree__callLookupFallback(struct LxmlFallbackElementClassLookup *, struct LxmlDocument *, xmlNode *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__lookupDefaultElementClass(PyObject *, struct LxmlDocument *, xmlNode *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__attribute_class_lookup(PyObject *, struct LxmlDocument *, xmlNode *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__parser_class_lookup(PyObject *, struct LxmlDocument *, xmlNode *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__custom_class_lookup(PyObject *, struct LxmlDocument *, xmlNode *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__python_class_lookup(PyObject *, struct LxmlDocument *, xmlNode *); /*proto*/
static void __pyx_f_4lxml_5etree__setElementClassLookupFunction(_element_class_lookup_function, PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__find_nselement_class(PyObject *, struct LxmlDocument *, xmlNode *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__find_all_extension_prefixes(void); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__initResolverContext(struct __pyx_obj_4lxml_5etree__ResolverContext *, struct __pyx_obj_4lxml_5etree__ResolverRegistry *); /*proto*/
static int __pyx_f_4lxml_5etree__setupPythonUnicode(void); /*proto*/
static const char *__pyx_f_4lxml_5etree__findEncodingName(const xmlChar *, int); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__find_PyUCS4EncodingName(void); /*proto*/
static int __pyx_f_4lxml_5etree__readFilelikeParser(void *, char *, int); /*proto*/
static xmlParserInput *__pyx_f_4lxml_5etree__local_resolver(const char *, const char *, xmlParserCtxt *); /*proto*/
static xmlExternalEntityLoader __pyx_f_4lxml_5etree__register_document_loader(void); /*proto*/
static void __pyx_f_4lxml_5etree__reset_document_loader(xmlExternalEntityLoader); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__initParserContext(struct __pyx_obj_4lxml_5etree__ParserContext *, struct __pyx_obj_4lxml_5etree__ResolverRegistry *, xmlParserCtxt *); /*proto*/
static void __pyx_f_4lxml_5etree__forwardParserError(xmlParserCtxt *, xmlError const *); /*proto*/
static void __pyx_f_4lxml_5etree__receiveParserError(void *, xmlError const *); /*proto*/
static int __pyx_f_4lxml_5etree__raiseParseError(xmlParserCtxt *, PyObject *, struct __pyx_obj_4lxml_5etree__ErrorLog *); /*proto*/
static xmlDoc *__pyx_f_4lxml_5etree__handleParseResult(struct __pyx_obj_4lxml_5etree__ParserContext *, xmlParserCtxt *, xmlDoc *, PyObject *, int, int); /*proto*/
static int __pyx_f_4lxml_5etree__fixHtmlDictNames(xmlDict *, xmlDoc *); /*proto*/
static int __pyx_f_4lxml_5etree__fixHtmlDictSubtreeNames(xmlDict *, xmlDoc *, xmlNode *); /*proto*/
static CYTHON_INLINE int __pyx_f_4lxml_5etree__fixHtmlDictNodeNames(xmlDict *, xmlNode *); /*proto*/
static xmlEntity *__pyx_f_4lxml_5etree__getInternalEntityOnly(void *, const xmlChar *); /*proto*/
static void __pyx_f_4lxml_5etree__initSaxDocument(void *); /*proto*/
static __pyx_ctuple_int__and_int __pyx_f_4lxml_5etree__parse_data_chunk(xmlParserCtxt *, char const *, int); /*proto*/
static int __pyx_f_4lxml_5etree__htmlCtxtResetPush(xmlParserCtxt *, const char *, int, const char *, const char *, int); /*proto*/
static xmlDoc *__pyx_f_4lxml_5etree__parseDoc(PyObject *, PyObject *, struct __pyx_obj_4lxml_5etree__BaseParser *); /*proto*/
static xmlDoc *__pyx_f_4lxml_5etree__parseDoc_unicode(PyObject *, PyObject *, char *, struct __pyx_obj_4lxml_5etree__BaseParser *); /*proto*/
static xmlDoc *__pyx_f_4lxml_5etree__parseDoc_bytes(PyObject *, PyObject *, char *, struct __pyx_obj_4lxml_5etree__BaseParser *); /*proto*/
static xmlDoc *__pyx_f_4lxml_5etree__parseDoc_charbuffer(PyObject *, PyObject *, char *, struct __pyx_obj_4lxml_5etree__BaseParser *); /*proto*/
static xmlDoc *__pyx_f_4lxml_5etree__parseDocFromFile(PyObject *, struct __pyx_obj_4lxml_5etree__BaseParser *); /*proto*/
static xmlDoc *__pyx_f_4lxml_5etree__parseDocFromFilelike(PyObject *, PyObject *, struct __pyx_obj_4lxml_5etree__BaseParser *); /*proto*/
static xmlDoc *__pyx_f_4lxml_5etree__newXMLDoc(void); /*proto*/
static xmlDoc *__pyx_f_4lxml_5etree__newHTMLDoc(void); /*proto*/
static xmlDoc *__pyx_f_4lxml_5etree__copyDoc(xmlDoc *, int); /*proto*/
static xmlDoc *__pyx_f_4lxml_5etree__copyDocRoot(xmlDoc *, xmlNode *); /*proto*/
static xmlNode *__pyx_f_4lxml_5etree__copyNodeToDoc(xmlNode *, xmlDoc *); /*proto*/
static struct LxmlDocument *__pyx_f_4lxml_5etree__parseDocument(PyObject *, struct __pyx_obj_4lxml_5etree__BaseParser *, PyObject *); /*proto*/
static struct LxmlDocument *__pyx_f_4lxml_5etree__parseDocumentFromURL(PyObject *, struct __pyx_obj_4lxml_5etree__BaseParser *); /*proto*/
static struct LxmlDocument *__pyx_f_4lxml_5etree__parseMemoryDocument(PyObject *, PyObject *, struct __pyx_obj_4lxml_5etree__BaseParser *); /*proto*/
static struct LxmlDocument *__pyx_f_4lxml_5etree__parseFilelikeDocument(PyObject *, PyObject *, struct __pyx_obj_4lxml_5etree__BaseParser *); /*proto*/
static int __pyx_f_4lxml_5etree__buildParseEventFilter(PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__build_prefix_uri_list(struct __pyx_obj_4lxml_5etree__SaxParserContext *, int, const xmlChar **); /*proto*/
static void __pyx_f_4lxml_5etree__handleSaxStart(void *, const xmlChar *, const xmlChar *, const xmlChar *, int, const xmlChar **, int, int, const xmlChar **); /*proto*/
static void __pyx_f_4lxml_5etree__handleSaxTargetStart(void *, const xmlChar *, const xmlChar *, const xmlChar *, int, const xmlChar **, int, int, const xmlChar **); /*proto*/
static void __pyx_f_4lxml_5etree__handleSaxStartNoNs(void *, const xmlChar *, const xmlChar **); /*proto*/
static void __pyx_f_4lxml_5etree__handleSaxTargetStartNoNs(void *, const xmlChar *, const xmlChar **); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__callTargetSaxStart(struct __pyx_obj_4lxml_5etree__SaxParserContext *, xmlParserCtxt *, PyObject *, PyObject *, PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__pushSaxStartEvent(struct __pyx_obj_4lxml_5etree__SaxParserContext *, xmlParserCtxt *, const xmlChar *, const xmlChar *, PyObject *); /*proto*/
static void __pyx_f_4lxml_5etree__handleSaxEnd(void *, const xmlChar *, const xmlChar *, const xmlChar *); /*proto*/
static void __pyx_f_4lxml_5etree__handleSaxEndNoNs(void *, const xmlChar *); /*proto*/
static int __pyx_f_4lxml_5etree__pushSaxNsEndEvents(struct __pyx_obj_4lxml_5etree__SaxParserContext *); /*proto*/
static int __pyx_f_4lxml_5etree__pushSaxEndEvent(struct __pyx_obj_4lxml_5etree__SaxParserContext *, const xmlChar *, const xmlChar *, PyObject *); /*proto*/
static void __pyx_f_4lxml_5etree__handleSaxData(void *, const xmlChar *, int); /*proto*/
static void __pyx_f_4lxml_5etree__handleSaxTargetDoctype(void *, const xmlChar *, const xmlChar *, const xmlChar *); /*proto*/
static void __pyx_f_4lxml_5etree__handleSaxStartDocument(void *); /*proto*/
static void __pyx_f_4lxml_5etree__handleSaxTargetPI(void *, const xmlChar *, const xmlChar *); /*proto*/
static void __pyx_f_4lxml_5etree__handleSaxPIEvent(void *, const xmlChar *, const xmlChar *); /*proto*/
static void __pyx_f_4lxml_5etree__handleSaxTargetComment(void *, const xmlChar *); /*proto*/
static void __pyx_f_4lxml_5etree__handleSaxComment(void *, const xmlChar *); /*proto*/
static CYTHON_INLINE xmlNode *__pyx_f_4lxml_5etree__findLastEventNode(xmlParserCtxt *); /*proto*/
static int __pyx_f_4lxml_5etree__findOutputMethod(PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__textToString(xmlNode *, PyObject *, int); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__tostring(struct LxmlElement *, PyObject *, PyObject *, PyObject *, int, int, int, int, int); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__tostringC14N(PyObject *, int, int, PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__raiseSerialisationError(int); /*proto*/
static void __pyx_f_4lxml_5etree__writeDoctype(xmlOutputBuffer *, const xmlChar *); /*proto*/
static void __pyx_f_4lxml_5etree__writeNodeToBuffer(xmlOutputBuffer *, xmlNode *, const char *, const xmlChar *, int, int, int, int, int, int); /*proto*/
static void __pyx_f_4lxml_5etree__writeDeclarationToBuffer(xmlOutputBuffer *, const xmlChar *, const char *, int); /*proto*/
static void __pyx_f_4lxml_5etree__writeDtdToBuffer(xmlOutputBuffer *, xmlDoc *, const xmlChar *, int, const char *); /*proto*/
static void __pyx_f_4lxml_5etree__writeTail(xmlOutputBuffer *, xmlNode *, const char *, int, int); /*proto*/
static void __pyx_f_4lxml_5etree__writePrevSiblings(xmlOutputBuffer *, xmlNode *, const char *, int); /*proto*/
static void __pyx_f_4lxml_5etree__writeNextSiblings(xmlOutputBuffer *, xmlNode *, const char *, int); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__write_attr_string(xmlOutputBuffer *, char const *); /*proto*/
static void __pyx_f_4lxml_5etree__write_cdata_section(xmlOutputBuffer *, char const *, char const *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__write_cdata_string(xmlOutputBuffer *, PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__writeFilelikeWriter(void *, char *, int); /*proto*/
static int __pyx_f_4lxml_5etree__closeFilelikeWriter(void *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__tofilelike(PyObject *, struct LxmlElement *, PyObject *, PyObject *, PyObject *, int, int, int, int, int, int); /*proto*/
static int __pyx_f_4lxml_5etree__serialise_node(xmlOutputBuffer *, const xmlChar *, const char *, xmlNode *, int, int, int, int, int, int); /*proto*/
static struct __pyx_obj_4lxml_5etree__FilelikeWriter *__pyx_f_4lxml_5etree__create_output_buffer(PyObject *, const char *, int, xmlOutputBuffer **, int); /*proto*/
static xmlChar **__pyx_f_4lxml_5etree__convert_ns_prefixes(xmlDict *, PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__tofilelikeC14N(PyObject *, struct LxmlElement *, int, int, int, PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__tree_to_target(PyObject *, PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__raise_serialization_error(PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__escape_cdata_c14n(PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__escape_attrib_c14n(PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__countNsDefs(xmlNode *); /*proto*/
static int __pyx_f_4lxml_5etree__appendStartNsEvents(xmlNode *, PyObject *); /*proto*/
static void __pyx_f_4lxml_5etree__collectIdHashItemList(void *, void *, xmlChar *); /*proto*/
static void __pyx_f_4lxml_5etree__collectIdHashKeys(void *, void *, xmlChar *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__strip_attributes(xmlNode *, struct __pyx_obj_4lxml_5etree__MultiTagMatcher *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__strip_elements(struct LxmlDocument *, xmlNode *, struct __pyx_obj_4lxml_5etree__MultiTagMatcher *, int); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__strip_tags(struct LxmlDocument *, xmlNode *, struct __pyx_obj_4lxml_5etree__MultiTagMatcher *); /*proto*/
static void __pyx_f_4lxml_5etree__forwardXPathError(void *, xmlError const *); /*proto*/
static void __pyx_f_4lxml_5etree__receiveXPathError(void *, xmlError const *); /*proto*/
static xmlXPathObject *__pyx_f_4lxml_5etree__wrapXPathObject(PyObject *, struct LxmlDocument *, struct __pyx_obj_4lxml_5etree__BaseContext *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__unwrapXPathObject(xmlXPathObject *, struct LxmlDocument *, struct __pyx_obj_4lxml_5etree__BaseContext *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__createNodeSetResult(xmlXPathObject *, struct LxmlDocument *, struct __pyx_obj_4lxml_5etree__BaseContext *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__unpackNodeSetEntry(PyObject *, xmlNode *, struct LxmlDocument *, struct __pyx_obj_4lxml_5etree__BaseContext *, int); /*proto*/
static void __pyx_f_4lxml_5etree__freeXPathObject(xmlXPathObject *); /*proto*/
static struct LxmlElement *__pyx_f_4lxml_5etree__instantiateElementFromXPath(xmlNode *, struct LxmlDocument *, struct __pyx_obj_4lxml_5etree__BaseContext *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__elementStringResultFactory(PyObject *, struct LxmlElement *, PyObject *, int); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__buildElementStringResult(struct LxmlDocument *, xmlNode *, struct __pyx_obj_4lxml_5etree__BaseContext *); /*proto*/
static void __pyx_f_4lxml_5etree__extension_function_call(struct __pyx_obj_4lxml_5etree__BaseContext *, PyObject *, xmlXPathParserContext *, int); /*proto*/
static void __pyx_f_4lxml_5etree__xpath_function_call(xmlXPathParserContext *, int); /*proto*/
static int __pyx_f_4lxml_5etree__register_xpath_function(void *, PyObject *, PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__unregister_xpath_function(void *, PyObject *, PyObject *); /*proto*/
static void __pyx_f_4lxml_5etree__registerExsltFunctionsForNamespaces(void *, void *, const xmlChar *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__initXSLTResolverContext(struct __pyx_obj_4lxml_5etree__XSLTResolverContext *, struct __pyx_obj_4lxml_5etree__BaseParser *); /*proto*/
static xmlDoc *__pyx_f_4lxml_5etree__xslt_resolve_from_python(const xmlChar *, void *, int, int *); /*proto*/
static void __pyx_f_4lxml_5etree__xslt_store_resolver_exception(const xmlChar *, void *, xsltLoadType); /*proto*/
static xmlDoc *__pyx_f_4lxml_5etree__xslt_doc_loader(const xmlChar *, xmlDict *, int, void *, xsltLoadType); /*proto*/
static int __pyx_f_4lxml_5etree__register_xslt_function(void *, PyObject *, PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__convert_xslt_parameters(xsltTransformContext *, PyObject *, const char ***); /*proto*/
static struct __pyx_obj_4lxml_5etree_XSLT *__pyx_f_4lxml_5etree__copyXSLT(struct __pyx_obj_4lxml_5etree_XSLT *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__xsltResultTreeFactory(struct LxmlDocument *, struct __pyx_obj_4lxml_5etree_XSLT *, struct LxmlDocument *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__findStylesheetByID(struct LxmlDocument *, PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__registerXSLTExtensions(xsltTransformContext *, PyObject *); /*proto*/
static void __pyx_f_4lxml_5etree__callExtensionElement(xsltTransformContext *, xmlNode *, xmlNode *, void *); /*proto*/
static CYTHON_INLINE int __pyx_f_4lxml_5etree__assertValidDTDNode(PyObject *, void *); /*proto*/
static xmlDtd *__pyx_f_4lxml_5etree__parseDtdFromFilelike(PyObject *); /*proto*/
static struct __pyx_obj_4lxml_5etree_DTD *__pyx_f_4lxml_5etree__dtdFactory(xmlDtd *); /*proto*/
static xmlDtd *__pyx_f_4lxml_5etree__copyDtd(xmlDtd *); /*proto*/
static void __pyx_f_4lxml_5etree__linkDtdAttribute(xmlDtd *, xmlAttribute *); /*proto*/
static int __pyx_f_4lxml_5etree__isDtdNsDecl(xmlAttribute *); /*proto*/
static int __pyx_f_4lxml_5etree__require_rnc2rng(void); /*proto*/
__PYX_EXTERN_C struct LxmlElement *deepcopyNodeToDocument(struct LxmlDocument *, xmlNode *); /*proto*/
__PYX_EXTERN_C struct LxmlElementTree *elementTreeFactory(struct LxmlElement *); /*proto*/
__PYX_EXTERN_C struct LxmlElementTree *newElementTree(struct LxmlElement *, PyObject *); /*proto*/
__PYX_EXTERN_C struct LxmlElementTree *adoptExternalDocument(xmlDoc *, PyObject *, int); /*proto*/
__PYX_EXTERN_C struct LxmlElement *elementFactory(struct LxmlDocument *, xmlNode *); /*proto*/
__PYX_EXTERN_C struct LxmlElement *makeElement(PyObject *, struct LxmlDocument *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/
__PYX_EXTERN_C struct LxmlElement *makeSubElement(struct LxmlElement *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/
__PYX_EXTERN_C void setElementClassLookupFunction(_element_class_lookup_function, PyObject *); /*proto*/
__PYX_EXTERN_C PyObject *lookupDefaultElementClass(PyObject *, PyObject *, xmlNode *); /*proto*/
__PYX_EXTERN_C PyObject *lookupNamespaceElementClass(PyObject *, PyObject *, xmlNode *); /*proto*/
__PYX_EXTERN_C PyObject *callLookupFallback(struct LxmlFallbackElementClassLookup *, struct LxmlDocument *, xmlNode *); /*proto*/
__PYX_EXTERN_C int tagMatches(xmlNode *, const xmlChar *, const xmlChar *); /*proto*/
__PYX_EXTERN_C struct LxmlDocument *documentOrRaise(PyObject *); /*proto*/
__PYX_EXTERN_C struct LxmlElement *rootNodeOrRaise(PyObject *); /*proto*/
__PYX_EXTERN_C int hasText(xmlNode *); /*proto*/
__PYX_EXTERN_C int hasTail(xmlNode *); /*proto*/
__PYX_EXTERN_C PyObject *textOf(xmlNode *); /*proto*/
__PYX_EXTERN_C PyObject *tailOf(xmlNode *); /*proto*/
__PYX_EXTERN_C int setNodeText(xmlNode *, PyObject *); /*proto*/
__PYX_EXTERN_C int setTailText(xmlNode *, PyObject *); /*proto*/
__PYX_EXTERN_C PyObject *attributeValue(xmlNode *, xmlAttr *); /*proto*/
__PYX_EXTERN_C PyObject *attributeValueFromNsName(xmlNode *, const xmlChar *, const xmlChar *); /*proto*/
__PYX_EXTERN_C PyObject *getAttributeValue(struct LxmlElement *, PyObject *, PyObject *); /*proto*/
__PYX_EXTERN_C PyObject *iterattributes(struct LxmlElement *, int); /*proto*/
__PYX_EXTERN_C PyObject *collectAttributes(xmlNode *, int); /*proto*/
__PYX_EXTERN_C int setAttributeValue(struct LxmlElement *, PyObject *, PyObject *); /*proto*/
__PYX_EXTERN_C int delAttribute(struct LxmlElement *, PyObject *); /*proto*/
__PYX_EXTERN_C int delAttributeFromNsName(xmlNode *, const xmlChar *, const xmlChar *); /*proto*/
__PYX_EXTERN_C int hasChild(xmlNode *); /*proto*/
__PYX_EXTERN_C xmlNode *findChild(xmlNode *, Py_ssize_t); /*proto*/
__PYX_EXTERN_C xmlNode *findChildForwards(xmlNode *, Py_ssize_t); /*proto*/
__PYX_EXTERN_C xmlNode *findChildBackwards(xmlNode *, Py_ssize_t); /*proto*/
__PYX_EXTERN_C xmlNode *nextElement(xmlNode *); /*proto*/
__PYX_EXTERN_C xmlNode *previousElement(xmlNode *); /*proto*/
__PYX_EXTERN_C void appendChild(struct LxmlElement *, struct LxmlElement *); /*proto*/
__PYX_EXTERN_C int appendChildToElement(struct LxmlElement *, struct LxmlElement *); /*proto*/
__PYX_EXTERN_C PyObject *pyunicode(const xmlChar *); /*proto*/
__PYX_EXTERN_C PyObject *utf8(PyObject *); /*proto*/
__PYX_EXTERN_C PyObject *getNsTag(PyObject *); /*proto*/
__PYX_EXTERN_C PyObject *getNsTagWithEmptyNs(PyObject *); /*proto*/
__PYX_EXTERN_C PyObject *namespacedName(xmlNode *); /*proto*/
__PYX_EXTERN_C PyObject *namespacedNameFromNsName(const xmlChar *, const xmlChar *); /*proto*/
__PYX_EXTERN_C void iteratorStoreNext(struct LxmlElementIterator *, struct LxmlElement *); /*proto*/
__PYX_EXTERN_C void initTagMatch(struct LxmlElementTagMatcher *, PyObject *); /*proto*/
__PYX_EXTERN_C xmlNs *findOrBuildNodeNsPrefix(struct LxmlDocument *, xmlNode *, const xmlChar *, const xmlChar *); /*proto*/
static int __pyx_array_allocate_buffer(struct __pyx_array_obj *); /*proto*/
static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char const *, char *); /*proto*/
static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo const *); /*proto*/
static CYTHON_INLINE int __pyx_memoryview_check(PyObject *); /*proto*/
static PyObject *_unellipsify(PyObject *, int); /*proto*/
static int assert_direct_dimensions(Py_ssize_t *, int); /*proto*/
static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *, PyObject *); /*proto*/
static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int, int); /*proto*/
static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, Py_ssize_t); /*proto*/
static int __pyx_memslice_transpose(__Pyx_memviewslice *); /*proto*/
static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice, int, PyObject *(*)(char *), int (*)(char *, PyObject *), int); /*proto*/
static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *); /*proto*/
static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
static Py_ssize_t abs_py_ssize_t(Py_ssize_t); /*proto*/
static char __pyx_get_best_slice_order(__Pyx_memviewslice *, int); /*proto*/
static void _copy_strided_to_strided(char *, Py_ssize_t *, char *, Py_ssize_t *, Py_ssize_t *, Py_ssize_t *, int, size_t); /*proto*/
static void copy_strided_to_strided(__Pyx_memviewslice *, __Pyx_memviewslice *, int, size_t); /*proto*/
static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *, int); /*proto*/
static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *, Py_ssize_t *, Py_ssize_t, int, char); /*proto*/
static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *, __Pyx_memviewslice *, char, int); /*proto*/
static int __pyx_memoryview_err_extents(int, Py_ssize_t, Py_ssize_t); /*proto*/
static int __pyx_memoryview_err_dim(PyObject *, PyObject *, int); /*proto*/
static int __pyx_memoryview_err(PyObject *, PyObject *); /*proto*/
static int __pyx_memoryview_err_no_memory(void); /*proto*/
static int __pyx_memoryview_copy_contents(__Pyx_memviewslice, __Pyx_memviewslice, int, int, int); /*proto*/
static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *, int, int); /*proto*/
static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *, int, int, int); /*proto*/
static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/
static void __pyx_memoryview_refcount_objects_in_slice(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/
static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *, int, size_t, void *, int); /*proto*/
static void __pyx_memoryview__slice_assign_scalar(char *, Py_ssize_t *, Py_ssize_t *, int, size_t, void *); /*proto*/
static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *, PyObject *); /*proto*/
/* #### Code section: typeinfo ### */
static const __Pyx_TypeInfo __Pyx_TypeInfo_unsigned_char__const__ = { "const unsigned char", NULL, sizeof(unsigned char const ), { 0 }, 0, __PYX_IS_UNSIGNED(unsigned char const ) ? 'U' : 'I', __PYX_IS_UNSIGNED(unsigned char const ), 0 };
/* #### Code section: before_global_var ### */
#define __Pyx_MODULE_NAME "lxml.etree"
extern int __pyx_module_is_main_lxml__etree;
int __pyx_module_is_main_lxml__etree = 0;

/* Implementation of "lxml.etree" */
/* #### Code section: global_var ### */
static PyObject *__pyx_builtin_print;
static PyObject *__pyx_builtin_object;
static PyObject *__pyx_builtin_property;
static PyObject *__pyx_builtin_staticmethod;
static PyObject *__pyx_builtin_super;
static PyObject *__pyx_builtin_id;
static PyObject *__pyx_builtin_enumerate;
static PyObject *__pyx_builtin_NotImplemented;
static PyObject *__pyx_builtin_reversed;
static PyObject *__pyx_builtin_open;
static PyObject *__pyx_builtin_sorted;
static PyObject *__pyx_builtin___import__;
static PyObject *__pyx_builtin_Ellipsis;
/* #### Code section: string_decls ### */
static const char __pyx_k_9[] = "&#9;";
static const char __pyx_k_c[] = "c";
static const char __pyx_k_10[] = "&#10;";
static const char __pyx_k_13[] = "&#13;";
static const char __pyx_k__3[] = ">";
static const char __pyx_k__7[] = " ";
static const char __pyx_k__8[] = "";
static const char __pyx_k__9[] = ":";
static const char __pyx_k_gt[] = "&gt;";
static const char __pyx_k_lt[] = "&lt;";
static const char __pyx_k__12[] = "\n";
static const char __pyx_k__14[] = "\"";
static const char __pyx_k__15[] = "\" ";
static const char __pyx_k__31[] = "'?>\n";
static const char __pyx_k__32[] = ">\n";
static const char __pyx_k__33[] = " [\n";
static const char __pyx_k__34[] = "]>\n";
static const char __pyx_k__35[] = "]]>";
static const char __pyx_k__37[] = "<";
static const char __pyx_k__38[] = "=\"";
static const char __pyx_k__39[] = "</";
static const char __pyx_k_amp[] = "&amp;";
static const char __pyx_k_name[] = "name";
static const char __pyx_k_quot[] = "&quot;";
static const char __pyx_k_CDATA[] = "<![CDATA[";
static const char __pyx_k_UTF_8[] = "UTF-8";
static const char __pyx_k_PUBLIC[] = " PUBLIC \"";
static const char __pyx_k_SYSTEM[] = " SYSTEM ";
static const char __pyx_k_file_s[] = "file %s";
static const char __pyx_k_line_d[] = "line %d";
static const char __pyx_k_DOCTYPE[] = "<!DOCTYPE ";
static const char __pyx_k_UCS_4BE[] = "UCS-4BE";
static const char __pyx_k_UCS_4LE[] = "UCS-4LE";
static const char __pyx_k_fortran[] = "fortran";
static const char __pyx_k_replace[] = "replace";
static const char __pyx_k_xmlns_2[] = "xmlns";
static const char __pyx_k_UTF_16BE[] = "UTF-16BE";
static const char __pyx_k_UTF_16LE[] = "UTF-16LE";
static const char __pyx_k_UTF_32BE[] = "UTF-32BE";
static const char __pyx_k_UTF_32LE[] = "UTF-32LE";
static const char __pyx_k_element_s[] = "element %s";
static const char __pyx_k_ISO_8859_1[] = "ISO-8859-1";
static const char __pyx_k_encoding_2[] = "' encoding='";
static const char __pyx_k_s_element_s[] = "%s, element '%s'";
static const char __pyx_k_xml_version[] = "<?xml version='";
static const char __pyx_k_standalone_no[] = "' standalone='no'?>\n";
static const char __pyx_k_standalone_yes[] = "' standalone='yes'?>\n";
static const char __pyx_k_backslashreplace[] = "backslashreplace";
static const char __pyx_k_string___STRING__XSLT[] = "string://__STRING__XSLT";
static const char __pyx_k_The_lxml_etree_module_implement[] = "\nThe ``lxml.etree`` module implements the extended ElementTree API for XML.\n";
/* #### Code section: decls ### */
static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer); /* proto */
static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr); /* proto */
static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item); /* proto */
static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object); /* proto */
static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto */
static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto */
static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_17_ImmutableMapping___getitem__(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_17_ImmutableMapping_2__setitem__(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_key, CYTHON_UNUSED PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_17_ImmutableMapping_4__delitem__(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_17_ImmutableMapping_6__contains__(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_17_ImmutableMapping_8__len__(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_17_ImmutableMapping_10__iter__(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_register_namespace(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_prefix, PyObject *__pyx_v_uri); /* proto */
static int __pyx_pf_4lxml_5etree_9LxmlError___init__(struct __pyx_obj_4lxml_5etree_LxmlError *__pyx_v_self, PyObject *__pyx_v_message, PyObject *__pyx_v_error_log); /* proto */
static int __pyx_pf_4lxml_5etree_10_TempStore___init__(struct __pyx_obj_4lxml_5etree__TempStore *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_2clear_error_log(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static void __pyx_pf_4lxml_5etree_9_LogEntry___dealloc__(struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_2__repr__(struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_11domain_name___get__(struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_9type_name___get__(struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_10level_name___get__(struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_7message___get__(struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_8filename___get__(struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_4path___get__(struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_6domain___get__(struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_4type___get__(struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_5level___get__(struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_4line___get__(struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_6column___get__(struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_13_BaseErrorLog___init__(struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_self, PyObject *__pyx_v_first_error, PyObject *__pyx_v_last_error); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_13_BaseErrorLog_2copy(struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_13_BaseErrorLog_4__repr__(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_13_BaseErrorLog_6receive(struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_self, struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_entry); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_13_BaseErrorLog_10last_error___get__(struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_13_ListErrorLog___init__(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self, PyObject *__pyx_v_entries, PyObject *__pyx_v_first_error, PyObject *__pyx_v_last_error); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_2copy(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_4__iter__(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_6__repr__(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_8__getitem__(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self, PyObject *__pyx_v_index); /* proto */
static Py_ssize_t __pyx_pf_4lxml_5etree_13_ListErrorLog_10__len__(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_13_ListErrorLog_12__contains__(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self, PyObject *__pyx_v_error_type); /* proto */
static int __pyx_pf_4lxml_5etree_13_ListErrorLog_14__bool__(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_16filter_domains(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self, PyObject *__pyx_v_domains); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_18filter_types(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self, PyObject *__pyx_v_types); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_20filter_levels(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self, PyObject *__pyx_v_levels); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_22filter_from_level(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self, PyObject *__pyx_v_level); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_24filter_from_fatals(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_26filter_from_errors(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_28filter_from_warnings(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_9_ErrorLog___cinit__(struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_9_ErrorLog_2__init__(struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9_ErrorLog_4__exit__(struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9_ErrorLog_6clear(struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9_ErrorLog_8copy(struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9_ErrorLog_10__iter__(struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9_ErrorLog_12receive(struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_self, struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_entry); /* proto */
static int __pyx_pf_4lxml_5etree_15_DomainErrorLog___init__(struct __pyx_obj_4lxml_5etree__DomainErrorLog *__pyx_v_self, PyObject *__pyx_v_domains); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_15_DomainErrorLog_2receive(struct __pyx_obj_4lxml_5etree__DomainErrorLog *__pyx_v_self, struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_entry); /* proto */
static int __pyx_pf_4lxml_5etree_17_RotatingErrorLog___init__(struct __pyx_obj_4lxml_5etree__RotatingErrorLog *__pyx_v_self, PyObject *__pyx_v_max_len); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_17_RotatingErrorLog_2receive(struct __pyx_obj_4lxml_5etree__RotatingErrorLog *__pyx_v_self, struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_entry); /* proto */
static int __pyx_pf_4lxml_5etree_10PyErrorLog___init__(struct __pyx_obj_4lxml_5etree_PyErrorLog *__pyx_v_self, PyObject *__pyx_v_logger_name, PyObject *__pyx_v_logger); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_10PyErrorLog_2copy(struct __pyx_obj_4lxml_5etree_PyErrorLog *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_10PyErrorLog_4log(struct __pyx_obj_4lxml_5etree_PyErrorLog *__pyx_v_self, PyObject *__pyx_v_log_entry, PyObject *__pyx_v_message, PyObject *__pyx_v_args); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_10PyErrorLog_6receive(struct __pyx_obj_4lxml_5etree_PyErrorLog *__pyx_v_self, struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_log_entry); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_10PyErrorLog_9level_map___get__(struct __pyx_obj_4lxml_5etree_PyErrorLog *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_4use_global_python_log(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_4lxml_5etree_PyErrorLog *__pyx_v_log); /* proto */
static void __pyx_pf_4lxml_5etree_9_Document___dealloc__(struct LxmlDocument *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_7DocInfo___cinit__(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self, PyObject *__pyx_v_tree); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_9root_name___get__(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_2clear(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_9public_id___get__(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_7DocInfo_9public_id_2__set__(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_10system_url___get__(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_7DocInfo_10system_url_2__set__(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_11xml_version___get__(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_8encoding___get__(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_10standalone___get__(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_3URL___get__(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_7DocInfo_3URL_2__set__(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self, PyObject *__pyx_v_url); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_7doctype___get__(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_11internalDTD___get__(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_11externalDTD___get__(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element__init(CYTHON_UNUSED struct LxmlElement *__pyx_v_self); /* proto */
static void __pyx_pf_4lxml_5etree_8_Element_2__dealloc__(struct LxmlElement *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_8_Element_4__setitem__(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_4lxml_5etree_8_Element_6__delitem__(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_8__deepcopy__(struct LxmlElement *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_memo); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_10__copy__(struct LxmlElement *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_12set(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_14append(struct LxmlElement *__pyx_v_self, struct LxmlElement *__pyx_v_element); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_16addnext(struct LxmlElement *__pyx_v_self, struct LxmlElement *__pyx_v_element); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_18addprevious(struct LxmlElement *__pyx_v_self, struct LxmlElement *__pyx_v_element); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_20extend(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_elements); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_22clear(struct LxmlElement *__pyx_v_self, int __pyx_v_keep_tail); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_24insert(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_index, struct LxmlElement *__pyx_v_element); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_26remove(struct LxmlElement *__pyx_v_self, struct LxmlElement *__pyx_v_element); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_28replace(struct LxmlElement *__pyx_v_self, struct LxmlElement *__pyx_v_old_element, struct LxmlElement *__pyx_v_new_element); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_3tag___get__(struct LxmlElement *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_8_Element_3tag_2__set__(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_6attrib___get__(struct LxmlElement *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_4text___get__(struct LxmlElement *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_8_Element_4text_2__set__(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_4tail___get__(struct LxmlElement *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_8_Element_4tail_2__set__(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_6prefix___get__(struct LxmlElement *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_10sourceline___get__(struct LxmlElement *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_8_Element_10sourceline_2__set__(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_line); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_5nsmap___get__(struct LxmlElement *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_4base___get__(struct LxmlElement *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_8_Element_4base_2__set__(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_url); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_30__repr__(struct LxmlElement *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_32__getitem__(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static Py_ssize_t __pyx_pf_4lxml_5etree_8_Element_34__len__(struct LxmlElement *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_8_Element_36__bool__(struct LxmlElement *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_8_Element_38__contains__(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_element); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_40__iter__(struct LxmlElement *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_42__reversed__(struct LxmlElement *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_44index(struct LxmlElement *__pyx_v_self, struct LxmlElement *__pyx_v_child, PyObject *__pyx_v_start, PyObject *__pyx_v_stop); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_46get(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_48keys(struct LxmlElement *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_50values(struct LxmlElement *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_52items(struct LxmlElement *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_54getchildren(struct LxmlElement *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_56getparent(struct LxmlElement *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_58getnext(struct LxmlElement *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_60getprevious(struct LxmlElement *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_62itersiblings(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_preceding, PyObject *__pyx_v_tags); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_64iterancestors(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_tags); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_66iterdescendants(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_tags); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_68iterchildren(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_reversed, PyObject *__pyx_v_tags); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_70getroottree(struct LxmlElement *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_72getiterator(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_tags); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_74iter(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_tags); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_76itertext(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_with_tail, PyObject *__pyx_v_tags); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_78makeelement(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v__tag, PyObject *__pyx_v_attrib, PyObject *__pyx_v_nsmap, PyObject *__pyx_v__extra); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_80find(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_namespaces); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_82findtext(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_default, PyObject *__pyx_v_namespaces); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_84findall(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_namespaces); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_86iterfind(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_namespaces); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_88xpath(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v__path, PyObject *__pyx_v_namespaces, PyObject *__pyx_v_extensions, PyObject *__pyx_v_smart_strings, PyObject *__pyx_v__variables); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_90cssselect(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_expr, PyObject *__pyx_v_translator); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_set(struct __pyx_obj_4lxml_5etree___ContentOnlyElement *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_key, CYTHON_UNUSED PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_2append(struct __pyx_obj_4lxml_5etree___ContentOnlyElement *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_4insert(struct __pyx_obj_4lxml_5etree___ContentOnlyElement *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_index, CYTHON_UNUSED PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_4lxml_5etree_20__ContentOnlyElement_6__setitem__(struct __pyx_obj_4lxml_5etree___ContentOnlyElement *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_index, CYTHON_UNUSED PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_6attrib___get__(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree___ContentOnlyElement *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_4text___get__(struct __pyx_obj_4lxml_5etree___ContentOnlyElement *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_20__ContentOnlyElement_4text_2__set__(struct __pyx_obj_4lxml_5etree___ContentOnlyElement *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_8__getitem__(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree___ContentOnlyElement *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static Py_ssize_t __pyx_pf_4lxml_5etree_20__ContentOnlyElement_10__len__(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree___ContentOnlyElement *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_12get(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree___ContentOnlyElement *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_key, CYTHON_UNUSED PyObject *__pyx_v_default); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_14keys(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree___ContentOnlyElement *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_16items(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree___ContentOnlyElement *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_18values(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree___ContentOnlyElement *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Comment_3tag___get__(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__Comment *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Comment___repr__(struct __pyx_obj_4lxml_5etree__Comment *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_22_ProcessingInstruction_3tag___get__(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__ProcessingInstruction *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_22_ProcessingInstruction_6target___get__(struct __pyx_obj_4lxml_5etree__ProcessingInstruction *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_22_ProcessingInstruction_6target_2__set__(struct __pyx_obj_4lxml_5etree__ProcessingInstruction *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_22_ProcessingInstruction___repr__(struct __pyx_obj_4lxml_5etree__ProcessingInstruction *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_22_ProcessingInstruction_2get(struct __pyx_obj_4lxml_5etree__ProcessingInstruction *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_22_ProcessingInstruction_6attrib___get__(struct __pyx_obj_4lxml_5etree__ProcessingInstruction *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_Entity_3tag___get__(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__Entity *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_Entity_4name___get__(struct __pyx_obj_4lxml_5etree__Entity *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_7_Entity_4name_2__set__(struct __pyx_obj_4lxml_5etree__Entity *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_Entity_4text___get__(struct __pyx_obj_4lxml_5etree__Entity *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_Entity___repr__(struct __pyx_obj_4lxml_5etree__Entity *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_5QName___init__(struct __pyx_obj_4lxml_5etree_QName *__pyx_v_self, PyObject *__pyx_v_text_or_uri_or_element, PyObject *__pyx_v_tag); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_5QName_2__str__(struct __pyx_obj_4lxml_5etree_QName *__pyx_v_self); /* proto */
static Py_hash_t __pyx_pf_4lxml_5etree_5QName_4__hash__(struct __pyx_obj_4lxml_5etree_QName *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_5QName_6__richcmp__(struct __pyx_obj_4lxml_5etree_QName *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_5QName_4text___get__(struct __pyx_obj_4lxml_5etree_QName *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_5QName_9localname___get__(struct __pyx_obj_4lxml_5etree_QName *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_5QName_9namespace___get__(struct __pyx_obj_4lxml_5etree_QName *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_parse(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v_source, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser, PyObject *__pyx_v_base_url); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_2_setroot(struct LxmlElementTree *__pyx_v_self, struct LxmlElement *__pyx_v_root); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_4getroot(struct LxmlElementTree *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_6__copy__(struct LxmlElementTree *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_8__deepcopy__(struct LxmlElementTree *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_memo); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_7docinfo___get__(struct LxmlElementTree *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_6parser___get__(struct LxmlElementTree *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_10write(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v_file, PyObject *__pyx_v_encoding, PyObject *__pyx_v_method, int __pyx_v_pretty_print, PyObject *__pyx_v_xml_declaration, int __pyx_v_with_tail, PyObject *__pyx_v_standalone, PyObject *__pyx_v_doctype, PyObject *__pyx_v_compression, int __pyx_v_exclusive, PyObject *__pyx_v_inclusive_ns_prefixes, int __pyx_v_with_comments, int __pyx_v_strip_text, PyObject *__pyx_v_docstring); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_12getpath(struct LxmlElementTree *__pyx_v_self, struct LxmlElement *__pyx_v_element); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_14getelementpath(struct LxmlElementTree *__pyx_v_self, struct LxmlElement *__pyx_v_element); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_16getiterator(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_tags); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_18iter(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_tags); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_20find(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_namespaces); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_22findtext(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_default, PyObject *__pyx_v_namespaces); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_24findall(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_namespaces); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_26iterfind(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_namespaces); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_28xpath(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v__path, PyObject *__pyx_v_namespaces, PyObject *__pyx_v_extensions, PyObject *__pyx_v_smart_strings, PyObject *__pyx_v__variables); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_30xslt(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v__xslt, PyObject *__pyx_v_extensions, PyObject *__pyx_v_access_control, PyObject *__pyx_v__kw); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_32relaxng(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v_relaxng); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_34xmlschema(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v_xmlschema); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_36xinclude(struct LxmlElementTree *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_38write_c14n(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v_file, int __pyx_v_exclusive, int __pyx_v_with_comments, PyObject *__pyx_v_compression, PyObject *__pyx_v_inclusive_ns_prefixes); /* proto */
static int __pyx_pf_4lxml_5etree_7_Attrib___cinit__(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self, struct LxmlElement *__pyx_v_element); /* proto */
static int __pyx_pf_4lxml_5etree_7_Attrib_2__setitem__(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_4lxml_5etree_7_Attrib_4__delitem__(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_6update(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self, PyObject *__pyx_v_sequence_or_dict); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_8pop(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_10clear(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_12__repr__(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_14__copy__(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_16__deepcopy__(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_memo); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_18__getitem__(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static int __pyx_pf_4lxml_5etree_7_Attrib_20__bool__(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_pf_4lxml_5etree_7_Attrib_22__len__(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_24get(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_26keys(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_28__iter__(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_30iterkeys(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_32values(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_34itervalues(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_36items(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_38iteritems(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_40has_key(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static int __pyx_pf_4lxml_5etree_7_Attrib_42__contains__(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_44__richcmp__(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_15_AttribIterator___iter__(struct __pyx_obj_4lxml_5etree__AttribIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_15_AttribIterator_2__next__(struct __pyx_obj_4lxml_5etree__AttribIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_16_ElementIterator___iter__(struct LxmlElementIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_16_ElementIterator_2__next__(struct LxmlElementIterator *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_16_MultiTagMatcher___cinit__(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *__pyx_v_self, PyObject *__pyx_v_tags); /* proto */
static void __pyx_pf_4lxml_5etree_16_MultiTagMatcher_2__dealloc__(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_21_ElementMatchIterator___iter__(struct __pyx_obj_4lxml_5etree__ElementMatchIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_21_ElementMatchIterator_2__next__(struct __pyx_obj_4lxml_5etree__ElementMatchIterator *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_20ElementChildIterator___cinit__(struct __pyx_obj_4lxml_5etree_ElementChildIterator *__pyx_v_self, struct LxmlElement *__pyx_v_node, PyObject *__pyx_v_tag, int __pyx_v_reversed); /* proto */
static int __pyx_pf_4lxml_5etree_16SiblingsIterator___cinit__(struct __pyx_obj_4lxml_5etree_SiblingsIterator *__pyx_v_self, struct LxmlElement *__pyx_v_node, PyObject *__pyx_v_tag, int __pyx_v_preceding); /* proto */
static int __pyx_pf_4lxml_5etree_17AncestorsIterator___cinit__(struct __pyx_obj_4lxml_5etree_AncestorsIterator *__pyx_v_self, struct LxmlElement *__pyx_v_node, PyObject *__pyx_v_tag); /* proto */
static int __pyx_pf_4lxml_5etree_25ElementDepthFirstIterator___cinit__(struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *__pyx_v_self, struct LxmlElement *__pyx_v_node, PyObject *__pyx_v_tag, int __pyx_v_inclusive); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_25ElementDepthFirstIterator_2__iter__(struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_25ElementDepthFirstIterator_4__next__(struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_19ElementTextIterator___cinit__(struct __pyx_obj_4lxml_5etree_ElementTextIterator *__pyx_v_self, struct LxmlElement *__pyx_v_element, PyObject *__pyx_v_tag, int __pyx_v_with_tail); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_19ElementTextIterator_2__iter__(struct __pyx_obj_4lxml_5etree_ElementTextIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_19ElementTextIterator_4__next__(struct __pyx_obj_4lxml_5etree_ElementTextIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7Element___new__(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_cls, PyObject *__pyx_v__tag, PyObject *__pyx_v_attrib, PyObject *__pyx_v_nsmap, PyObject *__pyx_v__extra); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_6Comment(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_text); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8ProcessingInstruction(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_target, PyObject *__pyx_v_text); /* proto */
static int __pyx_pf_4lxml_5etree_5CDATA___cinit__(struct __pyx_obj_4lxml_5etree_CDATA *__pyx_v_self, PyObject *__pyx_v_data); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_10Entity(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12SubElement(CYTHON_UNUSED PyObject *__pyx_self, struct LxmlElement *__pyx_v__parent, PyObject *__pyx_v__tag, PyObject *__pyx_v_attrib, PyObject *__pyx_v_nsmap, PyObject *__pyx_v__extra); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_11ElementTree___new__(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_cls, struct LxmlElement *__pyx_v_element, PyObject *__pyx_v_file, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_14HTML(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_text, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser, PyObject *__pyx_v_base_url); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_16XML(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_text, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser, PyObject *__pyx_v_base_url); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_18fromstring(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_text, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser, PyObject *__pyx_v_base_url); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_20fromstringlist(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_strings, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_22iselement(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_element); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_24indent(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tree, PyObject *__pyx_v_space, Py_ssize_t __pyx_v_level); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_26dump(CYTHON_UNUSED PyObject *__pyx_self, struct LxmlElement *__pyx_v_elem, int __pyx_v_pretty_print, int __pyx_v_with_tail); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_28tostring(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_element_or_tree, PyObject *__pyx_v_encoding, PyObject *__pyx_v_method, PyObject *__pyx_v_xml_declaration, int __pyx_v_pretty_print, int __pyx_v_with_tail, PyObject *__pyx_v_standalone, PyObject *__pyx_v_doctype, int __pyx_v_exclusive, PyObject *__pyx_v_inclusive_ns_prefixes, int __pyx_v_with_comments, int __pyx_v_strip_text); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_30tostringlist(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_element_or_tree, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_32tounicode(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_element_or_tree, PyObject *__pyx_v_method, int __pyx_v_pretty_print, int __pyx_v_with_tail, PyObject *__pyx_v_doctype); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_34parse(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_source, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser, PyObject *__pyx_v_base_url); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_36adopt_external_document(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_capsule, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser); /* proto */
static int __pyx_pf_4lxml_5etree_14_ReadOnlyProxy___cinit__(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_3tag___get__(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_4text___get__(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_4tail___get__(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_10sourceline___get__(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_2__repr__(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_4__getitem__(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static Py_ssize_t __pyx_pf_4lxml_5etree_14_ReadOnlyProxy_6__len__(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_14_ReadOnlyProxy_8__bool__(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_10__deepcopy__(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_memo); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_12__copy__(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_14__iter__(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_16iterchildren(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_reversed); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_18getchildren(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_20getparent(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_22getnext(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_24getprevious(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_16_ReadOnlyPIProxy_6target___get__(struct __pyx_obj_4lxml_5etree__ReadOnlyPIProxy *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_20_ReadOnlyEntityProxy_4name___get__(struct __pyx_obj_4lxml_5etree__ReadOnlyEntityProxy *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_20_ReadOnlyEntityProxy_4name_2__set__(struct __pyx_obj_4lxml_5etree__ReadOnlyEntityProxy *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_20_ReadOnlyEntityProxy_4text___get__(struct __pyx_obj_4lxml_5etree__ReadOnlyEntityProxy *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_6attrib___get__(struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_6prefix___get__(struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_5nsmap___get__(struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_get(struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_2keys(struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_4values(struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_6items(struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_18_OpaqueNodeWrapper___init__(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__OpaqueNodeWrapper *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_22_OpaqueDocumentWrapper_append(struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper *__pyx_v_self, PyObject *__pyx_v_other_element); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_22_OpaqueDocumentWrapper_2extend(struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper *__pyx_v_self, PyObject *__pyx_v_elements); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_23_ModifyContentOnlyProxy_4text___get__(struct __pyx_obj_4lxml_5etree__ModifyContentOnlyProxy *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_23_ModifyContentOnlyProxy_4text_2__set__(struct __pyx_obj_4lxml_5etree__ModifyContentOnlyProxy *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_25_ModifyContentOnlyPIProxy_6target___get__(struct __pyx_obj_4lxml_5etree__ModifyContentOnlyPIProxy *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_25_ModifyContentOnlyPIProxy_6target_2__set__(struct __pyx_obj_4lxml_5etree__ModifyContentOnlyPIProxy *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_29_ModifyContentOnlyEntityProxy_4name___get__(struct __pyx_obj_4lxml_5etree__ModifyContentOnlyEntityProxy *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_29_ModifyContentOnlyEntityProxy_4name_2__set__(struct __pyx_obj_4lxml_5etree__ModifyContentOnlyEntityProxy *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_23_AppendOnlyElementProxy_append(struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *__pyx_v_self, PyObject *__pyx_v_other_element); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_23_AppendOnlyElementProxy_2extend(struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *__pyx_v_self, PyObject *__pyx_v_elements); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_23_AppendOnlyElementProxy_4text___get__(struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_23_AppendOnlyElementProxy_4text_2__set__(struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_4lxml_5etree_11ElementBase___init__(struct LxmlElementBase *__pyx_v_self, PyObject *__pyx_v_attrib, PyObject *__pyx_v_nsmap, PyObject *__pyx_v_children, PyObject *__pyx_v__extra); /* proto */
static int __pyx_pf_4lxml_5etree_11CommentBase___init__(struct __pyx_obj_4lxml_5etree_CommentBase *__pyx_v_self, PyObject *__pyx_v_text); /* proto */
static int __pyx_pf_4lxml_5etree_6PIBase___init__(struct __pyx_obj_4lxml_5etree_PIBase *__pyx_v_self, PyObject *__pyx_v_target, PyObject *__pyx_v_text); /* proto */
static int __pyx_pf_4lxml_5etree_10EntityBase___init__(struct __pyx_obj_4lxml_5etree_EntityBase *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
static int __pyx_pf_4lxml_5etree_26FallbackElementClassLookup___cinit__(struct LxmlFallbackElementClassLookup *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_26FallbackElementClassLookup_2__init__(struct LxmlFallbackElementClassLookup *__pyx_v_self, struct LxmlElementClassLookup *__pyx_v_fallback); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_26FallbackElementClassLookup_4set_fallback(struct LxmlFallbackElementClassLookup *__pyx_v_self, struct LxmlElementClassLookup *__pyx_v_lookup); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_26FallbackElementClassLookup_8fallback___get__(struct LxmlFallbackElementClassLookup *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_25ElementDefaultClassLookup___cinit__(struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_25ElementDefaultClassLookup_2__init__(struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *__pyx_v_self, PyObject *__pyx_v_element, PyObject *__pyx_v_comment, PyObject *__pyx_v_pi, PyObject *__pyx_v_entity); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_25ElementDefaultClassLookup_13element_class___get__(struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_25ElementDefaultClassLookup_13comment_class___get__(struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_25ElementDefaultClassLookup_8pi_class___get__(struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_25ElementDefaultClassLookup_12entity_class___get__(struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_32AttributeBasedElementClassLookup___cinit__(struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_32AttributeBasedElementClassLookup_2__init__(struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup *__pyx_v_self, PyObject *__pyx_v_attribute_name, PyObject *__pyx_v_class_mapping, struct LxmlElementClassLookup *__pyx_v_fallback); /* proto */
static int __pyx_pf_4lxml_5etree_29ParserBasedElementClassLookup___cinit__(struct __pyx_obj_4lxml_5etree_ParserBasedElementClassLookup *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_24CustomElementClassLookup___cinit__(struct __pyx_obj_4lxml_5etree_CustomElementClassLookup *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_24CustomElementClassLookup_2lookup(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree_CustomElementClassLookup *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_type, CYTHON_UNUSED PyObject *__pyx_v_doc, CYTHON_UNUSED PyObject *__pyx_v_namespace, CYTHON_UNUSED PyObject *__pyx_v_name); /* proto */
static int __pyx_pf_4lxml_5etree_24PythonElementClassLookup___cinit__(struct __pyx_obj_4lxml_5etree_PythonElementClassLookup *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_24PythonElementClassLookup_2lookup(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree_PythonElementClassLookup *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_doc, CYTHON_UNUSED PyObject *__pyx_v_element); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_38set_element_class_lookup(CYTHON_UNUSED PyObject *__pyx_self, struct LxmlElementClassLookup *__pyx_v_lookup); /* proto */
static int __pyx_pf_4lxml_5etree_18_NamespaceRegistry___cinit__(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *__pyx_v_self, PyObject *__pyx_v_ns_uri); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_18_NamespaceRegistry_2update(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *__pyx_v_self, PyObject *__pyx_v_class_dict_iterable); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_18_NamespaceRegistry_4__getitem__(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
static int __pyx_pf_4lxml_5etree_18_NamespaceRegistry_6__delitem__(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_18_NamespaceRegistry_8__iter__(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_18_NamespaceRegistry_10items(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_18_NamespaceRegistry_12iteritems(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_18_NamespaceRegistry_14clear(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_18_NamespaceRegistry_16__call__(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *__pyx_v_self, PyObject *__pyx_v_obj); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_18_NamespaceRegistry_18__deco(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_obj); /* proto */
static int __pyx_pf_4lxml_5etree_23_ClassNamespaceRegistry___setitem__(struct __pyx_obj_4lxml_5etree__ClassNamespaceRegistry *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_item); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_23_ClassNamespaceRegistry_2__repr__(struct __pyx_obj_4lxml_5etree__ClassNamespaceRegistry *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_27ElementNamespaceClassLookup___cinit__(struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_27ElementNamespaceClassLookup_2__init__(struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *__pyx_v_self, struct LxmlElementClassLookup *__pyx_v_fallback); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_27ElementNamespaceClassLookup_4get_namespace(struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *__pyx_v_self, PyObject *__pyx_v_ns_uri); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_40FunctionNamespace(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_ns_uri); /* proto */
static int __pyx_pf_4lxml_5etree_26_FunctionNamespaceRegistry___setitem__(struct __pyx_obj_4lxml_5etree__FunctionNamespaceRegistry *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_item); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_26_FunctionNamespaceRegistry_2__repr__(struct __pyx_obj_4lxml_5etree__FunctionNamespaceRegistry *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_31_XPathFunctionNamespaceRegistry_6prefix___del__(struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_31_XPathFunctionNamespaceRegistry_6prefix_2__get__(struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_31_XPathFunctionNamespaceRegistry_6prefix_4__set__(struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *__pyx_v_self, PyObject *__pyx_v_prefix); /* proto */
static int __pyx_pf_4lxml_5etree_14_InputDocument___cinit__(struct __pyx_obj_4lxml_5etree__InputDocument *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8Resolver_resolve(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree_Resolver *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_system_url, CYTHON_UNUSED PyObject *__pyx_v_public_id, CYTHON_UNUSED PyObject *__pyx_v_context); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8Resolver_2resolve_empty(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree_Resolver *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_context); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8Resolver_4resolve_string(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree_Resolver *__pyx_v_self, PyObject *__pyx_v_string, CYTHON_UNUSED PyObject *__pyx_v_context, PyObject *__pyx_v_base_url); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8Resolver_6resolve_filename(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree_Resolver *__pyx_v_self, PyObject *__pyx_v_filename, CYTHON_UNUSED PyObject *__pyx_v_context); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8Resolver_8resolve_file(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree_Resolver *__pyx_v_self, PyObject *__pyx_v_f, CYTHON_UNUSED PyObject *__pyx_v_context, PyObject *__pyx_v_base_url, int __pyx_v_close); /* proto */
static int __pyx_pf_4lxml_5etree_17_ResolverRegistry___cinit__(struct __pyx_obj_4lxml_5etree__ResolverRegistry *__pyx_v_self, struct __pyx_obj_4lxml_5etree_Resolver *__pyx_v_default_resolver); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_17_ResolverRegistry_2add(struct __pyx_obj_4lxml_5etree__ResolverRegistry *__pyx_v_self, struct __pyx_obj_4lxml_5etree_Resolver *__pyx_v_resolver); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_17_ResolverRegistry_4remove(struct __pyx_obj_4lxml_5etree__ResolverRegistry *__pyx_v_self, PyObject *__pyx_v_resolver); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_17_ResolverRegistry_6copy(struct __pyx_obj_4lxml_5etree__ResolverRegistry *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_17_ResolverRegistry_8resolve(struct __pyx_obj_4lxml_5etree__ResolverRegistry *__pyx_v_self, PyObject *__pyx_v_system_url, PyObject *__pyx_v_public_id, PyObject *__pyx_v_context); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_17_ResolverRegistry_10__repr__(struct __pyx_obj_4lxml_5etree__ResolverRegistry *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_42_GenericAlias(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cls, PyObject *__pyx_v_item); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_10ParseError___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_message, PyObject *__pyx_v_code, PyObject *__pyx_v_line, PyObject *__pyx_v_column, PyObject *__pyx_v_filename); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_10ParseError_2position(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_10ParseError_4position(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_new_pos); /* proto */
static int __pyx_pf_4lxml_5etree_24_ParserDictionaryContext___cinit__(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self); /* proto */
static void __pyx_pf_4lxml_5etree_24_ParserDictionaryContext_2__dealloc__(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_18_FileReaderContext___cinit__(struct __pyx_obj_4lxml_5etree__FileReaderContext *__pyx_v_self, PyObject *__pyx_v_filelike, PyObject *__pyx_v_exc_context, PyObject *__pyx_v_url, PyObject *__pyx_v_encoding, int __pyx_v_close_file); /* proto */
static int __pyx_pf_4lxml_5etree_14_ParserContext___cinit__(struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_self); /* proto */
static void __pyx_pf_4lxml_5etree_14_ParserContext_2__dealloc__(struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_11_BaseParser___init__(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self, int __pyx_v_parse_options, int __pyx_v_for_html, struct __pyx_obj_4lxml_5etree_XMLSchema *__pyx_v_schema, PyObject *__pyx_v_remove_comments, PyObject *__pyx_v_remove_pis, PyObject *__pyx_v_strip_cdata, PyObject *__pyx_v_collect_ids, PyObject *__pyx_v_target, PyObject *__pyx_v_encoding, int __pyx_v_resolve_external_entities); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_11_BaseParser_9error_log___get__(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_11_BaseParser_9resolvers___get__(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_11_BaseParser_7version___get__(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_11_BaseParser_2set_element_class_lookup(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self, struct LxmlElementClassLookup *__pyx_v_lookup); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_11_BaseParser_4copy(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_11_BaseParser_6makeelement(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self, PyObject *__pyx_v__tag, PyObject *__pyx_v_attrib, PyObject *__pyx_v_nsmap, PyObject *__pyx_v__extra); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_11_BaseParser_6target___get__(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_11_FeedParser_14feed_error_log___get__(struct __pyx_obj_4lxml_5etree__FeedParser *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_11_FeedParser_feed(struct __pyx_obj_4lxml_5etree__FeedParser *__pyx_v_self, PyObject *__pyx_v_data); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_11_FeedParser_2close(struct __pyx_obj_4lxml_5etree__FeedParser *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_9XMLParser___init__(struct __pyx_obj_4lxml_5etree_XMLParser *__pyx_v_self, PyObject *__pyx_v_encoding, PyObject *__pyx_v_attribute_defaults, PyObject *__pyx_v_dtd_validation, PyObject *__pyx_v_load_dtd, PyObject *__pyx_v_no_network, PyObject *__pyx_v_decompress, PyObject *__pyx_v_ns_clean, PyObject *__pyx_v_recover, struct __pyx_obj_4lxml_5etree_XMLSchema *__pyx_v_schema, PyObject *__pyx_v_huge_tree, PyObject *__pyx_v_remove_blank_text, PyObject *__pyx_v_resolve_entities, PyObject *__pyx_v_remove_comments, PyObject *__pyx_v_remove_pis, PyObject *__pyx_v_strip_cdata, PyObject *__pyx_v_collect_ids, PyObject *__pyx_v_target, PyObject *__pyx_v_compact); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9XMLParser_2__class_getitem__(PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_item); /* proto */
static int __pyx_pf_4lxml_5etree_13XMLPullParser___init__(struct __pyx_obj_4lxml_5etree_XMLPullParser *__pyx_v_self, PyObject *__pyx_v_events, PyObject *__pyx_v_tag, PyObject *__pyx_v_base_url, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_13XMLPullParser_2read_events(struct __pyx_obj_4lxml_5etree_XMLPullParser *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_17ETCompatXMLParser___init__(struct __pyx_obj_4lxml_5etree_ETCompatXMLParser *__pyx_v_self, PyObject *__pyx_v_encoding, PyObject *__pyx_v_attribute_defaults, PyObject *__pyx_v_dtd_validation, PyObject *__pyx_v_load_dtd, PyObject *__pyx_v_no_network, PyObject *__pyx_v_decompress, PyObject *__pyx_v_ns_clean, PyObject *__pyx_v_recover, PyObject *__pyx_v_schema, PyObject *__pyx_v_huge_tree, PyObject *__pyx_v_remove_blank_text, PyObject *__pyx_v_resolve_entities, PyObject *__pyx_v_remove_comments, PyObject *__pyx_v_remove_pis, PyObject *__pyx_v_strip_cdata, PyObject *__pyx_v_target, PyObject *__pyx_v_compact); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_44set_default_parser(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_46get_default_parser(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static int __pyx_pf_4lxml_5etree_10HTMLParser___init__(struct __pyx_obj_4lxml_5etree_HTMLParser *__pyx_v_self, PyObject *__pyx_v_encoding, PyObject *__pyx_v_remove_blank_text, PyObject *__pyx_v_remove_comments, PyObject *__pyx_v_remove_pis, PyObject *__pyx_v_strip_cdata, PyObject *__pyx_v_no_network, PyObject *__pyx_v_decompress, PyObject *__pyx_v_target, struct __pyx_obj_4lxml_5etree_XMLSchema *__pyx_v_schema, PyObject *__pyx_v_recover, PyObject *__pyx_v_compact, PyObject *__pyx_v_default_doctype, PyObject *__pyx_v_collect_ids, PyObject *__pyx_v_huge_tree); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_10HTMLParser_2__class_getitem__(PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_item); /* proto */
static int __pyx_pf_4lxml_5etree_14HTMLPullParser___init__(struct __pyx_obj_4lxml_5etree_HTMLPullParser *__pyx_v_self, PyObject *__pyx_v_events, PyObject *__pyx_v_tag, PyObject *__pyx_v_base_url, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_14HTMLPullParser_2read_events(struct __pyx_obj_4lxml_5etree_HTMLPullParser *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_23XMLSyntaxAssertionError___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_message); /* proto */
static int __pyx_pf_4lxml_5etree_17_SaxParserContext___cinit__(struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_self, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser); /* proto */
static int __pyx_pf_4lxml_5etree_20_ParseEventsIterator___cinit__(struct __pyx_obj_4lxml_5etree__ParseEventsIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_20_ParseEventsIterator_2__iter__(struct __pyx_obj_4lxml_5etree__ParseEventsIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_20_ParseEventsIterator_4__next__(struct __pyx_obj_4lxml_5etree__ParseEventsIterator *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_11TreeBuilder___init__(struct __pyx_obj_4lxml_5etree_TreeBuilder *__pyx_v_self, PyObject *__pyx_v_element_factory, PyObject *__pyx_v_parser, PyObject *__pyx_v_comment_factory, PyObject *__pyx_v_pi_factory, int __pyx_v_insert_comments, int __pyx_v_insert_pis); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_11TreeBuilder_2close(struct __pyx_obj_4lxml_5etree_TreeBuilder *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_11TreeBuilder_4data(struct __pyx_obj_4lxml_5etree_TreeBuilder *__pyx_v_self, PyObject *__pyx_v_data); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_11TreeBuilder_6start(struct __pyx_obj_4lxml_5etree_TreeBuilder *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_attrs, PyObject *__pyx_v_nsmap); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_11TreeBuilder_8end(struct __pyx_obj_4lxml_5etree_TreeBuilder *__pyx_v_self, PyObject *__pyx_v_tag); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_11TreeBuilder_10pi(struct __pyx_obj_4lxml_5etree_TreeBuilder *__pyx_v_self, PyObject *__pyx_v_target, PyObject *__pyx_v_data); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_11TreeBuilder_12comment(struct __pyx_obj_4lxml_5etree_TreeBuilder *__pyx_v_self, PyObject *__pyx_v_comment); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_19_TargetParserResult___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_result); /* proto */
static int __pyx_pf_4lxml_5etree_22_PythonSaxParserTarget___cinit__(struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *__pyx_v_self, PyObject *__pyx_v_target); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_48_open_utf8_file(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_file, PyObject *__pyx_v_compression); /* proto */
static int __pyx_pf_4lxml_5etree_15_FilelikeWriter___cinit__(struct __pyx_obj_4lxml_5etree__FilelikeWriter *__pyx_v_self, PyObject *__pyx_v_filelike, PyObject *__pyx_v_exc_context, PyObject *__pyx_v_compression, PyObject *__pyx_v_close); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_51canonicalize(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_xml_data, PyObject *__pyx_v_out, PyObject *__pyx_v_from_file, PyObject *__pyx_v_options); /* proto */
static int __pyx_pf_4lxml_5etree_16C14NWriterTarget___init__(struct __pyx_obj_4lxml_5etree_C14NWriterTarget *__pyx_v_self, PyObject *__pyx_v_write, PyObject *__pyx_v_with_comments, PyObject *__pyx_v_strip_text, PyObject *__pyx_v_rewrite_prefixes, PyObject *__pyx_v_qname_aware_tags, PyObject *__pyx_v_qname_aware_attrs, PyObject *__pyx_v_exclude_attrs, PyObject *__pyx_v_exclude_tags); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_16C14NWriterTarget_2_iter_namespaces(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree_C14NWriterTarget *__pyx_v_self, PyObject *__pyx_v_ns_stack); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_16C14NWriterTarget_5data(struct __pyx_obj_4lxml_5etree_C14NWriterTarget *__pyx_v_self, PyObject *__pyx_v_data); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_16C14NWriterTarget_7start_ns(struct __pyx_obj_4lxml_5etree_C14NWriterTarget *__pyx_v_self, PyObject *__pyx_v_prefix, PyObject *__pyx_v_uri); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_16C14NWriterTarget_9start(struct __pyx_obj_4lxml_5etree_C14NWriterTarget *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_attrs); /* proto */
static PyObject *__pyx_lambda_funcdef_lambda(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_n); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_16C14NWriterTarget_11end(struct __pyx_obj_4lxml_5etree_C14NWriterTarget *__pyx_v_self, PyObject *__pyx_v_tag); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_16C14NWriterTarget_13comment(struct __pyx_obj_4lxml_5etree_C14NWriterTarget *__pyx_v_self, PyObject *__pyx_v_text); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_16C14NWriterTarget_15pi(struct __pyx_obj_4lxml_5etree_C14NWriterTarget *__pyx_v_self, PyObject *__pyx_v_target, PyObject *__pyx_v_data); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_16C14NWriterTarget_17close(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree_C14NWriterTarget *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_7xmlfile___init__(struct __pyx_obj_4lxml_5etree_xmlfile *__pyx_v_self, PyObject *__pyx_v_output_file, PyObject *__pyx_v_encoding, PyObject *__pyx_v_compression, PyObject *__pyx_v_close, PyObject *__pyx_v_buffered); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7xmlfile_2__enter__(struct __pyx_obj_4lxml_5etree_xmlfile *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7xmlfile_4__exit__(struct __pyx_obj_4lxml_5etree_xmlfile *__pyx_v_self, PyObject *__pyx_v_exc_type, CYTHON_UNUSED PyObject *__pyx_v_exc_val, CYTHON_UNUSED PyObject *__pyx_v_exc_tb); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7xmlfile_6__aenter__(struct __pyx_obj_4lxml_5etree_xmlfile *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7xmlfile_9__aexit__(struct __pyx_obj_4lxml_5etree_xmlfile *__pyx_v_self, PyObject *__pyx_v_exc_type, CYTHON_UNUSED PyObject *__pyx_v_exc_val, CYTHON_UNUSED PyObject *__pyx_v_exc_tb); /* proto */
static int __pyx_pf_4lxml_5etree_8htmlfile___init__(struct __pyx_obj_4lxml_5etree_htmlfile *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */
static int __pyx_pf_4lxml_5etree_22_IncrementalFileWriter___cinit__(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_outfile, PyObject *__pyx_v_encoding, int __pyx_v_compresslevel, int __pyx_v_close, int __pyx_v_buffered, int __pyx_v_method); /* proto */
static void __pyx_pf_4lxml_5etree_22_IncrementalFileWriter_2__dealloc__(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_22_IncrementalFileWriter_4write_declaration(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_version, PyObject *__pyx_v_standalone, PyObject *__pyx_v_doctype); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_22_IncrementalFileWriter_6write_doctype(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_doctype); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_22_IncrementalFileWriter_8method(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_method); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_22_IncrementalFileWriter_10element(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_attrib, PyObject *__pyx_v_nsmap, PyObject *__pyx_v_method, PyObject *__pyx_v__extra); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_22_IncrementalFileWriter_12write(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self, int __pyx_v_with_tail, int __pyx_v_pretty_print, PyObject *__pyx_v_method, PyObject *__pyx_v_args); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_22_IncrementalFileWriter_14flush(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_16_AsyncDataWriter___cinit__(struct __pyx_obj_4lxml_5etree__AsyncDataWriter *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_16_AsyncDataWriter_2write(struct __pyx_obj_4lxml_5etree__AsyncDataWriter *__pyx_v_self, PyObject *__pyx_v_data); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_16_AsyncDataWriter_4close(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__AsyncDataWriter *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_27_AsyncIncrementalFileWriter___cinit__(struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_async_outfile, PyObject *__pyx_v_encoding, int __pyx_v_compresslevel, int __pyx_v_close, int __pyx_v_buffered, int __pyx_v_method); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_27_AsyncIncrementalFileWriter_2flush(struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_27_AsyncIncrementalFileWriter_5write_declaration(struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_version, PyObject *__pyx_v_standalone, PyObject *__pyx_v_doctype); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_27_AsyncIncrementalFileWriter_8write_doctype(struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_doctype); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_27_AsyncIncrementalFileWriter_11write(struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_with_tail, PyObject *__pyx_v_pretty_print, PyObject *__pyx_v_method, PyObject *__pyx_v_args); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_27_AsyncIncrementalFileWriter_14method(struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_method); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_27_AsyncIncrementalFileWriter_16element(struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_attrib, PyObject *__pyx_v_nsmap, PyObject *__pyx_v_method, PyObject *__pyx_v__extra); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_27_AsyncIncrementalFileWriter_18_close(struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *__pyx_v_self, int __pyx_v_raise_on_error); /* proto */
static int __pyx_pf_4lxml_5etree_23_AsyncFileWriterElement___cinit__(struct __pyx_obj_4lxml_5etree__AsyncFileWriterElement *__pyx_v_self, struct __pyx_obj_4lxml_5etree__FileWriterElement *__pyx_v_element_writer, struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *__pyx_v_writer); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_23_AsyncFileWriterElement_2__aenter__(struct __pyx_obj_4lxml_5etree__AsyncFileWriterElement *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_23_AsyncFileWriterElement_5__aexit__(struct __pyx_obj_4lxml_5etree__AsyncFileWriterElement *__pyx_v_self, PyObject *__pyx_v_args); /* proto */
static int __pyx_pf_4lxml_5etree_18_FileWriterElement___cinit__(struct __pyx_obj_4lxml_5etree__FileWriterElement *__pyx_v_self, struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_writer, PyObject *__pyx_v_element_config, int __pyx_v_method); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_18_FileWriterElement_2__enter__(struct __pyx_obj_4lxml_5etree__FileWriterElement *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_18_FileWriterElement_4__exit__(struct __pyx_obj_4lxml_5etree__FileWriterElement *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exc_type, CYTHON_UNUSED PyObject *__pyx_v_exc_val, CYTHON_UNUSED PyObject *__pyx_v_exc_tb); /* proto */
static int __pyx_pf_4lxml_5etree_14_MethodChanger___cinit__(struct __pyx_obj_4lxml_5etree__MethodChanger *__pyx_v_self, struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_writer, int __pyx_v_method); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_14_MethodChanger_2__enter__(struct __pyx_obj_4lxml_5etree__MethodChanger *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_14_MethodChanger_4__exit__(struct __pyx_obj_4lxml_5etree__MethodChanger *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exc_type, CYTHON_UNUSED PyObject *__pyx_v_exc_val, CYTHON_UNUSED PyObject *__pyx_v_exc_tb); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_14_MethodChanger_6__aenter__(struct __pyx_obj_4lxml_5etree__MethodChanger *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_14_MethodChanger_9__aexit__(struct __pyx_obj_4lxml_5etree__MethodChanger *__pyx_v_self, PyObject *__pyx_v_args); /* proto */
static int __pyx_pf_4lxml_5etree_9iterparse___init__(struct __pyx_obj_4lxml_5etree_iterparse *__pyx_v_self, PyObject *__pyx_v_source, PyObject *__pyx_v_events, PyObject *__pyx_v_tag, PyObject *__pyx_v_attribute_defaults, PyObject *__pyx_v_dtd_validation, PyObject *__pyx_v_load_dtd, PyObject *__pyx_v_no_network, PyObject *__pyx_v_remove_blank_text, PyObject *__pyx_v_compact, PyObject *__pyx_v_resolve_entities, PyObject *__pyx_v_remove_comments, PyObject *__pyx_v_remove_pis, PyObject *__pyx_v_strip_cdata, PyObject *__pyx_v_encoding, PyObject *__pyx_v_html, PyObject *__pyx_v_recover, PyObject *__pyx_v_huge_tree, CYTHON_UNUSED PyObject *__pyx_v_collect_ids, struct __pyx_obj_4lxml_5etree_XMLSchema *__pyx_v_schema); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9iterparse_9error_log___get__(struct __pyx_obj_4lxml_5etree_iterparse *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9iterparse_9resolvers___get__(struct __pyx_obj_4lxml_5etree_iterparse *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9iterparse_7version___get__(struct __pyx_obj_4lxml_5etree_iterparse *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9iterparse_2set_element_class_lookup(struct __pyx_obj_4lxml_5etree_iterparse *__pyx_v_self, struct LxmlElementClassLookup *__pyx_v_lookup); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9iterparse_4makeelement(struct __pyx_obj_4lxml_5etree_iterparse *__pyx_v_self, PyObject *__pyx_v__tag, CYTHON_UNUSED PyObject *__pyx_v_attrib, CYTHON_UNUSED PyObject *__pyx_v_nsmap, PyObject *__pyx_v__extra); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9iterparse_6__iter__(struct __pyx_obj_4lxml_5etree_iterparse *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9iterparse_8__next__(struct __pyx_obj_4lxml_5etree_iterparse *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9iterparse_4root___get__(struct __pyx_obj_4lxml_5etree_iterparse *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_8iterwalk___init__(struct __pyx_obj_4lxml_5etree_iterwalk *__pyx_v_self, PyObject *__pyx_v_element_or_tree, PyObject *__pyx_v_events, PyObject *__pyx_v_tag); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8iterwalk_2__iter__(struct __pyx_obj_4lxml_5etree_iterwalk *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8iterwalk_4__next__(struct __pyx_obj_4lxml_5etree_iterwalk *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8iterwalk_6skip_subtree(struct __pyx_obj_4lxml_5etree_iterwalk *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_53XMLID(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_text, PyObject *__pyx_v_parser, PyObject *__pyx_v_base_url); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_55XMLDTDID(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_text, PyObject *__pyx_v_parser, PyObject *__pyx_v_base_url); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_57parseid(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_source, PyObject *__pyx_v_parser, PyObject *__pyx_v_base_url); /* proto */
static int __pyx_pf_4lxml_5etree_7_IDDict___cinit__(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self, PyObject *__pyx_v_etree); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_2copy(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_4__getitem__(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self, PyObject *__pyx_v_id_name); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_6get(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self, PyObject *__pyx_v_id_name); /* proto */
static int __pyx_pf_4lxml_5etree_7_IDDict_8__contains__(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self, PyObject *__pyx_v_id_name); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_10has_key(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self, PyObject *__pyx_v_id_name); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_12__repr__(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_14keys(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_16__iter__(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_18iterkeys(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_pf_4lxml_5etree_7_IDDict_20__len__(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_22items(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_24iteritems(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_26values(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_28itervalues(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_8XInclude___init__(struct __pyx_obj_4lxml_5etree_XInclude *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8XInclude_9error_log___get__(struct __pyx_obj_4lxml_5etree_XInclude *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8XInclude_2__call__(struct __pyx_obj_4lxml_5etree_XInclude *__pyx_v_self, struct LxmlElement *__pyx_v_node); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_59cleanup_namespaces(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tree_or_element, PyObject *__pyx_v_top_nsmap, PyObject *__pyx_v_keep_ns_prefixes); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_61strip_attributes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tree_or_element, PyObject *__pyx_v_attribute_names); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_63strip_elements(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tree_or_element, int __pyx_v_with_tail, PyObject *__pyx_v_tag_names); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_65strip_tags(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tree_or_element, PyObject *__pyx_v_tag_names); /* proto */
static int __pyx_pf_4lxml_5etree_12_BaseContext___init__(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, PyObject *__pyx_v_namespaces, PyObject *__pyx_v_extensions, PyObject *__pyx_v_error_log, PyObject *__pyx_v_enable_regexp, PyObject *__pyx_v_build_smart_strings); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_BaseContext_12context_node___get__(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_BaseContext_12eval_context___get__(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_67Extension(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_module, PyObject *__pyx_v_function_mapping, PyObject *__pyx_v_ns); /* proto */
static int __pyx_pf_4lxml_5etree_12_ExsltRegExp___cinit__(struct __pyx_obj_4lxml_5etree__ExsltRegExp *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_ExsltRegExp_2test(struct __pyx_obj_4lxml_5etree__ExsltRegExp *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_ctxt, PyObject *__pyx_v_s, PyObject *__pyx_v_rexp, PyObject *__pyx_v_flags); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_ExsltRegExp_4match(struct __pyx_obj_4lxml_5etree__ExsltRegExp *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_ctxt, PyObject *__pyx_v_s, PyObject *__pyx_v_rexp, PyObject *__pyx_v_flags); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_ExsltRegExp_6replace(struct __pyx_obj_4lxml_5etree__ExsltRegExp *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_ctxt, PyObject *__pyx_v_s, PyObject *__pyx_v_rexp, PyObject *__pyx_v_flags, PyObject *__pyx_v_replacement); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_21_ElementUnicodeResult_getparent(struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_21_ElementUnicodeResult_7is_text___get__(struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_21_ElementUnicodeResult_12is_attribute___get__(struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_21_ElementUnicodeResult_8attrname___get__(struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_21_ElementUnicodeResult_7is_tail___get__(struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_13_XPathContext___init__(struct __pyx_obj_4lxml_5etree__XPathContext *__pyx_v_self, PyObject *__pyx_v_namespaces, PyObject *__pyx_v_extensions, PyObject *__pyx_v_error_log, PyObject *__pyx_v_enable_regexp, PyObject *__pyx_v_variables, PyObject *__pyx_v_build_smart_strings); /* proto */
static int __pyx_pf_4lxml_5etree_19_XPathEvaluatorBase___cinit__(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_19_XPathEvaluatorBase_2__init__(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *__pyx_v_self, PyObject *__pyx_v_namespaces, PyObject *__pyx_v_extensions, PyObject *__pyx_v_enable_regexp, PyObject *__pyx_v_smart_strings); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_19_XPathEvaluatorBase_9error_log___get__(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *__pyx_v_self); /* proto */
static void __pyx_pf_4lxml_5etree_19_XPathEvaluatorBase_4__dealloc__(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_21XPathElementEvaluator___init__(struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *__pyx_v_self, struct LxmlElement *__pyx_v_element, PyObject *__pyx_v_namespaces, PyObject *__pyx_v_extensions, PyObject *__pyx_v_regexp, PyObject *__pyx_v_smart_strings); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_21XPathElementEvaluator_2register_namespace(struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *__pyx_v_self, PyObject *__pyx_v_prefix, PyObject *__pyx_v_uri); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_21XPathElementEvaluator_4register_namespaces(struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *__pyx_v_self, PyObject *__pyx_v_namespaces); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_21XPathElementEvaluator_6__call__(struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *__pyx_v_self, PyObject *__pyx_v__path, PyObject *__pyx_v__variables); /* proto */
static int __pyx_pf_4lxml_5etree_22XPathDocumentEvaluator___init__(struct __pyx_obj_4lxml_5etree_XPathDocumentEvaluator *__pyx_v_self, struct LxmlElementTree *__pyx_v_etree, PyObject *__pyx_v_namespaces, PyObject *__pyx_v_extensions, PyObject *__pyx_v_regexp, PyObject *__pyx_v_smart_strings); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_22XPathDocumentEvaluator_2__call__(struct __pyx_obj_4lxml_5etree_XPathDocumentEvaluator *__pyx_v_self, PyObject *__pyx_v__path, PyObject *__pyx_v__variables); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_69XPathEvaluator(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_etree_or_element, PyObject *__pyx_v_namespaces, PyObject *__pyx_v_extensions, PyObject *__pyx_v_regexp, PyObject *__pyx_v_smart_strings); /* proto */
static int __pyx_pf_4lxml_5etree_5XPath___cinit__(struct __pyx_obj_4lxml_5etree_XPath *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_5XPath_2__init__(struct __pyx_obj_4lxml_5etree_XPath *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_namespaces, PyObject *__pyx_v_extensions, PyObject *__pyx_v_regexp, PyObject *__pyx_v_smart_strings); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_5XPath_4__call__(struct __pyx_obj_4lxml_5etree_XPath *__pyx_v_self, PyObject *__pyx_v__etree_or_element, PyObject *__pyx_v__variables); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_5XPath_4path___get__(struct __pyx_obj_4lxml_5etree_XPath *__pyx_v_self); /* proto */
static void __pyx_pf_4lxml_5etree_5XPath_6__dealloc__(struct __pyx_obj_4lxml_5etree_XPath *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_5XPath_8__repr__(struct __pyx_obj_4lxml_5etree_XPath *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_7ETXPath___init__(struct __pyx_obj_4lxml_5etree_ETXPath *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_extensions, PyObject *__pyx_v_regexp, PyObject *__pyx_v_smart_strings); /* proto */
static int __pyx_pf_4lxml_5etree_17XSLTAccessControl___cinit__(struct __pyx_obj_4lxml_5etree_XSLTAccessControl *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_17XSLTAccessControl_2__init__(struct __pyx_obj_4lxml_5etree_XSLTAccessControl *__pyx_v_self, int __pyx_v_read_file, int __pyx_v_write_file, int __pyx_v_create_dir, int __pyx_v_read_network, int __pyx_v_write_network); /* proto */
static void __pyx_pf_4lxml_5etree_17XSLTAccessControl_4__dealloc__(struct __pyx_obj_4lxml_5etree_XSLTAccessControl *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_17XSLTAccessControl_7options___get__(struct __pyx_obj_4lxml_5etree_XSLTAccessControl *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_17XSLTAccessControl_6__repr__(struct __pyx_obj_4lxml_5etree_XSLTAccessControl *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_12_XSLTContext___cinit__(struct __pyx_obj_4lxml_5etree__XSLTContext *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_12_XSLTContext_2__init__(struct __pyx_obj_4lxml_5etree__XSLTContext *__pyx_v_self, PyObject *__pyx_v_namespaces, PyObject *__pyx_v_extensions, PyObject *__pyx_v_error_log, PyObject *__pyx_v_enable_regexp, PyObject *__pyx_v_build_smart_strings); /* proto */
static int __pyx_pf_4lxml_5etree_22_XSLTQuotedStringParam___cinit__(struct __pyx_obj_4lxml_5etree__XSLTQuotedStringParam *__pyx_v_self, PyObject *__pyx_v_strval); /* proto */
static int __pyx_pf_4lxml_5etree_4XSLT___cinit__(struct __pyx_obj_4lxml_5etree_XSLT *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_4XSLT_2__init__(struct __pyx_obj_4lxml_5etree_XSLT *__pyx_v_self, PyObject *__pyx_v_xslt_input, PyObject *__pyx_v_extensions, PyObject *__pyx_v_regexp, PyObject *__pyx_v_access_control); /* proto */
static void __pyx_pf_4lxml_5etree_4XSLT_4__dealloc__(struct __pyx_obj_4lxml_5etree_XSLT *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_4XSLT_9error_log___get__(struct __pyx_obj_4lxml_5etree_XSLT *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_4XSLT_6strparam(PyObject *__pyx_v_strval); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_4XSLT_8set_global_max_depth(int __pyx_v_max_depth); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_4XSLT_10tostring(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree_XSLT *__pyx_v_self, struct LxmlElementTree *__pyx_v_result_tree); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_4XSLT_12__deepcopy__(struct __pyx_obj_4lxml_5etree_XSLT *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_memo); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_4XSLT_14__copy__(struct __pyx_obj_4lxml_5etree_XSLT *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_4XSLT_16__call__(struct __pyx_obj_4lxml_5etree_XSLT *__pyx_v_self, PyObject *__pyx_v__input, PyObject *__pyx_v_profile_run, PyObject *__pyx_v_kw); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_15_XSLTResultTree_write_output(struct __pyx_obj_4lxml_5etree__XSLTResultTree *__pyx_v_self, PyObject *__pyx_v_file, PyObject *__pyx_v_compression); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_15_XSLTResultTree_2__str__(struct __pyx_obj_4lxml_5etree__XSLTResultTree *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_15_XSLTResultTree_4__getbuffer__(struct __pyx_obj_4lxml_5etree__XSLTResultTree *__pyx_v_self, Py_buffer *__pyx_v_buffer, int __pyx_v_flags); /* proto */
static void __pyx_pf_4lxml_5etree_15_XSLTResultTree_6__releasebuffer__(struct __pyx_obj_4lxml_5etree__XSLTResultTree *__pyx_v_self, Py_buffer *__pyx_v_buffer); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_15_XSLTResultTree_12xslt_profile___get__(struct __pyx_obj_4lxml_5etree__XSLTResultTree *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_15_XSLTResultTree_12xslt_profile_2__del__(struct __pyx_obj_4lxml_5etree__XSLTResultTree *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_26_XSLTProcessingInstruction_parseXSL(struct __pyx_obj_4lxml_5etree__XSLTProcessingInstruction *__pyx_v_self, PyObject *__pyx_v_parser); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_26_XSLTProcessingInstruction_2set(struct __pyx_obj_4lxml_5etree__XSLTProcessingInstruction *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_13XSLTExtension_execute(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree_XSLTExtension *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_context, CYTHON_UNUSED PyObject *__pyx_v_self_node, CYTHON_UNUSED PyObject *__pyx_v_input_node, CYTHON_UNUSED PyObject *__pyx_v_output_parent); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_13XSLTExtension_2apply_templates(struct __pyx_obj_4lxml_5etree_XSLTExtension *__pyx_v_self, struct __pyx_obj_4lxml_5etree__XSLTContext *__pyx_v_context, PyObject *__pyx_v_node, PyObject *__pyx_v_output_parent, PyObject *__pyx_v_elements_only, PyObject *__pyx_v_remove_blank_text); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_13XSLTExtension_4process_children(struct __pyx_obj_4lxml_5etree_XSLTExtension *__pyx_v_self, struct __pyx_obj_4lxml_5etree__XSLTContext *__pyx_v_context, PyObject *__pyx_v_output_parent, PyObject *__pyx_v_elements_only, PyObject *__pyx_v_remove_blank_text); /* proto */
static int __pyx_pf_4lxml_5etree_10_Validator___cinit__(struct __pyx_obj_4lxml_5etree__Validator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_10_Validator_2validate(struct __pyx_obj_4lxml_5etree__Validator *__pyx_v_self, PyObject *__pyx_v_etree); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_10_Validator_4assertValid(struct __pyx_obj_4lxml_5etree__Validator *__pyx_v_self, PyObject *__pyx_v_etree); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_10_Validator_6assert_(struct __pyx_obj_4lxml_5etree__Validator *__pyx_v_self, PyObject *__pyx_v_etree); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_10_Validator_8_append_log_message(struct __pyx_obj_4lxml_5etree__Validator *__pyx_v_self, int __pyx_v_domain, int __pyx_v_type, int __pyx_v_level, int __pyx_v_line, PyObject *__pyx_v_message, PyObject *__pyx_v_filename); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_10_Validator_10_clear_error_log(struct __pyx_obj_4lxml_5etree__Validator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_10_Validator_9error_log___get__(struct __pyx_obj_4lxml_5etree__Validator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_22_DTDElementContentDecl___repr__(struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_22_DTDElementContentDecl_4name___get__(struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_22_DTDElementContentDecl_4type___get__(struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_22_DTDElementContentDecl_5occur___get__(struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_22_DTDElementContentDecl_4left___get__(struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_22_DTDElementContentDecl_5right___get__(struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_17_DTDAttributeDecl___repr__(struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_17_DTDAttributeDecl_4name___get__(struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_17_DTDAttributeDecl_8elemname___get__(struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_17_DTDAttributeDecl_6prefix___get__(struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_17_DTDAttributeDecl_4type___get__(struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_17_DTDAttributeDecl_7default___get__(struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_17_DTDAttributeDecl_13default_value___get__(struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_17_DTDAttributeDecl_2itervalues(struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_17_DTDAttributeDecl_5values(struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_15_DTDElementDecl___repr__(struct __pyx_obj_4lxml_5etree__DTDElementDecl *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_15_DTDElementDecl_4name___get__(struct __pyx_obj_4lxml_5etree__DTDElementDecl *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_15_DTDElementDecl_6prefix___get__(struct __pyx_obj_4lxml_5etree__DTDElementDecl *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_15_DTDElementDecl_4type___get__(struct __pyx_obj_4lxml_5etree__DTDElementDecl *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_15_DTDElementDecl_7content___get__(struct __pyx_obj_4lxml_5etree__DTDElementDecl *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_15_DTDElementDecl_2iterattributes(struct __pyx_obj_4lxml_5etree__DTDElementDecl *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_15_DTDElementDecl_5attributes(struct __pyx_obj_4lxml_5etree__DTDElementDecl *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_14_DTDEntityDecl___repr__(struct __pyx_obj_4lxml_5etree__DTDEntityDecl *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_14_DTDEntityDecl_4name___get__(struct __pyx_obj_4lxml_5etree__DTDEntityDecl *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_14_DTDEntityDecl_4orig___get__(struct __pyx_obj_4lxml_5etree__DTDEntityDecl *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_14_DTDEntityDecl_7content___get__(struct __pyx_obj_4lxml_5etree__DTDEntityDecl *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_14_DTDEntityDecl_10system_url___get__(struct __pyx_obj_4lxml_5etree__DTDEntityDecl *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_3DTD___init__(struct __pyx_obj_4lxml_5etree_DTD *__pyx_v_self, PyObject *__pyx_v_file, PyObject *__pyx_v_external_id); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_3DTD_4name___get__(struct __pyx_obj_4lxml_5etree_DTD *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_3DTD_11external_id___get__(struct __pyx_obj_4lxml_5etree_DTD *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_3DTD_10system_url___get__(struct __pyx_obj_4lxml_5etree_DTD *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_3DTD_2iterelements(struct __pyx_obj_4lxml_5etree_DTD *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_3DTD_5elements(struct __pyx_obj_4lxml_5etree_DTD *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_3DTD_7iterentities(struct __pyx_obj_4lxml_5etree_DTD *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_3DTD_10entities(struct __pyx_obj_4lxml_5etree_DTD *__pyx_v_self); /* proto */
static void __pyx_pf_4lxml_5etree_3DTD_12__dealloc__(struct __pyx_obj_4lxml_5etree_DTD *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_3DTD_14__call__(struct __pyx_obj_4lxml_5etree_DTD *__pyx_v_self, PyObject *__pyx_v_etree); /* proto */
static int __pyx_pf_4lxml_5etree_7RelaxNG___cinit__(struct __pyx_obj_4lxml_5etree_RelaxNG *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_7RelaxNG_2__init__(struct __pyx_obj_4lxml_5etree_RelaxNG *__pyx_v_self, PyObject *__pyx_v_etree, PyObject *__pyx_v_file); /* proto */
static void __pyx_pf_4lxml_5etree_7RelaxNG_4__dealloc__(struct __pyx_obj_4lxml_5etree_RelaxNG *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7RelaxNG_6__call__(struct __pyx_obj_4lxml_5etree_RelaxNG *__pyx_v_self, PyObject *__pyx_v_etree); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7RelaxNG_8from_rnc_string(PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_src, PyObject *__pyx_v_base_url); /* proto */
static int __pyx_pf_4lxml_5etree_9XMLSchema___cinit__(struct __pyx_obj_4lxml_5etree_XMLSchema *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_9XMLSchema_2__init__(struct __pyx_obj_4lxml_5etree_XMLSchema *__pyx_v_self, PyObject *__pyx_v_etree, PyObject *__pyx_v_file, int __pyx_v_attribute_defaults); /* proto */
static void __pyx_pf_4lxml_5etree_9XMLSchema_4__dealloc__(struct __pyx_obj_4lxml_5etree_XMLSchema *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9XMLSchema_6__call__(struct __pyx_obj_4lxml_5etree_XMLSchema *__pyx_v_self, PyObject *__pyx_v_etree); /* proto */
static int __pyx_pf_4lxml_5etree_30_ParserSchemaValidationContext___cinit__(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *__pyx_v_self); /* proto */
static void __pyx_pf_4lxml_5etree_30_ParserSchemaValidationContext_2__dealloc__(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_10Schematron___init__(struct __pyx_obj_4lxml_5etree_Schematron *__pyx_v_self, PyObject *__pyx_v_etree, PyObject *__pyx_v_file); /* proto */
static void __pyx_pf_4lxml_5etree_10Schematron_2__dealloc__(struct __pyx_obj_4lxml_5etree_Schematron *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_10Schematron_4__call__(struct __pyx_obj_4lxml_5etree_Schematron *__pyx_v_self, PyObject *__pyx_v_etree); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9_MemDebug_bytes_used(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__MemDebug *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9_MemDebug_2blocks_used(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__MemDebug *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9_MemDebug_4dict_size(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__MemDebug *__pyx_v_self); /* proto */
static PyObject *__pyx_tp_new_4lxml_5etree_Error(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__TempStore(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__ExceptionContext(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__LogEntry(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__BaseErrorLog(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__ListErrorLog(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__ErrorLogContext(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__ErrorLog(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__DomainErrorLog(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__RotatingErrorLog(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_PyErrorLog(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__Document(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_DocInfo(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__Element(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree___ContentOnlyElement(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__Comment(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__ProcessingInstruction(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__Entity(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_QName(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__ElementTree(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__Attrib(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__AttribIterator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__ElementTagMatcher(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__ElementIterator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__MultiTagMatcher(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__ElementMatchIterator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_ElementChildIterator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_SiblingsIterator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_AncestorsIterator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_ElementDepthFirstIterator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_ElementTextIterator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_CDATA(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__ReadOnlyProxy(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__ReadOnlyPIProxy(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__ReadOnlyEntityProxy(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__ReadOnlyElementProxy(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__OpaqueNodeWrapper(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__OpaqueDocumentWrapper(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__ModifyContentOnlyProxy(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__ModifyContentOnlyPIProxy(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__ModifyContentOnlyEntityProxy(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__AppendOnlyElementProxy(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_CommentBase(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_PIBase(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_EntityBase(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_ElementClassLookup(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_FallbackElementClassLookup(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_ElementDefaultClassLookup(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_AttributeBasedElementClassLookup(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_ParserBasedElementClassLookup(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_CustomElementClassLookup(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_PythonElementClassLookup(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__NamespaceRegistry(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__ClassNamespaceRegistry(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_ElementNamespaceClassLookup(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__FunctionNamespaceRegistry(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__XPathFunctionNamespaceRegistry(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__InputDocument(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_Resolver(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__ResolverRegistry(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__ResolverContext(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__ParserDictionaryContext(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__FileReaderContext(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__ParserContext(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__BaseParser(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__FeedParser(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_XMLParser(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_XMLPullParser(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_ETCompatXMLParser(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_HTMLParser(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_HTMLPullParser(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__SaxParserTarget(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__SaxParserContext(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__ParseEventsIterator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_TreeBuilder(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__PythonSaxParserTarget(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__TargetParserContext(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__FilelikeWriter(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_C14NWriterTarget(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_xmlfile(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__IncrementalFileWriter(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__AsyncDataWriter(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__AsyncIncrementalFileWriter(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__AsyncFileWriterElement(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__FileWriterElement(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__MethodChanger(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_iterparse(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_iterwalk(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__IDDict(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_XInclude(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__ExsltRegExp(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__BaseContext(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__ElementUnicodeResult(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__XPathContext(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__XPathEvaluatorBase(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_XPathElementEvaluator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_XPathDocumentEvaluator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_XPath(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_ETXPath(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__XSLTResolverContext(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_XSLTAccessControl(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__XSLTContext(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__XSLTQuotedStringParam(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_XSLT(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__XSLTResultTree(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__XSLTProcessingInstruction(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_XSLTExtension(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__Validator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__DTDElementContentDecl(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__DTDAttributeDecl(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__DTDElementDecl(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__DTDEntityDecl(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_DTD(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_RelaxNG(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_XMLSchema(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__ParserSchemaValidationContext(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_Schematron(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__MemDebug(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct___open_utf8_file(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_1__iter_namespaces(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_2___aenter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_3___aexit__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_4_flush(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_5_write_declaration(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_6_write_doctype(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_7_write(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_8__close(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_9___aenter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_10___aexit__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_11___aenter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_12___aexit__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_13_itervalues(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_14_iterattributes(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_15_iterelements(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_16_iterentities(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
/* #### Code section: late_includes ### */
/* #### Code section: module_state ### */
/* SmallCodeConfig */
#ifndef CYTHON_SMALL_CODE
#if defined(__clang__)
    #define CYTHON_SMALL_CODE
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
    #define CYTHON_SMALL_CODE __attribute__((cold))
#else
    #define CYTHON_SMALL_CODE
#endif
#endif

typedef struct {
  PyObject *__pyx_d;
  PyObject *__pyx_b;
  PyObject *__pyx_cython_runtime;
  PyObject *__pyx_empty_tuple;
  PyObject *__pyx_empty_bytes;
  PyObject *__pyx_empty_unicode;
  PyTypeObject *__pyx_ptype_7cpython_4type_type;
  PyObject *__pyx_type_4lxml_5etree_Error;
  PyObject *__pyx_type_4lxml_5etree_LxmlError;
  PyObject *__pyx_type_4lxml_5etree_C14NError;
  PyObject *__pyx_type_4lxml_5etree__TempStore;
  PyObject *__pyx_type_4lxml_5etree__ExceptionContext;
  PyObject *__pyx_type_4lxml_5etree__LogEntry;
  PyObject *__pyx_type_4lxml_5etree__BaseErrorLog;
  PyObject *__pyx_type_4lxml_5etree__ListErrorLog;
  PyObject *__pyx_type_4lxml_5etree__ErrorLogContext;
  PyObject *__pyx_type_4lxml_5etree__ErrorLog;
  PyObject *__pyx_type_4lxml_5etree__DomainErrorLog;
  PyObject *__pyx_type_4lxml_5etree__RotatingErrorLog;
  PyObject *__pyx_type_4lxml_5etree_PyErrorLog;
  PyObject *LxmlDocumentType;
  PyObject *__pyx_type_4lxml_5etree_DocInfo;
  PyObject *LxmlElementType;
  PyObject *__pyx_type_4lxml_5etree___ContentOnlyElement;
  PyObject *__pyx_type_4lxml_5etree__Comment;
  PyObject *__pyx_type_4lxml_5etree__ProcessingInstruction;
  PyObject *__pyx_type_4lxml_5etree__Entity;
  PyObject *__pyx_type_4lxml_5etree_QName;
  PyObject *LxmlElementTreeType;
  PyObject *__pyx_type_4lxml_5etree__Attrib;
  PyObject *__pyx_type_4lxml_5etree__AttribIterator;
  PyObject *LxmlElementTagMatcherType;
  PyObject *LxmlElementIteratorType;
  PyObject *__pyx_type_4lxml_5etree__MultiTagMatcher;
  PyObject *__pyx_type_4lxml_5etree__ElementMatchIterator;
  PyObject *__pyx_type_4lxml_5etree_ElementChildIterator;
  PyObject *__pyx_type_4lxml_5etree_SiblingsIterator;
  PyObject *__pyx_type_4lxml_5etree_AncestorsIterator;
  PyObject *__pyx_type_4lxml_5etree_ElementDepthFirstIterator;
  PyObject *__pyx_type_4lxml_5etree_ElementTextIterator;
  PyObject *__pyx_type_4lxml_5etree_CDATA;
  PyObject *__pyx_type_4lxml_5etree__ReadOnlyProxy;
  PyObject *__pyx_type_4lxml_5etree__ReadOnlyPIProxy;
  PyObject *__pyx_type_4lxml_5etree__ReadOnlyEntityProxy;
  PyObject *__pyx_type_4lxml_5etree__ReadOnlyElementProxy;
  PyObject *__pyx_type_4lxml_5etree__OpaqueNodeWrapper;
  PyObject *__pyx_type_4lxml_5etree__OpaqueDocumentWrapper;
  PyObject *__pyx_type_4lxml_5etree__ModifyContentOnlyProxy;
  PyObject *__pyx_type_4lxml_5etree__ModifyContentOnlyPIProxy;
  PyObject *__pyx_type_4lxml_5etree__ModifyContentOnlyEntityProxy;
  PyObject *__pyx_type_4lxml_5etree__AppendOnlyElementProxy;
  PyObject *LxmlElementBaseType;
  PyObject *__pyx_type_4lxml_5etree_CommentBase;
  PyObject *__pyx_type_4lxml_5etree_PIBase;
  PyObject *__pyx_type_4lxml_5etree_EntityBase;
  PyObject *LxmlElementClassLookupType;
  PyObject *LxmlFallbackElementClassLookupType;
  PyObject *__pyx_type_4lxml_5etree_ElementDefaultClassLookup;
  PyObject *__pyx_type_4lxml_5etree_AttributeBasedElementClassLookup;
  PyObject *__pyx_type_4lxml_5etree_ParserBasedElementClassLookup;
  PyObject *__pyx_type_4lxml_5etree_CustomElementClassLookup;
  PyObject *__pyx_type_4lxml_5etree_PythonElementClassLookup;
  PyObject *__pyx_type_4lxml_5etree_LxmlRegistryError;
  PyObject *__pyx_type_4lxml_5etree_NamespaceRegistryError;
  PyObject *__pyx_type_4lxml_5etree__NamespaceRegistry;
  PyObject *__pyx_type_4lxml_5etree__ClassNamespaceRegistry;
  PyObject *__pyx_type_4lxml_5etree_ElementNamespaceClassLookup;
  PyObject *__pyx_type_4lxml_5etree__FunctionNamespaceRegistry;
  PyObject *__pyx_type_4lxml_5etree__XPathFunctionNamespaceRegistry;
  PyObject *__pyx_type_4lxml_5etree__InputDocument;
  PyObject *__pyx_type_4lxml_5etree_Resolver;
  PyObject *__pyx_type_4lxml_5etree__ResolverRegistry;
  PyObject *__pyx_type_4lxml_5etree__ResolverContext;
  PyObject *__pyx_type_4lxml_5etree_ParserError;
  PyObject *__pyx_type_4lxml_5etree__ParserDictionaryContext;
  PyObject *__pyx_type_4lxml_5etree__FileReaderContext;
  PyObject *__pyx_type_4lxml_5etree__ParserContext;
  PyObject *__pyx_type_4lxml_5etree__BaseParser;
  PyObject *__pyx_type_4lxml_5etree__FeedParser;
  PyObject *__pyx_type_4lxml_5etree_XMLParser;
  PyObject *__pyx_type_4lxml_5etree_XMLPullParser;
  PyObject *__pyx_type_4lxml_5etree_ETCompatXMLParser;
  PyObject *__pyx_type_4lxml_5etree_HTMLParser;
  PyObject *__pyx_type_4lxml_5etree_HTMLPullParser;
  PyObject *__pyx_type_4lxml_5etree__SaxParserTarget;
  PyObject *__pyx_type_4lxml_5etree__SaxParserContext;
  PyObject *__pyx_type_4lxml_5etree__ParseEventsIterator;
  PyObject *__pyx_type_4lxml_5etree_TreeBuilder;
  PyObject *__pyx_type_4lxml_5etree__PythonSaxParserTarget;
  PyObject *__pyx_type_4lxml_5etree__TargetParserContext;
  PyObject *__pyx_type_4lxml_5etree_SerialisationError;
  PyObject *__pyx_type_4lxml_5etree__FilelikeWriter;
  PyObject *__pyx_type_4lxml_5etree_C14NWriterTarget;
  PyObject *__pyx_type_4lxml_5etree_xmlfile;
  PyObject *__pyx_type_4lxml_5etree_htmlfile;
  PyObject *__pyx_type_4lxml_5etree__IncrementalFileWriter;
  PyObject *__pyx_type_4lxml_5etree__AsyncDataWriter;
  PyObject *__pyx_type_4lxml_5etree__AsyncIncrementalFileWriter;
  PyObject *__pyx_type_4lxml_5etree__AsyncFileWriterElement;
  PyObject *__pyx_type_4lxml_5etree__FileWriterElement;
  PyObject *__pyx_type_4lxml_5etree__MethodChanger;
  PyObject *__pyx_type_4lxml_5etree_iterparse;
  PyObject *__pyx_type_4lxml_5etree_iterwalk;
  PyObject *__pyx_type_4lxml_5etree__IDDict;
  PyObject *__pyx_type_4lxml_5etree_XIncludeError;
  PyObject *__pyx_type_4lxml_5etree_XInclude;
  PyObject *__pyx_type_4lxml_5etree_XPathError;
  PyObject *__pyx_type_4lxml_5etree_XPathEvalError;
  PyObject *__pyx_type_4lxml_5etree_XPathFunctionError;
  PyObject *__pyx_type_4lxml_5etree_XPathResultError;
  PyObject *__pyx_type_4lxml_5etree__ExsltRegExp;
  PyObject *__pyx_type_4lxml_5etree__BaseContext;
  PyObject *__pyx_type_4lxml_5etree__ElementUnicodeResult;
  PyObject *__pyx_type_4lxml_5etree__XPathContext;
  PyObject *__pyx_type_4lxml_5etree__XPathEvaluatorBase;
  PyObject *__pyx_type_4lxml_5etree_XPathElementEvaluator;
  PyObject *__pyx_type_4lxml_5etree_XPathDocumentEvaluator;
  PyObject *__pyx_type_4lxml_5etree_XPath;
  PyObject *__pyx_type_4lxml_5etree_ETXPath;
  PyObject *__pyx_type_4lxml_5etree_XSLTError;
  PyObject *__pyx_type_4lxml_5etree_XSLTParseError;
  PyObject *__pyx_type_4lxml_5etree_XSLTApplyError;
  PyObject *__pyx_type_4lxml_5etree_XSLTExtensionError;
  PyObject *__pyx_type_4lxml_5etree__XSLTResolverContext;
  PyObject *__pyx_type_4lxml_5etree_XSLTAccessControl;
  PyObject *__pyx_type_4lxml_5etree__XSLTContext;
  PyObject *__pyx_type_4lxml_5etree__XSLTQuotedStringParam;
  PyObject *__pyx_type_4lxml_5etree_XSLT;
  PyObject *__pyx_type_4lxml_5etree__XSLTResultTree;
  PyObject *__pyx_type_4lxml_5etree__XSLTProcessingInstruction;
  PyObject *__pyx_type_4lxml_5etree_XSLTExtension;
  PyObject *__pyx_type_4lxml_5etree_DocumentInvalid;
  PyObject *__pyx_type_4lxml_5etree__Validator;
  PyObject *__pyx_type_4lxml_5etree_DTDError;
  PyObject *__pyx_type_4lxml_5etree_DTDParseError;
  PyObject *__pyx_type_4lxml_5etree_DTDValidateError;
  PyObject *__pyx_type_4lxml_5etree__DTDElementContentDecl;
  PyObject *__pyx_type_4lxml_5etree__DTDAttributeDecl;
  PyObject *__pyx_type_4lxml_5etree__DTDElementDecl;
  PyObject *__pyx_type_4lxml_5etree__DTDEntityDecl;
  PyObject *__pyx_type_4lxml_5etree_DTD;
  PyObject *__pyx_type_4lxml_5etree_RelaxNGError;
  PyObject *__pyx_type_4lxml_5etree_RelaxNGParseError;
  PyObject *__pyx_type_4lxml_5etree_RelaxNGValidateError;
  PyObject *__pyx_type_4lxml_5etree_RelaxNG;
  PyObject *__pyx_type_4lxml_5etree_XMLSchemaError;
  PyObject *__pyx_type_4lxml_5etree_XMLSchemaParseError;
  PyObject *__pyx_type_4lxml_5etree_XMLSchemaValidateError;
  PyObject *__pyx_type_4lxml_5etree_XMLSchema;
  PyObject *__pyx_type_4lxml_5etree__ParserSchemaValidationContext;
  PyObject *__pyx_type_4lxml_5etree_SchematronError;
  PyObject *__pyx_type_4lxml_5etree_SchematronParseError;
  PyObject *__pyx_type_4lxml_5etree_SchematronValidateError;
  PyObject *__pyx_type_4lxml_5etree_Schematron;
  PyObject *__pyx_type_4lxml_5etree__MemDebug;
  PyObject *__pyx_type_4lxml_5etree___pyx_scope_struct___open_utf8_file;
  PyObject *__pyx_type_4lxml_5etree___pyx_scope_struct_1__iter_namespaces;
  PyObject *__pyx_type_4lxml_5etree___pyx_scope_struct_2___aenter__;
  PyObject *__pyx_type_4lxml_5etree___pyx_scope_struct_3___aexit__;
  PyObject *__pyx_type_4lxml_5etree___pyx_scope_struct_4_flush;
  PyObject *__pyx_type_4lxml_5etree___pyx_scope_struct_5_write_declaration;
  PyObject *__pyx_type_4lxml_5etree___pyx_scope_struct_6_write_doctype;
  PyObject *__pyx_type_4lxml_5etree___pyx_scope_struct_7_write;
  PyObject *__pyx_type_4lxml_5etree___pyx_scope_struct_8__close;
  PyObject *__pyx_type_4lxml_5etree___pyx_scope_struct_9___aenter__;
  PyObject *__pyx_type_4lxml_5etree___pyx_scope_struct_10___aexit__;
  PyObject *__pyx_type_4lxml_5etree___pyx_scope_struct_11___aenter__;
  PyObject *__pyx_type_4lxml_5etree___pyx_scope_struct_12___aexit__;
  PyObject *__pyx_type_4lxml_5etree___pyx_scope_struct_13_itervalues;
  PyObject *__pyx_type_4lxml_5etree___pyx_scope_struct_14_iterattributes;
  PyObject *__pyx_type_4lxml_5etree___pyx_scope_struct_15_iterelements;
  PyObject *__pyx_type_4lxml_5etree___pyx_scope_struct_16_iterentities;
  PyObject *__pyx_type___pyx_array;
  PyObject *__pyx_type___pyx_MemviewEnum;
  PyObject *__pyx_type___pyx_memoryview;
  PyObject *__pyx_type___pyx_memoryviewslice;
  PyTypeObject *__pyx_ptype_4lxml_5etree_Error;
  PyTypeObject *__pyx_ptype_4lxml_5etree_LxmlError;
  PyTypeObject *__pyx_ptype_4lxml_5etree_C14NError;
  PyTypeObject *__pyx_ptype_4lxml_5etree__TempStore;
  PyTypeObject *__pyx_ptype_4lxml_5etree__ExceptionContext;
  PyTypeObject *__pyx_ptype_4lxml_5etree__LogEntry;
  PyTypeObject *__pyx_ptype_4lxml_5etree__BaseErrorLog;
  PyTypeObject *__pyx_ptype_4lxml_5etree__ListErrorLog;
  PyTypeObject *__pyx_ptype_4lxml_5etree__ErrorLogContext;
  PyTypeObject *__pyx_ptype_4lxml_5etree__ErrorLog;
  PyTypeObject *__pyx_ptype_4lxml_5etree__DomainErrorLog;
  PyTypeObject *__pyx_ptype_4lxml_5etree__RotatingErrorLog;
  PyTypeObject *__pyx_ptype_4lxml_5etree_PyErrorLog;
  PyTypeObject *__pyx_ptype_4lxml_5etree__Document;
  PyTypeObject *__pyx_ptype_4lxml_5etree_DocInfo;
  PyTypeObject *__pyx_ptype_4lxml_5etree__Element;
  PyTypeObject *__pyx_ptype_4lxml_5etree___ContentOnlyElement;
  PyTypeObject *__pyx_ptype_4lxml_5etree__Comment;
  PyTypeObject *__pyx_ptype_4lxml_5etree__ProcessingInstruction;
  PyTypeObject *__pyx_ptype_4lxml_5etree__Entity;
  PyTypeObject *__pyx_ptype_4lxml_5etree_QName;
  PyTypeObject *__pyx_ptype_4lxml_5etree__ElementTree;
  PyTypeObject *__pyx_ptype_4lxml_5etree__Attrib;
  PyTypeObject *__pyx_ptype_4lxml_5etree__AttribIterator;
  PyTypeObject *__pyx_ptype_4lxml_5etree__ElementTagMatcher;
  PyTypeObject *__pyx_ptype_4lxml_5etree__ElementIterator;
  PyTypeObject *__pyx_ptype_4lxml_5etree__MultiTagMatcher;
  PyTypeObject *__pyx_ptype_4lxml_5etree__ElementMatchIterator;
  PyTypeObject *__pyx_ptype_4lxml_5etree_ElementChildIterator;
  PyTypeObject *__pyx_ptype_4lxml_5etree_SiblingsIterator;
  PyTypeObject *__pyx_ptype_4lxml_5etree_AncestorsIterator;
  PyTypeObject *__pyx_ptype_4lxml_5etree_ElementDepthFirstIterator;
  PyTypeObject *__pyx_ptype_4lxml_5etree_ElementTextIterator;
  PyTypeObject *__pyx_ptype_4lxml_5etree_CDATA;
  PyTypeObject *__pyx_ptype_4lxml_5etree__ReadOnlyProxy;
  PyTypeObject *__pyx_ptype_4lxml_5etree__ReadOnlyPIProxy;
  PyTypeObject *__pyx_ptype_4lxml_5etree__ReadOnlyEntityProxy;
  PyTypeObject *__pyx_ptype_4lxml_5etree__ReadOnlyElementProxy;
  PyTypeObject *__pyx_ptype_4lxml_5etree__OpaqueNodeWrapper;
  PyTypeObject *__pyx_ptype_4lxml_5etree__OpaqueDocumentWrapper;
  PyTypeObject *__pyx_ptype_4lxml_5etree__ModifyContentOnlyProxy;
  PyTypeObject *__pyx_ptype_4lxml_5etree__ModifyContentOnlyPIProxy;
  PyTypeObject *__pyx_ptype_4lxml_5etree__ModifyContentOnlyEntityProxy;
  PyTypeObject *__pyx_ptype_4lxml_5etree__AppendOnlyElementProxy;
  PyTypeObject *__pyx_ptype_4lxml_5etree_ElementBase;
  PyTypeObject *__pyx_ptype_4lxml_5etree_CommentBase;
  PyTypeObject *__pyx_ptype_4lxml_5etree_PIBase;
  PyTypeObject *__pyx_ptype_4lxml_5etree_EntityBase;
  PyTypeObject *__pyx_ptype_4lxml_5etree_ElementClassLookup;
  PyTypeObject *__pyx_ptype_4lxml_5etree_FallbackElementClassLookup;
  PyTypeObject *__pyx_ptype_4lxml_5etree_ElementDefaultClassLookup;
  PyTypeObject *__pyx_ptype_4lxml_5etree_AttributeBasedElementClassLookup;
  PyTypeObject *__pyx_ptype_4lxml_5etree_ParserBasedElementClassLookup;
  PyTypeObject *__pyx_ptype_4lxml_5etree_CustomElementClassLookup;
  PyTypeObject *__pyx_ptype_4lxml_5etree_PythonElementClassLookup;
  PyTypeObject *__pyx_ptype_4lxml_5etree_LxmlRegistryError;
  PyTypeObject *__pyx_ptype_4lxml_5etree_NamespaceRegistryError;
  PyTypeObject *__pyx_ptype_4lxml_5etree__NamespaceRegistry;
  PyTypeObject *__pyx_ptype_4lxml_5etree__ClassNamespaceRegistry;
  PyTypeObject *__pyx_ptype_4lxml_5etree_ElementNamespaceClassLookup;
  PyTypeObject *__pyx_ptype_4lxml_5etree__FunctionNamespaceRegistry;
  PyTypeObject *__pyx_ptype_4lxml_5etree__XPathFunctionNamespaceRegistry;
  PyTypeObject *__pyx_ptype_4lxml_5etree__InputDocument;
  PyTypeObject *__pyx_ptype_4lxml_5etree_Resolver;
  PyTypeObject *__pyx_ptype_4lxml_5etree__ResolverRegistry;
  PyTypeObject *__pyx_ptype_4lxml_5etree__ResolverContext;
  PyTypeObject *__pyx_ptype_4lxml_5etree_ParserError;
  PyTypeObject *__pyx_ptype_4lxml_5etree__ParserDictionaryContext;
  PyTypeObject *__pyx_ptype_4lxml_5etree__FileReaderContext;
  PyTypeObject *__pyx_ptype_4lxml_5etree__ParserContext;
  PyTypeObject *__pyx_ptype_4lxml_5etree__BaseParser;
  PyTypeObject *__pyx_ptype_4lxml_5etree__FeedParser;
  PyTypeObject *__pyx_ptype_4lxml_5etree_XMLParser;
  PyTypeObject *__pyx_ptype_4lxml_5etree_XMLPullParser;
  PyTypeObject *__pyx_ptype_4lxml_5etree_ETCompatXMLParser;
  PyTypeObject *__pyx_ptype_4lxml_5etree_HTMLParser;
  PyTypeObject *__pyx_ptype_4lxml_5etree_HTMLPullParser;
  PyTypeObject *__pyx_ptype_4lxml_5etree__SaxParserTarget;
  PyTypeObject *__pyx_ptype_4lxml_5etree__SaxParserContext;
  PyTypeObject *__pyx_ptype_4lxml_5etree__ParseEventsIterator;
  PyTypeObject *__pyx_ptype_4lxml_5etree_TreeBuilder;
  PyTypeObject *__pyx_ptype_4lxml_5etree__PythonSaxParserTarget;
  PyTypeObject *__pyx_ptype_4lxml_5etree__TargetParserContext;
  PyTypeObject *__pyx_ptype_4lxml_5etree_SerialisationError;
  PyTypeObject *__pyx_ptype_4lxml_5etree__FilelikeWriter;
  PyTypeObject *__pyx_ptype_4lxml_5etree_C14NWriterTarget;
  PyTypeObject *__pyx_ptype_4lxml_5etree_xmlfile;
  PyTypeObject *__pyx_ptype_4lxml_5etree_htmlfile;
  PyTypeObject *__pyx_ptype_4lxml_5etree__IncrementalFileWriter;
  PyTypeObject *__pyx_ptype_4lxml_5etree__AsyncDataWriter;
  PyTypeObject *__pyx_ptype_4lxml_5etree__AsyncIncrementalFileWriter;
  PyTypeObject *__pyx_ptype_4lxml_5etree__AsyncFileWriterElement;
  PyTypeObject *__pyx_ptype_4lxml_5etree__FileWriterElement;
  PyTypeObject *__pyx_ptype_4lxml_5etree__MethodChanger;
  PyTypeObject *__pyx_ptype_4lxml_5etree_iterparse;
  PyTypeObject *__pyx_ptype_4lxml_5etree_iterwalk;
  PyTypeObject *__pyx_ptype_4lxml_5etree__IDDict;
  PyTypeObject *__pyx_ptype_4lxml_5etree_XIncludeError;
  PyTypeObject *__pyx_ptype_4lxml_5etree_XInclude;
  PyTypeObject *__pyx_ptype_4lxml_5etree_XPathError;
  PyTypeObject *__pyx_ptype_4lxml_5etree_XPathEvalError;
  PyTypeObject *__pyx_ptype_4lxml_5etree_XPathFunctionError;
  PyTypeObject *__pyx_ptype_4lxml_5etree_XPathResultError;
  PyTypeObject *__pyx_ptype_4lxml_5etree__ExsltRegExp;
  PyTypeObject *__pyx_ptype_4lxml_5etree__BaseContext;
  PyTypeObject *__pyx_ptype_4lxml_5etree__ElementUnicodeResult;
  PyTypeObject *__pyx_ptype_4lxml_5etree__XPathContext;
  PyTypeObject *__pyx_ptype_4lxml_5etree__XPathEvaluatorBase;
  PyTypeObject *__pyx_ptype_4lxml_5etree_XPathElementEvaluator;
  PyTypeObject *__pyx_ptype_4lxml_5etree_XPathDocumentEvaluator;
  PyTypeObject *__pyx_ptype_4lxml_5etree_XPath;
  PyTypeObject *__pyx_ptype_4lxml_5etree_ETXPath;
  PyTypeObject *__pyx_ptype_4lxml_5etree_XSLTError;
  PyTypeObject *__pyx_ptype_4lxml_5etree_XSLTParseError;
  PyTypeObject *__pyx_ptype_4lxml_5etree_XSLTApplyError;
  PyTypeObject *__pyx_ptype_4lxml_5etree_XSLTExtensionError;
  PyTypeObject *__pyx_ptype_4lxml_5etree__XSLTResolverContext;
  PyTypeObject *__pyx_ptype_4lxml_5etree_XSLTAccessControl;
  PyTypeObject *__pyx_ptype_4lxml_5etree__XSLTContext;
  PyTypeObject *__pyx_ptype_4lxml_5etree__XSLTQuotedStringParam;
  PyTypeObject *__pyx_ptype_4lxml_5etree_XSLT;
  PyTypeObject *__pyx_ptype_4lxml_5etree__XSLTResultTree;
  PyTypeObject *__pyx_ptype_4lxml_5etree__XSLTProcessingInstruction;
  PyTypeObject *__pyx_ptype_4lxml_5etree_XSLTExtension;
  PyTypeObject *__pyx_ptype_4lxml_5etree_DocumentInvalid;
  PyTypeObject *__pyx_ptype_4lxml_5etree__Validator;
  PyTypeObject *__pyx_ptype_4lxml_5etree_DTDError;
  PyTypeObject *__pyx_ptype_4lxml_5etree_DTDParseError;
  PyTypeObject *__pyx_ptype_4lxml_5etree_DTDValidateError;
  PyTypeObject *__pyx_ptype_4lxml_5etree__DTDElementContentDecl;
  PyTypeObject *__pyx_ptype_4lxml_5etree__DTDAttributeDecl;
  PyTypeObject *__pyx_ptype_4lxml_5etree__DTDElementDecl;
  PyTypeObject *__pyx_ptype_4lxml_5etree__DTDEntityDecl;
  PyTypeObject *__pyx_ptype_4lxml_5etree_DTD;
  PyTypeObject *__pyx_ptype_4lxml_5etree_RelaxNGError;
  PyTypeObject *__pyx_ptype_4lxml_5etree_RelaxNGParseError;
  PyTypeObject *__pyx_ptype_4lxml_5etree_RelaxNGValidateError;
  PyTypeObject *__pyx_ptype_4lxml_5etree_RelaxNG;
  PyTypeObject *__pyx_ptype_4lxml_5etree_XMLSchemaError;
  PyTypeObject *__pyx_ptype_4lxml_5etree_XMLSchemaParseError;
  PyTypeObject *__pyx_ptype_4lxml_5etree_XMLSchemaValidateError;
  PyTypeObject *__pyx_ptype_4lxml_5etree_XMLSchema;
  PyTypeObject *__pyx_ptype_4lxml_5etree__ParserSchemaValidationContext;
  PyTypeObject *__pyx_ptype_4lxml_5etree_SchematronError;
  PyTypeObject *__pyx_ptype_4lxml_5etree_SchematronParseError;
  PyTypeObject *__pyx_ptype_4lxml_5etree_SchematronValidateError;
  PyTypeObject *__pyx_ptype_4lxml_5etree_Schematron;
  PyTypeObject *__pyx_ptype_4lxml_5etree__MemDebug;
  PyTypeObject *__pyx_ptype_4lxml_5etree___pyx_scope_struct___open_utf8_file;
  PyTypeObject *__pyx_ptype_4lxml_5etree___pyx_scope_struct_1__iter_namespaces;
  PyTypeObject *__pyx_ptype_4lxml_5etree___pyx_scope_struct_2___aenter__;
  PyTypeObject *__pyx_ptype_4lxml_5etree___pyx_scope_struct_3___aexit__;
  PyTypeObject *__pyx_ptype_4lxml_5etree___pyx_scope_struct_4_flush;
  PyTypeObject *__pyx_ptype_4lxml_5etree___pyx_scope_struct_5_write_declaration;
  PyTypeObject *__pyx_ptype_4lxml_5etree___pyx_scope_struct_6_write_doctype;
  PyTypeObject *__pyx_ptype_4lxml_5etree___pyx_scope_struct_7_write;
  PyTypeObject *__pyx_ptype_4lxml_5etree___pyx_scope_struct_8__close;
  PyTypeObject *__pyx_ptype_4lxml_5etree___pyx_scope_struct_9___aenter__;
  PyTypeObject *__pyx_ptype_4lxml_5etree___pyx_scope_struct_10___aexit__;
  PyTypeObject *__pyx_ptype_4lxml_5etree___pyx_scope_struct_11___aenter__;
  PyTypeObject *__pyx_ptype_4lxml_5etree___pyx_scope_struct_12___aexit__;
  PyTypeObject *__pyx_ptype_4lxml_5etree___pyx_scope_struct_13_itervalues;
  PyTypeObject *__pyx_ptype_4lxml_5etree___pyx_scope_struct_14_iterattributes;
  PyTypeObject *__pyx_ptype_4lxml_5etree___pyx_scope_struct_15_iterelements;
  PyTypeObject *__pyx_ptype_4lxml_5etree___pyx_scope_struct_16_iterentities;
  PyTypeObject *__pyx_array_type;
  PyTypeObject *__pyx_MemviewEnum_type;
  PyTypeObject *__pyx_memoryview_type;
  PyTypeObject *__pyx_memoryviewslice_type;
  __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_get;
  __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_items;
  __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_pop;
  __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_values;
  __Pyx_CachedCFunction __pyx_umethod_PyList_Type_pop;
  __Pyx_CachedCFunction __pyx_umethod_PySet_Type_update;
  __Pyx_CachedCFunction __pyx_umethod_PyBytes_Type__replace;
  __Pyx_CachedCFunction __pyx_umethod_PyBytes_Type__split;
  __Pyx_CachedCFunction __pyx_umethod_PyUnicode_Type__strip;
  PyObject *__pyx_k__30;
  PyObject *__pyx_slice[12];
  PyObject *__pyx_tuple[26];
  PyObject *__pyx_codeobj_tab[276];
  PyObject *__pyx_string_tab[1744];
  PyObject *__pyx_number_tab[14];
/* #### Code section: module_state_contents ### */
/* IterNextPlain.module_state_decls */
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
PyObject *__Pyx_GetBuiltinNext_LimitedAPI_cache;
#endif

/* CommonTypesMetaclass.module_state_decls */
PyTypeObject *__pyx_CommonTypesMetaclassType;

/* Generator.module_state_decls */
PyTypeObject *__pyx_GeneratorType;

/* CachedMethodType.module_state_decls */
#if CYTHON_COMPILING_IN_LIMITED_API
PyObject *__Pyx_CachedMethodType;
#endif

/* CythonFunctionShared.module_state_decls */
PyTypeObject *__pyx_CyFunctionType;

/* Coroutine.module_state_decls */
PyTypeObject *__pyx_CoroutineType;
PyTypeObject *__pyx_CoroutineAwaitType;

/* Coro_CheckExact.module_state_decls */
#if CYTHON_COMPILING_IN_LIMITED_API
PyObject *__Pyx_CachedCoroType;
#endif


#if CYTHON_USE_FREELISTS
struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_freelist_4lxml_5etree__LogEntry[16];
int __pyx_freecount_4lxml_5etree__LogEntry;
#endif

#if CYTHON_USE_FREELISTS
struct LxmlDocument *__pyx_freelist_4lxml_5etree__Document[8];
int __pyx_freecount_4lxml_5etree__Document;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_4lxml_5etree__Attrib *__pyx_freelist_4lxml_5etree__Attrib[16];
int __pyx_freecount_4lxml_5etree__Attrib;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_4lxml_5etree__FileWriterElement *__pyx_freelist_4lxml_5etree__FileWriterElement[8];
int __pyx_freecount_4lxml_5etree__FileWriterElement;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_4lxml_5etree__MethodChanger *__pyx_freelist_4lxml_5etree__MethodChanger[8];
int __pyx_freecount_4lxml_5etree__MethodChanger;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_4lxml_5etree__XSLTQuotedStringParam *__pyx_freelist_4lxml_5etree__XSLTQuotedStringParam[8];
int __pyx_freecount_4lxml_5etree__XSLTQuotedStringParam;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *__pyx_freelist_4lxml_5etree__DTDElementContentDecl[8];
int __pyx_freecount_4lxml_5etree__DTDElementContentDecl;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *__pyx_freelist_4lxml_5etree__DTDAttributeDecl[8];
int __pyx_freecount_4lxml_5etree__DTDAttributeDecl;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_4lxml_5etree__DTDElementDecl *__pyx_freelist_4lxml_5etree__DTDElementDecl[8];
int __pyx_freecount_4lxml_5etree__DTDElementDecl;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_4lxml_5etree__DTDEntityDecl *__pyx_freelist_4lxml_5etree__DTDEntityDecl[8];
int __pyx_freecount_4lxml_5etree__DTDEntityDecl;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_4lxml_5etree___pyx_scope_struct___open_utf8_file *__pyx_freelist_4lxml_5etree___pyx_scope_struct___open_utf8_file[8];
int __pyx_freecount_4lxml_5etree___pyx_scope_struct___open_utf8_file;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_1__iter_namespaces *__pyx_freelist_4lxml_5etree___pyx_scope_struct_1__iter_namespaces[8];
int __pyx_freecount_4lxml_5etree___pyx_scope_struct_1__iter_namespaces;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_2___aenter__ *__pyx_freelist_4lxml_5etree___pyx_scope_struct_2___aenter__[8];
int __pyx_freecount_4lxml_5etree___pyx_scope_struct_2___aenter__;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_3___aexit__ *__pyx_freelist_4lxml_5etree___pyx_scope_struct_3___aexit__[8];
int __pyx_freecount_4lxml_5etree___pyx_scope_struct_3___aexit__;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_4_flush *__pyx_freelist_4lxml_5etree___pyx_scope_struct_4_flush[8];
int __pyx_freecount_4lxml_5etree___pyx_scope_struct_4_flush;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_5_write_declaration *__pyx_freelist_4lxml_5etree___pyx_scope_struct_5_write_declaration[8];
int __pyx_freecount_4lxml_5etree___pyx_scope_struct_5_write_declaration;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_6_write_doctype *__pyx_freelist_4lxml_5etree___pyx_scope_struct_6_write_doctype[8];
int __pyx_freecount_4lxml_5etree___pyx_scope_struct_6_write_doctype;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_7_write *__pyx_freelist_4lxml_5etree___pyx_scope_struct_7_write[8];
int __pyx_freecount_4lxml_5etree___pyx_scope_struct_7_write;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_8__close *__pyx_freelist_4lxml_5etree___pyx_scope_struct_8__close[8];
int __pyx_freecount_4lxml_5etree___pyx_scope_struct_8__close;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_9___aenter__ *__pyx_freelist_4lxml_5etree___pyx_scope_struct_9___aenter__[8];
int __pyx_freecount_4lxml_5etree___pyx_scope_struct_9___aenter__;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_10___aexit__ *__pyx_freelist_4lxml_5etree___pyx_scope_struct_10___aexit__[8];
int __pyx_freecount_4lxml_5etree___pyx_scope_struct_10___aexit__;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_11___aenter__ *__pyx_freelist_4lxml_5etree___pyx_scope_struct_11___aenter__[8];
int __pyx_freecount_4lxml_5etree___pyx_scope_struct_11___aenter__;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_12___aexit__ *__pyx_freelist_4lxml_5etree___pyx_scope_struct_12___aexit__[8];
int __pyx_freecount_4lxml_5etree___pyx_scope_struct_12___aexit__;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_13_itervalues *__pyx_freelist_4lxml_5etree___pyx_scope_struct_13_itervalues[8];
int __pyx_freecount_4lxml_5etree___pyx_scope_struct_13_itervalues;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_14_iterattributes *__pyx_freelist_4lxml_5etree___pyx_scope_struct_14_iterattributes[8];
int __pyx_freecount_4lxml_5etree___pyx_scope_struct_14_iterattributes;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_15_iterelements *__pyx_freelist_4lxml_5etree___pyx_scope_struct_15_iterelements[8];
int __pyx_freecount_4lxml_5etree___pyx_scope_struct_15_iterelements;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_16_iterentities *__pyx_freelist_4lxml_5etree___pyx_scope_struct_16_iterentities[8];
int __pyx_freecount_4lxml_5etree___pyx_scope_struct_16_iterentities;
#endif
/* CodeObjectCache.module_state_decls */
struct __Pyx_CodeObjectCache __pyx_code_cache;

/* #### Code section: module_state_end ### */
} __pyx_mstatetype;

#if CYTHON_USE_MODULE_STATE
#ifdef __cplusplus
namespace {
extern struct PyModuleDef __pyx_moduledef;
} /* anonymous namespace */
#else
static struct PyModuleDef __pyx_moduledef;
#endif

#define __pyx_mstate_global (__Pyx_PyModule_GetState(__Pyx_State_FindModule(&__pyx_moduledef)))

#define __pyx_m (__Pyx_State_FindModule(&__pyx_moduledef))
#else
static __pyx_mstatetype __pyx_mstate_global_static =
#ifdef __cplusplus
    {};
#else
    {0};
#endif
static __pyx_mstatetype * const __pyx_mstate_global = &__pyx_mstate_global_static;
#endif
/* #### Code section: constant_name_defines ### */
#define __pyx_kp_u_ __pyx_string_tab[0]
#define __pyx_kp_u_0_9 __pyx_string_tab[1]
#define __pyx_kp_u_1 __pyx_string_tab[2]
#define __pyx_kp_u_All_dimensions_preceding_dimensi __pyx_string_tab[3]
#define __pyx_kp_u_All_strings_must_be_XML_compatib __pyx_string_tab[4]
#define __pyx_kp_u_An_XMLSyntaxError_that_addition __pyx_string_tab[5]
#define __pyx_kp_u_Argument_is_not_a_file_like_obje __pyx_string_tab[6]
#define __pyx_kp_u_Argument_must_be_bytes_or_unicod __pyx_string_tab[7]
#define __pyx_kp_u_Argument_must_be_string_or_unico __pyx_string_tab[8]
#define __pyx_kp_u_Base_class_for_all_syntax_errors __pyx_string_tab[9]
#define __pyx_kp_u_Buffer_view_does_not_expose_stri __pyx_string_tab[10]
#define __pyx_kp_u_C14N_failed __pyx_string_tab[11]
#define __pyx_kp_u_Can_only_create_a_buffer_that_is __pyx_string_tab[12]
#define __pyx_kp_u_Can_only_discard_comments_in_C14 __pyx_string_tab[13]
#define __pyx_kp_u_Can_only_strip_text_in_C14N_2_0 __pyx_string_tab[14]
#define __pyx_kp_u_Cannot_assign_to_read_only_memor __pyx_string_tab[15]
#define __pyx_kp_u_Cannot_asynchronously_write_to_a __pyx_string_tab[16]
#define __pyx_kp_u_Cannot_change_the_xml_prefix_of __pyx_string_tab[17]
#define __pyx_kp_u_Cannot_create_writable_memory_vi __pyx_string_tab[18]
#define __pyx_kp_u_Cannot_enable_XML_declaration_in __pyx_string_tab[19]
#define __pyx_kp_u_Cannot_index_with_type __pyx_string_tab[20]
#define __pyx_kp_u_Cannot_parse_stylesheet __pyx_string_tab[21]
#define __pyx_kp_u_Cannot_resolve_URI __pyx_string_tab[22]
#define __pyx_kp_u_Cannot_specify_encoding_with_C14 __pyx_string_tab[23]
#define __pyx_kp_u_Cannot_transpose_memoryview_with __pyx_string_tab[24]
#define __pyx_kp_u_Comment_may_not_contain_or_end_w __pyx_string_tab[25]
#define __pyx_kp_u_Could_not_create_I_O_writer_cont __pyx_string_tab[26]
#define __pyx_kp_u_Could_not_find_root_node __pyx_string_tab[27]
#define __pyx_kp_u_DOCTYPE __pyx_string_tab[28]
#define __pyx_kp_u_DOCTYPE_already_written_or_canno __pyx_string_tab[29]
#define __pyx_kp_u_DTD_not_initialised __pyx_string_tab[30]
#define __pyx_kp_u_Dimension_d_is_not_direct __pyx_string_tab[31]
#define __pyx_kp_u_Document_does_not_comply_with_sc __pyx_string_tab[32]
#define __pyx_kp_u_Document_is_not_a_valid_Schematr __pyx_string_tab[33]
#define __pyx_kp_u_Document_is_not_parsable_as_Rela __pyx_string_tab[34]
#define __pyx_kp_u_Document_is_not_valid_Relax_NG __pyx_string_tab[35]
#define __pyx_kp_u_Document_is_not_valid_XML_Schema __pyx_string_tab[36]
#define __pyx_kp_u_Document_is_not_well_formed __pyx_string_tab[37]
#define __pyx_kp_u_ERR_OK_0_ERR_INTERNAL_ERROR_1_ER __pyx_string_tab[38]
#define __pyx_kp_u_Either_xml_data_or_from_file_mus __pyx_string_tab[39]
#define __pyx_kp_u_Element __pyx_string_tab[40]
#define __pyx_kp_u_ElementTree_not_initialized_miss __pyx_string_tab[41]
#define __pyx_kp_u_Element__tag_attrib_None_nsmap_N __pyx_string_tab[42]
#define __pyx_kp_u_Element_class_is_not_a_type_got __pyx_string_tab[43]
#define __pyx_kp_u_Element_is_not_a_child_of_this_n __pyx_string_tab[44]
#define __pyx_kp_u_Element_is_not_in_this_tree __pyx_string_tab[45]
#define __pyx_kp_u_Element_is_not_in_this_tree_2 __pyx_string_tab[46]
#define __pyx_kp_u_Empty_shape_tuple_for_cython_arr __pyx_string_tab[47]
#define __pyx_kp_u_Empty_tag_name __pyx_string_tab[48]
#define __pyx_kp_u_Entity_class_must_be_subclass_of __pyx_string_tab[49]
#define __pyx_kp_u_Error_applying_stylesheet __pyx_string_tab[50]
#define __pyx_kp_u_Error_applying_stylesheet_line __pyx_string_tab[51]
#define __pyx_kp_u_Error_during_serialisation_out_o __pyx_string_tab[52]
#define __pyx_kp_u_Error_in_xpath_expression __pyx_string_tab[53]
#define __pyx_kp_u_Error_reading __pyx_string_tab[54]
#define __pyx_kp_u_Error_reading_file __pyx_string_tab[55]
#define __pyx_kp_u_Error_serialising_an_XSLT_result __pyx_string_tab[56]
#define __pyx_kp_u_Failed_to_create_validation_cont __pyx_string_tab[57]
#define __pyx_kp_u_File_is_already_closed __pyx_string_tab[58]
#define __pyx_kp_u_File_or_filename_expected_got __pyx_string_tab[59]
#define __pyx_kp_u_FunctionNamespace_line_207 __pyx_string_tab[60]
#define __pyx_kp_u_FunctionNamespace_ns_uri_Retriev __pyx_string_tab[61]
#define __pyx_kp_u_FunctionNamespace_r __pyx_string_tab[62]
#define __pyx_kp_u_ID_attribute_not_found __pyx_string_tab[63]
#define __pyx_kp_u_Illegal_Unicode_kind __pyx_string_tab[64]
#define __pyx_kp_u_Illegal_document_provided_NULL __pyx_string_tab[65]
#define __pyx_kp_u_Illegal_document_provided_expect __pyx_string_tab[66]
#define __pyx_kp_u_Inconsistent_enter_action_in_con __pyx_string_tab[67]
#define __pyx_kp_u_Inconsistent_exit_action_in_cont __pyx_string_tab[68]
#define __pyx_kp_u_Index_out_of_bounds_axis_d __pyx_string_tab[69]
#define __pyx_kp_u_Indirect_dimensions_not_supporte __pyx_string_tab[70]
#define __pyx_kp_u_Initial_indentation_level_must_b __pyx_string_tab[71]
#define __pyx_kp_u_Input_object_has_no_document __pyx_string_tab[72]
#define __pyx_kp_u_Input_object_is_not_an_XML_eleme __pyx_string_tab[73]
#define __pyx_kp_u_Internal_error_in_DTD_validation __pyx_string_tab[74]
#define __pyx_kp_u_Internal_error_in_Relax_NG_valid __pyx_string_tab[75]
#define __pyx_kp_u_Internal_error_in_Schematron_val __pyx_string_tab[76]
#define __pyx_kp_u_Internal_error_in_XML_Schema_val __pyx_string_tab[77]
#define __pyx_kp_u_Invalid_HTML_tag_name __pyx_string_tab[78]
#define __pyx_kp_u_Invalid_PI_name __pyx_string_tab[79]
#define __pyx_kp_u_Invalid_URL_must_not_contain_or __pyx_string_tab[80]
#define __pyx_kp_u_Invalid_attribute_dictionary __pyx_string_tab[81]
#define __pyx_kp_u_Invalid_attribute_name __pyx_string_tab[82]
#define __pyx_kp_u_Invalid_character_reference __pyx_string_tab[83]
#define __pyx_kp_u_Invalid_character_s __pyx_string_tab[84]
#define __pyx_kp_u_Invalid_child_type __pyx_string_tab[85]
#define __pyx_kp_u_Invalid_entity_name __pyx_string_tab[86]
#define __pyx_kp_u_Invalid_entity_reference __pyx_string_tab[87]
#define __pyx_kp_u_Invalid_input_object __pyx_string_tab[88]
#define __pyx_kp_u_Invalid_input_tag_of_type __pyx_string_tab[89]
#define __pyx_kp_u_Invalid_mode_expected_c_or_fortr __pyx_string_tab[90]
#define __pyx_kp_u_Invalid_namespace_URI __pyx_string_tab[91]
#define __pyx_kp_u_Invalid_namespace_prefix __pyx_string_tab[92]
#define __pyx_kp_u_Invalid_shape_in_axis __pyx_string_tab[93]
#define __pyx_kp_u_Invalid_tag_name __pyx_string_tab[94]
#define __pyx_kp_u_Invalid_tag_name_2 __pyx_string_tab[95]
#define __pyx_kp_u_Libxml2_RelaxNG_error_types __pyx_string_tab[96]
#define __pyx_kp_u_Libxml2_error_domains __pyx_string_tab[97]
#define __pyx_kp_u_Libxml2_error_levels __pyx_string_tab[98]
#define __pyx_kp_u_Libxml2_error_types __pyx_string_tab[99]
#define __pyx_kp_u_MemoryView_of __pyx_string_tab[100]
#define __pyx_kp_u_Method_changed_outside_of_contex __pyx_string_tab[101]
#define __pyx_kp_u_NONE_0_PARSER_1_TREE_2_NAMESPACE __pyx_string_tab[102]
#define __pyx_kp_u_NONE_0_WARNING_1_ERROR_2_FATAL_3 __pyx_string_tab[103]
#define __pyx_kp_u_Name_not_registered __pyx_string_tab[104]
#define __pyx_kp_u_Namespace __pyx_string_tab[105]
#define __pyx_kp_u_Namespace_r __pyx_string_tab[106]
#define __pyx_kp_u_No_ID_dictionary_available __pyx_string_tab[107]
#define __pyx_kp_u_No_document_to_serialise __pyx_string_tab[108]
#define __pyx_kp_u_No_tree_or_file_given __pyx_string_tab[109]
#define __pyx_kp_u_Node_must_not_be_None __pyx_string_tab[110]
#define __pyx_kp_u_Non_Element_values_not_supported __pyx_string_tab[111]
#define __pyx_kp_u_None __pyx_string_tab[112]
#define __pyx_kp_u_Not_yet_implemented_result_node __pyx_string_tab[113]
#define __pyx_kp_u_Note_that_Cython_is_deliberately __pyx_string_tab[114]
#define __pyx_kp_u_Only_elements_can_be_the_root_of __pyx_string_tab[115]
#define __pyx_kp_u_Only_processing_instructions_and __pyx_string_tab[116]
#define __pyx_kp_u_Out_of_bounds_on_buffer_access_a __pyx_string_tab[117]
#define __pyx_kp_u_Output_file_needs_an_async_write __pyx_string_tab[118]
#define __pyx_kp_u_PI_class_must_be_subclass_of_PIB __pyx_string_tab[119]
#define __pyx_kp_u_PI_lacks_content __pyx_string_tab[120]
#define __pyx_kp_u_PI_text_must_not_contain __pyx_string_tab[121]
#define __pyx_kp_u_PUBLIC __pyx_string_tab[122]
#define __pyx_kp_u_Parameter_name_too_long __pyx_string_tab[123]
#define __pyx_kp_u_Parameter_value_too_long __pyx_string_tab[124]
#define __pyx_kp_u_ParserSchemaValidationContext_n __pyx_string_tab[125]
#define __pyx_kp_u_Parsing_requires_string_data __pyx_string_tab[126]
#define __pyx_kp_u_Prefix __pyx_string_tab[127]
#define __pyx_kp_u_Prefix_format_reserved_for_inter __pyx_string_tab[128]
#define __pyx_kp_u_Prefix_too_long __pyx_string_tab[129]
#define __pyx_kp_u_Proxy_invalidated __pyx_string_tab[130]
#define __pyx_kp_u_RELAXNG_OK_0_RELAXNG_ERR_MEMORY __pyx_string_tab[131]
#define __pyx_kp_u_Registered_element_classes_must __pyx_string_tab[132]
#define __pyx_kp_u_Registered_functions_must_be_cal __pyx_string_tab[133]
#define __pyx_kp_u_RelaxNG_instance_not_initialised __pyx_string_tab[134]
#define __pyx_kp_u_SYSTEM __pyx_string_tab[135]
#define __pyx_kp_u_Schema_instance_not_initialised __pyx_string_tab[136]
#define __pyx_kp_u_Schematron_instance_not_initiali __pyx_string_tab[137]
#define __pyx_kp_u_Serialisation_to_unicode_must_no __pyx_string_tab[138]
#define __pyx_kp_u_Step_may_not_be_zero_axis_d __pyx_string_tab[139]
#define __pyx_kp_u_Syntax_error_while_parsing_an_XM __pyx_string_tab[140]
#define __pyx_kp_u_Syntax_error_while_parsing_an_XM_2 __pyx_string_tab[141]
#define __pyx_kp_u_System_URL_may_not_contain_both __pyx_string_tab[142]
#define __pyx_kp_u_The_docstring_option_is_deprecat __pyx_string_tab[143]
#define __pyx_kp_u_The_non_ISO_Schematron_feature_i __pyx_string_tab[144]
#define __pyx_kp_u_The_strip_cdata_option_of_HTMLPa __pyx_string_tab[145]
#define __pyx_kp_u_This_class_cannot_be_instantiate __pyx_string_tab[146]
#define __pyx_kp_u_This_is_not_a_supported_node_set __pyx_string_tab[147]
#define __pyx_kp_u_This_search_incorrectly_ignores __pyx_string_tab[148]
#define __pyx_kp_u_This_type_cannot_be_instantiated __pyx_string_tab[149]
#define __pyx_kp_u_Tried_to_unregister_unknown_prox __pyx_string_tab[150]
#define __pyx_kp_u_Truth_testing_of_elements_was_a __pyx_string_tab[151]
#define __pyx_kp_u_Type __pyx_string_tab[152]
#define __pyx_kp_u_US_ASCII __pyx_string_tab[153]
#define __pyx_kp_u_UTF_8 __pyx_string_tab[154]
#define __pyx_kp_u_Unable_to_convert_item_to_object __pyx_string_tab[155]
#define __pyx_kp_u_Undefined_xpath_result __pyx_string_tab[156]
#define __pyx_kp_u_Unicode_strings_with_encoding_de __pyx_string_tab[157]
#define __pyx_kp_u_Unknown_libxml2_version __pyx_string_tab[158]
#define __pyx_kp_u_Unknown_node_type __pyx_string_tab[159]
#define __pyx_kp_u_Unknown_return_type __pyx_string_tab[160]
#define __pyx_kp_u_Unknown_xpath_result __pyx_string_tab[161]
#define __pyx_kp_u_Unsupported_element_type __pyx_string_tab[162]
#define __pyx_kp_u_Unsupported_node_type __pyx_string_tab[163]
#define __pyx_kp_u_XInclude_instance_not_initialise __pyx_string_tab[164]
#define __pyx_kp_u_XInclude_processing_failed __pyx_string_tab[165]
#define __pyx_kp_u_XInclude_processor_not_initialis __pyx_string_tab[166]
#define __pyx_kp_u_XML_declaration_already_written __pyx_string_tab[167]
#define __pyx_kp_u_XML_line_3387 __pyx_string_tab[168]
#define __pyx_kp_u_XML_text_parser_None_base_url_No __pyx_string_tab[169]
#define __pyx_kp_u_XPath_context_is_only_usable_dur __pyx_string_tab[170]
#define __pyx_kp_u_XPath_context_not_initialised __pyx_string_tab[171]
#define __pyx_kp_u_XPath_evaluator_locking_failed __pyx_string_tab[172]
#define __pyx_kp_u_XPath_evaluator_not_initialised __pyx_string_tab[173]
#define __pyx_kp_u_XPath_function __pyx_string_tab[174]
#define __pyx_kp_u_XSLT_context_not_initialised __pyx_string_tab[175]
#define __pyx_kp_u_XSLT_stylesheet_not_initialised __pyx_string_tab[176]
#define __pyx_kp_u__10 __pyx_string_tab[177]
#define __pyx_kp_u__11 __pyx_string_tab[178]
#define __pyx_kp_u__12 __pyx_string_tab[179]
#define __pyx_kp_u__13 __pyx_string_tab[180]
#define __pyx_kp_u__14 __pyx_string_tab[181]
#define __pyx_kp_u__15 __pyx_string_tab[182]
#define __pyx_kp_u__16 __pyx_string_tab[183]
#define __pyx_kp_u__17 __pyx_string_tab[184]
#define __pyx_kp_u__18 __pyx_string_tab[185]
#define __pyx_kp_u__19 __pyx_string_tab[186]
#define __pyx_kp_u__2 __pyx_string_tab[187]
#define __pyx_kp_u__20 __pyx_string_tab[188]
#define __pyx_kp_u__21 __pyx_string_tab[189]
#define __pyx_kp_u__22 __pyx_string_tab[190]
#define __pyx_kp_u__23 __pyx_string_tab[191]
#define __pyx_kp_u__24 __pyx_string_tab[192]
#define __pyx_kp_u__25 __pyx_string_tab[193]
#define __pyx_kp_u__27 __pyx_string_tab[194]
#define __pyx_kp_u__29 __pyx_string_tab[195]
#define __pyx_kp_u__3 __pyx_string_tab[196]
#define __pyx_kp_u__37 __pyx_string_tab[197]
#define __pyx_kp_u__38 __pyx_string_tab[198]
#define __pyx_kp_u__39 __pyx_string_tab[199]
#define __pyx_kp_u__4 __pyx_string_tab[200]
#define __pyx_kp_u__40 __pyx_string_tab[201]
#define __pyx_kp_u__41 __pyx_string_tab[202]
#define __pyx_kp_u__42 __pyx_string_tab[203]
#define __pyx_kp_u__43 __pyx_string_tab[204]
#define __pyx_kp_u__44 __pyx_string_tab[205]
#define __pyx_kp_u__5 __pyx_string_tab[206]
#define __pyx_kp_u__6 __pyx_string_tab[207]
#define __pyx_kp_u__7 __pyx_string_tab[208]
#define __pyx_kp_u__8 __pyx_string_tab[209]
#define __pyx_kp_u__9 __pyx_string_tab[210]
#define __pyx_kp_u_add_note __pyx_string_tab[211]
#define __pyx_kp_u_ambiguous_reference_to_embedded __pyx_string_tab[212]
#define __pyx_kp_u_amp __pyx_string_tab[213]
#define __pyx_kp_u_and __pyx_string_tab[214]
#define __pyx_kp_u_argument_must_be_a_byte_string_o __pyx_string_tab[215]
#define __pyx_kp_u_at_0x __pyx_string_tab[216]
#define __pyx_kp_u_attempt_to_assign_sequence_of_si __pyx_string_tab[217]
#define __pyx_kp_u_boolean_xs_attribute_default_or __pyx_string_tab[218]
#define __pyx_kp_u_cannot_add_ancestor_as_sibling_p __pyx_string_tab[219]
#define __pyx_kp_u_cannot_append_document_already_h __pyx_string_tab[220]
#define __pyx_kp_u_cannot_append_parent_to_itself __pyx_string_tab[221]
#define __pyx_kp_u_cannot_append_trailing_element_t __pyx_string_tab[222]
#define __pyx_kp_u_cannot_assign_None __pyx_string_tab[223]
#define __pyx_kp_u_cannot_be_serialized __pyx_string_tab[224]
#define __pyx_kp_u_cannot_parse_from __pyx_string_tab[225]
#define __pyx_kp_u_cannot_serialize __pyx_string_tab[226]
#define __pyx_kp_u_cannot_set_a_maximum_stylesheet __pyx_string_tab[227]
#define __pyx_kp_u_collections_abc __pyx_string_tab[228]
#define __pyx_kp_u_column __pyx_string_tab[229]
#define __pyx_kp_u_comment_class_must_be_subclass_o __pyx_string_tab[230]
#define __pyx_kp_u_compact_syntax_not_supported_ple __pyx_string_tab[231]
#define __pyx_kp_u_contiguous_and_direct __pyx_string_tab[232]
#define __pyx_kp_u_contiguous_and_indirect __pyx_string_tab[233]
#define __pyx_kp_u_default_2 __pyx_string_tab[234]
#define __pyx_kp_u_default_value __pyx_string_tab[235]
#define __pyx_kp_u_disable __pyx_string_tab[236]
#define __pyx_kp_u_document_context_is_missing __pyx_string_tab[237]
#define __pyx_kp_u_document_external_context_nodes __pyx_string_tab[238]
#define __pyx_kp_u_double_registering_proxy __pyx_string_tab[239]
#define __pyx_kp_u_either_filename_or_external_ID_r __pyx_string_tab[240]
#define __pyx_kp_u_element_class_must_be_subclass_o __pyx_string_tab[241]
#define __pyx_kp_u_elemname __pyx_string_tab[242]
#define __pyx_kp_u_empty_namespace_prefix_is_not_su __pyx_string_tab[243]
#define __pyx_kp_u_empty_prefix_is_not_supported_in __pyx_string_tab[244]
#define __pyx_kp_u_enable __pyx_string_tab[245]
#define __pyx_kp_u_end_ns __pyx_string_tab[246]
#define __pyx_kp_u_end_tag_mismatch_expected __pyx_string_tab[247]
#define __pyx_kp_u_error_parsing_DTD __pyx_string_tab[248]
#define __pyx_kp_u_expected __pyx_string_tab[249]
#define __pyx_kp_u_expected_string_CDATA_or_Elemen __pyx_string_tab[250]
#define __pyx_kp_u_extension_element __pyx_string_tab[251]
#define __pyx_kp_u_extensions_must_have_non_empty_n __pyx_string_tab[252]
#define __pyx_kp_u_extensions_must_not_have_empty_n __pyx_string_tab[253]
#define __pyx_kp_u_file_must_be_a_filename_file_lik __pyx_string_tab[254]
#define __pyx_kp_u_g_1_g_2 __pyx_string_tab[255]
#define __pyx_kp_u_gc __pyx_string_tab[256]
#define __pyx_kp_u_got __pyx_string_tab[257]
#define __pyx_kp_u_got_2 __pyx_string_tab[258]
#define __pyx_kp_u_got_differing_extents_in_dimensi __pyx_string_tab[259]
#define __pyx_kp_u_got_invalid_input_value_of_type __pyx_string_tab[260]
#define __pyx_kp_u_gt __pyx_string_tab[261]
#define __pyx_kp_u_href_2 __pyx_string_tab[262]
#define __pyx_kp_u_http_www_w3_org_1999_XSL_Transfo __pyx_string_tab[263]
#define __pyx_kp_u_http_www_w3_org_2001_XMLSchema __pyx_string_tab[264]
#define __pyx_kp_u_http_www_w3_org_XML_1998_namesp __pyx_string_tab[265]
#define __pyx_kp_u_http_www_w3_org_XML_1998_namespa __pyx_string_tab[266]
#define __pyx_kp_u_in_public_id __pyx_string_tab[267]
#define __pyx_kp_u_inconsistent_exit_action_in_cont __pyx_string_tab[268]
#define __pyx_kp_u_index_out_of_range __pyx_string_tab[269]
#define __pyx_kp_u_input_is_not_an_Element __pyx_string_tab[270]
#define __pyx_kp_u_internal_error_tail __pyx_string_tab[271]
#define __pyx_kp_u_internal_error_text __pyx_string_tab[272]
#define __pyx_kp_u_invalid_DTD_proxy_at_s __pyx_string_tab[273]
#define __pyx_kp_u_invalid_Document_proxy_at_s __pyx_string_tab[274]
#define __pyx_kp_u_invalid_Element_proxy_at_s __pyx_string_tab[275]
#define __pyx_kp_u_invalid_argument_type __pyx_string_tab[276]
#define __pyx_kp_u_invalid_element __pyx_string_tab[277]
#define __pyx_kp_u_invalid_event_name __pyx_string_tab[278]
#define __pyx_kp_u_invalid_node_type __pyx_string_tab[279]
#define __pyx_kp_u_is_not_declared_in_scope __pyx_string_tab[280]
#define __pyx_kp_u_isenabled __pyx_string_tab[281]
#define __pyx_kp_u_itemsize_0_for_cython_array __pyx_string_tab[282]
#define __pyx_kp_u_key_not_found __pyx_string_tab[283]
#define __pyx_kp_u_libxml2_d_d_d __pyx_string_tab[284]
#define __pyx_kp_u_line __pyx_string_tab[285]
#define __pyx_kp_u_line_3 __pyx_string_tab[286]
#define __pyx_kp_u_list_index_out_of_range __pyx_string_tab[287]
#define __pyx_kp_u_list_index_x_x_not_in_list __pyx_string_tab[288]
#define __pyx_kp_u_list_index_x_x_not_in_slice __pyx_string_tab[289]
#define __pyx_kp_u_lt __pyx_string_tab[290]
#define __pyx_kp_u_lxml_etree_was_compiled_without __pyx_string_tab[291]
#define __pyx_kp_u_malformed_PI_attributes __pyx_string_tab[292]
#define __pyx_kp_u_missing_end_tags __pyx_string_tab[293]
#define __pyx_kp_u_missing_toplevel_element __pyx_string_tab[294]
#define __pyx_kp_u_no_content_written __pyx_string_tab[295]
#define __pyx_kp_u_no_context_node __pyx_string_tab[296]
#define __pyx_kp_u_no_default___reduce___due_to_non __pyx_string_tab[297]
#define __pyx_kp_u_no_element_found __pyx_string_tab[298]
#define __pyx_kp_u_not_found __pyx_string_tab[299]
#define __pyx_kp_u_not_found_2 __pyx_string_tab[300]
#define __pyx_kp_u_not_in_an_element __pyx_string_tab[301]
#define __pyx_kp_u_ns_d __pyx_string_tab[302]
#define __pyx_kp_u_object_2 __pyx_string_tab[303]
#define __pyx_kp_u_object_name __pyx_string_tab[304]
#define __pyx_kp_u_occur __pyx_string_tab[305]
#define __pyx_kp_u_of_QName __pyx_string_tab[306]
#define __pyx_kp_u_of_name __pyx_string_tab[307]
#define __pyx_kp_u_only_XML_documents_have_declarat __pyx_string_tab[308]
#define __pyx_kp_u_only_setting_the_href_attribute __pyx_string_tab[309]
#define __pyx_kp_u_parser_locking_failed __pyx_string_tab[310]
#define __pyx_kp_u_passing_a_single_string_into_fro __pyx_string_tab[311]
#define __pyx_kp_u_pending_open_tags_on_close __pyx_string_tab[312]
#define __pyx_kp_u_pop_expected_at_most_2_arguments __pyx_string_tab[313]
#define __pyx_kp_u_prefix_2 __pyx_string_tab[314]
#define __pyx_kp_u_quot __pyx_string_tab[315]
#define __pyx_kp_u_reading_file_objects_must_return __pyx_string_tab[316]
#define __pyx_kp_u_reading_from_file_like_objects_m __pyx_string_tab[317]
#define __pyx_kp_u_reference_to_non_existing_embedd __pyx_string_tab[318]
#define __pyx_kp_u_restructuredtext_en __pyx_string_tab[319]
#define __pyx_kp_u_result_of_class_lookup_must_be_s __pyx_string_tab[320]
#define __pyx_kp_u_rnc __pyx_string_tab[321]
#define __pyx_kp_u_s __pyx_string_tab[322]
#define __pyx_kp_u_s_2 __pyx_string_tab[323]
#define __pyx_kp_u_s_3 __pyx_string_tab[324]
#define __pyx_kp_u_s_href_s_s __pyx_string_tab[325]
#define __pyx_kp_u_s_r __pyx_string_tab[326]
#define __pyx_kp_u_s_w_s_s __pyx_string_tab[327]
#define __pyx_kp_u_setting_default_namespace_is_not __pyx_string_tab[328]
#define __pyx_kp_u_src_lxml_classlookup_pxi __pyx_string_tab[329]
#define __pyx_kp_u_src_lxml_cleanup_pxi __pyx_string_tab[330]
#define __pyx_kp_u_src_lxml_debug_pxi __pyx_string_tab[331]
#define __pyx_kp_u_src_lxml_docloader_pxi __pyx_string_tab[332]
#define __pyx_kp_u_src_lxml_dtd_pxi __pyx_string_tab[333]
#define __pyx_kp_u_src_lxml_etree_pyx __pyx_string_tab[334]
#define __pyx_kp_u_src_lxml_extensions_pxi __pyx_string_tab[335]
#define __pyx_kp_u_src_lxml_iterparse_pxi __pyx_string_tab[336]
#define __pyx_kp_u_src_lxml_nsclasses_pxi __pyx_string_tab[337]
#define __pyx_kp_u_src_lxml_parser_pxi __pyx_string_tab[338]
#define __pyx_kp_u_src_lxml_parsertarget_pxi __pyx_string_tab[339]
#define __pyx_kp_u_src_lxml_readonlytree_pxi __pyx_string_tab[340]
#define __pyx_kp_u_src_lxml_relaxng_pxi __pyx_string_tab[341]
#define __pyx_kp_u_src_lxml_saxparser_pxi __pyx_string_tab[342]
#define __pyx_kp_u_src_lxml_serializer_pxi __pyx_string_tab[343]
#define __pyx_kp_u_src_lxml_xmlerror_pxi __pyx_string_tab[344]
#define __pyx_kp_u_src_lxml_xmlid_pxi __pyx_string_tab[345]
#define __pyx_kp_u_src_lxml_xpath_pxi __pyx_string_tab[346]
#define __pyx_kp_u_src_lxml_xslt_pxi __pyx_string_tab[347]
#define __pyx_kp_u_src_lxml_xsltext_pxi __pyx_string_tab[348]
#define __pyx_kp_u_start_ns __pyx_string_tab[349]
#define __pyx_kp_u_strided_and_direct __pyx_string_tab[350]
#define __pyx_kp_u_strided_and_direct_or_indirect __pyx_string_tab[351]
#define __pyx_kp_u_strided_and_indirect __pyx_string_tab[352]
#define __pyx_kp_u_string __pyx_string_tab[353]
#define __pyx_kp_u_string___STRING__XSLT_2 __pyx_string_tab[354]
#define __pyx_kp_u_string_id __pyx_string_tab[355]
#define __pyx_kp_u_text_root __pyx_string_tab[356]
#define __pyx_kp_u_this_element_does_not_have_child __pyx_string_tab[357]
#define __pyx_kp_u_to_extended_slice_of_size __pyx_string_tab[358]
#define __pyx_kp_u_type_2 __pyx_string_tab[359]
#define __pyx_kp_u_type_3 __pyx_string_tab[360]
#define __pyx_kp_u_unable_to_allocate_array_data __pyx_string_tab[361]
#define __pyx_kp_u_unable_to_allocate_shape_and_str __pyx_string_tab[362]
#define __pyx_kp_u_undecodable_error_message __pyx_string_tab[363]
#define __pyx_kp_u_unknown_encoding __pyx_string_tab[364]
#define __pyx_kp_u_unknown_error __pyx_string_tab[365]
#define __pyx_kp_u_unknown_error_2 __pyx_string_tab[366]
#define __pyx_kp_u_unknown_output_method __pyx_string_tab[367]
#define __pyx_kp_u_unsupported_XSLT_result_type __pyx_string_tab[368]
#define __pyx_kp_u_unsupported_element_type_for_top __pyx_string_tab[369]
#define __pyx_kp_u_utf_8 __pyx_string_tab[370]
#define __pyx_kp_u_w_w __pyx_string_tab[371]
#define __pyx_kp_u_x20_x0D_x0Aa_zA_Z0_9 __pyx_string_tab[372]
#define __pyx_kp_u_x9 __pyx_string_tab[373]
#define __pyx_kp_u_xA __pyx_string_tab[374]
#define __pyx_kp_u_xD __pyx_string_tab[375]
#define __pyx_kp_u_xml_s_encoding_s_s_s __pyx_string_tab[376]
#define __pyx_kp_u_xml_xml __pyx_string_tab[377]
#define __pyx_kp_u_xmlns __pyx_string_tab[378]
#define __pyx_kp_u_xsl_stylesheet_xml_id_id __pyx_string_tab[379]
#define __pyx_kp_u_xslt_2 __pyx_string_tab[380]
#define __pyx_n_u_ABC __pyx_string_tab[381]
#define __pyx_n_u_ASCII __pyx_string_tab[382]
#define __pyx_n_u_AncestorsIterator __pyx_string_tab[383]
#define __pyx_n_u_AppendOnlyElementProxy_append __pyx_string_tab[384]
#define __pyx_n_u_AppendOnlyElementProxy_extend __pyx_string_tab[385]
#define __pyx_n_u_AsyncDataWriter_close __pyx_string_tab[386]
#define __pyx_n_u_AsyncDataWriter_write __pyx_string_tab[387]
#define __pyx_n_u_AsyncFileWriterElement___aenter __pyx_string_tab[388]
#define __pyx_n_u_AsyncFileWriterElement___aexit __pyx_string_tab[389]
#define __pyx_n_u_AsyncIncrementalFileWriter__clo __pyx_string_tab[390]
#define __pyx_n_u_AsyncIncrementalFileWriter_elem __pyx_string_tab[391]
#define __pyx_n_u_AsyncIncrementalFileWriter_flus __pyx_string_tab[392]
#define __pyx_n_u_AsyncIncrementalFileWriter_meth __pyx_string_tab[393]
#define __pyx_n_u_AsyncIncrementalFileWriter_writ __pyx_string_tab[394]
#define __pyx_n_u_AsyncIncrementalFileWriter_writ_2 __pyx_string_tab[395]
#define __pyx_n_u_AsyncIncrementalFileWriter_writ_3 __pyx_string_tab[396]
#define __pyx_n_u_Attrib __pyx_string_tab[397]
#define __pyx_n_u_Attrib___copy __pyx_string_tab[398]
#define __pyx_n_u_Attrib___deepcopy __pyx_string_tab[399]
#define __pyx_n_u_Attrib_clear __pyx_string_tab[400]
#define __pyx_n_u_Attrib_get __pyx_string_tab[401]
#define __pyx_n_u_Attrib_has_key __pyx_string_tab[402]
#define __pyx_n_u_Attrib_items __pyx_string_tab[403]
#define __pyx_n_u_Attrib_iteritems __pyx_string_tab[404]
#define __pyx_n_u_Attrib_iterkeys __pyx_string_tab[405]
#define __pyx_n_u_Attrib_itervalues __pyx_string_tab[406]
#define __pyx_n_u_Attrib_keys __pyx_string_tab[407]
#define __pyx_n_u_Attrib_pop __pyx_string_tab[408]
#define __pyx_n_u_Attrib_update __pyx_string_tab[409]
#define __pyx_n_u_Attrib_values __pyx_string_tab[410]
#define __pyx_n_u_AttributeBasedElementClassLookup __pyx_string_tab[411]
#define __pyx_n_u_B __pyx_string_tab[412]
#define __pyx_n_u_BE __pyx_string_tab[413]
#define __pyx_n_u_BaseErrorLog __pyx_string_tab[414]
#define __pyx_n_u_BaseErrorLog_copy __pyx_string_tab[415]
#define __pyx_n_u_BaseErrorLog_receive __pyx_string_tab[416]
#define __pyx_n_u_BaseParser_copy __pyx_string_tab[417]
#define __pyx_n_u_BaseParser_makeelement __pyx_string_tab[418]
#define __pyx_n_u_BaseParser_set_element_class_lo __pyx_string_tab[419]
#define __pyx_n_u_BytesIO __pyx_string_tab[420]
#define __pyx_n_u_C14NError __pyx_string_tab[421]
#define __pyx_n_u_C14NWriterTarget __pyx_string_tab[422]
#define __pyx_n_u_C14NWriterTarget__iter_namespace __pyx_string_tab[423]
#define __pyx_n_u_C14NWriterTarget__start_locals_l __pyx_string_tab[424]
#define __pyx_n_u_C14NWriterTarget_close __pyx_string_tab[425]
#define __pyx_n_u_C14NWriterTarget_comment __pyx_string_tab[426]
#define __pyx_n_u_C14NWriterTarget_data __pyx_string_tab[427]
#define __pyx_n_u_C14NWriterTarget_end __pyx_string_tab[428]
#define __pyx_n_u_C14NWriterTarget_pi __pyx_string_tab[429]
#define __pyx_n_u_C14NWriterTarget_start __pyx_string_tab[430]
#define __pyx_n_u_C14NWriterTarget_start_ns __pyx_string_tab[431]
#define __pyx_n_u_CDATA_2 __pyx_string_tab[432]
#define __pyx_n_u_CRITICAL __pyx_string_tab[433]
#define __pyx_n_u_CSSSelector __pyx_string_tab[434]
#define __pyx_n_u_Comment __pyx_string_tab[435]
#define __pyx_n_u_CommentBase __pyx_string_tab[436]
#define __pyx_n_u_Comment_2 __pyx_string_tab[437]
#define __pyx_n_u_ContentOnlyElement_append __pyx_string_tab[438]
#define __pyx_n_u_ContentOnlyElement_get __pyx_string_tab[439]
#define __pyx_n_u_ContentOnlyElement_insert __pyx_string_tab[440]
#define __pyx_n_u_ContentOnlyElement_items __pyx_string_tab[441]
#define __pyx_n_u_ContentOnlyElement_keys __pyx_string_tab[442]
#define __pyx_n_u_ContentOnlyElement_set __pyx_string_tab[443]
#define __pyx_n_u_ContentOnlyElement_values __pyx_string_tab[444]
#define __pyx_n_u_CustomElementClassLookup __pyx_string_tab[445]
#define __pyx_n_u_CustomElementClassLookup_lookup __pyx_string_tab[446]
#define __pyx_n_u_DEBUG __pyx_string_tab[447]
#define __pyx_n_u_DENY_ALL __pyx_string_tab[448]
#define __pyx_n_u_DENY_WRITE __pyx_string_tab[449]
#define __pyx_n_u_DTD __pyx_string_tab[450]
#define __pyx_n_u_DTDAttributeDecl_itervalues __pyx_string_tab[451]
#define __pyx_n_u_DTDAttributeDecl_values __pyx_string_tab[452]
#define __pyx_n_u_DTDElementDecl_attributes __pyx_string_tab[453]
#define __pyx_n_u_DTDElementDecl_iterattributes __pyx_string_tab[454]
#define __pyx_n_u_DTDError __pyx_string_tab[455]
#define __pyx_n_u_DTDParseError __pyx_string_tab[456]
#define __pyx_n_u_DTDValidateError __pyx_string_tab[457]
#define __pyx_n_u_DTD_elements __pyx_string_tab[458]
#define __pyx_n_u_DTD_entities __pyx_string_tab[459]
#define __pyx_n_u_DTD_iterelements __pyx_string_tab[460]
#define __pyx_n_u_DTD_iterentities __pyx_string_tab[461]
#define __pyx_n_u_DocInfo __pyx_string_tab[462]
#define __pyx_n_u_DocInfo_clear __pyx_string_tab[463]
#define __pyx_n_u_Document __pyx_string_tab[464]
#define __pyx_n_u_DocumentInvalid __pyx_string_tab[465]
#define __pyx_n_u_DomainErrorLog __pyx_string_tab[466]
#define __pyx_n_u_DomainErrorLog_receive __pyx_string_tab[467]
#define __pyx_n_u_ERROR __pyx_string_tab[468]
#define __pyx_n_u_ERR_INVALID_CHAR __pyx_string_tab[469]
#define __pyx_n_u_ERR_UNDECLARED_ENTITY __pyx_string_tab[470]
#define __pyx_n_u_ETCompatXMLParser __pyx_string_tab[471]
#define __pyx_n_u_ETXPath __pyx_string_tab[472]
#define __pyx_n_u_ElementBase __pyx_string_tab[473]
#define __pyx_n_u_ElementChildIterator __pyx_string_tab[474]
#define __pyx_n_u_ElementClassLookup __pyx_string_tab[475]
#define __pyx_n_u_ElementDefaultClassLookup __pyx_string_tab[476]
#define __pyx_n_u_ElementDepthFirstIterator __pyx_string_tab[477]
#define __pyx_n_u_ElementIterator __pyx_string_tab[478]
#define __pyx_n_u_ElementMatchIterator __pyx_string_tab[479]
#define __pyx_n_u_ElementNamespaceClassLookup __pyx_string_tab[480]
#define __pyx_n_u_ElementNamespaceClassLookup_get __pyx_string_tab[481]
#define __pyx_n_u_ElementTagMatcher __pyx_string_tab[482]
#define __pyx_n_u_ElementTextIterator __pyx_string_tab[483]
#define __pyx_n_u_ElementTree __pyx_string_tab[484]
#define __pyx_n_u_ElementTree_2 __pyx_string_tab[485]
#define __pyx_n_u_ElementTree___copy __pyx_string_tab[486]
#define __pyx_n_u_ElementTree___deepcopy __pyx_string_tab[487]
#define __pyx_n_u_ElementTree___new __pyx_string_tab[488]
#define __pyx_n_u_ElementTree__setroot __pyx_string_tab[489]
#define __pyx_n_u_ElementTree_find __pyx_string_tab[490]
#define __pyx_n_u_ElementTree_findall __pyx_string_tab[491]
#define __pyx_n_u_ElementTree_findtext __pyx_string_tab[492]
#define __pyx_n_u_ElementTree_getelementpath __pyx_string_tab[493]
#define __pyx_n_u_ElementTree_getiterator __pyx_string_tab[494]
#define __pyx_n_u_ElementTree_getpath __pyx_string_tab[495]
#define __pyx_n_u_ElementTree_getroot __pyx_string_tab[496]
#define __pyx_n_u_ElementTree_iter __pyx_string_tab[497]
#define __pyx_n_u_ElementTree_iterfind __pyx_string_tab[498]
#define __pyx_n_u_ElementTree_parse __pyx_string_tab[499]
#define __pyx_n_u_ElementTree_relaxng __pyx_string_tab[500]
#define __pyx_n_u_ElementTree_write __pyx_string_tab[501]
#define __pyx_n_u_ElementTree_write_c14n __pyx_string_tab[502]
#define __pyx_n_u_ElementTree_xinclude __pyx_string_tab[503]
#define __pyx_n_u_ElementTree_xmlschema __pyx_string_tab[504]
#define __pyx_n_u_ElementTree_xpath __pyx_string_tab[505]
#define __pyx_n_u_ElementTree_xslt __pyx_string_tab[506]
#define __pyx_n_u_ElementUnicodeResult __pyx_string_tab[507]
#define __pyx_n_u_ElementUnicodeResult_getparent __pyx_string_tab[508]
#define __pyx_n_u_Element_2 __pyx_string_tab[509]
#define __pyx_n_u_Element_3 __pyx_string_tab[510]
#define __pyx_n_u_Element___copy __pyx_string_tab[511]
#define __pyx_n_u_Element___deepcopy __pyx_string_tab[512]
#define __pyx_n_u_Element___new __pyx_string_tab[513]
#define __pyx_n_u_Element___reversed __pyx_string_tab[514]
#define __pyx_n_u_Element__init __pyx_string_tab[515]
#define __pyx_n_u_Element_addnext __pyx_string_tab[516]
#define __pyx_n_u_Element_addprevious __pyx_string_tab[517]
#define __pyx_n_u_Element_append __pyx_string_tab[518]
#define __pyx_n_u_Element_clear __pyx_string_tab[519]
#define __pyx_n_u_Element_cssselect __pyx_string_tab[520]
#define __pyx_n_u_Element_extend __pyx_string_tab[521]
#define __pyx_n_u_Element_find __pyx_string_tab[522]
#define __pyx_n_u_Element_findall __pyx_string_tab[523]
#define __pyx_n_u_Element_findtext __pyx_string_tab[524]
#define __pyx_n_u_Element_get __pyx_string_tab[525]
#define __pyx_n_u_Element_getchildren __pyx_string_tab[526]
#define __pyx_n_u_Element_getiterator __pyx_string_tab[527]
#define __pyx_n_u_Element_getnext __pyx_string_tab[528]
#define __pyx_n_u_Element_getparent __pyx_string_tab[529]
#define __pyx_n_u_Element_getprevious __pyx_string_tab[530]
#define __pyx_n_u_Element_getroottree __pyx_string_tab[531]
#define __pyx_n_u_Element_index __pyx_string_tab[532]
#define __pyx_n_u_Element_insert __pyx_string_tab[533]
#define __pyx_n_u_Element_items __pyx_string_tab[534]
#define __pyx_n_u_Element_iter __pyx_string_tab[535]
#define __pyx_n_u_Element_iterancestors __pyx_string_tab[536]
#define __pyx_n_u_Element_iterchildren __pyx_string_tab[537]
#define __pyx_n_u_Element_iterdescendants __pyx_string_tab[538]
#define __pyx_n_u_Element_iterfind __pyx_string_tab[539]
#define __pyx_n_u_Element_itersiblings __pyx_string_tab[540]
#define __pyx_n_u_Element_itertext __pyx_string_tab[541]
#define __pyx_n_u_Element_keys __pyx_string_tab[542]
#define __pyx_n_u_Element_makeelement __pyx_string_tab[543]
#define __pyx_n_u_Element_remove __pyx_string_tab[544]
#define __pyx_n_u_Element_replace __pyx_string_tab[545]
#define __pyx_n_u_Element_set __pyx_string_tab[546]
#define __pyx_n_u_Element_values __pyx_string_tab[547]
#define __pyx_n_u_Element_xpath __pyx_string_tab[548]
#define __pyx_n_u_Ellipsis __pyx_string_tab[549]
#define __pyx_n_u_Entity __pyx_string_tab[550]
#define __pyx_n_u_EntityBase __pyx_string_tab[551]
#define __pyx_n_u_Entity_2 __pyx_string_tab[552]
#define __pyx_n_u_Error __pyx_string_tab[553]
#define __pyx_n_u_ErrorDomains __pyx_string_tab[554]
#define __pyx_n_u_ErrorLevels __pyx_string_tab[555]
#define __pyx_n_u_ErrorLog __pyx_string_tab[556]
#define __pyx_n_u_ErrorLog___exit __pyx_string_tab[557]
#define __pyx_n_u_ErrorLog_clear __pyx_string_tab[558]
#define __pyx_n_u_ErrorLog_copy __pyx_string_tab[559]
#define __pyx_n_u_ErrorLog_receive __pyx_string_tab[560]
#define __pyx_n_u_ErrorTypes __pyx_string_tab[561]
#define __pyx_n_u_ExsltRegExp_match __pyx_string_tab[562]
#define __pyx_n_u_ExsltRegExp_replace __pyx_string_tab[563]
#define __pyx_n_u_ExsltRegExp_test __pyx_string_tab[564]
#define __pyx_n_u_Extension __pyx_string_tab[565]
#define __pyx_n_u_FATAL __pyx_string_tab[566]
#define __pyx_n_u_FallbackElementClassLookup __pyx_string_tab[567]
#define __pyx_n_u_FallbackElementClassLookup_set_f __pyx_string_tab[568]
#define __pyx_n_u_FeedParser __pyx_string_tab[569]
#define __pyx_n_u_FeedParser_close __pyx_string_tab[570]
#define __pyx_n_u_FeedParser_feed __pyx_string_tab[571]
#define __pyx_n_u_FileWriterElement___enter __pyx_string_tab[572]
#define __pyx_n_u_FileWriterElement___exit __pyx_string_tab[573]
#define __pyx_n_u_FunctionNamespace __pyx_string_tab[574]
#define __pyx_n_u_Generic __pyx_string_tab[575]
#define __pyx_n_u_GenericAlias __pyx_string_tab[576]
#define __pyx_n_u_GenericAlias_2 __pyx_string_tab[577]
#define __pyx_n_u_GlobalErrorLog __pyx_string_tab[578]
#define __pyx_n_u_GzipFile __pyx_string_tab[579]
#define __pyx_n_u_HTML __pyx_string_tab[580]
#define __pyx_n_u_HTMLParser __pyx_string_tab[581]
#define __pyx_n_u_HTMLParser___class_getitem __pyx_string_tab[582]
#define __pyx_n_u_HTMLPullParser __pyx_string_tab[583]
#define __pyx_n_u_HTMLPullParser_read_events __pyx_string_tab[584]
#define __pyx_n_u_ICONV_COMPILED_VERSION __pyx_string_tab[585]
#define __pyx_n_u_IDDict __pyx_string_tab[586]
#define __pyx_n_u_IDDict_copy __pyx_string_tab[587]
#define __pyx_n_u_IDDict_get __pyx_string_tab[588]
#define __pyx_n_u_IDDict_has_key __pyx_string_tab[589]
#define __pyx_n_u_IDDict_items __pyx_string_tab[590]
#define __pyx_n_u_IDDict_iteritems __pyx_string_tab[591]
#define __pyx_n_u_IDDict_iterkeys __pyx_string_tab[592]
#define __pyx_n_u_IDDict_itervalues __pyx_string_tab[593]
#define __pyx_n_u_IDDict_keys __pyx_string_tab[594]
#define __pyx_n_u_IDDict_values __pyx_string_tab[595]
#define __pyx_n_u_IGNORECASE __pyx_string_tab[596]
#define __pyx_n_u_ImmutableMapping __pyx_string_tab[597]
#define __pyx_n_u_ImmutableMapping___contains __pyx_string_tab[598]
#define __pyx_n_u_ImmutableMapping___delitem __pyx_string_tab[599]
#define __pyx_n_u_ImmutableMapping___getitem __pyx_string_tab[600]
#define __pyx_n_u_ImmutableMapping___iter __pyx_string_tab[601]
#define __pyx_n_u_ImmutableMapping___len __pyx_string_tab[602]
#define __pyx_n_u_ImmutableMapping___setitem __pyx_string_tab[603]
#define __pyx_n_u_IncrementalFileWriter_element __pyx_string_tab[604]
#define __pyx_n_u_IncrementalFileWriter_flush __pyx_string_tab[605]
#define __pyx_n_u_IncrementalFileWriter_method __pyx_string_tab[606]
#define __pyx_n_u_IncrementalFileWriter_write __pyx_string_tab[607]
#define __pyx_n_u_IncrementalFileWriter_write_dec __pyx_string_tab[608]
#define __pyx_n_u_IncrementalFileWriter_write_doc __pyx_string_tab[609]
#define __pyx_n_u_LE __pyx_string_tab[610]
#define __pyx_n_u_LIBXML_COMPILED_FEATURES __pyx_string_tab[611]
#define __pyx_n_u_LIBXML_COMPILED_VERSION __pyx_string_tab[612]
#define __pyx_n_u_LIBXML_FEATURES __pyx_string_tab[613]
#define __pyx_n_u_LIBXML_VERSION __pyx_string_tab[614]
#define __pyx_n_u_LIBXSLT_COMPILED_VERSION __pyx_string_tab[615]
#define __pyx_n_u_LIBXSLT_VERSION __pyx_string_tab[616]
#define __pyx_n_u_LXML_VERSION __pyx_string_tab[617]
#define __pyx_n_u_ListErrorLog __pyx_string_tab[618]
#define __pyx_n_u_ListErrorLog_copy __pyx_string_tab[619]
#define __pyx_n_u_ListErrorLog_filter_domains __pyx_string_tab[620]
#define __pyx_n_u_ListErrorLog_filter_from_errors __pyx_string_tab[621]
#define __pyx_n_u_ListErrorLog_filter_from_fatals __pyx_string_tab[622]
#define __pyx_n_u_ListErrorLog_filter_from_level __pyx_string_tab[623]
#define __pyx_n_u_ListErrorLog_filter_from_warnin __pyx_string_tab[624]
#define __pyx_n_u_ListErrorLog_filter_levels __pyx_string_tab[625]
#define __pyx_n_u_ListErrorLog_filter_types __pyx_string_tab[626]
#define __pyx_n_u_LogEntry __pyx_string_tab[627]
#define __pyx_n_u_LxmlError __pyx_string_tab[628]
#define __pyx_n_u_LxmlRegistryError __pyx_string_tab[629]
#define __pyx_n_u_LxmlSyntaxError __pyx_string_tab[630]
#define __pyx_n_u_MemDebug_blocks_used __pyx_string_tab[631]
#define __pyx_n_u_MemDebug_bytes_used __pyx_string_tab[632]
#define __pyx_n_u_MemDebug_dict_size __pyx_string_tab[633]
#define __pyx_n_u_MethodChanger___aenter __pyx_string_tab[634]
#define __pyx_n_u_MethodChanger___aexit __pyx_string_tab[635]
#define __pyx_n_u_MethodChanger___enter __pyx_string_tab[636]
#define __pyx_n_u_MethodChanger___exit __pyx_string_tab[637]
#define __pyx_n_u_MutableMapping __pyx_string_tab[638]
#define __pyx_n_u_NAMESPACE __pyx_string_tab[639]
#define __pyx_n_u_NamespaceRegistryError __pyx_string_tab[640]
#define __pyx_n_u_NamespaceRegistry___deco __pyx_string_tab[641]
#define __pyx_n_u_NamespaceRegistry__deco __pyx_string_tab[642]
#define __pyx_n_u_NamespaceRegistry_clear __pyx_string_tab[643]
#define __pyx_n_u_NamespaceRegistry_items __pyx_string_tab[644]
#define __pyx_n_u_NamespaceRegistry_iteritems __pyx_string_tab[645]
#define __pyx_n_u_NamespaceRegistry_update __pyx_string_tab[646]
#define __pyx_n_u_NotImplemented __pyx_string_tab[647]
#define __pyx_n_u_OpaqueDocumentWrapper_append __pyx_string_tab[648]
#define __pyx_n_u_OpaqueDocumentWrapper_extend __pyx_string_tab[649]
#define __pyx_n_u_OrderedDict __pyx_string_tab[650]
#define __pyx_n_u_PARSER __pyx_string_tab[651]
#define __pyx_n_u_PI __pyx_string_tab[652]
#define __pyx_n_u_PIBase __pyx_string_tab[653]
#define __pyx_n_u_ParseError __pyx_string_tab[654]
#define __pyx_n_u_ParseError___init __pyx_string_tab[655]
#define __pyx_n_u_ParseError_position __pyx_string_tab[656]
#define __pyx_n_u_ParserBasedElementClassLookup __pyx_string_tab[657]
#define __pyx_n_u_ParserDictionaryContext __pyx_string_tab[658]
#define __pyx_n_u_ParserError __pyx_string_tab[659]
#define __pyx_n_u_ProcessingInstruction __pyx_string_tab[660]
#define __pyx_n_u_ProcessingInstruction_2 __pyx_string_tab[661]
#define __pyx_n_u_ProcessingInstruction_get __pyx_string_tab[662]
#define __pyx_n_u_PyErrorLog __pyx_string_tab[663]
#define __pyx_n_u_PyErrorLog_copy __pyx_string_tab[664]
#define __pyx_n_u_PyErrorLog_log __pyx_string_tab[665]
#define __pyx_n_u_PyErrorLog_receive __pyx_string_tab[666]
#define __pyx_n_u_PythonElementClassLookup __pyx_string_tab[667]
#define __pyx_n_u_PythonElementClassLookup_lookup __pyx_string_tab[668]
#define __pyx_n_u_Pyx_PyDict_NextRef __pyx_string_tab[669]
#define __pyx_n_u_QName __pyx_string_tab[670]
#define __pyx_n_u_RELAXNGV __pyx_string_tab[671]
#define __pyx_n_u_ReadOnlyElementProxy_get __pyx_string_tab[672]
#define __pyx_n_u_ReadOnlyElementProxy_items __pyx_string_tab[673]
#define __pyx_n_u_ReadOnlyElementProxy_keys __pyx_string_tab[674]
#define __pyx_n_u_ReadOnlyElementProxy_values __pyx_string_tab[675]
#define __pyx_n_u_ReadOnlyProxy___copy __pyx_string_tab[676]
#define __pyx_n_u_ReadOnlyProxy___deepcopy __pyx_string_tab[677]
#define __pyx_n_u_ReadOnlyProxy_getchildren __pyx_string_tab[678]
#define __pyx_n_u_ReadOnlyProxy_getnext __pyx_string_tab[679]
#define __pyx_n_u_ReadOnlyProxy_getparent __pyx_string_tab[680]
#define __pyx_n_u_ReadOnlyProxy_getprevious __pyx_string_tab[681]
#define __pyx_n_u_ReadOnlyProxy_iterchildren __pyx_string_tab[682]
#define __pyx_n_u_RelaxNG __pyx_string_tab[683]
#define __pyx_n_u_RelaxNGError __pyx_string_tab[684]
#define __pyx_n_u_RelaxNGErrorTypes __pyx_string_tab[685]
#define __pyx_n_u_RelaxNGParseError __pyx_string_tab[686]
#define __pyx_n_u_RelaxNGValidateError __pyx_string_tab[687]
#define __pyx_n_u_RelaxNG_from_rnc_string __pyx_string_tab[688]
#define __pyx_n_u_Resolver __pyx_string_tab[689]
#define __pyx_n_u_ResolverRegistry_add __pyx_string_tab[690]
#define __pyx_n_u_ResolverRegistry_copy __pyx_string_tab[691]
#define __pyx_n_u_ResolverRegistry_remove __pyx_string_tab[692]
#define __pyx_n_u_ResolverRegistry_resolve __pyx_string_tab[693]
#define __pyx_n_u_Resolver_resolve __pyx_string_tab[694]
#define __pyx_n_u_Resolver_resolve_empty __pyx_string_tab[695]
#define __pyx_n_u_Resolver_resolve_file __pyx_string_tab[696]
#define __pyx_n_u_Resolver_resolve_filename __pyx_string_tab[697]
#define __pyx_n_u_Resolver_resolve_string __pyx_string_tab[698]
#define __pyx_n_u_RotatingErrorLog __pyx_string_tab[699]
#define __pyx_n_u_RotatingErrorLog_receive __pyx_string_tab[700]
#define __pyx_n_u_SaxParserTarget __pyx_string_tab[701]
#define __pyx_n_u_Schematron __pyx_string_tab[702]
#define __pyx_n_u_SchematronError __pyx_string_tab[703]
#define __pyx_n_u_SchematronParseError __pyx_string_tab[704]
#define __pyx_n_u_SchematronValidateError __pyx_string_tab[705]
#define __pyx_n_u_Sequence __pyx_string_tab[706]
#define __pyx_n_u_SerialisationError __pyx_string_tab[707]
#define __pyx_n_u_SiblingsIterator __pyx_string_tab[708]
#define __pyx_n_u_StringIO __pyx_string_tab[709]
#define __pyx_n_u_SubElement __pyx_string_tab[710]
#define __pyx_n_u_T __pyx_string_tab[711]
#define __pyx_n_u_TAG __pyx_string_tab[712]
#define __pyx_n_u_TargetParserResult __pyx_string_tab[713]
#define __pyx_n_u_TargetParserResult___init __pyx_string_tab[714]
#define __pyx_n_u_TreeBuilder __pyx_string_tab[715]
#define __pyx_n_u_TreeBuilder_close __pyx_string_tab[716]
#define __pyx_n_u_TreeBuilder_comment __pyx_string_tab[717]
#define __pyx_n_u_TreeBuilder_data __pyx_string_tab[718]
#define __pyx_n_u_TreeBuilder_end __pyx_string_tab[719]
#define __pyx_n_u_TreeBuilder_pi __pyx_string_tab[720]
#define __pyx_n_u_TreeBuilder_start __pyx_string_tab[721]
#define __pyx_n_u_TypeVar __pyx_string_tab[722]
#define __pyx_n_u_U __pyx_string_tab[723]
#define __pyx_n_u_UNICODE __pyx_string_tab[724]
#define __pyx_n_u_UTF8 __pyx_string_tab[725]
#define __pyx_n_u_Validator __pyx_string_tab[726]
#define __pyx_n_u_Validator__append_log_message __pyx_string_tab[727]
#define __pyx_n_u_Validator__clear_error_log __pyx_string_tab[728]
#define __pyx_n_u_Validator_assert __pyx_string_tab[729]
#define __pyx_n_u_Validator_assertValid __pyx_string_tab[730]
#define __pyx_n_u_Validator_validate __pyx_string_tab[731]
#define __pyx_n_u_View_MemoryView __pyx_string_tab[732]
#define __pyx_n_u_WARNING __pyx_string_tab[733]
#define __pyx_n_u_WAR_UNDECLARED_ENTITY __pyx_string_tab[734]
#define __pyx_n_u_XInclude __pyx_string_tab[735]
#define __pyx_n_u_XIncludeError __pyx_string_tab[736]
#define __pyx_n_u_XML __pyx_string_tab[737]
#define __pyx_n_u_XMLDTDID __pyx_string_tab[738]
#define __pyx_n_u_XMLID __pyx_string_tab[739]
#define __pyx_n_u_XMLParser __pyx_string_tab[740]
#define __pyx_n_u_XMLParser___class_getitem __pyx_string_tab[741]
#define __pyx_n_u_XMLPullParser __pyx_string_tab[742]
#define __pyx_n_u_XMLPullParser_read_events __pyx_string_tab[743]
#define __pyx_n_u_XMLSchema __pyx_string_tab[744]
#define __pyx_n_u_XMLSchemaError __pyx_string_tab[745]
#define __pyx_n_u_XMLSchemaParseError __pyx_string_tab[746]
#define __pyx_n_u_XMLSchemaValidateError __pyx_string_tab[747]
#define __pyx_n_u_XMLSyntaxAssertionError __pyx_string_tab[748]
#define __pyx_n_u_XMLSyntaxAssertionError___init __pyx_string_tab[749]
#define __pyx_n_u_XMLSyntaxError __pyx_string_tab[750]
#define __pyx_n_u_XMLTreeBuilder __pyx_string_tab[751]
#define __pyx_n_u_XPATH_LOCATIONSET __pyx_string_tab[752]
#define __pyx_n_u_XPATH_POINT __pyx_string_tab[753]
#define __pyx_n_u_XPATH_RANGE __pyx_string_tab[754]
#define __pyx_n_u_XPATH_USERS __pyx_string_tab[755]
#define __pyx_n_u_XPath __pyx_string_tab[756]
#define __pyx_n_u_XPathDocumentEvaluator __pyx_string_tab[757]
#define __pyx_n_u_XPathElementEvaluator __pyx_string_tab[758]
#define __pyx_n_u_XPathElementEvaluator_register_n __pyx_string_tab[759]
#define __pyx_n_u_XPathElementEvaluator_register_n_2 __pyx_string_tab[760]
#define __pyx_n_u_XPathError __pyx_string_tab[761]
#define __pyx_n_u_XPathEvalError __pyx_string_tab[762]
#define __pyx_n_u_XPathEvaluator __pyx_string_tab[763]
#define __pyx_n_u_XPathEvaluatorBase __pyx_string_tab[764]
#define __pyx_n_u_XPathFunctionError __pyx_string_tab[765]
#define __pyx_n_u_XPathResultError __pyx_string_tab[766]
#define __pyx_n_u_XPathSyntaxError __pyx_string_tab[767]
#define __pyx_n_u_XSLT __pyx_string_tab[768]
#define __pyx_n_u_XSLTAccessControl __pyx_string_tab[769]
#define __pyx_n_u_XSLTApplyError __pyx_string_tab[770]
#define __pyx_n_u_XSLTError __pyx_string_tab[771]
#define __pyx_n_u_XSLTErrorLog __pyx_string_tab[772]
#define __pyx_n_u_XSLTExtension __pyx_string_tab[773]
#define __pyx_n_u_XSLTExtensionError __pyx_string_tab[774]
#define __pyx_n_u_XSLTExtension_apply_templates __pyx_string_tab[775]
#define __pyx_n_u_XSLTExtension_execute __pyx_string_tab[776]
#define __pyx_n_u_XSLTExtension_process_children __pyx_string_tab[777]
#define __pyx_n_u_XSLTParseError __pyx_string_tab[778]
#define __pyx_n_u_XSLTProcessingInstruction __pyx_string_tab[779]
#define __pyx_n_u_XSLTProcessingInstruction_parse __pyx_string_tab[780]
#define __pyx_n_u_XSLTProcessingInstruction_set __pyx_string_tab[781]
#define __pyx_n_u_XSLTResultTree __pyx_string_tab[782]
#define __pyx_n_u_XSLTResultTree_write_output __pyx_string_tab[783]
#define __pyx_n_u_XSLTSaveError __pyx_string_tab[784]
#define __pyx_n_u_XSLT___copy __pyx_string_tab[785]
#define __pyx_n_u_XSLT___deepcopy __pyx_string_tab[786]
#define __pyx_n_u_XSLT_set_global_max_depth __pyx_string_tab[787]
#define __pyx_n_u_XSLT_strparam __pyx_string_tab[788]
#define __pyx_n_u_XSLT_tostring __pyx_string_tab[789]
#define __pyx_n_u__28 __pyx_string_tab[790]
#define __pyx_n_u_abc __pyx_string_tab[791]
#define __pyx_n_u_abspath __pyx_string_tab[792]
#define __pyx_n_u_accepted_domains __pyx_string_tab[793]
#define __pyx_n_u_access_control __pyx_string_tab[794]
#define __pyx_n_u_add __pyx_string_tab[795]
#define __pyx_n_u_addnext __pyx_string_tab[796]
#define __pyx_n_u_addprevious __pyx_string_tab[797]
#define __pyx_n_u_adopt_external_document __pyx_string_tab[798]
#define __pyx_n_u_aenter __pyx_string_tab[799]
#define __pyx_n_u_aexit __pyx_string_tab[800]
#define __pyx_n_u_all __pyx_string_tab[801]
#define __pyx_n_u_allocate_buffer __pyx_string_tab[802]
#define __pyx_n_u_alpha __pyx_string_tab[803]
#define __pyx_n_u_any __pyx_string_tab[804]
#define __pyx_n_u_append __pyx_string_tab[805]
#define __pyx_n_u_append_log_message __pyx_string_tab[806]
#define __pyx_n_u_apply_templates __pyx_string_tab[807]
#define __pyx_n_u_args __pyx_string_tab[808]
#define __pyx_n_u_ascii __pyx_string_tab[809]
#define __pyx_n_u_assert __pyx_string_tab[810]
#define __pyx_n_u_assertValid __pyx_string_tab[811]
#define __pyx_n_u_async_outfile __pyx_string_tab[812]
#define __pyx_n_u_asyncio_coroutines __pyx_string_tab[813]
#define __pyx_n_u_attrib __pyx_string_tab[814]
#define __pyx_n_u_attribute_defaults __pyx_string_tab[815]
#define __pyx_n_u_attribute_name __pyx_string_tab[816]
#define __pyx_n_u_attribute_names __pyx_string_tab[817]
#define __pyx_n_u_attributes __pyx_string_tab[818]
#define __pyx_n_u_attrs __pyx_string_tab[819]
#define __pyx_n_u_await __pyx_string_tab[820]
#define __pyx_n_u_base __pyx_string_tab[821]
#define __pyx_n_u_base_url __pyx_string_tab[822]
#define __pyx_n_u_beta __pyx_string_tab[823]
#define __pyx_n_u_blocks_used __pyx_string_tab[824]
#define __pyx_n_u_bstring __pyx_string_tab[825]
#define __pyx_n_u_buffered __pyx_string_tab[826]
#define __pyx_n_u_build_smart_strings __pyx_string_tab[827]
#define __pyx_n_u_bytes_used __pyx_string_tab[828]
#define __pyx_n_u_c __pyx_string_tab[829]
#define __pyx_n_u_c14n __pyx_string_tab[830]
#define __pyx_n_u_c14n2 __pyx_string_tab[831]
#define __pyx_n_u_c_attr __pyx_string_tab[832]
#define __pyx_n_u_c_attr_next __pyx_string_tab[833]
#define __pyx_n_u_c_attrs __pyx_string_tab[834]
#define __pyx_n_u_c_buffer __pyx_string_tab[835]
#define __pyx_n_u_c_child __pyx_string_tab[836]
#define __pyx_n_u_c_compression __pyx_string_tab[837]
#define __pyx_n_u_c_context_node __pyx_string_tab[838]
#define __pyx_n_u_c_ctxt __pyx_string_tab[839]
#define __pyx_n_u_c_dict __pyx_string_tab[840]
#define __pyx_n_u_c_doc __pyx_string_tab[841]
#define __pyx_n_u_c_dtd __pyx_string_tab[842]
#define __pyx_n_u_c_element __pyx_string_tab[843]
#define __pyx_n_u_c_encoding __pyx_string_tab[844]
#define __pyx_n_u_c_href __pyx_string_tab[845]
#define __pyx_n_u_c_method __pyx_string_tab[846]
#define __pyx_n_u_c_name __pyx_string_tab[847]
#define __pyx_n_u_c_new_next __pyx_string_tab[848]
#define __pyx_n_u_c_new_node __pyx_string_tab[849]
#define __pyx_n_u_c_next __pyx_string_tab[850]
#define __pyx_n_u_c_node __pyx_string_tab[851]
#define __pyx_n_u_c_node_copy __pyx_string_tab[852]
#define __pyx_n_u_c_node_next __pyx_string_tab[853]
#define __pyx_n_u_c_old_next __pyx_string_tab[854]
#define __pyx_n_u_c_old_node __pyx_string_tab[855]
#define __pyx_n_u_c_old_output_parent __pyx_string_tab[856]
#define __pyx_n_u_c_parent __pyx_string_tab[857]
#define __pyx_n_u_c_path __pyx_string_tab[858]
#define __pyx_n_u_c_source_doc __pyx_string_tab[859]
#define __pyx_n_u_c_standalone __pyx_string_tab[860]
#define __pyx_n_u_c_start __pyx_string_tab[861]
#define __pyx_n_u_c_start_node __pyx_string_tab[862]
#define __pyx_n_u_c_stop __pyx_string_tab[863]
#define __pyx_n_u_c_version __pyx_string_tab[864]
#define __pyx_n_u_canonicalize __pyx_string_tab[865]
#define __pyx_n_u_capsule __pyx_string_tab[866]
#define __pyx_n_u_cast __pyx_string_tab[867]
#define __pyx_n_u_catalog __pyx_string_tab[868]
#define __pyx_n_u_cdata __pyx_string_tab[869]
#define __pyx_n_u_child __pyx_string_tab[870]
#define __pyx_n_u_children __pyx_string_tab[871]
#define __pyx_n_u_class __pyx_string_tab[872]
#define __pyx_n_u_class_dict_iterable __pyx_string_tab[873]
#define __pyx_n_u_class_getitem __pyx_string_tab[874]
#define __pyx_n_u_class_mapping __pyx_string_tab[875]
#define __pyx_n_u_cleanup_namespaces __pyx_string_tab[876]
#define __pyx_n_u_clear __pyx_string_tab[877]
#define __pyx_n_u_clear_error_log __pyx_string_tab[878]
#define __pyx_n_u_clear_error_log_2 __pyx_string_tab[879]
#define __pyx_n_u_cline_in_traceback __pyx_string_tab[880]
#define __pyx_n_u_close __pyx_string_tab[881]
#define __pyx_n_u_close_2 __pyx_string_tab[882]
#define __pyx_n_u_close_file __pyx_string_tab[883]
#define __pyx_n_u_cls __pyx_string_tab[884]
#define __pyx_n_u_code __pyx_string_tab[885]
#define __pyx_n_u_codecs __pyx_string_tab[886]
#define __pyx_n_u_collect_ids __pyx_string_tab[887]
#define __pyx_n_u_collections __pyx_string_tab[888]
#define __pyx_n_u_collections_abc __pyx_string_tab[889]
#define __pyx_n_u_column_2 __pyx_string_tab[890]
#define __pyx_n_u_comment __pyx_string_tab[891]
#define __pyx_n_u_comment_factory __pyx_string_tab[892]
#define __pyx_n_u_compact __pyx_string_tab[893]
#define __pyx_n_u_compile __pyx_string_tab[894]
#define __pyx_n_u_compression __pyx_string_tab[895]
#define __pyx_n_u_compresslevel __pyx_string_tab[896]
#define __pyx_n_u_contains __pyx_string_tab[897]
#define __pyx_n_u_content __pyx_string_tab[898]
#define __pyx_n_u_context __pyx_string_tab[899]
#define __pyx_n_u_contextlib __pyx_string_tab[900]
#define __pyx_n_u_contextmanager __pyx_string_tab[901]
#define __pyx_n_u_copy __pyx_string_tab[902]
#define __pyx_n_u_copy_2 __pyx_string_tab[903]
#define __pyx_n_u_count __pyx_string_tab[904]
#define __pyx_n_u_create_dir __pyx_string_tab[905]
#define __pyx_n_u_cssselect __pyx_string_tab[906]
#define __pyx_n_u_ctxt __pyx_string_tab[907]
#define __pyx_n_u_d __pyx_string_tab[908]
#define __pyx_n_u_data __pyx_string_tab[909]
#define __pyx_n_u_deco __pyx_string_tab[910]
#define __pyx_n_u_decode __pyx_string_tab[911]
#define __pyx_n_u_decompress __pyx_string_tab[912]
#define __pyx_n_u_deepcopy __pyx_string_tab[913]
#define __pyx_n_u_default __pyx_string_tab[914]
#define __pyx_n_u_default_doctype __pyx_string_tab[915]
#define __pyx_n_u_default_resolver __pyx_string_tab[916]
#define __pyx_n_u_default_value_2 __pyx_string_tab[917]
#define __pyx_n_u_delitem __pyx_string_tab[918]
#define __pyx_n_u_dev __pyx_string_tab[919]
#define __pyx_n_u_dic __pyx_string_tab[920]
#define __pyx_n_u_dict __pyx_string_tab[921]
#define __pyx_n_u_dict_size __pyx_string_tab[922]
#define __pyx_n_u_discard __pyx_string_tab[923]
#define __pyx_n_u_doc __pyx_string_tab[924]
#define __pyx_n_u_doc_2 __pyx_string_tab[925]
#define __pyx_n_u_doc_3 __pyx_string_tab[926]
#define __pyx_n_u_doc_ref __pyx_string_tab[927]
#define __pyx_n_u_docformat __pyx_string_tab[928]
#define __pyx_n_u_docstring __pyx_string_tab[929]
#define __pyx_n_u_doctype __pyx_string_tab[930]
#define __pyx_n_u_domain __pyx_string_tab[931]
#define __pyx_n_u_domain_name __pyx_string_tab[932]
#define __pyx_n_u_domains __pyx_string_tab[933]
#define __pyx_n_u_dtd_validation __pyx_string_tab[934]
#define __pyx_n_u_dtype_is_object __pyx_string_tab[935]
#define __pyx_n_u_dump __pyx_string_tab[936]
#define __pyx_n_u_dumps __pyx_string_tab[937]
#define __pyx_n_u_el __pyx_string_tab[938]
#define __pyx_n_u_elem __pyx_string_tab[939]
#define __pyx_n_u_element __pyx_string_tab[940]
#define __pyx_n_u_element_config __pyx_string_tab[941]
#define __pyx_n_u_element_factory __pyx_string_tab[942]
#define __pyx_n_u_element_or_tree __pyx_string_tab[943]
#define __pyx_n_u_element_writer __pyx_string_tab[944]
#define __pyx_n_u_elementpath __pyx_string_tab[945]
#define __pyx_n_u_elements __pyx_string_tab[946]
#define __pyx_n_u_elements_only __pyx_string_tab[947]
#define __pyx_n_u_elemname_2 __pyx_string_tab[948]
#define __pyx_n_u_empty __pyx_string_tab[949]
#define __pyx_n_u_enable_regexp __pyx_string_tab[950]
#define __pyx_n_u_encode __pyx_string_tab[951]
#define __pyx_n_u_encoding __pyx_string_tab[952]
#define __pyx_n_u_end __pyx_string_tab[953]
#define __pyx_n_u_end_ns_2 __pyx_string_tab[954]
#define __pyx_n_u_endswith __pyx_string_tab[955]
#define __pyx_n_u_enter __pyx_string_tab[956]
#define __pyx_n_u_entities __pyx_string_tab[957]
#define __pyx_n_u_entity __pyx_string_tab[958]
#define __pyx_n_u_entries __pyx_string_tab[959]
#define __pyx_n_u_entry __pyx_string_tab[960]
#define __pyx_n_u_enumerate __pyx_string_tab[961]
#define __pyx_n_u_enumeration __pyx_string_tab[962]
#define __pyx_n_u_error __pyx_string_tab[963]
#define __pyx_n_u_error_log __pyx_string_tab[964]
#define __pyx_n_u_etree __pyx_string_tab[965]
#define __pyx_n_u_etree_or_element __pyx_string_tab[966]
#define __pyx_n_u_etree_or_element_2 __pyx_string_tab[967]
#define __pyx_n_u_evaluator __pyx_string_tab[968]
#define __pyx_n_u_events __pyx_string_tab[969]
#define __pyx_n_u_exc_context __pyx_string_tab[970]
#define __pyx_n_u_exc_info __pyx_string_tab[971]
#define __pyx_n_u_exc_tb __pyx_string_tab[972]
#define __pyx_n_u_exc_type __pyx_string_tab[973]
#define __pyx_n_u_exc_val __pyx_string_tab[974]
#define __pyx_n_u_exclude_attrs __pyx_string_tab[975]
#define __pyx_n_u_exclude_tags __pyx_string_tab[976]
#define __pyx_n_u_exclusive __pyx_string_tab[977]
#define __pyx_n_u_execute __pyx_string_tab[978]
#define __pyx_n_u_exit __pyx_string_tab[979]
#define __pyx_n_u_expr __pyx_string_tab[980]
#define __pyx_n_u_extend __pyx_string_tab[981]
#define __pyx_n_u_extensions __pyx_string_tab[982]
#define __pyx_n_u_external_id __pyx_string_tab[983]
#define __pyx_n_u_extra __pyx_string_tab[984]
#define __pyx_n_u_f __pyx_string_tab[985]
#define __pyx_n_u_fallback __pyx_string_tab[986]
#define __pyx_n_u_feed __pyx_string_tab[987]
#define __pyx_n_u_feed_error_log __pyx_string_tab[988]
#define __pyx_n_u_file __pyx_string_tab[989]
#define __pyx_n_u_filelike __pyx_string_tab[990]
#define __pyx_n_u_filename __pyx_string_tab[991]
#define __pyx_n_u_fileobj __pyx_string_tab[992]
#define __pyx_n_u_filter_domains __pyx_string_tab[993]
#define __pyx_n_u_filter_from_errors __pyx_string_tab[994]
#define __pyx_n_u_filter_from_fatals __pyx_string_tab[995]
#define __pyx_n_u_filter_from_level __pyx_string_tab[996]
#define __pyx_n_u_filter_from_warnings __pyx_string_tab[997]
#define __pyx_n_u_filter_levels __pyx_string_tab[998]
#define __pyx_n_u_filter_types __pyx_string_tab[999]
#define __pyx_n_u_filtered __pyx_string_tab[1000]
#define __pyx_n_u_find __pyx_string_tab[1001]
#define __pyx_n_u_findall __pyx_string_tab[1002]
#define __pyx_n_u_findtext __pyx_string_tab[1003]
#define __pyx_n_u_first_error __pyx_string_tab[1004]
#define __pyx_n_u_fixed __pyx_string_tab[1005]
#define __pyx_n_u_flags __pyx_string_tab[1006]
#define __pyx_n_u_flush __pyx_string_tab[1007]
#define __pyx_n_u_for_html __pyx_string_tab[1008]
#define __pyx_n_u_format __pyx_string_tab[1009]
#define __pyx_n_u_fortran __pyx_string_tab[1010]
#define __pyx_n_u_from_file __pyx_string_tab[1011]
#define __pyx_n_u_from_rnc_string __pyx_string_tab[1012]
#define __pyx_n_u_fromstring __pyx_string_tab[1013]
#define __pyx_n_u_fromstringlist __pyx_string_tab[1014]
#define __pyx_n_u_ftp __pyx_string_tab[1015]
#define __pyx_n_u_func __pyx_string_tab[1016]
#define __pyx_n_u_function_mapping __pyx_string_tab[1017]
#define __pyx_n_u_function_name __pyx_string_tab[1018]
#define __pyx_n_u_functions __pyx_string_tab[1019]
#define __pyx_n_u_functools __pyx_string_tab[1020]
#define __pyx_n_u_g __pyx_string_tab[1021]
#define __pyx_n_u_get __pyx_string_tab[1022]
#define __pyx_n_u_getLogger __pyx_string_tab[1023]
#define __pyx_n_u_getName __pyx_string_tab[1024]
#define __pyx_n_u_get_default_parser __pyx_string_tab[1025]
#define __pyx_n_u_get_namespace __pyx_string_tab[1026]
#define __pyx_n_u_getargspec __pyx_string_tab[1027]
#define __pyx_n_u_getattribute __pyx_string_tab[1028]
#define __pyx_n_u_getchildren __pyx_string_tab[1029]
#define __pyx_n_u_getdefaultencoding __pyx_string_tab[1030]
#define __pyx_n_u_getelementpath __pyx_string_tab[1031]
#define __pyx_n_u_getfilesystemencoding __pyx_string_tab[1032]
#define __pyx_n_u_getfullargspec __pyx_string_tab[1033]
#define __pyx_n_u_getitem __pyx_string_tab[1034]
#define __pyx_n_u_getiterator __pyx_string_tab[1035]
#define __pyx_n_u_getnext __pyx_string_tab[1036]
#define __pyx_n_u_getparent __pyx_string_tab[1037]
#define __pyx_n_u_getpath __pyx_string_tab[1038]
#define __pyx_n_u_getprevious __pyx_string_tab[1039]
#define __pyx_n_u_getroot __pyx_string_tab[1040]
#define __pyx_n_u_getroottree __pyx_string_tab[1041]
#define __pyx_n_u_getstate __pyx_string_tab[1042]
#define __pyx_n_u_geturl __pyx_string_tab[1043]
#define __pyx_n_u_getvalue __pyx_string_tab[1044]
#define __pyx_n_u_getwriter __pyx_string_tab[1045]
#define __pyx_n_u_group __pyx_string_tab[1046]
#define __pyx_n_u_groups __pyx_string_tab[1047]
#define __pyx_n_u_gzip __pyx_string_tab[1048]
#define __pyx_n_u_has_key __pyx_string_tab[1049]
#define __pyx_n_u_href __pyx_string_tab[1050]
#define __pyx_n_u_href_utf __pyx_string_tab[1051]
#define __pyx_n_u_hrefs __pyx_string_tab[1052]
#define __pyx_n_u_html __pyx_string_tab[1053]
#define __pyx_n_u_htmlfile __pyx_string_tab[1054]
#define __pyx_n_u_http __pyx_string_tab[1055]
#define __pyx_n_u_huge_tree __pyx_string_tab[1056]
#define __pyx_n_u_i __pyx_string_tab[1057]
#define __pyx_n_u_iconv __pyx_string_tab[1058]
#define __pyx_n_u_icu __pyx_string_tab[1059]
#define __pyx_n_u_id __pyx_string_tab[1060]
#define __pyx_n_u_id_name __pyx_string_tab[1061]
#define __pyx_n_u_idref __pyx_string_tab[1062]
#define __pyx_n_u_idrefs __pyx_string_tab[1063]
#define __pyx_n_u_implied __pyx_string_tab[1064]
#define __pyx_n_u_import __pyx_string_tab[1065]
#define __pyx_n_u_inclusive __pyx_string_tab[1066]
#define __pyx_n_u_inclusive_ns_prefixes __pyx_string_tab[1067]
#define __pyx_n_u_indent __pyx_string_tab[1068]
#define __pyx_n_u_index __pyx_string_tab[1069]
#define __pyx_n_u_init __pyx_string_tab[1070]
#define __pyx_n_u_init_2 __pyx_string_tab[1071]
#define __pyx_n_u_input __pyx_string_tab[1072]
#define __pyx_n_u_input_node __pyx_string_tab[1073]
#define __pyx_n_u_insert __pyx_string_tab[1074]
#define __pyx_n_u_insert_comments __pyx_string_tab[1075]
#define __pyx_n_u_insert_pis __pyx_string_tab[1076]
#define __pyx_n_u_inspect __pyx_string_tab[1077]
#define __pyx_n_u_int __pyx_string_tab[1078]
#define __pyx_n_u_int1 __pyx_string_tab[1079]
#define __pyx_n_u_int2 __pyx_string_tab[1080]
#define __pyx_n_u_internal __pyx_string_tab[1081]
#define __pyx_n_u_intersection __pyx_string_tab[1082]
#define __pyx_n_u_io __pyx_string_tab[1083]
#define __pyx_n_u_is_coroutine __pyx_string_tab[1084]
#define __pyx_n_u_is_owned __pyx_string_tab[1085]
#define __pyx_n_u_is_standalone __pyx_string_tab[1086]
#define __pyx_n_u_iselement __pyx_string_tab[1087]
#define __pyx_n_u_islice __pyx_string_tab[1088]
#define __pyx_n_u_isspace __pyx_string_tab[1089]
#define __pyx_n_u_item __pyx_string_tab[1090]
#define __pyx_n_u_items __pyx_string_tab[1091]
#define __pyx_n_u_itemsize __pyx_string_tab[1092]
#define __pyx_n_u_iter __pyx_string_tab[1093]
#define __pyx_n_u_iter_2 __pyx_string_tab[1094]
#define __pyx_n_u_iter_namespaces __pyx_string_tab[1095]
#define __pyx_n_u_iterancestors __pyx_string_tab[1096]
#define __pyx_n_u_iterattributes __pyx_string_tab[1097]
#define __pyx_n_u_iterchildren __pyx_string_tab[1098]
#define __pyx_n_u_iterdescendants __pyx_string_tab[1099]
#define __pyx_n_u_iterelements __pyx_string_tab[1100]
#define __pyx_n_u_iterentities __pyx_string_tab[1101]
#define __pyx_n_u_iterfind __pyx_string_tab[1102]
#define __pyx_n_u_iteritems __pyx_string_tab[1103]
#define __pyx_n_u_iterkeys __pyx_string_tab[1104]
#define __pyx_n_u_iterparse __pyx_string_tab[1105]
#define __pyx_n_u_iterparse_makeelement __pyx_string_tab[1106]
#define __pyx_n_u_iterparse_set_element_class_look __pyx_string_tab[1107]
#define __pyx_n_u_itersiblings __pyx_string_tab[1108]
#define __pyx_n_u_itertext __pyx_string_tab[1109]
#define __pyx_n_u_itertools __pyx_string_tab[1110]
#define __pyx_n_u_itervalues __pyx_string_tab[1111]
#define __pyx_n_u_iterwalk __pyx_string_tab[1112]
#define __pyx_n_u_iterwalk_skip_subtree __pyx_string_tab[1113]
#define __pyx_n_u_join __pyx_string_tab[1114]
#define __pyx_n_u_k __pyx_string_tab[1115]
#define __pyx_n_u_keep_ns_prefixes __pyx_string_tab[1116]
#define __pyx_n_u_keep_tail __pyx_string_tab[1117]
#define __pyx_n_u_key __pyx_string_tab[1118]
#define __pyx_n_u_keys __pyx_string_tab[1119]
#define __pyx_n_u_kw __pyx_string_tab[1120]
#define __pyx_n_u_kwargs __pyx_string_tab[1121]
#define __pyx_n_u_l __pyx_string_tab[1122]
#define __pyx_n_u_lambda __pyx_string_tab[1123]
#define __pyx_n_u_last_error __pyx_string_tab[1124]
#define __pyx_n_u_len __pyx_string_tab[1125]
#define __pyx_n_u_level __pyx_string_tab[1126]
#define __pyx_n_u_level_name __pyx_string_tab[1127]
#define __pyx_n_u_levels __pyx_string_tab[1128]
#define __pyx_n_u_line_2 __pyx_string_tab[1129]
#define __pyx_n_u_lineno __pyx_string_tab[1130]
#define __pyx_n_u_load __pyx_string_tab[1131]
#define __pyx_n_u_load_dtd __pyx_string_tab[1132]
#define __pyx_n_u_loads __pyx_string_tab[1133]
#define __pyx_n_u_log __pyx_string_tab[1134]
#define __pyx_n_u_log_entry __pyx_string_tab[1135]
#define __pyx_n_u_logger __pyx_string_tab[1136]
#define __pyx_n_u_logger_name __pyx_string_tab[1137]
#define __pyx_n_u_logging __pyx_string_tab[1138]
#define __pyx_n_u_lookup __pyx_string_tab[1139]
#define __pyx_n_u_lower __pyx_string_tab[1140]
#define __pyx_n_u_lxml __pyx_string_tab[1141]
#define __pyx_n_u_lxml_cssselect __pyx_string_tab[1142]
#define __pyx_n_u_lxml_etree __pyx_string_tab[1143]
#define __pyx_n_u_lzma __pyx_string_tab[1144]
#define __pyx_n_u_main __pyx_string_tab[1145]
#define __pyx_n_u_makeelement __pyx_string_tab[1146]
#define __pyx_n_u_match __pyx_string_tab[1147]
#define __pyx_n_u_matcher __pyx_string_tab[1148]
#define __pyx_n_u_matches __pyx_string_tab[1149]
#define __pyx_n_u_max_depth __pyx_string_tab[1150]
#define __pyx_n_u_max_len __pyx_string_tab[1151]
#define __pyx_n_u_memo __pyx_string_tab[1152]
#define __pyx_n_u_memory_debugger __pyx_string_tab[1153]
#define __pyx_n_u_memview __pyx_string_tab[1154]
#define __pyx_n_u_message __pyx_string_tab[1155]
#define __pyx_n_u_metaclass __pyx_string_tab[1156]
#define __pyx_n_u_method __pyx_string_tab[1157]
#define __pyx_n_u_mixed __pyx_string_tab[1158]
#define __pyx_n_u_mode __pyx_string_tab[1159]
#define __pyx_n_u_module __pyx_string_tab[1160]
#define __pyx_n_u_module_2 __pyx_string_tab[1161]
#define __pyx_n_u_mro_entries __pyx_string_tab[1162]
#define __pyx_n_u_mult __pyx_string_tab[1163]
#define __pyx_n_u_n __pyx_string_tab[1164]
#define __pyx_n_u_name __pyx_string_tab[1165]
#define __pyx_n_u_name_2 __pyx_string_tab[1166]
#define __pyx_n_u_name_utf __pyx_string_tab[1167]
#define __pyx_n_u_names __pyx_string_tab[1168]
#define __pyx_n_u_namespace __pyx_string_tab[1169]
#define __pyx_n_u_namespaces __pyx_string_tab[1170]
#define __pyx_n_u_ndim __pyx_string_tab[1171]
#define __pyx_n_u_new __pyx_string_tab[1172]
#define __pyx_n_u_new_2 __pyx_string_tab[1173]
#define __pyx_n_u_new_doc __pyx_string_tab[1174]
#define __pyx_n_u_new_element __pyx_string_tab[1175]
#define __pyx_n_u_new_namespaces __pyx_string_tab[1176]
#define __pyx_n_u_new_pos __pyx_string_tab[1177]
#define __pyx_n_u_next __pyx_string_tab[1178]
#define __pyx_n_u_nmtoken __pyx_string_tab[1179]
#define __pyx_n_u_nmtokens __pyx_string_tab[1180]
#define __pyx_n_u_no_network __pyx_string_tab[1181]
#define __pyx_n_u_node __pyx_string_tab[1182]
#define __pyx_n_u_none __pyx_string_tab[1183]
#define __pyx_n_u_notation __pyx_string_tab[1184]
#define __pyx_n_u_ns __pyx_string_tab[1185]
#define __pyx_n_u_ns_clean __pyx_string_tab[1186]
#define __pyx_n_u_ns_stack __pyx_string_tab[1187]
#define __pyx_n_u_ns_uri __pyx_string_tab[1188]
#define __pyx_n_u_ns_utf __pyx_string_tab[1189]
#define __pyx_n_u_nsmap __pyx_string_tab[1190]
#define __pyx_n_u_obj __pyx_string_tab[1191]
#define __pyx_n_u_object __pyx_string_tab[1192]
#define __pyx_n_u_occur_2 __pyx_string_tab[1193]
#define __pyx_n_u_offset __pyx_string_tab[1194]
#define __pyx_n_u_old __pyx_string_tab[1195]
#define __pyx_n_u_old_element __pyx_string_tab[1196]
#define __pyx_n_u_old_writer __pyx_string_tab[1197]
#define __pyx_n_u_once __pyx_string_tab[1198]
#define __pyx_n_u_open __pyx_string_tab[1199]
#define __pyx_n_u_open_utf8_file __pyx_string_tab[1200]
#define __pyx_n_u_opt __pyx_string_tab[1201]
#define __pyx_n_u_options __pyx_string_tab[1202]
#define __pyx_n_u_or __pyx_string_tab[1203]
#define __pyx_n_u_os_path __pyx_string_tab[1204]
#define __pyx_n_u_other_element __pyx_string_tab[1205]
#define __pyx_n_u_out __pyx_string_tab[1206]
#define __pyx_n_u_outfile __pyx_string_tab[1207]
#define __pyx_n_u_output_file __pyx_string_tab[1208]
#define __pyx_n_u_output_parent __pyx_string_tab[1209]
#define __pyx_n_u_pack __pyx_string_tab[1210]
#define __pyx_n_u_parent __pyx_string_tab[1211]
#define __pyx_n_u_parse __pyx_string_tab[1212]
#define __pyx_n_u_parseXSL __pyx_string_tab[1213]
#define __pyx_n_u_parse_options __pyx_string_tab[1214]
#define __pyx_n_u_parseid __pyx_string_tab[1215]
#define __pyx_n_u_parser __pyx_string_tab[1216]
#define __pyx_n_u_partial __pyx_string_tab[1217]
#define __pyx_n_u_path __pyx_string_tab[1218]
#define __pyx_n_u_path_2 __pyx_string_tab[1219]
#define __pyx_n_u_pcdata __pyx_string_tab[1220]
#define __pyx_n_u_pi __pyx_string_tab[1221]
#define __pyx_n_u_pi_factory __pyx_string_tab[1222]
#define __pyx_n_u_plus __pyx_string_tab[1223]
#define __pyx_n_u_pop __pyx_string_tab[1224]
#define __pyx_n_u_position __pyx_string_tab[1225]
#define __pyx_n_u_preceding __pyx_string_tab[1226]
#define __pyx_n_u_prefix __pyx_string_tab[1227]
#define __pyx_n_u_prefix_utf __pyx_string_tab[1228]
#define __pyx_n_u_prepare __pyx_string_tab[1229]
#define __pyx_n_u_preserve __pyx_string_tab[1230]
#define __pyx_n_u_pretty_print __pyx_string_tab[1231]
#define __pyx_n_u_print __pyx_string_tab[1232]
#define __pyx_n_u_process_children __pyx_string_tab[1233]
#define __pyx_n_u_profile_run __pyx_string_tab[1234]
#define __pyx_n_u_property __pyx_string_tab[1235]
#define __pyx_n_u_public_id __pyx_string_tab[1236]
#define __pyx_n_u_pyucs4_encoding_name __pyx_string_tab[1237]
#define __pyx_n_u_pyx_capi __pyx_string_tab[1238]
#define __pyx_n_u_pyx_checksum __pyx_string_tab[1239]
#define __pyx_n_u_pyx_state __pyx_string_tab[1240]
#define __pyx_n_u_pyx_type __pyx_string_tab[1241]
#define __pyx_n_u_pyx_unpickle_Enum __pyx_string_tab[1242]
#define __pyx_n_u_pyx_vtable __pyx_string_tab[1243]
#define __pyx_n_u_qname_aware_attrs __pyx_string_tab[1244]
#define __pyx_n_u_qname_aware_tags __pyx_string_tab[1245]
#define __pyx_n_u_qualname __pyx_string_tab[1246]
#define __pyx_n_u_r __pyx_string_tab[1247]
#define __pyx_n_u_raise_on_error __pyx_string_tab[1248]
#define __pyx_n_u_rb __pyx_string_tab[1249]
#define __pyx_n_u_rclose __pyx_string_tab[1250]
#define __pyx_n_u_re __pyx_string_tab[1251]
#define __pyx_n_u_read __pyx_string_tab[1252]
#define __pyx_n_u_read_events __pyx_string_tab[1253]
#define __pyx_n_u_read_file __pyx_string_tab[1254]
#define __pyx_n_u_read_network __pyx_string_tab[1255]
#define __pyx_n_u_receive __pyx_string_tab[1256]
#define __pyx_n_u_recover __pyx_string_tab[1257]
#define __pyx_n_u_reduce __pyx_string_tab[1258]
#define __pyx_n_u_reduce_cython __pyx_string_tab[1259]
#define __pyx_n_u_reduce_ex __pyx_string_tab[1260]
#define __pyx_n_u_regexp __pyx_string_tab[1261]
#define __pyx_n_u_register __pyx_string_tab[1262]
#define __pyx_n_u_register_namespace __pyx_string_tab[1263]
#define __pyx_n_u_register_namespaces __pyx_string_tab[1264]
#define __pyx_n_u_registry __pyx_string_tab[1265]
#define __pyx_n_u_relaxng __pyx_string_tab[1266]
#define __pyx_n_u_remove __pyx_string_tab[1267]
#define __pyx_n_u_remove_blank_text __pyx_string_tab[1268]
#define __pyx_n_u_remove_comments __pyx_string_tab[1269]
#define __pyx_n_u_remove_pis __pyx_string_tab[1270]
#define __pyx_n_u_replace __pyx_string_tab[1271]
#define __pyx_n_u_replacement __pyx_string_tab[1272]
#define __pyx_n_u_required __pyx_string_tab[1273]
#define __pyx_n_u_resolve __pyx_string_tab[1274]
#define __pyx_n_u_resolve_empty __pyx_string_tab[1275]
#define __pyx_n_u_resolve_entities __pyx_string_tab[1276]
#define __pyx_n_u_resolve_external_entities __pyx_string_tab[1277]
#define __pyx_n_u_resolve_file __pyx_string_tab[1278]
#define __pyx_n_u_resolve_filename __pyx_string_tab[1279]
#define __pyx_n_u_resolve_string __pyx_string_tab[1280]
#define __pyx_n_u_resolver __pyx_string_tab[1281]
#define __pyx_n_u_resolvers __pyx_string_tab[1282]
#define __pyx_n_u_result __pyx_string_tab[1283]
#define __pyx_n_u_result_container __pyx_string_tab[1284]
#define __pyx_n_u_result_doc __pyx_string_tab[1285]
#define __pyx_n_u_result_list __pyx_string_tab[1286]
#define __pyx_n_u_result_node __pyx_string_tab[1287]
#define __pyx_n_u_result_tree __pyx_string_tab[1288]
#define __pyx_n_u_results __pyx_string_tab[1289]
#define __pyx_n_u_reversed __pyx_string_tab[1290]
#define __pyx_n_u_reversed_2 __pyx_string_tab[1291]
#define __pyx_n_u_reversed_nsmap __pyx_string_tab[1292]
#define __pyx_n_u_rewrite_prefixes __pyx_string_tab[1293]
#define __pyx_n_u_rexp __pyx_string_tab[1294]
#define __pyx_n_u_rexpc __pyx_string_tab[1295]
#define __pyx_n_u_rnc2rng __pyx_string_tab[1296]
#define __pyx_n_u_rng_str __pyx_string_tab[1297]
#define __pyx_n_u_root __pyx_string_tab[1298]
#define __pyx_n_u_rsplit __pyx_string_tab[1299]
#define __pyx_n_u_s_4 __pyx_string_tab[1300]
#define __pyx_n_u_s_match __pyx_string_tab[1301]
#define __pyx_n_u_schema __pyx_string_tab[1302]
#define __pyx_n_u_schematron __pyx_string_tab[1303]
#define __pyx_n_u_search __pyx_string_tab[1304]
#define __pyx_n_u_self __pyx_string_tab[1305]
#define __pyx_n_u_self_node __pyx_string_tab[1306]
#define __pyx_n_u_send __pyx_string_tab[1307]
#define __pyx_n_u_seq __pyx_string_tab[1308]
#define __pyx_n_u_sequence_or_dict __pyx_string_tab[1309]
#define __pyx_n_u_set __pyx_string_tab[1310]
#define __pyx_n_u_set_default_parser __pyx_string_tab[1311]
#define __pyx_n_u_set_element_class_lookup __pyx_string_tab[1312]
#define __pyx_n_u_set_fallback __pyx_string_tab[1313]
#define __pyx_n_u_set_global_max_depth __pyx_string_tab[1314]
#define __pyx_n_u_set_name __pyx_string_tab[1315]
#define __pyx_n_u_setdefault __pyx_string_tab[1316]
#define __pyx_n_u_setitem __pyx_string_tab[1317]
#define __pyx_n_u_setroot __pyx_string_tab[1318]
#define __pyx_n_u_setstate __pyx_string_tab[1319]
#define __pyx_n_u_setstate_cython __pyx_string_tab[1320]
#define __pyx_n_u_setter __pyx_string_tab[1321]
#define __pyx_n_u_shape __pyx_string_tab[1322]
#define __pyx_n_u_sio __pyx_string_tab[1323]
#define __pyx_n_u_size __pyx_string_tab[1324]
#define __pyx_n_u_skip_subtree __pyx_string_tab[1325]
#define __pyx_n_u_smart_strings __pyx_string_tab[1326]
#define __pyx_n_u_sorted __pyx_string_tab[1327]
#define __pyx_n_u_source __pyx_string_tab[1328]
#define __pyx_n_u_space __pyx_string_tab[1329]
#define __pyx_n_u_split __pyx_string_tab[1330]
#define __pyx_n_u_splitlines __pyx_string_tab[1331]
#define __pyx_n_u_src __pyx_string_tab[1332]
#define __pyx_n_u_stacklevel __pyx_string_tab[1333]
#define __pyx_n_u_standalone __pyx_string_tab[1334]
#define __pyx_n_u_start __pyx_string_tab[1335]
#define __pyx_n_u_start_ns_2 __pyx_string_tab[1336]
#define __pyx_n_u_startswith __pyx_string_tab[1337]
#define __pyx_n_u_staticmethod __pyx_string_tab[1338]
#define __pyx_n_u_stdout __pyx_string_tab[1339]
#define __pyx_n_u_step __pyx_string_tab[1340]
#define __pyx_n_u_stop __pyx_string_tab[1341]
#define __pyx_n_u_store_exception __pyx_string_tab[1342]
#define __pyx_n_u_str1 __pyx_string_tab[1343]
#define __pyx_n_u_str2 __pyx_string_tab[1344]
#define __pyx_n_u_str3 __pyx_string_tab[1345]
#define __pyx_n_u_string_2 __pyx_string_tab[1346]
#define __pyx_n_u_strings __pyx_string_tab[1347]
#define __pyx_n_u_strip __pyx_string_tab[1348]
#define __pyx_n_u_strip_attributes __pyx_string_tab[1349]
#define __pyx_n_u_strip_cdata __pyx_string_tab[1350]
#define __pyx_n_u_strip_elements __pyx_string_tab[1351]
#define __pyx_n_u_strip_tags __pyx_string_tab[1352]
#define __pyx_n_u_strip_text __pyx_string_tab[1353]
#define __pyx_n_u_strparam __pyx_string_tab[1354]
#define __pyx_n_u_struct __pyx_string_tab[1355]
#define __pyx_n_u_strval __pyx_string_tab[1356]
#define __pyx_n_u_style __pyx_string_tab[1357]
#define __pyx_n_u_sub __pyx_string_tab[1358]
#define __pyx_n_u_super __pyx_string_tab[1359]
#define __pyx_n_u_sys __pyx_string_tab[1360]
#define __pyx_n_u_system_url __pyx_string_tab[1361]
#define __pyx_n_u_tag __pyx_string_tab[1362]
#define __pyx_n_u_tag_2 __pyx_string_tab[1363]
#define __pyx_n_u_tag_names __pyx_string_tab[1364]
#define __pyx_n_u_tags __pyx_string_tab[1365]
#define __pyx_n_u_tail __pyx_string_tab[1366]
#define __pyx_n_u_target __pyx_string_tab[1367]
#define __pyx_n_u_tell __pyx_string_tab[1368]
#define __pyx_n_u_test __pyx_string_tab[1369]
#define __pyx_n_u_test_2 __pyx_string_tab[1370]
#define __pyx_n_u_text __pyx_string_tab[1371]
#define __pyx_n_u_text_or_uri_or_element __pyx_string_tab[1372]
#define __pyx_n_u_throw __pyx_string_tab[1373]
#define __pyx_n_u_top_nsmap __pyx_string_tab[1374]
#define __pyx_n_u_tostring __pyx_string_tab[1375]
#define __pyx_n_u_tostringlist __pyx_string_tab[1376]
#define __pyx_n_u_tounicode __pyx_string_tab[1377]
#define __pyx_n_u_translator __pyx_string_tab[1378]
#define __pyx_n_u_tree __pyx_string_tab[1379]
#define __pyx_n_u_tree_or_element __pyx_string_tab[1380]
#define __pyx_n_u_type __pyx_string_tab[1381]
#define __pyx_n_u_type_name __pyx_string_tab[1382]
#define __pyx_n_u_types __pyx_string_tab[1383]
#define __pyx_n_u_typing __pyx_string_tab[1384]
#define __pyx_n_u_undefined __pyx_string_tab[1385]
#define __pyx_n_u_unicode __pyx_string_tab[1386]
#define __pyx_n_u_unknown __pyx_string_tab[1387]
#define __pyx_n_u_unpack __pyx_string_tab[1388]
#define __pyx_n_u_update __pyx_string_tab[1389]
#define __pyx_n_u_upper __pyx_string_tab[1390]
#define __pyx_n_u_uri __pyx_string_tab[1391]
#define __pyx_n_u_uri_utf __pyx_string_tab[1392]
#define __pyx_n_u_url __pyx_string_tab[1393]
#define __pyx_n_u_use_global_python_log __pyx_string_tab[1394]
#define __pyx_n_u_utf8 __pyx_string_tab[1395]
#define __pyx_n_u_v __pyx_string_tab[1396]
#define __pyx_n_u_validate __pyx_string_tab[1397]
#define __pyx_n_u_value __pyx_string_tab[1398]
#define __pyx_n_u_values __pyx_string_tab[1399]
#define __pyx_n_u_variables __pyx_string_tab[1400]
#define __pyx_n_u_variables_2 __pyx_string_tab[1401]
#define __pyx_n_u_version __pyx_string_tab[1402]
#define __pyx_n_u_version_2 __pyx_string_tab[1403]
#define __pyx_n_u_w __pyx_string_tab[1404]
#define __pyx_n_u_warn __pyx_string_tab[1405]
#define __pyx_n_u_warnings __pyx_string_tab[1406]
#define __pyx_n_u_wb __pyx_string_tab[1407]
#define __pyx_n_u_with_comments __pyx_string_tab[1408]
#define __pyx_n_u_with_prefixes __pyx_string_tab[1409]
#define __pyx_n_u_with_tail __pyx_string_tab[1410]
#define __pyx_n_u_write __pyx_string_tab[1411]
#define __pyx_n_u_write_c14n __pyx_string_tab[1412]
#define __pyx_n_u_write_declaration __pyx_string_tab[1413]
#define __pyx_n_u_write_doctype __pyx_string_tab[1414]
#define __pyx_n_u_write_file __pyx_string_tab[1415]
#define __pyx_n_u_write_network __pyx_string_tab[1416]
#define __pyx_n_u_write_output __pyx_string_tab[1417]
#define __pyx_n_u_writer __pyx_string_tab[1418]
#define __pyx_n_u_x __pyx_string_tab[1419]
#define __pyx_n_u_xinclude __pyx_string_tab[1420]
#define __pyx_n_u_xml __pyx_string_tab[1421]
#define __pyx_n_u_xml_data __pyx_string_tab[1422]
#define __pyx_n_u_xml_declaration __pyx_string_tab[1423]
#define __pyx_n_u_xmlfile __pyx_string_tab[1424]
#define __pyx_n_u_xmlfile___aenter __pyx_string_tab[1425]
#define __pyx_n_u_xmlfile___aexit __pyx_string_tab[1426]
#define __pyx_n_u_xmlfile___enter __pyx_string_tab[1427]
#define __pyx_n_u_xmlfile___exit __pyx_string_tab[1428]
#define __pyx_n_u_xmlns_2 __pyx_string_tab[1429]
#define __pyx_n_u_xmlschema __pyx_string_tab[1430]
#define __pyx_n_u_xpath __pyx_string_tab[1431]
#define __pyx_n_u_xpath_name __pyx_string_tab[1432]
#define __pyx_n_u_xs __pyx_string_tab[1433]
#define __pyx_n_u_xsl __pyx_string_tab[1434]
#define __pyx_n_u_xslt __pyx_string_tab[1435]
#define __pyx_n_u_xslt_3 __pyx_string_tab[1436]
#define __pyx_n_u_xslt_input __pyx_string_tab[1437]
#define __pyx_n_u_zf __pyx_string_tab[1438]
#define __pyx_n_u_zlib __pyx_string_tab[1439]
#define __pyx_kp_b_25 __pyx_string_tab[1440]
#define __pyx_kp_b_Char_out_of_XML_range __pyx_string_tab[1441]
#define __pyx_kp_b_Encoding_error __pyx_string_tab[1442]
#define __pyx_kp_b_Expected_for_variable_reference __pyx_string_tab[1443]
#define __pyx_kp_b_Forbidden_variable __pyx_string_tab[1444]
#define __pyx_kp_b_Invalid_context_position __pyx_string_tab[1445]
#define __pyx_kp_b_Invalid_context_size __pyx_string_tab[1446]
#define __pyx_kp_b_Invalid_expression __pyx_string_tab[1447]
#define __pyx_kp_b_Invalid_number_of_arguments __pyx_string_tab[1448]
#define __pyx_kp_b_Invalid_operand __pyx_string_tab[1449]
#define __pyx_kp_b_Invalid_or_incomplete_context __pyx_string_tab[1450]
#define __pyx_kp_b_Invalid_predicate __pyx_string_tab[1451]
#define __pyx_kp_b_Invalid_type __pyx_string_tab[1452]
#define __pyx_kp_b_Memory_allocation_error __pyx_string_tab[1453]
#define __pyx_kp_b_Missing_closing_curly_brace __pyx_string_tab[1454]
#define __pyx_kp_b_Number_encoding __pyx_string_tab[1455]
#define __pyx_kp_b_PyObject_PyObject_PyObject_PyObj __pyx_string_tab[1456]
#define __pyx_kp_b_Resource_error __pyx_string_tab[1457]
#define __pyx_kp_b_Stack_usage_error __pyx_string_tab[1458]
#define __pyx_kp_b_Start_of_literal __pyx_string_tab[1459]
#define __pyx_kp_b_Sub_resource_error __pyx_string_tab[1460]
#define __pyx_kp_b_Syntax_error __pyx_string_tab[1461]
#define __pyx_kp_b_Undefined_namespace_prefix __pyx_string_tab[1462]
#define __pyx_kp_b_Undefined_variable __pyx_string_tab[1463]
#define __pyx_kp_b_Unfinished_literal __pyx_string_tab[1464]
#define __pyx_kp_b_Unknown_error __pyx_string_tab[1465]
#define __pyx_kp_b_Unregistered_function __pyx_string_tab[1466]
#define __pyx_kp_b__12 __pyx_string_tab[1467]
#define __pyx_kp_b__14 __pyx_string_tab[1468]
#define __pyx_kp_b__18 __pyx_string_tab[1469]
#define __pyx_kp_b__19 __pyx_string_tab[1470]
#define __pyx_kp_b__2 __pyx_string_tab[1471]
#define __pyx_kp_b__20 __pyx_string_tab[1472]
#define __pyx_kp_b__24 __pyx_string_tab[1473]
#define __pyx_kp_b__26 __pyx_string_tab[1474]
#define __pyx_kp_b__36 __pyx_string_tab[1475]
#define __pyx_kp_b__4 __pyx_string_tab[1476]
#define __pyx_kp_b__45 __pyx_string_tab[1477]
#define __pyx_kp_b__46 __pyx_string_tab[1478]
#define __pyx_kp_b__6 __pyx_string_tab[1479]
#define __pyx_kp_b__8 __pyx_string_tab[1480]
#define __pyx_kp_b__9 __pyx_string_tab[1481]
#define __pyx_kp_b_file_2 __pyx_string_tab[1482]
#define __pyx_kp_b_http_codespeak_net_lxml_objectif __pyx_string_tab[1483]
#define __pyx_kp_b_http_exslt_org_regular_expressio __pyx_string_tab[1484]
#define __pyx_kp_b_http_purl_org_dc_elements_1_1 __pyx_string_tab[1485]
#define __pyx_kp_b_http_schemas_xmlsoap_org_wsdl __pyx_string_tab[1486]
#define __pyx_kp_b_http_www_w3_org_1999_02_22_rdf_s __pyx_string_tab[1487]
#define __pyx_kp_b_http_www_w3_org_1999_XSL_Transfo __pyx_string_tab[1488]
#define __pyx_kp_b_http_www_w3_org_1999_xhtml __pyx_string_tab[1489]
#define __pyx_kp_b_http_www_w3_org_2001_XMLSchema __pyx_string_tab[1490]
#define __pyx_kp_b_http_www_w3_org_2001_XMLSchema_i __pyx_string_tab[1491]
#define __pyx_kp_b_http_www_w3_org_XML_1998_namespa __pyx_string_tab[1492]
#define __pyx_kp_b_iso88591_0_4_1_aq_t1_ha_9_Qa_wk_z_1_7_e1 __pyx_string_tab[1493]
#define __pyx_kp_b_iso88591_0_a_4_gQ_nA_4s_a_t3a_m1A_Cq_1L __pyx_string_tab[1494]
#define __pyx_kp_b_iso88591_0_z_A_O_9_q_Rt_Cq_r_d_Qa_D_Kq_Q __pyx_string_tab[1495]
#define __pyx_kp_b_iso88591_11K1_8_O1_Q_s_s_b_q_d_2_Q_Q __pyx_string_tab[1496]
#define __pyx_kp_b_iso88591_1A_vRq_j_Gq_y_Q_Qa_r_r_Zs_1 __pyx_string_tab[1497]
#define __pyx_kp_b_iso88591_1HA_xq __pyx_string_tab[1498]
#define __pyx_kp_b_iso88591_1_1F_fF_G1 __pyx_string_tab[1499]
#define __pyx_kp_b_iso88591_1_3avXYa_t5_uCq_vQ_vWAQ __pyx_string_tab[1500]
#define __pyx_kp_b_iso88591_1_4_1_4we4t3a_r_D_is_E_A_1_xt1 __pyx_string_tab[1501]
#define __pyx_kp_b_iso88591_1_5Q_8_y __pyx_string_tab[1502]
#define __pyx_kp_b_iso88591_1_6_1_s_q __pyx_string_tab[1503]
#define __pyx_kp_b_iso88591_1_HL_vXQ __pyx_string_tab[1504]
#define __pyx_kp_b_iso88591_1_Q_1F_4q_q_a_q_1_q_7_d_AQ_gWA __pyx_string_tab[1505]
#define __pyx_kp_b_iso88591_1_q_A_1F_G6_q_G1 __pyx_string_tab[1506]
#define __pyx_kp_b_iso88591_1_wc_9_4z_Q_6_1_s_q __pyx_string_tab[1507]
#define __pyx_kp_b_iso88591_1_z_1_y_4IYa_S_l_1_Q_y_8_83c_Q __pyx_string_tab[1508]
#define __pyx_kp_b_iso88591_2_1_aq_t1_ha_9_Qa_wk_z_1_7_e1_1 __pyx_string_tab[1509]
#define __pyx_kp_b_iso88591_2_4wa_Q_6_z __pyx_string_tab[1510]
#define __pyx_kp_b_iso88591_31 __pyx_string_tab[1511]
#define __pyx_kp_b_iso88591_33DA_Q_Q_y_9G1_q_31A_a_y_q __pyx_string_tab[1512]
#define __pyx_kp_b_iso88591_3a_e1A_3avXYa_1A_1D_AYa_6 __pyx_string_tab[1513]
#define __pyx_kp_b_iso88591_4A_Qm5_IT_F_1_HA_L __pyx_string_tab[1514]
#define __pyx_kp_b_iso88591_4y_D_HA_1_4wa_Q_q __pyx_string_tab[1515]
#define __pyx_kp_b_iso88591_4y_D_HA_1_4wa_Q_vZq __pyx_string_tab[1516]
#define __pyx_kp_b_iso88591_5Q_4y_D_HA_1_4wa_Q_1F __pyx_string_tab[1517]
#define __pyx_kp_b_iso88591_6_q __pyx_string_tab[1518]
#define __pyx_kp_b_iso88591_6a_1_t9D_D_q_d_ha_1_4wa_Q_q_fJa __pyx_string_tab[1519]
#define __pyx_kp_b_iso88591_6a_O1_t81_9AQ_t2S_1_t2Q_Q_A_q_a __pyx_string_tab[1520]
#define __pyx_kp_b_iso88591_6a_QfA_G5_9AV6_nTXXgghhi __pyx_string_tab[1521]
#define __pyx_kp_b_iso88591_87_7_nAV81_q_Ja_7_5 __pyx_string_tab[1522]
#define __pyx_kp_b_iso88591_8_aq_q_q_gQ_e6_5_q_1AU_84z_a __pyx_string_tab[1523]
#define __pyx_kp_b_iso88591_9_q_t87_4y_1_4y_1_Qa_F_xwj_Qa_c __pyx_string_tab[1524]
#define __pyx_kp_b_iso88591_9_z_A_Q_k_7_A_k_7 __pyx_string_tab[1525]
#define __pyx_kp_b_iso88591_A4_D_0_1_QfA_t_c_Q_T_Qa_31A_Q_q __pyx_string_tab[1526]
#define __pyx_kp_b_iso88591_A_1D_7_Q_q_AWJd_AQ_wha_axwa_4wn __pyx_string_tab[1527]
#define __pyx_kp_b_iso88591_A_1F_1 __pyx_string_tab[1528]
#define __pyx_kp_b_iso88591_A_1F_iuCuG3a_AZvQ __pyx_string_tab[1529]
#define __pyx_kp_b_iso88591_A_1_4xs_m1_HD_1F_AQ_q __pyx_string_tab[1530]
#define __pyx_kp_b_iso88591_A_1_6_Kq __pyx_string_tab[1531]
#define __pyx_kp_b_iso88591_A_1_U_1_Q_4_Qa_t_1_aq_1 __pyx_string_tab[1532]
#define __pyx_kp_b_iso88591_A_2 __pyx_string_tab[1533]
#define __pyx_kp_b_iso88591_A_3 __pyx_string_tab[1534]
#define __pyx_kp_b_iso88591_A_3ay_EQc_RSST_Q_1D_5_7_Q_t1_j_W __pyx_string_tab[1535]
#define __pyx_kp_b_iso88591_A_4_Cq_q __pyx_string_tab[1536]
#define __pyx_kp_b_iso88591_A_4_S_T_g_IWAQ __pyx_string_tab[1537]
#define __pyx_kp_b_iso88591_A_4_S_T_g_IWAQ_3at_b_A_A_t9Bd_Cq __pyx_string_tab[1538]
#define __pyx_kp_b_iso88591_A_4_gQ_4_Ya_5_q_AQ_1D_j_A_avQ_wa __pyx_string_tab[1539]
#define __pyx_kp_b_iso88591_A_4_gQ_4q_a_wa_a_3ha_a_q_7_q_a_A __pyx_string_tab[1540]
#define __pyx_kp_b_iso88591_A_4_gU_Ct3d_1_4q_q_waq_4_d_c_Q_5 __pyx_string_tab[1541]
#define __pyx_kp_b_iso88591_A_4q_1_4q_q_G1D_WAT_D_N_Qd_4Cq_t __pyx_string_tab[1542]
#define __pyx_kp_b_iso88591_A_4q_4q_q_Jb_5 __pyx_string_tab[1543]
#define __pyx_kp_b_iso88591_A_4q_4q_q_T_Q_q_G1_A_D_4t1_q __pyx_string_tab[1544]
#define __pyx_kp_b_iso88591_A_4q_4wc_t1 __pyx_string_tab[1545]
#define __pyx_kp_b_iso88591_A_4q_4xy_4q_HKt1_Kq __pyx_string_tab[1546]
#define __pyx_kp_b_iso88591_A_4q_HKt1_L __pyx_string_tab[1547]
#define __pyx_kp_b_iso88591_A_4s_6_A_Q_F_T_A_a_Yaq_t2T_Rq __pyx_string_tab[1548]
#define __pyx_kp_b_iso88591_A_4t1A_k1H __pyx_string_tab[1549]
#define __pyx_kp_b_iso88591_A_4t1A_k1H_a __pyx_string_tab[1550]
#define __pyx_kp_b_iso88591_A_4t1_4q_4q_q_T_Q_q_G1F_Qa_4t1_q __pyx_string_tab[1551]
#define __pyx_kp_b_iso88591_A_4t1_B_Q_Q_A_q_A_4q_QgV3a_1G6_A __pyx_string_tab[1552]
#define __pyx_kp_b_iso88591_A_4t1_gQa __pyx_string_tab[1553]
#define __pyx_kp_b_iso88591_A_4wc_t6 __pyx_string_tab[1554]
#define __pyx_kp_b_iso88591_A_4wd __pyx_string_tab[1555]
#define __pyx_kp_b_iso88591_A_4xs_m1_t1D __pyx_string_tab[1556]
#define __pyx_kp_b_iso88591_A_4xs_m1_t7 __pyx_string_tab[1557]
#define __pyx_kp_b_iso88591_A_4xvWA_Q_Q_HA __pyx_string_tab[1558]
#define __pyx_kp_b_iso88591_A_4xwa_Jd_1_Yc_gQa_t1_O1 __pyx_string_tab[1559]
#define __pyx_kp_b_iso88591_A_4xxs_t4z_ha_whfG1_7_q_Q_81_q_a __pyx_string_tab[1560]
#define __pyx_kp_b_iso88591_A_4xxs_t4z_ha_whfL0B_k_81_avQ __pyx_string_tab[1561]
#define __pyx_kp_b_iso88591_A_4y_1_1_AT_t1_7_wha_5_q_1_a_gWE __pyx_string_tab[1562]
#define __pyx_kp_b_iso88591_A_5_4q_QfA __pyx_string_tab[1563]
#define __pyx_kp_b_iso88591_A_6_A_a_1_4wfF __pyx_string_tab[1564]
#define __pyx_kp_b_iso88591_A_6_a __pyx_string_tab[1565]
#define __pyx_kp_b_iso88591_A_6_nJk_RS_t1_q_wfAQ __pyx_string_tab[1566]
#define __pyx_kp_b_iso88591_A_7_5V1_F_S_S_Bc_E_XQa_AXQ __pyx_string_tab[1567]
#define __pyx_kp_b_iso88591_A_7_q_a_4_gQ_4q_wa_4uHA_a_7_t1_a __pyx_string_tab[1568]
#define __pyx_kp_b_iso88591_A_9F_hgQ __pyx_string_tab[1569]
#define __pyx_kp_b_iso88591_A_A __pyx_string_tab[1570]
#define __pyx_kp_b_iso88591_A_AT_A __pyx_string_tab[1571]
#define __pyx_kp_b_iso88591_A_AT_it1_7_e1_wha_5_q_1_a_gWE_V6 __pyx_string_tab[1572]
#define __pyx_kp_b_iso88591_A_AT_q __pyx_string_tab[1573]
#define __pyx_kp_b_iso88591_A_AU __pyx_string_tab[1574]
#define __pyx_kp_b_iso88591_A_AV1 __pyx_string_tab[1575]
#define __pyx_kp_b_iso88591_A_AXQ_q __pyx_string_tab[1576]
#define __pyx_kp_b_iso88591_A_A_N_Kq_D __pyx_string_tab[1577]
#define __pyx_kp_b_iso88591_A_A_a_t1 __pyx_string_tab[1578]
#define __pyx_kp_b_iso88591_A_D_D __pyx_string_tab[1579]
#define __pyx_kp_b_iso88591_A_D_c __pyx_string_tab[1580]
#define __pyx_kp_b_iso88591_A_E_1IXQ_a __pyx_string_tab[1581]
#define __pyx_kp_b_iso88591_A_F __pyx_string_tab[1582]
#define __pyx_kp_b_iso88591_A_HKt1_H_a __pyx_string_tab[1583]
#define __pyx_kp_b_iso88591_A_H_q_A_HKt1 __pyx_string_tab[1584]
#define __pyx_kp_b_iso88591_A_IV1 __pyx_string_tab[1585]
#define __pyx_kp_b_iso88591_A_IYa_JgRq __pyx_string_tab[1586]
#define __pyx_kp_b_iso88591_A_Ja __pyx_string_tab[1587]
#define __pyx_kp_b_iso88591_A_K_q_gV1 __pyx_string_tab[1588]
#define __pyx_kp_b_iso88591_A_Kq __pyx_string_tab[1589]
#define __pyx_kp_b_iso88591_A_Kq_xs_k_AQ_q __pyx_string_tab[1590]
#define __pyx_kp_b_iso88591_A_Kt1A __pyx_string_tab[1591]
#define __pyx_kp_b_iso88591_A_KvQ __pyx_string_tab[1592]
#define __pyx_kp_b_iso88591_A_Kxq __pyx_string_tab[1593]
#define __pyx_kp_b_iso88591_A_L_1_6_wa_t_WA_l_6_7q_LAVST_q_d __pyx_string_tab[1594]
#define __pyx_kp_b_iso88591_A_L_1_q_HA_q_Zq __pyx_string_tab[1595]
#define __pyx_kp_b_iso88591_A_L_4xq_9CuCx_1_1_AT_9 __pyx_string_tab[1596]
#define __pyx_kp_b_iso88591_A_L_A_XXQl_Q_wgQ_q_4_Q_1_t_XQl_Q __pyx_string_tab[1597]
#define __pyx_kp_b_iso88591_A_L_Kq_q __pyx_string_tab[1598]
#define __pyx_kp_b_iso88591_A_L_Qd_7_AT_9_q __pyx_string_tab[1599]
#define __pyx_kp_b_iso88591_A_L_XQ_gWA_aq_gQ_q_4DA_V1_q __pyx_string_tab[1600]
#define __pyx_kp_b_iso88591_A_L_a_7_AT_9_q __pyx_string_tab[1601]
#define __pyx_kp_b_iso88591_A_L_j __pyx_string_tab[1602]
#define __pyx_kp_b_iso88591_A_M __pyx_string_tab[1603]
#define __pyx_kp_b_iso88591_A_O1A __pyx_string_tab[1604]
#define __pyx_kp_b_iso88591_A_O1_1_vYaq __pyx_string_tab[1605]
#define __pyx_kp_b_iso88591_A_O1_4q __pyx_string_tab[1606]
#define __pyx_kp_b_iso88591_A_O1_t81_9AQ_t2S_1_t2Q_Q_A_q_a __pyx_string_tab[1607]
#define __pyx_kp_b_iso88591_A_O1_vYaq __pyx_string_tab[1608]
#define __pyx_kp_b_iso88591_A_Q_Q_q_vQ_E_at_e1 __pyx_string_tab[1609]
#define __pyx_kp_b_iso88591_A_Q_a_1_HA_HHD_wj_t1 __pyx_string_tab[1610]
#define __pyx_kp_b_iso88591_A_Q_ixq_1_q __pyx_string_tab[1611]
#define __pyx_kp_b_iso88591_A_Q_iz __pyx_string_tab[1612]
#define __pyx_kp_b_iso88591_A_Q_t1_at9Ja __pyx_string_tab[1613]
#define __pyx_kp_b_iso88591_A_Q_t3a __pyx_string_tab[1614]
#define __pyx_kp_b_iso88591_A_Qa __pyx_string_tab[1615]
#define __pyx_kp_b_iso88591_A_Qd_7_Q_1_at7 __pyx_string_tab[1616]
#define __pyx_kp_b_iso88591_A_QfA_G5_5_v_t_Z __pyx_string_tab[1617]
#define __pyx_kp_b_iso88591_A_QgQ_Q_1F_iuCuF_Q_AZvQ __pyx_string_tab[1618]
#define __pyx_kp_b_iso88591_A_Qha_a_1F_iuCuG3a_AZvQ __pyx_string_tab[1619]
#define __pyx_kp_b_iso88591_A_Qiq_q_1F_iuCuHCq_AZvQ __pyx_string_tab[1620]
#define __pyx_kp_b_iso88591_A_Rq_AQ_A __pyx_string_tab[1621]
#define __pyx_kp_b_iso88591_A_T_a_U_6_A_1 __pyx_string_tab[1622]
#define __pyx_kp_b_iso88591_A_XWD_a_A_Q_AQ_Zq_Zq_z_1L_a_a_4w __pyx_string_tab[1623]
#define __pyx_kp_b_iso88591_A_a __pyx_string_tab[1624]
#define __pyx_kp_b_iso88591_A_a_1_aj_wd_9G1_AQ_1_AQ_7_Q_2 __pyx_string_tab[1625]
#define __pyx_kp_b_iso88591_A_a_4_d_d_q __pyx_string_tab[1626]
#define __pyx_kp_b_iso88591_A_a_7_Q_1_at7 __pyx_string_tab[1627]
#define __pyx_kp_b_iso88591_A_auG7_1 __pyx_string_tab[1628]
#define __pyx_kp_b_iso88591_A_axvQhfAQ_s_q_8 __pyx_string_tab[1629]
#define __pyx_kp_b_iso88591_A_d_q_M_D_Qa_IQfD_1_T_Kq_uD_c __pyx_string_tab[1630]
#define __pyx_kp_b_iso88591_A_iq_ivS __pyx_string_tab[1631]
#define __pyx_kp_b_iso88591_A_j __pyx_string_tab[1632]
#define __pyx_kp_b_iso88591_A_j_2 __pyx_string_tab[1633]
#define __pyx_kp_b_iso88591_A_nAQ_t6_c_fKq_q __pyx_string_tab[1634]
#define __pyx_kp_b_iso88591_A_q __pyx_string_tab[1635]
#define __pyx_kp_b_iso88591_A_q_2 __pyx_string_tab[1636]
#define __pyx_kp_b_iso88591_A_q_3 __pyx_string_tab[1637]
#define __pyx_kp_b_iso88591_A_q_4 __pyx_string_tab[1638]
#define __pyx_kp_b_iso88591_A_q_5 __pyx_string_tab[1639]
#define __pyx_kp_b_iso88591_A_q_7_Q_q __pyx_string_tab[1640]
#define __pyx_kp_b_iso88591_A_q_A_4wa __pyx_string_tab[1641]
#define __pyx_kp_b_iso88591_A_q_A_7_Q_1_at7 __pyx_string_tab[1642]
#define __pyx_kp_b_iso88591_A_r_Q __pyx_string_tab[1643]
#define __pyx_kp_b_iso88591_A_s_1 __pyx_string_tab[1644]
#define __pyx_kp_b_iso88591_A_t1 __pyx_string_tab[1645]
#define __pyx_kp_b_iso88591_A_t1A __pyx_string_tab[1646]
#define __pyx_kp_b_iso88591_A_t1A_2 __pyx_string_tab[1647]
#define __pyx_kp_b_iso88591_A_t1D_1 __pyx_string_tab[1648]
#define __pyx_kp_b_iso88591_A_t1D_Q __pyx_string_tab[1649]
#define __pyx_kp_b_iso88591_A_t1D_q __pyx_string_tab[1650]
#define __pyx_kp_b_iso88591_A_t1D_q_2 __pyx_string_tab[1651]
#define __pyx_kp_b_iso88591_A_t1D_q_3 __pyx_string_tab[1652]
#define __pyx_kp_b_iso88591_A_t1_2 __pyx_string_tab[1653]
#define __pyx_kp_b_iso88591_A_t6 __pyx_string_tab[1654]
#define __pyx_kp_b_iso88591_A_t6_2 __pyx_string_tab[1655]
#define __pyx_kp_b_iso88591_A_t87_1 __pyx_string_tab[1656]
#define __pyx_kp_b_iso88591_A_t87_4_7_Z7H_QfA __pyx_string_tab[1657]
#define __pyx_kp_b_iso88591_A_t87_83a_4y_1_q_Qd_6_Kq_4t1_Qd __pyx_string_tab[1658]
#define __pyx_kp_b_iso88591_A_t87_a_N_4wa __pyx_string_tab[1659]
#define __pyx_kp_b_iso88591_A_t9A __pyx_string_tab[1660]
#define __pyx_kp_b_iso88591_A_t9A_2 __pyx_string_tab[1661]
#define __pyx_kp_b_iso88591_A_t9D __pyx_string_tab[1662]
#define __pyx_kp_b_iso88591_A_t_Qa __pyx_string_tab[1663]
#define __pyx_kp_b_iso88591_A_t_Qk __pyx_string_tab[1664]
#define __pyx_kp_b_iso88591_A_t_q_J_A_d_T_Kt1_t1 __pyx_string_tab[1665]
#define __pyx_kp_b_iso88591_A_t_wfA_HG_V1_axq __pyx_string_tab[1666]
#define __pyx_kp_b_iso88591_A_t_wfA_I_81 __pyx_string_tab[1667]
#define __pyx_kp_b_iso88591_A_uCq_q_uAQ_6_E_D_AQ_Ja_7_1G6_A __pyx_string_tab[1668]
#define __pyx_kp_b_iso88591_A_wat1 __pyx_string_tab[1669]
#define __pyx_kp_b_iso88591_A_xs __pyx_string_tab[1670]
#define __pyx_kp_b_iso88591_A_y __pyx_string_tab[1671]
#define __pyx_kp_b_iso88591_A_y_O1A_q __pyx_string_tab[1672]
#define __pyx_kp_b_iso88591_A_y_q __pyx_string_tab[1673]
#define __pyx_kp_b_iso88591_A_z_G1_j_wc_9_6_AQ_6_q __pyx_string_tab[1674]
#define __pyx_kp_b_iso88591_B_PQ_t87_4_7_Z7H_Kq_y_4y_1_t9B __pyx_string_tab[1675]
#define __pyx_kp_b_iso88591_C1_H_Qa __pyx_string_tab[1676]
#define __pyx_kp_b_iso88591_C1_Q __pyx_string_tab[1677]
#define __pyx_kp_b_iso88591_F_fA_q_7_Q_a_5_5_V3e3fCq_gQ_Qa __pyx_string_tab[1678]
#define __pyx_kp_b_iso88591_LA_C1_2_F_wk_a_1A_z_0_q_j_uKvQ __pyx_string_tab[1679]
#define __pyx_kp_b_iso88591_M_D_Qa_IQfD_1_4s_e81A_t1_q_U_t1 __pyx_string_tab[1680]
#define __pyx_kp_b_iso88591_M_D_Qa_IQfD_1_5_q_3a_1_1 __pyx_string_tab[1681]
#define __pyx_kp_b_iso88591_O1_6_A_6a_9_y __pyx_string_tab[1682]
#define __pyx_kp_b_iso88591_O1_AWKq_A_uAXQ __pyx_string_tab[1683]
#define __pyx_kp_b_iso88591_O1_t81_9AQ_t2S_1_t2Q_Q_A_q_a_t9 __pyx_string_tab[1684]
#define __pyx_kp_b_iso88591_Q __pyx_string_tab[1685]
#define __pyx_kp_b_iso88591_QQR_B_0_wk_a_1_1A_z_0_q_z_1_q_q __pyx_string_tab[1686]
#define __pyx_kp_b_iso88591_Q_7q_7_auA __pyx_string_tab[1687]
#define __pyx_kp_b_iso88591_Q_wc_c_1_A_avQ_av __pyx_string_tab[1688]
#define __pyx_kp_b_iso88591_Q_y_5_Jc_j_t3a_fHA_Qc_1_y_uD_Ja __pyx_string_tab[1689]
#define __pyx_kp_b_iso88591_QfA_G5_9AV6_4 __pyx_string_tab[1690]
#define __pyx_kp_b_iso88591_QfF_fA_gQ __pyx_string_tab[1691]
#define __pyx_kp_b_iso88591_Qha_iwgQa_1HA_Q_y_a_9G1_q_q __pyx_string_tab[1692]
#define __pyx_kp_b_iso88591_Qiz_j_PQ __pyx_string_tab[1693]
#define __pyx_kp_b_iso88591_U_1_AQ_vV3c_l_Qa_uCq_q_uAQ_6_A __pyx_string_tab[1694]
#define __pyx_kp_b_iso88591_U_l_aq_2_1_2_1_q __pyx_string_tab[1695]
#define __pyx_kp_b_iso88591__47 __pyx_string_tab[1696]
#define __pyx_kp_b_iso88591__48 __pyx_string_tab[1697]
#define __pyx_kp_b_iso88591_a __pyx_string_tab[1698]
#define __pyx_kp_b_iso88591_a2_nAXXQ_5_q __pyx_string_tab[1699]
#define __pyx_kp_b_iso88591_a_4wa_Q_q __pyx_string_tab[1700]
#define __pyx_kp_b_iso88591_a_4xy_1_a_Qd_5T_QRRS_3awc_a_Qa __pyx_string_tab[1701]
#define __pyx_kp_b_iso88591_a_6_A_A_t_1E __pyx_string_tab[1702]
#define __pyx_kp_b_iso88591_a_a __pyx_string_tab[1703]
#define __pyx_kp_b_iso88591_a_t __pyx_string_tab[1704]
#define __pyx_kp_b_iso88591_a_t81_5_1_1_4wa_Q_t_r __pyx_string_tab[1705]
#define __pyx_kp_b_iso88591_aq_t1_ha_9_QgQ_w_1_QgZq __pyx_string_tab[1706]
#define __pyx_kp_b_iso88591_m1_77LA_9_7q_O1_Q_s_s_b_7_ha_y __pyx_string_tab[1707]
#define __pyx_kp_b_iso88591_m1_XXQe87_A_a_7q __pyx_string_tab[1708]
#define __pyx_kp_b_iso88591_m1_t87_Q_7_i_1A_5_q_y_gRt6_aq_1 __pyx_string_tab[1709]
#define __pyx_kp_b_iso88591_nA __pyx_string_tab[1710]
#define __pyx_kp_b_iso88591_q_4wa_Q_q __pyx_string_tab[1711]
#define __pyx_kp_b_iso88591_q_L_Qd_E __pyx_string_tab[1712]
#define __pyx_kp_b_iso88591_q_O1_t81_9AQ_t2S_1_t2Q_Q_A_q_a __pyx_string_tab[1713]
#define __pyx_kp_b_iso88591_q_Q __pyx_string_tab[1714]
#define __pyx_kp_b_iso88591_q_Q_k_a __pyx_string_tab[1715]
#define __pyx_kp_b_iso88591_q_QfA_G5_81F_N_o __pyx_string_tab[1716]
#define __pyx_kp_b_iso88591_q_aq_Qa_j_AQ_AQ_4_Q_WD_1_j_5_A __pyx_string_tab[1717]
#define __pyx_kp_b_iso88591_q_q __pyx_string_tab[1718]
#define __pyx_kp_b_iso88591_q_t7_auA __pyx_string_tab[1719]
#define __pyx_kp_b_iso88591_q_t81_5_1_1_4wa_Q_t5 __pyx_string_tab[1720]
#define __pyx_kp_b_iso88591_q_wc_AQ __pyx_string_tab[1721]
#define __pyx_kp_b_iso88591_uAQ_V1A_vQc_A_4_1_aq__AQ_l_7q_J __pyx_string_tab[1722]
#define __pyx_kp_b_iso88591_wc_9_4z_Q_6_1_s_q __pyx_string_tab[1723]
#define __pyx_kp_b_ns_d_2 __pyx_string_tab[1724]
#define __pyx_n_b_A __pyx_string_tab[1725]
#define __pyx_n_b_ASCII __pyx_string_tab[1726]
#define __pyx_n_b_O __pyx_string_tab[1727]
#define __pyx_n_b_Ok __pyx_string_tab[1728]
#define __pyx_n_b_dc __pyx_string_tab[1729]
#define __pyx_n_b_html __pyx_string_tab[1730]
#define __pyx_n_b_match __pyx_string_tab[1731]
#define __pyx_n_b_py __pyx_string_tab[1732]
#define __pyx_n_b_rdf __pyx_string_tab[1733]
#define __pyx_n_b_replace __pyx_string_tab[1734]
#define __pyx_n_b_script __pyx_string_tab[1735]
#define __pyx_n_b_style __pyx_string_tab[1736]
#define __pyx_n_b_test __pyx_string_tab[1737]
#define __pyx_n_b_wsdl __pyx_string_tab[1738]
#define __pyx_n_b_xml __pyx_string_tab[1739]
#define __pyx_n_b_xmlns_2 __pyx_string_tab[1740]
#define __pyx_n_b_xs __pyx_string_tab[1741]
#define __pyx_n_b_xsi __pyx_string_tab[1742]
#define __pyx_n_b_xsl __pyx_string_tab[1743]
#define __pyx_int_0 __pyx_number_tab[0]
#define __pyx_int_neg_1 __pyx_number_tab[1]
#define __pyx_int_1 __pyx_number_tab[2]
#define __pyx_int_2 __pyx_number_tab[3]
#define __pyx_int_3 __pyx_number_tab[4]
#define __pyx_int_neg_4 __pyx_number_tab[5]
#define __pyx_int_4 __pyx_number_tab[6]
#define __pyx_int_5 __pyx_number_tab[7]
#define __pyx_int_neg_100 __pyx_number_tab[8]
#define __pyx_int_100 __pyx_number_tab[9]
#define __pyx_int_neg_200 __pyx_number_tab[10]
#define __pyx_int_neg_300 __pyx_number_tab[11]
#define __pyx_int_32768 __pyx_number_tab[12]
#define __pyx_int_136983863 __pyx_number_tab[13]
/* #### Code section: module_state_clear ### */
#if CYTHON_USE_MODULE_STATE
static CYTHON_SMALL_CODE int __pyx_m_clear(PyObject *m) {
  __pyx_mstatetype *clear_module_state = __Pyx_PyModule_GetState(m);
  if (!clear_module_state) return 0;
  Py_CLEAR(clear_module_state->__pyx_d);
  Py_CLEAR(clear_module_state->__pyx_b);
  Py_CLEAR(clear_module_state->__pyx_cython_runtime);
  Py_CLEAR(clear_module_state->__pyx_empty_tuple);
  Py_CLEAR(clear_module_state->__pyx_empty_bytes);
  Py_CLEAR(clear_module_state->__pyx_empty_unicode);
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  __Pyx_State_RemoveModule(NULL);
  #endif
  Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_4type_type);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_Error);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_Error);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_LxmlError);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_LxmlError);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_C14NError);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_C14NError);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__TempStore);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__TempStore);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__ExceptionContext);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__ExceptionContext);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__LogEntry);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__LogEntry);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__BaseErrorLog);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__BaseErrorLog);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__ListErrorLog);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__ListErrorLog);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__ErrorLogContext);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__ErrorLogContext);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__ErrorLog);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__ErrorLog);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__DomainErrorLog);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__DomainErrorLog);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__RotatingErrorLog);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__RotatingErrorLog);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_PyErrorLog);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_PyErrorLog);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__Document);
  Py_CLEAR(clear_module_state->LxmlDocumentType);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_DocInfo);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_DocInfo);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__Element);
  Py_CLEAR(clear_module_state->LxmlElementType);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree___ContentOnlyElement);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree___ContentOnlyElement);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__Comment);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__Comment);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__ProcessingInstruction);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__ProcessingInstruction);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__Entity);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__Entity);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_QName);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_QName);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__ElementTree);
  Py_CLEAR(clear_module_state->LxmlElementTreeType);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__Attrib);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__Attrib);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__AttribIterator);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__AttribIterator);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__ElementTagMatcher);
  Py_CLEAR(clear_module_state->LxmlElementTagMatcherType);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__ElementIterator);
  Py_CLEAR(clear_module_state->LxmlElementIteratorType);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__MultiTagMatcher);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__MultiTagMatcher);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__ElementMatchIterator);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__ElementMatchIterator);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_ElementChildIterator);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_ElementChildIterator);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_SiblingsIterator);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_SiblingsIterator);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_AncestorsIterator);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_AncestorsIterator);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_ElementDepthFirstIterator);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_ElementDepthFirstIterator);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_ElementTextIterator);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_ElementTextIterator);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_CDATA);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_CDATA);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__ReadOnlyProxy);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__ReadOnlyProxy);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__ReadOnlyPIProxy);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__ReadOnlyPIProxy);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__ReadOnlyEntityProxy);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__ReadOnlyEntityProxy);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__ReadOnlyElementProxy);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__ReadOnlyElementProxy);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__OpaqueNodeWrapper);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__OpaqueNodeWrapper);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__OpaqueDocumentWrapper);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__OpaqueDocumentWrapper);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__ModifyContentOnlyProxy);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__ModifyContentOnlyProxy);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__ModifyContentOnlyPIProxy);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__ModifyContentOnlyPIProxy);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__ModifyContentOnlyEntityProxy);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__ModifyContentOnlyEntityProxy);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__AppendOnlyElementProxy);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__AppendOnlyElementProxy);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_ElementBase);
  Py_CLEAR(clear_module_state->LxmlElementBaseType);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_CommentBase);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_CommentBase);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_PIBase);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_PIBase);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_EntityBase);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_EntityBase);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_ElementClassLookup);
  Py_CLEAR(clear_module_state->LxmlElementClassLookupType);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_FallbackElementClassLookup);
  Py_CLEAR(clear_module_state->LxmlFallbackElementClassLookupType);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_ElementDefaultClassLookup);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_ElementDefaultClassLookup);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_AttributeBasedElementClassLookup);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_AttributeBasedElementClassLookup);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_ParserBasedElementClassLookup);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_ParserBasedElementClassLookup);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_CustomElementClassLookup);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_CustomElementClassLookup);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_PythonElementClassLookup);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_PythonElementClassLookup);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_LxmlRegistryError);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_LxmlRegistryError);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_NamespaceRegistryError);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_NamespaceRegistryError);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__NamespaceRegistry);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__NamespaceRegistry);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__ClassNamespaceRegistry);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__ClassNamespaceRegistry);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_ElementNamespaceClassLookup);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_ElementNamespaceClassLookup);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__FunctionNamespaceRegistry);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__FunctionNamespaceRegistry);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__XPathFunctionNamespaceRegistry);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__XPathFunctionNamespaceRegistry);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__InputDocument);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__InputDocument);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_Resolver);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_Resolver);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__ResolverRegistry);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__ResolverRegistry);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__ResolverContext);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__ResolverContext);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_ParserError);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_ParserError);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__ParserDictionaryContext);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__ParserDictionaryContext);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__FileReaderContext);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__FileReaderContext);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__ParserContext);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__ParserContext);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__BaseParser);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__BaseParser);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__FeedParser);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__FeedParser);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_XMLParser);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_XMLParser);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_XMLPullParser);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_XMLPullParser);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_ETCompatXMLParser);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_ETCompatXMLParser);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_HTMLParser);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_HTMLParser);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_HTMLPullParser);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_HTMLPullParser);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__SaxParserTarget);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__SaxParserTarget);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__SaxParserContext);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__SaxParserContext);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__ParseEventsIterator);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__ParseEventsIterator);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_TreeBuilder);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_TreeBuilder);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__PythonSaxParserTarget);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__PythonSaxParserTarget);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__TargetParserContext);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__TargetParserContext);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_SerialisationError);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_SerialisationError);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__FilelikeWriter);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__FilelikeWriter);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_C14NWriterTarget);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_C14NWriterTarget);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_xmlfile);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_xmlfile);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_htmlfile);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_htmlfile);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__IncrementalFileWriter);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__IncrementalFileWriter);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__AsyncDataWriter);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__AsyncDataWriter);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__AsyncIncrementalFileWriter);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__AsyncIncrementalFileWriter);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__AsyncFileWriterElement);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__AsyncFileWriterElement);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__FileWriterElement);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__FileWriterElement);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__MethodChanger);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__MethodChanger);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_iterparse);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_iterparse);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_iterwalk);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_iterwalk);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__IDDict);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__IDDict);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_XIncludeError);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_XIncludeError);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_XInclude);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_XInclude);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_XPathError);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_XPathError);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_XPathEvalError);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_XPathEvalError);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_XPathFunctionError);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_XPathFunctionError);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_XPathResultError);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_XPathResultError);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__ExsltRegExp);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__ExsltRegExp);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__BaseContext);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__BaseContext);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__ElementUnicodeResult);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__ElementUnicodeResult);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__XPathContext);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__XPathContext);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__XPathEvaluatorBase);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__XPathEvaluatorBase);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_XPathElementEvaluator);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_XPathElementEvaluator);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_XPathDocumentEvaluator);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_XPathDocumentEvaluator);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_XPath);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_XPath);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_ETXPath);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_ETXPath);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_XSLTError);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_XSLTError);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_XSLTParseError);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_XSLTParseError);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_XSLTApplyError);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_XSLTApplyError);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_XSLTExtensionError);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_XSLTExtensionError);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__XSLTResolverContext);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__XSLTResolverContext);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_XSLTAccessControl);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_XSLTAccessControl);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__XSLTContext);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__XSLTContext);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__XSLTQuotedStringParam);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__XSLTQuotedStringParam);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_XSLT);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_XSLT);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__XSLTResultTree);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__XSLTResultTree);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__XSLTProcessingInstruction);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__XSLTProcessingInstruction);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_XSLTExtension);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_XSLTExtension);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_DocumentInvalid);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_DocumentInvalid);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__Validator);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__Validator);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_DTDError);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_DTDError);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_DTDParseError);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_DTDParseError);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_DTDValidateError);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_DTDValidateError);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__DTDElementContentDecl);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__DTDElementContentDecl);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__DTDAttributeDecl);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__DTDAttributeDecl);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__DTDElementDecl);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__DTDElementDecl);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__DTDEntityDecl);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__DTDEntityDecl);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_DTD);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_DTD);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_RelaxNGError);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_RelaxNGError);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_RelaxNGParseError);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_RelaxNGParseError);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_RelaxNGValidateError);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_RelaxNGValidateError);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_RelaxNG);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_RelaxNG);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_XMLSchemaError);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_XMLSchemaError);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_XMLSchemaParseError);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_XMLSchemaParseError);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_XMLSchemaValidateError);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_XMLSchemaValidateError);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_XMLSchema);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_XMLSchema);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__ParserSchemaValidationContext);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__ParserSchemaValidationContext);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_SchematronError);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_SchematronError);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_SchematronParseError);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_SchematronParseError);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_SchematronValidateError);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_SchematronValidateError);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_Schematron);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_Schematron);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__MemDebug);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__MemDebug);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct___open_utf8_file);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct___open_utf8_file);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_1__iter_namespaces);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_1__iter_namespaces);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_2___aenter__);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_2___aenter__);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_3___aexit__);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_3___aexit__);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_4_flush);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_4_flush);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_5_write_declaration);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_5_write_declaration);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_6_write_doctype);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_6_write_doctype);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_7_write);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_7_write);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_8__close);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_8__close);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_9___aenter__);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_9___aenter__);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_10___aexit__);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_10___aexit__);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_11___aenter__);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_11___aenter__);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_12___aexit__);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_12___aexit__);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_13_itervalues);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_13_itervalues);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_14_iterattributes);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_14_iterattributes);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_15_iterelements);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_15_iterelements);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_16_iterentities);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_16_iterentities);
  Py_CLEAR(clear_module_state->__pyx_array_type);
  Py_CLEAR(clear_module_state->__pyx_type___pyx_array);
  Py_CLEAR(clear_module_state->__pyx_MemviewEnum_type);
  Py_CLEAR(clear_module_state->__pyx_type___pyx_MemviewEnum);
  Py_CLEAR(clear_module_state->__pyx_memoryview_type);
  Py_CLEAR(clear_module_state->__pyx_type___pyx_memoryview);
  Py_CLEAR(clear_module_state->__pyx_memoryviewslice_type);
  Py_CLEAR(clear_module_state->__pyx_type___pyx_memoryviewslice);
  Py_CLEAR(clear_module_state->__pyx_k__30);
  for (int i=0; i<12; ++i) { Py_CLEAR(clear_module_state->__pyx_slice[i]); }
  for (int i=0; i<26; ++i) { Py_CLEAR(clear_module_state->__pyx_tuple[i]); }
  for (int i=0; i<276; ++i) { Py_CLEAR(clear_module_state->__pyx_codeobj_tab[i]); }
  for (int i=0; i<1744; ++i) { Py_CLEAR(clear_module_state->__pyx_string_tab[i]); }
  for (int i=0; i<14; ++i) { Py_CLEAR(clear_module_state->__pyx_number_tab[i]); }
/* #### Code section: module_state_clear_contents ### */
/* CommonTypesMetaclass.module_state_clear */
Py_CLEAR(clear_module_state->__pyx_CommonTypesMetaclassType);

/* Generator.module_state_clear */
Py_CLEAR(clear_module_state->__pyx_GeneratorType);

/* CythonFunctionShared.module_state_clear */
Py_CLEAR(clear_module_state->__pyx_CyFunctionType);

/* Coroutine.module_state_clear */
Py_CLEAR(clear_module_state->__pyx_CoroutineType);
Py_CLEAR(clear_module_state->__pyx_CoroutineAwaitType);

/* #### Code section: module_state_clear_end ### */
return 0;
}
#endif
/* #### Code section: module_state_traverse ### */
#if CYTHON_USE_MODULE_STATE
static CYTHON_SMALL_CODE int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) {
  __pyx_mstatetype *traverse_module_state = __Pyx_PyModule_GetState(m);
  if (!traverse_module_state) return 0;
  Py_VISIT(traverse_module_state->__pyx_d);
  Py_VISIT(traverse_module_state->__pyx_b);
  Py_VISIT(traverse_module_state->__pyx_cython_runtime);
  __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_tuple);
  __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_bytes);
  __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_unicode);
  Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_4type_type);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_Error);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_Error);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_LxmlError);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_LxmlError);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_C14NError);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_C14NError);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__TempStore);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__TempStore);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__ExceptionContext);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__ExceptionContext);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__LogEntry);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__LogEntry);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__BaseErrorLog);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__BaseErrorLog);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__ListErrorLog);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__ListErrorLog);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__ErrorLogContext);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__ErrorLogContext);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__ErrorLog);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__ErrorLog);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__DomainErrorLog);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__DomainErrorLog);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__RotatingErrorLog);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__RotatingErrorLog);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_PyErrorLog);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_PyErrorLog);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__Document);
  Py_VISIT(traverse_module_state->LxmlDocumentType);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_DocInfo);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_DocInfo);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__Element);
  Py_VISIT(traverse_module_state->LxmlElementType);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree___ContentOnlyElement);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree___ContentOnlyElement);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__Comment);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__Comment);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__ProcessingInstruction);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__ProcessingInstruction);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__Entity);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__Entity);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_QName);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_QName);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__ElementTree);
  Py_VISIT(traverse_module_state->LxmlElementTreeType);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__Attrib);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__Attrib);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__AttribIterator);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__AttribIterator);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__ElementTagMatcher);
  Py_VISIT(traverse_module_state->LxmlElementTagMatcherType);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__ElementIterator);
  Py_VISIT(traverse_module_state->LxmlElementIteratorType);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__MultiTagMatcher);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__MultiTagMatcher);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__ElementMatchIterator);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__ElementMatchIterator);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_ElementChildIterator);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_ElementChildIterator);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_SiblingsIterator);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_SiblingsIterator);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_AncestorsIterator);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_AncestorsIterator);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_ElementDepthFirstIterator);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_ElementDepthFirstIterator);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_ElementTextIterator);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_ElementTextIterator);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_CDATA);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_CDATA);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__ReadOnlyProxy);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__ReadOnlyProxy);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__ReadOnlyPIProxy);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__ReadOnlyPIProxy);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__ReadOnlyEntityProxy);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__ReadOnlyEntityProxy);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__ReadOnlyElementProxy);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__ReadOnlyElementProxy);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__OpaqueNodeWrapper);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__OpaqueNodeWrapper);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__OpaqueDocumentWrapper);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__OpaqueDocumentWrapper);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__ModifyContentOnlyProxy);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__ModifyContentOnlyProxy);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__ModifyContentOnlyPIProxy);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__ModifyContentOnlyPIProxy);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__ModifyContentOnlyEntityProxy);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__ModifyContentOnlyEntityProxy);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__AppendOnlyElementProxy);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__AppendOnlyElementProxy);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_ElementBase);
  Py_VISIT(traverse_module_state->LxmlElementBaseType);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_CommentBase);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_CommentBase);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_PIBase);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_PIBase);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_EntityBase);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_EntityBase);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_ElementClassLookup);
  Py_VISIT(traverse_module_state->LxmlElementClassLookupType);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_FallbackElementClassLookup);
  Py_VISIT(traverse_module_state->LxmlFallbackElementClassLookupType);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_ElementDefaultClassLookup);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_ElementDefaultClassLookup);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_AttributeBasedElementClassLookup);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_AttributeBasedElementClassLookup);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_ParserBasedElementClassLookup);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_ParserBasedElementClassLookup);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_CustomElementClassLookup);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_CustomElementClassLookup);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_PythonElementClassLookup);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_PythonElementClassLookup);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_LxmlRegistryError);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_LxmlRegistryError);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_NamespaceRegistryError);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_NamespaceRegistryError);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__NamespaceRegistry);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__NamespaceRegistry);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__ClassNamespaceRegistry);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__ClassNamespaceRegistry);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_ElementNamespaceClassLookup);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_ElementNamespaceClassLookup);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__FunctionNamespaceRegistry);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__FunctionNamespaceRegistry);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__XPathFunctionNamespaceRegistry);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__XPathFunctionNamespaceRegistry);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__InputDocument);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__InputDocument);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_Resolver);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_Resolver);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__ResolverRegistry);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__ResolverRegistry);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__ResolverContext);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__ResolverContext);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_ParserError);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_ParserError);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__ParserDictionaryContext);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__ParserDictionaryContext);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__FileReaderContext);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__FileReaderContext);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__ParserContext);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__ParserContext);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__BaseParser);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__BaseParser);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__FeedParser);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__FeedParser);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_XMLParser);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_XMLParser);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_XMLPullParser);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_XMLPullParser);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_ETCompatXMLParser);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_ETCompatXMLParser);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_HTMLParser);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_HTMLParser);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_HTMLPullParser);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_HTMLPullParser);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__SaxParserTarget);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__SaxParserTarget);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__SaxParserContext);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__SaxParserContext);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__ParseEventsIterator);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__ParseEventsIterator);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_TreeBuilder);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_TreeBuilder);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__PythonSaxParserTarget);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__PythonSaxParserTarget);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__TargetParserContext);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__TargetParserContext);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_SerialisationError);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_SerialisationError);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__FilelikeWriter);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__FilelikeWriter);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_C14NWriterTarget);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_C14NWriterTarget);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_xmlfile);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_xmlfile);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_htmlfile);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_htmlfile);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__IncrementalFileWriter);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__IncrementalFileWriter);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__AsyncDataWriter);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__AsyncDataWriter);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__AsyncIncrementalFileWriter);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__AsyncIncrementalFileWriter);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__AsyncFileWriterElement);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__AsyncFileWriterElement);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__FileWriterElement);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__FileWriterElement);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__MethodChanger);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__MethodChanger);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_iterparse);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_iterparse);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_iterwalk);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_iterwalk);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__IDDict);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__IDDict);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_XIncludeError);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_XIncludeError);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_XInclude);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_XInclude);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_XPathError);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_XPathError);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_XPathEvalError);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_XPathEvalError);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_XPathFunctionError);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_XPathFunctionError);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_XPathResultError);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_XPathResultError);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__ExsltRegExp);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__ExsltRegExp);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__BaseContext);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__BaseContext);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__ElementUnicodeResult);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__ElementUnicodeResult);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__XPathContext);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__XPathContext);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__XPathEvaluatorBase);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__XPathEvaluatorBase);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_XPathElementEvaluator);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_XPathElementEvaluator);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_XPathDocumentEvaluator);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_XPathDocumentEvaluator);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_XPath);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_XPath);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_ETXPath);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_ETXPath);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_XSLTError);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_XSLTError);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_XSLTParseError);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_XSLTParseError);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_XSLTApplyError);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_XSLTApplyError);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_XSLTExtensionError);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_XSLTExtensionError);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__XSLTResolverContext);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__XSLTResolverContext);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_XSLTAccessControl);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_XSLTAccessControl);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__XSLTContext);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__XSLTContext);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__XSLTQuotedStringParam);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__XSLTQuotedStringParam);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_XSLT);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_XSLT);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__XSLTResultTree);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__XSLTResultTree);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__XSLTProcessingInstruction);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__XSLTProcessingInstruction);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_XSLTExtension);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_XSLTExtension);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_DocumentInvalid);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_DocumentInvalid);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__Validator);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__Validator);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_DTDError);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_DTDError);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_DTDParseError);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_DTDParseError);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_DTDValidateError);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_DTDValidateError);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__DTDElementContentDecl);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__DTDElementContentDecl);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__DTDAttributeDecl);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__DTDAttributeDecl);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__DTDElementDecl);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__DTDElementDecl);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__DTDEntityDecl);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__DTDEntityDecl);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_DTD);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_DTD);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_RelaxNGError);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_RelaxNGError);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_RelaxNGParseError);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_RelaxNGParseError);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_RelaxNGValidateError);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_RelaxNGValidateError);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_RelaxNG);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_RelaxNG);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_XMLSchemaError);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_XMLSchemaError);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_XMLSchemaParseError);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_XMLSchemaParseError);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_XMLSchemaValidateError);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_XMLSchemaValidateError);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_XMLSchema);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_XMLSchema);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__ParserSchemaValidationContext);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__ParserSchemaValidationContext);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_SchematronError);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_SchematronError);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_SchematronParseError);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_SchematronParseError);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_SchematronValidateError);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_SchematronValidateError);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_Schematron);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_Schematron);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__MemDebug);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__MemDebug);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct___open_utf8_file);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct___open_utf8_file);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_1__iter_namespaces);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_1__iter_namespaces);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_2___aenter__);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_2___aenter__);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_3___aexit__);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_3___aexit__);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_4_flush);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_4_flush);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_5_write_declaration);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_5_write_declaration);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_6_write_doctype);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_6_write_doctype);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_7_write);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_7_write);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_8__close);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_8__close);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_9___aenter__);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_9___aenter__);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_10___aexit__);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_10___aexit__);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_11___aenter__);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_11___aenter__);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_12___aexit__);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_12___aexit__);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_13_itervalues);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_13_itervalues);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_14_iterattributes);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_14_iterattributes);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_15_iterelements);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_15_iterelements);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_16_iterentities);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_16_iterentities);
  Py_VISIT(traverse_module_state->__pyx_array_type);
  Py_VISIT(traverse_module_state->__pyx_type___pyx_array);
  Py_VISIT(traverse_module_state->__pyx_MemviewEnum_type);
  Py_VISIT(traverse_module_state->__pyx_type___pyx_MemviewEnum);
  Py_VISIT(traverse_module_state->__pyx_memoryview_type);
  Py_VISIT(traverse_module_state->__pyx_type___pyx_memoryview);
  Py_VISIT(traverse_module_state->__pyx_memoryviewslice_type);
  Py_VISIT(traverse_module_state->__pyx_type___pyx_memoryviewslice);
  Py_VISIT(traverse_module_state->__pyx_k__30);
  for (int i=0; i<12; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_slice[i]); }
  for (int i=0; i<26; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_tuple[i]); }
  for (int i=0; i<276; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_codeobj_tab[i]); }
  for (int i=0; i<1744; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_string_tab[i]); }
  for (int i=0; i<14; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_number_tab[i]); }
/* #### Code section: module_state_traverse_contents ### */
/* CommonTypesMetaclass.module_state_traverse */
Py_VISIT(traverse_module_state->__pyx_CommonTypesMetaclassType);

/* Generator.module_state_traverse */
Py_VISIT(traverse_module_state->__pyx_GeneratorType);

/* CythonFunctionShared.module_state_traverse */
Py_VISIT(traverse_module_state->__pyx_CyFunctionType);

/* Coroutine.module_state_traverse */
Py_VISIT(traverse_module_state->__pyx_CoroutineType);
Py_VISIT(traverse_module_state->__pyx_CoroutineAwaitType);

/* #### Code section: module_state_traverse_end ### */
return 0;
}
#endif
/* #### Code section: module_code ### */

/* "View.MemoryView":129
 *         cdef bint dtype_is_object
 * 
 *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,             # <<<<<<<<<<<<<<
 *                   mode="c", bint allocate_buffer=True):
 * 
*/

/* Python wrapper */
static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_shape = 0;
  Py_ssize_t __pyx_v_itemsize;
  PyObject *__pyx_v_format = 0;
  PyObject *__pyx_v_mode = 0;
  int __pyx_v_allocate_buffer;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[5] = {0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_shape,&__pyx_mstate_global->__pyx_n_u_itemsize,&__pyx_mstate_global->__pyx_n_u_format,&__pyx_mstate_global->__pyx_n_u_mode,&__pyx_mstate_global->__pyx_n_u_allocate_buffer,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(7, 129, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  5:
        values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(7, 129, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(7, 129, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(7, 129, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(7, 129, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(7, 129, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__cinit__", 0) < (0)) __PYX_ERR(7, 129, __pyx_L3_error)
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_n_u_c));
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, i); __PYX_ERR(7, 129, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  5:
        values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(7, 129, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(7, 129, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(7, 129, __pyx_L3_error)
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(7, 129, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(7, 129, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_n_u_c));
    }
    __pyx_v_shape = ((PyObject*)values[0]);
    __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(7, 129, __pyx_L3_error)
    __pyx_v_format = values[2];
    __pyx_v_mode = values[3];
    if (values[4]) {
      __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_allocate_buffer == (int)-1) && PyErr_Occurred())) __PYX_ERR(7, 130, __pyx_L3_error)
    } else {

      /* "View.MemoryView":130
 * 
 *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,
 *                   mode="c", bint allocate_buffer=True):             # <<<<<<<<<<<<<<
 * 
 *         cdef int idx
*/
      __pyx_v_allocate_buffer = ((int)1);
    }
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, __pyx_nargs); __PYX_ERR(7, 129, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1, "shape", 1))) __PYX_ERR(7, 129, __pyx_L1_error)
  if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) {
    PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "format"); __PYX_ERR(7, 129, __pyx_L1_error)
  }
  __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(((struct __pyx_array_obj *)__pyx_v_self), __pyx_v_shape, __pyx_v_itemsize, __pyx_v_format, __pyx_v_mode, __pyx_v_allocate_buffer);

  /* "View.MemoryView":129
 *         cdef bint dtype_is_object
 * 
 *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,             # <<<<<<<<<<<<<<
 *                   mode="c", bint allocate_buffer=True):
 * 
*/

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer) {
  int __pyx_v_idx;
  Py_ssize_t __pyx_v_dim;
  char __pyx_v_order;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  char *__pyx_t_7;
  int __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11[5];
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);
  __Pyx_INCREF(__pyx_v_format);

  /* "View.MemoryView":135
 *         cdef Py_ssize_t dim
 * 
 *         self.ndim = <int> len(shape)             # <<<<<<<<<<<<<<
 *         self.itemsize = itemsize
 * 
*/
  if (unlikely(__pyx_v_shape == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(7, 135, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyTuple_GET_SIZE(__pyx_v_shape); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(7, 135, __pyx_L1_error)
  __pyx_v_self->ndim = ((int)__pyx_t_1);

  /* "View.MemoryView":136
 * 
 *         self.ndim = <int> len(shape)
 *         self.itemsize = itemsize             # <<<<<<<<<<<<<<
 * 
 *         if not self.ndim:
*/
  __pyx_v_self->itemsize = __pyx_v_itemsize;

  /* "View.MemoryView":138
 *         self.itemsize = itemsize
 * 
 *         if not self.ndim:             # <<<<<<<<<<<<<<
 *             raise ValueError, "Empty shape tuple for cython.array"
 * 
*/
  __pyx_t_2 = (!(__pyx_v_self->ndim != 0));
  if (unlikely(__pyx_t_2)) {

    /* "View.MemoryView":139
 * 
 *         if not self.ndim:
 *             raise ValueError, "Empty shape tuple for cython.array"             # <<<<<<<<<<<<<<
 * 
 *         if itemsize <= 0:
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Empty_shape_tuple_for_cython_arr, 0, 0);
    __PYX_ERR(7, 139, __pyx_L1_error)

    /* "View.MemoryView":138
 *         self.itemsize = itemsize
 * 
 *         if not self.ndim:             # <<<<<<<<<<<<<<
 *             raise ValueError, "Empty shape tuple for cython.array"
 * 
*/
  }

  /* "View.MemoryView":141
 *             raise ValueError, "Empty shape tuple for cython.array"
 * 
 *         if itemsize <= 0:             # <<<<<<<<<<<<<<
 *             raise ValueError, "itemsize <= 0 for cython.array"
 * 
*/
  __pyx_t_2 = (__pyx_v_itemsize <= 0);
  if (unlikely(__pyx_t_2)) {

    /* "View.MemoryView":142
 * 
 *         if itemsize <= 0:
 *             raise ValueError, "itemsize <= 0 for cython.array"             # <<<<<<<<<<<<<<
 * 
 *         if not isinstance(format, bytes):
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_itemsize_0_for_cython_array, 0, 0);
    __PYX_ERR(7, 142, __pyx_L1_error)

    /* "View.MemoryView":141
 *             raise ValueError, "Empty shape tuple for cython.array"
 * 
 *         if itemsize <= 0:             # <<<<<<<<<<<<<<
 *             raise ValueError, "itemsize <= 0 for cython.array"
 * 
*/
  }

  /* "View.MemoryView":144
 *             raise ValueError, "itemsize <= 0 for cython.array"
 * 
 *         if not isinstance(format, bytes):             # <<<<<<<<<<<<<<
 *             format = format.encode('ASCII')
 *         self._format = format  # keep a reference to the byte string
*/
  __pyx_t_2 = PyBytes_Check(__pyx_v_format); 
  __pyx_t_3 = (!__pyx_t_2);
  if (__pyx_t_3) {

    /* "View.MemoryView":145
 * 
 *         if not isinstance(format, bytes):
 *             format = format.encode('ASCII')             # <<<<<<<<<<<<<<
 *         self._format = format  # keep a reference to the byte string
 *         self.format = self._format
*/
    __pyx_t_5 = __pyx_v_format;
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_6 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_n_u_ASCII};
      __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 145, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "View.MemoryView":144
 *             raise ValueError, "itemsize <= 0 for cython.array"
 * 
 *         if not isinstance(format, bytes):             # <<<<<<<<<<<<<<
 *             format = format.encode('ASCII')
 *         self._format = format  # keep a reference to the byte string
*/
  }

  /* "View.MemoryView":146
 *         if not isinstance(format, bytes):
 *             format = format.encode('ASCII')
 *         self._format = format  # keep a reference to the byte string             # <<<<<<<<<<<<<<
 *         self.format = self._format
 * 
*/
  __pyx_t_4 = __pyx_v_format;
  __Pyx_INCREF(__pyx_t_4);
  if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_4))) __PYX_ERR(7, 146, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_GOTREF(__pyx_v_self->_format);
  __Pyx_DECREF(__pyx_v_self->_format);
  __pyx_v_self->_format = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "View.MemoryView":147
 *             format = format.encode('ASCII')
 *         self._format = format  # keep a reference to the byte string
 *         self.format = self._format             # <<<<<<<<<<<<<<
 * 
 * 
*/
  if (unlikely(__pyx_v_self->_format == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(7, 147, __pyx_L1_error)
  }
  __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(7, 147, __pyx_L1_error)
  __pyx_v_self->format = __pyx_t_7;

  /* "View.MemoryView":150
 * 
 * 
 *         self._shape = <Py_ssize_t *> PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2)             # <<<<<<<<<<<<<<
 *         self._strides = self._shape + self.ndim
 * 
*/
  __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2)));

  /* "View.MemoryView":151
 * 
 *         self._shape = <Py_ssize_t *> PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2)
 *         self._strides = self._shape + self.ndim             # <<<<<<<<<<<<<<
 * 
 *         if not self._shape:
*/
  __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim);

  /* "View.MemoryView":153
 *         self._strides = self._shape + self.ndim
 * 
 *         if not self._shape:             # <<<<<<<<<<<<<<
 *             raise MemoryError, "unable to allocate shape and strides."
 * 
*/
  __pyx_t_3 = (!(__pyx_v_self->_shape != 0));
  if (unlikely(__pyx_t_3)) {

    /* "View.MemoryView":154
 * 
 *         if not self._shape:
 *             raise MemoryError, "unable to allocate shape and strides."             # <<<<<<<<<<<<<<
 * 
 * 
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_MemoryError))), __pyx_mstate_global->__pyx_kp_u_unable_to_allocate_shape_and_str, 0, 0);
    __PYX_ERR(7, 154, __pyx_L1_error)

    /* "View.MemoryView":153
 *         self._strides = self._shape + self.ndim
 * 
 *         if not self._shape:             # <<<<<<<<<<<<<<
 *             raise MemoryError, "unable to allocate shape and strides."
 * 
*/
  }

  /* "View.MemoryView":157
 * 
 * 
 *         for idx, dim in enumerate(shape):             # <<<<<<<<<<<<<<
 *             if dim <= 0:
 *                 raise ValueError, f"Invalid shape in axis {idx}: {dim}."
*/
  __pyx_t_8 = 0;
  __pyx_t_4 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_4);
  __pyx_t_1 = 0;
  for (;;) {
    {
      Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4);
      #if !CYTHON_ASSUME_SAFE_SIZE
      if (unlikely((__pyx_temp < 0))) __PYX_ERR(7, 157, __pyx_L1_error)
      #endif
      if (__pyx_t_1 >= __pyx_temp) break;
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_1));
    #else
    __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_1);
    #endif
    ++__pyx_t_1;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 157, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(7, 157, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_dim = __pyx_t_9;
    __pyx_v_idx = __pyx_t_8;
    __pyx_t_8 = (__pyx_t_8 + 1);

    /* "View.MemoryView":158
 * 
 *         for idx, dim in enumerate(shape):
 *             if dim <= 0:             # <<<<<<<<<<<<<<
 *                 raise ValueError, f"Invalid shape in axis {idx}: {dim}."
 *             self._shape[idx] = dim
*/
    __pyx_t_3 = (__pyx_v_dim <= 0);
    if (unlikely(__pyx_t_3)) {

      /* "View.MemoryView":159
 *         for idx, dim in enumerate(shape):
 *             if dim <= 0:
 *                 raise ValueError, f"Invalid shape in axis {idx}: {dim}."             # <<<<<<<<<<<<<<
 *             self._shape[idx] = dim
 * 
*/
      __pyx_t_5 = __Pyx_PyUnicode_From_int(__pyx_v_idx, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 159, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_10 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_10)) __PYX_ERR(7, 159, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_11[0] = __pyx_mstate_global->__pyx_kp_u_Invalid_shape_in_axis;
      __pyx_t_11[1] = __pyx_t_5;
      __pyx_t_11[2] = __pyx_mstate_global->__pyx_kp_u_;
      __pyx_t_11[3] = __pyx_t_10;
      __pyx_t_11[4] = __pyx_mstate_global->__pyx_kp_u__2;
      __pyx_t_12 = __Pyx_PyUnicode_Join(__pyx_t_11, 5, 22 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_10) + 1, 127);
      if (unlikely(!__pyx_t_12)) __PYX_ERR(7, 159, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_t_12, 0, 0);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __PYX_ERR(7, 159, __pyx_L1_error)

      /* "View.MemoryView":158
 * 
 *         for idx, dim in enumerate(shape):
 *             if dim <= 0:             # <<<<<<<<<<<<<<
 *                 raise ValueError, f"Invalid shape in axis {idx}: {dim}."
 *             self._shape[idx] = dim
*/
    }

    /* "View.MemoryView":160
 *             if dim <= 0:
 *                 raise ValueError, f"Invalid shape in axis {idx}: {dim}."
 *             self._shape[idx] = dim             # <<<<<<<<<<<<<<
 * 
 *         cdef char order
*/
    (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim;

    /* "View.MemoryView":157
 * 
 * 
 *         for idx, dim in enumerate(shape):             # <<<<<<<<<<<<<<
 *             if dim <= 0:
 *                 raise ValueError, f"Invalid shape in axis {idx}: {dim}."
*/
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "View.MemoryView":163
 * 
 *         cdef char order
 *         if mode == 'c':             # <<<<<<<<<<<<<<
 *             order = b'C'
 *             self.mode = u'c'
*/
  __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_v_mode, __pyx_mstate_global->__pyx_n_u_c, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(7, 163, __pyx_L1_error)
  if (__pyx_t_3) {

    /* "View.MemoryView":164
 *         cdef char order
 *         if mode == 'c':
 *             order = b'C'             # <<<<<<<<<<<<<<
 *             self.mode = u'c'
 *         elif mode == 'fortran':
*/
    __pyx_v_order = 'C';

    /* "View.MemoryView":165
 *         if mode == 'c':
 *             order = b'C'
 *             self.mode = u'c'             # <<<<<<<<<<<<<<
 *         elif mode == 'fortran':
 *             order = b'F'
*/
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_c);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_c);
    __Pyx_GOTREF(__pyx_v_self->mode);
    __Pyx_DECREF(__pyx_v_self->mode);
    __pyx_v_self->mode = __pyx_mstate_global->__pyx_n_u_c;

    /* "View.MemoryView":163
 * 
 *         cdef char order
 *         if mode == 'c':             # <<<<<<<<<<<<<<
 *             order = b'C'
 *             self.mode = u'c'
*/
    goto __pyx_L11;
  }

  /* "View.MemoryView":166
 *             order = b'C'
 *             self.mode = u'c'
 *         elif mode == 'fortran':             # <<<<<<<<<<<<<<
 *             order = b'F'
 *             self.mode = u'fortran'
*/
  __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_v_mode, __pyx_mstate_global->__pyx_n_u_fortran, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(7, 166, __pyx_L1_error)
  if (likely(__pyx_t_3)) {

    /* "View.MemoryView":167
 *             self.mode = u'c'
 *         elif mode == 'fortran':
 *             order = b'F'             # <<<<<<<<<<<<<<
 *             self.mode = u'fortran'
 *         else:
*/
    __pyx_v_order = 'F';

    /* "View.MemoryView":168
 *         elif mode == 'fortran':
 *             order = b'F'
 *             self.mode = u'fortran'             # <<<<<<<<<<<<<<
 *         else:
 *             raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}"
*/
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_fortran);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_fortran);
    __Pyx_GOTREF(__pyx_v_self->mode);
    __Pyx_DECREF(__pyx_v_self->mode);
    __pyx_v_self->mode = __pyx_mstate_global->__pyx_n_u_fortran;

    /* "View.MemoryView":166
 *             order = b'C'
 *             self.mode = u'c'
 *         elif mode == 'fortran':             # <<<<<<<<<<<<<<
 *             order = b'F'
 *             self.mode = u'fortran'
*/
    goto __pyx_L11;
  }

  /* "View.MemoryView":170
 *             self.mode = u'fortran'
 *         else:
 *             raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}"             # <<<<<<<<<<<<<<
 * 
 *         self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order)
*/
  /*else*/ {
    __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_mode, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 170, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_12 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_Invalid_mode_expected_c_or_fortr, __pyx_t_4); if (unlikely(!__pyx_t_12)) __PYX_ERR(7, 170, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_t_12, 0, 0);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __PYX_ERR(7, 170, __pyx_L1_error)
  }
  __pyx_L11:;

  /* "View.MemoryView":172
 *             raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}"
 * 
 *         self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order)             # <<<<<<<<<<<<<<
 * 
 *         self.free_data = allocate_buffer
*/
  __pyx_v_self->len = __pyx_fill_contig_strides_array(__pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_itemsize, __pyx_v_self->ndim, __pyx_v_order);

  /* "View.MemoryView":174
 *         self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order)
 * 
 *         self.free_data = allocate_buffer             # <<<<<<<<<<<<<<
 *         self.dtype_is_object = format == b'O'
 * 
*/
  __pyx_v_self->free_data = __pyx_v_allocate_buffer;

  /* "View.MemoryView":175
 * 
 *         self.free_data = allocate_buffer
 *         self.dtype_is_object = format == b'O'             # <<<<<<<<<<<<<<
 * 
 *         if allocate_buffer:
*/
  __pyx_t_12 = PyObject_RichCompare(__pyx_v_format, __pyx_mstate_global->__pyx_n_b_O, Py_EQ); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) __PYX_ERR(7, 175, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(7, 175, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_v_self->dtype_is_object = __pyx_t_3;

  /* "View.MemoryView":177
 *         self.dtype_is_object = format == b'O'
 * 
 *         if allocate_buffer:             # <<<<<<<<<<<<<<
 *             _allocate_buffer(self)
 * 
*/
  if (__pyx_v_allocate_buffer) {

    /* "View.MemoryView":178
 * 
 *         if allocate_buffer:
 *             _allocate_buffer(self)             # <<<<<<<<<<<<<<
 * 
 *     @cname('getbuffer')
*/
    __pyx_t_8 = __pyx_array_allocate_buffer(__pyx_v_self); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(7, 178, __pyx_L1_error)

    /* "View.MemoryView":177
 *         self.dtype_is_object = format == b'O'
 * 
 *         if allocate_buffer:             # <<<<<<<<<<<<<<
 *             _allocate_buffer(self)
 * 
*/
  }

  /* "View.MemoryView":129
 *         cdef bint dtype_is_object
 * 
 *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,             # <<<<<<<<<<<<<<
 *                   mode="c", bint allocate_buffer=True):
 * 
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_format);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":180
 *             _allocate_buffer(self)
 * 
 *     @cname('getbuffer')             # <<<<<<<<<<<<<<
 *     def __getbuffer__(self, Py_buffer *info, int flags):
 *         cdef int bufmode = -1
*/

/* Python wrapper */
CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(((struct __pyx_array_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  int __pyx_v_bufmode;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  char *__pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  Py_ssize_t *__pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  if (unlikely(__pyx_v_info == NULL)) {
    PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
    return -1;
  }
  __Pyx_RefNannySetupContext("__getbuffer__", 0);
  __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(__pyx_v_info->obj);

  /* "View.MemoryView":182
 *     @cname('getbuffer')
 *     def __getbuffer__(self, Py_buffer *info, int flags):
 *         cdef int bufmode = -1             # <<<<<<<<<<<<<<
 *         if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS):
 *             if self.mode == u"c":
*/
  __pyx_v_bufmode = -1;

  /* "View.MemoryView":183
 *     def __getbuffer__(self, Py_buffer *info, int flags):
 *         cdef int bufmode = -1
 *         if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS):             # <<<<<<<<<<<<<<
 *             if self.mode == u"c":
 *                 bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
*/
  __pyx_t_1 = ((__pyx_v_flags & ((PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS) | PyBUF_ANY_CONTIGUOUS)) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":184
 *         cdef int bufmode = -1
 *         if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS):
 *             if self.mode == u"c":             # <<<<<<<<<<<<<<
 *                 bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *             elif self.mode == u"fortran":
*/
    __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_mstate_global->__pyx_n_u_c, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(7, 184, __pyx_L1_error)
    if (__pyx_t_1) {

      /* "View.MemoryView":185
 *         if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS):
 *             if self.mode == u"c":
 *                 bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS             # <<<<<<<<<<<<<<
 *             elif self.mode == u"fortran":
 *                 bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
*/
      __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);

      /* "View.MemoryView":184
 *         cdef int bufmode = -1
 *         if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS):
 *             if self.mode == u"c":             # <<<<<<<<<<<<<<
 *                 bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *             elif self.mode == u"fortran":
*/
      goto __pyx_L4;
    }

    /* "View.MemoryView":186
 *             if self.mode == u"c":
 *                 bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *             elif self.mode == u"fortran":             # <<<<<<<<<<<<<<
 *                 bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *             if not (flags & bufmode):
*/
    __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_mstate_global->__pyx_n_u_fortran, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(7, 186, __pyx_L1_error)
    if (__pyx_t_1) {

      /* "View.MemoryView":187
 *                 bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *             elif self.mode == u"fortran":
 *                 bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS             # <<<<<<<<<<<<<<
 *             if not (flags & bufmode):
 *                 raise ValueError, "Can only create a buffer that is contiguous in memory."
*/
      __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);

      /* "View.MemoryView":186
 *             if self.mode == u"c":
 *                 bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *             elif self.mode == u"fortran":             # <<<<<<<<<<<<<<
 *                 bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *             if not (flags & bufmode):
*/
    }
    __pyx_L4:;

    /* "View.MemoryView":188
 *             elif self.mode == u"fortran":
 *                 bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *             if not (flags & bufmode):             # <<<<<<<<<<<<<<
 *                 raise ValueError, "Can only create a buffer that is contiguous in memory."
 *         info.buf = self.data
*/
    __pyx_t_1 = (!((__pyx_v_flags & __pyx_v_bufmode) != 0));
    if (unlikely(__pyx_t_1)) {

      /* "View.MemoryView":189
 *                 bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *             if not (flags & bufmode):
 *                 raise ValueError, "Can only create a buffer that is contiguous in memory."             # <<<<<<<<<<<<<<
 *         info.buf = self.data
 *         info.len = self.len
*/
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Can_only_create_a_buffer_that_is, 0, 0);
      __PYX_ERR(7, 189, __pyx_L1_error)

      /* "View.MemoryView":188
 *             elif self.mode == u"fortran":
 *                 bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *             if not (flags & bufmode):             # <<<<<<<<<<<<<<
 *                 raise ValueError, "Can only create a buffer that is contiguous in memory."
 *         info.buf = self.data
*/
    }

    /* "View.MemoryView":183
 *     def __getbuffer__(self, Py_buffer *info, int flags):
 *         cdef int bufmode = -1
 *         if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS):             # <<<<<<<<<<<<<<
 *             if self.mode == u"c":
 *                 bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
*/
  }

  /* "View.MemoryView":190
 *             if not (flags & bufmode):
 *                 raise ValueError, "Can only create a buffer that is contiguous in memory."
 *         info.buf = self.data             # <<<<<<<<<<<<<<
 *         info.len = self.len
 * 
*/
  __pyx_t_2 = __pyx_v_self->data;
  __pyx_v_info->buf = __pyx_t_2;

  /* "View.MemoryView":191
 *                 raise ValueError, "Can only create a buffer that is contiguous in memory."
 *         info.buf = self.data
 *         info.len = self.len             # <<<<<<<<<<<<<<
 * 
 *         if flags & PyBUF_STRIDES:
*/
  __pyx_t_3 = __pyx_v_self->len;
  __pyx_v_info->len = __pyx_t_3;

  /* "View.MemoryView":193
 *         info.len = self.len
 * 
 *         if flags & PyBUF_STRIDES:             # <<<<<<<<<<<<<<
 *             info.ndim = self.ndim
 *             info.shape = self._shape
*/
  __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":194
 * 
 *         if flags & PyBUF_STRIDES:
 *             info.ndim = self.ndim             # <<<<<<<<<<<<<<
 *             info.shape = self._shape
 *             info.strides = self._strides
*/
    __pyx_t_4 = __pyx_v_self->ndim;
    __pyx_v_info->ndim = __pyx_t_4;

    /* "View.MemoryView":195
 *         if flags & PyBUF_STRIDES:
 *             info.ndim = self.ndim
 *             info.shape = self._shape             # <<<<<<<<<<<<<<
 *             info.strides = self._strides
 *         else:
*/
    __pyx_t_5 = __pyx_v_self->_shape;
    __pyx_v_info->shape = __pyx_t_5;

    /* "View.MemoryView":196
 *             info.ndim = self.ndim
 *             info.shape = self._shape
 *             info.strides = self._strides             # <<<<<<<<<<<<<<
 *         else:
 *             info.ndim = 1
*/
    __pyx_t_5 = __pyx_v_self->_strides;
    __pyx_v_info->strides = __pyx_t_5;

    /* "View.MemoryView":193
 *         info.len = self.len
 * 
 *         if flags & PyBUF_STRIDES:             # <<<<<<<<<<<<<<
 *             info.ndim = self.ndim
 *             info.shape = self._shape
*/
    goto __pyx_L6;
  }

  /* "View.MemoryView":198
 *             info.strides = self._strides
 *         else:
 *             info.ndim = 1             # <<<<<<<<<<<<<<
 *             info.shape = &self.len if flags & PyBUF_ND else NULL
 *             info.strides = NULL
*/
  /*else*/ {
    __pyx_v_info->ndim = 1;

    /* "View.MemoryView":199
 *         else:
 *             info.ndim = 1
 *             info.shape = &self.len if flags & PyBUF_ND else NULL             # <<<<<<<<<<<<<<
 *             info.strides = NULL
 * 
*/
    __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0);
    if (__pyx_t_1) {
      __pyx_t_5 = (&__pyx_v_self->len);
    } else {
      __pyx_t_5 = NULL;
    }
    __pyx_v_info->shape = __pyx_t_5;

    /* "View.MemoryView":200
 *             info.ndim = 1
 *             info.shape = &self.len if flags & PyBUF_ND else NULL
 *             info.strides = NULL             # <<<<<<<<<<<<<<
 * 
 *         info.suboffsets = NULL
*/
    __pyx_v_info->strides = NULL;
  }
  __pyx_L6:;

  /* "View.MemoryView":202
 *             info.strides = NULL
 * 
 *         info.suboffsets = NULL             # <<<<<<<<<<<<<<
 *         info.itemsize = self.itemsize
 *         info.readonly = 0
*/
  __pyx_v_info->suboffsets = NULL;

  /* "View.MemoryView":203
 * 
 *         info.suboffsets = NULL
 *         info.itemsize = self.itemsize             # <<<<<<<<<<<<<<
 *         info.readonly = 0
 *         info.format = self.format if flags & PyBUF_FORMAT else NULL
*/
  __pyx_t_3 = __pyx_v_self->itemsize;
  __pyx_v_info->itemsize = __pyx_t_3;

  /* "View.MemoryView":204
 *         info.suboffsets = NULL
 *         info.itemsize = self.itemsize
 *         info.readonly = 0             # <<<<<<<<<<<<<<
 *         info.format = self.format if flags & PyBUF_FORMAT else NULL
 *         info.obj = self
*/
  __pyx_v_info->readonly = 0;

  /* "View.MemoryView":205
 *         info.itemsize = self.itemsize
 *         info.readonly = 0
 *         info.format = self.format if flags & PyBUF_FORMAT else NULL             # <<<<<<<<<<<<<<
 *         info.obj = self
 * 
*/
  __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
  if (__pyx_t_1) {
    __pyx_t_2 = __pyx_v_self->format;
  } else {
    __pyx_t_2 = NULL;
  }
  __pyx_v_info->format = __pyx_t_2;

  /* "View.MemoryView":206
 *         info.readonly = 0
 *         info.format = self.format if flags & PyBUF_FORMAT else NULL
 *         info.obj = self             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(array self):
*/
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_v_self);
  __Pyx_GOTREF(__pyx_v_info->obj);
  __Pyx_DECREF(__pyx_v_info->obj);
  __pyx_v_info->obj = ((PyObject *)__pyx_v_self);

  /* "View.MemoryView":180
 *             _allocate_buffer(self)
 * 
 *     @cname('getbuffer')             # <<<<<<<<<<<<<<
 *     def __getbuffer__(self, Py_buffer *info, int flags):
 *         cdef int bufmode = -1
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  if (__pyx_v_info->obj != NULL) {
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
  }
  goto __pyx_L2;
  __pyx_L0:;
  if (__pyx_v_info->obj == Py_None) {
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
  }
  __pyx_L2:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":208
 *         info.obj = self
 * 
 *     def __dealloc__(array self):             # <<<<<<<<<<<<<<
 *         if self.callback_free_data != NULL:
 *             self.callback_free_data(self.data)
*/

/* Python wrapper */
static void __pyx_array___dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_array___dealloc__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((struct __pyx_array_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self) {
  int __pyx_t_1;
  int __pyx_t_2;

  /* "View.MemoryView":209
 * 
 *     def __dealloc__(array self):
 *         if self.callback_free_data != NULL:             # <<<<<<<<<<<<<<
 *             self.callback_free_data(self.data)
 *         elif self.free_data and self.data is not NULL:
*/
  __pyx_t_1 = (__pyx_v_self->callback_free_data != NULL);
  if (__pyx_t_1) {

    /* "View.MemoryView":210
 *     def __dealloc__(array self):
 *         if self.callback_free_data != NULL:
 *             self.callback_free_data(self.data)             # <<<<<<<<<<<<<<
 *         elif self.free_data and self.data is not NULL:
 *             if self.dtype_is_object:
*/
    __pyx_v_self->callback_free_data(__pyx_v_self->data);

    /* "View.MemoryView":209
 * 
 *     def __dealloc__(array self):
 *         if self.callback_free_data != NULL:             # <<<<<<<<<<<<<<
 *             self.callback_free_data(self.data)
 *         elif self.free_data and self.data is not NULL:
*/
    goto __pyx_L3;
  }

  /* "View.MemoryView":211
 *         if self.callback_free_data != NULL:
 *             self.callback_free_data(self.data)
 *         elif self.free_data and self.data is not NULL:             # <<<<<<<<<<<<<<
 *             if self.dtype_is_object:
 *                 refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False)
*/
  if (__pyx_v_self->free_data) {
  } else {
    __pyx_t_1 = __pyx_v_self->free_data;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_self->data != NULL);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "View.MemoryView":212
 *             self.callback_free_data(self.data)
 *         elif self.free_data and self.data is not NULL:
 *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
 *                 refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False)
 *             free(self.data)
*/
    if (__pyx_v_self->dtype_is_object) {

      /* "View.MemoryView":213
 *         elif self.free_data and self.data is not NULL:
 *             if self.dtype_is_object:
 *                 refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False)             # <<<<<<<<<<<<<<
 *             free(self.data)
 *         PyObject_Free(self._shape)
*/
      __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0);

      /* "View.MemoryView":212
 *             self.callback_free_data(self.data)
 *         elif self.free_data and self.data is not NULL:
 *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
 *                 refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False)
 *             free(self.data)
*/
    }

    /* "View.MemoryView":214
 *             if self.dtype_is_object:
 *                 refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False)
 *             free(self.data)             # <<<<<<<<<<<<<<
 *         PyObject_Free(self._shape)
 * 
*/
    free(__pyx_v_self->data);

    /* "View.MemoryView":211
 *         if self.callback_free_data != NULL:
 *             self.callback_free_data(self.data)
 *         elif self.free_data and self.data is not NULL:             # <<<<<<<<<<<<<<
 *             if self.dtype_is_object:
 *                 refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False)
*/
  }
  __pyx_L3:;

  /* "View.MemoryView":215
 *                 refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False)
 *             free(self.data)
 *         PyObject_Free(self._shape)             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  PyObject_Free(__pyx_v_self->_shape);

  /* "View.MemoryView":208
 *         info.obj = self
 * 
 *     def __dealloc__(array self):             # <<<<<<<<<<<<<<
 *         if self.callback_free_data != NULL:
 *             self.callback_free_data(self.data)
*/

  /* function exit code */
}

/* "View.MemoryView":217
 *         PyObject_Free(self._shape)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def memview(self):
 *         return self.get_memview()
*/

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((struct __pyx_array_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":219
 *     @property
 *     def memview(self):
 *         return self.get_memview()             # <<<<<<<<<<<<<<
 * 
 *     @cname('get_memview')
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 219, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":217
 *         PyObject_Free(self._shape)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def memview(self):
 *         return self.get_memview()
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":221
 *         return self.get_memview()
 * 
 *     @cname('get_memview')             # <<<<<<<<<<<<<<
 *     cdef get_memview(self):
 *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
*/

static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) {
  int __pyx_v_flags;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_memview", 0);

  /* "View.MemoryView":223
 *     @cname('get_memview')
 *     cdef get_memview(self):
 *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE             # <<<<<<<<<<<<<<
 *         return  memoryview(self, flags, self.dtype_is_object)
 * 
*/
  __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE);

  /* "View.MemoryView":224
 *     cdef get_memview(self):
 *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
 *         return  memoryview(self, flags, self.dtype_is_object)             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = NULL;
  __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 224, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 224, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[4] = {__pyx_t_2, ((PyObject *)__pyx_v_self), __pyx_t_3, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_memoryview_type, __pyx_callargs+__pyx_t_5, (4-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 224, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __pyx_r = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":221
 *         return self.get_memview()
 * 
 *     @cname('get_memview')             # <<<<<<<<<<<<<<
 *     cdef get_memview(self):
 *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("View.MemoryView.array.get_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":226
 *         return  memoryview(self, flags, self.dtype_is_object)
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self._shape[0]
 * 
*/

/* Python wrapper */
static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((struct __pyx_array_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self) {
  Py_ssize_t __pyx_r;

  /* "View.MemoryView":227
 * 
 *     def __len__(self):
 *         return self._shape[0]             # <<<<<<<<<<<<<<
 * 
 *     def __getattr__(self, attr):
*/
  __pyx_r = (__pyx_v_self->_shape[0]);
  goto __pyx_L0;

  /* "View.MemoryView":226
 *         return  memoryview(self, flags, self.dtype_is_object)
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self._shape[0]
 * 
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":229
 *         return self._shape[0]
 * 
 *     def __getattr__(self, attr):             # <<<<<<<<<<<<<<
 *         return getattr(self.memview, attr)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr); /*proto*/
static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getattr__", 0);

  /* "View.MemoryView":230
 * 
 *     def __getattr__(self, attr):
 *         return getattr(self.memview, attr)             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, item):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 230, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 230, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":229
 *         return self._shape[0]
 * 
 *     def __getattr__(self, attr):             # <<<<<<<<<<<<<<
 *         return getattr(self.memview, attr)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("View.MemoryView.array.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":232
 *         return getattr(self.memview, attr)
 * 
 *     def __getitem__(self, item):             # <<<<<<<<<<<<<<
 *         return self.memview[item]
 * 
*/

/* Python wrapper */
static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/
static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "View.MemoryView":233
 * 
 *     def __getitem__(self, item):
 *         return self.memview[item]             # <<<<<<<<<<<<<<
 * 
 *     def __setitem__(self, item, value):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 233, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 233, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":232
 *         return getattr(self.memview, attr)
 * 
 *     def __getitem__(self, item):             # <<<<<<<<<<<<<<
 *         return self.memview[item]
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("View.MemoryView.array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":235
 *         return self.memview[item]
 * 
 *     def __setitem__(self, item, value):             # <<<<<<<<<<<<<<
 *         self.memview[item] = value
 * 
*/

/* Python wrapper */
static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /*proto*/
static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setitem__", 0);

  /* "View.MemoryView":236
 * 
 *     def __setitem__(self, item, value):
 *         self.memview[item] = value             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 236, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (unlikely((PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0))) __PYX_ERR(7, 236, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "View.MemoryView":235
 *         return self.memview[item]
 * 
 *     def __setitem__(self, item, value):             # <<<<<<<<<<<<<<
 *         self.memview[item] = value
 * 
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
*/

/* Python wrapper */
static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf___pyx_array___reduce_cython__(((struct __pyx_array_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(7, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/

/* Python wrapper */
static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(7, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(7, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(7, 3, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(7, 3, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(7, 3, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(7, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((struct __pyx_array_obj *)__pyx_v_self), __pyx_v___pyx_state);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(7, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":245
 *         pass
 * 
 * @cname("__pyx_array_allocate_buffer")             # <<<<<<<<<<<<<<
 * cdef int _allocate_buffer(array self) except -1:
 * 
*/

static int __pyx_array_allocate_buffer(struct __pyx_array_obj *__pyx_v_self) {
  Py_ssize_t __pyx_v_i;
  PyObject **__pyx_v_p;
  int __pyx_r;
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "View.MemoryView":252
 *     cdef PyObject **p
 * 
 *     self.free_data = True             # <<<<<<<<<<<<<<
 *     self.data = <char *>malloc(self.len)
 *     if not self.data:
*/
  __pyx_v_self->free_data = 1;

  /* "View.MemoryView":253
 * 
 *     self.free_data = True
 *     self.data = <char *>malloc(self.len)             # <<<<<<<<<<<<<<
 *     if not self.data:
 *         raise MemoryError, "unable to allocate array data."
*/
  __pyx_v_self->data = ((char *)malloc(__pyx_v_self->len));

  /* "View.MemoryView":254
 *     self.free_data = True
 *     self.data = <char *>malloc(self.len)
 *     if not self.data:             # <<<<<<<<<<<<<<
 *         raise MemoryError, "unable to allocate array data."
 * 
*/
  __pyx_t_1 = (!(__pyx_v_self->data != 0));
  if (unlikely(__pyx_t_1)) {

    /* "View.MemoryView":255
 *     self.data = <char *>malloc(self.len)
 *     if not self.data:
 *         raise MemoryError, "unable to allocate array data."             # <<<<<<<<<<<<<<
 * 
 *     if self.dtype_is_object:
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_MemoryError))), __pyx_mstate_global->__pyx_kp_u_unable_to_allocate_array_data, 0, 0);
    __PYX_ERR(7, 255, __pyx_L1_error)

    /* "View.MemoryView":254
 *     self.free_data = True
 *     self.data = <char *>malloc(self.len)
 *     if not self.data:             # <<<<<<<<<<<<<<
 *         raise MemoryError, "unable to allocate array data."
 * 
*/
  }

  /* "View.MemoryView":257
 *         raise MemoryError, "unable to allocate array data."
 * 
 *     if self.dtype_is_object:             # <<<<<<<<<<<<<<
 *         p = <PyObject **> self.data
 *         for i in range(self.len // self.itemsize):
*/
  if (__pyx_v_self->dtype_is_object) {

    /* "View.MemoryView":258
 * 
 *     if self.dtype_is_object:
 *         p = <PyObject **> self.data             # <<<<<<<<<<<<<<
 *         for i in range(self.len // self.itemsize):
 *             p[i] = Py_None
*/
    __pyx_v_p = ((PyObject **)__pyx_v_self->data);

    /* "View.MemoryView":259
 *     if self.dtype_is_object:
 *         p = <PyObject **> self.data
 *         for i in range(self.len // self.itemsize):             # <<<<<<<<<<<<<<
 *             p[i] = Py_None
 *             Py_INCREF(Py_None)
*/
    if (unlikely(__pyx_v_self->itemsize == 0)) {
      PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
      __PYX_ERR(7, 259, __pyx_L1_error)
    }
    else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_self->itemsize == (Py_ssize_t)-1)  && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) {
      PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
      __PYX_ERR(7, 259, __pyx_L1_error)
    }
    __pyx_t_2 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_self->itemsize, 0);
    __pyx_t_3 = __pyx_t_2;
    for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
      __pyx_v_i = __pyx_t_4;

      /* "View.MemoryView":260
 *         p = <PyObject **> self.data
 *         for i in range(self.len // self.itemsize):
 *             p[i] = Py_None             # <<<<<<<<<<<<<<
 *             Py_INCREF(Py_None)
 *     return 0
*/
      (__pyx_v_p[__pyx_v_i]) = Py_None;

      /* "View.MemoryView":261
 *         for i in range(self.len // self.itemsize):
 *             p[i] = Py_None
 *             Py_INCREF(Py_None)             # <<<<<<<<<<<<<<
 *     return 0
 * 
*/
      Py_INCREF(Py_None);
    }

    /* "View.MemoryView":257
 *         raise MemoryError, "unable to allocate array data."
 * 
 *     if self.dtype_is_object:             # <<<<<<<<<<<<<<
 *         p = <PyObject **> self.data
 *         for i in range(self.len // self.itemsize):
*/
  }

  /* "View.MemoryView":262
 *             p[i] = Py_None
 *             Py_INCREF(Py_None)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "View.MemoryView":245
 *         pass
 * 
 * @cname("__pyx_array_allocate_buffer")             # <<<<<<<<<<<<<<
 * cdef int _allocate_buffer(array self) except -1:
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("View.MemoryView._allocate_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":265
 * 
 * 
 * @cname("__pyx_array_new")             # <<<<<<<<<<<<<<
 * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, const char *c_mode, char *buf):
 *     cdef array result
*/

static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, char *__pyx_v_format, char const *__pyx_v_c_mode, char *__pyx_v_buf) {
  struct __pyx_array_obj *__pyx_v_result = 0;
  PyObject *__pyx_v_mode = 0;
  struct __pyx_array_obj *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("array_cwrapper", 0);

  /* "View.MemoryView":268
 * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, const char *c_mode, char *buf):
 *     cdef array result
 *     cdef str mode = "fortran" if c_mode[0] == b'f' else "c"  # this often comes from a constant C string.             # <<<<<<<<<<<<<<
 * 
 *     if buf is NULL:
*/
  __pyx_t_2 = ((__pyx_v_c_mode[0]) == 'f');
  if (__pyx_t_2) {
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_fortran);
    __pyx_t_1 = __pyx_mstate_global->__pyx_n_u_fortran;
  } else {
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_c);
    __pyx_t_1 = __pyx_mstate_global->__pyx_n_u_c;
  }
  __pyx_v_mode = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "View.MemoryView":270
 *     cdef str mode = "fortran" if c_mode[0] == b'f' else "c"  # this often comes from a constant C string.
 * 
 *     if buf is NULL:             # <<<<<<<<<<<<<<
 *         result = array.__new__(array, shape, itemsize, format, mode)
 *     else:
*/
  __pyx_t_2 = (__pyx_v_buf == NULL);
  if (__pyx_t_2) {

    /* "View.MemoryView":271
 * 
 *     if buf is NULL:
 *         result = array.__new__(array, shape, itemsize, format, mode)             # <<<<<<<<<<<<<<
 *     else:
 *         result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False)
*/
    __pyx_t_1 = PyLong_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 271, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 271, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 271, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_shape);
    __Pyx_GIVEREF(__pyx_v_shape);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_shape) != (0)) __PYX_ERR(7, 271, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(7, 271, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_3);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3) != (0)) __PYX_ERR(7, 271, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_mode);
    __Pyx_GIVEREF(__pyx_v_mode);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v_mode) != (0)) __PYX_ERR(7, 271, __pyx_L1_error);
    __pyx_t_1 = 0;
    __pyx_t_3 = 0;
    __pyx_t_3 = ((PyObject *)__pyx_tp_new_array(((PyTypeObject *)__pyx_mstate_global->__pyx_array_type), __pyx_t_4, NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 271, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "View.MemoryView":270
 *     cdef str mode = "fortran" if c_mode[0] == b'f' else "c"  # this often comes from a constant C string.
 * 
 *     if buf is NULL:             # <<<<<<<<<<<<<<
 *         result = array.__new__(array, shape, itemsize, format, mode)
 *     else:
*/
    goto __pyx_L3;
  }

  /* "View.MemoryView":273
 *         result = array.__new__(array, shape, itemsize, format, mode)
 *     else:
 *         result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False)             # <<<<<<<<<<<<<<
 *         result.data = buf
 * 
*/
  /*else*/ {
    __pyx_t_3 = PyLong_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 273, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 273, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 273, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v_shape);
    __Pyx_GIVEREF(__pyx_v_shape);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_shape) != (0)) __PYX_ERR(7, 273, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_3);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3) != (0)) __PYX_ERR(7, 273, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_4);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_4) != (0)) __PYX_ERR(7, 273, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_mode);
    __Pyx_GIVEREF(__pyx_v_mode);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_mode) != (0)) __PYX_ERR(7, 273, __pyx_L1_error);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 273, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_allocate_buffer, Py_False) < (0)) __PYX_ERR(7, 273, __pyx_L1_error)
    __pyx_t_3 = ((PyObject *)__pyx_tp_new_array(((PyTypeObject *)__pyx_mstate_global->__pyx_array_type), __pyx_t_1, __pyx_t_4)); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 273, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "View.MemoryView":274
 *     else:
 *         result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False)
 *         result.data = buf             # <<<<<<<<<<<<<<
 * 
 *     return result
*/
    __pyx_v_result->data = __pyx_v_buf;
  }
  __pyx_L3:;

  /* "View.MemoryView":276
 *         result.data = buf
 * 
 *     return result             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "View.MemoryView":265
 * 
 * 
 * @cname("__pyx_array_new")             # <<<<<<<<<<<<<<
 * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, const char *c_mode, char *buf):
 *     cdef array result
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_mode);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":302
 * cdef class Enum(object):
 *     cdef object name
 *     def __init__(self, name):             # <<<<<<<<<<<<<<
 *         self.name = name
 *     def __repr__(self):
*/

/* Python wrapper */
static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_name,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(7, 302, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(7, 302, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(7, 302, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, i); __PYX_ERR(7, 302, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(7, 302, __pyx_L3_error)
    }
    __pyx_v_name = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, __pyx_nargs); __PYX_ERR(7, 302, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "View.MemoryView":303
 *     cdef object name
 *     def __init__(self, name):
 *         self.name = name             # <<<<<<<<<<<<<<
 *     def __repr__(self):
 *         return self.name
*/
  __Pyx_INCREF(__pyx_v_name);
  __Pyx_GIVEREF(__pyx_v_name);
  __Pyx_GOTREF(__pyx_v_self->name);
  __Pyx_DECREF(__pyx_v_self->name);
  __pyx_v_self->name = __pyx_v_name;

  /* "View.MemoryView":302
 * cdef class Enum(object):
 *     cdef object name
 *     def __init__(self, name):             # <<<<<<<<<<<<<<
 *         self.name = name
 *     def __repr__(self):
*/

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":304
 *     def __init__(self, name):
 *         self.name = name
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return self.name
 * 
*/

/* Python wrapper */
static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "View.MemoryView":305
 *         self.name = name
 *     def __repr__(self):
 *         return self.name             # <<<<<<<<<<<<<<
 * 
 * cdef generic = Enum("<strided and direct or indirect>")
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->name);
  __pyx_r = __pyx_v_self->name;
  goto __pyx_L0;

  /* "View.MemoryView":304
 *     def __init__(self, name):
 *         self.name = name
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return self.name
 * 
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
*/

/* Python wrapper */
static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf___pyx_MemviewEnum___reduce_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self.name,)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None and _dict:
*/
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_self->name);
  __Pyx_GIVEREF(__pyx_v_self->name);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __pyx_v_state = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self.name,)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None and _dict:
 *         state += (_dict,)
*/
  __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__dict = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":7
 *     state = (self.name,)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None and _dict:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
*/
  __pyx_t_3 = (__pyx_v__dict != Py_None);
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v__dict); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(7, 7, __pyx_L1_error)
  __pyx_t_2 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None and _dict:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
*/
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict) != (0)) __PYX_ERR(7, 8, __pyx_L1_error);
    __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "(tree fragment)":9
 *     if _dict is not None and _dict:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = self.name is not None
*/
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = (self.name,)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None and _dict:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
*/
    goto __pyx_L3;
  }

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = self.name is not None             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state
*/
  /*else*/ {
    __pyx_t_2 = (__pyx_v_self->name != Py_None);
    __pyx_v_use_setstate = __pyx_t_2;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.name is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state
 *     else:
*/
  if (__pyx_v_use_setstate) {

    /* "(tree fragment)":13
 *         use_setstate = self.name is not None
 *     if use_setstate:
 *         return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_Enum, (type(self), 0x82a3537, state)
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Enum); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(7, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_136983863);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_136983863);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_136983863) != (0)) __PYX_ERR(7, 13, __pyx_L1_error);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None) != (0)) __PYX_ERR(7, 13, __pyx_L1_error);
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4) != (0)) __PYX_ERR(7, 13, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1) != (0)) __PYX_ERR(7, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state) != (0)) __PYX_ERR(7, 13, __pyx_L1_error);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.name is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state
 *     else:
*/
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state
 *     else:
 *         return __pyx_unpickle_Enum, (type(self), 0x82a3537, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_Enum__set_state(self, __pyx_state)
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Enum); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(7, 15, __pyx_L1_error);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_136983863);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_136983863);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_136983863) != (0)) __PYX_ERR(7, 15, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state) != (0)) __PYX_ERR(7, 15, __pyx_L1_error);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5) != (0)) __PYX_ERR(7, 15, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(7, 15, __pyx_L1_error);
    __pyx_t_5 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_Enum, (type(self), 0x82a3537, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_Enum__set_state(self, __pyx_state)
*/

/* Python wrapper */
static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(7, 16, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(7, 16, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(7, 16, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(7, 16, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(7, 16, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(7, 16, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v___pyx_state);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_Enum, (type(self), 0x82a3537, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_Enum__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
*/
  __pyx_t_1 = __pyx_v___pyx_state;
  __Pyx_INCREF(__pyx_t_1);
  if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_1))) __PYX_ERR(7, 17, __pyx_L1_error)
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "cannot pass None into a C function argument that is declared 'not None'");
    __PYX_ERR(7, 17, __pyx_L1_error)
  }
  __pyx_t_2 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_Enum, (type(self), 0x82a3537, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_Enum__set_state(self, __pyx_state)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":348
 *     cdef const __Pyx_TypeInfo *typeinfo
 * 
 *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):             # <<<<<<<<<<<<<<
 *         self.obj = obj
 *         self.flags = flags
*/

/* Python wrapper */
static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_obj = 0;
  int __pyx_v_flags;
  int __pyx_v_dtype_is_object;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_obj,&__pyx_mstate_global->__pyx_n_u_flags,&__pyx_mstate_global->__pyx_n_u_dtype_is_object,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(7, 348, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(7, 348, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(7, 348, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(7, 348, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__cinit__", 0) < (0)) __PYX_ERR(7, 348, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, i); __PYX_ERR(7, 348, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(7, 348, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(7, 348, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(7, 348, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_obj = values[0];
    __pyx_v_flags = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(7, 348, __pyx_L3_error)
    if (values[2]) {
      __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_dtype_is_object == (int)-1) && PyErr_Occurred())) __PYX_ERR(7, 348, __pyx_L3_error)
    } else {
      __pyx_v_dtype_is_object = ((int)0);
    }
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, __pyx_nargs); __PYX_ERR(7, 348, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_obj, __pyx_v_flags, __pyx_v_dtype_is_object);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  Py_intptr_t __pyx_t_4;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "View.MemoryView":349
 * 
 *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):
 *         self.obj = obj             # <<<<<<<<<<<<<<
 *         self.flags = flags
 *         if type(self) is memoryview or obj is not None:
*/
  __Pyx_INCREF(__pyx_v_obj);
  __Pyx_GIVEREF(__pyx_v_obj);
  __Pyx_GOTREF(__pyx_v_self->obj);
  __Pyx_DECREF(__pyx_v_self->obj);
  __pyx_v_self->obj = __pyx_v_obj;

  /* "View.MemoryView":350
 *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):
 *         self.obj = obj
 *         self.flags = flags             # <<<<<<<<<<<<<<
 *         if type(self) is memoryview or obj is not None:
 *             PyObject_GetBuffer(obj, &self.view, flags)
*/
  __pyx_v_self->flags = __pyx_v_flags;

  /* "View.MemoryView":351
 *         self.obj = obj
 *         self.flags = flags
 *         if type(self) is memoryview or obj is not None:             # <<<<<<<<<<<<<<
 *             PyObject_GetBuffer(obj, &self.view, flags)
 *             if <PyObject *> self.view.obj == NULL:
*/
  __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_mstate_global->__pyx_memoryview_type));
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_obj != Py_None);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "View.MemoryView":352
 *         self.flags = flags
 *         if type(self) is memoryview or obj is not None:
 *             PyObject_GetBuffer(obj, &self.view, flags)             # <<<<<<<<<<<<<<
 *             if <PyObject *> self.view.obj == NULL:
 *                 (<__pyx_buffer *> &self.view).obj = Py_None
*/
    __pyx_t_3 = PyObject_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(7, 352, __pyx_L1_error)

    /* "View.MemoryView":353
 *         if type(self) is memoryview or obj is not None:
 *             PyObject_GetBuffer(obj, &self.view, flags)
 *             if <PyObject *> self.view.obj == NULL:             # <<<<<<<<<<<<<<
 *                 (<__pyx_buffer *> &self.view).obj = Py_None
 *                 Py_INCREF(Py_None)
*/
    __pyx_t_1 = (((PyObject *)__pyx_v_self->view.obj) == NULL);
    if (__pyx_t_1) {

      /* "View.MemoryView":354
 *             PyObject_GetBuffer(obj, &self.view, flags)
 *             if <PyObject *> self.view.obj == NULL:
 *                 (<__pyx_buffer *> &self.view).obj = Py_None             # <<<<<<<<<<<<<<
 *                 Py_INCREF(Py_None)
 * 
*/
      ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None;

      /* "View.MemoryView":355
 *             if <PyObject *> self.view.obj == NULL:
 *                 (<__pyx_buffer *> &self.view).obj = Py_None
 *                 Py_INCREF(Py_None)             # <<<<<<<<<<<<<<
 * 
 *         if not __PYX_CYTHON_ATOMICS_ENABLED():
*/
      Py_INCREF(Py_None);

      /* "View.MemoryView":353
 *         if type(self) is memoryview or obj is not None:
 *             PyObject_GetBuffer(obj, &self.view, flags)
 *             if <PyObject *> self.view.obj == NULL:             # <<<<<<<<<<<<<<
 *                 (<__pyx_buffer *> &self.view).obj = Py_None
 *                 Py_INCREF(Py_None)
*/
    }

    /* "View.MemoryView":351
 *         self.obj = obj
 *         self.flags = flags
 *         if type(self) is memoryview or obj is not None:             # <<<<<<<<<<<<<<
 *             PyObject_GetBuffer(obj, &self.view, flags)
 *             if <PyObject *> self.view.obj == NULL:
*/
  }

  /* "View.MemoryView":357
 *                 Py_INCREF(Py_None)
 * 
 *         if not __PYX_CYTHON_ATOMICS_ENABLED():             # <<<<<<<<<<<<<<
 *             global __pyx_memoryview_thread_locks_used
 *             if (__pyx_memoryview_thread_locks_used < 8 and
*/
  __pyx_t_1 = (!__PYX_CYTHON_ATOMICS_ENABLED());
  if (__pyx_t_1) {

    /* "View.MemoryView":359
 *         if not __PYX_CYTHON_ATOMICS_ENABLED():
 *             global __pyx_memoryview_thread_locks_used
 *             if (__pyx_memoryview_thread_locks_used < 8 and             # <<<<<<<<<<<<<<
 * 
 *                     not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()):
*/
    __pyx_t_2 = (__pyx_memoryview_thread_locks_used < 8);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L9_bool_binop_done;
    }

    /* "View.MemoryView":361
 *             if (__pyx_memoryview_thread_locks_used < 8 and
 * 
 *                     not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()):             # <<<<<<<<<<<<<<
 *                 self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
 *                 __pyx_memoryview_thread_locks_used += 1
*/
    __pyx_t_2 = (!__PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING());
    __pyx_t_1 = __pyx_t_2;
    __pyx_L9_bool_binop_done:;

    /* "View.MemoryView":359
 *         if not __PYX_CYTHON_ATOMICS_ENABLED():
 *             global __pyx_memoryview_thread_locks_used
 *             if (__pyx_memoryview_thread_locks_used < 8 and             # <<<<<<<<<<<<<<
 * 
 *                     not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()):
*/
    if (__pyx_t_1) {

      /* "View.MemoryView":362
 * 
 *                     not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()):
 *                 self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]             # <<<<<<<<<<<<<<
 *                 __pyx_memoryview_thread_locks_used += 1
 *             if self.lock is NULL:
*/
      __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);

      /* "View.MemoryView":363
 *                     not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()):
 *                 self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
 *                 __pyx_memoryview_thread_locks_used += 1             # <<<<<<<<<<<<<<
 *             if self.lock is NULL:
 *                 self.lock = PyThread_allocate_lock()
*/
      __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1);

      /* "View.MemoryView":359
 *         if not __PYX_CYTHON_ATOMICS_ENABLED():
 *             global __pyx_memoryview_thread_locks_used
 *             if (__pyx_memoryview_thread_locks_used < 8 and             # <<<<<<<<<<<<<<
 * 
 *                     not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()):
*/
    }

    /* "View.MemoryView":364
 *                 self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
 *                 __pyx_memoryview_thread_locks_used += 1
 *             if self.lock is NULL:             # <<<<<<<<<<<<<<
 *                 self.lock = PyThread_allocate_lock()
 *                 if self.lock is NULL:
*/
    __pyx_t_1 = (__pyx_v_self->lock == NULL);
    if (__pyx_t_1) {

      /* "View.MemoryView":365
 *                 __pyx_memoryview_thread_locks_used += 1
 *             if self.lock is NULL:
 *                 self.lock = PyThread_allocate_lock()             # <<<<<<<<<<<<<<
 *                 if self.lock is NULL:
 *                     raise MemoryError
*/
      __pyx_v_self->lock = PyThread_allocate_lock();

      /* "View.MemoryView":366
 *             if self.lock is NULL:
 *                 self.lock = PyThread_allocate_lock()
 *                 if self.lock is NULL:             # <<<<<<<<<<<<<<
 *                     raise MemoryError
 * 
*/
      __pyx_t_1 = (__pyx_v_self->lock == NULL);
      if (unlikely(__pyx_t_1)) {

        /* "View.MemoryView":367
 *                 self.lock = PyThread_allocate_lock()
 *                 if self.lock is NULL:
 *                     raise MemoryError             # <<<<<<<<<<<<<<
 * 
 *         if flags & PyBUF_FORMAT:
*/
        PyErr_NoMemory(); __PYX_ERR(7, 367, __pyx_L1_error)

        /* "View.MemoryView":366
 *             if self.lock is NULL:
 *                 self.lock = PyThread_allocate_lock()
 *                 if self.lock is NULL:             # <<<<<<<<<<<<<<
 *                     raise MemoryError
 * 
*/
      }

      /* "View.MemoryView":364
 *                 self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
 *                 __pyx_memoryview_thread_locks_used += 1
 *             if self.lock is NULL:             # <<<<<<<<<<<<<<
 *                 self.lock = PyThread_allocate_lock()
 *                 if self.lock is NULL:
*/
    }

    /* "View.MemoryView":357
 *                 Py_INCREF(Py_None)
 * 
 *         if not __PYX_CYTHON_ATOMICS_ENABLED():             # <<<<<<<<<<<<<<
 *             global __pyx_memoryview_thread_locks_used
 *             if (__pyx_memoryview_thread_locks_used < 8 and
*/
  }

  /* "View.MemoryView":369
 *                     raise MemoryError
 * 
 *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
 *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
 *         else:
*/
  __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":370
 * 
 *         if flags & PyBUF_FORMAT:
 *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')             # <<<<<<<<<<<<<<
 *         else:
 *             self.dtype_is_object = dtype_is_object
*/
    __pyx_t_2 = ((__pyx_v_self->view.format[0]) == 'O');
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L14_bool_binop_done;
    }
    __pyx_t_2 = ((__pyx_v_self->view.format[1]) == '\x00');
    __pyx_t_1 = __pyx_t_2;
    __pyx_L14_bool_binop_done:;
    __pyx_v_self->dtype_is_object = __pyx_t_1;

    /* "View.MemoryView":369
 *                     raise MemoryError
 * 
 *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
 *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
 *         else:
*/
    goto __pyx_L13;
  }

  /* "View.MemoryView":372
 *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
 *         else:
 *             self.dtype_is_object = dtype_is_object             # <<<<<<<<<<<<<<
 * 
 *         assert <Py_intptr_t><void*>(&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0
*/
  /*else*/ {
    __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object;
  }
  __pyx_L13:;

  /* "View.MemoryView":374
 *             self.dtype_is_object = dtype_is_object
 * 
 *         assert <Py_intptr_t><void*>(&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0             # <<<<<<<<<<<<<<
 *         self.typeinfo = NULL
 * 
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_4 = ((Py_intptr_t)((void *)(&__pyx_v_self->acquisition_count)));
    __pyx_t_5 = (sizeof(__pyx_atomic_int_type));
    if (unlikely(__pyx_t_5 == 0)) {
      PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
      __PYX_ERR(7, 374, __pyx_L1_error)
    }
    __pyx_t_1 = ((__pyx_t_4 % __pyx_t_5) == 0);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
      __PYX_ERR(7, 374, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(7, 374, __pyx_L1_error)
  #endif

  /* "View.MemoryView":375
 * 
 *         assert <Py_intptr_t><void*>(&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0
 *         self.typeinfo = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(memoryview self):
*/
  __pyx_v_self->typeinfo = NULL;

  /* "View.MemoryView":348
 *     cdef const __Pyx_TypeInfo *typeinfo
 * 
 *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):             # <<<<<<<<<<<<<<
 *         self.obj = obj
 *         self.flags = flags
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":377
 *         self.typeinfo = NULL
 * 
 *     def __dealloc__(memoryview self):             # <<<<<<<<<<<<<<
 *         if self.obj is not None:
 *             PyBuffer_Release(&self.view)
*/

/* Python wrapper */
static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) {
  int __pyx_v_i;
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  PyThread_type_lock __pyx_t_5;
  PyThread_type_lock __pyx_t_6;

  /* "View.MemoryView":378
 * 
 *     def __dealloc__(memoryview self):
 *         if self.obj is not None:             # <<<<<<<<<<<<<<
 *             PyBuffer_Release(&self.view)
 *         elif (<__pyx_buffer *> &self.view).obj == Py_None:
*/
  __pyx_t_1 = (__pyx_v_self->obj != Py_None);
  if (__pyx_t_1) {

    /* "View.MemoryView":379
 *     def __dealloc__(memoryview self):
 *         if self.obj is not None:
 *             PyBuffer_Release(&self.view)             # <<<<<<<<<<<<<<
 *         elif (<__pyx_buffer *> &self.view).obj == Py_None:
 * 
*/
    PyBuffer_Release((&__pyx_v_self->view));

    /* "View.MemoryView":378
 * 
 *     def __dealloc__(memoryview self):
 *         if self.obj is not None:             # <<<<<<<<<<<<<<
 *             PyBuffer_Release(&self.view)
 *         elif (<__pyx_buffer *> &self.view).obj == Py_None:
*/
    goto __pyx_L3;
  }

  /* "View.MemoryView":380
 *         if self.obj is not None:
 *             PyBuffer_Release(&self.view)
 *         elif (<__pyx_buffer *> &self.view).obj == Py_None:             # <<<<<<<<<<<<<<
 * 
 *             (<__pyx_buffer *> &self.view).obj = NULL
*/
  __pyx_t_1 = (((Py_buffer *)(&__pyx_v_self->view))->obj == Py_None);
  if (__pyx_t_1) {

    /* "View.MemoryView":382
 *         elif (<__pyx_buffer *> &self.view).obj == Py_None:
 * 
 *             (<__pyx_buffer *> &self.view).obj = NULL             # <<<<<<<<<<<<<<
 *             Py_DECREF(Py_None)
 * 
*/
    ((Py_buffer *)(&__pyx_v_self->view))->obj = NULL;

    /* "View.MemoryView":383
 * 
 *             (<__pyx_buffer *> &self.view).obj = NULL
 *             Py_DECREF(Py_None)             # <<<<<<<<<<<<<<
 * 
 *         cdef int i
*/
    Py_DECREF(Py_None);

    /* "View.MemoryView":380
 *         if self.obj is not None:
 *             PyBuffer_Release(&self.view)
 *         elif (<__pyx_buffer *> &self.view).obj == Py_None:             # <<<<<<<<<<<<<<
 * 
 *             (<__pyx_buffer *> &self.view).obj = NULL
*/
  }
  __pyx_L3:;

  /* "View.MemoryView":387
 *         cdef int i
 *         global __pyx_memoryview_thread_locks_used
 *         if self.lock != NULL:             # <<<<<<<<<<<<<<
 *             for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used):
 *                 if __pyx_memoryview_thread_locks[i] is self.lock:
*/
  __pyx_t_1 = (__pyx_v_self->lock != NULL);
  if (__pyx_t_1) {

    /* "View.MemoryView":388
 *         global __pyx_memoryview_thread_locks_used
 *         if self.lock != NULL:
 *             for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used):             # <<<<<<<<<<<<<<
 *                 if __pyx_memoryview_thread_locks[i] is self.lock:
 *                     __pyx_memoryview_thread_locks_used -= 1
*/
    __pyx_t_1 = __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING();
    if (__pyx_t_1) {
      __pyx_t_2 = 0;
    } else {
      __pyx_t_2 = __pyx_memoryview_thread_locks_used;
    }
    __pyx_t_3 = __pyx_t_2;
    for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
      __pyx_v_i = __pyx_t_4;

      /* "View.MemoryView":389
 *         if self.lock != NULL:
 *             for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used):
 *                 if __pyx_memoryview_thread_locks[i] is self.lock:             # <<<<<<<<<<<<<<
 *                     __pyx_memoryview_thread_locks_used -= 1
 *                     if i != __pyx_memoryview_thread_locks_used:
*/
      __pyx_t_1 = ((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock);
      if (__pyx_t_1) {

        /* "View.MemoryView":390
 *             for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used):
 *                 if __pyx_memoryview_thread_locks[i] is self.lock:
 *                     __pyx_memoryview_thread_locks_used -= 1             # <<<<<<<<<<<<<<
 *                     if i != __pyx_memoryview_thread_locks_used:
 *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
*/
        __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1);

        /* "View.MemoryView":391
 *                 if __pyx_memoryview_thread_locks[i] is self.lock:
 *                     __pyx_memoryview_thread_locks_used -= 1
 *                     if i != __pyx_memoryview_thread_locks_used:             # <<<<<<<<<<<<<<
 *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
 *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
*/
        __pyx_t_1 = (__pyx_v_i != __pyx_memoryview_thread_locks_used);
        if (__pyx_t_1) {

          /* "View.MemoryView":393
 *                     if i != __pyx_memoryview_thread_locks_used:
 *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
 *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])             # <<<<<<<<<<<<<<
 *                     break
 *             else:
*/
          __pyx_t_5 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
          __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_v_i]);

          /* "View.MemoryView":392
 *                     __pyx_memoryview_thread_locks_used -= 1
 *                     if i != __pyx_memoryview_thread_locks_used:
 *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (             # <<<<<<<<<<<<<<
 *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
 *                     break
*/
          (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_5;
          (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_6;

          /* "View.MemoryView":391
 *                 if __pyx_memoryview_thread_locks[i] is self.lock:
 *                     __pyx_memoryview_thread_locks_used -= 1
 *                     if i != __pyx_memoryview_thread_locks_used:             # <<<<<<<<<<<<<<
 *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
 *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
*/
        }

        /* "View.MemoryView":394
 *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
 *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
 *                     break             # <<<<<<<<<<<<<<
 *             else:
 *                 PyThread_free_lock(self.lock)
*/
        goto __pyx_L6_break;

        /* "View.MemoryView":389
 *         if self.lock != NULL:
 *             for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used):
 *                 if __pyx_memoryview_thread_locks[i] is self.lock:             # <<<<<<<<<<<<<<
 *                     __pyx_memoryview_thread_locks_used -= 1
 *                     if i != __pyx_memoryview_thread_locks_used:
*/
      }
    }
    /*else*/ {

      /* "View.MemoryView":396
 *                     break
 *             else:
 *                 PyThread_free_lock(self.lock)             # <<<<<<<<<<<<<<
 * 
 *     cdef char *get_item_pointer(memoryview self, object index) except NULL:
*/
      PyThread_free_lock(__pyx_v_self->lock);
    }
    __pyx_L6_break:;

    /* "View.MemoryView":387
 *         cdef int i
 *         global __pyx_memoryview_thread_locks_used
 *         if self.lock != NULL:             # <<<<<<<<<<<<<<
 *             for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used):
 *                 if __pyx_memoryview_thread_locks[i] is self.lock:
*/
  }

  /* "View.MemoryView":377
 *         self.typeinfo = NULL
 * 
 *     def __dealloc__(memoryview self):             # <<<<<<<<<<<<<<
 *         if self.obj is not None:
 *             PyBuffer_Release(&self.view)
*/

  /* function exit code */
}

/* "View.MemoryView":398
 *                 PyThread_free_lock(self.lock)
 * 
 *     cdef char *get_item_pointer(memoryview self, object index) except NULL:             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t dim
 *         cdef char *itemp = <char *> self.view.buf
*/

static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
  Py_ssize_t __pyx_v_dim;
  char *__pyx_v_itemp;
  PyObject *__pyx_v_idx = NULL;
  char *__pyx_r;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  char *__pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_item_pointer", 0);

  /* "View.MemoryView":400
 *     cdef char *get_item_pointer(memoryview self, object index) except NULL:
 *         cdef Py_ssize_t dim
 *         cdef char *itemp = <char *> self.view.buf             # <<<<<<<<<<<<<<
 * 
 *         for dim, idx in enumerate(index):
*/
  __pyx_v_itemp = ((char *)__pyx_v_self->view.buf);

  /* "View.MemoryView":402
 *         cdef char *itemp = <char *> self.view.buf
 * 
 *         for dim, idx in enumerate(index):             # <<<<<<<<<<<<<<
 *             itemp = pybuffer_index(&self.view, itemp, idx, dim)
 * 
*/
  __pyx_t_1 = 0;
  if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) {
    __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 402, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 402, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(7, 402, __pyx_L1_error)
          #endif
          if (__pyx_t_3 >= __pyx_temp) break;
        }
        __pyx_t_5 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_3, __Pyx_ReferenceSharing_OwnStrongReference);
        ++__pyx_t_3;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(7, 402, __pyx_L1_error)
          #endif
          if (__pyx_t_3 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3));
        #else
        __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3);
        #endif
        ++__pyx_t_3;
      }
      if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 402, __pyx_L1_error)
    } else {
      __pyx_t_5 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_5)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(7, 402, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_v_dim = __pyx_t_1;
    __pyx_t_1 = (__pyx_t_1 + 1);

    /* "View.MemoryView":403
 * 
 *         for dim, idx in enumerate(index):
 *             itemp = pybuffer_index(&self.view, itemp, idx, dim)             # <<<<<<<<<<<<<<
 * 
 *         return itemp
*/
    __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(7, 403, __pyx_L1_error)
    __pyx_t_7 = __pyx_pybuffer_index((&__pyx_v_self->view), __pyx_v_itemp, __pyx_t_6, __pyx_v_dim); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(7, 403, __pyx_L1_error)
    __pyx_v_itemp = __pyx_t_7;

    /* "View.MemoryView":402
 *         cdef char *itemp = <char *> self.view.buf
 * 
 *         for dim, idx in enumerate(index):             # <<<<<<<<<<<<<<
 *             itemp = pybuffer_index(&self.view, itemp, idx, dim)
 * 
*/
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "View.MemoryView":405
 *             itemp = pybuffer_index(&self.view, itemp, idx, dim)
 * 
 *         return itemp             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = __pyx_v_itemp;
  goto __pyx_L0;

  /* "View.MemoryView":398
 *                 PyThread_free_lock(self.lock)
 * 
 *     cdef char *get_item_pointer(memoryview self, object index) except NULL:             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t dim
 *         cdef char *itemp = <char *> self.view.buf
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_idx);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":408
 * 
 * 
 *     def __getitem__(memoryview self, object index):             # <<<<<<<<<<<<<<
 *         if index is Ellipsis:
 *             return self
*/

/* Python wrapper */
static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/
static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
  PyObject *__pyx_v_have_slices = NULL;
  PyObject *__pyx_v_indices = NULL;
  char *__pyx_v_itemp;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  char *__pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "View.MemoryView":409
 * 
 *     def __getitem__(memoryview self, object index):
 *         if index is Ellipsis:             # <<<<<<<<<<<<<<
 *             return self
 * 
*/
  __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis);
  if (__pyx_t_1) {

    /* "View.MemoryView":410
 *     def __getitem__(memoryview self, object index):
 *         if index is Ellipsis:
 *             return self             # <<<<<<<<<<<<<<
 * 
 *         have_slices, indices = _unellipsify(index, self.view.ndim)
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF((PyObject *)__pyx_v_self);
    __pyx_r = ((PyObject *)__pyx_v_self);
    goto __pyx_L0;

    /* "View.MemoryView":409
 * 
 *     def __getitem__(memoryview self, object index):
 *         if index is Ellipsis:             # <<<<<<<<<<<<<<
 *             return self
 * 
*/
  }

  /* "View.MemoryView":412
 *             return self
 * 
 *         have_slices, indices = _unellipsify(index, self.view.ndim)             # <<<<<<<<<<<<<<
 * 
 *         cdef char *itemp
*/
  __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 412, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (likely(__pyx_t_2 != Py_None)) {
    PyObject* sequence = __pyx_t_2;
    Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(7, 412, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 412, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 412, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(7, 412, __pyx_L1_error)
  }
  __pyx_v_have_slices = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_indices = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "View.MemoryView":415
 * 
 *         cdef char *itemp
 *         if have_slices:             # <<<<<<<<<<<<<<
 *             return memview_slice(self, indices)
 *         else:
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(7, 415, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "View.MemoryView":416
 *         cdef char *itemp
 *         if have_slices:
 *             return memview_slice(self, indices)             # <<<<<<<<<<<<<<
 *         else:
 *             itemp = self.get_item_pointer(indices)
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 416, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "View.MemoryView":415
 * 
 *         cdef char *itemp
 *         if have_slices:             # <<<<<<<<<<<<<<
 *             return memview_slice(self, indices)
 *         else:
*/
  }

  /* "View.MemoryView":418
 *             return memview_slice(self, indices)
 *         else:
 *             itemp = self.get_item_pointer(indices)             # <<<<<<<<<<<<<<
 *             return self.convert_item_to_object(itemp)
 * 
*/
  /*else*/ {
    __pyx_t_5 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_5 == ((void *)NULL))) __PYX_ERR(7, 418, __pyx_L1_error)
    __pyx_v_itemp = __pyx_t_5;

    /* "View.MemoryView":419
 *         else:
 *             itemp = self.get_item_pointer(indices)
 *             return self.convert_item_to_object(itemp)             # <<<<<<<<<<<<<<
 * 
 *     def __setitem__(memoryview self, object index, object value):
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 419, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "View.MemoryView":408
 * 
 * 
 *     def __getitem__(memoryview self, object index):             # <<<<<<<<<<<<<<
 *         if index is Ellipsis:
 *             return self
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_have_slices);
  __Pyx_XDECREF(__pyx_v_indices);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":421
 *             return self.convert_item_to_object(itemp)
 * 
 *     def __setitem__(memoryview self, object index, object value):             # <<<<<<<<<<<<<<
 *         if self.view.readonly:
 *             raise TypeError, "Cannot assign to read-only memoryview"
*/

/* Python wrapper */
static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/
static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
  PyObject *__pyx_v_have_slices = NULL;
  PyObject *__pyx_v_obj = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setitem__", 0);
  __Pyx_INCREF(__pyx_v_index);

  /* "View.MemoryView":422
 * 
 *     def __setitem__(memoryview self, object index, object value):
 *         if self.view.readonly:             # <<<<<<<<<<<<<<
 *             raise TypeError, "Cannot assign to read-only memoryview"
 * 
*/
  if (unlikely(__pyx_v_self->view.readonly)) {

    /* "View.MemoryView":423
 *     def __setitem__(memoryview self, object index, object value):
 *         if self.view.readonly:
 *             raise TypeError, "Cannot assign to read-only memoryview"             # <<<<<<<<<<<<<<
 * 
 *         have_slices, index = _unellipsify(index, self.view.ndim)
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_Cannot_assign_to_read_only_memor, 0, 0);
    __PYX_ERR(7, 423, __pyx_L1_error)

    /* "View.MemoryView":422
 * 
 *     def __setitem__(memoryview self, object index, object value):
 *         if self.view.readonly:             # <<<<<<<<<<<<<<
 *             raise TypeError, "Cannot assign to read-only memoryview"
 * 
*/
  }

  /* "View.MemoryView":425
 *             raise TypeError, "Cannot assign to read-only memoryview"
 * 
 *         have_slices, index = _unellipsify(index, self.view.ndim)             # <<<<<<<<<<<<<<
 * 
 *         if have_slices:
*/
  __pyx_t_1 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 425, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(__pyx_t_1 != Py_None)) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(7, 425, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 425, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 425, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(7, 425, __pyx_L1_error)
  }
  __pyx_v_have_slices = __pyx_t_2;
  __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "View.MemoryView":427
 *         have_slices, index = _unellipsify(index, self.view.ndim)
 * 
 *         if have_slices:             # <<<<<<<<<<<<<<
 *             obj = self.is_slice(value)
 *             if obj is not None:
*/
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(7, 427, __pyx_L1_error)
  if (__pyx_t_4) {

    /* "View.MemoryView":428
 * 
 *         if have_slices:
 *             obj = self.is_slice(value)             # <<<<<<<<<<<<<<
 *             if obj is not None:
 *                 self.setitem_slice_assignment(self[index], obj)
*/
    __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->is_slice(__pyx_v_self, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 428, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_obj = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "View.MemoryView":429
 *         if have_slices:
 *             obj = self.is_slice(value)
 *             if obj is not None:             # <<<<<<<<<<<<<<
 *                 self.setitem_slice_assignment(self[index], obj)
 *             else:
*/
    __pyx_t_4 = (__pyx_v_obj != Py_None);
    if (__pyx_t_4) {

      /* "View.MemoryView":430
 *             obj = self.is_slice(value)
 *             if obj is not None:
 *                 self.setitem_slice_assignment(self[index], obj)             # <<<<<<<<<<<<<<
 *             else:
 *                 self.setitem_slice_assign_scalar(self[index], value)
*/
      __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 430, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_1, __pyx_v_obj); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 430, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "View.MemoryView":429
 *         if have_slices:
 *             obj = self.is_slice(value)
 *             if obj is not None:             # <<<<<<<<<<<<<<
 *                 self.setitem_slice_assignment(self[index], obj)
 *             else:
*/
      goto __pyx_L5;
    }

    /* "View.MemoryView":432
 *                 self.setitem_slice_assignment(self[index], obj)
 *             else:
 *                 self.setitem_slice_assign_scalar(self[index], value)             # <<<<<<<<<<<<<<
 *         else:
 *             self.setitem_indexed(index, value)
*/
    /*else*/ {
      __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 432, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_mstate_global->__pyx_memoryview_type))))) __PYX_ERR(7, 432, __pyx_L1_error)
      __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((struct __pyx_memoryview_obj *)__pyx_t_3), __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 432, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __pyx_L5:;

    /* "View.MemoryView":427
 *         have_slices, index = _unellipsify(index, self.view.ndim)
 * 
 *         if have_slices:             # <<<<<<<<<<<<<<
 *             obj = self.is_slice(value)
 *             if obj is not None:
*/
    goto __pyx_L4;
  }

  /* "View.MemoryView":434
 *                 self.setitem_slice_assign_scalar(self[index], value)
 *         else:
 *             self.setitem_indexed(index, value)             # <<<<<<<<<<<<<<
 * 
 *     cdef is_slice(self, obj):
*/
  /*else*/ {
    __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_indexed(__pyx_v_self, __pyx_v_index, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 434, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __pyx_L4:;

  /* "View.MemoryView":421
 *             return self.convert_item_to_object(itemp)
 * 
 *     def __setitem__(memoryview self, object index, object value):             # <<<<<<<<<<<<<<
 *         if self.view.readonly:
 *             raise TypeError, "Cannot assign to read-only memoryview"
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_have_slices);
  __Pyx_XDECREF(__pyx_v_obj);
  __Pyx_XDECREF(__pyx_v_index);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":436
 *             self.setitem_indexed(index, value)
 * 
 *     cdef is_slice(self, obj):             # <<<<<<<<<<<<<<
 *         if not isinstance(obj, memoryview):
 *             try:
*/

static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  size_t __pyx_t_10;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("is_slice", 0);
  __Pyx_INCREF(__pyx_v_obj);

  /* "View.MemoryView":437
 * 
 *     cdef is_slice(self, obj):
 *         if not isinstance(obj, memoryview):             # <<<<<<<<<<<<<<
 *             try:
 *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
*/
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_mstate_global->__pyx_memoryview_type); 
  __pyx_t_2 = (!__pyx_t_1);
  if (__pyx_t_2) {

    /* "View.MemoryView":438
 *     cdef is_slice(self, obj):
 *         if not isinstance(obj, memoryview):
 *             try:             # <<<<<<<<<<<<<<
 *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
 *                                  self.dtype_is_object)
*/
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_5);
      /*try:*/ {

        /* "View.MemoryView":439
 *         if not isinstance(obj, memoryview):
 *             try:
 *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,             # <<<<<<<<<<<<<<
 *                                  self.dtype_is_object)
 *             except TypeError:
*/
        __pyx_t_7 = NULL;
        __pyx_t_8 = __Pyx_PyLong_From_int(((__pyx_v_self->flags & (~PyBUF_WRITABLE)) | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_8)) __PYX_ERR(7, 439, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_8);

        /* "View.MemoryView":440
 *             try:
 *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
 *                                  self.dtype_is_object)             # <<<<<<<<<<<<<<
 *             except TypeError:
 *                 return None
*/
        __pyx_t_9 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_9)) __PYX_ERR(7, 440, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_10 = 1;
        {
          PyObject *__pyx_callargs[4] = {__pyx_t_7, __pyx_v_obj, __pyx_t_8, __pyx_t_9};
          __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_memoryview_type, __pyx_callargs+__pyx_t_10, (4-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          if (unlikely(!__pyx_t_6)) __PYX_ERR(7, 439, __pyx_L4_error)
          __Pyx_GOTREF((PyObject *)__pyx_t_6);
        }
        __Pyx_DECREF_SET(__pyx_v_obj, ((PyObject *)__pyx_t_6));
        __pyx_t_6 = 0;

        /* "View.MemoryView":438
 *     cdef is_slice(self, obj):
 *         if not isinstance(obj, memoryview):
 *             try:             # <<<<<<<<<<<<<<
 *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
 *                                  self.dtype_is_object)
*/
      }
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L9_try_end;
      __pyx_L4_error:;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "View.MemoryView":441
 *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
 *                                  self.dtype_is_object)
 *             except TypeError:             # <<<<<<<<<<<<<<
 *                 return None
 * 
*/
      __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_TypeError))));
      if (__pyx_t_11) {
        __Pyx_ErrRestore(0,0,0);

        /* "View.MemoryView":442
 *                                  self.dtype_is_object)
 *             except TypeError:
 *                 return None             # <<<<<<<<<<<<<<
 * 
 *         return obj
*/
        __Pyx_XDECREF(__pyx_r);
        __pyx_r = Py_None; __Pyx_INCREF(Py_None);
        goto __pyx_L7_except_return;
      }
      goto __pyx_L6_except_error;

      /* "View.MemoryView":438
 *     cdef is_slice(self, obj):
 *         if not isinstance(obj, memoryview):
 *             try:             # <<<<<<<<<<<<<<
 *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
 *                                  self.dtype_is_object)
*/
      __pyx_L6_except_error:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      goto __pyx_L1_error;
      __pyx_L7_except_return:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      goto __pyx_L0;
      __pyx_L9_try_end:;
    }

    /* "View.MemoryView":437
 * 
 *     cdef is_slice(self, obj):
 *         if not isinstance(obj, memoryview):             # <<<<<<<<<<<<<<
 *             try:
 *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
*/
  }

  /* "View.MemoryView":444
 *                 return None
 * 
 *         return obj             # <<<<<<<<<<<<<<
 * 
 *     cdef setitem_slice_assignment(self, dst, src):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_obj);
  __pyx_r = __pyx_v_obj;
  goto __pyx_L0;

  /* "View.MemoryView":436
 *             self.setitem_indexed(index, value)
 * 
 *     cdef is_slice(self, obj):             # <<<<<<<<<<<<<<
 *         if not isinstance(obj, memoryview):
 *             try:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_obj);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":446
 *         return obj
 * 
 *     cdef setitem_slice_assignment(self, dst, src):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice dst_slice
 *         cdef __Pyx_memviewslice src_slice
*/

static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) {
  __Pyx_memviewslice __pyx_v_dst_slice;
  __Pyx_memviewslice __pyx_v_src_slice;
  __Pyx_memviewslice __pyx_v_msrc;
  __Pyx_memviewslice __pyx_v_mdst;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_memviewslice *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("setitem_slice_assignment", 0);

  /* "View.MemoryView":449
 *         cdef __Pyx_memviewslice dst_slice
 *         cdef __Pyx_memviewslice src_slice
 *         cdef __Pyx_memviewslice msrc = get_slice_from_memview(src, &src_slice)[0]             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0]
 * 
*/
  if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_mstate_global->__pyx_memoryview_type))))) __PYX_ERR(7, 449, __pyx_L1_error)
  __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice)); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(7, 449, __pyx_L1_error)
  __pyx_v_msrc = (__pyx_t_1[0]);

  /* "View.MemoryView":450
 *         cdef __Pyx_memviewslice src_slice
 *         cdef __Pyx_memviewslice msrc = get_slice_from_memview(src, &src_slice)[0]
 *         cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0]             # <<<<<<<<<<<<<<
 * 
 *         memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object)
*/
  if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_mstate_global->__pyx_memoryview_type))))) __PYX_ERR(7, 450, __pyx_L1_error)
  __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice)); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(7, 450, __pyx_L1_error)
  __pyx_v_mdst = (__pyx_t_1[0]);

  /* "View.MemoryView":452
 *         cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0]
 * 
 *         memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object)             # <<<<<<<<<<<<<<
 * 
 *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):
*/
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_mstate_global->__pyx_n_u_ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 452, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyLong_As_int(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(7, 452, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_mstate_global->__pyx_n_u_ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 452, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyLong_As_int(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(7, 452, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = __pyx_memoryview_copy_contents(__pyx_v_msrc, __pyx_v_mdst, __pyx_t_3, __pyx_t_4, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(7, 452, __pyx_L1_error)

  /* "View.MemoryView":446
 *         return obj
 * 
 *     cdef setitem_slice_assignment(self, dst, src):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice dst_slice
 *         cdef __Pyx_memviewslice src_slice
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":454
 *         memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object)
 * 
 *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):             # <<<<<<<<<<<<<<
 *         cdef int array[128]
 *         cdef void *tmp = NULL
*/

static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value) {
  int __pyx_v_array[128];
  void *__pyx_v_tmp;
  void *__pyx_v_item;
  __Pyx_memviewslice *__pyx_v_dst_slice;
  __Pyx_memviewslice __pyx_v_tmp_slice;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_memviewslice *__pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  char const *__pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 0);

  /* "View.MemoryView":456
 *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):
 *         cdef int array[128]
 *         cdef void *tmp = NULL             # <<<<<<<<<<<<<<
 *         cdef void *item
 * 
*/
  __pyx_v_tmp = NULL;

  /* "View.MemoryView":461
 *         cdef __Pyx_memviewslice *dst_slice
 *         cdef __Pyx_memviewslice tmp_slice
 *         dst_slice = get_slice_from_memview(dst, &tmp_slice)             # <<<<<<<<<<<<<<
 * 
 *         if <size_t>self.view.itemsize > sizeof(array):
*/
  __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice)); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(7, 461, __pyx_L1_error)
  __pyx_v_dst_slice = __pyx_t_1;

  /* "View.MemoryView":463
 *         dst_slice = get_slice_from_memview(dst, &tmp_slice)
 * 
 *         if <size_t>self.view.itemsize > sizeof(array):             # <<<<<<<<<<<<<<
 *             tmp = PyMem_Malloc(self.view.itemsize)
 *             if tmp == NULL:
*/
  __pyx_t_2 = (((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array)));
  if (__pyx_t_2) {

    /* "View.MemoryView":464
 * 
 *         if <size_t>self.view.itemsize > sizeof(array):
 *             tmp = PyMem_Malloc(self.view.itemsize)             # <<<<<<<<<<<<<<
 *             if tmp == NULL:
 *                 raise MemoryError
*/
    __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize);

    /* "View.MemoryView":465
 *         if <size_t>self.view.itemsize > sizeof(array):
 *             tmp = PyMem_Malloc(self.view.itemsize)
 *             if tmp == NULL:             # <<<<<<<<<<<<<<
 *                 raise MemoryError
 *             item = tmp
*/
    __pyx_t_2 = (__pyx_v_tmp == NULL);
    if (unlikely(__pyx_t_2)) {

      /* "View.MemoryView":466
 *             tmp = PyMem_Malloc(self.view.itemsize)
 *             if tmp == NULL:
 *                 raise MemoryError             # <<<<<<<<<<<<<<
 *             item = tmp
 *         else:
*/
      PyErr_NoMemory(); __PYX_ERR(7, 466, __pyx_L1_error)

      /* "View.MemoryView":465
 *         if <size_t>self.view.itemsize > sizeof(array):
 *             tmp = PyMem_Malloc(self.view.itemsize)
 *             if tmp == NULL:             # <<<<<<<<<<<<<<
 *                 raise MemoryError
 *             item = tmp
*/
    }

    /* "View.MemoryView":467
 *             if tmp == NULL:
 *                 raise MemoryError
 *             item = tmp             # <<<<<<<<<<<<<<
 *         else:
 *             item = <void *> array
*/
    __pyx_v_item = __pyx_v_tmp;

    /* "View.MemoryView":463
 *         dst_slice = get_slice_from_memview(dst, &tmp_slice)
 * 
 *         if <size_t>self.view.itemsize > sizeof(array):             # <<<<<<<<<<<<<<
 *             tmp = PyMem_Malloc(self.view.itemsize)
 *             if tmp == NULL:
*/
    goto __pyx_L3;
  }

  /* "View.MemoryView":469
 *             item = tmp
 *         else:
 *             item = <void *> array             # <<<<<<<<<<<<<<
 * 
 *         try:
*/
  /*else*/ {
    __pyx_v_item = ((void *)__pyx_v_array);
  }
  __pyx_L3:;

  /* "View.MemoryView":471
 *             item = <void *> array
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             if self.dtype_is_object:
 *                 (<PyObject **> item)[0] = <PyObject *> value
*/
  /*try:*/ {

    /* "View.MemoryView":472
 * 
 *         try:
 *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
 *                 (<PyObject **> item)[0] = <PyObject *> value
 *             else:
*/
    if (__pyx_v_self->dtype_is_object) {

      /* "View.MemoryView":473
 *         try:
 *             if self.dtype_is_object:
 *                 (<PyObject **> item)[0] = <PyObject *> value             # <<<<<<<<<<<<<<
 *             else:
 *                 self.assign_item_from_object(<char *> item, value)
*/
      (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value);

      /* "View.MemoryView":472
 * 
 *         try:
 *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
 *                 (<PyObject **> item)[0] = <PyObject *> value
 *             else:
*/
      goto __pyx_L8;
    }

    /* "View.MemoryView":475
 *                 (<PyObject **> item)[0] = <PyObject *> value
 *             else:
 *                 self.assign_item_from_object(<char *> item, value)             # <<<<<<<<<<<<<<
 * 
 * 
*/
    /*else*/ {
      __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, ((char *)__pyx_v_item), __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 475, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __pyx_L8:;

    /* "View.MemoryView":479
 * 
 * 
 *             if self.view.suboffsets != NULL:             # <<<<<<<<<<<<<<
 *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
 *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
*/
    __pyx_t_2 = (__pyx_v_self->view.suboffsets != NULL);
    if (__pyx_t_2) {

      /* "View.MemoryView":480
 * 
 *             if self.view.suboffsets != NULL:
 *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)             # <<<<<<<<<<<<<<
 *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
 *                                 item, self.dtype_is_object)
*/
      __pyx_t_4 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(7, 480, __pyx_L6_error)

      /* "View.MemoryView":479
 * 
 * 
 *             if self.view.suboffsets != NULL:             # <<<<<<<<<<<<<<
 *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
 *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
*/
    }

    /* "View.MemoryView":481
 *             if self.view.suboffsets != NULL:
 *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
 *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,             # <<<<<<<<<<<<<<
 *                                 item, self.dtype_is_object)
 *         finally:
*/
    __pyx_memoryview_slice_assign_scalar(__pyx_v_dst_slice, __pyx_v_dst->view.ndim, __pyx_v_self->view.itemsize, __pyx_v_item, __pyx_v_self->dtype_is_object);
  }

  /* "View.MemoryView":484
 *                                 item, self.dtype_is_object)
 *         finally:
 *             PyMem_Free(tmp)             # <<<<<<<<<<<<<<
 * 
 *     cdef setitem_indexed(self, index, value):
*/
  /*finally:*/ {
    /*normal exit:*/{
      PyMem_Free(__pyx_v_tmp);
      goto __pyx_L7;
    }
    __pyx_L6_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      if ( unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename;
      {
        PyMem_Free(__pyx_v_tmp);
      }
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
      __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6;
      goto __pyx_L1_error;
    }
    __pyx_L7:;
  }

  /* "View.MemoryView":454
 *         memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object)
 * 
 *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):             # <<<<<<<<<<<<<<
 *         cdef int array[128]
 *         cdef void *tmp = NULL
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":486
 *             PyMem_Free(tmp)
 * 
 *     cdef setitem_indexed(self, index, value):             # <<<<<<<<<<<<<<
 *         cdef char *itemp = self.get_item_pointer(index)
 *         self.assign_item_from_object(itemp, value)
*/

static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
  char *__pyx_v_itemp;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  char *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("setitem_indexed", 0);

  /* "View.MemoryView":487
 * 
 *     cdef setitem_indexed(self, index, value):
 *         cdef char *itemp = self.get_item_pointer(index)             # <<<<<<<<<<<<<<
 *         self.assign_item_from_object(itemp, value)
 * 
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_index); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(7, 487, __pyx_L1_error)
  __pyx_v_itemp = __pyx_t_1;

  /* "View.MemoryView":488
 *     cdef setitem_indexed(self, index, value):
 *         cdef char *itemp = self.get_item_pointer(index)
 *         self.assign_item_from_object(itemp, value)             # <<<<<<<<<<<<<<
 * 
 *     cdef convert_item_to_object(self, char *itemp):
*/
  __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 488, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "View.MemoryView":486
 *             PyMem_Free(tmp)
 * 
 *     cdef setitem_indexed(self, index, value):             # <<<<<<<<<<<<<<
 *         cdef char *itemp = self.get_item_pointer(index)
 *         self.assign_item_from_object(itemp, value)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":490
 *         self.assign_item_from_object(itemp, value)
 * 
 *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
 *         """Only used if instantiated manually by the user, or if Cython doesn't
 *         know how to convert the type"""
*/

static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp) {
  PyObject *__pyx_v_struct = NULL;
  PyObject *__pyx_v_bytesitem = 0;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  size_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("convert_item_to_object", 0);

  /* "View.MemoryView":493
 *         """Only used if instantiated manually by the user, or if Cython doesn't
 *         know how to convert the type"""
 *         import struct             # <<<<<<<<<<<<<<
 *         cdef bytes bytesitem
 * 
*/
  __pyx_t_2 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_struct, 0, 0, NULL, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 493, __pyx_L1_error)
  __pyx_t_1 = __pyx_t_2;
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_struct = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "View.MemoryView":496
 *         cdef bytes bytesitem
 * 
 *         bytesitem = itemp[:self.view.itemsize]             # <<<<<<<<<<<<<<
 *         try:
 *             result = struct.unpack(self.view.format, bytesitem)
*/
  __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 496, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_bytesitem = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "View.MemoryView":497
 * 
 *         bytesitem = itemp[:self.view.itemsize]
 *         try:             # <<<<<<<<<<<<<<
 *             result = struct.unpack(self.view.format, bytesitem)
 *         except struct.error:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    /*try:*/ {

      /* "View.MemoryView":498
 *         bytesitem = itemp[:self.view.itemsize]
 *         try:
 *             result = struct.unpack(self.view.format, bytesitem)             # <<<<<<<<<<<<<<
 *         except struct.error:
 *             raise ValueError, "Unable to convert item to object"
*/
      __pyx_t_5 = __pyx_v_struct;
      __Pyx_INCREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) __PYX_ERR(7, 498, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = 0;
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_t_6, __pyx_v_bytesitem};
        __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_unpack, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 498, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __pyx_v_result = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "View.MemoryView":497
 * 
 *         bytesitem = itemp[:self.view.itemsize]
 *         try:             # <<<<<<<<<<<<<<
 *             result = struct.unpack(self.view.format, bytesitem)
 *         except struct.error:
*/
    }

    /* "View.MemoryView":502
 *             raise ValueError, "Unable to convert item to object"
 *         else:
 *             if len(self.view.format) == 1:             # <<<<<<<<<<<<<<
 *                 return result[0]
 *             return result
*/
    /*else:*/ {
      __pyx_t_8 = __Pyx_ssize_strlen(__pyx_v_self->view.format); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(7, 502, __pyx_L5_except_error)
      __pyx_t_9 = (__pyx_t_8 == 1);
      if (__pyx_t_9) {

        /* "View.MemoryView":503
 *         else:
 *             if len(self.view.format) == 1:
 *                 return result[0]             # <<<<<<<<<<<<<<
 *             return result
 * 
*/
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_result, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 503, __pyx_L5_except_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_r = __pyx_t_1;
        __pyx_t_1 = 0;
        goto __pyx_L6_except_return;

        /* "View.MemoryView":502
 *             raise ValueError, "Unable to convert item to object"
 *         else:
 *             if len(self.view.format) == 1:             # <<<<<<<<<<<<<<
 *                 return result[0]
 *             return result
*/
      }

      /* "View.MemoryView":504
 *             if len(self.view.format) == 1:
 *                 return result[0]
 *             return result             # <<<<<<<<<<<<<<
 * 
 *     cdef assign_item_from_object(self, char *itemp, object value):
*/
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_result);
      __pyx_r = __pyx_v_result;
      goto __pyx_L6_except_return;
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "View.MemoryView":499
 *         try:
 *             result = struct.unpack(self.view.format, bytesitem)
 *         except struct.error:             # <<<<<<<<<<<<<<
 *             raise ValueError, "Unable to convert item to object"
 *         else:
*/
    __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_6, &__pyx_t_5);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_mstate_global->__pyx_n_u_error); if (unlikely(!__pyx_t_10)) __PYX_ERR(7, 499, __pyx_L5_except_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_11 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_10);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_ErrRestore(__pyx_t_1, __pyx_t_6, __pyx_t_5);
    __pyx_t_1 = 0; __pyx_t_6 = 0; __pyx_t_5 = 0;
    if (__pyx_t_11) {
      __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_1) < 0) __PYX_ERR(7, 499, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_1);

      /* "View.MemoryView":500
 *             result = struct.unpack(self.view.format, bytesitem)
 *         except struct.error:
 *             raise ValueError, "Unable to convert item to object"             # <<<<<<<<<<<<<<
 *         else:
 *             if len(self.view.format) == 1:
*/
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Unable_to_convert_item_to_object, 0, 0);
      __PYX_ERR(7, 500, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;

    /* "View.MemoryView":497
 * 
 *         bytesitem = itemp[:self.view.itemsize]
 *         try:             # <<<<<<<<<<<<<<
 *             result = struct.unpack(self.view.format, bytesitem)
 *         except struct.error:
*/
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    goto __pyx_L1_error;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    goto __pyx_L0;
  }

  /* "View.MemoryView":490
 *         self.assign_item_from_object(itemp, value)
 * 
 *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
 *         """Only used if instantiated manually by the user, or if Cython doesn't
 *         know how to convert the type"""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_struct);
  __Pyx_XDECREF(__pyx_v_bytesitem);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":506
 *             return result
 * 
 *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
 *         """Only used if instantiated manually by the user, or if Cython doesn't
 *         know how to convert the type"""
*/

static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) {
  PyObject *__pyx_v_struct = NULL;
  char __pyx_v_c;
  PyObject *__pyx_v_bytesvalue = 0;
  Py_ssize_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  size_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  char *__pyx_t_10;
  char *__pyx_t_11;
  Py_ssize_t __pyx_t_12;
  char *__pyx_t_13;
  char *__pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("assign_item_from_object", 0);

  /* "View.MemoryView":509
 *         """Only used if instantiated manually by the user, or if Cython doesn't
 *         know how to convert the type"""
 *         import struct             # <<<<<<<<<<<<<<
 *         cdef char c
 *         cdef bytes bytesvalue
*/
  __pyx_t_2 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_struct, 0, 0, NULL, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 509, __pyx_L1_error)
  __pyx_t_1 = __pyx_t_2;
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_struct = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "View.MemoryView":514
 *         cdef Py_ssize_t i
 * 
 *         if isinstance(value, tuple):             # <<<<<<<<<<<<<<
 *             bytesvalue = struct.pack(self.view.format, *value)
 *         else:
*/
  __pyx_t_3 = PyTuple_Check(__pyx_v_value); 
  if (__pyx_t_3) {

    /* "View.MemoryView":515
 * 
 *         if isinstance(value, tuple):
 *             bytesvalue = struct.pack(self.view.format, *value)             # <<<<<<<<<<<<<<
 *         else:
 *             bytesvalue = struct.pack(self.view.format, value)
*/
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_mstate_global->__pyx_n_u_pack); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 515, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 515, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 515, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4) != (0)) __PYX_ERR(7, 515, __pyx_L1_error);
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 515, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(7, 515, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 515, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_4))) __PYX_ERR(7, 515, __pyx_L1_error)
    __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "View.MemoryView":514
 *         cdef Py_ssize_t i
 * 
 *         if isinstance(value, tuple):             # <<<<<<<<<<<<<<
 *             bytesvalue = struct.pack(self.view.format, *value)
 *         else:
*/
    goto __pyx_L3;
  }

  /* "View.MemoryView":517
 *             bytesvalue = struct.pack(self.view.format, *value)
 *         else:
 *             bytesvalue = struct.pack(self.view.format, value)             # <<<<<<<<<<<<<<
 * 
 *         for i, c in enumerate(bytesvalue):
*/
  /*else*/ {
    __pyx_t_6 = __pyx_v_struct;
    __Pyx_INCREF(__pyx_t_6);
    __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 517, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_7 = 0;
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_t_1, __pyx_v_value};
      __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_pack, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 517, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_4))) __PYX_ERR(7, 517, __pyx_L1_error)
    __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;
  }
  __pyx_L3:;

  /* "View.MemoryView":519
 *             bytesvalue = struct.pack(self.view.format, value)
 * 
 *         for i, c in enumerate(bytesvalue):             # <<<<<<<<<<<<<<
 *             itemp[i] = c
 * 
*/
  __pyx_t_8 = 0;
  if (unlikely(__pyx_v_bytesvalue == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable");
    __PYX_ERR(7, 519, __pyx_L1_error)
  }
  __Pyx_INCREF(__pyx_v_bytesvalue);
  __pyx_t_9 = __pyx_v_bytesvalue;
  __pyx_t_11 = __Pyx_PyBytes_AsWritableString(__pyx_t_9); if (unlikely(__pyx_t_11 == ((char *)NULL))) __PYX_ERR(7, 519, __pyx_L1_error)
  __pyx_t_12 = __Pyx_PyBytes_GET_SIZE(__pyx_t_9); if (unlikely(__pyx_t_12 == ((Py_ssize_t)-1))) __PYX_ERR(7, 519, __pyx_L1_error)
  __pyx_t_13 = (__pyx_t_11 + __pyx_t_12);
  for (__pyx_t_14 = __pyx_t_11; __pyx_t_14 < __pyx_t_13; __pyx_t_14++) {
    __pyx_t_10 = __pyx_t_14;
    __pyx_v_c = (__pyx_t_10[0]);

    /* "View.MemoryView":520
 * 
 *         for i, c in enumerate(bytesvalue):
 *             itemp[i] = c             # <<<<<<<<<<<<<<
 * 
 *     @cname('getbuffer')
*/
    __pyx_v_i = __pyx_t_8;

    /* "View.MemoryView":519
 *             bytesvalue = struct.pack(self.view.format, value)
 * 
 *         for i, c in enumerate(bytesvalue):             # <<<<<<<<<<<<<<
 *             itemp[i] = c
 * 
*/
    __pyx_t_8 = (__pyx_t_8 + 1);

    /* "View.MemoryView":520
 * 
 *         for i, c in enumerate(bytesvalue):
 *             itemp[i] = c             # <<<<<<<<<<<<<<
 * 
 *     @cname('getbuffer')
*/
    (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c;
  }
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "View.MemoryView":506
 *             return result
 * 
 *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
 *         """Only used if instantiated manually by the user, or if Cython doesn't
 *         know how to convert the type"""
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_struct);
  __Pyx_XDECREF(__pyx_v_bytesvalue);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":522
 *             itemp[i] = c
 * 
 *     @cname('getbuffer')             # <<<<<<<<<<<<<<
 *     def __getbuffer__(self, Py_buffer *info, int flags):
 *         if flags & PyBUF_WRITABLE and self.view.readonly:
*/

/* Python wrapper */
CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  Py_ssize_t *__pyx_t_3;
  char *__pyx_t_4;
  void *__pyx_t_5;
  int __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  if (unlikely(__pyx_v_info == NULL)) {
    PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
    return -1;
  }
  __Pyx_RefNannySetupContext("__getbuffer__", 0);
  __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(__pyx_v_info->obj);

  /* "View.MemoryView":524
 *     @cname('getbuffer')
 *     def __getbuffer__(self, Py_buffer *info, int flags):
 *         if flags & PyBUF_WRITABLE and self.view.readonly:             # <<<<<<<<<<<<<<
 *             raise ValueError, "Cannot create writable memory view from read-only memoryview"
 * 
*/
  __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_1 = __pyx_v_self->view.readonly;
  __pyx_L4_bool_binop_done:;
  if (unlikely(__pyx_t_1)) {

    /* "View.MemoryView":525
 *     def __getbuffer__(self, Py_buffer *info, int flags):
 *         if flags & PyBUF_WRITABLE and self.view.readonly:
 *             raise ValueError, "Cannot create writable memory view from read-only memoryview"             # <<<<<<<<<<<<<<
 * 
 *         if flags & PyBUF_ND:
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Cannot_create_writable_memory_vi, 0, 0);
    __PYX_ERR(7, 525, __pyx_L1_error)

    /* "View.MemoryView":524
 *     @cname('getbuffer')
 *     def __getbuffer__(self, Py_buffer *info, int flags):
 *         if flags & PyBUF_WRITABLE and self.view.readonly:             # <<<<<<<<<<<<<<
 *             raise ValueError, "Cannot create writable memory view from read-only memoryview"
 * 
*/
  }

  /* "View.MemoryView":527
 *             raise ValueError, "Cannot create writable memory view from read-only memoryview"
 * 
 *         if flags & PyBUF_ND:             # <<<<<<<<<<<<<<
 *             info.shape = self.view.shape
 *         else:
*/
  __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":528
 * 
 *         if flags & PyBUF_ND:
 *             info.shape = self.view.shape             # <<<<<<<<<<<<<<
 *         else:
 *             info.shape = NULL
*/
    __pyx_t_3 = __pyx_v_self->view.shape;
    __pyx_v_info->shape = __pyx_t_3;

    /* "View.MemoryView":527
 *             raise ValueError, "Cannot create writable memory view from read-only memoryview"
 * 
 *         if flags & PyBUF_ND:             # <<<<<<<<<<<<<<
 *             info.shape = self.view.shape
 *         else:
*/
    goto __pyx_L6;
  }

  /* "View.MemoryView":530
 *             info.shape = self.view.shape
 *         else:
 *             info.shape = NULL             # <<<<<<<<<<<<<<
 * 
 *         if flags & PyBUF_STRIDES:
*/
  /*else*/ {
    __pyx_v_info->shape = NULL;
  }
  __pyx_L6:;

  /* "View.MemoryView":532
 *             info.shape = NULL
 * 
 *         if flags & PyBUF_STRIDES:             # <<<<<<<<<<<<<<
 *             info.strides = self.view.strides
 *         else:
*/
  __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":533
 * 
 *         if flags & PyBUF_STRIDES:
 *             info.strides = self.view.strides             # <<<<<<<<<<<<<<
 *         else:
 *             info.strides = NULL
*/
    __pyx_t_3 = __pyx_v_self->view.strides;
    __pyx_v_info->strides = __pyx_t_3;

    /* "View.MemoryView":532
 *             info.shape = NULL
 * 
 *         if flags & PyBUF_STRIDES:             # <<<<<<<<<<<<<<
 *             info.strides = self.view.strides
 *         else:
*/
    goto __pyx_L7;
  }

  /* "View.MemoryView":535
 *             info.strides = self.view.strides
 *         else:
 *             info.strides = NULL             # <<<<<<<<<<<<<<
 * 
 *         if flags & PyBUF_INDIRECT:
*/
  /*else*/ {
    __pyx_v_info->strides = NULL;
  }
  __pyx_L7:;

  /* "View.MemoryView":537
 *             info.strides = NULL
 * 
 *         if flags & PyBUF_INDIRECT:             # <<<<<<<<<<<<<<
 *             info.suboffsets = self.view.suboffsets
 *         else:
*/
  __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":538
 * 
 *         if flags & PyBUF_INDIRECT:
 *             info.suboffsets = self.view.suboffsets             # <<<<<<<<<<<<<<
 *         else:
 *             info.suboffsets = NULL
*/
    __pyx_t_3 = __pyx_v_self->view.suboffsets;
    __pyx_v_info->suboffsets = __pyx_t_3;

    /* "View.MemoryView":537
 *             info.strides = NULL
 * 
 *         if flags & PyBUF_INDIRECT:             # <<<<<<<<<<<<<<
 *             info.suboffsets = self.view.suboffsets
 *         else:
*/
    goto __pyx_L8;
  }

  /* "View.MemoryView":540
 *             info.suboffsets = self.view.suboffsets
 *         else:
 *             info.suboffsets = NULL             # <<<<<<<<<<<<<<
 * 
 *         if flags & PyBUF_FORMAT:
*/
  /*else*/ {
    __pyx_v_info->suboffsets = NULL;
  }
  __pyx_L8:;

  /* "View.MemoryView":542
 *             info.suboffsets = NULL
 * 
 *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
 *             info.format = self.view.format
 *         else:
*/
  __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":543
 * 
 *         if flags & PyBUF_FORMAT:
 *             info.format = self.view.format             # <<<<<<<<<<<<<<
 *         else:
 *             info.format = NULL
*/
    __pyx_t_4 = __pyx_v_self->view.format;
    __pyx_v_info->format = __pyx_t_4;

    /* "View.MemoryView":542
 *             info.suboffsets = NULL
 * 
 *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
 *             info.format = self.view.format
 *         else:
*/
    goto __pyx_L9;
  }

  /* "View.MemoryView":545
 *             info.format = self.view.format
 *         else:
 *             info.format = NULL             # <<<<<<<<<<<<<<
 * 
 *         info.buf = self.view.buf
*/
  /*else*/ {
    __pyx_v_info->format = NULL;
  }
  __pyx_L9:;

  /* "View.MemoryView":547
 *             info.format = NULL
 * 
 *         info.buf = self.view.buf             # <<<<<<<<<<<<<<
 *         info.ndim = self.view.ndim
 *         info.itemsize = self.view.itemsize
*/
  __pyx_t_5 = __pyx_v_self->view.buf;
  __pyx_v_info->buf = __pyx_t_5;

  /* "View.MemoryView":548
 * 
 *         info.buf = self.view.buf
 *         info.ndim = self.view.ndim             # <<<<<<<<<<<<<<
 *         info.itemsize = self.view.itemsize
 *         info.len = self.view.len
*/
  __pyx_t_6 = __pyx_v_self->view.ndim;
  __pyx_v_info->ndim = __pyx_t_6;

  /* "View.MemoryView":549
 *         info.buf = self.view.buf
 *         info.ndim = self.view.ndim
 *         info.itemsize = self.view.itemsize             # <<<<<<<<<<<<<<
 *         info.len = self.view.len
 *         info.readonly = self.view.readonly
*/
  __pyx_t_7 = __pyx_v_self->view.itemsize;
  __pyx_v_info->itemsize = __pyx_t_7;

  /* "View.MemoryView":550
 *         info.ndim = self.view.ndim
 *         info.itemsize = self.view.itemsize
 *         info.len = self.view.len             # <<<<<<<<<<<<<<
 *         info.readonly = self.view.readonly
 *         info.obj = self
*/
  __pyx_t_7 = __pyx_v_self->view.len;
  __pyx_v_info->len = __pyx_t_7;

  /* "View.MemoryView":551
 *         info.itemsize = self.view.itemsize
 *         info.len = self.view.len
 *         info.readonly = self.view.readonly             # <<<<<<<<<<<<<<
 *         info.obj = self
 * 
*/
  __pyx_t_1 = __pyx_v_self->view.readonly;
  __pyx_v_info->readonly = __pyx_t_1;

  /* "View.MemoryView":552
 *         info.len = self.view.len
 *         info.readonly = self.view.readonly
 *         info.obj = self             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_v_self);
  __Pyx_GOTREF(__pyx_v_info->obj);
  __Pyx_DECREF(__pyx_v_info->obj);
  __pyx_v_info->obj = ((PyObject *)__pyx_v_self);

  /* "View.MemoryView":522
 *             itemp[i] = c
 * 
 *     @cname('getbuffer')             # <<<<<<<<<<<<<<
 *     def __getbuffer__(self, Py_buffer *info, int flags):
 *         if flags & PyBUF_WRITABLE and self.view.readonly:
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("View.MemoryView.memoryview.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  if (__pyx_v_info->obj != NULL) {
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
  }
  goto __pyx_L2;
  __pyx_L0:;
  if (__pyx_v_info->obj == Py_None) {
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
  }
  __pyx_L2:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":555
 * 
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def T(self):
 *         cdef _memoryviewslice result = memoryview_copy(self)
*/

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":557
 *     @property
 *     def T(self):
 *         cdef _memoryviewslice result = memoryview_copy(self)             # <<<<<<<<<<<<<<
 *         transpose_memslice(&result.from_slice)
 *         return result
*/
  __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 557, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_memoryviewslice_type))))) __PYX_ERR(7, 557, __pyx_L1_error)
  __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "View.MemoryView":558
 *     def T(self):
 *         cdef _memoryviewslice result = memoryview_copy(self)
 *         transpose_memslice(&result.from_slice)             # <<<<<<<<<<<<<<
 *         return result
 * 
*/
  __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(7, 558, __pyx_L1_error)

  /* "View.MemoryView":559
 *         cdef _memoryviewslice result = memoryview_copy(self)
 *         transpose_memslice(&result.from_slice)
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_result);
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  /* "View.MemoryView":555
 * 
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def T(self):
 *         cdef _memoryviewslice result = memoryview_copy(self)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":561
 *         return result
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def base(self):
 *         return self._get_base()
*/

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":563
 *     @property
 *     def base(self):
 *         return self._get_base()             # <<<<<<<<<<<<<<
 * 
 *     cdef _get_base(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->_get_base(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 563, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":561
 *         return result
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def base(self):
 *         return self._get_base()
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.memoryview.base.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":565
 *         return self._get_base()
 * 
 *     cdef _get_base(self):             # <<<<<<<<<<<<<<
 *         return self.obj
 * 
*/

static PyObject *__pyx_memoryview__get_base(struct __pyx_memoryview_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_get_base", 0);

  /* "View.MemoryView":566
 * 
 *     cdef _get_base(self):
 *         return self.obj             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->obj);
  __pyx_r = __pyx_v_self->obj;
  goto __pyx_L0;

  /* "View.MemoryView":565
 *         return self._get_base()
 * 
 *     cdef _get_base(self):             # <<<<<<<<<<<<<<
 *         return self.obj
 * 
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":568
 *         return self.obj
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def shape(self):
 *         return tuple([length for length in self.view.shape[:self.view.ndim]])
*/

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  Py_ssize_t __pyx_7genexpr__pyx_v_length;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t *__pyx_t_2;
  Py_ssize_t *__pyx_t_3;
  Py_ssize_t *__pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":570
 *     @property
 *     def shape(self):
 *         return tuple([length for length in self.view.shape[:self.view.ndim]])             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  { /* enter inner scope */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 570, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
    for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
      __pyx_t_2 = __pyx_t_4;
      __pyx_7genexpr__pyx_v_length = (__pyx_t_2[0]);
      __pyx_t_5 = PyLong_FromSsize_t(__pyx_7genexpr__pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 570, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(7, 570, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  } /* exit inner scope */
  __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 570, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":568
 *         return self.obj
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def shape(self):
 *         return tuple([length for length in self.view.shape[:self.view.ndim]])
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":572
 *         return tuple([length for length in self.view.shape[:self.view.ndim]])
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def strides(self):
 *         if self.view.strides == NULL:
*/

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  Py_ssize_t __pyx_8genexpr1__pyx_v_stride;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t *__pyx_t_3;
  Py_ssize_t *__pyx_t_4;
  Py_ssize_t *__pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":574
 *     @property
 *     def strides(self):
 *         if self.view.strides == NULL:             # <<<<<<<<<<<<<<
 * 
 *             raise ValueError, "Buffer view does not expose strides"
*/
  __pyx_t_1 = (__pyx_v_self->view.strides == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "View.MemoryView":576
 *         if self.view.strides == NULL:
 * 
 *             raise ValueError, "Buffer view does not expose strides"             # <<<<<<<<<<<<<<
 * 
 *         return tuple([stride for stride in self.view.strides[:self.view.ndim]])
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Buffer_view_does_not_expose_stri, 0, 0);
    __PYX_ERR(7, 576, __pyx_L1_error)

    /* "View.MemoryView":574
 *     @property
 *     def strides(self):
 *         if self.view.strides == NULL:             # <<<<<<<<<<<<<<
 * 
 *             raise ValueError, "Buffer view does not expose strides"
*/
  }

  /* "View.MemoryView":578
 *             raise ValueError, "Buffer view does not expose strides"
 * 
 *         return tuple([stride for stride in self.view.strides[:self.view.ndim]])             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  { /* enter inner scope */
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 578, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim);
    for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
      __pyx_t_3 = __pyx_t_5;
      __pyx_8genexpr1__pyx_v_stride = (__pyx_t_3[0]);
      __pyx_t_6 = PyLong_FromSsize_t(__pyx_8genexpr1__pyx_v_stride); if (unlikely(!__pyx_t_6)) __PYX_ERR(7, 578, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(7, 578, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
  } /* exit inner scope */
  __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(7, 578, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":572
 *         return tuple([length for length in self.view.shape[:self.view.ndim]])
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def strides(self):
 *         if self.view.strides == NULL:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":580
 *         return tuple([stride for stride in self.view.strides[:self.view.ndim]])
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def suboffsets(self):
 *         if self.view.suboffsets == NULL:
*/

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  Py_ssize_t __pyx_8genexpr2__pyx_v_suboffset;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t *__pyx_t_3;
  Py_ssize_t *__pyx_t_4;
  Py_ssize_t *__pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":582
 *     @property
 *     def suboffsets(self):
 *         if self.view.suboffsets == NULL:             # <<<<<<<<<<<<<<
 *             return (-1,) * self.view.ndim
 * 
*/
  __pyx_t_1 = (__pyx_v_self->view.suboffsets == NULL);
  if (__pyx_t_1) {

    /* "View.MemoryView":583
 *     def suboffsets(self):
 *         if self.view.suboffsets == NULL:
 *             return (-1,) * self.view.ndim             # <<<<<<<<<<<<<<
 * 
 *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PySequence_Multiply(__pyx_mstate_global->__pyx_tuple[0], __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 583, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "View.MemoryView":582
 *     @property
 *     def suboffsets(self):
 *         if self.view.suboffsets == NULL:             # <<<<<<<<<<<<<<
 *             return (-1,) * self.view.ndim
 * 
*/
  }

  /* "View.MemoryView":585
 *             return (-1,) * self.view.ndim
 * 
 *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  { /* enter inner scope */
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 585, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim);
    for (__pyx_t_5 = __pyx_v_self->view.suboffsets; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
      __pyx_t_3 = __pyx_t_5;
      __pyx_8genexpr2__pyx_v_suboffset = (__pyx_t_3[0]);
      __pyx_t_6 = PyLong_FromSsize_t(__pyx_8genexpr2__pyx_v_suboffset); if (unlikely(!__pyx_t_6)) __PYX_ERR(7, 585, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(7, 585, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
  } /* exit inner scope */
  __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(7, 585, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":580
 *         return tuple([stride for stride in self.view.strides[:self.view.ndim]])
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def suboffsets(self):
 *         if self.view.suboffsets == NULL:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":587
 *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def ndim(self):
 *         return self.view.ndim
*/

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":589
 *     @property
 *     def ndim(self):
 *         return self.view.ndim             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 589, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":587
 *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def ndim(self):
 *         return self.view.ndim
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":591
 *         return self.view.ndim
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def itemsize(self):
 *         return self.view.itemsize
*/

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":593
 *     @property
 *     def itemsize(self):
 *         return self.view.itemsize             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyLong_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 593, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":591
 *         return self.view.ndim
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def itemsize(self):
 *         return self.view.itemsize
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":595
 *         return self.view.itemsize
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def nbytes(self):
 *         return self.size * self.view.itemsize
*/

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":597
 *     @property
 *     def nbytes(self):
 *         return self.size * self.view.itemsize             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 597, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyLong_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 597, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 597, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":595
 *         return self.view.itemsize
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def nbytes(self):
 *         return self.size * self.view.itemsize
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":599
 *         return self.size * self.view.itemsize
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def size(self):
 *         if self._size is None:
*/

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_v_length = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  Py_ssize_t *__pyx_t_2;
  Py_ssize_t *__pyx_t_3;
  Py_ssize_t *__pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":601
 *     @property
 *     def size(self):
 *         if self._size is None:             # <<<<<<<<<<<<<<
 *             result = 1
 * 
*/
  __pyx_t_1 = (__pyx_v_self->_size == Py_None);
  if (__pyx_t_1) {

    /* "View.MemoryView":602
 *     def size(self):
 *         if self._size is None:
 *             result = 1             # <<<<<<<<<<<<<<
 * 
 *             for length in self.view.shape[:self.view.ndim]:
*/
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_1);
    __pyx_v_result = __pyx_mstate_global->__pyx_int_1;

    /* "View.MemoryView":604
 *             result = 1
 * 
 *             for length in self.view.shape[:self.view.ndim]:             # <<<<<<<<<<<<<<
 *                 result *= length
 * 
*/
    __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
    for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
      __pyx_t_2 = __pyx_t_4;
      __pyx_t_5 = PyLong_FromSsize_t((__pyx_t_2[0])); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 604, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "View.MemoryView":605
 * 
 *             for length in self.view.shape[:self.view.ndim]:
 *                 result *= length             # <<<<<<<<<<<<<<
 * 
 *             self._size = result
*/
      __pyx_t_5 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 605, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_5);
      __pyx_t_5 = 0;
    }

    /* "View.MemoryView":607
 *                 result *= length
 * 
 *             self._size = result             # <<<<<<<<<<<<<<
 * 
 *         return self._size
*/
    __Pyx_INCREF(__pyx_v_result);
    __Pyx_GIVEREF(__pyx_v_result);
    __Pyx_GOTREF(__pyx_v_self->_size);
    __Pyx_DECREF(__pyx_v_self->_size);
    __pyx_v_self->_size = __pyx_v_result;

    /* "View.MemoryView":601
 *     @property
 *     def size(self):
 *         if self._size is None:             # <<<<<<<<<<<<<<
 *             result = 1
 * 
*/
  }

  /* "View.MemoryView":609
 *             self._size = result
 * 
 *         return self._size             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_size);
  __pyx_r = __pyx_v_self->_size;
  goto __pyx_L0;

  /* "View.MemoryView":599
 *         return self.size * self.view.itemsize
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def size(self):
 *         if self._size is None:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_length);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":611
 *         return self._size
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         if self.view.ndim >= 1:
 *             return self.view.shape[0]
*/

/* Python wrapper */
static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  int __pyx_t_1;

  /* "View.MemoryView":612
 * 
 *     def __len__(self):
 *         if self.view.ndim >= 1:             # <<<<<<<<<<<<<<
 *             return self.view.shape[0]
 * 
*/
  __pyx_t_1 = (__pyx_v_self->view.ndim >= 1);
  if (__pyx_t_1) {

    /* "View.MemoryView":613
 *     def __len__(self):
 *         if self.view.ndim >= 1:
 *             return self.view.shape[0]             # <<<<<<<<<<<<<<
 * 
 *         return 0
*/
    __pyx_r = (__pyx_v_self->view.shape[0]);
    goto __pyx_L0;

    /* "View.MemoryView":612
 * 
 *     def __len__(self):
 *         if self.view.ndim >= 1:             # <<<<<<<<<<<<<<
 *             return self.view.shape[0]
 * 
*/
  }

  /* "View.MemoryView":615
 *             return self.view.shape[0]
 * 
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "View.MemoryView":611
 *         return self._size
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         if self.view.ndim >= 1:
 *             return self.view.shape[0]
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":617
 *         return 0
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
 *                                                id(self))
*/

/* Python wrapper */
static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4[5];
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "View.MemoryView":618
 * 
 *     def __repr__(self):
 *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,             # <<<<<<<<<<<<<<
 *                                                id(self))
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 618, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 618, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 618, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_1), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 618, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "View.MemoryView":619
 *     def __repr__(self):
 *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
 *                                                id(self))             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self):
*/
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 619, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_Format(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_x); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 619, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u_MemoryView_of;
  __pyx_t_4[1] = __pyx_t_2;
  __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u_at_0x;
  __pyx_t_4[3] = __pyx_t_3;
  __pyx_t_4[4] = __pyx_mstate_global->__pyx_kp_u__3;

  /* "View.MemoryView":618
 * 
 *     def __repr__(self):
 *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,             # <<<<<<<<<<<<<<
 *                                                id(self))
 * 
*/
  __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_4, 5, 15 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 6 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3));
  if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 618, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":617
 *         return 0
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
 *                                                id(self))
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":621
 *                                                id(self))
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return "<MemoryView of %r object>" % (self.base.__class__.__name__,)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3[3];
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__str__", 0);

  /* "View.MemoryView":622
 * 
 *     def __str__(self):
 *         return "<MemoryView of %r object>" % (self.base.__class__.__name__,)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 622, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 622, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 622, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_1), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 622, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3[0] = __pyx_mstate_global->__pyx_kp_u_MemoryView_of;
  __pyx_t_3[1] = __pyx_t_2;
  __pyx_t_3[2] = __pyx_mstate_global->__pyx_kp_u_object_2;
  __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, 15 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 8, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2));
  if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 622, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":621
 *                                                id(self))
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return "<MemoryView of %r object>" % (self.base.__class__.__name__,)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":625
 * 
 * 
 *     def is_c_contig(self):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice *mslice
 *         cdef __Pyx_memviewslice tmp
*/

/* Python wrapper */
static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_c_contig (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("is_c_contig", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("is_c_contig", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self) {
  __Pyx_memviewslice *__pyx_v_mslice;
  __Pyx_memviewslice __pyx_v_tmp;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_memviewslice *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("is_c_contig", 0);

  /* "View.MemoryView":628
 *         cdef __Pyx_memviewslice *mslice
 *         cdef __Pyx_memviewslice tmp
 *         mslice = get_slice_from_memview(self, &tmp)             # <<<<<<<<<<<<<<
 *         return slice_is_contig(mslice[0], 'C', self.view.ndim)
 * 
*/
  __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(7, 628, __pyx_L1_error)
  __pyx_v_mslice = __pyx_t_1;

  /* "View.MemoryView":629
 *         cdef __Pyx_memviewslice tmp
 *         mslice = get_slice_from_memview(self, &tmp)
 *         return slice_is_contig(mslice[0], 'C', self.view.ndim)             # <<<<<<<<<<<<<<
 * 
 *     def is_f_contig(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'C', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 629, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":625
 * 
 * 
 *     def is_c_contig(self):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice *mslice
 *         cdef __Pyx_memviewslice tmp
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":631
 *         return slice_is_contig(mslice[0], 'C', self.view.ndim)
 * 
 *     def is_f_contig(self):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice *mslice
 *         cdef __Pyx_memviewslice tmp
*/

/* Python wrapper */
static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_f_contig (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("is_f_contig", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("is_f_contig", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self) {
  __Pyx_memviewslice *__pyx_v_mslice;
  __Pyx_memviewslice __pyx_v_tmp;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_memviewslice *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("is_f_contig", 0);

  /* "View.MemoryView":634
 *         cdef __Pyx_memviewslice *mslice
 *         cdef __Pyx_memviewslice tmp
 *         mslice = get_slice_from_memview(self, &tmp)             # <<<<<<<<<<<<<<
 *         return slice_is_contig(mslice[0], 'F', self.view.ndim)
 * 
*/
  __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(7, 634, __pyx_L1_error)
  __pyx_v_mslice = __pyx_t_1;

  /* "View.MemoryView":635
 *         cdef __Pyx_memviewslice tmp
 *         mslice = get_slice_from_memview(self, &tmp)
 *         return slice_is_contig(mslice[0], 'F', self.view.ndim)             # <<<<<<<<<<<<<<
 * 
 *     def copy(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'F', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 635, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":631
 *         return slice_is_contig(mslice[0], 'C', self.view.ndim)
 * 
 *     def is_f_contig(self):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice *mslice
 *         cdef __Pyx_memviewslice tmp
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":637
 *         return slice_is_contig(mslice[0], 'F', self.view.ndim)
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice mslice
 *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
*/

/* Python wrapper */
static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("copy", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("copy", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self) {
  __Pyx_memviewslice __pyx_v_mslice;
  int __pyx_v_flags;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_memviewslice __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy", 0);

  /* "View.MemoryView":639
 *     def copy(self):
 *         cdef __Pyx_memviewslice mslice
 *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS             # <<<<<<<<<<<<<<
 * 
 *         slice_copy(self, &mslice)
*/
  __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS));

  /* "View.MemoryView":641
 *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
 * 
 *         slice_copy(self, &mslice)             # <<<<<<<<<<<<<<
 *         mslice = slice_copy_contig(&mslice, "c", self.view.ndim,
 *                                    self.view.itemsize,
*/
  __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice));

  /* "View.MemoryView":642
 * 
 *         slice_copy(self, &mslice)
 *         mslice = slice_copy_contig(&mslice, "c", self.view.ndim,             # <<<<<<<<<<<<<<
 *                                    self.view.itemsize,
 *                                    flags|PyBUF_C_CONTIGUOUS,
*/
  __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), __pyx_k_c, __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_C_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(7, 642, __pyx_L1_error)
  __pyx_v_mslice = __pyx_t_1;

  /* "View.MemoryView":647
 *                                    self.dtype_is_object)
 * 
 *         return memoryview_copy_from_slice(self, &mslice)             # <<<<<<<<<<<<<<
 * 
 *     def copy_fortran(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice)); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 647, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":637
 *         return slice_is_contig(mslice[0], 'F', self.view.ndim)
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice mslice
 *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":649
 *         return memoryview_copy_from_slice(self, &mslice)
 * 
 *     def copy_fortran(self):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice src, dst
 *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
*/

/* Python wrapper */
static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy_fortran (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("copy_fortran", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("copy_fortran", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self) {
  __Pyx_memviewslice __pyx_v_src;
  __Pyx_memviewslice __pyx_v_dst;
  int __pyx_v_flags;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_memviewslice __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy_fortran", 0);

  /* "View.MemoryView":651
 *     def copy_fortran(self):
 *         cdef __Pyx_memviewslice src, dst
 *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS             # <<<<<<<<<<<<<<
 * 
 *         slice_copy(self, &src)
*/
  __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS));

  /* "View.MemoryView":653
 *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
 * 
 *         slice_copy(self, &src)             # <<<<<<<<<<<<<<
 *         dst = slice_copy_contig(&src, "fortran", self.view.ndim,
 *                                 self.view.itemsize,
*/
  __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src));

  /* "View.MemoryView":654
 * 
 *         slice_copy(self, &src)
 *         dst = slice_copy_contig(&src, "fortran", self.view.ndim,             # <<<<<<<<<<<<<<
 *                                 self.view.itemsize,
 *                                 flags|PyBUF_F_CONTIGUOUS,
*/
  __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), __pyx_k_fortran, __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_F_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(7, 654, __pyx_L1_error)
  __pyx_v_dst = __pyx_t_1;

  /* "View.MemoryView":659
 *                                 self.dtype_is_object)
 * 
 *         return memoryview_copy_from_slice(self, &dst)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst)); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 659, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":649
 *         return memoryview_copy_from_slice(self, &mslice)
 * 
 *     def copy_fortran(self):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice src, dst
 *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
*/

/* Python wrapper */
static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf___pyx_memoryview___reduce_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(7, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/

/* Python wrapper */
static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(7, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(7, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(7, 3, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(7, 3, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(7, 3, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(7, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v___pyx_state);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(7, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":662
 * 
 * 
 * @cname('__pyx_memoryview_new')             # <<<<<<<<<<<<<<
 * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, const __Pyx_TypeInfo *typeinfo):
 *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
*/

static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, int __pyx_v_dtype_is_object, __Pyx_TypeInfo const *__pyx_v_typeinfo) {
  struct __pyx_memoryview_obj *__pyx_v_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("memoryview_cwrapper", 0);

  /* "View.MemoryView":664
 * @cname('__pyx_memoryview_new')
 * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, const __Pyx_TypeInfo *typeinfo):
 *     cdef memoryview result = memoryview(o, flags, dtype_is_object)             # <<<<<<<<<<<<<<
 *     result.typeinfo = typeinfo
 *     return result
*/
  __pyx_t_2 = NULL;
  __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 664, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 664, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[4] = {__pyx_t_2, __pyx_v_o, __pyx_t_3, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_memoryview_type, __pyx_callargs+__pyx_t_5, (4-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 664, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __pyx_v_result = ((struct __pyx_memoryview_obj *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "View.MemoryView":665
 * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, const __Pyx_TypeInfo *typeinfo):
 *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
 *     result.typeinfo = typeinfo             # <<<<<<<<<<<<<<
 *     return result
 * 
*/
  __pyx_v_result->typeinfo = __pyx_v_typeinfo;

  /* "View.MemoryView":666
 *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
 *     result.typeinfo = typeinfo
 *     return result             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_check')
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_result);
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  /* "View.MemoryView":662
 * 
 * 
 * @cname('__pyx_memoryview_new')             # <<<<<<<<<<<<<<
 * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, const __Pyx_TypeInfo *typeinfo):
 *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":668
 *     return result
 * 
 * @cname('__pyx_memoryview_check')             # <<<<<<<<<<<<<<
 * cdef inline bint memoryview_check(object o) noexcept:
 *     return isinstance(o, memoryview)
*/

static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) {
  int __pyx_r;
  int __pyx_t_1;

  /* "View.MemoryView":670
 * @cname('__pyx_memoryview_check')
 * cdef inline bint memoryview_check(object o) noexcept:
 *     return isinstance(o, memoryview)             # <<<<<<<<<<<<<<
 * 
 * cdef tuple _unellipsify(object index, int ndim):
*/
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_mstate_global->__pyx_memoryview_type); 
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  /* "View.MemoryView":668
 *     return result
 * 
 * @cname('__pyx_memoryview_check')             # <<<<<<<<<<<<<<
 * cdef inline bint memoryview_check(object o) noexcept:
 *     return isinstance(o, memoryview)
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":672
 *     return isinstance(o, memoryview)
 * 
 * cdef tuple _unellipsify(object index, int ndim):             # <<<<<<<<<<<<<<
 *     """
 *     Replace all ellipses with full slices and fill incomplete indices with
*/

static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  Py_ssize_t __pyx_v_idx;
  PyObject *__pyx_v_tup = NULL;
  PyObject *__pyx_v_result = NULL;
  int __pyx_v_have_slices;
  int __pyx_v_seen_ellipsis;
  PyObject *__pyx_v_item = NULL;
  Py_ssize_t __pyx_v_nslices;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6[3];
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_unellipsify", 0);

  /* "View.MemoryView":678
 *     """
 *     cdef Py_ssize_t idx
 *     tup = <tuple>index if isinstance(index, tuple) else (index,)             # <<<<<<<<<<<<<<
 * 
 *     result = [slice(None)] * ndim
*/
  __pyx_t_2 = PyTuple_Check(__pyx_v_index); 
  if (__pyx_t_2) {
    __Pyx_INCREF(((PyObject*)__pyx_v_index));
    __pyx_t_1 = __pyx_v_index;
  } else {
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 678, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_index);
    __Pyx_GIVEREF(__pyx_v_index);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index) != (0)) __PYX_ERR(7, 678, __pyx_L1_error);
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
  }
  __pyx_v_tup = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "View.MemoryView":680
 *     tup = <tuple>index if isinstance(index, tuple) else (index,)
 * 
 *     result = [slice(None)] * ndim             # <<<<<<<<<<<<<<
 *     have_slices = False
 *     seen_ellipsis = False
*/
  __pyx_t_1 = PyList_New(1 * ((__pyx_v_ndim<0) ? 0:__pyx_v_ndim)); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 680, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  { Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < __pyx_v_ndim; __pyx_temp++) {
      __Pyx_INCREF(__pyx_mstate_global->__pyx_slice[0]);
      __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[0]);
      if (__Pyx_PyList_SET_ITEM(__pyx_t_1, __pyx_temp, __pyx_mstate_global->__pyx_slice[0]) != (0)) __PYX_ERR(7, 680, __pyx_L1_error);
    }
  }
  __pyx_v_result = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "View.MemoryView":681
 * 
 *     result = [slice(None)] * ndim
 *     have_slices = False             # <<<<<<<<<<<<<<
 *     seen_ellipsis = False
 *     idx = 0
*/
  __pyx_v_have_slices = 0;

  /* "View.MemoryView":682
 *     result = [slice(None)] * ndim
 *     have_slices = False
 *     seen_ellipsis = False             # <<<<<<<<<<<<<<
 *     idx = 0
 *     for item in tup:
*/
  __pyx_v_seen_ellipsis = 0;

  /* "View.MemoryView":683
 *     have_slices = False
 *     seen_ellipsis = False
 *     idx = 0             # <<<<<<<<<<<<<<
 *     for item in tup:
 *         if item is Ellipsis:
*/
  __pyx_v_idx = 0;

  /* "View.MemoryView":684
 *     seen_ellipsis = False
 *     idx = 0
 *     for item in tup:             # <<<<<<<<<<<<<<
 *         if item is Ellipsis:
 *             if not seen_ellipsis:
*/
  if (unlikely(__pyx_v_tup == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(7, 684, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_1);
  __pyx_t_4 = 0;
  for (;;) {
    {
      Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
      #if !CYTHON_ASSUME_SAFE_SIZE
      if (unlikely((__pyx_temp < 0))) __PYX_ERR(7, 684, __pyx_L1_error)
      #endif
      if (__pyx_t_4 >= __pyx_temp) break;
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4));
    #else
    __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_4);
    #endif
    ++__pyx_t_4;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 684, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "View.MemoryView":685
 *     idx = 0
 *     for item in tup:
 *         if item is Ellipsis:             # <<<<<<<<<<<<<<
 *             if not seen_ellipsis:
 *                 idx += ndim - len(tup)
*/
    __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis);
    if (__pyx_t_2) {

      /* "View.MemoryView":686
 *     for item in tup:
 *         if item is Ellipsis:
 *             if not seen_ellipsis:             # <<<<<<<<<<<<<<
 *                 idx += ndim - len(tup)
 *                 seen_ellipsis = True
*/
      __pyx_t_2 = (!__pyx_v_seen_ellipsis);
      if (__pyx_t_2) {

        /* "View.MemoryView":687
 *         if item is Ellipsis:
 *             if not seen_ellipsis:
 *                 idx += ndim - len(tup)             # <<<<<<<<<<<<<<
 *                 seen_ellipsis = True
 *             have_slices = True
*/
        if (unlikely(__pyx_v_tup == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
          __PYX_ERR(7, 687, __pyx_L1_error)
        }
        __pyx_t_5 = __Pyx_PyTuple_GET_SIZE(__pyx_v_tup); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(7, 687, __pyx_L1_error)
        __pyx_v_idx = (__pyx_v_idx + (__pyx_v_ndim - __pyx_t_5));

        /* "View.MemoryView":688
 *             if not seen_ellipsis:
 *                 idx += ndim - len(tup)
 *                 seen_ellipsis = True             # <<<<<<<<<<<<<<
 *             have_slices = True
 *         else:
*/
        __pyx_v_seen_ellipsis = 1;

        /* "View.MemoryView":686
 *     for item in tup:
 *         if item is Ellipsis:
 *             if not seen_ellipsis:             # <<<<<<<<<<<<<<
 *                 idx += ndim - len(tup)
 *                 seen_ellipsis = True
*/
      }

      /* "View.MemoryView":689
 *                 idx += ndim - len(tup)
 *                 seen_ellipsis = True
 *             have_slices = True             # <<<<<<<<<<<<<<
 *         else:
 *             if isinstance(item, slice):
*/
      __pyx_v_have_slices = 1;

      /* "View.MemoryView":685
 *     idx = 0
 *     for item in tup:
 *         if item is Ellipsis:             # <<<<<<<<<<<<<<
 *             if not seen_ellipsis:
 *                 idx += ndim - len(tup)
*/
      goto __pyx_L5;
    }

    /* "View.MemoryView":691
 *             have_slices = True
 *         else:
 *             if isinstance(item, slice):             # <<<<<<<<<<<<<<
 *                 have_slices = True
 *             elif not PyIndex_Check(item):
*/
    /*else*/ {
      __pyx_t_2 = PySlice_Check(__pyx_v_item); 
      if (__pyx_t_2) {

        /* "View.MemoryView":692
 *         else:
 *             if isinstance(item, slice):
 *                 have_slices = True             # <<<<<<<<<<<<<<
 *             elif not PyIndex_Check(item):
 *                 raise TypeError, f"Cannot index with type '{type(item)}'"
*/
        __pyx_v_have_slices = 1;

        /* "View.MemoryView":691
 *             have_slices = True
 *         else:
 *             if isinstance(item, slice):             # <<<<<<<<<<<<<<
 *                 have_slices = True
 *             elif not PyIndex_Check(item):
*/
        goto __pyx_L7;
      }

      /* "View.MemoryView":693
 *             if isinstance(item, slice):
 *                 have_slices = True
 *             elif not PyIndex_Check(item):             # <<<<<<<<<<<<<<
 *                 raise TypeError, f"Cannot index with type '{type(item)}'"
 *             result[idx] = item
*/
      __pyx_t_2 = (!(PyIndex_Check(__pyx_v_item) != 0));
      if (unlikely(__pyx_t_2)) {

        /* "View.MemoryView":694
 *                 have_slices = True
 *             elif not PyIndex_Check(item):
 *                 raise TypeError, f"Cannot index with type '{type(item)}'"             # <<<<<<<<<<<<<<
 *             result[idx] = item
 *         idx += 1
*/
        __pyx_t_3 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(__pyx_v_item)), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 694, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_6[0] = __pyx_mstate_global->__pyx_kp_u_Cannot_index_with_type;
        __pyx_t_6[1] = __pyx_t_3;
        __pyx_t_6[2] = __pyx_mstate_global->__pyx_kp_u__4;
        __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_6, 3, 24 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3));
        if (unlikely(!__pyx_t_7)) __PYX_ERR(7, 694, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_t_7, 0, 0);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __PYX_ERR(7, 694, __pyx_L1_error)

        /* "View.MemoryView":693
 *             if isinstance(item, slice):
 *                 have_slices = True
 *             elif not PyIndex_Check(item):             # <<<<<<<<<<<<<<
 *                 raise TypeError, f"Cannot index with type '{type(item)}'"
 *             result[idx] = item
*/
      }
      __pyx_L7:;

      /* "View.MemoryView":695
 *             elif not PyIndex_Check(item):
 *                 raise TypeError, f"Cannot index with type '{type(item)}'"
 *             result[idx] = item             # <<<<<<<<<<<<<<
 *         idx += 1
 * 
*/
      if (unlikely((__Pyx_SetItemInt(__pyx_v_result, __pyx_v_idx, __pyx_v_item, Py_ssize_t, 1, PyLong_FromSsize_t, 1, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference) < 0))) __PYX_ERR(7, 695, __pyx_L1_error)
    }
    __pyx_L5:;

    /* "View.MemoryView":696
 *                 raise TypeError, f"Cannot index with type '{type(item)}'"
 *             result[idx] = item
 *         idx += 1             # <<<<<<<<<<<<<<
 * 
 *     nslices = ndim - idx
*/
    __pyx_v_idx = (__pyx_v_idx + 1);

    /* "View.MemoryView":684
 *     seen_ellipsis = False
 *     idx = 0
 *     for item in tup:             # <<<<<<<<<<<<<<
 *         if item is Ellipsis:
 *             if not seen_ellipsis:
*/
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "View.MemoryView":698
 *         idx += 1
 * 
 *     nslices = ndim - idx             # <<<<<<<<<<<<<<
 *     return have_slices or nslices, tuple(result)
 * 
*/
  __pyx_v_nslices = (__pyx_v_ndim - __pyx_v_idx);

  /* "View.MemoryView":699
 * 
 *     nslices = ndim - idx
 *     return have_slices or nslices, tuple(result)             # <<<<<<<<<<<<<<
 * 
 * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1:
*/
  __Pyx_XDECREF(__pyx_r);
  if (!__pyx_v_have_slices) {
  } else {
    __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_have_slices); if (unlikely(!__pyx_t_7)) __PYX_ERR(7, 699, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_1 = __pyx_t_7;
    __pyx_t_7 = 0;
    goto __pyx_L9_bool_binop_done;
  }
  __pyx_t_7 = PyLong_FromSsize_t(__pyx_v_nslices); if (unlikely(!__pyx_t_7)) __PYX_ERR(7, 699, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_1 = __pyx_t_7;
  __pyx_t_7 = 0;
  __pyx_L9_bool_binop_done:;
  __pyx_t_7 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_7)) __PYX_ERR(7, 699, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 699, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1) != (0)) __PYX_ERR(7, 699, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_7);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_7) != (0)) __PYX_ERR(7, 699, __pyx_L1_error);
  __pyx_t_1 = 0;
  __pyx_t_7 = 0;
  __pyx_r = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":672
 *     return isinstance(o, memoryview)
 * 
 * cdef tuple _unellipsify(object index, int ndim):             # <<<<<<<<<<<<<<
 *     """
 *     Replace all ellipses with full slices and fill incomplete indices with
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tup);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":701
 *     return have_slices or nslices, tuple(result)
 * 
 * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1:             # <<<<<<<<<<<<<<
 *     for suboffset in suboffsets[:ndim]:
 *         if suboffset >= 0:
*/

static int assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __pyx_v_ndim) {
  Py_ssize_t __pyx_v_suboffset;
  int __pyx_r;
  Py_ssize_t *__pyx_t_1;
  Py_ssize_t *__pyx_t_2;
  Py_ssize_t *__pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "View.MemoryView":702
 * 
 * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1:
 *     for suboffset in suboffsets[:ndim]:             # <<<<<<<<<<<<<<
 *         if suboffset >= 0:
 *             raise ValueError, "Indirect dimensions not supported"
*/
  __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim);
  for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) {
    __pyx_t_1 = __pyx_t_3;
    __pyx_v_suboffset = (__pyx_t_1[0]);

    /* "View.MemoryView":703
 * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1:
 *     for suboffset in suboffsets[:ndim]:
 *         if suboffset >= 0:             # <<<<<<<<<<<<<<
 *             raise ValueError, "Indirect dimensions not supported"
 *     return 0  # return type just used as an error flag
*/
    __pyx_t_4 = (__pyx_v_suboffset >= 0);
    if (unlikely(__pyx_t_4)) {

      /* "View.MemoryView":704
 *     for suboffset in suboffsets[:ndim]:
 *         if suboffset >= 0:
 *             raise ValueError, "Indirect dimensions not supported"             # <<<<<<<<<<<<<<
 *     return 0  # return type just used as an error flag
 * 
*/
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Indirect_dimensions_not_supporte, 0, 0);
      __PYX_ERR(7, 704, __pyx_L1_error)

      /* "View.MemoryView":703
 * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1:
 *     for suboffset in suboffsets[:ndim]:
 *         if suboffset >= 0:             # <<<<<<<<<<<<<<
 *             raise ValueError, "Indirect dimensions not supported"
 *     return 0  # return type just used as an error flag
*/
    }
  }

  /* "View.MemoryView":705
 *         if suboffset >= 0:
 *             raise ValueError, "Indirect dimensions not supported"
 *     return 0  # return type just used as an error flag             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "View.MemoryView":701
 *     return have_slices or nslices, tuple(result)
 * 
 * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1:             # <<<<<<<<<<<<<<
 *     for suboffset in suboffsets[:ndim]:
 *         if suboffset >= 0:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":711
 * 
 * 
 * @cname('__pyx_memview_slice')             # <<<<<<<<<<<<<<
 * cdef memoryview memview_slice(memoryview memview, object indices):
 *     cdef int new_ndim = 0, suboffset_dim = -1, dim
*/

static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) {
  int __pyx_v_new_ndim;
  int __pyx_v_suboffset_dim;
  int __pyx_v_dim;
  __Pyx_memviewslice __pyx_v_src;
  __Pyx_memviewslice __pyx_v_dst;
  __Pyx_memviewslice *__pyx_v_p_src;
  struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0;
  __Pyx_memviewslice *__pyx_v_p_dst;
  int *__pyx_v_p_suboffset_dim;
  Py_ssize_t __pyx_v_start;
  Py_ssize_t __pyx_v_stop;
  Py_ssize_t __pyx_v_step;
  Py_ssize_t __pyx_v_cindex;
  int __pyx_v_have_start;
  int __pyx_v_have_stop;
  int __pyx_v_have_step;
  PyObject *__pyx_v_index = NULL;
  struct __pyx_memoryview_obj *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  struct __pyx_memoryview_obj *__pyx_t_3;
  char *__pyx_t_4;
  int __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyObject *__pyx_t_8 = NULL;
  Py_ssize_t __pyx_t_9;
  int __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("memview_slice", 0);

  /* "View.MemoryView":713
 * @cname('__pyx_memview_slice')
 * cdef memoryview memview_slice(memoryview memview, object indices):
 *     cdef int new_ndim = 0, suboffset_dim = -1, dim             # <<<<<<<<<<<<<<
 *     cdef bint negative_step
 *     cdef __Pyx_memviewslice src, dst
*/
  __pyx_v_new_ndim = 0;
  __pyx_v_suboffset_dim = -1;

  /* "View.MemoryView":720
 * 
 * 
 *     memset(&dst, 0, sizeof(dst))             # <<<<<<<<<<<<<<
 * 
 *     cdef _memoryviewslice memviewsliceobj
*/
  (void)(memset((&__pyx_v_dst), 0, (sizeof(__pyx_v_dst))));

  /* "View.MemoryView":724
 *     cdef _memoryviewslice memviewsliceobj
 * 
 *     assert memview.view.ndim > 0             # <<<<<<<<<<<<<<
 * 
 *     if isinstance(memview, _memoryviewslice):
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = (__pyx_v_memview->view.ndim > 0);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
      __PYX_ERR(7, 724, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(7, 724, __pyx_L1_error)
  #endif

  /* "View.MemoryView":726
 *     assert memview.view.ndim > 0
 * 
 *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
 *         memviewsliceobj = memview
 *         p_src = &memviewsliceobj.from_slice
*/
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_mstate_global->__pyx_memoryviewslice_type); 
  if (__pyx_t_1) {

    /* "View.MemoryView":727
 * 
 *     if isinstance(memview, _memoryviewslice):
 *         memviewsliceobj = memview             # <<<<<<<<<<<<<<
 *         p_src = &memviewsliceobj.from_slice
 *     else:
*/
    __pyx_t_2 = ((PyObject *)__pyx_v_memview);
    __Pyx_INCREF(__pyx_t_2);
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_memoryviewslice_type))))) __PYX_ERR(7, 727, __pyx_L1_error)
    __pyx_v_memviewsliceobj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "View.MemoryView":728
 *     if isinstance(memview, _memoryviewslice):
 *         memviewsliceobj = memview
 *         p_src = &memviewsliceobj.from_slice             # <<<<<<<<<<<<<<
 *     else:
 *         slice_copy(memview, &src)
*/
    __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice);

    /* "View.MemoryView":726
 *     assert memview.view.ndim > 0
 * 
 *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
 *         memviewsliceobj = memview
 *         p_src = &memviewsliceobj.from_slice
*/
    goto __pyx_L3;
  }

  /* "View.MemoryView":730
 *         p_src = &memviewsliceobj.from_slice
 *     else:
 *         slice_copy(memview, &src)             # <<<<<<<<<<<<<<
 *         p_src = &src
 * 
*/
  /*else*/ {
    __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src));

    /* "View.MemoryView":731
 *     else:
 *         slice_copy(memview, &src)
 *         p_src = &src             # <<<<<<<<<<<<<<
 * 
 * 
*/
    __pyx_v_p_src = (&__pyx_v_src);
  }
  __pyx_L3:;

  /* "View.MemoryView":737
 * 
 * 
 *     dst.memview = p_src.memview             # <<<<<<<<<<<<<<
 *     dst.data = p_src.data
 * 
*/
  __pyx_t_3 = __pyx_v_p_src->memview;
  __pyx_v_dst.memview = __pyx_t_3;

  /* "View.MemoryView":738
 * 
 *     dst.memview = p_src.memview
 *     dst.data = p_src.data             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_4 = __pyx_v_p_src->data;
  __pyx_v_dst.data = __pyx_t_4;

  /* "View.MemoryView":743
 * 
 * 
 *     cdef __Pyx_memviewslice *p_dst = &dst             # <<<<<<<<<<<<<<
 *     cdef int *p_suboffset_dim = &suboffset_dim
 *     cdef Py_ssize_t start, stop, step, cindex
*/
  __pyx_v_p_dst = (&__pyx_v_dst);

  /* "View.MemoryView":744
 * 
 *     cdef __Pyx_memviewslice *p_dst = &dst
 *     cdef int *p_suboffset_dim = &suboffset_dim             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t start, stop, step, cindex
 *     cdef bint have_start, have_stop, have_step
*/
  __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim);

  /* "View.MemoryView":748
 *     cdef bint have_start, have_stop, have_step
 * 
 *     for dim, index in enumerate(indices):             # <<<<<<<<<<<<<<
 *         if PyIndex_Check(index):
 *             cindex = index
*/
  __pyx_t_5 = 0;
  if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) {
    __pyx_t_2 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_2);
    __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
  } else {
    __pyx_t_6 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 748, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(7, 748, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_7)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(7, 748, __pyx_L1_error)
          #endif
          if (__pyx_t_6 >= __pyx_temp) break;
        }
        __pyx_t_8 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_6, __Pyx_ReferenceSharing_OwnStrongReference);
        ++__pyx_t_6;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(7, 748, __pyx_L1_error)
          #endif
          if (__pyx_t_6 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_8 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6));
        #else
        __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_6);
        #endif
        ++__pyx_t_6;
      }
      if (unlikely(!__pyx_t_8)) __PYX_ERR(7, 748, __pyx_L1_error)
    } else {
      __pyx_t_8 = __pyx_t_7(__pyx_t_2);
      if (unlikely(!__pyx_t_8)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(7, 748, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_8);
    __pyx_t_8 = 0;
    __pyx_v_dim = __pyx_t_5;
    __pyx_t_5 = (__pyx_t_5 + 1);

    /* "View.MemoryView":749
 * 
 *     for dim, index in enumerate(indices):
 *         if PyIndex_Check(index):             # <<<<<<<<<<<<<<
 *             cindex = index
 *             slice_memviewslice(
*/
    __pyx_t_1 = (PyIndex_Check(__pyx_v_index) != 0);
    if (__pyx_t_1) {

      /* "View.MemoryView":750
 *     for dim, index in enumerate(indices):
 *         if PyIndex_Check(index):
 *             cindex = index             # <<<<<<<<<<<<<<
 *             slice_memviewslice(
 *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
*/
      __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(7, 750, __pyx_L1_error)
      __pyx_v_cindex = __pyx_t_9;

      /* "View.MemoryView":751
 *         if PyIndex_Check(index):
 *             cindex = index
 *             slice_memviewslice(             # <<<<<<<<<<<<<<
 *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
 *                 dim, new_ndim, p_suboffset_dim,
*/
      __pyx_t_10 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_cindex, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(7, 751, __pyx_L1_error)

      /* "View.MemoryView":749
 * 
 *     for dim, index in enumerate(indices):
 *         if PyIndex_Check(index):             # <<<<<<<<<<<<<<
 *             cindex = index
 *             slice_memviewslice(
*/
      goto __pyx_L6;
    }

    /* "View.MemoryView":757
 *                 0, 0, 0, # have_{start,stop,step}
 *                 False)
 *         elif index is None:             # <<<<<<<<<<<<<<
 *             p_dst.shape[new_ndim] = 1
 *             p_dst.strides[new_ndim] = 0
*/
    __pyx_t_1 = (__pyx_v_index == Py_None);
    if (__pyx_t_1) {

      /* "View.MemoryView":758
 *                 False)
 *         elif index is None:
 *             p_dst.shape[new_ndim] = 1             # <<<<<<<<<<<<<<
 *             p_dst.strides[new_ndim] = 0
 *             p_dst.suboffsets[new_ndim] = -1
*/
      (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1;

      /* "View.MemoryView":759
 *         elif index is None:
 *             p_dst.shape[new_ndim] = 1
 *             p_dst.strides[new_ndim] = 0             # <<<<<<<<<<<<<<
 *             p_dst.suboffsets[new_ndim] = -1
 *             new_ndim += 1
*/
      (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0;

      /* "View.MemoryView":760
 *             p_dst.shape[new_ndim] = 1
 *             p_dst.strides[new_ndim] = 0
 *             p_dst.suboffsets[new_ndim] = -1             # <<<<<<<<<<<<<<
 *             new_ndim += 1
 *         else:
*/
      (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1L;

      /* "View.MemoryView":761
 *             p_dst.strides[new_ndim] = 0
 *             p_dst.suboffsets[new_ndim] = -1
 *             new_ndim += 1             # <<<<<<<<<<<<<<
 *         else:
 *             start = index.start or 0
*/
      __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);

      /* "View.MemoryView":757
 *                 0, 0, 0, # have_{start,stop,step}
 *                 False)
 *         elif index is None:             # <<<<<<<<<<<<<<
 *             p_dst.shape[new_ndim] = 1
 *             p_dst.strides[new_ndim] = 0
*/
      goto __pyx_L6;
    }

    /* "View.MemoryView":763
 *             new_ndim += 1
 *         else:
 *             start = index.start or 0             # <<<<<<<<<<<<<<
 *             stop = index.stop or 0
 *             step = index.step or 0
*/
    /*else*/ {
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_start); if (unlikely(!__pyx_t_8)) __PYX_ERR(7, 763, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(7, 763, __pyx_L1_error)
      if (!__pyx_t_1) {
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      } else {
        __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(7, 763, __pyx_L1_error)
        __pyx_t_9 = __pyx_t_11;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L7_bool_binop_done;
      }
      __pyx_t_9 = 0;
      __pyx_L7_bool_binop_done:;
      __pyx_v_start = __pyx_t_9;

      /* "View.MemoryView":764
 *         else:
 *             start = index.start or 0
 *             stop = index.stop or 0             # <<<<<<<<<<<<<<
 *             step = index.step or 0
 * 
*/
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_stop); if (unlikely(!__pyx_t_8)) __PYX_ERR(7, 764, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(7, 764, __pyx_L1_error)
      if (!__pyx_t_1) {
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      } else {
        __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(7, 764, __pyx_L1_error)
        __pyx_t_9 = __pyx_t_11;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L9_bool_binop_done;
      }
      __pyx_t_9 = 0;
      __pyx_L9_bool_binop_done:;
      __pyx_v_stop = __pyx_t_9;

      /* "View.MemoryView":765
 *             start = index.start or 0
 *             stop = index.stop or 0
 *             step = index.step or 0             # <<<<<<<<<<<<<<
 * 
 *             have_start = index.start is not None
*/
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_step); if (unlikely(!__pyx_t_8)) __PYX_ERR(7, 765, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(7, 765, __pyx_L1_error)
      if (!__pyx_t_1) {
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      } else {
        __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(7, 765, __pyx_L1_error)
        __pyx_t_9 = __pyx_t_11;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L11_bool_binop_done;
      }
      __pyx_t_9 = 0;
      __pyx_L11_bool_binop_done:;
      __pyx_v_step = __pyx_t_9;

      /* "View.MemoryView":767
 *             step = index.step or 0
 * 
 *             have_start = index.start is not None             # <<<<<<<<<<<<<<
 *             have_stop = index.stop is not None
 *             have_step = index.step is not None
*/
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_start); if (unlikely(!__pyx_t_8)) __PYX_ERR(7, 767, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_1 = (__pyx_t_8 != Py_None);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_v_have_start = __pyx_t_1;

      /* "View.MemoryView":768
 * 
 *             have_start = index.start is not None
 *             have_stop = index.stop is not None             # <<<<<<<<<<<<<<
 *             have_step = index.step is not None
 * 
*/
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_stop); if (unlikely(!__pyx_t_8)) __PYX_ERR(7, 768, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_1 = (__pyx_t_8 != Py_None);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_v_have_stop = __pyx_t_1;

      /* "View.MemoryView":769
 *             have_start = index.start is not None
 *             have_stop = index.stop is not None
 *             have_step = index.step is not None             # <<<<<<<<<<<<<<
 * 
 *             slice_memviewslice(
*/
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_step); if (unlikely(!__pyx_t_8)) __PYX_ERR(7, 769, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_1 = (__pyx_t_8 != Py_None);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_v_have_step = __pyx_t_1;

      /* "View.MemoryView":771
 *             have_step = index.step is not None
 * 
 *             slice_memviewslice(             # <<<<<<<<<<<<<<
 *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
 *                 dim, new_ndim, p_suboffset_dim,
*/
      __pyx_t_10 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(7, 771, __pyx_L1_error)

      /* "View.MemoryView":777
 *                 have_start, have_stop, have_step,
 *                 True)
 *             new_ndim += 1             # <<<<<<<<<<<<<<
 * 
 *     if isinstance(memview, _memoryviewslice):
*/
      __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
    }
    __pyx_L6:;

    /* "View.MemoryView":748
 *     cdef bint have_start, have_stop, have_step
 * 
 *     for dim, index in enumerate(indices):             # <<<<<<<<<<<<<<
 *         if PyIndex_Check(index):
 *             cindex = index
*/
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "View.MemoryView":779
 *             new_ndim += 1
 * 
 *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
 *         return memoryview_fromslice(dst, new_ndim,
 *                                     memviewsliceobj.to_object_func,
*/
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_mstate_global->__pyx_memoryviewslice_type); 
  if (__pyx_t_1) {

    /* "View.MemoryView":780
 * 
 *     if isinstance(memview, _memoryviewslice):
 *         return memoryview_fromslice(dst, new_ndim,             # <<<<<<<<<<<<<<
 *                                     memviewsliceobj.to_object_func,
 *                                     memviewsliceobj.to_dtype_func,
*/
    __Pyx_XDECREF((PyObject *)__pyx_r);

    /* "View.MemoryView":781
 *     if isinstance(memview, _memoryviewslice):
 *         return memoryview_fromslice(dst, new_ndim,
 *                                     memviewsliceobj.to_object_func,             # <<<<<<<<<<<<<<
 *                                     memviewsliceobj.to_dtype_func,
 *                                     memview.dtype_is_object)
*/
    if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(7, 781, __pyx_L1_error) }

    /* "View.MemoryView":782
 *         return memoryview_fromslice(dst, new_ndim,
 *                                     memviewsliceobj.to_object_func,
 *                                     memviewsliceobj.to_dtype_func,             # <<<<<<<<<<<<<<
 *                                     memview.dtype_is_object)
 *     else:
*/
    if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(7, 782, __pyx_L1_error) }

    /* "View.MemoryView":780
 * 
 *     if isinstance(memview, _memoryviewslice):
 *         return memoryview_fromslice(dst, new_ndim,             # <<<<<<<<<<<<<<
 *                                     memviewsliceobj.to_object_func,
 *                                     memviewsliceobj.to_dtype_func,
*/
    __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 780, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_memoryview_type))))) __PYX_ERR(7, 780, __pyx_L1_error)
    __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "View.MemoryView":779
 *             new_ndim += 1
 * 
 *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
 *         return memoryview_fromslice(dst, new_ndim,
 *                                     memviewsliceobj.to_object_func,
*/
  }

  /* "View.MemoryView":785
 *                                     memview.dtype_is_object)
 *     else:
 *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,             # <<<<<<<<<<<<<<
 *                                     memview.dtype_is_object)
 * 
*/
  /*else*/ {
    __Pyx_XDECREF((PyObject *)__pyx_r);

    /* "View.MemoryView":786
 *     else:
 *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,
 *                                     memview.dtype_is_object)             # <<<<<<<<<<<<<<
 * 
 * 
*/
    __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 785, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);

    /* "View.MemoryView":785
 *                                     memview.dtype_is_object)
 *     else:
 *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,             # <<<<<<<<<<<<<<
 *                                     memview.dtype_is_object)
 * 
*/
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_memoryview_type))))) __PYX_ERR(7, 785, __pyx_L1_error)
    __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "View.MemoryView":711
 * 
 * 
 * @cname('__pyx_memview_slice')             # <<<<<<<<<<<<<<
 * cdef memoryview memview_slice(memoryview memview, object indices):
 *     cdef int new_ndim = 0, suboffset_dim = -1, dim
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj);
  __Pyx_XDECREF(__pyx_v_index);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":793
 * 
 * 
 * @cname('__pyx_memoryview_slice_memviewslice')             # <<<<<<<<<<<<<<
 * cdef int slice_memviewslice(
 *         __Pyx_memviewslice *dst,
*/

static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, Py_ssize_t __pyx_v_shape, Py_ssize_t __pyx_v_stride, Py_ssize_t __pyx_v_suboffset, int __pyx_v_dim, int __pyx_v_new_ndim, int *__pyx_v_suboffset_dim, Py_ssize_t __pyx_v_start, Py_ssize_t __pyx_v_stop, Py_ssize_t __pyx_v_step, int __pyx_v_have_start, int __pyx_v_have_stop, int __pyx_v_have_step, int __pyx_v_is_slice) {
  Py_ssize_t __pyx_v_new_shape;
  int __pyx_v_negative_step;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save;

  /* "View.MemoryView":814
 *     cdef bint negative_step
 * 
 *     if not is_slice:             # <<<<<<<<<<<<<<
 * 
 *         if start < 0:
*/
  __pyx_t_1 = (!__pyx_v_is_slice);
  if (__pyx_t_1) {

    /* "View.MemoryView":816
 *     if not is_slice:
 * 
 *         if start < 0:             # <<<<<<<<<<<<<<
 *             start += shape
 *         if not 0 <= start < shape:
*/
    __pyx_t_1 = (__pyx_v_start < 0);
    if (__pyx_t_1) {

      /* "View.MemoryView":817
 * 
 *         if start < 0:
 *             start += shape             # <<<<<<<<<<<<<<
 *         if not 0 <= start < shape:
 *             _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim)
*/
      __pyx_v_start = (__pyx_v_start + __pyx_v_shape);

      /* "View.MemoryView":816
 *     if not is_slice:
 * 
 *         if start < 0:             # <<<<<<<<<<<<<<
 *             start += shape
 *         if not 0 <= start < shape:
*/
    }

    /* "View.MemoryView":818
 *         if start < 0:
 *             start += shape
 *         if not 0 <= start < shape:             # <<<<<<<<<<<<<<
 *             _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim)
 *     else:
*/
    __pyx_t_1 = (0 <= __pyx_v_start);
    if (__pyx_t_1) {
      __pyx_t_1 = (__pyx_v_start < __pyx_v_shape);
    }
    __pyx_t_2 = (!__pyx_t_1);
    if (__pyx_t_2) {

      /* "View.MemoryView":819
 *             start += shape
 *         if not 0 <= start < shape:
 *             _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim)             # <<<<<<<<<<<<<<
 *     else:
 * 
*/
      __pyx_t_3 = __pyx_memoryview_err_dim(PyExc_IndexError, __pyx_mstate_global->__pyx_kp_u_Index_out_of_bounds_axis_d, __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(7, 819, __pyx_L1_error)

      /* "View.MemoryView":818
 *         if start < 0:
 *             start += shape
 *         if not 0 <= start < shape:             # <<<<<<<<<<<<<<
 *             _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim)
 *     else:
*/
    }

    /* "View.MemoryView":814
 *     cdef bint negative_step
 * 
 *     if not is_slice:             # <<<<<<<<<<<<<<
 * 
 *         if start < 0:
*/
    goto __pyx_L3;
  }

  /* "View.MemoryView":822
 *     else:
 * 
 *         if have_step:             # <<<<<<<<<<<<<<
 *             negative_step = step < 0
 *             if step == 0:
*/
  /*else*/ {
    __pyx_t_2 = (__pyx_v_have_step != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":823
 * 
 *         if have_step:
 *             negative_step = step < 0             # <<<<<<<<<<<<<<
 *             if step == 0:
 *                 _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim)
*/
      __pyx_v_negative_step = (__pyx_v_step < 0);

      /* "View.MemoryView":824
 *         if have_step:
 *             negative_step = step < 0
 *             if step == 0:             # <<<<<<<<<<<<<<
 *                 _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim)
 *         else:
*/
      __pyx_t_2 = (__pyx_v_step == 0);
      if (__pyx_t_2) {

        /* "View.MemoryView":825
 *             negative_step = step < 0
 *             if step == 0:
 *                 _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim)             # <<<<<<<<<<<<<<
 *         else:
 *             negative_step = False
*/
        __pyx_t_3 = __pyx_memoryview_err_dim(PyExc_ValueError, __pyx_mstate_global->__pyx_kp_u_Step_may_not_be_zero_axis_d, __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(7, 825, __pyx_L1_error)

        /* "View.MemoryView":824
 *         if have_step:
 *             negative_step = step < 0
 *             if step == 0:             # <<<<<<<<<<<<<<
 *                 _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim)
 *         else:
*/
      }

      /* "View.MemoryView":822
 *     else:
 * 
 *         if have_step:             # <<<<<<<<<<<<<<
 *             negative_step = step < 0
 *             if step == 0:
*/
      goto __pyx_L6;
    }

    /* "View.MemoryView":827
 *                 _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim)
 *         else:
 *             negative_step = False             # <<<<<<<<<<<<<<
 *             step = 1
 * 
*/
    /*else*/ {
      __pyx_v_negative_step = 0;

      /* "View.MemoryView":828
 *         else:
 *             negative_step = False
 *             step = 1             # <<<<<<<<<<<<<<
 * 
 * 
*/
      __pyx_v_step = 1;
    }
    __pyx_L6:;

    /* "View.MemoryView":831
 * 
 * 
 *         if have_start:             # <<<<<<<<<<<<<<
 *             if start < 0:
 *                 start += shape
*/
    __pyx_t_2 = (__pyx_v_have_start != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":832
 * 
 *         if have_start:
 *             if start < 0:             # <<<<<<<<<<<<<<
 *                 start += shape
 *                 if start < 0:
*/
      __pyx_t_2 = (__pyx_v_start < 0);
      if (__pyx_t_2) {

        /* "View.MemoryView":833
 *         if have_start:
 *             if start < 0:
 *                 start += shape             # <<<<<<<<<<<<<<
 *                 if start < 0:
 *                     start = 0
*/
        __pyx_v_start = (__pyx_v_start + __pyx_v_shape);

        /* "View.MemoryView":834
 *             if start < 0:
 *                 start += shape
 *                 if start < 0:             # <<<<<<<<<<<<<<
 *                     start = 0
 *             elif start >= shape:
*/
        __pyx_t_2 = (__pyx_v_start < 0);
        if (__pyx_t_2) {

          /* "View.MemoryView":835
 *                 start += shape
 *                 if start < 0:
 *                     start = 0             # <<<<<<<<<<<<<<
 *             elif start >= shape:
 *                 if negative_step:
*/
          __pyx_v_start = 0;

          /* "View.MemoryView":834
 *             if start < 0:
 *                 start += shape
 *                 if start < 0:             # <<<<<<<<<<<<<<
 *                     start = 0
 *             elif start >= shape:
*/
        }

        /* "View.MemoryView":832
 * 
 *         if have_start:
 *             if start < 0:             # <<<<<<<<<<<<<<
 *                 start += shape
 *                 if start < 0:
*/
        goto __pyx_L9;
      }

      /* "View.MemoryView":836
 *                 if start < 0:
 *                     start = 0
 *             elif start >= shape:             # <<<<<<<<<<<<<<
 *                 if negative_step:
 *                     start = shape - 1
*/
      __pyx_t_2 = (__pyx_v_start >= __pyx_v_shape);
      if (__pyx_t_2) {

        /* "View.MemoryView":837
 *                     start = 0
 *             elif start >= shape:
 *                 if negative_step:             # <<<<<<<<<<<<<<
 *                     start = shape - 1
 *                 else:
*/
        if (__pyx_v_negative_step) {

          /* "View.MemoryView":838
 *             elif start >= shape:
 *                 if negative_step:
 *                     start = shape - 1             # <<<<<<<<<<<<<<
 *                 else:
 *                     start = shape
*/
          __pyx_v_start = (__pyx_v_shape - 1);

          /* "View.MemoryView":837
 *                     start = 0
 *             elif start >= shape:
 *                 if negative_step:             # <<<<<<<<<<<<<<
 *                     start = shape - 1
 *                 else:
*/
          goto __pyx_L11;
        }

        /* "View.MemoryView":840
 *                     start = shape - 1
 *                 else:
 *                     start = shape             # <<<<<<<<<<<<<<
 *         else:
 *             if negative_step:
*/
        /*else*/ {
          __pyx_v_start = __pyx_v_shape;
        }
        __pyx_L11:;

        /* "View.MemoryView":836
 *                 if start < 0:
 *                     start = 0
 *             elif start >= shape:             # <<<<<<<<<<<<<<
 *                 if negative_step:
 *                     start = shape - 1
*/
      }
      __pyx_L9:;

      /* "View.MemoryView":831
 * 
 * 
 *         if have_start:             # <<<<<<<<<<<<<<
 *             if start < 0:
 *                 start += shape
*/
      goto __pyx_L8;
    }

    /* "View.MemoryView":842
 *                     start = shape
 *         else:
 *             if negative_step:             # <<<<<<<<<<<<<<
 *                 start = shape - 1
 *             else:
*/
    /*else*/ {
      if (__pyx_v_negative_step) {

        /* "View.MemoryView":843
 *         else:
 *             if negative_step:
 *                 start = shape - 1             # <<<<<<<<<<<<<<
 *             else:
 *                 start = 0
*/
        __pyx_v_start = (__pyx_v_shape - 1);

        /* "View.MemoryView":842
 *                     start = shape
 *         else:
 *             if negative_step:             # <<<<<<<<<<<<<<
 *                 start = shape - 1
 *             else:
*/
        goto __pyx_L12;
      }

      /* "View.MemoryView":845
 *                 start = shape - 1
 *             else:
 *                 start = 0             # <<<<<<<<<<<<<<
 * 
 *         if have_stop:
*/
      /*else*/ {
        __pyx_v_start = 0;
      }
      __pyx_L12:;
    }
    __pyx_L8:;

    /* "View.MemoryView":847
 *                 start = 0
 * 
 *         if have_stop:             # <<<<<<<<<<<<<<
 *             if stop < 0:
 *                 stop += shape
*/
    __pyx_t_2 = (__pyx_v_have_stop != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":848
 * 
 *         if have_stop:
 *             if stop < 0:             # <<<<<<<<<<<<<<
 *                 stop += shape
 *                 if stop < 0:
*/
      __pyx_t_2 = (__pyx_v_stop < 0);
      if (__pyx_t_2) {

        /* "View.MemoryView":849
 *         if have_stop:
 *             if stop < 0:
 *                 stop += shape             # <<<<<<<<<<<<<<
 *                 if stop < 0:
 *                     stop = 0
*/
        __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape);

        /* "View.MemoryView":850
 *             if stop < 0:
 *                 stop += shape
 *                 if stop < 0:             # <<<<<<<<<<<<<<
 *                     stop = 0
 *             elif stop > shape:
*/
        __pyx_t_2 = (__pyx_v_stop < 0);
        if (__pyx_t_2) {

          /* "View.MemoryView":851
 *                 stop += shape
 *                 if stop < 0:
 *                     stop = 0             # <<<<<<<<<<<<<<
 *             elif stop > shape:
 *                 stop = shape
*/
          __pyx_v_stop = 0;

          /* "View.MemoryView":850
 *             if stop < 0:
 *                 stop += shape
 *                 if stop < 0:             # <<<<<<<<<<<<<<
 *                     stop = 0
 *             elif stop > shape:
*/
        }

        /* "View.MemoryView":848
 * 
 *         if have_stop:
 *             if stop < 0:             # <<<<<<<<<<<<<<
 *                 stop += shape
 *                 if stop < 0:
*/
        goto __pyx_L14;
      }

      /* "View.MemoryView":852
 *                 if stop < 0:
 *                     stop = 0
 *             elif stop > shape:             # <<<<<<<<<<<<<<
 *                 stop = shape
 *         else:
*/
      __pyx_t_2 = (__pyx_v_stop > __pyx_v_shape);
      if (__pyx_t_2) {

        /* "View.MemoryView":853
 *                     stop = 0
 *             elif stop > shape:
 *                 stop = shape             # <<<<<<<<<<<<<<
 *         else:
 *             if negative_step:
*/
        __pyx_v_stop = __pyx_v_shape;

        /* "View.MemoryView":852
 *                 if stop < 0:
 *                     stop = 0
 *             elif stop > shape:             # <<<<<<<<<<<<<<
 *                 stop = shape
 *         else:
*/
      }
      __pyx_L14:;

      /* "View.MemoryView":847
 *                 start = 0
 * 
 *         if have_stop:             # <<<<<<<<<<<<<<
 *             if stop < 0:
 *                 stop += shape
*/
      goto __pyx_L13;
    }

    /* "View.MemoryView":855
 *                 stop = shape
 *         else:
 *             if negative_step:             # <<<<<<<<<<<<<<
 *                 stop = -1
 *             else:
*/
    /*else*/ {
      if (__pyx_v_negative_step) {

        /* "View.MemoryView":856
 *         else:
 *             if negative_step:
 *                 stop = -1             # <<<<<<<<<<<<<<
 *             else:
 *                 stop = shape
*/
        __pyx_v_stop = -1L;

        /* "View.MemoryView":855
 *                 stop = shape
 *         else:
 *             if negative_step:             # <<<<<<<<<<<<<<
 *                 stop = -1
 *             else:
*/
        goto __pyx_L16;
      }

      /* "View.MemoryView":858
 *                 stop = -1
 *             else:
 *                 stop = shape             # <<<<<<<<<<<<<<
 * 
 * 
*/
      /*else*/ {
        __pyx_v_stop = __pyx_v_shape;
      }
      __pyx_L16:;
    }
    __pyx_L13:;

    /* "View.MemoryView":862
 * 
 *         with cython.cdivision(True):
 *             new_shape = (stop - start) // step             # <<<<<<<<<<<<<<
 * 
 *             if (stop - start) - step * new_shape:
*/
    __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step);

    /* "View.MemoryView":864
 *             new_shape = (stop - start) // step
 * 
 *             if (stop - start) - step * new_shape:             # <<<<<<<<<<<<<<
 *                 new_shape += 1
 * 
*/
    __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":865
 * 
 *             if (stop - start) - step * new_shape:
 *                 new_shape += 1             # <<<<<<<<<<<<<<
 * 
 *         if new_shape < 0:
*/
      __pyx_v_new_shape = (__pyx_v_new_shape + 1);

      /* "View.MemoryView":864
 *             new_shape = (stop - start) // step
 * 
 *             if (stop - start) - step * new_shape:             # <<<<<<<<<<<<<<
 *                 new_shape += 1
 * 
*/
    }

    /* "View.MemoryView":867
 *                 new_shape += 1
 * 
 *         if new_shape < 0:             # <<<<<<<<<<<<<<
 *             new_shape = 0
 * 
*/
    __pyx_t_2 = (__pyx_v_new_shape < 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":868
 * 
 *         if new_shape < 0:
 *             new_shape = 0             # <<<<<<<<<<<<<<
 * 
 * 
*/
      __pyx_v_new_shape = 0;

      /* "View.MemoryView":867
 *                 new_shape += 1
 * 
 *         if new_shape < 0:             # <<<<<<<<<<<<<<
 *             new_shape = 0
 * 
*/
    }

    /* "View.MemoryView":871
 * 
 * 
 *         dst.strides[new_ndim] = stride * step             # <<<<<<<<<<<<<<
 *         dst.shape[new_ndim] = new_shape
 *         dst.suboffsets[new_ndim] = suboffset
*/
    (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step);

    /* "View.MemoryView":872
 * 
 *         dst.strides[new_ndim] = stride * step
 *         dst.shape[new_ndim] = new_shape             # <<<<<<<<<<<<<<
 *         dst.suboffsets[new_ndim] = suboffset
 * 
*/
    (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape;

    /* "View.MemoryView":873
 *         dst.strides[new_ndim] = stride * step
 *         dst.shape[new_ndim] = new_shape
 *         dst.suboffsets[new_ndim] = suboffset             # <<<<<<<<<<<<<<
 * 
 * 
*/
    (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset;
  }
  __pyx_L3:;

  /* "View.MemoryView":876
 * 
 * 
 *     if suboffset_dim[0] < 0:             # <<<<<<<<<<<<<<
 *         dst.data += start * stride
 *     else:
*/
  __pyx_t_2 = ((__pyx_v_suboffset_dim[0]) < 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":877
 * 
 *     if suboffset_dim[0] < 0:
 *         dst.data += start * stride             # <<<<<<<<<<<<<<
 *     else:
 *         dst.suboffsets[suboffset_dim[0]] += start * stride
*/
    __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride));

    /* "View.MemoryView":876
 * 
 * 
 *     if suboffset_dim[0] < 0:             # <<<<<<<<<<<<<<
 *         dst.data += start * stride
 *     else:
*/
    goto __pyx_L19;
  }

  /* "View.MemoryView":879
 *         dst.data += start * stride
 *     else:
 *         dst.suboffsets[suboffset_dim[0]] += start * stride             # <<<<<<<<<<<<<<
 * 
 *     if suboffset >= 0:
*/
  /*else*/ {
    __pyx_t_3 = (__pyx_v_suboffset_dim[0]);
    (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride));
  }
  __pyx_L19:;

  /* "View.MemoryView":881
 *         dst.suboffsets[suboffset_dim[0]] += start * stride
 * 
 *     if suboffset >= 0:             # <<<<<<<<<<<<<<
 *         if not is_slice:
 *             if new_ndim == 0:
*/
  __pyx_t_2 = (__pyx_v_suboffset >= 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":882
 * 
 *     if suboffset >= 0:
 *         if not is_slice:             # <<<<<<<<<<<<<<
 *             if new_ndim == 0:
 *                 dst.data = (<char **> dst.data)[0] + suboffset
*/
    __pyx_t_2 = (!__pyx_v_is_slice);
    if (__pyx_t_2) {

      /* "View.MemoryView":883
 *     if suboffset >= 0:
 *         if not is_slice:
 *             if new_ndim == 0:             # <<<<<<<<<<<<<<
 *                 dst.data = (<char **> dst.data)[0] + suboffset
 *             else:
*/
      __pyx_t_2 = (__pyx_v_new_ndim == 0);
      if (__pyx_t_2) {

        /* "View.MemoryView":884
 *         if not is_slice:
 *             if new_ndim == 0:
 *                 dst.data = (<char **> dst.data)[0] + suboffset             # <<<<<<<<<<<<<<
 *             else:
 *                 _err_dim(PyExc_IndexError, "All dimensions preceding dimension %d "
*/
        __pyx_v_dst->data = ((((char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset);

        /* "View.MemoryView":883
 *     if suboffset >= 0:
 *         if not is_slice:
 *             if new_ndim == 0:             # <<<<<<<<<<<<<<
 *                 dst.data = (<char **> dst.data)[0] + suboffset
 *             else:
*/
        goto __pyx_L22;
      }

      /* "View.MemoryView":886
 *                 dst.data = (<char **> dst.data)[0] + suboffset
 *             else:
 *                 _err_dim(PyExc_IndexError, "All dimensions preceding dimension %d "             # <<<<<<<<<<<<<<
 *                                      "must be indexed and not sliced", dim)
 *         else:
*/
      /*else*/ {

        /* "View.MemoryView":887
 *             else:
 *                 _err_dim(PyExc_IndexError, "All dimensions preceding dimension %d "
 *                                      "must be indexed and not sliced", dim)             # <<<<<<<<<<<<<<
 *         else:
 *             suboffset_dim[0] = new_ndim
*/
        __pyx_t_3 = __pyx_memoryview_err_dim(PyExc_IndexError, __pyx_mstate_global->__pyx_kp_u_All_dimensions_preceding_dimensi, __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(7, 886, __pyx_L1_error)
      }
      __pyx_L22:;

      /* "View.MemoryView":882
 * 
 *     if suboffset >= 0:
 *         if not is_slice:             # <<<<<<<<<<<<<<
 *             if new_ndim == 0:
 *                 dst.data = (<char **> dst.data)[0] + suboffset
*/
      goto __pyx_L21;
    }

    /* "View.MemoryView":889
 *                                      "must be indexed and not sliced", dim)
 *         else:
 *             suboffset_dim[0] = new_ndim             # <<<<<<<<<<<<<<
 * 
 *     return 0
*/
    /*else*/ {
      (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim;
    }
    __pyx_L21:;

    /* "View.MemoryView":881
 *         dst.suboffsets[suboffset_dim[0]] += start * stride
 * 
 *     if suboffset >= 0:             # <<<<<<<<<<<<<<
 *         if not is_slice:
 *             if new_ndim == 0:
*/
  }

  /* "View.MemoryView":891
 *             suboffset_dim[0] = new_ndim
 * 
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "View.MemoryView":793
 * 
 * 
 * @cname('__pyx_memoryview_slice_memviewslice')             # <<<<<<<<<<<<<<
 * cdef int slice_memviewslice(
 *         __Pyx_memviewslice *dst,
*/

  /* function exit code */
  __pyx_L1_error:;
  __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_AddTraceback("View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":896
 * 
 * 
 * @cname('__pyx_pybuffer_index')             # <<<<<<<<<<<<<<
 * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,
 *                           Py_ssize_t dim) except NULL:
*/

static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, Py_ssize_t __pyx_v_dim) {
  Py_ssize_t __pyx_v_shape;
  Py_ssize_t __pyx_v_stride;
  Py_ssize_t __pyx_v_suboffset;
  Py_ssize_t __pyx_v_itemsize;
  char *__pyx_v_resultp;
  char *__pyx_r;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4[3];
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("pybuffer_index", 0);

  /* "View.MemoryView":899
 * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,
 *                           Py_ssize_t dim) except NULL:
 *     cdef Py_ssize_t shape, stride, suboffset = -1             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t itemsize = view.itemsize
 *     cdef char *resultp
*/
  __pyx_v_suboffset = -1L;

  /* "View.MemoryView":900
 *                           Py_ssize_t dim) except NULL:
 *     cdef Py_ssize_t shape, stride, suboffset = -1
 *     cdef Py_ssize_t itemsize = view.itemsize             # <<<<<<<<<<<<<<
 *     cdef char *resultp
 * 
*/
  __pyx_t_1 = __pyx_v_view->itemsize;
  __pyx_v_itemsize = __pyx_t_1;

  /* "View.MemoryView":903
 *     cdef char *resultp
 * 
 *     if view.ndim == 0:             # <<<<<<<<<<<<<<
 *         shape = view.len // itemsize
 *         stride = itemsize
*/
  __pyx_t_2 = (__pyx_v_view->ndim == 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":904
 * 
 *     if view.ndim == 0:
 *         shape = view.len // itemsize             # <<<<<<<<<<<<<<
 *         stride = itemsize
 *     else:
*/
    if (unlikely(__pyx_v_itemsize == 0)) {
      PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
      __PYX_ERR(7, 904, __pyx_L1_error)
    }
    else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1)  && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) {
      PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
      __PYX_ERR(7, 904, __pyx_L1_error)
    }
    __pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize, 0);

    /* "View.MemoryView":905
 *     if view.ndim == 0:
 *         shape = view.len // itemsize
 *         stride = itemsize             # <<<<<<<<<<<<<<
 *     else:
 *         shape = view.shape[dim]
*/
    __pyx_v_stride = __pyx_v_itemsize;

    /* "View.MemoryView":903
 *     cdef char *resultp
 * 
 *     if view.ndim == 0:             # <<<<<<<<<<<<<<
 *         shape = view.len // itemsize
 *         stride = itemsize
*/
    goto __pyx_L3;
  }

  /* "View.MemoryView":907
 *         stride = itemsize
 *     else:
 *         shape = view.shape[dim]             # <<<<<<<<<<<<<<
 *         stride = view.strides[dim]
 *         if view.suboffsets != NULL:
*/
  /*else*/ {
    __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]);

    /* "View.MemoryView":908
 *     else:
 *         shape = view.shape[dim]
 *         stride = view.strides[dim]             # <<<<<<<<<<<<<<
 *         if view.suboffsets != NULL:
 *             suboffset = view.suboffsets[dim]
*/
    __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]);

    /* "View.MemoryView":909
 *         shape = view.shape[dim]
 *         stride = view.strides[dim]
 *         if view.suboffsets != NULL:             # <<<<<<<<<<<<<<
 *             suboffset = view.suboffsets[dim]
 * 
*/
    __pyx_t_2 = (__pyx_v_view->suboffsets != NULL);
    if (__pyx_t_2) {

      /* "View.MemoryView":910
 *         stride = view.strides[dim]
 *         if view.suboffsets != NULL:
 *             suboffset = view.suboffsets[dim]             # <<<<<<<<<<<<<<
 * 
 *     if index < 0:
*/
      __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]);

      /* "View.MemoryView":909
 *         shape = view.shape[dim]
 *         stride = view.strides[dim]
 *         if view.suboffsets != NULL:             # <<<<<<<<<<<<<<
 *             suboffset = view.suboffsets[dim]
 * 
*/
    }
  }
  __pyx_L3:;

  /* "View.MemoryView":912
 *             suboffset = view.suboffsets[dim]
 * 
 *     if index < 0:             # <<<<<<<<<<<<<<
 *         index += view.shape[dim]
 *         if index < 0:
*/
  __pyx_t_2 = (__pyx_v_index < 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":913
 * 
 *     if index < 0:
 *         index += view.shape[dim]             # <<<<<<<<<<<<<<
 *         if index < 0:
 *             raise IndexError, f"Out of bounds on buffer access (axis {dim})"
*/
    __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim]));

    /* "View.MemoryView":914
 *     if index < 0:
 *         index += view.shape[dim]
 *         if index < 0:             # <<<<<<<<<<<<<<
 *             raise IndexError, f"Out of bounds on buffer access (axis {dim})"
 * 
*/
    __pyx_t_2 = (__pyx_v_index < 0);
    if (unlikely(__pyx_t_2)) {

      /* "View.MemoryView":915
 *         index += view.shape[dim]
 *         if index < 0:
 *             raise IndexError, f"Out of bounds on buffer access (axis {dim})"             # <<<<<<<<<<<<<<
 * 
 *     if index >= shape:
*/
      __pyx_t_3 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 915, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u_Out_of_bounds_on_buffer_access_a;
      __pyx_t_4[1] = __pyx_t_3;
      __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u__5;
      __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, 37 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 1, 127);
      if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 915, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_IndexError))), __pyx_t_5, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __PYX_ERR(7, 915, __pyx_L1_error)

      /* "View.MemoryView":914
 *     if index < 0:
 *         index += view.shape[dim]
 *         if index < 0:             # <<<<<<<<<<<<<<
 *             raise IndexError, f"Out of bounds on buffer access (axis {dim})"
 * 
*/
    }

    /* "View.MemoryView":912
 *             suboffset = view.suboffsets[dim]
 * 
 *     if index < 0:             # <<<<<<<<<<<<<<
 *         index += view.shape[dim]
 *         if index < 0:
*/
  }

  /* "View.MemoryView":917
 *             raise IndexError, f"Out of bounds on buffer access (axis {dim})"
 * 
 *     if index >= shape:             # <<<<<<<<<<<<<<
 *         raise IndexError, f"Out of bounds on buffer access (axis {dim})"
 * 
*/
  __pyx_t_2 = (__pyx_v_index >= __pyx_v_shape);
  if (unlikely(__pyx_t_2)) {

    /* "View.MemoryView":918
 * 
 *     if index >= shape:
 *         raise IndexError, f"Out of bounds on buffer access (axis {dim})"             # <<<<<<<<<<<<<<
 * 
 *     resultp = bufp + index * stride
*/
    __pyx_t_5 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 918, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u_Out_of_bounds_on_buffer_access_a;
    __pyx_t_4[1] = __pyx_t_5;
    __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u__5;
    __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, 37 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 1, 127);
    if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 918, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_IndexError))), __pyx_t_3, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(7, 918, __pyx_L1_error)

    /* "View.MemoryView":917
 *             raise IndexError, f"Out of bounds on buffer access (axis {dim})"
 * 
 *     if index >= shape:             # <<<<<<<<<<<<<<
 *         raise IndexError, f"Out of bounds on buffer access (axis {dim})"
 * 
*/
  }

  /* "View.MemoryView":920
 *         raise IndexError, f"Out of bounds on buffer access (axis {dim})"
 * 
 *     resultp = bufp + index * stride             # <<<<<<<<<<<<<<
 *     if suboffset >= 0:
 *         resultp = (<char **> resultp)[0] + suboffset
*/
  __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride));

  /* "View.MemoryView":921
 * 
 *     resultp = bufp + index * stride
 *     if suboffset >= 0:             # <<<<<<<<<<<<<<
 *         resultp = (<char **> resultp)[0] + suboffset
 * 
*/
  __pyx_t_2 = (__pyx_v_suboffset >= 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":922
 *     resultp = bufp + index * stride
 *     if suboffset >= 0:
 *         resultp = (<char **> resultp)[0] + suboffset             # <<<<<<<<<<<<<<
 * 
 *     return resultp
*/
    __pyx_v_resultp = ((((char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset);

    /* "View.MemoryView":921
 * 
 *     resultp = bufp + index * stride
 *     if suboffset >= 0:             # <<<<<<<<<<<<<<
 *         resultp = (<char **> resultp)[0] + suboffset
 * 
*/
  }

  /* "View.MemoryView":924
 *         resultp = (<char **> resultp)[0] + suboffset
 * 
 *     return resultp             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = __pyx_v_resultp;
  goto __pyx_L0;

  /* "View.MemoryView":896
 * 
 * 
 * @cname('__pyx_pybuffer_index')             # <<<<<<<<<<<<<<
 * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,
 *                           Py_ssize_t dim) except NULL:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":929
 * 
 * 
 * @cname('__pyx_memslice_transpose')             # <<<<<<<<<<<<<<
 * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil:
 *     cdef int ndim = memslice.memview.view.ndim
*/

static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  int __pyx_v_ndim;
  Py_ssize_t *__pyx_v_shape;
  Py_ssize_t *__pyx_v_strides;
  int __pyx_v_i;
  int __pyx_v_j;
  int __pyx_r;
  int __pyx_t_1;
  Py_ssize_t *__pyx_t_2;
  long __pyx_t_3;
  long __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save;

  /* "View.MemoryView":931
 * @cname('__pyx_memslice_transpose')
 * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil:
 *     cdef int ndim = memslice.memview.view.ndim             # <<<<<<<<<<<<<<
 * 
 *     cdef Py_ssize_t *shape = memslice.shape
*/
  __pyx_t_1 = __pyx_v_memslice->memview->view.ndim;
  __pyx_v_ndim = __pyx_t_1;

  /* "View.MemoryView":933
 *     cdef int ndim = memslice.memview.view.ndim
 * 
 *     cdef Py_ssize_t *shape = memslice.shape             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t *strides = memslice.strides
 * 
*/
  __pyx_t_2 = __pyx_v_memslice->shape;
  __pyx_v_shape = __pyx_t_2;

  /* "View.MemoryView":934
 * 
 *     cdef Py_ssize_t *shape = memslice.shape
 *     cdef Py_ssize_t *strides = memslice.strides             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_2 = __pyx_v_memslice->strides;
  __pyx_v_strides = __pyx_t_2;

  /* "View.MemoryView":938
 * 
 *     cdef int i, j
 *     for i in range(ndim // 2):             # <<<<<<<<<<<<<<
 *         j = ndim - 1 - i
 *         strides[i], strides[j] = strides[j], strides[i]
*/
  __pyx_t_3 = __Pyx_div_long(__pyx_v_ndim, 2, 1);
  __pyx_t_4 = __pyx_t_3;
  for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) {
    __pyx_v_i = __pyx_t_1;

    /* "View.MemoryView":939
 *     cdef int i, j
 *     for i in range(ndim // 2):
 *         j = ndim - 1 - i             # <<<<<<<<<<<<<<
 *         strides[i], strides[j] = strides[j], strides[i]
 *         shape[i], shape[j] = shape[j], shape[i]
*/
    __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i);

    /* "View.MemoryView":940
 *     for i in range(ndim // 2):
 *         j = ndim - 1 - i
 *         strides[i], strides[j] = strides[j], strides[i]             # <<<<<<<<<<<<<<
 *         shape[i], shape[j] = shape[j], shape[i]
 * 
*/
    __pyx_t_5 = (__pyx_v_strides[__pyx_v_j]);
    __pyx_t_6 = (__pyx_v_strides[__pyx_v_i]);
    (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5;
    (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6;

    /* "View.MemoryView":941
 *         j = ndim - 1 - i
 *         strides[i], strides[j] = strides[j], strides[i]
 *         shape[i], shape[j] = shape[j], shape[i]             # <<<<<<<<<<<<<<
 * 
 *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
*/
    __pyx_t_6 = (__pyx_v_shape[__pyx_v_j]);
    __pyx_t_5 = (__pyx_v_shape[__pyx_v_i]);
    (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6;
    (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5;

    /* "View.MemoryView":943
 *         shape[i], shape[j] = shape[j], shape[i]
 * 
 *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:             # <<<<<<<<<<<<<<
 *             _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions")
 * 
*/
    __pyx_t_8 = ((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0);
    if (!__pyx_t_8) {
    } else {
      __pyx_t_7 = __pyx_t_8;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_8 = ((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0);
    __pyx_t_7 = __pyx_t_8;
    __pyx_L6_bool_binop_done:;
    if (__pyx_t_7) {

      /* "View.MemoryView":944
 * 
 *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
 *             _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions")             # <<<<<<<<<<<<<<
 * 
 *     return 0
*/
      __pyx_t_9 = __pyx_memoryview_err(PyExc_ValueError, __pyx_mstate_global->__pyx_kp_u_Cannot_transpose_memoryview_with); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(7, 944, __pyx_L1_error)

      /* "View.MemoryView":943
 *         shape[i], shape[j] = shape[j], shape[i]
 * 
 *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:             # <<<<<<<<<<<<<<
 *             _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions")
 * 
*/
    }
  }

  /* "View.MemoryView":946
 *             _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions")
 * 
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "View.MemoryView":929
 * 
 * 
 * @cname('__pyx_memslice_transpose')             # <<<<<<<<<<<<<<
 * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil:
 *     cdef int ndim = memslice.memview.view.ndim
*/

  /* function exit code */
  __pyx_L1_error:;
  __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_AddTraceback("View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":964
 *     cdef int (*to_dtype_func)(char *, object) except 0
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1)
 * 
*/

/* Python wrapper */
static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self) {

  /* "View.MemoryView":965
 * 
 *     def __dealloc__(self):
 *         __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1)             # <<<<<<<<<<<<<<
 * 
 *     cdef convert_item_to_object(self, char *itemp):
*/
  __PYX_XCLEAR_MEMVIEW((&__pyx_v_self->from_slice), 1);

  /* "View.MemoryView":964
 *     cdef int (*to_dtype_func)(char *, object) except 0
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1)
 * 
*/

  /* function exit code */
}

/* "View.MemoryView":967
 *         __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1)
 * 
 *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
 *         if self.to_object_func != NULL:
 *             return self.to_object_func(itemp)
*/

static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("convert_item_to_object", 0);

  /* "View.MemoryView":968
 * 
 *     cdef convert_item_to_object(self, char *itemp):
 *         if self.to_object_func != NULL:             # <<<<<<<<<<<<<<
 *             return self.to_object_func(itemp)
 *         else:
*/
  __pyx_t_1 = (__pyx_v_self->to_object_func != NULL);
  if (__pyx_t_1) {

    /* "View.MemoryView":969
 *     cdef convert_item_to_object(self, char *itemp):
 *         if self.to_object_func != NULL:
 *             return self.to_object_func(itemp)             # <<<<<<<<<<<<<<
 *         else:
 *             return memoryview.convert_item_to_object(self, itemp)
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 969, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "View.MemoryView":968
 * 
 *     cdef convert_item_to_object(self, char *itemp):
 *         if self.to_object_func != NULL:             # <<<<<<<<<<<<<<
 *             return self.to_object_func(itemp)
 *         else:
*/
  }

  /* "View.MemoryView":971
 *             return self.to_object_func(itemp)
 *         else:
 *             return memoryview.convert_item_to_object(self, itemp)             # <<<<<<<<<<<<<<
 * 
 *     cdef assign_item_from_object(self, char *itemp, object value):
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __pyx_memoryview_convert_item_to_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 971, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "View.MemoryView":967
 *         __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1)
 * 
 *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
 *         if self.to_object_func != NULL:
 *             return self.to_object_func(itemp)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":973
 *             return memoryview.convert_item_to_object(self, itemp)
 * 
 *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
 *         if self.to_dtype_func != NULL:
 *             self.to_dtype_func(itemp, value)
*/

static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("assign_item_from_object", 0);

  /* "View.MemoryView":974
 * 
 *     cdef assign_item_from_object(self, char *itemp, object value):
 *         if self.to_dtype_func != NULL:             # <<<<<<<<<<<<<<
 *             self.to_dtype_func(itemp, value)
 *         else:
*/
  __pyx_t_1 = (__pyx_v_self->to_dtype_func != NULL);
  if (__pyx_t_1) {

    /* "View.MemoryView":975
 *     cdef assign_item_from_object(self, char *itemp, object value):
 *         if self.to_dtype_func != NULL:
 *             self.to_dtype_func(itemp, value)             # <<<<<<<<<<<<<<
 *         else:
 *             memoryview.assign_item_from_object(self, itemp, value)
*/
    __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(7, 975, __pyx_L1_error)

    /* "View.MemoryView":974
 * 
 *     cdef assign_item_from_object(self, char *itemp, object value):
 *         if self.to_dtype_func != NULL:             # <<<<<<<<<<<<<<
 *             self.to_dtype_func(itemp, value)
 *         else:
*/
    goto __pyx_L3;
  }

  /* "View.MemoryView":977
 *             self.to_dtype_func(itemp, value)
 *         else:
 *             memoryview.assign_item_from_object(self, itemp, value)             # <<<<<<<<<<<<<<
 * 
 *     cdef _get_base(self):
*/
  /*else*/ {
    __pyx_t_3 = __pyx_memoryview_assign_item_from_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 977, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_L3:;

  /* "View.MemoryView":973
 *             return memoryview.convert_item_to_object(self, itemp)
 * 
 *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
 *         if self.to_dtype_func != NULL:
 *             self.to_dtype_func(itemp, value)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":979
 *             memoryview.assign_item_from_object(self, itemp, value)
 * 
 *     cdef _get_base(self):             # <<<<<<<<<<<<<<
 *         return self.from_object
 * 
*/

static PyObject *__pyx_memoryviewslice__get_base(struct __pyx_memoryviewslice_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_get_base", 0);

  /* "View.MemoryView":980
 * 
 *     cdef _get_base(self):
 *         return self.from_object             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->from_object);
  __pyx_r = __pyx_v_self->from_object;
  goto __pyx_L0;

  /* "View.MemoryView":979
 *             memoryview.assign_item_from_object(self, itemp, value)
 * 
 *     cdef _get_base(self):             # <<<<<<<<<<<<<<
 *         return self.from_object
 * 
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
*/

/* Python wrapper */
static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf___pyx_memoryviewslice___reduce_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(7, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/

/* Python wrapper */
static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(7, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(7, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(7, 3, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(7, 3, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(7, 3, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(7, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self), __pyx_v___pyx_state);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(7, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":999
 *     pass  # ignore failure, it's a minor issue
 * 
 * @cname('__pyx_memoryview_fromslice')             # <<<<<<<<<<<<<<
 * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice,
 *                           int ndim,
*/

static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewslice, int __pyx_v_ndim, PyObject *(*__pyx_v_to_object_func)(char *), int (*__pyx_v_to_dtype_func)(char *, PyObject *), int __pyx_v_dtype_is_object) {
  struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
  Py_ssize_t __pyx_v_suboffset;
  PyObject *__pyx_v_length = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_TypeInfo const *__pyx_t_4;
  Py_buffer __pyx_t_5;
  Py_ssize_t *__pyx_t_6;
  Py_ssize_t *__pyx_t_7;
  Py_ssize_t *__pyx_t_8;
  Py_ssize_t __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("memoryview_fromslice", 0);

  /* "View.MemoryView":1008
 *     cdef _memoryviewslice result
 * 
 *     if <PyObject *> memviewslice.memview == Py_None:             # <<<<<<<<<<<<<<
 *         return None
 * 
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_memviewslice.memview) == Py_None);
  if (__pyx_t_1) {

    /* "View.MemoryView":1009
 * 
 *     if <PyObject *> memviewslice.memview == Py_None:
 *         return None             # <<<<<<<<<<<<<<
 * 
 * 
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "View.MemoryView":1008
 *     cdef _memoryviewslice result
 * 
 *     if <PyObject *> memviewslice.memview == Py_None:             # <<<<<<<<<<<<<<
 *         return None
 * 
*/
  }

  /* "View.MemoryView":1014
 * 
 * 
 *     result = _memoryviewslice.__new__(_memoryviewslice, None, 0, dtype_is_object)             # <<<<<<<<<<<<<<
 * 
 *     result.from_slice = memviewslice
*/
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 1014, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 1014, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None) != (0)) __PYX_ERR(7, 1014, __pyx_L1_error);
  __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_0);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_mstate_global->__pyx_int_0) != (0)) __PYX_ERR(7, 1014, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_2);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2) != (0)) __PYX_ERR(7, 1014, __pyx_L1_error);
  __pyx_t_2 = 0;
  __pyx_t_2 = ((PyObject *)__pyx_tp_new__memoryviewslice(((PyTypeObject *)__pyx_mstate_global->__pyx_memoryviewslice_type), __pyx_t_3, NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 1014, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "View.MemoryView":1016
 *     result = _memoryviewslice.__new__(_memoryviewslice, None, 0, dtype_is_object)
 * 
 *     result.from_slice = memviewslice             # <<<<<<<<<<<<<<
 *     __PYX_INC_MEMVIEW(&memviewslice, 1)
 * 
*/
  __pyx_v_result->from_slice = __pyx_v_memviewslice;

  /* "View.MemoryView":1017
 * 
 *     result.from_slice = memviewslice
 *     __PYX_INC_MEMVIEW(&memviewslice, 1)             # <<<<<<<<<<<<<<
 * 
 *     result.from_object = (<memoryview> memviewslice.memview)._get_base()
*/
  __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1);

  /* "View.MemoryView":1019
 *     __PYX_INC_MEMVIEW(&memviewslice, 1)
 * 
 *     result.from_object = (<memoryview> memviewslice.memview)._get_base()             # <<<<<<<<<<<<<<
 *     result.typeinfo = memviewslice.memview.typeinfo
 * 
*/
  __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->__pyx_vtab)->_get_base(((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 1019, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_result->from_object);
  __Pyx_DECREF(__pyx_v_result->from_object);
  __pyx_v_result->from_object = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "View.MemoryView":1020
 * 
 *     result.from_object = (<memoryview> memviewslice.memview)._get_base()
 *     result.typeinfo = memviewslice.memview.typeinfo             # <<<<<<<<<<<<<<
 * 
 *     result.view = memviewslice.memview.view
*/
  __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo;
  __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4;

  /* "View.MemoryView":1022
 *     result.typeinfo = memviewslice.memview.typeinfo
 * 
 *     result.view = memviewslice.memview.view             # <<<<<<<<<<<<<<
 *     result.view.buf = <void *> memviewslice.data
 *     result.view.ndim = ndim
*/
  __pyx_t_5 = __pyx_v_memviewslice.memview->view;
  __pyx_v_result->__pyx_base.view = __pyx_t_5;

  /* "View.MemoryView":1023
 * 
 *     result.view = memviewslice.memview.view
 *     result.view.buf = <void *> memviewslice.data             # <<<<<<<<<<<<<<
 *     result.view.ndim = ndim
 *     (<__pyx_buffer *> &result.view).obj = Py_None
*/
  __pyx_v_result->__pyx_base.view.buf = ((void *)__pyx_v_memviewslice.data);

  /* "View.MemoryView":1024
 *     result.view = memviewslice.memview.view
 *     result.view.buf = <void *> memviewslice.data
 *     result.view.ndim = ndim             # <<<<<<<<<<<<<<
 *     (<__pyx_buffer *> &result.view).obj = Py_None
 *     Py_INCREF(Py_None)
*/
  __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim;

  /* "View.MemoryView":1025
 *     result.view.buf = <void *> memviewslice.data
 *     result.view.ndim = ndim
 *     (<__pyx_buffer *> &result.view).obj = Py_None             # <<<<<<<<<<<<<<
 *     Py_INCREF(Py_None)
 * 
*/
  ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None;

  /* "View.MemoryView":1026
 *     result.view.ndim = ndim
 *     (<__pyx_buffer *> &result.view).obj = Py_None
 *     Py_INCREF(Py_None)             # <<<<<<<<<<<<<<
 * 
 *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:
*/
  Py_INCREF(Py_None);

  /* "View.MemoryView":1028
 *     Py_INCREF(Py_None)
 * 
 *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:             # <<<<<<<<<<<<<<
 *         result.flags = PyBUF_RECORDS
 *     else:
*/
  __pyx_t_1 = ((((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":1029
 * 
 *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:
 *         result.flags = PyBUF_RECORDS             # <<<<<<<<<<<<<<
 *     else:
 *         result.flags = PyBUF_RECORDS_RO
*/
    __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS;

    /* "View.MemoryView":1028
 *     Py_INCREF(Py_None)
 * 
 *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:             # <<<<<<<<<<<<<<
 *         result.flags = PyBUF_RECORDS
 *     else:
*/
    goto __pyx_L4;
  }

  /* "View.MemoryView":1031
 *         result.flags = PyBUF_RECORDS
 *     else:
 *         result.flags = PyBUF_RECORDS_RO             # <<<<<<<<<<<<<<
 * 
 *     result.view.shape = <Py_ssize_t *> result.from_slice.shape
*/
  /*else*/ {
    __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS_RO;
  }
  __pyx_L4:;

  /* "View.MemoryView":1033
 *         result.flags = PyBUF_RECORDS_RO
 * 
 *     result.view.shape = <Py_ssize_t *> result.from_slice.shape             # <<<<<<<<<<<<<<
 *     result.view.strides = <Py_ssize_t *> result.from_slice.strides
 * 
*/
  __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape);

  /* "View.MemoryView":1034
 * 
 *     result.view.shape = <Py_ssize_t *> result.from_slice.shape
 *     result.view.strides = <Py_ssize_t *> result.from_slice.strides             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides);

  /* "View.MemoryView":1037
 * 
 * 
 *     result.view.suboffsets = NULL             # <<<<<<<<<<<<<<
 *     for suboffset in result.from_slice.suboffsets[:ndim]:
 *         if suboffset >= 0:
*/
  __pyx_v_result->__pyx_base.view.suboffsets = NULL;

  /* "View.MemoryView":1038
 * 
 *     result.view.suboffsets = NULL
 *     for suboffset in result.from_slice.suboffsets[:ndim]:             # <<<<<<<<<<<<<<
 *         if suboffset >= 0:
 *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
*/
  __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim);
  for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
    __pyx_t_6 = __pyx_t_8;
    __pyx_v_suboffset = (__pyx_t_6[0]);

    /* "View.MemoryView":1039
 *     result.view.suboffsets = NULL
 *     for suboffset in result.from_slice.suboffsets[:ndim]:
 *         if suboffset >= 0:             # <<<<<<<<<<<<<<
 *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
 *             break
*/
    __pyx_t_1 = (__pyx_v_suboffset >= 0);
    if (__pyx_t_1) {

      /* "View.MemoryView":1040
 *     for suboffset in result.from_slice.suboffsets[:ndim]:
 *         if suboffset >= 0:
 *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets             # <<<<<<<<<<<<<<
 *             break
 * 
*/
      __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets);

      /* "View.MemoryView":1041
 *         if suboffset >= 0:
 *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
 *             break             # <<<<<<<<<<<<<<
 * 
 *     result.view.len = result.view.itemsize
*/
      goto __pyx_L6_break;

      /* "View.MemoryView":1039
 *     result.view.suboffsets = NULL
 *     for suboffset in result.from_slice.suboffsets[:ndim]:
 *         if suboffset >= 0:             # <<<<<<<<<<<<<<
 *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
 *             break
*/
    }
  }
  __pyx_L6_break:;

  /* "View.MemoryView":1043
 *             break
 * 
 *     result.view.len = result.view.itemsize             # <<<<<<<<<<<<<<
 *     for length in result.view.shape[:ndim]:
 *         result.view.len *= length
*/
  __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize;
  __pyx_v_result->__pyx_base.view.len = __pyx_t_9;

  /* "View.MemoryView":1044
 * 
 *     result.view.len = result.view.itemsize
 *     for length in result.view.shape[:ndim]:             # <<<<<<<<<<<<<<
 *         result.view.len *= length
 * 
*/
  __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim);
  for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
    __pyx_t_6 = __pyx_t_8;
    __pyx_t_2 = PyLong_FromSsize_t((__pyx_t_6[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 1044, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "View.MemoryView":1045
 *     result.view.len = result.view.itemsize
 *     for length in result.view.shape[:ndim]:
 *         result.view.len *= length             # <<<<<<<<<<<<<<
 * 
 *     result.to_object_func = to_object_func
*/
    __pyx_t_2 = PyLong_FromSsize_t(__pyx_v_result->__pyx_base.view.len); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 1045, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 1045, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(7, 1045, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
  }

  /* "View.MemoryView":1047
 *         result.view.len *= length
 * 
 *     result.to_object_func = to_object_func             # <<<<<<<<<<<<<<
 *     result.to_dtype_func = to_dtype_func
 * 
*/
  __pyx_v_result->to_object_func = __pyx_v_to_object_func;

  /* "View.MemoryView":1048
 * 
 *     result.to_object_func = to_object_func
 *     result.to_dtype_func = to_dtype_func             # <<<<<<<<<<<<<<
 * 
 *     return result
*/
  __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func;

  /* "View.MemoryView":1050
 *     result.to_dtype_func = to_dtype_func
 * 
 *     return result             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_get_slice_from_memoryview')
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_result);
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  /* "View.MemoryView":999
 *     pass  # ignore failure, it's a minor issue
 * 
 * @cname('__pyx_memoryview_fromslice')             # <<<<<<<<<<<<<<
 * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice,
 *                           int ndim,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_length);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":1052
 *     return result
 * 
 * @cname('__pyx_memoryview_get_slice_from_memoryview')             # <<<<<<<<<<<<<<
 * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview,
 *                                                    __Pyx_memviewslice *mslice) except NULL:
*/

static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) {
  struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0;
  __Pyx_memviewslice *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_slice_from_memview", 0);

  /* "View.MemoryView":1056
 *                                                    __Pyx_memviewslice *mslice) except NULL:
 *     cdef _memoryviewslice obj
 *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
 *         obj = memview
 *         return &obj.from_slice
*/
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_mstate_global->__pyx_memoryviewslice_type); 
  if (__pyx_t_1) {

    /* "View.MemoryView":1057
 *     cdef _memoryviewslice obj
 *     if isinstance(memview, _memoryviewslice):
 *         obj = memview             # <<<<<<<<<<<<<<
 *         return &obj.from_slice
 *     else:
*/
    __pyx_t_2 = ((PyObject *)__pyx_v_memview);
    __Pyx_INCREF(__pyx_t_2);
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_memoryviewslice_type))))) __PYX_ERR(7, 1057, __pyx_L1_error)
    __pyx_v_obj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "View.MemoryView":1058
 *     if isinstance(memview, _memoryviewslice):
 *         obj = memview
 *         return &obj.from_slice             # <<<<<<<<<<<<<<
 *     else:
 *         slice_copy(memview, mslice)
*/
    __pyx_r = (&__pyx_v_obj->from_slice);
    goto __pyx_L0;

    /* "View.MemoryView":1056
 *                                                    __Pyx_memviewslice *mslice) except NULL:
 *     cdef _memoryviewslice obj
 *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
 *         obj = memview
 *         return &obj.from_slice
*/
  }

  /* "View.MemoryView":1060
 *         return &obj.from_slice
 *     else:
 *         slice_copy(memview, mslice)             # <<<<<<<<<<<<<<
 *         return mslice
 * 
*/
  /*else*/ {
    __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice);

    /* "View.MemoryView":1061
 *     else:
 *         slice_copy(memview, mslice)
 *         return mslice             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_slice_copy')
*/
    __pyx_r = __pyx_v_mslice;
    goto __pyx_L0;
  }

  /* "View.MemoryView":1052
 *     return result
 * 
 * @cname('__pyx_memoryview_get_slice_from_memoryview')             # <<<<<<<<<<<<<<
 * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview,
 *                                                    __Pyx_memviewslice *mslice) except NULL:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_obj);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":1063
 *         return mslice
 * 
 * @cname('__pyx_memoryview_slice_copy')             # <<<<<<<<<<<<<<
 * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst) noexcept:
 *     cdef int dim
*/

static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) {
  int __pyx_v_dim;
  Py_ssize_t *__pyx_v_shape;
  Py_ssize_t *__pyx_v_strides;
  Py_ssize_t *__pyx_v_suboffsets;
  Py_ssize_t *__pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;

  /* "View.MemoryView":1068
 *     cdef (Py_ssize_t*) shape, strides, suboffsets
 * 
 *     shape = memview.view.shape             # <<<<<<<<<<<<<<
 *     strides = memview.view.strides
 *     suboffsets = memview.view.suboffsets
*/
  __pyx_t_1 = __pyx_v_memview->view.shape;
  __pyx_v_shape = __pyx_t_1;

  /* "View.MemoryView":1069
 * 
 *     shape = memview.view.shape
 *     strides = memview.view.strides             # <<<<<<<<<<<<<<
 *     suboffsets = memview.view.suboffsets
 * 
*/
  __pyx_t_1 = __pyx_v_memview->view.strides;
  __pyx_v_strides = __pyx_t_1;

  /* "View.MemoryView":1070
 *     shape = memview.view.shape
 *     strides = memview.view.strides
 *     suboffsets = memview.view.suboffsets             # <<<<<<<<<<<<<<
 * 
 *     dst.memview = <__pyx_memoryview *> memview
*/
  __pyx_t_1 = __pyx_v_memview->view.suboffsets;
  __pyx_v_suboffsets = __pyx_t_1;

  /* "View.MemoryView":1072
 *     suboffsets = memview.view.suboffsets
 * 
 *     dst.memview = <__pyx_memoryview *> memview             # <<<<<<<<<<<<<<
 *     dst.data = <char *> memview.view.buf
 * 
*/
  __pyx_v_dst->memview = ((struct __pyx_memoryview_obj *)__pyx_v_memview);

  /* "View.MemoryView":1073
 * 
 *     dst.memview = <__pyx_memoryview *> memview
 *     dst.data = <char *> memview.view.buf             # <<<<<<<<<<<<<<
 * 
 *     for dim in range(memview.view.ndim):
*/
  __pyx_v_dst->data = ((char *)__pyx_v_memview->view.buf);

  /* "View.MemoryView":1075
 *     dst.data = <char *> memview.view.buf
 * 
 *     for dim in range(memview.view.ndim):             # <<<<<<<<<<<<<<
 *         dst.shape[dim] = shape[dim]
 *         dst.strides[dim] = strides[dim]
*/
  __pyx_t_2 = __pyx_v_memview->view.ndim;
  __pyx_t_3 = __pyx_t_2;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_dim = __pyx_t_4;

    /* "View.MemoryView":1076
 * 
 *     for dim in range(memview.view.ndim):
 *         dst.shape[dim] = shape[dim]             # <<<<<<<<<<<<<<
 *         dst.strides[dim] = strides[dim]
 *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
*/
    (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]);

    /* "View.MemoryView":1077
 *     for dim in range(memview.view.ndim):
 *         dst.shape[dim] = shape[dim]
 *         dst.strides[dim] = strides[dim]             # <<<<<<<<<<<<<<
 *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
 * 
*/
    (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]);

    /* "View.MemoryView":1078
 *         dst.shape[dim] = shape[dim]
 *         dst.strides[dim] = strides[dim]
 *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_copy_object')
*/
    __pyx_t_6 = (__pyx_v_suboffsets != 0);
    if (__pyx_t_6) {
      __pyx_t_5 = (__pyx_v_suboffsets[__pyx_v_dim]);
    } else {
      __pyx_t_5 = -1L;
    }
    (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5;
  }

  /* "View.MemoryView":1063
 *         return mslice
 * 
 * @cname('__pyx_memoryview_slice_copy')             # <<<<<<<<<<<<<<
 * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst) noexcept:
 *     cdef int dim
*/

  /* function exit code */
}

/* "View.MemoryView":1080
 *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
 * 
 * @cname('__pyx_memoryview_copy_object')             # <<<<<<<<<<<<<<
 * cdef memoryview_copy(memoryview memview):
 *     "Create a new memoryview object"
*/

static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx_v_memview) {
  __Pyx_memviewslice __pyx_v_memviewslice;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("memoryview_copy", 0);

  /* "View.MemoryView":1084
 *     "Create a new memoryview object"
 *     cdef __Pyx_memviewslice memviewslice
 *     slice_copy(memview, &memviewslice)             # <<<<<<<<<<<<<<
 *     return memoryview_copy_from_slice(memview, &memviewslice)
 * 
*/
  __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice));

  /* "View.MemoryView":1085
 *     cdef __Pyx_memviewslice memviewslice
 *     slice_copy(memview, &memviewslice)
 *     return memoryview_copy_from_slice(memview, &memviewslice)             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_copy_object_from_slice')
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice)); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 1085, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":1080
 *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
 * 
 * @cname('__pyx_memoryview_copy_object')             # <<<<<<<<<<<<<<
 * cdef memoryview_copy(memoryview memview):
 *     "Create a new memoryview object"
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":1087
 *     return memoryview_copy_from_slice(memview, &memviewslice)
 * 
 * @cname('__pyx_memoryview_copy_object_from_slice')             # <<<<<<<<<<<<<<
 * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice):
 *     """
*/

static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) {
  PyObject *(*__pyx_v_to_object_func)(char *);
  int (*__pyx_v_to_dtype_func)(char *, PyObject *);
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *(*__pyx_t_2)(char *);
  int (*__pyx_t_3)(char *, PyObject *);
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("memoryview_copy_from_slice", 0);

  /* "View.MemoryView":1095
 *     cdef int (*to_dtype_func)(char *, object) except 0
 * 
 *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
 *         to_object_func = (<_memoryviewslice> memview).to_object_func
 *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
*/
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_mstate_global->__pyx_memoryviewslice_type); 
  if (__pyx_t_1) {

    /* "View.MemoryView":1096
 * 
 *     if isinstance(memview, _memoryviewslice):
 *         to_object_func = (<_memoryviewslice> memview).to_object_func             # <<<<<<<<<<<<<<
 *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
 *     else:
*/
    __pyx_t_2 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func;
    __pyx_v_to_object_func = __pyx_t_2;

    /* "View.MemoryView":1097
 *     if isinstance(memview, _memoryviewslice):
 *         to_object_func = (<_memoryviewslice> memview).to_object_func
 *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func             # <<<<<<<<<<<<<<
 *     else:
 *         to_object_func = NULL
*/
    __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func;
    __pyx_v_to_dtype_func = __pyx_t_3;

    /* "View.MemoryView":1095
 *     cdef int (*to_dtype_func)(char *, object) except 0
 * 
 *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
 *         to_object_func = (<_memoryviewslice> memview).to_object_func
 *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
*/
    goto __pyx_L3;
  }

  /* "View.MemoryView":1099
 *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
 *     else:
 *         to_object_func = NULL             # <<<<<<<<<<<<<<
 *         to_dtype_func = NULL
 * 
*/
  /*else*/ {
    __pyx_v_to_object_func = NULL;

    /* "View.MemoryView":1100
 *     else:
 *         to_object_func = NULL
 *         to_dtype_func = NULL             # <<<<<<<<<<<<<<
 * 
 *     return memoryview_fromslice(memviewslice[0], memview.view.ndim,
*/
    __pyx_v_to_dtype_func = NULL;
  }
  __pyx_L3:;

  /* "View.MemoryView":1102
 *         to_dtype_func = NULL
 * 
 *     return memoryview_fromslice(memviewslice[0], memview.view.ndim,             # <<<<<<<<<<<<<<
 *                                 to_object_func, to_dtype_func,
 *                                 memview.dtype_is_object)
*/
  __Pyx_XDECREF(__pyx_r);

  /* "View.MemoryView":1104
 *     return memoryview_fromslice(memviewslice[0], memview.view.ndim,
 *                                 to_object_func, to_dtype_func,
 *                                 memview.dtype_is_object)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_4 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 1102, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":1087
 *     return memoryview_copy_from_slice(memview, &memviewslice)
 * 
 * @cname('__pyx_memoryview_copy_object_from_slice')             # <<<<<<<<<<<<<<
 * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice):
 *     """
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":1110
 * 
 * 
 * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil:             # <<<<<<<<<<<<<<
 *     return -arg if arg < 0 else arg
 * 
*/

static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) {
  Py_ssize_t __pyx_r;
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;

  /* "View.MemoryView":1111
 * 
 * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil:
 *     return -arg if arg < 0 else arg             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_get_best_slice_order')
*/
  __pyx_t_2 = (__pyx_v_arg < 0);
  if (__pyx_t_2) {
    __pyx_t_1 = (-__pyx_v_arg);
  } else {
    __pyx_t_1 = __pyx_v_arg;
  }
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  /* "View.MemoryView":1110
 * 
 * 
 * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil:             # <<<<<<<<<<<<<<
 *     return -arg if arg < 0 else arg
 * 
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":1113
 *     return -arg if arg < 0 else arg
 * 
 * @cname('__pyx_get_best_slice_order')             # <<<<<<<<<<<<<<
 * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) noexcept nogil:
 *     """
*/

static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim) {
  int __pyx_v_i;
  Py_ssize_t __pyx_v_c_stride;
  Py_ssize_t __pyx_v_f_stride;
  char __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;

  /* "View.MemoryView":1119
 *     """
 *     cdef int i
 *     cdef Py_ssize_t c_stride = 0             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t f_stride = 0
 * 
*/
  __pyx_v_c_stride = 0;

  /* "View.MemoryView":1120
 *     cdef int i
 *     cdef Py_ssize_t c_stride = 0
 *     cdef Py_ssize_t f_stride = 0             # <<<<<<<<<<<<<<
 * 
 *     for i in range(ndim - 1, -1, -1):
*/
  __pyx_v_f_stride = 0;

  /* "View.MemoryView":1122
 *     cdef Py_ssize_t f_stride = 0
 * 
 *     for i in range(ndim - 1, -1, -1):             # <<<<<<<<<<<<<<
 *         if mslice.shape[i] > 1:
 *             c_stride = mslice.strides[i]
*/
  for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
    __pyx_v_i = __pyx_t_1;

    /* "View.MemoryView":1123
 * 
 *     for i in range(ndim - 1, -1, -1):
 *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
 *             c_stride = mslice.strides[i]
 *             break
*/
    __pyx_t_2 = ((__pyx_v_mslice->shape[__pyx_v_i]) > 1);
    if (__pyx_t_2) {

      /* "View.MemoryView":1124
 *     for i in range(ndim - 1, -1, -1):
 *         if mslice.shape[i] > 1:
 *             c_stride = mslice.strides[i]             # <<<<<<<<<<<<<<
 *             break
 * 
*/
      __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]);

      /* "View.MemoryView":1125
 *         if mslice.shape[i] > 1:
 *             c_stride = mslice.strides[i]
 *             break             # <<<<<<<<<<<<<<
 * 
 *     for i in range(ndim):
*/
      goto __pyx_L4_break;

      /* "View.MemoryView":1123
 * 
 *     for i in range(ndim - 1, -1, -1):
 *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
 *             c_stride = mslice.strides[i]
 *             break
*/
    }
  }
  __pyx_L4_break:;

  /* "View.MemoryView":1127
 *             break
 * 
 *     for i in range(ndim):             # <<<<<<<<<<<<<<
 *         if mslice.shape[i] > 1:
 *             f_stride = mslice.strides[i]
*/
  __pyx_t_1 = __pyx_v_ndim;
  __pyx_t_3 = __pyx_t_1;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;

    /* "View.MemoryView":1128
 * 
 *     for i in range(ndim):
 *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
 *             f_stride = mslice.strides[i]
 *             break
*/
    __pyx_t_2 = ((__pyx_v_mslice->shape[__pyx_v_i]) > 1);
    if (__pyx_t_2) {

      /* "View.MemoryView":1129
 *     for i in range(ndim):
 *         if mslice.shape[i] > 1:
 *             f_stride = mslice.strides[i]             # <<<<<<<<<<<<<<
 *             break
 * 
*/
      __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]);

      /* "View.MemoryView":1130
 *         if mslice.shape[i] > 1:
 *             f_stride = mslice.strides[i]
 *             break             # <<<<<<<<<<<<<<
 * 
 *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):
*/
      goto __pyx_L7_break;

      /* "View.MemoryView":1128
 * 
 *     for i in range(ndim):
 *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
 *             f_stride = mslice.strides[i]
 *             break
*/
    }
  }
  __pyx_L7_break:;

  /* "View.MemoryView":1132
 *             break
 * 
 *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):             # <<<<<<<<<<<<<<
 *         return 'C'
 *     else:
*/
  __pyx_t_2 = (abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride));
  if (__pyx_t_2) {

    /* "View.MemoryView":1133
 * 
 *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):
 *         return 'C'             # <<<<<<<<<<<<<<
 *     else:
 *         return 'F'
*/
    __pyx_r = 'C';
    goto __pyx_L0;

    /* "View.MemoryView":1132
 *             break
 * 
 *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):             # <<<<<<<<<<<<<<
 *         return 'C'
 *     else:
*/
  }

  /* "View.MemoryView":1135
 *         return 'C'
 *     else:
 *         return 'F'             # <<<<<<<<<<<<<<
 * 
 * @cython.cdivision(True)
*/
  /*else*/ {
    __pyx_r = 'F';
    goto __pyx_L0;
  }

  /* "View.MemoryView":1113
 *     return -arg if arg < 0 else arg
 * 
 * @cname('__pyx_get_best_slice_order')             # <<<<<<<<<<<<<<
 * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) noexcept nogil:
 *     """
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":1137
 *         return 'F'
 * 
 * @cython.cdivision(True)             # <<<<<<<<<<<<<<
 * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides,
 *                                    char *dst_data, Py_ssize_t *dst_strides,
*/

static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v_src_strides, char *__pyx_v_dst_data, Py_ssize_t *__pyx_v_dst_strides, Py_ssize_t *__pyx_v_src_shape, Py_ssize_t *__pyx_v_dst_shape, int __pyx_v_ndim, size_t __pyx_v_itemsize) {
  CYTHON_UNUSED Py_ssize_t __pyx_v_i;
  CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent;
  Py_ssize_t __pyx_v_dst_extent;
  Py_ssize_t __pyx_v_src_stride;
  Py_ssize_t __pyx_v_dst_stride;
  int __pyx_t_1;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;

  /* "View.MemoryView":1145
 * 
 *     cdef Py_ssize_t i
 *     cdef Py_ssize_t src_extent = src_shape[0]             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t dst_extent = dst_shape[0]
 *     cdef Py_ssize_t src_stride = src_strides[0]
*/
  __pyx_v_src_extent = (__pyx_v_src_shape[0]);

  /* "View.MemoryView":1146
 *     cdef Py_ssize_t i
 *     cdef Py_ssize_t src_extent = src_shape[0]
 *     cdef Py_ssize_t dst_extent = dst_shape[0]             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t src_stride = src_strides[0]
 *     cdef Py_ssize_t dst_stride = dst_strides[0]
*/
  __pyx_v_dst_extent = (__pyx_v_dst_shape[0]);

  /* "View.MemoryView":1147
 *     cdef Py_ssize_t src_extent = src_shape[0]
 *     cdef Py_ssize_t dst_extent = dst_shape[0]
 *     cdef Py_ssize_t src_stride = src_strides[0]             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t dst_stride = dst_strides[0]
 * 
*/
  __pyx_v_src_stride = (__pyx_v_src_strides[0]);

  /* "View.MemoryView":1148
 *     cdef Py_ssize_t dst_extent = dst_shape[0]
 *     cdef Py_ssize_t src_stride = src_strides[0]
 *     cdef Py_ssize_t dst_stride = dst_strides[0]             # <<<<<<<<<<<<<<
 * 
 *     if ndim == 1:
*/
  __pyx_v_dst_stride = (__pyx_v_dst_strides[0]);

  /* "View.MemoryView":1150
 *     cdef Py_ssize_t dst_stride = dst_strides[0]
 * 
 *     if ndim == 1:             # <<<<<<<<<<<<<<
 *         if (src_stride > 0 and dst_stride > 0 and
 *                 <size_t> src_stride == itemsize == <size_t> dst_stride):
*/
  __pyx_t_1 = (__pyx_v_ndim == 1);
  if (__pyx_t_1) {

    /* "View.MemoryView":1151
 * 
 *     if ndim == 1:
 *         if (src_stride > 0 and dst_stride > 0 and             # <<<<<<<<<<<<<<
 *                 <size_t> src_stride == itemsize == <size_t> dst_stride):
 *             memcpy(dst_data, src_data, itemsize * dst_extent)
*/
    __pyx_t_2 = (__pyx_v_src_stride > 0);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_2 = (__pyx_v_dst_stride > 0);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L5_bool_binop_done;
    }

    /* "View.MemoryView":1152
 *     if ndim == 1:
 *         if (src_stride > 0 and dst_stride > 0 and
 *                 <size_t> src_stride == itemsize == <size_t> dst_stride):             # <<<<<<<<<<<<<<
 *             memcpy(dst_data, src_data, itemsize * dst_extent)
 *         else:
*/
    __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize);
    if (__pyx_t_2) {
      __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride));
    }
    __pyx_t_1 = __pyx_t_2;
    __pyx_L5_bool_binop_done:;

    /* "View.MemoryView":1151
 * 
 *     if ndim == 1:
 *         if (src_stride > 0 and dst_stride > 0 and             # <<<<<<<<<<<<<<
 *                 <size_t> src_stride == itemsize == <size_t> dst_stride):
 *             memcpy(dst_data, src_data, itemsize * dst_extent)
*/
    if (__pyx_t_1) {

      /* "View.MemoryView":1153
 *         if (src_stride > 0 and dst_stride > 0 and
 *                 <size_t> src_stride == itemsize == <size_t> dst_stride):
 *             memcpy(dst_data, src_data, itemsize * dst_extent)             # <<<<<<<<<<<<<<
 *         else:
 *             for i in range(dst_extent):
*/
      (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent)));

      /* "View.MemoryView":1151
 * 
 *     if ndim == 1:
 *         if (src_stride > 0 and dst_stride > 0 and             # <<<<<<<<<<<<<<
 *                 <size_t> src_stride == itemsize == <size_t> dst_stride):
 *             memcpy(dst_data, src_data, itemsize * dst_extent)
*/
      goto __pyx_L4;
    }

    /* "View.MemoryView":1155
 *             memcpy(dst_data, src_data, itemsize * dst_extent)
 *         else:
 *             for i in range(dst_extent):             # <<<<<<<<<<<<<<
 *                 memcpy(dst_data, src_data, itemsize)
 *                 src_data += src_stride
*/
    /*else*/ {
      __pyx_t_3 = __pyx_v_dst_extent;
      __pyx_t_4 = __pyx_t_3;
      for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
        __pyx_v_i = __pyx_t_5;

        /* "View.MemoryView":1156
 *         else:
 *             for i in range(dst_extent):
 *                 memcpy(dst_data, src_data, itemsize)             # <<<<<<<<<<<<<<
 *                 src_data += src_stride
 *                 dst_data += dst_stride
*/
        (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize));

        /* "View.MemoryView":1157
 *             for i in range(dst_extent):
 *                 memcpy(dst_data, src_data, itemsize)
 *                 src_data += src_stride             # <<<<<<<<<<<<<<
 *                 dst_data += dst_stride
 *     else:
*/
        __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);

        /* "View.MemoryView":1158
 *                 memcpy(dst_data, src_data, itemsize)
 *                 src_data += src_stride
 *                 dst_data += dst_stride             # <<<<<<<<<<<<<<
 *     else:
 *         for i in range(dst_extent):
*/
        __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
      }
    }
    __pyx_L4:;

    /* "View.MemoryView":1150
 *     cdef Py_ssize_t dst_stride = dst_strides[0]
 * 
 *     if ndim == 1:             # <<<<<<<<<<<<<<
 *         if (src_stride > 0 and dst_stride > 0 and
 *                 <size_t> src_stride == itemsize == <size_t> dst_stride):
*/
    goto __pyx_L3;
  }

  /* "View.MemoryView":1160
 *                 dst_data += dst_stride
 *     else:
 *         for i in range(dst_extent):             # <<<<<<<<<<<<<<
 *             _copy_strided_to_strided(src_data, src_strides + 1,
 *                                      dst_data, dst_strides + 1,
*/
  /*else*/ {
    __pyx_t_3 = __pyx_v_dst_extent;
    __pyx_t_4 = __pyx_t_3;
    for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
      __pyx_v_i = __pyx_t_5;

      /* "View.MemoryView":1161
 *     else:
 *         for i in range(dst_extent):
 *             _copy_strided_to_strided(src_data, src_strides + 1,             # <<<<<<<<<<<<<<
 *                                      dst_data, dst_strides + 1,
 *                                      src_shape + 1, dst_shape + 1,
*/
      _copy_strided_to_strided(__pyx_v_src_data, (__pyx_v_src_strides + 1), __pyx_v_dst_data, (__pyx_v_dst_strides + 1), (__pyx_v_src_shape + 1), (__pyx_v_dst_shape + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize);

      /* "View.MemoryView":1165
 *                                      src_shape + 1, dst_shape + 1,
 *                                      ndim - 1, itemsize)
 *             src_data += src_stride             # <<<<<<<<<<<<<<
 *             dst_data += dst_stride
 * 
*/
      __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);

      /* "View.MemoryView":1166
 *                                      ndim - 1, itemsize)
 *             src_data += src_stride
 *             dst_data += dst_stride             # <<<<<<<<<<<<<<
 * 
 * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,
*/
      __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
    }
  }
  __pyx_L3:;

  /* "View.MemoryView":1137
 *         return 'F'
 * 
 * @cython.cdivision(True)             # <<<<<<<<<<<<<<
 * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides,
 *                                    char *dst_data, Py_ssize_t *dst_strides,
*/

  /* function exit code */
}

/* "View.MemoryView":1168
 *             dst_data += dst_stride
 * 
 * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
 *                                   __Pyx_memviewslice *dst,
 *                                   int ndim, size_t itemsize) noexcept nogil:
*/

static void copy_strided_to_strided(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize) {

  /* "View.MemoryView":1171
 *                                   __Pyx_memviewslice *dst,
 *                                   int ndim, size_t itemsize) noexcept nogil:
 *     _copy_strided_to_strided(src.data, src.strides, dst.data, dst.strides,             # <<<<<<<<<<<<<<
 *                              src.shape, dst.shape, ndim, itemsize)
 * 
*/
  _copy_strided_to_strided(__pyx_v_src->data, __pyx_v_src->strides, __pyx_v_dst->data, __pyx_v_dst->strides, __pyx_v_src->shape, __pyx_v_dst->shape, __pyx_v_ndim, __pyx_v_itemsize);

  /* "View.MemoryView":1168
 *             dst_data += dst_stride
 * 
 * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
 *                                   __Pyx_memviewslice *dst,
 *                                   int ndim, size_t itemsize) noexcept nogil:
*/

  /* function exit code */
}

/* "View.MemoryView":1174
 *                              src.shape, dst.shape, ndim, itemsize)
 * 
 * @cname('__pyx_memoryview_slice_get_size')             # <<<<<<<<<<<<<<
 * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil:
 *     "Return the size of the memory occupied by the slice in number of bytes"
*/

static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src, int __pyx_v_ndim) {
  Py_ssize_t __pyx_v_shape;
  Py_ssize_t __pyx_v_size;
  Py_ssize_t __pyx_r;
  Py_ssize_t __pyx_t_1;
  Py_ssize_t *__pyx_t_2;
  Py_ssize_t *__pyx_t_3;
  Py_ssize_t *__pyx_t_4;

  /* "View.MemoryView":1177
 * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil:
 *     "Return the size of the memory occupied by the slice in number of bytes"
 *     cdef Py_ssize_t shape, size = src.memview.view.itemsize             # <<<<<<<<<<<<<<
 * 
 *     for shape in src.shape[:ndim]:
*/
  __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
  __pyx_v_size = __pyx_t_1;

  /* "View.MemoryView":1179
 *     cdef Py_ssize_t shape, size = src.memview.view.itemsize
 * 
 *     for shape in src.shape[:ndim]:             # <<<<<<<<<<<<<<
 *         size *= shape
 * 
*/
  __pyx_t_3 = (__pyx_v_src->shape + __pyx_v_ndim);
  for (__pyx_t_4 = __pyx_v_src->shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
    __pyx_t_2 = __pyx_t_4;
    __pyx_v_shape = (__pyx_t_2[0]);

    /* "View.MemoryView":1180
 * 
 *     for shape in src.shape[:ndim]:
 *         size *= shape             # <<<<<<<<<<<<<<
 * 
 *     return size
*/
    __pyx_v_size = (__pyx_v_size * __pyx_v_shape);
  }

  /* "View.MemoryView":1182
 *         size *= shape
 * 
 *     return size             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_fill_contig_strides_array')
*/
  __pyx_r = __pyx_v_size;
  goto __pyx_L0;

  /* "View.MemoryView":1174
 *                              src.shape, dst.shape, ndim, itemsize)
 * 
 * @cname('__pyx_memoryview_slice_get_size')             # <<<<<<<<<<<<<<
 * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil:
 *     "Return the size of the memory occupied by the slice in number of bytes"
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":1184
 *     return size
 * 
 * @cname('__pyx_fill_contig_strides_array')             # <<<<<<<<<<<<<<
 * cdef Py_ssize_t fill_contig_strides_array(
 *                 Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride,
*/

static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, Py_ssize_t __pyx_v_stride, int __pyx_v_ndim, char __pyx_v_order) {
  int __pyx_v_idx;
  Py_ssize_t __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;

  /* "View.MemoryView":1194
 *     cdef int idx
 * 
 *     if order == 'F':             # <<<<<<<<<<<<<<
 *         for idx in range(ndim):
 *             strides[idx] = stride
*/
  __pyx_t_1 = (__pyx_v_order == 'F');
  if (__pyx_t_1) {

    /* "View.MemoryView":1195
 * 
 *     if order == 'F':
 *         for idx in range(ndim):             # <<<<<<<<<<<<<<
 *             strides[idx] = stride
 *             stride *= shape[idx]
*/
    __pyx_t_2 = __pyx_v_ndim;
    __pyx_t_3 = __pyx_t_2;
    for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
      __pyx_v_idx = __pyx_t_4;

      /* "View.MemoryView":1196
 *     if order == 'F':
 *         for idx in range(ndim):
 *             strides[idx] = stride             # <<<<<<<<<<<<<<
 *             stride *= shape[idx]
 *     else:
*/
      (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;

      /* "View.MemoryView":1197
 *         for idx in range(ndim):
 *             strides[idx] = stride
 *             stride *= shape[idx]             # <<<<<<<<<<<<<<
 *     else:
 *         for idx in range(ndim - 1, -1, -1):
*/
      __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
    }

    /* "View.MemoryView":1194
 *     cdef int idx
 * 
 *     if order == 'F':             # <<<<<<<<<<<<<<
 *         for idx in range(ndim):
 *             strides[idx] = stride
*/
    goto __pyx_L3;
  }

  /* "View.MemoryView":1199
 *             stride *= shape[idx]
 *     else:
 *         for idx in range(ndim - 1, -1, -1):             # <<<<<<<<<<<<<<
 *             strides[idx] = stride
 *             stride *= shape[idx]
*/
  /*else*/ {
    for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) {
      __pyx_v_idx = __pyx_t_2;

      /* "View.MemoryView":1200
 *     else:
 *         for idx in range(ndim - 1, -1, -1):
 *             strides[idx] = stride             # <<<<<<<<<<<<<<
 *             stride *= shape[idx]
 * 
*/
      (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;

      /* "View.MemoryView":1201
 *         for idx in range(ndim - 1, -1, -1):
 *             strides[idx] = stride
 *             stride *= shape[idx]             # <<<<<<<<<<<<<<
 * 
 *     return stride
*/
      __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
    }
  }
  __pyx_L3:;

  /* "View.MemoryView":1203
 *             stride *= shape[idx]
 * 
 *     return stride             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_copy_data_to_temp')
*/
  __pyx_r = __pyx_v_stride;
  goto __pyx_L0;

  /* "View.MemoryView":1184
 *     return size
 * 
 * @cname('__pyx_fill_contig_strides_array')             # <<<<<<<<<<<<<<
 * cdef Py_ssize_t fill_contig_strides_array(
 *                 Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride,
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":1205
 *     return stride
 * 
 * @cname('__pyx_memoryview_copy_data_to_temp')             # <<<<<<<<<<<<<<
 * cdef void *copy_data_to_temp(__Pyx_memviewslice *src,
 *                              __Pyx_memviewslice *tmpslice,
*/

static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_tmpslice, char __pyx_v_order, int __pyx_v_ndim) {
  int __pyx_v_i;
  void *__pyx_v_result;
  size_t __pyx_v_itemsize;
  size_t __pyx_v_size;
  void *__pyx_r;
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  struct __pyx_memoryview_obj *__pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save;

  /* "View.MemoryView":1217
 *     cdef void *result
 * 
 *     cdef size_t itemsize = src.memview.view.itemsize             # <<<<<<<<<<<<<<
 *     cdef size_t size = slice_get_size(src, ndim)
 * 
*/
  __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
  __pyx_v_itemsize = __pyx_t_1;

  /* "View.MemoryView":1218
 * 
 *     cdef size_t itemsize = src.memview.view.itemsize
 *     cdef size_t size = slice_get_size(src, ndim)             # <<<<<<<<<<<<<<
 * 
 *     result = malloc(size)
*/
  __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim);

  /* "View.MemoryView":1220
 *     cdef size_t size = slice_get_size(src, ndim)
 * 
 *     result = malloc(size)             # <<<<<<<<<<<<<<
 *     if not result:
 *         _err_no_memory()
*/
  __pyx_v_result = malloc(__pyx_v_size);

  /* "View.MemoryView":1221
 * 
 *     result = malloc(size)
 *     if not result:             # <<<<<<<<<<<<<<
 *         _err_no_memory()
 * 
*/
  __pyx_t_2 = (!(__pyx_v_result != 0));
  if (__pyx_t_2) {

    /* "View.MemoryView":1222
 *     result = malloc(size)
 *     if not result:
 *         _err_no_memory()             # <<<<<<<<<<<<<<
 * 
 * 
*/
    __pyx_t_3 = __pyx_memoryview_err_no_memory(); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(7, 1222, __pyx_L1_error)

    /* "View.MemoryView":1221
 * 
 *     result = malloc(size)
 *     if not result:             # <<<<<<<<<<<<<<
 *         _err_no_memory()
 * 
*/
  }

  /* "View.MemoryView":1225
 * 
 * 
 *     tmpslice.data = <char *> result             # <<<<<<<<<<<<<<
 *     tmpslice.memview = src.memview
 *     for i in range(ndim):
*/
  __pyx_v_tmpslice->data = ((char *)__pyx_v_result);

  /* "View.MemoryView":1226
 * 
 *     tmpslice.data = <char *> result
 *     tmpslice.memview = src.memview             # <<<<<<<<<<<<<<
 *     for i in range(ndim):
 *         tmpslice.shape[i] = src.shape[i]
*/
  __pyx_t_4 = __pyx_v_src->memview;
  __pyx_v_tmpslice->memview = __pyx_t_4;

  /* "View.MemoryView":1227
 *     tmpslice.data = <char *> result
 *     tmpslice.memview = src.memview
 *     for i in range(ndim):             # <<<<<<<<<<<<<<
 *         tmpslice.shape[i] = src.shape[i]
 *         tmpslice.suboffsets[i] = -1
*/
  __pyx_t_3 = __pyx_v_ndim;
  __pyx_t_5 = __pyx_t_3;
  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
    __pyx_v_i = __pyx_t_6;

    /* "View.MemoryView":1228
 *     tmpslice.memview = src.memview
 *     for i in range(ndim):
 *         tmpslice.shape[i] = src.shape[i]             # <<<<<<<<<<<<<<
 *         tmpslice.suboffsets[i] = -1
 * 
*/
    (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]);

    /* "View.MemoryView":1229
 *     for i in range(ndim):
 *         tmpslice.shape[i] = src.shape[i]
 *         tmpslice.suboffsets[i] = -1             # <<<<<<<<<<<<<<
 * 
 *     fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, ndim, order)
*/
    (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1L;
  }

  /* "View.MemoryView":1231
 *         tmpslice.suboffsets[i] = -1
 * 
 *     fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, ndim, order)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  (void)(__pyx_fill_contig_strides_array((&(__pyx_v_tmpslice->shape[0])), (&(__pyx_v_tmpslice->strides[0])), __pyx_v_itemsize, __pyx_v_ndim, __pyx_v_order));

  /* "View.MemoryView":1234
 * 
 * 
 *     for i in range(ndim):             # <<<<<<<<<<<<<<
 *         if tmpslice.shape[i] == 1:
 *             tmpslice.strides[i] = 0
*/
  __pyx_t_3 = __pyx_v_ndim;
  __pyx_t_5 = __pyx_t_3;
  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
    __pyx_v_i = __pyx_t_6;

    /* "View.MemoryView":1235
 * 
 *     for i in range(ndim):
 *         if tmpslice.shape[i] == 1:             # <<<<<<<<<<<<<<
 *             tmpslice.strides[i] = 0
 * 
*/
    __pyx_t_2 = ((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1);
    if (__pyx_t_2) {

      /* "View.MemoryView":1236
 *     for i in range(ndim):
 *         if tmpslice.shape[i] == 1:
 *             tmpslice.strides[i] = 0             # <<<<<<<<<<<<<<
 * 
 *     if slice_is_contig(src[0], order, ndim):
*/
      (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0;

      /* "View.MemoryView":1235
 * 
 *     for i in range(ndim):
 *         if tmpslice.shape[i] == 1:             # <<<<<<<<<<<<<<
 *             tmpslice.strides[i] = 0
 * 
*/
    }
  }

  /* "View.MemoryView":1238
 *             tmpslice.strides[i] = 0
 * 
 *     if slice_is_contig(src[0], order, ndim):             # <<<<<<<<<<<<<<
 *         memcpy(result, src.data, size)
 *     else:
*/
  __pyx_t_2 = __pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim);
  if (__pyx_t_2) {

    /* "View.MemoryView":1239
 * 
 *     if slice_is_contig(src[0], order, ndim):
 *         memcpy(result, src.data, size)             # <<<<<<<<<<<<<<
 *     else:
 *         copy_strided_to_strided(src, tmpslice, ndim, itemsize)
*/
    (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size));

    /* "View.MemoryView":1238
 *             tmpslice.strides[i] = 0
 * 
 *     if slice_is_contig(src[0], order, ndim):             # <<<<<<<<<<<<<<
 *         memcpy(result, src.data, size)
 *     else:
*/
    goto __pyx_L9;
  }

  /* "View.MemoryView":1241
 *         memcpy(result, src.data, size)
 *     else:
 *         copy_strided_to_strided(src, tmpslice, ndim, itemsize)             # <<<<<<<<<<<<<<
 * 
 *     return result
*/
  /*else*/ {
    copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize);
  }
  __pyx_L9:;

  /* "View.MemoryView":1243
 *         copy_strided_to_strided(src, tmpslice, ndim, itemsize)
 * 
 *     return result             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "View.MemoryView":1205
 *     return stride
 * 
 * @cname('__pyx_memoryview_copy_data_to_temp')             # <<<<<<<<<<<<<<
 * cdef void *copy_data_to_temp(__Pyx_memviewslice *src,
 *                              __Pyx_memviewslice *tmpslice,
*/

  /* function exit code */
  __pyx_L1_error:;
  __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_AddTraceback("View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":1247
 * 
 * 
 * @cname('__pyx_memoryview_err_extents')             # <<<<<<<<<<<<<<
 * cdef int _err_extents(int i, Py_ssize_t extent1,
 *                              Py_ssize_t extent2) except -1 with gil:
*/

static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4[7];
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("_err_extents", 0);

  /* "View.MemoryView":1250
 * cdef int _err_extents(int i, Py_ssize_t extent1,
 *                              Py_ssize_t extent2) except -1 with gil:
 *     raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})"             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_err_dim')
*/
  __pyx_t_1 = __Pyx_PyUnicode_From_int(__pyx_v_i, 0, ' ', 'd'); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 1250, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_extent1, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 1250, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_extent2, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 1250, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u_got_differing_extents_in_dimensi;
  __pyx_t_4[1] = __pyx_t_1;
  __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u_got;
  __pyx_t_4[3] = __pyx_t_2;
  __pyx_t_4[4] = __pyx_mstate_global->__pyx_kp_u_and;
  __pyx_t_4[5] = __pyx_t_3;
  __pyx_t_4[6] = __pyx_mstate_global->__pyx_kp_u__5;
  __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_4, 7, 35 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + 6 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 5 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 1, 127);
  if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 1250, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_t_5, 0, 0);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __PYX_ERR(7, 1250, __pyx_L1_error)

  /* "View.MemoryView":1247
 * 
 * 
 * @cname('__pyx_memoryview_err_extents')             # <<<<<<<<<<<<<<
 * cdef int _err_extents(int i, Py_ssize_t extent1,
 *                              Py_ssize_t extent2) except -1 with gil:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  return __pyx_r;
}

/* "View.MemoryView":1252
 *     raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})"
 * 
 * @cname('__pyx_memoryview_err_dim')             # <<<<<<<<<<<<<<
 * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil:
 *     raise <object>error, msg % dim
*/

static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, PyObject *__pyx_v_msg, int __pyx_v_dim) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("_err_dim", 0);
  __Pyx_INCREF(__pyx_v_msg);

  /* "View.MemoryView":1254
 * @cname('__pyx_memoryview_err_dim')
 * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil:
 *     raise <object>error, msg % dim             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_err')
*/
  __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_dim); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 1254, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyUnicode_FormatSafe(__pyx_v_msg, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 1254, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_Raise(((PyObject *)__pyx_v_error), __pyx_t_2, 0, 0);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __PYX_ERR(7, 1254, __pyx_L1_error)

  /* "View.MemoryView":1252
 *     raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})"
 * 
 * @cname('__pyx_memoryview_err_dim')             # <<<<<<<<<<<<<<
 * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil:
 *     raise <object>error, msg % dim
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_XDECREF(__pyx_v_msg);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  return __pyx_r;
}

/* "View.MemoryView":1256
 *     raise <object>error, msg % dim
 * 
 * @cname('__pyx_memoryview_err')             # <<<<<<<<<<<<<<
 * cdef int _err(PyObject *error, str msg) except -1 with gil:
 *     raise <object>error, msg
*/

static int __pyx_memoryview_err(PyObject *__pyx_v_error, PyObject *__pyx_v_msg) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("_err", 0);
  __Pyx_INCREF(__pyx_v_msg);

  /* "View.MemoryView":1258
 * @cname('__pyx_memoryview_err')
 * cdef int _err(PyObject *error, str msg) except -1 with gil:
 *     raise <object>error, msg             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_err_no_memory')
*/
  __Pyx_Raise(((PyObject *)__pyx_v_error), __pyx_v_msg, 0, 0);
  __PYX_ERR(7, 1258, __pyx_L1_error)

  /* "View.MemoryView":1256
 *     raise <object>error, msg % dim
 * 
 * @cname('__pyx_memoryview_err')             # <<<<<<<<<<<<<<
 * cdef int _err(PyObject *error, str msg) except -1 with gil:
 *     raise <object>error, msg
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_XDECREF(__pyx_v_msg);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  return __pyx_r;
}

/* "View.MemoryView":1260
 *     raise <object>error, msg
 * 
 * @cname('__pyx_memoryview_err_no_memory')             # <<<<<<<<<<<<<<
 * cdef int _err_no_memory() except -1 with gil:
 *     raise MemoryError
*/

static int __pyx_memoryview_err_no_memory(void) {
  int __pyx_r;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();

  /* "View.MemoryView":1262
 * @cname('__pyx_memoryview_err_no_memory')
 * cdef int _err_no_memory() except -1 with gil:
 *     raise MemoryError             # <<<<<<<<<<<<<<
 * 
 * 
*/
  PyErr_NoMemory(); __PYX_ERR(7, 1262, __pyx_L1_error)

  /* "View.MemoryView":1260
 *     raise <object>error, msg
 * 
 * @cname('__pyx_memoryview_err_no_memory')             # <<<<<<<<<<<<<<
 * cdef int _err_no_memory() except -1 with gil:
 *     raise MemoryError
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("View.MemoryView._err_no_memory", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  return __pyx_r;
}

/* "View.MemoryView":1265
 * 
 * 
 * @cname('__pyx_memoryview_copy_contents')             # <<<<<<<<<<<<<<
 * cdef int memoryview_copy_contents(__Pyx_memviewslice src,
 *                                   __Pyx_memviewslice dst,
*/

static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_memviewslice __pyx_v_dst, int __pyx_v_src_ndim, int __pyx_v_dst_ndim, int __pyx_v_dtype_is_object) {
  void *__pyx_v_tmpdata;
  size_t __pyx_v_itemsize;
  int __pyx_v_i;
  char __pyx_v_order;
  int __pyx_v_broadcasting;
  int __pyx_v_direct_copy;
  __Pyx_memviewslice __pyx_v_tmp;
  int __pyx_v_ndim;
  int __pyx_r;
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  void *__pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save;

  /* "View.MemoryView":1274
 *     Check for overlapping memory and verify the shapes.
 *     """
 *     cdef void *tmpdata = NULL             # <<<<<<<<<<<<<<
 *     cdef size_t itemsize = src.memview.view.itemsize
 *     cdef int i
*/
  __pyx_v_tmpdata = NULL;

  /* "View.MemoryView":1275
 *     """
 *     cdef void *tmpdata = NULL
 *     cdef size_t itemsize = src.memview.view.itemsize             # <<<<<<<<<<<<<<
 *     cdef int i
 *     cdef char order = get_best_order(&src, src_ndim)
*/
  __pyx_t_1 = __pyx_v_src.memview->view.itemsize;
  __pyx_v_itemsize = __pyx_t_1;

  /* "View.MemoryView":1277
 *     cdef size_t itemsize = src.memview.view.itemsize
 *     cdef int i
 *     cdef char order = get_best_order(&src, src_ndim)             # <<<<<<<<<<<<<<
 *     cdef bint broadcasting = False
 *     cdef bint direct_copy = False
*/
  __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim);

  /* "View.MemoryView":1278
 *     cdef int i
 *     cdef char order = get_best_order(&src, src_ndim)
 *     cdef bint broadcasting = False             # <<<<<<<<<<<<<<
 *     cdef bint direct_copy = False
 *     cdef __Pyx_memviewslice tmp
*/
  __pyx_v_broadcasting = 0;

  /* "View.MemoryView":1279
 *     cdef char order = get_best_order(&src, src_ndim)
 *     cdef bint broadcasting = False
 *     cdef bint direct_copy = False             # <<<<<<<<<<<<<<
 *     cdef __Pyx_memviewslice tmp
 * 
*/
  __pyx_v_direct_copy = 0;

  /* "View.MemoryView":1282
 *     cdef __Pyx_memviewslice tmp
 * 
 *     if src_ndim < dst_ndim:             # <<<<<<<<<<<<<<
 *         broadcast_leading(&src, src_ndim, dst_ndim)
 *     elif dst_ndim < src_ndim:
*/
  __pyx_t_2 = (__pyx_v_src_ndim < __pyx_v_dst_ndim);
  if (__pyx_t_2) {

    /* "View.MemoryView":1283
 * 
 *     if src_ndim < dst_ndim:
 *         broadcast_leading(&src, src_ndim, dst_ndim)             # <<<<<<<<<<<<<<
 *     elif dst_ndim < src_ndim:
 *         broadcast_leading(&dst, dst_ndim, src_ndim)
*/
    __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim);

    /* "View.MemoryView":1282
 *     cdef __Pyx_memviewslice tmp
 * 
 *     if src_ndim < dst_ndim:             # <<<<<<<<<<<<<<
 *         broadcast_leading(&src, src_ndim, dst_ndim)
 *     elif dst_ndim < src_ndim:
*/
    goto __pyx_L3;
  }

  /* "View.MemoryView":1284
 *     if src_ndim < dst_ndim:
 *         broadcast_leading(&src, src_ndim, dst_ndim)
 *     elif dst_ndim < src_ndim:             # <<<<<<<<<<<<<<
 *         broadcast_leading(&dst, dst_ndim, src_ndim)
 * 
*/
  __pyx_t_2 = (__pyx_v_dst_ndim < __pyx_v_src_ndim);
  if (__pyx_t_2) {

    /* "View.MemoryView":1285
 *         broadcast_leading(&src, src_ndim, dst_ndim)
 *     elif dst_ndim < src_ndim:
 *         broadcast_leading(&dst, dst_ndim, src_ndim)             # <<<<<<<<<<<<<<
 * 
 *     cdef int ndim = max(src_ndim, dst_ndim)
*/
    __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim);

    /* "View.MemoryView":1284
 *     if src_ndim < dst_ndim:
 *         broadcast_leading(&src, src_ndim, dst_ndim)
 *     elif dst_ndim < src_ndim:             # <<<<<<<<<<<<<<
 *         broadcast_leading(&dst, dst_ndim, src_ndim)
 * 
*/
  }
  __pyx_L3:;

  /* "View.MemoryView":1287
 *         broadcast_leading(&dst, dst_ndim, src_ndim)
 * 
 *     cdef int ndim = max(src_ndim, dst_ndim)             # <<<<<<<<<<<<<<
 * 
 *     for i in range(ndim):
*/
  __pyx_t_3 = __pyx_v_dst_ndim;
  __pyx_t_4 = __pyx_v_src_ndim;
  __pyx_t_2 = (__pyx_t_3 > __pyx_t_4);
  if (__pyx_t_2) {
    __pyx_t_5 = __pyx_t_3;
  } else {
    __pyx_t_5 = __pyx_t_4;
  }
  __pyx_v_ndim = __pyx_t_5;

  /* "View.MemoryView":1289
 *     cdef int ndim = max(src_ndim, dst_ndim)
 * 
 *     for i in range(ndim):             # <<<<<<<<<<<<<<
 *         if src.shape[i] != dst.shape[i]:
 *             if src.shape[i] == 1:
*/
  __pyx_t_5 = __pyx_v_ndim;
  __pyx_t_3 = __pyx_t_5;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;

    /* "View.MemoryView":1290
 * 
 *     for i in range(ndim):
 *         if src.shape[i] != dst.shape[i]:             # <<<<<<<<<<<<<<
 *             if src.shape[i] == 1:
 *                 broadcasting = True
*/
    __pyx_t_2 = ((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i]));
    if (__pyx_t_2) {

      /* "View.MemoryView":1291
 *     for i in range(ndim):
 *         if src.shape[i] != dst.shape[i]:
 *             if src.shape[i] == 1:             # <<<<<<<<<<<<<<
 *                 broadcasting = True
 *                 src.strides[i] = 0
*/
      __pyx_t_2 = ((__pyx_v_src.shape[__pyx_v_i]) == 1);
      if (__pyx_t_2) {

        /* "View.MemoryView":1292
 *         if src.shape[i] != dst.shape[i]:
 *             if src.shape[i] == 1:
 *                 broadcasting = True             # <<<<<<<<<<<<<<
 *                 src.strides[i] = 0
 *             else:
*/
        __pyx_v_broadcasting = 1;

        /* "View.MemoryView":1293
 *             if src.shape[i] == 1:
 *                 broadcasting = True
 *                 src.strides[i] = 0             # <<<<<<<<<<<<<<
 *             else:
 *                 _err_extents(i, dst.shape[i], src.shape[i])
*/
        (__pyx_v_src.strides[__pyx_v_i]) = 0;

        /* "View.MemoryView":1291
 *     for i in range(ndim):
 *         if src.shape[i] != dst.shape[i]:
 *             if src.shape[i] == 1:             # <<<<<<<<<<<<<<
 *                 broadcasting = True
 *                 src.strides[i] = 0
*/
        goto __pyx_L7;
      }

      /* "View.MemoryView":1295
 *                 src.strides[i] = 0
 *             else:
 *                 _err_extents(i, dst.shape[i], src.shape[i])             # <<<<<<<<<<<<<<
 * 
 *         if src.suboffsets[i] >= 0:
*/
      /*else*/ {
        __pyx_t_6 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(7, 1295, __pyx_L1_error)
      }
      __pyx_L7:;

      /* "View.MemoryView":1290
 * 
 *     for i in range(ndim):
 *         if src.shape[i] != dst.shape[i]:             # <<<<<<<<<<<<<<
 *             if src.shape[i] == 1:
 *                 broadcasting = True
*/
    }

    /* "View.MemoryView":1297
 *                 _err_extents(i, dst.shape[i], src.shape[i])
 * 
 *         if src.suboffsets[i] >= 0:             # <<<<<<<<<<<<<<
 *             _err_dim(PyExc_ValueError, "Dimension %d is not direct", i)
 * 
*/
    __pyx_t_2 = ((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":1298
 * 
 *         if src.suboffsets[i] >= 0:
 *             _err_dim(PyExc_ValueError, "Dimension %d is not direct", i)             # <<<<<<<<<<<<<<
 * 
 *     if slices_overlap(&src, &dst, ndim, itemsize):
*/
      __pyx_t_6 = __pyx_memoryview_err_dim(PyExc_ValueError, __pyx_mstate_global->__pyx_kp_u_Dimension_d_is_not_direct, __pyx_v_i); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(7, 1298, __pyx_L1_error)

      /* "View.MemoryView":1297
 *                 _err_extents(i, dst.shape[i], src.shape[i])
 * 
 *         if src.suboffsets[i] >= 0:             # <<<<<<<<<<<<<<
 *             _err_dim(PyExc_ValueError, "Dimension %d is not direct", i)
 * 
*/
    }
  }

  /* "View.MemoryView":1300
 *             _err_dim(PyExc_ValueError, "Dimension %d is not direct", i)
 * 
 *     if slices_overlap(&src, &dst, ndim, itemsize):             # <<<<<<<<<<<<<<
 * 
 *         if not slice_is_contig(src, order, ndim):
*/
  __pyx_t_2 = __pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize);
  if (__pyx_t_2) {

    /* "View.MemoryView":1302
 *     if slices_overlap(&src, &dst, ndim, itemsize):
 * 
 *         if not slice_is_contig(src, order, ndim):             # <<<<<<<<<<<<<<
 *             order = get_best_order(&dst, ndim)
 * 
*/
    __pyx_t_2 = (!__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim));
    if (__pyx_t_2) {

      /* "View.MemoryView":1303
 * 
 *         if not slice_is_contig(src, order, ndim):
 *             order = get_best_order(&dst, ndim)             # <<<<<<<<<<<<<<
 * 
 *         tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)
*/
      __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim);

      /* "View.MemoryView":1302
 *     if slices_overlap(&src, &dst, ndim, itemsize):
 * 
 *         if not slice_is_contig(src, order, ndim):             # <<<<<<<<<<<<<<
 *             order = get_best_order(&dst, ndim)
 * 
*/
    }

    /* "View.MemoryView":1305
 *             order = get_best_order(&dst, ndim)
 * 
 *         tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)             # <<<<<<<<<<<<<<
 *         src = tmp
 * 
*/
    __pyx_t_7 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(7, 1305, __pyx_L1_error)
    __pyx_v_tmpdata = __pyx_t_7;

    /* "View.MemoryView":1306
 * 
 *         tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)
 *         src = tmp             # <<<<<<<<<<<<<<
 * 
 *     if not broadcasting:
*/
    __pyx_v_src = __pyx_v_tmp;

    /* "View.MemoryView":1300
 *             _err_dim(PyExc_ValueError, "Dimension %d is not direct", i)
 * 
 *     if slices_overlap(&src, &dst, ndim, itemsize):             # <<<<<<<<<<<<<<
 * 
 *         if not slice_is_contig(src, order, ndim):
*/
  }

  /* "View.MemoryView":1308
 *         src = tmp
 * 
 *     if not broadcasting:             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_2 = (!__pyx_v_broadcasting);
  if (__pyx_t_2) {

    /* "View.MemoryView":1311
 * 
 * 
 *         if slice_is_contig(src, 'C', ndim):             # <<<<<<<<<<<<<<
 *             direct_copy = slice_is_contig(dst, 'C', ndim)
 *         elif slice_is_contig(src, 'F', ndim):
*/
    __pyx_t_2 = __pyx_memviewslice_is_contig(__pyx_v_src, 'C', __pyx_v_ndim);
    if (__pyx_t_2) {

      /* "View.MemoryView":1312
 * 
 *         if slice_is_contig(src, 'C', ndim):
 *             direct_copy = slice_is_contig(dst, 'C', ndim)             # <<<<<<<<<<<<<<
 *         elif slice_is_contig(src, 'F', ndim):
 *             direct_copy = slice_is_contig(dst, 'F', ndim)
*/
      __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'C', __pyx_v_ndim);

      /* "View.MemoryView":1311
 * 
 * 
 *         if slice_is_contig(src, 'C', ndim):             # <<<<<<<<<<<<<<
 *             direct_copy = slice_is_contig(dst, 'C', ndim)
 *         elif slice_is_contig(src, 'F', ndim):
*/
      goto __pyx_L12;
    }

    /* "View.MemoryView":1313
 *         if slice_is_contig(src, 'C', ndim):
 *             direct_copy = slice_is_contig(dst, 'C', ndim)
 *         elif slice_is_contig(src, 'F', ndim):             # <<<<<<<<<<<<<<
 *             direct_copy = slice_is_contig(dst, 'F', ndim)
 * 
*/
    __pyx_t_2 = __pyx_memviewslice_is_contig(__pyx_v_src, 'F', __pyx_v_ndim);
    if (__pyx_t_2) {

      /* "View.MemoryView":1314
 *             direct_copy = slice_is_contig(dst, 'C', ndim)
 *         elif slice_is_contig(src, 'F', ndim):
 *             direct_copy = slice_is_contig(dst, 'F', ndim)             # <<<<<<<<<<<<<<
 * 
 *         if direct_copy:
*/
      __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'F', __pyx_v_ndim);

      /* "View.MemoryView":1313
 *         if slice_is_contig(src, 'C', ndim):
 *             direct_copy = slice_is_contig(dst, 'C', ndim)
 *         elif slice_is_contig(src, 'F', ndim):             # <<<<<<<<<<<<<<
 *             direct_copy = slice_is_contig(dst, 'F', ndim)
 * 
*/
    }
    __pyx_L12:;

    /* "View.MemoryView":1316
 *             direct_copy = slice_is_contig(dst, 'F', ndim)
 * 
 *         if direct_copy:             # <<<<<<<<<<<<<<
 * 
 *             refcount_copying(&dst, dtype_is_object, ndim, inc=False)
*/
    if (__pyx_v_direct_copy) {

      /* "View.MemoryView":1318
 *         if direct_copy:
 * 
 *             refcount_copying(&dst, dtype_is_object, ndim, inc=False)             # <<<<<<<<<<<<<<
 *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))
 *             refcount_copying(&dst, dtype_is_object, ndim, inc=True)
*/
      __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);

      /* "View.MemoryView":1319
 * 
 *             refcount_copying(&dst, dtype_is_object, ndim, inc=False)
 *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))             # <<<<<<<<<<<<<<
 *             refcount_copying(&dst, dtype_is_object, ndim, inc=True)
 *             free(tmpdata)
*/
      (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim)));

      /* "View.MemoryView":1320
 *             refcount_copying(&dst, dtype_is_object, ndim, inc=False)
 *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))
 *             refcount_copying(&dst, dtype_is_object, ndim, inc=True)             # <<<<<<<<<<<<<<
 *             free(tmpdata)
 *             return 0
*/
      __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);

      /* "View.MemoryView":1321
 *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))
 *             refcount_copying(&dst, dtype_is_object, ndim, inc=True)
 *             free(tmpdata)             # <<<<<<<<<<<<<<
 *             return 0
 * 
*/
      free(__pyx_v_tmpdata);

      /* "View.MemoryView":1322
 *             refcount_copying(&dst, dtype_is_object, ndim, inc=True)
 *             free(tmpdata)
 *             return 0             # <<<<<<<<<<<<<<
 * 
 *     if order == 'F' == get_best_order(&dst, ndim):
*/
      __pyx_r = 0;
      goto __pyx_L0;

      /* "View.MemoryView":1316
 *             direct_copy = slice_is_contig(dst, 'F', ndim)
 * 
 *         if direct_copy:             # <<<<<<<<<<<<<<
 * 
 *             refcount_copying(&dst, dtype_is_object, ndim, inc=False)
*/
    }

    /* "View.MemoryView":1308
 *         src = tmp
 * 
 *     if not broadcasting:             # <<<<<<<<<<<<<<
 * 
 * 
*/
  }

  /* "View.MemoryView":1324
 *             return 0
 * 
 *     if order == 'F' == get_best_order(&dst, ndim):             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_2 = (__pyx_v_order == 'F');
  if (__pyx_t_2) {
    __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim));
  }
  if (__pyx_t_2) {

    /* "View.MemoryView":1327
 * 
 * 
 *         transpose_memslice(&src)             # <<<<<<<<<<<<<<
 *         transpose_memslice(&dst)
 * 
*/
    __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(7, 1327, __pyx_L1_error)

    /* "View.MemoryView":1328
 * 
 *         transpose_memslice(&src)
 *         transpose_memslice(&dst)             # <<<<<<<<<<<<<<
 * 
 *     refcount_copying(&dst, dtype_is_object, ndim, inc=False)
*/
    __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(7, 1328, __pyx_L1_error)

    /* "View.MemoryView":1324
 *             return 0
 * 
 *     if order == 'F' == get_best_order(&dst, ndim):             # <<<<<<<<<<<<<<
 * 
 * 
*/
  }

  /* "View.MemoryView":1330
 *         transpose_memslice(&dst)
 * 
 *     refcount_copying(&dst, dtype_is_object, ndim, inc=False)             # <<<<<<<<<<<<<<
 *     copy_strided_to_strided(&src, &dst, ndim, itemsize)
 *     refcount_copying(&dst, dtype_is_object, ndim, inc=True)
*/
  __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);

  /* "View.MemoryView":1331
 * 
 *     refcount_copying(&dst, dtype_is_object, ndim, inc=False)
 *     copy_strided_to_strided(&src, &dst, ndim, itemsize)             # <<<<<<<<<<<<<<
 *     refcount_copying(&dst, dtype_is_object, ndim, inc=True)
 * 
*/
  copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize);

  /* "View.MemoryView":1332
 *     refcount_copying(&dst, dtype_is_object, ndim, inc=False)
 *     copy_strided_to_strided(&src, &dst, ndim, itemsize)
 *     refcount_copying(&dst, dtype_is_object, ndim, inc=True)             # <<<<<<<<<<<<<<
 * 
 *     free(tmpdata)
*/
  __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);

  /* "View.MemoryView":1334
 *     refcount_copying(&dst, dtype_is_object, ndim, inc=True)
 * 
 *     free(tmpdata)             # <<<<<<<<<<<<<<
 *     return 0
 * 
*/
  free(__pyx_v_tmpdata);

  /* "View.MemoryView":1335
 * 
 *     free(tmpdata)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_broadcast_leading')
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "View.MemoryView":1265
 * 
 * 
 * @cname('__pyx_memoryview_copy_contents')             # <<<<<<<<<<<<<<
 * cdef int memoryview_copy_contents(__Pyx_memviewslice src,
 *                                   __Pyx_memviewslice dst,
*/

  /* function exit code */
  __pyx_L1_error:;
  __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_AddTraceback("View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":1337
 *     return 0
 * 
 * @cname('__pyx_memoryview_broadcast_leading')             # <<<<<<<<<<<<<<
 * cdef void broadcast_leading(__Pyx_memviewslice *mslice,
 *                             int ndim,
*/

static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim, int __pyx_v_ndim_other) {
  int __pyx_v_i;
  int __pyx_v_offset;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;

  /* "View.MemoryView":1342
 *                             int ndim_other) noexcept nogil:
 *     cdef int i
 *     cdef int offset = ndim_other - ndim             # <<<<<<<<<<<<<<
 * 
 *     for i in range(ndim - 1, -1, -1):
*/
  __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim);

  /* "View.MemoryView":1344
 *     cdef int offset = ndim_other - ndim
 * 
 *     for i in range(ndim - 1, -1, -1):             # <<<<<<<<<<<<<<
 *         mslice.shape[i + offset] = mslice.shape[i]
 *         mslice.strides[i + offset] = mslice.strides[i]
*/
  for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
    __pyx_v_i = __pyx_t_1;

    /* "View.MemoryView":1345
 * 
 *     for i in range(ndim - 1, -1, -1):
 *         mslice.shape[i + offset] = mslice.shape[i]             # <<<<<<<<<<<<<<
 *         mslice.strides[i + offset] = mslice.strides[i]
 *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]
*/
    (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]);

    /* "View.MemoryView":1346
 *     for i in range(ndim - 1, -1, -1):
 *         mslice.shape[i + offset] = mslice.shape[i]
 *         mslice.strides[i + offset] = mslice.strides[i]             # <<<<<<<<<<<<<<
 *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]
 * 
*/
    (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]);

    /* "View.MemoryView":1347
 *         mslice.shape[i + offset] = mslice.shape[i]
 *         mslice.strides[i + offset] = mslice.strides[i]
 *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]             # <<<<<<<<<<<<<<
 * 
 *     for i in range(offset):
*/
    (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]);
  }

  /* "View.MemoryView":1349
 *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]
 * 
 *     for i in range(offset):             # <<<<<<<<<<<<<<
 *         mslice.shape[i] = 1
 *         mslice.strides[i] = mslice.strides[0]
*/
  __pyx_t_1 = __pyx_v_offset;
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "View.MemoryView":1350
 * 
 *     for i in range(offset):
 *         mslice.shape[i] = 1             # <<<<<<<<<<<<<<
 *         mslice.strides[i] = mslice.strides[0]
 *         mslice.suboffsets[i] = -1
*/
    (__pyx_v_mslice->shape[__pyx_v_i]) = 1;

    /* "View.MemoryView":1351
 *     for i in range(offset):
 *         mslice.shape[i] = 1
 *         mslice.strides[i] = mslice.strides[0]             # <<<<<<<<<<<<<<
 *         mslice.suboffsets[i] = -1
 * 
*/
    (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]);

    /* "View.MemoryView":1352
 *         mslice.shape[i] = 1
 *         mslice.strides[i] = mslice.strides[0]
 *         mslice.suboffsets[i] = -1             # <<<<<<<<<<<<<<
 * 
 * 
*/
    (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1L;
  }

  /* "View.MemoryView":1337
 *     return 0
 * 
 * @cname('__pyx_memoryview_broadcast_leading')             # <<<<<<<<<<<<<<
 * cdef void broadcast_leading(__Pyx_memviewslice *mslice,
 *                             int ndim,
*/

  /* function exit code */
}

/* "View.MemoryView":1359
 * 
 * 
 * @cname('__pyx_memoryview_refcount_copying')             # <<<<<<<<<<<<<<
 * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil:
 * 
*/

static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_dtype_is_object, int __pyx_v_ndim, int __pyx_v_inc) {

  /* "View.MemoryView":1362
 * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil:
 * 
 *     if dtype_is_object:             # <<<<<<<<<<<<<<
 *         refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc)
 * 
*/
  if (__pyx_v_dtype_is_object) {

    /* "View.MemoryView":1363
 * 
 *     if dtype_is_object:
 *         refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc)             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil')
*/
    __pyx_memoryview_refcount_objects_in_slice_with_gil(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_inc);

    /* "View.MemoryView":1362
 * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil:
 * 
 *     if dtype_is_object:             # <<<<<<<<<<<<<<
 *         refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc)
 * 
*/
  }

  /* "View.MemoryView":1359
 * 
 * 
 * @cname('__pyx_memoryview_refcount_copying')             # <<<<<<<<<<<<<<
 * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil:
 * 
*/

  /* function exit code */
}

/* "View.MemoryView":1365
 *         refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc)
 * 
 * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil')             # <<<<<<<<<<<<<<
 * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape,
 *                                              Py_ssize_t *strides, int ndim,
*/

static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) {
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();

  /* "View.MemoryView":1369
 *                                              Py_ssize_t *strides, int ndim,
 *                                              bint inc) noexcept with gil:
 *     refcount_objects_in_slice(data, shape, strides, ndim, inc)             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_refcount_objects_in_slice')
*/
  __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc);

  /* "View.MemoryView":1365
 *         refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc)
 * 
 * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil')             # <<<<<<<<<<<<<<
 * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape,
 *                                              Py_ssize_t *strides, int ndim,
*/

  /* function exit code */
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
}

/* "View.MemoryView":1371
 *     refcount_objects_in_slice(data, shape, strides, ndim, inc)
 * 
 * @cname('__pyx_memoryview_refcount_objects_in_slice')             # <<<<<<<<<<<<<<
 * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape,
 *                                     Py_ssize_t *strides, int ndim, bint inc) noexcept:
*/

static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) {
  CYTHON_UNUSED Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_stride;
  Py_ssize_t __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;

  /* "View.MemoryView":1375
 *                                     Py_ssize_t *strides, int ndim, bint inc) noexcept:
 *     cdef Py_ssize_t i
 *     cdef Py_ssize_t stride = strides[0]             # <<<<<<<<<<<<<<
 * 
 *     for i in range(shape[0]):
*/
  __pyx_v_stride = (__pyx_v_strides[0]);

  /* "View.MemoryView":1377
 *     cdef Py_ssize_t stride = strides[0]
 * 
 *     for i in range(shape[0]):             # <<<<<<<<<<<<<<
 *         if ndim == 1:
 *             if inc:
*/
  __pyx_t_1 = (__pyx_v_shape[0]);
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "View.MemoryView":1378
 * 
 *     for i in range(shape[0]):
 *         if ndim == 1:             # <<<<<<<<<<<<<<
 *             if inc:
 *                 Py_INCREF((<PyObject **> data)[0])
*/
    __pyx_t_4 = (__pyx_v_ndim == 1);
    if (__pyx_t_4) {

      /* "View.MemoryView":1379
 *     for i in range(shape[0]):
 *         if ndim == 1:
 *             if inc:             # <<<<<<<<<<<<<<
 *                 Py_INCREF((<PyObject **> data)[0])
 *             else:
*/
      if (__pyx_v_inc) {

        /* "View.MemoryView":1380
 *         if ndim == 1:
 *             if inc:
 *                 Py_INCREF((<PyObject **> data)[0])             # <<<<<<<<<<<<<<
 *             else:
 *                 Py_DECREF((<PyObject **> data)[0])
*/
        Py_INCREF((((PyObject **)__pyx_v_data)[0]));

        /* "View.MemoryView":1379
 *     for i in range(shape[0]):
 *         if ndim == 1:
 *             if inc:             # <<<<<<<<<<<<<<
 *                 Py_INCREF((<PyObject **> data)[0])
 *             else:
*/
        goto __pyx_L6;
      }

      /* "View.MemoryView":1382
 *                 Py_INCREF((<PyObject **> data)[0])
 *             else:
 *                 Py_DECREF((<PyObject **> data)[0])             # <<<<<<<<<<<<<<
 *         else:
 *             refcount_objects_in_slice(data, shape + 1, strides + 1, ndim - 1, inc)
*/
      /*else*/ {
        Py_DECREF((((PyObject **)__pyx_v_data)[0]));
      }
      __pyx_L6:;

      /* "View.MemoryView":1378
 * 
 *     for i in range(shape[0]):
 *         if ndim == 1:             # <<<<<<<<<<<<<<
 *             if inc:
 *                 Py_INCREF((<PyObject **> data)[0])
*/
      goto __pyx_L5;
    }

    /* "View.MemoryView":1384
 *                 Py_DECREF((<PyObject **> data)[0])
 *         else:
 *             refcount_objects_in_slice(data, shape + 1, strides + 1, ndim - 1, inc)             # <<<<<<<<<<<<<<
 * 
 *         data += stride
*/
    /*else*/ {
      __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc);
    }
    __pyx_L5:;

    /* "View.MemoryView":1386
 *             refcount_objects_in_slice(data, shape + 1, strides + 1, ndim - 1, inc)
 * 
 *         data += stride             # <<<<<<<<<<<<<<
 * 
 * 
*/
    __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
  }

  /* "View.MemoryView":1371
 *     refcount_objects_in_slice(data, shape, strides, ndim, inc)
 * 
 * @cname('__pyx_memoryview_refcount_objects_in_slice')             # <<<<<<<<<<<<<<
 * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape,
 *                                     Py_ssize_t *strides, int ndim, bint inc) noexcept:
*/

  /* function exit code */
}

/* "View.MemoryView":1391
 * 
 * 
 * @cname('__pyx_memoryview_slice_assign_scalar')             # <<<<<<<<<<<<<<
 * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim,
 *                               size_t itemsize, void *item,
*/

static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item, int __pyx_v_dtype_is_object) {

  /* "View.MemoryView":1395
 *                               size_t itemsize, void *item,
 *                               bint dtype_is_object) noexcept nogil:
 *     refcount_copying(dst, dtype_is_object, ndim, inc=False)             # <<<<<<<<<<<<<<
 *     _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, itemsize, item)
 *     refcount_copying(dst, dtype_is_object, ndim, inc=True)
*/
  __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0);

  /* "View.MemoryView":1396
 *                               bint dtype_is_object) noexcept nogil:
 *     refcount_copying(dst, dtype_is_object, ndim, inc=False)
 *     _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, itemsize, item)             # <<<<<<<<<<<<<<
 *     refcount_copying(dst, dtype_is_object, ndim, inc=True)
 * 
*/
  __pyx_memoryview__slice_assign_scalar(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_itemsize, __pyx_v_item);

  /* "View.MemoryView":1397
 *     refcount_copying(dst, dtype_is_object, ndim, inc=False)
 *     _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, itemsize, item)
 *     refcount_copying(dst, dtype_is_object, ndim, inc=True)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1);

  /* "View.MemoryView":1391
 * 
 * 
 * @cname('__pyx_memoryview_slice_assign_scalar')             # <<<<<<<<<<<<<<
 * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim,
 *                               size_t itemsize, void *item,
*/

  /* function exit code */
}

/* "View.MemoryView":1400
 * 
 * 
 * @cname('__pyx_memoryview__slice_assign_scalar')             # <<<<<<<<<<<<<<
 * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape,
 *                               Py_ssize_t *strides, int ndim,
*/

static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item) {
  CYTHON_UNUSED Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_stride;
  Py_ssize_t __pyx_v_extent;
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;

  /* "View.MemoryView":1405
 *                               size_t itemsize, void *item) noexcept nogil:
 *     cdef Py_ssize_t i
 *     cdef Py_ssize_t stride = strides[0]             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t extent = shape[0]
 * 
*/
  __pyx_v_stride = (__pyx_v_strides[0]);

  /* "View.MemoryView":1406
 *     cdef Py_ssize_t i
 *     cdef Py_ssize_t stride = strides[0]
 *     cdef Py_ssize_t extent = shape[0]             # <<<<<<<<<<<<<<
 * 
 *     if ndim == 1:
*/
  __pyx_v_extent = (__pyx_v_shape[0]);

  /* "View.MemoryView":1408
 *     cdef Py_ssize_t extent = shape[0]
 * 
 *     if ndim == 1:             # <<<<<<<<<<<<<<
 *         for i in range(extent):
 *             memcpy(data, item, itemsize)
*/
  __pyx_t_1 = (__pyx_v_ndim == 1);
  if (__pyx_t_1) {

    /* "View.MemoryView":1409
 * 
 *     if ndim == 1:
 *         for i in range(extent):             # <<<<<<<<<<<<<<
 *             memcpy(data, item, itemsize)
 *             data += stride
*/
    __pyx_t_2 = __pyx_v_extent;
    __pyx_t_3 = __pyx_t_2;
    for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
      __pyx_v_i = __pyx_t_4;

      /* "View.MemoryView":1410
 *     if ndim == 1:
 *         for i in range(extent):
 *             memcpy(data, item, itemsize)             # <<<<<<<<<<<<<<
 *             data += stride
 *     else:
*/
      (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize));

      /* "View.MemoryView":1411
 *         for i in range(extent):
 *             memcpy(data, item, itemsize)
 *             data += stride             # <<<<<<<<<<<<<<
 *     else:
 *         for i in range(extent):
*/
      __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
    }

    /* "View.MemoryView":1408
 *     cdef Py_ssize_t extent = shape[0]
 * 
 *     if ndim == 1:             # <<<<<<<<<<<<<<
 *         for i in range(extent):
 *             memcpy(data, item, itemsize)
*/
    goto __pyx_L3;
  }

  /* "View.MemoryView":1413
 *             data += stride
 *     else:
 *         for i in range(extent):             # <<<<<<<<<<<<<<
 *             _slice_assign_scalar(data, shape + 1, strides + 1, ndim - 1, itemsize, item)
 *             data += stride
*/
  /*else*/ {
    __pyx_t_2 = __pyx_v_extent;
    __pyx_t_3 = __pyx_t_2;
    for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
      __pyx_v_i = __pyx_t_4;

      /* "View.MemoryView":1414
 *     else:
 *         for i in range(extent):
 *             _slice_assign_scalar(data, shape + 1, strides + 1, ndim - 1, itemsize, item)             # <<<<<<<<<<<<<<
 *             data += stride
 * 
*/
      __pyx_memoryview__slice_assign_scalar(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize, __pyx_v_item);

      /* "View.MemoryView":1415
 *         for i in range(extent):
 *             _slice_assign_scalar(data, shape + 1, strides + 1, ndim - 1, itemsize, item)
 *             data += stride             # <<<<<<<<<<<<<<
 * 
*/
      __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
    }
  }
  __pyx_L3:;

  /* "View.MemoryView":1400
 * 
 * 
 * @cname('__pyx_memoryview__slice_assign_scalar')             # <<<<<<<<<<<<<<
 * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape,
 *                               Py_ssize_t *strides, int ndim,
*/

  /* function exit code */
}

/* "(tree fragment)":4
 *     int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1
 *     int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1
 * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_result
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name')
*/

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum = {"__pyx_unpickle_Enum", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_Enum (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_type,&__pyx_mstate_global->__pyx_n_u_pyx_checksum,&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(7, 4, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(7, 4, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(7, 4, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(7, 4, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__pyx_unpickle_Enum", 0) < (0)) __PYX_ERR(7, 4, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, i); __PYX_ERR(7, 4, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(7, 4, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(7, 4, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(7, 4, __pyx_L3_error)
    }
    __pyx_v___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyLong_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(7, 4, __pyx_L3_error)
    __pyx_v___pyx_state = ((PyObject*)values[2]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, __pyx_nargs); __PYX_ERR(7, 4, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v___pyx_state), (&PyTuple_Type), 1, "__pyx_state", 1))) __PYX_ERR(7, 4, __pyx_L1_error)
  __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_unpickle_Enum", 0);

  /* "(tree fragment)":6
 * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, tuple __pyx_state):
 *     cdef object __pyx_result
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name')             # <<<<<<<<<<<<<<
 *     __pyx_result = Enum.__new__(__pyx_type)
 *     if __pyx_state is not None:
*/
  __pyx_t_1 = __Pyx_CheckUnpickleChecksum(__pyx_v___pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, __pyx_k_name); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(7, 6, __pyx_L1_error)

  /* "(tree fragment)":7
 *     cdef object __pyx_result
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name')
 *     __pyx_result = Enum.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
*/
  __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_MemviewEnum_type);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v___pyx_type};
    __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_new, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 7, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_v___pyx_result = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "(tree fragment)":8
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name')
 *     __pyx_result = Enum.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
 *     return __pyx_result
*/
  __pyx_t_5 = (__pyx_v___pyx_state != ((PyObject*)Py_None));
  if (__pyx_t_5) {

    /* "(tree fragment)":9
 *     __pyx_result = Enum.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple):
*/
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "cannot pass None into a C function argument that is declared 'not None'");
      __PYX_ERR(7, 9, __pyx_L1_error)
    }
    __pyx_t_2 = __pyx_unpickle_Enum__set_state(((struct __pyx_MemviewEnum_obj *)__pyx_v___pyx_result), __pyx_v___pyx_state); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "(tree fragment)":8
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name')
 *     __pyx_result = Enum.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
 *     return __pyx_result
*/
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple):
 *     __pyx_result.name = __pyx_state[0]
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":4
 *     int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1
 *     int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1
 * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_result
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name')
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple):             # <<<<<<<<<<<<<<
 *     __pyx_result.name = __pyx_state[0]
 *     __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 1)
*/

static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_unpickle_Enum__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple):
 *     __pyx_result.name = __pyx_state[0]             # <<<<<<<<<<<<<<
 *     __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 1)
*/
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->name);
  __Pyx_DECREF(__pyx_v___pyx_result->name);
  __pyx_v___pyx_result->name = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple):
 *     __pyx_result.name = __pyx_state[0]
 *     __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 1)             # <<<<<<<<<<<<<<
*/
  __pyx_t_2 = __Pyx_UpdateUnpickledDict(((PyObject *)__pyx_v___pyx_result), __pyx_v___pyx_state, 1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(7, 13, __pyx_L1_error)

  /* "(tree fragment)":11
 *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple):             # <<<<<<<<<<<<<<
 *     __pyx_result.name = __pyx_state[0]
 *     __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 1)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":95
 * 
 * class _ImmutableMapping(MutableMapping):
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         raise KeyError, key
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_17_ImmutableMapping_1__getitem__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_17_ImmutableMapping_1__getitem__ = {"__getitem__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_17_ImmutableMapping_1__getitem__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_17_ImmutableMapping_1__getitem__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_key = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_key,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 95, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 95, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 95, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__getitem__", 0) < (0)) __PYX_ERR(0, 95, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__getitem__", 1, 2, 2, i); __PYX_ERR(0, 95, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 95, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 95, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
    __pyx_v_key = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__getitem__", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 95, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._ImmutableMapping.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_17_ImmutableMapping___getitem__(__pyx_self, __pyx_v_self, __pyx_v_key);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_17_ImmutableMapping___getitem__(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "lxml/etree.pyx":96
 * class _ImmutableMapping(MutableMapping):
 *     def __getitem__(self, key):
 *         raise KeyError, key             # <<<<<<<<<<<<<<
 * 
 *     def __setitem__(self, key, value):
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_KeyError))), __pyx_v_key, 0, 0);
  __PYX_ERR(0, 96, __pyx_L1_error)

  /* "lxml/etree.pyx":95
 * 
 * class _ImmutableMapping(MutableMapping):
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         raise KeyError, key
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._ImmutableMapping.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":98
 *         raise KeyError, key
 * 
 *     def __setitem__(self, key, value):             # <<<<<<<<<<<<<<
 *         raise KeyError, key
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_17_ImmutableMapping_3__setitem__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_17_ImmutableMapping_3__setitem__ = {"__setitem__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_17_ImmutableMapping_3__setitem__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_17_ImmutableMapping_3__setitem__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_key = 0;
  CYTHON_UNUSED PyObject *__pyx_v_value = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_key,&__pyx_mstate_global->__pyx_n_u_value,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 98, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 98, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 98, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 98, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setitem__", 0) < (0)) __PYX_ERR(0, 98, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setitem__", 1, 3, 3, i); __PYX_ERR(0, 98, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 98, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 98, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 98, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
    __pyx_v_key = values[1];
    __pyx_v_value = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setitem__", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 98, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._ImmutableMapping.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_17_ImmutableMapping_2__setitem__(__pyx_self, __pyx_v_self, __pyx_v_key, __pyx_v_value);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_17_ImmutableMapping_2__setitem__(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_key, CYTHON_UNUSED PyObject *__pyx_v_value) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setitem__", 0);

  /* "lxml/etree.pyx":99
 * 
 *     def __setitem__(self, key, value):
 *         raise KeyError, key             # <<<<<<<<<<<<<<
 * 
 *     def __delitem__(self, key):
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_KeyError))), __pyx_v_key, 0, 0);
  __PYX_ERR(0, 99, __pyx_L1_error)

  /* "lxml/etree.pyx":98
 *         raise KeyError, key
 * 
 *     def __setitem__(self, key, value):             # <<<<<<<<<<<<<<
 *         raise KeyError, key
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._ImmutableMapping.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":101
 *         raise KeyError, key
 * 
 *     def __delitem__(self, key):             # <<<<<<<<<<<<<<
 *         raise KeyError, key
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_17_ImmutableMapping_5__delitem__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_17_ImmutableMapping_5__delitem__ = {"__delitem__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_17_ImmutableMapping_5__delitem__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_17_ImmutableMapping_5__delitem__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_key = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__delitem__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_key,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 101, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 101, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 101, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__delitem__", 0) < (0)) __PYX_ERR(0, 101, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__delitem__", 1, 2, 2, i); __PYX_ERR(0, 101, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 101, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 101, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
    __pyx_v_key = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__delitem__", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 101, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._ImmutableMapping.__delitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_17_ImmutableMapping_4__delitem__(__pyx_self, __pyx_v_self, __pyx_v_key);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_17_ImmutableMapping_4__delitem__(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__delitem__", 0);

  /* "lxml/etree.pyx":102
 * 
 *     def __delitem__(self, key):
 *         raise KeyError, key             # <<<<<<<<<<<<<<
 * 
 *     def __contains__(self, key):
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_KeyError))), __pyx_v_key, 0, 0);
  __PYX_ERR(0, 102, __pyx_L1_error)

  /* "lxml/etree.pyx":101
 *         raise KeyError, key
 * 
 *     def __delitem__(self, key):             # <<<<<<<<<<<<<<
 *         raise KeyError, key
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._ImmutableMapping.__delitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":104
 *         raise KeyError, key
 * 
 *     def __contains__(self, key):             # <<<<<<<<<<<<<<
 *         return False
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_17_ImmutableMapping_7__contains__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_17_ImmutableMapping_7__contains__ = {"__contains__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_17_ImmutableMapping_7__contains__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_17_ImmutableMapping_7__contains__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_key = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_key,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 104, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 104, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 104, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__contains__", 0) < (0)) __PYX_ERR(0, 104, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__contains__", 1, 2, 2, i); __PYX_ERR(0, 104, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 104, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 104, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
    __pyx_v_key = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__contains__", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 104, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._ImmutableMapping.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_17_ImmutableMapping_6__contains__(__pyx_self, __pyx_v_self, __pyx_v_key);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_17_ImmutableMapping_6__contains__(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_key) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__", 0);

  /* "lxml/etree.pyx":105
 * 
 *     def __contains__(self, key):
 *         return False             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_False);
  __pyx_r = Py_False;
  goto __pyx_L0;

  /* "lxml/etree.pyx":104
 *         raise KeyError, key
 * 
 *     def __contains__(self, key):             # <<<<<<<<<<<<<<
 *         return False
 * 
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":107
 *         return False
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return 0
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_17_ImmutableMapping_9__len__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_17_ImmutableMapping_9__len__ = {"__len__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_17_ImmutableMapping_9__len__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_17_ImmutableMapping_9__len__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 107, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 107, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__len__", 0) < (0)) __PYX_ERR(0, 107, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__len__", 1, 1, 1, i); __PYX_ERR(0, 107, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 107, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__len__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 107, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._ImmutableMapping.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_17_ImmutableMapping_8__len__(__pyx_self, __pyx_v_self);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_17_ImmutableMapping_8__len__(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "lxml/etree.pyx":108
 * 
 *     def __len__(self):
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0);
  __pyx_r = __pyx_mstate_global->__pyx_int_0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":107
 *         return False
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return 0
 * 
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":110
 *         return 0
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return ITER_EMPTY
 *     iterkeys = itervalues = iteritems = __iter__
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_17_ImmutableMapping_11__iter__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_17_ImmutableMapping_11__iter__ = {"__iter__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_17_ImmutableMapping_11__iter__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_17_ImmutableMapping_11__iter__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 110, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 110, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__iter__", 0) < (0)) __PYX_ERR(0, 110, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__iter__", 1, 1, 1, i); __PYX_ERR(0, 110, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 110, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__iter__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 110, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._ImmutableMapping.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_17_ImmutableMapping_10__iter__(__pyx_self, __pyx_v_self);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_17_ImmutableMapping_10__iter__(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "lxml/etree.pyx":111
 * 
 *     def __iter__(self):
 *         return ITER_EMPTY             # <<<<<<<<<<<<<<
 *     iterkeys = itervalues = iteritems = __iter__
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_4lxml_5etree_ITER_EMPTY);
  __pyx_r = __pyx_v_4lxml_5etree_ITER_EMPTY;
  goto __pyx_L0;

  /* "lxml/etree.pyx":110
 *         return 0
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return ITER_EMPTY
 *     iterkeys = itervalues = iteritems = __iter__
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":176
 * cdef object _DEFAULT_NAMESPACE_PREFIXES_ITEMS = []
 * 
 * cdef _update_default_namespace_prefixes_items():             # <<<<<<<<<<<<<<
 *     cdef bytes ns, prefix
 *     global _DEFAULT_NAMESPACE_PREFIXES_ITEMS
*/

static PyObject *__pyx_f_4lxml_5etree__update_default_namespace_prefixes_items(void) {
  PyObject *__pyx_7genexpr__pyx_v_ns = NULL;
  PyObject *__pyx_7genexpr__pyx_v_prefix = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_update_default_namespace_prefixes_items", 0);

  /* "lxml/etree.pyx":182
 *         ns.decode('utf-8') : prefix.decode('utf-8')
 *         for ns, prefix in _DEFAULT_NAMESPACE_PREFIXES.items()
 *     }.items()             # <<<<<<<<<<<<<<
 * 
 * _update_default_namespace_prefixes_items()
*/
  { /* enter inner scope */

    /* "lxml/etree.pyx":179
 *     cdef bytes ns, prefix
 *     global _DEFAULT_NAMESPACE_PREFIXES_ITEMS
 *     _DEFAULT_NAMESPACE_PREFIXES_ITEMS = {             # <<<<<<<<<<<<<<
 *         ns.decode('utf-8') : prefix.decode('utf-8')
 *         for ns, prefix in _DEFAULT_NAMESPACE_PREFIXES.items()
*/
    __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 179, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_1);

    /* "lxml/etree.pyx":181
 *     _DEFAULT_NAMESPACE_PREFIXES_ITEMS = {
 *         ns.decode('utf-8') : prefix.decode('utf-8')
 *         for ns, prefix in _DEFAULT_NAMESPACE_PREFIXES.items()             # <<<<<<<<<<<<<<
 *     }.items()
 * 
*/
    __pyx_t_3 = 0;
    if (unlikely(__pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
      __PYX_ERR(0, 181, __pyx_L5_error)
    }
    __pyx_t_6 = __Pyx_dict_iterator(__pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES, 1, __pyx_mstate_global->__pyx_n_u_items, (&__pyx_t_4), (&__pyx_t_5)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 181, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_2);
    __pyx_t_2 = __pyx_t_6;
    __pyx_t_6 = 0;
    while (1) {
      __pyx_t_8 = __Pyx_dict_iter_next(__pyx_t_2, __pyx_t_4, &__pyx_t_3, &__pyx_t_6, &__pyx_t_7, NULL, __pyx_t_5);
      if (unlikely(__pyx_t_8 == 0)) break;
      if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(0, 181, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);
      if (!(likely(PyBytes_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_6))) __PYX_ERR(0, 181, __pyx_L5_error)
      if (!(likely(PyBytes_CheckExact(__pyx_t_7))||((__pyx_t_7) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_7))) __PYX_ERR(0, 181, __pyx_L5_error)
      __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_ns, ((PyObject*)__pyx_t_6));
      __pyx_t_6 = 0;
      __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_prefix, ((PyObject*)__pyx_t_7));
      __pyx_t_7 = 0;

      /* "lxml/etree.pyx":180
 *     global _DEFAULT_NAMESPACE_PREFIXES_ITEMS
 *     _DEFAULT_NAMESPACE_PREFIXES_ITEMS = {
 *         ns.decode('utf-8') : prefix.decode('utf-8')             # <<<<<<<<<<<<<<
 *         for ns, prefix in _DEFAULT_NAMESPACE_PREFIXES.items()
 *     }.items()
*/
      if (unlikely(__pyx_7genexpr__pyx_v_ns == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "decode");
        __PYX_ERR(0, 180, __pyx_L5_error)
      }
      __pyx_t_7 = __Pyx_decode_bytes(__pyx_7genexpr__pyx_v_ns, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 180, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (unlikely(__pyx_7genexpr__pyx_v_prefix == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "decode");
        __PYX_ERR(0, 180, __pyx_L5_error)
      }
      __pyx_t_6 = __Pyx_decode_bytes(__pyx_7genexpr__pyx_v_prefix, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 180, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (unlikely(PyDict_SetItem(__pyx_t_1, (PyObject*)__pyx_t_7, (PyObject*)__pyx_t_6))) __PYX_ERR(0, 180, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_7genexpr__pyx_v_ns); __pyx_7genexpr__pyx_v_ns = 0;
    __Pyx_XDECREF(__pyx_7genexpr__pyx_v_prefix); __pyx_7genexpr__pyx_v_prefix = 0;
    goto __pyx_L8_exit_scope;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_7genexpr__pyx_v_ns); __pyx_7genexpr__pyx_v_ns = 0;
    __Pyx_XDECREF(__pyx_7genexpr__pyx_v_prefix); __pyx_7genexpr__pyx_v_prefix = 0;
    goto __pyx_L1_error;
    __pyx_L8_exit_scope:;
  } /* exit inner scope */

  /* "lxml/etree.pyx":182
 *         ns.decode('utf-8') : prefix.decode('utf-8')
 *         for ns, prefix in _DEFAULT_NAMESPACE_PREFIXES.items()
 *     }.items()             # <<<<<<<<<<<<<<
 * 
 * _update_default_namespace_prefixes_items()
*/
  __pyx_t_2 = __Pyx_PyDict_Items(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES_ITEMS);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES_ITEMS, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;

  /* "lxml/etree.pyx":176
 * cdef object _DEFAULT_NAMESPACE_PREFIXES_ITEMS = []
 * 
 * cdef _update_default_namespace_prefixes_items():             # <<<<<<<<<<<<<<
 *     cdef bytes ns, prefix
 *     global _DEFAULT_NAMESPACE_PREFIXES_ITEMS
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree._update_default_namespace_prefixes_items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_7genexpr__pyx_v_ns);
  __Pyx_XDECREF(__pyx_7genexpr__pyx_v_prefix);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":188
 * cdef object _check_internal_prefix = re.compile(br"ns\d+$").match
 * 
 * def register_namespace(prefix, uri):             # <<<<<<<<<<<<<<
 *     """Registers a namespace prefix that newly created Elements in that
 *     namespace will use.  The registry is global, and any existing
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_1register_namespace(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_register_namespace, "Registers a namespace prefix that newly created Elements in that\n    namespace will use.  The registry is global, and any existing\n    mapping for either the given prefix or the namespace URI will be\n    removed.\n    ");
static PyMethodDef __pyx_mdef_4lxml_5etree_1register_namespace = {"register_namespace", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_1register_namespace, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_register_namespace};
static PyObject *__pyx_pw_4lxml_5etree_1register_namespace(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_prefix = 0;
  PyObject *__pyx_v_uri = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("register_namespace (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_prefix,&__pyx_mstate_global->__pyx_n_u_uri,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 188, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 188, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 188, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "register_namespace", 0) < (0)) __PYX_ERR(0, 188, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("register_namespace", 1, 2, 2, i); __PYX_ERR(0, 188, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 188, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 188, __pyx_L3_error)
    }
    __pyx_v_prefix = values[0];
    __pyx_v_uri = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("register_namespace", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 188, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.register_namespace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_register_namespace(__pyx_self, __pyx_v_prefix, __pyx_v_uri);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_register_namespace(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_prefix, PyObject *__pyx_v_uri) {
  PyObject *__pyx_v_prefix_utf = NULL;
  PyObject *__pyx_v_uri_utf = NULL;
  PyObject *__pyx_v_k = NULL;
  PyObject *__pyx_v_v = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *(*__pyx_t_11)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("register_namespace", 0);

  /* "lxml/etree.pyx":194
 *     removed.
 *     """
 *     prefix_utf, uri_utf = _utf8(prefix), _utf8(uri)             # <<<<<<<<<<<<<<
 *     if _check_internal_prefix(prefix_utf):
 *         raise ValueError("Prefix format reserved for internal use")
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__utf8(__pyx_v_prefix); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 194, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__utf8(__pyx_v_uri); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 194, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_prefix_utf = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_v_uri_utf = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "lxml/etree.pyx":195
 *     """
 *     prefix_utf, uri_utf = _utf8(prefix), _utf8(uri)
 *     if _check_internal_prefix(prefix_utf):             # <<<<<<<<<<<<<<
 *         raise ValueError("Prefix format reserved for internal use")
 *     _tagValidOrRaise(prefix_utf)
*/
  __pyx_t_1 = NULL;
  __Pyx_INCREF(__pyx_v_4lxml_5etree__check_internal_prefix);
  __pyx_t_3 = __pyx_v_4lxml_5etree__check_internal_prefix; 
  __pyx_t_4 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_1);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_4 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_v_prefix_utf};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 195, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 195, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(__pyx_t_5)) {

    /* "lxml/etree.pyx":196
 *     prefix_utf, uri_utf = _utf8(prefix), _utf8(uri)
 *     if _check_internal_prefix(prefix_utf):
 *         raise ValueError("Prefix format reserved for internal use")             # <<<<<<<<<<<<<<
 *     _tagValidOrRaise(prefix_utf)
 *     _uriValidOrRaise(uri_utf)
*/
    __pyx_t_3 = NULL;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Prefix_format_reserved_for_inter};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 196, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(0, 196, __pyx_L1_error)

    /* "lxml/etree.pyx":195
 *     """
 *     prefix_utf, uri_utf = _utf8(prefix), _utf8(uri)
 *     if _check_internal_prefix(prefix_utf):             # <<<<<<<<<<<<<<
 *         raise ValueError("Prefix format reserved for internal use")
 *     _tagValidOrRaise(prefix_utf)
*/
  }

  /* "lxml/etree.pyx":197
 *     if _check_internal_prefix(prefix_utf):
 *         raise ValueError("Prefix format reserved for internal use")
 *     _tagValidOrRaise(prefix_utf)             # <<<<<<<<<<<<<<
 *     _uriValidOrRaise(uri_utf)
 *     if (uri_utf == b"http://www.w3.org/XML/1998/namespace" and prefix_utf != b'xml'
*/
  __pyx_t_6 = __pyx_f_4lxml_5etree__tagValidOrRaise(__pyx_v_prefix_utf); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 197, __pyx_L1_error)

  /* "lxml/etree.pyx":198
 *         raise ValueError("Prefix format reserved for internal use")
 *     _tagValidOrRaise(prefix_utf)
 *     _uriValidOrRaise(uri_utf)             # <<<<<<<<<<<<<<
 *     if (uri_utf == b"http://www.w3.org/XML/1998/namespace" and prefix_utf != b'xml'
 *             or prefix_utf == b'xml' and uri_utf != b"http://www.w3.org/XML/1998/namespace"):
*/
  __pyx_t_6 = __pyx_f_4lxml_5etree__uriValidOrRaise(__pyx_v_uri_utf); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 198, __pyx_L1_error)

  /* "lxml/etree.pyx":199
 *     _tagValidOrRaise(prefix_utf)
 *     _uriValidOrRaise(uri_utf)
 *     if (uri_utf == b"http://www.w3.org/XML/1998/namespace" and prefix_utf != b'xml'             # <<<<<<<<<<<<<<
 *             or prefix_utf == b'xml' and uri_utf != b"http://www.w3.org/XML/1998/namespace"):
 *         raise ValueError("Cannot change the 'xml' prefix of the XML namespace")
*/
  __pyx_t_7 = (__Pyx_PyBytes_Equals(__pyx_v_uri_utf, __pyx_mstate_global->__pyx_kp_b_http_www_w3_org_XML_1998_namespa, Py_EQ)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 199, __pyx_L1_error)
  if (!__pyx_t_7) {
    goto __pyx_L6_next_or;
  } else {
  }
  __pyx_t_7 = (__Pyx_PyBytes_Equals(__pyx_v_prefix_utf, __pyx_mstate_global->__pyx_n_b_xml, Py_NE)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 199, __pyx_L1_error)
  if (!__pyx_t_7) {
  } else {
    __pyx_t_5 = __pyx_t_7;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_L6_next_or:;

  /* "lxml/etree.pyx":200
 *     _uriValidOrRaise(uri_utf)
 *     if (uri_utf == b"http://www.w3.org/XML/1998/namespace" and prefix_utf != b'xml'
 *             or prefix_utf == b'xml' and uri_utf != b"http://www.w3.org/XML/1998/namespace"):             # <<<<<<<<<<<<<<
 *         raise ValueError("Cannot change the 'xml' prefix of the XML namespace")
 *     for k, v in list(_DEFAULT_NAMESPACE_PREFIXES.items()):
*/
  __pyx_t_7 = (__Pyx_PyBytes_Equals(__pyx_v_prefix_utf, __pyx_mstate_global->__pyx_n_b_xml, Py_EQ)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 200, __pyx_L1_error)
  if (__pyx_t_7) {
  } else {
    __pyx_t_5 = __pyx_t_7;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_7 = (__Pyx_PyBytes_Equals(__pyx_v_uri_utf, __pyx_mstate_global->__pyx_kp_b_http_www_w3_org_XML_1998_namespa, Py_NE)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 200, __pyx_L1_error)
  __pyx_t_5 = __pyx_t_7;
  __pyx_L5_bool_binop_done:;

  /* "lxml/etree.pyx":199
 *     _tagValidOrRaise(prefix_utf)
 *     _uriValidOrRaise(uri_utf)
 *     if (uri_utf == b"http://www.w3.org/XML/1998/namespace" and prefix_utf != b'xml'             # <<<<<<<<<<<<<<
 *             or prefix_utf == b'xml' and uri_utf != b"http://www.w3.org/XML/1998/namespace"):
 *         raise ValueError("Cannot change the 'xml' prefix of the XML namespace")
*/
  if (unlikely(__pyx_t_5)) {

    /* "lxml/etree.pyx":201
 *     if (uri_utf == b"http://www.w3.org/XML/1998/namespace" and prefix_utf != b'xml'
 *             or prefix_utf == b'xml' and uri_utf != b"http://www.w3.org/XML/1998/namespace"):
 *         raise ValueError("Cannot change the 'xml' prefix of the XML namespace")             # <<<<<<<<<<<<<<
 *     for k, v in list(_DEFAULT_NAMESPACE_PREFIXES.items()):
 *         if k == uri_utf or v == prefix_utf:
*/
    __pyx_t_3 = NULL;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Cannot_change_the_xml_prefix_of};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 201, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(0, 201, __pyx_L1_error)

    /* "lxml/etree.pyx":199
 *     _tagValidOrRaise(prefix_utf)
 *     _uriValidOrRaise(uri_utf)
 *     if (uri_utf == b"http://www.w3.org/XML/1998/namespace" and prefix_utf != b'xml'             # <<<<<<<<<<<<<<
 *             or prefix_utf == b'xml' and uri_utf != b"http://www.w3.org/XML/1998/namespace"):
 *         raise ValueError("Cannot change the 'xml' prefix of the XML namespace")
*/
  }

  /* "lxml/etree.pyx":202
 *             or prefix_utf == b'xml' and uri_utf != b"http://www.w3.org/XML/1998/namespace"):
 *         raise ValueError("Cannot change the 'xml' prefix of the XML namespace")
 *     for k, v in list(_DEFAULT_NAMESPACE_PREFIXES.items()):             # <<<<<<<<<<<<<<
 *         if k == uri_utf or v == prefix_utf:
 *             del _DEFAULT_NAMESPACE_PREFIXES[k]
*/
  if (unlikely(__pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
    __PYX_ERR(0, 202, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyDict_Items(__pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PySequence_ListKeepNew(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __pyx_t_3; __Pyx_INCREF(__pyx_t_2);
  __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  for (;;) {
    {
      Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
      #if !CYTHON_ASSUME_SAFE_SIZE
      if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 202, __pyx_L1_error)
      #endif
      if (__pyx_t_8 >= __pyx_temp) break;
    }
    __pyx_t_3 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_8, __Pyx_ReferenceSharing_OwnStrongReference);
    ++__pyx_t_8;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 202, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
      PyObject* sequence = __pyx_t_3;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 202, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1);
        __Pyx_INCREF(__pyx_t_9);
      } else {
        __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 202, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_1);
        __pyx_t_9 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 202, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_9);
      }
      #else
      __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 202, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_9 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 202, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      #endif
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_10 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 202, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_11 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_10);
      index = 0; __pyx_t_1 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_1)) goto __pyx_L11_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_1);
      index = 1; __pyx_t_9 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L11_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_9);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 2) < (0)) __PYX_ERR(0, 202, __pyx_L1_error)
      __pyx_t_11 = NULL;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      goto __pyx_L12_unpacking_done;
      __pyx_L11_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_11 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 202, __pyx_L1_error)
      __pyx_L12_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_1);
    __pyx_t_1 = 0;
    __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_9);
    __pyx_t_9 = 0;

    /* "lxml/etree.pyx":203
 *         raise ValueError("Cannot change the 'xml' prefix of the XML namespace")
 *     for k, v in list(_DEFAULT_NAMESPACE_PREFIXES.items()):
 *         if k == uri_utf or v == prefix_utf:             # <<<<<<<<<<<<<<
 *             del _DEFAULT_NAMESPACE_PREFIXES[k]
 *     _DEFAULT_NAMESPACE_PREFIXES[uri_utf] = prefix_utf
*/
    __pyx_t_7 = (__Pyx_PyBytes_Equals(__pyx_v_k, __pyx_v_uri_utf, Py_EQ)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 203, __pyx_L1_error)
    if (!__pyx_t_7) {
    } else {
      __pyx_t_5 = __pyx_t_7;
      goto __pyx_L14_bool_binop_done;
    }
    __pyx_t_7 = (__Pyx_PyBytes_Equals(__pyx_v_v, __pyx_v_prefix_utf, Py_EQ)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 203, __pyx_L1_error)
    __pyx_t_5 = __pyx_t_7;
    __pyx_L14_bool_binop_done:;
    if (__pyx_t_5) {

      /* "lxml/etree.pyx":204
 *     for k, v in list(_DEFAULT_NAMESPACE_PREFIXES.items()):
 *         if k == uri_utf or v == prefix_utf:
 *             del _DEFAULT_NAMESPACE_PREFIXES[k]             # <<<<<<<<<<<<<<
 *     _DEFAULT_NAMESPACE_PREFIXES[uri_utf] = prefix_utf
 *     _update_default_namespace_prefixes_items()
*/
      if (unlikely(__pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 204, __pyx_L1_error)
      }
      if (unlikely((PyDict_DelItem(__pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES, __pyx_v_k) < 0))) __PYX_ERR(0, 204, __pyx_L1_error)

      /* "lxml/etree.pyx":203
 *         raise ValueError("Cannot change the 'xml' prefix of the XML namespace")
 *     for k, v in list(_DEFAULT_NAMESPACE_PREFIXES.items()):
 *         if k == uri_utf or v == prefix_utf:             # <<<<<<<<<<<<<<
 *             del _DEFAULT_NAMESPACE_PREFIXES[k]
 *     _DEFAULT_NAMESPACE_PREFIXES[uri_utf] = prefix_utf
*/
    }

    /* "lxml/etree.pyx":202
 *             or prefix_utf == b'xml' and uri_utf != b"http://www.w3.org/XML/1998/namespace"):
 *         raise ValueError("Cannot change the 'xml' prefix of the XML namespace")
 *     for k, v in list(_DEFAULT_NAMESPACE_PREFIXES.items()):             # <<<<<<<<<<<<<<
 *         if k == uri_utf or v == prefix_utf:
 *             del _DEFAULT_NAMESPACE_PREFIXES[k]
*/
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "lxml/etree.pyx":205
 *         if k == uri_utf or v == prefix_utf:
 *             del _DEFAULT_NAMESPACE_PREFIXES[k]
 *     _DEFAULT_NAMESPACE_PREFIXES[uri_utf] = prefix_utf             # <<<<<<<<<<<<<<
 *     _update_default_namespace_prefixes_items()
 * 
*/
  if (unlikely(__pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 205, __pyx_L1_error)
  }
  if (unlikely((PyDict_SetItem(__pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES, __pyx_v_uri_utf, __pyx_v_prefix_utf) < 0))) __PYX_ERR(0, 205, __pyx_L1_error)

  /* "lxml/etree.pyx":206
 *             del _DEFAULT_NAMESPACE_PREFIXES[k]
 *     _DEFAULT_NAMESPACE_PREFIXES[uri_utf] = prefix_utf
 *     _update_default_namespace_prefixes_items()             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_2 = __pyx_f_4lxml_5etree__update_default_namespace_prefixes_items(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 206, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "lxml/etree.pyx":188
 * cdef object _check_internal_prefix = re.compile(br"ns\d+$").match
 * 
 * def register_namespace(prefix, uri):             # <<<<<<<<<<<<<<
 *     """Registers a namespace prefix that newly created Elements in that
 *     namespace will use.  The registry is global, and any existing
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("lxml.etree.register_namespace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_prefix_utf);
  __Pyx_XDECREF(__pyx_v_uri_utf);
  __Pyx_XDECREF(__pyx_v_k);
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":218
 *     this one.
 *     """
 *     def __init__(self, message, error_log=None):             # <<<<<<<<<<<<<<
 *         super(_Error, self).__init__(message)
 *         if error_log is None:
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_9LxmlError_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_9LxmlError_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_message = 0;
  PyObject *__pyx_v_error_log = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_message,&__pyx_mstate_global->__pyx_n_u_error_log,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 218, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 218, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 218, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(0, 218, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, i); __PYX_ERR(0, 218, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 218, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 218, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_message = values[0];
    __pyx_v_error_log = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 218, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.LxmlError.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_9LxmlError___init__(((struct __pyx_obj_4lxml_5etree_LxmlError *)__pyx_v_self), __pyx_v_message, __pyx_v_error_log);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_9LxmlError___init__(struct __pyx_obj_4lxml_5etree_LxmlError *__pyx_v_self, PyObject *__pyx_v_message, PyObject *__pyx_v_error_log) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "lxml/etree.pyx":219
 *     """
 *     def __init__(self, message, error_log=None):
 *         super(_Error, self).__init__(message)             # <<<<<<<<<<<<<<
 *         if error_log is None:
 *             self.error_log = __copyGlobalErrorLog()
*/
  __pyx_t_4 = NULL;
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_v_4lxml_5etree__Error, ((PyObject *)__pyx_v_self)};
    __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_super, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 219, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  __pyx_t_2 = __pyx_t_3;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_message};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_init, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 219, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":220
 *     def __init__(self, message, error_log=None):
 *         super(_Error, self).__init__(message)
 *         if error_log is None:             # <<<<<<<<<<<<<<
 *             self.error_log = __copyGlobalErrorLog()
 *         else:
*/
  __pyx_t_6 = (__pyx_v_error_log == Py_None);
  if (__pyx_t_6) {

    /* "lxml/etree.pyx":221
 *         super(_Error, self).__init__(message)
 *         if error_log is None:
 *             self.error_log = __copyGlobalErrorLog()             # <<<<<<<<<<<<<<
 *         else:
 *             self.error_log = error_log.copy()
*/
    __pyx_t_1 = __pyx_f_4lxml_5etree___copyGlobalErrorLog(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 221, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_error_log, __pyx_t_1) < (0)) __PYX_ERR(0, 221, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "lxml/etree.pyx":220
 *     def __init__(self, message, error_log=None):
 *         super(_Error, self).__init__(message)
 *         if error_log is None:             # <<<<<<<<<<<<<<
 *             self.error_log = __copyGlobalErrorLog()
 *         else:
*/
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":223
 *             self.error_log = __copyGlobalErrorLog()
 *         else:
 *             self.error_log = error_log.copy()             # <<<<<<<<<<<<<<
 * 
 * cdef object _Error = Error
*/
  /*else*/ {
    __pyx_t_3 = __pyx_v_error_log;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_5 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_copy, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 223, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_error_log, __pyx_t_1) < (0)) __PYX_ERR(0, 223, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __pyx_L3:;

  /* "lxml/etree.pyx":218
 *     this one.
 *     """
 *     def __init__(self, message, error_log=None):             # <<<<<<<<<<<<<<
 *         super(_Error, self).__init__(message)
 *         if error_log is None:
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.LxmlError.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":238
 * 
 * # version information
 * cdef tuple __unpackDottedVersion(version):             # <<<<<<<<<<<<<<
 *     version_list = []
 *     l = (version.decode("ascii").replace('-', '.').split('.') + [0]*4)[:4]
*/

static PyObject *__pyx_f_4lxml_5etree___unpackDottedVersion(PyObject *__pyx_v_version) {
  PyObject *__pyx_v_version_list = NULL;
  PyObject *__pyx_v_l = NULL;
  PyObject *__pyx_v_item = NULL;
  PyObject *__pyx_v_count = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_t_14;
  int __pyx_t_15;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__unpackDottedVersion", 0);

  /* "lxml/etree.pyx":239
 * # version information
 * cdef tuple __unpackDottedVersion(version):
 *     version_list = []             # <<<<<<<<<<<<<<
 *     l = (version.decode("ascii").replace('-', '.').split('.') + [0]*4)[:4]
 *     for item in l:
*/
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 239, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_version_list = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "lxml/etree.pyx":240
 * cdef tuple __unpackDottedVersion(version):
 *     version_list = []
 *     l = (version.decode("ascii").replace('-', '.').split('.') + [0]*4)[:4]             # <<<<<<<<<<<<<<
 *     for item in l:
 *         try:
*/
  __pyx_t_4 = __pyx_v_version;
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_n_u_ascii};
    __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_decode, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 240, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_replace); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_mstate_global->__pyx_tuple[1], NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_2 = __pyx_t_3;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u__2};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_split, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 240, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_3 = PyList_New(1 * 4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  { Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < 4; __pyx_temp++) {
      __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0);
      __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_0);
      if (__Pyx_PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_mstate_global->__pyx_int_0) != (0)) __PYX_ERR(0, 240, __pyx_L1_error);
    }
  }
  __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_t_2, 0, 4, NULL, NULL, &__pyx_mstate_global->__pyx_slice[1], 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_l = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "lxml/etree.pyx":241
 *     version_list = []
 *     l = (version.decode("ascii").replace('-', '.').split('.') + [0]*4)[:4]
 *     for item in l:             # <<<<<<<<<<<<<<
 *         try:
 *             item = int(item)
*/
  if (likely(PyList_CheckExact(__pyx_v_l)) || PyTuple_CheckExact(__pyx_v_l)) {
    __pyx_t_3 = __pyx_v_l; __Pyx_INCREF(__pyx_t_3);
    __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
  } else {
    __pyx_t_6 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_l); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 241, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 241, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_7)) {
      if (likely(PyList_CheckExact(__pyx_t_3))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 241, __pyx_L1_error)
          #endif
          if (__pyx_t_6 >= __pyx_temp) break;
        }
        __pyx_t_2 = __Pyx_PyList_GetItemRefFast(__pyx_t_3, __pyx_t_6, __Pyx_ReferenceSharing_OwnStrongReference);
        ++__pyx_t_6;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 241, __pyx_L1_error)
          #endif
          if (__pyx_t_6 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_6));
        #else
        __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_6);
        #endif
        ++__pyx_t_6;
      }
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 241, __pyx_L1_error)
    } else {
      __pyx_t_2 = __pyx_t_7(__pyx_t_3);
      if (unlikely(!__pyx_t_2)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 241, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "lxml/etree.pyx":242
 *     l = (version.decode("ascii").replace('-', '.').split('.') + [0]*4)[:4]
 *     for item in l:
 *         try:             # <<<<<<<<<<<<<<
 *             item = int(item)
 *         except ValueError:
*/
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      /*try:*/ {

        /* "lxml/etree.pyx":243
 *     for item in l:
 *         try:
 *             item = int(item)             # <<<<<<<<<<<<<<
 *         except ValueError:
 *             if item.startswith('dev'):
*/
        __pyx_t_2 = __Pyx_PyNumber_Int(__pyx_v_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 243, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF_SET(__pyx_v_item, __pyx_t_2);
        __pyx_t_2 = 0;

        /* "lxml/etree.pyx":242
 *     l = (version.decode("ascii").replace('-', '.').split('.') + [0]*4)[:4]
 *     for item in l:
 *         try:             # <<<<<<<<<<<<<<
 *             item = int(item)
 *         except ValueError:
*/
      }
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      goto __pyx_L12_try_end;
      __pyx_L5_error:;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "lxml/etree.pyx":244
 *         try:
 *             item = int(item)
 *         except ValueError:             # <<<<<<<<<<<<<<
 *             if item.startswith('dev'):
 *                 count = item[3:]
*/
      __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_ValueError))));
      if (__pyx_t_11) {
        __Pyx_AddTraceback("lxml.etree.__unpackDottedVersion", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_4) < 0) __PYX_ERR(0, 244, __pyx_L7_except_error)
        __Pyx_XGOTREF(__pyx_t_2);
        __Pyx_XGOTREF(__pyx_t_1);
        __Pyx_XGOTREF(__pyx_t_4);

        /* "lxml/etree.pyx":245
 *             item = int(item)
 *         except ValueError:
 *             if item.startswith('dev'):             # <<<<<<<<<<<<<<
 *                 count = item[3:]
 *                 item = -300
*/
        __pyx_t_13 = __pyx_v_item;
        __Pyx_INCREF(__pyx_t_13);
        __pyx_t_5 = 0;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_13, __pyx_mstate_global->__pyx_n_u_dev};
          __pyx_t_12 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_startswith, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
          if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 245, __pyx_L7_except_error)
          __Pyx_GOTREF(__pyx_t_12);
        }
        __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely((__pyx_t_14 < 0))) __PYX_ERR(0, 245, __pyx_L7_except_error)
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        if (__pyx_t_14) {

          /* "lxml/etree.pyx":246
 *         except ValueError:
 *             if item.startswith('dev'):
 *                 count = item[3:]             # <<<<<<<<<<<<<<
 *                 item = -300
 *             elif item.startswith('alpha'):
*/
          __pyx_t_12 = __Pyx_PyObject_GetSlice(__pyx_v_item, 3, 0, NULL, NULL, &__pyx_mstate_global->__pyx_slice[2], 1, 0, 1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 246, __pyx_L7_except_error)
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_XDECREF_SET(__pyx_v_count, __pyx_t_12);
          __pyx_t_12 = 0;

          /* "lxml/etree.pyx":247
 *             if item.startswith('dev'):
 *                 count = item[3:]
 *                 item = -300             # <<<<<<<<<<<<<<
 *             elif item.startswith('alpha'):
 *                 count = item[5:]
*/
          __Pyx_INCREF(__pyx_mstate_global->__pyx_int_neg_300);
          __Pyx_DECREF_SET(__pyx_v_item, __pyx_mstate_global->__pyx_int_neg_300);

          /* "lxml/etree.pyx":245
 *             item = int(item)
 *         except ValueError:
 *             if item.startswith('dev'):             # <<<<<<<<<<<<<<
 *                 count = item[3:]
 *                 item = -300
*/
          goto __pyx_L15;
        }

        /* "lxml/etree.pyx":248
 *                 count = item[3:]
 *                 item = -300
 *             elif item.startswith('alpha'):             # <<<<<<<<<<<<<<
 *                 count = item[5:]
 *                 item = -200
*/
        __pyx_t_13 = __pyx_v_item;
        __Pyx_INCREF(__pyx_t_13);
        __pyx_t_5 = 0;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_13, __pyx_mstate_global->__pyx_n_u_alpha};
          __pyx_t_12 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_startswith, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
          if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 248, __pyx_L7_except_error)
          __Pyx_GOTREF(__pyx_t_12);
        }
        __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely((__pyx_t_14 < 0))) __PYX_ERR(0, 248, __pyx_L7_except_error)
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        if (__pyx_t_14) {

          /* "lxml/etree.pyx":249
 *                 item = -300
 *             elif item.startswith('alpha'):
 *                 count = item[5:]             # <<<<<<<<<<<<<<
 *                 item = -200
 *             elif item.startswith('beta'):
*/
          __pyx_t_12 = __Pyx_PyObject_GetSlice(__pyx_v_item, 5, 0, NULL, NULL, &__pyx_mstate_global->__pyx_slice[3], 1, 0, 1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 249, __pyx_L7_except_error)
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_XDECREF_SET(__pyx_v_count, __pyx_t_12);
          __pyx_t_12 = 0;

          /* "lxml/etree.pyx":250
 *             elif item.startswith('alpha'):
 *                 count = item[5:]
 *                 item = -200             # <<<<<<<<<<<<<<
 *             elif item.startswith('beta'):
 *                 count = item[4:]
*/
          __Pyx_INCREF(__pyx_mstate_global->__pyx_int_neg_200);
          __Pyx_DECREF_SET(__pyx_v_item, __pyx_mstate_global->__pyx_int_neg_200);

          /* "lxml/etree.pyx":248
 *                 count = item[3:]
 *                 item = -300
 *             elif item.startswith('alpha'):             # <<<<<<<<<<<<<<
 *                 count = item[5:]
 *                 item = -200
*/
          goto __pyx_L15;
        }

        /* "lxml/etree.pyx":251
 *                 count = item[5:]
 *                 item = -200
 *             elif item.startswith('beta'):             # <<<<<<<<<<<<<<
 *                 count = item[4:]
 *                 item = -100
*/
        __pyx_t_13 = __pyx_v_item;
        __Pyx_INCREF(__pyx_t_13);
        __pyx_t_5 = 0;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_13, __pyx_mstate_global->__pyx_n_u_beta};
          __pyx_t_12 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_startswith, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
          if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 251, __pyx_L7_except_error)
          __Pyx_GOTREF(__pyx_t_12);
        }
        __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely((__pyx_t_14 < 0))) __PYX_ERR(0, 251, __pyx_L7_except_error)
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        if (__pyx_t_14) {

          /* "lxml/etree.pyx":252
 *                 item = -200
 *             elif item.startswith('beta'):
 *                 count = item[4:]             # <<<<<<<<<<<<<<
 *                 item = -100
 *             else:
*/
          __pyx_t_12 = __Pyx_PyObject_GetSlice(__pyx_v_item, 4, 0, NULL, NULL, &__pyx_mstate_global->__pyx_slice[4], 1, 0, 1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 252, __pyx_L7_except_error)
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_XDECREF_SET(__pyx_v_count, __pyx_t_12);
          __pyx_t_12 = 0;

          /* "lxml/etree.pyx":253
 *             elif item.startswith('beta'):
 *                 count = item[4:]
 *                 item = -100             # <<<<<<<<<<<<<<
 *             else:
 *                 count = 0
*/
          __Pyx_INCREF(__pyx_mstate_global->__pyx_int_neg_100);
          __Pyx_DECREF_SET(__pyx_v_item, __pyx_mstate_global->__pyx_int_neg_100);

          /* "lxml/etree.pyx":251
 *                 count = item[5:]
 *                 item = -200
 *             elif item.startswith('beta'):             # <<<<<<<<<<<<<<
 *                 count = item[4:]
 *                 item = -100
*/
          goto __pyx_L15;
        }

        /* "lxml/etree.pyx":255
 *                 item = -100
 *             else:
 *                 count = 0             # <<<<<<<<<<<<<<
 *             if count:
 *                 item += int(count)
*/
        /*else*/ {
          __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0);
          __Pyx_XDECREF_SET(__pyx_v_count, __pyx_mstate_global->__pyx_int_0);
        }
        __pyx_L15:;

        /* "lxml/etree.pyx":256
 *             else:
 *                 count = 0
 *             if count:             # <<<<<<<<<<<<<<
 *                 item += int(count)
 *         version_list.append(item)
*/
        __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_v_count); if (unlikely((__pyx_t_14 < 0))) __PYX_ERR(0, 256, __pyx_L7_except_error)
        if (__pyx_t_14) {

          /* "lxml/etree.pyx":257
 *                 count = 0
 *             if count:
 *                 item += int(count)             # <<<<<<<<<<<<<<
 *         version_list.append(item)
 *     return tuple(version_list)
*/
          __pyx_t_12 = __Pyx_PyNumber_Int(__pyx_v_count); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 257, __pyx_L7_except_error)
          __Pyx_GOTREF(__pyx_t_12);
          __pyx_t_13 = PyNumber_InPlaceAdd(__pyx_v_item, __pyx_t_12); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 257, __pyx_L7_except_error)
          __Pyx_GOTREF(__pyx_t_13);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_DECREF_SET(__pyx_v_item, __pyx_t_13);
          __pyx_t_13 = 0;

          /* "lxml/etree.pyx":256
 *             else:
 *                 count = 0
 *             if count:             # <<<<<<<<<<<<<<
 *                 item += int(count)
 *         version_list.append(item)
*/
        }
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        goto __pyx_L6_exception_handled;
      }
      goto __pyx_L7_except_error;

      /* "lxml/etree.pyx":242
 *     l = (version.decode("ascii").replace('-', '.').split('.') + [0]*4)[:4]
 *     for item in l:
 *         try:             # <<<<<<<<<<<<<<
 *             item = int(item)
 *         except ValueError:
*/
      __pyx_L7_except_error:;
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      goto __pyx_L1_error;
      __pyx_L6_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      __pyx_L12_try_end:;
    }

    /* "lxml/etree.pyx":258
 *             if count:
 *                 item += int(count)
 *         version_list.append(item)             # <<<<<<<<<<<<<<
 *     return tuple(version_list)
 * 
*/
    __pyx_t_15 = __Pyx_PyList_Append(__pyx_v_version_list, __pyx_v_item); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 258, __pyx_L1_error)

    /* "lxml/etree.pyx":241
 *     version_list = []
 *     l = (version.decode("ascii").replace('-', '.').split('.') + [0]*4)[:4]
 *     for item in l:             # <<<<<<<<<<<<<<
 *         try:
 *             item = int(item)
*/
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "lxml/etree.pyx":259
 *                 item += int(count)
 *         version_list.append(item)
 *     return tuple(version_list)             # <<<<<<<<<<<<<<
 * 
 * cdef tuple __unpackIntVersion(int c_version, int base=100):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyList_AsTuple(__pyx_v_version_list); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 259, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":238
 * 
 * # version information
 * cdef tuple __unpackDottedVersion(version):             # <<<<<<<<<<<<<<
 *     version_list = []
 *     l = (version.decode("ascii").replace('-', '.').split('.') + [0]*4)[:4]
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("lxml.etree.__unpackDottedVersion", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_version_list);
  __Pyx_XDECREF(__pyx_v_l);
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_XDECREF(__pyx_v_count);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":261
 *     return tuple(version_list)
 * 
 * cdef tuple __unpackIntVersion(int c_version, int base=100):             # <<<<<<<<<<<<<<
 *     return (
 *         ((c_version // (base*base)) % base),
*/

static PyObject *__pyx_f_4lxml_5etree___unpackIntVersion(int __pyx_v_c_version, struct __pyx_opt_args_4lxml_5etree___unpackIntVersion *__pyx_optional_args) {
  int __pyx_v_base = ((int)0x64);
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__unpackIntVersion", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_base = __pyx_optional_args->base;
    }
  }

  /* "lxml/etree.pyx":262
 * 
 * cdef tuple __unpackIntVersion(int c_version, int base=100):
 *     return (             # <<<<<<<<<<<<<<
 *         ((c_version // (base*base)) % base),
 *         ((c_version // base)        % base),
*/
  __Pyx_XDECREF(__pyx_r);

  /* "lxml/etree.pyx":263
 * cdef tuple __unpackIntVersion(int c_version, int base=100):
 *     return (
 *         ((c_version // (base*base)) % base),             # <<<<<<<<<<<<<<
 *         ((c_version // base)        % base),
 *         (c_version                  % base)
*/
  __pyx_t_1 = (__pyx_v_base * __pyx_v_base);
  if (unlikely(__pyx_t_1 == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
    __PYX_ERR(0, 263, __pyx_L1_error)
  }
  else if (sizeof(int) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(__pyx_t_1 == (int)-1)  && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_v_c_version))) {
    PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
    __PYX_ERR(0, 263, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_div_int(__pyx_v_c_version, __pyx_t_1, 0);
  if (unlikely(__pyx_v_base == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
    __PYX_ERR(0, 263, __pyx_L1_error)
  }
  __pyx_t_3 = __Pyx_PyLong_From_int(__Pyx_mod_int(__pyx_t_2, __pyx_v_base, 0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 263, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "lxml/etree.pyx":264
 *     return (
 *         ((c_version // (base*base)) % base),
 *         ((c_version // base)        % base),             # <<<<<<<<<<<<<<
 *         (c_version                  % base)
 *         )
*/
  if (unlikely(__pyx_v_base == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
    __PYX_ERR(0, 264, __pyx_L1_error)
  }
  else if (sizeof(int) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(__pyx_v_base == (int)-1)  && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_v_c_version))) {
    PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
    __PYX_ERR(0, 264, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_div_int(__pyx_v_c_version, __pyx_v_base, 0);
  if (unlikely(__pyx_v_base == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
    __PYX_ERR(0, 264, __pyx_L1_error)
  }
  __pyx_t_4 = __Pyx_PyLong_From_int(__Pyx_mod_int(__pyx_t_2, __pyx_v_base, 0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 264, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "lxml/etree.pyx":265
 *         ((c_version // (base*base)) % base),
 *         ((c_version // base)        % base),
 *         (c_version                  % base)             # <<<<<<<<<<<<<<
 *         )
 * 
*/
  if (unlikely(__pyx_v_base == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
    __PYX_ERR(0, 265, __pyx_L1_error)
  }
  __pyx_t_5 = __Pyx_PyLong_From_int(__Pyx_mod_int(__pyx_v_c_version, __pyx_v_base, 0)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 265, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);

  /* "lxml/etree.pyx":263
 * cdef tuple __unpackIntVersion(int c_version, int base=100):
 *     return (
 *         ((c_version // (base*base)) % base),             # <<<<<<<<<<<<<<
 *         ((c_version // base)        % base),
 *         (c_version                  % base)
*/
  __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 263, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_3);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3) != (0)) __PYX_ERR(0, 263, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_4);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_4) != (0)) __PYX_ERR(0, 263, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_5);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_5) != (0)) __PYX_ERR(0, 263, __pyx_L1_error);
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_r = ((PyObject*)__pyx_t_6);
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":261
 *     return tuple(version_list)
 * 
 * cdef tuple __unpackIntVersion(int c_version, int base=100):             # <<<<<<<<<<<<<<
 *     return (
 *         ((c_version // (base*base)) % base),
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree.__unpackIntVersion", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":348
 * 
 * 
 * cdef set _copy_lib_features():             # <<<<<<<<<<<<<<
 *     features = set()
 *     feature = _LXML_LIB_FEATURES
*/

static PyObject *__pyx_f_4lxml_5etree__copy_lib_features(void) {
  PyObject *__pyx_v_features = NULL;
  char const *const *__pyx_v_feature;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  char const *__pyx_t_3;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_copy_lib_features", 0);

  /* "lxml/etree.pyx":349
 * 
 * cdef set _copy_lib_features():
 *     features = set()             # <<<<<<<<<<<<<<
 *     feature = _LXML_LIB_FEATURES
 *     while feature[0]:
*/
  __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 349, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_features = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "lxml/etree.pyx":350
 * cdef set _copy_lib_features():
 *     features = set()
 *     feature = _LXML_LIB_FEATURES             # <<<<<<<<<<<<<<
 *     while feature[0]:
 *         features.add(feature[0].decode('ASCII'))
*/
  __pyx_v_feature = _lxml_lib_features;

  /* "lxml/etree.pyx":351
 *     features = set()
 *     feature = _LXML_LIB_FEATURES
 *     while feature[0]:             # <<<<<<<<<<<<<<
 *         features.add(feature[0].decode('ASCII'))
 *         feature += 1
*/
  while (1) {
    __pyx_t_2 = ((__pyx_v_feature[0]) != 0);
    if (!__pyx_t_2) break;

    /* "lxml/etree.pyx":352
 *     feature = _LXML_LIB_FEATURES
 *     while feature[0]:
 *         features.add(feature[0].decode('ASCII'))             # <<<<<<<<<<<<<<
 *         feature += 1
 *     return features
*/
    __pyx_t_3 = (__pyx_v_feature[0]);
    __pyx_t_4 = __Pyx_ssize_strlen(__pyx_t_3); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 352, __pyx_L1_error)
    __pyx_t_1 = __Pyx_decode_c_string(__pyx_t_3, 0, __pyx_t_4, NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 352, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = PySet_Add(__pyx_v_features, __pyx_t_1); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 352, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "lxml/etree.pyx":353
 *     while feature[0]:
 *         features.add(feature[0].decode('ASCII'))
 *         feature += 1             # <<<<<<<<<<<<<<
 *     return features
 * 
*/
    __pyx_v_feature = (__pyx_v_feature + 1);
  }

  /* "lxml/etree.pyx":354
 *         features.add(feature[0].decode('ASCII'))
 *         feature += 1
 *     return features             # <<<<<<<<<<<<<<
 * 
 * LIBXML_COMPILED_FEATURES = _copy_lib_features()
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_features);
  __pyx_r = __pyx_v_features;
  goto __pyx_L0;

  /* "lxml/etree.pyx":348
 * 
 * 
 * cdef set _copy_lib_features():             # <<<<<<<<<<<<<<
 *     features = set()
 *     feature = _LXML_LIB_FEATURES
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._copy_lib_features", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_features);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":404
 * cdef class _TempStore:
 *     cdef list _storage
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self._storage = []
 * 
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_10_TempStore_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_10_TempStore_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, __pyx_nargs); return -1; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return -1;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__init__", __pyx_kwds); return -1;}
  __pyx_r = __pyx_pf_4lxml_5etree_10_TempStore___init__(((struct __pyx_obj_4lxml_5etree__TempStore *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_10_TempStore___init__(struct __pyx_obj_4lxml_5etree__TempStore *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "lxml/etree.pyx":405
 *     cdef list _storage
 *     def __init__(self):
 *         self._storage = []             # <<<<<<<<<<<<<<
 * 
 *     cdef int add(self, obj) except -1:
*/
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 405, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_storage);
  __Pyx_DECREF(__pyx_v_self->_storage);
  __pyx_v_self->_storage = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "lxml/etree.pyx":404
 * cdef class _TempStore:
 *     cdef list _storage
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self._storage = []
 * 
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._TempStore.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":407
 *         self._storage = []
 * 
 *     cdef int add(self, obj) except -1:             # <<<<<<<<<<<<<<
 *         self._storage.append(obj)
 *         return 0
*/

static int __pyx_f_4lxml_5etree_10_TempStore_add(struct __pyx_obj_4lxml_5etree__TempStore *__pyx_v_self, PyObject *__pyx_v_obj) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "lxml/etree.pyx":408
 * 
 *     cdef int add(self, obj) except -1:
 *         self._storage.append(obj)             # <<<<<<<<<<<<<<
 *         return 0
 * 
*/
  if (unlikely(__pyx_v_self->_storage == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
    __PYX_ERR(0, 408, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyList_Append(__pyx_v_self->_storage, __pyx_v_obj); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 408, __pyx_L1_error)

  /* "lxml/etree.pyx":409
 *     cdef int add(self, obj) except -1:
 *         self._storage.append(obj)
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     cdef int clear(self) except -1:
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":407
 *         self._storage = []
 * 
 *     cdef int add(self, obj) except -1:             # <<<<<<<<<<<<<<
 *         self._storage.append(obj)
 *         return 0
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._TempStore.add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "lxml/etree.pyx":411
 *         return 0
 * 
 *     cdef int clear(self) except -1:             # <<<<<<<<<<<<<<
 *         del self._storage[:]
 *         return 0
*/

static int __pyx_f_4lxml_5etree_10_TempStore_clear(struct __pyx_obj_4lxml_5etree__TempStore *__pyx_v_self) {
  int __pyx_r;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "lxml/etree.pyx":412
 * 
 *     cdef int clear(self) except -1:
 *         del self._storage[:]             # <<<<<<<<<<<<<<
 *         return 0
 * 
*/
  if (unlikely(__pyx_v_self->_storage == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 412, __pyx_L1_error)
  }
  if (__Pyx_PyObject_DelSlice(__pyx_v_self->_storage, 0, 0, NULL, NULL, NULL, 0, 0, 1) < (0)) __PYX_ERR(0, 412, __pyx_L1_error)

  /* "lxml/etree.pyx":413
 *     cdef int clear(self) except -1:
 *         del self._storage[:]
 *         return 0             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":411
 *         return 0
 * 
 *     cdef int clear(self) except -1:             # <<<<<<<<<<<<<<
 *         del self._storage[:]
 *         return 0
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._TempStore.clear", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "lxml/etree.pyx":421
 *     cdef object _exc_info
 * 
 *     cdef int clear(self) except -1:             # <<<<<<<<<<<<<<
 *         self._exc_info = None
 *         return 0
*/

static int __pyx_f_4lxml_5etree_17_ExceptionContext_clear(struct __pyx_obj_4lxml_5etree__ExceptionContext *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clear", 0);

  /* "lxml/etree.pyx":422
 * 
 *     cdef int clear(self) except -1:
 *         self._exc_info = None             # <<<<<<<<<<<<<<
 *         return 0
 * 
*/
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_exc_info);
  __Pyx_DECREF(__pyx_v_self->_exc_info);
  __pyx_v_self->_exc_info = Py_None;

  /* "lxml/etree.pyx":423
 *     cdef int clear(self) except -1:
 *         self._exc_info = None
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":421
 *     cdef object _exc_info
 * 
 *     cdef int clear(self) except -1:             # <<<<<<<<<<<<<<
 *         self._exc_info = None
 *         return 0
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":425
 *         return 0
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef void _store_raised(self) noexcept:
 *         try:
*/

static void __pyx_f_4lxml_5etree_17_ExceptionContext__store_raised(struct __pyx_obj_4lxml_5etree__ExceptionContext *__pyx_v_self) {
  PyObject *__pyx_v_e = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  char const *__pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_store_raised", 0);

  /* "lxml/etree.pyx":427
 *     @cython.final
 *     cdef void _store_raised(self) noexcept:
 *         try:             # <<<<<<<<<<<<<<
 *             self._exc_info = sys.exc_info()
 *         except BaseException as e:
*/
  /*try:*/ {
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_1);
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_3);
      /*try:*/ {

        /* "lxml/etree.pyx":428
 *     cdef void _store_raised(self) noexcept:
 *         try:
 *             self._exc_info = sys.exc_info()             # <<<<<<<<<<<<<<
 *         except BaseException as e:
 *             self._store_exception(e)
*/
        __pyx_t_5 = __pyx_v_4lxml_5etree_sys;
        __Pyx_INCREF(__pyx_t_5);
        __pyx_t_6 = 0;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};
          __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_exc_info, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 428, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_4);
        }
        __Pyx_GIVEREF(__pyx_t_4);
        __Pyx_GOTREF(__pyx_v_self->_exc_info);
        __Pyx_DECREF(__pyx_v_self->_exc_info);
        __pyx_v_self->_exc_info = __pyx_t_4;
        __pyx_t_4 = 0;

        /* "lxml/etree.pyx":427
 *     @cython.final
 *     cdef void _store_raised(self) noexcept:
 *         try:             # <<<<<<<<<<<<<<
 *             self._exc_info = sys.exc_info()
 *         except BaseException as e:
*/
      }
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L11_try_end;
      __pyx_L6_error:;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "lxml/etree.pyx":429
 *         try:
 *             self._exc_info = sys.exc_info()
 *         except BaseException as e:             # <<<<<<<<<<<<<<
 *             self._store_exception(e)
 *         finally:
*/
      __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_BaseException))));
      if (__pyx_t_7) {
        __Pyx_AddTraceback("lxml.etree._ExceptionContext._store_raised", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_5, &__pyx_t_8) < 0) __PYX_ERR(0, 429, __pyx_L8_except_error)
        __Pyx_XGOTREF(__pyx_t_4);
        __Pyx_XGOTREF(__pyx_t_5);
        __Pyx_XGOTREF(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_5);
        __pyx_v_e = __pyx_t_5;
        /*try:*/ {

          /* "lxml/etree.pyx":430
 *             self._exc_info = sys.exc_info()
 *         except BaseException as e:
 *             self._store_exception(e)             # <<<<<<<<<<<<<<
 *         finally:
 *             return  # and swallow any further exceptions
*/
          __pyx_t_7 = __pyx_f_4lxml_5etree_17_ExceptionContext__store_exception(__pyx_v_self, __pyx_v_e); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 430, __pyx_L17_error)
        }

        /* "lxml/etree.pyx":429
 *         try:
 *             self._exc_info = sys.exc_info()
 *         except BaseException as e:             # <<<<<<<<<<<<<<
 *             self._store_exception(e)
 *         finally:
*/
        /*finally:*/ {
          /*normal exit:*/{
            __Pyx_DECREF(__pyx_v_e); __pyx_v_e = 0;
            goto __pyx_L18;
          }
          __pyx_L17_error:;
          /*exception exit:*/{
            __Pyx_PyThreadState_declare
            __Pyx_PyThreadState_assign
            __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
             __Pyx_ExceptionSwap(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16);
            if ( unlikely(__Pyx_GetException(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13) < 0)) __Pyx_ErrFetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
            __Pyx_XGOTREF(__pyx_t_11);
            __Pyx_XGOTREF(__pyx_t_12);
            __Pyx_XGOTREF(__pyx_t_13);
            __Pyx_XGOTREF(__pyx_t_14);
            __Pyx_XGOTREF(__pyx_t_15);
            __Pyx_XGOTREF(__pyx_t_16);
            __pyx_t_7 = __pyx_lineno; __pyx_t_9 = __pyx_clineno; __pyx_t_10 = __pyx_filename;
            {
              __Pyx_DECREF(__pyx_v_e); __pyx_v_e = 0;
            }
            __Pyx_XGIVEREF(__pyx_t_14);
            __Pyx_XGIVEREF(__pyx_t_15);
            __Pyx_XGIVEREF(__pyx_t_16);
            __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16);
            __Pyx_XGIVEREF(__pyx_t_11);
            __Pyx_XGIVEREF(__pyx_t_12);
            __Pyx_XGIVEREF(__pyx_t_13);
            __Pyx_ErrRestore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
            __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
            __pyx_lineno = __pyx_t_7; __pyx_clineno = __pyx_t_9; __pyx_filename = __pyx_t_10;
            goto __pyx_L8_except_error;
          }
          __pyx_L18:;
        }
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L7_exception_handled;
      }
      goto __pyx_L8_except_error;

      /* "lxml/etree.pyx":427
 *     @cython.final
 *     cdef void _store_raised(self) noexcept:
 *         try:             # <<<<<<<<<<<<<<
 *             self._exc_info = sys.exc_info()
 *         except BaseException as e:
*/
      __pyx_L8_except_error:;
      __Pyx_XGIVEREF(__pyx_t_1);
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
      goto __pyx_L4_error;
      __pyx_L7_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_1);
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
      __pyx_L11_try_end:;
    }
  }

  /* "lxml/etree.pyx":432
 *             self._store_exception(e)
 *         finally:
 *             return  # and swallow any further exceptions             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
*/
  /*finally:*/ {
    /*normal exit:*/{
      goto __pyx_L0;
    }
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_1 = 0; __pyx_t_16 = 0; __pyx_t_15 = 0; __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_16, &__pyx_t_15, &__pyx_t_14);
      if ( unlikely(__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1) < 0)) __Pyx_ErrFetch(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_1);
      __Pyx_XGOTREF(__pyx_t_16);
      __Pyx_XGOTREF(__pyx_t_15);
      __Pyx_XGOTREF(__pyx_t_14);
      {
        goto __pyx_L23_return;
      }
      __pyx_L23_return:;
      __Pyx_XGIVEREF(__pyx_t_16);
      __Pyx_XGIVEREF(__pyx_t_15);
      __Pyx_XGIVEREF(__pyx_t_14);
      __Pyx_ExceptionReset(__pyx_t_16, __pyx_t_15, __pyx_t_14);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_16 = 0; __pyx_t_15 = 0; __pyx_t_14 = 0;
      goto __pyx_L0;
    }
  }

  /* "lxml/etree.pyx":425
 *         return 0
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef void _store_raised(self) noexcept:
 *         try:
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_e);
  __Pyx_RefNannyFinishContext();
}

/* "lxml/etree.pyx":434
 *             return  # and swallow any further exceptions
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef int _store_exception(self, exception) except -1:
 *         self._exc_info = (exception, None, None)
*/

static int __pyx_f_4lxml_5etree_17_ExceptionContext__store_exception(struct __pyx_obj_4lxml_5etree__ExceptionContext *__pyx_v_self, PyObject *__pyx_v_exception) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_store_exception", 0);

  /* "lxml/etree.pyx":436
 *     @cython.final
 *     cdef int _store_exception(self, exception) except -1:
 *         self._exc_info = (exception, None, None)             # <<<<<<<<<<<<<<
 *         return 0
 * 
*/
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 436, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_exception);
  __Pyx_GIVEREF(__pyx_v_exception);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_exception) != (0)) __PYX_ERR(0, 436, __pyx_L1_error);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, Py_None) != (0)) __PYX_ERR(0, 436, __pyx_L1_error);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None) != (0)) __PYX_ERR(0, 436, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_exc_info);
  __Pyx_DECREF(__pyx_v_self->_exc_info);
  __pyx_v_self->_exc_info = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "lxml/etree.pyx":437
 *     cdef int _store_exception(self, exception) except -1:
 *         self._exc_info = (exception, None, None)
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":434
 *             return  # and swallow any further exceptions
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef int _store_exception(self, exception) except -1:
 *         self._exc_info = (exception, None, None)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ExceptionContext._store_exception", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":439
 *         return 0
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef bint _has_raised(self) except -1:
 *         return self._exc_info is not None
*/

static int __pyx_f_4lxml_5etree_17_ExceptionContext__has_raised(struct __pyx_obj_4lxml_5etree__ExceptionContext *__pyx_v_self) {
  int __pyx_r;
  int __pyx_t_1;

  /* "lxml/etree.pyx":441
 *     @cython.final
 *     cdef bint _has_raised(self) except -1:
 *         return self._exc_info is not None             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
*/
  __pyx_t_1 = (__pyx_v_self->_exc_info != Py_None);
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  /* "lxml/etree.pyx":439
 *         return 0
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef bint _has_raised(self) except -1:
 *         return self._exc_info is not None
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "lxml/etree.pyx":443
 *         return self._exc_info is not None
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef int _raise_if_stored(self) except -1:
 *         if self._exc_info is None:
*/

static int __pyx_f_4lxml_5etree_17_ExceptionContext__raise_if_stored(struct __pyx_obj_4lxml_5etree__ExceptionContext *__pyx_v_self) {
  PyObject *__pyx_v_type = NULL;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_v_traceback = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_raise_if_stored", 0);

  /* "lxml/etree.pyx":445
 *     @cython.final
 *     cdef int _raise_if_stored(self) except -1:
 *         if self._exc_info is None:             # <<<<<<<<<<<<<<
 *             return 0
 *         type, value, traceback = self._exc_info
*/
  __pyx_t_1 = (__pyx_v_self->_exc_info == Py_None);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":446
 *     cdef int _raise_if_stored(self) except -1:
 *         if self._exc_info is None:
 *             return 0             # <<<<<<<<<<<<<<
 *         type, value, traceback = self._exc_info
 *         self._exc_info = None
*/
    __pyx_r = 0;
    goto __pyx_L0;

    /* "lxml/etree.pyx":445
 *     @cython.final
 *     cdef int _raise_if_stored(self) except -1:
 *         if self._exc_info is None:             # <<<<<<<<<<<<<<
 *             return 0
 *         type, value, traceback = self._exc_info
*/
  }

  /* "lxml/etree.pyx":447
 *         if self._exc_info is None:
 *             return 0
 *         type, value, traceback = self._exc_info             # <<<<<<<<<<<<<<
 *         self._exc_info = None
 *         if value is None and traceback is None:
*/
  __pyx_t_2 = __pyx_v_self->_exc_info;
  __Pyx_INCREF(__pyx_t_2);
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 3)) {
      if (size > 3) __Pyx_RaiseTooManyValuesError(3);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 447, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
      __Pyx_INCREF(__pyx_t_3);
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
      __Pyx_INCREF(__pyx_t_4);
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 2);
      __Pyx_INCREF(__pyx_t_5);
    } else {
      __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 447, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 447, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyList_GetItemRefFast(sequence, 2, __Pyx_ReferenceSharing_SharedReference);
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 447, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_5);
    }
    #else
    __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 447, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 447, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 447, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_6 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 447, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_6);
    index = 0; __pyx_t_3 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_3)) goto __pyx_L4_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 1; __pyx_t_4 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L4_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    index = 2; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L4_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 3) < (0)) __PYX_ERR(0, 447, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L5_unpacking_done;
    __pyx_L4_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 447, __pyx_L1_error)
    __pyx_L5_unpacking_done:;
  }
  __pyx_v_type = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_value = __pyx_t_4;
  __pyx_t_4 = 0;
  __pyx_v_traceback = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "lxml/etree.pyx":448
 *             return 0
 *         type, value, traceback = self._exc_info
 *         self._exc_info = None             # <<<<<<<<<<<<<<
 *         if value is None and traceback is None:
 *             raise type
*/
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_exc_info);
  __Pyx_DECREF(__pyx_v_self->_exc_info);
  __pyx_v_self->_exc_info = Py_None;

  /* "lxml/etree.pyx":449
 *         type, value, traceback = self._exc_info
 *         self._exc_info = None
 *         if value is None and traceback is None:             # <<<<<<<<<<<<<<
 *             raise type
 *         else:
*/
  __pyx_t_8 = (__pyx_v_value == Py_None);
  if (__pyx_t_8) {
  } else {
    __pyx_t_1 = __pyx_t_8;
    goto __pyx_L7_bool_binop_done;
  }
  __pyx_t_8 = (__pyx_v_traceback == Py_None);
  __pyx_t_1 = __pyx_t_8;
  __pyx_L7_bool_binop_done:;
  if (unlikely(__pyx_t_1)) {

    /* "lxml/etree.pyx":450
 *         self._exc_info = None
 *         if value is None and traceback is None:
 *             raise type             # <<<<<<<<<<<<<<
 *         else:
 *             raise type, value, traceback
*/
    __Pyx_Raise(__pyx_v_type, 0, 0, 0);
    __PYX_ERR(0, 450, __pyx_L1_error)

    /* "lxml/etree.pyx":449
 *         type, value, traceback = self._exc_info
 *         self._exc_info = None
 *         if value is None and traceback is None:             # <<<<<<<<<<<<<<
 *             raise type
 *         else:
*/
  }

  /* "lxml/etree.pyx":452
 *             raise type
 *         else:
 *             raise type, value, traceback             # <<<<<<<<<<<<<<
 * 
 * 
*/
  /*else*/ {
    __Pyx_Raise(__pyx_v_type, __pyx_v_value, __pyx_v_traceback, 0);
    __PYX_ERR(0, 452, __pyx_L1_error)
  }

  /* "lxml/etree.pyx":443
 *         return self._exc_info is not None
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef int _raise_if_stored(self) except -1:
 *         if self._exc_info is None:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._ExceptionContext._raise_if_stored", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_type);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XDECREF(__pyx_v_traceback);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/proxy.pxi":7
 * # the Python class.
 * 
 * @cython.linetrace(False)             # <<<<<<<<<<<<<<
 * @cython.profile(False)
 * cdef inline _Element getProxy(xmlNode* c_node):
*/

static CYTHON_INLINE struct LxmlElement *__pyx_f_4lxml_5etree_getProxy(xmlNode *__pyx_v_c_node) {
  struct LxmlElement *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getProxy", 0);

  /* "src/lxml/proxy.pxi":13
 *     """
 *     #print "getProxy for:", <int>c_node
 *     if c_node is not NULL and c_node._private is not NULL:             # <<<<<<<<<<<<<<
 *         return <_Element>c_node._private
 *     else:
*/
  __pyx_t_2 = (__pyx_v_c_node != NULL);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_c_node->_private != NULL);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/proxy.pxi":14
 *     #print "getProxy for:", <int>c_node
 *     if c_node is not NULL and c_node._private is not NULL:
 *         return <_Element>c_node._private             # <<<<<<<<<<<<<<
 *     else:
 *         return None
*/
    __Pyx_XDECREF((PyObject *)__pyx_r);
    __Pyx_INCREF((PyObject *)((struct LxmlElement *)__pyx_v_c_node->_private));
    __pyx_r = ((struct LxmlElement *)__pyx_v_c_node->_private);
    goto __pyx_L0;

    /* "src/lxml/proxy.pxi":13
 *     """
 *     #print "getProxy for:", <int>c_node
 *     if c_node is not NULL and c_node._private is not NULL:             # <<<<<<<<<<<<<<
 *         return <_Element>c_node._private
 *     else:
*/
  }

  /* "src/lxml/proxy.pxi":16
 *         return <_Element>c_node._private
 *     else:
 *         return None             # <<<<<<<<<<<<<<
 * 
 * 
*/
  /*else*/ {
    __Pyx_XDECREF((PyObject *)__pyx_r);
    __pyx_r = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "src/lxml/proxy.pxi":7
 * # the Python class.
 * 
 * @cython.linetrace(False)             # <<<<<<<<<<<<<<
 * @cython.profile(False)
 * cdef inline _Element getProxy(xmlNode* c_node):
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/proxy.pxi":19
 * 
 * 
 * @cython.linetrace(False)             # <<<<<<<<<<<<<<
 * @cython.profile(False)
 * cdef inline bint hasProxy(xmlNode* c_node):
*/

static CYTHON_INLINE int __pyx_f_4lxml_5etree_hasProxy(xmlNode *__pyx_v_c_node) {
  int __pyx_r;
  int __pyx_t_1;

  /* "src/lxml/proxy.pxi":22
 * @cython.profile(False)
 * cdef inline bint hasProxy(xmlNode* c_node):
 *     if c_node._private is NULL:             # <<<<<<<<<<<<<<
 *         return False
 *     return True
*/
  __pyx_t_1 = (__pyx_v_c_node->_private == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/proxy.pxi":23
 * cdef inline bint hasProxy(xmlNode* c_node):
 *     if c_node._private is NULL:
 *         return False             # <<<<<<<<<<<<<<
 *     return True
 * 
*/
    __pyx_r = 0;
    goto __pyx_L0;

    /* "src/lxml/proxy.pxi":22
 * @cython.profile(False)
 * cdef inline bint hasProxy(xmlNode* c_node):
 *     if c_node._private is NULL:             # <<<<<<<<<<<<<<
 *         return False
 *     return True
*/
  }

  /* "src/lxml/proxy.pxi":24
 *     if c_node._private is NULL:
 *         return False
 *     return True             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = 1;
  goto __pyx_L0;

  /* "src/lxml/proxy.pxi":19
 * 
 * 
 * @cython.linetrace(False)             # <<<<<<<<<<<<<<
 * @cython.profile(False)
 * cdef inline bint hasProxy(xmlNode* c_node):
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/proxy.pxi":27
 * 
 * 
 * @cython.linetrace(False)             # <<<<<<<<<<<<<<
 * @cython.profile(False)
 * cdef inline int _registerProxy(_Element proxy, _Document doc,
*/

static CYTHON_INLINE int __pyx_f_4lxml_5etree__registerProxy(struct LxmlElement *__pyx_v_proxy, struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_node) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_registerProxy", 0);

  /* "src/lxml/proxy.pxi":34
 *     """
 *     #print "registering for:", <int>proxy._c_node
 *     assert not hasProxy(c_node), "double registering proxy!"             # <<<<<<<<<<<<<<
 *     proxy._doc = doc
 *     proxy._c_node = c_node
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = __pyx_f_4lxml_5etree_hasProxy(__pyx_v_c_node); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(8, 34, __pyx_L1_error)
    __pyx_t_2 = (!__pyx_t_1);
    if (unlikely(!__pyx_t_2)) {
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_mstate_global->__pyx_kp_u_double_registering_proxy, 0, 0);
      __PYX_ERR(8, 34, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(8, 34, __pyx_L1_error)
  #endif

  /* "src/lxml/proxy.pxi":35
 *     #print "registering for:", <int>proxy._c_node
 *     assert not hasProxy(c_node), "double registering proxy!"
 *     proxy._doc = doc             # <<<<<<<<<<<<<<
 *     proxy._c_node = c_node
 *     c_node._private = <void*>proxy
*/
  __Pyx_INCREF((PyObject *)__pyx_v_doc);
  __Pyx_GIVEREF((PyObject *)__pyx_v_doc);
  __Pyx_GOTREF((PyObject *)__pyx_v_proxy->_doc);
  __Pyx_DECREF((PyObject *)__pyx_v_proxy->_doc);
  __pyx_v_proxy->_doc = __pyx_v_doc;

  /* "src/lxml/proxy.pxi":36
 *     assert not hasProxy(c_node), "double registering proxy!"
 *     proxy._doc = doc
 *     proxy._c_node = c_node             # <<<<<<<<<<<<<<
 *     c_node._private = <void*>proxy
 *     return 0
*/
  __pyx_v_proxy->_c_node = __pyx_v_c_node;

  /* "src/lxml/proxy.pxi":37
 *     proxy._doc = doc
 *     proxy._c_node = c_node
 *     c_node._private = <void*>proxy             # <<<<<<<<<<<<<<
 *     return 0
 * 
*/
  __pyx_v_c_node->_private = ((void *)__pyx_v_proxy);

  /* "src/lxml/proxy.pxi":38
 *     proxy._c_node = c_node
 *     c_node._private = <void*>proxy
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/proxy.pxi":27
 * 
 * 
 * @cython.linetrace(False)             # <<<<<<<<<<<<<<
 * @cython.profile(False)
 * cdef inline int _registerProxy(_Element proxy, _Document doc,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._registerProxy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/proxy.pxi":41
 * 
 * 
 * @cython.linetrace(False)             # <<<<<<<<<<<<<<
 * @cython.profile(False)
 * cdef inline int _unregisterProxy(_Element proxy) except -1:
*/

static CYTHON_INLINE int __pyx_f_4lxml_5etree__unregisterProxy(struct LxmlElement *__pyx_v_proxy) {
  xmlNode *__pyx_v_c_node;
  int __pyx_r;
  xmlNode *__pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/proxy.pxi":46
 *     """Unregister a proxy for the node it's proxying for.
 *     """
 *     cdef xmlNode* c_node = proxy._c_node             # <<<<<<<<<<<<<<
 *     assert c_node._private is <void*>proxy, "Tried to unregister unknown proxy"
 *     c_node._private = NULL
*/
  __pyx_t_1 = __pyx_v_proxy->_c_node;
  __pyx_v_c_node = __pyx_t_1;

  /* "src/lxml/proxy.pxi":47
 *     """
 *     cdef xmlNode* c_node = proxy._c_node
 *     assert c_node._private is <void*>proxy, "Tried to unregister unknown proxy"             # <<<<<<<<<<<<<<
 *     c_node._private = NULL
 *     return 0
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_2 = (__pyx_v_c_node->_private == ((void *)__pyx_v_proxy));
    if (unlikely(!__pyx_t_2)) {
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_mstate_global->__pyx_kp_u_Tried_to_unregister_unknown_prox, 0, 0);
      __PYX_ERR(8, 47, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(8, 47, __pyx_L1_error)
  #endif

  /* "src/lxml/proxy.pxi":48
 *     cdef xmlNode* c_node = proxy._c_node
 *     assert c_node._private is <void*>proxy, "Tried to unregister unknown proxy"
 *     c_node._private = NULL             # <<<<<<<<<<<<<<
 *     return 0
 * 
*/
  __pyx_v_c_node->_private = NULL;

  /* "src/lxml/proxy.pxi":49
 *     assert c_node._private is <void*>proxy, "Tried to unregister unknown proxy"
 *     c_node._private = NULL
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/proxy.pxi":41
 * 
 * 
 * @cython.linetrace(False)             # <<<<<<<<<<<<<<
 * @cython.profile(False)
 * cdef inline int _unregisterProxy(_Element proxy) except -1:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._unregisterProxy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/proxy.pxi":55
 * # temporarily make a node the root node of its document
 * 
 * cdef xmlDoc* _fakeRootDoc(xmlDoc* c_base_doc, xmlNode* c_node) except NULL:             # <<<<<<<<<<<<<<
 *     return _plainFakeRootDoc(c_base_doc, c_node, 1)
 * 
*/

static xmlDoc *__pyx_f_4lxml_5etree__fakeRootDoc(xmlDoc *__pyx_v_c_base_doc, xmlNode *__pyx_v_c_node) {
  xmlDoc *__pyx_r;
  xmlDoc *__pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/proxy.pxi":56
 * 
 * cdef xmlDoc* _fakeRootDoc(xmlDoc* c_base_doc, xmlNode* c_node) except NULL:
 *     return _plainFakeRootDoc(c_base_doc, c_node, 1)             # <<<<<<<<<<<<<<
 * 
 * cdef xmlDoc* _plainFakeRootDoc(xmlDoc* c_base_doc, xmlNode* c_node,
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__plainFakeRootDoc(__pyx_v_c_base_doc, __pyx_v_c_node, 1); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(8, 56, __pyx_L1_error)
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  /* "src/lxml/proxy.pxi":55
 * # temporarily make a node the root node of its document
 * 
 * cdef xmlDoc* _fakeRootDoc(xmlDoc* c_base_doc, xmlNode* c_node) except NULL:             # <<<<<<<<<<<<<<
 *     return _plainFakeRootDoc(c_base_doc, c_node, 1)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._fakeRootDoc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/proxy.pxi":58
 *     return _plainFakeRootDoc(c_base_doc, c_node, 1)
 * 
 * cdef xmlDoc* _plainFakeRootDoc(xmlDoc* c_base_doc, xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                                bint with_siblings) except NULL:
 *     # build a temporary document that has the given node as root node
*/

static xmlDoc *__pyx_f_4lxml_5etree__plainFakeRootDoc(xmlDoc *__pyx_v_c_base_doc, xmlNode *__pyx_v_c_node, int __pyx_v_with_siblings) {
  xmlNode *__pyx_v_c_child;
  xmlNode *__pyx_v_c_root;
  xmlNode *__pyx_v_c_new_root;
  xmlDoc *__pyx_v_c_doc;
  xmlDoc *__pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  xmlDoc *__pyx_t_3;
  xmlNode *__pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/proxy.pxi":67
 *     cdef xmlNode* c_new_root
 *     cdef xmlDoc*  c_doc
 *     if with_siblings or (c_node.prev is NULL and c_node.next is NULL):             # <<<<<<<<<<<<<<
 *         c_root = tree.xmlDocGetRootElement(c_base_doc)
 *         if c_root is c_node:
*/
  if (!__pyx_v_with_siblings) {
  } else {
    __pyx_t_1 = __pyx_v_with_siblings;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_c_node->prev == NULL);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_c_node->next == NULL);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/proxy.pxi":68
 *     cdef xmlDoc*  c_doc
 *     if with_siblings or (c_node.prev is NULL and c_node.next is NULL):
 *         c_root = tree.xmlDocGetRootElement(c_base_doc)             # <<<<<<<<<<<<<<
 *         if c_root is c_node:
 *             # already the root node, no siblings
*/
    __pyx_v_c_root = xmlDocGetRootElement(__pyx_v_c_base_doc);

    /* "src/lxml/proxy.pxi":69
 *     if with_siblings or (c_node.prev is NULL and c_node.next is NULL):
 *         c_root = tree.xmlDocGetRootElement(c_base_doc)
 *         if c_root is c_node:             # <<<<<<<<<<<<<<
 *             # already the root node, no siblings
 *             return c_base_doc
*/
    __pyx_t_1 = (__pyx_v_c_root == __pyx_v_c_node);
    if (__pyx_t_1) {

      /* "src/lxml/proxy.pxi":71
 *         if c_root is c_node:
 *             # already the root node, no siblings
 *             return c_base_doc             # <<<<<<<<<<<<<<
 * 
 *     c_doc  = _copyDoc(c_base_doc, 0)                   # non recursive!
*/
      __pyx_r = __pyx_v_c_base_doc;
      goto __pyx_L0;

      /* "src/lxml/proxy.pxi":69
 *     if with_siblings or (c_node.prev is NULL and c_node.next is NULL):
 *         c_root = tree.xmlDocGetRootElement(c_base_doc)
 *         if c_root is c_node:             # <<<<<<<<<<<<<<
 *             # already the root node, no siblings
 *             return c_base_doc
*/
    }

    /* "src/lxml/proxy.pxi":67
 *     cdef xmlNode* c_new_root
 *     cdef xmlDoc*  c_doc
 *     if with_siblings or (c_node.prev is NULL and c_node.next is NULL):             # <<<<<<<<<<<<<<
 *         c_root = tree.xmlDocGetRootElement(c_base_doc)
 *         if c_root is c_node:
*/
  }

  /* "src/lxml/proxy.pxi":73
 *             return c_base_doc
 * 
 *     c_doc  = _copyDoc(c_base_doc, 0)                   # non recursive!             # <<<<<<<<<<<<<<
 *     c_new_root = tree.xmlDocCopyNode(c_node, c_doc, 2) if c_doc is not NULL else NULL # non recursive!
 *     if c_new_root is NULL:
*/
  __pyx_t_3 = __pyx_f_4lxml_5etree__copyDoc(__pyx_v_c_base_doc, 0); if (unlikely(__pyx_t_3 == ((void *)NULL))) __PYX_ERR(8, 73, __pyx_L1_error)
  __pyx_v_c_doc = __pyx_t_3;

  /* "src/lxml/proxy.pxi":74
 * 
 *     c_doc  = _copyDoc(c_base_doc, 0)                   # non recursive!
 *     c_new_root = tree.xmlDocCopyNode(c_node, c_doc, 2) if c_doc is not NULL else NULL # non recursive!             # <<<<<<<<<<<<<<
 *     if c_new_root is NULL:
 *         raise MemoryError()
*/
  __pyx_t_1 = (__pyx_v_c_doc != NULL);
  if (__pyx_t_1) {
    __pyx_t_4 = xmlDocCopyNode(__pyx_v_c_node, __pyx_v_c_doc, 2);
  } else {
    __pyx_t_4 = NULL;
  }
  __pyx_v_c_new_root = __pyx_t_4;

  /* "src/lxml/proxy.pxi":75
 *     c_doc  = _copyDoc(c_base_doc, 0)                   # non recursive!
 *     c_new_root = tree.xmlDocCopyNode(c_node, c_doc, 2) if c_doc is not NULL else NULL # non recursive!
 *     if c_new_root is NULL:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     tree.xmlDocSetRootElement(c_doc, c_new_root)
*/
  __pyx_t_1 = (__pyx_v_c_new_root == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/proxy.pxi":76
 *     c_new_root = tree.xmlDocCopyNode(c_node, c_doc, 2) if c_doc is not NULL else NULL # non recursive!
 *     if c_new_root is NULL:
 *         raise MemoryError()             # <<<<<<<<<<<<<<
 *     tree.xmlDocSetRootElement(c_doc, c_new_root)
 *     _copyParentNamespaces(c_node, c_new_root)
*/
    PyErr_NoMemory(); __PYX_ERR(8, 76, __pyx_L1_error)

    /* "src/lxml/proxy.pxi":75
 *     c_doc  = _copyDoc(c_base_doc, 0)                   # non recursive!
 *     c_new_root = tree.xmlDocCopyNode(c_node, c_doc, 2) if c_doc is not NULL else NULL # non recursive!
 *     if c_new_root is NULL:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     tree.xmlDocSetRootElement(c_doc, c_new_root)
*/
  }

  /* "src/lxml/proxy.pxi":77
 *     if c_new_root is NULL:
 *         raise MemoryError()
 *     tree.xmlDocSetRootElement(c_doc, c_new_root)             # <<<<<<<<<<<<<<
 *     _copyParentNamespaces(c_node, c_new_root)
 * 
*/
  (void)(xmlDocSetRootElement(__pyx_v_c_doc, __pyx_v_c_new_root));

  /* "src/lxml/proxy.pxi":78
 *         raise MemoryError()
 *     tree.xmlDocSetRootElement(c_doc, c_new_root)
 *     _copyParentNamespaces(c_node, c_new_root)             # <<<<<<<<<<<<<<
 * 
 *     c_new_root.children = c_node.children
*/
  __pyx_f_4lxml_5etree__copyParentNamespaces(__pyx_v_c_node, __pyx_v_c_new_root);

  /* "src/lxml/proxy.pxi":80
 *     _copyParentNamespaces(c_node, c_new_root)
 * 
 *     c_new_root.children = c_node.children             # <<<<<<<<<<<<<<
 *     c_new_root.last = c_node.last
 *     c_new_root.next = c_new_root.prev = NULL
*/
  __pyx_t_4 = __pyx_v_c_node->children;
  __pyx_v_c_new_root->children = __pyx_t_4;

  /* "src/lxml/proxy.pxi":81
 * 
 *     c_new_root.children = c_node.children
 *     c_new_root.last = c_node.last             # <<<<<<<<<<<<<<
 *     c_new_root.next = c_new_root.prev = NULL
 * 
*/
  __pyx_t_4 = __pyx_v_c_node->last;
  __pyx_v_c_new_root->last = __pyx_t_4;

  /* "src/lxml/proxy.pxi":82
 *     c_new_root.children = c_node.children
 *     c_new_root.last = c_node.last
 *     c_new_root.next = c_new_root.prev = NULL             # <<<<<<<<<<<<<<
 * 
 *     # store original node
*/
  __pyx_v_c_new_root->next = NULL;
  __pyx_v_c_new_root->prev = NULL;

  /* "src/lxml/proxy.pxi":85
 * 
 *     # store original node
 *     c_doc._private = c_node             # <<<<<<<<<<<<<<
 * 
 *     # divert parent pointers of children
*/
  __pyx_v_c_doc->_private = __pyx_v_c_node;

  /* "src/lxml/proxy.pxi":88
 * 
 *     # divert parent pointers of children
 *     c_child = c_new_root.children             # <<<<<<<<<<<<<<
 *     while c_child is not NULL:
 *         c_child.parent = c_new_root
*/
  __pyx_t_4 = __pyx_v_c_new_root->children;
  __pyx_v_c_child = __pyx_t_4;

  /* "src/lxml/proxy.pxi":89
 *     # divert parent pointers of children
 *     c_child = c_new_root.children
 *     while c_child is not NULL:             # <<<<<<<<<<<<<<
 *         c_child.parent = c_new_root
 *         c_child = c_child.next
*/
  while (1) {
    __pyx_t_1 = (__pyx_v_c_child != NULL);
    if (!__pyx_t_1) break;

    /* "src/lxml/proxy.pxi":90
 *     c_child = c_new_root.children
 *     while c_child is not NULL:
 *         c_child.parent = c_new_root             # <<<<<<<<<<<<<<
 *         c_child = c_child.next
 * 
*/
    __pyx_v_c_child->parent = __pyx_v_c_new_root;

    /* "src/lxml/proxy.pxi":91
 *     while c_child is not NULL:
 *         c_child.parent = c_new_root
 *         c_child = c_child.next             # <<<<<<<<<<<<<<
 * 
 *     c_doc.children = c_new_root
*/
    __pyx_t_4 = __pyx_v_c_child->next;
    __pyx_v_c_child = __pyx_t_4;
  }

  /* "src/lxml/proxy.pxi":93
 *         c_child = c_child.next
 * 
 *     c_doc.children = c_new_root             # <<<<<<<<<<<<<<
 *     return c_doc
 * 
*/
  __pyx_v_c_doc->children = __pyx_v_c_new_root;

  /* "src/lxml/proxy.pxi":94
 * 
 *     c_doc.children = c_new_root
 *     return c_doc             # <<<<<<<<<<<<<<
 * 
 * cdef void _destroyFakeDoc(xmlDoc* c_base_doc, xmlDoc* c_doc) noexcept:
*/
  __pyx_r = __pyx_v_c_doc;
  goto __pyx_L0;

  /* "src/lxml/proxy.pxi":58
 *     return _plainFakeRootDoc(c_base_doc, c_node, 1)
 * 
 * cdef xmlDoc* _plainFakeRootDoc(xmlDoc* c_base_doc, xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                                bint with_siblings) except NULL:
 *     # build a temporary document that has the given node as root node
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._plainFakeRootDoc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/proxy.pxi":96
 *     return c_doc
 * 
 * cdef void _destroyFakeDoc(xmlDoc* c_base_doc, xmlDoc* c_doc) noexcept:             # <<<<<<<<<<<<<<
 *     # delete a temporary document
 *     cdef xmlNode* c_child
*/

static void __pyx_f_4lxml_5etree__destroyFakeDoc(xmlDoc *__pyx_v_c_base_doc, xmlDoc *__pyx_v_c_doc) {
  xmlNode *__pyx_v_c_child;
  xmlNode *__pyx_v_c_parent;
  xmlNode *__pyx_v_c_root;
  int __pyx_t_1;
  xmlNode *__pyx_t_2;

  /* "src/lxml/proxy.pxi":101
 *     cdef xmlNode* c_parent
 *     cdef xmlNode* c_root
 *     if c_doc is c_base_doc:             # <<<<<<<<<<<<<<
 *         return
 *     c_root = tree.xmlDocGetRootElement(c_doc)
*/
  __pyx_t_1 = (__pyx_v_c_doc == __pyx_v_c_base_doc);
  if (__pyx_t_1) {

    /* "src/lxml/proxy.pxi":102
 *     cdef xmlNode* c_root
 *     if c_doc is c_base_doc:
 *         return             # <<<<<<<<<<<<<<
 *     c_root = tree.xmlDocGetRootElement(c_doc)
 * 
*/
    goto __pyx_L0;

    /* "src/lxml/proxy.pxi":101
 *     cdef xmlNode* c_parent
 *     cdef xmlNode* c_root
 *     if c_doc is c_base_doc:             # <<<<<<<<<<<<<<
 *         return
 *     c_root = tree.xmlDocGetRootElement(c_doc)
*/
  }

  /* "src/lxml/proxy.pxi":103
 *     if c_doc is c_base_doc:
 *         return
 *     c_root = tree.xmlDocGetRootElement(c_doc)             # <<<<<<<<<<<<<<
 * 
 *     # restore parent pointers of children
*/
  __pyx_v_c_root = xmlDocGetRootElement(__pyx_v_c_doc);

  /* "src/lxml/proxy.pxi":106
 * 
 *     # restore parent pointers of children
 *     c_parent = <xmlNode*>c_doc._private             # <<<<<<<<<<<<<<
 *     c_child = c_root.children
 *     while c_child is not NULL:
*/
  __pyx_v_c_parent = ((xmlNode *)__pyx_v_c_doc->_private);

  /* "src/lxml/proxy.pxi":107
 *     # restore parent pointers of children
 *     c_parent = <xmlNode*>c_doc._private
 *     c_child = c_root.children             # <<<<<<<<<<<<<<
 *     while c_child is not NULL:
 *         c_child.parent = c_parent
*/
  __pyx_t_2 = __pyx_v_c_root->children;
  __pyx_v_c_child = __pyx_t_2;

  /* "src/lxml/proxy.pxi":108
 *     c_parent = <xmlNode*>c_doc._private
 *     c_child = c_root.children
 *     while c_child is not NULL:             # <<<<<<<<<<<<<<
 *         c_child.parent = c_parent
 *         c_child = c_child.next
*/
  while (1) {
    __pyx_t_1 = (__pyx_v_c_child != NULL);
    if (!__pyx_t_1) break;

    /* "src/lxml/proxy.pxi":109
 *     c_child = c_root.children
 *     while c_child is not NULL:
 *         c_child.parent = c_parent             # <<<<<<<<<<<<<<
 *         c_child = c_child.next
 * 
*/
    __pyx_v_c_child->parent = __pyx_v_c_parent;

    /* "src/lxml/proxy.pxi":110
 *     while c_child is not NULL:
 *         c_child.parent = c_parent
 *         c_child = c_child.next             # <<<<<<<<<<<<<<
 * 
 *     # prevent recursive removal of children
*/
    __pyx_t_2 = __pyx_v_c_child->next;
    __pyx_v_c_child = __pyx_t_2;
  }

  /* "src/lxml/proxy.pxi":113
 * 
 *     # prevent recursive removal of children
 *     c_root.children = c_root.last = NULL             # <<<<<<<<<<<<<<
 *     tree.xmlFreeDoc(c_doc)
 * 
*/
  __pyx_v_c_root->children = NULL;
  __pyx_v_c_root->last = NULL;

  /* "src/lxml/proxy.pxi":114
 *     # prevent recursive removal of children
 *     c_root.children = c_root.last = NULL
 *     tree.xmlFreeDoc(c_doc)             # <<<<<<<<<<<<<<
 * 
 * cdef _Element _fakeDocElementFactory(_Document doc, xmlNode* c_element):
*/
  xmlFreeDoc(__pyx_v_c_doc);

  /* "src/lxml/proxy.pxi":96
 *     return c_doc
 * 
 * cdef void _destroyFakeDoc(xmlDoc* c_base_doc, xmlDoc* c_doc) noexcept:             # <<<<<<<<<<<<<<
 *     # delete a temporary document
 *     cdef xmlNode* c_child
*/

  /* function exit code */
  __pyx_L0:;
}

/* "src/lxml/proxy.pxi":116
 *     tree.xmlFreeDoc(c_doc)
 * 
 * cdef _Element _fakeDocElementFactory(_Document doc, xmlNode* c_element):             # <<<<<<<<<<<<<<
 *     """Special element factory for cases where we need to create a fake
 *     root document, but still need to instantiate arbitrary nodes from
*/

static struct LxmlElement *__pyx_f_4lxml_5etree__fakeDocElementFactory(struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_element) {
  struct LxmlElement *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_fakeDocElementFactory", 0);

  /* "src/lxml/proxy.pxi":125
 *     instantiate the original node instead.
 *     """
 *     if c_element.doc is not doc._c_doc:             # <<<<<<<<<<<<<<
 *         if c_element.doc._private is not NULL:
 *             if c_element is c_element.doc.children:
*/
  __pyx_t_1 = (__pyx_v_c_element->doc != __pyx_v_doc->_c_doc);
  if (__pyx_t_1) {

    /* "src/lxml/proxy.pxi":126
 *     """
 *     if c_element.doc is not doc._c_doc:
 *         if c_element.doc._private is not NULL:             # <<<<<<<<<<<<<<
 *             if c_element is c_element.doc.children:
 *                 c_element = <xmlNode*>c_element.doc._private
*/
    __pyx_t_1 = (__pyx_v_c_element->doc->_private != NULL);
    if (__pyx_t_1) {

      /* "src/lxml/proxy.pxi":127
 *     if c_element.doc is not doc._c_doc:
 *         if c_element.doc._private is not NULL:
 *             if c_element is c_element.doc.children:             # <<<<<<<<<<<<<<
 *                 c_element = <xmlNode*>c_element.doc._private
 *                 #assert c_element.type == tree.XML_ELEMENT_NODE
*/
      __pyx_t_1 = (__pyx_v_c_element == __pyx_v_c_element->doc->children);
      if (__pyx_t_1) {

        /* "src/lxml/proxy.pxi":128
 *         if c_element.doc._private is not NULL:
 *             if c_element is c_element.doc.children:
 *                 c_element = <xmlNode*>c_element.doc._private             # <<<<<<<<<<<<<<
 *                 #assert c_element.type == tree.XML_ELEMENT_NODE
 *     return _elementFactory(doc, c_element)
*/
        __pyx_v_c_element = ((xmlNode *)__pyx_v_c_element->doc->_private);

        /* "src/lxml/proxy.pxi":127
 *     if c_element.doc is not doc._c_doc:
 *         if c_element.doc._private is not NULL:
 *             if c_element is c_element.doc.children:             # <<<<<<<<<<<<<<
 *                 c_element = <xmlNode*>c_element.doc._private
 *                 #assert c_element.type == tree.XML_ELEMENT_NODE
*/
      }

      /* "src/lxml/proxy.pxi":126
 *     """
 *     if c_element.doc is not doc._c_doc:
 *         if c_element.doc._private is not NULL:             # <<<<<<<<<<<<<<
 *             if c_element is c_element.doc.children:
 *                 c_element = <xmlNode*>c_element.doc._private
*/
    }

    /* "src/lxml/proxy.pxi":125
 *     instantiate the original node instead.
 *     """
 *     if c_element.doc is not doc._c_doc:             # <<<<<<<<<<<<<<
 *         if c_element.doc._private is not NULL:
 *             if c_element is c_element.doc.children:
*/
  }

  /* "src/lxml/proxy.pxi":130
 *                 c_element = <xmlNode*>c_element.doc._private
 *                 #assert c_element.type == tree.XML_ELEMENT_NODE
 *     return _elementFactory(doc, c_element)             # <<<<<<<<<<<<<<
 * 
 * ################################################################################
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(__pyx_v_doc, __pyx_v_c_element)); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = ((struct LxmlElement *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/proxy.pxi":116
 *     tree.xmlFreeDoc(c_doc)
 * 
 * cdef _Element _fakeDocElementFactory(_Document doc, xmlNode* c_element):             # <<<<<<<<<<<<<<
 *     """Special element factory for cases where we need to create a fake
 *     root document, but still need to instantiate arbitrary nodes from
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._fakeDocElementFactory", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/proxy.pxi":135
 * # support for freeing tree elements when proxy objects are destroyed
 * 
 * cdef int attemptDeallocation(xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *     """Attempt deallocation of c_node (or higher up in tree).
 *     """
*/

static int __pyx_f_4lxml_5etree_attemptDeallocation(xmlNode *__pyx_v_c_node) {
  xmlNode *__pyx_v_c_top;
  int __pyx_r;
  int __pyx_t_1;

  /* "src/lxml/proxy.pxi":140
 *     cdef xmlNode* c_top
 *     # could be we actually aren't referring to the tree at all
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         #print "not freeing, node is NULL"
 *         return 0
*/
  __pyx_t_1 = (__pyx_v_c_node == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/proxy.pxi":142
 *     if c_node is NULL:
 *         #print "not freeing, node is NULL"
 *         return 0             # <<<<<<<<<<<<<<
 *     c_top = getDeallocationTop(c_node)
 *     if c_top is not NULL:
*/
    __pyx_r = 0;
    goto __pyx_L0;

    /* "src/lxml/proxy.pxi":140
 *     cdef xmlNode* c_top
 *     # could be we actually aren't referring to the tree at all
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         #print "not freeing, node is NULL"
 *         return 0
*/
  }

  /* "src/lxml/proxy.pxi":143
 *         #print "not freeing, node is NULL"
 *         return 0
 *     c_top = getDeallocationTop(c_node)             # <<<<<<<<<<<<<<
 *     if c_top is not NULL:
 *         #print "freeing:", c_top.name
*/
  __pyx_v_c_top = __pyx_f_4lxml_5etree_getDeallocationTop(__pyx_v_c_node);

  /* "src/lxml/proxy.pxi":144
 *         return 0
 *     c_top = getDeallocationTop(c_node)
 *     if c_top is not NULL:             # <<<<<<<<<<<<<<
 *         #print "freeing:", c_top.name
 *         _removeText(c_top.next) # tail
*/
  __pyx_t_1 = (__pyx_v_c_top != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/proxy.pxi":146
 *     if c_top is not NULL:
 *         #print "freeing:", c_top.name
 *         _removeText(c_top.next) # tail             # <<<<<<<<<<<<<<
 *         tree.xmlFreeNode(c_top)
 *         return 1
*/
    __pyx_f_4lxml_5etree__removeText(__pyx_v_c_top->next);

    /* "src/lxml/proxy.pxi":147
 *         #print "freeing:", c_top.name
 *         _removeText(c_top.next) # tail
 *         tree.xmlFreeNode(c_top)             # <<<<<<<<<<<<<<
 *         return 1
 *     return 0
*/
    xmlFreeNode(__pyx_v_c_top);

    /* "src/lxml/proxy.pxi":148
 *         _removeText(c_top.next) # tail
 *         tree.xmlFreeNode(c_top)
 *         return 1             # <<<<<<<<<<<<<<
 *     return 0
 * 
*/
    __pyx_r = 1;
    goto __pyx_L0;

    /* "src/lxml/proxy.pxi":144
 *         return 0
 *     c_top = getDeallocationTop(c_node)
 *     if c_top is not NULL:             # <<<<<<<<<<<<<<
 *         #print "freeing:", c_top.name
 *         _removeText(c_top.next) # tail
*/
  }

  /* "src/lxml/proxy.pxi":149
 *         tree.xmlFreeNode(c_top)
 *         return 1
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef xmlNode* getDeallocationTop(xmlNode* c_node) noexcept:
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/proxy.pxi":135
 * # support for freeing tree elements when proxy objects are destroyed
 * 
 * cdef int attemptDeallocation(xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *     """Attempt deallocation of c_node (or higher up in tree).
 *     """
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/proxy.pxi":151
 *     return 0
 * 
 * cdef xmlNode* getDeallocationTop(xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *     """Return the top of the tree that can be deallocated, or NULL.
 *     """
*/

static xmlNode *__pyx_f_4lxml_5etree_getDeallocationTop(xmlNode *__pyx_v_c_node) {
  xmlNode *__pyx_v_c_next;
  xmlNode *__pyx_r;
  int __pyx_t_1;
  xmlNode *__pyx_t_2;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/proxy.pxi":156
 *     cdef xmlNode* c_next
 *     #print "trying to do deallocating:", c_node.type
 *     if hasProxy(c_node):             # <<<<<<<<<<<<<<
 *         #print "Not freeing: proxies still exist"
 *         return NULL
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_hasProxy(__pyx_v_c_node); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(8, 156, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/proxy.pxi":158
 *     if hasProxy(c_node):
 *         #print "Not freeing: proxies still exist"
 *         return NULL             # <<<<<<<<<<<<<<
 *     while c_node.parent is not NULL:
 *         c_node = c_node.parent
*/
    __pyx_r = NULL;
    goto __pyx_L0;

    /* "src/lxml/proxy.pxi":156
 *     cdef xmlNode* c_next
 *     #print "trying to do deallocating:", c_node.type
 *     if hasProxy(c_node):             # <<<<<<<<<<<<<<
 *         #print "Not freeing: proxies still exist"
 *         return NULL
*/
  }

  /* "src/lxml/proxy.pxi":159
 *         #print "Not freeing: proxies still exist"
 *         return NULL
 *     while c_node.parent is not NULL:             # <<<<<<<<<<<<<<
 *         c_node = c_node.parent
 *         #print "checking:", c_current.type
*/
  while (1) {
    __pyx_t_1 = (__pyx_v_c_node->parent != NULL);
    if (!__pyx_t_1) break;

    /* "src/lxml/proxy.pxi":160
 *         return NULL
 *     while c_node.parent is not NULL:
 *         c_node = c_node.parent             # <<<<<<<<<<<<<<
 *         #print "checking:", c_current.type
 *         if c_node.type == tree.XML_DOCUMENT_NODE or \
*/
    __pyx_t_2 = __pyx_v_c_node->parent;
    __pyx_v_c_node = __pyx_t_2;

    /* "src/lxml/proxy.pxi":162
 *         c_node = c_node.parent
 *         #print "checking:", c_current.type
 *         if c_node.type == tree.XML_DOCUMENT_NODE or \             # <<<<<<<<<<<<<<
 *                c_node.type == tree.XML_HTML_DOCUMENT_NODE:
 *             #print "not freeing: still in doc"
*/
    switch (__pyx_v_c_node->type) {
      case XML_DOCUMENT_NODE:
      case XML_HTML_DOCUMENT_NODE:

      /* "src/lxml/proxy.pxi":165
 *                c_node.type == tree.XML_HTML_DOCUMENT_NODE:
 *             #print "not freeing: still in doc"
 *             return NULL             # <<<<<<<<<<<<<<
 *         # if we're still attached to the document, don't deallocate
 *         if hasProxy(c_node):
*/
      __pyx_r = NULL;
      goto __pyx_L0;

      /* "src/lxml/proxy.pxi":162
 *         c_node = c_node.parent
 *         #print "checking:", c_current.type
 *         if c_node.type == tree.XML_DOCUMENT_NODE or \             # <<<<<<<<<<<<<<
 *                c_node.type == tree.XML_HTML_DOCUMENT_NODE:
 *             #print "not freeing: still in doc"
*/
      break;
      default: break;
    }

    /* "src/lxml/proxy.pxi":167
 *             return NULL
 *         # if we're still attached to the document, don't deallocate
 *         if hasProxy(c_node):             # <<<<<<<<<<<<<<
 *             #print "Not freeing: proxies still exist"
 *             return NULL
*/
    __pyx_t_1 = __pyx_f_4lxml_5etree_hasProxy(__pyx_v_c_node); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(8, 167, __pyx_L1_error)
    if (__pyx_t_1) {

      /* "src/lxml/proxy.pxi":169
 *         if hasProxy(c_node):
 *             #print "Not freeing: proxies still exist"
 *             return NULL             # <<<<<<<<<<<<<<
 *     # see whether we have children to deallocate
 *     if not canDeallocateChildNodes(c_node):
*/
      __pyx_r = NULL;
      goto __pyx_L0;

      /* "src/lxml/proxy.pxi":167
 *             return NULL
 *         # if we're still attached to the document, don't deallocate
 *         if hasProxy(c_node):             # <<<<<<<<<<<<<<
 *             #print "Not freeing: proxies still exist"
 *             return NULL
*/
    }
  }

  /* "src/lxml/proxy.pxi":171
 *             return NULL
 *     # see whether we have children to deallocate
 *     if not canDeallocateChildNodes(c_node):             # <<<<<<<<<<<<<<
 *         return NULL
 *     # see whether we have siblings to deallocate
*/
  __pyx_t_1 = (!(__pyx_f_4lxml_5etree_canDeallocateChildNodes(__pyx_v_c_node) != 0));
  if (__pyx_t_1) {

    /* "src/lxml/proxy.pxi":172
 *     # see whether we have children to deallocate
 *     if not canDeallocateChildNodes(c_node):
 *         return NULL             # <<<<<<<<<<<<<<
 *     # see whether we have siblings to deallocate
 *     c_next = c_node.prev
*/
    __pyx_r = NULL;
    goto __pyx_L0;

    /* "src/lxml/proxy.pxi":171
 *             return NULL
 *     # see whether we have children to deallocate
 *     if not canDeallocateChildNodes(c_node):             # <<<<<<<<<<<<<<
 *         return NULL
 *     # see whether we have siblings to deallocate
*/
  }

  /* "src/lxml/proxy.pxi":174
 *         return NULL
 *     # see whether we have siblings to deallocate
 *     c_next = c_node.prev             # <<<<<<<<<<<<<<
 *     while c_next:
 *         if _isElement(c_next):
*/
  __pyx_t_2 = __pyx_v_c_node->prev;
  __pyx_v_c_next = __pyx_t_2;

  /* "src/lxml/proxy.pxi":175
 *     # see whether we have siblings to deallocate
 *     c_next = c_node.prev
 *     while c_next:             # <<<<<<<<<<<<<<
 *         if _isElement(c_next):
 *             if hasProxy(c_next) or not canDeallocateChildNodes(c_next):
*/
  while (1) {
    __pyx_t_1 = (__pyx_v_c_next != 0);
    if (!__pyx_t_1) break;

    /* "src/lxml/proxy.pxi":176
 *     c_next = c_node.prev
 *     while c_next:
 *         if _isElement(c_next):             # <<<<<<<<<<<<<<
 *             if hasProxy(c_next) or not canDeallocateChildNodes(c_next):
 *                 return NULL
*/
    __pyx_t_1 = _isElement(__pyx_v_c_next);
    if (__pyx_t_1) {

      /* "src/lxml/proxy.pxi":177
 *     while c_next:
 *         if _isElement(c_next):
 *             if hasProxy(c_next) or not canDeallocateChildNodes(c_next):             # <<<<<<<<<<<<<<
 *                 return NULL
 *         c_next = c_next.prev
*/
      __pyx_t_3 = __pyx_f_4lxml_5etree_hasProxy(__pyx_v_c_next); if (unlikely(__pyx_t_3 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(8, 177, __pyx_L1_error)
      if (!__pyx_t_3) {
      } else {
        __pyx_t_1 = __pyx_t_3;
        goto __pyx_L12_bool_binop_done;
      }
      __pyx_t_3 = (!(__pyx_f_4lxml_5etree_canDeallocateChildNodes(__pyx_v_c_next) != 0));
      __pyx_t_1 = __pyx_t_3;
      __pyx_L12_bool_binop_done:;
      if (__pyx_t_1) {

        /* "src/lxml/proxy.pxi":178
 *         if _isElement(c_next):
 *             if hasProxy(c_next) or not canDeallocateChildNodes(c_next):
 *                 return NULL             # <<<<<<<<<<<<<<
 *         c_next = c_next.prev
 *     c_next = c_node.next
*/
        __pyx_r = NULL;
        goto __pyx_L0;

        /* "src/lxml/proxy.pxi":177
 *     while c_next:
 *         if _isElement(c_next):
 *             if hasProxy(c_next) or not canDeallocateChildNodes(c_next):             # <<<<<<<<<<<<<<
 *                 return NULL
 *         c_next = c_next.prev
*/
      }

      /* "src/lxml/proxy.pxi":176
 *     c_next = c_node.prev
 *     while c_next:
 *         if _isElement(c_next):             # <<<<<<<<<<<<<<
 *             if hasProxy(c_next) or not canDeallocateChildNodes(c_next):
 *                 return NULL
*/
    }

    /* "src/lxml/proxy.pxi":179
 *             if hasProxy(c_next) or not canDeallocateChildNodes(c_next):
 *                 return NULL
 *         c_next = c_next.prev             # <<<<<<<<<<<<<<
 *     c_next = c_node.next
 *     while c_next:
*/
    __pyx_t_2 = __pyx_v_c_next->prev;
    __pyx_v_c_next = __pyx_t_2;
  }

  /* "src/lxml/proxy.pxi":180
 *                 return NULL
 *         c_next = c_next.prev
 *     c_next = c_node.next             # <<<<<<<<<<<<<<
 *     while c_next:
 *         if _isElement(c_next):
*/
  __pyx_t_2 = __pyx_v_c_node->next;
  __pyx_v_c_next = __pyx_t_2;

  /* "src/lxml/proxy.pxi":181
 *         c_next = c_next.prev
 *     c_next = c_node.next
 *     while c_next:             # <<<<<<<<<<<<<<
 *         if _isElement(c_next):
 *             if hasProxy(c_next) or not canDeallocateChildNodes(c_next):
*/
  while (1) {
    __pyx_t_1 = (__pyx_v_c_next != 0);
    if (!__pyx_t_1) break;

    /* "src/lxml/proxy.pxi":182
 *     c_next = c_node.next
 *     while c_next:
 *         if _isElement(c_next):             # <<<<<<<<<<<<<<
 *             if hasProxy(c_next) or not canDeallocateChildNodes(c_next):
 *                 return NULL
*/
    __pyx_t_1 = _isElement(__pyx_v_c_next);
    if (__pyx_t_1) {

      /* "src/lxml/proxy.pxi":183
 *     while c_next:
 *         if _isElement(c_next):
 *             if hasProxy(c_next) or not canDeallocateChildNodes(c_next):             # <<<<<<<<<<<<<<
 *                 return NULL
 *         c_next = c_next.next
*/
      __pyx_t_3 = __pyx_f_4lxml_5etree_hasProxy(__pyx_v_c_next); if (unlikely(__pyx_t_3 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(8, 183, __pyx_L1_error)
      if (!__pyx_t_3) {
      } else {
        __pyx_t_1 = __pyx_t_3;
        goto __pyx_L18_bool_binop_done;
      }
      __pyx_t_3 = (!(__pyx_f_4lxml_5etree_canDeallocateChildNodes(__pyx_v_c_next) != 0));
      __pyx_t_1 = __pyx_t_3;
      __pyx_L18_bool_binop_done:;
      if (__pyx_t_1) {

        /* "src/lxml/proxy.pxi":184
 *         if _isElement(c_next):
 *             if hasProxy(c_next) or not canDeallocateChildNodes(c_next):
 *                 return NULL             # <<<<<<<<<<<<<<
 *         c_next = c_next.next
 *     return c_node
*/
        __pyx_r = NULL;
        goto __pyx_L0;

        /* "src/lxml/proxy.pxi":183
 *     while c_next:
 *         if _isElement(c_next):
 *             if hasProxy(c_next) or not canDeallocateChildNodes(c_next):             # <<<<<<<<<<<<<<
 *                 return NULL
 *         c_next = c_next.next
*/
      }

      /* "src/lxml/proxy.pxi":182
 *     c_next = c_node.next
 *     while c_next:
 *         if _isElement(c_next):             # <<<<<<<<<<<<<<
 *             if hasProxy(c_next) or not canDeallocateChildNodes(c_next):
 *                 return NULL
*/
    }

    /* "src/lxml/proxy.pxi":185
 *             if hasProxy(c_next) or not canDeallocateChildNodes(c_next):
 *                 return NULL
 *         c_next = c_next.next             # <<<<<<<<<<<<<<
 *     return c_node
 * 
*/
    __pyx_t_2 = __pyx_v_c_next->next;
    __pyx_v_c_next = __pyx_t_2;
  }

  /* "src/lxml/proxy.pxi":186
 *                 return NULL
 *         c_next = c_next.next
 *     return c_node             # <<<<<<<<<<<<<<
 * 
 * cdef int canDeallocateChildNodes(xmlNode* c_parent) noexcept:
*/
  __pyx_r = __pyx_v_c_node;
  goto __pyx_L0;

  /* "src/lxml/proxy.pxi":151
 *     return 0
 * 
 * cdef xmlNode* getDeallocationTop(xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *     """Return the top of the tree that can be deallocated, or NULL.
 *     """
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("lxml.etree.getDeallocationTop", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/proxy.pxi":188
 *     return c_node
 * 
 * cdef int canDeallocateChildNodes(xmlNode* c_parent) noexcept:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     c_node = c_parent.children
*/

static int __pyx_f_4lxml_5etree_canDeallocateChildNodes(xmlNode *__pyx_v_c_parent) {
  xmlNode *__pyx_v_c_node;
  int __pyx_r;
  xmlNode *__pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/proxy.pxi":190
 * cdef int canDeallocateChildNodes(xmlNode* c_parent) noexcept:
 *     cdef xmlNode* c_node
 *     c_node = c_parent.children             # <<<<<<<<<<<<<<
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_parent, c_node, 1)
 *     if hasProxy(c_node):
*/
  __pyx_t_1 = __pyx_v_c_parent->children;
  __pyx_v_c_node = __pyx_t_1;

  /* "src/lxml/proxy.pxi":191
 *     cdef xmlNode* c_node
 *     c_node = c_parent.children
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_parent, c_node, 1)             # <<<<<<<<<<<<<<
 *     if hasProxy(c_node):
 *         return 0
*/
  BEGIN_FOR_EACH_ELEMENT_FROM(__pyx_v_c_parent, __pyx_v_c_node, 1);

  /* "src/lxml/proxy.pxi":192
 *     c_node = c_parent.children
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_parent, c_node, 1)
 *     if hasProxy(c_node):             # <<<<<<<<<<<<<<
 *         return 0
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)
*/
  __pyx_t_2 = __pyx_f_4lxml_5etree_hasProxy(__pyx_v_c_node); if (unlikely(__pyx_t_2 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(8, 192, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "src/lxml/proxy.pxi":193
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_parent, c_node, 1)
 *     if hasProxy(c_node):
 *         return 0             # <<<<<<<<<<<<<<
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 *     return 1
*/
    __pyx_r = 0;
    goto __pyx_L0;

    /* "src/lxml/proxy.pxi":192
 *     c_node = c_parent.children
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_parent, c_node, 1)
 *     if hasProxy(c_node):             # <<<<<<<<<<<<<<
 *         return 0
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)
*/
  }

  /* "src/lxml/proxy.pxi":194
 *     if hasProxy(c_node):
 *         return 0
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)             # <<<<<<<<<<<<<<
 *     return 1
 * 
*/
  END_FOR_EACH_ELEMENT_FROM(__pyx_v_c_node);

  /* "src/lxml/proxy.pxi":195
 *         return 0
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 *     return 1             # <<<<<<<<<<<<<<
 * 
 * ################################################################################
*/
  __pyx_r = 1;
  goto __pyx_L0;

  /* "src/lxml/proxy.pxi":188
 *     return c_node
 * 
 * cdef int canDeallocateChildNodes(xmlNode* c_parent) noexcept:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     c_node = c_parent.children
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("lxml.etree.canDeallocateChildNodes", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/proxy.pxi":200
 * # fix _Document references and namespaces when a node changes documents
 * 
 * cdef void _copyParentNamespaces(xmlNode* c_from_node, xmlNode* c_to_node) noexcept nogil:             # <<<<<<<<<<<<<<
 *     """Copy the namespaces of all ancestors of c_from_node to c_to_node.
 *     """
*/

static void __pyx_f_4lxml_5etree__copyParentNamespaces(xmlNode *__pyx_v_c_from_node, xmlNode *__pyx_v_c_to_node) {
  xmlNode *__pyx_v_c_parent;
  xmlNs *__pyx_v_c_new_ns;
  xmlNode *__pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  xmlNs *__pyx_t_4;

  /* "src/lxml/proxy.pxi":207
 *     cdef xmlNs* c_new_ns
 *     cdef int prefix_known
 *     c_parent = c_from_node.parent             # <<<<<<<<<<<<<<
 *     while c_parent and (tree._isElementOrXInclude(c_parent) or
 *                         c_parent.type == tree.XML_DOCUMENT_NODE):
*/
  __pyx_t_1 = __pyx_v_c_from_node->parent;
  __pyx_v_c_parent = __pyx_t_1;

  /* "src/lxml/proxy.pxi":208
 *     cdef int prefix_known
 *     c_parent = c_from_node.parent
 *     while c_parent and (tree._isElementOrXInclude(c_parent) or             # <<<<<<<<<<<<<<
 *                         c_parent.type == tree.XML_DOCUMENT_NODE):
 *         c_new_ns = c_parent.nsDef
*/
  while (1) {
    __pyx_t_3 = (__pyx_v_c_parent != 0);
    if (__pyx_t_3) {
    } else {
      __pyx_t_2 = __pyx_t_3;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_3 = _isElementOrXInclude(__pyx_v_c_parent);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_2 = __pyx_t_3;
      goto __pyx_L5_bool_binop_done;
    }

    /* "src/lxml/proxy.pxi":209
 *     c_parent = c_from_node.parent
 *     while c_parent and (tree._isElementOrXInclude(c_parent) or
 *                         c_parent.type == tree.XML_DOCUMENT_NODE):             # <<<<<<<<<<<<<<
 *         c_new_ns = c_parent.nsDef
 *         while c_new_ns:
*/
    __pyx_t_3 = (__pyx_v_c_parent->type == XML_DOCUMENT_NODE);
    __pyx_t_2 = __pyx_t_3;
    __pyx_L5_bool_binop_done:;
    if (!__pyx_t_2) break;

    /* "src/lxml/proxy.pxi":210
 *     while c_parent and (tree._isElementOrXInclude(c_parent) or
 *                         c_parent.type == tree.XML_DOCUMENT_NODE):
 *         c_new_ns = c_parent.nsDef             # <<<<<<<<<<<<<<
 *         while c_new_ns:
 *             # libxml2 will check if the prefix is already defined
*/
    __pyx_t_4 = __pyx_v_c_parent->nsDef;
    __pyx_v_c_new_ns = __pyx_t_4;

    /* "src/lxml/proxy.pxi":211
 *                         c_parent.type == tree.XML_DOCUMENT_NODE):
 *         c_new_ns = c_parent.nsDef
 *         while c_new_ns:             # <<<<<<<<<<<<<<
 *             # libxml2 will check if the prefix is already defined
 *             tree.xmlNewNs(c_to_node, c_new_ns.href, c_new_ns.prefix)
*/
    while (1) {
      __pyx_t_2 = (__pyx_v_c_new_ns != 0);
      if (!__pyx_t_2) break;

      /* "src/lxml/proxy.pxi":213
 *         while c_new_ns:
 *             # libxml2 will check if the prefix is already defined
 *             tree.xmlNewNs(c_to_node, c_new_ns.href, c_new_ns.prefix)             # <<<<<<<<<<<<<<
 *             c_new_ns = c_new_ns.next
 *         c_parent = c_parent.parent
*/
      (void)(xmlNewNs(__pyx_v_c_to_node, __pyx_v_c_new_ns->href, __pyx_v_c_new_ns->prefix));

      /* "src/lxml/proxy.pxi":214
 *             # libxml2 will check if the prefix is already defined
 *             tree.xmlNewNs(c_to_node, c_new_ns.href, c_new_ns.prefix)
 *             c_new_ns = c_new_ns.next             # <<<<<<<<<<<<<<
 *         c_parent = c_parent.parent
 * 
*/
      __pyx_t_4 = __pyx_v_c_new_ns->next;
      __pyx_v_c_new_ns = __pyx_t_4;
    }

    /* "src/lxml/proxy.pxi":215
 *             tree.xmlNewNs(c_to_node, c_new_ns.href, c_new_ns.prefix)
 *             c_new_ns = c_new_ns.next
 *         c_parent = c_parent.parent             # <<<<<<<<<<<<<<
 * 
 * 
*/
    __pyx_t_1 = __pyx_v_c_parent->parent;
    __pyx_v_c_parent = __pyx_t_1;
  }

  /* "src/lxml/proxy.pxi":200
 * # fix _Document references and namespaces when a node changes documents
 * 
 * cdef void _copyParentNamespaces(xmlNode* c_from_node, xmlNode* c_to_node) noexcept nogil:             # <<<<<<<<<<<<<<
 *     """Copy the namespaces of all ancestors of c_from_node to c_to_node.
 *     """
*/

  /* function exit code */
}

/* "src/lxml/proxy.pxi":229
 * 
 * 
 * cdef int _growNsCache(_nscache* c_ns_cache) except -1:             # <<<<<<<<<<<<<<
 *     cdef _ns_update_map* ns_map_ptr
 *     if c_ns_cache.size == 0:
*/

static int __pyx_f_4lxml_5etree__growNsCache(__pyx_t_4lxml_5etree__nscache *__pyx_v_c_ns_cache) {
  __pyx_t_4lxml_5etree__ns_update_map *__pyx_v_ns_map_ptr;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/proxy.pxi":231
 * cdef int _growNsCache(_nscache* c_ns_cache) except -1:
 *     cdef _ns_update_map* ns_map_ptr
 *     if c_ns_cache.size == 0:             # <<<<<<<<<<<<<<
 *         c_ns_cache.size = 20
 *     else:
*/
  __pyx_t_1 = (__pyx_v_c_ns_cache->size == 0);
  if (__pyx_t_1) {

    /* "src/lxml/proxy.pxi":232
 *     cdef _ns_update_map* ns_map_ptr
 *     if c_ns_cache.size == 0:
 *         c_ns_cache.size = 20             # <<<<<<<<<<<<<<
 *     else:
 *         c_ns_cache.size *= 2
*/
    __pyx_v_c_ns_cache->size = 20;

    /* "src/lxml/proxy.pxi":231
 * cdef int _growNsCache(_nscache* c_ns_cache) except -1:
 *     cdef _ns_update_map* ns_map_ptr
 *     if c_ns_cache.size == 0:             # <<<<<<<<<<<<<<
 *         c_ns_cache.size = 20
 *     else:
*/
    goto __pyx_L3;
  }

  /* "src/lxml/proxy.pxi":234
 *         c_ns_cache.size = 20
 *     else:
 *         c_ns_cache.size *= 2             # <<<<<<<<<<<<<<
 *     ns_map_ptr = <_ns_update_map*> python.lxml_realloc(
 *         c_ns_cache.ns_map, c_ns_cache.size, sizeof(_ns_update_map))
*/
  /*else*/ {
    __pyx_v_c_ns_cache->size = (__pyx_v_c_ns_cache->size * 2);
  }
  __pyx_L3:;

  /* "src/lxml/proxy.pxi":235
 *     else:
 *         c_ns_cache.size *= 2
 *     ns_map_ptr = <_ns_update_map*> python.lxml_realloc(             # <<<<<<<<<<<<<<
 *         c_ns_cache.ns_map, c_ns_cache.size, sizeof(_ns_update_map))
 *     if not ns_map_ptr:
*/
  __pyx_v_ns_map_ptr = ((__pyx_t_4lxml_5etree__ns_update_map *)lxml_realloc(__pyx_v_c_ns_cache->ns_map, __pyx_v_c_ns_cache->size, (sizeof(__pyx_t_4lxml_5etree__ns_update_map))));

  /* "src/lxml/proxy.pxi":237
 *     ns_map_ptr = <_ns_update_map*> python.lxml_realloc(
 *         c_ns_cache.ns_map, c_ns_cache.size, sizeof(_ns_update_map))
 *     if not ns_map_ptr:             # <<<<<<<<<<<<<<
 *         python.lxml_free(c_ns_cache.ns_map)
 *         c_ns_cache.ns_map = NULL
*/
  __pyx_t_1 = (!(__pyx_v_ns_map_ptr != 0));
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/proxy.pxi":238
 *         c_ns_cache.ns_map, c_ns_cache.size, sizeof(_ns_update_map))
 *     if not ns_map_ptr:
 *         python.lxml_free(c_ns_cache.ns_map)             # <<<<<<<<<<<<<<
 *         c_ns_cache.ns_map = NULL
 *         raise MemoryError()
*/
    lxml_free(__pyx_v_c_ns_cache->ns_map);

    /* "src/lxml/proxy.pxi":239
 *     if not ns_map_ptr:
 *         python.lxml_free(c_ns_cache.ns_map)
 *         c_ns_cache.ns_map = NULL             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     c_ns_cache.ns_map = ns_map_ptr
*/
    __pyx_v_c_ns_cache->ns_map = NULL;

    /* "src/lxml/proxy.pxi":240
 *         python.lxml_free(c_ns_cache.ns_map)
 *         c_ns_cache.ns_map = NULL
 *         raise MemoryError()             # <<<<<<<<<<<<<<
 *     c_ns_cache.ns_map = ns_map_ptr
 *     return 0
*/
    PyErr_NoMemory(); __PYX_ERR(8, 240, __pyx_L1_error)

    /* "src/lxml/proxy.pxi":237
 *     ns_map_ptr = <_ns_update_map*> python.lxml_realloc(
 *         c_ns_cache.ns_map, c_ns_cache.size, sizeof(_ns_update_map))
 *     if not ns_map_ptr:             # <<<<<<<<<<<<<<
 *         python.lxml_free(c_ns_cache.ns_map)
 *         c_ns_cache.ns_map = NULL
*/
  }

  /* "src/lxml/proxy.pxi":241
 *         c_ns_cache.ns_map = NULL
 *         raise MemoryError()
 *     c_ns_cache.ns_map = ns_map_ptr             # <<<<<<<<<<<<<<
 *     return 0
 * 
*/
  __pyx_v_c_ns_cache->ns_map = __pyx_v_ns_map_ptr;

  /* "src/lxml/proxy.pxi":242
 *         raise MemoryError()
 *     c_ns_cache.ns_map = ns_map_ptr
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/proxy.pxi":229
 * 
 * 
 * cdef int _growNsCache(_nscache* c_ns_cache) except -1:             # <<<<<<<<<<<<<<
 *     cdef _ns_update_map* ns_map_ptr
 *     if c_ns_cache.size == 0:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._growNsCache", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/proxy.pxi":245
 * 
 * 
 * cdef inline int _appendToNsCache(_nscache* c_ns_cache,             # <<<<<<<<<<<<<<
 *                                  xmlNs* c_old_ns, xmlNs* c_new_ns) except -1:
 *     if c_ns_cache.last >= c_ns_cache.size:
*/

static CYTHON_INLINE int __pyx_f_4lxml_5etree__appendToNsCache(__pyx_t_4lxml_5etree__nscache *__pyx_v_c_ns_cache, xmlNs *__pyx_v_c_old_ns, xmlNs *__pyx_v_c_new_ns) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  __pyx_t_4lxml_5etree__ns_update_map __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/proxy.pxi":247
 * cdef inline int _appendToNsCache(_nscache* c_ns_cache,
 *                                  xmlNs* c_old_ns, xmlNs* c_new_ns) except -1:
 *     if c_ns_cache.last >= c_ns_cache.size:             # <<<<<<<<<<<<<<
 *         _growNsCache(c_ns_cache)
 *     c_ns_cache.ns_map[c_ns_cache.last] = _ns_update_map(old=c_old_ns, new=c_new_ns)
*/
  __pyx_t_1 = (__pyx_v_c_ns_cache->last >= __pyx_v_c_ns_cache->size);
  if (__pyx_t_1) {

    /* "src/lxml/proxy.pxi":248
 *                                  xmlNs* c_old_ns, xmlNs* c_new_ns) except -1:
 *     if c_ns_cache.last >= c_ns_cache.size:
 *         _growNsCache(c_ns_cache)             # <<<<<<<<<<<<<<
 *     c_ns_cache.ns_map[c_ns_cache.last] = _ns_update_map(old=c_old_ns, new=c_new_ns)
 *     c_ns_cache.last += 1
*/
    __pyx_t_2 = __pyx_f_4lxml_5etree__growNsCache(__pyx_v_c_ns_cache); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(8, 248, __pyx_L1_error)

    /* "src/lxml/proxy.pxi":247
 * cdef inline int _appendToNsCache(_nscache* c_ns_cache,
 *                                  xmlNs* c_old_ns, xmlNs* c_new_ns) except -1:
 *     if c_ns_cache.last >= c_ns_cache.size:             # <<<<<<<<<<<<<<
 *         _growNsCache(c_ns_cache)
 *     c_ns_cache.ns_map[c_ns_cache.last] = _ns_update_map(old=c_old_ns, new=c_new_ns)
*/
  }

  /* "src/lxml/proxy.pxi":249
 *     if c_ns_cache.last >= c_ns_cache.size:
 *         _growNsCache(c_ns_cache)
 *     c_ns_cache.ns_map[c_ns_cache.last] = _ns_update_map(old=c_old_ns, new=c_new_ns)             # <<<<<<<<<<<<<<
 *     c_ns_cache.last += 1
 * 
*/
  __pyx_t_3.old = __pyx_v_c_old_ns;
  __pyx_t_3.__pyx_new = __pyx_v_c_new_ns;
  (__pyx_v_c_ns_cache->ns_map[__pyx_v_c_ns_cache->last]) = __pyx_t_3;

  /* "src/lxml/proxy.pxi":250
 *         _growNsCache(c_ns_cache)
 *     c_ns_cache.ns_map[c_ns_cache.last] = _ns_update_map(old=c_old_ns, new=c_new_ns)
 *     c_ns_cache.last += 1             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_v_c_ns_cache->last = (__pyx_v_c_ns_cache->last + 1);

  /* "src/lxml/proxy.pxi":245
 * 
 * 
 * cdef inline int _appendToNsCache(_nscache* c_ns_cache,             # <<<<<<<<<<<<<<
 *                                  xmlNs* c_old_ns, xmlNs* c_new_ns) except -1:
 *     if c_ns_cache.last >= c_ns_cache.size:
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._appendToNsCache", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/proxy.pxi":253
 * 
 * 
 * cdef int _stripRedundantNamespaceDeclarations(xmlNode* c_element, _nscache* c_ns_cache,             # <<<<<<<<<<<<<<
 *                                               xmlNs** c_del_ns_list) except -1:
 *     """Removes namespace declarations from an element that are already
*/

static int __pyx_f_4lxml_5etree__stripRedundantNamespaceDeclarations(xmlNode *__pyx_v_c_element, __pyx_t_4lxml_5etree__nscache *__pyx_v_c_ns_cache, xmlNs **__pyx_v_c_del_ns_list) {
  xmlNs *__pyx_v_c_ns;
  xmlNs *__pyx_v_c_ns_next;
  xmlNs **__pyx_v_c_nsdef;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  xmlNs *__pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/proxy.pxi":263
 *     cdef xmlNs** c_nsdef
 *     # use a xmlNs** to handle assignments to "c_element.nsDef" correctly
 *     c_nsdef = &c_element.nsDef             # <<<<<<<<<<<<<<
 *     while c_nsdef[0] is not NULL:
 *         c_ns = tree.xmlSearchNsByHref(
*/
  __pyx_v_c_nsdef = (&__pyx_v_c_element->nsDef);

  /* "src/lxml/proxy.pxi":264
 *     # use a xmlNs** to handle assignments to "c_element.nsDef" correctly
 *     c_nsdef = &c_element.nsDef
 *     while c_nsdef[0] is not NULL:             # <<<<<<<<<<<<<<
 *         c_ns = tree.xmlSearchNsByHref(
 *             c_element.doc, c_element.parent, c_nsdef[0].href)
*/
  while (1) {
    __pyx_t_1 = ((__pyx_v_c_nsdef[0]) != NULL);
    if (!__pyx_t_1) break;

    /* "src/lxml/proxy.pxi":265
 *     c_nsdef = &c_element.nsDef
 *     while c_nsdef[0] is not NULL:
 *         c_ns = tree.xmlSearchNsByHref(             # <<<<<<<<<<<<<<
 *             c_element.doc, c_element.parent, c_nsdef[0].href)
 *         if c_ns is NULL:
*/
    __pyx_v_c_ns = xmlSearchNsByHref(__pyx_v_c_element->doc, __pyx_v_c_element->parent, (__pyx_v_c_nsdef[0])->href);

    /* "src/lxml/proxy.pxi":267
 *         c_ns = tree.xmlSearchNsByHref(
 *             c_element.doc, c_element.parent, c_nsdef[0].href)
 *         if c_ns is NULL:             # <<<<<<<<<<<<<<
 *             # new namespace href => keep and cache the ns declaration
 *             _appendToNsCache(c_ns_cache, c_nsdef[0], c_nsdef[0])
*/
    __pyx_t_1 = (__pyx_v_c_ns == NULL);
    if (__pyx_t_1) {

      /* "src/lxml/proxy.pxi":269
 *         if c_ns is NULL:
 *             # new namespace href => keep and cache the ns declaration
 *             _appendToNsCache(c_ns_cache, c_nsdef[0], c_nsdef[0])             # <<<<<<<<<<<<<<
 *             c_nsdef = &c_nsdef[0].next
 *         else:
*/
      __pyx_t_2 = __pyx_f_4lxml_5etree__appendToNsCache(__pyx_v_c_ns_cache, (__pyx_v_c_nsdef[0]), (__pyx_v_c_nsdef[0])); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(8, 269, __pyx_L1_error)

      /* "src/lxml/proxy.pxi":270
 *             # new namespace href => keep and cache the ns declaration
 *             _appendToNsCache(c_ns_cache, c_nsdef[0], c_nsdef[0])
 *             c_nsdef = &c_nsdef[0].next             # <<<<<<<<<<<<<<
 *         else:
 *             # known namespace href => cache mapping and strip old ns
*/
      __pyx_v_c_nsdef = (&(__pyx_v_c_nsdef[0])->next);

      /* "src/lxml/proxy.pxi":267
 *         c_ns = tree.xmlSearchNsByHref(
 *             c_element.doc, c_element.parent, c_nsdef[0].href)
 *         if c_ns is NULL:             # <<<<<<<<<<<<<<
 *             # new namespace href => keep and cache the ns declaration
 *             _appendToNsCache(c_ns_cache, c_nsdef[0], c_nsdef[0])
*/
      goto __pyx_L5;
    }

    /* "src/lxml/proxy.pxi":273
 *         else:
 *             # known namespace href => cache mapping and strip old ns
 *             _appendToNsCache(c_ns_cache, c_nsdef[0], c_ns)             # <<<<<<<<<<<<<<
 *             # cut out c_nsdef.next and prepend it to garbage chain
 *             c_ns_next = c_nsdef[0].next
*/
    /*else*/ {
      __pyx_t_2 = __pyx_f_4lxml_5etree__appendToNsCache(__pyx_v_c_ns_cache, (__pyx_v_c_nsdef[0]), __pyx_v_c_ns); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(8, 273, __pyx_L1_error)

      /* "src/lxml/proxy.pxi":275
 *             _appendToNsCache(c_ns_cache, c_nsdef[0], c_ns)
 *             # cut out c_nsdef.next and prepend it to garbage chain
 *             c_ns_next = c_nsdef[0].next             # <<<<<<<<<<<<<<
 *             c_nsdef[0].next = c_del_ns_list[0]
 *             c_del_ns_list[0] = c_nsdef[0]
*/
      __pyx_t_3 = (__pyx_v_c_nsdef[0])->next;
      __pyx_v_c_ns_next = __pyx_t_3;

      /* "src/lxml/proxy.pxi":276
 *             # cut out c_nsdef.next and prepend it to garbage chain
 *             c_ns_next = c_nsdef[0].next
 *             c_nsdef[0].next = c_del_ns_list[0]             # <<<<<<<<<<<<<<
 *             c_del_ns_list[0] = c_nsdef[0]
 *             c_nsdef[0] = c_ns_next
*/
      (__pyx_v_c_nsdef[0])->next = (__pyx_v_c_del_ns_list[0]);

      /* "src/lxml/proxy.pxi":277
 *             c_ns_next = c_nsdef[0].next
 *             c_nsdef[0].next = c_del_ns_list[0]
 *             c_del_ns_list[0] = c_nsdef[0]             # <<<<<<<<<<<<<<
 *             c_nsdef[0] = c_ns_next
 *     return 0
*/
      (__pyx_v_c_del_ns_list[0]) = (__pyx_v_c_nsdef[0]);

      /* "src/lxml/proxy.pxi":278
 *             c_nsdef[0].next = c_del_ns_list[0]
 *             c_del_ns_list[0] = c_nsdef[0]
 *             c_nsdef[0] = c_ns_next             # <<<<<<<<<<<<<<
 *     return 0
 * 
*/
      (__pyx_v_c_nsdef[0]) = __pyx_v_c_ns_next;
    }
    __pyx_L5:;
  }

  /* "src/lxml/proxy.pxi":279
 *             c_del_ns_list[0] = c_nsdef[0]
 *             c_nsdef[0] = c_ns_next
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/proxy.pxi":253
 * 
 * 
 * cdef int _stripRedundantNamespaceDeclarations(xmlNode* c_element, _nscache* c_ns_cache,             # <<<<<<<<<<<<<<
 *                                               xmlNs** c_del_ns_list) except -1:
 *     """Removes namespace declarations from an element that are already
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._stripRedundantNamespaceDeclarations", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/proxy.pxi":282
 * 
 * 
 * cdef void _cleanUpFromNamespaceAdaptation(xmlNode* c_start_node,             # <<<<<<<<<<<<<<
 *                                           _nscache* c_ns_cache, xmlNs* c_del_ns_list) noexcept:
 *     # Try to recover from exceptions with really bad timing.  We were in the middle
*/

static void __pyx_f_4lxml_5etree__cleanUpFromNamespaceAdaptation(xmlNode *__pyx_v_c_start_node, __pyx_t_4lxml_5etree__nscache *__pyx_v_c_ns_cache, xmlNs *__pyx_v_c_del_ns_list) {
  xmlNs *__pyx_v_c_ns;
  int __pyx_t_1;
  xmlNs *__pyx_t_2;

  /* "src/lxml/proxy.pxi":288
 *     # by re-adding the original xmlNs declarations (which might still be used in some
 *     # places).
 *     if c_ns_cache.ns_map:             # <<<<<<<<<<<<<<
 *         python.lxml_free(c_ns_cache.ns_map)
 *     if c_del_ns_list:
*/
  __pyx_t_1 = (__pyx_v_c_ns_cache->ns_map != 0);
  if (__pyx_t_1) {

    /* "src/lxml/proxy.pxi":289
 *     # places).
 *     if c_ns_cache.ns_map:
 *         python.lxml_free(c_ns_cache.ns_map)             # <<<<<<<<<<<<<<
 *     if c_del_ns_list:
 *         if not c_start_node.nsDef:
*/
    lxml_free(__pyx_v_c_ns_cache->ns_map);

    /* "src/lxml/proxy.pxi":288
 *     # by re-adding the original xmlNs declarations (which might still be used in some
 *     # places).
 *     if c_ns_cache.ns_map:             # <<<<<<<<<<<<<<
 *         python.lxml_free(c_ns_cache.ns_map)
 *     if c_del_ns_list:
*/
  }

  /* "src/lxml/proxy.pxi":290
 *     if c_ns_cache.ns_map:
 *         python.lxml_free(c_ns_cache.ns_map)
 *     if c_del_ns_list:             # <<<<<<<<<<<<<<
 *         if not c_start_node.nsDef:
 *             c_start_node.nsDef = c_del_ns_list
*/
  __pyx_t_1 = (__pyx_v_c_del_ns_list != 0);
  if (__pyx_t_1) {

    /* "src/lxml/proxy.pxi":291
 *         python.lxml_free(c_ns_cache.ns_map)
 *     if c_del_ns_list:
 *         if not c_start_node.nsDef:             # <<<<<<<<<<<<<<
 *             c_start_node.nsDef = c_del_ns_list
 *         else:
*/
    __pyx_t_1 = (!(__pyx_v_c_start_node->nsDef != 0));
    if (__pyx_t_1) {

      /* "src/lxml/proxy.pxi":292
 *     if c_del_ns_list:
 *         if not c_start_node.nsDef:
 *             c_start_node.nsDef = c_del_ns_list             # <<<<<<<<<<<<<<
 *         else:
 *             c_ns = c_start_node.nsDef
*/
      __pyx_v_c_start_node->nsDef = __pyx_v_c_del_ns_list;

      /* "src/lxml/proxy.pxi":291
 *         python.lxml_free(c_ns_cache.ns_map)
 *     if c_del_ns_list:
 *         if not c_start_node.nsDef:             # <<<<<<<<<<<<<<
 *             c_start_node.nsDef = c_del_ns_list
 *         else:
*/
      goto __pyx_L5;
    }

    /* "src/lxml/proxy.pxi":294
 *             c_start_node.nsDef = c_del_ns_list
 *         else:
 *             c_ns = c_start_node.nsDef             # <<<<<<<<<<<<<<
 *             while c_ns.next:
 *                 c_ns = c_ns.next
*/
    /*else*/ {
      __pyx_t_2 = __pyx_v_c_start_node->nsDef;
      __pyx_v_c_ns = __pyx_t_2;

      /* "src/lxml/proxy.pxi":295
 *         else:
 *             c_ns = c_start_node.nsDef
 *             while c_ns.next:             # <<<<<<<<<<<<<<
 *                 c_ns = c_ns.next
 *             c_ns.next = c_del_ns_list
*/
      while (1) {
        __pyx_t_1 = (__pyx_v_c_ns->next != 0);
        if (!__pyx_t_1) break;

        /* "src/lxml/proxy.pxi":296
 *             c_ns = c_start_node.nsDef
 *             while c_ns.next:
 *                 c_ns = c_ns.next             # <<<<<<<<<<<<<<
 *             c_ns.next = c_del_ns_list
 * 
*/
        __pyx_t_2 = __pyx_v_c_ns->next;
        __pyx_v_c_ns = __pyx_t_2;
      }

      /* "src/lxml/proxy.pxi":297
 *             while c_ns.next:
 *                 c_ns = c_ns.next
 *             c_ns.next = c_del_ns_list             # <<<<<<<<<<<<<<
 * 
 * 
*/
      __pyx_v_c_ns->next = __pyx_v_c_del_ns_list;
    }
    __pyx_L5:;

    /* "src/lxml/proxy.pxi":290
 *     if c_ns_cache.ns_map:
 *         python.lxml_free(c_ns_cache.ns_map)
 *     if c_del_ns_list:             # <<<<<<<<<<<<<<
 *         if not c_start_node.nsDef:
 *             c_start_node.nsDef = c_del_ns_list
*/
  }

  /* "src/lxml/proxy.pxi":282
 * 
 * 
 * cdef void _cleanUpFromNamespaceAdaptation(xmlNode* c_start_node,             # <<<<<<<<<<<<<<
 *                                           _nscache* c_ns_cache, xmlNs* c_del_ns_list) noexcept:
 *     # Try to recover from exceptions with really bad timing.  We were in the middle
*/

  /* function exit code */
}

/* "src/lxml/proxy.pxi":300
 * 
 * 
 * cdef int moveNodeToDocument(_Document doc, xmlDoc* c_source_doc,             # <<<<<<<<<<<<<<
 *                             xmlNode* c_element) except -1:
 *     """Fix the xmlNs pointers of a node and its subtree that were moved.
*/

static int __pyx_f_4lxml_5etree_moveNodeToDocument(struct LxmlDocument *__pyx_v_doc, xmlDoc *__pyx_v_c_source_doc, xmlNode *__pyx_v_c_element) {
  xmlNode *__pyx_v_c_start_node;
  xmlNode *__pyx_v_c_node;
  CYTHON_UNUSED xmlDoc *__pyx_v_c_doc;
  __pyx_t_4lxml_5etree__nscache __pyx_v_c_ns_cache;
  xmlNs *__pyx_v_c_del_ns_list;
  PyObject *__pyx_v_proxy_count = 0;
  struct LxmlElement *__pyx_v_proxy = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  xmlDoc *__pyx_t_1;
  __pyx_t_4lxml_5etree__nscache __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  xmlNode *__pyx_t_11;
  int __pyx_t_12;
  size_t __pyx_t_13;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("moveNodeToDocument", 0);

  /* "src/lxml/proxy.pxi":333
 *     cdef xmlNode* c_start_node
 *     cdef xmlNode* c_node
 *     cdef xmlDoc* c_doc = doc._c_doc             # <<<<<<<<<<<<<<
 *     cdef tree.xmlAttr* c_attr
 *     cdef char* c_name
*/
  __pyx_t_1 = __pyx_v_doc->_c_doc;
  __pyx_v_c_doc = __pyx_t_1;

  /* "src/lxml/proxy.pxi":336
 *     cdef tree.xmlAttr* c_attr
 *     cdef char* c_name
 *     cdef _nscache c_ns_cache = [NULL, 0, 0]             # <<<<<<<<<<<<<<
 *     cdef xmlNs* c_del_ns_list = NULL
 *     cdef proxy_count = 0
*/
  __pyx_t_2.ns_map = NULL;
  __pyx_t_2.size = 0;
  __pyx_t_2.last = 0;
  __pyx_v_c_ns_cache = __pyx_t_2;

  /* "src/lxml/proxy.pxi":337
 *     cdef char* c_name
 *     cdef _nscache c_ns_cache = [NULL, 0, 0]
 *     cdef xmlNs* c_del_ns_list = NULL             # <<<<<<<<<<<<<<
 *     cdef proxy_count = 0
 * 
*/
  __pyx_v_c_del_ns_list = NULL;

  /* "src/lxml/proxy.pxi":338
 *     cdef _nscache c_ns_cache = [NULL, 0, 0]
 *     cdef xmlNs* c_del_ns_list = NULL
 *     cdef proxy_count = 0             # <<<<<<<<<<<<<<
 * 
 *     if not tree._isElementOrXInclude(c_element):
*/
  __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0);
  __pyx_v_proxy_count = __pyx_mstate_global->__pyx_int_0;

  /* "src/lxml/proxy.pxi":340
 *     cdef proxy_count = 0
 * 
 *     if not tree._isElementOrXInclude(c_element):             # <<<<<<<<<<<<<<
 *         return 0
 * 
*/
  __pyx_t_3 = (!_isElementOrXInclude(__pyx_v_c_element));
  if (__pyx_t_3) {

    /* "src/lxml/proxy.pxi":341
 * 
 *     if not tree._isElementOrXInclude(c_element):
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     c_start_node = c_element
*/
    __pyx_r = 0;
    goto __pyx_L0;

    /* "src/lxml/proxy.pxi":340
 *     cdef proxy_count = 0
 * 
 *     if not tree._isElementOrXInclude(c_element):             # <<<<<<<<<<<<<<
 *         return 0
 * 
*/
  }

  /* "src/lxml/proxy.pxi":343
 *         return 0
 * 
 *     c_start_node = c_element             # <<<<<<<<<<<<<<
 * 
 *     tree.BEGIN_FOR_EACH_FROM(c_element, c_element, 1)
*/
  __pyx_v_c_start_node = __pyx_v_c_element;

  /* "src/lxml/proxy.pxi":345
 *     c_start_node = c_element
 * 
 *     tree.BEGIN_FOR_EACH_FROM(c_element, c_element, 1)             # <<<<<<<<<<<<<<
 *     if tree._isElementOrXInclude(c_element):
 *         if hasProxy(c_element):
*/
  BEGIN_FOR_EACH_FROM(__pyx_v_c_element, __pyx_v_c_element, 1);

  /* "src/lxml/proxy.pxi":346
 * 
 *     tree.BEGIN_FOR_EACH_FROM(c_element, c_element, 1)
 *     if tree._isElementOrXInclude(c_element):             # <<<<<<<<<<<<<<
 *         if hasProxy(c_element):
 *             proxy_count += 1
*/
  __pyx_t_3 = _isElementOrXInclude(__pyx_v_c_element);
  if (__pyx_t_3) {

    /* "src/lxml/proxy.pxi":347
 *     tree.BEGIN_FOR_EACH_FROM(c_element, c_element, 1)
 *     if tree._isElementOrXInclude(c_element):
 *         if hasProxy(c_element):             # <<<<<<<<<<<<<<
 *             proxy_count += 1
 * 
*/
    __pyx_t_3 = __pyx_f_4lxml_5etree_hasProxy(__pyx_v_c_element); if (unlikely(__pyx_t_3 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(8, 347, __pyx_L1_error)
    if (__pyx_t_3) {

      /* "src/lxml/proxy.pxi":348
 *     if tree._isElementOrXInclude(c_element):
 *         if hasProxy(c_element):
 *             proxy_count += 1             # <<<<<<<<<<<<<<
 * 
 *         # 1) cut out namespaces defined here that are already known by
*/
      __pyx_t_4 = __Pyx_PyLong_AddObjC(__pyx_v_proxy_count, __pyx_mstate_global->__pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(8, 348, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF_SET(__pyx_v_proxy_count, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "src/lxml/proxy.pxi":347
 *     tree.BEGIN_FOR_EACH_FROM(c_element, c_element, 1)
 *     if tree._isElementOrXInclude(c_element):
 *         if hasProxy(c_element):             # <<<<<<<<<<<<<<
 *             proxy_count += 1
 * 
*/
    }

    /* "src/lxml/proxy.pxi":352
 *         # 1) cut out namespaces defined here that are already known by
 *         #    the ancestors
 *         if c_element.nsDef is not NULL:             # <<<<<<<<<<<<<<
 *             try:
 *                 _stripRedundantNamespaceDeclarations(c_element, &c_ns_cache, &c_del_ns_list)
*/
    __pyx_t_3 = (__pyx_v_c_element->nsDef != NULL);
    if (__pyx_t_3) {

      /* "src/lxml/proxy.pxi":353
 *         #    the ancestors
 *         if c_element.nsDef is not NULL:
 *             try:             # <<<<<<<<<<<<<<
 *                 _stripRedundantNamespaceDeclarations(c_element, &c_ns_cache, &c_del_ns_list)
 *             except:
*/
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_5);
        __Pyx_XGOTREF(__pyx_t_6);
        __Pyx_XGOTREF(__pyx_t_7);
        /*try:*/ {

          /* "src/lxml/proxy.pxi":354
 *         if c_element.nsDef is not NULL:
 *             try:
 *                 _stripRedundantNamespaceDeclarations(c_element, &c_ns_cache, &c_del_ns_list)             # <<<<<<<<<<<<<<
 *             except:
 *                 _cleanUpFromNamespaceAdaptation(c_start_node, &c_ns_cache, c_del_ns_list)
*/
          __pyx_t_8 = __pyx_f_4lxml_5etree__stripRedundantNamespaceDeclarations(__pyx_v_c_element, (&__pyx_v_c_ns_cache), (&__pyx_v_c_del_ns_list)); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(8, 354, __pyx_L7_error)

          /* "src/lxml/proxy.pxi":353
 *         #    the ancestors
 *         if c_element.nsDef is not NULL:
 *             try:             # <<<<<<<<<<<<<<
 *                 _stripRedundantNamespaceDeclarations(c_element, &c_ns_cache, &c_del_ns_list)
 *             except:
*/
        }
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        goto __pyx_L12_try_end;
        __pyx_L7_error:;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

        /* "src/lxml/proxy.pxi":355
 *             try:
 *                 _stripRedundantNamespaceDeclarations(c_element, &c_ns_cache, &c_del_ns_list)
 *             except:             # <<<<<<<<<<<<<<
 *                 _cleanUpFromNamespaceAdaptation(c_start_node, &c_ns_cache, c_del_ns_list)
 *                 raise
*/
        /*except:*/ {
          __Pyx_AddTraceback("lxml.etree.moveNodeToDocument", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_9, &__pyx_t_10) < 0) __PYX_ERR(8, 355, __pyx_L9_except_error)
          __Pyx_XGOTREF(__pyx_t_4);
          __Pyx_XGOTREF(__pyx_t_9);
          __Pyx_XGOTREF(__pyx_t_10);

          /* "src/lxml/proxy.pxi":356
 *                 _stripRedundantNamespaceDeclarations(c_element, &c_ns_cache, &c_del_ns_list)
 *             except:
 *                 _cleanUpFromNamespaceAdaptation(c_start_node, &c_ns_cache, c_del_ns_list)             # <<<<<<<<<<<<<<
 *                 raise
 * 
*/
          __pyx_f_4lxml_5etree__cleanUpFromNamespaceAdaptation(__pyx_v_c_start_node, (&__pyx_v_c_ns_cache), __pyx_v_c_del_ns_list);

          /* "src/lxml/proxy.pxi":357
 *             except:
 *                 _cleanUpFromNamespaceAdaptation(c_start_node, &c_ns_cache, c_del_ns_list)
 *                 raise             # <<<<<<<<<<<<<<
 * 
 *         # 2) make sure the namespaces of an element and its attributes
*/
          __Pyx_GIVEREF(__pyx_t_4);
          __Pyx_GIVEREF(__pyx_t_9);
          __Pyx_XGIVEREF(__pyx_t_10);
          __Pyx_ErrRestoreWithState(__pyx_t_4, __pyx_t_9, __pyx_t_10);
          __pyx_t_4 = 0;  __pyx_t_9 = 0;  __pyx_t_10 = 0; 
          __PYX_ERR(8, 357, __pyx_L9_except_error)
        }

        /* "src/lxml/proxy.pxi":353
 *         #    the ancestors
 *         if c_element.nsDef is not NULL:
 *             try:             # <<<<<<<<<<<<<<
 *                 _stripRedundantNamespaceDeclarations(c_element, &c_ns_cache, &c_del_ns_list)
 *             except:
*/
        __pyx_L9_except_error:;
        __Pyx_XGIVEREF(__pyx_t_5);
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
        goto __pyx_L1_error;
        __pyx_L12_try_end:;
      }

      /* "src/lxml/proxy.pxi":352
 *         # 1) cut out namespaces defined here that are already known by
 *         #    the ancestors
 *         if c_element.nsDef is not NULL:             # <<<<<<<<<<<<<<
 *             try:
 *                 _stripRedundantNamespaceDeclarations(c_element, &c_ns_cache, &c_del_ns_list)
*/
    }

    /* "src/lxml/proxy.pxi":361
 *         # 2) make sure the namespaces of an element and its attributes
 *         #    are declared in this document (i.e. on the node or its parents)
 *         if c_element.ns is not NULL:             # <<<<<<<<<<<<<<
 *             _fixCNs(doc, c_start_node, c_element, &c_ns_cache, c_del_ns_list)
 * 
*/
    __pyx_t_3 = (__pyx_v_c_element->ns != NULL);
    if (__pyx_t_3) {

      /* "src/lxml/proxy.pxi":362
 *         #    are declared in this document (i.e. on the node or its parents)
 *         if c_element.ns is not NULL:
 *             _fixCNs(doc, c_start_node, c_element, &c_ns_cache, c_del_ns_list)             # <<<<<<<<<<<<<<
 * 
 *         c_node = <xmlNode*>c_element.properties
*/
      __pyx_t_8 = __pyx_f_4lxml_5etree__fixCNs(__pyx_v_doc, __pyx_v_c_start_node, __pyx_v_c_element, (&__pyx_v_c_ns_cache), __pyx_v_c_del_ns_list); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(8, 362, __pyx_L1_error)

      /* "src/lxml/proxy.pxi":361
 *         # 2) make sure the namespaces of an element and its attributes
 *         #    are declared in this document (i.e. on the node or its parents)
 *         if c_element.ns is not NULL:             # <<<<<<<<<<<<<<
 *             _fixCNs(doc, c_start_node, c_element, &c_ns_cache, c_del_ns_list)
 * 
*/
    }

    /* "src/lxml/proxy.pxi":364
 *             _fixCNs(doc, c_start_node, c_element, &c_ns_cache, c_del_ns_list)
 * 
 *         c_node = <xmlNode*>c_element.properties             # <<<<<<<<<<<<<<
 *         while c_node is not NULL:
 *             if c_node.ns is not NULL:
*/
    __pyx_v_c_node = ((xmlNode *)__pyx_v_c_element->properties);

    /* "src/lxml/proxy.pxi":365
 * 
 *         c_node = <xmlNode*>c_element.properties
 *         while c_node is not NULL:             # <<<<<<<<<<<<<<
 *             if c_node.ns is not NULL:
 *                 _fixCNs(doc, c_start_node, c_node, &c_ns_cache, c_del_ns_list)
*/
    while (1) {
      __pyx_t_3 = (__pyx_v_c_node != NULL);
      if (!__pyx_t_3) break;

      /* "src/lxml/proxy.pxi":366
 *         c_node = <xmlNode*>c_element.properties
 *         while c_node is not NULL:
 *             if c_node.ns is not NULL:             # <<<<<<<<<<<<<<
 *                 _fixCNs(doc, c_start_node, c_node, &c_ns_cache, c_del_ns_list)
 *             c_node = c_node.next
*/
      __pyx_t_3 = (__pyx_v_c_node->ns != NULL);
      if (__pyx_t_3) {

        /* "src/lxml/proxy.pxi":367
 *         while c_node is not NULL:
 *             if c_node.ns is not NULL:
 *                 _fixCNs(doc, c_start_node, c_node, &c_ns_cache, c_del_ns_list)             # <<<<<<<<<<<<<<
 *             c_node = c_node.next
 * 
*/
        __pyx_t_8 = __pyx_f_4lxml_5etree__fixCNs(__pyx_v_doc, __pyx_v_c_start_node, __pyx_v_c_node, (&__pyx_v_c_ns_cache), __pyx_v_c_del_ns_list); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(8, 367, __pyx_L1_error)

        /* "src/lxml/proxy.pxi":366
 *         c_node = <xmlNode*>c_element.properties
 *         while c_node is not NULL:
 *             if c_node.ns is not NULL:             # <<<<<<<<<<<<<<
 *                 _fixCNs(doc, c_start_node, c_node, &c_ns_cache, c_del_ns_list)
 *             c_node = c_node.next
*/
      }

      /* "src/lxml/proxy.pxi":368
 *             if c_node.ns is not NULL:
 *                 _fixCNs(doc, c_start_node, c_node, &c_ns_cache, c_del_ns_list)
 *             c_node = c_node.next             # <<<<<<<<<<<<<<
 * 
 *     tree.END_FOR_EACH_FROM(c_element)
*/
      __pyx_t_11 = __pyx_v_c_node->next;
      __pyx_v_c_node = __pyx_t_11;
    }

    /* "src/lxml/proxy.pxi":346
 * 
 *     tree.BEGIN_FOR_EACH_FROM(c_element, c_element, 1)
 *     if tree._isElementOrXInclude(c_element):             # <<<<<<<<<<<<<<
 *         if hasProxy(c_element):
 *             proxy_count += 1
*/
  }

  /* "src/lxml/proxy.pxi":370
 *             c_node = c_node.next
 * 
 *     tree.END_FOR_EACH_FROM(c_element)             # <<<<<<<<<<<<<<
 * 
 *     # free now unused namespace declarations
*/
  END_FOR_EACH_FROM(__pyx_v_c_element);

  /* "src/lxml/proxy.pxi":373
 * 
 *     # free now unused namespace declarations
 *     if c_del_ns_list is not NULL:             # <<<<<<<<<<<<<<
 *         tree.xmlFreeNsList(c_del_ns_list)
 * 
*/
  __pyx_t_3 = (__pyx_v_c_del_ns_list != NULL);
  if (__pyx_t_3) {

    /* "src/lxml/proxy.pxi":374
 *     # free now unused namespace declarations
 *     if c_del_ns_list is not NULL:
 *         tree.xmlFreeNsList(c_del_ns_list)             # <<<<<<<<<<<<<<
 * 
 *     # cleanup
*/
    xmlFreeNsList(__pyx_v_c_del_ns_list);

    /* "src/lxml/proxy.pxi":373
 * 
 *     # free now unused namespace declarations
 *     if c_del_ns_list is not NULL:             # <<<<<<<<<<<<<<
 *         tree.xmlFreeNsList(c_del_ns_list)
 * 
*/
  }

  /* "src/lxml/proxy.pxi":377
 * 
 *     # cleanup
 *     if c_ns_cache.ns_map is not NULL:             # <<<<<<<<<<<<<<
 *         python.lxml_free(c_ns_cache.ns_map)
 * 
*/
  __pyx_t_3 = (__pyx_v_c_ns_cache.ns_map != NULL);
  if (__pyx_t_3) {

    /* "src/lxml/proxy.pxi":378
 *     # cleanup
 *     if c_ns_cache.ns_map is not NULL:
 *         python.lxml_free(c_ns_cache.ns_map)             # <<<<<<<<<<<<<<
 * 
 *     # 3) fix the names in the tree if we moved it from a different thread
*/
    lxml_free(__pyx_v_c_ns_cache.ns_map);

    /* "src/lxml/proxy.pxi":377
 * 
 *     # cleanup
 *     if c_ns_cache.ns_map is not NULL:             # <<<<<<<<<<<<<<
 *         python.lxml_free(c_ns_cache.ns_map)
 * 
*/
  }

  /* "src/lxml/proxy.pxi":381
 * 
 *     # 3) fix the names in the tree if we moved it from a different thread
 *     if doc._c_doc.dict is not c_source_doc.dict:             # <<<<<<<<<<<<<<
 *         fixThreadDictNames(c_start_node, c_source_doc.dict, doc._c_doc.dict)
 * 
*/
  __pyx_t_3 = (__pyx_v_doc->_c_doc->dict != __pyx_v_c_source_doc->dict);
  if (__pyx_t_3) {

    /* "src/lxml/proxy.pxi":382
 *     # 3) fix the names in the tree if we moved it from a different thread
 *     if doc._c_doc.dict is not c_source_doc.dict:
 *         fixThreadDictNames(c_start_node, c_source_doc.dict, doc._c_doc.dict)             # <<<<<<<<<<<<<<
 * 
 *     # 4) fix _Document references
*/
    __pyx_f_4lxml_5etree_fixThreadDictNames(__pyx_v_c_start_node, __pyx_v_c_source_doc->dict, __pyx_v_doc->_c_doc->dict);

    /* "src/lxml/proxy.pxi":381
 * 
 *     # 3) fix the names in the tree if we moved it from a different thread
 *     if doc._c_doc.dict is not c_source_doc.dict:             # <<<<<<<<<<<<<<
 *         fixThreadDictNames(c_start_node, c_source_doc.dict, doc._c_doc.dict)
 * 
*/
  }

  /* "src/lxml/proxy.pxi":386
 *     # 4) fix _Document references
 *     #    (and potentially deallocate the source document)
 *     if proxy_count > 0:             # <<<<<<<<<<<<<<
 *         if proxy_count == 1 and c_start_node._private is not NULL:
 *             proxy = getProxy(c_start_node)
*/
  __pyx_t_10 = PyObject_RichCompare(__pyx_v_proxy_count, __pyx_mstate_global->__pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(8, 386, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(8, 386, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (__pyx_t_3) {

    /* "src/lxml/proxy.pxi":387
 *     #    (and potentially deallocate the source document)
 *     if proxy_count > 0:
 *         if proxy_count == 1 and c_start_node._private is not NULL:             # <<<<<<<<<<<<<<
 *             proxy = getProxy(c_start_node)
 *             if proxy is not None:
*/
    __pyx_t_12 = (__Pyx_PyLong_BoolEqObjC(__pyx_v_proxy_count, __pyx_mstate_global->__pyx_int_1, 1, 0)); if (unlikely((__pyx_t_12 < 0))) __PYX_ERR(8, 387, __pyx_L1_error)
    if (__pyx_t_12) {
    } else {
      __pyx_t_3 = __pyx_t_12;
      goto __pyx_L24_bool_binop_done;
    }
    __pyx_t_12 = (__pyx_v_c_start_node->_private != NULL);
    __pyx_t_3 = __pyx_t_12;
    __pyx_L24_bool_binop_done:;
    if (__pyx_t_3) {

      /* "src/lxml/proxy.pxi":388
 *     if proxy_count > 0:
 *         if proxy_count == 1 and c_start_node._private is not NULL:
 *             proxy = getProxy(c_start_node)             # <<<<<<<<<<<<<<
 *             if proxy is not None:
 *                 if proxy._doc is not doc:
*/
      __pyx_t_10 = ((PyObject *)__pyx_f_4lxml_5etree_getProxy(__pyx_v_c_start_node)); if (unlikely(!__pyx_t_10)) __PYX_ERR(8, 388, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_v_proxy = ((struct LxmlElement *)__pyx_t_10);
      __pyx_t_10 = 0;

      /* "src/lxml/proxy.pxi":389
 *         if proxy_count == 1 and c_start_node._private is not NULL:
 *             proxy = getProxy(c_start_node)
 *             if proxy is not None:             # <<<<<<<<<<<<<<
 *                 if proxy._doc is not doc:
 *                     proxy._doc = doc
*/
      __pyx_t_3 = (((PyObject *)__pyx_v_proxy) != Py_None);
      if (__pyx_t_3) {

        /* "src/lxml/proxy.pxi":390
 *             proxy = getProxy(c_start_node)
 *             if proxy is not None:
 *                 if proxy._doc is not doc:             # <<<<<<<<<<<<<<
 *                     proxy._doc = doc
 *             else:
*/
        __pyx_t_3 = (__pyx_v_proxy->_doc != __pyx_v_doc);
        if (__pyx_t_3) {

          /* "src/lxml/proxy.pxi":391
 *             if proxy is not None:
 *                 if proxy._doc is not doc:
 *                     proxy._doc = doc             # <<<<<<<<<<<<<<
 *             else:
 *                 fixElementDocument(c_start_node, doc, proxy_count)
*/
          __Pyx_INCREF((PyObject *)__pyx_v_doc);
          __Pyx_GIVEREF((PyObject *)__pyx_v_doc);
          __Pyx_GOTREF((PyObject *)__pyx_v_proxy->_doc);
          __Pyx_DECREF((PyObject *)__pyx_v_proxy->_doc);
          __pyx_v_proxy->_doc = __pyx_v_doc;

          /* "src/lxml/proxy.pxi":390
 *             proxy = getProxy(c_start_node)
 *             if proxy is not None:
 *                 if proxy._doc is not doc:             # <<<<<<<<<<<<<<
 *                     proxy._doc = doc
 *             else:
*/
        }

        /* "src/lxml/proxy.pxi":389
 *         if proxy_count == 1 and c_start_node._private is not NULL:
 *             proxy = getProxy(c_start_node)
 *             if proxy is not None:             # <<<<<<<<<<<<<<
 *                 if proxy._doc is not doc:
 *                     proxy._doc = doc
*/
        goto __pyx_L26;
      }

      /* "src/lxml/proxy.pxi":393
 *                     proxy._doc = doc
 *             else:
 *                 fixElementDocument(c_start_node, doc, proxy_count)             # <<<<<<<<<<<<<<
 *         else:
 *             fixElementDocument(c_start_node, doc, proxy_count)
*/
      /*else*/ {
        __pyx_t_13 = __Pyx_PyLong_As_size_t(__pyx_v_proxy_count); if (unlikely((__pyx_t_13 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(8, 393, __pyx_L1_error)
        __pyx_t_8 = __pyx_f_4lxml_5etree_fixElementDocument(__pyx_v_c_start_node, __pyx_v_doc, __pyx_t_13); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(8, 393, __pyx_L1_error)
      }
      __pyx_L26:;

      /* "src/lxml/proxy.pxi":387
 *     #    (and potentially deallocate the source document)
 *     if proxy_count > 0:
 *         if proxy_count == 1 and c_start_node._private is not NULL:             # <<<<<<<<<<<<<<
 *             proxy = getProxy(c_start_node)
 *             if proxy is not None:
*/
      goto __pyx_L23;
    }

    /* "src/lxml/proxy.pxi":395
 *                 fixElementDocument(c_start_node, doc, proxy_count)
 *         else:
 *             fixElementDocument(c_start_node, doc, proxy_count)             # <<<<<<<<<<<<<<
 * 
 *     return 0
*/
    /*else*/ {
      __pyx_t_13 = __Pyx_PyLong_As_size_t(__pyx_v_proxy_count); if (unlikely((__pyx_t_13 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(8, 395, __pyx_L1_error)
      __pyx_t_8 = __pyx_f_4lxml_5etree_fixElementDocument(__pyx_v_c_start_node, __pyx_v_doc, __pyx_t_13); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(8, 395, __pyx_L1_error)
    }
    __pyx_L23:;

    /* "src/lxml/proxy.pxi":386
 *     # 4) fix _Document references
 *     #    (and potentially deallocate the source document)
 *     if proxy_count > 0:             # <<<<<<<<<<<<<<
 *         if proxy_count == 1 and c_start_node._private is not NULL:
 *             proxy = getProxy(c_start_node)
*/
  }

  /* "src/lxml/proxy.pxi":397
 *             fixElementDocument(c_start_node, doc, proxy_count)
 * 
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/proxy.pxi":300
 * 
 * 
 * cdef int moveNodeToDocument(_Document doc, xmlDoc* c_source_doc,             # <<<<<<<<<<<<<<
 *                             xmlNode* c_element) except -1:
 *     """Fix the xmlNs pointers of a node and its subtree that were moved.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("lxml.etree.moveNodeToDocument", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_proxy_count);
  __Pyx_XDECREF((PyObject *)__pyx_v_proxy);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/proxy.pxi":400
 * 
 * 
 * cdef void _setTreeDoc(xmlNode* c_node, xmlDoc* c_doc) noexcept:             # <<<<<<<<<<<<<<
 *     """Adaptation of 'xmlSetTreeDoc()' that deep-fixes the document links iteratively.
 *     It avoids https://gitlab.gnome.org/GNOME/libxml2/issues/42
*/

static void __pyx_f_4lxml_5etree__setTreeDoc(xmlNode *__pyx_v_c_node, xmlDoc *__pyx_v_c_doc) {
  xmlAttr *__pyx_v_c_attr;
  int __pyx_t_1;
  xmlAttr *__pyx_t_2;

  /* "src/lxml/proxy.pxi":404
 *     It avoids https://gitlab.gnome.org/GNOME/libxml2/issues/42
 *     """
 *     tree.BEGIN_FOR_EACH_FROM(c_node, c_node, 1)             # <<<<<<<<<<<<<<
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         c_attr = <tree.xmlAttr*>c_node.properties
*/
  BEGIN_FOR_EACH_FROM(__pyx_v_c_node, __pyx_v_c_node, 1);

  /* "src/lxml/proxy.pxi":405
 *     """
 *     tree.BEGIN_FOR_EACH_FROM(c_node, c_node, 1)
 *     if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         c_attr = <tree.xmlAttr*>c_node.properties
 *         while c_attr:
*/
  __pyx_t_1 = (__pyx_v_c_node->type == XML_ELEMENT_NODE);
  if (__pyx_t_1) {

    /* "src/lxml/proxy.pxi":406
 *     tree.BEGIN_FOR_EACH_FROM(c_node, c_node, 1)
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         c_attr = <tree.xmlAttr*>c_node.properties             # <<<<<<<<<<<<<<
 *         while c_attr:
 *             if c_attr.atype == tree.XML_ATTRIBUTE_ID:
*/
    __pyx_v_c_attr = ((xmlAttr *)__pyx_v_c_node->properties);

    /* "src/lxml/proxy.pxi":407
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         c_attr = <tree.xmlAttr*>c_node.properties
 *         while c_attr:             # <<<<<<<<<<<<<<
 *             if c_attr.atype == tree.XML_ATTRIBUTE_ID:
 *                 tree.xmlRemoveID(c_node.doc, c_attr)
*/
    while (1) {
      __pyx_t_1 = (__pyx_v_c_attr != 0);
      if (!__pyx_t_1) break;

      /* "src/lxml/proxy.pxi":408
 *         c_attr = <tree.xmlAttr*>c_node.properties
 *         while c_attr:
 *             if c_attr.atype == tree.XML_ATTRIBUTE_ID:             # <<<<<<<<<<<<<<
 *                 tree.xmlRemoveID(c_node.doc, c_attr)
 *             c_attr.doc = c_doc
*/
      __pyx_t_1 = (__pyx_v_c_attr->atype == XML_ATTRIBUTE_ID);
      if (__pyx_t_1) {

        /* "src/lxml/proxy.pxi":409
 *         while c_attr:
 *             if c_attr.atype == tree.XML_ATTRIBUTE_ID:
 *                 tree.xmlRemoveID(c_node.doc, c_attr)             # <<<<<<<<<<<<<<
 *             c_attr.doc = c_doc
 *             _fixDocChildren(c_attr.children, c_doc)
*/
        (void)(xmlRemoveID(__pyx_v_c_node->doc, __pyx_v_c_attr));

        /* "src/lxml/proxy.pxi":408
 *         c_attr = <tree.xmlAttr*>c_node.properties
 *         while c_attr:
 *             if c_attr.atype == tree.XML_ATTRIBUTE_ID:             # <<<<<<<<<<<<<<
 *                 tree.xmlRemoveID(c_node.doc, c_attr)
 *             c_attr.doc = c_doc
*/
      }

      /* "src/lxml/proxy.pxi":410
 *             if c_attr.atype == tree.XML_ATTRIBUTE_ID:
 *                 tree.xmlRemoveID(c_node.doc, c_attr)
 *             c_attr.doc = c_doc             # <<<<<<<<<<<<<<
 *             _fixDocChildren(c_attr.children, c_doc)
 *             c_attr = c_attr.next
*/
      __pyx_v_c_attr->doc = __pyx_v_c_doc;

      /* "src/lxml/proxy.pxi":411
 *                 tree.xmlRemoveID(c_node.doc, c_attr)
 *             c_attr.doc = c_doc
 *             _fixDocChildren(c_attr.children, c_doc)             # <<<<<<<<<<<<<<
 *             c_attr = c_attr.next
 *     # Set doc link for all nodes, not only elements.
*/
      __pyx_f_4lxml_5etree__fixDocChildren(__pyx_v_c_attr->children, __pyx_v_c_doc);

      /* "src/lxml/proxy.pxi":412
 *             c_attr.doc = c_doc
 *             _fixDocChildren(c_attr.children, c_doc)
 *             c_attr = c_attr.next             # <<<<<<<<<<<<<<
 *     # Set doc link for all nodes, not only elements.
 *     c_node.doc = c_doc
*/
      __pyx_t_2 = __pyx_v_c_attr->next;
      __pyx_v_c_attr = __pyx_t_2;
    }

    /* "src/lxml/proxy.pxi":405
 *     """
 *     tree.BEGIN_FOR_EACH_FROM(c_node, c_node, 1)
 *     if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         c_attr = <tree.xmlAttr*>c_node.properties
 *         while c_attr:
*/
  }

  /* "src/lxml/proxy.pxi":414
 *             c_attr = c_attr.next
 *     # Set doc link for all nodes, not only elements.
 *     c_node.doc = c_doc             # <<<<<<<<<<<<<<
 *     tree.END_FOR_EACH_FROM(c_node)
 * 
*/
  __pyx_v_c_node->doc = __pyx_v_c_doc;

  /* "src/lxml/proxy.pxi":415
 *     # Set doc link for all nodes, not only elements.
 *     c_node.doc = c_doc
 *     tree.END_FOR_EACH_FROM(c_node)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  END_FOR_EACH_FROM(__pyx_v_c_node);

  /* "src/lxml/proxy.pxi":400
 * 
 * 
 * cdef void _setTreeDoc(xmlNode* c_node, xmlDoc* c_doc) noexcept:             # <<<<<<<<<<<<<<
 *     """Adaptation of 'xmlSetTreeDoc()' that deep-fixes the document links iteratively.
 *     It avoids https://gitlab.gnome.org/GNOME/libxml2/issues/42
*/

  /* function exit code */
}

/* "src/lxml/proxy.pxi":418
 * 
 * 
 * cdef inline void _fixDocChildren(xmlNode* c_child, xmlDoc* c_doc) noexcept:             # <<<<<<<<<<<<<<
 *     while c_child:
 *         c_child.doc = c_doc
*/

static CYTHON_INLINE void __pyx_f_4lxml_5etree__fixDocChildren(xmlNode *__pyx_v_c_child, xmlDoc *__pyx_v_c_doc) {
  int __pyx_t_1;
  xmlNode *__pyx_t_2;

  /* "src/lxml/proxy.pxi":419
 * 
 * cdef inline void _fixDocChildren(xmlNode* c_child, xmlDoc* c_doc) noexcept:
 *     while c_child:             # <<<<<<<<<<<<<<
 *         c_child.doc = c_doc
 *         if c_child.children:
*/
  while (1) {
    __pyx_t_1 = (__pyx_v_c_child != 0);
    if (!__pyx_t_1) break;

    /* "src/lxml/proxy.pxi":420
 * cdef inline void _fixDocChildren(xmlNode* c_child, xmlDoc* c_doc) noexcept:
 *     while c_child:
 *         c_child.doc = c_doc             # <<<<<<<<<<<<<<
 *         if c_child.children:
 *             _fixDocChildren(c_child.children, c_doc)
*/
    __pyx_v_c_child->doc = __pyx_v_c_doc;

    /* "src/lxml/proxy.pxi":421
 *     while c_child:
 *         c_child.doc = c_doc
 *         if c_child.children:             # <<<<<<<<<<<<<<
 *             _fixDocChildren(c_child.children, c_doc)
 *         c_child = c_child.next
*/
    __pyx_t_1 = (__pyx_v_c_child->children != 0);
    if (__pyx_t_1) {

      /* "src/lxml/proxy.pxi":422
 *         c_child.doc = c_doc
 *         if c_child.children:
 *             _fixDocChildren(c_child.children, c_doc)             # <<<<<<<<<<<<<<
 *         c_child = c_child.next
 * 
*/
      __pyx_f_4lxml_5etree__fixDocChildren(__pyx_v_c_child->children, __pyx_v_c_doc);

      /* "src/lxml/proxy.pxi":421
 *     while c_child:
 *         c_child.doc = c_doc
 *         if c_child.children:             # <<<<<<<<<<<<<<
 *             _fixDocChildren(c_child.children, c_doc)
 *         c_child = c_child.next
*/
    }

    /* "src/lxml/proxy.pxi":423
 *         if c_child.children:
 *             _fixDocChildren(c_child.children, c_doc)
 *         c_child = c_child.next             # <<<<<<<<<<<<<<
 * 
 * 
*/
    __pyx_t_2 = __pyx_v_c_child->next;
    __pyx_v_c_child = __pyx_t_2;
  }

  /* "src/lxml/proxy.pxi":418
 * 
 * 
 * cdef inline void _fixDocChildren(xmlNode* c_child, xmlDoc* c_doc) noexcept:             # <<<<<<<<<<<<<<
 *     while c_child:
 *         c_child.doc = c_doc
*/

  /* function exit code */
}

/* "src/lxml/proxy.pxi":426
 * 
 * 
 * cdef int _fixCNs(_Document doc, xmlNode* c_start_node, xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                  _nscache* c_ns_cache, xmlNs* c_del_ns_list) except -1:
 *     cdef xmlNs* c_ns = NULL
*/

static int __pyx_f_4lxml_5etree__fixCNs(struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_start_node, xmlNode *__pyx_v_c_node, __pyx_t_4lxml_5etree__nscache *__pyx_v_c_ns_cache, xmlNs *__pyx_v_c_del_ns_list) {
  xmlNs *__pyx_v_c_ns;
  int __pyx_v_is_prefixed_attr;
  __pyx_t_4lxml_5etree__ns_update_map __pyx_v_ns_map;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __pyx_t_4lxml_5etree__ns_update_map *__pyx_t_3;
  __pyx_t_4lxml_5etree__ns_update_map *__pyx_t_4;
  __pyx_t_4lxml_5etree__ns_update_map *__pyx_t_5;
  xmlNs *__pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_fixCNs", 0);

  /* "src/lxml/proxy.pxi":428
 * cdef int _fixCNs(_Document doc, xmlNode* c_start_node, xmlNode* c_node,
 *                  _nscache* c_ns_cache, xmlNs* c_del_ns_list) except -1:
 *     cdef xmlNs* c_ns = NULL             # <<<<<<<<<<<<<<
 *     cdef bint is_prefixed_attr = (c_node.type == tree.XML_ATTRIBUTE_NODE and c_node.ns.prefix)
 * 
*/
  __pyx_v_c_ns = NULL;

  /* "src/lxml/proxy.pxi":429
 *                  _nscache* c_ns_cache, xmlNs* c_del_ns_list) except -1:
 *     cdef xmlNs* c_ns = NULL
 *     cdef bint is_prefixed_attr = (c_node.type == tree.XML_ATTRIBUTE_NODE and c_node.ns.prefix)             # <<<<<<<<<<<<<<
 * 
 *     for ns_map in c_ns_cache.ns_map[:c_ns_cache.last]:
*/
  __pyx_t_2 = (__pyx_v_c_node->type == XML_ATTRIBUTE_NODE);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L3_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_c_node->ns->prefix != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L3_bool_binop_done:;
  __pyx_v_is_prefixed_attr = __pyx_t_1;

  /* "src/lxml/proxy.pxi":431
 *     cdef bint is_prefixed_attr = (c_node.type == tree.XML_ATTRIBUTE_NODE and c_node.ns.prefix)
 * 
 *     for ns_map in c_ns_cache.ns_map[:c_ns_cache.last]:             # <<<<<<<<<<<<<<
 *         if c_node.ns is ns_map.old:
 *             if is_prefixed_attr and not ns_map.new.prefix:
*/
  __pyx_t_4 = (__pyx_v_c_ns_cache->ns_map + __pyx_v_c_ns_cache->last);
  for (__pyx_t_5 = __pyx_v_c_ns_cache->ns_map; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
    __pyx_t_3 = __pyx_t_5;
    __pyx_v_ns_map = (__pyx_t_3[0]);

    /* "src/lxml/proxy.pxi":432
 * 
 *     for ns_map in c_ns_cache.ns_map[:c_ns_cache.last]:
 *         if c_node.ns is ns_map.old:             # <<<<<<<<<<<<<<
 *             if is_prefixed_attr and not ns_map.new.prefix:
 *                 # avoid dropping prefix from attributes
*/
    __pyx_t_1 = (__pyx_v_c_node->ns == __pyx_v_ns_map.old);
    if (__pyx_t_1) {

      /* "src/lxml/proxy.pxi":433
 *     for ns_map in c_ns_cache.ns_map[:c_ns_cache.last]:
 *         if c_node.ns is ns_map.old:
 *             if is_prefixed_attr and not ns_map.new.prefix:             # <<<<<<<<<<<<<<
 *                 # avoid dropping prefix from attributes
 *                 continue
*/
      if (__pyx_v_is_prefixed_attr) {
      } else {
        __pyx_t_1 = __pyx_v_is_prefixed_attr;
        goto __pyx_L9_bool_binop_done;
      }
      __pyx_t_2 = (!(__pyx_v_ns_map.__pyx_new->prefix != 0));
      __pyx_t_1 = __pyx_t_2;
      __pyx_L9_bool_binop_done:;
      if (__pyx_t_1) {

        /* "src/lxml/proxy.pxi":435
 *             if is_prefixed_attr and not ns_map.new.prefix:
 *                 # avoid dropping prefix from attributes
 *                 continue             # <<<<<<<<<<<<<<
 *             c_ns = ns_map.new
 *             break
*/
        goto __pyx_L5_continue;

        /* "src/lxml/proxy.pxi":433
 *     for ns_map in c_ns_cache.ns_map[:c_ns_cache.last]:
 *         if c_node.ns is ns_map.old:
 *             if is_prefixed_attr and not ns_map.new.prefix:             # <<<<<<<<<<<<<<
 *                 # avoid dropping prefix from attributes
 *                 continue
*/
      }

      /* "src/lxml/proxy.pxi":436
 *                 # avoid dropping prefix from attributes
 *                 continue
 *             c_ns = ns_map.new             # <<<<<<<<<<<<<<
 *             break
 * 
*/
      __pyx_t_6 = __pyx_v_ns_map.__pyx_new;
      __pyx_v_c_ns = __pyx_t_6;

      /* "src/lxml/proxy.pxi":437
 *                 continue
 *             c_ns = ns_map.new
 *             break             # <<<<<<<<<<<<<<
 * 
 *     if c_ns:
*/
      goto __pyx_L6_break;

      /* "src/lxml/proxy.pxi":432
 * 
 *     for ns_map in c_ns_cache.ns_map[:c_ns_cache.last]:
 *         if c_node.ns is ns_map.old:             # <<<<<<<<<<<<<<
 *             if is_prefixed_attr and not ns_map.new.prefix:
 *                 # avoid dropping prefix from attributes
*/
    }
    __pyx_L5_continue:;
  }
  __pyx_L6_break:;

  /* "src/lxml/proxy.pxi":439
 *             break
 * 
 *     if c_ns:             # <<<<<<<<<<<<<<
 *         c_node.ns = c_ns
 *     else:
*/
  __pyx_t_1 = (__pyx_v_c_ns != 0);
  if (__pyx_t_1) {

    /* "src/lxml/proxy.pxi":440
 * 
 *     if c_ns:
 *         c_node.ns = c_ns             # <<<<<<<<<<<<<<
 *     else:
 *         # not in cache or not acceptable
*/
    __pyx_v_c_node->ns = __pyx_v_c_ns;

    /* "src/lxml/proxy.pxi":439
 *             break
 * 
 *     if c_ns:             # <<<<<<<<<<<<<<
 *         c_node.ns = c_ns
 *     else:
*/
    goto __pyx_L11;
  }

  /* "src/lxml/proxy.pxi":444
 *         # not in cache or not acceptable
 *         # => find a replacement from this document
 *         try:             # <<<<<<<<<<<<<<
 *             c_ns = doc._findOrBuildNodeNs(
 *                 c_start_node, c_node.ns.href, c_node.ns.prefix,
*/
  /*else*/ {
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);
      /*try:*/ {

        /* "src/lxml/proxy.pxi":445
 *         # => find a replacement from this document
 *         try:
 *             c_ns = doc._findOrBuildNodeNs(             # <<<<<<<<<<<<<<
 *                 c_start_node, c_node.ns.href, c_node.ns.prefix,
 *                 c_node.type == tree.XML_ATTRIBUTE_NODE)
*/
        __pyx_t_6 = __pyx_f_4lxml_5etree_9_Document__findOrBuildNodeNs(__pyx_v_doc, __pyx_v_c_start_node, __pyx_v_c_node->ns->href, __pyx_v_c_node->ns->prefix, (__pyx_v_c_node->type == XML_ATTRIBUTE_NODE)); if (unlikely(__pyx_t_6 == ((void *)NULL))) __PYX_ERR(8, 445, __pyx_L12_error)
        __pyx_v_c_ns = __pyx_t_6;

        /* "src/lxml/proxy.pxi":448
 *                 c_start_node, c_node.ns.href, c_node.ns.prefix,
 *                 c_node.type == tree.XML_ATTRIBUTE_NODE)
 *             c_node.ns = c_ns             # <<<<<<<<<<<<<<
 *             _appendToNsCache(c_ns_cache, c_node.ns, c_ns)
 *         except:
*/
        __pyx_v_c_node->ns = __pyx_v_c_ns;

        /* "src/lxml/proxy.pxi":449
 *                 c_node.type == tree.XML_ATTRIBUTE_NODE)
 *             c_node.ns = c_ns
 *             _appendToNsCache(c_ns_cache, c_node.ns, c_ns)             # <<<<<<<<<<<<<<
 *         except:
 *             _cleanUpFromNamespaceAdaptation(c_start_node, c_ns_cache, c_del_ns_list)
*/
        __pyx_t_10 = __pyx_f_4lxml_5etree__appendToNsCache(__pyx_v_c_ns_cache, __pyx_v_c_node->ns, __pyx_v_c_ns); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(8, 449, __pyx_L12_error)

        /* "src/lxml/proxy.pxi":444
 *         # not in cache or not acceptable
 *         # => find a replacement from this document
 *         try:             # <<<<<<<<<<<<<<
 *             c_ns = doc._findOrBuildNodeNs(
 *                 c_start_node, c_node.ns.href, c_node.ns.prefix,
*/
      }
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L17_try_end;
      __pyx_L12_error:;

      /* "src/lxml/proxy.pxi":450
 *             c_node.ns = c_ns
 *             _appendToNsCache(c_ns_cache, c_node.ns, c_ns)
 *         except:             # <<<<<<<<<<<<<<
 *             _cleanUpFromNamespaceAdaptation(c_start_node, c_ns_cache, c_del_ns_list)
 *             raise
*/
      /*except:*/ {
        __Pyx_AddTraceback("lxml.etree._fixCNs", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13) < 0) __PYX_ERR(8, 450, __pyx_L14_except_error)
        __Pyx_XGOTREF(__pyx_t_11);
        __Pyx_XGOTREF(__pyx_t_12);
        __Pyx_XGOTREF(__pyx_t_13);

        /* "src/lxml/proxy.pxi":451
 *             _appendToNsCache(c_ns_cache, c_node.ns, c_ns)
 *         except:
 *             _cleanUpFromNamespaceAdaptation(c_start_node, c_ns_cache, c_del_ns_list)             # <<<<<<<<<<<<<<
 *             raise
 *     return 0
*/
        __pyx_f_4lxml_5etree__cleanUpFromNamespaceAdaptation(__pyx_v_c_start_node, __pyx_v_c_ns_cache, __pyx_v_c_del_ns_list);

        /* "src/lxml/proxy.pxi":452
 *         except:
 *             _cleanUpFromNamespaceAdaptation(c_start_node, c_ns_cache, c_del_ns_list)
 *             raise             # <<<<<<<<<<<<<<
 *     return 0
 * 
*/
        __Pyx_GIVEREF(__pyx_t_11);
        __Pyx_GIVEREF(__pyx_t_12);
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_ErrRestoreWithState(__pyx_t_11, __pyx_t_12, __pyx_t_13);
        __pyx_t_11 = 0;  __pyx_t_12 = 0;  __pyx_t_13 = 0; 
        __PYX_ERR(8, 452, __pyx_L14_except_error)
      }

      /* "src/lxml/proxy.pxi":444
 *         # not in cache or not acceptable
 *         # => find a replacement from this document
 *         try:             # <<<<<<<<<<<<<<
 *             c_ns = doc._findOrBuildNodeNs(
 *                 c_start_node, c_node.ns.href, c_node.ns.prefix,
*/
      __pyx_L14_except_error:;
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
      goto __pyx_L1_error;
      __pyx_L17_try_end:;
    }
  }
  __pyx_L11:;

  /* "src/lxml/proxy.pxi":453
 *             _cleanUpFromNamespaceAdaptation(c_start_node, c_ns_cache, c_del_ns_list)
 *             raise
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/proxy.pxi":426
 * 
 * 
 * cdef int _fixCNs(_Document doc, xmlNode* c_start_node, xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                  _nscache* c_ns_cache, xmlNs* c_del_ns_list) except -1:
 *     cdef xmlNs* c_ns = NULL
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("lxml.etree._fixCNs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/proxy.pxi":456
 * 
 * 
 * cdef int fixElementDocument(xmlNode* c_element, _Document doc,             # <<<<<<<<<<<<<<
 *                              size_t proxy_count) except -1:
 *     cdef xmlNode* c_node = c_element
*/

static int __pyx_f_4lxml_5etree_fixElementDocument(xmlNode *__pyx_v_c_element, struct LxmlDocument *__pyx_v_doc, size_t __pyx_v_proxy_count) {
  xmlNode *__pyx_v_c_node;
  struct LxmlElement *__pyx_v_proxy = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("fixElementDocument", 0);

  /* "src/lxml/proxy.pxi":458
 * cdef int fixElementDocument(xmlNode* c_element, _Document doc,
 *                              size_t proxy_count) except -1:
 *     cdef xmlNode* c_node = c_element             # <<<<<<<<<<<<<<
 *     cdef _Element proxy = None # init-to-None required due to fake-loop below
 *     tree.BEGIN_FOR_EACH_FROM(c_element, c_node, 1)
*/
  __pyx_v_c_node = __pyx_v_c_element;

  /* "src/lxml/proxy.pxi":459
 *                              size_t proxy_count) except -1:
 *     cdef xmlNode* c_node = c_element
 *     cdef _Element proxy = None # init-to-None required due to fake-loop below             # <<<<<<<<<<<<<<
 *     tree.BEGIN_FOR_EACH_FROM(c_element, c_node, 1)
 *     if c_node._private is not NULL:
*/
  __Pyx_INCREF(Py_None);
  __pyx_v_proxy = ((struct LxmlElement *)Py_None);

  /* "src/lxml/proxy.pxi":460
 *     cdef xmlNode* c_node = c_element
 *     cdef _Element proxy = None # init-to-None required due to fake-loop below
 *     tree.BEGIN_FOR_EACH_FROM(c_element, c_node, 1)             # <<<<<<<<<<<<<<
 *     if c_node._private is not NULL:
 *         proxy = getProxy(c_node)
*/
  BEGIN_FOR_EACH_FROM(__pyx_v_c_element, __pyx_v_c_node, 1);

  /* "src/lxml/proxy.pxi":461
 *     cdef _Element proxy = None # init-to-None required due to fake-loop below
 *     tree.BEGIN_FOR_EACH_FROM(c_element, c_node, 1)
 *     if c_node._private is not NULL:             # <<<<<<<<<<<<<<
 *         proxy = getProxy(c_node)
 *         if proxy is not None:
*/
  __pyx_t_1 = (__pyx_v_c_node->_private != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/proxy.pxi":462
 *     tree.BEGIN_FOR_EACH_FROM(c_element, c_node, 1)
 *     if c_node._private is not NULL:
 *         proxy = getProxy(c_node)             # <<<<<<<<<<<<<<
 *         if proxy is not None:
 *             if proxy._doc is not doc:
*/
    __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree_getProxy(__pyx_v_c_node)); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 462, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_proxy, ((struct LxmlElement *)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "src/lxml/proxy.pxi":463
 *     if c_node._private is not NULL:
 *         proxy = getProxy(c_node)
 *         if proxy is not None:             # <<<<<<<<<<<<<<
 *             if proxy._doc is not doc:
 *                 proxy._doc = doc
*/
    __pyx_t_1 = (((PyObject *)__pyx_v_proxy) != Py_None);
    if (__pyx_t_1) {

      /* "src/lxml/proxy.pxi":464
 *         proxy = getProxy(c_node)
 *         if proxy is not None:
 *             if proxy._doc is not doc:             # <<<<<<<<<<<<<<
 *                 proxy._doc = doc
 *             proxy_count -= 1
*/
      __pyx_t_1 = (__pyx_v_proxy->_doc != __pyx_v_doc);
      if (__pyx_t_1) {

        /* "src/lxml/proxy.pxi":465
 *         if proxy is not None:
 *             if proxy._doc is not doc:
 *                 proxy._doc = doc             # <<<<<<<<<<<<<<
 *             proxy_count -= 1
 *             if proxy_count == 0:
*/
        __Pyx_INCREF((PyObject *)__pyx_v_doc);
        __Pyx_GIVEREF((PyObject *)__pyx_v_doc);
        __Pyx_GOTREF((PyObject *)__pyx_v_proxy->_doc);
        __Pyx_DECREF((PyObject *)__pyx_v_proxy->_doc);
        __pyx_v_proxy->_doc = __pyx_v_doc;

        /* "src/lxml/proxy.pxi":464
 *         proxy = getProxy(c_node)
 *         if proxy is not None:
 *             if proxy._doc is not doc:             # <<<<<<<<<<<<<<
 *                 proxy._doc = doc
 *             proxy_count -= 1
*/
      }

      /* "src/lxml/proxy.pxi":466
 *             if proxy._doc is not doc:
 *                 proxy._doc = doc
 *             proxy_count -= 1             # <<<<<<<<<<<<<<
 *             if proxy_count == 0:
 *                 return 0
*/
      __pyx_v_proxy_count = (__pyx_v_proxy_count - 1);

      /* "src/lxml/proxy.pxi":467
 *                 proxy._doc = doc
 *             proxy_count -= 1
 *             if proxy_count == 0:             # <<<<<<<<<<<<<<
 *                 return 0
 *     tree.END_FOR_EACH_FROM(c_node)
*/
      __pyx_t_1 = (__pyx_v_proxy_count == 0);
      if (__pyx_t_1) {

        /* "src/lxml/proxy.pxi":468
 *             proxy_count -= 1
 *             if proxy_count == 0:
 *                 return 0             # <<<<<<<<<<<<<<
 *     tree.END_FOR_EACH_FROM(c_node)
 * 
*/
        __pyx_r = 0;
        goto __pyx_L0;

        /* "src/lxml/proxy.pxi":467
 *                 proxy._doc = doc
 *             proxy_count -= 1
 *             if proxy_count == 0:             # <<<<<<<<<<<<<<
 *                 return 0
 *     tree.END_FOR_EACH_FROM(c_node)
*/
      }

      /* "src/lxml/proxy.pxi":463
 *     if c_node._private is not NULL:
 *         proxy = getProxy(c_node)
 *         if proxy is not None:             # <<<<<<<<<<<<<<
 *             if proxy._doc is not doc:
 *                 proxy._doc = doc
*/
    }

    /* "src/lxml/proxy.pxi":461
 *     cdef _Element proxy = None # init-to-None required due to fake-loop below
 *     tree.BEGIN_FOR_EACH_FROM(c_element, c_node, 1)
 *     if c_node._private is not NULL:             # <<<<<<<<<<<<<<
 *         proxy = getProxy(c_node)
 *         if proxy is not None:
*/
  }

  /* "src/lxml/proxy.pxi":469
 *             if proxy_count == 0:
 *                 return 0
 *     tree.END_FOR_EACH_FROM(c_node)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  END_FOR_EACH_FROM(__pyx_v_c_node);

  /* "src/lxml/proxy.pxi":456
 * 
 * 
 * cdef int fixElementDocument(xmlNode* c_element, _Document doc,             # <<<<<<<<<<<<<<
 *                              size_t proxy_count) except -1:
 *     cdef xmlNode* c_node = c_element
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.fixElementDocument", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_proxy);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/proxy.pxi":472
 * 
 * 
 * cdef void fixThreadDictNames(xmlNode* c_element,             # <<<<<<<<<<<<<<
 *                              tree.xmlDict* c_src_dict,
 *                              tree.xmlDict* c_dict) noexcept nogil:
*/

static void __pyx_f_4lxml_5etree_fixThreadDictNames(xmlNode *__pyx_v_c_element, xmlDict *__pyx_v_c_src_dict, xmlDict *__pyx_v_c_dict) {
  int __pyx_t_1;
  xmlNode *__pyx_t_2;

  /* "src/lxml/proxy.pxi":479
 *     # this should only be called when the element is based on a
 *     # different libxml2 tag name dictionary
 *     if c_element.type == tree.XML_DOCUMENT_NODE or \             # <<<<<<<<<<<<<<
 *             c_element.type == tree.XML_HTML_DOCUMENT_NODE:
 *         # may define "xml" namespace
*/
  switch (__pyx_v_c_element->type) {
    case XML_DOCUMENT_NODE:
    case XML_HTML_DOCUMENT_NODE:

    /* "src/lxml/proxy.pxi":480
 *     # different libxml2 tag name dictionary
 *     if c_element.type == tree.XML_DOCUMENT_NODE or \
 *             c_element.type == tree.XML_HTML_DOCUMENT_NODE:             # <<<<<<<<<<<<<<
 *         # may define "xml" namespace
 *         fixThreadDictNsForNode(c_element, c_src_dict, c_dict)
*/
    __pyx_t_1 = 1;

    /* "src/lxml/proxy.pxi":479
 *     # this should only be called when the element is based on a
 *     # different libxml2 tag name dictionary
 *     if c_element.type == tree.XML_DOCUMENT_NODE or \             # <<<<<<<<<<<<<<
 *             c_element.type == tree.XML_HTML_DOCUMENT_NODE:
 *         # may define "xml" namespace
*/
    break;
    default:
    __pyx_t_1 = 0;
    break;
  }
  if (__pyx_t_1) {

    /* "src/lxml/proxy.pxi":482
 *             c_element.type == tree.XML_HTML_DOCUMENT_NODE:
 *         # may define "xml" namespace
 *         fixThreadDictNsForNode(c_element, c_src_dict, c_dict)             # <<<<<<<<<<<<<<
 *         if c_element.doc.extSubset:
 *             fixThreadDictNamesForDtd(c_element.doc.extSubset, c_src_dict, c_dict)
*/
    __pyx_f_4lxml_5etree_fixThreadDictNsForNode(__pyx_v_c_element, __pyx_v_c_src_dict, __pyx_v_c_dict);

    /* "src/lxml/proxy.pxi":483
 *         # may define "xml" namespace
 *         fixThreadDictNsForNode(c_element, c_src_dict, c_dict)
 *         if c_element.doc.extSubset:             # <<<<<<<<<<<<<<
 *             fixThreadDictNamesForDtd(c_element.doc.extSubset, c_src_dict, c_dict)
 *         if c_element.doc.intSubset:
*/
    __pyx_t_1 = (__pyx_v_c_element->doc->extSubset != 0);
    if (__pyx_t_1) {

      /* "src/lxml/proxy.pxi":484
 *         fixThreadDictNsForNode(c_element, c_src_dict, c_dict)
 *         if c_element.doc.extSubset:
 *             fixThreadDictNamesForDtd(c_element.doc.extSubset, c_src_dict, c_dict)             # <<<<<<<<<<<<<<
 *         if c_element.doc.intSubset:
 *             fixThreadDictNamesForDtd(c_element.doc.intSubset, c_src_dict, c_dict)
*/
      __pyx_f_4lxml_5etree_fixThreadDictNamesForDtd(__pyx_v_c_element->doc->extSubset, __pyx_v_c_src_dict, __pyx_v_c_dict);

      /* "src/lxml/proxy.pxi":483
 *         # may define "xml" namespace
 *         fixThreadDictNsForNode(c_element, c_src_dict, c_dict)
 *         if c_element.doc.extSubset:             # <<<<<<<<<<<<<<
 *             fixThreadDictNamesForDtd(c_element.doc.extSubset, c_src_dict, c_dict)
 *         if c_element.doc.intSubset:
*/
    }

    /* "src/lxml/proxy.pxi":485
 *         if c_element.doc.extSubset:
 *             fixThreadDictNamesForDtd(c_element.doc.extSubset, c_src_dict, c_dict)
 *         if c_element.doc.intSubset:             # <<<<<<<<<<<<<<
 *             fixThreadDictNamesForDtd(c_element.doc.intSubset, c_src_dict, c_dict)
 *         c_element = c_element.children
*/
    __pyx_t_1 = (__pyx_v_c_element->doc->intSubset != 0);
    if (__pyx_t_1) {

      /* "src/lxml/proxy.pxi":486
 *             fixThreadDictNamesForDtd(c_element.doc.extSubset, c_src_dict, c_dict)
 *         if c_element.doc.intSubset:
 *             fixThreadDictNamesForDtd(c_element.doc.intSubset, c_src_dict, c_dict)             # <<<<<<<<<<<<<<
 *         c_element = c_element.children
 *         while c_element is not NULL:
*/
      __pyx_f_4lxml_5etree_fixThreadDictNamesForDtd(__pyx_v_c_element->doc->intSubset, __pyx_v_c_src_dict, __pyx_v_c_dict);

      /* "src/lxml/proxy.pxi":485
 *         if c_element.doc.extSubset:
 *             fixThreadDictNamesForDtd(c_element.doc.extSubset, c_src_dict, c_dict)
 *         if c_element.doc.intSubset:             # <<<<<<<<<<<<<<
 *             fixThreadDictNamesForDtd(c_element.doc.intSubset, c_src_dict, c_dict)
 *         c_element = c_element.children
*/
    }

    /* "src/lxml/proxy.pxi":487
 *         if c_element.doc.intSubset:
 *             fixThreadDictNamesForDtd(c_element.doc.intSubset, c_src_dict, c_dict)
 *         c_element = c_element.children             # <<<<<<<<<<<<<<
 *         while c_element is not NULL:
 *             fixThreadDictNamesForNode(c_element, c_src_dict, c_dict)
*/
    __pyx_t_2 = __pyx_v_c_element->children;
    __pyx_v_c_element = __pyx_t_2;

    /* "src/lxml/proxy.pxi":488
 *             fixThreadDictNamesForDtd(c_element.doc.intSubset, c_src_dict, c_dict)
 *         c_element = c_element.children
 *         while c_element is not NULL:             # <<<<<<<<<<<<<<
 *             fixThreadDictNamesForNode(c_element, c_src_dict, c_dict)
 *             c_element = c_element.next
*/
    while (1) {
      __pyx_t_1 = (__pyx_v_c_element != NULL);
      if (!__pyx_t_1) break;

      /* "src/lxml/proxy.pxi":489
 *         c_element = c_element.children
 *         while c_element is not NULL:
 *             fixThreadDictNamesForNode(c_element, c_src_dict, c_dict)             # <<<<<<<<<<<<<<
 *             c_element = c_element.next
 *     elif tree._isElementOrXInclude(c_element):
*/
      __pyx_f_4lxml_5etree_fixThreadDictNamesForNode(__pyx_v_c_element, __pyx_v_c_src_dict, __pyx_v_c_dict);

      /* "src/lxml/proxy.pxi":490
 *         while c_element is not NULL:
 *             fixThreadDictNamesForNode(c_element, c_src_dict, c_dict)
 *             c_element = c_element.next             # <<<<<<<<<<<<<<
 *     elif tree._isElementOrXInclude(c_element):
 *         fixThreadDictNamesForNode(c_element, c_src_dict, c_dict)
*/
      __pyx_t_2 = __pyx_v_c_element->next;
      __pyx_v_c_element = __pyx_t_2;
    }

    /* "src/lxml/proxy.pxi":479
 *     # this should only be called when the element is based on a
 *     # different libxml2 tag name dictionary
 *     if c_element.type == tree.XML_DOCUMENT_NODE or \             # <<<<<<<<<<<<<<
 *             c_element.type == tree.XML_HTML_DOCUMENT_NODE:
 *         # may define "xml" namespace
*/
    goto __pyx_L3;
  }

  /* "src/lxml/proxy.pxi":491
 *             fixThreadDictNamesForNode(c_element, c_src_dict, c_dict)
 *             c_element = c_element.next
 *     elif tree._isElementOrXInclude(c_element):             # <<<<<<<<<<<<<<
 *         fixThreadDictNamesForNode(c_element, c_src_dict, c_dict)
 * 
*/
  __pyx_t_1 = _isElementOrXInclude(__pyx_v_c_element);
  if (__pyx_t_1) {

    /* "src/lxml/proxy.pxi":492
 *             c_element = c_element.next
 *     elif tree._isElementOrXInclude(c_element):
 *         fixThreadDictNamesForNode(c_element, c_src_dict, c_dict)             # <<<<<<<<<<<<<<
 * 
 * 
*/
    __pyx_f_4lxml_5etree_fixThreadDictNamesForNode(__pyx_v_c_element, __pyx_v_c_src_dict, __pyx_v_c_dict);

    /* "src/lxml/proxy.pxi":491
 *             fixThreadDictNamesForNode(c_element, c_src_dict, c_dict)
 *             c_element = c_element.next
 *     elif tree._isElementOrXInclude(c_element):             # <<<<<<<<<<<<<<
 *         fixThreadDictNamesForNode(c_element, c_src_dict, c_dict)
 * 
*/
  }
  __pyx_L3:;

  /* "src/lxml/proxy.pxi":472
 * 
 * 
 * cdef void fixThreadDictNames(xmlNode* c_element,             # <<<<<<<<<<<<<<
 *                              tree.xmlDict* c_src_dict,
 *                              tree.xmlDict* c_dict) noexcept nogil:
*/

  /* function exit code */
}

/* "src/lxml/proxy.pxi":495
 * 
 * 
 * cdef inline void _fixThreadDictPtr(const_xmlChar** c_ptr,             # <<<<<<<<<<<<<<
 *                                    tree.xmlDict* c_src_dict,
 *                                    tree.xmlDict* c_dict) noexcept nogil:
*/

static CYTHON_INLINE void __pyx_f_4lxml_5etree__fixThreadDictPtr(const xmlChar **__pyx_v_c_ptr, xmlDict *__pyx_v_c_src_dict, xmlDict *__pyx_v_c_dict) {
  const xmlChar *__pyx_v_c_str;
  int __pyx_t_1;
  int __pyx_t_2;

  /* "src/lxml/proxy.pxi":498
 *                                    tree.xmlDict* c_src_dict,
 *                                    tree.xmlDict* c_dict) noexcept nogil:
 *     c_str = c_ptr[0]             # <<<<<<<<<<<<<<
 *     if c_str and c_src_dict and tree.xmlDictOwns(c_src_dict, c_str):
 *         # return value can be NULL on memory error, but we don't handle that here
*/
  __pyx_v_c_str = (__pyx_v_c_ptr[0]);

  /* "src/lxml/proxy.pxi":499
 *                                    tree.xmlDict* c_dict) noexcept nogil:
 *     c_str = c_ptr[0]
 *     if c_str and c_src_dict and tree.xmlDictOwns(c_src_dict, c_str):             # <<<<<<<<<<<<<<
 *         # return value can be NULL on memory error, but we don't handle that here
 *         c_str = tree.xmlDictLookup(c_dict, c_str, -1)
*/
  __pyx_t_2 = (__pyx_v_c_str != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_c_src_dict != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (xmlDictOwns(__pyx_v_c_src_dict, __pyx_v_c_str) != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/proxy.pxi":501
 *     if c_str and c_src_dict and tree.xmlDictOwns(c_src_dict, c_str):
 *         # return value can be NULL on memory error, but we don't handle that here
 *         c_str = tree.xmlDictLookup(c_dict, c_str, -1)             # <<<<<<<<<<<<<<
 *         if c_str:
 *             c_ptr[0] = c_str
*/
    __pyx_v_c_str = xmlDictLookup(__pyx_v_c_dict, __pyx_v_c_str, -1);

    /* "src/lxml/proxy.pxi":502
 *         # return value can be NULL on memory error, but we don't handle that here
 *         c_str = tree.xmlDictLookup(c_dict, c_str, -1)
 *         if c_str:             # <<<<<<<<<<<<<<
 *             c_ptr[0] = c_str
 * 
*/
    __pyx_t_1 = (__pyx_v_c_str != 0);
    if (__pyx_t_1) {

      /* "src/lxml/proxy.pxi":503
 *         c_str = tree.xmlDictLookup(c_dict, c_str, -1)
 *         if c_str:
 *             c_ptr[0] = c_str             # <<<<<<<<<<<<<<
 * 
 * 
*/
      (__pyx_v_c_ptr[0]) = __pyx_v_c_str;

      /* "src/lxml/proxy.pxi":502
 *         # return value can be NULL on memory error, but we don't handle that here
 *         c_str = tree.xmlDictLookup(c_dict, c_str, -1)
 *         if c_str:             # <<<<<<<<<<<<<<
 *             c_ptr[0] = c_str
 * 
*/
    }

    /* "src/lxml/proxy.pxi":499
 *                                    tree.xmlDict* c_dict) noexcept nogil:
 *     c_str = c_ptr[0]
 *     if c_str and c_src_dict and tree.xmlDictOwns(c_src_dict, c_str):             # <<<<<<<<<<<<<<
 *         # return value can be NULL on memory error, but we don't handle that here
 *         c_str = tree.xmlDictLookup(c_dict, c_str, -1)
*/
  }

  /* "src/lxml/proxy.pxi":495
 * 
 * 
 * cdef inline void _fixThreadDictPtr(const_xmlChar** c_ptr,             # <<<<<<<<<<<<<<
 *                                    tree.xmlDict* c_src_dict,
 *                                    tree.xmlDict* c_dict) noexcept nogil:
*/

  /* function exit code */
}

/* "src/lxml/proxy.pxi":506
 * 
 * 
 * cdef void fixThreadDictNamesForNode(xmlNode* c_element,             # <<<<<<<<<<<<<<
 *                                     tree.xmlDict* c_src_dict,
 *                                     tree.xmlDict* c_dict) noexcept nogil:
*/

static void __pyx_f_4lxml_5etree_fixThreadDictNamesForNode(xmlNode *__pyx_v_c_element, xmlDict *__pyx_v_c_src_dict, xmlDict *__pyx_v_c_dict) {
  xmlNode *__pyx_v_c_node;

  /* "src/lxml/proxy.pxi":509
 *                                     tree.xmlDict* c_src_dict,
 *                                     tree.xmlDict* c_dict) noexcept nogil:
 *     cdef xmlNode* c_node = c_element             # <<<<<<<<<<<<<<
 *     tree.BEGIN_FOR_EACH_FROM(c_element, c_node, 1)
 *     if c_node.type in (tree.XML_ELEMENT_NODE, tree.XML_XINCLUDE_START):
*/
  __pyx_v_c_node = __pyx_v_c_element;

  /* "src/lxml/proxy.pxi":510
 *                                     tree.xmlDict* c_dict) noexcept nogil:
 *     cdef xmlNode* c_node = c_element
 *     tree.BEGIN_FOR_EACH_FROM(c_element, c_node, 1)             # <<<<<<<<<<<<<<
 *     if c_node.type in (tree.XML_ELEMENT_NODE, tree.XML_XINCLUDE_START):
 *         fixThreadDictNamesForAttributes(
*/
  BEGIN_FOR_EACH_FROM(__pyx_v_c_element, __pyx_v_c_node, 1);

  /* "src/lxml/proxy.pxi":511
 *     cdef xmlNode* c_node = c_element
 *     tree.BEGIN_FOR_EACH_FROM(c_element, c_node, 1)
 *     if c_node.type in (tree.XML_ELEMENT_NODE, tree.XML_XINCLUDE_START):             # <<<<<<<<<<<<<<
 *         fixThreadDictNamesForAttributes(
 *             c_node.properties, c_src_dict, c_dict)
*/
  switch (__pyx_v_c_node->type) {
    case XML_ELEMENT_NODE:
    case XML_XINCLUDE_START:

    /* "src/lxml/proxy.pxi":512
 *     tree.BEGIN_FOR_EACH_FROM(c_element, c_node, 1)
 *     if c_node.type in (tree.XML_ELEMENT_NODE, tree.XML_XINCLUDE_START):
 *         fixThreadDictNamesForAttributes(             # <<<<<<<<<<<<<<
 *             c_node.properties, c_src_dict, c_dict)
 *         fixThreadDictNsForNode(c_node, c_src_dict, c_dict)
*/
    __pyx_f_4lxml_5etree_fixThreadDictNamesForAttributes(__pyx_v_c_node->properties, __pyx_v_c_src_dict, __pyx_v_c_dict);

    /* "src/lxml/proxy.pxi":514
 *         fixThreadDictNamesForAttributes(
 *             c_node.properties, c_src_dict, c_dict)
 *         fixThreadDictNsForNode(c_node, c_src_dict, c_dict)             # <<<<<<<<<<<<<<
 *         _fixThreadDictPtr(&c_node.name, c_src_dict, c_dict)
 *     elif c_node.type == tree.XML_TEXT_NODE:
*/
    __pyx_f_4lxml_5etree_fixThreadDictNsForNode(__pyx_v_c_node, __pyx_v_c_src_dict, __pyx_v_c_dict);

    /* "src/lxml/proxy.pxi":515
 *             c_node.properties, c_src_dict, c_dict)
 *         fixThreadDictNsForNode(c_node, c_src_dict, c_dict)
 *         _fixThreadDictPtr(&c_node.name, c_src_dict, c_dict)             # <<<<<<<<<<<<<<
 *     elif c_node.type == tree.XML_TEXT_NODE:
 *         # libxml2's SAX2 parser interns some indentation space
*/
    __pyx_f_4lxml_5etree__fixThreadDictPtr((&__pyx_v_c_node->name), __pyx_v_c_src_dict, __pyx_v_c_dict);

    /* "src/lxml/proxy.pxi":511
 *     cdef xmlNode* c_node = c_element
 *     tree.BEGIN_FOR_EACH_FROM(c_element, c_node, 1)
 *     if c_node.type in (tree.XML_ELEMENT_NODE, tree.XML_XINCLUDE_START):             # <<<<<<<<<<<<<<
 *         fixThreadDictNamesForAttributes(
 *             c_node.properties, c_src_dict, c_dict)
*/
    break;
    case XML_TEXT_NODE:

    /* "src/lxml/proxy.pxi":518
 *     elif c_node.type == tree.XML_TEXT_NODE:
 *         # libxml2's SAX2 parser interns some indentation space
 *         fixThreadDictContentForNode(c_node, c_src_dict, c_dict)             # <<<<<<<<<<<<<<
 *     elif c_node.type == tree.XML_COMMENT_NODE:
 *         pass  # don't touch c_node.name
*/
    __pyx_f_4lxml_5etree_fixThreadDictContentForNode(__pyx_v_c_node, __pyx_v_c_src_dict, __pyx_v_c_dict);

    /* "src/lxml/proxy.pxi":516
 *         fixThreadDictNsForNode(c_node, c_src_dict, c_dict)
 *         _fixThreadDictPtr(&c_node.name, c_src_dict, c_dict)
 *     elif c_node.type == tree.XML_TEXT_NODE:             # <<<<<<<<<<<<<<
 *         # libxml2's SAX2 parser interns some indentation space
 *         fixThreadDictContentForNode(c_node, c_src_dict, c_dict)
*/
    break;
    case XML_COMMENT_NODE:

    /* "src/lxml/proxy.pxi":519
 *         # libxml2's SAX2 parser interns some indentation space
 *         fixThreadDictContentForNode(c_node, c_src_dict, c_dict)
 *     elif c_node.type == tree.XML_COMMENT_NODE:             # <<<<<<<<<<<<<<
 *         pass  # don't touch c_node.name
 *     else:
*/
    break;
    default:

    /* "src/lxml/proxy.pxi":522
 *         pass  # don't touch c_node.name
 *     else:
 *         _fixThreadDictPtr(&c_node.name, c_src_dict, c_dict)             # <<<<<<<<<<<<<<
 *     tree.END_FOR_EACH_FROM(c_node)
 * 
*/
    __pyx_f_4lxml_5etree__fixThreadDictPtr((&__pyx_v_c_node->name), __pyx_v_c_src_dict, __pyx_v_c_dict);
    break;
  }

  /* "src/lxml/proxy.pxi":523
 *     else:
 *         _fixThreadDictPtr(&c_node.name, c_src_dict, c_dict)
 *     tree.END_FOR_EACH_FROM(c_node)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  END_FOR_EACH_FROM(__pyx_v_c_node);

  /* "src/lxml/proxy.pxi":506
 * 
 * 
 * cdef void fixThreadDictNamesForNode(xmlNode* c_element,             # <<<<<<<<<<<<<<
 *                                     tree.xmlDict* c_src_dict,
 *                                     tree.xmlDict* c_dict) noexcept nogil:
*/

  /* function exit code */
}

/* "src/lxml/proxy.pxi":526
 * 
 * 
 * cdef inline void fixThreadDictNamesForAttributes(tree.xmlAttr* c_attr,             # <<<<<<<<<<<<<<
 *                                                  tree.xmlDict* c_src_dict,
 *                                                  tree.xmlDict* c_dict) noexcept nogil:
*/

static CYTHON_INLINE void __pyx_f_4lxml_5etree_fixThreadDictNamesForAttributes(xmlAttr *__pyx_v_c_attr, xmlDict *__pyx_v_c_src_dict, xmlDict *__pyx_v_c_dict) {
  xmlNode *__pyx_v_c_child;
  xmlNode *__pyx_v_c_node;
  int __pyx_t_1;
  int __pyx_t_2;
  xmlNode *__pyx_t_3;

  /* "src/lxml/proxy.pxi":530
 *                                                  tree.xmlDict* c_dict) noexcept nogil:
 *     cdef xmlNode* c_child
 *     cdef xmlNode* c_node = <xmlNode*>c_attr             # <<<<<<<<<<<<<<
 *     while c_node is not NULL:
 *         if c_node.type not in (tree.XML_TEXT_NODE, tree.XML_COMMENT_NODE):
*/
  __pyx_v_c_node = ((xmlNode *)__pyx_v_c_attr);

  /* "src/lxml/proxy.pxi":531
 *     cdef xmlNode* c_child
 *     cdef xmlNode* c_node = <xmlNode*>c_attr
 *     while c_node is not NULL:             # <<<<<<<<<<<<<<
 *         if c_node.type not in (tree.XML_TEXT_NODE, tree.XML_COMMENT_NODE):
 *             _fixThreadDictPtr(&c_node.name, c_src_dict, c_dict)
*/
  while (1) {
    __pyx_t_1 = (__pyx_v_c_node != NULL);
    if (!__pyx_t_1) break;

    /* "src/lxml/proxy.pxi":532
 *     cdef xmlNode* c_node = <xmlNode*>c_attr
 *     while c_node is not NULL:
 *         if c_node.type not in (tree.XML_TEXT_NODE, tree.XML_COMMENT_NODE):             # <<<<<<<<<<<<<<
 *             _fixThreadDictPtr(&c_node.name, c_src_dict, c_dict)
 *         # libxml2 keeps some (!) attribute values in the dict
*/
    switch (__pyx_v_c_node->type) {
      case XML_TEXT_NODE:
      case XML_COMMENT_NODE:
      __pyx_t_1 = 0;
      break;
      default:
      __pyx_t_1 = 1;
      break;
    }
    __pyx_t_2 = __pyx_t_1;
    if (__pyx_t_2) {

      /* "src/lxml/proxy.pxi":533
 *     while c_node is not NULL:
 *         if c_node.type not in (tree.XML_TEXT_NODE, tree.XML_COMMENT_NODE):
 *             _fixThreadDictPtr(&c_node.name, c_src_dict, c_dict)             # <<<<<<<<<<<<<<
 *         # libxml2 keeps some (!) attribute values in the dict
 *         c_child = c_node.children
*/
      __pyx_f_4lxml_5etree__fixThreadDictPtr((&__pyx_v_c_node->name), __pyx_v_c_src_dict, __pyx_v_c_dict);

      /* "src/lxml/proxy.pxi":532
 *     cdef xmlNode* c_node = <xmlNode*>c_attr
 *     while c_node is not NULL:
 *         if c_node.type not in (tree.XML_TEXT_NODE, tree.XML_COMMENT_NODE):             # <<<<<<<<<<<<<<
 *             _fixThreadDictPtr(&c_node.name, c_src_dict, c_dict)
 *         # libxml2 keeps some (!) attribute values in the dict
*/
    }

    /* "src/lxml/proxy.pxi":535
 *             _fixThreadDictPtr(&c_node.name, c_src_dict, c_dict)
 *         # libxml2 keeps some (!) attribute values in the dict
 *         c_child = c_node.children             # <<<<<<<<<<<<<<
 *         while c_child is not NULL:
 *             fixThreadDictContentForNode(c_child, c_src_dict, c_dict)
*/
    __pyx_t_3 = __pyx_v_c_node->children;
    __pyx_v_c_child = __pyx_t_3;

    /* "src/lxml/proxy.pxi":536
 *         # libxml2 keeps some (!) attribute values in the dict
 *         c_child = c_node.children
 *         while c_child is not NULL:             # <<<<<<<<<<<<<<
 *             fixThreadDictContentForNode(c_child, c_src_dict, c_dict)
 *             c_child = c_child.next
*/
    while (1) {
      __pyx_t_2 = (__pyx_v_c_child != NULL);
      if (!__pyx_t_2) break;

      /* "src/lxml/proxy.pxi":537
 *         c_child = c_node.children
 *         while c_child is not NULL:
 *             fixThreadDictContentForNode(c_child, c_src_dict, c_dict)             # <<<<<<<<<<<<<<
 *             c_child = c_child.next
 *         c_node = c_node.next
*/
      __pyx_f_4lxml_5etree_fixThreadDictContentForNode(__pyx_v_c_child, __pyx_v_c_src_dict, __pyx_v_c_dict);

      /* "src/lxml/proxy.pxi":538
 *         while c_child is not NULL:
 *             fixThreadDictContentForNode(c_child, c_src_dict, c_dict)
 *             c_child = c_child.next             # <<<<<<<<<<<<<<
 *         c_node = c_node.next
 * 
*/
      __pyx_t_3 = __pyx_v_c_child->next;
      __pyx_v_c_child = __pyx_t_3;
    }

    /* "src/lxml/proxy.pxi":539
 *             fixThreadDictContentForNode(c_child, c_src_dict, c_dict)
 *             c_child = c_child.next
 *         c_node = c_node.next             # <<<<<<<<<<<<<<
 * 
 * 
*/
    __pyx_t_3 = __pyx_v_c_node->next;
    __pyx_v_c_node = __pyx_t_3;
  }

  /* "src/lxml/proxy.pxi":526
 * 
 * 
 * cdef inline void fixThreadDictNamesForAttributes(tree.xmlAttr* c_attr,             # <<<<<<<<<<<<<<
 *                                                  tree.xmlDict* c_src_dict,
 *                                                  tree.xmlDict* c_dict) noexcept nogil:
*/

  /* function exit code */
}

/* "src/lxml/proxy.pxi":542
 * 
 * 
 * cdef inline void fixThreadDictContentForNode(xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                                              tree.xmlDict* c_src_dict,
 *                                              tree.xmlDict* c_dict) noexcept nogil:
*/

static CYTHON_INLINE void __pyx_f_4lxml_5etree_fixThreadDictContentForNode(xmlNode *__pyx_v_c_node, xmlDict *__pyx_v_c_src_dict, xmlDict *__pyx_v_c_dict) {
  int __pyx_t_1;
  int __pyx_t_2;

  /* "src/lxml/proxy.pxi":545
 *                                              tree.xmlDict* c_src_dict,
 *                                              tree.xmlDict* c_dict) noexcept nogil:
 *     if c_node.content is not NULL and \             # <<<<<<<<<<<<<<
 *            c_node.content is not <xmlChar*>&c_node.properties:
 *         if tree.xmlDictOwns(c_src_dict, c_node.content):
*/
  __pyx_t_2 = (__pyx_v_c_node->content != NULL);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }

  /* "src/lxml/proxy.pxi":546
 *                                              tree.xmlDict* c_dict) noexcept nogil:
 *     if c_node.content is not NULL and \
 *            c_node.content is not <xmlChar*>&c_node.properties:             # <<<<<<<<<<<<<<
 *         if tree.xmlDictOwns(c_src_dict, c_node.content):
 *             # result can be NULL on memory error, but we don't handle that here
*/
  __pyx_t_2 = (__pyx_v_c_node->content != ((xmlChar *)(&__pyx_v_c_node->properties)));
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;

  /* "src/lxml/proxy.pxi":545
 *                                              tree.xmlDict* c_src_dict,
 *                                              tree.xmlDict* c_dict) noexcept nogil:
 *     if c_node.content is not NULL and \             # <<<<<<<<<<<<<<
 *            c_node.content is not <xmlChar*>&c_node.properties:
 *         if tree.xmlDictOwns(c_src_dict, c_node.content):
*/
  if (__pyx_t_1) {

    /* "src/lxml/proxy.pxi":547
 *     if c_node.content is not NULL and \
 *            c_node.content is not <xmlChar*>&c_node.properties:
 *         if tree.xmlDictOwns(c_src_dict, c_node.content):             # <<<<<<<<<<<<<<
 *             # result can be NULL on memory error, but we don't handle that here
 *             c_node.content = <xmlChar*>tree.xmlDictLookup(c_dict, c_node.content, -1)
*/
    __pyx_t_1 = (xmlDictOwns(__pyx_v_c_src_dict, __pyx_v_c_node->content) != 0);
    if (__pyx_t_1) {

      /* "src/lxml/proxy.pxi":549
 *         if tree.xmlDictOwns(c_src_dict, c_node.content):
 *             # result can be NULL on memory error, but we don't handle that here
 *             c_node.content = <xmlChar*>tree.xmlDictLookup(c_dict, c_node.content, -1)             # <<<<<<<<<<<<<<
 * 
 * 
*/
      __pyx_v_c_node->content = ((xmlChar *)xmlDictLookup(__pyx_v_c_dict, __pyx_v_c_node->content, -1));

      /* "src/lxml/proxy.pxi":547
 *     if c_node.content is not NULL and \
 *            c_node.content is not <xmlChar*>&c_node.properties:
 *         if tree.xmlDictOwns(c_src_dict, c_node.content):             # <<<<<<<<<<<<<<
 *             # result can be NULL on memory error, but we don't handle that here
 *             c_node.content = <xmlChar*>tree.xmlDictLookup(c_dict, c_node.content, -1)
*/
    }

    /* "src/lxml/proxy.pxi":545
 *                                              tree.xmlDict* c_src_dict,
 *                                              tree.xmlDict* c_dict) noexcept nogil:
 *     if c_node.content is not NULL and \             # <<<<<<<<<<<<<<
 *            c_node.content is not <xmlChar*>&c_node.properties:
 *         if tree.xmlDictOwns(c_src_dict, c_node.content):
*/
  }

  /* "src/lxml/proxy.pxi":542
 * 
 * 
 * cdef inline void fixThreadDictContentForNode(xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                                              tree.xmlDict* c_src_dict,
 *                                              tree.xmlDict* c_dict) noexcept nogil:
*/

  /* function exit code */
}

/* "src/lxml/proxy.pxi":552
 * 
 * 
 * cdef inline void fixThreadDictNsForNode(xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                                         tree.xmlDict* c_src_dict,
 *                                         tree.xmlDict* c_dict) noexcept nogil:
*/

static CYTHON_INLINE void __pyx_f_4lxml_5etree_fixThreadDictNsForNode(xmlNode *__pyx_v_c_node, xmlDict *__pyx_v_c_src_dict, xmlDict *__pyx_v_c_dict) {
  xmlNs *__pyx_v_c_ns;
  xmlNs *__pyx_t_1;
  int __pyx_t_2;

  /* "src/lxml/proxy.pxi":555
 *                                         tree.xmlDict* c_src_dict,
 *                                         tree.xmlDict* c_dict) noexcept nogil:
 *     cdef xmlNs* c_ns = c_node.nsDef             # <<<<<<<<<<<<<<
 *     while c_ns is not NULL:
 *         _fixThreadDictPtr(&c_ns.href, c_src_dict, c_dict)
*/
  __pyx_t_1 = __pyx_v_c_node->nsDef;
  __pyx_v_c_ns = __pyx_t_1;

  /* "src/lxml/proxy.pxi":556
 *                                         tree.xmlDict* c_dict) noexcept nogil:
 *     cdef xmlNs* c_ns = c_node.nsDef
 *     while c_ns is not NULL:             # <<<<<<<<<<<<<<
 *         _fixThreadDictPtr(&c_ns.href, c_src_dict, c_dict)
 *         _fixThreadDictPtr(&c_ns.prefix, c_src_dict, c_dict)
*/
  while (1) {
    __pyx_t_2 = (__pyx_v_c_ns != NULL);
    if (!__pyx_t_2) break;

    /* "src/lxml/proxy.pxi":557
 *     cdef xmlNs* c_ns = c_node.nsDef
 *     while c_ns is not NULL:
 *         _fixThreadDictPtr(&c_ns.href, c_src_dict, c_dict)             # <<<<<<<<<<<<<<
 *         _fixThreadDictPtr(&c_ns.prefix, c_src_dict, c_dict)
 *         c_ns = c_ns.next
*/
    __pyx_f_4lxml_5etree__fixThreadDictPtr((&__pyx_v_c_ns->href), __pyx_v_c_src_dict, __pyx_v_c_dict);

    /* "src/lxml/proxy.pxi":558
 *     while c_ns is not NULL:
 *         _fixThreadDictPtr(&c_ns.href, c_src_dict, c_dict)
 *         _fixThreadDictPtr(&c_ns.prefix, c_src_dict, c_dict)             # <<<<<<<<<<<<<<
 *         c_ns = c_ns.next
 * 
*/
    __pyx_f_4lxml_5etree__fixThreadDictPtr((&__pyx_v_c_ns->prefix), __pyx_v_c_src_dict, __pyx_v_c_dict);

    /* "src/lxml/proxy.pxi":559
 *         _fixThreadDictPtr(&c_ns.href, c_src_dict, c_dict)
 *         _fixThreadDictPtr(&c_ns.prefix, c_src_dict, c_dict)
 *         c_ns = c_ns.next             # <<<<<<<<<<<<<<
 * 
 * 
*/
    __pyx_t_1 = __pyx_v_c_ns->next;
    __pyx_v_c_ns = __pyx_t_1;
  }

  /* "src/lxml/proxy.pxi":552
 * 
 * 
 * cdef inline void fixThreadDictNsForNode(xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                                         tree.xmlDict* c_src_dict,
 *                                         tree.xmlDict* c_dict) noexcept nogil:
*/

  /* function exit code */
}

/* "src/lxml/proxy.pxi":562
 * 
 * 
 * cdef void fixThreadDictNamesForDtd(tree.xmlDtd* c_dtd,             # <<<<<<<<<<<<<<
 *                                    tree.xmlDict* c_src_dict,
 *                                    tree.xmlDict* c_dict) noexcept nogil:
*/

static void __pyx_f_4lxml_5etree_fixThreadDictNamesForDtd(xmlDtd *__pyx_v_c_dtd, xmlDict *__pyx_v_c_src_dict, xmlDict *__pyx_v_c_dict) {
  xmlNode *__pyx_v_c_node;
  xmlElement *__pyx_v_c_element;
  xmlAttribute *__pyx_v_c_attribute;
  xmlEntity *__pyx_v_c_entity;
  xmlNode *__pyx_t_1;
  int __pyx_t_2;
  xmlAttribute *__pyx_t_3;

  /* "src/lxml/proxy.pxi":570
 *     cdef tree.xmlEntity* c_entity
 * 
 *     c_node = c_dtd.children             # <<<<<<<<<<<<<<
 *     while c_node:
 *         if c_node.type == tree.XML_ELEMENT_DECL:
*/
  __pyx_t_1 = __pyx_v_c_dtd->children;
  __pyx_v_c_node = __pyx_t_1;

  /* "src/lxml/proxy.pxi":571
 * 
 *     c_node = c_dtd.children
 *     while c_node:             # <<<<<<<<<<<<<<
 *         if c_node.type == tree.XML_ELEMENT_DECL:
 *             c_element = <tree.xmlElement*>c_node
*/
  while (1) {
    __pyx_t_2 = (__pyx_v_c_node != 0);
    if (!__pyx_t_2) break;

    /* "src/lxml/proxy.pxi":572
 *     c_node = c_dtd.children
 *     while c_node:
 *         if c_node.type == tree.XML_ELEMENT_DECL:             # <<<<<<<<<<<<<<
 *             c_element = <tree.xmlElement*>c_node
 *             if c_element.content:
*/
    switch (__pyx_v_c_node->type) {
      case XML_ELEMENT_DECL:

      /* "src/lxml/proxy.pxi":573
 *     while c_node:
 *         if c_node.type == tree.XML_ELEMENT_DECL:
 *             c_element = <tree.xmlElement*>c_node             # <<<<<<<<<<<<<<
 *             if c_element.content:
 *                 _fixThreadDictPtr(&c_element.content.name, c_src_dict, c_dict)
*/
      __pyx_v_c_element = ((xmlElement *)__pyx_v_c_node);

      /* "src/lxml/proxy.pxi":574
 *         if c_node.type == tree.XML_ELEMENT_DECL:
 *             c_element = <tree.xmlElement*>c_node
 *             if c_element.content:             # <<<<<<<<<<<<<<
 *                 _fixThreadDictPtr(&c_element.content.name, c_src_dict, c_dict)
 *                 _fixThreadDictPtr(&c_element.content.prefix, c_src_dict, c_dict)
*/
      __pyx_t_2 = (__pyx_v_c_element->content != 0);
      if (__pyx_t_2) {

        /* "src/lxml/proxy.pxi":575
 *             c_element = <tree.xmlElement*>c_node
 *             if c_element.content:
 *                 _fixThreadDictPtr(&c_element.content.name, c_src_dict, c_dict)             # <<<<<<<<<<<<<<
 *                 _fixThreadDictPtr(&c_element.content.prefix, c_src_dict, c_dict)
 *             c_attribute = c_element.attributes
*/
        __pyx_f_4lxml_5etree__fixThreadDictPtr((&__pyx_v_c_element->content->name), __pyx_v_c_src_dict, __pyx_v_c_dict);

        /* "src/lxml/proxy.pxi":576
 *             if c_element.content:
 *                 _fixThreadDictPtr(&c_element.content.name, c_src_dict, c_dict)
 *                 _fixThreadDictPtr(&c_element.content.prefix, c_src_dict, c_dict)             # <<<<<<<<<<<<<<
 *             c_attribute = c_element.attributes
 *             while c_attribute:
*/
        __pyx_f_4lxml_5etree__fixThreadDictPtr((&__pyx_v_c_element->content->prefix), __pyx_v_c_src_dict, __pyx_v_c_dict);

        /* "src/lxml/proxy.pxi":574
 *         if c_node.type == tree.XML_ELEMENT_DECL:
 *             c_element = <tree.xmlElement*>c_node
 *             if c_element.content:             # <<<<<<<<<<<<<<
 *                 _fixThreadDictPtr(&c_element.content.name, c_src_dict, c_dict)
 *                 _fixThreadDictPtr(&c_element.content.prefix, c_src_dict, c_dict)
*/
      }

      /* "src/lxml/proxy.pxi":577
 *                 _fixThreadDictPtr(&c_element.content.name, c_src_dict, c_dict)
 *                 _fixThreadDictPtr(&c_element.content.prefix, c_src_dict, c_dict)
 *             c_attribute = c_element.attributes             # <<<<<<<<<<<<<<
 *             while c_attribute:
 *                 if tree.LIBXML_VERSION < 21500:
*/
      __pyx_t_3 = __pyx_v_c_element->attributes;
      __pyx_v_c_attribute = __pyx_t_3;

      /* "src/lxml/proxy.pxi":578
 *                 _fixThreadDictPtr(&c_element.content.prefix, c_src_dict, c_dict)
 *             c_attribute = c_element.attributes
 *             while c_attribute:             # <<<<<<<<<<<<<<
 *                 if tree.LIBXML_VERSION < 21500:
 *                     # libxml2 2.15 no longer stores default values in the dict.
*/
      while (1) {
        __pyx_t_2 = (__pyx_v_c_attribute != 0);
        if (!__pyx_t_2) break;

        /* "src/lxml/proxy.pxi":579
 *             c_attribute = c_element.attributes
 *             while c_attribute:
 *                 if tree.LIBXML_VERSION < 21500:             # <<<<<<<<<<<<<<
 *                     # libxml2 2.15 no longer stores default values in the dict.
 *                     # See https://gitlab.gnome.org/GNOME/libxml2/-/commit/24628f25
*/
        __pyx_t_2 = (LIBXML_VERSION < 0x53FC);
        if (__pyx_t_2) {

          /* "src/lxml/proxy.pxi":582
 *                     # libxml2 2.15 no longer stores default values in the dict.
 *                     # See https://gitlab.gnome.org/GNOME/libxml2/-/commit/24628f25
 *                     _fixThreadDictPtr(<const_xmlChar**>&c_attribute.defaultValue, c_src_dict, c_dict)             # <<<<<<<<<<<<<<
 *                 _fixThreadDictPtr(&c_attribute.name, c_src_dict, c_dict)
 *                 _fixThreadDictPtr(&c_attribute.prefix, c_src_dict, c_dict)
*/
          __pyx_f_4lxml_5etree__fixThreadDictPtr(((const xmlChar **)(&__pyx_v_c_attribute->defaultValue)), __pyx_v_c_src_dict, __pyx_v_c_dict);

          /* "src/lxml/proxy.pxi":579
 *             c_attribute = c_element.attributes
 *             while c_attribute:
 *                 if tree.LIBXML_VERSION < 21500:             # <<<<<<<<<<<<<<
 *                     # libxml2 2.15 no longer stores default values in the dict.
 *                     # See https://gitlab.gnome.org/GNOME/libxml2/-/commit/24628f25
*/
        }

        /* "src/lxml/proxy.pxi":583
 *                     # See https://gitlab.gnome.org/GNOME/libxml2/-/commit/24628f25
 *                     _fixThreadDictPtr(<const_xmlChar**>&c_attribute.defaultValue, c_src_dict, c_dict)
 *                 _fixThreadDictPtr(&c_attribute.name, c_src_dict, c_dict)             # <<<<<<<<<<<<<<
 *                 _fixThreadDictPtr(&c_attribute.prefix, c_src_dict, c_dict)
 *                 _fixThreadDictPtr(&c_attribute.elem, c_src_dict, c_dict)
*/
        __pyx_f_4lxml_5etree__fixThreadDictPtr((&__pyx_v_c_attribute->name), __pyx_v_c_src_dict, __pyx_v_c_dict);

        /* "src/lxml/proxy.pxi":584
 *                     _fixThreadDictPtr(<const_xmlChar**>&c_attribute.defaultValue, c_src_dict, c_dict)
 *                 _fixThreadDictPtr(&c_attribute.name, c_src_dict, c_dict)
 *                 _fixThreadDictPtr(&c_attribute.prefix, c_src_dict, c_dict)             # <<<<<<<<<<<<<<
 *                 _fixThreadDictPtr(&c_attribute.elem, c_src_dict, c_dict)
 *                 c_attribute = c_attribute.nexth
*/
        __pyx_f_4lxml_5etree__fixThreadDictPtr((&__pyx_v_c_attribute->prefix), __pyx_v_c_src_dict, __pyx_v_c_dict);

        /* "src/lxml/proxy.pxi":585
 *                 _fixThreadDictPtr(&c_attribute.name, c_src_dict, c_dict)
 *                 _fixThreadDictPtr(&c_attribute.prefix, c_src_dict, c_dict)
 *                 _fixThreadDictPtr(&c_attribute.elem, c_src_dict, c_dict)             # <<<<<<<<<<<<<<
 *                 c_attribute = c_attribute.nexth
 *         elif c_node.type == tree.XML_ENTITY_DECL:
*/
        __pyx_f_4lxml_5etree__fixThreadDictPtr((&__pyx_v_c_attribute->elem), __pyx_v_c_src_dict, __pyx_v_c_dict);

        /* "src/lxml/proxy.pxi":586
 *                 _fixThreadDictPtr(&c_attribute.prefix, c_src_dict, c_dict)
 *                 _fixThreadDictPtr(&c_attribute.elem, c_src_dict, c_dict)
 *                 c_attribute = c_attribute.nexth             # <<<<<<<<<<<<<<
 *         elif c_node.type == tree.XML_ENTITY_DECL:
 *             c_entity = <tree.xmlEntity*>c_node
*/
        __pyx_t_3 = __pyx_v_c_attribute->nexth;
        __pyx_v_c_attribute = __pyx_t_3;
      }

      /* "src/lxml/proxy.pxi":572
 *     c_node = c_dtd.children
 *     while c_node:
 *         if c_node.type == tree.XML_ELEMENT_DECL:             # <<<<<<<<<<<<<<
 *             c_element = <tree.xmlElement*>c_node
 *             if c_element.content:
*/
      break;
      case XML_ENTITY_DECL:

      /* "src/lxml/proxy.pxi":588
 *                 c_attribute = c_attribute.nexth
 *         elif c_node.type == tree.XML_ENTITY_DECL:
 *             c_entity = <tree.xmlEntity*>c_node             # <<<<<<<<<<<<<<
 *             _fixThreadDictPtr(&c_entity.name, c_src_dict, c_dict)
 *             _fixThreadDictPtr(&c_entity.ExternalID, c_src_dict, c_dict)
*/
      __pyx_v_c_entity = ((xmlEntity *)__pyx_v_c_node);

      /* "src/lxml/proxy.pxi":589
 *         elif c_node.type == tree.XML_ENTITY_DECL:
 *             c_entity = <tree.xmlEntity*>c_node
 *             _fixThreadDictPtr(&c_entity.name, c_src_dict, c_dict)             # <<<<<<<<<<<<<<
 *             _fixThreadDictPtr(&c_entity.ExternalID, c_src_dict, c_dict)
 *             _fixThreadDictPtr(&c_entity.SystemID, c_src_dict, c_dict)
*/
      __pyx_f_4lxml_5etree__fixThreadDictPtr((&__pyx_v_c_entity->name), __pyx_v_c_src_dict, __pyx_v_c_dict);

      /* "src/lxml/proxy.pxi":590
 *             c_entity = <tree.xmlEntity*>c_node
 *             _fixThreadDictPtr(&c_entity.name, c_src_dict, c_dict)
 *             _fixThreadDictPtr(&c_entity.ExternalID, c_src_dict, c_dict)             # <<<<<<<<<<<<<<
 *             _fixThreadDictPtr(&c_entity.SystemID, c_src_dict, c_dict)
 *             _fixThreadDictPtr(<const_xmlChar**>&c_entity.content, c_src_dict, c_dict)
*/
      __pyx_f_4lxml_5etree__fixThreadDictPtr((&__pyx_v_c_entity->ExternalID), __pyx_v_c_src_dict, __pyx_v_c_dict);

      /* "src/lxml/proxy.pxi":591
 *             _fixThreadDictPtr(&c_entity.name, c_src_dict, c_dict)
 *             _fixThreadDictPtr(&c_entity.ExternalID, c_src_dict, c_dict)
 *             _fixThreadDictPtr(&c_entity.SystemID, c_src_dict, c_dict)             # <<<<<<<<<<<<<<
 *             _fixThreadDictPtr(<const_xmlChar**>&c_entity.content, c_src_dict, c_dict)
 *         c_node = c_node.next
*/
      __pyx_f_4lxml_5etree__fixThreadDictPtr((&__pyx_v_c_entity->SystemID), __pyx_v_c_src_dict, __pyx_v_c_dict);

      /* "src/lxml/proxy.pxi":592
 *             _fixThreadDictPtr(&c_entity.ExternalID, c_src_dict, c_dict)
 *             _fixThreadDictPtr(&c_entity.SystemID, c_src_dict, c_dict)
 *             _fixThreadDictPtr(<const_xmlChar**>&c_entity.content, c_src_dict, c_dict)             # <<<<<<<<<<<<<<
 *         c_node = c_node.next
 * 
*/
      __pyx_f_4lxml_5etree__fixThreadDictPtr(((const xmlChar **)(&__pyx_v_c_entity->content)), __pyx_v_c_src_dict, __pyx_v_c_dict);

      /* "src/lxml/proxy.pxi":587
 *                 _fixThreadDictPtr(&c_attribute.elem, c_src_dict, c_dict)
 *                 c_attribute = c_attribute.nexth
 *         elif c_node.type == tree.XML_ENTITY_DECL:             # <<<<<<<<<<<<<<
 *             c_entity = <tree.xmlEntity*>c_node
 *             _fixThreadDictPtr(&c_entity.name, c_src_dict, c_dict)
*/
      break;
      default: break;
    }

    /* "src/lxml/proxy.pxi":593
 *             _fixThreadDictPtr(&c_entity.SystemID, c_src_dict, c_dict)
 *             _fixThreadDictPtr(<const_xmlChar**>&c_entity.content, c_src_dict, c_dict)
 *         c_node = c_node.next             # <<<<<<<<<<<<<<
 * 
 * 
*/
    __pyx_t_1 = __pyx_v_c_node->next;
    __pyx_v_c_node = __pyx_t_1;
  }

  /* "src/lxml/proxy.pxi":562
 * 
 * 
 * cdef void fixThreadDictNamesForDtd(tree.xmlDtd* c_dtd,             # <<<<<<<<<<<<<<
 *                                    tree.xmlDict* c_src_dict,
 *                                    tree.xmlDict* c_dict) noexcept nogil:
*/

  /* function exit code */
}

/* "src/lxml/proxy.pxi":599
 * # adopt an xmlDoc from an external libxml2 document source
 * 
 * cdef _Document _adoptForeignDoc(xmlDoc* c_doc, _BaseParser parser=None, bint is_owned=True):             # <<<<<<<<<<<<<<
 *     """Convert and wrap an externally produced xmlDoc for use in lxml.
 *     Assures that all '_private' pointers are NULL to prevent accidental
*/

static struct LxmlDocument *__pyx_f_4lxml_5etree__adoptForeignDoc(xmlDoc *__pyx_v_c_doc, struct __pyx_opt_args_4lxml_5etree__adoptForeignDoc *__pyx_optional_args) {
  struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None);
  int __pyx_v_is_owned = ((int)1);
  xmlElementType __pyx_v_doc_type;
  xmlNode *__pyx_v_c_node;
  struct LxmlDocument *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_t_5;
  xmlElementType __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_adoptForeignDoc", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_parser = __pyx_optional_args->parser;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_is_owned = __pyx_optional_args->is_owned;
      }
    }
  }

  /* "src/lxml/proxy.pxi":604
 *     dereference into lxml proxy objects.
 *     """
 *     if c_doc is NULL:             # <<<<<<<<<<<<<<
 *         raise ValueError("Illegal document provided: NULL")
 *     if c_doc.type not in (tree.XML_DOCUMENT_NODE, tree.XML_HTML_DOCUMENT_NODE):
*/
  __pyx_t_1 = (__pyx_v_c_doc == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/proxy.pxi":605
 *     """
 *     if c_doc is NULL:
 *         raise ValueError("Illegal document provided: NULL")             # <<<<<<<<<<<<<<
 *     if c_doc.type not in (tree.XML_DOCUMENT_NODE, tree.XML_HTML_DOCUMENT_NODE):
 *         doc_type = c_doc.type
*/
    __pyx_t_3 = NULL;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Illegal_document_provided_NULL};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 605, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(8, 605, __pyx_L1_error)

    /* "src/lxml/proxy.pxi":604
 *     dereference into lxml proxy objects.
 *     """
 *     if c_doc is NULL:             # <<<<<<<<<<<<<<
 *         raise ValueError("Illegal document provided: NULL")
 *     if c_doc.type not in (tree.XML_DOCUMENT_NODE, tree.XML_HTML_DOCUMENT_NODE):
*/
  }

  /* "src/lxml/proxy.pxi":606
 *     if c_doc is NULL:
 *         raise ValueError("Illegal document provided: NULL")
 *     if c_doc.type not in (tree.XML_DOCUMENT_NODE, tree.XML_HTML_DOCUMENT_NODE):             # <<<<<<<<<<<<<<
 *         doc_type = c_doc.type
 *         if is_owned:
*/
  switch (__pyx_v_c_doc->type) {
    case XML_DOCUMENT_NODE:
    case XML_HTML_DOCUMENT_NODE:
    __pyx_t_1 = 0;
    break;
    default:
    __pyx_t_1 = 1;
    break;
  }
  __pyx_t_5 = __pyx_t_1;
  if (__pyx_t_5) {

    /* "src/lxml/proxy.pxi":607
 *         raise ValueError("Illegal document provided: NULL")
 *     if c_doc.type not in (tree.XML_DOCUMENT_NODE, tree.XML_HTML_DOCUMENT_NODE):
 *         doc_type = c_doc.type             # <<<<<<<<<<<<<<
 *         if is_owned:
 *             tree.xmlFreeDoc(c_doc)
*/
    __pyx_t_6 = __pyx_v_c_doc->type;
    __pyx_v_doc_type = __pyx_t_6;

    /* "src/lxml/proxy.pxi":608
 *     if c_doc.type not in (tree.XML_DOCUMENT_NODE, tree.XML_HTML_DOCUMENT_NODE):
 *         doc_type = c_doc.type
 *         if is_owned:             # <<<<<<<<<<<<<<
 *             tree.xmlFreeDoc(c_doc)
 *         raise ValueError(f"Illegal document provided: expected XML or HTML, found {doc_type}")
*/
    if (__pyx_v_is_owned) {

      /* "src/lxml/proxy.pxi":609
 *         doc_type = c_doc.type
 *         if is_owned:
 *             tree.xmlFreeDoc(c_doc)             # <<<<<<<<<<<<<<
 *         raise ValueError(f"Illegal document provided: expected XML or HTML, found {doc_type}")
 * 
*/
      xmlFreeDoc(__pyx_v_c_doc);

      /* "src/lxml/proxy.pxi":608
 *     if c_doc.type not in (tree.XML_DOCUMENT_NODE, tree.XML_HTML_DOCUMENT_NODE):
 *         doc_type = c_doc.type
 *         if is_owned:             # <<<<<<<<<<<<<<
 *             tree.xmlFreeDoc(c_doc)
 *         raise ValueError(f"Illegal document provided: expected XML or HTML, found {doc_type}")
*/
    }

    /* "src/lxml/proxy.pxi":610
 *         if is_owned:
 *             tree.xmlFreeDoc(c_doc)
 *         raise ValueError(f"Illegal document provided: expected XML or HTML, found {doc_type}")             # <<<<<<<<<<<<<<
 * 
 *     cdef xmlNode* c_node = <xmlNode*>c_doc
*/
    __pyx_t_3 = NULL;
    __pyx_t_7 = __Pyx_PyUnicode_From_xmlElementType(__pyx_v_doc_type, 0, ' ', 'd'); if (unlikely(!__pyx_t_7)) __PYX_ERR(8, 610, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_Illegal_document_provided_expect, __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(8, 610, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_8};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 610, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(8, 610, __pyx_L1_error)

    /* "src/lxml/proxy.pxi":606
 *     if c_doc is NULL:
 *         raise ValueError("Illegal document provided: NULL")
 *     if c_doc.type not in (tree.XML_DOCUMENT_NODE, tree.XML_HTML_DOCUMENT_NODE):             # <<<<<<<<<<<<<<
 *         doc_type = c_doc.type
 *         if is_owned:
*/
  }

  /* "src/lxml/proxy.pxi":612
 *         raise ValueError(f"Illegal document provided: expected XML or HTML, found {doc_type}")
 * 
 *     cdef xmlNode* c_node = <xmlNode*>c_doc             # <<<<<<<<<<<<<<
 * 
 *     if is_owned:
*/
  __pyx_v_c_node = ((xmlNode *)__pyx_v_c_doc);

  /* "src/lxml/proxy.pxi":614
 *     cdef xmlNode* c_node = <xmlNode*>c_doc
 * 
 *     if is_owned:             # <<<<<<<<<<<<<<
 *         tree.BEGIN_FOR_EACH_FROM(<xmlNode*>c_doc, c_node, 1)
 *         c_node._private = NULL
*/
  if (__pyx_v_is_owned) {

    /* "src/lxml/proxy.pxi":615
 * 
 *     if is_owned:
 *         tree.BEGIN_FOR_EACH_FROM(<xmlNode*>c_doc, c_node, 1)             # <<<<<<<<<<<<<<
 *         c_node._private = NULL
 *         tree.END_FOR_EACH_FROM(c_node)
*/
    BEGIN_FOR_EACH_FROM(((xmlNode *)__pyx_v_c_doc), __pyx_v_c_node, 1);

    /* "src/lxml/proxy.pxi":616
 *     if is_owned:
 *         tree.BEGIN_FOR_EACH_FROM(<xmlNode*>c_doc, c_node, 1)
 *         c_node._private = NULL             # <<<<<<<<<<<<<<
 *         tree.END_FOR_EACH_FROM(c_node)
 *     else:
*/
    __pyx_v_c_node->_private = NULL;

    /* "src/lxml/proxy.pxi":617
 *         tree.BEGIN_FOR_EACH_FROM(<xmlNode*>c_doc, c_node, 1)
 *         c_node._private = NULL
 *         tree.END_FOR_EACH_FROM(c_node)             # <<<<<<<<<<<<<<
 *     else:
 *         # create a fresh copy that lxml owns
*/
    END_FOR_EACH_FROM(__pyx_v_c_node);

    /* "src/lxml/proxy.pxi":614
 *     cdef xmlNode* c_node = <xmlNode*>c_doc
 * 
 *     if is_owned:             # <<<<<<<<<<<<<<
 *         tree.BEGIN_FOR_EACH_FROM(<xmlNode*>c_doc, c_node, 1)
 *         c_node._private = NULL
*/
    goto __pyx_L6;
  }

  /* "src/lxml/proxy.pxi":620
 *     else:
 *         # create a fresh copy that lxml owns
 *         c_doc = tree.xmlCopyDoc(c_doc, 1)             # <<<<<<<<<<<<<<
 *         if c_doc is NULL:
 *             raise MemoryError()
*/
  /*else*/ {
    __pyx_v_c_doc = xmlCopyDoc(__pyx_v_c_doc, 1);

    /* "src/lxml/proxy.pxi":621
 *         # create a fresh copy that lxml owns
 *         c_doc = tree.xmlCopyDoc(c_doc, 1)
 *         if c_doc is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 * 
*/
    __pyx_t_5 = (__pyx_v_c_doc == NULL);
    if (unlikely(__pyx_t_5)) {

      /* "src/lxml/proxy.pxi":622
 *         c_doc = tree.xmlCopyDoc(c_doc, 1)
 *         if c_doc is NULL:
 *             raise MemoryError()             # <<<<<<<<<<<<<<
 * 
 *     return _documentFactory(c_doc, parser)
*/
      PyErr_NoMemory(); __PYX_ERR(8, 622, __pyx_L1_error)

      /* "src/lxml/proxy.pxi":621
 *         # create a fresh copy that lxml owns
 *         c_doc = tree.xmlCopyDoc(c_doc, 1)
 *         if c_doc is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 * 
*/
    }
  }
  __pyx_L6:;

  /* "src/lxml/proxy.pxi":624
 *             raise MemoryError()
 * 
 *     return _documentFactory(c_doc, parser)             # <<<<<<<<<<<<<<
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, __pyx_v_parser)); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 624, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = ((struct LxmlDocument *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/proxy.pxi":599
 * # adopt an xmlDoc from an external libxml2 document source
 * 
 * cdef _Document _adoptForeignDoc(xmlDoc* c_doc, _BaseParser parser=None, bint is_owned=True):             # <<<<<<<<<<<<<<
 *     """Convert and wrap an externally produced xmlDoc for use in lxml.
 *     Assures that all '_private' pointers are NULL to prevent accidental
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("lxml.etree._adoptForeignDoc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":6
 * 
 * 
 * cdef void displayNode(xmlNode* c_node, indent) noexcept:             # <<<<<<<<<<<<<<
 *     # to help with debugging
 *     cdef xmlNode* c_child
*/

static void __pyx_f_4lxml_5etree_displayNode(xmlNode *__pyx_v_c_node, PyObject *__pyx_v_indent) {
  xmlNode *__pyx_v_c_child;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  xmlNode *__pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("displayNode", 0);

  /* "src/lxml/apihelpers.pxi":9
 *     # to help with debugging
 *     cdef xmlNode* c_child
 *     try:             # <<<<<<<<<<<<<<
 *         print(indent * ' ', <long>c_node)
 *         c_child = c_node.children
*/
  /*try:*/ {

    /* "src/lxml/apihelpers.pxi":10
 *     cdef xmlNode* c_child
 *     try:
 *         print(indent * ' ', <long>c_node)             # <<<<<<<<<<<<<<
 *         c_child = c_node.children
 *         while c_child is not NULL:
*/
    __pyx_t_2 = NULL;
    __pyx_t_3 = PyNumber_Multiply(__pyx_v_indent, __pyx_mstate_global->__pyx_kp_u__7); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 10, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyLong_From_long(((long)__pyx_v_c_node)); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 10, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_t_3, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_print, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 10, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "src/lxml/apihelpers.pxi":11
 *     try:
 *         print(indent * ' ', <long>c_node)
 *         c_child = c_node.children             # <<<<<<<<<<<<<<
 *         while c_child is not NULL:
 *             displayNode(c_child, indent + 1)
*/
    __pyx_t_6 = __pyx_v_c_node->children;
    __pyx_v_c_child = __pyx_t_6;

    /* "src/lxml/apihelpers.pxi":12
 *         print(indent * ' ', <long>c_node)
 *         c_child = c_node.children
 *         while c_child is not NULL:             # <<<<<<<<<<<<<<
 *             displayNode(c_child, indent + 1)
 *             c_child = c_child.next
*/
    while (1) {
      __pyx_t_7 = (__pyx_v_c_child != NULL);
      if (!__pyx_t_7) break;

      /* "src/lxml/apihelpers.pxi":13
 *         c_child = c_node.children
 *         while c_child is not NULL:
 *             displayNode(c_child, indent + 1)             # <<<<<<<<<<<<<<
 *             c_child = c_child.next
 *     finally:
*/
      __pyx_t_1 = __Pyx_PyLong_AddObjC(__pyx_v_indent, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_f_4lxml_5etree_displayNode(__pyx_v_c_child, __pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "src/lxml/apihelpers.pxi":14
 *         while c_child is not NULL:
 *             displayNode(c_child, indent + 1)
 *             c_child = c_child.next             # <<<<<<<<<<<<<<
 *     finally:
 *         return  # swallow any exceptions
*/
      __pyx_t_6 = __pyx_v_c_child->next;
      __pyx_v_c_child = __pyx_t_6;
    }
  }

  /* "src/lxml/apihelpers.pxi":16
 *             c_child = c_child.next
 *     finally:
 *         return  # swallow any exceptions             # <<<<<<<<<<<<<<
 * 
 * cdef inline bint _isHtmlDocument(_Element element) except -1:
*/
  /*finally:*/ {
    /*normal exit:*/{
      goto __pyx_L0;
    }
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
      if ( unlikely(__Pyx_GetException(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10) < 0)) __Pyx_ErrFetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      {
        goto __pyx_L8_return;
      }
      __pyx_L8_return:;
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
      goto __pyx_L0;
    }
  }

  /* "src/lxml/apihelpers.pxi":6
 * 
 * 
 * cdef void displayNode(xmlNode* c_node, indent) noexcept:             # <<<<<<<<<<<<<<
 *     # to help with debugging
 *     cdef xmlNode* c_child
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "src/lxml/apihelpers.pxi":18
 *         return  # swallow any exceptions
 * 
 * cdef inline bint _isHtmlDocument(_Element element) except -1:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node = element._c_node
 *     return (
*/

static CYTHON_INLINE int __pyx_f_4lxml_5etree__isHtmlDocument(struct LxmlElement *__pyx_v_element) {
  xmlNode *__pyx_v_c_node;
  int __pyx_r;
  xmlNode *__pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;

  /* "src/lxml/apihelpers.pxi":19
 * 
 * cdef inline bint _isHtmlDocument(_Element element) except -1:
 *     cdef xmlNode* c_node = element._c_node             # <<<<<<<<<<<<<<
 *     return (
 *         c_node is not NULL and c_node.doc is not NULL and
*/
  __pyx_t_1 = __pyx_v_element->_c_node;
  __pyx_v_c_node = __pyx_t_1;

  /* "src/lxml/apihelpers.pxi":21
 *     cdef xmlNode* c_node = element._c_node
 *     return (
 *         c_node is not NULL and c_node.doc is not NULL and             # <<<<<<<<<<<<<<
 *         c_node.doc.properties & tree.XML_DOC_HTML != 0
 *     )
*/
  __pyx_t_3 = (__pyx_v_c_node != NULL);
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L3_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_c_node->doc != NULL);
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L3_bool_binop_done;
  }

  /* "src/lxml/apihelpers.pxi":22
 *     return (
 *         c_node is not NULL and c_node.doc is not NULL and
 *         c_node.doc.properties & tree.XML_DOC_HTML != 0             # <<<<<<<<<<<<<<
 *     )
 * 
*/
  __pyx_t_3 = ((__pyx_v_c_node->doc->properties & XML_DOC_HTML) != 0);
  __pyx_t_2 = __pyx_t_3;
  __pyx_L3_bool_binop_done:;
  __pyx_r = __pyx_t_2;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":18
 *         return  # swallow any exceptions
 * 
 * cdef inline bint _isHtmlDocument(_Element element) except -1:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node = element._c_node
 *     return (
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":25
 *     )
 * 
 * cdef inline int _assertValidNode(_Element element) except -1:             # <<<<<<<<<<<<<<
 *     assert element._c_node is not NULL, "invalid Element proxy at %s" % id(element)
 * 
*/

static CYTHON_INLINE int __pyx_f_4lxml_5etree__assertValidNode(struct LxmlElement *__pyx_v_element) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_assertValidNode", 0);

  /* "src/lxml/apihelpers.pxi":26
 * 
 * cdef inline int _assertValidNode(_Element element) except -1:
 *     assert element._c_node is not NULL, "invalid Element proxy at %s" % id(element)             # <<<<<<<<<<<<<<
 * 
 * cdef inline int _assertValidDoc(_Document doc) except -1:
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = (__pyx_v_element->_c_node != NULL);
    if (unlikely(!__pyx_t_1)) {
      __pyx_t_3 = NULL;
      __pyx_t_4 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_3, ((PyObject *)__pyx_v_element)};
        __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_id, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 26, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __pyx_t_3 = __Pyx_PyUnicode_FormatSafe(__pyx_mstate_global->__pyx_kp_u_invalid_Element_proxy_at_s, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 26, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_t_3, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(4, 26, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(4, 26, __pyx_L1_error)
  #endif

  /* "src/lxml/apihelpers.pxi":25
 *     )
 * 
 * cdef inline int _assertValidNode(_Element element) except -1:             # <<<<<<<<<<<<<<
 *     assert element._c_node is not NULL, "invalid Element proxy at %s" % id(element)
 * 
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._assertValidNode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":28
 *     assert element._c_node is not NULL, "invalid Element proxy at %s" % id(element)
 * 
 * cdef inline int _assertValidDoc(_Document doc) except -1:             # <<<<<<<<<<<<<<
 *     assert doc._c_doc is not NULL, "invalid Document proxy at %s" % id(doc)
 * 
*/

static CYTHON_INLINE int __pyx_f_4lxml_5etree__assertValidDoc(struct LxmlDocument *__pyx_v_doc) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_assertValidDoc", 0);

  /* "src/lxml/apihelpers.pxi":29
 * 
 * cdef inline int _assertValidDoc(_Document doc) except -1:
 *     assert doc._c_doc is not NULL, "invalid Document proxy at %s" % id(doc)             # <<<<<<<<<<<<<<
 * 
 * cdef _Document _documentOrRaise(object input):
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = (__pyx_v_doc->_c_doc != NULL);
    if (unlikely(!__pyx_t_1)) {
      __pyx_t_3 = NULL;
      __pyx_t_4 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_3, ((PyObject *)__pyx_v_doc)};
        __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_id, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 29, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __pyx_t_3 = __Pyx_PyUnicode_FormatSafe(__pyx_mstate_global->__pyx_kp_u_invalid_Document_proxy_at_s, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 29, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_t_3, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(4, 29, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(4, 29, __pyx_L1_error)
  #endif

  /* "src/lxml/apihelpers.pxi":28
 *     assert element._c_node is not NULL, "invalid Element proxy at %s" % id(element)
 * 
 * cdef inline int _assertValidDoc(_Document doc) except -1:             # <<<<<<<<<<<<<<
 *     assert doc._c_doc is not NULL, "invalid Document proxy at %s" % id(doc)
 * 
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._assertValidDoc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":31
 *     assert doc._c_doc is not NULL, "invalid Document proxy at %s" % id(doc)
 * 
 * cdef _Document _documentOrRaise(object input):             # <<<<<<<<<<<<<<
 *     """Call this to get the document of a _Document, _ElementTree or _Element
 *     object, or to raise an exception if it can't be determined.
*/

static struct LxmlDocument *__pyx_f_4lxml_5etree__documentOrRaise(PyObject *__pyx_v_input) {
  struct LxmlDocument *__pyx_v_doc = 0;
  struct LxmlDocument *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  const char *__pyx_t_3;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_documentOrRaise", 0);

  /* "src/lxml/apihelpers.pxi":38
 *     """
 *     cdef _Document doc
 *     if isinstance(input, _ElementTree):             # <<<<<<<<<<<<<<
 *         if (<_ElementTree>input)._context_node is not None:
 *             doc = (<_ElementTree>input)._context_node._doc
*/
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_input, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ElementTree); 
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":39
 *     cdef _Document doc
 *     if isinstance(input, _ElementTree):
 *         if (<_ElementTree>input)._context_node is not None:             # <<<<<<<<<<<<<<
 *             doc = (<_ElementTree>input)._context_node._doc
 *         else:
*/
    __pyx_t_1 = (((PyObject *)((struct LxmlElementTree *)__pyx_v_input)->_context_node) != Py_None);
    if (__pyx_t_1) {

      /* "src/lxml/apihelpers.pxi":40
 *     if isinstance(input, _ElementTree):
 *         if (<_ElementTree>input)._context_node is not None:
 *             doc = (<_ElementTree>input)._context_node._doc             # <<<<<<<<<<<<<<
 *         else:
 *             doc = None
*/
      __pyx_t_2 = ((PyObject *)((struct LxmlElementTree *)__pyx_v_input)->_context_node->_doc);
      __Pyx_INCREF(__pyx_t_2);
      __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_2);
      __pyx_t_2 = 0;

      /* "src/lxml/apihelpers.pxi":39
 *     cdef _Document doc
 *     if isinstance(input, _ElementTree):
 *         if (<_ElementTree>input)._context_node is not None:             # <<<<<<<<<<<<<<
 *             doc = (<_ElementTree>input)._context_node._doc
 *         else:
*/
      goto __pyx_L4;
    }

    /* "src/lxml/apihelpers.pxi":42
 *             doc = (<_ElementTree>input)._context_node._doc
 *         else:
 *             doc = None             # <<<<<<<<<<<<<<
 *     elif isinstance(input, _Element):
 *         doc = (<_Element>input)._doc
*/
    /*else*/ {
      __Pyx_INCREF(Py_None);
      __pyx_v_doc = ((struct LxmlDocument *)Py_None);
    }
    __pyx_L4:;

    /* "src/lxml/apihelpers.pxi":38
 *     """
 *     cdef _Document doc
 *     if isinstance(input, _ElementTree):             # <<<<<<<<<<<<<<
 *         if (<_ElementTree>input)._context_node is not None:
 *             doc = (<_ElementTree>input)._context_node._doc
*/
    goto __pyx_L3;
  }

  /* "src/lxml/apihelpers.pxi":43
 *         else:
 *             doc = None
 *     elif isinstance(input, _Element):             # <<<<<<<<<<<<<<
 *         doc = (<_Element>input)._doc
 *     elif isinstance(input, _Document):
*/
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_input, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element); 
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":44
 *             doc = None
 *     elif isinstance(input, _Element):
 *         doc = (<_Element>input)._doc             # <<<<<<<<<<<<<<
 *     elif isinstance(input, _Document):
 *         doc = <_Document>input
*/
    __pyx_t_2 = ((PyObject *)((struct LxmlElement *)__pyx_v_input)->_doc);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/apihelpers.pxi":43
 *         else:
 *             doc = None
 *     elif isinstance(input, _Element):             # <<<<<<<<<<<<<<
 *         doc = (<_Element>input)._doc
 *     elif isinstance(input, _Document):
*/
    goto __pyx_L3;
  }

  /* "src/lxml/apihelpers.pxi":45
 *     elif isinstance(input, _Element):
 *         doc = (<_Element>input)._doc
 *     elif isinstance(input, _Document):             # <<<<<<<<<<<<<<
 *         doc = <_Document>input
 *     else:
*/
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_input, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Document); 
  if (likely(__pyx_t_1)) {

    /* "src/lxml/apihelpers.pxi":46
 *         doc = (<_Element>input)._doc
 *     elif isinstance(input, _Document):
 *         doc = <_Document>input             # <<<<<<<<<<<<<<
 *     else:
 *         raise TypeError, f"Invalid input object: {python._fqtypename(input).decode('utf8')}"
*/
    __pyx_t_2 = __pyx_v_input;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/apihelpers.pxi":45
 *     elif isinstance(input, _Element):
 *         doc = (<_Element>input)._doc
 *     elif isinstance(input, _Document):             # <<<<<<<<<<<<<<
 *         doc = <_Document>input
 *     else:
*/
    goto __pyx_L3;
  }

  /* "src/lxml/apihelpers.pxi":48
 *         doc = <_Document>input
 *     else:
 *         raise TypeError, f"Invalid input object: {python._fqtypename(input).decode('utf8')}"             # <<<<<<<<<<<<<<
 *     if doc is None:
 *         raise ValueError, f"Input object has no document: {python._fqtypename(input).decode('utf8')}"
*/
  /*else*/ {
    __pyx_t_3 = _fqtypename(__pyx_v_input);
    __pyx_t_4 = __Pyx_ssize_strlen(__pyx_t_3); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(4, 48, __pyx_L1_error)
    __pyx_t_2 = __Pyx_decode_c_string(__pyx_t_3, 0, __pyx_t_4, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 48, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_Invalid_input_object, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 48, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_t_5, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __PYX_ERR(4, 48, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "src/lxml/apihelpers.pxi":49
 *     else:
 *         raise TypeError, f"Invalid input object: {python._fqtypename(input).decode('utf8')}"
 *     if doc is None:             # <<<<<<<<<<<<<<
 *         raise ValueError, f"Input object has no document: {python._fqtypename(input).decode('utf8')}"
 *     _assertValidDoc(doc)
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_doc) == Py_None);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/apihelpers.pxi":50
 *         raise TypeError, f"Invalid input object: {python._fqtypename(input).decode('utf8')}"
 *     if doc is None:
 *         raise ValueError, f"Input object has no document: {python._fqtypename(input).decode('utf8')}"             # <<<<<<<<<<<<<<
 *     _assertValidDoc(doc)
 *     return doc
*/
    __pyx_t_3 = _fqtypename(__pyx_v_input);
    __pyx_t_4 = __Pyx_ssize_strlen(__pyx_t_3); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(4, 50, __pyx_L1_error)
    __pyx_t_5 = __Pyx_decode_c_string(__pyx_t_3, 0, __pyx_t_4, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 50, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_Input_object_has_no_document, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 50, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_t_2, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(4, 50, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":49
 *     else:
 *         raise TypeError, f"Invalid input object: {python._fqtypename(input).decode('utf8')}"
 *     if doc is None:             # <<<<<<<<<<<<<<
 *         raise ValueError, f"Input object has no document: {python._fqtypename(input).decode('utf8')}"
 *     _assertValidDoc(doc)
*/
  }

  /* "src/lxml/apihelpers.pxi":51
 *     if doc is None:
 *         raise ValueError, f"Input object has no document: {python._fqtypename(input).decode('utf8')}"
 *     _assertValidDoc(doc)             # <<<<<<<<<<<<<<
 *     return doc
 * 
*/
  __pyx_t_6 = __pyx_f_4lxml_5etree__assertValidDoc(__pyx_v_doc); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(4, 51, __pyx_L1_error)

  /* "src/lxml/apihelpers.pxi":52
 *         raise ValueError, f"Input object has no document: {python._fqtypename(input).decode('utf8')}"
 *     _assertValidDoc(doc)
 *     return doc             # <<<<<<<<<<<<<<
 * 
 * cdef _Element _rootNodeOrRaise(object input):
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_doc);
  __pyx_r = __pyx_v_doc;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":31
 *     assert doc._c_doc is not NULL, "invalid Document proxy at %s" % id(doc)
 * 
 * cdef _Document _documentOrRaise(object input):             # <<<<<<<<<<<<<<
 *     """Call this to get the document of a _Document, _ElementTree or _Element
 *     object, or to raise an exception if it can't be determined.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._documentOrRaise", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":54
 *     return doc
 * 
 * cdef _Element _rootNodeOrRaise(object input):             # <<<<<<<<<<<<<<
 *     """Call this to get the root node of a _Document, _ElementTree or
 *      _Element object, or to raise an exception if it can't be determined.
*/

static struct LxmlElement *__pyx_f_4lxml_5etree__rootNodeOrRaise(PyObject *__pyx_v_input) {
  struct LxmlElement *__pyx_v_node = 0;
  struct LxmlElement *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  const char *__pyx_t_3;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_rootNodeOrRaise", 0);

  /* "src/lxml/apihelpers.pxi":61
 *      """
 *     cdef _Element node
 *     if isinstance(input, _ElementTree):             # <<<<<<<<<<<<<<
 *         node = (<_ElementTree>input)._context_node
 *     elif isinstance(input, _Element):
*/
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_input, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ElementTree); 
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":62
 *     cdef _Element node
 *     if isinstance(input, _ElementTree):
 *         node = (<_ElementTree>input)._context_node             # <<<<<<<<<<<<<<
 *     elif isinstance(input, _Element):
 *         node = <_Element>input
*/
    __pyx_t_2 = ((PyObject *)((struct LxmlElementTree *)__pyx_v_input)->_context_node);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v_node = ((struct LxmlElement *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/apihelpers.pxi":61
 *      """
 *     cdef _Element node
 *     if isinstance(input, _ElementTree):             # <<<<<<<<<<<<<<
 *         node = (<_ElementTree>input)._context_node
 *     elif isinstance(input, _Element):
*/
    goto __pyx_L3;
  }

  /* "src/lxml/apihelpers.pxi":63
 *     if isinstance(input, _ElementTree):
 *         node = (<_ElementTree>input)._context_node
 *     elif isinstance(input, _Element):             # <<<<<<<<<<<<<<
 *         node = <_Element>input
 *     elif isinstance(input, _Document):
*/
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_input, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element); 
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":64
 *         node = (<_ElementTree>input)._context_node
 *     elif isinstance(input, _Element):
 *         node = <_Element>input             # <<<<<<<<<<<<<<
 *     elif isinstance(input, _Document):
 *         node = (<_Document>input).getroot()
*/
    __pyx_t_2 = __pyx_v_input;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v_node = ((struct LxmlElement *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/apihelpers.pxi":63
 *     if isinstance(input, _ElementTree):
 *         node = (<_ElementTree>input)._context_node
 *     elif isinstance(input, _Element):             # <<<<<<<<<<<<<<
 *         node = <_Element>input
 *     elif isinstance(input, _Document):
*/
    goto __pyx_L3;
  }

  /* "src/lxml/apihelpers.pxi":65
 *     elif isinstance(input, _Element):
 *         node = <_Element>input
 *     elif isinstance(input, _Document):             # <<<<<<<<<<<<<<
 *         node = (<_Document>input).getroot()
 *     else:
*/
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_input, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Document); 
  if (likely(__pyx_t_1)) {

    /* "src/lxml/apihelpers.pxi":66
 *         node = <_Element>input
 *     elif isinstance(input, _Document):
 *         node = (<_Document>input).getroot()             # <<<<<<<<<<<<<<
 *     else:
 *         raise TypeError, f"Invalid input object: {python._fqtypename(input).decode('utf8')}"
*/
    __pyx_t_2 = __pyx_f_4lxml_5etree_9_Document_getroot(((struct LxmlDocument *)__pyx_v_input)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 66, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element))))) __PYX_ERR(4, 66, __pyx_L1_error)
    __pyx_v_node = ((struct LxmlElement *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/apihelpers.pxi":65
 *     elif isinstance(input, _Element):
 *         node = <_Element>input
 *     elif isinstance(input, _Document):             # <<<<<<<<<<<<<<
 *         node = (<_Document>input).getroot()
 *     else:
*/
    goto __pyx_L3;
  }

  /* "src/lxml/apihelpers.pxi":68
 *         node = (<_Document>input).getroot()
 *     else:
 *         raise TypeError, f"Invalid input object: {python._fqtypename(input).decode('utf8')}"             # <<<<<<<<<<<<<<
 *     if (node is None or not node._c_node or
 *             node._c_node.type != tree.XML_ELEMENT_NODE):
*/
  /*else*/ {
    __pyx_t_3 = _fqtypename(__pyx_v_input);
    __pyx_t_4 = __Pyx_ssize_strlen(__pyx_t_3); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(4, 68, __pyx_L1_error)
    __pyx_t_2 = __Pyx_decode_c_string(__pyx_t_3, 0, __pyx_t_4, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 68, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_Invalid_input_object, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 68, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_t_5, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __PYX_ERR(4, 68, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "src/lxml/apihelpers.pxi":69
 *     else:
 *         raise TypeError, f"Invalid input object: {python._fqtypename(input).decode('utf8')}"
 *     if (node is None or not node._c_node or             # <<<<<<<<<<<<<<
 *             node._c_node.type != tree.XML_ELEMENT_NODE):
 *         raise ValueError, f"Input object is not an XML element: {python._fqtypename(input).decode('utf8')}"
*/
  __pyx_t_6 = (((PyObject *)__pyx_v_node) == Py_None);
  if (!__pyx_t_6) {
  } else {
    __pyx_t_1 = __pyx_t_6;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_6 = (!(__pyx_v_node->_c_node != 0));
  if (!__pyx_t_6) {
  } else {
    __pyx_t_1 = __pyx_t_6;
    goto __pyx_L5_bool_binop_done;
  }

  /* "src/lxml/apihelpers.pxi":70
 *         raise TypeError, f"Invalid input object: {python._fqtypename(input).decode('utf8')}"
 *     if (node is None or not node._c_node or
 *             node._c_node.type != tree.XML_ELEMENT_NODE):             # <<<<<<<<<<<<<<
 *         raise ValueError, f"Input object is not an XML element: {python._fqtypename(input).decode('utf8')}"
 *     _assertValidNode(node)
*/
  __pyx_t_6 = (__pyx_v_node->_c_node->type != XML_ELEMENT_NODE);
  __pyx_t_1 = __pyx_t_6;
  __pyx_L5_bool_binop_done:;

  /* "src/lxml/apihelpers.pxi":69
 *     else:
 *         raise TypeError, f"Invalid input object: {python._fqtypename(input).decode('utf8')}"
 *     if (node is None or not node._c_node or             # <<<<<<<<<<<<<<
 *             node._c_node.type != tree.XML_ELEMENT_NODE):
 *         raise ValueError, f"Input object is not an XML element: {python._fqtypename(input).decode('utf8')}"
*/
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/apihelpers.pxi":71
 *     if (node is None or not node._c_node or
 *             node._c_node.type != tree.XML_ELEMENT_NODE):
 *         raise ValueError, f"Input object is not an XML element: {python._fqtypename(input).decode('utf8')}"             # <<<<<<<<<<<<<<
 *     _assertValidNode(node)
 *     return node
*/
    __pyx_t_3 = _fqtypename(__pyx_v_input);
    __pyx_t_4 = __Pyx_ssize_strlen(__pyx_t_3); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(4, 71, __pyx_L1_error)
    __pyx_t_5 = __Pyx_decode_c_string(__pyx_t_3, 0, __pyx_t_4, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 71, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_Input_object_is_not_an_XML_eleme, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 71, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_t_2, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(4, 71, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":69
 *     else:
 *         raise TypeError, f"Invalid input object: {python._fqtypename(input).decode('utf8')}"
 *     if (node is None or not node._c_node or             # <<<<<<<<<<<<<<
 *             node._c_node.type != tree.XML_ELEMENT_NODE):
 *         raise ValueError, f"Input object is not an XML element: {python._fqtypename(input).decode('utf8')}"
*/
  }

  /* "src/lxml/apihelpers.pxi":72
 *             node._c_node.type != tree.XML_ELEMENT_NODE):
 *         raise ValueError, f"Input object is not an XML element: {python._fqtypename(input).decode('utf8')}"
 *     _assertValidNode(node)             # <<<<<<<<<<<<<<
 *     return node
 * 
*/
  __pyx_t_7 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_node); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(4, 72, __pyx_L1_error)

  /* "src/lxml/apihelpers.pxi":73
 *         raise ValueError, f"Input object is not an XML element: {python._fqtypename(input).decode('utf8')}"
 *     _assertValidNode(node)
 *     return node             # <<<<<<<<<<<<<<
 * 
 * cdef bint _isAncestorOrSame(xmlNode* c_ancestor, xmlNode* c_node) noexcept:
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_node);
  __pyx_r = __pyx_v_node;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":54
 *     return doc
 * 
 * cdef _Element _rootNodeOrRaise(object input):             # <<<<<<<<<<<<<<
 *     """Call this to get the root node of a _Document, _ElementTree or
 *      _Element object, or to raise an exception if it can't be determined.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._rootNodeOrRaise", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_node);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":75
 *     return node
 * 
 * cdef bint _isAncestorOrSame(xmlNode* c_ancestor, xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *     while c_node:
 *         if c_node is c_ancestor:
*/

static int __pyx_f_4lxml_5etree__isAncestorOrSame(xmlNode *__pyx_v_c_ancestor, xmlNode *__pyx_v_c_node) {
  int __pyx_r;
  int __pyx_t_1;
  xmlNode *__pyx_t_2;

  /* "src/lxml/apihelpers.pxi":76
 * 
 * cdef bint _isAncestorOrSame(xmlNode* c_ancestor, xmlNode* c_node) noexcept:
 *     while c_node:             # <<<<<<<<<<<<<<
 *         if c_node is c_ancestor:
 *             return True
*/
  while (1) {
    __pyx_t_1 = (__pyx_v_c_node != 0);
    if (!__pyx_t_1) break;

    /* "src/lxml/apihelpers.pxi":77
 * cdef bint _isAncestorOrSame(xmlNode* c_ancestor, xmlNode* c_node) noexcept:
 *     while c_node:
 *         if c_node is c_ancestor:             # <<<<<<<<<<<<<<
 *             return True
 *         c_node = c_node.parent
*/
    __pyx_t_1 = (__pyx_v_c_node == __pyx_v_c_ancestor);
    if (__pyx_t_1) {

      /* "src/lxml/apihelpers.pxi":78
 *     while c_node:
 *         if c_node is c_ancestor:
 *             return True             # <<<<<<<<<<<<<<
 *         c_node = c_node.parent
 *     return False
*/
      __pyx_r = 1;
      goto __pyx_L0;

      /* "src/lxml/apihelpers.pxi":77
 * cdef bint _isAncestorOrSame(xmlNode* c_ancestor, xmlNode* c_node) noexcept:
 *     while c_node:
 *         if c_node is c_ancestor:             # <<<<<<<<<<<<<<
 *             return True
 *         c_node = c_node.parent
*/
    }

    /* "src/lxml/apihelpers.pxi":79
 *         if c_node is c_ancestor:
 *             return True
 *         c_node = c_node.parent             # <<<<<<<<<<<<<<
 *     return False
 * 
*/
    __pyx_t_2 = __pyx_v_c_node->parent;
    __pyx_v_c_node = __pyx_t_2;
  }

  /* "src/lxml/apihelpers.pxi":80
 *             return True
 *         c_node = c_node.parent
 *     return False             # <<<<<<<<<<<<<<
 * 
 * cdef _Element _makeElement(tag, xmlDoc* c_doc, _Document doc,
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":75
 *     return node
 * 
 * cdef bint _isAncestorOrSame(xmlNode* c_ancestor, xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *     while c_node:
 *         if c_node is c_ancestor:
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":82
 *     return False
 * 
 * cdef _Element _makeElement(tag, xmlDoc* c_doc, _Document doc,             # <<<<<<<<<<<<<<
 *                            _BaseParser parser, text, tail, attrib, nsmap,
 *                            dict extra_attrs):
*/

static struct LxmlElement *__pyx_f_4lxml_5etree__makeElement(PyObject *__pyx_v_tag, xmlDoc *__pyx_v_c_doc, struct LxmlDocument *__pyx_v_doc, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser, PyObject *__pyx_v_text, PyObject *__pyx_v_tail, PyObject *__pyx_v_attrib, PyObject *__pyx_v_nsmap, PyObject *__pyx_v_extra_attrs) {
  xmlNode *__pyx_v_c_node;
  PyObject *__pyx_v_ns_utf = NULL;
  PyObject *__pyx_v_name_utf = NULL;
  struct LxmlElement *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  xmlDoc *__pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  xmlNode *__pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_makeElement", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_doc);

  /* "src/lxml/apihelpers.pxi":100
 *     """
 *     cdef xmlNode* c_node
 *     if doc is not None:             # <<<<<<<<<<<<<<
 *         c_doc = doc._c_doc
 *     ns_utf, name_utf = _getNsTag(tag)
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_doc) != Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":101
 *     cdef xmlNode* c_node
 *     if doc is not None:
 *         c_doc = doc._c_doc             # <<<<<<<<<<<<<<
 *     ns_utf, name_utf = _getNsTag(tag)
 *     if parser is not None and parser._for_html:
*/
    __pyx_t_2 = __pyx_v_doc->_c_doc;
    __pyx_v_c_doc = __pyx_t_2;

    /* "src/lxml/apihelpers.pxi":100
 *     """
 *     cdef xmlNode* c_node
 *     if doc is not None:             # <<<<<<<<<<<<<<
 *         c_doc = doc._c_doc
 *     ns_utf, name_utf = _getNsTag(tag)
*/
  }

  /* "src/lxml/apihelpers.pxi":102
 *     if doc is not None:
 *         c_doc = doc._c_doc
 *     ns_utf, name_utf = _getNsTag(tag)             # <<<<<<<<<<<<<<
 *     if parser is not None and parser._for_html:
 *         _htmlTagValidOrRaise(name_utf)
*/
  __pyx_t_3 = __pyx_f_4lxml_5etree__getNsTag(__pyx_v_tag); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 102, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (likely(__pyx_t_3 != Py_None)) {
    PyObject* sequence = __pyx_t_3;
    Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(4, 102, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1);
    __Pyx_INCREF(__pyx_t_5);
    #else
    __pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 102, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 102, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    #endif
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(4, 102, __pyx_L1_error)
  }
  __pyx_v_ns_utf = __pyx_t_4;
  __pyx_t_4 = 0;
  __pyx_v_name_utf = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "src/lxml/apihelpers.pxi":103
 *         c_doc = doc._c_doc
 *     ns_utf, name_utf = _getNsTag(tag)
 *     if parser is not None and parser._for_html:             # <<<<<<<<<<<<<<
 *         _htmlTagValidOrRaise(name_utf)
 *         if c_doc is NULL:
*/
  __pyx_t_6 = (((PyObject *)__pyx_v_parser) != Py_None);
  if (__pyx_t_6) {
  } else {
    __pyx_t_1 = __pyx_t_6;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_1 = __pyx_v_parser->_for_html;
  __pyx_L5_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":104
 *     ns_utf, name_utf = _getNsTag(tag)
 *     if parser is not None and parser._for_html:
 *         _htmlTagValidOrRaise(name_utf)             # <<<<<<<<<<<<<<
 *         if c_doc is NULL:
 *             c_doc = _newHTMLDoc()
*/
    __pyx_t_7 = __pyx_f_4lxml_5etree__htmlTagValidOrRaise(__pyx_v_name_utf); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(4, 104, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":105
 *     if parser is not None and parser._for_html:
 *         _htmlTagValidOrRaise(name_utf)
 *         if c_doc is NULL:             # <<<<<<<<<<<<<<
 *             c_doc = _newHTMLDoc()
 *     else:
*/
    __pyx_t_1 = (__pyx_v_c_doc == NULL);
    if (__pyx_t_1) {

      /* "src/lxml/apihelpers.pxi":106
 *         _htmlTagValidOrRaise(name_utf)
 *         if c_doc is NULL:
 *             c_doc = _newHTMLDoc()             # <<<<<<<<<<<<<<
 *     else:
 *         _tagValidOrRaise(name_utf)
*/
      __pyx_t_2 = __pyx_f_4lxml_5etree__newHTMLDoc(); if (unlikely(__pyx_t_2 == ((void *)NULL))) __PYX_ERR(4, 106, __pyx_L1_error)
      __pyx_v_c_doc = __pyx_t_2;

      /* "src/lxml/apihelpers.pxi":105
 *     if parser is not None and parser._for_html:
 *         _htmlTagValidOrRaise(name_utf)
 *         if c_doc is NULL:             # <<<<<<<<<<<<<<
 *             c_doc = _newHTMLDoc()
 *     else:
*/
    }

    /* "src/lxml/apihelpers.pxi":103
 *         c_doc = doc._c_doc
 *     ns_utf, name_utf = _getNsTag(tag)
 *     if parser is not None and parser._for_html:             # <<<<<<<<<<<<<<
 *         _htmlTagValidOrRaise(name_utf)
 *         if c_doc is NULL:
*/
    goto __pyx_L4;
  }

  /* "src/lxml/apihelpers.pxi":108
 *             c_doc = _newHTMLDoc()
 *     else:
 *         _tagValidOrRaise(name_utf)             # <<<<<<<<<<<<<<
 *         if c_doc is NULL:
 *             c_doc = _newXMLDoc()
*/
  /*else*/ {
    __pyx_t_7 = __pyx_f_4lxml_5etree__tagValidOrRaise(__pyx_v_name_utf); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(4, 108, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":109
 *     else:
 *         _tagValidOrRaise(name_utf)
 *         if c_doc is NULL:             # <<<<<<<<<<<<<<
 *             c_doc = _newXMLDoc()
 *     c_node = _createElement(c_doc, name_utf)
*/
    __pyx_t_1 = (__pyx_v_c_doc == NULL);
    if (__pyx_t_1) {

      /* "src/lxml/apihelpers.pxi":110
 *         _tagValidOrRaise(name_utf)
 *         if c_doc is NULL:
 *             c_doc = _newXMLDoc()             # <<<<<<<<<<<<<<
 *     c_node = _createElement(c_doc, name_utf)
 *     if c_node is NULL:
*/
      __pyx_t_2 = __pyx_f_4lxml_5etree__newXMLDoc(); if (unlikely(__pyx_t_2 == ((void *)NULL))) __PYX_ERR(4, 110, __pyx_L1_error)
      __pyx_v_c_doc = __pyx_t_2;

      /* "src/lxml/apihelpers.pxi":109
 *     else:
 *         _tagValidOrRaise(name_utf)
 *         if c_doc is NULL:             # <<<<<<<<<<<<<<
 *             c_doc = _newXMLDoc()
 *     c_node = _createElement(c_doc, name_utf)
*/
    }
  }
  __pyx_L4:;

  /* "src/lxml/apihelpers.pxi":111
 *         if c_doc is NULL:
 *             c_doc = _newXMLDoc()
 *     c_node = _createElement(c_doc, name_utf)             # <<<<<<<<<<<<<<
 *     if c_node is NULL:
 *         if doc is None and c_doc is not NULL:
*/
  __pyx_t_8 = __pyx_f_4lxml_5etree__createElement(__pyx_v_c_doc, __pyx_v_name_utf); if (unlikely(__pyx_t_8 == ((void *)NULL))) __PYX_ERR(4, 111, __pyx_L1_error)
  __pyx_v_c_node = __pyx_t_8;

  /* "src/lxml/apihelpers.pxi":112
 *             c_doc = _newXMLDoc()
 *     c_node = _createElement(c_doc, name_utf)
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         if doc is None and c_doc is not NULL:
 *             tree.xmlFreeDoc(c_doc)
*/
  __pyx_t_1 = (__pyx_v_c_node == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":113
 *     c_node = _createElement(c_doc, name_utf)
 *     if c_node is NULL:
 *         if doc is None and c_doc is not NULL:             # <<<<<<<<<<<<<<
 *             tree.xmlFreeDoc(c_doc)
 *         raise MemoryError()
*/
    __pyx_t_6 = (((PyObject *)__pyx_v_doc) == Py_None);
    if (__pyx_t_6) {
    } else {
      __pyx_t_1 = __pyx_t_6;
      goto __pyx_L11_bool_binop_done;
    }
    __pyx_t_6 = (__pyx_v_c_doc != NULL);
    __pyx_t_1 = __pyx_t_6;
    __pyx_L11_bool_binop_done:;
    if (__pyx_t_1) {

      /* "src/lxml/apihelpers.pxi":114
 *     if c_node is NULL:
 *         if doc is None and c_doc is not NULL:
 *             tree.xmlFreeDoc(c_doc)             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     try:
*/
      xmlFreeDoc(__pyx_v_c_doc);

      /* "src/lxml/apihelpers.pxi":113
 *     c_node = _createElement(c_doc, name_utf)
 *     if c_node is NULL:
 *         if doc is None and c_doc is not NULL:             # <<<<<<<<<<<<<<
 *             tree.xmlFreeDoc(c_doc)
 *         raise MemoryError()
*/
    }

    /* "src/lxml/apihelpers.pxi":115
 *         if doc is None and c_doc is not NULL:
 *             tree.xmlFreeDoc(c_doc)
 *         raise MemoryError()             # <<<<<<<<<<<<<<
 *     try:
 *         if doc is None:
*/
    PyErr_NoMemory(); __PYX_ERR(4, 115, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":112
 *             c_doc = _newXMLDoc()
 *     c_node = _createElement(c_doc, name_utf)
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         if doc is None and c_doc is not NULL:
 *             tree.xmlFreeDoc(c_doc)
*/
  }

  /* "src/lxml/apihelpers.pxi":116
 *             tree.xmlFreeDoc(c_doc)
 *         raise MemoryError()
 *     try:             # <<<<<<<<<<<<<<
 *         if doc is None:
 *             tree.xmlDocSetRootElement(c_doc, c_node)
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
    __Pyx_XGOTREF(__pyx_t_9);
    __Pyx_XGOTREF(__pyx_t_10);
    __Pyx_XGOTREF(__pyx_t_11);
    /*try:*/ {

      /* "src/lxml/apihelpers.pxi":117
 *         raise MemoryError()
 *     try:
 *         if doc is None:             # <<<<<<<<<<<<<<
 *             tree.xmlDocSetRootElement(c_doc, c_node)
 *             doc = _documentFactory(c_doc, parser)
*/
      __pyx_t_1 = (((PyObject *)__pyx_v_doc) == Py_None);
      if (__pyx_t_1) {

        /* "src/lxml/apihelpers.pxi":118
 *     try:
 *         if doc is None:
 *             tree.xmlDocSetRootElement(c_doc, c_node)             # <<<<<<<<<<<<<<
 *             doc = _documentFactory(c_doc, parser)
 *         if text is not None:
*/
        (void)(xmlDocSetRootElement(__pyx_v_c_doc, __pyx_v_c_node));

        /* "src/lxml/apihelpers.pxi":119
 *         if doc is None:
 *             tree.xmlDocSetRootElement(c_doc, c_node)
 *             doc = _documentFactory(c_doc, parser)             # <<<<<<<<<<<<<<
 *         if text is not None:
 *             _setNodeText(c_node, text)
*/
        __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, __pyx_v_parser)); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 119, __pyx_L13_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF_SET(__pyx_v_doc, ((struct LxmlDocument *)__pyx_t_3));
        __pyx_t_3 = 0;

        /* "src/lxml/apihelpers.pxi":117
 *         raise MemoryError()
 *     try:
 *         if doc is None:             # <<<<<<<<<<<<<<
 *             tree.xmlDocSetRootElement(c_doc, c_node)
 *             doc = _documentFactory(c_doc, parser)
*/
      }

      /* "src/lxml/apihelpers.pxi":120
 *             tree.xmlDocSetRootElement(c_doc, c_node)
 *             doc = _documentFactory(c_doc, parser)
 *         if text is not None:             # <<<<<<<<<<<<<<
 *             _setNodeText(c_node, text)
 *         if tail is not None:
*/
      __pyx_t_1 = (__pyx_v_text != Py_None);
      if (__pyx_t_1) {

        /* "src/lxml/apihelpers.pxi":121
 *             doc = _documentFactory(c_doc, parser)
 *         if text is not None:
 *             _setNodeText(c_node, text)             # <<<<<<<<<<<<<<
 *         if tail is not None:
 *             _setTailText(c_node, tail)
*/
        __pyx_t_7 = __pyx_f_4lxml_5etree__setNodeText(__pyx_v_c_node, __pyx_v_text); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(4, 121, __pyx_L13_error)

        /* "src/lxml/apihelpers.pxi":120
 *             tree.xmlDocSetRootElement(c_doc, c_node)
 *             doc = _documentFactory(c_doc, parser)
 *         if text is not None:             # <<<<<<<<<<<<<<
 *             _setNodeText(c_node, text)
 *         if tail is not None:
*/
      }

      /* "src/lxml/apihelpers.pxi":122
 *         if text is not None:
 *             _setNodeText(c_node, text)
 *         if tail is not None:             # <<<<<<<<<<<<<<
 *             _setTailText(c_node, tail)
 *         # add namespaces to node if necessary
*/
      __pyx_t_1 = (__pyx_v_tail != Py_None);
      if (__pyx_t_1) {

        /* "src/lxml/apihelpers.pxi":123
 *             _setNodeText(c_node, text)
 *         if tail is not None:
 *             _setTailText(c_node, tail)             # <<<<<<<<<<<<<<
 *         # add namespaces to node if necessary
 *         _setNodeNamespaces(c_node, doc, ns_utf, nsmap)
*/
        __pyx_t_7 = __pyx_f_4lxml_5etree__setTailText(__pyx_v_c_node, __pyx_v_tail); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(4, 123, __pyx_L13_error)

        /* "src/lxml/apihelpers.pxi":122
 *         if text is not None:
 *             _setNodeText(c_node, text)
 *         if tail is not None:             # <<<<<<<<<<<<<<
 *             _setTailText(c_node, tail)
 *         # add namespaces to node if necessary
*/
      }

      /* "src/lxml/apihelpers.pxi":125
 *             _setTailText(c_node, tail)
 *         # add namespaces to node if necessary
 *         _setNodeNamespaces(c_node, doc, ns_utf, nsmap)             # <<<<<<<<<<<<<<
 *         _initNodeAttributes(c_node, doc, attrib, extra_attrs)
 *         return _elementFactory(doc, c_node)
*/
      __pyx_t_7 = __pyx_f_4lxml_5etree__setNodeNamespaces(__pyx_v_c_node, __pyx_v_doc, __pyx_v_ns_utf, __pyx_v_nsmap); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(4, 125, __pyx_L13_error)

      /* "src/lxml/apihelpers.pxi":126
 *         # add namespaces to node if necessary
 *         _setNodeNamespaces(c_node, doc, ns_utf, nsmap)
 *         _initNodeAttributes(c_node, doc, attrib, extra_attrs)             # <<<<<<<<<<<<<<
 *         return _elementFactory(doc, c_node)
 *     except:
*/
      __pyx_t_3 = __pyx_f_4lxml_5etree__initNodeAttributes(__pyx_v_c_node, __pyx_v_doc, __pyx_v_attrib, __pyx_v_extra_attrs); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 126, __pyx_L13_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "src/lxml/apihelpers.pxi":127
 *         _setNodeNamespaces(c_node, doc, ns_utf, nsmap)
 *         _initNodeAttributes(c_node, doc, attrib, extra_attrs)
 *         return _elementFactory(doc, c_node)             # <<<<<<<<<<<<<<
 *     except:
 *         # free allocated c_node/c_doc unless Python does it for us
*/
      __Pyx_XDECREF((PyObject *)__pyx_r);
      __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(__pyx_v_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 127, __pyx_L13_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_r = ((struct LxmlElement *)__pyx_t_3);
      __pyx_t_3 = 0;
      goto __pyx_L17_try_return;

      /* "src/lxml/apihelpers.pxi":116
 *             tree.xmlFreeDoc(c_doc)
 *         raise MemoryError()
 *     try:             # <<<<<<<<<<<<<<
 *         if doc is None:
 *             tree.xmlDocSetRootElement(c_doc, c_node)
*/
    }
    __pyx_L13_error:;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "src/lxml/apihelpers.pxi":128
 *         _initNodeAttributes(c_node, doc, attrib, extra_attrs)
 *         return _elementFactory(doc, c_node)
 *     except:             # <<<<<<<<<<<<<<
 *         # free allocated c_node/c_doc unless Python does it for us
 *         if c_node.doc is not c_doc:
*/
    /*except:*/ {
      __Pyx_AddTraceback("lxml.etree._makeElement", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_5, &__pyx_t_4) < 0) __PYX_ERR(4, 128, __pyx_L15_except_error)
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_4);

      /* "src/lxml/apihelpers.pxi":130
 *     except:
 *         # free allocated c_node/c_doc unless Python does it for us
 *         if c_node.doc is not c_doc:             # <<<<<<<<<<<<<<
 *             # node not yet in document => will not be freed by document
 *             if tail is not None:
*/
      __pyx_t_1 = (__pyx_v_c_node->doc != __pyx_v_c_doc);
      if (__pyx_t_1) {

        /* "src/lxml/apihelpers.pxi":132
 *         if c_node.doc is not c_doc:
 *             # node not yet in document => will not be freed by document
 *             if tail is not None:             # <<<<<<<<<<<<<<
 *                 _removeText(c_node.next) # tail
 *             tree.xmlFreeNode(c_node)
*/
        __pyx_t_1 = (__pyx_v_tail != Py_None);
        if (__pyx_t_1) {

          /* "src/lxml/apihelpers.pxi":133
 *             # node not yet in document => will not be freed by document
 *             if tail is not None:
 *                 _removeText(c_node.next) # tail             # <<<<<<<<<<<<<<
 *             tree.xmlFreeNode(c_node)
 *         if doc is None:
*/
          __pyx_f_4lxml_5etree__removeText(__pyx_v_c_node->next);

          /* "src/lxml/apihelpers.pxi":132
 *         if c_node.doc is not c_doc:
 *             # node not yet in document => will not be freed by document
 *             if tail is not None:             # <<<<<<<<<<<<<<
 *                 _removeText(c_node.next) # tail
 *             tree.xmlFreeNode(c_node)
*/
        }

        /* "src/lxml/apihelpers.pxi":134
 *             if tail is not None:
 *                 _removeText(c_node.next) # tail
 *             tree.xmlFreeNode(c_node)             # <<<<<<<<<<<<<<
 *         if doc is None:
 *             # c_doc will not be freed by doc
*/
        xmlFreeNode(__pyx_v_c_node);

        /* "src/lxml/apihelpers.pxi":130
 *     except:
 *         # free allocated c_node/c_doc unless Python does it for us
 *         if c_node.doc is not c_doc:             # <<<<<<<<<<<<<<
 *             # node not yet in document => will not be freed by document
 *             if tail is not None:
*/
      }

      /* "src/lxml/apihelpers.pxi":135
 *                 _removeText(c_node.next) # tail
 *             tree.xmlFreeNode(c_node)
 *         if doc is None:             # <<<<<<<<<<<<<<
 *             # c_doc will not be freed by doc
 *             tree.xmlFreeDoc(c_doc)
*/
      __pyx_t_1 = (((PyObject *)__pyx_v_doc) == Py_None);
      if (__pyx_t_1) {

        /* "src/lxml/apihelpers.pxi":137
 *         if doc is None:
 *             # c_doc will not be freed by doc
 *             tree.xmlFreeDoc(c_doc)             # <<<<<<<<<<<<<<
 *         raise
 * 
*/
        xmlFreeDoc(__pyx_v_c_doc);

        /* "src/lxml/apihelpers.pxi":135
 *                 _removeText(c_node.next) # tail
 *             tree.xmlFreeNode(c_node)
 *         if doc is None:             # <<<<<<<<<<<<<<
 *             # c_doc will not be freed by doc
 *             tree.xmlFreeDoc(c_doc)
*/
      }

      /* "src/lxml/apihelpers.pxi":138
 *             # c_doc will not be freed by doc
 *             tree.xmlFreeDoc(c_doc)
 *         raise             # <<<<<<<<<<<<<<
 * 
 * cdef int _initNewElement(_Element element, bint is_html, name_utf, ns_utf,
*/
      __Pyx_GIVEREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_ErrRestoreWithState(__pyx_t_3, __pyx_t_5, __pyx_t_4);
      __pyx_t_3 = 0;  __pyx_t_5 = 0;  __pyx_t_4 = 0; 
      __PYX_ERR(4, 138, __pyx_L15_except_error)
    }

    /* "src/lxml/apihelpers.pxi":116
 *             tree.xmlFreeDoc(c_doc)
 *         raise MemoryError()
 *     try:             # <<<<<<<<<<<<<<
 *         if doc is None:
 *             tree.xmlDocSetRootElement(c_doc, c_node)
*/
    __pyx_L15_except_error:;
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_XGIVEREF(__pyx_t_10);
    __Pyx_XGIVEREF(__pyx_t_11);
    __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
    goto __pyx_L1_error;
    __pyx_L17_try_return:;
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_XGIVEREF(__pyx_t_10);
    __Pyx_XGIVEREF(__pyx_t_11);
    __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
    goto __pyx_L0;
  }

  /* "src/lxml/apihelpers.pxi":82
 *     return False
 * 
 * cdef _Element _makeElement(tag, xmlDoc* c_doc, _Document doc,             # <<<<<<<<<<<<<<
 *                            _BaseParser parser, text, tail, attrib, nsmap,
 *                            dict extra_attrs):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._makeElement", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ns_utf);
  __Pyx_XDECREF(__pyx_v_name_utf);
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":140
 *         raise
 * 
 * cdef int _initNewElement(_Element element, bint is_html, name_utf, ns_utf,             # <<<<<<<<<<<<<<
 *                          _BaseParser parser, attrib, nsmap, dict extra_attrs) except -1:
 *     """Initialise a new Element object.
*/

static int __pyx_f_4lxml_5etree__initNewElement(struct LxmlElement *__pyx_v_element, int __pyx_v_is_html, PyObject *__pyx_v_name_utf, PyObject *__pyx_v_ns_utf, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser, PyObject *__pyx_v_attrib, PyObject *__pyx_v_nsmap, PyObject *__pyx_v_extra_attrs) {
  xmlDoc *__pyx_v_c_doc;
  xmlNode *__pyx_v_c_node;
  struct LxmlDocument *__pyx_v_doc = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  xmlDoc *__pyx_t_2;
  xmlNode *__pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  size_t __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_initNewElement", 0);

  /* "src/lxml/apihelpers.pxi":150
 *     cdef xmlNode* c_node
 *     cdef _Document doc
 *     if is_html:             # <<<<<<<<<<<<<<
 *         _htmlTagValidOrRaise(name_utf)
 *         c_doc = _newHTMLDoc()
*/
  if (__pyx_v_is_html) {

    /* "src/lxml/apihelpers.pxi":151
 *     cdef _Document doc
 *     if is_html:
 *         _htmlTagValidOrRaise(name_utf)             # <<<<<<<<<<<<<<
 *         c_doc = _newHTMLDoc()
 *     else:
*/
    __pyx_t_1 = __pyx_f_4lxml_5etree__htmlTagValidOrRaise(__pyx_v_name_utf); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(4, 151, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":152
 *     if is_html:
 *         _htmlTagValidOrRaise(name_utf)
 *         c_doc = _newHTMLDoc()             # <<<<<<<<<<<<<<
 *     else:
 *         _tagValidOrRaise(name_utf)
*/
    __pyx_t_2 = __pyx_f_4lxml_5etree__newHTMLDoc(); if (unlikely(__pyx_t_2 == ((void *)NULL))) __PYX_ERR(4, 152, __pyx_L1_error)
    __pyx_v_c_doc = __pyx_t_2;

    /* "src/lxml/apihelpers.pxi":150
 *     cdef xmlNode* c_node
 *     cdef _Document doc
 *     if is_html:             # <<<<<<<<<<<<<<
 *         _htmlTagValidOrRaise(name_utf)
 *         c_doc = _newHTMLDoc()
*/
    goto __pyx_L3;
  }

  /* "src/lxml/apihelpers.pxi":154
 *         c_doc = _newHTMLDoc()
 *     else:
 *         _tagValidOrRaise(name_utf)             # <<<<<<<<<<<<<<
 *         c_doc = _newXMLDoc()
 *     c_node = _createElement(c_doc, name_utf)
*/
  /*else*/ {
    __pyx_t_1 = __pyx_f_4lxml_5etree__tagValidOrRaise(__pyx_v_name_utf); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(4, 154, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":155
 *     else:
 *         _tagValidOrRaise(name_utf)
 *         c_doc = _newXMLDoc()             # <<<<<<<<<<<<<<
 *     c_node = _createElement(c_doc, name_utf)
 *     if c_node is NULL:
*/
    __pyx_t_2 = __pyx_f_4lxml_5etree__newXMLDoc(); if (unlikely(__pyx_t_2 == ((void *)NULL))) __PYX_ERR(4, 155, __pyx_L1_error)
    __pyx_v_c_doc = __pyx_t_2;
  }
  __pyx_L3:;

  /* "src/lxml/apihelpers.pxi":156
 *         _tagValidOrRaise(name_utf)
 *         c_doc = _newXMLDoc()
 *     c_node = _createElement(c_doc, name_utf)             # <<<<<<<<<<<<<<
 *     if c_node is NULL:
 *         if c_doc is not NULL:
*/
  __pyx_t_3 = __pyx_f_4lxml_5etree__createElement(__pyx_v_c_doc, __pyx_v_name_utf); if (unlikely(__pyx_t_3 == ((void *)NULL))) __PYX_ERR(4, 156, __pyx_L1_error)
  __pyx_v_c_node = __pyx_t_3;

  /* "src/lxml/apihelpers.pxi":157
 *         c_doc = _newXMLDoc()
 *     c_node = _createElement(c_doc, name_utf)
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         if c_doc is not NULL:
 *             tree.xmlFreeDoc(c_doc)
*/
  __pyx_t_4 = (__pyx_v_c_node == NULL);
  if (__pyx_t_4) {

    /* "src/lxml/apihelpers.pxi":158
 *     c_node = _createElement(c_doc, name_utf)
 *     if c_node is NULL:
 *         if c_doc is not NULL:             # <<<<<<<<<<<<<<
 *             tree.xmlFreeDoc(c_doc)
 *         raise MemoryError()
*/
    __pyx_t_4 = (__pyx_v_c_doc != NULL);
    if (__pyx_t_4) {

      /* "src/lxml/apihelpers.pxi":159
 *     if c_node is NULL:
 *         if c_doc is not NULL:
 *             tree.xmlFreeDoc(c_doc)             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     tree.xmlDocSetRootElement(c_doc, c_node)
*/
      xmlFreeDoc(__pyx_v_c_doc);

      /* "src/lxml/apihelpers.pxi":158
 *     c_node = _createElement(c_doc, name_utf)
 *     if c_node is NULL:
 *         if c_doc is not NULL:             # <<<<<<<<<<<<<<
 *             tree.xmlFreeDoc(c_doc)
 *         raise MemoryError()
*/
    }

    /* "src/lxml/apihelpers.pxi":160
 *         if c_doc is not NULL:
 *             tree.xmlFreeDoc(c_doc)
 *         raise MemoryError()             # <<<<<<<<<<<<<<
 *     tree.xmlDocSetRootElement(c_doc, c_node)
 *     doc = _documentFactory(c_doc, parser)
*/
    PyErr_NoMemory(); __PYX_ERR(4, 160, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":157
 *         c_doc = _newXMLDoc()
 *     c_node = _createElement(c_doc, name_utf)
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         if c_doc is not NULL:
 *             tree.xmlFreeDoc(c_doc)
*/
  }

  /* "src/lxml/apihelpers.pxi":161
 *             tree.xmlFreeDoc(c_doc)
 *         raise MemoryError()
 *     tree.xmlDocSetRootElement(c_doc, c_node)             # <<<<<<<<<<<<<<
 *     doc = _documentFactory(c_doc, parser)
 *     # add namespaces to node if necessary
*/
  (void)(xmlDocSetRootElement(__pyx_v_c_doc, __pyx_v_c_node));

  /* "src/lxml/apihelpers.pxi":162
 *         raise MemoryError()
 *     tree.xmlDocSetRootElement(c_doc, c_node)
 *     doc = _documentFactory(c_doc, parser)             # <<<<<<<<<<<<<<
 *     # add namespaces to node if necessary
 *     _setNodeNamespaces(c_node, doc, ns_utf, nsmap)
*/
  __pyx_t_5 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, __pyx_v_parser)); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 162, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "src/lxml/apihelpers.pxi":164
 *     doc = _documentFactory(c_doc, parser)
 *     # add namespaces to node if necessary
 *     _setNodeNamespaces(c_node, doc, ns_utf, nsmap)             # <<<<<<<<<<<<<<
 *     _initNodeAttributes(c_node, doc, attrib, extra_attrs)
 *     _registerProxy(element, doc, c_node)
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__setNodeNamespaces(__pyx_v_c_node, __pyx_v_doc, __pyx_v_ns_utf, __pyx_v_nsmap); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(4, 164, __pyx_L1_error)

  /* "src/lxml/apihelpers.pxi":165
 *     # add namespaces to node if necessary
 *     _setNodeNamespaces(c_node, doc, ns_utf, nsmap)
 *     _initNodeAttributes(c_node, doc, attrib, extra_attrs)             # <<<<<<<<<<<<<<
 *     _registerProxy(element, doc, c_node)
 *     element._init()
*/
  __pyx_t_5 = __pyx_f_4lxml_5etree__initNodeAttributes(__pyx_v_c_node, __pyx_v_doc, __pyx_v_attrib, __pyx_v_extra_attrs); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 165, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "src/lxml/apihelpers.pxi":166
 *     _setNodeNamespaces(c_node, doc, ns_utf, nsmap)
 *     _initNodeAttributes(c_node, doc, attrib, extra_attrs)
 *     _registerProxy(element, doc, c_node)             # <<<<<<<<<<<<<<
 *     element._init()
 *     return 0
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__registerProxy(__pyx_v_element, __pyx_v_doc, __pyx_v_c_node); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(4, 166, __pyx_L1_error)

  /* "src/lxml/apihelpers.pxi":167
 *     _initNodeAttributes(c_node, doc, attrib, extra_attrs)
 *     _registerProxy(element, doc, c_node)
 *     element._init()             # <<<<<<<<<<<<<<
 *     return 0
 * 
*/
  __pyx_t_6 = ((PyObject *)__pyx_v_element);
  __Pyx_INCREF(__pyx_t_6);
  __pyx_t_7 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL};
    __pyx_t_5 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_init_2, __pyx_callargs+__pyx_t_7, (1-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 167, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "src/lxml/apihelpers.pxi":168
 *     _registerProxy(element, doc, c_node)
 *     element._init()
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef _Element _makeSubElement(_Element parent, tag, text, tail,
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":140
 *         raise
 * 
 * cdef int _initNewElement(_Element element, bint is_html, name_utf, ns_utf,             # <<<<<<<<<<<<<<
 *                          _BaseParser parser, attrib, nsmap, dict extra_attrs) except -1:
 *     """Initialise a new Element object.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._initNewElement", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":170
 *     return 0
 * 
 * cdef _Element _makeSubElement(_Element parent, tag, text, tail,             # <<<<<<<<<<<<<<
 *                               attrib, nsmap, dict extra_attrs):
 *     """Create a new child element and initialize text content, namespaces and
*/

static struct LxmlElement *__pyx_f_4lxml_5etree__makeSubElement(struct LxmlElement *__pyx_v_parent, PyObject *__pyx_v_tag, PyObject *__pyx_v_text, PyObject *__pyx_v_tail, PyObject *__pyx_v_attrib, PyObject *__pyx_v_nsmap, PyObject *__pyx_v_extra_attrs) {
  xmlNode *__pyx_v_c_node;
  xmlDoc *__pyx_v_c_doc;
  PyObject *__pyx_v_ns_utf = NULL;
  PyObject *__pyx_v_name_utf = NULL;
  struct LxmlElement *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  xmlDoc *__pyx_t_7;
  xmlNode *__pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_makeSubElement", 0);

  /* "src/lxml/apihelpers.pxi":177
 *     cdef xmlNode* c_node
 *     cdef xmlDoc* c_doc
 *     if parent is None or parent._doc is None:             # <<<<<<<<<<<<<<
 *         return None
 *     _assertValidNode(parent)
*/
  __pyx_t_2 = (((PyObject *)__pyx_v_parent) == Py_None);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (((PyObject *)__pyx_v_parent->_doc) == Py_None);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":178
 *     cdef xmlDoc* c_doc
 *     if parent is None or parent._doc is None:
 *         return None             # <<<<<<<<<<<<<<
 *     _assertValidNode(parent)
 *     ns_utf, name_utf = _getNsTag(tag)
*/
    __Pyx_XDECREF((PyObject *)__pyx_r);
    __pyx_r = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":177
 *     cdef xmlNode* c_node
 *     cdef xmlDoc* c_doc
 *     if parent is None or parent._doc is None:             # <<<<<<<<<<<<<<
 *         return None
 *     _assertValidNode(parent)
*/
  }

  /* "src/lxml/apihelpers.pxi":179
 *     if parent is None or parent._doc is None:
 *         return None
 *     _assertValidNode(parent)             # <<<<<<<<<<<<<<
 *     ns_utf, name_utf = _getNsTag(tag)
 *     c_doc = parent._doc._c_doc
*/
  __pyx_t_3 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_parent); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(4, 179, __pyx_L1_error)

  /* "src/lxml/apihelpers.pxi":180
 *         return None
 *     _assertValidNode(parent)
 *     ns_utf, name_utf = _getNsTag(tag)             # <<<<<<<<<<<<<<
 *     c_doc = parent._doc._c_doc
 * 
*/
  __pyx_t_4 = __pyx_f_4lxml_5etree__getNsTag(__pyx_v_tag); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 180, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (likely(__pyx_t_4 != Py_None)) {
    PyObject* sequence = __pyx_t_4;
    Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(4, 180, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0);
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1);
    __Pyx_INCREF(__pyx_t_6);
    #else
    __pyx_t_5 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 180, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 180, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    #endif
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(4, 180, __pyx_L1_error)
  }
  __pyx_v_ns_utf = __pyx_t_5;
  __pyx_t_5 = 0;
  __pyx_v_name_utf = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "src/lxml/apihelpers.pxi":181
 *     _assertValidNode(parent)
 *     ns_utf, name_utf = _getNsTag(tag)
 *     c_doc = parent._doc._c_doc             # <<<<<<<<<<<<<<
 * 
 *     if parent._doc._parser is not None and parent._doc._parser._for_html:
*/
  __pyx_t_7 = __pyx_v_parent->_doc->_c_doc;
  __pyx_v_c_doc = __pyx_t_7;

  /* "src/lxml/apihelpers.pxi":183
 *     c_doc = parent._doc._c_doc
 * 
 *     if parent._doc._parser is not None and parent._doc._parser._for_html:             # <<<<<<<<<<<<<<
 *         _htmlTagValidOrRaise(name_utf)
 *     else:
*/
  __pyx_t_2 = (((PyObject *)__pyx_v_parent->_doc->_parser) != Py_None);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L7_bool_binop_done;
  }
  __pyx_t_1 = __pyx_v_parent->_doc->_parser->_for_html;
  __pyx_L7_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":184
 * 
 *     if parent._doc._parser is not None and parent._doc._parser._for_html:
 *         _htmlTagValidOrRaise(name_utf)             # <<<<<<<<<<<<<<
 *     else:
 *         _tagValidOrRaise(name_utf)
*/
    __pyx_t_3 = __pyx_f_4lxml_5etree__htmlTagValidOrRaise(__pyx_v_name_utf); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(4, 184, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":183
 *     c_doc = parent._doc._c_doc
 * 
 *     if parent._doc._parser is not None and parent._doc._parser._for_html:             # <<<<<<<<<<<<<<
 *         _htmlTagValidOrRaise(name_utf)
 *     else:
*/
    goto __pyx_L6;
  }

  /* "src/lxml/apihelpers.pxi":186
 *         _htmlTagValidOrRaise(name_utf)
 *     else:
 *         _tagValidOrRaise(name_utf)             # <<<<<<<<<<<<<<
 * 
 *     c_node = _createElement(c_doc, name_utf)
*/
  /*else*/ {
    __pyx_t_3 = __pyx_f_4lxml_5etree__tagValidOrRaise(__pyx_v_name_utf); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(4, 186, __pyx_L1_error)
  }
  __pyx_L6:;

  /* "src/lxml/apihelpers.pxi":188
 *         _tagValidOrRaise(name_utf)
 * 
 *     c_node = _createElement(c_doc, name_utf)             # <<<<<<<<<<<<<<
 *     if c_node is NULL:
 *         raise MemoryError()
*/
  __pyx_t_8 = __pyx_f_4lxml_5etree__createElement(__pyx_v_c_doc, __pyx_v_name_utf); if (unlikely(__pyx_t_8 == ((void *)NULL))) __PYX_ERR(4, 188, __pyx_L1_error)
  __pyx_v_c_node = __pyx_t_8;

  /* "src/lxml/apihelpers.pxi":189
 * 
 *     c_node = _createElement(c_doc, name_utf)
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     tree.xmlAddChild(parent._c_node, c_node)
*/
  __pyx_t_1 = (__pyx_v_c_node == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/apihelpers.pxi":190
 *     c_node = _createElement(c_doc, name_utf)
 *     if c_node is NULL:
 *         raise MemoryError()             # <<<<<<<<<<<<<<
 *     tree.xmlAddChild(parent._c_node, c_node)
 * 
*/
    PyErr_NoMemory(); __PYX_ERR(4, 190, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":189
 * 
 *     c_node = _createElement(c_doc, name_utf)
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     tree.xmlAddChild(parent._c_node, c_node)
*/
  }

  /* "src/lxml/apihelpers.pxi":191
 *     if c_node is NULL:
 *         raise MemoryError()
 *     tree.xmlAddChild(parent._c_node, c_node)             # <<<<<<<<<<<<<<
 * 
 *     try:
*/
  (void)(xmlAddChild(__pyx_v_parent->_c_node, __pyx_v_c_node));

  /* "src/lxml/apihelpers.pxi":193
 *     tree.xmlAddChild(parent._c_node, c_node)
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         if text is not None:
 *             _setNodeText(c_node, text)
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
    __Pyx_XGOTREF(__pyx_t_9);
    __Pyx_XGOTREF(__pyx_t_10);
    __Pyx_XGOTREF(__pyx_t_11);
    /*try:*/ {

      /* "src/lxml/apihelpers.pxi":194
 * 
 *     try:
 *         if text is not None:             # <<<<<<<<<<<<<<
 *             _setNodeText(c_node, text)
 *         if tail is not None:
*/
      __pyx_t_1 = (__pyx_v_text != Py_None);
      if (__pyx_t_1) {

        /* "src/lxml/apihelpers.pxi":195
 *     try:
 *         if text is not None:
 *             _setNodeText(c_node, text)             # <<<<<<<<<<<<<<
 *         if tail is not None:
 *             _setTailText(c_node, tail)
*/
        __pyx_t_3 = __pyx_f_4lxml_5etree__setNodeText(__pyx_v_c_node, __pyx_v_text); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(4, 195, __pyx_L10_error)

        /* "src/lxml/apihelpers.pxi":194
 * 
 *     try:
 *         if text is not None:             # <<<<<<<<<<<<<<
 *             _setNodeText(c_node, text)
 *         if tail is not None:
*/
      }

      /* "src/lxml/apihelpers.pxi":196
 *         if text is not None:
 *             _setNodeText(c_node, text)
 *         if tail is not None:             # <<<<<<<<<<<<<<
 *             _setTailText(c_node, tail)
 * 
*/
      __pyx_t_1 = (__pyx_v_tail != Py_None);
      if (__pyx_t_1) {

        /* "src/lxml/apihelpers.pxi":197
 *             _setNodeText(c_node, text)
 *         if tail is not None:
 *             _setTailText(c_node, tail)             # <<<<<<<<<<<<<<
 * 
 *         # add namespaces to node if necessary
*/
        __pyx_t_3 = __pyx_f_4lxml_5etree__setTailText(__pyx_v_c_node, __pyx_v_tail); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(4, 197, __pyx_L10_error)

        /* "src/lxml/apihelpers.pxi":196
 *         if text is not None:
 *             _setNodeText(c_node, text)
 *         if tail is not None:             # <<<<<<<<<<<<<<
 *             _setTailText(c_node, tail)
 * 
*/
      }

      /* "src/lxml/apihelpers.pxi":200
 * 
 *         # add namespaces to node if necessary
 *         _setNodeNamespaces(c_node, parent._doc, ns_utf, nsmap)             # <<<<<<<<<<<<<<
 *         _initNodeAttributes(c_node, parent._doc, attrib, extra_attrs)
 *         return _elementFactory(parent._doc, c_node)
*/
      __pyx_t_4 = ((PyObject *)__pyx_v_parent->_doc);
      __Pyx_INCREF(__pyx_t_4);
      __pyx_t_3 = __pyx_f_4lxml_5etree__setNodeNamespaces(__pyx_v_c_node, ((struct LxmlDocument *)__pyx_t_4), __pyx_v_ns_utf, __pyx_v_nsmap); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(4, 200, __pyx_L10_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "src/lxml/apihelpers.pxi":201
 *         # add namespaces to node if necessary
 *         _setNodeNamespaces(c_node, parent._doc, ns_utf, nsmap)
 *         _initNodeAttributes(c_node, parent._doc, attrib, extra_attrs)             # <<<<<<<<<<<<<<
 *         return _elementFactory(parent._doc, c_node)
 *     except:
*/
      __pyx_t_4 = ((PyObject *)__pyx_v_parent->_doc);
      __Pyx_INCREF(__pyx_t_4);
      __pyx_t_6 = __pyx_f_4lxml_5etree__initNodeAttributes(__pyx_v_c_node, ((struct LxmlDocument *)__pyx_t_4), __pyx_v_attrib, __pyx_v_extra_attrs); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 201, __pyx_L10_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "src/lxml/apihelpers.pxi":202
 *         _setNodeNamespaces(c_node, parent._doc, ns_utf, nsmap)
 *         _initNodeAttributes(c_node, parent._doc, attrib, extra_attrs)
 *         return _elementFactory(parent._doc, c_node)             # <<<<<<<<<<<<<<
 *     except:
 *         # make sure we clean up in case of an error
*/
      __Pyx_XDECREF((PyObject *)__pyx_r);
      __pyx_t_6 = ((PyObject *)__pyx_v_parent->_doc);
      __Pyx_INCREF(__pyx_t_6);
      __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_6), __pyx_v_c_node)); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 202, __pyx_L10_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_r = ((struct LxmlElement *)__pyx_t_4);
      __pyx_t_4 = 0;
      goto __pyx_L14_try_return;

      /* "src/lxml/apihelpers.pxi":193
 *     tree.xmlAddChild(parent._c_node, c_node)
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         if text is not None:
 *             _setNodeText(c_node, text)
*/
    }
    __pyx_L10_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "src/lxml/apihelpers.pxi":203
 *         _initNodeAttributes(c_node, parent._doc, attrib, extra_attrs)
 *         return _elementFactory(parent._doc, c_node)
 *     except:             # <<<<<<<<<<<<<<
 *         # make sure we clean up in case of an error
 *         _removeNode(parent._doc, c_node)
*/
    /*except:*/ {
      __Pyx_AddTraceback("lxml.etree._makeSubElement", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_5) < 0) __PYX_ERR(4, 203, __pyx_L12_except_error)
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_5);

      /* "src/lxml/apihelpers.pxi":205
 *     except:
 *         # make sure we clean up in case of an error
 *         _removeNode(parent._doc, c_node)             # <<<<<<<<<<<<<<
 *         raise
 * 
*/
      __pyx_t_12 = ((PyObject *)__pyx_v_parent->_doc);
      __Pyx_INCREF(__pyx_t_12);
      __pyx_t_3 = __pyx_f_4lxml_5etree__removeNode(((struct LxmlDocument *)__pyx_t_12), __pyx_v_c_node); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(4, 205, __pyx_L12_except_error)
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

      /* "src/lxml/apihelpers.pxi":206
 *         # make sure we clean up in case of an error
 *         _removeNode(parent._doc, c_node)
 *         raise             # <<<<<<<<<<<<<<
 * 
 * 
*/
      __Pyx_GIVEREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ErrRestoreWithState(__pyx_t_4, __pyx_t_6, __pyx_t_5);
      __pyx_t_4 = 0;  __pyx_t_6 = 0;  __pyx_t_5 = 0; 
      __PYX_ERR(4, 206, __pyx_L12_except_error)
    }

    /* "src/lxml/apihelpers.pxi":193
 *     tree.xmlAddChild(parent._c_node, c_node)
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         if text is not None:
 *             _setNodeText(c_node, text)
*/
    __pyx_L12_except_error:;
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_XGIVEREF(__pyx_t_10);
    __Pyx_XGIVEREF(__pyx_t_11);
    __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
    goto __pyx_L1_error;
    __pyx_L14_try_return:;
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_XGIVEREF(__pyx_t_10);
    __Pyx_XGIVEREF(__pyx_t_11);
    __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
    goto __pyx_L0;
  }

  /* "src/lxml/apihelpers.pxi":170
 *     return 0
 * 
 * cdef _Element _makeSubElement(_Element parent, tag, text, tail,             # <<<<<<<<<<<<<<
 *                               attrib, nsmap, dict extra_attrs):
 *     """Create a new child element and initialize text content, namespaces and
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("lxml.etree._makeSubElement", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ns_utf);
  __Pyx_XDECREF(__pyx_v_name_utf);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":209
 * 
 * 
 * cdef int _setNodeNamespaces(xmlNode* c_node, _Document doc,             # <<<<<<<<<<<<<<
 *                             object node_ns_utf, object nsmap) except -1:
 *     """Lookup current namespace prefixes, then set namespace structure for
*/

static int __pyx_f_4lxml_5etree__setNodeNamespaces(xmlNode *__pyx_v_c_node, struct LxmlDocument *__pyx_v_doc, PyObject *__pyx_v_node_ns_utf, PyObject *__pyx_v_nsmap) {
  xmlNs *__pyx_v_c_ns;
  PyObject *__pyx_v_prefix = NULL;
  PyObject *__pyx_v_href = NULL;
  PyObject *__pyx_v_href_utf = NULL;
  const xmlChar *__pyx_v_c_href;
  PyObject *__pyx_v_prefix_utf = NULL;
  const xmlChar *__pyx_v_c_prefix;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *(*__pyx_t_9)(PyObject *);
  int __pyx_t_10;
  int __pyx_t_11;
  xmlNs *__pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_setNodeNamespaces", 0);
  __Pyx_INCREF(__pyx_v_node_ns_utf);

  /* "src/lxml/apihelpers.pxi":219
 *     cdef list nsdefs
 * 
 *     if nsmap:             # <<<<<<<<<<<<<<
 *         for prefix, href in _iter_nsmap(nsmap):
 *             href_utf = _utf8(href)
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_nsmap); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(4, 219, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":220
 * 
 *     if nsmap:
 *         for prefix, href in _iter_nsmap(nsmap):             # <<<<<<<<<<<<<<
 *             href_utf = _utf8(href)
 *             _uriValidOrRaise(href_utf)
*/
    __pyx_t_2 = __pyx_f_4lxml_5etree__iter_nsmap(__pyx_v_nsmap); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 220, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
      __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3);
      __pyx_t_4 = 0;
      __pyx_t_5 = NULL;
    } else {
      __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 220, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 220, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    for (;;) {
      if (likely(!__pyx_t_5)) {
        if (likely(PyList_CheckExact(__pyx_t_3))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(4, 220, __pyx_L1_error)
            #endif
            if (__pyx_t_4 >= __pyx_temp) break;
          }
          __pyx_t_2 = __Pyx_PyList_GetItemRefFast(__pyx_t_3, __pyx_t_4, __Pyx_ReferenceSharing_OwnStrongReference);
          ++__pyx_t_4;
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(4, 220, __pyx_L1_error)
            #endif
            if (__pyx_t_4 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4));
          #else
          __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_4);
          #endif
          ++__pyx_t_4;
        }
        if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 220, __pyx_L1_error)
      } else {
        __pyx_t_2 = __pyx_t_5(__pyx_t_3);
        if (unlikely(!__pyx_t_2)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(4, 220, __pyx_L1_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_2);
      if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
        PyObject* sequence = __pyx_t_2;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(4, 220, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0);
          __Pyx_INCREF(__pyx_t_6);
          __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1);
          __Pyx_INCREF(__pyx_t_7);
        } else {
          __pyx_t_6 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
          if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 220, __pyx_L1_error)
          __Pyx_XGOTREF(__pyx_t_6);
          __pyx_t_7 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
          if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 220, __pyx_L1_error)
          __Pyx_XGOTREF(__pyx_t_7);
        }
        #else
        __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 220, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_7 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 220, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        #endif
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_8 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 220, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_9 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_8);
        index = 0; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_6);
        index = 1; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L6_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_7);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < (0)) __PYX_ERR(4, 220, __pyx_L1_error)
        __pyx_t_9 = NULL;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L7_unpacking_done;
        __pyx_L6_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_9 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(4, 220, __pyx_L1_error)
        __pyx_L7_unpacking_done:;
      }
      __Pyx_XDECREF_SET(__pyx_v_prefix, __pyx_t_6);
      __pyx_t_6 = 0;
      __Pyx_XDECREF_SET(__pyx_v_href, __pyx_t_7);
      __pyx_t_7 = 0;

      /* "src/lxml/apihelpers.pxi":221
 *     if nsmap:
 *         for prefix, href in _iter_nsmap(nsmap):
 *             href_utf = _utf8(href)             # <<<<<<<<<<<<<<
 *             _uriValidOrRaise(href_utf)
 *             c_href = _xcstr(href_utf)
*/
      __pyx_t_2 = __pyx_f_4lxml_5etree__utf8(__pyx_v_href); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 221, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_XDECREF_SET(__pyx_v_href_utf, ((PyObject*)__pyx_t_2));
      __pyx_t_2 = 0;

      /* "src/lxml/apihelpers.pxi":222
 *         for prefix, href in _iter_nsmap(nsmap):
 *             href_utf = _utf8(href)
 *             _uriValidOrRaise(href_utf)             # <<<<<<<<<<<<<<
 *             c_href = _xcstr(href_utf)
 *             if prefix is not None:
*/
      __pyx_t_10 = __pyx_f_4lxml_5etree__uriValidOrRaise(__pyx_v_href_utf); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(4, 222, __pyx_L1_error)

      /* "src/lxml/apihelpers.pxi":223
 *             href_utf = _utf8(href)
 *             _uriValidOrRaise(href_utf)
 *             c_href = _xcstr(href_utf)             # <<<<<<<<<<<<<<
 *             if prefix is not None:
 *                 prefix_utf = _utf8(prefix)
*/
      __pyx_v_c_href = (const xmlChar*)PyBytes_AS_STRING(__pyx_v_href_utf);

      /* "src/lxml/apihelpers.pxi":224
 *             _uriValidOrRaise(href_utf)
 *             c_href = _xcstr(href_utf)
 *             if prefix is not None:             # <<<<<<<<<<<<<<
 *                 prefix_utf = _utf8(prefix)
 *                 _prefixValidOrRaise(prefix_utf)
*/
      __pyx_t_1 = (__pyx_v_prefix != Py_None);
      if (__pyx_t_1) {

        /* "src/lxml/apihelpers.pxi":225
 *             c_href = _xcstr(href_utf)
 *             if prefix is not None:
 *                 prefix_utf = _utf8(prefix)             # <<<<<<<<<<<<<<
 *                 _prefixValidOrRaise(prefix_utf)
 *                 c_prefix = _xcstr(prefix_utf)
*/
        __pyx_t_2 = __pyx_f_4lxml_5etree__utf8(__pyx_v_prefix); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 225, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_XDECREF_SET(__pyx_v_prefix_utf, ((PyObject*)__pyx_t_2));
        __pyx_t_2 = 0;

        /* "src/lxml/apihelpers.pxi":226
 *             if prefix is not None:
 *                 prefix_utf = _utf8(prefix)
 *                 _prefixValidOrRaise(prefix_utf)             # <<<<<<<<<<<<<<
 *                 c_prefix = _xcstr(prefix_utf)
 *             else:
*/
        __pyx_t_10 = __pyx_f_4lxml_5etree__prefixValidOrRaise(__pyx_v_prefix_utf); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(4, 226, __pyx_L1_error)

        /* "src/lxml/apihelpers.pxi":227
 *                 prefix_utf = _utf8(prefix)
 *                 _prefixValidOrRaise(prefix_utf)
 *                 c_prefix = _xcstr(prefix_utf)             # <<<<<<<<<<<<<<
 *             else:
 *                 c_prefix = <const_xmlChar*>NULL
*/
        __pyx_v_c_prefix = (const xmlChar*)PyBytes_AS_STRING(__pyx_v_prefix_utf);

        /* "src/lxml/apihelpers.pxi":224
 *             _uriValidOrRaise(href_utf)
 *             c_href = _xcstr(href_utf)
 *             if prefix is not None:             # <<<<<<<<<<<<<<
 *                 prefix_utf = _utf8(prefix)
 *                 _prefixValidOrRaise(prefix_utf)
*/
        goto __pyx_L8;
      }

      /* "src/lxml/apihelpers.pxi":229
 *                 c_prefix = _xcstr(prefix_utf)
 *             else:
 *                 c_prefix = <const_xmlChar*>NULL             # <<<<<<<<<<<<<<
 *             # add namespace with prefix if it is not already known
 *             c_ns = tree.xmlSearchNs(doc._c_doc, c_node, c_prefix)
*/
      /*else*/ {
        __pyx_v_c_prefix = ((const xmlChar *)NULL);
      }
      __pyx_L8:;

      /* "src/lxml/apihelpers.pxi":231
 *                 c_prefix = <const_xmlChar*>NULL
 *             # add namespace with prefix if it is not already known
 *             c_ns = tree.xmlSearchNs(doc._c_doc, c_node, c_prefix)             # <<<<<<<<<<<<<<
 *             if c_ns is NULL or \
 *                     c_ns.href is NULL or \
*/
      __pyx_v_c_ns = xmlSearchNs(__pyx_v_doc->_c_doc, __pyx_v_c_node, __pyx_v_c_prefix);

      /* "src/lxml/apihelpers.pxi":232
 *             # add namespace with prefix if it is not already known
 *             c_ns = tree.xmlSearchNs(doc._c_doc, c_node, c_prefix)
 *             if c_ns is NULL or \             # <<<<<<<<<<<<<<
 *                     c_ns.href is NULL or \
 *                     tree.xmlStrcmp(c_ns.href, c_href) != 0:
*/
      __pyx_t_11 = (__pyx_v_c_ns == NULL);
      if (!__pyx_t_11) {
      } else {
        __pyx_t_1 = __pyx_t_11;
        goto __pyx_L10_bool_binop_done;
      }

      /* "src/lxml/apihelpers.pxi":233
 *             c_ns = tree.xmlSearchNs(doc._c_doc, c_node, c_prefix)
 *             if c_ns is NULL or \
 *                     c_ns.href is NULL or \             # <<<<<<<<<<<<<<
 *                     tree.xmlStrcmp(c_ns.href, c_href) != 0:
 *                 c_ns = tree.xmlNewNs(c_node, c_href, c_prefix)
*/
      __pyx_t_11 = (__pyx_v_c_ns->href == NULL);
      if (!__pyx_t_11) {
      } else {
        __pyx_t_1 = __pyx_t_11;
        goto __pyx_L10_bool_binop_done;
      }

      /* "src/lxml/apihelpers.pxi":234
 *             if c_ns is NULL or \
 *                     c_ns.href is NULL or \
 *                     tree.xmlStrcmp(c_ns.href, c_href) != 0:             # <<<<<<<<<<<<<<
 *                 c_ns = tree.xmlNewNs(c_node, c_href, c_prefix)
 *                 if c_ns is NULL:
*/
      __pyx_t_11 = (xmlStrcmp(__pyx_v_c_ns->href, __pyx_v_c_href) != 0);
      __pyx_t_1 = __pyx_t_11;
      __pyx_L10_bool_binop_done:;

      /* "src/lxml/apihelpers.pxi":232
 *             # add namespace with prefix if it is not already known
 *             c_ns = tree.xmlSearchNs(doc._c_doc, c_node, c_prefix)
 *             if c_ns is NULL or \             # <<<<<<<<<<<<<<
 *                     c_ns.href is NULL or \
 *                     tree.xmlStrcmp(c_ns.href, c_href) != 0:
*/
      if (__pyx_t_1) {

        /* "src/lxml/apihelpers.pxi":235
 *                     c_ns.href is NULL or \
 *                     tree.xmlStrcmp(c_ns.href, c_href) != 0:
 *                 c_ns = tree.xmlNewNs(c_node, c_href, c_prefix)             # <<<<<<<<<<<<<<
 *                 if c_ns is NULL:
 *                     # libxml2 has two error conditions: "out of memory" and "prefix exists already".
*/
        __pyx_v_c_ns = xmlNewNs(__pyx_v_c_node, __pyx_v_c_href, __pyx_v_c_prefix);

        /* "src/lxml/apihelpers.pxi":236
 *                     tree.xmlStrcmp(c_ns.href, c_href) != 0:
 *                 c_ns = tree.xmlNewNs(c_node, c_href, c_prefix)
 *                 if c_ns is NULL:             # <<<<<<<<<<<<<<
 *                     # libxml2 has two error conditions: "out of memory" and "prefix exists already".
 *                     # We ignore the latter for compatibility reasons. It currently only appears
*/
        __pyx_t_1 = (__pyx_v_c_ns == NULL);
        if (__pyx_t_1) {

          /* "src/lxml/apihelpers.pxi":240
 *                     # We ignore the latter for compatibility reasons. It currently only appears
 *                     # during namespace cleanup.
 *                     c_ns = c_node.nsDef             # <<<<<<<<<<<<<<
 *                     while c_ns is not NULL:
 *                         if c_prefix is NULL:
*/
          __pyx_t_12 = __pyx_v_c_node->nsDef;
          __pyx_v_c_ns = __pyx_t_12;

          /* "src/lxml/apihelpers.pxi":241
 *                     # during namespace cleanup.
 *                     c_ns = c_node.nsDef
 *                     while c_ns is not NULL:             # <<<<<<<<<<<<<<
 *                         if c_prefix is NULL:
 *                             if c_ns.prefix is NULL:
*/
          while (1) {
            __pyx_t_1 = (__pyx_v_c_ns != NULL);
            if (!__pyx_t_1) break;

            /* "src/lxml/apihelpers.pxi":242
 *                     c_ns = c_node.nsDef
 *                     while c_ns is not NULL:
 *                         if c_prefix is NULL:             # <<<<<<<<<<<<<<
 *                             if c_ns.prefix is NULL:
 *                                 break
*/
            __pyx_t_1 = (__pyx_v_c_prefix == NULL);
            if (__pyx_t_1) {

              /* "src/lxml/apihelpers.pxi":243
 *                     while c_ns is not NULL:
 *                         if c_prefix is NULL:
 *                             if c_ns.prefix is NULL:             # <<<<<<<<<<<<<<
 *                                 break
 *                         elif tree.xmlStrcmp(c_ns.prefix, c_prefix) == 0:
*/
              __pyx_t_1 = (__pyx_v_c_ns->prefix == NULL);
              if (__pyx_t_1) {

                /* "src/lxml/apihelpers.pxi":244
 *                         if c_prefix is NULL:
 *                             if c_ns.prefix is NULL:
 *                                 break             # <<<<<<<<<<<<<<
 *                         elif tree.xmlStrcmp(c_ns.prefix, c_prefix) == 0:
 *                             break
*/
                goto __pyx_L15_break;

                /* "src/lxml/apihelpers.pxi":243
 *                     while c_ns is not NULL:
 *                         if c_prefix is NULL:
 *                             if c_ns.prefix is NULL:             # <<<<<<<<<<<<<<
 *                                 break
 *                         elif tree.xmlStrcmp(c_ns.prefix, c_prefix) == 0:
*/
              }

              /* "src/lxml/apihelpers.pxi":242
 *                     c_ns = c_node.nsDef
 *                     while c_ns is not NULL:
 *                         if c_prefix is NULL:             # <<<<<<<<<<<<<<
 *                             if c_ns.prefix is NULL:
 *                                 break
*/
              goto __pyx_L16;
            }

            /* "src/lxml/apihelpers.pxi":245
 *                             if c_ns.prefix is NULL:
 *                                 break
 *                         elif tree.xmlStrcmp(c_ns.prefix, c_prefix) == 0:             # <<<<<<<<<<<<<<
 *                             break
 *                         c_ns = c_ns.next
*/
            __pyx_t_1 = (xmlStrcmp(__pyx_v_c_ns->prefix, __pyx_v_c_prefix) == 0);
            if (__pyx_t_1) {

              /* "src/lxml/apihelpers.pxi":246
 *                                 break
 *                         elif tree.xmlStrcmp(c_ns.prefix, c_prefix) == 0:
 *                             break             # <<<<<<<<<<<<<<
 *                         c_ns = c_ns.next
 *                     else:
*/
              goto __pyx_L15_break;

              /* "src/lxml/apihelpers.pxi":245
 *                             if c_ns.prefix is NULL:
 *                                 break
 *                         elif tree.xmlStrcmp(c_ns.prefix, c_prefix) == 0:             # <<<<<<<<<<<<<<
 *                             break
 *                         c_ns = c_ns.next
*/
            }
            __pyx_L16:;

            /* "src/lxml/apihelpers.pxi":247
 *                         elif tree.xmlStrcmp(c_ns.prefix, c_prefix) == 0:
 *                             break
 *                         c_ns = c_ns.next             # <<<<<<<<<<<<<<
 *                     else:
 *                         raise MemoryError()
*/
            __pyx_t_12 = __pyx_v_c_ns->next;
            __pyx_v_c_ns = __pyx_t_12;
          }

          /* "src/lxml/apihelpers.pxi":249
 *                         c_ns = c_ns.next
 *                     else:
 *                         raise MemoryError()             # <<<<<<<<<<<<<<
 *             if href_utf == node_ns_utf:
 *                 tree.xmlSetNs(c_node, c_ns)
*/
          /*else*/ {
            PyErr_NoMemory(); __PYX_ERR(4, 249, __pyx_L1_error)
          }
          __pyx_L15_break:;

          /* "src/lxml/apihelpers.pxi":236
 *                     tree.xmlStrcmp(c_ns.href, c_href) != 0:
 *                 c_ns = tree.xmlNewNs(c_node, c_href, c_prefix)
 *                 if c_ns is NULL:             # <<<<<<<<<<<<<<
 *                     # libxml2 has two error conditions: "out of memory" and "prefix exists already".
 *                     # We ignore the latter for compatibility reasons. It currently only appears
*/
        }

        /* "src/lxml/apihelpers.pxi":232
 *             # add namespace with prefix if it is not already known
 *             c_ns = tree.xmlSearchNs(doc._c_doc, c_node, c_prefix)
 *             if c_ns is NULL or \             # <<<<<<<<<<<<<<
 *                     c_ns.href is NULL or \
 *                     tree.xmlStrcmp(c_ns.href, c_href) != 0:
*/
      }

      /* "src/lxml/apihelpers.pxi":250
 *                     else:
 *                         raise MemoryError()
 *             if href_utf == node_ns_utf:             # <<<<<<<<<<<<<<
 *                 tree.xmlSetNs(c_node, c_ns)
 *                 node_ns_utf = None
*/
      __pyx_t_1 = (__Pyx_PyBytes_Equals(__pyx_v_href_utf, __pyx_v_node_ns_utf, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(4, 250, __pyx_L1_error)
      if (__pyx_t_1) {

        /* "src/lxml/apihelpers.pxi":251
 *                         raise MemoryError()
 *             if href_utf == node_ns_utf:
 *                 tree.xmlSetNs(c_node, c_ns)             # <<<<<<<<<<<<<<
 *                 node_ns_utf = None
 * 
*/
        xmlSetNs(__pyx_v_c_node, __pyx_v_c_ns);

        /* "src/lxml/apihelpers.pxi":252
 *             if href_utf == node_ns_utf:
 *                 tree.xmlSetNs(c_node, c_ns)
 *                 node_ns_utf = None             # <<<<<<<<<<<<<<
 * 
 *     if node_ns_utf is not None:
*/
        __Pyx_INCREF(Py_None);
        __Pyx_DECREF_SET(__pyx_v_node_ns_utf, Py_None);

        /* "src/lxml/apihelpers.pxi":250
 *                     else:
 *                         raise MemoryError()
 *             if href_utf == node_ns_utf:             # <<<<<<<<<<<<<<
 *                 tree.xmlSetNs(c_node, c_ns)
 *                 node_ns_utf = None
*/
      }

      /* "src/lxml/apihelpers.pxi":220
 * 
 *     if nsmap:
 *         for prefix, href in _iter_nsmap(nsmap):             # <<<<<<<<<<<<<<
 *             href_utf = _utf8(href)
 *             _uriValidOrRaise(href_utf)
*/
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/apihelpers.pxi":219
 *     cdef list nsdefs
 * 
 *     if nsmap:             # <<<<<<<<<<<<<<
 *         for prefix, href in _iter_nsmap(nsmap):
 *             href_utf = _utf8(href)
*/
  }

  /* "src/lxml/apihelpers.pxi":254
 *                 node_ns_utf = None
 * 
 *     if node_ns_utf is not None:             # <<<<<<<<<<<<<<
 *         _uriValidOrRaise(node_ns_utf)
 *         doc._setNodeNs(c_node, _xcstr(node_ns_utf))
*/
  __pyx_t_1 = (__pyx_v_node_ns_utf != Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":255
 * 
 *     if node_ns_utf is not None:
 *         _uriValidOrRaise(node_ns_utf)             # <<<<<<<<<<<<<<
 *         doc._setNodeNs(c_node, _xcstr(node_ns_utf))
 *     return 0
*/
    __pyx_t_10 = __pyx_f_4lxml_5etree__uriValidOrRaise(__pyx_v_node_ns_utf); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(4, 255, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":256
 *     if node_ns_utf is not None:
 *         _uriValidOrRaise(node_ns_utf)
 *         doc._setNodeNs(c_node, _xcstr(node_ns_utf))             # <<<<<<<<<<<<<<
 *     return 0
 * 
*/
    __pyx_t_10 = __pyx_f_4lxml_5etree_9_Document__setNodeNs(__pyx_v_doc, __pyx_v_c_node, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_node_ns_utf)); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(4, 256, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":254
 *                 node_ns_utf = None
 * 
 *     if node_ns_utf is not None:             # <<<<<<<<<<<<<<
 *         _uriValidOrRaise(node_ns_utf)
 *         doc._setNodeNs(c_node, _xcstr(node_ns_utf))
*/
  }

  /* "src/lxml/apihelpers.pxi":257
 *         _uriValidOrRaise(node_ns_utf)
 *         doc._setNodeNs(c_node, _xcstr(node_ns_utf))
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":209
 * 
 * 
 * cdef int _setNodeNamespaces(xmlNode* c_node, _Document doc,             # <<<<<<<<<<<<<<
 *                             object node_ns_utf, object nsmap) except -1:
 *     """Lookup current namespace prefixes, then set namespace structure for
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("lxml.etree._setNodeNamespaces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_prefix);
  __Pyx_XDECREF(__pyx_v_href);
  __Pyx_XDECREF(__pyx_v_href_utf);
  __Pyx_XDECREF(__pyx_v_prefix_utf);
  __Pyx_XDECREF(__pyx_v_node_ns_utf);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":260
 * 
 * 
 * cdef dict _build_nsmap(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     """
 *     Namespace prefix->URI mapping known in the context of this Element.
*/

static PyObject *__pyx_f_4lxml_5etree__build_nsmap(xmlNode *__pyx_v_c_node) {
  xmlNs *__pyx_v_c_ns;
  PyObject *__pyx_v_nsmap = NULL;
  PyObject *__pyx_v_prefix = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  xmlNs *__pyx_t_4;
  xmlNode *__pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_build_nsmap", 0);

  /* "src/lxml/apihelpers.pxi":266
 *     """
 *     cdef xmlNs* c_ns
 *     nsmap = {}             # <<<<<<<<<<<<<<
 *     while c_node is not NULL and c_node.type == tree.XML_ELEMENT_NODE:
 *         c_ns = c_node.nsDef
*/
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 266, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_nsmap = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/apihelpers.pxi":267
 *     cdef xmlNs* c_ns
 *     nsmap = {}
 *     while c_node is not NULL and c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         c_ns = c_node.nsDef
 *         while c_ns is not NULL:
*/
  while (1) {
    __pyx_t_3 = (__pyx_v_c_node != NULL);
    if (__pyx_t_3) {
    } else {
      __pyx_t_2 = __pyx_t_3;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_3 = (__pyx_v_c_node->type == XML_ELEMENT_NODE);
    __pyx_t_2 = __pyx_t_3;
    __pyx_L5_bool_binop_done:;
    if (!__pyx_t_2) break;

    /* "src/lxml/apihelpers.pxi":268
 *     nsmap = {}
 *     while c_node is not NULL and c_node.type == tree.XML_ELEMENT_NODE:
 *         c_ns = c_node.nsDef             # <<<<<<<<<<<<<<
 *         while c_ns is not NULL:
 *             if c_ns.prefix or c_ns.href:
*/
    __pyx_t_4 = __pyx_v_c_node->nsDef;
    __pyx_v_c_ns = __pyx_t_4;

    /* "src/lxml/apihelpers.pxi":269
 *     while c_node is not NULL and c_node.type == tree.XML_ELEMENT_NODE:
 *         c_ns = c_node.nsDef
 *         while c_ns is not NULL:             # <<<<<<<<<<<<<<
 *             if c_ns.prefix or c_ns.href:
 *                 prefix = funicodeOrNone(c_ns.prefix)
*/
    while (1) {
      __pyx_t_2 = (__pyx_v_c_ns != NULL);
      if (!__pyx_t_2) break;

      /* "src/lxml/apihelpers.pxi":270
 *         c_ns = c_node.nsDef
 *         while c_ns is not NULL:
 *             if c_ns.prefix or c_ns.href:             # <<<<<<<<<<<<<<
 *                 prefix = funicodeOrNone(c_ns.prefix)
 *                 if prefix not in nsmap:
*/
      __pyx_t_3 = (__pyx_v_c_ns->prefix != 0);
      if (!__pyx_t_3) {
      } else {
        __pyx_t_2 = __pyx_t_3;
        goto __pyx_L10_bool_binop_done;
      }
      __pyx_t_3 = (__pyx_v_c_ns->href != 0);
      __pyx_t_2 = __pyx_t_3;
      __pyx_L10_bool_binop_done:;
      if (__pyx_t_2) {

        /* "src/lxml/apihelpers.pxi":271
 *         while c_ns is not NULL:
 *             if c_ns.prefix or c_ns.href:
 *                 prefix = funicodeOrNone(c_ns.prefix)             # <<<<<<<<<<<<<<
 *                 if prefix not in nsmap:
 *                     nsmap[prefix] = funicodeOrNone(c_ns.href)
*/
        __pyx_t_1 = __pyx_f_4lxml_5etree_funicodeOrNone(__pyx_v_c_ns->prefix); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 271, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_XDECREF_SET(__pyx_v_prefix, ((PyObject*)__pyx_t_1));
        __pyx_t_1 = 0;

        /* "src/lxml/apihelpers.pxi":272
 *             if c_ns.prefix or c_ns.href:
 *                 prefix = funicodeOrNone(c_ns.prefix)
 *                 if prefix not in nsmap:             # <<<<<<<<<<<<<<
 *                     nsmap[prefix] = funicodeOrNone(c_ns.href)
 *             c_ns = c_ns.next
*/
        __pyx_t_2 = (__Pyx_PyDict_ContainsTF(__pyx_v_prefix, __pyx_v_nsmap, Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(4, 272, __pyx_L1_error)
        if (__pyx_t_2) {

          /* "src/lxml/apihelpers.pxi":273
 *                 prefix = funicodeOrNone(c_ns.prefix)
 *                 if prefix not in nsmap:
 *                     nsmap[prefix] = funicodeOrNone(c_ns.href)             # <<<<<<<<<<<<<<
 *             c_ns = c_ns.next
 *         c_node = c_node.parent
*/
          __pyx_t_1 = __pyx_f_4lxml_5etree_funicodeOrNone(__pyx_v_c_ns->href); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 273, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          if (unlikely((PyDict_SetItem(__pyx_v_nsmap, __pyx_v_prefix, __pyx_t_1) < 0))) __PYX_ERR(4, 273, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

          /* "src/lxml/apihelpers.pxi":272
 *             if c_ns.prefix or c_ns.href:
 *                 prefix = funicodeOrNone(c_ns.prefix)
 *                 if prefix not in nsmap:             # <<<<<<<<<<<<<<
 *                     nsmap[prefix] = funicodeOrNone(c_ns.href)
 *             c_ns = c_ns.next
*/
        }

        /* "src/lxml/apihelpers.pxi":270
 *         c_ns = c_node.nsDef
 *         while c_ns is not NULL:
 *             if c_ns.prefix or c_ns.href:             # <<<<<<<<<<<<<<
 *                 prefix = funicodeOrNone(c_ns.prefix)
 *                 if prefix not in nsmap:
*/
      }

      /* "src/lxml/apihelpers.pxi":274
 *                 if prefix not in nsmap:
 *                     nsmap[prefix] = funicodeOrNone(c_ns.href)
 *             c_ns = c_ns.next             # <<<<<<<<<<<<<<
 *         c_node = c_node.parent
 *     return nsmap
*/
      __pyx_t_4 = __pyx_v_c_ns->next;
      __pyx_v_c_ns = __pyx_t_4;
    }

    /* "src/lxml/apihelpers.pxi":275
 *                     nsmap[prefix] = funicodeOrNone(c_ns.href)
 *             c_ns = c_ns.next
 *         c_node = c_node.parent             # <<<<<<<<<<<<<<
 *     return nsmap
 * 
*/
    __pyx_t_5 = __pyx_v_c_node->parent;
    __pyx_v_c_node = __pyx_t_5;
  }

  /* "src/lxml/apihelpers.pxi":276
 *             c_ns = c_ns.next
 *         c_node = c_node.parent
 *     return nsmap             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_nsmap);
  __pyx_r = __pyx_v_nsmap;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":260
 * 
 * 
 * cdef dict _build_nsmap(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     """
 *     Namespace prefix->URI mapping known in the context of this Element.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._build_nsmap", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nsmap);
  __Pyx_XDECREF(__pyx_v_prefix);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":279
 * 
 * 
 * cdef _iter_nsmap(nsmap):             # <<<<<<<<<<<<<<
 *     """
 *     Create a reproducibly ordered iterable from an nsmap mapping.
*/

static PyObject *__pyx_f_4lxml_5etree__iter_nsmap(PyObject *__pyx_v_nsmap) {
  PyObject *__pyx_v_default_ns = NULL;
  PyObject *__pyx_v_nsdefs = NULL;
  PyObject *__pyx_8genexpr2__pyx_v_k = NULL;
  PyObject *__pyx_8genexpr2__pyx_v_v = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_iter_nsmap", 0);

  /* "src/lxml/apihelpers.pxi":287
 *     in Py3.x.
 *     """
 *     if isinstance(nsmap, dict):             # <<<<<<<<<<<<<<
 *         # dicts are insertion-ordered in Py3.6+ => keep the user provided order.
 *         return nsmap.items()
*/
  __pyx_t_1 = PyDict_Check(__pyx_v_nsmap); 
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":289
 *     if isinstance(nsmap, dict):
 *         # dicts are insertion-ordered in Py3.6+ => keep the user provided order.
 *         return nsmap.items()             # <<<<<<<<<<<<<<
 *     if len(nsmap) <= 1:
 *         return nsmap.items()
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __pyx_v_nsmap;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_items, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 289, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":287
 *     in Py3.x.
 *     """
 *     if isinstance(nsmap, dict):             # <<<<<<<<<<<<<<
 *         # dicts are insertion-ordered in Py3.6+ => keep the user provided order.
 *         return nsmap.items()
*/
  }

  /* "src/lxml/apihelpers.pxi":290
 *         # dicts are insertion-ordered in Py3.6+ => keep the user provided order.
 *         return nsmap.items()
 *     if len(nsmap) <= 1:             # <<<<<<<<<<<<<<
 *         return nsmap.items()
 *     if isinstance(nsmap, OrderedDict):
*/
  __pyx_t_5 = PyObject_Length(__pyx_v_nsmap); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(4, 290, __pyx_L1_error)
  __pyx_t_1 = (__pyx_t_5 <= 1);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":291
 *         return nsmap.items()
 *     if len(nsmap) <= 1:
 *         return nsmap.items()             # <<<<<<<<<<<<<<
 *     if isinstance(nsmap, OrderedDict):
 *         return nsmap.items()  # keep existing order
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __pyx_v_nsmap;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_items, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 291, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":290
 *         # dicts are insertion-ordered in Py3.6+ => keep the user provided order.
 *         return nsmap.items()
 *     if len(nsmap) <= 1:             # <<<<<<<<<<<<<<
 *         return nsmap.items()
 *     if isinstance(nsmap, OrderedDict):
*/
  }

  /* "src/lxml/apihelpers.pxi":292
 *     if len(nsmap) <= 1:
 *         return nsmap.items()
 *     if isinstance(nsmap, OrderedDict):             # <<<<<<<<<<<<<<
 *         return nsmap.items()  # keep existing order
 *     if None not in nsmap:
*/
  __pyx_t_2 = __pyx_v_4lxml_5etree_OrderedDict;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_1 = PyObject_IsInstance(__pyx_v_nsmap, __pyx_t_2); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(4, 292, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":293
 *         return nsmap.items()
 *     if isinstance(nsmap, OrderedDict):
 *         return nsmap.items()  # keep existing order             # <<<<<<<<<<<<<<
 *     if None not in nsmap:
 *         return sorted(nsmap.items())
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __pyx_v_nsmap;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_items, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 293, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":292
 *     if len(nsmap) <= 1:
 *         return nsmap.items()
 *     if isinstance(nsmap, OrderedDict):             # <<<<<<<<<<<<<<
 *         return nsmap.items()  # keep existing order
 *     if None not in nsmap:
*/
  }

  /* "src/lxml/apihelpers.pxi":294
 *     if isinstance(nsmap, OrderedDict):
 *         return nsmap.items()  # keep existing order
 *     if None not in nsmap:             # <<<<<<<<<<<<<<
 *         return sorted(nsmap.items())
 * 
*/
  __pyx_t_1 = (__Pyx_PySequence_ContainsTF(Py_None, __pyx_v_nsmap, Py_NE)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(4, 294, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":295
 *         return nsmap.items()  # keep existing order
 *     if None not in nsmap:
 *         return sorted(nsmap.items())             # <<<<<<<<<<<<<<
 * 
 *     # Move the default namespace to the end.  This makes sure libxml2
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __pyx_v_nsmap;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_items, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 295, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_t_3 = PySequence_List(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 295, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely((PyList_Sort(__pyx_t_3) < 0))) __PYX_ERR(4, 295, __pyx_L1_error)
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":294
 *     if isinstance(nsmap, OrderedDict):
 *         return nsmap.items()  # keep existing order
 *     if None not in nsmap:             # <<<<<<<<<<<<<<
 *         return sorted(nsmap.items())
 * 
*/
  }

  /* "src/lxml/apihelpers.pxi":303
 *     # elements serialise without prefix (i.e. into the non-default
 *     # namespace).
 *     default_ns = nsmap[None]             # <<<<<<<<<<<<<<
 *     nsdefs = [(k, v) for k, v in nsmap.items() if k is not None]
 *     nsdefs.sort()
*/
  __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_nsmap, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 303, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_default_ns = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "src/lxml/apihelpers.pxi":304
 *     # namespace).
 *     default_ns = nsmap[None]
 *     nsdefs = [(k, v) for k, v in nsmap.items() if k is not None]             # <<<<<<<<<<<<<<
 *     nsdefs.sort()
 *     nsdefs.append((None, default_ns))
*/
  { /* enter inner scope */
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 304, __pyx_L9_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = 0;
    if (unlikely(__pyx_v_nsmap == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
      __PYX_ERR(4, 304, __pyx_L9_error)
    }
    __pyx_t_8 = __Pyx_dict_iterator(__pyx_v_nsmap, 0, __pyx_mstate_global->__pyx_n_u_items, (&__pyx_t_6), (&__pyx_t_7)); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 304, __pyx_L9_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_XDECREF(__pyx_t_2);
    __pyx_t_2 = __pyx_t_8;
    __pyx_t_8 = 0;
    while (1) {
      __pyx_t_10 = __Pyx_dict_iter_next(__pyx_t_2, __pyx_t_6, &__pyx_t_5, &__pyx_t_8, &__pyx_t_9, NULL, __pyx_t_7);
      if (unlikely(__pyx_t_10 == 0)) break;
      if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(4, 304, __pyx_L9_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_XDECREF_SET(__pyx_8genexpr2__pyx_v_k, __pyx_t_8);
      __pyx_t_8 = 0;
      __Pyx_XDECREF_SET(__pyx_8genexpr2__pyx_v_v, __pyx_t_9);
      __pyx_t_9 = 0;
      __pyx_t_1 = (__pyx_8genexpr2__pyx_v_k != Py_None);
      if (__pyx_t_1) {
        __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(4, 304, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_INCREF(__pyx_8genexpr2__pyx_v_k);
        __Pyx_GIVEREF(__pyx_8genexpr2__pyx_v_k);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_8genexpr2__pyx_v_k) != (0)) __PYX_ERR(4, 304, __pyx_L9_error);
        __Pyx_INCREF(__pyx_8genexpr2__pyx_v_v);
        __Pyx_GIVEREF(__pyx_8genexpr2__pyx_v_v);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_8genexpr2__pyx_v_v) != (0)) __PYX_ERR(4, 304, __pyx_L9_error);
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_9))) __PYX_ERR(4, 304, __pyx_L9_error)
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_k); __pyx_8genexpr2__pyx_v_k = 0;
    __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_v); __pyx_8genexpr2__pyx_v_v = 0;
    goto __pyx_L13_exit_scope;
    __pyx_L9_error:;
    __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_k); __pyx_8genexpr2__pyx_v_k = 0;
    __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_v); __pyx_8genexpr2__pyx_v_v = 0;
    goto __pyx_L1_error;
    __pyx_L13_exit_scope:;
  } /* exit inner scope */
  __pyx_v_nsdefs = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/apihelpers.pxi":305
 *     default_ns = nsmap[None]
 *     nsdefs = [(k, v) for k, v in nsmap.items() if k is not None]
 *     nsdefs.sort()             # <<<<<<<<<<<<<<
 *     nsdefs.append((None, default_ns))
 *     return nsdefs
*/
  __pyx_t_11 = PyList_Sort(__pyx_v_nsdefs); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(4, 305, __pyx_L1_error)

  /* "src/lxml/apihelpers.pxi":306
 *     nsdefs = [(k, v) for k, v in nsmap.items() if k is not None]
 *     nsdefs.sort()
 *     nsdefs.append((None, default_ns))             # <<<<<<<<<<<<<<
 *     return nsdefs
 * 
*/
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 306, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None) != (0)) __PYX_ERR(4, 306, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_default_ns);
  __Pyx_GIVEREF(__pyx_v_default_ns);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_default_ns) != (0)) __PYX_ERR(4, 306, __pyx_L1_error);
  __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_nsdefs, __pyx_t_3); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(4, 306, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/apihelpers.pxi":307
 *     nsdefs.sort()
 *     nsdefs.append((None, default_ns))
 *     return nsdefs             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_nsdefs);
  __pyx_r = __pyx_v_nsdefs;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":279
 * 
 * 
 * cdef _iter_nsmap(nsmap):             # <<<<<<<<<<<<<<
 *     """
 *     Create a reproducibly ordered iterable from an nsmap mapping.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("lxml.etree._iter_nsmap", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_default_ns);
  __Pyx_XDECREF(__pyx_v_nsdefs);
  __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_k);
  __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":310
 * 
 * 
 * cdef _iter_attrib(attrib):             # <<<<<<<<<<<<<<
 *     """
 *     Create a reproducibly ordered iterable from an attrib mapping.
*/

static PyObject *__pyx_f_4lxml_5etree__iter_attrib(PyObject *__pyx_v_attrib) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_iter_attrib", 0);

  /* "src/lxml/apihelpers.pxi":316
 *     """
 *     # dicts are insertion-ordered in Py3.6+ => keep the user provided order.
 *     if isinstance(attrib, (dict, _Attrib, OrderedDict)):             # <<<<<<<<<<<<<<
 *         return attrib.items()
 *     # assume it's an unordered mapping of some kind
*/
  __Pyx_INCREF(__pyx_v_4lxml_5etree_OrderedDict);
  __pyx_t_1 = __pyx_v_4lxml_5etree_OrderedDict;
  __pyx_t_3 = PyDict_Check(__pyx_v_attrib); 
  if (!__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_attrib, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Attrib); 
  if (!__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = PyObject_IsInstance(__pyx_v_attrib, __pyx_t_1); 
  __pyx_t_2 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "src/lxml/apihelpers.pxi":317
 *     # dicts are insertion-ordered in Py3.6+ => keep the user provided order.
 *     if isinstance(attrib, (dict, _Attrib, OrderedDict)):
 *         return attrib.items()             # <<<<<<<<<<<<<<
 *     # assume it's an unordered mapping of some kind
 *     return sorted(attrib.items())
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __pyx_v_attrib;
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_5 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_items, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 317, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":316
 *     """
 *     # dicts are insertion-ordered in Py3.6+ => keep the user provided order.
 *     if isinstance(attrib, (dict, _Attrib, OrderedDict)):             # <<<<<<<<<<<<<<
 *         return attrib.items()
 *     # assume it's an unordered mapping of some kind
*/
  }

  /* "src/lxml/apihelpers.pxi":319
 *         return attrib.items()
 *     # assume it's an unordered mapping of some kind
 *     return sorted(attrib.items())             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __pyx_v_attrib;
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_items, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 319, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_4 = PySequence_List(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 319, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely((PyList_Sort(__pyx_t_4) < 0))) __PYX_ERR(4, 319, __pyx_L1_error)
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":310
 * 
 * 
 * cdef _iter_attrib(attrib):             # <<<<<<<<<<<<<<
 *     """
 *     Create a reproducibly ordered iterable from an attrib mapping.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._iter_attrib", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":322
 * 
 * 
 * cdef _initNodeAttributes(xmlNode* c_node, _Document doc, attrib, dict extra):             # <<<<<<<<<<<<<<
 *     """Initialise the attributes of an element node.
 *     """
*/

static PyObject *__pyx_f_4lxml_5etree__initNodeAttributes(xmlNode *__pyx_v_c_node, struct LxmlDocument *__pyx_v_doc, PyObject *__pyx_v_attrib, PyObject *__pyx_v_extra) {
  int __pyx_v_is_html;
  PyObject *__pyx_v_seen = NULL;
  PyObject *__pyx_v_name = NULL;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  const char *__pyx_t_4;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  Py_ssize_t __pyx_t_8;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  PyObject *(*__pyx_t_12)(PyObject *);
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *(*__pyx_t_15)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_initNodeAttributes", 0);

  /* "src/lxml/apihelpers.pxi":327
 *     cdef bint is_html
 *     cdef xmlNs* c_ns
 *     if attrib is not None and not hasattr(attrib, 'items'):             # <<<<<<<<<<<<<<
 *         raise TypeError, f"Invalid attribute dictionary: {python._fqtypename(attrib).decode('utf8')}"
 *     if not attrib and not extra:
*/
  __pyx_t_2 = (__pyx_v_attrib != Py_None);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = __Pyx_HasAttr(__pyx_v_attrib, __pyx_mstate_global->__pyx_n_u_items); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(4, 327, __pyx_L1_error)
  __pyx_t_3 = (!__pyx_t_2);
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/apihelpers.pxi":328
 *     cdef xmlNs* c_ns
 *     if attrib is not None and not hasattr(attrib, 'items'):
 *         raise TypeError, f"Invalid attribute dictionary: {python._fqtypename(attrib).decode('utf8')}"             # <<<<<<<<<<<<<<
 *     if not attrib and not extra:
 *         return  # nothing to do
*/
    __pyx_t_4 = _fqtypename(__pyx_v_attrib);
    __pyx_t_5 = __Pyx_ssize_strlen(__pyx_t_4); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(4, 328, __pyx_L1_error)
    __pyx_t_6 = __Pyx_decode_c_string(__pyx_t_4, 0, __pyx_t_5, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 328, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_Invalid_attribute_dictionary, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 328, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_t_7, 0, 0);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __PYX_ERR(4, 328, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":327
 *     cdef bint is_html
 *     cdef xmlNs* c_ns
 *     if attrib is not None and not hasattr(attrib, 'items'):             # <<<<<<<<<<<<<<
 *         raise TypeError, f"Invalid attribute dictionary: {python._fqtypename(attrib).decode('utf8')}"
 *     if not attrib and not extra:
*/
  }

  /* "src/lxml/apihelpers.pxi":329
 *     if attrib is not None and not hasattr(attrib, 'items'):
 *         raise TypeError, f"Invalid attribute dictionary: {python._fqtypename(attrib).decode('utf8')}"
 *     if not attrib and not extra:             # <<<<<<<<<<<<<<
 *         return  # nothing to do
 *     is_html = doc._parser._for_html
*/
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_attrib); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(4, 329, __pyx_L1_error)
  __pyx_t_2 = (!__pyx_t_3);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L7_bool_binop_done;
  }
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_extra); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(4, 329, __pyx_L1_error)
  __pyx_t_3 = (!__pyx_t_2);
  __pyx_t_1 = __pyx_t_3;
  __pyx_L7_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":330
 *         raise TypeError, f"Invalid attribute dictionary: {python._fqtypename(attrib).decode('utf8')}"
 *     if not attrib and not extra:
 *         return  # nothing to do             # <<<<<<<<<<<<<<
 *     is_html = doc._parser._for_html
 *     seen = set()
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":329
 *     if attrib is not None and not hasattr(attrib, 'items'):
 *         raise TypeError, f"Invalid attribute dictionary: {python._fqtypename(attrib).decode('utf8')}"
 *     if not attrib and not extra:             # <<<<<<<<<<<<<<
 *         return  # nothing to do
 *     is_html = doc._parser._for_html
*/
  }

  /* "src/lxml/apihelpers.pxi":331
 *     if not attrib and not extra:
 *         return  # nothing to do
 *     is_html = doc._parser._for_html             # <<<<<<<<<<<<<<
 *     seen = set()
 *     if extra:
*/
  __pyx_t_1 = __pyx_v_doc->_parser->_for_html;
  __pyx_v_is_html = __pyx_t_1;

  /* "src/lxml/apihelpers.pxi":332
 *         return  # nothing to do
 *     is_html = doc._parser._for_html
 *     seen = set()             # <<<<<<<<<<<<<<
 *     if extra:
 *         for name, value in extra.items():
*/
  __pyx_t_7 = PySet_New(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 332, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_v_seen = ((PyObject*)__pyx_t_7);
  __pyx_t_7 = 0;

  /* "src/lxml/apihelpers.pxi":333
 *     is_html = doc._parser._for_html
 *     seen = set()
 *     if extra:             # <<<<<<<<<<<<<<
 *         for name, value in extra.items():
 *             _addAttributeToNode(c_node, doc, is_html, name, value, seen)
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_extra); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(4, 333, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":334
 *     seen = set()
 *     if extra:
 *         for name, value in extra.items():             # <<<<<<<<<<<<<<
 *             _addAttributeToNode(c_node, doc, is_html, name, value, seen)
 *     if attrib:
*/
    __pyx_t_5 = 0;
    if (unlikely(__pyx_v_extra == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
      __PYX_ERR(4, 334, __pyx_L1_error)
    }
    __pyx_t_6 = __Pyx_dict_iterator(__pyx_v_extra, 1, __pyx_mstate_global->__pyx_n_u_items, (&__pyx_t_8), (&__pyx_t_9)); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 334, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_7);
    __pyx_t_7 = __pyx_t_6;
    __pyx_t_6 = 0;
    while (1) {
      __pyx_t_11 = __Pyx_dict_iter_next(__pyx_t_7, __pyx_t_8, &__pyx_t_5, &__pyx_t_6, &__pyx_t_10, NULL, __pyx_t_9);
      if (unlikely(__pyx_t_11 == 0)) break;
      if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(4, 334, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_6);
      __pyx_t_6 = 0;
      __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_10);
      __pyx_t_10 = 0;

      /* "src/lxml/apihelpers.pxi":335
 *     if extra:
 *         for name, value in extra.items():
 *             _addAttributeToNode(c_node, doc, is_html, name, value, seen)             # <<<<<<<<<<<<<<
 *     if attrib:
 *         for name, value in _iter_attrib(attrib):
*/
      __pyx_t_11 = __pyx_f_4lxml_5etree__addAttributeToNode(__pyx_v_c_node, __pyx_v_doc, __pyx_v_is_html, __pyx_v_name, __pyx_v_value, __pyx_v_seen); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(4, 335, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "src/lxml/apihelpers.pxi":333
 *     is_html = doc._parser._for_html
 *     seen = set()
 *     if extra:             # <<<<<<<<<<<<<<
 *         for name, value in extra.items():
 *             _addAttributeToNode(c_node, doc, is_html, name, value, seen)
*/
  }

  /* "src/lxml/apihelpers.pxi":336
 *         for name, value in extra.items():
 *             _addAttributeToNode(c_node, doc, is_html, name, value, seen)
 *     if attrib:             # <<<<<<<<<<<<<<
 *         for name, value in _iter_attrib(attrib):
 *             _addAttributeToNode(c_node, doc, is_html, name, value, seen)
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_attrib); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(4, 336, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":337
 *             _addAttributeToNode(c_node, doc, is_html, name, value, seen)
 *     if attrib:
 *         for name, value in _iter_attrib(attrib):             # <<<<<<<<<<<<<<
 *             _addAttributeToNode(c_node, doc, is_html, name, value, seen)
 * 
*/
    __pyx_t_7 = __pyx_f_4lxml_5etree__iter_attrib(__pyx_v_attrib); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 337, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (likely(PyList_CheckExact(__pyx_t_7)) || PyTuple_CheckExact(__pyx_t_7)) {
      __pyx_t_10 = __pyx_t_7; __Pyx_INCREF(__pyx_t_10);
      __pyx_t_8 = 0;
      __pyx_t_12 = NULL;
    } else {
      __pyx_t_8 = -1; __pyx_t_10 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_10)) __PYX_ERR(4, 337, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_12 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_10); if (unlikely(!__pyx_t_12)) __PYX_ERR(4, 337, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    for (;;) {
      if (likely(!__pyx_t_12)) {
        if (likely(PyList_CheckExact(__pyx_t_10))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_10);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(4, 337, __pyx_L1_error)
            #endif
            if (__pyx_t_8 >= __pyx_temp) break;
          }
          __pyx_t_7 = __Pyx_PyList_GetItemRefFast(__pyx_t_10, __pyx_t_8, __Pyx_ReferenceSharing_OwnStrongReference);
          ++__pyx_t_8;
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_10);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(4, 337, __pyx_L1_error)
            #endif
            if (__pyx_t_8 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_7 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_8));
          #else
          __pyx_t_7 = __Pyx_PySequence_ITEM(__pyx_t_10, __pyx_t_8);
          #endif
          ++__pyx_t_8;
        }
        if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 337, __pyx_L1_error)
      } else {
        __pyx_t_7 = __pyx_t_12(__pyx_t_10);
        if (unlikely(!__pyx_t_7)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(4, 337, __pyx_L1_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_7);
      if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) {
        PyObject* sequence = __pyx_t_7;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(4, 337, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0);
          __Pyx_INCREF(__pyx_t_6);
          __pyx_t_13 = PyTuple_GET_ITEM(sequence, 1);
          __Pyx_INCREF(__pyx_t_13);
        } else {
          __pyx_t_6 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
          if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 337, __pyx_L1_error)
          __Pyx_XGOTREF(__pyx_t_6);
          __pyx_t_13 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
          if (unlikely(!__pyx_t_13)) __PYX_ERR(4, 337, __pyx_L1_error)
          __Pyx_XGOTREF(__pyx_t_13);
        }
        #else
        __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 337, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_13 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_13)) __PYX_ERR(4, 337, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        #endif
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_14 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_14)) __PYX_ERR(4, 337, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_15 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_14);
        index = 0; __pyx_t_6 = __pyx_t_15(__pyx_t_14); if (unlikely(!__pyx_t_6)) goto __pyx_L15_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_6);
        index = 1; __pyx_t_13 = __pyx_t_15(__pyx_t_14); if (unlikely(!__pyx_t_13)) goto __pyx_L15_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_13);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_15(__pyx_t_14), 2) < (0)) __PYX_ERR(4, 337, __pyx_L1_error)
        __pyx_t_15 = NULL;
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        goto __pyx_L16_unpacking_done;
        __pyx_L15_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __pyx_t_15 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(4, 337, __pyx_L1_error)
        __pyx_L16_unpacking_done:;
      }
      __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_6);
      __pyx_t_6 = 0;
      __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_13);
      __pyx_t_13 = 0;

      /* "src/lxml/apihelpers.pxi":338
 *     if attrib:
 *         for name, value in _iter_attrib(attrib):
 *             _addAttributeToNode(c_node, doc, is_html, name, value, seen)             # <<<<<<<<<<<<<<
 * 
 * 
*/
      __pyx_t_9 = __pyx_f_4lxml_5etree__addAttributeToNode(__pyx_v_c_node, __pyx_v_doc, __pyx_v_is_html, __pyx_v_name, __pyx_v_value, __pyx_v_seen); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(4, 338, __pyx_L1_error)

      /* "src/lxml/apihelpers.pxi":337
 *             _addAttributeToNode(c_node, doc, is_html, name, value, seen)
 *     if attrib:
 *         for name, value in _iter_attrib(attrib):             # <<<<<<<<<<<<<<
 *             _addAttributeToNode(c_node, doc, is_html, name, value, seen)
 * 
*/
    }
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

    /* "src/lxml/apihelpers.pxi":336
 *         for name, value in extra.items():
 *             _addAttributeToNode(c_node, doc, is_html, name, value, seen)
 *     if attrib:             # <<<<<<<<<<<<<<
 *         for name, value in _iter_attrib(attrib):
 *             _addAttributeToNode(c_node, doc, is_html, name, value, seen)
*/
  }

  /* "src/lxml/apihelpers.pxi":322
 * 
 * 
 * cdef _initNodeAttributes(xmlNode* c_node, _Document doc, attrib, dict extra):             # <<<<<<<<<<<<<<
 *     """Initialise the attributes of an element node.
 *     """
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_AddTraceback("lxml.etree._initNodeAttributes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_seen);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":341
 * 
 * 
 * cdef int _addAttributeToNode(xmlNode* c_node, _Document doc, bint is_html,             # <<<<<<<<<<<<<<
 *                              name, value, set seen_tags) except -1:
 *     ns_utf, name_utf = tag = _getNsTag(name)
*/

static int __pyx_f_4lxml_5etree__addAttributeToNode(xmlNode *__pyx_v_c_node, struct LxmlDocument *__pyx_v_doc, int __pyx_v_is_html, PyObject *__pyx_v_name, PyObject *__pyx_v_value, PyObject *__pyx_v_seen_tags) {
  PyObject *__pyx_v_ns_utf = NULL;
  PyObject *__pyx_v_name_utf = NULL;
  PyObject *__pyx_v_tag = NULL;
  PyObject *__pyx_v_value_utf = NULL;
  xmlAttr *__pyx_v_new_attr;
  xmlNs *__pyx_v_c_ns;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  xmlNs *__pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_addAttributeToNode", 0);

  /* "src/lxml/apihelpers.pxi":343
 * cdef int _addAttributeToNode(xmlNode* c_node, _Document doc, bint is_html,
 *                              name, value, set seen_tags) except -1:
 *     ns_utf, name_utf = tag = _getNsTag(name)             # <<<<<<<<<<<<<<
 *     if tag in seen_tags:
 *         return 0
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__getNsTag(__pyx_v_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 343, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(__pyx_t_1 != Py_None)) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(4, 343, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 343, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 343, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(4, 343, __pyx_L1_error)
  }
  __pyx_v_ns_utf = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_name_utf = __pyx_t_3;
  __pyx_t_3 = 0;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_tag = ((PyObject*)__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/apihelpers.pxi":344
 *                              name, value, set seen_tags) except -1:
 *     ns_utf, name_utf = tag = _getNsTag(name)
 *     if tag in seen_tags:             # <<<<<<<<<<<<<<
 *         return 0
 *     seen_tags.add(tag)
*/
  if (unlikely(__pyx_v_seen_tags == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(4, 344, __pyx_L1_error)
  }
  __pyx_t_4 = (__Pyx_PySet_ContainsTF(__pyx_v_tag, __pyx_v_seen_tags, Py_EQ)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(4, 344, __pyx_L1_error)
  if (__pyx_t_4) {

    /* "src/lxml/apihelpers.pxi":345
 *     ns_utf, name_utf = tag = _getNsTag(name)
 *     if tag in seen_tags:
 *         return 0             # <<<<<<<<<<<<<<
 *     seen_tags.add(tag)
 *     if not is_html:
*/
    __pyx_r = 0;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":344
 *                              name, value, set seen_tags) except -1:
 *     ns_utf, name_utf = tag = _getNsTag(name)
 *     if tag in seen_tags:             # <<<<<<<<<<<<<<
 *         return 0
 *     seen_tags.add(tag)
*/
  }

  /* "src/lxml/apihelpers.pxi":346
 *     if tag in seen_tags:
 *         return 0
 *     seen_tags.add(tag)             # <<<<<<<<<<<<<<
 *     if not is_html:
 *         _attributeValidOrRaise(name_utf)
*/
  if (unlikely(__pyx_v_seen_tags == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "add");
    __PYX_ERR(4, 346, __pyx_L1_error)
  }
  __pyx_t_5 = PySet_Add(__pyx_v_seen_tags, __pyx_v_tag); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(4, 346, __pyx_L1_error)

  /* "src/lxml/apihelpers.pxi":347
 *         return 0
 *     seen_tags.add(tag)
 *     if not is_html:             # <<<<<<<<<<<<<<
 *         _attributeValidOrRaise(name_utf)
 *     value_utf = _utf8(value)
*/
  __pyx_t_4 = (!__pyx_v_is_html);
  if (__pyx_t_4) {

    /* "src/lxml/apihelpers.pxi":348
 *     seen_tags.add(tag)
 *     if not is_html:
 *         _attributeValidOrRaise(name_utf)             # <<<<<<<<<<<<<<
 *     value_utf = _utf8(value)
 *     if ns_utf is None:
*/
    __pyx_t_6 = __pyx_f_4lxml_5etree__attributeValidOrRaise(__pyx_v_name_utf); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(4, 348, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":347
 *         return 0
 *     seen_tags.add(tag)
 *     if not is_html:             # <<<<<<<<<<<<<<
 *         _attributeValidOrRaise(name_utf)
 *     value_utf = _utf8(value)
*/
  }

  /* "src/lxml/apihelpers.pxi":349
 *     if not is_html:
 *         _attributeValidOrRaise(name_utf)
 *     value_utf = _utf8(value)             # <<<<<<<<<<<<<<
 *     if ns_utf is None:
 *         new_attr = tree.xmlNewProp(c_node, _xcstr(name_utf), _xcstr(value_utf))
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__utf8(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 349, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_value_utf = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/apihelpers.pxi":350
 *         _attributeValidOrRaise(name_utf)
 *     value_utf = _utf8(value)
 *     if ns_utf is None:             # <<<<<<<<<<<<<<
 *         new_attr = tree.xmlNewProp(c_node, _xcstr(name_utf), _xcstr(value_utf))
 *     else:
*/
  __pyx_t_4 = (__pyx_v_ns_utf == Py_None);
  if (__pyx_t_4) {

    /* "src/lxml/apihelpers.pxi":351
 *     value_utf = _utf8(value)
 *     if ns_utf is None:
 *         new_attr = tree.xmlNewProp(c_node, _xcstr(name_utf), _xcstr(value_utf))             # <<<<<<<<<<<<<<
 *     else:
 *         _uriValidOrRaise(ns_utf)
*/
    __pyx_v_new_attr = xmlNewProp(__pyx_v_c_node, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_name_utf), (const xmlChar*)PyBytes_AS_STRING(__pyx_v_value_utf));

    /* "src/lxml/apihelpers.pxi":350
 *         _attributeValidOrRaise(name_utf)
 *     value_utf = _utf8(value)
 *     if ns_utf is None:             # <<<<<<<<<<<<<<
 *         new_attr = tree.xmlNewProp(c_node, _xcstr(name_utf), _xcstr(value_utf))
 *     else:
*/
    goto __pyx_L5;
  }

  /* "src/lxml/apihelpers.pxi":353
 *         new_attr = tree.xmlNewProp(c_node, _xcstr(name_utf), _xcstr(value_utf))
 *     else:
 *         _uriValidOrRaise(ns_utf)             # <<<<<<<<<<<<<<
 *         c_ns = doc._findOrBuildNodeNs(c_node, _xcstr(ns_utf), NULL, 1)
 *         new_attr = tree.xmlNewNsProp(c_node, c_ns, _xcstr(name_utf), _xcstr(value_utf))
*/
  /*else*/ {
    __pyx_t_6 = __pyx_f_4lxml_5etree__uriValidOrRaise(__pyx_v_ns_utf); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(4, 353, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":354
 *     else:
 *         _uriValidOrRaise(ns_utf)
 *         c_ns = doc._findOrBuildNodeNs(c_node, _xcstr(ns_utf), NULL, 1)             # <<<<<<<<<<<<<<
 *         new_attr = tree.xmlNewNsProp(c_node, c_ns, _xcstr(name_utf), _xcstr(value_utf))
 *     if new_attr is NULL:
*/
    __pyx_t_7 = __pyx_f_4lxml_5etree_9_Document__findOrBuildNodeNs(__pyx_v_doc, __pyx_v_c_node, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_ns_utf), NULL, 1); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(4, 354, __pyx_L1_error)
    __pyx_v_c_ns = __pyx_t_7;

    /* "src/lxml/apihelpers.pxi":355
 *         _uriValidOrRaise(ns_utf)
 *         c_ns = doc._findOrBuildNodeNs(c_node, _xcstr(ns_utf), NULL, 1)
 *         new_attr = tree.xmlNewNsProp(c_node, c_ns, _xcstr(name_utf), _xcstr(value_utf))             # <<<<<<<<<<<<<<
 *     if new_attr is NULL:
 *         raise MemoryError()
*/
    __pyx_v_new_attr = xmlNewNsProp(__pyx_v_c_node, __pyx_v_c_ns, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_name_utf), (const xmlChar*)PyBytes_AS_STRING(__pyx_v_value_utf));
  }
  __pyx_L5:;

  /* "src/lxml/apihelpers.pxi":356
 *         c_ns = doc._findOrBuildNodeNs(c_node, _xcstr(ns_utf), NULL, 1)
 *         new_attr = tree.xmlNewNsProp(c_node, c_ns, _xcstr(name_utf), _xcstr(value_utf))
 *     if new_attr is NULL:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     return 0
*/
  __pyx_t_4 = (__pyx_v_new_attr == NULL);
  if (unlikely(__pyx_t_4)) {

    /* "src/lxml/apihelpers.pxi":357
 *         new_attr = tree.xmlNewNsProp(c_node, c_ns, _xcstr(name_utf), _xcstr(value_utf))
 *     if new_attr is NULL:
 *         raise MemoryError()             # <<<<<<<<<<<<<<
 *     return 0
 * 
*/
    PyErr_NoMemory(); __PYX_ERR(4, 357, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":356
 *         c_ns = doc._findOrBuildNodeNs(c_node, _xcstr(ns_utf), NULL, 1)
 *         new_attr = tree.xmlNewNsProp(c_node, c_ns, _xcstr(name_utf), _xcstr(value_utf))
 *     if new_attr is NULL:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     return 0
*/
  }

  /* "src/lxml/apihelpers.pxi":358
 *     if new_attr is NULL:
 *         raise MemoryError()
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":341
 * 
 * 
 * cdef int _addAttributeToNode(xmlNode* c_node, _Document doc, bint is_html,             # <<<<<<<<<<<<<<
 *                              name, value, set seen_tags) except -1:
 *     ns_utf, name_utf = tag = _getNsTag(name)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._addAttributeToNode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ns_utf);
  __Pyx_XDECREF(__pyx_v_name_utf);
  __Pyx_XDECREF(__pyx_v_tag);
  __Pyx_XDECREF(__pyx_v_value_utf);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":366
 * 
 * 
 * cdef int _collectNsDefs(xmlNode* c_element, _ns_node_ref **_c_ns_list,             # <<<<<<<<<<<<<<
 *                         size_t *_c_ns_list_len, size_t *_c_ns_list_size) except -1:
 *     c_ns_list = _c_ns_list[0]
*/

static int __pyx_f_4lxml_5etree__collectNsDefs(xmlNode *__pyx_v_c_element, __pyx_t_4lxml_5etree__ns_node_ref **__pyx_v__c_ns_list, size_t *__pyx_v__c_ns_list_len, size_t *__pyx_v__c_ns_list_size) {
  __pyx_t_4lxml_5etree__ns_node_ref *__pyx_v_c_ns_list;
  size_t __pyx_v_c_ns_list_len;
  size_t __pyx_v_c_ns_list_size;
  xmlNs *__pyx_v_c_nsdef;
  __pyx_t_4lxml_5etree__ns_node_ref *__pyx_v_c_nsref_ptr;
  int __pyx_r;
  xmlNs *__pyx_t_1;
  int __pyx_t_2;
  __pyx_t_4lxml_5etree__ns_node_ref __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/apihelpers.pxi":368
 * cdef int _collectNsDefs(xmlNode* c_element, _ns_node_ref **_c_ns_list,
 *                         size_t *_c_ns_list_len, size_t *_c_ns_list_size) except -1:
 *     c_ns_list = _c_ns_list[0]             # <<<<<<<<<<<<<<
 *     cdef size_t c_ns_list_len = _c_ns_list_len[0]
 *     cdef size_t c_ns_list_size = _c_ns_list_size[0]
*/
  __pyx_v_c_ns_list = (__pyx_v__c_ns_list[0]);

  /* "src/lxml/apihelpers.pxi":369
 *                         size_t *_c_ns_list_len, size_t *_c_ns_list_size) except -1:
 *     c_ns_list = _c_ns_list[0]
 *     cdef size_t c_ns_list_len = _c_ns_list_len[0]             # <<<<<<<<<<<<<<
 *     cdef size_t c_ns_list_size = _c_ns_list_size[0]
 * 
*/
  __pyx_v_c_ns_list_len = (__pyx_v__c_ns_list_len[0]);

  /* "src/lxml/apihelpers.pxi":370
 *     c_ns_list = _c_ns_list[0]
 *     cdef size_t c_ns_list_len = _c_ns_list_len[0]
 *     cdef size_t c_ns_list_size = _c_ns_list_size[0]             # <<<<<<<<<<<<<<
 * 
 *     c_nsdef = c_element.nsDef
*/
  __pyx_v_c_ns_list_size = (__pyx_v__c_ns_list_size[0]);

  /* "src/lxml/apihelpers.pxi":372
 *     cdef size_t c_ns_list_size = _c_ns_list_size[0]
 * 
 *     c_nsdef = c_element.nsDef             # <<<<<<<<<<<<<<
 *     while c_nsdef is not NULL:
 *         if c_ns_list_len >= c_ns_list_size:
*/
  __pyx_t_1 = __pyx_v_c_element->nsDef;
  __pyx_v_c_nsdef = __pyx_t_1;

  /* "src/lxml/apihelpers.pxi":373
 * 
 *     c_nsdef = c_element.nsDef
 *     while c_nsdef is not NULL:             # <<<<<<<<<<<<<<
 *         if c_ns_list_len >= c_ns_list_size:
 *             if c_ns_list is NULL:
*/
  while (1) {
    __pyx_t_2 = (__pyx_v_c_nsdef != NULL);
    if (!__pyx_t_2) break;

    /* "src/lxml/apihelpers.pxi":374
 *     c_nsdef = c_element.nsDef
 *     while c_nsdef is not NULL:
 *         if c_ns_list_len >= c_ns_list_size:             # <<<<<<<<<<<<<<
 *             if c_ns_list is NULL:
 *                 c_ns_list_size = 20
*/
    __pyx_t_2 = (__pyx_v_c_ns_list_len >= __pyx_v_c_ns_list_size);
    if (__pyx_t_2) {

      /* "src/lxml/apihelpers.pxi":375
 *     while c_nsdef is not NULL:
 *         if c_ns_list_len >= c_ns_list_size:
 *             if c_ns_list is NULL:             # <<<<<<<<<<<<<<
 *                 c_ns_list_size = 20
 *             else:
*/
      __pyx_t_2 = (__pyx_v_c_ns_list == NULL);
      if (__pyx_t_2) {

        /* "src/lxml/apihelpers.pxi":376
 *         if c_ns_list_len >= c_ns_list_size:
 *             if c_ns_list is NULL:
 *                 c_ns_list_size = 20             # <<<<<<<<<<<<<<
 *             else:
 *                 c_ns_list_size *= 2
*/
        __pyx_v_c_ns_list_size = 20;

        /* "src/lxml/apihelpers.pxi":375
 *     while c_nsdef is not NULL:
 *         if c_ns_list_len >= c_ns_list_size:
 *             if c_ns_list is NULL:             # <<<<<<<<<<<<<<
 *                 c_ns_list_size = 20
 *             else:
*/
        goto __pyx_L6;
      }

      /* "src/lxml/apihelpers.pxi":378
 *                 c_ns_list_size = 20
 *             else:
 *                 c_ns_list_size *= 2             # <<<<<<<<<<<<<<
 *             c_nsref_ptr = <_ns_node_ref*> python.lxml_realloc(
 *                 c_ns_list, c_ns_list_size, sizeof(_ns_node_ref))
*/
      /*else*/ {
        __pyx_v_c_ns_list_size = (__pyx_v_c_ns_list_size * 2);
      }
      __pyx_L6:;

      /* "src/lxml/apihelpers.pxi":379
 *             else:
 *                 c_ns_list_size *= 2
 *             c_nsref_ptr = <_ns_node_ref*> python.lxml_realloc(             # <<<<<<<<<<<<<<
 *                 c_ns_list, c_ns_list_size, sizeof(_ns_node_ref))
 *             if c_nsref_ptr is NULL:
*/
      __pyx_v_c_nsref_ptr = ((__pyx_t_4lxml_5etree__ns_node_ref *)lxml_realloc(__pyx_v_c_ns_list, __pyx_v_c_ns_list_size, (sizeof(__pyx_t_4lxml_5etree__ns_node_ref))));

      /* "src/lxml/apihelpers.pxi":381
 *             c_nsref_ptr = <_ns_node_ref*> python.lxml_realloc(
 *                 c_ns_list, c_ns_list_size, sizeof(_ns_node_ref))
 *             if c_nsref_ptr is NULL:             # <<<<<<<<<<<<<<
 *                 if c_ns_list is not NULL:
 *                     python.lxml_free(c_ns_list)
*/
      __pyx_t_2 = (__pyx_v_c_nsref_ptr == NULL);
      if (__pyx_t_2) {

        /* "src/lxml/apihelpers.pxi":382
 *                 c_ns_list, c_ns_list_size, sizeof(_ns_node_ref))
 *             if c_nsref_ptr is NULL:
 *                 if c_ns_list is not NULL:             # <<<<<<<<<<<<<<
 *                     python.lxml_free(c_ns_list)
 *                     _c_ns_list[0] = NULL
*/
        __pyx_t_2 = (__pyx_v_c_ns_list != NULL);
        if (__pyx_t_2) {

          /* "src/lxml/apihelpers.pxi":383
 *             if c_nsref_ptr is NULL:
 *                 if c_ns_list is not NULL:
 *                     python.lxml_free(c_ns_list)             # <<<<<<<<<<<<<<
 *                     _c_ns_list[0] = NULL
 *                 raise MemoryError()
*/
          lxml_free(__pyx_v_c_ns_list);

          /* "src/lxml/apihelpers.pxi":384
 *                 if c_ns_list is not NULL:
 *                     python.lxml_free(c_ns_list)
 *                     _c_ns_list[0] = NULL             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 *             c_ns_list = c_nsref_ptr
*/
          (__pyx_v__c_ns_list[0]) = NULL;

          /* "src/lxml/apihelpers.pxi":382
 *                 c_ns_list, c_ns_list_size, sizeof(_ns_node_ref))
 *             if c_nsref_ptr is NULL:
 *                 if c_ns_list is not NULL:             # <<<<<<<<<<<<<<
 *                     python.lxml_free(c_ns_list)
 *                     _c_ns_list[0] = NULL
*/
        }

        /* "src/lxml/apihelpers.pxi":385
 *                     python.lxml_free(c_ns_list)
 *                     _c_ns_list[0] = NULL
 *                 raise MemoryError()             # <<<<<<<<<<<<<<
 *             c_ns_list = c_nsref_ptr
 * 
*/
        PyErr_NoMemory(); __PYX_ERR(4, 385, __pyx_L1_error)

        /* "src/lxml/apihelpers.pxi":381
 *             c_nsref_ptr = <_ns_node_ref*> python.lxml_realloc(
 *                 c_ns_list, c_ns_list_size, sizeof(_ns_node_ref))
 *             if c_nsref_ptr is NULL:             # <<<<<<<<<<<<<<
 *                 if c_ns_list is not NULL:
 *                     python.lxml_free(c_ns_list)
*/
      }

      /* "src/lxml/apihelpers.pxi":386
 *                     _c_ns_list[0] = NULL
 *                 raise MemoryError()
 *             c_ns_list = c_nsref_ptr             # <<<<<<<<<<<<<<
 * 
 *         c_ns_list[c_ns_list_len] = _ns_node_ref(c_nsdef, c_element)
*/
      __pyx_v_c_ns_list = __pyx_v_c_nsref_ptr;

      /* "src/lxml/apihelpers.pxi":374
 *     c_nsdef = c_element.nsDef
 *     while c_nsdef is not NULL:
 *         if c_ns_list_len >= c_ns_list_size:             # <<<<<<<<<<<<<<
 *             if c_ns_list is NULL:
 *                 c_ns_list_size = 20
*/
    }

    /* "src/lxml/apihelpers.pxi":388
 *             c_ns_list = c_nsref_ptr
 * 
 *         c_ns_list[c_ns_list_len] = _ns_node_ref(c_nsdef, c_element)             # <<<<<<<<<<<<<<
 *         c_ns_list_len += 1
 *         c_nsdef = c_nsdef.next
*/
    __pyx_t_3.ns = __pyx_v_c_nsdef;
    __pyx_t_3.node = __pyx_v_c_element;
    (__pyx_v_c_ns_list[__pyx_v_c_ns_list_len]) = __pyx_t_3;

    /* "src/lxml/apihelpers.pxi":389
 * 
 *         c_ns_list[c_ns_list_len] = _ns_node_ref(c_nsdef, c_element)
 *         c_ns_list_len += 1             # <<<<<<<<<<<<<<
 *         c_nsdef = c_nsdef.next
 * 
*/
    __pyx_v_c_ns_list_len = (__pyx_v_c_ns_list_len + 1);

    /* "src/lxml/apihelpers.pxi":390
 *         c_ns_list[c_ns_list_len] = _ns_node_ref(c_nsdef, c_element)
 *         c_ns_list_len += 1
 *         c_nsdef = c_nsdef.next             # <<<<<<<<<<<<<<
 * 
 *     _c_ns_list_size[0] = c_ns_list_size
*/
    __pyx_t_1 = __pyx_v_c_nsdef->next;
    __pyx_v_c_nsdef = __pyx_t_1;
  }

  /* "src/lxml/apihelpers.pxi":392
 *         c_nsdef = c_nsdef.next
 * 
 *     _c_ns_list_size[0] = c_ns_list_size             # <<<<<<<<<<<<<<
 *     _c_ns_list_len[0] = c_ns_list_len
 *     _c_ns_list[0] = c_ns_list
*/
  (__pyx_v__c_ns_list_size[0]) = __pyx_v_c_ns_list_size;

  /* "src/lxml/apihelpers.pxi":393
 * 
 *     _c_ns_list_size[0] = c_ns_list_size
 *     _c_ns_list_len[0] = c_ns_list_len             # <<<<<<<<<<<<<<
 *     _c_ns_list[0] = c_ns_list
 * 
*/
  (__pyx_v__c_ns_list_len[0]) = __pyx_v_c_ns_list_len;

  /* "src/lxml/apihelpers.pxi":394
 *     _c_ns_list_size[0] = c_ns_list_size
 *     _c_ns_list_len[0] = c_ns_list_len
 *     _c_ns_list[0] = c_ns_list             # <<<<<<<<<<<<<<
 * 
 * 
*/
  (__pyx_v__c_ns_list[0]) = __pyx_v_c_ns_list;

  /* "src/lxml/apihelpers.pxi":366
 * 
 * 
 * cdef int _collectNsDefs(xmlNode* c_element, _ns_node_ref **_c_ns_list,             # <<<<<<<<<<<<<<
 *                         size_t *_c_ns_list_len, size_t *_c_ns_list_size) except -1:
 *     c_ns_list = _c_ns_list[0]
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._collectNsDefs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":397
 * 
 * 
 * cdef int _removeUnusedNamespaceDeclarations(xmlNode* c_element, set prefixes_to_keep) except -1:             # <<<<<<<<<<<<<<
 *     """Remove any namespace declarations from a subtree that are not used by
 *     any of its elements (or attributes).
*/

static int __pyx_f_4lxml_5etree__removeUnusedNamespaceDeclarations(xmlNode *__pyx_v_c_element, PyObject *__pyx_v_prefixes_to_keep) {
  xmlNode *__pyx_v_c_node;
  __pyx_t_4lxml_5etree__ns_node_ref *__pyx_v_c_ns_list;
  size_t __pyx_v_c_ns_list_size;
  size_t __pyx_v_c_ns_list_len;
  size_t __pyx_v_i;
  xmlNs *__pyx_v_c_nsdef;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  size_t __pyx_t_4;
  size_t __pyx_t_5;
  size_t __pyx_t_6;
  xmlNode *__pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  xmlNs *__pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_removeUnusedNamespaceDeclarations", 0);

  /* "src/lxml/apihelpers.pxi":405
 *     """
 *     cdef xmlNode* c_node
 *     cdef _ns_node_ref* c_ns_list = NULL             # <<<<<<<<<<<<<<
 *     cdef size_t c_ns_list_size = 0
 *     cdef size_t c_ns_list_len = 0
*/
  __pyx_v_c_ns_list = NULL;

  /* "src/lxml/apihelpers.pxi":406
 *     cdef xmlNode* c_node
 *     cdef _ns_node_ref* c_ns_list = NULL
 *     cdef size_t c_ns_list_size = 0             # <<<<<<<<<<<<<<
 *     cdef size_t c_ns_list_len = 0
 *     cdef size_t i
*/
  __pyx_v_c_ns_list_size = 0;

  /* "src/lxml/apihelpers.pxi":407
 *     cdef _ns_node_ref* c_ns_list = NULL
 *     cdef size_t c_ns_list_size = 0
 *     cdef size_t c_ns_list_len = 0             # <<<<<<<<<<<<<<
 *     cdef size_t i
 * 
*/
  __pyx_v_c_ns_list_len = 0;

  /* "src/lxml/apihelpers.pxi":410
 *     cdef size_t i
 * 
 *     if c_element.parent and c_element.parent.type == tree.XML_DOCUMENT_NODE:             # <<<<<<<<<<<<<<
 *         # include declarations on the document node
 *         _collectNsDefs(c_element.parent, &c_ns_list, &c_ns_list_len, &c_ns_list_size)
*/
  __pyx_t_2 = (__pyx_v_c_element->parent != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_c_element->parent->type == XML_DOCUMENT_NODE);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":412
 *     if c_element.parent and c_element.parent.type == tree.XML_DOCUMENT_NODE:
 *         # include declarations on the document node
 *         _collectNsDefs(c_element.parent, &c_ns_list, &c_ns_list_len, &c_ns_list_size)             # <<<<<<<<<<<<<<
 * 
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_element, c_element, 1)
*/
    __pyx_t_3 = __pyx_f_4lxml_5etree__collectNsDefs(__pyx_v_c_element->parent, (&__pyx_v_c_ns_list), (&__pyx_v_c_ns_list_len), (&__pyx_v_c_ns_list_size)); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(4, 412, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":410
 *     cdef size_t i
 * 
 *     if c_element.parent and c_element.parent.type == tree.XML_DOCUMENT_NODE:             # <<<<<<<<<<<<<<
 *         # include declarations on the document node
 *         _collectNsDefs(c_element.parent, &c_ns_list, &c_ns_list_len, &c_ns_list_size)
*/
  }

  /* "src/lxml/apihelpers.pxi":414
 *         _collectNsDefs(c_element.parent, &c_ns_list, &c_ns_list_len, &c_ns_list_size)
 * 
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_element, c_element, 1)             # <<<<<<<<<<<<<<
 *     # collect all new namespace declarations into the ns list
 *     if c_element.nsDef:
*/
  BEGIN_FOR_EACH_ELEMENT_FROM(__pyx_v_c_element, __pyx_v_c_element, 1);

  /* "src/lxml/apihelpers.pxi":416
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_element, c_element, 1)
 *     # collect all new namespace declarations into the ns list
 *     if c_element.nsDef:             # <<<<<<<<<<<<<<
 *         _collectNsDefs(c_element, &c_ns_list, &c_ns_list_len, &c_ns_list_size)
 * 
*/
  __pyx_t_1 = (__pyx_v_c_element->nsDef != 0);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":417
 *     # collect all new namespace declarations into the ns list
 *     if c_element.nsDef:
 *         _collectNsDefs(c_element, &c_ns_list, &c_ns_list_len, &c_ns_list_size)             # <<<<<<<<<<<<<<
 * 
 *     # remove all namespace declarations from the list that are referenced
*/
    __pyx_t_3 = __pyx_f_4lxml_5etree__collectNsDefs(__pyx_v_c_element, (&__pyx_v_c_ns_list), (&__pyx_v_c_ns_list_len), (&__pyx_v_c_ns_list_size)); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(4, 417, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":416
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_element, c_element, 1)
 *     # collect all new namespace declarations into the ns list
 *     if c_element.nsDef:             # <<<<<<<<<<<<<<
 *         _collectNsDefs(c_element, &c_ns_list, &c_ns_list_len, &c_ns_list_size)
 * 
*/
  }

  /* "src/lxml/apihelpers.pxi":420
 * 
 *     # remove all namespace declarations from the list that are referenced
 *     if c_ns_list_len and c_element.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         c_node = c_element
 *         while c_node and c_ns_list_len:
*/
  __pyx_t_2 = (__pyx_v_c_ns_list_len != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L8_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_c_element->type == XML_ELEMENT_NODE);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L8_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":421
 *     # remove all namespace declarations from the list that are referenced
 *     if c_ns_list_len and c_element.type == tree.XML_ELEMENT_NODE:
 *         c_node = c_element             # <<<<<<<<<<<<<<
 *         while c_node and c_ns_list_len:
 *             if c_node.ns:
*/
    __pyx_v_c_node = __pyx_v_c_element;

    /* "src/lxml/apihelpers.pxi":422
 *     if c_ns_list_len and c_element.type == tree.XML_ELEMENT_NODE:
 *         c_node = c_element
 *         while c_node and c_ns_list_len:             # <<<<<<<<<<<<<<
 *             if c_node.ns:
 *                 for i in range(c_ns_list_len):
*/
    while (1) {
      __pyx_t_2 = (__pyx_v_c_node != 0);
      if (__pyx_t_2) {
      } else {
        __pyx_t_1 = __pyx_t_2;
        goto __pyx_L12_bool_binop_done;
      }
      __pyx_t_2 = (__pyx_v_c_ns_list_len != 0);
      __pyx_t_1 = __pyx_t_2;
      __pyx_L12_bool_binop_done:;
      if (!__pyx_t_1) break;

      /* "src/lxml/apihelpers.pxi":423
 *         c_node = c_element
 *         while c_node and c_ns_list_len:
 *             if c_node.ns:             # <<<<<<<<<<<<<<
 *                 for i in range(c_ns_list_len):
 *                     if c_node.ns is c_ns_list[i].ns:
*/
      __pyx_t_1 = (__pyx_v_c_node->ns != 0);
      if (__pyx_t_1) {

        /* "src/lxml/apihelpers.pxi":424
 *         while c_node and c_ns_list_len:
 *             if c_node.ns:
 *                 for i in range(c_ns_list_len):             # <<<<<<<<<<<<<<
 *                     if c_node.ns is c_ns_list[i].ns:
 *                         c_ns_list_len -= 1
*/
        __pyx_t_4 = __pyx_v_c_ns_list_len;
        __pyx_t_5 = __pyx_t_4;
        for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
          __pyx_v_i = __pyx_t_6;

          /* "src/lxml/apihelpers.pxi":425
 *             if c_node.ns:
 *                 for i in range(c_ns_list_len):
 *                     if c_node.ns is c_ns_list[i].ns:             # <<<<<<<<<<<<<<
 *                         c_ns_list_len -= 1
 *                         c_ns_list[i] = c_ns_list[c_ns_list_len]
*/
          __pyx_t_1 = (__pyx_v_c_node->ns == (__pyx_v_c_ns_list[__pyx_v_i]).ns);
          if (__pyx_t_1) {

            /* "src/lxml/apihelpers.pxi":426
 *                 for i in range(c_ns_list_len):
 *                     if c_node.ns is c_ns_list[i].ns:
 *                         c_ns_list_len -= 1             # <<<<<<<<<<<<<<
 *                         c_ns_list[i] = c_ns_list[c_ns_list_len]
 *                         #c_ns_list[c_ns_list_len] = _ns_node_ref(NULL, NULL)
*/
            __pyx_v_c_ns_list_len = (__pyx_v_c_ns_list_len - 1);

            /* "src/lxml/apihelpers.pxi":427
 *                     if c_node.ns is c_ns_list[i].ns:
 *                         c_ns_list_len -= 1
 *                         c_ns_list[i] = c_ns_list[c_ns_list_len]             # <<<<<<<<<<<<<<
 *                         #c_ns_list[c_ns_list_len] = _ns_node_ref(NULL, NULL)
 *                         break
*/
            (__pyx_v_c_ns_list[__pyx_v_i]) = (__pyx_v_c_ns_list[__pyx_v_c_ns_list_len]);

            /* "src/lxml/apihelpers.pxi":429
 *                         c_ns_list[i] = c_ns_list[c_ns_list_len]
 *                         #c_ns_list[c_ns_list_len] = _ns_node_ref(NULL, NULL)
 *                         break             # <<<<<<<<<<<<<<
 *             if c_node is c_element:
 *                 # continue with attributes
*/
            goto __pyx_L16_break;

            /* "src/lxml/apihelpers.pxi":425
 *             if c_node.ns:
 *                 for i in range(c_ns_list_len):
 *                     if c_node.ns is c_ns_list[i].ns:             # <<<<<<<<<<<<<<
 *                         c_ns_list_len -= 1
 *                         c_ns_list[i] = c_ns_list[c_ns_list_len]
*/
          }
        }
        __pyx_L16_break:;

        /* "src/lxml/apihelpers.pxi":423
 *         c_node = c_element
 *         while c_node and c_ns_list_len:
 *             if c_node.ns:             # <<<<<<<<<<<<<<
 *                 for i in range(c_ns_list_len):
 *                     if c_node.ns is c_ns_list[i].ns:
*/
      }

      /* "src/lxml/apihelpers.pxi":430
 *                         #c_ns_list[c_ns_list_len] = _ns_node_ref(NULL, NULL)
 *                         break
 *             if c_node is c_element:             # <<<<<<<<<<<<<<
 *                 # continue with attributes
 *                 c_node = <xmlNode*>c_element.properties
*/
      __pyx_t_1 = (__pyx_v_c_node == __pyx_v_c_element);
      if (__pyx_t_1) {

        /* "src/lxml/apihelpers.pxi":432
 *             if c_node is c_element:
 *                 # continue with attributes
 *                 c_node = <xmlNode*>c_element.properties             # <<<<<<<<<<<<<<
 *             else:
 *                 c_node = c_node.next
*/
        __pyx_v_c_node = ((xmlNode *)__pyx_v_c_element->properties);

        /* "src/lxml/apihelpers.pxi":430
 *                         #c_ns_list[c_ns_list_len] = _ns_node_ref(NULL, NULL)
 *                         break
 *             if c_node is c_element:             # <<<<<<<<<<<<<<
 *                 # continue with attributes
 *                 c_node = <xmlNode*>c_element.properties
*/
        goto __pyx_L18;
      }

      /* "src/lxml/apihelpers.pxi":434
 *                 c_node = <xmlNode*>c_element.properties
 *             else:
 *                 c_node = c_node.next             # <<<<<<<<<<<<<<
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_element)
 * 
*/
      /*else*/ {
        __pyx_t_7 = __pyx_v_c_node->next;
        __pyx_v_c_node = __pyx_t_7;
      }
      __pyx_L18:;
    }

    /* "src/lxml/apihelpers.pxi":420
 * 
 *     # remove all namespace declarations from the list that are referenced
 *     if c_ns_list_len and c_element.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         c_node = c_element
 *         while c_node and c_ns_list_len:
*/
  }

  /* "src/lxml/apihelpers.pxi":435
 *             else:
 *                 c_node = c_node.next
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_element)             # <<<<<<<<<<<<<<
 * 
 *     if c_ns_list is NULL:
*/
  END_FOR_EACH_ELEMENT_FROM(__pyx_v_c_element);

  /* "src/lxml/apihelpers.pxi":437
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_element)
 * 
 *     if c_ns_list is NULL:             # <<<<<<<<<<<<<<
 *         return 0
 * 
*/
  __pyx_t_1 = (__pyx_v_c_ns_list == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":438
 * 
 *     if c_ns_list is NULL:
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     # free all namespace declarations that remained in the list,
*/
    __pyx_r = 0;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":437
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_element)
 * 
 *     if c_ns_list is NULL:             # <<<<<<<<<<<<<<
 *         return 0
 * 
*/
  }

  /* "src/lxml/apihelpers.pxi":443
 *     # except for those we should keep explicitly
 *     cdef xmlNs* c_nsdef
 *     for i in range(c_ns_list_len):             # <<<<<<<<<<<<<<
 *         if prefixes_to_keep is not None:
 *             if c_ns_list[i].ns.prefix and c_ns_list[i].ns.prefix in prefixes_to_keep:
*/
  __pyx_t_4 = __pyx_v_c_ns_list_len;
  __pyx_t_5 = __pyx_t_4;
  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
    __pyx_v_i = __pyx_t_6;

    /* "src/lxml/apihelpers.pxi":444
 *     cdef xmlNs* c_nsdef
 *     for i in range(c_ns_list_len):
 *         if prefixes_to_keep is not None:             # <<<<<<<<<<<<<<
 *             if c_ns_list[i].ns.prefix and c_ns_list[i].ns.prefix in prefixes_to_keep:
 *                 continue
*/
    __pyx_t_1 = (__pyx_v_prefixes_to_keep != ((PyObject*)Py_None));
    if (__pyx_t_1) {

      /* "src/lxml/apihelpers.pxi":445
 *     for i in range(c_ns_list_len):
 *         if prefixes_to_keep is not None:
 *             if c_ns_list[i].ns.prefix and c_ns_list[i].ns.prefix in prefixes_to_keep:             # <<<<<<<<<<<<<<
 *                 continue
 *         c_node = c_ns_list[i].node
*/
      __pyx_t_2 = ((__pyx_v_c_ns_list[__pyx_v_i]).ns->prefix != 0);
      if (__pyx_t_2) {
      } else {
        __pyx_t_1 = __pyx_t_2;
        goto __pyx_L24_bool_binop_done;
      }
      __pyx_t_8 = __Pyx_PyBytes_FromCString((__pyx_v_c_ns_list[__pyx_v_i]).ns->prefix); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 445, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (unlikely(__pyx_v_prefixes_to_keep == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
        __PYX_ERR(4, 445, __pyx_L1_error)
      }
      __pyx_t_2 = (__Pyx_PySet_ContainsTF(__pyx_t_8, __pyx_v_prefixes_to_keep, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(4, 445, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_1 = __pyx_t_2;
      __pyx_L24_bool_binop_done:;
      if (__pyx_t_1) {

        /* "src/lxml/apihelpers.pxi":446
 *         if prefixes_to_keep is not None:
 *             if c_ns_list[i].ns.prefix and c_ns_list[i].ns.prefix in prefixes_to_keep:
 *                 continue             # <<<<<<<<<<<<<<
 *         c_node = c_ns_list[i].node
 *         c_nsdef = c_node.nsDef
*/
        goto __pyx_L20_continue;

        /* "src/lxml/apihelpers.pxi":445
 *     for i in range(c_ns_list_len):
 *         if prefixes_to_keep is not None:
 *             if c_ns_list[i].ns.prefix and c_ns_list[i].ns.prefix in prefixes_to_keep:             # <<<<<<<<<<<<<<
 *                 continue
 *         c_node = c_ns_list[i].node
*/
      }

      /* "src/lxml/apihelpers.pxi":444
 *     cdef xmlNs* c_nsdef
 *     for i in range(c_ns_list_len):
 *         if prefixes_to_keep is not None:             # <<<<<<<<<<<<<<
 *             if c_ns_list[i].ns.prefix and c_ns_list[i].ns.prefix in prefixes_to_keep:
 *                 continue
*/
    }

    /* "src/lxml/apihelpers.pxi":447
 *             if c_ns_list[i].ns.prefix and c_ns_list[i].ns.prefix in prefixes_to_keep:
 *                 continue
 *         c_node = c_ns_list[i].node             # <<<<<<<<<<<<<<
 *         c_nsdef = c_node.nsDef
 *         if c_nsdef is c_ns_list[i].ns:
*/
    __pyx_t_7 = (__pyx_v_c_ns_list[__pyx_v_i]).node;
    __pyx_v_c_node = __pyx_t_7;

    /* "src/lxml/apihelpers.pxi":448
 *                 continue
 *         c_node = c_ns_list[i].node
 *         c_nsdef = c_node.nsDef             # <<<<<<<<<<<<<<
 *         if c_nsdef is c_ns_list[i].ns:
 *             c_node.nsDef = c_node.nsDef.next
*/
    __pyx_t_9 = __pyx_v_c_node->nsDef;
    __pyx_v_c_nsdef = __pyx_t_9;

    /* "src/lxml/apihelpers.pxi":449
 *         c_node = c_ns_list[i].node
 *         c_nsdef = c_node.nsDef
 *         if c_nsdef is c_ns_list[i].ns:             # <<<<<<<<<<<<<<
 *             c_node.nsDef = c_node.nsDef.next
 *         else:
*/
    __pyx_t_1 = (__pyx_v_c_nsdef == (__pyx_v_c_ns_list[__pyx_v_i]).ns);
    if (__pyx_t_1) {

      /* "src/lxml/apihelpers.pxi":450
 *         c_nsdef = c_node.nsDef
 *         if c_nsdef is c_ns_list[i].ns:
 *             c_node.nsDef = c_node.nsDef.next             # <<<<<<<<<<<<<<
 *         else:
 *             while c_nsdef.next is not c_ns_list[i].ns:
*/
      __pyx_t_9 = __pyx_v_c_node->nsDef->next;
      __pyx_v_c_node->nsDef = __pyx_t_9;

      /* "src/lxml/apihelpers.pxi":449
 *         c_node = c_ns_list[i].node
 *         c_nsdef = c_node.nsDef
 *         if c_nsdef is c_ns_list[i].ns:             # <<<<<<<<<<<<<<
 *             c_node.nsDef = c_node.nsDef.next
 *         else:
*/
      goto __pyx_L26;
    }

    /* "src/lxml/apihelpers.pxi":452
 *             c_node.nsDef = c_node.nsDef.next
 *         else:
 *             while c_nsdef.next is not c_ns_list[i].ns:             # <<<<<<<<<<<<<<
 *                 c_nsdef = c_nsdef.next
 *             c_nsdef.next = c_nsdef.next.next
*/
    /*else*/ {
      while (1) {
        __pyx_t_1 = (__pyx_v_c_nsdef->next != (__pyx_v_c_ns_list[__pyx_v_i]).ns);
        if (!__pyx_t_1) break;

        /* "src/lxml/apihelpers.pxi":453
 *         else:
 *             while c_nsdef.next is not c_ns_list[i].ns:
 *                 c_nsdef = c_nsdef.next             # <<<<<<<<<<<<<<
 *             c_nsdef.next = c_nsdef.next.next
 *         tree.xmlFreeNs(c_ns_list[i].ns)
*/
        __pyx_t_9 = __pyx_v_c_nsdef->next;
        __pyx_v_c_nsdef = __pyx_t_9;
      }

      /* "src/lxml/apihelpers.pxi":454
 *             while c_nsdef.next is not c_ns_list[i].ns:
 *                 c_nsdef = c_nsdef.next
 *             c_nsdef.next = c_nsdef.next.next             # <<<<<<<<<<<<<<
 *         tree.xmlFreeNs(c_ns_list[i].ns)
 * 
*/
      __pyx_t_9 = __pyx_v_c_nsdef->next->next;
      __pyx_v_c_nsdef->next = __pyx_t_9;
    }
    __pyx_L26:;

    /* "src/lxml/apihelpers.pxi":455
 *                 c_nsdef = c_nsdef.next
 *             c_nsdef.next = c_nsdef.next.next
 *         tree.xmlFreeNs(c_ns_list[i].ns)             # <<<<<<<<<<<<<<
 * 
 *     if c_ns_list is not NULL:
*/
    xmlFreeNs((__pyx_v_c_ns_list[__pyx_v_i]).ns);
    __pyx_L20_continue:;
  }

  /* "src/lxml/apihelpers.pxi":457
 *         tree.xmlFreeNs(c_ns_list[i].ns)
 * 
 *     if c_ns_list is not NULL:             # <<<<<<<<<<<<<<
 *         python.lxml_free(c_ns_list)
 *     return 0
*/
  __pyx_t_1 = (__pyx_v_c_ns_list != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":458
 * 
 *     if c_ns_list is not NULL:
 *         python.lxml_free(c_ns_list)             # <<<<<<<<<<<<<<
 *     return 0
 * 
*/
    lxml_free(__pyx_v_c_ns_list);

    /* "src/lxml/apihelpers.pxi":457
 *         tree.xmlFreeNs(c_ns_list[i].ns)
 * 
 *     if c_ns_list is not NULL:             # <<<<<<<<<<<<<<
 *         python.lxml_free(c_ns_list)
 *     return 0
*/
  }

  /* "src/lxml/apihelpers.pxi":459
 *     if c_ns_list is not NULL:
 *         python.lxml_free(c_ns_list)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef xmlNs* _searchNsByHref(xmlNode* c_node, const_xmlChar* c_href, bint is_attribute) noexcept:
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":397
 * 
 * 
 * cdef int _removeUnusedNamespaceDeclarations(xmlNode* c_element, set prefixes_to_keep) except -1:             # <<<<<<<<<<<<<<
 *     """Remove any namespace declarations from a subtree that are not used by
 *     any of its elements (or attributes).
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("lxml.etree._removeUnusedNamespaceDeclarations", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":461
 *     return 0
 * 
 * cdef xmlNs* _searchNsByHref(xmlNode* c_node, const_xmlChar* c_href, bint is_attribute) noexcept:             # <<<<<<<<<<<<<<
 *     """Search a namespace declaration that covers a node (element or
 *     attribute).
*/

static xmlNs *__pyx_f_4lxml_5etree__searchNsByHref(xmlNode *__pyx_v_c_node, const xmlChar *__pyx_v_c_href, int __pyx_v_is_attribute) {
  xmlNs *__pyx_v_c_ns;
  xmlNs *__pyx_v_c_default_ns;
  xmlNode *__pyx_v_c_element;
  xmlNs *__pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  xmlNode *__pyx_t_3;
  xmlNs *__pyx_t_4;

  /* "src/lxml/apihelpers.pxi":470
 *     """
 *     cdef xmlNs* c_ns
 *     cdef xmlNs* c_default_ns = NULL             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_element
 *     if c_href is NULL or c_node is NULL or c_node.type == tree.XML_ENTITY_REF_NODE:
*/
  __pyx_v_c_default_ns = NULL;

  /* "src/lxml/apihelpers.pxi":472
 *     cdef xmlNs* c_default_ns = NULL
 *     cdef xmlNode* c_element
 *     if c_href is NULL or c_node is NULL or c_node.type == tree.XML_ENTITY_REF_NODE:             # <<<<<<<<<<<<<<
 *         return NULL
 *     if tree.xmlStrcmp(c_href, tree.XML_XML_NAMESPACE) == 0:
*/
  __pyx_t_2 = (__pyx_v_c_href == NULL);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_c_node == NULL);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_c_node->type == XML_ENTITY_REF_NODE);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":473
 *     cdef xmlNode* c_element
 *     if c_href is NULL or c_node is NULL or c_node.type == tree.XML_ENTITY_REF_NODE:
 *         return NULL             # <<<<<<<<<<<<<<
 *     if tree.xmlStrcmp(c_href, tree.XML_XML_NAMESPACE) == 0:
 *         # no special cases here, let libxml2 handle this
*/
    __pyx_r = NULL;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":472
 *     cdef xmlNs* c_default_ns = NULL
 *     cdef xmlNode* c_element
 *     if c_href is NULL or c_node is NULL or c_node.type == tree.XML_ENTITY_REF_NODE:             # <<<<<<<<<<<<<<
 *         return NULL
 *     if tree.xmlStrcmp(c_href, tree.XML_XML_NAMESPACE) == 0:
*/
  }

  /* "src/lxml/apihelpers.pxi":474
 *     if c_href is NULL or c_node is NULL or c_node.type == tree.XML_ENTITY_REF_NODE:
 *         return NULL
 *     if tree.xmlStrcmp(c_href, tree.XML_XML_NAMESPACE) == 0:             # <<<<<<<<<<<<<<
 *         # no special cases here, let libxml2 handle this
 *         return tree.xmlSearchNsByHref(c_node.doc, c_node, c_href)
*/
  __pyx_t_1 = (xmlStrcmp(__pyx_v_c_href, XML_XML_NAMESPACE) == 0);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":476
 *     if tree.xmlStrcmp(c_href, tree.XML_XML_NAMESPACE) == 0:
 *         # no special cases here, let libxml2 handle this
 *         return tree.xmlSearchNsByHref(c_node.doc, c_node, c_href)             # <<<<<<<<<<<<<<
 *     if c_node.type == tree.XML_ATTRIBUTE_NODE:
 *         is_attribute = 1
*/
    __pyx_r = xmlSearchNsByHref(__pyx_v_c_node->doc, __pyx_v_c_node, __pyx_v_c_href);
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":474
 *     if c_href is NULL or c_node is NULL or c_node.type == tree.XML_ENTITY_REF_NODE:
 *         return NULL
 *     if tree.xmlStrcmp(c_href, tree.XML_XML_NAMESPACE) == 0:             # <<<<<<<<<<<<<<
 *         # no special cases here, let libxml2 handle this
 *         return tree.xmlSearchNsByHref(c_node.doc, c_node, c_href)
*/
  }

  /* "src/lxml/apihelpers.pxi":477
 *         # no special cases here, let libxml2 handle this
 *         return tree.xmlSearchNsByHref(c_node.doc, c_node, c_href)
 *     if c_node.type == tree.XML_ATTRIBUTE_NODE:             # <<<<<<<<<<<<<<
 *         is_attribute = 1
 *     while c_node is not NULL and c_node.type != tree.XML_ELEMENT_NODE:
*/
  __pyx_t_1 = (__pyx_v_c_node->type == XML_ATTRIBUTE_NODE);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":478
 *         return tree.xmlSearchNsByHref(c_node.doc, c_node, c_href)
 *     if c_node.type == tree.XML_ATTRIBUTE_NODE:
 *         is_attribute = 1             # <<<<<<<<<<<<<<
 *     while c_node is not NULL and c_node.type != tree.XML_ELEMENT_NODE:
 *         c_node = c_node.parent
*/
    __pyx_v_is_attribute = 1;

    /* "src/lxml/apihelpers.pxi":477
 *         # no special cases here, let libxml2 handle this
 *         return tree.xmlSearchNsByHref(c_node.doc, c_node, c_href)
 *     if c_node.type == tree.XML_ATTRIBUTE_NODE:             # <<<<<<<<<<<<<<
 *         is_attribute = 1
 *     while c_node is not NULL and c_node.type != tree.XML_ELEMENT_NODE:
*/
  }

  /* "src/lxml/apihelpers.pxi":479
 *     if c_node.type == tree.XML_ATTRIBUTE_NODE:
 *         is_attribute = 1
 *     while c_node is not NULL and c_node.type != tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         c_node = c_node.parent
 *     c_element = c_node
*/
  while (1) {
    __pyx_t_2 = (__pyx_v_c_node != NULL);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L11_bool_binop_done;
    }
    __pyx_t_2 = (__pyx_v_c_node->type != XML_ELEMENT_NODE);
    __pyx_t_1 = __pyx_t_2;
    __pyx_L11_bool_binop_done:;
    if (!__pyx_t_1) break;

    /* "src/lxml/apihelpers.pxi":480
 *         is_attribute = 1
 *     while c_node is not NULL and c_node.type != tree.XML_ELEMENT_NODE:
 *         c_node = c_node.parent             # <<<<<<<<<<<<<<
 *     c_element = c_node
 *     while c_node is not NULL:
*/
    __pyx_t_3 = __pyx_v_c_node->parent;
    __pyx_v_c_node = __pyx_t_3;
  }

  /* "src/lxml/apihelpers.pxi":481
 *     while c_node is not NULL and c_node.type != tree.XML_ELEMENT_NODE:
 *         c_node = c_node.parent
 *     c_element = c_node             # <<<<<<<<<<<<<<
 *     while c_node is not NULL:
 *         if c_node.type == tree.XML_ELEMENT_NODE:
*/
  __pyx_v_c_element = __pyx_v_c_node;

  /* "src/lxml/apihelpers.pxi":482
 *         c_node = c_node.parent
 *     c_element = c_node
 *     while c_node is not NULL:             # <<<<<<<<<<<<<<
 *         if c_node.type == tree.XML_ELEMENT_NODE:
 *             c_ns = c_node.nsDef
*/
  while (1) {
    __pyx_t_1 = (__pyx_v_c_node != NULL);
    if (!__pyx_t_1) break;

    /* "src/lxml/apihelpers.pxi":483
 *     c_element = c_node
 *     while c_node is not NULL:
 *         if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *             c_ns = c_node.nsDef
 *             while c_ns is not NULL:
*/
    __pyx_t_1 = (__pyx_v_c_node->type == XML_ELEMENT_NODE);
    if (__pyx_t_1) {

      /* "src/lxml/apihelpers.pxi":484
 *     while c_node is not NULL:
 *         if c_node.type == tree.XML_ELEMENT_NODE:
 *             c_ns = c_node.nsDef             # <<<<<<<<<<<<<<
 *             while c_ns is not NULL:
 *                 if c_ns.href is not NULL and tree.xmlStrcmp(c_href, c_ns.href) == 0:
*/
      __pyx_t_4 = __pyx_v_c_node->nsDef;
      __pyx_v_c_ns = __pyx_t_4;

      /* "src/lxml/apihelpers.pxi":485
 *         if c_node.type == tree.XML_ELEMENT_NODE:
 *             c_ns = c_node.nsDef
 *             while c_ns is not NULL:             # <<<<<<<<<<<<<<
 *                 if c_ns.href is not NULL and tree.xmlStrcmp(c_href, c_ns.href) == 0:
 *                     if c_ns.prefix is NULL and is_attribute:
*/
      while (1) {
        __pyx_t_1 = (__pyx_v_c_ns != NULL);
        if (!__pyx_t_1) break;

        /* "src/lxml/apihelpers.pxi":486
 *             c_ns = c_node.nsDef
 *             while c_ns is not NULL:
 *                 if c_ns.href is not NULL and tree.xmlStrcmp(c_href, c_ns.href) == 0:             # <<<<<<<<<<<<<<
 *                     if c_ns.prefix is NULL and is_attribute:
 *                         # for attributes, continue searching a named
*/
        __pyx_t_2 = (__pyx_v_c_ns->href != NULL);
        if (__pyx_t_2) {
        } else {
          __pyx_t_1 = __pyx_t_2;
          goto __pyx_L19_bool_binop_done;
        }
        __pyx_t_2 = (xmlStrcmp(__pyx_v_c_href, __pyx_v_c_ns->href) == 0);
        __pyx_t_1 = __pyx_t_2;
        __pyx_L19_bool_binop_done:;
        if (__pyx_t_1) {

          /* "src/lxml/apihelpers.pxi":487
 *             while c_ns is not NULL:
 *                 if c_ns.href is not NULL and tree.xmlStrcmp(c_href, c_ns.href) == 0:
 *                     if c_ns.prefix is NULL and is_attribute:             # <<<<<<<<<<<<<<
 *                         # for attributes, continue searching a named
 *                         # prefix, but keep the first default namespace
*/
          __pyx_t_2 = (__pyx_v_c_ns->prefix == NULL);
          if (__pyx_t_2) {
          } else {
            __pyx_t_1 = __pyx_t_2;
            goto __pyx_L22_bool_binop_done;
          }
          __pyx_t_1 = __pyx_v_is_attribute;
          __pyx_L22_bool_binop_done:;
          if (__pyx_t_1) {

            /* "src/lxml/apihelpers.pxi":491
 *                         # prefix, but keep the first default namespace
 *                         # declaration that we found
 *                         if c_default_ns is NULL:             # <<<<<<<<<<<<<<
 *                             c_default_ns = c_ns
 *                     elif tree.xmlSearchNs(
*/
            __pyx_t_1 = (__pyx_v_c_default_ns == NULL);
            if (__pyx_t_1) {

              /* "src/lxml/apihelpers.pxi":492
 *                         # declaration that we found
 *                         if c_default_ns is NULL:
 *                             c_default_ns = c_ns             # <<<<<<<<<<<<<<
 *                     elif tree.xmlSearchNs(
 *                         c_element.doc, c_element, c_ns.prefix) is c_ns:
*/
              __pyx_v_c_default_ns = __pyx_v_c_ns;

              /* "src/lxml/apihelpers.pxi":491
 *                         # prefix, but keep the first default namespace
 *                         # declaration that we found
 *                         if c_default_ns is NULL:             # <<<<<<<<<<<<<<
 *                             c_default_ns = c_ns
 *                     elif tree.xmlSearchNs(
*/
            }

            /* "src/lxml/apihelpers.pxi":487
 *             while c_ns is not NULL:
 *                 if c_ns.href is not NULL and tree.xmlStrcmp(c_href, c_ns.href) == 0:
 *                     if c_ns.prefix is NULL and is_attribute:             # <<<<<<<<<<<<<<
 *                         # for attributes, continue searching a named
 *                         # prefix, but keep the first default namespace
*/
            goto __pyx_L21;
          }

          /* "src/lxml/apihelpers.pxi":494
 *                             c_default_ns = c_ns
 *                     elif tree.xmlSearchNs(
 *                         c_element.doc, c_element, c_ns.prefix) is c_ns:             # <<<<<<<<<<<<<<
 *                         # start node is in namespace scope => found!
 *                         return c_ns
*/
          __pyx_t_1 = (xmlSearchNs(__pyx_v_c_element->doc, __pyx_v_c_element, __pyx_v_c_ns->prefix) == __pyx_v_c_ns);

          /* "src/lxml/apihelpers.pxi":493
 *                         if c_default_ns is NULL:
 *                             c_default_ns = c_ns
 *                     elif tree.xmlSearchNs(             # <<<<<<<<<<<<<<
 *                         c_element.doc, c_element, c_ns.prefix) is c_ns:
 *                         # start node is in namespace scope => found!
*/
          if (__pyx_t_1) {

            /* "src/lxml/apihelpers.pxi":496
 *                         c_element.doc, c_element, c_ns.prefix) is c_ns:
 *                         # start node is in namespace scope => found!
 *                         return c_ns             # <<<<<<<<<<<<<<
 *                 c_ns = c_ns.next
 *             if c_node is not c_element and c_node.ns is not NULL:
*/
            __pyx_r = __pyx_v_c_ns;
            goto __pyx_L0;

            /* "src/lxml/apihelpers.pxi":493
 *                         if c_default_ns is NULL:
 *                             c_default_ns = c_ns
 *                     elif tree.xmlSearchNs(             # <<<<<<<<<<<<<<
 *                         c_element.doc, c_element, c_ns.prefix) is c_ns:
 *                         # start node is in namespace scope => found!
*/
          }
          __pyx_L21:;

          /* "src/lxml/apihelpers.pxi":486
 *             c_ns = c_node.nsDef
 *             while c_ns is not NULL:
 *                 if c_ns.href is not NULL and tree.xmlStrcmp(c_href, c_ns.href) == 0:             # <<<<<<<<<<<<<<
 *                     if c_ns.prefix is NULL and is_attribute:
 *                         # for attributes, continue searching a named
*/
        }

        /* "src/lxml/apihelpers.pxi":497
 *                         # start node is in namespace scope => found!
 *                         return c_ns
 *                 c_ns = c_ns.next             # <<<<<<<<<<<<<<
 *             if c_node is not c_element and c_node.ns is not NULL:
 *                 # optimise: the node may have the namespace itself
*/
        __pyx_t_4 = __pyx_v_c_ns->next;
        __pyx_v_c_ns = __pyx_t_4;
      }

      /* "src/lxml/apihelpers.pxi":498
 *                         return c_ns
 *                 c_ns = c_ns.next
 *             if c_node is not c_element and c_node.ns is not NULL:             # <<<<<<<<<<<<<<
 *                 # optimise: the node may have the namespace itself
 *                 c_ns = c_node.ns
*/
      __pyx_t_2 = (__pyx_v_c_node != __pyx_v_c_element);
      if (__pyx_t_2) {
      } else {
        __pyx_t_1 = __pyx_t_2;
        goto __pyx_L26_bool_binop_done;
      }
      __pyx_t_2 = (__pyx_v_c_node->ns != NULL);
      __pyx_t_1 = __pyx_t_2;
      __pyx_L26_bool_binop_done:;
      if (__pyx_t_1) {

        /* "src/lxml/apihelpers.pxi":500
 *             if c_node is not c_element and c_node.ns is not NULL:
 *                 # optimise: the node may have the namespace itself
 *                 c_ns = c_node.ns             # <<<<<<<<<<<<<<
 *                 if c_ns.href is not NULL and tree.xmlStrcmp(c_href, c_ns.href) == 0:
 *                     if c_ns.prefix is NULL and is_attribute:
*/
        __pyx_t_4 = __pyx_v_c_node->ns;
        __pyx_v_c_ns = __pyx_t_4;

        /* "src/lxml/apihelpers.pxi":501
 *                 # optimise: the node may have the namespace itself
 *                 c_ns = c_node.ns
 *                 if c_ns.href is not NULL and tree.xmlStrcmp(c_href, c_ns.href) == 0:             # <<<<<<<<<<<<<<
 *                     if c_ns.prefix is NULL and is_attribute:
 *                         # for attributes, continue searching a named
*/
        __pyx_t_2 = (__pyx_v_c_ns->href != NULL);
        if (__pyx_t_2) {
        } else {
          __pyx_t_1 = __pyx_t_2;
          goto __pyx_L29_bool_binop_done;
        }
        __pyx_t_2 = (xmlStrcmp(__pyx_v_c_href, __pyx_v_c_ns->href) == 0);
        __pyx_t_1 = __pyx_t_2;
        __pyx_L29_bool_binop_done:;
        if (__pyx_t_1) {

          /* "src/lxml/apihelpers.pxi":502
 *                 c_ns = c_node.ns
 *                 if c_ns.href is not NULL and tree.xmlStrcmp(c_href, c_ns.href) == 0:
 *                     if c_ns.prefix is NULL and is_attribute:             # <<<<<<<<<<<<<<
 *                         # for attributes, continue searching a named
 *                         # prefix, but keep the first default namespace
*/
          __pyx_t_2 = (__pyx_v_c_ns->prefix == NULL);
          if (__pyx_t_2) {
          } else {
            __pyx_t_1 = __pyx_t_2;
            goto __pyx_L32_bool_binop_done;
          }
          __pyx_t_1 = __pyx_v_is_attribute;
          __pyx_L32_bool_binop_done:;
          if (__pyx_t_1) {

            /* "src/lxml/apihelpers.pxi":506
 *                         # prefix, but keep the first default namespace
 *                         # declaration that we found
 *                         if c_default_ns is NULL:             # <<<<<<<<<<<<<<
 *                             c_default_ns = c_ns
 *                     elif tree.xmlSearchNs(
*/
            __pyx_t_1 = (__pyx_v_c_default_ns == NULL);
            if (__pyx_t_1) {

              /* "src/lxml/apihelpers.pxi":507
 *                         # declaration that we found
 *                         if c_default_ns is NULL:
 *                             c_default_ns = c_ns             # <<<<<<<<<<<<<<
 *                     elif tree.xmlSearchNs(
 *                         c_element.doc, c_element, c_ns.prefix) is c_ns:
*/
              __pyx_v_c_default_ns = __pyx_v_c_ns;

              /* "src/lxml/apihelpers.pxi":506
 *                         # prefix, but keep the first default namespace
 *                         # declaration that we found
 *                         if c_default_ns is NULL:             # <<<<<<<<<<<<<<
 *                             c_default_ns = c_ns
 *                     elif tree.xmlSearchNs(
*/
            }

            /* "src/lxml/apihelpers.pxi":502
 *                 c_ns = c_node.ns
 *                 if c_ns.href is not NULL and tree.xmlStrcmp(c_href, c_ns.href) == 0:
 *                     if c_ns.prefix is NULL and is_attribute:             # <<<<<<<<<<<<<<
 *                         # for attributes, continue searching a named
 *                         # prefix, but keep the first default namespace
*/
            goto __pyx_L31;
          }

          /* "src/lxml/apihelpers.pxi":509
 *                             c_default_ns = c_ns
 *                     elif tree.xmlSearchNs(
 *                         c_element.doc, c_element, c_ns.prefix) is c_ns:             # <<<<<<<<<<<<<<
 *                         # start node is in namespace scope => found!
 *                         return c_ns
*/
          __pyx_t_1 = (xmlSearchNs(__pyx_v_c_element->doc, __pyx_v_c_element, __pyx_v_c_ns->prefix) == __pyx_v_c_ns);

          /* "src/lxml/apihelpers.pxi":508
 *                         if c_default_ns is NULL:
 *                             c_default_ns = c_ns
 *                     elif tree.xmlSearchNs(             # <<<<<<<<<<<<<<
 *                         c_element.doc, c_element, c_ns.prefix) is c_ns:
 *                         # start node is in namespace scope => found!
*/
          if (__pyx_t_1) {

            /* "src/lxml/apihelpers.pxi":511
 *                         c_element.doc, c_element, c_ns.prefix) is c_ns:
 *                         # start node is in namespace scope => found!
 *                         return c_ns             # <<<<<<<<<<<<<<
 *         c_node = c_node.parent
 *     # nothing found => use a matching default namespace or fail
*/
            __pyx_r = __pyx_v_c_ns;
            goto __pyx_L0;

            /* "src/lxml/apihelpers.pxi":508
 *                         if c_default_ns is NULL:
 *                             c_default_ns = c_ns
 *                     elif tree.xmlSearchNs(             # <<<<<<<<<<<<<<
 *                         c_element.doc, c_element, c_ns.prefix) is c_ns:
 *                         # start node is in namespace scope => found!
*/
          }
          __pyx_L31:;

          /* "src/lxml/apihelpers.pxi":501
 *                 # optimise: the node may have the namespace itself
 *                 c_ns = c_node.ns
 *                 if c_ns.href is not NULL and tree.xmlStrcmp(c_href, c_ns.href) == 0:             # <<<<<<<<<<<<<<
 *                     if c_ns.prefix is NULL and is_attribute:
 *                         # for attributes, continue searching a named
*/
        }

        /* "src/lxml/apihelpers.pxi":498
 *                         return c_ns
 *                 c_ns = c_ns.next
 *             if c_node is not c_element and c_node.ns is not NULL:             # <<<<<<<<<<<<<<
 *                 # optimise: the node may have the namespace itself
 *                 c_ns = c_node.ns
*/
      }

      /* "src/lxml/apihelpers.pxi":483
 *     c_element = c_node
 *     while c_node is not NULL:
 *         if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *             c_ns = c_node.nsDef
 *             while c_ns is not NULL:
*/
    }

    /* "src/lxml/apihelpers.pxi":512
 *                         # start node is in namespace scope => found!
 *                         return c_ns
 *         c_node = c_node.parent             # <<<<<<<<<<<<<<
 *     # nothing found => use a matching default namespace or fail
 *     if c_default_ns is not NULL:
*/
    __pyx_t_3 = __pyx_v_c_node->parent;
    __pyx_v_c_node = __pyx_t_3;
  }

  /* "src/lxml/apihelpers.pxi":514
 *         c_node = c_node.parent
 *     # nothing found => use a matching default namespace or fail
 *     if c_default_ns is not NULL:             # <<<<<<<<<<<<<<
 *         if tree.xmlSearchNs(c_element.doc, c_element, NULL) is c_default_ns:
 *             return c_default_ns
*/
  __pyx_t_1 = (__pyx_v_c_default_ns != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":515
 *     # nothing found => use a matching default namespace or fail
 *     if c_default_ns is not NULL:
 *         if tree.xmlSearchNs(c_element.doc, c_element, NULL) is c_default_ns:             # <<<<<<<<<<<<<<
 *             return c_default_ns
 *     return NULL
*/
    __pyx_t_1 = (xmlSearchNs(__pyx_v_c_element->doc, __pyx_v_c_element, NULL) == __pyx_v_c_default_ns);
    if (__pyx_t_1) {

      /* "src/lxml/apihelpers.pxi":516
 *     if c_default_ns is not NULL:
 *         if tree.xmlSearchNs(c_element.doc, c_element, NULL) is c_default_ns:
 *             return c_default_ns             # <<<<<<<<<<<<<<
 *     return NULL
 * 
*/
      __pyx_r = __pyx_v_c_default_ns;
      goto __pyx_L0;

      /* "src/lxml/apihelpers.pxi":515
 *     # nothing found => use a matching default namespace or fail
 *     if c_default_ns is not NULL:
 *         if tree.xmlSearchNs(c_element.doc, c_element, NULL) is c_default_ns:             # <<<<<<<<<<<<<<
 *             return c_default_ns
 *     return NULL
*/
    }

    /* "src/lxml/apihelpers.pxi":514
 *         c_node = c_node.parent
 *     # nothing found => use a matching default namespace or fail
 *     if c_default_ns is not NULL:             # <<<<<<<<<<<<<<
 *         if tree.xmlSearchNs(c_element.doc, c_element, NULL) is c_default_ns:
 *             return c_default_ns
*/
  }

  /* "src/lxml/apihelpers.pxi":517
 *         if tree.xmlSearchNs(c_element.doc, c_element, NULL) is c_default_ns:
 *             return c_default_ns
 *     return NULL             # <<<<<<<<<<<<<<
 * 
 * cdef int _replaceNodeByChildren(_Document doc, xmlNode* c_node) except -1:
*/
  __pyx_r = NULL;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":461
 *     return 0
 * 
 * cdef xmlNs* _searchNsByHref(xmlNode* c_node, const_xmlChar* c_href, bint is_attribute) noexcept:             # <<<<<<<<<<<<<<
 *     """Search a namespace declaration that covers a node (element or
 *     attribute).
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":519
 *     return NULL
 * 
 * cdef int _replaceNodeByChildren(_Document doc, xmlNode* c_node) except -1:             # <<<<<<<<<<<<<<
 *     # NOTE: this does not deallocate the node, just unlink it!
 *     cdef xmlNode* c_parent
*/

static int __pyx_f_4lxml_5etree__replaceNodeByChildren(struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_node) {
  xmlNode *__pyx_v_c_parent;
  xmlNode *__pyx_v_c_child;
  int __pyx_r;
  int __pyx_t_1;
  xmlNode *__pyx_t_2;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/apihelpers.pxi":523
 *     cdef xmlNode* c_parent
 *     cdef xmlNode* c_child
 *     if c_node.children is NULL:             # <<<<<<<<<<<<<<
 *         tree.xmlUnlinkNode(c_node)
 *         return 0
*/
  __pyx_t_1 = (__pyx_v_c_node->children == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":524
 *     cdef xmlNode* c_child
 *     if c_node.children is NULL:
 *         tree.xmlUnlinkNode(c_node)             # <<<<<<<<<<<<<<
 *         return 0
 * 
*/
    xmlUnlinkNode(__pyx_v_c_node);

    /* "src/lxml/apihelpers.pxi":525
 *     if c_node.children is NULL:
 *         tree.xmlUnlinkNode(c_node)
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     c_parent = c_node.parent
*/
    __pyx_r = 0;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":523
 *     cdef xmlNode* c_parent
 *     cdef xmlNode* c_child
 *     if c_node.children is NULL:             # <<<<<<<<<<<<<<
 *         tree.xmlUnlinkNode(c_node)
 *         return 0
*/
  }

  /* "src/lxml/apihelpers.pxi":527
 *         return 0
 * 
 *     c_parent = c_node.parent             # <<<<<<<<<<<<<<
 *     # fix parent links of children
 *     c_child = c_node.children
*/
  __pyx_t_2 = __pyx_v_c_node->parent;
  __pyx_v_c_parent = __pyx_t_2;

  /* "src/lxml/apihelpers.pxi":529
 *     c_parent = c_node.parent
 *     # fix parent links of children
 *     c_child = c_node.children             # <<<<<<<<<<<<<<
 *     while c_child is not NULL:
 *         c_child.parent = c_parent
*/
  __pyx_t_2 = __pyx_v_c_node->children;
  __pyx_v_c_child = __pyx_t_2;

  /* "src/lxml/apihelpers.pxi":530
 *     # fix parent links of children
 *     c_child = c_node.children
 *     while c_child is not NULL:             # <<<<<<<<<<<<<<
 *         c_child.parent = c_parent
 *         c_child = c_child.next
*/
  while (1) {
    __pyx_t_1 = (__pyx_v_c_child != NULL);
    if (!__pyx_t_1) break;

    /* "src/lxml/apihelpers.pxi":531
 *     c_child = c_node.children
 *     while c_child is not NULL:
 *         c_child.parent = c_parent             # <<<<<<<<<<<<<<
 *         c_child = c_child.next
 * 
*/
    __pyx_v_c_child->parent = __pyx_v_c_parent;

    /* "src/lxml/apihelpers.pxi":532
 *     while c_child is not NULL:
 *         c_child.parent = c_parent
 *         c_child = c_child.next             # <<<<<<<<<<<<<<
 * 
 *     # fix namespace references of children if their parent's namespace
*/
    __pyx_t_2 = __pyx_v_c_child->next;
    __pyx_v_c_child = __pyx_t_2;
  }

  /* "src/lxml/apihelpers.pxi":536
 *     # fix namespace references of children if their parent's namespace
 *     # declarations get lost
 *     if c_node.nsDef is not NULL:             # <<<<<<<<<<<<<<
 *         c_child = c_node.children
 *         while c_child is not NULL:
*/
  __pyx_t_1 = (__pyx_v_c_node->nsDef != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":537
 *     # declarations get lost
 *     if c_node.nsDef is not NULL:
 *         c_child = c_node.children             # <<<<<<<<<<<<<<
 *         while c_child is not NULL:
 *             moveNodeToDocument(doc, doc._c_doc, c_child)
*/
    __pyx_t_2 = __pyx_v_c_node->children;
    __pyx_v_c_child = __pyx_t_2;

    /* "src/lxml/apihelpers.pxi":538
 *     if c_node.nsDef is not NULL:
 *         c_child = c_node.children
 *         while c_child is not NULL:             # <<<<<<<<<<<<<<
 *             moveNodeToDocument(doc, doc._c_doc, c_child)
 *             c_child = c_child.next
*/
    while (1) {
      __pyx_t_1 = (__pyx_v_c_child != NULL);
      if (!__pyx_t_1) break;

      /* "src/lxml/apihelpers.pxi":539
 *         c_child = c_node.children
 *         while c_child is not NULL:
 *             moveNodeToDocument(doc, doc._c_doc, c_child)             # <<<<<<<<<<<<<<
 *             c_child = c_child.next
 * 
*/
      __pyx_t_3 = __pyx_f_4lxml_5etree_moveNodeToDocument(__pyx_v_doc, __pyx_v_doc->_c_doc, __pyx_v_c_child); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(4, 539, __pyx_L1_error)

      /* "src/lxml/apihelpers.pxi":540
 *         while c_child is not NULL:
 *             moveNodeToDocument(doc, doc._c_doc, c_child)
 *             c_child = c_child.next             # <<<<<<<<<<<<<<
 * 
 *     # fix sibling links to/from child slice
*/
      __pyx_t_2 = __pyx_v_c_child->next;
      __pyx_v_c_child = __pyx_t_2;
    }

    /* "src/lxml/apihelpers.pxi":536
 *     # fix namespace references of children if their parent's namespace
 *     # declarations get lost
 *     if c_node.nsDef is not NULL:             # <<<<<<<<<<<<<<
 *         c_child = c_node.children
 *         while c_child is not NULL:
*/
  }

  /* "src/lxml/apihelpers.pxi":543
 * 
 *     # fix sibling links to/from child slice
 *     if c_node.prev is NULL:             # <<<<<<<<<<<<<<
 *         c_parent.children = c_node.children
 *     else:
*/
  __pyx_t_1 = (__pyx_v_c_node->prev == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":544
 *     # fix sibling links to/from child slice
 *     if c_node.prev is NULL:
 *         c_parent.children = c_node.children             # <<<<<<<<<<<<<<
 *     else:
 *         c_node.prev.next = c_node.children
*/
    __pyx_t_2 = __pyx_v_c_node->children;
    __pyx_v_c_parent->children = __pyx_t_2;

    /* "src/lxml/apihelpers.pxi":543
 * 
 *     # fix sibling links to/from child slice
 *     if c_node.prev is NULL:             # <<<<<<<<<<<<<<
 *         c_parent.children = c_node.children
 *     else:
*/
    goto __pyx_L9;
  }

  /* "src/lxml/apihelpers.pxi":546
 *         c_parent.children = c_node.children
 *     else:
 *         c_node.prev.next = c_node.children             # <<<<<<<<<<<<<<
 *         c_node.children.prev = c_node.prev
 *     if c_node.next is NULL:
*/
  /*else*/ {
    __pyx_t_2 = __pyx_v_c_node->children;
    __pyx_v_c_node->prev->next = __pyx_t_2;

    /* "src/lxml/apihelpers.pxi":547
 *     else:
 *         c_node.prev.next = c_node.children
 *         c_node.children.prev = c_node.prev             # <<<<<<<<<<<<<<
 *     if c_node.next is NULL:
 *         c_parent.last = c_node.last
*/
    __pyx_t_2 = __pyx_v_c_node->prev;
    __pyx_v_c_node->children->prev = __pyx_t_2;
  }
  __pyx_L9:;

  /* "src/lxml/apihelpers.pxi":548
 *         c_node.prev.next = c_node.children
 *         c_node.children.prev = c_node.prev
 *     if c_node.next is NULL:             # <<<<<<<<<<<<<<
 *         c_parent.last = c_node.last
 *     else:
*/
  __pyx_t_1 = (__pyx_v_c_node->next == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":549
 *         c_node.children.prev = c_node.prev
 *     if c_node.next is NULL:
 *         c_parent.last = c_node.last             # <<<<<<<<<<<<<<
 *     else:
 *         c_node.next.prev = c_node.last
*/
    __pyx_t_2 = __pyx_v_c_node->last;
    __pyx_v_c_parent->last = __pyx_t_2;

    /* "src/lxml/apihelpers.pxi":548
 *         c_node.prev.next = c_node.children
 *         c_node.children.prev = c_node.prev
 *     if c_node.next is NULL:             # <<<<<<<<<<<<<<
 *         c_parent.last = c_node.last
 *     else:
*/
    goto __pyx_L10;
  }

  /* "src/lxml/apihelpers.pxi":551
 *         c_parent.last = c_node.last
 *     else:
 *         c_node.next.prev = c_node.last             # <<<<<<<<<<<<<<
 *         c_node.last.next = c_node.next
 * 
*/
  /*else*/ {
    __pyx_t_2 = __pyx_v_c_node->last;
    __pyx_v_c_node->next->prev = __pyx_t_2;

    /* "src/lxml/apihelpers.pxi":552
 *     else:
 *         c_node.next.prev = c_node.last
 *         c_node.last.next = c_node.next             # <<<<<<<<<<<<<<
 * 
 *     # unlink c_node
*/
    __pyx_t_2 = __pyx_v_c_node->next;
    __pyx_v_c_node->last->next = __pyx_t_2;
  }
  __pyx_L10:;

  /* "src/lxml/apihelpers.pxi":555
 * 
 *     # unlink c_node
 *     c_node.children = c_node.last = NULL             # <<<<<<<<<<<<<<
 *     c_node.parent = c_node.next = c_node.prev = NULL
 *     return 0
*/
  __pyx_v_c_node->children = NULL;
  __pyx_v_c_node->last = NULL;

  /* "src/lxml/apihelpers.pxi":556
 *     # unlink c_node
 *     c_node.children = c_node.last = NULL
 *     c_node.parent = c_node.next = c_node.prev = NULL             # <<<<<<<<<<<<<<
 *     return 0
 * 
*/
  __pyx_v_c_node->parent = NULL;
  __pyx_v_c_node->next = NULL;
  __pyx_v_c_node->prev = NULL;

  /* "src/lxml/apihelpers.pxi":557
 *     c_node.children = c_node.last = NULL
 *     c_node.parent = c_node.next = c_node.prev = NULL
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef unicode _attributeValue(xmlNode* c_element, xmlAttr* c_attrib_node):
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":519
 *     return NULL
 * 
 * cdef int _replaceNodeByChildren(_Document doc, xmlNode* c_node) except -1:             # <<<<<<<<<<<<<<
 *     # NOTE: this does not deallocate the node, just unlink it!
 *     cdef xmlNode* c_parent
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._replaceNodeByChildren", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":559
 *     return 0
 * 
 * cdef unicode _attributeValue(xmlNode* c_element, xmlAttr* c_attrib_node):             # <<<<<<<<<<<<<<
 *     c_href = _getNs(<xmlNode*>c_attrib_node)
 *     value = tree.xmlGetNsProp(c_element, c_attrib_node.name, c_href)
*/

static PyObject *__pyx_f_4lxml_5etree__attributeValue(xmlNode *__pyx_v_c_element, xmlAttr *__pyx_v_c_attrib_node) {
  const xmlChar *__pyx_v_c_href;
  xmlChar *__pyx_v_value;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  char const *__pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_attributeValue", 0);

  /* "src/lxml/apihelpers.pxi":560
 * 
 * cdef unicode _attributeValue(xmlNode* c_element, xmlAttr* c_attrib_node):
 *     c_href = _getNs(<xmlNode*>c_attrib_node)             # <<<<<<<<<<<<<<
 *     value = tree.xmlGetNsProp(c_element, c_attrib_node.name, c_href)
 *     try:
*/
  __pyx_v_c_href = _getNs(((xmlNode *)__pyx_v_c_attrib_node));

  /* "src/lxml/apihelpers.pxi":561
 * cdef unicode _attributeValue(xmlNode* c_element, xmlAttr* c_attrib_node):
 *     c_href = _getNs(<xmlNode*>c_attrib_node)
 *     value = tree.xmlGetNsProp(c_element, c_attrib_node.name, c_href)             # <<<<<<<<<<<<<<
 *     try:
 *         result = funicode(value)
*/
  __pyx_v_value = xmlGetNsProp(__pyx_v_c_element, __pyx_v_c_attrib_node->name, __pyx_v_c_href);

  /* "src/lxml/apihelpers.pxi":562
 *     c_href = _getNs(<xmlNode*>c_attrib_node)
 *     value = tree.xmlGetNsProp(c_element, c_attrib_node.name, c_href)
 *     try:             # <<<<<<<<<<<<<<
 *         result = funicode(value)
 *     finally:
*/
  /*try:*/ {

    /* "src/lxml/apihelpers.pxi":563
 *     value = tree.xmlGetNsProp(c_element, c_attrib_node.name, c_href)
 *     try:
 *         result = funicode(value)             # <<<<<<<<<<<<<<
 *     finally:
 *         tree.xmlFree(value)
*/
    __pyx_t_1 = __pyx_f_4lxml_5etree_funicode(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 563, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_result = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;
  }

  /* "src/lxml/apihelpers.pxi":565
 *         result = funicode(value)
 *     finally:
 *         tree.xmlFree(value)             # <<<<<<<<<<<<<<
 *     return result
 * 
*/
  /*finally:*/ {
    /*normal exit:*/{
      xmlFree(__pyx_v_value);
      goto __pyx_L5;
    }
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_5 = 0; __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      if ( unlikely(__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0)) __Pyx_ErrFetch(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __pyx_t_2 = __pyx_lineno; __pyx_t_3 = __pyx_clineno; __pyx_t_4 = __pyx_filename;
      {
        xmlFree(__pyx_v_value);
      }
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_ErrRestore(__pyx_t_5, __pyx_t_6, __pyx_t_7);
      __pyx_t_5 = 0; __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0;
      __pyx_lineno = __pyx_t_2; __pyx_clineno = __pyx_t_3; __pyx_filename = __pyx_t_4;
      goto __pyx_L1_error;
    }
    __pyx_L5:;
  }

  /* "src/lxml/apihelpers.pxi":566
 *     finally:
 *         tree.xmlFree(value)
 *     return result             # <<<<<<<<<<<<<<
 * 
 * cdef unicode _attributeValueFromNsName(xmlNode* c_element,
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":559
 *     return 0
 * 
 * cdef unicode _attributeValue(xmlNode* c_element, xmlAttr* c_attrib_node):             # <<<<<<<<<<<<<<
 *     c_href = _getNs(<xmlNode*>c_attrib_node)
 *     value = tree.xmlGetNsProp(c_element, c_attrib_node.name, c_href)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._attributeValue", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":568
 *     return result
 * 
 * cdef unicode _attributeValueFromNsName(xmlNode* c_element,             # <<<<<<<<<<<<<<
 *                                        const_xmlChar* c_href, const_xmlChar* c_name):
 *     c_result = tree.xmlGetNsProp(c_element, c_name, c_href)
*/

static PyObject *__pyx_f_4lxml_5etree__attributeValueFromNsName(xmlNode *__pyx_v_c_element, const xmlChar *__pyx_v_c_href, const xmlChar *__pyx_v_c_name) {
  xmlChar *__pyx_v_c_result;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  char const *__pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_attributeValueFromNsName", 0);

  /* "src/lxml/apihelpers.pxi":570
 * cdef unicode _attributeValueFromNsName(xmlNode* c_element,
 *                                        const_xmlChar* c_href, const_xmlChar* c_name):
 *     c_result = tree.xmlGetNsProp(c_element, c_name, c_href)             # <<<<<<<<<<<<<<
 *     if c_result is NULL:
 *         return None
*/
  __pyx_v_c_result = xmlGetNsProp(__pyx_v_c_element, __pyx_v_c_name, __pyx_v_c_href);

  /* "src/lxml/apihelpers.pxi":571
 *                                        const_xmlChar* c_href, const_xmlChar* c_name):
 *     c_result = tree.xmlGetNsProp(c_element, c_name, c_href)
 *     if c_result is NULL:             # <<<<<<<<<<<<<<
 *         return None
 *     try:
*/
  __pyx_t_1 = (__pyx_v_c_result == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":572
 *     c_result = tree.xmlGetNsProp(c_element, c_name, c_href)
 *     if c_result is NULL:
 *         return None             # <<<<<<<<<<<<<<
 *     try:
 *         result = funicode(c_result)
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":571
 *                                        const_xmlChar* c_href, const_xmlChar* c_name):
 *     c_result = tree.xmlGetNsProp(c_element, c_name, c_href)
 *     if c_result is NULL:             # <<<<<<<<<<<<<<
 *         return None
 *     try:
*/
  }

  /* "src/lxml/apihelpers.pxi":573
 *     if c_result is NULL:
 *         return None
 *     try:             # <<<<<<<<<<<<<<
 *         result = funicode(c_result)
 *     finally:
*/
  /*try:*/ {

    /* "src/lxml/apihelpers.pxi":574
 *         return None
 *     try:
 *         result = funicode(c_result)             # <<<<<<<<<<<<<<
 *     finally:
 *         tree.xmlFree(c_result)
*/
    __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_result); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 574, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_result = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;
  }

  /* "src/lxml/apihelpers.pxi":576
 *         result = funicode(c_result)
 *     finally:
 *         tree.xmlFree(c_result)             # <<<<<<<<<<<<<<
 *     return result
 * 
*/
  /*finally:*/ {
    /*normal exit:*/{
      xmlFree(__pyx_v_c_result);
      goto __pyx_L6;
    }
    __pyx_L5_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      if ( unlikely(__Pyx_GetException(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8) < 0)) __Pyx_ErrFetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __pyx_t_3 = __pyx_lineno; __pyx_t_4 = __pyx_clineno; __pyx_t_5 = __pyx_filename;
      {
        xmlFree(__pyx_v_c_result);
      }
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_ErrRestore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
      __pyx_lineno = __pyx_t_3; __pyx_clineno = __pyx_t_4; __pyx_filename = __pyx_t_5;
      goto __pyx_L1_error;
    }
    __pyx_L6:;
  }

  /* "src/lxml/apihelpers.pxi":577
 *     finally:
 *         tree.xmlFree(c_result)
 *     return result             # <<<<<<<<<<<<<<
 * 
 * cdef object _getNodeAttributeValue(xmlNode* c_node, key, default):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":568
 *     return result
 * 
 * cdef unicode _attributeValueFromNsName(xmlNode* c_element,             # <<<<<<<<<<<<<<
 *                                        const_xmlChar* c_href, const_xmlChar* c_name):
 *     c_result = tree.xmlGetNsProp(c_element, c_name, c_href)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._attributeValueFromNsName", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":579
 *     return result
 * 
 * cdef object _getNodeAttributeValue(xmlNode* c_node, key, default):             # <<<<<<<<<<<<<<
 *     ns, tag = _getNsTag(key)
 *     c_href = <const_xmlChar*>NULL if ns is None else _xcstr(ns)
*/

static PyObject *__pyx_f_4lxml_5etree__getNodeAttributeValue(xmlNode *__pyx_v_c_node, PyObject *__pyx_v_key, PyObject *__pyx_v_default) {
  PyObject *__pyx_v_ns = NULL;
  PyObject *__pyx_v_tag = NULL;
  const xmlChar *__pyx_v_c_href;
  xmlChar *__pyx_v_c_result;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  const xmlChar *__pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  char const *__pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_getNodeAttributeValue", 0);

  /* "src/lxml/apihelpers.pxi":580
 * 
 * cdef object _getNodeAttributeValue(xmlNode* c_node, key, default):
 *     ns, tag = _getNsTag(key)             # <<<<<<<<<<<<<<
 *     c_href = <const_xmlChar*>NULL if ns is None else _xcstr(ns)
 *     c_result = tree.xmlGetNsProp(c_node, _xcstr(tag), c_href)
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__getNsTag(__pyx_v_key); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 580, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(__pyx_t_1 != Py_None)) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(4, 580, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 580, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 580, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(4, 580, __pyx_L1_error)
  }
  __pyx_v_ns = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_tag = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "src/lxml/apihelpers.pxi":581
 * cdef object _getNodeAttributeValue(xmlNode* c_node, key, default):
 *     ns, tag = _getNsTag(key)
 *     c_href = <const_xmlChar*>NULL if ns is None else _xcstr(ns)             # <<<<<<<<<<<<<<
 *     c_result = tree.xmlGetNsProp(c_node, _xcstr(tag), c_href)
 *     if c_result is NULL:
*/
  __pyx_t_5 = (__pyx_v_ns == Py_None);
  if (__pyx_t_5) {
    __pyx_t_4 = ((const xmlChar *)NULL);
  } else {
    __pyx_t_4 = (const xmlChar*)PyBytes_AS_STRING(__pyx_v_ns);
  }
  __pyx_v_c_href = __pyx_t_4;

  /* "src/lxml/apihelpers.pxi":582
 *     ns, tag = _getNsTag(key)
 *     c_href = <const_xmlChar*>NULL if ns is None else _xcstr(ns)
 *     c_result = tree.xmlGetNsProp(c_node, _xcstr(tag), c_href)             # <<<<<<<<<<<<<<
 *     if c_result is NULL:
 *         # XXX free namespace that is not in use..?
*/
  __pyx_v_c_result = xmlGetNsProp(__pyx_v_c_node, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_tag), __pyx_v_c_href);

  /* "src/lxml/apihelpers.pxi":583
 *     c_href = <const_xmlChar*>NULL if ns is None else _xcstr(ns)
 *     c_result = tree.xmlGetNsProp(c_node, _xcstr(tag), c_href)
 *     if c_result is NULL:             # <<<<<<<<<<<<<<
 *         # XXX free namespace that is not in use..?
 *         return default
*/
  __pyx_t_5 = (__pyx_v_c_result == NULL);
  if (__pyx_t_5) {

    /* "src/lxml/apihelpers.pxi":585
 *     if c_result is NULL:
 *         # XXX free namespace that is not in use..?
 *         return default             # <<<<<<<<<<<<<<
 *     try:
 *         result = funicode(c_result)
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_default);
    __pyx_r = __pyx_v_default;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":583
 *     c_href = <const_xmlChar*>NULL if ns is None else _xcstr(ns)
 *     c_result = tree.xmlGetNsProp(c_node, _xcstr(tag), c_href)
 *     if c_result is NULL:             # <<<<<<<<<<<<<<
 *         # XXX free namespace that is not in use..?
 *         return default
*/
  }

  /* "src/lxml/apihelpers.pxi":586
 *         # XXX free namespace that is not in use..?
 *         return default
 *     try:             # <<<<<<<<<<<<<<
 *         result = funicode(c_result)
 *     finally:
*/
  /*try:*/ {

    /* "src/lxml/apihelpers.pxi":587
 *         return default
 *     try:
 *         result = funicode(c_result)             # <<<<<<<<<<<<<<
 *     finally:
 *         tree.xmlFree(c_result)
*/
    __pyx_t_1 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_result); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 587, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_result = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;
  }

  /* "src/lxml/apihelpers.pxi":589
 *         result = funicode(c_result)
 *     finally:
 *         tree.xmlFree(c_result)             # <<<<<<<<<<<<<<
 *     return result
 * 
*/
  /*finally:*/ {
    /*normal exit:*/{
      xmlFree(__pyx_v_c_result);
      goto __pyx_L6;
    }
    __pyx_L5_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
      if ( unlikely(__Pyx_GetException(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11) < 0)) __Pyx_ErrFetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_14);
      __pyx_t_6 = __pyx_lineno; __pyx_t_7 = __pyx_clineno; __pyx_t_8 = __pyx_filename;
      {
        xmlFree(__pyx_v_c_result);
      }
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_XGIVEREF(__pyx_t_14);
      __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_ErrRestore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
      __pyx_lineno = __pyx_t_6; __pyx_clineno = __pyx_t_7; __pyx_filename = __pyx_t_8;
      goto __pyx_L1_error;
    }
    __pyx_L6:;
  }

  /* "src/lxml/apihelpers.pxi":590
 *     finally:
 *         tree.xmlFree(c_result)
 *     return result             # <<<<<<<<<<<<<<
 * 
 * cdef inline object _getAttributeValue(_Element element, key, default):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":579
 *     return result
 * 
 * cdef object _getNodeAttributeValue(xmlNode* c_node, key, default):             # <<<<<<<<<<<<<<
 *     ns, tag = _getNsTag(key)
 *     c_href = <const_xmlChar*>NULL if ns is None else _xcstr(ns)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._getNodeAttributeValue", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ns);
  __Pyx_XDECREF(__pyx_v_tag);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":592
 *     return result
 * 
 * cdef inline object _getAttributeValue(_Element element, key, default):             # <<<<<<<<<<<<<<
 *     return _getNodeAttributeValue(element._c_node, key, default)
 * 
*/

static CYTHON_INLINE PyObject *__pyx_f_4lxml_5etree__getAttributeValue(struct LxmlElement *__pyx_v_element, PyObject *__pyx_v_key, PyObject *__pyx_v_default) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_getAttributeValue", 0);

  /* "src/lxml/apihelpers.pxi":593
 * 
 * cdef inline object _getAttributeValue(_Element element, key, default):
 *     return _getNodeAttributeValue(element._c_node, key, default)             # <<<<<<<<<<<<<<
 * 
 * cdef int _setAttributeValue(_Element element, key, value) except -1:
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree__getNodeAttributeValue(__pyx_v_element->_c_node, __pyx_v_key, __pyx_v_default); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 593, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":592
 *     return result
 * 
 * cdef inline object _getAttributeValue(_Element element, key, default):             # <<<<<<<<<<<<<<
 *     return _getNodeAttributeValue(element._c_node, key, default)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._getAttributeValue", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":595
 *     return _getNodeAttributeValue(element._c_node, key, default)
 * 
 * cdef int _setAttributeValue(_Element element, key, value) except -1:             # <<<<<<<<<<<<<<
 *     cdef const_xmlChar* c_value
 *     cdef xmlNs* c_ns
*/

static int __pyx_f_4lxml_5etree__setAttributeValue(struct LxmlElement *__pyx_v_element, PyObject *__pyx_v_key, PyObject *__pyx_v_value) {
  const xmlChar *__pyx_v_c_value;
  xmlNs *__pyx_v_c_ns;
  PyObject *__pyx_v_ns = NULL;
  PyObject *__pyx_v_tag = NULL;
  int __pyx_v_is_html;
  const xmlChar *__pyx_v_c_tag;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  xmlNs *__pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_setAttributeValue", 0);
  __Pyx_INCREF(__pyx_v_value);

  /* "src/lxml/apihelpers.pxi":598
 *     cdef const_xmlChar* c_value
 *     cdef xmlNs* c_ns
 *     ns, tag = _getNsTag(key)             # <<<<<<<<<<<<<<
 *     is_html = element._doc._parser._for_html
 *     if not is_html:
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__getNsTag(__pyx_v_key); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 598, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(__pyx_t_1 != Py_None)) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(4, 598, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 598, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 598, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(4, 598, __pyx_L1_error)
  }
  __pyx_v_ns = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_tag = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "src/lxml/apihelpers.pxi":599
 *     cdef xmlNs* c_ns
 *     ns, tag = _getNsTag(key)
 *     is_html = element._doc._parser._for_html             # <<<<<<<<<<<<<<
 *     if not is_html:
 *         _attributeValidOrRaise(tag)
*/
  __pyx_t_4 = __pyx_v_element->_doc->_parser->_for_html;
  __pyx_v_is_html = __pyx_t_4;

  /* "src/lxml/apihelpers.pxi":600
 *     ns, tag = _getNsTag(key)
 *     is_html = element._doc._parser._for_html
 *     if not is_html:             # <<<<<<<<<<<<<<
 *         _attributeValidOrRaise(tag)
 *     c_tag = _xcstr(tag)
*/
  __pyx_t_4 = (!__pyx_v_is_html);
  if (__pyx_t_4) {

    /* "src/lxml/apihelpers.pxi":601
 *     is_html = element._doc._parser._for_html
 *     if not is_html:
 *         _attributeValidOrRaise(tag)             # <<<<<<<<<<<<<<
 *     c_tag = _xcstr(tag)
 *     if value is None and is_html:
*/
    __pyx_t_5 = __pyx_f_4lxml_5etree__attributeValidOrRaise(__pyx_v_tag); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(4, 601, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":600
 *     ns, tag = _getNsTag(key)
 *     is_html = element._doc._parser._for_html
 *     if not is_html:             # <<<<<<<<<<<<<<
 *         _attributeValidOrRaise(tag)
 *     c_tag = _xcstr(tag)
*/
  }

  /* "src/lxml/apihelpers.pxi":602
 *     if not is_html:
 *         _attributeValidOrRaise(tag)
 *     c_tag = _xcstr(tag)             # <<<<<<<<<<<<<<
 *     if value is None and is_html:
 *         c_value = NULL
*/
  __pyx_v_c_tag = (const xmlChar*)PyBytes_AS_STRING(__pyx_v_tag);

  /* "src/lxml/apihelpers.pxi":603
 *         _attributeValidOrRaise(tag)
 *     c_tag = _xcstr(tag)
 *     if value is None and is_html:             # <<<<<<<<<<<<<<
 *         c_value = NULL
 *     else:
*/
  __pyx_t_6 = (__pyx_v_value == Py_None);
  if (__pyx_t_6) {
  } else {
    __pyx_t_4 = __pyx_t_6;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_4 = __pyx_v_is_html;
  __pyx_L5_bool_binop_done:;
  if (__pyx_t_4) {

    /* "src/lxml/apihelpers.pxi":604
 *     c_tag = _xcstr(tag)
 *     if value is None and is_html:
 *         c_value = NULL             # <<<<<<<<<<<<<<
 *     else:
 *         if isinstance(value, QName):
*/
    __pyx_v_c_value = NULL;

    /* "src/lxml/apihelpers.pxi":603
 *         _attributeValidOrRaise(tag)
 *     c_tag = _xcstr(tag)
 *     if value is None and is_html:             # <<<<<<<<<<<<<<
 *         c_value = NULL
 *     else:
*/
    goto __pyx_L4;
  }

  /* "src/lxml/apihelpers.pxi":606
 *         c_value = NULL
 *     else:
 *         if isinstance(value, QName):             # <<<<<<<<<<<<<<
 *             value = _resolveQNameText(element, value)
 *         else:
*/
  /*else*/ {
    __pyx_t_4 = __Pyx_TypeCheck(__pyx_v_value, __pyx_mstate_global->__pyx_ptype_4lxml_5etree_QName); 
    if (__pyx_t_4) {

      /* "src/lxml/apihelpers.pxi":607
 *     else:
 *         if isinstance(value, QName):
 *             value = _resolveQNameText(element, value)             # <<<<<<<<<<<<<<
 *         else:
 *             value = _utf8(value)
*/
      __pyx_t_1 = __pyx_f_4lxml_5etree__resolveQNameText(__pyx_v_element, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 607, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "src/lxml/apihelpers.pxi":606
 *         c_value = NULL
 *     else:
 *         if isinstance(value, QName):             # <<<<<<<<<<<<<<
 *             value = _resolveQNameText(element, value)
 *         else:
*/
      goto __pyx_L7;
    }

    /* "src/lxml/apihelpers.pxi":609
 *             value = _resolveQNameText(element, value)
 *         else:
 *             value = _utf8(value)             # <<<<<<<<<<<<<<
 *         c_value = _xcstr(value)
 *     if ns is None:
*/
    /*else*/ {
      __pyx_t_1 = __pyx_f_4lxml_5etree__utf8(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 609, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_1);
      __pyx_t_1 = 0;
    }
    __pyx_L7:;

    /* "src/lxml/apihelpers.pxi":610
 *         else:
 *             value = _utf8(value)
 *         c_value = _xcstr(value)             # <<<<<<<<<<<<<<
 *     if ns is None:
 *         c_ns = NULL
*/
    __pyx_v_c_value = (const xmlChar*)PyBytes_AS_STRING(__pyx_v_value);
  }
  __pyx_L4:;

  /* "src/lxml/apihelpers.pxi":611
 *             value = _utf8(value)
 *         c_value = _xcstr(value)
 *     if ns is None:             # <<<<<<<<<<<<<<
 *         c_ns = NULL
 *     else:
*/
  __pyx_t_4 = (__pyx_v_ns == Py_None);
  if (__pyx_t_4) {

    /* "src/lxml/apihelpers.pxi":612
 *         c_value = _xcstr(value)
 *     if ns is None:
 *         c_ns = NULL             # <<<<<<<<<<<<<<
 *     else:
 *         c_ns = element._doc._findOrBuildNodeNs(element._c_node, _xcstr(ns), NULL, 1)
*/
    __pyx_v_c_ns = NULL;

    /* "src/lxml/apihelpers.pxi":611
 *             value = _utf8(value)
 *         c_value = _xcstr(value)
 *     if ns is None:             # <<<<<<<<<<<<<<
 *         c_ns = NULL
 *     else:
*/
    goto __pyx_L8;
  }

  /* "src/lxml/apihelpers.pxi":614
 *         c_ns = NULL
 *     else:
 *         c_ns = element._doc._findOrBuildNodeNs(element._c_node, _xcstr(ns), NULL, 1)             # <<<<<<<<<<<<<<
 *     tree.xmlSetNsProp(element._c_node, c_ns, c_tag, c_value)
 *     return 0
*/
  /*else*/ {
    __pyx_t_7 = __pyx_f_4lxml_5etree_9_Document__findOrBuildNodeNs(__pyx_v_element->_doc, __pyx_v_element->_c_node, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_ns), NULL, 1); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(4, 614, __pyx_L1_error)
    __pyx_v_c_ns = __pyx_t_7;
  }
  __pyx_L8:;

  /* "src/lxml/apihelpers.pxi":615
 *     else:
 *         c_ns = element._doc._findOrBuildNodeNs(element._c_node, _xcstr(ns), NULL, 1)
 *     tree.xmlSetNsProp(element._c_node, c_ns, c_tag, c_value)             # <<<<<<<<<<<<<<
 *     return 0
 * 
*/
  (void)(xmlSetNsProp(__pyx_v_element->_c_node, __pyx_v_c_ns, __pyx_v_c_tag, __pyx_v_c_value));

  /* "src/lxml/apihelpers.pxi":616
 *         c_ns = element._doc._findOrBuildNodeNs(element._c_node, _xcstr(ns), NULL, 1)
 *     tree.xmlSetNsProp(element._c_node, c_ns, c_tag, c_value)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int _delAttribute(_Element element, key) except -1:
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":595
 *     return _getNodeAttributeValue(element._c_node, key, default)
 * 
 * cdef int _setAttributeValue(_Element element, key, value) except -1:             # <<<<<<<<<<<<<<
 *     cdef const_xmlChar* c_value
 *     cdef xmlNs* c_ns
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._setAttributeValue", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ns);
  __Pyx_XDECREF(__pyx_v_tag);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":618
 *     return 0
 * 
 * cdef int _delAttribute(_Element element, key) except -1:             # <<<<<<<<<<<<<<
 *     ns, tag = _getNsTag(key)
 *     c_href = <const_xmlChar*>NULL if ns is None else _xcstr(ns)
*/

static int __pyx_f_4lxml_5etree__delAttribute(struct LxmlElement *__pyx_v_element, PyObject *__pyx_v_key) {
  PyObject *__pyx_v_ns = NULL;
  PyObject *__pyx_v_tag = NULL;
  const xmlChar *__pyx_v_c_href;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  const xmlChar *__pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_delAttribute", 0);

  /* "src/lxml/apihelpers.pxi":619
 * 
 * cdef int _delAttribute(_Element element, key) except -1:
 *     ns, tag = _getNsTag(key)             # <<<<<<<<<<<<<<
 *     c_href = <const_xmlChar*>NULL if ns is None else _xcstr(ns)
 *     if _delAttributeFromNsName(element._c_node, c_href, _xcstr(tag)):
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__getNsTag(__pyx_v_key); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 619, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(__pyx_t_1 != Py_None)) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(4, 619, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 619, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 619, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(4, 619, __pyx_L1_error)
  }
  __pyx_v_ns = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_tag = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "src/lxml/apihelpers.pxi":620
 * cdef int _delAttribute(_Element element, key) except -1:
 *     ns, tag = _getNsTag(key)
 *     c_href = <const_xmlChar*>NULL if ns is None else _xcstr(ns)             # <<<<<<<<<<<<<<
 *     if _delAttributeFromNsName(element._c_node, c_href, _xcstr(tag)):
 *         raise KeyError, key
*/
  __pyx_t_5 = (__pyx_v_ns == Py_None);
  if (__pyx_t_5) {
    __pyx_t_4 = ((const xmlChar *)NULL);
  } else {
    __pyx_t_4 = (const xmlChar*)PyBytes_AS_STRING(__pyx_v_ns);
  }
  __pyx_v_c_href = __pyx_t_4;

  /* "src/lxml/apihelpers.pxi":621
 *     ns, tag = _getNsTag(key)
 *     c_href = <const_xmlChar*>NULL if ns is None else _xcstr(ns)
 *     if _delAttributeFromNsName(element._c_node, c_href, _xcstr(tag)):             # <<<<<<<<<<<<<<
 *         raise KeyError, key
 *     return 0
*/
  __pyx_t_5 = (__pyx_f_4lxml_5etree__delAttributeFromNsName(__pyx_v_element->_c_node, __pyx_v_c_href, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_tag)) != 0);
  if (unlikely(__pyx_t_5)) {

    /* "src/lxml/apihelpers.pxi":622
 *     c_href = <const_xmlChar*>NULL if ns is None else _xcstr(ns)
 *     if _delAttributeFromNsName(element._c_node, c_href, _xcstr(tag)):
 *         raise KeyError, key             # <<<<<<<<<<<<<<
 *     return 0
 * 
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_KeyError))), __pyx_v_key, 0, 0);
    __PYX_ERR(4, 622, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":621
 *     ns, tag = _getNsTag(key)
 *     c_href = <const_xmlChar*>NULL if ns is None else _xcstr(ns)
 *     if _delAttributeFromNsName(element._c_node, c_href, _xcstr(tag)):             # <<<<<<<<<<<<<<
 *         raise KeyError, key
 *     return 0
*/
  }

  /* "src/lxml/apihelpers.pxi":623
 *     if _delAttributeFromNsName(element._c_node, c_href, _xcstr(tag)):
 *         raise KeyError, key
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int _delAttributeFromNsName(xmlNode* c_node, const_xmlChar* c_href, const_xmlChar* c_name) noexcept:
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":618
 *     return 0
 * 
 * cdef int _delAttribute(_Element element, key) except -1:             # <<<<<<<<<<<<<<
 *     ns, tag = _getNsTag(key)
 *     c_href = <const_xmlChar*>NULL if ns is None else _xcstr(ns)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._delAttribute", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ns);
  __Pyx_XDECREF(__pyx_v_tag);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":625
 *     return 0
 * 
 * cdef int _delAttributeFromNsName(xmlNode* c_node, const_xmlChar* c_href, const_xmlChar* c_name) noexcept:             # <<<<<<<<<<<<<<
 *     c_attr = tree.xmlHasNsProp(c_node, c_name, c_href)
 *     if c_attr is NULL:
*/

static int __pyx_f_4lxml_5etree__delAttributeFromNsName(xmlNode *__pyx_v_c_node, const xmlChar *__pyx_v_c_href, const xmlChar *__pyx_v_c_name) {
  xmlAttr *__pyx_v_c_attr;
  int __pyx_r;
  int __pyx_t_1;

  /* "src/lxml/apihelpers.pxi":626
 * 
 * cdef int _delAttributeFromNsName(xmlNode* c_node, const_xmlChar* c_href, const_xmlChar* c_name) noexcept:
 *     c_attr = tree.xmlHasNsProp(c_node, c_name, c_href)             # <<<<<<<<<<<<<<
 *     if c_attr is NULL:
 *         # XXX free namespace that is not in use..?
*/
  __pyx_v_c_attr = xmlHasNsProp(__pyx_v_c_node, __pyx_v_c_name, __pyx_v_c_href);

  /* "src/lxml/apihelpers.pxi":627
 * cdef int _delAttributeFromNsName(xmlNode* c_node, const_xmlChar* c_href, const_xmlChar* c_name) noexcept:
 *     c_attr = tree.xmlHasNsProp(c_node, c_name, c_href)
 *     if c_attr is NULL:             # <<<<<<<<<<<<<<
 *         # XXX free namespace that is not in use..?
 *         return -1
*/
  __pyx_t_1 = (__pyx_v_c_attr == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":629
 *     if c_attr is NULL:
 *         # XXX free namespace that is not in use..?
 *         return -1             # <<<<<<<<<<<<<<
 *     tree.xmlRemoveProp(c_attr)
 *     return 0
*/
    __pyx_r = -1;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":627
 * cdef int _delAttributeFromNsName(xmlNode* c_node, const_xmlChar* c_href, const_xmlChar* c_name) noexcept:
 *     c_attr = tree.xmlHasNsProp(c_node, c_name, c_href)
 *     if c_attr is NULL:             # <<<<<<<<<<<<<<
 *         # XXX free namespace that is not in use..?
 *         return -1
*/
  }

  /* "src/lxml/apihelpers.pxi":630
 *         # XXX free namespace that is not in use..?
 *         return -1
 *     tree.xmlRemoveProp(c_attr)             # <<<<<<<<<<<<<<
 *     return 0
 * 
*/
  (void)(xmlRemoveProp(__pyx_v_c_attr));

  /* "src/lxml/apihelpers.pxi":631
 *         return -1
 *     tree.xmlRemoveProp(c_attr)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef list _collectAttributes(xmlNode* c_node, int collecttype):
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":625
 *     return 0
 * 
 * cdef int _delAttributeFromNsName(xmlNode* c_node, const_xmlChar* c_href, const_xmlChar* c_name) noexcept:             # <<<<<<<<<<<<<<
 *     c_attr = tree.xmlHasNsProp(c_node, c_name, c_href)
 *     if c_attr is NULL:
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":633
 *     return 0
 * 
 * cdef list _collectAttributes(xmlNode* c_node, int collecttype):             # <<<<<<<<<<<<<<
 *     """Collect all attributes of a node in a list.  Depending on collecttype,
 *     it collects either the name (1), the value (2) or the name-value tuples.
*/

static PyObject *__pyx_f_4lxml_5etree__collectAttributes(xmlNode *__pyx_v_c_node, int __pyx_v_collecttype) {
  Py_ssize_t __pyx_v_count;
  xmlAttr *__pyx_v_c_attr;
  PyObject *__pyx_v_attributes = NULL;
  PyObject *__pyx_v_item = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  xmlAttr *__pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_collectAttributes", 0);

  /* "src/lxml/apihelpers.pxi":638
 *     """
 *     cdef Py_ssize_t count
 *     c_attr = c_node.properties             # <<<<<<<<<<<<<<
 *     count = 0
 *     while c_attr is not NULL:
*/
  __pyx_t_1 = __pyx_v_c_node->properties;
  __pyx_v_c_attr = __pyx_t_1;

  /* "src/lxml/apihelpers.pxi":639
 *     cdef Py_ssize_t count
 *     c_attr = c_node.properties
 *     count = 0             # <<<<<<<<<<<<<<
 *     while c_attr is not NULL:
 *         if c_attr.type == tree.XML_ATTRIBUTE_NODE:
*/
  __pyx_v_count = 0;

  /* "src/lxml/apihelpers.pxi":640
 *     c_attr = c_node.properties
 *     count = 0
 *     while c_attr is not NULL:             # <<<<<<<<<<<<<<
 *         if c_attr.type == tree.XML_ATTRIBUTE_NODE:
 *             count += 1
*/
  while (1) {
    __pyx_t_2 = (__pyx_v_c_attr != NULL);
    if (!__pyx_t_2) break;

    /* "src/lxml/apihelpers.pxi":641
 *     count = 0
 *     while c_attr is not NULL:
 *         if c_attr.type == tree.XML_ATTRIBUTE_NODE:             # <<<<<<<<<<<<<<
 *             count += 1
 *         c_attr = c_attr.next
*/
    __pyx_t_2 = (__pyx_v_c_attr->type == XML_ATTRIBUTE_NODE);
    if (__pyx_t_2) {

      /* "src/lxml/apihelpers.pxi":642
 *     while c_attr is not NULL:
 *         if c_attr.type == tree.XML_ATTRIBUTE_NODE:
 *             count += 1             # <<<<<<<<<<<<<<
 *         c_attr = c_attr.next
 * 
*/
      __pyx_v_count = (__pyx_v_count + 1);

      /* "src/lxml/apihelpers.pxi":641
 *     count = 0
 *     while c_attr is not NULL:
 *         if c_attr.type == tree.XML_ATTRIBUTE_NODE:             # <<<<<<<<<<<<<<
 *             count += 1
 *         c_attr = c_attr.next
*/
    }

    /* "src/lxml/apihelpers.pxi":643
 *         if c_attr.type == tree.XML_ATTRIBUTE_NODE:
 *             count += 1
 *         c_attr = c_attr.next             # <<<<<<<<<<<<<<
 * 
 *     if not count:
*/
    __pyx_t_1 = __pyx_v_c_attr->next;
    __pyx_v_c_attr = __pyx_t_1;
  }

  /* "src/lxml/apihelpers.pxi":645
 *         c_attr = c_attr.next
 * 
 *     if not count:             # <<<<<<<<<<<<<<
 *         return []
 * 
*/
  __pyx_t_2 = (!(__pyx_v_count != 0));
  if (__pyx_t_2) {

    /* "src/lxml/apihelpers.pxi":646
 * 
 *     if not count:
 *         return []             # <<<<<<<<<<<<<<
 * 
 *     attributes = [None] * count
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 646, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":645
 *         c_attr = c_attr.next
 * 
 *     if not count:             # <<<<<<<<<<<<<<
 *         return []
 * 
*/
  }

  /* "src/lxml/apihelpers.pxi":648
 *         return []
 * 
 *     attributes = [None] * count             # <<<<<<<<<<<<<<
 *     c_attr = c_node.properties
 *     count = 0
*/
  __pyx_t_3 = PyList_New(1 * ((__pyx_v_count<0) ? 0:__pyx_v_count)); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 648, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  { Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < __pyx_v_count; __pyx_temp++) {
      __Pyx_INCREF(Py_None);
      __Pyx_GIVEREF(Py_None);
      if (__Pyx_PyList_SET_ITEM(__pyx_t_3, __pyx_temp, Py_None) != (0)) __PYX_ERR(4, 648, __pyx_L1_error);
    }
  }
  __pyx_v_attributes = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/apihelpers.pxi":649
 * 
 *     attributes = [None] * count
 *     c_attr = c_node.properties             # <<<<<<<<<<<<<<
 *     count = 0
 *     while c_attr is not NULL:
*/
  __pyx_t_1 = __pyx_v_c_node->properties;
  __pyx_v_c_attr = __pyx_t_1;

  /* "src/lxml/apihelpers.pxi":650
 *     attributes = [None] * count
 *     c_attr = c_node.properties
 *     count = 0             # <<<<<<<<<<<<<<
 *     while c_attr is not NULL:
 *         if c_attr.type == tree.XML_ATTRIBUTE_NODE:
*/
  __pyx_v_count = 0;

  /* "src/lxml/apihelpers.pxi":651
 *     c_attr = c_node.properties
 *     count = 0
 *     while c_attr is not NULL:             # <<<<<<<<<<<<<<
 *         if c_attr.type == tree.XML_ATTRIBUTE_NODE:
 *             if collecttype == 1:
*/
  while (1) {
    __pyx_t_2 = (__pyx_v_c_attr != NULL);
    if (!__pyx_t_2) break;

    /* "src/lxml/apihelpers.pxi":652
 *     count = 0
 *     while c_attr is not NULL:
 *         if c_attr.type == tree.XML_ATTRIBUTE_NODE:             # <<<<<<<<<<<<<<
 *             if collecttype == 1:
 *                 item = _namespacedName(<xmlNode*>c_attr)
*/
    __pyx_t_2 = (__pyx_v_c_attr->type == XML_ATTRIBUTE_NODE);
    if (__pyx_t_2) {

      /* "src/lxml/apihelpers.pxi":653
 *     while c_attr is not NULL:
 *         if c_attr.type == tree.XML_ATTRIBUTE_NODE:
 *             if collecttype == 1:             # <<<<<<<<<<<<<<
 *                 item = _namespacedName(<xmlNode*>c_attr)
 *             elif collecttype == 2:
*/
      switch (__pyx_v_collecttype) {
        case 1:

        /* "src/lxml/apihelpers.pxi":654
 *         if c_attr.type == tree.XML_ATTRIBUTE_NODE:
 *             if collecttype == 1:
 *                 item = _namespacedName(<xmlNode*>c_attr)             # <<<<<<<<<<<<<<
 *             elif collecttype == 2:
 *                 item = _attributeValue(c_node, c_attr)
*/
        __pyx_t_3 = __pyx_f_4lxml_5etree__namespacedName(((xmlNode *)__pyx_v_c_attr)); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 654, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_3);
        __pyx_t_3 = 0;

        /* "src/lxml/apihelpers.pxi":653
 *     while c_attr is not NULL:
 *         if c_attr.type == tree.XML_ATTRIBUTE_NODE:
 *             if collecttype == 1:             # <<<<<<<<<<<<<<
 *                 item = _namespacedName(<xmlNode*>c_attr)
 *             elif collecttype == 2:
*/
        break;
        case 2:

        /* "src/lxml/apihelpers.pxi":656
 *                 item = _namespacedName(<xmlNode*>c_attr)
 *             elif collecttype == 2:
 *                 item = _attributeValue(c_node, c_attr)             # <<<<<<<<<<<<<<
 *             else:
 *                 item = (_namespacedName(<xmlNode*>c_attr),
*/
        __pyx_t_3 = __pyx_f_4lxml_5etree__attributeValue(__pyx_v_c_node, __pyx_v_c_attr); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 656, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_3);
        __pyx_t_3 = 0;

        /* "src/lxml/apihelpers.pxi":655
 *             if collecttype == 1:
 *                 item = _namespacedName(<xmlNode*>c_attr)
 *             elif collecttype == 2:             # <<<<<<<<<<<<<<
 *                 item = _attributeValue(c_node, c_attr)
 *             else:
*/
        break;
        default:

        /* "src/lxml/apihelpers.pxi":658
 *                 item = _attributeValue(c_node, c_attr)
 *             else:
 *                 item = (_namespacedName(<xmlNode*>c_attr),             # <<<<<<<<<<<<<<
 *                         _attributeValue(c_node, c_attr))
 *             attributes[count] = item
*/
        __pyx_t_3 = __pyx_f_4lxml_5etree__namespacedName(((xmlNode *)__pyx_v_c_attr)); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 658, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);

        /* "src/lxml/apihelpers.pxi":659
 *             else:
 *                 item = (_namespacedName(<xmlNode*>c_attr),
 *                         _attributeValue(c_node, c_attr))             # <<<<<<<<<<<<<<
 *             attributes[count] = item
 *             count += 1
*/
        __pyx_t_4 = __pyx_f_4lxml_5etree__attributeValue(__pyx_v_c_node, __pyx_v_c_attr); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 659, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);

        /* "src/lxml/apihelpers.pxi":658
 *                 item = _attributeValue(c_node, c_attr)
 *             else:
 *                 item = (_namespacedName(<xmlNode*>c_attr),             # <<<<<<<<<<<<<<
 *                         _attributeValue(c_node, c_attr))
 *             attributes[count] = item
*/
        __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 658, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_3);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3) != (0)) __PYX_ERR(4, 658, __pyx_L1_error);
        __Pyx_GIVEREF(__pyx_t_4);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4) != (0)) __PYX_ERR(4, 658, __pyx_L1_error);
        __pyx_t_3 = 0;
        __pyx_t_4 = 0;
        __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_5);
        __pyx_t_5 = 0;
        break;
      }

      /* "src/lxml/apihelpers.pxi":660
 *                 item = (_namespacedName(<xmlNode*>c_attr),
 *                         _attributeValue(c_node, c_attr))
 *             attributes[count] = item             # <<<<<<<<<<<<<<
 *             count += 1
 *         c_attr = c_attr.next
*/
      if (unlikely((__Pyx_SetItemInt(__pyx_v_attributes, __pyx_v_count, __pyx_v_item, Py_ssize_t, 1, PyLong_FromSsize_t, 1, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference) < 0))) __PYX_ERR(4, 660, __pyx_L1_error)

      /* "src/lxml/apihelpers.pxi":661
 *                         _attributeValue(c_node, c_attr))
 *             attributes[count] = item
 *             count += 1             # <<<<<<<<<<<<<<
 *         c_attr = c_attr.next
 *     return attributes
*/
      __pyx_v_count = (__pyx_v_count + 1);

      /* "src/lxml/apihelpers.pxi":652
 *     count = 0
 *     while c_attr is not NULL:
 *         if c_attr.type == tree.XML_ATTRIBUTE_NODE:             # <<<<<<<<<<<<<<
 *             if collecttype == 1:
 *                 item = _namespacedName(<xmlNode*>c_attr)
*/
    }

    /* "src/lxml/apihelpers.pxi":662
 *             attributes[count] = item
 *             count += 1
 *         c_attr = c_attr.next             # <<<<<<<<<<<<<<
 *     return attributes
 * 
*/
    __pyx_t_1 = __pyx_v_c_attr->next;
    __pyx_v_c_attr = __pyx_t_1;
  }

  /* "src/lxml/apihelpers.pxi":663
 *             count += 1
 *         c_attr = c_attr.next
 *     return attributes             # <<<<<<<<<<<<<<
 * 
 * cdef object __RE_XML_ENCODING = re.compile(
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_attributes);
  __pyx_r = __pyx_v_attributes;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":633
 *     return 0
 * 
 * cdef list _collectAttributes(xmlNode* c_node, int collecttype):             # <<<<<<<<<<<<<<
 *     """Collect all attributes of a node in a list.  Depending on collecttype,
 *     it collects either the name (1), the value (2) or the name-value tuples.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._collectAttributes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_attributes);
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":671
 * cdef object __HAS_XML_ENCODING = __RE_XML_ENCODING.match
 * 
 * cdef object _stripEncodingDeclaration(object xml_string):             # <<<<<<<<<<<<<<
 *     # this is a hack to remove the XML encoding declaration from unicode
 *     return __REPLACE_XML_ENCODING(r'\g<1>\g<2>', xml_string)
*/

static PyObject *__pyx_f_4lxml_5etree__stripEncodingDeclaration(PyObject *__pyx_v_xml_string) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_stripEncodingDeclaration", 0);

  /* "src/lxml/apihelpers.pxi":673
 * cdef object _stripEncodingDeclaration(object xml_string):
 *     # this is a hack to remove the XML encoding declaration from unicode
 *     return __REPLACE_XML_ENCODING(r'\g<1>\g<2>', xml_string)             # <<<<<<<<<<<<<<
 * 
 * cdef bint _hasEncodingDeclaration(object xml_string) except -1:
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = NULL;
  __Pyx_INCREF(__pyx_v_4lxml_5etree___REPLACE_XML_ENCODING);
  __pyx_t_3 = __pyx_v_4lxml_5etree___REPLACE_XML_ENCODING; 
  __pyx_t_4 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_4 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_g_1_g_2, __pyx_v_xml_string};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 673, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":671
 * cdef object __HAS_XML_ENCODING = __RE_XML_ENCODING.match
 * 
 * cdef object _stripEncodingDeclaration(object xml_string):             # <<<<<<<<<<<<<<
 *     # this is a hack to remove the XML encoding declaration from unicode
 *     return __REPLACE_XML_ENCODING(r'\g<1>\g<2>', xml_string)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._stripEncodingDeclaration", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":675
 *     return __REPLACE_XML_ENCODING(r'\g<1>\g<2>', xml_string)
 * 
 * cdef bint _hasEncodingDeclaration(object xml_string) except -1:             # <<<<<<<<<<<<<<
 *     # check if a (unicode) string has an XML encoding declaration
 *     return __HAS_XML_ENCODING(xml_string) is not None
*/

static int __pyx_f_4lxml_5etree__hasEncodingDeclaration(PyObject *__pyx_v_xml_string) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_hasEncodingDeclaration", 0);

  /* "src/lxml/apihelpers.pxi":677
 * cdef bint _hasEncodingDeclaration(object xml_string) except -1:
 *     # check if a (unicode) string has an XML encoding declaration
 *     return __HAS_XML_ENCODING(xml_string) is not None             # <<<<<<<<<<<<<<
 * 
 * cdef inline bint _hasText(xmlNode* c_node) noexcept:
*/
  __pyx_t_2 = NULL;
  __Pyx_INCREF(__pyx_v_4lxml_5etree___HAS_XML_ENCODING);
  __pyx_t_3 = __pyx_v_4lxml_5etree___HAS_XML_ENCODING; 
  __pyx_t_4 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_4 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_xml_string};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 677, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_5 = (__pyx_t_1 != Py_None);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_5;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":675
 *     return __REPLACE_XML_ENCODING(r'\g<1>\g<2>', xml_string)
 * 
 * cdef bint _hasEncodingDeclaration(object xml_string) except -1:             # <<<<<<<<<<<<<<
 *     # check if a (unicode) string has an XML encoding declaration
 *     return __HAS_XML_ENCODING(xml_string) is not None
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._hasEncodingDeclaration", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":679
 *     return __HAS_XML_ENCODING(xml_string) is not None
 * 
 * cdef inline bint _hasText(xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *     return c_node is not NULL and _textNodeOrSkip(c_node.children) is not NULL
 * 
*/

static CYTHON_INLINE int __pyx_f_4lxml_5etree__hasText(xmlNode *__pyx_v_c_node) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;

  /* "src/lxml/apihelpers.pxi":680
 * 
 * cdef inline bint _hasText(xmlNode* c_node) noexcept:
 *     return c_node is not NULL and _textNodeOrSkip(c_node.children) is not NULL             # <<<<<<<<<<<<<<
 * 
 * cdef inline bint _hasTail(xmlNode* c_node) noexcept:
*/
  __pyx_t_2 = (__pyx_v_c_node != NULL);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L3_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_f_4lxml_5etree__textNodeOrSkip(__pyx_v_c_node->children) != NULL);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L3_bool_binop_done:;
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":679
 *     return __HAS_XML_ENCODING(xml_string) is not None
 * 
 * cdef inline bint _hasText(xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *     return c_node is not NULL and _textNodeOrSkip(c_node.children) is not NULL
 * 
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":682
 *     return c_node is not NULL and _textNodeOrSkip(c_node.children) is not NULL
 * 
 * cdef inline bint _hasTail(xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *     return c_node is not NULL and _textNodeOrSkip(c_node.next) is not NULL
 * 
*/

static CYTHON_INLINE int __pyx_f_4lxml_5etree__hasTail(xmlNode *__pyx_v_c_node) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;

  /* "src/lxml/apihelpers.pxi":683
 * 
 * cdef inline bint _hasTail(xmlNode* c_node) noexcept:
 *     return c_node is not NULL and _textNodeOrSkip(c_node.next) is not NULL             # <<<<<<<<<<<<<<
 * 
 * cdef inline bint _hasNonWhitespaceTail(xmlNode* c_node) except -1:
*/
  __pyx_t_2 = (__pyx_v_c_node != NULL);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L3_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_f_4lxml_5etree__textNodeOrSkip(__pyx_v_c_node->next) != NULL);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L3_bool_binop_done:;
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":682
 *     return c_node is not NULL and _textNodeOrSkip(c_node.children) is not NULL
 * 
 * cdef inline bint _hasTail(xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *     return c_node is not NULL and _textNodeOrSkip(c_node.next) is not NULL
 * 
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":685
 *     return c_node is not NULL and _textNodeOrSkip(c_node.next) is not NULL
 * 
 * cdef inline bint _hasNonWhitespaceTail(xmlNode* c_node) except -1:             # <<<<<<<<<<<<<<
 *     return _hasNonWhitespaceText(c_node, tail=True)
 * 
*/

static CYTHON_INLINE int __pyx_f_4lxml_5etree__hasNonWhitespaceTail(xmlNode *__pyx_v_c_node) {
  int __pyx_r;
  int __pyx_t_1;
  struct __pyx_opt_args_4lxml_5etree__hasNonWhitespaceText __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/apihelpers.pxi":686
 * 
 * cdef inline bint _hasNonWhitespaceTail(xmlNode* c_node) except -1:
 *     return _hasNonWhitespaceText(c_node, tail=True)             # <<<<<<<<<<<<<<
 * 
 * cdef bint _hasNonWhitespaceText(xmlNode* c_node, bint tail=False) except -1:
*/
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.tail = 1;
  __pyx_t_1 = __pyx_f_4lxml_5etree__hasNonWhitespaceText(__pyx_v_c_node, &__pyx_t_2); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(4, 686, __pyx_L1_error)
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":685
 *     return c_node is not NULL and _textNodeOrSkip(c_node.next) is not NULL
 * 
 * cdef inline bint _hasNonWhitespaceTail(xmlNode* c_node) except -1:             # <<<<<<<<<<<<<<
 *     return _hasNonWhitespaceText(c_node, tail=True)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._hasNonWhitespaceTail", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":688
 *     return _hasNonWhitespaceText(c_node, tail=True)
 * 
 * cdef bint _hasNonWhitespaceText(xmlNode* c_node, bint tail=False) except -1:             # <<<<<<<<<<<<<<
 *     c_text_node = c_node and _textNodeOrSkip(c_node.next if tail else c_node.children)
 *     if c_text_node is NULL:
*/

static int __pyx_f_4lxml_5etree__hasNonWhitespaceText(xmlNode *__pyx_v_c_node, struct __pyx_opt_args_4lxml_5etree__hasNonWhitespaceText *__pyx_optional_args) {
  int __pyx_v_tail = ((int)0);
  xmlNode *__pyx_v_c_text_node;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  xmlNode *__pyx_t_1;
  xmlNode *__pyx_t_2;
  xmlNode *__pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  size_t __pyx_t_9;
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_hasNonWhitespaceText", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_tail = __pyx_optional_args->tail;
    }
  }

  /* "src/lxml/apihelpers.pxi":689
 * 
 * cdef bint _hasNonWhitespaceText(xmlNode* c_node, bint tail=False) except -1:
 *     c_text_node = c_node and _textNodeOrSkip(c_node.next if tail else c_node.children)             # <<<<<<<<<<<<<<
 *     if c_text_node is NULL:
 *         return False
*/
  if (__pyx_v_c_node) {
  } else {
    __pyx_t_1 = __pyx_v_c_node;
    goto __pyx_L3_bool_binop_done;
  }
  if (__pyx_v_tail) {
    __pyx_t_2 = __pyx_v_c_node->next;
  } else {
    __pyx_t_2 = __pyx_v_c_node->children;
  }
  __pyx_t_3 = __pyx_f_4lxml_5etree__textNodeOrSkip(__pyx_t_2);
  __pyx_t_1 = __pyx_t_3;
  __pyx_L3_bool_binop_done:;
  __pyx_v_c_text_node = __pyx_t_1;

  /* "src/lxml/apihelpers.pxi":690
 * cdef bint _hasNonWhitespaceText(xmlNode* c_node, bint tail=False) except -1:
 *     c_text_node = c_node and _textNodeOrSkip(c_node.next if tail else c_node.children)
 *     if c_text_node is NULL:             # <<<<<<<<<<<<<<
 *         return False
 *     while c_text_node is not NULL:
*/
  __pyx_t_4 = (__pyx_v_c_text_node == NULL);
  if (__pyx_t_4) {

    /* "src/lxml/apihelpers.pxi":691
 *     c_text_node = c_node and _textNodeOrSkip(c_node.next if tail else c_node.children)
 *     if c_text_node is NULL:
 *         return False             # <<<<<<<<<<<<<<
 *     while c_text_node is not NULL:
 *         if c_text_node.content[0] != c'\0' and not _collectText(c_text_node).isspace():
*/
    __pyx_r = 0;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":690
 * cdef bint _hasNonWhitespaceText(xmlNode* c_node, bint tail=False) except -1:
 *     c_text_node = c_node and _textNodeOrSkip(c_node.next if tail else c_node.children)
 *     if c_text_node is NULL:             # <<<<<<<<<<<<<<
 *         return False
 *     while c_text_node is not NULL:
*/
  }

  /* "src/lxml/apihelpers.pxi":692
 *     if c_text_node is NULL:
 *         return False
 *     while c_text_node is not NULL:             # <<<<<<<<<<<<<<
 *         if c_text_node.content[0] != c'\0' and not _collectText(c_text_node).isspace():
 *             return True
*/
  while (1) {
    __pyx_t_4 = (__pyx_v_c_text_node != NULL);
    if (!__pyx_t_4) break;

    /* "src/lxml/apihelpers.pxi":693
 *         return False
 *     while c_text_node is not NULL:
 *         if c_text_node.content[0] != c'\0' and not _collectText(c_text_node).isspace():             # <<<<<<<<<<<<<<
 *             return True
 *         c_text_node = _textNodeOrSkip(c_text_node.next)
*/
    __pyx_t_5 = ((__pyx_v_c_text_node->content[0]) != '\x00');
    if (__pyx_t_5) {
    } else {
      __pyx_t_4 = __pyx_t_5;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_8 = __pyx_f_4lxml_5etree__collectText(__pyx_v_c_text_node); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 693, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_7 = __pyx_t_8;
    __Pyx_INCREF(__pyx_t_7);
    __pyx_t_9 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, NULL};
      __pyx_t_6 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_isspace, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 693, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
    }
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(4, 693, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_10 = (!__pyx_t_5);
    __pyx_t_4 = __pyx_t_10;
    __pyx_L9_bool_binop_done:;
    if (__pyx_t_4) {

      /* "src/lxml/apihelpers.pxi":694
 *     while c_text_node is not NULL:
 *         if c_text_node.content[0] != c'\0' and not _collectText(c_text_node).isspace():
 *             return True             # <<<<<<<<<<<<<<
 *         c_text_node = _textNodeOrSkip(c_text_node.next)
 *     return False
*/
      __pyx_r = 1;
      goto __pyx_L0;

      /* "src/lxml/apihelpers.pxi":693
 *         return False
 *     while c_text_node is not NULL:
 *         if c_text_node.content[0] != c'\0' and not _collectText(c_text_node).isspace():             # <<<<<<<<<<<<<<
 *             return True
 *         c_text_node = _textNodeOrSkip(c_text_node.next)
*/
    }

    /* "src/lxml/apihelpers.pxi":695
 *         if c_text_node.content[0] != c'\0' and not _collectText(c_text_node).isspace():
 *             return True
 *         c_text_node = _textNodeOrSkip(c_text_node.next)             # <<<<<<<<<<<<<<
 *     return False
 * 
*/
    __pyx_v_c_text_node = __pyx_f_4lxml_5etree__textNodeOrSkip(__pyx_v_c_text_node->next);
  }

  /* "src/lxml/apihelpers.pxi":696
 *             return True
 *         c_text_node = _textNodeOrSkip(c_text_node.next)
 *     return False             # <<<<<<<<<<<<<<
 * 
 * cdef unicode _collectText(xmlNode* c_node):
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":688
 *     return _hasNonWhitespaceText(c_node, tail=True)
 * 
 * cdef bint _hasNonWhitespaceText(xmlNode* c_node, bint tail=False) except -1:             # <<<<<<<<<<<<<<
 *     c_text_node = c_node and _textNodeOrSkip(c_node.next if tail else c_node.children)
 *     if c_text_node is NULL:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("lxml.etree._hasNonWhitespaceText", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":698
 *     return False
 * 
 * cdef unicode _collectText(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     """Collect all text nodes and return them as a unicode string.
 * 
*/

static PyObject *__pyx_f_4lxml_5etree__collectText(xmlNode *__pyx_v_c_node) {
  Py_ssize_t __pyx_v_scount;
  xmlChar *__pyx_v_c_text;
  xmlNode *__pyx_v_c_node_cur;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  xmlNode *__pyx_t_1;
  int __pyx_t_2;
  xmlChar *__pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  unsigned char *__pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_collectText", 0);

  /* "src/lxml/apihelpers.pxi":709
 *     cdef xmlNode* c_node_cur
 *     # check for multiple text nodes
 *     scount = 0             # <<<<<<<<<<<<<<
 *     c_text = NULL
 *     c_node_cur = c_node = _textNodeOrSkip(c_node)
*/
  __pyx_v_scount = 0;

  /* "src/lxml/apihelpers.pxi":710
 *     # check for multiple text nodes
 *     scount = 0
 *     c_text = NULL             # <<<<<<<<<<<<<<
 *     c_node_cur = c_node = _textNodeOrSkip(c_node)
 *     while c_node_cur is not NULL:
*/
  __pyx_v_c_text = NULL;

  /* "src/lxml/apihelpers.pxi":711
 *     scount = 0
 *     c_text = NULL
 *     c_node_cur = c_node = _textNodeOrSkip(c_node)             # <<<<<<<<<<<<<<
 *     while c_node_cur is not NULL:
 *         if c_node_cur.content[0] != c'\0':
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__textNodeOrSkip(__pyx_v_c_node);
  __pyx_v_c_node_cur = __pyx_t_1;
  __pyx_v_c_node = __pyx_t_1;

  /* "src/lxml/apihelpers.pxi":712
 *     c_text = NULL
 *     c_node_cur = c_node = _textNodeOrSkip(c_node)
 *     while c_node_cur is not NULL:             # <<<<<<<<<<<<<<
 *         if c_node_cur.content[0] != c'\0':
 *             c_text = c_node_cur.content
*/
  while (1) {
    __pyx_t_2 = (__pyx_v_c_node_cur != NULL);
    if (!__pyx_t_2) break;

    /* "src/lxml/apihelpers.pxi":713
 *     c_node_cur = c_node = _textNodeOrSkip(c_node)
 *     while c_node_cur is not NULL:
 *         if c_node_cur.content[0] != c'\0':             # <<<<<<<<<<<<<<
 *             c_text = c_node_cur.content
 *         scount += 1
*/
    __pyx_t_2 = ((__pyx_v_c_node_cur->content[0]) != '\x00');
    if (__pyx_t_2) {

      /* "src/lxml/apihelpers.pxi":714
 *     while c_node_cur is not NULL:
 *         if c_node_cur.content[0] != c'\0':
 *             c_text = c_node_cur.content             # <<<<<<<<<<<<<<
 *         scount += 1
 *         c_node_cur = _textNodeOrSkip(c_node_cur.next)
*/
      __pyx_t_3 = __pyx_v_c_node_cur->content;
      __pyx_v_c_text = __pyx_t_3;

      /* "src/lxml/apihelpers.pxi":713
 *     c_node_cur = c_node = _textNodeOrSkip(c_node)
 *     while c_node_cur is not NULL:
 *         if c_node_cur.content[0] != c'\0':             # <<<<<<<<<<<<<<
 *             c_text = c_node_cur.content
 *         scount += 1
*/
    }

    /* "src/lxml/apihelpers.pxi":715
 *         if c_node_cur.content[0] != c'\0':
 *             c_text = c_node_cur.content
 *         scount += 1             # <<<<<<<<<<<<<<
 *         c_node_cur = _textNodeOrSkip(c_node_cur.next)
 * 
*/
    __pyx_v_scount = (__pyx_v_scount + 1);

    /* "src/lxml/apihelpers.pxi":716
 *             c_text = c_node_cur.content
 *         scount += 1
 *         c_node_cur = _textNodeOrSkip(c_node_cur.next)             # <<<<<<<<<<<<<<
 * 
 *     # handle two most common cases first
*/
    __pyx_v_c_node_cur = __pyx_f_4lxml_5etree__textNodeOrSkip(__pyx_v_c_node_cur->next);
  }

  /* "src/lxml/apihelpers.pxi":719
 * 
 *     # handle two most common cases first
 *     if c_text is NULL:             # <<<<<<<<<<<<<<
 *         return '' if scount > 0 else None
 *     if scount == 1:
*/
  __pyx_t_2 = (__pyx_v_c_text == NULL);
  if (__pyx_t_2) {

    /* "src/lxml/apihelpers.pxi":720
 *     # handle two most common cases first
 *     if c_text is NULL:
 *         return '' if scount > 0 else None             # <<<<<<<<<<<<<<
 *     if scount == 1:
 *         return funicode(c_text)
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = (__pyx_v_scount > 0);
    if (__pyx_t_2) {
      __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u__8);
      __pyx_t_4 = __pyx_mstate_global->__pyx_kp_u__8;
    } else {
      __Pyx_INCREF(Py_None);
      __pyx_t_4 = Py_None;
    }
    if (!(likely(PyUnicode_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_4))) __PYX_ERR(4, 720, __pyx_L1_error)
    __pyx_r = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":719
 * 
 *     # handle two most common cases first
 *     if c_text is NULL:             # <<<<<<<<<<<<<<
 *         return '' if scount > 0 else None
 *     if scount == 1:
*/
  }

  /* "src/lxml/apihelpers.pxi":721
 *     if c_text is NULL:
 *         return '' if scount > 0 else None
 *     if scount == 1:             # <<<<<<<<<<<<<<
 *         return funicode(c_text)
 * 
*/
  __pyx_t_2 = (__pyx_v_scount == 1);
  if (__pyx_t_2) {

    /* "src/lxml/apihelpers.pxi":722
 *         return '' if scount > 0 else None
 *     if scount == 1:
 *         return funicode(c_text)             # <<<<<<<<<<<<<<
 * 
 *     # the rest is not performance critical anymore
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_text); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 722, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":721
 *     if c_text is NULL:
 *         return '' if scount > 0 else None
 *     if scount == 1:             # <<<<<<<<<<<<<<
 *         return funicode(c_text)
 * 
*/
  }

  /* "src/lxml/apihelpers.pxi":725
 * 
 *     # the rest is not performance critical anymore
 *     result = b''             # <<<<<<<<<<<<<<
 *     while c_node is not NULL:
 *         result += <unsigned char*>c_node.content
*/
  __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_b__8);
  __pyx_v_result = __pyx_mstate_global->__pyx_kp_b__8;

  /* "src/lxml/apihelpers.pxi":726
 *     # the rest is not performance critical anymore
 *     result = b''
 *     while c_node is not NULL:             # <<<<<<<<<<<<<<
 *         result += <unsigned char*>c_node.content
 *         c_node = _textNodeOrSkip(c_node.next)
*/
  while (1) {
    __pyx_t_2 = (__pyx_v_c_node != NULL);
    if (!__pyx_t_2) break;

    /* "src/lxml/apihelpers.pxi":727
 *     result = b''
 *     while c_node is not NULL:
 *         result += <unsigned char*>c_node.content             # <<<<<<<<<<<<<<
 *         c_node = _textNodeOrSkip(c_node.next)
 *     return funicode(<const_xmlChar*><unsigned char*>result)
*/
    __pyx_t_4 = __Pyx_PyBytes_FromCString(((unsigned char *)__pyx_v_c_node->content)); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 727, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_result, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 727, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_result, ((PyObject*)__pyx_t_5));
    __pyx_t_5 = 0;

    /* "src/lxml/apihelpers.pxi":728
 *     while c_node is not NULL:
 *         result += <unsigned char*>c_node.content
 *         c_node = _textNodeOrSkip(c_node.next)             # <<<<<<<<<<<<<<
 *     return funicode(<const_xmlChar*><unsigned char*>result)
 * 
*/
    __pyx_v_c_node = __pyx_f_4lxml_5etree__textNodeOrSkip(__pyx_v_c_node->next);
  }

  /* "src/lxml/apihelpers.pxi":729
 *         result += <unsigned char*>c_node.content
 *         c_node = _textNodeOrSkip(c_node.next)
 *     return funicode(<const_xmlChar*><unsigned char*>result)             # <<<<<<<<<<<<<<
 * 
 * cdef void _removeText(xmlNode* c_node) noexcept:
*/
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(__pyx_v_result == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(4, 729, __pyx_L1_error)
  }
  __pyx_t_6 = __Pyx_PyBytes_AsWritableUString(__pyx_v_result); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(4, 729, __pyx_L1_error)
  __pyx_t_5 = __pyx_f_4lxml_5etree_funicode(((const xmlChar *)((unsigned char *)__pyx_t_6))); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 729, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":698
 *     return False
 * 
 * cdef unicode _collectText(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     """Collect all text nodes and return them as a unicode string.
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._collectText", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":731
 *     return funicode(<const_xmlChar*><unsigned char*>result)
 * 
 * cdef void _removeText(xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *     """Remove all text nodes.
 * 
*/

static void __pyx_f_4lxml_5etree__removeText(xmlNode *__pyx_v_c_node) {
  xmlNode *__pyx_v_c_next;
  int __pyx_t_1;

  /* "src/lxml/apihelpers.pxi":737
 *     """
 *     cdef xmlNode* c_next
 *     c_node = _textNodeOrSkip(c_node)             # <<<<<<<<<<<<<<
 *     while c_node is not NULL:
 *         c_next = _textNodeOrSkip(c_node.next)
*/
  __pyx_v_c_node = __pyx_f_4lxml_5etree__textNodeOrSkip(__pyx_v_c_node);

  /* "src/lxml/apihelpers.pxi":738
 *     cdef xmlNode* c_next
 *     c_node = _textNodeOrSkip(c_node)
 *     while c_node is not NULL:             # <<<<<<<<<<<<<<
 *         c_next = _textNodeOrSkip(c_node.next)
 *         tree.xmlUnlinkNode(c_node)
*/
  while (1) {
    __pyx_t_1 = (__pyx_v_c_node != NULL);
    if (!__pyx_t_1) break;

    /* "src/lxml/apihelpers.pxi":739
 *     c_node = _textNodeOrSkip(c_node)
 *     while c_node is not NULL:
 *         c_next = _textNodeOrSkip(c_node.next)             # <<<<<<<<<<<<<<
 *         tree.xmlUnlinkNode(c_node)
 *         tree.xmlFreeNode(c_node)
*/
    __pyx_v_c_next = __pyx_f_4lxml_5etree__textNodeOrSkip(__pyx_v_c_node->next);

    /* "src/lxml/apihelpers.pxi":740
 *     while c_node is not NULL:
 *         c_next = _textNodeOrSkip(c_node.next)
 *         tree.xmlUnlinkNode(c_node)             # <<<<<<<<<<<<<<
 *         tree.xmlFreeNode(c_node)
 *         c_node = c_next
*/
    xmlUnlinkNode(__pyx_v_c_node);

    /* "src/lxml/apihelpers.pxi":741
 *         c_next = _textNodeOrSkip(c_node.next)
 *         tree.xmlUnlinkNode(c_node)
 *         tree.xmlFreeNode(c_node)             # <<<<<<<<<<<<<<
 *         c_node = c_next
 * 
*/
    xmlFreeNode(__pyx_v_c_node);

    /* "src/lxml/apihelpers.pxi":742
 *         tree.xmlUnlinkNode(c_node)
 *         tree.xmlFreeNode(c_node)
 *         c_node = c_next             # <<<<<<<<<<<<<<
 * 
 * cdef xmlNode* _createTextNode(xmlDoc* doc, value) except NULL:
*/
    __pyx_v_c_node = __pyx_v_c_next;
  }

  /* "src/lxml/apihelpers.pxi":731
 *     return funicode(<const_xmlChar*><unsigned char*>result)
 * 
 * cdef void _removeText(xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *     """Remove all text nodes.
 * 
*/

  /* function exit code */
}

/* "src/lxml/apihelpers.pxi":744
 *         c_node = c_next
 * 
 * cdef xmlNode* _createTextNode(xmlDoc* doc, value) except NULL:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_text_node
 *     if isinstance(value, CDATA):
*/

static xmlNode *__pyx_f_4lxml_5etree__createTextNode(xmlDoc *__pyx_v_doc, PyObject *__pyx_v_value) {
  xmlNode *__pyx_v_c_text_node;
  PyObject *__pyx_v_text = NULL;
  xmlNode *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_createTextNode", 0);

  /* "src/lxml/apihelpers.pxi":746
 * cdef xmlNode* _createTextNode(xmlDoc* doc, value) except NULL:
 *     cdef xmlNode* c_text_node
 *     if isinstance(value, CDATA):             # <<<<<<<<<<<<<<
 *         c_text_node = tree.xmlNewCDataBlock(
 *             doc, _xcstr((<CDATA>value)._utf8_data),
*/
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_value, __pyx_mstate_global->__pyx_ptype_4lxml_5etree_CDATA); 
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":748
 *     if isinstance(value, CDATA):
 *         c_text_node = tree.xmlNewCDataBlock(
 *             doc, _xcstr((<CDATA>value)._utf8_data),             # <<<<<<<<<<<<<<
 *             python.PyBytes_GET_SIZE((<CDATA>value)._utf8_data))
 *     else:
*/
    __pyx_t_2 = ((struct __pyx_obj_4lxml_5etree_CDATA *)__pyx_v_value)->_utf8_data;
    __Pyx_INCREF(__pyx_t_2);

    /* "src/lxml/apihelpers.pxi":749
 *         c_text_node = tree.xmlNewCDataBlock(
 *             doc, _xcstr((<CDATA>value)._utf8_data),
 *             python.PyBytes_GET_SIZE((<CDATA>value)._utf8_data))             # <<<<<<<<<<<<<<
 *     else:
 *         text = _utf8(value)
*/
    __pyx_t_3 = ((struct __pyx_obj_4lxml_5etree_CDATA *)__pyx_v_value)->_utf8_data;
    __Pyx_INCREF(__pyx_t_3);

    /* "src/lxml/apihelpers.pxi":747
 *     cdef xmlNode* c_text_node
 *     if isinstance(value, CDATA):
 *         c_text_node = tree.xmlNewCDataBlock(             # <<<<<<<<<<<<<<
 *             doc, _xcstr((<CDATA>value)._utf8_data),
 *             python.PyBytes_GET_SIZE((<CDATA>value)._utf8_data))
*/
    __pyx_v_c_text_node = xmlNewCDataBlock(__pyx_v_doc, (const xmlChar*)PyBytes_AS_STRING(__pyx_t_2), PyBytes_GET_SIZE(__pyx_t_3));
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/apihelpers.pxi":746
 * cdef xmlNode* _createTextNode(xmlDoc* doc, value) except NULL:
 *     cdef xmlNode* c_text_node
 *     if isinstance(value, CDATA):             # <<<<<<<<<<<<<<
 *         c_text_node = tree.xmlNewCDataBlock(
 *             doc, _xcstr((<CDATA>value)._utf8_data),
*/
    goto __pyx_L3;
  }

  /* "src/lxml/apihelpers.pxi":751
 *             python.PyBytes_GET_SIZE((<CDATA>value)._utf8_data))
 *     else:
 *         text = _utf8(value)             # <<<<<<<<<<<<<<
 *         c_text_node = tree.xmlNewDocText(doc, _xcstr(text))
 *     if not c_text_node:
*/
  /*else*/ {
    __pyx_t_3 = __pyx_f_4lxml_5etree__utf8(__pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 751, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_text = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/apihelpers.pxi":752
 *     else:
 *         text = _utf8(value)
 *         c_text_node = tree.xmlNewDocText(doc, _xcstr(text))             # <<<<<<<<<<<<<<
 *     if not c_text_node:
 *         raise MemoryError()
*/
    __pyx_v_c_text_node = xmlNewDocText(__pyx_v_doc, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_text));
  }
  __pyx_L3:;

  /* "src/lxml/apihelpers.pxi":753
 *         text = _utf8(value)
 *         c_text_node = tree.xmlNewDocText(doc, _xcstr(text))
 *     if not c_text_node:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     return c_text_node
*/
  __pyx_t_1 = (!(__pyx_v_c_text_node != 0));
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/apihelpers.pxi":754
 *         c_text_node = tree.xmlNewDocText(doc, _xcstr(text))
 *     if not c_text_node:
 *         raise MemoryError()             # <<<<<<<<<<<<<<
 *     return c_text_node
 * 
*/
    PyErr_NoMemory(); __PYX_ERR(4, 754, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":753
 *         text = _utf8(value)
 *         c_text_node = tree.xmlNewDocText(doc, _xcstr(text))
 *     if not c_text_node:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     return c_text_node
*/
  }

  /* "src/lxml/apihelpers.pxi":755
 *     if not c_text_node:
 *         raise MemoryError()
 *     return c_text_node             # <<<<<<<<<<<<<<
 * 
 * cdef int _setNodeText(xmlNode* c_node, value) except -1:
*/
  __pyx_r = __pyx_v_c_text_node;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":744
 *         c_node = c_next
 * 
 * cdef xmlNode* _createTextNode(xmlDoc* doc, value) except NULL:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_text_node
 *     if isinstance(value, CDATA):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._createTextNode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_text);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":757
 *     return c_text_node
 * 
 * cdef int _setNodeText(xmlNode* c_node, value) except -1:             # <<<<<<<<<<<<<<
 *     # remove all text nodes at the start first
 *     _removeText(c_node.children)
*/

static int __pyx_f_4lxml_5etree__setNodeText(xmlNode *__pyx_v_c_node, PyObject *__pyx_v_value) {
  xmlNode *__pyx_v_c_text_node;
  int __pyx_r;
  int __pyx_t_1;
  xmlNode *__pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/apihelpers.pxi":759
 * cdef int _setNodeText(xmlNode* c_node, value) except -1:
 *     # remove all text nodes at the start first
 *     _removeText(c_node.children)             # <<<<<<<<<<<<<<
 *     if value is None:
 *         return 0
*/
  __pyx_f_4lxml_5etree__removeText(__pyx_v_c_node->children);

  /* "src/lxml/apihelpers.pxi":760
 *     # remove all text nodes at the start first
 *     _removeText(c_node.children)
 *     if value is None:             # <<<<<<<<<<<<<<
 *         return 0
 *     # now add new text node with value at start
*/
  __pyx_t_1 = (__pyx_v_value == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":761
 *     _removeText(c_node.children)
 *     if value is None:
 *         return 0             # <<<<<<<<<<<<<<
 *     # now add new text node with value at start
 *     c_text_node = _createTextNode(c_node.doc, value)
*/
    __pyx_r = 0;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":760
 *     # remove all text nodes at the start first
 *     _removeText(c_node.children)
 *     if value is None:             # <<<<<<<<<<<<<<
 *         return 0
 *     # now add new text node with value at start
*/
  }

  /* "src/lxml/apihelpers.pxi":763
 *         return 0
 *     # now add new text node with value at start
 *     c_text_node = _createTextNode(c_node.doc, value)             # <<<<<<<<<<<<<<
 *     if c_node.children is NULL:
 *         tree.xmlAddChild(c_node, c_text_node)
*/
  __pyx_t_2 = __pyx_f_4lxml_5etree__createTextNode(__pyx_v_c_node->doc, __pyx_v_value); if (unlikely(__pyx_t_2 == ((void *)NULL))) __PYX_ERR(4, 763, __pyx_L1_error)
  __pyx_v_c_text_node = __pyx_t_2;

  /* "src/lxml/apihelpers.pxi":764
 *     # now add new text node with value at start
 *     c_text_node = _createTextNode(c_node.doc, value)
 *     if c_node.children is NULL:             # <<<<<<<<<<<<<<
 *         tree.xmlAddChild(c_node, c_text_node)
 *     else:
*/
  __pyx_t_1 = (__pyx_v_c_node->children == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":765
 *     c_text_node = _createTextNode(c_node.doc, value)
 *     if c_node.children is NULL:
 *         tree.xmlAddChild(c_node, c_text_node)             # <<<<<<<<<<<<<<
 *     else:
 *         tree.xmlAddPrevSibling(c_node.children, c_text_node)
*/
    (void)(xmlAddChild(__pyx_v_c_node, __pyx_v_c_text_node));

    /* "src/lxml/apihelpers.pxi":764
 *     # now add new text node with value at start
 *     c_text_node = _createTextNode(c_node.doc, value)
 *     if c_node.children is NULL:             # <<<<<<<<<<<<<<
 *         tree.xmlAddChild(c_node, c_text_node)
 *     else:
*/
    goto __pyx_L4;
  }

  /* "src/lxml/apihelpers.pxi":767
 *         tree.xmlAddChild(c_node, c_text_node)
 *     else:
 *         tree.xmlAddPrevSibling(c_node.children, c_text_node)             # <<<<<<<<<<<<<<
 *     return 0
 * 
*/
  /*else*/ {
    (void)(xmlAddPrevSibling(__pyx_v_c_node->children, __pyx_v_c_text_node));
  }
  __pyx_L4:;

  /* "src/lxml/apihelpers.pxi":768
 *     else:
 *         tree.xmlAddPrevSibling(c_node.children, c_text_node)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int _setTailText(xmlNode* c_node, value) except -1:
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":757
 *     return c_text_node
 * 
 * cdef int _setNodeText(xmlNode* c_node, value) except -1:             # <<<<<<<<<<<<<<
 *     # remove all text nodes at the start first
 *     _removeText(c_node.children)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._setNodeText", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":770
 *     return 0
 * 
 * cdef int _setTailText(xmlNode* c_node, value) except -1:             # <<<<<<<<<<<<<<
 *     # remove all text nodes at the start first
 *     _removeText(c_node.next)
*/

static int __pyx_f_4lxml_5etree__setTailText(xmlNode *__pyx_v_c_node, PyObject *__pyx_v_value) {
  xmlNode *__pyx_v_c_text_node;
  int __pyx_r;
  int __pyx_t_1;
  xmlNode *__pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/apihelpers.pxi":772
 * cdef int _setTailText(xmlNode* c_node, value) except -1:
 *     # remove all text nodes at the start first
 *     _removeText(c_node.next)             # <<<<<<<<<<<<<<
 *     if value is None:
 *         return 0
*/
  __pyx_f_4lxml_5etree__removeText(__pyx_v_c_node->next);

  /* "src/lxml/apihelpers.pxi":773
 *     # remove all text nodes at the start first
 *     _removeText(c_node.next)
 *     if value is None:             # <<<<<<<<<<<<<<
 *         return 0
 *     # now append new text node with value
*/
  __pyx_t_1 = (__pyx_v_value == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":774
 *     _removeText(c_node.next)
 *     if value is None:
 *         return 0             # <<<<<<<<<<<<<<
 *     # now append new text node with value
 *     c_text_node = _createTextNode(c_node.doc, value)
*/
    __pyx_r = 0;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":773
 *     # remove all text nodes at the start first
 *     _removeText(c_node.next)
 *     if value is None:             # <<<<<<<<<<<<<<
 *         return 0
 *     # now append new text node with value
*/
  }

  /* "src/lxml/apihelpers.pxi":776
 *         return 0
 *     # now append new text node with value
 *     c_text_node = _createTextNode(c_node.doc, value)             # <<<<<<<<<<<<<<
 *     tree.xmlAddNextSibling(c_node, c_text_node)
 *     return 0
*/
  __pyx_t_2 = __pyx_f_4lxml_5etree__createTextNode(__pyx_v_c_node->doc, __pyx_v_value); if (unlikely(__pyx_t_2 == ((void *)NULL))) __PYX_ERR(4, 776, __pyx_L1_error)
  __pyx_v_c_text_node = __pyx_t_2;

  /* "src/lxml/apihelpers.pxi":777
 *     # now append new text node with value
 *     c_text_node = _createTextNode(c_node.doc, value)
 *     tree.xmlAddNextSibling(c_node, c_text_node)             # <<<<<<<<<<<<<<
 *     return 0
 * 
*/
  (void)(xmlAddNextSibling(__pyx_v_c_node, __pyx_v_c_text_node));

  /* "src/lxml/apihelpers.pxi":778
 *     c_text_node = _createTextNode(c_node.doc, value)
 *     tree.xmlAddNextSibling(c_node, c_text_node)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef bytes _resolveQNameText(_Element element, value):
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":770
 *     return 0
 * 
 * cdef int _setTailText(xmlNode* c_node, value) except -1:             # <<<<<<<<<<<<<<
 *     # remove all text nodes at the start first
 *     _removeText(c_node.next)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._setTailText", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":780
 *     return 0
 * 
 * cdef bytes _resolveQNameText(_Element element, value):             # <<<<<<<<<<<<<<
 *     cdef xmlNs* c_ns
 *     ns, tag = _getNsTag(value)
*/

static PyObject *__pyx_f_4lxml_5etree__resolveQNameText(struct LxmlElement *__pyx_v_element, PyObject *__pyx_v_value) {
  xmlNs *__pyx_v_c_ns;
  PyObject *__pyx_v_ns = NULL;
  PyObject *__pyx_v_tag = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  xmlNs *__pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_resolveQNameText", 0);

  /* "src/lxml/apihelpers.pxi":782
 * cdef bytes _resolveQNameText(_Element element, value):
 *     cdef xmlNs* c_ns
 *     ns, tag = _getNsTag(value)             # <<<<<<<<<<<<<<
 *     if ns is None:
 *         return tag
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__getNsTag(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 782, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(__pyx_t_1 != Py_None)) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(4, 782, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 782, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 782, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(4, 782, __pyx_L1_error)
  }
  __pyx_v_ns = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_tag = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "src/lxml/apihelpers.pxi":783
 *     cdef xmlNs* c_ns
 *     ns, tag = _getNsTag(value)
 *     if ns is None:             # <<<<<<<<<<<<<<
 *         return tag
 *     else:
*/
  __pyx_t_4 = (__pyx_v_ns == Py_None);
  if (__pyx_t_4) {

    /* "src/lxml/apihelpers.pxi":784
 *     ns, tag = _getNsTag(value)
 *     if ns is None:
 *         return tag             # <<<<<<<<<<<<<<
 *     else:
 *         c_ns = element._doc._findOrBuildNodeNs(
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __pyx_v_tag;
    __Pyx_INCREF(__pyx_t_1);
    if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_1))) __PYX_ERR(4, 784, __pyx_L1_error)
    __pyx_r = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":783
 *     cdef xmlNs* c_ns
 *     ns, tag = _getNsTag(value)
 *     if ns is None:             # <<<<<<<<<<<<<<
 *         return tag
 *     else:
*/
  }

  /* "src/lxml/apihelpers.pxi":786
 *         return tag
 *     else:
 *         c_ns = element._doc._findOrBuildNodeNs(             # <<<<<<<<<<<<<<
 *             element._c_node, _xcstr(ns), NULL, 0)
 *         return python.PyBytes_FromFormat('%s:%s', c_ns.prefix, _cstr(tag))
*/
  /*else*/ {

    /* "src/lxml/apihelpers.pxi":787
 *     else:
 *         c_ns = element._doc._findOrBuildNodeNs(
 *             element._c_node, _xcstr(ns), NULL, 0)             # <<<<<<<<<<<<<<
 *         return python.PyBytes_FromFormat('%s:%s', c_ns.prefix, _cstr(tag))
 * 
*/
    __pyx_t_5 = __pyx_f_4lxml_5etree_9_Document__findOrBuildNodeNs(__pyx_v_element->_doc, __pyx_v_element->_c_node, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_ns), NULL, 0); if (unlikely(__pyx_t_5 == ((void *)NULL))) __PYX_ERR(4, 786, __pyx_L1_error)
    __pyx_v_c_ns = __pyx_t_5;

    /* "src/lxml/apihelpers.pxi":788
 *         c_ns = element._doc._findOrBuildNodeNs(
 *             element._c_node, _xcstr(ns), NULL, 0)
 *         return python.PyBytes_FromFormat('%s:%s', c_ns.prefix, _cstr(tag))             # <<<<<<<<<<<<<<
 * 
 * cdef inline bint _hasChild(xmlNode* c_node) noexcept:
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = PyBytes_FromFormat(((char *)"%s:%s"), __pyx_v_c_ns->prefix, PyBytes_AS_STRING(__pyx_v_tag)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 788, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L0;
  }

  /* "src/lxml/apihelpers.pxi":780
 *     return 0
 * 
 * cdef bytes _resolveQNameText(_Element element, value):             # <<<<<<<<<<<<<<
 *     cdef xmlNs* c_ns
 *     ns, tag = _getNsTag(value)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._resolveQNameText", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ns);
  __Pyx_XDECREF(__pyx_v_tag);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":790
 *         return python.PyBytes_FromFormat('%s:%s', c_ns.prefix, _cstr(tag))
 * 
 * cdef inline bint _hasChild(xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *     return c_node is not NULL and _findChildForwards(c_node, 0) is not NULL
 * 
*/

static CYTHON_INLINE int __pyx_f_4lxml_5etree__hasChild(xmlNode *__pyx_v_c_node) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;

  /* "src/lxml/apihelpers.pxi":791
 * 
 * cdef inline bint _hasChild(xmlNode* c_node) noexcept:
 *     return c_node is not NULL and _findChildForwards(c_node, 0) is not NULL             # <<<<<<<<<<<<<<
 * 
 * cdef inline Py_ssize_t _countElements(xmlNode* c_node) noexcept:
*/
  __pyx_t_2 = (__pyx_v_c_node != NULL);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L3_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_f_4lxml_5etree__findChildForwards(__pyx_v_c_node, 0) != NULL);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L3_bool_binop_done:;
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":790
 *         return python.PyBytes_FromFormat('%s:%s', c_ns.prefix, _cstr(tag))
 * 
 * cdef inline bint _hasChild(xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *     return c_node is not NULL and _findChildForwards(c_node, 0) is not NULL
 * 
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":793
 *     return c_node is not NULL and _findChildForwards(c_node, 0) is not NULL
 * 
 * cdef inline Py_ssize_t _countElements(xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *     "Counts the elements within the following siblings and the node itself."
 *     cdef Py_ssize_t count
*/

static CYTHON_INLINE Py_ssize_t __pyx_f_4lxml_5etree__countElements(xmlNode *__pyx_v_c_node) {
  Py_ssize_t __pyx_v_count;
  Py_ssize_t __pyx_r;
  int __pyx_t_1;
  xmlNode *__pyx_t_2;

  /* "src/lxml/apihelpers.pxi":796
 *     "Counts the elements within the following siblings and the node itself."
 *     cdef Py_ssize_t count
 *     count = 0             # <<<<<<<<<<<<<<
 *     while c_node is not NULL:
 *         if _isElement(c_node):
*/
  __pyx_v_count = 0;

  /* "src/lxml/apihelpers.pxi":797
 *     cdef Py_ssize_t count
 *     count = 0
 *     while c_node is not NULL:             # <<<<<<<<<<<<<<
 *         if _isElement(c_node):
 *             count += 1
*/
  while (1) {
    __pyx_t_1 = (__pyx_v_c_node != NULL);
    if (!__pyx_t_1) break;

    /* "src/lxml/apihelpers.pxi":798
 *     count = 0
 *     while c_node is not NULL:
 *         if _isElement(c_node):             # <<<<<<<<<<<<<<
 *             count += 1
 *         c_node = c_node.next
*/
    __pyx_t_1 = _isElement(__pyx_v_c_node);
    if (__pyx_t_1) {

      /* "src/lxml/apihelpers.pxi":799
 *     while c_node is not NULL:
 *         if _isElement(c_node):
 *             count += 1             # <<<<<<<<<<<<<<
 *         c_node = c_node.next
 *     return count
*/
      __pyx_v_count = (__pyx_v_count + 1);

      /* "src/lxml/apihelpers.pxi":798
 *     count = 0
 *     while c_node is not NULL:
 *         if _isElement(c_node):             # <<<<<<<<<<<<<<
 *             count += 1
 *         c_node = c_node.next
*/
    }

    /* "src/lxml/apihelpers.pxi":800
 *         if _isElement(c_node):
 *             count += 1
 *         c_node = c_node.next             # <<<<<<<<<<<<<<
 *     return count
 * 
*/
    __pyx_t_2 = __pyx_v_c_node->next;
    __pyx_v_c_node = __pyx_t_2;
  }

  /* "src/lxml/apihelpers.pxi":801
 *             count += 1
 *         c_node = c_node.next
 *     return count             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = __pyx_v_count;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":793
 *     return c_node is not NULL and _findChildForwards(c_node, 0) is not NULL
 * 
 * cdef inline Py_ssize_t _countElements(xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *     "Counts the elements within the following siblings and the node itself."
 *     cdef Py_ssize_t count
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":804
 * 
 * 
 * cdef int _findChildSlice(             # <<<<<<<<<<<<<<
 *     slice sliceobject, xmlNode* c_parent,
 *     xmlNode** c_start_node, Py_ssize_t* c_step, Py_ssize_t* c_length) except -1:
*/

static int __pyx_f_4lxml_5etree__findChildSlice(PyObject *__pyx_v_sliceobject, xmlNode *__pyx_v_c_parent, xmlNode **__pyx_v_c_start_node, Py_ssize_t *__pyx_v_c_step, Py_ssize_t *__pyx_v_c_length) {
  Py_ssize_t __pyx_v_start;
  Py_ssize_t __pyx_v_stop;
  Py_ssize_t __pyx_v_childcount;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_findChildSlice", 0);

  /* "src/lxml/apihelpers.pxi":812
 *     pointer arguments.
 *     """
 *     cdef Py_ssize_t start = 0, stop = 0, childcount             # <<<<<<<<<<<<<<
 *     childcount = _countElements(c_parent.children)
 *     if childcount == 0:
*/
  __pyx_v_start = 0;
  __pyx_v_stop = 0;

  /* "src/lxml/apihelpers.pxi":813
 *     """
 *     cdef Py_ssize_t start = 0, stop = 0, childcount
 *     childcount = _countElements(c_parent.children)             # <<<<<<<<<<<<<<
 *     if childcount == 0:
 *         c_start_node[0] = NULL
*/
  __pyx_v_childcount = __pyx_f_4lxml_5etree__countElements(__pyx_v_c_parent->children);

  /* "src/lxml/apihelpers.pxi":814
 *     cdef Py_ssize_t start = 0, stop = 0, childcount
 *     childcount = _countElements(c_parent.children)
 *     if childcount == 0:             # <<<<<<<<<<<<<<
 *         c_start_node[0] = NULL
 *         c_length[0] = 0
*/
  __pyx_t_1 = (__pyx_v_childcount == 0);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":815
 *     childcount = _countElements(c_parent.children)
 *     if childcount == 0:
 *         c_start_node[0] = NULL             # <<<<<<<<<<<<<<
 *         c_length[0] = 0
 *         if sliceobject.step is None:
*/
    (__pyx_v_c_start_node[0]) = NULL;

    /* "src/lxml/apihelpers.pxi":816
 *     if childcount == 0:
 *         c_start_node[0] = NULL
 *         c_length[0] = 0             # <<<<<<<<<<<<<<
 *         if sliceobject.step is None:
 *             c_step[0] = 1
*/
    (__pyx_v_c_length[0]) = 0;

    /* "src/lxml/apihelpers.pxi":817
 *         c_start_node[0] = NULL
 *         c_length[0] = 0
 *         if sliceobject.step is None:             # <<<<<<<<<<<<<<
 *             c_step[0] = 1
 *         else:
*/
    __pyx_t_2 = __Pyx_PySlice_Step(__pyx_v_sliceobject); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 817, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = (__pyx_t_2 == Py_None);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_1) {

      /* "src/lxml/apihelpers.pxi":818
 *         c_length[0] = 0
 *         if sliceobject.step is None:
 *             c_step[0] = 1             # <<<<<<<<<<<<<<
 *         else:
 *             python._PyEval_SliceIndex(sliceobject.step, c_step)
*/
      (__pyx_v_c_step[0]) = 1;

      /* "src/lxml/apihelpers.pxi":817
 *         c_start_node[0] = NULL
 *         c_length[0] = 0
 *         if sliceobject.step is None:             # <<<<<<<<<<<<<<
 *             c_step[0] = 1
 *         else:
*/
      goto __pyx_L4;
    }

    /* "src/lxml/apihelpers.pxi":820
 *             c_step[0] = 1
 *         else:
 *             python._PyEval_SliceIndex(sliceobject.step, c_step)             # <<<<<<<<<<<<<<
 *         return 0
 * 
*/
    /*else*/ {
      __pyx_t_2 = __Pyx_PySlice_Step(__pyx_v_sliceobject); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 820, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = _PyEval_SliceIndex(__pyx_t_2, __pyx_v_c_step); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 820, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __pyx_L4:;

    /* "src/lxml/apihelpers.pxi":821
 *         else:
 *             python._PyEval_SliceIndex(sliceobject.step, c_step)
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     python.PySlice_GetIndicesEx(
*/
    __pyx_r = 0;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":814
 *     cdef Py_ssize_t start = 0, stop = 0, childcount
 *     childcount = _countElements(c_parent.children)
 *     if childcount == 0:             # <<<<<<<<<<<<<<
 *         c_start_node[0] = NULL
 *         c_length[0] = 0
*/
  }

  /* "src/lxml/apihelpers.pxi":823
 *         return 0
 * 
 *     python.PySlice_GetIndicesEx(             # <<<<<<<<<<<<<<
 *         sliceobject, childcount, &start, &stop, c_step, c_length)
 * 
*/
  __pyx_t_3 = PySlice_GetIndicesEx(__pyx_v_sliceobject, __pyx_v_childcount, (&__pyx_v_start), (&__pyx_v_stop), __pyx_v_c_step, __pyx_v_c_length); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(4, 823, __pyx_L1_error)

  /* "src/lxml/apihelpers.pxi":826
 *         sliceobject, childcount, &start, &stop, c_step, c_length)
 * 
 *     if start > childcount // 2:             # <<<<<<<<<<<<<<
 *         c_start_node[0] = _findChildBackwards(c_parent, childcount - start - 1)
 *     else:
*/
  __pyx_t_1 = (__pyx_v_start > __Pyx_div_Py_ssize_t(__pyx_v_childcount, 2, 1));
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":827
 * 
 *     if start > childcount // 2:
 *         c_start_node[0] = _findChildBackwards(c_parent, childcount - start - 1)             # <<<<<<<<<<<<<<
 *     else:
 *         c_start_node[0] = _findChild(c_parent, start)
*/
    (__pyx_v_c_start_node[0]) = __pyx_f_4lxml_5etree__findChildBackwards(__pyx_v_c_parent, ((__pyx_v_childcount - __pyx_v_start) - 1));

    /* "src/lxml/apihelpers.pxi":826
 *         sliceobject, childcount, &start, &stop, c_step, c_length)
 * 
 *     if start > childcount // 2:             # <<<<<<<<<<<<<<
 *         c_start_node[0] = _findChildBackwards(c_parent, childcount - start - 1)
 *     else:
*/
    goto __pyx_L5;
  }

  /* "src/lxml/apihelpers.pxi":829
 *         c_start_node[0] = _findChildBackwards(c_parent, childcount - start - 1)
 *     else:
 *         c_start_node[0] = _findChild(c_parent, start)             # <<<<<<<<<<<<<<
 *     return 0
 * 
*/
  /*else*/ {
    (__pyx_v_c_start_node[0]) = __pyx_f_4lxml_5etree__findChild(__pyx_v_c_parent, __pyx_v_start);
  }
  __pyx_L5:;

  /* "src/lxml/apihelpers.pxi":830
 *     else:
 *         c_start_node[0] = _findChild(c_parent, start)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":804
 * 
 * 
 * cdef int _findChildSlice(             # <<<<<<<<<<<<<<
 *     slice sliceobject, xmlNode* c_parent,
 *     xmlNode** c_start_node, Py_ssize_t* c_step, Py_ssize_t* c_length) except -1:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._findChildSlice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":833
 * 
 * 
 * cdef bint _isFullSlice(slice sliceobject) except -1:             # <<<<<<<<<<<<<<
 *     """Conservative guess if this slice is a full slice as in ``s[:]``.
 *     """
*/

static int __pyx_f_4lxml_5etree__isFullSlice(PyObject *__pyx_v_sliceobject) {
  Py_ssize_t __pyx_v_step;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_isFullSlice", 0);

  /* "src/lxml/apihelpers.pxi":836
 *     """Conservative guess if this slice is a full slice as in ``s[:]``.
 *     """
 *     cdef Py_ssize_t step = 0             # <<<<<<<<<<<<<<
 *     if sliceobject is None:
 *         return 0
*/
  __pyx_v_step = 0;

  /* "src/lxml/apihelpers.pxi":837
 *     """
 *     cdef Py_ssize_t step = 0
 *     if sliceobject is None:             # <<<<<<<<<<<<<<
 *         return 0
 *     if sliceobject.start is None and \
*/
  __pyx_t_1 = (__pyx_v_sliceobject == ((PyObject*)Py_None));
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":838
 *     cdef Py_ssize_t step = 0
 *     if sliceobject is None:
 *         return 0             # <<<<<<<<<<<<<<
 *     if sliceobject.start is None and \
 *             sliceobject.stop is None:
*/
    __pyx_r = 0;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":837
 *     """
 *     cdef Py_ssize_t step = 0
 *     if sliceobject is None:             # <<<<<<<<<<<<<<
 *         return 0
 *     if sliceobject.start is None and \
*/
  }

  /* "src/lxml/apihelpers.pxi":839
 *     if sliceobject is None:
 *         return 0
 *     if sliceobject.start is None and \             # <<<<<<<<<<<<<<
 *             sliceobject.stop is None:
 *         if sliceobject.step is None:
*/
  __pyx_t_2 = __Pyx_PySlice_Start(__pyx_v_sliceobject); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 839, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = (__pyx_t_2 == Py_None);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L5_bool_binop_done;
  }

  /* "src/lxml/apihelpers.pxi":840
 *         return 0
 *     if sliceobject.start is None and \
 *             sliceobject.stop is None:             # <<<<<<<<<<<<<<
 *         if sliceobject.step is None:
 *             return 1
*/
  __pyx_t_2 = __Pyx_PySlice_Stop(__pyx_v_sliceobject); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 840, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = (__pyx_t_2 == Py_None);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __pyx_t_3;
  __pyx_L5_bool_binop_done:;

  /* "src/lxml/apihelpers.pxi":839
 *     if sliceobject is None:
 *         return 0
 *     if sliceobject.start is None and \             # <<<<<<<<<<<<<<
 *             sliceobject.stop is None:
 *         if sliceobject.step is None:
*/
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":841
 *     if sliceobject.start is None and \
 *             sliceobject.stop is None:
 *         if sliceobject.step is None:             # <<<<<<<<<<<<<<
 *             return 1
 *         python._PyEval_SliceIndex(sliceobject.step, &step)
*/
    __pyx_t_2 = __Pyx_PySlice_Step(__pyx_v_sliceobject); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 841, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = (__pyx_t_2 == Py_None);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_1) {

      /* "src/lxml/apihelpers.pxi":842
 *             sliceobject.stop is None:
 *         if sliceobject.step is None:
 *             return 1             # <<<<<<<<<<<<<<
 *         python._PyEval_SliceIndex(sliceobject.step, &step)
 *         if step == 1:
*/
      __pyx_r = 1;
      goto __pyx_L0;

      /* "src/lxml/apihelpers.pxi":841
 *     if sliceobject.start is None and \
 *             sliceobject.stop is None:
 *         if sliceobject.step is None:             # <<<<<<<<<<<<<<
 *             return 1
 *         python._PyEval_SliceIndex(sliceobject.step, &step)
*/
    }

    /* "src/lxml/apihelpers.pxi":843
 *         if sliceobject.step is None:
 *             return 1
 *         python._PyEval_SliceIndex(sliceobject.step, &step)             # <<<<<<<<<<<<<<
 *         if step == 1:
 *             return 1
*/
    __pyx_t_2 = __Pyx_PySlice_Step(__pyx_v_sliceobject); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 843, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = _PyEval_SliceIndex(__pyx_t_2, (&__pyx_v_step)); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(4, 843, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/apihelpers.pxi":844
 *             return 1
 *         python._PyEval_SliceIndex(sliceobject.step, &step)
 *         if step == 1:             # <<<<<<<<<<<<<<
 *             return 1
 *         return 0
*/
    __pyx_t_1 = (__pyx_v_step == 1);
    if (__pyx_t_1) {

      /* "src/lxml/apihelpers.pxi":845
 *         python._PyEval_SliceIndex(sliceobject.step, &step)
 *         if step == 1:
 *             return 1             # <<<<<<<<<<<<<<
 *         return 0
 *     return 0
*/
      __pyx_r = 1;
      goto __pyx_L0;

      /* "src/lxml/apihelpers.pxi":844
 *             return 1
 *         python._PyEval_SliceIndex(sliceobject.step, &step)
 *         if step == 1:             # <<<<<<<<<<<<<<
 *             return 1
 *         return 0
*/
    }

    /* "src/lxml/apihelpers.pxi":846
 *         if step == 1:
 *             return 1
 *         return 0             # <<<<<<<<<<<<<<
 *     return 0
 * 
*/
    __pyx_r = 0;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":839
 *     if sliceobject is None:
 *         return 0
 *     if sliceobject.start is None and \             # <<<<<<<<<<<<<<
 *             sliceobject.stop is None:
 *         if sliceobject.step is None:
*/
  }

  /* "src/lxml/apihelpers.pxi":847
 *             return 1
 *         return 0
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef _collectChildren(_Element element):
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":833
 * 
 * 
 * cdef bint _isFullSlice(slice sliceobject) except -1:             # <<<<<<<<<<<<<<
 *     """Conservative guess if this slice is a full slice as in ``s[:]``.
 *     """
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._isFullSlice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":849
 *     return 0
 * 
 * cdef _collectChildren(_Element element):             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     cdef list result = []
*/

static PyObject *__pyx_f_4lxml_5etree__collectChildren(struct LxmlElement *__pyx_v_element) {
  xmlNode *__pyx_v_c_node;
  PyObject *__pyx_v_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  xmlNode *__pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_collectChildren", 0);

  /* "src/lxml/apihelpers.pxi":851
 * cdef _collectChildren(_Element element):
 *     cdef xmlNode* c_node
 *     cdef list result = []             # <<<<<<<<<<<<<<
 *     c_node = element._c_node.children
 *     if c_node is not NULL:
*/
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 851, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_result = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/apihelpers.pxi":852
 *     cdef xmlNode* c_node
 *     cdef list result = []
 *     c_node = element._c_node.children             # <<<<<<<<<<<<<<
 *     if c_node is not NULL:
 *         if not _isElement(c_node):
*/
  __pyx_t_2 = __pyx_v_element->_c_node->children;
  __pyx_v_c_node = __pyx_t_2;

  /* "src/lxml/apihelpers.pxi":853
 *     cdef list result = []
 *     c_node = element._c_node.children
 *     if c_node is not NULL:             # <<<<<<<<<<<<<<
 *         if not _isElement(c_node):
 *             c_node = _nextElement(c_node)
*/
  __pyx_t_3 = (__pyx_v_c_node != NULL);
  if (__pyx_t_3) {

    /* "src/lxml/apihelpers.pxi":854
 *     c_node = element._c_node.children
 *     if c_node is not NULL:
 *         if not _isElement(c_node):             # <<<<<<<<<<<<<<
 *             c_node = _nextElement(c_node)
 *         while c_node is not NULL:
*/
    __pyx_t_3 = (!_isElement(__pyx_v_c_node));
    if (__pyx_t_3) {

      /* "src/lxml/apihelpers.pxi":855
 *     if c_node is not NULL:
 *         if not _isElement(c_node):
 *             c_node = _nextElement(c_node)             # <<<<<<<<<<<<<<
 *         while c_node is not NULL:
 *             result.append(_elementFactory(element._doc, c_node))
*/
      __pyx_v_c_node = __pyx_f_4lxml_5etree__nextElement(__pyx_v_c_node);

      /* "src/lxml/apihelpers.pxi":854
 *     c_node = element._c_node.children
 *     if c_node is not NULL:
 *         if not _isElement(c_node):             # <<<<<<<<<<<<<<
 *             c_node = _nextElement(c_node)
 *         while c_node is not NULL:
*/
    }

    /* "src/lxml/apihelpers.pxi":856
 *         if not _isElement(c_node):
 *             c_node = _nextElement(c_node)
 *         while c_node is not NULL:             # <<<<<<<<<<<<<<
 *             result.append(_elementFactory(element._doc, c_node))
 *             c_node = _nextElement(c_node)
*/
    while (1) {
      __pyx_t_3 = (__pyx_v_c_node != NULL);
      if (!__pyx_t_3) break;

      /* "src/lxml/apihelpers.pxi":857
 *             c_node = _nextElement(c_node)
 *         while c_node is not NULL:
 *             result.append(_elementFactory(element._doc, c_node))             # <<<<<<<<<<<<<<
 *             c_node = _nextElement(c_node)
 *     return result
*/
      __pyx_t_1 = ((PyObject *)__pyx_v_element->_doc);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_1), __pyx_v_c_node)); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 857, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_4); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(4, 857, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "src/lxml/apihelpers.pxi":858
 *         while c_node is not NULL:
 *             result.append(_elementFactory(element._doc, c_node))
 *             c_node = _nextElement(c_node)             # <<<<<<<<<<<<<<
 *     return result
 * 
*/
      __pyx_v_c_node = __pyx_f_4lxml_5etree__nextElement(__pyx_v_c_node);
    }

    /* "src/lxml/apihelpers.pxi":853
 *     cdef list result = []
 *     c_node = element._c_node.children
 *     if c_node is not NULL:             # <<<<<<<<<<<<<<
 *         if not _isElement(c_node):
 *             c_node = _nextElement(c_node)
*/
  }

  /* "src/lxml/apihelpers.pxi":859
 *             result.append(_elementFactory(element._doc, c_node))
 *             c_node = _nextElement(c_node)
 *     return result             # <<<<<<<<<<<<<<
 * 
 * cdef inline xmlNode* _findChild(xmlNode* c_node, Py_ssize_t index) noexcept:
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":849
 *     return 0
 * 
 * cdef _collectChildren(_Element element):             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     cdef list result = []
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._collectChildren", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":861
 *     return result
 * 
 * cdef inline xmlNode* _findChild(xmlNode* c_node, Py_ssize_t index) noexcept:             # <<<<<<<<<<<<<<
 *     if index < 0:
 *         return _findChildBackwards(c_node, -index - 1)
*/

static CYTHON_INLINE xmlNode *__pyx_f_4lxml_5etree__findChild(xmlNode *__pyx_v_c_node, Py_ssize_t __pyx_v_index) {
  xmlNode *__pyx_r;
  int __pyx_t_1;

  /* "src/lxml/apihelpers.pxi":862
 * 
 * cdef inline xmlNode* _findChild(xmlNode* c_node, Py_ssize_t index) noexcept:
 *     if index < 0:             # <<<<<<<<<<<<<<
 *         return _findChildBackwards(c_node, -index - 1)
 *     else:
*/
  __pyx_t_1 = (__pyx_v_index < 0);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":863
 * cdef inline xmlNode* _findChild(xmlNode* c_node, Py_ssize_t index) noexcept:
 *     if index < 0:
 *         return _findChildBackwards(c_node, -index - 1)             # <<<<<<<<<<<<<<
 *     else:
 *         return _findChildForwards(c_node, index)
*/
    __pyx_r = __pyx_f_4lxml_5etree__findChildBackwards(__pyx_v_c_node, ((-__pyx_v_index) - 1));
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":862
 * 
 * cdef inline xmlNode* _findChild(xmlNode* c_node, Py_ssize_t index) noexcept:
 *     if index < 0:             # <<<<<<<<<<<<<<
 *         return _findChildBackwards(c_node, -index - 1)
 *     else:
*/
  }

  /* "src/lxml/apihelpers.pxi":865
 *         return _findChildBackwards(c_node, -index - 1)
 *     else:
 *         return _findChildForwards(c_node, index)             # <<<<<<<<<<<<<<
 * 
 * cdef inline xmlNode* _findChildForwards(xmlNode* c_node, Py_ssize_t index) noexcept:
*/
  /*else*/ {
    __pyx_r = __pyx_f_4lxml_5etree__findChildForwards(__pyx_v_c_node, __pyx_v_index);
    goto __pyx_L0;
  }

  /* "src/lxml/apihelpers.pxi":861
 *     return result
 * 
 * cdef inline xmlNode* _findChild(xmlNode* c_node, Py_ssize_t index) noexcept:             # <<<<<<<<<<<<<<
 *     if index < 0:
 *         return _findChildBackwards(c_node, -index - 1)
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":867
 *         return _findChildForwards(c_node, index)
 * 
 * cdef inline xmlNode* _findChildForwards(xmlNode* c_node, Py_ssize_t index) noexcept:             # <<<<<<<<<<<<<<
 *     """Return child element of c_node with index, or return NULL if not found.
 *     """
*/

static CYTHON_INLINE xmlNode *__pyx_f_4lxml_5etree__findChildForwards(xmlNode *__pyx_v_c_node, Py_ssize_t __pyx_v_index) {
  xmlNode *__pyx_v_c_child;
  Py_ssize_t __pyx_v_c;
  xmlNode *__pyx_r;
  xmlNode *__pyx_t_1;
  int __pyx_t_2;

  /* "src/lxml/apihelpers.pxi":872
 *     cdef xmlNode* c_child
 *     cdef Py_ssize_t c
 *     c_child = c_node.children             # <<<<<<<<<<<<<<
 *     c = 0
 *     while c_child is not NULL:
*/
  __pyx_t_1 = __pyx_v_c_node->children;
  __pyx_v_c_child = __pyx_t_1;

  /* "src/lxml/apihelpers.pxi":873
 *     cdef Py_ssize_t c
 *     c_child = c_node.children
 *     c = 0             # <<<<<<<<<<<<<<
 *     while c_child is not NULL:
 *         if _isElement(c_child):
*/
  __pyx_v_c = 0;

  /* "src/lxml/apihelpers.pxi":874
 *     c_child = c_node.children
 *     c = 0
 *     while c_child is not NULL:             # <<<<<<<<<<<<<<
 *         if _isElement(c_child):
 *             if c == index:
*/
  while (1) {
    __pyx_t_2 = (__pyx_v_c_child != NULL);
    if (!__pyx_t_2) break;

    /* "src/lxml/apihelpers.pxi":875
 *     c = 0
 *     while c_child is not NULL:
 *         if _isElement(c_child):             # <<<<<<<<<<<<<<
 *             if c == index:
 *                 return c_child
*/
    __pyx_t_2 = _isElement(__pyx_v_c_child);
    if (__pyx_t_2) {

      /* "src/lxml/apihelpers.pxi":876
 *     while c_child is not NULL:
 *         if _isElement(c_child):
 *             if c == index:             # <<<<<<<<<<<<<<
 *                 return c_child
 *             c += 1
*/
      __pyx_t_2 = (__pyx_v_c == __pyx_v_index);
      if (__pyx_t_2) {

        /* "src/lxml/apihelpers.pxi":877
 *         if _isElement(c_child):
 *             if c == index:
 *                 return c_child             # <<<<<<<<<<<<<<
 *             c += 1
 *         c_child = c_child.next
*/
        __pyx_r = __pyx_v_c_child;
        goto __pyx_L0;

        /* "src/lxml/apihelpers.pxi":876
 *     while c_child is not NULL:
 *         if _isElement(c_child):
 *             if c == index:             # <<<<<<<<<<<<<<
 *                 return c_child
 *             c += 1
*/
      }

      /* "src/lxml/apihelpers.pxi":878
 *             if c == index:
 *                 return c_child
 *             c += 1             # <<<<<<<<<<<<<<
 *         c_child = c_child.next
 *     return NULL
*/
      __pyx_v_c = (__pyx_v_c + 1);

      /* "src/lxml/apihelpers.pxi":875
 *     c = 0
 *     while c_child is not NULL:
 *         if _isElement(c_child):             # <<<<<<<<<<<<<<
 *             if c == index:
 *                 return c_child
*/
    }

    /* "src/lxml/apihelpers.pxi":879
 *                 return c_child
 *             c += 1
 *         c_child = c_child.next             # <<<<<<<<<<<<<<
 *     return NULL
 * 
*/
    __pyx_t_1 = __pyx_v_c_child->next;
    __pyx_v_c_child = __pyx_t_1;
  }

  /* "src/lxml/apihelpers.pxi":880
 *             c += 1
 *         c_child = c_child.next
 *     return NULL             # <<<<<<<<<<<<<<
 * 
 * cdef inline xmlNode* _findChildBackwards(xmlNode* c_node, Py_ssize_t index) noexcept:
*/
  __pyx_r = NULL;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":867
 *         return _findChildForwards(c_node, index)
 * 
 * cdef inline xmlNode* _findChildForwards(xmlNode* c_node, Py_ssize_t index) noexcept:             # <<<<<<<<<<<<<<
 *     """Return child element of c_node with index, or return NULL if not found.
 *     """
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":882
 *     return NULL
 * 
 * cdef inline xmlNode* _findChildBackwards(xmlNode* c_node, Py_ssize_t index) noexcept:             # <<<<<<<<<<<<<<
 *     """Return child element of c_node with index, or return NULL if not found.
 *     Search from the end.
*/

static CYTHON_INLINE xmlNode *__pyx_f_4lxml_5etree__findChildBackwards(xmlNode *__pyx_v_c_node, Py_ssize_t __pyx_v_index) {
  xmlNode *__pyx_v_c_child;
  Py_ssize_t __pyx_v_c;
  xmlNode *__pyx_r;
  xmlNode *__pyx_t_1;
  int __pyx_t_2;

  /* "src/lxml/apihelpers.pxi":888
 *     cdef xmlNode* c_child
 *     cdef Py_ssize_t c
 *     c_child = c_node.last             # <<<<<<<<<<<<<<
 *     c = 0
 *     while c_child is not NULL:
*/
  __pyx_t_1 = __pyx_v_c_node->last;
  __pyx_v_c_child = __pyx_t_1;

  /* "src/lxml/apihelpers.pxi":889
 *     cdef Py_ssize_t c
 *     c_child = c_node.last
 *     c = 0             # <<<<<<<<<<<<<<
 *     while c_child is not NULL:
 *         if _isElement(c_child):
*/
  __pyx_v_c = 0;

  /* "src/lxml/apihelpers.pxi":890
 *     c_child = c_node.last
 *     c = 0
 *     while c_child is not NULL:             # <<<<<<<<<<<<<<
 *         if _isElement(c_child):
 *             if c == index:
*/
  while (1) {
    __pyx_t_2 = (__pyx_v_c_child != NULL);
    if (!__pyx_t_2) break;

    /* "src/lxml/apihelpers.pxi":891
 *     c = 0
 *     while c_child is not NULL:
 *         if _isElement(c_child):             # <<<<<<<<<<<<<<
 *             if c == index:
 *                 return c_child
*/
    __pyx_t_2 = _isElement(__pyx_v_c_child);
    if (__pyx_t_2) {

      /* "src/lxml/apihelpers.pxi":892
 *     while c_child is not NULL:
 *         if _isElement(c_child):
 *             if c == index:             # <<<<<<<<<<<<<<
 *                 return c_child
 *             c += 1
*/
      __pyx_t_2 = (__pyx_v_c == __pyx_v_index);
      if (__pyx_t_2) {

        /* "src/lxml/apihelpers.pxi":893
 *         if _isElement(c_child):
 *             if c == index:
 *                 return c_child             # <<<<<<<<<<<<<<
 *             c += 1
 *         c_child = c_child.prev
*/
        __pyx_r = __pyx_v_c_child;
        goto __pyx_L0;

        /* "src/lxml/apihelpers.pxi":892
 *     while c_child is not NULL:
 *         if _isElement(c_child):
 *             if c == index:             # <<<<<<<<<<<<<<
 *                 return c_child
 *             c += 1
*/
      }

      /* "src/lxml/apihelpers.pxi":894
 *             if c == index:
 *                 return c_child
 *             c += 1             # <<<<<<<<<<<<<<
 *         c_child = c_child.prev
 *     return NULL
*/
      __pyx_v_c = (__pyx_v_c + 1);

      /* "src/lxml/apihelpers.pxi":891
 *     c = 0
 *     while c_child is not NULL:
 *         if _isElement(c_child):             # <<<<<<<<<<<<<<
 *             if c == index:
 *                 return c_child
*/
    }

    /* "src/lxml/apihelpers.pxi":895
 *                 return c_child
 *             c += 1
 *         c_child = c_child.prev             # <<<<<<<<<<<<<<
 *     return NULL
 * 
*/
    __pyx_t_1 = __pyx_v_c_child->prev;
    __pyx_v_c_child = __pyx_t_1;
  }

  /* "src/lxml/apihelpers.pxi":896
 *             c += 1
 *         c_child = c_child.prev
 *     return NULL             # <<<<<<<<<<<<<<
 * 
 * cdef inline xmlNode* _textNodeOrSkip(xmlNode* c_node) noexcept nogil:
*/
  __pyx_r = NULL;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":882
 *     return NULL
 * 
 * cdef inline xmlNode* _findChildBackwards(xmlNode* c_node, Py_ssize_t index) noexcept:             # <<<<<<<<<<<<<<
 *     """Return child element of c_node with index, or return NULL if not found.
 *     Search from the end.
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":898
 *     return NULL
 * 
 * cdef inline xmlNode* _textNodeOrSkip(xmlNode* c_node) noexcept nogil:             # <<<<<<<<<<<<<<
 *     """Return the node if it's a text node.  Skip over ignorable nodes in a
 *     series of text nodes.  Return NULL if a non-ignorable node is found.
*/

static CYTHON_INLINE xmlNode *__pyx_f_4lxml_5etree__textNodeOrSkip(xmlNode *__pyx_v_c_node) {
  xmlNode *__pyx_r;
  int __pyx_t_1;
  xmlNode *__pyx_t_2;

  /* "src/lxml/apihelpers.pxi":905
 *     nodes.
 *     """
 *     while c_node is not NULL:             # <<<<<<<<<<<<<<
 *         if c_node.type == tree.XML_TEXT_NODE or \
 *                c_node.type == tree.XML_CDATA_SECTION_NODE:
*/
  while (1) {
    __pyx_t_1 = (__pyx_v_c_node != NULL);
    if (!__pyx_t_1) break;

    /* "src/lxml/apihelpers.pxi":906
 *     """
 *     while c_node is not NULL:
 *         if c_node.type == tree.XML_TEXT_NODE or \             # <<<<<<<<<<<<<<
 *                c_node.type == tree.XML_CDATA_SECTION_NODE:
 *             return c_node
*/
    switch (__pyx_v_c_node->type) {
      case XML_TEXT_NODE:
      case XML_CDATA_SECTION_NODE:

      /* "src/lxml/apihelpers.pxi":908
 *         if c_node.type == tree.XML_TEXT_NODE or \
 *                c_node.type == tree.XML_CDATA_SECTION_NODE:
 *             return c_node             # <<<<<<<<<<<<<<
 *         elif c_node.type == tree.XML_XINCLUDE_START or \
 *                  c_node.type == tree.XML_XINCLUDE_END:
*/
      __pyx_r = __pyx_v_c_node;
      goto __pyx_L0;

      /* "src/lxml/apihelpers.pxi":906
 *     """
 *     while c_node is not NULL:
 *         if c_node.type == tree.XML_TEXT_NODE or \             # <<<<<<<<<<<<<<
 *                c_node.type == tree.XML_CDATA_SECTION_NODE:
 *             return c_node
*/
      break;
      case XML_XINCLUDE_START:

      /* "src/lxml/apihelpers.pxi":909
 *                c_node.type == tree.XML_CDATA_SECTION_NODE:
 *             return c_node
 *         elif c_node.type == tree.XML_XINCLUDE_START or \             # <<<<<<<<<<<<<<
 *                  c_node.type == tree.XML_XINCLUDE_END:
 *             c_node = c_node.next
*/
      case XML_XINCLUDE_END:

      /* "src/lxml/apihelpers.pxi":911
 *         elif c_node.type == tree.XML_XINCLUDE_START or \
 *                  c_node.type == tree.XML_XINCLUDE_END:
 *             c_node = c_node.next             # <<<<<<<<<<<<<<
 *         else:
 *             return NULL
*/
      __pyx_t_2 = __pyx_v_c_node->next;
      __pyx_v_c_node = __pyx_t_2;

      /* "src/lxml/apihelpers.pxi":909
 *                c_node.type == tree.XML_CDATA_SECTION_NODE:
 *             return c_node
 *         elif c_node.type == tree.XML_XINCLUDE_START or \             # <<<<<<<<<<<<<<
 *                  c_node.type == tree.XML_XINCLUDE_END:
 *             c_node = c_node.next
*/
      break;
      default:

      /* "src/lxml/apihelpers.pxi":913
 *             c_node = c_node.next
 *         else:
 *             return NULL             # <<<<<<<<<<<<<<
 *     return NULL
 * 
*/
      __pyx_r = NULL;
      goto __pyx_L0;
      break;
    }
  }

  /* "src/lxml/apihelpers.pxi":914
 *         else:
 *             return NULL
 *     return NULL             # <<<<<<<<<<<<<<
 * 
 * cdef inline xmlNode* _nextElement(xmlNode* c_node) noexcept:
*/
  __pyx_r = NULL;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":898
 *     return NULL
 * 
 * cdef inline xmlNode* _textNodeOrSkip(xmlNode* c_node) noexcept nogil:             # <<<<<<<<<<<<<<
 *     """Return the node if it's a text node.  Skip over ignorable nodes in a
 *     series of text nodes.  Return NULL if a non-ignorable node is found.
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":916
 *     return NULL
 * 
 * cdef inline xmlNode* _nextElement(xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *     """Given a node, find the next sibling that is an element.
 *     """
*/

static CYTHON_INLINE xmlNode *__pyx_f_4lxml_5etree__nextElement(xmlNode *__pyx_v_c_node) {
  xmlNode *__pyx_r;
  int __pyx_t_1;
  xmlNode *__pyx_t_2;

  /* "src/lxml/apihelpers.pxi":919
 *     """Given a node, find the next sibling that is an element.
 *     """
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         return NULL
 *     c_node = c_node.next
*/
  __pyx_t_1 = (__pyx_v_c_node == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":920
 *     """
 *     if c_node is NULL:
 *         return NULL             # <<<<<<<<<<<<<<
 *     c_node = c_node.next
 *     while c_node is not NULL:
*/
    __pyx_r = NULL;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":919
 *     """Given a node, find the next sibling that is an element.
 *     """
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         return NULL
 *     c_node = c_node.next
*/
  }

  /* "src/lxml/apihelpers.pxi":921
 *     if c_node is NULL:
 *         return NULL
 *     c_node = c_node.next             # <<<<<<<<<<<<<<
 *     while c_node is not NULL:
 *         if _isElement(c_node):
*/
  __pyx_t_2 = __pyx_v_c_node->next;
  __pyx_v_c_node = __pyx_t_2;

  /* "src/lxml/apihelpers.pxi":922
 *         return NULL
 *     c_node = c_node.next
 *     while c_node is not NULL:             # <<<<<<<<<<<<<<
 *         if _isElement(c_node):
 *             return c_node
*/
  while (1) {
    __pyx_t_1 = (__pyx_v_c_node != NULL);
    if (!__pyx_t_1) break;

    /* "src/lxml/apihelpers.pxi":923
 *     c_node = c_node.next
 *     while c_node is not NULL:
 *         if _isElement(c_node):             # <<<<<<<<<<<<<<
 *             return c_node
 *         c_node = c_node.next
*/
    __pyx_t_1 = _isElement(__pyx_v_c_node);
    if (__pyx_t_1) {

      /* "src/lxml/apihelpers.pxi":924
 *     while c_node is not NULL:
 *         if _isElement(c_node):
 *             return c_node             # <<<<<<<<<<<<<<
 *         c_node = c_node.next
 *     return NULL
*/
      __pyx_r = __pyx_v_c_node;
      goto __pyx_L0;

      /* "src/lxml/apihelpers.pxi":923
 *     c_node = c_node.next
 *     while c_node is not NULL:
 *         if _isElement(c_node):             # <<<<<<<<<<<<<<
 *             return c_node
 *         c_node = c_node.next
*/
    }

    /* "src/lxml/apihelpers.pxi":925
 *         if _isElement(c_node):
 *             return c_node
 *         c_node = c_node.next             # <<<<<<<<<<<<<<
 *     return NULL
 * 
*/
    __pyx_t_2 = __pyx_v_c_node->next;
    __pyx_v_c_node = __pyx_t_2;
  }

  /* "src/lxml/apihelpers.pxi":926
 *             return c_node
 *         c_node = c_node.next
 *     return NULL             # <<<<<<<<<<<<<<
 * 
 * cdef inline xmlNode* _previousElement(xmlNode* c_node) noexcept:
*/
  __pyx_r = NULL;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":916
 *     return NULL
 * 
 * cdef inline xmlNode* _nextElement(xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *     """Given a node, find the next sibling that is an element.
 *     """
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":928
 *     return NULL
 * 
 * cdef inline xmlNode* _previousElement(xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *     """Given a node, find the next sibling that is an element.
 *     """
*/

static CYTHON_INLINE xmlNode *__pyx_f_4lxml_5etree__previousElement(xmlNode *__pyx_v_c_node) {
  xmlNode *__pyx_r;
  int __pyx_t_1;
  xmlNode *__pyx_t_2;

  /* "src/lxml/apihelpers.pxi":931
 *     """Given a node, find the next sibling that is an element.
 *     """
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         return NULL
 *     c_node = c_node.prev
*/
  __pyx_t_1 = (__pyx_v_c_node == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":932
 *     """
 *     if c_node is NULL:
 *         return NULL             # <<<<<<<<<<<<<<
 *     c_node = c_node.prev
 *     while c_node is not NULL:
*/
    __pyx_r = NULL;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":931
 *     """Given a node, find the next sibling that is an element.
 *     """
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         return NULL
 *     c_node = c_node.prev
*/
  }

  /* "src/lxml/apihelpers.pxi":933
 *     if c_node is NULL:
 *         return NULL
 *     c_node = c_node.prev             # <<<<<<<<<<<<<<
 *     while c_node is not NULL:
 *         if _isElement(c_node):
*/
  __pyx_t_2 = __pyx_v_c_node->prev;
  __pyx_v_c_node = __pyx_t_2;

  /* "src/lxml/apihelpers.pxi":934
 *         return NULL
 *     c_node = c_node.prev
 *     while c_node is not NULL:             # <<<<<<<<<<<<<<
 *         if _isElement(c_node):
 *             return c_node
*/
  while (1) {
    __pyx_t_1 = (__pyx_v_c_node != NULL);
    if (!__pyx_t_1) break;

    /* "src/lxml/apihelpers.pxi":935
 *     c_node = c_node.prev
 *     while c_node is not NULL:
 *         if _isElement(c_node):             # <<<<<<<<<<<<<<
 *             return c_node
 *         c_node = c_node.prev
*/
    __pyx_t_1 = _isElement(__pyx_v_c_node);
    if (__pyx_t_1) {

      /* "src/lxml/apihelpers.pxi":936
 *     while c_node is not NULL:
 *         if _isElement(c_node):
 *             return c_node             # <<<<<<<<<<<<<<
 *         c_node = c_node.prev
 *     return NULL
*/
      __pyx_r = __pyx_v_c_node;
      goto __pyx_L0;

      /* "src/lxml/apihelpers.pxi":935
 *     c_node = c_node.prev
 *     while c_node is not NULL:
 *         if _isElement(c_node):             # <<<<<<<<<<<<<<
 *             return c_node
 *         c_node = c_node.prev
*/
    }

    /* "src/lxml/apihelpers.pxi":937
 *         if _isElement(c_node):
 *             return c_node
 *         c_node = c_node.prev             # <<<<<<<<<<<<<<
 *     return NULL
 * 
*/
    __pyx_t_2 = __pyx_v_c_node->prev;
    __pyx_v_c_node = __pyx_t_2;
  }

  /* "src/lxml/apihelpers.pxi":938
 *             return c_node
 *         c_node = c_node.prev
 *     return NULL             # <<<<<<<<<<<<<<
 * 
 * cdef inline xmlNode* _parentElement(xmlNode* c_node) noexcept:
*/
  __pyx_r = NULL;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":928
 *     return NULL
 * 
 * cdef inline xmlNode* _previousElement(xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *     """Given a node, find the next sibling that is an element.
 *     """
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":940
 *     return NULL
 * 
 * cdef inline xmlNode* _parentElement(xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *     "Given a node, find the parent element."
 *     if c_node is NULL or not _isElement(c_node):
*/

static CYTHON_INLINE xmlNode *__pyx_f_4lxml_5etree__parentElement(xmlNode *__pyx_v_c_node) {
  xmlNode *__pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  xmlNode *__pyx_t_3;

  /* "src/lxml/apihelpers.pxi":942
 * cdef inline xmlNode* _parentElement(xmlNode* c_node) noexcept:
 *     "Given a node, find the parent element."
 *     if c_node is NULL or not _isElement(c_node):             # <<<<<<<<<<<<<<
 *         return NULL
 *     c_node = c_node.parent
*/
  __pyx_t_2 = (__pyx_v_c_node == NULL);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (!_isElement(__pyx_v_c_node));
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":943
 *     "Given a node, find the parent element."
 *     if c_node is NULL or not _isElement(c_node):
 *         return NULL             # <<<<<<<<<<<<<<
 *     c_node = c_node.parent
 *     if c_node is NULL or not _isElement(c_node):
*/
    __pyx_r = NULL;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":942
 * cdef inline xmlNode* _parentElement(xmlNode* c_node) noexcept:
 *     "Given a node, find the parent element."
 *     if c_node is NULL or not _isElement(c_node):             # <<<<<<<<<<<<<<
 *         return NULL
 *     c_node = c_node.parent
*/
  }

  /* "src/lxml/apihelpers.pxi":944
 *     if c_node is NULL or not _isElement(c_node):
 *         return NULL
 *     c_node = c_node.parent             # <<<<<<<<<<<<<<
 *     if c_node is NULL or not _isElement(c_node):
 *         return NULL
*/
  __pyx_t_3 = __pyx_v_c_node->parent;
  __pyx_v_c_node = __pyx_t_3;

  /* "src/lxml/apihelpers.pxi":945
 *         return NULL
 *     c_node = c_node.parent
 *     if c_node is NULL or not _isElement(c_node):             # <<<<<<<<<<<<<<
 *         return NULL
 *     return c_node
*/
  __pyx_t_2 = (__pyx_v_c_node == NULL);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L7_bool_binop_done;
  }
  __pyx_t_2 = (!_isElement(__pyx_v_c_node));
  __pyx_t_1 = __pyx_t_2;
  __pyx_L7_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":946
 *     c_node = c_node.parent
 *     if c_node is NULL or not _isElement(c_node):
 *         return NULL             # <<<<<<<<<<<<<<
 *     return c_node
 * 
*/
    __pyx_r = NULL;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":945
 *         return NULL
 *     c_node = c_node.parent
 *     if c_node is NULL or not _isElement(c_node):             # <<<<<<<<<<<<<<
 *         return NULL
 *     return c_node
*/
  }

  /* "src/lxml/apihelpers.pxi":947
 *     if c_node is NULL or not _isElement(c_node):
 *         return NULL
 *     return c_node             # <<<<<<<<<<<<<<
 * 
 * cdef inline bint _tagMatches(xmlNode* c_node, const_xmlChar* c_href, const_xmlChar* c_name) noexcept:
*/
  __pyx_r = __pyx_v_c_node;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":940
 *     return NULL
 * 
 * cdef inline xmlNode* _parentElement(xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *     "Given a node, find the parent element."
 *     if c_node is NULL or not _isElement(c_node):
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":949
 *     return c_node
 * 
 * cdef inline bint _tagMatches(xmlNode* c_node, const_xmlChar* c_href, const_xmlChar* c_name) noexcept:             # <<<<<<<<<<<<<<
 *     """Tests if the node matches namespace URI and tag name.
 * 
*/

static CYTHON_INLINE int __pyx_f_4lxml_5etree__tagMatches(xmlNode *__pyx_v_c_node, const xmlChar *__pyx_v_c_href, const xmlChar *__pyx_v_c_name) {
  const xmlChar *__pyx_v_c_node_href;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;

  /* "src/lxml/apihelpers.pxi":963
 *     * its name string equals the c_name string
 *     """
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         return 0
 *     if c_node.type != tree.XML_ELEMENT_NODE:
*/
  __pyx_t_1 = (__pyx_v_c_node == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":964
 *     """
 *     if c_node is NULL:
 *         return 0             # <<<<<<<<<<<<<<
 *     if c_node.type != tree.XML_ELEMENT_NODE:
 *         # not an element, only succeed if we match everything
*/
    __pyx_r = 0;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":963
 *     * its name string equals the c_name string
 *     """
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         return 0
 *     if c_node.type != tree.XML_ELEMENT_NODE:
*/
  }

  /* "src/lxml/apihelpers.pxi":965
 *     if c_node is NULL:
 *         return 0
 *     if c_node.type != tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         # not an element, only succeed if we match everything
 *         return c_name is NULL and c_href is NULL
*/
  __pyx_t_1 = (__pyx_v_c_node->type != XML_ELEMENT_NODE);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":967
 *     if c_node.type != tree.XML_ELEMENT_NODE:
 *         # not an element, only succeed if we match everything
 *         return c_name is NULL and c_href is NULL             # <<<<<<<<<<<<<<
 *     if c_name is NULL:
 *         if c_href is NULL:
*/
    __pyx_t_2 = (__pyx_v_c_name == NULL);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_2 = (__pyx_v_c_href == NULL);
    __pyx_t_1 = __pyx_t_2;
    __pyx_L5_bool_binop_done:;
    __pyx_r = __pyx_t_1;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":965
 *     if c_node is NULL:
 *         return 0
 *     if c_node.type != tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         # not an element, only succeed if we match everything
 *         return c_name is NULL and c_href is NULL
*/
  }

  /* "src/lxml/apihelpers.pxi":968
 *         # not an element, only succeed if we match everything
 *         return c_name is NULL and c_href is NULL
 *     if c_name is NULL:             # <<<<<<<<<<<<<<
 *         if c_href is NULL:
 *             # always match
*/
  __pyx_t_1 = (__pyx_v_c_name == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":969
 *         return c_name is NULL and c_href is NULL
 *     if c_name is NULL:
 *         if c_href is NULL:             # <<<<<<<<<<<<<<
 *             # always match
 *             return 1
*/
    __pyx_t_1 = (__pyx_v_c_href == NULL);
    if (__pyx_t_1) {

      /* "src/lxml/apihelpers.pxi":971
 *         if c_href is NULL:
 *             # always match
 *             return 1             # <<<<<<<<<<<<<<
 *         else:
 *             c_node_href = _getNs(c_node)
*/
      __pyx_r = 1;
      goto __pyx_L0;

      /* "src/lxml/apihelpers.pxi":969
 *         return c_name is NULL and c_href is NULL
 *     if c_name is NULL:
 *         if c_href is NULL:             # <<<<<<<<<<<<<<
 *             # always match
 *             return 1
*/
    }

    /* "src/lxml/apihelpers.pxi":973
 *             return 1
 *         else:
 *             c_node_href = _getNs(c_node)             # <<<<<<<<<<<<<<
 *             if c_node_href is NULL:
 *                 return c_href[0] == c'\0'
*/
    /*else*/ {
      __pyx_v_c_node_href = _getNs(__pyx_v_c_node);

      /* "src/lxml/apihelpers.pxi":974
 *         else:
 *             c_node_href = _getNs(c_node)
 *             if c_node_href is NULL:             # <<<<<<<<<<<<<<
 *                 return c_href[0] == c'\0'
 *             else:
*/
      __pyx_t_1 = (__pyx_v_c_node_href == NULL);
      if (__pyx_t_1) {

        /* "src/lxml/apihelpers.pxi":975
 *             c_node_href = _getNs(c_node)
 *             if c_node_href is NULL:
 *                 return c_href[0] == c'\0'             # <<<<<<<<<<<<<<
 *             else:
 *                 return tree.xmlStrcmp(c_node_href, c_href) == 0
*/
        __pyx_r = ((__pyx_v_c_href[0]) == '\x00');
        goto __pyx_L0;

        /* "src/lxml/apihelpers.pxi":974
 *         else:
 *             c_node_href = _getNs(c_node)
 *             if c_node_href is NULL:             # <<<<<<<<<<<<<<
 *                 return c_href[0] == c'\0'
 *             else:
*/
      }

      /* "src/lxml/apihelpers.pxi":977
 *                 return c_href[0] == c'\0'
 *             else:
 *                 return tree.xmlStrcmp(c_node_href, c_href) == 0             # <<<<<<<<<<<<<<
 *     elif c_href is NULL:
 *         if _getNs(c_node) is not NULL:
*/
      /*else*/ {
        __pyx_r = (xmlStrcmp(__pyx_v_c_node_href, __pyx_v_c_href) == 0);
        goto __pyx_L0;
      }
    }

    /* "src/lxml/apihelpers.pxi":968
 *         # not an element, only succeed if we match everything
 *         return c_name is NULL and c_href is NULL
 *     if c_name is NULL:             # <<<<<<<<<<<<<<
 *         if c_href is NULL:
 *             # always match
*/
  }

  /* "src/lxml/apihelpers.pxi":978
 *             else:
 *                 return tree.xmlStrcmp(c_node_href, c_href) == 0
 *     elif c_href is NULL:             # <<<<<<<<<<<<<<
 *         if _getNs(c_node) is not NULL:
 *             return 0
*/
  __pyx_t_1 = (__pyx_v_c_href == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":979
 *                 return tree.xmlStrcmp(c_node_href, c_href) == 0
 *     elif c_href is NULL:
 *         if _getNs(c_node) is not NULL:             # <<<<<<<<<<<<<<
 *             return 0
 *         return c_node.name == c_name or tree.xmlStrcmp(c_node.name, c_name) == 0
*/
    __pyx_t_1 = (_getNs(__pyx_v_c_node) != NULL);
    if (__pyx_t_1) {

      /* "src/lxml/apihelpers.pxi":980
 *     elif c_href is NULL:
 *         if _getNs(c_node) is not NULL:
 *             return 0             # <<<<<<<<<<<<<<
 *         return c_node.name == c_name or tree.xmlStrcmp(c_node.name, c_name) == 0
 *     elif c_node.name == c_name or tree.xmlStrcmp(c_node.name, c_name) == 0:
*/
      __pyx_r = 0;
      goto __pyx_L0;

      /* "src/lxml/apihelpers.pxi":979
 *                 return tree.xmlStrcmp(c_node_href, c_href) == 0
 *     elif c_href is NULL:
 *         if _getNs(c_node) is not NULL:             # <<<<<<<<<<<<<<
 *             return 0
 *         return c_node.name == c_name or tree.xmlStrcmp(c_node.name, c_name) == 0
*/
    }

    /* "src/lxml/apihelpers.pxi":981
 *         if _getNs(c_node) is not NULL:
 *             return 0
 *         return c_node.name == c_name or tree.xmlStrcmp(c_node.name, c_name) == 0             # <<<<<<<<<<<<<<
 *     elif c_node.name == c_name or tree.xmlStrcmp(c_node.name, c_name) == 0:
 *         c_node_href = _getNs(c_node)
*/
    __pyx_t_2 = (__pyx_v_c_node->name == __pyx_v_c_name);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L11_bool_binop_done;
    }
    __pyx_t_2 = (xmlStrcmp(__pyx_v_c_node->name, __pyx_v_c_name) == 0);
    __pyx_t_1 = __pyx_t_2;
    __pyx_L11_bool_binop_done:;
    __pyx_r = __pyx_t_1;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":978
 *             else:
 *                 return tree.xmlStrcmp(c_node_href, c_href) == 0
 *     elif c_href is NULL:             # <<<<<<<<<<<<<<
 *         if _getNs(c_node) is not NULL:
 *             return 0
*/
  }

  /* "src/lxml/apihelpers.pxi":982
 *             return 0
 *         return c_node.name == c_name or tree.xmlStrcmp(c_node.name, c_name) == 0
 *     elif c_node.name == c_name or tree.xmlStrcmp(c_node.name, c_name) == 0:             # <<<<<<<<<<<<<<
 *         c_node_href = _getNs(c_node)
 *         if c_node_href is NULL:
*/
  __pyx_t_2 = (__pyx_v_c_node->name == __pyx_v_c_name);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L13_bool_binop_done;
  }
  __pyx_t_2 = (xmlStrcmp(__pyx_v_c_node->name, __pyx_v_c_name) == 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L13_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":983
 *         return c_node.name == c_name or tree.xmlStrcmp(c_node.name, c_name) == 0
 *     elif c_node.name == c_name or tree.xmlStrcmp(c_node.name, c_name) == 0:
 *         c_node_href = _getNs(c_node)             # <<<<<<<<<<<<<<
 *         if c_node_href is NULL:
 *             return c_href[0] == c'\0'
*/
    __pyx_v_c_node_href = _getNs(__pyx_v_c_node);

    /* "src/lxml/apihelpers.pxi":984
 *     elif c_node.name == c_name or tree.xmlStrcmp(c_node.name, c_name) == 0:
 *         c_node_href = _getNs(c_node)
 *         if c_node_href is NULL:             # <<<<<<<<<<<<<<
 *             return c_href[0] == c'\0'
 *         else:
*/
    __pyx_t_1 = (__pyx_v_c_node_href == NULL);
    if (__pyx_t_1) {

      /* "src/lxml/apihelpers.pxi":985
 *         c_node_href = _getNs(c_node)
 *         if c_node_href is NULL:
 *             return c_href[0] == c'\0'             # <<<<<<<<<<<<<<
 *         else:
 *             return tree.xmlStrcmp(c_node_href, c_href) == 0
*/
      __pyx_r = ((__pyx_v_c_href[0]) == '\x00');
      goto __pyx_L0;

      /* "src/lxml/apihelpers.pxi":984
 *     elif c_node.name == c_name or tree.xmlStrcmp(c_node.name, c_name) == 0:
 *         c_node_href = _getNs(c_node)
 *         if c_node_href is NULL:             # <<<<<<<<<<<<<<
 *             return c_href[0] == c'\0'
 *         else:
*/
    }

    /* "src/lxml/apihelpers.pxi":987
 *             return c_href[0] == c'\0'
 *         else:
 *             return tree.xmlStrcmp(c_node_href, c_href) == 0             # <<<<<<<<<<<<<<
 *     else:
 *         return 0
*/
    /*else*/ {
      __pyx_r = (xmlStrcmp(__pyx_v_c_node_href, __pyx_v_c_href) == 0);
      goto __pyx_L0;
    }

    /* "src/lxml/apihelpers.pxi":982
 *             return 0
 *         return c_node.name == c_name or tree.xmlStrcmp(c_node.name, c_name) == 0
 *     elif c_node.name == c_name or tree.xmlStrcmp(c_node.name, c_name) == 0:             # <<<<<<<<<<<<<<
 *         c_node_href = _getNs(c_node)
 *         if c_node_href is NULL:
*/
  }

  /* "src/lxml/apihelpers.pxi":989
 *             return tree.xmlStrcmp(c_node_href, c_href) == 0
 *     else:
 *         return 0             # <<<<<<<<<<<<<<
 * 
 * cdef inline bint _tagMatchesExactly(xmlNode* c_node, qname* c_qname) noexcept:
*/
  /*else*/ {
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "src/lxml/apihelpers.pxi":949
 *     return c_node
 * 
 * cdef inline bint _tagMatches(xmlNode* c_node, const_xmlChar* c_href, const_xmlChar* c_name) noexcept:             # <<<<<<<<<<<<<<
 *     """Tests if the node matches namespace URI and tag name.
 * 
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":991
 *         return 0
 * 
 * cdef inline bint _tagMatchesExactly(xmlNode* c_node, qname* c_qname) noexcept:             # <<<<<<<<<<<<<<
 *     """Tests if the node matches namespace URI and tag name.
 * 
*/

static CYTHON_INLINE int __pyx_f_4lxml_5etree__tagMatchesExactly(xmlNode *__pyx_v_c_node, struct __pyx_t_4lxml_5etree_qname *__pyx_v_c_qname) {
  int __pyx_r;

  /* "src/lxml/apihelpers.pxi":1009
 *     * its name string points to the same address (!) as c_name
 *     """
 *     return _nsTagMatchesExactly(_getNs(c_node), c_node.name, c_qname)             # <<<<<<<<<<<<<<
 * 
 * cdef inline bint _nsTagMatchesExactly(const_xmlChar* c_node_href,
*/
  __pyx_r = __pyx_f_4lxml_5etree__nsTagMatchesExactly(_getNs(__pyx_v_c_node), __pyx_v_c_node->name, __pyx_v_c_qname);
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":991
 *         return 0
 * 
 * cdef inline bint _tagMatchesExactly(xmlNode* c_node, qname* c_qname) noexcept:             # <<<<<<<<<<<<<<
 *     """Tests if the node matches namespace URI and tag name.
 * 
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":1011
 *     return _nsTagMatchesExactly(_getNs(c_node), c_node.name, c_qname)
 * 
 * cdef inline bint _nsTagMatchesExactly(const_xmlChar* c_node_href,             # <<<<<<<<<<<<<<
 *                                       const_xmlChar* c_node_name,
 *                                       qname* c_qname) noexcept:
*/

static CYTHON_INLINE int __pyx_f_4lxml_5etree__nsTagMatchesExactly(const xmlChar *__pyx_v_c_node_href, const xmlChar *__pyx_v_c_node_name, struct __pyx_t_4lxml_5etree_qname *__pyx_v_c_qname) {
  char *__pyx_v_c_href;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;

  /* "src/lxml/apihelpers.pxi":1032
 *     """
 *     cdef char* c_href
 *     if c_qname.c_name is not NULL and c_qname.c_name is not c_node_name:             # <<<<<<<<<<<<<<
 *         return 0
 *     if c_qname.href is NULL:
*/
  __pyx_t_2 = (__pyx_v_c_qname->c_name != NULL);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_c_qname->c_name != __pyx_v_c_node_name);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":1033
 *     cdef char* c_href
 *     if c_qname.c_name is not NULL and c_qname.c_name is not c_node_name:
 *         return 0             # <<<<<<<<<<<<<<
 *     if c_qname.href is NULL:
 *         return 1
*/
    __pyx_r = 0;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":1032
 *     """
 *     cdef char* c_href
 *     if c_qname.c_name is not NULL and c_qname.c_name is not c_node_name:             # <<<<<<<<<<<<<<
 *         return 0
 *     if c_qname.href is NULL:
*/
  }

  /* "src/lxml/apihelpers.pxi":1034
 *     if c_qname.c_name is not NULL and c_qname.c_name is not c_node_name:
 *         return 0
 *     if c_qname.href is NULL:             # <<<<<<<<<<<<<<
 *         return 1
 *     c_href = python.__cstr(c_qname.href)
*/
  __pyx_t_1 = (__pyx_v_c_qname->href == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":1035
 *         return 0
 *     if c_qname.href is NULL:
 *         return 1             # <<<<<<<<<<<<<<
 *     c_href = python.__cstr(c_qname.href)
 *     if c_href[0] == b'\0':
*/
    __pyx_r = 1;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":1034
 *     if c_qname.c_name is not NULL and c_qname.c_name is not c_node_name:
 *         return 0
 *     if c_qname.href is NULL:             # <<<<<<<<<<<<<<
 *         return 1
 *     c_href = python.__cstr(c_qname.href)
*/
  }

  /* "src/lxml/apihelpers.pxi":1036
 *     if c_qname.href is NULL:
 *         return 1
 *     c_href = python.__cstr(c_qname.href)             # <<<<<<<<<<<<<<
 *     if c_href[0] == b'\0':
 *         return c_node_href is NULL or c_node_href[0] == b'\0'
*/
  __pyx_v_c_href = PyBytes_AS_STRING(__pyx_v_c_qname->href);

  /* "src/lxml/apihelpers.pxi":1037
 *         return 1
 *     c_href = python.__cstr(c_qname.href)
 *     if c_href[0] == b'\0':             # <<<<<<<<<<<<<<
 *         return c_node_href is NULL or c_node_href[0] == b'\0'
 *     elif c_node_href is NULL:
*/
  __pyx_t_1 = ((__pyx_v_c_href[0]) == '\x00');
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":1038
 *     c_href = python.__cstr(c_qname.href)
 *     if c_href[0] == b'\0':
 *         return c_node_href is NULL or c_node_href[0] == b'\0'             # <<<<<<<<<<<<<<
 *     elif c_node_href is NULL:
 *         return 0
*/
    __pyx_t_2 = (__pyx_v_c_node_href == NULL);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L8_bool_binop_done;
    }
    __pyx_t_2 = ((__pyx_v_c_node_href[0]) == '\x00');
    __pyx_t_1 = __pyx_t_2;
    __pyx_L8_bool_binop_done:;
    __pyx_r = __pyx_t_1;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":1037
 *         return 1
 *     c_href = python.__cstr(c_qname.href)
 *     if c_href[0] == b'\0':             # <<<<<<<<<<<<<<
 *         return c_node_href is NULL or c_node_href[0] == b'\0'
 *     elif c_node_href is NULL:
*/
  }

  /* "src/lxml/apihelpers.pxi":1039
 *     if c_href[0] == b'\0':
 *         return c_node_href is NULL or c_node_href[0] == b'\0'
 *     elif c_node_href is NULL:             # <<<<<<<<<<<<<<
 *         return 0
 *     else:
*/
  __pyx_t_1 = (__pyx_v_c_node_href == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":1040
 *         return c_node_href is NULL or c_node_href[0] == b'\0'
 *     elif c_node_href is NULL:
 *         return 0             # <<<<<<<<<<<<<<
 *     else:
 *         return tree.xmlStrcmp(<const_xmlChar*>c_href, c_node_href) == 0
*/
    __pyx_r = 0;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":1039
 *     if c_href[0] == b'\0':
 *         return c_node_href is NULL or c_node_href[0] == b'\0'
 *     elif c_node_href is NULL:             # <<<<<<<<<<<<<<
 *         return 0
 *     else:
*/
  }

  /* "src/lxml/apihelpers.pxi":1042
 *         return 0
 *     else:
 *         return tree.xmlStrcmp(<const_xmlChar*>c_href, c_node_href) == 0             # <<<<<<<<<<<<<<
 * 
 * cdef Py_ssize_t _mapTagsToQnameMatchArray(xmlDoc* c_doc, list ns_tags,
*/
  /*else*/ {
    __pyx_r = (xmlStrcmp(((const xmlChar *)__pyx_v_c_href), __pyx_v_c_node_href) == 0);
    goto __pyx_L0;
  }

  /* "src/lxml/apihelpers.pxi":1011
 *     return _nsTagMatchesExactly(_getNs(c_node), c_node.name, c_qname)
 * 
 * cdef inline bint _nsTagMatchesExactly(const_xmlChar* c_node_href,             # <<<<<<<<<<<<<<
 *                                       const_xmlChar* c_node_name,
 *                                       qname* c_qname) noexcept:
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":1044
 *         return tree.xmlStrcmp(<const_xmlChar*>c_href, c_node_href) == 0
 * 
 * cdef Py_ssize_t _mapTagsToQnameMatchArray(xmlDoc* c_doc, list ns_tags,             # <<<<<<<<<<<<<<
 *                                           qname* c_ns_tags, bint force_into_dict) except -1:
 *     """Map a sequence of (name, namespace) pairs to a qname array for efficient
*/

static Py_ssize_t __pyx_f_4lxml_5etree__mapTagsToQnameMatchArray(xmlDoc *__pyx_v_c_doc, PyObject *__pyx_v_ns_tags, struct __pyx_t_4lxml_5etree_qname *__pyx_v_c_ns_tags, int __pyx_v_force_into_dict) {
  Py_ssize_t __pyx_v_count;
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_c_tag_len;
  PyObject *__pyx_v_ns = 0;
  PyObject *__pyx_v_tag = 0;
  const xmlChar *__pyx_v_c_tag;
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  int __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_mapTagsToQnameMatchArray", 0);

  /* "src/lxml/apihelpers.pxi":1052
 *     if it is not NULL.
 *     """
 *     cdef Py_ssize_t count = 0, i, c_tag_len             # <<<<<<<<<<<<<<
 *     cdef bytes ns, tag
 *     cdef const_xmlChar* c_tag
*/
  __pyx_v_count = 0;

  /* "src/lxml/apihelpers.pxi":1056
 *     cdef const_xmlChar* c_tag
 * 
 *     for ns, tag in ns_tags:             # <<<<<<<<<<<<<<
 *         if tag is None:
 *             c_tag = <const_xmlChar*> NULL
*/
  if (unlikely(__pyx_v_ns_tags == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(4, 1056, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_v_ns_tags; __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = 0;
  for (;;) {
    {
      Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
      #if !CYTHON_ASSUME_SAFE_SIZE
      if (unlikely((__pyx_temp < 0))) __PYX_ERR(4, 1056, __pyx_L1_error)
      #endif
      if (__pyx_t_2 >= __pyx_temp) break;
    }
    __pyx_t_3 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference);
    ++__pyx_t_2;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 1056, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
      PyObject* sequence = __pyx_t_3;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(4, 1056, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
        __Pyx_INCREF(__pyx_t_4);
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1);
        __Pyx_INCREF(__pyx_t_5);
      } else {
        __pyx_t_4 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 1056, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_4);
        __pyx_t_5 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 1056, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_5);
      }
      #else
      __pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 1056, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 1056, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      #endif
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 1056, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_6);
      index = 0; __pyx_t_4 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < (0)) __PYX_ERR(4, 1056, __pyx_L1_error)
      __pyx_t_7 = NULL;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L6_unpacking_done;
      __pyx_L5_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_7 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(4, 1056, __pyx_L1_error)
      __pyx_L6_unpacking_done:;
    }
    if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_4))) __PYX_ERR(4, 1056, __pyx_L1_error)
    if (!(likely(PyBytes_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_5))) __PYX_ERR(4, 1056, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_ns, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;
    __Pyx_XDECREF_SET(__pyx_v_tag, ((PyObject*)__pyx_t_5));
    __pyx_t_5 = 0;

    /* "src/lxml/apihelpers.pxi":1057
 * 
 *     for ns, tag in ns_tags:
 *         if tag is None:             # <<<<<<<<<<<<<<
 *             c_tag = <const_xmlChar*> NULL
 *         else:
*/
    __pyx_t_8 = (__pyx_v_tag == ((PyObject*)Py_None));
    if (__pyx_t_8) {

      /* "src/lxml/apihelpers.pxi":1058
 *     for ns, tag in ns_tags:
 *         if tag is None:
 *             c_tag = <const_xmlChar*> NULL             # <<<<<<<<<<<<<<
 *         else:
 *             c_tag_len = len(tag)
*/
      __pyx_v_c_tag = ((const xmlChar *)NULL);

      /* "src/lxml/apihelpers.pxi":1057
 * 
 *     for ns, tag in ns_tags:
 *         if tag is None:             # <<<<<<<<<<<<<<
 *             c_tag = <const_xmlChar*> NULL
 *         else:
*/
      goto __pyx_L7;
    }

    /* "src/lxml/apihelpers.pxi":1060
 *             c_tag = <const_xmlChar*> NULL
 *         else:
 *             c_tag_len = len(tag)             # <<<<<<<<<<<<<<
 *             if c_tag_len > limits.INT_MAX:
 *                 # too long, not in the dict => not in the document
*/
    /*else*/ {
      if (unlikely(__pyx_v_tag == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
        __PYX_ERR(4, 1060, __pyx_L1_error)
      }
      __pyx_t_9 = __Pyx_PyBytes_GET_SIZE(__pyx_v_tag); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(4, 1060, __pyx_L1_error)
      __pyx_v_c_tag_len = __pyx_t_9;

      /* "src/lxml/apihelpers.pxi":1061
 *         else:
 *             c_tag_len = len(tag)
 *             if c_tag_len > limits.INT_MAX:             # <<<<<<<<<<<<<<
 *                 # too long, not in the dict => not in the document
 *                 continue
*/
      __pyx_t_8 = (__pyx_v_c_tag_len > INT_MAX);
      if (__pyx_t_8) {

        /* "src/lxml/apihelpers.pxi":1063
 *             if c_tag_len > limits.INT_MAX:
 *                 # too long, not in the dict => not in the document
 *                 continue             # <<<<<<<<<<<<<<
 *             elif force_into_dict:
 *                 c_tag = tree.xmlDictLookup(c_doc.dict, _xcstr(tag), <int> c_tag_len)
*/
        goto __pyx_L3_continue;

        /* "src/lxml/apihelpers.pxi":1061
 *         else:
 *             c_tag_len = len(tag)
 *             if c_tag_len > limits.INT_MAX:             # <<<<<<<<<<<<<<
 *                 # too long, not in the dict => not in the document
 *                 continue
*/
      }

      /* "src/lxml/apihelpers.pxi":1064
 *                 # too long, not in the dict => not in the document
 *                 continue
 *             elif force_into_dict:             # <<<<<<<<<<<<<<
 *                 c_tag = tree.xmlDictLookup(c_doc.dict, _xcstr(tag), <int> c_tag_len)
 *                 if c_tag is NULL:
*/
      if (__pyx_v_force_into_dict) {

        /* "src/lxml/apihelpers.pxi":1065
 *                 continue
 *             elif force_into_dict:
 *                 c_tag = tree.xmlDictLookup(c_doc.dict, _xcstr(tag), <int> c_tag_len)             # <<<<<<<<<<<<<<
 *                 if c_tag is NULL:
 *                     # clean up before raising the error
*/
        __pyx_v_c_tag = xmlDictLookup(__pyx_v_c_doc->dict, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_tag), ((int)__pyx_v_c_tag_len));

        /* "src/lxml/apihelpers.pxi":1066
 *             elif force_into_dict:
 *                 c_tag = tree.xmlDictLookup(c_doc.dict, _xcstr(tag), <int> c_tag_len)
 *                 if c_tag is NULL:             # <<<<<<<<<<<<<<
 *                     # clean up before raising the error
 *                     for i in xrange(count):
*/
        __pyx_t_8 = (__pyx_v_c_tag == NULL);
        if (__pyx_t_8) {

          /* "src/lxml/apihelpers.pxi":1068
 *                 if c_tag is NULL:
 *                     # clean up before raising the error
 *                     for i in xrange(count):             # <<<<<<<<<<<<<<
 *                         cpython.ref.Py_XDECREF(c_ns_tags[i].href)
 *                     raise MemoryError()
*/
          __pyx_t_9 = __pyx_v_count;
          __pyx_t_10 = __pyx_t_9;
          for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
            __pyx_v_i = __pyx_t_11;

            /* "src/lxml/apihelpers.pxi":1069
 *                     # clean up before raising the error
 *                     for i in xrange(count):
 *                         cpython.ref.Py_XDECREF(c_ns_tags[i].href)             # <<<<<<<<<<<<<<
 *                     raise MemoryError()
 *             else:
*/
            Py_XDECREF((__pyx_v_c_ns_tags[__pyx_v_i]).href);
          }

          /* "src/lxml/apihelpers.pxi":1070
 *                     for i in xrange(count):
 *                         cpython.ref.Py_XDECREF(c_ns_tags[i].href)
 *                     raise MemoryError()             # <<<<<<<<<<<<<<
 *             else:
 *                 c_tag = tree.xmlDictExists(c_doc.dict, _xcstr(tag), <int> c_tag_len)
*/
          PyErr_NoMemory(); __PYX_ERR(4, 1070, __pyx_L1_error)

          /* "src/lxml/apihelpers.pxi":1066
 *             elif force_into_dict:
 *                 c_tag = tree.xmlDictLookup(c_doc.dict, _xcstr(tag), <int> c_tag_len)
 *                 if c_tag is NULL:             # <<<<<<<<<<<<<<
 *                     # clean up before raising the error
 *                     for i in xrange(count):
*/
        }

        /* "src/lxml/apihelpers.pxi":1064
 *                 # too long, not in the dict => not in the document
 *                 continue
 *             elif force_into_dict:             # <<<<<<<<<<<<<<
 *                 c_tag = tree.xmlDictLookup(c_doc.dict, _xcstr(tag), <int> c_tag_len)
 *                 if c_tag is NULL:
*/
        goto __pyx_L8;
      }

      /* "src/lxml/apihelpers.pxi":1072
 *                     raise MemoryError()
 *             else:
 *                 c_tag = tree.xmlDictExists(c_doc.dict, _xcstr(tag), <int> c_tag_len)             # <<<<<<<<<<<<<<
 *                 if c_tag is NULL:
 *                     # not in the dict => not in the document
*/
      /*else*/ {
        __pyx_v_c_tag = xmlDictExists(__pyx_v_c_doc->dict, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_tag), ((int)__pyx_v_c_tag_len));

        /* "src/lxml/apihelpers.pxi":1073
 *             else:
 *                 c_tag = tree.xmlDictExists(c_doc.dict, _xcstr(tag), <int> c_tag_len)
 *                 if c_tag is NULL:             # <<<<<<<<<<<<<<
 *                     # not in the dict => not in the document
 *                     continue
*/
        __pyx_t_8 = (__pyx_v_c_tag == NULL);
        if (__pyx_t_8) {

          /* "src/lxml/apihelpers.pxi":1075
 *                 if c_tag is NULL:
 *                     # not in the dict => not in the document
 *                     continue             # <<<<<<<<<<<<<<
 * 
 *         c_ns_tags[count].c_name = c_tag
*/
          goto __pyx_L3_continue;

          /* "src/lxml/apihelpers.pxi":1073
 *             else:
 *                 c_tag = tree.xmlDictExists(c_doc.dict, _xcstr(tag), <int> c_tag_len)
 *                 if c_tag is NULL:             # <<<<<<<<<<<<<<
 *                     # not in the dict => not in the document
 *                     continue
*/
        }
      }
      __pyx_L8:;
    }
    __pyx_L7:;

    /* "src/lxml/apihelpers.pxi":1077
 *                     continue
 * 
 *         c_ns_tags[count].c_name = c_tag             # <<<<<<<<<<<<<<
 *         if ns is None:
 *             c_ns_tags[count].href = NULL
*/
    (__pyx_v_c_ns_tags[__pyx_v_count]).c_name = __pyx_v_c_tag;

    /* "src/lxml/apihelpers.pxi":1078
 * 
 *         c_ns_tags[count].c_name = c_tag
 *         if ns is None:             # <<<<<<<<<<<<<<
 *             c_ns_tags[count].href = NULL
 *         else:
*/
    __pyx_t_8 = (__pyx_v_ns == ((PyObject*)Py_None));
    if (__pyx_t_8) {

      /* "src/lxml/apihelpers.pxi":1079
 *         c_ns_tags[count].c_name = c_tag
 *         if ns is None:
 *             c_ns_tags[count].href = NULL             # <<<<<<<<<<<<<<
 *         else:
 *             cpython.ref.Py_INCREF(ns) # keep an owned reference!
*/
      (__pyx_v_c_ns_tags[__pyx_v_count]).href = NULL;

      /* "src/lxml/apihelpers.pxi":1078
 * 
 *         c_ns_tags[count].c_name = c_tag
 *         if ns is None:             # <<<<<<<<<<<<<<
 *             c_ns_tags[count].href = NULL
 *         else:
*/
      goto __pyx_L13;
    }

    /* "src/lxml/apihelpers.pxi":1081
 *             c_ns_tags[count].href = NULL
 *         else:
 *             cpython.ref.Py_INCREF(ns) # keep an owned reference!             # <<<<<<<<<<<<<<
 *             c_ns_tags[count].href = <python.PyObject*>ns
 *         count += 1
*/
    /*else*/ {
      Py_INCREF(__pyx_v_ns);

      /* "src/lxml/apihelpers.pxi":1082
 *         else:
 *             cpython.ref.Py_INCREF(ns) # keep an owned reference!
 *             c_ns_tags[count].href = <python.PyObject*>ns             # <<<<<<<<<<<<<<
 *         count += 1
 *     return count
*/
      (__pyx_v_c_ns_tags[__pyx_v_count]).href = ((PyObject *)__pyx_v_ns);
    }
    __pyx_L13:;

    /* "src/lxml/apihelpers.pxi":1083
 *             cpython.ref.Py_INCREF(ns) # keep an owned reference!
 *             c_ns_tags[count].href = <python.PyObject*>ns
 *         count += 1             # <<<<<<<<<<<<<<
 *     return count
 * 
*/
    __pyx_v_count = (__pyx_v_count + 1);

    /* "src/lxml/apihelpers.pxi":1056
 *     cdef const_xmlChar* c_tag
 * 
 *     for ns, tag in ns_tags:             # <<<<<<<<<<<<<<
 *         if tag is None:
 *             c_tag = <const_xmlChar*> NULL
*/
    __pyx_L3_continue:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/apihelpers.pxi":1084
 *             c_ns_tags[count].href = <python.PyObject*>ns
 *         count += 1
 *     return count             # <<<<<<<<<<<<<<
 * 
 * cdef int _removeNode(_Document doc, xmlNode* c_node) except -1:
*/
  __pyx_r = __pyx_v_count;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1044
 *         return tree.xmlStrcmp(<const_xmlChar*>c_href, c_node_href) == 0
 * 
 * cdef Py_ssize_t _mapTagsToQnameMatchArray(xmlDoc* c_doc, list ns_tags,             # <<<<<<<<<<<<<<
 *                                           qname* c_ns_tags, bint force_into_dict) except -1:
 *     """Map a sequence of (name, namespace) pairs to a qname array for efficient
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._mapTagsToQnameMatchArray", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1L;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ns);
  __Pyx_XDECREF(__pyx_v_tag);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":1086
 *     return count
 * 
 * cdef int _removeNode(_Document doc, xmlNode* c_node) except -1:             # <<<<<<<<<<<<<<
 *     """Unlink and free a node and subnodes if possible.  Otherwise, make sure
 *     it's self-contained.
*/

static int __pyx_f_4lxml_5etree__removeNode(struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_node) {
  xmlNode *__pyx_v_c_next;
  int __pyx_r;
  xmlNode *__pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/apihelpers.pxi":1091
 *     """
 *     cdef xmlNode* c_next
 *     c_next = c_node.next             # <<<<<<<<<<<<<<
 *     tree.xmlUnlinkNode(c_node)
 *     _moveTail(c_next, c_node)
*/
  __pyx_t_1 = __pyx_v_c_node->next;
  __pyx_v_c_next = __pyx_t_1;

  /* "src/lxml/apihelpers.pxi":1092
 *     cdef xmlNode* c_next
 *     c_next = c_node.next
 *     tree.xmlUnlinkNode(c_node)             # <<<<<<<<<<<<<<
 *     _moveTail(c_next, c_node)
 *     if not attemptDeallocation(c_node):
*/
  xmlUnlinkNode(__pyx_v_c_node);

  /* "src/lxml/apihelpers.pxi":1093
 *     c_next = c_node.next
 *     tree.xmlUnlinkNode(c_node)
 *     _moveTail(c_next, c_node)             # <<<<<<<<<<<<<<
 *     if not attemptDeallocation(c_node):
 *         # make namespaces absolute
*/
  __pyx_f_4lxml_5etree__moveTail(__pyx_v_c_next, __pyx_v_c_node);

  /* "src/lxml/apihelpers.pxi":1094
 *     tree.xmlUnlinkNode(c_node)
 *     _moveTail(c_next, c_node)
 *     if not attemptDeallocation(c_node):             # <<<<<<<<<<<<<<
 *         # make namespaces absolute
 *         moveNodeToDocument(doc, c_node.doc, c_node)
*/
  __pyx_t_2 = (!(__pyx_f_4lxml_5etree_attemptDeallocation(__pyx_v_c_node) != 0));
  if (__pyx_t_2) {

    /* "src/lxml/apihelpers.pxi":1096
 *     if not attemptDeallocation(c_node):
 *         # make namespaces absolute
 *         moveNodeToDocument(doc, c_node.doc, c_node)             # <<<<<<<<<<<<<<
 *     return 0
 * 
*/
    __pyx_t_3 = __pyx_f_4lxml_5etree_moveNodeToDocument(__pyx_v_doc, __pyx_v_c_node->doc, __pyx_v_c_node); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(4, 1096, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":1094
 *     tree.xmlUnlinkNode(c_node)
 *     _moveTail(c_next, c_node)
 *     if not attemptDeallocation(c_node):             # <<<<<<<<<<<<<<
 *         # make namespaces absolute
 *         moveNodeToDocument(doc, c_node.doc, c_node)
*/
  }

  /* "src/lxml/apihelpers.pxi":1097
 *         # make namespaces absolute
 *         moveNodeToDocument(doc, c_node.doc, c_node)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int _removeSiblings(xmlNode* c_element, tree.xmlElementType node_type, bint with_tail) except -1:
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1086
 *     return count
 * 
 * cdef int _removeNode(_Document doc, xmlNode* c_node) except -1:             # <<<<<<<<<<<<<<
 *     """Unlink and free a node and subnodes if possible.  Otherwise, make sure
 *     it's self-contained.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._removeNode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":1099
 *     return 0
 * 
 * cdef int _removeSiblings(xmlNode* c_element, tree.xmlElementType node_type, bint with_tail) except -1:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     cdef xmlNode* c_next
*/

static int __pyx_f_4lxml_5etree__removeSiblings(xmlNode *__pyx_v_c_element, xmlElementType __pyx_v_node_type, int __pyx_v_with_tail) {
  xmlNode *__pyx_v_c_node;
  xmlNode *__pyx_v_c_next;
  int __pyx_r;
  xmlNode *__pyx_t_1;
  int __pyx_t_2;

  /* "src/lxml/apihelpers.pxi":1102
 *     cdef xmlNode* c_node
 *     cdef xmlNode* c_next
 *     c_node = c_element.next             # <<<<<<<<<<<<<<
 *     while c_node is not NULL:
 *         c_next = _nextElement(c_node)
*/
  __pyx_t_1 = __pyx_v_c_element->next;
  __pyx_v_c_node = __pyx_t_1;

  /* "src/lxml/apihelpers.pxi":1103
 *     cdef xmlNode* c_next
 *     c_node = c_element.next
 *     while c_node is not NULL:             # <<<<<<<<<<<<<<
 *         c_next = _nextElement(c_node)
 *         if c_node.type == node_type:
*/
  while (1) {
    __pyx_t_2 = (__pyx_v_c_node != NULL);
    if (!__pyx_t_2) break;

    /* "src/lxml/apihelpers.pxi":1104
 *     c_node = c_element.next
 *     while c_node is not NULL:
 *         c_next = _nextElement(c_node)             # <<<<<<<<<<<<<<
 *         if c_node.type == node_type:
 *             if with_tail:
*/
    __pyx_v_c_next = __pyx_f_4lxml_5etree__nextElement(__pyx_v_c_node);

    /* "src/lxml/apihelpers.pxi":1105
 *     while c_node is not NULL:
 *         c_next = _nextElement(c_node)
 *         if c_node.type == node_type:             # <<<<<<<<<<<<<<
 *             if with_tail:
 *                 _removeText(c_node.next)
*/
    __pyx_t_2 = (__pyx_v_c_node->type == __pyx_v_node_type);
    if (__pyx_t_2) {

      /* "src/lxml/apihelpers.pxi":1106
 *         c_next = _nextElement(c_node)
 *         if c_node.type == node_type:
 *             if with_tail:             # <<<<<<<<<<<<<<
 *                 _removeText(c_node.next)
 *             tree.xmlUnlinkNode(c_node)
*/
      if (__pyx_v_with_tail) {

        /* "src/lxml/apihelpers.pxi":1107
 *         if c_node.type == node_type:
 *             if with_tail:
 *                 _removeText(c_node.next)             # <<<<<<<<<<<<<<
 *             tree.xmlUnlinkNode(c_node)
 *             attemptDeallocation(c_node)
*/
        __pyx_f_4lxml_5etree__removeText(__pyx_v_c_node->next);

        /* "src/lxml/apihelpers.pxi":1106
 *         c_next = _nextElement(c_node)
 *         if c_node.type == node_type:
 *             if with_tail:             # <<<<<<<<<<<<<<
 *                 _removeText(c_node.next)
 *             tree.xmlUnlinkNode(c_node)
*/
      }

      /* "src/lxml/apihelpers.pxi":1108
 *             if with_tail:
 *                 _removeText(c_node.next)
 *             tree.xmlUnlinkNode(c_node)             # <<<<<<<<<<<<<<
 *             attemptDeallocation(c_node)
 *         c_node = c_next
*/
      xmlUnlinkNode(__pyx_v_c_node);

      /* "src/lxml/apihelpers.pxi":1109
 *                 _removeText(c_node.next)
 *             tree.xmlUnlinkNode(c_node)
 *             attemptDeallocation(c_node)             # <<<<<<<<<<<<<<
 *         c_node = c_next
 *     c_node = c_element.prev
*/
      (void)(__pyx_f_4lxml_5etree_attemptDeallocation(__pyx_v_c_node));

      /* "src/lxml/apihelpers.pxi":1105
 *     while c_node is not NULL:
 *         c_next = _nextElement(c_node)
 *         if c_node.type == node_type:             # <<<<<<<<<<<<<<
 *             if with_tail:
 *                 _removeText(c_node.next)
*/
    }

    /* "src/lxml/apihelpers.pxi":1110
 *             tree.xmlUnlinkNode(c_node)
 *             attemptDeallocation(c_node)
 *         c_node = c_next             # <<<<<<<<<<<<<<
 *     c_node = c_element.prev
 *     while c_node is not NULL:
*/
    __pyx_v_c_node = __pyx_v_c_next;
  }

  /* "src/lxml/apihelpers.pxi":1111
 *             attemptDeallocation(c_node)
 *         c_node = c_next
 *     c_node = c_element.prev             # <<<<<<<<<<<<<<
 *     while c_node is not NULL:
 *         c_next = _previousElement(c_node)
*/
  __pyx_t_1 = __pyx_v_c_element->prev;
  __pyx_v_c_node = __pyx_t_1;

  /* "src/lxml/apihelpers.pxi":1112
 *         c_node = c_next
 *     c_node = c_element.prev
 *     while c_node is not NULL:             # <<<<<<<<<<<<<<
 *         c_next = _previousElement(c_node)
 *         if c_node.type == node_type:
*/
  while (1) {
    __pyx_t_2 = (__pyx_v_c_node != NULL);
    if (!__pyx_t_2) break;

    /* "src/lxml/apihelpers.pxi":1113
 *     c_node = c_element.prev
 *     while c_node is not NULL:
 *         c_next = _previousElement(c_node)             # <<<<<<<<<<<<<<
 *         if c_node.type == node_type:
 *             if with_tail:
*/
    __pyx_v_c_next = __pyx_f_4lxml_5etree__previousElement(__pyx_v_c_node);

    /* "src/lxml/apihelpers.pxi":1114
 *     while c_node is not NULL:
 *         c_next = _previousElement(c_node)
 *         if c_node.type == node_type:             # <<<<<<<<<<<<<<
 *             if with_tail:
 *                 _removeText(c_node.next)
*/
    __pyx_t_2 = (__pyx_v_c_node->type == __pyx_v_node_type);
    if (__pyx_t_2) {

      /* "src/lxml/apihelpers.pxi":1115
 *         c_next = _previousElement(c_node)
 *         if c_node.type == node_type:
 *             if with_tail:             # <<<<<<<<<<<<<<
 *                 _removeText(c_node.next)
 *             tree.xmlUnlinkNode(c_node)
*/
      if (__pyx_v_with_tail) {

        /* "src/lxml/apihelpers.pxi":1116
 *         if c_node.type == node_type:
 *             if with_tail:
 *                 _removeText(c_node.next)             # <<<<<<<<<<<<<<
 *             tree.xmlUnlinkNode(c_node)
 *             attemptDeallocation(c_node)
*/
        __pyx_f_4lxml_5etree__removeText(__pyx_v_c_node->next);

        /* "src/lxml/apihelpers.pxi":1115
 *         c_next = _previousElement(c_node)
 *         if c_node.type == node_type:
 *             if with_tail:             # <<<<<<<<<<<<<<
 *                 _removeText(c_node.next)
 *             tree.xmlUnlinkNode(c_node)
*/
      }

      /* "src/lxml/apihelpers.pxi":1117
 *             if with_tail:
 *                 _removeText(c_node.next)
 *             tree.xmlUnlinkNode(c_node)             # <<<<<<<<<<<<<<
 *             attemptDeallocation(c_node)
 *         c_node = c_next
*/
      xmlUnlinkNode(__pyx_v_c_node);

      /* "src/lxml/apihelpers.pxi":1118
 *                 _removeText(c_node.next)
 *             tree.xmlUnlinkNode(c_node)
 *             attemptDeallocation(c_node)             # <<<<<<<<<<<<<<
 *         c_node = c_next
 *     return 0
*/
      (void)(__pyx_f_4lxml_5etree_attemptDeallocation(__pyx_v_c_node));

      /* "src/lxml/apihelpers.pxi":1114
 *     while c_node is not NULL:
 *         c_next = _previousElement(c_node)
 *         if c_node.type == node_type:             # <<<<<<<<<<<<<<
 *             if with_tail:
 *                 _removeText(c_node.next)
*/
    }

    /* "src/lxml/apihelpers.pxi":1119
 *             tree.xmlUnlinkNode(c_node)
 *             attemptDeallocation(c_node)
 *         c_node = c_next             # <<<<<<<<<<<<<<
 *     return 0
 * 
*/
    __pyx_v_c_node = __pyx_v_c_next;
  }

  /* "src/lxml/apihelpers.pxi":1120
 *             attemptDeallocation(c_node)
 *         c_node = c_next
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef void _moveTail(xmlNode* c_tail, xmlNode* c_target) noexcept:
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1099
 *     return 0
 * 
 * cdef int _removeSiblings(xmlNode* c_element, tree.xmlElementType node_type, bint with_tail) except -1:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     cdef xmlNode* c_next
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":1122
 *     return 0
 * 
 * cdef void _moveTail(xmlNode* c_tail, xmlNode* c_target) noexcept:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_next
 *     # tail support: look for any text nodes trailing this node and
*/

static void __pyx_f_4lxml_5etree__moveTail(xmlNode *__pyx_v_c_tail, xmlNode *__pyx_v_c_target) {
  xmlNode *__pyx_v_c_next;
  int __pyx_t_1;

  /* "src/lxml/apihelpers.pxi":1126
 *     # tail support: look for any text nodes trailing this node and
 *     # move them too
 *     c_tail = _textNodeOrSkip(c_tail)             # <<<<<<<<<<<<<<
 *     while c_tail is not NULL:
 *         c_next = _textNodeOrSkip(c_tail.next)
*/
  __pyx_v_c_tail = __pyx_f_4lxml_5etree__textNodeOrSkip(__pyx_v_c_tail);

  /* "src/lxml/apihelpers.pxi":1127
 *     # move them too
 *     c_tail = _textNodeOrSkip(c_tail)
 *     while c_tail is not NULL:             # <<<<<<<<<<<<<<
 *         c_next = _textNodeOrSkip(c_tail.next)
 *         c_target = tree.xmlAddNextSibling(c_target, c_tail)
*/
  while (1) {
    __pyx_t_1 = (__pyx_v_c_tail != NULL);
    if (!__pyx_t_1) break;

    /* "src/lxml/apihelpers.pxi":1128
 *     c_tail = _textNodeOrSkip(c_tail)
 *     while c_tail is not NULL:
 *         c_next = _textNodeOrSkip(c_tail.next)             # <<<<<<<<<<<<<<
 *         c_target = tree.xmlAddNextSibling(c_target, c_tail)
 *         c_tail = c_next
*/
    __pyx_v_c_next = __pyx_f_4lxml_5etree__textNodeOrSkip(__pyx_v_c_tail->next);

    /* "src/lxml/apihelpers.pxi":1129
 *     while c_tail is not NULL:
 *         c_next = _textNodeOrSkip(c_tail.next)
 *         c_target = tree.xmlAddNextSibling(c_target, c_tail)             # <<<<<<<<<<<<<<
 *         c_tail = c_next
 * 
*/
    __pyx_v_c_target = xmlAddNextSibling(__pyx_v_c_target, __pyx_v_c_tail);

    /* "src/lxml/apihelpers.pxi":1130
 *         c_next = _textNodeOrSkip(c_tail.next)
 *         c_target = tree.xmlAddNextSibling(c_target, c_tail)
 *         c_tail = c_next             # <<<<<<<<<<<<<<
 * 
 * cdef int _copyTail(xmlNode* c_tail, xmlNode* c_target) except -1:
*/
    __pyx_v_c_tail = __pyx_v_c_next;
  }

  /* "src/lxml/apihelpers.pxi":1122
 *     return 0
 * 
 * cdef void _moveTail(xmlNode* c_tail, xmlNode* c_target) noexcept:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_next
 *     # tail support: look for any text nodes trailing this node and
*/

  /* function exit code */
}

/* "src/lxml/apihelpers.pxi":1132
 *         c_tail = c_next
 * 
 * cdef int _copyTail(xmlNode* c_tail, xmlNode* c_target) except -1:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_new_tail
 *     # tail copying support: look for any text nodes trailing this node and
*/

static int __pyx_f_4lxml_5etree__copyTail(xmlNode *__pyx_v_c_tail, xmlNode *__pyx_v_c_target) {
  xmlNode *__pyx_v_c_new_tail;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/apihelpers.pxi":1136
 *     # tail copying support: look for any text nodes trailing this node and
 *     # copy it to the target node
 *     c_tail = _textNodeOrSkip(c_tail)             # <<<<<<<<<<<<<<
 *     while c_tail is not NULL:
 *         if c_target.doc is not c_tail.doc:
*/
  __pyx_v_c_tail = __pyx_f_4lxml_5etree__textNodeOrSkip(__pyx_v_c_tail);

  /* "src/lxml/apihelpers.pxi":1137
 *     # copy it to the target node
 *     c_tail = _textNodeOrSkip(c_tail)
 *     while c_tail is not NULL:             # <<<<<<<<<<<<<<
 *         if c_target.doc is not c_tail.doc:
 *             c_new_tail = tree.xmlDocCopyNode(c_tail, c_target.doc, 0)
*/
  while (1) {
    __pyx_t_1 = (__pyx_v_c_tail != NULL);
    if (!__pyx_t_1) break;

    /* "src/lxml/apihelpers.pxi":1138
 *     c_tail = _textNodeOrSkip(c_tail)
 *     while c_tail is not NULL:
 *         if c_target.doc is not c_tail.doc:             # <<<<<<<<<<<<<<
 *             c_new_tail = tree.xmlDocCopyNode(c_tail, c_target.doc, 0)
 *         else:
*/
    __pyx_t_1 = (__pyx_v_c_target->doc != __pyx_v_c_tail->doc);
    if (__pyx_t_1) {

      /* "src/lxml/apihelpers.pxi":1139
 *     while c_tail is not NULL:
 *         if c_target.doc is not c_tail.doc:
 *             c_new_tail = tree.xmlDocCopyNode(c_tail, c_target.doc, 0)             # <<<<<<<<<<<<<<
 *         else:
 *             c_new_tail = tree.xmlCopyNode(c_tail, 0)
*/
      __pyx_v_c_new_tail = xmlDocCopyNode(__pyx_v_c_tail, __pyx_v_c_target->doc, 0);

      /* "src/lxml/apihelpers.pxi":1138
 *     c_tail = _textNodeOrSkip(c_tail)
 *     while c_tail is not NULL:
 *         if c_target.doc is not c_tail.doc:             # <<<<<<<<<<<<<<
 *             c_new_tail = tree.xmlDocCopyNode(c_tail, c_target.doc, 0)
 *         else:
*/
      goto __pyx_L5;
    }

    /* "src/lxml/apihelpers.pxi":1141
 *             c_new_tail = tree.xmlDocCopyNode(c_tail, c_target.doc, 0)
 *         else:
 *             c_new_tail = tree.xmlCopyNode(c_tail, 0)             # <<<<<<<<<<<<<<
 *         if c_new_tail is NULL:
 *             raise MemoryError()
*/
    /*else*/ {
      __pyx_v_c_new_tail = xmlCopyNode(__pyx_v_c_tail, 0);
    }
    __pyx_L5:;

    /* "src/lxml/apihelpers.pxi":1142
 *         else:
 *             c_new_tail = tree.xmlCopyNode(c_tail, 0)
 *         if c_new_tail is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 *         c_target = tree.xmlAddNextSibling(c_target, c_new_tail)
*/
    __pyx_t_1 = (__pyx_v_c_new_tail == NULL);
    if (unlikely(__pyx_t_1)) {

      /* "src/lxml/apihelpers.pxi":1143
 *             c_new_tail = tree.xmlCopyNode(c_tail, 0)
 *         if c_new_tail is NULL:
 *             raise MemoryError()             # <<<<<<<<<<<<<<
 *         c_target = tree.xmlAddNextSibling(c_target, c_new_tail)
 *         c_tail = _textNodeOrSkip(c_tail.next)
*/
      PyErr_NoMemory(); __PYX_ERR(4, 1143, __pyx_L1_error)

      /* "src/lxml/apihelpers.pxi":1142
 *         else:
 *             c_new_tail = tree.xmlCopyNode(c_tail, 0)
 *         if c_new_tail is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 *         c_target = tree.xmlAddNextSibling(c_target, c_new_tail)
*/
    }

    /* "src/lxml/apihelpers.pxi":1144
 *         if c_new_tail is NULL:
 *             raise MemoryError()
 *         c_target = tree.xmlAddNextSibling(c_target, c_new_tail)             # <<<<<<<<<<<<<<
 *         c_tail = _textNodeOrSkip(c_tail.next)
 *     return 0
*/
    __pyx_v_c_target = xmlAddNextSibling(__pyx_v_c_target, __pyx_v_c_new_tail);

    /* "src/lxml/apihelpers.pxi":1145
 *             raise MemoryError()
 *         c_target = tree.xmlAddNextSibling(c_target, c_new_tail)
 *         c_tail = _textNodeOrSkip(c_tail.next)             # <<<<<<<<<<<<<<
 *     return 0
 * 
*/
    __pyx_v_c_tail = __pyx_f_4lxml_5etree__textNodeOrSkip(__pyx_v_c_tail->next);
  }

  /* "src/lxml/apihelpers.pxi":1146
 *         c_target = tree.xmlAddNextSibling(c_target, c_new_tail)
 *         c_tail = _textNodeOrSkip(c_tail.next)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int _copyNonElementSiblings(xmlNode* c_node, xmlNode* c_target) except -1:
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1132
 *         c_tail = c_next
 * 
 * cdef int _copyTail(xmlNode* c_tail, xmlNode* c_target) except -1:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_new_tail
 *     # tail copying support: look for any text nodes trailing this node and
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._copyTail", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":1148
 *     return 0
 * 
 * cdef int _copyNonElementSiblings(xmlNode* c_node, xmlNode* c_target) except -1:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_copy
 *     cdef xmlNode* c_sibling = c_node
*/

static int __pyx_f_4lxml_5etree__copyNonElementSiblings(xmlNode *__pyx_v_c_node, xmlNode *__pyx_v_c_target) {
  xmlNode *__pyx_v_c_copy;
  xmlNode *__pyx_v_c_sibling;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  xmlNode *__pyx_t_3;
  xmlDtd *__pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/apihelpers.pxi":1150
 * cdef int _copyNonElementSiblings(xmlNode* c_node, xmlNode* c_target) except -1:
 *     cdef xmlNode* c_copy
 *     cdef xmlNode* c_sibling = c_node             # <<<<<<<<<<<<<<
 *     while c_sibling.prev != NULL and \
 *             (c_sibling.prev.type == tree.XML_PI_NODE or
*/
  __pyx_v_c_sibling = __pyx_v_c_node;

  /* "src/lxml/apihelpers.pxi":1151
 *     cdef xmlNode* c_copy
 *     cdef xmlNode* c_sibling = c_node
 *     while c_sibling.prev != NULL and \             # <<<<<<<<<<<<<<
 *             (c_sibling.prev.type == tree.XML_PI_NODE or
 *              c_sibling.prev.type == tree.XML_COMMENT_NODE or
*/
  while (1) {
    __pyx_t_2 = (__pyx_v_c_sibling->prev != NULL);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L5_bool_binop_done;
    }

    /* "src/lxml/apihelpers.pxi":1152
 *     cdef xmlNode* c_sibling = c_node
 *     while c_sibling.prev != NULL and \
 *             (c_sibling.prev.type == tree.XML_PI_NODE or             # <<<<<<<<<<<<<<
 *              c_sibling.prev.type == tree.XML_COMMENT_NODE or
 *              c_sibling.prev.type == tree.XML_DTD_NODE):
*/
    switch (__pyx_v_c_sibling->prev->type) {
      case XML_PI_NODE:
      case XML_COMMENT_NODE:

      /* "src/lxml/apihelpers.pxi":1153
 *     while c_sibling.prev != NULL and \
 *             (c_sibling.prev.type == tree.XML_PI_NODE or
 *              c_sibling.prev.type == tree.XML_COMMENT_NODE or             # <<<<<<<<<<<<<<
 *              c_sibling.prev.type == tree.XML_DTD_NODE):
 *         c_sibling = c_sibling.prev
*/
      case XML_DTD_NODE:

      /* "src/lxml/apihelpers.pxi":1152
 *     cdef xmlNode* c_sibling = c_node
 *     while c_sibling.prev != NULL and \
 *             (c_sibling.prev.type == tree.XML_PI_NODE or             # <<<<<<<<<<<<<<
 *              c_sibling.prev.type == tree.XML_COMMENT_NODE or
 *              c_sibling.prev.type == tree.XML_DTD_NODE):
*/
      __pyx_t_2 = 1;
      break;
      default:
      __pyx_t_2 = 0;
      break;
    }
    __pyx_t_1 = __pyx_t_2;
    __pyx_L5_bool_binop_done:;
    if (!__pyx_t_1) break;

    /* "src/lxml/apihelpers.pxi":1155
 *              c_sibling.prev.type == tree.XML_COMMENT_NODE or
 *              c_sibling.prev.type == tree.XML_DTD_NODE):
 *         c_sibling = c_sibling.prev             # <<<<<<<<<<<<<<
 *     while c_sibling != c_node:
 *         if c_sibling.type == tree.XML_DTD_NODE:
*/
    __pyx_t_3 = __pyx_v_c_sibling->prev;
    __pyx_v_c_sibling = __pyx_t_3;
  }

  /* "src/lxml/apihelpers.pxi":1156
 *              c_sibling.prev.type == tree.XML_DTD_NODE):
 *         c_sibling = c_sibling.prev
 *     while c_sibling != c_node:             # <<<<<<<<<<<<<<
 *         if c_sibling.type == tree.XML_DTD_NODE:
 *             c_copy = <xmlNode*>_copyDtd(<tree.xmlDtd*>c_sibling)
*/
  while (1) {
    __pyx_t_1 = (__pyx_v_c_sibling != __pyx_v_c_node);
    if (!__pyx_t_1) break;

    /* "src/lxml/apihelpers.pxi":1157
 *         c_sibling = c_sibling.prev
 *     while c_sibling != c_node:
 *         if c_sibling.type == tree.XML_DTD_NODE:             # <<<<<<<<<<<<<<
 *             c_copy = <xmlNode*>_copyDtd(<tree.xmlDtd*>c_sibling)
 *             if c_sibling == <xmlNode*>c_node.doc.intSubset:
*/
    __pyx_t_1 = (__pyx_v_c_sibling->type == XML_DTD_NODE);
    if (__pyx_t_1) {

      /* "src/lxml/apihelpers.pxi":1158
 *     while c_sibling != c_node:
 *         if c_sibling.type == tree.XML_DTD_NODE:
 *             c_copy = <xmlNode*>_copyDtd(<tree.xmlDtd*>c_sibling)             # <<<<<<<<<<<<<<
 *             if c_sibling == <xmlNode*>c_node.doc.intSubset:
 *                 c_target.doc.intSubset = <tree.xmlDtd*>c_copy
*/
      __pyx_t_4 = __pyx_f_4lxml_5etree__copyDtd(((xmlDtd *)__pyx_v_c_sibling)); if (unlikely(__pyx_t_4 == ((void *)NULL))) __PYX_ERR(4, 1158, __pyx_L1_error)
      __pyx_v_c_copy = ((xmlNode *)__pyx_t_4);

      /* "src/lxml/apihelpers.pxi":1159
 *         if c_sibling.type == tree.XML_DTD_NODE:
 *             c_copy = <xmlNode*>_copyDtd(<tree.xmlDtd*>c_sibling)
 *             if c_sibling == <xmlNode*>c_node.doc.intSubset:             # <<<<<<<<<<<<<<
 *                 c_target.doc.intSubset = <tree.xmlDtd*>c_copy
 *             else: # c_sibling == c_node.doc.extSubset
*/
      __pyx_t_1 = (__pyx_v_c_sibling == ((xmlNode *)__pyx_v_c_node->doc->intSubset));
      if (__pyx_t_1) {

        /* "src/lxml/apihelpers.pxi":1160
 *             c_copy = <xmlNode*>_copyDtd(<tree.xmlDtd*>c_sibling)
 *             if c_sibling == <xmlNode*>c_node.doc.intSubset:
 *                 c_target.doc.intSubset = <tree.xmlDtd*>c_copy             # <<<<<<<<<<<<<<
 *             else: # c_sibling == c_node.doc.extSubset
 *                 c_target.doc.extSubset = <tree.xmlDtd*>c_copy
*/
        __pyx_v_c_target->doc->intSubset = ((xmlDtd *)__pyx_v_c_copy);

        /* "src/lxml/apihelpers.pxi":1159
 *         if c_sibling.type == tree.XML_DTD_NODE:
 *             c_copy = <xmlNode*>_copyDtd(<tree.xmlDtd*>c_sibling)
 *             if c_sibling == <xmlNode*>c_node.doc.intSubset:             # <<<<<<<<<<<<<<
 *                 c_target.doc.intSubset = <tree.xmlDtd*>c_copy
 *             else: # c_sibling == c_node.doc.extSubset
*/
        goto __pyx_L10;
      }

      /* "src/lxml/apihelpers.pxi":1162
 *                 c_target.doc.intSubset = <tree.xmlDtd*>c_copy
 *             else: # c_sibling == c_node.doc.extSubset
 *                 c_target.doc.extSubset = <tree.xmlDtd*>c_copy             # <<<<<<<<<<<<<<
 *         else:
 *             c_copy = tree.xmlDocCopyNode(c_sibling, c_target.doc, 1)
*/
      /*else*/ {
        __pyx_v_c_target->doc->extSubset = ((xmlDtd *)__pyx_v_c_copy);
      }
      __pyx_L10:;

      /* "src/lxml/apihelpers.pxi":1157
 *         c_sibling = c_sibling.prev
 *     while c_sibling != c_node:
 *         if c_sibling.type == tree.XML_DTD_NODE:             # <<<<<<<<<<<<<<
 *             c_copy = <xmlNode*>_copyDtd(<tree.xmlDtd*>c_sibling)
 *             if c_sibling == <xmlNode*>c_node.doc.intSubset:
*/
      goto __pyx_L9;
    }

    /* "src/lxml/apihelpers.pxi":1164
 *                 c_target.doc.extSubset = <tree.xmlDtd*>c_copy
 *         else:
 *             c_copy = tree.xmlDocCopyNode(c_sibling, c_target.doc, 1)             # <<<<<<<<<<<<<<
 *             if c_copy is NULL:
 *                 raise MemoryError()
*/
    /*else*/ {
      __pyx_v_c_copy = xmlDocCopyNode(__pyx_v_c_sibling, __pyx_v_c_target->doc, 1);

      /* "src/lxml/apihelpers.pxi":1165
 *         else:
 *             c_copy = tree.xmlDocCopyNode(c_sibling, c_target.doc, 1)
 *             if c_copy is NULL:             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 *         tree.xmlAddPrevSibling(c_target, c_copy)
*/
      __pyx_t_1 = (__pyx_v_c_copy == NULL);
      if (unlikely(__pyx_t_1)) {

        /* "src/lxml/apihelpers.pxi":1166
 *             c_copy = tree.xmlDocCopyNode(c_sibling, c_target.doc, 1)
 *             if c_copy is NULL:
 *                 raise MemoryError()             # <<<<<<<<<<<<<<
 *         tree.xmlAddPrevSibling(c_target, c_copy)
 *         c_sibling = c_sibling.next
*/
        PyErr_NoMemory(); __PYX_ERR(4, 1166, __pyx_L1_error)

        /* "src/lxml/apihelpers.pxi":1165
 *         else:
 *             c_copy = tree.xmlDocCopyNode(c_sibling, c_target.doc, 1)
 *             if c_copy is NULL:             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 *         tree.xmlAddPrevSibling(c_target, c_copy)
*/
      }
    }
    __pyx_L9:;

    /* "src/lxml/apihelpers.pxi":1167
 *             if c_copy is NULL:
 *                 raise MemoryError()
 *         tree.xmlAddPrevSibling(c_target, c_copy)             # <<<<<<<<<<<<<<
 *         c_sibling = c_sibling.next
 *     while c_sibling.next != NULL and \
*/
    (void)(xmlAddPrevSibling(__pyx_v_c_target, __pyx_v_c_copy));

    /* "src/lxml/apihelpers.pxi":1168
 *                 raise MemoryError()
 *         tree.xmlAddPrevSibling(c_target, c_copy)
 *         c_sibling = c_sibling.next             # <<<<<<<<<<<<<<
 *     while c_sibling.next != NULL and \
 *             (c_sibling.next.type == tree.XML_PI_NODE or
*/
    __pyx_t_3 = __pyx_v_c_sibling->next;
    __pyx_v_c_sibling = __pyx_t_3;
  }

  /* "src/lxml/apihelpers.pxi":1169
 *         tree.xmlAddPrevSibling(c_target, c_copy)
 *         c_sibling = c_sibling.next
 *     while c_sibling.next != NULL and \             # <<<<<<<<<<<<<<
 *             (c_sibling.next.type == tree.XML_PI_NODE or
 *              c_sibling.next.type == tree.XML_COMMENT_NODE):
*/
  while (1) {
    __pyx_t_2 = (__pyx_v_c_sibling->next != NULL);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L14_bool_binop_done;
    }

    /* "src/lxml/apihelpers.pxi":1170
 *         c_sibling = c_sibling.next
 *     while c_sibling.next != NULL and \
 *             (c_sibling.next.type == tree.XML_PI_NODE or             # <<<<<<<<<<<<<<
 *              c_sibling.next.type == tree.XML_COMMENT_NODE):
 *         c_sibling = c_sibling.next
*/
    switch (__pyx_v_c_sibling->next->type) {
      case XML_PI_NODE:
      case XML_COMMENT_NODE:

      /* "src/lxml/apihelpers.pxi":1171
 *     while c_sibling.next != NULL and \
 *             (c_sibling.next.type == tree.XML_PI_NODE or
 *              c_sibling.next.type == tree.XML_COMMENT_NODE):             # <<<<<<<<<<<<<<
 *         c_sibling = c_sibling.next
 *         c_copy = tree.xmlDocCopyNode(c_sibling, c_target.doc, 1)
*/
      __pyx_t_2 = 1;

      /* "src/lxml/apihelpers.pxi":1170
 *         c_sibling = c_sibling.next
 *     while c_sibling.next != NULL and \
 *             (c_sibling.next.type == tree.XML_PI_NODE or             # <<<<<<<<<<<<<<
 *              c_sibling.next.type == tree.XML_COMMENT_NODE):
 *         c_sibling = c_sibling.next
*/
      break;
      default:
      __pyx_t_2 = 0;
      break;
    }
    __pyx_t_1 = __pyx_t_2;
    __pyx_L14_bool_binop_done:;
    if (!__pyx_t_1) break;

    /* "src/lxml/apihelpers.pxi":1172
 *             (c_sibling.next.type == tree.XML_PI_NODE or
 *              c_sibling.next.type == tree.XML_COMMENT_NODE):
 *         c_sibling = c_sibling.next             # <<<<<<<<<<<<<<
 *         c_copy = tree.xmlDocCopyNode(c_sibling, c_target.doc, 1)
 *         if c_copy is NULL:
*/
    __pyx_t_3 = __pyx_v_c_sibling->next;
    __pyx_v_c_sibling = __pyx_t_3;

    /* "src/lxml/apihelpers.pxi":1173
 *              c_sibling.next.type == tree.XML_COMMENT_NODE):
 *         c_sibling = c_sibling.next
 *         c_copy = tree.xmlDocCopyNode(c_sibling, c_target.doc, 1)             # <<<<<<<<<<<<<<
 *         if c_copy is NULL:
 *             raise MemoryError()
*/
    __pyx_v_c_copy = xmlDocCopyNode(__pyx_v_c_sibling, __pyx_v_c_target->doc, 1);

    /* "src/lxml/apihelpers.pxi":1174
 *         c_sibling = c_sibling.next
 *         c_copy = tree.xmlDocCopyNode(c_sibling, c_target.doc, 1)
 *         if c_copy is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 *         tree.xmlAddNextSibling(c_target, c_copy)
*/
    __pyx_t_1 = (__pyx_v_c_copy == NULL);
    if (unlikely(__pyx_t_1)) {

      /* "src/lxml/apihelpers.pxi":1175
 *         c_copy = tree.xmlDocCopyNode(c_sibling, c_target.doc, 1)
 *         if c_copy is NULL:
 *             raise MemoryError()             # <<<<<<<<<<<<<<
 *         tree.xmlAddNextSibling(c_target, c_copy)
 * 
*/
      PyErr_NoMemory(); __PYX_ERR(4, 1175, __pyx_L1_error)

      /* "src/lxml/apihelpers.pxi":1174
 *         c_sibling = c_sibling.next
 *         c_copy = tree.xmlDocCopyNode(c_sibling, c_target.doc, 1)
 *         if c_copy is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 *         tree.xmlAddNextSibling(c_target, c_copy)
*/
    }

    /* "src/lxml/apihelpers.pxi":1176
 *         if c_copy is NULL:
 *             raise MemoryError()
 *         tree.xmlAddNextSibling(c_target, c_copy)             # <<<<<<<<<<<<<<
 * 
 * cdef int _deleteSlice(_Document doc, xmlNode* c_node,
*/
    (void)(xmlAddNextSibling(__pyx_v_c_target, __pyx_v_c_copy));
  }

  /* "src/lxml/apihelpers.pxi":1148
 *     return 0
 * 
 * cdef int _copyNonElementSiblings(xmlNode* c_node, xmlNode* c_target) except -1:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_copy
 *     cdef xmlNode* c_sibling = c_node
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._copyNonElementSiblings", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":1178
 *         tree.xmlAddNextSibling(c_target, c_copy)
 * 
 * cdef int _deleteSlice(_Document doc, xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                       Py_ssize_t count, Py_ssize_t step) except -1:
 *     """Delete slice, ``count`` items starting with ``c_node`` with a step
*/

static int __pyx_f_4lxml_5etree__deleteSlice(struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_node, Py_ssize_t __pyx_v_count, Py_ssize_t __pyx_v_step) {
  xmlNode *__pyx_v_c_next;
  Py_ssize_t __pyx_v_c;
  CYTHON_UNUSED Py_ssize_t __pyx_v_i;
  _node_to_node_function __pyx_v_next_element;
  int __pyx_r;
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  int __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  xmlNode *__pyx_t_6;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/apihelpers.pxi":1186
 *     cdef Py_ssize_t c, i
 *     cdef _node_to_node_function next_element
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         return 0
 *     if step > 0:
*/
  __pyx_t_1 = (__pyx_v_c_node == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":1187
 *     cdef _node_to_node_function next_element
 *     if c_node is NULL:
 *         return 0             # <<<<<<<<<<<<<<
 *     if step > 0:
 *         next_element = _nextElement
*/
    __pyx_r = 0;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":1186
 *     cdef Py_ssize_t c, i
 *     cdef _node_to_node_function next_element
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         return 0
 *     if step > 0:
*/
  }

  /* "src/lxml/apihelpers.pxi":1188
 *     if c_node is NULL:
 *         return 0
 *     if step > 0:             # <<<<<<<<<<<<<<
 *         next_element = _nextElement
 *     else:
*/
  __pyx_t_1 = (__pyx_v_step > 0);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":1189
 *         return 0
 *     if step > 0:
 *         next_element = _nextElement             # <<<<<<<<<<<<<<
 *     else:
 *         step = -step if step != python.PY_SSIZE_T_MIN else python.PY_SSIZE_T_MAX
*/
    __pyx_v_next_element = __pyx_f_4lxml_5etree__nextElement;

    /* "src/lxml/apihelpers.pxi":1188
 *     if c_node is NULL:
 *         return 0
 *     if step > 0:             # <<<<<<<<<<<<<<
 *         next_element = _nextElement
 *     else:
*/
    goto __pyx_L4;
  }

  /* "src/lxml/apihelpers.pxi":1191
 *         next_element = _nextElement
 *     else:
 *         step = -step if step != python.PY_SSIZE_T_MIN else python.PY_SSIZE_T_MAX             # <<<<<<<<<<<<<<
 *         next_element = _previousElement
 *     # now start deleting nodes
*/
  /*else*/ {
    __pyx_t_1 = (__pyx_v_step != PY_SSIZE_T_MIN);
    if (__pyx_t_1) {
      __pyx_t_2 = (-__pyx_v_step);
    } else {
      __pyx_t_2 = PY_SSIZE_T_MAX;
    }
    __pyx_v_step = __pyx_t_2;

    /* "src/lxml/apihelpers.pxi":1192
 *     else:
 *         step = -step if step != python.PY_SSIZE_T_MIN else python.PY_SSIZE_T_MAX
 *         next_element = _previousElement             # <<<<<<<<<<<<<<
 *     # now start deleting nodes
 *     c = 0
*/
    __pyx_v_next_element = __pyx_f_4lxml_5etree__previousElement;
  }
  __pyx_L4:;

  /* "src/lxml/apihelpers.pxi":1194
 *         next_element = _previousElement
 *     # now start deleting nodes
 *     c = 0             # <<<<<<<<<<<<<<
 *     c_next = c_node
 *     while c_node is not NULL and c < count:
*/
  __pyx_v_c = 0;

  /* "src/lxml/apihelpers.pxi":1195
 *     # now start deleting nodes
 *     c = 0
 *     c_next = c_node             # <<<<<<<<<<<<<<
 *     while c_node is not NULL and c < count:
 *         for i in range(step):
*/
  __pyx_v_c_next = __pyx_v_c_node;

  /* "src/lxml/apihelpers.pxi":1196
 *     c = 0
 *     c_next = c_node
 *     while c_node is not NULL and c < count:             # <<<<<<<<<<<<<<
 *         for i in range(step):
 *             c_next = next_element(c_next)
*/
  while (1) {
    __pyx_t_3 = (__pyx_v_c_node != NULL);
    if (__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_3 = (__pyx_v_c < __pyx_v_count);
    __pyx_t_1 = __pyx_t_3;
    __pyx_L7_bool_binop_done:;
    if (!__pyx_t_1) break;

    /* "src/lxml/apihelpers.pxi":1197
 *     c_next = c_node
 *     while c_node is not NULL and c < count:
 *         for i in range(step):             # <<<<<<<<<<<<<<
 *             c_next = next_element(c_next)
 *             if c_next is NULL:
*/
    __pyx_t_2 = __pyx_v_step;
    __pyx_t_4 = __pyx_t_2;
    for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
      __pyx_v_i = __pyx_t_5;

      /* "src/lxml/apihelpers.pxi":1198
 *     while c_node is not NULL and c < count:
 *         for i in range(step):
 *             c_next = next_element(c_next)             # <<<<<<<<<<<<<<
 *             if c_next is NULL:
 *                 break
*/
      __pyx_t_6 = __pyx_v_next_element(__pyx_v_c_next); if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 1198, __pyx_L1_error)
      __pyx_v_c_next = __pyx_t_6;

      /* "src/lxml/apihelpers.pxi":1199
 *         for i in range(step):
 *             c_next = next_element(c_next)
 *             if c_next is NULL:             # <<<<<<<<<<<<<<
 *                 break
 *         _removeNode(doc, c_node)
*/
      __pyx_t_1 = (__pyx_v_c_next == NULL);
      if (__pyx_t_1) {

        /* "src/lxml/apihelpers.pxi":1200
 *             c_next = next_element(c_next)
 *             if c_next is NULL:
 *                 break             # <<<<<<<<<<<<<<
 *         _removeNode(doc, c_node)
 *         c += 1
*/
        goto __pyx_L10_break;

        /* "src/lxml/apihelpers.pxi":1199
 *         for i in range(step):
 *             c_next = next_element(c_next)
 *             if c_next is NULL:             # <<<<<<<<<<<<<<
 *                 break
 *         _removeNode(doc, c_node)
*/
      }
    }
    __pyx_L10_break:;

    /* "src/lxml/apihelpers.pxi":1201
 *             if c_next is NULL:
 *                 break
 *         _removeNode(doc, c_node)             # <<<<<<<<<<<<<<
 *         c += 1
 *         c_node = c_next
*/
    __pyx_t_7 = __pyx_f_4lxml_5etree__removeNode(__pyx_v_doc, __pyx_v_c_node); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(4, 1201, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":1202
 *                 break
 *         _removeNode(doc, c_node)
 *         c += 1             # <<<<<<<<<<<<<<
 *         c_node = c_next
 *     return 0
*/
    __pyx_v_c = (__pyx_v_c + 1);

    /* "src/lxml/apihelpers.pxi":1203
 *         _removeNode(doc, c_node)
 *         c += 1
 *         c_node = c_next             # <<<<<<<<<<<<<<
 *     return 0
 * 
*/
    __pyx_v_c_node = __pyx_v_c_next;
  }

  /* "src/lxml/apihelpers.pxi":1204
 *         c += 1
 *         c_node = c_next
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int _replaceSlice(_Element parent, xmlNode* c_node,
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1178
 *         tree.xmlAddNextSibling(c_target, c_copy)
 * 
 * cdef int _deleteSlice(_Document doc, xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                       Py_ssize_t count, Py_ssize_t step) except -1:
 *     """Delete slice, ``count`` items starting with ``c_node`` with a step
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._deleteSlice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":1206
 *     return 0
 * 
 * cdef int _replaceSlice(_Element parent, xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                        Py_ssize_t slicelength, Py_ssize_t step,
 *                        bint left_to_right, elements) except -1:
*/

static int __pyx_f_4lxml_5etree__replaceSlice(struct LxmlElement *__pyx_v_parent, xmlNode *__pyx_v_c_node, Py_ssize_t __pyx_v_slicelength, Py_ssize_t __pyx_v_step, int __pyx_v_left_to_right, PyObject *__pyx_v_elements) {
  xmlNode *__pyx_v_c_orig_neighbour;
  xmlNode *__pyx_v_c_next;
  xmlDoc *__pyx_v_c_source_doc;
  struct LxmlElement *__pyx_v_element = 0;
  Py_ssize_t __pyx_v_seqlength;
  CYTHON_UNUSED Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_c;
  _node_to_node_function __pyx_v_next_element;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6[4];
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  int __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  xmlNode *__pyx_t_12;
  Py_ssize_t __pyx_t_13;
  xmlDoc *__pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_replaceSlice", 0);
  __Pyx_INCREF(__pyx_v_elements);

  /* "src/lxml/apihelpers.pxi":1221
 *     cdef Py_ssize_t seqlength, i, c
 *     cdef _node_to_node_function next_element
 *     assert step > 0, step             # <<<<<<<<<<<<<<
 *     if left_to_right:
 *         next_element = _nextElement
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = (__pyx_v_step > 0);
    if (unlikely(!__pyx_t_1)) {
      __pyx_t_2 = PyLong_FromSsize_t(__pyx_v_step); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 1221, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyTuple_Pack(1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 1221, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_t_3, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(4, 1221, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(4, 1221, __pyx_L1_error)
  #endif

  /* "src/lxml/apihelpers.pxi":1222
 *     cdef _node_to_node_function next_element
 *     assert step > 0, step
 *     if left_to_right:             # <<<<<<<<<<<<<<
 *         next_element = _nextElement
 *     else:
*/
  if (__pyx_v_left_to_right) {

    /* "src/lxml/apihelpers.pxi":1223
 *     assert step > 0, step
 *     if left_to_right:
 *         next_element = _nextElement             # <<<<<<<<<<<<<<
 *     else:
 *         next_element = _previousElement
*/
    __pyx_v_next_element = __pyx_f_4lxml_5etree__nextElement;

    /* "src/lxml/apihelpers.pxi":1222
 *     cdef _node_to_node_function next_element
 *     assert step > 0, step
 *     if left_to_right:             # <<<<<<<<<<<<<<
 *         next_element = _nextElement
 *     else:
*/
    goto __pyx_L3;
  }

  /* "src/lxml/apihelpers.pxi":1225
 *         next_element = _nextElement
 *     else:
 *         next_element = _previousElement             # <<<<<<<<<<<<<<
 * 
 *     if not isinstance(elements, (list, tuple)):
*/
  /*else*/ {
    __pyx_v_next_element = __pyx_f_4lxml_5etree__previousElement;
  }
  __pyx_L3:;

  /* "src/lxml/apihelpers.pxi":1227
 *         next_element = _previousElement
 * 
 *     if not isinstance(elements, (list, tuple)):             # <<<<<<<<<<<<<<
 *         elements = list(elements)
 * 
*/
  __pyx_t_4 = PyList_Check(__pyx_v_elements); 
  if (!__pyx_t_4) {
  } else {
    __pyx_t_1 = __pyx_t_4;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_4 = PyTuple_Check(__pyx_v_elements); 
  __pyx_t_1 = __pyx_t_4;
  __pyx_L5_bool_binop_done:;
  __pyx_t_4 = (!__pyx_t_1);
  if (__pyx_t_4) {

    /* "src/lxml/apihelpers.pxi":1228
 * 
 *     if not isinstance(elements, (list, tuple)):
 *         elements = list(elements)             # <<<<<<<<<<<<<<
 * 
 *     if step != 1 or not left_to_right:
*/
    __pyx_t_3 = PySequence_List(__pyx_v_elements); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 1228, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_elements, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/apihelpers.pxi":1227
 *         next_element = _previousElement
 * 
 *     if not isinstance(elements, (list, tuple)):             # <<<<<<<<<<<<<<
 *         elements = list(elements)
 * 
*/
  }

  /* "src/lxml/apihelpers.pxi":1230
 *         elements = list(elements)
 * 
 *     if step != 1 or not left_to_right:             # <<<<<<<<<<<<<<
 *         # *replacing* children stepwise with list => check size!
 *         seqlength = len(elements)
*/
  __pyx_t_1 = (__pyx_v_step != 1);
  if (!__pyx_t_1) {
  } else {
    __pyx_t_4 = __pyx_t_1;
    goto __pyx_L8_bool_binop_done;
  }
  __pyx_t_1 = (!__pyx_v_left_to_right);
  __pyx_t_4 = __pyx_t_1;
  __pyx_L8_bool_binop_done:;
  if (__pyx_t_4) {

    /* "src/lxml/apihelpers.pxi":1232
 *     if step != 1 or not left_to_right:
 *         # *replacing* children stepwise with list => check size!
 *         seqlength = len(elements)             # <<<<<<<<<<<<<<
 *         if seqlength != slicelength:
 *             raise ValueError, f"attempt to assign sequence of size {seqlength} " \
*/
    __pyx_t_5 = PyObject_Length(__pyx_v_elements); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(4, 1232, __pyx_L1_error)
    __pyx_v_seqlength = __pyx_t_5;

    /* "src/lxml/apihelpers.pxi":1233
 *         # *replacing* children stepwise with list => check size!
 *         seqlength = len(elements)
 *         if seqlength != slicelength:             # <<<<<<<<<<<<<<
 *             raise ValueError, f"attempt to assign sequence of size {seqlength} " \
 *                 f"to extended slice of size {slicelength}"
*/
    __pyx_t_4 = (__pyx_v_seqlength != __pyx_v_slicelength);
    if (unlikely(__pyx_t_4)) {

      /* "src/lxml/apihelpers.pxi":1234
 *         seqlength = len(elements)
 *         if seqlength != slicelength:
 *             raise ValueError, f"attempt to assign sequence of size {seqlength} " \             # <<<<<<<<<<<<<<
 *                 f"to extended slice of size {slicelength}"
 * 
*/
      __pyx_t_3 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_seqlength, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 1234, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);

      /* "src/lxml/apihelpers.pxi":1235
 *         if seqlength != slicelength:
 *             raise ValueError, f"attempt to assign sequence of size {seqlength} " \
 *                 f"to extended slice of size {slicelength}"             # <<<<<<<<<<<<<<
 * 
 *     if c_node is NULL:
*/
      __pyx_t_2 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_slicelength, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 1235, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6[0] = __pyx_mstate_global->__pyx_kp_u_attempt_to_assign_sequence_of_si;
      __pyx_t_6[1] = __pyx_t_3;
      __pyx_t_6[2] = __pyx_mstate_global->__pyx_kp_u_to_extended_slice_of_size;
      __pyx_t_6[3] = __pyx_t_2;

      /* "src/lxml/apihelpers.pxi":1234
 *         seqlength = len(elements)
 *         if seqlength != slicelength:
 *             raise ValueError, f"attempt to assign sequence of size {seqlength} " \             # <<<<<<<<<<<<<<
 *                 f"to extended slice of size {slicelength}"
 * 
*/
      __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_6, 4, 35 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 27 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2), 127);
      if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 1234, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_t_7, 0, 0);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __PYX_ERR(4, 1234, __pyx_L1_error)

      /* "src/lxml/apihelpers.pxi":1233
 *         # *replacing* children stepwise with list => check size!
 *         seqlength = len(elements)
 *         if seqlength != slicelength:             # <<<<<<<<<<<<<<
 *             raise ValueError, f"attempt to assign sequence of size {seqlength} " \
 *                 f"to extended slice of size {slicelength}"
*/
    }

    /* "src/lxml/apihelpers.pxi":1230
 *         elements = list(elements)
 * 
 *     if step != 1 or not left_to_right:             # <<<<<<<<<<<<<<
 *         # *replacing* children stepwise with list => check size!
 *         seqlength = len(elements)
*/
  }

  /* "src/lxml/apihelpers.pxi":1237
 *                 f"to extended slice of size {slicelength}"
 * 
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         # no children yet => add all elements straight away
 *         if left_to_right:
*/
  __pyx_t_4 = (__pyx_v_c_node == NULL);
  if (__pyx_t_4) {

    /* "src/lxml/apihelpers.pxi":1239
 *     if c_node is NULL:
 *         # no children yet => add all elements straight away
 *         if left_to_right:             # <<<<<<<<<<<<<<
 *             for element in elements:
 *                 assert element is not None, "Node must not be None"
*/
    if (__pyx_v_left_to_right) {

      /* "src/lxml/apihelpers.pxi":1240
 *         # no children yet => add all elements straight away
 *         if left_to_right:
 *             for element in elements:             # <<<<<<<<<<<<<<
 *                 assert element is not None, "Node must not be None"
 *                 _appendChild(parent, element)
*/
      if (likely(PyList_CheckExact(__pyx_v_elements)) || PyTuple_CheckExact(__pyx_v_elements)) {
        __pyx_t_7 = __pyx_v_elements; __Pyx_INCREF(__pyx_t_7);
        __pyx_t_5 = 0;
        __pyx_t_8 = NULL;
      } else {
        __pyx_t_5 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_v_elements); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 1240, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 1240, __pyx_L1_error)
      }
      for (;;) {
        if (likely(!__pyx_t_8)) {
          if (likely(PyList_CheckExact(__pyx_t_7))) {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_7);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(4, 1240, __pyx_L1_error)
              #endif
              if (__pyx_t_5 >= __pyx_temp) break;
            }
            __pyx_t_2 = __Pyx_PyList_GetItemRefFast(__pyx_t_7, __pyx_t_5, __Pyx_ReferenceSharing_OwnStrongReference);
            ++__pyx_t_5;
          } else {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_7);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(4, 1240, __pyx_L1_error)
              #endif
              if (__pyx_t_5 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_2 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_5));
            #else
            __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_7, __pyx_t_5);
            #endif
            ++__pyx_t_5;
          }
          if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 1240, __pyx_L1_error)
        } else {
          __pyx_t_2 = __pyx_t_8(__pyx_t_7);
          if (unlikely(!__pyx_t_2)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(4, 1240, __pyx_L1_error)
              PyErr_Clear();
            }
            break;
          }
        }
        __Pyx_GOTREF(__pyx_t_2);
        if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element))))) __PYX_ERR(4, 1240, __pyx_L1_error)
        __Pyx_XDECREF_SET(__pyx_v_element, ((struct LxmlElement *)__pyx_t_2));
        __pyx_t_2 = 0;

        /* "src/lxml/apihelpers.pxi":1241
 *         if left_to_right:
 *             for element in elements:
 *                 assert element is not None, "Node must not be None"             # <<<<<<<<<<<<<<
 *                 _appendChild(parent, element)
 *         else:
*/
        #ifndef CYTHON_WITHOUT_ASSERTIONS
        if (unlikely(__pyx_assertions_enabled())) {
          __pyx_t_4 = (((PyObject *)__pyx_v_element) != Py_None);
          if (unlikely(!__pyx_t_4)) {
            __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_mstate_global->__pyx_kp_u_Node_must_not_be_None, 0, 0);
            __PYX_ERR(4, 1241, __pyx_L1_error)
          }
        }
        #else
        if ((1)); else __PYX_ERR(4, 1241, __pyx_L1_error)
        #endif

        /* "src/lxml/apihelpers.pxi":1242
 *             for element in elements:
 *                 assert element is not None, "Node must not be None"
 *                 _appendChild(parent, element)             # <<<<<<<<<<<<<<
 *         else:
 *             for element in elements:
*/
        __pyx_t_9 = __pyx_f_4lxml_5etree__appendChild(__pyx_v_parent, __pyx_v_element); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(4, 1242, __pyx_L1_error)

        /* "src/lxml/apihelpers.pxi":1240
 *         # no children yet => add all elements straight away
 *         if left_to_right:
 *             for element in elements:             # <<<<<<<<<<<<<<
 *                 assert element is not None, "Node must not be None"
 *                 _appendChild(parent, element)
*/
      }
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "src/lxml/apihelpers.pxi":1239
 *     if c_node is NULL:
 *         # no children yet => add all elements straight away
 *         if left_to_right:             # <<<<<<<<<<<<<<
 *             for element in elements:
 *                 assert element is not None, "Node must not be None"
*/
      goto __pyx_L12;
    }

    /* "src/lxml/apihelpers.pxi":1244
 *                 _appendChild(parent, element)
 *         else:
 *             for element in elements:             # <<<<<<<<<<<<<<
 *                 assert element is not None, "Node must not be None"
 *                 _prependChild(parent, element)
*/
    /*else*/ {
      if (likely(PyList_CheckExact(__pyx_v_elements)) || PyTuple_CheckExact(__pyx_v_elements)) {
        __pyx_t_7 = __pyx_v_elements; __Pyx_INCREF(__pyx_t_7);
        __pyx_t_5 = 0;
        __pyx_t_8 = NULL;
      } else {
        __pyx_t_5 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_v_elements); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 1244, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 1244, __pyx_L1_error)
      }
      for (;;) {
        if (likely(!__pyx_t_8)) {
          if (likely(PyList_CheckExact(__pyx_t_7))) {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_7);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(4, 1244, __pyx_L1_error)
              #endif
              if (__pyx_t_5 >= __pyx_temp) break;
            }
            __pyx_t_2 = __Pyx_PyList_GetItemRefFast(__pyx_t_7, __pyx_t_5, __Pyx_ReferenceSharing_OwnStrongReference);
            ++__pyx_t_5;
          } else {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_7);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(4, 1244, __pyx_L1_error)
              #endif
              if (__pyx_t_5 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_2 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_5));
            #else
            __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_7, __pyx_t_5);
            #endif
            ++__pyx_t_5;
          }
          if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 1244, __pyx_L1_error)
        } else {
          __pyx_t_2 = __pyx_t_8(__pyx_t_7);
          if (unlikely(!__pyx_t_2)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(4, 1244, __pyx_L1_error)
              PyErr_Clear();
            }
            break;
          }
        }
        __Pyx_GOTREF(__pyx_t_2);
        if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element))))) __PYX_ERR(4, 1244, __pyx_L1_error)
        __Pyx_XDECREF_SET(__pyx_v_element, ((struct LxmlElement *)__pyx_t_2));
        __pyx_t_2 = 0;

        /* "src/lxml/apihelpers.pxi":1245
 *         else:
 *             for element in elements:
 *                 assert element is not None, "Node must not be None"             # <<<<<<<<<<<<<<
 *                 _prependChild(parent, element)
 *         return 0
*/
        #ifndef CYTHON_WITHOUT_ASSERTIONS
        if (unlikely(__pyx_assertions_enabled())) {
          __pyx_t_4 = (((PyObject *)__pyx_v_element) != Py_None);
          if (unlikely(!__pyx_t_4)) {
            __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_mstate_global->__pyx_kp_u_Node_must_not_be_None, 0, 0);
            __PYX_ERR(4, 1245, __pyx_L1_error)
          }
        }
        #else
        if ((1)); else __PYX_ERR(4, 1245, __pyx_L1_error)
        #endif

        /* "src/lxml/apihelpers.pxi":1246
 *             for element in elements:
 *                 assert element is not None, "Node must not be None"
 *                 _prependChild(parent, element)             # <<<<<<<<<<<<<<
 *         return 0
 * 
*/
        __pyx_t_9 = __pyx_f_4lxml_5etree__prependChild(__pyx_v_parent, __pyx_v_element); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(4, 1246, __pyx_L1_error)

        /* "src/lxml/apihelpers.pxi":1244
 *                 _appendChild(parent, element)
 *         else:
 *             for element in elements:             # <<<<<<<<<<<<<<
 *                 assert element is not None, "Node must not be None"
 *                 _prependChild(parent, element)
*/
      }
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __pyx_L12:;

    /* "src/lxml/apihelpers.pxi":1247
 *                 assert element is not None, "Node must not be None"
 *                 _prependChild(parent, element)
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     # remove the elements first as some might be re-added
*/
    __pyx_r = 0;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":1237
 *                 f"to extended slice of size {slicelength}"
 * 
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         # no children yet => add all elements straight away
 *         if left_to_right:
*/
  }

  /* "src/lxml/apihelpers.pxi":1250
 * 
 *     # remove the elements first as some might be re-added
 *     if left_to_right:             # <<<<<<<<<<<<<<
 *         # L->R, remember left neighbour
 *         c_orig_neighbour = _previousElement(c_node)
*/
  if (__pyx_v_left_to_right) {

    /* "src/lxml/apihelpers.pxi":1252
 *     if left_to_right:
 *         # L->R, remember left neighbour
 *         c_orig_neighbour = _previousElement(c_node)             # <<<<<<<<<<<<<<
 *     else:
 *         # R->L, remember right neighbour
*/
    __pyx_v_c_orig_neighbour = __pyx_f_4lxml_5etree__previousElement(__pyx_v_c_node);

    /* "src/lxml/apihelpers.pxi":1250
 * 
 *     # remove the elements first as some might be re-added
 *     if left_to_right:             # <<<<<<<<<<<<<<
 *         # L->R, remember left neighbour
 *         c_orig_neighbour = _previousElement(c_node)
*/
    goto __pyx_L19;
  }

  /* "src/lxml/apihelpers.pxi":1255
 *     else:
 *         # R->L, remember right neighbour
 *         c_orig_neighbour = _nextElement(c_node)             # <<<<<<<<<<<<<<
 * 
 *     # We remove the original slice elements one by one. Since we hold
*/
  /*else*/ {
    __pyx_v_c_orig_neighbour = __pyx_f_4lxml_5etree__nextElement(__pyx_v_c_node);
  }
  __pyx_L19:;

  /* "src/lxml/apihelpers.pxi":1261
 *     # safe to let _removeNode() try (and fail) to free them even if
 *     # the element itself or one of its descendents will be reinserted.
 *     c = 0             # <<<<<<<<<<<<<<
 *     c_next = c_node
 *     while c_node is not NULL and c < slicelength:
*/
  __pyx_v_c = 0;

  /* "src/lxml/apihelpers.pxi":1262
 *     # the element itself or one of its descendents will be reinserted.
 *     c = 0
 *     c_next = c_node             # <<<<<<<<<<<<<<
 *     while c_node is not NULL and c < slicelength:
 *         for i in range(step):
*/
  __pyx_v_c_next = __pyx_v_c_node;

  /* "src/lxml/apihelpers.pxi":1263
 *     c = 0
 *     c_next = c_node
 *     while c_node is not NULL and c < slicelength:             # <<<<<<<<<<<<<<
 *         for i in range(step):
 *             c_next = next_element(c_next)
*/
  while (1) {
    __pyx_t_1 = (__pyx_v_c_node != NULL);
    if (__pyx_t_1) {
    } else {
      __pyx_t_4 = __pyx_t_1;
      goto __pyx_L22_bool_binop_done;
    }
    __pyx_t_1 = (__pyx_v_c < __pyx_v_slicelength);
    __pyx_t_4 = __pyx_t_1;
    __pyx_L22_bool_binop_done:;
    if (!__pyx_t_4) break;

    /* "src/lxml/apihelpers.pxi":1264
 *     c_next = c_node
 *     while c_node is not NULL and c < slicelength:
 *         for i in range(step):             # <<<<<<<<<<<<<<
 *             c_next = next_element(c_next)
 *             if c_next is NULL:
*/
    __pyx_t_5 = __pyx_v_step;
    __pyx_t_10 = __pyx_t_5;
    for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
      __pyx_v_i = __pyx_t_11;

      /* "src/lxml/apihelpers.pxi":1265
 *     while c_node is not NULL and c < slicelength:
 *         for i in range(step):
 *             c_next = next_element(c_next)             # <<<<<<<<<<<<<<
 *             if c_next is NULL:
 *                 break
*/
      __pyx_t_12 = __pyx_v_next_element(__pyx_v_c_next); if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 1265, __pyx_L1_error)
      __pyx_v_c_next = __pyx_t_12;

      /* "src/lxml/apihelpers.pxi":1266
 *         for i in range(step):
 *             c_next = next_element(c_next)
 *             if c_next is NULL:             # <<<<<<<<<<<<<<
 *                 break
 *         _removeNode(parent._doc, c_node)
*/
      __pyx_t_4 = (__pyx_v_c_next == NULL);
      if (__pyx_t_4) {

        /* "src/lxml/apihelpers.pxi":1267
 *             c_next = next_element(c_next)
 *             if c_next is NULL:
 *                 break             # <<<<<<<<<<<<<<
 *         _removeNode(parent._doc, c_node)
 *         c += 1
*/
        goto __pyx_L25_break;

        /* "src/lxml/apihelpers.pxi":1266
 *         for i in range(step):
 *             c_next = next_element(c_next)
 *             if c_next is NULL:             # <<<<<<<<<<<<<<
 *                 break
 *         _removeNode(parent._doc, c_node)
*/
      }
    }
    __pyx_L25_break:;

    /* "src/lxml/apihelpers.pxi":1268
 *             if c_next is NULL:
 *                 break
 *         _removeNode(parent._doc, c_node)             # <<<<<<<<<<<<<<
 *         c += 1
 *         c_node = c_next
*/
    __pyx_t_7 = ((PyObject *)__pyx_v_parent->_doc);
    __Pyx_INCREF(__pyx_t_7);
    __pyx_t_9 = __pyx_f_4lxml_5etree__removeNode(((struct LxmlDocument *)__pyx_t_7), __pyx_v_c_node); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(4, 1268, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "src/lxml/apihelpers.pxi":1269
 *                 break
 *         _removeNode(parent._doc, c_node)
 *         c += 1             # <<<<<<<<<<<<<<
 *         c_node = c_next
 * 
*/
    __pyx_v_c = (__pyx_v_c + 1);

    /* "src/lxml/apihelpers.pxi":1270
 *         _removeNode(parent._doc, c_node)
 *         c += 1
 *         c_node = c_next             # <<<<<<<<<<<<<<
 * 
 *     # make sure each element is inserted only once
*/
    __pyx_v_c_node = __pyx_v_c_next;
  }

  /* "src/lxml/apihelpers.pxi":1273
 * 
 *     # make sure each element is inserted only once
 *     elements = iter(elements)             # <<<<<<<<<<<<<<
 * 
 *     # find the first node right of the new insertion point
*/
  __pyx_t_7 = PyObject_GetIter(__pyx_v_elements); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 1273, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF_SET(__pyx_v_elements, __pyx_t_7);
  __pyx_t_7 = 0;

  /* "src/lxml/apihelpers.pxi":1276
 * 
 *     # find the first node right of the new insertion point
 *     if left_to_right:             # <<<<<<<<<<<<<<
 *         if c_orig_neighbour is not NULL:
 *             c_node = next_element(c_orig_neighbour)
*/
  if (__pyx_v_left_to_right) {

    /* "src/lxml/apihelpers.pxi":1277
 *     # find the first node right of the new insertion point
 *     if left_to_right:
 *         if c_orig_neighbour is not NULL:             # <<<<<<<<<<<<<<
 *             c_node = next_element(c_orig_neighbour)
 *         else:
*/
    __pyx_t_4 = (__pyx_v_c_orig_neighbour != NULL);
    if (__pyx_t_4) {

      /* "src/lxml/apihelpers.pxi":1278
 *     if left_to_right:
 *         if c_orig_neighbour is not NULL:
 *             c_node = next_element(c_orig_neighbour)             # <<<<<<<<<<<<<<
 *         else:
 *             # before the first element
*/
      __pyx_t_12 = __pyx_v_next_element(__pyx_v_c_orig_neighbour); if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 1278, __pyx_L1_error)
      __pyx_v_c_node = __pyx_t_12;

      /* "src/lxml/apihelpers.pxi":1277
 *     # find the first node right of the new insertion point
 *     if left_to_right:
 *         if c_orig_neighbour is not NULL:             # <<<<<<<<<<<<<<
 *             c_node = next_element(c_orig_neighbour)
 *         else:
*/
      goto __pyx_L28;
    }

    /* "src/lxml/apihelpers.pxi":1281
 *         else:
 *             # before the first element
 *             c_node = _findChildForwards(parent._c_node, 0)             # <<<<<<<<<<<<<<
 *     elif c_orig_neighbour is NULL:
 *         # at the end, but reversed stepping
*/
    /*else*/ {
      __pyx_v_c_node = __pyx_f_4lxml_5etree__findChildForwards(__pyx_v_parent->_c_node, 0);
    }
    __pyx_L28:;

    /* "src/lxml/apihelpers.pxi":1276
 * 
 *     # find the first node right of the new insertion point
 *     if left_to_right:             # <<<<<<<<<<<<<<
 *         if c_orig_neighbour is not NULL:
 *             c_node = next_element(c_orig_neighbour)
*/
    goto __pyx_L27;
  }

  /* "src/lxml/apihelpers.pxi":1282
 *             # before the first element
 *             c_node = _findChildForwards(parent._c_node, 0)
 *     elif c_orig_neighbour is NULL:             # <<<<<<<<<<<<<<
 *         # at the end, but reversed stepping
 *         # append one element and go to the next insertion point
*/
  __pyx_t_4 = (__pyx_v_c_orig_neighbour == NULL);
  if (__pyx_t_4) {

    /* "src/lxml/apihelpers.pxi":1285
 *         # at the end, but reversed stepping
 *         # append one element and go to the next insertion point
 *         for element in elements:             # <<<<<<<<<<<<<<
 *             assert element is not None, "Node must not be None"
 *             _appendChild(parent, element)
*/
    if (likely(PyList_CheckExact(__pyx_v_elements)) || PyTuple_CheckExact(__pyx_v_elements)) {
      __pyx_t_7 = __pyx_v_elements; __Pyx_INCREF(__pyx_t_7);
      __pyx_t_5 = 0;
      __pyx_t_8 = NULL;
    } else {
      __pyx_t_5 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_v_elements); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 1285, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 1285, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_8)) {
        if (likely(PyList_CheckExact(__pyx_t_7))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_7);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(4, 1285, __pyx_L1_error)
            #endif
            if (__pyx_t_5 >= __pyx_temp) break;
          }
          __pyx_t_2 = __Pyx_PyList_GetItemRefFast(__pyx_t_7, __pyx_t_5, __Pyx_ReferenceSharing_OwnStrongReference);
          ++__pyx_t_5;
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_7);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(4, 1285, __pyx_L1_error)
            #endif
            if (__pyx_t_5 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_5));
          #else
          __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_7, __pyx_t_5);
          #endif
          ++__pyx_t_5;
        }
        if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 1285, __pyx_L1_error)
      } else {
        __pyx_t_2 = __pyx_t_8(__pyx_t_7);
        if (unlikely(!__pyx_t_2)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(4, 1285, __pyx_L1_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_2);
      if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element))))) __PYX_ERR(4, 1285, __pyx_L1_error)
      __pyx_v_element = ((struct LxmlElement *)__pyx_t_2);
      __pyx_t_2 = 0;

      /* "src/lxml/apihelpers.pxi":1286
 *         # append one element and go to the next insertion point
 *         for element in elements:
 *             assert element is not None, "Node must not be None"             # <<<<<<<<<<<<<<
 *             _appendChild(parent, element)
 *             c_node = element._c_node
*/
      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(__pyx_assertions_enabled())) {
        __pyx_t_4 = (((PyObject *)__pyx_v_element) != Py_None);
        if (unlikely(!__pyx_t_4)) {
          __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_mstate_global->__pyx_kp_u_Node_must_not_be_None, 0, 0);
          __PYX_ERR(4, 1286, __pyx_L1_error)
        }
      }
      #else
      if ((1)); else __PYX_ERR(4, 1286, __pyx_L1_error)
      #endif

      /* "src/lxml/apihelpers.pxi":1287
 *         for element in elements:
 *             assert element is not None, "Node must not be None"
 *             _appendChild(parent, element)             # <<<<<<<<<<<<<<
 *             c_node = element._c_node
 *             if slicelength > 0:
*/
      __pyx_t_9 = __pyx_f_4lxml_5etree__appendChild(__pyx_v_parent, __pyx_v_element); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(4, 1287, __pyx_L1_error)

      /* "src/lxml/apihelpers.pxi":1288
 *             assert element is not None, "Node must not be None"
 *             _appendChild(parent, element)
 *             c_node = element._c_node             # <<<<<<<<<<<<<<
 *             if slicelength > 0:
 *                 slicelength -= 1
*/
      __pyx_t_12 = __pyx_v_element->_c_node;
      __pyx_v_c_node = __pyx_t_12;

      /* "src/lxml/apihelpers.pxi":1289
 *             _appendChild(parent, element)
 *             c_node = element._c_node
 *             if slicelength > 0:             # <<<<<<<<<<<<<<
 *                 slicelength -= 1
 *                 for i in range(1, step):
*/
      __pyx_t_4 = (__pyx_v_slicelength > 0);
      if (__pyx_t_4) {

        /* "src/lxml/apihelpers.pxi":1290
 *             c_node = element._c_node
 *             if slicelength > 0:
 *                 slicelength -= 1             # <<<<<<<<<<<<<<
 *                 for i in range(1, step):
 *                     c_node = next_element(c_node)
*/
        __pyx_v_slicelength = (__pyx_v_slicelength - 1);

        /* "src/lxml/apihelpers.pxi":1291
 *             if slicelength > 0:
 *                 slicelength -= 1
 *                 for i in range(1, step):             # <<<<<<<<<<<<<<
 *                     c_node = next_element(c_node)
 *                     if c_node is NULL:
*/
        __pyx_t_10 = __pyx_v_step;
        __pyx_t_11 = __pyx_t_10;
        for (__pyx_t_13 = 1; __pyx_t_13 < __pyx_t_11; __pyx_t_13+=1) {
          __pyx_v_i = __pyx_t_13;

          /* "src/lxml/apihelpers.pxi":1292
 *                 slicelength -= 1
 *                 for i in range(1, step):
 *                     c_node = next_element(c_node)             # <<<<<<<<<<<<<<
 *                     if c_node is NULL:
 *                         break
*/
          __pyx_t_12 = __pyx_v_next_element(__pyx_v_c_node); if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 1292, __pyx_L1_error)
          __pyx_v_c_node = __pyx_t_12;

          /* "src/lxml/apihelpers.pxi":1293
 *                 for i in range(1, step):
 *                     c_node = next_element(c_node)
 *                     if c_node is NULL:             # <<<<<<<<<<<<<<
 *                         break
 *             break
*/
          __pyx_t_4 = (__pyx_v_c_node == NULL);
          if (__pyx_t_4) {

            /* "src/lxml/apihelpers.pxi":1294
 *                     c_node = next_element(c_node)
 *                     if c_node is NULL:
 *                         break             # <<<<<<<<<<<<<<
 *             break
 *     else:
*/
            goto __pyx_L33_break;

            /* "src/lxml/apihelpers.pxi":1293
 *                 for i in range(1, step):
 *                     c_node = next_element(c_node)
 *                     if c_node is NULL:             # <<<<<<<<<<<<<<
 *                         break
 *             break
*/
          }
        }
        __pyx_L33_break:;

        /* "src/lxml/apihelpers.pxi":1289
 *             _appendChild(parent, element)
 *             c_node = element._c_node
 *             if slicelength > 0:             # <<<<<<<<<<<<<<
 *                 slicelength -= 1
 *                 for i in range(1, step):
*/
      }

      /* "src/lxml/apihelpers.pxi":1295
 *                     if c_node is NULL:
 *                         break
 *             break             # <<<<<<<<<<<<<<
 *     else:
 *         c_node = c_orig_neighbour
*/
      goto __pyx_L30_break;

      /* "src/lxml/apihelpers.pxi":1285
 *         # at the end, but reversed stepping
 *         # append one element and go to the next insertion point
 *         for element in elements:             # <<<<<<<<<<<<<<
 *             assert element is not None, "Node must not be None"
 *             _appendChild(parent, element)
*/
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    goto __pyx_L35_for_end;
    __pyx_L30_break:;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    goto __pyx_L35_for_end;
    __pyx_L35_for_end:;

    /* "src/lxml/apihelpers.pxi":1282
 *             # before the first element
 *             c_node = _findChildForwards(parent._c_node, 0)
 *     elif c_orig_neighbour is NULL:             # <<<<<<<<<<<<<<
 *         # at the end, but reversed stepping
 *         # append one element and go to the next insertion point
*/
    goto __pyx_L27;
  }

  /* "src/lxml/apihelpers.pxi":1297
 *             break
 *     else:
 *         c_node = c_orig_neighbour             # <<<<<<<<<<<<<<
 * 
 *     if left_to_right:
*/
  /*else*/ {
    __pyx_v_c_node = __pyx_v_c_orig_neighbour;
  }
  __pyx_L27:;

  /* "src/lxml/apihelpers.pxi":1299
 *         c_node = c_orig_neighbour
 * 
 *     if left_to_right:             # <<<<<<<<<<<<<<
 *         # adjust step size after removing slice as we are not stepping
 *         # over the newly inserted elements
*/
  if (__pyx_v_left_to_right) {

    /* "src/lxml/apihelpers.pxi":1302
 *         # adjust step size after removing slice as we are not stepping
 *         # over the newly inserted elements
 *         step -= 1             # <<<<<<<<<<<<<<
 * 
 *     # now insert elements where we removed them
*/
    __pyx_v_step = (__pyx_v_step - 1);

    /* "src/lxml/apihelpers.pxi":1299
 *         c_node = c_orig_neighbour
 * 
 *     if left_to_right:             # <<<<<<<<<<<<<<
 *         # adjust step size after removing slice as we are not stepping
 *         # over the newly inserted elements
*/
  }

  /* "src/lxml/apihelpers.pxi":1305
 * 
 *     # now insert elements where we removed them
 *     if c_node is not NULL:             # <<<<<<<<<<<<<<
 *         for element in elements:
 *             assert element is not None, "Node must not be None"
*/
  __pyx_t_4 = (__pyx_v_c_node != NULL);
  if (__pyx_t_4) {

    /* "src/lxml/apihelpers.pxi":1306
 *     # now insert elements where we removed them
 *     if c_node is not NULL:
 *         for element in elements:             # <<<<<<<<<<<<<<
 *             assert element is not None, "Node must not be None"
 *             _assertValidNode(element)
*/
    if (likely(PyList_CheckExact(__pyx_v_elements)) || PyTuple_CheckExact(__pyx_v_elements)) {
      __pyx_t_7 = __pyx_v_elements; __Pyx_INCREF(__pyx_t_7);
      __pyx_t_5 = 0;
      __pyx_t_8 = NULL;
    } else {
      __pyx_t_5 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_v_elements); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 1306, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 1306, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_8)) {
        if (likely(PyList_CheckExact(__pyx_t_7))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_7);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(4, 1306, __pyx_L1_error)
            #endif
            if (__pyx_t_5 >= __pyx_temp) break;
          }
          __pyx_t_2 = __Pyx_PyList_GetItemRefFast(__pyx_t_7, __pyx_t_5, __Pyx_ReferenceSharing_OwnStrongReference);
          ++__pyx_t_5;
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_7);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(4, 1306, __pyx_L1_error)
            #endif
            if (__pyx_t_5 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_5));
          #else
          __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_7, __pyx_t_5);
          #endif
          ++__pyx_t_5;
        }
        if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 1306, __pyx_L1_error)
      } else {
        __pyx_t_2 = __pyx_t_8(__pyx_t_7);
        if (unlikely(!__pyx_t_2)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(4, 1306, __pyx_L1_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_2);
      if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element))))) __PYX_ERR(4, 1306, __pyx_L1_error)
      __Pyx_XDECREF_SET(__pyx_v_element, ((struct LxmlElement *)__pyx_t_2));
      __pyx_t_2 = 0;

      /* "src/lxml/apihelpers.pxi":1307
 *     if c_node is not NULL:
 *         for element in elements:
 *             assert element is not None, "Node must not be None"             # <<<<<<<<<<<<<<
 *             _assertValidNode(element)
 *             # move element and tail over
*/
      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(__pyx_assertions_enabled())) {
        __pyx_t_4 = (((PyObject *)__pyx_v_element) != Py_None);
        if (unlikely(!__pyx_t_4)) {
          __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_mstate_global->__pyx_kp_u_Node_must_not_be_None, 0, 0);
          __PYX_ERR(4, 1307, __pyx_L1_error)
        }
      }
      #else
      if ((1)); else __PYX_ERR(4, 1307, __pyx_L1_error)
      #endif

      /* "src/lxml/apihelpers.pxi":1308
 *         for element in elements:
 *             assert element is not None, "Node must not be None"
 *             _assertValidNode(element)             # <<<<<<<<<<<<<<
 *             # move element and tail over
 *             c_source_doc = element._c_node.doc
*/
      __pyx_t_9 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_element); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(4, 1308, __pyx_L1_error)

      /* "src/lxml/apihelpers.pxi":1310
 *             _assertValidNode(element)
 *             # move element and tail over
 *             c_source_doc = element._c_node.doc             # <<<<<<<<<<<<<<
 *             c_next = element._c_node.next
 *             tree.xmlAddPrevSibling(c_node, element._c_node)
*/
      __pyx_t_14 = __pyx_v_element->_c_node->doc;
      __pyx_v_c_source_doc = __pyx_t_14;

      /* "src/lxml/apihelpers.pxi":1311
 *             # move element and tail over
 *             c_source_doc = element._c_node.doc
 *             c_next = element._c_node.next             # <<<<<<<<<<<<<<
 *             tree.xmlAddPrevSibling(c_node, element._c_node)
 *             _moveTail(c_next, element._c_node)
*/
      __pyx_t_12 = __pyx_v_element->_c_node->next;
      __pyx_v_c_next = __pyx_t_12;

      /* "src/lxml/apihelpers.pxi":1312
 *             c_source_doc = element._c_node.doc
 *             c_next = element._c_node.next
 *             tree.xmlAddPrevSibling(c_node, element._c_node)             # <<<<<<<<<<<<<<
 *             _moveTail(c_next, element._c_node)
 * 
*/
      (void)(xmlAddPrevSibling(__pyx_v_c_node, __pyx_v_element->_c_node));

      /* "src/lxml/apihelpers.pxi":1313
 *             c_next = element._c_node.next
 *             tree.xmlAddPrevSibling(c_node, element._c_node)
 *             _moveTail(c_next, element._c_node)             # <<<<<<<<<<<<<<
 * 
 *             # integrate element into new document
*/
      __pyx_f_4lxml_5etree__moveTail(__pyx_v_c_next, __pyx_v_element->_c_node);

      /* "src/lxml/apihelpers.pxi":1316
 * 
 *             # integrate element into new document
 *             moveNodeToDocument(parent._doc, c_source_doc, element._c_node)             # <<<<<<<<<<<<<<
 * 
 *             # stop at the end of the slice
*/
      __pyx_t_2 = ((PyObject *)__pyx_v_parent->_doc);
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_9 = __pyx_f_4lxml_5etree_moveNodeToDocument(((struct LxmlDocument *)__pyx_t_2), __pyx_v_c_source_doc, __pyx_v_element->_c_node); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(4, 1316, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "src/lxml/apihelpers.pxi":1319
 * 
 *             # stop at the end of the slice
 *             if slicelength > 0:             # <<<<<<<<<<<<<<
 *                 slicelength -= 1
 *                 for i in range(step):
*/
      __pyx_t_4 = (__pyx_v_slicelength > 0);
      if (__pyx_t_4) {

        /* "src/lxml/apihelpers.pxi":1320
 *             # stop at the end of the slice
 *             if slicelength > 0:
 *                 slicelength -= 1             # <<<<<<<<<<<<<<
 *                 for i in range(step):
 *                     c_node = next_element(c_node)
*/
        __pyx_v_slicelength = (__pyx_v_slicelength - 1);

        /* "src/lxml/apihelpers.pxi":1321
 *             if slicelength > 0:
 *                 slicelength -= 1
 *                 for i in range(step):             # <<<<<<<<<<<<<<
 *                     c_node = next_element(c_node)
 *                     if c_node is NULL:
*/
        __pyx_t_10 = __pyx_v_step;
        __pyx_t_11 = __pyx_t_10;
        for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_11; __pyx_t_13+=1) {
          __pyx_v_i = __pyx_t_13;

          /* "src/lxml/apihelpers.pxi":1322
 *                 slicelength -= 1
 *                 for i in range(step):
 *                     c_node = next_element(c_node)             # <<<<<<<<<<<<<<
 *                     if c_node is NULL:
 *                         break
*/
          __pyx_t_12 = __pyx_v_next_element(__pyx_v_c_node); if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 1322, __pyx_L1_error)
          __pyx_v_c_node = __pyx_t_12;

          /* "src/lxml/apihelpers.pxi":1323
 *                 for i in range(step):
 *                     c_node = next_element(c_node)
 *                     if c_node is NULL:             # <<<<<<<<<<<<<<
 *                         break
 *                 if c_node is NULL:
*/
          __pyx_t_4 = (__pyx_v_c_node == NULL);
          if (__pyx_t_4) {

            /* "src/lxml/apihelpers.pxi":1324
 *                     c_node = next_element(c_node)
 *                     if c_node is NULL:
 *                         break             # <<<<<<<<<<<<<<
 *                 if c_node is NULL:
 *                     break
*/
            goto __pyx_L42_break;

            /* "src/lxml/apihelpers.pxi":1323
 *                 for i in range(step):
 *                     c_node = next_element(c_node)
 *                     if c_node is NULL:             # <<<<<<<<<<<<<<
 *                         break
 *                 if c_node is NULL:
*/
          }
        }
        __pyx_L42_break:;

        /* "src/lxml/apihelpers.pxi":1325
 *                     if c_node is NULL:
 *                         break
 *                 if c_node is NULL:             # <<<<<<<<<<<<<<
 *                     break
 *         else:
*/
        __pyx_t_4 = (__pyx_v_c_node == NULL);
        if (__pyx_t_4) {

          /* "src/lxml/apihelpers.pxi":1326
 *                         break
 *                 if c_node is NULL:
 *                     break             # <<<<<<<<<<<<<<
 *         else:
 *             # everything inserted
*/
          goto __pyx_L39_break;

          /* "src/lxml/apihelpers.pxi":1325
 *                     if c_node is NULL:
 *                         break
 *                 if c_node is NULL:             # <<<<<<<<<<<<<<
 *                     break
 *         else:
*/
        }

        /* "src/lxml/apihelpers.pxi":1319
 * 
 *             # stop at the end of the slice
 *             if slicelength > 0:             # <<<<<<<<<<<<<<
 *                 slicelength -= 1
 *                 for i in range(step):
*/
      }

      /* "src/lxml/apihelpers.pxi":1306
 *     # now insert elements where we removed them
 *     if c_node is not NULL:
 *         for element in elements:             # <<<<<<<<<<<<<<
 *             assert element is not None, "Node must not be None"
 *             _assertValidNode(element)
*/
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    goto __pyx_L45_for_else;
    __pyx_L39_break:;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    goto __pyx_L46_for_end;
    /*else*/ {
      __pyx_L45_for_else:;

      /* "src/lxml/apihelpers.pxi":1329
 *         else:
 *             # everything inserted
 *             return 0             # <<<<<<<<<<<<<<
 * 
 *     # append the remaining elements at the respective end
*/
      __pyx_r = 0;
      goto __pyx_L0;
    }
    __pyx_L46_for_end:;

    /* "src/lxml/apihelpers.pxi":1305
 * 
 *     # now insert elements where we removed them
 *     if c_node is not NULL:             # <<<<<<<<<<<<<<
 *         for element in elements:
 *             assert element is not None, "Node must not be None"
*/
  }

  /* "src/lxml/apihelpers.pxi":1332
 * 
 *     # append the remaining elements at the respective end
 *     if left_to_right:             # <<<<<<<<<<<<<<
 *         for element in elements:
 *             assert element is not None, "Node must not be None"
*/
  if (__pyx_v_left_to_right) {

    /* "src/lxml/apihelpers.pxi":1333
 *     # append the remaining elements at the respective end
 *     if left_to_right:
 *         for element in elements:             # <<<<<<<<<<<<<<
 *             assert element is not None, "Node must not be None"
 *             _assertValidNode(element)
*/
    if (likely(PyList_CheckExact(__pyx_v_elements)) || PyTuple_CheckExact(__pyx_v_elements)) {
      __pyx_t_7 = __pyx_v_elements; __Pyx_INCREF(__pyx_t_7);
      __pyx_t_5 = 0;
      __pyx_t_8 = NULL;
    } else {
      __pyx_t_5 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_v_elements); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 1333, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 1333, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_8)) {
        if (likely(PyList_CheckExact(__pyx_t_7))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_7);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(4, 1333, __pyx_L1_error)
            #endif
            if (__pyx_t_5 >= __pyx_temp) break;
          }
          __pyx_t_2 = __Pyx_PyList_GetItemRefFast(__pyx_t_7, __pyx_t_5, __Pyx_ReferenceSharing_OwnStrongReference);
          ++__pyx_t_5;
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_7);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(4, 1333, __pyx_L1_error)
            #endif
            if (__pyx_t_5 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_5));
          #else
          __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_7, __pyx_t_5);
          #endif
          ++__pyx_t_5;
        }
        if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 1333, __pyx_L1_error)
      } else {
        __pyx_t_2 = __pyx_t_8(__pyx_t_7);
        if (unlikely(!__pyx_t_2)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(4, 1333, __pyx_L1_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_2);
      if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element))))) __PYX_ERR(4, 1333, __pyx_L1_error)
      __Pyx_XDECREF_SET(__pyx_v_element, ((struct LxmlElement *)__pyx_t_2));
      __pyx_t_2 = 0;

      /* "src/lxml/apihelpers.pxi":1334
 *     if left_to_right:
 *         for element in elements:
 *             assert element is not None, "Node must not be None"             # <<<<<<<<<<<<<<
 *             _assertValidNode(element)
 *             _appendChild(parent, element)
*/
      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(__pyx_assertions_enabled())) {
        __pyx_t_4 = (((PyObject *)__pyx_v_element) != Py_None);
        if (unlikely(!__pyx_t_4)) {
          __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_mstate_global->__pyx_kp_u_Node_must_not_be_None, 0, 0);
          __PYX_ERR(4, 1334, __pyx_L1_error)
        }
      }
      #else
      if ((1)); else __PYX_ERR(4, 1334, __pyx_L1_error)
      #endif

      /* "src/lxml/apihelpers.pxi":1335
 *         for element in elements:
 *             assert element is not None, "Node must not be None"
 *             _assertValidNode(element)             # <<<<<<<<<<<<<<
 *             _appendChild(parent, element)
 *     else:
*/
      __pyx_t_9 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_element); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(4, 1335, __pyx_L1_error)

      /* "src/lxml/apihelpers.pxi":1336
 *             assert element is not None, "Node must not be None"
 *             _assertValidNode(element)
 *             _appendChild(parent, element)             # <<<<<<<<<<<<<<
 *     else:
 *         for element in elements:
*/
      __pyx_t_9 = __pyx_f_4lxml_5etree__appendChild(__pyx_v_parent, __pyx_v_element); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(4, 1336, __pyx_L1_error)

      /* "src/lxml/apihelpers.pxi":1333
 *     # append the remaining elements at the respective end
 *     if left_to_right:
 *         for element in elements:             # <<<<<<<<<<<<<<
 *             assert element is not None, "Node must not be None"
 *             _assertValidNode(element)
*/
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "src/lxml/apihelpers.pxi":1332
 * 
 *     # append the remaining elements at the respective end
 *     if left_to_right:             # <<<<<<<<<<<<<<
 *         for element in elements:
 *             assert element is not None, "Node must not be None"
*/
    goto __pyx_L47;
  }

  /* "src/lxml/apihelpers.pxi":1338
 *             _appendChild(parent, element)
 *     else:
 *         for element in elements:             # <<<<<<<<<<<<<<
 *             assert element is not None, "Node must not be None"
 *             _assertValidNode(element)
*/
  /*else*/ {
    if (likely(PyList_CheckExact(__pyx_v_elements)) || PyTuple_CheckExact(__pyx_v_elements)) {
      __pyx_t_7 = __pyx_v_elements; __Pyx_INCREF(__pyx_t_7);
      __pyx_t_5 = 0;
      __pyx_t_8 = NULL;
    } else {
      __pyx_t_5 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_v_elements); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 1338, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 1338, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_8)) {
        if (likely(PyList_CheckExact(__pyx_t_7))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_7);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(4, 1338, __pyx_L1_error)
            #endif
            if (__pyx_t_5 >= __pyx_temp) break;
          }
          __pyx_t_2 = __Pyx_PyList_GetItemRefFast(__pyx_t_7, __pyx_t_5, __Pyx_ReferenceSharing_OwnStrongReference);
          ++__pyx_t_5;
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_7);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(4, 1338, __pyx_L1_error)
            #endif
            if (__pyx_t_5 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_5));
          #else
          __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_7, __pyx_t_5);
          #endif
          ++__pyx_t_5;
        }
        if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 1338, __pyx_L1_error)
      } else {
        __pyx_t_2 = __pyx_t_8(__pyx_t_7);
        if (unlikely(!__pyx_t_2)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(4, 1338, __pyx_L1_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_2);
      if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element))))) __PYX_ERR(4, 1338, __pyx_L1_error)
      __Pyx_XDECREF_SET(__pyx_v_element, ((struct LxmlElement *)__pyx_t_2));
      __pyx_t_2 = 0;

      /* "src/lxml/apihelpers.pxi":1339
 *     else:
 *         for element in elements:
 *             assert element is not None, "Node must not be None"             # <<<<<<<<<<<<<<
 *             _assertValidNode(element)
 *             _prependChild(parent, element)
*/
      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(__pyx_assertions_enabled())) {
        __pyx_t_4 = (((PyObject *)__pyx_v_element) != Py_None);
        if (unlikely(!__pyx_t_4)) {
          __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_mstate_global->__pyx_kp_u_Node_must_not_be_None, 0, 0);
          __PYX_ERR(4, 1339, __pyx_L1_error)
        }
      }
      #else
      if ((1)); else __PYX_ERR(4, 1339, __pyx_L1_error)
      #endif

      /* "src/lxml/apihelpers.pxi":1340
 *         for element in elements:
 *             assert element is not None, "Node must not be None"
 *             _assertValidNode(element)             # <<<<<<<<<<<<<<
 *             _prependChild(parent, element)
 * 
*/
      __pyx_t_9 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_element); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(4, 1340, __pyx_L1_error)

      /* "src/lxml/apihelpers.pxi":1341
 *             assert element is not None, "Node must not be None"
 *             _assertValidNode(element)
 *             _prependChild(parent, element)             # <<<<<<<<<<<<<<
 * 
 *     return 0
*/
      __pyx_t_9 = __pyx_f_4lxml_5etree__prependChild(__pyx_v_parent, __pyx_v_element); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(4, 1341, __pyx_L1_error)

      /* "src/lxml/apihelpers.pxi":1338
 *             _appendChild(parent, element)
 *     else:
 *         for element in elements:             # <<<<<<<<<<<<<<
 *             assert element is not None, "Node must not be None"
 *             _assertValidNode(element)
*/
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __pyx_L47:;

  /* "src/lxml/apihelpers.pxi":1343
 *             _prependChild(parent, element)
 * 
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1206
 *     return 0
 * 
 * cdef int _replaceSlice(_Element parent, xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                        Py_ssize_t slicelength, Py_ssize_t step,
 *                        bint left_to_right, elements) except -1:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree._replaceSlice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_element);
  __Pyx_XDECREF(__pyx_v_elements);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":1346
 * 
 * 
 * cdef int _linkChild(xmlNode* c_parent, xmlNode* c_node) except -1:             # <<<<<<<<<<<<<<
 *     """Adaptation of 'xmlAddChild()' that deep-fix the document links iteratively.
 *     """
*/

static int __pyx_f_4lxml_5etree__linkChild(xmlNode *__pyx_v_c_parent, xmlNode *__pyx_v_c_node) {
  int __pyx_r;
  int __pyx_t_1;
  xmlNode *__pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/apihelpers.pxi":1349
 *     """Adaptation of 'xmlAddChild()' that deep-fix the document links iteratively.
 *     """
 *     assert _isElement(c_node)             # <<<<<<<<<<<<<<
 *     c_node.parent = c_parent
 *     if c_parent.children is NULL:
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = _isElement(__pyx_v_c_node);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
      __PYX_ERR(4, 1349, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(4, 1349, __pyx_L1_error)
  #endif

  /* "src/lxml/apihelpers.pxi":1350
 *     """
 *     assert _isElement(c_node)
 *     c_node.parent = c_parent             # <<<<<<<<<<<<<<
 *     if c_parent.children is NULL:
 *         c_parent.children = c_parent.last = c_node
*/
  __pyx_v_c_node->parent = __pyx_v_c_parent;

  /* "src/lxml/apihelpers.pxi":1351
 *     assert _isElement(c_node)
 *     c_node.parent = c_parent
 *     if c_parent.children is NULL:             # <<<<<<<<<<<<<<
 *         c_parent.children = c_parent.last = c_node
 *     else:
*/
  __pyx_t_1 = (__pyx_v_c_parent->children == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":1352
 *     c_node.parent = c_parent
 *     if c_parent.children is NULL:
 *         c_parent.children = c_parent.last = c_node             # <<<<<<<<<<<<<<
 *     else:
 *         c_node.prev = c_parent.last
*/
    __pyx_v_c_parent->children = __pyx_v_c_node;
    __pyx_v_c_parent->last = __pyx_v_c_node;

    /* "src/lxml/apihelpers.pxi":1351
 *     assert _isElement(c_node)
 *     c_node.parent = c_parent
 *     if c_parent.children is NULL:             # <<<<<<<<<<<<<<
 *         c_parent.children = c_parent.last = c_node
 *     else:
*/
    goto __pyx_L3;
  }

  /* "src/lxml/apihelpers.pxi":1354
 *         c_parent.children = c_parent.last = c_node
 *     else:
 *         c_node.prev = c_parent.last             # <<<<<<<<<<<<<<
 *         c_parent.last.next = c_node
 *         c_parent.last = c_node
*/
  /*else*/ {
    __pyx_t_2 = __pyx_v_c_parent->last;
    __pyx_v_c_node->prev = __pyx_t_2;

    /* "src/lxml/apihelpers.pxi":1355
 *     else:
 *         c_node.prev = c_parent.last
 *         c_parent.last.next = c_node             # <<<<<<<<<<<<<<
 *         c_parent.last = c_node
 * 
*/
    __pyx_v_c_parent->last->next = __pyx_v_c_node;

    /* "src/lxml/apihelpers.pxi":1356
 *         c_node.prev = c_parent.last
 *         c_parent.last.next = c_node
 *         c_parent.last = c_node             # <<<<<<<<<<<<<<
 * 
 *     _setTreeDoc(c_node, c_parent.doc)
*/
    __pyx_v_c_parent->last = __pyx_v_c_node;
  }
  __pyx_L3:;

  /* "src/lxml/apihelpers.pxi":1358
 *         c_parent.last = c_node
 * 
 *     _setTreeDoc(c_node, c_parent.doc)             # <<<<<<<<<<<<<<
 *     return 0
 * 
*/
  __pyx_f_4lxml_5etree__setTreeDoc(__pyx_v_c_node, __pyx_v_c_parent->doc);

  /* "src/lxml/apihelpers.pxi":1359
 * 
 *     _setTreeDoc(c_node, c_parent.doc)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1346
 * 
 * 
 * cdef int _linkChild(xmlNode* c_parent, xmlNode* c_node) except -1:             # <<<<<<<<<<<<<<
 *     """Adaptation of 'xmlAddChild()' that deep-fix the document links iteratively.
 *     """
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._linkChild", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":1362
 * 
 * 
 * cdef int _appendChild(_Element parent, _Element child) except -1:             # <<<<<<<<<<<<<<
 *     """Append a new child to a parent element.
 *     """
*/

static int __pyx_f_4lxml_5etree__appendChild(struct LxmlElement *__pyx_v_parent, struct LxmlElement *__pyx_v_child) {
  xmlNode *__pyx_v_c_node;
  xmlDoc *__pyx_v_c_source_doc;
  xmlNode *__pyx_v_c_next;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  xmlNode *__pyx_t_1;
  xmlDoc *__pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_appendChild", 0);

  /* "src/lxml/apihelpers.pxi":1365
 *     """Append a new child to a parent element.
 *     """
 *     c_node = child._c_node             # <<<<<<<<<<<<<<
 *     c_source_doc = c_node.doc
 *     # prevent cycles
*/
  __pyx_t_1 = __pyx_v_child->_c_node;
  __pyx_v_c_node = __pyx_t_1;

  /* "src/lxml/apihelpers.pxi":1366
 *     """
 *     c_node = child._c_node
 *     c_source_doc = c_node.doc             # <<<<<<<<<<<<<<
 *     # prevent cycles
 *     if _isAncestorOrSame(c_node, parent._c_node):
*/
  __pyx_t_2 = __pyx_v_c_node->doc;
  __pyx_v_c_source_doc = __pyx_t_2;

  /* "src/lxml/apihelpers.pxi":1368
 *     c_source_doc = c_node.doc
 *     # prevent cycles
 *     if _isAncestorOrSame(c_node, parent._c_node):             # <<<<<<<<<<<<<<
 *         raise ValueError("cannot append parent to itself")
 *     # store possible text node
*/
  __pyx_t_3 = __pyx_f_4lxml_5etree__isAncestorOrSame(__pyx_v_c_node, __pyx_v_parent->_c_node);
  if (unlikely(__pyx_t_3)) {

    /* "src/lxml/apihelpers.pxi":1369
 *     # prevent cycles
 *     if _isAncestorOrSame(c_node, parent._c_node):
 *         raise ValueError("cannot append parent to itself")             # <<<<<<<<<<<<<<
 *     # store possible text node
 *     c_next = c_node.next
*/
    __pyx_t_5 = NULL;
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_cannot_append_parent_to_itself};
      __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 1369, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __PYX_ERR(4, 1369, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":1368
 *     c_source_doc = c_node.doc
 *     # prevent cycles
 *     if _isAncestorOrSame(c_node, parent._c_node):             # <<<<<<<<<<<<<<
 *         raise ValueError("cannot append parent to itself")
 *     # store possible text node
*/
  }

  /* "src/lxml/apihelpers.pxi":1371
 *         raise ValueError("cannot append parent to itself")
 *     # store possible text node
 *     c_next = c_node.next             # <<<<<<<<<<<<<<
 *     # move node itself
 *     tree.xmlUnlinkNode(c_node)
*/
  __pyx_t_1 = __pyx_v_c_node->next;
  __pyx_v_c_next = __pyx_t_1;

  /* "src/lxml/apihelpers.pxi":1373
 *     c_next = c_node.next
 *     # move node itself
 *     tree.xmlUnlinkNode(c_node)             # <<<<<<<<<<<<<<
 *     # do not call xmlAddChild() here since it would deep-traverse the tree
 *     _linkChild(parent._c_node, c_node)
*/
  xmlUnlinkNode(__pyx_v_c_node);

  /* "src/lxml/apihelpers.pxi":1375
 *     tree.xmlUnlinkNode(c_node)
 *     # do not call xmlAddChild() here since it would deep-traverse the tree
 *     _linkChild(parent._c_node, c_node)             # <<<<<<<<<<<<<<
 *     _moveTail(c_next, c_node)
 *     # uh oh, elements may be pointing to different doc when
*/
  __pyx_t_7 = __pyx_f_4lxml_5etree__linkChild(__pyx_v_parent->_c_node, __pyx_v_c_node); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(4, 1375, __pyx_L1_error)

  /* "src/lxml/apihelpers.pxi":1376
 *     # do not call xmlAddChild() here since it would deep-traverse the tree
 *     _linkChild(parent._c_node, c_node)
 *     _moveTail(c_next, c_node)             # <<<<<<<<<<<<<<
 *     # uh oh, elements may be pointing to different doc when
 *     # parent element has moved; change them too..
*/
  __pyx_f_4lxml_5etree__moveTail(__pyx_v_c_next, __pyx_v_c_node);

  /* "src/lxml/apihelpers.pxi":1379
 *     # uh oh, elements may be pointing to different doc when
 *     # parent element has moved; change them too..
 *     moveNodeToDocument(parent._doc, c_source_doc, c_node)             # <<<<<<<<<<<<<<
 *     return 0
 * 
*/
  __pyx_t_4 = ((PyObject *)__pyx_v_parent->_doc);
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_7 = __pyx_f_4lxml_5etree_moveNodeToDocument(((struct LxmlDocument *)__pyx_t_4), __pyx_v_c_source_doc, __pyx_v_c_node); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(4, 1379, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "src/lxml/apihelpers.pxi":1380
 *     # parent element has moved; change them too..
 *     moveNodeToDocument(parent._doc, c_source_doc, c_node)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int _prependChild(_Element parent, _Element child) except -1:
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1362
 * 
 * 
 * cdef int _appendChild(_Element parent, _Element child) except -1:             # <<<<<<<<<<<<<<
 *     """Append a new child to a parent element.
 *     """
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._appendChild", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":1382
 *     return 0
 * 
 * cdef int _prependChild(_Element parent, _Element child) except -1:             # <<<<<<<<<<<<<<
 *     """Prepend a new child to a parent element.
 *     """
*/

static int __pyx_f_4lxml_5etree__prependChild(struct LxmlElement *__pyx_v_parent, struct LxmlElement *__pyx_v_child) {
  xmlNode *__pyx_v_c_node;
  xmlDoc *__pyx_v_c_source_doc;
  xmlNode *__pyx_v_c_next;
  xmlNode *__pyx_v_c_child;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  xmlNode *__pyx_t_1;
  xmlDoc *__pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_prependChild", 0);

  /* "src/lxml/apihelpers.pxi":1385
 *     """Prepend a new child to a parent element.
 *     """
 *     c_node = child._c_node             # <<<<<<<<<<<<<<
 *     c_source_doc = c_node.doc
 *     # prevent cycles
*/
  __pyx_t_1 = __pyx_v_child->_c_node;
  __pyx_v_c_node = __pyx_t_1;

  /* "src/lxml/apihelpers.pxi":1386
 *     """
 *     c_node = child._c_node
 *     c_source_doc = c_node.doc             # <<<<<<<<<<<<<<
 *     # prevent cycles
 *     if _isAncestorOrSame(c_node, parent._c_node):
*/
  __pyx_t_2 = __pyx_v_c_node->doc;
  __pyx_v_c_source_doc = __pyx_t_2;

  /* "src/lxml/apihelpers.pxi":1388
 *     c_source_doc = c_node.doc
 *     # prevent cycles
 *     if _isAncestorOrSame(c_node, parent._c_node):             # <<<<<<<<<<<<<<
 *         raise ValueError("cannot append parent to itself")
 *     # store possible text node
*/
  __pyx_t_3 = __pyx_f_4lxml_5etree__isAncestorOrSame(__pyx_v_c_node, __pyx_v_parent->_c_node);
  if (unlikely(__pyx_t_3)) {

    /* "src/lxml/apihelpers.pxi":1389
 *     # prevent cycles
 *     if _isAncestorOrSame(c_node, parent._c_node):
 *         raise ValueError("cannot append parent to itself")             # <<<<<<<<<<<<<<
 *     # store possible text node
 *     c_next = c_node.next
*/
    __pyx_t_5 = NULL;
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_cannot_append_parent_to_itself};
      __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 1389, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __PYX_ERR(4, 1389, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":1388
 *     c_source_doc = c_node.doc
 *     # prevent cycles
 *     if _isAncestorOrSame(c_node, parent._c_node):             # <<<<<<<<<<<<<<
 *         raise ValueError("cannot append parent to itself")
 *     # store possible text node
*/
  }

  /* "src/lxml/apihelpers.pxi":1391
 *         raise ValueError("cannot append parent to itself")
 *     # store possible text node
 *     c_next = c_node.next             # <<<<<<<<<<<<<<
 *     # move node itself
 *     c_child = _findChildForwards(parent._c_node, 0)
*/
  __pyx_t_1 = __pyx_v_c_node->next;
  __pyx_v_c_next = __pyx_t_1;

  /* "src/lxml/apihelpers.pxi":1393
 *     c_next = c_node.next
 *     # move node itself
 *     c_child = _findChildForwards(parent._c_node, 0)             # <<<<<<<<<<<<<<
 *     if c_child is NULL:
 *         tree.xmlUnlinkNode(c_node)
*/
  __pyx_v_c_child = __pyx_f_4lxml_5etree__findChildForwards(__pyx_v_parent->_c_node, 0);

  /* "src/lxml/apihelpers.pxi":1394
 *     # move node itself
 *     c_child = _findChildForwards(parent._c_node, 0)
 *     if c_child is NULL:             # <<<<<<<<<<<<<<
 *         tree.xmlUnlinkNode(c_node)
 *         # do not call xmlAddChild() here since it would deep-traverse the tree
*/
  __pyx_t_3 = (__pyx_v_c_child == NULL);
  if (__pyx_t_3) {

    /* "src/lxml/apihelpers.pxi":1395
 *     c_child = _findChildForwards(parent._c_node, 0)
 *     if c_child is NULL:
 *         tree.xmlUnlinkNode(c_node)             # <<<<<<<<<<<<<<
 *         # do not call xmlAddChild() here since it would deep-traverse the tree
 *         _linkChild(parent._c_node, c_node)
*/
    xmlUnlinkNode(__pyx_v_c_node);

    /* "src/lxml/apihelpers.pxi":1397
 *         tree.xmlUnlinkNode(c_node)
 *         # do not call xmlAddChild() here since it would deep-traverse the tree
 *         _linkChild(parent._c_node, c_node)             # <<<<<<<<<<<<<<
 *     else:
 *         tree.xmlAddPrevSibling(c_child, c_node)
*/
    __pyx_t_7 = __pyx_f_4lxml_5etree__linkChild(__pyx_v_parent->_c_node, __pyx_v_c_node); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(4, 1397, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":1394
 *     # move node itself
 *     c_child = _findChildForwards(parent._c_node, 0)
 *     if c_child is NULL:             # <<<<<<<<<<<<<<
 *         tree.xmlUnlinkNode(c_node)
 *         # do not call xmlAddChild() here since it would deep-traverse the tree
*/
    goto __pyx_L4;
  }

  /* "src/lxml/apihelpers.pxi":1399
 *         _linkChild(parent._c_node, c_node)
 *     else:
 *         tree.xmlAddPrevSibling(c_child, c_node)             # <<<<<<<<<<<<<<
 *     _moveTail(c_next, c_node)
 *     # uh oh, elements may be pointing to different doc when
*/
  /*else*/ {
    (void)(xmlAddPrevSibling(__pyx_v_c_child, __pyx_v_c_node));
  }
  __pyx_L4:;

  /* "src/lxml/apihelpers.pxi":1400
 *     else:
 *         tree.xmlAddPrevSibling(c_child, c_node)
 *     _moveTail(c_next, c_node)             # <<<<<<<<<<<<<<
 *     # uh oh, elements may be pointing to different doc when
 *     # parent element has moved; change them too..
*/
  __pyx_f_4lxml_5etree__moveTail(__pyx_v_c_next, __pyx_v_c_node);

  /* "src/lxml/apihelpers.pxi":1403
 *     # uh oh, elements may be pointing to different doc when
 *     # parent element has moved; change them too..
 *     moveNodeToDocument(parent._doc, c_source_doc, c_node)             # <<<<<<<<<<<<<<
 *     return 0
 * 
*/
  __pyx_t_4 = ((PyObject *)__pyx_v_parent->_doc);
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_7 = __pyx_f_4lxml_5etree_moveNodeToDocument(((struct LxmlDocument *)__pyx_t_4), __pyx_v_c_source_doc, __pyx_v_c_node); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(4, 1403, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "src/lxml/apihelpers.pxi":1404
 *     # parent element has moved; change them too..
 *     moveNodeToDocument(parent._doc, c_source_doc, c_node)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int _appendSibling(_Element element, _Element sibling) except -1:
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1382
 *     return 0
 * 
 * cdef int _prependChild(_Element parent, _Element child) except -1:             # <<<<<<<<<<<<<<
 *     """Prepend a new child to a parent element.
 *     """
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._prependChild", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":1406
 *     return 0
 * 
 * cdef int _appendSibling(_Element element, _Element sibling) except -1:             # <<<<<<<<<<<<<<
 *     """Add a new sibling behind an element.
 *     """
*/

static int __pyx_f_4lxml_5etree__appendSibling(struct LxmlElement *__pyx_v_element, struct LxmlElement *__pyx_v_sibling) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/apihelpers.pxi":1409
 *     """Add a new sibling behind an element.
 *     """
 *     return _addSibling(element, sibling, as_next=True)             # <<<<<<<<<<<<<<
 * 
 * cdef int _prependSibling(_Element element, _Element sibling) except -1:
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__addSibling(__pyx_v_element, __pyx_v_sibling, 1); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(4, 1409, __pyx_L1_error)
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1406
 *     return 0
 * 
 * cdef int _appendSibling(_Element element, _Element sibling) except -1:             # <<<<<<<<<<<<<<
 *     """Add a new sibling behind an element.
 *     """
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._appendSibling", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":1411
 *     return _addSibling(element, sibling, as_next=True)
 * 
 * cdef int _prependSibling(_Element element, _Element sibling) except -1:             # <<<<<<<<<<<<<<
 *     """Add a new sibling before an element.
 *     """
*/

static int __pyx_f_4lxml_5etree__prependSibling(struct LxmlElement *__pyx_v_element, struct LxmlElement *__pyx_v_sibling) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/apihelpers.pxi":1414
 *     """Add a new sibling before an element.
 *     """
 *     return _addSibling(element, sibling, as_next=False)             # <<<<<<<<<<<<<<
 * 
 * cdef int _addSibling(_Element element, _Element sibling, bint as_next) except -1:
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__addSibling(__pyx_v_element, __pyx_v_sibling, 0); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(4, 1414, __pyx_L1_error)
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1411
 *     return _addSibling(element, sibling, as_next=True)
 * 
 * cdef int _prependSibling(_Element element, _Element sibling) except -1:             # <<<<<<<<<<<<<<
 *     """Add a new sibling before an element.
 *     """
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._prependSibling", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":1416
 *     return _addSibling(element, sibling, as_next=False)
 * 
 * cdef int _addSibling(_Element element, _Element sibling, bint as_next) except -1:             # <<<<<<<<<<<<<<
 *     c_node = sibling._c_node
 *     c_source_doc = c_node.doc
*/

static int __pyx_f_4lxml_5etree__addSibling(struct LxmlElement *__pyx_v_element, struct LxmlElement *__pyx_v_sibling, int __pyx_v_as_next) {
  xmlNode *__pyx_v_c_node;
  xmlDoc *__pyx_v_c_source_doc;
  xmlNode *__pyx_v_c_next;
  xmlNode *__pyx_v_c_next_node;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  xmlNode *__pyx_t_1;
  xmlDoc *__pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_addSibling", 0);

  /* "src/lxml/apihelpers.pxi":1417
 * 
 * cdef int _addSibling(_Element element, _Element sibling, bint as_next) except -1:
 *     c_node = sibling._c_node             # <<<<<<<<<<<<<<
 *     c_source_doc = c_node.doc
 *     # prevent cycles
*/
  __pyx_t_1 = __pyx_v_sibling->_c_node;
  __pyx_v_c_node = __pyx_t_1;

  /* "src/lxml/apihelpers.pxi":1418
 * cdef int _addSibling(_Element element, _Element sibling, bint as_next) except -1:
 *     c_node = sibling._c_node
 *     c_source_doc = c_node.doc             # <<<<<<<<<<<<<<
 *     # prevent cycles
 *     if _isAncestorOrSame(c_node, element._c_node):
*/
  __pyx_t_2 = __pyx_v_c_node->doc;
  __pyx_v_c_source_doc = __pyx_t_2;

  /* "src/lxml/apihelpers.pxi":1420
 *     c_source_doc = c_node.doc
 *     # prevent cycles
 *     if _isAncestorOrSame(c_node, element._c_node):             # <<<<<<<<<<<<<<
 *         if element._c_node is c_node:
 *             return 0  # nothing to do
*/
  __pyx_t_3 = __pyx_f_4lxml_5etree__isAncestorOrSame(__pyx_v_c_node, __pyx_v_element->_c_node);
  if (__pyx_t_3) {

    /* "src/lxml/apihelpers.pxi":1421
 *     # prevent cycles
 *     if _isAncestorOrSame(c_node, element._c_node):
 *         if element._c_node is c_node:             # <<<<<<<<<<<<<<
 *             return 0  # nothing to do
 *         raise ValueError("cannot add ancestor as sibling, please break cycle first")
*/
    __pyx_t_3 = (__pyx_v_element->_c_node == __pyx_v_c_node);
    if (__pyx_t_3) {

      /* "src/lxml/apihelpers.pxi":1422
 *     if _isAncestorOrSame(c_node, element._c_node):
 *         if element._c_node is c_node:
 *             return 0  # nothing to do             # <<<<<<<<<<<<<<
 *         raise ValueError("cannot add ancestor as sibling, please break cycle first")
 *     # store possible text node
*/
      __pyx_r = 0;
      goto __pyx_L0;

      /* "src/lxml/apihelpers.pxi":1421
 *     # prevent cycles
 *     if _isAncestorOrSame(c_node, element._c_node):
 *         if element._c_node is c_node:             # <<<<<<<<<<<<<<
 *             return 0  # nothing to do
 *         raise ValueError("cannot add ancestor as sibling, please break cycle first")
*/
    }

    /* "src/lxml/apihelpers.pxi":1423
 *         if element._c_node is c_node:
 *             return 0  # nothing to do
 *         raise ValueError("cannot add ancestor as sibling, please break cycle first")             # <<<<<<<<<<<<<<
 *     # store possible text node
 *     c_next = c_node.next
*/
    __pyx_t_5 = NULL;
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_cannot_add_ancestor_as_sibling_p};
      __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 1423, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __PYX_ERR(4, 1423, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":1420
 *     c_source_doc = c_node.doc
 *     # prevent cycles
 *     if _isAncestorOrSame(c_node, element._c_node):             # <<<<<<<<<<<<<<
 *         if element._c_node is c_node:
 *             return 0  # nothing to do
*/
  }

  /* "src/lxml/apihelpers.pxi":1425
 *         raise ValueError("cannot add ancestor as sibling, please break cycle first")
 *     # store possible text node
 *     c_next = c_node.next             # <<<<<<<<<<<<<<
 *     # move node itself
 *     if as_next:
*/
  __pyx_t_1 = __pyx_v_c_node->next;
  __pyx_v_c_next = __pyx_t_1;

  /* "src/lxml/apihelpers.pxi":1427
 *     c_next = c_node.next
 *     # move node itself
 *     if as_next:             # <<<<<<<<<<<<<<
 *         # must insert after any tail text
 *         c_next_node = _nextElement(element._c_node)
*/
  if (__pyx_v_as_next) {

    /* "src/lxml/apihelpers.pxi":1429
 *     if as_next:
 *         # must insert after any tail text
 *         c_next_node = _nextElement(element._c_node)             # <<<<<<<<<<<<<<
 *         if c_next_node is NULL:
 *             c_next_node = element._c_node
*/
    __pyx_v_c_next_node = __pyx_f_4lxml_5etree__nextElement(__pyx_v_element->_c_node);

    /* "src/lxml/apihelpers.pxi":1430
 *         # must insert after any tail text
 *         c_next_node = _nextElement(element._c_node)
 *         if c_next_node is NULL:             # <<<<<<<<<<<<<<
 *             c_next_node = element._c_node
 *             while c_next_node.next:
*/
    __pyx_t_3 = (__pyx_v_c_next_node == NULL);
    if (__pyx_t_3) {

      /* "src/lxml/apihelpers.pxi":1431
 *         c_next_node = _nextElement(element._c_node)
 *         if c_next_node is NULL:
 *             c_next_node = element._c_node             # <<<<<<<<<<<<<<
 *             while c_next_node.next:
 *                 c_next_node = c_next_node.next
*/
      __pyx_t_1 = __pyx_v_element->_c_node;
      __pyx_v_c_next_node = __pyx_t_1;

      /* "src/lxml/apihelpers.pxi":1432
 *         if c_next_node is NULL:
 *             c_next_node = element._c_node
 *             while c_next_node.next:             # <<<<<<<<<<<<<<
 *                 c_next_node = c_next_node.next
 *             tree.xmlAddNextSibling(c_next_node, c_node)
*/
      while (1) {
        __pyx_t_3 = (__pyx_v_c_next_node->next != 0);
        if (!__pyx_t_3) break;

        /* "src/lxml/apihelpers.pxi":1433
 *             c_next_node = element._c_node
 *             while c_next_node.next:
 *                 c_next_node = c_next_node.next             # <<<<<<<<<<<<<<
 *             tree.xmlAddNextSibling(c_next_node, c_node)
 *         else:
*/
        __pyx_t_1 = __pyx_v_c_next_node->next;
        __pyx_v_c_next_node = __pyx_t_1;
      }

      /* "src/lxml/apihelpers.pxi":1434
 *             while c_next_node.next:
 *                 c_next_node = c_next_node.next
 *             tree.xmlAddNextSibling(c_next_node, c_node)             # <<<<<<<<<<<<<<
 *         else:
 *             tree.xmlAddPrevSibling(c_next_node, c_node)
*/
      (void)(xmlAddNextSibling(__pyx_v_c_next_node, __pyx_v_c_node));

      /* "src/lxml/apihelpers.pxi":1430
 *         # must insert after any tail text
 *         c_next_node = _nextElement(element._c_node)
 *         if c_next_node is NULL:             # <<<<<<<<<<<<<<
 *             c_next_node = element._c_node
 *             while c_next_node.next:
*/
      goto __pyx_L6;
    }

    /* "src/lxml/apihelpers.pxi":1436
 *             tree.xmlAddNextSibling(c_next_node, c_node)
 *         else:
 *             tree.xmlAddPrevSibling(c_next_node, c_node)             # <<<<<<<<<<<<<<
 *     else:
 *         tree.xmlAddPrevSibling(element._c_node, c_node)
*/
    /*else*/ {
      (void)(xmlAddPrevSibling(__pyx_v_c_next_node, __pyx_v_c_node));
    }
    __pyx_L6:;

    /* "src/lxml/apihelpers.pxi":1427
 *     c_next = c_node.next
 *     # move node itself
 *     if as_next:             # <<<<<<<<<<<<<<
 *         # must insert after any tail text
 *         c_next_node = _nextElement(element._c_node)
*/
    goto __pyx_L5;
  }

  /* "src/lxml/apihelpers.pxi":1438
 *             tree.xmlAddPrevSibling(c_next_node, c_node)
 *     else:
 *         tree.xmlAddPrevSibling(element._c_node, c_node)             # <<<<<<<<<<<<<<
 *     _moveTail(c_next, c_node)
 *     # uh oh, elements may be pointing to different doc when
*/
  /*else*/ {
    (void)(xmlAddPrevSibling(__pyx_v_element->_c_node, __pyx_v_c_node));
  }
  __pyx_L5:;

  /* "src/lxml/apihelpers.pxi":1439
 *     else:
 *         tree.xmlAddPrevSibling(element._c_node, c_node)
 *     _moveTail(c_next, c_node)             # <<<<<<<<<<<<<<
 *     # uh oh, elements may be pointing to different doc when
 *     # parent element has moved; change them too..
*/
  __pyx_f_4lxml_5etree__moveTail(__pyx_v_c_next, __pyx_v_c_node);

  /* "src/lxml/apihelpers.pxi":1442
 *     # uh oh, elements may be pointing to different doc when
 *     # parent element has moved; change them too..
 *     moveNodeToDocument(element._doc, c_source_doc, c_node)             # <<<<<<<<<<<<<<
 *     return 0
 * 
*/
  __pyx_t_4 = ((PyObject *)__pyx_v_element->_doc);
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_7 = __pyx_f_4lxml_5etree_moveNodeToDocument(((struct LxmlDocument *)__pyx_t_4), __pyx_v_c_source_doc, __pyx_v_c_node); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(4, 1442, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "src/lxml/apihelpers.pxi":1443
 *     # parent element has moved; change them too..
 *     moveNodeToDocument(element._doc, c_source_doc, c_node)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef inline bint isutf8(const_xmlChar* s) noexcept:
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1416
 *     return _addSibling(element, sibling, as_next=False)
 * 
 * cdef int _addSibling(_Element element, _Element sibling, bint as_next) except -1:             # <<<<<<<<<<<<<<
 *     c_node = sibling._c_node
 *     c_source_doc = c_node.doc
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._addSibling", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":1445
 *     return 0
 * 
 * cdef inline bint isutf8(const_xmlChar* s) noexcept:             # <<<<<<<<<<<<<<
 *     cdef xmlChar c = s[0]
 *     while c != c'\0':
*/

static CYTHON_INLINE int __pyx_f_4lxml_5etree_isutf8(const xmlChar *__pyx_v_s) {
  xmlChar __pyx_v_c;
  int __pyx_r;
  int __pyx_t_1;

  /* "src/lxml/apihelpers.pxi":1446
 * 
 * cdef inline bint isutf8(const_xmlChar* s) noexcept:
 *     cdef xmlChar c = s[0]             # <<<<<<<<<<<<<<
 *     while c != c'\0':
 *         if c & 0x80:
*/
  __pyx_v_c = (__pyx_v_s[0]);

  /* "src/lxml/apihelpers.pxi":1447
 * cdef inline bint isutf8(const_xmlChar* s) noexcept:
 *     cdef xmlChar c = s[0]
 *     while c != c'\0':             # <<<<<<<<<<<<<<
 *         if c & 0x80:
 *             return True
*/
  while (1) {
    __pyx_t_1 = (__pyx_v_c != '\x00');
    if (!__pyx_t_1) break;

    /* "src/lxml/apihelpers.pxi":1448
 *     cdef xmlChar c = s[0]
 *     while c != c'\0':
 *         if c & 0x80:             # <<<<<<<<<<<<<<
 *             return True
 *         s += 1
*/
    __pyx_t_1 = ((__pyx_v_c & 0x80) != 0);
    if (__pyx_t_1) {

      /* "src/lxml/apihelpers.pxi":1449
 *     while c != c'\0':
 *         if c & 0x80:
 *             return True             # <<<<<<<<<<<<<<
 *         s += 1
 *         c = s[0]
*/
      __pyx_r = 1;
      goto __pyx_L0;

      /* "src/lxml/apihelpers.pxi":1448
 *     cdef xmlChar c = s[0]
 *     while c != c'\0':
 *         if c & 0x80:             # <<<<<<<<<<<<<<
 *             return True
 *         s += 1
*/
    }

    /* "src/lxml/apihelpers.pxi":1450
 *         if c & 0x80:
 *             return True
 *         s += 1             # <<<<<<<<<<<<<<
 *         c = s[0]
 *     return False
*/
    __pyx_v_s = (__pyx_v_s + 1);

    /* "src/lxml/apihelpers.pxi":1451
 *             return True
 *         s += 1
 *         c = s[0]             # <<<<<<<<<<<<<<
 *     return False
 * 
*/
    __pyx_v_c = (__pyx_v_s[0]);
  }

  /* "src/lxml/apihelpers.pxi":1452
 *         s += 1
 *         c = s[0]
 *     return False             # <<<<<<<<<<<<<<
 * 
 * cdef bint isutf8l(const_xmlChar* s, size_t length) noexcept:
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1445
 *     return 0
 * 
 * cdef inline bint isutf8(const_xmlChar* s) noexcept:             # <<<<<<<<<<<<<<
 *     cdef xmlChar c = s[0]
 *     while c != c'\0':
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":1454
 *     return False
 * 
 * cdef bint isutf8l(const_xmlChar* s, size_t length) noexcept:             # <<<<<<<<<<<<<<
 *     """
 *     Search for non-ASCII characters in the string, knowing its length in advance.
*/

static int __pyx_f_4lxml_5etree_isutf8l(const xmlChar *__pyx_v_s, size_t __pyx_v_length) {
  CYTHON_UNUSED unsigned int __pyx_v_i;
  unsigned long __pyx_v_non_ascii_mask;
  unsigned long const *__pyx_v_lptr;
  unsigned long const *__pyx_v_end;
  int __pyx_r;
  size_t __pyx_t_1;
  int __pyx_t_2;
  size_t __pyx_t_3;
  unsigned int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/apihelpers.pxi":1460
 *     cdef unsigned int i
 *     cdef unsigned long non_ascii_mask
 *     cdef const unsigned long *lptr = <const unsigned long*> s             # <<<<<<<<<<<<<<
 * 
 *     cdef const unsigned long *end = lptr + length // sizeof(unsigned long)
*/
  __pyx_v_lptr = ((unsigned long const *)__pyx_v_s);

  /* "src/lxml/apihelpers.pxi":1462
 *     cdef const unsigned long *lptr = <const unsigned long*> s
 * 
 *     cdef const unsigned long *end = lptr + length // sizeof(unsigned long)             # <<<<<<<<<<<<<<
 *     if length >= sizeof(non_ascii_mask):
 *         # Build constant 0x80808080... mask (and let the C compiler fold it).
*/
  __pyx_t_1 = (sizeof(unsigned long));
  if (unlikely(__pyx_t_1 == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
    __PYX_ERR(4, 1462, __pyx_L1_error)
  }
  __pyx_v_end = (__pyx_v_lptr + (__pyx_v_length / __pyx_t_1));

  /* "src/lxml/apihelpers.pxi":1463
 * 
 *     cdef const unsigned long *end = lptr + length // sizeof(unsigned long)
 *     if length >= sizeof(non_ascii_mask):             # <<<<<<<<<<<<<<
 *         # Build constant 0x80808080... mask (and let the C compiler fold it).
 *         non_ascii_mask = 0
*/
  __pyx_t_2 = (__pyx_v_length >= (sizeof(__pyx_v_non_ascii_mask)));
  if (__pyx_t_2) {

    /* "src/lxml/apihelpers.pxi":1465
 *     if length >= sizeof(non_ascii_mask):
 *         # Build constant 0x80808080... mask (and let the C compiler fold it).
 *         non_ascii_mask = 0             # <<<<<<<<<<<<<<
 *         for i in range(sizeof(non_ascii_mask) // 2):
 *             non_ascii_mask = (non_ascii_mask << 16) | 0x8080
*/
    __pyx_v_non_ascii_mask = 0;

    /* "src/lxml/apihelpers.pxi":1466
 *         # Build constant 0x80808080... mask (and let the C compiler fold it).
 *         non_ascii_mask = 0
 *         for i in range(sizeof(non_ascii_mask) // 2):             # <<<<<<<<<<<<<<
 *             non_ascii_mask = (non_ascii_mask << 16) | 0x8080
 * 
*/
    __pyx_t_1 = ((sizeof(__pyx_v_non_ascii_mask)) / 2);
    __pyx_t_3 = __pyx_t_1;
    for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
      __pyx_v_i = __pyx_t_4;

      /* "src/lxml/apihelpers.pxi":1467
 *         non_ascii_mask = 0
 *         for i in range(sizeof(non_ascii_mask) // 2):
 *             non_ascii_mask = (non_ascii_mask << 16) | 0x8080             # <<<<<<<<<<<<<<
 * 
 *         # Advance to long-aligned character before we start reading longs.
*/
      __pyx_v_non_ascii_mask = ((__pyx_v_non_ascii_mask << 16) | 0x8080);
    }

    /* "src/lxml/apihelpers.pxi":1470
 * 
 *         # Advance to long-aligned character before we start reading longs.
 *         while (<size_t>s) % sizeof(unsigned long) and s < <const_xmlChar *>end:             # <<<<<<<<<<<<<<
 *             if s[0] & 0x80:
 *                 return True
*/
    while (1) {
      __pyx_t_1 = (sizeof(unsigned long));
      if (unlikely(__pyx_t_1 == 0)) {
        PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
        __PYX_ERR(4, 1470, __pyx_L1_error)
      }
      __pyx_t_5 = ((((size_t)__pyx_v_s) % __pyx_t_1) != 0);
      if (__pyx_t_5) {
      } else {
        __pyx_t_2 = __pyx_t_5;
        goto __pyx_L8_bool_binop_done;
      }
      __pyx_t_5 = (__pyx_v_s < ((const xmlChar *)__pyx_v_end));
      __pyx_t_2 = __pyx_t_5;
      __pyx_L8_bool_binop_done:;
      if (!__pyx_t_2) break;

      /* "src/lxml/apihelpers.pxi":1471
 *         # Advance to long-aligned character before we start reading longs.
 *         while (<size_t>s) % sizeof(unsigned long) and s < <const_xmlChar *>end:
 *             if s[0] & 0x80:             # <<<<<<<<<<<<<<
 *                 return True
 *             s += 1
*/
      __pyx_t_2 = (((__pyx_v_s[0]) & 0x80) != 0);
      if (__pyx_t_2) {

        /* "src/lxml/apihelpers.pxi":1472
 *         while (<size_t>s) % sizeof(unsigned long) and s < <const_xmlChar *>end:
 *             if s[0] & 0x80:
 *                 return True             # <<<<<<<<<<<<<<
 *             s += 1
 * 
*/
        __pyx_r = 1;
        goto __pyx_L0;

        /* "src/lxml/apihelpers.pxi":1471
 *         # Advance to long-aligned character before we start reading longs.
 *         while (<size_t>s) % sizeof(unsigned long) and s < <const_xmlChar *>end:
 *             if s[0] & 0x80:             # <<<<<<<<<<<<<<
 *                 return True
 *             s += 1
*/
      }

      /* "src/lxml/apihelpers.pxi":1473
 *             if s[0] & 0x80:
 *                 return True
 *             s += 1             # <<<<<<<<<<<<<<
 * 
 *         # Read one long at a time
*/
      __pyx_v_s = (__pyx_v_s + 1);
    }

    /* "src/lxml/apihelpers.pxi":1476
 * 
 *         # Read one long at a time
 *         lptr = <const unsigned long*> s             # <<<<<<<<<<<<<<
 *         while lptr < end:
 *             if lptr[0] & non_ascii_mask:
*/
    __pyx_v_lptr = ((unsigned long const *)__pyx_v_s);

    /* "src/lxml/apihelpers.pxi":1477
 *         # Read one long at a time
 *         lptr = <const unsigned long*> s
 *         while lptr < end:             # <<<<<<<<<<<<<<
 *             if lptr[0] & non_ascii_mask:
 *                 return True
*/
    while (1) {
      __pyx_t_2 = (__pyx_v_lptr < __pyx_v_end);
      if (!__pyx_t_2) break;

      /* "src/lxml/apihelpers.pxi":1478
 *         lptr = <const unsigned long*> s
 *         while lptr < end:
 *             if lptr[0] & non_ascii_mask:             # <<<<<<<<<<<<<<
 *                 return True
 *             lptr += 1
*/
      __pyx_t_2 = (((__pyx_v_lptr[0]) & __pyx_v_non_ascii_mask) != 0);
      if (__pyx_t_2) {

        /* "src/lxml/apihelpers.pxi":1479
 *         while lptr < end:
 *             if lptr[0] & non_ascii_mask:
 *                 return True             # <<<<<<<<<<<<<<
 *             lptr += 1
 *         s = <const_xmlChar *>lptr
*/
        __pyx_r = 1;
        goto __pyx_L0;

        /* "src/lxml/apihelpers.pxi":1478
 *         lptr = <const unsigned long*> s
 *         while lptr < end:
 *             if lptr[0] & non_ascii_mask:             # <<<<<<<<<<<<<<
 *                 return True
 *             lptr += 1
*/
      }

      /* "src/lxml/apihelpers.pxi":1480
 *             if lptr[0] & non_ascii_mask:
 *                 return True
 *             lptr += 1             # <<<<<<<<<<<<<<
 *         s = <const_xmlChar *>lptr
 * 
*/
      __pyx_v_lptr = (__pyx_v_lptr + 1);
    }

    /* "src/lxml/apihelpers.pxi":1481
 *                 return True
 *             lptr += 1
 *         s = <const_xmlChar *>lptr             # <<<<<<<<<<<<<<
 * 
 *     while s < (<const_xmlChar *>end + length % sizeof(unsigned long)):
*/
    __pyx_v_s = ((const xmlChar *)__pyx_v_lptr);

    /* "src/lxml/apihelpers.pxi":1463
 * 
 *     cdef const unsigned long *end = lptr + length // sizeof(unsigned long)
 *     if length >= sizeof(non_ascii_mask):             # <<<<<<<<<<<<<<
 *         # Build constant 0x80808080... mask (and let the C compiler fold it).
 *         non_ascii_mask = 0
*/
  }

  /* "src/lxml/apihelpers.pxi":1483
 *         s = <const_xmlChar *>lptr
 * 
 *     while s < (<const_xmlChar *>end + length % sizeof(unsigned long)):             # <<<<<<<<<<<<<<
 *         if s[0] & 0x80:
 *             return True
*/
  while (1) {
    __pyx_t_1 = (sizeof(unsigned long));
    if (unlikely(__pyx_t_1 == 0)) {
      PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
      __PYX_ERR(4, 1483, __pyx_L1_error)
    }
    __pyx_t_2 = (__pyx_v_s < (((const xmlChar *)__pyx_v_end) + (__pyx_v_length % __pyx_t_1)));
    if (!__pyx_t_2) break;

    /* "src/lxml/apihelpers.pxi":1484
 * 
 *     while s < (<const_xmlChar *>end + length % sizeof(unsigned long)):
 *         if s[0] & 0x80:             # <<<<<<<<<<<<<<
 *             return True
 *         s += 1
*/
    __pyx_t_2 = (((__pyx_v_s[0]) & 0x80) != 0);
    if (__pyx_t_2) {

      /* "src/lxml/apihelpers.pxi":1485
 *     while s < (<const_xmlChar *>end + length % sizeof(unsigned long)):
 *         if s[0] & 0x80:
 *             return True             # <<<<<<<<<<<<<<
 *         s += 1
 * 
*/
      __pyx_r = 1;
      goto __pyx_L0;

      /* "src/lxml/apihelpers.pxi":1484
 * 
 *     while s < (<const_xmlChar *>end + length % sizeof(unsigned long)):
 *         if s[0] & 0x80:             # <<<<<<<<<<<<<<
 *             return True
 *         s += 1
*/
    }

    /* "src/lxml/apihelpers.pxi":1486
 *         if s[0] & 0x80:
 *             return True
 *         s += 1             # <<<<<<<<<<<<<<
 * 
 *     return False
*/
    __pyx_v_s = (__pyx_v_s + 1);
  }

  /* "src/lxml/apihelpers.pxi":1488
 *         s += 1
 * 
 *     return False             # <<<<<<<<<<<<<<
 * 
 * cdef int _is_valid_xml_ascii(bytes pystring) except -1:
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1454
 *     return False
 * 
 * cdef bint isutf8l(const_xmlChar* s, size_t length) noexcept:             # <<<<<<<<<<<<<<
 *     """
 *     Search for non-ASCII characters in the string, knowing its length in advance.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("lxml.etree.isutf8l", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":1490
 *     return False
 * 
 * cdef int _is_valid_xml_ascii(bytes pystring) except -1:             # <<<<<<<<<<<<<<
 *     """Check if a string is XML ascii content."""
 *     cdef signed char ch
*/

static int __pyx_f_4lxml_5etree__is_valid_xml_ascii(PyObject *__pyx_v_pystring) {
  signed char __pyx_v_ch;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  char *__pyx_t_2;
  char *__pyx_t_3;
  Py_ssize_t __pyx_t_4;
  char *__pyx_t_5;
  char *__pyx_t_6;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_is_valid_xml_ascii", 0);

  /* "src/lxml/apihelpers.pxi":1495
 *     # When ch is a *signed* char, non-ascii characters are negative integers
 *     # and xmlIsChar_ch does not accept them.
 *     for ch in pystring:             # <<<<<<<<<<<<<<
 *         if not tree.xmlIsChar_ch(ch):
 *             return 0
*/
  if (unlikely(__pyx_v_pystring == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable");
    __PYX_ERR(4, 1495, __pyx_L1_error)
  }
  __Pyx_INCREF(__pyx_v_pystring);
  __pyx_t_1 = __pyx_v_pystring;
  __pyx_t_3 = __Pyx_PyBytes_AsWritableString(__pyx_t_1); if (unlikely(__pyx_t_3 == ((char *)NULL))) __PYX_ERR(4, 1495, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyBytes_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(4, 1495, __pyx_L1_error)
  __pyx_t_5 = (__pyx_t_3 + __pyx_t_4);
  for (__pyx_t_6 = __pyx_t_3; __pyx_t_6 < __pyx_t_5; __pyx_t_6++) {
    __pyx_t_2 = __pyx_t_6;
    __pyx_v_ch = (__pyx_t_2[0]);

    /* "src/lxml/apihelpers.pxi":1496
 *     # and xmlIsChar_ch does not accept them.
 *     for ch in pystring:
 *         if not tree.xmlIsChar_ch(ch):             # <<<<<<<<<<<<<<
 *             return 0
 *     return 1
*/
    __pyx_t_7 = (!(xmlIsChar_ch(__pyx_v_ch) != 0));
    if (__pyx_t_7) {

      /* "src/lxml/apihelpers.pxi":1497
 *     for ch in pystring:
 *         if not tree.xmlIsChar_ch(ch):
 *             return 0             # <<<<<<<<<<<<<<
 *     return 1
 * 
*/
      __pyx_r = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;

      /* "src/lxml/apihelpers.pxi":1496
 *     # and xmlIsChar_ch does not accept them.
 *     for ch in pystring:
 *         if not tree.xmlIsChar_ch(ch):             # <<<<<<<<<<<<<<
 *             return 0
 *     return 1
*/
    }
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/apihelpers.pxi":1498
 *         if not tree.xmlIsChar_ch(ch):
 *             return 0
 *     return 1             # <<<<<<<<<<<<<<
 * 
 * cdef bint _is_valid_xml_utf8(bytes pystring) except -1:
*/
  __pyx_r = 1;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1490
 *     return False
 * 
 * cdef int _is_valid_xml_ascii(bytes pystring) except -1:             # <<<<<<<<<<<<<<
 *     """Check if a string is XML ascii content."""
 *     cdef signed char ch
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._is_valid_xml_ascii", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":1500
 *     return 1
 * 
 * cdef bint _is_valid_xml_utf8(bytes pystring) except -1:             # <<<<<<<<<<<<<<
 *     """Check if a string is like valid UTF-8 XML content."""
 *     cdef const_xmlChar* s = _xcstr(pystring)
*/

static int __pyx_f_4lxml_5etree__is_valid_xml_utf8(PyObject *__pyx_v_pystring) {
  const xmlChar *__pyx_v_s;
  const xmlChar *__pyx_v_c_end;
  unsigned long __pyx_v_next3;
  int __pyx_r;
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/apihelpers.pxi":1502
 * cdef bint _is_valid_xml_utf8(bytes pystring) except -1:
 *     """Check if a string is like valid UTF-8 XML content."""
 *     cdef const_xmlChar* s = _xcstr(pystring)             # <<<<<<<<<<<<<<
 *     cdef const_xmlChar* c_end = s + len(pystring)
 *     cdef unsigned long next3 = 0
*/
  __pyx_v_s = (const xmlChar*)PyBytes_AS_STRING(__pyx_v_pystring);

  /* "src/lxml/apihelpers.pxi":1503
 *     """Check if a string is like valid UTF-8 XML content."""
 *     cdef const_xmlChar* s = _xcstr(pystring)
 *     cdef const_xmlChar* c_end = s + len(pystring)             # <<<<<<<<<<<<<<
 *     cdef unsigned long next3 = 0
 *     if s < c_end - 2:
*/
  if (unlikely(__pyx_v_pystring == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(4, 1503, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyBytes_GET_SIZE(__pyx_v_pystring); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(4, 1503, __pyx_L1_error)
  __pyx_v_c_end = (__pyx_v_s + __pyx_t_1);

  /* "src/lxml/apihelpers.pxi":1504
 *     cdef const_xmlChar* s = _xcstr(pystring)
 *     cdef const_xmlChar* c_end = s + len(pystring)
 *     cdef unsigned long next3 = 0             # <<<<<<<<<<<<<<
 *     if s < c_end - 2:
 *         next3 = (s[0] << 8) | (s[1])
*/
  __pyx_v_next3 = 0;

  /* "src/lxml/apihelpers.pxi":1505
 *     cdef const_xmlChar* c_end = s + len(pystring)
 *     cdef unsigned long next3 = 0
 *     if s < c_end - 2:             # <<<<<<<<<<<<<<
 *         next3 = (s[0] << 8) | (s[1])
 * 
*/
  __pyx_t_2 = (__pyx_v_s < (__pyx_v_c_end - 2));
  if (__pyx_t_2) {

    /* "src/lxml/apihelpers.pxi":1506
 *     cdef unsigned long next3 = 0
 *     if s < c_end - 2:
 *         next3 = (s[0] << 8) | (s[1])             # <<<<<<<<<<<<<<
 * 
 *     while s < c_end - 2:
*/
    __pyx_v_next3 = (((__pyx_v_s[0]) << 8) | (__pyx_v_s[1]));

    /* "src/lxml/apihelpers.pxi":1505
 *     cdef const_xmlChar* c_end = s + len(pystring)
 *     cdef unsigned long next3 = 0
 *     if s < c_end - 2:             # <<<<<<<<<<<<<<
 *         next3 = (s[0] << 8) | (s[1])
 * 
*/
  }

  /* "src/lxml/apihelpers.pxi":1508
 *         next3 = (s[0] << 8) | (s[1])
 * 
 *     while s < c_end - 2:             # <<<<<<<<<<<<<<
 *         next3 = 0x00ffffff & ((next3 << 8) | s[2])
 *         if s[0] & 0x80:
*/
  while (1) {
    __pyx_t_2 = (__pyx_v_s < (__pyx_v_c_end - 2));
    if (!__pyx_t_2) break;

    /* "src/lxml/apihelpers.pxi":1509
 * 
 *     while s < c_end - 2:
 *         next3 = 0x00ffffff & ((next3 << 8) | s[2])             # <<<<<<<<<<<<<<
 *         if s[0] & 0x80:
 *             # 0xefbfbe and 0xefbfbf are utf-8 encodings of
*/
    __pyx_v_next3 = (0x00ffffff & ((__pyx_v_next3 << 8) | (__pyx_v_s[2])));

    /* "src/lxml/apihelpers.pxi":1510
 *     while s < c_end - 2:
 *         next3 = 0x00ffffff & ((next3 << 8) | s[2])
 *         if s[0] & 0x80:             # <<<<<<<<<<<<<<
 *             # 0xefbfbe and 0xefbfbf are utf-8 encodings of
 *             # forbidden characters \ufffe and \uffff
*/
    __pyx_t_2 = (((__pyx_v_s[0]) & 0x80) != 0);
    if (__pyx_t_2) {

      /* "src/lxml/apihelpers.pxi":1513
 *             # 0xefbfbe and 0xefbfbf are utf-8 encodings of
 *             # forbidden characters \ufffe and \uffff
 *             if next3 == 0x00efbfbe or next3 == 0x00efbfbf:             # <<<<<<<<<<<<<<
 *                 return 0
 *             # 0xeda080 and 0xedbfbf are utf-8 encodings of
*/
      switch (__pyx_v_next3) {
        case 0x00efbfbe:
        case 0x00efbfbf:

        /* "src/lxml/apihelpers.pxi":1514
 *             # forbidden characters \ufffe and \uffff
 *             if next3 == 0x00efbfbe or next3 == 0x00efbfbf:
 *                 return 0             # <<<<<<<<<<<<<<
 *             # 0xeda080 and 0xedbfbf are utf-8 encodings of
 *             # \ud800 and \udfff. Anything between them (inclusive)
*/
        __pyx_r = 0;
        goto __pyx_L0;

        /* "src/lxml/apihelpers.pxi":1513
 *             # 0xefbfbe and 0xefbfbf are utf-8 encodings of
 *             # forbidden characters \ufffe and \uffff
 *             if next3 == 0x00efbfbe or next3 == 0x00efbfbf:             # <<<<<<<<<<<<<<
 *                 return 0
 *             # 0xeda080 and 0xedbfbf are utf-8 encodings of
*/
        break;
        default: break;
      }

      /* "src/lxml/apihelpers.pxi":1518
 *             # \ud800 and \udfff. Anything between them (inclusive)
 *             # is forbidden, because they are surrogate blocks in utf-16.
 *             if 0x00eda080 <= next3 <= 0x00edbfbf:             # <<<<<<<<<<<<<<
 *                 return 0
 *         elif not tree.xmlIsChar_ch(s[0]):
*/
      __pyx_t_2 = (0x00eda080 <= __pyx_v_next3);
      if (__pyx_t_2) {
        __pyx_t_2 = (__pyx_v_next3 <= 0x00edbfbf);
      }
      if (__pyx_t_2) {

        /* "src/lxml/apihelpers.pxi":1519
 *             # is forbidden, because they are surrogate blocks in utf-16.
 *             if 0x00eda080 <= next3 <= 0x00edbfbf:
 *                 return 0             # <<<<<<<<<<<<<<
 *         elif not tree.xmlIsChar_ch(s[0]):
 *             return 0  # invalid ascii char
*/
        __pyx_r = 0;
        goto __pyx_L0;

        /* "src/lxml/apihelpers.pxi":1518
 *             # \ud800 and \udfff. Anything between them (inclusive)
 *             # is forbidden, because they are surrogate blocks in utf-16.
 *             if 0x00eda080 <= next3 <= 0x00edbfbf:             # <<<<<<<<<<<<<<
 *                 return 0
 *         elif not tree.xmlIsChar_ch(s[0]):
*/
      }

      /* "src/lxml/apihelpers.pxi":1510
 *     while s < c_end - 2:
 *         next3 = 0x00ffffff & ((next3 << 8) | s[2])
 *         if s[0] & 0x80:             # <<<<<<<<<<<<<<
 *             # 0xefbfbe and 0xefbfbf are utf-8 encodings of
 *             # forbidden characters \ufffe and \uffff
*/
      goto __pyx_L6;
    }

    /* "src/lxml/apihelpers.pxi":1520
 *             if 0x00eda080 <= next3 <= 0x00edbfbf:
 *                 return 0
 *         elif not tree.xmlIsChar_ch(s[0]):             # <<<<<<<<<<<<<<
 *             return 0  # invalid ascii char
 *         s += 1
*/
    __pyx_t_2 = (!(xmlIsChar_ch((__pyx_v_s[0])) != 0));
    if (__pyx_t_2) {

      /* "src/lxml/apihelpers.pxi":1521
 *                 return 0
 *         elif not tree.xmlIsChar_ch(s[0]):
 *             return 0  # invalid ascii char             # <<<<<<<<<<<<<<
 *         s += 1
 * 
*/
      __pyx_r = 0;
      goto __pyx_L0;

      /* "src/lxml/apihelpers.pxi":1520
 *             if 0x00eda080 <= next3 <= 0x00edbfbf:
 *                 return 0
 *         elif not tree.xmlIsChar_ch(s[0]):             # <<<<<<<<<<<<<<
 *             return 0  # invalid ascii char
 *         s += 1
*/
    }
    __pyx_L6:;

    /* "src/lxml/apihelpers.pxi":1522
 *         elif not tree.xmlIsChar_ch(s[0]):
 *             return 0  # invalid ascii char
 *         s += 1             # <<<<<<<<<<<<<<
 * 
 *     while s < c_end:
*/
    __pyx_v_s = (__pyx_v_s + 1);
  }

  /* "src/lxml/apihelpers.pxi":1524
 *         s += 1
 * 
 *     while s < c_end:             # <<<<<<<<<<<<<<
 *         if not s[0] & 0x80 and not tree.xmlIsChar_ch(s[0]):
 *             return 0  # invalid ascii char
*/
  while (1) {
    __pyx_t_2 = (__pyx_v_s < __pyx_v_c_end);
    if (!__pyx_t_2) break;

    /* "src/lxml/apihelpers.pxi":1525
 * 
 *     while s < c_end:
 *         if not s[0] & 0x80 and not tree.xmlIsChar_ch(s[0]):             # <<<<<<<<<<<<<<
 *             return 0  # invalid ascii char
 *         s += 1
*/
    __pyx_t_3 = (!(((__pyx_v_s[0]) & 0x80) != 0));
    if (__pyx_t_3) {
    } else {
      __pyx_t_2 = __pyx_t_3;
      goto __pyx_L11_bool_binop_done;
    }
    __pyx_t_3 = (!(xmlIsChar_ch((__pyx_v_s[0])) != 0));
    __pyx_t_2 = __pyx_t_3;
    __pyx_L11_bool_binop_done:;
    if (__pyx_t_2) {

      /* "src/lxml/apihelpers.pxi":1526
 *     while s < c_end:
 *         if not s[0] & 0x80 and not tree.xmlIsChar_ch(s[0]):
 *             return 0  # invalid ascii char             # <<<<<<<<<<<<<<
 *         s += 1
 * 
*/
      __pyx_r = 0;
      goto __pyx_L0;

      /* "src/lxml/apihelpers.pxi":1525
 * 
 *     while s < c_end:
 *         if not s[0] & 0x80 and not tree.xmlIsChar_ch(s[0]):             # <<<<<<<<<<<<<<
 *             return 0  # invalid ascii char
 *         s += 1
*/
    }

    /* "src/lxml/apihelpers.pxi":1527
 *         if not s[0] & 0x80 and not tree.xmlIsChar_ch(s[0]):
 *             return 0  # invalid ascii char
 *         s += 1             # <<<<<<<<<<<<<<
 * 
 *     return 1
*/
    __pyx_v_s = (__pyx_v_s + 1);
  }

  /* "src/lxml/apihelpers.pxi":1529
 *         s += 1
 * 
 *     return 1             # <<<<<<<<<<<<<<
 * 
 * cdef inline unicode funicodeOrNone(const_xmlChar* s):
*/
  __pyx_r = 1;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1500
 *     return 1
 * 
 * cdef bint _is_valid_xml_utf8(bytes pystring) except -1:             # <<<<<<<<<<<<<<
 *     """Check if a string is like valid UTF-8 XML content."""
 *     cdef const_xmlChar* s = _xcstr(pystring)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._is_valid_xml_utf8", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":1531
 *     return 1
 * 
 * cdef inline unicode funicodeOrNone(const_xmlChar* s):             # <<<<<<<<<<<<<<
 *     return funicode(s) if s is not NULL else None
 * 
*/

static CYTHON_INLINE PyObject *__pyx_f_4lxml_5etree_funicodeOrNone(const xmlChar *__pyx_v_s) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("funicodeOrNone", 0);

  /* "src/lxml/apihelpers.pxi":1532
 * 
 * cdef inline unicode funicodeOrNone(const_xmlChar* s):
 *     return funicode(s) if s is not NULL else None             # <<<<<<<<<<<<<<
 * 
 * cdef inline unicode funicodeOrEmpty(const_xmlChar* s):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = (__pyx_v_s != NULL);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_s); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 1532, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
  } else {
    __Pyx_INCREF(Py_None);
    __pyx_t_1 = Py_None;
  }
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_1))) __PYX_ERR(4, 1532, __pyx_L1_error)
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1531
 *     return 1
 * 
 * cdef inline unicode funicodeOrNone(const_xmlChar* s):             # <<<<<<<<<<<<<<
 *     return funicode(s) if s is not NULL else None
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.funicodeOrNone", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":1534
 *     return funicode(s) if s is not NULL else None
 * 
 * cdef inline unicode funicodeOrEmpty(const_xmlChar* s):             # <<<<<<<<<<<<<<
 *     return funicode(s) if s is not NULL else ''
 * 
*/

static CYTHON_INLINE PyObject *__pyx_f_4lxml_5etree_funicodeOrEmpty(const xmlChar *__pyx_v_s) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("funicodeOrEmpty", 0);

  /* "src/lxml/apihelpers.pxi":1535
 * 
 * cdef inline unicode funicodeOrEmpty(const_xmlChar* s):
 *     return funicode(s) if s is not NULL else ''             # <<<<<<<<<<<<<<
 * 
 * cdef unicode funicode(const_xmlChar* s):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = (__pyx_v_s != NULL);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_s); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 1535, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
  } else {
    __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u__8);
    __pyx_t_1 = __pyx_mstate_global->__pyx_kp_u__8;
  }
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1534
 *     return funicode(s) if s is not NULL else None
 * 
 * cdef inline unicode funicodeOrEmpty(const_xmlChar* s):             # <<<<<<<<<<<<<<
 *     return funicode(s) if s is not NULL else ''
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.funicodeOrEmpty", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":1537
 *     return funicode(s) if s is not NULL else ''
 * 
 * cdef unicode funicode(const_xmlChar* s):             # <<<<<<<<<<<<<<
 *     return s.decode('UTF-8')
 * 
*/

static PyObject *__pyx_f_4lxml_5etree_funicode(const xmlChar *__pyx_v_s) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("funicode", 0);

  /* "src/lxml/apihelpers.pxi":1538
 * 
 * cdef unicode funicode(const_xmlChar* s):
 *     return s.decode('UTF-8')             # <<<<<<<<<<<<<<
 * 
 * cdef bytes _utf8(object s):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_ssize_strlen(((char const *)__pyx_v_s)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(4, 1538, __pyx_L1_error)
  __pyx_t_2 = __Pyx_decode_c_string(((char const *)__pyx_v_s), 0, __pyx_t_1, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 1538, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1537
 *     return funicode(s) if s is not NULL else ''
 * 
 * cdef unicode funicode(const_xmlChar* s):             # <<<<<<<<<<<<<<
 *     return s.decode('UTF-8')
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.funicode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":1540
 *     return s.decode('UTF-8')
 * 
 * cdef bytes _utf8(object s):             # <<<<<<<<<<<<<<
 *     """Test if a string is valid user input and encode it to UTF-8.
 *     Reject all bytes/unicode input that contains non-XML characters.
*/

static PyObject *__pyx_f_4lxml_5etree__utf8(PyObject *__pyx_v_s) {
  int __pyx_v_valid;
  PyObject *__pyx_v_utf8_string = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_utf8", 0);

  /* "src/lxml/apihelpers.pxi":1547
 *     cdef int valid
 *     cdef bytes utf8_string
 *     if isinstance(s, unicode):             # <<<<<<<<<<<<<<
 *         utf8_string = (<unicode>s).encode('utf8')
 *         valid = _is_valid_xml_utf8(utf8_string)
*/
  __pyx_t_1 = PyUnicode_Check(__pyx_v_s); 
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":1548
 *     cdef bytes utf8_string
 *     if isinstance(s, unicode):
 *         utf8_string = (<unicode>s).encode('utf8')             # <<<<<<<<<<<<<<
 *         valid = _is_valid_xml_utf8(utf8_string)
 *     elif isinstance(s, (bytes, bytearray)):
*/
    if (unlikely(__pyx_v_s == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode");
      __PYX_ERR(4, 1548, __pyx_L1_error)
    }
    __pyx_t_2 = PyUnicode_AsUTF8String(((PyObject*)__pyx_v_s)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 1548, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_utf8_string = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/apihelpers.pxi":1549
 *     if isinstance(s, unicode):
 *         utf8_string = (<unicode>s).encode('utf8')
 *         valid = _is_valid_xml_utf8(utf8_string)             # <<<<<<<<<<<<<<
 *     elif isinstance(s, (bytes, bytearray)):
 *         utf8_string = s if type(s) is bytes else bytes(s)
*/
    __pyx_t_1 = __pyx_f_4lxml_5etree__is_valid_xml_utf8(__pyx_v_utf8_string); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(4, 1549, __pyx_L1_error)
    __pyx_v_valid = __pyx_t_1;

    /* "src/lxml/apihelpers.pxi":1547
 *     cdef int valid
 *     cdef bytes utf8_string
 *     if isinstance(s, unicode):             # <<<<<<<<<<<<<<
 *         utf8_string = (<unicode>s).encode('utf8')
 *         valid = _is_valid_xml_utf8(utf8_string)
*/
    goto __pyx_L3;
  }

  /* "src/lxml/apihelpers.pxi":1550
 *         utf8_string = (<unicode>s).encode('utf8')
 *         valid = _is_valid_xml_utf8(utf8_string)
 *     elif isinstance(s, (bytes, bytearray)):             # <<<<<<<<<<<<<<
 *         utf8_string = s if type(s) is bytes else bytes(s)
 *         valid = _is_valid_xml_ascii(utf8_string)
*/
  __pyx_t_3 = PyBytes_Check(__pyx_v_s); 
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = PyByteArray_Check(__pyx_v_s); 
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (likely(__pyx_t_1)) {

    /* "src/lxml/apihelpers.pxi":1551
 *         valid = _is_valid_xml_utf8(utf8_string)
 *     elif isinstance(s, (bytes, bytearray)):
 *         utf8_string = s if type(s) is bytes else bytes(s)             # <<<<<<<<<<<<<<
 *         valid = _is_valid_xml_ascii(utf8_string)
 *     else:
*/
    __pyx_t_1 = (((PyObject *)Py_TYPE(__pyx_v_s)) == ((PyObject *)(&PyBytes_Type)));
    if (__pyx_t_1) {
      __pyx_t_4 = __pyx_v_s;
      __Pyx_INCREF(__pyx_t_4);
      if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_4))) __PYX_ERR(4, 1551, __pyx_L1_error)
      __pyx_t_2 = __pyx_t_4;
      __pyx_t_4 = 0;
    } else {
      __pyx_t_5 = NULL;
      __pyx_t_6 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_s};
        __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(&PyBytes_Type), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 1551, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
      }
      __pyx_t_2 = __pyx_t_4;
      __pyx_t_4 = 0;
    }
    __pyx_v_utf8_string = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/apihelpers.pxi":1552
 *     elif isinstance(s, (bytes, bytearray)):
 *         utf8_string = s if type(s) is bytes else bytes(s)
 *         valid = _is_valid_xml_ascii(utf8_string)             # <<<<<<<<<<<<<<
 *     else:
 *         raise TypeError("Argument must be bytes or unicode, got '%.200s'" % type(s).__name__)
*/
    __pyx_t_7 = __pyx_f_4lxml_5etree__is_valid_xml_ascii(__pyx_v_utf8_string); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(4, 1552, __pyx_L1_error)
    __pyx_v_valid = __pyx_t_7;

    /* "src/lxml/apihelpers.pxi":1550
 *         utf8_string = (<unicode>s).encode('utf8')
 *         valid = _is_valid_xml_utf8(utf8_string)
 *     elif isinstance(s, (bytes, bytearray)):             # <<<<<<<<<<<<<<
 *         utf8_string = s if type(s) is bytes else bytes(s)
 *         valid = _is_valid_xml_ascii(utf8_string)
*/
    goto __pyx_L3;
  }

  /* "src/lxml/apihelpers.pxi":1554
 *         valid = _is_valid_xml_ascii(utf8_string)
 *     else:
 *         raise TypeError("Argument must be bytes or unicode, got '%.200s'" % type(s).__name__)             # <<<<<<<<<<<<<<
 *     if not valid:
 *         raise ValueError(
*/
  /*else*/ {
    __pyx_t_4 = NULL;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(__pyx_v_s)), __pyx_mstate_global->__pyx_n_u_name_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 1554, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_8 = __Pyx_PyUnicode_FormatSafe(__pyx_mstate_global->__pyx_kp_u_Argument_must_be_bytes_or_unicod, __pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 1554, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_8};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 1554, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(4, 1554, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "src/lxml/apihelpers.pxi":1555
 *     else:
 *         raise TypeError("Argument must be bytes or unicode, got '%.200s'" % type(s).__name__)
 *     if not valid:             # <<<<<<<<<<<<<<
 *         raise ValueError(
 *             "All strings must be XML compatible: Unicode or ASCII, no NULL bytes or control characters")
*/
  __pyx_t_1 = (!(__pyx_v_valid != 0));
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/apihelpers.pxi":1556
 *         raise TypeError("Argument must be bytes or unicode, got '%.200s'" % type(s).__name__)
 *     if not valid:
 *         raise ValueError(             # <<<<<<<<<<<<<<
 *             "All strings must be XML compatible: Unicode or ASCII, no NULL bytes or control characters")
 *     return utf8_string
*/
    __pyx_t_8 = NULL;
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_mstate_global->__pyx_kp_u_All_strings_must_be_XML_compatib};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 1556, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(4, 1556, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":1555
 *     else:
 *         raise TypeError("Argument must be bytes or unicode, got '%.200s'" % type(s).__name__)
 *     if not valid:             # <<<<<<<<<<<<<<
 *         raise ValueError(
 *             "All strings must be XML compatible: Unicode or ASCII, no NULL bytes or control characters")
*/
  }

  /* "src/lxml/apihelpers.pxi":1558
 *         raise ValueError(
 *             "All strings must be XML compatible: Unicode or ASCII, no NULL bytes or control characters")
 *     return utf8_string             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_utf8_string);
  __pyx_r = __pyx_v_utf8_string;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1540
 *     return s.decode('UTF-8')
 * 
 * cdef bytes _utf8(object s):             # <<<<<<<<<<<<<<
 *     """Test if a string is valid user input and encode it to UTF-8.
 *     Reject all bytes/unicode input that contains non-XML characters.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("lxml.etree._utf8", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_utf8_string);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":1561
 * 
 * 
 * cdef bytes _utf8orNone(object s):             # <<<<<<<<<<<<<<
 *     return _utf8(s) if s is not None else None
 * 
*/

static PyObject *__pyx_f_4lxml_5etree__utf8orNone(PyObject *__pyx_v_s) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_utf8orNone", 0);

  /* "src/lxml/apihelpers.pxi":1562
 * 
 * cdef bytes _utf8orNone(object s):
 *     return _utf8(s) if s is not None else None             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = (__pyx_v_s != Py_None);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_f_4lxml_5etree__utf8(__pyx_v_s); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 1562, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
  } else {
    __Pyx_INCREF(Py_None);
    __pyx_t_1 = Py_None;
  }
  if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_1))) __PYX_ERR(4, 1562, __pyx_L1_error)
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1561
 * 
 * 
 * cdef bytes _utf8orNone(object s):             # <<<<<<<<<<<<<<
 *     return _utf8(s) if s is not None else None
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._utf8orNone", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":1572
 * 
 * 
 * cdef bint _isFilePath(const_xmlChar* c_path) noexcept:             # <<<<<<<<<<<<<<
 *     "simple heuristic to see if a path is a filename"
 *     cdef xmlChar c
*/

static int __pyx_f_4lxml_5etree__isFilePath(const xmlChar *__pyx_v_c_path) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;

  /* "src/lxml/apihelpers.pxi":1576
 *     cdef xmlChar c
 *     # test if it looks like an absolute Unix path or a Windows network path
 *     if c_path[0] == c'/':             # <<<<<<<<<<<<<<
 *         return ABS_UNIX_FILE_PATH
 * 
*/
  __pyx_t_1 = ((__pyx_v_c_path[0]) == '/');
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":1577
 *     # test if it looks like an absolute Unix path or a Windows network path
 *     if c_path[0] == c'/':
 *         return ABS_UNIX_FILE_PATH             # <<<<<<<<<<<<<<
 * 
 *     # test if it looks like an absolute Windows path or URL
*/
    __pyx_r = __pyx_e_4lxml_5etree_ABS_UNIX_FILE_PATH;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":1576
 *     cdef xmlChar c
 *     # test if it looks like an absolute Unix path or a Windows network path
 *     if c_path[0] == c'/':             # <<<<<<<<<<<<<<
 *         return ABS_UNIX_FILE_PATH
 * 
*/
  }

  /* "src/lxml/apihelpers.pxi":1580
 * 
 *     # test if it looks like an absolute Windows path or URL
 *     if c'a' <= c_path[0] <= c'z' or c'A' <= c_path[0] <= c'Z':             # <<<<<<<<<<<<<<
 *         c_path += 1
 *         if c_path[0] == c':' and c_path[1] in b'\0\\':
*/
  __pyx_t_2 = ('a' <= (__pyx_v_c_path[0]));
  if (__pyx_t_2) {
    __pyx_t_2 = ((__pyx_v_c_path[0]) <= 'z');
  }
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_2 = ('A' <= (__pyx_v_c_path[0]));
  if (__pyx_t_2) {
    __pyx_t_2 = ((__pyx_v_c_path[0]) <= 'Z');
  }
  __pyx_t_1 = __pyx_t_2;
  __pyx_L5_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":1581
 *     # test if it looks like an absolute Windows path or URL
 *     if c'a' <= c_path[0] <= c'z' or c'A' <= c_path[0] <= c'Z':
 *         c_path += 1             # <<<<<<<<<<<<<<
 *         if c_path[0] == c':' and c_path[1] in b'\0\\':
 *             return ABS_WIN_FILE_PATH  # C: or C:\...
*/
    __pyx_v_c_path = (__pyx_v_c_path + 1);

    /* "src/lxml/apihelpers.pxi":1582
 *     if c'a' <= c_path[0] <= c'z' or c'A' <= c_path[0] <= c'Z':
 *         c_path += 1
 *         if c_path[0] == c':' and c_path[1] in b'\0\\':             # <<<<<<<<<<<<<<
 *             return ABS_WIN_FILE_PATH  # C: or C:\...
 * 
*/
    __pyx_t_2 = ((__pyx_v_c_path[0]) == ':');
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L8_bool_binop_done;
    }
    switch ((__pyx_v_c_path[1])) {
      case '\x00':
      case '\\':
      __pyx_t_2 = 1;
      break;
      default:
      __pyx_t_2 = 0;
      break;
    }
    __pyx_t_3 = __pyx_t_2;
    __pyx_t_1 = __pyx_t_3;
    __pyx_L8_bool_binop_done:;
    if (__pyx_t_1) {

      /* "src/lxml/apihelpers.pxi":1583
 *         c_path += 1
 *         if c_path[0] == c':' and c_path[1] in b'\0\\':
 *             return ABS_WIN_FILE_PATH  # C: or C:\...             # <<<<<<<<<<<<<<
 * 
 *         # test if it looks like a URL with scheme://
*/
      __pyx_r = __pyx_e_4lxml_5etree_ABS_WIN_FILE_PATH;
      goto __pyx_L0;

      /* "src/lxml/apihelpers.pxi":1582
 *     if c'a' <= c_path[0] <= c'z' or c'A' <= c_path[0] <= c'Z':
 *         c_path += 1
 *         if c_path[0] == c':' and c_path[1] in b'\0\\':             # <<<<<<<<<<<<<<
 *             return ABS_WIN_FILE_PATH  # C: or C:\...
 * 
*/
    }

    /* "src/lxml/apihelpers.pxi":1586
 * 
 *         # test if it looks like a URL with scheme://
 *         while c'a' <= c_path[0] <= c'z' or c'A' <= c_path[0] <= c'Z':             # <<<<<<<<<<<<<<
 *             c_path += 1
 *         if c_path[0] == c':' and c_path[1] == c'/' and c_path[2] == c'/':
*/
    while (1) {
      __pyx_t_3 = ('a' <= (__pyx_v_c_path[0]));
      if (__pyx_t_3) {
        __pyx_t_3 = ((__pyx_v_c_path[0]) <= 'z');
      }
      if (!__pyx_t_3) {
      } else {
        __pyx_t_1 = __pyx_t_3;
        goto __pyx_L12_bool_binop_done;
      }
      __pyx_t_3 = ('A' <= (__pyx_v_c_path[0]));
      if (__pyx_t_3) {
        __pyx_t_3 = ((__pyx_v_c_path[0]) <= 'Z');
      }
      __pyx_t_1 = __pyx_t_3;
      __pyx_L12_bool_binop_done:;
      if (!__pyx_t_1) break;

      /* "src/lxml/apihelpers.pxi":1587
 *         # test if it looks like a URL with scheme://
 *         while c'a' <= c_path[0] <= c'z' or c'A' <= c_path[0] <= c'Z':
 *             c_path += 1             # <<<<<<<<<<<<<<
 *         if c_path[0] == c':' and c_path[1] == c'/' and c_path[2] == c'/':
 *             return NO_FILE_PATH
*/
      __pyx_v_c_path = (__pyx_v_c_path + 1);
    }

    /* "src/lxml/apihelpers.pxi":1588
 *         while c'a' <= c_path[0] <= c'z' or c'A' <= c_path[0] <= c'Z':
 *             c_path += 1
 *         if c_path[0] == c':' and c_path[1] == c'/' and c_path[2] == c'/':             # <<<<<<<<<<<<<<
 *             return NO_FILE_PATH
 * 
*/
    __pyx_t_3 = ((__pyx_v_c_path[0]) == ':');
    if (__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L15_bool_binop_done;
    }
    __pyx_t_3 = ((__pyx_v_c_path[1]) == '/');
    if (__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L15_bool_binop_done;
    }
    __pyx_t_3 = ((__pyx_v_c_path[2]) == '/');
    __pyx_t_1 = __pyx_t_3;
    __pyx_L15_bool_binop_done:;
    if (__pyx_t_1) {

      /* "src/lxml/apihelpers.pxi":1589
 *             c_path += 1
 *         if c_path[0] == c':' and c_path[1] == c'/' and c_path[2] == c'/':
 *             return NO_FILE_PATH             # <<<<<<<<<<<<<<
 * 
 *     # assume it's a relative path
*/
      __pyx_r = __pyx_e_4lxml_5etree_NO_FILE_PATH;
      goto __pyx_L0;

      /* "src/lxml/apihelpers.pxi":1588
 *         while c'a' <= c_path[0] <= c'z' or c'A' <= c_path[0] <= c'Z':
 *             c_path += 1
 *         if c_path[0] == c':' and c_path[1] == c'/' and c_path[2] == c'/':             # <<<<<<<<<<<<<<
 *             return NO_FILE_PATH
 * 
*/
    }

    /* "src/lxml/apihelpers.pxi":1580
 * 
 *     # test if it looks like an absolute Windows path or URL
 *     if c'a' <= c_path[0] <= c'z' or c'A' <= c_path[0] <= c'Z':             # <<<<<<<<<<<<<<
 *         c_path += 1
 *         if c_path[0] == c':' and c_path[1] in b'\0\\':
*/
  }

  /* "src/lxml/apihelpers.pxi":1592
 * 
 *     # assume it's a relative path
 *     return REL_FILE_PATH             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = __pyx_e_4lxml_5etree_REL_FILE_PATH;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1572
 * 
 * 
 * cdef bint _isFilePath(const_xmlChar* c_path) noexcept:             # <<<<<<<<<<<<<<
 *     "simple heuristic to see if a path is a filename"
 *     cdef xmlChar c
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":1595
 * 
 * 
 * cdef object _getFSPathOrObject(object obj):             # <<<<<<<<<<<<<<
 *     """
 *     Get the __fspath__ attribute of an object if it exists.
*/

static PyObject *__pyx_f_4lxml_5etree__getFSPathOrObject(PyObject *__pyx_v_obj) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_getFSPathOrObject", 0);

  /* "src/lxml/apihelpers.pxi":1600
 *     Otherwise, the original object is returned.
 *     """
 *     if _isString(obj):             # <<<<<<<<<<<<<<
 *         return obj
 *     try:
*/
  __pyx_t_1 = _isString(__pyx_v_obj);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":1601
 *     """
 *     if _isString(obj):
 *         return obj             # <<<<<<<<<<<<<<
 *     try:
 *         return python.PyOS_FSPath(obj)
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_obj);
    __pyx_r = __pyx_v_obj;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":1600
 *     Otherwise, the original object is returned.
 *     """
 *     if _isString(obj):             # <<<<<<<<<<<<<<
 *         return obj
 *     try:
*/
  }

  /* "src/lxml/apihelpers.pxi":1602
 *     if _isString(obj):
 *         return obj
 *     try:             # <<<<<<<<<<<<<<
 *         return python.PyOS_FSPath(obj)
 *     except TypeError:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    /*try:*/ {

      /* "src/lxml/apihelpers.pxi":1603
 *         return obj
 *     try:
 *         return python.PyOS_FSPath(obj)             # <<<<<<<<<<<<<<
 *     except TypeError:
 *         return obj
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_5 = PyOS_FSPath(__pyx_v_obj); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 1603, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L8_try_return;

      /* "src/lxml/apihelpers.pxi":1602
 *     if _isString(obj):
 *         return obj
 *     try:             # <<<<<<<<<<<<<<
 *         return python.PyOS_FSPath(obj)
 *     except TypeError:
*/
    }
    __pyx_L4_error:;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "src/lxml/apihelpers.pxi":1604
 *     try:
 *         return python.PyOS_FSPath(obj)
 *     except TypeError:             # <<<<<<<<<<<<<<
 *         return obj
 * 
*/
    __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_TypeError))));
    if (__pyx_t_6) {
      __Pyx_ErrRestore(0,0,0);

      /* "src/lxml/apihelpers.pxi":1605
 *         return python.PyOS_FSPath(obj)
 *     except TypeError:
 *         return obj             # <<<<<<<<<<<<<<
 * 
 * 
*/
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_obj);
      __pyx_r = __pyx_v_obj;
      goto __pyx_L7_except_return;
    }
    goto __pyx_L6_except_error;

    /* "src/lxml/apihelpers.pxi":1602
 *     if _isString(obj):
 *         return obj
 *     try:             # <<<<<<<<<<<<<<
 *         return python.PyOS_FSPath(obj)
 *     except TypeError:
*/
    __pyx_L6_except_error:;
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    goto __pyx_L1_error;
    __pyx_L8_try_return:;
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    goto __pyx_L0;
    __pyx_L7_except_return:;
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    goto __pyx_L0;
  }

  /* "src/lxml/apihelpers.pxi":1595
 * 
 * 
 * cdef object _getFSPathOrObject(object obj):             # <<<<<<<<<<<<<<
 *     """
 *     Get the __fspath__ attribute of an object if it exists.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._getFSPathOrObject", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":1608
 * 
 * 
 * cdef object _encodeFilename(object filename):             # <<<<<<<<<<<<<<
 *     """Make sure a filename is 8-bit encoded (or None).
 *     """
*/

static PyObject *__pyx_f_4lxml_5etree__encodeFilename(PyObject *__pyx_v_filename) {
  PyObject *__pyx_v_filename8 = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  unsigned char *__pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  size_t __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_encodeFilename", 0);

  /* "src/lxml/apihelpers.pxi":1611
 *     """Make sure a filename is 8-bit encoded (or None).
 *     """
 *     if filename is None:             # <<<<<<<<<<<<<<
 *         return None
 *     elif isinstance(filename, bytes):
*/
  __pyx_t_1 = (__pyx_v_filename == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":1612
 *     """
 *     if filename is None:
 *         return None             # <<<<<<<<<<<<<<
 *     elif isinstance(filename, bytes):
 *         return filename
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":1611
 *     """Make sure a filename is 8-bit encoded (or None).
 *     """
 *     if filename is None:             # <<<<<<<<<<<<<<
 *         return None
 *     elif isinstance(filename, bytes):
*/
  }

  /* "src/lxml/apihelpers.pxi":1613
 *     if filename is None:
 *         return None
 *     elif isinstance(filename, bytes):             # <<<<<<<<<<<<<<
 *         return filename
 *     elif isinstance(filename, unicode):
*/
  __pyx_t_1 = PyBytes_Check(__pyx_v_filename); 
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":1614
 *         return None
 *     elif isinstance(filename, bytes):
 *         return filename             # <<<<<<<<<<<<<<
 *     elif isinstance(filename, unicode):
 *         filename8 = (<unicode>filename).encode('utf8')
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_filename);
    __pyx_r = __pyx_v_filename;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":1613
 *     if filename is None:
 *         return None
 *     elif isinstance(filename, bytes):             # <<<<<<<<<<<<<<
 *         return filename
 *     elif isinstance(filename, unicode):
*/
  }

  /* "src/lxml/apihelpers.pxi":1615
 *     elif isinstance(filename, bytes):
 *         return filename
 *     elif isinstance(filename, unicode):             # <<<<<<<<<<<<<<
 *         filename8 = (<unicode>filename).encode('utf8')
 *         if _isFilePath(<unsigned char*>filename8):
*/
  __pyx_t_1 = PyUnicode_Check(__pyx_v_filename); 
  if (likely(__pyx_t_1)) {

    /* "src/lxml/apihelpers.pxi":1616
 *         return filename
 *     elif isinstance(filename, unicode):
 *         filename8 = (<unicode>filename).encode('utf8')             # <<<<<<<<<<<<<<
 *         if _isFilePath(<unsigned char*>filename8):
 *             try:
*/
    if (unlikely(__pyx_v_filename == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode");
      __PYX_ERR(4, 1616, __pyx_L1_error)
    }
    __pyx_t_2 = PyUnicode_AsUTF8String(((PyObject*)__pyx_v_filename)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 1616, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_filename8 = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/apihelpers.pxi":1617
 *     elif isinstance(filename, unicode):
 *         filename8 = (<unicode>filename).encode('utf8')
 *         if _isFilePath(<unsigned char*>filename8):             # <<<<<<<<<<<<<<
 *             try:
 *                 return python.PyUnicode_AsEncodedString(
*/
    __pyx_t_3 = __Pyx_PyBytes_AsWritableUString(__pyx_v_filename8); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(4, 1617, __pyx_L1_error)
    __pyx_t_1 = __pyx_f_4lxml_5etree__isFilePath(((unsigned char *)__pyx_t_3));
    if (__pyx_t_1) {

      /* "src/lxml/apihelpers.pxi":1618
 *         filename8 = (<unicode>filename).encode('utf8')
 *         if _isFilePath(<unsigned char*>filename8):
 *             try:             # <<<<<<<<<<<<<<
 *                 return python.PyUnicode_AsEncodedString(
 *                     filename, _C_FILENAME_ENCODING, NULL)
*/
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
        __Pyx_XGOTREF(__pyx_t_4);
        __Pyx_XGOTREF(__pyx_t_5);
        __Pyx_XGOTREF(__pyx_t_6);
        /*try:*/ {

          /* "src/lxml/apihelpers.pxi":1619
 *         if _isFilePath(<unsigned char*>filename8):
 *             try:
 *                 return python.PyUnicode_AsEncodedString(             # <<<<<<<<<<<<<<
 *                     filename, _C_FILENAME_ENCODING, NULL)
 *             except UnicodeEncodeError:
*/
          __Pyx_XDECREF(__pyx_r);

          /* "src/lxml/apihelpers.pxi":1620
 *             try:
 *                 return python.PyUnicode_AsEncodedString(
 *                     filename, _C_FILENAME_ENCODING, NULL)             # <<<<<<<<<<<<<<
 *             except UnicodeEncodeError:
 *                 pass
*/
          __pyx_t_2 = PyUnicode_AsEncodedString(__pyx_v_filename, __pyx_v_4lxml_5etree__C_FILENAME_ENCODING, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 1619, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_r = __pyx_t_2;
          __pyx_t_2 = 0;
          goto __pyx_L9_try_return;

          /* "src/lxml/apihelpers.pxi":1618
 *         filename8 = (<unicode>filename).encode('utf8')
 *         if _isFilePath(<unsigned char*>filename8):
 *             try:             # <<<<<<<<<<<<<<
 *                 return python.PyUnicode_AsEncodedString(
 *                     filename, _C_FILENAME_ENCODING, NULL)
*/
        }
        __pyx_L5_error:;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "src/lxml/apihelpers.pxi":1621
 *                 return python.PyUnicode_AsEncodedString(
 *                     filename, _C_FILENAME_ENCODING, NULL)
 *             except UnicodeEncodeError:             # <<<<<<<<<<<<<<
 *                 pass
 *         return filename8
*/
        __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_UnicodeEncodeError))));
        if (__pyx_t_7) {
          __Pyx_ErrRestore(0,0,0);
          goto __pyx_L6_exception_handled;
        }
        goto __pyx_L7_except_error;

        /* "src/lxml/apihelpers.pxi":1618
 *         filename8 = (<unicode>filename).encode('utf8')
 *         if _isFilePath(<unsigned char*>filename8):
 *             try:             # <<<<<<<<<<<<<<
 *                 return python.PyUnicode_AsEncodedString(
 *                     filename, _C_FILENAME_ENCODING, NULL)
*/
        __pyx_L7_except_error:;
        __Pyx_XGIVEREF(__pyx_t_4);
        __Pyx_XGIVEREF(__pyx_t_5);
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
        goto __pyx_L1_error;
        __pyx_L9_try_return:;
        __Pyx_XGIVEREF(__pyx_t_4);
        __Pyx_XGIVEREF(__pyx_t_5);
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
        goto __pyx_L0;
        __pyx_L6_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_4);
        __Pyx_XGIVEREF(__pyx_t_5);
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
      }

      /* "src/lxml/apihelpers.pxi":1617
 *     elif isinstance(filename, unicode):
 *         filename8 = (<unicode>filename).encode('utf8')
 *         if _isFilePath(<unsigned char*>filename8):             # <<<<<<<<<<<<<<
 *             try:
 *                 return python.PyUnicode_AsEncodedString(
*/
    }

    /* "src/lxml/apihelpers.pxi":1623
 *             except UnicodeEncodeError:
 *                 pass
 *         return filename8             # <<<<<<<<<<<<<<
 *     else:
 *         raise TypeError("Argument must be string or unicode.")
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_filename8);
    __pyx_r = __pyx_v_filename8;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":1615
 *     elif isinstance(filename, bytes):
 *         return filename
 *     elif isinstance(filename, unicode):             # <<<<<<<<<<<<<<
 *         filename8 = (<unicode>filename).encode('utf8')
 *         if _isFilePath(<unsigned char*>filename8):
*/
  }

  /* "src/lxml/apihelpers.pxi":1625
 *         return filename8
 *     else:
 *         raise TypeError("Argument must be string or unicode.")             # <<<<<<<<<<<<<<
 * 
 * cdef object _decodeFilename(const_xmlChar* c_path):
*/
  /*else*/ {
    __pyx_t_8 = NULL;
    __pyx_t_9 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_mstate_global->__pyx_kp_u_Argument_must_be_string_or_unico};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 1625, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(4, 1625, __pyx_L1_error)
  }

  /* "src/lxml/apihelpers.pxi":1608
 * 
 * 
 * cdef object _encodeFilename(object filename):             # <<<<<<<<<<<<<<
 *     """Make sure a filename is 8-bit encoded (or None).
 *     """
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("lxml.etree._encodeFilename", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_filename8);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":1627
 *         raise TypeError("Argument must be string or unicode.")
 * 
 * cdef object _decodeFilename(const_xmlChar* c_path):             # <<<<<<<<<<<<<<
 *     """Make the filename a unicode string if we are in Py3.
 *     """
*/

static PyObject *__pyx_f_4lxml_5etree__decodeFilename(const xmlChar *__pyx_v_c_path) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_decodeFilename", 0);

  /* "src/lxml/apihelpers.pxi":1630
 *     """Make the filename a unicode string if we are in Py3.
 *     """
 *     return _decodeFilenameWithLength(c_path, tree.xmlStrlen(c_path))             # <<<<<<<<<<<<<<
 * 
 * cdef object _decodeFilenameWithLength(const_xmlChar* c_path, size_t c_len):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree__decodeFilenameWithLength(__pyx_v_c_path, xmlStrlen(__pyx_v_c_path)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1630, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1627
 *         raise TypeError("Argument must be string or unicode.")
 * 
 * cdef object _decodeFilename(const_xmlChar* c_path):             # <<<<<<<<<<<<<<
 *     """Make the filename a unicode string if we are in Py3.
 *     """
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._decodeFilename", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":1632
 *     return _decodeFilenameWithLength(c_path, tree.xmlStrlen(c_path))
 * 
 * cdef object _decodeFilenameWithLength(const_xmlChar* c_path, size_t c_len):             # <<<<<<<<<<<<<<
 *     """Make the filename a unicode string if we are in Py3.
 *     """
*/

static PyObject *__pyx_f_4lxml_5etree__decodeFilenameWithLength(const xmlChar *__pyx_v_c_path, size_t __pyx_v_c_len) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_decodeFilenameWithLength", 0);

  /* "src/lxml/apihelpers.pxi":1635
 *     """Make the filename a unicode string if we are in Py3.
 *     """
 *     if _isFilePath(c_path):             # <<<<<<<<<<<<<<
 *         try:
 *             return python.PyUnicode_Decode(
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__isFilePath(__pyx_v_c_path);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":1636
 *     """
 *     if _isFilePath(c_path):
 *         try:             # <<<<<<<<<<<<<<
 *             return python.PyUnicode_Decode(
 *                 <const_char*>c_path, c_len, _C_FILENAME_ENCODING, NULL)
*/
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_4);
      /*try:*/ {

        /* "src/lxml/apihelpers.pxi":1637
 *     if _isFilePath(c_path):
 *         try:
 *             return python.PyUnicode_Decode(             # <<<<<<<<<<<<<<
 *                 <const_char*>c_path, c_len, _C_FILENAME_ENCODING, NULL)
 *         except UnicodeDecodeError:
*/
        __Pyx_XDECREF(__pyx_r);

        /* "src/lxml/apihelpers.pxi":1638
 *         try:
 *             return python.PyUnicode_Decode(
 *                 <const_char*>c_path, c_len, _C_FILENAME_ENCODING, NULL)             # <<<<<<<<<<<<<<
 *         except UnicodeDecodeError:
 *             pass
*/
        __pyx_t_5 = PyUnicode_Decode(((const char *)__pyx_v_c_path), __pyx_v_c_len, __pyx_v_4lxml_5etree__C_FILENAME_ENCODING, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 1637, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_r = __pyx_t_5;
        __pyx_t_5 = 0;
        goto __pyx_L8_try_return;

        /* "src/lxml/apihelpers.pxi":1636
 *     """
 *     if _isFilePath(c_path):
 *         try:             # <<<<<<<<<<<<<<
 *             return python.PyUnicode_Decode(
 *                 <const_char*>c_path, c_len, _C_FILENAME_ENCODING, NULL)
*/
      }
      __pyx_L4_error:;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "src/lxml/apihelpers.pxi":1639
 *             return python.PyUnicode_Decode(
 *                 <const_char*>c_path, c_len, _C_FILENAME_ENCODING, NULL)
 *         except UnicodeDecodeError:             # <<<<<<<<<<<<<<
 *             pass
 *     try:
*/
      __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_UnicodeDecodeError))));
      if (__pyx_t_6) {
        __Pyx_ErrRestore(0,0,0);
        goto __pyx_L5_exception_handled;
      }
      goto __pyx_L6_except_error;

      /* "src/lxml/apihelpers.pxi":1636
 *     """
 *     if _isFilePath(c_path):
 *         try:             # <<<<<<<<<<<<<<
 *             return python.PyUnicode_Decode(
 *                 <const_char*>c_path, c_len, _C_FILENAME_ENCODING, NULL)
*/
      __pyx_L6_except_error:;
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
      goto __pyx_L1_error;
      __pyx_L8_try_return:;
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
      goto __pyx_L0;
      __pyx_L5_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    }

    /* "src/lxml/apihelpers.pxi":1635
 *     """Make the filename a unicode string if we are in Py3.
 *     """
 *     if _isFilePath(c_path):             # <<<<<<<<<<<<<<
 *         try:
 *             return python.PyUnicode_Decode(
*/
  }

  /* "src/lxml/apihelpers.pxi":1641
 *         except UnicodeDecodeError:
 *             pass
 *     try:             # <<<<<<<<<<<<<<
 *         return (<unsigned char*>c_path)[:c_len].decode('UTF-8')
 *     except UnicodeDecodeError:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_2);
    /*try:*/ {

      /* "src/lxml/apihelpers.pxi":1642
 *             pass
 *     try:
 *         return (<unsigned char*>c_path)[:c_len].decode('UTF-8')             # <<<<<<<<<<<<<<
 *     except UnicodeDecodeError:
 *         # this is a stupid fallback, but it might still work...
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_5 = __Pyx_decode_c_string(((char const *)((unsigned char *)__pyx_v_c_path)), 0, __pyx_v_c_len, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 1642, __pyx_L12_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L16_try_return;

      /* "src/lxml/apihelpers.pxi":1641
 *         except UnicodeDecodeError:
 *             pass
 *     try:             # <<<<<<<<<<<<<<
 *         return (<unsigned char*>c_path)[:c_len].decode('UTF-8')
 *     except UnicodeDecodeError:
*/
    }
    __pyx_L12_error:;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "src/lxml/apihelpers.pxi":1643
 *     try:
 *         return (<unsigned char*>c_path)[:c_len].decode('UTF-8')
 *     except UnicodeDecodeError:             # <<<<<<<<<<<<<<
 *         # this is a stupid fallback, but it might still work...
 *         return (<unsigned char*>c_path)[:c_len].decode('latin-1', 'replace')
*/
    __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_UnicodeDecodeError))));
    if (__pyx_t_6) {
      __Pyx_AddTraceback("lxml.etree._decodeFilenameWithLength", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_7, &__pyx_t_8) < 0) __PYX_ERR(4, 1643, __pyx_L14_except_error)
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);

      /* "src/lxml/apihelpers.pxi":1645
 *     except UnicodeDecodeError:
 *         # this is a stupid fallback, but it might still work...
 *         return (<unsigned char*>c_path)[:c_len].decode('latin-1', 'replace')             # <<<<<<<<<<<<<<
 * 
 * cdef object _encodeFilenameUTF8(object filename):
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_9 = __Pyx_decode_c_string(((char const *)((unsigned char *)__pyx_v_c_path)), 0, __pyx_v_c_len, NULL, __pyx_k_replace, PyUnicode_DecodeLatin1); if (unlikely(!__pyx_t_9)) __PYX_ERR(4, 1645, __pyx_L14_except_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_r = __pyx_t_9;
      __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L15_except_return;
    }
    goto __pyx_L14_except_error;

    /* "src/lxml/apihelpers.pxi":1641
 *         except UnicodeDecodeError:
 *             pass
 *     try:             # <<<<<<<<<<<<<<
 *         return (<unsigned char*>c_path)[:c_len].decode('UTF-8')
 *     except UnicodeDecodeError:
*/
    __pyx_L14_except_error:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_3, __pyx_t_2);
    goto __pyx_L1_error;
    __pyx_L16_try_return:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_3, __pyx_t_2);
    goto __pyx_L0;
    __pyx_L15_except_return:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_3, __pyx_t_2);
    goto __pyx_L0;
  }

  /* "src/lxml/apihelpers.pxi":1632
 *     return _decodeFilenameWithLength(c_path, tree.xmlStrlen(c_path))
 * 
 * cdef object _decodeFilenameWithLength(const_xmlChar* c_path, size_t c_len):             # <<<<<<<<<<<<<<
 *     """Make the filename a unicode string if we are in Py3.
 *     """
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("lxml.etree._decodeFilenameWithLength", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":1647
 *         return (<unsigned char*>c_path)[:c_len].decode('latin-1', 'replace')
 * 
 * cdef object _encodeFilenameUTF8(object filename):             # <<<<<<<<<<<<<<
 *     """Recode filename as UTF-8. Tries ASCII, local filesystem encoding and
 *     UTF-8 as source encoding.
*/

static PyObject *__pyx_f_4lxml_5etree__encodeFilenameUTF8(PyObject *__pyx_v_filename) {
  char *__pyx_v_c_filename;
  PyObject *__pyx_v_decode_exc = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  const xmlChar *__pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  int __pyx_t_17;
  char const *__pyx_t_18;
  PyObject *__pyx_t_19 = NULL;
  PyObject *__pyx_t_20 = NULL;
  PyObject *__pyx_t_21 = NULL;
  size_t __pyx_t_22;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_encodeFilenameUTF8", 0);
  __Pyx_INCREF(__pyx_v_filename);

  /* "src/lxml/apihelpers.pxi":1652
 *     """
 *     cdef char* c_filename
 *     if filename is None:             # <<<<<<<<<<<<<<
 *         return None
 *     elif isinstance(filename, bytes):
*/
  __pyx_t_1 = (__pyx_v_filename == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":1653
 *     cdef char* c_filename
 *     if filename is None:
 *         return None             # <<<<<<<<<<<<<<
 *     elif isinstance(filename, bytes):
 *         if not isutf8l(<bytes>filename, len(<bytes>filename)):
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":1652
 *     """
 *     cdef char* c_filename
 *     if filename is None:             # <<<<<<<<<<<<<<
 *         return None
 *     elif isinstance(filename, bytes):
*/
  }

  /* "src/lxml/apihelpers.pxi":1654
 *     if filename is None:
 *         return None
 *     elif isinstance(filename, bytes):             # <<<<<<<<<<<<<<
 *         if not isutf8l(<bytes>filename, len(<bytes>filename)):
 *             # plain ASCII!
*/
  __pyx_t_1 = PyBytes_Check(__pyx_v_filename); 
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":1655
 *         return None
 *     elif isinstance(filename, bytes):
 *         if not isutf8l(<bytes>filename, len(<bytes>filename)):             # <<<<<<<<<<<<<<
 *             # plain ASCII!
 *             return filename
*/
    if (unlikely(__pyx_v_filename == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
      __PYX_ERR(4, 1655, __pyx_L1_error)
    }
    __pyx_t_2 = __Pyx_PyBytes_AsUString(__pyx_v_filename); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(4, 1655, __pyx_L1_error)
    if (unlikely(__pyx_v_filename == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
      __PYX_ERR(4, 1655, __pyx_L1_error)
    }
    __pyx_t_3 = __Pyx_PyBytes_GET_SIZE(((PyObject*)__pyx_v_filename)); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(4, 1655, __pyx_L1_error)
    __pyx_t_1 = (!__pyx_f_4lxml_5etree_isutf8l(__pyx_t_2, __pyx_t_3));
    if (__pyx_t_1) {

      /* "src/lxml/apihelpers.pxi":1657
 *         if not isutf8l(<bytes>filename, len(<bytes>filename)):
 *             # plain ASCII!
 *             return filename             # <<<<<<<<<<<<<<
 *         c_filename = _cstr(<bytes>filename)
 *         try:
*/
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_filename);
      __pyx_r = __pyx_v_filename;
      goto __pyx_L0;

      /* "src/lxml/apihelpers.pxi":1655
 *         return None
 *     elif isinstance(filename, bytes):
 *         if not isutf8l(<bytes>filename, len(<bytes>filename)):             # <<<<<<<<<<<<<<
 *             # plain ASCII!
 *             return filename
*/
    }

    /* "src/lxml/apihelpers.pxi":1658
 *             # plain ASCII!
 *             return filename
 *         c_filename = _cstr(<bytes>filename)             # <<<<<<<<<<<<<<
 *         try:
 *             # try to decode with default encoding
*/
    __pyx_v_c_filename = PyBytes_AS_STRING(__pyx_v_filename);

    /* "src/lxml/apihelpers.pxi":1659
 *             return filename
 *         c_filename = _cstr(<bytes>filename)
 *         try:             # <<<<<<<<<<<<<<
 *             # try to decode with default encoding
 *             filename = python.PyUnicode_Decode(
*/
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_6);
      /*try:*/ {

        /* "src/lxml/apihelpers.pxi":1662
 *             # try to decode with default encoding
 *             filename = python.PyUnicode_Decode(
 *                 c_filename, len(<bytes>filename),             # <<<<<<<<<<<<<<
 *                 _C_FILENAME_ENCODING, NULL)
 *         except UnicodeDecodeError as decode_exc:
*/
        if (unlikely(__pyx_v_filename == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
          __PYX_ERR(4, 1662, __pyx_L5_error)
        }
        __pyx_t_3 = __Pyx_PyBytes_GET_SIZE(((PyObject*)__pyx_v_filename)); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(4, 1662, __pyx_L5_error)

        /* "src/lxml/apihelpers.pxi":1661
 *         try:
 *             # try to decode with default encoding
 *             filename = python.PyUnicode_Decode(             # <<<<<<<<<<<<<<
 *                 c_filename, len(<bytes>filename),
 *                 _C_FILENAME_ENCODING, NULL)
*/
        __pyx_t_7 = PyUnicode_Decode(__pyx_v_c_filename, __pyx_t_3, __pyx_v_4lxml_5etree__C_FILENAME_ENCODING, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 1661, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF_SET(__pyx_v_filename, __pyx_t_7);
        __pyx_t_7 = 0;

        /* "src/lxml/apihelpers.pxi":1659
 *             return filename
 *         c_filename = _cstr(<bytes>filename)
 *         try:             # <<<<<<<<<<<<<<
 *             # try to decode with default encoding
 *             filename = python.PyUnicode_Decode(
*/
      }
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L10_try_end;
      __pyx_L5_error:;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "src/lxml/apihelpers.pxi":1664
 *                 c_filename, len(<bytes>filename),
 *                 _C_FILENAME_ENCODING, NULL)
 *         except UnicodeDecodeError as decode_exc:             # <<<<<<<<<<<<<<
 *             try:
 *                 # try if it's proper UTF-8
*/
      __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_UnicodeDecodeError))));
      if (__pyx_t_8) {
        __Pyx_AddTraceback("lxml.etree._encodeFilenameUTF8", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_9, &__pyx_t_10) < 0) __PYX_ERR(4, 1664, __pyx_L7_except_error)
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_9);
        __Pyx_XGOTREF(__pyx_t_10);
        __Pyx_INCREF(__pyx_t_9);
        __pyx_v_decode_exc = __pyx_t_9;
        /*try:*/ {

          /* "src/lxml/apihelpers.pxi":1665
 *                 _C_FILENAME_ENCODING, NULL)
 *         except UnicodeDecodeError as decode_exc:
 *             try:             # <<<<<<<<<<<<<<
 *                 # try if it's proper UTF-8
 *                 (<bytes>filename).decode('utf8')
*/
          {
            __Pyx_PyThreadState_declare
            __Pyx_PyThreadState_assign
            __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
            __Pyx_XGOTREF(__pyx_t_11);
            __Pyx_XGOTREF(__pyx_t_12);
            __Pyx_XGOTREF(__pyx_t_13);
            /*try:*/ {

              /* "src/lxml/apihelpers.pxi":1667
 *             try:
 *                 # try if it's proper UTF-8
 *                 (<bytes>filename).decode('utf8')             # <<<<<<<<<<<<<<
 *                 return filename
 *             except UnicodeDecodeError:
*/
              if (unlikely(__pyx_v_filename == Py_None)) {
                PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "decode");
                __PYX_ERR(4, 1667, __pyx_L18_error)
              }
              __pyx_t_14 = __Pyx_decode_bytes(((PyObject*)__pyx_v_filename), 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_14)) __PYX_ERR(4, 1667, __pyx_L18_error)
              __Pyx_GOTREF(__pyx_t_14);
              __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

              /* "src/lxml/apihelpers.pxi":1668
 *                 # try if it's proper UTF-8
 *                 (<bytes>filename).decode('utf8')
 *                 return filename             # <<<<<<<<<<<<<<
 *             except UnicodeDecodeError:
 *                 raise decode_exc # otherwise re-raise original exception
*/
              __Pyx_XDECREF(__pyx_r);
              __Pyx_INCREF(__pyx_v_filename);
              __pyx_r = __pyx_v_filename;
              __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
              goto __pyx_L22_try_return;

              /* "src/lxml/apihelpers.pxi":1665
 *                 _C_FILENAME_ENCODING, NULL)
 *         except UnicodeDecodeError as decode_exc:
 *             try:             # <<<<<<<<<<<<<<
 *                 # try if it's proper UTF-8
 *                 (<bytes>filename).decode('utf8')
*/
            }
            __pyx_L18_error:;
            __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;

            /* "src/lxml/apihelpers.pxi":1669
 *                 (<bytes>filename).decode('utf8')
 *                 return filename
 *             except UnicodeDecodeError:             # <<<<<<<<<<<<<<
 *                 raise decode_exc # otherwise re-raise original exception
 *     if isinstance(filename, unicode):
*/
            __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_UnicodeDecodeError))));
            if (__pyx_t_8) {
              __Pyx_AddTraceback("lxml.etree._encodeFilenameUTF8", __pyx_clineno, __pyx_lineno, __pyx_filename);
              if (__Pyx_GetException(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16) < 0) __PYX_ERR(4, 1669, __pyx_L20_except_error)
              __Pyx_XGOTREF(__pyx_t_14);
              __Pyx_XGOTREF(__pyx_t_15);
              __Pyx_XGOTREF(__pyx_t_16);

              /* "src/lxml/apihelpers.pxi":1670
 *                 return filename
 *             except UnicodeDecodeError:
 *                 raise decode_exc # otherwise re-raise original exception             # <<<<<<<<<<<<<<
 *     if isinstance(filename, unicode):
 *         return (<unicode>filename).encode('utf8')
*/
              __Pyx_Raise(__pyx_v_decode_exc, 0, 0, 0);
              __PYX_ERR(4, 1670, __pyx_L20_except_error)
            }
            goto __pyx_L20_except_error;

            /* "src/lxml/apihelpers.pxi":1665
 *                 _C_FILENAME_ENCODING, NULL)
 *         except UnicodeDecodeError as decode_exc:
 *             try:             # <<<<<<<<<<<<<<
 *                 # try if it's proper UTF-8
 *                 (<bytes>filename).decode('utf8')
*/
            __pyx_L20_except_error:;
            __Pyx_XGIVEREF(__pyx_t_11);
            __Pyx_XGIVEREF(__pyx_t_12);
            __Pyx_XGIVEREF(__pyx_t_13);
            __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
            goto __pyx_L16_error;
            __pyx_L22_try_return:;
            __Pyx_XGIVEREF(__pyx_t_11);
            __Pyx_XGIVEREF(__pyx_t_12);
            __Pyx_XGIVEREF(__pyx_t_13);
            __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
            goto __pyx_L15_return;
          }
        }

        /* "src/lxml/apihelpers.pxi":1664
 *                 c_filename, len(<bytes>filename),
 *                 _C_FILENAME_ENCODING, NULL)
 *         except UnicodeDecodeError as decode_exc:             # <<<<<<<<<<<<<<
 *             try:
 *                 # try if it's proper UTF-8
*/
        /*finally:*/ {
          __pyx_L16_error:;
          /*exception exit:*/{
            __Pyx_PyThreadState_declare
            __Pyx_PyThreadState_assign
            __pyx_t_13 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0;
            __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
            __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
            __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
             __Pyx_ExceptionSwap(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21);
            if ( unlikely(__Pyx_GetException(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11) < 0)) __Pyx_ErrFetch(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11);
            __Pyx_XGOTREF(__pyx_t_13);
            __Pyx_XGOTREF(__pyx_t_12);
            __Pyx_XGOTREF(__pyx_t_11);
            __Pyx_XGOTREF(__pyx_t_19);
            __Pyx_XGOTREF(__pyx_t_20);
            __Pyx_XGOTREF(__pyx_t_21);
            __pyx_t_8 = __pyx_lineno; __pyx_t_17 = __pyx_clineno; __pyx_t_18 = __pyx_filename;
            {
              __Pyx_DECREF(__pyx_v_decode_exc); __pyx_v_decode_exc = 0;
            }
            __Pyx_XGIVEREF(__pyx_t_19);
            __Pyx_XGIVEREF(__pyx_t_20);
            __Pyx_XGIVEREF(__pyx_t_21);
            __Pyx_ExceptionReset(__pyx_t_19, __pyx_t_20, __pyx_t_21);
            __Pyx_XGIVEREF(__pyx_t_13);
            __Pyx_XGIVEREF(__pyx_t_12);
            __Pyx_XGIVEREF(__pyx_t_11);
            __Pyx_ErrRestore(__pyx_t_13, __pyx_t_12, __pyx_t_11);
            __pyx_t_13 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0;
            __pyx_lineno = __pyx_t_8; __pyx_clineno = __pyx_t_17; __pyx_filename = __pyx_t_18;
            goto __pyx_L7_except_error;
          }
          __pyx_L15_return: {
            __pyx_t_21 = __pyx_r;
            __pyx_r = 0;
            __Pyx_DECREF(__pyx_v_decode_exc); __pyx_v_decode_exc = 0;
            __pyx_r = __pyx_t_21;
            __pyx_t_21 = 0;
            goto __pyx_L8_except_return;
          }
        }
      }
      goto __pyx_L7_except_error;

      /* "src/lxml/apihelpers.pxi":1659
 *             return filename
 *         c_filename = _cstr(<bytes>filename)
 *         try:             # <<<<<<<<<<<<<<
 *             # try to decode with default encoding
 *             filename = python.PyUnicode_Decode(
*/
      __pyx_L7_except_error:;
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
      goto __pyx_L1_error;
      __pyx_L8_except_return:;
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
      goto __pyx_L0;
      __pyx_L10_try_end:;
    }

    /* "src/lxml/apihelpers.pxi":1654
 *     if filename is None:
 *         return None
 *     elif isinstance(filename, bytes):             # <<<<<<<<<<<<<<
 *         if not isutf8l(<bytes>filename, len(<bytes>filename)):
 *             # plain ASCII!
*/
  }

  /* "src/lxml/apihelpers.pxi":1671
 *             except UnicodeDecodeError:
 *                 raise decode_exc # otherwise re-raise original exception
 *     if isinstance(filename, unicode):             # <<<<<<<<<<<<<<
 *         return (<unicode>filename).encode('utf8')
 *     else:
*/
  __pyx_t_1 = PyUnicode_Check(__pyx_v_filename); 
  if (likely(__pyx_t_1)) {

    /* "src/lxml/apihelpers.pxi":1672
 *                 raise decode_exc # otherwise re-raise original exception
 *     if isinstance(filename, unicode):
 *         return (<unicode>filename).encode('utf8')             # <<<<<<<<<<<<<<
 *     else:
 *         raise TypeError("Argument must be string or unicode.")
*/
    __Pyx_XDECREF(__pyx_r);
    if (unlikely(__pyx_v_filename == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode");
      __PYX_ERR(4, 1672, __pyx_L1_error)
    }
    __pyx_t_10 = PyUnicode_AsUTF8String(((PyObject*)__pyx_v_filename)); if (unlikely(!__pyx_t_10)) __PYX_ERR(4, 1672, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_r = __pyx_t_10;
    __pyx_t_10 = 0;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":1671
 *             except UnicodeDecodeError:
 *                 raise decode_exc # otherwise re-raise original exception
 *     if isinstance(filename, unicode):             # <<<<<<<<<<<<<<
 *         return (<unicode>filename).encode('utf8')
 *     else:
*/
  }

  /* "src/lxml/apihelpers.pxi":1674
 *         return (<unicode>filename).encode('utf8')
 *     else:
 *         raise TypeError("Argument must be string or unicode.")             # <<<<<<<<<<<<<<
 * 
 * cdef tuple _getNsTag(tag):
*/
  /*else*/ {
    __pyx_t_9 = NULL;
    __pyx_t_22 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_mstate_global->__pyx_kp_u_Argument_must_be_string_or_unico};
      __pyx_t_10 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __pyx_callargs+__pyx_t_22, (2-__pyx_t_22) | (__pyx_t_22*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(!__pyx_t_10)) __PYX_ERR(4, 1674, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
    }
    __Pyx_Raise(__pyx_t_10, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __PYX_ERR(4, 1674, __pyx_L1_error)
  }

  /* "src/lxml/apihelpers.pxi":1647
 *         return (<unsigned char*>c_path)[:c_len].decode('latin-1', 'replace')
 * 
 * cdef object _encodeFilenameUTF8(object filename):             # <<<<<<<<<<<<<<
 *     """Recode filename as UTF-8. Tries ASCII, local filesystem encoding and
 *     UTF-8 as source encoding.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_AddTraceback("lxml.etree._encodeFilenameUTF8", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_decode_exc);
  __Pyx_XDECREF(__pyx_v_filename);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":1676
 *         raise TypeError("Argument must be string or unicode.")
 * 
 * cdef tuple _getNsTag(tag):             # <<<<<<<<<<<<<<
 *     """Given a tag, find namespace URI and tag name.
 *     Return None for NS uri if no namespace URI provided.
*/

static PyObject *__pyx_f_4lxml_5etree__getNsTag(PyObject *__pyx_v_tag) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_getNsTag", 0);

  /* "src/lxml/apihelpers.pxi":1680
 *     Return None for NS uri if no namespace URI provided.
 *     """
 *     return __getNsTag(tag, 0)             # <<<<<<<<<<<<<<
 * 
 * cdef tuple _getNsTagWithEmptyNs(tag):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree___getNsTag(__pyx_v_tag, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1680, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1676
 *         raise TypeError("Argument must be string or unicode.")
 * 
 * cdef tuple _getNsTag(tag):             # <<<<<<<<<<<<<<
 *     """Given a tag, find namespace URI and tag name.
 *     Return None for NS uri if no namespace URI provided.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._getNsTag", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":1682
 *     return __getNsTag(tag, 0)
 * 
 * cdef tuple _getNsTagWithEmptyNs(tag):             # <<<<<<<<<<<<<<
 *     """Given a tag, find namespace URI and tag name.  Return None for NS uri
 *     if no namespace URI provided, or the empty string if namespace
*/

static PyObject *__pyx_f_4lxml_5etree__getNsTagWithEmptyNs(PyObject *__pyx_v_tag) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_getNsTagWithEmptyNs", 0);

  /* "src/lxml/apihelpers.pxi":1687
 *     part is '{}'.
 *     """
 *     return __getNsTag(tag, 1)             # <<<<<<<<<<<<<<
 * 
 * cdef tuple __getNsTag(tag, bint empty_ns):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree___getNsTag(__pyx_v_tag, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1687, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1682
 *     return __getNsTag(tag, 0)
 * 
 * cdef tuple _getNsTagWithEmptyNs(tag):             # <<<<<<<<<<<<<<
 *     """Given a tag, find namespace URI and tag name.  Return None for NS uri
 *     if no namespace URI provided, or the empty string if namespace
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._getNsTagWithEmptyNs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":1689
 *     return __getNsTag(tag, 1)
 * 
 * cdef tuple __getNsTag(tag, bint empty_ns):             # <<<<<<<<<<<<<<
 *     cdef char* c_tag
 *     cdef char* c_ns_end
*/

static PyObject *__pyx_f_4lxml_5etree___getNsTag(PyObject *__pyx_v_tag, int __pyx_v_empty_ns) {
  char *__pyx_v_c_tag;
  char *__pyx_v_c_ns_end;
  Py_ssize_t __pyx_v_taglen;
  Py_ssize_t __pyx_v_nslen;
  PyObject *__pyx_v_ns = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getNsTag", 0);
  __Pyx_INCREF(__pyx_v_tag);

  /* "src/lxml/apihelpers.pxi":1694
 *     cdef Py_ssize_t taglen
 *     cdef Py_ssize_t nslen
 *     cdef bytes ns = None             # <<<<<<<<<<<<<<
 *     # _isString() is much faster than isinstance()
 *     if not _isString(tag) and isinstance(tag, QName):
*/
  __Pyx_INCREF(Py_None);
  __pyx_v_ns = ((PyObject*)Py_None);

  /* "src/lxml/apihelpers.pxi":1696
 *     cdef bytes ns = None
 *     # _isString() is much faster than isinstance()
 *     if not _isString(tag) and isinstance(tag, QName):             # <<<<<<<<<<<<<<
 *         tag = (<QName>tag).text
 *     tag = _utf8(tag)
*/
  __pyx_t_2 = (!_isString(__pyx_v_tag));
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_tag, __pyx_mstate_global->__pyx_ptype_4lxml_5etree_QName); 
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":1697
 *     # _isString() is much faster than isinstance()
 *     if not _isString(tag) and isinstance(tag, QName):
 *         tag = (<QName>tag).text             # <<<<<<<<<<<<<<
 *     tag = _utf8(tag)
 *     c_tag = _cstr(tag)
*/
    __pyx_t_3 = ((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_tag)->text;
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_tag, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/apihelpers.pxi":1696
 *     cdef bytes ns = None
 *     # _isString() is much faster than isinstance()
 *     if not _isString(tag) and isinstance(tag, QName):             # <<<<<<<<<<<<<<
 *         tag = (<QName>tag).text
 *     tag = _utf8(tag)
*/
  }

  /* "src/lxml/apihelpers.pxi":1698
 *     if not _isString(tag) and isinstance(tag, QName):
 *         tag = (<QName>tag).text
 *     tag = _utf8(tag)             # <<<<<<<<<<<<<<
 *     c_tag = _cstr(tag)
 *     if c_tag[0] == c'{':
*/
  __pyx_t_3 = __pyx_f_4lxml_5etree__utf8(__pyx_v_tag); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 1698, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF_SET(__pyx_v_tag, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/apihelpers.pxi":1699
 *         tag = (<QName>tag).text
 *     tag = _utf8(tag)
 *     c_tag = _cstr(tag)             # <<<<<<<<<<<<<<
 *     if c_tag[0] == c'{':
 *         c_tag += 1
*/
  __pyx_v_c_tag = PyBytes_AS_STRING(__pyx_v_tag);

  /* "src/lxml/apihelpers.pxi":1700
 *     tag = _utf8(tag)
 *     c_tag = _cstr(tag)
 *     if c_tag[0] == c'{':             # <<<<<<<<<<<<<<
 *         c_tag += 1
 *         c_ns_end = cstring_h.strchr(c_tag, c'}')
*/
  __pyx_t_1 = ((__pyx_v_c_tag[0]) == '{');
    if (__pyx_t_1) {

      /* "src/lxml/apihelpers.pxi":1701
 *     c_tag = _cstr(tag)
 *     if c_tag[0] == c'{':
 *         c_tag += 1             # <<<<<<<<<<<<<<
 *         c_ns_end = cstring_h.strchr(c_tag, c'}')
 *         if c_ns_end is NULL:
*/
      __pyx_v_c_tag = (__pyx_v_c_tag + 1);

      /* "src/lxml/apihelpers.pxi":1702
 *     if c_tag[0] == c'{':
 *         c_tag += 1
 *         c_ns_end = cstring_h.strchr(c_tag, c'}')             # <<<<<<<<<<<<<<
 *         if c_ns_end is NULL:
 *             raise ValueError, "Invalid tag name"
*/
    __pyx_v_c_ns_end = strchr(__pyx_v_c_tag, '}');

    /* "src/lxml/apihelpers.pxi":1703
 *         c_tag += 1
 *         c_ns_end = cstring_h.strchr(c_tag, c'}')
 *         if c_ns_end is NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError, "Invalid tag name"
 *         nslen  = c_ns_end - c_tag
*/
    __pyx_t_1 = (__pyx_v_c_ns_end == NULL);
    if (unlikely(__pyx_t_1)) {

      /* "src/lxml/apihelpers.pxi":1704
 *         c_ns_end = cstring_h.strchr(c_tag, c'}')
 *         if c_ns_end is NULL:
 *             raise ValueError, "Invalid tag name"             # <<<<<<<<<<<<<<
 *         nslen  = c_ns_end - c_tag
 *         taglen = python.PyBytes_GET_SIZE(tag) - nslen - 2
*/
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Invalid_tag_name, 0, 0);
      __PYX_ERR(4, 1704, __pyx_L1_error)

      /* "src/lxml/apihelpers.pxi":1703
 *         c_tag += 1
 *         c_ns_end = cstring_h.strchr(c_tag, c'}')
 *         if c_ns_end is NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError, "Invalid tag name"
 *         nslen  = c_ns_end - c_tag
*/
    }

    /* "src/lxml/apihelpers.pxi":1705
 *         if c_ns_end is NULL:
 *             raise ValueError, "Invalid tag name"
 *         nslen  = c_ns_end - c_tag             # <<<<<<<<<<<<<<
 *         taglen = python.PyBytes_GET_SIZE(tag) - nslen - 2
 *         if taglen == 0:
*/
    __pyx_v_nslen = (__pyx_v_c_ns_end - __pyx_v_c_tag);

    /* "src/lxml/apihelpers.pxi":1706
 *             raise ValueError, "Invalid tag name"
 *         nslen  = c_ns_end - c_tag
 *         taglen = python.PyBytes_GET_SIZE(tag) - nslen - 2             # <<<<<<<<<<<<<<
 *         if taglen == 0:
 *             raise ValueError, "Empty tag name"
*/
    __pyx_v_taglen = ((PyBytes_GET_SIZE(__pyx_v_tag) - __pyx_v_nslen) - 2);

    /* "src/lxml/apihelpers.pxi":1707
 *         nslen  = c_ns_end - c_tag
 *         taglen = python.PyBytes_GET_SIZE(tag) - nslen - 2
 *         if taglen == 0:             # <<<<<<<<<<<<<<
 *             raise ValueError, "Empty tag name"
 *         if nslen > 0:
*/
    __pyx_t_1 = (__pyx_v_taglen == 0);
    if (unlikely(__pyx_t_1)) {

      /* "src/lxml/apihelpers.pxi":1708
 *         taglen = python.PyBytes_GET_SIZE(tag) - nslen - 2
 *         if taglen == 0:
 *             raise ValueError, "Empty tag name"             # <<<<<<<<<<<<<<
 *         if nslen > 0:
 *             ns = <bytes>c_tag[:nslen]
*/
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Empty_tag_name, 0, 0);
      __PYX_ERR(4, 1708, __pyx_L1_error)

      /* "src/lxml/apihelpers.pxi":1707
 *         nslen  = c_ns_end - c_tag
 *         taglen = python.PyBytes_GET_SIZE(tag) - nslen - 2
 *         if taglen == 0:             # <<<<<<<<<<<<<<
 *             raise ValueError, "Empty tag name"
 *         if nslen > 0:
*/
    }

    /* "src/lxml/apihelpers.pxi":1709
 *         if taglen == 0:
 *             raise ValueError, "Empty tag name"
 *         if nslen > 0:             # <<<<<<<<<<<<<<
 *             ns = <bytes>c_tag[:nslen]
 *         elif empty_ns:
*/
    __pyx_t_1 = (__pyx_v_nslen > 0);
    if (__pyx_t_1) {

      /* "src/lxml/apihelpers.pxi":1710
 *             raise ValueError, "Empty tag name"
 *         if nslen > 0:
 *             ns = <bytes>c_tag[:nslen]             # <<<<<<<<<<<<<<
 *         elif empty_ns:
 *             ns = b''
*/
      __pyx_t_3 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_c_tag + 0, __pyx_v_nslen - 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 1710, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __pyx_t_3;
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF_SET(__pyx_v_ns, ((PyObject*)__pyx_t_4));
      __pyx_t_4 = 0;

      /* "src/lxml/apihelpers.pxi":1709
 *         if taglen == 0:
 *             raise ValueError, "Empty tag name"
 *         if nslen > 0:             # <<<<<<<<<<<<<<
 *             ns = <bytes>c_tag[:nslen]
 *         elif empty_ns:
*/
      goto __pyx_L9;
    }

    /* "src/lxml/apihelpers.pxi":1711
 *         if nslen > 0:
 *             ns = <bytes>c_tag[:nslen]
 *         elif empty_ns:             # <<<<<<<<<<<<<<
 *             ns = b''
 *         tag = <bytes>c_ns_end[1:taglen+1]
*/
    if (__pyx_v_empty_ns) {

      /* "src/lxml/apihelpers.pxi":1712
 *             ns = <bytes>c_tag[:nslen]
 *         elif empty_ns:
 *             ns = b''             # <<<<<<<<<<<<<<
 *         tag = <bytes>c_ns_end[1:taglen+1]
 *     elif python.PyBytes_GET_SIZE(tag) == 0:
*/
      __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_b__8);
      __Pyx_DECREF_SET(__pyx_v_ns, __pyx_mstate_global->__pyx_kp_b__8);

      /* "src/lxml/apihelpers.pxi":1711
 *         if nslen > 0:
 *             ns = <bytes>c_tag[:nslen]
 *         elif empty_ns:             # <<<<<<<<<<<<<<
 *             ns = b''
 *         tag = <bytes>c_ns_end[1:taglen+1]
*/
    }
    __pyx_L9:;

    /* "src/lxml/apihelpers.pxi":1713
 *         elif empty_ns:
 *             ns = b''
 *         tag = <bytes>c_ns_end[1:taglen+1]             # <<<<<<<<<<<<<<
 *     elif python.PyBytes_GET_SIZE(tag) == 0:
 *         raise ValueError, "Empty tag name"
*/
    __pyx_t_4 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_c_ns_end + 1, (__pyx_v_taglen + 1) - 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 1713, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __pyx_t_4;
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_tag, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/apihelpers.pxi":1700
 *     tag = _utf8(tag)
 *     c_tag = _cstr(tag)
 *     if c_tag[0] == c'{':             # <<<<<<<<<<<<<<
 *         c_tag += 1
 *         c_ns_end = cstring_h.strchr(c_tag, c'}')
*/
    goto __pyx_L6;
  }

  /* "src/lxml/apihelpers.pxi":1714
 *             ns = b''
 *         tag = <bytes>c_ns_end[1:taglen+1]
 *     elif python.PyBytes_GET_SIZE(tag) == 0:             # <<<<<<<<<<<<<<
 *         raise ValueError, "Empty tag name"
 *     return ns, tag
*/
  __pyx_t_1 = (PyBytes_GET_SIZE(__pyx_v_tag) == 0);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/apihelpers.pxi":1715
 *         tag = <bytes>c_ns_end[1:taglen+1]
 *     elif python.PyBytes_GET_SIZE(tag) == 0:
 *         raise ValueError, "Empty tag name"             # <<<<<<<<<<<<<<
 *     return ns, tag
 * 
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Empty_tag_name, 0, 0);
    __PYX_ERR(4, 1715, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":1714
 *             ns = b''
 *         tag = <bytes>c_ns_end[1:taglen+1]
 *     elif python.PyBytes_GET_SIZE(tag) == 0:             # <<<<<<<<<<<<<<
 *         raise ValueError, "Empty tag name"
 *     return ns, tag
*/
  }
  __pyx_L6:;

  /* "src/lxml/apihelpers.pxi":1716
 *     elif python.PyBytes_GET_SIZE(tag) == 0:
 *         raise ValueError, "Empty tag name"
 *     return ns, tag             # <<<<<<<<<<<<<<
 * 
 * cdef inline int _pyXmlNameIsValid(name_utf8):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 1716, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_ns);
  __Pyx_GIVEREF(__pyx_v_ns);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_ns) != (0)) __PYX_ERR(4, 1716, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_tag);
  __Pyx_GIVEREF(__pyx_v_tag);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_tag) != (0)) __PYX_ERR(4, 1716, __pyx_L1_error);
  __pyx_r = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1689
 *     return __getNsTag(tag, 1)
 * 
 * cdef tuple __getNsTag(tag, bint empty_ns):             # <<<<<<<<<<<<<<
 *     cdef char* c_tag
 *     cdef char* c_ns_end
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.__getNsTag", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ns);
  __Pyx_XDECREF(__pyx_v_tag);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":1718
 *     return ns, tag
 * 
 * cdef inline int _pyXmlNameIsValid(name_utf8):             # <<<<<<<<<<<<<<
 *     return _xmlNameIsValid(_xcstr(name_utf8)) and b':' not in name_utf8
 * 
*/

static CYTHON_INLINE int __pyx_f_4lxml_5etree__pyXmlNameIsValid(PyObject *__pyx_v_name_utf8) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/apihelpers.pxi":1719
 * 
 * cdef inline int _pyXmlNameIsValid(name_utf8):
 *     return _xmlNameIsValid(_xcstr(name_utf8)) and b':' not in name_utf8             # <<<<<<<<<<<<<<
 * 
 * cdef inline int _pyHtmlNameIsValid(name_utf8):
*/
  __pyx_t_2 = __pyx_f_4lxml_5etree__xmlNameIsValid((const xmlChar*)PyBytes_AS_STRING(__pyx_v_name_utf8));
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L3_bool_binop_done;
  }
  __pyx_t_3 = (__Pyx_PySequence_ContainsTF(__pyx_mstate_global->__pyx_kp_b__9, __pyx_v_name_utf8, Py_NE)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(4, 1719, __pyx_L1_error)
  __pyx_t_1 = __pyx_t_3;
  __pyx_L3_bool_binop_done:;
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1718
 *     return ns, tag
 * 
 * cdef inline int _pyXmlNameIsValid(name_utf8):             # <<<<<<<<<<<<<<
 *     return _xmlNameIsValid(_xcstr(name_utf8)) and b':' not in name_utf8
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._pyXmlNameIsValid", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":1721
 *     return _xmlNameIsValid(_xcstr(name_utf8)) and b':' not in name_utf8
 * 
 * cdef inline int _pyHtmlNameIsValid(name_utf8):             # <<<<<<<<<<<<<<
 *     return _htmlNameIsValid(_xcstr(name_utf8))
 * 
*/

static CYTHON_INLINE int __pyx_f_4lxml_5etree__pyHtmlNameIsValid(PyObject *__pyx_v_name_utf8) {
  int __pyx_r;

  /* "src/lxml/apihelpers.pxi":1722
 * 
 * cdef inline int _pyHtmlNameIsValid(name_utf8):
 *     return _htmlNameIsValid(_xcstr(name_utf8))             # <<<<<<<<<<<<<<
 * 
 * cdef inline int _xmlNameIsValid(const_xmlChar* c_name) noexcept:
*/
  __pyx_r = __pyx_f_4lxml_5etree__htmlNameIsValid((const xmlChar*)PyBytes_AS_STRING(__pyx_v_name_utf8));
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1721
 *     return _xmlNameIsValid(_xcstr(name_utf8)) and b':' not in name_utf8
 * 
 * cdef inline int _pyHtmlNameIsValid(name_utf8):             # <<<<<<<<<<<<<<
 *     return _htmlNameIsValid(_xcstr(name_utf8))
 * 
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":1724
 *     return _htmlNameIsValid(_xcstr(name_utf8))
 * 
 * cdef inline int _xmlNameIsValid(const_xmlChar* c_name) noexcept:             # <<<<<<<<<<<<<<
 *     return tree.xmlValidateNameValue(c_name)
 * 
*/

static CYTHON_INLINE int __pyx_f_4lxml_5etree__xmlNameIsValid(const xmlChar *__pyx_v_c_name) {
  int __pyx_r;

  /* "src/lxml/apihelpers.pxi":1725
 * 
 * cdef inline int _xmlNameIsValid(const_xmlChar* c_name) noexcept:
 *     return tree.xmlValidateNameValue(c_name)             # <<<<<<<<<<<<<<
 * 
 * cdef int _htmlNameIsValid(const_xmlChar* c_name) noexcept:
*/
  __pyx_r = xmlValidateNameValue(__pyx_v_c_name);
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1724
 *     return _htmlNameIsValid(_xcstr(name_utf8))
 * 
 * cdef inline int _xmlNameIsValid(const_xmlChar* c_name) noexcept:             # <<<<<<<<<<<<<<
 *     return tree.xmlValidateNameValue(c_name)
 * 
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":1727
 *     return tree.xmlValidateNameValue(c_name)
 * 
 * cdef int _htmlNameIsValid(const_xmlChar* c_name) noexcept:             # <<<<<<<<<<<<<<
 *     if c_name is NULL or c_name[0] == c'\0':
 *         return 0
*/

static int __pyx_f_4lxml_5etree__htmlNameIsValid(const xmlChar *__pyx_v_c_name) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;

  /* "src/lxml/apihelpers.pxi":1728
 * 
 * cdef int _htmlNameIsValid(const_xmlChar* c_name) noexcept:
 *     if c_name is NULL or c_name[0] == c'\0':             # <<<<<<<<<<<<<<
 *         return 0
 *     while c_name[0] != c'\0':
*/
  __pyx_t_2 = (__pyx_v_c_name == NULL);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = ((__pyx_v_c_name[0]) == '\x00');
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":1729
 * cdef int _htmlNameIsValid(const_xmlChar* c_name) noexcept:
 *     if c_name is NULL or c_name[0] == c'\0':
 *         return 0             # <<<<<<<<<<<<<<
 *     while c_name[0] != c'\0':
 *         if c_name[0] in b'&<>/"\'\t\n\x0B\x0C\r ':
*/
    __pyx_r = 0;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":1728
 * 
 * cdef int _htmlNameIsValid(const_xmlChar* c_name) noexcept:
 *     if c_name is NULL or c_name[0] == c'\0':             # <<<<<<<<<<<<<<
 *         return 0
 *     while c_name[0] != c'\0':
*/
  }

  /* "src/lxml/apihelpers.pxi":1730
 *     if c_name is NULL or c_name[0] == c'\0':
 *         return 0
 *     while c_name[0] != c'\0':             # <<<<<<<<<<<<<<
 *         if c_name[0] in b'&<>/"\'\t\n\x0B\x0C\r ':
 *             return 0
*/
  while (1) {
    __pyx_t_1 = ((__pyx_v_c_name[0]) != '\x00');
    if (!__pyx_t_1) break;

    /* "src/lxml/apihelpers.pxi":1731
 *         return 0
 *     while c_name[0] != c'\0':
 *         if c_name[0] in b'&<>/"\'\t\n\x0B\x0C\r ':             # <<<<<<<<<<<<<<
 *             return 0
 *         c_name += 1
*/
    switch ((__pyx_v_c_name[0])) {
      case '\t':
      case '\n':
      case '\x0B':
      case '\x0C':
      case '\r':
      case ' ':
      case '"':
      case '&':
      case '\'':
      case '/':
      case '<':
      case '>':

      /* "src/lxml/apihelpers.pxi":1732
 *     while c_name[0] != c'\0':
 *         if c_name[0] in b'&<>/"\'\t\n\x0B\x0C\r ':
 *             return 0             # <<<<<<<<<<<<<<
 *         c_name += 1
 *     return 1
*/
      __pyx_r = 0;
      goto __pyx_L0;

      /* "src/lxml/apihelpers.pxi":1731
 *         return 0
 *     while c_name[0] != c'\0':
 *         if c_name[0] in b'&<>/"\'\t\n\x0B\x0C\r ':             # <<<<<<<<<<<<<<
 *             return 0
 *         c_name += 1
*/
      break;
      default: break;
    }

    /* "src/lxml/apihelpers.pxi":1733
 *         if c_name[0] in b'&<>/"\'\t\n\x0B\x0C\r ':
 *             return 0
 *         c_name += 1             # <<<<<<<<<<<<<<
 *     return 1
 * 
*/
    __pyx_v_c_name = (__pyx_v_c_name + 1);
  }

  /* "src/lxml/apihelpers.pxi":1734
 *             return 0
 *         c_name += 1
 *     return 1             # <<<<<<<<<<<<<<
 * 
 * cdef bint _characterReferenceIsValid(const_xmlChar* c_name) noexcept:
*/
  __pyx_r = 1;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1727
 *     return tree.xmlValidateNameValue(c_name)
 * 
 * cdef int _htmlNameIsValid(const_xmlChar* c_name) noexcept:             # <<<<<<<<<<<<<<
 *     if c_name is NULL or c_name[0] == c'\0':
 *         return 0
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":1736
 *     return 1
 * 
 * cdef bint _characterReferenceIsValid(const_xmlChar* c_name) noexcept:             # <<<<<<<<<<<<<<
 *     cdef bint is_hex
 *     if c_name[0] == c'x':
*/

static int __pyx_f_4lxml_5etree__characterReferenceIsValid(const xmlChar *__pyx_v_c_name) {
  int __pyx_v_is_hex;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;

  /* "src/lxml/apihelpers.pxi":1738
 * cdef bint _characterReferenceIsValid(const_xmlChar* c_name) noexcept:
 *     cdef bint is_hex
 *     if c_name[0] == c'x':             # <<<<<<<<<<<<<<
 *         c_name += 1
 *         is_hex = 1
*/
  __pyx_t_1 = ((__pyx_v_c_name[0]) == 'x');
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":1739
 *     cdef bint is_hex
 *     if c_name[0] == c'x':
 *         c_name += 1             # <<<<<<<<<<<<<<
 *         is_hex = 1
 *     else:
*/
    __pyx_v_c_name = (__pyx_v_c_name + 1);

    /* "src/lxml/apihelpers.pxi":1740
 *     if c_name[0] == c'x':
 *         c_name += 1
 *         is_hex = 1             # <<<<<<<<<<<<<<
 *     else:
 *         is_hex = 0
*/
    __pyx_v_is_hex = 1;

    /* "src/lxml/apihelpers.pxi":1738
 * cdef bint _characterReferenceIsValid(const_xmlChar* c_name) noexcept:
 *     cdef bint is_hex
 *     if c_name[0] == c'x':             # <<<<<<<<<<<<<<
 *         c_name += 1
 *         is_hex = 1
*/
    goto __pyx_L3;
  }

  /* "src/lxml/apihelpers.pxi":1742
 *         is_hex = 1
 *     else:
 *         is_hex = 0             # <<<<<<<<<<<<<<
 *     if c_name[0] == c'\0':
 *         return 0
*/
  /*else*/ {
    __pyx_v_is_hex = 0;
  }
  __pyx_L3:;

  /* "src/lxml/apihelpers.pxi":1743
 *     else:
 *         is_hex = 0
 *     if c_name[0] == c'\0':             # <<<<<<<<<<<<<<
 *         return 0
 *     while c_name[0] != c'\0':
*/
  __pyx_t_1 = ((__pyx_v_c_name[0]) == '\x00');
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":1744
 *         is_hex = 0
 *     if c_name[0] == c'\0':
 *         return 0             # <<<<<<<<<<<<<<
 *     while c_name[0] != c'\0':
 *         if c_name[0] < c'0' or c_name[0] > c'9':
*/
    __pyx_r = 0;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":1743
 *     else:
 *         is_hex = 0
 *     if c_name[0] == c'\0':             # <<<<<<<<<<<<<<
 *         return 0
 *     while c_name[0] != c'\0':
*/
  }

  /* "src/lxml/apihelpers.pxi":1745
 *     if c_name[0] == c'\0':
 *         return 0
 *     while c_name[0] != c'\0':             # <<<<<<<<<<<<<<
 *         if c_name[0] < c'0' or c_name[0] > c'9':
 *             if not is_hex:
*/
  while (1) {
    __pyx_t_1 = ((__pyx_v_c_name[0]) != '\x00');
    if (!__pyx_t_1) break;

    /* "src/lxml/apihelpers.pxi":1746
 *         return 0
 *     while c_name[0] != c'\0':
 *         if c_name[0] < c'0' or c_name[0] > c'9':             # <<<<<<<<<<<<<<
 *             if not is_hex:
 *                 return 0
*/
    __pyx_t_2 = ((__pyx_v_c_name[0]) < '0');
    if (!__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L8_bool_binop_done;
    }
    __pyx_t_2 = ((__pyx_v_c_name[0]) > '9');
    __pyx_t_1 = __pyx_t_2;
    __pyx_L8_bool_binop_done:;
    if (__pyx_t_1) {

      /* "src/lxml/apihelpers.pxi":1747
 *     while c_name[0] != c'\0':
 *         if c_name[0] < c'0' or c_name[0] > c'9':
 *             if not is_hex:             # <<<<<<<<<<<<<<
 *                 return 0
 *             if not (c'a' <= c_name[0] <= c'f'):
*/
      __pyx_t_1 = (!__pyx_v_is_hex);
      if (__pyx_t_1) {

        /* "src/lxml/apihelpers.pxi":1748
 *         if c_name[0] < c'0' or c_name[0] > c'9':
 *             if not is_hex:
 *                 return 0             # <<<<<<<<<<<<<<
 *             if not (c'a' <= c_name[0] <= c'f'):
 *                 if not (c'A' <= c_name[0] <= c'F'):
*/
        __pyx_r = 0;
        goto __pyx_L0;

        /* "src/lxml/apihelpers.pxi":1747
 *     while c_name[0] != c'\0':
 *         if c_name[0] < c'0' or c_name[0] > c'9':
 *             if not is_hex:             # <<<<<<<<<<<<<<
 *                 return 0
 *             if not (c'a' <= c_name[0] <= c'f'):
*/
      }

      /* "src/lxml/apihelpers.pxi":1749
 *             if not is_hex:
 *                 return 0
 *             if not (c'a' <= c_name[0] <= c'f'):             # <<<<<<<<<<<<<<
 *                 if not (c'A' <= c_name[0] <= c'F'):
 *                     return 0
*/
      __pyx_t_1 = ('a' <= (__pyx_v_c_name[0]));
      if (__pyx_t_1) {
        __pyx_t_1 = ((__pyx_v_c_name[0]) <= 'f');
      }
      __pyx_t_2 = (!__pyx_t_1);
      if (__pyx_t_2) {

        /* "src/lxml/apihelpers.pxi":1750
 *                 return 0
 *             if not (c'a' <= c_name[0] <= c'f'):
 *                 if not (c'A' <= c_name[0] <= c'F'):             # <<<<<<<<<<<<<<
 *                     return 0
 *         c_name += 1
*/
        __pyx_t_2 = ('A' <= (__pyx_v_c_name[0]));
        if (__pyx_t_2) {
          __pyx_t_2 = ((__pyx_v_c_name[0]) <= 'F');
        }
        __pyx_t_1 = (!__pyx_t_2);
        if (__pyx_t_1) {

          /* "src/lxml/apihelpers.pxi":1751
 *             if not (c'a' <= c_name[0] <= c'f'):
 *                 if not (c'A' <= c_name[0] <= c'F'):
 *                     return 0             # <<<<<<<<<<<<<<
 *         c_name += 1
 *     return 1
*/
          __pyx_r = 0;
          goto __pyx_L0;

          /* "src/lxml/apihelpers.pxi":1750
 *                 return 0
 *             if not (c'a' <= c_name[0] <= c'f'):
 *                 if not (c'A' <= c_name[0] <= c'F'):             # <<<<<<<<<<<<<<
 *                     return 0
 *         c_name += 1
*/
        }

        /* "src/lxml/apihelpers.pxi":1749
 *             if not is_hex:
 *                 return 0
 *             if not (c'a' <= c_name[0] <= c'f'):             # <<<<<<<<<<<<<<
 *                 if not (c'A' <= c_name[0] <= c'F'):
 *                     return 0
*/
      }

      /* "src/lxml/apihelpers.pxi":1746
 *         return 0
 *     while c_name[0] != c'\0':
 *         if c_name[0] < c'0' or c_name[0] > c'9':             # <<<<<<<<<<<<<<
 *             if not is_hex:
 *                 return 0
*/
    }

    /* "src/lxml/apihelpers.pxi":1752
 *                 if not (c'A' <= c_name[0] <= c'F'):
 *                     return 0
 *         c_name += 1             # <<<<<<<<<<<<<<
 *     return 1
 * 
*/
    __pyx_v_c_name = (__pyx_v_c_name + 1);
  }

  /* "src/lxml/apihelpers.pxi":1753
 *                     return 0
 *         c_name += 1
 *     return 1             # <<<<<<<<<<<<<<
 * 
 * cdef int _tagValidOrRaise(tag_utf) except -1:
*/
  __pyx_r = 1;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1736
 *     return 1
 * 
 * cdef bint _characterReferenceIsValid(const_xmlChar* c_name) noexcept:             # <<<<<<<<<<<<<<
 *     cdef bint is_hex
 *     if c_name[0] == c'x':
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":1755
 *     return 1
 * 
 * cdef int _tagValidOrRaise(tag_utf) except -1:             # <<<<<<<<<<<<<<
 *     if not _pyXmlNameIsValid(tag_utf):
 *         raise ValueError(f"Invalid tag name {(<bytes>tag_utf).decode('utf8')!r}")
*/

static int __pyx_f_4lxml_5etree__tagValidOrRaise(PyObject *__pyx_v_tag_utf) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  size_t __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_tagValidOrRaise", 0);

  /* "src/lxml/apihelpers.pxi":1756
 * 
 * cdef int _tagValidOrRaise(tag_utf) except -1:
 *     if not _pyXmlNameIsValid(tag_utf):             # <<<<<<<<<<<<<<
 *         raise ValueError(f"Invalid tag name {(<bytes>tag_utf).decode('utf8')!r}")
 *     return 0
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__pyXmlNameIsValid(__pyx_v_tag_utf); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(4, 1756, __pyx_L1_error)
  __pyx_t_2 = (!(__pyx_t_1 != 0));
  if (unlikely(__pyx_t_2)) {

    /* "src/lxml/apihelpers.pxi":1757
 * cdef int _tagValidOrRaise(tag_utf) except -1:
 *     if not _pyXmlNameIsValid(tag_utf):
 *         raise ValueError(f"Invalid tag name {(<bytes>tag_utf).decode('utf8')!r}")             # <<<<<<<<<<<<<<
 *     return 0
 * 
*/
    __pyx_t_4 = NULL;
    if (unlikely(__pyx_v_tag_utf == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "decode");
      __PYX_ERR(4, 1757, __pyx_L1_error)
    }
    __pyx_t_5 = __Pyx_decode_bytes(((PyObject*)__pyx_v_tag_utf), 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 1757, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_5), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 1757, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_Invalid_tag_name_2, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 1757, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_7 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_5};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 1757, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(4, 1757, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":1756
 * 
 * cdef int _tagValidOrRaise(tag_utf) except -1:
 *     if not _pyXmlNameIsValid(tag_utf):             # <<<<<<<<<<<<<<
 *         raise ValueError(f"Invalid tag name {(<bytes>tag_utf).decode('utf8')!r}")
 *     return 0
*/
  }

  /* "src/lxml/apihelpers.pxi":1758
 *     if not _pyXmlNameIsValid(tag_utf):
 *         raise ValueError(f"Invalid tag name {(<bytes>tag_utf).decode('utf8')!r}")
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int _htmlTagValidOrRaise(tag_utf) except -1:
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1755
 *     return 1
 * 
 * cdef int _tagValidOrRaise(tag_utf) except -1:             # <<<<<<<<<<<<<<
 *     if not _pyXmlNameIsValid(tag_utf):
 *         raise ValueError(f"Invalid tag name {(<bytes>tag_utf).decode('utf8')!r}")
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._tagValidOrRaise", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":1760
 *     return 0
 * 
 * cdef int _htmlTagValidOrRaise(tag_utf) except -1:             # <<<<<<<<<<<<<<
 *     if not _pyHtmlNameIsValid(tag_utf):
 *         raise ValueError(f"Invalid HTML tag name {(<bytes>tag_utf).decode('utf8')!r}")
*/

static int __pyx_f_4lxml_5etree__htmlTagValidOrRaise(PyObject *__pyx_v_tag_utf) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  size_t __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_htmlTagValidOrRaise", 0);

  /* "src/lxml/apihelpers.pxi":1761
 * 
 * cdef int _htmlTagValidOrRaise(tag_utf) except -1:
 *     if not _pyHtmlNameIsValid(tag_utf):             # <<<<<<<<<<<<<<
 *         raise ValueError(f"Invalid HTML tag name {(<bytes>tag_utf).decode('utf8')!r}")
 *     return 0
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__pyHtmlNameIsValid(__pyx_v_tag_utf); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(4, 1761, __pyx_L1_error)
  __pyx_t_2 = (!(__pyx_t_1 != 0));
  if (unlikely(__pyx_t_2)) {

    /* "src/lxml/apihelpers.pxi":1762
 * cdef int _htmlTagValidOrRaise(tag_utf) except -1:
 *     if not _pyHtmlNameIsValid(tag_utf):
 *         raise ValueError(f"Invalid HTML tag name {(<bytes>tag_utf).decode('utf8')!r}")             # <<<<<<<<<<<<<<
 *     return 0
 * 
*/
    __pyx_t_4 = NULL;
    if (unlikely(__pyx_v_tag_utf == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "decode");
      __PYX_ERR(4, 1762, __pyx_L1_error)
    }
    __pyx_t_5 = __Pyx_decode_bytes(((PyObject*)__pyx_v_tag_utf), 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 1762, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_5), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 1762, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_Invalid_HTML_tag_name, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 1762, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_7 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_5};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 1762, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(4, 1762, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":1761
 * 
 * cdef int _htmlTagValidOrRaise(tag_utf) except -1:
 *     if not _pyHtmlNameIsValid(tag_utf):             # <<<<<<<<<<<<<<
 *         raise ValueError(f"Invalid HTML tag name {(<bytes>tag_utf).decode('utf8')!r}")
 *     return 0
*/
  }

  /* "src/lxml/apihelpers.pxi":1763
 *     if not _pyHtmlNameIsValid(tag_utf):
 *         raise ValueError(f"Invalid HTML tag name {(<bytes>tag_utf).decode('utf8')!r}")
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int _attributeValidOrRaise(name_utf) except -1:
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1760
 *     return 0
 * 
 * cdef int _htmlTagValidOrRaise(tag_utf) except -1:             # <<<<<<<<<<<<<<
 *     if not _pyHtmlNameIsValid(tag_utf):
 *         raise ValueError(f"Invalid HTML tag name {(<bytes>tag_utf).decode('utf8')!r}")
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._htmlTagValidOrRaise", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":1765
 *     return 0
 * 
 * cdef int _attributeValidOrRaise(name_utf) except -1:             # <<<<<<<<<<<<<<
 *     if not _pyXmlNameIsValid(name_utf):
 *         raise ValueError(f"Invalid attribute name {(<bytes>name_utf).decode('utf8')!r}")
*/

static int __pyx_f_4lxml_5etree__attributeValidOrRaise(PyObject *__pyx_v_name_utf) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  size_t __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_attributeValidOrRaise", 0);

  /* "src/lxml/apihelpers.pxi":1766
 * 
 * cdef int _attributeValidOrRaise(name_utf) except -1:
 *     if not _pyXmlNameIsValid(name_utf):             # <<<<<<<<<<<<<<
 *         raise ValueError(f"Invalid attribute name {(<bytes>name_utf).decode('utf8')!r}")
 *     return 0
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__pyXmlNameIsValid(__pyx_v_name_utf); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(4, 1766, __pyx_L1_error)
  __pyx_t_2 = (!(__pyx_t_1 != 0));
  if (unlikely(__pyx_t_2)) {

    /* "src/lxml/apihelpers.pxi":1767
 * cdef int _attributeValidOrRaise(name_utf) except -1:
 *     if not _pyXmlNameIsValid(name_utf):
 *         raise ValueError(f"Invalid attribute name {(<bytes>name_utf).decode('utf8')!r}")             # <<<<<<<<<<<<<<
 *     return 0
 * 
*/
    __pyx_t_4 = NULL;
    if (unlikely(__pyx_v_name_utf == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "decode");
      __PYX_ERR(4, 1767, __pyx_L1_error)
    }
    __pyx_t_5 = __Pyx_decode_bytes(((PyObject*)__pyx_v_name_utf), 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 1767, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_5), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 1767, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_Invalid_attribute_name, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 1767, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_7 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_5};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 1767, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(4, 1767, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":1766
 * 
 * cdef int _attributeValidOrRaise(name_utf) except -1:
 *     if not _pyXmlNameIsValid(name_utf):             # <<<<<<<<<<<<<<
 *         raise ValueError(f"Invalid attribute name {(<bytes>name_utf).decode('utf8')!r}")
 *     return 0
*/
  }

  /* "src/lxml/apihelpers.pxi":1768
 *     if not _pyXmlNameIsValid(name_utf):
 *         raise ValueError(f"Invalid attribute name {(<bytes>name_utf).decode('utf8')!r}")
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int _prefixValidOrRaise(tag_utf) except -1:
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1765
 *     return 0
 * 
 * cdef int _attributeValidOrRaise(name_utf) except -1:             # <<<<<<<<<<<<<<
 *     if not _pyXmlNameIsValid(name_utf):
 *         raise ValueError(f"Invalid attribute name {(<bytes>name_utf).decode('utf8')!r}")
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._attributeValidOrRaise", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":1770
 *     return 0
 * 
 * cdef int _prefixValidOrRaise(tag_utf) except -1:             # <<<<<<<<<<<<<<
 *     if not _pyXmlNameIsValid(tag_utf):
 *         raise ValueError(f"Invalid namespace prefix {(<bytes>tag_utf).decode('utf8')!r}")
*/

static int __pyx_f_4lxml_5etree__prefixValidOrRaise(PyObject *__pyx_v_tag_utf) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  size_t __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_prefixValidOrRaise", 0);

  /* "src/lxml/apihelpers.pxi":1771
 * 
 * cdef int _prefixValidOrRaise(tag_utf) except -1:
 *     if not _pyXmlNameIsValid(tag_utf):             # <<<<<<<<<<<<<<
 *         raise ValueError(f"Invalid namespace prefix {(<bytes>tag_utf).decode('utf8')!r}")
 *     return 0
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__pyXmlNameIsValid(__pyx_v_tag_utf); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(4, 1771, __pyx_L1_error)
  __pyx_t_2 = (!(__pyx_t_1 != 0));
  if (unlikely(__pyx_t_2)) {

    /* "src/lxml/apihelpers.pxi":1772
 * cdef int _prefixValidOrRaise(tag_utf) except -1:
 *     if not _pyXmlNameIsValid(tag_utf):
 *         raise ValueError(f"Invalid namespace prefix {(<bytes>tag_utf).decode('utf8')!r}")             # <<<<<<<<<<<<<<
 *     return 0
 * 
*/
    __pyx_t_4 = NULL;
    if (unlikely(__pyx_v_tag_utf == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "decode");
      __PYX_ERR(4, 1772, __pyx_L1_error)
    }
    __pyx_t_5 = __Pyx_decode_bytes(((PyObject*)__pyx_v_tag_utf), 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 1772, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_5), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 1772, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_Invalid_namespace_prefix, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 1772, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_7 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_5};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 1772, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(4, 1772, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":1771
 * 
 * cdef int _prefixValidOrRaise(tag_utf) except -1:
 *     if not _pyXmlNameIsValid(tag_utf):             # <<<<<<<<<<<<<<
 *         raise ValueError(f"Invalid namespace prefix {(<bytes>tag_utf).decode('utf8')!r}")
 *     return 0
*/
  }

  /* "src/lxml/apihelpers.pxi":1773
 *     if not _pyXmlNameIsValid(tag_utf):
 *         raise ValueError(f"Invalid namespace prefix {(<bytes>tag_utf).decode('utf8')!r}")
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int _uriValidOrRaise(uri_utf) except -1:
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1770
 *     return 0
 * 
 * cdef int _prefixValidOrRaise(tag_utf) except -1:             # <<<<<<<<<<<<<<
 *     if not _pyXmlNameIsValid(tag_utf):
 *         raise ValueError(f"Invalid namespace prefix {(<bytes>tag_utf).decode('utf8')!r}")
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._prefixValidOrRaise", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":1775
 *     return 0
 * 
 * cdef int _uriValidOrRaise(uri_utf) except -1:             # <<<<<<<<<<<<<<
 *     cdef uri.xmlURI* c_uri = uri.xmlParseURI(_cstr(uri_utf))
 *     if c_uri is NULL:
*/

static int __pyx_f_4lxml_5etree__uriValidOrRaise(PyObject *__pyx_v_uri_utf) {
  xmlURI *__pyx_v_c_uri;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_uriValidOrRaise", 0);

  /* "src/lxml/apihelpers.pxi":1776
 * 
 * cdef int _uriValidOrRaise(uri_utf) except -1:
 *     cdef uri.xmlURI* c_uri = uri.xmlParseURI(_cstr(uri_utf))             # <<<<<<<<<<<<<<
 *     if c_uri is NULL:
 *         raise ValueError(f"Invalid namespace URI {(<bytes>uri_utf).decode('utf8')!r}")
*/
  __pyx_v_c_uri = xmlParseURI(PyBytes_AS_STRING(__pyx_v_uri_utf));

  /* "src/lxml/apihelpers.pxi":1777
 * cdef int _uriValidOrRaise(uri_utf) except -1:
 *     cdef uri.xmlURI* c_uri = uri.xmlParseURI(_cstr(uri_utf))
 *     if c_uri is NULL:             # <<<<<<<<<<<<<<
 *         raise ValueError(f"Invalid namespace URI {(<bytes>uri_utf).decode('utf8')!r}")
 *     uri.xmlFreeURI(c_uri)
*/
  __pyx_t_1 = (__pyx_v_c_uri == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/apihelpers.pxi":1778
 *     cdef uri.xmlURI* c_uri = uri.xmlParseURI(_cstr(uri_utf))
 *     if c_uri is NULL:
 *         raise ValueError(f"Invalid namespace URI {(<bytes>uri_utf).decode('utf8')!r}")             # <<<<<<<<<<<<<<
 *     uri.xmlFreeURI(c_uri)
 *     return 0
*/
    __pyx_t_3 = NULL;
    if (unlikely(__pyx_v_uri_utf == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "decode");
      __PYX_ERR(4, 1778, __pyx_L1_error)
    }
    __pyx_t_4 = __Pyx_decode_bytes(((PyObject*)__pyx_v_uri_utf), 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 1778, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_4), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 1778, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_Invalid_namespace_URI, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 1778, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_4};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 1778, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(4, 1778, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":1777
 * cdef int _uriValidOrRaise(uri_utf) except -1:
 *     cdef uri.xmlURI* c_uri = uri.xmlParseURI(_cstr(uri_utf))
 *     if c_uri is NULL:             # <<<<<<<<<<<<<<
 *         raise ValueError(f"Invalid namespace URI {(<bytes>uri_utf).decode('utf8')!r}")
 *     uri.xmlFreeURI(c_uri)
*/
  }

  /* "src/lxml/apihelpers.pxi":1779
 *     if c_uri is NULL:
 *         raise ValueError(f"Invalid namespace URI {(<bytes>uri_utf).decode('utf8')!r}")
 *     uri.xmlFreeURI(c_uri)             # <<<<<<<<<<<<<<
 *     return 0
 * 
*/
  xmlFreeURI(__pyx_v_c_uri);

  /* "src/lxml/apihelpers.pxi":1780
 *         raise ValueError(f"Invalid namespace URI {(<bytes>uri_utf).decode('utf8')!r}")
 *     uri.xmlFreeURI(c_uri)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef inline unicode _namespacedName(xmlNode* c_node):
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1775
 *     return 0
 * 
 * cdef int _uriValidOrRaise(uri_utf) except -1:             # <<<<<<<<<<<<<<
 *     cdef uri.xmlURI* c_uri = uri.xmlParseURI(_cstr(uri_utf))
 *     if c_uri is NULL:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._uriValidOrRaise", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":1782
 *     return 0
 * 
 * cdef inline unicode _namespacedName(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     return _namespacedNameFromNsName(_getNs(c_node), c_node.name)
 * 
*/

static CYTHON_INLINE PyObject *__pyx_f_4lxml_5etree__namespacedName(xmlNode *__pyx_v_c_node) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_namespacedName", 0);

  /* "src/lxml/apihelpers.pxi":1783
 * 
 * cdef inline unicode _namespacedName(xmlNode* c_node):
 *     return _namespacedNameFromNsName(_getNs(c_node), c_node.name)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree__namespacedNameFromNsName(_getNs(__pyx_v_c_node), __pyx_v_c_node->name); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1783, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1782
 *     return 0
 * 
 * cdef inline unicode _namespacedName(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     return _namespacedNameFromNsName(_getNs(c_node), c_node.name)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._namespacedName", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":1786
 * 
 * 
 * cdef unicode _namespacedNameFromNsName(const_xmlChar* c_href, const_xmlChar* c_name):             # <<<<<<<<<<<<<<
 *     name = funicode(c_name)
 *     if c_href is NULL:
*/

static PyObject *__pyx_f_4lxml_5etree__namespacedNameFromNsName(const xmlChar *__pyx_v_c_href, const xmlChar *__pyx_v_c_name) {
  PyObject *__pyx_v_name = NULL;
  PyObject *__pyx_v_href = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4[4];
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_namespacedNameFromNsName", 0);

  /* "src/lxml/apihelpers.pxi":1787
 * 
 * cdef unicode _namespacedNameFromNsName(const_xmlChar* c_href, const_xmlChar* c_name):
 *     name = funicode(c_name)             # <<<<<<<<<<<<<<
 *     if c_href is NULL:
 *         return name
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1787, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_name = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/apihelpers.pxi":1788
 * cdef unicode _namespacedNameFromNsName(const_xmlChar* c_href, const_xmlChar* c_name):
 *     name = funicode(c_name)
 *     if c_href is NULL:             # <<<<<<<<<<<<<<
 *         return name
 *     href = funicode(c_href)
*/
  __pyx_t_2 = (__pyx_v_c_href == NULL);
  if (__pyx_t_2) {

    /* "src/lxml/apihelpers.pxi":1789
 *     name = funicode(c_name)
 *     if c_href is NULL:
 *         return name             # <<<<<<<<<<<<<<
 *     href = funicode(c_href)
 *     return f"{{{href}}}{name}"
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_name);
    __pyx_r = __pyx_v_name;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":1788
 * cdef unicode _namespacedNameFromNsName(const_xmlChar* c_href, const_xmlChar* c_name):
 *     name = funicode(c_name)
 *     if c_href is NULL:             # <<<<<<<<<<<<<<
 *         return name
 *     href = funicode(c_href)
*/
  }

  /* "src/lxml/apihelpers.pxi":1790
 *     if c_href is NULL:
 *         return name
 *     href = funicode(c_href)             # <<<<<<<<<<<<<<
 *     return f"{{{href}}}{name}"
 * 
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_href); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1790, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_href = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/apihelpers.pxi":1791
 *         return name
 *     href = funicode(c_href)
 *     return f"{{{href}}}{name}"             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyUnicode_Unicode(__pyx_v_href); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1791, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyUnicode_Unicode(__pyx_v_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 1791, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u__10;
  __pyx_t_4[1] = __pyx_t_1;
  __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u__11;
  __pyx_t_4[3] = __pyx_t_3;
  __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_4, 4, 1 * 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3));
  if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 1791, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1786
 * 
 * 
 * cdef unicode _namespacedNameFromNsName(const_xmlChar* c_href, const_xmlChar* c_name):             # <<<<<<<<<<<<<<
 *     name = funicode(c_name)
 *     if c_href is NULL:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._namespacedNameFromNsName", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_href);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":1794
 * 
 * 
 * cdef _getFilenameForFile(source):             # <<<<<<<<<<<<<<
 *     """Given a Python File or Gzip object, give filename back.
 * 
*/

static PyObject *__pyx_f_4lxml_5etree__getFilenameForFile(PyObject *__pyx_v_source) {
  PyObject *__pyx_v_filename = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_getFilenameForFile", 0);

  /* "src/lxml/apihelpers.pxi":1800
 *     """
 *     # urllib2 provides a geturl() method
 *     try:             # <<<<<<<<<<<<<<
 *         return source.geturl()
 *     except:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "src/lxml/apihelpers.pxi":1801
 *     # urllib2 provides a geturl() method
 *     try:
 *         return source.geturl()             # <<<<<<<<<<<<<<
 *     except:
 *         pass
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_5 = __pyx_v_source;
      __Pyx_INCREF(__pyx_t_5);
      __pyx_t_6 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};
        __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_geturl, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 1801, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_4);
      }
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L7_try_return;

      /* "src/lxml/apihelpers.pxi":1800
 *     """
 *     # urllib2 provides a geturl() method
 *     try:             # <<<<<<<<<<<<<<
 *         return source.geturl()
 *     except:
*/
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "src/lxml/apihelpers.pxi":1802
 *     try:
 *         return source.geturl()
 *     except:             # <<<<<<<<<<<<<<
 *         pass
 *     # file instances have a name attribute
*/
    /*except:*/ {
      __Pyx_ErrRestore(0,0,0);
      goto __pyx_L4_exception_handled;
    }

    /* "src/lxml/apihelpers.pxi":1800
 *     """
 *     # urllib2 provides a geturl() method
 *     try:             # <<<<<<<<<<<<<<
 *         return source.geturl()
 *     except:
*/
    __pyx_L7_try_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  }

  /* "src/lxml/apihelpers.pxi":1805
 *         pass
 *     # file instances have a name attribute
 *     try:             # <<<<<<<<<<<<<<
 *         filename = source.name
 *         if _isString(filename):
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_1);
    /*try:*/ {

      /* "src/lxml/apihelpers.pxi":1806
 *     # file instances have a name attribute
 *     try:
 *         filename = source.name             # <<<<<<<<<<<<<<
 *         if _isString(filename):
 *             return os_path_abspath(filename)
*/
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_source, __pyx_mstate_global->__pyx_n_u_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 1806, __pyx_L11_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_v_filename = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "src/lxml/apihelpers.pxi":1807
 *     try:
 *         filename = source.name
 *         if _isString(filename):             # <<<<<<<<<<<<<<
 *             return os_path_abspath(filename)
 *     except:
*/
      __pyx_t_7 = _isString(__pyx_v_filename);
      if (__pyx_t_7) {

        /* "src/lxml/apihelpers.pxi":1808
 *         filename = source.name
 *         if _isString(filename):
 *             return os_path_abspath(filename)             # <<<<<<<<<<<<<<
 *     except:
 *         pass
*/
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_5 = NULL;
        __Pyx_INCREF(__pyx_v_4lxml_5etree_os_path_abspath);
        __pyx_t_8 = __pyx_v_4lxml_5etree_os_path_abspath; 
        __pyx_t_6 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_8))) {
          __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_8);
          assert(__pyx_t_5);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_8);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_8, __pyx__function);
          __pyx_t_6 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_filename};
          __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_8, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 1808, __pyx_L11_error)
          __Pyx_GOTREF(__pyx_t_4);
        }
        __pyx_r = __pyx_t_4;
        __pyx_t_4 = 0;
        goto __pyx_L15_try_return;

        /* "src/lxml/apihelpers.pxi":1807
 *     try:
 *         filename = source.name
 *         if _isString(filename):             # <<<<<<<<<<<<<<
 *             return os_path_abspath(filename)
 *     except:
*/
      }

      /* "src/lxml/apihelpers.pxi":1805
 *         pass
 *     # file instances have a name attribute
 *     try:             # <<<<<<<<<<<<<<
 *         filename = source.name
 *         if _isString(filename):
*/
    }
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L16_try_end;
    __pyx_L11_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "src/lxml/apihelpers.pxi":1809
 *         if _isString(filename):
 *             return os_path_abspath(filename)
 *     except:             # <<<<<<<<<<<<<<
 *         pass
 *     # gzip file instances have a filename attribute (before Py3k)
*/
    /*except:*/ {
      __Pyx_ErrRestore(0,0,0);
      goto __pyx_L12_exception_handled;
    }

    /* "src/lxml/apihelpers.pxi":1805
 *         pass
 *     # file instances have a name attribute
 *     try:             # <<<<<<<<<<<<<<
 *         filename = source.name
 *         if _isString(filename):
*/
    __pyx_L15_try_return:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1);
    goto __pyx_L0;
    __pyx_L12_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1);
    __pyx_L16_try_end:;
  }

  /* "src/lxml/apihelpers.pxi":1812
 *         pass
 *     # gzip file instances have a filename attribute (before Py3k)
 *     try:             # <<<<<<<<<<<<<<
 *         filename = source.filename
 *         if _isString(filename):
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "src/lxml/apihelpers.pxi":1813
 *     # gzip file instances have a filename attribute (before Py3k)
 *     try:
 *         filename = source.filename             # <<<<<<<<<<<<<<
 *         if _isString(filename):
 *             return os_path_abspath(filename)
*/
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_source, __pyx_mstate_global->__pyx_n_u_filename); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 1813, __pyx_L20_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_XDECREF_SET(__pyx_v_filename, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "src/lxml/apihelpers.pxi":1814
 *     try:
 *         filename = source.filename
 *         if _isString(filename):             # <<<<<<<<<<<<<<
 *             return os_path_abspath(filename)
 *     except:
*/
      __pyx_t_7 = _isString(__pyx_v_filename);
      if (__pyx_t_7) {

        /* "src/lxml/apihelpers.pxi":1815
 *         filename = source.filename
 *         if _isString(filename):
 *             return os_path_abspath(filename)             # <<<<<<<<<<<<<<
 *     except:
 *         pass
*/
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_8 = NULL;
        __Pyx_INCREF(__pyx_v_4lxml_5etree_os_path_abspath);
        __pyx_t_5 = __pyx_v_4lxml_5etree_os_path_abspath; 
        __pyx_t_6 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
          assert(__pyx_t_8);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_8);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
          __pyx_t_6 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_v_filename};
          __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 1815, __pyx_L20_error)
          __Pyx_GOTREF(__pyx_t_4);
        }
        __pyx_r = __pyx_t_4;
        __pyx_t_4 = 0;
        goto __pyx_L24_try_return;

        /* "src/lxml/apihelpers.pxi":1814
 *     try:
 *         filename = source.filename
 *         if _isString(filename):             # <<<<<<<<<<<<<<
 *             return os_path_abspath(filename)
 *     except:
*/
      }

      /* "src/lxml/apihelpers.pxi":1812
 *         pass
 *     # gzip file instances have a filename attribute (before Py3k)
 *     try:             # <<<<<<<<<<<<<<
 *         filename = source.filename
 *         if _isString(filename):
*/
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L25_try_end;
    __pyx_L20_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "src/lxml/apihelpers.pxi":1816
 *         if _isString(filename):
 *             return os_path_abspath(filename)
 *     except:             # <<<<<<<<<<<<<<
 *         pass
 *     # can't determine filename
*/
    /*except:*/ {
      __Pyx_ErrRestore(0,0,0);
      goto __pyx_L21_exception_handled;
    }

    /* "src/lxml/apihelpers.pxi":1812
 *         pass
 *     # gzip file instances have a filename attribute (before Py3k)
 *     try:             # <<<<<<<<<<<<<<
 *         filename = source.filename
 *         if _isString(filename):
*/
    __pyx_L24_try_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L21_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    __pyx_L25_try_end:;
  }

  /* "src/lxml/apihelpers.pxi":1819
 *         pass
 *     # can't determine filename
 *     return None             # <<<<<<<<<<<<<<
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1794
 * 
 * 
 * cdef _getFilenameForFile(source):             # <<<<<<<<<<<<<<
 *     """Given a Python File or Gzip object, give filename back.
 * 
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_filename);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":11
 * # module level API functions
 * 
 * def clear_error_log():             # <<<<<<<<<<<<<<
 *     """clear_error_log()
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_3clear_error_log(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_2clear_error_log, "clear_error_log()\n\n    Clear the global error log.  Note that this log is already bound to a\n    fixed size.\n\n    Note: since lxml 2.2, the global error log is local to a thread\n    and this function will only clear the global error log of the\n    current thread.\n    ");
static PyMethodDef __pyx_mdef_4lxml_5etree_3clear_error_log = {"clear_error_log", (PyCFunction)__pyx_pw_4lxml_5etree_3clear_error_log, METH_NOARGS, __pyx_doc_4lxml_5etree_2clear_error_log};
static PyObject *__pyx_pw_4lxml_5etree_3clear_error_log(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clear_error_log (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_2clear_error_log(__pyx_self);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_2clear_error_log(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("clear_error_log", 0);

  /* "src/lxml/xmlerror.pxi":21
 *     current thread.
 *     """
 *     _getThreadErrorLog(GLOBAL_ERROR_LOG).clear()             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__getThreadErrorLog(__pyx_mstate_global->__pyx_n_u_GlobalErrorLog)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 21, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __pyx_t_3;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_clear, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 21, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xmlerror.pxi":11
 * # module level API functions
 * 
 * def clear_error_log():             # <<<<<<<<<<<<<<
 *     """clear_error_log()
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.clear_error_log", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":26
 * # setup for global log:
 * 
 * cdef void _initThreadLogging() noexcept:             # <<<<<<<<<<<<<<
 *     # Disable generic error lines from libxml2.
 *     _connectGenericErrorLog(None)
*/

static void __pyx_f_4lxml_5etree__initThreadLogging(void) {

  /* "src/lxml/xmlerror.pxi":28
 * cdef void _initThreadLogging() noexcept:
 *     # Disable generic error lines from libxml2.
 *     _connectGenericErrorLog(None)             # <<<<<<<<<<<<<<
 * 
 *     # Divert XSLT error messages to the global XSLT error log instead of stderr.
*/
  __pyx_f_4lxml_5etree__connectGenericErrorLog(Py_None, NULL);

  /* "src/lxml/xmlerror.pxi":31
 * 
 *     # Divert XSLT error messages to the global XSLT error log instead of stderr.
 *     xslt.xsltSetGenericErrorFunc(NULL, <xmlerror.xmlGenericErrorFunc>_receiveXSLTError)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  xsltSetGenericErrorFunc(NULL, ((xmlGenericErrorFunc)__pyx_f_4lxml_5etree__receiveXSLTError));

  /* "src/lxml/xmlerror.pxi":26
 * # setup for global log:
 * 
 * cdef void _initThreadLogging() noexcept:             # <<<<<<<<<<<<<<
 *     # Disable generic error lines from libxml2.
 *     _connectGenericErrorLog(None)
*/

  /* function exit code */
}

/* "src/lxml/xmlerror.pxi":63
 *     cdef xmlChar* _c_path
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         tree.xmlFree(self._c_message)
 *         tree.xmlFree(self._c_filename)
*/

/* Python wrapper */
static void __pyx_pw_4lxml_5etree_9_LogEntry_1__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_4lxml_5etree_9_LogEntry_1__dealloc__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_pf_4lxml_5etree_9_LogEntry___dealloc__(((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_4lxml_5etree_9_LogEntry___dealloc__(struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_self) {

  /* "src/lxml/xmlerror.pxi":64
 * 
 *     def __dealloc__(self):
 *         tree.xmlFree(self._c_message)             # <<<<<<<<<<<<<<
 *         tree.xmlFree(self._c_filename)
 *         tree.xmlFree(self._c_path)
*/
  xmlFree(__pyx_v_self->_c_message);

  /* "src/lxml/xmlerror.pxi":65
 *     def __dealloc__(self):
 *         tree.xmlFree(self._c_message)
 *         tree.xmlFree(self._c_filename)             # <<<<<<<<<<<<<<
 *         tree.xmlFree(self._c_path)
 * 
*/
  xmlFree(__pyx_v_self->_c_filename);

  /* "src/lxml/xmlerror.pxi":66
 *         tree.xmlFree(self._c_message)
 *         tree.xmlFree(self._c_filename)
 *         tree.xmlFree(self._c_path)             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
*/
  xmlFree(__pyx_v_self->_c_path);

  /* "src/lxml/xmlerror.pxi":63
 *     cdef xmlChar* _c_path
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         tree.xmlFree(self._c_message)
 *         tree.xmlFree(self._c_filename)
*/

  /* function exit code */
}

/* "src/lxml/xmlerror.pxi":68
 *         tree.xmlFree(self._c_path)
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef int _setError(self, const xmlerror.xmlError* error) except -1:
 *         self.domain   = error.domain
*/

static int __pyx_f_4lxml_5etree_9_LogEntry__setError(struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_self, xmlError const *__pyx_v_error) {
  long __pyx_v_c_line;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_setError", 0);

  /* "src/lxml/xmlerror.pxi":70
 *     @cython.final
 *     cdef int _setError(self, const xmlerror.xmlError* error) except -1:
 *         self.domain   = error.domain             # <<<<<<<<<<<<<<
 *         self.type     = error.code
 *         self.level    = <int>error.level
*/
  __pyx_t_1 = __pyx_v_error->domain;
  __pyx_v_self->domain = __pyx_t_1;

  /* "src/lxml/xmlerror.pxi":71
 *     cdef int _setError(self, const xmlerror.xmlError* error) except -1:
 *         self.domain   = error.domain
 *         self.type     = error.code             # <<<<<<<<<<<<<<
 *         self.level    = <int>error.level
 *         self.line     = <long>error.line
*/
  __pyx_t_1 = __pyx_v_error->code;
  __pyx_v_self->type = __pyx_t_1;

  /* "src/lxml/xmlerror.pxi":72
 *         self.domain   = error.domain
 *         self.type     = error.code
 *         self.level    = <int>error.level             # <<<<<<<<<<<<<<
 *         self.line     = <long>error.line
 *         self.column   = error.int2
*/
  __pyx_v_self->level = ((int)__pyx_v_error->level);

  /* "src/lxml/xmlerror.pxi":73
 *         self.type     = error.code
 *         self.level    = <int>error.level
 *         self.line     = <long>error.line             # <<<<<<<<<<<<<<
 *         self.column   = error.int2
 *         self._c_message = NULL
*/
  __pyx_v_self->line = ((long)__pyx_v_error->line);

  /* "src/lxml/xmlerror.pxi":74
 *         self.level    = <int>error.level
 *         self.line     = <long>error.line
 *         self.column   = error.int2             # <<<<<<<<<<<<<<
 *         self._c_message = NULL
 *         self._c_filename = NULL
*/
  __pyx_t_1 = __pyx_v_error->int2;
  __pyx_v_self->column = __pyx_t_1;

  /* "src/lxml/xmlerror.pxi":75
 *         self.line     = <long>error.line
 *         self.column   = error.int2
 *         self._c_message = NULL             # <<<<<<<<<<<<<<
 *         self._c_filename = NULL
 *         self._c_path = NULL
*/
  __pyx_v_self->_c_message = NULL;

  /* "src/lxml/xmlerror.pxi":76
 *         self.column   = error.int2
 *         self._c_message = NULL
 *         self._c_filename = NULL             # <<<<<<<<<<<<<<
 *         self._c_path = NULL
 *         if (error.message is NULL or
*/
  __pyx_v_self->_c_filename = NULL;

  /* "src/lxml/xmlerror.pxi":77
 *         self._c_message = NULL
 *         self._c_filename = NULL
 *         self._c_path = NULL             # <<<<<<<<<<<<<<
 *         if (error.message is NULL or
 *                 error.message[0] == b'\0' or
*/
  __pyx_v_self->_c_path = NULL;

  /* "src/lxml/xmlerror.pxi":78
 *         self._c_filename = NULL
 *         self._c_path = NULL
 *         if (error.message is NULL or             # <<<<<<<<<<<<<<
 *                 error.message[0] == b'\0' or
 *                 error.message[0] == b'\n' and error.message[1] == b'\0'):
*/
  __pyx_t_3 = (__pyx_v_error->message == NULL);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }

  /* "src/lxml/xmlerror.pxi":79
 *         self._c_path = NULL
 *         if (error.message is NULL or
 *                 error.message[0] == b'\0' or             # <<<<<<<<<<<<<<
 *                 error.message[0] == b'\n' and error.message[1] == b'\0'):
 *             self._message = "unknown error"
*/
  __pyx_t_3 = ((__pyx_v_error->message[0]) == '\x00');
  if (!__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }

  /* "src/lxml/xmlerror.pxi":80
 *         if (error.message is NULL or
 *                 error.message[0] == b'\0' or
 *                 error.message[0] == b'\n' and error.message[1] == b'\0'):             # <<<<<<<<<<<<<<
 *             self._message = "unknown error"
 *         else:
*/
  __pyx_t_3 = ((__pyx_v_error->message[0]) == '\n');
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = ((__pyx_v_error->message[1]) == '\x00');
  __pyx_t_2 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;

  /* "src/lxml/xmlerror.pxi":78
 *         self._c_filename = NULL
 *         self._c_path = NULL
 *         if (error.message is NULL or             # <<<<<<<<<<<<<<
 *                 error.message[0] == b'\0' or
 *                 error.message[0] == b'\n' and error.message[1] == b'\0'):
*/
  if (__pyx_t_2) {

    /* "src/lxml/xmlerror.pxi":81
 *                 error.message[0] == b'\0' or
 *                 error.message[0] == b'\n' and error.message[1] == b'\0'):
 *             self._message = "unknown error"             # <<<<<<<<<<<<<<
 *         else:
 *             self._message = None
*/
    __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_unknown_error);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_kp_u_unknown_error);
    __Pyx_GOTREF(__pyx_v_self->_message);
    __Pyx_DECREF(__pyx_v_self->_message);
    __pyx_v_self->_message = __pyx_mstate_global->__pyx_kp_u_unknown_error;

    /* "src/lxml/xmlerror.pxi":78
 *         self._c_filename = NULL
 *         self._c_path = NULL
 *         if (error.message is NULL or             # <<<<<<<<<<<<<<
 *                 error.message[0] == b'\0' or
 *                 error.message[0] == b'\n' and error.message[1] == b'\0'):
*/
    goto __pyx_L3;
  }

  /* "src/lxml/xmlerror.pxi":83
 *             self._message = "unknown error"
 *         else:
 *             self._message = None             # <<<<<<<<<<<<<<
 *             self._c_message = <char*> tree.xmlStrdup(
 *                 <const_xmlChar*> error.message)
*/
  /*else*/ {
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_self->_message);
    __Pyx_DECREF(__pyx_v_self->_message);
    __pyx_v_self->_message = ((PyObject*)Py_None);

    /* "src/lxml/xmlerror.pxi":84
 *         else:
 *             self._message = None
 *             self._c_message = <char*> tree.xmlStrdup(             # <<<<<<<<<<<<<<
 *                 <const_xmlChar*> error.message)
 *             if not self._c_message:
*/
    __pyx_v_self->_c_message = ((char *)xmlStrdup(((const xmlChar *)__pyx_v_error->message)));

    /* "src/lxml/xmlerror.pxi":86
 *             self._c_message = <char*> tree.xmlStrdup(
 *                 <const_xmlChar*> error.message)
 *             if not self._c_message:             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 *         if error.file is NULL:
*/
    __pyx_t_2 = (!(__pyx_v_self->_c_message != 0));
    if (unlikely(__pyx_t_2)) {

      /* "src/lxml/xmlerror.pxi":87
 *                 <const_xmlChar*> error.message)
 *             if not self._c_message:
 *                 raise MemoryError()             # <<<<<<<<<<<<<<
 *         if error.file is NULL:
 *             self._filename = '<string>'
*/
      PyErr_NoMemory(); __PYX_ERR(1, 87, __pyx_L1_error)

      /* "src/lxml/xmlerror.pxi":86
 *             self._c_message = <char*> tree.xmlStrdup(
 *                 <const_xmlChar*> error.message)
 *             if not self._c_message:             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 *         if error.file is NULL:
*/
    }
  }
  __pyx_L3:;

  /* "src/lxml/xmlerror.pxi":88
 *             if not self._c_message:
 *                 raise MemoryError()
 *         if error.file is NULL:             # <<<<<<<<<<<<<<
 *             self._filename = '<string>'
 *         else:
*/
  __pyx_t_2 = (__pyx_v_error->file == NULL);
  if (__pyx_t_2) {

    /* "src/lxml/xmlerror.pxi":89
 *                 raise MemoryError()
 *         if error.file is NULL:
 *             self._filename = '<string>'             # <<<<<<<<<<<<<<
 *         else:
 *             self._filename = None
*/
    __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_string);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_kp_u_string);
    __Pyx_GOTREF(__pyx_v_self->_filename);
    __Pyx_DECREF(__pyx_v_self->_filename);
    __pyx_v_self->_filename = __pyx_mstate_global->__pyx_kp_u_string;

    /* "src/lxml/xmlerror.pxi":88
 *             if not self._c_message:
 *                 raise MemoryError()
 *         if error.file is NULL:             # <<<<<<<<<<<<<<
 *             self._filename = '<string>'
 *         else:
*/
    goto __pyx_L9;
  }

  /* "src/lxml/xmlerror.pxi":91
 *             self._filename = '<string>'
 *         else:
 *             self._filename = None             # <<<<<<<<<<<<<<
 *             self._c_filename = tree.xmlStrdup(<const_xmlChar*> error.file)
 *             if not self._c_filename:
*/
  /*else*/ {
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_self->_filename);
    __Pyx_DECREF(__pyx_v_self->_filename);
    __pyx_v_self->_filename = ((PyObject*)Py_None);

    /* "src/lxml/xmlerror.pxi":92
 *         else:
 *             self._filename = None
 *             self._c_filename = tree.xmlStrdup(<const_xmlChar*> error.file)             # <<<<<<<<<<<<<<
 *             if not self._c_filename:
 *                 raise MemoryError()
*/
    __pyx_v_self->_c_filename = xmlStrdup(((const xmlChar *)__pyx_v_error->file));

    /* "src/lxml/xmlerror.pxi":93
 *             self._filename = None
 *             self._c_filename = tree.xmlStrdup(<const_xmlChar*> error.file)
 *             if not self._c_filename:             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 *         if error.node is not NULL:
*/
    __pyx_t_2 = (!(__pyx_v_self->_c_filename != 0));
    if (unlikely(__pyx_t_2)) {

      /* "src/lxml/xmlerror.pxi":94
 *             self._c_filename = tree.xmlStrdup(<const_xmlChar*> error.file)
 *             if not self._c_filename:
 *                 raise MemoryError()             # <<<<<<<<<<<<<<
 *         if error.node is not NULL:
 *             self._c_path = tree.xmlGetNodePath(<xmlNode*> error.node)
*/
      PyErr_NoMemory(); __PYX_ERR(1, 94, __pyx_L1_error)

      /* "src/lxml/xmlerror.pxi":93
 *             self._filename = None
 *             self._c_filename = tree.xmlStrdup(<const_xmlChar*> error.file)
 *             if not self._c_filename:             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 *         if error.node is not NULL:
*/
    }
  }
  __pyx_L9:;

  /* "src/lxml/xmlerror.pxi":95
 *             if not self._c_filename:
 *                 raise MemoryError()
 *         if error.node is not NULL:             # <<<<<<<<<<<<<<
 *             self._c_path = tree.xmlGetNodePath(<xmlNode*> error.node)
 *             c_line = tree.xmlGetLineNo(<xmlNode*> error.node)
*/
  __pyx_t_2 = (__pyx_v_error->node != NULL);
  if (__pyx_t_2) {

    /* "src/lxml/xmlerror.pxi":96
 *                 raise MemoryError()
 *         if error.node is not NULL:
 *             self._c_path = tree.xmlGetNodePath(<xmlNode*> error.node)             # <<<<<<<<<<<<<<
 *             c_line = tree.xmlGetLineNo(<xmlNode*> error.node)
 *             if c_line > limits.INT_MAX:
*/
    __pyx_v_self->_c_path = xmlGetNodePath(((xmlNode *)__pyx_v_error->node));

    /* "src/lxml/xmlerror.pxi":97
 *         if error.node is not NULL:
 *             self._c_path = tree.xmlGetNodePath(<xmlNode*> error.node)
 *             c_line = tree.xmlGetLineNo(<xmlNode*> error.node)             # <<<<<<<<<<<<<<
 *             if c_line > limits.INT_MAX:
 *                 self.line = c_line
*/
    __pyx_v_c_line = xmlGetLineNo(((xmlNode *)__pyx_v_error->node));

    /* "src/lxml/xmlerror.pxi":98
 *             self._c_path = tree.xmlGetNodePath(<xmlNode*> error.node)
 *             c_line = tree.xmlGetLineNo(<xmlNode*> error.node)
 *             if c_line > limits.INT_MAX:             # <<<<<<<<<<<<<<
 *                 self.line = c_line
 * 
*/
    __pyx_t_2 = (__pyx_v_c_line > INT_MAX);
    if (__pyx_t_2) {

      /* "src/lxml/xmlerror.pxi":99
 *             c_line = tree.xmlGetLineNo(<xmlNode*> error.node)
 *             if c_line > limits.INT_MAX:
 *                 self.line = c_line             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
*/
      __pyx_v_self->line = __pyx_v_c_line;

      /* "src/lxml/xmlerror.pxi":98
 *             self._c_path = tree.xmlGetNodePath(<xmlNode*> error.node)
 *             c_line = tree.xmlGetLineNo(<xmlNode*> error.node)
 *             if c_line > limits.INT_MAX:             # <<<<<<<<<<<<<<
 *                 self.line = c_line
 * 
*/
    }

    /* "src/lxml/xmlerror.pxi":95
 *             if not self._c_filename:
 *                 raise MemoryError()
 *         if error.node is not NULL:             # <<<<<<<<<<<<<<
 *             self._c_path = tree.xmlGetNodePath(<xmlNode*> error.node)
 *             c_line = tree.xmlGetLineNo(<xmlNode*> error.node)
*/
  }

  /* "src/lxml/xmlerror.pxi":68
 *         tree.xmlFree(self._c_path)
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef int _setError(self, const xmlerror.xmlError* error) except -1:
 *         self.domain   = error.domain
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._LogEntry._setError", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":101
 *                 self.line = c_line
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef _setGeneric(self, int domain, int type, int level, long line,
 *                      message, filename):
*/

static PyObject *__pyx_f_4lxml_5etree_9_LogEntry__setGeneric(struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_self, int __pyx_v_domain, int __pyx_v_type, int __pyx_v_level, long __pyx_v_line, PyObject *__pyx_v_message, PyObject *__pyx_v_filename) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_setGeneric", 0);

  /* "src/lxml/xmlerror.pxi":104
 *     cdef _setGeneric(self, int domain, int type, int level, long line,
 *                      message, filename):
 *         self.domain  = domain             # <<<<<<<<<<<<<<
 *         self.type    = type
 *         self.level   = level
*/
  __pyx_v_self->domain = __pyx_v_domain;

  /* "src/lxml/xmlerror.pxi":105
 *                      message, filename):
 *         self.domain  = domain
 *         self.type    = type             # <<<<<<<<<<<<<<
 *         self.level   = level
 *         self.line    = line
*/
  __pyx_v_self->type = __pyx_v_type;

  /* "src/lxml/xmlerror.pxi":106
 *         self.domain  = domain
 *         self.type    = type
 *         self.level   = level             # <<<<<<<<<<<<<<
 *         self.line    = line
 *         self.column  = 0
*/
  __pyx_v_self->level = __pyx_v_level;

  /* "src/lxml/xmlerror.pxi":107
 *         self.type    = type
 *         self.level   = level
 *         self.line    = line             # <<<<<<<<<<<<<<
 *         self.column  = 0
 *         self._message = message
*/
  __pyx_v_self->line = __pyx_v_line;

  /* "src/lxml/xmlerror.pxi":108
 *         self.level   = level
 *         self.line    = line
 *         self.column  = 0             # <<<<<<<<<<<<<<
 *         self._message = message
 *         self._filename = filename
*/
  __pyx_v_self->column = 0;

  /* "src/lxml/xmlerror.pxi":109
 *         self.line    = line
 *         self.column  = 0
 *         self._message = message             # <<<<<<<<<<<<<<
 *         self._filename = filename
 *         self._c_path = NULL
*/
  __pyx_t_1 = __pyx_v_message;
  __Pyx_INCREF(__pyx_t_1);
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_1))) __PYX_ERR(1, 109, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_message);
  __Pyx_DECREF(__pyx_v_self->_message);
  __pyx_v_self->_message = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xmlerror.pxi":110
 *         self.column  = 0
 *         self._message = message
 *         self._filename = filename             # <<<<<<<<<<<<<<
 *         self._c_path = NULL
 * 
*/
  __pyx_t_1 = __pyx_v_filename;
  __Pyx_INCREF(__pyx_t_1);
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_1))) __PYX_ERR(1, 110, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_filename);
  __Pyx_DECREF(__pyx_v_self->_filename);
  __pyx_v_self->_filename = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xmlerror.pxi":111
 *         self._message = message
 *         self._filename = filename
 *         self._c_path = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
*/
  __pyx_v_self->_c_path = NULL;

  /* "src/lxml/xmlerror.pxi":101
 *                 self.line = c_line
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef _setGeneric(self, int domain, int type, int level, long line,
 *                      message, filename):
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._LogEntry._setGeneric", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":113
 *         self._c_path = NULL
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "%s:%d:%d:%s:%s:%s: %s" % (
 *             self.filename, self.line, self.column, self.level_name,
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9_LogEntry_3__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_9_LogEntry_3__repr__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_9_LogEntry_2__repr__(((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_2__repr__(struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9[13];
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "src/lxml/xmlerror.pxi":114
 * 
 *     def __repr__(self):
 *         return "%s:%d:%d:%s:%s:%s: %s" % (             # <<<<<<<<<<<<<<
 *             self.filename, self.line, self.column, self.level_name,
 *             self.domain_name, self.type_name, self.message)
*/
  __Pyx_XDECREF(__pyx_r);

  /* "src/lxml/xmlerror.pxi":115
 *     def __repr__(self):
 *         return "%s:%d:%d:%s:%s:%s: %s" % (
 *             self.filename, self.line, self.column, self.level_name,             # <<<<<<<<<<<<<<
 *             self.domain_name, self.type_name, self.message)
 * 
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_filename); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 115, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_t_1), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 115, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyUnicode_From_long(__pyx_v_self->line, 0, ' ', 'd'); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 115, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyUnicode_From_int(__pyx_v_self->column, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 115, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_level_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 115, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_t_4), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 115, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "src/lxml/xmlerror.pxi":116
 *         return "%s:%d:%d:%s:%s:%s: %s" % (
 *             self.filename, self.line, self.column, self.level_name,
 *             self.domain_name, self.type_name, self.message)             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_domain_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_t_4), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_type_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_7 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_t_4), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_message); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_8 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_t_4), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_9[0] = __pyx_t_2;
  __pyx_t_9[1] = __pyx_mstate_global->__pyx_kp_u__9;
  __pyx_t_9[2] = __pyx_t_1;
  __pyx_t_9[3] = __pyx_mstate_global->__pyx_kp_u__9;
  __pyx_t_9[4] = __pyx_t_3;
  __pyx_t_9[5] = __pyx_mstate_global->__pyx_kp_u__9;
  __pyx_t_9[6] = __pyx_t_5;
  __pyx_t_9[7] = __pyx_mstate_global->__pyx_kp_u__9;
  __pyx_t_9[8] = __pyx_t_6;
  __pyx_t_9[9] = __pyx_mstate_global->__pyx_kp_u__9;
  __pyx_t_9[10] = __pyx_t_7;
  __pyx_t_9[11] = __pyx_mstate_global->__pyx_kp_u_;
  __pyx_t_9[12] = __pyx_t_8;

  /* "src/lxml/xmlerror.pxi":114
 * 
 *     def __repr__(self):
 *         return "%s:%d:%d:%s:%s:%s: %s" % (             # <<<<<<<<<<<<<<
 *             self.filename, self.line, self.column, self.level_name,
 *             self.domain_name, self.type_name, self.message)
*/
  __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_9, 13, __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 1 * 5 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7) + 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8));
  if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 114, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "src/lxml/xmlerror.pxi":113
 *         self._c_path = NULL
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "%s:%d:%d:%s:%s:%s: %s" % (
 *             self.filename, self.line, self.column, self.level_name,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("lxml.etree._LogEntry.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":118
 *             self.domain_name, self.type_name, self.message)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def domain_name(self):
 *         """The name of the error domain.  See lxml.etree.ErrorDomains
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9_LogEntry_11domain_name_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_9_LogEntry_11domain_name_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_9_LogEntry_11domain_name___get__(((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_11domain_name___get__(struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "src/lxml/xmlerror.pxi":122
 *         """The name of the error domain.  See lxml.etree.ErrorDomains
 *         """
 *         return ErrorDomains._getName(self.domain, "unknown")             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_ErrorDomains); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 122, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_getName); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 122, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_self->domain); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 122, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
    __pyx_t_5 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_t_3, __pyx_mstate_global->__pyx_n_u_unknown};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 122, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/xmlerror.pxi":118
 *             self.domain_name, self.type_name, self.message)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def domain_name(self):
 *         """The name of the error domain.  See lxml.etree.ErrorDomains
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._LogEntry.domain_name.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":124
 *         return ErrorDomains._getName(self.domain, "unknown")
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def type_name(self):
 *         """The name of the error type.  See lxml.etree.ErrorTypes
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9_LogEntry_9type_name_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_9_LogEntry_9type_name_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_9_LogEntry_9type_name___get__(((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_9type_name___get__(struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_self) {
  PyObject *__pyx_v_getName = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "src/lxml/xmlerror.pxi":128
 *         """The name of the error type.  See lxml.etree.ErrorTypes
 *         """
 *         if self.domain == ErrorDomains.RELAXNGV:             # <<<<<<<<<<<<<<
 *             getName = RelaxNGErrorTypes._getName
 *         else:
*/
  __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_self->domain); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 128, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_ErrorDomains); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 128, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_RELAXNGV); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 128, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 128, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(1, 128, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_4) {

    /* "src/lxml/xmlerror.pxi":129
 *         """
 *         if self.domain == ErrorDomains.RELAXNGV:
 *             getName = RelaxNGErrorTypes._getName             # <<<<<<<<<<<<<<
 *         else:
 *             getName = ErrorTypes._getName
*/
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_RelaxNGErrorTypes); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 129, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_getName); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 129, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_getName = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "src/lxml/xmlerror.pxi":128
 *         """The name of the error type.  See lxml.etree.ErrorTypes
 *         """
 *         if self.domain == ErrorDomains.RELAXNGV:             # <<<<<<<<<<<<<<
 *             getName = RelaxNGErrorTypes._getName
 *         else:
*/
    goto __pyx_L3;
  }

  /* "src/lxml/xmlerror.pxi":131
 *             getName = RelaxNGErrorTypes._getName
 *         else:
 *             getName = ErrorTypes._getName             # <<<<<<<<<<<<<<
 *         return getName(self.type, "unknown")
 * 
*/
  /*else*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_ErrorTypes); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 131, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_getName); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 131, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_getName = __pyx_t_2;
    __pyx_t_2 = 0;
  }
  __pyx_L3:;

  /* "src/lxml/xmlerror.pxi":132
 *         else:
 *             getName = ErrorTypes._getName
 *         return getName(self.type, "unknown")             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = NULL;
  __Pyx_INCREF(__pyx_v_getName);
  __pyx_t_1 = __pyx_v_getName; 
  __pyx_t_5 = __Pyx_PyLong_From_int(__pyx_v_self->type); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 132, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
    assert(__pyx_t_3);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_1, __pyx__function);
    __pyx_t_6 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_t_5, __pyx_mstate_global->__pyx_n_u_unknown};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_1, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 132, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/xmlerror.pxi":124
 *         return ErrorDomains._getName(self.domain, "unknown")
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def type_name(self):
 *         """The name of the error type.  See lxml.etree.ErrorTypes
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._LogEntry.type_name.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_getName);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":134
 *         return getName(self.type, "unknown")
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def level_name(self):
 *         """The name of the error level.  See lxml.etree.ErrorLevels
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9_LogEntry_10level_name_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_9_LogEntry_10level_name_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_9_LogEntry_10level_name___get__(((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_10level_name___get__(struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "src/lxml/xmlerror.pxi":138
 *         """The name of the error level.  See lxml.etree.ErrorLevels
 *         """
 *         return ErrorLevels._getName(self.level, "unknown")             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_ErrorLevels); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 138, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_getName); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 138, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_self->level); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 138, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
    __pyx_t_5 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_t_3, __pyx_mstate_global->__pyx_n_u_unknown};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 138, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/xmlerror.pxi":134
 *         return getName(self.type, "unknown")
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def level_name(self):
 *         """The name of the error level.  See lxml.etree.ErrorLevels
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._LogEntry.level_name.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":140
 *         return ErrorLevels._getName(self.level, "unknown")
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def message(self):
 *         """The log message string.
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9_LogEntry_7message_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_9_LogEntry_7message_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_9_LogEntry_7message___get__(((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_7message___get__(struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_self) {
  size_t __pyx_v_size;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "src/lxml/xmlerror.pxi":145
 *         """
 *         cdef size_t size
 *         if self._message is not None:             # <<<<<<<<<<<<<<
 *             return self._message
 *         if self._c_message is NULL:
*/
  __pyx_t_1 = (__pyx_v_self->_message != ((PyObject*)Py_None));
  if (__pyx_t_1) {

    /* "src/lxml/xmlerror.pxi":146
 *         cdef size_t size
 *         if self._message is not None:
 *             return self._message             # <<<<<<<<<<<<<<
 *         if self._c_message is NULL:
 *             return None
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_self->_message);
    __pyx_r = __pyx_v_self->_message;
    goto __pyx_L0;

    /* "src/lxml/xmlerror.pxi":145
 *         """
 *         cdef size_t size
 *         if self._message is not None:             # <<<<<<<<<<<<<<
 *             return self._message
 *         if self._c_message is NULL:
*/
  }

  /* "src/lxml/xmlerror.pxi":147
 *         if self._message is not None:
 *             return self._message
 *         if self._c_message is NULL:             # <<<<<<<<<<<<<<
 *             return None
 *         size = cstring_h.strlen(self._c_message)
*/
  __pyx_t_1 = (__pyx_v_self->_c_message == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/xmlerror.pxi":148
 *             return self._message
 *         if self._c_message is NULL:
 *             return None             # <<<<<<<<<<<<<<
 *         size = cstring_h.strlen(self._c_message)
 *         if size > 0 and self._c_message[size-1] == b'\n':
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/xmlerror.pxi":147
 *         if self._message is not None:
 *             return self._message
 *         if self._c_message is NULL:             # <<<<<<<<<<<<<<
 *             return None
 *         size = cstring_h.strlen(self._c_message)
*/
  }

  /* "src/lxml/xmlerror.pxi":149
 *         if self._c_message is NULL:
 *             return None
 *         size = cstring_h.strlen(self._c_message)             # <<<<<<<<<<<<<<
 *         if size > 0 and self._c_message[size-1] == b'\n':
 *             size -= 1  # strip EOL
*/
  __pyx_v_size = strlen(__pyx_v_self->_c_message);

  /* "src/lxml/xmlerror.pxi":150
 *             return None
 *         size = cstring_h.strlen(self._c_message)
 *         if size > 0 and self._c_message[size-1] == b'\n':             # <<<<<<<<<<<<<<
 *             size -= 1  # strip EOL
 *         # cannot use funicode() here because the message may contain
*/
  __pyx_t_2 = (__pyx_v_size > 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_2 = ((__pyx_v_self->_c_message[(__pyx_v_size - 1)]) == '\n');
  __pyx_t_1 = __pyx_t_2;
  __pyx_L6_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/xmlerror.pxi":151
 *         size = cstring_h.strlen(self._c_message)
 *         if size > 0 and self._c_message[size-1] == b'\n':
 *             size -= 1  # strip EOL             # <<<<<<<<<<<<<<
 *         # cannot use funicode() here because the message may contain
 *         # byte encoded file paths etc.
*/
    __pyx_v_size = (__pyx_v_size - 1);

    /* "src/lxml/xmlerror.pxi":150
 *             return None
 *         size = cstring_h.strlen(self._c_message)
 *         if size > 0 and self._c_message[size-1] == b'\n':             # <<<<<<<<<<<<<<
 *             size -= 1  # strip EOL
 *         # cannot use funicode() here because the message may contain
*/
  }

  /* "src/lxml/xmlerror.pxi":154
 *         # cannot use funicode() here because the message may contain
 *         # byte encoded file paths etc.
 *         try:             # <<<<<<<<<<<<<<
 *             self._message = self._c_message[:size].decode('utf8')
 *         except UnicodeDecodeError:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    /*try:*/ {

      /* "src/lxml/xmlerror.pxi":155
 *         # byte encoded file paths etc.
 *         try:
 *             self._message = self._c_message[:size].decode('utf8')             # <<<<<<<<<<<<<<
 *         except UnicodeDecodeError:
 *             try:
*/
      __pyx_t_6 = __Pyx_decode_c_string(__pyx_v_self->_c_message, 0, __pyx_v_size, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 155, __pyx_L8_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_v_self->_message);
      __Pyx_DECREF(__pyx_v_self->_message);
      __pyx_v_self->_message = ((PyObject*)__pyx_t_6);
      __pyx_t_6 = 0;

      /* "src/lxml/xmlerror.pxi":154
 *         # cannot use funicode() here because the message may contain
 *         # byte encoded file paths etc.
 *         try:             # <<<<<<<<<<<<<<
 *             self._message = self._c_message[:size].decode('utf8')
 *         except UnicodeDecodeError:
*/
    }
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L13_try_end;
    __pyx_L8_error:;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "src/lxml/xmlerror.pxi":156
 *         try:
 *             self._message = self._c_message[:size].decode('utf8')
 *         except UnicodeDecodeError:             # <<<<<<<<<<<<<<
 *             try:
 *                 self._message = self._c_message[:size].decode(
*/
    __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_UnicodeDecodeError))));
    if (__pyx_t_7) {
      __Pyx_AddTraceback("lxml.etree._LogEntry.message.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_8, &__pyx_t_9) < 0) __PYX_ERR(1, 156, __pyx_L10_except_error)
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);

      /* "src/lxml/xmlerror.pxi":157
 *             self._message = self._c_message[:size].decode('utf8')
 *         except UnicodeDecodeError:
 *             try:             # <<<<<<<<<<<<<<
 *                 self._message = self._c_message[:size].decode(
 *                     'ascii', 'backslashreplace')
*/
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
        __Pyx_XGOTREF(__pyx_t_10);
        __Pyx_XGOTREF(__pyx_t_11);
        __Pyx_XGOTREF(__pyx_t_12);
        /*try:*/ {

          /* "src/lxml/xmlerror.pxi":158
 *         except UnicodeDecodeError:
 *             try:
 *                 self._message = self._c_message[:size].decode(             # <<<<<<<<<<<<<<
 *                     'ascii', 'backslashreplace')
 *             except UnicodeDecodeError:
*/
          __pyx_t_13 = __Pyx_decode_c_string(__pyx_v_self->_c_message, 0, __pyx_v_size, NULL, __pyx_k_backslashreplace, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 158, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_13);
          __Pyx_GIVEREF(__pyx_t_13);
          __Pyx_GOTREF(__pyx_v_self->_message);
          __Pyx_DECREF(__pyx_v_self->_message);
          __pyx_v_self->_message = ((PyObject*)__pyx_t_13);
          __pyx_t_13 = 0;

          /* "src/lxml/xmlerror.pxi":157
 *             self._message = self._c_message[:size].decode('utf8')
 *         except UnicodeDecodeError:
 *             try:             # <<<<<<<<<<<<<<
 *                 self._message = self._c_message[:size].decode(
 *                     'ascii', 'backslashreplace')
*/
        }
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        goto __pyx_L23_try_end;
        __pyx_L16_error:;
        __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;

        /* "src/lxml/xmlerror.pxi":160
 *                 self._message = self._c_message[:size].decode(
 *                     'ascii', 'backslashreplace')
 *             except UnicodeDecodeError:             # <<<<<<<<<<<<<<
 *                 self._message = '<undecodable error message>'
 *         if self._c_message:
*/
        __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_UnicodeDecodeError))));
        if (__pyx_t_7) {
          __Pyx_ErrRestore(0,0,0);

          /* "src/lxml/xmlerror.pxi":161
 *                     'ascii', 'backslashreplace')
 *             except UnicodeDecodeError:
 *                 self._message = '<undecodable error message>'             # <<<<<<<<<<<<<<
 *         if self._c_message:
 *             # clean up early
*/
          __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_undecodable_error_message);
          __Pyx_GIVEREF(__pyx_mstate_global->__pyx_kp_u_undecodable_error_message);
          __Pyx_GOTREF(__pyx_v_self->_message);
          __Pyx_DECREF(__pyx_v_self->_message);
          __pyx_v_self->_message = __pyx_mstate_global->__pyx_kp_u_undecodable_error_message;
          goto __pyx_L17_exception_handled;
        }
        goto __pyx_L18_except_error;

        /* "src/lxml/xmlerror.pxi":157
 *             self._message = self._c_message[:size].decode('utf8')
 *         except UnicodeDecodeError:
 *             try:             # <<<<<<<<<<<<<<
 *                 self._message = self._c_message[:size].decode(
 *                     'ascii', 'backslashreplace')
*/
        __pyx_L18_except_error:;
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
        goto __pyx_L10_except_error;
        __pyx_L17_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
        __pyx_L23_try_end:;
      }
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L9_exception_handled;
    }
    goto __pyx_L10_except_error;

    /* "src/lxml/xmlerror.pxi":154
 *         # cannot use funicode() here because the message may contain
 *         # byte encoded file paths etc.
 *         try:             # <<<<<<<<<<<<<<
 *             self._message = self._c_message[:size].decode('utf8')
 *         except UnicodeDecodeError:
*/
    __pyx_L10_except_error:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    goto __pyx_L1_error;
    __pyx_L9_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    __pyx_L13_try_end:;
  }

  /* "src/lxml/xmlerror.pxi":162
 *             except UnicodeDecodeError:
 *                 self._message = '<undecodable error message>'
 *         if self._c_message:             # <<<<<<<<<<<<<<
 *             # clean up early
 *             tree.xmlFree(self._c_message)
*/
  __pyx_t_1 = (__pyx_v_self->_c_message != 0);
  if (__pyx_t_1) {

    /* "src/lxml/xmlerror.pxi":164
 *         if self._c_message:
 *             # clean up early
 *             tree.xmlFree(self._c_message)             # <<<<<<<<<<<<<<
 *             self._c_message = NULL
 *         return self._message
*/
    xmlFree(__pyx_v_self->_c_message);

    /* "src/lxml/xmlerror.pxi":165
 *             # clean up early
 *             tree.xmlFree(self._c_message)
 *             self._c_message = NULL             # <<<<<<<<<<<<<<
 *         return self._message
 * 
*/
    __pyx_v_self->_c_message = NULL;

    /* "src/lxml/xmlerror.pxi":162
 *             except UnicodeDecodeError:
 *                 self._message = '<undecodable error message>'
 *         if self._c_message:             # <<<<<<<<<<<<<<
 *             # clean up early
 *             tree.xmlFree(self._c_message)
*/
  }

  /* "src/lxml/xmlerror.pxi":166
 *             tree.xmlFree(self._c_message)
 *             self._c_message = NULL
 *         return self._message             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_message);
  __pyx_r = __pyx_v_self->_message;
  goto __pyx_L0;

  /* "src/lxml/xmlerror.pxi":140
 *         return ErrorLevels._getName(self.level, "unknown")
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def message(self):
 *         """The log message string.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("lxml.etree._LogEntry.message.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":168
 *         return self._message
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def filename(self):
 *         """The file path where the report originated, if any.
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9_LogEntry_8filename_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_9_LogEntry_8filename_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_9_LogEntry_8filename___get__(((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_8filename___get__(struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "src/lxml/xmlerror.pxi":172
 *         """The file path where the report originated, if any.
 *         """
 *         if self._filename is None:             # <<<<<<<<<<<<<<
 *             if self._c_filename is not NULL:
 *                 self._filename = _decodeFilename(self._c_filename)
*/
  __pyx_t_1 = (__pyx_v_self->_filename == ((PyObject*)Py_None));
  if (__pyx_t_1) {

    /* "src/lxml/xmlerror.pxi":173
 *         """
 *         if self._filename is None:
 *             if self._c_filename is not NULL:             # <<<<<<<<<<<<<<
 *                 self._filename = _decodeFilename(self._c_filename)
 *                 # clean up early
*/
    __pyx_t_1 = (__pyx_v_self->_c_filename != NULL);
    if (__pyx_t_1) {

      /* "src/lxml/xmlerror.pxi":174
 *         if self._filename is None:
 *             if self._c_filename is not NULL:
 *                 self._filename = _decodeFilename(self._c_filename)             # <<<<<<<<<<<<<<
 *                 # clean up early
 *                 tree.xmlFree(self._c_filename)
*/
      __pyx_t_2 = __pyx_f_4lxml_5etree__decodeFilename(__pyx_v_self->_c_filename); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 174, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (!(likely(PyUnicode_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_2))) __PYX_ERR(1, 174, __pyx_L1_error)
      __Pyx_GIVEREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_v_self->_filename);
      __Pyx_DECREF(__pyx_v_self->_filename);
      __pyx_v_self->_filename = ((PyObject*)__pyx_t_2);
      __pyx_t_2 = 0;

      /* "src/lxml/xmlerror.pxi":176
 *                 self._filename = _decodeFilename(self._c_filename)
 *                 # clean up early
 *                 tree.xmlFree(self._c_filename)             # <<<<<<<<<<<<<<
 *                 self._c_filename = NULL
 *         return self._filename
*/
      xmlFree(__pyx_v_self->_c_filename);

      /* "src/lxml/xmlerror.pxi":177
 *                 # clean up early
 *                 tree.xmlFree(self._c_filename)
 *                 self._c_filename = NULL             # <<<<<<<<<<<<<<
 *         return self._filename
 * 
*/
      __pyx_v_self->_c_filename = NULL;

      /* "src/lxml/xmlerror.pxi":173
 *         """
 *         if self._filename is None:
 *             if self._c_filename is not NULL:             # <<<<<<<<<<<<<<
 *                 self._filename = _decodeFilename(self._c_filename)
 *                 # clean up early
*/
    }

    /* "src/lxml/xmlerror.pxi":172
 *         """The file path where the report originated, if any.
 *         """
 *         if self._filename is None:             # <<<<<<<<<<<<<<
 *             if self._c_filename is not NULL:
 *                 self._filename = _decodeFilename(self._c_filename)
*/
  }

  /* "src/lxml/xmlerror.pxi":178
 *                 tree.xmlFree(self._c_filename)
 *                 self._c_filename = NULL
 *         return self._filename             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_filename);
  __pyx_r = __pyx_v_self->_filename;
  goto __pyx_L0;

  /* "src/lxml/xmlerror.pxi":168
 *         return self._message
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def filename(self):
 *         """The file path where the report originated, if any.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._LogEntry.filename.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":180
 *         return self._filename
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def path(self):
 *         """The XPath for the node where the error was detected.
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9_LogEntry_4path_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_9_LogEntry_4path_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_9_LogEntry_4path___get__(((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_4path___get__(struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "src/lxml/xmlerror.pxi":184
 *         """The XPath for the node where the error was detected.
 *         """
 *         return funicode(self._c_path) if self._c_path is not NULL else None             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = (__pyx_v_self->_c_path != NULL);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_self->_c_path); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 184, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
  } else {
    __Pyx_INCREF(Py_None);
    __pyx_t_1 = Py_None;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/xmlerror.pxi":180
 *         return self._filename
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def path(self):
 *         """The XPath for the node where the error was detected.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._LogEntry.path.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":52
 *     - path: the location in which the error was found (if available)
 *     """
 *     cdef readonly int domain             # <<<<<<<<<<<<<<
 *     cdef readonly int type
 *     cdef readonly int level
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9_LogEntry_6domain_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_9_LogEntry_6domain_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_9_LogEntry_6domain___get__(((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_6domain___get__(struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_self->domain); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 52, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._LogEntry.domain.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":53
 *     """
 *     cdef readonly int domain
 *     cdef readonly int type             # <<<<<<<<<<<<<<
 *     cdef readonly int level
 *     cdef readonly long line
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9_LogEntry_4type_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_9_LogEntry_4type_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_9_LogEntry_4type___get__(((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_4type___get__(struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_self->type); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 53, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._LogEntry.type.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":54
 *     cdef readonly int domain
 *     cdef readonly int type
 *     cdef readonly int level             # <<<<<<<<<<<<<<
 *     cdef readonly long line
 *     cdef readonly int column
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9_LogEntry_5level_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_9_LogEntry_5level_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_9_LogEntry_5level___get__(((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_5level___get__(struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_self->level); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 54, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._LogEntry.level.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":55
 *     cdef readonly int type
 *     cdef readonly int level
 *     cdef readonly long line             # <<<<<<<<<<<<<<
 *     cdef readonly int column
 *     cdef basestring _message
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9_LogEntry_4line_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_9_LogEntry_4line_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_9_LogEntry_4line___get__(((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_4line___get__(struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_From_long(__pyx_v_self->line); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 55, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._LogEntry.line.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":56
 *     cdef readonly int level
 *     cdef readonly long line
 *     cdef readonly int column             # <<<<<<<<<<<<<<
 *     cdef basestring _message
 *     cdef basestring _filename
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9_LogEntry_6column_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_9_LogEntry_6column_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_9_LogEntry_6column___get__(((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_6column___get__(struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_self->column); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 56, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._LogEntry.column.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":190
 *     cdef _LogEntry _first_error
 *     cdef readonly object last_error
 *     def __init__(self, first_error, last_error):             # <<<<<<<<<<<<<<
 *         self._first_error = first_error
 *         self.last_error = last_error
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_13_BaseErrorLog_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_13_BaseErrorLog_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_first_error = 0;
  PyObject *__pyx_v_last_error = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_first_error,&__pyx_mstate_global->__pyx_n_u_last_error,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 190, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 190, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 190, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(1, 190, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, i); __PYX_ERR(1, 190, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 190, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 190, __pyx_L3_error)
    }
    __pyx_v_first_error = values[0];
    __pyx_v_last_error = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, __pyx_nargs); __PYX_ERR(1, 190, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._BaseErrorLog.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_13_BaseErrorLog___init__(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self), __pyx_v_first_error, __pyx_v_last_error);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_13_BaseErrorLog___init__(struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_self, PyObject *__pyx_v_first_error, PyObject *__pyx_v_last_error) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "src/lxml/xmlerror.pxi":191
 *     cdef readonly object last_error
 *     def __init__(self, first_error, last_error):
 *         self._first_error = first_error             # <<<<<<<<<<<<<<
 *         self.last_error = last_error
 * 
*/
  __pyx_t_1 = __pyx_v_first_error;
  __Pyx_INCREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__LogEntry))))) __PYX_ERR(1, 191, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_first_error);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_first_error);
  __pyx_v_self->_first_error = ((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xmlerror.pxi":192
 *     def __init__(self, first_error, last_error):
 *         self._first_error = first_error
 *         self.last_error = last_error             # <<<<<<<<<<<<<<
 * 
 *     cpdef copy(self):
*/
  __Pyx_INCREF(__pyx_v_last_error);
  __Pyx_GIVEREF(__pyx_v_last_error);
  __Pyx_GOTREF(__pyx_v_self->last_error);
  __Pyx_DECREF(__pyx_v_self->last_error);
  __pyx_v_self->last_error = __pyx_v_last_error;

  /* "src/lxml/xmlerror.pxi":190
 *     cdef _LogEntry _first_error
 *     cdef readonly object last_error
 *     def __init__(self, first_error, last_error):             # <<<<<<<<<<<<<<
 *         self._first_error = first_error
 *         self.last_error = last_error
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._BaseErrorLog.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":194
 *         self.last_error = last_error
 * 
 *     cpdef copy(self):             # <<<<<<<<<<<<<<
 *         return _BaseErrorLog(self._first_error, self.last_error)
 * 
*/

static PyObject *__pyx_pw_4lxml_5etree_13_BaseErrorLog_3copy(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_4lxml_5etree_13_BaseErrorLog_copy(struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_self, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (
  #if !CYTHON_USE_TYPE_SLOTS
  unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_4lxml_5etree__BaseErrorLog &&
  __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
  #else
  unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
  #endif
  ) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_copy); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 194, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_4lxml_5etree_13_BaseErrorLog_3copy)) {
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_3 = NULL;
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_4 = __pyx_t_1; 
        __pyx_t_5 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
          assert(__pyx_t_3);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
          __pyx_t_5 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
          __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 194, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
        }
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "src/lxml/xmlerror.pxi":195
 * 
 *     cpdef copy(self):
 *         return _BaseErrorLog(self._first_error, self.last_error)             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = NULL;
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_2, ((PyObject *)__pyx_v_self->_first_error), __pyx_v_self->last_error};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__BaseErrorLog, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 195, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __pyx_r = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/xmlerror.pxi":194
 *         self.last_error = last_error
 * 
 *     cpdef copy(self):             # <<<<<<<<<<<<<<
 *         return _BaseErrorLog(self._first_error, self.last_error)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._BaseErrorLog.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_13_BaseErrorLog_3copy(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_13_BaseErrorLog_3copy = {"copy", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_13_BaseErrorLog_3copy, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_13_BaseErrorLog_3copy(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("copy", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("copy", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_13_BaseErrorLog_2copy(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_13_BaseErrorLog_2copy(struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree_13_BaseErrorLog_copy(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 194, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._BaseErrorLog.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":197
 *         return _BaseErrorLog(self._first_error, self.last_error)
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return ''
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_13_BaseErrorLog_5__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_13_BaseErrorLog_5__repr__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_13_BaseErrorLog_4__repr__(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_13_BaseErrorLog_4__repr__(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "src/lxml/xmlerror.pxi":198
 * 
 *     def __repr__(self):
 *         return ''             # <<<<<<<<<<<<<<
 * 
 *     cpdef receive(self, _LogEntry entry):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u__8);
  __pyx_r = __pyx_mstate_global->__pyx_kp_u__8;
  goto __pyx_L0;

  /* "src/lxml/xmlerror.pxi":197
 *         return _BaseErrorLog(self._first_error, self.last_error)
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return ''
 * 
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":200
 *         return ''
 * 
 *     cpdef receive(self, _LogEntry entry):             # <<<<<<<<<<<<<<
 *         pass
 * 
*/

static PyObject *__pyx_pw_4lxml_5etree_13_BaseErrorLog_7receive(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_4lxml_5etree_13_BaseErrorLog_receive(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_self, CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_entry, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("receive", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (
  #if !CYTHON_USE_TYPE_SLOTS
  unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_4lxml_5etree__BaseErrorLog &&
  __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
  #else
  unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
  #endif
  ) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_receive); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 200, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_4lxml_5etree_13_BaseErrorLog_7receive)) {
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_3 = NULL;
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_4 = __pyx_t_1; 
        __pyx_t_5 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
          assert(__pyx_t_3);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
          __pyx_t_5 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_3, ((PyObject *)__pyx_v_entry)};
          __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 200, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
        }
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "src/lxml/xmlerror.pxi":201
 * 
 *     cpdef receive(self, _LogEntry entry):
 *         pass             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._BaseErrorLog.receive", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":200
 *         return ''
 * 
 *     cpdef receive(self, _LogEntry entry):             # <<<<<<<<<<<<<<
 *         pass
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_13_BaseErrorLog_7receive(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_13_BaseErrorLog_7receive = {"receive", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_13_BaseErrorLog_7receive, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_13_BaseErrorLog_7receive(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_entry = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("receive (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_entry,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 200, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 200, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "receive", 0) < (0)) __PYX_ERR(1, 200, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("receive", 1, 1, 1, i); __PYX_ERR(1, 200, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 200, __pyx_L3_error)
    }
    __pyx_v_entry = ((struct __pyx_obj_4lxml_5etree__LogEntry *)values[0]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("receive", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 200, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._BaseErrorLog.receive", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_entry), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__LogEntry, 1, "entry", 0))) __PYX_ERR(1, 200, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_13_BaseErrorLog_6receive(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self), __pyx_v_entry);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_13_BaseErrorLog_6receive(struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_self, struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_entry) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("receive", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree_13_BaseErrorLog_receive(__pyx_v_self, __pyx_v_entry, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 200, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._BaseErrorLog.receive", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":203
 *         pass
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef int _receive(self, const xmlerror.xmlError* error) except -1:
 *         cdef bint is_error
*/

static int __pyx_f_4lxml_5etree_13_BaseErrorLog__receive(struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_self, xmlError const *__pyx_v_error) {
  int __pyx_v_is_error;
  struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_entry = 0;
  struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_global_log = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_receive", 0);

  /* "src/lxml/xmlerror.pxi":208
 *         cdef _LogEntry entry
 *         cdef _BaseErrorLog global_log
 *         entry = _LogEntry.__new__(_LogEntry)             # <<<<<<<<<<<<<<
 *         entry._setError(error)
 *         is_error = error.level == xmlerror.XML_ERR_ERROR or \
*/
  __pyx_t_1 = ((PyObject *)__pyx_tp_new_4lxml_5etree__LogEntry(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__LogEntry), __pyx_mstate_global->__pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 208, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_1);
  __pyx_v_entry = ((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xmlerror.pxi":209
 *         cdef _BaseErrorLog global_log
 *         entry = _LogEntry.__new__(_LogEntry)
 *         entry._setError(error)             # <<<<<<<<<<<<<<
 *         is_error = error.level == xmlerror.XML_ERR_ERROR or \
 *                    error.level == xmlerror.XML_ERR_FATAL
*/
  __pyx_t_2 = __pyx_f_4lxml_5etree_9_LogEntry__setError(__pyx_v_entry, __pyx_v_error); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 209, __pyx_L1_error)

  /* "src/lxml/xmlerror.pxi":210
 *         entry = _LogEntry.__new__(_LogEntry)
 *         entry._setError(error)
 *         is_error = error.level == xmlerror.XML_ERR_ERROR or \             # <<<<<<<<<<<<<<
 *                    error.level == xmlerror.XML_ERR_FATAL
 *         global_log = _getThreadErrorLog(GLOBAL_ERROR_LOG)
*/
  switch (__pyx_v_error->level) {
    case XML_ERR_ERROR:
    case XML_ERR_FATAL:

    /* "src/lxml/xmlerror.pxi":211
 *         entry._setError(error)
 *         is_error = error.level == xmlerror.XML_ERR_ERROR or \
 *                    error.level == xmlerror.XML_ERR_FATAL             # <<<<<<<<<<<<<<
 *         global_log = _getThreadErrorLog(GLOBAL_ERROR_LOG)
 *         if global_log is not self:
*/
    __pyx_t_3 = 1;

    /* "src/lxml/xmlerror.pxi":210
 *         entry = _LogEntry.__new__(_LogEntry)
 *         entry._setError(error)
 *         is_error = error.level == xmlerror.XML_ERR_ERROR or \             # <<<<<<<<<<<<<<
 *                    error.level == xmlerror.XML_ERR_FATAL
 *         global_log = _getThreadErrorLog(GLOBAL_ERROR_LOG)
*/
    break;
    default:
    __pyx_t_3 = 0;
    break;
  }
  __pyx_v_is_error = __pyx_t_3;

  /* "src/lxml/xmlerror.pxi":212
 *         is_error = error.level == xmlerror.XML_ERR_ERROR or \
 *                    error.level == xmlerror.XML_ERR_FATAL
 *         global_log = _getThreadErrorLog(GLOBAL_ERROR_LOG)             # <<<<<<<<<<<<<<
 *         if global_log is not self:
 *             global_log.receive(entry)
*/
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__getThreadErrorLog(__pyx_mstate_global->__pyx_n_u_GlobalErrorLog)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 212, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_global_log = ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xmlerror.pxi":213
 *                    error.level == xmlerror.XML_ERR_FATAL
 *         global_log = _getThreadErrorLog(GLOBAL_ERROR_LOG)
 *         if global_log is not self:             # <<<<<<<<<<<<<<
 *             global_log.receive(entry)
 *             if is_error:
*/
  __pyx_t_3 = (__pyx_v_global_log != __pyx_v_self);
  if (__pyx_t_3) {

    /* "src/lxml/xmlerror.pxi":214
 *         global_log = _getThreadErrorLog(GLOBAL_ERROR_LOG)
 *         if global_log is not self:
 *             global_log.receive(entry)             # <<<<<<<<<<<<<<
 *             if is_error:
 *                 global_log.last_error = entry
*/
    __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseErrorLog *)__pyx_v_global_log->__pyx_vtab)->receive(__pyx_v_global_log, __pyx_v_entry, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 214, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "src/lxml/xmlerror.pxi":215
 *         if global_log is not self:
 *             global_log.receive(entry)
 *             if is_error:             # <<<<<<<<<<<<<<
 *                 global_log.last_error = entry
 *         self.receive(entry)
*/
    if (__pyx_v_is_error) {

      /* "src/lxml/xmlerror.pxi":216
 *             global_log.receive(entry)
 *             if is_error:
 *                 global_log.last_error = entry             # <<<<<<<<<<<<<<
 *         self.receive(entry)
 *         if is_error:
*/
      __Pyx_INCREF((PyObject *)__pyx_v_entry);
      __Pyx_GIVEREF((PyObject *)__pyx_v_entry);
      __Pyx_GOTREF(__pyx_v_global_log->last_error);
      __Pyx_DECREF(__pyx_v_global_log->last_error);
      __pyx_v_global_log->last_error = ((PyObject *)__pyx_v_entry);

      /* "src/lxml/xmlerror.pxi":215
 *         if global_log is not self:
 *             global_log.receive(entry)
 *             if is_error:             # <<<<<<<<<<<<<<
 *                 global_log.last_error = entry
 *         self.receive(entry)
*/
    }

    /* "src/lxml/xmlerror.pxi":213
 *                    error.level == xmlerror.XML_ERR_FATAL
 *         global_log = _getThreadErrorLog(GLOBAL_ERROR_LOG)
 *         if global_log is not self:             # <<<<<<<<<<<<<<
 *             global_log.receive(entry)
 *             if is_error:
*/
  }

  /* "src/lxml/xmlerror.pxi":217
 *             if is_error:
 *                 global_log.last_error = entry
 *         self.receive(entry)             # <<<<<<<<<<<<<<
 *         if is_error:
 *             self.last_error = entry
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseErrorLog *)__pyx_v_self->__pyx_vtab)->receive(__pyx_v_self, __pyx_v_entry, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 217, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xmlerror.pxi":218
 *                 global_log.last_error = entry
 *         self.receive(entry)
 *         if is_error:             # <<<<<<<<<<<<<<
 *             self.last_error = entry
 * 
*/
  if (__pyx_v_is_error) {

    /* "src/lxml/xmlerror.pxi":219
 *         self.receive(entry)
 *         if is_error:
 *             self.last_error = entry             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
*/
    __Pyx_INCREF((PyObject *)__pyx_v_entry);
    __Pyx_GIVEREF((PyObject *)__pyx_v_entry);
    __Pyx_GOTREF(__pyx_v_self->last_error);
    __Pyx_DECREF(__pyx_v_self->last_error);
    __pyx_v_self->last_error = ((PyObject *)__pyx_v_entry);

    /* "src/lxml/xmlerror.pxi":218
 *                 global_log.last_error = entry
 *         self.receive(entry)
 *         if is_error:             # <<<<<<<<<<<<<<
 *             self.last_error = entry
 * 
*/
  }

  /* "src/lxml/xmlerror.pxi":203
 *         pass
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef int _receive(self, const xmlerror.xmlError* error) except -1:
 *         cdef bint is_error
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._BaseErrorLog._receive", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_entry);
  __Pyx_XDECREF((PyObject *)__pyx_v_global_log);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":221
 *             self.last_error = entry
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef int _receiveGeneric(self, int domain, int type, int level, long line,
 *                              message, filename) except -1:
*/

static int __pyx_f_4lxml_5etree_13_BaseErrorLog__receiveGeneric(struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_self, int __pyx_v_domain, int __pyx_v_type, int __pyx_v_level, long __pyx_v_line, PyObject *__pyx_v_message, PyObject *__pyx_v_filename) {
  int __pyx_v_is_error;
  struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_entry = 0;
  struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_global_log = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_receiveGeneric", 0);

  /* "src/lxml/xmlerror.pxi":227
 *         cdef _LogEntry entry
 *         cdef _BaseErrorLog global_log
 *         entry = _LogEntry.__new__(_LogEntry)             # <<<<<<<<<<<<<<
 *         entry._setGeneric(domain, type, level, line, message, filename)
 *         is_error = level == xmlerror.XML_ERR_ERROR or \
*/
  __pyx_t_1 = ((PyObject *)__pyx_tp_new_4lxml_5etree__LogEntry(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__LogEntry), __pyx_mstate_global->__pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 227, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_1);
  __pyx_v_entry = ((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xmlerror.pxi":228
 *         cdef _BaseErrorLog global_log
 *         entry = _LogEntry.__new__(_LogEntry)
 *         entry._setGeneric(domain, type, level, line, message, filename)             # <<<<<<<<<<<<<<
 *         is_error = level == xmlerror.XML_ERR_ERROR or \
 *                    level == xmlerror.XML_ERR_FATAL
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_9_LogEntry__setGeneric(__pyx_v_entry, __pyx_v_domain, __pyx_v_type, __pyx_v_level, __pyx_v_line, __pyx_v_message, __pyx_v_filename); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 228, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xmlerror.pxi":229
 *         entry = _LogEntry.__new__(_LogEntry)
 *         entry._setGeneric(domain, type, level, line, message, filename)
 *         is_error = level == xmlerror.XML_ERR_ERROR or \             # <<<<<<<<<<<<<<
 *                    level == xmlerror.XML_ERR_FATAL
 *         global_log = _getThreadErrorLog(GLOBAL_ERROR_LOG)
*/
  switch (__pyx_v_level) {
    case XML_ERR_ERROR:
    case XML_ERR_FATAL:

    /* "src/lxml/xmlerror.pxi":230
 *         entry._setGeneric(domain, type, level, line, message, filename)
 *         is_error = level == xmlerror.XML_ERR_ERROR or \
 *                    level == xmlerror.XML_ERR_FATAL             # <<<<<<<<<<<<<<
 *         global_log = _getThreadErrorLog(GLOBAL_ERROR_LOG)
 *         if global_log is not self:
*/
    __pyx_t_2 = 1;

    /* "src/lxml/xmlerror.pxi":229
 *         entry = _LogEntry.__new__(_LogEntry)
 *         entry._setGeneric(domain, type, level, line, message, filename)
 *         is_error = level == xmlerror.XML_ERR_ERROR or \             # <<<<<<<<<<<<<<
 *                    level == xmlerror.XML_ERR_FATAL
 *         global_log = _getThreadErrorLog(GLOBAL_ERROR_LOG)
*/
    break;
    default:
    __pyx_t_2 = 0;
    break;
  }
  __pyx_v_is_error = __pyx_t_2;

  /* "src/lxml/xmlerror.pxi":231
 *         is_error = level == xmlerror.XML_ERR_ERROR or \
 *                    level == xmlerror.XML_ERR_FATAL
 *         global_log = _getThreadErrorLog(GLOBAL_ERROR_LOG)             # <<<<<<<<<<<<<<
 *         if global_log is not self:
 *             global_log.receive(entry)
*/
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__getThreadErrorLog(__pyx_mstate_global->__pyx_n_u_GlobalErrorLog)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 231, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_global_log = ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xmlerror.pxi":232
 *                    level == xmlerror.XML_ERR_FATAL
 *         global_log = _getThreadErrorLog(GLOBAL_ERROR_LOG)
 *         if global_log is not self:             # <<<<<<<<<<<<<<
 *             global_log.receive(entry)
 *             if is_error:
*/
  __pyx_t_2 = (__pyx_v_global_log != __pyx_v_self);
  if (__pyx_t_2) {

    /* "src/lxml/xmlerror.pxi":233
 *         global_log = _getThreadErrorLog(GLOBAL_ERROR_LOG)
 *         if global_log is not self:
 *             global_log.receive(entry)             # <<<<<<<<<<<<<<
 *             if is_error:
 *                 global_log.last_error = entry
*/
    __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseErrorLog *)__pyx_v_global_log->__pyx_vtab)->receive(__pyx_v_global_log, __pyx_v_entry, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 233, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "src/lxml/xmlerror.pxi":234
 *         if global_log is not self:
 *             global_log.receive(entry)
 *             if is_error:             # <<<<<<<<<<<<<<
 *                 global_log.last_error = entry
 *         self.receive(entry)
*/
    if (__pyx_v_is_error) {

      /* "src/lxml/xmlerror.pxi":235
 *             global_log.receive(entry)
 *             if is_error:
 *                 global_log.last_error = entry             # <<<<<<<<<<<<<<
 *         self.receive(entry)
 *         if is_error:
*/
      __Pyx_INCREF((PyObject *)__pyx_v_entry);
      __Pyx_GIVEREF((PyObject *)__pyx_v_entry);
      __Pyx_GOTREF(__pyx_v_global_log->last_error);
      __Pyx_DECREF(__pyx_v_global_log->last_error);
      __pyx_v_global_log->last_error = ((PyObject *)__pyx_v_entry);

      /* "src/lxml/xmlerror.pxi":234
 *         if global_log is not self:
 *             global_log.receive(entry)
 *             if is_error:             # <<<<<<<<<<<<<<
 *                 global_log.last_error = entry
 *         self.receive(entry)
*/
    }

    /* "src/lxml/xmlerror.pxi":232
 *                    level == xmlerror.XML_ERR_FATAL
 *         global_log = _getThreadErrorLog(GLOBAL_ERROR_LOG)
 *         if global_log is not self:             # <<<<<<<<<<<<<<
 *             global_log.receive(entry)
 *             if is_error:
*/
  }

  /* "src/lxml/xmlerror.pxi":236
 *             if is_error:
 *                 global_log.last_error = entry
 *         self.receive(entry)             # <<<<<<<<<<<<<<
 *         if is_error:
 *             self.last_error = entry
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseErrorLog *)__pyx_v_self->__pyx_vtab)->receive(__pyx_v_self, __pyx_v_entry, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 236, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xmlerror.pxi":237
 *                 global_log.last_error = entry
 *         self.receive(entry)
 *         if is_error:             # <<<<<<<<<<<<<<
 *             self.last_error = entry
 * 
*/
  if (__pyx_v_is_error) {

    /* "src/lxml/xmlerror.pxi":238
 *         self.receive(entry)
 *         if is_error:
 *             self.last_error = entry             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
*/
    __Pyx_INCREF((PyObject *)__pyx_v_entry);
    __Pyx_GIVEREF((PyObject *)__pyx_v_entry);
    __Pyx_GOTREF(__pyx_v_self->last_error);
    __Pyx_DECREF(__pyx_v_self->last_error);
    __pyx_v_self->last_error = ((PyObject *)__pyx_v_entry);

    /* "src/lxml/xmlerror.pxi":237
 *                 global_log.last_error = entry
 *         self.receive(entry)
 *         if is_error:             # <<<<<<<<<<<<<<
 *             self.last_error = entry
 * 
*/
  }

  /* "src/lxml/xmlerror.pxi":221
 *             self.last_error = entry
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef int _receiveGeneric(self, int domain, int type, int level, long line,
 *                              message, filename) except -1:
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._BaseErrorLog._receiveGeneric", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_entry);
  __Pyx_XDECREF((PyObject *)__pyx_v_global_log);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":240
 *             self.last_error = entry
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef _buildParseException(self, exctype, default_message):
 *         code = xmlerror.XML_ERR_INTERNAL_ERROR
*/

static PyObject *__pyx_f_4lxml_5etree_13_BaseErrorLog__buildParseException(struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_self, PyObject *__pyx_v_exctype, PyObject *__pyx_v_default_message) {
  int __pyx_v_code;
  PyObject *__pyx_v_message = NULL;
  long __pyx_v_line;
  int __pyx_v_column;
  PyObject *__pyx_v_filename = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  int __pyx_t_7;
  long __pyx_t_8;
  PyObject *__pyx_t_9[5];
  PyObject *__pyx_t_10[3];
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_buildParseException", 0);

  /* "src/lxml/xmlerror.pxi":242
 *     @cython.final
 *     cdef _buildParseException(self, exctype, default_message):
 *         code = xmlerror.XML_ERR_INTERNAL_ERROR             # <<<<<<<<<<<<<<
 *         if self._first_error is None:
 *             return exctype(default_message, code, 0, 0)
*/
  __pyx_v_code = XML_ERR_INTERNAL_ERROR;

  /* "src/lxml/xmlerror.pxi":243
 *     cdef _buildParseException(self, exctype, default_message):
 *         code = xmlerror.XML_ERR_INTERNAL_ERROR
 *         if self._first_error is None:             # <<<<<<<<<<<<<<
 *             return exctype(default_message, code, 0, 0)
 *         message = self._first_error.message
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_self->_first_error) == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/xmlerror.pxi":244
 *         code = xmlerror.XML_ERR_INTERNAL_ERROR
 *         if self._first_error is None:
 *             return exctype(default_message, code, 0, 0)             # <<<<<<<<<<<<<<
 *         message = self._first_error.message
 *         if message:
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_v_exctype);
    __pyx_t_4 = __pyx_v_exctype; 
    __pyx_t_5 = __Pyx_PyLong_From_int(__pyx_v_code); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 244, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
      __pyx_t_6 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[5] = {__pyx_t_3, __pyx_v_default_message, __pyx_t_5, __pyx_mstate_global->__pyx_int_0, __pyx_mstate_global->__pyx_int_0};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_6, (5-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 244, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "src/lxml/xmlerror.pxi":243
 *     cdef _buildParseException(self, exctype, default_message):
 *         code = xmlerror.XML_ERR_INTERNAL_ERROR
 *         if self._first_error is None:             # <<<<<<<<<<<<<<
 *             return exctype(default_message, code, 0, 0)
 *         message = self._first_error.message
*/
  }

  /* "src/lxml/xmlerror.pxi":245
 *         if self._first_error is None:
 *             return exctype(default_message, code, 0, 0)
 *         message = self._first_error.message             # <<<<<<<<<<<<<<
 *         if message:
 *             code = self._first_error.type
*/
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_first_error), __pyx_mstate_global->__pyx_n_u_message); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 245, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_message = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "src/lxml/xmlerror.pxi":246
 *             return exctype(default_message, code, 0, 0)
 *         message = self._first_error.message
 *         if message:             # <<<<<<<<<<<<<<
 *             code = self._first_error.type
 *         else:
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_message); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 246, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/xmlerror.pxi":247
 *         message = self._first_error.message
 *         if message:
 *             code = self._first_error.type             # <<<<<<<<<<<<<<
 *         else:
 *             message = default_message
*/
    __pyx_t_7 = __pyx_v_self->_first_error->type;
    __pyx_v_code = __pyx_t_7;

    /* "src/lxml/xmlerror.pxi":246
 *             return exctype(default_message, code, 0, 0)
 *         message = self._first_error.message
 *         if message:             # <<<<<<<<<<<<<<
 *             code = self._first_error.type
 *         else:
*/
    goto __pyx_L4;
  }

  /* "src/lxml/xmlerror.pxi":249
 *             code = self._first_error.type
 *         else:
 *             message = default_message             # <<<<<<<<<<<<<<
 *         line = self._first_error.line
 *         column = self._first_error.column
*/
  /*else*/ {
    __Pyx_INCREF(__pyx_v_default_message);
    __Pyx_DECREF_SET(__pyx_v_message, __pyx_v_default_message);
  }
  __pyx_L4:;

  /* "src/lxml/xmlerror.pxi":250
 *         else:
 *             message = default_message
 *         line = self._first_error.line             # <<<<<<<<<<<<<<
 *         column = self._first_error.column
 *         filename = self._first_error.filename
*/
  __pyx_t_8 = __pyx_v_self->_first_error->line;
  __pyx_v_line = __pyx_t_8;

  /* "src/lxml/xmlerror.pxi":251
 *             message = default_message
 *         line = self._first_error.line
 *         column = self._first_error.column             # <<<<<<<<<<<<<<
 *         filename = self._first_error.filename
 *         if line > 0:
*/
  __pyx_t_7 = __pyx_v_self->_first_error->column;
  __pyx_v_column = __pyx_t_7;

  /* "src/lxml/xmlerror.pxi":252
 *         line = self._first_error.line
 *         column = self._first_error.column
 *         filename = self._first_error.filename             # <<<<<<<<<<<<<<
 *         if line > 0:
 *             if column > 0:
*/
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_first_error), __pyx_mstate_global->__pyx_n_u_filename); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 252, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_filename = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "src/lxml/xmlerror.pxi":253
 *         column = self._first_error.column
 *         filename = self._first_error.filename
 *         if line > 0:             # <<<<<<<<<<<<<<
 *             if column > 0:
 *                 message = f"{message}, line {line}, column {column}"
*/
  __pyx_t_1 = (__pyx_v_line > 0);
  if (__pyx_t_1) {

    /* "src/lxml/xmlerror.pxi":254
 *         filename = self._first_error.filename
 *         if line > 0:
 *             if column > 0:             # <<<<<<<<<<<<<<
 *                 message = f"{message}, line {line}, column {column}"
 *             else:
*/
    __pyx_t_1 = (__pyx_v_column > 0);
    if (__pyx_t_1) {

      /* "src/lxml/xmlerror.pxi":255
 *         if line > 0:
 *             if column > 0:
 *                 message = f"{message}, line {line}, column {column}"             # <<<<<<<<<<<<<<
 *             else:
 *                 message = f"{message}, line {line}"
*/
      __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_v_message, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 255, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = __Pyx_PyUnicode_From_long(__pyx_v_line, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 255, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyUnicode_From_int(__pyx_v_column, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 255, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_9[0] = __pyx_t_2;
      __pyx_t_9[1] = __pyx_mstate_global->__pyx_kp_u_line;
      __pyx_t_9[2] = __pyx_t_4;
      __pyx_t_9[3] = __pyx_mstate_global->__pyx_kp_u_column;
      __pyx_t_9[4] = __pyx_t_5;
      __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_9, 5, __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 7 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4) + 9 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2));
      if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 255, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF_SET(__pyx_v_message, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "src/lxml/xmlerror.pxi":254
 *         filename = self._first_error.filename
 *         if line > 0:
 *             if column > 0:             # <<<<<<<<<<<<<<
 *                 message = f"{message}, line {line}, column {column}"
 *             else:
*/
      goto __pyx_L6;
    }

    /* "src/lxml/xmlerror.pxi":257
 *                 message = f"{message}, line {line}, column {column}"
 *             else:
 *                 message = f"{message}, line {line}"             # <<<<<<<<<<<<<<
 *         return exctype(message, code, line, column, filename)
 * 
*/
    /*else*/ {
      __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_v_message, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 257, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = __Pyx_PyUnicode_From_long(__pyx_v_line, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 257, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_10[0] = __pyx_t_3;
      __pyx_t_10[1] = __pyx_mstate_global->__pyx_kp_u_line;
      __pyx_t_10[2] = __pyx_t_5;
      __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_10, 3, __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 7 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3));
      if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 257, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF_SET(__pyx_v_message, __pyx_t_4);
      __pyx_t_4 = 0;
    }
    __pyx_L6:;

    /* "src/lxml/xmlerror.pxi":253
 *         column = self._first_error.column
 *         filename = self._first_error.filename
 *         if line > 0:             # <<<<<<<<<<<<<<
 *             if column > 0:
 *                 message = f"{message}, line {line}, column {column}"
*/
  }

  /* "src/lxml/xmlerror.pxi":258
 *             else:
 *                 message = f"{message}, line {line}"
 *         return exctype(message, code, line, column, filename)             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = NULL;
  __Pyx_INCREF(__pyx_v_exctype);
  __pyx_t_3 = __pyx_v_exctype; 
  __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_v_code); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 258, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_11 = __Pyx_PyLong_From_long(__pyx_v_line); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 258, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_12 = __Pyx_PyLong_From_int(__pyx_v_column); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 258, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_6 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_5);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_6 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[6] = {__pyx_t_5, __pyx_v_message, __pyx_t_2, __pyx_t_11, __pyx_t_12, __pyx_v_filename};
    __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_6, (6-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 258, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "src/lxml/xmlerror.pxi":240
 *             self.last_error = entry
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef _buildParseException(self, exctype, default_message):
 *         code = xmlerror.XML_ERR_INTERNAL_ERROR
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("lxml.etree._BaseErrorLog._buildParseException", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_message);
  __Pyx_XDECREF(__pyx_v_filename);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":260
 *         return exctype(message, code, line, column, filename)
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef _buildExceptionMessage(self, default_message):
 *         if self._first_error is None:
*/

static PyObject *__pyx_f_4lxml_5etree_13_BaseErrorLog__buildExceptionMessage(struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_self, PyObject *__pyx_v_default_message) {
  PyObject *__pyx_v_message = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5[5];
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7[3];
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_buildExceptionMessage", 0);

  /* "src/lxml/xmlerror.pxi":262
 *     @cython.final
 *     cdef _buildExceptionMessage(self, default_message):
 *         if self._first_error is None:             # <<<<<<<<<<<<<<
 *             return default_message
 *         if self._first_error.message:
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_self->_first_error) == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/xmlerror.pxi":263
 *     cdef _buildExceptionMessage(self, default_message):
 *         if self._first_error is None:
 *             return default_message             # <<<<<<<<<<<<<<
 *         if self._first_error.message:
 *             message = self._first_error.message
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_default_message);
    __pyx_r = __pyx_v_default_message;
    goto __pyx_L0;

    /* "src/lxml/xmlerror.pxi":262
 *     @cython.final
 *     cdef _buildExceptionMessage(self, default_message):
 *         if self._first_error is None:             # <<<<<<<<<<<<<<
 *             return default_message
 *         if self._first_error.message:
*/
  }

  /* "src/lxml/xmlerror.pxi":264
 *         if self._first_error is None:
 *             return default_message
 *         if self._first_error.message:             # <<<<<<<<<<<<<<
 *             message = self._first_error.message
 *         elif default_message is None:
*/
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_first_error), __pyx_mstate_global->__pyx_n_u_message); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 264, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 264, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_1) {

    /* "src/lxml/xmlerror.pxi":265
 *             return default_message
 *         if self._first_error.message:
 *             message = self._first_error.message             # <<<<<<<<<<<<<<
 *         elif default_message is None:
 *             return None
*/
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_first_error), __pyx_mstate_global->__pyx_n_u_message); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 265, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_message = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "src/lxml/xmlerror.pxi":264
 *         if self._first_error is None:
 *             return default_message
 *         if self._first_error.message:             # <<<<<<<<<<<<<<
 *             message = self._first_error.message
 *         elif default_message is None:
*/
    goto __pyx_L4;
  }

  /* "src/lxml/xmlerror.pxi":266
 *         if self._first_error.message:
 *             message = self._first_error.message
 *         elif default_message is None:             # <<<<<<<<<<<<<<
 *             return None
 *         else:
*/
  __pyx_t_1 = (__pyx_v_default_message == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/xmlerror.pxi":267
 *             message = self._first_error.message
 *         elif default_message is None:
 *             return None             # <<<<<<<<<<<<<<
 *         else:
 *             message = default_message
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/xmlerror.pxi":266
 *         if self._first_error.message:
 *             message = self._first_error.message
 *         elif default_message is None:             # <<<<<<<<<<<<<<
 *             return None
 *         else:
*/
  }

  /* "src/lxml/xmlerror.pxi":269
 *             return None
 *         else:
 *             message = default_message             # <<<<<<<<<<<<<<
 *         if self._first_error.line > 0:
 *             if self._first_error.column > 0:
*/
  /*else*/ {
    __Pyx_INCREF(__pyx_v_default_message);
    __pyx_v_message = __pyx_v_default_message;
  }
  __pyx_L4:;

  /* "src/lxml/xmlerror.pxi":270
 *         else:
 *             message = default_message
 *         if self._first_error.line > 0:             # <<<<<<<<<<<<<<
 *             if self._first_error.column > 0:
 *                 message = f"{message}, line {self._first_error.line}, column {self._first_error.column}"
*/
  __pyx_t_1 = (__pyx_v_self->_first_error->line > 0);
  if (__pyx_t_1) {

    /* "src/lxml/xmlerror.pxi":271
 *             message = default_message
 *         if self._first_error.line > 0:
 *             if self._first_error.column > 0:             # <<<<<<<<<<<<<<
 *                 message = f"{message}, line {self._first_error.line}, column {self._first_error.column}"
 *             else:
*/
    __pyx_t_1 = (__pyx_v_self->_first_error->column > 0);
    if (__pyx_t_1) {

      /* "src/lxml/xmlerror.pxi":272
 *         if self._first_error.line > 0:
 *             if self._first_error.column > 0:
 *                 message = f"{message}, line {self._first_error.line}, column {self._first_error.column}"             # <<<<<<<<<<<<<<
 *             else:
 *                 message = f"{message}, line {self._first_error.line}"
*/
      __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_v_message, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 272, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyUnicode_From_long(__pyx_v_self->_first_error->line, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 272, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyUnicode_From_int(__pyx_v_self->_first_error->column, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 272, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5[0] = __pyx_t_2;
      __pyx_t_5[1] = __pyx_mstate_global->__pyx_kp_u_line;
      __pyx_t_5[2] = __pyx_t_3;
      __pyx_t_5[3] = __pyx_mstate_global->__pyx_kp_u_column;
      __pyx_t_5[4] = __pyx_t_4;
      __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_5, 5, __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 7 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 9 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2));
      if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 272, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF_SET(__pyx_v_message, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "src/lxml/xmlerror.pxi":271
 *             message = default_message
 *         if self._first_error.line > 0:
 *             if self._first_error.column > 0:             # <<<<<<<<<<<<<<
 *                 message = f"{message}, line {self._first_error.line}, column {self._first_error.column}"
 *             else:
*/
      goto __pyx_L6;
    }

    /* "src/lxml/xmlerror.pxi":274
 *                 message = f"{message}, line {self._first_error.line}, column {self._first_error.column}"
 *             else:
 *                 message = f"{message}, line {self._first_error.line}"             # <<<<<<<<<<<<<<
 *         return message
 * 
*/
    /*else*/ {
      __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_v_message, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 274, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_4 = __Pyx_PyUnicode_From_long(__pyx_v_self->_first_error->line, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 274, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_7[0] = __pyx_t_6;
      __pyx_t_7[1] = __pyx_mstate_global->__pyx_kp_u_line;
      __pyx_t_7[2] = __pyx_t_4;
      __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_7, 3, __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6) + 7 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6));
      if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 274, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF_SET(__pyx_v_message, __pyx_t_3);
      __pyx_t_3 = 0;
    }
    __pyx_L6:;

    /* "src/lxml/xmlerror.pxi":270
 *         else:
 *             message = default_message
 *         if self._first_error.line > 0:             # <<<<<<<<<<<<<<
 *             if self._first_error.column > 0:
 *                 message = f"{message}, line {self._first_error.line}, column {self._first_error.column}"
*/
  }

  /* "src/lxml/xmlerror.pxi":275
 *             else:
 *                 message = f"{message}, line {self._first_error.line}"
 *         return message             # <<<<<<<<<<<<<<
 * 
 * cdef class _ListErrorLog(_BaseErrorLog):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_message);
  __pyx_r = __pyx_v_message;
  goto __pyx_L0;

  /* "src/lxml/xmlerror.pxi":260
 *         return exctype(message, code, line, column, filename)
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef _buildExceptionMessage(self, default_message):
 *         if self._first_error is None:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._BaseErrorLog._buildExceptionMessage", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_message);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":189
 * cdef class _BaseErrorLog:
 *     cdef _LogEntry _first_error
 *     cdef readonly object last_error             # <<<<<<<<<<<<<<
 *     def __init__(self, first_error, last_error):
 *         self._first_error = first_error
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_13_BaseErrorLog_10last_error_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_13_BaseErrorLog_10last_error_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_13_BaseErrorLog_10last_error___get__(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_13_BaseErrorLog_10last_error___get__(struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->last_error);
  __pyx_r = __pyx_v_self->last_error;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":281
 *     cdef list _entries
 *     cdef int _offset
 *     def __init__(self, entries, first_error, last_error):             # <<<<<<<<<<<<<<
 *         if entries:
 *             if first_error is None:
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_13_ListErrorLog_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_13_ListErrorLog_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_entries = 0;
  PyObject *__pyx_v_first_error = 0;
  PyObject *__pyx_v_last_error = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_entries,&__pyx_mstate_global->__pyx_n_u_first_error,&__pyx_mstate_global->__pyx_n_u_last_error,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 281, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 281, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 281, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 281, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(1, 281, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, i); __PYX_ERR(1, 281, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 281, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 281, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 281, __pyx_L3_error)
    }
    __pyx_v_entries = values[0];
    __pyx_v_first_error = values[1];
    __pyx_v_last_error = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, __pyx_nargs); __PYX_ERR(1, 281, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._ListErrorLog.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_13_ListErrorLog___init__(((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self), __pyx_v_entries, __pyx_v_first_error, __pyx_v_last_error);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_13_ListErrorLog___init__(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self, PyObject *__pyx_v_entries, PyObject *__pyx_v_first_error, PyObject *__pyx_v_last_error) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_INCREF(__pyx_v_first_error);
  __Pyx_INCREF(__pyx_v_last_error);

  /* "src/lxml/xmlerror.pxi":282
 *     cdef int _offset
 *     def __init__(self, entries, first_error, last_error):
 *         if entries:             # <<<<<<<<<<<<<<
 *             if first_error is None:
 *                 first_error = entries[0]
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_entries); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 282, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/xmlerror.pxi":283
 *     def __init__(self, entries, first_error, last_error):
 *         if entries:
 *             if first_error is None:             # <<<<<<<<<<<<<<
 *                 first_error = entries[0]
 *             if last_error is None:
*/
    __pyx_t_1 = (__pyx_v_first_error == Py_None);
    if (__pyx_t_1) {

      /* "src/lxml/xmlerror.pxi":284
 *         if entries:
 *             if first_error is None:
 *                 first_error = entries[0]             # <<<<<<<<<<<<<<
 *             if last_error is None:
 *                 last_error = entries[-1]
*/
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_entries, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 284, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF_SET(__pyx_v_first_error, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "src/lxml/xmlerror.pxi":283
 *     def __init__(self, entries, first_error, last_error):
 *         if entries:
 *             if first_error is None:             # <<<<<<<<<<<<<<
 *                 first_error = entries[0]
 *             if last_error is None:
*/
    }

    /* "src/lxml/xmlerror.pxi":285
 *             if first_error is None:
 *                 first_error = entries[0]
 *             if last_error is None:             # <<<<<<<<<<<<<<
 *                 last_error = entries[-1]
 *         _BaseErrorLog.__init__(self, first_error, last_error)
*/
    __pyx_t_1 = (__pyx_v_last_error == Py_None);
    if (__pyx_t_1) {

      /* "src/lxml/xmlerror.pxi":286
 *                 first_error = entries[0]
 *             if last_error is None:
 *                 last_error = entries[-1]             # <<<<<<<<<<<<<<
 *         _BaseErrorLog.__init__(self, first_error, last_error)
 *         self._entries = entries
*/
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_entries, -1L, long, 1, __Pyx_PyLong_From_long, 0, 1, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 286, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF_SET(__pyx_v_last_error, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "src/lxml/xmlerror.pxi":285
 *             if first_error is None:
 *                 first_error = entries[0]
 *             if last_error is None:             # <<<<<<<<<<<<<<
 *                 last_error = entries[-1]
 *         _BaseErrorLog.__init__(self, first_error, last_error)
*/
    }

    /* "src/lxml/xmlerror.pxi":282
 *     cdef int _offset
 *     def __init__(self, entries, first_error, last_error):
 *         if entries:             # <<<<<<<<<<<<<<
 *             if first_error is None:
 *                 first_error = entries[0]
*/
  }

  /* "src/lxml/xmlerror.pxi":287
 *             if last_error is None:
 *                 last_error = entries[-1]
 *         _BaseErrorLog.__init__(self, first_error, last_error)             # <<<<<<<<<<<<<<
 *         self._entries = entries
 * 
*/
  __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__BaseErrorLog);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[4] = {__pyx_t_3, ((PyObject *)__pyx_v_self), __pyx_v_first_error, __pyx_v_last_error};
    __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_init, __pyx_callargs+__pyx_t_4, (4-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 287, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/xmlerror.pxi":288
 *                 last_error = entries[-1]
 *         _BaseErrorLog.__init__(self, first_error, last_error)
 *         self._entries = entries             # <<<<<<<<<<<<<<
 * 
 *     cpdef copy(self):
*/
  __pyx_t_2 = __pyx_v_entries;
  __Pyx_INCREF(__pyx_t_2);
  if (!(likely(PyList_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None) || __Pyx_RaiseUnexpectedTypeError("list", __pyx_t_2))) __PYX_ERR(1, 288, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_self->_entries);
  __Pyx_DECREF(__pyx_v_self->_entries);
  __pyx_v_self->_entries = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/xmlerror.pxi":281
 *     cdef list _entries
 *     cdef int _offset
 *     def __init__(self, entries, first_error, last_error):             # <<<<<<<<<<<<<<
 *         if entries:
 *             if first_error is None:
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._ListErrorLog.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_first_error);
  __Pyx_XDECREF(__pyx_v_last_error);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":290
 *         self._entries = entries
 * 
 *     cpdef copy(self):             # <<<<<<<<<<<<<<
 *         """Creates a shallow copy of this error log.  Reuses the list of
 *         entries.
*/

static PyObject *__pyx_pw_4lxml_5etree_13_ListErrorLog_3copy(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_4lxml_5etree_13_ListErrorLog_copy(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self, int __pyx_skip_dispatch) {
  struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_log = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (
  #if !CYTHON_USE_TYPE_SLOTS
  unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ListErrorLog &&
  __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
  #else
  unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
  #endif
  ) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_copy); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 290, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_4lxml_5etree_13_ListErrorLog_3copy)) {
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_3 = NULL;
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_4 = __pyx_t_1; 
        __pyx_t_5 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
          assert(__pyx_t_3);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
          __pyx_t_5 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
          __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 290, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
        }
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "src/lxml/xmlerror.pxi":294
 *         entries.
 *         """
 *         cdef _ListErrorLog log = _ListErrorLog(             # <<<<<<<<<<<<<<
 *             self._entries, self._first_error, self.last_error)
 *         log._offset = self._offset
*/
  __pyx_t_2 = NULL;

  /* "src/lxml/xmlerror.pxi":295
 *         """
 *         cdef _ListErrorLog log = _ListErrorLog(
 *             self._entries, self._first_error, self.last_error)             # <<<<<<<<<<<<<<
 *         log._offset = self._offset
 *         return log
*/
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[4] = {__pyx_t_2, __pyx_v_self->_entries, ((PyObject *)__pyx_v_self->__pyx_base._first_error), __pyx_v_self->__pyx_base.last_error};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ListErrorLog, __pyx_callargs+__pyx_t_5, (4-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 294, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __pyx_v_log = ((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xmlerror.pxi":296
 *         cdef _ListErrorLog log = _ListErrorLog(
 *             self._entries, self._first_error, self.last_error)
 *         log._offset = self._offset             # <<<<<<<<<<<<<<
 *         return log
 * 
*/
  __pyx_t_6 = __pyx_v_self->_offset;
  __pyx_v_log->_offset = __pyx_t_6;

  /* "src/lxml/xmlerror.pxi":297
 *             self._entries, self._first_error, self.last_error)
 *         log._offset = self._offset
 *         return log             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_log);
  __pyx_r = ((PyObject *)__pyx_v_log);
  goto __pyx_L0;

  /* "src/lxml/xmlerror.pxi":290
 *         self._entries = entries
 * 
 *     cpdef copy(self):             # <<<<<<<<<<<<<<
 *         """Creates a shallow copy of this error log.  Reuses the list of
 *         entries.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._ListErrorLog.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_log);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_13_ListErrorLog_3copy(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_13_ListErrorLog_2copy, "Creates a shallow copy of this error log.  Reuses the list of\n        entries.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_13_ListErrorLog_3copy = {"copy", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_13_ListErrorLog_3copy, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_13_ListErrorLog_2copy};
static PyObject *__pyx_pw_4lxml_5etree_13_ListErrorLog_3copy(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("copy", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("copy", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_13_ListErrorLog_2copy(((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_2copy(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree_13_ListErrorLog_copy(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 290, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ListErrorLog.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":299
 *         return log
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         entries = self._entries
 *         if self._offset:
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_13_ListErrorLog_5__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_13_ListErrorLog_5__iter__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_13_ListErrorLog_4__iter__(((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_4__iter__(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self) {
  PyObject *__pyx_v_entries = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "src/lxml/xmlerror.pxi":300
 * 
 *     def __iter__(self):
 *         entries = self._entries             # <<<<<<<<<<<<<<
 *         if self._offset:
 *             entries = islice(entries, self._offset)
*/
  __pyx_t_1 = __pyx_v_self->_entries;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_entries = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "src/lxml/xmlerror.pxi":301
 *     def __iter__(self):
 *         entries = self._entries
 *         if self._offset:             # <<<<<<<<<<<<<<
 *             entries = islice(entries, self._offset)
 *         return iter(entries)
*/
  __pyx_t_2 = (__pyx_v_self->_offset != 0);
  if (__pyx_t_2) {

    /* "src/lxml/xmlerror.pxi":302
 *         entries = self._entries
 *         if self._offset:
 *             entries = islice(entries, self._offset)             # <<<<<<<<<<<<<<
 *         return iter(entries)
 * 
*/
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_v_4lxml_5etree_islice);
    __pyx_t_4 = __pyx_v_4lxml_5etree_islice; 
    __pyx_t_5 = __Pyx_PyLong_From_int(__pyx_v_self->_offset); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 302, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
      __pyx_t_6 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_v_entries, __pyx_t_5};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 302, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF_SET(__pyx_v_entries, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/xmlerror.pxi":301
 *     def __iter__(self):
 *         entries = self._entries
 *         if self._offset:             # <<<<<<<<<<<<<<
 *             entries = islice(entries, self._offset)
 *         return iter(entries)
*/
  }

  /* "src/lxml/xmlerror.pxi":303
 *         if self._offset:
 *             entries = islice(entries, self._offset)
 *         return iter(entries)             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetIter(__pyx_v_entries); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 303, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/xmlerror.pxi":299
 *         return log
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         entries = self._entries
 *         if self._offset:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._ListErrorLog.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_entries);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":305
 *         return iter(entries)
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return '\n'.join([repr(entry) for entry in self])
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_13_ListErrorLog_7__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_13_ListErrorLog_7__repr__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_13_ListErrorLog_6__repr__(((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_6__repr__(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self) {
  PyObject *__pyx_8genexpr3__pyx_v_entry = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "src/lxml/xmlerror.pxi":306
 * 
 *     def __repr__(self):
 *         return '\n'.join([repr(entry) for entry in self])             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, index):
*/
  __Pyx_XDECREF(__pyx_r);
  { /* enter inner scope */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 306, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (likely(PyList_CheckExact(((PyObject *)__pyx_v_self))) || PyTuple_CheckExact(((PyObject *)__pyx_v_self))) {
      __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2);
      __pyx_t_3 = 0;
      __pyx_t_4 = NULL;
    } else {
      __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 306, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 306, __pyx_L5_error)
    }
    for (;;) {
      if (likely(!__pyx_t_4)) {
        if (likely(PyList_CheckExact(__pyx_t_2))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 306, __pyx_L5_error)
            #endif
            if (__pyx_t_3 >= __pyx_temp) break;
          }
          __pyx_t_5 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_3, __Pyx_ReferenceSharing_OwnStrongReference);
          ++__pyx_t_3;
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 306, __pyx_L5_error)
            #endif
            if (__pyx_t_3 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3));
          #else
          __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3);
          #endif
          ++__pyx_t_3;
        }
        if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 306, __pyx_L5_error)
      } else {
        __pyx_t_5 = __pyx_t_4(__pyx_t_2);
        if (unlikely(!__pyx_t_5)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(1, 306, __pyx_L5_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_XDECREF_SET(__pyx_8genexpr3__pyx_v_entry, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_5 = PyObject_Repr(__pyx_8genexpr3__pyx_v_entry); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 306, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 306, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_entry); __pyx_8genexpr3__pyx_v_entry = 0;
    goto __pyx_L9_exit_scope;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_entry); __pyx_8genexpr3__pyx_v_entry = 0;
    goto __pyx_L1_error;
    __pyx_L9_exit_scope:;
  } /* exit inner scope */
  __pyx_t_2 = PyUnicode_Join(__pyx_mstate_global->__pyx_kp_u__12, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 306, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/xmlerror.pxi":305
 *         return iter(entries)
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return '\n'.join([repr(entry) for entry in self])
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._ListErrorLog.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_entry);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":308
 *         return '\n'.join([repr(entry) for entry in self])
 * 
 *     def __getitem__(self, index):             # <<<<<<<<<<<<<<
 *         if self._offset:
 *             index += self._offset
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_13_ListErrorLog_9__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_13_ListErrorLog_9__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_13_ListErrorLog_8__getitem__(((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self), ((PyObject *)__pyx_v_index));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_8__getitem__(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self, PyObject *__pyx_v_index) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);
  __Pyx_INCREF(__pyx_v_index);

  /* "src/lxml/xmlerror.pxi":309
 * 
 *     def __getitem__(self, index):
 *         if self._offset:             # <<<<<<<<<<<<<<
 *             index += self._offset
 *         return self._entries[index]
*/
  __pyx_t_1 = (__pyx_v_self->_offset != 0);
  if (__pyx_t_1) {

    /* "src/lxml/xmlerror.pxi":310
 *     def __getitem__(self, index):
 *         if self._offset:
 *             index += self._offset             # <<<<<<<<<<<<<<
 *         return self._entries[index]
 * 
*/
    __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_v_self->_offset); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 310, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_index, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 310, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/xmlerror.pxi":309
 * 
 *     def __getitem__(self, index):
 *         if self._offset:             # <<<<<<<<<<<<<<
 *             index += self._offset
 *         return self._entries[index]
*/
  }

  /* "src/lxml/xmlerror.pxi":311
 *         if self._offset:
 *             index += self._offset
 *         return self._entries[index]             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(__pyx_v_self->_entries == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 311, __pyx_L1_error)
  }
  __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_self->_entries, __pyx_v_index); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 311, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "src/lxml/xmlerror.pxi":308
 *         return '\n'.join([repr(entry) for entry in self])
 * 
 *     def __getitem__(self, index):             # <<<<<<<<<<<<<<
 *         if self._offset:
 *             index += self._offset
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._ListErrorLog.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_index);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":313
 *         return self._entries[index]
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return len(self._entries) - self._offset
 * 
*/

/* Python wrapper */
static Py_ssize_t __pyx_pw_4lxml_5etree_13_ListErrorLog_11__len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_pw_4lxml_5etree_13_ListErrorLog_11__len__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_13_ListErrorLog_10__len__(((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_ssize_t __pyx_pf_4lxml_5etree_13_ListErrorLog_10__len__(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "src/lxml/xmlerror.pxi":314
 * 
 *     def __len__(self):
 *         return len(self._entries) - self._offset             # <<<<<<<<<<<<<<
 * 
 *     def __contains__(self, error_type):
*/
  __pyx_t_1 = __pyx_v_self->_entries;
  __Pyx_INCREF(__pyx_t_1);
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 314, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyList_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(1, 314, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = (__pyx_t_2 - __pyx_v_self->_offset);
  goto __pyx_L0;

  /* "src/lxml/xmlerror.pxi":313
 *         return self._entries[index]
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return len(self._entries) - self._offset
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ListErrorLog.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":316
 *         return len(self._entries) - self._offset
 * 
 *     def __contains__(self, error_type):             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t i
 *         for i, entry in enumerate(self._entries):
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_13_ListErrorLog_13__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_error_type); /*proto*/
static int __pyx_pw_4lxml_5etree_13_ListErrorLog_13__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_error_type) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_13_ListErrorLog_12__contains__(((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self), ((PyObject *)__pyx_v_error_type));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_13_ListErrorLog_12__contains__(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self, PyObject *__pyx_v_error_type) {
  Py_ssize_t __pyx_v_i;
  PyObject *__pyx_v_entry = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__contains__", 0);

  /* "src/lxml/xmlerror.pxi":318
 *     def __contains__(self, error_type):
 *         cdef Py_ssize_t i
 *         for i, entry in enumerate(self._entries):             # <<<<<<<<<<<<<<
 *             if i < self._offset:
 *                 continue
*/
  __pyx_t_1 = 0;
  __pyx_t_2 = __pyx_v_self->_entries; __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  for (;;) {
    {
      Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
      #if !CYTHON_ASSUME_SAFE_SIZE
      if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 318, __pyx_L1_error)
      #endif
      if (__pyx_t_3 >= __pyx_temp) break;
    }
    __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_3, __Pyx_ReferenceSharing_OwnStrongReference);
    ++__pyx_t_3;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 318, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XDECREF_SET(__pyx_v_entry, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_v_i = __pyx_t_1;
    __pyx_t_1 = (__pyx_t_1 + 1);

    /* "src/lxml/xmlerror.pxi":319
 *         cdef Py_ssize_t i
 *         for i, entry in enumerate(self._entries):
 *             if i < self._offset:             # <<<<<<<<<<<<<<
 *                 continue
 *             if entry.type == error_type:
*/
    __pyx_t_5 = (__pyx_v_i < __pyx_v_self->_offset);
    if (__pyx_t_5) {

      /* "src/lxml/xmlerror.pxi":320
 *         for i, entry in enumerate(self._entries):
 *             if i < self._offset:
 *                 continue             # <<<<<<<<<<<<<<
 *             if entry.type == error_type:
 *                 return True
*/
      goto __pyx_L3_continue;

      /* "src/lxml/xmlerror.pxi":319
 *         cdef Py_ssize_t i
 *         for i, entry in enumerate(self._entries):
 *             if i < self._offset:             # <<<<<<<<<<<<<<
 *                 continue
 *             if entry.type == error_type:
*/
    }

    /* "src/lxml/xmlerror.pxi":321
 *             if i < self._offset:
 *                 continue
 *             if entry.type == error_type:             # <<<<<<<<<<<<<<
 *                 return True
 *         return False
*/
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_entry, __pyx_mstate_global->__pyx_n_u_type); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 321, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, __pyx_v_error_type, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 321, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(1, 321, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (__pyx_t_5) {

      /* "src/lxml/xmlerror.pxi":322
 *                 continue
 *             if entry.type == error_type:
 *                 return True             # <<<<<<<<<<<<<<
 *         return False
 * 
*/
      __pyx_r = 1;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L0;

      /* "src/lxml/xmlerror.pxi":321
 *             if i < self._offset:
 *                 continue
 *             if entry.type == error_type:             # <<<<<<<<<<<<<<
 *                 return True
 *         return False
*/
    }

    /* "src/lxml/xmlerror.pxi":318
 *     def __contains__(self, error_type):
 *         cdef Py_ssize_t i
 *         for i, entry in enumerate(self._entries):             # <<<<<<<<<<<<<<
 *             if i < self._offset:
 *                 continue
*/
    __pyx_L3_continue:;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/xmlerror.pxi":323
 *             if entry.type == error_type:
 *                 return True
 *         return False             # <<<<<<<<<<<<<<
 * 
 *     def __bool__(self):
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/xmlerror.pxi":316
 *         return len(self._entries) - self._offset
 * 
 *     def __contains__(self, error_type):             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t i
 *         for i, entry in enumerate(self._entries):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._ListErrorLog.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_entry);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":325
 *         return False
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return len(self._entries) > self._offset
 * 
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_13_ListErrorLog_15__bool__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_4lxml_5etree_13_ListErrorLog_15__bool__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_13_ListErrorLog_14__bool__(((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_13_ListErrorLog_14__bool__(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__bool__", 0);

  /* "src/lxml/xmlerror.pxi":326
 * 
 *     def __bool__(self):
 *         return len(self._entries) > self._offset             # <<<<<<<<<<<<<<
 * 
 *     def filter_domains(self, domains):
*/
  __pyx_t_1 = __pyx_v_self->_entries;
  __Pyx_INCREF(__pyx_t_1);
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 326, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyList_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(1, 326, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = (__pyx_t_2 > __pyx_v_self->_offset);
  goto __pyx_L0;

  /* "src/lxml/xmlerror.pxi":325
 *         return False
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return len(self._entries) > self._offset
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ListErrorLog.__bool__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":328
 *         return len(self._entries) > self._offset
 * 
 *     def filter_domains(self, domains):             # <<<<<<<<<<<<<<
 *         """Filter the errors by the given domains and return a new error log
 *         containing the matches.
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_13_ListErrorLog_17filter_domains(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_13_ListErrorLog_16filter_domains, "Filter the errors by the given domains and return a new error log\n        containing the matches.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_13_ListErrorLog_17filter_domains = {"filter_domains", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_13_ListErrorLog_17filter_domains, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_13_ListErrorLog_16filter_domains};
static PyObject *__pyx_pw_4lxml_5etree_13_ListErrorLog_17filter_domains(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_domains = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("filter_domains (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_domains,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 328, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 328, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "filter_domains", 0) < (0)) __PYX_ERR(1, 328, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("filter_domains", 1, 1, 1, i); __PYX_ERR(1, 328, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 328, __pyx_L3_error)
    }
    __pyx_v_domains = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("filter_domains", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 328, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._ListErrorLog.filter_domains", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_13_ListErrorLog_16filter_domains(((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self), __pyx_v_domains);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_16filter_domains(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self, PyObject *__pyx_v_domains) {
  PyObject *__pyx_v_filtered = NULL;
  struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_8genexpr4__pyx_v_entry = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  size_t __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("filter_domains", 0);
  __Pyx_INCREF(__pyx_v_domains);

  /* "src/lxml/xmlerror.pxi":333
 *         """
 *         cdef _LogEntry entry
 *         if isinstance(domains, int):             # <<<<<<<<<<<<<<
 *             domains = (domains,)
 *         filtered = [entry for entry in self if entry.domain in domains]
*/
  __pyx_t_1 = PyLong_Check(__pyx_v_domains); 
  if (__pyx_t_1) {

    /* "src/lxml/xmlerror.pxi":334
 *         cdef _LogEntry entry
 *         if isinstance(domains, int):
 *             domains = (domains,)             # <<<<<<<<<<<<<<
 *         filtered = [entry for entry in self if entry.domain in domains]
 *         return _ListErrorLog(filtered, None, None)
*/
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 334, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_domains);
    __Pyx_GIVEREF(__pyx_v_domains);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_domains) != (0)) __PYX_ERR(1, 334, __pyx_L1_error);
    __Pyx_DECREF_SET(__pyx_v_domains, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/xmlerror.pxi":333
 *         """
 *         cdef _LogEntry entry
 *         if isinstance(domains, int):             # <<<<<<<<<<<<<<
 *             domains = (domains,)
 *         filtered = [entry for entry in self if entry.domain in domains]
*/
  }

  /* "src/lxml/xmlerror.pxi":335
 *         if isinstance(domains, int):
 *             domains = (domains,)
 *         filtered = [entry for entry in self if entry.domain in domains]             # <<<<<<<<<<<<<<
 *         return _ListErrorLog(filtered, None, None)
 * 
*/
  { /* enter inner scope */
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 335, __pyx_L6_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (likely(PyList_CheckExact(((PyObject *)__pyx_v_self))) || PyTuple_CheckExact(((PyObject *)__pyx_v_self))) {
      __pyx_t_3 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_3);
      __pyx_t_4 = 0;
      __pyx_t_5 = NULL;
    } else {
      __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 335, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 335, __pyx_L6_error)
    }
    for (;;) {
      if (likely(!__pyx_t_5)) {
        if (likely(PyList_CheckExact(__pyx_t_3))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 335, __pyx_L6_error)
            #endif
            if (__pyx_t_4 >= __pyx_temp) break;
          }
          __pyx_t_6 = __Pyx_PyList_GetItemRefFast(__pyx_t_3, __pyx_t_4, __Pyx_ReferenceSharing_OwnStrongReference);
          ++__pyx_t_4;
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 335, __pyx_L6_error)
            #endif
            if (__pyx_t_4 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_6 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4));
          #else
          __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_4);
          #endif
          ++__pyx_t_4;
        }
        if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 335, __pyx_L6_error)
      } else {
        __pyx_t_6 = __pyx_t_5(__pyx_t_3);
        if (unlikely(!__pyx_t_6)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(1, 335, __pyx_L6_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_6);
      if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__LogEntry))))) __PYX_ERR(1, 335, __pyx_L6_error)
      __Pyx_XDECREF_SET(__pyx_8genexpr4__pyx_v_entry, ((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_t_6));
      __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyLong_From_int(__pyx_8genexpr4__pyx_v_entry->domain); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 335, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_t_6, __pyx_v_domains, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 335, __pyx_L6_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (__pyx_t_1) {
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_8genexpr4__pyx_v_entry))) __PYX_ERR(1, 335, __pyx_L6_error)
      }
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF((PyObject *)__pyx_8genexpr4__pyx_v_entry); __pyx_8genexpr4__pyx_v_entry = 0;
    goto __pyx_L11_exit_scope;
    __pyx_L6_error:;
    __Pyx_XDECREF((PyObject *)__pyx_8genexpr4__pyx_v_entry); __pyx_8genexpr4__pyx_v_entry = 0;
    goto __pyx_L1_error;
    __pyx_L11_exit_scope:;
  } /* exit inner scope */
  __pyx_v_filtered = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/xmlerror.pxi":336
 *             domains = (domains,)
 *         filtered = [entry for entry in self if entry.domain in domains]
 *         return _ListErrorLog(filtered, None, None)             # <<<<<<<<<<<<<<
 * 
 *     def filter_types(self, types):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = NULL;
  __pyx_t_7 = 1;
  {
    PyObject *__pyx_callargs[4] = {__pyx_t_3, __pyx_v_filtered, Py_None, Py_None};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ListErrorLog, __pyx_callargs+__pyx_t_7, (4-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 336, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_2);
  }
  __pyx_r = ((PyObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/xmlerror.pxi":328
 *         return len(self._entries) > self._offset
 * 
 *     def filter_domains(self, domains):             # <<<<<<<<<<<<<<
 *         """Filter the errors by the given domains and return a new error log
 *         containing the matches.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._ListErrorLog.filter_domains", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_filtered);
  __Pyx_XDECREF((PyObject *)__pyx_8genexpr4__pyx_v_entry);
  __Pyx_XDECREF(__pyx_v_domains);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":338
 *         return _ListErrorLog(filtered, None, None)
 * 
 *     def filter_types(self, types):             # <<<<<<<<<<<<<<
 *         """filter_types(self, types)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_13_ListErrorLog_19filter_types(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_13_ListErrorLog_18filter_types, "filter_types(self, types)\n\n        Filter the errors by the given types and return a new error\n        log containing the matches.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_13_ListErrorLog_19filter_types = {"filter_types", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_13_ListErrorLog_19filter_types, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_13_ListErrorLog_18filter_types};
static PyObject *__pyx_pw_4lxml_5etree_13_ListErrorLog_19filter_types(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_types = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("filter_types (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_types,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 338, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 338, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "filter_types", 0) < (0)) __PYX_ERR(1, 338, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("filter_types", 1, 1, 1, i); __PYX_ERR(1, 338, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 338, __pyx_L3_error)
    }
    __pyx_v_types = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("filter_types", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 338, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._ListErrorLog.filter_types", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_13_ListErrorLog_18filter_types(((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self), __pyx_v_types);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_18filter_types(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self, PyObject *__pyx_v_types) {
  PyObject *__pyx_v_filtered = NULL;
  struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_8genexpr5__pyx_v_entry = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  size_t __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("filter_types", 0);
  __Pyx_INCREF(__pyx_v_types);

  /* "src/lxml/xmlerror.pxi":345
 *         """
 *         cdef _LogEntry entry
 *         if isinstance(types, int):             # <<<<<<<<<<<<<<
 *             types = (types,)
 *         filtered = [entry for entry in self if entry.type in types]
*/
  __pyx_t_1 = PyLong_Check(__pyx_v_types); 
  if (__pyx_t_1) {

    /* "src/lxml/xmlerror.pxi":346
 *         cdef _LogEntry entry
 *         if isinstance(types, int):
 *             types = (types,)             # <<<<<<<<<<<<<<
 *         filtered = [entry for entry in self if entry.type in types]
 *         return _ListErrorLog(filtered, None, None)
*/
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 346, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_types);
    __Pyx_GIVEREF(__pyx_v_types);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_types) != (0)) __PYX_ERR(1, 346, __pyx_L1_error);
    __Pyx_DECREF_SET(__pyx_v_types, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/xmlerror.pxi":345
 *         """
 *         cdef _LogEntry entry
 *         if isinstance(types, int):             # <<<<<<<<<<<<<<
 *             types = (types,)
 *         filtered = [entry for entry in self if entry.type in types]
*/
  }

  /* "src/lxml/xmlerror.pxi":347
 *         if isinstance(types, int):
 *             types = (types,)
 *         filtered = [entry for entry in self if entry.type in types]             # <<<<<<<<<<<<<<
 *         return _ListErrorLog(filtered, None, None)
 * 
*/
  { /* enter inner scope */
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 347, __pyx_L6_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (likely(PyList_CheckExact(((PyObject *)__pyx_v_self))) || PyTuple_CheckExact(((PyObject *)__pyx_v_self))) {
      __pyx_t_3 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_3);
      __pyx_t_4 = 0;
      __pyx_t_5 = NULL;
    } else {
      __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 347, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 347, __pyx_L6_error)
    }
    for (;;) {
      if (likely(!__pyx_t_5)) {
        if (likely(PyList_CheckExact(__pyx_t_3))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 347, __pyx_L6_error)
            #endif
            if (__pyx_t_4 >= __pyx_temp) break;
          }
          __pyx_t_6 = __Pyx_PyList_GetItemRefFast(__pyx_t_3, __pyx_t_4, __Pyx_ReferenceSharing_OwnStrongReference);
          ++__pyx_t_4;
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 347, __pyx_L6_error)
            #endif
            if (__pyx_t_4 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_6 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4));
          #else
          __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_4);
          #endif
          ++__pyx_t_4;
        }
        if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 347, __pyx_L6_error)
      } else {
        __pyx_t_6 = __pyx_t_5(__pyx_t_3);
        if (unlikely(!__pyx_t_6)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(1, 347, __pyx_L6_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_6);
      if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__LogEntry))))) __PYX_ERR(1, 347, __pyx_L6_error)
      __Pyx_XDECREF_SET(__pyx_8genexpr5__pyx_v_entry, ((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_t_6));
      __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyLong_From_int(__pyx_8genexpr5__pyx_v_entry->type); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 347, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_t_6, __pyx_v_types, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 347, __pyx_L6_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (__pyx_t_1) {
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_8genexpr5__pyx_v_entry))) __PYX_ERR(1, 347, __pyx_L6_error)
      }
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF((PyObject *)__pyx_8genexpr5__pyx_v_entry); __pyx_8genexpr5__pyx_v_entry = 0;
    goto __pyx_L11_exit_scope;
    __pyx_L6_error:;
    __Pyx_XDECREF((PyObject *)__pyx_8genexpr5__pyx_v_entry); __pyx_8genexpr5__pyx_v_entry = 0;
    goto __pyx_L1_error;
    __pyx_L11_exit_scope:;
  } /* exit inner scope */
  __pyx_v_filtered = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/xmlerror.pxi":348
 *             types = (types,)
 *         filtered = [entry for entry in self if entry.type in types]
 *         return _ListErrorLog(filtered, None, None)             # <<<<<<<<<<<<<<
 * 
 *     def filter_levels(self, levels):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = NULL;
  __pyx_t_7 = 1;
  {
    PyObject *__pyx_callargs[4] = {__pyx_t_3, __pyx_v_filtered, Py_None, Py_None};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ListErrorLog, __pyx_callargs+__pyx_t_7, (4-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 348, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_2);
  }
  __pyx_r = ((PyObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/xmlerror.pxi":338
 *         return _ListErrorLog(filtered, None, None)
 * 
 *     def filter_types(self, types):             # <<<<<<<<<<<<<<
 *         """filter_types(self, types)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._ListErrorLog.filter_types", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_filtered);
  __Pyx_XDECREF((PyObject *)__pyx_8genexpr5__pyx_v_entry);
  __Pyx_XDECREF(__pyx_v_types);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":350
 *         return _ListErrorLog(filtered, None, None)
 * 
 *     def filter_levels(self, levels):             # <<<<<<<<<<<<<<
 *         """filter_levels(self, levels)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_13_ListErrorLog_21filter_levels(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_13_ListErrorLog_20filter_levels, "filter_levels(self, levels)\n\n        Filter the errors by the given error levels and return a new\n        error log containing the matches.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_13_ListErrorLog_21filter_levels = {"filter_levels", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_13_ListErrorLog_21filter_levels, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_13_ListErrorLog_20filter_levels};
static PyObject *__pyx_pw_4lxml_5etree_13_ListErrorLog_21filter_levels(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_levels = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("filter_levels (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_levels,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 350, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 350, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "filter_levels", 0) < (0)) __PYX_ERR(1, 350, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("filter_levels", 1, 1, 1, i); __PYX_ERR(1, 350, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 350, __pyx_L3_error)
    }
    __pyx_v_levels = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("filter_levels", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 350, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._ListErrorLog.filter_levels", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_13_ListErrorLog_20filter_levels(((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self), __pyx_v_levels);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_20filter_levels(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self, PyObject *__pyx_v_levels) {
  PyObject *__pyx_v_filtered = NULL;
  struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_8genexpr6__pyx_v_entry = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  size_t __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("filter_levels", 0);
  __Pyx_INCREF(__pyx_v_levels);

  /* "src/lxml/xmlerror.pxi":357
 *         """
 *         cdef _LogEntry entry
 *         if isinstance(levels, int):             # <<<<<<<<<<<<<<
 *             levels = (levels,)
 *         filtered = [entry for entry in self if entry.level in levels]
*/
  __pyx_t_1 = PyLong_Check(__pyx_v_levels); 
  if (__pyx_t_1) {

    /* "src/lxml/xmlerror.pxi":358
 *         cdef _LogEntry entry
 *         if isinstance(levels, int):
 *             levels = (levels,)             # <<<<<<<<<<<<<<
 *         filtered = [entry for entry in self if entry.level in levels]
 *         return _ListErrorLog(filtered, None, None)
*/
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 358, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_levels);
    __Pyx_GIVEREF(__pyx_v_levels);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_levels) != (0)) __PYX_ERR(1, 358, __pyx_L1_error);
    __Pyx_DECREF_SET(__pyx_v_levels, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/xmlerror.pxi":357
 *         """
 *         cdef _LogEntry entry
 *         if isinstance(levels, int):             # <<<<<<<<<<<<<<
 *             levels = (levels,)
 *         filtered = [entry for entry in self if entry.level in levels]
*/
  }

  /* "src/lxml/xmlerror.pxi":359
 *         if isinstance(levels, int):
 *             levels = (levels,)
 *         filtered = [entry for entry in self if entry.level in levels]             # <<<<<<<<<<<<<<
 *         return _ListErrorLog(filtered, None, None)
 * 
*/
  { /* enter inner scope */
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 359, __pyx_L6_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (likely(PyList_CheckExact(((PyObject *)__pyx_v_self))) || PyTuple_CheckExact(((PyObject *)__pyx_v_self))) {
      __pyx_t_3 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_3);
      __pyx_t_4 = 0;
      __pyx_t_5 = NULL;
    } else {
      __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 359, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 359, __pyx_L6_error)
    }
    for (;;) {
      if (likely(!__pyx_t_5)) {
        if (likely(PyList_CheckExact(__pyx_t_3))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 359, __pyx_L6_error)
            #endif
            if (__pyx_t_4 >= __pyx_temp) break;
          }
          __pyx_t_6 = __Pyx_PyList_GetItemRefFast(__pyx_t_3, __pyx_t_4, __Pyx_ReferenceSharing_OwnStrongReference);
          ++__pyx_t_4;
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 359, __pyx_L6_error)
            #endif
            if (__pyx_t_4 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_6 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4));
          #else
          __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_4);
          #endif
          ++__pyx_t_4;
        }
        if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 359, __pyx_L6_error)
      } else {
        __pyx_t_6 = __pyx_t_5(__pyx_t_3);
        if (unlikely(!__pyx_t_6)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(1, 359, __pyx_L6_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_6);
      if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__LogEntry))))) __PYX_ERR(1, 359, __pyx_L6_error)
      __Pyx_XDECREF_SET(__pyx_8genexpr6__pyx_v_entry, ((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_t_6));
      __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyLong_From_int(__pyx_8genexpr6__pyx_v_entry->level); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 359, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_t_6, __pyx_v_levels, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 359, __pyx_L6_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (__pyx_t_1) {
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_8genexpr6__pyx_v_entry))) __PYX_ERR(1, 359, __pyx_L6_error)
      }
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF((PyObject *)__pyx_8genexpr6__pyx_v_entry); __pyx_8genexpr6__pyx_v_entry = 0;
    goto __pyx_L11_exit_scope;
    __pyx_L6_error:;
    __Pyx_XDECREF((PyObject *)__pyx_8genexpr6__pyx_v_entry); __pyx_8genexpr6__pyx_v_entry = 0;
    goto __pyx_L1_error;
    __pyx_L11_exit_scope:;
  } /* exit inner scope */
  __pyx_v_filtered = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/xmlerror.pxi":360
 *             levels = (levels,)
 *         filtered = [entry for entry in self if entry.level in levels]
 *         return _ListErrorLog(filtered, None, None)             # <<<<<<<<<<<<<<
 * 
 *     def filter_from_level(self, level):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = NULL;
  __pyx_t_7 = 1;
  {
    PyObject *__pyx_callargs[4] = {__pyx_t_3, __pyx_v_filtered, Py_None, Py_None};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ListErrorLog, __pyx_callargs+__pyx_t_7, (4-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 360, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_2);
  }
  __pyx_r = ((PyObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/xmlerror.pxi":350
 *         return _ListErrorLog(filtered, None, None)
 * 
 *     def filter_levels(self, levels):             # <<<<<<<<<<<<<<
 *         """filter_levels(self, levels)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._ListErrorLog.filter_levels", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_filtered);
  __Pyx_XDECREF((PyObject *)__pyx_8genexpr6__pyx_v_entry);
  __Pyx_XDECREF(__pyx_v_levels);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":362
 *         return _ListErrorLog(filtered, None, None)
 * 
 *     def filter_from_level(self, level):             # <<<<<<<<<<<<<<
 *         """filter_from_level(self, level)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_13_ListErrorLog_23filter_from_level(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_13_ListErrorLog_22filter_from_level, "filter_from_level(self, level)\n\n        Return a log with all messages of the requested level of worse.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_13_ListErrorLog_23filter_from_level = {"filter_from_level", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_13_ListErrorLog_23filter_from_level, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_13_ListErrorLog_22filter_from_level};
static PyObject *__pyx_pw_4lxml_5etree_13_ListErrorLog_23filter_from_level(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_level = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("filter_from_level (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_level,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 362, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 362, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "filter_from_level", 0) < (0)) __PYX_ERR(1, 362, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("filter_from_level", 1, 1, 1, i); __PYX_ERR(1, 362, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 362, __pyx_L3_error)
    }
    __pyx_v_level = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("filter_from_level", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 362, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._ListErrorLog.filter_from_level", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_13_ListErrorLog_22filter_from_level(((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self), __pyx_v_level);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_22filter_from_level(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self, PyObject *__pyx_v_level) {
  PyObject *__pyx_v_filtered = NULL;
  struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_8genexpr7__pyx_v_entry = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  size_t __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("filter_from_level", 0);

  /* "src/lxml/xmlerror.pxi":368
 *         """
 *         cdef _LogEntry entry
 *         filtered = [entry for entry in self if entry.level >= level]             # <<<<<<<<<<<<<<
 *         return _ListErrorLog(filtered, None, None)
 * 
*/
  { /* enter inner scope */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 368, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (likely(PyList_CheckExact(((PyObject *)__pyx_v_self))) || PyTuple_CheckExact(((PyObject *)__pyx_v_self))) {
      __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2);
      __pyx_t_3 = 0;
      __pyx_t_4 = NULL;
    } else {
      __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 368, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 368, __pyx_L5_error)
    }
    for (;;) {
      if (likely(!__pyx_t_4)) {
        if (likely(PyList_CheckExact(__pyx_t_2))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 368, __pyx_L5_error)
            #endif
            if (__pyx_t_3 >= __pyx_temp) break;
          }
          __pyx_t_5 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_3, __Pyx_ReferenceSharing_OwnStrongReference);
          ++__pyx_t_3;
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 368, __pyx_L5_error)
            #endif
            if (__pyx_t_3 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3));
          #else
          __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3);
          #endif
          ++__pyx_t_3;
        }
        if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 368, __pyx_L5_error)
      } else {
        __pyx_t_5 = __pyx_t_4(__pyx_t_2);
        if (unlikely(!__pyx_t_5)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(1, 368, __pyx_L5_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_5);
      if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__LogEntry))))) __PYX_ERR(1, 368, __pyx_L5_error)
      __Pyx_XDECREF_SET(__pyx_8genexpr7__pyx_v_entry, ((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_t_5));
      __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyLong_From_int(__pyx_8genexpr7__pyx_v_entry->level); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 368, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyObject_RichCompare(__pyx_t_5, __pyx_v_level, Py_GE); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 368, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(1, 368, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (__pyx_t_7) {
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_8genexpr7__pyx_v_entry))) __PYX_ERR(1, 368, __pyx_L5_error)
      }
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF((PyObject *)__pyx_8genexpr7__pyx_v_entry); __pyx_8genexpr7__pyx_v_entry = 0;
    goto __pyx_L10_exit_scope;
    __pyx_L5_error:;
    __Pyx_XDECREF((PyObject *)__pyx_8genexpr7__pyx_v_entry); __pyx_8genexpr7__pyx_v_entry = 0;
    goto __pyx_L1_error;
    __pyx_L10_exit_scope:;
  } /* exit inner scope */
  __pyx_v_filtered = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xmlerror.pxi":369
 *         cdef _LogEntry entry
 *         filtered = [entry for entry in self if entry.level >= level]
 *         return _ListErrorLog(filtered, None, None)             # <<<<<<<<<<<<<<
 * 
 *     def filter_from_fatals(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = NULL;
  __pyx_t_8 = 1;
  {
    PyObject *__pyx_callargs[4] = {__pyx_t_2, __pyx_v_filtered, Py_None, Py_None};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ListErrorLog, __pyx_callargs+__pyx_t_8, (4-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 369, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __pyx_r = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/xmlerror.pxi":362
 *         return _ListErrorLog(filtered, None, None)
 * 
 *     def filter_from_level(self, level):             # <<<<<<<<<<<<<<
 *         """filter_from_level(self, level)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._ListErrorLog.filter_from_level", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_filtered);
  __Pyx_XDECREF((PyObject *)__pyx_8genexpr7__pyx_v_entry);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":371
 *         return _ListErrorLog(filtered, None, None)
 * 
 *     def filter_from_fatals(self):             # <<<<<<<<<<<<<<
 *         """filter_from_fatals(self)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_13_ListErrorLog_25filter_from_fatals(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_13_ListErrorLog_24filter_from_fatals, "filter_from_fatals(self)\n\n        Convenience method to get all fatal error messages.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_13_ListErrorLog_25filter_from_fatals = {"filter_from_fatals", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_13_ListErrorLog_25filter_from_fatals, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_13_ListErrorLog_24filter_from_fatals};
static PyObject *__pyx_pw_4lxml_5etree_13_ListErrorLog_25filter_from_fatals(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("filter_from_fatals (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("filter_from_fatals", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("filter_from_fatals", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_13_ListErrorLog_24filter_from_fatals(((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_24filter_from_fatals(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("filter_from_fatals", 0);

  /* "src/lxml/xmlerror.pxi":376
 *         Convenience method to get all fatal error messages.
 *         """
 *         return self.filter_from_level(ErrorLevels.FATAL)             # <<<<<<<<<<<<<<
 * 
 *     def filter_from_errors(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_ErrorLevels); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 376, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_FATAL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 376, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_filter_from_level, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 376, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/xmlerror.pxi":371
 *         return _ListErrorLog(filtered, None, None)
 * 
 *     def filter_from_fatals(self):             # <<<<<<<<<<<<<<
 *         """filter_from_fatals(self)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._ListErrorLog.filter_from_fatals", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":378
 *         return self.filter_from_level(ErrorLevels.FATAL)
 * 
 *     def filter_from_errors(self):             # <<<<<<<<<<<<<<
 *         """filter_from_errors(self)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_13_ListErrorLog_27filter_from_errors(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_13_ListErrorLog_26filter_from_errors, "filter_from_errors(self)\n\n        Convenience method to get all error messages or worse.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_13_ListErrorLog_27filter_from_errors = {"filter_from_errors", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_13_ListErrorLog_27filter_from_errors, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_13_ListErrorLog_26filter_from_errors};
static PyObject *__pyx_pw_4lxml_5etree_13_ListErrorLog_27filter_from_errors(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("filter_from_errors (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("filter_from_errors", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("filter_from_errors", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_13_ListErrorLog_26filter_from_errors(((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_26filter_from_errors(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("filter_from_errors", 0);

  /* "src/lxml/xmlerror.pxi":383
 *         Convenience method to get all error messages or worse.
 *         """
 *         return self.filter_from_level(ErrorLevels.ERROR)             # <<<<<<<<<<<<<<
 * 
 *     def filter_from_warnings(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_ErrorLevels); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 383, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_ERROR); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 383, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_filter_from_level, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 383, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/xmlerror.pxi":378
 *         return self.filter_from_level(ErrorLevels.FATAL)
 * 
 *     def filter_from_errors(self):             # <<<<<<<<<<<<<<
 *         """filter_from_errors(self)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._ListErrorLog.filter_from_errors", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":385
 *         return self.filter_from_level(ErrorLevels.ERROR)
 * 
 *     def filter_from_warnings(self):             # <<<<<<<<<<<<<<
 *         """filter_from_warnings(self)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_13_ListErrorLog_29filter_from_warnings(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_13_ListErrorLog_28filter_from_warnings, "filter_from_warnings(self)\n\n        Convenience method to get all warnings or worse.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_13_ListErrorLog_29filter_from_warnings = {"filter_from_warnings", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_13_ListErrorLog_29filter_from_warnings, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_13_ListErrorLog_28filter_from_warnings};
static PyObject *__pyx_pw_4lxml_5etree_13_ListErrorLog_29filter_from_warnings(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("filter_from_warnings (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("filter_from_warnings", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("filter_from_warnings", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_13_ListErrorLog_28filter_from_warnings(((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_28filter_from_warnings(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("filter_from_warnings", 0);

  /* "src/lxml/xmlerror.pxi":390
 *         Convenience method to get all warnings or worse.
 *         """
 *         return self.filter_from_level(ErrorLevels.WARNING)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_ErrorLevels); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 390, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_WARNING); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 390, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_filter_from_level, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 390, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/xmlerror.pxi":385
 *         return self.filter_from_level(ErrorLevels.ERROR)
 * 
 *     def filter_from_warnings(self):             # <<<<<<<<<<<<<<
 *         """filter_from_warnings(self)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._ListErrorLog.filter_from_warnings", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":407
 *     cdef _BaseErrorLog old_xslt_error_log
 * 
 *     cdef int push_error_log(self, _BaseErrorLog log) except -1:             # <<<<<<<<<<<<<<
 *         self.old_error_func = xmlerror.xmlStructuredError
 *         self.old_error_context = xmlerror.xmlStructuredErrorContext
*/

static int __pyx_f_4lxml_5etree_16_ErrorLogContext_push_error_log(struct __pyx_obj_4lxml_5etree__ErrorLogContext *__pyx_v_self, struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_log) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("push_error_log", 0);

  /* "src/lxml/xmlerror.pxi":408
 * 
 *     cdef int push_error_log(self, _BaseErrorLog log) except -1:
 *         self.old_error_func = xmlerror.xmlStructuredError             # <<<<<<<<<<<<<<
 *         self.old_error_context = xmlerror.xmlStructuredErrorContext
 *         xmlerror.xmlSetStructuredErrorFunc(
*/
  __pyx_v_self->old_error_func = xmlStructuredError;

  /* "src/lxml/xmlerror.pxi":409
 *     cdef int push_error_log(self, _BaseErrorLog log) except -1:
 *         self.old_error_func = xmlerror.xmlStructuredError
 *         self.old_error_context = xmlerror.xmlStructuredErrorContext             # <<<<<<<<<<<<<<
 *         xmlerror.xmlSetStructuredErrorFunc(
 *             <void*>log, <xmlerror.xmlStructuredErrorFunc>_receiveError)
*/
  __pyx_v_self->old_error_context = xmlStructuredErrorContext;

  /* "src/lxml/xmlerror.pxi":410
 *         self.old_error_func = xmlerror.xmlStructuredError
 *         self.old_error_context = xmlerror.xmlStructuredErrorContext
 *         xmlerror.xmlSetStructuredErrorFunc(             # <<<<<<<<<<<<<<
 *             <void*>log, <xmlerror.xmlStructuredErrorFunc>_receiveError)
 * 
*/
  xmlSetStructuredErrorFunc(((void *)__pyx_v_log), ((xmlStructuredErrorFunc)__pyx_f_4lxml_5etree__receiveError));

  /* "src/lxml/xmlerror.pxi":414
 * 
 *         # xslt.xsltSetGenericErrorFunc() is not thread-local => keep error log in TLS
 *         self.old_xslt_error_func = xslt.xsltGenericError             # <<<<<<<<<<<<<<
 *         self.old_xslt_error_context = xslt.xsltGenericErrorContext
 *         self.old_xslt_error_log = _getThreadErrorLog(XSLT_ERROR_LOG)
*/
  __pyx_v_self->old_xslt_error_func = xsltGenericError;

  /* "src/lxml/xmlerror.pxi":415
 *         # xslt.xsltSetGenericErrorFunc() is not thread-local => keep error log in TLS
 *         self.old_xslt_error_func = xslt.xsltGenericError
 *         self.old_xslt_error_context = xslt.xsltGenericErrorContext             # <<<<<<<<<<<<<<
 *         self.old_xslt_error_log = _getThreadErrorLog(XSLT_ERROR_LOG)
 *         _setThreadErrorLog(XSLT_ERROR_LOG, log)
*/
  __pyx_v_self->old_xslt_error_context = xsltGenericErrorContext;

  /* "src/lxml/xmlerror.pxi":416
 *         self.old_xslt_error_func = xslt.xsltGenericError
 *         self.old_xslt_error_context = xslt.xsltGenericErrorContext
 *         self.old_xslt_error_log = _getThreadErrorLog(XSLT_ERROR_LOG)             # <<<<<<<<<<<<<<
 *         _setThreadErrorLog(XSLT_ERROR_LOG, log)
 *         xslt.xsltSetGenericErrorFunc(
*/
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__getThreadErrorLog(__pyx_mstate_global->__pyx_n_u_XSLTErrorLog)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 416, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->old_xslt_error_log);
  __Pyx_DECREF((PyObject *)__pyx_v_self->old_xslt_error_log);
  __pyx_v_self->old_xslt_error_log = ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xmlerror.pxi":417
 *         self.old_xslt_error_context = xslt.xsltGenericErrorContext
 *         self.old_xslt_error_log = _getThreadErrorLog(XSLT_ERROR_LOG)
 *         _setThreadErrorLog(XSLT_ERROR_LOG, log)             # <<<<<<<<<<<<<<
 *         xslt.xsltSetGenericErrorFunc(
 *             NULL, <xmlerror.xmlGenericErrorFunc>_receiveXSLTError)
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__setThreadErrorLog(__pyx_mstate_global->__pyx_n_u_XSLTErrorLog, __pyx_v_log); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 417, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xmlerror.pxi":418
 *         self.old_xslt_error_log = _getThreadErrorLog(XSLT_ERROR_LOG)
 *         _setThreadErrorLog(XSLT_ERROR_LOG, log)
 *         xslt.xsltSetGenericErrorFunc(             # <<<<<<<<<<<<<<
 *             NULL, <xmlerror.xmlGenericErrorFunc>_receiveXSLTError)
 *         return 0
*/
  xsltSetGenericErrorFunc(NULL, ((xmlGenericErrorFunc)__pyx_f_4lxml_5etree__receiveXSLTError));

  /* "src/lxml/xmlerror.pxi":420
 *         xslt.xsltSetGenericErrorFunc(
 *             NULL, <xmlerror.xmlGenericErrorFunc>_receiveXSLTError)
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     cdef int pop_error_log(self) except -1:
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/xmlerror.pxi":407
 *     cdef _BaseErrorLog old_xslt_error_log
 * 
 *     cdef int push_error_log(self, _BaseErrorLog log) except -1:             # <<<<<<<<<<<<<<
 *         self.old_error_func = xmlerror.xmlStructuredError
 *         self.old_error_context = xmlerror.xmlStructuredErrorContext
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ErrorLogContext.push_error_log", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":422
 *         return 0
 * 
 *     cdef int pop_error_log(self) except -1:             # <<<<<<<<<<<<<<
 *         xmlerror.xmlSetStructuredErrorFunc(
 *             self.old_error_context, self.old_error_func)
*/

static int __pyx_f_4lxml_5etree_16_ErrorLogContext_pop_error_log(struct __pyx_obj_4lxml_5etree__ErrorLogContext *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("pop_error_log", 0);

  /* "src/lxml/xmlerror.pxi":423
 * 
 *     cdef int pop_error_log(self) except -1:
 *         xmlerror.xmlSetStructuredErrorFunc(             # <<<<<<<<<<<<<<
 *             self.old_error_context, self.old_error_func)
 *         xslt.xsltSetGenericErrorFunc(
*/
  xmlSetStructuredErrorFunc(__pyx_v_self->old_error_context, __pyx_v_self->old_error_func);

  /* "src/lxml/xmlerror.pxi":425
 *         xmlerror.xmlSetStructuredErrorFunc(
 *             self.old_error_context, self.old_error_func)
 *         xslt.xsltSetGenericErrorFunc(             # <<<<<<<<<<<<<<
 *             self.old_xslt_error_context, self.old_xslt_error_func)
 *         _setThreadErrorLog(XSLT_ERROR_LOG, self.old_xslt_error_log)
*/
  xsltSetGenericErrorFunc(__pyx_v_self->old_xslt_error_context, __pyx_v_self->old_xslt_error_func);

  /* "src/lxml/xmlerror.pxi":427
 *         xslt.xsltSetGenericErrorFunc(
 *             self.old_xslt_error_context, self.old_xslt_error_func)
 *         _setThreadErrorLog(XSLT_ERROR_LOG, self.old_xslt_error_log)             # <<<<<<<<<<<<<<
 *         self.old_xslt_error_log= None
 *         return 0
*/
  __pyx_t_1 = ((PyObject *)__pyx_v_self->old_xslt_error_log);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__setThreadErrorLog(__pyx_mstate_global->__pyx_n_u_XSLTErrorLog, ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 427, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/xmlerror.pxi":428
 *             self.old_xslt_error_context, self.old_xslt_error_func)
 *         _setThreadErrorLog(XSLT_ERROR_LOG, self.old_xslt_error_log)
 *         self.old_xslt_error_log= None             # <<<<<<<<<<<<<<
 *         return 0
 * 
*/
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->old_xslt_error_log);
  __Pyx_DECREF((PyObject *)__pyx_v_self->old_xslt_error_log);
  __pyx_v_self->old_xslt_error_log = ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)Py_None);

  /* "src/lxml/xmlerror.pxi":429
 *         _setThreadErrorLog(XSLT_ERROR_LOG, self.old_xslt_error_log)
 *         self.old_xslt_error_log= None
 *         return 0             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/xmlerror.pxi":422
 *         return 0
 * 
 *     cdef int pop_error_log(self) except -1:             # <<<<<<<<<<<<<<
 *         xmlerror.xmlSetStructuredErrorFunc(
 *             self.old_error_context, self.old_error_func)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ErrorLogContext.pop_error_log", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":434
 * cdef class _ErrorLog(_ListErrorLog):
 *     cdef list _logContexts
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._logContexts = []
 * 
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_9_ErrorLog_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_9_ErrorLog_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, __pyx_nargs); return -1; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return -1;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__cinit__", __pyx_kwds); return -1;}
  __pyx_r = __pyx_pf_4lxml_5etree_9_ErrorLog___cinit__(((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_9_ErrorLog___cinit__(struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "src/lxml/xmlerror.pxi":435
 *     cdef list _logContexts
 *     def __cinit__(self):
 *         self._logContexts = []             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self):
*/
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 435, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_logContexts);
  __Pyx_DECREF(__pyx_v_self->_logContexts);
  __pyx_v_self->_logContexts = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xmlerror.pxi":434
 * cdef class _ErrorLog(_ListErrorLog):
 *     cdef list _logContexts
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._logContexts = []
 * 
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ErrorLog.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":437
 *         self._logContexts = []
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         _ListErrorLog.__init__(self, [], None, None)
 * 
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_9_ErrorLog_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_9_ErrorLog_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, __pyx_nargs); return -1; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return -1;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__init__", __pyx_kwds); return -1;}
  __pyx_r = __pyx_pf_4lxml_5etree_9_ErrorLog_2__init__(((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_9_ErrorLog_2__init__(struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "src/lxml/xmlerror.pxi":438
 * 
 *     def __init__(self):
 *         _ListErrorLog.__init__(self, [], None, None)             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
*/
  __pyx_t_2 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ListErrorLog);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 438, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[5] = {__pyx_t_2, ((PyObject *)__pyx_v_self), __pyx_t_3, Py_None, Py_None};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_init, __pyx_callargs+__pyx_t_4, (5-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 438, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xmlerror.pxi":437
 *         self._logContexts = []
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         _ListErrorLog.__init__(self, [], None, None)
 * 
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._ErrorLog.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":440
 *         _ListErrorLog.__init__(self, [], None, None)
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef int __enter__(self) except -1:
 *         return self.connect()
*/

static int __pyx_f_4lxml_5etree_9_ErrorLog___enter__(struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_self) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/xmlerror.pxi":442
 *     @cython.final
 *     cdef int __enter__(self) except -1:
 *         return self.connect()             # <<<<<<<<<<<<<<
 * 
 *     def __exit__(self, *args):
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_9_ErrorLog_connect(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 442, __pyx_L1_error)
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  /* "src/lxml/xmlerror.pxi":440
 *         _ListErrorLog.__init__(self, [], None, None)
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef int __enter__(self) except -1:
 *         return self.connect()
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._ErrorLog.__enter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":444
 *         return self.connect()
 * 
 *     def __exit__(self, *args):             # <<<<<<<<<<<<<<
 *         #  TODO: make this a cdef function when Cython supports it
 *         self.disconnect()
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9_ErrorLog_5__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_9_ErrorLog_5__exit__ = {"__exit__", (PyCFunction)(void(*)(void))(PyCFunctionWithKeywords)__pyx_pw_4lxml_5etree_9_ErrorLog_5__exit__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_9_ErrorLog_5__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_args = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__exit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__exit__", __pyx_kwds); return NULL;}
  __Pyx_INCREF(__pyx_args);
  __pyx_v_args = __pyx_args;
  __pyx_r = __pyx_pf_4lxml_5etree_9_ErrorLog_4__exit__(((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_v_self), __pyx_v_args);

  /* function exit code */
  __Pyx_DECREF(__pyx_v_args);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_9_ErrorLog_4__exit__(struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__exit__", 0);

  /* "src/lxml/xmlerror.pxi":446
 *     def __exit__(self, *args):
 *         #  TODO: make this a cdef function when Cython supports it
 *         self.disconnect()             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_9_ErrorLog_disconnect(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 446, __pyx_L1_error)

  /* "src/lxml/xmlerror.pxi":444
 *         return self.connect()
 * 
 *     def __exit__(self, *args):             # <<<<<<<<<<<<<<
 *         #  TODO: make this a cdef function when Cython supports it
 *         self.disconnect()
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._ErrorLog.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":448
 *         self.disconnect()
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef int connect(self) except -1:
 *         self._first_error = None
*/

static int __pyx_f_4lxml_5etree_9_ErrorLog_connect(struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree__ErrorLogContext *__pyx_v_context = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("connect", 0);

  /* "src/lxml/xmlerror.pxi":450
 *     @cython.final
 *     cdef int connect(self) except -1:
 *         self._first_error = None             # <<<<<<<<<<<<<<
 *         del self._entries[:]
 * 
*/
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->__pyx_base.__pyx_base._first_error);
  __Pyx_DECREF((PyObject *)__pyx_v_self->__pyx_base.__pyx_base._first_error);
  __pyx_v_self->__pyx_base.__pyx_base._first_error = ((struct __pyx_obj_4lxml_5etree__LogEntry *)Py_None);

  /* "src/lxml/xmlerror.pxi":451
 *     cdef int connect(self) except -1:
 *         self._first_error = None
 *         del self._entries[:]             # <<<<<<<<<<<<<<
 * 
 *         cdef _ErrorLogContext context = _ErrorLogContext.__new__(_ErrorLogContext)
*/
  if (unlikely(__pyx_v_self->__pyx_base._entries == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 451, __pyx_L1_error)
  }
  if (__Pyx_PyObject_DelSlice(__pyx_v_self->__pyx_base._entries, 0, 0, NULL, NULL, NULL, 0, 0, 1) < (0)) __PYX_ERR(1, 451, __pyx_L1_error)

  /* "src/lxml/xmlerror.pxi":453
 *         del self._entries[:]
 * 
 *         cdef _ErrorLogContext context = _ErrorLogContext.__new__(_ErrorLogContext)             # <<<<<<<<<<<<<<
 *         context.push_error_log(self)
 *         self._logContexts.append(context)
*/
  __pyx_t_1 = ((PyObject *)__pyx_tp_new_4lxml_5etree__ErrorLogContext(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ErrorLogContext), __pyx_mstate_global->__pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 453, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_1);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ErrorLogContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xmlerror.pxi":454
 * 
 *         cdef _ErrorLogContext context = _ErrorLogContext.__new__(_ErrorLogContext)
 *         context.push_error_log(self)             # <<<<<<<<<<<<<<
 *         self._logContexts.append(context)
 *         return 0
*/
  __pyx_t_2 = __pyx_f_4lxml_5etree_16_ErrorLogContext_push_error_log(__pyx_v_context, ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 454, __pyx_L1_error)

  /* "src/lxml/xmlerror.pxi":455
 *         cdef _ErrorLogContext context = _ErrorLogContext.__new__(_ErrorLogContext)
 *         context.push_error_log(self)
 *         self._logContexts.append(context)             # <<<<<<<<<<<<<<
 *         return 0
 * 
*/
  if (unlikely(__pyx_v_self->_logContexts == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
    __PYX_ERR(1, 455, __pyx_L1_error)
  }
  __pyx_t_3 = __Pyx_PyList_Append(__pyx_v_self->_logContexts, ((PyObject *)__pyx_v_context)); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 455, __pyx_L1_error)

  /* "src/lxml/xmlerror.pxi":456
 *         context.push_error_log(self)
 *         self._logContexts.append(context)
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/xmlerror.pxi":448
 *         self.disconnect()
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef int connect(self) except -1:
 *         self._first_error = None
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ErrorLog.connect", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":458
 *         return 0
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef int disconnect(self) except -1:
 *         cdef _ErrorLogContext context = self._logContexts.pop()
*/

static int __pyx_f_4lxml_5etree_9_ErrorLog_disconnect(struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree__ErrorLogContext *__pyx_v_context = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("disconnect", 0);

  /* "src/lxml/xmlerror.pxi":460
 *     @cython.final
 *     cdef int disconnect(self) except -1:
 *         cdef _ErrorLogContext context = self._logContexts.pop()             # <<<<<<<<<<<<<<
 *         context.pop_error_log()
 *         return 0
*/
  if (unlikely(__pyx_v_self->_logContexts == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "pop");
    __PYX_ERR(1, 460, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyList_Pop(__pyx_v_self->_logContexts); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 460, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ErrorLogContext))))) __PYX_ERR(1, 460, __pyx_L1_error)
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ErrorLogContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xmlerror.pxi":461
 *     cdef int disconnect(self) except -1:
 *         cdef _ErrorLogContext context = self._logContexts.pop()
 *         context.pop_error_log()             # <<<<<<<<<<<<<<
 *         return 0
 * 
*/
  __pyx_t_2 = __pyx_f_4lxml_5etree_16_ErrorLogContext_pop_error_log(__pyx_v_context); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 461, __pyx_L1_error)

  /* "src/lxml/xmlerror.pxi":462
 *         cdef _ErrorLogContext context = self._logContexts.pop()
 *         context.pop_error_log()
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     cpdef clear(self):
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/xmlerror.pxi":458
 *         return 0
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef int disconnect(self) except -1:
 *         cdef _ErrorLogContext context = self._logContexts.pop()
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ErrorLog.disconnect", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":464
 *         return 0
 * 
 *     cpdef clear(self):             # <<<<<<<<<<<<<<
 *         self._first_error = None
 *         self.last_error = None
*/

static PyObject *__pyx_pw_4lxml_5etree_9_ErrorLog_7clear(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_4lxml_5etree_9_ErrorLog_clear(struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_self, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("clear", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (
  #if !CYTHON_USE_TYPE_SLOTS
  unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ErrorLog &&
  __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
  #else
  unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
  #endif
  ) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_clear); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 464, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_4lxml_5etree_9_ErrorLog_7clear)) {
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_3 = NULL;
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_4 = __pyx_t_1; 
        __pyx_t_5 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
          assert(__pyx_t_3);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
          __pyx_t_5 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
          __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 464, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
        }
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "src/lxml/xmlerror.pxi":465
 * 
 *     cpdef clear(self):
 *         self._first_error = None             # <<<<<<<<<<<<<<
 *         self.last_error = None
 *         self._offset = 0
*/
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->__pyx_base.__pyx_base._first_error);
  __Pyx_DECREF((PyObject *)__pyx_v_self->__pyx_base.__pyx_base._first_error);
  __pyx_v_self->__pyx_base.__pyx_base._first_error = ((struct __pyx_obj_4lxml_5etree__LogEntry *)Py_None);

  /* "src/lxml/xmlerror.pxi":466
 *     cpdef clear(self):
 *         self._first_error = None
 *         self.last_error = None             # <<<<<<<<<<<<<<
 *         self._offset = 0
 *         del self._entries[:]
*/
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base.__pyx_base.last_error);
  __Pyx_DECREF(__pyx_v_self->__pyx_base.__pyx_base.last_error);
  __pyx_v_self->__pyx_base.__pyx_base.last_error = Py_None;

  /* "src/lxml/xmlerror.pxi":467
 *         self._first_error = None
 *         self.last_error = None
 *         self._offset = 0             # <<<<<<<<<<<<<<
 *         del self._entries[:]
 * 
*/
  __pyx_v_self->__pyx_base._offset = 0;

  /* "src/lxml/xmlerror.pxi":468
 *         self.last_error = None
 *         self._offset = 0
 *         del self._entries[:]             # <<<<<<<<<<<<<<
 * 
 *     cpdef copy(self):
*/
  if (unlikely(__pyx_v_self->__pyx_base._entries == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 468, __pyx_L1_error)
  }
  if (__Pyx_PyObject_DelSlice(__pyx_v_self->__pyx_base._entries, 0, 0, NULL, NULL, NULL, 0, 0, 1) < (0)) __PYX_ERR(1, 468, __pyx_L1_error)

  /* "src/lxml/xmlerror.pxi":464
 *         return 0
 * 
 *     cpdef clear(self):             # <<<<<<<<<<<<<<
 *         self._first_error = None
 *         self.last_error = None
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._ErrorLog.clear", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9_ErrorLog_7clear(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_9_ErrorLog_7clear = {"clear", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_9_ErrorLog_7clear, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_9_ErrorLog_7clear(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clear (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("clear", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("clear", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_9_ErrorLog_6clear(((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_9_ErrorLog_6clear(struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("clear", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree_9_ErrorLog_clear(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 464, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ErrorLog.clear", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":470
 *         del self._entries[:]
 * 
 *     cpdef copy(self):             # <<<<<<<<<<<<<<
 *         """Creates a shallow copy of this error log and the list of entries.
 *         """
*/

static PyObject *__pyx_pw_4lxml_5etree_9_ErrorLog_9copy(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_4lxml_5etree_9_ErrorLog_copy(struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_self, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (
  #if !CYTHON_USE_TYPE_SLOTS
  unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ErrorLog &&
  __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
  #else
  unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
  #endif
  ) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_copy); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 470, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_4lxml_5etree_9_ErrorLog_9copy)) {
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_3 = NULL;
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_4 = __pyx_t_1; 
        __pyx_t_5 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
          assert(__pyx_t_3);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
          __pyx_t_5 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
          __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 470, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
        }
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "src/lxml/xmlerror.pxi":473
 *         """Creates a shallow copy of this error log and the list of entries.
 *         """
 *         return _ListErrorLog(             # <<<<<<<<<<<<<<
 *             self._entries[self._offset:],
 *             self._first_error, self.last_error)
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = NULL;

  /* "src/lxml/xmlerror.pxi":474
 *         """
 *         return _ListErrorLog(
 *             self._entries[self._offset:],             # <<<<<<<<<<<<<<
 *             self._first_error, self.last_error)
 * 
*/
  if (unlikely(__pyx_v_self->__pyx_base._entries == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 474, __pyx_L1_error)
  }
  __pyx_t_4 = __Pyx_PyList_GetSlice(__pyx_v_self->__pyx_base._entries, __pyx_v_self->__pyx_base._offset, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 474, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "src/lxml/xmlerror.pxi":475
 *         return _ListErrorLog(
 *             self._entries[self._offset:],
 *             self._first_error, self.last_error)             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
*/
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[4] = {__pyx_t_2, __pyx_t_4, ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base._first_error), __pyx_v_self->__pyx_base.__pyx_base.last_error};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ListErrorLog, __pyx_callargs+__pyx_t_5, (4-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 473, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __pyx_r = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/xmlerror.pxi":470
 *         del self._entries[:]
 * 
 *     cpdef copy(self):             # <<<<<<<<<<<<<<
 *         """Creates a shallow copy of this error log and the list of entries.
 *         """
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._ErrorLog.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9_ErrorLog_9copy(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_9_ErrorLog_8copy, "Creates a shallow copy of this error log and the list of entries.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_9_ErrorLog_9copy = {"copy", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_9_ErrorLog_9copy, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_9_ErrorLog_8copy};
static PyObject *__pyx_pw_4lxml_5etree_9_ErrorLog_9copy(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("copy", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("copy", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_9_ErrorLog_8copy(((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_9_ErrorLog_8copy(struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree_9_ErrorLog_copy(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ErrorLog.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":477
 *             self._first_error, self.last_error)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return iter(self._entries[self._offset:])
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9_ErrorLog_11__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_9_ErrorLog_11__iter__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_9_ErrorLog_10__iter__(((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_9_ErrorLog_10__iter__(struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "src/lxml/xmlerror.pxi":478
 * 
 *     def __iter__(self):
 *         return iter(self._entries[self._offset:])             # <<<<<<<<<<<<<<
 * 
 *     cpdef receive(self, _LogEntry entry):
*/
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(__pyx_v_self->__pyx_base._entries == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 478, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyList_GetSlice(__pyx_v_self->__pyx_base._entries, __pyx_v_self->__pyx_base._offset, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 478, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 478, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/xmlerror.pxi":477
 *             self._first_error, self.last_error)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return iter(self._entries[self._offset:])
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ErrorLog.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":480
 *         return iter(self._entries[self._offset:])
 * 
 *     cpdef receive(self, _LogEntry entry):             # <<<<<<<<<<<<<<
 *         if self._first_error is None and entry.level >= xmlerror.XML_ERR_ERROR:
 *             self._first_error = entry
*/

static PyObject *__pyx_pw_4lxml_5etree_9_ErrorLog_13receive(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_4lxml_5etree_9_ErrorLog_receive(struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_self, struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_entry, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("receive", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (
  #if !CYTHON_USE_TYPE_SLOTS
  unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ErrorLog &&
  __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
  #else
  unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
  #endif
  ) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_receive); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 480, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_4lxml_5etree_9_ErrorLog_13receive)) {
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_3 = NULL;
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_4 = __pyx_t_1; 
        __pyx_t_5 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
          assert(__pyx_t_3);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
          __pyx_t_5 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_3, ((PyObject *)__pyx_v_entry)};
          __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 480, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
        }
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "src/lxml/xmlerror.pxi":481
 * 
 *     cpdef receive(self, _LogEntry entry):
 *         if self._first_error is None and entry.level >= xmlerror.XML_ERR_ERROR:             # <<<<<<<<<<<<<<
 *             self._first_error = entry
 *         self._entries.append(entry)
*/
  __pyx_t_7 = (((PyObject *)__pyx_v_self->__pyx_base.__pyx_base._first_error) == Py_None);
  if (__pyx_t_7) {
  } else {
    __pyx_t_6 = __pyx_t_7;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_7 = (__pyx_v_entry->level >= XML_ERR_ERROR);
  __pyx_t_6 = __pyx_t_7;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_6) {

    /* "src/lxml/xmlerror.pxi":482
 *     cpdef receive(self, _LogEntry entry):
 *         if self._first_error is None and entry.level >= xmlerror.XML_ERR_ERROR:
 *             self._first_error = entry             # <<<<<<<<<<<<<<
 *         self._entries.append(entry)
 * 
*/
    __Pyx_INCREF((PyObject *)__pyx_v_entry);
    __Pyx_GIVEREF((PyObject *)__pyx_v_entry);
    __Pyx_GOTREF((PyObject *)__pyx_v_self->__pyx_base.__pyx_base._first_error);
    __Pyx_DECREF((PyObject *)__pyx_v_self->__pyx_base.__pyx_base._first_error);
    __pyx_v_self->__pyx_base.__pyx_base._first_error = __pyx_v_entry;

    /* "src/lxml/xmlerror.pxi":481
 * 
 *     cpdef receive(self, _LogEntry entry):
 *         if self._first_error is None and entry.level >= xmlerror.XML_ERR_ERROR:             # <<<<<<<<<<<<<<
 *             self._first_error = entry
 *         self._entries.append(entry)
*/
  }

  /* "src/lxml/xmlerror.pxi":483
 *         if self._first_error is None and entry.level >= xmlerror.XML_ERR_ERROR:
 *             self._first_error = entry
 *         self._entries.append(entry)             # <<<<<<<<<<<<<<
 * 
 * cdef class _DomainErrorLog(_ErrorLog):
*/
  if (unlikely(__pyx_v_self->__pyx_base._entries == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
    __PYX_ERR(1, 483, __pyx_L1_error)
  }
  __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_self->__pyx_base._entries, ((PyObject *)__pyx_v_entry)); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(1, 483, __pyx_L1_error)

  /* "src/lxml/xmlerror.pxi":480
 *         return iter(self._entries[self._offset:])
 * 
 *     cpdef receive(self, _LogEntry entry):             # <<<<<<<<<<<<<<
 *         if self._first_error is None and entry.level >= xmlerror.XML_ERR_ERROR:
 *             self._first_error = entry
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._ErrorLog.receive", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9_ErrorLog_13receive(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_9_ErrorLog_13receive = {"receive", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_9_ErrorLog_13receive, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_9_ErrorLog_13receive(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_entry = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("receive (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_entry,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 480, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 480, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "receive", 0) < (0)) __PYX_ERR(1, 480, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("receive", 1, 1, 1, i); __PYX_ERR(1, 480, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 480, __pyx_L3_error)
    }
    __pyx_v_entry = ((struct __pyx_obj_4lxml_5etree__LogEntry *)values[0]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("receive", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 480, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._ErrorLog.receive", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_entry), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__LogEntry, 1, "entry", 0))) __PYX_ERR(1, 480, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_9_ErrorLog_12receive(((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_v_self), __pyx_v_entry);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_9_ErrorLog_12receive(struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_self, struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_entry) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("receive", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree_9_ErrorLog_receive(__pyx_v_self, __pyx_v_entry, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 480, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ErrorLog.receive", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":486
 * 
 * cdef class _DomainErrorLog(_ErrorLog):
 *     def __init__(self, domains):             # <<<<<<<<<<<<<<
 *         _ErrorLog.__init__(self)
 *         self._accepted_domains = tuple(domains)
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_15_DomainErrorLog_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_15_DomainErrorLog_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_domains = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_domains,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 486, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 486, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(1, 486, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, i); __PYX_ERR(1, 486, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 486, __pyx_L3_error)
    }
    __pyx_v_domains = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 486, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._DomainErrorLog.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_15_DomainErrorLog___init__(((struct __pyx_obj_4lxml_5etree__DomainErrorLog *)__pyx_v_self), __pyx_v_domains);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_15_DomainErrorLog___init__(struct __pyx_obj_4lxml_5etree__DomainErrorLog *__pyx_v_self, PyObject *__pyx_v_domains) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "src/lxml/xmlerror.pxi":487
 * cdef class _DomainErrorLog(_ErrorLog):
 *     def __init__(self, domains):
 *         _ErrorLog.__init__(self)             # <<<<<<<<<<<<<<
 *         self._accepted_domains = tuple(domains)
 * 
*/
  __pyx_t_2 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ErrorLog);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, ((PyObject *)__pyx_v_self)};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_init, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 487, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xmlerror.pxi":488
 *     def __init__(self, domains):
 *         _ErrorLog.__init__(self)
 *         self._accepted_domains = tuple(domains)             # <<<<<<<<<<<<<<
 * 
 *     cpdef receive(self, _LogEntry entry):
*/
  __pyx_t_1 = __Pyx_PySequence_Tuple(__pyx_v_domains); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 488, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_accepted_domains, __pyx_t_1) < (0)) __PYX_ERR(1, 488, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xmlerror.pxi":486
 * 
 * cdef class _DomainErrorLog(_ErrorLog):
 *     def __init__(self, domains):             # <<<<<<<<<<<<<<
 *         _ErrorLog.__init__(self)
 *         self._accepted_domains = tuple(domains)
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._DomainErrorLog.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":490
 *         self._accepted_domains = tuple(domains)
 * 
 *     cpdef receive(self, _LogEntry entry):             # <<<<<<<<<<<<<<
 *         if entry.domain in self._accepted_domains:
 *             _ErrorLog.receive(self, entry)
*/

static PyObject *__pyx_pw_4lxml_5etree_15_DomainErrorLog_3receive(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_4lxml_5etree_15_DomainErrorLog_receive(struct __pyx_obj_4lxml_5etree__DomainErrorLog *__pyx_v_self, struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_entry, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("receive", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (
  #if !CYTHON_USE_TYPE_SLOTS
  unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_4lxml_5etree__DomainErrorLog &&
  __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
  #else
  unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
  #endif
  ) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_receive); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 490, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_4lxml_5etree_15_DomainErrorLog_3receive)) {
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_3 = NULL;
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_4 = __pyx_t_1; 
        __pyx_t_5 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
          assert(__pyx_t_3);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
          __pyx_t_5 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_3, ((PyObject *)__pyx_v_entry)};
          __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 490, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
        }
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "src/lxml/xmlerror.pxi":491
 * 
 *     cpdef receive(self, _LogEntry entry):
 *         if entry.domain in self._accepted_domains:             # <<<<<<<<<<<<<<
 *             _ErrorLog.receive(self, entry)
 * 
*/
  __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_entry->domain); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 491, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_accepted_domains); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 491, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_t_2, Py_EQ)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(1, 491, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_6) {

    /* "src/lxml/xmlerror.pxi":492
 *     cpdef receive(self, _LogEntry entry):
 *         if entry.domain in self._accepted_domains:
 *             _ErrorLog.receive(self, entry)             # <<<<<<<<<<<<<<
 * 
 * cdef class _RotatingErrorLog(_ErrorLog):
*/
    __pyx_t_2 = __pyx_f_4lxml_5etree_9_ErrorLog_receive(((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_v_self), __pyx_v_entry, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 492, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/xmlerror.pxi":491
 * 
 *     cpdef receive(self, _LogEntry entry):
 *         if entry.domain in self._accepted_domains:             # <<<<<<<<<<<<<<
 *             _ErrorLog.receive(self, entry)
 * 
*/
  }

  /* "src/lxml/xmlerror.pxi":490
 *         self._accepted_domains = tuple(domains)
 * 
 *     cpdef receive(self, _LogEntry entry):             # <<<<<<<<<<<<<<
 *         if entry.domain in self._accepted_domains:
 *             _ErrorLog.receive(self, entry)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._DomainErrorLog.receive", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_15_DomainErrorLog_3receive(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_15_DomainErrorLog_3receive = {"receive", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_15_DomainErrorLog_3receive, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_15_DomainErrorLog_3receive(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_entry = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("receive (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_entry,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 490, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 490, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "receive", 0) < (0)) __PYX_ERR(1, 490, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("receive", 1, 1, 1, i); __PYX_ERR(1, 490, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 490, __pyx_L3_error)
    }
    __pyx_v_entry = ((struct __pyx_obj_4lxml_5etree__LogEntry *)values[0]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("receive", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 490, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._DomainErrorLog.receive", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_entry), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__LogEntry, 1, "entry", 0))) __PYX_ERR(1, 490, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_15_DomainErrorLog_2receive(((struct __pyx_obj_4lxml_5etree__DomainErrorLog *)__pyx_v_self), __pyx_v_entry);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_15_DomainErrorLog_2receive(struct __pyx_obj_4lxml_5etree__DomainErrorLog *__pyx_v_self, struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_entry) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("receive", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree_15_DomainErrorLog_receive(__pyx_v_self, __pyx_v_entry, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 490, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._DomainErrorLog.receive", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":496
 * cdef class _RotatingErrorLog(_ErrorLog):
 *     cdef int _max_len
 *     def __init__(self, max_len):             # <<<<<<<<<<<<<<
 *         _ErrorLog.__init__(self)
 *         self._max_len = max_len
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_17_RotatingErrorLog_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_17_RotatingErrorLog_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_max_len = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_max_len,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 496, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 496, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(1, 496, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, i); __PYX_ERR(1, 496, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 496, __pyx_L3_error)
    }
    __pyx_v_max_len = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 496, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._RotatingErrorLog.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_17_RotatingErrorLog___init__(((struct __pyx_obj_4lxml_5etree__RotatingErrorLog *)__pyx_v_self), __pyx_v_max_len);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_17_RotatingErrorLog___init__(struct __pyx_obj_4lxml_5etree__RotatingErrorLog *__pyx_v_self, PyObject *__pyx_v_max_len) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "src/lxml/xmlerror.pxi":497
 *     cdef int _max_len
 *     def __init__(self, max_len):
 *         _ErrorLog.__init__(self)             # <<<<<<<<<<<<<<
 *         self._max_len = max_len
 * 
*/
  __pyx_t_2 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ErrorLog);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, ((PyObject *)__pyx_v_self)};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_init, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 497, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xmlerror.pxi":498
 *     def __init__(self, max_len):
 *         _ErrorLog.__init__(self)
 *         self._max_len = max_len             # <<<<<<<<<<<<<<
 * 
 *     cpdef receive(self, _LogEntry entry):
*/
  __pyx_t_4 = __Pyx_PyLong_As_int(__pyx_v_max_len); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 498, __pyx_L1_error)
  __pyx_v_self->_max_len = __pyx_t_4;

  /* "src/lxml/xmlerror.pxi":496
 * cdef class _RotatingErrorLog(_ErrorLog):
 *     cdef int _max_len
 *     def __init__(self, max_len):             # <<<<<<<<<<<<<<
 *         _ErrorLog.__init__(self)
 *         self._max_len = max_len
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._RotatingErrorLog.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":500
 *         self._max_len = max_len
 * 
 *     cpdef receive(self, _LogEntry entry):             # <<<<<<<<<<<<<<
 *         if self._first_error is None and entry.level >= xmlerror.XML_ERR_ERROR:
 *             self._first_error = entry
*/

static PyObject *__pyx_pw_4lxml_5etree_17_RotatingErrorLog_3receive(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_4lxml_5etree_17_RotatingErrorLog_receive(struct __pyx_obj_4lxml_5etree__RotatingErrorLog *__pyx_v_self, struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_entry, int __pyx_skip_dispatch) {
  int __pyx_v_offset;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("receive", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (
  #if !CYTHON_USE_TYPE_SLOTS
  unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_4lxml_5etree__RotatingErrorLog &&
  __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
  #else
  unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
  #endif
  ) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_receive); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 500, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_4lxml_5etree_17_RotatingErrorLog_3receive)) {
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_3 = NULL;
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_4 = __pyx_t_1; 
        __pyx_t_5 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
          assert(__pyx_t_3);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
          __pyx_t_5 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_3, ((PyObject *)__pyx_v_entry)};
          __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 500, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
        }
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "src/lxml/xmlerror.pxi":501
 * 
 *     cpdef receive(self, _LogEntry entry):
 *         if self._first_error is None and entry.level >= xmlerror.XML_ERR_ERROR:             # <<<<<<<<<<<<<<
 *             self._first_error = entry
 *         self._entries.append(entry)
*/
  __pyx_t_7 = (((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base._first_error) == Py_None);
  if (__pyx_t_7) {
  } else {
    __pyx_t_6 = __pyx_t_7;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_7 = (__pyx_v_entry->level >= XML_ERR_ERROR);
  __pyx_t_6 = __pyx_t_7;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_6) {

    /* "src/lxml/xmlerror.pxi":502
 *     cpdef receive(self, _LogEntry entry):
 *         if self._first_error is None and entry.level >= xmlerror.XML_ERR_ERROR:
 *             self._first_error = entry             # <<<<<<<<<<<<<<
 *         self._entries.append(entry)
 * 
*/
    __Pyx_INCREF((PyObject *)__pyx_v_entry);
    __Pyx_GIVEREF((PyObject *)__pyx_v_entry);
    __Pyx_GOTREF((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base._first_error);
    __Pyx_DECREF((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base._first_error);
    __pyx_v_self->__pyx_base.__pyx_base.__pyx_base._first_error = __pyx_v_entry;

    /* "src/lxml/xmlerror.pxi":501
 * 
 *     cpdef receive(self, _LogEntry entry):
 *         if self._first_error is None and entry.level >= xmlerror.XML_ERR_ERROR:             # <<<<<<<<<<<<<<
 *             self._first_error = entry
 *         self._entries.append(entry)
*/
  }

  /* "src/lxml/xmlerror.pxi":503
 *         if self._first_error is None and entry.level >= xmlerror.XML_ERR_ERROR:
 *             self._first_error = entry
 *         self._entries.append(entry)             # <<<<<<<<<<<<<<
 * 
 *         if len(self._entries) > self._max_len:
*/
  if (unlikely(__pyx_v_self->__pyx_base.__pyx_base._entries == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
    __PYX_ERR(1, 503, __pyx_L1_error)
  }
  __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_self->__pyx_base.__pyx_base._entries, ((PyObject *)__pyx_v_entry)); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(1, 503, __pyx_L1_error)

  /* "src/lxml/xmlerror.pxi":505
 *         self._entries.append(entry)
 * 
 *         if len(self._entries) > self._max_len:             # <<<<<<<<<<<<<<
 *             self._offset += 1
 *             if self._offset > self._max_len // 3:
*/
  __pyx_t_1 = __pyx_v_self->__pyx_base.__pyx_base._entries;
  __Pyx_INCREF(__pyx_t_1);
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 505, __pyx_L1_error)
  }
  __pyx_t_9 = __Pyx_PyList_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(1, 505, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_6 = (__pyx_t_9 > __pyx_v_self->_max_len);
  if (__pyx_t_6) {

    /* "src/lxml/xmlerror.pxi":506
 * 
 *         if len(self._entries) > self._max_len:
 *             self._offset += 1             # <<<<<<<<<<<<<<
 *             if self._offset > self._max_len // 3:
 *                 offset = self._offset
*/
    __pyx_v_self->__pyx_base.__pyx_base._offset = (__pyx_v_self->__pyx_base.__pyx_base._offset + 1);

    /* "src/lxml/xmlerror.pxi":507
 *         if len(self._entries) > self._max_len:
 *             self._offset += 1
 *             if self._offset > self._max_len // 3:             # <<<<<<<<<<<<<<
 *                 offset = self._offset
 *                 self._offset = 0
*/
    __pyx_t_6 = (__pyx_v_self->__pyx_base.__pyx_base._offset > __Pyx_div_long(__pyx_v_self->_max_len, 3, 1));
    if (__pyx_t_6) {

      /* "src/lxml/xmlerror.pxi":508
 *             self._offset += 1
 *             if self._offset > self._max_len // 3:
 *                 offset = self._offset             # <<<<<<<<<<<<<<
 *                 self._offset = 0
 *                 del self._entries[:offset]
*/
      __pyx_t_10 = __pyx_v_self->__pyx_base.__pyx_base._offset;
      __pyx_v_offset = __pyx_t_10;

      /* "src/lxml/xmlerror.pxi":509
 *             if self._offset > self._max_len // 3:
 *                 offset = self._offset
 *                 self._offset = 0             # <<<<<<<<<<<<<<
 *                 del self._entries[:offset]
 * 
*/
      __pyx_v_self->__pyx_base.__pyx_base._offset = 0;

      /* "src/lxml/xmlerror.pxi":510
 *                 offset = self._offset
 *                 self._offset = 0
 *                 del self._entries[:offset]             # <<<<<<<<<<<<<<
 * 
 * cdef class PyErrorLog(_BaseErrorLog):
*/
      if (unlikely(__pyx_v_self->__pyx_base.__pyx_base._entries == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(1, 510, __pyx_L1_error)
      }
      if (__Pyx_PyObject_DelSlice(__pyx_v_self->__pyx_base.__pyx_base._entries, 0, __pyx_v_offset, NULL, NULL, NULL, 0, 1, 1) < (0)) __PYX_ERR(1, 510, __pyx_L1_error)

      /* "src/lxml/xmlerror.pxi":507
 *         if len(self._entries) > self._max_len:
 *             self._offset += 1
 *             if self._offset > self._max_len // 3:             # <<<<<<<<<<<<<<
 *                 offset = self._offset
 *                 self._offset = 0
*/
    }

    /* "src/lxml/xmlerror.pxi":505
 *         self._entries.append(entry)
 * 
 *         if len(self._entries) > self._max_len:             # <<<<<<<<<<<<<<
 *             self._offset += 1
 *             if self._offset > self._max_len // 3:
*/
  }

  /* "src/lxml/xmlerror.pxi":500
 *         self._max_len = max_len
 * 
 *     cpdef receive(self, _LogEntry entry):             # <<<<<<<<<<<<<<
 *         if self._first_error is None and entry.level >= xmlerror.XML_ERR_ERROR:
 *             self._first_error = entry
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._RotatingErrorLog.receive", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_17_RotatingErrorLog_3receive(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_17_RotatingErrorLog_3receive = {"receive", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_17_RotatingErrorLog_3receive, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_17_RotatingErrorLog_3receive(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_entry = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("receive (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_entry,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 500, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 500, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "receive", 0) < (0)) __PYX_ERR(1, 500, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("receive", 1, 1, 1, i); __PYX_ERR(1, 500, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 500, __pyx_L3_error)
    }
    __pyx_v_entry = ((struct __pyx_obj_4lxml_5etree__LogEntry *)values[0]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("receive", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 500, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._RotatingErrorLog.receive", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_entry), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__LogEntry, 1, "entry", 0))) __PYX_ERR(1, 500, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_17_RotatingErrorLog_2receive(((struct __pyx_obj_4lxml_5etree__RotatingErrorLog *)__pyx_v_self), __pyx_v_entry);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_17_RotatingErrorLog_2receive(struct __pyx_obj_4lxml_5etree__RotatingErrorLog *__pyx_v_self, struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_entry) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("receive", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree_17_RotatingErrorLog_receive(__pyx_v_self, __pyx_v_entry, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 500, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._RotatingErrorLog.receive", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":535
 *     cdef object _map_level
 *     cdef object _log
 *     def __init__(self, logger_name=None, logger=None):             # <<<<<<<<<<<<<<
 *         _BaseErrorLog.__init__(self, None, None)
 *         import logging
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_10PyErrorLog_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_10PyErrorLog_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_logger_name = 0;
  PyObject *__pyx_v_logger = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_logger_name,&__pyx_mstate_global->__pyx_n_u_logger,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 535, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 535, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 535, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(1, 535, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
    } else {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 535, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 535, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_logger_name = values[0];
    __pyx_v_logger = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 2, __pyx_nargs); __PYX_ERR(1, 535, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.PyErrorLog.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_10PyErrorLog___init__(((struct __pyx_obj_4lxml_5etree_PyErrorLog *)__pyx_v_self), __pyx_v_logger_name, __pyx_v_logger);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_10PyErrorLog___init__(struct __pyx_obj_4lxml_5etree_PyErrorLog *__pyx_v_self, PyObject *__pyx_v_logger_name, PyObject *__pyx_v_logger) {
  PyObject *__pyx_v_logging = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_INCREF(__pyx_v_logger);

  /* "src/lxml/xmlerror.pxi":536
 *     cdef object _log
 *     def __init__(self, logger_name=None, logger=None):
 *         _BaseErrorLog.__init__(self, None, None)             # <<<<<<<<<<<<<<
 *         import logging
 *         self.level_map = {
*/
  __pyx_t_2 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__BaseErrorLog);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[4] = {__pyx_t_2, ((PyObject *)__pyx_v_self), Py_None, Py_None};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_init, __pyx_callargs+__pyx_t_3, (4-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 536, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xmlerror.pxi":537
 *     def __init__(self, logger_name=None, logger=None):
 *         _BaseErrorLog.__init__(self, None, None)
 *         import logging             # <<<<<<<<<<<<<<
 *         self.level_map = {
 *             ErrorLevels.WARNING : logging.WARNING,
*/
  __pyx_t_4 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_logging, 0, 0, NULL, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 537, __pyx_L1_error)
  __pyx_t_1 = __pyx_t_4;
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_logging = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "src/lxml/xmlerror.pxi":539
 *         import logging
 *         self.level_map = {
 *             ErrorLevels.WARNING : logging.WARNING,             # <<<<<<<<<<<<<<
 *             ErrorLevels.ERROR   : logging.ERROR,
 *             ErrorLevels.FATAL   : logging.CRITICAL
*/
  __pyx_t_1 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 539, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_ErrorLevels); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 539, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_WARNING); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 539, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_logging, __pyx_mstate_global->__pyx_n_u_WARNING); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 539, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_t_5, __pyx_t_2) < (0)) __PYX_ERR(1, 539, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/xmlerror.pxi":540
 *         self.level_map = {
 *             ErrorLevels.WARNING : logging.WARNING,
 *             ErrorLevels.ERROR   : logging.ERROR,             # <<<<<<<<<<<<<<
 *             ErrorLevels.FATAL   : logging.CRITICAL
 *             }
*/
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_ErrorLevels); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 540, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_ERROR); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 540, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_logging, __pyx_mstate_global->__pyx_n_u_ERROR); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 540, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_t_5, __pyx_t_2) < (0)) __PYX_ERR(1, 539, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/xmlerror.pxi":541
 *             ErrorLevels.WARNING : logging.WARNING,
 *             ErrorLevels.ERROR   : logging.ERROR,
 *             ErrorLevels.FATAL   : logging.CRITICAL             # <<<<<<<<<<<<<<
 *             }
 *         self._map_level = self.level_map.get
*/
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_ErrorLevels); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 541, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FATAL); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 541, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_logging, __pyx_mstate_global->__pyx_n_u_CRITICAL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 541, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_t_5, __pyx_t_2) < (0)) __PYX_ERR(1, 539, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/xmlerror.pxi":538
 *         _BaseErrorLog.__init__(self, None, None)
 *         import logging
 *         self.level_map = {             # <<<<<<<<<<<<<<
 *             ErrorLevels.WARNING : logging.WARNING,
 *             ErrorLevels.ERROR   : logging.ERROR,
*/
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->level_map);
  __Pyx_DECREF(__pyx_v_self->level_map);
  __pyx_v_self->level_map = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xmlerror.pxi":543
 *             ErrorLevels.FATAL   : logging.CRITICAL
 *             }
 *         self._map_level = self.level_map.get             # <<<<<<<<<<<<<<
 *         if logger is None:
 *             if logger_name:
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->level_map, __pyx_mstate_global->__pyx_n_u_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 543, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_map_level);
  __Pyx_DECREF(__pyx_v_self->_map_level);
  __pyx_v_self->_map_level = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "src/lxml/xmlerror.pxi":544
 *             }
 *         self._map_level = self.level_map.get
 *         if logger is None:             # <<<<<<<<<<<<<<
 *             if logger_name:
 *                 logger = logging.getLogger(logger_name)
*/
  __pyx_t_6 = (__pyx_v_logger == Py_None);
  if (__pyx_t_6) {

    /* "src/lxml/xmlerror.pxi":545
 *         self._map_level = self.level_map.get
 *         if logger is None:
 *             if logger_name:             # <<<<<<<<<<<<<<
 *                 logger = logging.getLogger(logger_name)
 *             else:
*/
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_logger_name); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(1, 545, __pyx_L1_error)
    if (__pyx_t_6) {

      /* "src/lxml/xmlerror.pxi":546
 *         if logger is None:
 *             if logger_name:
 *                 logger = logging.getLogger(logger_name)             # <<<<<<<<<<<<<<
 *             else:
 *                 logger = logging.getLogger()
*/
      __pyx_t_2 = __pyx_v_logging;
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_3 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_logger_name};
        __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_getLogger, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 546, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_DECREF_SET(__pyx_v_logger, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "src/lxml/xmlerror.pxi":545
 *         self._map_level = self.level_map.get
 *         if logger is None:
 *             if logger_name:             # <<<<<<<<<<<<<<
 *                 logger = logging.getLogger(logger_name)
 *             else:
*/
      goto __pyx_L4;
    }

    /* "src/lxml/xmlerror.pxi":548
 *                 logger = logging.getLogger(logger_name)
 *             else:
 *                 logger = logging.getLogger()             # <<<<<<<<<<<<<<
 *         self._log = logger.log
 * 
*/
    /*else*/ {
      __pyx_t_2 = __pyx_v_logging;
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_3 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
        __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_getLogger, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 548, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_DECREF_SET(__pyx_v_logger, __pyx_t_1);
      __pyx_t_1 = 0;
    }
    __pyx_L4:;

    /* "src/lxml/xmlerror.pxi":544
 *             }
 *         self._map_level = self.level_map.get
 *         if logger is None:             # <<<<<<<<<<<<<<
 *             if logger_name:
 *                 logger = logging.getLogger(logger_name)
*/
  }

  /* "src/lxml/xmlerror.pxi":549
 *             else:
 *                 logger = logging.getLogger()
 *         self._log = logger.log             # <<<<<<<<<<<<<<
 * 
 *     cpdef copy(self):
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_logger, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 549, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_log);
  __Pyx_DECREF(__pyx_v_self->_log);
  __pyx_v_self->_log = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "src/lxml/xmlerror.pxi":535
 *     cdef object _map_level
 *     cdef object _log
 *     def __init__(self, logger_name=None, logger=None):             # <<<<<<<<<<<<<<
 *         _BaseErrorLog.__init__(self, None, None)
 *         import logging
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree.PyErrorLog.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_logging);
  __Pyx_XDECREF(__pyx_v_logger);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":551
 *         self._log = logger.log
 * 
 *     cpdef copy(self):             # <<<<<<<<<<<<<<
 *         """Dummy method that returns an empty error log.
 *         """
*/

static PyObject *__pyx_pw_4lxml_5etree_10PyErrorLog_3copy(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_4lxml_5etree_10PyErrorLog_copy(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree_PyErrorLog *__pyx_v_self, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (
  #if !CYTHON_USE_TYPE_SLOTS
  unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_4lxml_5etree_PyErrorLog &&
  __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
  #else
  unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
  #endif
  ) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_copy); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 551, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_4lxml_5etree_10PyErrorLog_3copy)) {
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_3 = NULL;
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_4 = __pyx_t_1; 
        __pyx_t_5 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
          assert(__pyx_t_3);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
          __pyx_t_5 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
          __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 551, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
        }
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "src/lxml/xmlerror.pxi":554
 *         """Dummy method that returns an empty error log.
 *         """
 *         return _ListErrorLog([], None, None)             # <<<<<<<<<<<<<<
 * 
 *     def log(self, log_entry, message, *args):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = NULL;
  __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 554, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[4] = {__pyx_t_2, __pyx_t_4, Py_None, Py_None};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ListErrorLog, __pyx_callargs+__pyx_t_5, (4-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 554, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __pyx_r = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/xmlerror.pxi":551
 *         self._log = logger.log
 * 
 *     cpdef copy(self):             # <<<<<<<<<<<<<<
 *         """Dummy method that returns an empty error log.
 *         """
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.PyErrorLog.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_10PyErrorLog_3copy(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_10PyErrorLog_2copy, "Dummy method that returns an empty error log.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_10PyErrorLog_3copy = {"copy", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_10PyErrorLog_3copy, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_10PyErrorLog_2copy};
static PyObject *__pyx_pw_4lxml_5etree_10PyErrorLog_3copy(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("copy", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("copy", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_10PyErrorLog_2copy(((struct __pyx_obj_4lxml_5etree_PyErrorLog *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_10PyErrorLog_2copy(struct __pyx_obj_4lxml_5etree_PyErrorLog *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree_10PyErrorLog_copy(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 551, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.PyErrorLog.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":556
 *         return _ListErrorLog([], None, None)
 * 
 *     def log(self, log_entry, message, *args):             # <<<<<<<<<<<<<<
 *         """log(self, log_entry, message, *args)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_10PyErrorLog_5log(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_10PyErrorLog_4log, "log(self, log_entry, message, *args)\n\n        Called by the .receive() method to log a _LogEntry instance to\n        the Python logging system.  This handles the error level\n        mapping.\n\n        In the default implementation, the ``message`` argument\n        receives a complete log line, and there are no further\n        ``args``.  To change the message format, it is best to\n        override the .receive() method instead of this one.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_10PyErrorLog_5log = {"log", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_10PyErrorLog_5log, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_10PyErrorLog_4log};
static PyObject *__pyx_pw_4lxml_5etree_10PyErrorLog_5log(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_log_entry = 0;
  PyObject *__pyx_v_message = 0;
  PyObject *__pyx_v_args = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("log (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  __pyx_v_args = __Pyx_ArgsSlice_FASTCALL(__pyx_args, 2, __pyx_nargs);
  if (unlikely(!__pyx_v_args)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_v_args);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_log_entry,&__pyx_mstate_global->__pyx_n_u_message,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 556, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        default:
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 556, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 556, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      const Py_ssize_t used_pos_args = (kwd_pos_args < 2) ? kwd_pos_args : 2;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, used_pos_args, __pyx_kwds_len, "log", 0) < (0)) __PYX_ERR(1, 556, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("log", 0, 2, 2, i); __PYX_ERR(1, 556, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs < 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 556, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 556, __pyx_L3_error)
    }
    __pyx_v_log_entry = values[0];
    __pyx_v_message = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("log", 0, 2, 2, __pyx_nargs); __PYX_ERR(1, 556, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0;
  __Pyx_AddTraceback("lxml.etree.PyErrorLog.log", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_10PyErrorLog_4log(((struct __pyx_obj_4lxml_5etree_PyErrorLog *)__pyx_v_self), __pyx_v_log_entry, __pyx_v_message, __pyx_v_args);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v_args);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_10PyErrorLog_4log(struct __pyx_obj_4lxml_5etree_PyErrorLog *__pyx_v_self, PyObject *__pyx_v_log_entry, PyObject *__pyx_v_message, PyObject *__pyx_v_args) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("log", 0);

  /* "src/lxml/xmlerror.pxi":569
 *         """
 *         self._log(
 *             self._map_level(log_entry.level, 0),             # <<<<<<<<<<<<<<
 *             message, *args
 *             )
*/
  __pyx_t_2 = NULL;
  __Pyx_INCREF(__pyx_v_self->_map_level);
  __pyx_t_3 = __pyx_v_self->_map_level; 
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_log_entry, __pyx_mstate_global->__pyx_n_u_level); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 569, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = 1;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_5 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_t_4, __pyx_mstate_global->__pyx_int_0};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 569, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }

  /* "src/lxml/xmlerror.pxi":568
 *         override the .receive() method instead of this one.
 *         """
 *         self._log(             # <<<<<<<<<<<<<<
 *             self._map_level(log_entry.level, 0),
 *             message, *args
*/
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 568, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1) != (0)) __PYX_ERR(1, 568, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_message);
  __Pyx_GIVEREF(__pyx_v_message);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_message) != (0)) __PYX_ERR(1, 568, __pyx_L1_error);
  __pyx_t_1 = 0;

  /* "src/lxml/xmlerror.pxi":570
 *         self._log(
 *             self._map_level(log_entry.level, 0),
 *             message, *args             # <<<<<<<<<<<<<<
 *             )
 * 
*/
  __pyx_t_1 = PyNumber_Add(__pyx_t_3, __pyx_v_args); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 568, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/xmlerror.pxi":568
 *         override the .receive() method instead of this one.
 *         """
 *         self._log(             # <<<<<<<<<<<<<<
 *             self._map_level(log_entry.level, 0),
 *             message, *args
*/
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_v_self->_log, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 568, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/xmlerror.pxi":556
 *         return _ListErrorLog([], None, None)
 * 
 *     def log(self, log_entry, message, *args):             # <<<<<<<<<<<<<<
 *         """log(self, log_entry, message, *args)
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.PyErrorLog.log", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":573
 *             )
 * 
 *     cpdef receive(self, _LogEntry log_entry):             # <<<<<<<<<<<<<<
 *         """receive(self, log_entry)
 * 
*/

static PyObject *__pyx_pw_4lxml_5etree_10PyErrorLog_7receive(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_4lxml_5etree_10PyErrorLog_receive(struct __pyx_obj_4lxml_5etree_PyErrorLog *__pyx_v_self, struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_log_entry, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("receive", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (
  #if !CYTHON_USE_TYPE_SLOTS
  unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_4lxml_5etree_PyErrorLog &&
  __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
  #else
  unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
  #endif
  ) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_receive); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 573, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_4lxml_5etree_10PyErrorLog_7receive)) {
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_3 = NULL;
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_4 = __pyx_t_1; 
        __pyx_t_5 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
          assert(__pyx_t_3);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
          __pyx_t_5 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_3, ((PyObject *)__pyx_v_log_entry)};
          __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 573, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
        }
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "src/lxml/xmlerror.pxi":584
 *         format.
 *         """
 *         self.log(log_entry, repr(log_entry))             # <<<<<<<<<<<<<<
 * 
 * # thread-local, global list log to collect error output messages from
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_4 = PyObject_Repr(((PyObject *)__pyx_v_log_entry)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 584, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_2, ((PyObject *)__pyx_v_log_entry), __pyx_t_4};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_log, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 584, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xmlerror.pxi":573
 *             )
 * 
 *     cpdef receive(self, _LogEntry log_entry):             # <<<<<<<<<<<<<<
 *         """receive(self, log_entry)
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.PyErrorLog.receive", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_10PyErrorLog_7receive(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_10PyErrorLog_6receive, "receive(self, log_entry)\n\n        Receive a _LogEntry instance from the logging system.  Calls\n        the .log() method with appropriate parameters::\n\n            self.log(log_entry, repr(log_entry))\n\n        You can override this method to provide your own log output\n        format.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_10PyErrorLog_7receive = {"receive", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_10PyErrorLog_7receive, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_10PyErrorLog_6receive};
static PyObject *__pyx_pw_4lxml_5etree_10PyErrorLog_7receive(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_log_entry = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("receive (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_log_entry,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 573, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 573, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "receive", 0) < (0)) __PYX_ERR(1, 573, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("receive", 1, 1, 1, i); __PYX_ERR(1, 573, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 573, __pyx_L3_error)
    }
    __pyx_v_log_entry = ((struct __pyx_obj_4lxml_5etree__LogEntry *)values[0]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("receive", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 573, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.PyErrorLog.receive", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_log_entry), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__LogEntry, 1, "log_entry", 0))) __PYX_ERR(1, 573, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_10PyErrorLog_6receive(((struct __pyx_obj_4lxml_5etree_PyErrorLog *)__pyx_v_self), __pyx_v_log_entry);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_10PyErrorLog_6receive(struct __pyx_obj_4lxml_5etree_PyErrorLog *__pyx_v_self, struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_log_entry) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("receive", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree_10PyErrorLog_receive(__pyx_v_self, __pyx_v_log_entry, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 573, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.PyErrorLog.receive", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":532
 *     with appropriate data.
 *     """
 *     cdef readonly dict level_map             # <<<<<<<<<<<<<<
 *     cdef object _map_level
 *     cdef object _log
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_10PyErrorLog_9level_map_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_10PyErrorLog_9level_map_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_10PyErrorLog_9level_map___get__(((struct __pyx_obj_4lxml_5etree_PyErrorLog *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_10PyErrorLog_9level_map___get__(struct __pyx_obj_4lxml_5etree_PyErrorLog *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->level_map);
  __pyx_r = __pyx_v_self->level_map;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":592
 * 
 * 
 * cdef _BaseErrorLog _getThreadErrorLog(name):             # <<<<<<<<<<<<<<
 *     """Retrieve the current error log with name 'name' of this thread."""
 *     cdef python.PyObject* thread_dict
*/

static struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_f_4lxml_5etree__getThreadErrorLog(PyObject *__pyx_v_name) {
  PyObject *__pyx_v_thread_dict;
  struct __pyx_obj_4lxml_5etree__RotatingErrorLog *__pyx_v_log = NULL;
  struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  size_t __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_getThreadErrorLog", 0);

  /* "src/lxml/xmlerror.pxi":595
 *     """Retrieve the current error log with name 'name' of this thread."""
 *     cdef python.PyObject* thread_dict
 *     thread_dict = python.PyThreadState_GetDict()             # <<<<<<<<<<<<<<
 *     if thread_dict is NULL:
 *         return __GLOBAL_ERROR_LOG
*/
  __pyx_v_thread_dict = PyThreadState_GetDict();

  /* "src/lxml/xmlerror.pxi":596
 *     cdef python.PyObject* thread_dict
 *     thread_dict = python.PyThreadState_GetDict()
 *     if thread_dict is NULL:             # <<<<<<<<<<<<<<
 *         return __GLOBAL_ERROR_LOG
 *     try:
*/
  __pyx_t_1 = (__pyx_v_thread_dict == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/xmlerror.pxi":597
 *     thread_dict = python.PyThreadState_GetDict()
 *     if thread_dict is NULL:
 *         return __GLOBAL_ERROR_LOG             # <<<<<<<<<<<<<<
 *     try:
 *         return (<object>thread_dict)[name]
*/
    __Pyx_XDECREF((PyObject *)__pyx_r);
    __Pyx_INCREF((PyObject *)__pyx_v_4lxml_5etree___GLOBAL_ERROR_LOG);
    __pyx_r = __pyx_v_4lxml_5etree___GLOBAL_ERROR_LOG;
    goto __pyx_L0;

    /* "src/lxml/xmlerror.pxi":596
 *     cdef python.PyObject* thread_dict
 *     thread_dict = python.PyThreadState_GetDict()
 *     if thread_dict is NULL:             # <<<<<<<<<<<<<<
 *         return __GLOBAL_ERROR_LOG
 *     try:
*/
  }

  /* "src/lxml/xmlerror.pxi":598
 *     if thread_dict is NULL:
 *         return __GLOBAL_ERROR_LOG
 *     try:             # <<<<<<<<<<<<<<
 *         return (<object>thread_dict)[name]
 *     except KeyError:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    /*try:*/ {

      /* "src/lxml/xmlerror.pxi":599
 *         return __GLOBAL_ERROR_LOG
 *     try:
 *         return (<object>thread_dict)[name]             # <<<<<<<<<<<<<<
 *     except KeyError:
 *         log = (<object>thread_dict)[name] = \
*/
      __Pyx_XDECREF((PyObject *)__pyx_r);
      __pyx_t_5 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_thread_dict), __pyx_v_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 599, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__BaseErrorLog))))) __PYX_ERR(1, 599, __pyx_L4_error)
      __pyx_r = ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_t_5);
      __pyx_t_5 = 0;
      goto __pyx_L8_try_return;

      /* "src/lxml/xmlerror.pxi":598
 *     if thread_dict is NULL:
 *         return __GLOBAL_ERROR_LOG
 *     try:             # <<<<<<<<<<<<<<
 *         return (<object>thread_dict)[name]
 *     except KeyError:
*/
    }
    __pyx_L4_error:;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "src/lxml/xmlerror.pxi":600
 *     try:
 *         return (<object>thread_dict)[name]
 *     except KeyError:             # <<<<<<<<<<<<<<
 *         log = (<object>thread_dict)[name] = \
 *               _RotatingErrorLog(__MAX_LOG_SIZE)
*/
    __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_KeyError))));
    if (__pyx_t_6) {
      __Pyx_AddTraceback("lxml.etree._getThreadErrorLog", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_7, &__pyx_t_8) < 0) __PYX_ERR(1, 600, __pyx_L6_except_error)
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);

      /* "src/lxml/xmlerror.pxi":602
 *     except KeyError:
 *         log = (<object>thread_dict)[name] = \
 *               _RotatingErrorLog(__MAX_LOG_SIZE)             # <<<<<<<<<<<<<<
 *         return log
 * 
*/
      __pyx_t_10 = NULL;
      __pyx_t_11 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_mstate_global->__pyx_int_100};
        __pyx_t_9 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__RotatingErrorLog, __pyx_callargs+__pyx_t_11, (2-__pyx_t_11) | (__pyx_t_11*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 602, __pyx_L6_except_error)
        __Pyx_GOTREF((PyObject *)__pyx_t_9);
      }
      __Pyx_INCREF(__pyx_t_9);
      __pyx_v_log = ((struct __pyx_obj_4lxml_5etree__RotatingErrorLog *)__pyx_t_9);

      /* "src/lxml/xmlerror.pxi":601
 *         return (<object>thread_dict)[name]
 *     except KeyError:
 *         log = (<object>thread_dict)[name] = \             # <<<<<<<<<<<<<<
 *               _RotatingErrorLog(__MAX_LOG_SIZE)
 *         return log
*/
      if (unlikely((PyObject_SetItem(((PyObject *)__pyx_v_thread_dict), __pyx_v_name, __pyx_t_9) < 0))) __PYX_ERR(1, 601, __pyx_L6_except_error)
      __Pyx_DECREF((PyObject *)__pyx_t_9); __pyx_t_9 = 0;

      /* "src/lxml/xmlerror.pxi":603
 *         log = (<object>thread_dict)[name] = \
 *               _RotatingErrorLog(__MAX_LOG_SIZE)
 *         return log             # <<<<<<<<<<<<<<
 * 
 * 
*/
      __Pyx_XDECREF((PyObject *)__pyx_r);
      __Pyx_INCREF((PyObject *)__pyx_v_log);
      __pyx_r = ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_log);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L7_except_return;
    }
    goto __pyx_L6_except_error;

    /* "src/lxml/xmlerror.pxi":598
 *     if thread_dict is NULL:
 *         return __GLOBAL_ERROR_LOG
 *     try:             # <<<<<<<<<<<<<<
 *         return (<object>thread_dict)[name]
 *     except KeyError:
*/
    __pyx_L6_except_error:;
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    goto __pyx_L1_error;
    __pyx_L8_try_return:;
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    goto __pyx_L0;
    __pyx_L7_except_return:;
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    goto __pyx_L0;
  }

  /* "src/lxml/xmlerror.pxi":592
 * 
 * 
 * cdef _BaseErrorLog _getThreadErrorLog(name):             # <<<<<<<<<<<<<<
 *     """Retrieve the current error log with name 'name' of this thread."""
 *     cdef python.PyObject* thread_dict
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("lxml.etree._getThreadErrorLog", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_log);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":606
 * 
 * 
 * cdef _setThreadErrorLog(name, _BaseErrorLog log):             # <<<<<<<<<<<<<<
 *     """Set the global error log of this thread."""
 *     cdef python.PyObject* thread_dict
*/

static PyObject *__pyx_f_4lxml_5etree__setThreadErrorLog(PyObject *__pyx_v_name, struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_log) {
  PyObject *__pyx_v_thread_dict;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_setThreadErrorLog", 0);

  /* "src/lxml/xmlerror.pxi":609
 *     """Set the global error log of this thread."""
 *     cdef python.PyObject* thread_dict
 *     thread_dict = python.PyThreadState_GetDict()             # <<<<<<<<<<<<<<
 *     if thread_dict is NULL:
 *         if name == GLOBAL_ERROR_LOG:
*/
  __pyx_v_thread_dict = PyThreadState_GetDict();

  /* "src/lxml/xmlerror.pxi":610
 *     cdef python.PyObject* thread_dict
 *     thread_dict = python.PyThreadState_GetDict()
 *     if thread_dict is NULL:             # <<<<<<<<<<<<<<
 *         if name == GLOBAL_ERROR_LOG:
 *             global __GLOBAL_ERROR_LOG
*/
  __pyx_t_1 = (__pyx_v_thread_dict == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/xmlerror.pxi":611
 *     thread_dict = python.PyThreadState_GetDict()
 *     if thread_dict is NULL:
 *         if name == GLOBAL_ERROR_LOG:             # <<<<<<<<<<<<<<
 *             global __GLOBAL_ERROR_LOG
 *             __GLOBAL_ERROR_LOG = log
*/
    __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_name, __pyx_mstate_global->__pyx_n_u_GlobalErrorLog, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 611, __pyx_L1_error)
    if (__pyx_t_1) {

      /* "src/lxml/xmlerror.pxi":613
 *         if name == GLOBAL_ERROR_LOG:
 *             global __GLOBAL_ERROR_LOG
 *             __GLOBAL_ERROR_LOG = log             # <<<<<<<<<<<<<<
 *     else:
 *         (<object>thread_dict)[name] = log
*/
      __Pyx_INCREF((PyObject *)__pyx_v_log);
      __Pyx_XGOTREF((PyObject *)__pyx_v_4lxml_5etree___GLOBAL_ERROR_LOG);
      __Pyx_DECREF_SET(__pyx_v_4lxml_5etree___GLOBAL_ERROR_LOG, __pyx_v_log);
      __Pyx_GIVEREF((PyObject *)__pyx_v_log);

      /* "src/lxml/xmlerror.pxi":611
 *     thread_dict = python.PyThreadState_GetDict()
 *     if thread_dict is NULL:
 *         if name == GLOBAL_ERROR_LOG:             # <<<<<<<<<<<<<<
 *             global __GLOBAL_ERROR_LOG
 *             __GLOBAL_ERROR_LOG = log
*/
    }

    /* "src/lxml/xmlerror.pxi":610
 *     cdef python.PyObject* thread_dict
 *     thread_dict = python.PyThreadState_GetDict()
 *     if thread_dict is NULL:             # <<<<<<<<<<<<<<
 *         if name == GLOBAL_ERROR_LOG:
 *             global __GLOBAL_ERROR_LOG
*/
    goto __pyx_L3;
  }

  /* "src/lxml/xmlerror.pxi":615
 *             __GLOBAL_ERROR_LOG = log
 *     else:
 *         (<object>thread_dict)[name] = log             # <<<<<<<<<<<<<<
 * 
 * 
*/
  /*else*/ {
    if (unlikely((PyObject_SetItem(((PyObject *)__pyx_v_thread_dict), __pyx_v_name, ((PyObject *)__pyx_v_log)) < 0))) __PYX_ERR(1, 615, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "src/lxml/xmlerror.pxi":606
 * 
 * 
 * cdef _setThreadErrorLog(name, _BaseErrorLog log):             # <<<<<<<<<<<<<<
 *     """Set the global error log of this thread."""
 *     cdef python.PyObject* thread_dict
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._setThreadErrorLog", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":618
 * 
 * 
 * cdef __copyGlobalErrorLog():             # <<<<<<<<<<<<<<
 *     "Helper function for properties in exceptions."
 *     return _getThreadErrorLog(GLOBAL_ERROR_LOG).copy()
*/

static PyObject *__pyx_f_4lxml_5etree___copyGlobalErrorLog(void) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__copyGlobalErrorLog", 0);

  /* "src/lxml/xmlerror.pxi":620
 * cdef __copyGlobalErrorLog():
 *     "Helper function for properties in exceptions."
 *     return _getThreadErrorLog(GLOBAL_ERROR_LOG).copy()             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__getThreadErrorLog(__pyx_mstate_global->__pyx_n_u_GlobalErrorLog)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 620, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseErrorLog *)((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_t_1)->__pyx_vtab)->copy(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_t_1), 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 620, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/xmlerror.pxi":618
 * 
 * 
 * cdef __copyGlobalErrorLog():             # <<<<<<<<<<<<<<
 *     "Helper function for properties in exceptions."
 *     return _getThreadErrorLog(GLOBAL_ERROR_LOG).copy()
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.__copyGlobalErrorLog", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":623
 * 
 * 
 * def use_global_python_log(PyErrorLog log not None):             # <<<<<<<<<<<<<<
 *     """use_global_python_log(log)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_5use_global_python_log(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_4use_global_python_log, "use_global_python_log(log)\n\n    Replace the global error log by an etree.PyErrorLog that uses the\n    standard Python logging package.\n\n    Note that this disables access to the global error log from exceptions.\n    Parsers, XSLT etc. will continue to provide their normal local error log.\n\n    Note: prior to lxml 2.2, this changed the error log globally.\n    Since lxml 2.2, the global error log is local to a thread and this\n    function will only set the global error log of the current thread.\n    ");
static PyMethodDef __pyx_mdef_4lxml_5etree_5use_global_python_log = {"use_global_python_log", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_5use_global_python_log, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_4use_global_python_log};
static PyObject *__pyx_pw_4lxml_5etree_5use_global_python_log(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct __pyx_obj_4lxml_5etree_PyErrorLog *__pyx_v_log = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("use_global_python_log (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_log,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 623, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 623, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "use_global_python_log", 0) < (0)) __PYX_ERR(1, 623, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("use_global_python_log", 1, 1, 1, i); __PYX_ERR(1, 623, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 623, __pyx_L3_error)
    }
    __pyx_v_log = ((struct __pyx_obj_4lxml_5etree_PyErrorLog *)values[0]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("use_global_python_log", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 623, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.use_global_python_log", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_log), __pyx_mstate_global->__pyx_ptype_4lxml_5etree_PyErrorLog, 0, "log", 0))) __PYX_ERR(1, 623, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_4use_global_python_log(__pyx_self, __pyx_v_log);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_4use_global_python_log(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_4lxml_5etree_PyErrorLog *__pyx_v_log) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("use_global_python_log", 0);

  /* "src/lxml/xmlerror.pxi":636
 *     function will only set the global error log of the current thread.
 *     """
 *     _setThreadErrorLog(GLOBAL_ERROR_LOG, log)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__setThreadErrorLog(__pyx_mstate_global->__pyx_n_u_GlobalErrorLog, ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_log)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 636, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xmlerror.pxi":623
 * 
 * 
 * def use_global_python_log(PyErrorLog log not None):             # <<<<<<<<<<<<<<
 *     """use_global_python_log(log)
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.use_global_python_log", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":640
 * 
 * # local log functions: forward error to logger object
 * cdef void _forwardError(void* c_log_handler, const xmlerror.xmlError* error) noexcept with gil:             # <<<<<<<<<<<<<<
 *     cdef _BaseErrorLog log_handler
 *     if c_log_handler is not NULL:
*/

static void __pyx_f_4lxml_5etree__forwardError(void *__pyx_v_c_log_handler, xmlError const *__pyx_v_error) {
  struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_log_handler = 0;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("_forwardError", 0);

  /* "src/lxml/xmlerror.pxi":642
 * cdef void _forwardError(void* c_log_handler, const xmlerror.xmlError* error) noexcept with gil:
 *     cdef _BaseErrorLog log_handler
 *     if c_log_handler is not NULL:             # <<<<<<<<<<<<<<
 *         log_handler = <_BaseErrorLog>c_log_handler
 *     elif error.domain == xmlerror.XML_FROM_XSLT:
*/
  __pyx_t_1 = (__pyx_v_c_log_handler != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/xmlerror.pxi":643
 *     cdef _BaseErrorLog log_handler
 *     if c_log_handler is not NULL:
 *         log_handler = <_BaseErrorLog>c_log_handler             # <<<<<<<<<<<<<<
 *     elif error.domain == xmlerror.XML_FROM_XSLT:
 *         log_handler = _getThreadErrorLog(XSLT_ERROR_LOG)
*/
    __pyx_t_2 = ((PyObject *)__pyx_v_c_log_handler);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v_log_handler = ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/xmlerror.pxi":642
 * cdef void _forwardError(void* c_log_handler, const xmlerror.xmlError* error) noexcept with gil:
 *     cdef _BaseErrorLog log_handler
 *     if c_log_handler is not NULL:             # <<<<<<<<<<<<<<
 *         log_handler = <_BaseErrorLog>c_log_handler
 *     elif error.domain == xmlerror.XML_FROM_XSLT:
*/
    goto __pyx_L3;
  }

  /* "src/lxml/xmlerror.pxi":644
 *     if c_log_handler is not NULL:
 *         log_handler = <_BaseErrorLog>c_log_handler
 *     elif error.domain == xmlerror.XML_FROM_XSLT:             # <<<<<<<<<<<<<<
 *         log_handler = _getThreadErrorLog(XSLT_ERROR_LOG)
 *     else:
*/
  __pyx_t_1 = (__pyx_v_error->domain == XML_FROM_XSLT);
  if (__pyx_t_1) {

    /* "src/lxml/xmlerror.pxi":645
 *         log_handler = <_BaseErrorLog>c_log_handler
 *     elif error.domain == xmlerror.XML_FROM_XSLT:
 *         log_handler = _getThreadErrorLog(XSLT_ERROR_LOG)             # <<<<<<<<<<<<<<
 *     else:
 *         log_handler = _getThreadErrorLog(GLOBAL_ERROR_LOG)
*/
    __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__getThreadErrorLog(__pyx_mstate_global->__pyx_n_u_XSLTErrorLog)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 645, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_log_handler = ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/xmlerror.pxi":644
 *     if c_log_handler is not NULL:
 *         log_handler = <_BaseErrorLog>c_log_handler
 *     elif error.domain == xmlerror.XML_FROM_XSLT:             # <<<<<<<<<<<<<<
 *         log_handler = _getThreadErrorLog(XSLT_ERROR_LOG)
 *     else:
*/
    goto __pyx_L3;
  }

  /* "src/lxml/xmlerror.pxi":647
 *         log_handler = _getThreadErrorLog(XSLT_ERROR_LOG)
 *     else:
 *         log_handler = _getThreadErrorLog(GLOBAL_ERROR_LOG)             # <<<<<<<<<<<<<<
 *     log_handler._receive(error)
 * 
*/
  /*else*/ {
    __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__getThreadErrorLog(__pyx_mstate_global->__pyx_n_u_GlobalErrorLog)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 647, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_log_handler = ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_t_2);
    __pyx_t_2 = 0;
  }
  __pyx_L3:;

  /* "src/lxml/xmlerror.pxi":648
 *     else:
 *         log_handler = _getThreadErrorLog(GLOBAL_ERROR_LOG)
 *     log_handler._receive(error)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_3 = __pyx_f_4lxml_5etree_13_BaseErrorLog__receive(__pyx_v_log_handler, __pyx_v_error); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 648, __pyx_L1_error)

  /* "src/lxml/xmlerror.pxi":640
 * 
 * # local log functions: forward error to logger object
 * cdef void _forwardError(void* c_log_handler, const xmlerror.xmlError* error) noexcept with gil:             # <<<<<<<<<<<<<<
 *     cdef _BaseErrorLog log_handler
 *     if c_log_handler is not NULL:
*/

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_WriteUnraisable("lxml.etree._forwardError", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_log_handler);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
}

/* "src/lxml/xmlerror.pxi":651
 * 
 * 
 * cdef void _receiveError(void* c_log_handler, const xmlerror.xmlError* error) noexcept nogil:             # <<<<<<<<<<<<<<
 *     # no Python objects here, may be called without thread context !
 *     if __DEBUG:
*/

static void __pyx_f_4lxml_5etree__receiveError(void *__pyx_v_c_log_handler, xmlError const *__pyx_v_error) {

  /* "src/lxml/xmlerror.pxi":654
 *     # no Python objects here, may be called without thread context !
 *     if __DEBUG:
 *         _forwardError(c_log_handler, error)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_f_4lxml_5etree__forwardError(__pyx_v_c_log_handler, __pyx_v_error);

  /* "src/lxml/xmlerror.pxi":651
 * 
 * 
 * cdef void _receiveError(void* c_log_handler, const xmlerror.xmlError* error) noexcept nogil:             # <<<<<<<<<<<<<<
 *     # no Python objects here, may be called without thread context !
 *     if __DEBUG:
*/

  /* function exit code */
}

/* "src/lxml/xmlerror.pxi":657
 * 
 * 
 * cdef void _receiveXSLTError(void* c_log_handler, char* msg, ...) noexcept nogil:             # <<<<<<<<<<<<<<
 *     # no Python objects here, may be called without thread context !
 *     cdef cvarargs.va_list args
*/

static void __pyx_f_4lxml_5etree__receiveXSLTError(void *__pyx_v_c_log_handler, char *__pyx_v_msg, ...) {
  va_list __pyx_v_args;

  /* "src/lxml/xmlerror.pxi":660
 *     # no Python objects here, may be called without thread context !
 *     cdef cvarargs.va_list args
 *     cvarargs.va_start(args, msg)             # <<<<<<<<<<<<<<
 *     _receiveGenericError(c_log_handler, xmlerror.XML_FROM_XSLT, msg, args)
 *     cvarargs.va_end(args)
*/
  va_start(__pyx_v_args, __pyx_v_msg);

  /* "src/lxml/xmlerror.pxi":661
 *     cdef cvarargs.va_list args
 *     cvarargs.va_start(args, msg)
 *     _receiveGenericError(c_log_handler, xmlerror.XML_FROM_XSLT, msg, args)             # <<<<<<<<<<<<<<
 *     cvarargs.va_end(args)
 * 
*/
  __pyx_f_4lxml_5etree__receiveGenericError(__pyx_v_c_log_handler, XML_FROM_XSLT, __pyx_v_msg, __pyx_v_args);

  /* "src/lxml/xmlerror.pxi":662
 *     cvarargs.va_start(args, msg)
 *     _receiveGenericError(c_log_handler, xmlerror.XML_FROM_XSLT, msg, args)
 *     cvarargs.va_end(args)             # <<<<<<<<<<<<<<
 * 
 * cdef void _receiveRelaxNGParseError(void* c_log_handler, char* msg, ...) noexcept nogil:
*/
  va_end(__pyx_v_args);

  /* "src/lxml/xmlerror.pxi":657
 * 
 * 
 * cdef void _receiveXSLTError(void* c_log_handler, char* msg, ...) noexcept nogil:             # <<<<<<<<<<<<<<
 *     # no Python objects here, may be called without thread context !
 *     cdef cvarargs.va_list args
*/

  /* function exit code */
}

/* "src/lxml/xmlerror.pxi":664
 *     cvarargs.va_end(args)
 * 
 * cdef void _receiveRelaxNGParseError(void* c_log_handler, char* msg, ...) noexcept nogil:             # <<<<<<<<<<<<<<
 *     # no Python objects here, may be called without thread context !
 *     cdef cvarargs.va_list args
*/

static void __pyx_f_4lxml_5etree__receiveRelaxNGParseError(void *__pyx_v_c_log_handler, char *__pyx_v_msg, ...) {
  va_list __pyx_v_args;

  /* "src/lxml/xmlerror.pxi":667
 *     # no Python objects here, may be called without thread context !
 *     cdef cvarargs.va_list args
 *     cvarargs.va_start(args, msg)             # <<<<<<<<<<<<<<
 *     _receiveGenericError(c_log_handler, xmlerror.XML_FROM_RELAXNGP, msg, args)
 *     cvarargs.va_end(args)
*/
  va_start(__pyx_v_args, __pyx_v_msg);

  /* "src/lxml/xmlerror.pxi":668
 *     cdef cvarargs.va_list args
 *     cvarargs.va_start(args, msg)
 *     _receiveGenericError(c_log_handler, xmlerror.XML_FROM_RELAXNGP, msg, args)             # <<<<<<<<<<<<<<
 *     cvarargs.va_end(args)
 * 
*/
  __pyx_f_4lxml_5etree__receiveGenericError(__pyx_v_c_log_handler, XML_FROM_RELAXNGP, __pyx_v_msg, __pyx_v_args);

  /* "src/lxml/xmlerror.pxi":669
 *     cvarargs.va_start(args, msg)
 *     _receiveGenericError(c_log_handler, xmlerror.XML_FROM_RELAXNGP, msg, args)
 *     cvarargs.va_end(args)             # <<<<<<<<<<<<<<
 * 
 * cdef void _receiveRelaxNGValidationError(void* c_log_handler, char* msg, ...) noexcept nogil:
*/
  va_end(__pyx_v_args);

  /* "src/lxml/xmlerror.pxi":664
 *     cvarargs.va_end(args)
 * 
 * cdef void _receiveRelaxNGParseError(void* c_log_handler, char* msg, ...) noexcept nogil:             # <<<<<<<<<<<<<<
 *     # no Python objects here, may be called without thread context !
 *     cdef cvarargs.va_list args
*/

  /* function exit code */
}

/* "src/lxml/xmlerror.pxi":671
 *     cvarargs.va_end(args)
 * 
 * cdef void _receiveRelaxNGValidationError(void* c_log_handler, char* msg, ...) noexcept nogil:             # <<<<<<<<<<<<<<
 *     # no Python objects here, may be called without thread context !
 *     cdef cvarargs.va_list args
*/

static void __pyx_f_4lxml_5etree__receiveRelaxNGValidationError(void *__pyx_v_c_log_handler, char *__pyx_v_msg, ...) {
  va_list __pyx_v_args;

  /* "src/lxml/xmlerror.pxi":674
 *     # no Python objects here, may be called without thread context !
 *     cdef cvarargs.va_list args
 *     cvarargs.va_start(args, msg)             # <<<<<<<<<<<<<<
 *     _receiveGenericError(c_log_handler, xmlerror.XML_FROM_RELAXNGV, msg, args)
 *     cvarargs.va_end(args)
*/
  va_start(__pyx_v_args, __pyx_v_msg);

  /* "src/lxml/xmlerror.pxi":675
 *     cdef cvarargs.va_list args
 *     cvarargs.va_start(args, msg)
 *     _receiveGenericError(c_log_handler, xmlerror.XML_FROM_RELAXNGV, msg, args)             # <<<<<<<<<<<<<<
 *     cvarargs.va_end(args)
 * 
*/
  __pyx_f_4lxml_5etree__receiveGenericError(__pyx_v_c_log_handler, XML_FROM_RELAXNGV, __pyx_v_msg, __pyx_v_args);

  /* "src/lxml/xmlerror.pxi":676
 *     cvarargs.va_start(args, msg)
 *     _receiveGenericError(c_log_handler, xmlerror.XML_FROM_RELAXNGV, msg, args)
 *     cvarargs.va_end(args)             # <<<<<<<<<<<<<<
 * 
 * # dummy function: no log output at all
*/
  va_end(__pyx_v_args);

  /* "src/lxml/xmlerror.pxi":671
 *     cvarargs.va_end(args)
 * 
 * cdef void _receiveRelaxNGValidationError(void* c_log_handler, char* msg, ...) noexcept nogil:             # <<<<<<<<<<<<<<
 *     # no Python objects here, may be called without thread context !
 *     cdef cvarargs.va_list args
*/

  /* function exit code */
}

/* "src/lxml/xmlerror.pxi":679
 * 
 * # dummy function: no log output at all
 * cdef void _nullGenericErrorFunc(void* ctxt, char* msg, ...) noexcept nogil:             # <<<<<<<<<<<<<<
 *     pass
 * 
*/

static void __pyx_f_4lxml_5etree__nullGenericErrorFunc(CYTHON_UNUSED void *__pyx_v_ctxt, CYTHON_UNUSED char *__pyx_v_msg, ...) {

  /* function exit code */
}

/* "src/lxml/xmlerror.pxi":683
 * 
 * 
 * cdef void _connectGenericErrorLog(log, int c_domain=-1) noexcept:             # <<<<<<<<<<<<<<
 *     cdef xmlerror.xmlGenericErrorFunc error_func = NULL
 *     c_log = <void*>log
*/

static void __pyx_f_4lxml_5etree__connectGenericErrorLog(PyObject *__pyx_v_log, struct __pyx_opt_args_4lxml_5etree__connectGenericErrorLog *__pyx_optional_args) {
  int __pyx_v_c_domain = ((int)-1);
  xmlGenericErrorFunc __pyx_v_error_func;
  void *__pyx_v_c_log;
  int __pyx_t_1;
  int __pyx_t_2;
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_c_domain = __pyx_optional_args->c_domain;
    }
  }

  /* "src/lxml/xmlerror.pxi":684
 * 
 * cdef void _connectGenericErrorLog(log, int c_domain=-1) noexcept:
 *     cdef xmlerror.xmlGenericErrorFunc error_func = NULL             # <<<<<<<<<<<<<<
 *     c_log = <void*>log
 *     if c_domain == xmlerror.XML_FROM_XSLT:
*/
  __pyx_v_error_func = NULL;

  /* "src/lxml/xmlerror.pxi":685
 * cdef void _connectGenericErrorLog(log, int c_domain=-1) noexcept:
 *     cdef xmlerror.xmlGenericErrorFunc error_func = NULL
 *     c_log = <void*>log             # <<<<<<<<<<<<<<
 *     if c_domain == xmlerror.XML_FROM_XSLT:
 *         error_func = <xmlerror.xmlGenericErrorFunc>_receiveXSLTError
*/
  __pyx_v_c_log = ((void *)__pyx_v_log);

  /* "src/lxml/xmlerror.pxi":686
 *     cdef xmlerror.xmlGenericErrorFunc error_func = NULL
 *     c_log = <void*>log
 *     if c_domain == xmlerror.XML_FROM_XSLT:             # <<<<<<<<<<<<<<
 *         error_func = <xmlerror.xmlGenericErrorFunc>_receiveXSLTError
 *     elif c_domain == xmlerror.XML_FROM_RELAXNGP:
*/
  switch (__pyx_v_c_domain) {
    case XML_FROM_XSLT:

    /* "src/lxml/xmlerror.pxi":687
 *     c_log = <void*>log
 *     if c_domain == xmlerror.XML_FROM_XSLT:
 *         error_func = <xmlerror.xmlGenericErrorFunc>_receiveXSLTError             # <<<<<<<<<<<<<<
 *     elif c_domain == xmlerror.XML_FROM_RELAXNGP:
 *         error_func = <xmlerror.xmlGenericErrorFunc>_receiveRelaxNGParseError
*/
    __pyx_v_error_func = ((xmlGenericErrorFunc)__pyx_f_4lxml_5etree__receiveXSLTError);

    /* "src/lxml/xmlerror.pxi":686
 *     cdef xmlerror.xmlGenericErrorFunc error_func = NULL
 *     c_log = <void*>log
 *     if c_domain == xmlerror.XML_FROM_XSLT:             # <<<<<<<<<<<<<<
 *         error_func = <xmlerror.xmlGenericErrorFunc>_receiveXSLTError
 *     elif c_domain == xmlerror.XML_FROM_RELAXNGP:
*/
    break;
    case XML_FROM_RELAXNGP:

    /* "src/lxml/xmlerror.pxi":689
 *         error_func = <xmlerror.xmlGenericErrorFunc>_receiveXSLTError
 *     elif c_domain == xmlerror.XML_FROM_RELAXNGP:
 *         error_func = <xmlerror.xmlGenericErrorFunc>_receiveRelaxNGParseError             # <<<<<<<<<<<<<<
 *     elif c_domain == xmlerror.XML_FROM_RELAXNGV:
 *         error_func = <xmlerror.xmlGenericErrorFunc>_receiveRelaxNGValidationError
*/
    __pyx_v_error_func = ((xmlGenericErrorFunc)__pyx_f_4lxml_5etree__receiveRelaxNGParseError);

    /* "src/lxml/xmlerror.pxi":688
 *     if c_domain == xmlerror.XML_FROM_XSLT:
 *         error_func = <xmlerror.xmlGenericErrorFunc>_receiveXSLTError
 *     elif c_domain == xmlerror.XML_FROM_RELAXNGP:             # <<<<<<<<<<<<<<
 *         error_func = <xmlerror.xmlGenericErrorFunc>_receiveRelaxNGParseError
 *     elif c_domain == xmlerror.XML_FROM_RELAXNGV:
*/
    break;
    case XML_FROM_RELAXNGV:

    /* "src/lxml/xmlerror.pxi":691
 *         error_func = <xmlerror.xmlGenericErrorFunc>_receiveRelaxNGParseError
 *     elif c_domain == xmlerror.XML_FROM_RELAXNGV:
 *         error_func = <xmlerror.xmlGenericErrorFunc>_receiveRelaxNGValidationError             # <<<<<<<<<<<<<<
 * 
 *     if log is None or error_func is NULL:
*/
    __pyx_v_error_func = ((xmlGenericErrorFunc)__pyx_f_4lxml_5etree__receiveRelaxNGValidationError);

    /* "src/lxml/xmlerror.pxi":690
 *     elif c_domain == xmlerror.XML_FROM_RELAXNGP:
 *         error_func = <xmlerror.xmlGenericErrorFunc>_receiveRelaxNGParseError
 *     elif c_domain == xmlerror.XML_FROM_RELAXNGV:             # <<<<<<<<<<<<<<
 *         error_func = <xmlerror.xmlGenericErrorFunc>_receiveRelaxNGValidationError
 * 
*/
    break;
    default: break;
  }

  /* "src/lxml/xmlerror.pxi":693
 *         error_func = <xmlerror.xmlGenericErrorFunc>_receiveRelaxNGValidationError
 * 
 *     if log is None or error_func is NULL:             # <<<<<<<<<<<<<<
 *         c_log = NULL
 *         error_func = <xmlerror.xmlGenericErrorFunc>_nullGenericErrorFunc
*/
  __pyx_t_2 = (__pyx_v_log == Py_None);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_error_func == NULL);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/xmlerror.pxi":694
 * 
 *     if log is None or error_func is NULL:
 *         c_log = NULL             # <<<<<<<<<<<<<<
 *         error_func = <xmlerror.xmlGenericErrorFunc>_nullGenericErrorFunc
 *     xmlerror.xmlSetGenericErrorFunc(c_log, error_func)
*/
    __pyx_v_c_log = NULL;

    /* "src/lxml/xmlerror.pxi":695
 *     if log is None or error_func is NULL:
 *         c_log = NULL
 *         error_func = <xmlerror.xmlGenericErrorFunc>_nullGenericErrorFunc             # <<<<<<<<<<<<<<
 *     xmlerror.xmlSetGenericErrorFunc(c_log, error_func)
 * 
*/
    __pyx_v_error_func = ((xmlGenericErrorFunc)__pyx_f_4lxml_5etree__nullGenericErrorFunc);

    /* "src/lxml/xmlerror.pxi":693
 *         error_func = <xmlerror.xmlGenericErrorFunc>_receiveRelaxNGValidationError
 * 
 *     if log is None or error_func is NULL:             # <<<<<<<<<<<<<<
 *         c_log = NULL
 *         error_func = <xmlerror.xmlGenericErrorFunc>_nullGenericErrorFunc
*/
  }

  /* "src/lxml/xmlerror.pxi":696
 *         c_log = NULL
 *         error_func = <xmlerror.xmlGenericErrorFunc>_nullGenericErrorFunc
 *     xmlerror.xmlSetGenericErrorFunc(c_log, error_func)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  xmlSetGenericErrorFunc(__pyx_v_c_log, __pyx_v_error_func);

  /* "src/lxml/xmlerror.pxi":683
 * 
 * 
 * cdef void _connectGenericErrorLog(log, int c_domain=-1) noexcept:             # <<<<<<<<<<<<<<
 *     cdef xmlerror.xmlGenericErrorFunc error_func = NULL
 *     c_log = <void*>log
*/

  /* function exit code */
}

/* "src/lxml/xmlerror.pxi":699
 * 
 * 
 * cdef void _receiveGenericError(void* c_log_handler, int c_domain,             # <<<<<<<<<<<<<<
 *                                char* msg, cvarargs.va_list args) noexcept nogil:
 *     # no Python objects here, may be called without thread context !
*/

static void __pyx_f_4lxml_5etree__receiveGenericError(void *__pyx_v_c_log_handler, int __pyx_v_c_domain, char *__pyx_v_msg, va_list __pyx_v_args) {
  xmlError __pyx_v_c_error;
  char *__pyx_v_c_text;
  char *__pyx_v_c_message;
  char *__pyx_v_c_element;
  char *__pyx_v_c_pos;
  char *__pyx_v_c_name_pos;
  char *__pyx_v_c_str;
  int __pyx_v_text_size;
  int __pyx_v_element_size;
  int __pyx_v_format_count;
  int __pyx_v_c_int;
  int __pyx_t_1;
  int __pyx_t_2;

  /* "src/lxml/xmlerror.pxi":710
 *     cdef char* c_str
 *     cdef int text_size, element_size, format_count, c_int
 *     if not __DEBUG or msg is NULL:             # <<<<<<<<<<<<<<
 *         return
 *     if msg[0] in b'\n\0':
*/
  __pyx_t_1 = (__pyx_v_msg == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/xmlerror.pxi":711
 *     cdef int text_size, element_size, format_count, c_int
 *     if not __DEBUG or msg is NULL:
 *         return             # <<<<<<<<<<<<<<
 *     if msg[0] in b'\n\0':
 *         return
*/
    goto __pyx_L0;

    /* "src/lxml/xmlerror.pxi":710
 *     cdef char* c_str
 *     cdef int text_size, element_size, format_count, c_int
 *     if not __DEBUG or msg is NULL:             # <<<<<<<<<<<<<<
 *         return
 *     if msg[0] in b'\n\0':
*/
  }

  /* "src/lxml/xmlerror.pxi":712
 *     if not __DEBUG or msg is NULL:
 *         return
 *     if msg[0] in b'\n\0':             # <<<<<<<<<<<<<<
 *         return
 * 
*/
  switch ((__pyx_v_msg[0])) {
    case '\x00':
    case '\n':

    /* "src/lxml/xmlerror.pxi":713
 *         return
 *     if msg[0] in b'\n\0':
 *         return             # <<<<<<<<<<<<<<
 * 
 *     c_text = c_element = c_error.file = c_error.node = NULL
*/
    goto __pyx_L0;

    /* "src/lxml/xmlerror.pxi":712
 *     if not __DEBUG or msg is NULL:
 *         return
 *     if msg[0] in b'\n\0':             # <<<<<<<<<<<<<<
 *         return
 * 
*/
    break;
    default: break;
  }

  /* "src/lxml/xmlerror.pxi":715
 *         return
 * 
 *     c_text = c_element = c_error.file = c_error.node = NULL             # <<<<<<<<<<<<<<
 *     c_error.line = 0
 * 
*/
  __pyx_v_c_text = NULL;
  __pyx_v_c_element = NULL;
  __pyx_v_c_error.file = NULL;
  __pyx_v_c_error.node = NULL;

  /* "src/lxml/xmlerror.pxi":716
 * 
 *     c_text = c_element = c_error.file = c_error.node = NULL
 *     c_error.line = 0             # <<<<<<<<<<<<<<
 * 
 *     # parse "NAME %s" chunks from the format string
*/
  __pyx_v_c_error.line = 0;

  /* "src/lxml/xmlerror.pxi":719
 * 
 *     # parse "NAME %s" chunks from the format string
 *     c_name_pos = c_pos = msg             # <<<<<<<<<<<<<<
 *     format_count = 0
 *     while c_pos[0]:
*/
  __pyx_v_c_name_pos = __pyx_v_msg;
  __pyx_v_c_pos = __pyx_v_msg;

  /* "src/lxml/xmlerror.pxi":720
 *     # parse "NAME %s" chunks from the format string
 *     c_name_pos = c_pos = msg
 *     format_count = 0             # <<<<<<<<<<<<<<
 *     while c_pos[0]:
 *         if c_pos[0] == b'%':
*/
  __pyx_v_format_count = 0;

  /* "src/lxml/xmlerror.pxi":721
 *     c_name_pos = c_pos = msg
 *     format_count = 0
 *     while c_pos[0]:             # <<<<<<<<<<<<<<
 *         if c_pos[0] == b'%':
 *             c_pos += 1
*/
  while (1) {
    __pyx_t_1 = ((__pyx_v_c_pos[0]) != 0);
    if (!__pyx_t_1) break;

    /* "src/lxml/xmlerror.pxi":722
 *     format_count = 0
 *     while c_pos[0]:
 *         if c_pos[0] == b'%':             # <<<<<<<<<<<<<<
 *             c_pos += 1
 *             if c_pos[0] == b's':  # "%s"
*/
    __pyx_t_1 = ((__pyx_v_c_pos[0]) == '%');
    if (__pyx_t_1) {

      /* "src/lxml/xmlerror.pxi":723
 *     while c_pos[0]:
 *         if c_pos[0] == b'%':
 *             c_pos += 1             # <<<<<<<<<<<<<<
 *             if c_pos[0] == b's':  # "%s"
 *                 format_count += 1
*/
      __pyx_v_c_pos = (__pyx_v_c_pos + 1);

      /* "src/lxml/xmlerror.pxi":724
 *         if c_pos[0] == b'%':
 *             c_pos += 1
 *             if c_pos[0] == b's':  # "%s"             # <<<<<<<<<<<<<<
 *                 format_count += 1
 *                 c_str = cvarargs.va_charptr(args)
*/
      __pyx_t_1 = ((__pyx_v_c_pos[0]) == 's');
      if (__pyx_t_1) {

        /* "src/lxml/xmlerror.pxi":725
 *             c_pos += 1
 *             if c_pos[0] == b's':  # "%s"
 *                 format_count += 1             # <<<<<<<<<<<<<<
 *                 c_str = cvarargs.va_charptr(args)
 *                 if c_pos == msg + 1:
*/
        __pyx_v_format_count = (__pyx_v_format_count + 1);

        /* "src/lxml/xmlerror.pxi":726
 *             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..."
*/
        __pyx_v_c_str = va_charptr(__pyx_v_args);

        /* "src/lxml/xmlerror.pxi":727
 *                 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] == b'e':
*/
        __pyx_t_1 = (__pyx_v_c_pos == (__pyx_v_msg + 1));
        if (__pyx_t_1) {

          /* "src/lxml/xmlerror.pxi":728
 *                 c_str = cvarargs.va_charptr(args)
 *                 if c_pos == msg + 1:
 *                     c_text = c_str  # msg == "%s..."             # <<<<<<<<<<<<<<
 *                 elif c_name_pos[0] == b'e':
 *                     if cstring_h.strncmp(c_name_pos, 'element %s', 10) == 0:
*/
          __pyx_v_c_text = __pyx_v_c_str;

          /* "src/lxml/xmlerror.pxi":727
 *                 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] == b'e':
*/
          goto __pyx_L8;
        }

        /* "src/lxml/xmlerror.pxi":729
 *                 if c_pos == msg + 1:
 *                     c_text = c_str  # msg == "%s..."
 *                 elif c_name_pos[0] == b'e':             # <<<<<<<<<<<<<<
 *                     if cstring_h.strncmp(c_name_pos, 'element %s', 10) == 0:
 *                         c_element = c_str
*/
        __pyx_t_1 = ((__pyx_v_c_name_pos[0]) == 'e');
        if (__pyx_t_1) {

          /* "src/lxml/xmlerror.pxi":730
 *                     c_text = c_str  # msg == "%s..."
 *                 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] == b'f':
*/
          __pyx_t_1 = (strncmp(__pyx_v_c_name_pos, __pyx_k_element_s, 10) == 0);
          if (__pyx_t_1) {

            /* "src/lxml/xmlerror.pxi":731
 *                 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] == b'f':
 *                     if cstring_h.strncmp(c_name_pos, 'file %s', 7) == 0:
*/
            __pyx_v_c_element = __pyx_v_c_str;

            /* "src/lxml/xmlerror.pxi":730
 *                     c_text = c_str  # msg == "%s..."
 *                 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] == b'f':
*/
          }

          /* "src/lxml/xmlerror.pxi":729
 *                 if c_pos == msg + 1:
 *                     c_text = c_str  # msg == "%s..."
 *                 elif c_name_pos[0] == b'e':             # <<<<<<<<<<<<<<
 *                     if cstring_h.strncmp(c_name_pos, 'element %s', 10) == 0:
 *                         c_element = c_str
*/
          goto __pyx_L8;
        }

        /* "src/lxml/xmlerror.pxi":732
 *                     if cstring_h.strncmp(c_name_pos, 'element %s', 10) == 0:
 *                         c_element = c_str
 *                 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',
*/
        __pyx_t_1 = ((__pyx_v_c_name_pos[0]) == 'f');
        if (__pyx_t_1) {

          /* "src/lxml/xmlerror.pxi":733
 *                         c_element = c_str
 *                 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:
*/
          __pyx_t_1 = (strncmp(__pyx_v_c_name_pos, __pyx_k_file_s, 7) == 0);
          if (__pyx_t_1) {

            /* "src/lxml/xmlerror.pxi":735
 *                     if cstring_h.strncmp(c_name_pos, 'file %s', 7) == 0:
 *                         if cstring_h.strncmp('string://__STRING__XSLT',
 *                                              c_str, 23) == 0:             # <<<<<<<<<<<<<<
 *                             c_str = '<xslt>'
 *                         c_error.file = c_str
*/
            __pyx_t_1 = (strncmp(__pyx_k_string___STRING__XSLT, __pyx_v_c_str, 23) == 0);

            /* "src/lxml/xmlerror.pxi":734
 *                 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 = '<xslt>'
*/
            if (__pyx_t_1) {

              /* "src/lxml/xmlerror.pxi":736
 *                         if cstring_h.strncmp('string://__STRING__XSLT',
 *                                              c_str, 23) == 0:
 *                             c_str = '<xslt>'             # <<<<<<<<<<<<<<
 *                         c_error.file = c_str
 *             elif c_pos[0] == b'd':  # "%d"
*/
              __pyx_v_c_str = ((char *)"<xslt>");

              /* "src/lxml/xmlerror.pxi":734
 *                 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 = '<xslt>'
*/
            }

            /* "src/lxml/xmlerror.pxi":737
 *                                              c_str, 23) == 0:
 *                             c_str = '<xslt>'
 *                         c_error.file = c_str             # <<<<<<<<<<<<<<
 *             elif c_pos[0] == b'd':  # "%d"
 *                 format_count += 1
*/
            __pyx_v_c_error.file = __pyx_v_c_str;

            /* "src/lxml/xmlerror.pxi":733
 *                         c_element = c_str
 *                 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:
*/
          }

          /* "src/lxml/xmlerror.pxi":732
 *                     if cstring_h.strncmp(c_name_pos, 'element %s', 10) == 0:
 *                         c_element = c_str
 *                 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',
*/
        }
        __pyx_L8:;

        /* "src/lxml/xmlerror.pxi":724
 *         if c_pos[0] == b'%':
 *             c_pos += 1
 *             if c_pos[0] == b's':  # "%s"             # <<<<<<<<<<<<<<
 *                 format_count += 1
 *                 c_str = cvarargs.va_charptr(args)
*/
        goto __pyx_L7;
      }

      /* "src/lxml/xmlerror.pxi":738
 *                             c_str = '<xslt>'
 *                         c_error.file = c_str
 *             elif c_pos[0] == b'd':  # "%d"             # <<<<<<<<<<<<<<
 *                 format_count += 1
 *                 c_int = cvarargs.va_int(args)
*/
      __pyx_t_1 = ((__pyx_v_c_pos[0]) == 'd');
      if (__pyx_t_1) {

        /* "src/lxml/xmlerror.pxi":739
 *                         c_error.file = c_str
 *             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:
*/
        __pyx_v_format_count = (__pyx_v_format_count + 1);

        /* "src/lxml/xmlerror.pxi":740
 *             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
*/
        __pyx_v_c_int = va_int(__pyx_v_args);

        /* "src/lxml/xmlerror.pxi":741
 *                 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] != b'%':  # "%%" == "%"
*/
        __pyx_t_1 = (strncmp(__pyx_v_c_name_pos, __pyx_k_line_d, 7) == 0);
        if (__pyx_t_1) {

          /* "src/lxml/xmlerror.pxi":742
 *                 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] != b'%':  # "%%" == "%"
 *                 format_count += 1
*/
          __pyx_v_c_error.line = __pyx_v_c_int;

          /* "src/lxml/xmlerror.pxi":741
 *                 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] != b'%':  # "%%" == "%"
*/
        }

        /* "src/lxml/xmlerror.pxi":738
 *                             c_str = '<xslt>'
 *                         c_error.file = c_str
 *             elif c_pos[0] == b'd':  # "%d"             # <<<<<<<<<<<<<<
 *                 format_count += 1
 *                 c_int = cvarargs.va_int(args)
*/
        goto __pyx_L7;
      }

      /* "src/lxml/xmlerror.pxi":743
 *                 if cstring_h.strncmp(c_name_pos, 'line %d', 7) == 0:
 *                     c_error.line = c_int
 *             elif c_pos[0] != b'%':  # "%%" == "%"             # <<<<<<<<<<<<<<
 *                 format_count += 1
 *                 break  # unexpected format or end of string => abort
*/
      __pyx_t_1 = ((__pyx_v_c_pos[0]) != '%');
      if (__pyx_t_1) {

        /* "src/lxml/xmlerror.pxi":744
 *                     c_error.line = c_int
 *             elif c_pos[0] != b'%':  # "%%" == "%"
 *                 format_count += 1             # <<<<<<<<<<<<<<
 *                 break  # unexpected format or end of string => abort
 *         elif c_pos[0] == b' ':
*/
        __pyx_v_format_count = (__pyx_v_format_count + 1);

        /* "src/lxml/xmlerror.pxi":745
 *             elif c_pos[0] != b'%':  # "%%" == "%"
 *                 format_count += 1
 *                 break  # unexpected format or end of string => abort             # <<<<<<<<<<<<<<
 *         elif c_pos[0] == b' ':
 *             if c_pos[1] != b'%':
*/
        goto __pyx_L5_break;

        /* "src/lxml/xmlerror.pxi":743
 *                 if cstring_h.strncmp(c_name_pos, 'line %d', 7) == 0:
 *                     c_error.line = c_int
 *             elif c_pos[0] != b'%':  # "%%" == "%"             # <<<<<<<<<<<<<<
 *                 format_count += 1
 *                 break  # unexpected format or end of string => abort
*/
      }
      __pyx_L7:;

      /* "src/lxml/xmlerror.pxi":722
 *     format_count = 0
 *     while c_pos[0]:
 *         if c_pos[0] == b'%':             # <<<<<<<<<<<<<<
 *             c_pos += 1
 *             if c_pos[0] == b's':  # "%s"
*/
      goto __pyx_L6;
    }

    /* "src/lxml/xmlerror.pxi":746
 *                 format_count += 1
 *                 break  # unexpected format or end of string => abort
 *         elif c_pos[0] == b' ':             # <<<<<<<<<<<<<<
 *             if c_pos[1] != b'%':
 *                 c_name_pos = c_pos + 1
*/
    __pyx_t_1 = ((__pyx_v_c_pos[0]) == ' ');
    if (__pyx_t_1) {

      /* "src/lxml/xmlerror.pxi":747
 *                 break  # unexpected format or end of string => abort
 *         elif c_pos[0] == b' ':
 *             if c_pos[1] != b'%':             # <<<<<<<<<<<<<<
 *                 c_name_pos = c_pos + 1
 *         c_pos += 1
*/
      __pyx_t_1 = ((__pyx_v_c_pos[1]) != '%');
      if (__pyx_t_1) {

        /* "src/lxml/xmlerror.pxi":748
 *         elif c_pos[0] == b' ':
 *             if c_pos[1] != b'%':
 *                 c_name_pos = c_pos + 1             # <<<<<<<<<<<<<<
 *         c_pos += 1
 * 
*/
        __pyx_v_c_name_pos = (__pyx_v_c_pos + 1);

        /* "src/lxml/xmlerror.pxi":747
 *                 break  # unexpected format or end of string => abort
 *         elif c_pos[0] == b' ':
 *             if c_pos[1] != b'%':             # <<<<<<<<<<<<<<
 *                 c_name_pos = c_pos + 1
 *         c_pos += 1
*/
      }

      /* "src/lxml/xmlerror.pxi":746
 *                 format_count += 1
 *                 break  # unexpected format or end of string => abort
 *         elif c_pos[0] == b' ':             # <<<<<<<<<<<<<<
 *             if c_pos[1] != b'%':
 *                 c_name_pos = c_pos + 1
*/
    }
    __pyx_L6:;

    /* "src/lxml/xmlerror.pxi":749
 *             if c_pos[1] != b'%':
 *                 c_name_pos = c_pos + 1
 *         c_pos += 1             # <<<<<<<<<<<<<<
 * 
 *     c_message = NULL
*/
    __pyx_v_c_pos = (__pyx_v_c_pos + 1);
  }
  __pyx_L5_break:;

  /* "src/lxml/xmlerror.pxi":751
 *         c_pos += 1
 * 
 *     c_message = NULL             # <<<<<<<<<<<<<<
 *     if c_text is NULL:
 *         if c_element is not NULL and format_count == 1:
*/
  __pyx_v_c_message = NULL;

  /* "src/lxml/xmlerror.pxi":752
 * 
 *     c_message = NULL
 *     if c_text is NULL:             # <<<<<<<<<<<<<<
 *         if c_element is not NULL and format_count == 1:
 *             # special case: a single occurrence of 'element %s'
*/
  __pyx_t_1 = (__pyx_v_c_text == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/xmlerror.pxi":753
 *     c_message = NULL
 *     if c_text is NULL:
 *         if c_element is not NULL and format_count == 1:             # <<<<<<<<<<<<<<
 *             # special case: a single occurrence of 'element %s'
 *             text_size    = cstring_h.strlen(msg)
*/
    __pyx_t_2 = (__pyx_v_c_element != NULL);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L16_bool_binop_done;
    }
    __pyx_t_2 = (__pyx_v_format_count == 1);
    __pyx_t_1 = __pyx_t_2;
    __pyx_L16_bool_binop_done:;
    if (__pyx_t_1) {

      /* "src/lxml/xmlerror.pxi":755
 *         if c_element is not NULL and format_count == 1:
 *             # special case: a single occurrence of 'element %s'
 *             text_size    = cstring_h.strlen(msg)             # <<<<<<<<<<<<<<
 *             element_size = cstring_h.strlen(c_element)
 *             c_message = <char*>stdlib.malloc(
*/
      __pyx_v_text_size = strlen(__pyx_v_msg);

      /* "src/lxml/xmlerror.pxi":756
 *             # special case: a single occurrence of 'element %s'
 *             text_size    = cstring_h.strlen(msg)
 *             element_size = cstring_h.strlen(c_element)             # <<<<<<<<<<<<<<
 *             c_message = <char*>stdlib.malloc(
 *                 (text_size + element_size + 1) * sizeof(char))
*/
      __pyx_v_element_size = strlen(__pyx_v_c_element);

      /* "src/lxml/xmlerror.pxi":757
 *             text_size    = cstring_h.strlen(msg)
 *             element_size = cstring_h.strlen(c_element)
 *             c_message = <char*>stdlib.malloc(             # <<<<<<<<<<<<<<
 *                 (text_size + element_size + 1) * sizeof(char))
 *             if c_message is not NULL:
*/
      __pyx_v_c_message = ((char *)malloc((((__pyx_v_text_size + __pyx_v_element_size) + 1) * (sizeof(char)))));

      /* "src/lxml/xmlerror.pxi":759
 *             c_message = <char*>stdlib.malloc(
 *                 (text_size + element_size + 1) * sizeof(char))
 *             if c_message is not NULL:             # <<<<<<<<<<<<<<
 *                 stdio.sprintf(c_message, msg, c_element)
 *                 c_error.message = c_message
*/
      __pyx_t_1 = (__pyx_v_c_message != NULL);
      if (__pyx_t_1) {

        /* "src/lxml/xmlerror.pxi":760
 *                 (text_size + element_size + 1) * sizeof(char))
 *             if c_message is not NULL:
 *                 stdio.sprintf(c_message, msg, c_element)             # <<<<<<<<<<<<<<
 *                 c_error.message = c_message
 *             else:
*/
        (void)(sprintf(__pyx_v_c_message, __pyx_v_msg, __pyx_v_c_element));

        /* "src/lxml/xmlerror.pxi":761
 *             if c_message is not NULL:
 *                 stdio.sprintf(c_message, msg, c_element)
 *                 c_error.message = c_message             # <<<<<<<<<<<<<<
 *             else:
 *                 # Out of memory, report at least the original message.
*/
        __pyx_v_c_error.message = __pyx_v_c_message;

        /* "src/lxml/xmlerror.pxi":759
 *             c_message = <char*>stdlib.malloc(
 *                 (text_size + element_size + 1) * sizeof(char))
 *             if c_message is not NULL:             # <<<<<<<<<<<<<<
 *                 stdio.sprintf(c_message, msg, c_element)
 *                 c_error.message = c_message
*/
        goto __pyx_L18;
      }

      /* "src/lxml/xmlerror.pxi":764
 *             else:
 *                 # Out of memory, report at least the original message.
 *                 c_error.message = msg             # <<<<<<<<<<<<<<
 *         else:
 *             c_error.message = ''
*/
      /*else*/ {
        __pyx_v_c_error.message = __pyx_v_msg;
      }
      __pyx_L18:;

      /* "src/lxml/xmlerror.pxi":753
 *     c_message = NULL
 *     if c_text is NULL:
 *         if c_element is not NULL and format_count == 1:             # <<<<<<<<<<<<<<
 *             # special case: a single occurrence of 'element %s'
 *             text_size    = cstring_h.strlen(msg)
*/
      goto __pyx_L15;
    }

    /* "src/lxml/xmlerror.pxi":766
 *                 c_error.message = msg
 *         else:
 *             c_error.message = ''             # <<<<<<<<<<<<<<
 *     elif c_element is NULL:
 *         c_error.message = c_text
*/
    /*else*/ {
      __pyx_v_c_error.message = ((char *)"");
    }
    __pyx_L15:;

    /* "src/lxml/xmlerror.pxi":752
 * 
 *     c_message = NULL
 *     if c_text is NULL:             # <<<<<<<<<<<<<<
 *         if c_element is not NULL and format_count == 1:
 *             # special case: a single occurrence of 'element %s'
*/
    goto __pyx_L14;
  }

  /* "src/lxml/xmlerror.pxi":767
 *         else:
 *             c_error.message = ''
 *     elif c_element is NULL:             # <<<<<<<<<<<<<<
 *         c_error.message = c_text
 *     else:
*/
  __pyx_t_1 = (__pyx_v_c_element == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/xmlerror.pxi":768
 *             c_error.message = ''
 *     elif c_element is NULL:
 *         c_error.message = c_text             # <<<<<<<<<<<<<<
 *     else:
 *         text_size    = cstring_h.strlen(c_text)
*/
    __pyx_v_c_error.message = __pyx_v_c_text;

    /* "src/lxml/xmlerror.pxi":767
 *         else:
 *             c_error.message = ''
 *     elif c_element is NULL:             # <<<<<<<<<<<<<<
 *         c_error.message = c_text
 *     else:
*/
    goto __pyx_L14;
  }

  /* "src/lxml/xmlerror.pxi":770
 *         c_error.message = c_text
 *     else:
 *         text_size    = cstring_h.strlen(c_text)             # <<<<<<<<<<<<<<
 *         element_size = cstring_h.strlen(c_element)
 *         c_message = <char*>stdlib.malloc(
*/
  /*else*/ {
    __pyx_v_text_size = strlen(__pyx_v_c_text);

    /* "src/lxml/xmlerror.pxi":771
 *     else:
 *         text_size    = cstring_h.strlen(c_text)
 *         element_size = cstring_h.strlen(c_element)             # <<<<<<<<<<<<<<
 *         c_message = <char*>stdlib.malloc(
 *             (text_size + 12 + element_size + 1) * sizeof(char))
*/
    __pyx_v_element_size = strlen(__pyx_v_c_element);

    /* "src/lxml/xmlerror.pxi":772
 *         text_size    = cstring_h.strlen(c_text)
 *         element_size = cstring_h.strlen(c_element)
 *         c_message = <char*>stdlib.malloc(             # <<<<<<<<<<<<<<
 *             (text_size + 12 + element_size + 1) * sizeof(char))
 *         if c_message is NULL:
*/
    __pyx_v_c_message = ((char *)malloc(((((__pyx_v_text_size + 12) + __pyx_v_element_size) + 1) * (sizeof(char)))));

    /* "src/lxml/xmlerror.pxi":774
 *         c_message = <char*>stdlib.malloc(
 *             (text_size + 12 + element_size + 1) * sizeof(char))
 *         if c_message is NULL:             # <<<<<<<<<<<<<<
 *             c_error.message = c_text
 *         else:
*/
    __pyx_t_1 = (__pyx_v_c_message == NULL);
    if (__pyx_t_1) {

      /* "src/lxml/xmlerror.pxi":775
 *             (text_size + 12 + element_size + 1) * sizeof(char))
 *         if c_message is NULL:
 *             c_error.message = c_text             # <<<<<<<<<<<<<<
 *         else:
 *             stdio.sprintf(c_message, "%s, element '%s'", c_text, c_element)
*/
      __pyx_v_c_error.message = __pyx_v_c_text;

      /* "src/lxml/xmlerror.pxi":774
 *         c_message = <char*>stdlib.malloc(
 *             (text_size + 12 + element_size + 1) * sizeof(char))
 *         if c_message is NULL:             # <<<<<<<<<<<<<<
 *             c_error.message = c_text
 *         else:
*/
      goto __pyx_L19;
    }

    /* "src/lxml/xmlerror.pxi":777
 *             c_error.message = c_text
 *         else:
 *             stdio.sprintf(c_message, "%s, element '%s'", c_text, c_element)             # <<<<<<<<<<<<<<
 *             c_error.message = c_message
 * 
*/
    /*else*/ {
      (void)(sprintf(__pyx_v_c_message, __pyx_k_s_element_s, __pyx_v_c_text, __pyx_v_c_element));

      /* "src/lxml/xmlerror.pxi":778
 *         else:
 *             stdio.sprintf(c_message, "%s, element '%s'", c_text, c_element)
 *             c_error.message = c_message             # <<<<<<<<<<<<<<
 * 
 *     c_error.domain = c_domain
*/
      __pyx_v_c_error.message = __pyx_v_c_message;
    }
    __pyx_L19:;
  }
  __pyx_L14:;

  /* "src/lxml/xmlerror.pxi":780
 *             c_error.message = c_message
 * 
 *     c_error.domain = c_domain             # <<<<<<<<<<<<<<
 *     c_error.code   = xmlerror.XML_ERR_OK    # what else?
 *     c_error.level  = xmlerror.XML_ERR_ERROR # what else?
*/
  __pyx_v_c_error.domain = __pyx_v_c_domain;

  /* "src/lxml/xmlerror.pxi":781
 * 
 *     c_error.domain = c_domain
 *     c_error.code   = xmlerror.XML_ERR_OK    # what else?             # <<<<<<<<<<<<<<
 *     c_error.level  = xmlerror.XML_ERR_ERROR # what else?
 *     c_error.int2   = 0
*/
  __pyx_v_c_error.code = XML_ERR_OK;

  /* "src/lxml/xmlerror.pxi":782
 *     c_error.domain = c_domain
 *     c_error.code   = xmlerror.XML_ERR_OK    # what else?
 *     c_error.level  = xmlerror.XML_ERR_ERROR # what else?             # <<<<<<<<<<<<<<
 *     c_error.int2   = 0
 * 
*/
  __pyx_v_c_error.level = XML_ERR_ERROR;

  /* "src/lxml/xmlerror.pxi":783
 *     c_error.code   = xmlerror.XML_ERR_OK    # what else?
 *     c_error.level  = xmlerror.XML_ERR_ERROR # what else?
 *     c_error.int2   = 0             # <<<<<<<<<<<<<<
 * 
 *     _forwardError(c_log_handler, &c_error)
*/
  __pyx_v_c_error.int2 = 0;

  /* "src/lxml/xmlerror.pxi":785
 *     c_error.int2   = 0
 * 
 *     _forwardError(c_log_handler, &c_error)             # <<<<<<<<<<<<<<
 * 
 *     if c_message is not NULL:
*/
  __pyx_f_4lxml_5etree__forwardError(__pyx_v_c_log_handler, (&__pyx_v_c_error));

  /* "src/lxml/xmlerror.pxi":787
 *     _forwardError(c_log_handler, &c_error)
 * 
 *     if c_message is not NULL:             # <<<<<<<<<<<<<<
 *         stdlib.free(c_message)
 * 
*/
  __pyx_t_1 = (__pyx_v_c_message != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/xmlerror.pxi":788
 * 
 *     if c_message is not NULL:
 *         stdlib.free(c_message)             # <<<<<<<<<<<<<<
 * 
 * ################################################################################
*/
    free(__pyx_v_c_message);

    /* "src/lxml/xmlerror.pxi":787
 *     _forwardError(c_log_handler, &c_error)
 * 
 *     if c_message is not NULL:             # <<<<<<<<<<<<<<
 *         stdlib.free(c_message)
 * 
*/
  }

  /* "src/lxml/xmlerror.pxi":699
 * 
 * 
 * cdef void _receiveGenericError(void* c_log_handler, int c_domain,             # <<<<<<<<<<<<<<
 *                                char* msg, cvarargs.va_list args) noexcept nogil:
 *     # no Python objects here, may be called without thread context !
*/

  /* function exit code */
  __pyx_L0:;
}

/* "src/lxml/xmlerror.pxi":794
 * ################################################################################
 * 
 * cdef __initErrorConstants():             # <<<<<<<<<<<<<<
 *     "Called at setup time to parse the constants and build the classes below."
 *     global __ERROR_LEVELS, __ERROR_DOMAINS, __PARSER_ERROR_TYPES, __RELAXNG_ERROR_TYPES
*/

static PyObject *__pyx_f_4lxml_5etree___initErrorConstants(void) {
  PyObject *__pyx_v_const_defs = NULL;
  PyObject *__pyx_v_cls = NULL;
  PyObject *__pyx_v_constants = NULL;
  PyObject *__pyx_v_reverse_dict = NULL;
  PyObject *__pyx_v_line = NULL;
  PyObject *__pyx_v_name = NULL;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  size_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  PyObject *(*__pyx_t_9)(PyObject *);
  int __pyx_t_10;
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *(*__pyx_t_13)(PyObject *);
  int __pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__initErrorConstants", 0);

  /* "src/lxml/xmlerror.pxi":797
 *     "Called at setup time to parse the constants and build the classes below."
 *     global __ERROR_LEVELS, __ERROR_DOMAINS, __PARSER_ERROR_TYPES, __RELAXNG_ERROR_TYPES
 *     const_defs = ((ErrorLevels,          __ERROR_LEVELS),             # <<<<<<<<<<<<<<
 *                   (ErrorDomains,         __ERROR_DOMAINS),
 *                   (ErrorTypes,           __PARSER_ERROR_TYPES),
*/
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_ErrorLevels); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 797, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 797, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1) != (0)) __PYX_ERR(1, 797, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_4lxml_5etree___ERROR_LEVELS);
  __Pyx_GIVEREF(__pyx_v_4lxml_5etree___ERROR_LEVELS);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_4lxml_5etree___ERROR_LEVELS) != (0)) __PYX_ERR(1, 797, __pyx_L1_error);
  __pyx_t_1 = 0;

  /* "src/lxml/xmlerror.pxi":798
 *     global __ERROR_LEVELS, __ERROR_DOMAINS, __PARSER_ERROR_TYPES, __RELAXNG_ERROR_TYPES
 *     const_defs = ((ErrorLevels,          __ERROR_LEVELS),
 *                   (ErrorDomains,         __ERROR_DOMAINS),             # <<<<<<<<<<<<<<
 *                   (ErrorTypes,           __PARSER_ERROR_TYPES),
 *                   (RelaxNGErrorTypes,    __RELAXNG_ERROR_TYPES))
*/
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_ErrorDomains); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 798, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 798, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1) != (0)) __PYX_ERR(1, 798, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_4lxml_5etree___ERROR_DOMAINS);
  __Pyx_GIVEREF(__pyx_v_4lxml_5etree___ERROR_DOMAINS);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_4lxml_5etree___ERROR_DOMAINS) != (0)) __PYX_ERR(1, 798, __pyx_L1_error);
  __pyx_t_1 = 0;

  /* "src/lxml/xmlerror.pxi":799
 *     const_defs = ((ErrorLevels,          __ERROR_LEVELS),
 *                   (ErrorDomains,         __ERROR_DOMAINS),
 *                   (ErrorTypes,           __PARSER_ERROR_TYPES),             # <<<<<<<<<<<<<<
 *                   (RelaxNGErrorTypes,    __RELAXNG_ERROR_TYPES))
 * 
*/
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_ErrorTypes); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 799, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 799, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1) != (0)) __PYX_ERR(1, 799, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_4lxml_5etree___PARSER_ERROR_TYPES);
  __Pyx_GIVEREF(__pyx_v_4lxml_5etree___PARSER_ERROR_TYPES);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_4lxml_5etree___PARSER_ERROR_TYPES) != (0)) __PYX_ERR(1, 799, __pyx_L1_error);
  __pyx_t_1 = 0;

  /* "src/lxml/xmlerror.pxi":800
 *                   (ErrorDomains,         __ERROR_DOMAINS),
 *                   (ErrorTypes,           __PARSER_ERROR_TYPES),
 *                   (RelaxNGErrorTypes,    __RELAXNG_ERROR_TYPES))             # <<<<<<<<<<<<<<
 * 
 *     for cls, constants in const_defs:
*/
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_RelaxNGErrorTypes); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 800, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 800, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1) != (0)) __PYX_ERR(1, 800, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_4lxml_5etree___RELAXNG_ERROR_TYPES);
  __Pyx_GIVEREF(__pyx_v_4lxml_5etree___RELAXNG_ERROR_TYPES);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_4lxml_5etree___RELAXNG_ERROR_TYPES) != (0)) __PYX_ERR(1, 800, __pyx_L1_error);
  __pyx_t_1 = 0;

  /* "src/lxml/xmlerror.pxi":797
 *     "Called at setup time to parse the constants and build the classes below."
 *     global __ERROR_LEVELS, __ERROR_DOMAINS, __PARSER_ERROR_TYPES, __RELAXNG_ERROR_TYPES
 *     const_defs = ((ErrorLevels,          __ERROR_LEVELS),             # <<<<<<<<<<<<<<
 *                   (ErrorDomains,         __ERROR_DOMAINS),
 *                   (ErrorTypes,           __PARSER_ERROR_TYPES),
*/
  __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 797, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2) != (0)) __PYX_ERR(1, 797, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_3);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3) != (0)) __PYX_ERR(1, 797, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_4);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_4) != (0)) __PYX_ERR(1, 797, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_5);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_5) != (0)) __PYX_ERR(1, 797, __pyx_L1_error);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_v_const_defs = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xmlerror.pxi":802
 *                   (RelaxNGErrorTypes,    __RELAXNG_ERROR_TYPES))
 * 
 *     for cls, constants in const_defs:             # <<<<<<<<<<<<<<
 *         reverse_dict = {}
 *         cls._names   = reverse_dict
*/
  __pyx_t_1 = __pyx_v_const_defs; __Pyx_INCREF(__pyx_t_1);
  __pyx_t_6 = 0;
  for (;;) {
    {
      Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
      #if !CYTHON_ASSUME_SAFE_SIZE
      if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 802, __pyx_L1_error)
      #endif
      if (__pyx_t_6 >= __pyx_temp) break;
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_6));
    #else
    __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_6);
    #endif
    ++__pyx_t_6;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 802, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (likely(__pyx_t_5 != Py_None)) {
      PyObject* sequence = __pyx_t_5;
      Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(1, 802, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
      __Pyx_INCREF(__pyx_t_4);
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
      __Pyx_INCREF(__pyx_t_3);
      #else
      __pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 802, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 802, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      #endif
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 802, __pyx_L1_error)
    }
    __Pyx_XDECREF_SET(__pyx_v_cls, __pyx_t_4);
    __pyx_t_4 = 0;
    __Pyx_XDECREF_SET(__pyx_v_constants, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/xmlerror.pxi":803
 * 
 *     for cls, constants in const_defs:
 *         reverse_dict = {}             # <<<<<<<<<<<<<<
 *         cls._names   = reverse_dict
 *         cls._getName = reverse_dict.get
*/
    __pyx_t_5 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 803, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_XDECREF_SET(__pyx_v_reverse_dict, ((PyObject*)__pyx_t_5));
    __pyx_t_5 = 0;

    /* "src/lxml/xmlerror.pxi":804
 *     for cls, constants in const_defs:
 *         reverse_dict = {}
 *         cls._names   = reverse_dict             # <<<<<<<<<<<<<<
 *         cls._getName = reverse_dict.get
 *         for line in constants.splitlines():
*/
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_cls, __pyx_mstate_global->__pyx_n_u_names, __pyx_v_reverse_dict) < (0)) __PYX_ERR(1, 804, __pyx_L1_error)

    /* "src/lxml/xmlerror.pxi":805
 *         reverse_dict = {}
 *         cls._names   = reverse_dict
 *         cls._getName = reverse_dict.get             # <<<<<<<<<<<<<<
 *         for line in constants.splitlines():
 *             if not line:
*/
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_reverse_dict, __pyx_mstate_global->__pyx_n_u_get); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 805, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_cls, __pyx_mstate_global->__pyx_n_u_getName, __pyx_t_5) < (0)) __PYX_ERR(1, 805, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "src/lxml/xmlerror.pxi":806
 *         cls._names   = reverse_dict
 *         cls._getName = reverse_dict.get
 *         for line in constants.splitlines():             # <<<<<<<<<<<<<<
 *             if not line:
 *                 continue
*/
    __pyx_t_3 = __pyx_v_constants;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_7 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_5 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_splitlines, __pyx_callargs+__pyx_t_7, (1-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 806, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    }
    if (likely(PyList_CheckExact(__pyx_t_5)) || PyTuple_CheckExact(__pyx_t_5)) {
      __pyx_t_3 = __pyx_t_5; __Pyx_INCREF(__pyx_t_3);
      __pyx_t_8 = 0;
      __pyx_t_9 = NULL;
    } else {
      __pyx_t_8 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 806, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_9 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 806, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    for (;;) {
      if (likely(!__pyx_t_9)) {
        if (likely(PyList_CheckExact(__pyx_t_3))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 806, __pyx_L1_error)
            #endif
            if (__pyx_t_8 >= __pyx_temp) break;
          }
          __pyx_t_5 = __Pyx_PyList_GetItemRefFast(__pyx_t_3, __pyx_t_8, __Pyx_ReferenceSharing_OwnStrongReference);
          ++__pyx_t_8;
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 806, __pyx_L1_error)
            #endif
            if (__pyx_t_8 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_8));
          #else
          __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_8);
          #endif
          ++__pyx_t_8;
        }
        if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 806, __pyx_L1_error)
      } else {
        __pyx_t_5 = __pyx_t_9(__pyx_t_3);
        if (unlikely(!__pyx_t_5)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(1, 806, __pyx_L1_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_XDECREF_SET(__pyx_v_line, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "src/lxml/xmlerror.pxi":807
 *         cls._getName = reverse_dict.get
 *         for line in constants.splitlines():
 *             if not line:             # <<<<<<<<<<<<<<
 *                 continue
 *             name, value = line.split('=')
*/
      __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_v_line); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(1, 807, __pyx_L1_error)
      __pyx_t_11 = (!__pyx_t_10);
      if (__pyx_t_11) {

        /* "src/lxml/xmlerror.pxi":808
 *         for line in constants.splitlines():
 *             if not line:
 *                 continue             # <<<<<<<<<<<<<<
 *             name, value = line.split('=')
 *             value = int(value)
*/
        goto __pyx_L5_continue;

        /* "src/lxml/xmlerror.pxi":807
 *         cls._getName = reverse_dict.get
 *         for line in constants.splitlines():
 *             if not line:             # <<<<<<<<<<<<<<
 *                 continue
 *             name, value = line.split('=')
*/
      }

      /* "src/lxml/xmlerror.pxi":809
 *             if not line:
 *                 continue
 *             name, value = line.split('=')             # <<<<<<<<<<<<<<
 *             value = int(value)
 *             setattr(cls, name, value)
*/
      __pyx_t_4 = __pyx_v_line;
      __Pyx_INCREF(__pyx_t_4);
      __pyx_t_7 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u__13};
        __pyx_t_5 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_split, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 809, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
      }
      if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
        PyObject* sequence = __pyx_t_5;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(1, 809, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
          __Pyx_INCREF(__pyx_t_4);
          __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
          __Pyx_INCREF(__pyx_t_2);
        } else {
          __pyx_t_4 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
          if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 809, __pyx_L1_error)
          __Pyx_XGOTREF(__pyx_t_4);
          __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
          if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 809, __pyx_L1_error)
          __Pyx_XGOTREF(__pyx_t_2);
        }
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 809, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 809, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_12 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 809, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_13 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_12);
        index = 0; __pyx_t_4 = __pyx_t_13(__pyx_t_12); if (unlikely(!__pyx_t_4)) goto __pyx_L8_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_4);
        index = 1; __pyx_t_2 = __pyx_t_13(__pyx_t_12); if (unlikely(!__pyx_t_2)) goto __pyx_L8_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_2);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_12), 2) < (0)) __PYX_ERR(1, 809, __pyx_L1_error)
        __pyx_t_13 = NULL;
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        goto __pyx_L9_unpacking_done;
        __pyx_L8_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __pyx_t_13 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(1, 809, __pyx_L1_error)
        __pyx_L9_unpacking_done:;
      }
      __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_4);
      __pyx_t_4 = 0;
      __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "src/lxml/xmlerror.pxi":810
 *                 continue
 *             name, value = line.split('=')
 *             value = int(value)             # <<<<<<<<<<<<<<
 *             setattr(cls, name, value)
 *             reverse_dict[value] = name
*/
      __pyx_t_5 = __Pyx_PyNumber_Int(__pyx_v_value); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 810, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "src/lxml/xmlerror.pxi":811
 *             name, value = line.split('=')
 *             value = int(value)
 *             setattr(cls, name, value)             # <<<<<<<<<<<<<<
 *             reverse_dict[value] = name
 * 
*/
      __pyx_t_14 = PyObject_SetAttr(__pyx_v_cls, __pyx_v_name, __pyx_v_value); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(1, 811, __pyx_L1_error)

      /* "src/lxml/xmlerror.pxi":812
 *             value = int(value)
 *             setattr(cls, name, value)
 *             reverse_dict[value] = name             # <<<<<<<<<<<<<<
 * 
 *     # discard the global string references after use
*/
      if (unlikely((PyDict_SetItem(__pyx_v_reverse_dict, __pyx_v_value, __pyx_v_name) < 0))) __PYX_ERR(1, 812, __pyx_L1_error)

      /* "src/lxml/xmlerror.pxi":806
 *         cls._names   = reverse_dict
 *         cls._getName = reverse_dict.get
 *         for line in constants.splitlines():             # <<<<<<<<<<<<<<
 *             if not line:
 *                 continue
*/
      __pyx_L5_continue:;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/xmlerror.pxi":802
 *                   (RelaxNGErrorTypes,    __RELAXNG_ERROR_TYPES))
 * 
 *     for cls, constants in const_defs:             # <<<<<<<<<<<<<<
 *         reverse_dict = {}
 *         cls._names   = reverse_dict
*/
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xmlerror.pxi":815
 * 
 *     # discard the global string references after use
 *     __ERROR_LEVELS = __ERROR_DOMAINS = __PARSER_ERROR_TYPES = __RELAXNG_ERROR_TYPES = None             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_INCREF(Py_None);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree___ERROR_LEVELS);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree___ERROR_LEVELS, Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_INCREF(Py_None);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree___ERROR_DOMAINS);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree___ERROR_DOMAINS, Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_INCREF(Py_None);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree___PARSER_ERROR_TYPES);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree___PARSER_ERROR_TYPES, Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_INCREF(Py_None);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree___RELAXNG_ERROR_TYPES);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree___RELAXNG_ERROR_TYPES, Py_None);
  __Pyx_GIVEREF(Py_None);

  /* "src/lxml/xmlerror.pxi":794
 * ################################################################################
 * 
 * cdef __initErrorConstants():             # <<<<<<<<<<<<<<
 *     "Called at setup time to parse the constants and build the classes below."
 *     global __ERROR_LEVELS, __ERROR_DOMAINS, __PARSER_ERROR_TYPES, __RELAXNG_ERROR_TYPES
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("lxml.etree.__initErrorConstants", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_const_defs);
  __Pyx_XDECREF(__pyx_v_cls);
  __Pyx_XDECREF(__pyx_v_constants);
  __Pyx_XDECREF(__pyx_v_reverse_dict);
  __Pyx_XDECREF(__pyx_v_line);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":483
 *     cdef _BaseParser _parser
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         # if there are no more references to the document, it is safe
 *         # to clean the whole thing up, as all nodes have a reference to
*/

/* Python wrapper */
static void __pyx_pw_4lxml_5etree_9_Document_1__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_4lxml_5etree_9_Document_1__dealloc__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_pf_4lxml_5etree_9_Document___dealloc__(((struct LxmlDocument *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_4lxml_5etree_9_Document___dealloc__(struct LxmlDocument *__pyx_v_self) {

  /* "lxml/etree.pyx":487
 *         # to clean the whole thing up, as all nodes have a reference to
 *         # the document
 *         tree.xmlFreeDoc(self._c_doc)             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
*/
  xmlFreeDoc(__pyx_v_self->_c_doc);

  /* "lxml/etree.pyx":483
 *     cdef _BaseParser _parser
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         # if there are no more references to the document, it is safe
 *         # to clean the whole thing up, as all nodes have a reference to
*/

  /* function exit code */
}

/* "lxml/etree.pyx":489
 *         tree.xmlFreeDoc(self._c_doc)
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef getroot(self):
 *         # return an element proxy for the document root
*/

static PyObject *__pyx_f_4lxml_5etree_9_Document_getroot(struct LxmlDocument *__pyx_v_self) {
  xmlNode *__pyx_v_c_node;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getroot", 0);

  /* "lxml/etree.pyx":493
 *         # return an element proxy for the document root
 *         cdef xmlNode* c_node
 *         c_node = tree.xmlDocGetRootElement(self._c_doc)             # <<<<<<<<<<<<<<
 *         if c_node is NULL:
 *             return None
*/
  __pyx_v_c_node = xmlDocGetRootElement(__pyx_v_self->_c_doc);

  /* "lxml/etree.pyx":494
 *         cdef xmlNode* c_node
 *         c_node = tree.xmlDocGetRootElement(self._c_doc)
 *         if c_node is NULL:             # <<<<<<<<<<<<<<
 *             return None
 *         return _elementFactory(self, c_node)
*/
  __pyx_t_1 = (__pyx_v_c_node == NULL);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":495
 *         c_node = tree.xmlDocGetRootElement(self._c_doc)
 *         if c_node is NULL:
 *             return None             # <<<<<<<<<<<<<<
 *         return _elementFactory(self, c_node)
 * 
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "lxml/etree.pyx":494
 *         cdef xmlNode* c_node
 *         c_node = tree.xmlDocGetRootElement(self._c_doc)
 *         if c_node is NULL:             # <<<<<<<<<<<<<<
 *             return None
 *         return _elementFactory(self, c_node)
*/
  }

  /* "lxml/etree.pyx":496
 *         if c_node is NULL:
 *             return None
 *         return _elementFactory(self, c_node)             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(__pyx_v_self, __pyx_v_c_node)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 496, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":489
 *         tree.xmlFreeDoc(self._c_doc)
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef getroot(self):
 *         # return an element proxy for the document root
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Document.getroot", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":498
 *         return _elementFactory(self, c_node)
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef bint hasdoctype(self) noexcept:
 *         # DOCTYPE gets parsed into internal subset (xmlDTD*)
*/

static int __pyx_f_4lxml_5etree_9_Document_hasdoctype(struct LxmlDocument *__pyx_v_self) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;

  /* "lxml/etree.pyx":501
 *     cdef bint hasdoctype(self) noexcept:
 *         # DOCTYPE gets parsed into internal subset (xmlDTD*)
 *         return self._c_doc is not NULL and self._c_doc.intSubset is not NULL             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
*/
  __pyx_t_2 = (__pyx_v_self->_c_doc != NULL);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L3_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_self->_c_doc->intSubset != NULL);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L3_bool_binop_done:;
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  /* "lxml/etree.pyx":498
 *         return _elementFactory(self, c_node)
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef bint hasdoctype(self) noexcept:
 *         # DOCTYPE gets parsed into internal subset (xmlDTD*)
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "lxml/etree.pyx":503
 *         return self._c_doc is not NULL and self._c_doc.intSubset is not NULL
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef getdoctype(self):
 *         # get doctype info: root tag, public/system ID (or None if not known)
*/

static PyObject *__pyx_f_4lxml_5etree_9_Document_getdoctype(struct LxmlDocument *__pyx_v_self) {
  xmlDtd *__pyx_v_c_dtd;
  xmlNode *__pyx_v_c_root_node;
  PyObject *__pyx_v_public_id = NULL;
  PyObject *__pyx_v_sys_url = NULL;
  PyObject *__pyx_v_root_name = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  xmlDtd *__pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getdoctype", 0);

  /* "lxml/etree.pyx":508
 *         cdef tree.xmlDtd* c_dtd
 *         cdef xmlNode* c_root_node
 *         public_id = None             # <<<<<<<<<<<<<<
 *         sys_url   = None
 *         c_dtd = self._c_doc.intSubset
*/
  __Pyx_INCREF(Py_None);
  __pyx_v_public_id = ((PyObject*)Py_None);

  /* "lxml/etree.pyx":509
 *         cdef xmlNode* c_root_node
 *         public_id = None
 *         sys_url   = None             # <<<<<<<<<<<<<<
 *         c_dtd = self._c_doc.intSubset
 *         if c_dtd is not NULL:
*/
  __Pyx_INCREF(Py_None);
  __pyx_v_sys_url = ((PyObject*)Py_None);

  /* "lxml/etree.pyx":510
 *         public_id = None
 *         sys_url   = None
 *         c_dtd = self._c_doc.intSubset             # <<<<<<<<<<<<<<
 *         if c_dtd is not NULL:
 *             if c_dtd.ExternalID is not NULL:
*/
  __pyx_t_1 = __pyx_v_self->_c_doc->intSubset;
  __pyx_v_c_dtd = __pyx_t_1;

  /* "lxml/etree.pyx":511
 *         sys_url   = None
 *         c_dtd = self._c_doc.intSubset
 *         if c_dtd is not NULL:             # <<<<<<<<<<<<<<
 *             if c_dtd.ExternalID is not NULL:
 *                 public_id = funicode(c_dtd.ExternalID)
*/
  __pyx_t_2 = (__pyx_v_c_dtd != NULL);
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":512
 *         c_dtd = self._c_doc.intSubset
 *         if c_dtd is not NULL:
 *             if c_dtd.ExternalID is not NULL:             # <<<<<<<<<<<<<<
 *                 public_id = funicode(c_dtd.ExternalID)
 *             if c_dtd.SystemID is not NULL:
*/
    __pyx_t_2 = (__pyx_v_c_dtd->ExternalID != NULL);
    if (__pyx_t_2) {

      /* "lxml/etree.pyx":513
 *         if c_dtd is not NULL:
 *             if c_dtd.ExternalID is not NULL:
 *                 public_id = funicode(c_dtd.ExternalID)             # <<<<<<<<<<<<<<
 *             if c_dtd.SystemID is not NULL:
 *                 sys_url = funicode(c_dtd.SystemID)
*/
      __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_dtd->ExternalID); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 513, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_public_id, ((PyObject*)__pyx_t_3));
      __pyx_t_3 = 0;

      /* "lxml/etree.pyx":512
 *         c_dtd = self._c_doc.intSubset
 *         if c_dtd is not NULL:
 *             if c_dtd.ExternalID is not NULL:             # <<<<<<<<<<<<<<
 *                 public_id = funicode(c_dtd.ExternalID)
 *             if c_dtd.SystemID is not NULL:
*/
    }

    /* "lxml/etree.pyx":514
 *             if c_dtd.ExternalID is not NULL:
 *                 public_id = funicode(c_dtd.ExternalID)
 *             if c_dtd.SystemID is not NULL:             # <<<<<<<<<<<<<<
 *                 sys_url = funicode(c_dtd.SystemID)
 *         c_dtd = self._c_doc.extSubset
*/
    __pyx_t_2 = (__pyx_v_c_dtd->SystemID != NULL);
    if (__pyx_t_2) {

      /* "lxml/etree.pyx":515
 *                 public_id = funicode(c_dtd.ExternalID)
 *             if c_dtd.SystemID is not NULL:
 *                 sys_url = funicode(c_dtd.SystemID)             # <<<<<<<<<<<<<<
 *         c_dtd = self._c_doc.extSubset
 *         if c_dtd is not NULL:
*/
      __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_dtd->SystemID); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 515, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_sys_url, ((PyObject*)__pyx_t_3));
      __pyx_t_3 = 0;

      /* "lxml/etree.pyx":514
 *             if c_dtd.ExternalID is not NULL:
 *                 public_id = funicode(c_dtd.ExternalID)
 *             if c_dtd.SystemID is not NULL:             # <<<<<<<<<<<<<<
 *                 sys_url = funicode(c_dtd.SystemID)
 *         c_dtd = self._c_doc.extSubset
*/
    }

    /* "lxml/etree.pyx":511
 *         sys_url   = None
 *         c_dtd = self._c_doc.intSubset
 *         if c_dtd is not NULL:             # <<<<<<<<<<<<<<
 *             if c_dtd.ExternalID is not NULL:
 *                 public_id = funicode(c_dtd.ExternalID)
*/
  }

  /* "lxml/etree.pyx":516
 *             if c_dtd.SystemID is not NULL:
 *                 sys_url = funicode(c_dtd.SystemID)
 *         c_dtd = self._c_doc.extSubset             # <<<<<<<<<<<<<<
 *         if c_dtd is not NULL:
 *             if not public_id and c_dtd.ExternalID is not NULL:
*/
  __pyx_t_1 = __pyx_v_self->_c_doc->extSubset;
  __pyx_v_c_dtd = __pyx_t_1;

  /* "lxml/etree.pyx":517
 *                 sys_url = funicode(c_dtd.SystemID)
 *         c_dtd = self._c_doc.extSubset
 *         if c_dtd is not NULL:             # <<<<<<<<<<<<<<
 *             if not public_id and c_dtd.ExternalID is not NULL:
 *                 public_id = funicode(c_dtd.ExternalID)
*/
  __pyx_t_2 = (__pyx_v_c_dtd != NULL);
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":518
 *         c_dtd = self._c_doc.extSubset
 *         if c_dtd is not NULL:
 *             if not public_id and c_dtd.ExternalID is not NULL:             # <<<<<<<<<<<<<<
 *                 public_id = funicode(c_dtd.ExternalID)
 *             if not sys_url and c_dtd.SystemID is not NULL:
*/
    if (__pyx_v_public_id == Py_None) __pyx_t_4 = 0;
    else
    {
      Py_ssize_t __pyx_temp = __Pyx_PyUnicode_IS_TRUE(__pyx_v_public_id);
      if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(0, 518, __pyx_L1_error)
      __pyx_t_4 = (__pyx_temp != 0);
    }

    __pyx_t_5 = (!__pyx_t_4);
    if (__pyx_t_5) {
    } else {
      __pyx_t_2 = __pyx_t_5;
      goto __pyx_L8_bool_binop_done;
    }
    __pyx_t_5 = (__pyx_v_c_dtd->ExternalID != NULL);
    __pyx_t_2 = __pyx_t_5;
    __pyx_L8_bool_binop_done:;
    if (__pyx_t_2) {

      /* "lxml/etree.pyx":519
 *         if c_dtd is not NULL:
 *             if not public_id and c_dtd.ExternalID is not NULL:
 *                 public_id = funicode(c_dtd.ExternalID)             # <<<<<<<<<<<<<<
 *             if not sys_url and c_dtd.SystemID is not NULL:
 *                 sys_url = funicode(c_dtd.SystemID)
*/
      __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_dtd->ExternalID); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 519, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_public_id, ((PyObject*)__pyx_t_3));
      __pyx_t_3 = 0;

      /* "lxml/etree.pyx":518
 *         c_dtd = self._c_doc.extSubset
 *         if c_dtd is not NULL:
 *             if not public_id and c_dtd.ExternalID is not NULL:             # <<<<<<<<<<<<<<
 *                 public_id = funicode(c_dtd.ExternalID)
 *             if not sys_url and c_dtd.SystemID is not NULL:
*/
    }

    /* "lxml/etree.pyx":520
 *             if not public_id and c_dtd.ExternalID is not NULL:
 *                 public_id = funicode(c_dtd.ExternalID)
 *             if not sys_url and c_dtd.SystemID is not NULL:             # <<<<<<<<<<<<<<
 *                 sys_url = funicode(c_dtd.SystemID)
 *         c_root_node = tree.xmlDocGetRootElement(self._c_doc)
*/
    if (__pyx_v_sys_url == Py_None) __pyx_t_5 = 0;
    else
    {
      Py_ssize_t __pyx_temp = __Pyx_PyUnicode_IS_TRUE(__pyx_v_sys_url);
      if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(0, 520, __pyx_L1_error)
      __pyx_t_5 = (__pyx_temp != 0);
    }

    __pyx_t_4 = (!__pyx_t_5);
    if (__pyx_t_4) {
    } else {
      __pyx_t_2 = __pyx_t_4;
      goto __pyx_L11_bool_binop_done;
    }
    __pyx_t_4 = (__pyx_v_c_dtd->SystemID != NULL);
    __pyx_t_2 = __pyx_t_4;
    __pyx_L11_bool_binop_done:;
    if (__pyx_t_2) {

      /* "lxml/etree.pyx":521
 *                 public_id = funicode(c_dtd.ExternalID)
 *             if not sys_url and c_dtd.SystemID is not NULL:
 *                 sys_url = funicode(c_dtd.SystemID)             # <<<<<<<<<<<<<<
 *         c_root_node = tree.xmlDocGetRootElement(self._c_doc)
 *         if c_root_node is NULL:
*/
      __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_dtd->SystemID); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 521, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_sys_url, ((PyObject*)__pyx_t_3));
      __pyx_t_3 = 0;

      /* "lxml/etree.pyx":520
 *             if not public_id and c_dtd.ExternalID is not NULL:
 *                 public_id = funicode(c_dtd.ExternalID)
 *             if not sys_url and c_dtd.SystemID is not NULL:             # <<<<<<<<<<<<<<
 *                 sys_url = funicode(c_dtd.SystemID)
 *         c_root_node = tree.xmlDocGetRootElement(self._c_doc)
*/
    }

    /* "lxml/etree.pyx":517
 *                 sys_url = funicode(c_dtd.SystemID)
 *         c_dtd = self._c_doc.extSubset
 *         if c_dtd is not NULL:             # <<<<<<<<<<<<<<
 *             if not public_id and c_dtd.ExternalID is not NULL:
 *                 public_id = funicode(c_dtd.ExternalID)
*/
  }

  /* "lxml/etree.pyx":522
 *             if not sys_url and c_dtd.SystemID is not NULL:
 *                 sys_url = funicode(c_dtd.SystemID)
 *         c_root_node = tree.xmlDocGetRootElement(self._c_doc)             # <<<<<<<<<<<<<<
 *         if c_root_node is NULL:
 *             root_name = None
*/
  __pyx_v_c_root_node = xmlDocGetRootElement(__pyx_v_self->_c_doc);

  /* "lxml/etree.pyx":523
 *                 sys_url = funicode(c_dtd.SystemID)
 *         c_root_node = tree.xmlDocGetRootElement(self._c_doc)
 *         if c_root_node is NULL:             # <<<<<<<<<<<<<<
 *             root_name = None
 *         else:
*/
  __pyx_t_2 = (__pyx_v_c_root_node == NULL);
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":524
 *         c_root_node = tree.xmlDocGetRootElement(self._c_doc)
 *         if c_root_node is NULL:
 *             root_name = None             # <<<<<<<<<<<<<<
 *         else:
 *             root_name = funicode(c_root_node.name)
*/
    __Pyx_INCREF(Py_None);
    __pyx_v_root_name = ((PyObject*)Py_None);

    /* "lxml/etree.pyx":523
 *                 sys_url = funicode(c_dtd.SystemID)
 *         c_root_node = tree.xmlDocGetRootElement(self._c_doc)
 *         if c_root_node is NULL:             # <<<<<<<<<<<<<<
 *             root_name = None
 *         else:
*/
    goto __pyx_L13;
  }

  /* "lxml/etree.pyx":526
 *             root_name = None
 *         else:
 *             root_name = funicode(c_root_node.name)             # <<<<<<<<<<<<<<
 *         return root_name, public_id, sys_url
 * 
*/
  /*else*/ {
    __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_root_node->name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 526, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_root_name = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;
  }
  __pyx_L13:;

  /* "lxml/etree.pyx":527
 *         else:
 *             root_name = funicode(c_root_node.name)
 *         return root_name, public_id, sys_url             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 527, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_root_name);
  __Pyx_GIVEREF(__pyx_v_root_name);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_root_name) != (0)) __PYX_ERR(0, 527, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_public_id);
  __Pyx_GIVEREF(__pyx_v_public_id);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_public_id) != (0)) __PYX_ERR(0, 527, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_sys_url);
  __Pyx_GIVEREF(__pyx_v_sys_url);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_sys_url) != (0)) __PYX_ERR(0, 527, __pyx_L1_error);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":503
 *         return self._c_doc is not NULL and self._c_doc.intSubset is not NULL
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef getdoctype(self):
 *         # get doctype info: root tag, public/system ID (or None if not known)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Document.getdoctype", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_public_id);
  __Pyx_XDECREF(__pyx_v_sys_url);
  __Pyx_XDECREF(__pyx_v_root_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":529
 *         return root_name, public_id, sys_url
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef getxmlinfo(self):
 *         # return XML version and encoding (or None if not known)
*/

static PyObject *__pyx_f_4lxml_5etree_9_Document_getxmlinfo(struct LxmlDocument *__pyx_v_self) {
  xmlDoc *__pyx_v_c_doc;
  PyObject *__pyx_v_version = NULL;
  PyObject *__pyx_v_encoding = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  xmlDoc *__pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getxmlinfo", 0);

  /* "lxml/etree.pyx":532
 *     cdef getxmlinfo(self):
 *         # return XML version and encoding (or None if not known)
 *         cdef xmlDoc* c_doc = self._c_doc             # <<<<<<<<<<<<<<
 *         if c_doc.version is NULL:
 *             version = None
*/
  __pyx_t_1 = __pyx_v_self->_c_doc;
  __pyx_v_c_doc = __pyx_t_1;

  /* "lxml/etree.pyx":533
 *         # return XML version and encoding (or None if not known)
 *         cdef xmlDoc* c_doc = self._c_doc
 *         if c_doc.version is NULL:             # <<<<<<<<<<<<<<
 *             version = None
 *         else:
*/
  __pyx_t_2 = (__pyx_v_c_doc->version == NULL);
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":534
 *         cdef xmlDoc* c_doc = self._c_doc
 *         if c_doc.version is NULL:
 *             version = None             # <<<<<<<<<<<<<<
 *         else:
 *             version = funicode(c_doc.version)
*/
    __Pyx_INCREF(Py_None);
    __pyx_v_version = ((PyObject*)Py_None);

    /* "lxml/etree.pyx":533
 *         # return XML version and encoding (or None if not known)
 *         cdef xmlDoc* c_doc = self._c_doc
 *         if c_doc.version is NULL:             # <<<<<<<<<<<<<<
 *             version = None
 *         else:
*/
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":536
 *             version = None
 *         else:
 *             version = funicode(c_doc.version)             # <<<<<<<<<<<<<<
 *         if c_doc.encoding is NULL:
 *             encoding = None
*/
  /*else*/ {
    __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_doc->version); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 536, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_version = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;
  }
  __pyx_L3:;

  /* "lxml/etree.pyx":537
 *         else:
 *             version = funicode(c_doc.version)
 *         if c_doc.encoding is NULL:             # <<<<<<<<<<<<<<
 *             encoding = None
 *         else:
*/
  __pyx_t_2 = (__pyx_v_c_doc->encoding == NULL);
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":538
 *             version = funicode(c_doc.version)
 *         if c_doc.encoding is NULL:
 *             encoding = None             # <<<<<<<<<<<<<<
 *         else:
 *             encoding = funicode(c_doc.encoding)
*/
    __Pyx_INCREF(Py_None);
    __pyx_v_encoding = ((PyObject*)Py_None);

    /* "lxml/etree.pyx":537
 *         else:
 *             version = funicode(c_doc.version)
 *         if c_doc.encoding is NULL:             # <<<<<<<<<<<<<<
 *             encoding = None
 *         else:
*/
    goto __pyx_L4;
  }

  /* "lxml/etree.pyx":540
 *             encoding = None
 *         else:
 *             encoding = funicode(c_doc.encoding)             # <<<<<<<<<<<<<<
 *         return version, encoding
 * 
*/
  /*else*/ {
    __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_doc->encoding); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 540, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_encoding = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;
  }
  __pyx_L4:;

  /* "lxml/etree.pyx":541
 *         else:
 *             encoding = funicode(c_doc.encoding)
 *         return version, encoding             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 541, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_version);
  __Pyx_GIVEREF(__pyx_v_version);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_version) != (0)) __PYX_ERR(0, 541, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_encoding);
  __Pyx_GIVEREF(__pyx_v_encoding);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_encoding) != (0)) __PYX_ERR(0, 541, __pyx_L1_error);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":529
 *         return root_name, public_id, sys_url
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef getxmlinfo(self):
 *         # return XML version and encoding (or None if not known)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Document.getxmlinfo", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_version);
  __Pyx_XDECREF(__pyx_v_encoding);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":543
 *         return version, encoding
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef isstandalone(self):
 *         # returns True for "standalone=true",
*/

static PyObject *__pyx_f_4lxml_5etree_9_Document_isstandalone(struct LxmlDocument *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("isstandalone", 0);

  /* "lxml/etree.pyx":547
 *         # returns True for "standalone=true",
 *         # False for "standalone=false", None if not provided
 *         if self._c_doc.standalone == -1:             # <<<<<<<<<<<<<<
 *             return None
 *         else:
*/
  __pyx_t_1 = (__pyx_v_self->_c_doc->standalone == -1L);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":548
 *         # False for "standalone=false", None if not provided
 *         if self._c_doc.standalone == -1:
 *             return None             # <<<<<<<<<<<<<<
 *         else:
 *             return <bint>(self._c_doc.standalone == 1)
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "lxml/etree.pyx":547
 *         # returns True for "standalone=true",
 *         # False for "standalone=false", None if not provided
 *         if self._c_doc.standalone == -1:             # <<<<<<<<<<<<<<
 *             return None
 *         else:
*/
  }

  /* "lxml/etree.pyx":550
 *             return None
 *         else:
 *             return <bint>(self._c_doc.standalone == 1)             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyBool_FromLong((__pyx_v_self->_c_doc->standalone == 1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 550, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "lxml/etree.pyx":543
 *         return version, encoding
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef isstandalone(self):
 *         # returns True for "standalone=true",
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Document.isstandalone", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":552
 *             return <bint>(self._c_doc.standalone == 1)
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef bytes buildNewPrefix(self):
 *         # get a new unique prefix ("nsX") for this document
*/

static PyObject *__pyx_f_4lxml_5etree_9_Document_buildNewPrefix(struct LxmlDocument *__pyx_v_self) {
  PyObject *__pyx_v_ns = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("buildNewPrefix", 0);

  /* "lxml/etree.pyx":556
 *         # get a new unique prefix ("nsX") for this document
 *         cdef bytes ns
 *         if self._ns_counter < len(_PREFIX_CACHE):             # <<<<<<<<<<<<<<
 *             ns = _PREFIX_CACHE[self._ns_counter]
 *         else:
*/
  __pyx_t_1 = __pyx_v_4lxml_5etree__PREFIX_CACHE;
  __Pyx_INCREF(__pyx_t_1);
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 556, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyTuple_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 556, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (__pyx_v_self->_ns_counter < __pyx_t_2);
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":557
 *         cdef bytes ns
 *         if self._ns_counter < len(_PREFIX_CACHE):
 *             ns = _PREFIX_CACHE[self._ns_counter]             # <<<<<<<<<<<<<<
 *         else:
 *             ns = python.PyBytes_FromFormat("ns%d", self._ns_counter)
*/
    if (unlikely(__pyx_v_4lxml_5etree__PREFIX_CACHE == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 557, __pyx_L1_error)
    }
    __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v_4lxml_5etree__PREFIX_CACHE, __pyx_v_self->_ns_counter, int, 1, __Pyx_PyLong_From_int, 0, 1, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 557, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_1))) __PYX_ERR(0, 557, __pyx_L1_error)
    __pyx_v_ns = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "lxml/etree.pyx":556
 *         # get a new unique prefix ("nsX") for this document
 *         cdef bytes ns
 *         if self._ns_counter < len(_PREFIX_CACHE):             # <<<<<<<<<<<<<<
 *             ns = _PREFIX_CACHE[self._ns_counter]
 *         else:
*/
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":559
 *             ns = _PREFIX_CACHE[self._ns_counter]
 *         else:
 *             ns = python.PyBytes_FromFormat("ns%d", self._ns_counter)             # <<<<<<<<<<<<<<
 *         if self._prefix_tail is not None:
 *             ns += self._prefix_tail
*/
  /*else*/ {
    __pyx_t_1 = PyBytes_FromFormat(((char *)"ns%d"), __pyx_v_self->_ns_counter); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 559, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_ns = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;
  }
  __pyx_L3:;

  /* "lxml/etree.pyx":560
 *         else:
 *             ns = python.PyBytes_FromFormat("ns%d", self._ns_counter)
 *         if self._prefix_tail is not None:             # <<<<<<<<<<<<<<
 *             ns += self._prefix_tail
 *         self._ns_counter += 1
*/
  __pyx_t_3 = (__pyx_v_self->_prefix_tail != ((PyObject*)Py_None));
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":561
 *             ns = python.PyBytes_FromFormat("ns%d", self._ns_counter)
 *         if self._prefix_tail is not None:
 *             ns += self._prefix_tail             # <<<<<<<<<<<<<<
 *         self._ns_counter += 1
 *         if self._ns_counter < 0:
*/
    __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_ns, __pyx_v_self->_prefix_tail); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 561, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_ns, ((PyObject*)__pyx_t_1));
    __pyx_t_1 = 0;

    /* "lxml/etree.pyx":560
 *         else:
 *             ns = python.PyBytes_FromFormat("ns%d", self._ns_counter)
 *         if self._prefix_tail is not None:             # <<<<<<<<<<<<<<
 *             ns += self._prefix_tail
 *         self._ns_counter += 1
*/
  }

  /* "lxml/etree.pyx":562
 *         if self._prefix_tail is not None:
 *             ns += self._prefix_tail
 *         self._ns_counter += 1             # <<<<<<<<<<<<<<
 *         if self._ns_counter < 0:
 *             # overflow!
*/
  __pyx_v_self->_ns_counter = (__pyx_v_self->_ns_counter + 1);

  /* "lxml/etree.pyx":563
 *             ns += self._prefix_tail
 *         self._ns_counter += 1
 *         if self._ns_counter < 0:             # <<<<<<<<<<<<<<
 *             # overflow!
 *             self._ns_counter = 0
*/
  __pyx_t_3 = (__pyx_v_self->_ns_counter < 0);
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":565
 *         if self._ns_counter < 0:
 *             # overflow!
 *             self._ns_counter = 0             # <<<<<<<<<<<<<<
 *             if self._prefix_tail is None:
 *                 self._prefix_tail = b"A"
*/
    __pyx_v_self->_ns_counter = 0;

    /* "lxml/etree.pyx":566
 *             # overflow!
 *             self._ns_counter = 0
 *             if self._prefix_tail is None:             # <<<<<<<<<<<<<<
 *                 self._prefix_tail = b"A"
 *             else:
*/
    __pyx_t_3 = (__pyx_v_self->_prefix_tail == ((PyObject*)Py_None));
    if (__pyx_t_3) {

      /* "lxml/etree.pyx":567
 *             self._ns_counter = 0
 *             if self._prefix_tail is None:
 *                 self._prefix_tail = b"A"             # <<<<<<<<<<<<<<
 *             else:
 *                 self._prefix_tail += b"A"
*/
      __Pyx_INCREF(__pyx_mstate_global->__pyx_n_b_A);
      __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_b_A);
      __Pyx_GOTREF(__pyx_v_self->_prefix_tail);
      __Pyx_DECREF(__pyx_v_self->_prefix_tail);
      __pyx_v_self->_prefix_tail = __pyx_mstate_global->__pyx_n_b_A;

      /* "lxml/etree.pyx":566
 *             # overflow!
 *             self._ns_counter = 0
 *             if self._prefix_tail is None:             # <<<<<<<<<<<<<<
 *                 self._prefix_tail = b"A"
 *             else:
*/
      goto __pyx_L6;
    }

    /* "lxml/etree.pyx":569
 *                 self._prefix_tail = b"A"
 *             else:
 *                 self._prefix_tail += b"A"             # <<<<<<<<<<<<<<
 *         return ns
 * 
*/
    /*else*/ {
      __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_self->_prefix_tail, __pyx_mstate_global->__pyx_n_b_A); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 569, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_v_self->_prefix_tail);
      __Pyx_DECREF(__pyx_v_self->_prefix_tail);
      __pyx_v_self->_prefix_tail = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;
    }
    __pyx_L6:;

    /* "lxml/etree.pyx":563
 *             ns += self._prefix_tail
 *         self._ns_counter += 1
 *         if self._ns_counter < 0:             # <<<<<<<<<<<<<<
 *             # overflow!
 *             self._ns_counter = 0
*/
  }

  /* "lxml/etree.pyx":570
 *             else:
 *                 self._prefix_tail += b"A"
 *         return ns             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_ns);
  __pyx_r = __pyx_v_ns;
  goto __pyx_L0;

  /* "lxml/etree.pyx":552
 *             return <bint>(self._c_doc.standalone == 1)
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef bytes buildNewPrefix(self):
 *         # get a new unique prefix ("nsX") for this document
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._Document.buildNewPrefix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ns);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":572
 *         return ns
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef xmlNs* _findOrBuildNodeNs(self, xmlNode* c_node,
 *                                    const_xmlChar* c_href, const_xmlChar* c_prefix,
*/

static xmlNs *__pyx_f_4lxml_5etree_9_Document__findOrBuildNodeNs(struct LxmlDocument *__pyx_v_self, xmlNode *__pyx_v_c_node, const xmlChar *__pyx_v_c_href, const xmlChar *__pyx_v_c_prefix, int __pyx_v_is_attribute) {
  xmlNs *__pyx_v_c_ns;
  PyObject *__pyx_v_dict_result;
  PyObject *__pyx_v_prefix = NULL;
  xmlNs *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4[4];
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_findOrBuildNodeNs", 0);

  /* "lxml/etree.pyx":582
 *         cdef xmlNs* c_doc_ns
 *         cdef python.PyObject* dict_result
 *         if c_node.type != tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *             assert c_node.type == tree.XML_ELEMENT_NODE, \
 *                 "invalid node type %d, expected %d" % (
*/
  __pyx_t_1 = (__pyx_v_c_node->type != XML_ELEMENT_NODE);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":583
 *         cdef python.PyObject* dict_result
 *         if c_node.type != tree.XML_ELEMENT_NODE:
 *             assert c_node.type == tree.XML_ELEMENT_NODE, \             # <<<<<<<<<<<<<<
 *                 "invalid node type %d, expected %d" % (
 *                 c_node.type, tree.XML_ELEMENT_NODE)
*/
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(__pyx_assertions_enabled())) {
      __pyx_t_1 = (__pyx_v_c_node->type == XML_ELEMENT_NODE);
      if (unlikely(!__pyx_t_1)) {

        /* "lxml/etree.pyx":585
 *             assert c_node.type == tree.XML_ELEMENT_NODE, \
 *                 "invalid node type %d, expected %d" % (
 *                 c_node.type, tree.XML_ELEMENT_NODE)             # <<<<<<<<<<<<<<
 *         # look for existing ns declaration
 *         c_ns = _searchNsByHref(c_node, c_href, is_attribute)
*/
        __pyx_t_2 = __Pyx_PyUnicode_From_xmlElementType(__pyx_v_c_node->type, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 585, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = __Pyx_PyUnicode_From_xmlElementType(XML_ELEMENT_NODE, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 585, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u_invalid_node_type;
        __pyx_t_4[1] = __pyx_t_2;
        __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u_expected;
        __pyx_t_4[3] = __pyx_t_3;

        /* "lxml/etree.pyx":584
 *         if c_node.type != tree.XML_ELEMENT_NODE:
 *             assert c_node.type == tree.XML_ELEMENT_NODE, \
 *                 "invalid node type %d, expected %d" % (             # <<<<<<<<<<<<<<
 *                 c_node.type, tree.XML_ELEMENT_NODE)
 *         # look for existing ns declaration
*/
        __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_4, 4, 18 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 11 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3));
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 584, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_t_5, 0, 0);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __PYX_ERR(0, 583, __pyx_L1_error)
      }
    }
    #else
    if ((1)); else __PYX_ERR(0, 583, __pyx_L1_error)
    #endif

    /* "lxml/etree.pyx":582
 *         cdef xmlNs* c_doc_ns
 *         cdef python.PyObject* dict_result
 *         if c_node.type != tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *             assert c_node.type == tree.XML_ELEMENT_NODE, \
 *                 "invalid node type %d, expected %d" % (
*/
  }

  /* "lxml/etree.pyx":587
 *                 c_node.type, tree.XML_ELEMENT_NODE)
 *         # look for existing ns declaration
 *         c_ns = _searchNsByHref(c_node, c_href, is_attribute)             # <<<<<<<<<<<<<<
 *         if c_ns is not NULL:
 *             if is_attribute and c_ns.prefix is NULL:
*/
  __pyx_v_c_ns = __pyx_f_4lxml_5etree__searchNsByHref(__pyx_v_c_node, __pyx_v_c_href, __pyx_v_is_attribute);

  /* "lxml/etree.pyx":588
 *         # look for existing ns declaration
 *         c_ns = _searchNsByHref(c_node, c_href, is_attribute)
 *         if c_ns is not NULL:             # <<<<<<<<<<<<<<
 *             if is_attribute and c_ns.prefix is NULL:
 *                 # do not put namespaced attributes into the default
*/
  __pyx_t_1 = (__pyx_v_c_ns != NULL);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":589
 *         c_ns = _searchNsByHref(c_node, c_href, is_attribute)
 *         if c_ns is not NULL:
 *             if is_attribute and c_ns.prefix is NULL:             # <<<<<<<<<<<<<<
 *                 # do not put namespaced attributes into the default
 *                 # namespace as this would break serialisation
*/
    if (__pyx_v_is_attribute) {
    } else {
      __pyx_t_1 = __pyx_v_is_attribute;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_6 = (__pyx_v_c_ns->prefix == NULL);
    __pyx_t_1 = __pyx_t_6;
    __pyx_L6_bool_binop_done:;
    if (__pyx_t_1) {
      goto __pyx_L5;
    }

    /* "lxml/etree.pyx":594
 *                 pass
 *             else:
 *                 return c_ns             # <<<<<<<<<<<<<<
 * 
 *         # none found => determine a suitable new prefix
*/
    /*else*/ {
      __pyx_r = __pyx_v_c_ns;
      goto __pyx_L0;
    }
    __pyx_L5:;

    /* "lxml/etree.pyx":588
 *         # look for existing ns declaration
 *         c_ns = _searchNsByHref(c_node, c_href, is_attribute)
 *         if c_ns is not NULL:             # <<<<<<<<<<<<<<
 *             if is_attribute and c_ns.prefix is NULL:
 *                 # do not put namespaced attributes into the default
*/
  }

  /* "lxml/etree.pyx":597
 * 
 *         # none found => determine a suitable new prefix
 *         if c_prefix is NULL:             # <<<<<<<<<<<<<<
 *             dict_result = python.PyDict_GetItem(
 *                 _DEFAULT_NAMESPACE_PREFIXES, <unsigned char*>c_href)
*/
  __pyx_t_1 = (__pyx_v_c_prefix == NULL);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":599
 *         if c_prefix is NULL:
 *             dict_result = python.PyDict_GetItem(
 *                 _DEFAULT_NAMESPACE_PREFIXES, <unsigned char*>c_href)             # <<<<<<<<<<<<<<
 *             if dict_result is not NULL:
 *                 prefix = <object>dict_result
*/
    __pyx_t_5 = __pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES;
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_3 = __Pyx_PyBytes_FromCString(((unsigned char *)__pyx_v_c_href)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 599, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);

    /* "lxml/etree.pyx":598
 *         # none found => determine a suitable new prefix
 *         if c_prefix is NULL:
 *             dict_result = python.PyDict_GetItem(             # <<<<<<<<<<<<<<
 *                 _DEFAULT_NAMESPACE_PREFIXES, <unsigned char*>c_href)
 *             if dict_result is not NULL:
*/
    __pyx_v_dict_result = PyDict_GetItem(__pyx_t_5, __pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "lxml/etree.pyx":600
 *             dict_result = python.PyDict_GetItem(
 *                 _DEFAULT_NAMESPACE_PREFIXES, <unsigned char*>c_href)
 *             if dict_result is not NULL:             # <<<<<<<<<<<<<<
 *                 prefix = <object>dict_result
 *             else:
*/
    __pyx_t_1 = (__pyx_v_dict_result != NULL);
    if (__pyx_t_1) {

      /* "lxml/etree.pyx":601
 *                 _DEFAULT_NAMESPACE_PREFIXES, <unsigned char*>c_href)
 *             if dict_result is not NULL:
 *                 prefix = <object>dict_result             # <<<<<<<<<<<<<<
 *             else:
 *                 prefix = self.buildNewPrefix()
*/
      __pyx_t_3 = ((PyObject *)__pyx_v_dict_result);
      __Pyx_INCREF(__pyx_t_3);
      __pyx_v_prefix = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "lxml/etree.pyx":600
 *             dict_result = python.PyDict_GetItem(
 *                 _DEFAULT_NAMESPACE_PREFIXES, <unsigned char*>c_href)
 *             if dict_result is not NULL:             # <<<<<<<<<<<<<<
 *                 prefix = <object>dict_result
 *             else:
*/
      goto __pyx_L9;
    }

    /* "lxml/etree.pyx":603
 *                 prefix = <object>dict_result
 *             else:
 *                 prefix = self.buildNewPrefix()             # <<<<<<<<<<<<<<
 *             c_prefix = _xcstr(prefix)
 * 
*/
    /*else*/ {
      __pyx_t_3 = __pyx_f_4lxml_5etree_9_Document_buildNewPrefix(__pyx_v_self); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 603, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_v_prefix = __pyx_t_3;
      __pyx_t_3 = 0;
    }
    __pyx_L9:;

    /* "lxml/etree.pyx":604
 *             else:
 *                 prefix = self.buildNewPrefix()
 *             c_prefix = _xcstr(prefix)             # <<<<<<<<<<<<<<
 * 
 *         # make sure the prefix is not in use already
*/
    __pyx_v_c_prefix = (const xmlChar*)PyBytes_AS_STRING(__pyx_v_prefix);

    /* "lxml/etree.pyx":597
 * 
 *         # none found => determine a suitable new prefix
 *         if c_prefix is NULL:             # <<<<<<<<<<<<<<
 *             dict_result = python.PyDict_GetItem(
 *                 _DEFAULT_NAMESPACE_PREFIXES, <unsigned char*>c_href)
*/
  }

  /* "lxml/etree.pyx":607
 * 
 *         # make sure the prefix is not in use already
 *         while tree.xmlSearchNs(self._c_doc, c_node, c_prefix) is not NULL:             # <<<<<<<<<<<<<<
 *             prefix = self.buildNewPrefix()
 *             c_prefix = _xcstr(prefix)
*/
  while (1) {
    __pyx_t_1 = (xmlSearchNs(__pyx_v_self->_c_doc, __pyx_v_c_node, __pyx_v_c_prefix) != NULL);
    if (!__pyx_t_1) break;

    /* "lxml/etree.pyx":608
 *         # make sure the prefix is not in use already
 *         while tree.xmlSearchNs(self._c_doc, c_node, c_prefix) is not NULL:
 *             prefix = self.buildNewPrefix()             # <<<<<<<<<<<<<<
 *             c_prefix = _xcstr(prefix)
 * 
*/
    __pyx_t_3 = __pyx_f_4lxml_5etree_9_Document_buildNewPrefix(__pyx_v_self); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 608, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_prefix, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "lxml/etree.pyx":609
 *         while tree.xmlSearchNs(self._c_doc, c_node, c_prefix) is not NULL:
 *             prefix = self.buildNewPrefix()
 *             c_prefix = _xcstr(prefix)             # <<<<<<<<<<<<<<
 * 
 *         # declare the namespace and return it
*/
    __pyx_v_c_prefix = (const xmlChar*)PyBytes_AS_STRING(__pyx_v_prefix);
  }

  /* "lxml/etree.pyx":612
 * 
 *         # declare the namespace and return it
 *         c_ns = tree.xmlNewNs(c_node, c_href, c_prefix)             # <<<<<<<<<<<<<<
 *         if c_ns is NULL:
 *             raise MemoryError()
*/
  __pyx_v_c_ns = xmlNewNs(__pyx_v_c_node, __pyx_v_c_href, __pyx_v_c_prefix);

  /* "lxml/etree.pyx":613
 *         # declare the namespace and return it
 *         c_ns = tree.xmlNewNs(c_node, c_href, c_prefix)
 *         if c_ns is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 *         return c_ns
*/
  __pyx_t_1 = (__pyx_v_c_ns == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "lxml/etree.pyx":614
 *         c_ns = tree.xmlNewNs(c_node, c_href, c_prefix)
 *         if c_ns is NULL:
 *             raise MemoryError()             # <<<<<<<<<<<<<<
 *         return c_ns
 * 
*/
    PyErr_NoMemory(); __PYX_ERR(0, 614, __pyx_L1_error)

    /* "lxml/etree.pyx":613
 *         # declare the namespace and return it
 *         c_ns = tree.xmlNewNs(c_node, c_href, c_prefix)
 *         if c_ns is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 *         return c_ns
*/
  }

  /* "lxml/etree.pyx":615
 *         if c_ns is NULL:
 *             raise MemoryError()
 *         return c_ns             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
*/
  __pyx_r = __pyx_v_c_ns;
  goto __pyx_L0;

  /* "lxml/etree.pyx":572
 *         return ns
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef xmlNs* _findOrBuildNodeNs(self, xmlNode* c_node,
 *                                    const_xmlChar* c_href, const_xmlChar* c_prefix,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._Document._findOrBuildNodeNs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_prefix);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":617
 *         return c_ns
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef int _setNodeNs(self, xmlNode* c_node, const_xmlChar* c_href) except -1:
 *         "Lookup namespace structure and set it for the node."
*/

static int __pyx_f_4lxml_5etree_9_Document__setNodeNs(struct LxmlDocument *__pyx_v_self, xmlNode *__pyx_v_c_node, const xmlChar *__pyx_v_c_href) {
  xmlNs *__pyx_v_c_ns;
  int __pyx_r;
  xmlNs *__pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "lxml/etree.pyx":620
 *     cdef int _setNodeNs(self, xmlNode* c_node, const_xmlChar* c_href) except -1:
 *         "Lookup namespace structure and set it for the node."
 *         c_ns = self._findOrBuildNodeNs(c_node, c_href, NULL, 0)             # <<<<<<<<<<<<<<
 *         tree.xmlSetNs(c_node, c_ns)
 * 
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_9_Document__findOrBuildNodeNs(__pyx_v_self, __pyx_v_c_node, __pyx_v_c_href, NULL, 0); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(0, 620, __pyx_L1_error)
  __pyx_v_c_ns = __pyx_t_1;

  /* "lxml/etree.pyx":621
 *         "Lookup namespace structure and set it for the node."
 *         c_ns = self._findOrBuildNodeNs(c_node, c_href, NULL, 0)
 *         tree.xmlSetNs(c_node, c_ns)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  xmlSetNs(__pyx_v_c_node, __pyx_v_c_ns);

  /* "lxml/etree.pyx":617
 *         return c_ns
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef int _setNodeNs(self, xmlNode* c_node, const_xmlChar* c_href) except -1:
 *         "Lookup namespace structure and set it for the node."
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._Document._setNodeNs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "lxml/etree.pyx":624
 * 
 * 
 * cdef tuple __initPrefixCache():             # <<<<<<<<<<<<<<
 *     cdef int i
 *     return tuple([ python.PyBytes_FromFormat("ns%d", i)
*/

static PyObject *__pyx_f_4lxml_5etree___initPrefixCache(void) {
  int __pyx_8genexpr8__pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__initPrefixCache", 0);

  /* "lxml/etree.pyx":626
 * cdef tuple __initPrefixCache():
 *     cdef int i
 *     return tuple([ python.PyBytes_FromFormat("ns%d", i)             # <<<<<<<<<<<<<<
 *                    for i in range(26) ])
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  { /* enter inner scope */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 626, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);

    /* "lxml/etree.pyx":627
 *     cdef int i
 *     return tuple([ python.PyBytes_FromFormat("ns%d", i)
 *                    for i in range(26) ])             # <<<<<<<<<<<<<<
 * 
 * cdef tuple _PREFIX_CACHE = __initPrefixCache()
*/
    for (__pyx_t_2 = 0; __pyx_t_2 < 26; __pyx_t_2+=1) {
      __pyx_8genexpr8__pyx_v_i = __pyx_t_2;

      /* "lxml/etree.pyx":626
 * cdef tuple __initPrefixCache():
 *     cdef int i
 *     return tuple([ python.PyBytes_FromFormat("ns%d", i)             # <<<<<<<<<<<<<<
 *                    for i in range(26) ])
 * 
*/
      __pyx_t_3 = PyBytes_FromFormat(((char *)"ns%d"), __pyx_8genexpr8__pyx_v_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 626, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_3))) __PYX_ERR(0, 626, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
  } /* exit inner scope */
  __pyx_t_3 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 626, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":624
 * 
 * 
 * cdef tuple __initPrefixCache():             # <<<<<<<<<<<<<<
 *     cdef int i
 *     return tuple([ python.PyBytes_FromFormat("ns%d", i)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.__initPrefixCache", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":632
 * 
 * 
 * cdef _Document _documentFactory(xmlDoc* c_doc, _BaseParser parser):             # <<<<<<<<<<<<<<
 *     cdef _Document result
 *     result = _Document.__new__(_Document)
*/

static struct LxmlDocument *__pyx_f_4lxml_5etree__documentFactory(xmlDoc *__pyx_v_c_doc, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser) {
  struct LxmlDocument *__pyx_v_result = 0;
  struct LxmlDocument *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_documentFactory", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_parser);

  /* "lxml/etree.pyx":634
 * cdef _Document _documentFactory(xmlDoc* c_doc, _BaseParser parser):
 *     cdef _Document result
 *     result = _Document.__new__(_Document)             # <<<<<<<<<<<<<<
 *     result._c_doc = c_doc
 *     result._ns_counter = 0
*/
  __pyx_t_1 = ((PyObject *)__pyx_tp_new_4lxml_5etree__Document(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Document), __pyx_mstate_global->__pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 634, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_1);
  __pyx_v_result = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "lxml/etree.pyx":635
 *     cdef _Document result
 *     result = _Document.__new__(_Document)
 *     result._c_doc = c_doc             # <<<<<<<<<<<<<<
 *     result._ns_counter = 0
 *     result._prefix_tail = None
*/
  __pyx_v_result->_c_doc = __pyx_v_c_doc;

  /* "lxml/etree.pyx":636
 *     result = _Document.__new__(_Document)
 *     result._c_doc = c_doc
 *     result._ns_counter = 0             # <<<<<<<<<<<<<<
 *     result._prefix_tail = None
 *     if parser is None:
*/
  __pyx_v_result->_ns_counter = 0;

  /* "lxml/etree.pyx":637
 *     result._c_doc = c_doc
 *     result._ns_counter = 0
 *     result._prefix_tail = None             # <<<<<<<<<<<<<<
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
*/
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_result->_prefix_tail);
  __Pyx_DECREF(__pyx_v_result->_prefix_tail);
  __pyx_v_result->_prefix_tail = ((PyObject*)Py_None);

  /* "lxml/etree.pyx":638
 *     result._ns_counter = 0
 *     result._prefix_tail = None
 *     if parser is None:             # <<<<<<<<<<<<<<
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *     result._parser = parser
*/
  __pyx_t_2 = (((PyObject *)__pyx_v_parser) == Py_None);
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":639
 *     result._prefix_tail = None
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()             # <<<<<<<<<<<<<<
 *     result._parser = parser
 *     return result
*/
    __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree_24_ParserDictionaryContext_getDefaultParser(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 639, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_parser, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_1));
    __pyx_t_1 = 0;

    /* "lxml/etree.pyx":638
 *     result._ns_counter = 0
 *     result._prefix_tail = None
 *     if parser is None:             # <<<<<<<<<<<<<<
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *     result._parser = parser
*/
  }

  /* "lxml/etree.pyx":640
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *     result._parser = parser             # <<<<<<<<<<<<<<
 *     return result
 * 
*/
  __Pyx_INCREF((PyObject *)__pyx_v_parser);
  __Pyx_GIVEREF((PyObject *)__pyx_v_parser);
  __Pyx_GOTREF((PyObject *)__pyx_v_result->_parser);
  __Pyx_DECREF((PyObject *)__pyx_v_result->_parser);
  __pyx_v_result->_parser = __pyx_v_parser;

  /* "lxml/etree.pyx":641
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *     result._parser = parser
 *     return result             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "lxml/etree.pyx":632
 * 
 * 
 * cdef _Document _documentFactory(xmlDoc* c_doc, _BaseParser parser):             # <<<<<<<<<<<<<<
 *     cdef _Document result
 *     result = _Document.__new__(_Document)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._documentFactory", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XDECREF((PyObject *)__pyx_v_parser);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":651
 *     "Document information provided by parser and DTD."
 *     cdef _Document _doc
 *     def __cinit__(self, tree):             # <<<<<<<<<<<<<<
 *         "Create a DocInfo object for an ElementTree object or root Element."
 *         self._doc = _documentOrRaise(tree)
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_7DocInfo_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_7DocInfo_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_tree = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_tree,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 651, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 651, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__cinit__", 0) < (0)) __PYX_ERR(0, 651, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, i); __PYX_ERR(0, 651, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 651, __pyx_L3_error)
    }
    __pyx_v_tree = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 651, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.DocInfo.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_7DocInfo___cinit__(((struct __pyx_obj_4lxml_5etree_DocInfo *)__pyx_v_self), __pyx_v_tree);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_7DocInfo___cinit__(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self, PyObject *__pyx_v_tree) {
  PyObject *__pyx_v_root_name = NULL;
  PyObject *__pyx_v_public_id = NULL;
  PyObject *__pyx_v_system_url = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *(*__pyx_t_6)(PyObject *);
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "lxml/etree.pyx":653
 *     def __cinit__(self, tree):
 *         "Create a DocInfo object for an ElementTree object or root Element."
 *         self._doc = _documentOrRaise(tree)             # <<<<<<<<<<<<<<
 *         root_name, public_id, system_url = self._doc.getdoctype()
 *         if not root_name and (public_id or system_url):
*/
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__documentOrRaise(__pyx_v_tree)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 653, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_doc);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_doc);
  __pyx_v_self->_doc = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "lxml/etree.pyx":654
 *         "Create a DocInfo object for an ElementTree object or root Element."
 *         self._doc = _documentOrRaise(tree)
 *         root_name, public_id, system_url = self._doc.getdoctype()             # <<<<<<<<<<<<<<
 *         if not root_name and (public_id or system_url):
 *             raise ValueError, "Could not find root node"
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_9_Document_getdoctype(__pyx_v_self->_doc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 654, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 3)) {
      if (size > 3) __Pyx_RaiseTooManyValuesError(3);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 654, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
      __Pyx_INCREF(__pyx_t_3);
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2);
      __Pyx_INCREF(__pyx_t_4);
    } else {
      __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 654, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 654, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyList_GetItemRefFast(sequence, 2, __Pyx_ReferenceSharing_SharedReference);
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 654, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_4);
    }
    #else
    __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 654, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 654, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 654, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 654, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_6 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_5);
    index = 0; __pyx_t_2 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 2; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 3) < (0)) __PYX_ERR(0, 654, __pyx_L1_error)
    __pyx_t_6 = NULL;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 654, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_root_name = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_public_id = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_system_url = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "lxml/etree.pyx":655
 *         self._doc = _documentOrRaise(tree)
 *         root_name, public_id, system_url = self._doc.getdoctype()
 *         if not root_name and (public_id or system_url):             # <<<<<<<<<<<<<<
 *             raise ValueError, "Could not find root node"
 * 
*/
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_root_name); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 655, __pyx_L1_error)
  __pyx_t_9 = (!__pyx_t_8);
  if (__pyx_t_9) {
  } else {
    __pyx_t_7 = __pyx_t_9;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_public_id); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 655, __pyx_L1_error)
  if (!__pyx_t_9) {
  } else {
    __pyx_t_7 = __pyx_t_9;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_system_url); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 655, __pyx_L1_error)
  __pyx_t_7 = __pyx_t_9;
  __pyx_L6_bool_binop_done:;
  if (unlikely(__pyx_t_7)) {

    /* "lxml/etree.pyx":656
 *         root_name, public_id, system_url = self._doc.getdoctype()
 *         if not root_name and (public_id or system_url):
 *             raise ValueError, "Could not find root node"             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Could_not_find_root_node, 0, 0);
    __PYX_ERR(0, 656, __pyx_L1_error)

    /* "lxml/etree.pyx":655
 *         self._doc = _documentOrRaise(tree)
 *         root_name, public_id, system_url = self._doc.getdoctype()
 *         if not root_name and (public_id or system_url):             # <<<<<<<<<<<<<<
 *             raise ValueError, "Could not find root node"
 * 
*/
  }

  /* "lxml/etree.pyx":651
 *     "Document information provided by parser and DTD."
 *     cdef _Document _doc
 *     def __cinit__(self, tree):             # <<<<<<<<<<<<<<
 *         "Create a DocInfo object for an ElementTree object or root Element."
 *         self._doc = _documentOrRaise(tree)
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree.DocInfo.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_root_name);
  __Pyx_XDECREF(__pyx_v_public_id);
  __Pyx_XDECREF(__pyx_v_system_url);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":658
 *             raise ValueError, "Could not find root node"
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def root_name(self):
 *         """Returns the name of the root node as defined by the DOCTYPE."""
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7DocInfo_9root_name_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7DocInfo_9root_name_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_7DocInfo_9root_name___get__(((struct __pyx_obj_4lxml_5etree_DocInfo *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_9root_name___get__(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self) {
  PyObject *__pyx_v_root_name = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_public_id = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_system_url = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *(*__pyx_t_6)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lxml/etree.pyx":661
 *     def root_name(self):
 *         """Returns the name of the root node as defined by the DOCTYPE."""
 *         root_name, public_id, system_url = self._doc.getdoctype()             # <<<<<<<<<<<<<<
 *         return root_name
 * 
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_9_Document_getdoctype(__pyx_v_self->_doc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 661, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 3)) {
      if (size > 3) __Pyx_RaiseTooManyValuesError(3);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 661, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
      __Pyx_INCREF(__pyx_t_3);
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2);
      __Pyx_INCREF(__pyx_t_4);
    } else {
      __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 661, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 661, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyList_GetItemRefFast(sequence, 2, __Pyx_ReferenceSharing_SharedReference);
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 661, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_4);
    }
    #else
    __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 661, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 661, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 661, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 661, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_6 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_5);
    index = 0; __pyx_t_2 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 2; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 3) < (0)) __PYX_ERR(0, 661, __pyx_L1_error)
    __pyx_t_6 = NULL;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 661, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_root_name = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_public_id = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_system_url = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "lxml/etree.pyx":662
 *         """Returns the name of the root node as defined by the DOCTYPE."""
 *         root_name, public_id, system_url = self._doc.getdoctype()
 *         return root_name             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_root_name);
  __pyx_r = __pyx_v_root_name;
  goto __pyx_L0;

  /* "lxml/etree.pyx":658
 *             raise ValueError, "Could not find root node"
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def root_name(self):
 *         """Returns the name of the root node as defined by the DOCTYPE."""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree.DocInfo.root_name.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_root_name);
  __Pyx_XDECREF(__pyx_v_public_id);
  __Pyx_XDECREF(__pyx_v_system_url);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":664
 *         return root_name
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef tree.xmlDtd* _get_c_dtd(self) noexcept:
 *         """"Return the DTD. Create it if it does not yet exist."""
*/

static xmlDtd *__pyx_f_4lxml_5etree_7DocInfo__get_c_dtd(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self) {
  xmlDoc *__pyx_v_c_doc;
  xmlNode *__pyx_v_c_root_node;
  const xmlChar *__pyx_v_c_name;
  xmlDtd *__pyx_r;
  xmlDoc *__pyx_t_1;
  int __pyx_t_2;
  const xmlChar *__pyx_t_3;

  /* "lxml/etree.pyx":667
 *     cdef tree.xmlDtd* _get_c_dtd(self) noexcept:
 *         """"Return the DTD. Create it if it does not yet exist."""
 *         cdef xmlDoc* c_doc = self._doc._c_doc             # <<<<<<<<<<<<<<
 *         cdef xmlNode* c_root_node
 *         cdef const_xmlChar* c_name
*/
  __pyx_t_1 = __pyx_v_self->_doc->_c_doc;
  __pyx_v_c_doc = __pyx_t_1;

  /* "lxml/etree.pyx":671
 *         cdef const_xmlChar* c_name
 * 
 *         if c_doc.intSubset:             # <<<<<<<<<<<<<<
 *             return c_doc.intSubset
 * 
*/
  __pyx_t_2 = (__pyx_v_c_doc->intSubset != 0);
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":672
 * 
 *         if c_doc.intSubset:
 *             return c_doc.intSubset             # <<<<<<<<<<<<<<
 * 
 *         c_root_node = tree.xmlDocGetRootElement(c_doc)
*/
    __pyx_r = __pyx_v_c_doc->intSubset;
    goto __pyx_L0;

    /* "lxml/etree.pyx":671
 *         cdef const_xmlChar* c_name
 * 
 *         if c_doc.intSubset:             # <<<<<<<<<<<<<<
 *             return c_doc.intSubset
 * 
*/
  }

  /* "lxml/etree.pyx":674
 *             return c_doc.intSubset
 * 
 *         c_root_node = tree.xmlDocGetRootElement(c_doc)             # <<<<<<<<<<<<<<
 *         c_name = c_root_node.name if c_root_node else NULL
 *         return  tree.xmlCreateIntSubset(c_doc, c_name, NULL, NULL)
*/
  __pyx_v_c_root_node = xmlDocGetRootElement(__pyx_v_c_doc);

  /* "lxml/etree.pyx":675
 * 
 *         c_root_node = tree.xmlDocGetRootElement(c_doc)
 *         c_name = c_root_node.name if c_root_node else NULL             # <<<<<<<<<<<<<<
 *         return  tree.xmlCreateIntSubset(c_doc, c_name, NULL, NULL)
 * 
*/
  __pyx_t_2 = (__pyx_v_c_root_node != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_v_c_root_node->name;
  } else {
    __pyx_t_3 = NULL;
  }
  __pyx_v_c_name = __pyx_t_3;

  /* "lxml/etree.pyx":676
 *         c_root_node = tree.xmlDocGetRootElement(c_doc)
 *         c_name = c_root_node.name if c_root_node else NULL
 *         return  tree.xmlCreateIntSubset(c_doc, c_name, NULL, NULL)             # <<<<<<<<<<<<<<
 * 
 *     def clear(self):
*/
  __pyx_r = xmlCreateIntSubset(__pyx_v_c_doc, __pyx_v_c_name, NULL, NULL);
  goto __pyx_L0;

  /* "lxml/etree.pyx":664
 *         return root_name
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef tree.xmlDtd* _get_c_dtd(self) noexcept:
 *         """"Return the DTD. Create it if it does not yet exist."""
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "lxml/etree.pyx":678
 *         return  tree.xmlCreateIntSubset(c_doc, c_name, NULL, NULL)
 * 
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         """Removes DOCTYPE and internal subset from the document."""
 *         cdef xmlDoc* c_doc = self._doc._c_doc
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7DocInfo_3clear(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_7DocInfo_2clear, "Removes DOCTYPE and internal subset from the document.");
static PyMethodDef __pyx_mdef_4lxml_5etree_7DocInfo_3clear = {"clear", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7DocInfo_3clear, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_7DocInfo_2clear};
static PyObject *__pyx_pw_4lxml_5etree_7DocInfo_3clear(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clear (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("clear", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("clear", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_7DocInfo_2clear(((struct __pyx_obj_4lxml_5etree_DocInfo *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_2clear(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self) {
  xmlDoc *__pyx_v_c_doc;
  xmlNode *__pyx_v_c_dtd;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  xmlDoc *__pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("clear", 0);

  /* "lxml/etree.pyx":680
 *     def clear(self):
 *         """Removes DOCTYPE and internal subset from the document."""
 *         cdef xmlDoc* c_doc = self._doc._c_doc             # <<<<<<<<<<<<<<
 *         cdef tree.xmlNode* c_dtd = <xmlNode*>c_doc.intSubset
 *         if c_dtd is NULL:
*/
  __pyx_t_1 = __pyx_v_self->_doc->_c_doc;
  __pyx_v_c_doc = __pyx_t_1;

  /* "lxml/etree.pyx":681
 *         """Removes DOCTYPE and internal subset from the document."""
 *         cdef xmlDoc* c_doc = self._doc._c_doc
 *         cdef tree.xmlNode* c_dtd = <xmlNode*>c_doc.intSubset             # <<<<<<<<<<<<<<
 *         if c_dtd is NULL:
 *             return
*/
  __pyx_v_c_dtd = ((xmlNode *)__pyx_v_c_doc->intSubset);

  /* "lxml/etree.pyx":682
 *         cdef xmlDoc* c_doc = self._doc._c_doc
 *         cdef tree.xmlNode* c_dtd = <xmlNode*>c_doc.intSubset
 *         if c_dtd is NULL:             # <<<<<<<<<<<<<<
 *             return
 *         tree.xmlUnlinkNode(c_dtd)
*/
  __pyx_t_2 = (__pyx_v_c_dtd == NULL);
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":683
 *         cdef tree.xmlNode* c_dtd = <xmlNode*>c_doc.intSubset
 *         if c_dtd is NULL:
 *             return             # <<<<<<<<<<<<<<
 *         tree.xmlUnlinkNode(c_dtd)
 *         tree.xmlFreeNode(c_dtd)
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "lxml/etree.pyx":682
 *         cdef xmlDoc* c_doc = self._doc._c_doc
 *         cdef tree.xmlNode* c_dtd = <xmlNode*>c_doc.intSubset
 *         if c_dtd is NULL:             # <<<<<<<<<<<<<<
 *             return
 *         tree.xmlUnlinkNode(c_dtd)
*/
  }

  /* "lxml/etree.pyx":684
 *         if c_dtd is NULL:
 *             return
 *         tree.xmlUnlinkNode(c_dtd)             # <<<<<<<<<<<<<<
 *         tree.xmlFreeNode(c_dtd)
 * 
*/
  xmlUnlinkNode(__pyx_v_c_dtd);

  /* "lxml/etree.pyx":685
 *             return
 *         tree.xmlUnlinkNode(c_dtd)
 *         tree.xmlFreeNode(c_dtd)             # <<<<<<<<<<<<<<
 * 
 *     property public_id:
*/
  xmlFreeNode(__pyx_v_c_dtd);

  /* "lxml/etree.pyx":678
 *         return  tree.xmlCreateIntSubset(c_doc, c_name, NULL, NULL)
 * 
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         """Removes DOCTYPE and internal subset from the document."""
 *         cdef xmlDoc* c_doc = self._doc._c_doc
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":693
 *         exist, setting this variable (even to None) will create one.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             root_name, public_id, system_url = self._doc.getdoctype()
 *             return public_id
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7DocInfo_9public_id_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7DocInfo_9public_id_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_7DocInfo_9public_id___get__(((struct __pyx_obj_4lxml_5etree_DocInfo *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_9public_id___get__(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self) {
  CYTHON_UNUSED PyObject *__pyx_v_root_name = NULL;
  PyObject *__pyx_v_public_id = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_system_url = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *(*__pyx_t_6)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lxml/etree.pyx":694
 *         """
 *         def __get__(self):
 *             root_name, public_id, system_url = self._doc.getdoctype()             # <<<<<<<<<<<<<<
 *             return public_id
 * 
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_9_Document_getdoctype(__pyx_v_self->_doc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 694, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 3)) {
      if (size > 3) __Pyx_RaiseTooManyValuesError(3);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 694, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
      __Pyx_INCREF(__pyx_t_3);
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2);
      __Pyx_INCREF(__pyx_t_4);
    } else {
      __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 694, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 694, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyList_GetItemRefFast(sequence, 2, __Pyx_ReferenceSharing_SharedReference);
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 694, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_4);
    }
    #else
    __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 694, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 694, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 694, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 694, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_6 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_5);
    index = 0; __pyx_t_2 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 2; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 3) < (0)) __PYX_ERR(0, 694, __pyx_L1_error)
    __pyx_t_6 = NULL;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 694, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_root_name = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_public_id = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_system_url = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "lxml/etree.pyx":695
 *         def __get__(self):
 *             root_name, public_id, system_url = self._doc.getdoctype()
 *             return public_id             # <<<<<<<<<<<<<<
 * 
 *         def __set__(self, value):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_public_id);
  __pyx_r = __pyx_v_public_id;
  goto __pyx_L0;

  /* "lxml/etree.pyx":693
 *         exist, setting this variable (even to None) will create one.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             root_name, public_id, system_url = self._doc.getdoctype()
 *             return public_id
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree.DocInfo.public_id.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_root_name);
  __Pyx_XDECREF(__pyx_v_public_id);
  __Pyx_XDECREF(__pyx_v_system_url);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":697
 *             return public_id
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             cdef xmlChar* c_value = NULL
 *             if value is not None:
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_7DocInfo_9public_id_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_4lxml_5etree_7DocInfo_9public_id_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_7DocInfo_9public_id_2__set__(((struct __pyx_obj_4lxml_5etree_DocInfo *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_7DocInfo_9public_id_2__set__(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self, PyObject *__pyx_v_value) {
  xmlChar *__pyx_v_c_value;
  PyObject *__pyx_v_match = NULL;
  xmlDtd *__pyx_v_c_dtd;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  PyObject *__pyx_t_6[3];
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);

  /* "lxml/etree.pyx":698
 * 
 *         def __set__(self, value):
 *             cdef xmlChar* c_value = NULL             # <<<<<<<<<<<<<<
 *             if value is not None:
 *                 match = _find_invalid_public_id_characters(value)
*/
  __pyx_v_c_value = NULL;

  /* "lxml/etree.pyx":699
 *         def __set__(self, value):
 *             cdef xmlChar* c_value = NULL
 *             if value is not None:             # <<<<<<<<<<<<<<
 *                 match = _find_invalid_public_id_characters(value)
 *                 if match:
*/
  __pyx_t_1 = (__pyx_v_value != Py_None);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":700
 *             cdef xmlChar* c_value = NULL
 *             if value is not None:
 *                 match = _find_invalid_public_id_characters(value)             # <<<<<<<<<<<<<<
 *                 if match:
 *                     raise ValueError, f'Invalid character(s) {match.group(0)!r} in public_id.'
*/
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_v_4lxml_5etree__find_invalid_public_id_characters);
    __pyx_t_4 = __pyx_v_4lxml_5etree__find_invalid_public_id_characters; 
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_value};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 700, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_v_match = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "lxml/etree.pyx":701
 *             if value is not None:
 *                 match = _find_invalid_public_id_characters(value)
 *                 if match:             # <<<<<<<<<<<<<<
 *                     raise ValueError, f'Invalid character(s) {match.group(0)!r} in public_id.'
 *                 value = _utf8(value)
*/
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_match); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 701, __pyx_L1_error)
    if (unlikely(__pyx_t_1)) {

      /* "lxml/etree.pyx":702
 *                 match = _find_invalid_public_id_characters(value)
 *                 if match:
 *                     raise ValueError, f'Invalid character(s) {match.group(0)!r} in public_id.'             # <<<<<<<<<<<<<<
 *                 value = _utf8(value)
 *                 c_value = tree.xmlStrdup(_xcstr(value))
*/
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_match, __pyx_mstate_global->__pyx_n_u_group); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 702, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_mstate_global->__pyx_tuple[2], NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 702, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_4), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 702, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6[0] = __pyx_mstate_global->__pyx_kp_u_Invalid_character_s;
      __pyx_t_6[1] = __pyx_t_2;
      __pyx_t_6[2] = __pyx_mstate_global->__pyx_kp_u_in_public_id;
      __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_6, 3, 21 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 14, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2));
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 702, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_t_4, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __PYX_ERR(0, 702, __pyx_L1_error)

      /* "lxml/etree.pyx":701
 *             if value is not None:
 *                 match = _find_invalid_public_id_characters(value)
 *                 if match:             # <<<<<<<<<<<<<<
 *                     raise ValueError, f'Invalid character(s) {match.group(0)!r} in public_id.'
 *                 value = _utf8(value)
*/
    }

    /* "lxml/etree.pyx":703
 *                 if match:
 *                     raise ValueError, f'Invalid character(s) {match.group(0)!r} in public_id.'
 *                 value = _utf8(value)             # <<<<<<<<<<<<<<
 *                 c_value = tree.xmlStrdup(_xcstr(value))
 *                 if not c_value:
*/
    __pyx_t_4 = __pyx_f_4lxml_5etree__utf8(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 703, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "lxml/etree.pyx":704
 *                     raise ValueError, f'Invalid character(s) {match.group(0)!r} in public_id.'
 *                 value = _utf8(value)
 *                 c_value = tree.xmlStrdup(_xcstr(value))             # <<<<<<<<<<<<<<
 *                 if not c_value:
 *                     raise MemoryError()
*/
    __pyx_v_c_value = xmlStrdup((const xmlChar*)PyBytes_AS_STRING(__pyx_v_value));

    /* "lxml/etree.pyx":705
 *                 value = _utf8(value)
 *                 c_value = tree.xmlStrdup(_xcstr(value))
 *                 if not c_value:             # <<<<<<<<<<<<<<
 *                     raise MemoryError()
 * 
*/
    __pyx_t_1 = (!(__pyx_v_c_value != 0));
    if (unlikely(__pyx_t_1)) {

      /* "lxml/etree.pyx":706
 *                 c_value = tree.xmlStrdup(_xcstr(value))
 *                 if not c_value:
 *                     raise MemoryError()             # <<<<<<<<<<<<<<
 * 
 *             c_dtd = self._get_c_dtd()
*/
      PyErr_NoMemory(); __PYX_ERR(0, 706, __pyx_L1_error)

      /* "lxml/etree.pyx":705
 *                 value = _utf8(value)
 *                 c_value = tree.xmlStrdup(_xcstr(value))
 *                 if not c_value:             # <<<<<<<<<<<<<<
 *                     raise MemoryError()
 * 
*/
    }

    /* "lxml/etree.pyx":699
 *         def __set__(self, value):
 *             cdef xmlChar* c_value = NULL
 *             if value is not None:             # <<<<<<<<<<<<<<
 *                 match = _find_invalid_public_id_characters(value)
 *                 if match:
*/
  }

  /* "lxml/etree.pyx":708
 *                     raise MemoryError()
 * 
 *             c_dtd = self._get_c_dtd()             # <<<<<<<<<<<<<<
 *             if not c_dtd:
 *                 tree.xmlFree(c_value)
*/
  __pyx_v_c_dtd = __pyx_f_4lxml_5etree_7DocInfo__get_c_dtd(__pyx_v_self);

  /* "lxml/etree.pyx":709
 * 
 *             c_dtd = self._get_c_dtd()
 *             if not c_dtd:             # <<<<<<<<<<<<<<
 *                 tree.xmlFree(c_value)
 *                 raise MemoryError()
*/
  __pyx_t_1 = (!(__pyx_v_c_dtd != 0));
  if (unlikely(__pyx_t_1)) {

    /* "lxml/etree.pyx":710
 *             c_dtd = self._get_c_dtd()
 *             if not c_dtd:
 *                 tree.xmlFree(c_value)             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 *             if c_dtd.ExternalID:
*/
    xmlFree(__pyx_v_c_value);

    /* "lxml/etree.pyx":711
 *             if not c_dtd:
 *                 tree.xmlFree(c_value)
 *                 raise MemoryError()             # <<<<<<<<<<<<<<
 *             if c_dtd.ExternalID:
 *                 tree.xmlFree(<void*>c_dtd.ExternalID)
*/
    PyErr_NoMemory(); __PYX_ERR(0, 711, __pyx_L1_error)

    /* "lxml/etree.pyx":709
 * 
 *             c_dtd = self._get_c_dtd()
 *             if not c_dtd:             # <<<<<<<<<<<<<<
 *                 tree.xmlFree(c_value)
 *                 raise MemoryError()
*/
  }

  /* "lxml/etree.pyx":712
 *                 tree.xmlFree(c_value)
 *                 raise MemoryError()
 *             if c_dtd.ExternalID:             # <<<<<<<<<<<<<<
 *                 tree.xmlFree(<void*>c_dtd.ExternalID)
 *             c_dtd.ExternalID = c_value
*/
  __pyx_t_1 = (__pyx_v_c_dtd->ExternalID != 0);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":713
 *                 raise MemoryError()
 *             if c_dtd.ExternalID:
 *                 tree.xmlFree(<void*>c_dtd.ExternalID)             # <<<<<<<<<<<<<<
 *             c_dtd.ExternalID = c_value
 * 
*/
    xmlFree(((void *)__pyx_v_c_dtd->ExternalID));

    /* "lxml/etree.pyx":712
 *                 tree.xmlFree(c_value)
 *                 raise MemoryError()
 *             if c_dtd.ExternalID:             # <<<<<<<<<<<<<<
 *                 tree.xmlFree(<void*>c_dtd.ExternalID)
 *             c_dtd.ExternalID = c_value
*/
  }

  /* "lxml/etree.pyx":714
 *             if c_dtd.ExternalID:
 *                 tree.xmlFree(<void*>c_dtd.ExternalID)
 *             c_dtd.ExternalID = c_value             # <<<<<<<<<<<<<<
 * 
 *     property system_url:
*/
  __pyx_v_c_dtd->ExternalID = __pyx_v_c_value;

  /* "lxml/etree.pyx":697
 *             return public_id
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             cdef xmlChar* c_value = NULL
 *             if value is not None:
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.DocInfo.public_id.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_match);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":722
 *         exist, setting this variable (even to None) will create one.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             root_name, public_id, system_url = self._doc.getdoctype()
 *             return system_url
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7DocInfo_10system_url_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7DocInfo_10system_url_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_7DocInfo_10system_url___get__(((struct __pyx_obj_4lxml_5etree_DocInfo *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_10system_url___get__(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self) {
  CYTHON_UNUSED PyObject *__pyx_v_root_name = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_public_id = NULL;
  PyObject *__pyx_v_system_url = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *(*__pyx_t_6)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lxml/etree.pyx":723
 *         """
 *         def __get__(self):
 *             root_name, public_id, system_url = self._doc.getdoctype()             # <<<<<<<<<<<<<<
 *             return system_url
 * 
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_9_Document_getdoctype(__pyx_v_self->_doc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 723, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 3)) {
      if (size > 3) __Pyx_RaiseTooManyValuesError(3);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 723, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
      __Pyx_INCREF(__pyx_t_3);
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2);
      __Pyx_INCREF(__pyx_t_4);
    } else {
      __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 723, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 723, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyList_GetItemRefFast(sequence, 2, __Pyx_ReferenceSharing_SharedReference);
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 723, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_4);
    }
    #else
    __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 723, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 723, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 723, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 723, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_6 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_5);
    index = 0; __pyx_t_2 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 2; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 3) < (0)) __PYX_ERR(0, 723, __pyx_L1_error)
    __pyx_t_6 = NULL;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 723, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_root_name = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_public_id = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_system_url = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "lxml/etree.pyx":724
 *         def __get__(self):
 *             root_name, public_id, system_url = self._doc.getdoctype()
 *             return system_url             # <<<<<<<<<<<<<<
 * 
 *         def __set__(self, value):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_system_url);
  __pyx_r = __pyx_v_system_url;
  goto __pyx_L0;

  /* "lxml/etree.pyx":722
 *         exist, setting this variable (even to None) will create one.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             root_name, public_id, system_url = self._doc.getdoctype()
 *             return system_url
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree.DocInfo.system_url.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_root_name);
  __Pyx_XDECREF(__pyx_v_public_id);
  __Pyx_XDECREF(__pyx_v_system_url);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":726
 *             return system_url
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             cdef xmlChar* c_value = NULL
 *             if value is not None:
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_7DocInfo_10system_url_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_4lxml_5etree_7DocInfo_10system_url_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_7DocInfo_10system_url_2__set__(((struct __pyx_obj_4lxml_5etree_DocInfo *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_7DocInfo_10system_url_2__set__(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self, PyObject *__pyx_v_value) {
  xmlChar *__pyx_v_c_value;
  PyObject *__pyx_v_bvalue = NULL;
  xmlDtd *__pyx_v_c_dtd;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "lxml/etree.pyx":727
 * 
 *         def __set__(self, value):
 *             cdef xmlChar* c_value = NULL             # <<<<<<<<<<<<<<
 *             if value is not None:
 *                 bvalue = _utf8(value)
*/
  __pyx_v_c_value = NULL;

  /* "lxml/etree.pyx":728
 *         def __set__(self, value):
 *             cdef xmlChar* c_value = NULL
 *             if value is not None:             # <<<<<<<<<<<<<<
 *                 bvalue = _utf8(value)
 *                 # sys_url may be any valid unicode string that can be
*/
  __pyx_t_1 = (__pyx_v_value != Py_None);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":729
 *             cdef xmlChar* c_value = NULL
 *             if value is not None:
 *                 bvalue = _utf8(value)             # <<<<<<<<<<<<<<
 *                 # sys_url may be any valid unicode string that can be
 *                 # enclosed in single quotes or quotes.
*/
    __pyx_t_2 = __pyx_f_4lxml_5etree__utf8(__pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 729, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_bvalue = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "lxml/etree.pyx":732
 *                 # sys_url may be any valid unicode string that can be
 *                 # enclosed in single quotes or quotes.
 *                 if b"'" in bvalue and b'"' in bvalue:             # <<<<<<<<<<<<<<
 *                     raise ValueError(
 *                         'System URL may not contain both single (\') and double quotes (").')
*/
    __pyx_t_3 = (__Pyx_PySequence_ContainsTF(__pyx_mstate_global->__pyx_kp_b__4, __pyx_v_bvalue, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 732, __pyx_L1_error)
    if (__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_3 = (__Pyx_PySequence_ContainsTF(__pyx_mstate_global->__pyx_kp_b__14, __pyx_v_bvalue, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 732, __pyx_L1_error)
    __pyx_t_1 = __pyx_t_3;
    __pyx_L5_bool_binop_done:;
    if (unlikely(__pyx_t_1)) {

      /* "lxml/etree.pyx":733
 *                 # enclosed in single quotes or quotes.
 *                 if b"'" in bvalue and b'"' in bvalue:
 *                     raise ValueError(             # <<<<<<<<<<<<<<
 *                         'System URL may not contain both single (\') and double quotes (").')
 *                 c_value = tree.xmlStrdup(_xcstr(bvalue))
*/
      __pyx_t_4 = NULL;
      __pyx_t_5 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_System_URL_may_not_contain_both};
        __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 733, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(0, 733, __pyx_L1_error)

      /* "lxml/etree.pyx":732
 *                 # sys_url may be any valid unicode string that can be
 *                 # enclosed in single quotes or quotes.
 *                 if b"'" in bvalue and b'"' in bvalue:             # <<<<<<<<<<<<<<
 *                     raise ValueError(
 *                         'System URL may not contain both single (\') and double quotes (").')
*/
    }

    /* "lxml/etree.pyx":735
 *                     raise ValueError(
 *                         'System URL may not contain both single (\') and double quotes (").')
 *                 c_value = tree.xmlStrdup(_xcstr(bvalue))             # <<<<<<<<<<<<<<
 *                 if not c_value:
 *                     raise MemoryError()
*/
    __pyx_v_c_value = xmlStrdup((const xmlChar*)PyBytes_AS_STRING(__pyx_v_bvalue));

    /* "lxml/etree.pyx":736
 *                         'System URL may not contain both single (\') and double quotes (").')
 *                 c_value = tree.xmlStrdup(_xcstr(bvalue))
 *                 if not c_value:             # <<<<<<<<<<<<<<
 *                     raise MemoryError()
 * 
*/
    __pyx_t_1 = (!(__pyx_v_c_value != 0));
    if (unlikely(__pyx_t_1)) {

      /* "lxml/etree.pyx":737
 *                 c_value = tree.xmlStrdup(_xcstr(bvalue))
 *                 if not c_value:
 *                     raise MemoryError()             # <<<<<<<<<<<<<<
 * 
 *             c_dtd = self._get_c_dtd()
*/
      PyErr_NoMemory(); __PYX_ERR(0, 737, __pyx_L1_error)

      /* "lxml/etree.pyx":736
 *                         'System URL may not contain both single (\') and double quotes (").')
 *                 c_value = tree.xmlStrdup(_xcstr(bvalue))
 *                 if not c_value:             # <<<<<<<<<<<<<<
 *                     raise MemoryError()
 * 
*/
    }

    /* "lxml/etree.pyx":728
 *         def __set__(self, value):
 *             cdef xmlChar* c_value = NULL
 *             if value is not None:             # <<<<<<<<<<<<<<
 *                 bvalue = _utf8(value)
 *                 # sys_url may be any valid unicode string that can be
*/
  }

  /* "lxml/etree.pyx":739
 *                     raise MemoryError()
 * 
 *             c_dtd = self._get_c_dtd()             # <<<<<<<<<<<<<<
 *             if not c_dtd:
 *                 tree.xmlFree(c_value)
*/
  __pyx_v_c_dtd = __pyx_f_4lxml_5etree_7DocInfo__get_c_dtd(__pyx_v_self);

  /* "lxml/etree.pyx":740
 * 
 *             c_dtd = self._get_c_dtd()
 *             if not c_dtd:             # <<<<<<<<<<<<<<
 *                 tree.xmlFree(c_value)
 *                 raise MemoryError()
*/
  __pyx_t_1 = (!(__pyx_v_c_dtd != 0));
  if (unlikely(__pyx_t_1)) {

    /* "lxml/etree.pyx":741
 *             c_dtd = self._get_c_dtd()
 *             if not c_dtd:
 *                 tree.xmlFree(c_value)             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 *             if c_dtd.SystemID:
*/
    xmlFree(__pyx_v_c_value);

    /* "lxml/etree.pyx":742
 *             if not c_dtd:
 *                 tree.xmlFree(c_value)
 *                 raise MemoryError()             # <<<<<<<<<<<<<<
 *             if c_dtd.SystemID:
 *                 tree.xmlFree(<void*>c_dtd.SystemID)
*/
    PyErr_NoMemory(); __PYX_ERR(0, 742, __pyx_L1_error)

    /* "lxml/etree.pyx":740
 * 
 *             c_dtd = self._get_c_dtd()
 *             if not c_dtd:             # <<<<<<<<<<<<<<
 *                 tree.xmlFree(c_value)
 *                 raise MemoryError()
*/
  }

  /* "lxml/etree.pyx":743
 *                 tree.xmlFree(c_value)
 *                 raise MemoryError()
 *             if c_dtd.SystemID:             # <<<<<<<<<<<<<<
 *                 tree.xmlFree(<void*>c_dtd.SystemID)
 *             c_dtd.SystemID = c_value
*/
  __pyx_t_1 = (__pyx_v_c_dtd->SystemID != 0);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":744
 *                 raise MemoryError()
 *             if c_dtd.SystemID:
 *                 tree.xmlFree(<void*>c_dtd.SystemID)             # <<<<<<<<<<<<<<
 *             c_dtd.SystemID = c_value
 * 
*/
    xmlFree(((void *)__pyx_v_c_dtd->SystemID));

    /* "lxml/etree.pyx":743
 *                 tree.xmlFree(c_value)
 *                 raise MemoryError()
 *             if c_dtd.SystemID:             # <<<<<<<<<<<<<<
 *                 tree.xmlFree(<void*>c_dtd.SystemID)
 *             c_dtd.SystemID = c_value
*/
  }

  /* "lxml/etree.pyx":745
 *             if c_dtd.SystemID:
 *                 tree.xmlFree(<void*>c_dtd.SystemID)
 *             c_dtd.SystemID = c_value             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __pyx_v_c_dtd->SystemID = __pyx_v_c_value;

  /* "lxml/etree.pyx":726
 *             return system_url
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             cdef xmlChar* c_value = NULL
 *             if value is not None:
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.DocInfo.system_url.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bvalue);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":747
 *             c_dtd.SystemID = c_value
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def xml_version(self):
 *         """Returns the XML version as declared by the document."""
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7DocInfo_11xml_version_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7DocInfo_11xml_version_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_7DocInfo_11xml_version___get__(((struct __pyx_obj_4lxml_5etree_DocInfo *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_11xml_version___get__(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self) {
  PyObject *__pyx_v_xml_version = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_encoding = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lxml/etree.pyx":750
 *     def xml_version(self):
 *         """Returns the XML version as declared by the document."""
 *         xml_version, encoding = self._doc.getxmlinfo()             # <<<<<<<<<<<<<<
 *         return xml_version
 * 
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_9_Document_getxmlinfo(__pyx_v_self->_doc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 750, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 750, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
      __Pyx_INCREF(__pyx_t_3);
    } else {
      __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 750, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 750, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_3);
    }
    #else
    __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 750, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 750, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 750, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4);
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < (0)) __PYX_ERR(0, 750, __pyx_L1_error)
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 750, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_xml_version = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_encoding = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "lxml/etree.pyx":751
 *         """Returns the XML version as declared by the document."""
 *         xml_version, encoding = self._doc.getxmlinfo()
 *         return xml_version             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_xml_version);
  __pyx_r = __pyx_v_xml_version;
  goto __pyx_L0;

  /* "lxml/etree.pyx":747
 *             c_dtd.SystemID = c_value
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def xml_version(self):
 *         """Returns the XML version as declared by the document."""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.DocInfo.xml_version.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_xml_version);
  __Pyx_XDECREF(__pyx_v_encoding);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":753
 *         return xml_version
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def encoding(self):
 *         """Returns the encoding name as declared by the document."""
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7DocInfo_8encoding_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7DocInfo_8encoding_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_7DocInfo_8encoding___get__(((struct __pyx_obj_4lxml_5etree_DocInfo *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_8encoding___get__(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self) {
  CYTHON_UNUSED PyObject *__pyx_v_xml_version = NULL;
  PyObject *__pyx_v_encoding = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lxml/etree.pyx":756
 *     def encoding(self):
 *         """Returns the encoding name as declared by the document."""
 *         xml_version, encoding = self._doc.getxmlinfo()             # <<<<<<<<<<<<<<
 *         return encoding
 * 
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_9_Document_getxmlinfo(__pyx_v_self->_doc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 756, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 756, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
      __Pyx_INCREF(__pyx_t_3);
    } else {
      __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 756, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 756, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_3);
    }
    #else
    __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 756, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 756, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 756, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4);
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < (0)) __PYX_ERR(0, 756, __pyx_L1_error)
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 756, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_xml_version = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_encoding = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "lxml/etree.pyx":757
 *         """Returns the encoding name as declared by the document."""
 *         xml_version, encoding = self._doc.getxmlinfo()
 *         return encoding             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_encoding);
  __pyx_r = __pyx_v_encoding;
  goto __pyx_L0;

  /* "lxml/etree.pyx":753
 *         return xml_version
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def encoding(self):
 *         """Returns the encoding name as declared by the document."""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.DocInfo.encoding.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_xml_version);
  __Pyx_XDECREF(__pyx_v_encoding);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":759
 *         return encoding
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def standalone(self):
 *         """Returns the standalone flag as declared by the document.  The possible
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7DocInfo_10standalone_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7DocInfo_10standalone_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_7DocInfo_10standalone___get__(((struct __pyx_obj_4lxml_5etree_DocInfo *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_10standalone___get__(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lxml/etree.pyx":768
 *         ``standalone`` flag was set to ``'yes'`` or not.
 *         """
 *         return self._doc.isstandalone()             # <<<<<<<<<<<<<<
 * 
 *     property URL:
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree_9_Document_isstandalone(__pyx_v_self->_doc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 768, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":759
 *         return encoding
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def standalone(self):
 *         """Returns the standalone flag as declared by the document.  The possible
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.DocInfo.standalone.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":772
 *     property URL:
 *         "The source URL of the document (or None if unknown)."
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if self._doc._c_doc.URL is NULL:
 *                 return None
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7DocInfo_3URL_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7DocInfo_3URL_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_7DocInfo_3URL___get__(((struct __pyx_obj_4lxml_5etree_DocInfo *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_3URL___get__(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lxml/etree.pyx":773
 *         "The source URL of the document (or None if unknown)."
 *         def __get__(self):
 *             if self._doc._c_doc.URL is NULL:             # <<<<<<<<<<<<<<
 *                 return None
 *             return _decodeFilename(self._doc._c_doc.URL)
*/
  __pyx_t_1 = (__pyx_v_self->_doc->_c_doc->URL == NULL);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":774
 *         def __get__(self):
 *             if self._doc._c_doc.URL is NULL:
 *                 return None             # <<<<<<<<<<<<<<
 *             return _decodeFilename(self._doc._c_doc.URL)
 *         def __set__(self, url):
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "lxml/etree.pyx":773
 *         "The source URL of the document (or None if unknown)."
 *         def __get__(self):
 *             if self._doc._c_doc.URL is NULL:             # <<<<<<<<<<<<<<
 *                 return None
 *             return _decodeFilename(self._doc._c_doc.URL)
*/
  }

  /* "lxml/etree.pyx":775
 *             if self._doc._c_doc.URL is NULL:
 *                 return None
 *             return _decodeFilename(self._doc._c_doc.URL)             # <<<<<<<<<<<<<<
 *         def __set__(self, url):
 *             url = _encodeFilename(url)
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree__decodeFilename(__pyx_v_self->_doc->_c_doc->URL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 775, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":772
 *     property URL:
 *         "The source URL of the document (or None if unknown)."
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if self._doc._c_doc.URL is NULL:
 *                 return None
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.DocInfo.URL.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":776
 *                 return None
 *             return _decodeFilename(self._doc._c_doc.URL)
 *         def __set__(self, url):             # <<<<<<<<<<<<<<
 *             url = _encodeFilename(url)
 *             c_oldurl = self._doc._c_doc.URL
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_7DocInfo_3URL_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_url); /*proto*/
static int __pyx_pw_4lxml_5etree_7DocInfo_3URL_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_url) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_7DocInfo_3URL_2__set__(((struct __pyx_obj_4lxml_5etree_DocInfo *)__pyx_v_self), ((PyObject *)__pyx_v_url));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_7DocInfo_3URL_2__set__(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self, PyObject *__pyx_v_url) {
  const xmlChar *__pyx_v_c_oldurl;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  const xmlChar *__pyx_t_2;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_url);

  /* "lxml/etree.pyx":777
 *             return _decodeFilename(self._doc._c_doc.URL)
 *         def __set__(self, url):
 *             url = _encodeFilename(url)             # <<<<<<<<<<<<<<
 *             c_oldurl = self._doc._c_doc.URL
 *             if url is None:
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__encodeFilename(__pyx_v_url); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 777, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_url, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "lxml/etree.pyx":778
 *         def __set__(self, url):
 *             url = _encodeFilename(url)
 *             c_oldurl = self._doc._c_doc.URL             # <<<<<<<<<<<<<<
 *             if url is None:
 *                 self._doc._c_doc.URL = NULL
*/
  __pyx_t_2 = __pyx_v_self->_doc->_c_doc->URL;
  __pyx_v_c_oldurl = __pyx_t_2;

  /* "lxml/etree.pyx":779
 *             url = _encodeFilename(url)
 *             c_oldurl = self._doc._c_doc.URL
 *             if url is None:             # <<<<<<<<<<<<<<
 *                 self._doc._c_doc.URL = NULL
 *             else:
*/
  __pyx_t_3 = (__pyx_v_url == Py_None);
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":780
 *             c_oldurl = self._doc._c_doc.URL
 *             if url is None:
 *                 self._doc._c_doc.URL = NULL             # <<<<<<<<<<<<<<
 *             else:
 *                 self._doc._c_doc.URL = tree.xmlStrdup(_xcstr(url))
*/
    __pyx_v_self->_doc->_c_doc->URL = NULL;

    /* "lxml/etree.pyx":779
 *             url = _encodeFilename(url)
 *             c_oldurl = self._doc._c_doc.URL
 *             if url is None:             # <<<<<<<<<<<<<<
 *                 self._doc._c_doc.URL = NULL
 *             else:
*/
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":782
 *                 self._doc._c_doc.URL = NULL
 *             else:
 *                 self._doc._c_doc.URL = tree.xmlStrdup(_xcstr(url))             # <<<<<<<<<<<<<<
 *             if c_oldurl is not NULL:
 *                 tree.xmlFree(<void*>c_oldurl)
*/
  /*else*/ {
    __pyx_v_self->_doc->_c_doc->URL = xmlStrdup((const xmlChar*)PyBytes_AS_STRING(__pyx_v_url));
  }
  __pyx_L3:;

  /* "lxml/etree.pyx":783
 *             else:
 *                 self._doc._c_doc.URL = tree.xmlStrdup(_xcstr(url))
 *             if c_oldurl is not NULL:             # <<<<<<<<<<<<<<
 *                 tree.xmlFree(<void*>c_oldurl)
 * 
*/
  __pyx_t_3 = (__pyx_v_c_oldurl != NULL);
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":784
 *                 self._doc._c_doc.URL = tree.xmlStrdup(_xcstr(url))
 *             if c_oldurl is not NULL:
 *                 tree.xmlFree(<void*>c_oldurl)             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
    xmlFree(((void *)__pyx_v_c_oldurl));

    /* "lxml/etree.pyx":783
 *             else:
 *                 self._doc._c_doc.URL = tree.xmlStrdup(_xcstr(url))
 *             if c_oldurl is not NULL:             # <<<<<<<<<<<<<<
 *                 tree.xmlFree(<void*>c_oldurl)
 * 
*/
  }

  /* "lxml/etree.pyx":776
 *                 return None
 *             return _decodeFilename(self._doc._c_doc.URL)
 *         def __set__(self, url):             # <<<<<<<<<<<<<<
 *             url = _encodeFilename(url)
 *             c_oldurl = self._doc._c_doc.URL
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.DocInfo.URL.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_url);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":786
 *                 tree.xmlFree(<void*>c_oldurl)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def doctype(self):
 *         """Returns a DOCTYPE declaration string for the document."""
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7DocInfo_7doctype_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7DocInfo_7doctype_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_7DocInfo_7doctype___get__(((struct __pyx_obj_4lxml_5etree_DocInfo *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_7doctype___get__(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self) {
  PyObject *__pyx_v_root_name = NULL;
  PyObject *__pyx_v_public_id = NULL;
  PyObject *__pyx_v_system_url = NULL;
  PyObject *__pyx_v_quoted_system_url = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *(*__pyx_t_6)(PyObject *);
  int __pyx_t_7;
  PyObject *__pyx_t_8[3];
  PyObject *__pyx_t_9[7];
  PyObject *__pyx_t_10[5];
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lxml/etree.pyx":789
 *     def doctype(self):
 *         """Returns a DOCTYPE declaration string for the document."""
 *         root_name, public_id, system_url = self._doc.getdoctype()             # <<<<<<<<<<<<<<
 *         if system_url:
 *             # If '"' in system_url, we must escape it with single
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_9_Document_getdoctype(__pyx_v_self->_doc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 789, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 3)) {
      if (size > 3) __Pyx_RaiseTooManyValuesError(3);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 789, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
      __Pyx_INCREF(__pyx_t_3);
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2);
      __Pyx_INCREF(__pyx_t_4);
    } else {
      __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 789, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 789, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyList_GetItemRefFast(sequence, 2, __Pyx_ReferenceSharing_SharedReference);
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 789, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_4);
    }
    #else
    __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 789, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 789, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 789, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 789, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_6 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_5);
    index = 0; __pyx_t_2 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 2; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 3) < (0)) __PYX_ERR(0, 789, __pyx_L1_error)
    __pyx_t_6 = NULL;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 789, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_root_name = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_public_id = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_system_url = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "lxml/etree.pyx":790
 *         """Returns a DOCTYPE declaration string for the document."""
 *         root_name, public_id, system_url = self._doc.getdoctype()
 *         if system_url:             # <<<<<<<<<<<<<<
 *             # If '"' in system_url, we must escape it with single
 *             # quotes, otherwise escape with double quotes. If url
*/
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_system_url); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 790, __pyx_L1_error)
  if (__pyx_t_7) {

    /* "lxml/etree.pyx":795
 *             # contains both a single quote and a double quote, XML
 *             # standard is being violated.
 *             if '"' in system_url:             # <<<<<<<<<<<<<<
 *                 quoted_system_url = f"'{system_url}'"
 *             else:
*/
    __pyx_t_7 = (__Pyx_PySequence_ContainsTF(__pyx_mstate_global->__pyx_kp_u__14, __pyx_v_system_url, Py_EQ)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 795, __pyx_L1_error)
    if (__pyx_t_7) {

      /* "lxml/etree.pyx":796
 *             # standard is being violated.
 *             if '"' in system_url:
 *                 quoted_system_url = f"'{system_url}'"             # <<<<<<<<<<<<<<
 *             else:
 *                 quoted_system_url = f'"{system_url}"'
*/
      __pyx_t_1 = __Pyx_PyObject_FormatSimple(__pyx_v_system_url, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 796, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_8[0] = __pyx_mstate_global->__pyx_kp_u__4;
      __pyx_t_8[1] = __pyx_t_1;
      __pyx_t_8[2] = __pyx_mstate_global->__pyx_kp_u__4;
      __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_8, 3, 1 * 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1));
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 796, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_quoted_system_url = ((PyObject*)__pyx_t_4);
      __pyx_t_4 = 0;

      /* "lxml/etree.pyx":795
 *             # contains both a single quote and a double quote, XML
 *             # standard is being violated.
 *             if '"' in system_url:             # <<<<<<<<<<<<<<
 *                 quoted_system_url = f"'{system_url}'"
 *             else:
*/
      goto __pyx_L6;
    }

    /* "lxml/etree.pyx":798
 *                 quoted_system_url = f"'{system_url}'"
 *             else:
 *                 quoted_system_url = f'"{system_url}"'             # <<<<<<<<<<<<<<
 *         if public_id:
 *             if system_url:
*/
    /*else*/ {
      __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_system_url, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 798, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_8[0] = __pyx_mstate_global->__pyx_kp_u__14;
      __pyx_t_8[1] = __pyx_t_4;
      __pyx_t_8[2] = __pyx_mstate_global->__pyx_kp_u__14;
      __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_8, 3, 1 * 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4));
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 798, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_quoted_system_url = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;
    }
    __pyx_L6:;

    /* "lxml/etree.pyx":790
 *         """Returns a DOCTYPE declaration string for the document."""
 *         root_name, public_id, system_url = self._doc.getdoctype()
 *         if system_url:             # <<<<<<<<<<<<<<
 *             # If '"' in system_url, we must escape it with single
 *             # quotes, otherwise escape with double quotes. If url
*/
  }

  /* "lxml/etree.pyx":799
 *             else:
 *                 quoted_system_url = f'"{system_url}"'
 *         if public_id:             # <<<<<<<<<<<<<<
 *             if system_url:
 *                 return f'<!DOCTYPE {root_name} PUBLIC "{public_id}" {quoted_system_url}>'
*/
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_public_id); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 799, __pyx_L1_error)
  if (__pyx_t_7) {

    /* "lxml/etree.pyx":800
 *                 quoted_system_url = f'"{system_url}"'
 *         if public_id:
 *             if system_url:             # <<<<<<<<<<<<<<
 *                 return f'<!DOCTYPE {root_name} PUBLIC "{public_id}" {quoted_system_url}>'
 *             else:
*/
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_system_url); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 800, __pyx_L1_error)
    if (__pyx_t_7) {

      /* "lxml/etree.pyx":801
 *         if public_id:
 *             if system_url:
 *                 return f'<!DOCTYPE {root_name} PUBLIC "{public_id}" {quoted_system_url}>'             # <<<<<<<<<<<<<<
 *             else:
 *                 return f'<!DOCTYPE {root_name} PUBLIC "{public_id}">'
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __Pyx_PyObject_FormatSimple(__pyx_v_root_name, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 801, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_public_id, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 801, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (unlikely(!__pyx_v_quoted_system_url)) { __Pyx_RaiseUnboundLocalError("quoted_system_url"); __PYX_ERR(0, 801, __pyx_L1_error) }
      __pyx_t_9[0] = __pyx_mstate_global->__pyx_kp_u_DOCTYPE;
      __pyx_t_9[1] = __pyx_t_1;
      __pyx_t_9[2] = __pyx_mstate_global->__pyx_kp_u_PUBLIC;
      __pyx_t_9[3] = __pyx_t_4;
      __pyx_t_9[4] = __pyx_mstate_global->__pyx_kp_u__15;
      __pyx_t_9[5] = __pyx_v_quoted_system_url;
      __pyx_t_9[6] = __pyx_mstate_global->__pyx_kp_u__3;
      __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_9, 7, 10 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + 9 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4) + 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_v_quoted_system_url) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_v_quoted_system_url));
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 801, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L0;

      /* "lxml/etree.pyx":800
 *                 quoted_system_url = f'"{system_url}"'
 *         if public_id:
 *             if system_url:             # <<<<<<<<<<<<<<
 *                 return f'<!DOCTYPE {root_name} PUBLIC "{public_id}" {quoted_system_url}>'
 *             else:
*/
    }

    /* "lxml/etree.pyx":803
 *                 return f'<!DOCTYPE {root_name} PUBLIC "{public_id}" {quoted_system_url}>'
 *             else:
 *                 return f'<!DOCTYPE {root_name} PUBLIC "{public_id}">'             # <<<<<<<<<<<<<<
 *         elif system_url:
 *             return f'<!DOCTYPE {root_name} SYSTEM {quoted_system_url}>'
*/
    /*else*/ {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_v_root_name, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 803, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_public_id, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 803, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_10[0] = __pyx_mstate_global->__pyx_kp_u_DOCTYPE;
      __pyx_t_10[1] = __pyx_t_3;
      __pyx_t_10[2] = __pyx_mstate_global->__pyx_kp_u_PUBLIC;
      __pyx_t_10[3] = __pyx_t_4;
      __pyx_t_10[4] = __pyx_mstate_global->__pyx_kp_u__16;
      __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_10, 5, 10 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 9 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4) + 2, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4));
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 803, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;
    }

    /* "lxml/etree.pyx":799
 *             else:
 *                 quoted_system_url = f'"{system_url}"'
 *         if public_id:             # <<<<<<<<<<<<<<
 *             if system_url:
 *                 return f'<!DOCTYPE {root_name} PUBLIC "{public_id}" {quoted_system_url}>'
*/
  }

  /* "lxml/etree.pyx":804
 *             else:
 *                 return f'<!DOCTYPE {root_name} PUBLIC "{public_id}">'
 *         elif system_url:             # <<<<<<<<<<<<<<
 *             return f'<!DOCTYPE {root_name} SYSTEM {quoted_system_url}>'
 *         elif self._doc.hasdoctype():
*/
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_system_url); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 804, __pyx_L1_error)
  if (__pyx_t_7) {

    /* "lxml/etree.pyx":805
 *                 return f'<!DOCTYPE {root_name} PUBLIC "{public_id}">'
 *         elif system_url:
 *             return f'<!DOCTYPE {root_name} SYSTEM {quoted_system_url}>'             # <<<<<<<<<<<<<<
 *         elif self._doc.hasdoctype():
 *             return f'<!DOCTYPE {root_name}>'
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_FormatSimple(__pyx_v_root_name, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 805, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (unlikely(!__pyx_v_quoted_system_url)) { __Pyx_RaiseUnboundLocalError("quoted_system_url"); __PYX_ERR(0, 805, __pyx_L1_error) }
    __pyx_t_10[0] = __pyx_mstate_global->__pyx_kp_u_DOCTYPE;
    __pyx_t_10[1] = __pyx_t_1;
    __pyx_t_10[2] = __pyx_mstate_global->__pyx_kp_u_SYSTEM;
    __pyx_t_10[3] = __pyx_v_quoted_system_url;
    __pyx_t_10[4] = __pyx_mstate_global->__pyx_kp_u__3;
    __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_10, 5, 10 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + 8 + __Pyx_PyUnicode_GET_LENGTH(__pyx_v_quoted_system_url) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_v_quoted_system_url));
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 805, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;

    /* "lxml/etree.pyx":804
 *             else:
 *                 return f'<!DOCTYPE {root_name} PUBLIC "{public_id}">'
 *         elif system_url:             # <<<<<<<<<<<<<<
 *             return f'<!DOCTYPE {root_name} SYSTEM {quoted_system_url}>'
 *         elif self._doc.hasdoctype():
*/
  }

  /* "lxml/etree.pyx":806
 *         elif system_url:
 *             return f'<!DOCTYPE {root_name} SYSTEM {quoted_system_url}>'
 *         elif self._doc.hasdoctype():             # <<<<<<<<<<<<<<
 *             return f'<!DOCTYPE {root_name}>'
 *         else:
*/
  __pyx_t_7 = __pyx_f_4lxml_5etree_9_Document_hasdoctype(__pyx_v_self->_doc);
  if (__pyx_t_7) {

    /* "lxml/etree.pyx":807
 *             return f'<!DOCTYPE {root_name} SYSTEM {quoted_system_url}>'
 *         elif self._doc.hasdoctype():
 *             return f'<!DOCTYPE {root_name}>'             # <<<<<<<<<<<<<<
 *         else:
 *             return ''
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_root_name, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 807, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_8[0] = __pyx_mstate_global->__pyx_kp_u_DOCTYPE;
    __pyx_t_8[1] = __pyx_t_4;
    __pyx_t_8[2] = __pyx_mstate_global->__pyx_kp_u__3;
    __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_8, 3, 10 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4));
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 807, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "lxml/etree.pyx":806
 *         elif system_url:
 *             return f'<!DOCTYPE {root_name} SYSTEM {quoted_system_url}>'
 *         elif self._doc.hasdoctype():             # <<<<<<<<<<<<<<
 *             return f'<!DOCTYPE {root_name}>'
 *         else:
*/
  }

  /* "lxml/etree.pyx":809
 *             return f'<!DOCTYPE {root_name}>'
 *         else:
 *             return ''             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u__8);
    __pyx_r = __pyx_mstate_global->__pyx_kp_u__8;
    goto __pyx_L0;
  }

  /* "lxml/etree.pyx":786
 *                 tree.xmlFree(<void*>c_oldurl)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def doctype(self):
 *         """Returns a DOCTYPE declaration string for the document."""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree.DocInfo.doctype.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_root_name);
  __Pyx_XDECREF(__pyx_v_public_id);
  __Pyx_XDECREF(__pyx_v_system_url);
  __Pyx_XDECREF(__pyx_v_quoted_system_url);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":811
 *             return ''
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def internalDTD(self):
 *         """Returns a DTD validator based on the internal subset of the document."""
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7DocInfo_11internalDTD_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7DocInfo_11internalDTD_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_7DocInfo_11internalDTD___get__(((struct __pyx_obj_4lxml_5etree_DocInfo *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_11internalDTD___get__(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lxml/etree.pyx":814
 *     def internalDTD(self):
 *         """Returns a DTD validator based on the internal subset of the document."""
 *         return _dtdFactory(self._doc._c_doc.intSubset)             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__dtdFactory(__pyx_v_self->_doc->_c_doc->intSubset)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 814, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":811
 *             return ''
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def internalDTD(self):
 *         """Returns a DTD validator based on the internal subset of the document."""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.DocInfo.internalDTD.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":816
 *         return _dtdFactory(self._doc._c_doc.intSubset)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def externalDTD(self):
 *         """Returns a DTD validator based on the external subset of the document."""
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7DocInfo_11externalDTD_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7DocInfo_11externalDTD_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_7DocInfo_11externalDTD___get__(((struct __pyx_obj_4lxml_5etree_DocInfo *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_11externalDTD___get__(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lxml/etree.pyx":819
 *     def externalDTD(self):
 *         """Returns a DTD validator based on the external subset of the document."""
 *         return _dtdFactory(self._doc._c_doc.extSubset)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__dtdFactory(__pyx_v_self->_doc->_c_doc->extSubset)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 819, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":816
 *         return _dtdFactory(self._doc._c_doc.intSubset)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def externalDTD(self):
 *         """Returns a DTD validator based on the external subset of the document."""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.DocInfo.externalDTD.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":835
 *     cdef object _tag
 * 
 *     def _init(self):             # <<<<<<<<<<<<<<
 *         """_init(self)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_1_init(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element__init, "_init(self)\n\n        Called after object initialisation.  Custom subclasses may override\n        this if they recursively call _init() in the superclasses.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_1_init = {"_init", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_1_init, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element__init};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_1_init(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_init (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("_init", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("_init", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element__init(((struct LxmlElement *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8_Element__init(CYTHON_UNUSED struct LxmlElement *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_init", 0);

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":842
 *         """
 * 
 *     @cython.linetrace(False)             # <<<<<<<<<<<<<<
 *     @cython.profile(False)
 *     def __dealloc__(self):
*/

/* Python wrapper */
static void __pyx_pw_4lxml_5etree_8_Element_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_4lxml_5etree_8_Element_3__dealloc__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_pf_4lxml_5etree_8_Element_2__dealloc__(((struct LxmlElement *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_4lxml_5etree_8_Element_2__dealloc__(struct LxmlElement *__pyx_v_self) {
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "lxml/etree.pyx":847
 *         #print("trying to free node:", <int>self._c_node)
 *         #displayNode(self._c_node, 0)
 *         if self._c_node is not NULL:             # <<<<<<<<<<<<<<
 *             _unregisterProxy(self)
 *             attemptDeallocation(self._c_node)
*/
  __pyx_t_1 = (__pyx_v_self->_c_node != NULL);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":848
 *         #displayNode(self._c_node, 0)
 *         if self._c_node is not NULL:
 *             _unregisterProxy(self)             # <<<<<<<<<<<<<<
 *             attemptDeallocation(self._c_node)
 * 
*/
    __pyx_t_2 = __pyx_f_4lxml_5etree__unregisterProxy(__pyx_v_self); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 848, __pyx_L1_error)

    /* "lxml/etree.pyx":849
 *         if self._c_node is not NULL:
 *             _unregisterProxy(self)
 *             attemptDeallocation(self._c_node)             # <<<<<<<<<<<<<<
 * 
 *     # MANIPULATORS
*/
    (void)(__pyx_f_4lxml_5etree_attemptDeallocation(__pyx_v_self->_c_node));

    /* "lxml/etree.pyx":847
 *         #print("trying to free node:", <int>self._c_node)
 *         #displayNode(self._c_node, 0)
 *         if self._c_node is not NULL:             # <<<<<<<<<<<<<<
 *             _unregisterProxy(self)
 *             attemptDeallocation(self._c_node)
*/
  }

  /* "lxml/etree.pyx":842
 *         """
 * 
 *     @cython.linetrace(False)             # <<<<<<<<<<<<<<
 *     @cython.profile(False)
 *     def __dealloc__(self):
*/

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("lxml.etree._Element.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
}

/* "lxml/etree.pyx":853
 *     # MANIPULATORS
 * 
 *     def __setitem__(self, x, value):             # <<<<<<<<<<<<<<
 *         """__setitem__(self, x, value)
 * 
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_8_Element_5__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_value); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_4__setitem__, "__setitem__(self, x, value)\n\n        Replaces the given subelement index or slice.\n        ");
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_8_Element_4__setitem__;
#endif
static int __pyx_pw_4lxml_5etree_8_Element_5__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_value) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_4__setitem__(((struct LxmlElement *)__pyx_v_self), ((PyObject *)__pyx_v_x), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_8_Element_4__setitem__(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_value) {
  xmlNode *__pyx_v_c_node;
  xmlNode *__pyx_v_c_next;
  xmlDoc *__pyx_v_c_source_doc;
  struct LxmlElement *__pyx_v_element = 0;
  int __pyx_v_left_to_right;
  Py_ssize_t __pyx_v_slicelength;
  Py_ssize_t __pyx_v_step;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  xmlDoc *__pyx_t_5;
  xmlNode *__pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setitem__", 0);

  /* "lxml/etree.pyx":858
 *         Replaces the given subelement index or slice.
 *         """
 *         cdef xmlNode* c_node = NULL             # <<<<<<<<<<<<<<
 *         cdef xmlNode* c_next
 *         cdef xmlDoc* c_source_doc
*/
  __pyx_v_c_node = NULL;

  /* "lxml/etree.pyx":863
 *         cdef _Element element
 *         cdef bint left_to_right
 *         cdef Py_ssize_t slicelength = 0, step = 0             # <<<<<<<<<<<<<<
 *         _assertValidNode(self)
 *         if value is None:
*/
  __pyx_v_slicelength = 0;
  __pyx_v_step = 0;

  /* "lxml/etree.pyx":864
 *         cdef bint left_to_right
 *         cdef Py_ssize_t slicelength = 0, step = 0
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         if value is None:
 *             raise ValueError, "cannot assign None"
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 864, __pyx_L1_error)

  /* "lxml/etree.pyx":865
 *         cdef Py_ssize_t slicelength = 0, step = 0
 *         _assertValidNode(self)
 *         if value is None:             # <<<<<<<<<<<<<<
 *             raise ValueError, "cannot assign None"
 *         if isinstance(x, slice):
*/
  __pyx_t_2 = (__pyx_v_value == Py_None);
  if (unlikely(__pyx_t_2)) {

    /* "lxml/etree.pyx":866
 *         _assertValidNode(self)
 *         if value is None:
 *             raise ValueError, "cannot assign None"             # <<<<<<<<<<<<<<
 *         if isinstance(x, slice):
 *             # slice assignment
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_cannot_assign_None, 0, 0);
    __PYX_ERR(0, 866, __pyx_L1_error)

    /* "lxml/etree.pyx":865
 *         cdef Py_ssize_t slicelength = 0, step = 0
 *         _assertValidNode(self)
 *         if value is None:             # <<<<<<<<<<<<<<
 *             raise ValueError, "cannot assign None"
 *         if isinstance(x, slice):
*/
  }

  /* "lxml/etree.pyx":867
 *         if value is None:
 *             raise ValueError, "cannot assign None"
 *         if isinstance(x, slice):             # <<<<<<<<<<<<<<
 *             # slice assignment
 *             _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)
*/
  __pyx_t_2 = PySlice_Check(__pyx_v_x); 
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":869
 *         if isinstance(x, slice):
 *             # slice assignment
 *             _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)             # <<<<<<<<<<<<<<
 *             if step > 0:
 *                 left_to_right = 1
*/
    __pyx_t_1 = __pyx_f_4lxml_5etree__findChildSlice(((PyObject*)__pyx_v_x), __pyx_v_self->_c_node, (&__pyx_v_c_node), (&__pyx_v_step), (&__pyx_v_slicelength)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 869, __pyx_L1_error)

    /* "lxml/etree.pyx":870
 *             # slice assignment
 *             _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)
 *             if step > 0:             # <<<<<<<<<<<<<<
 *                 left_to_right = 1
 *             else:
*/
    __pyx_t_2 = (__pyx_v_step > 0);
    if (__pyx_t_2) {

      /* "lxml/etree.pyx":871
 *             _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)
 *             if step > 0:
 *                 left_to_right = 1             # <<<<<<<<<<<<<<
 *             else:
 *                 left_to_right = 0
*/
      __pyx_v_left_to_right = 1;

      /* "lxml/etree.pyx":870
 *             # slice assignment
 *             _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)
 *             if step > 0:             # <<<<<<<<<<<<<<
 *                 left_to_right = 1
 *             else:
*/
      goto __pyx_L5;
    }

    /* "lxml/etree.pyx":873
 *                 left_to_right = 1
 *             else:
 *                 left_to_right = 0             # <<<<<<<<<<<<<<
 *                 step = -step if step != python.PY_SSIZE_T_MIN else python.PY_SSIZE_T_MAX
 *             _replaceSlice(self, c_node, slicelength, step, left_to_right, value)
*/
    /*else*/ {
      __pyx_v_left_to_right = 0;

      /* "lxml/etree.pyx":874
 *             else:
 *                 left_to_right = 0
 *                 step = -step if step != python.PY_SSIZE_T_MIN else python.PY_SSIZE_T_MAX             # <<<<<<<<<<<<<<
 *             _replaceSlice(self, c_node, slicelength, step, left_to_right, value)
 *             return
*/
      __pyx_t_2 = (__pyx_v_step != PY_SSIZE_T_MIN);
      if (__pyx_t_2) {
        __pyx_t_3 = (-__pyx_v_step);
      } else {
        __pyx_t_3 = PY_SSIZE_T_MAX;
      }
      __pyx_v_step = __pyx_t_3;
    }
    __pyx_L5:;

    /* "lxml/etree.pyx":875
 *                 left_to_right = 0
 *                 step = -step if step != python.PY_SSIZE_T_MIN else python.PY_SSIZE_T_MAX
 *             _replaceSlice(self, c_node, slicelength, step, left_to_right, value)             # <<<<<<<<<<<<<<
 *             return
 *         else:
*/
    __pyx_t_1 = __pyx_f_4lxml_5etree__replaceSlice(__pyx_v_self, __pyx_v_c_node, __pyx_v_slicelength, __pyx_v_step, __pyx_v_left_to_right, __pyx_v_value); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 875, __pyx_L1_error)

    /* "lxml/etree.pyx":876
 *                 step = -step if step != python.PY_SSIZE_T_MIN else python.PY_SSIZE_T_MAX
 *             _replaceSlice(self, c_node, slicelength, step, left_to_right, value)
 *             return             # <<<<<<<<<<<<<<
 *         else:
 *             # otherwise: normal item assignment
*/
    __pyx_r = 0;
    goto __pyx_L0;

    /* "lxml/etree.pyx":867
 *         if value is None:
 *             raise ValueError, "cannot assign None"
 *         if isinstance(x, slice):             # <<<<<<<<<<<<<<
 *             # slice assignment
 *             _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)
*/
  }

  /* "lxml/etree.pyx":879
 *         else:
 *             # otherwise: normal item assignment
 *             element = value             # <<<<<<<<<<<<<<
 *             _assertValidNode(element)
 *             c_node = _findChild(self._c_node, x)
*/
  /*else*/ {
    __pyx_t_4 = __pyx_v_value;
    __Pyx_INCREF(__pyx_t_4);
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element))))) __PYX_ERR(0, 879, __pyx_L1_error)
    __pyx_v_element = ((struct LxmlElement *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "lxml/etree.pyx":880
 *             # otherwise: normal item assignment
 *             element = value
 *             _assertValidNode(element)             # <<<<<<<<<<<<<<
 *             c_node = _findChild(self._c_node, x)
 *             if c_node is NULL:
*/
    __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_element); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 880, __pyx_L1_error)

    /* "lxml/etree.pyx":881
 *             element = value
 *             _assertValidNode(element)
 *             c_node = _findChild(self._c_node, x)             # <<<<<<<<<<<<<<
 *             if c_node is NULL:
 *                 raise IndexError, "list index out of range"
*/
    __pyx_t_3 = __Pyx_PyIndex_AsSsize_t(__pyx_v_x); if (unlikely((__pyx_t_3 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 881, __pyx_L1_error)
    __pyx_v_c_node = __pyx_f_4lxml_5etree__findChild(__pyx_v_self->_c_node, __pyx_t_3);

    /* "lxml/etree.pyx":882
 *             _assertValidNode(element)
 *             c_node = _findChild(self._c_node, x)
 *             if c_node is NULL:             # <<<<<<<<<<<<<<
 *                 raise IndexError, "list index out of range"
 *             c_source_doc = element._c_node.doc
*/
    __pyx_t_2 = (__pyx_v_c_node == NULL);
    if (unlikely(__pyx_t_2)) {

      /* "lxml/etree.pyx":883
 *             c_node = _findChild(self._c_node, x)
 *             if c_node is NULL:
 *                 raise IndexError, "list index out of range"             # <<<<<<<<<<<<<<
 *             c_source_doc = element._c_node.doc
 *             c_next = element._c_node.next
*/
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_IndexError))), __pyx_mstate_global->__pyx_kp_u_list_index_out_of_range, 0, 0);
      __PYX_ERR(0, 883, __pyx_L1_error)

      /* "lxml/etree.pyx":882
 *             _assertValidNode(element)
 *             c_node = _findChild(self._c_node, x)
 *             if c_node is NULL:             # <<<<<<<<<<<<<<
 *                 raise IndexError, "list index out of range"
 *             c_source_doc = element._c_node.doc
*/
    }

    /* "lxml/etree.pyx":884
 *             if c_node is NULL:
 *                 raise IndexError, "list index out of range"
 *             c_source_doc = element._c_node.doc             # <<<<<<<<<<<<<<
 *             c_next = element._c_node.next
 *             _removeText(c_node.next)
*/
    __pyx_t_5 = __pyx_v_element->_c_node->doc;
    __pyx_v_c_source_doc = __pyx_t_5;

    /* "lxml/etree.pyx":885
 *                 raise IndexError, "list index out of range"
 *             c_source_doc = element._c_node.doc
 *             c_next = element._c_node.next             # <<<<<<<<<<<<<<
 *             _removeText(c_node.next)
 *             tree.xmlReplaceNode(c_node, element._c_node)
*/
    __pyx_t_6 = __pyx_v_element->_c_node->next;
    __pyx_v_c_next = __pyx_t_6;

    /* "lxml/etree.pyx":886
 *             c_source_doc = element._c_node.doc
 *             c_next = element._c_node.next
 *             _removeText(c_node.next)             # <<<<<<<<<<<<<<
 *             tree.xmlReplaceNode(c_node, element._c_node)
 *             _moveTail(c_next, element._c_node)
*/
    __pyx_f_4lxml_5etree__removeText(__pyx_v_c_node->next);

    /* "lxml/etree.pyx":887
 *             c_next = element._c_node.next
 *             _removeText(c_node.next)
 *             tree.xmlReplaceNode(c_node, element._c_node)             # <<<<<<<<<<<<<<
 *             _moveTail(c_next, element._c_node)
 *             moveNodeToDocument(self._doc, c_source_doc, element._c_node)
*/
    (void)(xmlReplaceNode(__pyx_v_c_node, __pyx_v_element->_c_node));

    /* "lxml/etree.pyx":888
 *             _removeText(c_node.next)
 *             tree.xmlReplaceNode(c_node, element._c_node)
 *             _moveTail(c_next, element._c_node)             # <<<<<<<<<<<<<<
 *             moveNodeToDocument(self._doc, c_source_doc, element._c_node)
 *             if not attemptDeallocation(c_node):
*/
    __pyx_f_4lxml_5etree__moveTail(__pyx_v_c_next, __pyx_v_element->_c_node);

    /* "lxml/etree.pyx":889
 *             tree.xmlReplaceNode(c_node, element._c_node)
 *             _moveTail(c_next, element._c_node)
 *             moveNodeToDocument(self._doc, c_source_doc, element._c_node)             # <<<<<<<<<<<<<<
 *             if not attemptDeallocation(c_node):
 *                 moveNodeToDocument(self._doc, c_node.doc, c_node)
*/
    __pyx_t_4 = ((PyObject *)__pyx_v_self->_doc);
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_1 = __pyx_f_4lxml_5etree_moveNodeToDocument(((struct LxmlDocument *)__pyx_t_4), __pyx_v_c_source_doc, __pyx_v_element->_c_node); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 889, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "lxml/etree.pyx":890
 *             _moveTail(c_next, element._c_node)
 *             moveNodeToDocument(self._doc, c_source_doc, element._c_node)
 *             if not attemptDeallocation(c_node):             # <<<<<<<<<<<<<<
 *                 moveNodeToDocument(self._doc, c_node.doc, c_node)
 * 
*/
    __pyx_t_2 = (!(__pyx_f_4lxml_5etree_attemptDeallocation(__pyx_v_c_node) != 0));
    if (__pyx_t_2) {

      /* "lxml/etree.pyx":891
 *             moveNodeToDocument(self._doc, c_source_doc, element._c_node)
 *             if not attemptDeallocation(c_node):
 *                 moveNodeToDocument(self._doc, c_node.doc, c_node)             # <<<<<<<<<<<<<<
 * 
 *     def __delitem__(self, x):
*/
      __pyx_t_4 = ((PyObject *)__pyx_v_self->_doc);
      __Pyx_INCREF(__pyx_t_4);
      __pyx_t_1 = __pyx_f_4lxml_5etree_moveNodeToDocument(((struct LxmlDocument *)__pyx_t_4), __pyx_v_c_node->doc, __pyx_v_c_node); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 891, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "lxml/etree.pyx":890
 *             _moveTail(c_next, element._c_node)
 *             moveNodeToDocument(self._doc, c_source_doc, element._c_node)
 *             if not attemptDeallocation(c_node):             # <<<<<<<<<<<<<<
 *                 moveNodeToDocument(self._doc, c_node.doc, c_node)
 * 
*/
    }
  }

  /* "lxml/etree.pyx":853
 *     # MANIPULATORS
 * 
 *     def __setitem__(self, x, value):             # <<<<<<<<<<<<<<
 *         """__setitem__(self, x, value)
 * 
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._Element.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_element);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":893
 *                 moveNodeToDocument(self._doc, c_node.doc, c_node)
 * 
 *     def __delitem__(self, x):             # <<<<<<<<<<<<<<
 *         """__delitem__(self, x)
 * 
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_8_Element_7__delitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_6__delitem__, "__delitem__(self, x)\n\n        Deletes the given subelement or a slice.\n        ");
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_8_Element_6__delitem__;
#endif
static int __pyx_pw_4lxml_5etree_8_Element_7__delitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__delitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_6__delitem__(((struct LxmlElement *)__pyx_v_self), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_8_Element_6__delitem__(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_x) {
  xmlNode *__pyx_v_c_node;
  xmlNode *__pyx_v_c_next;
  Py_ssize_t __pyx_v_step;
  Py_ssize_t __pyx_v_slicelength;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  xmlNode *__pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__delitem__", 0);

  /* "lxml/etree.pyx":898
 *         Deletes the given subelement or a slice.
 *         """
 *         cdef xmlNode* c_node = NULL             # <<<<<<<<<<<<<<
 *         cdef xmlNode* c_next
 *         cdef Py_ssize_t step = 0, slicelength = 0
*/
  __pyx_v_c_node = NULL;

  /* "lxml/etree.pyx":900
 *         cdef xmlNode* c_node = NULL
 *         cdef xmlNode* c_next
 *         cdef Py_ssize_t step = 0, slicelength = 0             # <<<<<<<<<<<<<<
 *         _assertValidNode(self)
 *         if isinstance(x, slice):
*/
  __pyx_v_step = 0;
  __pyx_v_slicelength = 0;

  /* "lxml/etree.pyx":901
 *         cdef xmlNode* c_next
 *         cdef Py_ssize_t step = 0, slicelength = 0
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         if isinstance(x, slice):
 *             # slice deletion
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 901, __pyx_L1_error)

  /* "lxml/etree.pyx":902
 *         cdef Py_ssize_t step = 0, slicelength = 0
 *         _assertValidNode(self)
 *         if isinstance(x, slice):             # <<<<<<<<<<<<<<
 *             # slice deletion
 *             if _isFullSlice(<slice>x):
*/
  __pyx_t_2 = PySlice_Check(__pyx_v_x); 
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":904
 *         if isinstance(x, slice):
 *             # slice deletion
 *             if _isFullSlice(<slice>x):             # <<<<<<<<<<<<<<
 *                 c_node = self._c_node.children
 *                 if c_node is not NULL:
*/
    __pyx_t_2 = __pyx_f_4lxml_5etree__isFullSlice(((PyObject*)__pyx_v_x)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 904, __pyx_L1_error)
    if (__pyx_t_2) {

      /* "lxml/etree.pyx":905
 *             # slice deletion
 *             if _isFullSlice(<slice>x):
 *                 c_node = self._c_node.children             # <<<<<<<<<<<<<<
 *                 if c_node is not NULL:
 *                     if not _isElement(c_node):
*/
      __pyx_t_3 = __pyx_v_self->_c_node->children;
      __pyx_v_c_node = __pyx_t_3;

      /* "lxml/etree.pyx":906
 *             if _isFullSlice(<slice>x):
 *                 c_node = self._c_node.children
 *                 if c_node is not NULL:             # <<<<<<<<<<<<<<
 *                     if not _isElement(c_node):
 *                         c_node = _nextElement(c_node)
*/
      __pyx_t_2 = (__pyx_v_c_node != NULL);
      if (__pyx_t_2) {

        /* "lxml/etree.pyx":907
 *                 c_node = self._c_node.children
 *                 if c_node is not NULL:
 *                     if not _isElement(c_node):             # <<<<<<<<<<<<<<
 *                         c_node = _nextElement(c_node)
 *                     while c_node is not NULL:
*/
        __pyx_t_2 = (!_isElement(__pyx_v_c_node));
        if (__pyx_t_2) {

          /* "lxml/etree.pyx":908
 *                 if c_node is not NULL:
 *                     if not _isElement(c_node):
 *                         c_node = _nextElement(c_node)             # <<<<<<<<<<<<<<
 *                     while c_node is not NULL:
 *                         c_next = _nextElement(c_node)
*/
          __pyx_v_c_node = __pyx_f_4lxml_5etree__nextElement(__pyx_v_c_node);

          /* "lxml/etree.pyx":907
 *                 c_node = self._c_node.children
 *                 if c_node is not NULL:
 *                     if not _isElement(c_node):             # <<<<<<<<<<<<<<
 *                         c_node = _nextElement(c_node)
 *                     while c_node is not NULL:
*/
        }

        /* "lxml/etree.pyx":909
 *                     if not _isElement(c_node):
 *                         c_node = _nextElement(c_node)
 *                     while c_node is not NULL:             # <<<<<<<<<<<<<<
 *                         c_next = _nextElement(c_node)
 *                         _removeNode(self._doc, c_node)
*/
        while (1) {
          __pyx_t_2 = (__pyx_v_c_node != NULL);
          if (!__pyx_t_2) break;

          /* "lxml/etree.pyx":910
 *                         c_node = _nextElement(c_node)
 *                     while c_node is not NULL:
 *                         c_next = _nextElement(c_node)             # <<<<<<<<<<<<<<
 *                         _removeNode(self._doc, c_node)
 *                         c_node = c_next
*/
          __pyx_v_c_next = __pyx_f_4lxml_5etree__nextElement(__pyx_v_c_node);

          /* "lxml/etree.pyx":911
 *                     while c_node is not NULL:
 *                         c_next = _nextElement(c_node)
 *                         _removeNode(self._doc, c_node)             # <<<<<<<<<<<<<<
 *                         c_node = c_next
 *             else:
*/
          __pyx_t_4 = ((PyObject *)__pyx_v_self->_doc);
          __Pyx_INCREF(__pyx_t_4);
          __pyx_t_1 = __pyx_f_4lxml_5etree__removeNode(((struct LxmlDocument *)__pyx_t_4), __pyx_v_c_node); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 911, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

          /* "lxml/etree.pyx":912
 *                         c_next = _nextElement(c_node)
 *                         _removeNode(self._doc, c_node)
 *                         c_node = c_next             # <<<<<<<<<<<<<<
 *             else:
 *                 _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)
*/
          __pyx_v_c_node = __pyx_v_c_next;
        }

        /* "lxml/etree.pyx":906
 *             if _isFullSlice(<slice>x):
 *                 c_node = self._c_node.children
 *                 if c_node is not NULL:             # <<<<<<<<<<<<<<
 *                     if not _isElement(c_node):
 *                         c_node = _nextElement(c_node)
*/
      }

      /* "lxml/etree.pyx":904
 *         if isinstance(x, slice):
 *             # slice deletion
 *             if _isFullSlice(<slice>x):             # <<<<<<<<<<<<<<
 *                 c_node = self._c_node.children
 *                 if c_node is not NULL:
*/
      goto __pyx_L4;
    }

    /* "lxml/etree.pyx":914
 *                         c_node = c_next
 *             else:
 *                 _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)             # <<<<<<<<<<<<<<
 *                 _deleteSlice(self._doc, c_node, slicelength, step)
 *         else:
*/
    /*else*/ {
      __pyx_t_1 = __pyx_f_4lxml_5etree__findChildSlice(((PyObject*)__pyx_v_x), __pyx_v_self->_c_node, (&__pyx_v_c_node), (&__pyx_v_step), (&__pyx_v_slicelength)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 914, __pyx_L1_error)

      /* "lxml/etree.pyx":915
 *             else:
 *                 _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)
 *                 _deleteSlice(self._doc, c_node, slicelength, step)             # <<<<<<<<<<<<<<
 *         else:
 *             # item deletion
*/
      __pyx_t_4 = ((PyObject *)__pyx_v_self->_doc);
      __Pyx_INCREF(__pyx_t_4);
      __pyx_t_1 = __pyx_f_4lxml_5etree__deleteSlice(((struct LxmlDocument *)__pyx_t_4), __pyx_v_c_node, __pyx_v_slicelength, __pyx_v_step); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 915, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __pyx_L4:;

    /* "lxml/etree.pyx":902
 *         cdef Py_ssize_t step = 0, slicelength = 0
 *         _assertValidNode(self)
 *         if isinstance(x, slice):             # <<<<<<<<<<<<<<
 *             # slice deletion
 *             if _isFullSlice(<slice>x):
*/
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":918
 *         else:
 *             # item deletion
 *             c_node = _findChild(self._c_node, x)             # <<<<<<<<<<<<<<
 *             if c_node is NULL:
 *                 raise IndexError, f"index out of range: {x}"
*/
  /*else*/ {
    __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_v_x); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 918, __pyx_L1_error)
    __pyx_v_c_node = __pyx_f_4lxml_5etree__findChild(__pyx_v_self->_c_node, __pyx_t_5);

    /* "lxml/etree.pyx":919
 *             # item deletion
 *             c_node = _findChild(self._c_node, x)
 *             if c_node is NULL:             # <<<<<<<<<<<<<<
 *                 raise IndexError, f"index out of range: {x}"
 *             _removeNode(self._doc, c_node)
*/
    __pyx_t_2 = (__pyx_v_c_node == NULL);
    if (unlikely(__pyx_t_2)) {

      /* "lxml/etree.pyx":920
 *             c_node = _findChild(self._c_node, x)
 *             if c_node is NULL:
 *                 raise IndexError, f"index out of range: {x}"             # <<<<<<<<<<<<<<
 *             _removeNode(self._doc, c_node)
 * 
*/
      __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_x, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 920, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_index_out_of_range, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 920, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_IndexError))), __pyx_t_6, 0, 0);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __PYX_ERR(0, 920, __pyx_L1_error)

      /* "lxml/etree.pyx":919
 *             # item deletion
 *             c_node = _findChild(self._c_node, x)
 *             if c_node is NULL:             # <<<<<<<<<<<<<<
 *                 raise IndexError, f"index out of range: {x}"
 *             _removeNode(self._doc, c_node)
*/
    }

    /* "lxml/etree.pyx":921
 *             if c_node is NULL:
 *                 raise IndexError, f"index out of range: {x}"
 *             _removeNode(self._doc, c_node)             # <<<<<<<<<<<<<<
 * 
 *     def __deepcopy__(self, memo):
*/
    __pyx_t_6 = ((PyObject *)__pyx_v_self->_doc);
    __Pyx_INCREF(__pyx_t_6);
    __pyx_t_1 = __pyx_f_4lxml_5etree__removeNode(((struct LxmlDocument *)__pyx_t_6), __pyx_v_c_node); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 921, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __pyx_L3:;

  /* "lxml/etree.pyx":893
 *                 moveNodeToDocument(self._doc, c_node.doc, c_node)
 * 
 *     def __delitem__(self, x):             # <<<<<<<<<<<<<<
 *         """__delitem__(self, x)
 * 
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._Element.__delitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":923
 *             _removeNode(self._doc, c_node)
 * 
 *     def __deepcopy__(self, memo):             # <<<<<<<<<<<<<<
 *         "__deepcopy__(self, memo)"
 *         return self.__copy__()
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_9__deepcopy__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_8__deepcopy__, "__deepcopy__(self, memo)");
static PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_9__deepcopy__ = {"__deepcopy__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_9__deepcopy__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_8__deepcopy__};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_9__deepcopy__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_memo = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__deepcopy__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_memo,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 923, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 923, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__deepcopy__", 0) < (0)) __PYX_ERR(0, 923, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__deepcopy__", 1, 1, 1, i); __PYX_ERR(0, 923, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 923, __pyx_L3_error)
    }
    __pyx_v_memo = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__deepcopy__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 923, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._Element.__deepcopy__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_8__deepcopy__(((struct LxmlElement *)__pyx_v_self), __pyx_v_memo);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8_Element_8__deepcopy__(struct LxmlElement *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_memo) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__deepcopy__", 0);

  /* "lxml/etree.pyx":925
 *     def __deepcopy__(self, memo):
 *         "__deepcopy__(self, memo)"
 *         return self.__copy__()             # <<<<<<<<<<<<<<
 * 
 *     def __copy__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_copy_2, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 925, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":923
 *             _removeNode(self._doc, c_node)
 * 
 *     def __deepcopy__(self, memo):             # <<<<<<<<<<<<<<
 *         "__deepcopy__(self, memo)"
 *         return self.__copy__()
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Element.__deepcopy__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":927
 *         return self.__copy__()
 * 
 *     def __copy__(self):             # <<<<<<<<<<<<<<
 *         "__copy__(self)"
 *         cdef xmlDoc* c_doc
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_11__copy__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_10__copy__, "__copy__(self)");
static PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_11__copy__ = {"__copy__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_11__copy__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_10__copy__};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_11__copy__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__copy__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__copy__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__copy__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_10__copy__(((struct LxmlElement *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8_Element_10__copy__(struct LxmlElement *__pyx_v_self) {
  xmlDoc *__pyx_v_c_doc;
  xmlNode *__pyx_v_c_node;
  struct LxmlDocument *__pyx_v_new_doc = 0;
  PyObject *__pyx_v_root = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  xmlDoc *__pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  xmlNode *__pyx_t_6;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__copy__", 0);

  /* "lxml/etree.pyx":932
 *         cdef xmlNode* c_node
 *         cdef _Document new_doc
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         c_doc = _copyDocRoot(self._doc._c_doc, self._c_node) # recursive
 *         new_doc = _documentFactory(c_doc, self._doc._parser)
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 932, __pyx_L1_error)

  /* "lxml/etree.pyx":933
 *         cdef _Document new_doc
 *         _assertValidNode(self)
 *         c_doc = _copyDocRoot(self._doc._c_doc, self._c_node) # recursive             # <<<<<<<<<<<<<<
 *         new_doc = _documentFactory(c_doc, self._doc._parser)
 *         root = new_doc.getroot()
*/
  __pyx_t_2 = __pyx_f_4lxml_5etree__copyDocRoot(__pyx_v_self->_doc->_c_doc, __pyx_v_self->_c_node); if (unlikely(__pyx_t_2 == ((void *)NULL))) __PYX_ERR(0, 933, __pyx_L1_error)
  __pyx_v_c_doc = __pyx_t_2;

  /* "lxml/etree.pyx":934
 *         _assertValidNode(self)
 *         c_doc = _copyDocRoot(self._doc._c_doc, self._c_node) # recursive
 *         new_doc = _documentFactory(c_doc, self._doc._parser)             # <<<<<<<<<<<<<<
 *         root = new_doc.getroot()
 *         if root is not None:
*/
  __pyx_t_3 = ((PyObject *)__pyx_v_self->_doc->_parser);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_3))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 934, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_new_doc = ((struct LxmlDocument *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "lxml/etree.pyx":935
 *         c_doc = _copyDocRoot(self._doc._c_doc, self._c_node) # recursive
 *         new_doc = _documentFactory(c_doc, self._doc._parser)
 *         root = new_doc.getroot()             # <<<<<<<<<<<<<<
 *         if root is not None:
 *             return root
*/
  __pyx_t_4 = __pyx_f_4lxml_5etree_9_Document_getroot(__pyx_v_new_doc); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 935, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_root = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "lxml/etree.pyx":936
 *         new_doc = _documentFactory(c_doc, self._doc._parser)
 *         root = new_doc.getroot()
 *         if root is not None:             # <<<<<<<<<<<<<<
 *             return root
 *         # Comment/PI
*/
  __pyx_t_5 = (__pyx_v_root != Py_None);
  if (__pyx_t_5) {

    /* "lxml/etree.pyx":937
 *         root = new_doc.getroot()
 *         if root is not None:
 *             return root             # <<<<<<<<<<<<<<
 *         # Comment/PI
 *         c_node = c_doc.children
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_root);
    __pyx_r = __pyx_v_root;
    goto __pyx_L0;

    /* "lxml/etree.pyx":936
 *         new_doc = _documentFactory(c_doc, self._doc._parser)
 *         root = new_doc.getroot()
 *         if root is not None:             # <<<<<<<<<<<<<<
 *             return root
 *         # Comment/PI
*/
  }

  /* "lxml/etree.pyx":939
 *             return root
 *         # Comment/PI
 *         c_node = c_doc.children             # <<<<<<<<<<<<<<
 *         while c_node is not NULL and c_node.type != self._c_node.type:
 *             c_node = c_node.next
*/
  __pyx_t_6 = __pyx_v_c_doc->children;
  __pyx_v_c_node = __pyx_t_6;

  /* "lxml/etree.pyx":940
 *         # Comment/PI
 *         c_node = c_doc.children
 *         while c_node is not NULL and c_node.type != self._c_node.type:             # <<<<<<<<<<<<<<
 *             c_node = c_node.next
 *         if c_node is NULL:
*/
  while (1) {
    __pyx_t_7 = (__pyx_v_c_node != NULL);
    if (__pyx_t_7) {
    } else {
      __pyx_t_5 = __pyx_t_7;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_7 = (__pyx_v_c_node->type != __pyx_v_self->_c_node->type);
    __pyx_t_5 = __pyx_t_7;
    __pyx_L6_bool_binop_done:;
    if (!__pyx_t_5) break;

    /* "lxml/etree.pyx":941
 *         c_node = c_doc.children
 *         while c_node is not NULL and c_node.type != self._c_node.type:
 *             c_node = c_node.next             # <<<<<<<<<<<<<<
 *         if c_node is NULL:
 *             return None
*/
    __pyx_t_6 = __pyx_v_c_node->next;
    __pyx_v_c_node = __pyx_t_6;
  }

  /* "lxml/etree.pyx":942
 *         while c_node is not NULL and c_node.type != self._c_node.type:
 *             c_node = c_node.next
 *         if c_node is NULL:             # <<<<<<<<<<<<<<
 *             return None
 *         return _elementFactory(new_doc, c_node)
*/
  __pyx_t_5 = (__pyx_v_c_node == NULL);
  if (__pyx_t_5) {

    /* "lxml/etree.pyx":943
 *             c_node = c_node.next
 *         if c_node is NULL:
 *             return None             # <<<<<<<<<<<<<<
 *         return _elementFactory(new_doc, c_node)
 * 
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "lxml/etree.pyx":942
 *         while c_node is not NULL and c_node.type != self._c_node.type:
 *             c_node = c_node.next
 *         if c_node is NULL:             # <<<<<<<<<<<<<<
 *             return None
 *         return _elementFactory(new_doc, c_node)
*/
  }

  /* "lxml/etree.pyx":944
 *         if c_node is NULL:
 *             return None
 *         return _elementFactory(new_doc, c_node)             # <<<<<<<<<<<<<<
 * 
 *     def set(self, key, value):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(__pyx_v_new_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 944, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":927
 *         return self.__copy__()
 * 
 *     def __copy__(self):             # <<<<<<<<<<<<<<
 *         "__copy__(self)"
 *         cdef xmlDoc* c_doc
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._Element.__copy__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_new_doc);
  __Pyx_XDECREF(__pyx_v_root);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":946
 *         return _elementFactory(new_doc, c_node)
 * 
 *     def set(self, key, value):             # <<<<<<<<<<<<<<
 *         """set(self, key, value)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_13set(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_12set, "set(self, key, value)\n\n        Sets an element attribute.\n        In HTML documents (not XML or XHTML), the value None is allowed and creates\n        an attribute without value (just the attribute name).\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_13set = {"set", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_13set, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_12set};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_13set(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_value = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_key,&__pyx_mstate_global->__pyx_n_u_value,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 946, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 946, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 946, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "set", 0) < (0)) __PYX_ERR(0, 946, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("set", 1, 2, 2, i); __PYX_ERR(0, 946, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 946, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 946, __pyx_L3_error)
    }
    __pyx_v_key = values[0];
    __pyx_v_value = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 946, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._Element.set", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_12set(((struct LxmlElement *)__pyx_v_self), __pyx_v_key, __pyx_v_value);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8_Element_12set(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set", 0);

  /* "lxml/etree.pyx":953
 *         an attribute without value (just the attribute name).
 *         """
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         _setAttributeValue(self, key, value)
 * 
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 953, __pyx_L1_error)

  /* "lxml/etree.pyx":954
 *         """
 *         _assertValidNode(self)
 *         _setAttributeValue(self, key, value)             # <<<<<<<<<<<<<<
 * 
 *     def append(self, _Element element not None):
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__setAttributeValue(__pyx_v_self, __pyx_v_key, __pyx_v_value); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 954, __pyx_L1_error)

  /* "lxml/etree.pyx":946
 *         return _elementFactory(new_doc, c_node)
 * 
 *     def set(self, key, value):             # <<<<<<<<<<<<<<
 *         """set(self, key, value)
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._Element.set", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":956
 *         _setAttributeValue(self, key, value)
 * 
 *     def append(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         """append(self, element)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_15append(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_14append, "append(self, element)\n\n        Adds a subelement to the end of this element.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_15append = {"append", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_15append, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_14append};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_15append(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct LxmlElement *__pyx_v_element = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("append (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_element,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 956, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 956, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "append", 0) < (0)) __PYX_ERR(0, 956, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("append", 1, 1, 1, i); __PYX_ERR(0, 956, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 956, __pyx_L3_error)
    }
    __pyx_v_element = ((struct LxmlElement *)values[0]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("append", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 956, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._Element.append", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_element), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element, 0, "element", 0))) __PYX_ERR(0, 956, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_14append(((struct LxmlElement *)__pyx_v_self), __pyx_v_element);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8_Element_14append(struct LxmlElement *__pyx_v_self, struct LxmlElement *__pyx_v_element) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("append", 0);

  /* "lxml/etree.pyx":961
 *         Adds a subelement to the end of this element.
 *         """
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         _assertValidNode(element)
 *         _appendChild(self, element)
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 961, __pyx_L1_error)

  /* "lxml/etree.pyx":962
 *         """
 *         _assertValidNode(self)
 *         _assertValidNode(element)             # <<<<<<<<<<<<<<
 *         _appendChild(self, element)
 * 
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_element); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 962, __pyx_L1_error)

  /* "lxml/etree.pyx":963
 *         _assertValidNode(self)
 *         _assertValidNode(element)
 *         _appendChild(self, element)             # <<<<<<<<<<<<<<
 * 
 *     def addnext(self, _Element element not None):
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__appendChild(__pyx_v_self, __pyx_v_element); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 963, __pyx_L1_error)

  /* "lxml/etree.pyx":956
 *         _setAttributeValue(self, key, value)
 * 
 *     def append(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         """append(self, element)
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._Element.append", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":965
 *         _appendChild(self, element)
 * 
 *     def addnext(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         """addnext(self, element)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_17addnext(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_16addnext, "addnext(self, element)\n\n        Adds the element as a following sibling directly after this\n        element.\n\n        This is normally used to set a processing instruction or comment after\n        the root node of a document.  Note that tail text is automatically\n        discarded when adding at the root level.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_17addnext = {"addnext", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_17addnext, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_16addnext};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_17addnext(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct LxmlElement *__pyx_v_element = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("addnext (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_element,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 965, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 965, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "addnext", 0) < (0)) __PYX_ERR(0, 965, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("addnext", 1, 1, 1, i); __PYX_ERR(0, 965, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 965, __pyx_L3_error)
    }
    __pyx_v_element = ((struct LxmlElement *)values[0]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("addnext", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 965, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._Element.addnext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_element), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element, 0, "element", 0))) __PYX_ERR(0, 965, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_16addnext(((struct LxmlElement *)__pyx_v_self), __pyx_v_element);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8_Element_16addnext(struct LxmlElement *__pyx_v_self, struct LxmlElement *__pyx_v_element) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("addnext", 0);

  /* "lxml/etree.pyx":975
 *         discarded when adding at the root level.
 *         """
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         _assertValidNode(element)
 *         if self._c_node.parent != NULL and not _isElement(self._c_node.parent):
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 975, __pyx_L1_error)

  /* "lxml/etree.pyx":976
 *         """
 *         _assertValidNode(self)
 *         _assertValidNode(element)             # <<<<<<<<<<<<<<
 *         if self._c_node.parent != NULL and not _isElement(self._c_node.parent):
 *             if element._c_node.type not in (tree.XML_PI_NODE, tree.XML_COMMENT_NODE):
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_element); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 976, __pyx_L1_error)

  /* "lxml/etree.pyx":977
 *         _assertValidNode(self)
 *         _assertValidNode(element)
 *         if self._c_node.parent != NULL and not _isElement(self._c_node.parent):             # <<<<<<<<<<<<<<
 *             if element._c_node.type not in (tree.XML_PI_NODE, tree.XML_COMMENT_NODE):
 *                 raise TypeError, "Only processing instructions and comments can be siblings of the root element"
*/
  __pyx_t_3 = (__pyx_v_self->_c_node->parent != NULL);
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (!_isElement(__pyx_v_self->_c_node->parent));
  __pyx_t_2 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":978
 *         _assertValidNode(element)
 *         if self._c_node.parent != NULL and not _isElement(self._c_node.parent):
 *             if element._c_node.type not in (tree.XML_PI_NODE, tree.XML_COMMENT_NODE):             # <<<<<<<<<<<<<<
 *                 raise TypeError, "Only processing instructions and comments can be siblings of the root element"
 *             element.tail = None
*/
    switch (__pyx_v_element->_c_node->type) {
      case XML_PI_NODE:
      case XML_COMMENT_NODE:
      __pyx_t_2 = 0;
      break;
      default:
      __pyx_t_2 = 1;
      break;
    }
    __pyx_t_3 = __pyx_t_2;
    if (unlikely(__pyx_t_3)) {

      /* "lxml/etree.pyx":979
 *         if self._c_node.parent != NULL and not _isElement(self._c_node.parent):
 *             if element._c_node.type not in (tree.XML_PI_NODE, tree.XML_COMMENT_NODE):
 *                 raise TypeError, "Only processing instructions and comments can be siblings of the root element"             # <<<<<<<<<<<<<<
 *             element.tail = None
 *         _appendSibling(self, element)
*/
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_Only_processing_instructions_and, 0, 0);
      __PYX_ERR(0, 979, __pyx_L1_error)

      /* "lxml/etree.pyx":978
 *         _assertValidNode(element)
 *         if self._c_node.parent != NULL and not _isElement(self._c_node.parent):
 *             if element._c_node.type not in (tree.XML_PI_NODE, tree.XML_COMMENT_NODE):             # <<<<<<<<<<<<<<
 *                 raise TypeError, "Only processing instructions and comments can be siblings of the root element"
 *             element.tail = None
*/
    }

    /* "lxml/etree.pyx":980
 *             if element._c_node.type not in (tree.XML_PI_NODE, tree.XML_COMMENT_NODE):
 *                 raise TypeError, "Only processing instructions and comments can be siblings of the root element"
 *             element.tail = None             # <<<<<<<<<<<<<<
 *         _appendSibling(self, element)
 * 
*/
    if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_element), __pyx_mstate_global->__pyx_n_u_tail, Py_None) < (0)) __PYX_ERR(0, 980, __pyx_L1_error)

    /* "lxml/etree.pyx":977
 *         _assertValidNode(self)
 *         _assertValidNode(element)
 *         if self._c_node.parent != NULL and not _isElement(self._c_node.parent):             # <<<<<<<<<<<<<<
 *             if element._c_node.type not in (tree.XML_PI_NODE, tree.XML_COMMENT_NODE):
 *                 raise TypeError, "Only processing instructions and comments can be siblings of the root element"
*/
  }

  /* "lxml/etree.pyx":981
 *                 raise TypeError, "Only processing instructions and comments can be siblings of the root element"
 *             element.tail = None
 *         _appendSibling(self, element)             # <<<<<<<<<<<<<<
 * 
 *     def addprevious(self, _Element element not None):
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__appendSibling(__pyx_v_self, __pyx_v_element); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 981, __pyx_L1_error)

  /* "lxml/etree.pyx":965
 *         _appendChild(self, element)
 * 
 *     def addnext(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         """addnext(self, element)
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._Element.addnext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":983
 *         _appendSibling(self, element)
 * 
 *     def addprevious(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         """addprevious(self, element)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_19addprevious(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_18addprevious, "addprevious(self, element)\n\n        Adds the element as a preceding sibling directly before this\n        element.\n\n        This is normally used to set a processing instruction or comment\n        before the root node of a document.  Note that tail text is\n        automatically discarded when adding at the root level.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_19addprevious = {"addprevious", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_19addprevious, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_18addprevious};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_19addprevious(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct LxmlElement *__pyx_v_element = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("addprevious (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_element,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 983, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 983, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "addprevious", 0) < (0)) __PYX_ERR(0, 983, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("addprevious", 1, 1, 1, i); __PYX_ERR(0, 983, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 983, __pyx_L3_error)
    }
    __pyx_v_element = ((struct LxmlElement *)values[0]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("addprevious", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 983, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._Element.addprevious", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_element), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element, 0, "element", 0))) __PYX_ERR(0, 983, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_18addprevious(((struct LxmlElement *)__pyx_v_self), __pyx_v_element);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8_Element_18addprevious(struct LxmlElement *__pyx_v_self, struct LxmlElement *__pyx_v_element) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("addprevious", 0);

  /* "lxml/etree.pyx":993
 *         automatically discarded when adding at the root level.
 *         """
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         _assertValidNode(element)
 *         if self._c_node.parent != NULL and not _isElement(self._c_node.parent):
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 993, __pyx_L1_error)

  /* "lxml/etree.pyx":994
 *         """
 *         _assertValidNode(self)
 *         _assertValidNode(element)             # <<<<<<<<<<<<<<
 *         if self._c_node.parent != NULL and not _isElement(self._c_node.parent):
 *             if element._c_node.type != tree.XML_PI_NODE:
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_element); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 994, __pyx_L1_error)

  /* "lxml/etree.pyx":995
 *         _assertValidNode(self)
 *         _assertValidNode(element)
 *         if self._c_node.parent != NULL and not _isElement(self._c_node.parent):             # <<<<<<<<<<<<<<
 *             if element._c_node.type != tree.XML_PI_NODE:
 *                 if element._c_node.type != tree.XML_COMMENT_NODE:
*/
  __pyx_t_3 = (__pyx_v_self->_c_node->parent != NULL);
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (!_isElement(__pyx_v_self->_c_node->parent));
  __pyx_t_2 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":996
 *         _assertValidNode(element)
 *         if self._c_node.parent != NULL and not _isElement(self._c_node.parent):
 *             if element._c_node.type != tree.XML_PI_NODE:             # <<<<<<<<<<<<<<
 *                 if element._c_node.type != tree.XML_COMMENT_NODE:
 *                     raise TypeError, "Only processing instructions and comments can be siblings of the root element"
*/
    __pyx_t_2 = (__pyx_v_element->_c_node->type != XML_PI_NODE);
    if (__pyx_t_2) {

      /* "lxml/etree.pyx":997
 *         if self._c_node.parent != NULL and not _isElement(self._c_node.parent):
 *             if element._c_node.type != tree.XML_PI_NODE:
 *                 if element._c_node.type != tree.XML_COMMENT_NODE:             # <<<<<<<<<<<<<<
 *                     raise TypeError, "Only processing instructions and comments can be siblings of the root element"
 *             element.tail = None
*/
      __pyx_t_2 = (__pyx_v_element->_c_node->type != XML_COMMENT_NODE);
      if (unlikely(__pyx_t_2)) {

        /* "lxml/etree.pyx":998
 *             if element._c_node.type != tree.XML_PI_NODE:
 *                 if element._c_node.type != tree.XML_COMMENT_NODE:
 *                     raise TypeError, "Only processing instructions and comments can be siblings of the root element"             # <<<<<<<<<<<<<<
 *             element.tail = None
 *         _prependSibling(self, element)
*/
        __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_Only_processing_instructions_and, 0, 0);
        __PYX_ERR(0, 998, __pyx_L1_error)

        /* "lxml/etree.pyx":997
 *         if self._c_node.parent != NULL and not _isElement(self._c_node.parent):
 *             if element._c_node.type != tree.XML_PI_NODE:
 *                 if element._c_node.type != tree.XML_COMMENT_NODE:             # <<<<<<<<<<<<<<
 *                     raise TypeError, "Only processing instructions and comments can be siblings of the root element"
 *             element.tail = None
*/
      }

      /* "lxml/etree.pyx":996
 *         _assertValidNode(element)
 *         if self._c_node.parent != NULL and not _isElement(self._c_node.parent):
 *             if element._c_node.type != tree.XML_PI_NODE:             # <<<<<<<<<<<<<<
 *                 if element._c_node.type != tree.XML_COMMENT_NODE:
 *                     raise TypeError, "Only processing instructions and comments can be siblings of the root element"
*/
    }

    /* "lxml/etree.pyx":999
 *                 if element._c_node.type != tree.XML_COMMENT_NODE:
 *                     raise TypeError, "Only processing instructions and comments can be siblings of the root element"
 *             element.tail = None             # <<<<<<<<<<<<<<
 *         _prependSibling(self, element)
 * 
*/
    if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_element), __pyx_mstate_global->__pyx_n_u_tail, Py_None) < (0)) __PYX_ERR(0, 999, __pyx_L1_error)

    /* "lxml/etree.pyx":995
 *         _assertValidNode(self)
 *         _assertValidNode(element)
 *         if self._c_node.parent != NULL and not _isElement(self._c_node.parent):             # <<<<<<<<<<<<<<
 *             if element._c_node.type != tree.XML_PI_NODE:
 *                 if element._c_node.type != tree.XML_COMMENT_NODE:
*/
  }

  /* "lxml/etree.pyx":1000
 *                     raise TypeError, "Only processing instructions and comments can be siblings of the root element"
 *             element.tail = None
 *         _prependSibling(self, element)             # <<<<<<<<<<<<<<
 * 
 *     def extend(self, elements):
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__prependSibling(__pyx_v_self, __pyx_v_element); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1000, __pyx_L1_error)

  /* "lxml/etree.pyx":983
 *         _appendSibling(self, element)
 * 
 *     def addprevious(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         """addprevious(self, element)
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._Element.addprevious", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1002
 *         _prependSibling(self, element)
 * 
 *     def extend(self, elements):             # <<<<<<<<<<<<<<
 *         """extend(self, elements)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_21extend(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_20extend, "extend(self, elements)\n\n        Extends the current children by the elements in the iterable.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_21extend = {"extend", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_21extend, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_20extend};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_21extend(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_elements = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("extend (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_elements,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1002, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1002, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "extend", 0) < (0)) __PYX_ERR(0, 1002, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("extend", 1, 1, 1, i); __PYX_ERR(0, 1002, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1002, __pyx_L3_error)
    }
    __pyx_v_elements = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("extend", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1002, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._Element.extend", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_20extend(((struct LxmlElement *)__pyx_v_self), __pyx_v_elements);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8_Element_20extend(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_elements) {
  struct LxmlElement *__pyx_v_element = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("extend", 0);

  /* "lxml/etree.pyx":1008
 *         """
 *         cdef _Element element
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         for element in elements:
 *             if element is None:
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1008, __pyx_L1_error)

  /* "lxml/etree.pyx":1009
 *         cdef _Element element
 *         _assertValidNode(self)
 *         for element in elements:             # <<<<<<<<<<<<<<
 *             if element is None:
 *                 raise TypeError, "Node must not be None"
*/
  if (likely(PyList_CheckExact(__pyx_v_elements)) || PyTuple_CheckExact(__pyx_v_elements)) {
    __pyx_t_2 = __pyx_v_elements; __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_elements); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1009, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1009, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1009, __pyx_L1_error)
          #endif
          if (__pyx_t_3 >= __pyx_temp) break;
        }
        __pyx_t_5 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_3, __Pyx_ReferenceSharing_OwnStrongReference);
        ++__pyx_t_3;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1009, __pyx_L1_error)
          #endif
          if (__pyx_t_3 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3));
        #else
        __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3);
        #endif
        ++__pyx_t_3;
      }
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1009, __pyx_L1_error)
    } else {
      __pyx_t_5 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_5)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 1009, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_5);
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element))))) __PYX_ERR(0, 1009, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_element, ((struct LxmlElement *)__pyx_t_5));
    __pyx_t_5 = 0;

    /* "lxml/etree.pyx":1010
 *         _assertValidNode(self)
 *         for element in elements:
 *             if element is None:             # <<<<<<<<<<<<<<
 *                 raise TypeError, "Node must not be None"
 *             _assertValidNode(element)
*/
    __pyx_t_6 = (((PyObject *)__pyx_v_element) == Py_None);
    if (unlikely(__pyx_t_6)) {

      /* "lxml/etree.pyx":1011
 *         for element in elements:
 *             if element is None:
 *                 raise TypeError, "Node must not be None"             # <<<<<<<<<<<<<<
 *             _assertValidNode(element)
 *             _appendChild(self, element)
*/
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_Node_must_not_be_None, 0, 0);
      __PYX_ERR(0, 1011, __pyx_L1_error)

      /* "lxml/etree.pyx":1010
 *         _assertValidNode(self)
 *         for element in elements:
 *             if element is None:             # <<<<<<<<<<<<<<
 *                 raise TypeError, "Node must not be None"
 *             _assertValidNode(element)
*/
    }

    /* "lxml/etree.pyx":1012
 *             if element is None:
 *                 raise TypeError, "Node must not be None"
 *             _assertValidNode(element)             # <<<<<<<<<<<<<<
 *             _appendChild(self, element)
 * 
*/
    __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_element); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1012, __pyx_L1_error)

    /* "lxml/etree.pyx":1013
 *                 raise TypeError, "Node must not be None"
 *             _assertValidNode(element)
 *             _appendChild(self, element)             # <<<<<<<<<<<<<<
 * 
 *     def clear(self, bint keep_tail=False):
*/
    __pyx_t_1 = __pyx_f_4lxml_5etree__appendChild(__pyx_v_self, __pyx_v_element); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1013, __pyx_L1_error)

    /* "lxml/etree.pyx":1009
 *         cdef _Element element
 *         _assertValidNode(self)
 *         for element in elements:             # <<<<<<<<<<<<<<
 *             if element is None:
 *                 raise TypeError, "Node must not be None"
*/
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "lxml/etree.pyx":1002
 *         _prependSibling(self, element)
 * 
 *     def extend(self, elements):             # <<<<<<<<<<<<<<
 *         """extend(self, elements)
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._Element.extend", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_element);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1015
 *             _appendChild(self, element)
 * 
 *     def clear(self, bint keep_tail=False):             # <<<<<<<<<<<<<<
 *         """clear(self, keep_tail=False)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_23clear(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_22clear, "clear(self, keep_tail=False)\n\n        Resets an element.  This function removes all subelements, clears\n        all attributes and sets the text and tail properties to None.\n\n        Pass ``keep_tail=True`` to leave the tail text untouched.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_23clear = {"clear", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_23clear, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_22clear};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_23clear(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  int __pyx_v_keep_tail;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clear (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_keep_tail,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1015, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1015, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "clear", 0) < (0)) __PYX_ERR(0, 1015, __pyx_L3_error)
    } else {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1015, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_keep_tail = __Pyx_PyObject_IsTrue(values[0]); if (unlikely((__pyx_v_keep_tail == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1015, __pyx_L3_error)
    } else {
      __pyx_v_keep_tail = ((int)0);
    }
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("clear", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 1015, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._Element.clear", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_22clear(((struct LxmlElement *)__pyx_v_self), __pyx_v_keep_tail);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8_Element_22clear(struct LxmlElement *__pyx_v_self, int __pyx_v_keep_tail) {
  xmlAttr *__pyx_v_c_attr;
  xmlNode *__pyx_v_c_node;
  xmlNode *__pyx_v_c_node_next;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  xmlNode *__pyx_t_2;
  int __pyx_t_3;
  xmlAttr *__pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("clear", 0);

  /* "lxml/etree.pyx":1027
 *         cdef xmlNode* c_node
 *         cdef xmlNode* c_node_next
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         c_node = self._c_node
 *         # remove self.text and self.tail
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1027, __pyx_L1_error)

  /* "lxml/etree.pyx":1028
 *         cdef xmlNode* c_node_next
 *         _assertValidNode(self)
 *         c_node = self._c_node             # <<<<<<<<<<<<<<
 *         # remove self.text and self.tail
 *         _removeText(c_node.children)
*/
  __pyx_t_2 = __pyx_v_self->_c_node;
  __pyx_v_c_node = __pyx_t_2;

  /* "lxml/etree.pyx":1030
 *         c_node = self._c_node
 *         # remove self.text and self.tail
 *         _removeText(c_node.children)             # <<<<<<<<<<<<<<
 *         if not keep_tail:
 *             _removeText(c_node.next)
*/
  __pyx_f_4lxml_5etree__removeText(__pyx_v_c_node->children);

  /* "lxml/etree.pyx":1031
 *         # remove self.text and self.tail
 *         _removeText(c_node.children)
 *         if not keep_tail:             # <<<<<<<<<<<<<<
 *             _removeText(c_node.next)
 *         # remove all attributes
*/
  __pyx_t_3 = (!__pyx_v_keep_tail);
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":1032
 *         _removeText(c_node.children)
 *         if not keep_tail:
 *             _removeText(c_node.next)             # <<<<<<<<<<<<<<
 *         # remove all attributes
 *         c_attr = c_node.properties
*/
    __pyx_f_4lxml_5etree__removeText(__pyx_v_c_node->next);

    /* "lxml/etree.pyx":1031
 *         # remove self.text and self.tail
 *         _removeText(c_node.children)
 *         if not keep_tail:             # <<<<<<<<<<<<<<
 *             _removeText(c_node.next)
 *         # remove all attributes
*/
  }

  /* "lxml/etree.pyx":1034
 *             _removeText(c_node.next)
 *         # remove all attributes
 *         c_attr = c_node.properties             # <<<<<<<<<<<<<<
 *         if c_attr:
 *             c_node.properties = NULL
*/
  __pyx_t_4 = __pyx_v_c_node->properties;
  __pyx_v_c_attr = __pyx_t_4;

  /* "lxml/etree.pyx":1035
 *         # remove all attributes
 *         c_attr = c_node.properties
 *         if c_attr:             # <<<<<<<<<<<<<<
 *             c_node.properties = NULL
 *             tree.xmlFreePropList(c_attr)
*/
  __pyx_t_3 = (__pyx_v_c_attr != 0);
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":1036
 *         c_attr = c_node.properties
 *         if c_attr:
 *             c_node.properties = NULL             # <<<<<<<<<<<<<<
 *             tree.xmlFreePropList(c_attr)
 *         # remove all subelements
*/
    __pyx_v_c_node->properties = NULL;

    /* "lxml/etree.pyx":1037
 *         if c_attr:
 *             c_node.properties = NULL
 *             tree.xmlFreePropList(c_attr)             # <<<<<<<<<<<<<<
 *         # remove all subelements
 *         c_node = c_node.children
*/
    xmlFreePropList(__pyx_v_c_attr);

    /* "lxml/etree.pyx":1035
 *         # remove all attributes
 *         c_attr = c_node.properties
 *         if c_attr:             # <<<<<<<<<<<<<<
 *             c_node.properties = NULL
 *             tree.xmlFreePropList(c_attr)
*/
  }

  /* "lxml/etree.pyx":1039
 *             tree.xmlFreePropList(c_attr)
 *         # remove all subelements
 *         c_node = c_node.children             # <<<<<<<<<<<<<<
 *         if c_node and not _isElement(c_node):
 *             c_node = _nextElement(c_node)
*/
  __pyx_t_2 = __pyx_v_c_node->children;
  __pyx_v_c_node = __pyx_t_2;

  /* "lxml/etree.pyx":1040
 *         # remove all subelements
 *         c_node = c_node.children
 *         if c_node and not _isElement(c_node):             # <<<<<<<<<<<<<<
 *             c_node = _nextElement(c_node)
 *         while c_node is not NULL:
*/
  __pyx_t_5 = (__pyx_v_c_node != 0);
  if (__pyx_t_5) {
  } else {
    __pyx_t_3 = __pyx_t_5;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_5 = (!_isElement(__pyx_v_c_node));
  __pyx_t_3 = __pyx_t_5;
  __pyx_L6_bool_binop_done:;
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":1041
 *         c_node = c_node.children
 *         if c_node and not _isElement(c_node):
 *             c_node = _nextElement(c_node)             # <<<<<<<<<<<<<<
 *         while c_node is not NULL:
 *             c_node_next = _nextElement(c_node)
*/
    __pyx_v_c_node = __pyx_f_4lxml_5etree__nextElement(__pyx_v_c_node);

    /* "lxml/etree.pyx":1040
 *         # remove all subelements
 *         c_node = c_node.children
 *         if c_node and not _isElement(c_node):             # <<<<<<<<<<<<<<
 *             c_node = _nextElement(c_node)
 *         while c_node is not NULL:
*/
  }

  /* "lxml/etree.pyx":1042
 *         if c_node and not _isElement(c_node):
 *             c_node = _nextElement(c_node)
 *         while c_node is not NULL:             # <<<<<<<<<<<<<<
 *             c_node_next = _nextElement(c_node)
 *             _removeNode(self._doc, c_node)
*/
  while (1) {
    __pyx_t_3 = (__pyx_v_c_node != NULL);
    if (!__pyx_t_3) break;

    /* "lxml/etree.pyx":1043
 *             c_node = _nextElement(c_node)
 *         while c_node is not NULL:
 *             c_node_next = _nextElement(c_node)             # <<<<<<<<<<<<<<
 *             _removeNode(self._doc, c_node)
 *             c_node = c_node_next
*/
    __pyx_v_c_node_next = __pyx_f_4lxml_5etree__nextElement(__pyx_v_c_node);

    /* "lxml/etree.pyx":1044
 *         while c_node is not NULL:
 *             c_node_next = _nextElement(c_node)
 *             _removeNode(self._doc, c_node)             # <<<<<<<<<<<<<<
 *             c_node = c_node_next
 * 
*/
    __pyx_t_6 = ((PyObject *)__pyx_v_self->_doc);
    __Pyx_INCREF(__pyx_t_6);
    __pyx_t_1 = __pyx_f_4lxml_5etree__removeNode(((struct LxmlDocument *)__pyx_t_6), __pyx_v_c_node); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1044, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "lxml/etree.pyx":1045
 *             c_node_next = _nextElement(c_node)
 *             _removeNode(self._doc, c_node)
 *             c_node = c_node_next             # <<<<<<<<<<<<<<
 * 
 *     def insert(self, index: int, _Element element not None):
*/
    __pyx_v_c_node = __pyx_v_c_node_next;
  }

  /* "lxml/etree.pyx":1015
 *             _appendChild(self, element)
 * 
 *     def clear(self, bint keep_tail=False):             # <<<<<<<<<<<<<<
 *         """clear(self, keep_tail=False)
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._Element.clear", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1047
 *             c_node = c_node_next
 * 
 *     def insert(self, index: int, _Element element not None):             # <<<<<<<<<<<<<<
 *         """insert(self, index, element)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_25insert(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_24insert, "insert(self, index, element)\n\n        Inserts a subelement at the given position in this element\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_25insert = {"insert", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_25insert, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_24insert};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_25insert(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_index = 0;
  struct LxmlElement *__pyx_v_element = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("insert (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_index,&__pyx_mstate_global->__pyx_n_u_element,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1047, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1047, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1047, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "insert", 0) < (0)) __PYX_ERR(0, 1047, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("insert", 1, 2, 2, i); __PYX_ERR(0, 1047, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1047, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1047, __pyx_L3_error)
    }
    if (__Pyx_PyInt_FromNumber(&values[0], "index", 0) < (0)) __PYX_ERR(0, 1047, __pyx_L3_error)
    __pyx_v_index = ((PyObject*)values[0]);
    __pyx_v_element = ((struct LxmlElement *)values[1]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("insert", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1047, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._Element.insert", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_index), (&PyLong_Type), 0, "index", 2))) __PYX_ERR(0, 1047, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_element), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element, 0, "element", 0))) __PYX_ERR(0, 1047, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_24insert(((struct LxmlElement *)__pyx_v_self), __pyx_v_index, __pyx_v_element);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8_Element_24insert(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_index, struct LxmlElement *__pyx_v_element) {
  xmlNode *__pyx_v_c_node;
  xmlNode *__pyx_v_c_next;
  xmlDoc *__pyx_v_c_source_doc;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  xmlDoc *__pyx_t_7;
  xmlNode *__pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("insert", 0);

  /* "lxml/etree.pyx":1055
 *         cdef xmlNode* c_next
 *         cdef xmlDoc* c_source_doc
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         _assertValidNode(element)
 *         c_node = _findChild(self._c_node, index)
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1055, __pyx_L1_error)

  /* "lxml/etree.pyx":1056
 *         cdef xmlDoc* c_source_doc
 *         _assertValidNode(self)
 *         _assertValidNode(element)             # <<<<<<<<<<<<<<
 *         c_node = _findChild(self._c_node, index)
 *         if c_node is NULL:
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_element); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1056, __pyx_L1_error)

  /* "lxml/etree.pyx":1057
 *         _assertValidNode(self)
 *         _assertValidNode(element)
 *         c_node = _findChild(self._c_node, index)             # <<<<<<<<<<<<<<
 *         if c_node is NULL:
 *             _appendChild(self, element)
*/
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1057, __pyx_L1_error)
  __pyx_v_c_node = __pyx_f_4lxml_5etree__findChild(__pyx_v_self->_c_node, __pyx_t_2);

  /* "lxml/etree.pyx":1058
 *         _assertValidNode(element)
 *         c_node = _findChild(self._c_node, index)
 *         if c_node is NULL:             # <<<<<<<<<<<<<<
 *             _appendChild(self, element)
 *             return
*/
  __pyx_t_3 = (__pyx_v_c_node == NULL);
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":1059
 *         c_node = _findChild(self._c_node, index)
 *         if c_node is NULL:
 *             _appendChild(self, element)             # <<<<<<<<<<<<<<
 *             return
 *         # prevent cycles
*/
    __pyx_t_1 = __pyx_f_4lxml_5etree__appendChild(__pyx_v_self, __pyx_v_element); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1059, __pyx_L1_error)

    /* "lxml/etree.pyx":1060
 *         if c_node is NULL:
 *             _appendChild(self, element)
 *             return             # <<<<<<<<<<<<<<
 *         # prevent cycles
 *         if _isAncestorOrSame(element._c_node, self._c_node):
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "lxml/etree.pyx":1058
 *         _assertValidNode(element)
 *         c_node = _findChild(self._c_node, index)
 *         if c_node is NULL:             # <<<<<<<<<<<<<<
 *             _appendChild(self, element)
 *             return
*/
  }

  /* "lxml/etree.pyx":1062
 *             return
 *         # prevent cycles
 *         if _isAncestorOrSame(element._c_node, self._c_node):             # <<<<<<<<<<<<<<
 *             raise ValueError("cannot append parent to itself")
 *         c_source_doc = element._c_node.doc
*/
  __pyx_t_3 = __pyx_f_4lxml_5etree__isAncestorOrSame(__pyx_v_element->_c_node, __pyx_v_self->_c_node);
  if (unlikely(__pyx_t_3)) {

    /* "lxml/etree.pyx":1063
 *         # prevent cycles
 *         if _isAncestorOrSame(element._c_node, self._c_node):
 *             raise ValueError("cannot append parent to itself")             # <<<<<<<<<<<<<<
 *         c_source_doc = element._c_node.doc
 *         c_next = element._c_node.next
*/
    __pyx_t_5 = NULL;
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_cannot_append_parent_to_itself};
      __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1063, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __PYX_ERR(0, 1063, __pyx_L1_error)

    /* "lxml/etree.pyx":1062
 *             return
 *         # prevent cycles
 *         if _isAncestorOrSame(element._c_node, self._c_node):             # <<<<<<<<<<<<<<
 *             raise ValueError("cannot append parent to itself")
 *         c_source_doc = element._c_node.doc
*/
  }

  /* "lxml/etree.pyx":1064
 *         if _isAncestorOrSame(element._c_node, self._c_node):
 *             raise ValueError("cannot append parent to itself")
 *         c_source_doc = element._c_node.doc             # <<<<<<<<<<<<<<
 *         c_next = element._c_node.next
 *         tree.xmlAddPrevSibling(c_node, element._c_node)
*/
  __pyx_t_7 = __pyx_v_element->_c_node->doc;
  __pyx_v_c_source_doc = __pyx_t_7;

  /* "lxml/etree.pyx":1065
 *             raise ValueError("cannot append parent to itself")
 *         c_source_doc = element._c_node.doc
 *         c_next = element._c_node.next             # <<<<<<<<<<<<<<
 *         tree.xmlAddPrevSibling(c_node, element._c_node)
 *         _moveTail(c_next, element._c_node)
*/
  __pyx_t_8 = __pyx_v_element->_c_node->next;
  __pyx_v_c_next = __pyx_t_8;

  /* "lxml/etree.pyx":1066
 *         c_source_doc = element._c_node.doc
 *         c_next = element._c_node.next
 *         tree.xmlAddPrevSibling(c_node, element._c_node)             # <<<<<<<<<<<<<<
 *         _moveTail(c_next, element._c_node)
 *         moveNodeToDocument(self._doc, c_source_doc, element._c_node)
*/
  (void)(xmlAddPrevSibling(__pyx_v_c_node, __pyx_v_element->_c_node));

  /* "lxml/etree.pyx":1067
 *         c_next = element._c_node.next
 *         tree.xmlAddPrevSibling(c_node, element._c_node)
 *         _moveTail(c_next, element._c_node)             # <<<<<<<<<<<<<<
 *         moveNodeToDocument(self._doc, c_source_doc, element._c_node)
 * 
*/
  __pyx_f_4lxml_5etree__moveTail(__pyx_v_c_next, __pyx_v_element->_c_node);

  /* "lxml/etree.pyx":1068
 *         tree.xmlAddPrevSibling(c_node, element._c_node)
 *         _moveTail(c_next, element._c_node)
 *         moveNodeToDocument(self._doc, c_source_doc, element._c_node)             # <<<<<<<<<<<<<<
 * 
 *     def remove(self, _Element element not None):
*/
  __pyx_t_4 = ((PyObject *)__pyx_v_self->_doc);
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_1 = __pyx_f_4lxml_5etree_moveNodeToDocument(((struct LxmlDocument *)__pyx_t_4), __pyx_v_c_source_doc, __pyx_v_element->_c_node); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1068, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "lxml/etree.pyx":1047
 *             c_node = c_node_next
 * 
 *     def insert(self, index: int, _Element element not None):             # <<<<<<<<<<<<<<
 *         """insert(self, index, element)
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._Element.insert", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1070
 *         moveNodeToDocument(self._doc, c_source_doc, element._c_node)
 * 
 *     def remove(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         """remove(self, element)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_27remove(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_26remove, "remove(self, element)\n\n        Removes a matching subelement. Unlike the find methods, this\n        method compares elements based on identity, not on tag value\n        or contents.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_27remove = {"remove", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_27remove, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_26remove};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_27remove(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct LxmlElement *__pyx_v_element = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("remove (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_element,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1070, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1070, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "remove", 0) < (0)) __PYX_ERR(0, 1070, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("remove", 1, 1, 1, i); __PYX_ERR(0, 1070, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1070, __pyx_L3_error)
    }
    __pyx_v_element = ((struct LxmlElement *)values[0]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("remove", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1070, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._Element.remove", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_element), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element, 0, "element", 0))) __PYX_ERR(0, 1070, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_26remove(((struct LxmlElement *)__pyx_v_self), __pyx_v_element);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8_Element_26remove(struct LxmlElement *__pyx_v_self, struct LxmlElement *__pyx_v_element) {
  xmlNode *__pyx_v_c_node;
  xmlNode *__pyx_v_c_next;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  xmlNode *__pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("remove", 0);

  /* "lxml/etree.pyx":1079
 *         cdef xmlNode* c_node
 *         cdef xmlNode* c_next
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         _assertValidNode(element)
 *         c_node = element._c_node
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1079, __pyx_L1_error)

  /* "lxml/etree.pyx":1080
 *         cdef xmlNode* c_next
 *         _assertValidNode(self)
 *         _assertValidNode(element)             # <<<<<<<<<<<<<<
 *         c_node = element._c_node
 *         if c_node.parent is not self._c_node:
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_element); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1080, __pyx_L1_error)

  /* "lxml/etree.pyx":1081
 *         _assertValidNode(self)
 *         _assertValidNode(element)
 *         c_node = element._c_node             # <<<<<<<<<<<<<<
 *         if c_node.parent is not self._c_node:
 *             raise ValueError, "Element is not a child of this node."
*/
  __pyx_t_2 = __pyx_v_element->_c_node;
  __pyx_v_c_node = __pyx_t_2;

  /* "lxml/etree.pyx":1082
 *         _assertValidNode(element)
 *         c_node = element._c_node
 *         if c_node.parent is not self._c_node:             # <<<<<<<<<<<<<<
 *             raise ValueError, "Element is not a child of this node."
 *         c_next = element._c_node.next
*/
  __pyx_t_3 = (__pyx_v_c_node->parent != __pyx_v_self->_c_node);
  if (unlikely(__pyx_t_3)) {

    /* "lxml/etree.pyx":1083
 *         c_node = element._c_node
 *         if c_node.parent is not self._c_node:
 *             raise ValueError, "Element is not a child of this node."             # <<<<<<<<<<<<<<
 *         c_next = element._c_node.next
 *         tree.xmlUnlinkNode(c_node)
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Element_is_not_a_child_of_this_n, 0, 0);
    __PYX_ERR(0, 1083, __pyx_L1_error)

    /* "lxml/etree.pyx":1082
 *         _assertValidNode(element)
 *         c_node = element._c_node
 *         if c_node.parent is not self._c_node:             # <<<<<<<<<<<<<<
 *             raise ValueError, "Element is not a child of this node."
 *         c_next = element._c_node.next
*/
  }

  /* "lxml/etree.pyx":1084
 *         if c_node.parent is not self._c_node:
 *             raise ValueError, "Element is not a child of this node."
 *         c_next = element._c_node.next             # <<<<<<<<<<<<<<
 *         tree.xmlUnlinkNode(c_node)
 *         _moveTail(c_next, c_node)
*/
  __pyx_t_2 = __pyx_v_element->_c_node->next;
  __pyx_v_c_next = __pyx_t_2;

  /* "lxml/etree.pyx":1085
 *             raise ValueError, "Element is not a child of this node."
 *         c_next = element._c_node.next
 *         tree.xmlUnlinkNode(c_node)             # <<<<<<<<<<<<<<
 *         _moveTail(c_next, c_node)
 *         # fix namespace declarations
*/
  xmlUnlinkNode(__pyx_v_c_node);

  /* "lxml/etree.pyx":1086
 *         c_next = element._c_node.next
 *         tree.xmlUnlinkNode(c_node)
 *         _moveTail(c_next, c_node)             # <<<<<<<<<<<<<<
 *         # fix namespace declarations
 *         moveNodeToDocument(self._doc, c_node.doc, c_node)
*/
  __pyx_f_4lxml_5etree__moveTail(__pyx_v_c_next, __pyx_v_c_node);

  /* "lxml/etree.pyx":1088
 *         _moveTail(c_next, c_node)
 *         # fix namespace declarations
 *         moveNodeToDocument(self._doc, c_node.doc, c_node)             # <<<<<<<<<<<<<<
 * 
 *     def replace(self, _Element old_element not None,
*/
  __pyx_t_4 = ((PyObject *)__pyx_v_self->_doc);
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_1 = __pyx_f_4lxml_5etree_moveNodeToDocument(((struct LxmlDocument *)__pyx_t_4), __pyx_v_c_node->doc, __pyx_v_c_node); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1088, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "lxml/etree.pyx":1070
 *         moveNodeToDocument(self._doc, c_source_doc, element._c_node)
 * 
 *     def remove(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         """remove(self, element)
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._Element.remove", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1090
 *         moveNodeToDocument(self._doc, c_node.doc, c_node)
 * 
 *     def replace(self, _Element old_element not None,             # <<<<<<<<<<<<<<
 *                 _Element new_element not None):
 *         """replace(self, old_element, new_element)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_29replace(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_28replace, "replace(self, old_element, new_element)\n\n        Replaces a subelement with the element passed as second argument.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_29replace = {"replace", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_29replace, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_28replace};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_29replace(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct LxmlElement *__pyx_v_old_element = 0;
  struct LxmlElement *__pyx_v_new_element = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("replace (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_old_element,&__pyx_mstate_global->__pyx_n_u_new_element,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1090, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1090, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1090, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "replace", 0) < (0)) __PYX_ERR(0, 1090, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("replace", 1, 2, 2, i); __PYX_ERR(0, 1090, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1090, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1090, __pyx_L3_error)
    }
    __pyx_v_old_element = ((struct LxmlElement *)values[0]);
    __pyx_v_new_element = ((struct LxmlElement *)values[1]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("replace", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1090, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._Element.replace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_old_element), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element, 0, "old_element", 0))) __PYX_ERR(0, 1090, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_new_element), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element, 0, "new_element", 0))) __PYX_ERR(0, 1091, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_28replace(((struct LxmlElement *)__pyx_v_self), __pyx_v_old_element, __pyx_v_new_element);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8_Element_28replace(struct LxmlElement *__pyx_v_self, struct LxmlElement *__pyx_v_old_element, struct LxmlElement *__pyx_v_new_element) {
  xmlNode *__pyx_v_c_old_node;
  xmlNode *__pyx_v_c_old_next;
  xmlNode *__pyx_v_c_new_node;
  xmlNode *__pyx_v_c_new_next;
  xmlDoc *__pyx_v_c_source_doc;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  xmlNode *__pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  xmlDoc *__pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("replace", 0);

  /* "lxml/etree.pyx":1101
 *         cdef xmlNode* c_new_next
 *         cdef xmlDoc* c_source_doc
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         _assertValidNode(old_element)
 *         _assertValidNode(new_element)
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1101, __pyx_L1_error)

  /* "lxml/etree.pyx":1102
 *         cdef xmlDoc* c_source_doc
 *         _assertValidNode(self)
 *         _assertValidNode(old_element)             # <<<<<<<<<<<<<<
 *         _assertValidNode(new_element)
 *         c_old_node = old_element._c_node
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_old_element); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1102, __pyx_L1_error)

  /* "lxml/etree.pyx":1103
 *         _assertValidNode(self)
 *         _assertValidNode(old_element)
 *         _assertValidNode(new_element)             # <<<<<<<<<<<<<<
 *         c_old_node = old_element._c_node
 *         if c_old_node.parent is not self._c_node:
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_new_element); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1103, __pyx_L1_error)

  /* "lxml/etree.pyx":1104
 *         _assertValidNode(old_element)
 *         _assertValidNode(new_element)
 *         c_old_node = old_element._c_node             # <<<<<<<<<<<<<<
 *         if c_old_node.parent is not self._c_node:
 *             raise ValueError, "Element is not a child of this node."
*/
  __pyx_t_2 = __pyx_v_old_element->_c_node;
  __pyx_v_c_old_node = __pyx_t_2;

  /* "lxml/etree.pyx":1105
 *         _assertValidNode(new_element)
 *         c_old_node = old_element._c_node
 *         if c_old_node.parent is not self._c_node:             # <<<<<<<<<<<<<<
 *             raise ValueError, "Element is not a child of this node."
 *         c_new_node = new_element._c_node
*/
  __pyx_t_3 = (__pyx_v_c_old_node->parent != __pyx_v_self->_c_node);
  if (unlikely(__pyx_t_3)) {

    /* "lxml/etree.pyx":1106
 *         c_old_node = old_element._c_node
 *         if c_old_node.parent is not self._c_node:
 *             raise ValueError, "Element is not a child of this node."             # <<<<<<<<<<<<<<
 *         c_new_node = new_element._c_node
 *         # prevent cycles
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Element_is_not_a_child_of_this_n, 0, 0);
    __PYX_ERR(0, 1106, __pyx_L1_error)

    /* "lxml/etree.pyx":1105
 *         _assertValidNode(new_element)
 *         c_old_node = old_element._c_node
 *         if c_old_node.parent is not self._c_node:             # <<<<<<<<<<<<<<
 *             raise ValueError, "Element is not a child of this node."
 *         c_new_node = new_element._c_node
*/
  }

  /* "lxml/etree.pyx":1107
 *         if c_old_node.parent is not self._c_node:
 *             raise ValueError, "Element is not a child of this node."
 *         c_new_node = new_element._c_node             # <<<<<<<<<<<<<<
 *         # prevent cycles
 *         if _isAncestorOrSame(c_new_node, self._c_node):
*/
  __pyx_t_2 = __pyx_v_new_element->_c_node;
  __pyx_v_c_new_node = __pyx_t_2;

  /* "lxml/etree.pyx":1109
 *         c_new_node = new_element._c_node
 *         # prevent cycles
 *         if _isAncestorOrSame(c_new_node, self._c_node):             # <<<<<<<<<<<<<<
 *             raise ValueError("cannot append parent to itself")
 *         # replace node
*/
  __pyx_t_3 = __pyx_f_4lxml_5etree__isAncestorOrSame(__pyx_v_c_new_node, __pyx_v_self->_c_node);
  if (unlikely(__pyx_t_3)) {

    /* "lxml/etree.pyx":1110
 *         # prevent cycles
 *         if _isAncestorOrSame(c_new_node, self._c_node):
 *             raise ValueError("cannot append parent to itself")             # <<<<<<<<<<<<<<
 *         # replace node
 *         c_old_next = c_old_node.next
*/
    __pyx_t_5 = NULL;
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_cannot_append_parent_to_itself};
      __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1110, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __PYX_ERR(0, 1110, __pyx_L1_error)

    /* "lxml/etree.pyx":1109
 *         c_new_node = new_element._c_node
 *         # prevent cycles
 *         if _isAncestorOrSame(c_new_node, self._c_node):             # <<<<<<<<<<<<<<
 *             raise ValueError("cannot append parent to itself")
 *         # replace node
*/
  }

  /* "lxml/etree.pyx":1112
 *             raise ValueError("cannot append parent to itself")
 *         # replace node
 *         c_old_next = c_old_node.next             # <<<<<<<<<<<<<<
 *         c_new_next = c_new_node.next
 *         c_source_doc = c_new_node.doc
*/
  __pyx_t_2 = __pyx_v_c_old_node->next;
  __pyx_v_c_old_next = __pyx_t_2;

  /* "lxml/etree.pyx":1113
 *         # replace node
 *         c_old_next = c_old_node.next
 *         c_new_next = c_new_node.next             # <<<<<<<<<<<<<<
 *         c_source_doc = c_new_node.doc
 *         tree.xmlReplaceNode(c_old_node, c_new_node)
*/
  __pyx_t_2 = __pyx_v_c_new_node->next;
  __pyx_v_c_new_next = __pyx_t_2;

  /* "lxml/etree.pyx":1114
 *         c_old_next = c_old_node.next
 *         c_new_next = c_new_node.next
 *         c_source_doc = c_new_node.doc             # <<<<<<<<<<<<<<
 *         tree.xmlReplaceNode(c_old_node, c_new_node)
 *         _moveTail(c_new_next, c_new_node)
*/
  __pyx_t_7 = __pyx_v_c_new_node->doc;
  __pyx_v_c_source_doc = __pyx_t_7;

  /* "lxml/etree.pyx":1115
 *         c_new_next = c_new_node.next
 *         c_source_doc = c_new_node.doc
 *         tree.xmlReplaceNode(c_old_node, c_new_node)             # <<<<<<<<<<<<<<
 *         _moveTail(c_new_next, c_new_node)
 *         _moveTail(c_old_next, c_old_node)
*/
  (void)(xmlReplaceNode(__pyx_v_c_old_node, __pyx_v_c_new_node));

  /* "lxml/etree.pyx":1116
 *         c_source_doc = c_new_node.doc
 *         tree.xmlReplaceNode(c_old_node, c_new_node)
 *         _moveTail(c_new_next, c_new_node)             # <<<<<<<<<<<<<<
 *         _moveTail(c_old_next, c_old_node)
 *         moveNodeToDocument(self._doc, c_source_doc, c_new_node)
*/
  __pyx_f_4lxml_5etree__moveTail(__pyx_v_c_new_next, __pyx_v_c_new_node);

  /* "lxml/etree.pyx":1117
 *         tree.xmlReplaceNode(c_old_node, c_new_node)
 *         _moveTail(c_new_next, c_new_node)
 *         _moveTail(c_old_next, c_old_node)             # <<<<<<<<<<<<<<
 *         moveNodeToDocument(self._doc, c_source_doc, c_new_node)
 *         # fix namespace declarations
*/
  __pyx_f_4lxml_5etree__moveTail(__pyx_v_c_old_next, __pyx_v_c_old_node);

  /* "lxml/etree.pyx":1118
 *         _moveTail(c_new_next, c_new_node)
 *         _moveTail(c_old_next, c_old_node)
 *         moveNodeToDocument(self._doc, c_source_doc, c_new_node)             # <<<<<<<<<<<<<<
 *         # fix namespace declarations
 *         moveNodeToDocument(self._doc, c_old_node.doc, c_old_node)
*/
  __pyx_t_4 = ((PyObject *)__pyx_v_self->_doc);
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_1 = __pyx_f_4lxml_5etree_moveNodeToDocument(((struct LxmlDocument *)__pyx_t_4), __pyx_v_c_source_doc, __pyx_v_c_new_node); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1118, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "lxml/etree.pyx":1120
 *         moveNodeToDocument(self._doc, c_source_doc, c_new_node)
 *         # fix namespace declarations
 *         moveNodeToDocument(self._doc, c_old_node.doc, c_old_node)             # <<<<<<<<<<<<<<
 * 
 *     # PROPERTIES
*/
  __pyx_t_4 = ((PyObject *)__pyx_v_self->_doc);
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_1 = __pyx_f_4lxml_5etree_moveNodeToDocument(((struct LxmlDocument *)__pyx_t_4), __pyx_v_c_old_node->doc, __pyx_v_c_old_node); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1120, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "lxml/etree.pyx":1090
 *         moveNodeToDocument(self._doc, c_node.doc, c_node)
 * 
 *     def replace(self, _Element old_element not None,             # <<<<<<<<<<<<<<
 *                 _Element new_element not None):
 *         """replace(self, old_element, new_element)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._Element.replace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1126
 *         """Element tag
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if self._tag is not None:
 *                 return self._tag
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_3tag_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_8_Element_3tag_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_3tag___get__(((struct LxmlElement *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8_Element_3tag___get__(struct LxmlElement *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lxml/etree.pyx":1127
 *         """
 *         def __get__(self):
 *             if self._tag is not None:             # <<<<<<<<<<<<<<
 *                 return self._tag
 *             _assertValidNode(self)
*/
  __pyx_t_1 = (__pyx_v_self->_tag != Py_None);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":1128
 *         def __get__(self):
 *             if self._tag is not None:
 *                 return self._tag             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             self._tag = _namespacedName(self._c_node)
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_self->_tag);
    __pyx_r = __pyx_v_self->_tag;
    goto __pyx_L0;

    /* "lxml/etree.pyx":1127
 *         """
 *         def __get__(self):
 *             if self._tag is not None:             # <<<<<<<<<<<<<<
 *                 return self._tag
 *             _assertValidNode(self)
*/
  }

  /* "lxml/etree.pyx":1129
 *             if self._tag is not None:
 *                 return self._tag
 *             _assertValidNode(self)             # <<<<<<<<<<<<<<
 *             self._tag = _namespacedName(self._c_node)
 *             return self._tag
*/
  __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 1129, __pyx_L1_error)

  /* "lxml/etree.pyx":1130
 *                 return self._tag
 *             _assertValidNode(self)
 *             self._tag = _namespacedName(self._c_node)             # <<<<<<<<<<<<<<
 *             return self._tag
 * 
*/
  __pyx_t_3 = __pyx_f_4lxml_5etree__namespacedName(__pyx_v_self->_c_node); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_v_self->_tag);
  __Pyx_DECREF(__pyx_v_self->_tag);
  __pyx_v_self->_tag = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "lxml/etree.pyx":1131
 *             _assertValidNode(self)
 *             self._tag = _namespacedName(self._c_node)
 *             return self._tag             # <<<<<<<<<<<<<<
 * 
 *         def __set__(self, value):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_tag);
  __pyx_r = __pyx_v_self->_tag;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1126
 *         """Element tag
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if self._tag is not None:
 *                 return self._tag
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Element.tag.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1133
 *             return self._tag
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             cdef _BaseParser parser
 *             _assertValidNode(self)
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_8_Element_3tag_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_4lxml_5etree_8_Element_3tag_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_3tag_2__set__(((struct LxmlElement *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_8_Element_3tag_2__set__(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_value) {
  struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser = 0;
  PyObject *__pyx_v_ns = NULL;
  PyObject *__pyx_v_name = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "lxml/etree.pyx":1135
 *         def __set__(self, value):
 *             cdef _BaseParser parser
 *             _assertValidNode(self)             # <<<<<<<<<<<<<<
 *             ns, name = _getNsTag(value)
 *             parser = self._doc._parser
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1135, __pyx_L1_error)

  /* "lxml/etree.pyx":1136
 *             cdef _BaseParser parser
 *             _assertValidNode(self)
 *             ns, name = _getNsTag(value)             # <<<<<<<<<<<<<<
 *             parser = self._doc._parser
 *             if parser is not None and parser._for_html:
*/
  __pyx_t_2 = __pyx_f_4lxml_5etree__getNsTag(__pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1136, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (likely(__pyx_t_2 != Py_None)) {
    PyObject* sequence = __pyx_t_2;
    Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1136, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1136, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1136, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 1136, __pyx_L1_error)
  }
  __pyx_v_ns = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_name = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "lxml/etree.pyx":1137
 *             _assertValidNode(self)
 *             ns, name = _getNsTag(value)
 *             parser = self._doc._parser             # <<<<<<<<<<<<<<
 *             if parser is not None and parser._for_html:
 *                 _htmlTagValidOrRaise(name)
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self->_doc->_parser);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "lxml/etree.pyx":1138
 *             ns, name = _getNsTag(value)
 *             parser = self._doc._parser
 *             if parser is not None and parser._for_html:             # <<<<<<<<<<<<<<
 *                 _htmlTagValidOrRaise(name)
 *             else:
*/
  __pyx_t_6 = (((PyObject *)__pyx_v_parser) != Py_None);
  if (__pyx_t_6) {
  } else {
    __pyx_t_5 = __pyx_t_6;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_5 = __pyx_v_parser->_for_html;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_5) {

    /* "lxml/etree.pyx":1139
 *             parser = self._doc._parser
 *             if parser is not None and parser._for_html:
 *                 _htmlTagValidOrRaise(name)             # <<<<<<<<<<<<<<
 *             else:
 *                 _tagValidOrRaise(name)
*/
    __pyx_t_1 = __pyx_f_4lxml_5etree__htmlTagValidOrRaise(__pyx_v_name); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1139, __pyx_L1_error)

    /* "lxml/etree.pyx":1138
 *             ns, name = _getNsTag(value)
 *             parser = self._doc._parser
 *             if parser is not None and parser._for_html:             # <<<<<<<<<<<<<<
 *                 _htmlTagValidOrRaise(name)
 *             else:
*/
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":1141
 *                 _htmlTagValidOrRaise(name)
 *             else:
 *                 _tagValidOrRaise(name)             # <<<<<<<<<<<<<<
 *             self._tag = value
 *             tree.xmlNodeSetName(self._c_node, _xcstr(name))
*/
  /*else*/ {
    __pyx_t_1 = __pyx_f_4lxml_5etree__tagValidOrRaise(__pyx_v_name); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1141, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "lxml/etree.pyx":1142
 *             else:
 *                 _tagValidOrRaise(name)
 *             self._tag = value             # <<<<<<<<<<<<<<
 *             tree.xmlNodeSetName(self._c_node, _xcstr(name))
 *             if ns is None:
*/
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(__pyx_v_self->_tag);
  __Pyx_DECREF(__pyx_v_self->_tag);
  __pyx_v_self->_tag = __pyx_v_value;

  /* "lxml/etree.pyx":1143
 *                 _tagValidOrRaise(name)
 *             self._tag = value
 *             tree.xmlNodeSetName(self._c_node, _xcstr(name))             # <<<<<<<<<<<<<<
 *             if ns is None:
 *                 self._c_node.ns = NULL
*/
  xmlNodeSetName(__pyx_v_self->_c_node, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_name));

  /* "lxml/etree.pyx":1144
 *             self._tag = value
 *             tree.xmlNodeSetName(self._c_node, _xcstr(name))
 *             if ns is None:             # <<<<<<<<<<<<<<
 *                 self._c_node.ns = NULL
 *             else:
*/
  __pyx_t_5 = (__pyx_v_ns == Py_None);
  if (__pyx_t_5) {

    /* "lxml/etree.pyx":1145
 *             tree.xmlNodeSetName(self._c_node, _xcstr(name))
 *             if ns is None:
 *                 self._c_node.ns = NULL             # <<<<<<<<<<<<<<
 *             else:
 *                 self._doc._setNodeNs(self._c_node, _xcstr(ns))
*/
    __pyx_v_self->_c_node->ns = NULL;

    /* "lxml/etree.pyx":1144
 *             self._tag = value
 *             tree.xmlNodeSetName(self._c_node, _xcstr(name))
 *             if ns is None:             # <<<<<<<<<<<<<<
 *                 self._c_node.ns = NULL
 *             else:
*/
    goto __pyx_L6;
  }

  /* "lxml/etree.pyx":1147
 *                 self._c_node.ns = NULL
 *             else:
 *                 self._doc._setNodeNs(self._c_node, _xcstr(ns))             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  /*else*/ {
    __pyx_t_1 = __pyx_f_4lxml_5etree_9_Document__setNodeNs(__pyx_v_self->_doc, __pyx_v_self->_c_node, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_ns)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1147, __pyx_L1_error)
  }
  __pyx_L6:;

  /* "lxml/etree.pyx":1133
 *             return self._tag
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             cdef _BaseParser parser
 *             _assertValidNode(self)
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._Element.tag.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_parser);
  __Pyx_XDECREF(__pyx_v_ns);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1149
 *                 self._doc._setNodeNs(self._c_node, _xcstr(ns))
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def attrib(self):
 *         """Element attribute dictionary. Where possible, use get(), set(),
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_6attrib_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_8_Element_6attrib_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_6attrib___get__(((struct LxmlElement *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8_Element_6attrib___get__(struct LxmlElement *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lxml/etree.pyx":1154
 *         keys(), values() and items() to access element attributes.
 *         """
 *         return _Attrib.__new__(_Attrib, self)             # <<<<<<<<<<<<<<
 * 
 *     property text:
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1154, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_v_self);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self)) != (0)) __PYX_ERR(0, 1154, __pyx_L1_error);
  __pyx_t_2 = ((PyObject *)__pyx_tp_new_4lxml_5etree__Attrib(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Attrib), __pyx_t_1, NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1154, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = ((PyObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1149
 *                 self._doc._setNodeNs(self._c_node, _xcstr(ns))
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def attrib(self):
 *         """Element attribute dictionary. Where possible, use get(), set(),
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Element.attrib.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1160
 *         the value None, if there was no text.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             return _collectText(self._c_node.children)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_4text_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_8_Element_4text_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_4text___get__(((struct LxmlElement *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8_Element_4text___get__(struct LxmlElement *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lxml/etree.pyx":1161
 *         """
 *         def __get__(self):
 *             _assertValidNode(self)             # <<<<<<<<<<<<<<
 *             return _collectText(self._c_node.children)
 * 
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1161, __pyx_L1_error)

  /* "lxml/etree.pyx":1162
 *         def __get__(self):
 *             _assertValidNode(self)
 *             return _collectText(self._c_node.children)             # <<<<<<<<<<<<<<
 * 
 *         def __set__(self, value):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree__collectText(__pyx_v_self->_c_node->children); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1162, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1160
 *         the value None, if there was no text.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             return _collectText(self._c_node.children)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Element.text.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1164
 *             return _collectText(self._c_node.children)
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             if isinstance(value, QName):
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_8_Element_4text_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_4lxml_5etree_8_Element_4text_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_4text_2__set__(((struct LxmlElement *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_8_Element_4text_2__set__(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);

  /* "lxml/etree.pyx":1165
 * 
 *         def __set__(self, value):
 *             _assertValidNode(self)             # <<<<<<<<<<<<<<
 *             if isinstance(value, QName):
 *                 value = _resolveQNameText(self, value).decode('utf8')
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1165, __pyx_L1_error)

  /* "lxml/etree.pyx":1166
 *         def __set__(self, value):
 *             _assertValidNode(self)
 *             if isinstance(value, QName):             # <<<<<<<<<<<<<<
 *                 value = _resolveQNameText(self, value).decode('utf8')
 *             _setNodeText(self._c_node, value)
*/
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_value, __pyx_mstate_global->__pyx_ptype_4lxml_5etree_QName); 
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":1167
 *             _assertValidNode(self)
 *             if isinstance(value, QName):
 *                 value = _resolveQNameText(self, value).decode('utf8')             # <<<<<<<<<<<<<<
 *             _setNodeText(self._c_node, value)
 * 
*/
    __pyx_t_3 = __pyx_f_4lxml_5etree__resolveQNameText(__pyx_v_self, __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1167, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (unlikely(__pyx_t_3 == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "decode");
      __PYX_ERR(0, 1167, __pyx_L1_error)
    }
    __pyx_t_4 = __Pyx_decode_bytes(__pyx_t_3, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1167, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "lxml/etree.pyx":1166
 *         def __set__(self, value):
 *             _assertValidNode(self)
 *             if isinstance(value, QName):             # <<<<<<<<<<<<<<
 *                 value = _resolveQNameText(self, value).decode('utf8')
 *             _setNodeText(self._c_node, value)
*/
  }

  /* "lxml/etree.pyx":1168
 *             if isinstance(value, QName):
 *                 value = _resolveQNameText(self, value).decode('utf8')
 *             _setNodeText(self._c_node, value)             # <<<<<<<<<<<<<<
 * 
 *         # using 'del el.text' is the wrong thing to do
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__setNodeText(__pyx_v_self->_c_node, __pyx_v_value); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1168, __pyx_L1_error)

  /* "lxml/etree.pyx":1164
 *             return _collectText(self._c_node.children)
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             if isinstance(value, QName):
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._Element.text.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1179
 *         there was no text.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             return _collectText(self._c_node.next)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_4tail_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_8_Element_4tail_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_4tail___get__(((struct LxmlElement *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8_Element_4tail___get__(struct LxmlElement *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lxml/etree.pyx":1180
 *         """
 *         def __get__(self):
 *             _assertValidNode(self)             # <<<<<<<<<<<<<<
 *             return _collectText(self._c_node.next)
 * 
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1180, __pyx_L1_error)

  /* "lxml/etree.pyx":1181
 *         def __get__(self):
 *             _assertValidNode(self)
 *             return _collectText(self._c_node.next)             # <<<<<<<<<<<<<<
 * 
 *         def __set__(self, value):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree__collectText(__pyx_v_self->_c_node->next); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1179
 *         there was no text.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             return _collectText(self._c_node.next)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Element.tail.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1183
 *             return _collectText(self._c_node.next)
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             _setTailText(self._c_node, value)
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_8_Element_4tail_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_4lxml_5etree_8_Element_4tail_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_4tail_2__set__(((struct LxmlElement *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_8_Element_4tail_2__set__(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "lxml/etree.pyx":1184
 * 
 *         def __set__(self, value):
 *             _assertValidNode(self)             # <<<<<<<<<<<<<<
 *             _setTailText(self._c_node, value)
 * 
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1184, __pyx_L1_error)

  /* "lxml/etree.pyx":1185
 *         def __set__(self, value):
 *             _assertValidNode(self)
 *             _setTailText(self._c_node, value)             # <<<<<<<<<<<<<<
 * 
 *         # using 'del el.tail' is the wrong thing to do
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__setTailText(__pyx_v_self->_c_node, __pyx_v_value); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1185, __pyx_L1_error)

  /* "lxml/etree.pyx":1183
 *             return _collectText(self._c_node.next)
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             _setTailText(self._c_node, value)
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._Element.tail.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "lxml/etree.pyx":1192
 * 
 *     # not in ElementTree, read-only
 *     @property             # <<<<<<<<<<<<<<
 *     def prefix(self):
 *         """Namespace prefix or None.
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_6prefix_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_8_Element_6prefix_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_6prefix___get__(((struct LxmlElement *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8_Element_6prefix___get__(struct LxmlElement *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lxml/etree.pyx":1196
 *         """Namespace prefix or None.
 *         """
 *         if self._c_node.ns is not NULL:             # <<<<<<<<<<<<<<
 *             if self._c_node.ns.prefix is not NULL:
 *                 return funicode(self._c_node.ns.prefix)
*/
  __pyx_t_1 = (__pyx_v_self->_c_node->ns != NULL);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":1197
 *         """
 *         if self._c_node.ns is not NULL:
 *             if self._c_node.ns.prefix is not NULL:             # <<<<<<<<<<<<<<
 *                 return funicode(self._c_node.ns.prefix)
 *         return None
*/
    __pyx_t_1 = (__pyx_v_self->_c_node->ns->prefix != NULL);
    if (__pyx_t_1) {

      /* "lxml/etree.pyx":1198
 *         if self._c_node.ns is not NULL:
 *             if self._c_node.ns.prefix is not NULL:
 *                 return funicode(self._c_node.ns.prefix)             # <<<<<<<<<<<<<<
 *         return None
 * 
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_self->_c_node->ns->prefix); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1198, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;

      /* "lxml/etree.pyx":1197
 *         """
 *         if self._c_node.ns is not NULL:
 *             if self._c_node.ns.prefix is not NULL:             # <<<<<<<<<<<<<<
 *                 return funicode(self._c_node.ns.prefix)
 *         return None
*/
    }

    /* "lxml/etree.pyx":1196
 *         """Namespace prefix or None.
 *         """
 *         if self._c_node.ns is not NULL:             # <<<<<<<<<<<<<<
 *             if self._c_node.ns.prefix is not NULL:
 *                 return funicode(self._c_node.ns.prefix)
*/
  }

  /* "lxml/etree.pyx":1199
 *             if self._c_node.ns.prefix is not NULL:
 *                 return funicode(self._c_node.ns.prefix)
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     # not in ElementTree, read-only
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "lxml/etree.pyx":1192
 * 
 *     # not in ElementTree, read-only
 *     @property             # <<<<<<<<<<<<<<
 *     def prefix(self):
 *         """Namespace prefix or None.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Element.prefix.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1205
 *         """Original line number as found by the parser or None if unknown.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef long line
 *             _assertValidNode(self)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_10sourceline_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_8_Element_10sourceline_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_10sourceline___get__(((struct LxmlElement *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8_Element_10sourceline___get__(struct LxmlElement *__pyx_v_self) {
  long __pyx_v_line;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lxml/etree.pyx":1207
 *         def __get__(self):
 *             cdef long line
 *             _assertValidNode(self)             # <<<<<<<<<<<<<<
 *             line = tree.xmlGetLineNo(self._c_node)
 *             return line if line > 0 else None
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1207, __pyx_L1_error)

  /* "lxml/etree.pyx":1208
 *             cdef long line
 *             _assertValidNode(self)
 *             line = tree.xmlGetLineNo(self._c_node)             # <<<<<<<<<<<<<<
 *             return line if line > 0 else None
 * 
*/
  __pyx_v_line = xmlGetLineNo(__pyx_v_self->_c_node);

  /* "lxml/etree.pyx":1209
 *             _assertValidNode(self)
 *             line = tree.xmlGetLineNo(self._c_node)
 *             return line if line > 0 else None             # <<<<<<<<<<<<<<
 * 
 *         def __set__(self, line):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = (__pyx_v_line > 0);
  if (__pyx_t_3) {
    __pyx_t_4 = __Pyx_PyLong_From_long(__pyx_v_line); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1209, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = __pyx_t_4;
    __pyx_t_4 = 0;
  } else {
    __Pyx_INCREF(Py_None);
    __pyx_t_2 = Py_None;
  }
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1205
 *         """Original line number as found by the parser or None if unknown.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef long line
 *             _assertValidNode(self)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._Element.sourceline.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1211
 *             return line if line > 0 else None
 * 
 *         def __set__(self, line):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             if line <= 0:
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_8_Element_10sourceline_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_line); /*proto*/
static int __pyx_pw_4lxml_5etree_8_Element_10sourceline_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_line) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_10sourceline_2__set__(((struct LxmlElement *)__pyx_v_self), ((PyObject *)__pyx_v_line));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_8_Element_10sourceline_2__set__(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_line) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  unsigned short __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "lxml/etree.pyx":1212
 * 
 *         def __set__(self, line):
 *             _assertValidNode(self)             # <<<<<<<<<<<<<<
 *             if line <= 0:
 *                 self._c_node.line = 0
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1212, __pyx_L1_error)

  /* "lxml/etree.pyx":1213
 *         def __set__(self, line):
 *             _assertValidNode(self)
 *             if line <= 0:             # <<<<<<<<<<<<<<
 *                 self._c_node.line = 0
 *             else:
*/
  __pyx_t_2 = PyObject_RichCompare(__pyx_v_line, __pyx_mstate_global->__pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1213, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 1213, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":1214
 *             _assertValidNode(self)
 *             if line <= 0:
 *                 self._c_node.line = 0             # <<<<<<<<<<<<<<
 *             else:
 *                 self._c_node.line = line
*/
    __pyx_v_self->_c_node->line = 0;

    /* "lxml/etree.pyx":1213
 *         def __set__(self, line):
 *             _assertValidNode(self)
 *             if line <= 0:             # <<<<<<<<<<<<<<
 *                 self._c_node.line = 0
 *             else:
*/
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":1216
 *                 self._c_node.line = 0
 *             else:
 *                 self._c_node.line = line             # <<<<<<<<<<<<<<
 * 
 *     # not in ElementTree, read-only
*/
  /*else*/ {
    __pyx_t_4 = __Pyx_PyLong_As_unsigned_short(__pyx_v_line); if (unlikely((__pyx_t_4 == (unsigned short)-1) && PyErr_Occurred())) __PYX_ERR(0, 1216, __pyx_L1_error)
    __pyx_v_self->_c_node->line = __pyx_t_4;
  }
  __pyx_L3:;

  /* "lxml/etree.pyx":1211
 *             return line if line > 0 else None
 * 
 *         def __set__(self, line):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             if line <= 0:
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Element.sourceline.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1219
 * 
 *     # not in ElementTree, read-only
 *     @property             # <<<<<<<<<<<<<<
 *     def nsmap(self):
 *         """Namespace prefix->URI mapping known in the context of this
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_5nsmap_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_8_Element_5nsmap_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_5nsmap___get__(((struct LxmlElement *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8_Element_5nsmap___get__(struct LxmlElement *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lxml/etree.pyx":1227
 *         Note that changing the returned dict has no effect on the Element.
 *         """
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         return _build_nsmap(self._c_node)
 * 
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1227, __pyx_L1_error)

  /* "lxml/etree.pyx":1228
 *         """
 *         _assertValidNode(self)
 *         return _build_nsmap(self._c_node)             # <<<<<<<<<<<<<<
 * 
 *     # not in ElementTree, read-only
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree__build_nsmap(__pyx_v_self->_c_node); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1228, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1219
 * 
 *     # not in ElementTree, read-only
 *     @property             # <<<<<<<<<<<<<<
 *     def nsmap(self):
 *         """Namespace prefix->URI mapping known in the context of this
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Element.nsmap.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1242
 *         Element, regardless of the document type (XML or HTML).
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             c_base = tree.xmlNodeGetBase(self._doc._c_doc, self._c_node)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_4base_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_8_Element_4base_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_4base___get__(((struct LxmlElement *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8_Element_4base___get__(struct LxmlElement *__pyx_v_self) {
  xmlChar *__pyx_v_c_base;
  PyObject *__pyx_v_base = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  char const *__pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lxml/etree.pyx":1243
 *         """
 *         def __get__(self):
 *             _assertValidNode(self)             # <<<<<<<<<<<<<<
 *             c_base = tree.xmlNodeGetBase(self._doc._c_doc, self._c_node)
 *             if c_base is NULL:
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1243, __pyx_L1_error)

  /* "lxml/etree.pyx":1244
 *         def __get__(self):
 *             _assertValidNode(self)
 *             c_base = tree.xmlNodeGetBase(self._doc._c_doc, self._c_node)             # <<<<<<<<<<<<<<
 *             if c_base is NULL:
 *                 if self._doc._c_doc.URL is NULL:
*/
  __pyx_v_c_base = xmlNodeGetBase(__pyx_v_self->_doc->_c_doc, __pyx_v_self->_c_node);

  /* "lxml/etree.pyx":1245
 *             _assertValidNode(self)
 *             c_base = tree.xmlNodeGetBase(self._doc._c_doc, self._c_node)
 *             if c_base is NULL:             # <<<<<<<<<<<<<<
 *                 if self._doc._c_doc.URL is NULL:
 *                     return None
*/
  __pyx_t_2 = (__pyx_v_c_base == NULL);
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":1246
 *             c_base = tree.xmlNodeGetBase(self._doc._c_doc, self._c_node)
 *             if c_base is NULL:
 *                 if self._doc._c_doc.URL is NULL:             # <<<<<<<<<<<<<<
 *                     return None
 *                 return _decodeFilename(self._doc._c_doc.URL)
*/
    __pyx_t_2 = (__pyx_v_self->_doc->_c_doc->URL == NULL);
    if (__pyx_t_2) {

      /* "lxml/etree.pyx":1247
 *             if c_base is NULL:
 *                 if self._doc._c_doc.URL is NULL:
 *                     return None             # <<<<<<<<<<<<<<
 *                 return _decodeFilename(self._doc._c_doc.URL)
 *             try:
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;

      /* "lxml/etree.pyx":1246
 *             c_base = tree.xmlNodeGetBase(self._doc._c_doc, self._c_node)
 *             if c_base is NULL:
 *                 if self._doc._c_doc.URL is NULL:             # <<<<<<<<<<<<<<
 *                     return None
 *                 return _decodeFilename(self._doc._c_doc.URL)
*/
    }

    /* "lxml/etree.pyx":1248
 *                 if self._doc._c_doc.URL is NULL:
 *                     return None
 *                 return _decodeFilename(self._doc._c_doc.URL)             # <<<<<<<<<<<<<<
 *             try:
 *                 base = _decodeFilename(c_base)
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __pyx_f_4lxml_5etree__decodeFilename(__pyx_v_self->_doc->_c_doc->URL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1248, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "lxml/etree.pyx":1245
 *             _assertValidNode(self)
 *             c_base = tree.xmlNodeGetBase(self._doc._c_doc, self._c_node)
 *             if c_base is NULL:             # <<<<<<<<<<<<<<
 *                 if self._doc._c_doc.URL is NULL:
 *                     return None
*/
  }

  /* "lxml/etree.pyx":1249
 *                     return None
 *                 return _decodeFilename(self._doc._c_doc.URL)
 *             try:             # <<<<<<<<<<<<<<
 *                 base = _decodeFilename(c_base)
 *             finally:
*/
  /*try:*/ {

    /* "lxml/etree.pyx":1250
 *                 return _decodeFilename(self._doc._c_doc.URL)
 *             try:
 *                 base = _decodeFilename(c_base)             # <<<<<<<<<<<<<<
 *             finally:
 *                 tree.xmlFree(c_base)
*/
    __pyx_t_3 = __pyx_f_4lxml_5etree__decodeFilename(__pyx_v_c_base); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1250, __pyx_L6_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_base = __pyx_t_3;
    __pyx_t_3 = 0;
  }

  /* "lxml/etree.pyx":1252
 *                 base = _decodeFilename(c_base)
 *             finally:
 *                 tree.xmlFree(c_base)             # <<<<<<<<<<<<<<
 *             return base
 * 
*/
  /*finally:*/ {
    /*normal exit:*/{
      xmlFree(__pyx_v_c_base);
      goto __pyx_L7;
    }
    __pyx_L6_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      if ( unlikely(__Pyx_GetException(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8) < 0)) __Pyx_ErrFetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __pyx_t_1 = __pyx_lineno; __pyx_t_4 = __pyx_clineno; __pyx_t_5 = __pyx_filename;
      {
        xmlFree(__pyx_v_c_base);
      }
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_ErrRestore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
      __pyx_lineno = __pyx_t_1; __pyx_clineno = __pyx_t_4; __pyx_filename = __pyx_t_5;
      goto __pyx_L1_error;
    }
    __pyx_L7:;
  }

  /* "lxml/etree.pyx":1253
 *             finally:
 *                 tree.xmlFree(c_base)
 *             return base             # <<<<<<<<<<<<<<
 * 
 *         def __set__(self, url):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_base);
  __pyx_r = __pyx_v_base;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1242
 *         Element, regardless of the document type (XML or HTML).
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             c_base = tree.xmlNodeGetBase(self._doc._c_doc, self._c_node)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Element.base.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_base);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1255
 *             return base
 * 
 *         def __set__(self, url):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             if url is None:
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_8_Element_4base_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_url); /*proto*/
static int __pyx_pw_4lxml_5etree_8_Element_4base_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_url) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_4base_2__set__(((struct LxmlElement *)__pyx_v_self), ((PyObject *)__pyx_v_url));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_8_Element_4base_2__set__(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_url) {
  const xmlChar *__pyx_v_c_base;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_url);

  /* "lxml/etree.pyx":1256
 * 
 *         def __set__(self, url):
 *             _assertValidNode(self)             # <<<<<<<<<<<<<<
 *             if url is None:
 *                 c_base = <const_xmlChar*>NULL
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1256, __pyx_L1_error)

  /* "lxml/etree.pyx":1257
 *         def __set__(self, url):
 *             _assertValidNode(self)
 *             if url is None:             # <<<<<<<<<<<<<<
 *                 c_base = <const_xmlChar*>NULL
 *             else:
*/
  __pyx_t_2 = (__pyx_v_url == Py_None);
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":1258
 *             _assertValidNode(self)
 *             if url is None:
 *                 c_base = <const_xmlChar*>NULL             # <<<<<<<<<<<<<<
 *             else:
 *                 url = _encodeFilename(url)
*/
    __pyx_v_c_base = ((const xmlChar *)NULL);

    /* "lxml/etree.pyx":1257
 *         def __set__(self, url):
 *             _assertValidNode(self)
 *             if url is None:             # <<<<<<<<<<<<<<
 *                 c_base = <const_xmlChar*>NULL
 *             else:
*/
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":1260
 *                 c_base = <const_xmlChar*>NULL
 *             else:
 *                 url = _encodeFilename(url)             # <<<<<<<<<<<<<<
 *                 c_base = _xcstr(url)
 *             tree.xmlNodeSetBase(self._c_node, c_base)
*/
  /*else*/ {
    __pyx_t_3 = __pyx_f_4lxml_5etree__encodeFilename(__pyx_v_url); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1260, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_url, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "lxml/etree.pyx":1261
 *             else:
 *                 url = _encodeFilename(url)
 *                 c_base = _xcstr(url)             # <<<<<<<<<<<<<<
 *             tree.xmlNodeSetBase(self._c_node, c_base)
 * 
*/
    __pyx_v_c_base = (const xmlChar*)PyBytes_AS_STRING(__pyx_v_url);
  }
  __pyx_L3:;

  /* "lxml/etree.pyx":1262
 *                 url = _encodeFilename(url)
 *                 c_base = _xcstr(url)
 *             tree.xmlNodeSetBase(self._c_node, c_base)             # <<<<<<<<<<<<<<
 * 
 *     # ACCESSORS
*/
  xmlNodeSetBase(__pyx_v_self->_c_node, __pyx_v_c_base);

  /* "lxml/etree.pyx":1255
 *             return base
 * 
 *         def __set__(self, url):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             if url is None:
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Element.base.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_url);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1265
 * 
 *     # ACCESSORS
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         "__repr__(self)"
 *         return "<Element %s at 0x%x>" % (self.tag, id(self))
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_31__repr__(PyObject *__pyx_v_self); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_30__repr__, "__repr__(self)");
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_8_Element_30__repr__;
#endif
static PyObject *__pyx_pw_4lxml_5etree_8_Element_31__repr__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_30__repr__(((struct LxmlElement *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8_Element_30__repr__(struct LxmlElement *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4[5];
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "lxml/etree.pyx":1267
 *     def __repr__(self):
 *         "__repr__(self)"
 *         return "<Element %s at 0x%x>" % (self.tag, id(self))             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, x):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_tag); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1267, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_t_1), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1267, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1267, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_Format(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_x); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1267, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u_Element;
  __pyx_t_4[1] = __pyx_t_2;
  __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u_at_0x;
  __pyx_t_4[3] = __pyx_t_3;
  __pyx_t_4[4] = __pyx_mstate_global->__pyx_kp_u__3;
  __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_4, 5, 9 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 6 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3));
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1267, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1265
 * 
 *     # ACCESSORS
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         "__repr__(self)"
 *         return "<Element %s at 0x%x>" % (self.tag, id(self))
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Element.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1269
 *         return "<Element %s at 0x%x>" % (self.tag, id(self))
 * 
 *     def __getitem__(self, x):             # <<<<<<<<<<<<<<
 *         """Returns the subelement at the given position or the requested
 *         slice.
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_33__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_32__getitem__, "Returns the subelement at the given position or the requested\n        slice.\n        ");
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_8_Element_32__getitem__;
#endif
static PyObject *__pyx_pw_4lxml_5etree_8_Element_33__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_32__getitem__(((struct LxmlElement *)__pyx_v_self), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8_Element_32__getitem__(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_x) {
  xmlNode *__pyx_v_c_node;
  Py_ssize_t __pyx_v_step;
  Py_ssize_t __pyx_v_slicelength;
  Py_ssize_t __pyx_v_c;
  CYTHON_UNUSED Py_ssize_t __pyx_v_i;
  _node_to_node_function __pyx_v_next_element;
  PyObject *__pyx_v_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  xmlNode *__pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "lxml/etree.pyx":1273
 *         slice.
 *         """
 *         cdef xmlNode* c_node = NULL             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t step = 0, slicelength = 0
 *         cdef Py_ssize_t c, i
*/
  __pyx_v_c_node = NULL;

  /* "lxml/etree.pyx":1274
 *         """
 *         cdef xmlNode* c_node = NULL
 *         cdef Py_ssize_t step = 0, slicelength = 0             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t c, i
 *         cdef _node_to_node_function next_element
*/
  __pyx_v_step = 0;
  __pyx_v_slicelength = 0;

  /* "lxml/etree.pyx":1278
 *         cdef _node_to_node_function next_element
 *         cdef list result
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         if isinstance(x, slice):
 *             # slicing
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1278, __pyx_L1_error)

  /* "lxml/etree.pyx":1279
 *         cdef list result
 *         _assertValidNode(self)
 *         if isinstance(x, slice):             # <<<<<<<<<<<<<<
 *             # slicing
 *             if _isFullSlice(<slice>x):
*/
  __pyx_t_2 = PySlice_Check(__pyx_v_x); 
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":1281
 *         if isinstance(x, slice):
 *             # slicing
 *             if _isFullSlice(<slice>x):             # <<<<<<<<<<<<<<
 *                 return _collectChildren(self)
 *             _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)
*/
    __pyx_t_2 = __pyx_f_4lxml_5etree__isFullSlice(((PyObject*)__pyx_v_x)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 1281, __pyx_L1_error)
    if (__pyx_t_2) {

      /* "lxml/etree.pyx":1282
 *             # slicing
 *             if _isFullSlice(<slice>x):
 *                 return _collectChildren(self)             # <<<<<<<<<<<<<<
 *             _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)
 *             if c_node is NULL:
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __pyx_f_4lxml_5etree__collectChildren(__pyx_v_self); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1282, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L0;

      /* "lxml/etree.pyx":1281
 *         if isinstance(x, slice):
 *             # slicing
 *             if _isFullSlice(<slice>x):             # <<<<<<<<<<<<<<
 *                 return _collectChildren(self)
 *             _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)
*/
    }

    /* "lxml/etree.pyx":1283
 *             if _isFullSlice(<slice>x):
 *                 return _collectChildren(self)
 *             _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)             # <<<<<<<<<<<<<<
 *             if c_node is NULL:
 *                 return []
*/
    __pyx_t_1 = __pyx_f_4lxml_5etree__findChildSlice(((PyObject*)__pyx_v_x), __pyx_v_self->_c_node, (&__pyx_v_c_node), (&__pyx_v_step), (&__pyx_v_slicelength)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1283, __pyx_L1_error)

    /* "lxml/etree.pyx":1284
 *                 return _collectChildren(self)
 *             _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)
 *             if c_node is NULL:             # <<<<<<<<<<<<<<
 *                 return []
 *             if step > 0:
*/
    __pyx_t_2 = (__pyx_v_c_node == NULL);
    if (__pyx_t_2) {

      /* "lxml/etree.pyx":1285
 *             _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)
 *             if c_node is NULL:
 *                 return []             # <<<<<<<<<<<<<<
 *             if step > 0:
 *                 next_element = _nextElement
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1285, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L0;

      /* "lxml/etree.pyx":1284
 *                 return _collectChildren(self)
 *             _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)
 *             if c_node is NULL:             # <<<<<<<<<<<<<<
 *                 return []
 *             if step > 0:
*/
    }

    /* "lxml/etree.pyx":1286
 *             if c_node is NULL:
 *                 return []
 *             if step > 0:             # <<<<<<<<<<<<<<
 *                 next_element = _nextElement
 *             else:
*/
    __pyx_t_2 = (__pyx_v_step > 0);
    if (__pyx_t_2) {

      /* "lxml/etree.pyx":1287
 *                 return []
 *             if step > 0:
 *                 next_element = _nextElement             # <<<<<<<<<<<<<<
 *             else:
 *                 step = -step if step != python.PY_SSIZE_T_MIN else python.PY_SSIZE_T_MAX
*/
      __pyx_v_next_element = __pyx_f_4lxml_5etree__nextElement;

      /* "lxml/etree.pyx":1286
 *             if c_node is NULL:
 *                 return []
 *             if step > 0:             # <<<<<<<<<<<<<<
 *                 next_element = _nextElement
 *             else:
*/
      goto __pyx_L6;
    }

    /* "lxml/etree.pyx":1289
 *                 next_element = _nextElement
 *             else:
 *                 step = -step if step != python.PY_SSIZE_T_MIN else python.PY_SSIZE_T_MAX             # <<<<<<<<<<<<<<
 *                 next_element = _previousElement
 *             result = []
*/
    /*else*/ {
      __pyx_t_2 = (__pyx_v_step != PY_SSIZE_T_MIN);
      if (__pyx_t_2) {
        __pyx_t_4 = (-__pyx_v_step);
      } else {
        __pyx_t_4 = PY_SSIZE_T_MAX;
      }
      __pyx_v_step = __pyx_t_4;

      /* "lxml/etree.pyx":1290
 *             else:
 *                 step = -step if step != python.PY_SSIZE_T_MIN else python.PY_SSIZE_T_MAX
 *                 next_element = _previousElement             # <<<<<<<<<<<<<<
 *             result = []
 *             c = 0
*/
      __pyx_v_next_element = __pyx_f_4lxml_5etree__previousElement;
    }
    __pyx_L6:;

    /* "lxml/etree.pyx":1291
 *                 step = -step if step != python.PY_SSIZE_T_MIN else python.PY_SSIZE_T_MAX
 *                 next_element = _previousElement
 *             result = []             # <<<<<<<<<<<<<<
 *             c = 0
 *             while c_node is not NULL and c < slicelength:
*/
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1291, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_result = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "lxml/etree.pyx":1292
 *                 next_element = _previousElement
 *             result = []
 *             c = 0             # <<<<<<<<<<<<<<
 *             while c_node is not NULL and c < slicelength:
 *                 result.append(_elementFactory(self._doc, c_node))
*/
    __pyx_v_c = 0;

    /* "lxml/etree.pyx":1293
 *             result = []
 *             c = 0
 *             while c_node is not NULL and c < slicelength:             # <<<<<<<<<<<<<<
 *                 result.append(_elementFactory(self._doc, c_node))
 *                 c += 1
*/
    while (1) {
      __pyx_t_5 = (__pyx_v_c_node != NULL);
      if (__pyx_t_5) {
      } else {
        __pyx_t_2 = __pyx_t_5;
        goto __pyx_L9_bool_binop_done;
      }
      __pyx_t_5 = (__pyx_v_c < __pyx_v_slicelength);
      __pyx_t_2 = __pyx_t_5;
      __pyx_L9_bool_binop_done:;
      if (!__pyx_t_2) break;

      /* "lxml/etree.pyx":1294
 *             c = 0
 *             while c_node is not NULL and c < slicelength:
 *                 result.append(_elementFactory(self._doc, c_node))             # <<<<<<<<<<<<<<
 *                 c += 1
 *                 for i in range(step):
*/
      __pyx_t_3 = ((PyObject *)__pyx_v_self->_doc);
      __Pyx_INCREF(__pyx_t_3);
      __pyx_t_6 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_3), __pyx_v_c_node)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1294, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_6); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 1294, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "lxml/etree.pyx":1295
 *             while c_node is not NULL and c < slicelength:
 *                 result.append(_elementFactory(self._doc, c_node))
 *                 c += 1             # <<<<<<<<<<<<<<
 *                 for i in range(step):
 *                     c_node = next_element(c_node)
*/
      __pyx_v_c = (__pyx_v_c + 1);

      /* "lxml/etree.pyx":1296
 *                 result.append(_elementFactory(self._doc, c_node))
 *                 c += 1
 *                 for i in range(step):             # <<<<<<<<<<<<<<
 *                     c_node = next_element(c_node)
 *                     if c_node is NULL:
*/
      __pyx_t_4 = __pyx_v_step;
      __pyx_t_8 = __pyx_t_4;
      for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
        __pyx_v_i = __pyx_t_9;

        /* "lxml/etree.pyx":1297
 *                 c += 1
 *                 for i in range(step):
 *                     c_node = next_element(c_node)             # <<<<<<<<<<<<<<
 *                     if c_node is NULL:
 *                         break
*/
        __pyx_t_10 = __pyx_v_next_element(__pyx_v_c_node); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1297, __pyx_L1_error)
        __pyx_v_c_node = __pyx_t_10;

        /* "lxml/etree.pyx":1298
 *                 for i in range(step):
 *                     c_node = next_element(c_node)
 *                     if c_node is NULL:             # <<<<<<<<<<<<<<
 *                         break
 *             return result
*/
        __pyx_t_2 = (__pyx_v_c_node == NULL);
        if (__pyx_t_2) {

          /* "lxml/etree.pyx":1299
 *                     c_node = next_element(c_node)
 *                     if c_node is NULL:
 *                         break             # <<<<<<<<<<<<<<
 *             return result
 *         else:
*/
          goto __pyx_L12_break;

          /* "lxml/etree.pyx":1298
 *                 for i in range(step):
 *                     c_node = next_element(c_node)
 *                     if c_node is NULL:             # <<<<<<<<<<<<<<
 *                         break
 *             return result
*/
        }
      }
      __pyx_L12_break:;
    }

    /* "lxml/etree.pyx":1300
 *                     if c_node is NULL:
 *                         break
 *             return result             # <<<<<<<<<<<<<<
 *         else:
 *             # indexing
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_result);
    __pyx_r = __pyx_v_result;
    goto __pyx_L0;

    /* "lxml/etree.pyx":1279
 *         cdef list result
 *         _assertValidNode(self)
 *         if isinstance(x, slice):             # <<<<<<<<<<<<<<
 *             # slicing
 *             if _isFullSlice(<slice>x):
*/
  }

  /* "lxml/etree.pyx":1303
 *         else:
 *             # indexing
 *             c_node = _findChild(self._c_node, x)             # <<<<<<<<<<<<<<
 *             if c_node is NULL:
 *                 raise IndexError, "list index out of range"
*/
  /*else*/ {
    __pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_v_x); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1303, __pyx_L1_error)
    __pyx_v_c_node = __pyx_f_4lxml_5etree__findChild(__pyx_v_self->_c_node, __pyx_t_4);

    /* "lxml/etree.pyx":1304
 *             # indexing
 *             c_node = _findChild(self._c_node, x)
 *             if c_node is NULL:             # <<<<<<<<<<<<<<
 *                 raise IndexError, "list index out of range"
 *             return _elementFactory(self._doc, c_node)
*/
    __pyx_t_2 = (__pyx_v_c_node == NULL);
    if (unlikely(__pyx_t_2)) {

      /* "lxml/etree.pyx":1305
 *             c_node = _findChild(self._c_node, x)
 *             if c_node is NULL:
 *                 raise IndexError, "list index out of range"             # <<<<<<<<<<<<<<
 *             return _elementFactory(self._doc, c_node)
 * 
*/
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_IndexError))), __pyx_mstate_global->__pyx_kp_u_list_index_out_of_range, 0, 0);
      __PYX_ERR(0, 1305, __pyx_L1_error)

      /* "lxml/etree.pyx":1304
 *             # indexing
 *             c_node = _findChild(self._c_node, x)
 *             if c_node is NULL:             # <<<<<<<<<<<<<<
 *                 raise IndexError, "list index out of range"
 *             return _elementFactory(self._doc, c_node)
*/
    }

    /* "lxml/etree.pyx":1306
 *             if c_node is NULL:
 *                 raise IndexError, "list index out of range"
 *             return _elementFactory(self._doc, c_node)             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_6 = ((PyObject *)__pyx_v_self->_doc);
    __Pyx_INCREF(__pyx_t_6);
    __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_6), __pyx_v_c_node)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1306, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "lxml/etree.pyx":1269
 *         return "<Element %s at 0x%x>" % (self.tag, id(self))
 * 
 *     def __getitem__(self, x):             # <<<<<<<<<<<<<<
 *         """Returns the subelement at the given position or the requested
 *         slice.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._Element.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1308
 *             return _elementFactory(self._doc, c_node)
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         """__len__(self)
 * 
*/

/* Python wrapper */
static Py_ssize_t __pyx_pw_4lxml_5etree_8_Element_35__len__(PyObject *__pyx_v_self); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_34__len__, "__len__(self)\n\n        Returns the number of subelements.\n        ");
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_8_Element_34__len__;
#endif
static Py_ssize_t __pyx_pw_4lxml_5etree_8_Element_35__len__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_34__len__(((struct LxmlElement *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_ssize_t __pyx_pf_4lxml_5etree_8_Element_34__len__(struct LxmlElement *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "lxml/etree.pyx":1313
 *         Returns the number of subelements.
 *         """
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         return _countElements(self._c_node.children)
 * 
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1313, __pyx_L1_error)

  /* "lxml/etree.pyx":1314
 *         """
 *         _assertValidNode(self)
 *         return _countElements(self._c_node.children)             # <<<<<<<<<<<<<<
 * 
 *     def __bool__(self):
*/
  __pyx_r = __pyx_f_4lxml_5etree__countElements(__pyx_v_self->_c_node->children);
  goto __pyx_L0;

  /* "lxml/etree.pyx":1308
 *             return _elementFactory(self._doc, c_node)
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         """__len__(self)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._Element.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "lxml/etree.pyx":1316
 *         return _countElements(self._c_node.children)
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         """__bool__(self)"""
 *         import warnings
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_8_Element_37__bool__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_4lxml_5etree_8_Element_37__bool__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_36__bool__(((struct LxmlElement *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_8_Element_36__bool__(struct LxmlElement *__pyx_v_self) {
  PyObject *__pyx_v_warnings = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__bool__", 0);

  /* "lxml/etree.pyx":1318
 *     def __bool__(self):
 *         """__bool__(self)"""
 *         import warnings             # <<<<<<<<<<<<<<
 *         warnings.warn(
 *             "Truth-testing of elements was a source of confusion and will always "
*/
  __pyx_t_2 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_warnings, 0, 0, NULL, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1318, __pyx_L1_error)
  __pyx_t_1 = __pyx_t_2;
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_warnings = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "lxml/etree.pyx":1319
 *         """__bool__(self)"""
 *         import warnings
 *         warnings.warn(             # <<<<<<<<<<<<<<
 *             "Truth-testing of elements was a source of confusion and will always "
 *             "return True in future versions. "
*/
  __pyx_t_3 = __pyx_v_warnings;
  __Pyx_INCREF(__pyx_t_3);

  /* "lxml/etree.pyx":1323
 *             "return True in future versions. "
 *             "Use specific 'len(elem)' or 'elem is not None' test instead.",
 *             FutureWarning             # <<<<<<<<<<<<<<
 *             )
 *         # emulate old behaviour
*/
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Truth_testing_of_elements_was_a, ((PyObject *)(((PyTypeObject*)PyExc_FutureWarning)))};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_warn, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1319, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":1326
 *             )
 *         # emulate old behaviour
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         return _hasChild(self._c_node)
 * 
*/
  __pyx_t_5 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 1326, __pyx_L1_error)

  /* "lxml/etree.pyx":1327
 *         # emulate old behaviour
 *         _assertValidNode(self)
 *         return _hasChild(self._c_node)             # <<<<<<<<<<<<<<
 * 
 *     def __contains__(self, element):
*/
  __pyx_r = __pyx_f_4lxml_5etree__hasChild(__pyx_v_self->_c_node);
  goto __pyx_L0;

  /* "lxml/etree.pyx":1316
 *         return _countElements(self._c_node.children)
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         """__bool__(self)"""
 *         import warnings
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Element.__bool__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warnings);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1329
 *         return _hasChild(self._c_node)
 * 
 *     def __contains__(self, element):             # <<<<<<<<<<<<<<
 *         "__contains__(self, element)"
 *         cdef xmlNode* c_node
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_8_Element_39__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_element); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_38__contains__, "__contains__(self, element)");
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_8_Element_38__contains__;
#endif
static int __pyx_pw_4lxml_5etree_8_Element_39__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_element) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_38__contains__(((struct LxmlElement *)__pyx_v_self), ((PyObject *)__pyx_v_element));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_8_Element_38__contains__(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_element) {
  xmlNode *__pyx_v_c_node;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  xmlNode *__pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "lxml/etree.pyx":1332
 *         "__contains__(self, element)"
 *         cdef xmlNode* c_node
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         if not isinstance(element, _Element):
 *             return 0
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1332, __pyx_L1_error)

  /* "lxml/etree.pyx":1333
 *         cdef xmlNode* c_node
 *         _assertValidNode(self)
 *         if not isinstance(element, _Element):             # <<<<<<<<<<<<<<
 *             return 0
 *         c_node = (<_Element>element)._c_node
*/
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_element, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element); 
  __pyx_t_3 = (!__pyx_t_2);
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":1334
 *         _assertValidNode(self)
 *         if not isinstance(element, _Element):
 *             return 0             # <<<<<<<<<<<<<<
 *         c_node = (<_Element>element)._c_node
 *         return c_node is not NULL and c_node.parent is self._c_node
*/
    __pyx_r = 0;
    goto __pyx_L0;

    /* "lxml/etree.pyx":1333
 *         cdef xmlNode* c_node
 *         _assertValidNode(self)
 *         if not isinstance(element, _Element):             # <<<<<<<<<<<<<<
 *             return 0
 *         c_node = (<_Element>element)._c_node
*/
  }

  /* "lxml/etree.pyx":1335
 *         if not isinstance(element, _Element):
 *             return 0
 *         c_node = (<_Element>element)._c_node             # <<<<<<<<<<<<<<
 *         return c_node is not NULL and c_node.parent is self._c_node
 * 
*/
  __pyx_t_4 = ((struct LxmlElement *)__pyx_v_element)->_c_node;
  __pyx_v_c_node = __pyx_t_4;

  /* "lxml/etree.pyx":1336
 *             return 0
 *         c_node = (<_Element>element)._c_node
 *         return c_node is not NULL and c_node.parent is self._c_node             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
*/
  __pyx_t_3 = (__pyx_v_c_node != NULL);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_c_node->parent == __pyx_v_self->_c_node);
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1329
 *         return _hasChild(self._c_node)
 * 
 *     def __contains__(self, element):             # <<<<<<<<<<<<<<
 *         "__contains__(self, element)"
 *         cdef xmlNode* c_node
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._Element.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "lxml/etree.pyx":1338
 *         return c_node is not NULL and c_node.parent is self._c_node
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         "__iter__(self)"
 *         return ElementChildIterator(self)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_41__iter__(PyObject *__pyx_v_self); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_40__iter__, "__iter__(self)");
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_8_Element_40__iter__;
#endif
static PyObject *__pyx_pw_4lxml_5etree_8_Element_41__iter__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_40__iter__(((struct LxmlElement *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8_Element_40__iter__(struct LxmlElement *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "lxml/etree.pyx":1340
 *     def __iter__(self):
 *         "__iter__(self)"
 *         return ElementChildIterator(self)             # <<<<<<<<<<<<<<
 * 
 *     def __reversed__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = NULL;
  __pyx_t_3 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, ((PyObject *)__pyx_v_self)};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_ElementChildIterator, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1340, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __pyx_r = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1338
 *         return c_node is not NULL and c_node.parent is self._c_node
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         "__iter__(self)"
 *         return ElementChildIterator(self)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Element.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1342
 *         return ElementChildIterator(self)
 * 
 *     def __reversed__(self):             # <<<<<<<<<<<<<<
 *         "__reversed__(self)"
 *         return ElementChildIterator(self, reversed=True)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_43__reversed__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_42__reversed__, "__reversed__(self)");
static PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_43__reversed__ = {"__reversed__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_43__reversed__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_42__reversed__};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_43__reversed__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reversed__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reversed__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reversed__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_42__reversed__(((struct LxmlElement *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8_Element_42__reversed__(struct LxmlElement *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reversed__", 0);

  /* "lxml/etree.pyx":1344
 *     def __reversed__(self):
 *         "__reversed__(self)"
 *         return ElementChildIterator(self, reversed=True)             # <<<<<<<<<<<<<<
 * 
 *     def index(self, child: _Element, start: int = None, stop: int = None):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = NULL;
  __pyx_t_3 = 1;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_2, ((PyObject *)__pyx_v_self)};
    __pyx_t_4 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1344, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_reversed, Py_True, __pyx_t_4, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 1344, __pyx_L1_error)
    __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_ElementChildIterator, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1344, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __pyx_r = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1342
 *         return ElementChildIterator(self)
 * 
 *     def __reversed__(self):             # <<<<<<<<<<<<<<
 *         "__reversed__(self)"
 *         return ElementChildIterator(self, reversed=True)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._Element.__reversed__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1346
 *         return ElementChildIterator(self, reversed=True)
 * 
 *     def index(self, child: _Element, start: int = None, stop: int = None):             # <<<<<<<<<<<<<<
 *         """index(self, child, start=None, stop=None)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_45index(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_44index, "index(self, child, start=None, stop=None)\n\n        Find the position of the child within the parent.\n\n        This method is not part of the original ElementTree API.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_45index = {"index", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_45index, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_44index};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_45index(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct LxmlElement *__pyx_v_child = 0;
  PyObject *__pyx_v_start = 0;
  PyObject *__pyx_v_stop = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("index (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_child,&__pyx_mstate_global->__pyx_n_u_start,&__pyx_mstate_global->__pyx_n_u_stop,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1346, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1346, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1346, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1346, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "index", 0) < (0)) __PYX_ERR(0, 1346, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject*)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject*)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("index", 0, 1, 3, i); __PYX_ERR(0, 1346, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1346, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1346, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1346, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject*)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject*)Py_None));
    }
    __pyx_v_child = ((struct LxmlElement *)values[0]);
    if (__Pyx_PyInt_FromNumber(&values[1], "start", 1) < (0)) __PYX_ERR(0, 1346, __pyx_L3_error)
    __pyx_v_start = ((PyObject*)values[1]);
    if (__Pyx_PyInt_FromNumber(&values[2], "stop", 1) < (0)) __PYX_ERR(0, 1346, __pyx_L3_error)
    __pyx_v_stop = ((PyObject*)values[2]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("index", 0, 1, 3, __pyx_nargs); __PYX_ERR(0, 1346, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._Element.index", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_child), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element, 0, "child", 0))) __PYX_ERR(0, 1346, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_start), (&PyLong_Type), 1, "start", 2))) __PYX_ERR(0, 1346, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_stop), (&PyLong_Type), 1, "stop", 2))) __PYX_ERR(0, 1346, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_44index(((struct LxmlElement *)__pyx_v_self), __pyx_v_child, __pyx_v_start, __pyx_v_stop);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8_Element_44index(struct LxmlElement *__pyx_v_self, struct LxmlElement *__pyx_v_child, PyObject *__pyx_v_start, PyObject *__pyx_v_stop) {
  Py_ssize_t __pyx_v_k;
  Py_ssize_t __pyx_v_l;
  Py_ssize_t __pyx_v_c_start;
  Py_ssize_t __pyx_v_c_stop;
  xmlNode *__pyx_v_c_child;
  xmlNode *__pyx_v_c_start_node;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  xmlNode *__pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("index", 0);

  /* "lxml/etree.pyx":1357
 *         cdef xmlNode* c_child
 *         cdef xmlNode* c_start_node
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         _assertValidNode(child)
 *         c_child = child._c_node
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1357, __pyx_L1_error)

  /* "lxml/etree.pyx":1358
 *         cdef xmlNode* c_start_node
 *         _assertValidNode(self)
 *         _assertValidNode(child)             # <<<<<<<<<<<<<<
 *         c_child = child._c_node
 *         if c_child.parent is not self._c_node:
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_child); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1358, __pyx_L1_error)

  /* "lxml/etree.pyx":1359
 *         _assertValidNode(self)
 *         _assertValidNode(child)
 *         c_child = child._c_node             # <<<<<<<<<<<<<<
 *         if c_child.parent is not self._c_node:
 *             raise ValueError, "Element is not a child of this node."
*/
  __pyx_t_2 = __pyx_v_child->_c_node;
  __pyx_v_c_child = __pyx_t_2;

  /* "lxml/etree.pyx":1360
 *         _assertValidNode(child)
 *         c_child = child._c_node
 *         if c_child.parent is not self._c_node:             # <<<<<<<<<<<<<<
 *             raise ValueError, "Element is not a child of this node."
 * 
*/
  __pyx_t_3 = (__pyx_v_c_child->parent != __pyx_v_self->_c_node);
  if (unlikely(__pyx_t_3)) {

    /* "lxml/etree.pyx":1361
 *         c_child = child._c_node
 *         if c_child.parent is not self._c_node:
 *             raise ValueError, "Element is not a child of this node."             # <<<<<<<<<<<<<<
 * 
 *         # handle the unbounded search straight away (normal case)
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Element_is_not_a_child_of_this_n, 0, 0);
    __PYX_ERR(0, 1361, __pyx_L1_error)

    /* "lxml/etree.pyx":1360
 *         _assertValidNode(child)
 *         c_child = child._c_node
 *         if c_child.parent is not self._c_node:             # <<<<<<<<<<<<<<
 *             raise ValueError, "Element is not a child of this node."
 * 
*/
  }

  /* "lxml/etree.pyx":1364
 * 
 *         # handle the unbounded search straight away (normal case)
 *         if stop is None and (start is None or start == 0):             # <<<<<<<<<<<<<<
 *             k = 0
 *             c_child = c_child.prev
*/
  __pyx_t_4 = (__pyx_v_stop == ((PyObject*)Py_None));
  if (__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_4 = (__pyx_v_start == ((PyObject*)Py_None));
  if (!__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_4 = (__Pyx_PyLong_BoolEqObjC(__pyx_v_start, __pyx_mstate_global->__pyx_int_0, 0, 0)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 1364, __pyx_L1_error)
  __pyx_t_3 = __pyx_t_4;
  __pyx_L5_bool_binop_done:;
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":1365
 *         # handle the unbounded search straight away (normal case)
 *         if stop is None and (start is None or start == 0):
 *             k = 0             # <<<<<<<<<<<<<<
 *             c_child = c_child.prev
 *             while c_child is not NULL:
*/
    __pyx_v_k = 0;

    /* "lxml/etree.pyx":1366
 *         if stop is None and (start is None or start == 0):
 *             k = 0
 *             c_child = c_child.prev             # <<<<<<<<<<<<<<
 *             while c_child is not NULL:
 *                 if _isElement(c_child):
*/
    __pyx_t_2 = __pyx_v_c_child->prev;
    __pyx_v_c_child = __pyx_t_2;

    /* "lxml/etree.pyx":1367
 *             k = 0
 *             c_child = c_child.prev
 *             while c_child is not NULL:             # <<<<<<<<<<<<<<
 *                 if _isElement(c_child):
 *                     k += 1
*/
    while (1) {
      __pyx_t_3 = (__pyx_v_c_child != NULL);
      if (!__pyx_t_3) break;

      /* "lxml/etree.pyx":1368
 *             c_child = c_child.prev
 *             while c_child is not NULL:
 *                 if _isElement(c_child):             # <<<<<<<<<<<<<<
 *                     k += 1
 *                 c_child = c_child.prev
*/
      __pyx_t_3 = _isElement(__pyx_v_c_child);
      if (__pyx_t_3) {

        /* "lxml/etree.pyx":1369
 *             while c_child is not NULL:
 *                 if _isElement(c_child):
 *                     k += 1             # <<<<<<<<<<<<<<
 *                 c_child = c_child.prev
 *             return k
*/
        __pyx_v_k = (__pyx_v_k + 1);

        /* "lxml/etree.pyx":1368
 *             c_child = c_child.prev
 *             while c_child is not NULL:
 *                 if _isElement(c_child):             # <<<<<<<<<<<<<<
 *                     k += 1
 *                 c_child = c_child.prev
*/
      }

      /* "lxml/etree.pyx":1370
 *                 if _isElement(c_child):
 *                     k += 1
 *                 c_child = c_child.prev             # <<<<<<<<<<<<<<
 *             return k
 * 
*/
      __pyx_t_2 = __pyx_v_c_child->prev;
      __pyx_v_c_child = __pyx_t_2;
    }

    /* "lxml/etree.pyx":1371
 *                     k += 1
 *                 c_child = c_child.prev
 *             return k             # <<<<<<<<<<<<<<
 * 
 *         # check indices
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = PyLong_FromSsize_t(__pyx_v_k); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1371, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "lxml/etree.pyx":1364
 * 
 *         # handle the unbounded search straight away (normal case)
 *         if stop is None and (start is None or start == 0):             # <<<<<<<<<<<<<<
 *             k = 0
 *             c_child = c_child.prev
*/
  }

  /* "lxml/etree.pyx":1374
 * 
 *         # check indices
 *         if start is None:             # <<<<<<<<<<<<<<
 *             c_start = 0
 *         else:
*/
  __pyx_t_3 = (__pyx_v_start == ((PyObject*)Py_None));
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":1375
 *         # check indices
 *         if start is None:
 *             c_start = 0             # <<<<<<<<<<<<<<
 *         else:
 *             c_start = start
*/
    __pyx_v_c_start = 0;

    /* "lxml/etree.pyx":1374
 * 
 *         # check indices
 *         if start is None:             # <<<<<<<<<<<<<<
 *             c_start = 0
 *         else:
*/
    goto __pyx_L11;
  }

  /* "lxml/etree.pyx":1377
 *             c_start = 0
 *         else:
 *             c_start = start             # <<<<<<<<<<<<<<
 *         if stop is None:
 *             c_stop = 0
*/
  /*else*/ {
    __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_start); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1377, __pyx_L1_error)
    __pyx_v_c_start = __pyx_t_6;
  }
  __pyx_L11:;

  /* "lxml/etree.pyx":1378
 *         else:
 *             c_start = start
 *         if stop is None:             # <<<<<<<<<<<<<<
 *             c_stop = 0
 *         else:
*/
  __pyx_t_3 = (__pyx_v_stop == ((PyObject*)Py_None));
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":1379
 *             c_start = start
 *         if stop is None:
 *             c_stop = 0             # <<<<<<<<<<<<<<
 *         else:
 *             c_stop = stop
*/
    __pyx_v_c_stop = 0;

    /* "lxml/etree.pyx":1378
 *         else:
 *             c_start = start
 *         if stop is None:             # <<<<<<<<<<<<<<
 *             c_stop = 0
 *         else:
*/
    goto __pyx_L12;
  }

  /* "lxml/etree.pyx":1381
 *             c_stop = 0
 *         else:
 *             c_stop = stop             # <<<<<<<<<<<<<<
 *             if c_stop == 0 or \
 *                    c_start >= c_stop and (c_stop > 0 or c_start < 0):
*/
  /*else*/ {
    __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_stop); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1381, __pyx_L1_error)
    __pyx_v_c_stop = __pyx_t_6;

    /* "lxml/etree.pyx":1382
 *         else:
 *             c_stop = stop
 *             if c_stop == 0 or \             # <<<<<<<<<<<<<<
 *                    c_start >= c_stop and (c_stop > 0 or c_start < 0):
 *                 raise ValueError, "list.index(x): x not in slice"
*/
    __pyx_t_4 = (__pyx_v_c_stop == 0);
    if (!__pyx_t_4) {
    } else {
      __pyx_t_3 = __pyx_t_4;
      goto __pyx_L14_bool_binop_done;
    }

    /* "lxml/etree.pyx":1383
 *             c_stop = stop
 *             if c_stop == 0 or \
 *                    c_start >= c_stop and (c_stop > 0 or c_start < 0):             # <<<<<<<<<<<<<<
 *                 raise ValueError, "list.index(x): x not in slice"
 * 
*/
    __pyx_t_4 = (__pyx_v_c_start >= __pyx_v_c_stop);
    if (__pyx_t_4) {
    } else {
      __pyx_t_3 = __pyx_t_4;
      goto __pyx_L14_bool_binop_done;
    }
    __pyx_t_4 = (__pyx_v_c_stop > 0);
    if (!__pyx_t_4) {
    } else {
      __pyx_t_3 = __pyx_t_4;
      goto __pyx_L14_bool_binop_done;
    }
    __pyx_t_4 = (__pyx_v_c_start < 0);
    __pyx_t_3 = __pyx_t_4;
    __pyx_L14_bool_binop_done:;

    /* "lxml/etree.pyx":1382
 *         else:
 *             c_stop = stop
 *             if c_stop == 0 or \             # <<<<<<<<<<<<<<
 *                    c_start >= c_stop and (c_stop > 0 or c_start < 0):
 *                 raise ValueError, "list.index(x): x not in slice"
*/
    if (unlikely(__pyx_t_3)) {

      /* "lxml/etree.pyx":1384
 *             if c_stop == 0 or \
 *                    c_start >= c_stop and (c_stop > 0 or c_start < 0):
 *                 raise ValueError, "list.index(x): x not in slice"             # <<<<<<<<<<<<<<
 * 
 *         # for negative slice indices, check slice before searching index
*/
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_list_index_x_x_not_in_slice, 0, 0);
      __PYX_ERR(0, 1384, __pyx_L1_error)

      /* "lxml/etree.pyx":1382
 *         else:
 *             c_stop = stop
 *             if c_stop == 0 or \             # <<<<<<<<<<<<<<
 *                    c_start >= c_stop and (c_stop > 0 or c_start < 0):
 *                 raise ValueError, "list.index(x): x not in slice"
*/
    }
  }
  __pyx_L12:;

  /* "lxml/etree.pyx":1387
 * 
 *         # for negative slice indices, check slice before searching index
 *         if c_start < 0 or c_stop < 0:             # <<<<<<<<<<<<<<
 *             # start from right, at most up to leftmost(c_start, c_stop)
 *             if c_start < c_stop:
*/
  __pyx_t_4 = (__pyx_v_c_start < 0);
  if (!__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L19_bool_binop_done;
  }
  __pyx_t_4 = (__pyx_v_c_stop < 0);
  __pyx_t_3 = __pyx_t_4;
  __pyx_L19_bool_binop_done:;
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":1389
 *         if c_start < 0 or c_stop < 0:
 *             # start from right, at most up to leftmost(c_start, c_stop)
 *             if c_start < c_stop:             # <<<<<<<<<<<<<<
 *                 k = -c_start
 *             else:
*/
    __pyx_t_3 = (__pyx_v_c_start < __pyx_v_c_stop);
    if (__pyx_t_3) {

      /* "lxml/etree.pyx":1390
 *             # start from right, at most up to leftmost(c_start, c_stop)
 *             if c_start < c_stop:
 *                 k = -c_start             # <<<<<<<<<<<<<<
 *             else:
 *                 k = -c_stop
*/
      __pyx_v_k = (-__pyx_v_c_start);

      /* "lxml/etree.pyx":1389
 *         if c_start < 0 or c_stop < 0:
 *             # start from right, at most up to leftmost(c_start, c_stop)
 *             if c_start < c_stop:             # <<<<<<<<<<<<<<
 *                 k = -c_start
 *             else:
*/
      goto __pyx_L21;
    }

    /* "lxml/etree.pyx":1392
 *                 k = -c_start
 *             else:
 *                 k = -c_stop             # <<<<<<<<<<<<<<
 *             c_start_node = self._c_node.last
 *             l = 1
*/
    /*else*/ {
      __pyx_v_k = (-__pyx_v_c_stop);
    }
    __pyx_L21:;

    /* "lxml/etree.pyx":1393
 *             else:
 *                 k = -c_stop
 *             c_start_node = self._c_node.last             # <<<<<<<<<<<<<<
 *             l = 1
 *             while c_start_node != c_child and l < k:
*/
    __pyx_t_2 = __pyx_v_self->_c_node->last;
    __pyx_v_c_start_node = __pyx_t_2;

    /* "lxml/etree.pyx":1394
 *                 k = -c_stop
 *             c_start_node = self._c_node.last
 *             l = 1             # <<<<<<<<<<<<<<
 *             while c_start_node != c_child and l < k:
 *                 if _isElement(c_start_node):
*/
    __pyx_v_l = 1;

    /* "lxml/etree.pyx":1395
 *             c_start_node = self._c_node.last
 *             l = 1
 *             while c_start_node != c_child and l < k:             # <<<<<<<<<<<<<<
 *                 if _isElement(c_start_node):
 *                     l += 1
*/
    while (1) {
      __pyx_t_4 = (__pyx_v_c_start_node != __pyx_v_c_child);
      if (__pyx_t_4) {
      } else {
        __pyx_t_3 = __pyx_t_4;
        goto __pyx_L24_bool_binop_done;
      }
      __pyx_t_4 = (__pyx_v_l < __pyx_v_k);
      __pyx_t_3 = __pyx_t_4;
      __pyx_L24_bool_binop_done:;
      if (!__pyx_t_3) break;

      /* "lxml/etree.pyx":1396
 *             l = 1
 *             while c_start_node != c_child and l < k:
 *                 if _isElement(c_start_node):             # <<<<<<<<<<<<<<
 *                     l += 1
 *                 c_start_node = c_start_node.prev
*/
      __pyx_t_3 = _isElement(__pyx_v_c_start_node);
      if (__pyx_t_3) {

        /* "lxml/etree.pyx":1397
 *             while c_start_node != c_child and l < k:
 *                 if _isElement(c_start_node):
 *                     l += 1             # <<<<<<<<<<<<<<
 *                 c_start_node = c_start_node.prev
 *             if c_start_node == c_child:
*/
        __pyx_v_l = (__pyx_v_l + 1);

        /* "lxml/etree.pyx":1396
 *             l = 1
 *             while c_start_node != c_child and l < k:
 *                 if _isElement(c_start_node):             # <<<<<<<<<<<<<<
 *                     l += 1
 *                 c_start_node = c_start_node.prev
*/
      }

      /* "lxml/etree.pyx":1398
 *                 if _isElement(c_start_node):
 *                     l += 1
 *                 c_start_node = c_start_node.prev             # <<<<<<<<<<<<<<
 *             if c_start_node == c_child:
 *                 # found! before slice end?
*/
      __pyx_t_2 = __pyx_v_c_start_node->prev;
      __pyx_v_c_start_node = __pyx_t_2;
    }

    /* "lxml/etree.pyx":1399
 *                     l += 1
 *                 c_start_node = c_start_node.prev
 *             if c_start_node == c_child:             # <<<<<<<<<<<<<<
 *                 # found! before slice end?
 *                 if c_stop < 0 and l <= -c_stop:
*/
    __pyx_t_3 = (__pyx_v_c_start_node == __pyx_v_c_child);
    if (__pyx_t_3) {

      /* "lxml/etree.pyx":1401
 *             if c_start_node == c_child:
 *                 # found! before slice end?
 *                 if c_stop < 0 and l <= -c_stop:             # <<<<<<<<<<<<<<
 *                     raise ValueError, "list.index(x): x not in slice"
 *             elif c_start < 0:
*/
      __pyx_t_4 = (__pyx_v_c_stop < 0);
      if (__pyx_t_4) {
      } else {
        __pyx_t_3 = __pyx_t_4;
        goto __pyx_L29_bool_binop_done;
      }
      __pyx_t_4 = (__pyx_v_l <= (-__pyx_v_c_stop));
      __pyx_t_3 = __pyx_t_4;
      __pyx_L29_bool_binop_done:;
      if (unlikely(__pyx_t_3)) {

        /* "lxml/etree.pyx":1402
 *                 # found! before slice end?
 *                 if c_stop < 0 and l <= -c_stop:
 *                     raise ValueError, "list.index(x): x not in slice"             # <<<<<<<<<<<<<<
 *             elif c_start < 0:
 *                 raise ValueError, "list.index(x): x not in slice"
*/
        __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_list_index_x_x_not_in_slice, 0, 0);
        __PYX_ERR(0, 1402, __pyx_L1_error)

        /* "lxml/etree.pyx":1401
 *             if c_start_node == c_child:
 *                 # found! before slice end?
 *                 if c_stop < 0 and l <= -c_stop:             # <<<<<<<<<<<<<<
 *                     raise ValueError, "list.index(x): x not in slice"
 *             elif c_start < 0:
*/
      }

      /* "lxml/etree.pyx":1399
 *                     l += 1
 *                 c_start_node = c_start_node.prev
 *             if c_start_node == c_child:             # <<<<<<<<<<<<<<
 *                 # found! before slice end?
 *                 if c_stop < 0 and l <= -c_stop:
*/
      goto __pyx_L27;
    }

    /* "lxml/etree.pyx":1403
 *                 if c_stop < 0 and l <= -c_stop:
 *                     raise ValueError, "list.index(x): x not in slice"
 *             elif c_start < 0:             # <<<<<<<<<<<<<<
 *                 raise ValueError, "list.index(x): x not in slice"
 * 
*/
    __pyx_t_3 = (__pyx_v_c_start < 0);
    if (unlikely(__pyx_t_3)) {

      /* "lxml/etree.pyx":1404
 *                     raise ValueError, "list.index(x): x not in slice"
 *             elif c_start < 0:
 *                 raise ValueError, "list.index(x): x not in slice"             # <<<<<<<<<<<<<<
 * 
 *         # now determine the index backwards from child
*/
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_list_index_x_x_not_in_slice, 0, 0);
      __PYX_ERR(0, 1404, __pyx_L1_error)

      /* "lxml/etree.pyx":1403
 *                 if c_stop < 0 and l <= -c_stop:
 *                     raise ValueError, "list.index(x): x not in slice"
 *             elif c_start < 0:             # <<<<<<<<<<<<<<
 *                 raise ValueError, "list.index(x): x not in slice"
 * 
*/
    }
    __pyx_L27:;

    /* "lxml/etree.pyx":1387
 * 
 *         # for negative slice indices, check slice before searching index
 *         if c_start < 0 or c_stop < 0:             # <<<<<<<<<<<<<<
 *             # start from right, at most up to leftmost(c_start, c_stop)
 *             if c_start < c_stop:
*/
  }

  /* "lxml/etree.pyx":1407
 * 
 *         # now determine the index backwards from child
 *         c_child = c_child.prev             # <<<<<<<<<<<<<<
 *         k = 0
 *         if c_stop > 0:
*/
  __pyx_t_2 = __pyx_v_c_child->prev;
  __pyx_v_c_child = __pyx_t_2;

  /* "lxml/etree.pyx":1408
 *         # now determine the index backwards from child
 *         c_child = c_child.prev
 *         k = 0             # <<<<<<<<<<<<<<
 *         if c_stop > 0:
 *             # we can optimize: stop after c_stop elements if not found
*/
  __pyx_v_k = 0;

  /* "lxml/etree.pyx":1409
 *         c_child = c_child.prev
 *         k = 0
 *         if c_stop > 0:             # <<<<<<<<<<<<<<
 *             # we can optimize: stop after c_stop elements if not found
 *             while c_child != NULL and k < c_stop:
*/
  __pyx_t_3 = (__pyx_v_c_stop > 0);
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":1411
 *         if c_stop > 0:
 *             # we can optimize: stop after c_stop elements if not found
 *             while c_child != NULL and k < c_stop:             # <<<<<<<<<<<<<<
 *                 if _isElement(c_child):
 *                     k += 1
*/
    while (1) {
      __pyx_t_4 = (__pyx_v_c_child != NULL);
      if (__pyx_t_4) {
      } else {
        __pyx_t_3 = __pyx_t_4;
        goto __pyx_L34_bool_binop_done;
      }
      __pyx_t_4 = (__pyx_v_k < __pyx_v_c_stop);
      __pyx_t_3 = __pyx_t_4;
      __pyx_L34_bool_binop_done:;
      if (!__pyx_t_3) break;

      /* "lxml/etree.pyx":1412
 *             # we can optimize: stop after c_stop elements if not found
 *             while c_child != NULL and k < c_stop:
 *                 if _isElement(c_child):             # <<<<<<<<<<<<<<
 *                     k += 1
 *                 c_child = c_child.prev
*/
      __pyx_t_3 = _isElement(__pyx_v_c_child);
      if (__pyx_t_3) {

        /* "lxml/etree.pyx":1413
 *             while c_child != NULL and k < c_stop:
 *                 if _isElement(c_child):
 *                     k += 1             # <<<<<<<<<<<<<<
 *                 c_child = c_child.prev
 *             if k < c_stop:
*/
        __pyx_v_k = (__pyx_v_k + 1);

        /* "lxml/etree.pyx":1412
 *             # we can optimize: stop after c_stop elements if not found
 *             while c_child != NULL and k < c_stop:
 *                 if _isElement(c_child):             # <<<<<<<<<<<<<<
 *                     k += 1
 *                 c_child = c_child.prev
*/
      }

      /* "lxml/etree.pyx":1414
 *                 if _isElement(c_child):
 *                     k += 1
 *                 c_child = c_child.prev             # <<<<<<<<<<<<<<
 *             if k < c_stop:
 *                 return k
*/
      __pyx_t_2 = __pyx_v_c_child->prev;
      __pyx_v_c_child = __pyx_t_2;
    }

    /* "lxml/etree.pyx":1415
 *                     k += 1
 *                 c_child = c_child.prev
 *             if k < c_stop:             # <<<<<<<<<<<<<<
 *                 return k
 *         else:
*/
    __pyx_t_3 = (__pyx_v_k < __pyx_v_c_stop);
    if (__pyx_t_3) {

      /* "lxml/etree.pyx":1416
 *                 c_child = c_child.prev
 *             if k < c_stop:
 *                 return k             # <<<<<<<<<<<<<<
 *         else:
 *             # traverse all
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_5 = PyLong_FromSsize_t(__pyx_v_k); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1416, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L0;

      /* "lxml/etree.pyx":1415
 *                     k += 1
 *                 c_child = c_child.prev
 *             if k < c_stop:             # <<<<<<<<<<<<<<
 *                 return k
 *         else:
*/
    }

    /* "lxml/etree.pyx":1409
 *         c_child = c_child.prev
 *         k = 0
 *         if c_stop > 0:             # <<<<<<<<<<<<<<
 *             # we can optimize: stop after c_stop elements if not found
 *             while c_child != NULL and k < c_stop:
*/
    goto __pyx_L31;
  }

  /* "lxml/etree.pyx":1419
 *         else:
 *             # traverse all
 *             while c_child != NULL:             # <<<<<<<<<<<<<<
 *                 if _isElement(c_child):
 *                     k = k + 1
*/
  /*else*/ {
    while (1) {
      __pyx_t_3 = (__pyx_v_c_child != NULL);
      if (!__pyx_t_3) break;

      /* "lxml/etree.pyx":1420
 *             # traverse all
 *             while c_child != NULL:
 *                 if _isElement(c_child):             # <<<<<<<<<<<<<<
 *                     k = k + 1
 *                 c_child = c_child.prev
*/
      __pyx_t_3 = _isElement(__pyx_v_c_child);
      if (__pyx_t_3) {

        /* "lxml/etree.pyx":1421
 *             while c_child != NULL:
 *                 if _isElement(c_child):
 *                     k = k + 1             # <<<<<<<<<<<<<<
 *                 c_child = c_child.prev
 *             if c_start > 0:
*/
        __pyx_v_k = (__pyx_v_k + 1);

        /* "lxml/etree.pyx":1420
 *             # traverse all
 *             while c_child != NULL:
 *                 if _isElement(c_child):             # <<<<<<<<<<<<<<
 *                     k = k + 1
 *                 c_child = c_child.prev
*/
      }

      /* "lxml/etree.pyx":1422
 *                 if _isElement(c_child):
 *                     k = k + 1
 *                 c_child = c_child.prev             # <<<<<<<<<<<<<<
 *             if c_start > 0:
 *                 if k >= c_start:
*/
      __pyx_t_2 = __pyx_v_c_child->prev;
      __pyx_v_c_child = __pyx_t_2;
    }

    /* "lxml/etree.pyx":1423
 *                     k = k + 1
 *                 c_child = c_child.prev
 *             if c_start > 0:             # <<<<<<<<<<<<<<
 *                 if k >= c_start:
 *                     return k
*/
    __pyx_t_3 = (__pyx_v_c_start > 0);
    if (__pyx_t_3) {

      /* "lxml/etree.pyx":1424
 *                 c_child = c_child.prev
 *             if c_start > 0:
 *                 if k >= c_start:             # <<<<<<<<<<<<<<
 *                     return k
 *             else:
*/
      __pyx_t_3 = (__pyx_v_k >= __pyx_v_c_start);
      if (__pyx_t_3) {

        /* "lxml/etree.pyx":1425
 *             if c_start > 0:
 *                 if k >= c_start:
 *                     return k             # <<<<<<<<<<<<<<
 *             else:
 *                 return k
*/
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_5 = PyLong_FromSsize_t(__pyx_v_k); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1425, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_r = __pyx_t_5;
        __pyx_t_5 = 0;
        goto __pyx_L0;

        /* "lxml/etree.pyx":1424
 *                 c_child = c_child.prev
 *             if c_start > 0:
 *                 if k >= c_start:             # <<<<<<<<<<<<<<
 *                     return k
 *             else:
*/
      }

      /* "lxml/etree.pyx":1423
 *                     k = k + 1
 *                 c_child = c_child.prev
 *             if c_start > 0:             # <<<<<<<<<<<<<<
 *                 if k >= c_start:
 *                     return k
*/
      goto __pyx_L41;
    }

    /* "lxml/etree.pyx":1427
 *                     return k
 *             else:
 *                 return k             # <<<<<<<<<<<<<<
 *         if c_start != 0 or c_stop != 0:
 *             raise ValueError, "list.index(x): x not in slice"
*/
    /*else*/ {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_5 = PyLong_FromSsize_t(__pyx_v_k); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1427, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L0;
    }
    __pyx_L41:;
  }
  __pyx_L31:;

  /* "lxml/etree.pyx":1428
 *             else:
 *                 return k
 *         if c_start != 0 or c_stop != 0:             # <<<<<<<<<<<<<<
 *             raise ValueError, "list.index(x): x not in slice"
 *         else:
*/
  __pyx_t_4 = (__pyx_v_c_start != 0);
  if (!__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L44_bool_binop_done;
  }
  __pyx_t_4 = (__pyx_v_c_stop != 0);
  __pyx_t_3 = __pyx_t_4;
  __pyx_L44_bool_binop_done:;
  if (unlikely(__pyx_t_3)) {

    /* "lxml/etree.pyx":1429
 *                 return k
 *         if c_start != 0 or c_stop != 0:
 *             raise ValueError, "list.index(x): x not in slice"             # <<<<<<<<<<<<<<
 *         else:
 *             raise ValueError, "list.index(x): x not in list"
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_list_index_x_x_not_in_slice, 0, 0);
    __PYX_ERR(0, 1429, __pyx_L1_error)

    /* "lxml/etree.pyx":1428
 *             else:
 *                 return k
 *         if c_start != 0 or c_stop != 0:             # <<<<<<<<<<<<<<
 *             raise ValueError, "list.index(x): x not in slice"
 *         else:
*/
  }

  /* "lxml/etree.pyx":1431
 *             raise ValueError, "list.index(x): x not in slice"
 *         else:
 *             raise ValueError, "list.index(x): x not in list"             # <<<<<<<<<<<<<<
 * 
 *     def get(self, key, default=None):
*/
  /*else*/ {
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_list_index_x_x_not_in_list, 0, 0);
    __PYX_ERR(0, 1431, __pyx_L1_error)
  }

  /* "lxml/etree.pyx":1346
 *         return ElementChildIterator(self, reversed=True)
 * 
 *     def index(self, child: _Element, start: int = None, stop: int = None):             # <<<<<<<<<<<<<<
 *         """index(self, child, start=None, stop=None)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._Element.index", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1433
 *             raise ValueError, "list.index(x): x not in list"
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         """get(self, key, default=None)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_47get(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_46get, "get(self, key, default=None)\n\n        Gets an element attribute.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_47get = {"get", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_47get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_46get};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_47get(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_default = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_key,&__pyx_mstate_global->__pyx_n_u_default,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1433, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1433, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1433, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "get", 0) < (0)) __PYX_ERR(0, 1433, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, i); __PYX_ERR(0, 1433, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1433, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1433, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_key = values[0];
    __pyx_v_default = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 1433, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._Element.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_46get(((struct LxmlElement *)__pyx_v_self), __pyx_v_key, __pyx_v_default);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8_Element_46get(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get", 0);

  /* "lxml/etree.pyx":1438
 *         Gets an element attribute.
 *         """
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         return _getAttributeValue(self, key, default)
 * 
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1438, __pyx_L1_error)

  /* "lxml/etree.pyx":1439
 *         """
 *         _assertValidNode(self)
 *         return _getAttributeValue(self, key, default)             # <<<<<<<<<<<<<<
 * 
 *     def keys(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree__getAttributeValue(__pyx_v_self, __pyx_v_key, __pyx_v_default); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1439, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1433
 *             raise ValueError, "list.index(x): x not in list"
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         """get(self, key, default=None)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Element.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1441
 *         return _getAttributeValue(self, key, default)
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """keys(self)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_49keys(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_48keys, "keys(self)\n\n        Gets a list of attribute names.  The names are returned in an\n        arbitrary order (just like for an ordinary Python dictionary).\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_49keys = {"keys", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_49keys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_48keys};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_49keys(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("keys (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("keys", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("keys", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_48keys(((struct LxmlElement *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8_Element_48keys(struct LxmlElement *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("keys", 0);

  /* "lxml/etree.pyx":1447
 *         arbitrary order (just like for an ordinary Python dictionary).
 *         """
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         return _collectAttributes(self._c_node, 1)
 * 
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1447, __pyx_L1_error)

  /* "lxml/etree.pyx":1448
 *         """
 *         _assertValidNode(self)
 *         return _collectAttributes(self._c_node, 1)             # <<<<<<<<<<<<<<
 * 
 *     def values(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree__collectAttributes(__pyx_v_self->_c_node, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1448, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1441
 *         return _getAttributeValue(self, key, default)
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """keys(self)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Element.keys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1450
 *         return _collectAttributes(self._c_node, 1)
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         """values(self)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_51values(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_50values, "values(self)\n\n        Gets element attribute values as a sequence of strings.  The\n        attributes are returned in an arbitrary order.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_51values = {"values", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_51values, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_50values};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_51values(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("values (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("values", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("values", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_50values(((struct LxmlElement *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8_Element_50values(struct LxmlElement *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("values", 0);

  /* "lxml/etree.pyx":1456
 *         attributes are returned in an arbitrary order.
 *         """
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         return _collectAttributes(self._c_node, 2)
 * 
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1456, __pyx_L1_error)

  /* "lxml/etree.pyx":1457
 *         """
 *         _assertValidNode(self)
 *         return _collectAttributes(self._c_node, 2)             # <<<<<<<<<<<<<<
 * 
 *     def items(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree__collectAttributes(__pyx_v_self->_c_node, 2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1457, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1450
 *         return _collectAttributes(self._c_node, 1)
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         """values(self)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Element.values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1459
 *         return _collectAttributes(self._c_node, 2)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """items(self)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_53items(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_52items, "items(self)\n\n        Gets element attributes, as a sequence. The attributes are returned in\n        an arbitrary order.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_53items = {"items", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_53items, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_52items};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_53items(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("items", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("items", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_52items(((struct LxmlElement *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8_Element_52items(struct LxmlElement *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("items", 0);

  /* "lxml/etree.pyx":1465
 *         an arbitrary order.
 *         """
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         return _collectAttributes(self._c_node, 3)
 * 
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1465, __pyx_L1_error)

  /* "lxml/etree.pyx":1466
 *         """
 *         _assertValidNode(self)
 *         return _collectAttributes(self._c_node, 3)             # <<<<<<<<<<<<<<
 * 
 *     def getchildren(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree__collectAttributes(__pyx_v_self->_c_node, 3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1466, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1459
 *         return _collectAttributes(self._c_node, 2)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """items(self)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Element.items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1468
 *         return _collectAttributes(self._c_node, 3)
 * 
 *     def getchildren(self):             # <<<<<<<<<<<<<<
 *         """getchildren(self)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_55getchildren(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_54getchildren, "getchildren(self)\n\n        Returns all direct children.  The elements are returned in document\n        order.\n\n        :deprecated: Note that this method has been deprecated as of\n          ElementTree 1.3 and lxml 2.0.  New code should use\n          ``list(element)`` or simply iterate over elements.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_55getchildren = {"getchildren", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_55getchildren, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_54getchildren};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_55getchildren(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getchildren (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("getchildren", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("getchildren", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_54getchildren(((struct LxmlElement *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8_Element_54getchildren(struct LxmlElement *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getchildren", 0);

  /* "lxml/etree.pyx":1478
 *           ``list(element)`` or simply iterate over elements.
 *         """
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         return _collectChildren(self)
 * 
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1478, __pyx_L1_error)

  /* "lxml/etree.pyx":1479
 *         """
 *         _assertValidNode(self)
 *         return _collectChildren(self)             # <<<<<<<<<<<<<<
 * 
 *     def getparent(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree__collectChildren(__pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1479, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1468
 *         return _collectAttributes(self._c_node, 3)
 * 
 *     def getchildren(self):             # <<<<<<<<<<<<<<
 *         """getchildren(self)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Element.getchildren", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1481
 *         return _collectChildren(self)
 * 
 *     def getparent(self):             # <<<<<<<<<<<<<<
 *         """getparent(self)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_57getparent(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_56getparent, "getparent(self)\n\n        Returns the parent of this element or None for the root element.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_57getparent = {"getparent", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_57getparent, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_56getparent};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_57getparent(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getparent (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("getparent", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("getparent", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_56getparent(((struct LxmlElement *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8_Element_56getparent(struct LxmlElement *__pyx_v_self) {
  xmlNode *__pyx_v_c_node;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getparent", 0);

  /* "lxml/etree.pyx":1488
 *         cdef xmlNode* c_node
 *         #_assertValidNode(self) # not needed
 *         c_node = _parentElement(self._c_node)             # <<<<<<<<<<<<<<
 *         if c_node is NULL:
 *             return None
*/
  __pyx_v_c_node = __pyx_f_4lxml_5etree__parentElement(__pyx_v_self->_c_node);

  /* "lxml/etree.pyx":1489
 *         #_assertValidNode(self) # not needed
 *         c_node = _parentElement(self._c_node)
 *         if c_node is NULL:             # <<<<<<<<<<<<<<
 *             return None
 *         return _elementFactory(self._doc, c_node)
*/
  __pyx_t_1 = (__pyx_v_c_node == NULL);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":1490
 *         c_node = _parentElement(self._c_node)
 *         if c_node is NULL:
 *             return None             # <<<<<<<<<<<<<<
 *         return _elementFactory(self._doc, c_node)
 * 
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "lxml/etree.pyx":1489
 *         #_assertValidNode(self) # not needed
 *         c_node = _parentElement(self._c_node)
 *         if c_node is NULL:             # <<<<<<<<<<<<<<
 *             return None
 *         return _elementFactory(self._doc, c_node)
*/
  }

  /* "lxml/etree.pyx":1491
 *         if c_node is NULL:
 *             return None
 *         return _elementFactory(self._doc, c_node)             # <<<<<<<<<<<<<<
 * 
 *     def getnext(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_v_self->_doc);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_2), __pyx_v_c_node)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1491, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1481
 *         return _collectChildren(self)
 * 
 *     def getparent(self):             # <<<<<<<<<<<<<<
 *         """getparent(self)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Element.getparent", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1493
 *         return _elementFactory(self._doc, c_node)
 * 
 *     def getnext(self):             # <<<<<<<<<<<<<<
 *         """getnext(self)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_59getnext(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_58getnext, "getnext(self)\n\n        Returns the following sibling of this element or None.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_59getnext = {"getnext", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_59getnext, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_58getnext};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_59getnext(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getnext (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("getnext", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("getnext", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_58getnext(((struct LxmlElement *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8_Element_58getnext(struct LxmlElement *__pyx_v_self) {
  xmlNode *__pyx_v_c_node;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getnext", 0);

  /* "lxml/etree.pyx":1500
 *         cdef xmlNode* c_node
 *         #_assertValidNode(self) # not needed
 *         c_node = _nextElement(self._c_node)             # <<<<<<<<<<<<<<
 *         if c_node is NULL:
 *             return None
*/
  __pyx_v_c_node = __pyx_f_4lxml_5etree__nextElement(__pyx_v_self->_c_node);

  /* "lxml/etree.pyx":1501
 *         #_assertValidNode(self) # not needed
 *         c_node = _nextElement(self._c_node)
 *         if c_node is NULL:             # <<<<<<<<<<<<<<
 *             return None
 *         return _elementFactory(self._doc, c_node)
*/
  __pyx_t_1 = (__pyx_v_c_node == NULL);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":1502
 *         c_node = _nextElement(self._c_node)
 *         if c_node is NULL:
 *             return None             # <<<<<<<<<<<<<<
 *         return _elementFactory(self._doc, c_node)
 * 
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "lxml/etree.pyx":1501
 *         #_assertValidNode(self) # not needed
 *         c_node = _nextElement(self._c_node)
 *         if c_node is NULL:             # <<<<<<<<<<<<<<
 *             return None
 *         return _elementFactory(self._doc, c_node)
*/
  }

  /* "lxml/etree.pyx":1503
 *         if c_node is NULL:
 *             return None
 *         return _elementFactory(self._doc, c_node)             # <<<<<<<<<<<<<<
 * 
 *     def getprevious(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_v_self->_doc);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_2), __pyx_v_c_node)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1503, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1493
 *         return _elementFactory(self._doc, c_node)
 * 
 *     def getnext(self):             # <<<<<<<<<<<<<<
 *         """getnext(self)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Element.getnext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1505
 *         return _elementFactory(self._doc, c_node)
 * 
 *     def getprevious(self):             # <<<<<<<<<<<<<<
 *         """getprevious(self)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_61getprevious(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_60getprevious, "getprevious(self)\n\n        Returns the preceding sibling of this element or None.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_61getprevious = {"getprevious", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_61getprevious, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_60getprevious};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_61getprevious(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getprevious (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("getprevious", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("getprevious", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_60getprevious(((struct LxmlElement *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8_Element_60getprevious(struct LxmlElement *__pyx_v_self) {
  xmlNode *__pyx_v_c_node;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getprevious", 0);

  /* "lxml/etree.pyx":1512
 *         cdef xmlNode* c_node
 *         #_assertValidNode(self) # not needed
 *         c_node = _previousElement(self._c_node)             # <<<<<<<<<<<<<<
 *         if c_node is NULL:
 *             return None
*/
  __pyx_v_c_node = __pyx_f_4lxml_5etree__previousElement(__pyx_v_self->_c_node);

  /* "lxml/etree.pyx":1513
 *         #_assertValidNode(self) # not needed
 *         c_node = _previousElement(self._c_node)
 *         if c_node is NULL:             # <<<<<<<<<<<<<<
 *             return None
 *         return _elementFactory(self._doc, c_node)
*/
  __pyx_t_1 = (__pyx_v_c_node == NULL);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":1514
 *         c_node = _previousElement(self._c_node)
 *         if c_node is NULL:
 *             return None             # <<<<<<<<<<<<<<
 *         return _elementFactory(self._doc, c_node)
 * 
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "lxml/etree.pyx":1513
 *         #_assertValidNode(self) # not needed
 *         c_node = _previousElement(self._c_node)
 *         if c_node is NULL:             # <<<<<<<<<<<<<<
 *             return None
 *         return _elementFactory(self._doc, c_node)
*/
  }

  /* "lxml/etree.pyx":1515
 *         if c_node is NULL:
 *             return None
 *         return _elementFactory(self._doc, c_node)             # <<<<<<<<<<<<<<
 * 
 *     def itersiblings(self, tag=None, *tags, preceding=False):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_v_self->_doc);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_2), __pyx_v_c_node)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1515, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1505
 *         return _elementFactory(self._doc, c_node)
 * 
 *     def getprevious(self):             # <<<<<<<<<<<<<<
 *         """getprevious(self)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Element.getprevious", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1517
 *         return _elementFactory(self._doc, c_node)
 * 
 *     def itersiblings(self, tag=None, *tags, preceding=False):             # <<<<<<<<<<<<<<
 *         """itersiblings(self, tag=None, *tags, preceding=False)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_63itersiblings(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_62itersiblings, "itersiblings(self, tag=None, *tags, preceding=False)\n\n        Iterate over the following or preceding siblings of this element.\n\n        The direction is determined by the 'preceding' keyword which\n        defaults to False, i.e. forward iteration over the following\n        siblings.  When True, the iterator yields the preceding\n        siblings in reverse document order, i.e. starting right before\n        the current element and going backwards.\n\n        Can be restricted to find only elements with specific tags,\n        see `iter`.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_63itersiblings = {"itersiblings", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_63itersiblings, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_62itersiblings};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_63itersiblings(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_v_preceding = 0;
  PyObject *__pyx_v_tags = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("itersiblings (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  __pyx_v_tags = __Pyx_ArgsSlice_FASTCALL(__pyx_args, 1, __pyx_nargs);
  if (unlikely(!__pyx_v_tags)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_v_tags);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_tag,&__pyx_mstate_global->__pyx_n_u_preceding,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1517, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        default:
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1517, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      const Py_ssize_t used_pos_args = (kwd_pos_args < 1) ? kwd_pos_args : 1;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, used_pos_args, __pyx_kwds_len, "itersiblings", 0) < (0)) __PYX_ERR(0, 1517, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_False));
    } else {
      switch (__pyx_nargs) {
        default:
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1517, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_False));
    }
    __pyx_v_tag = values[0];
    __pyx_v_preceding = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v_tags); __pyx_v_tags = 0;
  __Pyx_AddTraceback("lxml.etree._Element.itersiblings", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_62itersiblings(((struct LxmlElement *)__pyx_v_self), __pyx_v_tag, __pyx_v_preceding, __pyx_v_tags);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v_tags);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8_Element_62itersiblings(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_preceding, PyObject *__pyx_v_tags) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("itersiblings", 0);
  __Pyx_INCREF(__pyx_v_tags);

  /* "lxml/etree.pyx":1531
 *         see `iter`.
 *         """
 *         if preceding:             # <<<<<<<<<<<<<<
 *             if self._c_node and not self._c_node.prev:
 *                 return ITER_EMPTY
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_preceding); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1531, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":1532
 *         """
 *         if preceding:
 *             if self._c_node and not self._c_node.prev:             # <<<<<<<<<<<<<<
 *                 return ITER_EMPTY
 *         elif self._c_node and not self._c_node.next:
*/
    __pyx_t_2 = (__pyx_v_self->_c_node != 0);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_2 = (!(__pyx_v_self->_c_node->prev != 0));
    __pyx_t_1 = __pyx_t_2;
    __pyx_L5_bool_binop_done:;
    if (__pyx_t_1) {

      /* "lxml/etree.pyx":1533
 *         if preceding:
 *             if self._c_node and not self._c_node.prev:
 *                 return ITER_EMPTY             # <<<<<<<<<<<<<<
 *         elif self._c_node and not self._c_node.next:
 *             return ITER_EMPTY
*/
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_4lxml_5etree_ITER_EMPTY);
      __pyx_r = __pyx_v_4lxml_5etree_ITER_EMPTY;
      goto __pyx_L0;

      /* "lxml/etree.pyx":1532
 *         """
 *         if preceding:
 *             if self._c_node and not self._c_node.prev:             # <<<<<<<<<<<<<<
 *                 return ITER_EMPTY
 *         elif self._c_node and not self._c_node.next:
*/
    }

    /* "lxml/etree.pyx":1531
 *         see `iter`.
 *         """
 *         if preceding:             # <<<<<<<<<<<<<<
 *             if self._c_node and not self._c_node.prev:
 *                 return ITER_EMPTY
*/
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":1534
 *             if self._c_node and not self._c_node.prev:
 *                 return ITER_EMPTY
 *         elif self._c_node and not self._c_node.next:             # <<<<<<<<<<<<<<
 *             return ITER_EMPTY
 *         if tag is not None:
*/
  __pyx_t_2 = (__pyx_v_self->_c_node != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L7_bool_binop_done;
  }
  __pyx_t_2 = (!(__pyx_v_self->_c_node->next != 0));
  __pyx_t_1 = __pyx_t_2;
  __pyx_L7_bool_binop_done:;
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":1535
 *                 return ITER_EMPTY
 *         elif self._c_node and not self._c_node.next:
 *             return ITER_EMPTY             # <<<<<<<<<<<<<<
 *         if tag is not None:
 *             tags += (tag,)
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_4lxml_5etree_ITER_EMPTY);
    __pyx_r = __pyx_v_4lxml_5etree_ITER_EMPTY;
    goto __pyx_L0;

    /* "lxml/etree.pyx":1534
 *             if self._c_node and not self._c_node.prev:
 *                 return ITER_EMPTY
 *         elif self._c_node and not self._c_node.next:             # <<<<<<<<<<<<<<
 *             return ITER_EMPTY
 *         if tag is not None:
*/
  }
  __pyx_L3:;

  /* "lxml/etree.pyx":1536
 *         elif self._c_node and not self._c_node.next:
 *             return ITER_EMPTY
 *         if tag is not None:             # <<<<<<<<<<<<<<
 *             tags += (tag,)
 *         return SiblingsIterator(self, tags, preceding=preceding)
*/
  __pyx_t_1 = (__pyx_v_tag != Py_None);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":1537
 *             return ITER_EMPTY
 *         if tag is not None:
 *             tags += (tag,)             # <<<<<<<<<<<<<<
 *         return SiblingsIterator(self, tags, preceding=preceding)
 * 
*/
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1537, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_tag);
    __Pyx_GIVEREF(__pyx_v_tag);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_tag) != (0)) __PYX_ERR(0, 1537, __pyx_L1_error);
    __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_tags, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1537, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_tags, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "lxml/etree.pyx":1536
 *         elif self._c_node and not self._c_node.next:
 *             return ITER_EMPTY
 *         if tag is not None:             # <<<<<<<<<<<<<<
 *             tags += (tag,)
 *         return SiblingsIterator(self, tags, preceding=preceding)
*/
  }

  /* "lxml/etree.pyx":1538
 *         if tag is not None:
 *             tags += (tag,)
 *         return SiblingsIterator(self, tags, preceding=preceding)             # <<<<<<<<<<<<<<
 * 
 *     def iterancestors(self, tag=None, *tags):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = NULL;
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[3 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_3, ((PyObject *)__pyx_v_self), __pyx_v_tags};
    __pyx_t_6 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1538, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_preceding, __pyx_v_preceding, __pyx_t_6, __pyx_callargs+3, 0) < (0)) __PYX_ERR(0, 1538, __pyx_L1_error)
    __pyx_t_4 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_SiblingsIterator, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1538, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_4);
  }
  __pyx_r = ((PyObject *)__pyx_t_4);
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1517
 *         return _elementFactory(self._doc, c_node)
 * 
 *     def itersiblings(self, tag=None, *tags, preceding=False):             # <<<<<<<<<<<<<<
 *         """itersiblings(self, tag=None, *tags, preceding=False)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._Element.itersiblings", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tags);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1540
 *         return SiblingsIterator(self, tags, preceding=preceding)
 * 
 *     def iterancestors(self, tag=None, *tags):             # <<<<<<<<<<<<<<
 *         """iterancestors(self, tag=None, *tags)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_65iterancestors(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_64iterancestors, "iterancestors(self, tag=None, *tags)\n\n        Iterate over the ancestors of this element (from parent to parent).\n\n        Can be restricted to find only elements with specific tags,\n        see `iter`.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_65iterancestors = {"iterancestors", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_65iterancestors, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_64iterancestors};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_65iterancestors(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_v_tags = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iterancestors (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  __pyx_v_tags = __Pyx_ArgsSlice_FASTCALL(__pyx_args, 1, __pyx_nargs);
  if (unlikely(!__pyx_v_tags)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_v_tags);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_tag,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1540, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        default:
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1540, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      const Py_ssize_t used_pos_args = (kwd_pos_args < 1) ? kwd_pos_args : 1;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, used_pos_args, __pyx_kwds_len, "iterancestors", 0) < (0)) __PYX_ERR(0, 1540, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
    } else {
      switch (__pyx_nargs) {
        default:
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1540, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_tag = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v_tags); __pyx_v_tags = 0;
  __Pyx_AddTraceback("lxml.etree._Element.iterancestors", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_64iterancestors(((struct LxmlElement *)__pyx_v_self), __pyx_v_tag, __pyx_v_tags);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v_tags);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8_Element_64iterancestors(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_tags) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("iterancestors", 0);
  __Pyx_INCREF(__pyx_v_tags);

  /* "lxml/etree.pyx":1548
 *         see `iter`.
 *         """
 *         if self._c_node and not self._c_node.parent:             # <<<<<<<<<<<<<<
 *             return ITER_EMPTY
 *         if tag is not None:
*/
  __pyx_t_2 = (__pyx_v_self->_c_node != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (!(__pyx_v_self->_c_node->parent != 0));
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":1549
 *         """
 *         if self._c_node and not self._c_node.parent:
 *             return ITER_EMPTY             # <<<<<<<<<<<<<<
 *         if tag is not None:
 *             tags += (tag,)
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_4lxml_5etree_ITER_EMPTY);
    __pyx_r = __pyx_v_4lxml_5etree_ITER_EMPTY;
    goto __pyx_L0;

    /* "lxml/etree.pyx":1548
 *         see `iter`.
 *         """
 *         if self._c_node and not self._c_node.parent:             # <<<<<<<<<<<<<<
 *             return ITER_EMPTY
 *         if tag is not None:
*/
  }

  /* "lxml/etree.pyx":1550
 *         if self._c_node and not self._c_node.parent:
 *             return ITER_EMPTY
 *         if tag is not None:             # <<<<<<<<<<<<<<
 *             tags += (tag,)
 *         return AncestorsIterator(self, tags)
*/
  __pyx_t_1 = (__pyx_v_tag != Py_None);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":1551
 *             return ITER_EMPTY
 *         if tag is not None:
 *             tags += (tag,)             # <<<<<<<<<<<<<<
 *         return AncestorsIterator(self, tags)
 * 
*/
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1551, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_tag);
    __Pyx_GIVEREF(__pyx_v_tag);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_tag) != (0)) __PYX_ERR(0, 1551, __pyx_L1_error);
    __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_tags, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1551, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_tags, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "lxml/etree.pyx":1550
 *         if self._c_node and not self._c_node.parent:
 *             return ITER_EMPTY
 *         if tag is not None:             # <<<<<<<<<<<<<<
 *             tags += (tag,)
 *         return AncestorsIterator(self, tags)
*/
  }

  /* "lxml/etree.pyx":1552
 *         if tag is not None:
 *             tags += (tag,)
 *         return AncestorsIterator(self, tags)             # <<<<<<<<<<<<<<
 * 
 *     def iterdescendants(self, tag=None, *tags):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = NULL;
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_3, ((PyObject *)__pyx_v_self), __pyx_v_tags};
    __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_AncestorsIterator, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1552, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_4);
  }
  __pyx_r = ((PyObject *)__pyx_t_4);
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1540
 *         return SiblingsIterator(self, tags, preceding=preceding)
 * 
 *     def iterancestors(self, tag=None, *tags):             # <<<<<<<<<<<<<<
 *         """iterancestors(self, tag=None, *tags)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._Element.iterancestors", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tags);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1554
 *         return AncestorsIterator(self, tags)
 * 
 *     def iterdescendants(self, tag=None, *tags):             # <<<<<<<<<<<<<<
 *         """iterdescendants(self, tag=None, *tags)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_67iterdescendants(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_66iterdescendants, "iterdescendants(self, tag=None, *tags)\n\n        Iterate over the descendants of this element in document order.\n\n        As opposed to ``el.iter()``, this iterator does not yield the element\n        itself.  The returned elements can be restricted to find only elements\n        with specific tags, see `iter`.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_67iterdescendants = {"iterdescendants", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_67iterdescendants, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_66iterdescendants};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_67iterdescendants(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_v_tags = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iterdescendants (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  __pyx_v_tags = __Pyx_ArgsSlice_FASTCALL(__pyx_args, 1, __pyx_nargs);
  if (unlikely(!__pyx_v_tags)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_v_tags);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_tag,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1554, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        default:
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1554, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      const Py_ssize_t used_pos_args = (kwd_pos_args < 1) ? kwd_pos_args : 1;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, used_pos_args, __pyx_kwds_len, "iterdescendants", 0) < (0)) __PYX_ERR(0, 1554, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
    } else {
      switch (__pyx_nargs) {
        default:
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1554, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_tag = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v_tags); __pyx_v_tags = 0;
  __Pyx_AddTraceback("lxml.etree._Element.iterdescendants", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_66iterdescendants(((struct LxmlElement *)__pyx_v_self), __pyx_v_tag, __pyx_v_tags);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v_tags);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8_Element_66iterdescendants(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_tags) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("iterdescendants", 0);
  __Pyx_INCREF(__pyx_v_tags);

  /* "lxml/etree.pyx":1563
 *         with specific tags, see `iter`.
 *         """
 *         if self._c_node and not self._c_node.children:             # <<<<<<<<<<<<<<
 *             return ITER_EMPTY
 *         if tag is not None:
*/
  __pyx_t_2 = (__pyx_v_self->_c_node != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (!(__pyx_v_self->_c_node->children != 0));
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":1564
 *         """
 *         if self._c_node and not self._c_node.children:
 *             return ITER_EMPTY             # <<<<<<<<<<<<<<
 *         if tag is not None:
 *             tags += (tag,)
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_4lxml_5etree_ITER_EMPTY);
    __pyx_r = __pyx_v_4lxml_5etree_ITER_EMPTY;
    goto __pyx_L0;

    /* "lxml/etree.pyx":1563
 *         with specific tags, see `iter`.
 *         """
 *         if self._c_node and not self._c_node.children:             # <<<<<<<<<<<<<<
 *             return ITER_EMPTY
 *         if tag is not None:
*/
  }

  /* "lxml/etree.pyx":1565
 *         if self._c_node and not self._c_node.children:
 *             return ITER_EMPTY
 *         if tag is not None:             # <<<<<<<<<<<<<<
 *             tags += (tag,)
 *         return ElementDepthFirstIterator(self, tags, inclusive=False)
*/
  __pyx_t_1 = (__pyx_v_tag != Py_None);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":1566
 *             return ITER_EMPTY
 *         if tag is not None:
 *             tags += (tag,)             # <<<<<<<<<<<<<<
 *         return ElementDepthFirstIterator(self, tags, inclusive=False)
 * 
*/
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1566, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_tag);
    __Pyx_GIVEREF(__pyx_v_tag);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_tag) != (0)) __PYX_ERR(0, 1566, __pyx_L1_error);
    __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_tags, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1566, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_tags, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "lxml/etree.pyx":1565
 *         if self._c_node and not self._c_node.children:
 *             return ITER_EMPTY
 *         if tag is not None:             # <<<<<<<<<<<<<<
 *             tags += (tag,)
 *         return ElementDepthFirstIterator(self, tags, inclusive=False)
*/
  }

  /* "lxml/etree.pyx":1567
 *         if tag is not None:
 *             tags += (tag,)
 *         return ElementDepthFirstIterator(self, tags, inclusive=False)             # <<<<<<<<<<<<<<
 * 
 *     def iterchildren(self, tag=None, *tags, reversed=False):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = NULL;
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[3 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_3, ((PyObject *)__pyx_v_self), __pyx_v_tags};
    __pyx_t_6 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1567, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_inclusive, Py_False, __pyx_t_6, __pyx_callargs+3, 0) < (0)) __PYX_ERR(0, 1567, __pyx_L1_error)
    __pyx_t_4 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_ElementDepthFirstIterator, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1567, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_4);
  }
  __pyx_r = ((PyObject *)__pyx_t_4);
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1554
 *         return AncestorsIterator(self, tags)
 * 
 *     def iterdescendants(self, tag=None, *tags):             # <<<<<<<<<<<<<<
 *         """iterdescendants(self, tag=None, *tags)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._Element.iterdescendants", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tags);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1569
 *         return ElementDepthFirstIterator(self, tags, inclusive=False)
 * 
 *     def iterchildren(self, tag=None, *tags, reversed=False):             # <<<<<<<<<<<<<<
 *         """iterchildren(self, tag=None, *tags, reversed=False)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_69iterchildren(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_68iterchildren, "iterchildren(self, tag=None, *tags, reversed=False)\n\n        Iterate over the children of this element.\n\n        As opposed to using normal iteration on this element, the returned\n        elements can be reversed with the 'reversed' keyword and restricted\n        to find only elements with specific tags, see `iter`.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_69iterchildren = {"iterchildren", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_69iterchildren, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_68iterchildren};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_69iterchildren(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_v_reversed = 0;
  PyObject *__pyx_v_tags = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iterchildren (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  __pyx_v_tags = __Pyx_ArgsSlice_FASTCALL(__pyx_args, 1, __pyx_nargs);
  if (unlikely(!__pyx_v_tags)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_v_tags);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_tag,&__pyx_mstate_global->__pyx_n_u_reversed,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1569, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        default:
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1569, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      const Py_ssize_t used_pos_args = (kwd_pos_args < 1) ? kwd_pos_args : 1;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, used_pos_args, __pyx_kwds_len, "iterchildren", 0) < (0)) __PYX_ERR(0, 1569, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_False));
    } else {
      switch (__pyx_nargs) {
        default:
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1569, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_False));
    }
    __pyx_v_tag = values[0];
    __pyx_v_reversed = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v_tags); __pyx_v_tags = 0;
  __Pyx_AddTraceback("lxml.etree._Element.iterchildren", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_68iterchildren(((struct LxmlElement *)__pyx_v_self), __pyx_v_tag, __pyx_v_reversed, __pyx_v_tags);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v_tags);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8_Element_68iterchildren(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_reversed, PyObject *__pyx_v_tags) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("iterchildren", 0);
  __Pyx_INCREF(__pyx_v_tags);

  /* "lxml/etree.pyx":1578
 *         to find only elements with specific tags, see `iter`.
 *         """
 *         if self._c_node and not self._c_node.children:             # <<<<<<<<<<<<<<
 *             return ITER_EMPTY
 *         if tag is not None:
*/
  __pyx_t_2 = (__pyx_v_self->_c_node != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (!(__pyx_v_self->_c_node->children != 0));
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":1579
 *         """
 *         if self._c_node and not self._c_node.children:
 *             return ITER_EMPTY             # <<<<<<<<<<<<<<
 *         if tag is not None:
 *             tags += (tag,)
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_4lxml_5etree_ITER_EMPTY);
    __pyx_r = __pyx_v_4lxml_5etree_ITER_EMPTY;
    goto __pyx_L0;

    /* "lxml/etree.pyx":1578
 *         to find only elements with specific tags, see `iter`.
 *         """
 *         if self._c_node and not self._c_node.children:             # <<<<<<<<<<<<<<
 *             return ITER_EMPTY
 *         if tag is not None:
*/
  }

  /* "lxml/etree.pyx":1580
 *         if self._c_node and not self._c_node.children:
 *             return ITER_EMPTY
 *         if tag is not None:             # <<<<<<<<<<<<<<
 *             tags += (tag,)
 *         return ElementChildIterator(self, tags, reversed=reversed)
*/
  __pyx_t_1 = (__pyx_v_tag != Py_None);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":1581
 *             return ITER_EMPTY
 *         if tag is not None:
 *             tags += (tag,)             # <<<<<<<<<<<<<<
 *         return ElementChildIterator(self, tags, reversed=reversed)
 * 
*/
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1581, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_tag);
    __Pyx_GIVEREF(__pyx_v_tag);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_tag) != (0)) __PYX_ERR(0, 1581, __pyx_L1_error);
    __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_tags, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1581, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_tags, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "lxml/etree.pyx":1580
 *         if self._c_node and not self._c_node.children:
 *             return ITER_EMPTY
 *         if tag is not None:             # <<<<<<<<<<<<<<
 *             tags += (tag,)
 *         return ElementChildIterator(self, tags, reversed=reversed)
*/
  }

  /* "lxml/etree.pyx":1582
 *         if tag is not None:
 *             tags += (tag,)
 *         return ElementChildIterator(self, tags, reversed=reversed)             # <<<<<<<<<<<<<<
 * 
 *     def getroottree(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = NULL;
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[3 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_3, ((PyObject *)__pyx_v_self), __pyx_v_tags};
    __pyx_t_6 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1582, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_reversed, __pyx_v_reversed, __pyx_t_6, __pyx_callargs+3, 0) < (0)) __PYX_ERR(0, 1582, __pyx_L1_error)
    __pyx_t_4 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_ElementChildIterator, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1582, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_4);
  }
  __pyx_r = ((PyObject *)__pyx_t_4);
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1569
 *         return ElementDepthFirstIterator(self, tags, inclusive=False)
 * 
 *     def iterchildren(self, tag=None, *tags, reversed=False):             # <<<<<<<<<<<<<<
 *         """iterchildren(self, tag=None, *tags, reversed=False)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._Element.iterchildren", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tags);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1584
 *         return ElementChildIterator(self, tags, reversed=reversed)
 * 
 *     def getroottree(self):             # <<<<<<<<<<<<<<
 *         """getroottree(self)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_71getroottree(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_70getroottree, "getroottree(self)\n\n        Return an ElementTree for the root node of the document that\n        contains this element.\n\n        This is the same as following element.getparent() up the tree until it\n        returns None (for the root element) and then build an ElementTree for\n        the last parent that was returned.");
static PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_71getroottree = {"getroottree", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_71getroottree, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_70getroottree};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_71getroottree(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getroottree (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("getroottree", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("getroottree", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_70getroottree(((struct LxmlElement *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8_Element_70getroottree(struct LxmlElement *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getroottree", 0);

  /* "lxml/etree.pyx":1593
 *         returns None (for the root element) and then build an ElementTree for
 *         the last parent that was returned."""
 *         _assertValidDoc(self._doc)             # <<<<<<<<<<<<<<
 *         return _elementTreeFactory(self._doc, None)
 * 
*/
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_doc);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidDoc(((struct LxmlDocument *)__pyx_t_1)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 1593, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":1594
 *         the last parent that was returned."""
 *         _assertValidDoc(self._doc)
 *         return _elementTreeFactory(self._doc, None)             # <<<<<<<<<<<<<<
 * 
 *     def getiterator(self, tag=None, *tags):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_doc);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__elementTreeFactory(((struct LxmlDocument *)__pyx_t_1), ((struct LxmlElement *)Py_None))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1594, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1584
 *         return ElementChildIterator(self, tags, reversed=reversed)
 * 
 *     def getroottree(self):             # <<<<<<<<<<<<<<
 *         """getroottree(self)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Element.getroottree", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1596
 *         return _elementTreeFactory(self._doc, None)
 * 
 *     def getiterator(self, tag=None, *tags):             # <<<<<<<<<<<<<<
 *         """getiterator(self, tag=None, *tags)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_73getiterator(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_72getiterator, "getiterator(self, tag=None, *tags)\n\n        Returns a sequence or iterator of all elements in the subtree in\n        document order (depth first pre-order), starting with this\n        element.\n\n        Can be restricted to find only elements with specific tags,\n        see `iter`.\n\n        :deprecated: Note that this method is deprecated as of\n          ElementTree 1.3 and lxml 2.0.  It returns an iterator in\n          lxml, which diverges from the original ElementTree\n          behaviour.  If you want an efficient iterator, use the\n          ``element.iter()`` method instead.  You should only use this\n          method in new code if you require backwards compatibility\n          with older versions of lxml or ElementTree.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_73getiterator = {"getiterator", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_73getiterator, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_72getiterator};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_73getiterator(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_v_tags = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getiterator (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  __pyx_v_tags = __Pyx_ArgsSlice_FASTCALL(__pyx_args, 1, __pyx_nargs);
  if (unlikely(!__pyx_v_tags)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_v_tags);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_tag,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1596, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        default:
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1596, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      const Py_ssize_t used_pos_args = (kwd_pos_args < 1) ? kwd_pos_args : 1;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, used_pos_args, __pyx_kwds_len, "getiterator", 0) < (0)) __PYX_ERR(0, 1596, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
    } else {
      switch (__pyx_nargs) {
        default:
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1596, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_tag = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v_tags); __pyx_v_tags = 0;
  __Pyx_AddTraceback("lxml.etree._Element.getiterator", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_72getiterator(((struct LxmlElement *)__pyx_v_self), __pyx_v_tag, __pyx_v_tags);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v_tags);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8_Element_72getiterator(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_tags) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getiterator", 0);
  __Pyx_INCREF(__pyx_v_tags);

  /* "lxml/etree.pyx":1614
 *           with older versions of lxml or ElementTree.
 *         """
 *         if tag is not None:             # <<<<<<<<<<<<<<
 *             tags += (tag,)
 *         return ElementDepthFirstIterator(self, tags)
*/
  __pyx_t_1 = (__pyx_v_tag != Py_None);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":1615
 *         """
 *         if tag is not None:
 *             tags += (tag,)             # <<<<<<<<<<<<<<
 *         return ElementDepthFirstIterator(self, tags)
 * 
*/
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1615, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_tag);
    __Pyx_GIVEREF(__pyx_v_tag);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_tag) != (0)) __PYX_ERR(0, 1615, __pyx_L1_error);
    __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_tags, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1615, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF_SET(__pyx_v_tags, ((PyObject*)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "lxml/etree.pyx":1614
 *           with older versions of lxml or ElementTree.
 *         """
 *         if tag is not None:             # <<<<<<<<<<<<<<
 *             tags += (tag,)
 *         return ElementDepthFirstIterator(self, tags)
*/
  }

  /* "lxml/etree.pyx":1616
 *         if tag is not None:
 *             tags += (tag,)
 *         return ElementDepthFirstIterator(self, tags)             # <<<<<<<<<<<<<<
 * 
 *     def iter(self, tag=None, *tags):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = NULL;
  __pyx_t_4 = 1;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_2, ((PyObject *)__pyx_v_self), __pyx_v_tags};
    __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_ElementDepthFirstIterator, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1616, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_3);
  }
  __pyx_r = ((PyObject *)__pyx_t_3);
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1596
 *         return _elementTreeFactory(self._doc, None)
 * 
 *     def getiterator(self, tag=None, *tags):             # <<<<<<<<<<<<<<
 *         """getiterator(self, tag=None, *tags)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Element.getiterator", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tags);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1618
 *         return ElementDepthFirstIterator(self, tags)
 * 
 *     def iter(self, tag=None, *tags):             # <<<<<<<<<<<<<<
 *         """iter(self, tag=None, *tags)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_75iter(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_74iter, "iter(self, tag=None, *tags)\n\n        Iterate over all elements in the subtree in document order (depth\n        first pre-order), starting with this element.\n\n        Can be restricted to find only elements with specific tags:\n        pass ``\"{ns}localname\"`` as tag. Either or both of ``ns`` and\n        ``localname`` can be ``*`` for a wildcard; ``ns`` can be empty\n        for no namespace. ``\"localname\"`` is equivalent to ``\"{}localname\"``\n        (i.e. no namespace) but ``\"*\"`` is ``\"{*}*\"`` (any or no namespace),\n        not ``\"{}*\"``.\n\n        You can also pass the Element, Comment, ProcessingInstruction and\n        Entity factory functions to look only for the specific element type.\n\n        Passing multiple tags (or a sequence of tags) instead of a single tag\n        will let the iterator return all elements matching any of these tags,\n        in document order.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_75iter = {"iter", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_75iter, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_74iter};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_75iter(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_v_tags = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iter (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  __pyx_v_tags = __Pyx_ArgsSlice_FASTCALL(__pyx_args, 1, __pyx_nargs);
  if (unlikely(!__pyx_v_tags)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_v_tags);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_tag,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1618, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        default:
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1618, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      const Py_ssize_t used_pos_args = (kwd_pos_args < 1) ? kwd_pos_args : 1;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, used_pos_args, __pyx_kwds_len, "iter", 0) < (0)) __PYX_ERR(0, 1618, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
    } else {
      switch (__pyx_nargs) {
        default:
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1618, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_tag = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v_tags); __pyx_v_tags = 0;
  __Pyx_AddTraceback("lxml.etree._Element.iter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_74iter(((struct LxmlElement *)__pyx_v_self), __pyx_v_tag, __pyx_v_tags);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v_tags);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8_Element_74iter(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_tags) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("iter", 0);
  __Pyx_INCREF(__pyx_v_tags);

  /* "lxml/etree.pyx":1638
 *         in document order.
 *         """
 *         if tag is not None:             # <<<<<<<<<<<<<<
 *             tags += (tag,)
 *         return ElementDepthFirstIterator(self, tags)
*/
  __pyx_t_1 = (__pyx_v_tag != Py_None);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":1639
 *         """
 *         if tag is not None:
 *             tags += (tag,)             # <<<<<<<<<<<<<<
 *         return ElementDepthFirstIterator(self, tags)
 * 
*/
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1639, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_tag);
    __Pyx_GIVEREF(__pyx_v_tag);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_tag) != (0)) __PYX_ERR(0, 1639, __pyx_L1_error);
    __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_tags, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1639, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF_SET(__pyx_v_tags, ((PyObject*)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "lxml/etree.pyx":1638
 *         in document order.
 *         """
 *         if tag is not None:             # <<<<<<<<<<<<<<
 *             tags += (tag,)
 *         return ElementDepthFirstIterator(self, tags)
*/
  }

  /* "lxml/etree.pyx":1640
 *         if tag is not None:
 *             tags += (tag,)
 *         return ElementDepthFirstIterator(self, tags)             # <<<<<<<<<<<<<<
 * 
 *     def itertext(self, tag=None, *tags, with_tail=True):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = NULL;
  __pyx_t_4 = 1;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_2, ((PyObject *)__pyx_v_self), __pyx_v_tags};
    __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_ElementDepthFirstIterator, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1640, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_3);
  }
  __pyx_r = ((PyObject *)__pyx_t_3);
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1618
 *         return ElementDepthFirstIterator(self, tags)
 * 
 *     def iter(self, tag=None, *tags):             # <<<<<<<<<<<<<<
 *         """iter(self, tag=None, *tags)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Element.iter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tags);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1642
 *         return ElementDepthFirstIterator(self, tags)
 * 
 *     def itertext(self, tag=None, *tags, with_tail=True):             # <<<<<<<<<<<<<<
 *         """itertext(self, tag=None, *tags, with_tail=True)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_77itertext(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_76itertext, "itertext(self, tag=None, *tags, with_tail=True)\n\n        Iterates over the text content of a subtree.\n\n        You can pass tag names to restrict text content to specific elements,\n        see `iter`.\n\n        You can set the ``with_tail`` keyword argument to ``False`` to skip\n        over tail text.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_77itertext = {"itertext", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_77itertext, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_76itertext};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_77itertext(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_v_with_tail = 0;
  PyObject *__pyx_v_tags = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("itertext (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  __pyx_v_tags = __Pyx_ArgsSlice_FASTCALL(__pyx_args, 1, __pyx_nargs);
  if (unlikely(!__pyx_v_tags)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_v_tags);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_tag,&__pyx_mstate_global->__pyx_n_u_with_tail,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1642, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        default:
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1642, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      const Py_ssize_t used_pos_args = (kwd_pos_args < 1) ? kwd_pos_args : 1;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, used_pos_args, __pyx_kwds_len, "itertext", 0) < (0)) __PYX_ERR(0, 1642, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_True));
    } else {
      switch (__pyx_nargs) {
        default:
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1642, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_True));
    }
    __pyx_v_tag = values[0];
    __pyx_v_with_tail = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v_tags); __pyx_v_tags = 0;
  __Pyx_AddTraceback("lxml.etree._Element.itertext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_76itertext(((struct LxmlElement *)__pyx_v_self), __pyx_v_tag, __pyx_v_with_tail, __pyx_v_tags);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v_tags);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8_Element_76itertext(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_with_tail, PyObject *__pyx_v_tags) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("itertext", 0);
  __Pyx_INCREF(__pyx_v_tags);

  /* "lxml/etree.pyx":1653
 *         over tail text.
 *         """
 *         if tag is not None:             # <<<<<<<<<<<<<<
 *             tags += (tag,)
 *         return ElementTextIterator(self, tags, with_tail=with_tail)
*/
  __pyx_t_1 = (__pyx_v_tag != Py_None);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":1654
 *         """
 *         if tag is not None:
 *             tags += (tag,)             # <<<<<<<<<<<<<<
 *         return ElementTextIterator(self, tags, with_tail=with_tail)
 * 
*/
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1654, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_tag);
    __Pyx_GIVEREF(__pyx_v_tag);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_tag) != (0)) __PYX_ERR(0, 1654, __pyx_L1_error);
    __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_tags, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1654, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF_SET(__pyx_v_tags, ((PyObject*)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "lxml/etree.pyx":1653
 *         over tail text.
 *         """
 *         if tag is not None:             # <<<<<<<<<<<<<<
 *             tags += (tag,)
 *         return ElementTextIterator(self, tags, with_tail=with_tail)
*/
  }

  /* "lxml/etree.pyx":1655
 *         if tag is not None:
 *             tags += (tag,)
 *         return ElementTextIterator(self, tags, with_tail=with_tail)             # <<<<<<<<<<<<<<
 * 
 *     def makeelement(self, _tag, attrib=None, nsmap=None, **_extra):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = NULL;
  __pyx_t_4 = 1;
  {
    PyObject *__pyx_callargs[3 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_2, ((PyObject *)__pyx_v_self), __pyx_v_tags};
    __pyx_t_5 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1655, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_with_tail, __pyx_v_with_tail, __pyx_t_5, __pyx_callargs+3, 0) < (0)) __PYX_ERR(0, 1655, __pyx_L1_error)
    __pyx_t_3 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_ElementTextIterator, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_5);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1655, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_3);
  }
  __pyx_r = ((PyObject *)__pyx_t_3);
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1642
 *         return ElementDepthFirstIterator(self, tags)
 * 
 *     def itertext(self, tag=None, *tags, with_tail=True):             # <<<<<<<<<<<<<<
 *         """itertext(self, tag=None, *tags, with_tail=True)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._Element.itertext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tags);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1657
 *         return ElementTextIterator(self, tags, with_tail=with_tail)
 * 
 *     def makeelement(self, _tag, attrib=None, nsmap=None, **_extra):             # <<<<<<<<<<<<<<
 *         """makeelement(self, _tag, attrib=None, nsmap=None, **_extra)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_79makeelement(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_78makeelement, "makeelement(self, _tag, attrib=None, nsmap=None, **_extra)\n\n        Creates a new element associated with the same document.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_79makeelement = {"makeelement", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_79makeelement, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_78makeelement};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_79makeelement(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v__tag = 0;
  PyObject *__pyx_v_attrib = 0;
  PyObject *__pyx_v_nsmap = 0;
  PyObject *__pyx_v__extra = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("makeelement (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  __pyx_v__extra = PyDict_New(); if (unlikely(!__pyx_v__extra)) return NULL;
  __Pyx_GOTREF(__pyx_v__extra);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_tag_2,&__pyx_mstate_global->__pyx_n_u_attrib,&__pyx_mstate_global->__pyx_n_u_nsmap,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1657, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1657, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1657, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1657, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v__extra, values, kwd_pos_args, __pyx_kwds_len, "makeelement", 1) < (0)) __PYX_ERR(0, 1657, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("makeelement", 0, 1, 3, i); __PYX_ERR(0, 1657, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1657, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1657, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1657, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v__tag = values[0];
    __pyx_v_attrib = values[1];
    __pyx_v_nsmap = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("makeelement", 0, 1, 3, __pyx_nargs); __PYX_ERR(0, 1657, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v__extra); __pyx_v__extra = 0;
  __Pyx_AddTraceback("lxml.etree._Element.makeelement", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_78makeelement(((struct LxmlElement *)__pyx_v_self), __pyx_v__tag, __pyx_v_attrib, __pyx_v_nsmap, __pyx_v__extra);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v__extra);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8_Element_78makeelement(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v__tag, PyObject *__pyx_v_attrib, PyObject *__pyx_v_nsmap, PyObject *__pyx_v__extra) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("makeelement", 0);

  /* "lxml/etree.pyx":1662
 *         Creates a new element associated with the same document.
 *         """
 *         _assertValidDoc(self._doc)             # <<<<<<<<<<<<<<
 *         return _makeElement(_tag, NULL, self._doc, None, None, None,
 *                             attrib, nsmap, _extra)
*/
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_doc);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidDoc(((struct LxmlDocument *)__pyx_t_1)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 1662, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":1663
 *         """
 *         _assertValidDoc(self._doc)
 *         return _makeElement(_tag, NULL, self._doc, None, None, None,             # <<<<<<<<<<<<<<
 *                             attrib, nsmap, _extra)
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_doc);
  __Pyx_INCREF(__pyx_t_1);

  /* "lxml/etree.pyx":1664
 *         _assertValidDoc(self._doc)
 *         return _makeElement(_tag, NULL, self._doc, None, None, None,
 *                             attrib, nsmap, _extra)             # <<<<<<<<<<<<<<
 * 
 *     def find(self, path, namespaces=None):
*/
  __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__makeElement(__pyx_v__tag, NULL, ((struct LxmlDocument *)__pyx_t_1), ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None), Py_None, Py_None, __pyx_v_attrib, __pyx_v_nsmap, __pyx_v__extra)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1663, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1657
 *         return ElementTextIterator(self, tags, with_tail=with_tail)
 * 
 *     def makeelement(self, _tag, attrib=None, nsmap=None, **_extra):             # <<<<<<<<<<<<<<
 *         """makeelement(self, _tag, attrib=None, nsmap=None, **_extra)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Element.makeelement", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1666
 *                             attrib, nsmap, _extra)
 * 
 *     def find(self, path, namespaces=None):             # <<<<<<<<<<<<<<
 *         """find(self, path, namespaces=None)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_81find(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_80find, "find(self, path, namespaces=None)\n\n        Finds the first matching subelement, by tag name or path.\n\n        The optional ``namespaces`` argument accepts a\n        prefix-to-namespace mapping that allows the usage of XPath\n        prefixes in the path expression.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_81find = {"find", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_81find, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_80find};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_81find(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_path = 0;
  PyObject *__pyx_v_namespaces = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("find (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_path,&__pyx_mstate_global->__pyx_n_u_namespaces,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1666, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1666, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1666, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "find", 0) < (0)) __PYX_ERR(0, 1666, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("find", 0, 1, 2, i); __PYX_ERR(0, 1666, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1666, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1666, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_path = values[0];
    __pyx_v_namespaces = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("find", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 1666, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._Element.find", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_80find(((struct LxmlElement *)__pyx_v_self), __pyx_v_path, __pyx_v_namespaces);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8_Element_80find(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_namespaces) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("find", 0);
  __Pyx_INCREF(__pyx_v_path);

  /* "lxml/etree.pyx":1675
 *         prefixes in the path expression.
 *         """
 *         if isinstance(path, QName):             # <<<<<<<<<<<<<<
 *             path = (<QName>path).text
 *         return _elementpath.find(self, path, namespaces, with_prefixes=not _isHtmlDocument(self))
*/
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_path, __pyx_mstate_global->__pyx_ptype_4lxml_5etree_QName); 
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":1676
 *         """
 *         if isinstance(path, QName):
 *             path = (<QName>path).text             # <<<<<<<<<<<<<<
 *         return _elementpath.find(self, path, namespaces, with_prefixes=not _isHtmlDocument(self))
 * 
*/
    __pyx_t_2 = ((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_path)->text;
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_path, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "lxml/etree.pyx":1675
 *         prefixes in the path expression.
 *         """
 *         if isinstance(path, QName):             # <<<<<<<<<<<<<<
 *             path = (<QName>path).text
 *         return _elementpath.find(self, path, namespaces, with_prefixes=not _isHtmlDocument(self))
*/
  }

  /* "lxml/etree.pyx":1677
 *         if isinstance(path, QName):
 *             path = (<QName>path).text
 *         return _elementpath.find(self, path, namespaces, with_prefixes=not _isHtmlDocument(self))             # <<<<<<<<<<<<<<
 * 
 *     def findtext(self, path, default=None, namespaces=None):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __pyx_v_4lxml_5etree__elementpath;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_1 = __pyx_f_4lxml_5etree__isHtmlDocument(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1677, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyBool_FromLong((!__pyx_t_1)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1677, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[4 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_3, ((PyObject *)__pyx_v_self), __pyx_v_path, __pyx_v_namespaces};
    __pyx_t_6 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1677, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_with_prefixes, __pyx_t_4, __pyx_t_6, __pyx_callargs+4, 0) < (0)) __PYX_ERR(0, 1677, __pyx_L1_error)
    __pyx_t_2 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_find, __pyx_callargs+__pyx_t_5, (4-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1677, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1666
 *                             attrib, nsmap, _extra)
 * 
 *     def find(self, path, namespaces=None):             # <<<<<<<<<<<<<<
 *         """find(self, path, namespaces=None)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._Element.find", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_path);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1679
 *         return _elementpath.find(self, path, namespaces, with_prefixes=not _isHtmlDocument(self))
 * 
 *     def findtext(self, path, default=None, namespaces=None):             # <<<<<<<<<<<<<<
 *         """findtext(self, path, default=None, namespaces=None)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_83findtext(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_82findtext, "findtext(self, path, default=None, namespaces=None)\n\n        Finds text for the first matching subelement, by tag name or path.\n\n        The optional ``namespaces`` argument accepts a\n        prefix-to-namespace mapping that allows the usage of XPath\n        prefixes in the path expression.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_83findtext = {"findtext", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_83findtext, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_82findtext};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_83findtext(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_path = 0;
  PyObject *__pyx_v_default = 0;
  PyObject *__pyx_v_namespaces = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("findtext (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_path,&__pyx_mstate_global->__pyx_n_u_default,&__pyx_mstate_global->__pyx_n_u_namespaces,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1679, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1679, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1679, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1679, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "findtext", 0) < (0)) __PYX_ERR(0, 1679, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("findtext", 0, 1, 3, i); __PYX_ERR(0, 1679, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1679, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1679, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1679, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_path = values[0];
    __pyx_v_default = values[1];
    __pyx_v_namespaces = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("findtext", 0, 1, 3, __pyx_nargs); __PYX_ERR(0, 1679, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._Element.findtext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_82findtext(((struct LxmlElement *)__pyx_v_self), __pyx_v_path, __pyx_v_default, __pyx_v_namespaces);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8_Element_82findtext(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_default, PyObject *__pyx_v_namespaces) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("findtext", 0);
  __Pyx_INCREF(__pyx_v_path);

  /* "lxml/etree.pyx":1688
 *         prefixes in the path expression.
 *         """
 *         if isinstance(path, QName):             # <<<<<<<<<<<<<<
 *             path = (<QName>path).text
 *         return _elementpath.findtext(self, path, default, namespaces, with_prefixes=not _isHtmlDocument(self))
*/
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_path, __pyx_mstate_global->__pyx_ptype_4lxml_5etree_QName); 
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":1689
 *         """
 *         if isinstance(path, QName):
 *             path = (<QName>path).text             # <<<<<<<<<<<<<<
 *         return _elementpath.findtext(self, path, default, namespaces, with_prefixes=not _isHtmlDocument(self))
 * 
*/
    __pyx_t_2 = ((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_path)->text;
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_path, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "lxml/etree.pyx":1688
 *         prefixes in the path expression.
 *         """
 *         if isinstance(path, QName):             # <<<<<<<<<<<<<<
 *             path = (<QName>path).text
 *         return _elementpath.findtext(self, path, default, namespaces, with_prefixes=not _isHtmlDocument(self))
*/
  }

  /* "lxml/etree.pyx":1690
 *         if isinstance(path, QName):
 *             path = (<QName>path).text
 *         return _elementpath.findtext(self, path, default, namespaces, with_prefixes=not _isHtmlDocument(self))             # <<<<<<<<<<<<<<
 * 
 *     def findall(self, path, namespaces=None):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __pyx_v_4lxml_5etree__elementpath;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_1 = __pyx_f_4lxml_5etree__isHtmlDocument(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1690, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyBool_FromLong((!__pyx_t_1)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1690, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[5 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_3, ((PyObject *)__pyx_v_self), __pyx_v_path, __pyx_v_default, __pyx_v_namespaces};
    __pyx_t_6 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1690, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_with_prefixes, __pyx_t_4, __pyx_t_6, __pyx_callargs+5, 0) < (0)) __PYX_ERR(0, 1690, __pyx_L1_error)
    __pyx_t_2 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_findtext, __pyx_callargs+__pyx_t_5, (5-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1690, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1679
 *         return _elementpath.find(self, path, namespaces, with_prefixes=not _isHtmlDocument(self))
 * 
 *     def findtext(self, path, default=None, namespaces=None):             # <<<<<<<<<<<<<<
 *         """findtext(self, path, default=None, namespaces=None)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._Element.findtext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_path);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1692
 *         return _elementpath.findtext(self, path, default, namespaces, with_prefixes=not _isHtmlDocument(self))
 * 
 *     def findall(self, path, namespaces=None):             # <<<<<<<<<<<<<<
 *         """findall(self, path, namespaces=None)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_85findall(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_84findall, "findall(self, path, namespaces=None)\n\n        Finds all matching subelements, by tag name or path.\n\n        The optional ``namespaces`` argument accepts a\n        prefix-to-namespace mapping that allows the usage of XPath\n        prefixes in the path expression.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_85findall = {"findall", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_85findall, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_84findall};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_85findall(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_path = 0;
  PyObject *__pyx_v_namespaces = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("findall (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_path,&__pyx_mstate_global->__pyx_n_u_namespaces,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1692, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1692, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1692, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "findall", 0) < (0)) __PYX_ERR(0, 1692, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("findall", 0, 1, 2, i); __PYX_ERR(0, 1692, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1692, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1692, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_path = values[0];
    __pyx_v_namespaces = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("findall", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 1692, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._Element.findall", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_84findall(((struct LxmlElement *)__pyx_v_self), __pyx_v_path, __pyx_v_namespaces);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8_Element_84findall(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_namespaces) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("findall", 0);
  __Pyx_INCREF(__pyx_v_path);

  /* "lxml/etree.pyx":1701
 *         prefixes in the path expression.
 *         """
 *         if isinstance(path, QName):             # <<<<<<<<<<<<<<
 *             path = (<QName>path).text
 *         return _elementpath.findall(self, path, namespaces, with_prefixes=not _isHtmlDocument(self))
*/
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_path, __pyx_mstate_global->__pyx_ptype_4lxml_5etree_QName); 
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":1702
 *         """
 *         if isinstance(path, QName):
 *             path = (<QName>path).text             # <<<<<<<<<<<<<<
 *         return _elementpath.findall(self, path, namespaces, with_prefixes=not _isHtmlDocument(self))
 * 
*/
    __pyx_t_2 = ((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_path)->text;
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_path, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "lxml/etree.pyx":1701
 *         prefixes in the path expression.
 *         """
 *         if isinstance(path, QName):             # <<<<<<<<<<<<<<
 *             path = (<QName>path).text
 *         return _elementpath.findall(self, path, namespaces, with_prefixes=not _isHtmlDocument(self))
*/
  }

  /* "lxml/etree.pyx":1703
 *         if isinstance(path, QName):
 *             path = (<QName>path).text
 *         return _elementpath.findall(self, path, namespaces, with_prefixes=not _isHtmlDocument(self))             # <<<<<<<<<<<<<<
 * 
 *     def iterfind(self, path, namespaces=None):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __pyx_v_4lxml_5etree__elementpath;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_1 = __pyx_f_4lxml_5etree__isHtmlDocument(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1703, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyBool_FromLong((!__pyx_t_1)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1703, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[4 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_3, ((PyObject *)__pyx_v_self), __pyx_v_path, __pyx_v_namespaces};
    __pyx_t_6 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1703, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_with_prefixes, __pyx_t_4, __pyx_t_6, __pyx_callargs+4, 0) < (0)) __PYX_ERR(0, 1703, __pyx_L1_error)
    __pyx_t_2 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_findall, __pyx_callargs+__pyx_t_5, (4-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1703, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1692
 *         return _elementpath.findtext(self, path, default, namespaces, with_prefixes=not _isHtmlDocument(self))
 * 
 *     def findall(self, path, namespaces=None):             # <<<<<<<<<<<<<<
 *         """findall(self, path, namespaces=None)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._Element.findall", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_path);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1705
 *         return _elementpath.findall(self, path, namespaces, with_prefixes=not _isHtmlDocument(self))
 * 
 *     def iterfind(self, path, namespaces=None):             # <<<<<<<<<<<<<<
 *         """iterfind(self, path, namespaces=None)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_87iterfind(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_86iterfind, "iterfind(self, path, namespaces=None)\n\n        Iterates over all matching subelements, by tag name or path.\n\n        The optional ``namespaces`` argument accepts a\n        prefix-to-namespace mapping that allows the usage of XPath\n        prefixes in the path expression.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_87iterfind = {"iterfind", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_87iterfind, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_86iterfind};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_87iterfind(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_path = 0;
  PyObject *__pyx_v_namespaces = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iterfind (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_path,&__pyx_mstate_global->__pyx_n_u_namespaces,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1705, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1705, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1705, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "iterfind", 0) < (0)) __PYX_ERR(0, 1705, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("iterfind", 0, 1, 2, i); __PYX_ERR(0, 1705, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1705, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1705, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_path = values[0];
    __pyx_v_namespaces = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("iterfind", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 1705, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._Element.iterfind", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_86iterfind(((struct LxmlElement *)__pyx_v_self), __pyx_v_path, __pyx_v_namespaces);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8_Element_86iterfind(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_namespaces) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("iterfind", 0);
  __Pyx_INCREF(__pyx_v_path);

  /* "lxml/etree.pyx":1714
 *         prefixes in the path expression.
 *         """
 *         if isinstance(path, QName):             # <<<<<<<<<<<<<<
 *             path = (<QName>path).text
 *         return _elementpath.iterfind(self, path, namespaces, with_prefixes=not _isHtmlDocument(self))
*/
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_path, __pyx_mstate_global->__pyx_ptype_4lxml_5etree_QName); 
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":1715
 *         """
 *         if isinstance(path, QName):
 *             path = (<QName>path).text             # <<<<<<<<<<<<<<
 *         return _elementpath.iterfind(self, path, namespaces, with_prefixes=not _isHtmlDocument(self))
 * 
*/
    __pyx_t_2 = ((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_path)->text;
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_path, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "lxml/etree.pyx":1714
 *         prefixes in the path expression.
 *         """
 *         if isinstance(path, QName):             # <<<<<<<<<<<<<<
 *             path = (<QName>path).text
 *         return _elementpath.iterfind(self, path, namespaces, with_prefixes=not _isHtmlDocument(self))
*/
  }

  /* "lxml/etree.pyx":1716
 *         if isinstance(path, QName):
 *             path = (<QName>path).text
 *         return _elementpath.iterfind(self, path, namespaces, with_prefixes=not _isHtmlDocument(self))             # <<<<<<<<<<<<<<
 * 
 *     def xpath(self, _path, *, namespaces=None, extensions=None,
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __pyx_v_4lxml_5etree__elementpath;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_1 = __pyx_f_4lxml_5etree__isHtmlDocument(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1716, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyBool_FromLong((!__pyx_t_1)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1716, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[4 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_3, ((PyObject *)__pyx_v_self), __pyx_v_path, __pyx_v_namespaces};
    __pyx_t_6 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1716, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_with_prefixes, __pyx_t_4, __pyx_t_6, __pyx_callargs+4, 0) < (0)) __PYX_ERR(0, 1716, __pyx_L1_error)
    __pyx_t_2 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_iterfind, __pyx_callargs+__pyx_t_5, (4-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1716, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1705
 *         return _elementpath.findall(self, path, namespaces, with_prefixes=not _isHtmlDocument(self))
 * 
 *     def iterfind(self, path, namespaces=None):             # <<<<<<<<<<<<<<
 *         """iterfind(self, path, namespaces=None)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._Element.iterfind", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_path);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1718
 *         return _elementpath.iterfind(self, path, namespaces, with_prefixes=not _isHtmlDocument(self))
 * 
 *     def xpath(self, _path, *, namespaces=None, extensions=None,             # <<<<<<<<<<<<<<
 *               smart_strings=True, **_variables):
 *         """xpath(self, _path, namespaces=None, extensions=None, smart_strings=True, **_variables)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_89xpath(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_88xpath, "xpath(self, _path, namespaces=None, extensions=None, smart_strings=True, **_variables)\n\n        Evaluate an xpath expression using the element as context node.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_89xpath = {"xpath", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_89xpath, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_88xpath};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_89xpath(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v__path = 0;
  PyObject *__pyx_v_namespaces = 0;
  PyObject *__pyx_v_extensions = 0;
  PyObject *__pyx_v_smart_strings = 0;
  PyObject *__pyx_v__variables = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[4] = {0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("xpath (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  __pyx_v__variables = PyDict_New(); if (unlikely(!__pyx_v__variables)) return NULL;
  __Pyx_GOTREF(__pyx_v__variables);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_path_2,&__pyx_mstate_global->__pyx_n_u_namespaces,&__pyx_mstate_global->__pyx_n_u_extensions,&__pyx_mstate_global->__pyx_n_u_smart_strings,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1718, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1718, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v__variables, values, kwd_pos_args, __pyx_kwds_len, "xpath", 1) < (0)) __PYX_ERR(0, 1718, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "lxml/etree.pyx":1719
 * 
 *     def xpath(self, _path, *, namespaces=None, extensions=None,
 *               smart_strings=True, **_variables):             # <<<<<<<<<<<<<<
 *         """xpath(self, _path, namespaces=None, extensions=None, smart_strings=True, **_variables)
 * 
*/
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_True));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("xpath", 1, 1, 1, i); __PYX_ERR(0, 1718, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1718, __pyx_L3_error)

      /* "lxml/etree.pyx":1718
 *         return _elementpath.iterfind(self, path, namespaces, with_prefixes=not _isHtmlDocument(self))
 * 
 *     def xpath(self, _path, *, namespaces=None, extensions=None,             # <<<<<<<<<<<<<<
 *               smart_strings=True, **_variables):
 *         """xpath(self, _path, namespaces=None, extensions=None, smart_strings=True, **_variables)
*/
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "lxml/etree.pyx":1719
 * 
 *     def xpath(self, _path, *, namespaces=None, extensions=None,
 *               smart_strings=True, **_variables):             # <<<<<<<<<<<<<<
 *         """xpath(self, _path, namespaces=None, extensions=None, smart_strings=True, **_variables)
 * 
*/
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_True));
    }
    __pyx_v__path = values[0];
    __pyx_v_namespaces = values[1];
    __pyx_v_extensions = values[2];
    __pyx_v_smart_strings = values[3];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("xpath", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1718, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v__variables); __pyx_v__variables = 0;
  __Pyx_AddTraceback("lxml.etree._Element.xpath", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_88xpath(((struct LxmlElement *)__pyx_v_self), __pyx_v__path, __pyx_v_namespaces, __pyx_v_extensions, __pyx_v_smart_strings, __pyx_v__variables);

  /* "lxml/etree.pyx":1718
 *         return _elementpath.iterfind(self, path, namespaces, with_prefixes=not _isHtmlDocument(self))
 * 
 *     def xpath(self, _path, *, namespaces=None, extensions=None,             # <<<<<<<<<<<<<<
 *               smart_strings=True, **_variables):
 *         """xpath(self, _path, namespaces=None, extensions=None, smart_strings=True, **_variables)
*/

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v__variables);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8_Element_88xpath(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v__path, PyObject *__pyx_v_namespaces, PyObject *__pyx_v_extensions, PyObject *__pyx_v_smart_strings, PyObject *__pyx_v__variables) {
  struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *__pyx_v_evaluator = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("xpath", 0);

  /* "lxml/etree.pyx":1724
 *         Evaluate an xpath expression using the element as context node.
 *         """
 *         evaluator = XPathElementEvaluator(self, namespaces=namespaces,             # <<<<<<<<<<<<<<
 *                                           extensions=extensions,
 *                                           smart_strings=smart_strings)
*/
  __pyx_t_2 = NULL;

  /* "lxml/etree.pyx":1726
 *         evaluator = XPathElementEvaluator(self, namespaces=namespaces,
 *                                           extensions=extensions,
 *                                           smart_strings=smart_strings)             # <<<<<<<<<<<<<<
 *         return evaluator(_path, **_variables)
 * 
*/
  __pyx_t_3 = 1;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 3 : 0)] = {__pyx_t_2, ((PyObject *)__pyx_v_self)};
    __pyx_t_4 = __Pyx_MakeVectorcallBuilderKwds(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1724, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_namespaces, __pyx_v_namespaces, __pyx_t_4, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 1724, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_extensions, __pyx_v_extensions, __pyx_t_4, __pyx_callargs+2, 1) < (0)) __PYX_ERR(0, 1724, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_smart_strings, __pyx_v_smart_strings, __pyx_t_4, __pyx_callargs+2, 2) < (0)) __PYX_ERR(0, 1724, __pyx_L1_error)
    __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XPathElementEvaluator, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1724, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __pyx_v_evaluator = ((struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "lxml/etree.pyx":1727
 *                                           extensions=extensions,
 *                                           smart_strings=smart_strings)
 *         return evaluator(_path, **_variables)             # <<<<<<<<<<<<<<
 * 
 *     def cssselect(self, expr, *, translator='xml'):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = NULL;
  __Pyx_INCREF((PyObject *)__pyx_v_evaluator);
  __pyx_t_2 = ((PyObject *)__pyx_v_evaluator); 
  __pyx_t_5 = PyDict_Copy(__pyx_v__variables); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1727, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    assert(__pyx_t_4);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
    __pyx_t_3 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v__path};
    __pyx_t_1 = __Pyx_PyObject_FastCallDict((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1727, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1718
 *         return _elementpath.iterfind(self, path, namespaces, with_prefixes=not _isHtmlDocument(self))
 * 
 *     def xpath(self, _path, *, namespaces=None, extensions=None,             # <<<<<<<<<<<<<<
 *               smart_strings=True, **_variables):
 *         """xpath(self, _path, namespaces=None, extensions=None, smart_strings=True, **_variables)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._Element.xpath", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_evaluator);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1729
 *         return evaluator(_path, **_variables)
 * 
 *     def cssselect(self, expr, *, translator='xml'):             # <<<<<<<<<<<<<<
 *         """
 *         Run the CSS expression on this element and its children,
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_91cssselect(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_90cssselect, "\n        Run the CSS expression on this element and its children,\n        returning a list of the results.\n\n        Equivalent to lxml.cssselect.CSSSelect(expr)(self) -- note\n        that pre-compiling the expression can provide a substantial\n        speedup.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_91cssselect = {"cssselect", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_91cssselect, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_90cssselect};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_91cssselect(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_expr = 0;
  PyObject *__pyx_v_translator = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("cssselect (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_expr,&__pyx_mstate_global->__pyx_n_u_translator,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1729, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1729, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "cssselect", 0) < (0)) __PYX_ERR(0, 1729, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_n_u_xml));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("cssselect", 1, 1, 1, i); __PYX_ERR(0, 1729, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1729, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_n_u_xml));
    }
    __pyx_v_expr = values[0];
    __pyx_v_translator = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("cssselect", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1729, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._Element.cssselect", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_90cssselect(((struct LxmlElement *)__pyx_v_self), __pyx_v_expr, __pyx_v_translator);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8_Element_90cssselect(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_expr, PyObject *__pyx_v_translator) {
  PyObject *__pyx_v_CSSSelector = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  size_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("cssselect", 0);

  /* "lxml/etree.pyx":1739
 *         """
 *         # Do the import here to make the dependency optional.
 *         from lxml.cssselect import CSSSelector             # <<<<<<<<<<<<<<
 *         return CSSSelector(expr, translator=translator)(self)
 * 
*/
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_CSSSelector};
    __pyx_t_2 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_lxml_cssselect, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1739, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_t_2;
  __Pyx_GOTREF(__pyx_t_1);
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_CSSSelector};
    __pyx_t_3 = 0; {
      __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_1, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1739, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      switch (__pyx_t_3) {
        case 0:
        __Pyx_INCREF(__pyx_t_4);
        __pyx_v_CSSSelector = __pyx_t_4;
        break;
        default:;
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":1740
 *         # Do the import here to make the dependency optional.
 *         from lxml.cssselect import CSSSelector
 *         return CSSSelector(expr, translator=translator)(self)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = NULL;
  __pyx_t_6 = NULL;
  __Pyx_INCREF(__pyx_v_CSSSelector);
  __pyx_t_7 = __pyx_v_CSSSelector; 
  __pyx_t_8 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
    assert(__pyx_t_6);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
    __Pyx_INCREF(__pyx_t_6);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
    __pyx_t_8 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_6, __pyx_v_expr};
    __pyx_t_9 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1740, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_translator, __pyx_v_translator, __pyx_t_9, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 1740, __pyx_L1_error)
    __pyx_t_5 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_9);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1740, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
  }
  __pyx_t_8 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
    assert(__pyx_t_4);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
    __pyx_t_8 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, ((PyObject *)__pyx_v_self)};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1740, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1729
 *         return evaluator(_path, **_variables)
 * 
 *     def cssselect(self, expr, *, translator='xml'):             # <<<<<<<<<<<<<<
 *         """
 *         Run the CSS expression on this element and its children,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("lxml.etree._Element.cssselect", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_CSSSelector);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1743
 * 
 * 
 * @cython.linetrace(False)             # <<<<<<<<<<<<<<
 * cdef _Element _elementFactory(_Document doc, xmlNode* c_node):
 *     cdef _Element result
*/

static struct LxmlElement *__pyx_f_4lxml_5etree__elementFactory(struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_node) {
  struct LxmlElement *__pyx_v_result = 0;
  PyTypeObject *__pyx_v_element_class = NULL;
  struct LxmlElement *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  size_t __pyx_t_7;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_elementFactory", 0);

  /* "lxml/etree.pyx":1746
 * cdef _Element _elementFactory(_Document doc, xmlNode* c_node):
 *     cdef _Element result
 *     result = getProxy(c_node)             # <<<<<<<<<<<<<<
 *     if result is not None:
 *         return result
*/
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree_getProxy(__pyx_v_c_node)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1746, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_result = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "lxml/etree.pyx":1747
 *     cdef _Element result
 *     result = getProxy(c_node)
 *     if result is not None:             # <<<<<<<<<<<<<<
 *         return result
 *     if c_node is NULL:
*/
  __pyx_t_2 = (((PyObject *)__pyx_v_result) != Py_None);
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":1748
 *     result = getProxy(c_node)
 *     if result is not None:
 *         return result             # <<<<<<<<<<<<<<
 *     if c_node is NULL:
 *         return None
*/
    __Pyx_XDECREF((PyObject *)__pyx_r);
    __Pyx_INCREF((PyObject *)__pyx_v_result);
    __pyx_r = __pyx_v_result;
    goto __pyx_L0;

    /* "lxml/etree.pyx":1747
 *     cdef _Element result
 *     result = getProxy(c_node)
 *     if result is not None:             # <<<<<<<<<<<<<<
 *         return result
 *     if c_node is NULL:
*/
  }

  /* "lxml/etree.pyx":1749
 *     if result is not None:
 *         return result
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         return None
 * 
*/
  __pyx_t_2 = (__pyx_v_c_node == NULL);
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":1750
 *         return result
 *     if c_node is NULL:
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     element_class = <type> LOOKUP_ELEMENT_CLASS(
*/
    __Pyx_XDECREF((PyObject *)__pyx_r);
    __pyx_r = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "lxml/etree.pyx":1749
 *     if result is not None:
 *         return result
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         return None
 * 
*/
  }

  /* "lxml/etree.pyx":1753
 * 
 *     element_class = <type> LOOKUP_ELEMENT_CLASS(
 *         ELEMENT_CLASS_LOOKUP_STATE, doc, c_node)             # <<<<<<<<<<<<<<
 *     if type(element_class) is not type:
 *         if not isinstance(element_class, type):
*/
  __pyx_t_1 = __pyx_v_4lxml_5etree_ELEMENT_CLASS_LOOKUP_STATE;
  __Pyx_INCREF(__pyx_t_1);

  /* "lxml/etree.pyx":1752
 *         return None
 * 
 *     element_class = <type> LOOKUP_ELEMENT_CLASS(             # <<<<<<<<<<<<<<
 *         ELEMENT_CLASS_LOOKUP_STATE, doc, c_node)
 *     if type(element_class) is not type:
*/
  __pyx_t_3 = __pyx_v_4lxml_5etree_LOOKUP_ELEMENT_CLASS(__pyx_t_1, __pyx_v_doc, __pyx_v_c_node); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1752, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __pyx_t_3;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_element_class = ((PyTypeObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "lxml/etree.pyx":1754
 *     element_class = <type> LOOKUP_ELEMENT_CLASS(
 *         ELEMENT_CLASS_LOOKUP_STATE, doc, c_node)
 *     if type(element_class) is not type:             # <<<<<<<<<<<<<<
 *         if not isinstance(element_class, type):
 *             raise TypeError(f"Element class is not a type, got {type(element_class)}")
*/
  __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_element_class))) != ((PyObject *)(&PyType_Type)));
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":1755
 *         ELEMENT_CLASS_LOOKUP_STATE, doc, c_node)
 *     if type(element_class) is not type:
 *         if not isinstance(element_class, type):             # <<<<<<<<<<<<<<
 *             raise TypeError(f"Element class is not a type, got {type(element_class)}")
 *     if hasProxy(c_node):
*/
    __pyx_t_2 = PyType_Check(((PyObject *)__pyx_v_element_class)); 
    __pyx_t_4 = (!__pyx_t_2);
    if (unlikely(__pyx_t_4)) {

      /* "lxml/etree.pyx":1756
 *     if type(element_class) is not type:
 *         if not isinstance(element_class, type):
 *             raise TypeError(f"Element class is not a type, got {type(element_class)}")             # <<<<<<<<<<<<<<
 *     if hasProxy(c_node):
 *         # prevent re-entry race condition - we just called into Python
*/
      __pyx_t_3 = NULL;
      __pyx_t_5 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_element_class))), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1756, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_Element_class_is_not_a_type_got, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1756, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_7 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_6};
        __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1756, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_ERR(0, 1756, __pyx_L1_error)

      /* "lxml/etree.pyx":1755
 *         ELEMENT_CLASS_LOOKUP_STATE, doc, c_node)
 *     if type(element_class) is not type:
 *         if not isinstance(element_class, type):             # <<<<<<<<<<<<<<
 *             raise TypeError(f"Element class is not a type, got {type(element_class)}")
 *     if hasProxy(c_node):
*/
    }

    /* "lxml/etree.pyx":1754
 *     element_class = <type> LOOKUP_ELEMENT_CLASS(
 *         ELEMENT_CLASS_LOOKUP_STATE, doc, c_node)
 *     if type(element_class) is not type:             # <<<<<<<<<<<<<<
 *         if not isinstance(element_class, type):
 *             raise TypeError(f"Element class is not a type, got {type(element_class)}")
*/
  }

  /* "lxml/etree.pyx":1757
 *         if not isinstance(element_class, type):
 *             raise TypeError(f"Element class is not a type, got {type(element_class)}")
 *     if hasProxy(c_node):             # <<<<<<<<<<<<<<
 *         # prevent re-entry race condition - we just called into Python
 *         return getProxy(c_node)
*/
  __pyx_t_4 = __pyx_f_4lxml_5etree_hasProxy(__pyx_v_c_node); if (unlikely(__pyx_t_4 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1757, __pyx_L1_error)
  if (__pyx_t_4) {

    /* "lxml/etree.pyx":1759
 *     if hasProxy(c_node):
 *         # prevent re-entry race condition - we just called into Python
 *         return getProxy(c_node)             # <<<<<<<<<<<<<<
 *     result = element_class.__new__(element_class)
 *     if hasProxy(c_node):
*/
    __Pyx_XDECREF((PyObject *)__pyx_r);
    __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree_getProxy(__pyx_v_c_node)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1759, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = ((struct LxmlElement *)__pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "lxml/etree.pyx":1757
 *         if not isinstance(element_class, type):
 *             raise TypeError(f"Element class is not a type, got {type(element_class)}")
 *     if hasProxy(c_node):             # <<<<<<<<<<<<<<
 *         # prevent re-entry race condition - we just called into Python
 *         return getProxy(c_node)
*/
  }

  /* "lxml/etree.pyx":1760
 *         # prevent re-entry race condition - we just called into Python
 *         return getProxy(c_node)
 *     result = element_class.__new__(element_class)             # <<<<<<<<<<<<<<
 *     if hasProxy(c_node):
 *         # prevent re-entry race condition - we just called into Python
*/
  if (unlikely(((PyObject *)__pyx_v_element_class) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object.__new__(X): X is not a type object (NoneType)");
    __PYX_ERR(0, 1760, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_tp_new(((PyObject *)__pyx_v_element_class), __pyx_mstate_global->__pyx_empty_tuple); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1760, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element)))) __PYX_ERR(0, 1760, __pyx_L1_error)
  __Pyx_DECREF_SET(__pyx_v_result, ((struct LxmlElement *)__pyx_t_1));
  __pyx_t_1 = 0;

  /* "lxml/etree.pyx":1761
 *         return getProxy(c_node)
 *     result = element_class.__new__(element_class)
 *     if hasProxy(c_node):             # <<<<<<<<<<<<<<
 *         # prevent re-entry race condition - we just called into Python
 *         result._c_node = NULL
*/
  __pyx_t_4 = __pyx_f_4lxml_5etree_hasProxy(__pyx_v_c_node); if (unlikely(__pyx_t_4 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1761, __pyx_L1_error)
  if (__pyx_t_4) {

    /* "lxml/etree.pyx":1763
 *     if hasProxy(c_node):
 *         # prevent re-entry race condition - we just called into Python
 *         result._c_node = NULL             # <<<<<<<<<<<<<<
 *         return getProxy(c_node)
 * 
*/
    __pyx_v_result->_c_node = NULL;

    /* "lxml/etree.pyx":1764
 *         # prevent re-entry race condition - we just called into Python
 *         result._c_node = NULL
 *         return getProxy(c_node)             # <<<<<<<<<<<<<<
 * 
 *     _registerProxy(result, doc, c_node)
*/
    __Pyx_XDECREF((PyObject *)__pyx_r);
    __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree_getProxy(__pyx_v_c_node)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1764, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = ((struct LxmlElement *)__pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "lxml/etree.pyx":1761
 *         return getProxy(c_node)
 *     result = element_class.__new__(element_class)
 *     if hasProxy(c_node):             # <<<<<<<<<<<<<<
 *         # prevent re-entry race condition - we just called into Python
 *         result._c_node = NULL
*/
  }

  /* "lxml/etree.pyx":1766
 *         return getProxy(c_node)
 * 
 *     _registerProxy(result, doc, c_node)             # <<<<<<<<<<<<<<
 *     if element_class is not _Element:
 *         result._init()
*/
  __pyx_t_8 = __pyx_f_4lxml_5etree__registerProxy(__pyx_v_result, __pyx_v_doc, __pyx_v_c_node); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 1766, __pyx_L1_error)

  /* "lxml/etree.pyx":1767
 * 
 *     _registerProxy(result, doc, c_node)
 *     if element_class is not _Element:             # <<<<<<<<<<<<<<
 *         result._init()
 *     return result
*/
  __pyx_t_4 = (__pyx_v_element_class != __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element);
  if (__pyx_t_4) {

    /* "lxml/etree.pyx":1768
 *     _registerProxy(result, doc, c_node)
 *     if element_class is not _Element:
 *         result._init()             # <<<<<<<<<<<<<<
 *     return result
 * 
*/
    __pyx_t_6 = ((PyObject *)__pyx_v_result);
    __Pyx_INCREF(__pyx_t_6);
    __pyx_t_7 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_init_2, __pyx_callargs+__pyx_t_7, (1-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1768, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "lxml/etree.pyx":1767
 * 
 *     _registerProxy(result, doc, c_node)
 *     if element_class is not _Element:             # <<<<<<<<<<<<<<
 *         result._init()
 *     return result
*/
  }

  /* "lxml/etree.pyx":1769
 *     if element_class is not _Element:
 *         result._init()
 *     return result             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1743
 * 
 * 
 * @cython.linetrace(False)             # <<<<<<<<<<<<<<
 * cdef _Element _elementFactory(_Document doc, xmlNode* c_node):
 *     cdef _Element result
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._elementFactory", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XDECREF((PyObject *)__pyx_v_element_class);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1774
 * @cython.internal
 * cdef class __ContentOnlyElement(_Element):
 *     cdef int _raiseImmutable(self) except -1:             # <<<<<<<<<<<<<<
 *         raise TypeError, "this element does not have children or attributes"
 * 
*/

static int __pyx_f_4lxml_5etree_20__ContentOnlyElement__raiseImmutable(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree___ContentOnlyElement *__pyx_v_self) {
  int __pyx_r;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "lxml/etree.pyx":1775
 * cdef class __ContentOnlyElement(_Element):
 *     cdef int _raiseImmutable(self) except -1:
 *         raise TypeError, "this element does not have children or attributes"             # <<<<<<<<<<<<<<
 * 
 *     def set(self, key, value):
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_this_element_does_not_have_child, 0, 0);
  __PYX_ERR(0, 1775, __pyx_L1_error)

  /* "lxml/etree.pyx":1774
 * @cython.internal
 * cdef class __ContentOnlyElement(_Element):
 *     cdef int _raiseImmutable(self) except -1:             # <<<<<<<<<<<<<<
 *         raise TypeError, "this element does not have children or attributes"
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.__ContentOnlyElement._raiseImmutable", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  return __pyx_r;
}

/* "lxml/etree.pyx":1777
 *         raise TypeError, "this element does not have children or attributes"
 * 
 *     def set(self, key, value):             # <<<<<<<<<<<<<<
 *         "set(self, key, value)"
 *         self._raiseImmutable()
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_20__ContentOnlyElement_1set(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_20__ContentOnlyElement_set, "set(self, key, value)");
static PyMethodDef __pyx_mdef_4lxml_5etree_20__ContentOnlyElement_1set = {"set", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_20__ContentOnlyElement_1set, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_20__ContentOnlyElement_set};
static PyObject *__pyx_pw_4lxml_5etree_20__ContentOnlyElement_1set(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_key = 0;
  CYTHON_UNUSED PyObject *__pyx_v_value = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_key,&__pyx_mstate_global->__pyx_n_u_value,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1777, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1777, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1777, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "set", 0) < (0)) __PYX_ERR(0, 1777, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("set", 1, 2, 2, i); __PYX_ERR(0, 1777, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1777, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1777, __pyx_L3_error)
    }
    __pyx_v_key = values[0];
    __pyx_v_value = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1777, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.__ContentOnlyElement.set", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_20__ContentOnlyElement_set(((struct __pyx_obj_4lxml_5etree___ContentOnlyElement *)__pyx_v_self), __pyx_v_key, __pyx_v_value);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_set(struct __pyx_obj_4lxml_5etree___ContentOnlyElement *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_key, CYTHON_UNUSED PyObject *__pyx_v_value) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set", 0);

  /* "lxml/etree.pyx":1779
 *     def set(self, key, value):
 *         "set(self, key, value)"
 *         self._raiseImmutable()             # <<<<<<<<<<<<<<
 * 
 *     def append(self, value):
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree___ContentOnlyElement *)__pyx_v_self->__pyx_vtab)->_raiseImmutable(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1779, __pyx_L1_error)

  /* "lxml/etree.pyx":1777
 *         raise TypeError, "this element does not have children or attributes"
 * 
 *     def set(self, key, value):             # <<<<<<<<<<<<<<
 *         "set(self, key, value)"
 *         self._raiseImmutable()
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.__ContentOnlyElement.set", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1781
 *         self._raiseImmutable()
 * 
 *     def append(self, value):             # <<<<<<<<<<<<<<
 *         "append(self, value)"
 *         self._raiseImmutable()
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_20__ContentOnlyElement_3append(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_20__ContentOnlyElement_2append, "append(self, value)");
static PyMethodDef __pyx_mdef_4lxml_5etree_20__ContentOnlyElement_3append = {"append", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_20__ContentOnlyElement_3append, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_20__ContentOnlyElement_2append};
static PyObject *__pyx_pw_4lxml_5etree_20__ContentOnlyElement_3append(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_value = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("append (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_value,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1781, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1781, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "append", 0) < (0)) __PYX_ERR(0, 1781, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("append", 1, 1, 1, i); __PYX_ERR(0, 1781, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1781, __pyx_L3_error)
    }
    __pyx_v_value = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("append", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1781, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.__ContentOnlyElement.append", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_20__ContentOnlyElement_2append(((struct __pyx_obj_4lxml_5etree___ContentOnlyElement *)__pyx_v_self), __pyx_v_value);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_2append(struct __pyx_obj_4lxml_5etree___ContentOnlyElement *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_value) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("append", 0);

  /* "lxml/etree.pyx":1783
 *     def append(self, value):
 *         "append(self, value)"
 *         self._raiseImmutable()             # <<<<<<<<<<<<<<
 * 
 *     def insert(self, index, value):
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree___ContentOnlyElement *)__pyx_v_self->__pyx_vtab)->_raiseImmutable(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1783, __pyx_L1_error)

  /* "lxml/etree.pyx":1781
 *         self._raiseImmutable()
 * 
 *     def append(self, value):             # <<<<<<<<<<<<<<
 *         "append(self, value)"
 *         self._raiseImmutable()
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.__ContentOnlyElement.append", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1785
 *         self._raiseImmutable()
 * 
 *     def insert(self, index, value):             # <<<<<<<<<<<<<<
 *         "insert(self, index, value)"
 *         self._raiseImmutable()
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_20__ContentOnlyElement_5insert(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_20__ContentOnlyElement_4insert, "insert(self, index, value)");
static PyMethodDef __pyx_mdef_4lxml_5etree_20__ContentOnlyElement_5insert = {"insert", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_20__ContentOnlyElement_5insert, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_20__ContentOnlyElement_4insert};
static PyObject *__pyx_pw_4lxml_5etree_20__ContentOnlyElement_5insert(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_index = 0;
  CYTHON_UNUSED PyObject *__pyx_v_value = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("insert (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_index,&__pyx_mstate_global->__pyx_n_u_value,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1785, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1785, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1785, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "insert", 0) < (0)) __PYX_ERR(0, 1785, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("insert", 1, 2, 2, i); __PYX_ERR(0, 1785, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1785, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1785, __pyx_L3_error)
    }
    __pyx_v_index = values[0];
    __pyx_v_value = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("insert", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1785, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.__ContentOnlyElement.insert", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_20__ContentOnlyElement_4insert(((struct __pyx_obj_4lxml_5etree___ContentOnlyElement *)__pyx_v_self), __pyx_v_index, __pyx_v_value);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_4insert(struct __pyx_obj_4lxml_5etree___ContentOnlyElement *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_index, CYTHON_UNUSED PyObject *__pyx_v_value) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("insert", 0);

  /* "lxml/etree.pyx":1787
 *     def insert(self, index, value):
 *         "insert(self, index, value)"
 *         self._raiseImmutable()             # <<<<<<<<<<<<<<
 * 
 *     def __setitem__(self, index, value):
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree___ContentOnlyElement *)__pyx_v_self->__pyx_vtab)->_raiseImmutable(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1787, __pyx_L1_error)

  /* "lxml/etree.pyx":1785
 *         self._raiseImmutable()
 * 
 *     def insert(self, index, value):             # <<<<<<<<<<<<<<
 *         "insert(self, index, value)"
 *         self._raiseImmutable()
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.__ContentOnlyElement.insert", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1789
 *         self._raiseImmutable()
 * 
 *     def __setitem__(self, index, value):             # <<<<<<<<<<<<<<
 *         "__setitem__(self, index, value)"
 *         self._raiseImmutable()
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_20__ContentOnlyElement_7__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_20__ContentOnlyElement_6__setitem__, "__setitem__(self, index, value)");
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_20__ContentOnlyElement_6__setitem__;
#endif
static int __pyx_pw_4lxml_5etree_20__ContentOnlyElement_7__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_20__ContentOnlyElement_6__setitem__(((struct __pyx_obj_4lxml_5etree___ContentOnlyElement *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_20__ContentOnlyElement_6__setitem__(struct __pyx_obj_4lxml_5etree___ContentOnlyElement *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_index, CYTHON_UNUSED PyObject *__pyx_v_value) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "lxml/etree.pyx":1791
 *     def __setitem__(self, index, value):
 *         "__setitem__(self, index, value)"
 *         self._raiseImmutable()             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree___ContentOnlyElement *)__pyx_v_self->__pyx_vtab)->_raiseImmutable(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1791, __pyx_L1_error)

  /* "lxml/etree.pyx":1789
 *         self._raiseImmutable()
 * 
 *     def __setitem__(self, index, value):             # <<<<<<<<<<<<<<
 *         "__setitem__(self, index, value)"
 *         self._raiseImmutable()
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.__ContentOnlyElement.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "lxml/etree.pyx":1793
 *         self._raiseImmutable()
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def attrib(self):
 *         return IMMUTABLE_EMPTY_MAPPING
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_20__ContentOnlyElement_6attrib_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_20__ContentOnlyElement_6attrib_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_20__ContentOnlyElement_6attrib___get__(((struct __pyx_obj_4lxml_5etree___ContentOnlyElement *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_6attrib___get__(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree___ContentOnlyElement *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lxml/etree.pyx":1795
 *     @property
 *     def attrib(self):
 *         return IMMUTABLE_EMPTY_MAPPING             # <<<<<<<<<<<<<<
 * 
 *     property text:
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_4lxml_5etree_IMMUTABLE_EMPTY_MAPPING);
  __pyx_r = __pyx_v_4lxml_5etree_IMMUTABLE_EMPTY_MAPPING;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1793
 *         self._raiseImmutable()
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def attrib(self):
 *         return IMMUTABLE_EMPTY_MAPPING
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1798
 * 
 *     property text:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             return funicodeOrEmpty(self._c_node.content)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_20__ContentOnlyElement_4text_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_20__ContentOnlyElement_4text_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_20__ContentOnlyElement_4text___get__(((struct __pyx_obj_4lxml_5etree___ContentOnlyElement *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_4text___get__(struct __pyx_obj_4lxml_5etree___ContentOnlyElement *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lxml/etree.pyx":1799
 *     property text:
 *         def __get__(self):
 *             _assertValidNode(self)             # <<<<<<<<<<<<<<
 *             return funicodeOrEmpty(self._c_node.content)
 * 
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1799, __pyx_L1_error)

  /* "lxml/etree.pyx":1800
 *         def __get__(self):
 *             _assertValidNode(self)
 *             return funicodeOrEmpty(self._c_node.content)             # <<<<<<<<<<<<<<
 * 
 *         def __set__(self, value):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree_funicodeOrEmpty(__pyx_v_self->__pyx_base._c_node->content); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1800, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1798
 * 
 *     property text:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             return funicodeOrEmpty(self._c_node.content)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.__ContentOnlyElement.text.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1802
 *             return funicodeOrEmpty(self._c_node.content)
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             cdef tree.xmlDict* c_dict
 *             _assertValidNode(self)
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_20__ContentOnlyElement_4text_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_4lxml_5etree_20__ContentOnlyElement_4text_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_20__ContentOnlyElement_4text_2__set__(((struct __pyx_obj_4lxml_5etree___ContentOnlyElement *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_20__ContentOnlyElement_4text_2__set__(struct __pyx_obj_4lxml_5etree___ContentOnlyElement *__pyx_v_self, PyObject *__pyx_v_value) {
  const xmlChar *__pyx_v_c_text;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);

  /* "lxml/etree.pyx":1804
 *         def __set__(self, value):
 *             cdef tree.xmlDict* c_dict
 *             _assertValidNode(self)             # <<<<<<<<<<<<<<
 *             if value is None:
 *                 c_text = <const_xmlChar*>NULL
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1804, __pyx_L1_error)

  /* "lxml/etree.pyx":1805
 *             cdef tree.xmlDict* c_dict
 *             _assertValidNode(self)
 *             if value is None:             # <<<<<<<<<<<<<<
 *                 c_text = <const_xmlChar*>NULL
 *             else:
*/
  __pyx_t_2 = (__pyx_v_value == Py_None);
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":1806
 *             _assertValidNode(self)
 *             if value is None:
 *                 c_text = <const_xmlChar*>NULL             # <<<<<<<<<<<<<<
 *             else:
 *                 value = _utf8(value)
*/
    __pyx_v_c_text = ((const xmlChar *)NULL);

    /* "lxml/etree.pyx":1805
 *             cdef tree.xmlDict* c_dict
 *             _assertValidNode(self)
 *             if value is None:             # <<<<<<<<<<<<<<
 *                 c_text = <const_xmlChar*>NULL
 *             else:
*/
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":1808
 *                 c_text = <const_xmlChar*>NULL
 *             else:
 *                 value = _utf8(value)             # <<<<<<<<<<<<<<
 *                 c_text = _xcstr(value)
 *             tree.xmlNodeSetContent(self._c_node, c_text)
*/
  /*else*/ {
    __pyx_t_3 = __pyx_f_4lxml_5etree__utf8(__pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1808, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "lxml/etree.pyx":1809
 *             else:
 *                 value = _utf8(value)
 *                 c_text = _xcstr(value)             # <<<<<<<<<<<<<<
 *             tree.xmlNodeSetContent(self._c_node, c_text)
 * 
*/
    __pyx_v_c_text = (const xmlChar*)PyBytes_AS_STRING(__pyx_v_value);
  }
  __pyx_L3:;

  /* "lxml/etree.pyx":1810
 *                 value = _utf8(value)
 *                 c_text = _xcstr(value)
 *             tree.xmlNodeSetContent(self._c_node, c_text)             # <<<<<<<<<<<<<<
 * 
 *     # ACCESSORS
*/
  xmlNodeSetContent(__pyx_v_self->__pyx_base._c_node, __pyx_v_c_text);

  /* "lxml/etree.pyx":1802
 *             return funicodeOrEmpty(self._c_node.content)
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             cdef tree.xmlDict* c_dict
 *             _assertValidNode(self)
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.__ContentOnlyElement.text.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1813
 * 
 *     # ACCESSORS
 *     def __getitem__(self, x):             # <<<<<<<<<<<<<<
 *         "__getitem__(self, x)"
 *         if isinstance(x, slice):
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_20__ContentOnlyElement_9__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_20__ContentOnlyElement_8__getitem__, "__getitem__(self, x)");
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_20__ContentOnlyElement_8__getitem__;
#endif
static PyObject *__pyx_pw_4lxml_5etree_20__ContentOnlyElement_9__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_20__ContentOnlyElement_8__getitem__(((struct __pyx_obj_4lxml_5etree___ContentOnlyElement *)__pyx_v_self), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_8__getitem__(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree___ContentOnlyElement *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "lxml/etree.pyx":1815
 *     def __getitem__(self, x):
 *         "__getitem__(self, x)"
 *         if isinstance(x, slice):             # <<<<<<<<<<<<<<
 *             return []
 *         else:
*/
  __pyx_t_1 = PySlice_Check(__pyx_v_x); 
  if (likely(__pyx_t_1)) {

    /* "lxml/etree.pyx":1816
 *         "__getitem__(self, x)"
 *         if isinstance(x, slice):
 *             return []             # <<<<<<<<<<<<<<
 *         else:
 *             raise IndexError, "list index out of range"
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1816, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "lxml/etree.pyx":1815
 *     def __getitem__(self, x):
 *         "__getitem__(self, x)"
 *         if isinstance(x, slice):             # <<<<<<<<<<<<<<
 *             return []
 *         else:
*/
  }

  /* "lxml/etree.pyx":1818
 *             return []
 *         else:
 *             raise IndexError, "list index out of range"             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
*/
  /*else*/ {
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_IndexError))), __pyx_mstate_global->__pyx_kp_u_list_index_out_of_range, 0, 0);
    __PYX_ERR(0, 1818, __pyx_L1_error)
  }

  /* "lxml/etree.pyx":1813
 * 
 *     # ACCESSORS
 *     def __getitem__(self, x):             # <<<<<<<<<<<<<<
 *         "__getitem__(self, x)"
 *         if isinstance(x, slice):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.__ContentOnlyElement.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1820
 *             raise IndexError, "list index out of range"
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         "__len__(self)"
 *         return 0
*/

/* Python wrapper */
static Py_ssize_t __pyx_pw_4lxml_5etree_20__ContentOnlyElement_11__len__(PyObject *__pyx_v_self); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_20__ContentOnlyElement_10__len__, "__len__(self)");
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_20__ContentOnlyElement_10__len__;
#endif
static Py_ssize_t __pyx_pw_4lxml_5etree_20__ContentOnlyElement_11__len__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_20__ContentOnlyElement_10__len__(((struct __pyx_obj_4lxml_5etree___ContentOnlyElement *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_ssize_t __pyx_pf_4lxml_5etree_20__ContentOnlyElement_10__len__(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree___ContentOnlyElement *__pyx_v_self) {
  Py_ssize_t __pyx_r;

  /* "lxml/etree.pyx":1822
 *     def __len__(self):
 *         "__len__(self)"
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     def get(self, key, default=None):
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1820
 *             raise IndexError, "list index out of range"
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         "__len__(self)"
 *         return 0
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "lxml/etree.pyx":1824
 *         return 0
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         "get(self, key, default=None)"
 *         return None
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_20__ContentOnlyElement_13get(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_20__ContentOnlyElement_12get, "get(self, key, default=None)");
static PyMethodDef __pyx_mdef_4lxml_5etree_20__ContentOnlyElement_13get = {"get", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_20__ContentOnlyElement_13get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_20__ContentOnlyElement_12get};
static PyObject *__pyx_pw_4lxml_5etree_20__ContentOnlyElement_13get(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_key = 0;
  CYTHON_UNUSED PyObject *__pyx_v_default = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_key,&__pyx_mstate_global->__pyx_n_u_default,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1824, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1824, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1824, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "get", 0) < (0)) __PYX_ERR(0, 1824, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, i); __PYX_ERR(0, 1824, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1824, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1824, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_key = values[0];
    __pyx_v_default = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 1824, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.__ContentOnlyElement.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_20__ContentOnlyElement_12get(((struct __pyx_obj_4lxml_5etree___ContentOnlyElement *)__pyx_v_self), __pyx_v_key, __pyx_v_default);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_12get(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree___ContentOnlyElement *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_key, CYTHON_UNUSED PyObject *__pyx_v_default) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get", 0);

  /* "lxml/etree.pyx":1826
 *     def get(self, key, default=None):
 *         "get(self, key, default=None)"
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     def keys(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "lxml/etree.pyx":1824
 *         return 0
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         "get(self, key, default=None)"
 *         return None
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1828
 *         return None
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         "keys(self)"
 *         return []
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_20__ContentOnlyElement_15keys(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_20__ContentOnlyElement_14keys, "keys(self)");
static PyMethodDef __pyx_mdef_4lxml_5etree_20__ContentOnlyElement_15keys = {"keys", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_20__ContentOnlyElement_15keys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_20__ContentOnlyElement_14keys};
static PyObject *__pyx_pw_4lxml_5etree_20__ContentOnlyElement_15keys(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("keys (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("keys", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("keys", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_20__ContentOnlyElement_14keys(((struct __pyx_obj_4lxml_5etree___ContentOnlyElement *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_14keys(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree___ContentOnlyElement *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("keys", 0);

  /* "lxml/etree.pyx":1830
 *     def keys(self):
 *         "keys(self)"
 *         return []             # <<<<<<<<<<<<<<
 * 
 *     def items(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1830, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1828
 *         return None
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         "keys(self)"
 *         return []
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.__ContentOnlyElement.keys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1832
 *         return []
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         "items(self)"
 *         return []
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_20__ContentOnlyElement_17items(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_20__ContentOnlyElement_16items, "items(self)");
static PyMethodDef __pyx_mdef_4lxml_5etree_20__ContentOnlyElement_17items = {"items", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_20__ContentOnlyElement_17items, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_20__ContentOnlyElement_16items};
static PyObject *__pyx_pw_4lxml_5etree_20__ContentOnlyElement_17items(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("items", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("items", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_20__ContentOnlyElement_16items(((struct __pyx_obj_4lxml_5etree___ContentOnlyElement *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_16items(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree___ContentOnlyElement *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("items", 0);

  /* "lxml/etree.pyx":1834
 *     def items(self):
 *         "items(self)"
 *         return []             # <<<<<<<<<<<<<<
 * 
 *     def values(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1834, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1832
 *         return []
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         "items(self)"
 *         return []
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.__ContentOnlyElement.items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1836
 *         return []
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         "values(self)"
 *         return []
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_20__ContentOnlyElement_19values(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_20__ContentOnlyElement_18values, "values(self)");
static PyMethodDef __pyx_mdef_4lxml_5etree_20__ContentOnlyElement_19values = {"values", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_20__ContentOnlyElement_19values, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_20__ContentOnlyElement_18values};
static PyObject *__pyx_pw_4lxml_5etree_20__ContentOnlyElement_19values(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("values (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("values", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("values", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_20__ContentOnlyElement_18values(((struct __pyx_obj_4lxml_5etree___ContentOnlyElement *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_18values(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree___ContentOnlyElement *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("values", 0);

  /* "lxml/etree.pyx":1838
 *     def values(self):
 *         "values(self)"
 *         return []             # <<<<<<<<<<<<<<
 * 
 * cdef class _Comment(__ContentOnlyElement):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1838, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1836
 *         return []
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         "values(self)"
 *         return []
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.__ContentOnlyElement.values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1841
 * 
 * cdef class _Comment(__ContentOnlyElement):
 *     @property             # <<<<<<<<<<<<<<
 *     def tag(self):
 *         return Comment
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Comment_3tag_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_8_Comment_3tag_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Comment_3tag___get__(((struct __pyx_obj_4lxml_5etree__Comment *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8_Comment_3tag___get__(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__Comment *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lxml/etree.pyx":1843
 *     @property
 *     def tag(self):
 *         return Comment             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_Comment); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1843, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1841
 * 
 * cdef class _Comment(__ContentOnlyElement):
 *     @property             # <<<<<<<<<<<<<<
 *     def tag(self):
 *         return Comment
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._Comment.tag.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1845
 *         return Comment
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "<!--%s-->" % self.text
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Comment_1__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_8_Comment_1__repr__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Comment___repr__(((struct __pyx_obj_4lxml_5etree__Comment *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8_Comment___repr__(struct __pyx_obj_4lxml_5etree__Comment *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "lxml/etree.pyx":1846
 * 
 *     def __repr__(self):
 *         return "<!--%s-->" % self.text             # <<<<<<<<<<<<<<
 * 
 * cdef class _ProcessingInstruction(__ContentOnlyElement):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_text); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1846, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyUnicode_FormatSafe(__pyx_mstate_global->__pyx_kp_u_s, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1846, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1845
 *         return Comment
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "<!--%s-->" % self.text
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Comment.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1849
 * 
 * cdef class _ProcessingInstruction(__ContentOnlyElement):
 *     @property             # <<<<<<<<<<<<<<
 *     def tag(self):
 *         return ProcessingInstruction
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_22_ProcessingInstruction_3tag_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_22_ProcessingInstruction_3tag_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_22_ProcessingInstruction_3tag___get__(((struct __pyx_obj_4lxml_5etree__ProcessingInstruction *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_22_ProcessingInstruction_3tag___get__(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__ProcessingInstruction *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lxml/etree.pyx":1851
 *     @property
 *     def tag(self):
 *         return ProcessingInstruction             # <<<<<<<<<<<<<<
 * 
 *     property target:
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_ProcessingInstruction); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1851, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1849
 * 
 * cdef class _ProcessingInstruction(__ContentOnlyElement):
 *     @property             # <<<<<<<<<<<<<<
 *     def tag(self):
 *         return ProcessingInstruction
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ProcessingInstruction.tag.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1855
 *     property target:
 *         # not in ElementTree
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             return funicode(self._c_node.name)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_22_ProcessingInstruction_6target_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_22_ProcessingInstruction_6target_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_22_ProcessingInstruction_6target___get__(((struct __pyx_obj_4lxml_5etree__ProcessingInstruction *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_22_ProcessingInstruction_6target___get__(struct __pyx_obj_4lxml_5etree__ProcessingInstruction *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lxml/etree.pyx":1856
 *         # not in ElementTree
 *         def __get__(self):
 *             _assertValidNode(self)             # <<<<<<<<<<<<<<
 *             return funicode(self._c_node.name)
 * 
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1856, __pyx_L1_error)

  /* "lxml/etree.pyx":1857
 *         def __get__(self):
 *             _assertValidNode(self)
 *             return funicode(self._c_node.name)             # <<<<<<<<<<<<<<
 * 
 *         def __set__(self, value):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_self->__pyx_base.__pyx_base._c_node->name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1857, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1855
 *     property target:
 *         # not in ElementTree
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             return funicode(self._c_node.name)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ProcessingInstruction.target.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1859
 *             return funicode(self._c_node.name)
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             value = _utf8(value)
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_22_ProcessingInstruction_6target_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_4lxml_5etree_22_ProcessingInstruction_6target_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_22_ProcessingInstruction_6target_2__set__(((struct __pyx_obj_4lxml_5etree__ProcessingInstruction *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_22_ProcessingInstruction_6target_2__set__(struct __pyx_obj_4lxml_5etree__ProcessingInstruction *__pyx_v_self, PyObject *__pyx_v_value) {
  const xmlChar *__pyx_v_c_text;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);

  /* "lxml/etree.pyx":1860
 * 
 *         def __set__(self, value):
 *             _assertValidNode(self)             # <<<<<<<<<<<<<<
 *             value = _utf8(value)
 *             c_text = _xcstr(value)
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1860, __pyx_L1_error)

  /* "lxml/etree.pyx":1861
 *         def __set__(self, value):
 *             _assertValidNode(self)
 *             value = _utf8(value)             # <<<<<<<<<<<<<<
 *             c_text = _xcstr(value)
 *             tree.xmlNodeSetName(self._c_node, c_text)
*/
  __pyx_t_2 = __pyx_f_4lxml_5etree__utf8(__pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1861, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "lxml/etree.pyx":1862
 *             _assertValidNode(self)
 *             value = _utf8(value)
 *             c_text = _xcstr(value)             # <<<<<<<<<<<<<<
 *             tree.xmlNodeSetName(self._c_node, c_text)
 * 
*/
  __pyx_v_c_text = (const xmlChar*)PyBytes_AS_STRING(__pyx_v_value);

  /* "lxml/etree.pyx":1863
 *             value = _utf8(value)
 *             c_text = _xcstr(value)
 *             tree.xmlNodeSetName(self._c_node, c_text)             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
*/
  xmlNodeSetName(__pyx_v_self->__pyx_base.__pyx_base._c_node, __pyx_v_c_text);

  /* "lxml/etree.pyx":1859
 *             return funicode(self._c_node.name)
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             value = _utf8(value)
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ProcessingInstruction.target.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1865
 *             tree.xmlNodeSetName(self._c_node, c_text)
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         text = self.text
 *         if text:
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_22_ProcessingInstruction_1__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_22_ProcessingInstruction_1__repr__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_22_ProcessingInstruction___repr__(((struct __pyx_obj_4lxml_5etree__ProcessingInstruction *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_22_ProcessingInstruction___repr__(struct __pyx_obj_4lxml_5etree__ProcessingInstruction *__pyx_v_self) {
  PyObject *__pyx_v_text = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4[5];
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "lxml/etree.pyx":1866
 * 
 *     def __repr__(self):
 *         text = self.text             # <<<<<<<<<<<<<<
 *         if text:
 *             return "<?%s %s?>" % (self.target, text)
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_text); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1866, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_text = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "lxml/etree.pyx":1867
 *     def __repr__(self):
 *         text = self.text
 *         if text:             # <<<<<<<<<<<<<<
 *             return "<?%s %s?>" % (self.target, text)
 *         else:
*/
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_text); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 1867, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":1868
 *         text = self.text
 *         if text:
 *             return "<?%s %s?>" % (self.target, text)             # <<<<<<<<<<<<<<
 *         else:
 *             return "<?%s?>" % self.target
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_target); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1868, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_t_1), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1868, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_v_text), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1868, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u__17;
    __pyx_t_4[1] = __pyx_t_3;
    __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u__7;
    __pyx_t_4[3] = __pyx_t_1;
    __pyx_t_4[4] = __pyx_mstate_global->__pyx_kp_u__18;
    __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_4, 5, 2 * 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 1 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1));
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1868, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "lxml/etree.pyx":1867
 *     def __repr__(self):
 *         text = self.text
 *         if text:             # <<<<<<<<<<<<<<
 *             return "<?%s %s?>" % (self.target, text)
 *         else:
*/
  }

  /* "lxml/etree.pyx":1870
 *             return "<?%s %s?>" % (self.target, text)
 *         else:
 *             return "<?%s?>" % self.target             # <<<<<<<<<<<<<<
 * 
 *     def get(self, key, default=None):
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_target); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1870, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = __Pyx_PyUnicode_FormatSafe(__pyx_mstate_global->__pyx_kp_u_s_2, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1870, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
  }

  /* "lxml/etree.pyx":1865
 *             tree.xmlNodeSetName(self._c_node, c_text)
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         text = self.text
 *         if text:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._ProcessingInstruction.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_text);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1872
 *             return "<?%s?>" % self.target
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         """get(self, key, default=None)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_22_ProcessingInstruction_3get(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_22_ProcessingInstruction_2get, "get(self, key, default=None)\n\n        Try to parse pseudo-attributes from the text content of the\n        processing instruction, search for one with the given key as\n        name and return its associated value.\n\n        Note that this is only a convenience method for the most\n        common case that all text content is structured in\n        attribute-like name-value pairs with properly quoted values.\n        It is not guaranteed to work for all possible text content.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_22_ProcessingInstruction_3get = {"get", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_22_ProcessingInstruction_3get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_22_ProcessingInstruction_2get};
static PyObject *__pyx_pw_4lxml_5etree_22_ProcessingInstruction_3get(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_default = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_key,&__pyx_mstate_global->__pyx_n_u_default,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1872, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1872, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1872, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "get", 0) < (0)) __PYX_ERR(0, 1872, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, i); __PYX_ERR(0, 1872, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1872, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1872, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_key = values[0];
    __pyx_v_default = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 1872, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._ProcessingInstruction.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_22_ProcessingInstruction_2get(((struct __pyx_obj_4lxml_5etree__ProcessingInstruction *)__pyx_v_self), __pyx_v_key, __pyx_v_default);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_22_ProcessingInstruction_2get(struct __pyx_obj_4lxml_5etree__ProcessingInstruction *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get", 0);

  /* "lxml/etree.pyx":1884
 *         It is not guaranteed to work for all possible text content.
 *         """
 *         return self.attrib.get(key, default)             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_attrib); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1884, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __pyx_t_3;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_v_key, __pyx_v_default};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1884, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1872
 *             return "<?%s?>" % self.target
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         """get(self, key, default=None)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._ProcessingInstruction.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1886
 *         return self.attrib.get(key, default)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def attrib(self):
 *         """Returns a dict containing all pseudo-attributes that can be
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_22_ProcessingInstruction_6attrib_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_22_ProcessingInstruction_6attrib_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_22_ProcessingInstruction_6attrib___get__(((struct __pyx_obj_4lxml_5etree__ProcessingInstruction *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_22_ProcessingInstruction_6attrib___get__(struct __pyx_obj_4lxml_5etree__ProcessingInstruction *__pyx_v_self) {
  PyObject *__pyx_8genexpr9__pyx_v_attr = NULL;
  PyObject *__pyx_8genexpr9__pyx_v_value1 = NULL;
  PyObject *__pyx_8genexpr9__pyx_v_value2 = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  size_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  PyObject *(*__pyx_t_9)(PyObject *);
  PyObject *__pyx_t_10 = NULL;
  PyObject *(*__pyx_t_11)(PyObject *);
  int __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lxml/etree.pyx":1893
 *         XML node, although this is not guaranteed to stay this way.
 *         """
 *         return { attr : (value1 or value2)             # <<<<<<<<<<<<<<
 *                  for attr, value1, value2 in _FIND_PI_ATTRIBUTES(' ' + self.text) }
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  { /* enter inner scope */
    __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1893, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_1);

    /* "lxml/etree.pyx":1894
 *         """
 *         return { attr : (value1 or value2)
 *                  for attr, value1, value2 in _FIND_PI_ATTRIBUTES(' ' + self.text) }             # <<<<<<<<<<<<<<
 * 
 * cdef object _FIND_PI_ATTRIBUTES = re.compile(r'\s+(\w+)\s*=\s*(?:\'([^\']*)\'|"([^"]*)")', re.U).findall
*/
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_v_4lxml_5etree__FIND_PI_ATTRIBUTES);
    __pyx_t_4 = __pyx_v_4lxml_5etree__FIND_PI_ATTRIBUTES; 
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_text); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1894, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyNumber_Add(__pyx_mstate_global->__pyx_kp_u__7, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1894, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_7 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
      __pyx_t_7 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_6};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1894, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
      __pyx_t_4 = __pyx_t_2; __Pyx_INCREF(__pyx_t_4);
      __pyx_t_8 = 0;
      __pyx_t_9 = NULL;
    } else {
      __pyx_t_8 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1894, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_9 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1894, __pyx_L5_error)
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    for (;;) {
      if (likely(!__pyx_t_9)) {
        if (likely(PyList_CheckExact(__pyx_t_4))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_4);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1894, __pyx_L5_error)
            #endif
            if (__pyx_t_8 >= __pyx_temp) break;
          }
          __pyx_t_2 = __Pyx_PyList_GetItemRefFast(__pyx_t_4, __pyx_t_8, __Pyx_ReferenceSharing_OwnStrongReference);
          ++__pyx_t_8;
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1894, __pyx_L5_error)
            #endif
            if (__pyx_t_8 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_8));
          #else
          __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_8);
          #endif
          ++__pyx_t_8;
        }
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1894, __pyx_L5_error)
      } else {
        __pyx_t_2 = __pyx_t_9(__pyx_t_4);
        if (unlikely(!__pyx_t_2)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 1894, __pyx_L5_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_2);
      if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
        PyObject* sequence = __pyx_t_2;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 3)) {
          if (size > 3) __Pyx_RaiseTooManyValuesError(3);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(0, 1894, __pyx_L5_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0);
          __Pyx_INCREF(__pyx_t_6);
          __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
          __Pyx_INCREF(__pyx_t_3);
          __pyx_t_5 = PyTuple_GET_ITEM(sequence, 2);
          __Pyx_INCREF(__pyx_t_5);
        } else {
          __pyx_t_6 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
          if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1894, __pyx_L5_error)
          __Pyx_XGOTREF(__pyx_t_6);
          __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
          if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1894, __pyx_L5_error)
          __Pyx_XGOTREF(__pyx_t_3);
          __pyx_t_5 = __Pyx_PyList_GetItemRefFast(sequence, 2, __Pyx_ReferenceSharing_SharedReference);
          if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1894, __pyx_L5_error)
          __Pyx_XGOTREF(__pyx_t_5);
        }
        #else
        __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1894, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1894, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_5 = __Pyx_PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1894, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_10 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1894, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_11 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_10);
        index = 0; __pyx_t_6 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_6)) goto __pyx_L8_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_6);
        index = 1; __pyx_t_3 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_3)) goto __pyx_L8_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_3);
        index = 2; __pyx_t_5 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_5)) goto __pyx_L8_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_5);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 3) < (0)) __PYX_ERR(0, 1894, __pyx_L5_error)
        __pyx_t_11 = NULL;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        goto __pyx_L9_unpacking_done;
        __pyx_L8_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_11 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(0, 1894, __pyx_L5_error)
        __pyx_L9_unpacking_done:;
      }
      __Pyx_XDECREF_SET(__pyx_8genexpr9__pyx_v_attr, __pyx_t_6);
      __pyx_t_6 = 0;
      __Pyx_XDECREF_SET(__pyx_8genexpr9__pyx_v_value1, __pyx_t_3);
      __pyx_t_3 = 0;
      __Pyx_XDECREF_SET(__pyx_8genexpr9__pyx_v_value2, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "lxml/etree.pyx":1893
 *         XML node, although this is not guaranteed to stay this way.
 *         """
 *         return { attr : (value1 or value2)             # <<<<<<<<<<<<<<
 *                  for attr, value1, value2 in _FIND_PI_ATTRIBUTES(' ' + self.text) }
 * 
*/
      __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_8genexpr9__pyx_v_value1); if (unlikely((__pyx_t_12 < 0))) __PYX_ERR(0, 1893, __pyx_L5_error)
      if (!__pyx_t_12) {
      } else {
        __Pyx_INCREF(__pyx_8genexpr9__pyx_v_value1);
        __pyx_t_2 = __pyx_8genexpr9__pyx_v_value1;
        goto __pyx_L10_bool_binop_done;
      }
      __Pyx_INCREF(__pyx_8genexpr9__pyx_v_value2);
      __pyx_t_2 = __pyx_8genexpr9__pyx_v_value2;
      __pyx_L10_bool_binop_done:;
      if (unlikely(PyDict_SetItem(__pyx_t_1, (PyObject*)__pyx_8genexpr9__pyx_v_attr, (PyObject*)__pyx_t_2))) __PYX_ERR(0, 1893, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "lxml/etree.pyx":1894
 *         """
 *         return { attr : (value1 or value2)
 *                  for attr, value1, value2 in _FIND_PI_ATTRIBUTES(' ' + self.text) }             # <<<<<<<<<<<<<<
 * 
 * cdef object _FIND_PI_ATTRIBUTES = re.compile(r'\s+(\w+)\s*=\s*(?:\'([^\']*)\'|"([^"]*)")', re.U).findall
*/
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_8genexpr9__pyx_v_attr); __pyx_8genexpr9__pyx_v_attr = 0;
    __Pyx_XDECREF(__pyx_8genexpr9__pyx_v_value1); __pyx_8genexpr9__pyx_v_value1 = 0;
    __Pyx_XDECREF(__pyx_8genexpr9__pyx_v_value2); __pyx_8genexpr9__pyx_v_value2 = 0;
    goto __pyx_L13_exit_scope;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_8genexpr9__pyx_v_attr); __pyx_8genexpr9__pyx_v_attr = 0;
    __Pyx_XDECREF(__pyx_8genexpr9__pyx_v_value1); __pyx_8genexpr9__pyx_v_value1 = 0;
    __Pyx_XDECREF(__pyx_8genexpr9__pyx_v_value2); __pyx_8genexpr9__pyx_v_value2 = 0;
    goto __pyx_L1_error;
    __pyx_L13_exit_scope:;
  } /* exit inner scope */
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1886
 *         return self.attrib.get(key, default)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def attrib(self):
 *         """Returns a dict containing all pseudo-attributes that can be
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("lxml.etree._ProcessingInstruction.attrib.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_8genexpr9__pyx_v_attr);
  __Pyx_XDECREF(__pyx_8genexpr9__pyx_v_value1);
  __Pyx_XDECREF(__pyx_8genexpr9__pyx_v_value2);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1899
 * 
 * cdef class _Entity(__ContentOnlyElement):
 *     @property             # <<<<<<<<<<<<<<
 *     def tag(self):
 *         return Entity
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_Entity_3tag_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7_Entity_3tag_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_7_Entity_3tag___get__(((struct __pyx_obj_4lxml_5etree__Entity *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_7_Entity_3tag___get__(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__Entity *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lxml/etree.pyx":1901
 *     @property
 *     def tag(self):
 *         return Entity             # <<<<<<<<<<<<<<
 * 
 *     property name:
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_Entity); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1901, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1899
 * 
 * cdef class _Entity(__ContentOnlyElement):
 *     @property             # <<<<<<<<<<<<<<
 *     def tag(self):
 *         return Entity
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._Entity.tag.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1905
 *     property name:
 *         # not in ElementTree
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             return funicode(self._c_node.name)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_Entity_4name_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7_Entity_4name_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_7_Entity_4name___get__(((struct __pyx_obj_4lxml_5etree__Entity *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_7_Entity_4name___get__(struct __pyx_obj_4lxml_5etree__Entity *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lxml/etree.pyx":1906
 *         # not in ElementTree
 *         def __get__(self):
 *             _assertValidNode(self)             # <<<<<<<<<<<<<<
 *             return funicode(self._c_node.name)
 * 
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1906, __pyx_L1_error)

  /* "lxml/etree.pyx":1907
 *         def __get__(self):
 *             _assertValidNode(self)
 *             return funicode(self._c_node.name)             # <<<<<<<<<<<<<<
 * 
 *         def __set__(self, value):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_self->__pyx_base.__pyx_base._c_node->name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1907, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1905
 *     property name:
 *         # not in ElementTree
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             return funicode(self._c_node.name)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Entity.name.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1909
 *             return funicode(self._c_node.name)
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             value_utf = _utf8(value)
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_7_Entity_4name_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_4lxml_5etree_7_Entity_4name_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_7_Entity_4name_2__set__(((struct __pyx_obj_4lxml_5etree__Entity *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_7_Entity_4name_2__set__(struct __pyx_obj_4lxml_5etree__Entity *__pyx_v_self, PyObject *__pyx_v_value) {
  PyObject *__pyx_v_value_utf = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5[3];
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "lxml/etree.pyx":1910
 * 
 *         def __set__(self, value):
 *             _assertValidNode(self)             # <<<<<<<<<<<<<<
 *             value_utf = _utf8(value)
 *             if b'&' in value_utf or b';' in value_utf:
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1910, __pyx_L1_error)

  /* "lxml/etree.pyx":1911
 *         def __set__(self, value):
 *             _assertValidNode(self)
 *             value_utf = _utf8(value)             # <<<<<<<<<<<<<<
 *             if b'&' in value_utf or b';' in value_utf:
 *                 raise ValueError, f"Invalid entity name '{value}'"
*/
  __pyx_t_2 = __pyx_f_4lxml_5etree__utf8(__pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1911, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_value_utf = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "lxml/etree.pyx":1912
 *             _assertValidNode(self)
 *             value_utf = _utf8(value)
 *             if b'&' in value_utf or b';' in value_utf:             # <<<<<<<<<<<<<<
 *                 raise ValueError, f"Invalid entity name '{value}'"
 *             tree.xmlNodeSetName(self._c_node, _xcstr(value_utf))
*/
  __pyx_t_4 = (__Pyx_PySequence_ContainsTF(__pyx_mstate_global->__pyx_kp_b__19, __pyx_v_value_utf, Py_EQ)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 1912, __pyx_L1_error)
  if (!__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = (__Pyx_PySequence_ContainsTF(__pyx_mstate_global->__pyx_kp_b__20, __pyx_v_value_utf, Py_EQ)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 1912, __pyx_L1_error)
  __pyx_t_3 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (unlikely(__pyx_t_3)) {

    /* "lxml/etree.pyx":1913
 *             value_utf = _utf8(value)
 *             if b'&' in value_utf or b';' in value_utf:
 *                 raise ValueError, f"Invalid entity name '{value}'"             # <<<<<<<<<<<<<<
 *             tree.xmlNodeSetName(self._c_node, _xcstr(value_utf))
 * 
*/
    __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_v_value, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1913, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5[0] = __pyx_mstate_global->__pyx_kp_u_Invalid_entity_name;
    __pyx_t_5[1] = __pyx_t_2;
    __pyx_t_5[2] = __pyx_mstate_global->__pyx_kp_u__4;
    __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_5, 3, 21 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2));
    if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1913, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_t_6, 0, 0);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __PYX_ERR(0, 1913, __pyx_L1_error)

    /* "lxml/etree.pyx":1912
 *             _assertValidNode(self)
 *             value_utf = _utf8(value)
 *             if b'&' in value_utf or b';' in value_utf:             # <<<<<<<<<<<<<<
 *                 raise ValueError, f"Invalid entity name '{value}'"
 *             tree.xmlNodeSetName(self._c_node, _xcstr(value_utf))
*/
  }

  /* "lxml/etree.pyx":1914
 *             if b'&' in value_utf or b';' in value_utf:
 *                 raise ValueError, f"Invalid entity name '{value}'"
 *             tree.xmlNodeSetName(self._c_node, _xcstr(value_utf))             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  xmlNodeSetName(__pyx_v_self->__pyx_base.__pyx_base._c_node, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_value_utf));

  /* "lxml/etree.pyx":1909
 *             return funicode(self._c_node.name)
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             value_utf = _utf8(value)
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._Entity.name.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value_utf);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1916
 *             tree.xmlNodeSetName(self._c_node, _xcstr(value_utf))
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def text(self):
 *         # FIXME: should this be None or '&[VALUE];' or the resolved
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_Entity_4text_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7_Entity_4text_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_7_Entity_4text___get__(((struct __pyx_obj_4lxml_5etree__Entity *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_7_Entity_4text___get__(struct __pyx_obj_4lxml_5etree__Entity *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4[3];
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lxml/etree.pyx":1920
 *         # FIXME: should this be None or '&[VALUE];' or the resolved
 *         # entity value ?
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         return f'&{funicode(self._c_node.name)};'
 * 
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1920, __pyx_L1_error)

  /* "lxml/etree.pyx":1921
 *         # entity value ?
 *         _assertValidNode(self)
 *         return f'&{funicode(self._c_node.name)};'             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_self->__pyx_base.__pyx_base._c_node->name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1921, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyUnicode_Unicode(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1921, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u__19;
  __pyx_t_4[1] = __pyx_t_3;
  __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u__20;
  __pyx_t_2 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, 1 * 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3));
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1921, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1916
 *             tree.xmlNodeSetName(self._c_node, _xcstr(value_utf))
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def text(self):
 *         # FIXME: should this be None or '&[VALUE];' or the resolved
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Entity.text.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1923
 *         return f'&{funicode(self._c_node.name)};'
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "&%s;" % self.name
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_Entity_1__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7_Entity_1__repr__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_7_Entity___repr__(((struct __pyx_obj_4lxml_5etree__Entity *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_7_Entity___repr__(struct __pyx_obj_4lxml_5etree__Entity *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "lxml/etree.pyx":1924
 * 
 *     def __repr__(self):
 *         return "&%s;" % self.name             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1924, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyUnicode_FormatSafe(__pyx_mstate_global->__pyx_kp_u_s_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1924, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1923
 *         return f'&{funicode(self._c_node.name)};'
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "&%s;" % self.name
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Entity.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1951
 *     cdef readonly unicode localname
 *     cdef readonly unicode namespace
 *     def __init__(self, text_or_uri_or_element, tag=None):             # <<<<<<<<<<<<<<
 *         if text_or_uri_or_element is None:
 *             # Allow None as no namespace.
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_5QName_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_5QName_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_text_or_uri_or_element = 0;
  PyObject *__pyx_v_tag = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_text_or_uri_or_element,&__pyx_mstate_global->__pyx_n_u_tag,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1951, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1951, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1951, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(0, 1951, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, i); __PYX_ERR(0, 1951, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1951, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1951, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_text_or_uri_or_element = values[0];
    __pyx_v_tag = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 1951, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.QName.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_5QName___init__(((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_self), __pyx_v_text_or_uri_or_element, __pyx_v_tag);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_5QName___init__(struct __pyx_obj_4lxml_5etree_QName *__pyx_v_self, PyObject *__pyx_v_text_or_uri_or_element, PyObject *__pyx_v_tag) {
  PyObject *__pyx_v_ns_utf = NULL;
  PyObject *__pyx_v_tag_utf = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6[4];
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_INCREF(__pyx_v_text_or_uri_or_element);
  __Pyx_INCREF(__pyx_v_tag);

  /* "lxml/etree.pyx":1952
 *     cdef readonly unicode namespace
 *     def __init__(self, text_or_uri_or_element, tag=None):
 *         if text_or_uri_or_element is None:             # <<<<<<<<<<<<<<
 *             # Allow None as no namespace.
 *             text_or_uri_or_element, tag = tag, None
*/
  __pyx_t_1 = (__pyx_v_text_or_uri_or_element == Py_None);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":1954
 *         if text_or_uri_or_element is None:
 *             # Allow None as no namespace.
 *             text_or_uri_or_element, tag = tag, None             # <<<<<<<<<<<<<<
 *         if not _isString(text_or_uri_or_element):
 *             if isinstance(text_or_uri_or_element, _Element):
*/
    __pyx_t_2 = __pyx_v_tag;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = Py_None;
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_text_or_uri_or_element, __pyx_t_2);
    __pyx_t_2 = 0;
    __Pyx_DECREF_SET(__pyx_v_tag, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "lxml/etree.pyx":1952
 *     cdef readonly unicode namespace
 *     def __init__(self, text_or_uri_or_element, tag=None):
 *         if text_or_uri_or_element is None:             # <<<<<<<<<<<<<<
 *             # Allow None as no namespace.
 *             text_or_uri_or_element, tag = tag, None
*/
  }

  /* "lxml/etree.pyx":1955
 *             # Allow None as no namespace.
 *             text_or_uri_or_element, tag = tag, None
 *         if not _isString(text_or_uri_or_element):             # <<<<<<<<<<<<<<
 *             if isinstance(text_or_uri_or_element, _Element):
 *                 text_or_uri_or_element = (<_Element>text_or_uri_or_element).tag
*/
  __pyx_t_1 = (!_isString(__pyx_v_text_or_uri_or_element));
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":1956
 *             text_or_uri_or_element, tag = tag, None
 *         if not _isString(text_or_uri_or_element):
 *             if isinstance(text_or_uri_or_element, _Element):             # <<<<<<<<<<<<<<
 *                 text_or_uri_or_element = (<_Element>text_or_uri_or_element).tag
 *                 if not _isString(text_or_uri_or_element):
*/
    __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_text_or_uri_or_element, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element); 
    if (__pyx_t_1) {

      /* "lxml/etree.pyx":1957
 *         if not _isString(text_or_uri_or_element):
 *             if isinstance(text_or_uri_or_element, _Element):
 *                 text_or_uri_or_element = (<_Element>text_or_uri_or_element).tag             # <<<<<<<<<<<<<<
 *                 if not _isString(text_or_uri_or_element):
 *                     raise ValueError, f"Invalid input tag of type {type(text_or_uri_or_element)!r}"
*/
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_text_or_uri_or_element, __pyx_mstate_global->__pyx_n_u_tag); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1957, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_text_or_uri_or_element, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "lxml/etree.pyx":1958
 *             if isinstance(text_or_uri_or_element, _Element):
 *                 text_or_uri_or_element = (<_Element>text_or_uri_or_element).tag
 *                 if not _isString(text_or_uri_or_element):             # <<<<<<<<<<<<<<
 *                     raise ValueError, f"Invalid input tag of type {type(text_or_uri_or_element)!r}"
 *             elif isinstance(text_or_uri_or_element, QName):
*/
      __pyx_t_1 = (!_isString(__pyx_v_text_or_uri_or_element));
      if (unlikely(__pyx_t_1)) {

        /* "lxml/etree.pyx":1959
 *                 text_or_uri_or_element = (<_Element>text_or_uri_or_element).tag
 *                 if not _isString(text_or_uri_or_element):
 *                     raise ValueError, f"Invalid input tag of type {type(text_or_uri_or_element)!r}"             # <<<<<<<<<<<<<<
 *             elif isinstance(text_or_uri_or_element, QName):
 *                 text_or_uri_or_element = (<QName>text_or_uri_or_element).text
*/
        __pyx_t_3 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(((PyObject *)Py_TYPE(__pyx_v_text_or_uri_or_element))), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1959, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_Invalid_input_tag_of_type, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1959, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_t_2, 0, 0);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __PYX_ERR(0, 1959, __pyx_L1_error)

        /* "lxml/etree.pyx":1958
 *             if isinstance(text_or_uri_or_element, _Element):
 *                 text_or_uri_or_element = (<_Element>text_or_uri_or_element).tag
 *                 if not _isString(text_or_uri_or_element):             # <<<<<<<<<<<<<<
 *                     raise ValueError, f"Invalid input tag of type {type(text_or_uri_or_element)!r}"
 *             elif isinstance(text_or_uri_or_element, QName):
*/
      }

      /* "lxml/etree.pyx":1956
 *             text_or_uri_or_element, tag = tag, None
 *         if not _isString(text_or_uri_or_element):
 *             if isinstance(text_or_uri_or_element, _Element):             # <<<<<<<<<<<<<<
 *                 text_or_uri_or_element = (<_Element>text_or_uri_or_element).tag
 *                 if not _isString(text_or_uri_or_element):
*/
      goto __pyx_L5;
    }

    /* "lxml/etree.pyx":1960
 *                 if not _isString(text_or_uri_or_element):
 *                     raise ValueError, f"Invalid input tag of type {type(text_or_uri_or_element)!r}"
 *             elif isinstance(text_or_uri_or_element, QName):             # <<<<<<<<<<<<<<
 *                 text_or_uri_or_element = (<QName>text_or_uri_or_element).text
 *             elif text_or_uri_or_element is not None:
*/
    __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_text_or_uri_or_element, __pyx_mstate_global->__pyx_ptype_4lxml_5etree_QName); 
    if (__pyx_t_1) {

      /* "lxml/etree.pyx":1961
 *                     raise ValueError, f"Invalid input tag of type {type(text_or_uri_or_element)!r}"
 *             elif isinstance(text_or_uri_or_element, QName):
 *                 text_or_uri_or_element = (<QName>text_or_uri_or_element).text             # <<<<<<<<<<<<<<
 *             elif text_or_uri_or_element is not None:
 *                 text_or_uri_or_element = unicode(text_or_uri_or_element)
*/
      __pyx_t_2 = ((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_text_or_uri_or_element)->text;
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_DECREF_SET(__pyx_v_text_or_uri_or_element, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "lxml/etree.pyx":1960
 *                 if not _isString(text_or_uri_or_element):
 *                     raise ValueError, f"Invalid input tag of type {type(text_or_uri_or_element)!r}"
 *             elif isinstance(text_or_uri_or_element, QName):             # <<<<<<<<<<<<<<
 *                 text_or_uri_or_element = (<QName>text_or_uri_or_element).text
 *             elif text_or_uri_or_element is not None:
*/
      goto __pyx_L5;
    }

    /* "lxml/etree.pyx":1962
 *             elif isinstance(text_or_uri_or_element, QName):
 *                 text_or_uri_or_element = (<QName>text_or_uri_or_element).text
 *             elif text_or_uri_or_element is not None:             # <<<<<<<<<<<<<<
 *                 text_or_uri_or_element = unicode(text_or_uri_or_element)
 *             else:
*/
    __pyx_t_1 = (__pyx_v_text_or_uri_or_element != Py_None);
    if (likely(__pyx_t_1)) {

      /* "lxml/etree.pyx":1963
 *                 text_or_uri_or_element = (<QName>text_or_uri_or_element).text
 *             elif text_or_uri_or_element is not None:
 *                 text_or_uri_or_element = unicode(text_or_uri_or_element)             # <<<<<<<<<<<<<<
 *             else:
 *                 raise ValueError, f"Invalid input tag of type {type(text_or_uri_or_element)!r}"
*/
      __pyx_t_2 = __Pyx_PyObject_Unicode(__pyx_v_text_or_uri_or_element); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1963, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF_SET(__pyx_v_text_or_uri_or_element, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "lxml/etree.pyx":1962
 *             elif isinstance(text_or_uri_or_element, QName):
 *                 text_or_uri_or_element = (<QName>text_or_uri_or_element).text
 *             elif text_or_uri_or_element is not None:             # <<<<<<<<<<<<<<
 *                 text_or_uri_or_element = unicode(text_or_uri_or_element)
 *             else:
*/
      goto __pyx_L5;
    }

    /* "lxml/etree.pyx":1965
 *                 text_or_uri_or_element = unicode(text_or_uri_or_element)
 *             else:
 *                 raise ValueError, f"Invalid input tag of type {type(text_or_uri_or_element)!r}"             # <<<<<<<<<<<<<<
 * 
 *         ns_utf, tag_utf = _getNsTag(text_or_uri_or_element)
*/
    /*else*/ {
      __pyx_t_2 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(((PyObject *)Py_TYPE(__pyx_v_text_or_uri_or_element))), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1965, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_Invalid_input_tag_of_type, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1965, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_t_3, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(0, 1965, __pyx_L1_error)
    }
    __pyx_L5:;

    /* "lxml/etree.pyx":1955
 *             # Allow None as no namespace.
 *             text_or_uri_or_element, tag = tag, None
 *         if not _isString(text_or_uri_or_element):             # <<<<<<<<<<<<<<
 *             if isinstance(text_or_uri_or_element, _Element):
 *                 text_or_uri_or_element = (<_Element>text_or_uri_or_element).tag
*/
  }

  /* "lxml/etree.pyx":1967
 *                 raise ValueError, f"Invalid input tag of type {type(text_or_uri_or_element)!r}"
 * 
 *         ns_utf, tag_utf = _getNsTag(text_or_uri_or_element)             # <<<<<<<<<<<<<<
 *         if tag is not None:
 *             # either ('ns', 'tag') or ('{ns}oldtag', 'newtag')
*/
  __pyx_t_3 = __pyx_f_4lxml_5etree__getNsTag(__pyx_v_text_or_uri_or_element); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1967, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (likely(__pyx_t_3 != Py_None)) {
    PyObject* sequence = __pyx_t_3;
    Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1967, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1967, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1967, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 1967, __pyx_L1_error)
  }
  __pyx_v_ns_utf = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_tag_utf = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "lxml/etree.pyx":1968
 * 
 *         ns_utf, tag_utf = _getNsTag(text_or_uri_or_element)
 *         if tag is not None:             # <<<<<<<<<<<<<<
 *             # either ('ns', 'tag') or ('{ns}oldtag', 'newtag')
 *             if ns_utf is None:
*/
  __pyx_t_1 = (__pyx_v_tag != Py_None);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":1970
 *         if tag is not None:
 *             # either ('ns', 'tag') or ('{ns}oldtag', 'newtag')
 *             if ns_utf is None:             # <<<<<<<<<<<<<<
 *                 ns_utf = tag_utf # case 1: namespace ended up as tag name
 *             tag_utf = _utf8(tag)
*/
    __pyx_t_1 = (__pyx_v_ns_utf == Py_None);
    if (__pyx_t_1) {

      /* "lxml/etree.pyx":1971
 *             # either ('ns', 'tag') or ('{ns}oldtag', 'newtag')
 *             if ns_utf is None:
 *                 ns_utf = tag_utf # case 1: namespace ended up as tag name             # <<<<<<<<<<<<<<
 *             tag_utf = _utf8(tag)
 *         _tagValidOrRaise(tag_utf)
*/
      __Pyx_INCREF(__pyx_v_tag_utf);
      __Pyx_DECREF_SET(__pyx_v_ns_utf, __pyx_v_tag_utf);

      /* "lxml/etree.pyx":1970
 *         if tag is not None:
 *             # either ('ns', 'tag') or ('{ns}oldtag', 'newtag')
 *             if ns_utf is None:             # <<<<<<<<<<<<<<
 *                 ns_utf = tag_utf # case 1: namespace ended up as tag name
 *             tag_utf = _utf8(tag)
*/
    }

    /* "lxml/etree.pyx":1972
 *             if ns_utf is None:
 *                 ns_utf = tag_utf # case 1: namespace ended up as tag name
 *             tag_utf = _utf8(tag)             # <<<<<<<<<<<<<<
 *         _tagValidOrRaise(tag_utf)
 *         self.localname = (<bytes>tag_utf).decode('utf8')
*/
    __pyx_t_3 = __pyx_f_4lxml_5etree__utf8(__pyx_v_tag); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1972, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_tag_utf, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "lxml/etree.pyx":1968
 * 
 *         ns_utf, tag_utf = _getNsTag(text_or_uri_or_element)
 *         if tag is not None:             # <<<<<<<<<<<<<<
 *             # either ('ns', 'tag') or ('{ns}oldtag', 'newtag')
 *             if ns_utf is None:
*/
  }

  /* "lxml/etree.pyx":1973
 *                 ns_utf = tag_utf # case 1: namespace ended up as tag name
 *             tag_utf = _utf8(tag)
 *         _tagValidOrRaise(tag_utf)             # <<<<<<<<<<<<<<
 *         self.localname = (<bytes>tag_utf).decode('utf8')
 *         if ns_utf is None:
*/
  __pyx_t_5 = __pyx_f_4lxml_5etree__tagValidOrRaise(__pyx_v_tag_utf); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 1973, __pyx_L1_error)

  /* "lxml/etree.pyx":1974
 *             tag_utf = _utf8(tag)
 *         _tagValidOrRaise(tag_utf)
 *         self.localname = (<bytes>tag_utf).decode('utf8')             # <<<<<<<<<<<<<<
 *         if ns_utf is None:
 *             self.namespace = None
*/
  if (unlikely(__pyx_v_tag_utf == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "decode");
    __PYX_ERR(0, 1974, __pyx_L1_error)
  }
  __pyx_t_3 = __Pyx_decode_bytes(((PyObject*)__pyx_v_tag_utf), 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1974, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_v_self->localname);
  __Pyx_DECREF(__pyx_v_self->localname);
  __pyx_v_self->localname = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "lxml/etree.pyx":1975
 *         _tagValidOrRaise(tag_utf)
 *         self.localname = (<bytes>tag_utf).decode('utf8')
 *         if ns_utf is None:             # <<<<<<<<<<<<<<
 *             self.namespace = None
 *             self.text = self.localname
*/
  __pyx_t_1 = (__pyx_v_ns_utf == Py_None);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":1976
 *         self.localname = (<bytes>tag_utf).decode('utf8')
 *         if ns_utf is None:
 *             self.namespace = None             # <<<<<<<<<<<<<<
 *             self.text = self.localname
 *         else:
*/
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_self->__pyx_namespace);
    __Pyx_DECREF(__pyx_v_self->__pyx_namespace);
    __pyx_v_self->__pyx_namespace = ((PyObject*)Py_None);

    /* "lxml/etree.pyx":1977
 *         if ns_utf is None:
 *             self.namespace = None
 *             self.text = self.localname             # <<<<<<<<<<<<<<
 *         else:
 *             self.namespace = (<bytes>ns_utf).decode('utf8')
*/
    __pyx_t_3 = __pyx_v_self->localname;
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF(__pyx_v_self->text);
    __Pyx_DECREF(__pyx_v_self->text);
    __pyx_v_self->text = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "lxml/etree.pyx":1975
 *         _tagValidOrRaise(tag_utf)
 *         self.localname = (<bytes>tag_utf).decode('utf8')
 *         if ns_utf is None:             # <<<<<<<<<<<<<<
 *             self.namespace = None
 *             self.text = self.localname
*/
    goto __pyx_L9;
  }

  /* "lxml/etree.pyx":1979
 *             self.text = self.localname
 *         else:
 *             self.namespace = (<bytes>ns_utf).decode('utf8')             # <<<<<<<<<<<<<<
 *             self.text = "{%s}%s" % (self.namespace, self.localname)
 *     def __str__(self):
*/
  /*else*/ {
    if (unlikely(__pyx_v_ns_utf == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "decode");
      __PYX_ERR(0, 1979, __pyx_L1_error)
    }
    __pyx_t_3 = __Pyx_decode_bytes(((PyObject*)__pyx_v_ns_utf), 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1979, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF(__pyx_v_self->__pyx_namespace);
    __Pyx_DECREF(__pyx_v_self->__pyx_namespace);
    __pyx_v_self->__pyx_namespace = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "lxml/etree.pyx":1980
 *         else:
 *             self.namespace = (<bytes>ns_utf).decode('utf8')
 *             self.text = "{%s}%s" % (self.namespace, self.localname)             # <<<<<<<<<<<<<<
 *     def __str__(self):
 *         return self.text
*/
    __pyx_t_3 = __Pyx_PyUnicode_Unicode(__pyx_v_self->__pyx_namespace); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1980, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyUnicode_Unicode(__pyx_v_self->localname); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1980, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6[0] = __pyx_mstate_global->__pyx_kp_u__10;
    __pyx_t_6[1] = __pyx_t_3;
    __pyx_t_6[2] = __pyx_mstate_global->__pyx_kp_u__11;
    __pyx_t_6[3] = __pyx_t_4;
    __pyx_t_2 = __Pyx_PyUnicode_Join(__pyx_t_6, 4, 1 * 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4));
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1980, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_GOTREF(__pyx_v_self->text);
    __Pyx_DECREF(__pyx_v_self->text);
    __pyx_v_self->text = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;
  }
  __pyx_L9:;

  /* "lxml/etree.pyx":1951
 *     cdef readonly unicode localname
 *     cdef readonly unicode namespace
 *     def __init__(self, text_or_uri_or_element, tag=None):             # <<<<<<<<<<<<<<
 *         if text_or_uri_or_element is None:
 *             # Allow None as no namespace.
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.QName.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ns_utf);
  __Pyx_XDECREF(__pyx_v_tag_utf);
  __Pyx_XDECREF(__pyx_v_text_or_uri_or_element);
  __Pyx_XDECREF(__pyx_v_tag);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1981
 *             self.namespace = (<bytes>ns_utf).decode('utf8')
 *             self.text = "{%s}%s" % (self.namespace, self.localname)
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return self.text
 *     def __hash__(self):
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_5QName_3__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_5QName_3__str__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_5QName_2__str__(((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_5QName_2__str__(struct __pyx_obj_4lxml_5etree_QName *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__", 0);

  /* "lxml/etree.pyx":1982
 *             self.text = "{%s}%s" % (self.namespace, self.localname)
 *     def __str__(self):
 *         return self.text             # <<<<<<<<<<<<<<
 *     def __hash__(self):
 *         return hash(self.text)
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->text);
  __pyx_r = __pyx_v_self->text;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1981
 *             self.namespace = (<bytes>ns_utf).decode('utf8')
 *             self.text = "{%s}%s" % (self.namespace, self.localname)
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return self.text
 *     def __hash__(self):
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1983
 *     def __str__(self):
 *         return self.text
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         return hash(self.text)
 *     def __richcmp__(self, other, int op):
*/

/* Python wrapper */
static Py_hash_t __pyx_pw_4lxml_5etree_5QName_5__hash__(PyObject *__pyx_v_self); /*proto*/
static Py_hash_t __pyx_pw_4lxml_5etree_5QName_5__hash__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  Py_hash_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__hash__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_5QName_4__hash__(((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_hash_t __pyx_pf_4lxml_5etree_5QName_4__hash__(struct __pyx_obj_4lxml_5etree_QName *__pyx_v_self) {
  Py_hash_t __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_hash_t __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__hash__", 0);

  /* "lxml/etree.pyx":1984
 *         return self.text
 *     def __hash__(self):
 *         return hash(self.text)             # <<<<<<<<<<<<<<
 *     def __richcmp__(self, other, int op):
 *         try:
*/
  __pyx_t_1 = __pyx_v_self->text;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Hash(__pyx_t_1); if (unlikely(__pyx_t_2 == ((Py_hash_t)-1))) __PYX_ERR(0, 1984, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1983
 *     def __str__(self):
 *         return self.text
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         return hash(self.text)
 *     def __richcmp__(self, other, int op):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.QName.__hash__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  if (unlikely(__pyx_r == -1) && !PyErr_Occurred()) __pyx_r = -2;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1985
 *     def __hash__(self):
 *         return hash(self.text)
 *     def __richcmp__(self, other, int op):             # <<<<<<<<<<<<<<
 *         try:
 *             if type(other) is QName:
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_5QName_7__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_5QName_7__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__richcmp__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_5QName_6__richcmp__(((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_self), ((PyObject *)__pyx_v_other), ((int)__pyx_v_op));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_5QName_6__richcmp__(struct __pyx_obj_4lxml_5etree_QName *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__richcmp__", 0);
  __Pyx_INCREF(__pyx_v_other);

  /* "lxml/etree.pyx":1986
 *         return hash(self.text)
 *     def __richcmp__(self, other, int op):
 *         try:             # <<<<<<<<<<<<<<
 *             if type(other) is QName:
 *                 other = (<QName>other).text
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "lxml/etree.pyx":1987
 *     def __richcmp__(self, other, int op):
 *         try:
 *             if type(other) is QName:             # <<<<<<<<<<<<<<
 *                 other = (<QName>other).text
 *             elif not isinstance(other, unicode):
*/
      __pyx_t_4 = (((PyObject *)Py_TYPE(__pyx_v_other)) == ((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_QName));
      if (__pyx_t_4) {

        /* "lxml/etree.pyx":1988
 *         try:
 *             if type(other) is QName:
 *                 other = (<QName>other).text             # <<<<<<<<<<<<<<
 *             elif not isinstance(other, unicode):
 *                 other = unicode(other)
*/
        __pyx_t_5 = ((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_other)->text;
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_DECREF_SET(__pyx_v_other, __pyx_t_5);
        __pyx_t_5 = 0;

        /* "lxml/etree.pyx":1987
 *     def __richcmp__(self, other, int op):
 *         try:
 *             if type(other) is QName:             # <<<<<<<<<<<<<<
 *                 other = (<QName>other).text
 *             elif not isinstance(other, unicode):
*/
        goto __pyx_L9;
      }

      /* "lxml/etree.pyx":1989
 *             if type(other) is QName:
 *                 other = (<QName>other).text
 *             elif not isinstance(other, unicode):             # <<<<<<<<<<<<<<
 *                 other = unicode(other)
 *         except (ValueError, UnicodeDecodeError):
*/
      __pyx_t_4 = PyUnicode_Check(__pyx_v_other); 
      __pyx_t_6 = (!__pyx_t_4);
      if (__pyx_t_6) {

        /* "lxml/etree.pyx":1990
 *                 other = (<QName>other).text
 *             elif not isinstance(other, unicode):
 *                 other = unicode(other)             # <<<<<<<<<<<<<<
 *         except (ValueError, UnicodeDecodeError):
 *             return NotImplemented
*/
        __pyx_t_5 = __Pyx_PyObject_Unicode(__pyx_v_other); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1990, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF_SET(__pyx_v_other, __pyx_t_5);
        __pyx_t_5 = 0;

        /* "lxml/etree.pyx":1989
 *             if type(other) is QName:
 *                 other = (<QName>other).text
 *             elif not isinstance(other, unicode):             # <<<<<<<<<<<<<<
 *                 other = unicode(other)
 *         except (ValueError, UnicodeDecodeError):
*/
      }
      __pyx_L9:;

      /* "lxml/etree.pyx":1986
 *         return hash(self.text)
 *     def __richcmp__(self, other, int op):
 *         try:             # <<<<<<<<<<<<<<
 *             if type(other) is QName:
 *                 other = (<QName>other).text
*/
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "lxml/etree.pyx":1991
 *             elif not isinstance(other, unicode):
 *                 other = unicode(other)
 *         except (ValueError, UnicodeDecodeError):             # <<<<<<<<<<<<<<
 *             return NotImplemented
 *         return python.PyObject_RichCompare(self.text, other, op)
*/
    __pyx_t_7 = __Pyx_PyErr_ExceptionMatches2(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), ((PyObject *)(((PyTypeObject*)PyExc_UnicodeDecodeError))));
    if (__pyx_t_7) {
      __Pyx_AddTraceback("lxml.etree.QName.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_8, &__pyx_t_9) < 0) __PYX_ERR(0, 1991, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);

      /* "lxml/etree.pyx":1992
 *                 other = unicode(other)
 *         except (ValueError, UnicodeDecodeError):
 *             return NotImplemented             # <<<<<<<<<<<<<<
 *         return python.PyObject_RichCompare(self.text, other, op)
 * 
*/
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_builtin_NotImplemented);
      __pyx_r = __pyx_builtin_NotImplemented;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L6_except_return;
    }
    goto __pyx_L5_except_error;

    /* "lxml/etree.pyx":1986
 *         return hash(self.text)
 *     def __richcmp__(self, other, int op):
 *         try:             # <<<<<<<<<<<<<<
 *             if type(other) is QName:
 *                 other = (<QName>other).text
*/
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L8_try_end:;
  }

  /* "lxml/etree.pyx":1993
 *         except (ValueError, UnicodeDecodeError):
 *             return NotImplemented
 *         return python.PyObject_RichCompare(self.text, other, op)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_9 = __pyx_v_self->text;
  __Pyx_INCREF(__pyx_t_9);
  __pyx_t_8 = PyObject_RichCompare(__pyx_t_9, __pyx_v_other, __pyx_v_op); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1993, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_r = __pyx_t_8;
  __pyx_t_8 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1985
 *     def __hash__(self):
 *         return hash(self.text)
 *     def __richcmp__(self, other, int op):             # <<<<<<<<<<<<<<
 *         try:
 *             if type(other) is QName:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("lxml.etree.QName.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_other);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1948
 *     their text content.
 *     """
 *     cdef readonly unicode text             # <<<<<<<<<<<<<<
 *     cdef readonly unicode localname
 *     cdef readonly unicode namespace
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_5QName_4text_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_5QName_4text_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_5QName_4text___get__(((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_5QName_4text___get__(struct __pyx_obj_4lxml_5etree_QName *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->text);
  __pyx_r = __pyx_v_self->text;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1949
 *     """
 *     cdef readonly unicode text
 *     cdef readonly unicode localname             # <<<<<<<<<<<<<<
 *     cdef readonly unicode namespace
 *     def __init__(self, text_or_uri_or_element, tag=None):
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_5QName_9localname_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_5QName_9localname_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_5QName_9localname___get__(((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_5QName_9localname___get__(struct __pyx_obj_4lxml_5etree_QName *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->localname);
  __pyx_r = __pyx_v_self->localname;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1950
 *     cdef readonly unicode text
 *     cdef readonly unicode localname
 *     cdef readonly unicode namespace             # <<<<<<<<<<<<<<
 *     def __init__(self, text_or_uri_or_element, tag=None):
 *         if text_or_uri_or_element is None:
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_5QName_9namespace_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_5QName_9namespace_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_5QName_9namespace___get__(((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_5QName_9namespace___get__(struct __pyx_obj_4lxml_5etree_QName *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->__pyx_namespace);
  __pyx_r = __pyx_v_self->__pyx_namespace;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2005
 *     # to honour tree restructuring.  _doc can happily be None!
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef int _assertHasRoot(self) except -1:
 *         """We have to take care here: the document may not have a root node!
*/

static int __pyx_f_4lxml_5etree_12_ElementTree__assertHasRoot(struct LxmlElementTree *__pyx_v_self) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "lxml/etree.pyx":2012
 *         the caller program.
 *         """
 *         assert self._context_node is not None, \             # <<<<<<<<<<<<<<
 *                "ElementTree not initialized, missing root"
 *         return 0
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = (((PyObject *)__pyx_v_self->_context_node) != Py_None);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_mstate_global->__pyx_kp_u_ElementTree_not_initialized_miss, 0, 0);
      __PYX_ERR(0, 2012, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(0, 2012, __pyx_L1_error)
  #endif

  /* "lxml/etree.pyx":2014
 *         assert self._context_node is not None, \
 *                "ElementTree not initialized, missing root"
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     def parse(self, source, _BaseParser parser=None, *, base_url=None):
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":2005
 *     # to honour tree restructuring.  _doc can happily be None!
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef int _assertHasRoot(self) except -1:
 *         """We have to take care here: the document may not have a root node!
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._ElementTree._assertHasRoot", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "lxml/etree.pyx":2016
 *         return 0
 * 
 *     def parse(self, source, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *         """parse(self, source, parser=None, base_url=None)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_1parse(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_12_ElementTree_parse, "parse(self, source, parser=None, base_url=None)\n\n        Updates self with the content of source and returns its root.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_12_ElementTree_1parse = {"parse", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_1parse, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_parse};
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_1parse(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_source = 0;
  struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser = 0;
  PyObject *__pyx_v_base_url = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("parse (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_source,&__pyx_mstate_global->__pyx_n_u_parser,&__pyx_mstate_global->__pyx_n_u_base_url,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 2016, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 2016, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2016, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "parse", 0) < (0)) __PYX_ERR(0, 2016, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef((PyObject *)((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("parse", 0, 1, 2, i); __PYX_ERR(0, 2016, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 2016, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2016, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef((PyObject *)((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_source = values[0];
    __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)values[1]);
    __pyx_v_base_url = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("parse", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 2016, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._ElementTree.parse", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parser), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__BaseParser, 1, "parser", 0))) __PYX_ERR(0, 2016, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_12_ElementTree_parse(((struct LxmlElementTree *)__pyx_v_self), __pyx_v_source, __pyx_v_parser, __pyx_v_base_url);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_parse(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v_source, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser, PyObject *__pyx_v_base_url) {
  struct LxmlDocument *__pyx_v_doc = 0;
  PyObject *__pyx_v_result_container = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_t_9;
  char const *__pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  int __pyx_t_17;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("parse", 0);

  /* "lxml/etree.pyx":2021
 *         Updates self with the content of source and returns its root.
 *         """
 *         cdef _Document doc = None             # <<<<<<<<<<<<<<
 *         try:
 *             doc = _parseDocument(source, parser, base_url)
*/
  __Pyx_INCREF(Py_None);
  __pyx_v_doc = ((struct LxmlDocument *)Py_None);

  /* "lxml/etree.pyx":2022
 *         """
 *         cdef _Document doc = None
 *         try:             # <<<<<<<<<<<<<<
 *             doc = _parseDocument(source, parser, base_url)
 *         except _TargetParserResult as result_container:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "lxml/etree.pyx":2023
 *         cdef _Document doc = None
 *         try:
 *             doc = _parseDocument(source, parser, base_url)             # <<<<<<<<<<<<<<
 *         except _TargetParserResult as result_container:
 *             # raises a TypeError if we don't get an _Element
*/
      __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__parseDocument(__pyx_v_source, __pyx_v_parser, __pyx_v_base_url)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2023, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF_SET(__pyx_v_doc, ((struct LxmlDocument *)__pyx_t_4));
      __pyx_t_4 = 0;

      /* "lxml/etree.pyx":2022
 *         """
 *         cdef _Document doc = None
 *         try:             # <<<<<<<<<<<<<<
 *             doc = _parseDocument(source, parser, base_url)
 *         except _TargetParserResult as result_container:
*/
    }

    /* "lxml/etree.pyx":2028
 *             self._context_node = result_container.result
 *         else:
 *             self._context_node = doc.getroot()             # <<<<<<<<<<<<<<
 *         self._doc = None if self._context_node is not None else doc
 *         return self._context_node
*/
    /*else:*/ {
      __pyx_t_4 = __pyx_f_4lxml_5etree_9_Document_getroot(__pyx_v_doc); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2028, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element))))) __PYX_ERR(0, 2028, __pyx_L5_except_error)
      __Pyx_GIVEREF(__pyx_t_4);
      __Pyx_GOTREF((PyObject *)__pyx_v_self->_context_node);
      __Pyx_DECREF((PyObject *)__pyx_v_self->_context_node);
      __pyx_v_self->_context_node = ((struct LxmlElement *)__pyx_t_4);
      __pyx_t_4 = 0;
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "lxml/etree.pyx":2024
 *         try:
 *             doc = _parseDocument(source, parser, base_url)
 *         except _TargetParserResult as result_container:             # <<<<<<<<<<<<<<
 *             # raises a TypeError if we don't get an _Element
 *             self._context_node = result_container.result
*/
    __Pyx_ErrFetch(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_TargetParserResult); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2024, __pyx_L5_except_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_4, __pyx_t_7);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_ErrRestore(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    __pyx_t_4 = 0; __pyx_t_5 = 0; __pyx_t_6 = 0;
    if (__pyx_t_8) {
      __Pyx_AddTraceback("lxml.etree._ElementTree.parse", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4) < 0) __PYX_ERR(0, 2024, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __pyx_v_result_container = __pyx_t_5;
      /*try:*/ {

        /* "lxml/etree.pyx":2026
 *         except _TargetParserResult as result_container:
 *             # raises a TypeError if we don't get an _Element
 *             self._context_node = result_container.result             # <<<<<<<<<<<<<<
 *         else:
 *             self._context_node = doc.getroot()
*/
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_result_container, __pyx_mstate_global->__pyx_n_u_result); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2026, __pyx_L14_error)
        __Pyx_GOTREF(__pyx_t_7);
        if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element))))) __PYX_ERR(0, 2026, __pyx_L14_error)
        __Pyx_GIVEREF(__pyx_t_7);
        __Pyx_GOTREF((PyObject *)__pyx_v_self->_context_node);
        __Pyx_DECREF((PyObject *)__pyx_v_self->_context_node);
        __pyx_v_self->_context_node = ((struct LxmlElement *)__pyx_t_7);
        __pyx_t_7 = 0;
      }

      /* "lxml/etree.pyx":2024
 *         try:
 *             doc = _parseDocument(source, parser, base_url)
 *         except _TargetParserResult as result_container:             # <<<<<<<<<<<<<<
 *             # raises a TypeError if we don't get an _Element
 *             self._context_node = result_container.result
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_DECREF(__pyx_v_result_container); __pyx_v_result_container = 0;
          goto __pyx_L15;
        }
        __pyx_L14_error:;
        /*exception exit:*/{
          __Pyx_PyThreadState_declare
          __Pyx_PyThreadState_assign
          __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
           __Pyx_ExceptionSwap(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16);
          if ( unlikely(__Pyx_GetException(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13) < 0)) __Pyx_ErrFetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
          __Pyx_XGOTREF(__pyx_t_11);
          __Pyx_XGOTREF(__pyx_t_12);
          __Pyx_XGOTREF(__pyx_t_13);
          __Pyx_XGOTREF(__pyx_t_14);
          __Pyx_XGOTREF(__pyx_t_15);
          __Pyx_XGOTREF(__pyx_t_16);
          __pyx_t_8 = __pyx_lineno; __pyx_t_9 = __pyx_clineno; __pyx_t_10 = __pyx_filename;
          {
            __Pyx_DECREF(__pyx_v_result_container); __pyx_v_result_container = 0;
          }
          __Pyx_XGIVEREF(__pyx_t_14);
          __Pyx_XGIVEREF(__pyx_t_15);
          __Pyx_XGIVEREF(__pyx_t_16);
          __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16);
          __Pyx_XGIVEREF(__pyx_t_11);
          __Pyx_XGIVEREF(__pyx_t_12);
          __Pyx_XGIVEREF(__pyx_t_13);
          __Pyx_ErrRestore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
          __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
          __pyx_lineno = __pyx_t_8; __pyx_clineno = __pyx_t_9; __pyx_filename = __pyx_t_10;
          goto __pyx_L5_except_error;
        }
        __pyx_L15:;
      }
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L4_exception_handled;
    }
    goto __pyx_L5_except_error;

    /* "lxml/etree.pyx":2022
 *         """
 *         cdef _Document doc = None
 *         try:             # <<<<<<<<<<<<<<
 *             doc = _parseDocument(source, parser, base_url)
 *         except _TargetParserResult as result_container:
*/
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    __pyx_L8_try_end:;
  }

  /* "lxml/etree.pyx":2029
 *         else:
 *             self._context_node = doc.getroot()
 *         self._doc = None if self._context_node is not None else doc             # <<<<<<<<<<<<<<
 *         return self._context_node
 * 
*/
  __pyx_t_17 = (((PyObject *)__pyx_v_self->_context_node) != Py_None);
  if (__pyx_t_17) {
    __Pyx_INCREF(Py_None);
    __pyx_t_4 = Py_None;
  } else {
    __Pyx_INCREF((PyObject *)__pyx_v_doc);
    __pyx_t_4 = ((PyObject *)__pyx_v_doc);
  }
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Document))))) __PYX_ERR(0, 2029, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_doc);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_doc);
  __pyx_v_self->_doc = ((struct LxmlDocument *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "lxml/etree.pyx":2030
 *             self._context_node = doc.getroot()
 *         self._doc = None if self._context_node is not None else doc
 *         return self._context_node             # <<<<<<<<<<<<<<
 * 
 *     def _setroot(self, _Element root not None):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_self->_context_node);
  __pyx_r = ((PyObject *)__pyx_v_self->_context_node);
  goto __pyx_L0;

  /* "lxml/etree.pyx":2016
 *         return 0
 * 
 *     def parse(self, source, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *         """parse(self, source, parser=None, base_url=None)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree._ElementTree.parse", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XDECREF(__pyx_v_result_container);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2032
 *         return self._context_node
 * 
 *     def _setroot(self, _Element root not None):             # <<<<<<<<<<<<<<
 *         """_setroot(self, root)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_3_setroot(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_12_ElementTree_2_setroot, "_setroot(self, root)\n\n        Relocate the ElementTree to a new root node.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_12_ElementTree_3_setroot = {"_setroot", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_3_setroot, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_2_setroot};
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_3_setroot(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct LxmlElement *__pyx_v_root = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_setroot (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_root,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 2032, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2032, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_setroot", 0) < (0)) __PYX_ERR(0, 2032, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_setroot", 1, 1, 1, i); __PYX_ERR(0, 2032, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2032, __pyx_L3_error)
    }
    __pyx_v_root = ((struct LxmlElement *)values[0]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_setroot", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2032, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._ElementTree._setroot", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_root), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element, 0, "root", 0))) __PYX_ERR(0, 2032, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_12_ElementTree_2_setroot(((struct LxmlElementTree *)__pyx_v_self), __pyx_v_root);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_2_setroot(struct LxmlElementTree *__pyx_v_self, struct LxmlElement *__pyx_v_root) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_setroot", 0);

  /* "lxml/etree.pyx":2037
 *         Relocate the ElementTree to a new root node.
 *         """
 *         _assertValidNode(root)             # <<<<<<<<<<<<<<
 *         if root._c_node.type != tree.XML_ELEMENT_NODE:
 *             raise TypeError, "Only elements can be the root of an ElementTree"
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_root); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 2037, __pyx_L1_error)

  /* "lxml/etree.pyx":2038
 *         """
 *         _assertValidNode(root)
 *         if root._c_node.type != tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *             raise TypeError, "Only elements can be the root of an ElementTree"
 *         self._context_node = root
*/
  __pyx_t_2 = (__pyx_v_root->_c_node->type != XML_ELEMENT_NODE);
  if (unlikely(__pyx_t_2)) {

    /* "lxml/etree.pyx":2039
 *         _assertValidNode(root)
 *         if root._c_node.type != tree.XML_ELEMENT_NODE:
 *             raise TypeError, "Only elements can be the root of an ElementTree"             # <<<<<<<<<<<<<<
 *         self._context_node = root
 *         self._doc = None
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_Only_elements_can_be_the_root_of, 0, 0);
    __PYX_ERR(0, 2039, __pyx_L1_error)

    /* "lxml/etree.pyx":2038
 *         """
 *         _assertValidNode(root)
 *         if root._c_node.type != tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *             raise TypeError, "Only elements can be the root of an ElementTree"
 *         self._context_node = root
*/
  }

  /* "lxml/etree.pyx":2040
 *         if root._c_node.type != tree.XML_ELEMENT_NODE:
 *             raise TypeError, "Only elements can be the root of an ElementTree"
 *         self._context_node = root             # <<<<<<<<<<<<<<
 *         self._doc = None
 * 
*/
  __Pyx_INCREF((PyObject *)__pyx_v_root);
  __Pyx_GIVEREF((PyObject *)__pyx_v_root);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_context_node);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_context_node);
  __pyx_v_self->_context_node = __pyx_v_root;

  /* "lxml/etree.pyx":2041
 *             raise TypeError, "Only elements can be the root of an ElementTree"
 *         self._context_node = root
 *         self._doc = None             # <<<<<<<<<<<<<<
 * 
 *     def getroot(self):
*/
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_doc);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_doc);
  __pyx_v_self->_doc = ((struct LxmlDocument *)Py_None);

  /* "lxml/etree.pyx":2032
 *         return self._context_node
 * 
 *     def _setroot(self, _Element root not None):             # <<<<<<<<<<<<<<
 *         """_setroot(self, root)
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._ElementTree._setroot", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2043
 *         self._doc = None
 * 
 *     def getroot(self):             # <<<<<<<<<<<<<<
 *         """getroot(self)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_5getroot(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_12_ElementTree_4getroot, "getroot(self)\n\n        Gets the root element for this tree.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_12_ElementTree_5getroot = {"getroot", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_5getroot, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_4getroot};
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_5getroot(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getroot (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("getroot", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("getroot", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_12_ElementTree_4getroot(((struct LxmlElementTree *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_4getroot(struct LxmlElementTree *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getroot", 0);

  /* "lxml/etree.pyx":2048
 *         Gets the root element for this tree.
 *         """
 *         return self._context_node             # <<<<<<<<<<<<<<
 * 
 *     def __copy__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_self->_context_node);
  __pyx_r = ((PyObject *)__pyx_v_self->_context_node);
  goto __pyx_L0;

  /* "lxml/etree.pyx":2043
 *         self._doc = None
 * 
 *     def getroot(self):             # <<<<<<<<<<<<<<
 *         """getroot(self)
 * 
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2050
 *         return self._context_node
 * 
 *     def __copy__(self):             # <<<<<<<<<<<<<<
 *         return _elementTreeFactory(self._doc, self._context_node)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_7__copy__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_12_ElementTree_7__copy__ = {"__copy__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_7__copy__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_7__copy__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__copy__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__copy__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__copy__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_12_ElementTree_6__copy__(((struct LxmlElementTree *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_6__copy__(struct LxmlElementTree *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__copy__", 0);

  /* "lxml/etree.pyx":2051
 * 
 *     def __copy__(self):
 *         return _elementTreeFactory(self._doc, self._context_node)             # <<<<<<<<<<<<<<
 * 
 *     def __deepcopy__(self, memo):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_doc);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = ((PyObject *)__pyx_v_self->_context_node);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__elementTreeFactory(((struct LxmlDocument *)__pyx_t_1), ((struct LxmlElement *)__pyx_t_2))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2051, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":2050
 *         return self._context_node
 * 
 *     def __copy__(self):             # <<<<<<<<<<<<<<
 *         return _elementTreeFactory(self._doc, self._context_node)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._ElementTree.__copy__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2053
 *         return _elementTreeFactory(self._doc, self._context_node)
 * 
 *     def __deepcopy__(self, memo):             # <<<<<<<<<<<<<<
 *         cdef _Element root
 *         cdef _Document doc
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_9__deepcopy__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_12_ElementTree_9__deepcopy__ = {"__deepcopy__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_9__deepcopy__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_9__deepcopy__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_memo = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__deepcopy__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_memo,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 2053, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2053, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__deepcopy__", 0) < (0)) __PYX_ERR(0, 2053, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__deepcopy__", 1, 1, 1, i); __PYX_ERR(0, 2053, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2053, __pyx_L3_error)
    }
    __pyx_v_memo = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__deepcopy__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2053, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._ElementTree.__deepcopy__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_12_ElementTree_8__deepcopy__(((struct LxmlElementTree *)__pyx_v_self), __pyx_v_memo);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_8__deepcopy__(struct LxmlElementTree *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_memo) {
  struct LxmlElement *__pyx_v_root = 0;
  struct LxmlDocument *__pyx_v_doc = 0;
  xmlDoc *__pyx_v_c_doc;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__deepcopy__", 0);

  /* "lxml/etree.pyx":2057
 *         cdef _Document doc
 *         cdef xmlDoc* c_doc
 *         if self._context_node is not None:             # <<<<<<<<<<<<<<
 *             root = self._context_node.__copy__()
 *             assert root is not None
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_self->_context_node) != Py_None);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":2058
 *         cdef xmlDoc* c_doc
 *         if self._context_node is not None:
 *             root = self._context_node.__copy__()             # <<<<<<<<<<<<<<
 *             assert root is not None
 *             _assertValidNode(root)
*/
    __pyx_t_3 = ((PyObject *)__pyx_v_self->_context_node);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_copy_2, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2058, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element))))) __PYX_ERR(0, 2058, __pyx_L1_error)
    __pyx_v_root = ((struct LxmlElement *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "lxml/etree.pyx":2059
 *         if self._context_node is not None:
 *             root = self._context_node.__copy__()
 *             assert root is not None             # <<<<<<<<<<<<<<
 *             _assertValidNode(root)
 *             _copyNonElementSiblings(self._context_node._c_node, root._c_node)
*/
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(__pyx_assertions_enabled())) {
      __pyx_t_1 = (((PyObject *)__pyx_v_root) != Py_None);
      if (unlikely(!__pyx_t_1)) {
        __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
        __PYX_ERR(0, 2059, __pyx_L1_error)
      }
    }
    #else
    if ((1)); else __PYX_ERR(0, 2059, __pyx_L1_error)
    #endif

    /* "lxml/etree.pyx":2060
 *             root = self._context_node.__copy__()
 *             assert root is not None
 *             _assertValidNode(root)             # <<<<<<<<<<<<<<
 *             _copyNonElementSiblings(self._context_node._c_node, root._c_node)
 *             return _elementTreeFactory(None, root)
*/
    __pyx_t_5 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_root); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 2060, __pyx_L1_error)

    /* "lxml/etree.pyx":2061
 *             assert root is not None
 *             _assertValidNode(root)
 *             _copyNonElementSiblings(self._context_node._c_node, root._c_node)             # <<<<<<<<<<<<<<
 *             return _elementTreeFactory(None, root)
 *         elif self._doc is not None:
*/
    __pyx_t_5 = __pyx_f_4lxml_5etree__copyNonElementSiblings(__pyx_v_self->_context_node->_c_node, __pyx_v_root->_c_node); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 2061, __pyx_L1_error)

    /* "lxml/etree.pyx":2062
 *             _assertValidNode(root)
 *             _copyNonElementSiblings(self._context_node._c_node, root._c_node)
 *             return _elementTreeFactory(None, root)             # <<<<<<<<<<<<<<
 *         elif self._doc is not None:
 *             _assertValidDoc(self._doc)
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__elementTreeFactory(((struct LxmlDocument *)Py_None), __pyx_v_root)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2062, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "lxml/etree.pyx":2057
 *         cdef _Document doc
 *         cdef xmlDoc* c_doc
 *         if self._context_node is not None:             # <<<<<<<<<<<<<<
 *             root = self._context_node.__copy__()
 *             assert root is not None
*/
  }

  /* "lxml/etree.pyx":2063
 *             _copyNonElementSiblings(self._context_node._c_node, root._c_node)
 *             return _elementTreeFactory(None, root)
 *         elif self._doc is not None:             # <<<<<<<<<<<<<<
 *             _assertValidDoc(self._doc)
 *             c_doc = tree.xmlCopyDoc(self._doc._c_doc, 1)
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_self->_doc) != Py_None);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":2064
 *             return _elementTreeFactory(None, root)
 *         elif self._doc is not None:
 *             _assertValidDoc(self._doc)             # <<<<<<<<<<<<<<
 *             c_doc = tree.xmlCopyDoc(self._doc._c_doc, 1)
 *             if c_doc is NULL:
*/
    __pyx_t_2 = ((PyObject *)__pyx_v_self->_doc);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_5 = __pyx_f_4lxml_5etree__assertValidDoc(((struct LxmlDocument *)__pyx_t_2)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 2064, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "lxml/etree.pyx":2065
 *         elif self._doc is not None:
 *             _assertValidDoc(self._doc)
 *             c_doc = tree.xmlCopyDoc(self._doc._c_doc, 1)             # <<<<<<<<<<<<<<
 *             if c_doc is NULL:
 *                 raise MemoryError()
*/
    __pyx_v_c_doc = xmlCopyDoc(__pyx_v_self->_doc->_c_doc, 1);

    /* "lxml/etree.pyx":2066
 *             _assertValidDoc(self._doc)
 *             c_doc = tree.xmlCopyDoc(self._doc._c_doc, 1)
 *             if c_doc is NULL:             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 *             doc = _documentFactory(c_doc, self._doc._parser)
*/
    __pyx_t_1 = (__pyx_v_c_doc == NULL);
    if (unlikely(__pyx_t_1)) {

      /* "lxml/etree.pyx":2067
 *             c_doc = tree.xmlCopyDoc(self._doc._c_doc, 1)
 *             if c_doc is NULL:
 *                 raise MemoryError()             # <<<<<<<<<<<<<<
 *             doc = _documentFactory(c_doc, self._doc._parser)
 *             return _elementTreeFactory(doc, None)
*/
      PyErr_NoMemory(); __PYX_ERR(0, 2067, __pyx_L1_error)

      /* "lxml/etree.pyx":2066
 *             _assertValidDoc(self._doc)
 *             c_doc = tree.xmlCopyDoc(self._doc._c_doc, 1)
 *             if c_doc is NULL:             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 *             doc = _documentFactory(c_doc, self._doc._parser)
*/
    }

    /* "lxml/etree.pyx":2068
 *             if c_doc is NULL:
 *                 raise MemoryError()
 *             doc = _documentFactory(c_doc, self._doc._parser)             # <<<<<<<<<<<<<<
 *             return _elementTreeFactory(doc, None)
 *         else:
*/
    __pyx_t_2 = ((PyObject *)__pyx_v_self->_doc->_parser);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_2))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2068, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "lxml/etree.pyx":2069
 *                 raise MemoryError()
 *             doc = _documentFactory(c_doc, self._doc._parser)
 *             return _elementTreeFactory(doc, None)             # <<<<<<<<<<<<<<
 *         else:
 *             # so what ...
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__elementTreeFactory(__pyx_v_doc, ((struct LxmlElement *)Py_None))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2069, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "lxml/etree.pyx":2063
 *             _copyNonElementSiblings(self._context_node._c_node, root._c_node)
 *             return _elementTreeFactory(None, root)
 *         elif self._doc is not None:             # <<<<<<<<<<<<<<
 *             _assertValidDoc(self._doc)
 *             c_doc = tree.xmlCopyDoc(self._doc._c_doc, 1)
*/
  }

  /* "lxml/etree.pyx":2072
 *         else:
 *             # so what ...
 *             return self             # <<<<<<<<<<<<<<
 * 
 *     # not in ElementTree
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF((PyObject *)__pyx_v_self);
    __pyx_r = ((PyObject *)__pyx_v_self);
    goto __pyx_L0;
  }

  /* "lxml/etree.pyx":2053
 *         return _elementTreeFactory(self._doc, self._context_node)
 * 
 *     def __deepcopy__(self, memo):             # <<<<<<<<<<<<<<
 *         cdef _Element root
 *         cdef _Document doc
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._ElementTree.__deepcopy__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_root);
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2075
 * 
 *     # not in ElementTree
 *     @property             # <<<<<<<<<<<<<<
 *     def docinfo(self) -> DocInfo:
 *         """Information about the document provided by parser and DTD."""
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_7docinfo_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_7docinfo_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_12_ElementTree_7docinfo___get__(((struct LxmlElementTree *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_7docinfo___get__(struct LxmlElementTree *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lxml/etree.pyx":2078
 *     def docinfo(self) -> DocInfo:
 *         """Information about the document provided by parser and DTD."""
 *         self._assertHasRoot()             # <<<<<<<<<<<<<<
 *         return DocInfo(self._context_node._doc)
 * 
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_12_ElementTree__assertHasRoot(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 2078, __pyx_L1_error)

  /* "lxml/etree.pyx":2079
 *         """Information about the document provided by parser and DTD."""
 *         self._assertHasRoot()
 *         return DocInfo(self._context_node._doc)             # <<<<<<<<<<<<<<
 * 
 *     # not in ElementTree, read-only
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, ((PyObject *)__pyx_v_self->_context_node->_doc)};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_DocInfo, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2079, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_2);
  }
  __pyx_r = ((PyObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":2075
 * 
 *     # not in ElementTree
 *     @property             # <<<<<<<<<<<<<<
 *     def docinfo(self) -> DocInfo:
 *         """Information about the document provided by parser and DTD."""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._ElementTree.docinfo.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2082
 * 
 *     # not in ElementTree, read-only
 *     @property             # <<<<<<<<<<<<<<
 *     def parser(self):
 *         """The parser that was used to parse the document in this ElementTree.
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_6parser_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_6parser_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_12_ElementTree_6parser___get__(((struct LxmlElementTree *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_6parser___get__(struct LxmlElementTree *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lxml/etree.pyx":2086
 *         """The parser that was used to parse the document in this ElementTree.
 *         """
 *         if self._context_node is not None and \             # <<<<<<<<<<<<<<
 *                self._context_node._doc is not None:
 *             return self._context_node._doc._parser
*/
  __pyx_t_2 = (((PyObject *)__pyx_v_self->_context_node) != Py_None);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }

  /* "lxml/etree.pyx":2087
 *         """
 *         if self._context_node is not None and \
 *                self._context_node._doc is not None:             # <<<<<<<<<<<<<<
 *             return self._context_node._doc._parser
 *         if self._doc is not None:
*/
  __pyx_t_2 = (((PyObject *)__pyx_v_self->_context_node->_doc) != Py_None);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;

  /* "lxml/etree.pyx":2086
 *         """The parser that was used to parse the document in this ElementTree.
 *         """
 *         if self._context_node is not None and \             # <<<<<<<<<<<<<<
 *                self._context_node._doc is not None:
 *             return self._context_node._doc._parser
*/
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":2088
 *         if self._context_node is not None and \
 *                self._context_node._doc is not None:
 *             return self._context_node._doc._parser             # <<<<<<<<<<<<<<
 *         if self._doc is not None:
 *             return self._doc._parser
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF((PyObject *)__pyx_v_self->_context_node->_doc->_parser);
    __pyx_r = ((PyObject *)__pyx_v_self->_context_node->_doc->_parser);
    goto __pyx_L0;

    /* "lxml/etree.pyx":2086
 *         """The parser that was used to parse the document in this ElementTree.
 *         """
 *         if self._context_node is not None and \             # <<<<<<<<<<<<<<
 *                self._context_node._doc is not None:
 *             return self._context_node._doc._parser
*/
  }

  /* "lxml/etree.pyx":2089
 *                self._context_node._doc is not None:
 *             return self._context_node._doc._parser
 *         if self._doc is not None:             # <<<<<<<<<<<<<<
 *             return self._doc._parser
 *         return None
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_self->_doc) != Py_None);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":2090
 *             return self._context_node._doc._parser
 *         if self._doc is not None:
 *             return self._doc._parser             # <<<<<<<<<<<<<<
 *         return None
 * 
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF((PyObject *)__pyx_v_self->_doc->_parser);
    __pyx_r = ((PyObject *)__pyx_v_self->_doc->_parser);
    goto __pyx_L0;

    /* "lxml/etree.pyx":2089
 *                self._context_node._doc is not None:
 *             return self._context_node._doc._parser
 *         if self._doc is not None:             # <<<<<<<<<<<<<<
 *             return self._doc._parser
 *         return None
*/
  }

  /* "lxml/etree.pyx":2091
 *         if self._doc is not None:
 *             return self._doc._parser
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     def write(self, file, *, encoding=None, method="xml",
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "lxml/etree.pyx":2082
 * 
 *     # not in ElementTree, read-only
 *     @property             # <<<<<<<<<<<<<<
 *     def parser(self):
 *         """The parser that was used to parse the document in this ElementTree.
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2093
 *         return None
 * 
 *     def write(self, file, *, encoding=None, method="xml",             # <<<<<<<<<<<<<<
 *               bint pretty_print=False, xml_declaration=None, bint with_tail=True,
 *               standalone=None, doctype=None, compression=0,
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_11write(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_12_ElementTree_10write, "write(self, file, encoding=None, method=\"xml\",\n                  pretty_print=False, xml_declaration=None, with_tail=True,\n                  standalone=None, doctype=None, compression=0,\n                  exclusive=False, inclusive_ns_prefixes=None,\n                  with_comments=True, strip_text=False)\n\n        Write the tree to a filename, file or file-like object.\n\n        Defaults to ASCII encoding and writing a declaration as needed.\n\n        The keyword argument 'method' selects the output method:\n        'xml', 'html', 'text', 'c14n' or 'c14n2'.  Default is 'xml'.\n\n        With ``method=\"c14n\"`` (C14N version 1), the options ``exclusive``,\n        ``with_comments`` and ``inclusive_ns_prefixes`` request exclusive\n        C14N, include comments, and list the inclusive prefixes respectively.\n\n        With ``method=\"c14n2\"`` (C14N version 2), the ``with_comments`` and\n        ``strip_text`` options control the output of comments and text space\n        according to C14N 2.0.\n\n        Passing a boolean value to the ``standalone`` option will\n        output an XML declaration with the corresponding\n        ``standalone`` flag.\n\n        The ``doctype`` option allows passing in a plain string that will\n        be serialised before the XML tree.  Note that passing in non\n        well-formed content here will make the XML output non well-formed.\n        Also, an existing doctype in the document tree will not be removed\n        when serialising an ElementTree instance.\n\n        The ``compression`` option enables GZip compression level 1-9.\n\n        The ``inclusive_ns_prefixes`` should be a list of namespace strings\n        (i.e. ['xs', 'xsi']) that will be promoted to the top-level element\n        during exclusive C14N serialisation.  This parameter is ignored if\n        exclusive mode=False.\n\n        If exclusive=True and no list is provided, a namespace will only be\n        rendered if it is used by the immediate parent or ""one of its attributes\n        and its prefix and values have not already been rendered by an ancestor\n        of the namespace node's parent element.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_12_ElementTree_11write = {"write", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_11write, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_10write};
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_11write(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_file = 0;
  PyObject *__pyx_v_encoding = 0;
  PyObject *__pyx_v_method = 0;
  int __pyx_v_pretty_print;
  PyObject *__pyx_v_xml_declaration = 0;
  int __pyx_v_with_tail;
  PyObject *__pyx_v_standalone = 0;
  PyObject *__pyx_v_doctype = 0;
  PyObject *__pyx_v_compression = 0;
  int __pyx_v_exclusive;
  PyObject *__pyx_v_inclusive_ns_prefixes = 0;
  int __pyx_v_with_comments;
  int __pyx_v_strip_text;
  PyObject *__pyx_v_docstring = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[14] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_file,&__pyx_mstate_global->__pyx_n_u_encoding,&__pyx_mstate_global->__pyx_n_u_method,&__pyx_mstate_global->__pyx_n_u_pretty_print,&__pyx_mstate_global->__pyx_n_u_xml_declaration,&__pyx_mstate_global->__pyx_n_u_with_tail,&__pyx_mstate_global->__pyx_n_u_standalone,&__pyx_mstate_global->__pyx_n_u_doctype,&__pyx_mstate_global->__pyx_n_u_compression,&__pyx_mstate_global->__pyx_n_u_exclusive,&__pyx_mstate_global->__pyx_n_u_inclusive_ns_prefixes,&__pyx_mstate_global->__pyx_n_u_with_comments,&__pyx_mstate_global->__pyx_n_u_strip_text,&__pyx_mstate_global->__pyx_n_u_docstring,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 2093, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2093, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "write", 0) < (0)) __PYX_ERR(0, 2093, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_n_u_xml));

      /* "lxml/etree.pyx":2094
 * 
 *     def write(self, file, *, encoding=None, method="xml",
 *               bint pretty_print=False, xml_declaration=None, bint with_tail=True,             # <<<<<<<<<<<<<<
 *               standalone=None, doctype=None, compression=0,
 *               bint exclusive=False, inclusive_ns_prefixes=None,
*/
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "lxml/etree.pyx":2095
 *     def write(self, file, *, encoding=None, method="xml",
 *               bint pretty_print=False, xml_declaration=None, bint with_tail=True,
 *               standalone=None, doctype=None, compression=0,             # <<<<<<<<<<<<<<
 *               bint exclusive=False, inclusive_ns_prefixes=None,
 *               bint with_comments=True, bint strip_text=False,
*/
      if (!values[6]) values[6] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[7]) values[7] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[8]) values[8] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_int_0));

      /* "lxml/etree.pyx":2096
 *               bint pretty_print=False, xml_declaration=None, bint with_tail=True,
 *               standalone=None, doctype=None, compression=0,
 *               bint exclusive=False, inclusive_ns_prefixes=None,             # <<<<<<<<<<<<<<
 *               bint with_comments=True, bint strip_text=False,
 *               docstring=None):
*/
      if (!values[10]) values[10] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "lxml/etree.pyx":2098
 *               bint exclusive=False, inclusive_ns_prefixes=None,
 *               bint with_comments=True, bint strip_text=False,
 *               docstring=None):             # <<<<<<<<<<<<<<
 *         """write(self, file, encoding=None, method="xml",
 *                   pretty_print=False, xml_declaration=None, with_tail=True,
*/
      if (!values[13]) values[13] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("write", 1, 1, 1, i); __PYX_ERR(0, 2093, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2093, __pyx_L3_error)

      /* "lxml/etree.pyx":2093
 *         return None
 * 
 *     def write(self, file, *, encoding=None, method="xml",             # <<<<<<<<<<<<<<
 *               bint pretty_print=False, xml_declaration=None, bint with_tail=True,
 *               standalone=None, doctype=None, compression=0,
*/
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_n_u_xml));

      /* "lxml/etree.pyx":2094
 * 
 *     def write(self, file, *, encoding=None, method="xml",
 *               bint pretty_print=False, xml_declaration=None, bint with_tail=True,             # <<<<<<<<<<<<<<
 *               standalone=None, doctype=None, compression=0,
 *               bint exclusive=False, inclusive_ns_prefixes=None,
*/
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "lxml/etree.pyx":2095
 *     def write(self, file, *, encoding=None, method="xml",
 *               bint pretty_print=False, xml_declaration=None, bint with_tail=True,
 *               standalone=None, doctype=None, compression=0,             # <<<<<<<<<<<<<<
 *               bint exclusive=False, inclusive_ns_prefixes=None,
 *               bint with_comments=True, bint strip_text=False,
*/
      if (!values[6]) values[6] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[7]) values[7] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[8]) values[8] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_int_0));

      /* "lxml/etree.pyx":2096
 *               bint pretty_print=False, xml_declaration=None, bint with_tail=True,
 *               standalone=None, doctype=None, compression=0,
 *               bint exclusive=False, inclusive_ns_prefixes=None,             # <<<<<<<<<<<<<<
 *               bint with_comments=True, bint strip_text=False,
 *               docstring=None):
*/
      if (!values[10]) values[10] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "lxml/etree.pyx":2098
 *               bint exclusive=False, inclusive_ns_prefixes=None,
 *               bint with_comments=True, bint strip_text=False,
 *               docstring=None):             # <<<<<<<<<<<<<<
 *         """write(self, file, encoding=None, method="xml",
 *                   pretty_print=False, xml_declaration=None, with_tail=True,
*/
      if (!values[13]) values[13] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_file = values[0];
    __pyx_v_encoding = values[1];
    __pyx_v_method = values[2];
    if (values[3]) {
      __pyx_v_pretty_print = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_pretty_print == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2094, __pyx_L3_error)
    } else {

      /* "lxml/etree.pyx":2094
 * 
 *     def write(self, file, *, encoding=None, method="xml",
 *               bint pretty_print=False, xml_declaration=None, bint with_tail=True,             # <<<<<<<<<<<<<<
 *               standalone=None, doctype=None, compression=0,
 *               bint exclusive=False, inclusive_ns_prefixes=None,
*/
      __pyx_v_pretty_print = ((int)0);
    }
    __pyx_v_xml_declaration = values[4];
    if (values[5]) {
      __pyx_v_with_tail = __Pyx_PyObject_IsTrue(values[5]); if (unlikely((__pyx_v_with_tail == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2094, __pyx_L3_error)
    } else {
      __pyx_v_with_tail = ((int)1);
    }
    __pyx_v_standalone = values[6];
    __pyx_v_doctype = values[7];
    __pyx_v_compression = values[8];
    if (values[9]) {
      __pyx_v_exclusive = __Pyx_PyObject_IsTrue(values[9]); if (unlikely((__pyx_v_exclusive == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2096, __pyx_L3_error)
    } else {

      /* "lxml/etree.pyx":2096
 *               bint pretty_print=False, xml_declaration=None, bint with_tail=True,
 *               standalone=None, doctype=None, compression=0,
 *               bint exclusive=False, inclusive_ns_prefixes=None,             # <<<<<<<<<<<<<<
 *               bint with_comments=True, bint strip_text=False,
 *               docstring=None):
*/
      __pyx_v_exclusive = ((int)0);
    }
    __pyx_v_inclusive_ns_prefixes = values[10];
    if (values[11]) {
      __pyx_v_with_comments = __Pyx_PyObject_IsTrue(values[11]); if (unlikely((__pyx_v_with_comments == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2097, __pyx_L3_error)
    } else {

      /* "lxml/etree.pyx":2097
 *               standalone=None, doctype=None, compression=0,
 *               bint exclusive=False, inclusive_ns_prefixes=None,
 *               bint with_comments=True, bint strip_text=False,             # <<<<<<<<<<<<<<
 *               docstring=None):
 *         """write(self, file, encoding=None, method="xml",
*/
      __pyx_v_with_comments = ((int)1);
    }
    if (values[12]) {
      __pyx_v_strip_text = __Pyx_PyObject_IsTrue(values[12]); if (unlikely((__pyx_v_strip_text == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2097, __pyx_L3_error)
    } else {
      __pyx_v_strip_text = ((int)0);
    }
    __pyx_v_docstring = values[13];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("write", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2093, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._ElementTree.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_12_ElementTree_10write(((struct LxmlElementTree *)__pyx_v_self), __pyx_v_file, __pyx_v_encoding, __pyx_v_method, __pyx_v_pretty_print, __pyx_v_xml_declaration, __pyx_v_with_tail, __pyx_v_standalone, __pyx_v_doctype, __pyx_v_compression, __pyx_v_exclusive, __pyx_v_inclusive_ns_prefixes, __pyx_v_with_comments, __pyx_v_strip_text, __pyx_v_docstring);

  /* "lxml/etree.pyx":2093
 *         return None
 * 
 *     def write(self, file, *, encoding=None, method="xml",             # <<<<<<<<<<<<<<
 *               bint pretty_print=False, xml_declaration=None, bint with_tail=True,
 *               standalone=None, doctype=None, compression=0,
*/

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_10write(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v_file, PyObject *__pyx_v_encoding, PyObject *__pyx_v_method, int __pyx_v_pretty_print, PyObject *__pyx_v_xml_declaration, int __pyx_v_with_tail, PyObject *__pyx_v_standalone, PyObject *__pyx_v_doctype, PyObject *__pyx_v_compression, int __pyx_v_exclusive, PyObject *__pyx_v_inclusive_ns_prefixes, int __pyx_v_with_comments, int __pyx_v_strip_text, PyObject *__pyx_v_docstring) {
  int __pyx_v_write_declaration;
  int __pyx_v_is_standalone;
  PyObject *__pyx_v_f = NULL;
  struct __pyx_obj_4lxml_5etree_C14NWriterTarget *__pyx_v_target = NULL;
  PyObject *__pyx_v_warnings = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("write", 0);
  __Pyx_INCREF(__pyx_v_encoding);
  __Pyx_INCREF(__pyx_v_doctype);
  __Pyx_INCREF(__pyx_v_compression);

  /* "lxml/etree.pyx":2145
 *         cdef int is_standalone
 * 
 *         self._assertHasRoot()             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._context_node)
 *         if compression is None or compression < 0:
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_12_ElementTree__assertHasRoot(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 2145, __pyx_L1_error)

  /* "lxml/etree.pyx":2146
 * 
 *         self._assertHasRoot()
 *         _assertValidNode(self._context_node)             # <<<<<<<<<<<<<<
 *         if compression is None or compression < 0:
 *             compression = 0
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self->_context_node);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_t_2)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 2146, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "lxml/etree.pyx":2147
 *         self._assertHasRoot()
 *         _assertValidNode(self._context_node)
 *         if compression is None or compression < 0:             # <<<<<<<<<<<<<<
 *             compression = 0
 * 
*/
  __pyx_t_4 = (__pyx_v_compression == Py_None);
  if (!__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(__pyx_v_compression, __pyx_mstate_global->__pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2147, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 2147, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":2148
 *         _assertValidNode(self._context_node)
 *         if compression is None or compression < 0:
 *             compression = 0             # <<<<<<<<<<<<<<
 * 
 *         # C14N serialisation
*/
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0);
    __Pyx_DECREF_SET(__pyx_v_compression, __pyx_mstate_global->__pyx_int_0);

    /* "lxml/etree.pyx":2147
 *         self._assertHasRoot()
 *         _assertValidNode(self._context_node)
 *         if compression is None or compression < 0:             # <<<<<<<<<<<<<<
 *             compression = 0
 * 
*/
  }

  /* "lxml/etree.pyx":2151
 * 
 *         # C14N serialisation
 *         if method in ('c14n', 'c14n2'):             # <<<<<<<<<<<<<<
 *             if encoding is not None:
 *                 raise ValueError("Cannot specify encoding with C14N")
*/
  __Pyx_INCREF(__pyx_v_method);
  __pyx_t_2 = __pyx_v_method;
  __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_c14n, Py_EQ)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 2151, __pyx_L1_error)
  if (!__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L7_bool_binop_done;
  }
  __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_c14n2, Py_EQ)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 2151, __pyx_L1_error)
  __pyx_t_3 = __pyx_t_4;
  __pyx_L7_bool_binop_done:;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __pyx_t_3;
  if (__pyx_t_4) {

    /* "lxml/etree.pyx":2152
 *         # C14N serialisation
 *         if method in ('c14n', 'c14n2'):
 *             if encoding is not None:             # <<<<<<<<<<<<<<
 *                 raise ValueError("Cannot specify encoding with C14N")
 *             if xml_declaration:
*/
    __pyx_t_4 = (__pyx_v_encoding != Py_None);
    if (unlikely(__pyx_t_4)) {

      /* "lxml/etree.pyx":2153
 *         if method in ('c14n', 'c14n2'):
 *             if encoding is not None:
 *                 raise ValueError("Cannot specify encoding with C14N")             # <<<<<<<<<<<<<<
 *             if xml_declaration:
 *                 raise ValueError("Cannot enable XML declaration in C14N")
*/
      __pyx_t_5 = NULL;
      __pyx_t_6 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_Cannot_specify_encoding_with_C14};
        __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2153, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(0, 2153, __pyx_L1_error)

      /* "lxml/etree.pyx":2152
 *         # C14N serialisation
 *         if method in ('c14n', 'c14n2'):
 *             if encoding is not None:             # <<<<<<<<<<<<<<
 *                 raise ValueError("Cannot specify encoding with C14N")
 *             if xml_declaration:
*/
    }

    /* "lxml/etree.pyx":2154
 *             if encoding is not None:
 *                 raise ValueError("Cannot specify encoding with C14N")
 *             if xml_declaration:             # <<<<<<<<<<<<<<
 *                 raise ValueError("Cannot enable XML declaration in C14N")
 * 
*/
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_xml_declaration); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 2154, __pyx_L1_error)
    if (unlikely(__pyx_t_4)) {

      /* "lxml/etree.pyx":2155
 *                 raise ValueError("Cannot specify encoding with C14N")
 *             if xml_declaration:
 *                 raise ValueError("Cannot enable XML declaration in C14N")             # <<<<<<<<<<<<<<
 * 
 *             if method == 'c14n':
*/
      __pyx_t_5 = NULL;
      __pyx_t_6 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_Cannot_enable_XML_declaration_in};
        __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2155, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(0, 2155, __pyx_L1_error)

      /* "lxml/etree.pyx":2154
 *             if encoding is not None:
 *                 raise ValueError("Cannot specify encoding with C14N")
 *             if xml_declaration:             # <<<<<<<<<<<<<<
 *                 raise ValueError("Cannot enable XML declaration in C14N")
 * 
*/
    }

    /* "lxml/etree.pyx":2157
 *                 raise ValueError("Cannot enable XML declaration in C14N")
 * 
 *             if method == 'c14n':             # <<<<<<<<<<<<<<
 *                 _tofilelikeC14N(file, self._context_node, exclusive, with_comments,
 *                                 compression, inclusive_ns_prefixes)
*/
    __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_v_method, __pyx_mstate_global->__pyx_n_u_c14n, Py_EQ)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 2157, __pyx_L1_error)
    if (__pyx_t_4) {

      /* "lxml/etree.pyx":2158
 * 
 *             if method == 'c14n':
 *                 _tofilelikeC14N(file, self._context_node, exclusive, with_comments,             # <<<<<<<<<<<<<<
 *                                 compression, inclusive_ns_prefixes)
 *             else:  # c14n2
*/
      __pyx_t_2 = ((PyObject *)__pyx_v_self->_context_node);
      __Pyx_INCREF(__pyx_t_2);

      /* "lxml/etree.pyx":2159
 *             if method == 'c14n':
 *                 _tofilelikeC14N(file, self._context_node, exclusive, with_comments,
 *                                 compression, inclusive_ns_prefixes)             # <<<<<<<<<<<<<<
 *             else:  # c14n2
 *                 with _open_utf8_file(file, compression=compression) as f:
*/
      __pyx_t_1 = __Pyx_PyLong_As_int(__pyx_v_compression); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2159, __pyx_L1_error)

      /* "lxml/etree.pyx":2158
 * 
 *             if method == 'c14n':
 *                 _tofilelikeC14N(file, self._context_node, exclusive, with_comments,             # <<<<<<<<<<<<<<
 *                                 compression, inclusive_ns_prefixes)
 *             else:  # c14n2
*/
      __pyx_t_5 = __pyx_f_4lxml_5etree__tofilelikeC14N(__pyx_v_file, ((struct LxmlElement *)__pyx_t_2), __pyx_v_exclusive, __pyx_v_with_comments, __pyx_t_1, __pyx_v_inclusive_ns_prefixes); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2158, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "lxml/etree.pyx":2157
 *                 raise ValueError("Cannot enable XML declaration in C14N")
 * 
 *             if method == 'c14n':             # <<<<<<<<<<<<<<
 *                 _tofilelikeC14N(file, self._context_node, exclusive, with_comments,
 *                                 compression, inclusive_ns_prefixes)
*/
      goto __pyx_L11;
    }

    /* "lxml/etree.pyx":2161
 *                                 compression, inclusive_ns_prefixes)
 *             else:  # c14n2
 *                 with _open_utf8_file(file, compression=compression) as f:             # <<<<<<<<<<<<<<
 *                     target = C14NWriterTarget(
 *                         f.write, with_comments=with_comments, strip_text=strip_text)
*/
    /*else*/ {
      /*with:*/ {
        __pyx_t_2 = NULL;
        __Pyx_INCREF(__pyx_v_4lxml_5etree__open_utf8_file);
        __pyx_t_7 = __pyx_v_4lxml_5etree__open_utf8_file; 
        __pyx_t_6 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_7))) {
          __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_7);
          assert(__pyx_t_2);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
          __pyx_t_6 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_2, __pyx_v_file};
          __pyx_t_8 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2161, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_compression, __pyx_v_compression, __pyx_t_8, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 2161, __pyx_L1_error)
          __pyx_t_5 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_8);
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2161, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
        }
        __pyx_t_9 = __Pyx_PyObject_LookupSpecial(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2161, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_8 = NULL;
        __pyx_t_2 = __Pyx_PyObject_LookupSpecial(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_enter); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2161, __pyx_L12_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_6 = 1;
        #if CYTHON_UNPACK_METHODS
        if (likely(PyMethod_Check(__pyx_t_2))) {
          __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_2);
          assert(__pyx_t_8);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_8);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
          __pyx_t_6 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_8, NULL};
          __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2161, __pyx_L12_error)
          __Pyx_GOTREF(__pyx_t_7);
        }
        __pyx_t_2 = __pyx_t_7;
        __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        /*try:*/ {
          {
            __Pyx_PyThreadState_declare
            __Pyx_PyThreadState_assign
            __Pyx_ExceptionSave(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
            __Pyx_XGOTREF(__pyx_t_10);
            __Pyx_XGOTREF(__pyx_t_11);
            __Pyx_XGOTREF(__pyx_t_12);
            /*try:*/ {
              __pyx_v_f = __pyx_t_2;
              __pyx_t_2 = 0;

              /* "lxml/etree.pyx":2162
 *             else:  # c14n2
 *                 with _open_utf8_file(file, compression=compression) as f:
 *                     target = C14NWriterTarget(             # <<<<<<<<<<<<<<
 *                         f.write, with_comments=with_comments, strip_text=strip_text)
 *                     _tree_to_target(self, target)
*/
              __pyx_t_5 = NULL;

              /* "lxml/etree.pyx":2163
 *                 with _open_utf8_file(file, compression=compression) as f:
 *                     target = C14NWriterTarget(
 *                         f.write, with_comments=with_comments, strip_text=strip_text)             # <<<<<<<<<<<<<<
 *                     _tree_to_target(self, target)
 *             return
*/
              __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_mstate_global->__pyx_n_u_write); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2163, __pyx_L16_error)
              __Pyx_GOTREF(__pyx_t_7);
              __pyx_t_8 = __Pyx_PyBool_FromLong(__pyx_v_with_comments); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2163, __pyx_L16_error)
              __Pyx_GOTREF(__pyx_t_8);
              __pyx_t_13 = __Pyx_PyBool_FromLong(__pyx_v_strip_text); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 2163, __pyx_L16_error)
              __Pyx_GOTREF(__pyx_t_13);
              __pyx_t_6 = 1;
              {
                PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_5, __pyx_t_7};
                __pyx_t_14 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 2162, __pyx_L16_error)
                __Pyx_GOTREF(__pyx_t_14);
                if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_with_comments, __pyx_t_8, __pyx_t_14, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 2162, __pyx_L16_error)
                if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_strip_text, __pyx_t_13, __pyx_t_14, __pyx_callargs+2, 1) < (0)) __PYX_ERR(0, 2162, __pyx_L16_error)
                __pyx_t_2 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_C14NWriterTarget, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_14);
                __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
                __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
                __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
                __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
                __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
                if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2162, __pyx_L16_error)
                __Pyx_GOTREF((PyObject *)__pyx_t_2);
              }
              __pyx_v_target = ((struct __pyx_obj_4lxml_5etree_C14NWriterTarget *)__pyx_t_2);
              __pyx_t_2 = 0;

              /* "lxml/etree.pyx":2164
 *                     target = C14NWriterTarget(
 *                         f.write, with_comments=with_comments, strip_text=strip_text)
 *                     _tree_to_target(self, target)             # <<<<<<<<<<<<<<
 *             return
 * 
*/
              __pyx_t_2 = __pyx_f_4lxml_5etree__tree_to_target(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_target)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2164, __pyx_L16_error)
              __Pyx_GOTREF(__pyx_t_2);
              __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

              /* "lxml/etree.pyx":2161
 *                                 compression, inclusive_ns_prefixes)
 *             else:  # c14n2
 *                 with _open_utf8_file(file, compression=compression) as f:             # <<<<<<<<<<<<<<
 *                     target = C14NWriterTarget(
 *                         f.write, with_comments=with_comments, strip_text=strip_text)
*/
            }
            __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
            __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
            __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
            goto __pyx_L21_try_end;
            __pyx_L16_error:;
            __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
            __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
            __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
            __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
            __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
            __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
            /*except:*/ {
              __Pyx_AddTraceback("lxml.etree._ElementTree.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
              if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_14, &__pyx_t_13) < 0) __PYX_ERR(0, 2161, __pyx_L18_except_error)
              __Pyx_XGOTREF(__pyx_t_2);
              __Pyx_XGOTREF(__pyx_t_14);
              __Pyx_XGOTREF(__pyx_t_13);
              __pyx_t_8 = PyTuple_Pack(3, __pyx_t_2, __pyx_t_14, __pyx_t_13); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2161, __pyx_L18_except_error)
              __Pyx_GOTREF(__pyx_t_8);
              __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_8, NULL);
              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
              __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
              if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 2161, __pyx_L18_except_error)
              __Pyx_GOTREF(__pyx_t_15);
              __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_15);
              __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
              if (__pyx_t_4 < (0)) __PYX_ERR(0, 2161, __pyx_L18_except_error)
              __pyx_t_3 = (!__pyx_t_4);
              if (unlikely(__pyx_t_3)) {
                __Pyx_GIVEREF(__pyx_t_2);
                __Pyx_GIVEREF(__pyx_t_14);
                __Pyx_XGIVEREF(__pyx_t_13);
                __Pyx_ErrRestoreWithState(__pyx_t_2, __pyx_t_14, __pyx_t_13);
                __pyx_t_2 = 0;  __pyx_t_14 = 0;  __pyx_t_13 = 0; 
                __PYX_ERR(0, 2161, __pyx_L18_except_error)
              }
              __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
              __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
              __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
              goto __pyx_L17_exception_handled;
            }
            __pyx_L18_except_error:;
            __Pyx_XGIVEREF(__pyx_t_10);
            __Pyx_XGIVEREF(__pyx_t_11);
            __Pyx_XGIVEREF(__pyx_t_12);
            __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
            goto __pyx_L1_error;
            __pyx_L17_exception_handled:;
            __Pyx_XGIVEREF(__pyx_t_10);
            __Pyx_XGIVEREF(__pyx_t_11);
            __Pyx_XGIVEREF(__pyx_t_12);
            __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
            __pyx_L21_try_end:;
          }
        }
        /*finally:*/ {
          /*normal exit:*/{
            if (__pyx_t_9) {
              __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_mstate_global->__pyx_tuple[3], NULL);
              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
              if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2161, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_12);
              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
            }
            goto __pyx_L15;
          }
          __pyx_L15:;
        }
        goto __pyx_L25;
        __pyx_L12_error:;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L1_error;
        __pyx_L25:;
      }
    }
    __pyx_L11:;

    /* "lxml/etree.pyx":2165
 *                         f.write, with_comments=with_comments, strip_text=strip_text)
 *                     _tree_to_target(self, target)
 *             return             # <<<<<<<<<<<<<<
 * 
 *         if not with_comments:
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "lxml/etree.pyx":2151
 * 
 *         # C14N serialisation
 *         if method in ('c14n', 'c14n2'):             # <<<<<<<<<<<<<<
 *             if encoding is not None:
 *                 raise ValueError("Cannot specify encoding with C14N")
*/
  }

  /* "lxml/etree.pyx":2167
 *             return
 * 
 *         if not with_comments:             # <<<<<<<<<<<<<<
 *             raise ValueError("Can only discard comments in C14N serialisation")
 *         # suppress decl. in default case (purely for ElementTree compatibility)
*/
  __pyx_t_3 = (!__pyx_v_with_comments);
  if (unlikely(__pyx_t_3)) {

    /* "lxml/etree.pyx":2168
 * 
 *         if not with_comments:
 *             raise ValueError("Can only discard comments in C14N serialisation")             # <<<<<<<<<<<<<<
 *         # suppress decl. in default case (purely for ElementTree compatibility)
 *         if xml_declaration is not None:
*/
    __pyx_t_14 = NULL;
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_14, __pyx_mstate_global->__pyx_kp_u_Can_only_discard_comments_in_C14};
      __pyx_t_13 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 2168, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
    }
    __Pyx_Raise(__pyx_t_13, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __PYX_ERR(0, 2168, __pyx_L1_error)

    /* "lxml/etree.pyx":2167
 *             return
 * 
 *         if not with_comments:             # <<<<<<<<<<<<<<
 *             raise ValueError("Can only discard comments in C14N serialisation")
 *         # suppress decl. in default case (purely for ElementTree compatibility)
*/
  }

  /* "lxml/etree.pyx":2170
 *             raise ValueError("Can only discard comments in C14N serialisation")
 *         # suppress decl. in default case (purely for ElementTree compatibility)
 *         if xml_declaration is not None:             # <<<<<<<<<<<<<<
 *             write_declaration = xml_declaration
 *             if encoding is None:
*/
  __pyx_t_3 = (__pyx_v_xml_declaration != Py_None);
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":2171
 *         # suppress decl. in default case (purely for ElementTree compatibility)
 *         if xml_declaration is not None:
 *             write_declaration = xml_declaration             # <<<<<<<<<<<<<<
 *             if encoding is None:
 *                 encoding = 'ASCII'
*/
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_xml_declaration); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2171, __pyx_L1_error)
    __pyx_v_write_declaration = __pyx_t_3;

    /* "lxml/etree.pyx":2172
 *         if xml_declaration is not None:
 *             write_declaration = xml_declaration
 *             if encoding is None:             # <<<<<<<<<<<<<<
 *                 encoding = 'ASCII'
 *             else:
*/
    __pyx_t_3 = (__pyx_v_encoding == Py_None);
    if (__pyx_t_3) {

      /* "lxml/etree.pyx":2173
 *             write_declaration = xml_declaration
 *             if encoding is None:
 *                 encoding = 'ASCII'             # <<<<<<<<<<<<<<
 *             else:
 *                 encoding = encoding.upper()
*/
      __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_ASCII);
      __Pyx_DECREF_SET(__pyx_v_encoding, __pyx_mstate_global->__pyx_n_u_ASCII);

      /* "lxml/etree.pyx":2172
 *         if xml_declaration is not None:
 *             write_declaration = xml_declaration
 *             if encoding is None:             # <<<<<<<<<<<<<<
 *                 encoding = 'ASCII'
 *             else:
*/
      goto __pyx_L28;
    }

    /* "lxml/etree.pyx":2175
 *                 encoding = 'ASCII'
 *             else:
 *                 encoding = encoding.upper()             # <<<<<<<<<<<<<<
 *         elif encoding is None:
 *             encoding = 'ASCII'
*/
    /*else*/ {
      __pyx_t_14 = __pyx_v_encoding;
      __Pyx_INCREF(__pyx_t_14);
      __pyx_t_6 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_14, NULL};
        __pyx_t_13 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_upper, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 2175, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
      }
      __Pyx_DECREF_SET(__pyx_v_encoding, __pyx_t_13);
      __pyx_t_13 = 0;
    }
    __pyx_L28:;

    /* "lxml/etree.pyx":2170
 *             raise ValueError("Can only discard comments in C14N serialisation")
 *         # suppress decl. in default case (purely for ElementTree compatibility)
 *         if xml_declaration is not None:             # <<<<<<<<<<<<<<
 *             write_declaration = xml_declaration
 *             if encoding is None:
*/
    goto __pyx_L27;
  }

  /* "lxml/etree.pyx":2176
 *             else:
 *                 encoding = encoding.upper()
 *         elif encoding is None:             # <<<<<<<<<<<<<<
 *             encoding = 'ASCII'
 *             write_declaration = 0
*/
  __pyx_t_3 = (__pyx_v_encoding == Py_None);
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":2177
 *                 encoding = encoding.upper()
 *         elif encoding is None:
 *             encoding = 'ASCII'             # <<<<<<<<<<<<<<
 *             write_declaration = 0
 *         else:
*/
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_ASCII);
    __Pyx_DECREF_SET(__pyx_v_encoding, __pyx_mstate_global->__pyx_n_u_ASCII);

    /* "lxml/etree.pyx":2178
 *         elif encoding is None:
 *             encoding = 'ASCII'
 *             write_declaration = 0             # <<<<<<<<<<<<<<
 *         else:
 *             encoding = encoding.upper()
*/
    __pyx_v_write_declaration = 0;

    /* "lxml/etree.pyx":2176
 *             else:
 *                 encoding = encoding.upper()
 *         elif encoding is None:             # <<<<<<<<<<<<<<
 *             encoding = 'ASCII'
 *             write_declaration = 0
*/
    goto __pyx_L27;
  }

  /* "lxml/etree.pyx":2180
 *             write_declaration = 0
 *         else:
 *             encoding = encoding.upper()             # <<<<<<<<<<<<<<
 *             write_declaration = encoding not in (
 *                 'US-ASCII', 'ASCII', 'UTF8', 'UTF-8')
*/
  /*else*/ {
    __pyx_t_14 = __pyx_v_encoding;
    __Pyx_INCREF(__pyx_t_14);
    __pyx_t_6 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_14, NULL};
      __pyx_t_13 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_upper, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 2180, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
    }
    __Pyx_DECREF_SET(__pyx_v_encoding, __pyx_t_13);
    __pyx_t_13 = 0;

    /* "lxml/etree.pyx":2181
 *         else:
 *             encoding = encoding.upper()
 *             write_declaration = encoding not in (             # <<<<<<<<<<<<<<
 *                 'US-ASCII', 'ASCII', 'UTF8', 'UTF-8')
 *         if standalone is None:
*/
    __Pyx_INCREF(__pyx_v_encoding);
    __pyx_t_13 = __pyx_v_encoding;
    __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_t_13, __pyx_mstate_global->__pyx_kp_u_US_ASCII, Py_NE)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 2181, __pyx_L1_error)
    if (__pyx_t_4) {
    } else {
      __pyx_t_3 = __pyx_t_4;
      goto __pyx_L29_bool_binop_done;
    }
    __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_ASCII, Py_NE)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 2181, __pyx_L1_error)
    if (__pyx_t_4) {
    } else {
      __pyx_t_3 = __pyx_t_4;
      goto __pyx_L29_bool_binop_done;
    }
    __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_UTF8, Py_NE)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 2181, __pyx_L1_error)
    if (__pyx_t_4) {
    } else {
      __pyx_t_3 = __pyx_t_4;
      goto __pyx_L29_bool_binop_done;
    }
    __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_t_13, __pyx_mstate_global->__pyx_kp_u_UTF_8, Py_NE)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 2181, __pyx_L1_error)
    __pyx_t_3 = __pyx_t_4;
    __pyx_L29_bool_binop_done:;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_v_write_declaration = __pyx_t_3;
  }
  __pyx_L27:;

  /* "lxml/etree.pyx":2183
 *             write_declaration = encoding not in (
 *                 'US-ASCII', 'ASCII', 'UTF8', 'UTF-8')
 *         if standalone is None:             # <<<<<<<<<<<<<<
 *             is_standalone = -1
 *         elif standalone:
*/
  __pyx_t_3 = (__pyx_v_standalone == Py_None);
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":2184
 *                 'US-ASCII', 'ASCII', 'UTF8', 'UTF-8')
 *         if standalone is None:
 *             is_standalone = -1             # <<<<<<<<<<<<<<
 *         elif standalone:
 *             write_declaration = 1
*/
    __pyx_v_is_standalone = -1;

    /* "lxml/etree.pyx":2183
 *             write_declaration = encoding not in (
 *                 'US-ASCII', 'ASCII', 'UTF8', 'UTF-8')
 *         if standalone is None:             # <<<<<<<<<<<<<<
 *             is_standalone = -1
 *         elif standalone:
*/
    goto __pyx_L33;
  }

  /* "lxml/etree.pyx":2185
 *         if standalone is None:
 *             is_standalone = -1
 *         elif standalone:             # <<<<<<<<<<<<<<
 *             write_declaration = 1
 *             is_standalone = 1
*/
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_standalone); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 2185, __pyx_L1_error)
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":2186
 *             is_standalone = -1
 *         elif standalone:
 *             write_declaration = 1             # <<<<<<<<<<<<<<
 *             is_standalone = 1
 *         else:
*/
    __pyx_v_write_declaration = 1;

    /* "lxml/etree.pyx":2187
 *         elif standalone:
 *             write_declaration = 1
 *             is_standalone = 1             # <<<<<<<<<<<<<<
 *         else:
 *             write_declaration = 1
*/
    __pyx_v_is_standalone = 1;

    /* "lxml/etree.pyx":2185
 *         if standalone is None:
 *             is_standalone = -1
 *         elif standalone:             # <<<<<<<<<<<<<<
 *             write_declaration = 1
 *             is_standalone = 1
*/
    goto __pyx_L33;
  }

  /* "lxml/etree.pyx":2189
 *             is_standalone = 1
 *         else:
 *             write_declaration = 1             # <<<<<<<<<<<<<<
 *             is_standalone = 0
 * 
*/
  /*else*/ {
    __pyx_v_write_declaration = 1;

    /* "lxml/etree.pyx":2190
 *         else:
 *             write_declaration = 1
 *             is_standalone = 0             # <<<<<<<<<<<<<<
 * 
 *         if docstring is not None and doctype is None:
*/
    __pyx_v_is_standalone = 0;
  }
  __pyx_L33:;

  /* "lxml/etree.pyx":2192
 *             is_standalone = 0
 * 
 *         if docstring is not None and doctype is None:             # <<<<<<<<<<<<<<
 *             import warnings
 *             warnings.warn(
*/
  __pyx_t_4 = (__pyx_v_docstring != Py_None);
  if (__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L35_bool_binop_done;
  }
  __pyx_t_4 = (__pyx_v_doctype == Py_None);
  __pyx_t_3 = __pyx_t_4;
  __pyx_L35_bool_binop_done:;
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":2193
 * 
 *         if docstring is not None and doctype is None:
 *             import warnings             # <<<<<<<<<<<<<<
 *             warnings.warn(
 *                 "The 'docstring' option is deprecated. Use 'doctype' instead.",
*/
    __pyx_t_9 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_warnings, 0, 0, NULL, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2193, __pyx_L1_error)
    __pyx_t_13 = __pyx_t_9;
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_v_warnings = __pyx_t_13;
    __pyx_t_13 = 0;

    /* "lxml/etree.pyx":2194
 *         if docstring is not None and doctype is None:
 *             import warnings
 *             warnings.warn(             # <<<<<<<<<<<<<<
 *                 "The 'docstring' option is deprecated. Use 'doctype' instead.",
 *                 DeprecationWarning)
*/
    __pyx_t_14 = __pyx_v_warnings;
    __Pyx_INCREF(__pyx_t_14);

    /* "lxml/etree.pyx":2196
 *             warnings.warn(
 *                 "The 'docstring' option is deprecated. Use 'doctype' instead.",
 *                 DeprecationWarning)             # <<<<<<<<<<<<<<
 *             doctype = docstring
 * 
*/
    __pyx_t_6 = 0;
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_14, __pyx_mstate_global->__pyx_kp_u_The_docstring_option_is_deprecat, ((PyObject *)(((PyTypeObject*)PyExc_DeprecationWarning)))};
      __pyx_t_13 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_warn, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 2194, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
    }
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

    /* "lxml/etree.pyx":2197
 *                 "The 'docstring' option is deprecated. Use 'doctype' instead.",
 *                 DeprecationWarning)
 *             doctype = docstring             # <<<<<<<<<<<<<<
 * 
 *         _tofilelike(file, self._context_node, encoding, doctype, method,
*/
    __Pyx_INCREF(__pyx_v_docstring);
    __Pyx_DECREF_SET(__pyx_v_doctype, __pyx_v_docstring);

    /* "lxml/etree.pyx":2192
 *             is_standalone = 0
 * 
 *         if docstring is not None and doctype is None:             # <<<<<<<<<<<<<<
 *             import warnings
 *             warnings.warn(
*/
  }

  /* "lxml/etree.pyx":2199
 *             doctype = docstring
 * 
 *         _tofilelike(file, self._context_node, encoding, doctype, method,             # <<<<<<<<<<<<<<
 *                     write_declaration, 1, pretty_print, with_tail,
 *                     is_standalone, compression)
*/
  __pyx_t_13 = ((PyObject *)__pyx_v_self->_context_node);
  __Pyx_INCREF(__pyx_t_13);

  /* "lxml/etree.pyx":2201
 *         _tofilelike(file, self._context_node, encoding, doctype, method,
 *                     write_declaration, 1, pretty_print, with_tail,
 *                     is_standalone, compression)             # <<<<<<<<<<<<<<
 * 
 *     def getpath(self, _Element element not None):
*/
  __pyx_t_1 = __Pyx_PyLong_As_int(__pyx_v_compression); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2201, __pyx_L1_error)

  /* "lxml/etree.pyx":2199
 *             doctype = docstring
 * 
 *         _tofilelike(file, self._context_node, encoding, doctype, method,             # <<<<<<<<<<<<<<
 *                     write_declaration, 1, pretty_print, with_tail,
 *                     is_standalone, compression)
*/
  __pyx_t_14 = __pyx_f_4lxml_5etree__tofilelike(__pyx_v_file, ((struct LxmlElement *)__pyx_t_13), __pyx_v_encoding, __pyx_v_doctype, __pyx_v_method, __pyx_v_write_declaration, 1, __pyx_v_pretty_print, __pyx_v_with_tail, __pyx_v_is_standalone, __pyx_t_1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 2199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

  /* "lxml/etree.pyx":2093
 *         return None
 * 
 *     def write(self, file, *, encoding=None, method="xml",             # <<<<<<<<<<<<<<
 *               bint pretty_print=False, xml_declaration=None, bint with_tail=True,
 *               standalone=None, doctype=None, compression=0,
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_AddTraceback("lxml.etree._ElementTree.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_f);
  __Pyx_XDECREF((PyObject *)__pyx_v_target);
  __Pyx_XDECREF(__pyx_v_warnings);
  __Pyx_XDECREF(__pyx_v_encoding);
  __Pyx_XDECREF(__pyx_v_doctype);
  __Pyx_XDECREF(__pyx_v_compression);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2203
 *                     is_standalone, compression)
 * 
 *     def getpath(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         """getpath(self, element)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_13getpath(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_12_ElementTree_12getpath, "getpath(self, element)\n\n        Returns a structural, absolute XPath expression to find the element.\n\n        For namespaced elements, the expression uses prefixes from the\n        document, which therefore need to be provided in order to make any\n        use of the expression in XPath.\n\n        Also see the method getelementpath(self, element), which returns a\n        self-contained ElementPath expression.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_12_ElementTree_13getpath = {"getpath", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_13getpath, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_12getpath};
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_13getpath(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct LxmlElement *__pyx_v_element = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getpath (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_element,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 2203, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2203, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "getpath", 0) < (0)) __PYX_ERR(0, 2203, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("getpath", 1, 1, 1, i); __PYX_ERR(0, 2203, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2203, __pyx_L3_error)
    }
    __pyx_v_element = ((struct LxmlElement *)values[0]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getpath", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2203, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._ElementTree.getpath", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_element), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element, 0, "element", 0))) __PYX_ERR(0, 2203, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_12_ElementTree_12getpath(((struct LxmlElementTree *)__pyx_v_self), __pyx_v_element);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_12getpath(struct LxmlElementTree *__pyx_v_self, struct LxmlElement *__pyx_v_element) {
  struct LxmlDocument *__pyx_v_doc = 0;
  struct LxmlElement *__pyx_v_root = 0;
  xmlDoc *__pyx_v_c_doc;
  xmlChar *__pyx_v_c_path;
  PyObject *__pyx_v_path = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  xmlDoc *__pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getpath", 0);

  /* "lxml/etree.pyx":2218
 *         cdef _Element root
 *         cdef xmlDoc* c_doc
 *         _assertValidNode(element)             # <<<<<<<<<<<<<<
 *         if self._context_node is not None:
 *             root = self._context_node
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_element); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 2218, __pyx_L1_error)

  /* "lxml/etree.pyx":2219
 *         cdef xmlDoc* c_doc
 *         _assertValidNode(element)
 *         if self._context_node is not None:             # <<<<<<<<<<<<<<
 *             root = self._context_node
 *             doc = root._doc
*/
  __pyx_t_2 = (((PyObject *)__pyx_v_self->_context_node) != Py_None);
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":2220
 *         _assertValidNode(element)
 *         if self._context_node is not None:
 *             root = self._context_node             # <<<<<<<<<<<<<<
 *             doc = root._doc
 *         elif self._doc is not None:
*/
    __pyx_t_3 = ((PyObject *)__pyx_v_self->_context_node);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_v_root = ((struct LxmlElement *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "lxml/etree.pyx":2221
 *         if self._context_node is not None:
 *             root = self._context_node
 *             doc = root._doc             # <<<<<<<<<<<<<<
 *         elif self._doc is not None:
 *             doc = self._doc
*/
    __pyx_t_3 = ((PyObject *)__pyx_v_root->_doc);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "lxml/etree.pyx":2219
 *         cdef xmlDoc* c_doc
 *         _assertValidNode(element)
 *         if self._context_node is not None:             # <<<<<<<<<<<<<<
 *             root = self._context_node
 *             doc = root._doc
*/
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":2222
 *             root = self._context_node
 *             doc = root._doc
 *         elif self._doc is not None:             # <<<<<<<<<<<<<<
 *             doc = self._doc
 *             root = doc.getroot()
*/
  __pyx_t_2 = (((PyObject *)__pyx_v_self->_doc) != Py_None);
  if (likely(__pyx_t_2)) {

    /* "lxml/etree.pyx":2223
 *             doc = root._doc
 *         elif self._doc is not None:
 *             doc = self._doc             # <<<<<<<<<<<<<<
 *             root = doc.getroot()
 *         else:
*/
    __pyx_t_3 = ((PyObject *)__pyx_v_self->_doc);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "lxml/etree.pyx":2224
 *         elif self._doc is not None:
 *             doc = self._doc
 *             root = doc.getroot()             # <<<<<<<<<<<<<<
 *         else:
 *             raise ValueError, "Element is not in this tree."
*/
    __pyx_t_3 = __pyx_f_4lxml_5etree_9_Document_getroot(__pyx_v_doc); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2224, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element))))) __PYX_ERR(0, 2224, __pyx_L1_error)
    __pyx_v_root = ((struct LxmlElement *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "lxml/etree.pyx":2222
 *             root = self._context_node
 *             doc = root._doc
 *         elif self._doc is not None:             # <<<<<<<<<<<<<<
 *             doc = self._doc
 *             root = doc.getroot()
*/
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":2226
 *             root = doc.getroot()
 *         else:
 *             raise ValueError, "Element is not in this tree."             # <<<<<<<<<<<<<<
 *         _assertValidDoc(doc)
 *         _assertValidNode(root)
*/
  /*else*/ {
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Element_is_not_in_this_tree, 0, 0);
    __PYX_ERR(0, 2226, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "lxml/etree.pyx":2227
 *         else:
 *             raise ValueError, "Element is not in this tree."
 *         _assertValidDoc(doc)             # <<<<<<<<<<<<<<
 *         _assertValidNode(root)
 *         if element._doc is not doc:
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidDoc(__pyx_v_doc); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 2227, __pyx_L1_error)

  /* "lxml/etree.pyx":2228
 *             raise ValueError, "Element is not in this tree."
 *         _assertValidDoc(doc)
 *         _assertValidNode(root)             # <<<<<<<<<<<<<<
 *         if element._doc is not doc:
 *             raise ValueError, "Element is not in this tree."
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_root); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 2228, __pyx_L1_error)

  /* "lxml/etree.pyx":2229
 *         _assertValidDoc(doc)
 *         _assertValidNode(root)
 *         if element._doc is not doc:             # <<<<<<<<<<<<<<
 *             raise ValueError, "Element is not in this tree."
 * 
*/
  __pyx_t_2 = (__pyx_v_element->_doc != __pyx_v_doc);
  if (unlikely(__pyx_t_2)) {

    /* "lxml/etree.pyx":2230
 *         _assertValidNode(root)
 *         if element._doc is not doc:
 *             raise ValueError, "Element is not in this tree."             # <<<<<<<<<<<<<<
 * 
 *         c_doc = _fakeRootDoc(doc._c_doc, root._c_node)
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Element_is_not_in_this_tree, 0, 0);
    __PYX_ERR(0, 2230, __pyx_L1_error)

    /* "lxml/etree.pyx":2229
 *         _assertValidDoc(doc)
 *         _assertValidNode(root)
 *         if element._doc is not doc:             # <<<<<<<<<<<<<<
 *             raise ValueError, "Element is not in this tree."
 * 
*/
  }

  /* "lxml/etree.pyx":2232
 *             raise ValueError, "Element is not in this tree."
 * 
 *         c_doc = _fakeRootDoc(doc._c_doc, root._c_node)             # <<<<<<<<<<<<<<
 *         c_path = tree.xmlGetNodePath(element._c_node)
 *         _destroyFakeDoc(doc._c_doc, c_doc)
*/
  __pyx_t_4 = __pyx_f_4lxml_5etree__fakeRootDoc(__pyx_v_doc->_c_doc, __pyx_v_root->_c_node); if (unlikely(__pyx_t_4 == ((void *)NULL))) __PYX_ERR(0, 2232, __pyx_L1_error)
  __pyx_v_c_doc = __pyx_t_4;

  /* "lxml/etree.pyx":2233
 * 
 *         c_doc = _fakeRootDoc(doc._c_doc, root._c_node)
 *         c_path = tree.xmlGetNodePath(element._c_node)             # <<<<<<<<<<<<<<
 *         _destroyFakeDoc(doc._c_doc, c_doc)
 *         if c_path is NULL:
*/
  __pyx_v_c_path = xmlGetNodePath(__pyx_v_element->_c_node);

  /* "lxml/etree.pyx":2234
 *         c_doc = _fakeRootDoc(doc._c_doc, root._c_node)
 *         c_path = tree.xmlGetNodePath(element._c_node)
 *         _destroyFakeDoc(doc._c_doc, c_doc)             # <<<<<<<<<<<<<<
 *         if c_path is NULL:
 *             raise MemoryError()
*/
  __pyx_f_4lxml_5etree__destroyFakeDoc(__pyx_v_doc->_c_doc, __pyx_v_c_doc);

  /* "lxml/etree.pyx":2235
 *         c_path = tree.xmlGetNodePath(element._c_node)
 *         _destroyFakeDoc(doc._c_doc, c_doc)
 *         if c_path is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 *         path = funicode(c_path)
*/
  __pyx_t_2 = (__pyx_v_c_path == NULL);
  if (unlikely(__pyx_t_2)) {

    /* "lxml/etree.pyx":2236
 *         _destroyFakeDoc(doc._c_doc, c_doc)
 *         if c_path is NULL:
 *             raise MemoryError()             # <<<<<<<<<<<<<<
 *         path = funicode(c_path)
 *         tree.xmlFree(c_path)
*/
    PyErr_NoMemory(); __PYX_ERR(0, 2236, __pyx_L1_error)

    /* "lxml/etree.pyx":2235
 *         c_path = tree.xmlGetNodePath(element._c_node)
 *         _destroyFakeDoc(doc._c_doc, c_doc)
 *         if c_path is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 *         path = funicode(c_path)
*/
  }

  /* "lxml/etree.pyx":2237
 *         if c_path is NULL:
 *             raise MemoryError()
 *         path = funicode(c_path)             # <<<<<<<<<<<<<<
 *         tree.xmlFree(c_path)
 *         return path
*/
  __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_path); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2237, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_path = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "lxml/etree.pyx":2238
 *             raise MemoryError()
 *         path = funicode(c_path)
 *         tree.xmlFree(c_path)             # <<<<<<<<<<<<<<
 *         return path
 * 
*/
  xmlFree(__pyx_v_c_path);

  /* "lxml/etree.pyx":2239
 *         path = funicode(c_path)
 *         tree.xmlFree(c_path)
 *         return path             # <<<<<<<<<<<<<<
 * 
 *     def getelementpath(self, _Element element not None):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_path);
  __pyx_r = __pyx_v_path;
  goto __pyx_L0;

  /* "lxml/etree.pyx":2203
 *                     is_standalone, compression)
 * 
 *     def getpath(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         """getpath(self, element)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._ElementTree.getpath", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XDECREF((PyObject *)__pyx_v_root);
  __Pyx_XDECREF(__pyx_v_path);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2241
 *         return path
 * 
 *     def getelementpath(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         """getelementpath(self, element)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_15getelementpath(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_12_ElementTree_14getelementpath, "getelementpath(self, element)\n\n        Returns a structural, absolute ElementPath expression to find the\n        element.  This path can be used in the .find() method to look up\n        the element, provided that the elements along the path and their\n        list of immediate children were not modified in between.\n\n        ElementPath has the advantage over an XPath expression (as returned\n        by the .getpath() method) that it does not require additional prefix\n        declarations.  It is always self-contained.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_12_ElementTree_15getelementpath = {"getelementpath", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_15getelementpath, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_14getelementpath};
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_15getelementpath(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct LxmlElement *__pyx_v_element = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getelementpath (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_element,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 2241, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2241, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "getelementpath", 0) < (0)) __PYX_ERR(0, 2241, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("getelementpath", 1, 1, 1, i); __PYX_ERR(0, 2241, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2241, __pyx_L3_error)
    }
    __pyx_v_element = ((struct LxmlElement *)values[0]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getelementpath", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2241, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._ElementTree.getelementpath", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_element), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element, 0, "element", 0))) __PYX_ERR(0, 2241, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_12_ElementTree_14getelementpath(((struct LxmlElementTree *)__pyx_v_self), __pyx_v_element);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_14getelementpath(struct LxmlElementTree *__pyx_v_self, struct LxmlElement *__pyx_v_element) {
  struct LxmlElement *__pyx_v_root = 0;
  Py_ssize_t __pyx_v_count;
  PyObject *__pyx_v_path = NULL;
  xmlNode *__pyx_v_c_element;
  const xmlChar *__pyx_v_c_name;
  const xmlChar *__pyx_v_c_href;
  PyObject *__pyx_v_tag = NULL;
  xmlNode *__pyx_v_c_node;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  xmlNode *__pyx_t_4;
  const xmlChar *__pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7[4];
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getelementpath", 0);

  /* "lxml/etree.pyx":2255
 *         cdef _Element root
 *         cdef Py_ssize_t count
 *         _assertValidNode(element)             # <<<<<<<<<<<<<<
 *         if element._c_node.type != tree.XML_ELEMENT_NODE:
 *             raise ValueError, "input is not an Element"
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_element); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 2255, __pyx_L1_error)

  /* "lxml/etree.pyx":2256
 *         cdef Py_ssize_t count
 *         _assertValidNode(element)
 *         if element._c_node.type != tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *             raise ValueError, "input is not an Element"
 *         if self._context_node is not None:
*/
  __pyx_t_2 = (__pyx_v_element->_c_node->type != XML_ELEMENT_NODE);
  if (unlikely(__pyx_t_2)) {

    /* "lxml/etree.pyx":2257
 *         _assertValidNode(element)
 *         if element._c_node.type != tree.XML_ELEMENT_NODE:
 *             raise ValueError, "input is not an Element"             # <<<<<<<<<<<<<<
 *         if self._context_node is not None:
 *             root = self._context_node
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_input_is_not_an_Element, 0, 0);
    __PYX_ERR(0, 2257, __pyx_L1_error)

    /* "lxml/etree.pyx":2256
 *         cdef Py_ssize_t count
 *         _assertValidNode(element)
 *         if element._c_node.type != tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *             raise ValueError, "input is not an Element"
 *         if self._context_node is not None:
*/
  }

  /* "lxml/etree.pyx":2258
 *         if element._c_node.type != tree.XML_ELEMENT_NODE:
 *             raise ValueError, "input is not an Element"
 *         if self._context_node is not None:             # <<<<<<<<<<<<<<
 *             root = self._context_node
 *         elif self._doc is not None:
*/
  __pyx_t_2 = (((PyObject *)__pyx_v_self->_context_node) != Py_None);
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":2259
 *             raise ValueError, "input is not an Element"
 *         if self._context_node is not None:
 *             root = self._context_node             # <<<<<<<<<<<<<<
 *         elif self._doc is not None:
 *             root = self._doc.getroot()
*/
    __pyx_t_3 = ((PyObject *)__pyx_v_self->_context_node);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_v_root = ((struct LxmlElement *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "lxml/etree.pyx":2258
 *         if element._c_node.type != tree.XML_ELEMENT_NODE:
 *             raise ValueError, "input is not an Element"
 *         if self._context_node is not None:             # <<<<<<<<<<<<<<
 *             root = self._context_node
 *         elif self._doc is not None:
*/
    goto __pyx_L4;
  }

  /* "lxml/etree.pyx":2260
 *         if self._context_node is not None:
 *             root = self._context_node
 *         elif self._doc is not None:             # <<<<<<<<<<<<<<
 *             root = self._doc.getroot()
 *         else:
*/
  __pyx_t_2 = (((PyObject *)__pyx_v_self->_doc) != Py_None);
  if (likely(__pyx_t_2)) {

    /* "lxml/etree.pyx":2261
 *             root = self._context_node
 *         elif self._doc is not None:
 *             root = self._doc.getroot()             # <<<<<<<<<<<<<<
 *         else:
 *             raise ValueError, "Element is not in this tree"
*/
    __pyx_t_3 = __pyx_f_4lxml_5etree_9_Document_getroot(__pyx_v_self->_doc); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2261, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element))))) __PYX_ERR(0, 2261, __pyx_L1_error)
    __pyx_v_root = ((struct LxmlElement *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "lxml/etree.pyx":2260
 *         if self._context_node is not None:
 *             root = self._context_node
 *         elif self._doc is not None:             # <<<<<<<<<<<<<<
 *             root = self._doc.getroot()
 *         else:
*/
    goto __pyx_L4;
  }

  /* "lxml/etree.pyx":2263
 *             root = self._doc.getroot()
 *         else:
 *             raise ValueError, "Element is not in this tree"             # <<<<<<<<<<<<<<
 *         _assertValidNode(root)
 *         if element._doc is not root._doc:
*/
  /*else*/ {
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Element_is_not_in_this_tree_2, 0, 0);
    __PYX_ERR(0, 2263, __pyx_L1_error)
  }
  __pyx_L4:;

  /* "lxml/etree.pyx":2264
 *         else:
 *             raise ValueError, "Element is not in this tree"
 *         _assertValidNode(root)             # <<<<<<<<<<<<<<
 *         if element._doc is not root._doc:
 *             raise ValueError, "Element is not in this tree"
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_root); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 2264, __pyx_L1_error)

  /* "lxml/etree.pyx":2265
 *             raise ValueError, "Element is not in this tree"
 *         _assertValidNode(root)
 *         if element._doc is not root._doc:             # <<<<<<<<<<<<<<
 *             raise ValueError, "Element is not in this tree"
 * 
*/
  __pyx_t_2 = (__pyx_v_element->_doc != __pyx_v_root->_doc);
  if (unlikely(__pyx_t_2)) {

    /* "lxml/etree.pyx":2266
 *         _assertValidNode(root)
 *         if element._doc is not root._doc:
 *             raise ValueError, "Element is not in this tree"             # <<<<<<<<<<<<<<
 * 
 *         path = []
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Element_is_not_in_this_tree_2, 0, 0);
    __PYX_ERR(0, 2266, __pyx_L1_error)

    /* "lxml/etree.pyx":2265
 *             raise ValueError, "Element is not in this tree"
 *         _assertValidNode(root)
 *         if element._doc is not root._doc:             # <<<<<<<<<<<<<<
 *             raise ValueError, "Element is not in this tree"
 * 
*/
  }

  /* "lxml/etree.pyx":2268
 *             raise ValueError, "Element is not in this tree"
 * 
 *         path = []             # <<<<<<<<<<<<<<
 *         c_element = element._c_node
 *         while c_element is not root._c_node:
*/
  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2268, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_path = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "lxml/etree.pyx":2269
 * 
 *         path = []
 *         c_element = element._c_node             # <<<<<<<<<<<<<<
 *         while c_element is not root._c_node:
 *             c_name = c_element.name
*/
  __pyx_t_4 = __pyx_v_element->_c_node;
  __pyx_v_c_element = __pyx_t_4;

  /* "lxml/etree.pyx":2270
 *         path = []
 *         c_element = element._c_node
 *         while c_element is not root._c_node:             # <<<<<<<<<<<<<<
 *             c_name = c_element.name
 *             c_href = _getNs(c_element)
*/
  while (1) {
    __pyx_t_2 = (__pyx_v_c_element != __pyx_v_root->_c_node);
    if (!__pyx_t_2) break;

    /* "lxml/etree.pyx":2271
 *         c_element = element._c_node
 *         while c_element is not root._c_node:
 *             c_name = c_element.name             # <<<<<<<<<<<<<<
 *             c_href = _getNs(c_element)
 *             tag = _namespacedNameFromNsName(c_href, c_name)
*/
    __pyx_t_5 = __pyx_v_c_element->name;
    __pyx_v_c_name = __pyx_t_5;

    /* "lxml/etree.pyx":2272
 *         while c_element is not root._c_node:
 *             c_name = c_element.name
 *             c_href = _getNs(c_element)             # <<<<<<<<<<<<<<
 *             tag = _namespacedNameFromNsName(c_href, c_name)
 *             if c_href is NULL:
*/
    __pyx_v_c_href = _getNs(__pyx_v_c_element);

    /* "lxml/etree.pyx":2273
 *             c_name = c_element.name
 *             c_href = _getNs(c_element)
 *             tag = _namespacedNameFromNsName(c_href, c_name)             # <<<<<<<<<<<<<<
 *             if c_href is NULL:
 *                 c_href = <const_xmlChar*>b''  # no namespace (NULL is wildcard)
*/
    __pyx_t_3 = __pyx_f_4lxml_5etree__namespacedNameFromNsName(__pyx_v_c_href, __pyx_v_c_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2273, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_tag, ((PyObject*)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "lxml/etree.pyx":2274
 *             c_href = _getNs(c_element)
 *             tag = _namespacedNameFromNsName(c_href, c_name)
 *             if c_href is NULL:             # <<<<<<<<<<<<<<
 *                 c_href = <const_xmlChar*>b''  # no namespace (NULL is wildcard)
 *             # use tag[N] if there are preceding siblings with the same tag
*/
    __pyx_t_2 = (__pyx_v_c_href == NULL);
    if (__pyx_t_2) {

      /* "lxml/etree.pyx":2275
 *             tag = _namespacedNameFromNsName(c_href, c_name)
 *             if c_href is NULL:
 *                 c_href = <const_xmlChar*>b''  # no namespace (NULL is wildcard)             # <<<<<<<<<<<<<<
 *             # use tag[N] if there are preceding siblings with the same tag
 *             count = 0
*/
      __pyx_v_c_href = ((const xmlChar *)((const xmlChar *)__pyx_k__8));

      /* "lxml/etree.pyx":2274
 *             c_href = _getNs(c_element)
 *             tag = _namespacedNameFromNsName(c_href, c_name)
 *             if c_href is NULL:             # <<<<<<<<<<<<<<
 *                 c_href = <const_xmlChar*>b''  # no namespace (NULL is wildcard)
 *             # use tag[N] if there are preceding siblings with the same tag
*/
    }

    /* "lxml/etree.pyx":2277
 *                 c_href = <const_xmlChar*>b''  # no namespace (NULL is wildcard)
 *             # use tag[N] if there are preceding siblings with the same tag
 *             count = 0             # <<<<<<<<<<<<<<
 *             c_node = c_element.prev
 *             while c_node is not NULL:
*/
    __pyx_v_count = 0;

    /* "lxml/etree.pyx":2278
 *             # use tag[N] if there are preceding siblings with the same tag
 *             count = 0
 *             c_node = c_element.prev             # <<<<<<<<<<<<<<
 *             while c_node is not NULL:
 *                 if c_node.type == tree.XML_ELEMENT_NODE:
*/
    __pyx_t_4 = __pyx_v_c_element->prev;
    __pyx_v_c_node = __pyx_t_4;

    /* "lxml/etree.pyx":2279
 *             count = 0
 *             c_node = c_element.prev
 *             while c_node is not NULL:             # <<<<<<<<<<<<<<
 *                 if c_node.type == tree.XML_ELEMENT_NODE:
 *                     if _tagMatches(c_node, c_href, c_name):
*/
    while (1) {
      __pyx_t_2 = (__pyx_v_c_node != NULL);
      if (!__pyx_t_2) break;

      /* "lxml/etree.pyx":2280
 *             c_node = c_element.prev
 *             while c_node is not NULL:
 *                 if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *                     if _tagMatches(c_node, c_href, c_name):
 *                         count += 1
*/
      __pyx_t_2 = (__pyx_v_c_node->type == XML_ELEMENT_NODE);
      if (__pyx_t_2) {

        /* "lxml/etree.pyx":2281
 *             while c_node is not NULL:
 *                 if c_node.type == tree.XML_ELEMENT_NODE:
 *                     if _tagMatches(c_node, c_href, c_name):             # <<<<<<<<<<<<<<
 *                         count += 1
 *                 c_node = c_node.prev
*/
        __pyx_t_2 = __pyx_f_4lxml_5etree__tagMatches(__pyx_v_c_node, __pyx_v_c_href, __pyx_v_c_name);
        if (__pyx_t_2) {

          /* "lxml/etree.pyx":2282
 *                 if c_node.type == tree.XML_ELEMENT_NODE:
 *                     if _tagMatches(c_node, c_href, c_name):
 *                         count += 1             # <<<<<<<<<<<<<<
 *                 c_node = c_node.prev
 *             if count:
*/
          __pyx_v_count = (__pyx_v_count + 1);

          /* "lxml/etree.pyx":2281
 *             while c_node is not NULL:
 *                 if c_node.type == tree.XML_ELEMENT_NODE:
 *                     if _tagMatches(c_node, c_href, c_name):             # <<<<<<<<<<<<<<
 *                         count += 1
 *                 c_node = c_node.prev
*/
        }

        /* "lxml/etree.pyx":2280
 *             c_node = c_element.prev
 *             while c_node is not NULL:
 *                 if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *                     if _tagMatches(c_node, c_href, c_name):
 *                         count += 1
*/
      }

      /* "lxml/etree.pyx":2283
 *                     if _tagMatches(c_node, c_href, c_name):
 *                         count += 1
 *                 c_node = c_node.prev             # <<<<<<<<<<<<<<
 *             if count:
 *                 tag = f'{tag}[{count+1}]'
*/
      __pyx_t_4 = __pyx_v_c_node->prev;
      __pyx_v_c_node = __pyx_t_4;
    }

    /* "lxml/etree.pyx":2284
 *                         count += 1
 *                 c_node = c_node.prev
 *             if count:             # <<<<<<<<<<<<<<
 *                 tag = f'{tag}[{count+1}]'
 *             else:
*/
    __pyx_t_2 = (__pyx_v_count != 0);
    if (__pyx_t_2) {

      /* "lxml/etree.pyx":2285
 *                 c_node = c_node.prev
 *             if count:
 *                 tag = f'{tag}[{count+1}]'             # <<<<<<<<<<<<<<
 *             else:
 *                 # use tag[1] if there are following siblings with the same tag
*/
      __pyx_t_3 = __Pyx_PyUnicode_Unicode(__pyx_v_tag); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2285, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = __Pyx_PyUnicode_From_Py_ssize_t((__pyx_v_count + 1), 0, ' ', 'd'); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2285, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7[0] = __pyx_t_3;
      __pyx_t_7[1] = __pyx_mstate_global->__pyx_kp_u__21;
      __pyx_t_7[2] = __pyx_t_6;
      __pyx_t_7[3] = __pyx_mstate_global->__pyx_kp_u__22;
      __pyx_t_8 = __Pyx_PyUnicode_Join(__pyx_t_7, 4, __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 1 * 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3));
      if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2285, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF_SET(__pyx_v_tag, ((PyObject*)__pyx_t_8));
      __pyx_t_8 = 0;

      /* "lxml/etree.pyx":2284
 *                         count += 1
 *                 c_node = c_node.prev
 *             if count:             # <<<<<<<<<<<<<<
 *                 tag = f'{tag}[{count+1}]'
 *             else:
*/
      goto __pyx_L13;
    }

    /* "lxml/etree.pyx":2288
 *             else:
 *                 # use tag[1] if there are following siblings with the same tag
 *                 c_node = c_element.next             # <<<<<<<<<<<<<<
 *                 while c_node is not NULL:
 *                     if c_node.type == tree.XML_ELEMENT_NODE:
*/
    /*else*/ {
      __pyx_t_4 = __pyx_v_c_element->next;
      __pyx_v_c_node = __pyx_t_4;

      /* "lxml/etree.pyx":2289
 *                 # use tag[1] if there are following siblings with the same tag
 *                 c_node = c_element.next
 *                 while c_node is not NULL:             # <<<<<<<<<<<<<<
 *                     if c_node.type == tree.XML_ELEMENT_NODE:
 *                         if _tagMatches(c_node, c_href, c_name):
*/
      while (1) {
        __pyx_t_2 = (__pyx_v_c_node != NULL);
        if (!__pyx_t_2) break;

        /* "lxml/etree.pyx":2290
 *                 c_node = c_element.next
 *                 while c_node is not NULL:
 *                     if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *                         if _tagMatches(c_node, c_href, c_name):
 *                             tag += '[1]'
*/
        __pyx_t_2 = (__pyx_v_c_node->type == XML_ELEMENT_NODE);
        if (__pyx_t_2) {

          /* "lxml/etree.pyx":2291
 *                 while c_node is not NULL:
 *                     if c_node.type == tree.XML_ELEMENT_NODE:
 *                         if _tagMatches(c_node, c_href, c_name):             # <<<<<<<<<<<<<<
 *                             tag += '[1]'
 *                             break
*/
          __pyx_t_2 = __pyx_f_4lxml_5etree__tagMatches(__pyx_v_c_node, __pyx_v_c_href, __pyx_v_c_name);
          if (__pyx_t_2) {

            /* "lxml/etree.pyx":2292
 *                     if c_node.type == tree.XML_ELEMENT_NODE:
 *                         if _tagMatches(c_node, c_href, c_name):
 *                             tag += '[1]'             # <<<<<<<<<<<<<<
 *                             break
 *                     c_node = c_node.next
*/
            __pyx_t_8 = __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_OwnStrongReferenceInPlaceSafe(__pyx_v_tag, __pyx_mstate_global->__pyx_kp_u_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2292, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_DECREF_SET(__pyx_v_tag, ((PyObject*)__pyx_t_8));
            __pyx_t_8 = 0;

            /* "lxml/etree.pyx":2293
 *                         if _tagMatches(c_node, c_href, c_name):
 *                             tag += '[1]'
 *                             break             # <<<<<<<<<<<<<<
 *                     c_node = c_node.next
 * 
*/
            goto __pyx_L15_break;

            /* "lxml/etree.pyx":2291
 *                 while c_node is not NULL:
 *                     if c_node.type == tree.XML_ELEMENT_NODE:
 *                         if _tagMatches(c_node, c_href, c_name):             # <<<<<<<<<<<<<<
 *                             tag += '[1]'
 *                             break
*/
          }

          /* "lxml/etree.pyx":2290
 *                 c_node = c_element.next
 *                 while c_node is not NULL:
 *                     if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *                         if _tagMatches(c_node, c_href, c_name):
 *                             tag += '[1]'
*/
        }

        /* "lxml/etree.pyx":2294
 *                             tag += '[1]'
 *                             break
 *                     c_node = c_node.next             # <<<<<<<<<<<<<<
 * 
 *             path.append(tag)
*/
        __pyx_t_4 = __pyx_v_c_node->next;
        __pyx_v_c_node = __pyx_t_4;
      }
      __pyx_L15_break:;
    }
    __pyx_L13:;

    /* "lxml/etree.pyx":2296
 *                     c_node = c_node.next
 * 
 *             path.append(tag)             # <<<<<<<<<<<<<<
 *             c_element = c_element.parent
 *             if c_element is NULL or c_element.type != tree.XML_ELEMENT_NODE:
*/
    __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_path, __pyx_v_tag); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 2296, __pyx_L1_error)

    /* "lxml/etree.pyx":2297
 * 
 *             path.append(tag)
 *             c_element = c_element.parent             # <<<<<<<<<<<<<<
 *             if c_element is NULL or c_element.type != tree.XML_ELEMENT_NODE:
 *                 raise ValueError, "Element is not in this tree."
*/
    __pyx_t_4 = __pyx_v_c_element->parent;
    __pyx_v_c_element = __pyx_t_4;

    /* "lxml/etree.pyx":2298
 *             path.append(tag)
 *             c_element = c_element.parent
 *             if c_element is NULL or c_element.type != tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *                 raise ValueError, "Element is not in this tree."
 *         if not path:
*/
    __pyx_t_10 = (__pyx_v_c_element == NULL);
    if (!__pyx_t_10) {
    } else {
      __pyx_t_2 = __pyx_t_10;
      goto __pyx_L19_bool_binop_done;
    }
    __pyx_t_10 = (__pyx_v_c_element->type != XML_ELEMENT_NODE);
    __pyx_t_2 = __pyx_t_10;
    __pyx_L19_bool_binop_done:;
    if (unlikely(__pyx_t_2)) {

      /* "lxml/etree.pyx":2299
 *             c_element = c_element.parent
 *             if c_element is NULL or c_element.type != tree.XML_ELEMENT_NODE:
 *                 raise ValueError, "Element is not in this tree."             # <<<<<<<<<<<<<<
 *         if not path:
 *             return '.'
*/
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Element_is_not_in_this_tree, 0, 0);
      __PYX_ERR(0, 2299, __pyx_L1_error)

      /* "lxml/etree.pyx":2298
 *             path.append(tag)
 *             c_element = c_element.parent
 *             if c_element is NULL or c_element.type != tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *                 raise ValueError, "Element is not in this tree."
 *         if not path:
*/
    }
  }

  /* "lxml/etree.pyx":2300
 *             if c_element is NULL or c_element.type != tree.XML_ELEMENT_NODE:
 *                 raise ValueError, "Element is not in this tree."
 *         if not path:             # <<<<<<<<<<<<<<
 *             return '.'
 *         path.reverse()
*/
  {
    Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_v_path);
    if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(0, 2300, __pyx_L1_error)
    __pyx_t_2 = (__pyx_temp != 0);
  }

  __pyx_t_10 = (!__pyx_t_2);
  if (__pyx_t_10) {

    /* "lxml/etree.pyx":2301
 *                 raise ValueError, "Element is not in this tree."
 *         if not path:
 *             return '.'             # <<<<<<<<<<<<<<
 *         path.reverse()
 *         return '/'.join(path)
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u__2);
    __pyx_r = __pyx_mstate_global->__pyx_kp_u__2;
    goto __pyx_L0;

    /* "lxml/etree.pyx":2300
 *             if c_element is NULL or c_element.type != tree.XML_ELEMENT_NODE:
 *                 raise ValueError, "Element is not in this tree."
 *         if not path:             # <<<<<<<<<<<<<<
 *             return '.'
 *         path.reverse()
*/
  }

  /* "lxml/etree.pyx":2302
 *         if not path:
 *             return '.'
 *         path.reverse()             # <<<<<<<<<<<<<<
 *         return '/'.join(path)
 * 
*/
  __pyx_t_9 = PyList_Reverse(__pyx_v_path); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 2302, __pyx_L1_error)

  /* "lxml/etree.pyx":2303
 *             return '.'
 *         path.reverse()
 *         return '/'.join(path)             # <<<<<<<<<<<<<<
 * 
 *     def getiterator(self, tag=None, *tags):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_8 = PyUnicode_Join(__pyx_mstate_global->__pyx_kp_u__23, __pyx_v_path); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2303, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_r = __pyx_t_8;
  __pyx_t_8 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":2241
 *         return path
 * 
 *     def getelementpath(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         """getelementpath(self, element)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("lxml.etree._ElementTree.getelementpath", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_root);
  __Pyx_XDECREF(__pyx_v_path);
  __Pyx_XDECREF(__pyx_v_tag);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2305
 *         return '/'.join(path)
 * 
 *     def getiterator(self, tag=None, *tags):             # <<<<<<<<<<<<<<
 *         """getiterator(self, *tags, tag=None)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_17getiterator(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_12_ElementTree_16getiterator, "getiterator(self, *tags, tag=None)\n\n        Returns a sequence or iterator of all elements in document order\n        (depth first pre-order), starting with the root element.\n\n        Can be restricted to find only elements with specific tags,\n        see `_Element.iter`.\n\n        :deprecated: Note that this method is deprecated as of\n          ElementTree 1.3 and lxml 2.0.  It returns an iterator in\n          lxml, which diverges from the original ElementTree\n          behaviour.  If you want an efficient iterator, use the\n          ``tree.iter()`` method instead.  You should only use this\n          method in new code if you require backwards compatibility\n          with older versions of lxml or ElementTree.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_12_ElementTree_17getiterator = {"getiterator", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_17getiterator, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_16getiterator};
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_17getiterator(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_v_tags = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getiterator (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  __pyx_v_tags = __Pyx_ArgsSlice_FASTCALL(__pyx_args, 1, __pyx_nargs);
  if (unlikely(!__pyx_v_tags)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_v_tags);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_tag,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 2305, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        default:
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2305, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      const Py_ssize_t used_pos_args = (kwd_pos_args < 1) ? kwd_pos_args : 1;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, used_pos_args, __pyx_kwds_len, "getiterator", 0) < (0)) __PYX_ERR(0, 2305, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
    } else {
      switch (__pyx_nargs) {
        default:
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2305, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_tag = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v_tags); __pyx_v_tags = 0;
  __Pyx_AddTraceback("lxml.etree._ElementTree.getiterator", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_12_ElementTree_16getiterator(((struct LxmlElementTree *)__pyx_v_self), __pyx_v_tag, __pyx_v_tags);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v_tags);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_16getiterator(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_tags) {
  PyObject *__pyx_v_root = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getiterator", 0);
  __Pyx_INCREF(__pyx_v_tags);

  /* "lxml/etree.pyx":2322
 *           with older versions of lxml or ElementTree.
 *         """
 *         root = self.getroot()             # <<<<<<<<<<<<<<
 *         if root is None:
 *             return ITER_EMPTY
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_getroot, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2322, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v_root = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "lxml/etree.pyx":2323
 *         """
 *         root = self.getroot()
 *         if root is None:             # <<<<<<<<<<<<<<
 *             return ITER_EMPTY
 *         if tag is not None:
*/
  __pyx_t_4 = (__pyx_v_root == Py_None);
  if (__pyx_t_4) {

    /* "lxml/etree.pyx":2324
 *         root = self.getroot()
 *         if root is None:
 *             return ITER_EMPTY             # <<<<<<<<<<<<<<
 *         if tag is not None:
 *             tags += (tag,)
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_4lxml_5etree_ITER_EMPTY);
    __pyx_r = __pyx_v_4lxml_5etree_ITER_EMPTY;
    goto __pyx_L0;

    /* "lxml/etree.pyx":2323
 *         """
 *         root = self.getroot()
 *         if root is None:             # <<<<<<<<<<<<<<
 *             return ITER_EMPTY
 *         if tag is not None:
*/
  }

  /* "lxml/etree.pyx":2325
 *         if root is None:
 *             return ITER_EMPTY
 *         if tag is not None:             # <<<<<<<<<<<<<<
 *             tags += (tag,)
 *         return root.getiterator(*tags)
*/
  __pyx_t_4 = (__pyx_v_tag != Py_None);
  if (__pyx_t_4) {

    /* "lxml/etree.pyx":2326
 *             return ITER_EMPTY
 *         if tag is not None:
 *             tags += (tag,)             # <<<<<<<<<<<<<<
 *         return root.getiterator(*tags)
 * 
*/
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2326, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v_tag);
    __Pyx_GIVEREF(__pyx_v_tag);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_tag) != (0)) __PYX_ERR(0, 2326, __pyx_L1_error);
    __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_tags, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2326, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_tags, ((PyObject*)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "lxml/etree.pyx":2325
 *         if root is None:
 *             return ITER_EMPTY
 *         if tag is not None:             # <<<<<<<<<<<<<<
 *             tags += (tag,)
 *         return root.getiterator(*tags)
*/
  }

  /* "lxml/etree.pyx":2327
 *         if tag is not None:
 *             tags += (tag,)
 *         return root.getiterator(*tags)             # <<<<<<<<<<<<<<
 * 
 *     def iter(self, tag=None, *tags):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_root, __pyx_mstate_global->__pyx_n_u_getiterator); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2327, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_v_tags, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2327, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":2305
 *         return '/'.join(path)
 * 
 *     def getiterator(self, tag=None, *tags):             # <<<<<<<<<<<<<<
 *         """getiterator(self, *tags, tag=None)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ElementTree.getiterator", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tags);
  __Pyx_XDECREF(__pyx_v_root);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2329
 *         return root.getiterator(*tags)
 * 
 *     def iter(self, tag=None, *tags):             # <<<<<<<<<<<<<<
 *         """iter(self, tag=None, *tags)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_19iter(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_12_ElementTree_18iter, "iter(self, tag=None, *tags)\n\n        Creates an iterator for the root element.  The iterator loops over\n        all elements in this tree, in document order.  Note that siblings\n        of the root element (comments or processing instructions) are not\n        returned by the iterator.\n\n        Can be restricted to find only elements with specific tags,\n        see `_Element.iter`.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_12_ElementTree_19iter = {"iter", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_19iter, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_18iter};
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_19iter(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_v_tags = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iter (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  __pyx_v_tags = __Pyx_ArgsSlice_FASTCALL(__pyx_args, 1, __pyx_nargs);
  if (unlikely(!__pyx_v_tags)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_v_tags);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_tag,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 2329, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        default:
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2329, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      const Py_ssize_t used_pos_args = (kwd_pos_args < 1) ? kwd_pos_args : 1;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, used_pos_args, __pyx_kwds_len, "iter", 0) < (0)) __PYX_ERR(0, 2329, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
    } else {
      switch (__pyx_nargs) {
        default:
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2329, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_tag = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v_tags); __pyx_v_tags = 0;
  __Pyx_AddTraceback("lxml.etree._ElementTree.iter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_12_ElementTree_18iter(((struct LxmlElementTree *)__pyx_v_self), __pyx_v_tag, __pyx_v_tags);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v_tags);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_18iter(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_tags) {
  PyObject *__pyx_v_root = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("iter", 0);
  __Pyx_INCREF(__pyx_v_tags);

  /* "lxml/etree.pyx":2340
 *         see `_Element.iter`.
 *         """
 *         root = self.getroot()             # <<<<<<<<<<<<<<
 *         if root is None:
 *             return ITER_EMPTY
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_getroot, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2340, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v_root = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "lxml/etree.pyx":2341
 *         """
 *         root = self.getroot()
 *         if root is None:             # <<<<<<<<<<<<<<
 *             return ITER_EMPTY
 *         if tag is not None:
*/
  __pyx_t_4 = (__pyx_v_root == Py_None);
  if (__pyx_t_4) {

    /* "lxml/etree.pyx":2342
 *         root = self.getroot()
 *         if root is None:
 *             return ITER_EMPTY             # <<<<<<<<<<<<<<
 *         if tag is not None:
 *             tags += (tag,)
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_4lxml_5etree_ITER_EMPTY);
    __pyx_r = __pyx_v_4lxml_5etree_ITER_EMPTY;
    goto __pyx_L0;

    /* "lxml/etree.pyx":2341
 *         """
 *         root = self.getroot()
 *         if root is None:             # <<<<<<<<<<<<<<
 *             return ITER_EMPTY
 *         if tag is not None:
*/
  }

  /* "lxml/etree.pyx":2343
 *         if root is None:
 *             return ITER_EMPTY
 *         if tag is not None:             # <<<<<<<<<<<<<<
 *             tags += (tag,)
 *         return root.iter(*tags)
*/
  __pyx_t_4 = (__pyx_v_tag != Py_None);
  if (__pyx_t_4) {

    /* "lxml/etree.pyx":2344
 *             return ITER_EMPTY
 *         if tag is not None:
 *             tags += (tag,)             # <<<<<<<<<<<<<<
 *         return root.iter(*tags)
 * 
*/
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2344, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v_tag);
    __Pyx_GIVEREF(__pyx_v_tag);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_tag) != (0)) __PYX_ERR(0, 2344, __pyx_L1_error);
    __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_tags, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2344, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_tags, ((PyObject*)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "lxml/etree.pyx":2343
 *         if root is None:
 *             return ITER_EMPTY
 *         if tag is not None:             # <<<<<<<<<<<<<<
 *             tags += (tag,)
 *         return root.iter(*tags)
*/
  }

  /* "lxml/etree.pyx":2345
 *         if tag is not None:
 *             tags += (tag,)
 *         return root.iter(*tags)             # <<<<<<<<<<<<<<
 * 
 *     def find(self, path, namespaces=None):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_root, __pyx_mstate_global->__pyx_n_u_iter); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2345, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_v_tags, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2345, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":2329
 *         return root.getiterator(*tags)
 * 
 *     def iter(self, tag=None, *tags):             # <<<<<<<<<<<<<<
 *         """iter(self, tag=None, *tags)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ElementTree.iter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tags);
  __Pyx_XDECREF(__pyx_v_root);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2347
 *         return root.iter(*tags)
 * 
 *     def find(self, path, namespaces=None):             # <<<<<<<<<<<<<<
 *         """find(self, path, namespaces=None)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_21find(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_12_ElementTree_20find, "find(self, path, namespaces=None)\n\n        Finds the first toplevel element with given tag.  Same as\n        ``tree.getroot().find(path)``.\n\n        The optional ``namespaces`` argument accepts a\n        prefix-to-namespace mapping that allows the usage of XPath\n        prefixes in the path expression.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_12_ElementTree_21find = {"find", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_21find, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_20find};
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_21find(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_path = 0;
  PyObject *__pyx_v_namespaces = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("find (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_path,&__pyx_mstate_global->__pyx_n_u_namespaces,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 2347, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 2347, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2347, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "find", 0) < (0)) __PYX_ERR(0, 2347, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("find", 0, 1, 2, i); __PYX_ERR(0, 2347, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 2347, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2347, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_path = values[0];
    __pyx_v_namespaces = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("find", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 2347, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._ElementTree.find", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_12_ElementTree_20find(((struct LxmlElementTree *)__pyx_v_self), __pyx_v_path, __pyx_v_namespaces);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_20find(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_namespaces) {
  PyObject *__pyx_v_root = NULL;
  PyObject *__pyx_v_warn = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("find", 0);
  __Pyx_INCREF(__pyx_v_path);

  /* "lxml/etree.pyx":2357
 *         prefixes in the path expression.
 *         """
 *         self._assertHasRoot()             # <<<<<<<<<<<<<<
 *         root = self.getroot()
 *         if _isString(path):
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_12_ElementTree__assertHasRoot(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 2357, __pyx_L1_error)

  /* "lxml/etree.pyx":2358
 *         """
 *         self._assertHasRoot()
 *         root = self.getroot()             # <<<<<<<<<<<<<<
 *         if _isString(path):
 *             if path[:1] == "/":
*/
  __pyx_t_3 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
    __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_getroot, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2358, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_v_root = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "lxml/etree.pyx":2359
 *         self._assertHasRoot()
 *         root = self.getroot()
 *         if _isString(path):             # <<<<<<<<<<<<<<
 *             if path[:1] == "/":
 *                 path = "." + path
*/
  __pyx_t_5 = _isString(__pyx_v_path);
  if (__pyx_t_5) {

    /* "lxml/etree.pyx":2360
 *         root = self.getroot()
 *         if _isString(path):
 *             if path[:1] == "/":             # <<<<<<<<<<<<<<
 *                 path = "." + path
 *                 from warnings import warn
*/
    __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_path, 0, 1, NULL, NULL, &__pyx_mstate_global->__pyx_slice[5], 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2360, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_t_2, __pyx_mstate_global->__pyx_kp_u__23, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 2360, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_5) {

      /* "lxml/etree.pyx":2361
 *         if _isString(path):
 *             if path[:1] == "/":
 *                 path = "." + path             # <<<<<<<<<<<<<<
 *                 from warnings import warn
 *                 warn(
*/
      __pyx_t_2 = PyNumber_Add(__pyx_mstate_global->__pyx_kp_u__2, __pyx_v_path); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2361, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF_SET(__pyx_v_path, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "lxml/etree.pyx":2362
 *             if path[:1] == "/":
 *                 path = "." + path
 *                 from warnings import warn             # <<<<<<<<<<<<<<
 *                 warn(
 *                     "This search incorrectly ignores the root element, and will be "
*/
      {
        PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_warn};
        __pyx_t_6 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_warnings, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2362, __pyx_L1_error)
      }
      __pyx_t_2 = __pyx_t_6;
      __Pyx_GOTREF(__pyx_t_2);
      {
        PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_warn};
        __pyx_t_7 = 0; {
          __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_7]); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2362, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          switch (__pyx_t_7) {
            case 0:
            __Pyx_INCREF(__pyx_t_3);
            __pyx_v_warn = __pyx_t_3;
            break;
            default:;
          }
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "lxml/etree.pyx":2363
 *                 path = "." + path
 *                 from warnings import warn
 *                 warn(             # <<<<<<<<<<<<<<
 *                     "This search incorrectly ignores the root element, and will be "
 *                     "fixed in a future version.  If you rely on the current "
*/
      __pyx_t_3 = NULL;
      __Pyx_INCREF(__pyx_v_warn);
      __pyx_t_8 = __pyx_v_warn; 

      /* "lxml/etree.pyx":2366
 *                     "This search incorrectly ignores the root element, and will be "
 *                     "fixed in a future version.  If you rely on the current "
 *                     f"behaviour, change it to {path!r}",             # <<<<<<<<<<<<<<
 *                     FutureWarning, stacklevel=1
 *                 )
*/
      __pyx_t_9 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_path), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2366, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);

      /* "lxml/etree.pyx":2364
 *                 from warnings import warn
 *                 warn(
 *                     "This search incorrectly ignores the root element, and will be "             # <<<<<<<<<<<<<<
 *                     "fixed in a future version.  If you rely on the current "
 *                     f"behaviour, change it to {path!r}",
*/
      __pyx_t_10 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_This_search_incorrectly_ignores, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2364, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "lxml/etree.pyx":2367
 *                     "fixed in a future version.  If you rely on the current "
 *                     f"behaviour, change it to {path!r}",
 *                     FutureWarning, stacklevel=1             # <<<<<<<<<<<<<<
 *                 )
 *         return root.find(path, namespaces)
*/
      __pyx_t_4 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_8))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_8);
        assert(__pyx_t_3);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_8, __pyx__function);
        __pyx_t_4 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[3 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_3, __pyx_t_10, ((PyObject *)(((PyTypeObject*)PyExc_FutureWarning)))};
        __pyx_t_9 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2363, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_stacklevel, __pyx_mstate_global->__pyx_int_1, __pyx_t_9, __pyx_callargs+3, 0) < (0)) __PYX_ERR(0, 2363, __pyx_L1_error)
        __pyx_t_2 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_8, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_9);
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2363, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "lxml/etree.pyx":2360
 *         root = self.getroot()
 *         if _isString(path):
 *             if path[:1] == "/":             # <<<<<<<<<<<<<<
 *                 path = "." + path
 *                 from warnings import warn
*/
    }

    /* "lxml/etree.pyx":2359
 *         self._assertHasRoot()
 *         root = self.getroot()
 *         if _isString(path):             # <<<<<<<<<<<<<<
 *             if path[:1] == "/":
 *                 path = "." + path
*/
  }

  /* "lxml/etree.pyx":2369
 *                     FutureWarning, stacklevel=1
 *                 )
 *         return root.find(path, namespaces)             # <<<<<<<<<<<<<<
 * 
 *     def findtext(self, path, default=None, namespaces=None):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_8 = __pyx_v_root;
  __Pyx_INCREF(__pyx_t_8);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_8, __pyx_v_path, __pyx_v_namespaces};
    __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_find, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2369, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":2347
 *         return root.iter(*tags)
 * 
 *     def find(self, path, namespaces=None):             # <<<<<<<<<<<<<<
 *         """find(self, path, namespaces=None)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("lxml.etree._ElementTree.find", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_root);
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v_path);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2371
 *         return root.find(path, namespaces)
 * 
 *     def findtext(self, path, default=None, namespaces=None):             # <<<<<<<<<<<<<<
 *         """findtext(self, path, default=None, namespaces=None)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_23findtext(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_12_ElementTree_22findtext, "findtext(self, path, default=None, namespaces=None)\n\n        Finds the text for the first element matching the ElementPath\n        expression.  Same as getroot().findtext(path)\n\n        The optional ``namespaces`` argument accepts a\n        prefix-to-namespace mapping that allows the usage of XPath\n        prefixes in the path expression.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_12_ElementTree_23findtext = {"findtext", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_23findtext, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_22findtext};
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_23findtext(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_path = 0;
  PyObject *__pyx_v_default = 0;
  PyObject *__pyx_v_namespaces = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("findtext (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_path,&__pyx_mstate_global->__pyx_n_u_default,&__pyx_mstate_global->__pyx_n_u_namespaces,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 2371, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 2371, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 2371, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2371, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "findtext", 0) < (0)) __PYX_ERR(0, 2371, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("findtext", 0, 1, 3, i); __PYX_ERR(0, 2371, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 2371, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 2371, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2371, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_path = values[0];
    __pyx_v_default = values[1];
    __pyx_v_namespaces = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("findtext", 0, 1, 3, __pyx_nargs); __PYX_ERR(0, 2371, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._ElementTree.findtext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_12_ElementTree_22findtext(((struct LxmlElementTree *)__pyx_v_self), __pyx_v_path, __pyx_v_default, __pyx_v_namespaces);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_22findtext(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_default, PyObject *__pyx_v_namespaces) {
  PyObject *__pyx_v_root = NULL;
  PyObject *__pyx_v_warn = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("findtext", 0);
  __Pyx_INCREF(__pyx_v_path);

  /* "lxml/etree.pyx":2381
 *         prefixes in the path expression.
 *         """
 *         self._assertHasRoot()             # <<<<<<<<<<<<<<
 *         root = self.getroot()
 *         if _isString(path):
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_12_ElementTree__assertHasRoot(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 2381, __pyx_L1_error)

  /* "lxml/etree.pyx":2382
 *         """
 *         self._assertHasRoot()
 *         root = self.getroot()             # <<<<<<<<<<<<<<
 *         if _isString(path):
 *             if path[:1] == "/":
*/
  __pyx_t_3 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
    __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_getroot, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2382, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_v_root = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "lxml/etree.pyx":2383
 *         self._assertHasRoot()
 *         root = self.getroot()
 *         if _isString(path):             # <<<<<<<<<<<<<<
 *             if path[:1] == "/":
 *                 path = "." + path
*/
  __pyx_t_5 = _isString(__pyx_v_path);
  if (__pyx_t_5) {

    /* "lxml/etree.pyx":2384
 *         root = self.getroot()
 *         if _isString(path):
 *             if path[:1] == "/":             # <<<<<<<<<<<<<<
 *                 path = "." + path
 *                 from warnings import warn
*/
    __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_path, 0, 1, NULL, NULL, &__pyx_mstate_global->__pyx_slice[5], 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2384, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_t_2, __pyx_mstate_global->__pyx_kp_u__23, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 2384, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_5) {

      /* "lxml/etree.pyx":2385
 *         if _isString(path):
 *             if path[:1] == "/":
 *                 path = "." + path             # <<<<<<<<<<<<<<
 *                 from warnings import warn
 *                 warn(
*/
      __pyx_t_2 = PyNumber_Add(__pyx_mstate_global->__pyx_kp_u__2, __pyx_v_path); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2385, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF_SET(__pyx_v_path, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "lxml/etree.pyx":2386
 *             if path[:1] == "/":
 *                 path = "." + path
 *                 from warnings import warn             # <<<<<<<<<<<<<<
 *                 warn(
 *                     "This search incorrectly ignores the root element, and will be "
*/
      {
        PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_warn};
        __pyx_t_6 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_warnings, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2386, __pyx_L1_error)
      }
      __pyx_t_2 = __pyx_t_6;
      __Pyx_GOTREF(__pyx_t_2);
      {
        PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_warn};
        __pyx_t_7 = 0; {
          __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_7]); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2386, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          switch (__pyx_t_7) {
            case 0:
            __Pyx_INCREF(__pyx_t_3);
            __pyx_v_warn = __pyx_t_3;
            break;
            default:;
          }
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "lxml/etree.pyx":2387
 *                 path = "." + path
 *                 from warnings import warn
 *                 warn(             # <<<<<<<<<<<<<<
 *                     "This search incorrectly ignores the root element, and will be "
 *                     "fixed in a future version.  If you rely on the current "
*/
      __pyx_t_3 = NULL;
      __Pyx_INCREF(__pyx_v_warn);
      __pyx_t_8 = __pyx_v_warn; 

      /* "lxml/etree.pyx":2390
 *                     "This search incorrectly ignores the root element, and will be "
 *                     "fixed in a future version.  If you rely on the current "
 *                     f"behaviour, change it to {path!r}",             # <<<<<<<<<<<<<<
 *                     FutureWarning, stacklevel=1
 *                 )
*/
      __pyx_t_9 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_path), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2390, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);

      /* "lxml/etree.pyx":2388
 *                 from warnings import warn
 *                 warn(
 *                     "This search incorrectly ignores the root element, and will be "             # <<<<<<<<<<<<<<
 *                     "fixed in a future version.  If you rely on the current "
 *                     f"behaviour, change it to {path!r}",
*/
      __pyx_t_10 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_This_search_incorrectly_ignores, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2388, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "lxml/etree.pyx":2391
 *                     "fixed in a future version.  If you rely on the current "
 *                     f"behaviour, change it to {path!r}",
 *                     FutureWarning, stacklevel=1             # <<<<<<<<<<<<<<
 *                 )
 *         return root.findtext(path, default, namespaces)
*/
      __pyx_t_4 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_8))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_8);
        assert(__pyx_t_3);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_8, __pyx__function);
        __pyx_t_4 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[3 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_3, __pyx_t_10, ((PyObject *)(((PyTypeObject*)PyExc_FutureWarning)))};
        __pyx_t_9 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2387, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_stacklevel, __pyx_mstate_global->__pyx_int_1, __pyx_t_9, __pyx_callargs+3, 0) < (0)) __PYX_ERR(0, 2387, __pyx_L1_error)
        __pyx_t_2 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_8, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_9);
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2387, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "lxml/etree.pyx":2384
 *         root = self.getroot()
 *         if _isString(path):
 *             if path[:1] == "/":             # <<<<<<<<<<<<<<
 *                 path = "." + path
 *                 from warnings import warn
*/
    }

    /* "lxml/etree.pyx":2383
 *         self._assertHasRoot()
 *         root = self.getroot()
 *         if _isString(path):             # <<<<<<<<<<<<<<
 *             if path[:1] == "/":
 *                 path = "." + path
*/
  }

  /* "lxml/etree.pyx":2393
 *                     FutureWarning, stacklevel=1
 *                 )
 *         return root.findtext(path, default, namespaces)             # <<<<<<<<<<<<<<
 * 
 *     def findall(self, path, namespaces=None):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_8 = __pyx_v_root;
  __Pyx_INCREF(__pyx_t_8);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[4] = {__pyx_t_8, __pyx_v_path, __pyx_v_default, __pyx_v_namespaces};
    __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_findtext, __pyx_callargs+__pyx_t_4, (4-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2393, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":2371
 *         return root.find(path, namespaces)
 * 
 *     def findtext(self, path, default=None, namespaces=None):             # <<<<<<<<<<<<<<
 *         """findtext(self, path, default=None, namespaces=None)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("lxml.etree._ElementTree.findtext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_root);
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v_path);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2395
 *         return root.findtext(path, default, namespaces)
 * 
 *     def findall(self, path, namespaces=None):             # <<<<<<<<<<<<<<
 *         """findall(self, path, namespaces=None)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_25findall(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_12_ElementTree_24findall, "findall(self, path, namespaces=None)\n\n        Finds all elements matching the ElementPath expression.  Same as\n        getroot().findall(path).\n\n        The optional ``namespaces`` argument accepts a\n        prefix-to-namespace mapping that allows the usage of XPath\n        prefixes in the path expression.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_12_ElementTree_25findall = {"findall", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_25findall, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_24findall};
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_25findall(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_path = 0;
  PyObject *__pyx_v_namespaces = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("findall (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_path,&__pyx_mstate_global->__pyx_n_u_namespaces,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 2395, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 2395, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2395, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "findall", 0) < (0)) __PYX_ERR(0, 2395, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("findall", 0, 1, 2, i); __PYX_ERR(0, 2395, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 2395, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2395, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_path = values[0];
    __pyx_v_namespaces = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("findall", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 2395, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._ElementTree.findall", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_12_ElementTree_24findall(((struct LxmlElementTree *)__pyx_v_self), __pyx_v_path, __pyx_v_namespaces);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_24findall(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_namespaces) {
  PyObject *__pyx_v_root = NULL;
  PyObject *__pyx_v_warn = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("findall", 0);
  __Pyx_INCREF(__pyx_v_path);

  /* "lxml/etree.pyx":2405
 *         prefixes in the path expression.
 *         """
 *         self._assertHasRoot()             # <<<<<<<<<<<<<<
 *         root = self.getroot()
 *         if _isString(path):
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_12_ElementTree__assertHasRoot(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 2405, __pyx_L1_error)

  /* "lxml/etree.pyx":2406
 *         """
 *         self._assertHasRoot()
 *         root = self.getroot()             # <<<<<<<<<<<<<<
 *         if _isString(path):
 *             if path[:1] == "/":
*/
  __pyx_t_3 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
    __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_getroot, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2406, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_v_root = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "lxml/etree.pyx":2407
 *         self._assertHasRoot()
 *         root = self.getroot()
 *         if _isString(path):             # <<<<<<<<<<<<<<
 *             if path[:1] == "/":
 *                 path = "." + path
*/
  __pyx_t_5 = _isString(__pyx_v_path);
  if (__pyx_t_5) {

    /* "lxml/etree.pyx":2408
 *         root = self.getroot()
 *         if _isString(path):
 *             if path[:1] == "/":             # <<<<<<<<<<<<<<
 *                 path = "." + path
 *                 from warnings import warn
*/
    __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_path, 0, 1, NULL, NULL, &__pyx_mstate_global->__pyx_slice[5], 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2408, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_t_2, __pyx_mstate_global->__pyx_kp_u__23, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 2408, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_5) {

      /* "lxml/etree.pyx":2409
 *         if _isString(path):
 *             if path[:1] == "/":
 *                 path = "." + path             # <<<<<<<<<<<<<<
 *                 from warnings import warn
 *                 warn(
*/
      __pyx_t_2 = PyNumber_Add(__pyx_mstate_global->__pyx_kp_u__2, __pyx_v_path); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2409, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF_SET(__pyx_v_path, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "lxml/etree.pyx":2410
 *             if path[:1] == "/":
 *                 path = "." + path
 *                 from warnings import warn             # <<<<<<<<<<<<<<
 *                 warn(
 *                     "This search incorrectly ignores the root element, and will be "
*/
      {
        PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_warn};
        __pyx_t_6 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_warnings, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2410, __pyx_L1_error)
      }
      __pyx_t_2 = __pyx_t_6;
      __Pyx_GOTREF(__pyx_t_2);
      {
        PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_warn};
        __pyx_t_7 = 0; {
          __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_7]); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2410, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          switch (__pyx_t_7) {
            case 0:
            __Pyx_INCREF(__pyx_t_3);
            __pyx_v_warn = __pyx_t_3;
            break;
            default:;
          }
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "lxml/etree.pyx":2411
 *                 path = "." + path
 *                 from warnings import warn
 *                 warn(             # <<<<<<<<<<<<<<
 *                     "This search incorrectly ignores the root element, and will be "
 *                     "fixed in a future version.  If you rely on the current "
*/
      __pyx_t_3 = NULL;
      __Pyx_INCREF(__pyx_v_warn);
      __pyx_t_8 = __pyx_v_warn; 

      /* "lxml/etree.pyx":2414
 *                     "This search incorrectly ignores the root element, and will be "
 *                     "fixed in a future version.  If you rely on the current "
 *                     f"behaviour, change it to {path!r}",             # <<<<<<<<<<<<<<
 *                     FutureWarning, stacklevel=1
 *                 )
*/
      __pyx_t_9 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_path), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2414, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);

      /* "lxml/etree.pyx":2412
 *                 from warnings import warn
 *                 warn(
 *                     "This search incorrectly ignores the root element, and will be "             # <<<<<<<<<<<<<<
 *                     "fixed in a future version.  If you rely on the current "
 *                     f"behaviour, change it to {path!r}",
*/
      __pyx_t_10 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_This_search_incorrectly_ignores, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2412, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "lxml/etree.pyx":2415
 *                     "fixed in a future version.  If you rely on the current "
 *                     f"behaviour, change it to {path!r}",
 *                     FutureWarning, stacklevel=1             # <<<<<<<<<<<<<<
 *                 )
 *         return root.findall(path, namespaces)
*/
      __pyx_t_4 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_8))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_8);
        assert(__pyx_t_3);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_8, __pyx__function);
        __pyx_t_4 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[3 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_3, __pyx_t_10, ((PyObject *)(((PyTypeObject*)PyExc_FutureWarning)))};
        __pyx_t_9 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2411, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_stacklevel, __pyx_mstate_global->__pyx_int_1, __pyx_t_9, __pyx_callargs+3, 0) < (0)) __PYX_ERR(0, 2411, __pyx_L1_error)
        __pyx_t_2 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_8, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_9);
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2411, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "lxml/etree.pyx":2408
 *         root = self.getroot()
 *         if _isString(path):
 *             if path[:1] == "/":             # <<<<<<<<<<<<<<
 *                 path = "." + path
 *                 from warnings import warn
*/
    }

    /* "lxml/etree.pyx":2407
 *         self._assertHasRoot()
 *         root = self.getroot()
 *         if _isString(path):             # <<<<<<<<<<<<<<
 *             if path[:1] == "/":
 *                 path = "." + path
*/
  }

  /* "lxml/etree.pyx":2417
 *                     FutureWarning, stacklevel=1
 *                 )
 *         return root.findall(path, namespaces)             # <<<<<<<<<<<<<<
 * 
 *     def iterfind(self, path, namespaces=None):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_8 = __pyx_v_root;
  __Pyx_INCREF(__pyx_t_8);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_8, __pyx_v_path, __pyx_v_namespaces};
    __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_findall, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2417, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":2395
 *         return root.findtext(path, default, namespaces)
 * 
 *     def findall(self, path, namespaces=None):             # <<<<<<<<<<<<<<
 *         """findall(self, path, namespaces=None)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("lxml.etree._ElementTree.findall", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_root);
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v_path);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2419
 *         return root.findall(path, namespaces)
 * 
 *     def iterfind(self, path, namespaces=None):             # <<<<<<<<<<<<<<
 *         """iterfind(self, path, namespaces=None)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_27iterfind(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_12_ElementTree_26iterfind, "iterfind(self, path, namespaces=None)\n\n        Iterates over all elements matching the ElementPath expression.\n        Same as getroot().iterfind(path).\n\n        The optional ``namespaces`` argument accepts a\n        prefix-to-namespace mapping that allows the usage of XPath\n        prefixes in the path expression.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_12_ElementTree_27iterfind = {"iterfind", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_27iterfind, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_26iterfind};
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_27iterfind(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_path = 0;
  PyObject *__pyx_v_namespaces = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iterfind (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_path,&__pyx_mstate_global->__pyx_n_u_namespaces,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 2419, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 2419, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2419, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "iterfind", 0) < (0)) __PYX_ERR(0, 2419, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("iterfind", 0, 1, 2, i); __PYX_ERR(0, 2419, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 2419, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2419, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_path = values[0];
    __pyx_v_namespaces = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("iterfind", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 2419, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._ElementTree.iterfind", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_12_ElementTree_26iterfind(((struct LxmlElementTree *)__pyx_v_self), __pyx_v_path, __pyx_v_namespaces);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_26iterfind(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_namespaces) {
  PyObject *__pyx_v_root = NULL;
  PyObject *__pyx_v_warn = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("iterfind", 0);
  __Pyx_INCREF(__pyx_v_path);

  /* "lxml/etree.pyx":2429
 *         prefixes in the path expression.
 *         """
 *         self._assertHasRoot()             # <<<<<<<<<<<<<<
 *         root = self.getroot()
 *         if _isString(path):
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_12_ElementTree__assertHasRoot(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 2429, __pyx_L1_error)

  /* "lxml/etree.pyx":2430
 *         """
 *         self._assertHasRoot()
 *         root = self.getroot()             # <<<<<<<<<<<<<<
 *         if _isString(path):
 *             if path[:1] == "/":
*/
  __pyx_t_3 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
    __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_getroot, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2430, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_v_root = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "lxml/etree.pyx":2431
 *         self._assertHasRoot()
 *         root = self.getroot()
 *         if _isString(path):             # <<<<<<<<<<<<<<
 *             if path[:1] == "/":
 *                 path = "." + path
*/
  __pyx_t_5 = _isString(__pyx_v_path);
  if (__pyx_t_5) {

    /* "lxml/etree.pyx":2432
 *         root = self.getroot()
 *         if _isString(path):
 *             if path[:1] == "/":             # <<<<<<<<<<<<<<
 *                 path = "." + path
 *                 from warnings import warn
*/
    __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_path, 0, 1, NULL, NULL, &__pyx_mstate_global->__pyx_slice[5], 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2432, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_t_2, __pyx_mstate_global->__pyx_kp_u__23, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 2432, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_5) {

      /* "lxml/etree.pyx":2433
 *         if _isString(path):
 *             if path[:1] == "/":
 *                 path = "." + path             # <<<<<<<<<<<<<<
 *                 from warnings import warn
 *                 warn(
*/
      __pyx_t_2 = PyNumber_Add(__pyx_mstate_global->__pyx_kp_u__2, __pyx_v_path); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2433, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF_SET(__pyx_v_path, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "lxml/etree.pyx":2434
 *             if path[:1] == "/":
 *                 path = "." + path
 *                 from warnings import warn             # <<<<<<<<<<<<<<
 *                 warn(
 *                     "This search incorrectly ignores the root element, and will be "
*/
      {
        PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_warn};
        __pyx_t_6 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_warnings, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2434, __pyx_L1_error)
      }
      __pyx_t_2 = __pyx_t_6;
      __Pyx_GOTREF(__pyx_t_2);
      {
        PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_warn};
        __pyx_t_7 = 0; {
          __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_7]); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2434, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          switch (__pyx_t_7) {
            case 0:
            __Pyx_INCREF(__pyx_t_3);
            __pyx_v_warn = __pyx_t_3;
            break;
            default:;
          }
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "lxml/etree.pyx":2435
 *                 path = "." + path
 *                 from warnings import warn
 *                 warn(             # <<<<<<<<<<<<<<
 *                     "This search incorrectly ignores the root element, and will be "
 *                     "fixed in a future version.  If you rely on the current "
*/
      __pyx_t_3 = NULL;
      __Pyx_INCREF(__pyx_v_warn);
      __pyx_t_8 = __pyx_v_warn; 

      /* "lxml/etree.pyx":2438
 *                     "This search incorrectly ignores the root element, and will be "
 *                     "fixed in a future version.  If you rely on the current "
 *                     f"behaviour, change it to {path!r}",             # <<<<<<<<<<<<<<
 *                     FutureWarning, stacklevel=1
 *                 )
*/
      __pyx_t_9 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_path), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2438, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);

      /* "lxml/etree.pyx":2436
 *                 from warnings import warn
 *                 warn(
 *                     "This search incorrectly ignores the root element, and will be "             # <<<<<<<<<<<<<<
 *                     "fixed in a future version.  If you rely on the current "
 *                     f"behaviour, change it to {path!r}",
*/
      __pyx_t_10 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_This_search_incorrectly_ignores, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2436, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "lxml/etree.pyx":2439
 *                     "fixed in a future version.  If you rely on the current "
 *                     f"behaviour, change it to {path!r}",
 *                     FutureWarning, stacklevel=1             # <<<<<<<<<<<<<<
 *                 )
 *         return root.iterfind(path, namespaces)
*/
      __pyx_t_4 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_8))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_8);
        assert(__pyx_t_3);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_8, __pyx__function);
        __pyx_t_4 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[3 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_3, __pyx_t_10, ((PyObject *)(((PyTypeObject*)PyExc_FutureWarning)))};
        __pyx_t_9 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2435, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_stacklevel, __pyx_mstate_global->__pyx_int_1, __pyx_t_9, __pyx_callargs+3, 0) < (0)) __PYX_ERR(0, 2435, __pyx_L1_error)
        __pyx_t_2 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_8, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_9);
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2435, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "lxml/etree.pyx":2432
 *         root = self.getroot()
 *         if _isString(path):
 *             if path[:1] == "/":             # <<<<<<<<<<<<<<
 *                 path = "." + path
 *                 from warnings import warn
*/
    }

    /* "lxml/etree.pyx":2431
 *         self._assertHasRoot()
 *         root = self.getroot()
 *         if _isString(path):             # <<<<<<<<<<<<<<
 *             if path[:1] == "/":
 *                 path = "." + path
*/
  }

  /* "lxml/etree.pyx":2441
 *                     FutureWarning, stacklevel=1
 *                 )
 *         return root.iterfind(path, namespaces)             # <<<<<<<<<<<<<<
 * 
 *     def xpath(self, _path, *, namespaces=None, extensions=None,
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_8 = __pyx_v_root;
  __Pyx_INCREF(__pyx_t_8);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_8, __pyx_v_path, __pyx_v_namespaces};
    __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_iterfind, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2441, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":2419
 *         return root.findall(path, namespaces)
 * 
 *     def iterfind(self, path, namespaces=None):             # <<<<<<<<<<<<<<
 *         """iterfind(self, path, namespaces=None)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("lxml.etree._ElementTree.iterfind", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_root);
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v_path);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2443
 *         return root.iterfind(path, namespaces)
 * 
 *     def xpath(self, _path, *, namespaces=None, extensions=None,             # <<<<<<<<<<<<<<
 *               smart_strings=True, **_variables):
 *         """xpath(self, _path, namespaces=None, extensions=None, smart_strings=True, **_variables)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_29xpath(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_12_ElementTree_28xpath, "xpath(self, _path, namespaces=None, extensions=None, smart_strings=True, **_variables)\n\n        XPath evaluate in context of document.\n\n        ``namespaces`` is an optional dictionary with prefix to namespace URI\n        mappings, used by XPath.  ``extensions`` defines additional extension\n        functions.\n\n        Returns a list (nodeset), or bool, float or string.\n\n        In case of a list result, return Element for element nodes,\n        string for text and attribute values.\n\n        Note: if you are going to apply multiple XPath expressions\n        against the same document, it is more efficient to use\n        XPathEvaluator directly.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_12_ElementTree_29xpath = {"xpath", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_29xpath, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_28xpath};
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_29xpath(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v__path = 0;
  PyObject *__pyx_v_namespaces = 0;
  PyObject *__pyx_v_extensions = 0;
  PyObject *__pyx_v_smart_strings = 0;
  PyObject *__pyx_v__variables = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[4] = {0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("xpath (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  __pyx_v__variables = PyDict_New(); if (unlikely(!__pyx_v__variables)) return NULL;
  __Pyx_GOTREF(__pyx_v__variables);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_path_2,&__pyx_mstate_global->__pyx_n_u_namespaces,&__pyx_mstate_global->__pyx_n_u_extensions,&__pyx_mstate_global->__pyx_n_u_smart_strings,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 2443, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2443, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v__variables, values, kwd_pos_args, __pyx_kwds_len, "xpath", 1) < (0)) __PYX_ERR(0, 2443, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "lxml/etree.pyx":2444
 * 
 *     def xpath(self, _path, *, namespaces=None, extensions=None,
 *               smart_strings=True, **_variables):             # <<<<<<<<<<<<<<
 *         """xpath(self, _path, namespaces=None, extensions=None, smart_strings=True, **_variables)
 * 
*/
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_True));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("xpath", 1, 1, 1, i); __PYX_ERR(0, 2443, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2443, __pyx_L3_error)

      /* "lxml/etree.pyx":2443
 *         return root.iterfind(path, namespaces)
 * 
 *     def xpath(self, _path, *, namespaces=None, extensions=None,             # <<<<<<<<<<<<<<
 *               smart_strings=True, **_variables):
 *         """xpath(self, _path, namespaces=None, extensions=None, smart_strings=True, **_variables)
*/
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "lxml/etree.pyx":2444
 * 
 *     def xpath(self, _path, *, namespaces=None, extensions=None,
 *               smart_strings=True, **_variables):             # <<<<<<<<<<<<<<
 *         """xpath(self, _path, namespaces=None, extensions=None, smart_strings=True, **_variables)
 * 
*/
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_True));
    }
    __pyx_v__path = values[0];
    __pyx_v_namespaces = values[1];
    __pyx_v_extensions = values[2];
    __pyx_v_smart_strings = values[3];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("xpath", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2443, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v__variables); __pyx_v__variables = 0;
  __Pyx_AddTraceback("lxml.etree._ElementTree.xpath", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_12_ElementTree_28xpath(((struct LxmlElementTree *)__pyx_v_self), __pyx_v__path, __pyx_v_namespaces, __pyx_v_extensions, __pyx_v_smart_strings, __pyx_v__variables);

  /* "lxml/etree.pyx":2443
 *         return root.iterfind(path, namespaces)
 * 
 *     def xpath(self, _path, *, namespaces=None, extensions=None,             # <<<<<<<<<<<<<<
 *               smart_strings=True, **_variables):
 *         """xpath(self, _path, namespaces=None, extensions=None, smart_strings=True, **_variables)
*/

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v__variables);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_28xpath(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v__path, PyObject *__pyx_v_namespaces, PyObject *__pyx_v_extensions, PyObject *__pyx_v_smart_strings, PyObject *__pyx_v__variables) {
  struct __pyx_obj_4lxml_5etree_XPathDocumentEvaluator *__pyx_v_evaluator = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("xpath", 0);

  /* "lxml/etree.pyx":2462
 *         XPathEvaluator directly.
 *         """
 *         self._assertHasRoot()             # <<<<<<<<<<<<<<
 *         evaluator = XPathDocumentEvaluator(self, namespaces=namespaces,
 *                                            extensions=extensions,
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_12_ElementTree__assertHasRoot(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 2462, __pyx_L1_error)

  /* "lxml/etree.pyx":2463
 *         """
 *         self._assertHasRoot()
 *         evaluator = XPathDocumentEvaluator(self, namespaces=namespaces,             # <<<<<<<<<<<<<<
 *                                            extensions=extensions,
 *                                            smart_strings=smart_strings)
*/
  __pyx_t_3 = NULL;

  /* "lxml/etree.pyx":2465
 *         evaluator = XPathDocumentEvaluator(self, namespaces=namespaces,
 *                                            extensions=extensions,
 *                                            smart_strings=smart_strings)             # <<<<<<<<<<<<<<
 *         return evaluator(_path, **_variables)
 * 
*/
  __pyx_t_4 = 1;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 3 : 0)] = {__pyx_t_3, ((PyObject *)__pyx_v_self)};
    __pyx_t_5 = __Pyx_MakeVectorcallBuilderKwds(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2463, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_namespaces, __pyx_v_namespaces, __pyx_t_5, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 2463, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_extensions, __pyx_v_extensions, __pyx_t_5, __pyx_callargs+2, 1) < (0)) __PYX_ERR(0, 2463, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_smart_strings, __pyx_v_smart_strings, __pyx_t_5, __pyx_callargs+2, 2) < (0)) __PYX_ERR(0, 2463, __pyx_L1_error)
    __pyx_t_2 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XPathDocumentEvaluator, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_5);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2463, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_2);
  }
  __pyx_v_evaluator = ((struct __pyx_obj_4lxml_5etree_XPathDocumentEvaluator *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "lxml/etree.pyx":2466
 *                                            extensions=extensions,
 *                                            smart_strings=smart_strings)
 *         return evaluator(_path, **_variables)             # <<<<<<<<<<<<<<
 * 
 *     def xslt(self, _xslt, extensions=None, access_control=None, **_kw):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = NULL;
  __Pyx_INCREF((PyObject *)__pyx_v_evaluator);
  __pyx_t_3 = ((PyObject *)__pyx_v_evaluator); 
  __pyx_t_6 = PyDict_Copy(__pyx_v__variables); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2466, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_5);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_4 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v__path};
    __pyx_t_2 = __Pyx_PyObject_FastCallDict((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2466, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":2443
 *         return root.iterfind(path, namespaces)
 * 
 *     def xpath(self, _path, *, namespaces=None, extensions=None,             # <<<<<<<<<<<<<<
 *               smart_strings=True, **_variables):
 *         """xpath(self, _path, namespaces=None, extensions=None, smart_strings=True, **_variables)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._ElementTree.xpath", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_evaluator);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2468
 *         return evaluator(_path, **_variables)
 * 
 *     def xslt(self, _xslt, extensions=None, access_control=None, **_kw):             # <<<<<<<<<<<<<<
 *         """xslt(self, _xslt, extensions=None, access_control=None, **_kw)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_31xslt(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_12_ElementTree_30xslt, "xslt(self, _xslt, extensions=None, access_control=None, **_kw)\n\n        Transform this document using other document.\n\n        xslt is a tree that should be XSLT\n        keyword parameters are XSLT transformation parameters.\n\n        Returns the transformed tree.\n\n        Note: if you are going to apply the same XSLT stylesheet against\n        multiple documents, it is more efficient to use the XSLT\n        class directly.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_12_ElementTree_31xslt = {"xslt", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_31xslt, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_30xslt};
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_31xslt(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v__xslt = 0;
  PyObject *__pyx_v_extensions = 0;
  PyObject *__pyx_v_access_control = 0;
  PyObject *__pyx_v__kw = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("xslt (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  __pyx_v__kw = PyDict_New(); if (unlikely(!__pyx_v__kw)) return NULL;
  __Pyx_GOTREF(__pyx_v__kw);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_xslt,&__pyx_mstate_global->__pyx_n_u_extensions,&__pyx_mstate_global->__pyx_n_u_access_control,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 2468, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 2468, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 2468, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2468, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v__kw, values, kwd_pos_args, __pyx_kwds_len, "xslt", 1) < (0)) __PYX_ERR(0, 2468, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("xslt", 0, 1, 3, i); __PYX_ERR(0, 2468, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 2468, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 2468, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2468, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v__xslt = values[0];
    __pyx_v_extensions = values[1];
    __pyx_v_access_control = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("xslt", 0, 1, 3, __pyx_nargs); __PYX_ERR(0, 2468, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v__kw); __pyx_v__kw = 0;
  __Pyx_AddTraceback("lxml.etree._ElementTree.xslt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_12_ElementTree_30xslt(((struct LxmlElementTree *)__pyx_v_self), __pyx_v__xslt, __pyx_v_extensions, __pyx_v_access_control, __pyx_v__kw);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v__kw);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_30xslt(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v__xslt, PyObject *__pyx_v_extensions, PyObject *__pyx_v_access_control, PyObject *__pyx_v__kw) {
  struct __pyx_obj_4lxml_5etree_XSLT *__pyx_v_style = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("xslt", 0);

  /* "lxml/etree.pyx":2482
 *         class directly.
 *         """
 *         self._assertHasRoot()             # <<<<<<<<<<<<<<
 *         style = XSLT(_xslt, extensions=extensions,
 *                      access_control=access_control)
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_12_ElementTree__assertHasRoot(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 2482, __pyx_L1_error)

  /* "lxml/etree.pyx":2483
 *         """
 *         self._assertHasRoot()
 *         style = XSLT(_xslt, extensions=extensions,             # <<<<<<<<<<<<<<
 *                      access_control=access_control)
 *         return style(self, **_kw)
*/
  __pyx_t_3 = NULL;

  /* "lxml/etree.pyx":2484
 *         self._assertHasRoot()
 *         style = XSLT(_xslt, extensions=extensions,
 *                      access_control=access_control)             # <<<<<<<<<<<<<<
 *         return style(self, **_kw)
 * 
*/
  __pyx_t_4 = 1;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_3, __pyx_v__xslt};
    __pyx_t_5 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2483, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_extensions, __pyx_v_extensions, __pyx_t_5, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 2483, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_access_control, __pyx_v_access_control, __pyx_t_5, __pyx_callargs+2, 1) < (0)) __PYX_ERR(0, 2483, __pyx_L1_error)
    __pyx_t_2 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XSLT, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_5);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2483, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_2);
  }
  __pyx_v_style = ((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "lxml/etree.pyx":2485
 *         style = XSLT(_xslt, extensions=extensions,
 *                      access_control=access_control)
 *         return style(self, **_kw)             # <<<<<<<<<<<<<<
 * 
 *     def relaxng(self, relaxng):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = NULL;
  __Pyx_INCREF((PyObject *)__pyx_v_style);
  __pyx_t_3 = ((PyObject *)__pyx_v_style); 
  __pyx_t_6 = PyDict_Copy(__pyx_v__kw); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2485, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_5);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_4 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, ((PyObject *)__pyx_v_self)};
    __pyx_t_2 = __Pyx_PyObject_FastCallDict((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2485, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":2468
 *         return evaluator(_path, **_variables)
 * 
 *     def xslt(self, _xslt, extensions=None, access_control=None, **_kw):             # <<<<<<<<<<<<<<
 *         """xslt(self, _xslt, extensions=None, access_control=None, **_kw)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._ElementTree.xslt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_style);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2487
 *         return style(self, **_kw)
 * 
 *     def relaxng(self, relaxng):             # <<<<<<<<<<<<<<
 *         """relaxng(self, relaxng)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_33relaxng(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_12_ElementTree_32relaxng, "relaxng(self, relaxng)\n\n        Validate this document using other document.\n\n        The relaxng argument is a tree that should contain a Relax NG schema.\n\n        Returns True or False, depending on whether validation\n        succeeded.\n\n        Note: if you are going to apply the same Relax NG schema against\n        multiple documents, it is more efficient to use the RelaxNG\n        class directly.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_12_ElementTree_33relaxng = {"relaxng", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_33relaxng, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_32relaxng};
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_33relaxng(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_relaxng = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("relaxng (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_relaxng,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 2487, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2487, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "relaxng", 0) < (0)) __PYX_ERR(0, 2487, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("relaxng", 1, 1, 1, i); __PYX_ERR(0, 2487, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2487, __pyx_L3_error)
    }
    __pyx_v_relaxng = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("relaxng", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2487, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._ElementTree.relaxng", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_12_ElementTree_32relaxng(((struct LxmlElementTree *)__pyx_v_self), __pyx_v_relaxng);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_32relaxng(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v_relaxng) {
  struct __pyx_obj_4lxml_5etree_RelaxNG *__pyx_v_schema = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("relaxng", 0);

  /* "lxml/etree.pyx":2501
 *         class directly.
 *         """
 *         self._assertHasRoot()             # <<<<<<<<<<<<<<
 *         schema = RelaxNG(relaxng)
 *         return schema.validate(self)
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_12_ElementTree__assertHasRoot(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 2501, __pyx_L1_error)

  /* "lxml/etree.pyx":2502
 *         """
 *         self._assertHasRoot()
 *         schema = RelaxNG(relaxng)             # <<<<<<<<<<<<<<
 *         return schema.validate(self)
 * 
*/
  __pyx_t_3 = NULL;
  __pyx_t_4 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_relaxng};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_RelaxNG, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2502, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_2);
  }
  __pyx_v_schema = ((struct __pyx_obj_4lxml_5etree_RelaxNG *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "lxml/etree.pyx":2503
 *         self._assertHasRoot()
 *         schema = RelaxNG(relaxng)
 *         return schema.validate(self)             # <<<<<<<<<<<<<<
 * 
 *     def xmlschema(self, xmlschema):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_v_schema);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, ((PyObject *)__pyx_v_self)};
    __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_validate, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2503, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":2487
 *         return style(self, **_kw)
 * 
 *     def relaxng(self, relaxng):             # <<<<<<<<<<<<<<
 *         """relaxng(self, relaxng)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._ElementTree.relaxng", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_schema);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2505
 *         return schema.validate(self)
 * 
 *     def xmlschema(self, xmlschema):             # <<<<<<<<<<<<<<
 *         """xmlschema(self, xmlschema)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_35xmlschema(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_12_ElementTree_34xmlschema, "xmlschema(self, xmlschema)\n\n        Validate this document using other document.\n\n        The xmlschema argument is a tree that should contain an XML Schema.\n\n        Returns True or False, depending on whether validation\n        succeeded.\n\n        Note: If you are going to apply the same XML Schema against\n        multiple documents, it is more efficient to use the XMLSchema\n        class directly.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_12_ElementTree_35xmlschema = {"xmlschema", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_35xmlschema, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_34xmlschema};
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_35xmlschema(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_xmlschema = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("xmlschema (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_xmlschema,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 2505, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2505, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "xmlschema", 0) < (0)) __PYX_ERR(0, 2505, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("xmlschema", 1, 1, 1, i); __PYX_ERR(0, 2505, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2505, __pyx_L3_error)
    }
    __pyx_v_xmlschema = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("xmlschema", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2505, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._ElementTree.xmlschema", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_12_ElementTree_34xmlschema(((struct LxmlElementTree *)__pyx_v_self), __pyx_v_xmlschema);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_34xmlschema(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v_xmlschema) {
  struct __pyx_obj_4lxml_5etree_XMLSchema *__pyx_v_schema = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("xmlschema", 0);

  /* "lxml/etree.pyx":2519
 *         class directly.
 *         """
 *         self._assertHasRoot()             # <<<<<<<<<<<<<<
 *         schema = XMLSchema(xmlschema)
 *         return schema.validate(self)
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_12_ElementTree__assertHasRoot(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 2519, __pyx_L1_error)

  /* "lxml/etree.pyx":2520
 *         """
 *         self._assertHasRoot()
 *         schema = XMLSchema(xmlschema)             # <<<<<<<<<<<<<<
 *         return schema.validate(self)
 * 
*/
  __pyx_t_3 = NULL;
  __pyx_t_4 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_xmlschema};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XMLSchema, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2520, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_2);
  }
  __pyx_v_schema = ((struct __pyx_obj_4lxml_5etree_XMLSchema *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "lxml/etree.pyx":2521
 *         self._assertHasRoot()
 *         schema = XMLSchema(xmlschema)
 *         return schema.validate(self)             # <<<<<<<<<<<<<<
 * 
 *     def xinclude(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_v_schema);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, ((PyObject *)__pyx_v_self)};
    __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_validate, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2521, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":2505
 *         return schema.validate(self)
 * 
 *     def xmlschema(self, xmlschema):             # <<<<<<<<<<<<<<
 *         """xmlschema(self, xmlschema)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._ElementTree.xmlschema", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_schema);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2523
 *         return schema.validate(self)
 * 
 *     def xinclude(self):             # <<<<<<<<<<<<<<
 *         """xinclude(self)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_37xinclude(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_12_ElementTree_36xinclude, "xinclude(self)\n\n        Process the XInclude nodes in this document and include the\n        referenced XML fragments.\n\n        There is support for loading files through the file system, HTTP and\n        FTP.\n\n        Note that XInclude does not support custom resolvers in Python space\n        due to restrictions of libxml2 <= 2.6.29.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_12_ElementTree_37xinclude = {"xinclude", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_37xinclude, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_36xinclude};
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_37xinclude(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("xinclude (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("xinclude", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("xinclude", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_12_ElementTree_36xinclude(((struct LxmlElementTree *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_36xinclude(struct LxmlElementTree *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("xinclude", 0);

  /* "lxml/etree.pyx":2535
 *         due to restrictions of libxml2 <= 2.6.29.
 *         """
 *         self._assertHasRoot()             # <<<<<<<<<<<<<<
 *         XInclude()(self._context_node)
 * 
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_12_ElementTree__assertHasRoot(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 2535, __pyx_L1_error)

  /* "lxml/etree.pyx":2536
 *         """
 *         self._assertHasRoot()
 *         XInclude()(self._context_node)             # <<<<<<<<<<<<<<
 * 
 *     def write_c14n(self, file, *, bint exclusive=False, bint with_comments=True,
*/
  __pyx_t_3 = NULL;
  __pyx_t_5 = NULL;
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};
    __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XInclude, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2536, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_4);
  }
  __pyx_t_6 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    assert(__pyx_t_3);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
    __pyx_t_6 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, ((PyObject *)__pyx_v_self->_context_node)};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF((PyObject *)__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2536, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "lxml/etree.pyx":2523
 *         return schema.validate(self)
 * 
 *     def xinclude(self):             # <<<<<<<<<<<<<<
 *         """xinclude(self)
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._ElementTree.xinclude", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2538
 *         XInclude()(self._context_node)
 * 
 *     def write_c14n(self, file, *, bint exclusive=False, bint with_comments=True,             # <<<<<<<<<<<<<<
 *                    compression=0, inclusive_ns_prefixes=None):
 *         """write_c14n(self, file, exclusive=False, with_comments=True,
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_39write_c14n(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_12_ElementTree_38write_c14n, "write_c14n(self, file, exclusive=False, with_comments=True,\n                       compression=0, inclusive_ns_prefixes=None)\n\n        C14N write of document. Always writes UTF-8.\n\n        The ``compression`` option enables GZip compression level 1-9.\n\n        The ``inclusive_ns_prefixes`` should be a list of namespace strings\n        (i.e. ['xs', 'xsi']) that will be promoted to the top-level element\n        during exclusive C14N serialisation.  This parameter is ignored if\n        exclusive mode=False.\n\n        If exclusive=True and no list is provided, a namespace will only be\n        rendered if it is used by the immediate parent or one of its attributes\n        and its prefix and values have not already been rendered by an ancestor\n        of the namespace node's parent element.\n\n        NOTE: This method is deprecated as of lxml 4.4 and will be removed in a\n        future release.  Use ``.write(f, method=\"c14n\")`` instead.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_12_ElementTree_39write_c14n = {"write_c14n", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_39write_c14n, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_38write_c14n};
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_39write_c14n(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_file = 0;
  int __pyx_v_exclusive;
  int __pyx_v_with_comments;
  PyObject *__pyx_v_compression = 0;
  PyObject *__pyx_v_inclusive_ns_prefixes = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[5] = {0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write_c14n (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_file,&__pyx_mstate_global->__pyx_n_u_exclusive,&__pyx_mstate_global->__pyx_n_u_with_comments,&__pyx_mstate_global->__pyx_n_u_compression,&__pyx_mstate_global->__pyx_n_u_inclusive_ns_prefixes,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 2538, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2538, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "write_c14n", 0) < (0)) __PYX_ERR(0, 2538, __pyx_L3_error)
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_int_0));

      /* "lxml/etree.pyx":2539
 * 
 *     def write_c14n(self, file, *, bint exclusive=False, bint with_comments=True,
 *                    compression=0, inclusive_ns_prefixes=None):             # <<<<<<<<<<<<<<
 *         """write_c14n(self, file, exclusive=False, with_comments=True,
 *                        compression=0, inclusive_ns_prefixes=None)
*/
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("write_c14n", 1, 1, 1, i); __PYX_ERR(0, 2538, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2538, __pyx_L3_error)
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_int_0));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_file = values[0];
    if (values[1]) {
      __pyx_v_exclusive = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_exclusive == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2538, __pyx_L3_error)
    } else {

      /* "lxml/etree.pyx":2538
 *         XInclude()(self._context_node)
 * 
 *     def write_c14n(self, file, *, bint exclusive=False, bint with_comments=True,             # <<<<<<<<<<<<<<
 *                    compression=0, inclusive_ns_prefixes=None):
 *         """write_c14n(self, file, exclusive=False, with_comments=True,
*/
      __pyx_v_exclusive = ((int)0);
    }
    if (values[2]) {
      __pyx_v_with_comments = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_with_comments == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2538, __pyx_L3_error)
    } else {
      __pyx_v_with_comments = ((int)1);
    }
    __pyx_v_compression = values[3];
    __pyx_v_inclusive_ns_prefixes = values[4];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("write_c14n", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2538, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._ElementTree.write_c14n", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_12_ElementTree_38write_c14n(((struct LxmlElementTree *)__pyx_v_self), __pyx_v_file, __pyx_v_exclusive, __pyx_v_with_comments, __pyx_v_compression, __pyx_v_inclusive_ns_prefixes);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_38write_c14n(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v_file, int __pyx_v_exclusive, int __pyx_v_with_comments, PyObject *__pyx_v_compression, PyObject *__pyx_v_inclusive_ns_prefixes) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("write_c14n", 0);
  __Pyx_INCREF(__pyx_v_compression);

  /* "lxml/etree.pyx":2560
 *         future release.  Use ``.write(f, method="c14n")`` instead.
 *         """
 *         self._assertHasRoot()             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._context_node)
 *         if compression is None or compression < 0:
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_12_ElementTree__assertHasRoot(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 2560, __pyx_L1_error)

  /* "lxml/etree.pyx":2561
 *         """
 *         self._assertHasRoot()
 *         _assertValidNode(self._context_node)             # <<<<<<<<<<<<<<
 *         if compression is None or compression < 0:
 *             compression = 0
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self->_context_node);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_t_2)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 2561, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "lxml/etree.pyx":2562
 *         self._assertHasRoot()
 *         _assertValidNode(self._context_node)
 *         if compression is None or compression < 0:             # <<<<<<<<<<<<<<
 *             compression = 0
 * 
*/
  __pyx_t_4 = (__pyx_v_compression == Py_None);
  if (!__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(__pyx_v_compression, __pyx_mstate_global->__pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2562, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 2562, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":2563
 *         _assertValidNode(self._context_node)
 *         if compression is None or compression < 0:
 *             compression = 0             # <<<<<<<<<<<<<<
 * 
 *         _tofilelikeC14N(file, self._context_node, exclusive, with_comments,
*/
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0);
    __Pyx_DECREF_SET(__pyx_v_compression, __pyx_mstate_global->__pyx_int_0);

    /* "lxml/etree.pyx":2562
 *         self._assertHasRoot()
 *         _assertValidNode(self._context_node)
 *         if compression is None or compression < 0:             # <<<<<<<<<<<<<<
 *             compression = 0
 * 
*/
  }

  /* "lxml/etree.pyx":2565
 *             compression = 0
 * 
 *         _tofilelikeC14N(file, self._context_node, exclusive, with_comments,             # <<<<<<<<<<<<<<
 *                         compression, inclusive_ns_prefixes)
 * 
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self->_context_node);
  __Pyx_INCREF(__pyx_t_2);

  /* "lxml/etree.pyx":2566
 * 
 *         _tofilelikeC14N(file, self._context_node, exclusive, with_comments,
 *                         compression, inclusive_ns_prefixes)             # <<<<<<<<<<<<<<
 * 
 * cdef _ElementTree _elementTreeFactory(_Document doc, _Element context_node):
*/
  __pyx_t_1 = __Pyx_PyLong_As_int(__pyx_v_compression); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2566, __pyx_L1_error)

  /* "lxml/etree.pyx":2565
 *             compression = 0
 * 
 *         _tofilelikeC14N(file, self._context_node, exclusive, with_comments,             # <<<<<<<<<<<<<<
 *                         compression, inclusive_ns_prefixes)
 * 
*/
  __pyx_t_5 = __pyx_f_4lxml_5etree__tofilelikeC14N(__pyx_v_file, ((struct LxmlElement *)__pyx_t_2), __pyx_v_exclusive, __pyx_v_with_comments, __pyx_t_1, __pyx_v_inclusive_ns_prefixes); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2565, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "lxml/etree.pyx":2538
 *         XInclude()(self._context_node)
 * 
 *     def write_c14n(self, file, *, bint exclusive=False, bint with_comments=True,             # <<<<<<<<<<<<<<
 *                    compression=0, inclusive_ns_prefixes=None):
 *         """write_c14n(self, file, exclusive=False, with_comments=True,
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._ElementTree.write_c14n", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_compression);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2568
 *                         compression, inclusive_ns_prefixes)
 * 
 * cdef _ElementTree _elementTreeFactory(_Document doc, _Element context_node):             # <<<<<<<<<<<<<<
 *     return _newElementTree(doc, context_node, _ElementTree)
 * 
*/

static struct LxmlElementTree *__pyx_f_4lxml_5etree__elementTreeFactory(struct LxmlDocument *__pyx_v_doc, struct LxmlElement *__pyx_v_context_node) {
  struct LxmlElementTree *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_elementTreeFactory", 0);

  /* "lxml/etree.pyx":2569
 * 
 * cdef _ElementTree _elementTreeFactory(_Document doc, _Element context_node):
 *     return _newElementTree(doc, context_node, _ElementTree)             # <<<<<<<<<<<<<<
 * 
 * cdef _ElementTree _newElementTree(_Document doc, _Element context_node,
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__newElementTree(__pyx_v_doc, __pyx_v_context_node, ((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ElementTree))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2569, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((struct LxmlElementTree *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":2568
 *                         compression, inclusive_ns_prefixes)
 * 
 * cdef _ElementTree _elementTreeFactory(_Document doc, _Element context_node):             # <<<<<<<<<<<<<<
 *     return _newElementTree(doc, context_node, _ElementTree)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._elementTreeFactory", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2571
 *     return _newElementTree(doc, context_node, _ElementTree)
 * 
 * cdef _ElementTree _newElementTree(_Document doc, _Element context_node,             # <<<<<<<<<<<<<<
 *                                   object baseclass):
 *     cdef _ElementTree result
*/

static struct LxmlElementTree *__pyx_f_4lxml_5etree__newElementTree(struct LxmlDocument *__pyx_v_doc, struct LxmlElement *__pyx_v_context_node, PyObject *__pyx_v_baseclass) {
  struct LxmlElementTree *__pyx_v_result = 0;
  struct LxmlElementTree *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_newElementTree", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_context_node);

  /* "lxml/etree.pyx":2574
 *                                   object baseclass):
 *     cdef _ElementTree result
 *     result = baseclass()             # <<<<<<<<<<<<<<
 *     if context_node is None and doc is not None:
 *         context_node = doc.getroot()
*/
  __pyx_t_2 = NULL;
  __Pyx_INCREF(__pyx_v_baseclass);
  __pyx_t_3 = __pyx_v_baseclass; 
  __pyx_t_4 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_4 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2574, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ElementTree))))) __PYX_ERR(0, 2574, __pyx_L1_error)
  __pyx_v_result = ((struct LxmlElementTree *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "lxml/etree.pyx":2575
 *     cdef _ElementTree result
 *     result = baseclass()
 *     if context_node is None and doc is not None:             # <<<<<<<<<<<<<<
 *         context_node = doc.getroot()
 *     if context_node is None:
*/
  __pyx_t_6 = (((PyObject *)__pyx_v_context_node) == Py_None);
  if (__pyx_t_6) {
  } else {
    __pyx_t_5 = __pyx_t_6;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_6 = (((PyObject *)__pyx_v_doc) != Py_None);
  __pyx_t_5 = __pyx_t_6;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_5) {

    /* "lxml/etree.pyx":2576
 *     result = baseclass()
 *     if context_node is None and doc is not None:
 *         context_node = doc.getroot()             # <<<<<<<<<<<<<<
 *     if context_node is None:
 *         _assertValidDoc(doc)
*/
    __pyx_t_1 = __pyx_f_4lxml_5etree_9_Document_getroot(__pyx_v_doc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2576, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element))))) __PYX_ERR(0, 2576, __pyx_L1_error)
    __Pyx_DECREF_SET(__pyx_v_context_node, ((struct LxmlElement *)__pyx_t_1));
    __pyx_t_1 = 0;

    /* "lxml/etree.pyx":2575
 *     cdef _ElementTree result
 *     result = baseclass()
 *     if context_node is None and doc is not None:             # <<<<<<<<<<<<<<
 *         context_node = doc.getroot()
 *     if context_node is None:
*/
  }

  /* "lxml/etree.pyx":2577
 *     if context_node is None and doc is not None:
 *         context_node = doc.getroot()
 *     if context_node is None:             # <<<<<<<<<<<<<<
 *         _assertValidDoc(doc)
 *         result._doc = doc
*/
  __pyx_t_5 = (((PyObject *)__pyx_v_context_node) == Py_None);
  if (__pyx_t_5) {

    /* "lxml/etree.pyx":2578
 *         context_node = doc.getroot()
 *     if context_node is None:
 *         _assertValidDoc(doc)             # <<<<<<<<<<<<<<
 *         result._doc = doc
 *     else:
*/
    __pyx_t_7 = __pyx_f_4lxml_5etree__assertValidDoc(__pyx_v_doc); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 2578, __pyx_L1_error)

    /* "lxml/etree.pyx":2579
 *     if context_node is None:
 *         _assertValidDoc(doc)
 *         result._doc = doc             # <<<<<<<<<<<<<<
 *     else:
 *         _assertValidNode(context_node)
*/
    __Pyx_INCREF((PyObject *)__pyx_v_doc);
    __Pyx_GIVEREF((PyObject *)__pyx_v_doc);
    __Pyx_GOTREF((PyObject *)__pyx_v_result->_doc);
    __Pyx_DECREF((PyObject *)__pyx_v_result->_doc);
    __pyx_v_result->_doc = __pyx_v_doc;

    /* "lxml/etree.pyx":2577
 *     if context_node is None and doc is not None:
 *         context_node = doc.getroot()
 *     if context_node is None:             # <<<<<<<<<<<<<<
 *         _assertValidDoc(doc)
 *         result._doc = doc
*/
    goto __pyx_L6;
  }

  /* "lxml/etree.pyx":2581
 *         result._doc = doc
 *     else:
 *         _assertValidNode(context_node)             # <<<<<<<<<<<<<<
 *     result._context_node = context_node
 *     return result
*/
  /*else*/ {
    __pyx_t_7 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_context_node); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 2581, __pyx_L1_error)
  }
  __pyx_L6:;

  /* "lxml/etree.pyx":2582
 *     else:
 *         _assertValidNode(context_node)
 *     result._context_node = context_node             # <<<<<<<<<<<<<<
 *     return result
 * 
*/
  __Pyx_INCREF((PyObject *)__pyx_v_context_node);
  __Pyx_GIVEREF((PyObject *)__pyx_v_context_node);
  __Pyx_GOTREF((PyObject *)__pyx_v_result->_context_node);
  __Pyx_DECREF((PyObject *)__pyx_v_result->_context_node);
  __pyx_v_result->_context_node = __pyx_v_context_node;

  /* "lxml/etree.pyx":2583
 *         _assertValidNode(context_node)
 *     result._context_node = context_node
 *     return result             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "lxml/etree.pyx":2571
 *     return _newElementTree(doc, context_node, _ElementTree)
 * 
 * cdef _ElementTree _newElementTree(_Document doc, _Element context_node,             # <<<<<<<<<<<<<<
 *                                   object baseclass):
 *     cdef _ElementTree result
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._newElementTree", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XDECREF((PyObject *)__pyx_v_context_node);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2592
 *     """
 *     cdef _Element _element
 *     def __cinit__(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         _assertValidNode(element)
 *         self._element = element
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_7_Attrib_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_7_Attrib_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct LxmlElement *__pyx_v_element = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_element,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 2592, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2592, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__cinit__", 0) < (0)) __PYX_ERR(0, 2592, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, i); __PYX_ERR(0, 2592, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2592, __pyx_L3_error)
    }
    __pyx_v_element = ((struct LxmlElement *)values[0]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2592, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._Attrib.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_element), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element, 0, "element", 0))) __PYX_ERR(0, 2592, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_7_Attrib___cinit__(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self), __pyx_v_element);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_7_Attrib___cinit__(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self, struct LxmlElement *__pyx_v_element) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "lxml/etree.pyx":2593
 *     cdef _Element _element
 *     def __cinit__(self, _Element element not None):
 *         _assertValidNode(element)             # <<<<<<<<<<<<<<
 *         self._element = element
 * 
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_element); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 2593, __pyx_L1_error)

  /* "lxml/etree.pyx":2594
 *     def __cinit__(self, _Element element not None):
 *         _assertValidNode(element)
 *         self._element = element             # <<<<<<<<<<<<<<
 * 
 *     # MANIPULATORS
*/
  __Pyx_INCREF((PyObject *)__pyx_v_element);
  __Pyx_GIVEREF((PyObject *)__pyx_v_element);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_element);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_element);
  __pyx_v_self->_element = __pyx_v_element;

  /* "lxml/etree.pyx":2592
 *     """
 *     cdef _Element _element
 *     def __cinit__(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         _assertValidNode(element)
 *         self._element = element
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._Attrib.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2597
 * 
 *     # MANIPULATORS
 *     def __setitem__(self, key, value):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         _setAttributeValue(self._element, key, value)
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_7_Attrib_3__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_4lxml_5etree_7_Attrib_3__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_7_Attrib_2__setitem__(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self), ((PyObject *)__pyx_v_key), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_7_Attrib_2__setitem__(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setitem__", 0);

  /* "lxml/etree.pyx":2598
 *     # MANIPULATORS
 *     def __setitem__(self, key, value):
 *         _assertValidNode(self._element)             # <<<<<<<<<<<<<<
 *         _setAttributeValue(self._element, key, value)
 * 
*/
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_element);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_t_1)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 2598, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":2599
 *     def __setitem__(self, key, value):
 *         _assertValidNode(self._element)
 *         _setAttributeValue(self._element, key, value)             # <<<<<<<<<<<<<<
 * 
 *     def __delitem__(self, key):
*/
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_element);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__setAttributeValue(((struct LxmlElement *)__pyx_t_1), __pyx_v_key, __pyx_v_value); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 2599, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":2597
 * 
 *     # MANIPULATORS
 *     def __setitem__(self, key, value):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         _setAttributeValue(self._element, key, value)
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._Attrib.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2601
 *         _setAttributeValue(self._element, key, value)
 * 
 *     def __delitem__(self, key):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         _delAttribute(self._element, key)
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_7_Attrib_5__delitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static int __pyx_pw_4lxml_5etree_7_Attrib_5__delitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__delitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_7_Attrib_4__delitem__(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self), ((PyObject *)__pyx_v_key));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_7_Attrib_4__delitem__(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self, PyObject *__pyx_v_key) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__delitem__", 0);

  /* "lxml/etree.pyx":2602
 * 
 *     def __delitem__(self, key):
 *         _assertValidNode(self._element)             # <<<<<<<<<<<<<<
 *         _delAttribute(self._element, key)
 * 
*/
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_element);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_t_1)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 2602, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":2603
 *     def __delitem__(self, key):
 *         _assertValidNode(self._element)
 *         _delAttribute(self._element, key)             # <<<<<<<<<<<<<<
 * 
 *     def update(self, sequence_or_dict):
*/
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_element);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__delAttribute(((struct LxmlElement *)__pyx_t_1), __pyx_v_key); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 2603, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":2601
 *         _setAttributeValue(self._element, key, value)
 * 
 *     def __delitem__(self, key):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         _delAttribute(self._element, key)
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._Attrib.__delitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2605
 *         _delAttribute(self._element, key)
 * 
 *     def update(self, sequence_or_dict):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         if isinstance(sequence_or_dict, (dict, _Attrib)):
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_7update(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_7_Attrib_7update = {"update", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_Attrib_7update, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_7update(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_sequence_or_dict = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("update (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_sequence_or_dict,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 2605, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2605, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "update", 0) < (0)) __PYX_ERR(0, 2605, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("update", 1, 1, 1, i); __PYX_ERR(0, 2605, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2605, __pyx_L3_error)
    }
    __pyx_v_sequence_or_dict = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("update", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2605, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._Attrib.update", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_7_Attrib_6update(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self), __pyx_v_sequence_or_dict);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_6update(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self, PyObject *__pyx_v_sequence_or_dict) {
  PyObject *__pyx_v_key = NULL;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  PyObject *(*__pyx_t_8)(PyObject *);
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *(*__pyx_t_12)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("update", 0);
  __Pyx_INCREF(__pyx_v_sequence_or_dict);

  /* "lxml/etree.pyx":2606
 * 
 *     def update(self, sequence_or_dict):
 *         _assertValidNode(self._element)             # <<<<<<<<<<<<<<
 *         if isinstance(sequence_or_dict, (dict, _Attrib)):
 *             sequence_or_dict = sequence_or_dict.items()
*/
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_element);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_t_1)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 2606, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":2607
 *     def update(self, sequence_or_dict):
 *         _assertValidNode(self._element)
 *         if isinstance(sequence_or_dict, (dict, _Attrib)):             # <<<<<<<<<<<<<<
 *             sequence_or_dict = sequence_or_dict.items()
 *         for key, value in sequence_or_dict:
*/
  __pyx_t_4 = PyDict_Check(__pyx_v_sequence_or_dict); 
  if (!__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_TypeCheck(__pyx_v_sequence_or_dict, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Attrib); 
  __pyx_t_3 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":2608
 *         _assertValidNode(self._element)
 *         if isinstance(sequence_or_dict, (dict, _Attrib)):
 *             sequence_or_dict = sequence_or_dict.items()             # <<<<<<<<<<<<<<
 *         for key, value in sequence_or_dict:
 *             _setAttributeValue(self._element, key, value)
*/
    __pyx_t_5 = __pyx_v_sequence_or_dict;
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_6 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_items, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2608, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF_SET(__pyx_v_sequence_or_dict, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "lxml/etree.pyx":2607
 *     def update(self, sequence_or_dict):
 *         _assertValidNode(self._element)
 *         if isinstance(sequence_or_dict, (dict, _Attrib)):             # <<<<<<<<<<<<<<
 *             sequence_or_dict = sequence_or_dict.items()
 *         for key, value in sequence_or_dict:
*/
  }

  /* "lxml/etree.pyx":2609
 *         if isinstance(sequence_or_dict, (dict, _Attrib)):
 *             sequence_or_dict = sequence_or_dict.items()
 *         for key, value in sequence_or_dict:             # <<<<<<<<<<<<<<
 *             _setAttributeValue(self._element, key, value)
 * 
*/
  if (likely(PyList_CheckExact(__pyx_v_sequence_or_dict)) || PyTuple_CheckExact(__pyx_v_sequence_or_dict)) {
    __pyx_t_1 = __pyx_v_sequence_or_dict; __Pyx_INCREF(__pyx_t_1);
    __pyx_t_7 = 0;
    __pyx_t_8 = NULL;
  } else {
    __pyx_t_7 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_sequence_or_dict); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2609, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2609, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_8)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 2609, __pyx_L1_error)
          #endif
          if (__pyx_t_7 >= __pyx_temp) break;
        }
        __pyx_t_5 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_7, __Pyx_ReferenceSharing_OwnStrongReference);
        ++__pyx_t_7;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 2609, __pyx_L1_error)
          #endif
          if (__pyx_t_7 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_7));
        #else
        __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_7);
        #endif
        ++__pyx_t_7;
      }
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2609, __pyx_L1_error)
    } else {
      __pyx_t_5 = __pyx_t_8(__pyx_t_1);
      if (unlikely(!__pyx_t_5)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 2609, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_5);
    if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
      PyObject* sequence = __pyx_t_5;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 2609, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0);
        __Pyx_INCREF(__pyx_t_9);
        __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1);
        __Pyx_INCREF(__pyx_t_10);
      } else {
        __pyx_t_9 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2609, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_9);
        __pyx_t_10 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2609, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_10);
      }
      #else
      __pyx_t_9 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2609, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2609, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      #endif
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_11 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2609, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_12 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_11);
      index = 0; __pyx_t_9 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_9)) goto __pyx_L8_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_9);
      index = 1; __pyx_t_10 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_10)) goto __pyx_L8_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_10);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 2) < (0)) __PYX_ERR(0, 2609, __pyx_L1_error)
      __pyx_t_12 = NULL;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      goto __pyx_L9_unpacking_done;
      __pyx_L8_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_12 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 2609, __pyx_L1_error)
      __pyx_L9_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_9);
    __pyx_t_9 = 0;
    __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_10);
    __pyx_t_10 = 0;

    /* "lxml/etree.pyx":2610
 *             sequence_or_dict = sequence_or_dict.items()
 *         for key, value in sequence_or_dict:
 *             _setAttributeValue(self._element, key, value)             # <<<<<<<<<<<<<<
 * 
 *     def pop(self, key, *default):
*/
    __pyx_t_5 = ((PyObject *)__pyx_v_self->_element);
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_2 = __pyx_f_4lxml_5etree__setAttributeValue(((struct LxmlElement *)__pyx_t_5), __pyx_v_key, __pyx_v_value); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 2610, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "lxml/etree.pyx":2609
 *         if isinstance(sequence_or_dict, (dict, _Attrib)):
 *             sequence_or_dict = sequence_or_dict.items()
 *         for key, value in sequence_or_dict:             # <<<<<<<<<<<<<<
 *             _setAttributeValue(self._element, key, value)
 * 
*/
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":2605
 *         _delAttribute(self._element, key)
 * 
 *     def update(self, sequence_or_dict):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         if isinstance(sequence_or_dict, (dict, _Attrib)):
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("lxml.etree._Attrib.update", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XDECREF(__pyx_v_sequence_or_dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2612
 *             _setAttributeValue(self._element, key, value)
 * 
 *     def pop(self, key, *default):             # <<<<<<<<<<<<<<
 *         if len(default) > 1:
 *             raise TypeError, f"pop expected at most 2 arguments, got {len(default)+1}"
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_9pop(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_7_Attrib_9pop = {"pop", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_Attrib_9pop, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_9pop(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_default = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pop (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  __pyx_v_default = __Pyx_ArgsSlice_FASTCALL(__pyx_args, 1, __pyx_nargs);
  if (unlikely(!__pyx_v_default)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_v_default);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_key,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 2612, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        default:
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2612, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      const Py_ssize_t used_pos_args = (kwd_pos_args < 1) ? kwd_pos_args : 1;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, used_pos_args, __pyx_kwds_len, "pop", 0) < (0)) __PYX_ERR(0, 2612, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("pop", 0, 1, 1, i); __PYX_ERR(0, 2612, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs < 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2612, __pyx_L3_error)
    }
    __pyx_v_key = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pop", 0, 1, 1, __pyx_nargs); __PYX_ERR(0, 2612, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v_default); __pyx_v_default = 0;
  __Pyx_AddTraceback("lxml.etree._Attrib.pop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_7_Attrib_8pop(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self), __pyx_v_key, __pyx_v_default);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v_default);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_8pop(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default) {
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("pop", 0);

  /* "lxml/etree.pyx":2613
 * 
 *     def pop(self, key, *default):
 *         if len(default) > 1:             # <<<<<<<<<<<<<<
 *             raise TypeError, f"pop expected at most 2 arguments, got {len(default)+1}"
 *         _assertValidNode(self._element)
*/
  __pyx_t_1 = __Pyx_PyTuple_GET_SIZE(__pyx_v_default); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2613, __pyx_L1_error)
  __pyx_t_2 = (__pyx_t_1 > 1);
  if (unlikely(__pyx_t_2)) {

    /* "lxml/etree.pyx":2614
 *     def pop(self, key, *default):
 *         if len(default) > 1:
 *             raise TypeError, f"pop expected at most 2 arguments, got {len(default)+1}"             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         result = _getAttributeValue(self._element, key, None)
*/
    __pyx_t_1 = __Pyx_PyTuple_GET_SIZE(__pyx_v_default); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2614, __pyx_L1_error)
    __pyx_t_3 = __Pyx_PyUnicode_From_Py_ssize_t((__pyx_t_1 + 1), 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2614, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_pop_expected_at_most_2_arguments, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2614, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_t_4, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __PYX_ERR(0, 2614, __pyx_L1_error)

    /* "lxml/etree.pyx":2613
 * 
 *     def pop(self, key, *default):
 *         if len(default) > 1:             # <<<<<<<<<<<<<<
 *             raise TypeError, f"pop expected at most 2 arguments, got {len(default)+1}"
 *         _assertValidNode(self._element)
*/
  }

  /* "lxml/etree.pyx":2615
 *         if len(default) > 1:
 *             raise TypeError, f"pop expected at most 2 arguments, got {len(default)+1}"
 *         _assertValidNode(self._element)             # <<<<<<<<<<<<<<
 *         result = _getAttributeValue(self._element, key, None)
 *         if result is None:
*/
  __pyx_t_4 = ((PyObject *)__pyx_v_self->_element);
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_5 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_t_4)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 2615, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "lxml/etree.pyx":2616
 *             raise TypeError, f"pop expected at most 2 arguments, got {len(default)+1}"
 *         _assertValidNode(self._element)
 *         result = _getAttributeValue(self._element, key, None)             # <<<<<<<<<<<<<<
 *         if result is None:
 *             if not default:
*/
  __pyx_t_4 = ((PyObject *)__pyx_v_self->_element);
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_3 = __pyx_f_4lxml_5etree__getAttributeValue(((struct LxmlElement *)__pyx_t_4), __pyx_v_key, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2616, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_result = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "lxml/etree.pyx":2617
 *         _assertValidNode(self._element)
 *         result = _getAttributeValue(self._element, key, None)
 *         if result is None:             # <<<<<<<<<<<<<<
 *             if not default:
 *                 raise KeyError, key
*/
  __pyx_t_2 = (__pyx_v_result == Py_None);
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":2618
 *         result = _getAttributeValue(self._element, key, None)
 *         if result is None:
 *             if not default:             # <<<<<<<<<<<<<<
 *                 raise KeyError, key
 *             result = default[0]
*/
    {
      Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_v_default);
      if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(0, 2618, __pyx_L1_error)
      __pyx_t_2 = (__pyx_temp != 0);
    }

    __pyx_t_6 = (!__pyx_t_2);
    if (unlikely(__pyx_t_6)) {

      /* "lxml/etree.pyx":2619
 *         if result is None:
 *             if not default:
 *                 raise KeyError, key             # <<<<<<<<<<<<<<
 *             result = default[0]
 *         else:
*/
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_KeyError))), __pyx_v_key, 0, 0);
      __PYX_ERR(0, 2619, __pyx_L1_error)

      /* "lxml/etree.pyx":2618
 *         result = _getAttributeValue(self._element, key, None)
 *         if result is None:
 *             if not default:             # <<<<<<<<<<<<<<
 *                 raise KeyError, key
 *             result = default[0]
*/
    }

    /* "lxml/etree.pyx":2620
 *             if not default:
 *                 raise KeyError, key
 *             result = default[0]             # <<<<<<<<<<<<<<
 *         else:
 *             _delAttribute(self._element, key)
*/
    __pyx_t_3 = __Pyx_GetItemInt_Tuple(__pyx_v_default, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2620, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "lxml/etree.pyx":2617
 *         _assertValidNode(self._element)
 *         result = _getAttributeValue(self._element, key, None)
 *         if result is None:             # <<<<<<<<<<<<<<
 *             if not default:
 *                 raise KeyError, key
*/
    goto __pyx_L4;
  }

  /* "lxml/etree.pyx":2622
 *             result = default[0]
 *         else:
 *             _delAttribute(self._element, key)             # <<<<<<<<<<<<<<
 *         return result
 * 
*/
  /*else*/ {
    __pyx_t_3 = ((PyObject *)__pyx_v_self->_element);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_5 = __pyx_f_4lxml_5etree__delAttribute(((struct LxmlElement *)__pyx_t_3), __pyx_v_key); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 2622, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_L4:;

  /* "lxml/etree.pyx":2623
 *         else:
 *             _delAttribute(self._element, key)
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     def clear(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "lxml/etree.pyx":2612
 *             _setAttributeValue(self._element, key, value)
 * 
 *     def pop(self, key, *default):             # <<<<<<<<<<<<<<
 *         if len(default) > 1:
 *             raise TypeError, f"pop expected at most 2 arguments, got {len(default)+1}"
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._Attrib.pop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2625
 *         return result
 * 
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         c_attrs = self._element._c_node.properties
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_11clear(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_7_Attrib_11clear = {"clear", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_Attrib_11clear, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_11clear(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clear (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("clear", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("clear", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_7_Attrib_10clear(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_10clear(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self) {
  xmlAttr *__pyx_v_c_attrs;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  xmlAttr *__pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("clear", 0);

  /* "lxml/etree.pyx":2626
 * 
 *     def clear(self):
 *         _assertValidNode(self._element)             # <<<<<<<<<<<<<<
 *         c_attrs = self._element._c_node.properties
 *         if c_attrs:
*/
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_element);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_t_1)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 2626, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":2627
 *     def clear(self):
 *         _assertValidNode(self._element)
 *         c_attrs = self._element._c_node.properties             # <<<<<<<<<<<<<<
 *         if c_attrs:
 *             self._element._c_node.properties = NULL
*/
  __pyx_t_3 = __pyx_v_self->_element->_c_node->properties;
  __pyx_v_c_attrs = __pyx_t_3;

  /* "lxml/etree.pyx":2628
 *         _assertValidNode(self._element)
 *         c_attrs = self._element._c_node.properties
 *         if c_attrs:             # <<<<<<<<<<<<<<
 *             self._element._c_node.properties = NULL
 *             tree.xmlFreePropList(c_attrs)
*/
  __pyx_t_4 = (__pyx_v_c_attrs != 0);
  if (__pyx_t_4) {

    /* "lxml/etree.pyx":2629
 *         c_attrs = self._element._c_node.properties
 *         if c_attrs:
 *             self._element._c_node.properties = NULL             # <<<<<<<<<<<<<<
 *             tree.xmlFreePropList(c_attrs)
 * 
*/
    __pyx_v_self->_element->_c_node->properties = NULL;

    /* "lxml/etree.pyx":2630
 *         if c_attrs:
 *             self._element._c_node.properties = NULL
 *             tree.xmlFreePropList(c_attrs)             # <<<<<<<<<<<<<<
 * 
 *     # ACCESSORS
*/
    xmlFreePropList(__pyx_v_c_attrs);

    /* "lxml/etree.pyx":2628
 *         _assertValidNode(self._element)
 *         c_attrs = self._element._c_node.properties
 *         if c_attrs:             # <<<<<<<<<<<<<<
 *             self._element._c_node.properties = NULL
 *             tree.xmlFreePropList(c_attrs)
*/
  }

  /* "lxml/etree.pyx":2625
 *         return result
 * 
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         c_attrs = self._element._c_node.properties
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._Attrib.clear", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2633
 * 
 *     # ACCESSORS
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return repr(dict( _collectAttributes(self._element._c_node, 3) ))
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_13__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_13__repr__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_7_Attrib_12__repr__(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_12__repr__(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "lxml/etree.pyx":2634
 *     # ACCESSORS
 *     def __repr__(self):
 *         _assertValidNode(self._element)             # <<<<<<<<<<<<<<
 *         return repr(dict( _collectAttributes(self._element._c_node, 3) ))
 * 
*/
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_element);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_t_1)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 2634, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":2635
 *     def __repr__(self):
 *         _assertValidNode(self._element)
 *         return repr(dict( _collectAttributes(self._element._c_node, 3) ))             # <<<<<<<<<<<<<<
 * 
 *     def __copy__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = NULL;
  __pyx_t_4 = __pyx_f_4lxml_5etree__collectAttributes(__pyx_v_self->_element->_c_node, 3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2635, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(&PyDict_Type), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2635, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_4 = PyObject_Repr(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2635, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":2633
 * 
 *     # ACCESSORS
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return repr(dict( _collectAttributes(self._element._c_node, 3) ))
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._Attrib.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2637
 *         return repr(dict( _collectAttributes(self._element._c_node, 3) ))
 * 
 *     def __copy__(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return dict(_collectAttributes(self._element._c_node, 3))
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_15__copy__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_7_Attrib_15__copy__ = {"__copy__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_Attrib_15__copy__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_15__copy__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__copy__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__copy__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__copy__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_7_Attrib_14__copy__(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_14__copy__(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__copy__", 0);

  /* "lxml/etree.pyx":2638
 * 
 *     def __copy__(self):
 *         _assertValidNode(self._element)             # <<<<<<<<<<<<<<
 *         return dict(_collectAttributes(self._element._c_node, 3))
 * 
*/
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_element);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_t_1)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 2638, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":2639
 *     def __copy__(self):
 *         _assertValidNode(self._element)
 *         return dict(_collectAttributes(self._element._c_node, 3))             # <<<<<<<<<<<<<<
 * 
 *     def __deepcopy__(self, memo):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = NULL;
  __pyx_t_4 = __pyx_f_4lxml_5etree__collectAttributes(__pyx_v_self->_element->_c_node, 3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2639, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(&PyDict_Type), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2639, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":2637
 *         return repr(dict( _collectAttributes(self._element._c_node, 3) ))
 * 
 *     def __copy__(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return dict(_collectAttributes(self._element._c_node, 3))
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._Attrib.__copy__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2641
 *         return dict(_collectAttributes(self._element._c_node, 3))
 * 
 *     def __deepcopy__(self, memo):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return dict(_collectAttributes(self._element._c_node, 3))
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_17__deepcopy__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_7_Attrib_17__deepcopy__ = {"__deepcopy__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_Attrib_17__deepcopy__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_17__deepcopy__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_memo = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__deepcopy__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_memo,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 2641, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2641, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__deepcopy__", 0) < (0)) __PYX_ERR(0, 2641, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__deepcopy__", 1, 1, 1, i); __PYX_ERR(0, 2641, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2641, __pyx_L3_error)
    }
    __pyx_v_memo = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__deepcopy__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2641, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._Attrib.__deepcopy__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_7_Attrib_16__deepcopy__(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self), __pyx_v_memo);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_16__deepcopy__(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_memo) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__deepcopy__", 0);

  /* "lxml/etree.pyx":2642
 * 
 *     def __deepcopy__(self, memo):
 *         _assertValidNode(self._element)             # <<<<<<<<<<<<<<
 *         return dict(_collectAttributes(self._element._c_node, 3))
 * 
*/
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_element);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_t_1)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 2642, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":2643
 *     def __deepcopy__(self, memo):
 *         _assertValidNode(self._element)
 *         return dict(_collectAttributes(self._element._c_node, 3))             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, key):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = NULL;
  __pyx_t_4 = __pyx_f_4lxml_5etree__collectAttributes(__pyx_v_self->_element->_c_node, 3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2643, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(&PyDict_Type), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2643, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":2641
 *         return dict(_collectAttributes(self._element._c_node, 3))
 * 
 *     def __deepcopy__(self, memo):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return dict(_collectAttributes(self._element._c_node, 3))
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._Attrib.__deepcopy__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2645
 *         return dict(_collectAttributes(self._element._c_node, 3))
 * 
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         result = _getAttributeValue(self._element, key, None)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_19__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_19__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_7_Attrib_18__getitem__(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self), ((PyObject *)__pyx_v_key));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_18__getitem__(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self, PyObject *__pyx_v_key) {
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "lxml/etree.pyx":2646
 * 
 *     def __getitem__(self, key):
 *         _assertValidNode(self._element)             # <<<<<<<<<<<<<<
 *         result = _getAttributeValue(self._element, key, None)
 *         if result is None:
*/
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_element);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_t_1)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 2646, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":2647
 *     def __getitem__(self, key):
 *         _assertValidNode(self._element)
 *         result = _getAttributeValue(self._element, key, None)             # <<<<<<<<<<<<<<
 *         if result is None:
 *             raise KeyError, key
*/
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_element);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_3 = __pyx_f_4lxml_5etree__getAttributeValue(((struct LxmlElement *)__pyx_t_1), __pyx_v_key, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2647, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_result = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "lxml/etree.pyx":2648
 *         _assertValidNode(self._element)
 *         result = _getAttributeValue(self._element, key, None)
 *         if result is None:             # <<<<<<<<<<<<<<
 *             raise KeyError, key
 *         return result
*/
  __pyx_t_4 = (__pyx_v_result == Py_None);
  if (unlikely(__pyx_t_4)) {

    /* "lxml/etree.pyx":2649
 *         result = _getAttributeValue(self._element, key, None)
 *         if result is None:
 *             raise KeyError, key             # <<<<<<<<<<<<<<
 *         return result
 * 
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_KeyError))), __pyx_v_key, 0, 0);
    __PYX_ERR(0, 2649, __pyx_L1_error)

    /* "lxml/etree.pyx":2648
 *         _assertValidNode(self._element)
 *         result = _getAttributeValue(self._element, key, None)
 *         if result is None:             # <<<<<<<<<<<<<<
 *             raise KeyError, key
 *         return result
*/
  }

  /* "lxml/etree.pyx":2650
 *         if result is None:
 *             raise KeyError, key
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     def __bool__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "lxml/etree.pyx":2645
 *         return dict(_collectAttributes(self._element._c_node, 3))
 * 
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         result = _getAttributeValue(self._element, key, None)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Attrib.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2652
 *         return result
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         cdef xmlAttr* c_attr = self._element._c_node.properties
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_7_Attrib_21__bool__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_4lxml_5etree_7_Attrib_21__bool__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_7_Attrib_20__bool__(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_7_Attrib_20__bool__(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self) {
  xmlAttr *__pyx_v_c_attr;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  xmlAttr *__pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__bool__", 0);

  /* "lxml/etree.pyx":2653
 * 
 *     def __bool__(self):
 *         _assertValidNode(self._element)             # <<<<<<<<<<<<<<
 *         cdef xmlAttr* c_attr = self._element._c_node.properties
 *         while c_attr is not NULL:
*/
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_element);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_t_1)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 2653, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":2654
 *     def __bool__(self):
 *         _assertValidNode(self._element)
 *         cdef xmlAttr* c_attr = self._element._c_node.properties             # <<<<<<<<<<<<<<
 *         while c_attr is not NULL:
 *             if c_attr.type == tree.XML_ATTRIBUTE_NODE:
*/
  __pyx_t_3 = __pyx_v_self->_element->_c_node->properties;
  __pyx_v_c_attr = __pyx_t_3;

  /* "lxml/etree.pyx":2655
 *         _assertValidNode(self._element)
 *         cdef xmlAttr* c_attr = self._element._c_node.properties
 *         while c_attr is not NULL:             # <<<<<<<<<<<<<<
 *             if c_attr.type == tree.XML_ATTRIBUTE_NODE:
 *                 return 1
*/
  while (1) {
    __pyx_t_4 = (__pyx_v_c_attr != NULL);
    if (!__pyx_t_4) break;

    /* "lxml/etree.pyx":2656
 *         cdef xmlAttr* c_attr = self._element._c_node.properties
 *         while c_attr is not NULL:
 *             if c_attr.type == tree.XML_ATTRIBUTE_NODE:             # <<<<<<<<<<<<<<
 *                 return 1
 *             c_attr = c_attr.next
*/
    __pyx_t_4 = (__pyx_v_c_attr->type == XML_ATTRIBUTE_NODE);
    if (__pyx_t_4) {

      /* "lxml/etree.pyx":2657
 *         while c_attr is not NULL:
 *             if c_attr.type == tree.XML_ATTRIBUTE_NODE:
 *                 return 1             # <<<<<<<<<<<<<<
 *             c_attr = c_attr.next
 *         return 0
*/
      __pyx_r = 1;
      goto __pyx_L0;

      /* "lxml/etree.pyx":2656
 *         cdef xmlAttr* c_attr = self._element._c_node.properties
 *         while c_attr is not NULL:
 *             if c_attr.type == tree.XML_ATTRIBUTE_NODE:             # <<<<<<<<<<<<<<
 *                 return 1
 *             c_attr = c_attr.next
*/
    }

    /* "lxml/etree.pyx":2658
 *             if c_attr.type == tree.XML_ATTRIBUTE_NODE:
 *                 return 1
 *             c_attr = c_attr.next             # <<<<<<<<<<<<<<
 *         return 0
 * 
*/
    __pyx_t_3 = __pyx_v_c_attr->next;
    __pyx_v_c_attr = __pyx_t_3;
  }

  /* "lxml/etree.pyx":2659
 *                 return 1
 *             c_attr = c_attr.next
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":2652
 *         return result
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         cdef xmlAttr* c_attr = self._element._c_node.properties
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._Attrib.__bool__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2661
 *         return 0
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         cdef xmlAttr* c_attr = self._element._c_node.properties
*/

/* Python wrapper */
static Py_ssize_t __pyx_pw_4lxml_5etree_7_Attrib_23__len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_pw_4lxml_5etree_7_Attrib_23__len__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_7_Attrib_22__len__(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_ssize_t __pyx_pf_4lxml_5etree_7_Attrib_22__len__(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self) {
  xmlAttr *__pyx_v_c_attr;
  Py_ssize_t __pyx_v_c;
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  xmlAttr *__pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "lxml/etree.pyx":2662
 * 
 *     def __len__(self):
 *         _assertValidNode(self._element)             # <<<<<<<<<<<<<<
 *         cdef xmlAttr* c_attr = self._element._c_node.properties
 *         cdef Py_ssize_t c = 0
*/
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_element);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_t_1)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 2662, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":2663
 *     def __len__(self):
 *         _assertValidNode(self._element)
 *         cdef xmlAttr* c_attr = self._element._c_node.properties             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t c = 0
 *         while c_attr is not NULL:
*/
  __pyx_t_3 = __pyx_v_self->_element->_c_node->properties;
  __pyx_v_c_attr = __pyx_t_3;

  /* "lxml/etree.pyx":2664
 *         _assertValidNode(self._element)
 *         cdef xmlAttr* c_attr = self._element._c_node.properties
 *         cdef Py_ssize_t c = 0             # <<<<<<<<<<<<<<
 *         while c_attr is not NULL:
 *             if c_attr.type == tree.XML_ATTRIBUTE_NODE:
*/
  __pyx_v_c = 0;

  /* "lxml/etree.pyx":2665
 *         cdef xmlAttr* c_attr = self._element._c_node.properties
 *         cdef Py_ssize_t c = 0
 *         while c_attr is not NULL:             # <<<<<<<<<<<<<<
 *             if c_attr.type == tree.XML_ATTRIBUTE_NODE:
 *                 c += 1
*/
  while (1) {
    __pyx_t_4 = (__pyx_v_c_attr != NULL);
    if (!__pyx_t_4) break;

    /* "lxml/etree.pyx":2666
 *         cdef Py_ssize_t c = 0
 *         while c_attr is not NULL:
 *             if c_attr.type == tree.XML_ATTRIBUTE_NODE:             # <<<<<<<<<<<<<<
 *                 c += 1
 *             c_attr = c_attr.next
*/
    __pyx_t_4 = (__pyx_v_c_attr->type == XML_ATTRIBUTE_NODE);
    if (__pyx_t_4) {

      /* "lxml/etree.pyx":2667
 *         while c_attr is not NULL:
 *             if c_attr.type == tree.XML_ATTRIBUTE_NODE:
 *                 c += 1             # <<<<<<<<<<<<<<
 *             c_attr = c_attr.next
 *         return c
*/
      __pyx_v_c = (__pyx_v_c + 1);

      /* "lxml/etree.pyx":2666
 *         cdef Py_ssize_t c = 0
 *         while c_attr is not NULL:
 *             if c_attr.type == tree.XML_ATTRIBUTE_NODE:             # <<<<<<<<<<<<<<
 *                 c += 1
 *             c_attr = c_attr.next
*/
    }

    /* "lxml/etree.pyx":2668
 *             if c_attr.type == tree.XML_ATTRIBUTE_NODE:
 *                 c += 1
 *             c_attr = c_attr.next             # <<<<<<<<<<<<<<
 *         return c
 * 
*/
    __pyx_t_3 = __pyx_v_c_attr->next;
    __pyx_v_c_attr = __pyx_t_3;
  }

  /* "lxml/etree.pyx":2669
 *                 c += 1
 *             c_attr = c_attr.next
 *         return c             # <<<<<<<<<<<<<<
 * 
 *     def get(self, key, default=None):
*/
  __pyx_r = __pyx_v_c;
  goto __pyx_L0;

  /* "lxml/etree.pyx":2661
 *         return 0
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         cdef xmlAttr* c_attr = self._element._c_node.properties
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._Attrib.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2671
 *         return c
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return _getAttributeValue(self._element, key, default)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_25get(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_7_Attrib_25get = {"get", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_Attrib_25get, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_25get(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_default = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_key,&__pyx_mstate_global->__pyx_n_u_default,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 2671, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 2671, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2671, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "get", 0) < (0)) __PYX_ERR(0, 2671, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, i); __PYX_ERR(0, 2671, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 2671, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2671, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_key = values[0];
    __pyx_v_default = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 2671, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._Attrib.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_7_Attrib_24get(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self), __pyx_v_key, __pyx_v_default);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_24get(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get", 0);

  /* "lxml/etree.pyx":2672
 * 
 *     def get(self, key, default=None):
 *         _assertValidNode(self._element)             # <<<<<<<<<<<<<<
 *         return _getAttributeValue(self._element, key, default)
 * 
*/
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_element);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_t_1)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 2672, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":2673
 *     def get(self, key, default=None):
 *         _assertValidNode(self._element)
 *         return _getAttributeValue(self._element, key, default)             # <<<<<<<<<<<<<<
 * 
 *     def keys(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_element);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_3 = __pyx_f_4lxml_5etree__getAttributeValue(((struct LxmlElement *)__pyx_t_1), __pyx_v_key, __pyx_v_default); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2673, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":2671
 *         return c
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return _getAttributeValue(self._element, key, default)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Attrib.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2675
 *         return _getAttributeValue(self._element, key, default)
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return _collectAttributes(self._element._c_node, 1)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_27keys(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_7_Attrib_27keys = {"keys", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_Attrib_27keys, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_27keys(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("keys (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("keys", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("keys", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_7_Attrib_26keys(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_26keys(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("keys", 0);

  /* "lxml/etree.pyx":2676
 * 
 *     def keys(self):
 *         _assertValidNode(self._element)             # <<<<<<<<<<<<<<
 *         return _collectAttributes(self._element._c_node, 1)
 * 
*/
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_element);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_t_1)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 2676, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":2677
 *     def keys(self):
 *         _assertValidNode(self._element)
 *         return _collectAttributes(self._element._c_node, 1)             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree__collectAttributes(__pyx_v_self->_element->_c_node, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2677, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":2675
 *         return _getAttributeValue(self._element, key, default)
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return _collectAttributes(self._element._c_node, 1)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._Attrib.keys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2679
 *         return _collectAttributes(self._element._c_node, 1)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return iter(_collectAttributes(self._element._c_node, 1))
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_29__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_29__iter__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_7_Attrib_28__iter__(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_28__iter__(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "lxml/etree.pyx":2680
 * 
 *     def __iter__(self):
 *         _assertValidNode(self._element)             # <<<<<<<<<<<<<<
 *         return iter(_collectAttributes(self._element._c_node, 1))
 * 
*/
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_element);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_t_1)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 2680, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":2681
 *     def __iter__(self):
 *         _assertValidNode(self._element)
 *         return iter(_collectAttributes(self._element._c_node, 1))             # <<<<<<<<<<<<<<
 * 
 *     def iterkeys(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree__collectAttributes(__pyx_v_self->_element->_c_node, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2681, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2681, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":2679
 *         return _collectAttributes(self._element._c_node, 1)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return iter(_collectAttributes(self._element._c_node, 1))
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Attrib.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2683
 *         return iter(_collectAttributes(self._element._c_node, 1))
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return iter(_collectAttributes(self._element._c_node, 1))
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_31iterkeys(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_7_Attrib_31iterkeys = {"iterkeys", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_Attrib_31iterkeys, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_31iterkeys(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iterkeys (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("iterkeys", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("iterkeys", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_7_Attrib_30iterkeys(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_30iterkeys(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("iterkeys", 0);

  /* "lxml/etree.pyx":2684
 * 
 *     def iterkeys(self):
 *         _assertValidNode(self._element)             # <<<<<<<<<<<<<<
 *         return iter(_collectAttributes(self._element._c_node, 1))
 * 
*/
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_element);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_t_1)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 2684, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":2685
 *     def iterkeys(self):
 *         _assertValidNode(self._element)
 *         return iter(_collectAttributes(self._element._c_node, 1))             # <<<<<<<<<<<<<<
 * 
 *     def values(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree__collectAttributes(__pyx_v_self->_element->_c_node, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2685, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2685, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":2683
 *         return iter(_collectAttributes(self._element._c_node, 1))
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return iter(_collectAttributes(self._element._c_node, 1))
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Attrib.iterkeys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2687
 *         return iter(_collectAttributes(self._element._c_node, 1))
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return _collectAttributes(self._element._c_node, 2)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_33values(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_7_Attrib_33values = {"values", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_Attrib_33values, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_33values(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("values (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("values", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("values", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_7_Attrib_32values(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_32values(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("values", 0);

  /* "lxml/etree.pyx":2688
 * 
 *     def values(self):
 *         _assertValidNode(self._element)             # <<<<<<<<<<<<<<
 *         return _collectAttributes(self._element._c_node, 2)
 * 
*/
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_element);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_t_1)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 2688, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":2689
 *     def values(self):
 *         _assertValidNode(self._element)
 *         return _collectAttributes(self._element._c_node, 2)             # <<<<<<<<<<<<<<
 * 
 *     def itervalues(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree__collectAttributes(__pyx_v_self->_element->_c_node, 2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2689, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":2687
 *         return iter(_collectAttributes(self._element._c_node, 1))
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return _collectAttributes(self._element._c_node, 2)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._Attrib.values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2691
 *         return _collectAttributes(self._element._c_node, 2)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return iter(_collectAttributes(self._element._c_node, 2))
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_35itervalues(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_7_Attrib_35itervalues = {"itervalues", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_Attrib_35itervalues, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_35itervalues(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("itervalues (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("itervalues", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("itervalues", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_7_Attrib_34itervalues(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_34itervalues(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("itervalues", 0);

  /* "lxml/etree.pyx":2692
 * 
 *     def itervalues(self):
 *         _assertValidNode(self._element)             # <<<<<<<<<<<<<<
 *         return iter(_collectAttributes(self._element._c_node, 2))
 * 
*/
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_element);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_t_1)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 2692, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":2693
 *     def itervalues(self):
 *         _assertValidNode(self._element)
 *         return iter(_collectAttributes(self._element._c_node, 2))             # <<<<<<<<<<<<<<
 * 
 *     def items(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree__collectAttributes(__pyx_v_self->_element->_c_node, 2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2693, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2693, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":2691
 *         return _collectAttributes(self._element._c_node, 2)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return iter(_collectAttributes(self._element._c_node, 2))
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Attrib.itervalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2695
 *         return iter(_collectAttributes(self._element._c_node, 2))
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return _collectAttributes(self._element._c_node, 3)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_37items(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_7_Attrib_37items = {"items", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_Attrib_37items, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_37items(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("items", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("items", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_7_Attrib_36items(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_36items(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("items", 0);

  /* "lxml/etree.pyx":2696
 * 
 *     def items(self):
 *         _assertValidNode(self._element)             # <<<<<<<<<<<<<<
 *         return _collectAttributes(self._element._c_node, 3)
 * 
*/
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_element);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_t_1)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 2696, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":2697
 *     def items(self):
 *         _assertValidNode(self._element)
 *         return _collectAttributes(self._element._c_node, 3)             # <<<<<<<<<<<<<<
 * 
 *     def iteritems(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree__collectAttributes(__pyx_v_self->_element->_c_node, 3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2697, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":2695
 *         return iter(_collectAttributes(self._element._c_node, 2))
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return _collectAttributes(self._element._c_node, 3)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._Attrib.items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2699
 *         return _collectAttributes(self._element._c_node, 3)
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return iter(_collectAttributes(self._element._c_node, 3))
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_39iteritems(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_7_Attrib_39iteritems = {"iteritems", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_Attrib_39iteritems, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_39iteritems(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iteritems (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("iteritems", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("iteritems", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_7_Attrib_38iteritems(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_38iteritems(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("iteritems", 0);

  /* "lxml/etree.pyx":2700
 * 
 *     def iteritems(self):
 *         _assertValidNode(self._element)             # <<<<<<<<<<<<<<
 *         return iter(_collectAttributes(self._element._c_node, 3))
 * 
*/
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_element);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_t_1)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 2700, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":2701
 *     def iteritems(self):
 *         _assertValidNode(self._element)
 *         return iter(_collectAttributes(self._element._c_node, 3))             # <<<<<<<<<<<<<<
 * 
 *     def has_key(self, key):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree__collectAttributes(__pyx_v_self->_element->_c_node, 3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2701, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2701, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":2699
 *         return _collectAttributes(self._element._c_node, 3)
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return iter(_collectAttributes(self._element._c_node, 3))
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Attrib.iteritems", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2703
 *         return iter(_collectAttributes(self._element._c_node, 3))
 * 
 *     def has_key(self, key):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return key in self
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_41has_key(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_7_Attrib_41has_key = {"has_key", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_Attrib_41has_key, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_41has_key(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_key = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("has_key (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_key,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 2703, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2703, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "has_key", 0) < (0)) __PYX_ERR(0, 2703, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("has_key", 1, 1, 1, i); __PYX_ERR(0, 2703, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2703, __pyx_L3_error)
    }
    __pyx_v_key = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("has_key", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2703, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._Attrib.has_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_7_Attrib_40has_key(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self), __pyx_v_key);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_40has_key(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self, PyObject *__pyx_v_key) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("has_key", 0);

  /* "lxml/etree.pyx":2704
 * 
 *     def has_key(self, key):
 *         _assertValidNode(self._element)             # <<<<<<<<<<<<<<
 *         return key in self
 * 
*/
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_element);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_t_1)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 2704, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":2705
 *     def has_key(self, key):
 *         _assertValidNode(self._element)
 *         return key in self             # <<<<<<<<<<<<<<
 * 
 *     def __contains__(self, key):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = (__Pyx_PySequence_ContainsTF(__pyx_v_key, ((PyObject *)__pyx_v_self), Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 2705, __pyx_L1_error)
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2705, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":2703
 *         return iter(_collectAttributes(self._element._c_node, 3))
 * 
 *     def has_key(self, key):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return key in self
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._Attrib.has_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2707
 *         return key in self
 * 
 *     def __contains__(self, key):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         cdef xmlNode* c_node
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_7_Attrib_43__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static int __pyx_pw_4lxml_5etree_7_Attrib_43__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_7_Attrib_42__contains__(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self), ((PyObject *)__pyx_v_key));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_7_Attrib_42__contains__(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self, PyObject *__pyx_v_key) {
  xmlNode *__pyx_v_c_node;
  PyObject *__pyx_v_ns = NULL;
  PyObject *__pyx_v_tag = NULL;
  const xmlChar *__pyx_v_c_href;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  xmlNode *__pyx_t_5;
  const xmlChar *__pyx_t_6;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__contains__", 0);

  /* "lxml/etree.pyx":2708
 * 
 *     def __contains__(self, key):
 *         _assertValidNode(self._element)             # <<<<<<<<<<<<<<
 *         cdef xmlNode* c_node
 *         ns, tag = _getNsTag(key)
*/
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_element);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_t_1)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 2708, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":2710
 *         _assertValidNode(self._element)
 *         cdef xmlNode* c_node
 *         ns, tag = _getNsTag(key)             # <<<<<<<<<<<<<<
 *         c_node = self._element._c_node
 *         c_href = <const_xmlChar*>NULL if ns is None else _xcstr(ns)
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__getNsTag(__pyx_v_key); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2710, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(__pyx_t_1 != Py_None)) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 2710, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2710, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2710, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 2710, __pyx_L1_error)
  }
  __pyx_v_ns = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_tag = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "lxml/etree.pyx":2711
 *         cdef xmlNode* c_node
 *         ns, tag = _getNsTag(key)
 *         c_node = self._element._c_node             # <<<<<<<<<<<<<<
 *         c_href = <const_xmlChar*>NULL if ns is None else _xcstr(ns)
 *         return 1 if tree.xmlHasNsProp(c_node, _xcstr(tag), c_href) else 0
*/
  __pyx_t_5 = __pyx_v_self->_element->_c_node;
  __pyx_v_c_node = __pyx_t_5;

  /* "lxml/etree.pyx":2712
 *         ns, tag = _getNsTag(key)
 *         c_node = self._element._c_node
 *         c_href = <const_xmlChar*>NULL if ns is None else _xcstr(ns)             # <<<<<<<<<<<<<<
 *         return 1 if tree.xmlHasNsProp(c_node, _xcstr(tag), c_href) else 0
 * 
*/
  __pyx_t_7 = (__pyx_v_ns == Py_None);
  if (__pyx_t_7) {
    __pyx_t_6 = ((const xmlChar *)NULL);
  } else {
    __pyx_t_6 = (const xmlChar*)PyBytes_AS_STRING(__pyx_v_ns);
  }
  __pyx_v_c_href = __pyx_t_6;

  /* "lxml/etree.pyx":2713
 *         c_node = self._element._c_node
 *         c_href = <const_xmlChar*>NULL if ns is None else _xcstr(ns)
 *         return 1 if tree.xmlHasNsProp(c_node, _xcstr(tag), c_href) else 0             # <<<<<<<<<<<<<<
 * 
 *     def __richcmp__(self, other, int op):
*/
  __pyx_t_7 = (xmlHasNsProp(__pyx_v_c_node, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_tag), __pyx_v_c_href) != 0);
  if (__pyx_t_7) {
    __pyx_t_2 = 1;
  } else {
    __pyx_t_2 = 0;
  }
  __pyx_r = __pyx_t_2;
  goto __pyx_L0;

  /* "lxml/etree.pyx":2707
 *         return key in self
 * 
 *     def __contains__(self, key):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         cdef xmlNode* c_node
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._Attrib.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ns);
  __Pyx_XDECREF(__pyx_v_tag);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2715
 *         return 1 if tree.xmlHasNsProp(c_node, _xcstr(tag), c_href) else 0
 * 
 *     def __richcmp__(self, other, int op):             # <<<<<<<<<<<<<<
 *         try:
 *             one = dict(self.items())
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_45__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_45__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__richcmp__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_7_Attrib_44__richcmp__(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self), ((PyObject *)__pyx_v_other), ((int)__pyx_v_op));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_44__richcmp__(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op) {
  PyObject *__pyx_v_one = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  size_t __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__richcmp__", 0);
  __Pyx_INCREF(__pyx_v_other);

  /* "lxml/etree.pyx":2716
 * 
 *     def __richcmp__(self, other, int op):
 *         try:             # <<<<<<<<<<<<<<
 *             one = dict(self.items())
 *             if not isinstance(other, dict):
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "lxml/etree.pyx":2717
 *     def __richcmp__(self, other, int op):
 *         try:
 *             one = dict(self.items())             # <<<<<<<<<<<<<<
 *             if not isinstance(other, dict):
 *                 other = dict(other)
*/
      __pyx_t_5 = NULL;
      __pyx_t_7 = ((PyObject *)__pyx_v_self);
      __Pyx_INCREF(__pyx_t_7);
      __pyx_t_8 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_7, NULL};
        __pyx_t_6 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_items, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2717, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_6);
      }
      __pyx_t_8 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_6};
        __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(&PyDict_Type), __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2717, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_4);
      }
      __pyx_v_one = ((PyObject*)__pyx_t_4);
      __pyx_t_4 = 0;

      /* "lxml/etree.pyx":2718
 *         try:
 *             one = dict(self.items())
 *             if not isinstance(other, dict):             # <<<<<<<<<<<<<<
 *                 other = dict(other)
 *         except (TypeError, ValueError):
*/
      __pyx_t_9 = PyDict_Check(__pyx_v_other); 
      __pyx_t_10 = (!__pyx_t_9);
      if (__pyx_t_10) {

        /* "lxml/etree.pyx":2719
 *             one = dict(self.items())
 *             if not isinstance(other, dict):
 *                 other = dict(other)             # <<<<<<<<<<<<<<
 *         except (TypeError, ValueError):
 *             return NotImplemented
*/
        __pyx_t_6 = NULL;
        __pyx_t_8 = 1;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_v_other};
          __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(&PyDict_Type), __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2719, __pyx_L3_error)
          __Pyx_GOTREF(__pyx_t_4);
        }
        __Pyx_DECREF_SET(__pyx_v_other, __pyx_t_4);
        __pyx_t_4 = 0;

        /* "lxml/etree.pyx":2718
 *         try:
 *             one = dict(self.items())
 *             if not isinstance(other, dict):             # <<<<<<<<<<<<<<
 *                 other = dict(other)
 *         except (TypeError, ValueError):
*/
      }

      /* "lxml/etree.pyx":2716
 * 
 *     def __richcmp__(self, other, int op):
 *         try:             # <<<<<<<<<<<<<<
 *             one = dict(self.items())
 *             if not isinstance(other, dict):
*/
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "lxml/etree.pyx":2720
 *             if not isinstance(other, dict):
 *                 other = dict(other)
 *         except (TypeError, ValueError):             # <<<<<<<<<<<<<<
 *             return NotImplemented
 *         return python.PyObject_RichCompare(one, other, op)
*/
    __pyx_t_11 = __Pyx_PyErr_ExceptionMatches2(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), ((PyObject *)(((PyTypeObject*)PyExc_ValueError))));
    if (__pyx_t_11) {
      __Pyx_AddTraceback("lxml.etree._Attrib.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_5) < 0) __PYX_ERR(0, 2720, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_5);

      /* "lxml/etree.pyx":2721
 *                 other = dict(other)
 *         except (TypeError, ValueError):
 *             return NotImplemented             # <<<<<<<<<<<<<<
 *         return python.PyObject_RichCompare(one, other, op)
 * 
*/
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_builtin_NotImplemented);
      __pyx_r = __pyx_builtin_NotImplemented;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L6_except_return;
    }
    goto __pyx_L5_except_error;

    /* "lxml/etree.pyx":2716
 * 
 *     def __richcmp__(self, other, int op):
 *         try:             # <<<<<<<<<<<<<<
 *             one = dict(self.items())
 *             if not isinstance(other, dict):
*/
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L8_try_end:;
  }

  /* "lxml/etree.pyx":2722
 *         except (TypeError, ValueError):
 *             return NotImplemented
 *         return python.PyObject_RichCompare(one, other, op)             # <<<<<<<<<<<<<<
 * 
 * MutableMapping.register(_Attrib)
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = PyObject_RichCompare(__pyx_v_one, __pyx_v_other, __pyx_v_op); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2722, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":2715
 *         return 1 if tree.xmlHasNsProp(c_node, _xcstr(tag), c_href) else 0
 * 
 *     def __richcmp__(self, other, int op):             # <<<<<<<<<<<<<<
 *         try:
 *             one = dict(self.items())
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree._Attrib.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_one);
  __Pyx_XDECREF(__pyx_v_other);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2736
 *     cdef xmlAttr* _c_attr
 *     cdef int _keysvalues # 1 - keys, 2 - values, 3 - items (key, value)
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_15_AttribIterator_1__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_15_AttribIterator_1__iter__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_15_AttribIterator___iter__(((struct __pyx_obj_4lxml_5etree__AttribIterator *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_15_AttribIterator___iter__(struct __pyx_obj_4lxml_5etree__AttribIterator *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "lxml/etree.pyx":2737
 *     cdef int _keysvalues # 1 - keys, 2 - values, 3 - items (key, value)
 *     def __iter__(self):
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __next__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "lxml/etree.pyx":2736
 *     cdef xmlAttr* _c_attr
 *     cdef int _keysvalues # 1 - keys, 2 - values, 3 - items (key, value)
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2739
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         cdef xmlAttr* c_attr
 *         if self._node is None:
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_15_AttribIterator_3__next__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_15_AttribIterator_3__next__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_15_AttribIterator_2__next__(((struct __pyx_obj_4lxml_5etree__AttribIterator *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_15_AttribIterator_2__next__(struct __pyx_obj_4lxml_5etree__AttribIterator *__pyx_v_self) {
  xmlAttr *__pyx_v_c_attr;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_error_without_exception = 0; /* StopIteration */
  int __pyx_t_1;
  xmlAttr *__pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__next__", 0);

  /* "lxml/etree.pyx":2741
 *     def __next__(self):
 *         cdef xmlAttr* c_attr
 *         if self._node is None:             # <<<<<<<<<<<<<<
 *             raise StopIteration
 *         c_attr = self._c_attr
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_self->_node) == Py_None);
  if (unlikely(__pyx_t_1)) {

    /* "lxml/etree.pyx":2742
 *         cdef xmlAttr* c_attr
 *         if self._node is None:
 *             raise StopIteration             # <<<<<<<<<<<<<<
 *         c_attr = self._c_attr
 *         while c_attr is not NULL and c_attr.type != tree.XML_ATTRIBUTE_NODE:
*/
    __pyx_error_without_exception = 1;
    goto __pyx_L1_error;;

    /* "lxml/etree.pyx":2741
 *     def __next__(self):
 *         cdef xmlAttr* c_attr
 *         if self._node is None:             # <<<<<<<<<<<<<<
 *             raise StopIteration
 *         c_attr = self._c_attr
*/
  }

  /* "lxml/etree.pyx":2743
 *         if self._node is None:
 *             raise StopIteration
 *         c_attr = self._c_attr             # <<<<<<<<<<<<<<
 *         while c_attr is not NULL and c_attr.type != tree.XML_ATTRIBUTE_NODE:
 *             c_attr = c_attr.next
*/
  __pyx_t_2 = __pyx_v_self->_c_attr;
  __pyx_v_c_attr = __pyx_t_2;

  /* "lxml/etree.pyx":2744
 *             raise StopIteration
 *         c_attr = self._c_attr
 *         while c_attr is not NULL and c_attr.type != tree.XML_ATTRIBUTE_NODE:             # <<<<<<<<<<<<<<
 *             c_attr = c_attr.next
 *         if c_attr is NULL:
*/
  while (1) {
    __pyx_t_3 = (__pyx_v_c_attr != NULL);
    if (__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_3 = (__pyx_v_c_attr->type != XML_ATTRIBUTE_NODE);
    __pyx_t_1 = __pyx_t_3;
    __pyx_L6_bool_binop_done:;
    if (!__pyx_t_1) break;

    /* "lxml/etree.pyx":2745
 *         c_attr = self._c_attr
 *         while c_attr is not NULL and c_attr.type != tree.XML_ATTRIBUTE_NODE:
 *             c_attr = c_attr.next             # <<<<<<<<<<<<<<
 *         if c_attr is NULL:
 *             self._node = None
*/
    __pyx_t_2 = __pyx_v_c_attr->next;
    __pyx_v_c_attr = __pyx_t_2;
  }

  /* "lxml/etree.pyx":2746
 *         while c_attr is not NULL and c_attr.type != tree.XML_ATTRIBUTE_NODE:
 *             c_attr = c_attr.next
 *         if c_attr is NULL:             # <<<<<<<<<<<<<<
 *             self._node = None
 *             raise StopIteration
*/
  __pyx_t_1 = (__pyx_v_c_attr == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "lxml/etree.pyx":2747
 *             c_attr = c_attr.next
 *         if c_attr is NULL:
 *             self._node = None             # <<<<<<<<<<<<<<
 *             raise StopIteration
 * 
*/
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF((PyObject *)__pyx_v_self->_node);
    __Pyx_DECREF((PyObject *)__pyx_v_self->_node);
    __pyx_v_self->_node = ((struct LxmlElement *)Py_None);

    /* "lxml/etree.pyx":2748
 *         if c_attr is NULL:
 *             self._node = None
 *             raise StopIteration             # <<<<<<<<<<<<<<
 * 
 *         self._c_attr = c_attr.next
*/
    __pyx_error_without_exception = 1;
    goto __pyx_L1_error;;

    /* "lxml/etree.pyx":2746
 *         while c_attr is not NULL and c_attr.type != tree.XML_ATTRIBUTE_NODE:
 *             c_attr = c_attr.next
 *         if c_attr is NULL:             # <<<<<<<<<<<<<<
 *             self._node = None
 *             raise StopIteration
*/
  }

  /* "lxml/etree.pyx":2750
 *             raise StopIteration
 * 
 *         self._c_attr = c_attr.next             # <<<<<<<<<<<<<<
 *         if self._keysvalues == 1:
 *             return _namespacedName(<xmlNode*>c_attr)
*/
  __pyx_t_2 = __pyx_v_c_attr->next;
  __pyx_v_self->_c_attr = __pyx_t_2;

  /* "lxml/etree.pyx":2751
 * 
 *         self._c_attr = c_attr.next
 *         if self._keysvalues == 1:             # <<<<<<<<<<<<<<
 *             return _namespacedName(<xmlNode*>c_attr)
 *         elif self._keysvalues == 2:
*/
  switch (__pyx_v_self->_keysvalues) {
    case 1:

    /* "lxml/etree.pyx":2752
 *         self._c_attr = c_attr.next
 *         if self._keysvalues == 1:
 *             return _namespacedName(<xmlNode*>c_attr)             # <<<<<<<<<<<<<<
 *         elif self._keysvalues == 2:
 *             return _attributeValue(self._node._c_node, c_attr)
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __pyx_f_4lxml_5etree__namespacedName(((xmlNode *)__pyx_v_c_attr)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2752, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;

    /* "lxml/etree.pyx":2751
 * 
 *         self._c_attr = c_attr.next
 *         if self._keysvalues == 1:             # <<<<<<<<<<<<<<
 *             return _namespacedName(<xmlNode*>c_attr)
 *         elif self._keysvalues == 2:
*/
    break;
    case 2:

    /* "lxml/etree.pyx":2754
 *             return _namespacedName(<xmlNode*>c_attr)
 *         elif self._keysvalues == 2:
 *             return _attributeValue(self._node._c_node, c_attr)             # <<<<<<<<<<<<<<
 *         else:
 *             return (_namespacedName(<xmlNode*>c_attr),
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __pyx_f_4lxml_5etree__attributeValue(__pyx_v_self->_node->_c_node, __pyx_v_c_attr); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2754, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;

    /* "lxml/etree.pyx":2753
 *         if self._keysvalues == 1:
 *             return _namespacedName(<xmlNode*>c_attr)
 *         elif self._keysvalues == 2:             # <<<<<<<<<<<<<<
 *             return _attributeValue(self._node._c_node, c_attr)
 *         else:
*/
    break;
    default:

    /* "lxml/etree.pyx":2756
 *             return _attributeValue(self._node._c_node, c_attr)
 *         else:
 *             return (_namespacedName(<xmlNode*>c_attr),             # <<<<<<<<<<<<<<
 *                     _attributeValue(self._node._c_node, c_attr))
 * 
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __pyx_f_4lxml_5etree__namespacedName(((xmlNode *)__pyx_v_c_attr)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2756, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);

    /* "lxml/etree.pyx":2757
 *         else:
 *             return (_namespacedName(<xmlNode*>c_attr),
 *                     _attributeValue(self._node._c_node, c_attr))             # <<<<<<<<<<<<<<
 * 
 * cdef object _attributeIteratorFactory(_Element element, int keysvalues):
*/
    __pyx_t_5 = __pyx_f_4lxml_5etree__attributeValue(__pyx_v_self->_node->_c_node, __pyx_v_c_attr); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2757, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);

    /* "lxml/etree.pyx":2756
 *             return _attributeValue(self._node._c_node, c_attr)
 *         else:
 *             return (_namespacedName(<xmlNode*>c_attr),             # <<<<<<<<<<<<<<
 *                     _attributeValue(self._node._c_node, c_attr))
 * 
*/
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2756, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_4);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4) != (0)) __PYX_ERR(0, 2756, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_5);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5) != (0)) __PYX_ERR(0, 2756, __pyx_L1_error);
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    goto __pyx_L0;
    break;
  }

  /* "lxml/etree.pyx":2739
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         cdef xmlAttr* c_attr
 *         if self._node is None:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  if (!__pyx_error_without_exception) {
    __Pyx_AddTraceback("lxml.etree._AttribIterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2759
 *                     _attributeValue(self._node._c_node, c_attr))
 * 
 * cdef object _attributeIteratorFactory(_Element element, int keysvalues):             # <<<<<<<<<<<<<<
 *     cdef _AttribIterator attribs
 *     if element._c_node.properties is NULL:
*/

static PyObject *__pyx_f_4lxml_5etree__attributeIteratorFactory(struct LxmlElement *__pyx_v_element, int __pyx_v_keysvalues) {
  struct __pyx_obj_4lxml_5etree__AttribIterator *__pyx_v_attribs = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  xmlAttr *__pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_attributeIteratorFactory", 0);

  /* "lxml/etree.pyx":2761
 * cdef object _attributeIteratorFactory(_Element element, int keysvalues):
 *     cdef _AttribIterator attribs
 *     if element._c_node.properties is NULL:             # <<<<<<<<<<<<<<
 *         return ITER_EMPTY
 *     attribs = _AttribIterator()
*/
  __pyx_t_1 = (__pyx_v_element->_c_node->properties == NULL);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":2762
 *     cdef _AttribIterator attribs
 *     if element._c_node.properties is NULL:
 *         return ITER_EMPTY             # <<<<<<<<<<<<<<
 *     attribs = _AttribIterator()
 *     attribs._node = element
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_4lxml_5etree_ITER_EMPTY);
    __pyx_r = __pyx_v_4lxml_5etree_ITER_EMPTY;
    goto __pyx_L0;

    /* "lxml/etree.pyx":2761
 * cdef object _attributeIteratorFactory(_Element element, int keysvalues):
 *     cdef _AttribIterator attribs
 *     if element._c_node.properties is NULL:             # <<<<<<<<<<<<<<
 *         return ITER_EMPTY
 *     attribs = _AttribIterator()
*/
  }

  /* "lxml/etree.pyx":2763
 *     if element._c_node.properties is NULL:
 *         return ITER_EMPTY
 *     attribs = _AttribIterator()             # <<<<<<<<<<<<<<
 *     attribs._node = element
 *     attribs._c_attr = element._c_node.properties
*/
  __pyx_t_3 = NULL;
  __pyx_t_4 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__AttribIterator, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2763, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_2);
  }
  __pyx_v_attribs = ((struct __pyx_obj_4lxml_5etree__AttribIterator *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "lxml/etree.pyx":2764
 *         return ITER_EMPTY
 *     attribs = _AttribIterator()
 *     attribs._node = element             # <<<<<<<<<<<<<<
 *     attribs._c_attr = element._c_node.properties
 *     attribs._keysvalues = keysvalues
*/
  __Pyx_INCREF((PyObject *)__pyx_v_element);
  __Pyx_GIVEREF((PyObject *)__pyx_v_element);
  __Pyx_GOTREF((PyObject *)__pyx_v_attribs->_node);
  __Pyx_DECREF((PyObject *)__pyx_v_attribs->_node);
  __pyx_v_attribs->_node = __pyx_v_element;

  /* "lxml/etree.pyx":2765
 *     attribs = _AttribIterator()
 *     attribs._node = element
 *     attribs._c_attr = element._c_node.properties             # <<<<<<<<<<<<<<
 *     attribs._keysvalues = keysvalues
 *     return attribs
*/
  __pyx_t_5 = __pyx_v_element->_c_node->properties;
  __pyx_v_attribs->_c_attr = __pyx_t_5;

  /* "lxml/etree.pyx":2766
 *     attribs._node = element
 *     attribs._c_attr = element._c_node.properties
 *     attribs._keysvalues = keysvalues             # <<<<<<<<<<<<<<
 *     return attribs
 * 
*/
  __pyx_v_attribs->_keysvalues = __pyx_v_keysvalues;

  /* "lxml/etree.pyx":2767
 *     attribs._c_attr = element._c_node.properties
 *     attribs._keysvalues = keysvalues
 *     return attribs             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_attribs);
  __pyx_r = ((PyObject *)__pyx_v_attribs);
  goto __pyx_L0;

  /* "lxml/etree.pyx":2759
 *                     _attributeValue(self._node._c_node, c_attr))
 * 
 * cdef object _attributeIteratorFactory(_Element element, int keysvalues):             # <<<<<<<<<<<<<<
 *     cdef _AttribIterator attribs
 *     if element._c_node.properties is NULL:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._attributeIteratorFactory", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_attribs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2779
 *     cdef char* _href
 *     cdef char* _name
 *     cdef _initTagMatch(self, tag):             # <<<<<<<<<<<<<<
 *         self._href = NULL
 *         self._name = NULL
*/

static PyObject *__pyx_f_4lxml_5etree_18_ElementTagMatcher__initTagMatch(struct LxmlElementTagMatcher *__pyx_v_self, PyObject *__pyx_v_tag) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_initTagMatch", 0);

  /* "lxml/etree.pyx":2780
 *     cdef char* _name
 *     cdef _initTagMatch(self, tag):
 *         self._href = NULL             # <<<<<<<<<<<<<<
 *         self._name = NULL
 *         if tag is None:
*/
  __pyx_v_self->_href = NULL;

  /* "lxml/etree.pyx":2781
 *     cdef _initTagMatch(self, tag):
 *         self._href = NULL
 *         self._name = NULL             # <<<<<<<<<<<<<<
 *         if tag is None:
 *             self._node_type = 0
*/
  __pyx_v_self->_name = NULL;

  /* "lxml/etree.pyx":2782
 *         self._href = NULL
 *         self._name = NULL
 *         if tag is None:             # <<<<<<<<<<<<<<
 *             self._node_type = 0
 *         elif tag is Comment:
*/
  __pyx_t_1 = (__pyx_v_tag == Py_None);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":2783
 *         self._name = NULL
 *         if tag is None:
 *             self._node_type = 0             # <<<<<<<<<<<<<<
 *         elif tag is Comment:
 *             self._node_type = tree.XML_COMMENT_NODE
*/
    __pyx_v_self->_node_type = 0;

    /* "lxml/etree.pyx":2782
 *         self._href = NULL
 *         self._name = NULL
 *         if tag is None:             # <<<<<<<<<<<<<<
 *             self._node_type = 0
 *         elif tag is Comment:
*/
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":2784
 *         if tag is None:
 *             self._node_type = 0
 *         elif tag is Comment:             # <<<<<<<<<<<<<<
 *             self._node_type = tree.XML_COMMENT_NODE
 *         elif tag is ProcessingInstruction:
*/
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_Comment); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2784, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = (__pyx_v_tag == __pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":2785
 *             self._node_type = 0
 *         elif tag is Comment:
 *             self._node_type = tree.XML_COMMENT_NODE             # <<<<<<<<<<<<<<
 *         elif tag is ProcessingInstruction:
 *             self._node_type = tree.XML_PI_NODE
*/
    __pyx_v_self->_node_type = XML_COMMENT_NODE;

    /* "lxml/etree.pyx":2784
 *         if tag is None:
 *             self._node_type = 0
 *         elif tag is Comment:             # <<<<<<<<<<<<<<
 *             self._node_type = tree.XML_COMMENT_NODE
 *         elif tag is ProcessingInstruction:
*/
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":2786
 *         elif tag is Comment:
 *             self._node_type = tree.XML_COMMENT_NODE
 *         elif tag is ProcessingInstruction:             # <<<<<<<<<<<<<<
 *             self._node_type = tree.XML_PI_NODE
 *         elif tag is Entity:
*/
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_ProcessingInstruction); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2786, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = (__pyx_v_tag == __pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":2787
 *             self._node_type = tree.XML_COMMENT_NODE
 *         elif tag is ProcessingInstruction:
 *             self._node_type = tree.XML_PI_NODE             # <<<<<<<<<<<<<<
 *         elif tag is Entity:
 *             self._node_type = tree.XML_ENTITY_REF_NODE
*/
    __pyx_v_self->_node_type = XML_PI_NODE;

    /* "lxml/etree.pyx":2786
 *         elif tag is Comment:
 *             self._node_type = tree.XML_COMMENT_NODE
 *         elif tag is ProcessingInstruction:             # <<<<<<<<<<<<<<
 *             self._node_type = tree.XML_PI_NODE
 *         elif tag is Entity:
*/
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":2788
 *         elif tag is ProcessingInstruction:
 *             self._node_type = tree.XML_PI_NODE
 *         elif tag is Entity:             # <<<<<<<<<<<<<<
 *             self._node_type = tree.XML_ENTITY_REF_NODE
 *         elif tag is Element:
*/
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_Entity); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2788, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = (__pyx_v_tag == __pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":2789
 *             self._node_type = tree.XML_PI_NODE
 *         elif tag is Entity:
 *             self._node_type = tree.XML_ENTITY_REF_NODE             # <<<<<<<<<<<<<<
 *         elif tag is Element:
 *             self._node_type = tree.XML_ELEMENT_NODE
*/
    __pyx_v_self->_node_type = XML_ENTITY_REF_NODE;

    /* "lxml/etree.pyx":2788
 *         elif tag is ProcessingInstruction:
 *             self._node_type = tree.XML_PI_NODE
 *         elif tag is Entity:             # <<<<<<<<<<<<<<
 *             self._node_type = tree.XML_ENTITY_REF_NODE
 *         elif tag is Element:
*/
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":2790
 *         elif tag is Entity:
 *             self._node_type = tree.XML_ENTITY_REF_NODE
 *         elif tag is Element:             # <<<<<<<<<<<<<<
 *             self._node_type = tree.XML_ELEMENT_NODE
 *         else:
*/
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_Element_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2790, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = (__pyx_v_tag == __pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":2791
 *             self._node_type = tree.XML_ENTITY_REF_NODE
 *         elif tag is Element:
 *             self._node_type = tree.XML_ELEMENT_NODE             # <<<<<<<<<<<<<<
 *         else:
 *             self._node_type = tree.XML_ELEMENT_NODE
*/
    __pyx_v_self->_node_type = XML_ELEMENT_NODE;

    /* "lxml/etree.pyx":2790
 *         elif tag is Entity:
 *             self._node_type = tree.XML_ENTITY_REF_NODE
 *         elif tag is Element:             # <<<<<<<<<<<<<<
 *             self._node_type = tree.XML_ELEMENT_NODE
 *         else:
*/
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":2793
 *             self._node_type = tree.XML_ELEMENT_NODE
 *         else:
 *             self._node_type = tree.XML_ELEMENT_NODE             # <<<<<<<<<<<<<<
 *             self._pystrings = _getNsTag(tag)
 *             if self._pystrings[0] is not None:
*/
  /*else*/ {
    __pyx_v_self->_node_type = XML_ELEMENT_NODE;

    /* "lxml/etree.pyx":2794
 *         else:
 *             self._node_type = tree.XML_ELEMENT_NODE
 *             self._pystrings = _getNsTag(tag)             # <<<<<<<<<<<<<<
 *             if self._pystrings[0] is not None:
 *                 self._href = _cstr(self._pystrings[0])
*/
    __pyx_t_2 = __pyx_f_4lxml_5etree__getNsTag(__pyx_v_tag); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2794, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_GOTREF(__pyx_v_self->_pystrings);
    __Pyx_DECREF(__pyx_v_self->_pystrings);
    __pyx_v_self->_pystrings = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "lxml/etree.pyx":2795
 *             self._node_type = tree.XML_ELEMENT_NODE
 *             self._pystrings = _getNsTag(tag)
 *             if self._pystrings[0] is not None:             # <<<<<<<<<<<<<<
 *                 self._href = _cstr(self._pystrings[0])
 *             self._name = _cstr(self._pystrings[1])
*/
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_self->_pystrings, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2795, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = (__pyx_t_2 != Py_None);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_1) {

      /* "lxml/etree.pyx":2796
 *             self._pystrings = _getNsTag(tag)
 *             if self._pystrings[0] is not None:
 *                 self._href = _cstr(self._pystrings[0])             # <<<<<<<<<<<<<<
 *             self._name = _cstr(self._pystrings[1])
 *             if self._name[0] == c'*' and self._name[1] == c'\0':
*/
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_self->_pystrings, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2796, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_v_self->_href = PyBytes_AS_STRING(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "lxml/etree.pyx":2795
 *             self._node_type = tree.XML_ELEMENT_NODE
 *             self._pystrings = _getNsTag(tag)
 *             if self._pystrings[0] is not None:             # <<<<<<<<<<<<<<
 *                 self._href = _cstr(self._pystrings[0])
 *             self._name = _cstr(self._pystrings[1])
*/
    }

    /* "lxml/etree.pyx":2797
 *             if self._pystrings[0] is not None:
 *                 self._href = _cstr(self._pystrings[0])
 *             self._name = _cstr(self._pystrings[1])             # <<<<<<<<<<<<<<
 *             if self._name[0] == c'*' and self._name[1] == c'\0':
 *                 self._name = NULL
*/
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_self->_pystrings, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2797, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_self->_name = PyBytes_AS_STRING(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "lxml/etree.pyx":2798
 *                 self._href = _cstr(self._pystrings[0])
 *             self._name = _cstr(self._pystrings[1])
 *             if self._name[0] == c'*' and self._name[1] == c'\0':             # <<<<<<<<<<<<<<
 *                 self._name = NULL
 * 
*/
    __pyx_t_3 = ((__pyx_v_self->_name[0]) == '*');
    if (__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_3 = ((__pyx_v_self->_name[1]) == '\x00');
    __pyx_t_1 = __pyx_t_3;
    __pyx_L6_bool_binop_done:;
    if (__pyx_t_1) {

      /* "lxml/etree.pyx":2799
 *             self._name = _cstr(self._pystrings[1])
 *             if self._name[0] == c'*' and self._name[1] == c'\0':
 *                 self._name = NULL             # <<<<<<<<<<<<<<
 * 
 * cdef public class _ElementIterator(_ElementTagMatcher) [
*/
      __pyx_v_self->_name = NULL;

      /* "lxml/etree.pyx":2798
 *                 self._href = _cstr(self._pystrings[0])
 *             self._name = _cstr(self._pystrings[1])
 *             if self._name[0] == c'*' and self._name[1] == c'\0':             # <<<<<<<<<<<<<<
 *                 self._name = NULL
 * 
*/
    }
  }
  __pyx_L3:;

  /* "lxml/etree.pyx":2779
 *     cdef char* _href
 *     cdef char* _name
 *     cdef _initTagMatch(self, tag):             # <<<<<<<<<<<<<<
 *         self._href = NULL
 *         self._name = NULL
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ElementTagMatcher._initTagMatch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2809
 *     cdef _Element _node
 *     cdef _node_to_node_function _next_element
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_16_ElementIterator_1__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_16_ElementIterator_1__iter__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_16_ElementIterator___iter__(((struct LxmlElementIterator *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_16_ElementIterator___iter__(struct LxmlElementIterator *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "lxml/etree.pyx":2810
 *     cdef _node_to_node_function _next_element
 *     def __iter__(self):
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     cdef void _storeNext(self, _Element node):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "lxml/etree.pyx":2809
 *     cdef _Element _node
 *     cdef _node_to_node_function _next_element
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2812
 *         return self
 * 
 *     cdef void _storeNext(self, _Element node):             # <<<<<<<<<<<<<<
 *         cdef xmlNode* c_node
 *         c_node = self._next_element(node._c_node)
*/

static void __pyx_f_4lxml_5etree_16_ElementIterator__storeNext(struct LxmlElementIterator *__pyx_v_self, struct LxmlElement *__pyx_v_node) {
  xmlNode *__pyx_v_c_node;
  __Pyx_RefNannyDeclarations
  xmlNode *__pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_storeNext", 0);

  /* "lxml/etree.pyx":2814
 *     cdef void _storeNext(self, _Element node):
 *         cdef xmlNode* c_node
 *         c_node = self._next_element(node._c_node)             # <<<<<<<<<<<<<<
 *         while c_node is not NULL and \
 *                   self._node_type != 0 and \
*/
  __pyx_t_1 = __pyx_v_self->_next_element(__pyx_v_node->_c_node); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2814, __pyx_L1_error)
  __pyx_v_c_node = __pyx_t_1;

  /* "lxml/etree.pyx":2815
 *         cdef xmlNode* c_node
 *         c_node = self._next_element(node._c_node)
 *         while c_node is not NULL and \             # <<<<<<<<<<<<<<
 *                   self._node_type != 0 and \
 *                   (<tree.xmlElementType>self._node_type != c_node.type or
*/
  while (1) {
    __pyx_t_3 = (__pyx_v_c_node != NULL);
    if (__pyx_t_3) {
    } else {
      __pyx_t_2 = __pyx_t_3;
      goto __pyx_L5_bool_binop_done;
    }

    /* "lxml/etree.pyx":2816
 *         c_node = self._next_element(node._c_node)
 *         while c_node is not NULL and \
 *                   self._node_type != 0 and \             # <<<<<<<<<<<<<<
 *                   (<tree.xmlElementType>self._node_type != c_node.type or
 *                    not _tagMatches(c_node, <const_xmlChar*>self._href, <const_xmlChar*>self._name)):
*/
    __pyx_t_3 = (__pyx_v_self->__pyx_base._node_type != 0);
    if (__pyx_t_3) {
    } else {
      __pyx_t_2 = __pyx_t_3;
      goto __pyx_L5_bool_binop_done;
    }

    /* "lxml/etree.pyx":2817
 *         while c_node is not NULL and \
 *                   self._node_type != 0 and \
 *                   (<tree.xmlElementType>self._node_type != c_node.type or             # <<<<<<<<<<<<<<
 *                    not _tagMatches(c_node, <const_xmlChar*>self._href, <const_xmlChar*>self._name)):
 *             c_node = self._next_element(c_node)
*/
    __pyx_t_3 = (((xmlElementType)__pyx_v_self->__pyx_base._node_type) != __pyx_v_c_node->type);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_2 = __pyx_t_3;
      goto __pyx_L5_bool_binop_done;
    }

    /* "lxml/etree.pyx":2818
 *                   self._node_type != 0 and \
 *                   (<tree.xmlElementType>self._node_type != c_node.type or
 *                    not _tagMatches(c_node, <const_xmlChar*>self._href, <const_xmlChar*>self._name)):             # <<<<<<<<<<<<<<
 *             c_node = self._next_element(c_node)
 *         if c_node is NULL:
*/
    __pyx_t_3 = (!__pyx_f_4lxml_5etree__tagMatches(__pyx_v_c_node, ((const xmlChar *)__pyx_v_self->__pyx_base._href), ((const xmlChar *)__pyx_v_self->__pyx_base._name)));
    __pyx_t_2 = __pyx_t_3;
    __pyx_L5_bool_binop_done:;
    if (!__pyx_t_2) break;

    /* "lxml/etree.pyx":2819
 *                   (<tree.xmlElementType>self._node_type != c_node.type or
 *                    not _tagMatches(c_node, <const_xmlChar*>self._href, <const_xmlChar*>self._name)):
 *             c_node = self._next_element(c_node)             # <<<<<<<<<<<<<<
 *         if c_node is NULL:
 *             self._node = None
*/
    __pyx_t_1 = __pyx_v_self->_next_element(__pyx_v_c_node); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2819, __pyx_L1_error)
    __pyx_v_c_node = __pyx_t_1;
  }

  /* "lxml/etree.pyx":2820
 *                    not _tagMatches(c_node, <const_xmlChar*>self._href, <const_xmlChar*>self._name)):
 *             c_node = self._next_element(c_node)
 *         if c_node is NULL:             # <<<<<<<<<<<<<<
 *             self._node = None
 *         else:
*/
  __pyx_t_2 = (__pyx_v_c_node == NULL);
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":2821
 *             c_node = self._next_element(c_node)
 *         if c_node is NULL:
 *             self._node = None             # <<<<<<<<<<<<<<
 *         else:
 *             # Python ref:
*/
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF((PyObject *)__pyx_v_self->_node);
    __Pyx_DECREF((PyObject *)__pyx_v_self->_node);
    __pyx_v_self->_node = ((struct LxmlElement *)Py_None);

    /* "lxml/etree.pyx":2820
 *                    not _tagMatches(c_node, <const_xmlChar*>self._href, <const_xmlChar*>self._name)):
 *             c_node = self._next_element(c_node)
 *         if c_node is NULL:             # <<<<<<<<<<<<<<
 *             self._node = None
 *         else:
*/
    goto __pyx_L9;
  }

  /* "lxml/etree.pyx":2824
 *         else:
 *             # Python ref:
 *             self._node = _elementFactory(node._doc, c_node)             # <<<<<<<<<<<<<<
 * 
 *     def __next__(self):
*/
  /*else*/ {
    __pyx_t_4 = ((PyObject *)__pyx_v_node->_doc);
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_5 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_4), __pyx_v_c_node)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2824, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GIVEREF(__pyx_t_5);
    __Pyx_GOTREF((PyObject *)__pyx_v_self->_node);
    __Pyx_DECREF((PyObject *)__pyx_v_self->_node);
    __pyx_v_self->_node = ((struct LxmlElement *)__pyx_t_5);
    __pyx_t_5 = 0;
  }
  __pyx_L9:;

  /* "lxml/etree.pyx":2812
 *         return self
 * 
 *     cdef void _storeNext(self, _Element node):             # <<<<<<<<<<<<<<
 *         cdef xmlNode* c_node
 *         c_node = self._next_element(node._c_node)
*/

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._ElementIterator._storeNext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "lxml/etree.pyx":2826
 *             self._node = _elementFactory(node._doc, c_node)
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         cdef xmlNode* c_node
 *         cdef _Element current_node
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_16_ElementIterator_3__next__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_16_ElementIterator_3__next__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_16_ElementIterator_2__next__(((struct LxmlElementIterator *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_16_ElementIterator_2__next__(struct LxmlElementIterator *__pyx_v_self) {
  struct LxmlElement *__pyx_v_current_node = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_error_without_exception = 0; /* StopIteration */
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__next__", 0);

  /* "lxml/etree.pyx":2829
 *         cdef xmlNode* c_node
 *         cdef _Element current_node
 *         if self._node is None:             # <<<<<<<<<<<<<<
 *             raise StopIteration
 *         # Python ref:
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_self->_node) == Py_None);
  if (unlikely(__pyx_t_1)) {

    /* "lxml/etree.pyx":2830
 *         cdef _Element current_node
 *         if self._node is None:
 *             raise StopIteration             # <<<<<<<<<<<<<<
 *         # Python ref:
 *         current_node = self._node
*/
    __pyx_error_without_exception = 1;
    goto __pyx_L1_error;;

    /* "lxml/etree.pyx":2829
 *         cdef xmlNode* c_node
 *         cdef _Element current_node
 *         if self._node is None:             # <<<<<<<<<<<<<<
 *             raise StopIteration
 *         # Python ref:
*/
  }

  /* "lxml/etree.pyx":2832
 *             raise StopIteration
 *         # Python ref:
 *         current_node = self._node             # <<<<<<<<<<<<<<
 *         self._storeNext(current_node)
 *         return current_node
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self->_node);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_current_node = ((struct LxmlElement *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "lxml/etree.pyx":2833
 *         # Python ref:
 *         current_node = self._node
 *         self._storeNext(current_node)             # <<<<<<<<<<<<<<
 *         return current_node
 * 
*/
  ((struct __pyx_vtabstruct_4lxml_5etree__ElementIterator *)__pyx_v_self->__pyx_base.__pyx_vtab)->_storeNext(__pyx_v_self, __pyx_v_current_node); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2833, __pyx_L1_error)

  /* "lxml/etree.pyx":2834
 *         current_node = self._node
 *         self._storeNext(current_node)
 *         return current_node             # <<<<<<<<<<<<<<
 * 
 * @cython.final
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_current_node);
  __pyx_r = ((PyObject *)__pyx_v_current_node);
  goto __pyx_L0;

  /* "lxml/etree.pyx":2826
 *             self._node = _elementFactory(node._doc, c_node)
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         cdef xmlNode* c_node
 *         cdef _Element current_node
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  if (!__pyx_error_without_exception) {
    __Pyx_AddTraceback("lxml.etree._ElementIterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_current_node);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2849
 *     cdef int _node_types
 * 
 *     def __cinit__(self, tags):             # <<<<<<<<<<<<<<
 *         self._py_tags = []
 *         self.initTagMatch(tags)
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_16_MultiTagMatcher_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_16_MultiTagMatcher_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_tags = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_tags,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 2849, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2849, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__cinit__", 0) < (0)) __PYX_ERR(0, 2849, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, i); __PYX_ERR(0, 2849, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2849, __pyx_L3_error)
    }
    __pyx_v_tags = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2849, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._MultiTagMatcher.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_16_MultiTagMatcher___cinit__(((struct __pyx_obj_4lxml_5etree__MultiTagMatcher *)__pyx_v_self), __pyx_v_tags);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_16_MultiTagMatcher___cinit__(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *__pyx_v_self, PyObject *__pyx_v_tags) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "lxml/etree.pyx":2850
 * 
 *     def __cinit__(self, tags):
 *         self._py_tags = []             # <<<<<<<<<<<<<<
 *         self.initTagMatch(tags)
 * 
*/
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2850, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_py_tags);
  __Pyx_DECREF(__pyx_v_self->_py_tags);
  __pyx_v_self->_py_tags = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "lxml/etree.pyx":2851
 *     def __cinit__(self, tags):
 *         self._py_tags = []
 *         self.initTagMatch(tags)             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_16_MultiTagMatcher_initTagMatch(__pyx_v_self, __pyx_v_tags); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2851, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":2849
 *     cdef int _node_types
 * 
 *     def __cinit__(self, tags):             # <<<<<<<<<<<<<<
 *         self._py_tags = []
 *         self.initTagMatch(tags)
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._MultiTagMatcher.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2853
 *         self.initTagMatch(tags)
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         self._clear()
 * 
*/

/* Python wrapper */
static void __pyx_pw_4lxml_5etree_16_MultiTagMatcher_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_4lxml_5etree_16_MultiTagMatcher_3__dealloc__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_pf_4lxml_5etree_16_MultiTagMatcher_2__dealloc__(((struct __pyx_obj_4lxml_5etree__MultiTagMatcher *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_4lxml_5etree_16_MultiTagMatcher_2__dealloc__(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *__pyx_v_self) {

  /* "lxml/etree.pyx":2854
 * 
 *     def __dealloc__(self):
 *         self._clear()             # <<<<<<<<<<<<<<
 * 
 *     cdef bint rejectsAll(self) noexcept:
*/
  __pyx_f_4lxml_5etree_16_MultiTagMatcher__clear(__pyx_v_self);

  /* "lxml/etree.pyx":2853
 *         self.initTagMatch(tags)
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         self._clear()
 * 
*/

  /* function exit code */
}

/* "lxml/etree.pyx":2856
 *         self._clear()
 * 
 *     cdef bint rejectsAll(self) noexcept:             # <<<<<<<<<<<<<<
 *         return not self._tag_count and not self._node_types
 * 
*/

static int __pyx_f_4lxml_5etree_16_MultiTagMatcher_rejectsAll(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *__pyx_v_self) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;

  /* "lxml/etree.pyx":2857
 * 
 *     cdef bint rejectsAll(self) noexcept:
 *         return not self._tag_count and not self._node_types             # <<<<<<<<<<<<<<
 * 
 *     cdef bint rejectsAllAttributes(self) noexcept:
*/
  __pyx_t_2 = (!(__pyx_v_self->_tag_count != 0));
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L3_bool_binop_done;
  }
  __pyx_t_2 = (!(__pyx_v_self->_node_types != 0));
  __pyx_t_1 = __pyx_t_2;
  __pyx_L3_bool_binop_done:;
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  /* "lxml/etree.pyx":2856
 *         self._clear()
 * 
 *     cdef bint rejectsAll(self) noexcept:             # <<<<<<<<<<<<<<
 *         return not self._tag_count and not self._node_types
 * 
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "lxml/etree.pyx":2859
 *         return not self._tag_count and not self._node_types
 * 
 *     cdef bint rejectsAllAttributes(self) noexcept:             # <<<<<<<<<<<<<<
 *         return not self._tag_count
 * 
*/

static int __pyx_f_4lxml_5etree_16_MultiTagMatcher_rejectsAllAttributes(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *__pyx_v_self) {
  int __pyx_r;

  /* "lxml/etree.pyx":2860
 * 
 *     cdef bint rejectsAllAttributes(self) noexcept:
 *         return not self._tag_count             # <<<<<<<<<<<<<<
 * 
 *     cdef bint matchesType(self, int node_type) noexcept:
*/
  __pyx_r = (!(__pyx_v_self->_tag_count != 0));
  goto __pyx_L0;

  /* "lxml/etree.pyx":2859
 *         return not self._tag_count and not self._node_types
 * 
 *     cdef bint rejectsAllAttributes(self) noexcept:             # <<<<<<<<<<<<<<
 *         return not self._tag_count
 * 
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "lxml/etree.pyx":2862
 *         return not self._tag_count
 * 
 *     cdef bint matchesType(self, int node_type) noexcept:             # <<<<<<<<<<<<<<
 *         if node_type == tree.XML_ELEMENT_NODE and self._tag_count:
 *             return True
*/

static int __pyx_f_4lxml_5etree_16_MultiTagMatcher_matchesType(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *__pyx_v_self, int __pyx_v_node_type) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;

  /* "lxml/etree.pyx":2863
 * 
 *     cdef bint matchesType(self, int node_type) noexcept:
 *         if node_type == tree.XML_ELEMENT_NODE and self._tag_count:             # <<<<<<<<<<<<<<
 *             return True
 *         return self._node_types & (1 << node_type)
*/
  __pyx_t_2 = (__pyx_v_node_type == XML_ELEMENT_NODE);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_self->_tag_count != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":2864
 *     cdef bint matchesType(self, int node_type) noexcept:
 *         if node_type == tree.XML_ELEMENT_NODE and self._tag_count:
 *             return True             # <<<<<<<<<<<<<<
 *         return self._node_types & (1 << node_type)
 * 
*/
    __pyx_r = 1;
    goto __pyx_L0;

    /* "lxml/etree.pyx":2863
 * 
 *     cdef bint matchesType(self, int node_type) noexcept:
 *         if node_type == tree.XML_ELEMENT_NODE and self._tag_count:             # <<<<<<<<<<<<<<
 *             return True
 *         return self._node_types & (1 << node_type)
*/
  }

  /* "lxml/etree.pyx":2865
 *         if node_type == tree.XML_ELEMENT_NODE and self._tag_count:
 *             return True
 *         return self._node_types & (1 << node_type)             # <<<<<<<<<<<<<<
 * 
 *     cdef void _clear(self) noexcept:
*/
  __pyx_r = (__pyx_v_self->_node_types & (1 << __pyx_v_node_type));
  goto __pyx_L0;

  /* "lxml/etree.pyx":2862
 *         return not self._tag_count
 * 
 *     cdef bint matchesType(self, int node_type) noexcept:             # <<<<<<<<<<<<<<
 *         if node_type == tree.XML_ELEMENT_NODE and self._tag_count:
 *             return True
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "lxml/etree.pyx":2867
 *         return self._node_types & (1 << node_type)
 * 
 *     cdef void _clear(self) noexcept:             # <<<<<<<<<<<<<<
 *         cdef size_t i, count
 *         count = self._tag_count
*/

static void __pyx_f_4lxml_5etree_16_MultiTagMatcher__clear(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *__pyx_v_self) {
  size_t __pyx_v_i;
  size_t __pyx_v_count;
  size_t __pyx_t_1;
  int __pyx_t_2;
  size_t __pyx_t_3;
  size_t __pyx_t_4;

  /* "lxml/etree.pyx":2869
 *     cdef void _clear(self) noexcept:
 *         cdef size_t i, count
 *         count = self._tag_count             # <<<<<<<<<<<<<<
 *         self._tag_count = 0
 *         if self._cached_tags:
*/
  __pyx_t_1 = __pyx_v_self->_tag_count;
  __pyx_v_count = __pyx_t_1;

  /* "lxml/etree.pyx":2870
 *         cdef size_t i, count
 *         count = self._tag_count
 *         self._tag_count = 0             # <<<<<<<<<<<<<<
 *         if self._cached_tags:
 *             for i in range(count):
*/
  __pyx_v_self->_tag_count = 0;

  /* "lxml/etree.pyx":2871
 *         count = self._tag_count
 *         self._tag_count = 0
 *         if self._cached_tags:             # <<<<<<<<<<<<<<
 *             for i in range(count):
 *                 cpython.ref.Py_XDECREF(self._cached_tags[i].href)
*/
  __pyx_t_2 = (__pyx_v_self->_cached_tags != 0);
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":2872
 *         self._tag_count = 0
 *         if self._cached_tags:
 *             for i in range(count):             # <<<<<<<<<<<<<<
 *                 cpython.ref.Py_XDECREF(self._cached_tags[i].href)
 *             python.lxml_free(self._cached_tags)
*/
    __pyx_t_1 = __pyx_v_count;
    __pyx_t_3 = __pyx_t_1;
    for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
      __pyx_v_i = __pyx_t_4;

      /* "lxml/etree.pyx":2873
 *         if self._cached_tags:
 *             for i in range(count):
 *                 cpython.ref.Py_XDECREF(self._cached_tags[i].href)             # <<<<<<<<<<<<<<
 *             python.lxml_free(self._cached_tags)
 *             self._cached_tags = NULL
*/
      Py_XDECREF((__pyx_v_self->_cached_tags[__pyx_v_i]).href);
    }

    /* "lxml/etree.pyx":2874
 *             for i in range(count):
 *                 cpython.ref.Py_XDECREF(self._cached_tags[i].href)
 *             python.lxml_free(self._cached_tags)             # <<<<<<<<<<<<<<
 *             self._cached_tags = NULL
 * 
*/
    lxml_free(__pyx_v_self->_cached_tags);

    /* "lxml/etree.pyx":2875
 *                 cpython.ref.Py_XDECREF(self._cached_tags[i].href)
 *             python.lxml_free(self._cached_tags)
 *             self._cached_tags = NULL             # <<<<<<<<<<<<<<
 * 
 *     cdef initTagMatch(self, tags):
*/
    __pyx_v_self->_cached_tags = NULL;

    /* "lxml/etree.pyx":2871
 *         count = self._tag_count
 *         self._tag_count = 0
 *         if self._cached_tags:             # <<<<<<<<<<<<<<
 *             for i in range(count):
 *                 cpython.ref.Py_XDECREF(self._cached_tags[i].href)
*/
  }

  /* "lxml/etree.pyx":2867
 *         return self._node_types & (1 << node_type)
 * 
 *     cdef void _clear(self) noexcept:             # <<<<<<<<<<<<<<
 *         cdef size_t i, count
 *         count = self._tag_count
*/

  /* function exit code */
}

/* "lxml/etree.pyx":2877
 *             self._cached_tags = NULL
 * 
 *     cdef initTagMatch(self, tags):             # <<<<<<<<<<<<<<
 *         self._cached_doc = None
 *         del self._py_tags[:]
*/

static PyObject *__pyx_f_4lxml_5etree_16_MultiTagMatcher_initTagMatch(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *__pyx_v_self, PyObject *__pyx_v_tags) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("initTagMatch", 0);

  /* "lxml/etree.pyx":2878
 * 
 *     cdef initTagMatch(self, tags):
 *         self._cached_doc = None             # <<<<<<<<<<<<<<
 *         del self._py_tags[:]
 *         self._clear()
*/
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_cached_doc);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_cached_doc);
  __pyx_v_self->_cached_doc = ((struct LxmlDocument *)Py_None);

  /* "lxml/etree.pyx":2879
 *     cdef initTagMatch(self, tags):
 *         self._cached_doc = None
 *         del self._py_tags[:]             # <<<<<<<<<<<<<<
 *         self._clear()
 *         if tags is None or tags == ():
*/
  if (unlikely(__pyx_v_self->_py_tags == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 2879, __pyx_L1_error)
  }
  if (__Pyx_PyObject_DelSlice(__pyx_v_self->_py_tags, 0, 0, NULL, NULL, NULL, 0, 0, 1) < (0)) __PYX_ERR(0, 2879, __pyx_L1_error)

  /* "lxml/etree.pyx":2880
 *         self._cached_doc = None
 *         del self._py_tags[:]
 *         self._clear()             # <<<<<<<<<<<<<<
 *         if tags is None or tags == ():
 *             # no selection in tags argument => match anything
*/
  __pyx_f_4lxml_5etree_16_MultiTagMatcher__clear(__pyx_v_self);

  /* "lxml/etree.pyx":2881
 *         del self._py_tags[:]
 *         self._clear()
 *         if tags is None or tags == ():             # <<<<<<<<<<<<<<
 *             # no selection in tags argument => match anything
 *             self._node_types = (
*/
  __pyx_t_2 = (__pyx_v_tags == Py_None);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = PyObject_RichCompare(__pyx_v_tags, __pyx_mstate_global->__pyx_empty_tuple, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2881, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 2881, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":2883
 *         if tags is None or tags == ():
 *             # no selection in tags argument => match anything
 *             self._node_types = (             # <<<<<<<<<<<<<<
 *                 1 << tree.XML_COMMENT_NODE |
 *                 1 << tree.XML_PI_NODE |
*/
    __pyx_v_self->_node_types = ((((1 << XML_COMMENT_NODE) | (1 << XML_PI_NODE)) | (1 << XML_ENTITY_REF_NODE)) | (1 << XML_ELEMENT_NODE));

    /* "lxml/etree.pyx":2881
 *         del self._py_tags[:]
 *         self._clear()
 *         if tags is None or tags == ():             # <<<<<<<<<<<<<<
 *             # no selection in tags argument => match anything
 *             self._node_types = (
*/
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":2889
 *                 1 << tree.XML_ELEMENT_NODE)
 *         else:
 *             self._node_types = 0             # <<<<<<<<<<<<<<
 *             self._storeTags(tags, set())
 * 
*/
  /*else*/ {
    __pyx_v_self->_node_types = 0;

    /* "lxml/etree.pyx":2890
 *         else:
 *             self._node_types = 0
 *             self._storeTags(tags, set())             # <<<<<<<<<<<<<<
 * 
 *     cdef _storeTags(self, tag, set seen):
*/
    __pyx_t_3 = PySet_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2890, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __pyx_f_4lxml_5etree_16_MultiTagMatcher__storeTags(__pyx_v_self, __pyx_v_tags, ((PyObject*)__pyx_t_3)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2890, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_L3:;

  /* "lxml/etree.pyx":2877
 *             self._cached_tags = NULL
 * 
 *     cdef initTagMatch(self, tags):             # <<<<<<<<<<<<<<
 *         self._cached_doc = None
 *         del self._py_tags[:]
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._MultiTagMatcher.initTagMatch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2892
 *             self._storeTags(tags, set())
 * 
 *     cdef _storeTags(self, tag, set seen):             # <<<<<<<<<<<<<<
 *         if tag is Comment:
 *             self._node_types |= 1 << tree.XML_COMMENT_NODE
*/

static PyObject *__pyx_f_4lxml_5etree_16_MultiTagMatcher__storeTags(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_seen) {
  PyObject *__pyx_v_href = NULL;
  PyObject *__pyx_v_name = NULL;
  PyObject *__pyx_v_item = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  PyObject *(*__pyx_t_8)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_storeTags", 0);

  /* "lxml/etree.pyx":2893
 * 
 *     cdef _storeTags(self, tag, set seen):
 *         if tag is Comment:             # <<<<<<<<<<<<<<
 *             self._node_types |= 1 << tree.XML_COMMENT_NODE
 *         elif tag is ProcessingInstruction:
*/
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_Comment); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2893, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__pyx_v_tag == __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":2894
 *     cdef _storeTags(self, tag, set seen):
 *         if tag is Comment:
 *             self._node_types |= 1 << tree.XML_COMMENT_NODE             # <<<<<<<<<<<<<<
 *         elif tag is ProcessingInstruction:
 *             self._node_types |= 1 << tree.XML_PI_NODE
*/
    __pyx_v_self->_node_types = (__pyx_v_self->_node_types | (1 << XML_COMMENT_NODE));

    /* "lxml/etree.pyx":2893
 * 
 *     cdef _storeTags(self, tag, set seen):
 *         if tag is Comment:             # <<<<<<<<<<<<<<
 *             self._node_types |= 1 << tree.XML_COMMENT_NODE
 *         elif tag is ProcessingInstruction:
*/
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":2895
 *         if tag is Comment:
 *             self._node_types |= 1 << tree.XML_COMMENT_NODE
 *         elif tag is ProcessingInstruction:             # <<<<<<<<<<<<<<
 *             self._node_types |= 1 << tree.XML_PI_NODE
 *         elif tag is Entity:
*/
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_ProcessingInstruction); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2895, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__pyx_v_tag == __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":2896
 *             self._node_types |= 1 << tree.XML_COMMENT_NODE
 *         elif tag is ProcessingInstruction:
 *             self._node_types |= 1 << tree.XML_PI_NODE             # <<<<<<<<<<<<<<
 *         elif tag is Entity:
 *             self._node_types |= 1 << tree.XML_ENTITY_REF_NODE
*/
    __pyx_v_self->_node_types = (__pyx_v_self->_node_types | (1 << XML_PI_NODE));

    /* "lxml/etree.pyx":2895
 *         if tag is Comment:
 *             self._node_types |= 1 << tree.XML_COMMENT_NODE
 *         elif tag is ProcessingInstruction:             # <<<<<<<<<<<<<<
 *             self._node_types |= 1 << tree.XML_PI_NODE
 *         elif tag is Entity:
*/
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":2897
 *         elif tag is ProcessingInstruction:
 *             self._node_types |= 1 << tree.XML_PI_NODE
 *         elif tag is Entity:             # <<<<<<<<<<<<<<
 *             self._node_types |= 1 << tree.XML_ENTITY_REF_NODE
 *         elif tag is Element:
*/
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_Entity); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2897, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__pyx_v_tag == __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":2898
 *             self._node_types |= 1 << tree.XML_PI_NODE
 *         elif tag is Entity:
 *             self._node_types |= 1 << tree.XML_ENTITY_REF_NODE             # <<<<<<<<<<<<<<
 *         elif tag is Element:
 *             self._node_types |= 1 << tree.XML_ELEMENT_NODE
*/
    __pyx_v_self->_node_types = (__pyx_v_self->_node_types | (1 << XML_ENTITY_REF_NODE));

    /* "lxml/etree.pyx":2897
 *         elif tag is ProcessingInstruction:
 *             self._node_types |= 1 << tree.XML_PI_NODE
 *         elif tag is Entity:             # <<<<<<<<<<<<<<
 *             self._node_types |= 1 << tree.XML_ENTITY_REF_NODE
 *         elif tag is Element:
*/
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":2899
 *         elif tag is Entity:
 *             self._node_types |= 1 << tree.XML_ENTITY_REF_NODE
 *         elif tag is Element:             # <<<<<<<<<<<<<<
 *             self._node_types |= 1 << tree.XML_ELEMENT_NODE
 *         elif python._isString(tag):
*/
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_Element_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2899, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__pyx_v_tag == __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":2900
 *             self._node_types |= 1 << tree.XML_ENTITY_REF_NODE
 *         elif tag is Element:
 *             self._node_types |= 1 << tree.XML_ELEMENT_NODE             # <<<<<<<<<<<<<<
 *         elif python._isString(tag):
 *             if tag in seen:
*/
    __pyx_v_self->_node_types = (__pyx_v_self->_node_types | (1 << XML_ELEMENT_NODE));

    /* "lxml/etree.pyx":2899
 *         elif tag is Entity:
 *             self._node_types |= 1 << tree.XML_ENTITY_REF_NODE
 *         elif tag is Element:             # <<<<<<<<<<<<<<
 *             self._node_types |= 1 << tree.XML_ELEMENT_NODE
 *         elif python._isString(tag):
*/
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":2901
 *         elif tag is Element:
 *             self._node_types |= 1 << tree.XML_ELEMENT_NODE
 *         elif python._isString(tag):             # <<<<<<<<<<<<<<
 *             if tag in seen:
 *                 return
*/
  __pyx_t_2 = _isString(__pyx_v_tag);
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":2902
 *             self._node_types |= 1 << tree.XML_ELEMENT_NODE
 *         elif python._isString(tag):
 *             if tag in seen:             # <<<<<<<<<<<<<<
 *                 return
 *             seen.add(tag)
*/
    if (unlikely(__pyx_v_seen == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
      __PYX_ERR(0, 2902, __pyx_L1_error)
    }
    __pyx_t_2 = (__Pyx_PySet_ContainsTF(__pyx_v_tag, __pyx_v_seen, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 2902, __pyx_L1_error)
    if (__pyx_t_2) {

      /* "lxml/etree.pyx":2903
 *         elif python._isString(tag):
 *             if tag in seen:
 *                 return             # <<<<<<<<<<<<<<
 *             seen.add(tag)
 *             if tag in ('*', '{*}*'):
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;

      /* "lxml/etree.pyx":2902
 *             self._node_types |= 1 << tree.XML_ELEMENT_NODE
 *         elif python._isString(tag):
 *             if tag in seen:             # <<<<<<<<<<<<<<
 *                 return
 *             seen.add(tag)
*/
    }

    /* "lxml/etree.pyx":2904
 *             if tag in seen:
 *                 return
 *             seen.add(tag)             # <<<<<<<<<<<<<<
 *             if tag in ('*', '{*}*'):
 *                 self._node_types |= 1 << tree.XML_ELEMENT_NODE
*/
    if (unlikely(__pyx_v_seen == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "add");
      __PYX_ERR(0, 2904, __pyx_L1_error)
    }
    __pyx_t_3 = PySet_Add(__pyx_v_seen, __pyx_v_tag); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 2904, __pyx_L1_error)

    /* "lxml/etree.pyx":2905
 *                 return
 *             seen.add(tag)
 *             if tag in ('*', '{*}*'):             # <<<<<<<<<<<<<<
 *                 self._node_types |= 1 << tree.XML_ELEMENT_NODE
 *             else:
*/
    __Pyx_INCREF(__pyx_v_tag);
    __pyx_t_1 = __pyx_v_tag;
    __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_mstate_global->__pyx_kp_u__24, Py_EQ)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 2905, __pyx_L1_error)
    if (!__pyx_t_4) {
    } else {
      __pyx_t_2 = __pyx_t_4;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_mstate_global->__pyx_kp_u__25, Py_EQ)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 2905, __pyx_L1_error)
    __pyx_t_2 = __pyx_t_4;
    __pyx_L6_bool_binop_done:;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_4 = __pyx_t_2;
    if (__pyx_t_4) {

      /* "lxml/etree.pyx":2906
 *             seen.add(tag)
 *             if tag in ('*', '{*}*'):
 *                 self._node_types |= 1 << tree.XML_ELEMENT_NODE             # <<<<<<<<<<<<<<
 *             else:
 *                 href, name = _getNsTag(tag)
*/
      __pyx_v_self->_node_types = (__pyx_v_self->_node_types | (1 << XML_ELEMENT_NODE));

      /* "lxml/etree.pyx":2905
 *                 return
 *             seen.add(tag)
 *             if tag in ('*', '{*}*'):             # <<<<<<<<<<<<<<
 *                 self._node_types |= 1 << tree.XML_ELEMENT_NODE
 *             else:
*/
      goto __pyx_L5;
    }

    /* "lxml/etree.pyx":2908
 *                 self._node_types |= 1 << tree.XML_ELEMENT_NODE
 *             else:
 *                 href, name = _getNsTag(tag)             # <<<<<<<<<<<<<<
 *                 if name == b'*':
 *                     name = None
*/
    /*else*/ {
      __pyx_t_1 = __pyx_f_4lxml_5etree__getNsTag(__pyx_v_tag); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2908, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (likely(__pyx_t_1 != Py_None)) {
        PyObject* sequence = __pyx_t_1;
        Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(0, 2908, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0);
        __Pyx_INCREF(__pyx_t_5);
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1);
        __Pyx_INCREF(__pyx_t_6);
        #else
        __pyx_t_5 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2908, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2908, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        #endif
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      } else {
        __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 2908, __pyx_L1_error)
      }
      __pyx_v_href = __pyx_t_5;
      __pyx_t_5 = 0;
      __pyx_v_name = __pyx_t_6;
      __pyx_t_6 = 0;

      /* "lxml/etree.pyx":2909
 *             else:
 *                 href, name = _getNsTag(tag)
 *                 if name == b'*':             # <<<<<<<<<<<<<<
 *                     name = None
 *                 if href is None:
*/
      __pyx_t_4 = (__Pyx_PyBytes_Equals(__pyx_v_name, __pyx_mstate_global->__pyx_kp_b__24, Py_EQ)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 2909, __pyx_L1_error)
      if (__pyx_t_4) {

        /* "lxml/etree.pyx":2910
 *                 href, name = _getNsTag(tag)
 *                 if name == b'*':
 *                     name = None             # <<<<<<<<<<<<<<
 *                 if href is None:
 *                     href = b''  # no namespace
*/
        __Pyx_INCREF(Py_None);
        __Pyx_DECREF_SET(__pyx_v_name, Py_None);

        /* "lxml/etree.pyx":2909
 *             else:
 *                 href, name = _getNsTag(tag)
 *                 if name == b'*':             # <<<<<<<<<<<<<<
 *                     name = None
 *                 if href is None:
*/
      }

      /* "lxml/etree.pyx":2911
 *                 if name == b'*':
 *                     name = None
 *                 if href is None:             # <<<<<<<<<<<<<<
 *                     href = b''  # no namespace
 *                 elif href == b'*':
*/
      __pyx_t_4 = (__pyx_v_href == Py_None);
      if (__pyx_t_4) {

        /* "lxml/etree.pyx":2912
 *                     name = None
 *                 if href is None:
 *                     href = b''  # no namespace             # <<<<<<<<<<<<<<
 *                 elif href == b'*':
 *                     href = None  # wildcard: any namespace, including none
*/
        __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_b__8);
        __Pyx_DECREF_SET(__pyx_v_href, __pyx_mstate_global->__pyx_kp_b__8);

        /* "lxml/etree.pyx":2911
 *                 if name == b'*':
 *                     name = None
 *                 if href is None:             # <<<<<<<<<<<<<<
 *                     href = b''  # no namespace
 *                 elif href == b'*':
*/
        goto __pyx_L9;
      }

      /* "lxml/etree.pyx":2913
 *                 if href is None:
 *                     href = b''  # no namespace
 *                 elif href == b'*':             # <<<<<<<<<<<<<<
 *                     href = None  # wildcard: any namespace, including none
 *                 self._py_tags.append((href, name))
*/
      __pyx_t_4 = (__Pyx_PyBytes_Equals(__pyx_v_href, __pyx_mstate_global->__pyx_kp_b__24, Py_EQ)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 2913, __pyx_L1_error)
      if (__pyx_t_4) {

        /* "lxml/etree.pyx":2914
 *                     href = b''  # no namespace
 *                 elif href == b'*':
 *                     href = None  # wildcard: any namespace, including none             # <<<<<<<<<<<<<<
 *                 self._py_tags.append((href, name))
 *         elif isinstance(tag, QName):
*/
        __Pyx_INCREF(Py_None);
        __Pyx_DECREF_SET(__pyx_v_href, Py_None);

        /* "lxml/etree.pyx":2913
 *                 if href is None:
 *                     href = b''  # no namespace
 *                 elif href == b'*':             # <<<<<<<<<<<<<<
 *                     href = None  # wildcard: any namespace, including none
 *                 self._py_tags.append((href, name))
*/
      }
      __pyx_L9:;

      /* "lxml/etree.pyx":2915
 *                 elif href == b'*':
 *                     href = None  # wildcard: any namespace, including none
 *                 self._py_tags.append((href, name))             # <<<<<<<<<<<<<<
 *         elif isinstance(tag, QName):
 *             self._storeTags(tag.text, seen)
*/
      if (unlikely(__pyx_v_self->_py_tags == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
        __PYX_ERR(0, 2915, __pyx_L1_error)
      }
      __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2915, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_v_href);
      __Pyx_GIVEREF(__pyx_v_href);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_href) != (0)) __PYX_ERR(0, 2915, __pyx_L1_error);
      __Pyx_INCREF(__pyx_v_name);
      __Pyx_GIVEREF(__pyx_v_name);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_name) != (0)) __PYX_ERR(0, 2915, __pyx_L1_error);
      __pyx_t_3 = __Pyx_PyList_Append(__pyx_v_self->_py_tags, __pyx_t_1); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 2915, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __pyx_L5:;

    /* "lxml/etree.pyx":2901
 *         elif tag is Element:
 *             self._node_types |= 1 << tree.XML_ELEMENT_NODE
 *         elif python._isString(tag):             # <<<<<<<<<<<<<<
 *             if tag in seen:
 *                 return
*/
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":2916
 *                     href = None  # wildcard: any namespace, including none
 *                 self._py_tags.append((href, name))
 *         elif isinstance(tag, QName):             # <<<<<<<<<<<<<<
 *             self._storeTags(tag.text, seen)
 *         else:
*/
  __pyx_t_4 = __Pyx_TypeCheck(__pyx_v_tag, __pyx_mstate_global->__pyx_ptype_4lxml_5etree_QName); 
  if (__pyx_t_4) {

    /* "lxml/etree.pyx":2917
 *                 self._py_tags.append((href, name))
 *         elif isinstance(tag, QName):
 *             self._storeTags(tag.text, seen)             # <<<<<<<<<<<<<<
 *         else:
 *             # support a sequence of tags
*/
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_tag, __pyx_mstate_global->__pyx_n_u_text); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2917, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = __pyx_f_4lxml_5etree_16_MultiTagMatcher__storeTags(__pyx_v_self, __pyx_t_1, __pyx_v_seen); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2917, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "lxml/etree.pyx":2916
 *                     href = None  # wildcard: any namespace, including none
 *                 self._py_tags.append((href, name))
 *         elif isinstance(tag, QName):             # <<<<<<<<<<<<<<
 *             self._storeTags(tag.text, seen)
 *         else:
*/
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":2920
 *         else:
 *             # support a sequence of tags
 *             for item in tag:             # <<<<<<<<<<<<<<
 *                 self._storeTags(item, seen)
 * 
*/
  /*else*/ {
    if (likely(PyList_CheckExact(__pyx_v_tag)) || PyTuple_CheckExact(__pyx_v_tag)) {
      __pyx_t_6 = __pyx_v_tag; __Pyx_INCREF(__pyx_t_6);
      __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
    } else {
      __pyx_t_7 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_tag); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2920, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2920, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_8)) {
        if (likely(PyList_CheckExact(__pyx_t_6))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_6);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 2920, __pyx_L1_error)
            #endif
            if (__pyx_t_7 >= __pyx_temp) break;
          }
          __pyx_t_1 = __Pyx_PyList_GetItemRefFast(__pyx_t_6, __pyx_t_7, __Pyx_ReferenceSharing_OwnStrongReference);
          ++__pyx_t_7;
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_6);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 2920, __pyx_L1_error)
            #endif
            if (__pyx_t_7 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_1 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_7));
          #else
          __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_7);
          #endif
          ++__pyx_t_7;
        }
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2920, __pyx_L1_error)
      } else {
        __pyx_t_1 = __pyx_t_8(__pyx_t_6);
        if (unlikely(!__pyx_t_1)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 2920, __pyx_L1_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "lxml/etree.pyx":2921
 *             # support a sequence of tags
 *             for item in tag:
 *                 self._storeTags(item, seen)             # <<<<<<<<<<<<<<
 * 
 *     cdef inline int cacheTags(self, _Document doc, bint force_into_dict=False) except -1:
*/
      __pyx_t_1 = __pyx_f_4lxml_5etree_16_MultiTagMatcher__storeTags(__pyx_v_self, __pyx_v_item, __pyx_v_seen); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2921, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "lxml/etree.pyx":2920
 *         else:
 *             # support a sequence of tags
 *             for item in tag:             # <<<<<<<<<<<<<<
 *                 self._storeTags(item, seen)
 * 
*/
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __pyx_L3:;

  /* "lxml/etree.pyx":2892
 *             self._storeTags(tags, set())
 * 
 *     cdef _storeTags(self, tag, set seen):             # <<<<<<<<<<<<<<
 *         if tag is Comment:
 *             self._node_types |= 1 << tree.XML_COMMENT_NODE
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._MultiTagMatcher._storeTags", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_href);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2923
 *                 self._storeTags(item, seen)
 * 
 *     cdef inline int cacheTags(self, _Document doc, bint force_into_dict=False) except -1:             # <<<<<<<<<<<<<<
 *         """
 *         Look up the tag names in the doc dict to enable string pointer comparisons.
*/

static CYTHON_INLINE int __pyx_f_4lxml_5etree_16_MultiTagMatcher_cacheTags(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *__pyx_v_self, struct LxmlDocument *__pyx_v_doc, struct __pyx_opt_args_4lxml_5etree_16_MultiTagMatcher_cacheTags *__pyx_optional_args) {
  int __pyx_v_force_into_dict = ((int)0);
  size_t __pyx_v_dict_size;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("cacheTags", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_force_into_dict = __pyx_optional_args->force_into_dict;
    }
  }

  /* "lxml/etree.pyx":2927
 *         Look up the tag names in the doc dict to enable string pointer comparisons.
 *         """
 *         cdef size_t dict_size = tree.xmlDictSize(doc._c_doc.dict)             # <<<<<<<<<<<<<<
 *         if doc is self._cached_doc and dict_size == self._cached_size:
 *             # doc and dict didn't change => names already cached
*/
  __pyx_v_dict_size = xmlDictSize(__pyx_v_doc->_c_doc->dict);

  /* "lxml/etree.pyx":2928
 *         """
 *         cdef size_t dict_size = tree.xmlDictSize(doc._c_doc.dict)
 *         if doc is self._cached_doc and dict_size == self._cached_size:             # <<<<<<<<<<<<<<
 *             # doc and dict didn't change => names already cached
 *             return 0
*/
  __pyx_t_2 = (__pyx_v_doc == __pyx_v_self->_cached_doc);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_dict_size == __pyx_v_self->_cached_size);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":2930
 *         if doc is self._cached_doc and dict_size == self._cached_size:
 *             # doc and dict didn't change => names already cached
 *             return 0             # <<<<<<<<<<<<<<
 *         self._tag_count = 0
 *         if not self._py_tags:
*/
    __pyx_r = 0;
    goto __pyx_L0;

    /* "lxml/etree.pyx":2928
 *         """
 *         cdef size_t dict_size = tree.xmlDictSize(doc._c_doc.dict)
 *         if doc is self._cached_doc and dict_size == self._cached_size:             # <<<<<<<<<<<<<<
 *             # doc and dict didn't change => names already cached
 *             return 0
*/
  }

  /* "lxml/etree.pyx":2931
 *             # doc and dict didn't change => names already cached
 *             return 0
 *         self._tag_count = 0             # <<<<<<<<<<<<<<
 *         if not self._py_tags:
 *             self._cached_doc = doc
*/
  __pyx_v_self->_tag_count = 0;

  /* "lxml/etree.pyx":2932
 *             return 0
 *         self._tag_count = 0
 *         if not self._py_tags:             # <<<<<<<<<<<<<<
 *             self._cached_doc = doc
 *             self._cached_size = dict_size
*/
  if (__pyx_v_self->_py_tags == Py_None) __pyx_t_1 = 0;
  else
  {
    Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_v_self->_py_tags);
    if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(0, 2932, __pyx_L1_error)
    __pyx_t_1 = (__pyx_temp != 0);
  }

  __pyx_t_2 = (!__pyx_t_1);
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":2933
 *         self._tag_count = 0
 *         if not self._py_tags:
 *             self._cached_doc = doc             # <<<<<<<<<<<<<<
 *             self._cached_size = dict_size
 *             return 0
*/
    __Pyx_INCREF((PyObject *)__pyx_v_doc);
    __Pyx_GIVEREF((PyObject *)__pyx_v_doc);
    __Pyx_GOTREF((PyObject *)__pyx_v_self->_cached_doc);
    __Pyx_DECREF((PyObject *)__pyx_v_self->_cached_doc);
    __pyx_v_self->_cached_doc = __pyx_v_doc;

    /* "lxml/etree.pyx":2934
 *         if not self._py_tags:
 *             self._cached_doc = doc
 *             self._cached_size = dict_size             # <<<<<<<<<<<<<<
 *             return 0
 *         if not self._cached_tags:
*/
    __pyx_v_self->_cached_size = __pyx_v_dict_size;

    /* "lxml/etree.pyx":2935
 *             self._cached_doc = doc
 *             self._cached_size = dict_size
 *             return 0             # <<<<<<<<<<<<<<
 *         if not self._cached_tags:
 *             self._cached_tags = <qname*>python.lxml_malloc(len(self._py_tags), sizeof(qname))
*/
    __pyx_r = 0;
    goto __pyx_L0;

    /* "lxml/etree.pyx":2932
 *             return 0
 *         self._tag_count = 0
 *         if not self._py_tags:             # <<<<<<<<<<<<<<
 *             self._cached_doc = doc
 *             self._cached_size = dict_size
*/
  }

  /* "lxml/etree.pyx":2936
 *             self._cached_size = dict_size
 *             return 0
 *         if not self._cached_tags:             # <<<<<<<<<<<<<<
 *             self._cached_tags = <qname*>python.lxml_malloc(len(self._py_tags), sizeof(qname))
 *             if not self._cached_tags:
*/
  __pyx_t_2 = (!(__pyx_v_self->_cached_tags != 0));
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":2937
 *             return 0
 *         if not self._cached_tags:
 *             self._cached_tags = <qname*>python.lxml_malloc(len(self._py_tags), sizeof(qname))             # <<<<<<<<<<<<<<
 *             if not self._cached_tags:
 *                 self._cached_doc = None
*/
    __pyx_t_3 = __pyx_v_self->_py_tags;
    __Pyx_INCREF(__pyx_t_3);
    if (unlikely(__pyx_t_3 == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
      __PYX_ERR(0, 2937, __pyx_L1_error)
    }
    __pyx_t_4 = __Pyx_PyList_GET_SIZE(__pyx_t_3); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2937, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_self->_cached_tags = ((struct __pyx_t_4lxml_5etree_qname *)lxml_malloc(__pyx_t_4, (sizeof(struct __pyx_t_4lxml_5etree_qname))));

    /* "lxml/etree.pyx":2938
 *         if not self._cached_tags:
 *             self._cached_tags = <qname*>python.lxml_malloc(len(self._py_tags), sizeof(qname))
 *             if not self._cached_tags:             # <<<<<<<<<<<<<<
 *                 self._cached_doc = None
 *                 raise MemoryError()
*/
    __pyx_t_2 = (!(__pyx_v_self->_cached_tags != 0));
    if (unlikely(__pyx_t_2)) {

      /* "lxml/etree.pyx":2939
 *             self._cached_tags = <qname*>python.lxml_malloc(len(self._py_tags), sizeof(qname))
 *             if not self._cached_tags:
 *                 self._cached_doc = None             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 *         self._tag_count = <size_t>_mapTagsToQnameMatchArray(
*/
      __Pyx_INCREF(Py_None);
      __Pyx_GIVEREF(Py_None);
      __Pyx_GOTREF((PyObject *)__pyx_v_self->_cached_doc);
      __Pyx_DECREF((PyObject *)__pyx_v_self->_cached_doc);
      __pyx_v_self->_cached_doc = ((struct LxmlDocument *)Py_None);

      /* "lxml/etree.pyx":2940
 *             if not self._cached_tags:
 *                 self._cached_doc = None
 *                 raise MemoryError()             # <<<<<<<<<<<<<<
 *         self._tag_count = <size_t>_mapTagsToQnameMatchArray(
 *             doc._c_doc, self._py_tags, self._cached_tags, force_into_dict)
*/
      PyErr_NoMemory(); __PYX_ERR(0, 2940, __pyx_L1_error)

      /* "lxml/etree.pyx":2938
 *         if not self._cached_tags:
 *             self._cached_tags = <qname*>python.lxml_malloc(len(self._py_tags), sizeof(qname))
 *             if not self._cached_tags:             # <<<<<<<<<<<<<<
 *                 self._cached_doc = None
 *                 raise MemoryError()
*/
    }

    /* "lxml/etree.pyx":2936
 *             self._cached_size = dict_size
 *             return 0
 *         if not self._cached_tags:             # <<<<<<<<<<<<<<
 *             self._cached_tags = <qname*>python.lxml_malloc(len(self._py_tags), sizeof(qname))
 *             if not self._cached_tags:
*/
  }

  /* "lxml/etree.pyx":2942
 *                 raise MemoryError()
 *         self._tag_count = <size_t>_mapTagsToQnameMatchArray(
 *             doc._c_doc, self._py_tags, self._cached_tags, force_into_dict)             # <<<<<<<<<<<<<<
 *         self._cached_doc = doc
 *         self._cached_size = dict_size
*/
  __pyx_t_3 = __pyx_v_self->_py_tags;
  __Pyx_INCREF(__pyx_t_3);

  /* "lxml/etree.pyx":2941
 *                 self._cached_doc = None
 *                 raise MemoryError()
 *         self._tag_count = <size_t>_mapTagsToQnameMatchArray(             # <<<<<<<<<<<<<<
 *             doc._c_doc, self._py_tags, self._cached_tags, force_into_dict)
 *         self._cached_doc = doc
*/
  __pyx_t_4 = __pyx_f_4lxml_5etree__mapTagsToQnameMatchArray(__pyx_v_doc->_c_doc, ((PyObject*)__pyx_t_3), __pyx_v_self->_cached_tags, __pyx_v_force_into_dict); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1L))) __PYX_ERR(0, 2941, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_self->_tag_count = ((size_t)__pyx_t_4);

  /* "lxml/etree.pyx":2943
 *         self._tag_count = <size_t>_mapTagsToQnameMatchArray(
 *             doc._c_doc, self._py_tags, self._cached_tags, force_into_dict)
 *         self._cached_doc = doc             # <<<<<<<<<<<<<<
 *         self._cached_size = dict_size
 *         return 0
*/
  __Pyx_INCREF((PyObject *)__pyx_v_doc);
  __Pyx_GIVEREF((PyObject *)__pyx_v_doc);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_cached_doc);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_cached_doc);
  __pyx_v_self->_cached_doc = __pyx_v_doc;

  /* "lxml/etree.pyx":2944
 *             doc._c_doc, self._py_tags, self._cached_tags, force_into_dict)
 *         self._cached_doc = doc
 *         self._cached_size = dict_size             # <<<<<<<<<<<<<<
 *         return 0
 * 
*/
  __pyx_v_self->_cached_size = __pyx_v_dict_size;

  /* "lxml/etree.pyx":2945
 *         self._cached_doc = doc
 *         self._cached_size = dict_size
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     cdef inline bint matches(self, xmlNode* c_node) noexcept:
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":2923
 *                 self._storeTags(item, seen)
 * 
 *     cdef inline int cacheTags(self, _Document doc, bint force_into_dict=False) except -1:             # <<<<<<<<<<<<<<
 *         """
 *         Look up the tag names in the doc dict to enable string pointer comparisons.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._MultiTagMatcher.cacheTags", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2947
 *         return 0
 * 
 *     cdef inline bint matches(self, xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *         cdef qname* c_qname
 *         if self._node_types & (1 << c_node.type):
*/

static CYTHON_INLINE int __pyx_f_4lxml_5etree_16_MultiTagMatcher_matches(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *__pyx_v_self, xmlNode *__pyx_v_c_node) {
  struct __pyx_t_4lxml_5etree_qname *__pyx_v_c_qname;
  int __pyx_r;
  int __pyx_t_1;
  struct __pyx_t_4lxml_5etree_qname *__pyx_t_2;
  struct __pyx_t_4lxml_5etree_qname *__pyx_t_3;
  struct __pyx_t_4lxml_5etree_qname *__pyx_t_4;

  /* "lxml/etree.pyx":2949
 *     cdef inline bint matches(self, xmlNode* c_node) noexcept:
 *         cdef qname* c_qname
 *         if self._node_types & (1 << c_node.type):             # <<<<<<<<<<<<<<
 *             return True
 *         elif c_node.type == tree.XML_ELEMENT_NODE:
*/
  __pyx_t_1 = ((__pyx_v_self->_node_types & (1 << __pyx_v_c_node->type)) != 0);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":2950
 *         cdef qname* c_qname
 *         if self._node_types & (1 << c_node.type):
 *             return True             # <<<<<<<<<<<<<<
 *         elif c_node.type == tree.XML_ELEMENT_NODE:
 *             for c_qname in self._cached_tags[:self._tag_count]:
*/
    __pyx_r = 1;
    goto __pyx_L0;

    /* "lxml/etree.pyx":2949
 *     cdef inline bint matches(self, xmlNode* c_node) noexcept:
 *         cdef qname* c_qname
 *         if self._node_types & (1 << c_node.type):             # <<<<<<<<<<<<<<
 *             return True
 *         elif c_node.type == tree.XML_ELEMENT_NODE:
*/
  }

  /* "lxml/etree.pyx":2951
 *         if self._node_types & (1 << c_node.type):
 *             return True
 *         elif c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *             for c_qname in self._cached_tags[:self._tag_count]:
 *                 if _tagMatchesExactly(c_node, c_qname):
*/
  __pyx_t_1 = (__pyx_v_c_node->type == XML_ELEMENT_NODE);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":2952
 *             return True
 *         elif c_node.type == tree.XML_ELEMENT_NODE:
 *             for c_qname in self._cached_tags[:self._tag_count]:             # <<<<<<<<<<<<<<
 *                 if _tagMatchesExactly(c_node, c_qname):
 *                     return True
*/
    __pyx_t_3 = (__pyx_v_self->_cached_tags + __pyx_v_self->_tag_count);
    for (__pyx_t_4 = __pyx_v_self->_cached_tags; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
      __pyx_t_2 = __pyx_t_4;
      __pyx_v_c_qname = __pyx_t_2;

      /* "lxml/etree.pyx":2953
 *         elif c_node.type == tree.XML_ELEMENT_NODE:
 *             for c_qname in self._cached_tags[:self._tag_count]:
 *                 if _tagMatchesExactly(c_node, c_qname):             # <<<<<<<<<<<<<<
 *                     return True
 *         return False
*/
      __pyx_t_1 = __pyx_f_4lxml_5etree__tagMatchesExactly(__pyx_v_c_node, __pyx_v_c_qname);
      if (__pyx_t_1) {

        /* "lxml/etree.pyx":2954
 *             for c_qname in self._cached_tags[:self._tag_count]:
 *                 if _tagMatchesExactly(c_node, c_qname):
 *                     return True             # <<<<<<<<<<<<<<
 *         return False
 * 
*/
        __pyx_r = 1;
        goto __pyx_L0;

        /* "lxml/etree.pyx":2953
 *         elif c_node.type == tree.XML_ELEMENT_NODE:
 *             for c_qname in self._cached_tags[:self._tag_count]:
 *                 if _tagMatchesExactly(c_node, c_qname):             # <<<<<<<<<<<<<<
 *                     return True
 *         return False
*/
      }
    }

    /* "lxml/etree.pyx":2951
 *         if self._node_types & (1 << c_node.type):
 *             return True
 *         elif c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *             for c_qname in self._cached_tags[:self._tag_count]:
 *                 if _tagMatchesExactly(c_node, c_qname):
*/
  }

  /* "lxml/etree.pyx":2955
 *                 if _tagMatchesExactly(c_node, c_qname):
 *                     return True
 *         return False             # <<<<<<<<<<<<<<
 * 
 *     cdef inline bint matchesNsTag(self, const_xmlChar* c_href,
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":2947
 *         return 0
 * 
 *     cdef inline bint matches(self, xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *         cdef qname* c_qname
 *         if self._node_types & (1 << c_node.type):
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "lxml/etree.pyx":2957
 *         return False
 * 
 *     cdef inline bint matchesNsTag(self, const_xmlChar* c_href,             # <<<<<<<<<<<<<<
 *                                   const_xmlChar* c_name) noexcept:
 *         cdef qname* c_qname
*/

static CYTHON_INLINE int __pyx_f_4lxml_5etree_16_MultiTagMatcher_matchesNsTag(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *__pyx_v_self, const xmlChar *__pyx_v_c_href, const xmlChar *__pyx_v_c_name) {
  struct __pyx_t_4lxml_5etree_qname *__pyx_v_c_qname;
  int __pyx_r;
  int __pyx_t_1;
  struct __pyx_t_4lxml_5etree_qname *__pyx_t_2;
  struct __pyx_t_4lxml_5etree_qname *__pyx_t_3;
  struct __pyx_t_4lxml_5etree_qname *__pyx_t_4;

  /* "lxml/etree.pyx":2960
 *                                   const_xmlChar* c_name) noexcept:
 *         cdef qname* c_qname
 *         if self._node_types & (1 << tree.XML_ELEMENT_NODE):             # <<<<<<<<<<<<<<
 *             return True
 *         for c_qname in self._cached_tags[:self._tag_count]:
*/
  __pyx_t_1 = ((__pyx_v_self->_node_types & (1 << XML_ELEMENT_NODE)) != 0);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":2961
 *         cdef qname* c_qname
 *         if self._node_types & (1 << tree.XML_ELEMENT_NODE):
 *             return True             # <<<<<<<<<<<<<<
 *         for c_qname in self._cached_tags[:self._tag_count]:
 *             if _nsTagMatchesExactly(c_href, c_name, c_qname):
*/
    __pyx_r = 1;
    goto __pyx_L0;

    /* "lxml/etree.pyx":2960
 *                                   const_xmlChar* c_name) noexcept:
 *         cdef qname* c_qname
 *         if self._node_types & (1 << tree.XML_ELEMENT_NODE):             # <<<<<<<<<<<<<<
 *             return True
 *         for c_qname in self._cached_tags[:self._tag_count]:
*/
  }

  /* "lxml/etree.pyx":2962
 *         if self._node_types & (1 << tree.XML_ELEMENT_NODE):
 *             return True
 *         for c_qname in self._cached_tags[:self._tag_count]:             # <<<<<<<<<<<<<<
 *             if _nsTagMatchesExactly(c_href, c_name, c_qname):
 *                 return True
*/
  __pyx_t_3 = (__pyx_v_self->_cached_tags + __pyx_v_self->_tag_count);
  for (__pyx_t_4 = __pyx_v_self->_cached_tags; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
    __pyx_t_2 = __pyx_t_4;
    __pyx_v_c_qname = __pyx_t_2;

    /* "lxml/etree.pyx":2963
 *             return True
 *         for c_qname in self._cached_tags[:self._tag_count]:
 *             if _nsTagMatchesExactly(c_href, c_name, c_qname):             # <<<<<<<<<<<<<<
 *                 return True
 *         return False
*/
    __pyx_t_1 = __pyx_f_4lxml_5etree__nsTagMatchesExactly(__pyx_v_c_href, __pyx_v_c_name, __pyx_v_c_qname);
    if (__pyx_t_1) {

      /* "lxml/etree.pyx":2964
 *         for c_qname in self._cached_tags[:self._tag_count]:
 *             if _nsTagMatchesExactly(c_href, c_name, c_qname):
 *                 return True             # <<<<<<<<<<<<<<
 *         return False
 * 
*/
      __pyx_r = 1;
      goto __pyx_L0;

      /* "lxml/etree.pyx":2963
 *             return True
 *         for c_qname in self._cached_tags[:self._tag_count]:
 *             if _nsTagMatchesExactly(c_href, c_name, c_qname):             # <<<<<<<<<<<<<<
 *                 return True
 *         return False
*/
    }
  }

  /* "lxml/etree.pyx":2965
 *             if _nsTagMatchesExactly(c_href, c_name, c_qname):
 *                 return True
 *         return False             # <<<<<<<<<<<<<<
 * 
 *     cdef inline bint matchesAttribute(self, xmlAttr* c_attr) noexcept:
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":2957
 *         return False
 * 
 *     cdef inline bint matchesNsTag(self, const_xmlChar* c_href,             # <<<<<<<<<<<<<<
 *                                   const_xmlChar* c_name) noexcept:
 *         cdef qname* c_qname
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "lxml/etree.pyx":2967
 *         return False
 * 
 *     cdef inline bint matchesAttribute(self, xmlAttr* c_attr) noexcept:             # <<<<<<<<<<<<<<
 *         """Attribute matches differ from Element matches in that they do
 *         not care about node types.
*/

static CYTHON_INLINE int __pyx_f_4lxml_5etree_16_MultiTagMatcher_matchesAttribute(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *__pyx_v_self, xmlAttr *__pyx_v_c_attr) {
  struct __pyx_t_4lxml_5etree_qname *__pyx_v_c_qname;
  int __pyx_r;
  struct __pyx_t_4lxml_5etree_qname *__pyx_t_1;
  struct __pyx_t_4lxml_5etree_qname *__pyx_t_2;
  struct __pyx_t_4lxml_5etree_qname *__pyx_t_3;
  int __pyx_t_4;

  /* "lxml/etree.pyx":2972
 *         """
 *         cdef qname* c_qname
 *         for c_qname in self._cached_tags[:self._tag_count]:             # <<<<<<<<<<<<<<
 *             if _tagMatchesExactly(<xmlNode*>c_attr, c_qname):
 *                 return True
*/
  __pyx_t_2 = (__pyx_v_self->_cached_tags + __pyx_v_self->_tag_count);
  for (__pyx_t_3 = __pyx_v_self->_cached_tags; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) {
    __pyx_t_1 = __pyx_t_3;
    __pyx_v_c_qname = __pyx_t_1;

    /* "lxml/etree.pyx":2973
 *         cdef qname* c_qname
 *         for c_qname in self._cached_tags[:self._tag_count]:
 *             if _tagMatchesExactly(<xmlNode*>c_attr, c_qname):             # <<<<<<<<<<<<<<
 *                 return True
 *         return False
*/
    __pyx_t_4 = __pyx_f_4lxml_5etree__tagMatchesExactly(((xmlNode *)__pyx_v_c_attr), __pyx_v_c_qname);
    if (__pyx_t_4) {

      /* "lxml/etree.pyx":2974
 *         for c_qname in self._cached_tags[:self._tag_count]:
 *             if _tagMatchesExactly(<xmlNode*>c_attr, c_qname):
 *                 return True             # <<<<<<<<<<<<<<
 *         return False
 * 
*/
      __pyx_r = 1;
      goto __pyx_L0;

      /* "lxml/etree.pyx":2973
 *         cdef qname* c_qname
 *         for c_qname in self._cached_tags[:self._tag_count]:
 *             if _tagMatchesExactly(<xmlNode*>c_attr, c_qname):             # <<<<<<<<<<<<<<
 *                 return True
 *         return False
*/
    }
  }

  /* "lxml/etree.pyx":2975
 *             if _tagMatchesExactly(<xmlNode*>c_attr, c_qname):
 *                 return True
 *         return False             # <<<<<<<<<<<<<<
 * 
 * cdef class _ElementMatchIterator:
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":2967
 *         return False
 * 
 *     cdef inline bint matchesAttribute(self, xmlAttr* c_attr) noexcept:             # <<<<<<<<<<<<<<
 *         """Attribute matches differ from Element matches in that they do
 *         not care about node types.
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "lxml/etree.pyx":2982
 *     cdef _MultiTagMatcher _matcher
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef _initTagMatcher(self, tags):
 *         self._matcher = _MultiTagMatcher.__new__(_MultiTagMatcher, tags)
*/

static PyObject *__pyx_f_4lxml_5etree_21_ElementMatchIterator__initTagMatcher(struct __pyx_obj_4lxml_5etree__ElementMatchIterator *__pyx_v_self, PyObject *__pyx_v_tags) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_initTagMatcher", 0);

  /* "lxml/etree.pyx":2984
 *     @cython.final
 *     cdef _initTagMatcher(self, tags):
 *         self._matcher = _MultiTagMatcher.__new__(_MultiTagMatcher, tags)             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
*/
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2984, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_tags);
  __Pyx_GIVEREF(__pyx_v_tags);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_tags) != (0)) __PYX_ERR(0, 2984, __pyx_L1_error);
  __pyx_t_2 = ((PyObject *)__pyx_tp_new_4lxml_5etree__MultiTagMatcher(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__MultiTagMatcher), __pyx_t_1, NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2984, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_GIVEREF((PyObject *)__pyx_t_2);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_matcher);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_matcher);
  __pyx_v_self->_matcher = ((struct __pyx_obj_4lxml_5etree__MultiTagMatcher *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "lxml/etree.pyx":2982
 *     cdef _MultiTagMatcher _matcher
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef _initTagMatcher(self, tags):
 *         self._matcher = _MultiTagMatcher.__new__(_MultiTagMatcher, tags)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ElementMatchIterator._initTagMatcher", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2986
 *         self._matcher = _MultiTagMatcher.__new__(_MultiTagMatcher, tags)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_21_ElementMatchIterator_1__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_21_ElementMatchIterator_1__iter__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_21_ElementMatchIterator___iter__(((struct __pyx_obj_4lxml_5etree__ElementMatchIterator *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_21_ElementMatchIterator___iter__(struct __pyx_obj_4lxml_5etree__ElementMatchIterator *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "lxml/etree.pyx":2987
 * 
 *     def __iter__(self):
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "lxml/etree.pyx":2986
 *         self._matcher = _MultiTagMatcher.__new__(_MultiTagMatcher, tags)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2989
 *         return self
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef int _storeNext(self, _Element node) except -1:
 *         self._matcher.cacheTags(node._doc)
*/

static int __pyx_f_4lxml_5etree_21_ElementMatchIterator__storeNext(struct __pyx_obj_4lxml_5etree__ElementMatchIterator *__pyx_v_self, struct LxmlElement *__pyx_v_node) {
  xmlNode *__pyx_v_c_node;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  xmlNode *__pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_storeNext", 0);

  /* "lxml/etree.pyx":2991
 *     @cython.final
 *     cdef int _storeNext(self, _Element node) except -1:
 *         self._matcher.cacheTags(node._doc)             # <<<<<<<<<<<<<<
 *         c_node = self._next_element(node._c_node)
 *         while c_node is not NULL and not self._matcher.matches(c_node):
*/
  __pyx_t_1 = ((PyObject *)__pyx_v_node->_doc);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree_16_MultiTagMatcher_cacheTags(__pyx_v_self->_matcher, ((struct LxmlDocument *)__pyx_t_1), NULL); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 2991, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":2992
 *     cdef int _storeNext(self, _Element node) except -1:
 *         self._matcher.cacheTags(node._doc)
 *         c_node = self._next_element(node._c_node)             # <<<<<<<<<<<<<<
 *         while c_node is not NULL and not self._matcher.matches(c_node):
 *             c_node = self._next_element(c_node)
*/
  __pyx_t_3 = __pyx_v_self->_next_element(__pyx_v_node->_c_node); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2992, __pyx_L1_error)
  __pyx_v_c_node = __pyx_t_3;

  /* "lxml/etree.pyx":2993
 *         self._matcher.cacheTags(node._doc)
 *         c_node = self._next_element(node._c_node)
 *         while c_node is not NULL and not self._matcher.matches(c_node):             # <<<<<<<<<<<<<<
 *             c_node = self._next_element(c_node)
 *         # store Python ref to next node to make sure it's kept alive
*/
  while (1) {
    __pyx_t_5 = (__pyx_v_c_node != NULL);
    if (__pyx_t_5) {
    } else {
      __pyx_t_4 = __pyx_t_5;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_5 = (!__pyx_f_4lxml_5etree_16_MultiTagMatcher_matches(__pyx_v_self->_matcher, __pyx_v_c_node));
    __pyx_t_4 = __pyx_t_5;
    __pyx_L5_bool_binop_done:;
    if (!__pyx_t_4) break;

    /* "lxml/etree.pyx":2994
 *         c_node = self._next_element(node._c_node)
 *         while c_node is not NULL and not self._matcher.matches(c_node):
 *             c_node = self._next_element(c_node)             # <<<<<<<<<<<<<<
 *         # store Python ref to next node to make sure it's kept alive
 *         self._node = _elementFactory(node._doc, c_node) if c_node is not NULL else None
*/
    __pyx_t_3 = __pyx_v_self->_next_element(__pyx_v_c_node); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2994, __pyx_L1_error)
    __pyx_v_c_node = __pyx_t_3;
  }

  /* "lxml/etree.pyx":2996
 *             c_node = self._next_element(c_node)
 *         # store Python ref to next node to make sure it's kept alive
 *         self._node = _elementFactory(node._doc, c_node) if c_node is not NULL else None             # <<<<<<<<<<<<<<
 *         return 0
 * 
*/
  __pyx_t_4 = (__pyx_v_c_node != NULL);
  if (__pyx_t_4) {
    __pyx_t_6 = ((PyObject *)__pyx_v_node->_doc);
    __Pyx_INCREF(__pyx_t_6);
    __pyx_t_7 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_6), __pyx_v_c_node)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2996, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_1 = __pyx_t_7;
    __pyx_t_7 = 0;
  } else {
    __Pyx_INCREF(Py_None);
    __pyx_t_1 = Py_None;
  }
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element))))) __PYX_ERR(0, 2996, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_node);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_node);
  __pyx_v_self->_node = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "lxml/etree.pyx":2997
 *         # store Python ref to next node to make sure it's kept alive
 *         self._node = _elementFactory(node._doc, c_node) if c_node is not NULL else None
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     def __next__(self):
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":2989
 *         return self
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef int _storeNext(self, _Element node) except -1:
 *         self._matcher.cacheTags(node._doc)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree._ElementMatchIterator._storeNext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2999
 *         return 0
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         cdef _Element current_node = self._node
 *         if current_node is None:
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_21_ElementMatchIterator_3__next__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_21_ElementMatchIterator_3__next__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_21_ElementMatchIterator_2__next__(((struct __pyx_obj_4lxml_5etree__ElementMatchIterator *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_21_ElementMatchIterator_2__next__(struct __pyx_obj_4lxml_5etree__ElementMatchIterator *__pyx_v_self) {
  struct LxmlElement *__pyx_v_current_node = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_error_without_exception = 0; /* StopIteration */
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__next__", 0);

  /* "lxml/etree.pyx":3000
 * 
 *     def __next__(self):
 *         cdef _Element current_node = self._node             # <<<<<<<<<<<<<<
 *         if current_node is None:
 *             raise StopIteration
*/
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_node);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_current_node = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "lxml/etree.pyx":3001
 *     def __next__(self):
 *         cdef _Element current_node = self._node
 *         if current_node is None:             # <<<<<<<<<<<<<<
 *             raise StopIteration
 *         self._storeNext(current_node)
*/
  __pyx_t_2 = (((PyObject *)__pyx_v_current_node) == Py_None);
  if (unlikely(__pyx_t_2)) {

    /* "lxml/etree.pyx":3002
 *         cdef _Element current_node = self._node
 *         if current_node is None:
 *             raise StopIteration             # <<<<<<<<<<<<<<
 *         self._storeNext(current_node)
 *         return current_node
*/
    __pyx_error_without_exception = 1;
    goto __pyx_L1_error;;

    /* "lxml/etree.pyx":3001
 *     def __next__(self):
 *         cdef _Element current_node = self._node
 *         if current_node is None:             # <<<<<<<<<<<<<<
 *             raise StopIteration
 *         self._storeNext(current_node)
*/
  }

  /* "lxml/etree.pyx":3003
 *         if current_node is None:
 *             raise StopIteration
 *         self._storeNext(current_node)             # <<<<<<<<<<<<<<
 *         return current_node
 * 
*/
  __pyx_t_3 = __pyx_f_4lxml_5etree_21_ElementMatchIterator__storeNext(__pyx_v_self, __pyx_v_current_node); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 3003, __pyx_L1_error)

  /* "lxml/etree.pyx":3004
 *             raise StopIteration
 *         self._storeNext(current_node)
 *         return current_node             # <<<<<<<<<<<<<<
 * 
 * cdef class ElementChildIterator(_ElementMatchIterator):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_current_node);
  __pyx_r = ((PyObject *)__pyx_v_current_node);
  goto __pyx_L0;

  /* "lxml/etree.pyx":2999
 *         return 0
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         cdef _Element current_node = self._node
 *         if current_node is None:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  if (!__pyx_error_without_exception) {
    __Pyx_AddTraceback("lxml.etree._ElementMatchIterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_current_node);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":3010
 *     Iterates over the children of an element.
 *     """
 *     def __cinit__(self, _Element node not None, tag=None, *, bint reversed=False):             # <<<<<<<<<<<<<<
 *         cdef xmlNode* c_node
 *         _assertValidNode(node)
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_20ElementChildIterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_20ElementChildIterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct LxmlElement *__pyx_v_node = 0;
  PyObject *__pyx_v_tag = 0;
  int __pyx_v_reversed;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_node,&__pyx_mstate_global->__pyx_n_u_tag,&__pyx_mstate_global->__pyx_n_u_reversed,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 3010, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 3010, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3010, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__cinit__", 0) < (0)) __PYX_ERR(0, 3010, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 2, i); __PYX_ERR(0, 3010, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 3010, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3010, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_node = ((struct LxmlElement *)values[0]);
    __pyx_v_tag = values[1];
    if (values[2]) {
      __pyx_v_reversed = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_reversed == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3010, __pyx_L3_error)
    } else {
      __pyx_v_reversed = ((int)0);
    }
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 3010, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.ElementChildIterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_node), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element, 0, "node", 0))) __PYX_ERR(0, 3010, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_20ElementChildIterator___cinit__(((struct __pyx_obj_4lxml_5etree_ElementChildIterator *)__pyx_v_self), __pyx_v_node, __pyx_v_tag, __pyx_v_reversed);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_20ElementChildIterator___cinit__(struct __pyx_obj_4lxml_5etree_ElementChildIterator *__pyx_v_self, struct LxmlElement *__pyx_v_node, PyObject *__pyx_v_tag, int __pyx_v_reversed) {
  xmlNode *__pyx_v_c_node;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  xmlNode *__pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "lxml/etree.pyx":3012
 *     def __cinit__(self, _Element node not None, tag=None, *, bint reversed=False):
 *         cdef xmlNode* c_node
 *         _assertValidNode(node)             # <<<<<<<<<<<<<<
 *         self._initTagMatcher(tag)
 *         if reversed:
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_node); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 3012, __pyx_L1_error)

  /* "lxml/etree.pyx":3013
 *         cdef xmlNode* c_node
 *         _assertValidNode(node)
 *         self._initTagMatcher(tag)             # <<<<<<<<<<<<<<
 *         if reversed:
 *             c_node = _findChildBackwards(node._c_node, 0)
*/
  __pyx_t_2 = __pyx_f_4lxml_5etree_21_ElementMatchIterator__initTagMatcher(((struct __pyx_obj_4lxml_5etree__ElementMatchIterator *)__pyx_v_self), __pyx_v_tag); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3013, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "lxml/etree.pyx":3014
 *         _assertValidNode(node)
 *         self._initTagMatcher(tag)
 *         if reversed:             # <<<<<<<<<<<<<<
 *             c_node = _findChildBackwards(node._c_node, 0)
 *             self._next_element = _previousElement
*/
  if (__pyx_v_reversed) {

    /* "lxml/etree.pyx":3015
 *         self._initTagMatcher(tag)
 *         if reversed:
 *             c_node = _findChildBackwards(node._c_node, 0)             # <<<<<<<<<<<<<<
 *             self._next_element = _previousElement
 *         else:
*/
    __pyx_v_c_node = __pyx_f_4lxml_5etree__findChildBackwards(__pyx_v_node->_c_node, 0);

    /* "lxml/etree.pyx":3016
 *         if reversed:
 *             c_node = _findChildBackwards(node._c_node, 0)
 *             self._next_element = _previousElement             # <<<<<<<<<<<<<<
 *         else:
 *             c_node = _findChildForwards(node._c_node, 0)
*/
    __pyx_v_self->__pyx_base._next_element = __pyx_f_4lxml_5etree__previousElement;

    /* "lxml/etree.pyx":3014
 *         _assertValidNode(node)
 *         self._initTagMatcher(tag)
 *         if reversed:             # <<<<<<<<<<<<<<
 *             c_node = _findChildBackwards(node._c_node, 0)
 *             self._next_element = _previousElement
*/
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":3018
 *             self._next_element = _previousElement
 *         else:
 *             c_node = _findChildForwards(node._c_node, 0)             # <<<<<<<<<<<<<<
 *             self._next_element = _nextElement
 *         self._matcher.cacheTags(node._doc)
*/
  /*else*/ {
    __pyx_v_c_node = __pyx_f_4lxml_5etree__findChildForwards(__pyx_v_node->_c_node, 0);

    /* "lxml/etree.pyx":3019
 *         else:
 *             c_node = _findChildForwards(node._c_node, 0)
 *             self._next_element = _nextElement             # <<<<<<<<<<<<<<
 *         self._matcher.cacheTags(node._doc)
 *         while c_node is not NULL and not self._matcher.matches(c_node):
*/
    __pyx_v_self->__pyx_base._next_element = __pyx_f_4lxml_5etree__nextElement;
  }
  __pyx_L3:;

  /* "lxml/etree.pyx":3020
 *             c_node = _findChildForwards(node._c_node, 0)
 *             self._next_element = _nextElement
 *         self._matcher.cacheTags(node._doc)             # <<<<<<<<<<<<<<
 *         while c_node is not NULL and not self._matcher.matches(c_node):
 *             c_node = self._next_element(c_node)
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_node->_doc);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_1 = __pyx_f_4lxml_5etree_16_MultiTagMatcher_cacheTags(__pyx_v_self->__pyx_base._matcher, ((struct LxmlDocument *)__pyx_t_2), NULL); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 3020, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "lxml/etree.pyx":3021
 *             self._next_element = _nextElement
 *         self._matcher.cacheTags(node._doc)
 *         while c_node is not NULL and not self._matcher.matches(c_node):             # <<<<<<<<<<<<<<
 *             c_node = self._next_element(c_node)
 *         # store Python ref to next node to make sure it's kept alive
*/
  while (1) {
    __pyx_t_4 = (__pyx_v_c_node != NULL);
    if (__pyx_t_4) {
    } else {
      __pyx_t_3 = __pyx_t_4;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_4 = (!__pyx_f_4lxml_5etree_16_MultiTagMatcher_matches(__pyx_v_self->__pyx_base._matcher, __pyx_v_c_node));
    __pyx_t_3 = __pyx_t_4;
    __pyx_L6_bool_binop_done:;
    if (!__pyx_t_3) break;

    /* "lxml/etree.pyx":3022
 *         self._matcher.cacheTags(node._doc)
 *         while c_node is not NULL and not self._matcher.matches(c_node):
 *             c_node = self._next_element(c_node)             # <<<<<<<<<<<<<<
 *         # store Python ref to next node to make sure it's kept alive
 *         self._node = _elementFactory(node._doc, c_node) if c_node is not NULL else None
*/
    __pyx_t_5 = __pyx_v_self->__pyx_base._next_element(__pyx_v_c_node); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3022, __pyx_L1_error)
    __pyx_v_c_node = __pyx_t_5;
  }

  /* "lxml/etree.pyx":3024
 *             c_node = self._next_element(c_node)
 *         # store Python ref to next node to make sure it's kept alive
 *         self._node = _elementFactory(node._doc, c_node) if c_node is not NULL else None             # <<<<<<<<<<<<<<
 * 
 * cdef class SiblingsIterator(_ElementMatchIterator):
*/
  __pyx_t_3 = (__pyx_v_c_node != NULL);
  if (__pyx_t_3) {
    __pyx_t_6 = ((PyObject *)__pyx_v_node->_doc);
    __Pyx_INCREF(__pyx_t_6);
    __pyx_t_7 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_6), __pyx_v_c_node)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3024, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_2 = __pyx_t_7;
    __pyx_t_7 = 0;
  } else {
    __Pyx_INCREF(Py_None);
    __pyx_t_2 = Py_None;
  }
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element))))) __PYX_ERR(0, 3024, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->__pyx_base._node);
  __Pyx_DECREF((PyObject *)__pyx_v_self->__pyx_base._node);
  __pyx_v_self->__pyx_base._node = ((struct LxmlElement *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "lxml/etree.pyx":3010
 *     Iterates over the children of an element.
 *     """
 *     def __cinit__(self, _Element node not None, tag=None, *, bint reversed=False):             # <<<<<<<<<<<<<<
 *         cdef xmlNode* c_node
 *         _assertValidNode(node)
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree.ElementChildIterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":3032
 *     You can pass the boolean keyword ``preceding`` to specify the direction.
 *     """
 *     def __cinit__(self, _Element node not None, tag=None, *, bint preceding=False):             # <<<<<<<<<<<<<<
 *         _assertValidNode(node)
 *         self._initTagMatcher(tag)
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_16SiblingsIterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_16SiblingsIterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct LxmlElement *__pyx_v_node = 0;
  PyObject *__pyx_v_tag = 0;
  int __pyx_v_preceding;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_node,&__pyx_mstate_global->__pyx_n_u_tag,&__pyx_mstate_global->__pyx_n_u_preceding,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 3032, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 3032, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3032, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__cinit__", 0) < (0)) __PYX_ERR(0, 3032, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 2, i); __PYX_ERR(0, 3032, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 3032, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3032, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_node = ((struct LxmlElement *)values[0]);
    __pyx_v_tag = values[1];
    if (values[2]) {
      __pyx_v_preceding = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_preceding == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3032, __pyx_L3_error)
    } else {
      __pyx_v_preceding = ((int)0);
    }
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 3032, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.SiblingsIterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_node), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element, 0, "node", 0))) __PYX_ERR(0, 3032, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_16SiblingsIterator___cinit__(((struct __pyx_obj_4lxml_5etree_SiblingsIterator *)__pyx_v_self), __pyx_v_node, __pyx_v_tag, __pyx_v_preceding);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_16SiblingsIterator___cinit__(struct __pyx_obj_4lxml_5etree_SiblingsIterator *__pyx_v_self, struct LxmlElement *__pyx_v_node, PyObject *__pyx_v_tag, int __pyx_v_preceding) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "lxml/etree.pyx":3033
 *     """
 *     def __cinit__(self, _Element node not None, tag=None, *, bint preceding=False):
 *         _assertValidNode(node)             # <<<<<<<<<<<<<<
 *         self._initTagMatcher(tag)
 *         if preceding:
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_node); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 3033, __pyx_L1_error)

  /* "lxml/etree.pyx":3034
 *     def __cinit__(self, _Element node not None, tag=None, *, bint preceding=False):
 *         _assertValidNode(node)
 *         self._initTagMatcher(tag)             # <<<<<<<<<<<<<<
 *         if preceding:
 *             self._next_element = _previousElement
*/
  __pyx_t_2 = __pyx_f_4lxml_5etree_21_ElementMatchIterator__initTagMatcher(((struct __pyx_obj_4lxml_5etree__ElementMatchIterator *)__pyx_v_self), __pyx_v_tag); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3034, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "lxml/etree.pyx":3035
 *         _assertValidNode(node)
 *         self._initTagMatcher(tag)
 *         if preceding:             # <<<<<<<<<<<<<<
 *             self._next_element = _previousElement
 *         else:
*/
  if (__pyx_v_preceding) {

    /* "lxml/etree.pyx":3036
 *         self._initTagMatcher(tag)
 *         if preceding:
 *             self._next_element = _previousElement             # <<<<<<<<<<<<<<
 *         else:
 *             self._next_element = _nextElement
*/
    __pyx_v_self->__pyx_base._next_element = __pyx_f_4lxml_5etree__previousElement;

    /* "lxml/etree.pyx":3035
 *         _assertValidNode(node)
 *         self._initTagMatcher(tag)
 *         if preceding:             # <<<<<<<<<<<<<<
 *             self._next_element = _previousElement
 *         else:
*/
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":3038
 *             self._next_element = _previousElement
 *         else:
 *             self._next_element = _nextElement             # <<<<<<<<<<<<<<
 *         self._storeNext(node)
 * 
*/
  /*else*/ {
    __pyx_v_self->__pyx_base._next_element = __pyx_f_4lxml_5etree__nextElement;
  }
  __pyx_L3:;

  /* "lxml/etree.pyx":3039
 *         else:
 *             self._next_element = _nextElement
 *         self._storeNext(node)             # <<<<<<<<<<<<<<
 * 
 * cdef class AncestorsIterator(_ElementMatchIterator):
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_21_ElementMatchIterator__storeNext(((struct __pyx_obj_4lxml_5etree__ElementMatchIterator *)__pyx_v_self), __pyx_v_node); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 3039, __pyx_L1_error)

  /* "lxml/etree.pyx":3032
 *     You can pass the boolean keyword ``preceding`` to specify the direction.
 *     """
 *     def __cinit__(self, _Element node not None, tag=None, *, bint preceding=False):             # <<<<<<<<<<<<<<
 *         _assertValidNode(node)
 *         self._initTagMatcher(tag)
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.SiblingsIterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":3045
 *     Iterates over the ancestors of an element (from parent to parent).
 *     """
 *     def __cinit__(self, _Element node not None, tag=None):             # <<<<<<<<<<<<<<
 *         _assertValidNode(node)
 *         self._initTagMatcher(tag)
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_17AncestorsIterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_17AncestorsIterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct LxmlElement *__pyx_v_node = 0;
  PyObject *__pyx_v_tag = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_node,&__pyx_mstate_global->__pyx_n_u_tag,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 3045, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 3045, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3045, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__cinit__", 0) < (0)) __PYX_ERR(0, 3045, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 2, i); __PYX_ERR(0, 3045, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 3045, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3045, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_node = ((struct LxmlElement *)values[0]);
    __pyx_v_tag = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 3045, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.AncestorsIterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_node), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element, 0, "node", 0))) __PYX_ERR(0, 3045, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_17AncestorsIterator___cinit__(((struct __pyx_obj_4lxml_5etree_AncestorsIterator *)__pyx_v_self), __pyx_v_node, __pyx_v_tag);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_17AncestorsIterator___cinit__(struct __pyx_obj_4lxml_5etree_AncestorsIterator *__pyx_v_self, struct LxmlElement *__pyx_v_node, PyObject *__pyx_v_tag) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "lxml/etree.pyx":3046
 *     """
 *     def __cinit__(self, _Element node not None, tag=None):
 *         _assertValidNode(node)             # <<<<<<<<<<<<<<
 *         self._initTagMatcher(tag)
 *         self._next_element = _parentElement
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_node); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 3046, __pyx_L1_error)

  /* "lxml/etree.pyx":3047
 *     def __cinit__(self, _Element node not None, tag=None):
 *         _assertValidNode(node)
 *         self._initTagMatcher(tag)             # <<<<<<<<<<<<<<
 *         self._next_element = _parentElement
 *         self._storeNext(node)
*/
  __pyx_t_2 = __pyx_f_4lxml_5etree_21_ElementMatchIterator__initTagMatcher(((struct __pyx_obj_4lxml_5etree__ElementMatchIterator *)__pyx_v_self), __pyx_v_tag); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3047, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "lxml/etree.pyx":3048
 *         _assertValidNode(node)
 *         self._initTagMatcher(tag)
 *         self._next_element = _parentElement             # <<<<<<<<<<<<<<
 *         self._storeNext(node)
 * 
*/
  __pyx_v_self->__pyx_base._next_element = __pyx_f_4lxml_5etree__parentElement;

  /* "lxml/etree.pyx":3049
 *         self._initTagMatcher(tag)
 *         self._next_element = _parentElement
 *         self._storeNext(node)             # <<<<<<<<<<<<<<
 * 
 * cdef class ElementDepthFirstIterator:
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_21_ElementMatchIterator__storeNext(((struct __pyx_obj_4lxml_5etree__ElementMatchIterator *)__pyx_v_self), __pyx_v_node); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 3049, __pyx_L1_error)

  /* "lxml/etree.pyx":3045
 *     Iterates over the ancestors of an element (from parent to parent).
 *     """
 *     def __cinit__(self, _Element node not None, tag=None):             # <<<<<<<<<<<<<<
 *         _assertValidNode(node)
 *         self._initTagMatcher(tag)
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.AncestorsIterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":3076
 *     cdef _Element _top_node
 *     cdef _MultiTagMatcher _matcher
 *     def __cinit__(self, _Element node not None, tag=None, *, bint inclusive=True):             # <<<<<<<<<<<<<<
 *         _assertValidNode(node)
 *         self._top_node  = node
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_25ElementDepthFirstIterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_25ElementDepthFirstIterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct LxmlElement *__pyx_v_node = 0;
  PyObject *__pyx_v_tag = 0;
  int __pyx_v_inclusive;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_node,&__pyx_mstate_global->__pyx_n_u_tag,&__pyx_mstate_global->__pyx_n_u_inclusive,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 3076, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 3076, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3076, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__cinit__", 0) < (0)) __PYX_ERR(0, 3076, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 2, i); __PYX_ERR(0, 3076, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 3076, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3076, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_node = ((struct LxmlElement *)values[0]);
    __pyx_v_tag = values[1];
    if (values[2]) {
      __pyx_v_inclusive = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_inclusive == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3076, __pyx_L3_error)
    } else {
      __pyx_v_inclusive = ((int)1);
    }
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 3076, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.ElementDepthFirstIterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_node), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element, 0, "node", 0))) __PYX_ERR(0, 3076, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_25ElementDepthFirstIterator___cinit__(((struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *)__pyx_v_self), __pyx_v_node, __pyx_v_tag, __pyx_v_inclusive);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_25ElementDepthFirstIterator___cinit__(struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *__pyx_v_self, struct LxmlElement *__pyx_v_node, PyObject *__pyx_v_tag, int __pyx_v_inclusive) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "lxml/etree.pyx":3077
 *     cdef _MultiTagMatcher _matcher
 *     def __cinit__(self, _Element node not None, tag=None, *, bint inclusive=True):
 *         _assertValidNode(node)             # <<<<<<<<<<<<<<
 *         self._top_node  = node
 *         self._next_node = node
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_node); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 3077, __pyx_L1_error)

  /* "lxml/etree.pyx":3078
 *     def __cinit__(self, _Element node not None, tag=None, *, bint inclusive=True):
 *         _assertValidNode(node)
 *         self._top_node  = node             # <<<<<<<<<<<<<<
 *         self._next_node = node
 *         self._matcher = _MultiTagMatcher.__new__(_MultiTagMatcher, tag)
*/
  __Pyx_INCREF((PyObject *)__pyx_v_node);
  __Pyx_GIVEREF((PyObject *)__pyx_v_node);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_top_node);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_top_node);
  __pyx_v_self->_top_node = __pyx_v_node;

  /* "lxml/etree.pyx":3079
 *         _assertValidNode(node)
 *         self._top_node  = node
 *         self._next_node = node             # <<<<<<<<<<<<<<
 *         self._matcher = _MultiTagMatcher.__new__(_MultiTagMatcher, tag)
 *         self._matcher.cacheTags(node._doc)
*/
  __Pyx_INCREF((PyObject *)__pyx_v_node);
  __Pyx_GIVEREF((PyObject *)__pyx_v_node);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_next_node);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_next_node);
  __pyx_v_self->_next_node = __pyx_v_node;

  /* "lxml/etree.pyx":3080
 *         self._top_node  = node
 *         self._next_node = node
 *         self._matcher = _MultiTagMatcher.__new__(_MultiTagMatcher, tag)             # <<<<<<<<<<<<<<
 *         self._matcher.cacheTags(node._doc)
 *         if not inclusive or not self._matcher.matches(node._c_node):
*/
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3080, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_tag);
  __Pyx_GIVEREF(__pyx_v_tag);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_tag) != (0)) __PYX_ERR(0, 3080, __pyx_L1_error);
  __pyx_t_3 = ((PyObject *)__pyx_tp_new_4lxml_5etree__MultiTagMatcher(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__MultiTagMatcher), __pyx_t_2, NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3080, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_GIVEREF((PyObject *)__pyx_t_3);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_matcher);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_matcher);
  __pyx_v_self->_matcher = ((struct __pyx_obj_4lxml_5etree__MultiTagMatcher *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "lxml/etree.pyx":3081
 *         self._next_node = node
 *         self._matcher = _MultiTagMatcher.__new__(_MultiTagMatcher, tag)
 *         self._matcher.cacheTags(node._doc)             # <<<<<<<<<<<<<<
 *         if not inclusive or not self._matcher.matches(node._c_node):
 *             # find start node (this cannot raise StopIteration, self._next_node != None)
*/
  __pyx_t_3 = ((PyObject *)__pyx_v_node->_doc);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_1 = __pyx_f_4lxml_5etree_16_MultiTagMatcher_cacheTags(__pyx_v_self->_matcher, ((struct LxmlDocument *)__pyx_t_3), NULL); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 3081, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "lxml/etree.pyx":3082
 *         self._matcher = _MultiTagMatcher.__new__(_MultiTagMatcher, tag)
 *         self._matcher.cacheTags(node._doc)
 *         if not inclusive or not self._matcher.matches(node._c_node):             # <<<<<<<<<<<<<<
 *             # find start node (this cannot raise StopIteration, self._next_node != None)
 *             next(self)
*/
  __pyx_t_5 = (!__pyx_v_inclusive);
  if (!__pyx_t_5) {
  } else {
    __pyx_t_4 = __pyx_t_5;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_5 = (!__pyx_f_4lxml_5etree_16_MultiTagMatcher_matches(__pyx_v_self->_matcher, __pyx_v_node->_c_node));
  __pyx_t_4 = __pyx_t_5;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_4) {

    /* "lxml/etree.pyx":3084
 *         if not inclusive or not self._matcher.matches(node._c_node):
 *             # find start node (this cannot raise StopIteration, self._next_node != None)
 *             next(self)             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
*/
    __pyx_t_3 = __Pyx_PyIter_Next(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3084, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "lxml/etree.pyx":3082
 *         self._matcher = _MultiTagMatcher.__new__(_MultiTagMatcher, tag)
 *         self._matcher.cacheTags(node._doc)
 *         if not inclusive or not self._matcher.matches(node._c_node):             # <<<<<<<<<<<<<<
 *             # find start node (this cannot raise StopIteration, self._next_node != None)
 *             next(self)
*/
  }

  /* "lxml/etree.pyx":3076
 *     cdef _Element _top_node
 *     cdef _MultiTagMatcher _matcher
 *     def __cinit__(self, _Element node not None, tag=None, *, bint inclusive=True):             # <<<<<<<<<<<<<<
 *         _assertValidNode(node)
 *         self._top_node  = node
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.ElementDepthFirstIterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":3086
 *             next(self)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_25ElementDepthFirstIterator_3__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_25ElementDepthFirstIterator_3__iter__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_25ElementDepthFirstIterator_2__iter__(((struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_25ElementDepthFirstIterator_2__iter__(struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "lxml/etree.pyx":3087
 * 
 *     def __iter__(self):
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __next__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "lxml/etree.pyx":3086
 *             next(self)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":3089
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         cdef xmlNode* c_node
 *         cdef _Element current_node = self._next_node
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_25ElementDepthFirstIterator_5__next__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_25ElementDepthFirstIterator_5__next__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_25ElementDepthFirstIterator_4__next__(((struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_25ElementDepthFirstIterator_4__next__(struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *__pyx_v_self) {
  xmlNode *__pyx_v_c_node;
  struct LxmlElement *__pyx_v_current_node = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_error_without_exception = 0; /* StopIteration */
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  xmlNode *__pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__next__", 0);

  /* "lxml/etree.pyx":3091
 *     def __next__(self):
 *         cdef xmlNode* c_node
 *         cdef _Element current_node = self._next_node             # <<<<<<<<<<<<<<
 *         if current_node is None:
 *             raise StopIteration
*/
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_next_node);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_current_node = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "lxml/etree.pyx":3092
 *         cdef xmlNode* c_node
 *         cdef _Element current_node = self._next_node
 *         if current_node is None:             # <<<<<<<<<<<<<<
 *             raise StopIteration
 *         c_node = current_node._c_node
*/
  __pyx_t_2 = (((PyObject *)__pyx_v_current_node) == Py_None);
  if (unlikely(__pyx_t_2)) {

    /* "lxml/etree.pyx":3093
 *         cdef _Element current_node = self._next_node
 *         if current_node is None:
 *             raise StopIteration             # <<<<<<<<<<<<<<
 *         c_node = current_node._c_node
 *         self._matcher.cacheTags(current_node._doc)
*/
    __pyx_error_without_exception = 1;
    goto __pyx_L1_error;;

    /* "lxml/etree.pyx":3092
 *         cdef xmlNode* c_node
 *         cdef _Element current_node = self._next_node
 *         if current_node is None:             # <<<<<<<<<<<<<<
 *             raise StopIteration
 *         c_node = current_node._c_node
*/
  }

  /* "lxml/etree.pyx":3094
 *         if current_node is None:
 *             raise StopIteration
 *         c_node = current_node._c_node             # <<<<<<<<<<<<<<
 *         self._matcher.cacheTags(current_node._doc)
 *         if not self._matcher._tag_count:
*/
  __pyx_t_3 = __pyx_v_current_node->_c_node;
  __pyx_v_c_node = __pyx_t_3;

  /* "lxml/etree.pyx":3095
 *             raise StopIteration
 *         c_node = current_node._c_node
 *         self._matcher.cacheTags(current_node._doc)             # <<<<<<<<<<<<<<
 *         if not self._matcher._tag_count:
 *             # no tag name was found in the dict => not in document either
*/
  __pyx_t_1 = ((PyObject *)__pyx_v_current_node->_doc);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_4 = __pyx_f_4lxml_5etree_16_MultiTagMatcher_cacheTags(__pyx_v_self->_matcher, ((struct LxmlDocument *)__pyx_t_1), NULL); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 3095, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":3096
 *         c_node = current_node._c_node
 *         self._matcher.cacheTags(current_node._doc)
 *         if not self._matcher._tag_count:             # <<<<<<<<<<<<<<
 *             # no tag name was found in the dict => not in document either
 *             # try to match by node type
*/
  __pyx_t_2 = (!(__pyx_v_self->_matcher->_tag_count != 0));
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":3099
 *             # no tag name was found in the dict => not in document either
 *             # try to match by node type
 *             c_node = self._nextNodeAnyTag(c_node)             # <<<<<<<<<<<<<<
 *         else:
 *             c_node = self._nextNodeMatchTag(c_node)
*/
    __pyx_v_c_node = __pyx_f_4lxml_5etree_25ElementDepthFirstIterator__nextNodeAnyTag(__pyx_v_self, __pyx_v_c_node);

    /* "lxml/etree.pyx":3096
 *         c_node = current_node._c_node
 *         self._matcher.cacheTags(current_node._doc)
 *         if not self._matcher._tag_count:             # <<<<<<<<<<<<<<
 *             # no tag name was found in the dict => not in document either
 *             # try to match by node type
*/
    goto __pyx_L4;
  }

  /* "lxml/etree.pyx":3101
 *             c_node = self._nextNodeAnyTag(c_node)
 *         else:
 *             c_node = self._nextNodeMatchTag(c_node)             # <<<<<<<<<<<<<<
 *         if c_node is NULL:
 *             self._next_node = None
*/
  /*else*/ {
    __pyx_v_c_node = __pyx_f_4lxml_5etree_25ElementDepthFirstIterator__nextNodeMatchTag(__pyx_v_self, __pyx_v_c_node);
  }
  __pyx_L4:;

  /* "lxml/etree.pyx":3102
 *         else:
 *             c_node = self._nextNodeMatchTag(c_node)
 *         if c_node is NULL:             # <<<<<<<<<<<<<<
 *             self._next_node = None
 *         else:
*/
  __pyx_t_2 = (__pyx_v_c_node == NULL);
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":3103
 *             c_node = self._nextNodeMatchTag(c_node)
 *         if c_node is NULL:
 *             self._next_node = None             # <<<<<<<<<<<<<<
 *         else:
 *             self._next_node = _elementFactory(current_node._doc, c_node)
*/
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF((PyObject *)__pyx_v_self->_next_node);
    __Pyx_DECREF((PyObject *)__pyx_v_self->_next_node);
    __pyx_v_self->_next_node = ((struct LxmlElement *)Py_None);

    /* "lxml/etree.pyx":3102
 *         else:
 *             c_node = self._nextNodeMatchTag(c_node)
 *         if c_node is NULL:             # <<<<<<<<<<<<<<
 *             self._next_node = None
 *         else:
*/
    goto __pyx_L5;
  }

  /* "lxml/etree.pyx":3105
 *             self._next_node = None
 *         else:
 *             self._next_node = _elementFactory(current_node._doc, c_node)             # <<<<<<<<<<<<<<
 *         return current_node
 * 
*/
  /*else*/ {
    __pyx_t_1 = ((PyObject *)__pyx_v_current_node->_doc);
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_5 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_1), __pyx_v_c_node)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3105, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GIVEREF(__pyx_t_5);
    __Pyx_GOTREF((PyObject *)__pyx_v_self->_next_node);
    __Pyx_DECREF((PyObject *)__pyx_v_self->_next_node);
    __pyx_v_self->_next_node = ((struct LxmlElement *)__pyx_t_5);
    __pyx_t_5 = 0;
  }
  __pyx_L5:;

  /* "lxml/etree.pyx":3106
 *         else:
 *             self._next_node = _elementFactory(current_node._doc, c_node)
 *         return current_node             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_current_node);
  __pyx_r = ((PyObject *)__pyx_v_current_node);
  goto __pyx_L0;

  /* "lxml/etree.pyx":3089
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         cdef xmlNode* c_node
 *         cdef _Element current_node = self._next_node
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  if (!__pyx_error_without_exception) {
    __Pyx_AddTraceback("lxml.etree.ElementDepthFirstIterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_current_node);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":3108
 *         return current_node
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef xmlNode* _nextNodeAnyTag(self, xmlNode* c_node) noexcept:
 *         cdef int node_types = self._matcher._node_types
*/

static xmlNode *__pyx_f_4lxml_5etree_25ElementDepthFirstIterator__nextNodeAnyTag(struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *__pyx_v_self, xmlNode *__pyx_v_c_node) {
  int __pyx_v_node_types;
  xmlNode *__pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;

  /* "lxml/etree.pyx":3110
 *     @cython.final
 *     cdef xmlNode* _nextNodeAnyTag(self, xmlNode* c_node) noexcept:
 *         cdef int node_types = self._matcher._node_types             # <<<<<<<<<<<<<<
 *         if not node_types:
 *             return NULL
*/
  __pyx_t_1 = __pyx_v_self->_matcher->_node_types;
  __pyx_v_node_types = __pyx_t_1;

  /* "lxml/etree.pyx":3111
 *     cdef xmlNode* _nextNodeAnyTag(self, xmlNode* c_node) noexcept:
 *         cdef int node_types = self._matcher._node_types
 *         if not node_types:             # <<<<<<<<<<<<<<
 *             return NULL
 *         tree.BEGIN_FOR_EACH_ELEMENT_FROM(self._top_node._c_node, c_node, 0)
*/
  __pyx_t_2 = (!(__pyx_v_node_types != 0));
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":3112
 *         cdef int node_types = self._matcher._node_types
 *         if not node_types:
 *             return NULL             # <<<<<<<<<<<<<<
 *         tree.BEGIN_FOR_EACH_ELEMENT_FROM(self._top_node._c_node, c_node, 0)
 *         if node_types & (1 << c_node.type):
*/
    __pyx_r = NULL;
    goto __pyx_L0;

    /* "lxml/etree.pyx":3111
 *     cdef xmlNode* _nextNodeAnyTag(self, xmlNode* c_node) noexcept:
 *         cdef int node_types = self._matcher._node_types
 *         if not node_types:             # <<<<<<<<<<<<<<
 *             return NULL
 *         tree.BEGIN_FOR_EACH_ELEMENT_FROM(self._top_node._c_node, c_node, 0)
*/
  }

  /* "lxml/etree.pyx":3113
 *         if not node_types:
 *             return NULL
 *         tree.BEGIN_FOR_EACH_ELEMENT_FROM(self._top_node._c_node, c_node, 0)             # <<<<<<<<<<<<<<
 *         if node_types & (1 << c_node.type):
 *             return c_node
*/
  BEGIN_FOR_EACH_ELEMENT_FROM(__pyx_v_self->_top_node->_c_node, __pyx_v_c_node, 0);

  /* "lxml/etree.pyx":3114
 *             return NULL
 *         tree.BEGIN_FOR_EACH_ELEMENT_FROM(self._top_node._c_node, c_node, 0)
 *         if node_types & (1 << c_node.type):             # <<<<<<<<<<<<<<
 *             return c_node
 *         tree.END_FOR_EACH_ELEMENT_FROM(c_node)
*/
  __pyx_t_2 = ((__pyx_v_node_types & (1 << __pyx_v_c_node->type)) != 0);
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":3115
 *         tree.BEGIN_FOR_EACH_ELEMENT_FROM(self._top_node._c_node, c_node, 0)
 *         if node_types & (1 << c_node.type):
 *             return c_node             # <<<<<<<<<<<<<<
 *         tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 *         return NULL
*/
    __pyx_r = __pyx_v_c_node;
    goto __pyx_L0;

    /* "lxml/etree.pyx":3114
 *             return NULL
 *         tree.BEGIN_FOR_EACH_ELEMENT_FROM(self._top_node._c_node, c_node, 0)
 *         if node_types & (1 << c_node.type):             # <<<<<<<<<<<<<<
 *             return c_node
 *         tree.END_FOR_EACH_ELEMENT_FROM(c_node)
*/
  }

  /* "lxml/etree.pyx":3116
 *         if node_types & (1 << c_node.type):
 *             return c_node
 *         tree.END_FOR_EACH_ELEMENT_FROM(c_node)             # <<<<<<<<<<<<<<
 *         return NULL
 * 
*/
  END_FOR_EACH_ELEMENT_FROM(__pyx_v_c_node);

  /* "lxml/etree.pyx":3117
 *             return c_node
 *         tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 *         return NULL             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
*/
  __pyx_r = NULL;
  goto __pyx_L0;

  /* "lxml/etree.pyx":3108
 *         return current_node
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef xmlNode* _nextNodeAnyTag(self, xmlNode* c_node) noexcept:
 *         cdef int node_types = self._matcher._node_types
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "lxml/etree.pyx":3119
 *         return NULL
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef xmlNode* _nextNodeMatchTag(self, xmlNode* c_node) noexcept:
 *         tree.BEGIN_FOR_EACH_ELEMENT_FROM(self._top_node._c_node, c_node, 0)
*/

static xmlNode *__pyx_f_4lxml_5etree_25ElementDepthFirstIterator__nextNodeMatchTag(struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *__pyx_v_self, xmlNode *__pyx_v_c_node) {
  xmlNode *__pyx_r;
  int __pyx_t_1;

  /* "lxml/etree.pyx":3121
 *     @cython.final
 *     cdef xmlNode* _nextNodeMatchTag(self, xmlNode* c_node) noexcept:
 *         tree.BEGIN_FOR_EACH_ELEMENT_FROM(self._top_node._c_node, c_node, 0)             # <<<<<<<<<<<<<<
 *         if self._matcher.matches(c_node):
 *             return c_node
*/
  BEGIN_FOR_EACH_ELEMENT_FROM(__pyx_v_self->_top_node->_c_node, __pyx_v_c_node, 0);

  /* "lxml/etree.pyx":3122
 *     cdef xmlNode* _nextNodeMatchTag(self, xmlNode* c_node) noexcept:
 *         tree.BEGIN_FOR_EACH_ELEMENT_FROM(self._top_node._c_node, c_node, 0)
 *         if self._matcher.matches(c_node):             # <<<<<<<<<<<<<<
 *             return c_node
 *         tree.END_FOR_EACH_ELEMENT_FROM(c_node)
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_16_MultiTagMatcher_matches(__pyx_v_self->_matcher, __pyx_v_c_node);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":3123
 *         tree.BEGIN_FOR_EACH_ELEMENT_FROM(self._top_node._c_node, c_node, 0)
 *         if self._matcher.matches(c_node):
 *             return c_node             # <<<<<<<<<<<<<<
 *         tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 *         return NULL
*/
    __pyx_r = __pyx_v_c_node;
    goto __pyx_L0;

    /* "lxml/etree.pyx":3122
 *     cdef xmlNode* _nextNodeMatchTag(self, xmlNode* c_node) noexcept:
 *         tree.BEGIN_FOR_EACH_ELEMENT_FROM(self._top_node._c_node, c_node, 0)
 *         if self._matcher.matches(c_node):             # <<<<<<<<<<<<<<
 *             return c_node
 *         tree.END_FOR_EACH_ELEMENT_FROM(c_node)
*/
  }

  /* "lxml/etree.pyx":3124
 *         if self._matcher.matches(c_node):
 *             return c_node
 *         tree.END_FOR_EACH_ELEMENT_FROM(c_node)             # <<<<<<<<<<<<<<
 *         return NULL
 * 
*/
  END_FOR_EACH_ELEMENT_FROM(__pyx_v_c_node);

  /* "lxml/etree.pyx":3125
 *             return c_node
 *         tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 *         return NULL             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = NULL;
  goto __pyx_L0;

  /* "lxml/etree.pyx":3119
 *         return NULL
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef xmlNode* _nextNodeMatchTag(self, xmlNode* c_node) noexcept:
 *         tree.BEGIN_FOR_EACH_ELEMENT_FROM(self._top_node._c_node, c_node, 0)
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "lxml/etree.pyx":3140
 *     cdef object _events
 *     cdef _Element _start_element
 *     def __cinit__(self, _Element element not None, tag=None, *, bint with_tail=True):             # <<<<<<<<<<<<<<
 *         _assertValidNode(element)
 *         if with_tail:
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_19ElementTextIterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_19ElementTextIterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct LxmlElement *__pyx_v_element = 0;
  PyObject *__pyx_v_tag = 0;
  int __pyx_v_with_tail;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_element,&__pyx_mstate_global->__pyx_n_u_tag,&__pyx_mstate_global->__pyx_n_u_with_tail,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 3140, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 3140, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3140, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__cinit__", 0) < (0)) __PYX_ERR(0, 3140, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 2, i); __PYX_ERR(0, 3140, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 3140, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3140, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_element = ((struct LxmlElement *)values[0]);
    __pyx_v_tag = values[1];
    if (values[2]) {
      __pyx_v_with_tail = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_with_tail == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3140, __pyx_L3_error)
    } else {
      __pyx_v_with_tail = ((int)1);
    }
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 3140, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.ElementTextIterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_element), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element, 0, "element", 0))) __PYX_ERR(0, 3140, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_19ElementTextIterator___cinit__(((struct __pyx_obj_4lxml_5etree_ElementTextIterator *)__pyx_v_self), __pyx_v_element, __pyx_v_tag, __pyx_v_with_tail);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_19ElementTextIterator___cinit__(struct __pyx_obj_4lxml_5etree_ElementTextIterator *__pyx_v_self, struct LxmlElement *__pyx_v_element, PyObject *__pyx_v_tag, int __pyx_v_with_tail) {
  PyObject *__pyx_v_events = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "lxml/etree.pyx":3141
 *     cdef _Element _start_element
 *     def __cinit__(self, _Element element not None, tag=None, *, bint with_tail=True):
 *         _assertValidNode(element)             # <<<<<<<<<<<<<<
 *         if with_tail:
 *             events = ("start", "comment", "pi", "end")
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_element); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 3141, __pyx_L1_error)

  /* "lxml/etree.pyx":3142
 *     def __cinit__(self, _Element element not None, tag=None, *, bint with_tail=True):
 *         _assertValidNode(element)
 *         if with_tail:             # <<<<<<<<<<<<<<
 *             events = ("start", "comment", "pi", "end")
 *         else:
*/
  if (__pyx_v_with_tail) {

    /* "lxml/etree.pyx":3143
 *         _assertValidNode(element)
 *         if with_tail:
 *             events = ("start", "comment", "pi", "end")             # <<<<<<<<<<<<<<
 *         else:
 *             events = ("start",)
*/
    __Pyx_INCREF(__pyx_mstate_global->__pyx_tuple[4]);
    __pyx_v_events = __pyx_mstate_global->__pyx_tuple[4];

    /* "lxml/etree.pyx":3142
 *     def __cinit__(self, _Element element not None, tag=None, *, bint with_tail=True):
 *         _assertValidNode(element)
 *         if with_tail:             # <<<<<<<<<<<<<<
 *             events = ("start", "comment", "pi", "end")
 *         else:
*/
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":3145
 *             events = ("start", "comment", "pi", "end")
 *         else:
 *             events = ("start",)             # <<<<<<<<<<<<<<
 *         self._start_element = element
 *         self._events = iterwalk(element, events=events, tag=tag)
*/
  /*else*/ {
    __Pyx_INCREF(__pyx_mstate_global->__pyx_tuple[5]);
    __pyx_v_events = __pyx_mstate_global->__pyx_tuple[5];
  }
  __pyx_L3:;

  /* "lxml/etree.pyx":3146
 *         else:
 *             events = ("start",)
 *         self._start_element = element             # <<<<<<<<<<<<<<
 *         self._events = iterwalk(element, events=events, tag=tag)
 * 
*/
  __Pyx_INCREF((PyObject *)__pyx_v_element);
  __Pyx_GIVEREF((PyObject *)__pyx_v_element);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_start_element);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_start_element);
  __pyx_v_self->_start_element = __pyx_v_element;

  /* "lxml/etree.pyx":3147
 *             events = ("start",)
 *         self._start_element = element
 *         self._events = iterwalk(element, events=events, tag=tag)             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
*/
  __pyx_t_3 = NULL;
  __pyx_t_4 = 1;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_3, ((PyObject *)__pyx_v_element)};
    __pyx_t_5 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3147, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_events, __pyx_v_events, __pyx_t_5, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 3147, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_tag, __pyx_v_tag, __pyx_t_5, __pyx_callargs+2, 1) < (0)) __PYX_ERR(0, 3147, __pyx_L1_error)
    __pyx_t_2 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_iterwalk, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_5);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3147, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_2);
  }
  __Pyx_GIVEREF((PyObject *)__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_self->_events);
  __Pyx_DECREF(__pyx_v_self->_events);
  __pyx_v_self->_events = ((PyObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "lxml/etree.pyx":3140
 *     cdef object _events
 *     cdef _Element _start_element
 *     def __cinit__(self, _Element element not None, tag=None, *, bint with_tail=True):             # <<<<<<<<<<<<<<
 *         _assertValidNode(element)
 *         if with_tail:
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree.ElementTextIterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_events);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":3149
 *         self._events = iterwalk(element, events=events, tag=tag)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_19ElementTextIterator_3__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_19ElementTextIterator_3__iter__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_19ElementTextIterator_2__iter__(((struct __pyx_obj_4lxml_5etree_ElementTextIterator *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_19ElementTextIterator_2__iter__(struct __pyx_obj_4lxml_5etree_ElementTextIterator *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "lxml/etree.pyx":3150
 * 
 *     def __iter__(self):
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __next__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "lxml/etree.pyx":3149
 *         self._events = iterwalk(element, events=events, tag=tag)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":3152
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         cdef _Element element
 *         result = None
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_19ElementTextIterator_5__next__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_19ElementTextIterator_5__next__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_19ElementTextIterator_4__next__(((struct __pyx_obj_4lxml_5etree_ElementTextIterator *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_19ElementTextIterator_4__next__(struct __pyx_obj_4lxml_5etree_ElementTextIterator *__pyx_v_self) {
  struct LxmlElement *__pyx_v_element = 0;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_v_event = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *(*__pyx_t_6)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__next__", 0);

  /* "lxml/etree.pyx":3154
 *     def __next__(self):
 *         cdef _Element element
 *         result = None             # <<<<<<<<<<<<<<
 *         while result is None:
 *             event, element = next(self._events)  # raises StopIteration
*/
  __Pyx_INCREF(Py_None);
  __pyx_v_result = Py_None;

  /* "lxml/etree.pyx":3155
 *         cdef _Element element
 *         result = None
 *         while result is None:             # <<<<<<<<<<<<<<
 *             event, element = next(self._events)  # raises StopIteration
 *             if event == "start":
*/
  while (1) {
    __pyx_t_1 = (__pyx_v_result == Py_None);
    if (!__pyx_t_1) break;

    /* "lxml/etree.pyx":3156
 *         result = None
 *         while result is None:
 *             event, element = next(self._events)  # raises StopIteration             # <<<<<<<<<<<<<<
 *             if event == "start":
 *                 result = element.text
*/
    __pyx_t_2 = __pyx_v_self->_events;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyIter_Next(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3156, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
      PyObject* sequence = __pyx_t_3;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 3156, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
        __Pyx_INCREF(__pyx_t_2);
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
        __Pyx_INCREF(__pyx_t_4);
      } else {
        __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3156, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_2);
        __pyx_t_4 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3156, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_4);
      }
      #else
      __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3156, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3156, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      #endif
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_5 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3156, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_5);
      index = 0; __pyx_t_2 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_2);
      index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < (0)) __PYX_ERR(0, 3156, __pyx_L1_error)
      __pyx_t_6 = NULL;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L6_unpacking_done;
      __pyx_L5_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 3156, __pyx_L1_error)
      __pyx_L6_unpacking_done:;
    }
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element))))) __PYX_ERR(0, 3156, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_event, __pyx_t_2);
    __pyx_t_2 = 0;
    __Pyx_XDECREF_SET(__pyx_v_element, ((struct LxmlElement *)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "lxml/etree.pyx":3157
 *         while result is None:
 *             event, element = next(self._events)  # raises StopIteration
 *             if event == "start":             # <<<<<<<<<<<<<<
 *                 result = element.text
 *             elif element is not self._start_element:
*/
    __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_event, __pyx_mstate_global->__pyx_n_u_start, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 3157, __pyx_L1_error)
    if (__pyx_t_1) {

      /* "lxml/etree.pyx":3158
 *             event, element = next(self._events)  # raises StopIteration
 *             if event == "start":
 *                 result = element.text             # <<<<<<<<<<<<<<
 *             elif element is not self._start_element:
 *                 result = element.tail
*/
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_element), __pyx_mstate_global->__pyx_n_u_text); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3158, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "lxml/etree.pyx":3157
 *         while result is None:
 *             event, element = next(self._events)  # raises StopIteration
 *             if event == "start":             # <<<<<<<<<<<<<<
 *                 result = element.text
 *             elif element is not self._start_element:
*/
      goto __pyx_L7;
    }

    /* "lxml/etree.pyx":3159
 *             if event == "start":
 *                 result = element.text
 *             elif element is not self._start_element:             # <<<<<<<<<<<<<<
 *                 result = element.tail
 *         return result
*/
    __pyx_t_1 = (__pyx_v_element != __pyx_v_self->_start_element);
    if (__pyx_t_1) {

      /* "lxml/etree.pyx":3160
 *                 result = element.text
 *             elif element is not self._start_element:
 *                 result = element.tail             # <<<<<<<<<<<<<<
 *         return result
 * 
*/
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_element), __pyx_mstate_global->__pyx_n_u_tail); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3160, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "lxml/etree.pyx":3159
 *             if event == "start":
 *                 result = element.text
 *             elif element is not self._start_element:             # <<<<<<<<<<<<<<
 *                 result = element.tail
 *         return result
*/
    }
    __pyx_L7:;
  }

  /* "lxml/etree.pyx":3161
 *             elif element is not self._start_element:
 *                 result = element.tail
 *         return result             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "lxml/etree.pyx":3152
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         cdef _Element element
 *         result = None
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree.ElementTextIterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_element);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_event);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":3164
 * 
 * 
 * cdef xmlNode* _createElement(xmlDoc* c_doc, object name_utf) except NULL:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     c_node = tree.xmlNewDocNode(c_doc, NULL, _xcstr(name_utf), NULL)
*/

static xmlNode *__pyx_f_4lxml_5etree__createElement(xmlDoc *__pyx_v_c_doc, PyObject *__pyx_v_name_utf) {
  xmlNode *__pyx_v_c_node;
  xmlNode *__pyx_r;

  /* "lxml/etree.pyx":3166
 * cdef xmlNode* _createElement(xmlDoc* c_doc, object name_utf) except NULL:
 *     cdef xmlNode* c_node
 *     c_node = tree.xmlNewDocNode(c_doc, NULL, _xcstr(name_utf), NULL)             # <<<<<<<<<<<<<<
 *     return c_node
 * 
*/
  __pyx_v_c_node = xmlNewDocNode(__pyx_v_c_doc, NULL, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_name_utf), NULL);

  /* "lxml/etree.pyx":3167
 *     cdef xmlNode* c_node
 *     c_node = tree.xmlNewDocNode(c_doc, NULL, _xcstr(name_utf), NULL)
 *     return c_node             # <<<<<<<<<<<<<<
 * 
 * cdef xmlNode* _createComment(xmlDoc* c_doc, const_xmlChar* text) noexcept:
*/
  __pyx_r = __pyx_v_c_node;
  goto __pyx_L0;

  /* "lxml/etree.pyx":3164
 * 
 * 
 * cdef xmlNode* _createElement(xmlDoc* c_doc, object name_utf) except NULL:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     c_node = tree.xmlNewDocNode(c_doc, NULL, _xcstr(name_utf), NULL)
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "lxml/etree.pyx":3169
 *     return c_node
 * 
 * cdef xmlNode* _createComment(xmlDoc* c_doc, const_xmlChar* text) noexcept:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     c_node = tree.xmlNewDocComment(c_doc, text)
*/

static xmlNode *__pyx_f_4lxml_5etree__createComment(xmlDoc *__pyx_v_c_doc, const xmlChar *__pyx_v_text) {
  xmlNode *__pyx_v_c_node;
  xmlNode *__pyx_r;

  /* "lxml/etree.pyx":3171
 * cdef xmlNode* _createComment(xmlDoc* c_doc, const_xmlChar* text) noexcept:
 *     cdef xmlNode* c_node
 *     c_node = tree.xmlNewDocComment(c_doc, text)             # <<<<<<<<<<<<<<
 *     return c_node
 * 
*/
  __pyx_v_c_node = xmlNewDocComment(__pyx_v_c_doc, __pyx_v_text);

  /* "lxml/etree.pyx":3172
 *     cdef xmlNode* c_node
 *     c_node = tree.xmlNewDocComment(c_doc, text)
 *     return c_node             # <<<<<<<<<<<<<<
 * 
 * cdef xmlNode* _createPI(xmlDoc* c_doc, const_xmlChar* target, const_xmlChar* text) noexcept:
*/
  __pyx_r = __pyx_v_c_node;
  goto __pyx_L0;

  /* "lxml/etree.pyx":3169
 *     return c_node
 * 
 * cdef xmlNode* _createComment(xmlDoc* c_doc, const_xmlChar* text) noexcept:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     c_node = tree.xmlNewDocComment(c_doc, text)
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "lxml/etree.pyx":3174
 *     return c_node
 * 
 * cdef xmlNode* _createPI(xmlDoc* c_doc, const_xmlChar* target, const_xmlChar* text) noexcept:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     c_node = tree.xmlNewDocPI(c_doc, target, text)
*/

static xmlNode *__pyx_f_4lxml_5etree__createPI(xmlDoc *__pyx_v_c_doc, const xmlChar *__pyx_v_target, const xmlChar *__pyx_v_text) {
  xmlNode *__pyx_v_c_node;
  xmlNode *__pyx_r;

  /* "lxml/etree.pyx":3176
 * cdef xmlNode* _createPI(xmlDoc* c_doc, const_xmlChar* target, const_xmlChar* text) noexcept:
 *     cdef xmlNode* c_node
 *     c_node = tree.xmlNewDocPI(c_doc, target, text)             # <<<<<<<<<<<<<<
 *     return c_node
 * 
*/
  __pyx_v_c_node = xmlNewDocPI(__pyx_v_c_doc, __pyx_v_target, __pyx_v_text);

  /* "lxml/etree.pyx":3177
 *     cdef xmlNode* c_node
 *     c_node = tree.xmlNewDocPI(c_doc, target, text)
 *     return c_node             # <<<<<<<<<<<<<<
 * 
 * cdef xmlNode* _createEntity(xmlDoc* c_doc, const_xmlChar* name) noexcept:
*/
  __pyx_r = __pyx_v_c_node;
  goto __pyx_L0;

  /* "lxml/etree.pyx":3174
 *     return c_node
 * 
 * cdef xmlNode* _createPI(xmlDoc* c_doc, const_xmlChar* target, const_xmlChar* text) noexcept:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     c_node = tree.xmlNewDocPI(c_doc, target, text)
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "lxml/etree.pyx":3179
 *     return c_node
 * 
 * cdef xmlNode* _createEntity(xmlDoc* c_doc, const_xmlChar* name) noexcept:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     c_node = tree.xmlNewReference(c_doc, name)
*/

static xmlNode *__pyx_f_4lxml_5etree__createEntity(xmlDoc *__pyx_v_c_doc, const xmlChar *__pyx_v_name) {
  xmlNode *__pyx_v_c_node;
  xmlNode *__pyx_r;

  /* "lxml/etree.pyx":3181
 * cdef xmlNode* _createEntity(xmlDoc* c_doc, const_xmlChar* name) noexcept:
 *     cdef xmlNode* c_node
 *     c_node = tree.xmlNewReference(c_doc, name)             # <<<<<<<<<<<<<<
 *     return c_node
 * 
*/
  __pyx_v_c_node = xmlNewReference(__pyx_v_c_doc, __pyx_v_name);

  /* "lxml/etree.pyx":3182
 *     cdef xmlNode* c_node
 *     c_node = tree.xmlNewReference(c_doc, name)
 *     return c_node             # <<<<<<<<<<<<<<
 * 
 * # module-level API for ElementTree
*/
  __pyx_r = __pyx_v_c_node;
  goto __pyx_L0;

  /* "lxml/etree.pyx":3179
 *     return c_node
 * 
 * cdef xmlNode* _createEntity(xmlDoc* c_doc, const_xmlChar* name) noexcept:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     c_node = tree.xmlNewReference(c_doc, name)
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "lxml/etree.pyx":3208
 *     create an Element within a specific document or parser context.
 *     """
 *     def __new__(cls, _tag, attrib=None, nsmap=None, **_extra):             # <<<<<<<<<<<<<<
 *           return _makeElement(_tag, NULL, None, None, None, None,
 *                               attrib, nsmap, _extra)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7Element_1__new__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_7Element_1__new__ = {"__new__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7Element_1__new__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_7Element_1__new__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_cls = 0;
  PyObject *__pyx_v__tag = 0;
  PyObject *__pyx_v_attrib = 0;
  PyObject *__pyx_v_nsmap = 0;
  PyObject *__pyx_v__extra = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[4] = {0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__new__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  __pyx_v__extra = PyDict_New(); if (unlikely(!__pyx_v__extra)) return NULL;
  __Pyx_GOTREF(__pyx_v__extra);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_cls,&__pyx_mstate_global->__pyx_n_u_tag_2,&__pyx_mstate_global->__pyx_n_u_attrib,&__pyx_mstate_global->__pyx_n_u_nsmap,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 3208, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 3208, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 3208, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 3208, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3208, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v__extra, values, kwd_pos_args, __pyx_kwds_len, "__new__", 1) < (0)) __PYX_ERR(0, 3208, __pyx_L3_error)
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__new__", 0, 2, 4, i); __PYX_ERR(0, 3208, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 3208, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 3208, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 3208, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3208, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_cls = values[0];
    __pyx_v__tag = values[1];
    __pyx_v_attrib = values[2];
    __pyx_v_nsmap = values[3];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__new__", 0, 2, 4, __pyx_nargs); __PYX_ERR(0, 3208, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v__extra); __pyx_v__extra = 0;
  __Pyx_AddTraceback("lxml.etree.Element.__new__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_7Element___new__(__pyx_self, __pyx_v_cls, __pyx_v__tag, __pyx_v_attrib, __pyx_v_nsmap, __pyx_v__extra);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v__extra);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_7Element___new__(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_cls, PyObject *__pyx_v__tag, PyObject *__pyx_v_attrib, PyObject *__pyx_v_nsmap, PyObject *__pyx_v__extra) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__new__", 0);

  /* "lxml/etree.pyx":3209
 *     """
 *     def __new__(cls, _tag, attrib=None, nsmap=None, **_extra):
 *           return _makeElement(_tag, NULL, None, None, None, None,             # <<<<<<<<<<<<<<
 *                               attrib, nsmap, _extra)
 * 
*/
  __Pyx_XDECREF(__pyx_r);

  /* "lxml/etree.pyx":3210
 *     def __new__(cls, _tag, attrib=None, nsmap=None, **_extra):
 *           return _makeElement(_tag, NULL, None, None, None, None,
 *                               attrib, nsmap, _extra)             # <<<<<<<<<<<<<<
 * 
 * # Register _Element as a virtual subclass of Element
*/
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__makeElement(__pyx_v__tag, NULL, ((struct LxmlDocument *)Py_None), ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None), Py_None, Py_None, __pyx_v_attrib, __pyx_v_nsmap, __pyx_v__extra)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3209, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":3208
 *     create an Element within a specific document or parser context.
 *     """
 *     def __new__(cls, _tag, attrib=None, nsmap=None, **_extra):             # <<<<<<<<<<<<<<
 *           return _makeElement(_tag, NULL, None, None, None, None,
 *                               attrib, nsmap, _extra)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.Element.__new__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":3216
 * 
 * 
 * def Comment(text=None):             # <<<<<<<<<<<<<<
 *     """Comment(text=None)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7Comment(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_6Comment, "Comment(text=None)\n\n    Comment element factory. This factory function creates a special element that will\n    be serialized as an XML comment.\n    ");
static PyMethodDef __pyx_mdef_4lxml_5etree_7Comment = {"Comment", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7Comment, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_6Comment};
static PyObject *__pyx_pw_4lxml_5etree_7Comment(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_text = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Comment (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_text,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 3216, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3216, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "Comment", 0) < (0)) __PYX_ERR(0, 3216, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
    } else {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3216, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_text = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("Comment", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 3216, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.Comment", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_6Comment(__pyx_self, __pyx_v_text);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_6Comment(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_text) {
  struct LxmlDocument *__pyx_v_doc = 0;
  xmlNode *__pyx_v_c_node;
  xmlDoc *__pyx_v_c_doc;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  xmlDoc *__pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("Comment", 0);
  __Pyx_INCREF(__pyx_v_text);

  /* "lxml/etree.pyx":3226
 *     cdef xmlDoc*   c_doc
 * 
 *     if text is None:             # <<<<<<<<<<<<<<
 *         text = b''
 *     else:
*/
  __pyx_t_1 = (__pyx_v_text == Py_None);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":3227
 * 
 *     if text is None:
 *         text = b''             # <<<<<<<<<<<<<<
 *     else:
 *         text = _utf8(text)
*/
    __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_b__8);
    __Pyx_DECREF_SET(__pyx_v_text, __pyx_mstate_global->__pyx_kp_b__8);

    /* "lxml/etree.pyx":3226
 *     cdef xmlDoc*   c_doc
 * 
 *     if text is None:             # <<<<<<<<<<<<<<
 *         text = b''
 *     else:
*/
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":3229
 *         text = b''
 *     else:
 *         text = _utf8(text)             # <<<<<<<<<<<<<<
 *         if b'--' in text or text.endswith(b'-'):
 *             raise ValueError("Comment may not contain '--' or end with '-'")
*/
  /*else*/ {
    __pyx_t_2 = __pyx_f_4lxml_5etree__utf8(__pyx_v_text); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3229, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_text, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "lxml/etree.pyx":3230
 *     else:
 *         text = _utf8(text)
 *         if b'--' in text or text.endswith(b'-'):             # <<<<<<<<<<<<<<
 *             raise ValueError("Comment may not contain '--' or end with '-'")
 * 
*/
    __pyx_t_3 = (__Pyx_PySequence_ContainsTF(__pyx_mstate_global->__pyx_kp_b__26, __pyx_v_text, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 3230, __pyx_L1_error)
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_4 = __pyx_v_text;
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_5 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_b__6};
      __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_endswith, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3230, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 3230, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_1 = __pyx_t_3;
    __pyx_L5_bool_binop_done:;
    if (unlikely(__pyx_t_1)) {

      /* "lxml/etree.pyx":3231
 *         text = _utf8(text)
 *         if b'--' in text or text.endswith(b'-'):
 *             raise ValueError("Comment may not contain '--' or end with '-'")             # <<<<<<<<<<<<<<
 * 
 *     c_doc = _newXMLDoc()
*/
      __pyx_t_4 = NULL;
      __pyx_t_5 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Comment_may_not_contain_or_end_w};
        __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3231, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(0, 3231, __pyx_L1_error)

      /* "lxml/etree.pyx":3230
 *     else:
 *         text = _utf8(text)
 *         if b'--' in text or text.endswith(b'-'):             # <<<<<<<<<<<<<<
 *             raise ValueError("Comment may not contain '--' or end with '-'")
 * 
*/
    }
  }
  __pyx_L3:;

  /* "lxml/etree.pyx":3233
 *             raise ValueError("Comment may not contain '--' or end with '-'")
 * 
 *     c_doc = _newXMLDoc()             # <<<<<<<<<<<<<<
 *     doc = _documentFactory(c_doc, None)
 *     c_node = _createComment(c_doc, _xcstr(text))
*/
  __pyx_t_6 = __pyx_f_4lxml_5etree__newXMLDoc(); if (unlikely(__pyx_t_6 == ((void *)NULL))) __PYX_ERR(0, 3233, __pyx_L1_error)
  __pyx_v_c_doc = __pyx_t_6;

  /* "lxml/etree.pyx":3234
 * 
 *     c_doc = _newXMLDoc()
 *     doc = _documentFactory(c_doc, None)             # <<<<<<<<<<<<<<
 *     c_node = _createComment(c_doc, _xcstr(text))
 *     tree.xmlAddChild(<xmlNode*>c_doc, c_node)
*/
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3234, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "lxml/etree.pyx":3235
 *     c_doc = _newXMLDoc()
 *     doc = _documentFactory(c_doc, None)
 *     c_node = _createComment(c_doc, _xcstr(text))             # <<<<<<<<<<<<<<
 *     tree.xmlAddChild(<xmlNode*>c_doc, c_node)
 *     return _elementFactory(doc, c_node)
*/
  __pyx_v_c_node = __pyx_f_4lxml_5etree__createComment(__pyx_v_c_doc, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_text));

  /* "lxml/etree.pyx":3236
 *     doc = _documentFactory(c_doc, None)
 *     c_node = _createComment(c_doc, _xcstr(text))
 *     tree.xmlAddChild(<xmlNode*>c_doc, c_node)             # <<<<<<<<<<<<<<
 *     return _elementFactory(doc, c_node)
 * 
*/
  (void)(xmlAddChild(((xmlNode *)__pyx_v_c_doc), __pyx_v_c_node));

  /* "lxml/etree.pyx":3237
 *     c_node = _createComment(c_doc, _xcstr(text))
 *     tree.xmlAddChild(<xmlNode*>c_doc, c_node)
 *     return _elementFactory(doc, c_node)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(__pyx_v_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3237, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":3216
 * 
 * 
 * def Comment(text=None):             # <<<<<<<<<<<<<<
 *     """Comment(text=None)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.Comment", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XDECREF(__pyx_v_text);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":3240
 * 
 * 
 * def ProcessingInstruction(target, text=None):             # <<<<<<<<<<<<<<
 *     """ProcessingInstruction(target, text=None)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9ProcessingInstruction(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8ProcessingInstruction, "ProcessingInstruction(target, text=None)\n\n    ProcessingInstruction element factory. This factory function creates a\n    special element that will be serialized as an XML processing instruction.\n    ");
static PyMethodDef __pyx_mdef_4lxml_5etree_9ProcessingInstruction = {"ProcessingInstruction", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_9ProcessingInstruction, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8ProcessingInstruction};
static PyObject *__pyx_pw_4lxml_5etree_9ProcessingInstruction(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_target = 0;
  PyObject *__pyx_v_text = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ProcessingInstruction (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_target,&__pyx_mstate_global->__pyx_n_u_text,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 3240, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 3240, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3240, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "ProcessingInstruction", 0) < (0)) __PYX_ERR(0, 3240, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("ProcessingInstruction", 0, 1, 2, i); __PYX_ERR(0, 3240, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 3240, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3240, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_target = values[0];
    __pyx_v_text = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ProcessingInstruction", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 3240, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.ProcessingInstruction", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_8ProcessingInstruction(__pyx_self, __pyx_v_target, __pyx_v_text);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8ProcessingInstruction(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_target, PyObject *__pyx_v_text) {
  struct LxmlDocument *__pyx_v_doc = 0;
  xmlNode *__pyx_v_c_node;
  xmlDoc *__pyx_v_c_doc;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6[3];
  xmlDoc *__pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("ProcessingInstruction", 0);
  __Pyx_INCREF(__pyx_v_target);
  __Pyx_INCREF(__pyx_v_text);

  /* "lxml/etree.pyx":3250
 *     cdef xmlDoc*   c_doc
 * 
 *     target = _utf8(target)             # <<<<<<<<<<<<<<
 *     _tagValidOrRaise(target)
 *     if target.lower() == b'xml':
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__utf8(__pyx_v_target); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3250, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_target, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "lxml/etree.pyx":3251
 * 
 *     target = _utf8(target)
 *     _tagValidOrRaise(target)             # <<<<<<<<<<<<<<
 *     if target.lower() == b'xml':
 *         raise ValueError, f"Invalid PI name '{target}'"
*/
  __pyx_t_2 = __pyx_f_4lxml_5etree__tagValidOrRaise(__pyx_v_target); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 3251, __pyx_L1_error)

  /* "lxml/etree.pyx":3252
 *     target = _utf8(target)
 *     _tagValidOrRaise(target)
 *     if target.lower() == b'xml':             # <<<<<<<<<<<<<<
 *         raise ValueError, f"Invalid PI name '{target}'"
 * 
*/
  __pyx_t_3 = __pyx_v_target;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_lower, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3252, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_5 = (__Pyx_PyBytes_Equals(__pyx_t_1, __pyx_mstate_global->__pyx_n_b_xml, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 3252, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(__pyx_t_5)) {

    /* "lxml/etree.pyx":3253
 *     _tagValidOrRaise(target)
 *     if target.lower() == b'xml':
 *         raise ValueError, f"Invalid PI name '{target}'"             # <<<<<<<<<<<<<<
 * 
 *     if text is None:
*/
    __pyx_t_1 = __Pyx_PyObject_FormatSimple(__pyx_v_target, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3253, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6[0] = __pyx_mstate_global->__pyx_kp_u_Invalid_PI_name;
    __pyx_t_6[1] = __pyx_t_1;
    __pyx_t_6[2] = __pyx_mstate_global->__pyx_kp_u__4;
    __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_6, 3, 17 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1));
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3253, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_t_3, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(0, 3253, __pyx_L1_error)

    /* "lxml/etree.pyx":3252
 *     target = _utf8(target)
 *     _tagValidOrRaise(target)
 *     if target.lower() == b'xml':             # <<<<<<<<<<<<<<
 *         raise ValueError, f"Invalid PI name '{target}'"
 * 
*/
  }

  /* "lxml/etree.pyx":3255
 *         raise ValueError, f"Invalid PI name '{target}'"
 * 
 *     if text is None:             # <<<<<<<<<<<<<<
 *         text = b''
 *     else:
*/
  __pyx_t_5 = (__pyx_v_text == Py_None);
  if (__pyx_t_5) {

    /* "lxml/etree.pyx":3256
 * 
 *     if text is None:
 *         text = b''             # <<<<<<<<<<<<<<
 *     else:
 *         text = _utf8(text)
*/
    __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_b__8);
    __Pyx_DECREF_SET(__pyx_v_text, __pyx_mstate_global->__pyx_kp_b__8);

    /* "lxml/etree.pyx":3255
 *         raise ValueError, f"Invalid PI name '{target}'"
 * 
 *     if text is None:             # <<<<<<<<<<<<<<
 *         text = b''
 *     else:
*/
    goto __pyx_L4;
  }

  /* "lxml/etree.pyx":3258
 *         text = b''
 *     else:
 *         text = _utf8(text)             # <<<<<<<<<<<<<<
 *         if b'?>' in text:
 *             raise ValueError, "PI text must not contain '?>'"
*/
  /*else*/ {
    __pyx_t_3 = __pyx_f_4lxml_5etree__utf8(__pyx_v_text); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3258, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_text, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "lxml/etree.pyx":3259
 *     else:
 *         text = _utf8(text)
 *         if b'?>' in text:             # <<<<<<<<<<<<<<
 *             raise ValueError, "PI text must not contain '?>'"
 * 
*/
    __pyx_t_5 = (__Pyx_PySequence_ContainsTF(__pyx_mstate_global->__pyx_kp_b__18, __pyx_v_text, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 3259, __pyx_L1_error)
    if (unlikely(__pyx_t_5)) {

      /* "lxml/etree.pyx":3260
 *         text = _utf8(text)
 *         if b'?>' in text:
 *             raise ValueError, "PI text must not contain '?>'"             # <<<<<<<<<<<<<<
 * 
 *     c_doc = _newXMLDoc()
*/
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_PI_text_must_not_contain, 0, 0);
      __PYX_ERR(0, 3260, __pyx_L1_error)

      /* "lxml/etree.pyx":3259
 *     else:
 *         text = _utf8(text)
 *         if b'?>' in text:             # <<<<<<<<<<<<<<
 *             raise ValueError, "PI text must not contain '?>'"
 * 
*/
    }
  }
  __pyx_L4:;

  /* "lxml/etree.pyx":3262
 *             raise ValueError, "PI text must not contain '?>'"
 * 
 *     c_doc = _newXMLDoc()             # <<<<<<<<<<<<<<
 *     doc = _documentFactory(c_doc, None)
 *     c_node = _createPI(c_doc, _xcstr(target), _xcstr(text))
*/
  __pyx_t_7 = __pyx_f_4lxml_5etree__newXMLDoc(); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(0, 3262, __pyx_L1_error)
  __pyx_v_c_doc = __pyx_t_7;

  /* "lxml/etree.pyx":3263
 * 
 *     c_doc = _newXMLDoc()
 *     doc = _documentFactory(c_doc, None)             # <<<<<<<<<<<<<<
 *     c_node = _createPI(c_doc, _xcstr(target), _xcstr(text))
 *     tree.xmlAddChild(<xmlNode*>c_doc, c_node)
*/
  __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3263, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "lxml/etree.pyx":3264
 *     c_doc = _newXMLDoc()
 *     doc = _documentFactory(c_doc, None)
 *     c_node = _createPI(c_doc, _xcstr(target), _xcstr(text))             # <<<<<<<<<<<<<<
 *     tree.xmlAddChild(<xmlNode*>c_doc, c_node)
 *     return _elementFactory(doc, c_node)
*/
  __pyx_v_c_node = __pyx_f_4lxml_5etree__createPI(__pyx_v_c_doc, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_target), (const xmlChar*)PyBytes_AS_STRING(__pyx_v_text));

  /* "lxml/etree.pyx":3265
 *     doc = _documentFactory(c_doc, None)
 *     c_node = _createPI(c_doc, _xcstr(target), _xcstr(text))
 *     tree.xmlAddChild(<xmlNode*>c_doc, c_node)             # <<<<<<<<<<<<<<
 *     return _elementFactory(doc, c_node)
 * 
*/
  (void)(xmlAddChild(((xmlNode *)__pyx_v_c_doc), __pyx_v_c_node));

  /* "lxml/etree.pyx":3266
 *     c_node = _createPI(c_doc, _xcstr(target), _xcstr(text))
 *     tree.xmlAddChild(<xmlNode*>c_doc, c_node)
 *     return _elementFactory(doc, c_node)             # <<<<<<<<<<<<<<
 * 
 * PI = ProcessingInstruction
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(__pyx_v_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3266, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":3240
 * 
 * 
 * def ProcessingInstruction(target, text=None):             # <<<<<<<<<<<<<<
 *     """ProcessingInstruction(target, text=None)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.ProcessingInstruction", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XDECREF(__pyx_v_target);
  __Pyx_XDECREF(__pyx_v_text);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":3286
 *     """
 *     cdef bytes _utf8_data
 *     def __cinit__(self, data):             # <<<<<<<<<<<<<<
 *         self._utf8_data = _utf8(data)
 * 
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_5CDATA_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_5CDATA_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_data = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_data,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 3286, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3286, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__cinit__", 0) < (0)) __PYX_ERR(0, 3286, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, i); __PYX_ERR(0, 3286, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3286, __pyx_L3_error)
    }
    __pyx_v_data = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 3286, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.CDATA.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_5CDATA___cinit__(((struct __pyx_obj_4lxml_5etree_CDATA *)__pyx_v_self), __pyx_v_data);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_5CDATA___cinit__(struct __pyx_obj_4lxml_5etree_CDATA *__pyx_v_self, PyObject *__pyx_v_data) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "lxml/etree.pyx":3287
 *     cdef bytes _utf8_data
 *     def __cinit__(self, data):
 *         self._utf8_data = _utf8(data)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__utf8(__pyx_v_data); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3287, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_utf8_data);
  __Pyx_DECREF(__pyx_v_self->_utf8_data);
  __pyx_v_self->_utf8_data = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "lxml/etree.pyx":3286
 *     """
 *     cdef bytes _utf8_data
 *     def __cinit__(self, data):             # <<<<<<<<<<<<<<
 *         self._utf8_data = _utf8(data)
 * 
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.CDATA.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":3290
 * 
 * 
 * def Entity(name):             # <<<<<<<<<<<<<<
 *     """Entity(name)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_11Entity(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_10Entity, "Entity(name)\n\n    Entity factory.  This factory function creates a special element\n    that will be serialized as an XML entity reference or character\n    reference.  Note, however, that entities will not be automatically\n    declared in the document.  A document that uses entity references\n    requires a DTD to define the entities.\n    ");
static PyMethodDef __pyx_mdef_4lxml_5etree_11Entity = {"Entity", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_11Entity, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_10Entity};
static PyObject *__pyx_pw_4lxml_5etree_11Entity(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_name = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Entity (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_name,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 3290, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3290, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "Entity", 0) < (0)) __PYX_ERR(0, 3290, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("Entity", 1, 1, 1, i); __PYX_ERR(0, 3290, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3290, __pyx_L3_error)
    }
    __pyx_v_name = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("Entity", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 3290, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.Entity", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_10Entity(__pyx_self, __pyx_v_name);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_10Entity(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_name) {
  struct LxmlDocument *__pyx_v_doc = 0;
  xmlNode *__pyx_v_c_node;
  xmlDoc *__pyx_v_c_doc;
  PyObject *__pyx_v_name_utf = NULL;
  const xmlChar *__pyx_v_c_name;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3[3];
  PyObject *__pyx_t_4 = NULL;
  xmlDoc *__pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("Entity", 0);

  /* "lxml/etree.pyx":3302
 *     cdef xmlNode*  c_node
 *     cdef xmlDoc*   c_doc
 *     name_utf = _utf8(name)             # <<<<<<<<<<<<<<
 *     c_name = _xcstr(name_utf)
 *     if c_name[0] == c'#':
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__utf8(__pyx_v_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3302, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_name_utf = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "lxml/etree.pyx":3303
 *     cdef xmlDoc*   c_doc
 *     name_utf = _utf8(name)
 *     c_name = _xcstr(name_utf)             # <<<<<<<<<<<<<<
 *     if c_name[0] == c'#':
 *         if not _characterReferenceIsValid(c_name + 1):
*/
  __pyx_v_c_name = (const xmlChar*)PyBytes_AS_STRING(__pyx_v_name_utf);

  /* "lxml/etree.pyx":3304
 *     name_utf = _utf8(name)
 *     c_name = _xcstr(name_utf)
 *     if c_name[0] == c'#':             # <<<<<<<<<<<<<<
 *         if not _characterReferenceIsValid(c_name + 1):
 *             raise ValueError, f"Invalid character reference: '{name}'"
*/
  __pyx_t_2 = ((__pyx_v_c_name[0]) == '#');
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":3305
 *     c_name = _xcstr(name_utf)
 *     if c_name[0] == c'#':
 *         if not _characterReferenceIsValid(c_name + 1):             # <<<<<<<<<<<<<<
 *             raise ValueError, f"Invalid character reference: '{name}'"
 *     elif not _xmlNameIsValid(c_name):
*/
    __pyx_t_2 = (!__pyx_f_4lxml_5etree__characterReferenceIsValid((__pyx_v_c_name + 1)));
    if (unlikely(__pyx_t_2)) {

      /* "lxml/etree.pyx":3306
 *     if c_name[0] == c'#':
 *         if not _characterReferenceIsValid(c_name + 1):
 *             raise ValueError, f"Invalid character reference: '{name}'"             # <<<<<<<<<<<<<<
 *     elif not _xmlNameIsValid(c_name):
 *         raise ValueError, f"Invalid entity reference: '{name}'"
*/
      __pyx_t_1 = __Pyx_PyObject_FormatSimple(__pyx_v_name, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3306, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3[0] = __pyx_mstate_global->__pyx_kp_u_Invalid_character_reference;
      __pyx_t_3[1] = __pyx_t_1;
      __pyx_t_3[2] = __pyx_mstate_global->__pyx_kp_u__4;
      __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, 30 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1));
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3306, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_t_4, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __PYX_ERR(0, 3306, __pyx_L1_error)

      /* "lxml/etree.pyx":3305
 *     c_name = _xcstr(name_utf)
 *     if c_name[0] == c'#':
 *         if not _characterReferenceIsValid(c_name + 1):             # <<<<<<<<<<<<<<
 *             raise ValueError, f"Invalid character reference: '{name}'"
 *     elif not _xmlNameIsValid(c_name):
*/
    }

    /* "lxml/etree.pyx":3304
 *     name_utf = _utf8(name)
 *     c_name = _xcstr(name_utf)
 *     if c_name[0] == c'#':             # <<<<<<<<<<<<<<
 *         if not _characterReferenceIsValid(c_name + 1):
 *             raise ValueError, f"Invalid character reference: '{name}'"
*/
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":3307
 *         if not _characterReferenceIsValid(c_name + 1):
 *             raise ValueError, f"Invalid character reference: '{name}'"
 *     elif not _xmlNameIsValid(c_name):             # <<<<<<<<<<<<<<
 *         raise ValueError, f"Invalid entity reference: '{name}'"
 *     c_doc = _newXMLDoc()
*/
  __pyx_t_2 = (!(__pyx_f_4lxml_5etree__xmlNameIsValid(__pyx_v_c_name) != 0));
  if (unlikely(__pyx_t_2)) {

    /* "lxml/etree.pyx":3308
 *             raise ValueError, f"Invalid character reference: '{name}'"
 *     elif not _xmlNameIsValid(c_name):
 *         raise ValueError, f"Invalid entity reference: '{name}'"             # <<<<<<<<<<<<<<
 *     c_doc = _newXMLDoc()
 *     doc = _documentFactory(c_doc, None)
*/
    __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_name, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3308, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3[0] = __pyx_mstate_global->__pyx_kp_u_Invalid_entity_reference;
    __pyx_t_3[1] = __pyx_t_4;
    __pyx_t_3[2] = __pyx_mstate_global->__pyx_kp_u__4;
    __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, 27 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4));
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3308, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_t_1, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 3308, __pyx_L1_error)

    /* "lxml/etree.pyx":3307
 *         if not _characterReferenceIsValid(c_name + 1):
 *             raise ValueError, f"Invalid character reference: '{name}'"
 *     elif not _xmlNameIsValid(c_name):             # <<<<<<<<<<<<<<
 *         raise ValueError, f"Invalid entity reference: '{name}'"
 *     c_doc = _newXMLDoc()
*/
  }
  __pyx_L3:;

  /* "lxml/etree.pyx":3309
 *     elif not _xmlNameIsValid(c_name):
 *         raise ValueError, f"Invalid entity reference: '{name}'"
 *     c_doc = _newXMLDoc()             # <<<<<<<<<<<<<<
 *     doc = _documentFactory(c_doc, None)
 *     c_node = _createEntity(c_doc, c_name)
*/
  __pyx_t_5 = __pyx_f_4lxml_5etree__newXMLDoc(); if (unlikely(__pyx_t_5 == ((void *)NULL))) __PYX_ERR(0, 3309, __pyx_L1_error)
  __pyx_v_c_doc = __pyx_t_5;

  /* "lxml/etree.pyx":3310
 *         raise ValueError, f"Invalid entity reference: '{name}'"
 *     c_doc = _newXMLDoc()
 *     doc = _documentFactory(c_doc, None)             # <<<<<<<<<<<<<<
 *     c_node = _createEntity(c_doc, c_name)
 *     tree.xmlAddChild(<xmlNode*>c_doc, c_node)
*/
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "lxml/etree.pyx":3311
 *     c_doc = _newXMLDoc()
 *     doc = _documentFactory(c_doc, None)
 *     c_node = _createEntity(c_doc, c_name)             # <<<<<<<<<<<<<<
 *     tree.xmlAddChild(<xmlNode*>c_doc, c_node)
 *     return _elementFactory(doc, c_node)
*/
  __pyx_v_c_node = __pyx_f_4lxml_5etree__createEntity(__pyx_v_c_doc, __pyx_v_c_name);

  /* "lxml/etree.pyx":3312
 *     doc = _documentFactory(c_doc, None)
 *     c_node = _createEntity(c_doc, c_name)
 *     tree.xmlAddChild(<xmlNode*>c_doc, c_node)             # <<<<<<<<<<<<<<
 *     return _elementFactory(doc, c_node)
 * 
*/
  (void)(xmlAddChild(((xmlNode *)__pyx_v_c_doc), __pyx_v_c_node));

  /* "lxml/etree.pyx":3313
 *     c_node = _createEntity(c_doc, c_name)
 *     tree.xmlAddChild(<xmlNode*>c_doc, c_node)
 *     return _elementFactory(doc, c_node)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(__pyx_v_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3313, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":3290
 * 
 * 
 * def Entity(name):             # <<<<<<<<<<<<<<
 *     """Entity(name)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.Entity", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XDECREF(__pyx_v_name_utf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":3316
 * 
 * 
 * def SubElement(_Element _parent not None, _tag,             # <<<<<<<<<<<<<<
 *                attrib=None, nsmap=None, **_extra):
 *     """SubElement(_parent, _tag, attrib=None, nsmap=None, **_extra)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_13SubElement(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_12SubElement, "SubElement(_parent, _tag, attrib=None, nsmap=None, **_extra)\n\n    Subelement factory.  This function creates an element instance, and\n    appends it to an existing element.\n    ");
static PyMethodDef __pyx_mdef_4lxml_5etree_13SubElement = {"SubElement", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_13SubElement, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12SubElement};
static PyObject *__pyx_pw_4lxml_5etree_13SubElement(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct LxmlElement *__pyx_v__parent = 0;
  PyObject *__pyx_v__tag = 0;
  PyObject *__pyx_v_attrib = 0;
  PyObject *__pyx_v_nsmap = 0;
  PyObject *__pyx_v__extra = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[4] = {0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("SubElement (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  __pyx_v__extra = PyDict_New(); if (unlikely(!__pyx_v__extra)) return NULL;
  __Pyx_GOTREF(__pyx_v__extra);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_parent,&__pyx_mstate_global->__pyx_n_u_tag_2,&__pyx_mstate_global->__pyx_n_u_attrib,&__pyx_mstate_global->__pyx_n_u_nsmap,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 3316, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 3316, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 3316, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 3316, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3316, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v__extra, values, kwd_pos_args, __pyx_kwds_len, "SubElement", 1) < (0)) __PYX_ERR(0, 3316, __pyx_L3_error)

      /* "lxml/etree.pyx":3317
 * 
 * def SubElement(_Element _parent not None, _tag,
 *                attrib=None, nsmap=None, **_extra):             # <<<<<<<<<<<<<<
 *     """SubElement(_parent, _tag, attrib=None, nsmap=None, **_extra)
 * 
*/
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("SubElement", 0, 2, 4, i); __PYX_ERR(0, 3316, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 3316, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 3316, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 3316, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3316, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v__parent = ((struct LxmlElement *)values[0]);
    __pyx_v__tag = values[1];
    __pyx_v_attrib = values[2];
    __pyx_v_nsmap = values[3];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("SubElement", 0, 2, 4, __pyx_nargs); __PYX_ERR(0, 3316, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v__extra); __pyx_v__extra = 0;
  __Pyx_AddTraceback("lxml.etree.SubElement", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v__parent), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element, 0, "_parent", 0))) __PYX_ERR(0, 3316, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_12SubElement(__pyx_self, __pyx_v__parent, __pyx_v__tag, __pyx_v_attrib, __pyx_v_nsmap, __pyx_v__extra);

  /* "lxml/etree.pyx":3316
 * 
 * 
 * def SubElement(_Element _parent not None, _tag,             # <<<<<<<<<<<<<<
 *                attrib=None, nsmap=None, **_extra):
 *     """SubElement(_parent, _tag, attrib=None, nsmap=None, **_extra)
*/

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_DECREF(__pyx_v__extra);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_12SubElement(CYTHON_UNUSED PyObject *__pyx_self, struct LxmlElement *__pyx_v__parent, PyObject *__pyx_v__tag, PyObject *__pyx_v_attrib, PyObject *__pyx_v_nsmap, PyObject *__pyx_v__extra) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("SubElement", 0);

  /* "lxml/etree.pyx":3323
 *     appends it to an existing element.
 *     """
 *     return _makeSubElement(_parent, _tag, None, None, attrib, nsmap, _extra)             # <<<<<<<<<<<<<<
 * 
 * from typing import Generic, TypeVar
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__makeSubElement(__pyx_v__parent, __pyx_v__tag, Py_None, Py_None, __pyx_v_attrib, __pyx_v_nsmap, __pyx_v__extra)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3323, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":3316
 * 
 * 
 * def SubElement(_Element _parent not None, _tag,             # <<<<<<<<<<<<<<
 *                attrib=None, nsmap=None, **_extra):
 *     """SubElement(_parent, _tag, attrib=None, nsmap=None, **_extra)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.SubElement", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":3330
 * 
 * class ElementTree(ABC, Generic[T]):
 *     def __new__(cls, _Element element=None, *, file=None, _BaseParser parser=None):             # <<<<<<<<<<<<<<
 *         """ElementTree(element=None, file=None, parser=None)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_11ElementTree_1__new__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_11ElementTree___new__, "ElementTree(element=None, file=None, parser=None)\n\n        ElementTree wrapper class.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_11ElementTree_1__new__ = {"__new__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_11ElementTree_1__new__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_11ElementTree___new__};
static PyObject *__pyx_pw_4lxml_5etree_11ElementTree_1__new__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_cls = 0;
  struct LxmlElement *__pyx_v_element = 0;
  PyObject *__pyx_v_file = 0;
  struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[4] = {0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__new__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_cls,&__pyx_mstate_global->__pyx_n_u_element,&__pyx_mstate_global->__pyx_n_u_file,&__pyx_mstate_global->__pyx_n_u_parser,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 3330, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 3330, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3330, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__new__", 0) < (0)) __PYX_ERR(0, 3330, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef((PyObject *)((struct LxmlElement *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[3]) values[3] = __Pyx_NewRef((PyObject *)((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__new__", 0, 1, 2, i); __PYX_ERR(0, 3330, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 3330, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3330, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef((PyObject *)((struct LxmlElement *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[3]) values[3] = __Pyx_NewRef((PyObject *)((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None));
    }
    __pyx_v_cls = values[0];
    __pyx_v_element = ((struct LxmlElement *)values[1]);
    __pyx_v_file = values[2];
    __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)values[3]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__new__", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 3330, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.ElementTree.__new__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_element), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element, 1, "element", 0))) __PYX_ERR(0, 3330, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parser), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__BaseParser, 1, "parser", 0))) __PYX_ERR(0, 3330, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_11ElementTree___new__(__pyx_self, __pyx_v_cls, __pyx_v_element, __pyx_v_file, __pyx_v_parser);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_11ElementTree___new__(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_cls, struct LxmlElement *__pyx_v_element, PyObject *__pyx_v_file, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser) {
  xmlDoc *__pyx_v_c_doc;
  struct LxmlDocument *__pyx_v_doc = 0;
  PyObject *__pyx_v_result_container = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  int __pyx_t_10;
  char const *__pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  xmlDoc *__pyx_t_18;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__new__", 0);

  /* "lxml/etree.pyx":3342
 *         cdef _Document doc
 * 
 *         if element is not None:             # <<<<<<<<<<<<<<
 *             doc  = element._doc
 *         elif file is not None:
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_element) != Py_None);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":3343
 * 
 *         if element is not None:
 *             doc  = element._doc             # <<<<<<<<<<<<<<
 *         elif file is not None:
 *             try:
*/
    __pyx_t_2 = ((PyObject *)__pyx_v_element->_doc);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "lxml/etree.pyx":3342
 *         cdef _Document doc
 * 
 *         if element is not None:             # <<<<<<<<<<<<<<
 *             doc  = element._doc
 *         elif file is not None:
*/
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":3344
 *         if element is not None:
 *             doc  = element._doc
 *         elif file is not None:             # <<<<<<<<<<<<<<
 *             try:
 *                 doc = _parseDocument(file, parser, None)
*/
  __pyx_t_1 = (__pyx_v_file != Py_None);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":3345
 *             doc  = element._doc
 *         elif file is not None:
 *             try:             # <<<<<<<<<<<<<<
 *                 doc = _parseDocument(file, parser, None)
 *             except _TargetParserResult as result_container:
*/
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_5);
      /*try:*/ {

        /* "lxml/etree.pyx":3346
 *         elif file is not None:
 *             try:
 *                 doc = _parseDocument(file, parser, None)             # <<<<<<<<<<<<<<
 *             except _TargetParserResult as result_container:
 *                 return result_container.result
*/
        __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__parseDocument(__pyx_v_file, __pyx_v_parser, Py_None)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3346, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_2);
        __pyx_t_2 = 0;

        /* "lxml/etree.pyx":3345
 *             doc  = element._doc
 *         elif file is not None:
 *             try:             # <<<<<<<<<<<<<<
 *                 doc = _parseDocument(file, parser, None)
 *             except _TargetParserResult as result_container:
*/
      }
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L9_try_end;
      __pyx_L4_error:;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "lxml/etree.pyx":3347
 *             try:
 *                 doc = _parseDocument(file, parser, None)
 *             except _TargetParserResult as result_container:             # <<<<<<<<<<<<<<
 *                 return result_container.result
 *         else:
*/
      __Pyx_ErrFetch(&__pyx_t_2, &__pyx_t_6, &__pyx_t_7);
      __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_TargetParserResult); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3347, __pyx_L6_except_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_2, __pyx_t_8);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_ErrRestore(__pyx_t_2, __pyx_t_6, __pyx_t_7);
      __pyx_t_2 = 0; __pyx_t_6 = 0; __pyx_t_7 = 0;
      if (__pyx_t_9) {
        __Pyx_AddTraceback("lxml.etree.ElementTree.__new__", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_6, &__pyx_t_2) < 0) __PYX_ERR(0, 3347, __pyx_L6_except_error)
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_6);
        __Pyx_XGOTREF(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_6);
        __pyx_v_result_container = __pyx_t_6;
        /*try:*/ {

          /* "lxml/etree.pyx":3348
 *                 doc = _parseDocument(file, parser, None)
 *             except _TargetParserResult as result_container:
 *                 return result_container.result             # <<<<<<<<<<<<<<
 *         else:
 *             c_doc = _newXMLDoc()
*/
          __Pyx_XDECREF(__pyx_r);
          __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_result_container, __pyx_mstate_global->__pyx_n_u_result); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3348, __pyx_L15_error)
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_r = __pyx_t_8;
          __pyx_t_8 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          goto __pyx_L14_return;
        }

        /* "lxml/etree.pyx":3347
 *             try:
 *                 doc = _parseDocument(file, parser, None)
 *             except _TargetParserResult as result_container:             # <<<<<<<<<<<<<<
 *                 return result_container.result
 *         else:
*/
        /*finally:*/ {
          __pyx_L15_error:;
          /*exception exit:*/{
            __Pyx_PyThreadState_declare
            __Pyx_PyThreadState_assign
            __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0;
            __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
             __Pyx_ExceptionSwap(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17);
            if ( unlikely(__Pyx_GetException(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14) < 0)) __Pyx_ErrFetch(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
            __Pyx_XGOTREF(__pyx_t_12);
            __Pyx_XGOTREF(__pyx_t_13);
            __Pyx_XGOTREF(__pyx_t_14);
            __Pyx_XGOTREF(__pyx_t_15);
            __Pyx_XGOTREF(__pyx_t_16);
            __Pyx_XGOTREF(__pyx_t_17);
            __pyx_t_9 = __pyx_lineno; __pyx_t_10 = __pyx_clineno; __pyx_t_11 = __pyx_filename;
            {
              __Pyx_DECREF(__pyx_v_result_container); __pyx_v_result_container = 0;
            }
            __Pyx_XGIVEREF(__pyx_t_15);
            __Pyx_XGIVEREF(__pyx_t_16);
            __Pyx_XGIVEREF(__pyx_t_17);
            __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17);
            __Pyx_XGIVEREF(__pyx_t_12);
            __Pyx_XGIVEREF(__pyx_t_13);
            __Pyx_XGIVEREF(__pyx_t_14);
            __Pyx_ErrRestore(__pyx_t_12, __pyx_t_13, __pyx_t_14);
            __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0;
            __pyx_lineno = __pyx_t_9; __pyx_clineno = __pyx_t_10; __pyx_filename = __pyx_t_11;
            goto __pyx_L6_except_error;
          }
          __pyx_L14_return: {
            __pyx_t_17 = __pyx_r;
            __pyx_r = 0;
            __Pyx_DECREF(__pyx_v_result_container); __pyx_v_result_container = 0;
            __pyx_r = __pyx_t_17;
            __pyx_t_17 = 0;
            goto __pyx_L7_except_return;
          }
        }
      }
      goto __pyx_L6_except_error;

      /* "lxml/etree.pyx":3345
 *             doc  = element._doc
 *         elif file is not None:
 *             try:             # <<<<<<<<<<<<<<
 *                 doc = _parseDocument(file, parser, None)
 *             except _TargetParserResult as result_container:
*/
      __pyx_L6_except_error:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      goto __pyx_L1_error;
      __pyx_L7_except_return:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      goto __pyx_L0;
      __pyx_L9_try_end:;
    }

    /* "lxml/etree.pyx":3344
 *         if element is not None:
 *             doc  = element._doc
 *         elif file is not None:             # <<<<<<<<<<<<<<
 *             try:
 *                 doc = _parseDocument(file, parser, None)
*/
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":3350
 *                 return result_container.result
 *         else:
 *             c_doc = _newXMLDoc()             # <<<<<<<<<<<<<<
 *             doc = _documentFactory(c_doc, parser)
 * 
*/
  /*else*/ {
    __pyx_t_18 = __pyx_f_4lxml_5etree__newXMLDoc(); if (unlikely(__pyx_t_18 == ((void *)NULL))) __PYX_ERR(0, 3350, __pyx_L1_error)
    __pyx_v_c_doc = __pyx_t_18;

    /* "lxml/etree.pyx":3351
 *         else:
 *             c_doc = _newXMLDoc()
 *             doc = _documentFactory(c_doc, parser)             # <<<<<<<<<<<<<<
 * 
 *         return _elementTreeFactory(doc, element)
*/
    __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, __pyx_v_parser)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3351, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_2);
    __pyx_t_2 = 0;
  }
  __pyx_L3:;

  /* "lxml/etree.pyx":3353
 *             doc = _documentFactory(c_doc, parser)
 * 
 *         return _elementTreeFactory(doc, element)             # <<<<<<<<<<<<<<
 * 
 * # Register _ElementTree as a virtual subclass of ElementTree
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__elementTreeFactory(__pyx_v_doc, __pyx_v_element)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3353, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":3330
 * 
 * class ElementTree(ABC, Generic[T]):
 *     def __new__(cls, _Element element=None, *, file=None, _BaseParser parser=None):             # <<<<<<<<<<<<<<
 *         """ElementTree(element=None, file=None, parser=None)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("lxml.etree.ElementTree.__new__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XDECREF(__pyx_v_result_container);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":3361
 * del ABC, Generic, TypeVar, T
 * 
 * def HTML(text, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     """HTML(text, parser=None, base_url=None)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_15HTML(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_14HTML, "HTML(text, parser=None, base_url=None)\n\n    Parses an HTML document from a string constant.  Returns the root\n    node (or the result returned by a parser target).  This function\n    can be used to embed \"HTML literals\" in Python code.\n\n    To override the parser with a different ``HTMLParser`` you can pass it to\n    the ``parser`` keyword argument.\n\n    The ``base_url`` keyword argument allows to set the original base URL of\n    the document to support relative Paths when looking up external entities\n    (DTD, XInclude, ...).\n    ");
static PyMethodDef __pyx_mdef_4lxml_5etree_15HTML = {"HTML", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_15HTML, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_14HTML};
static PyObject *__pyx_pw_4lxml_5etree_15HTML(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_text = 0;
  struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser = 0;
  PyObject *__pyx_v_base_url = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("HTML (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_text,&__pyx_mstate_global->__pyx_n_u_parser,&__pyx_mstate_global->__pyx_n_u_base_url,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 3361, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 3361, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3361, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "HTML", 0) < (0)) __PYX_ERR(0, 3361, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef((PyObject *)((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("HTML", 0, 1, 2, i); __PYX_ERR(0, 3361, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 3361, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3361, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef((PyObject *)((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_text = values[0];
    __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)values[1]);
    __pyx_v_base_url = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("HTML", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 3361, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.HTML", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parser), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__BaseParser, 1, "parser", 0))) __PYX_ERR(0, 3361, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_14HTML(__pyx_self, __pyx_v_text, __pyx_v_parser, __pyx_v_base_url);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_14HTML(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_text, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser, PyObject *__pyx_v_base_url) {
  struct LxmlDocument *__pyx_v_doc = 0;
  PyObject *__pyx_v_result_container = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_t_11;
  char const *__pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("HTML", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_parser);

  /* "lxml/etree.pyx":3376
 *     """
 *     cdef _Document doc
 *     if parser is None:             # <<<<<<<<<<<<<<
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *         if not isinstance(parser, HTMLParser):
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_parser) == Py_None);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":3377
 *     cdef _Document doc
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()             # <<<<<<<<<<<<<<
 *         if not isinstance(parser, HTMLParser):
 *             parser = __DEFAULT_HTML_PARSER
*/
    __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree_24_ParserDictionaryContext_getDefaultParser(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3377, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_parser, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "lxml/etree.pyx":3378
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *         if not isinstance(parser, HTMLParser):             # <<<<<<<<<<<<<<
 *             parser = __DEFAULT_HTML_PARSER
 *     try:
*/
    __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_parser), __pyx_mstate_global->__pyx_ptype_4lxml_5etree_HTMLParser); 
    __pyx_t_3 = (!__pyx_t_1);
    if (__pyx_t_3) {

      /* "lxml/etree.pyx":3379
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *         if not isinstance(parser, HTMLParser):
 *             parser = __DEFAULT_HTML_PARSER             # <<<<<<<<<<<<<<
 *     try:
 *         doc = _parseMemoryDocument(text, base_url, parser)
*/
      __Pyx_INCREF((PyObject *)__pyx_v_4lxml_5etree___DEFAULT_HTML_PARSER);
      __Pyx_DECREF_SET(__pyx_v_parser, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_4lxml_5etree___DEFAULT_HTML_PARSER));

      /* "lxml/etree.pyx":3378
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *         if not isinstance(parser, HTMLParser):             # <<<<<<<<<<<<<<
 *             parser = __DEFAULT_HTML_PARSER
 *     try:
*/
    }

    /* "lxml/etree.pyx":3376
 *     """
 *     cdef _Document doc
 *     if parser is None:             # <<<<<<<<<<<<<<
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *         if not isinstance(parser, HTMLParser):
*/
  }

  /* "lxml/etree.pyx":3380
 *         if not isinstance(parser, HTMLParser):
 *             parser = __DEFAULT_HTML_PARSER
 *     try:             # <<<<<<<<<<<<<<
 *         doc = _parseMemoryDocument(text, base_url, parser)
 *         return doc.getroot()
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_6);
    /*try:*/ {

      /* "lxml/etree.pyx":3381
 *             parser = __DEFAULT_HTML_PARSER
 *     try:
 *         doc = _parseMemoryDocument(text, base_url, parser)             # <<<<<<<<<<<<<<
 *         return doc.getroot()
 *     except _TargetParserResult as result_container:
*/
      __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__parseMemoryDocument(__pyx_v_text, __pyx_v_base_url, __pyx_v_parser)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3381, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_2);
      __pyx_t_2 = 0;

      /* "lxml/etree.pyx":3382
 *     try:
 *         doc = _parseMemoryDocument(text, base_url, parser)
 *         return doc.getroot()             # <<<<<<<<<<<<<<
 *     except _TargetParserResult as result_container:
 *         return result_container.result
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = __pyx_f_4lxml_5etree_9_Document_getroot(__pyx_v_doc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3382, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L9_try_return;

      /* "lxml/etree.pyx":3380
 *         if not isinstance(parser, HTMLParser):
 *             parser = __DEFAULT_HTML_PARSER
 *     try:             # <<<<<<<<<<<<<<
 *         doc = _parseMemoryDocument(text, base_url, parser)
 *         return doc.getroot()
*/
    }
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "lxml/etree.pyx":3383
 *         doc = _parseMemoryDocument(text, base_url, parser)
 *         return doc.getroot()
 *     except _TargetParserResult as result_container:             # <<<<<<<<<<<<<<
 *         return result_container.result
 * 
*/
    __Pyx_ErrFetch(&__pyx_t_2, &__pyx_t_7, &__pyx_t_8);
    __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_TargetParserResult); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 3383, __pyx_L7_except_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_2, __pyx_t_9);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_ErrRestore(__pyx_t_2, __pyx_t_7, __pyx_t_8);
    __pyx_t_2 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0;
    if (__pyx_t_10) {
      __Pyx_AddTraceback("lxml.etree.HTML", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_7, &__pyx_t_2) < 0) __PYX_ERR(0, 3383, __pyx_L7_except_error)
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_7);
      __pyx_v_result_container = __pyx_t_7;
      /*try:*/ {

        /* "lxml/etree.pyx":3384
 *         return doc.getroot()
 *     except _TargetParserResult as result_container:
 *         return result_container.result             # <<<<<<<<<<<<<<
 * 
 * 
*/
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_result_container, __pyx_mstate_global->__pyx_n_u_result); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 3384, __pyx_L16_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_r = __pyx_t_9;
        __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L15_return;
      }

      /* "lxml/etree.pyx":3383
 *         doc = _parseMemoryDocument(text, base_url, parser)
 *         return doc.getroot()
 *     except _TargetParserResult as result_container:             # <<<<<<<<<<<<<<
 *         return result_container.result
 * 
*/
      /*finally:*/ {
        __pyx_L16_error:;
        /*exception exit:*/{
          __Pyx_PyThreadState_declare
          __Pyx_PyThreadState_assign
          __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0;
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
           __Pyx_ExceptionSwap(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
          if ( unlikely(__Pyx_GetException(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15) < 0)) __Pyx_ErrFetch(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
          __Pyx_XGOTREF(__pyx_t_13);
          __Pyx_XGOTREF(__pyx_t_14);
          __Pyx_XGOTREF(__pyx_t_15);
          __Pyx_XGOTREF(__pyx_t_16);
          __Pyx_XGOTREF(__pyx_t_17);
          __Pyx_XGOTREF(__pyx_t_18);
          __pyx_t_10 = __pyx_lineno; __pyx_t_11 = __pyx_clineno; __pyx_t_12 = __pyx_filename;
          {
            __Pyx_DECREF(__pyx_v_result_container); __pyx_v_result_container = 0;
          }
          __Pyx_XGIVEREF(__pyx_t_16);
          __Pyx_XGIVEREF(__pyx_t_17);
          __Pyx_XGIVEREF(__pyx_t_18);
          __Pyx_ExceptionReset(__pyx_t_16, __pyx_t_17, __pyx_t_18);
          __Pyx_XGIVEREF(__pyx_t_13);
          __Pyx_XGIVEREF(__pyx_t_14);
          __Pyx_XGIVEREF(__pyx_t_15);
          __Pyx_ErrRestore(__pyx_t_13, __pyx_t_14, __pyx_t_15);
          __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0;
          __pyx_lineno = __pyx_t_10; __pyx_clineno = __pyx_t_11; __pyx_filename = __pyx_t_12;
          goto __pyx_L7_except_error;
        }
        __pyx_L15_return: {
          __pyx_t_18 = __pyx_r;
          __pyx_r = 0;
          __Pyx_DECREF(__pyx_v_result_container); __pyx_v_result_container = 0;
          __pyx_r = __pyx_t_18;
          __pyx_t_18 = 0;
          goto __pyx_L8_except_return;
        }
      }
    }
    goto __pyx_L7_except_error;

    /* "lxml/etree.pyx":3380
 *         if not isinstance(parser, HTMLParser):
 *             parser = __DEFAULT_HTML_PARSER
 *     try:             # <<<<<<<<<<<<<<
 *         doc = _parseMemoryDocument(text, base_url, parser)
 *         return doc.getroot()
*/
    __pyx_L7_except_error:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    goto __pyx_L1_error;
    __pyx_L9_try_return:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    goto __pyx_L0;
    __pyx_L8_except_return:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    goto __pyx_L0;
  }

  /* "lxml/etree.pyx":3361
 * del ABC, Generic, TypeVar, T
 * 
 * def HTML(text, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     """HTML(text, parser=None, base_url=None)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("lxml.etree.HTML", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XDECREF(__pyx_v_result_container);
  __Pyx_XDECREF((PyObject *)__pyx_v_parser);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":3387
 * 
 * 
 * def XML(text, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     """XML(text, parser=None, base_url=None)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_17XML(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_16XML, "XML(text, parser=None, base_url=None)\n\n    Parses an XML document or fragment from a string constant.\n    Returns the root node (or the result returned by a parser target).\n    This function can be used to embed \"XML literals\" in Python code,\n    like in\n\n       >>> root = XML(\"<root><test/></root>\")\n       >>> print(root.tag)\n       root\n\n    To override the parser with a different ``XMLParser`` you can pass it to\n    the ``parser`` keyword argument.\n\n    The ``base_url`` keyword argument allows to set the original base URL of\n    the document to support relative Paths when looking up external entities\n    (DTD, XInclude, ...).\n    ");
static PyMethodDef __pyx_mdef_4lxml_5etree_17XML = {"XML", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_17XML, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_16XML};
static PyObject *__pyx_pw_4lxml_5etree_17XML(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_text = 0;
  struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser = 0;
  PyObject *__pyx_v_base_url = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("XML (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_text,&__pyx_mstate_global->__pyx_n_u_parser,&__pyx_mstate_global->__pyx_n_u_base_url,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 3387, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 3387, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3387, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "XML", 0) < (0)) __PYX_ERR(0, 3387, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef((PyObject *)((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("XML", 0, 1, 2, i); __PYX_ERR(0, 3387, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 3387, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3387, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef((PyObject *)((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_text = values[0];
    __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)values[1]);
    __pyx_v_base_url = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("XML", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 3387, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.XML", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parser), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__BaseParser, 1, "parser", 0))) __PYX_ERR(0, 3387, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_16XML(__pyx_self, __pyx_v_text, __pyx_v_parser, __pyx_v_base_url);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_16XML(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_text, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser, PyObject *__pyx_v_base_url) {
  struct LxmlDocument *__pyx_v_doc = 0;
  PyObject *__pyx_v_result_container = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_t_11;
  char const *__pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("XML", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_parser);

  /* "lxml/etree.pyx":3407
 *     """
 *     cdef _Document doc
 *     if parser is None:             # <<<<<<<<<<<<<<
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *         if not isinstance(parser, XMLParser):
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_parser) == Py_None);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":3408
 *     cdef _Document doc
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()             # <<<<<<<<<<<<<<
 *         if not isinstance(parser, XMLParser):
 *             parser = __DEFAULT_XML_PARSER
*/
    __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree_24_ParserDictionaryContext_getDefaultParser(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3408, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_parser, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "lxml/etree.pyx":3409
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *         if not isinstance(parser, XMLParser):             # <<<<<<<<<<<<<<
 *             parser = __DEFAULT_XML_PARSER
 *     try:
*/
    __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_parser), __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XMLParser); 
    __pyx_t_3 = (!__pyx_t_1);
    if (__pyx_t_3) {

      /* "lxml/etree.pyx":3410
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *         if not isinstance(parser, XMLParser):
 *             parser = __DEFAULT_XML_PARSER             # <<<<<<<<<<<<<<
 *     try:
 *         doc = _parseMemoryDocument(text, base_url, parser)
*/
      __Pyx_INCREF((PyObject *)__pyx_v_4lxml_5etree___DEFAULT_XML_PARSER);
      __Pyx_DECREF_SET(__pyx_v_parser, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_4lxml_5etree___DEFAULT_XML_PARSER));

      /* "lxml/etree.pyx":3409
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *         if not isinstance(parser, XMLParser):             # <<<<<<<<<<<<<<
 *             parser = __DEFAULT_XML_PARSER
 *     try:
*/
    }

    /* "lxml/etree.pyx":3407
 *     """
 *     cdef _Document doc
 *     if parser is None:             # <<<<<<<<<<<<<<
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *         if not isinstance(parser, XMLParser):
*/
  }

  /* "lxml/etree.pyx":3411
 *         if not isinstance(parser, XMLParser):
 *             parser = __DEFAULT_XML_PARSER
 *     try:             # <<<<<<<<<<<<<<
 *         doc = _parseMemoryDocument(text, base_url, parser)
 *         return doc.getroot()
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_6);
    /*try:*/ {

      /* "lxml/etree.pyx":3412
 *             parser = __DEFAULT_XML_PARSER
 *     try:
 *         doc = _parseMemoryDocument(text, base_url, parser)             # <<<<<<<<<<<<<<
 *         return doc.getroot()
 *     except _TargetParserResult as result_container:
*/
      __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__parseMemoryDocument(__pyx_v_text, __pyx_v_base_url, __pyx_v_parser)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3412, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_2);
      __pyx_t_2 = 0;

      /* "lxml/etree.pyx":3413
 *     try:
 *         doc = _parseMemoryDocument(text, base_url, parser)
 *         return doc.getroot()             # <<<<<<<<<<<<<<
 *     except _TargetParserResult as result_container:
 *         return result_container.result
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = __pyx_f_4lxml_5etree_9_Document_getroot(__pyx_v_doc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3413, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L9_try_return;

      /* "lxml/etree.pyx":3411
 *         if not isinstance(parser, XMLParser):
 *             parser = __DEFAULT_XML_PARSER
 *     try:             # <<<<<<<<<<<<<<
 *         doc = _parseMemoryDocument(text, base_url, parser)
 *         return doc.getroot()
*/
    }
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "lxml/etree.pyx":3414
 *         doc = _parseMemoryDocument(text, base_url, parser)
 *         return doc.getroot()
 *     except _TargetParserResult as result_container:             # <<<<<<<<<<<<<<
 *         return result_container.result
 * 
*/
    __Pyx_ErrFetch(&__pyx_t_2, &__pyx_t_7, &__pyx_t_8);
    __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_TargetParserResult); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 3414, __pyx_L7_except_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_2, __pyx_t_9);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_ErrRestore(__pyx_t_2, __pyx_t_7, __pyx_t_8);
    __pyx_t_2 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0;
    if (__pyx_t_10) {
      __Pyx_AddTraceback("lxml.etree.XML", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_7, &__pyx_t_2) < 0) __PYX_ERR(0, 3414, __pyx_L7_except_error)
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_7);
      __pyx_v_result_container = __pyx_t_7;
      /*try:*/ {

        /* "lxml/etree.pyx":3415
 *         return doc.getroot()
 *     except _TargetParserResult as result_container:
 *         return result_container.result             # <<<<<<<<<<<<<<
 * 
 * 
*/
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_result_container, __pyx_mstate_global->__pyx_n_u_result); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 3415, __pyx_L16_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_r = __pyx_t_9;
        __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L15_return;
      }

      /* "lxml/etree.pyx":3414
 *         doc = _parseMemoryDocument(text, base_url, parser)
 *         return doc.getroot()
 *     except _TargetParserResult as result_container:             # <<<<<<<<<<<<<<
 *         return result_container.result
 * 
*/
      /*finally:*/ {
        __pyx_L16_error:;
        /*exception exit:*/{
          __Pyx_PyThreadState_declare
          __Pyx_PyThreadState_assign
          __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0;
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
           __Pyx_ExceptionSwap(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
          if ( unlikely(__Pyx_GetException(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15) < 0)) __Pyx_ErrFetch(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
          __Pyx_XGOTREF(__pyx_t_13);
          __Pyx_XGOTREF(__pyx_t_14);
          __Pyx_XGOTREF(__pyx_t_15);
          __Pyx_XGOTREF(__pyx_t_16);
          __Pyx_XGOTREF(__pyx_t_17);
          __Pyx_XGOTREF(__pyx_t_18);
          __pyx_t_10 = __pyx_lineno; __pyx_t_11 = __pyx_clineno; __pyx_t_12 = __pyx_filename;
          {
            __Pyx_DECREF(__pyx_v_result_container); __pyx_v_result_container = 0;
          }
          __Pyx_XGIVEREF(__pyx_t_16);
          __Pyx_XGIVEREF(__pyx_t_17);
          __Pyx_XGIVEREF(__pyx_t_18);
          __Pyx_ExceptionReset(__pyx_t_16, __pyx_t_17, __pyx_t_18);
          __Pyx_XGIVEREF(__pyx_t_13);
          __Pyx_XGIVEREF(__pyx_t_14);
          __Pyx_XGIVEREF(__pyx_t_15);
          __Pyx_ErrRestore(__pyx_t_13, __pyx_t_14, __pyx_t_15);
          __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0;
          __pyx_lineno = __pyx_t_10; __pyx_clineno = __pyx_t_11; __pyx_filename = __pyx_t_12;
          goto __pyx_L7_except_error;
        }
        __pyx_L15_return: {
          __pyx_t_18 = __pyx_r;
          __pyx_r = 0;
          __Pyx_DECREF(__pyx_v_result_container); __pyx_v_result_container = 0;
          __pyx_r = __pyx_t_18;
          __pyx_t_18 = 0;
          goto __pyx_L8_except_return;
        }
      }
    }
    goto __pyx_L7_except_error;

    /* "lxml/etree.pyx":3411
 *         if not isinstance(parser, XMLParser):
 *             parser = __DEFAULT_XML_PARSER
 *     try:             # <<<<<<<<<<<<<<
 *         doc = _parseMemoryDocument(text, base_url, parser)
 *         return doc.getroot()
*/
    __pyx_L7_except_error:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    goto __pyx_L1_error;
    __pyx_L9_try_return:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    goto __pyx_L0;
    __pyx_L8_except_return:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    goto __pyx_L0;
  }

  /* "lxml/etree.pyx":3387
 * 
 * 
 * def XML(text, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     """XML(text, parser=None, base_url=None)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("lxml.etree.XML", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XDECREF(__pyx_v_result_container);
  __Pyx_XDECREF((PyObject *)__pyx_v_parser);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":3418
 * 
 * 
 * def fromstring(text, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     """fromstring(text, parser=None, base_url=None)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_19fromstring(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_18fromstring, "fromstring(text, parser=None, base_url=None)\n\n    Parses an XML document or fragment from a string.  Returns the\n    root node (or the result returned by a parser target).\n\n    To override the default parser with a different parser you can pass it to\n    the ``parser`` keyword argument.\n\n    The ``base_url`` keyword argument allows to set the original base URL of\n    the document to support relative Paths when looking up external entities\n    (DTD, XInclude, ...).\n    ");
static PyMethodDef __pyx_mdef_4lxml_5etree_19fromstring = {"fromstring", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_19fromstring, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_18fromstring};
static PyObject *__pyx_pw_4lxml_5etree_19fromstring(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_text = 0;
  struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser = 0;
  PyObject *__pyx_v_base_url = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("fromstring (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_text,&__pyx_mstate_global->__pyx_n_u_parser,&__pyx_mstate_global->__pyx_n_u_base_url,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 3418, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 3418, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3418, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "fromstring", 0) < (0)) __PYX_ERR(0, 3418, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef((PyObject *)((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("fromstring", 0, 1, 2, i); __PYX_ERR(0, 3418, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 3418, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3418, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef((PyObject *)((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_text = values[0];
    __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)values[1]);
    __pyx_v_base_url = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("fromstring", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 3418, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.fromstring", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parser), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__BaseParser, 1, "parser", 0))) __PYX_ERR(0, 3418, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_18fromstring(__pyx_self, __pyx_v_text, __pyx_v_parser, __pyx_v_base_url);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_18fromstring(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_text, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser, PyObject *__pyx_v_base_url) {
  struct LxmlDocument *__pyx_v_doc = 0;
  PyObject *__pyx_v_result_container = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_t_9;
  char const *__pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("fromstring", 0);

  /* "lxml/etree.pyx":3432
 *     """
 *     cdef _Document doc
 *     try:             # <<<<<<<<<<<<<<
 *         doc = _parseMemoryDocument(text, base_url, parser)
 *         return doc.getroot()
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "lxml/etree.pyx":3433
 *     cdef _Document doc
 *     try:
 *         doc = _parseMemoryDocument(text, base_url, parser)             # <<<<<<<<<<<<<<
 *         return doc.getroot()
 *     except _TargetParserResult as result_container:
*/
      __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__parseMemoryDocument(__pyx_v_text, __pyx_v_base_url, __pyx_v_parser)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3433, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_4);
      __pyx_t_4 = 0;

      /* "lxml/etree.pyx":3434
 *     try:
 *         doc = _parseMemoryDocument(text, base_url, parser)
 *         return doc.getroot()             # <<<<<<<<<<<<<<
 *     except _TargetParserResult as result_container:
 *         return result_container.result
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = __pyx_f_4lxml_5etree_9_Document_getroot(__pyx_v_doc); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3434, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L7_try_return;

      /* "lxml/etree.pyx":3432
 *     """
 *     cdef _Document doc
 *     try:             # <<<<<<<<<<<<<<
 *         doc = _parseMemoryDocument(text, base_url, parser)
 *         return doc.getroot()
*/
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "lxml/etree.pyx":3435
 *         doc = _parseMemoryDocument(text, base_url, parser)
 *         return doc.getroot()
 *     except _TargetParserResult as result_container:             # <<<<<<<<<<<<<<
 *         return result_container.result
 * 
*/
    __Pyx_ErrFetch(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_TargetParserResult); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3435, __pyx_L5_except_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_4, __pyx_t_7);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_ErrRestore(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    __pyx_t_4 = 0; __pyx_t_5 = 0; __pyx_t_6 = 0;
    if (__pyx_t_8) {
      __Pyx_AddTraceback("lxml.etree.fromstring", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4) < 0) __PYX_ERR(0, 3435, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __pyx_v_result_container = __pyx_t_5;
      /*try:*/ {

        /* "lxml/etree.pyx":3436
 *         return doc.getroot()
 *     except _TargetParserResult as result_container:
 *         return result_container.result             # <<<<<<<<<<<<<<
 * 
 * 
*/
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_result_container, __pyx_mstate_global->__pyx_n_u_result); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3436, __pyx_L14_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_r = __pyx_t_7;
        __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        goto __pyx_L13_return;
      }

      /* "lxml/etree.pyx":3435
 *         doc = _parseMemoryDocument(text, base_url, parser)
 *         return doc.getroot()
 *     except _TargetParserResult as result_container:             # <<<<<<<<<<<<<<
 *         return result_container.result
 * 
*/
      /*finally:*/ {
        __pyx_L14_error:;
        /*exception exit:*/{
          __Pyx_PyThreadState_declare
          __Pyx_PyThreadState_assign
          __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
           __Pyx_ExceptionSwap(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16);
          if ( unlikely(__Pyx_GetException(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13) < 0)) __Pyx_ErrFetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
          __Pyx_XGOTREF(__pyx_t_11);
          __Pyx_XGOTREF(__pyx_t_12);
          __Pyx_XGOTREF(__pyx_t_13);
          __Pyx_XGOTREF(__pyx_t_14);
          __Pyx_XGOTREF(__pyx_t_15);
          __Pyx_XGOTREF(__pyx_t_16);
          __pyx_t_8 = __pyx_lineno; __pyx_t_9 = __pyx_clineno; __pyx_t_10 = __pyx_filename;
          {
            __Pyx_DECREF(__pyx_v_result_container); __pyx_v_result_container = 0;
          }
          __Pyx_XGIVEREF(__pyx_t_14);
          __Pyx_XGIVEREF(__pyx_t_15);
          __Pyx_XGIVEREF(__pyx_t_16);
          __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16);
          __Pyx_XGIVEREF(__pyx_t_11);
          __Pyx_XGIVEREF(__pyx_t_12);
          __Pyx_XGIVEREF(__pyx_t_13);
          __Pyx_ErrRestore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
          __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
          __pyx_lineno = __pyx_t_8; __pyx_clineno = __pyx_t_9; __pyx_filename = __pyx_t_10;
          goto __pyx_L5_except_error;
        }
        __pyx_L13_return: {
          __pyx_t_16 = __pyx_r;
          __pyx_r = 0;
          __Pyx_DECREF(__pyx_v_result_container); __pyx_v_result_container = 0;
          __pyx_r = __pyx_t_16;
          __pyx_t_16 = 0;
          goto __pyx_L6_except_return;
        }
      }
    }
    goto __pyx_L5_except_error;

    /* "lxml/etree.pyx":3432
 *     """
 *     cdef _Document doc
 *     try:             # <<<<<<<<<<<<<<
 *         doc = _parseMemoryDocument(text, base_url, parser)
 *         return doc.getroot()
*/
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L7_try_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
  }

  /* "lxml/etree.pyx":3418
 * 
 * 
 * def fromstring(text, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     """fromstring(text, parser=None, base_url=None)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree.fromstring", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XDECREF(__pyx_v_result_container);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":3439
 * 
 * 
 * def fromstringlist(strings, _BaseParser parser=None):             # <<<<<<<<<<<<<<
 *     """fromstringlist(strings, parser=None)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_21fromstringlist(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_20fromstringlist, "fromstringlist(strings, parser=None)\n\n    Parses an XML document from a sequence of strings.  Returns the\n    root node (or the result returned by a parser target).\n\n    To override the default parser with a different parser you can pass it to\n    the ``parser`` keyword argument.\n    ");
static PyMethodDef __pyx_mdef_4lxml_5etree_21fromstringlist = {"fromstringlist", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_21fromstringlist, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_20fromstringlist};
static PyObject *__pyx_pw_4lxml_5etree_21fromstringlist(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_strings = 0;
  struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("fromstringlist (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_strings,&__pyx_mstate_global->__pyx_n_u_parser,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 3439, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 3439, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3439, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "fromstringlist", 0) < (0)) __PYX_ERR(0, 3439, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef((PyObject *)((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("fromstringlist", 0, 1, 2, i); __PYX_ERR(0, 3439, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 3439, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3439, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef((PyObject *)((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None));
    }
    __pyx_v_strings = values[0];
    __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)values[1]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("fromstringlist", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 3439, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.fromstringlist", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parser), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__BaseParser, 1, "parser", 0))) __PYX_ERR(0, 3439, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_20fromstringlist(__pyx_self, __pyx_v_strings, __pyx_v_parser);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_20fromstringlist(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_strings, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser) {
  PyObject *__pyx_v_feed = NULL;
  PyObject *__pyx_v_data = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("fromstringlist", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_parser);

  /* "lxml/etree.pyx":3449
 *     """
 *     cdef _Document doc
 *     if isinstance(strings, (bytes, unicode)):             # <<<<<<<<<<<<<<
 *         raise ValueError("passing a single string into fromstringlist() is not"
 *                          " efficient, use fromstring() instead")
*/
  __pyx_t_2 = PyBytes_Check(__pyx_v_strings); 
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyUnicode_Check(__pyx_v_strings); 
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (unlikely(__pyx_t_1)) {

    /* "lxml/etree.pyx":3450
 *     cdef _Document doc
 *     if isinstance(strings, (bytes, unicode)):
 *         raise ValueError("passing a single string into fromstringlist() is not"             # <<<<<<<<<<<<<<
 *                          " efficient, use fromstring() instead")
 *     if parser is None:
*/
    __pyx_t_4 = NULL;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_passing_a_single_string_into_fro};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3450, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(0, 3450, __pyx_L1_error)

    /* "lxml/etree.pyx":3449
 *     """
 *     cdef _Document doc
 *     if isinstance(strings, (bytes, unicode)):             # <<<<<<<<<<<<<<
 *         raise ValueError("passing a single string into fromstringlist() is not"
 *                          " efficient, use fromstring() instead")
*/
  }

  /* "lxml/etree.pyx":3452
 *         raise ValueError("passing a single string into fromstringlist() is not"
 *                          " efficient, use fromstring() instead")
 *     if parser is None:             # <<<<<<<<<<<<<<
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *     feed = parser.feed
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_parser) == Py_None);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":3453
 *                          " efficient, use fromstring() instead")
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()             # <<<<<<<<<<<<<<
 *     feed = parser.feed
 *     for data in strings:
*/
    __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree_24_ParserDictionaryContext_getDefaultParser(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3453, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_parser, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "lxml/etree.pyx":3452
 *         raise ValueError("passing a single string into fromstringlist() is not"
 *                          " efficient, use fromstring() instead")
 *     if parser is None:             # <<<<<<<<<<<<<<
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *     feed = parser.feed
*/
  }

  /* "lxml/etree.pyx":3454
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *     feed = parser.feed             # <<<<<<<<<<<<<<
 *     for data in strings:
 *         feed(data)
*/
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_parser), __pyx_mstate_global->__pyx_n_u_feed); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3454, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_feed = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "lxml/etree.pyx":3455
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *     feed = parser.feed
 *     for data in strings:             # <<<<<<<<<<<<<<
 *         feed(data)
 *     return parser.close()
*/
  if (likely(PyList_CheckExact(__pyx_v_strings)) || PyTuple_CheckExact(__pyx_v_strings)) {
    __pyx_t_3 = __pyx_v_strings; __Pyx_INCREF(__pyx_t_3);
    __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
  } else {
    __pyx_t_6 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_strings); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3455, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3455, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_7)) {
      if (likely(PyList_CheckExact(__pyx_t_3))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 3455, __pyx_L1_error)
          #endif
          if (__pyx_t_6 >= __pyx_temp) break;
        }
        __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_3, __pyx_t_6, __Pyx_ReferenceSharing_OwnStrongReference);
        ++__pyx_t_6;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 3455, __pyx_L1_error)
          #endif
          if (__pyx_t_6 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_6));
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_6);
        #endif
        ++__pyx_t_6;
      }
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3455, __pyx_L1_error)
    } else {
      __pyx_t_4 = __pyx_t_7(__pyx_t_3);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 3455, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XDECREF_SET(__pyx_v_data, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "lxml/etree.pyx":3456
 *     feed = parser.feed
 *     for data in strings:
 *         feed(data)             # <<<<<<<<<<<<<<
 *     return parser.close()
 * 
*/
    __pyx_t_8 = NULL;
    __Pyx_INCREF(__pyx_v_feed);
    __pyx_t_9 = __pyx_v_feed; 
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_9);
      assert(__pyx_t_8);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_9, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_v_data};
      __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_9, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3456, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "lxml/etree.pyx":3455
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *     feed = parser.feed
 *     for data in strings:             # <<<<<<<<<<<<<<
 *         feed(data)
 *     return parser.close()
*/
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "lxml/etree.pyx":3457
 *     for data in strings:
 *         feed(data)
 *     return parser.close()             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = ((PyObject *)__pyx_v_parser);
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
    __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_close, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3457, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":3439
 * 
 * 
 * def fromstringlist(strings, _BaseParser parser=None):             # <<<<<<<<<<<<<<
 *     """fromstringlist(strings, parser=None)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("lxml.etree.fromstringlist", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_feed);
  __Pyx_XDECREF(__pyx_v_data);
  __Pyx_XDECREF((PyObject *)__pyx_v_parser);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":3460
 * 
 * 
 * def iselement(element):             # <<<<<<<<<<<<<<
 *     """iselement(element)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_23iselement(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_22iselement, "iselement(element)\n\n    Checks if an object appears to be a valid element object.\n    ");
static PyMethodDef __pyx_mdef_4lxml_5etree_23iselement = {"iselement", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_23iselement, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_22iselement};
static PyObject *__pyx_pw_4lxml_5etree_23iselement(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_element = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iselement (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_element,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 3460, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3460, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "iselement", 0) < (0)) __PYX_ERR(0, 3460, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("iselement", 1, 1, 1, i); __PYX_ERR(0, 3460, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3460, __pyx_L3_error)
    }
    __pyx_v_element = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("iselement", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 3460, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.iselement", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_22iselement(__pyx_self, __pyx_v_element);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_22iselement(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_element) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("iselement", 0);

  /* "lxml/etree.pyx":3465
 *     Checks if an object appears to be a valid element object.
 *     """
 *     return isinstance(element, _Element) and (<_Element>element)._c_node is not NULL             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_element, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element); 
  if (__pyx_t_2) {
  } else {
    __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3465, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L3_bool_binop_done;
  }
  __pyx_t_2 = (((struct LxmlElement *)__pyx_v_element)->_c_node != NULL);
  __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3465, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_L3_bool_binop_done:;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":3460
 * 
 * 
 * def iselement(element):             # <<<<<<<<<<<<<<
 *     """iselement(element)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.iselement", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":3468
 * 
 * 
 * def indent(tree, space="  ", *, Py_ssize_t level=0):             # <<<<<<<<<<<<<<
 *     """indent(tree, space="  ", level=0)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_25indent(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_24indent, "indent(tree, space=\"  \", level=0)\n\n    Indent an XML document by inserting newlines and indentation space\n    after elements.\n\n    *tree* is the ElementTree or Element to modify.  The (root) element\n    itself will not be changed, but the tail text of all elements in its\n    subtree will be adapted.\n\n    *space* is the whitespace to insert for each indentation level, two\n    space characters by default.\n\n    *level* is the initial indentation level. Setting this to a higher\n    value than 0 can be used for indenting subtrees that are more deeply\n    nested inside of a document.\n    ");
static PyMethodDef __pyx_mdef_4lxml_5etree_25indent = {"indent", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_25indent, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_24indent};
static PyObject *__pyx_pw_4lxml_5etree_25indent(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_tree = 0;
  PyObject *__pyx_v_space = 0;
  Py_ssize_t __pyx_v_level;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("indent (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_tree,&__pyx_mstate_global->__pyx_n_u_space,&__pyx_mstate_global->__pyx_n_u_level,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 3468, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 3468, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3468, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "indent", 0) < (0)) __PYX_ERR(0, 3468, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_kp_u__27)));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("indent", 0, 1, 2, i); __PYX_ERR(0, 3468, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 3468, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3468, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_kp_u__27)));
    }
    __pyx_v_tree = values[0];
    __pyx_v_space = values[1];
    if (values[2]) {
      __pyx_v_level = __Pyx_PyIndex_AsSsize_t(values[2]); if (unlikely((__pyx_v_level == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 3468, __pyx_L3_error)
    } else {
      __pyx_v_level = ((Py_ssize_t)((Py_ssize_t)0));
    }
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("indent", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 3468, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.indent", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_24indent(__pyx_self, __pyx_v_tree, __pyx_v_space, __pyx_v_level);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_24indent(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tree, PyObject *__pyx_v_space, Py_ssize_t __pyx_v_level) {
  struct LxmlElement *__pyx_v_root = NULL;
  PyObject *__pyx_v_indent = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("indent", 0);
  __Pyx_INCREF(__pyx_v_space);

  /* "lxml/etree.pyx":3485
 *     nested inside of a document.
 *     """
 *     root = _rootNodeOrRaise(tree)             # <<<<<<<<<<<<<<
 *     if level < 0:
 *         raise ValueError(f"Initial indentation level must be >= 0, got {level}")
*/
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__rootNodeOrRaise(__pyx_v_tree)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3485, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_root = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "lxml/etree.pyx":3486
 *     """
 *     root = _rootNodeOrRaise(tree)
 *     if level < 0:             # <<<<<<<<<<<<<<
 *         raise ValueError(f"Initial indentation level must be >= 0, got {level}")
 *     if _hasChild(root._c_node):
*/
  __pyx_t_2 = (__pyx_v_level < 0);
  if (unlikely(__pyx_t_2)) {

    /* "lxml/etree.pyx":3487
 *     root = _rootNodeOrRaise(tree)
 *     if level < 0:
 *         raise ValueError(f"Initial indentation level must be >= 0, got {level}")             # <<<<<<<<<<<<<<
 *     if _hasChild(root._c_node):
 *         space = _utf8(space)
*/
    __pyx_t_3 = NULL;
    __pyx_t_4 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_level, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3487, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_Initial_indentation_level_must_b, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3487, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_5};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3487, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 3487, __pyx_L1_error)

    /* "lxml/etree.pyx":3486
 *     """
 *     root = _rootNodeOrRaise(tree)
 *     if level < 0:             # <<<<<<<<<<<<<<
 *         raise ValueError(f"Initial indentation level must be >= 0, got {level}")
 *     if _hasChild(root._c_node):
*/
  }

  /* "lxml/etree.pyx":3488
 *     if level < 0:
 *         raise ValueError(f"Initial indentation level must be >= 0, got {level}")
 *     if _hasChild(root._c_node):             # <<<<<<<<<<<<<<
 *         space = _utf8(space)
 *         indent = b"\n" + level * space
*/
  __pyx_t_2 = __pyx_f_4lxml_5etree__hasChild(__pyx_v_root->_c_node);
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":3489
 *         raise ValueError(f"Initial indentation level must be >= 0, got {level}")
 *     if _hasChild(root._c_node):
 *         space = _utf8(space)             # <<<<<<<<<<<<<<
 *         indent = b"\n" + level * space
 *         _indent_children(root._c_node, 1, space, [indent, indent + space])
*/
    __pyx_t_1 = __pyx_f_4lxml_5etree__utf8(__pyx_v_space); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3489, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_space, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "lxml/etree.pyx":3490
 *     if _hasChild(root._c_node):
 *         space = _utf8(space)
 *         indent = b"\n" + level * space             # <<<<<<<<<<<<<<
 *         _indent_children(root._c_node, 1, space, [indent, indent + space])
 * 
*/
    __pyx_t_1 = PyLong_FromSsize_t(__pyx_v_level); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3490, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = PyNumber_Multiply(__pyx_t_1, __pyx_v_space); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3490, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_Add(__pyx_mstate_global->__pyx_kp_b__12, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3490, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_indent = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "lxml/etree.pyx":3491
 *         space = _utf8(space)
 *         indent = b"\n" + level * space
 *         _indent_children(root._c_node, 1, space, [indent, indent + space])             # <<<<<<<<<<<<<<
 * 
 * 
*/
    __pyx_t_1 = __pyx_v_space;
    __Pyx_INCREF(__pyx_t_1);
    if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_1))) __PYX_ERR(0, 3491, __pyx_L1_error)
    __pyx_t_5 = PyNumber_Add(__pyx_v_indent, __pyx_v_space); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3491, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = PyList_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3491, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_indent);
    __Pyx_GIVEREF(__pyx_v_indent);
    if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, __pyx_v_indent) != (0)) __PYX_ERR(0, 3491, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_5);
    if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 1, __pyx_t_5) != (0)) __PYX_ERR(0, 3491, __pyx_L1_error);
    __pyx_t_5 = 0;
    __pyx_t_7 = __pyx_f_4lxml_5etree__indent_children(__pyx_v_root->_c_node, 1, ((PyObject*)__pyx_t_1), ((PyObject*)__pyx_t_3)); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 3491, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "lxml/etree.pyx":3488
 *     if level < 0:
 *         raise ValueError(f"Initial indentation level must be >= 0, got {level}")
 *     if _hasChild(root._c_node):             # <<<<<<<<<<<<<<
 *         space = _utf8(space)
 *         indent = b"\n" + level * space
*/
  }

  /* "lxml/etree.pyx":3468
 * 
 * 
 * def indent(tree, space="  ", *, Py_ssize_t level=0):             # <<<<<<<<<<<<<<
 *     """indent(tree, space="  ", level=0)
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree.indent", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_root);
  __Pyx_XDECREF(__pyx_v_indent);
  __Pyx_XDECREF(__pyx_v_space);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":3494
 * 
 * 
 * cdef int _indent_children(xmlNode* c_node, Py_ssize_t level, bytes one_space, list indentations) except -1:             # <<<<<<<<<<<<<<
 *     # Reuse indentation strings for speed.
 *     if len(indentations) <= level:
*/

static int __pyx_f_4lxml_5etree__indent_children(xmlNode *__pyx_v_c_node, Py_ssize_t __pyx_v_level, PyObject *__pyx_v_one_space, PyObject *__pyx_v_indentations) {
  PyObject *__pyx_v_child_indentation = NULL;
  xmlNode *__pyx_v_c_child;
  xmlNode *__pyx_v_c_next_child;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_indent_children", 0);

  /* "lxml/etree.pyx":3496
 * cdef int _indent_children(xmlNode* c_node, Py_ssize_t level, bytes one_space, list indentations) except -1:
 *     # Reuse indentation strings for speed.
 *     if len(indentations) <= level:             # <<<<<<<<<<<<<<
 *         indentations.append(indentations[-1] + one_space)
 * 
*/
  if (unlikely(__pyx_v_indentations == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 3496, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyList_GET_SIZE(__pyx_v_indentations); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 3496, __pyx_L1_error)
  __pyx_t_2 = (__pyx_t_1 <= __pyx_v_level);
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":3497
 *     # Reuse indentation strings for speed.
 *     if len(indentations) <= level:
 *         indentations.append(indentations[-1] + one_space)             # <<<<<<<<<<<<<<
 * 
 *     # Start a new indentation level for the first child.
*/
    if (unlikely(__pyx_v_indentations == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
      __PYX_ERR(0, 3497, __pyx_L1_error)
    }
    if (unlikely(__pyx_v_indentations == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 3497, __pyx_L1_error)
    }
    __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_indentations, -1L, long, 1, __Pyx_PyLong_From_long, 1, 1, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3497, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_Add(__pyx_t_3, __pyx_v_one_space); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3497, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_indentations, __pyx_t_4); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 3497, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "lxml/etree.pyx":3496
 * cdef int _indent_children(xmlNode* c_node, Py_ssize_t level, bytes one_space, list indentations) except -1:
 *     # Reuse indentation strings for speed.
 *     if len(indentations) <= level:             # <<<<<<<<<<<<<<
 *         indentations.append(indentations[-1] + one_space)
 * 
*/
  }

  /* "lxml/etree.pyx":3500
 * 
 *     # Start a new indentation level for the first child.
 *     child_indentation = indentations[level]             # <<<<<<<<<<<<<<
 *     if not _hasNonWhitespaceText(c_node):
 *         _setNodeText(c_node, child_indentation)
*/
  if (unlikely(__pyx_v_indentations == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 3500, __pyx_L1_error)
  }
  __pyx_t_4 = __Pyx_GetItemInt_List(__pyx_v_indentations, __pyx_v_level, Py_ssize_t, 1, PyLong_FromSsize_t, 1, 1, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3500, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_child_indentation = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "lxml/etree.pyx":3501
 *     # Start a new indentation level for the first child.
 *     child_indentation = indentations[level]
 *     if not _hasNonWhitespaceText(c_node):             # <<<<<<<<<<<<<<
 *         _setNodeText(c_node, child_indentation)
 * 
*/
  __pyx_t_2 = __pyx_f_4lxml_5etree__hasNonWhitespaceText(__pyx_v_c_node, NULL); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 3501, __pyx_L1_error)
  __pyx_t_6 = (!__pyx_t_2);
  if (__pyx_t_6) {

    /* "lxml/etree.pyx":3502
 *     child_indentation = indentations[level]
 *     if not _hasNonWhitespaceText(c_node):
 *         _setNodeText(c_node, child_indentation)             # <<<<<<<<<<<<<<
 * 
 *     # Recursively indent all children.
*/
    __pyx_t_7 = __pyx_f_4lxml_5etree__setNodeText(__pyx_v_c_node, __pyx_v_child_indentation); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 3502, __pyx_L1_error)

    /* "lxml/etree.pyx":3501
 *     # Start a new indentation level for the first child.
 *     child_indentation = indentations[level]
 *     if not _hasNonWhitespaceText(c_node):             # <<<<<<<<<<<<<<
 *         _setNodeText(c_node, child_indentation)
 * 
*/
  }

  /* "lxml/etree.pyx":3505
 * 
 *     # Recursively indent all children.
 *     cdef xmlNode* c_child = _findChildForwards(c_node, 0)             # <<<<<<<<<<<<<<
 *     while c_child is not NULL:
 *         if _hasChild(c_child):
*/
  __pyx_v_c_child = __pyx_f_4lxml_5etree__findChildForwards(__pyx_v_c_node, 0);

  /* "lxml/etree.pyx":3506
 *     # Recursively indent all children.
 *     cdef xmlNode* c_child = _findChildForwards(c_node, 0)
 *     while c_child is not NULL:             # <<<<<<<<<<<<<<
 *         if _hasChild(c_child):
 *             _indent_children(c_child, level+1, one_space, indentations)
*/
  while (1) {
    __pyx_t_6 = (__pyx_v_c_child != NULL);
    if (!__pyx_t_6) break;

    /* "lxml/etree.pyx":3507
 *     cdef xmlNode* c_child = _findChildForwards(c_node, 0)
 *     while c_child is not NULL:
 *         if _hasChild(c_child):             # <<<<<<<<<<<<<<
 *             _indent_children(c_child, level+1, one_space, indentations)
 *         c_next_child = _nextElement(c_child)
*/
    __pyx_t_6 = __pyx_f_4lxml_5etree__hasChild(__pyx_v_c_child);
    if (__pyx_t_6) {

      /* "lxml/etree.pyx":3508
 *     while c_child is not NULL:
 *         if _hasChild(c_child):
 *             _indent_children(c_child, level+1, one_space, indentations)             # <<<<<<<<<<<<<<
 *         c_next_child = _nextElement(c_child)
 *         if not _hasNonWhitespaceTail(c_child):
*/
      __pyx_t_7 = __pyx_f_4lxml_5etree__indent_children(__pyx_v_c_child, (__pyx_v_level + 1), __pyx_v_one_space, __pyx_v_indentations); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 3508, __pyx_L1_error)

      /* "lxml/etree.pyx":3507
 *     cdef xmlNode* c_child = _findChildForwards(c_node, 0)
 *     while c_child is not NULL:
 *         if _hasChild(c_child):             # <<<<<<<<<<<<<<
 *             _indent_children(c_child, level+1, one_space, indentations)
 *         c_next_child = _nextElement(c_child)
*/
    }

    /* "lxml/etree.pyx":3509
 *         if _hasChild(c_child):
 *             _indent_children(c_child, level+1, one_space, indentations)
 *         c_next_child = _nextElement(c_child)             # <<<<<<<<<<<<<<
 *         if not _hasNonWhitespaceTail(c_child):
 *             if c_next_child is NULL:
*/
    __pyx_v_c_next_child = __pyx_f_4lxml_5etree__nextElement(__pyx_v_c_child);

    /* "lxml/etree.pyx":3510
 *             _indent_children(c_child, level+1, one_space, indentations)
 *         c_next_child = _nextElement(c_child)
 *         if not _hasNonWhitespaceTail(c_child):             # <<<<<<<<<<<<<<
 *             if c_next_child is NULL:
 *                 # Dedent after the last child.
*/
    __pyx_t_6 = __pyx_f_4lxml_5etree__hasNonWhitespaceTail(__pyx_v_c_child); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 3510, __pyx_L1_error)
    __pyx_t_2 = (!__pyx_t_6);
    if (__pyx_t_2) {

      /* "lxml/etree.pyx":3511
 *         c_next_child = _nextElement(c_child)
 *         if not _hasNonWhitespaceTail(c_child):
 *             if c_next_child is NULL:             # <<<<<<<<<<<<<<
 *                 # Dedent after the last child.
 *                 child_indentation = indentations[level-1]
*/
      __pyx_t_2 = (__pyx_v_c_next_child == NULL);
      if (__pyx_t_2) {

        /* "lxml/etree.pyx":3513
 *             if c_next_child is NULL:
 *                 # Dedent after the last child.
 *                 child_indentation = indentations[level-1]             # <<<<<<<<<<<<<<
 *             _setTailText(c_child, child_indentation)
 *         c_child = c_next_child
*/
        if (unlikely(__pyx_v_indentations == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(0, 3513, __pyx_L1_error)
        }
        __pyx_t_1 = (__pyx_v_level - 1);
        __pyx_t_4 = __Pyx_GetItemInt_List(__pyx_v_indentations, __pyx_t_1, Py_ssize_t, 1, PyLong_FromSsize_t, 1, 1, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3513, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF_SET(__pyx_v_child_indentation, __pyx_t_4);
        __pyx_t_4 = 0;

        /* "lxml/etree.pyx":3511
 *         c_next_child = _nextElement(c_child)
 *         if not _hasNonWhitespaceTail(c_child):
 *             if c_next_child is NULL:             # <<<<<<<<<<<<<<
 *                 # Dedent after the last child.
 *                 child_indentation = indentations[level-1]
*/
      }

      /* "lxml/etree.pyx":3514
 *                 # Dedent after the last child.
 *                 child_indentation = indentations[level-1]
 *             _setTailText(c_child, child_indentation)             # <<<<<<<<<<<<<<
 *         c_child = c_next_child
 *     return 0
*/
      __pyx_t_7 = __pyx_f_4lxml_5etree__setTailText(__pyx_v_c_child, __pyx_v_child_indentation); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 3514, __pyx_L1_error)

      /* "lxml/etree.pyx":3510
 *             _indent_children(c_child, level+1, one_space, indentations)
 *         c_next_child = _nextElement(c_child)
 *         if not _hasNonWhitespaceTail(c_child):             # <<<<<<<<<<<<<<
 *             if c_next_child is NULL:
 *                 # Dedent after the last child.
*/
    }

    /* "lxml/etree.pyx":3515
 *                 child_indentation = indentations[level-1]
 *             _setTailText(c_child, child_indentation)
 *         c_child = c_next_child             # <<<<<<<<<<<<<<
 *     return 0
 * 
*/
    __pyx_v_c_child = __pyx_v_c_next_child;
  }

  /* "lxml/etree.pyx":3516
 *             _setTailText(c_child, child_indentation)
 *         c_child = c_next_child
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":3494
 * 
 * 
 * cdef int _indent_children(xmlNode* c_node, Py_ssize_t level, bytes one_space, list indentations) except -1:             # <<<<<<<<<<<<<<
 *     # Reuse indentation strings for speed.
 *     if len(indentations) <= level:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._indent_children", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_child_indentation);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":3519
 * 
 * 
 * def dump(_Element elem not None, *, bint pretty_print=True, bint with_tail=True):             # <<<<<<<<<<<<<<
 *     """dump(elem, pretty_print=True, with_tail=True)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_27dump(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_26dump, "dump(elem, pretty_print=True, with_tail=True)\n\n    Writes an element tree or element structure to sys.stdout. This function\n    should be used for debugging only.\n    ");
static PyMethodDef __pyx_mdef_4lxml_5etree_27dump = {"dump", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_27dump, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_26dump};
static PyObject *__pyx_pw_4lxml_5etree_27dump(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct LxmlElement *__pyx_v_elem = 0;
  int __pyx_v_pretty_print;
  int __pyx_v_with_tail;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("dump (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_elem,&__pyx_mstate_global->__pyx_n_u_pretty_print,&__pyx_mstate_global->__pyx_n_u_with_tail,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 3519, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3519, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "dump", 0) < (0)) __PYX_ERR(0, 3519, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("dump", 1, 1, 1, i); __PYX_ERR(0, 3519, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3519, __pyx_L3_error)
    }
    __pyx_v_elem = ((struct LxmlElement *)values[0]);
    if (values[1]) {
      __pyx_v_pretty_print = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_pretty_print == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3519, __pyx_L3_error)
    } else {
      __pyx_v_pretty_print = ((int)((int)1));
    }
    if (values[2]) {
      __pyx_v_with_tail = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_with_tail == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3519, __pyx_L3_error)
    } else {
      __pyx_v_with_tail = ((int)((int)1));
    }
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("dump", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 3519, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.dump", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elem), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element, 0, "elem", 0))) __PYX_ERR(0, 3519, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_26dump(__pyx_self, __pyx_v_elem, __pyx_v_pretty_print, __pyx_v_with_tail);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_26dump(CYTHON_UNUSED PyObject *__pyx_self, struct LxmlElement *__pyx_v_elem, int __pyx_v_pretty_print, int __pyx_v_with_tail) {
  PyObject *__pyx_v_xml = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("dump", 0);

  /* "lxml/etree.pyx":3525
 *     should be used for debugging only.
 *     """
 *     xml = tostring(elem, pretty_print=pretty_print, with_tail=with_tail, encoding='unicode')             # <<<<<<<<<<<<<<
 *     if not pretty_print:
 *         xml += '\n'
*/
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_tostring); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3525, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_pretty_print); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3525, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_v_with_tail); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3525, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_6 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 3 : 0)] = {__pyx_t_2, ((PyObject *)__pyx_v_elem)};
    __pyx_t_7 = __Pyx_MakeVectorcallBuilderKwds(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3525, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_pretty_print, __pyx_t_4, __pyx_t_7, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 3525, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_with_tail, __pyx_t_5, __pyx_t_7, __pyx_callargs+2, 1) < (0)) __PYX_ERR(0, 3525, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_encoding, __pyx_mstate_global->__pyx_n_u_unicode, __pyx_t_7, __pyx_callargs+2, 2) < (0)) __PYX_ERR(0, 3525, __pyx_L1_error)
    __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_7);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3525, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v_xml = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "lxml/etree.pyx":3526
 *     """
 *     xml = tostring(elem, pretty_print=pretty_print, with_tail=with_tail, encoding='unicode')
 *     if not pretty_print:             # <<<<<<<<<<<<<<
 *         xml += '\n'
 *     sys.stdout.write(xml)
*/
  __pyx_t_8 = (!__pyx_v_pretty_print);
  if (__pyx_t_8) {

    /* "lxml/etree.pyx":3527
 *     xml = tostring(elem, pretty_print=pretty_print, with_tail=with_tail, encoding='unicode')
 *     if not pretty_print:
 *         xml += '\n'             # <<<<<<<<<<<<<<
 *     sys.stdout.write(xml)
 * 
*/
    __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_xml, __pyx_mstate_global->__pyx_kp_u__12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3527, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_xml, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "lxml/etree.pyx":3526
 *     """
 *     xml = tostring(elem, pretty_print=pretty_print, with_tail=with_tail, encoding='unicode')
 *     if not pretty_print:             # <<<<<<<<<<<<<<
 *         xml += '\n'
 *     sys.stdout.write(xml)
*/
  }

  /* "lxml/etree.pyx":3528
 *     if not pretty_print:
 *         xml += '\n'
 *     sys.stdout.write(xml)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree_sys, __pyx_mstate_global->__pyx_n_u_stdout); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3528, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_3 = __pyx_t_7;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_xml};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_write, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3528, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":3519
 * 
 * 
 * def dump(_Element elem not None, *, bint pretty_print=True, bint with_tail=True):             # <<<<<<<<<<<<<<
 *     """dump(elem, pretty_print=True, with_tail=True)
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree.dump", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_xml);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":3531
 * 
 * 
 * def tostring(element_or_tree, *, encoding=None, method="xml",             # <<<<<<<<<<<<<<
 *              xml_declaration=None, bint pretty_print=False, bint with_tail=True,
 *              standalone=None, doctype=None,
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_29tostring(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_28tostring, "tostring(element_or_tree, encoding=None, method=\"xml\",\n                 xml_declaration=None, pretty_print=False, with_tail=True,\n                 standalone=None, doctype=None,\n                 exclusive=False, inclusive_ns_prefixes=None,\n                 with_comments=True, strip_text=False,\n                 )\n\n    Serialize an element to an encoded string representation of its XML\n    tree.\n\n    Defaults to ASCII encoding without XML declaration.  This\n    behaviour can be configured with the keyword arguments 'encoding'\n    (string) and 'xml_declaration' (bool).  Note that changing the\n    encoding to a non UTF-8 compatible encoding will enable a\n    declaration by default.\n\n    You can also serialise to a Unicode string without declaration by\n    passing the name ``'unicode'`` as encoding (or the ``str`` function\n    in Py3 or ``unicode`` in Py2).  This changes the return value from\n    a byte string to an unencoded unicode string.\n\n    The keyword argument 'pretty_print' (bool) enables formatted XML.\n\n    The keyword argument 'method' selects the output method: 'xml',\n    'html', plain 'text' (text content without tags), 'c14n' or 'c14n2'.\n    Default is 'xml'.\n\n    With ``method=\"c14n\"`` (C14N version 1), the options ``exclusive``,\n    ``with_comments`` and ``inclusive_ns_prefixes`` request exclusive\n    C14N, include comments, and list the inclusive prefixes respectively.\n\n    With ``method=\"c14n2\"`` (C14N version 2), the ``with_comments`` and\n    ``strip_text`` options control the output of comments and text space\n    according to C14N 2.0.\n\n    Passing a boolean value to the ``standalone`` option will output\n    an XML declaration with the corresponding ``standalone`` flag.\n\n    The ``doctype`` option allows passing in a plain string that will\n    be serialised before the XML tree.  Note that passing in non\n    well-formed content here will make the XML output non well-formed.\n    Also, an existing doctype in ""the document tree will not be removed\n    when serialising an ElementTree instance.\n\n    You can prevent the tail text of the element from being serialised\n    by passing the boolean ``with_tail`` option.  This has no impact\n    on the tail text of children, which will always be serialised.\n    ");
static PyMethodDef __pyx_mdef_4lxml_5etree_29tostring = {"tostring", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_29tostring, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_28tostring};
static PyObject *__pyx_pw_4lxml_5etree_29tostring(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_element_or_tree = 0;
  PyObject *__pyx_v_encoding = 0;
  PyObject *__pyx_v_method = 0;
  PyObject *__pyx_v_xml_declaration = 0;
  int __pyx_v_pretty_print;
  int __pyx_v_with_tail;
  PyObject *__pyx_v_standalone = 0;
  PyObject *__pyx_v_doctype = 0;
  int __pyx_v_exclusive;
  PyObject *__pyx_v_inclusive_ns_prefixes = 0;
  int __pyx_v_with_comments;
  int __pyx_v_strip_text;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[12] = {0,0,0,0,0,0,0,0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("tostring (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_element_or_tree,&__pyx_mstate_global->__pyx_n_u_encoding,&__pyx_mstate_global->__pyx_n_u_method,&__pyx_mstate_global->__pyx_n_u_xml_declaration,&__pyx_mstate_global->__pyx_n_u_pretty_print,&__pyx_mstate_global->__pyx_n_u_with_tail,&__pyx_mstate_global->__pyx_n_u_standalone,&__pyx_mstate_global->__pyx_n_u_doctype,&__pyx_mstate_global->__pyx_n_u_exclusive,&__pyx_mstate_global->__pyx_n_u_inclusive_ns_prefixes,&__pyx_mstate_global->__pyx_n_u_with_comments,&__pyx_mstate_global->__pyx_n_u_strip_text,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 3531, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3531, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "tostring", 0) < (0)) __PYX_ERR(0, 3531, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_n_u_xml)));

      /* "lxml/etree.pyx":3532
 * 
 * def tostring(element_or_tree, *, encoding=None, method="xml",
 *              xml_declaration=None, bint pretty_print=False, bint with_tail=True,             # <<<<<<<<<<<<<<
 *              standalone=None, doctype=None,
 *              # method='c14n'
*/
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "lxml/etree.pyx":3533
 * def tostring(element_or_tree, *, encoding=None, method="xml",
 *              xml_declaration=None, bint pretty_print=False, bint with_tail=True,
 *              standalone=None, doctype=None,             # <<<<<<<<<<<<<<
 *              # method='c14n'
 *              bint exclusive=False, inclusive_ns_prefixes=None,
*/
      if (!values[6]) values[6] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[7]) values[7] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "lxml/etree.pyx":3535
 *              standalone=None, doctype=None,
 *              # method='c14n'
 *              bint exclusive=False, inclusive_ns_prefixes=None,             # <<<<<<<<<<<<<<
 *              # method='c14n2'
 *              bint with_comments=True, bint strip_text=False,
*/
      if (!values[9]) values[9] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("tostring", 1, 1, 1, i); __PYX_ERR(0, 3531, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3531, __pyx_L3_error)

      /* "lxml/etree.pyx":3531
 * 
 * 
 * def tostring(element_or_tree, *, encoding=None, method="xml",             # <<<<<<<<<<<<<<
 *              xml_declaration=None, bint pretty_print=False, bint with_tail=True,
 *              standalone=None, doctype=None,
*/
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_n_u_xml)));

      /* "lxml/etree.pyx":3532
 * 
 * def tostring(element_or_tree, *, encoding=None, method="xml",
 *              xml_declaration=None, bint pretty_print=False, bint with_tail=True,             # <<<<<<<<<<<<<<
 *              standalone=None, doctype=None,
 *              # method='c14n'
*/
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "lxml/etree.pyx":3533
 * def tostring(element_or_tree, *, encoding=None, method="xml",
 *              xml_declaration=None, bint pretty_print=False, bint with_tail=True,
 *              standalone=None, doctype=None,             # <<<<<<<<<<<<<<
 *              # method='c14n'
 *              bint exclusive=False, inclusive_ns_prefixes=None,
*/
      if (!values[6]) values[6] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[7]) values[7] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "lxml/etree.pyx":3535
 *              standalone=None, doctype=None,
 *              # method='c14n'
 *              bint exclusive=False, inclusive_ns_prefixes=None,             # <<<<<<<<<<<<<<
 *              # method='c14n2'
 *              bint with_comments=True, bint strip_text=False,
*/
      if (!values[9]) values[9] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_element_or_tree = values[0];
    __pyx_v_encoding = values[1];
    __pyx_v_method = values[2];
    __pyx_v_xml_declaration = values[3];
    if (values[4]) {
      __pyx_v_pretty_print = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_pretty_print == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3532, __pyx_L3_error)
    } else {

      /* "lxml/etree.pyx":3532
 * 
 * def tostring(element_or_tree, *, encoding=None, method="xml",
 *              xml_declaration=None, bint pretty_print=False, bint with_tail=True,             # <<<<<<<<<<<<<<
 *              standalone=None, doctype=None,
 *              # method='c14n'
*/
      __pyx_v_pretty_print = ((int)((int)0));
    }
    if (values[5]) {
      __pyx_v_with_tail = __Pyx_PyObject_IsTrue(values[5]); if (unlikely((__pyx_v_with_tail == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3532, __pyx_L3_error)
    } else {
      __pyx_v_with_tail = ((int)((int)1));
    }
    __pyx_v_standalone = values[6];
    __pyx_v_doctype = values[7];
    if (values[8]) {
      __pyx_v_exclusive = __Pyx_PyObject_IsTrue(values[8]); if (unlikely((__pyx_v_exclusive == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3535, __pyx_L3_error)
    } else {

      /* "lxml/etree.pyx":3535
 *              standalone=None, doctype=None,
 *              # method='c14n'
 *              bint exclusive=False, inclusive_ns_prefixes=None,             # <<<<<<<<<<<<<<
 *              # method='c14n2'
 *              bint with_comments=True, bint strip_text=False,
*/
      __pyx_v_exclusive = ((int)((int)0));
    }
    __pyx_v_inclusive_ns_prefixes = values[9];
    if (values[10]) {
      __pyx_v_with_comments = __Pyx_PyObject_IsTrue(values[10]); if (unlikely((__pyx_v_with_comments == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3537, __pyx_L3_error)
    } else {

      /* "lxml/etree.pyx":3537
 *              bint exclusive=False, inclusive_ns_prefixes=None,
 *              # method='c14n2'
 *              bint with_comments=True, bint strip_text=False,             # <<<<<<<<<<<<<<
 *              ):
 *     """tostring(element_or_tree, encoding=None, method="xml",
*/
      __pyx_v_with_comments = ((int)((int)1));
    }
    if (values[11]) {
      __pyx_v_strip_text = __Pyx_PyObject_IsTrue(values[11]); if (unlikely((__pyx_v_strip_text == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3537, __pyx_L3_error)
    } else {
      __pyx_v_strip_text = ((int)((int)0));
    }
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("tostring", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 3531, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.tostring", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_28tostring(__pyx_self, __pyx_v_element_or_tree, __pyx_v_encoding, __pyx_v_method, __pyx_v_xml_declaration, __pyx_v_pretty_print, __pyx_v_with_tail, __pyx_v_standalone, __pyx_v_doctype, __pyx_v_exclusive, __pyx_v_inclusive_ns_prefixes, __pyx_v_with_comments, __pyx_v_strip_text);

  /* "lxml/etree.pyx":3531
 * 
 * 
 * def tostring(element_or_tree, *, encoding=None, method="xml",             # <<<<<<<<<<<<<<
 *              xml_declaration=None, bint pretty_print=False, bint with_tail=True,
 *              standalone=None, doctype=None,
*/

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_28tostring(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_element_or_tree, PyObject *__pyx_v_encoding, PyObject *__pyx_v_method, PyObject *__pyx_v_xml_declaration, int __pyx_v_pretty_print, int __pyx_v_with_tail, PyObject *__pyx_v_standalone, PyObject *__pyx_v_doctype, int __pyx_v_exclusive, PyObject *__pyx_v_inclusive_ns_prefixes, int __pyx_v_with_comments, int __pyx_v_strip_text) {
  int __pyx_v_write_declaration;
  int __pyx_v_is_standalone;
  PyObject *__pyx_v_out = NULL;
  struct __pyx_obj_4lxml_5etree_C14NWriterTarget *__pyx_v_target = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  const char *__pyx_t_11;
  Py_ssize_t __pyx_t_12;
  PyObject *__pyx_t_13[3];
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("tostring", 0);
  __Pyx_INCREF(__pyx_v_encoding);

  /* "lxml/etree.pyx":3590
 *     cdef int is_standalone
 *     # C14N serialisation
 *     if method in ('c14n', 'c14n2'):             # <<<<<<<<<<<<<<
 *         if encoding is not None:
 *             raise ValueError("Cannot specify encoding with C14N")
*/
  __Pyx_INCREF(__pyx_v_method);
  __pyx_t_1 = __pyx_v_method;
  __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_c14n, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 3590, __pyx_L1_error)
  if (!__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_c14n2, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 3590, __pyx_L1_error)
  __pyx_t_2 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __pyx_t_2;
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":3591
 *     # C14N serialisation
 *     if method in ('c14n', 'c14n2'):
 *         if encoding is not None:             # <<<<<<<<<<<<<<
 *             raise ValueError("Cannot specify encoding with C14N")
 *         if xml_declaration:
*/
    __pyx_t_3 = (__pyx_v_encoding != Py_None);
    if (unlikely(__pyx_t_3)) {

      /* "lxml/etree.pyx":3592
 *     if method in ('c14n', 'c14n2'):
 *         if encoding is not None:
 *             raise ValueError("Cannot specify encoding with C14N")             # <<<<<<<<<<<<<<
 *         if xml_declaration:
 *             raise ValueError("Cannot enable XML declaration in C14N")
*/
      __pyx_t_4 = NULL;
      __pyx_t_5 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Cannot_specify_encoding_with_C14};
        __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3592, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_ERR(0, 3592, __pyx_L1_error)

      /* "lxml/etree.pyx":3591
 *     # C14N serialisation
 *     if method in ('c14n', 'c14n2'):
 *         if encoding is not None:             # <<<<<<<<<<<<<<
 *             raise ValueError("Cannot specify encoding with C14N")
 *         if xml_declaration:
*/
    }

    /* "lxml/etree.pyx":3593
 *         if encoding is not None:
 *             raise ValueError("Cannot specify encoding with C14N")
 *         if xml_declaration:             # <<<<<<<<<<<<<<
 *             raise ValueError("Cannot enable XML declaration in C14N")
 *         if method == 'c14n':
*/
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_xml_declaration); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 3593, __pyx_L1_error)
    if (unlikely(__pyx_t_3)) {

      /* "lxml/etree.pyx":3594
 *             raise ValueError("Cannot specify encoding with C14N")
 *         if xml_declaration:
 *             raise ValueError("Cannot enable XML declaration in C14N")             # <<<<<<<<<<<<<<
 *         if method == 'c14n':
 *             return _tostringC14N(element_or_tree, exclusive, with_comments, inclusive_ns_prefixes)
*/
      __pyx_t_4 = NULL;
      __pyx_t_5 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Cannot_enable_XML_declaration_in};
        __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3594, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_ERR(0, 3594, __pyx_L1_error)

      /* "lxml/etree.pyx":3593
 *         if encoding is not None:
 *             raise ValueError("Cannot specify encoding with C14N")
 *         if xml_declaration:             # <<<<<<<<<<<<<<
 *             raise ValueError("Cannot enable XML declaration in C14N")
 *         if method == 'c14n':
*/
    }

    /* "lxml/etree.pyx":3595
 *         if xml_declaration:
 *             raise ValueError("Cannot enable XML declaration in C14N")
 *         if method == 'c14n':             # <<<<<<<<<<<<<<
 *             return _tostringC14N(element_or_tree, exclusive, with_comments, inclusive_ns_prefixes)
 *         else:
*/
    __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_v_method, __pyx_mstate_global->__pyx_n_u_c14n, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 3595, __pyx_L1_error)
    if (__pyx_t_3) {

      /* "lxml/etree.pyx":3596
 *             raise ValueError("Cannot enable XML declaration in C14N")
 *         if method == 'c14n':
 *             return _tostringC14N(element_or_tree, exclusive, with_comments, inclusive_ns_prefixes)             # <<<<<<<<<<<<<<
 *         else:
 *             out = BytesIO()
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __pyx_f_4lxml_5etree__tostringC14N(__pyx_v_element_or_tree, __pyx_v_exclusive, __pyx_v_with_comments, __pyx_v_inclusive_ns_prefixes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3596, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* "lxml/etree.pyx":3595
 *         if xml_declaration:
 *             raise ValueError("Cannot enable XML declaration in C14N")
 *         if method == 'c14n':             # <<<<<<<<<<<<<<
 *             return _tostringC14N(element_or_tree, exclusive, with_comments, inclusive_ns_prefixes)
 *         else:
*/
    }

    /* "lxml/etree.pyx":3598
 *             return _tostringC14N(element_or_tree, exclusive, with_comments, inclusive_ns_prefixes)
 *         else:
 *             out = BytesIO()             # <<<<<<<<<<<<<<
 *             target = C14NWriterTarget(
 *                 utf8_writer(out).write,
*/
    /*else*/ {
      __pyx_t_4 = NULL;
      __Pyx_INCREF(__pyx_v_4lxml_5etree_BytesIO);
      __pyx_t_6 = __pyx_v_4lxml_5etree_BytesIO; 
      __pyx_t_5 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
        assert(__pyx_t_4);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
        __pyx_t_5 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
        __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3598, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __pyx_v_out = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "lxml/etree.pyx":3599
 *         else:
 *             out = BytesIO()
 *             target = C14NWriterTarget(             # <<<<<<<<<<<<<<
 *                 utf8_writer(out).write,
 *                 with_comments=with_comments, strip_text=strip_text)
*/
      __pyx_t_6 = NULL;

      /* "lxml/etree.pyx":3600
 *             out = BytesIO()
 *             target = C14NWriterTarget(
 *                 utf8_writer(out).write,             # <<<<<<<<<<<<<<
 *                 with_comments=with_comments, strip_text=strip_text)
 *             _tree_to_target(element_or_tree, target)
*/
      __pyx_t_7 = NULL;
      __Pyx_INCREF(__pyx_v_4lxml_5etree_utf8_writer);
      __pyx_t_8 = __pyx_v_4lxml_5etree_utf8_writer; 
      __pyx_t_5 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_8))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8);
        assert(__pyx_t_7);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_8, __pyx__function);
        __pyx_t_5 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_v_out};
        __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_8, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3600, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
      }
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_write); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3600, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "lxml/etree.pyx":3601
 *             target = C14NWriterTarget(
 *                 utf8_writer(out).write,
 *                 with_comments=with_comments, strip_text=strip_text)             # <<<<<<<<<<<<<<
 *             _tree_to_target(element_or_tree, target)
 *             return out.getvalue()
*/
      __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_with_comments); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3601, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_strip_text); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3601, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_5 = 1;
      {
        PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_6, __pyx_t_8};
        __pyx_t_9 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 3599, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_with_comments, __pyx_t_4, __pyx_t_9, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 3599, __pyx_L1_error)
        if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_strip_text, __pyx_t_7, __pyx_t_9, __pyx_callargs+2, 1) < (0)) __PYX_ERR(0, 3599, __pyx_L1_error)
        __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_C14NWriterTarget, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_9);
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3599, __pyx_L1_error)
        __Pyx_GOTREF((PyObject *)__pyx_t_1);
      }
      __pyx_v_target = ((struct __pyx_obj_4lxml_5etree_C14NWriterTarget *)__pyx_t_1);
      __pyx_t_1 = 0;

      /* "lxml/etree.pyx":3602
 *                 utf8_writer(out).write,
 *                 with_comments=with_comments, strip_text=strip_text)
 *             _tree_to_target(element_or_tree, target)             # <<<<<<<<<<<<<<
 *             return out.getvalue()
 *     if not with_comments:
*/
      __pyx_t_1 = __pyx_f_4lxml_5etree__tree_to_target(__pyx_v_element_or_tree, ((PyObject *)__pyx_v_target)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3602, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "lxml/etree.pyx":3603
 *                 with_comments=with_comments, strip_text=strip_text)
 *             _tree_to_target(element_or_tree, target)
 *             return out.getvalue()             # <<<<<<<<<<<<<<
 *     if not with_comments:
 *         raise ValueError("Can only discard comments in C14N serialisation")
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_9 = __pyx_v_out;
      __Pyx_INCREF(__pyx_t_9);
      __pyx_t_5 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_9, NULL};
        __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_getvalue, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3603, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;
    }

    /* "lxml/etree.pyx":3590
 *     cdef int is_standalone
 *     # C14N serialisation
 *     if method in ('c14n', 'c14n2'):             # <<<<<<<<<<<<<<
 *         if encoding is not None:
 *             raise ValueError("Cannot specify encoding with C14N")
*/
  }

  /* "lxml/etree.pyx":3604
 *             _tree_to_target(element_or_tree, target)
 *             return out.getvalue()
 *     if not with_comments:             # <<<<<<<<<<<<<<
 *         raise ValueError("Can only discard comments in C14N serialisation")
 *     if strip_text:
*/
  __pyx_t_3 = (!__pyx_v_with_comments);
  if (unlikely(__pyx_t_3)) {

    /* "lxml/etree.pyx":3605
 *             return out.getvalue()
 *     if not with_comments:
 *         raise ValueError("Can only discard comments in C14N serialisation")             # <<<<<<<<<<<<<<
 *     if strip_text:
 *         raise ValueError("Can only strip text in C14N 2.0 serialisation")
*/
    __pyx_t_9 = NULL;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_mstate_global->__pyx_kp_u_Can_only_discard_comments_in_C14};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3605, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 3605, __pyx_L1_error)

    /* "lxml/etree.pyx":3604
 *             _tree_to_target(element_or_tree, target)
 *             return out.getvalue()
 *     if not with_comments:             # <<<<<<<<<<<<<<
 *         raise ValueError("Can only discard comments in C14N serialisation")
 *     if strip_text:
*/
  }

  /* "lxml/etree.pyx":3606
 *     if not with_comments:
 *         raise ValueError("Can only discard comments in C14N serialisation")
 *     if strip_text:             # <<<<<<<<<<<<<<
 *         raise ValueError("Can only strip text in C14N 2.0 serialisation")
 *     if encoding is unicode or (encoding is not None and encoding.lower() == 'unicode'):
*/
  if (unlikely(__pyx_v_strip_text)) {

    /* "lxml/etree.pyx":3607
 *         raise ValueError("Can only discard comments in C14N serialisation")
 *     if strip_text:
 *         raise ValueError("Can only strip text in C14N 2.0 serialisation")             # <<<<<<<<<<<<<<
 *     if encoding is unicode or (encoding is not None and encoding.lower() == 'unicode'):
 *         if xml_declaration:
*/
    __pyx_t_9 = NULL;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_mstate_global->__pyx_kp_u_Can_only_strip_text_in_C14N_2_0};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3607, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 3607, __pyx_L1_error)

    /* "lxml/etree.pyx":3606
 *     if not with_comments:
 *         raise ValueError("Can only discard comments in C14N serialisation")
 *     if strip_text:             # <<<<<<<<<<<<<<
 *         raise ValueError("Can only strip text in C14N 2.0 serialisation")
 *     if encoding is unicode or (encoding is not None and encoding.lower() == 'unicode'):
*/
  }

  /* "lxml/etree.pyx":3608
 *     if strip_text:
 *         raise ValueError("Can only strip text in C14N 2.0 serialisation")
 *     if encoding is unicode or (encoding is not None and encoding.lower() == 'unicode'):             # <<<<<<<<<<<<<<
 *         if xml_declaration:
 *             raise ValueError, \
*/
  __pyx_t_2 = (__pyx_v_encoding == ((PyObject *)(&PyUnicode_Type)));
  if (!__pyx_t_2) {
  } else {
    __pyx_t_3 = __pyx_t_2;
    goto __pyx_L12_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_encoding != Py_None);
  if (__pyx_t_2) {
  } else {
    __pyx_t_3 = __pyx_t_2;
    goto __pyx_L12_bool_binop_done;
  }
  __pyx_t_9 = __pyx_v_encoding;
  __Pyx_INCREF(__pyx_t_9);
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_9, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_lower, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3608, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_unicode, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 3608, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __pyx_t_2;
  __pyx_L12_bool_binop_done:;
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":3609
 *         raise ValueError("Can only strip text in C14N 2.0 serialisation")
 *     if encoding is unicode or (encoding is not None and encoding.lower() == 'unicode'):
 *         if xml_declaration:             # <<<<<<<<<<<<<<
 *             raise ValueError, \
 *                 "Serialisation to unicode must not request an XML declaration"
*/
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_xml_declaration); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 3609, __pyx_L1_error)
    if (unlikely(__pyx_t_3)) {

      /* "lxml/etree.pyx":3610
 *     if encoding is unicode or (encoding is not None and encoding.lower() == 'unicode'):
 *         if xml_declaration:
 *             raise ValueError, \             # <<<<<<<<<<<<<<
 *                 "Serialisation to unicode must not request an XML declaration"
 *         write_declaration = 0
*/
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Serialisation_to_unicode_must_no, 0, 0);
      __PYX_ERR(0, 3610, __pyx_L1_error)

      /* "lxml/etree.pyx":3609
 *         raise ValueError("Can only strip text in C14N 2.0 serialisation")
 *     if encoding is unicode or (encoding is not None and encoding.lower() == 'unicode'):
 *         if xml_declaration:             # <<<<<<<<<<<<<<
 *             raise ValueError, \
 *                 "Serialisation to unicode must not request an XML declaration"
*/
    }

    /* "lxml/etree.pyx":3612
 *             raise ValueError, \
 *                 "Serialisation to unicode must not request an XML declaration"
 *         write_declaration = 0             # <<<<<<<<<<<<<<
 *         encoding = unicode
 *     elif xml_declaration is None:
*/
    __pyx_v_write_declaration = 0;

    /* "lxml/etree.pyx":3613
 *                 "Serialisation to unicode must not request an XML declaration"
 *         write_declaration = 0
 *         encoding = unicode             # <<<<<<<<<<<<<<
 *     elif xml_declaration is None:
 *         # by default, write an XML declaration only for non-standard encodings
*/
    __Pyx_INCREF((PyObject *)(&PyUnicode_Type));
    __Pyx_DECREF_SET(__pyx_v_encoding, ((PyObject *)(&PyUnicode_Type)));

    /* "lxml/etree.pyx":3608
 *     if strip_text:
 *         raise ValueError("Can only strip text in C14N 2.0 serialisation")
 *     if encoding is unicode or (encoding is not None and encoding.lower() == 'unicode'):             # <<<<<<<<<<<<<<
 *         if xml_declaration:
 *             raise ValueError, \
*/
    goto __pyx_L11;
  }

  /* "lxml/etree.pyx":3614
 *         write_declaration = 0
 *         encoding = unicode
 *     elif xml_declaration is None:             # <<<<<<<<<<<<<<
 *         # by default, write an XML declaration only for non-standard encodings
 *         write_declaration = encoding is not None and encoding.upper() not in \
*/
  __pyx_t_3 = (__pyx_v_xml_declaration == Py_None);
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":3616
 *     elif xml_declaration is None:
 *         # by default, write an XML declaration only for non-standard encodings
 *         write_declaration = encoding is not None and encoding.upper() not in \             # <<<<<<<<<<<<<<
 *                             ('ASCII', 'UTF-8', 'UTF8', 'US-ASCII')
 *     else:
*/
    __pyx_t_2 = (__pyx_v_encoding != Py_None);
    if (__pyx_t_2) {
    } else {
      __pyx_t_3 = __pyx_t_2;
      goto __pyx_L16_bool_binop_done;
    }
    __pyx_t_9 = __pyx_v_encoding;
    __Pyx_INCREF(__pyx_t_9);
    __pyx_t_5 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_9, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_upper, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3616, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_t_10 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_ASCII, Py_NE)); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 3616, __pyx_L1_error)
    if (__pyx_t_10) {
    } else {
      __pyx_t_2 = __pyx_t_10;
      goto __pyx_L18_bool_binop_done;
    }
    __pyx_t_10 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_mstate_global->__pyx_kp_u_UTF_8, Py_NE)); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 3616, __pyx_L1_error)
    if (__pyx_t_10) {
    } else {
      __pyx_t_2 = __pyx_t_10;
      goto __pyx_L18_bool_binop_done;
    }
    __pyx_t_10 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_UTF8, Py_NE)); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 3616, __pyx_L1_error)
    if (__pyx_t_10) {
    } else {
      __pyx_t_2 = __pyx_t_10;
      goto __pyx_L18_bool_binop_done;
    }
    __pyx_t_10 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_mstate_global->__pyx_kp_u_US_ASCII, Py_NE)); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 3616, __pyx_L1_error)
    __pyx_t_2 = __pyx_t_10;
    __pyx_L18_bool_binop_done:;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_10 = __pyx_t_2;
    __pyx_t_3 = __pyx_t_10;
    __pyx_L16_bool_binop_done:;
    __pyx_v_write_declaration = __pyx_t_3;

    /* "lxml/etree.pyx":3614
 *         write_declaration = 0
 *         encoding = unicode
 *     elif xml_declaration is None:             # <<<<<<<<<<<<<<
 *         # by default, write an XML declaration only for non-standard encodings
 *         write_declaration = encoding is not None and encoding.upper() not in \
*/
    goto __pyx_L11;
  }

  /* "lxml/etree.pyx":3619
 *                             ('ASCII', 'UTF-8', 'UTF8', 'US-ASCII')
 *     else:
 *         write_declaration = xml_declaration             # <<<<<<<<<<<<<<
 *     if encoding is None:
 *         encoding = 'ASCII'
*/
  /*else*/ {
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_xml_declaration); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3619, __pyx_L1_error)
    __pyx_v_write_declaration = __pyx_t_3;
  }
  __pyx_L11:;

  /* "lxml/etree.pyx":3620
 *     else:
 *         write_declaration = xml_declaration
 *     if encoding is None:             # <<<<<<<<<<<<<<
 *         encoding = 'ASCII'
 *     if standalone is None:
*/
  __pyx_t_3 = (__pyx_v_encoding == Py_None);
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":3621
 *         write_declaration = xml_declaration
 *     if encoding is None:
 *         encoding = 'ASCII'             # <<<<<<<<<<<<<<
 *     if standalone is None:
 *         is_standalone = -1
*/
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_ASCII);
    __Pyx_DECREF_SET(__pyx_v_encoding, __pyx_mstate_global->__pyx_n_u_ASCII);

    /* "lxml/etree.pyx":3620
 *     else:
 *         write_declaration = xml_declaration
 *     if encoding is None:             # <<<<<<<<<<<<<<
 *         encoding = 'ASCII'
 *     if standalone is None:
*/
  }

  /* "lxml/etree.pyx":3622
 *     if encoding is None:
 *         encoding = 'ASCII'
 *     if standalone is None:             # <<<<<<<<<<<<<<
 *         is_standalone = -1
 *     elif standalone:
*/
  __pyx_t_3 = (__pyx_v_standalone == Py_None);
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":3623
 *         encoding = 'ASCII'
 *     if standalone is None:
 *         is_standalone = -1             # <<<<<<<<<<<<<<
 *     elif standalone:
 *         write_declaration = 1
*/
    __pyx_v_is_standalone = -1;

    /* "lxml/etree.pyx":3622
 *     if encoding is None:
 *         encoding = 'ASCII'
 *     if standalone is None:             # <<<<<<<<<<<<<<
 *         is_standalone = -1
 *     elif standalone:
*/
    goto __pyx_L23;
  }

  /* "lxml/etree.pyx":3624
 *     if standalone is None:
 *         is_standalone = -1
 *     elif standalone:             # <<<<<<<<<<<<<<
 *         write_declaration = 1
 *         is_standalone = 1
*/
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_standalone); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 3624, __pyx_L1_error)
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":3625
 *         is_standalone = -1
 *     elif standalone:
 *         write_declaration = 1             # <<<<<<<<<<<<<<
 *         is_standalone = 1
 *     else:
*/
    __pyx_v_write_declaration = 1;

    /* "lxml/etree.pyx":3626
 *     elif standalone:
 *         write_declaration = 1
 *         is_standalone = 1             # <<<<<<<<<<<<<<
 *     else:
 *         write_declaration = 1
*/
    __pyx_v_is_standalone = 1;

    /* "lxml/etree.pyx":3624
 *     if standalone is None:
 *         is_standalone = -1
 *     elif standalone:             # <<<<<<<<<<<<<<
 *         write_declaration = 1
 *         is_standalone = 1
*/
    goto __pyx_L23;
  }

  /* "lxml/etree.pyx":3628
 *         is_standalone = 1
 *     else:
 *         write_declaration = 1             # <<<<<<<<<<<<<<
 *         is_standalone = 0
 * 
*/
  /*else*/ {
    __pyx_v_write_declaration = 1;

    /* "lxml/etree.pyx":3629
 *     else:
 *         write_declaration = 1
 *         is_standalone = 0             # <<<<<<<<<<<<<<
 * 
 *     if isinstance(element_or_tree, _Element):
*/
    __pyx_v_is_standalone = 0;
  }
  __pyx_L23:;

  /* "lxml/etree.pyx":3631
 *         is_standalone = 0
 * 
 *     if isinstance(element_or_tree, _Element):             # <<<<<<<<<<<<<<
 *         return _tostring(<_Element>element_or_tree, encoding, doctype, method,
 *                          write_declaration, 0, pretty_print, with_tail,
*/
  __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_element_or_tree, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element); 
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":3632
 * 
 *     if isinstance(element_or_tree, _Element):
 *         return _tostring(<_Element>element_or_tree, encoding, doctype, method,             # <<<<<<<<<<<<<<
 *                          write_declaration, 0, pretty_print, with_tail,
 *                          is_standalone)
*/
    __Pyx_XDECREF(__pyx_r);

    /* "lxml/etree.pyx":3634
 *         return _tostring(<_Element>element_or_tree, encoding, doctype, method,
 *                          write_declaration, 0, pretty_print, with_tail,
 *                          is_standalone)             # <<<<<<<<<<<<<<
 *     elif isinstance(element_or_tree, _ElementTree):
 *         return _tostring((<_ElementTree>element_or_tree)._context_node,
*/
    __pyx_t_1 = __pyx_f_4lxml_5etree__tostring(((struct LxmlElement *)__pyx_v_element_or_tree), __pyx_v_encoding, __pyx_v_doctype, __pyx_v_method, __pyx_v_write_declaration, 0, __pyx_v_pretty_print, __pyx_v_with_tail, __pyx_v_is_standalone); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3632, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "lxml/etree.pyx":3631
 *         is_standalone = 0
 * 
 *     if isinstance(element_or_tree, _Element):             # <<<<<<<<<<<<<<
 *         return _tostring(<_Element>element_or_tree, encoding, doctype, method,
 *                          write_declaration, 0, pretty_print, with_tail,
*/
  }

  /* "lxml/etree.pyx":3635
 *                          write_declaration, 0, pretty_print, with_tail,
 *                          is_standalone)
 *     elif isinstance(element_or_tree, _ElementTree):             # <<<<<<<<<<<<<<
 *         return _tostring((<_ElementTree>element_or_tree)._context_node,
 *                          encoding, doctype, method, write_declaration, 1,
*/
  __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_element_or_tree, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ElementTree); 
  if (likely(__pyx_t_3)) {

    /* "lxml/etree.pyx":3636
 *                          is_standalone)
 *     elif isinstance(element_or_tree, _ElementTree):
 *         return _tostring((<_ElementTree>element_or_tree)._context_node,             # <<<<<<<<<<<<<<
 *                          encoding, doctype, method, write_declaration, 1,
 *                          pretty_print, with_tail, is_standalone)
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = ((PyObject *)((struct LxmlElementTree *)__pyx_v_element_or_tree)->_context_node);
    __Pyx_INCREF(__pyx_t_1);

    /* "lxml/etree.pyx":3638
 *         return _tostring((<_ElementTree>element_or_tree)._context_node,
 *                          encoding, doctype, method, write_declaration, 1,
 *                          pretty_print, with_tail, is_standalone)             # <<<<<<<<<<<<<<
 *     else:
 *         raise TypeError, f"Type '{python._fqtypename(element_or_tree).decode('utf8')}' cannot be serialized."
*/
    __pyx_t_9 = __pyx_f_4lxml_5etree__tostring(((struct LxmlElement *)__pyx_t_1), __pyx_v_encoding, __pyx_v_doctype, __pyx_v_method, __pyx_v_write_declaration, 1, __pyx_v_pretty_print, __pyx_v_with_tail, __pyx_v_is_standalone); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 3636, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_r = __pyx_t_9;
    __pyx_t_9 = 0;
    goto __pyx_L0;

    /* "lxml/etree.pyx":3635
 *                          write_declaration, 0, pretty_print, with_tail,
 *                          is_standalone)
 *     elif isinstance(element_or_tree, _ElementTree):             # <<<<<<<<<<<<<<
 *         return _tostring((<_ElementTree>element_or_tree)._context_node,
 *                          encoding, doctype, method, write_declaration, 1,
*/
  }

  /* "lxml/etree.pyx":3640
 *                          pretty_print, with_tail, is_standalone)
 *     else:
 *         raise TypeError, f"Type '{python._fqtypename(element_or_tree).decode('utf8')}' cannot be serialized."             # <<<<<<<<<<<<<<
 * 
 * 
*/
  /*else*/ {
    __pyx_t_11 = _fqtypename(__pyx_v_element_or_tree);
    __pyx_t_12 = __Pyx_ssize_strlen(__pyx_t_11); if (unlikely(__pyx_t_12 == ((Py_ssize_t)-1))) __PYX_ERR(0, 3640, __pyx_L1_error)
    __pyx_t_9 = __Pyx_decode_c_string(__pyx_t_11, 0, __pyx_t_12, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 3640, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_13[0] = __pyx_mstate_global->__pyx_kp_u_Type;
    __pyx_t_13[1] = __pyx_t_9;
    __pyx_t_13[2] = __pyx_mstate_global->__pyx_kp_u_cannot_be_serialized;
    __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_13, 3, 6 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_9) + 23, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_9));
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3640, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_t_1, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 3640, __pyx_L1_error)
  }

  /* "lxml/etree.pyx":3531
 * 
 * 
 * def tostring(element_or_tree, *, encoding=None, method="xml",             # <<<<<<<<<<<<<<
 *              xml_declaration=None, bint pretty_print=False, bint with_tail=True,
 *              standalone=None, doctype=None,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("lxml.etree.tostring", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_out);
  __Pyx_XDECREF((PyObject *)__pyx_v_target);
  __Pyx_XDECREF(__pyx_v_encoding);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":3644
 * 
 * 
 * def tostringlist(element_or_tree, *args, **kwargs):             # <<<<<<<<<<<<<<
 *     """tostringlist(element_or_tree, *args, **kwargs)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_31tostringlist(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_30tostringlist, "tostringlist(element_or_tree, *args, **kwargs)\n\n    Serialize an element to an encoded string representation of its XML\n    tree, stored in a list of partial strings.\n\n    This is purely for ElementTree 1.3 compatibility.  The result is a\n    single string wrapped in a list.\n    ");
static PyMethodDef __pyx_mdef_4lxml_5etree_31tostringlist = {"tostringlist", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_31tostringlist, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_30tostringlist};
static PyObject *__pyx_pw_4lxml_5etree_31tostringlist(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_element_or_tree = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kwargs = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("tostringlist (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  __pyx_v_args = __Pyx_ArgsSlice_FASTCALL(__pyx_args, 1, __pyx_nargs);
  if (unlikely(!__pyx_v_args)) {
    __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_v_args);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_element_or_tree,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 3644, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        default:
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3644, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      const Py_ssize_t used_pos_args = (kwd_pos_args < 1) ? kwd_pos_args : 1;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v_kwargs, values, used_pos_args, __pyx_kwds_len, "tostringlist", 1) < (0)) __PYX_ERR(0, 3644, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("tostringlist", 0, 1, 1, i); __PYX_ERR(0, 3644, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs < 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3644, __pyx_L3_error)
    }
    __pyx_v_element_or_tree = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("tostringlist", 0, 1, 1, __pyx_nargs); __PYX_ERR(0, 3644, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0;
  __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("lxml.etree.tostringlist", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_30tostringlist(__pyx_self, __pyx_v_element_or_tree, __pyx_v_args, __pyx_v_kwargs);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v_args);
  __Pyx_DECREF(__pyx_v_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_30tostringlist(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_element_or_tree, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("tostringlist", 0);

  /* "lxml/etree.pyx":3653
 *     single string wrapped in a list.
 *     """
 *     return [tostring(element_or_tree, *args, **kwargs)]             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_tostring); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3653, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3653, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_element_or_tree);
  __Pyx_GIVEREF(__pyx_v_element_or_tree);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_element_or_tree) != (0)) __PYX_ERR(0, 3653, __pyx_L1_error);
  __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_v_args); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3653, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3653, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3653, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3653, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_4);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_4) != (0)) __PYX_ERR(0, 3653, __pyx_L1_error);
  __pyx_t_4 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":3644
 * 
 * 
 * def tostringlist(element_or_tree, *args, **kwargs):             # <<<<<<<<<<<<<<
 *     """tostringlist(element_or_tree, *args, **kwargs)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.tostringlist", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":3656
 * 
 * 
 * def tounicode(element_or_tree, *, method="xml", bint pretty_print=False,             # <<<<<<<<<<<<<<
 *               bint with_tail=True, doctype=None):
 *     """tounicode(element_or_tree, method="xml", pretty_print=False,
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_33tounicode(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_32tounicode, "tounicode(element_or_tree, method=\"xml\", pretty_print=False,\n                  with_tail=True, doctype=None)\n\n    Serialize an element to the Python unicode representation of its XML\n    tree.\n\n    :deprecated: use ``tostring(el, encoding='unicode')`` instead.\n\n    Note that the result does not carry an XML encoding declaration and is\n    therefore not necessarily suited for serialization to byte streams without\n    further treatment.\n\n    The boolean keyword argument 'pretty_print' enables formatted XML.\n\n    The keyword argument 'method' selects the output method: 'xml',\n    'html' or plain 'text'.\n\n    You can prevent the tail text of the element from being serialised\n    by passing the boolean ``with_tail`` option.  This has no impact\n    on the tail text of children, which will always be serialised.\n    ");
static PyMethodDef __pyx_mdef_4lxml_5etree_33tounicode = {"tounicode", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_33tounicode, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_32tounicode};
static PyObject *__pyx_pw_4lxml_5etree_33tounicode(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_element_or_tree = 0;
  PyObject *__pyx_v_method = 0;
  int __pyx_v_pretty_print;
  int __pyx_v_with_tail;
  PyObject *__pyx_v_doctype = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[5] = {0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("tounicode (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_element_or_tree,&__pyx_mstate_global->__pyx_n_u_method,&__pyx_mstate_global->__pyx_n_u_pretty_print,&__pyx_mstate_global->__pyx_n_u_with_tail,&__pyx_mstate_global->__pyx_n_u_doctype,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 3656, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3656, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "tounicode", 0) < (0)) __PYX_ERR(0, 3656, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_n_u_xml)));

      /* "lxml/etree.pyx":3657
 * 
 * def tounicode(element_or_tree, *, method="xml", bint pretty_print=False,
 *               bint with_tail=True, doctype=None):             # <<<<<<<<<<<<<<
 *     """tounicode(element_or_tree, method="xml", pretty_print=False,
 *                   with_tail=True, doctype=None)
*/
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("tounicode", 1, 1, 1, i); __PYX_ERR(0, 3656, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3656, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_n_u_xml)));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_element_or_tree = values[0];
    __pyx_v_method = values[1];
    if (values[2]) {
      __pyx_v_pretty_print = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_pretty_print == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3656, __pyx_L3_error)
    } else {

      /* "lxml/etree.pyx":3656
 * 
 * 
 * def tounicode(element_or_tree, *, method="xml", bint pretty_print=False,             # <<<<<<<<<<<<<<
 *               bint with_tail=True, doctype=None):
 *     """tounicode(element_or_tree, method="xml", pretty_print=False,
*/
      __pyx_v_pretty_print = ((int)((int)0));
    }
    if (values[3]) {
      __pyx_v_with_tail = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_with_tail == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3657, __pyx_L3_error)
    } else {

      /* "lxml/etree.pyx":3657
 * 
 * def tounicode(element_or_tree, *, method="xml", bint pretty_print=False,
 *               bint with_tail=True, doctype=None):             # <<<<<<<<<<<<<<
 *     """tounicode(element_or_tree, method="xml", pretty_print=False,
 *                   with_tail=True, doctype=None)
*/
      __pyx_v_with_tail = ((int)((int)1));
    }
    __pyx_v_doctype = values[4];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("tounicode", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 3656, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.tounicode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_32tounicode(__pyx_self, __pyx_v_element_or_tree, __pyx_v_method, __pyx_v_pretty_print, __pyx_v_with_tail, __pyx_v_doctype);

  /* "lxml/etree.pyx":3656
 * 
 * 
 * def tounicode(element_or_tree, *, method="xml", bint pretty_print=False,             # <<<<<<<<<<<<<<
 *               bint with_tail=True, doctype=None):
 *     """tounicode(element_or_tree, method="xml", pretty_print=False,
*/

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_32tounicode(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_element_or_tree, PyObject *__pyx_v_method, int __pyx_v_pretty_print, int __pyx_v_with_tail, PyObject *__pyx_v_doctype) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4[3];
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("tounicode", 0);

  /* "lxml/etree.pyx":3679
 *     on the tail text of children, which will always be serialised.
 *     """
 *     if isinstance(element_or_tree, _Element):             # <<<<<<<<<<<<<<
 *         return _tostring(<_Element>element_or_tree, unicode, doctype, method,
 *                           0, 0, pretty_print, with_tail, -1)
*/
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_element_or_tree, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element); 
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":3680
 *     """
 *     if isinstance(element_or_tree, _Element):
 *         return _tostring(<_Element>element_or_tree, unicode, doctype, method,             # <<<<<<<<<<<<<<
 *                           0, 0, pretty_print, with_tail, -1)
 *     elif isinstance(element_or_tree, _ElementTree):
*/
    __Pyx_XDECREF(__pyx_r);

    /* "lxml/etree.pyx":3681
 *     if isinstance(element_or_tree, _Element):
 *         return _tostring(<_Element>element_or_tree, unicode, doctype, method,
 *                           0, 0, pretty_print, with_tail, -1)             # <<<<<<<<<<<<<<
 *     elif isinstance(element_or_tree, _ElementTree):
 *         return _tostring((<_ElementTree>element_or_tree)._context_node,
*/
    __pyx_t_2 = __pyx_f_4lxml_5etree__tostring(((struct LxmlElement *)__pyx_v_element_or_tree), ((PyObject *)(&PyUnicode_Type)), __pyx_v_doctype, __pyx_v_method, 0, 0, __pyx_v_pretty_print, __pyx_v_with_tail, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3680, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "lxml/etree.pyx":3679
 *     on the tail text of children, which will always be serialised.
 *     """
 *     if isinstance(element_or_tree, _Element):             # <<<<<<<<<<<<<<
 *         return _tostring(<_Element>element_or_tree, unicode, doctype, method,
 *                           0, 0, pretty_print, with_tail, -1)
*/
  }

  /* "lxml/etree.pyx":3682
 *         return _tostring(<_Element>element_or_tree, unicode, doctype, method,
 *                           0, 0, pretty_print, with_tail, -1)
 *     elif isinstance(element_or_tree, _ElementTree):             # <<<<<<<<<<<<<<
 *         return _tostring((<_ElementTree>element_or_tree)._context_node,
 *                          unicode, doctype, method, 0, 1, pretty_print,
*/
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_element_or_tree, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ElementTree); 
  if (likely(__pyx_t_1)) {

    /* "lxml/etree.pyx":3683
 *                           0, 0, pretty_print, with_tail, -1)
 *     elif isinstance(element_or_tree, _ElementTree):
 *         return _tostring((<_ElementTree>element_or_tree)._context_node,             # <<<<<<<<<<<<<<
 *                          unicode, doctype, method, 0, 1, pretty_print,
 *                          with_tail, -1)
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = ((PyObject *)((struct LxmlElementTree *)__pyx_v_element_or_tree)->_context_node);
    __Pyx_INCREF(__pyx_t_2);

    /* "lxml/etree.pyx":3685
 *         return _tostring((<_ElementTree>element_or_tree)._context_node,
 *                          unicode, doctype, method, 0, 1, pretty_print,
 *                          with_tail, -1)             # <<<<<<<<<<<<<<
 *     else:
 *         raise TypeError, f"Type '{type(element_or_tree)}' cannot be serialized."
*/
    __pyx_t_3 = __pyx_f_4lxml_5etree__tostring(((struct LxmlElement *)__pyx_t_2), ((PyObject *)(&PyUnicode_Type)), __pyx_v_doctype, __pyx_v_method, 0, 1, __pyx_v_pretty_print, __pyx_v_with_tail, -1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3683, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "lxml/etree.pyx":3682
 *         return _tostring(<_Element>element_or_tree, unicode, doctype, method,
 *                           0, 0, pretty_print, with_tail, -1)
 *     elif isinstance(element_or_tree, _ElementTree):             # <<<<<<<<<<<<<<
 *         return _tostring((<_ElementTree>element_or_tree)._context_node,
 *                          unicode, doctype, method, 0, 1, pretty_print,
*/
  }

  /* "lxml/etree.pyx":3687
 *                          with_tail, -1)
 *     else:
 *         raise TypeError, f"Type '{type(element_or_tree)}' cannot be serialized."             # <<<<<<<<<<<<<<
 * 
 * 
*/
  /*else*/ {
    __pyx_t_3 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(__pyx_v_element_or_tree)), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3687, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u_Type;
    __pyx_t_4[1] = __pyx_t_3;
    __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u_cannot_be_serialized;
    __pyx_t_2 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, 6 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 23, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3));
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3687, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_t_2, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(0, 3687, __pyx_L1_error)
  }

  /* "lxml/etree.pyx":3656
 * 
 * 
 * def tounicode(element_or_tree, *, method="xml", bint pretty_print=False,             # <<<<<<<<<<<<<<
 *               bint with_tail=True, doctype=None):
 *     """tounicode(element_or_tree, method="xml", pretty_print=False,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.tounicode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":3690
 * 
 * 
 * def parse(source, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     """parse(source, parser=None, base_url=None)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_35parse(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_34parse, "parse(source, parser=None, base_url=None)\n\n    Return an ElementTree object loaded with source elements.  If no parser\n    is provided as second argument, the default parser is used.\n\n    The ``source`` can be any of the following:\n\n    - a file name/path\n    - a file object\n    - a file-like object\n    - a URL using the HTTP or FTP protocol\n\n    To parse from a string, use the ``fromstring()`` function instead.\n\n    Note that it is generally faster to parse from a file path or URL\n    than from an open file object or file-like object.  Transparent\n    decompression from gzip compressed sources is supported (unless\n    explicitly disabled in libxml2).\n\n    The ``base_url`` keyword allows setting a URL for the document\n    when parsing from a file-like object.  This is needed when looking\n    up external entities (DTD, XInclude, ...) with relative paths.\n    ");
static PyMethodDef __pyx_mdef_4lxml_5etree_35parse = {"parse", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_35parse, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_34parse};
static PyObject *__pyx_pw_4lxml_5etree_35parse(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_source = 0;
  struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser = 0;
  PyObject *__pyx_v_base_url = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("parse (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_source,&__pyx_mstate_global->__pyx_n_u_parser,&__pyx_mstate_global->__pyx_n_u_base_url,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 3690, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 3690, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3690, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "parse", 0) < (0)) __PYX_ERR(0, 3690, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef((PyObject *)((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("parse", 0, 1, 2, i); __PYX_ERR(0, 3690, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 3690, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3690, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef((PyObject *)((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_source = values[0];
    __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)values[1]);
    __pyx_v_base_url = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("parse", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 3690, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.parse", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parser), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__BaseParser, 1, "parser", 0))) __PYX_ERR(0, 3690, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_34parse(__pyx_self, __pyx_v_source, __pyx_v_parser, __pyx_v_base_url);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_34parse(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_source, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser, PyObject *__pyx_v_base_url) {
  struct LxmlDocument *__pyx_v_doc = 0;
  PyObject *__pyx_v_result_container = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_t_9;
  char const *__pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("parse", 0);

  /* "lxml/etree.pyx":3715
 *     """
 *     cdef _Document doc
 *     try:             # <<<<<<<<<<<<<<
 *         doc = _parseDocument(source, parser, base_url)
 *         return _elementTreeFactory(doc, None)
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "lxml/etree.pyx":3716
 *     cdef _Document doc
 *     try:
 *         doc = _parseDocument(source, parser, base_url)             # <<<<<<<<<<<<<<
 *         return _elementTreeFactory(doc, None)
 *     except _TargetParserResult as result_container:
*/
      __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__parseDocument(__pyx_v_source, __pyx_v_parser, __pyx_v_base_url)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3716, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_4);
      __pyx_t_4 = 0;

      /* "lxml/etree.pyx":3717
 *     try:
 *         doc = _parseDocument(source, parser, base_url)
 *         return _elementTreeFactory(doc, None)             # <<<<<<<<<<<<<<
 *     except _TargetParserResult as result_container:
 *         return result_container.result
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__elementTreeFactory(__pyx_v_doc, ((struct LxmlElement *)Py_None))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3717, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L7_try_return;

      /* "lxml/etree.pyx":3715
 *     """
 *     cdef _Document doc
 *     try:             # <<<<<<<<<<<<<<
 *         doc = _parseDocument(source, parser, base_url)
 *         return _elementTreeFactory(doc, None)
*/
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "lxml/etree.pyx":3718
 *         doc = _parseDocument(source, parser, base_url)
 *         return _elementTreeFactory(doc, None)
 *     except _TargetParserResult as result_container:             # <<<<<<<<<<<<<<
 *         return result_container.result
 * 
*/
    __Pyx_ErrFetch(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_TargetParserResult); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3718, __pyx_L5_except_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_4, __pyx_t_7);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_ErrRestore(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    __pyx_t_4 = 0; __pyx_t_5 = 0; __pyx_t_6 = 0;
    if (__pyx_t_8) {
      __Pyx_AddTraceback("lxml.etree.parse", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4) < 0) __PYX_ERR(0, 3718, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __pyx_v_result_container = __pyx_t_5;
      /*try:*/ {

        /* "lxml/etree.pyx":3719
 *         return _elementTreeFactory(doc, None)
 *     except _TargetParserResult as result_container:
 *         return result_container.result             # <<<<<<<<<<<<<<
 * 
 * 
*/
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_result_container, __pyx_mstate_global->__pyx_n_u_result); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3719, __pyx_L14_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_r = __pyx_t_7;
        __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        goto __pyx_L13_return;
      }

      /* "lxml/etree.pyx":3718
 *         doc = _parseDocument(source, parser, base_url)
 *         return _elementTreeFactory(doc, None)
 *     except _TargetParserResult as result_container:             # <<<<<<<<<<<<<<
 *         return result_container.result
 * 
*/
      /*finally:*/ {
        __pyx_L14_error:;
        /*exception exit:*/{
          __Pyx_PyThreadState_declare
          __Pyx_PyThreadState_assign
          __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
           __Pyx_ExceptionSwap(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16);
          if ( unlikely(__Pyx_GetException(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13) < 0)) __Pyx_ErrFetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
          __Pyx_XGOTREF(__pyx_t_11);
          __Pyx_XGOTREF(__pyx_t_12);
          __Pyx_XGOTREF(__pyx_t_13);
          __Pyx_XGOTREF(__pyx_t_14);
          __Pyx_XGOTREF(__pyx_t_15);
          __Pyx_XGOTREF(__pyx_t_16);
          __pyx_t_8 = __pyx_lineno; __pyx_t_9 = __pyx_clineno; __pyx_t_10 = __pyx_filename;
          {
            __Pyx_DECREF(__pyx_v_result_container); __pyx_v_result_container = 0;
          }
          __Pyx_XGIVEREF(__pyx_t_14);
          __Pyx_XGIVEREF(__pyx_t_15);
          __Pyx_XGIVEREF(__pyx_t_16);
          __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16);
          __Pyx_XGIVEREF(__pyx_t_11);
          __Pyx_XGIVEREF(__pyx_t_12);
          __Pyx_XGIVEREF(__pyx_t_13);
          __Pyx_ErrRestore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
          __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
          __pyx_lineno = __pyx_t_8; __pyx_clineno = __pyx_t_9; __pyx_filename = __pyx_t_10;
          goto __pyx_L5_except_error;
        }
        __pyx_L13_return: {
          __pyx_t_16 = __pyx_r;
          __pyx_r = 0;
          __Pyx_DECREF(__pyx_v_result_container); __pyx_v_result_container = 0;
          __pyx_r = __pyx_t_16;
          __pyx_t_16 = 0;
          goto __pyx_L6_except_return;
        }
      }
    }
    goto __pyx_L5_except_error;

    /* "lxml/etree.pyx":3715
 *     """
 *     cdef _Document doc
 *     try:             # <<<<<<<<<<<<<<
 *         doc = _parseDocument(source, parser, base_url)
 *         return _elementTreeFactory(doc, None)
*/
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L7_try_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
  }

  /* "lxml/etree.pyx":3690
 * 
 * 
 * def parse(source, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     """parse(source, parser=None, base_url=None)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree.parse", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XDECREF(__pyx_v_result_container);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":3722
 * 
 * 
 * def adopt_external_document(capsule, _BaseParser parser=None):             # <<<<<<<<<<<<<<
 *     """adopt_external_document(capsule, parser=None)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_37adopt_external_document(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_36adopt_external_document, "adopt_external_document(capsule, parser=None)\n\n    Unpack a libxml2 document pointer from a PyCapsule and wrap it in an\n    lxml ElementTree object.\n\n    This allows external libraries to build XML/HTML trees using libxml2\n    and then pass them efficiently into lxml for further processing.\n\n    If a ``parser`` is provided, it will be used for configuring the\n    lxml document.  No parsing will be done.\n\n    The capsule must have the name ``\"libxml2:xmlDoc\"`` and its pointer\n    value must reference a correct libxml2 document of type ``xmlDoc*``.\n    The creator of the capsule must take care to correctly clean up the\n    document using an appropriate capsule destructor.  By default, the\n    libxml2 document will be copied to let lxml safely own the memory\n    of the internal tree that it uses.\n\n    If the capsule context is non-NULL, it must point to a C string that\n    can be compared using ``strcmp()``.  If the context string equals\n    ``\"destructor:xmlFreeDoc\"``, the libxml2 document will not be copied\n    but the capsule invalidated instead by clearing its destructor and\n    name.  That way, lxml takes ownership of the libxml2 document in memory\n    without creating a copy first, and the capsule destructor will not be\n    called.  The document will then eventually be cleaned up by lxml using\n    the libxml2 API function ``xmlFreeDoc()`` once it is no longer used.\n\n    If no copy is made, later modifications of the tree outside of lxml\n    should not be attempted after transferring the ownership.\n    ");
static PyMethodDef __pyx_mdef_4lxml_5etree_37adopt_external_document = {"adopt_external_document", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_37adopt_external_document, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_36adopt_external_document};
static PyObject *__pyx_pw_4lxml_5etree_37adopt_external_document(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_capsule = 0;
  struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("adopt_external_document (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_capsule,&__pyx_mstate_global->__pyx_n_u_parser,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 3722, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 3722, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3722, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "adopt_external_document", 0) < (0)) __PYX_ERR(0, 3722, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef((PyObject *)((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("adopt_external_document", 0, 1, 2, i); __PYX_ERR(0, 3722, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 3722, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3722, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef((PyObject *)((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None));
    }
    __pyx_v_capsule = values[0];
    __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)values[1]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("adopt_external_document", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 3722, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.adopt_external_document", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parser), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__BaseParser, 1, "parser", 0))) __PYX_ERR(0, 3722, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_36adopt_external_document(__pyx_self, __pyx_v_capsule, __pyx_v_parser);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_36adopt_external_document(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_capsule, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser) {
  xmlDoc *__pyx_v_c_doc;
  int __pyx_v_is_owned;
  struct LxmlDocument *__pyx_v_doc = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  void *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  struct __pyx_opt_args_4lxml_5etree__adoptForeignDoc __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("adopt_external_document", 0);

  /* "lxml/etree.pyx":3754
 *     """
 *     cdef xmlDoc* c_doc
 *     cdef bint is_owned = False             # <<<<<<<<<<<<<<
 *     c_doc = <xmlDoc*> python.lxml_unpack_xmldoc_capsule(capsule, &is_owned)
 *     doc = _adoptForeignDoc(c_doc, parser, is_owned)
*/
  __pyx_v_is_owned = 0;

  /* "lxml/etree.pyx":3755
 *     cdef xmlDoc* c_doc
 *     cdef bint is_owned = False
 *     c_doc = <xmlDoc*> python.lxml_unpack_xmldoc_capsule(capsule, &is_owned)             # <<<<<<<<<<<<<<
 *     doc = _adoptForeignDoc(c_doc, parser, is_owned)
 *     return _elementTreeFactory(doc, None)
*/
  __pyx_t_1 = lxml_unpack_xmldoc_capsule(__pyx_v_capsule, (&__pyx_v_is_owned)); if (unlikely(__pyx_t_1 == ((void *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 3755, __pyx_L1_error)
  __pyx_v_c_doc = ((xmlDoc *)__pyx_t_1);

  /* "lxml/etree.pyx":3756
 *     cdef bint is_owned = False
 *     c_doc = <xmlDoc*> python.lxml_unpack_xmldoc_capsule(capsule, &is_owned)
 *     doc = _adoptForeignDoc(c_doc, parser, is_owned)             # <<<<<<<<<<<<<<
 *     return _elementTreeFactory(doc, None)
 * 
*/
  __pyx_t_3.__pyx_n = 2;
  __pyx_t_3.parser = __pyx_v_parser;
  __pyx_t_3.is_owned = __pyx_v_is_owned;
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__adoptForeignDoc(__pyx_v_c_doc, &__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3756, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "lxml/etree.pyx":3757
 *     c_doc = <xmlDoc*> python.lxml_unpack_xmldoc_capsule(capsule, &is_owned)
 *     doc = _adoptForeignDoc(c_doc, parser, is_owned)
 *     return _elementTreeFactory(doc, None)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__elementTreeFactory(__pyx_v_doc, ((struct LxmlElement *)Py_None))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3757, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":3722
 * 
 * 
 * def adopt_external_document(capsule, _BaseParser parser=None):             # <<<<<<<<<<<<<<
 *     """adopt_external_document(capsule, parser=None)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.adopt_external_document", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/readonlytree.pxi":10
 *     cdef _ReadOnlyProxy _source_proxy
 *     cdef list _dependent_proxies
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._c_node = NULL
 *         self._free_after_use = 0
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, __pyx_nargs); return -1; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return -1;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__cinit__", __pyx_kwds); return -1;}
  __pyx_r = __pyx_pf_4lxml_5etree_14_ReadOnlyProxy___cinit__(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_14_ReadOnlyProxy___cinit__(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self) {
  int __pyx_r;

  /* "src/lxml/readonlytree.pxi":11
 *     cdef list _dependent_proxies
 *     def __cinit__(self):
 *         self._c_node = NULL             # <<<<<<<<<<<<<<
 *         self._free_after_use = 0
 * 
*/
  __pyx_v_self->_c_node = NULL;

  /* "src/lxml/readonlytree.pxi":12
 *     def __cinit__(self):
 *         self._c_node = NULL
 *         self._free_after_use = 0             # <<<<<<<<<<<<<<
 * 
 *     cdef int _assertNode(self) except -1:
*/
  __pyx_v_self->_free_after_use = 0;

  /* "src/lxml/readonlytree.pxi":10
 *     cdef _ReadOnlyProxy _source_proxy
 *     cdef list _dependent_proxies
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._c_node = NULL
 *         self._free_after_use = 0
*/

  /* function exit code */
  __pyx_r = 0;
  return __pyx_r;
}

/* "src/lxml/readonlytree.pxi":14
 *         self._free_after_use = 0
 * 
 *     cdef int _assertNode(self) except -1:             # <<<<<<<<<<<<<<
 *         """This is our way of saying: this proxy is invalid!
 *         """
*/

static int __pyx_f_4lxml_5etree_14_ReadOnlyProxy__assertNode(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_assertNode", 0);

  /* "src/lxml/readonlytree.pxi":17
 *         """This is our way of saying: this proxy is invalid!
 *         """
 *         if not self._c_node:             # <<<<<<<<<<<<<<
 *             raise ReferenceError("Proxy invalidated!")
 *         return 0
*/
  __pyx_t_1 = (!(__pyx_v_self->_c_node != 0));
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/readonlytree.pxi":18
 *         """
 *         if not self._c_node:
 *             raise ReferenceError("Proxy invalidated!")             # <<<<<<<<<<<<<<
 *         return 0
 * 
*/
    __pyx_t_3 = NULL;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Proxy_invalidated};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ReferenceError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 18, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(9, 18, __pyx_L1_error)

    /* "src/lxml/readonlytree.pxi":17
 *         """This is our way of saying: this proxy is invalid!
 *         """
 *         if not self._c_node:             # <<<<<<<<<<<<<<
 *             raise ReferenceError("Proxy invalidated!")
 *         return 0
*/
  }

  /* "src/lxml/readonlytree.pxi":19
 *         if not self._c_node:
 *             raise ReferenceError("Proxy invalidated!")
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     cdef int _raise_unsupported_type(self) except -1:
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/readonlytree.pxi":14
 *         self._free_after_use = 0
 * 
 *     cdef int _assertNode(self) except -1:             # <<<<<<<<<<<<<<
 *         """This is our way of saying: this proxy is invalid!
 *         """
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy._assertNode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/readonlytree.pxi":21
 *         return 0
 * 
 *     cdef int _raise_unsupported_type(self) except -1:             # <<<<<<<<<<<<<<
 *         raise TypeError(f"Unsupported node type: {self._c_node.type}")
 * 
*/

static int __pyx_f_4lxml_5etree_14_ReadOnlyProxy__raise_unsupported_type(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_raise_unsupported_type", 0);

  /* "src/lxml/readonlytree.pxi":22
 * 
 *     cdef int _raise_unsupported_type(self) except -1:
 *         raise TypeError(f"Unsupported node type: {self._c_node.type}")             # <<<<<<<<<<<<<<
 * 
 *     cdef void free_after_use(self) noexcept:
*/
  __pyx_t_2 = NULL;
  __pyx_t_3 = __Pyx_PyUnicode_From_xmlElementType(__pyx_v_self->_c_node->type, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(9, 22, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_Unsupported_node_type, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(9, 22, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 22, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(9, 22, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":21
 *         return 0
 * 
 *     cdef int _raise_unsupported_type(self) except -1:             # <<<<<<<<<<<<<<
 *         raise TypeError(f"Unsupported node type: {self._c_node.type}")
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy._raise_unsupported_type", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/readonlytree.pxi":24
 *         raise TypeError(f"Unsupported node type: {self._c_node.type}")
 * 
 *     cdef void free_after_use(self) noexcept:             # <<<<<<<<<<<<<<
 *         """Should the xmlNode* be freed when releasing the proxy?
 *         """
*/

static void __pyx_f_4lxml_5etree_14_ReadOnlyProxy_free_after_use(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self) {

  /* "src/lxml/readonlytree.pxi":27
 *         """Should the xmlNode* be freed when releasing the proxy?
 *         """
 *         self._free_after_use = 1             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __pyx_v_self->_free_after_use = 1;

  /* "src/lxml/readonlytree.pxi":24
 *         raise TypeError(f"Unsupported node type: {self._c_node.type}")
 * 
 *     cdef void free_after_use(self) noexcept:             # <<<<<<<<<<<<<<
 *         """Should the xmlNode* be freed when releasing the proxy?
 *         """
*/

  /* function exit code */
}

/* "src/lxml/readonlytree.pxi":29
 *         self._free_after_use = 1
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def tag(self):
 *         """Element tag
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_3tag_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_3tag_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_14_ReadOnlyProxy_3tag___get__(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_3tag___get__(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "src/lxml/readonlytree.pxi":33
 *         """Element tag
 *         """
 *         self._assertNode()             # <<<<<<<<<<<<<<
 *         if self._c_node.type == tree.XML_ELEMENT_NODE:
 *             return _namespacedName(self._c_node)
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self->__pyx_vtab)->_assertNode(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(9, 33, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":34
 *         """
 *         self._assertNode()
 *         if self._c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *             return _namespacedName(self._c_node)
 *         elif self._c_node.type == tree.XML_PI_NODE:
*/
  switch (__pyx_v_self->_c_node->type) {
    case XML_ELEMENT_NODE:

    /* "src/lxml/readonlytree.pxi":35
 *         self._assertNode()
 *         if self._c_node.type == tree.XML_ELEMENT_NODE:
 *             return _namespacedName(self._c_node)             # <<<<<<<<<<<<<<
 *         elif self._c_node.type == tree.XML_PI_NODE:
 *             return ProcessingInstruction
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __pyx_f_4lxml_5etree__namespacedName(__pyx_v_self->_c_node); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 35, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "src/lxml/readonlytree.pxi":34
 *         """
 *         self._assertNode()
 *         if self._c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *             return _namespacedName(self._c_node)
 *         elif self._c_node.type == tree.XML_PI_NODE:
*/
    break;
    case XML_PI_NODE:

    /* "src/lxml/readonlytree.pxi":37
 *             return _namespacedName(self._c_node)
 *         elif self._c_node.type == tree.XML_PI_NODE:
 *             return ProcessingInstruction             # <<<<<<<<<<<<<<
 *         elif self._c_node.type == tree.XML_COMMENT_NODE:
 *             return Comment
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_ProcessingInstruction); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 37, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "src/lxml/readonlytree.pxi":36
 *         if self._c_node.type == tree.XML_ELEMENT_NODE:
 *             return _namespacedName(self._c_node)
 *         elif self._c_node.type == tree.XML_PI_NODE:             # <<<<<<<<<<<<<<
 *             return ProcessingInstruction
 *         elif self._c_node.type == tree.XML_COMMENT_NODE:
*/
    break;
    case XML_COMMENT_NODE:

    /* "src/lxml/readonlytree.pxi":39
 *             return ProcessingInstruction
 *         elif self._c_node.type == tree.XML_COMMENT_NODE:
 *             return Comment             # <<<<<<<<<<<<<<
 *         elif self._c_node.type == tree.XML_ENTITY_REF_NODE:
 *             return Entity
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_Comment); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 39, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "src/lxml/readonlytree.pxi":38
 *         elif self._c_node.type == tree.XML_PI_NODE:
 *             return ProcessingInstruction
 *         elif self._c_node.type == tree.XML_COMMENT_NODE:             # <<<<<<<<<<<<<<
 *             return Comment
 *         elif self._c_node.type == tree.XML_ENTITY_REF_NODE:
*/
    break;
    case XML_ENTITY_REF_NODE:

    /* "src/lxml/readonlytree.pxi":41
 *             return Comment
 *         elif self._c_node.type == tree.XML_ENTITY_REF_NODE:
 *             return Entity             # <<<<<<<<<<<<<<
 *         else:
 *             self._raise_unsupported_type()
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_Entity); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 41, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "src/lxml/readonlytree.pxi":40
 *         elif self._c_node.type == tree.XML_COMMENT_NODE:
 *             return Comment
 *         elif self._c_node.type == tree.XML_ENTITY_REF_NODE:             # <<<<<<<<<<<<<<
 *             return Entity
 *         else:
*/
    break;
    default:

    /* "src/lxml/readonlytree.pxi":43
 *             return Entity
 *         else:
 *             self._raise_unsupported_type()             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
    __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self->__pyx_vtab)->_raise_unsupported_type(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(9, 43, __pyx_L1_error)
    break;
  }

  /* "src/lxml/readonlytree.pxi":29
 *         self._free_after_use = 1
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def tag(self):
 *         """Element tag
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy.tag.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/readonlytree.pxi":45
 *             self._raise_unsupported_type()
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def text(self):
 *         """Text before the first subelement. This is either a string or
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_4text_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_4text_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_14_ReadOnlyProxy_4text___get__(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_4text___get__(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5[3];
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "src/lxml/readonlytree.pxi":50
 *         the value None, if there was no text.
 *         """
 *         self._assertNode()             # <<<<<<<<<<<<<<
 *         if self._c_node.type == tree.XML_ELEMENT_NODE:
 *             return _collectText(self._c_node.children)
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self->__pyx_vtab)->_assertNode(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(9, 50, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":51
 *         """
 *         self._assertNode()
 *         if self._c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *             return _collectText(self._c_node.children)
 *         elif self._c_node.type in (tree.XML_PI_NODE,
*/
  switch (__pyx_v_self->_c_node->type) {
    case XML_ELEMENT_NODE:

    /* "src/lxml/readonlytree.pxi":52
 *         self._assertNode()
 *         if self._c_node.type == tree.XML_ELEMENT_NODE:
 *             return _collectText(self._c_node.children)             # <<<<<<<<<<<<<<
 *         elif self._c_node.type in (tree.XML_PI_NODE,
 *                                    tree.XML_COMMENT_NODE):
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __pyx_f_4lxml_5etree__collectText(__pyx_v_self->_c_node->children); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 52, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "src/lxml/readonlytree.pxi":51
 *         """
 *         self._assertNode()
 *         if self._c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *             return _collectText(self._c_node.children)
 *         elif self._c_node.type in (tree.XML_PI_NODE,
*/
    break;
    case XML_PI_NODE:

    /* "src/lxml/readonlytree.pxi":53
 *         if self._c_node.type == tree.XML_ELEMENT_NODE:
 *             return _collectText(self._c_node.children)
 *         elif self._c_node.type in (tree.XML_PI_NODE,             # <<<<<<<<<<<<<<
 *                                    tree.XML_COMMENT_NODE):
 *             if self._c_node.content is NULL:
*/
    case XML_COMMENT_NODE:

    /* "src/lxml/readonlytree.pxi":55
 *         elif self._c_node.type in (tree.XML_PI_NODE,
 *                                    tree.XML_COMMENT_NODE):
 *             if self._c_node.content is NULL:             # <<<<<<<<<<<<<<
 *                 return ''
 *             else:
*/
    __pyx_t_3 = (__pyx_v_self->_c_node->content == NULL);
    if (__pyx_t_3) {

      /* "src/lxml/readonlytree.pxi":56
 *                                    tree.XML_COMMENT_NODE):
 *             if self._c_node.content is NULL:
 *                 return ''             # <<<<<<<<<<<<<<
 *             else:
 *                 return funicode(self._c_node.content)
*/
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u__8);
      __pyx_r = __pyx_mstate_global->__pyx_kp_u__8;
      goto __pyx_L0;

      /* "src/lxml/readonlytree.pxi":55
 *         elif self._c_node.type in (tree.XML_PI_NODE,
 *                                    tree.XML_COMMENT_NODE):
 *             if self._c_node.content is NULL:             # <<<<<<<<<<<<<<
 *                 return ''
 *             else:
*/
    }

    /* "src/lxml/readonlytree.pxi":58
 *                 return ''
 *             else:
 *                 return funicode(self._c_node.content)             # <<<<<<<<<<<<<<
 *         elif self._c_node.type == tree.XML_ENTITY_REF_NODE:
 *             return f'&{funicode(self._c_node.name)};'
*/
    /*else*/ {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_self->_c_node->content); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 58, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;
    }

    /* "src/lxml/readonlytree.pxi":53
 *         if self._c_node.type == tree.XML_ELEMENT_NODE:
 *             return _collectText(self._c_node.children)
 *         elif self._c_node.type in (tree.XML_PI_NODE,             # <<<<<<<<<<<<<<
 *                                    tree.XML_COMMENT_NODE):
 *             if self._c_node.content is NULL:
*/
    break;
    case XML_ENTITY_REF_NODE:

    /* "src/lxml/readonlytree.pxi":60
 *                 return funicode(self._c_node.content)
 *         elif self._c_node.type == tree.XML_ENTITY_REF_NODE:
 *             return f'&{funicode(self._c_node.name)};'             # <<<<<<<<<<<<<<
 *         else:
 *             self._raise_unsupported_type()
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_self->_c_node->name); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 60, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyUnicode_Unicode(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(9, 60, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_5[0] = __pyx_mstate_global->__pyx_kp_u__19;
    __pyx_t_5[1] = __pyx_t_4;
    __pyx_t_5[2] = __pyx_mstate_global->__pyx_kp_u__20;
    __pyx_t_2 = __Pyx_PyUnicode_Join(__pyx_t_5, 3, 1 * 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4));
    if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 60, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "src/lxml/readonlytree.pxi":59
 *             else:
 *                 return funicode(self._c_node.content)
 *         elif self._c_node.type == tree.XML_ENTITY_REF_NODE:             # <<<<<<<<<<<<<<
 *             return f'&{funicode(self._c_node.name)};'
 *         else:
*/
    break;
    default:

    /* "src/lxml/readonlytree.pxi":62
 *             return f'&{funicode(self._c_node.name)};'
 *         else:
 *             self._raise_unsupported_type()             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
    __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self->__pyx_vtab)->_raise_unsupported_type(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(9, 62, __pyx_L1_error)
    break;
  }

  /* "src/lxml/readonlytree.pxi":45
 *             self._raise_unsupported_type()
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def text(self):
 *         """Text before the first subelement. This is either a string or
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy.text.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/readonlytree.pxi":64
 *             self._raise_unsupported_type()
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def tail(self):
 *         """Text after this element's end tag, but before the next sibling
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_4tail_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_4tail_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_14_ReadOnlyProxy_4tail___get__(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_4tail___get__(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "src/lxml/readonlytree.pxi":70
 *         there was no text.
 *         """
 *         self._assertNode()             # <<<<<<<<<<<<<<
 *         return _collectText(self._c_node.next)
 * 
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self->__pyx_vtab)->_assertNode(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(9, 70, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":71
 *         """
 *         self._assertNode()
 *         return _collectText(self._c_node.next)             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree__collectText(__pyx_v_self->_c_node->next); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 71, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/readonlytree.pxi":64
 *             self._raise_unsupported_type()
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def tail(self):
 *         """Text after this element's end tag, but before the next sibling
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy.tail.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/readonlytree.pxi":73
 *         return _collectText(self._c_node.next)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def sourceline(self):
 *         """Original line number as found by the parser or None if unknown.
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_10sourceline_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_10sourceline_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_14_ReadOnlyProxy_10sourceline___get__(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_10sourceline___get__(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self) {
  long __pyx_v_line;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "src/lxml/readonlytree.pxi":78
 *         """
 *         cdef long line
 *         self._assertNode()             # <<<<<<<<<<<<<<
 *         line = tree.xmlGetLineNo(self._c_node)
 *         if line > 0:
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self->__pyx_vtab)->_assertNode(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(9, 78, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":79
 *         cdef long line
 *         self._assertNode()
 *         line = tree.xmlGetLineNo(self._c_node)             # <<<<<<<<<<<<<<
 *         if line > 0:
 *             return line
*/
  __pyx_v_line = xmlGetLineNo(__pyx_v_self->_c_node);

  /* "src/lxml/readonlytree.pxi":80
 *         self._assertNode()
 *         line = tree.xmlGetLineNo(self._c_node)
 *         if line > 0:             # <<<<<<<<<<<<<<
 *             return line
 *         else:
*/
  __pyx_t_2 = (__pyx_v_line > 0);
  if (__pyx_t_2) {

    /* "src/lxml/readonlytree.pxi":81
 *         line = tree.xmlGetLineNo(self._c_node)
 *         if line > 0:
 *             return line             # <<<<<<<<<<<<<<
 *         else:
 *             return None
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_PyLong_From_long(__pyx_v_line); if (unlikely(!__pyx_t_3)) __PYX_ERR(9, 81, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "src/lxml/readonlytree.pxi":80
 *         self._assertNode()
 *         line = tree.xmlGetLineNo(self._c_node)
 *         if line > 0:             # <<<<<<<<<<<<<<
 *             return line
 *         else:
*/
  }

  /* "src/lxml/readonlytree.pxi":83
 *             return line
 *         else:
 *             return None             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "src/lxml/readonlytree.pxi":73
 *         return _collectText(self._c_node.next)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def sourceline(self):
 *         """Original line number as found by the parser or None if unknown.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy.sourceline.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/readonlytree.pxi":85
 *             return None
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         self._assertNode()
 *         if self._c_node.type == tree.XML_ELEMENT_NODE:
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_3__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_3__repr__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_14_ReadOnlyProxy_2__repr__(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_2__repr__(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self) {
  PyObject *__pyx_v_text = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5[5];
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "src/lxml/readonlytree.pxi":86
 * 
 *     def __repr__(self):
 *         self._assertNode()             # <<<<<<<<<<<<<<
 *         if self._c_node.type == tree.XML_ELEMENT_NODE:
 *             return "<Element %s at 0x%x>" % (self.tag, id(self))
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self->__pyx_vtab)->_assertNode(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(9, 86, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":87
 *     def __repr__(self):
 *         self._assertNode()
 *         if self._c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *             return "<Element %s at 0x%x>" % (self.tag, id(self))
 *         elif self._c_node.type == tree.XML_COMMENT_NODE:
*/
  switch (__pyx_v_self->_c_node->type) {
    case XML_ELEMENT_NODE:

    /* "src/lxml/readonlytree.pxi":88
 *         self._assertNode()
 *         if self._c_node.type == tree.XML_ELEMENT_NODE:
 *             return "<Element %s at 0x%x>" % (self.tag, id(self))             # <<<<<<<<<<<<<<
 *         elif self._c_node.type == tree.XML_COMMENT_NODE:
 *             return "<!--%s-->" % self.text
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_tag); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 88, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_t_2), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(9, 88, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 88, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_Format(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_x); if (unlikely(!__pyx_t_4)) __PYX_ERR(9, 88, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_5[0] = __pyx_mstate_global->__pyx_kp_u_Element;
    __pyx_t_5[1] = __pyx_t_3;
    __pyx_t_5[2] = __pyx_mstate_global->__pyx_kp_u_at_0x;
    __pyx_t_5[3] = __pyx_t_4;
    __pyx_t_5[4] = __pyx_mstate_global->__pyx_kp_u__3;
    __pyx_t_2 = __Pyx_PyUnicode_Join(__pyx_t_5, 5, 9 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 6 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4));
    if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 88, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "src/lxml/readonlytree.pxi":87
 *     def __repr__(self):
 *         self._assertNode()
 *         if self._c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *             return "<Element %s at 0x%x>" % (self.tag, id(self))
 *         elif self._c_node.type == tree.XML_COMMENT_NODE:
*/
    break;
    case XML_COMMENT_NODE:

    /* "src/lxml/readonlytree.pxi":90
 *             return "<Element %s at 0x%x>" % (self.tag, id(self))
 *         elif self._c_node.type == tree.XML_COMMENT_NODE:
 *             return "<!--%s-->" % self.text             # <<<<<<<<<<<<<<
 *         elif self._c_node.type == tree.XML_ENTITY_NODE:
 *             return "&%s;" % funicode(self._c_node.name)
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_text); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 90, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyUnicode_FormatSafe(__pyx_mstate_global->__pyx_kp_u_s, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(9, 90, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;

    /* "src/lxml/readonlytree.pxi":89
 *         if self._c_node.type == tree.XML_ELEMENT_NODE:
 *             return "<Element %s at 0x%x>" % (self.tag, id(self))
 *         elif self._c_node.type == tree.XML_COMMENT_NODE:             # <<<<<<<<<<<<<<
 *             return "<!--%s-->" % self.text
 *         elif self._c_node.type == tree.XML_ENTITY_NODE:
*/
    break;
    case XML_ENTITY_NODE:

    /* "src/lxml/readonlytree.pxi":92
 *             return "<!--%s-->" % self.text
 *         elif self._c_node.type == tree.XML_ENTITY_NODE:
 *             return "&%s;" % funicode(self._c_node.name)             # <<<<<<<<<<<<<<
 *         elif self._c_node.type == tree.XML_PI_NODE:
 *             text = self.text
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __pyx_f_4lxml_5etree_funicode(__pyx_v_self->_c_node->name); if (unlikely(!__pyx_t_4)) __PYX_ERR(9, 92, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = PyUnicode_Format(__pyx_mstate_global->__pyx_kp_u_s_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 92, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "src/lxml/readonlytree.pxi":91
 *         elif self._c_node.type == tree.XML_COMMENT_NODE:
 *             return "<!--%s-->" % self.text
 *         elif self._c_node.type == tree.XML_ENTITY_NODE:             # <<<<<<<<<<<<<<
 *             return "&%s;" % funicode(self._c_node.name)
 *         elif self._c_node.type == tree.XML_PI_NODE:
*/
    break;
    case XML_PI_NODE:

    /* "src/lxml/readonlytree.pxi":94
 *             return "&%s;" % funicode(self._c_node.name)
 *         elif self._c_node.type == tree.XML_PI_NODE:
 *             text = self.text             # <<<<<<<<<<<<<<
 *             if text:
 *                 return "<?%s %s?>" % (self.target, text)
*/
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_text); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 94, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_text = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "src/lxml/readonlytree.pxi":95
 *         elif self._c_node.type == tree.XML_PI_NODE:
 *             text = self.text
 *             if text:             # <<<<<<<<<<<<<<
 *                 return "<?%s %s?>" % (self.target, text)
 *             else:
*/
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_text); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(9, 95, __pyx_L1_error)
    if (__pyx_t_6) {

      /* "src/lxml/readonlytree.pxi":96
 *             text = self.text
 *             if text:
 *                 return "<?%s %s?>" % (self.target, text)             # <<<<<<<<<<<<<<
 *             else:
 *                 return "<?%s?>" % self.target
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_target); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 96, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_t_2), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(9, 96, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_v_text), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 96, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5[0] = __pyx_mstate_global->__pyx_kp_u__17;
      __pyx_t_5[1] = __pyx_t_4;
      __pyx_t_5[2] = __pyx_mstate_global->__pyx_kp_u__7;
      __pyx_t_5[3] = __pyx_t_2;
      __pyx_t_5[4] = __pyx_mstate_global->__pyx_kp_u__18;
      __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_5, 5, 2 * 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4) + 1 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2));
      if (unlikely(!__pyx_t_3)) __PYX_ERR(9, 96, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L0;

      /* "src/lxml/readonlytree.pxi":95
 *         elif self._c_node.type == tree.XML_PI_NODE:
 *             text = self.text
 *             if text:             # <<<<<<<<<<<<<<
 *                 return "<?%s %s?>" % (self.target, text)
 *             else:
*/
    }

    /* "src/lxml/readonlytree.pxi":98
 *                 return "<?%s %s?>" % (self.target, text)
 *             else:
 *                 return "<?%s?>" % self.target             # <<<<<<<<<<<<<<
 *         else:
 *             self._raise_unsupported_type()
*/
    /*else*/ {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_target); if (unlikely(!__pyx_t_3)) __PYX_ERR(9, 98, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = __Pyx_PyUnicode_FormatSafe(__pyx_mstate_global->__pyx_kp_u_s_2, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 98, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;
    }

    /* "src/lxml/readonlytree.pxi":93
 *         elif self._c_node.type == tree.XML_ENTITY_NODE:
 *             return "&%s;" % funicode(self._c_node.name)
 *         elif self._c_node.type == tree.XML_PI_NODE:             # <<<<<<<<<<<<<<
 *             text = self.text
 *             if text:
*/
    break;
    default:

    /* "src/lxml/readonlytree.pxi":100
 *                 return "<?%s?>" % self.target
 *         else:
 *             self._raise_unsupported_type()             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, x):
*/
    __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self->__pyx_vtab)->_raise_unsupported_type(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(9, 100, __pyx_L1_error)
    break;
  }

  /* "src/lxml/readonlytree.pxi":85
 *             return None
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         self._assertNode()
 *         if self._c_node.type == tree.XML_ELEMENT_NODE:
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_text);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/readonlytree.pxi":102
 *             self._raise_unsupported_type()
 * 
 *     def __getitem__(self, x):             # <<<<<<<<<<<<<<
 *         """Returns the subelement at the given position or the requested
 *         slice.
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_14_ReadOnlyProxy_4__getitem__, "Returns the subelement at the given position or the requested\n        slice.\n        ");
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_14_ReadOnlyProxy_4__getitem__;
#endif
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_14_ReadOnlyProxy_4__getitem__(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_4__getitem__(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self, PyObject *__pyx_v_x) {
  xmlNode *__pyx_v_c_node;
  Py_ssize_t __pyx_v_step;
  Py_ssize_t __pyx_v_slicelength;
  Py_ssize_t __pyx_v_c;
  CYTHON_UNUSED Py_ssize_t __pyx_v_i;
  _node_to_node_function __pyx_v_next_element;
  PyObject *__pyx_v_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  xmlNode *__pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "src/lxml/readonlytree.pxi":106
 *         slice.
 *         """
 *         cdef xmlNode* c_node = NULL             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t step = 0, slicelength = 0
 *         cdef Py_ssize_t c, i
*/
  __pyx_v_c_node = NULL;

  /* "src/lxml/readonlytree.pxi":107
 *         """
 *         cdef xmlNode* c_node = NULL
 *         cdef Py_ssize_t step = 0, slicelength = 0             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t c, i
 *         cdef _node_to_node_function next_element
*/
  __pyx_v_step = 0;
  __pyx_v_slicelength = 0;

  /* "src/lxml/readonlytree.pxi":111
 *         cdef _node_to_node_function next_element
 *         cdef list result
 *         self._assertNode()             # <<<<<<<<<<<<<<
 *         if isinstance(x, slice):
 *             # slicing
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self->__pyx_vtab)->_assertNode(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(9, 111, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":112
 *         cdef list result
 *         self._assertNode()
 *         if isinstance(x, slice):             # <<<<<<<<<<<<<<
 *             # slicing
 *             if _isFullSlice(<slice>x):
*/
  __pyx_t_2 = PySlice_Check(__pyx_v_x); 
  if (__pyx_t_2) {

    /* "src/lxml/readonlytree.pxi":114
 *         if isinstance(x, slice):
 *             # slicing
 *             if _isFullSlice(<slice>x):             # <<<<<<<<<<<<<<
 *                 return _collectChildren(self)
 *             _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)
*/
    __pyx_t_2 = __pyx_f_4lxml_5etree__isFullSlice(((PyObject*)__pyx_v_x)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(9, 114, __pyx_L1_error)
    if (__pyx_t_2) {

      /* "src/lxml/readonlytree.pxi":115
 *             # slicing
 *             if _isFullSlice(<slice>x):
 *                 return _collectChildren(self)             # <<<<<<<<<<<<<<
 *             _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)
 *             if c_node is NULL:
*/
      __Pyx_XDECREF(__pyx_r);
      if (!(likely(((((PyObject *)__pyx_v_self)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element))))) __PYX_ERR(9, 115, __pyx_L1_error)
      __pyx_t_3 = __pyx_f_4lxml_5etree__collectChildren(((struct LxmlElement *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) __PYX_ERR(9, 115, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L0;

      /* "src/lxml/readonlytree.pxi":114
 *         if isinstance(x, slice):
 *             # slicing
 *             if _isFullSlice(<slice>x):             # <<<<<<<<<<<<<<
 *                 return _collectChildren(self)
 *             _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)
*/
    }

    /* "src/lxml/readonlytree.pxi":116
 *             if _isFullSlice(<slice>x):
 *                 return _collectChildren(self)
 *             _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)             # <<<<<<<<<<<<<<
 *             if c_node is NULL:
 *                 return []
*/
    __pyx_t_1 = __pyx_f_4lxml_5etree__findChildSlice(((PyObject*)__pyx_v_x), __pyx_v_self->_c_node, (&__pyx_v_c_node), (&__pyx_v_step), (&__pyx_v_slicelength)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(9, 116, __pyx_L1_error)

    /* "src/lxml/readonlytree.pxi":117
 *                 return _collectChildren(self)
 *             _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)
 *             if c_node is NULL:             # <<<<<<<<<<<<<<
 *                 return []
 *             if step > 0:
*/
    __pyx_t_2 = (__pyx_v_c_node == NULL);
    if (__pyx_t_2) {

      /* "src/lxml/readonlytree.pxi":118
 *             _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)
 *             if c_node is NULL:
 *                 return []             # <<<<<<<<<<<<<<
 *             if step > 0:
 *                 next_element = _nextElement
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(9, 118, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L0;

      /* "src/lxml/readonlytree.pxi":117
 *                 return _collectChildren(self)
 *             _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)
 *             if c_node is NULL:             # <<<<<<<<<<<<<<
 *                 return []
 *             if step > 0:
*/
    }

    /* "src/lxml/readonlytree.pxi":119
 *             if c_node is NULL:
 *                 return []
 *             if step > 0:             # <<<<<<<<<<<<<<
 *                 next_element = _nextElement
 *             else:
*/
    __pyx_t_2 = (__pyx_v_step > 0);
    if (__pyx_t_2) {

      /* "src/lxml/readonlytree.pxi":120
 *                 return []
 *             if step > 0:
 *                 next_element = _nextElement             # <<<<<<<<<<<<<<
 *             else:
 *                 step = -step if step != python.PY_SSIZE_T_MIN else python.PY_SSIZE_T_MAX
*/
      __pyx_v_next_element = __pyx_f_4lxml_5etree__nextElement;

      /* "src/lxml/readonlytree.pxi":119
 *             if c_node is NULL:
 *                 return []
 *             if step > 0:             # <<<<<<<<<<<<<<
 *                 next_element = _nextElement
 *             else:
*/
      goto __pyx_L6;
    }

    /* "src/lxml/readonlytree.pxi":122
 *                 next_element = _nextElement
 *             else:
 *                 step = -step if step != python.PY_SSIZE_T_MIN else python.PY_SSIZE_T_MAX             # <<<<<<<<<<<<<<
 *                 next_element = _previousElement
 *             result = []
*/
    /*else*/ {
      __pyx_t_2 = (__pyx_v_step != PY_SSIZE_T_MIN);
      if (__pyx_t_2) {
        __pyx_t_4 = (-__pyx_v_step);
      } else {
        __pyx_t_4 = PY_SSIZE_T_MAX;
      }
      __pyx_v_step = __pyx_t_4;

      /* "src/lxml/readonlytree.pxi":123
 *             else:
 *                 step = -step if step != python.PY_SSIZE_T_MIN else python.PY_SSIZE_T_MAX
 *                 next_element = _previousElement             # <<<<<<<<<<<<<<
 *             result = []
 *             c = 0
*/
      __pyx_v_next_element = __pyx_f_4lxml_5etree__previousElement;
    }
    __pyx_L6:;

    /* "src/lxml/readonlytree.pxi":124
 *                 step = -step if step != python.PY_SSIZE_T_MIN else python.PY_SSIZE_T_MAX
 *                 next_element = _previousElement
 *             result = []             # <<<<<<<<<<<<<<
 *             c = 0
 *             while c_node is not NULL and c < slicelength:
*/
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(9, 124, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_result = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/readonlytree.pxi":125
 *                 next_element = _previousElement
 *             result = []
 *             c = 0             # <<<<<<<<<<<<<<
 *             while c_node is not NULL and c < slicelength:
 *                 result.append(_newReadOnlyProxy(self._source_proxy, c_node))
*/
    __pyx_v_c = 0;

    /* "src/lxml/readonlytree.pxi":126
 *             result = []
 *             c = 0
 *             while c_node is not NULL and c < slicelength:             # <<<<<<<<<<<<<<
 *                 result.append(_newReadOnlyProxy(self._source_proxy, c_node))
 *                 result.append(_elementFactory(self._doc, c_node))
*/
    while (1) {
      __pyx_t_5 = (__pyx_v_c_node != NULL);
      if (__pyx_t_5) {
      } else {
        __pyx_t_2 = __pyx_t_5;
        goto __pyx_L9_bool_binop_done;
      }
      __pyx_t_5 = (__pyx_v_c < __pyx_v_slicelength);
      __pyx_t_2 = __pyx_t_5;
      __pyx_L9_bool_binop_done:;
      if (!__pyx_t_2) break;

      /* "src/lxml/readonlytree.pxi":127
 *             c = 0
 *             while c_node is not NULL and c < slicelength:
 *                 result.append(_newReadOnlyProxy(self._source_proxy, c_node))             # <<<<<<<<<<<<<<
 *                 result.append(_elementFactory(self._doc, c_node))
 *                 c = c + 1
*/
      __pyx_t_3 = ((PyObject *)__pyx_v_self->_source_proxy);
      __Pyx_INCREF(__pyx_t_3);
      __pyx_t_6 = ((PyObject *)__pyx_f_4lxml_5etree__newReadOnlyProxy(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_3), __pyx_v_c_node)); if (unlikely(!__pyx_t_6)) __PYX_ERR(9, 127, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_6); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(9, 127, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "src/lxml/readonlytree.pxi":128
 *             while c_node is not NULL and c < slicelength:
 *                 result.append(_newReadOnlyProxy(self._source_proxy, c_node))
 *                 result.append(_elementFactory(self._doc, c_node))             # <<<<<<<<<<<<<<
 *                 c = c + 1
 *                 for i from 0 <= i < step:
*/
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_doc); if (unlikely(!__pyx_t_6)) __PYX_ERR(9, 128, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Document))))) __PYX_ERR(9, 128, __pyx_L1_error)
      __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_6), __pyx_v_c_node)); if (unlikely(!__pyx_t_3)) __PYX_ERR(9, 128, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_3); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(9, 128, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "src/lxml/readonlytree.pxi":129
 *                 result.append(_newReadOnlyProxy(self._source_proxy, c_node))
 *                 result.append(_elementFactory(self._doc, c_node))
 *                 c = c + 1             # <<<<<<<<<<<<<<
 *                 for i from 0 <= i < step:
 *                     c_node = next_element(c_node)
*/
      __pyx_v_c = (__pyx_v_c + 1);

      /* "src/lxml/readonlytree.pxi":130
 *                 result.append(_elementFactory(self._doc, c_node))
 *                 c = c + 1
 *                 for i from 0 <= i < step:             # <<<<<<<<<<<<<<
 *                     c_node = next_element(c_node)
 *             return result
*/
      __pyx_t_4 = __pyx_v_step;
      for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_4; __pyx_v_i++) {

        /* "src/lxml/readonlytree.pxi":131
 *                 c = c + 1
 *                 for i from 0 <= i < step:
 *                     c_node = next_element(c_node)             # <<<<<<<<<<<<<<
 *             return result
 *         else:
*/
        __pyx_t_8 = __pyx_v_next_element(__pyx_v_c_node); if (unlikely(PyErr_Occurred())) __PYX_ERR(9, 131, __pyx_L1_error)
        __pyx_v_c_node = __pyx_t_8;
      }
    }

    /* "src/lxml/readonlytree.pxi":132
 *                 for i from 0 <= i < step:
 *                     c_node = next_element(c_node)
 *             return result             # <<<<<<<<<<<<<<
 *         else:
 *             # indexing
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_result);
    __pyx_r = __pyx_v_result;
    goto __pyx_L0;

    /* "src/lxml/readonlytree.pxi":112
 *         cdef list result
 *         self._assertNode()
 *         if isinstance(x, slice):             # <<<<<<<<<<<<<<
 *             # slicing
 *             if _isFullSlice(<slice>x):
*/
  }

  /* "src/lxml/readonlytree.pxi":135
 *         else:
 *             # indexing
 *             c_node = _findChild(self._c_node, x)             # <<<<<<<<<<<<<<
 *             if c_node is NULL:
 *                 raise IndexError, "list index out of range"
*/
  /*else*/ {
    __pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_v_x); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(9, 135, __pyx_L1_error)
    __pyx_v_c_node = __pyx_f_4lxml_5etree__findChild(__pyx_v_self->_c_node, __pyx_t_4);

    /* "src/lxml/readonlytree.pxi":136
 *             # indexing
 *             c_node = _findChild(self._c_node, x)
 *             if c_node is NULL:             # <<<<<<<<<<<<<<
 *                 raise IndexError, "list index out of range"
 *             return _newReadOnlyProxy(self._source_proxy, c_node)
*/
    __pyx_t_2 = (__pyx_v_c_node == NULL);
    if (unlikely(__pyx_t_2)) {

      /* "src/lxml/readonlytree.pxi":137
 *             c_node = _findChild(self._c_node, x)
 *             if c_node is NULL:
 *                 raise IndexError, "list index out of range"             # <<<<<<<<<<<<<<
 *             return _newReadOnlyProxy(self._source_proxy, c_node)
 * 
*/
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_IndexError))), __pyx_mstate_global->__pyx_kp_u_list_index_out_of_range, 0, 0);
      __PYX_ERR(9, 137, __pyx_L1_error)

      /* "src/lxml/readonlytree.pxi":136
 *             # indexing
 *             c_node = _findChild(self._c_node, x)
 *             if c_node is NULL:             # <<<<<<<<<<<<<<
 *                 raise IndexError, "list index out of range"
 *             return _newReadOnlyProxy(self._source_proxy, c_node)
*/
    }

    /* "src/lxml/readonlytree.pxi":138
 *             if c_node is NULL:
 *                 raise IndexError, "list index out of range"
 *             return _newReadOnlyProxy(self._source_proxy, c_node)             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = ((PyObject *)__pyx_v_self->_source_proxy);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_6 = ((PyObject *)__pyx_f_4lxml_5etree__newReadOnlyProxy(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_3), __pyx_v_c_node)); if (unlikely(!__pyx_t_6)) __PYX_ERR(9, 138, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    goto __pyx_L0;
  }

  /* "src/lxml/readonlytree.pxi":102
 *             self._raise_unsupported_type()
 * 
 *     def __getitem__(self, x):             # <<<<<<<<<<<<<<
 *         """Returns the subelement at the given position or the requested
 *         slice.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/readonlytree.pxi":140
 *             return _newReadOnlyProxy(self._source_proxy, c_node)
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         """Returns the number of subelements.
 *         """
*/

/* Python wrapper */
static Py_ssize_t __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_7__len__(PyObject *__pyx_v_self); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_14_ReadOnlyProxy_6__len__, "Returns the number of subelements.\n        ");
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_14_ReadOnlyProxy_6__len__;
#endif
static Py_ssize_t __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_7__len__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_14_ReadOnlyProxy_6__len__(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_ssize_t __pyx_pf_4lxml_5etree_14_ReadOnlyProxy_6__len__(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self) {
  Py_ssize_t __pyx_v_c;
  xmlNode *__pyx_v_c_node;
  Py_ssize_t __pyx_r;
  int __pyx_t_1;
  xmlNode *__pyx_t_2;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/readonlytree.pxi":145
 *         cdef Py_ssize_t c
 *         cdef xmlNode* c_node
 *         self._assertNode()             # <<<<<<<<<<<<<<
 *         c = 0
 *         c_node = self._c_node.children
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self->__pyx_vtab)->_assertNode(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(9, 145, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":146
 *         cdef xmlNode* c_node
 *         self._assertNode()
 *         c = 0             # <<<<<<<<<<<<<<
 *         c_node = self._c_node.children
 *         while c_node is not NULL:
*/
  __pyx_v_c = 0;

  /* "src/lxml/readonlytree.pxi":147
 *         self._assertNode()
 *         c = 0
 *         c_node = self._c_node.children             # <<<<<<<<<<<<<<
 *         while c_node is not NULL:
 *             if tree._isElement(c_node):
*/
  __pyx_t_2 = __pyx_v_self->_c_node->children;
  __pyx_v_c_node = __pyx_t_2;

  /* "src/lxml/readonlytree.pxi":148
 *         c = 0
 *         c_node = self._c_node.children
 *         while c_node is not NULL:             # <<<<<<<<<<<<<<
 *             if tree._isElement(c_node):
 *                 c = c + 1
*/
  while (1) {
    __pyx_t_3 = (__pyx_v_c_node != NULL);
    if (!__pyx_t_3) break;

    /* "src/lxml/readonlytree.pxi":149
 *         c_node = self._c_node.children
 *         while c_node is not NULL:
 *             if tree._isElement(c_node):             # <<<<<<<<<<<<<<
 *                 c = c + 1
 *             c_node = c_node.next
*/
    __pyx_t_3 = _isElement(__pyx_v_c_node);
    if (__pyx_t_3) {

      /* "src/lxml/readonlytree.pxi":150
 *         while c_node is not NULL:
 *             if tree._isElement(c_node):
 *                 c = c + 1             # <<<<<<<<<<<<<<
 *             c_node = c_node.next
 *         return c
*/
      __pyx_v_c = (__pyx_v_c + 1);

      /* "src/lxml/readonlytree.pxi":149
 *         c_node = self._c_node.children
 *         while c_node is not NULL:
 *             if tree._isElement(c_node):             # <<<<<<<<<<<<<<
 *                 c = c + 1
 *             c_node = c_node.next
*/
    }

    /* "src/lxml/readonlytree.pxi":151
 *             if tree._isElement(c_node):
 *                 c = c + 1
 *             c_node = c_node.next             # <<<<<<<<<<<<<<
 *         return c
 * 
*/
    __pyx_t_2 = __pyx_v_c_node->next;
    __pyx_v_c_node = __pyx_t_2;
  }

  /* "src/lxml/readonlytree.pxi":152
 *                 c = c + 1
 *             c_node = c_node.next
 *         return c             # <<<<<<<<<<<<<<
 * 
 *     def __bool__(self):
*/
  __pyx_r = __pyx_v_c;
  goto __pyx_L0;

  /* "src/lxml/readonlytree.pxi":140
 *             return _newReadOnlyProxy(self._source_proxy, c_node)
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         """Returns the number of subelements.
 *         """
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/readonlytree.pxi":154
 *         return c
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         cdef xmlNode* c_node
 *         self._assertNode()
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_9__bool__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_9__bool__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_14_ReadOnlyProxy_8__bool__(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_14_ReadOnlyProxy_8__bool__(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self) {
  xmlNode *__pyx_v_c_node;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/readonlytree.pxi":156
 *     def __bool__(self):
 *         cdef xmlNode* c_node
 *         self._assertNode()             # <<<<<<<<<<<<<<
 *         c_node = _findChildBackwards(self._c_node, 0)
 *         return c_node != NULL
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self->__pyx_vtab)->_assertNode(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(9, 156, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":157
 *         cdef xmlNode* c_node
 *         self._assertNode()
 *         c_node = _findChildBackwards(self._c_node, 0)             # <<<<<<<<<<<<<<
 *         return c_node != NULL
 * 
*/
  __pyx_v_c_node = __pyx_f_4lxml_5etree__findChildBackwards(__pyx_v_self->_c_node, 0);

  /* "src/lxml/readonlytree.pxi":158
 *         self._assertNode()
 *         c_node = _findChildBackwards(self._c_node, 0)
 *         return c_node != NULL             # <<<<<<<<<<<<<<
 * 
 *     def __deepcopy__(self, memo):
*/
  __pyx_r = (__pyx_v_c_node != NULL);
  goto __pyx_L0;

  /* "src/lxml/readonlytree.pxi":154
 *         return c
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         cdef xmlNode* c_node
 *         self._assertNode()
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy.__bool__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/readonlytree.pxi":160
 *         return c_node != NULL
 * 
 *     def __deepcopy__(self, memo):             # <<<<<<<<<<<<<<
 *         "__deepcopy__(self, memo)"
 *         return self.__copy__()
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_11__deepcopy__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_14_ReadOnlyProxy_10__deepcopy__, "__deepcopy__(self, memo)");
static PyMethodDef __pyx_mdef_4lxml_5etree_14_ReadOnlyProxy_11__deepcopy__ = {"__deepcopy__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_11__deepcopy__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_14_ReadOnlyProxy_10__deepcopy__};
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_11__deepcopy__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_memo = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__deepcopy__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_memo,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(9, 160, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(9, 160, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__deepcopy__", 0) < (0)) __PYX_ERR(9, 160, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__deepcopy__", 1, 1, 1, i); __PYX_ERR(9, 160, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(9, 160, __pyx_L3_error)
    }
    __pyx_v_memo = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__deepcopy__", 1, 1, 1, __pyx_nargs); __PYX_ERR(9, 160, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy.__deepcopy__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_14_ReadOnlyProxy_10__deepcopy__(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self), __pyx_v_memo);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_10__deepcopy__(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_memo) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__deepcopy__", 0);

  /* "src/lxml/readonlytree.pxi":162
 *     def __deepcopy__(self, memo):
 *         "__deepcopy__(self, memo)"
 *         return self.__copy__()             # <<<<<<<<<<<<<<
 * 
 *     cpdef __copy__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self->__pyx_vtab)->__pyx___copy__(__pyx_v_self, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 162, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/readonlytree.pxi":160
 *         return c_node != NULL
 * 
 *     def __deepcopy__(self, memo):             # <<<<<<<<<<<<<<
 *         "__deepcopy__(self, memo)"
 *         return self.__copy__()
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy.__deepcopy__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/readonlytree.pxi":164
 *         return self.__copy__()
 * 
 *     cpdef __copy__(self):             # <<<<<<<<<<<<<<
 *         "__copy__(self)"
 *         cdef xmlDoc* c_doc
*/

static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_13__copy__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_4lxml_5etree_14_ReadOnlyProxy___copy__(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self, int __pyx_skip_dispatch) {
  xmlDoc *__pyx_v_c_doc;
  xmlNode *__pyx_v_c_node;
  struct LxmlDocument *__pyx_v_new_doc = 0;
  PyObject *__pyx_v_root = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_t_6;
  xmlDoc *__pyx_t_7;
  xmlNode *__pyx_t_8;
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__copy__", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (
  #if !CYTHON_USE_TYPE_SLOTS
  unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ReadOnlyProxy &&
  __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
  #else
  unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
  #endif
  ) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_copy_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 164, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_13__copy__)) {
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_3 = NULL;
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_4 = __pyx_t_1; 
        __pyx_t_5 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
          assert(__pyx_t_3);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
          __pyx_t_5 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
          __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 164, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
        }
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "src/lxml/readonlytree.pxi":169
 *         cdef xmlNode* c_node
 *         cdef _Document new_doc
 *         if self._c_node is NULL:             # <<<<<<<<<<<<<<
 *             return self
 *         c_doc = _copyDocRoot(self._c_node.doc, self._c_node) # recursive
*/
  __pyx_t_6 = (__pyx_v_self->_c_node == NULL);
  if (__pyx_t_6) {

    /* "src/lxml/readonlytree.pxi":170
 *         cdef _Document new_doc
 *         if self._c_node is NULL:
 *             return self             # <<<<<<<<<<<<<<
 *         c_doc = _copyDocRoot(self._c_node.doc, self._c_node) # recursive
 *         new_doc = _documentFactory(c_doc, None)
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF((PyObject *)__pyx_v_self);
    __pyx_r = ((PyObject *)__pyx_v_self);
    goto __pyx_L0;

    /* "src/lxml/readonlytree.pxi":169
 *         cdef xmlNode* c_node
 *         cdef _Document new_doc
 *         if self._c_node is NULL:             # <<<<<<<<<<<<<<
 *             return self
 *         c_doc = _copyDocRoot(self._c_node.doc, self._c_node) # recursive
*/
  }

  /* "src/lxml/readonlytree.pxi":171
 *         if self._c_node is NULL:
 *             return self
 *         c_doc = _copyDocRoot(self._c_node.doc, self._c_node) # recursive             # <<<<<<<<<<<<<<
 *         new_doc = _documentFactory(c_doc, None)
 *         root = new_doc.getroot()
*/
  __pyx_t_7 = __pyx_f_4lxml_5etree__copyDocRoot(__pyx_v_self->_c_node->doc, __pyx_v_self->_c_node); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(9, 171, __pyx_L1_error)
  __pyx_v_c_doc = __pyx_t_7;

  /* "src/lxml/readonlytree.pxi":172
 *             return self
 *         c_doc = _copyDocRoot(self._c_node.doc, self._c_node) # recursive
 *         new_doc = _documentFactory(c_doc, None)             # <<<<<<<<<<<<<<
 *         root = new_doc.getroot()
 *         if root is not None:
*/
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None))); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 172, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_new_doc = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/readonlytree.pxi":173
 *         c_doc = _copyDocRoot(self._c_node.doc, self._c_node) # recursive
 *         new_doc = _documentFactory(c_doc, None)
 *         root = new_doc.getroot()             # <<<<<<<<<<<<<<
 *         if root is not None:
 *             return root
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_9_Document_getroot(__pyx_v_new_doc); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 173, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_root = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "src/lxml/readonlytree.pxi":174
 *         new_doc = _documentFactory(c_doc, None)
 *         root = new_doc.getroot()
 *         if root is not None:             # <<<<<<<<<<<<<<
 *             return root
 *         # Comment/PI
*/
  __pyx_t_6 = (__pyx_v_root != Py_None);
  if (__pyx_t_6) {

    /* "src/lxml/readonlytree.pxi":175
 *         root = new_doc.getroot()
 *         if root is not None:
 *             return root             # <<<<<<<<<<<<<<
 *         # Comment/PI
 *         c_node = c_doc.children
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_root);
    __pyx_r = __pyx_v_root;
    goto __pyx_L0;

    /* "src/lxml/readonlytree.pxi":174
 *         new_doc = _documentFactory(c_doc, None)
 *         root = new_doc.getroot()
 *         if root is not None:             # <<<<<<<<<<<<<<
 *             return root
 *         # Comment/PI
*/
  }

  /* "src/lxml/readonlytree.pxi":177
 *             return root
 *         # Comment/PI
 *         c_node = c_doc.children             # <<<<<<<<<<<<<<
 *         while c_node is not NULL and c_node.type != self._c_node.type:
 *             c_node = c_node.next
*/
  __pyx_t_8 = __pyx_v_c_doc->children;
  __pyx_v_c_node = __pyx_t_8;

  /* "src/lxml/readonlytree.pxi":178
 *         # Comment/PI
 *         c_node = c_doc.children
 *         while c_node is not NULL and c_node.type != self._c_node.type:             # <<<<<<<<<<<<<<
 *             c_node = c_node.next
 *         if c_node is NULL:
*/
  while (1) {
    __pyx_t_9 = (__pyx_v_c_node != NULL);
    if (__pyx_t_9) {
    } else {
      __pyx_t_6 = __pyx_t_9;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_9 = (__pyx_v_c_node->type != __pyx_v_self->_c_node->type);
    __pyx_t_6 = __pyx_t_9;
    __pyx_L7_bool_binop_done:;
    if (!__pyx_t_6) break;

    /* "src/lxml/readonlytree.pxi":179
 *         c_node = c_doc.children
 *         while c_node is not NULL and c_node.type != self._c_node.type:
 *             c_node = c_node.next             # <<<<<<<<<<<<<<
 *         if c_node is NULL:
 *             return None
*/
    __pyx_t_8 = __pyx_v_c_node->next;
    __pyx_v_c_node = __pyx_t_8;
  }

  /* "src/lxml/readonlytree.pxi":180
 *         while c_node is not NULL and c_node.type != self._c_node.type:
 *             c_node = c_node.next
 *         if c_node is NULL:             # <<<<<<<<<<<<<<
 *             return None
 *         return _elementFactory(new_doc, c_node)
*/
  __pyx_t_6 = (__pyx_v_c_node == NULL);
  if (__pyx_t_6) {

    /* "src/lxml/readonlytree.pxi":181
 *             c_node = c_node.next
 *         if c_node is NULL:
 *             return None             # <<<<<<<<<<<<<<
 *         return _elementFactory(new_doc, c_node)
 * 
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/readonlytree.pxi":180
 *         while c_node is not NULL and c_node.type != self._c_node.type:
 *             c_node = c_node.next
 *         if c_node is NULL:             # <<<<<<<<<<<<<<
 *             return None
 *         return _elementFactory(new_doc, c_node)
*/
  }

  /* "src/lxml/readonlytree.pxi":182
 *         if c_node is NULL:
 *             return None
 *         return _elementFactory(new_doc, c_node)             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(__pyx_v_new_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/readonlytree.pxi":164
 *         return self.__copy__()
 * 
 *     cpdef __copy__(self):             # <<<<<<<<<<<<<<
 *         "__copy__(self)"
 *         cdef xmlDoc* c_doc
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy.__copy__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_new_doc);
  __Pyx_XDECREF(__pyx_v_root);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_13__copy__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_14_ReadOnlyProxy_12__copy__, "__copy__(self)");
static PyMethodDef __pyx_mdef_4lxml_5etree_14_ReadOnlyProxy_13__copy__ = {"__copy__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_13__copy__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_14_ReadOnlyProxy_12__copy__};
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_13__copy__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__copy__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__copy__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__copy__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_14_ReadOnlyProxy_12__copy__(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_12__copy__(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__copy__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree_14_ReadOnlyProxy___copy__(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 164, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy.__copy__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/readonlytree.pxi":184
 *         return _elementFactory(new_doc, c_node)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return iter(self.getchildren())
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_15__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_15__iter__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_14_ReadOnlyProxy_14__iter__(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_14__iter__(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "src/lxml/readonlytree.pxi":185
 * 
 *     def __iter__(self):
 *         return iter(self.getchildren())             # <<<<<<<<<<<<<<
 * 
 *     def iterchildren(self, tag=None, *, reversed=False):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self->__pyx_vtab)->getchildren(__pyx_v_self, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 185, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 185, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/readonlytree.pxi":184
 *         return _elementFactory(new_doc, c_node)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return iter(self.getchildren())
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/readonlytree.pxi":187
 *         return iter(self.getchildren())
 * 
 *     def iterchildren(self, tag=None, *, reversed=False):             # <<<<<<<<<<<<<<
 *         """iterchildren(self, tag=None, reversed=False)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_17iterchildren(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_14_ReadOnlyProxy_16iterchildren, "iterchildren(self, tag=None, reversed=False)\n\n        Iterate over the children of this element.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_14_ReadOnlyProxy_17iterchildren = {"iterchildren", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_17iterchildren, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_14_ReadOnlyProxy_16iterchildren};
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_17iterchildren(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_v_reversed = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iterchildren (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_tag,&__pyx_mstate_global->__pyx_n_u_reversed,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(9, 187, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(9, 187, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "iterchildren", 0) < (0)) __PYX_ERR(9, 187, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_False));
    } else {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(9, 187, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_False));
    }
    __pyx_v_tag = values[0];
    __pyx_v_reversed = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("iterchildren", 0, 0, 1, __pyx_nargs); __PYX_ERR(9, 187, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy.iterchildren", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_14_ReadOnlyProxy_16iterchildren(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self), __pyx_v_tag, __pyx_v_reversed);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_16iterchildren(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_reversed) {
  PyObject *__pyx_v_children = NULL;
  PyObject *__pyx_9genexpr10__pyx_v_el = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *(*__pyx_t_6)(PyObject *);
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("iterchildren", 0);

  /* "src/lxml/readonlytree.pxi":192
 *         Iterate over the children of this element.
 *         """
 *         children = self.getchildren()             # <<<<<<<<<<<<<<
 *         if tag is not None and tag != '*':
 *             children = [ el for el in children if el.tag == tag ]
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self->__pyx_vtab)->getchildren(__pyx_v_self, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 192, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_children = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "src/lxml/readonlytree.pxi":193
 *         """
 *         children = self.getchildren()
 *         if tag is not None and tag != '*':             # <<<<<<<<<<<<<<
 *             children = [ el for el in children if el.tag == tag ]
 *         if reversed:
*/
  __pyx_t_3 = (__pyx_v_tag != Py_None);
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_v_tag, __pyx_mstate_global->__pyx_kp_u__24, Py_NE)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(9, 193, __pyx_L1_error)
  __pyx_t_2 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "src/lxml/readonlytree.pxi":194
 *         children = self.getchildren()
 *         if tag is not None and tag != '*':
 *             children = [ el for el in children if el.tag == tag ]             # <<<<<<<<<<<<<<
 *         if reversed:
 *             children = children[::-1]
*/
    { /* enter inner scope */
      __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 194, __pyx_L8_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (likely(PyList_CheckExact(__pyx_v_children)) || PyTuple_CheckExact(__pyx_v_children)) {
        __pyx_t_4 = __pyx_v_children; __Pyx_INCREF(__pyx_t_4);
        __pyx_t_5 = 0;
        __pyx_t_6 = NULL;
      } else {
        __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_children); if (unlikely(!__pyx_t_4)) __PYX_ERR(9, 194, __pyx_L8_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_6 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(9, 194, __pyx_L8_error)
      }
      for (;;) {
        if (likely(!__pyx_t_6)) {
          if (likely(PyList_CheckExact(__pyx_t_4))) {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_4);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(9, 194, __pyx_L8_error)
              #endif
              if (__pyx_t_5 >= __pyx_temp) break;
            }
            __pyx_t_7 = __Pyx_PyList_GetItemRefFast(__pyx_t_4, __pyx_t_5, __Pyx_ReferenceSharing_OwnStrongReference);
            ++__pyx_t_5;
          } else {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(9, 194, __pyx_L8_error)
              #endif
              if (__pyx_t_5 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_7 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5));
            #else
            __pyx_t_7 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_5);
            #endif
            ++__pyx_t_5;
          }
          if (unlikely(!__pyx_t_7)) __PYX_ERR(9, 194, __pyx_L8_error)
        } else {
          __pyx_t_7 = __pyx_t_6(__pyx_t_4);
          if (unlikely(!__pyx_t_7)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(9, 194, __pyx_L8_error)
              PyErr_Clear();
            }
            break;
          }
        }
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_XDECREF_SET(__pyx_9genexpr10__pyx_v_el, __pyx_t_7);
        __pyx_t_7 = 0;
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_9genexpr10__pyx_v_el, __pyx_mstate_global->__pyx_n_u_tag); if (unlikely(!__pyx_t_7)) __PYX_ERR(9, 194, __pyx_L8_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_8 = PyObject_RichCompare(__pyx_t_7, __pyx_v_tag, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(9, 194, __pyx_L8_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(9, 194, __pyx_L8_error)
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (__pyx_t_2) {
          if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_9genexpr10__pyx_v_el))) __PYX_ERR(9, 194, __pyx_L8_error)
        }
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_9genexpr10__pyx_v_el); __pyx_9genexpr10__pyx_v_el = 0;
      goto __pyx_L13_exit_scope;
      __pyx_L8_error:;
      __Pyx_XDECREF(__pyx_9genexpr10__pyx_v_el); __pyx_9genexpr10__pyx_v_el = 0;
      goto __pyx_L1_error;
      __pyx_L13_exit_scope:;
    } /* exit inner scope */
    __Pyx_DECREF_SET(__pyx_v_children, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/readonlytree.pxi":193
 *         """
 *         children = self.getchildren()
 *         if tag is not None and tag != '*':             # <<<<<<<<<<<<<<
 *             children = [ el for el in children if el.tag == tag ]
 *         if reversed:
*/
  }

  /* "src/lxml/readonlytree.pxi":195
 *         if tag is not None and tag != '*':
 *             children = [ el for el in children if el.tag == tag ]
 *         if reversed:             # <<<<<<<<<<<<<<
 *             children = children[::-1]
 *         return iter(children)
*/
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_reversed); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(9, 195, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "src/lxml/readonlytree.pxi":196
 *             children = [ el for el in children if el.tag == tag ]
 *         if reversed:
 *             children = children[::-1]             # <<<<<<<<<<<<<<
 *         return iter(children)
 * 
*/
    __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_children, __pyx_mstate_global->__pyx_slice[6]); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 196, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_children, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/readonlytree.pxi":195
 *         if tag is not None and tag != '*':
 *             children = [ el for el in children if el.tag == tag ]
 *         if reversed:             # <<<<<<<<<<<<<<
 *             children = children[::-1]
 *         return iter(children)
*/
  }

  /* "src/lxml/readonlytree.pxi":197
 *         if reversed:
 *             children = children[::-1]
 *         return iter(children)             # <<<<<<<<<<<<<<
 * 
 *     cpdef getchildren(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetIter(__pyx_v_children); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 197, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/readonlytree.pxi":187
 *         return iter(self.getchildren())
 * 
 *     def iterchildren(self, tag=None, *, reversed=False):             # <<<<<<<<<<<<<<
 *         """iterchildren(self, tag=None, reversed=False)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy.iterchildren", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_children);
  __Pyx_XDECREF(__pyx_9genexpr10__pyx_v_el);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/readonlytree.pxi":199
 *         return iter(children)
 * 
 *     cpdef getchildren(self):             # <<<<<<<<<<<<<<
 *         """Returns all subelements. The elements are returned in document
 *         order.
*/

static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_19getchildren(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_4lxml_5etree_14_ReadOnlyProxy_getchildren(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self, int __pyx_skip_dispatch) {
  xmlNode *__pyx_v_c_node;
  PyObject *__pyx_v_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_t_6;
  xmlNode *__pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getchildren", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (
  #if !CYTHON_USE_TYPE_SLOTS
  unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ReadOnlyProxy &&
  __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
  #else
  unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
  #endif
  ) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_getchildren); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 199, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_19getchildren)) {
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_3 = NULL;
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_4 = __pyx_t_1; 
        __pyx_t_5 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
          assert(__pyx_t_3);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
          __pyx_t_5 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
          __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 199, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
        }
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "src/lxml/readonlytree.pxi":205
 *         cdef xmlNode* c_node
 *         cdef list result
 *         self._assertNode()             # <<<<<<<<<<<<<<
 *         result = []
 *         c_node = self._c_node.children
*/
  __pyx_t_6 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self->__pyx_vtab)->_assertNode(__pyx_v_self); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(9, 205, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":206
 *         cdef list result
 *         self._assertNode()
 *         result = []             # <<<<<<<<<<<<<<
 *         c_node = self._c_node.children
 *         while c_node is not NULL:
*/
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 206, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_result = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/readonlytree.pxi":207
 *         self._assertNode()
 *         result = []
 *         c_node = self._c_node.children             # <<<<<<<<<<<<<<
 *         while c_node is not NULL:
 *             if tree._isElement(c_node):
*/
  __pyx_t_7 = __pyx_v_self->_c_node->children;
  __pyx_v_c_node = __pyx_t_7;

  /* "src/lxml/readonlytree.pxi":208
 *         result = []
 *         c_node = self._c_node.children
 *         while c_node is not NULL:             # <<<<<<<<<<<<<<
 *             if tree._isElement(c_node):
 *                 result.append(_newReadOnlyProxy(self._source_proxy, c_node))
*/
  while (1) {
    __pyx_t_8 = (__pyx_v_c_node != NULL);
    if (!__pyx_t_8) break;

    /* "src/lxml/readonlytree.pxi":209
 *         c_node = self._c_node.children
 *         while c_node is not NULL:
 *             if tree._isElement(c_node):             # <<<<<<<<<<<<<<
 *                 result.append(_newReadOnlyProxy(self._source_proxy, c_node))
 *             c_node = c_node.next
*/
    __pyx_t_8 = _isElement(__pyx_v_c_node);
    if (__pyx_t_8) {

      /* "src/lxml/readonlytree.pxi":210
 *         while c_node is not NULL:
 *             if tree._isElement(c_node):
 *                 result.append(_newReadOnlyProxy(self._source_proxy, c_node))             # <<<<<<<<<<<<<<
 *             c_node = c_node.next
 *         return result
*/
      __pyx_t_1 = ((PyObject *)__pyx_v_self->_source_proxy);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__newReadOnlyProxy(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_1), __pyx_v_c_node)); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 210, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_2); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(9, 210, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "src/lxml/readonlytree.pxi":209
 *         c_node = self._c_node.children
 *         while c_node is not NULL:
 *             if tree._isElement(c_node):             # <<<<<<<<<<<<<<
 *                 result.append(_newReadOnlyProxy(self._source_proxy, c_node))
 *             c_node = c_node.next
*/
    }

    /* "src/lxml/readonlytree.pxi":211
 *             if tree._isElement(c_node):
 *                 result.append(_newReadOnlyProxy(self._source_proxy, c_node))
 *             c_node = c_node.next             # <<<<<<<<<<<<<<
 *         return result
 * 
*/
    __pyx_t_7 = __pyx_v_c_node->next;
    __pyx_v_c_node = __pyx_t_7;
  }

  /* "src/lxml/readonlytree.pxi":212
 *                 result.append(_newReadOnlyProxy(self._source_proxy, c_node))
 *             c_node = c_node.next
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     def getparent(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "src/lxml/readonlytree.pxi":199
 *         return iter(children)
 * 
 *     cpdef getchildren(self):             # <<<<<<<<<<<<<<
 *         """Returns all subelements. The elements are returned in document
 *         order.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy.getchildren", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_19getchildren(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_14_ReadOnlyProxy_18getchildren, "Returns all subelements. The elements are returned in document\n        order.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_14_ReadOnlyProxy_19getchildren = {"getchildren", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_19getchildren, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_14_ReadOnlyProxy_18getchildren};
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_19getchildren(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getchildren (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("getchildren", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("getchildren", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_14_ReadOnlyProxy_18getchildren(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_18getchildren(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getchildren", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree_14_ReadOnlyProxy_getchildren(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy.getchildren", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/readonlytree.pxi":214
 *         return result
 * 
 *     def getparent(self):             # <<<<<<<<<<<<<<
 *         """Returns the parent of this element or None for the root element.
 *         """
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_21getparent(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_14_ReadOnlyProxy_20getparent, "Returns the parent of this element or None for the root element.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_14_ReadOnlyProxy_21getparent = {"getparent", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_21getparent, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_14_ReadOnlyProxy_20getparent};
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_21getparent(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getparent (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("getparent", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("getparent", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_14_ReadOnlyProxy_20getparent(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_20getparent(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self) {
  xmlNode *__pyx_v_c_parent;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  xmlNode *__pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getparent", 0);

  /* "src/lxml/readonlytree.pxi":218
 *         """
 *         cdef xmlNode* c_parent
 *         self._assertNode()             # <<<<<<<<<<<<<<
 *         c_parent = self._c_node.parent
 *         if c_parent is NULL or not tree._isElement(c_parent):
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self->__pyx_vtab)->_assertNode(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(9, 218, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":219
 *         cdef xmlNode* c_parent
 *         self._assertNode()
 *         c_parent = self._c_node.parent             # <<<<<<<<<<<<<<
 *         if c_parent is NULL or not tree._isElement(c_parent):
 *             return None
*/
  __pyx_t_2 = __pyx_v_self->_c_node->parent;
  __pyx_v_c_parent = __pyx_t_2;

  /* "src/lxml/readonlytree.pxi":220
 *         self._assertNode()
 *         c_parent = self._c_node.parent
 *         if c_parent is NULL or not tree._isElement(c_parent):             # <<<<<<<<<<<<<<
 *             return None
 *         else:
*/
  __pyx_t_4 = (__pyx_v_c_parent == NULL);
  if (!__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = (!_isElement(__pyx_v_c_parent));
  __pyx_t_3 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_3) {

    /* "src/lxml/readonlytree.pxi":221
 *         c_parent = self._c_node.parent
 *         if c_parent is NULL or not tree._isElement(c_parent):
 *             return None             # <<<<<<<<<<<<<<
 *         else:
 *             return _newReadOnlyProxy(self._source_proxy, c_parent)
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/readonlytree.pxi":220
 *         self._assertNode()
 *         c_parent = self._c_node.parent
 *         if c_parent is NULL or not tree._isElement(c_parent):             # <<<<<<<<<<<<<<
 *             return None
 *         else:
*/
  }

  /* "src/lxml/readonlytree.pxi":223
 *             return None
 *         else:
 *             return _newReadOnlyProxy(self._source_proxy, c_parent)             # <<<<<<<<<<<<<<
 * 
 *     def getnext(self):
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = ((PyObject *)__pyx_v_self->_source_proxy);
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_6 = ((PyObject *)__pyx_f_4lxml_5etree__newReadOnlyProxy(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_5), __pyx_v_c_parent)); if (unlikely(!__pyx_t_6)) __PYX_ERR(9, 223, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    goto __pyx_L0;
  }

  /* "src/lxml/readonlytree.pxi":214
 *         return result
 * 
 *     def getparent(self):             # <<<<<<<<<<<<<<
 *         """Returns the parent of this element or None for the root element.
 *         """
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy.getparent", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/readonlytree.pxi":225
 *             return _newReadOnlyProxy(self._source_proxy, c_parent)
 * 
 *     def getnext(self):             # <<<<<<<<<<<<<<
 *         """Returns the following sibling of this element or None.
 *         """
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_23getnext(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_14_ReadOnlyProxy_22getnext, "Returns the following sibling of this element or None.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_14_ReadOnlyProxy_23getnext = {"getnext", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_23getnext, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_14_ReadOnlyProxy_22getnext};
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_23getnext(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getnext (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("getnext", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("getnext", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_14_ReadOnlyProxy_22getnext(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_22getnext(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self) {
  xmlNode *__pyx_v_c_node;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getnext", 0);

  /* "src/lxml/readonlytree.pxi":229
 *         """
 *         cdef xmlNode* c_node
 *         self._assertNode()             # <<<<<<<<<<<<<<
 *         c_node = _nextElement(self._c_node)
 *         if c_node is not NULL:
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self->__pyx_vtab)->_assertNode(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(9, 229, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":230
 *         cdef xmlNode* c_node
 *         self._assertNode()
 *         c_node = _nextElement(self._c_node)             # <<<<<<<<<<<<<<
 *         if c_node is not NULL:
 *             return _newReadOnlyProxy(self._source_proxy, c_node)
*/
  __pyx_v_c_node = __pyx_f_4lxml_5etree__nextElement(__pyx_v_self->_c_node);

  /* "src/lxml/readonlytree.pxi":231
 *         self._assertNode()
 *         c_node = _nextElement(self._c_node)
 *         if c_node is not NULL:             # <<<<<<<<<<<<<<
 *             return _newReadOnlyProxy(self._source_proxy, c_node)
 *         return None
*/
  __pyx_t_2 = (__pyx_v_c_node != NULL);
  if (__pyx_t_2) {

    /* "src/lxml/readonlytree.pxi":232
 *         c_node = _nextElement(self._c_node)
 *         if c_node is not NULL:
 *             return _newReadOnlyProxy(self._source_proxy, c_node)             # <<<<<<<<<<<<<<
 *         return None
 * 
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = ((PyObject *)__pyx_v_self->_source_proxy);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__newReadOnlyProxy(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_3), __pyx_v_c_node)); if (unlikely(!__pyx_t_4)) __PYX_ERR(9, 232, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;

    /* "src/lxml/readonlytree.pxi":231
 *         self._assertNode()
 *         c_node = _nextElement(self._c_node)
 *         if c_node is not NULL:             # <<<<<<<<<<<<<<
 *             return _newReadOnlyProxy(self._source_proxy, c_node)
 *         return None
*/
  }

  /* "src/lxml/readonlytree.pxi":233
 *         if c_node is not NULL:
 *             return _newReadOnlyProxy(self._source_proxy, c_node)
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     def getprevious(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "src/lxml/readonlytree.pxi":225
 *             return _newReadOnlyProxy(self._source_proxy, c_parent)
 * 
 *     def getnext(self):             # <<<<<<<<<<<<<<
 *         """Returns the following sibling of this element or None.
 *         """
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy.getnext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/readonlytree.pxi":235
 *         return None
 * 
 *     def getprevious(self):             # <<<<<<<<<<<<<<
 *         """Returns the preceding sibling of this element or None.
 *         """
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_25getprevious(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_14_ReadOnlyProxy_24getprevious, "Returns the preceding sibling of this element or None.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_14_ReadOnlyProxy_25getprevious = {"getprevious", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_25getprevious, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_14_ReadOnlyProxy_24getprevious};
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_25getprevious(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getprevious (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("getprevious", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("getprevious", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_14_ReadOnlyProxy_24getprevious(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_24getprevious(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self) {
  xmlNode *__pyx_v_c_node;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getprevious", 0);

  /* "src/lxml/readonlytree.pxi":239
 *         """
 *         cdef xmlNode* c_node
 *         self._assertNode()             # <<<<<<<<<<<<<<
 *         c_node = _previousElement(self._c_node)
 *         if c_node is not NULL:
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self->__pyx_vtab)->_assertNode(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(9, 239, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":240
 *         cdef xmlNode* c_node
 *         self._assertNode()
 *         c_node = _previousElement(self._c_node)             # <<<<<<<<<<<<<<
 *         if c_node is not NULL:
 *             return _newReadOnlyProxy(self._source_proxy, c_node)
*/
  __pyx_v_c_node = __pyx_f_4lxml_5etree__previousElement(__pyx_v_self->_c_node);

  /* "src/lxml/readonlytree.pxi":241
 *         self._assertNode()
 *         c_node = _previousElement(self._c_node)
 *         if c_node is not NULL:             # <<<<<<<<<<<<<<
 *             return _newReadOnlyProxy(self._source_proxy, c_node)
 *         return None
*/
  __pyx_t_2 = (__pyx_v_c_node != NULL);
  if (__pyx_t_2) {

    /* "src/lxml/readonlytree.pxi":242
 *         c_node = _previousElement(self._c_node)
 *         if c_node is not NULL:
 *             return _newReadOnlyProxy(self._source_proxy, c_node)             # <<<<<<<<<<<<<<
 *         return None
 * 
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = ((PyObject *)__pyx_v_self->_source_proxy);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__newReadOnlyProxy(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_3), __pyx_v_c_node)); if (unlikely(!__pyx_t_4)) __PYX_ERR(9, 242, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;

    /* "src/lxml/readonlytree.pxi":241
 *         self._assertNode()
 *         c_node = _previousElement(self._c_node)
 *         if c_node is not NULL:             # <<<<<<<<<<<<<<
 *             return _newReadOnlyProxy(self._source_proxy, c_node)
 *         return None
*/
  }

  /* "src/lxml/readonlytree.pxi":243
 *         if c_node is not NULL:
 *             return _newReadOnlyProxy(self._source_proxy, c_node)
 *         return None             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "src/lxml/readonlytree.pxi":235
 *         return None
 * 
 *     def getprevious(self):             # <<<<<<<<<<<<<<
 *         """Returns the preceding sibling of this element or None.
 *         """
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy.getprevious", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/readonlytree.pxi":250
 * cdef class _ReadOnlyPIProxy(_ReadOnlyProxy):
 *     """A read-only proxy for processing instructions (for internal use only!)"""
 *     @property             # <<<<<<<<<<<<<<
 *     def target(self):
 *         self._assertNode()
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_16_ReadOnlyPIProxy_6target_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_16_ReadOnlyPIProxy_6target_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_16_ReadOnlyPIProxy_6target___get__(((struct __pyx_obj_4lxml_5etree__ReadOnlyPIProxy *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_16_ReadOnlyPIProxy_6target___get__(struct __pyx_obj_4lxml_5etree__ReadOnlyPIProxy *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "src/lxml/readonlytree.pxi":252
 *     @property
 *     def target(self):
 *         self._assertNode()             # <<<<<<<<<<<<<<
 *         return funicode(self._c_node.name)
 * 
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyPIProxy *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(9, 252, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":253
 *     def target(self):
 *         self._assertNode()
 *         return funicode(self._c_node.name)             # <<<<<<<<<<<<<<
 * 
 * @cython.final
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_self->__pyx_base._c_node->name); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 253, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/readonlytree.pxi":250
 * cdef class _ReadOnlyPIProxy(_ReadOnlyProxy):
 *     """A read-only proxy for processing instructions (for internal use only!)"""
 *     @property             # <<<<<<<<<<<<<<
 *     def target(self):
 *         self._assertNode()
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyPIProxy.target.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/readonlytree.pxi":260
 *     """A read-only proxy for entity references (for internal use only!)"""
 *     property name:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return funicode(self._c_node.name)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_20_ReadOnlyEntityProxy_4name_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_20_ReadOnlyEntityProxy_4name_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_20_ReadOnlyEntityProxy_4name___get__(((struct __pyx_obj_4lxml_5etree__ReadOnlyEntityProxy *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_20_ReadOnlyEntityProxy_4name___get__(struct __pyx_obj_4lxml_5etree__ReadOnlyEntityProxy *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "src/lxml/readonlytree.pxi":261
 *     property name:
 *         def __get__(self):
 *             return funicode(self._c_node.name)             # <<<<<<<<<<<<<<
 * 
 *         def __set__(self, value):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree_funicode(__pyx_v_self->__pyx_base._c_node->name); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 261, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/readonlytree.pxi":260
 *     """A read-only proxy for entity references (for internal use only!)"""
 *     property name:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return funicode(self._c_node.name)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyEntityProxy.name.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/readonlytree.pxi":263
 *             return funicode(self._c_node.name)
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             value_utf = _utf8(value)
 *             if '&' in value or ';' in value:
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_20_ReadOnlyEntityProxy_4name_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_4lxml_5etree_20_ReadOnlyEntityProxy_4name_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_20_ReadOnlyEntityProxy_4name_2__set__(((struct __pyx_obj_4lxml_5etree__ReadOnlyEntityProxy *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_20_ReadOnlyEntityProxy_4name_2__set__(struct __pyx_obj_4lxml_5etree__ReadOnlyEntityProxy *__pyx_v_self, PyObject *__pyx_v_value) {
  PyObject *__pyx_v_value_utf = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6[3];
  PyObject *__pyx_t_7 = NULL;
  size_t __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "src/lxml/readonlytree.pxi":264
 * 
 *         def __set__(self, value):
 *             value_utf = _utf8(value)             # <<<<<<<<<<<<<<
 *             if '&' in value or ';' in value:
 *                 raise ValueError(f"Invalid entity name '{value}'")
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__utf8(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 264, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_value_utf = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/readonlytree.pxi":265
 *         def __set__(self, value):
 *             value_utf = _utf8(value)
 *             if '&' in value or ';' in value:             # <<<<<<<<<<<<<<
 *                 raise ValueError(f"Invalid entity name '{value}'")
 *             tree.xmlNodeSetName(self._c_node, _xcstr(value_utf))
*/
  __pyx_t_3 = (__Pyx_PySequence_ContainsTF(__pyx_mstate_global->__pyx_kp_u__19, __pyx_v_value, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(9, 265, __pyx_L1_error)
  if (!__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__Pyx_PySequence_ContainsTF(__pyx_mstate_global->__pyx_kp_u__20, __pyx_v_value, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(9, 265, __pyx_L1_error)
  __pyx_t_2 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (unlikely(__pyx_t_2)) {

    /* "src/lxml/readonlytree.pxi":266
 *             value_utf = _utf8(value)
 *             if '&' in value or ';' in value:
 *                 raise ValueError(f"Invalid entity name '{value}'")             # <<<<<<<<<<<<<<
 *             tree.xmlNodeSetName(self._c_node, _xcstr(value_utf))
 * 
*/
    __pyx_t_4 = NULL;
    __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_v_value, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(9, 266, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6[0] = __pyx_mstate_global->__pyx_kp_u_Invalid_entity_name;
    __pyx_t_6[1] = __pyx_t_5;
    __pyx_t_6[2] = __pyx_mstate_global->__pyx_kp_u__4;
    __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_6, 3, 21 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5));
    if (unlikely(!__pyx_t_7)) __PYX_ERR(9, 266, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_8 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_7};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 266, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(9, 266, __pyx_L1_error)

    /* "src/lxml/readonlytree.pxi":265
 *         def __set__(self, value):
 *             value_utf = _utf8(value)
 *             if '&' in value or ';' in value:             # <<<<<<<<<<<<<<
 *                 raise ValueError(f"Invalid entity name '{value}'")
 *             tree.xmlNodeSetName(self._c_node, _xcstr(value_utf))
*/
  }

  /* "src/lxml/readonlytree.pxi":267
 *             if '&' in value or ';' in value:
 *                 raise ValueError(f"Invalid entity name '{value}'")
 *             tree.xmlNodeSetName(self._c_node, _xcstr(value_utf))             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  xmlNodeSetName(__pyx_v_self->__pyx_base._c_node, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_value_utf));

  /* "src/lxml/readonlytree.pxi":263
 *             return funicode(self._c_node.name)
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             value_utf = _utf8(value)
 *             if '&' in value or ';' in value:
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyEntityProxy.name.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value_utf);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/readonlytree.pxi":269
 *             tree.xmlNodeSetName(self._c_node, _xcstr(value_utf))
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def text(self):
 *         return f'&{funicode(self._c_node.name)};'
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_20_ReadOnlyEntityProxy_4text_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_20_ReadOnlyEntityProxy_4text_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_20_ReadOnlyEntityProxy_4text___get__(((struct __pyx_obj_4lxml_5etree__ReadOnlyEntityProxy *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_20_ReadOnlyEntityProxy_4text___get__(struct __pyx_obj_4lxml_5etree__ReadOnlyEntityProxy *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3[3];
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "src/lxml/readonlytree.pxi":271
 *     @property
 *     def text(self):
 *         return f'&{funicode(self._c_node.name)};'             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree_funicode(__pyx_v_self->__pyx_base._c_node->name); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 271, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyUnicode_Unicode(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 271, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3[0] = __pyx_mstate_global->__pyx_kp_u__19;
  __pyx_t_3[1] = __pyx_t_2;
  __pyx_t_3[2] = __pyx_mstate_global->__pyx_kp_u__20;
  __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, 1 * 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2));
  if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 271, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/readonlytree.pxi":269
 *             tree.xmlNodeSetName(self._c_node, _xcstr(value_utf))
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def text(self):
 *         return f'&{funicode(self._c_node.name)};'
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyEntityProxy.text.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/readonlytree.pxi":278
 *     """The main read-only Element proxy class (for internal use only!)."""
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def attrib(self):
 *         self._assertNode()
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_21_ReadOnlyElementProxy_6attrib_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_21_ReadOnlyElementProxy_6attrib_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_6attrib___get__(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_6attrib___get__(struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "src/lxml/readonlytree.pxi":280
 *     @property
 *     def attrib(self):
 *         self._assertNode()             # <<<<<<<<<<<<<<
 *         return dict(_collectAttributes(self._c_node, 3))
 * 
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(9, 280, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":281
 *     def attrib(self):
 *         self._assertNode()
 *         return dict(_collectAttributes(self._c_node, 3))             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = NULL;
  __pyx_t_4 = __pyx_f_4lxml_5etree__collectAttributes(__pyx_v_self->__pyx_base._c_node, 3); if (unlikely(!__pyx_t_4)) __PYX_ERR(9, 281, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_4};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(&PyDict_Type), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 281, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/readonlytree.pxi":278
 *     """The main read-only Element proxy class (for internal use only!)."""
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def attrib(self):
 *         self._assertNode()
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyElementProxy.attrib.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/readonlytree.pxi":283
 *         return dict(_collectAttributes(self._c_node, 3))
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def prefix(self):
 *         """Namespace prefix or None.
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_21_ReadOnlyElementProxy_6prefix_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_21_ReadOnlyElementProxy_6prefix_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_6prefix___get__(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_6prefix___get__(struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "src/lxml/readonlytree.pxi":287
 *         """Namespace prefix or None.
 *         """
 *         self._assertNode()             # <<<<<<<<<<<<<<
 *         if self._c_node.ns is not NULL:
 *             if self._c_node.ns.prefix is not NULL:
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(9, 287, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":288
 *         """
 *         self._assertNode()
 *         if self._c_node.ns is not NULL:             # <<<<<<<<<<<<<<
 *             if self._c_node.ns.prefix is not NULL:
 *                 return funicode(self._c_node.ns.prefix)
*/
  __pyx_t_2 = (__pyx_v_self->__pyx_base._c_node->ns != NULL);
  if (__pyx_t_2) {

    /* "src/lxml/readonlytree.pxi":289
 *         self._assertNode()
 *         if self._c_node.ns is not NULL:
 *             if self._c_node.ns.prefix is not NULL:             # <<<<<<<<<<<<<<
 *                 return funicode(self._c_node.ns.prefix)
 *         return None
*/
    __pyx_t_2 = (__pyx_v_self->__pyx_base._c_node->ns->prefix != NULL);
    if (__pyx_t_2) {

      /* "src/lxml/readonlytree.pxi":290
 *         if self._c_node.ns is not NULL:
 *             if self._c_node.ns.prefix is not NULL:
 *                 return funicode(self._c_node.ns.prefix)             # <<<<<<<<<<<<<<
 *         return None
 * 
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_self->__pyx_base._c_node->ns->prefix); if (unlikely(!__pyx_t_3)) __PYX_ERR(9, 290, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L0;

      /* "src/lxml/readonlytree.pxi":289
 *         self._assertNode()
 *         if self._c_node.ns is not NULL:
 *             if self._c_node.ns.prefix is not NULL:             # <<<<<<<<<<<<<<
 *                 return funicode(self._c_node.ns.prefix)
 *         return None
*/
    }

    /* "src/lxml/readonlytree.pxi":288
 *         """
 *         self._assertNode()
 *         if self._c_node.ns is not NULL:             # <<<<<<<<<<<<<<
 *             if self._c_node.ns.prefix is not NULL:
 *                 return funicode(self._c_node.ns.prefix)
*/
  }

  /* "src/lxml/readonlytree.pxi":291
 *             if self._c_node.ns.prefix is not NULL:
 *                 return funicode(self._c_node.ns.prefix)
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "src/lxml/readonlytree.pxi":283
 *         return dict(_collectAttributes(self._c_node, 3))
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def prefix(self):
 *         """Namespace prefix or None.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyElementProxy.prefix.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/readonlytree.pxi":293
 *         return None
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def nsmap(self):
 *         """Namespace prefix->URI mapping known in the context of this
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_21_ReadOnlyElementProxy_5nsmap_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_21_ReadOnlyElementProxy_5nsmap_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_5nsmap___get__(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_5nsmap___get__(struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "src/lxml/readonlytree.pxi":301
 *         Note that changing the returned dict has no effect on the Element.
 *         """
 *         self._assertNode()             # <<<<<<<<<<<<<<
 *         return _build_nsmap(self._c_node)
 * 
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(9, 301, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":302
 *         """
 *         self._assertNode()
 *         return _build_nsmap(self._c_node)             # <<<<<<<<<<<<<<
 * 
 *     def get(self, key, default=None):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree__build_nsmap(__pyx_v_self->__pyx_base._c_node); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 302, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/readonlytree.pxi":293
 *         return None
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def nsmap(self):
 *         """Namespace prefix->URI mapping known in the context of this
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyElementProxy.nsmap.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/readonlytree.pxi":304
 *         return _build_nsmap(self._c_node)
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         """Gets an element attribute.
 *         """
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_21_ReadOnlyElementProxy_1get(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy_get, "Gets an element attribute.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_21_ReadOnlyElementProxy_1get = {"get", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_21_ReadOnlyElementProxy_1get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy_get};
static PyObject *__pyx_pw_4lxml_5etree_21_ReadOnlyElementProxy_1get(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_default = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_key,&__pyx_mstate_global->__pyx_n_u_default,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(9, 304, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(9, 304, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(9, 304, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "get", 0) < (0)) __PYX_ERR(9, 304, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, i); __PYX_ERR(9, 304, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(9, 304, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(9, 304, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_key = values[0];
    __pyx_v_default = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, __pyx_nargs); __PYX_ERR(9, 304, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._ReadOnlyElementProxy.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_get(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self), __pyx_v_key, __pyx_v_default);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_get(struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get", 0);

  /* "src/lxml/readonlytree.pxi":307
 *         """Gets an element attribute.
 *         """
 *         self._assertNode()             # <<<<<<<<<<<<<<
 *         return _getNodeAttributeValue(self._c_node, key, default)
 * 
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(9, 307, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":308
 *         """
 *         self._assertNode()
 *         return _getNodeAttributeValue(self._c_node, key, default)             # <<<<<<<<<<<<<<
 * 
 *     def keys(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree__getNodeAttributeValue(__pyx_v_self->__pyx_base._c_node, __pyx_v_key, __pyx_v_default); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 308, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/readonlytree.pxi":304
 *         return _build_nsmap(self._c_node)
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         """Gets an element attribute.
 *         """
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyElementProxy.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/readonlytree.pxi":310
 *         return _getNodeAttributeValue(self._c_node, key, default)
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """Gets a list of attribute names. The names are returned in an
 *         arbitrary order (just like for an ordinary Python dictionary).
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_21_ReadOnlyElementProxy_3keys(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy_2keys, "Gets a list of attribute names. The names are returned in an\n        arbitrary order (just like for an ordinary Python dictionary).\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_21_ReadOnlyElementProxy_3keys = {"keys", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_21_ReadOnlyElementProxy_3keys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy_2keys};
static PyObject *__pyx_pw_4lxml_5etree_21_ReadOnlyElementProxy_3keys(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("keys (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("keys", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("keys", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_2keys(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_2keys(struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("keys", 0);

  /* "src/lxml/readonlytree.pxi":314
 *         arbitrary order (just like for an ordinary Python dictionary).
 *         """
 *         self._assertNode()             # <<<<<<<<<<<<<<
 *         return _collectAttributes(self._c_node, 1)
 * 
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(9, 314, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":315
 *         """
 *         self._assertNode()
 *         return _collectAttributes(self._c_node, 1)             # <<<<<<<<<<<<<<
 * 
 *     def values(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree__collectAttributes(__pyx_v_self->__pyx_base._c_node, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 315, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/readonlytree.pxi":310
 *         return _getNodeAttributeValue(self._c_node, key, default)
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """Gets a list of attribute names. The names are returned in an
 *         arbitrary order (just like for an ordinary Python dictionary).
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyElementProxy.keys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/readonlytree.pxi":317
 *         return _collectAttributes(self._c_node, 1)
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         """Gets element attributes, as a sequence. The attributes are returned
 *         in an arbitrary order.
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_21_ReadOnlyElementProxy_5values(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy_4values, "Gets element attributes, as a sequence. The attributes are returned\n        in an arbitrary order.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_21_ReadOnlyElementProxy_5values = {"values", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_21_ReadOnlyElementProxy_5values, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy_4values};
static PyObject *__pyx_pw_4lxml_5etree_21_ReadOnlyElementProxy_5values(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("values (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("values", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("values", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_4values(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_4values(struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("values", 0);

  /* "src/lxml/readonlytree.pxi":321
 *         in an arbitrary order.
 *         """
 *         self._assertNode()             # <<<<<<<<<<<<<<
 *         return _collectAttributes(self._c_node, 2)
 * 
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(9, 321, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":322
 *         """
 *         self._assertNode()
 *         return _collectAttributes(self._c_node, 2)             # <<<<<<<<<<<<<<
 * 
 *     def items(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree__collectAttributes(__pyx_v_self->__pyx_base._c_node, 2); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 322, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/readonlytree.pxi":317
 *         return _collectAttributes(self._c_node, 1)
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         """Gets element attributes, as a sequence. The attributes are returned
 *         in an arbitrary order.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyElementProxy.values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/readonlytree.pxi":324
 *         return _collectAttributes(self._c_node, 2)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """Gets element attributes, as a sequence. The attributes are returned
 *         in an arbitrary order.
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_21_ReadOnlyElementProxy_7items(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy_6items, "Gets element attributes, as a sequence. The attributes are returned\n        in an arbitrary order.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_21_ReadOnlyElementProxy_7items = {"items", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_21_ReadOnlyElementProxy_7items, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy_6items};
static PyObject *__pyx_pw_4lxml_5etree_21_ReadOnlyElementProxy_7items(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("items", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("items", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_6items(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_6items(struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("items", 0);

  /* "src/lxml/readonlytree.pxi":328
 *         in an arbitrary order.
 *         """
 *         self._assertNode()             # <<<<<<<<<<<<<<
 *         return _collectAttributes(self._c_node, 3)
 * 
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(9, 328, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":329
 *         """
 *         self._assertNode()
 *         return _collectAttributes(self._c_node, 3)             # <<<<<<<<<<<<<<
 * 
 * cdef _ReadOnlyProxy _newReadOnlyProxy(
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree__collectAttributes(__pyx_v_self->__pyx_base._c_node, 3); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 329, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/readonlytree.pxi":324
 *         return _collectAttributes(self._c_node, 2)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """Gets element attributes, as a sequence. The attributes are returned
 *         in an arbitrary order.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyElementProxy.items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/readonlytree.pxi":331
 *         return _collectAttributes(self._c_node, 3)
 * 
 * cdef _ReadOnlyProxy _newReadOnlyProxy(             # <<<<<<<<<<<<<<
 *     _ReadOnlyProxy source_proxy, xmlNode* c_node):
 *     cdef _ReadOnlyProxy el
*/

static struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_f_4lxml_5etree__newReadOnlyProxy(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_source_proxy, xmlNode *__pyx_v_c_node) {
  struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_el = 0;
  struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_newReadOnlyProxy", 0);

  /* "src/lxml/readonlytree.pxi":334
 *     _ReadOnlyProxy source_proxy, xmlNode* c_node):
 *     cdef _ReadOnlyProxy el
 *     if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         el = _ReadOnlyElementProxy.__new__(_ReadOnlyElementProxy)
 *     elif c_node.type == tree.XML_PI_NODE:
*/
  switch (__pyx_v_c_node->type) {
    case XML_ELEMENT_NODE:

    /* "src/lxml/readonlytree.pxi":335
 *     cdef _ReadOnlyProxy el
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         el = _ReadOnlyElementProxy.__new__(_ReadOnlyElementProxy)             # <<<<<<<<<<<<<<
 *     elif c_node.type == tree.XML_PI_NODE:
 *         el = _ReadOnlyPIProxy.__new__(_ReadOnlyPIProxy)
*/
    __pyx_t_1 = ((PyObject *)__pyx_tp_new_4lxml_5etree__ReadOnlyElementProxy(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ReadOnlyElementProxy), __pyx_mstate_global->__pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 335, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
    if (!(likely(__Pyx_TypeTest(((PyObject *)__pyx_t_1), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ReadOnlyProxy)))) __PYX_ERR(9, 335, __pyx_L1_error)
    __pyx_v_el = ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/readonlytree.pxi":334
 *     _ReadOnlyProxy source_proxy, xmlNode* c_node):
 *     cdef _ReadOnlyProxy el
 *     if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         el = _ReadOnlyElementProxy.__new__(_ReadOnlyElementProxy)
 *     elif c_node.type == tree.XML_PI_NODE:
*/
    break;
    case XML_PI_NODE:

    /* "src/lxml/readonlytree.pxi":337
 *         el = _ReadOnlyElementProxy.__new__(_ReadOnlyElementProxy)
 *     elif c_node.type == tree.XML_PI_NODE:
 *         el = _ReadOnlyPIProxy.__new__(_ReadOnlyPIProxy)             # <<<<<<<<<<<<<<
 *     elif c_node.type in (tree.XML_COMMENT_NODE,
 *                          tree.XML_ENTITY_REF_NODE):
*/
    __pyx_t_1 = ((PyObject *)__pyx_tp_new_4lxml_5etree__ReadOnlyPIProxy(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ReadOnlyPIProxy), __pyx_mstate_global->__pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 337, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
    if (!(likely(__Pyx_TypeTest(((PyObject *)__pyx_t_1), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ReadOnlyProxy)))) __PYX_ERR(9, 337, __pyx_L1_error)
    __pyx_v_el = ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/readonlytree.pxi":336
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         el = _ReadOnlyElementProxy.__new__(_ReadOnlyElementProxy)
 *     elif c_node.type == tree.XML_PI_NODE:             # <<<<<<<<<<<<<<
 *         el = _ReadOnlyPIProxy.__new__(_ReadOnlyPIProxy)
 *     elif c_node.type in (tree.XML_COMMENT_NODE,
*/
    break;
    case XML_COMMENT_NODE:

    /* "src/lxml/readonlytree.pxi":338
 *     elif c_node.type == tree.XML_PI_NODE:
 *         el = _ReadOnlyPIProxy.__new__(_ReadOnlyPIProxy)
 *     elif c_node.type in (tree.XML_COMMENT_NODE,             # <<<<<<<<<<<<<<
 *                          tree.XML_ENTITY_REF_NODE):
 *         el = _ReadOnlyProxy.__new__(_ReadOnlyProxy)
*/
    case XML_ENTITY_REF_NODE:

    /* "src/lxml/readonlytree.pxi":340
 *     elif c_node.type in (tree.XML_COMMENT_NODE,
 *                          tree.XML_ENTITY_REF_NODE):
 *         el = _ReadOnlyProxy.__new__(_ReadOnlyProxy)             # <<<<<<<<<<<<<<
 *     else:
 *         raise TypeError(f"Unsupported element type: {c_node.type}")
*/
    __pyx_t_1 = ((PyObject *)__pyx_tp_new_4lxml_5etree__ReadOnlyProxy(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ReadOnlyProxy), __pyx_mstate_global->__pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 340, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
    __pyx_v_el = ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/readonlytree.pxi":338
 *     elif c_node.type == tree.XML_PI_NODE:
 *         el = _ReadOnlyPIProxy.__new__(_ReadOnlyPIProxy)
 *     elif c_node.type in (tree.XML_COMMENT_NODE,             # <<<<<<<<<<<<<<
 *                          tree.XML_ENTITY_REF_NODE):
 *         el = _ReadOnlyProxy.__new__(_ReadOnlyProxy)
*/
    break;
    default:

    /* "src/lxml/readonlytree.pxi":342
 *         el = _ReadOnlyProxy.__new__(_ReadOnlyProxy)
 *     else:
 *         raise TypeError(f"Unsupported element type: {c_node.type}")             # <<<<<<<<<<<<<<
 *     el._c_node = c_node
 *     _initReadOnlyProxy(el, source_proxy)
*/
    __pyx_t_2 = NULL;
    __pyx_t_3 = __Pyx_PyUnicode_From_xmlElementType(__pyx_v_c_node->type, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(9, 342, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_Unsupported_element_type, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(9, 342, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 342, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(9, 342, __pyx_L1_error)
    break;
  }

  /* "src/lxml/readonlytree.pxi":343
 *     else:
 *         raise TypeError(f"Unsupported element type: {c_node.type}")
 *     el._c_node = c_node             # <<<<<<<<<<<<<<
 *     _initReadOnlyProxy(el, source_proxy)
 *     return el
*/
  __pyx_v_el->_c_node = __pyx_v_c_node;

  /* "src/lxml/readonlytree.pxi":344
 *         raise TypeError(f"Unsupported element type: {c_node.type}")
 *     el._c_node = c_node
 *     _initReadOnlyProxy(el, source_proxy)             # <<<<<<<<<<<<<<
 *     return el
 * 
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__initReadOnlyProxy(__pyx_v_el, __pyx_v_source_proxy); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 344, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/readonlytree.pxi":345
 *     el._c_node = c_node
 *     _initReadOnlyProxy(el, source_proxy)
 *     return el             # <<<<<<<<<<<<<<
 * 
 * cdef inline _initReadOnlyProxy(_ReadOnlyProxy el,
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_el);
  __pyx_r = __pyx_v_el;
  goto __pyx_L0;

  /* "src/lxml/readonlytree.pxi":331
 *         return _collectAttributes(self._c_node, 3)
 * 
 * cdef _ReadOnlyProxy _newReadOnlyProxy(             # <<<<<<<<<<<<<<
 *     _ReadOnlyProxy source_proxy, xmlNode* c_node):
 *     cdef _ReadOnlyProxy el
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._newReadOnlyProxy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_el);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/readonlytree.pxi":347
 *     return el
 * 
 * cdef inline _initReadOnlyProxy(_ReadOnlyProxy el,             # <<<<<<<<<<<<<<
 *                                _ReadOnlyProxy source_proxy):
 *     if source_proxy is None:
*/

static CYTHON_INLINE PyObject *__pyx_f_4lxml_5etree__initReadOnlyProxy(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_el, struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_source_proxy) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_initReadOnlyProxy", 0);

  /* "src/lxml/readonlytree.pxi":349
 * cdef inline _initReadOnlyProxy(_ReadOnlyProxy el,
 *                                _ReadOnlyProxy source_proxy):
 *     if source_proxy is None:             # <<<<<<<<<<<<<<
 *         el._source_proxy = el
 *         el._dependent_proxies = [el]
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_source_proxy) == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/readonlytree.pxi":350
 *                                _ReadOnlyProxy source_proxy):
 *     if source_proxy is None:
 *         el._source_proxy = el             # <<<<<<<<<<<<<<
 *         el._dependent_proxies = [el]
 *     else:
*/
    __Pyx_INCREF((PyObject *)__pyx_v_el);
    __Pyx_GIVEREF((PyObject *)__pyx_v_el);
    __Pyx_GOTREF((PyObject *)__pyx_v_el->_source_proxy);
    __Pyx_DECREF((PyObject *)__pyx_v_el->_source_proxy);
    __pyx_v_el->_source_proxy = __pyx_v_el;

    /* "src/lxml/readonlytree.pxi":351
 *     if source_proxy is None:
 *         el._source_proxy = el
 *         el._dependent_proxies = [el]             # <<<<<<<<<<<<<<
 *     else:
 *         el._source_proxy = source_proxy
*/
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 351, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF((PyObject *)__pyx_v_el);
    __Pyx_GIVEREF((PyObject *)__pyx_v_el);
    if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_el)) != (0)) __PYX_ERR(9, 351, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_GOTREF(__pyx_v_el->_dependent_proxies);
    __Pyx_DECREF(__pyx_v_el->_dependent_proxies);
    __pyx_v_el->_dependent_proxies = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/readonlytree.pxi":349
 * cdef inline _initReadOnlyProxy(_ReadOnlyProxy el,
 *                                _ReadOnlyProxy source_proxy):
 *     if source_proxy is None:             # <<<<<<<<<<<<<<
 *         el._source_proxy = el
 *         el._dependent_proxies = [el]
*/
    goto __pyx_L3;
  }

  /* "src/lxml/readonlytree.pxi":353
 *         el._dependent_proxies = [el]
 *     else:
 *         el._source_proxy = source_proxy             # <<<<<<<<<<<<<<
 *         source_proxy._dependent_proxies.append(el)
 * 
*/
  /*else*/ {
    __Pyx_INCREF((PyObject *)__pyx_v_source_proxy);
    __Pyx_GIVEREF((PyObject *)__pyx_v_source_proxy);
    __Pyx_GOTREF((PyObject *)__pyx_v_el->_source_proxy);
    __Pyx_DECREF((PyObject *)__pyx_v_el->_source_proxy);
    __pyx_v_el->_source_proxy = __pyx_v_source_proxy;

    /* "src/lxml/readonlytree.pxi":354
 *     else:
 *         el._source_proxy = source_proxy
 *         source_proxy._dependent_proxies.append(el)             # <<<<<<<<<<<<<<
 * 
 * cdef _freeReadOnlyProxies(_ReadOnlyProxy sourceProxy):
*/
    if (unlikely(__pyx_v_source_proxy->_dependent_proxies == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
      __PYX_ERR(9, 354, __pyx_L1_error)
    }
    __pyx_t_3 = __Pyx_PyList_Append(__pyx_v_source_proxy->_dependent_proxies, ((PyObject *)__pyx_v_el)); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(9, 354, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "src/lxml/readonlytree.pxi":347
 *     return el
 * 
 * cdef inline _initReadOnlyProxy(_ReadOnlyProxy el,             # <<<<<<<<<<<<<<
 *                                _ReadOnlyProxy source_proxy):
 *     if source_proxy is None:
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._initReadOnlyProxy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/readonlytree.pxi":356
 *         source_proxy._dependent_proxies.append(el)
 * 
 * cdef _freeReadOnlyProxies(_ReadOnlyProxy sourceProxy):             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     cdef _ReadOnlyProxy el
*/

static PyObject *__pyx_f_4lxml_5etree__freeReadOnlyProxies(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_sourceProxy) {
  xmlNode *__pyx_v_c_node;
  struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_el = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  xmlNode *__pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_freeReadOnlyProxies", 0);

  /* "src/lxml/readonlytree.pxi":359
 *     cdef xmlNode* c_node
 *     cdef _ReadOnlyProxy el
 *     if sourceProxy is None:             # <<<<<<<<<<<<<<
 *         return
 *     if sourceProxy._dependent_proxies is None:
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_sourceProxy) == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/readonlytree.pxi":360
 *     cdef _ReadOnlyProxy el
 *     if sourceProxy is None:
 *         return             # <<<<<<<<<<<<<<
 *     if sourceProxy._dependent_proxies is None:
 *         return
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/readonlytree.pxi":359
 *     cdef xmlNode* c_node
 *     cdef _ReadOnlyProxy el
 *     if sourceProxy is None:             # <<<<<<<<<<<<<<
 *         return
 *     if sourceProxy._dependent_proxies is None:
*/
  }

  /* "src/lxml/readonlytree.pxi":361
 *     if sourceProxy is None:
 *         return
 *     if sourceProxy._dependent_proxies is None:             # <<<<<<<<<<<<<<
 *         return
 *     for el in sourceProxy._dependent_proxies:
*/
  __pyx_t_1 = (__pyx_v_sourceProxy->_dependent_proxies == ((PyObject*)Py_None));
  if (__pyx_t_1) {

    /* "src/lxml/readonlytree.pxi":362
 *         return
 *     if sourceProxy._dependent_proxies is None:
 *         return             # <<<<<<<<<<<<<<
 *     for el in sourceProxy._dependent_proxies:
 *         c_node = el._c_node
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/readonlytree.pxi":361
 *     if sourceProxy is None:
 *         return
 *     if sourceProxy._dependent_proxies is None:             # <<<<<<<<<<<<<<
 *         return
 *     for el in sourceProxy._dependent_proxies:
*/
  }

  /* "src/lxml/readonlytree.pxi":363
 *     if sourceProxy._dependent_proxies is None:
 *         return
 *     for el in sourceProxy._dependent_proxies:             # <<<<<<<<<<<<<<
 *         c_node = el._c_node
 *         el._c_node = NULL
*/
  if (unlikely(__pyx_v_sourceProxy->_dependent_proxies == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(9, 363, __pyx_L1_error)
  }
  __pyx_t_2 = __pyx_v_sourceProxy->_dependent_proxies; __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  for (;;) {
    {
      Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
      #if !CYTHON_ASSUME_SAFE_SIZE
      if (unlikely((__pyx_temp < 0))) __PYX_ERR(9, 363, __pyx_L1_error)
      #endif
      if (__pyx_t_3 >= __pyx_temp) break;
    }
    __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_3, __Pyx_ReferenceSharing_OwnStrongReference);
    ++__pyx_t_3;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(9, 363, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ReadOnlyProxy))))) __PYX_ERR(9, 363, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_el, ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "src/lxml/readonlytree.pxi":364
 *         return
 *     for el in sourceProxy._dependent_proxies:
 *         c_node = el._c_node             # <<<<<<<<<<<<<<
 *         el._c_node = NULL
 *         if el._free_after_use:
*/
    __pyx_t_5 = __pyx_v_el->_c_node;
    __pyx_v_c_node = __pyx_t_5;

    /* "src/lxml/readonlytree.pxi":365
 *     for el in sourceProxy._dependent_proxies:
 *         c_node = el._c_node
 *         el._c_node = NULL             # <<<<<<<<<<<<<<
 *         if el._free_after_use:
 *             tree.xmlFreeNode(c_node)
*/
    __pyx_v_el->_c_node = NULL;

    /* "src/lxml/readonlytree.pxi":366
 *         c_node = el._c_node
 *         el._c_node = NULL
 *         if el._free_after_use:             # <<<<<<<<<<<<<<
 *             tree.xmlFreeNode(c_node)
 *     del sourceProxy._dependent_proxies[:]
*/
    if (__pyx_v_el->_free_after_use) {

      /* "src/lxml/readonlytree.pxi":367
 *         el._c_node = NULL
 *         if el._free_after_use:
 *             tree.xmlFreeNode(c_node)             # <<<<<<<<<<<<<<
 *     del sourceProxy._dependent_proxies[:]
 * 
*/
      xmlFreeNode(__pyx_v_c_node);

      /* "src/lxml/readonlytree.pxi":366
 *         c_node = el._c_node
 *         el._c_node = NULL
 *         if el._free_after_use:             # <<<<<<<<<<<<<<
 *             tree.xmlFreeNode(c_node)
 *     del sourceProxy._dependent_proxies[:]
*/
    }

    /* "src/lxml/readonlytree.pxi":363
 *     if sourceProxy._dependent_proxies is None:
 *         return
 *     for el in sourceProxy._dependent_proxies:             # <<<<<<<<<<<<<<
 *         c_node = el._c_node
 *         el._c_node = NULL
*/
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/readonlytree.pxi":368
 *         if el._free_after_use:
 *             tree.xmlFreeNode(c_node)
 *     del sourceProxy._dependent_proxies[:]             # <<<<<<<<<<<<<<
 * 
 * # opaque wrapper around non-element nodes, e.g. the document node
*/
  if (unlikely(__pyx_v_sourceProxy->_dependent_proxies == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(9, 368, __pyx_L1_error)
  }
  if (__Pyx_PyObject_DelSlice(__pyx_v_sourceProxy->_dependent_proxies, 0, 0, NULL, NULL, NULL, 0, 0, 1) < (0)) __PYX_ERR(9, 368, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":356
 *         source_proxy._dependent_proxies.append(el)
 * 
 * cdef _freeReadOnlyProxies(_ReadOnlyProxy sourceProxy):             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     cdef _ReadOnlyProxy el
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._freeReadOnlyProxies", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_el);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/readonlytree.pxi":378
 * cdef class _OpaqueNodeWrapper:
 *     cdef tree.xmlNode* _c_node
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         raise TypeError, "This type cannot be instantiated from Python"
 * 
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_18_OpaqueNodeWrapper_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_18_OpaqueNodeWrapper_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, __pyx_nargs); return -1; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return -1;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__init__", __pyx_kwds); return -1;}
  __pyx_r = __pyx_pf_4lxml_5etree_18_OpaqueNodeWrapper___init__(((struct __pyx_obj_4lxml_5etree__OpaqueNodeWrapper *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_18_OpaqueNodeWrapper___init__(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__OpaqueNodeWrapper *__pyx_v_self) {
  int __pyx_r;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/readonlytree.pxi":379
 *     cdef tree.xmlNode* _c_node
 *     def __init__(self):
 *         raise TypeError, "This type cannot be instantiated from Python"             # <<<<<<<<<<<<<<
 * 
 * @cython.final
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_This_type_cannot_be_instantiated, 0, 0);
  __PYX_ERR(9, 379, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":378
 * cdef class _OpaqueNodeWrapper:
 *     cdef tree.xmlNode* _c_node
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         raise TypeError, "This type cannot be instantiated from Python"
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._OpaqueNodeWrapper.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  return __pyx_r;
}

/* "src/lxml/readonlytree.pxi":384
 * @cython.internal
 * cdef class _OpaqueDocumentWrapper(_OpaqueNodeWrapper):
 *     cdef int _assertNode(self) except -1:             # <<<<<<<<<<<<<<
 *         """This is our way of saying: this proxy is invalid!
 *         """
*/

static int __pyx_f_4lxml_5etree_22_OpaqueDocumentWrapper__assertNode(struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper *__pyx_v_self) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/readonlytree.pxi":387
 *         """This is our way of saying: this proxy is invalid!
 *         """
 *         assert self._c_node is not NULL, "Proxy invalidated!"             # <<<<<<<<<<<<<<
 *         return 0
 * 
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = (__pyx_v_self->__pyx_base._c_node != NULL);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_mstate_global->__pyx_kp_u_Proxy_invalidated, 0, 0);
      __PYX_ERR(9, 387, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(9, 387, __pyx_L1_error)
  #endif

  /* "src/lxml/readonlytree.pxi":388
 *         """
 *         assert self._c_node is not NULL, "Proxy invalidated!"
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     cpdef append(self, other_element):
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/readonlytree.pxi":384
 * @cython.internal
 * cdef class _OpaqueDocumentWrapper(_OpaqueNodeWrapper):
 *     cdef int _assertNode(self) except -1:             # <<<<<<<<<<<<<<
 *         """This is our way of saying: this proxy is invalid!
 *         """
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._OpaqueDocumentWrapper._assertNode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/readonlytree.pxi":390
 *         return 0
 * 
 *     cpdef append(self, other_element):             # <<<<<<<<<<<<<<
 *         """Append a copy of an Element to the list of children.
 *         """
*/

static PyObject *__pyx_pw_4lxml_5etree_22_OpaqueDocumentWrapper_1append(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_4lxml_5etree_22_OpaqueDocumentWrapper_append(struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper *__pyx_v_self, PyObject *__pyx_v_other_element, CYTHON_UNUSED int __pyx_skip_dispatch) {
  xmlNode *__pyx_v_c_next;
  xmlNode *__pyx_v_c_node;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  xmlNode *__pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("append", 0);

  /* "src/lxml/readonlytree.pxi":395
 *         cdef xmlNode* c_next
 *         cdef xmlNode* c_node
 *         self._assertNode()             # <<<<<<<<<<<<<<
 *         c_node = _roNodeOf(other_element)
 *         if c_node.type == tree.XML_ELEMENT_NODE:
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_22_OpaqueDocumentWrapper__assertNode(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(9, 395, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":396
 *         cdef xmlNode* c_node
 *         self._assertNode()
 *         c_node = _roNodeOf(other_element)             # <<<<<<<<<<<<<<
 *         if c_node.type == tree.XML_ELEMENT_NODE:
 *             if tree.xmlDocGetRootElement(<tree.xmlDoc*>self._c_node) is not NULL:
*/
  __pyx_t_2 = __pyx_f_4lxml_5etree__roNodeOf(__pyx_v_other_element); if (unlikely(__pyx_t_2 == ((void *)NULL))) __PYX_ERR(9, 396, __pyx_L1_error)
  __pyx_v_c_node = __pyx_t_2;

  /* "src/lxml/readonlytree.pxi":397
 *         self._assertNode()
 *         c_node = _roNodeOf(other_element)
 *         if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *             if tree.xmlDocGetRootElement(<tree.xmlDoc*>self._c_node) is not NULL:
 *                 raise ValueError, "cannot append, document already has a root element"
*/
  __pyx_t_3 = (__pyx_v_c_node->type == XML_ELEMENT_NODE);
  if (__pyx_t_3) {

    /* "src/lxml/readonlytree.pxi":398
 *         c_node = _roNodeOf(other_element)
 *         if c_node.type == tree.XML_ELEMENT_NODE:
 *             if tree.xmlDocGetRootElement(<tree.xmlDoc*>self._c_node) is not NULL:             # <<<<<<<<<<<<<<
 *                 raise ValueError, "cannot append, document already has a root element"
 *         elif c_node.type not in (tree.XML_PI_NODE, tree.XML_COMMENT_NODE):
*/
    __pyx_t_3 = (xmlDocGetRootElement(((xmlDoc *)__pyx_v_self->__pyx_base._c_node)) != NULL);
    if (unlikely(__pyx_t_3)) {

      /* "src/lxml/readonlytree.pxi":399
 *         if c_node.type == tree.XML_ELEMENT_NODE:
 *             if tree.xmlDocGetRootElement(<tree.xmlDoc*>self._c_node) is not NULL:
 *                 raise ValueError, "cannot append, document already has a root element"             # <<<<<<<<<<<<<<
 *         elif c_node.type not in (tree.XML_PI_NODE, tree.XML_COMMENT_NODE):
 *             raise TypeError, f"unsupported element type for top-level node: {c_node.type}"
*/
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_cannot_append_document_already_h, 0, 0);
      __PYX_ERR(9, 399, __pyx_L1_error)

      /* "src/lxml/readonlytree.pxi":398
 *         c_node = _roNodeOf(other_element)
 *         if c_node.type == tree.XML_ELEMENT_NODE:
 *             if tree.xmlDocGetRootElement(<tree.xmlDoc*>self._c_node) is not NULL:             # <<<<<<<<<<<<<<
 *                 raise ValueError, "cannot append, document already has a root element"
 *         elif c_node.type not in (tree.XML_PI_NODE, tree.XML_COMMENT_NODE):
*/
    }

    /* "src/lxml/readonlytree.pxi":397
 *         self._assertNode()
 *         c_node = _roNodeOf(other_element)
 *         if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *             if tree.xmlDocGetRootElement(<tree.xmlDoc*>self._c_node) is not NULL:
 *                 raise ValueError, "cannot append, document already has a root element"
*/
    goto __pyx_L3;
  }

  /* "src/lxml/readonlytree.pxi":400
 *             if tree.xmlDocGetRootElement(<tree.xmlDoc*>self._c_node) is not NULL:
 *                 raise ValueError, "cannot append, document already has a root element"
 *         elif c_node.type not in (tree.XML_PI_NODE, tree.XML_COMMENT_NODE):             # <<<<<<<<<<<<<<
 *             raise TypeError, f"unsupported element type for top-level node: {c_node.type}"
 *         c_node = _copyNodeToDoc(c_node, <tree.xmlDoc*>self._c_node)
*/
  switch (__pyx_v_c_node->type) {
    case XML_PI_NODE:
    case XML_COMMENT_NODE:
    __pyx_t_3 = 0;
    break;
    default:
    __pyx_t_3 = 1;
    break;
  }
  __pyx_t_4 = __pyx_t_3;
  if (unlikely(__pyx_t_4)) {

    /* "src/lxml/readonlytree.pxi":401
 *                 raise ValueError, "cannot append, document already has a root element"
 *         elif c_node.type not in (tree.XML_PI_NODE, tree.XML_COMMENT_NODE):
 *             raise TypeError, f"unsupported element type for top-level node: {c_node.type}"             # <<<<<<<<<<<<<<
 *         c_node = _copyNodeToDoc(c_node, <tree.xmlDoc*>self._c_node)
 *         c_next = c_node.next
*/
    __pyx_t_5 = __Pyx_PyUnicode_From_xmlElementType(__pyx_v_c_node->type, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(9, 401, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_unsupported_element_type_for_top, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(9, 401, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_t_6, 0, 0);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __PYX_ERR(9, 401, __pyx_L1_error)

    /* "src/lxml/readonlytree.pxi":400
 *             if tree.xmlDocGetRootElement(<tree.xmlDoc*>self._c_node) is not NULL:
 *                 raise ValueError, "cannot append, document already has a root element"
 *         elif c_node.type not in (tree.XML_PI_NODE, tree.XML_COMMENT_NODE):             # <<<<<<<<<<<<<<
 *             raise TypeError, f"unsupported element type for top-level node: {c_node.type}"
 *         c_node = _copyNodeToDoc(c_node, <tree.xmlDoc*>self._c_node)
*/
  }
  __pyx_L3:;

  /* "src/lxml/readonlytree.pxi":402
 *         elif c_node.type not in (tree.XML_PI_NODE, tree.XML_COMMENT_NODE):
 *             raise TypeError, f"unsupported element type for top-level node: {c_node.type}"
 *         c_node = _copyNodeToDoc(c_node, <tree.xmlDoc*>self._c_node)             # <<<<<<<<<<<<<<
 *         c_next = c_node.next
 *         tree.xmlAddChild(self._c_node, c_node)
*/
  __pyx_t_2 = __pyx_f_4lxml_5etree__copyNodeToDoc(__pyx_v_c_node, ((xmlDoc *)__pyx_v_self->__pyx_base._c_node)); if (unlikely(__pyx_t_2 == ((void *)NULL))) __PYX_ERR(9, 402, __pyx_L1_error)
  __pyx_v_c_node = __pyx_t_2;

  /* "src/lxml/readonlytree.pxi":403
 *             raise TypeError, f"unsupported element type for top-level node: {c_node.type}"
 *         c_node = _copyNodeToDoc(c_node, <tree.xmlDoc*>self._c_node)
 *         c_next = c_node.next             # <<<<<<<<<<<<<<
 *         tree.xmlAddChild(self._c_node, c_node)
 *         _moveTail(c_next, c_node)
*/
  __pyx_t_2 = __pyx_v_c_node->next;
  __pyx_v_c_next = __pyx_t_2;

  /* "src/lxml/readonlytree.pxi":404
 *         c_node = _copyNodeToDoc(c_node, <tree.xmlDoc*>self._c_node)
 *         c_next = c_node.next
 *         tree.xmlAddChild(self._c_node, c_node)             # <<<<<<<<<<<<<<
 *         _moveTail(c_next, c_node)
 * 
*/
  (void)(xmlAddChild(__pyx_v_self->__pyx_base._c_node, __pyx_v_c_node));

  /* "src/lxml/readonlytree.pxi":405
 *         c_next = c_node.next
 *         tree.xmlAddChild(self._c_node, c_node)
 *         _moveTail(c_next, c_node)             # <<<<<<<<<<<<<<
 * 
 *     def extend(self, elements):
*/
  __pyx_f_4lxml_5etree__moveTail(__pyx_v_c_next, __pyx_v_c_node);

  /* "src/lxml/readonlytree.pxi":390
 *         return 0
 * 
 *     cpdef append(self, other_element):             # <<<<<<<<<<<<<<
 *         """Append a copy of an Element to the list of children.
 *         """
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._OpaqueDocumentWrapper.append", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_22_OpaqueDocumentWrapper_1append(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_22_OpaqueDocumentWrapper_append, "Append a copy of an Element to the list of children.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_22_OpaqueDocumentWrapper_1append = {"append", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_22_OpaqueDocumentWrapper_1append, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_22_OpaqueDocumentWrapper_append};
static PyObject *__pyx_pw_4lxml_5etree_22_OpaqueDocumentWrapper_1append(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_other_element = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("append (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_other_element,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(9, 390, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(9, 390, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "append", 0) < (0)) __PYX_ERR(9, 390, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("append", 1, 1, 1, i); __PYX_ERR(9, 390, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(9, 390, __pyx_L3_error)
    }
    __pyx_v_other_element = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("append", 1, 1, 1, __pyx_nargs); __PYX_ERR(9, 390, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._OpaqueDocumentWrapper.append", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_22_OpaqueDocumentWrapper_append(((struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper *)__pyx_v_self), __pyx_v_other_element);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_22_OpaqueDocumentWrapper_append(struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper *__pyx_v_self, PyObject *__pyx_v_other_element) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("append", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree_22_OpaqueDocumentWrapper_append(__pyx_v_self, __pyx_v_other_element, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 390, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._OpaqueDocumentWrapper.append", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/readonlytree.pxi":407
 *         _moveTail(c_next, c_node)
 * 
 *     def extend(self, elements):             # <<<<<<<<<<<<<<
 *         """Append a copy of all Elements from a sequence to the list of
 *         children.
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_22_OpaqueDocumentWrapper_3extend(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_22_OpaqueDocumentWrapper_2extend, "Append a copy of all Elements from a sequence to the list of\n        children.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_22_OpaqueDocumentWrapper_3extend = {"extend", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_22_OpaqueDocumentWrapper_3extend, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_22_OpaqueDocumentWrapper_2extend};
static PyObject *__pyx_pw_4lxml_5etree_22_OpaqueDocumentWrapper_3extend(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_elements = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("extend (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_elements,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(9, 407, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(9, 407, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "extend", 0) < (0)) __PYX_ERR(9, 407, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("extend", 1, 1, 1, i); __PYX_ERR(9, 407, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(9, 407, __pyx_L3_error)
    }
    __pyx_v_elements = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("extend", 1, 1, 1, __pyx_nargs); __PYX_ERR(9, 407, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._OpaqueDocumentWrapper.extend", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_22_OpaqueDocumentWrapper_2extend(((struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper *)__pyx_v_self), __pyx_v_elements);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_22_OpaqueDocumentWrapper_2extend(struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper *__pyx_v_self, PyObject *__pyx_v_elements) {
  PyObject *__pyx_v_element = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("extend", 0);

  /* "src/lxml/readonlytree.pxi":411
 *         children.
 *         """
 *         self._assertNode()             # <<<<<<<<<<<<<<
 *         for element in elements:
 *             self.append(element)
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_22_OpaqueDocumentWrapper__assertNode(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(9, 411, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":412
 *         """
 *         self._assertNode()
 *         for element in elements:             # <<<<<<<<<<<<<<
 *             self.append(element)
 * 
*/
  if (likely(PyList_CheckExact(__pyx_v_elements)) || PyTuple_CheckExact(__pyx_v_elements)) {
    __pyx_t_2 = __pyx_v_elements; __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_elements); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 412, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(9, 412, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(9, 412, __pyx_L1_error)
          #endif
          if (__pyx_t_3 >= __pyx_temp) break;
        }
        __pyx_t_5 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_3, __Pyx_ReferenceSharing_OwnStrongReference);
        ++__pyx_t_3;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(9, 412, __pyx_L1_error)
          #endif
          if (__pyx_t_3 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3));
        #else
        __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3);
        #endif
        ++__pyx_t_3;
      }
      if (unlikely(!__pyx_t_5)) __PYX_ERR(9, 412, __pyx_L1_error)
    } else {
      __pyx_t_5 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_5)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(9, 412, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_XDECREF_SET(__pyx_v_element, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "src/lxml/readonlytree.pxi":413
 *         self._assertNode()
 *         for element in elements:
 *             self.append(element)             # <<<<<<<<<<<<<<
 * 
 * cdef _OpaqueNodeWrapper _newOpaqueAppendOnlyNodeWrapper(xmlNode* c_node):
*/
    __pyx_t_5 = __pyx_f_4lxml_5etree_22_OpaqueDocumentWrapper_append(__pyx_v_self, __pyx_v_element, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(9, 413, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "src/lxml/readonlytree.pxi":412
 *         """
 *         self._assertNode()
 *         for element in elements:             # <<<<<<<<<<<<<<
 *             self.append(element)
 * 
*/
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/readonlytree.pxi":407
 *         _moveTail(c_next, c_node)
 * 
 *     def extend(self, elements):             # <<<<<<<<<<<<<<
 *         """Append a copy of all Elements from a sequence to the list of
 *         children.
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._OpaqueDocumentWrapper.extend", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_element);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/readonlytree.pxi":415
 *             self.append(element)
 * 
 * cdef _OpaqueNodeWrapper _newOpaqueAppendOnlyNodeWrapper(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     cdef _OpaqueNodeWrapper node
 *     if c_node.type in (tree.XML_DOCUMENT_NODE, tree.XML_HTML_DOCUMENT_NODE):
*/

static struct __pyx_obj_4lxml_5etree__OpaqueNodeWrapper *__pyx_f_4lxml_5etree__newOpaqueAppendOnlyNodeWrapper(xmlNode *__pyx_v_c_node) {
  struct __pyx_obj_4lxml_5etree__OpaqueNodeWrapper *__pyx_v_node = 0;
  struct __pyx_obj_4lxml_5etree__OpaqueNodeWrapper *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_newOpaqueAppendOnlyNodeWrapper", 0);

  /* "src/lxml/readonlytree.pxi":417
 * cdef _OpaqueNodeWrapper _newOpaqueAppendOnlyNodeWrapper(xmlNode* c_node):
 *     cdef _OpaqueNodeWrapper node
 *     if c_node.type in (tree.XML_DOCUMENT_NODE, tree.XML_HTML_DOCUMENT_NODE):             # <<<<<<<<<<<<<<
 *         node = _OpaqueDocumentWrapper.__new__(_OpaqueDocumentWrapper)
 *     else:
*/
  switch (__pyx_v_c_node->type) {
    case XML_DOCUMENT_NODE:
    case XML_HTML_DOCUMENT_NODE:

    /* "src/lxml/readonlytree.pxi":418
 *     cdef _OpaqueNodeWrapper node
 *     if c_node.type in (tree.XML_DOCUMENT_NODE, tree.XML_HTML_DOCUMENT_NODE):
 *         node = _OpaqueDocumentWrapper.__new__(_OpaqueDocumentWrapper)             # <<<<<<<<<<<<<<
 *     else:
 *         node = _OpaqueNodeWrapper.__new__(_OpaqueNodeWrapper)
*/
    __pyx_t_1 = ((PyObject *)__pyx_tp_new_4lxml_5etree__OpaqueDocumentWrapper(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__OpaqueDocumentWrapper), __pyx_mstate_global->__pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 418, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
    if (!(likely(__Pyx_TypeTest(((PyObject *)__pyx_t_1), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__OpaqueNodeWrapper)))) __PYX_ERR(9, 418, __pyx_L1_error)
    __pyx_v_node = ((struct __pyx_obj_4lxml_5etree__OpaqueNodeWrapper *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/readonlytree.pxi":417
 * cdef _OpaqueNodeWrapper _newOpaqueAppendOnlyNodeWrapper(xmlNode* c_node):
 *     cdef _OpaqueNodeWrapper node
 *     if c_node.type in (tree.XML_DOCUMENT_NODE, tree.XML_HTML_DOCUMENT_NODE):             # <<<<<<<<<<<<<<
 *         node = _OpaqueDocumentWrapper.__new__(_OpaqueDocumentWrapper)
 *     else:
*/
    break;
    default:

    /* "src/lxml/readonlytree.pxi":420
 *         node = _OpaqueDocumentWrapper.__new__(_OpaqueDocumentWrapper)
 *     else:
 *         node = _OpaqueNodeWrapper.__new__(_OpaqueNodeWrapper)             # <<<<<<<<<<<<<<
 *     node._c_node = c_node
 *     return node
*/
    __pyx_t_1 = ((PyObject *)__pyx_tp_new_4lxml_5etree__OpaqueNodeWrapper(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__OpaqueNodeWrapper), __pyx_mstate_global->__pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 420, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
    __pyx_v_node = ((struct __pyx_obj_4lxml_5etree__OpaqueNodeWrapper *)__pyx_t_1);
    __pyx_t_1 = 0;
    break;
  }

  /* "src/lxml/readonlytree.pxi":421
 *     else:
 *         node = _OpaqueNodeWrapper.__new__(_OpaqueNodeWrapper)
 *     node._c_node = c_node             # <<<<<<<<<<<<<<
 *     return node
 * 
*/
  __pyx_v_node->_c_node = __pyx_v_c_node;

  /* "src/lxml/readonlytree.pxi":422
 *         node = _OpaqueNodeWrapper.__new__(_OpaqueNodeWrapper)
 *     node._c_node = c_node
 *     return node             # <<<<<<<<<<<<<<
 * 
 * # element proxies that allow restricted modification
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_node);
  __pyx_r = __pyx_v_node;
  goto __pyx_L0;

  /* "src/lxml/readonlytree.pxi":415
 *             self.append(element)
 * 
 * cdef _OpaqueNodeWrapper _newOpaqueAppendOnlyNodeWrapper(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     cdef _OpaqueNodeWrapper node
 *     if c_node.type in (tree.XML_DOCUMENT_NODE, tree.XML_HTML_DOCUMENT_NODE):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._newOpaqueAppendOnlyNodeWrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_node);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/readonlytree.pxi":431
 *     """
 *     property text:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self._assertNode()
 *             if self._c_node.content is NULL:
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_23_ModifyContentOnlyProxy_4text_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_23_ModifyContentOnlyProxy_4text_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_23_ModifyContentOnlyProxy_4text___get__(((struct __pyx_obj_4lxml_5etree__ModifyContentOnlyProxy *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_23_ModifyContentOnlyProxy_4text___get__(struct __pyx_obj_4lxml_5etree__ModifyContentOnlyProxy *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "src/lxml/readonlytree.pxi":432
 *     property text:
 *         def __get__(self):
 *             self._assertNode()             # <<<<<<<<<<<<<<
 *             if self._c_node.content is NULL:
 *                 return ''
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ModifyContentOnlyProxy *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(9, 432, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":433
 *         def __get__(self):
 *             self._assertNode()
 *             if self._c_node.content is NULL:             # <<<<<<<<<<<<<<
 *                 return ''
 *             else:
*/
  __pyx_t_2 = (__pyx_v_self->__pyx_base._c_node->content == NULL);
  if (__pyx_t_2) {

    /* "src/lxml/readonlytree.pxi":434
 *             self._assertNode()
 *             if self._c_node.content is NULL:
 *                 return ''             # <<<<<<<<<<<<<<
 *             else:
 *                 return funicode(self._c_node.content)
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u__8);
    __pyx_r = __pyx_mstate_global->__pyx_kp_u__8;
    goto __pyx_L0;

    /* "src/lxml/readonlytree.pxi":433
 *         def __get__(self):
 *             self._assertNode()
 *             if self._c_node.content is NULL:             # <<<<<<<<<<<<<<
 *                 return ''
 *             else:
*/
  }

  /* "src/lxml/readonlytree.pxi":436
 *                 return ''
 *             else:
 *                 return funicode(self._c_node.content)             # <<<<<<<<<<<<<<
 * 
 *         def __set__(self, value):
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_self->__pyx_base._c_node->content); if (unlikely(!__pyx_t_3)) __PYX_ERR(9, 436, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "src/lxml/readonlytree.pxi":431
 *     """
 *     property text:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self._assertNode()
 *             if self._c_node.content is NULL:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._ModifyContentOnlyProxy.text.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/readonlytree.pxi":438
 *                 return funicode(self._c_node.content)
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             cdef tree.xmlDict* c_dict
 *             self._assertNode()
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_23_ModifyContentOnlyProxy_4text_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_4lxml_5etree_23_ModifyContentOnlyProxy_4text_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_23_ModifyContentOnlyProxy_4text_2__set__(((struct __pyx_obj_4lxml_5etree__ModifyContentOnlyProxy *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_23_ModifyContentOnlyProxy_4text_2__set__(struct __pyx_obj_4lxml_5etree__ModifyContentOnlyProxy *__pyx_v_self, PyObject *__pyx_v_value) {
  const xmlChar *__pyx_v_c_text;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);

  /* "src/lxml/readonlytree.pxi":440
 *         def __set__(self, value):
 *             cdef tree.xmlDict* c_dict
 *             self._assertNode()             # <<<<<<<<<<<<<<
 *             if value is None:
 *                 c_text = <const_xmlChar*>NULL
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ModifyContentOnlyProxy *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(9, 440, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":441
 *             cdef tree.xmlDict* c_dict
 *             self._assertNode()
 *             if value is None:             # <<<<<<<<<<<<<<
 *                 c_text = <const_xmlChar*>NULL
 *             else:
*/
  __pyx_t_2 = (__pyx_v_value == Py_None);
  if (__pyx_t_2) {

    /* "src/lxml/readonlytree.pxi":442
 *             self._assertNode()
 *             if value is None:
 *                 c_text = <const_xmlChar*>NULL             # <<<<<<<<<<<<<<
 *             else:
 *                 value = _utf8(value)
*/
    __pyx_v_c_text = ((const xmlChar *)NULL);

    /* "src/lxml/readonlytree.pxi":441
 *             cdef tree.xmlDict* c_dict
 *             self._assertNode()
 *             if value is None:             # <<<<<<<<<<<<<<
 *                 c_text = <const_xmlChar*>NULL
 *             else:
*/
    goto __pyx_L3;
  }

  /* "src/lxml/readonlytree.pxi":444
 *                 c_text = <const_xmlChar*>NULL
 *             else:
 *                 value = _utf8(value)             # <<<<<<<<<<<<<<
 *                 c_text = _xcstr(value)
 *             tree.xmlNodeSetContent(self._c_node, c_text)
*/
  /*else*/ {
    __pyx_t_3 = __pyx_f_4lxml_5etree__utf8(__pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(9, 444, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/readonlytree.pxi":445
 *             else:
 *                 value = _utf8(value)
 *                 c_text = _xcstr(value)             # <<<<<<<<<<<<<<
 *             tree.xmlNodeSetContent(self._c_node, c_text)
 * 
*/
    __pyx_v_c_text = (const xmlChar*)PyBytes_AS_STRING(__pyx_v_value);
  }
  __pyx_L3:;

  /* "src/lxml/readonlytree.pxi":446
 *                 value = _utf8(value)
 *                 c_text = _xcstr(value)
 *             tree.xmlNodeSetContent(self._c_node, c_text)             # <<<<<<<<<<<<<<
 * 
 * @cython.final
*/
  xmlNodeSetContent(__pyx_v_self->__pyx_base._c_node, __pyx_v_c_text);

  /* "src/lxml/readonlytree.pxi":438
 *                 return funicode(self._c_node.content)
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             cdef tree.xmlDict* c_dict
 *             self._assertNode()
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._ModifyContentOnlyProxy.text.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/readonlytree.pxi":455
 *     """
 *     property target:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self._assertNode()
 *             return funicode(self._c_node.name)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_25_ModifyContentOnlyPIProxy_6target_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_25_ModifyContentOnlyPIProxy_6target_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_25_ModifyContentOnlyPIProxy_6target___get__(((struct __pyx_obj_4lxml_5etree__ModifyContentOnlyPIProxy *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_25_ModifyContentOnlyPIProxy_6target___get__(struct __pyx_obj_4lxml_5etree__ModifyContentOnlyPIProxy *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "src/lxml/readonlytree.pxi":456
 *     property target:
 *         def __get__(self):
 *             self._assertNode()             # <<<<<<<<<<<<<<
 *             return funicode(self._c_node.name)
 * 
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ModifyContentOnlyPIProxy *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(9, 456, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":457
 *         def __get__(self):
 *             self._assertNode()
 *             return funicode(self._c_node.name)             # <<<<<<<<<<<<<<
 * 
 *         def __set__(self, value):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_self->__pyx_base.__pyx_base._c_node->name); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 457, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/readonlytree.pxi":455
 *     """
 *     property target:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self._assertNode()
 *             return funicode(self._c_node.name)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ModifyContentOnlyPIProxy.target.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/readonlytree.pxi":459
 *             return funicode(self._c_node.name)
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self._assertNode()
 *             value = _utf8(value)
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_25_ModifyContentOnlyPIProxy_6target_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_4lxml_5etree_25_ModifyContentOnlyPIProxy_6target_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_25_ModifyContentOnlyPIProxy_6target_2__set__(((struct __pyx_obj_4lxml_5etree__ModifyContentOnlyPIProxy *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_25_ModifyContentOnlyPIProxy_6target_2__set__(struct __pyx_obj_4lxml_5etree__ModifyContentOnlyPIProxy *__pyx_v_self, PyObject *__pyx_v_value) {
  const xmlChar *__pyx_v_c_text;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);

  /* "src/lxml/readonlytree.pxi":460
 * 
 *         def __set__(self, value):
 *             self._assertNode()             # <<<<<<<<<<<<<<
 *             value = _utf8(value)
 *             c_text = _xcstr(value)
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ModifyContentOnlyPIProxy *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(9, 460, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":461
 *         def __set__(self, value):
 *             self._assertNode()
 *             value = _utf8(value)             # <<<<<<<<<<<<<<
 *             c_text = _xcstr(value)
 *             tree.xmlNodeSetName(self._c_node, c_text)
*/
  __pyx_t_2 = __pyx_f_4lxml_5etree__utf8(__pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 461, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/readonlytree.pxi":462
 *             self._assertNode()
 *             value = _utf8(value)
 *             c_text = _xcstr(value)             # <<<<<<<<<<<<<<
 *             tree.xmlNodeSetName(self._c_node, c_text)
 * 
*/
  __pyx_v_c_text = (const xmlChar*)PyBytes_AS_STRING(__pyx_v_value);

  /* "src/lxml/readonlytree.pxi":463
 *             value = _utf8(value)
 *             c_text = _xcstr(value)
 *             tree.xmlNodeSetName(self._c_node, c_text)             # <<<<<<<<<<<<<<
 * 
 * @cython.final
*/
  xmlNodeSetName(__pyx_v_self->__pyx_base.__pyx_base._c_node, __pyx_v_c_text);

  /* "src/lxml/readonlytree.pxi":459
 *             return funicode(self._c_node.name)
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self._assertNode()
 *             value = _utf8(value)
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ModifyContentOnlyPIProxy.target.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/readonlytree.pxi":470
 *     "A read-only proxy for entity references (for internal use only!)"
 *     property name:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return funicode(self._c_node.name)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_29_ModifyContentOnlyEntityProxy_4name_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_29_ModifyContentOnlyEntityProxy_4name_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_29_ModifyContentOnlyEntityProxy_4name___get__(((struct __pyx_obj_4lxml_5etree__ModifyContentOnlyEntityProxy *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_29_ModifyContentOnlyEntityProxy_4name___get__(struct __pyx_obj_4lxml_5etree__ModifyContentOnlyEntityProxy *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "src/lxml/readonlytree.pxi":471
 *     property name:
 *         def __get__(self):
 *             return funicode(self._c_node.name)             # <<<<<<<<<<<<<<
 * 
 *         def __set__(self, value):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree_funicode(__pyx_v_self->__pyx_base.__pyx_base._c_node->name); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 471, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/readonlytree.pxi":470
 *     "A read-only proxy for entity references (for internal use only!)"
 *     property name:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return funicode(self._c_node.name)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ModifyContentOnlyEntityProxy.name.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/readonlytree.pxi":473
 *             return funicode(self._c_node.name)
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             value = _utf8(value)
 *             assert '&' not in value and ';' not in value, \
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_29_ModifyContentOnlyEntityProxy_4name_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_4lxml_5etree_29_ModifyContentOnlyEntityProxy_4name_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_29_ModifyContentOnlyEntityProxy_4name_2__set__(((struct __pyx_obj_4lxml_5etree__ModifyContentOnlyEntityProxy *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_29_ModifyContentOnlyEntityProxy_4name_2__set__(struct __pyx_obj_4lxml_5etree__ModifyContentOnlyEntityProxy *__pyx_v_self, PyObject *__pyx_v_value) {
  const xmlChar *__pyx_v_c_text;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4[3];
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);

  /* "src/lxml/readonlytree.pxi":474
 * 
 *         def __set__(self, value):
 *             value = _utf8(value)             # <<<<<<<<<<<<<<
 *             assert '&' not in value and ';' not in value, \
 *                 f"Invalid entity name '{value}'"
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__utf8(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 474, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/readonlytree.pxi":475
 *         def __set__(self, value):
 *             value = _utf8(value)
 *             assert '&' not in value and ';' not in value, \             # <<<<<<<<<<<<<<
 *                 f"Invalid entity name '{value}'"
 *             c_text = _xcstr(value)
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_3 = (__Pyx_PySequence_ContainsTF(__pyx_mstate_global->__pyx_kp_u__19, __pyx_v_value, Py_NE)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(9, 475, __pyx_L1_error)
    if (__pyx_t_3) {
    } else {
      __pyx_t_2 = __pyx_t_3;
      goto __pyx_L3_bool_binop_done;
    }
    __pyx_t_3 = (__Pyx_PySequence_ContainsTF(__pyx_mstate_global->__pyx_kp_u__20, __pyx_v_value, Py_NE)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(9, 475, __pyx_L1_error)
    __pyx_t_2 = __pyx_t_3;
    __pyx_L3_bool_binop_done:;
    if (unlikely(!__pyx_t_2)) {

      /* "src/lxml/readonlytree.pxi":476
 *             value = _utf8(value)
 *             assert '&' not in value and ';' not in value, \
 *                 f"Invalid entity name '{value}'"             # <<<<<<<<<<<<<<
 *             c_text = _xcstr(value)
 *             tree.xmlNodeSetName(self._c_node, c_text)
*/
      __pyx_t_1 = __Pyx_PyObject_FormatSimple(__pyx_v_value, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 476, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u_Invalid_entity_name;
      __pyx_t_4[1] = __pyx_t_1;
      __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u__4;
      __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, 21 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1));
      if (unlikely(!__pyx_t_5)) __PYX_ERR(9, 476, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_t_5, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __PYX_ERR(9, 475, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(9, 475, __pyx_L1_error)
  #endif

  /* "src/lxml/readonlytree.pxi":477
 *             assert '&' not in value and ';' not in value, \
 *                 f"Invalid entity name '{value}'"
 *             c_text = _xcstr(value)             # <<<<<<<<<<<<<<
 *             tree.xmlNodeSetName(self._c_node, c_text)
 * 
*/
  __pyx_v_c_text = (const xmlChar*)PyBytes_AS_STRING(__pyx_v_value);

  /* "src/lxml/readonlytree.pxi":478
 *                 f"Invalid entity name '{value}'"
 *             c_text = _xcstr(value)
 *             tree.xmlNodeSetName(self._c_node, c_text)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  xmlNodeSetName(__pyx_v_self->__pyx_base.__pyx_base._c_node, __pyx_v_c_text);

  /* "src/lxml/readonlytree.pxi":473
 *             return funicode(self._c_node.name)
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             value = _utf8(value)
 *             assert '&' not in value and ';' not in value, \
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._ModifyContentOnlyEntityProxy.name.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/readonlytree.pxi":487
 *     text content (i.e. everything that adds to the subtree).
 *     """
 *     cpdef append(self, other_element):             # <<<<<<<<<<<<<<
 *         """Append a copy of an Element to the list of children.
 *         """
*/

static PyObject *__pyx_pw_4lxml_5etree_23_AppendOnlyElementProxy_1append(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_4lxml_5etree_23_AppendOnlyElementProxy_append(struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *__pyx_v_self, PyObject *__pyx_v_other_element, CYTHON_UNUSED int __pyx_skip_dispatch) {
  xmlNode *__pyx_v_c_next;
  xmlNode *__pyx_v_c_node;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  xmlNode *__pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("append", 0);

  /* "src/lxml/readonlytree.pxi":492
 *         cdef xmlNode* c_next
 *         cdef xmlNode* c_node
 *         self._assertNode()             # <<<<<<<<<<<<<<
 *         c_node = _roNodeOf(other_element)
 *         c_node = _copyNodeToDoc(c_node, self._c_node.doc)
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__AppendOnlyElementProxy *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(9, 492, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":493
 *         cdef xmlNode* c_node
 *         self._assertNode()
 *         c_node = _roNodeOf(other_element)             # <<<<<<<<<<<<<<
 *         c_node = _copyNodeToDoc(c_node, self._c_node.doc)
 *         c_next = c_node.next
*/
  __pyx_t_2 = __pyx_f_4lxml_5etree__roNodeOf(__pyx_v_other_element); if (unlikely(__pyx_t_2 == ((void *)NULL))) __PYX_ERR(9, 493, __pyx_L1_error)
  __pyx_v_c_node = __pyx_t_2;

  /* "src/lxml/readonlytree.pxi":494
 *         self._assertNode()
 *         c_node = _roNodeOf(other_element)
 *         c_node = _copyNodeToDoc(c_node, self._c_node.doc)             # <<<<<<<<<<<<<<
 *         c_next = c_node.next
 *         tree.xmlAddChild(self._c_node, c_node)
*/
  __pyx_t_2 = __pyx_f_4lxml_5etree__copyNodeToDoc(__pyx_v_c_node, __pyx_v_self->__pyx_base.__pyx_base._c_node->doc); if (unlikely(__pyx_t_2 == ((void *)NULL))) __PYX_ERR(9, 494, __pyx_L1_error)
  __pyx_v_c_node = __pyx_t_2;

  /* "src/lxml/readonlytree.pxi":495
 *         c_node = _roNodeOf(other_element)
 *         c_node = _copyNodeToDoc(c_node, self._c_node.doc)
 *         c_next = c_node.next             # <<<<<<<<<<<<<<
 *         tree.xmlAddChild(self._c_node, c_node)
 *         _moveTail(c_next, c_node)
*/
  __pyx_t_2 = __pyx_v_c_node->next;
  __pyx_v_c_next = __pyx_t_2;

  /* "src/lxml/readonlytree.pxi":496
 *         c_node = _copyNodeToDoc(c_node, self._c_node.doc)
 *         c_next = c_node.next
 *         tree.xmlAddChild(self._c_node, c_node)             # <<<<<<<<<<<<<<
 *         _moveTail(c_next, c_node)
 * 
*/
  (void)(xmlAddChild(__pyx_v_self->__pyx_base.__pyx_base._c_node, __pyx_v_c_node));

  /* "src/lxml/readonlytree.pxi":497
 *         c_next = c_node.next
 *         tree.xmlAddChild(self._c_node, c_node)
 *         _moveTail(c_next, c_node)             # <<<<<<<<<<<<<<
 * 
 *     def extend(self, elements):
*/
  __pyx_f_4lxml_5etree__moveTail(__pyx_v_c_next, __pyx_v_c_node);

  /* "src/lxml/readonlytree.pxi":487
 *     text content (i.e. everything that adds to the subtree).
 *     """
 *     cpdef append(self, other_element):             # <<<<<<<<<<<<<<
 *         """Append a copy of an Element to the list of children.
 *         """
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._AppendOnlyElementProxy.append", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_23_AppendOnlyElementProxy_1append(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_23_AppendOnlyElementProxy_append, "Append a copy of an Element to the list of children.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_23_AppendOnlyElementProxy_1append = {"append", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_23_AppendOnlyElementProxy_1append, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_23_AppendOnlyElementProxy_append};
static PyObject *__pyx_pw_4lxml_5etree_23_AppendOnlyElementProxy_1append(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_other_element = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("append (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_other_element,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(9, 487, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(9, 487, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "append", 0) < (0)) __PYX_ERR(9, 487, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("append", 1, 1, 1, i); __PYX_ERR(9, 487, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(9, 487, __pyx_L3_error)
    }
    __pyx_v_other_element = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("append", 1, 1, 1, __pyx_nargs); __PYX_ERR(9, 487, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._AppendOnlyElementProxy.append", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_23_AppendOnlyElementProxy_append(((struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *)__pyx_v_self), __pyx_v_other_element);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_23_AppendOnlyElementProxy_append(struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *__pyx_v_self, PyObject *__pyx_v_other_element) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("append", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree_23_AppendOnlyElementProxy_append(__pyx_v_self, __pyx_v_other_element, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 487, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._AppendOnlyElementProxy.append", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/readonlytree.pxi":499
 *         _moveTail(c_next, c_node)
 * 
 *     def extend(self, elements):             # <<<<<<<<<<<<<<
 *         """Append a copy of all Elements from a sequence to the list of
 *         children.
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_23_AppendOnlyElementProxy_3extend(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_23_AppendOnlyElementProxy_2extend, "Append a copy of all Elements from a sequence to the list of\n        children.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_23_AppendOnlyElementProxy_3extend = {"extend", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_23_AppendOnlyElementProxy_3extend, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_23_AppendOnlyElementProxy_2extend};
static PyObject *__pyx_pw_4lxml_5etree_23_AppendOnlyElementProxy_3extend(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_elements = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("extend (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_elements,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(9, 499, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(9, 499, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "extend", 0) < (0)) __PYX_ERR(9, 499, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("extend", 1, 1, 1, i); __PYX_ERR(9, 499, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(9, 499, __pyx_L3_error)
    }
    __pyx_v_elements = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("extend", 1, 1, 1, __pyx_nargs); __PYX_ERR(9, 499, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._AppendOnlyElementProxy.extend", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_23_AppendOnlyElementProxy_2extend(((struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *)__pyx_v_self), __pyx_v_elements);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_23_AppendOnlyElementProxy_2extend(struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *__pyx_v_self, PyObject *__pyx_v_elements) {
  PyObject *__pyx_v_element = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("extend", 0);

  /* "src/lxml/readonlytree.pxi":503
 *         children.
 *         """
 *         self._assertNode()             # <<<<<<<<<<<<<<
 *         for element in elements:
 *             self.append(element)
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__AppendOnlyElementProxy *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(9, 503, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":504
 *         """
 *         self._assertNode()
 *         for element in elements:             # <<<<<<<<<<<<<<
 *             self.append(element)
 * 
*/
  if (likely(PyList_CheckExact(__pyx_v_elements)) || PyTuple_CheckExact(__pyx_v_elements)) {
    __pyx_t_2 = __pyx_v_elements; __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_elements); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 504, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(9, 504, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(9, 504, __pyx_L1_error)
          #endif
          if (__pyx_t_3 >= __pyx_temp) break;
        }
        __pyx_t_5 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_3, __Pyx_ReferenceSharing_OwnStrongReference);
        ++__pyx_t_3;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(9, 504, __pyx_L1_error)
          #endif
          if (__pyx_t_3 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3));
        #else
        __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3);
        #endif
        ++__pyx_t_3;
      }
      if (unlikely(!__pyx_t_5)) __PYX_ERR(9, 504, __pyx_L1_error)
    } else {
      __pyx_t_5 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_5)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(9, 504, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_XDECREF_SET(__pyx_v_element, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "src/lxml/readonlytree.pxi":505
 *         self._assertNode()
 *         for element in elements:
 *             self.append(element)             # <<<<<<<<<<<<<<
 * 
 *     property text:
*/
    __pyx_t_5 = __pyx_f_4lxml_5etree_23_AppendOnlyElementProxy_append(__pyx_v_self, __pyx_v_element, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(9, 505, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "src/lxml/readonlytree.pxi":504
 *         """
 *         self._assertNode()
 *         for element in elements:             # <<<<<<<<<<<<<<
 *             self.append(element)
 * 
*/
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/readonlytree.pxi":499
 *         _moveTail(c_next, c_node)
 * 
 *     def extend(self, elements):             # <<<<<<<<<<<<<<
 *         """Append a copy of all Elements from a sequence to the list of
 *         children.
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._AppendOnlyElementProxy.extend", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_element);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/readonlytree.pxi":511
 *         value None, if there was no text.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self._assertNode()
 *             return _collectText(self._c_node.children)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_23_AppendOnlyElementProxy_4text_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_23_AppendOnlyElementProxy_4text_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_23_AppendOnlyElementProxy_4text___get__(((struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_23_AppendOnlyElementProxy_4text___get__(struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "src/lxml/readonlytree.pxi":512
 *         """
 *         def __get__(self):
 *             self._assertNode()             # <<<<<<<<<<<<<<
 *             return _collectText(self._c_node.children)
 * 
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__AppendOnlyElementProxy *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(9, 512, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":513
 *         def __get__(self):
 *             self._assertNode()
 *             return _collectText(self._c_node.children)             # <<<<<<<<<<<<<<
 * 
 *         def __set__(self, value):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree__collectText(__pyx_v_self->__pyx_base.__pyx_base._c_node->children); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 513, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/readonlytree.pxi":511
 *         value None, if there was no text.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self._assertNode()
 *             return _collectText(self._c_node.children)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._AppendOnlyElementProxy.text.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/readonlytree.pxi":515
 *             return _collectText(self._c_node.children)
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self._assertNode()
 *             if isinstance(value, QName):
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_23_AppendOnlyElementProxy_4text_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_4lxml_5etree_23_AppendOnlyElementProxy_4text_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_23_AppendOnlyElementProxy_4text_2__set__(((struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_23_AppendOnlyElementProxy_4text_2__set__(struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);

  /* "src/lxml/readonlytree.pxi":516
 * 
 *         def __set__(self, value):
 *             self._assertNode()             # <<<<<<<<<<<<<<
 *             if isinstance(value, QName):
 *                 value = _resolveQNameText(self, value).decode('utf8')
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__AppendOnlyElementProxy *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(9, 516, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":517
 *         def __set__(self, value):
 *             self._assertNode()
 *             if isinstance(value, QName):             # <<<<<<<<<<<<<<
 *                 value = _resolveQNameText(self, value).decode('utf8')
 *             _setNodeText(self._c_node, value)
*/
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_value, __pyx_mstate_global->__pyx_ptype_4lxml_5etree_QName); 
  if (__pyx_t_2) {

    /* "src/lxml/readonlytree.pxi":518
 *             self._assertNode()
 *             if isinstance(value, QName):
 *                 value = _resolveQNameText(self, value).decode('utf8')             # <<<<<<<<<<<<<<
 *             _setNodeText(self._c_node, value)
 * 
*/
    if (!(likely(((((PyObject *)__pyx_v_self)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element))))) __PYX_ERR(9, 518, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_4lxml_5etree__resolveQNameText(((struct LxmlElement *)__pyx_v_self), __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(9, 518, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (unlikely(__pyx_t_3 == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "decode");
      __PYX_ERR(9, 518, __pyx_L1_error)
    }
    __pyx_t_4 = __Pyx_decode_bytes(__pyx_t_3, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_4)) __PYX_ERR(9, 518, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "src/lxml/readonlytree.pxi":517
 *         def __set__(self, value):
 *             self._assertNode()
 *             if isinstance(value, QName):             # <<<<<<<<<<<<<<
 *                 value = _resolveQNameText(self, value).decode('utf8')
 *             _setNodeText(self._c_node, value)
*/
  }

  /* "src/lxml/readonlytree.pxi":519
 *             if isinstance(value, QName):
 *                 value = _resolveQNameText(self, value).decode('utf8')
 *             _setNodeText(self._c_node, value)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__setNodeText(__pyx_v_self->__pyx_base.__pyx_base._c_node, __pyx_v_value); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(9, 519, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":515
 *             return _collectText(self._c_node.children)
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self._assertNode()
 *             if isinstance(value, QName):
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._AppendOnlyElementProxy.text.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/readonlytree.pxi":522
 * 
 * 
 * cdef _ReadOnlyProxy _newAppendOnlyProxy(             # <<<<<<<<<<<<<<
 *     _ReadOnlyProxy source_proxy, xmlNode* c_node):
 *     cdef _ReadOnlyProxy el
*/

static struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_f_4lxml_5etree__newAppendOnlyProxy(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_source_proxy, xmlNode *__pyx_v_c_node) {
  struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_el = 0;
  struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_newAppendOnlyProxy", 0);

  /* "src/lxml/readonlytree.pxi":525
 *     _ReadOnlyProxy source_proxy, xmlNode* c_node):
 *     cdef _ReadOnlyProxy el
 *     if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         el = _AppendOnlyElementProxy.__new__(_AppendOnlyElementProxy)
 *     elif c_node.type == tree.XML_PI_NODE:
*/
  switch (__pyx_v_c_node->type) {
    case XML_ELEMENT_NODE:

    /* "src/lxml/readonlytree.pxi":526
 *     cdef _ReadOnlyProxy el
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         el = _AppendOnlyElementProxy.__new__(_AppendOnlyElementProxy)             # <<<<<<<<<<<<<<
 *     elif c_node.type == tree.XML_PI_NODE:
 *         el = _ModifyContentOnlyPIProxy.__new__(_ModifyContentOnlyPIProxy)
*/
    __pyx_t_1 = ((PyObject *)__pyx_tp_new_4lxml_5etree__AppendOnlyElementProxy(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__AppendOnlyElementProxy), __pyx_mstate_global->__pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 526, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
    if (!(likely(__Pyx_TypeTest(((PyObject *)__pyx_t_1), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ReadOnlyProxy)))) __PYX_ERR(9, 526, __pyx_L1_error)
    __pyx_v_el = ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/readonlytree.pxi":525
 *     _ReadOnlyProxy source_proxy, xmlNode* c_node):
 *     cdef _ReadOnlyProxy el
 *     if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         el = _AppendOnlyElementProxy.__new__(_AppendOnlyElementProxy)
 *     elif c_node.type == tree.XML_PI_NODE:
*/
    break;
    case XML_PI_NODE:

    /* "src/lxml/readonlytree.pxi":528
 *         el = _AppendOnlyElementProxy.__new__(_AppendOnlyElementProxy)
 *     elif c_node.type == tree.XML_PI_NODE:
 *         el = _ModifyContentOnlyPIProxy.__new__(_ModifyContentOnlyPIProxy)             # <<<<<<<<<<<<<<
 *     elif c_node.type == tree.XML_COMMENT_NODE:
 *         el = _ModifyContentOnlyProxy.__new__(_ModifyContentOnlyProxy)
*/
    __pyx_t_1 = ((PyObject *)__pyx_tp_new_4lxml_5etree__ModifyContentOnlyPIProxy(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ModifyContentOnlyPIProxy), __pyx_mstate_global->__pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 528, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
    if (!(likely(__Pyx_TypeTest(((PyObject *)__pyx_t_1), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ReadOnlyProxy)))) __PYX_ERR(9, 528, __pyx_L1_error)
    __pyx_v_el = ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/readonlytree.pxi":527
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         el = _AppendOnlyElementProxy.__new__(_AppendOnlyElementProxy)
 *     elif c_node.type == tree.XML_PI_NODE:             # <<<<<<<<<<<<<<
 *         el = _ModifyContentOnlyPIProxy.__new__(_ModifyContentOnlyPIProxy)
 *     elif c_node.type == tree.XML_COMMENT_NODE:
*/
    break;
    case XML_COMMENT_NODE:

    /* "src/lxml/readonlytree.pxi":530
 *         el = _ModifyContentOnlyPIProxy.__new__(_ModifyContentOnlyPIProxy)
 *     elif c_node.type == tree.XML_COMMENT_NODE:
 *         el = _ModifyContentOnlyProxy.__new__(_ModifyContentOnlyProxy)             # <<<<<<<<<<<<<<
 *     else:
 *         raise TypeError(f"Unsupported element type: {c_node.type}")
*/
    __pyx_t_1 = ((PyObject *)__pyx_tp_new_4lxml_5etree__ModifyContentOnlyProxy(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ModifyContentOnlyProxy), __pyx_mstate_global->__pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 530, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
    if (!(likely(__Pyx_TypeTest(((PyObject *)__pyx_t_1), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ReadOnlyProxy)))) __PYX_ERR(9, 530, __pyx_L1_error)
    __pyx_v_el = ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/readonlytree.pxi":529
 *     elif c_node.type == tree.XML_PI_NODE:
 *         el = _ModifyContentOnlyPIProxy.__new__(_ModifyContentOnlyPIProxy)
 *     elif c_node.type == tree.XML_COMMENT_NODE:             # <<<<<<<<<<<<<<
 *         el = _ModifyContentOnlyProxy.__new__(_ModifyContentOnlyProxy)
 *     else:
*/
    break;
    default:

    /* "src/lxml/readonlytree.pxi":532
 *         el = _ModifyContentOnlyProxy.__new__(_ModifyContentOnlyProxy)
 *     else:
 *         raise TypeError(f"Unsupported element type: {c_node.type}")             # <<<<<<<<<<<<<<
 *     el._c_node = c_node
 *     _initReadOnlyProxy(el, source_proxy)
*/
    __pyx_t_2 = NULL;
    __pyx_t_3 = __Pyx_PyUnicode_From_xmlElementType(__pyx_v_c_node->type, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(9, 532, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_Unsupported_element_type, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(9, 532, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 532, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(9, 532, __pyx_L1_error)
    break;
  }

  /* "src/lxml/readonlytree.pxi":533
 *     else:
 *         raise TypeError(f"Unsupported element type: {c_node.type}")
 *     el._c_node = c_node             # <<<<<<<<<<<<<<
 *     _initReadOnlyProxy(el, source_proxy)
 *     return el
*/
  __pyx_v_el->_c_node = __pyx_v_c_node;

  /* "src/lxml/readonlytree.pxi":534
 *         raise TypeError(f"Unsupported element type: {c_node.type}")
 *     el._c_node = c_node
 *     _initReadOnlyProxy(el, source_proxy)             # <<<<<<<<<<<<<<
 *     return el
 * 
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__initReadOnlyProxy(__pyx_v_el, __pyx_v_source_proxy); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 534, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/readonlytree.pxi":535
 *     el._c_node = c_node
 *     _initReadOnlyProxy(el, source_proxy)
 *     return el             # <<<<<<<<<<<<<<
 * 
 * cdef xmlNode* _roNodeOf(element) except NULL:
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_el);
  __pyx_r = __pyx_v_el;
  goto __pyx_L0;

  /* "src/lxml/readonlytree.pxi":522
 * 
 * 
 * cdef _ReadOnlyProxy _newAppendOnlyProxy(             # <<<<<<<<<<<<<<
 *     _ReadOnlyProxy source_proxy, xmlNode* c_node):
 *     cdef _ReadOnlyProxy el
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._newAppendOnlyProxy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_el);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/readonlytree.pxi":537
 *     return el
 * 
 * cdef xmlNode* _roNodeOf(element) except NULL:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     if isinstance(element, _Element):
*/

static xmlNode *__pyx_f_4lxml_5etree__roNodeOf(PyObject *__pyx_v_element) {
  xmlNode *__pyx_v_c_node;
  xmlNode *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  xmlNode *__pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_roNodeOf", 0);

  /* "src/lxml/readonlytree.pxi":539
 * cdef xmlNode* _roNodeOf(element) except NULL:
 *     cdef xmlNode* c_node
 *     if isinstance(element, _Element):             # <<<<<<<<<<<<<<
 *         c_node = (<_Element>element)._c_node
 *     elif isinstance(element, _ReadOnlyProxy):
*/
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_element, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element); 
  if (__pyx_t_1) {

    /* "src/lxml/readonlytree.pxi":540
 *     cdef xmlNode* c_node
 *     if isinstance(element, _Element):
 *         c_node = (<_Element>element)._c_node             # <<<<<<<<<<<<<<
 *     elif isinstance(element, _ReadOnlyProxy):
 *         c_node = (<_ReadOnlyProxy>element)._c_node
*/
    __pyx_t_2 = ((struct LxmlElement *)__pyx_v_element)->_c_node;
    __pyx_v_c_node = __pyx_t_2;

    /* "src/lxml/readonlytree.pxi":539
 * cdef xmlNode* _roNodeOf(element) except NULL:
 *     cdef xmlNode* c_node
 *     if isinstance(element, _Element):             # <<<<<<<<<<<<<<
 *         c_node = (<_Element>element)._c_node
 *     elif isinstance(element, _ReadOnlyProxy):
*/
    goto __pyx_L3;
  }

  /* "src/lxml/readonlytree.pxi":541
 *     if isinstance(element, _Element):
 *         c_node = (<_Element>element)._c_node
 *     elif isinstance(element, _ReadOnlyProxy):             # <<<<<<<<<<<<<<
 *         c_node = (<_ReadOnlyProxy>element)._c_node
 *     elif isinstance(element, _OpaqueNodeWrapper):
*/
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_element, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ReadOnlyProxy); 
  if (__pyx_t_1) {

    /* "src/lxml/readonlytree.pxi":542
 *         c_node = (<_Element>element)._c_node
 *     elif isinstance(element, _ReadOnlyProxy):
 *         c_node = (<_ReadOnlyProxy>element)._c_node             # <<<<<<<<<<<<<<
 *     elif isinstance(element, _OpaqueNodeWrapper):
 *         c_node = (<_OpaqueNodeWrapper>element)._c_node
*/
    __pyx_t_2 = ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_element)->_c_node;
    __pyx_v_c_node = __pyx_t_2;

    /* "src/lxml/readonlytree.pxi":541
 *     if isinstance(element, _Element):
 *         c_node = (<_Element>element)._c_node
 *     elif isinstance(element, _ReadOnlyProxy):             # <<<<<<<<<<<<<<
 *         c_node = (<_ReadOnlyProxy>element)._c_node
 *     elif isinstance(element, _OpaqueNodeWrapper):
*/
    goto __pyx_L3;
  }

  /* "src/lxml/readonlytree.pxi":543
 *     elif isinstance(element, _ReadOnlyProxy):
 *         c_node = (<_ReadOnlyProxy>element)._c_node
 *     elif isinstance(element, _OpaqueNodeWrapper):             # <<<<<<<<<<<<<<
 *         c_node = (<_OpaqueNodeWrapper>element)._c_node
 *     else:
*/
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_element, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__OpaqueNodeWrapper); 
  if (likely(__pyx_t_1)) {

    /* "src/lxml/readonlytree.pxi":544
 *         c_node = (<_ReadOnlyProxy>element)._c_node
 *     elif isinstance(element, _OpaqueNodeWrapper):
 *         c_node = (<_OpaqueNodeWrapper>element)._c_node             # <<<<<<<<<<<<<<
 *     else:
 *         raise TypeError, f"invalid argument type {type(element)}"
*/
    __pyx_t_2 = ((struct __pyx_obj_4lxml_5etree__OpaqueNodeWrapper *)__pyx_v_element)->_c_node;
    __pyx_v_c_node = __pyx_t_2;

    /* "src/lxml/readonlytree.pxi":543
 *     elif isinstance(element, _ReadOnlyProxy):
 *         c_node = (<_ReadOnlyProxy>element)._c_node
 *     elif isinstance(element, _OpaqueNodeWrapper):             # <<<<<<<<<<<<<<
 *         c_node = (<_OpaqueNodeWrapper>element)._c_node
 *     else:
*/
    goto __pyx_L3;
  }

  /* "src/lxml/readonlytree.pxi":546
 *         c_node = (<_OpaqueNodeWrapper>element)._c_node
 *     else:
 *         raise TypeError, f"invalid argument type {type(element)}"             # <<<<<<<<<<<<<<
 * 
 *     if c_node is NULL:
*/
  /*else*/ {
    __pyx_t_3 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(__pyx_v_element)), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(9, 546, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_invalid_argument_type, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(9, 546, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_t_4, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __PYX_ERR(9, 546, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "src/lxml/readonlytree.pxi":548
 *         raise TypeError, f"invalid argument type {type(element)}"
 * 
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         raise TypeError, "invalid element"
 *     return c_node
*/
  __pyx_t_1 = (__pyx_v_c_node == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/readonlytree.pxi":549
 * 
 *     if c_node is NULL:
 *         raise TypeError, "invalid element"             # <<<<<<<<<<<<<<
 *     return c_node
 * 
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_invalid_element, 0, 0);
    __PYX_ERR(9, 549, __pyx_L1_error)

    /* "src/lxml/readonlytree.pxi":548
 *         raise TypeError, f"invalid argument type {type(element)}"
 * 
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         raise TypeError, "invalid element"
 *     return c_node
*/
  }

  /* "src/lxml/readonlytree.pxi":550
 *     if c_node is NULL:
 *         raise TypeError, "invalid element"
 *     return c_node             # <<<<<<<<<<<<<<
 * 
 * cdef xmlNode* _nonRoNodeOf(element) except NULL:
*/
  __pyx_r = __pyx_v_c_node;
  goto __pyx_L0;

  /* "src/lxml/readonlytree.pxi":537
 *     return el
 * 
 * cdef xmlNode* _roNodeOf(element) except NULL:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     if isinstance(element, _Element):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._roNodeOf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/readonlytree.pxi":552
 *     return c_node
 * 
 * cdef xmlNode* _nonRoNodeOf(element) except NULL:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     if isinstance(element, _Element):
*/

static xmlNode *__pyx_f_4lxml_5etree__nonRoNodeOf(PyObject *__pyx_v_element) {
  xmlNode *__pyx_v_c_node;
  xmlNode *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  xmlNode *__pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_nonRoNodeOf", 0);

  /* "src/lxml/readonlytree.pxi":554
 * cdef xmlNode* _nonRoNodeOf(element) except NULL:
 *     cdef xmlNode* c_node
 *     if isinstance(element, _Element):             # <<<<<<<<<<<<<<
 *         c_node = (<_Element>element)._c_node
 *     elif isinstance(element, _AppendOnlyElementProxy):
*/
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_element, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element); 
  if (__pyx_t_1) {

    /* "src/lxml/readonlytree.pxi":555
 *     cdef xmlNode* c_node
 *     if isinstance(element, _Element):
 *         c_node = (<_Element>element)._c_node             # <<<<<<<<<<<<<<
 *     elif isinstance(element, _AppendOnlyElementProxy):
 *         c_node = (<_AppendOnlyElementProxy>element)._c_node
*/
    __pyx_t_2 = ((struct LxmlElement *)__pyx_v_element)->_c_node;
    __pyx_v_c_node = __pyx_t_2;

    /* "src/lxml/readonlytree.pxi":554
 * cdef xmlNode* _nonRoNodeOf(element) except NULL:
 *     cdef xmlNode* c_node
 *     if isinstance(element, _Element):             # <<<<<<<<<<<<<<
 *         c_node = (<_Element>element)._c_node
 *     elif isinstance(element, _AppendOnlyElementProxy):
*/
    goto __pyx_L3;
  }

  /* "src/lxml/readonlytree.pxi":556
 *     if isinstance(element, _Element):
 *         c_node = (<_Element>element)._c_node
 *     elif isinstance(element, _AppendOnlyElementProxy):             # <<<<<<<<<<<<<<
 *         c_node = (<_AppendOnlyElementProxy>element)._c_node
 *     elif isinstance(element, _OpaqueNodeWrapper):
*/
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_element, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__AppendOnlyElementProxy); 
  if (__pyx_t_1) {

    /* "src/lxml/readonlytree.pxi":557
 *         c_node = (<_Element>element)._c_node
 *     elif isinstance(element, _AppendOnlyElementProxy):
 *         c_node = (<_AppendOnlyElementProxy>element)._c_node             # <<<<<<<<<<<<<<
 *     elif isinstance(element, _OpaqueNodeWrapper):
 *         c_node = (<_OpaqueNodeWrapper>element)._c_node
*/
    __pyx_t_2 = ((struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *)__pyx_v_element)->__pyx_base.__pyx_base._c_node;
    __pyx_v_c_node = __pyx_t_2;

    /* "src/lxml/readonlytree.pxi":556
 *     if isinstance(element, _Element):
 *         c_node = (<_Element>element)._c_node
 *     elif isinstance(element, _AppendOnlyElementProxy):             # <<<<<<<<<<<<<<
 *         c_node = (<_AppendOnlyElementProxy>element)._c_node
 *     elif isinstance(element, _OpaqueNodeWrapper):
*/
    goto __pyx_L3;
  }

  /* "src/lxml/readonlytree.pxi":558
 *     elif isinstance(element, _AppendOnlyElementProxy):
 *         c_node = (<_AppendOnlyElementProxy>element)._c_node
 *     elif isinstance(element, _OpaqueNodeWrapper):             # <<<<<<<<<<<<<<
 *         c_node = (<_OpaqueNodeWrapper>element)._c_node
 *     else:
*/
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_element, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__OpaqueNodeWrapper); 
  if (likely(__pyx_t_1)) {

    /* "src/lxml/readonlytree.pxi":559
 *         c_node = (<_AppendOnlyElementProxy>element)._c_node
 *     elif isinstance(element, _OpaqueNodeWrapper):
 *         c_node = (<_OpaqueNodeWrapper>element)._c_node             # <<<<<<<<<<<<<<
 *     else:
 *         raise TypeError, f"invalid argument type {type(element)}"
*/
    __pyx_t_2 = ((struct __pyx_obj_4lxml_5etree__OpaqueNodeWrapper *)__pyx_v_element)->_c_node;
    __pyx_v_c_node = __pyx_t_2;

    /* "src/lxml/readonlytree.pxi":558
 *     elif isinstance(element, _AppendOnlyElementProxy):
 *         c_node = (<_AppendOnlyElementProxy>element)._c_node
 *     elif isinstance(element, _OpaqueNodeWrapper):             # <<<<<<<<<<<<<<
 *         c_node = (<_OpaqueNodeWrapper>element)._c_node
 *     else:
*/
    goto __pyx_L3;
  }

  /* "src/lxml/readonlytree.pxi":561
 *         c_node = (<_OpaqueNodeWrapper>element)._c_node
 *     else:
 *         raise TypeError, f"invalid argument type {type(element)}"             # <<<<<<<<<<<<<<
 * 
 *     if c_node is NULL:
*/
  /*else*/ {
    __pyx_t_3 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(__pyx_v_element)), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(9, 561, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_invalid_argument_type, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(9, 561, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_t_4, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __PYX_ERR(9, 561, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "src/lxml/readonlytree.pxi":563
 *         raise TypeError, f"invalid argument type {type(element)}"
 * 
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         raise TypeError, "invalid element"
 *     return c_node
*/
  __pyx_t_1 = (__pyx_v_c_node == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/readonlytree.pxi":564
 * 
 *     if c_node is NULL:
 *         raise TypeError, "invalid element"             # <<<<<<<<<<<<<<
 *     return c_node
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_invalid_element, 0, 0);
    __PYX_ERR(9, 564, __pyx_L1_error)

    /* "src/lxml/readonlytree.pxi":563
 *         raise TypeError, f"invalid argument type {type(element)}"
 * 
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         raise TypeError, "invalid element"
 *     return c_node
*/
  }

  /* "src/lxml/readonlytree.pxi":565
 *     if c_node is NULL:
 *         raise TypeError, "invalid element"
 *     return c_node             # <<<<<<<<<<<<<<
*/
  __pyx_r = __pyx_v_c_node;
  goto __pyx_L0;

  /* "src/lxml/readonlytree.pxi":552
 *     return c_node
 * 
 * cdef xmlNode* _nonRoNodeOf(element) except NULL:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     if isinstance(element, _Element):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._nonRoNodeOf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/classlookup.pxi":42
 *     hierarchies that implement a common namespace.
 *     """
 *     def __init__(self, *children, attrib=None, nsmap=None, **_extra):             # <<<<<<<<<<<<<<
 *         """ElementBase(*children, attrib=None, nsmap=None, **_extra)
 *         """
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_11ElementBase_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_11ElementBase___init__, "ElementBase(*children, attrib=None, nsmap=None, **_extra)\n        ");
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_11ElementBase___init__;
#endif
static int __pyx_pw_4lxml_5etree_11ElementBase_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_attrib = 0;
  PyObject *__pyx_v_nsmap = 0;
  PyObject *__pyx_v_children = 0;
  PyObject *__pyx_v__extra = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_v__extra = PyDict_New(); if (unlikely(!__pyx_v__extra)) return -1;
  __Pyx_GOTREF(__pyx_v__extra);
  __Pyx_INCREF(__pyx_args);
  __pyx_v_children = __pyx_args;
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_attrib,&__pyx_mstate_global->__pyx_n_u_nsmap,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(10, 42, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        default:
        case  0: break;
      }
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v__extra, values, 0, __pyx_kwds_len, "__init__", 1) < (0)) __PYX_ERR(10, 42, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
    } else if (unlikely(__pyx_nargs < 0)) {
      goto __pyx_L5_argtuple_error;
    } else {
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_attrib = values[0];
    __pyx_v_nsmap = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 0, __pyx_nargs); __PYX_ERR(10, 42, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v_children); __pyx_v_children = 0;
  __Pyx_DECREF(__pyx_v__extra); __pyx_v__extra = 0;
  __Pyx_AddTraceback("lxml.etree.ElementBase.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_11ElementBase___init__(((struct LxmlElementBase *)__pyx_v_self), __pyx_v_attrib, __pyx_v_nsmap, __pyx_v_children, __pyx_v__extra);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v_children);
  __Pyx_DECREF(__pyx_v__extra);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_11ElementBase___init__(struct LxmlElementBase *__pyx_v_self, PyObject *__pyx_v_attrib, PyObject *__pyx_v_nsmap, PyObject *__pyx_v_children, PyObject *__pyx_v__extra) {
  int __pyx_v_is_html;
  struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser = 0;
  struct LxmlElement *__pyx_v_last_child = 0;
  PyObject *__pyx_v__getattr = NULL;
  PyObject *__pyx_v_namespace = NULL;
  PyObject *__pyx_v_ns = NULL;
  PyObject *__pyx_v_tag = NULL;
  PyObject *__pyx_v_child = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  size_t __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  Py_ssize_t __pyx_t_16;
  int __pyx_t_17;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "src/lxml/classlookup.pxi":45
 *         """ElementBase(*children, attrib=None, nsmap=None, **_extra)
 *         """
 *         cdef bint is_html = 0             # <<<<<<<<<<<<<<
 *         cdef _BaseParser parser
 *         cdef _Element last_child
*/
  __pyx_v_is_html = 0;

  /* "src/lxml/classlookup.pxi":49
 *         cdef _Element last_child
 *         # don't use normal attribute access as it might be overridden
 *         _getattr = object.__getattribute__             # <<<<<<<<<<<<<<
 *         try:
 *             namespace = _utf8(_getattr(self, 'NAMESPACE'))
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_builtin_object, __pyx_mstate_global->__pyx_n_u_getattribute); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 49, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__getattr = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "src/lxml/classlookup.pxi":50
 *         # don't use normal attribute access as it might be overridden
 *         _getattr = object.__getattribute__
 *         try:             # <<<<<<<<<<<<<<
 *             namespace = _utf8(_getattr(self, 'NAMESPACE'))
 *         except AttributeError:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    /*try:*/ {

      /* "src/lxml/classlookup.pxi":51
 *         _getattr = object.__getattribute__
 *         try:
 *             namespace = _utf8(_getattr(self, 'NAMESPACE'))             # <<<<<<<<<<<<<<
 *         except AttributeError:
 *             namespace = None
*/
      __pyx_t_5 = NULL;
      __Pyx_INCREF(__pyx_v__getattr);
      __pyx_t_6 = __pyx_v__getattr; 
      __pyx_t_7 = 1;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
        assert(__pyx_t_5);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
        __pyx_t_7 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_5, ((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_NAMESPACE};
        __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 51, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __pyx_t_6 = __pyx_f_4lxml_5etree__utf8(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 51, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_namespace = __pyx_t_6;
      __pyx_t_6 = 0;

      /* "src/lxml/classlookup.pxi":50
 *         # don't use normal attribute access as it might be overridden
 *         _getattr = object.__getattribute__
 *         try:             # <<<<<<<<<<<<<<
 *             namespace = _utf8(_getattr(self, 'NAMESPACE'))
 *         except AttributeError:
*/
    }
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "src/lxml/classlookup.pxi":52
 *         try:
 *             namespace = _utf8(_getattr(self, 'NAMESPACE'))
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             namespace = None
 *         try:
*/
    __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_AttributeError))));
    if (__pyx_t_8) {
      __Pyx_ErrRestore(0,0,0);

      /* "src/lxml/classlookup.pxi":53
 *             namespace = _utf8(_getattr(self, 'NAMESPACE'))
 *         except AttributeError:
 *             namespace = None             # <<<<<<<<<<<<<<
 *         try:
 *             ns, tag = _getNsTag(_getattr(self, 'TAG'))
*/
      __Pyx_INCREF(Py_None);
      __Pyx_XDECREF_SET(__pyx_v_namespace, Py_None);
      goto __pyx_L4_exception_handled;
    }
    goto __pyx_L5_except_error;

    /* "src/lxml/classlookup.pxi":50
 *         # don't use normal attribute access as it might be overridden
 *         _getattr = object.__getattribute__
 *         try:             # <<<<<<<<<<<<<<
 *             namespace = _utf8(_getattr(self, 'NAMESPACE'))
 *         except AttributeError:
*/
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    goto __pyx_L1_error;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    __pyx_L8_try_end:;
  }

  /* "src/lxml/classlookup.pxi":54
 *         except AttributeError:
 *             namespace = None
 *         try:             # <<<<<<<<<<<<<<
 *             ns, tag = _getNsTag(_getattr(self, 'TAG'))
 *             if ns is not None:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_2);
    /*try:*/ {

      /* "src/lxml/classlookup.pxi":55
 *             namespace = None
 *         try:
 *             ns, tag = _getNsTag(_getattr(self, 'TAG'))             # <<<<<<<<<<<<<<
 *             if ns is not None:
 *                 namespace = ns
*/
      __pyx_t_1 = NULL;
      __Pyx_INCREF(__pyx_v__getattr);
      __pyx_t_5 = __pyx_v__getattr; 
      __pyx_t_7 = 1;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5);
        assert(__pyx_t_1);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
        __pyx_t_7 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_1, ((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_TAG};
        __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 55, __pyx_L11_error)
        __Pyx_GOTREF(__pyx_t_6);
      }
      __pyx_t_5 = __pyx_f_4lxml_5etree__getNsTag(__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(10, 55, __pyx_L11_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (likely(__pyx_t_5 != Py_None)) {
        PyObject* sequence = __pyx_t_5;
        Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(10, 55, __pyx_L11_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0);
        __Pyx_INCREF(__pyx_t_6);
        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1);
        __Pyx_INCREF(__pyx_t_1);
        #else
        __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 55, __pyx_L11_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 55, __pyx_L11_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      } else {
        __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(10, 55, __pyx_L11_error)
      }
      __pyx_v_ns = __pyx_t_6;
      __pyx_t_6 = 0;
      __pyx_v_tag = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "src/lxml/classlookup.pxi":56
 *         try:
 *             ns, tag = _getNsTag(_getattr(self, 'TAG'))
 *             if ns is not None:             # <<<<<<<<<<<<<<
 *                 namespace = ns
 *         except AttributeError:
*/
      __pyx_t_9 = (__pyx_v_ns != Py_None);
      if (__pyx_t_9) {

        /* "src/lxml/classlookup.pxi":57
 *             ns, tag = _getNsTag(_getattr(self, 'TAG'))
 *             if ns is not None:
 *                 namespace = ns             # <<<<<<<<<<<<<<
 *         except AttributeError:
 *             tag = _utf8(_getattr(_getattr(self, '__class__'), '__name__'))
*/
        __Pyx_INCREF(__pyx_v_ns);
        __Pyx_DECREF_SET(__pyx_v_namespace, __pyx_v_ns);

        /* "src/lxml/classlookup.pxi":56
 *         try:
 *             ns, tag = _getNsTag(_getattr(self, 'TAG'))
 *             if ns is not None:             # <<<<<<<<<<<<<<
 *                 namespace = ns
 *         except AttributeError:
*/
      }

      /* "src/lxml/classlookup.pxi":54
 *         except AttributeError:
 *             namespace = None
 *         try:             # <<<<<<<<<<<<<<
 *             ns, tag = _getNsTag(_getattr(self, 'TAG'))
 *             if ns is not None:
*/
    }
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L16_try_end;
    __pyx_L11_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "src/lxml/classlookup.pxi":58
 *             if ns is not None:
 *                 namespace = ns
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             tag = _utf8(_getattr(_getattr(self, '__class__'), '__name__'))
 *             if b'.' in tag:
*/
    __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_AttributeError))));
    if (__pyx_t_8) {
      __Pyx_AddTraceback("lxml.etree.ElementBase.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_1, &__pyx_t_6) < 0) __PYX_ERR(10, 58, __pyx_L13_except_error)
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_1);
      __Pyx_XGOTREF(__pyx_t_6);

      /* "src/lxml/classlookup.pxi":59
 *                 namespace = ns
 *         except AttributeError:
 *             tag = _utf8(_getattr(_getattr(self, '__class__'), '__name__'))             # <<<<<<<<<<<<<<
 *             if b'.' in tag:
 *                 tag = tag.split(b'.')[-1]
*/
      __pyx_t_11 = NULL;
      __Pyx_INCREF(__pyx_v__getattr);
      __pyx_t_12 = __pyx_v__getattr; 
      __pyx_t_14 = NULL;
      __Pyx_INCREF(__pyx_v__getattr);
      __pyx_t_15 = __pyx_v__getattr; 
      __pyx_t_7 = 1;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_15))) {
        __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_15);
        assert(__pyx_t_14);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_15);
        __Pyx_INCREF(__pyx_t_14);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_15, __pyx__function);
        __pyx_t_7 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_14, ((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_class};
        __pyx_t_13 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_15, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        if (unlikely(!__pyx_t_13)) __PYX_ERR(10, 59, __pyx_L13_except_error)
        __Pyx_GOTREF(__pyx_t_13);
      }
      __pyx_t_7 = 1;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_12))) {
        __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_12);
        assert(__pyx_t_11);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_12);
        __Pyx_INCREF(__pyx_t_11);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_12, __pyx__function);
        __pyx_t_7 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_11, __pyx_t_13, __pyx_mstate_global->__pyx_n_u_name_2};
        __pyx_t_10 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_12, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        if (unlikely(!__pyx_t_10)) __PYX_ERR(10, 59, __pyx_L13_except_error)
        __Pyx_GOTREF(__pyx_t_10);
      }
      __pyx_t_12 = __pyx_f_4lxml_5etree__utf8(__pyx_t_10); if (unlikely(!__pyx_t_12)) __PYX_ERR(10, 59, __pyx_L13_except_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF_SET(__pyx_v_tag, __pyx_t_12);
      __pyx_t_12 = 0;

      /* "src/lxml/classlookup.pxi":60
 *         except AttributeError:
 *             tag = _utf8(_getattr(_getattr(self, '__class__'), '__name__'))
 *             if b'.' in tag:             # <<<<<<<<<<<<<<
 *                 tag = tag.split(b'.')[-1]
 *         try:
*/
      __pyx_t_9 = (__Pyx_PySequence_ContainsTF(__pyx_mstate_global->__pyx_kp_b__2, __pyx_v_tag, Py_EQ)); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(10, 60, __pyx_L13_except_error)
      if (__pyx_t_9) {

        /* "src/lxml/classlookup.pxi":61
 *             tag = _utf8(_getattr(_getattr(self, '__class__'), '__name__'))
 *             if b'.' in tag:
 *                 tag = tag.split(b'.')[-1]             # <<<<<<<<<<<<<<
 *         try:
 *             parser = _getattr(self, 'PARSER')
*/
        __pyx_t_12 = __Pyx_CallUnboundCMethod1(&__pyx_mstate_global->__pyx_umethod_PyBytes_Type__split, __pyx_v_tag, __pyx_mstate_global->__pyx_kp_b__2); if (unlikely(!__pyx_t_12)) __PYX_ERR(10, 61, __pyx_L13_except_error)
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_10 = __Pyx_GetItemInt_List(__pyx_t_12, -1L, long, 1, __Pyx_PyLong_From_long, 1, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_10)) __PYX_ERR(10, 61, __pyx_L13_except_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_DECREF_SET(__pyx_v_tag, __pyx_t_10);
        __pyx_t_10 = 0;

        /* "src/lxml/classlookup.pxi":60
 *         except AttributeError:
 *             tag = _utf8(_getattr(_getattr(self, '__class__'), '__name__'))
 *             if b'.' in tag:             # <<<<<<<<<<<<<<
 *                 tag = tag.split(b'.')[-1]
 *         try:
*/
      }
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L12_exception_handled;
    }
    goto __pyx_L13_except_error;

    /* "src/lxml/classlookup.pxi":54
 *         except AttributeError:
 *             namespace = None
 *         try:             # <<<<<<<<<<<<<<
 *             ns, tag = _getNsTag(_getattr(self, 'TAG'))
 *             if ns is not None:
*/
    __pyx_L13_except_error:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_3, __pyx_t_2);
    goto __pyx_L1_error;
    __pyx_L12_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_3, __pyx_t_2);
    __pyx_L16_try_end:;
  }

  /* "src/lxml/classlookup.pxi":62
 *             if b'.' in tag:
 *                 tag = tag.split(b'.')[-1]
 *         try:             # <<<<<<<<<<<<<<
 *             parser = _getattr(self, 'PARSER')
 *         except AttributeError:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    /*try:*/ {

      /* "src/lxml/classlookup.pxi":63
 *                 tag = tag.split(b'.')[-1]
 *         try:
 *             parser = _getattr(self, 'PARSER')             # <<<<<<<<<<<<<<
 *         except AttributeError:
 *             parser = None
*/
      __pyx_t_1 = NULL;
      __Pyx_INCREF(__pyx_v__getattr);
      __pyx_t_5 = __pyx_v__getattr; 
      __pyx_t_7 = 1;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5);
        assert(__pyx_t_1);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
        __pyx_t_7 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_1, ((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_PARSER};
        __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 63, __pyx_L21_error)
        __Pyx_GOTREF(__pyx_t_6);
      }
      if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__BaseParser))))) __PYX_ERR(10, 63, __pyx_L21_error)
      __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_6);
      __pyx_t_6 = 0;

      /* "src/lxml/classlookup.pxi":62
 *             if b'.' in tag:
 *                 tag = tag.split(b'.')[-1]
 *         try:             # <<<<<<<<<<<<<<
 *             parser = _getattr(self, 'PARSER')
 *         except AttributeError:
*/
    }
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L26_try_end;
    __pyx_L21_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "src/lxml/classlookup.pxi":64
 *         try:
 *             parser = _getattr(self, 'PARSER')
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             parser = None
 *             for child in children:
*/
    __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_AttributeError))));
    if (__pyx_t_8) {
      __Pyx_AddTraceback("lxml.etree.ElementBase.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(10, 64, __pyx_L23_except_error)
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_1);

      /* "src/lxml/classlookup.pxi":65
 *             parser = _getattr(self, 'PARSER')
 *         except AttributeError:
 *             parser = None             # <<<<<<<<<<<<<<
 *             for child in children:
 *                 if isinstance(child, _Element):
*/
      __Pyx_INCREF(Py_None);
      __Pyx_XDECREF_SET(__pyx_v_parser, ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None));

      /* "src/lxml/classlookup.pxi":66
 *         except AttributeError:
 *             parser = None
 *             for child in children:             # <<<<<<<<<<<<<<
 *                 if isinstance(child, _Element):
 *                     parser = (<_Element>child)._doc._parser
*/
      __pyx_t_10 = __pyx_v_children; __Pyx_INCREF(__pyx_t_10);
      __pyx_t_16 = 0;
      for (;;) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_10);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(10, 66, __pyx_L23_except_error)
          #endif
          if (__pyx_t_16 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_12 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_16));
        #else
        __pyx_t_12 = __Pyx_PySequence_ITEM(__pyx_t_10, __pyx_t_16);
        #endif
        ++__pyx_t_16;
        if (unlikely(!__pyx_t_12)) __PYX_ERR(10, 66, __pyx_L23_except_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_XDECREF_SET(__pyx_v_child, __pyx_t_12);
        __pyx_t_12 = 0;

        /* "src/lxml/classlookup.pxi":67
 *             parser = None
 *             for child in children:
 *                 if isinstance(child, _Element):             # <<<<<<<<<<<<<<
 *                     parser = (<_Element>child)._doc._parser
 *                     break
*/
        __pyx_t_9 = __Pyx_TypeCheck(__pyx_v_child, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element); 
        if (__pyx_t_9) {

          /* "src/lxml/classlookup.pxi":68
 *             for child in children:
 *                 if isinstance(child, _Element):
 *                     parser = (<_Element>child)._doc._parser             # <<<<<<<<<<<<<<
 *                     break
 *         if isinstance(parser, HTMLParser):
*/
          __pyx_t_12 = ((PyObject *)((struct LxmlElement *)__pyx_v_child)->_doc->_parser);
          __Pyx_INCREF(__pyx_t_12);
          __Pyx_DECREF_SET(__pyx_v_parser, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_12));
          __pyx_t_12 = 0;

          /* "src/lxml/classlookup.pxi":69
 *                 if isinstance(child, _Element):
 *                     parser = (<_Element>child)._doc._parser
 *                     break             # <<<<<<<<<<<<<<
 *         if isinstance(parser, HTMLParser):
 *             is_html = 1
*/
          goto __pyx_L30_break;

          /* "src/lxml/classlookup.pxi":67
 *             parser = None
 *             for child in children:
 *                 if isinstance(child, _Element):             # <<<<<<<<<<<<<<
 *                     parser = (<_Element>child)._doc._parser
 *                     break
*/
        }

        /* "src/lxml/classlookup.pxi":66
 *         except AttributeError:
 *             parser = None
 *             for child in children:             # <<<<<<<<<<<<<<
 *                 if isinstance(child, _Element):
 *                     parser = (<_Element>child)._doc._parser
*/
      }
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      goto __pyx_L32_for_end;
      __pyx_L30_break:;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      goto __pyx_L32_for_end;
      __pyx_L32_for_end:;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L22_exception_handled;
    }
    goto __pyx_L23_except_error;

    /* "src/lxml/classlookup.pxi":62
 *             if b'.' in tag:
 *                 tag = tag.split(b'.')[-1]
 *         try:             # <<<<<<<<<<<<<<
 *             parser = _getattr(self, 'PARSER')
 *         except AttributeError:
*/
    __pyx_L23_except_error:;
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    goto __pyx_L1_error;
    __pyx_L22_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    __pyx_L26_try_end:;
  }

  /* "src/lxml/classlookup.pxi":70
 *                     parser = (<_Element>child)._doc._parser
 *                     break
 *         if isinstance(parser, HTMLParser):             # <<<<<<<<<<<<<<
 *             is_html = 1
 *         if namespace is None:
*/
  __pyx_t_9 = __Pyx_TypeCheck(((PyObject *)__pyx_v_parser), __pyx_mstate_global->__pyx_ptype_4lxml_5etree_HTMLParser); 
  if (__pyx_t_9) {

    /* "src/lxml/classlookup.pxi":71
 *                     break
 *         if isinstance(parser, HTMLParser):
 *             is_html = 1             # <<<<<<<<<<<<<<
 *         if namespace is None:
 *             try:
*/
    __pyx_v_is_html = 1;

    /* "src/lxml/classlookup.pxi":70
 *                     parser = (<_Element>child)._doc._parser
 *                     break
 *         if isinstance(parser, HTMLParser):             # <<<<<<<<<<<<<<
 *             is_html = 1
 *         if namespace is None:
*/
  }

  /* "src/lxml/classlookup.pxi":72
 *         if isinstance(parser, HTMLParser):
 *             is_html = 1
 *         if namespace is None:             # <<<<<<<<<<<<<<
 *             try:
 *                 is_html = _getattr(self, 'HTML')
*/
  __pyx_t_9 = (__pyx_v_namespace == Py_None);
  if (__pyx_t_9) {

    /* "src/lxml/classlookup.pxi":73
 *             is_html = 1
 *         if namespace is None:
 *             try:             # <<<<<<<<<<<<<<
 *                 is_html = _getattr(self, 'HTML')
 *             except AttributeError:
*/
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_2);
      /*try:*/ {

        /* "src/lxml/classlookup.pxi":74
 *         if namespace is None:
 *             try:
 *                 is_html = _getattr(self, 'HTML')             # <<<<<<<<<<<<<<
 *             except AttributeError:
 *                 pass
*/
        __pyx_t_5 = NULL;
        __Pyx_INCREF(__pyx_v__getattr);
        __pyx_t_6 = __pyx_v__getattr; 
        __pyx_t_7 = 1;
        #if CYTHON_UNPACK_METHODS
        if (likely(PyMethod_Check(__pyx_t_6))) {
          __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
          assert(__pyx_t_5);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
          __pyx_t_7 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[3] = {__pyx_t_5, ((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_HTML};
          __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 74, __pyx_L35_error)
          __Pyx_GOTREF(__pyx_t_1);
        }
        __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(10, 74, __pyx_L35_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_v_is_html = __pyx_t_9;

        /* "src/lxml/classlookup.pxi":73
 *             is_html = 1
 *         if namespace is None:
 *             try:             # <<<<<<<<<<<<<<
 *                 is_html = _getattr(self, 'HTML')
 *             except AttributeError:
*/
      }
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L40_try_end;
      __pyx_L35_error:;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "src/lxml/classlookup.pxi":75
 *             try:
 *                 is_html = _getattr(self, 'HTML')
 *             except AttributeError:             # <<<<<<<<<<<<<<
 *                 pass
 *         _initNewElement(self, is_html, tag, namespace, parser,
*/
      __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_AttributeError))));
      if (__pyx_t_8) {
        __Pyx_ErrRestore(0,0,0);
        goto __pyx_L36_exception_handled;
      }
      goto __pyx_L37_except_error;

      /* "src/lxml/classlookup.pxi":73
 *             is_html = 1
 *         if namespace is None:
 *             try:             # <<<<<<<<<<<<<<
 *                 is_html = _getattr(self, 'HTML')
 *             except AttributeError:
*/
      __pyx_L37_except_error:;
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_3, __pyx_t_2);
      goto __pyx_L1_error;
      __pyx_L36_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_3, __pyx_t_2);
      __pyx_L40_try_end:;
    }

    /* "src/lxml/classlookup.pxi":72
 *         if isinstance(parser, HTMLParser):
 *             is_html = 1
 *         if namespace is None:             # <<<<<<<<<<<<<<
 *             try:
 *                 is_html = _getattr(self, 'HTML')
*/
  }

  /* "src/lxml/classlookup.pxi":77
 *             except AttributeError:
 *                 pass
 *         _initNewElement(self, is_html, tag, namespace, parser,             # <<<<<<<<<<<<<<
 *                         attrib, nsmap, _extra)
 *         last_child = None
*/
  __pyx_t_8 = __pyx_f_4lxml_5etree__initNewElement(((struct LxmlElement *)__pyx_v_self), __pyx_v_is_html, __pyx_v_tag, __pyx_v_namespace, __pyx_v_parser, __pyx_v_attrib, __pyx_v_nsmap, __pyx_v__extra); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(10, 77, __pyx_L1_error)

  /* "src/lxml/classlookup.pxi":79
 *         _initNewElement(self, is_html, tag, namespace, parser,
 *                         attrib, nsmap, _extra)
 *         last_child = None             # <<<<<<<<<<<<<<
 *         for child in children:
 *             if _isString(child):
*/
  __Pyx_INCREF(Py_None);
  __pyx_v_last_child = ((struct LxmlElement *)Py_None);

  /* "src/lxml/classlookup.pxi":80
 *                         attrib, nsmap, _extra)
 *         last_child = None
 *         for child in children:             # <<<<<<<<<<<<<<
 *             if _isString(child):
 *                 if last_child is None:
*/
  __pyx_t_1 = __pyx_v_children; __Pyx_INCREF(__pyx_t_1);
  __pyx_t_16 = 0;
  for (;;) {
    {
      Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
      #if !CYTHON_ASSUME_SAFE_SIZE
      if (unlikely((__pyx_temp < 0))) __PYX_ERR(10, 80, __pyx_L1_error)
      #endif
      if (__pyx_t_16 >= __pyx_temp) break;
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_6 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_16));
    #else
    __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_16);
    #endif
    ++__pyx_t_16;
    if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 80, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF_SET(__pyx_v_child, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "src/lxml/classlookup.pxi":81
 *         last_child = None
 *         for child in children:
 *             if _isString(child):             # <<<<<<<<<<<<<<
 *                 if last_child is None:
 *                     _setNodeText(self._c_node,
*/
    __pyx_t_9 = _isString(__pyx_v_child);
    if (__pyx_t_9) {

      /* "src/lxml/classlookup.pxi":82
 *         for child in children:
 *             if _isString(child):
 *                 if last_child is None:             # <<<<<<<<<<<<<<
 *                     _setNodeText(self._c_node,
 *                                  (_collectText(self._c_node.children) or '') + child)
*/
      __pyx_t_9 = (((PyObject *)__pyx_v_last_child) == Py_None);
      if (__pyx_t_9) {

        /* "src/lxml/classlookup.pxi":84
 *                 if last_child is None:
 *                     _setNodeText(self._c_node,
 *                                  (_collectText(self._c_node.children) or '') + child)             # <<<<<<<<<<<<<<
 *                 else:
 *                     _setTailText(last_child._c_node,
*/
        __pyx_t_5 = __pyx_f_4lxml_5etree__collectText(__pyx_v_self->__pyx_base._c_node->children); if (unlikely(!__pyx_t_5)) __PYX_ERR(10, 84, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(10, 84, __pyx_L1_error)
        if (!__pyx_t_9) {
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        } else {
          __Pyx_INCREF(__pyx_t_5);
          __pyx_t_6 = __pyx_t_5;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          goto __pyx_L47_bool_binop_done;
        }
        __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u__8);
        __pyx_t_6 = __pyx_mstate_global->__pyx_kp_u__8;
        __pyx_L47_bool_binop_done:;
        __pyx_t_5 = PyNumber_Add(__pyx_t_6, __pyx_v_child); if (unlikely(!__pyx_t_5)) __PYX_ERR(10, 84, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

        /* "src/lxml/classlookup.pxi":83
 *             if _isString(child):
 *                 if last_child is None:
 *                     _setNodeText(self._c_node,             # <<<<<<<<<<<<<<
 *                                  (_collectText(self._c_node.children) or '') + child)
 *                 else:
*/
        __pyx_t_8 = __pyx_f_4lxml_5etree__setNodeText(__pyx_v_self->__pyx_base._c_node, __pyx_t_5); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(10, 83, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "src/lxml/classlookup.pxi":82
 *         for child in children:
 *             if _isString(child):
 *                 if last_child is None:             # <<<<<<<<<<<<<<
 *                     _setNodeText(self._c_node,
 *                                  (_collectText(self._c_node.children) or '') + child)
*/
        goto __pyx_L46;
      }

      /* "src/lxml/classlookup.pxi":86
 *                                  (_collectText(self._c_node.children) or '') + child)
 *                 else:
 *                     _setTailText(last_child._c_node,             # <<<<<<<<<<<<<<
 *                                  (_collectText(last_child._c_node.next) or '') + child)
 *             elif isinstance(child, _Element):
*/
      /*else*/ {

        /* "src/lxml/classlookup.pxi":87
 *                 else:
 *                     _setTailText(last_child._c_node,
 *                                  (_collectText(last_child._c_node.next) or '') + child)             # <<<<<<<<<<<<<<
 *             elif isinstance(child, _Element):
 *                 last_child = child
*/
        __pyx_t_6 = __pyx_f_4lxml_5etree__collectText(__pyx_v_last_child->_c_node->next); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 87, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(10, 87, __pyx_L1_error)
        if (!__pyx_t_9) {
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        } else {
          __Pyx_INCREF(__pyx_t_6);
          __pyx_t_5 = __pyx_t_6;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          goto __pyx_L49_bool_binop_done;
        }
        __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u__8);
        __pyx_t_5 = __pyx_mstate_global->__pyx_kp_u__8;
        __pyx_L49_bool_binop_done:;
        __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_v_child); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 87, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "src/lxml/classlookup.pxi":86
 *                                  (_collectText(self._c_node.children) or '') + child)
 *                 else:
 *                     _setTailText(last_child._c_node,             # <<<<<<<<<<<<<<
 *                                  (_collectText(last_child._c_node.next) or '') + child)
 *             elif isinstance(child, _Element):
*/
        __pyx_t_8 = __pyx_f_4lxml_5etree__setTailText(__pyx_v_last_child->_c_node, __pyx_t_6); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(10, 86, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
      __pyx_L46:;

      /* "src/lxml/classlookup.pxi":81
 *         last_child = None
 *         for child in children:
 *             if _isString(child):             # <<<<<<<<<<<<<<
 *                 if last_child is None:
 *                     _setNodeText(self._c_node,
*/
      goto __pyx_L45;
    }

    /* "src/lxml/classlookup.pxi":88
 *                     _setTailText(last_child._c_node,
 *                                  (_collectText(last_child._c_node.next) or '') + child)
 *             elif isinstance(child, _Element):             # <<<<<<<<<<<<<<
 *                 last_child = child
 *                 _appendChild(self, last_child)
*/
    __pyx_t_9 = __Pyx_TypeCheck(__pyx_v_child, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element); 
    if (__pyx_t_9) {

      /* "src/lxml/classlookup.pxi":89
 *                                  (_collectText(last_child._c_node.next) or '') + child)
 *             elif isinstance(child, _Element):
 *                 last_child = child             # <<<<<<<<<<<<<<
 *                 _appendChild(self, last_child)
 *             elif isinstance(child, type) and issubclass(child, ElementBase):
*/
      __pyx_t_6 = __pyx_v_child;
      __Pyx_INCREF(__pyx_t_6);
      if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element))))) __PYX_ERR(10, 89, __pyx_L1_error)
      __Pyx_DECREF_SET(__pyx_v_last_child, ((struct LxmlElement *)__pyx_t_6));
      __pyx_t_6 = 0;

      /* "src/lxml/classlookup.pxi":90
 *             elif isinstance(child, _Element):
 *                 last_child = child
 *                 _appendChild(self, last_child)             # <<<<<<<<<<<<<<
 *             elif isinstance(child, type) and issubclass(child, ElementBase):
 *                 last_child = child()
*/
      __pyx_t_8 = __pyx_f_4lxml_5etree__appendChild(((struct LxmlElement *)__pyx_v_self), __pyx_v_last_child); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(10, 90, __pyx_L1_error)

      /* "src/lxml/classlookup.pxi":88
 *                     _setTailText(last_child._c_node,
 *                                  (_collectText(last_child._c_node.next) or '') + child)
 *             elif isinstance(child, _Element):             # <<<<<<<<<<<<<<
 *                 last_child = child
 *                 _appendChild(self, last_child)
*/
      goto __pyx_L45;
    }

    /* "src/lxml/classlookup.pxi":91
 *                 last_child = child
 *                 _appendChild(self, last_child)
 *             elif isinstance(child, type) and issubclass(child, ElementBase):             # <<<<<<<<<<<<<<
 *                 last_child = child()
 *                 _appendChild(self, last_child)
*/
    __pyx_t_17 = PyType_Check(__pyx_v_child); 
    if (__pyx_t_17) {
    } else {
      __pyx_t_9 = __pyx_t_17;
      goto __pyx_L51_bool_binop_done;
    }
    __pyx_t_17 = PyObject_IsSubclass(__pyx_v_child, ((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_ElementBase)); if (unlikely(__pyx_t_17 == ((int)-1))) __PYX_ERR(10, 91, __pyx_L1_error)
    __pyx_t_9 = __pyx_t_17;
    __pyx_L51_bool_binop_done:;
    if (likely(__pyx_t_9)) {

      /* "src/lxml/classlookup.pxi":92
 *                 _appendChild(self, last_child)
 *             elif isinstance(child, type) and issubclass(child, ElementBase):
 *                 last_child = child()             # <<<<<<<<<<<<<<
 *                 _appendChild(self, last_child)
 *             else:
*/
      __pyx_t_5 = NULL;
      __Pyx_INCREF(__pyx_v_child);
      __pyx_t_10 = __pyx_v_child; 
      __pyx_t_7 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_10))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_10);
        assert(__pyx_t_5);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_10);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_10, __pyx__function);
        __pyx_t_7 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};
        __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_10, __pyx_callargs+__pyx_t_7, (1-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 92, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
      }
      if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element))))) __PYX_ERR(10, 92, __pyx_L1_error)
      __Pyx_DECREF_SET(__pyx_v_last_child, ((struct LxmlElement *)__pyx_t_6));
      __pyx_t_6 = 0;

      /* "src/lxml/classlookup.pxi":93
 *             elif isinstance(child, type) and issubclass(child, ElementBase):
 *                 last_child = child()
 *                 _appendChild(self, last_child)             # <<<<<<<<<<<<<<
 *             else:
 *                 raise TypeError, f"Invalid child type: {type(child)!r}"
*/
      __pyx_t_8 = __pyx_f_4lxml_5etree__appendChild(((struct LxmlElement *)__pyx_v_self), __pyx_v_last_child); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(10, 93, __pyx_L1_error)

      /* "src/lxml/classlookup.pxi":91
 *                 last_child = child
 *                 _appendChild(self, last_child)
 *             elif isinstance(child, type) and issubclass(child, ElementBase):             # <<<<<<<<<<<<<<
 *                 last_child = child()
 *                 _appendChild(self, last_child)
*/
      goto __pyx_L45;
    }

    /* "src/lxml/classlookup.pxi":95
 *                 _appendChild(self, last_child)
 *             else:
 *                 raise TypeError, f"Invalid child type: {type(child)!r}"             # <<<<<<<<<<<<<<
 * 
 * cdef class CommentBase(_Comment):
*/
    /*else*/ {
      __pyx_t_6 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(((PyObject *)Py_TYPE(__pyx_v_child))), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 95, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_10 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_Invalid_child_type, __pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(10, 95, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_t_10, 0, 0);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __PYX_ERR(10, 95, __pyx_L1_error)
    }
    __pyx_L45:;

    /* "src/lxml/classlookup.pxi":80
 *                         attrib, nsmap, _extra)
 *         last_child = None
 *         for child in children:             # <<<<<<<<<<<<<<
 *             if _isString(child):
 *                 if last_child is None:
*/
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/classlookup.pxi":42
 *     hierarchies that implement a common namespace.
 *     """
 *     def __init__(self, *children, attrib=None, nsmap=None, **_extra):             # <<<<<<<<<<<<<<
 *         """ElementBase(*children, attrib=None, nsmap=None, **_extra)
 *         """
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_AddTraceback("lxml.etree.ElementBase.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_parser);
  __Pyx_XDECREF((PyObject *)__pyx_v_last_child);
  __Pyx_XDECREF(__pyx_v__getattr);
  __Pyx_XDECREF(__pyx_v_namespace);
  __Pyx_XDECREF(__pyx_v_ns);
  __Pyx_XDECREF(__pyx_v_tag);
  __Pyx_XDECREF(__pyx_v_child);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/classlookup.pxi":109
 *     called after object creation.
 *     """
 *     def __init__(self, text):             # <<<<<<<<<<<<<<
 *         # copied from Comment() factory
 *         cdef _Document doc
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_11CommentBase_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_11CommentBase_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_text = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_text,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(10, 109, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(10, 109, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(10, 109, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, i); __PYX_ERR(10, 109, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(10, 109, __pyx_L3_error)
    }
    __pyx_v_text = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, __pyx_nargs); __PYX_ERR(10, 109, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.CommentBase.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_11CommentBase___init__(((struct __pyx_obj_4lxml_5etree_CommentBase *)__pyx_v_self), __pyx_v_text);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_11CommentBase___init__(struct __pyx_obj_4lxml_5etree_CommentBase *__pyx_v_self, PyObject *__pyx_v_text) {
  struct LxmlDocument *__pyx_v_doc = 0;
  xmlDoc *__pyx_v_c_doc;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  xmlDoc *__pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_INCREF(__pyx_v_text);

  /* "src/lxml/classlookup.pxi":113
 *         cdef _Document doc
 *         cdef xmlDoc*   c_doc
 *         if text is None:             # <<<<<<<<<<<<<<
 *             text = b''
 *         else:
*/
  __pyx_t_1 = (__pyx_v_text == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/classlookup.pxi":114
 *         cdef xmlDoc*   c_doc
 *         if text is None:
 *             text = b''             # <<<<<<<<<<<<<<
 *         else:
 *             text = _utf8(text)
*/
    __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_b__8);
    __Pyx_DECREF_SET(__pyx_v_text, __pyx_mstate_global->__pyx_kp_b__8);

    /* "src/lxml/classlookup.pxi":113
 *         cdef _Document doc
 *         cdef xmlDoc*   c_doc
 *         if text is None:             # <<<<<<<<<<<<<<
 *             text = b''
 *         else:
*/
    goto __pyx_L3;
  }

  /* "src/lxml/classlookup.pxi":116
 *             text = b''
 *         else:
 *             text = _utf8(text)             # <<<<<<<<<<<<<<
 *         c_doc = _newXMLDoc()
 *         doc = _documentFactory(c_doc, None)
*/
  /*else*/ {
    __pyx_t_2 = __pyx_f_4lxml_5etree__utf8(__pyx_v_text); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 116, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_text, __pyx_t_2);
    __pyx_t_2 = 0;
  }
  __pyx_L3:;

  /* "src/lxml/classlookup.pxi":117
 *         else:
 *             text = _utf8(text)
 *         c_doc = _newXMLDoc()             # <<<<<<<<<<<<<<
 *         doc = _documentFactory(c_doc, None)
 *         self._c_node = _createComment(c_doc, _xcstr(text))
*/
  __pyx_t_3 = __pyx_f_4lxml_5etree__newXMLDoc(); if (unlikely(__pyx_t_3 == ((void *)NULL))) __PYX_ERR(10, 117, __pyx_L1_error)
  __pyx_v_c_doc = __pyx_t_3;

  /* "src/lxml/classlookup.pxi":118
 *             text = _utf8(text)
 *         c_doc = _newXMLDoc()
 *         doc = _documentFactory(c_doc, None)             # <<<<<<<<<<<<<<
 *         self._c_node = _createComment(c_doc, _xcstr(text))
 *         if self._c_node is NULL:
*/
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None))); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 118, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/classlookup.pxi":119
 *         c_doc = _newXMLDoc()
 *         doc = _documentFactory(c_doc, None)
 *         self._c_node = _createComment(c_doc, _xcstr(text))             # <<<<<<<<<<<<<<
 *         if self._c_node is NULL:
 *             raise MemoryError()
*/
  __pyx_v_self->__pyx_base.__pyx_base.__pyx_base._c_node = __pyx_f_4lxml_5etree__createComment(__pyx_v_c_doc, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_text));

  /* "src/lxml/classlookup.pxi":120
 *         doc = _documentFactory(c_doc, None)
 *         self._c_node = _createComment(c_doc, _xcstr(text))
 *         if self._c_node is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 *         tree.xmlAddChild(<xmlNode*>c_doc, self._c_node)
*/
  __pyx_t_1 = (__pyx_v_self->__pyx_base.__pyx_base.__pyx_base._c_node == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/classlookup.pxi":121
 *         self._c_node = _createComment(c_doc, _xcstr(text))
 *         if self._c_node is NULL:
 *             raise MemoryError()             # <<<<<<<<<<<<<<
 *         tree.xmlAddChild(<xmlNode*>c_doc, self._c_node)
 *         _registerProxy(self, doc, self._c_node)
*/
    PyErr_NoMemory(); __PYX_ERR(10, 121, __pyx_L1_error)

    /* "src/lxml/classlookup.pxi":120
 *         doc = _documentFactory(c_doc, None)
 *         self._c_node = _createComment(c_doc, _xcstr(text))
 *         if self._c_node is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 *         tree.xmlAddChild(<xmlNode*>c_doc, self._c_node)
*/
  }

  /* "src/lxml/classlookup.pxi":122
 *         if self._c_node is NULL:
 *             raise MemoryError()
 *         tree.xmlAddChild(<xmlNode*>c_doc, self._c_node)             # <<<<<<<<<<<<<<
 *         _registerProxy(self, doc, self._c_node)
 *         self._init()
*/
  (void)(xmlAddChild(((xmlNode *)__pyx_v_c_doc), __pyx_v_self->__pyx_base.__pyx_base.__pyx_base._c_node));

  /* "src/lxml/classlookup.pxi":123
 *             raise MemoryError()
 *         tree.xmlAddChild(<xmlNode*>c_doc, self._c_node)
 *         _registerProxy(self, doc, self._c_node)             # <<<<<<<<<<<<<<
 *         self._init()
 * 
*/
  __pyx_t_4 = __pyx_f_4lxml_5etree__registerProxy(((struct LxmlElement *)__pyx_v_self), __pyx_v_doc, __pyx_v_self->__pyx_base.__pyx_base.__pyx_base._c_node); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(10, 123, __pyx_L1_error)

  /* "src/lxml/classlookup.pxi":124
 *         tree.xmlAddChild(<xmlNode*>c_doc, self._c_node)
 *         _registerProxy(self, doc, self._c_node)
 *         self._init()             # <<<<<<<<<<<<<<
 * 
 * cdef class PIBase(_ProcessingInstruction):
*/
  __pyx_t_5 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_5);
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};
    __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_init_2, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 124, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/classlookup.pxi":109
 *     called after object creation.
 *     """
 *     def __init__(self, text):             # <<<<<<<<<<<<<<
 *         # copied from Comment() factory
 *         cdef _Document doc
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree.CommentBase.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XDECREF(__pyx_v_text);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/classlookup.pxi":139
 *     called after object creation.
 *     """
 *     def __init__(self, target, text=None):             # <<<<<<<<<<<<<<
 *         # copied from PI() factory
 *         cdef _Document doc
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_6PIBase_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_6PIBase_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_target = 0;
  PyObject *__pyx_v_text = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_target,&__pyx_mstate_global->__pyx_n_u_text,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(10, 139, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(10, 139, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(10, 139, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(10, 139, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, i); __PYX_ERR(10, 139, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(10, 139, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(10, 139, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_target = values[0];
    __pyx_v_text = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, __pyx_nargs); __PYX_ERR(10, 139, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.PIBase.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_6PIBase___init__(((struct __pyx_obj_4lxml_5etree_PIBase *)__pyx_v_self), __pyx_v_target, __pyx_v_text);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_6PIBase___init__(struct __pyx_obj_4lxml_5etree_PIBase *__pyx_v_self, PyObject *__pyx_v_target, PyObject *__pyx_v_text) {
  struct LxmlDocument *__pyx_v_doc = 0;
  xmlDoc *__pyx_v_c_doc;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  xmlDoc *__pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_INCREF(__pyx_v_target);
  __Pyx_INCREF(__pyx_v_text);

  /* "src/lxml/classlookup.pxi":143
 *         cdef _Document doc
 *         cdef xmlDoc*   c_doc
 *         target = _utf8(target)             # <<<<<<<<<<<<<<
 *         if text is None:
 *             text = b''
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__utf8(__pyx_v_target); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_target, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/classlookup.pxi":144
 *         cdef xmlDoc*   c_doc
 *         target = _utf8(target)
 *         if text is None:             # <<<<<<<<<<<<<<
 *             text = b''
 *         else:
*/
  __pyx_t_2 = (__pyx_v_text == Py_None);
  if (__pyx_t_2) {

    /* "src/lxml/classlookup.pxi":145
 *         target = _utf8(target)
 *         if text is None:
 *             text = b''             # <<<<<<<<<<<<<<
 *         else:
 *             text = _utf8(text)
*/
    __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_b__8);
    __Pyx_DECREF_SET(__pyx_v_text, __pyx_mstate_global->__pyx_kp_b__8);

    /* "src/lxml/classlookup.pxi":144
 *         cdef xmlDoc*   c_doc
 *         target = _utf8(target)
 *         if text is None:             # <<<<<<<<<<<<<<
 *             text = b''
 *         else:
*/
    goto __pyx_L3;
  }

  /* "src/lxml/classlookup.pxi":147
 *             text = b''
 *         else:
 *             text = _utf8(text)             # <<<<<<<<<<<<<<
 *         c_doc = _newXMLDoc()
 *         doc = _documentFactory(c_doc, None)
*/
  /*else*/ {
    __pyx_t_1 = __pyx_f_4lxml_5etree__utf8(__pyx_v_text); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 147, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_text, __pyx_t_1);
    __pyx_t_1 = 0;
  }
  __pyx_L3:;

  /* "src/lxml/classlookup.pxi":148
 *         else:
 *             text = _utf8(text)
 *         c_doc = _newXMLDoc()             # <<<<<<<<<<<<<<
 *         doc = _documentFactory(c_doc, None)
 *         self._c_node = _createPI(c_doc, _xcstr(target), _xcstr(text))
*/
  __pyx_t_3 = __pyx_f_4lxml_5etree__newXMLDoc(); if (unlikely(__pyx_t_3 == ((void *)NULL))) __PYX_ERR(10, 148, __pyx_L1_error)
  __pyx_v_c_doc = __pyx_t_3;

  /* "src/lxml/classlookup.pxi":149
 *             text = _utf8(text)
 *         c_doc = _newXMLDoc()
 *         doc = _documentFactory(c_doc, None)             # <<<<<<<<<<<<<<
 *         self._c_node = _createPI(c_doc, _xcstr(target), _xcstr(text))
 *         if self._c_node is NULL:
*/
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None))); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 149, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/classlookup.pxi":150
 *         c_doc = _newXMLDoc()
 *         doc = _documentFactory(c_doc, None)
 *         self._c_node = _createPI(c_doc, _xcstr(target), _xcstr(text))             # <<<<<<<<<<<<<<
 *         if self._c_node is NULL:
 *             raise MemoryError()
*/
  __pyx_v_self->__pyx_base.__pyx_base.__pyx_base._c_node = __pyx_f_4lxml_5etree__createPI(__pyx_v_c_doc, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_target), (const xmlChar*)PyBytes_AS_STRING(__pyx_v_text));

  /* "src/lxml/classlookup.pxi":151
 *         doc = _documentFactory(c_doc, None)
 *         self._c_node = _createPI(c_doc, _xcstr(target), _xcstr(text))
 *         if self._c_node is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 *         tree.xmlAddChild(<xmlNode*>c_doc, self._c_node)
*/
  __pyx_t_2 = (__pyx_v_self->__pyx_base.__pyx_base.__pyx_base._c_node == NULL);
  if (unlikely(__pyx_t_2)) {

    /* "src/lxml/classlookup.pxi":152
 *         self._c_node = _createPI(c_doc, _xcstr(target), _xcstr(text))
 *         if self._c_node is NULL:
 *             raise MemoryError()             # <<<<<<<<<<<<<<
 *         tree.xmlAddChild(<xmlNode*>c_doc, self._c_node)
 *         _registerProxy(self, doc, self._c_node)
*/
    PyErr_NoMemory(); __PYX_ERR(10, 152, __pyx_L1_error)

    /* "src/lxml/classlookup.pxi":151
 *         doc = _documentFactory(c_doc, None)
 *         self._c_node = _createPI(c_doc, _xcstr(target), _xcstr(text))
 *         if self._c_node is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 *         tree.xmlAddChild(<xmlNode*>c_doc, self._c_node)
*/
  }

  /* "src/lxml/classlookup.pxi":153
 *         if self._c_node is NULL:
 *             raise MemoryError()
 *         tree.xmlAddChild(<xmlNode*>c_doc, self._c_node)             # <<<<<<<<<<<<<<
 *         _registerProxy(self, doc, self._c_node)
 *         self._init()
*/
  (void)(xmlAddChild(((xmlNode *)__pyx_v_c_doc), __pyx_v_self->__pyx_base.__pyx_base.__pyx_base._c_node));

  /* "src/lxml/classlookup.pxi":154
 *             raise MemoryError()
 *         tree.xmlAddChild(<xmlNode*>c_doc, self._c_node)
 *         _registerProxy(self, doc, self._c_node)             # <<<<<<<<<<<<<<
 *         self._init()
 * 
*/
  __pyx_t_4 = __pyx_f_4lxml_5etree__registerProxy(((struct LxmlElement *)__pyx_v_self), __pyx_v_doc, __pyx_v_self->__pyx_base.__pyx_base.__pyx_base._c_node); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(10, 154, __pyx_L1_error)

  /* "src/lxml/classlookup.pxi":155
 *         tree.xmlAddChild(<xmlNode*>c_doc, self._c_node)
 *         _registerProxy(self, doc, self._c_node)
 *         self._init()             # <<<<<<<<<<<<<<
 * 
 * cdef class EntityBase(_Entity):
*/
  __pyx_t_5 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_5);
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_init_2, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 155, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/classlookup.pxi":139
 *     called after object creation.
 *     """
 *     def __init__(self, target, text=None):             # <<<<<<<<<<<<<<
 *         # copied from PI() factory
 *         cdef _Document doc
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree.PIBase.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XDECREF(__pyx_v_target);
  __Pyx_XDECREF(__pyx_v_text);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/classlookup.pxi":169
 *     called after object creation.
 *     """
 *     def __init__(self, name):             # <<<<<<<<<<<<<<
 *         cdef _Document doc
 *         cdef xmlDoc*   c_doc
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_10EntityBase_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_10EntityBase_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_name,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(10, 169, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(10, 169, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(10, 169, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, i); __PYX_ERR(10, 169, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(10, 169, __pyx_L3_error)
    }
    __pyx_v_name = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, __pyx_nargs); __PYX_ERR(10, 169, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.EntityBase.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_10EntityBase___init__(((struct __pyx_obj_4lxml_5etree_EntityBase *)__pyx_v_self), __pyx_v_name);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_10EntityBase___init__(struct __pyx_obj_4lxml_5etree_EntityBase *__pyx_v_self, PyObject *__pyx_v_name) {
  struct LxmlDocument *__pyx_v_doc = 0;
  xmlDoc *__pyx_v_c_doc;
  PyObject *__pyx_v_name_utf = NULL;
  const xmlChar *__pyx_v_c_name;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3[3];
  PyObject *__pyx_t_4 = NULL;
  xmlDoc *__pyx_t_5;
  int __pyx_t_6;
  size_t __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "src/lxml/classlookup.pxi":172
 *         cdef _Document doc
 *         cdef xmlDoc*   c_doc
 *         name_utf = _utf8(name)             # <<<<<<<<<<<<<<
 *         c_name = _xcstr(name_utf)
 *         if c_name[0] == c'#':
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__utf8(__pyx_v_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 172, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_name_utf = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/classlookup.pxi":173
 *         cdef xmlDoc*   c_doc
 *         name_utf = _utf8(name)
 *         c_name = _xcstr(name_utf)             # <<<<<<<<<<<<<<
 *         if c_name[0] == c'#':
 *             if not _characterReferenceIsValid(c_name + 1):
*/
  __pyx_v_c_name = (const xmlChar*)PyBytes_AS_STRING(__pyx_v_name_utf);

  /* "src/lxml/classlookup.pxi":174
 *         name_utf = _utf8(name)
 *         c_name = _xcstr(name_utf)
 *         if c_name[0] == c'#':             # <<<<<<<<<<<<<<
 *             if not _characterReferenceIsValid(c_name + 1):
 *                 raise ValueError, f"Invalid character reference: '{name}'"
*/
  __pyx_t_2 = ((__pyx_v_c_name[0]) == '#');
  if (__pyx_t_2) {

    /* "src/lxml/classlookup.pxi":175
 *         c_name = _xcstr(name_utf)
 *         if c_name[0] == c'#':
 *             if not _characterReferenceIsValid(c_name + 1):             # <<<<<<<<<<<<<<
 *                 raise ValueError, f"Invalid character reference: '{name}'"
 *         elif not _xmlNameIsValid(c_name):
*/
    __pyx_t_2 = (!__pyx_f_4lxml_5etree__characterReferenceIsValid((__pyx_v_c_name + 1)));
    if (unlikely(__pyx_t_2)) {

      /* "src/lxml/classlookup.pxi":176
 *         if c_name[0] == c'#':
 *             if not _characterReferenceIsValid(c_name + 1):
 *                 raise ValueError, f"Invalid character reference: '{name}'"             # <<<<<<<<<<<<<<
 *         elif not _xmlNameIsValid(c_name):
 *             raise ValueError, f"Invalid entity reference: '{name}'"
*/
      __pyx_t_1 = __Pyx_PyObject_FormatSimple(__pyx_v_name, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 176, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3[0] = __pyx_mstate_global->__pyx_kp_u_Invalid_character_reference;
      __pyx_t_3[1] = __pyx_t_1;
      __pyx_t_3[2] = __pyx_mstate_global->__pyx_kp_u__4;
      __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, 30 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1));
      if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 176, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_t_4, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __PYX_ERR(10, 176, __pyx_L1_error)

      /* "src/lxml/classlookup.pxi":175
 *         c_name = _xcstr(name_utf)
 *         if c_name[0] == c'#':
 *             if not _characterReferenceIsValid(c_name + 1):             # <<<<<<<<<<<<<<
 *                 raise ValueError, f"Invalid character reference: '{name}'"
 *         elif not _xmlNameIsValid(c_name):
*/
    }

    /* "src/lxml/classlookup.pxi":174
 *         name_utf = _utf8(name)
 *         c_name = _xcstr(name_utf)
 *         if c_name[0] == c'#':             # <<<<<<<<<<<<<<
 *             if not _characterReferenceIsValid(c_name + 1):
 *                 raise ValueError, f"Invalid character reference: '{name}'"
*/
    goto __pyx_L3;
  }

  /* "src/lxml/classlookup.pxi":177
 *             if not _characterReferenceIsValid(c_name + 1):
 *                 raise ValueError, f"Invalid character reference: '{name}'"
 *         elif not _xmlNameIsValid(c_name):             # <<<<<<<<<<<<<<
 *             raise ValueError, f"Invalid entity reference: '{name}'"
 *         c_doc = _newXMLDoc()
*/
  __pyx_t_2 = (!(__pyx_f_4lxml_5etree__xmlNameIsValid(__pyx_v_c_name) != 0));
  if (unlikely(__pyx_t_2)) {

    /* "src/lxml/classlookup.pxi":178
 *                 raise ValueError, f"Invalid character reference: '{name}'"
 *         elif not _xmlNameIsValid(c_name):
 *             raise ValueError, f"Invalid entity reference: '{name}'"             # <<<<<<<<<<<<<<
 *         c_doc = _newXMLDoc()
 *         doc = _documentFactory(c_doc, None)
*/
    __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_name, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 178, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3[0] = __pyx_mstate_global->__pyx_kp_u_Invalid_entity_reference;
    __pyx_t_3[1] = __pyx_t_4;
    __pyx_t_3[2] = __pyx_mstate_global->__pyx_kp_u__4;
    __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, 27 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4));
    if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 178, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_t_1, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(10, 178, __pyx_L1_error)

    /* "src/lxml/classlookup.pxi":177
 *             if not _characterReferenceIsValid(c_name + 1):
 *                 raise ValueError, f"Invalid character reference: '{name}'"
 *         elif not _xmlNameIsValid(c_name):             # <<<<<<<<<<<<<<
 *             raise ValueError, f"Invalid entity reference: '{name}'"
 *         c_doc = _newXMLDoc()
*/
  }
  __pyx_L3:;

  /* "src/lxml/classlookup.pxi":179
 *         elif not _xmlNameIsValid(c_name):
 *             raise ValueError, f"Invalid entity reference: '{name}'"
 *         c_doc = _newXMLDoc()             # <<<<<<<<<<<<<<
 *         doc = _documentFactory(c_doc, None)
 *         self._c_node = _createEntity(c_doc, c_name)
*/
  __pyx_t_5 = __pyx_f_4lxml_5etree__newXMLDoc(); if (unlikely(__pyx_t_5 == ((void *)NULL))) __PYX_ERR(10, 179, __pyx_L1_error)
  __pyx_v_c_doc = __pyx_t_5;

  /* "src/lxml/classlookup.pxi":180
 *             raise ValueError, f"Invalid entity reference: '{name}'"
 *         c_doc = _newXMLDoc()
 *         doc = _documentFactory(c_doc, None)             # <<<<<<<<<<<<<<
 *         self._c_node = _createEntity(c_doc, c_name)
 *         if self._c_node is NULL:
*/
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None))); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 180, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/classlookup.pxi":181
 *         c_doc = _newXMLDoc()
 *         doc = _documentFactory(c_doc, None)
 *         self._c_node = _createEntity(c_doc, c_name)             # <<<<<<<<<<<<<<
 *         if self._c_node is NULL:
 *             raise MemoryError()
*/
  __pyx_v_self->__pyx_base.__pyx_base.__pyx_base._c_node = __pyx_f_4lxml_5etree__createEntity(__pyx_v_c_doc, __pyx_v_c_name);

  /* "src/lxml/classlookup.pxi":182
 *         doc = _documentFactory(c_doc, None)
 *         self._c_node = _createEntity(c_doc, c_name)
 *         if self._c_node is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 *         tree.xmlAddChild(<xmlNode*>c_doc, self._c_node)
*/
  __pyx_t_2 = (__pyx_v_self->__pyx_base.__pyx_base.__pyx_base._c_node == NULL);
  if (unlikely(__pyx_t_2)) {

    /* "src/lxml/classlookup.pxi":183
 *         self._c_node = _createEntity(c_doc, c_name)
 *         if self._c_node is NULL:
 *             raise MemoryError()             # <<<<<<<<<<<<<<
 *         tree.xmlAddChild(<xmlNode*>c_doc, self._c_node)
 *         _registerProxy(self, doc, self._c_node)
*/
    PyErr_NoMemory(); __PYX_ERR(10, 183, __pyx_L1_error)

    /* "src/lxml/classlookup.pxi":182
 *         doc = _documentFactory(c_doc, None)
 *         self._c_node = _createEntity(c_doc, c_name)
 *         if self._c_node is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 *         tree.xmlAddChild(<xmlNode*>c_doc, self._c_node)
*/
  }

  /* "src/lxml/classlookup.pxi":184
 *         if self._c_node is NULL:
 *             raise MemoryError()
 *         tree.xmlAddChild(<xmlNode*>c_doc, self._c_node)             # <<<<<<<<<<<<<<
 *         _registerProxy(self, doc, self._c_node)
 *         self._init()
*/
  (void)(xmlAddChild(((xmlNode *)__pyx_v_c_doc), __pyx_v_self->__pyx_base.__pyx_base.__pyx_base._c_node));

  /* "src/lxml/classlookup.pxi":185
 *             raise MemoryError()
 *         tree.xmlAddChild(<xmlNode*>c_doc, self._c_node)
 *         _registerProxy(self, doc, self._c_node)             # <<<<<<<<<<<<<<
 *         self._init()
 * 
*/
  __pyx_t_6 = __pyx_f_4lxml_5etree__registerProxy(((struct LxmlElement *)__pyx_v_self), __pyx_v_doc, __pyx_v_self->__pyx_base.__pyx_base.__pyx_base._c_node); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(10, 185, __pyx_L1_error)

  /* "src/lxml/classlookup.pxi":186
 *         tree.xmlAddChild(<xmlNode*>c_doc, self._c_node)
 *         _registerProxy(self, doc, self._c_node)
 *         self._init()             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_4 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_7 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_init_2, __pyx_callargs+__pyx_t_7, (1-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 186, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/classlookup.pxi":169
 *     called after object creation.
 *     """
 *     def __init__(self, name):             # <<<<<<<<<<<<<<
 *         cdef _Document doc
 *         cdef xmlDoc*   c_doc
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.EntityBase.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XDECREF(__pyx_v_name_utf);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/classlookup.pxi":189
 * 
 * 
 * cdef int _validateNodeClass(xmlNode* c_node, cls) except -1:             # <<<<<<<<<<<<<<
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         expected = ElementBase
*/

static int __pyx_f_4lxml_5etree__validateNodeClass(xmlNode *__pyx_v_c_node, PyObject *__pyx_v_cls) {
  PyTypeObject *__pyx_v_expected = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7[4];
  PyObject *__pyx_t_8 = NULL;
  size_t __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_validateNodeClass", 0);

  /* "src/lxml/classlookup.pxi":190
 * 
 * cdef int _validateNodeClass(xmlNode* c_node, cls) except -1:
 *     if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         expected = ElementBase
 *     elif c_node.type == tree.XML_COMMENT_NODE:
*/
  switch (__pyx_v_c_node->type) {
    case XML_ELEMENT_NODE:

    /* "src/lxml/classlookup.pxi":191
 * cdef int _validateNodeClass(xmlNode* c_node, cls) except -1:
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         expected = ElementBase             # <<<<<<<<<<<<<<
 *     elif c_node.type == tree.XML_COMMENT_NODE:
 *         expected = CommentBase
*/
    __Pyx_INCREF((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_ElementBase);
    __pyx_v_expected = __pyx_mstate_global->__pyx_ptype_4lxml_5etree_ElementBase;

    /* "src/lxml/classlookup.pxi":190
 * 
 * cdef int _validateNodeClass(xmlNode* c_node, cls) except -1:
 *     if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         expected = ElementBase
 *     elif c_node.type == tree.XML_COMMENT_NODE:
*/
    break;
    case XML_COMMENT_NODE:

    /* "src/lxml/classlookup.pxi":193
 *         expected = ElementBase
 *     elif c_node.type == tree.XML_COMMENT_NODE:
 *         expected = CommentBase             # <<<<<<<<<<<<<<
 *     elif c_node.type == tree.XML_ENTITY_REF_NODE:
 *         expected = EntityBase
*/
    __Pyx_INCREF((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_CommentBase);
    __pyx_v_expected = __pyx_mstate_global->__pyx_ptype_4lxml_5etree_CommentBase;

    /* "src/lxml/classlookup.pxi":192
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         expected = ElementBase
 *     elif c_node.type == tree.XML_COMMENT_NODE:             # <<<<<<<<<<<<<<
 *         expected = CommentBase
 *     elif c_node.type == tree.XML_ENTITY_REF_NODE:
*/
    break;
    case XML_ENTITY_REF_NODE:

    /* "src/lxml/classlookup.pxi":195
 *         expected = CommentBase
 *     elif c_node.type == tree.XML_ENTITY_REF_NODE:
 *         expected = EntityBase             # <<<<<<<<<<<<<<
 *     elif c_node.type == tree.XML_PI_NODE:
 *         expected = PIBase
*/
    __Pyx_INCREF((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_EntityBase);
    __pyx_v_expected = __pyx_mstate_global->__pyx_ptype_4lxml_5etree_EntityBase;

    /* "src/lxml/classlookup.pxi":194
 *     elif c_node.type == tree.XML_COMMENT_NODE:
 *         expected = CommentBase
 *     elif c_node.type == tree.XML_ENTITY_REF_NODE:             # <<<<<<<<<<<<<<
 *         expected = EntityBase
 *     elif c_node.type == tree.XML_PI_NODE:
*/
    break;
    case XML_PI_NODE:

    /* "src/lxml/classlookup.pxi":197
 *         expected = EntityBase
 *     elif c_node.type == tree.XML_PI_NODE:
 *         expected = PIBase             # <<<<<<<<<<<<<<
 *     else:
 *         assert False, f"Unknown node type: {c_node.type}"
*/
    __Pyx_INCREF((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_PIBase);
    __pyx_v_expected = __pyx_mstate_global->__pyx_ptype_4lxml_5etree_PIBase;

    /* "src/lxml/classlookup.pxi":196
 *     elif c_node.type == tree.XML_ENTITY_REF_NODE:
 *         expected = EntityBase
 *     elif c_node.type == tree.XML_PI_NODE:             # <<<<<<<<<<<<<<
 *         expected = PIBase
 *     else:
*/
    break;
    default:

    /* "src/lxml/classlookup.pxi":199
 *         expected = PIBase
 *     else:
 *         assert False, f"Unknown node type: {c_node.type}"             # <<<<<<<<<<<<<<
 * 
 *     if not (isinstance(cls, type) and issubclass(cls, expected)):
*/
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(__pyx_assertions_enabled())) {
      if (unlikely(!0)) {
        __pyx_t_1 = __Pyx_PyUnicode_From_xmlElementType(__pyx_v_c_node->type, 0, ' ', 'd'); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 199, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_Unknown_node_type, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 199, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_t_2, 0, 0);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __PYX_ERR(10, 199, __pyx_L1_error)
      }
    }
    #else
    if ((1)); else __PYX_ERR(10, 199, __pyx_L1_error)
    #endif
    break;
  }

  /* "src/lxml/classlookup.pxi":201
 *         assert False, f"Unknown node type: {c_node.type}"
 * 
 *     if not (isinstance(cls, type) and issubclass(cls, expected)):             # <<<<<<<<<<<<<<
 *         raise TypeError(
 *             f"result of class lookup must be subclass of {type(expected)}, got {type(cls)}")
*/
  __pyx_t_4 = PyType_Check(__pyx_v_cls); 
  if (__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  if (unlikely(!__pyx_v_expected)) { __Pyx_RaiseUnboundLocalError("expected"); __PYX_ERR(10, 201, __pyx_L1_error) }
  __pyx_t_4 = PyObject_IsSubclass(__pyx_v_cls, ((PyObject *)__pyx_v_expected)); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(10, 201, __pyx_L1_error)
  __pyx_t_3 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  __pyx_t_4 = (!__pyx_t_3);
  if (unlikely(__pyx_t_4)) {

    /* "src/lxml/classlookup.pxi":202
 * 
 *     if not (isinstance(cls, type) and issubclass(cls, expected)):
 *         raise TypeError(             # <<<<<<<<<<<<<<
 *             f"result of class lookup must be subclass of {type(expected)}, got {type(cls)}")
 *     return 0
*/
    __pyx_t_1 = NULL;

    /* "src/lxml/classlookup.pxi":203
 *     if not (isinstance(cls, type) and issubclass(cls, expected)):
 *         raise TypeError(
 *             f"result of class lookup must be subclass of {type(expected)}, got {type(cls)}")             # <<<<<<<<<<<<<<
 *     return 0
 * 
*/
    if (unlikely(!__pyx_v_expected)) { __Pyx_RaiseUnboundLocalError("expected"); __PYX_ERR(10, 203, __pyx_L1_error) }
    __pyx_t_5 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_expected))), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(10, 203, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(__pyx_v_cls)), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 203, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7[0] = __pyx_mstate_global->__pyx_kp_u_result_of_class_lookup_must_be_s;
    __pyx_t_7[1] = __pyx_t_5;
    __pyx_t_7[2] = __pyx_mstate_global->__pyx_kp_u_got_2;
    __pyx_t_7[3] = __pyx_t_6;
    __pyx_t_8 = __Pyx_PyUnicode_Join(__pyx_t_7, 4, 43 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 6 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6));
    if (unlikely(!__pyx_t_8)) __PYX_ERR(10, 203, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_9 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_8};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 202, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(10, 202, __pyx_L1_error)

    /* "src/lxml/classlookup.pxi":201
 *         assert False, f"Unknown node type: {c_node.type}"
 * 
 *     if not (isinstance(cls, type) and issubclass(cls, expected)):             # <<<<<<<<<<<<<<
 *         raise TypeError(
 *             f"result of class lookup must be subclass of {type(expected)}, got {type(cls)}")
*/
  }

  /* "src/lxml/classlookup.pxi":204
 *         raise TypeError(
 *             f"result of class lookup must be subclass of {type(expected)}, got {type(cls)}")
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/classlookup.pxi":189
 * 
 * 
 * cdef int _validateNodeClass(xmlNode* c_node, cls) except -1:             # <<<<<<<<<<<<<<
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         expected = ElementBase
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("lxml.etree._validateNodeClass", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_expected);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/classlookup.pxi":230
 *     cdef readonly ElementClassLookup fallback
 *     cdef _element_class_lookup_function _fallback_function
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         # fall back to default lookup
 *         self._fallback_function = _lookupDefaultElementClass
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_26FallbackElementClassLookup_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_26FallbackElementClassLookup_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, __pyx_nargs); return -1; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return -1;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__cinit__", __pyx_kwds); return -1;}
  __pyx_r = __pyx_pf_4lxml_5etree_26FallbackElementClassLookup___cinit__(((struct LxmlFallbackElementClassLookup *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_26FallbackElementClassLookup___cinit__(struct LxmlFallbackElementClassLookup *__pyx_v_self) {
  int __pyx_r;

  /* "src/lxml/classlookup.pxi":232
 *     def __cinit__(self):
 *         # fall back to default lookup
 *         self._fallback_function = _lookupDefaultElementClass             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, ElementClassLookup fallback=None):
*/
  __pyx_v_self->_fallback_function = __pyx_f_4lxml_5etree__lookupDefaultElementClass;

  /* "src/lxml/classlookup.pxi":230
 *     cdef readonly ElementClassLookup fallback
 *     cdef _element_class_lookup_function _fallback_function
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         # fall back to default lookup
 *         self._fallback_function = _lookupDefaultElementClass
*/

  /* function exit code */
  __pyx_r = 0;
  return __pyx_r;
}

/* "src/lxml/classlookup.pxi":234
 *         self._fallback_function = _lookupDefaultElementClass
 * 
 *     def __init__(self, ElementClassLookup fallback=None):             # <<<<<<<<<<<<<<
 *         if fallback is not None:
 *             self._setFallback(fallback)
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_26FallbackElementClassLookup_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_26FallbackElementClassLookup_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct LxmlElementClassLookup *__pyx_v_fallback = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_fallback,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(10, 234, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(10, 234, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(10, 234, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef((PyObject *)((struct LxmlElementClassLookup *)Py_None));
    } else {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(10, 234, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef((PyObject *)((struct LxmlElementClassLookup *)Py_None));
    }
    __pyx_v_fallback = ((struct LxmlElementClassLookup *)values[0]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, __pyx_nargs); __PYX_ERR(10, 234, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.FallbackElementClassLookup.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fallback), __pyx_mstate_global->__pyx_ptype_4lxml_5etree_ElementClassLookup, 1, "fallback", 0))) __PYX_ERR(10, 234, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_26FallbackElementClassLookup_2__init__(((struct LxmlFallbackElementClassLookup *)__pyx_v_self), __pyx_v_fallback);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_26FallbackElementClassLookup_2__init__(struct LxmlFallbackElementClassLookup *__pyx_v_self, struct LxmlElementClassLookup *__pyx_v_fallback) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/classlookup.pxi":235
 * 
 *     def __init__(self, ElementClassLookup fallback=None):
 *         if fallback is not None:             # <<<<<<<<<<<<<<
 *             self._setFallback(fallback)
 *         else:
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_fallback) != Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/classlookup.pxi":236
 *     def __init__(self, ElementClassLookup fallback=None):
 *         if fallback is not None:
 *             self._setFallback(fallback)             # <<<<<<<<<<<<<<
 *         else:
 *             self._fallback_function = _lookupDefaultElementClass
*/
    ((struct __pyx_vtabstruct_4lxml_5etree_FallbackElementClassLookup *)__pyx_v_self->__pyx_vtab)->_setFallback(__pyx_v_self, __pyx_v_fallback); if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 236, __pyx_L1_error)

    /* "src/lxml/classlookup.pxi":235
 * 
 *     def __init__(self, ElementClassLookup fallback=None):
 *         if fallback is not None:             # <<<<<<<<<<<<<<
 *             self._setFallback(fallback)
 *         else:
*/
    goto __pyx_L3;
  }

  /* "src/lxml/classlookup.pxi":238
 *             self._setFallback(fallback)
 *         else:
 *             self._fallback_function = _lookupDefaultElementClass             # <<<<<<<<<<<<<<
 * 
 *     cdef void _setFallback(self, ElementClassLookup lookup):
*/
  /*else*/ {
    __pyx_v_self->_fallback_function = __pyx_f_4lxml_5etree__lookupDefaultElementClass;
  }
  __pyx_L3:;

  /* "src/lxml/classlookup.pxi":234
 *         self._fallback_function = _lookupDefaultElementClass
 * 
 *     def __init__(self, ElementClassLookup fallback=None):             # <<<<<<<<<<<<<<
 *         if fallback is not None:
 *             self._setFallback(fallback)
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.FallbackElementClassLookup.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/classlookup.pxi":240
 *             self._fallback_function = _lookupDefaultElementClass
 * 
 *     cdef void _setFallback(self, ElementClassLookup lookup):             # <<<<<<<<<<<<<<
 *         """Sets the fallback scheme for this lookup method.
 *         """
*/

static void __pyx_f_4lxml_5etree_26FallbackElementClassLookup__setFallback(struct LxmlFallbackElementClassLookup *__pyx_v_self, struct LxmlElementClassLookup *__pyx_v_lookup) {
  __Pyx_RefNannyDeclarations
  _element_class_lookup_function __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("_setFallback", 0);

  /* "src/lxml/classlookup.pxi":243
 *         """Sets the fallback scheme for this lookup method.
 *         """
 *         self.fallback = lookup             # <<<<<<<<<<<<<<
 *         self._fallback_function = lookup._lookup_function
 *         if self._fallback_function is NULL:
*/
  __Pyx_INCREF((PyObject *)__pyx_v_lookup);
  __Pyx_GIVEREF((PyObject *)__pyx_v_lookup);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->fallback);
  __Pyx_DECREF((PyObject *)__pyx_v_self->fallback);
  __pyx_v_self->fallback = __pyx_v_lookup;

  /* "src/lxml/classlookup.pxi":244
 *         """
 *         self.fallback = lookup
 *         self._fallback_function = lookup._lookup_function             # <<<<<<<<<<<<<<
 *         if self._fallback_function is NULL:
 *             self._fallback_function = _lookupDefaultElementClass
*/
  __pyx_t_1 = __pyx_v_lookup->_lookup_function;
  __pyx_v_self->_fallback_function = __pyx_t_1;

  /* "src/lxml/classlookup.pxi":245
 *         self.fallback = lookup
 *         self._fallback_function = lookup._lookup_function
 *         if self._fallback_function is NULL:             # <<<<<<<<<<<<<<
 *             self._fallback_function = _lookupDefaultElementClass
 * 
*/
  __pyx_t_2 = (__pyx_v_self->_fallback_function == NULL);
  if (__pyx_t_2) {

    /* "src/lxml/classlookup.pxi":246
 *         self._fallback_function = lookup._lookup_function
 *         if self._fallback_function is NULL:
 *             self._fallback_function = _lookupDefaultElementClass             # <<<<<<<<<<<<<<
 * 
 *     def set_fallback(self, ElementClassLookup lookup not None):
*/
    __pyx_v_self->_fallback_function = __pyx_f_4lxml_5etree__lookupDefaultElementClass;

    /* "src/lxml/classlookup.pxi":245
 *         self.fallback = lookup
 *         self._fallback_function = lookup._lookup_function
 *         if self._fallback_function is NULL:             # <<<<<<<<<<<<<<
 *             self._fallback_function = _lookupDefaultElementClass
 * 
*/
  }

  /* "src/lxml/classlookup.pxi":240
 *             self._fallback_function = _lookupDefaultElementClass
 * 
 *     cdef void _setFallback(self, ElementClassLookup lookup):             # <<<<<<<<<<<<<<
 *         """Sets the fallback scheme for this lookup method.
 *         """
*/

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "src/lxml/classlookup.pxi":248
 *             self._fallback_function = _lookupDefaultElementClass
 * 
 *     def set_fallback(self, ElementClassLookup lookup not None):             # <<<<<<<<<<<<<<
 *         """set_fallback(self, lookup)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_26FallbackElementClassLookup_5set_fallback(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_26FallbackElementClassLookup_4set_fallback, "set_fallback(self, lookup)\n\n        Sets the fallback scheme for this lookup method.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_26FallbackElementClassLookup_5set_fallback = {"set_fallback", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_26FallbackElementClassLookup_5set_fallback, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_26FallbackElementClassLookup_4set_fallback};
static PyObject *__pyx_pw_4lxml_5etree_26FallbackElementClassLookup_5set_fallback(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct LxmlElementClassLookup *__pyx_v_lookup = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_fallback (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_lookup,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(10, 248, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(10, 248, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "set_fallback", 0) < (0)) __PYX_ERR(10, 248, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("set_fallback", 1, 1, 1, i); __PYX_ERR(10, 248, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(10, 248, __pyx_L3_error)
    }
    __pyx_v_lookup = ((struct LxmlElementClassLookup *)values[0]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_fallback", 1, 1, 1, __pyx_nargs); __PYX_ERR(10, 248, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.FallbackElementClassLookup.set_fallback", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lookup), __pyx_mstate_global->__pyx_ptype_4lxml_5etree_ElementClassLookup, 0, "lookup", 0))) __PYX_ERR(10, 248, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_26FallbackElementClassLookup_4set_fallback(((struct LxmlFallbackElementClassLookup *)__pyx_v_self), __pyx_v_lookup);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_26FallbackElementClassLookup_4set_fallback(struct LxmlFallbackElementClassLookup *__pyx_v_self, struct LxmlElementClassLookup *__pyx_v_lookup) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_fallback", 0);

  /* "src/lxml/classlookup.pxi":253
 *         Sets the fallback scheme for this lookup method.
 *         """
 *         self._setFallback(lookup)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object _callLookupFallback(FallbackElementClassLookup lookup,
*/
  ((struct __pyx_vtabstruct_4lxml_5etree_FallbackElementClassLookup *)__pyx_v_self->__pyx_vtab)->_setFallback(__pyx_v_self, __pyx_v_lookup); if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 253, __pyx_L1_error)

  /* "src/lxml/classlookup.pxi":248
 *             self._fallback_function = _lookupDefaultElementClass
 * 
 *     def set_fallback(self, ElementClassLookup lookup not None):             # <<<<<<<<<<<<<<
 *         """set_fallback(self, lookup)
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.FallbackElementClassLookup.set_fallback", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/classlookup.pxi":228
 *     Superclass of Element class lookups with additional fallback.
 *     """
 *     cdef readonly ElementClassLookup fallback             # <<<<<<<<<<<<<<
 *     cdef _element_class_lookup_function _fallback_function
 *     def __cinit__(self):
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_26FallbackElementClassLookup_8fallback_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_26FallbackElementClassLookup_8fallback_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_26FallbackElementClassLookup_8fallback___get__(((struct LxmlFallbackElementClassLookup *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_26FallbackElementClassLookup_8fallback___get__(struct LxmlFallbackElementClassLookup *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_self->fallback);
  __pyx_r = ((PyObject *)__pyx_v_self->fallback);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/classlookup.pxi":255
 *         self._setFallback(lookup)
 * 
 * cdef inline object _callLookupFallback(FallbackElementClassLookup lookup,             # <<<<<<<<<<<<<<
 *                                        _Document doc, xmlNode* c_node):
 *     return lookup._fallback_function(lookup.fallback, doc, c_node)
*/

static CYTHON_INLINE PyObject *__pyx_f_4lxml_5etree__callLookupFallback(struct LxmlFallbackElementClassLookup *__pyx_v_lookup, struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_node) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_callLookupFallback", 0);

  /* "src/lxml/classlookup.pxi":257
 * cdef inline object _callLookupFallback(FallbackElementClassLookup lookup,
 *                                        _Document doc, xmlNode* c_node):
 *     return lookup._fallback_function(lookup.fallback, doc, c_node)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_v_lookup->fallback);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_v_lookup->_fallback_function(__pyx_t_1, __pyx_v_doc, __pyx_v_c_node); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 257, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/classlookup.pxi":255
 *         self._setFallback(lookup)
 * 
 * cdef inline object _callLookupFallback(FallbackElementClassLookup lookup,             # <<<<<<<<<<<<<<
 *                                        _Document doc, xmlNode* c_node):
 *     return lookup._fallback_function(lookup.fallback, doc, c_node)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._callLookupFallback", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/classlookup.pxi":275
 *     cdef readonly object pi_class
 *     cdef readonly object entity_class
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._lookup_function = _lookupDefaultElementClass
 * 
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_25ElementDefaultClassLookup_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_25ElementDefaultClassLookup_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, __pyx_nargs); return -1; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return -1;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__cinit__", __pyx_kwds); return -1;}
  __pyx_r = __pyx_pf_4lxml_5etree_25ElementDefaultClassLookup___cinit__(((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_25ElementDefaultClassLookup___cinit__(struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *__pyx_v_self) {
  int __pyx_r;

  /* "src/lxml/classlookup.pxi":276
 *     cdef readonly object entity_class
 *     def __cinit__(self):
 *         self._lookup_function = _lookupDefaultElementClass             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, element=None, comment=None, pi=None, entity=None):
*/
  __pyx_v_self->__pyx_base._lookup_function = __pyx_f_4lxml_5etree__lookupDefaultElementClass;

  /* "src/lxml/classlookup.pxi":275
 *     cdef readonly object pi_class
 *     cdef readonly object entity_class
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._lookup_function = _lookupDefaultElementClass
 * 
*/

  /* function exit code */
  __pyx_r = 0;
  return __pyx_r;
}

/* "src/lxml/classlookup.pxi":278
 *         self._lookup_function = _lookupDefaultElementClass
 * 
 *     def __init__(self, element=None, comment=None, pi=None, entity=None):             # <<<<<<<<<<<<<<
 *         if element is None:
 *             self.element_class = _Element
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_25ElementDefaultClassLookup_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_25ElementDefaultClassLookup_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_element = 0;
  PyObject *__pyx_v_comment = 0;
  PyObject *__pyx_v_pi = 0;
  PyObject *__pyx_v_entity = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[4] = {0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_element,&__pyx_mstate_global->__pyx_n_u_comment,&__pyx_mstate_global->__pyx_n_u_pi,&__pyx_mstate_global->__pyx_n_u_entity,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(10, 278, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  4:
        values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(10, 278, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(10, 278, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(10, 278, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(10, 278, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(10, 278, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
    } else {
      switch (__pyx_nargs) {
        case  4:
        values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(10, 278, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(10, 278, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(10, 278, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(10, 278, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_element = values[0];
    __pyx_v_comment = values[1];
    __pyx_v_pi = values[2];
    __pyx_v_entity = values[3];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 4, __pyx_nargs); __PYX_ERR(10, 278, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.ElementDefaultClassLookup.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_25ElementDefaultClassLookup_2__init__(((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_self), __pyx_v_element, __pyx_v_comment, __pyx_v_pi, __pyx_v_entity);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_25ElementDefaultClassLookup_2__init__(struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *__pyx_v_self, PyObject *__pyx_v_element, PyObject *__pyx_v_comment, PyObject *__pyx_v_pi, PyObject *__pyx_v_entity) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "src/lxml/classlookup.pxi":279
 * 
 *     def __init__(self, element=None, comment=None, pi=None, entity=None):
 *         if element is None:             # <<<<<<<<<<<<<<
 *             self.element_class = _Element
 *         elif issubclass(element, ElementBase):
*/
  __pyx_t_1 = (__pyx_v_element == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/classlookup.pxi":280
 *     def __init__(self, element=None, comment=None, pi=None, entity=None):
 *         if element is None:
 *             self.element_class = _Element             # <<<<<<<<<<<<<<
 *         elif issubclass(element, ElementBase):
 *             self.element_class = element
*/
    __Pyx_INCREF((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element);
    __Pyx_GIVEREF((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element);
    __Pyx_GOTREF(__pyx_v_self->element_class);
    __Pyx_DECREF(__pyx_v_self->element_class);
    __pyx_v_self->element_class = ((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element);

    /* "src/lxml/classlookup.pxi":279
 * 
 *     def __init__(self, element=None, comment=None, pi=None, entity=None):
 *         if element is None:             # <<<<<<<<<<<<<<
 *             self.element_class = _Element
 *         elif issubclass(element, ElementBase):
*/
    goto __pyx_L3;
  }

  /* "src/lxml/classlookup.pxi":281
 *         if element is None:
 *             self.element_class = _Element
 *         elif issubclass(element, ElementBase):             # <<<<<<<<<<<<<<
 *             self.element_class = element
 *         else:
*/
  __pyx_t_1 = PyObject_IsSubclass(__pyx_v_element, ((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_ElementBase)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(10, 281, __pyx_L1_error)
  if (likely(__pyx_t_1)) {

    /* "src/lxml/classlookup.pxi":282
 *             self.element_class = _Element
 *         elif issubclass(element, ElementBase):
 *             self.element_class = element             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError, "element class must be subclass of ElementBase"
*/
    __Pyx_INCREF(__pyx_v_element);
    __Pyx_GIVEREF(__pyx_v_element);
    __Pyx_GOTREF(__pyx_v_self->element_class);
    __Pyx_DECREF(__pyx_v_self->element_class);
    __pyx_v_self->element_class = __pyx_v_element;

    /* "src/lxml/classlookup.pxi":281
 *         if element is None:
 *             self.element_class = _Element
 *         elif issubclass(element, ElementBase):             # <<<<<<<<<<<<<<
 *             self.element_class = element
 *         else:
*/
    goto __pyx_L3;
  }

  /* "src/lxml/classlookup.pxi":284
 *             self.element_class = element
 *         else:
 *             raise TypeError, "element class must be subclass of ElementBase"             # <<<<<<<<<<<<<<
 * 
 *         if comment is None:
*/
  /*else*/ {
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_element_class_must_be_subclass_o, 0, 0);
    __PYX_ERR(10, 284, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "src/lxml/classlookup.pxi":286
 *             raise TypeError, "element class must be subclass of ElementBase"
 * 
 *         if comment is None:             # <<<<<<<<<<<<<<
 *             self.comment_class = _Comment
 *         elif issubclass(comment, CommentBase):
*/
  __pyx_t_1 = (__pyx_v_comment == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/classlookup.pxi":287
 * 
 *         if comment is None:
 *             self.comment_class = _Comment             # <<<<<<<<<<<<<<
 *         elif issubclass(comment, CommentBase):
 *             self.comment_class = comment
*/
    __Pyx_INCREF((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Comment);
    __Pyx_GIVEREF((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Comment);
    __Pyx_GOTREF(__pyx_v_self->comment_class);
    __Pyx_DECREF(__pyx_v_self->comment_class);
    __pyx_v_self->comment_class = ((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Comment);

    /* "src/lxml/classlookup.pxi":286
 *             raise TypeError, "element class must be subclass of ElementBase"
 * 
 *         if comment is None:             # <<<<<<<<<<<<<<
 *             self.comment_class = _Comment
 *         elif issubclass(comment, CommentBase):
*/
    goto __pyx_L4;
  }

  /* "src/lxml/classlookup.pxi":288
 *         if comment is None:
 *             self.comment_class = _Comment
 *         elif issubclass(comment, CommentBase):             # <<<<<<<<<<<<<<
 *             self.comment_class = comment
 *         else:
*/
  __pyx_t_1 = PyObject_IsSubclass(__pyx_v_comment, ((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_CommentBase)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(10, 288, __pyx_L1_error)
  if (likely(__pyx_t_1)) {

    /* "src/lxml/classlookup.pxi":289
 *             self.comment_class = _Comment
 *         elif issubclass(comment, CommentBase):
 *             self.comment_class = comment             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError, "comment class must be subclass of CommentBase"
*/
    __Pyx_INCREF(__pyx_v_comment);
    __Pyx_GIVEREF(__pyx_v_comment);
    __Pyx_GOTREF(__pyx_v_self->comment_class);
    __Pyx_DECREF(__pyx_v_self->comment_class);
    __pyx_v_self->comment_class = __pyx_v_comment;

    /* "src/lxml/classlookup.pxi":288
 *         if comment is None:
 *             self.comment_class = _Comment
 *         elif issubclass(comment, CommentBase):             # <<<<<<<<<<<<<<
 *             self.comment_class = comment
 *         else:
*/
    goto __pyx_L4;
  }

  /* "src/lxml/classlookup.pxi":291
 *             self.comment_class = comment
 *         else:
 *             raise TypeError, "comment class must be subclass of CommentBase"             # <<<<<<<<<<<<<<
 * 
 *         if entity is None:
*/
  /*else*/ {
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_comment_class_must_be_subclass_o, 0, 0);
    __PYX_ERR(10, 291, __pyx_L1_error)
  }
  __pyx_L4:;

  /* "src/lxml/classlookup.pxi":293
 *             raise TypeError, "comment class must be subclass of CommentBase"
 * 
 *         if entity is None:             # <<<<<<<<<<<<<<
 *             self.entity_class = _Entity
 *         elif issubclass(entity, EntityBase):
*/
  __pyx_t_1 = (__pyx_v_entity == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/classlookup.pxi":294
 * 
 *         if entity is None:
 *             self.entity_class = _Entity             # <<<<<<<<<<<<<<
 *         elif issubclass(entity, EntityBase):
 *             self.entity_class = entity
*/
    __Pyx_INCREF((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Entity);
    __Pyx_GIVEREF((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Entity);
    __Pyx_GOTREF(__pyx_v_self->entity_class);
    __Pyx_DECREF(__pyx_v_self->entity_class);
    __pyx_v_self->entity_class = ((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Entity);

    /* "src/lxml/classlookup.pxi":293
 *             raise TypeError, "comment class must be subclass of CommentBase"
 * 
 *         if entity is None:             # <<<<<<<<<<<<<<
 *             self.entity_class = _Entity
 *         elif issubclass(entity, EntityBase):
*/
    goto __pyx_L5;
  }

  /* "src/lxml/classlookup.pxi":295
 *         if entity is None:
 *             self.entity_class = _Entity
 *         elif issubclass(entity, EntityBase):             # <<<<<<<<<<<<<<
 *             self.entity_class = entity
 *         else:
*/
  __pyx_t_1 = PyObject_IsSubclass(__pyx_v_entity, ((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_EntityBase)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(10, 295, __pyx_L1_error)
  if (likely(__pyx_t_1)) {

    /* "src/lxml/classlookup.pxi":296
 *             self.entity_class = _Entity
 *         elif issubclass(entity, EntityBase):
 *             self.entity_class = entity             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError, "Entity class must be subclass of EntityBase"
*/
    __Pyx_INCREF(__pyx_v_entity);
    __Pyx_GIVEREF(__pyx_v_entity);
    __Pyx_GOTREF(__pyx_v_self->entity_class);
    __Pyx_DECREF(__pyx_v_self->entity_class);
    __pyx_v_self->entity_class = __pyx_v_entity;

    /* "src/lxml/classlookup.pxi":295
 *         if entity is None:
 *             self.entity_class = _Entity
 *         elif issubclass(entity, EntityBase):             # <<<<<<<<<<<<<<
 *             self.entity_class = entity
 *         else:
*/
    goto __pyx_L5;
  }

  /* "src/lxml/classlookup.pxi":298
 *             self.entity_class = entity
 *         else:
 *             raise TypeError, "Entity class must be subclass of EntityBase"             # <<<<<<<<<<<<<<
 * 
 *         if pi is None:
*/
  /*else*/ {
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_Entity_class_must_be_subclass_of, 0, 0);
    __PYX_ERR(10, 298, __pyx_L1_error)
  }
  __pyx_L5:;

  /* "src/lxml/classlookup.pxi":300
 *             raise TypeError, "Entity class must be subclass of EntityBase"
 * 
 *         if pi is None:             # <<<<<<<<<<<<<<
 *             self.pi_class = None # special case, see below
 *         elif issubclass(pi, PIBase):
*/
  __pyx_t_1 = (__pyx_v_pi == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/classlookup.pxi":301
 * 
 *         if pi is None:
 *             self.pi_class = None # special case, see below             # <<<<<<<<<<<<<<
 *         elif issubclass(pi, PIBase):
 *             self.pi_class = pi
*/
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_self->pi_class);
    __Pyx_DECREF(__pyx_v_self->pi_class);
    __pyx_v_self->pi_class = Py_None;

    /* "src/lxml/classlookup.pxi":300
 *             raise TypeError, "Entity class must be subclass of EntityBase"
 * 
 *         if pi is None:             # <<<<<<<<<<<<<<
 *             self.pi_class = None # special case, see below
 *         elif issubclass(pi, PIBase):
*/
    goto __pyx_L6;
  }

  /* "src/lxml/classlookup.pxi":302
 *         if pi is None:
 *             self.pi_class = None # special case, see below
 *         elif issubclass(pi, PIBase):             # <<<<<<<<<<<<<<
 *             self.pi_class = pi
 *         else:
*/
  __pyx_t_1 = PyObject_IsSubclass(__pyx_v_pi, ((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_PIBase)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(10, 302, __pyx_L1_error)
  if (likely(__pyx_t_1)) {

    /* "src/lxml/classlookup.pxi":303
 *             self.pi_class = None # special case, see below
 *         elif issubclass(pi, PIBase):
 *             self.pi_class = pi             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError, "PI class must be subclass of PIBase"
*/
    __Pyx_INCREF(__pyx_v_pi);
    __Pyx_GIVEREF(__pyx_v_pi);
    __Pyx_GOTREF(__pyx_v_self->pi_class);
    __Pyx_DECREF(__pyx_v_self->pi_class);
    __pyx_v_self->pi_class = __pyx_v_pi;

    /* "src/lxml/classlookup.pxi":302
 *         if pi is None:
 *             self.pi_class = None # special case, see below
 *         elif issubclass(pi, PIBase):             # <<<<<<<<<<<<<<
 *             self.pi_class = pi
 *         else:
*/
    goto __pyx_L6;
  }

  /* "src/lxml/classlookup.pxi":305
 *             self.pi_class = pi
 *         else:
 *             raise TypeError, "PI class must be subclass of PIBase"             # <<<<<<<<<<<<<<
 * 
 * cdef object _lookupDefaultElementClass(state, _Document _doc, xmlNode* c_node):
*/
  /*else*/ {
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_PI_class_must_be_subclass_of_PIB, 0, 0);
    __PYX_ERR(10, 305, __pyx_L1_error)
  }
  __pyx_L6:;

  /* "src/lxml/classlookup.pxi":278
 *         self._lookup_function = _lookupDefaultElementClass
 * 
 *     def __init__(self, element=None, comment=None, pi=None, entity=None):             # <<<<<<<<<<<<<<
 *         if element is None:
 *             self.element_class = _Element
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.ElementDefaultClassLookup.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/classlookup.pxi":271
 *     accept the respective Element classes.
 *     """
 *     cdef readonly object element_class             # <<<<<<<<<<<<<<
 *     cdef readonly object comment_class
 *     cdef readonly object pi_class
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_25ElementDefaultClassLookup_13element_class_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_25ElementDefaultClassLookup_13element_class_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_25ElementDefaultClassLookup_13element_class___get__(((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_25ElementDefaultClassLookup_13element_class___get__(struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->element_class);
  __pyx_r = __pyx_v_self->element_class;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/classlookup.pxi":272
 *     """
 *     cdef readonly object element_class
 *     cdef readonly object comment_class             # <<<<<<<<<<<<<<
 *     cdef readonly object pi_class
 *     cdef readonly object entity_class
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_25ElementDefaultClassLookup_13comment_class_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_25ElementDefaultClassLookup_13comment_class_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_25ElementDefaultClassLookup_13comment_class___get__(((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_25ElementDefaultClassLookup_13comment_class___get__(struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->comment_class);
  __pyx_r = __pyx_v_self->comment_class;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/classlookup.pxi":273
 *     cdef readonly object element_class
 *     cdef readonly object comment_class
 *     cdef readonly object pi_class             # <<<<<<<<<<<<<<
 *     cdef readonly object entity_class
 *     def __cinit__(self):
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_25ElementDefaultClassLookup_8pi_class_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_25ElementDefaultClassLookup_8pi_class_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_25ElementDefaultClassLookup_8pi_class___get__(((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_25ElementDefaultClassLookup_8pi_class___get__(struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->pi_class);
  __pyx_r = __pyx_v_self->pi_class;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/classlookup.pxi":274
 *     cdef readonly object comment_class
 *     cdef readonly object pi_class
 *     cdef readonly object entity_class             # <<<<<<<<<<<<<<
 *     def __cinit__(self):
 *         self._lookup_function = _lookupDefaultElementClass
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_25ElementDefaultClassLookup_12entity_class_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_25ElementDefaultClassLookup_12entity_class_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_25ElementDefaultClassLookup_12entity_class___get__(((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_25ElementDefaultClassLookup_12entity_class___get__(struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->entity_class);
  __pyx_r = __pyx_v_self->entity_class;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/classlookup.pxi":307
 *             raise TypeError, "PI class must be subclass of PIBase"
 * 
 * cdef object _lookupDefaultElementClass(state, _Document _doc, xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     "Trivial class lookup function that always returns the default class."
 *     if c_node.type == tree.XML_ELEMENT_NODE:
*/

static PyObject *__pyx_f_4lxml_5etree__lookupDefaultElementClass(PyObject *__pyx_v_state, CYTHON_UNUSED struct LxmlDocument *__pyx_v__doc, xmlNode *__pyx_v_c_node) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_lookupDefaultElementClass", 0);

  /* "src/lxml/classlookup.pxi":309
 * cdef object _lookupDefaultElementClass(state, _Document _doc, xmlNode* c_node):
 *     "Trivial class lookup function that always returns the default class."
 *     if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         if state is not None:
 *             return (<ElementDefaultClassLookup>state).element_class
*/
  switch (__pyx_v_c_node->type) {
    case XML_ELEMENT_NODE:

    /* "src/lxml/classlookup.pxi":310
 *     "Trivial class lookup function that always returns the default class."
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         if state is not None:             # <<<<<<<<<<<<<<
 *             return (<ElementDefaultClassLookup>state).element_class
 *         else:
*/
    __pyx_t_1 = (__pyx_v_state != Py_None);
    if (__pyx_t_1) {

      /* "src/lxml/classlookup.pxi":311
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         if state is not None:
 *             return (<ElementDefaultClassLookup>state).element_class             # <<<<<<<<<<<<<<
 *         else:
 *             return _Element
*/
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_state)->element_class);
      __pyx_r = ((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_state)->element_class;
      goto __pyx_L0;

      /* "src/lxml/classlookup.pxi":310
 *     "Trivial class lookup function that always returns the default class."
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         if state is not None:             # <<<<<<<<<<<<<<
 *             return (<ElementDefaultClassLookup>state).element_class
 *         else:
*/
    }

    /* "src/lxml/classlookup.pxi":313
 *             return (<ElementDefaultClassLookup>state).element_class
 *         else:
 *             return _Element             # <<<<<<<<<<<<<<
 *     elif c_node.type == tree.XML_COMMENT_NODE:
 *         if state is not None:
*/
    /*else*/ {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element);
      __pyx_r = ((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element);
      goto __pyx_L0;
    }

    /* "src/lxml/classlookup.pxi":309
 * cdef object _lookupDefaultElementClass(state, _Document _doc, xmlNode* c_node):
 *     "Trivial class lookup function that always returns the default class."
 *     if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         if state is not None:
 *             return (<ElementDefaultClassLookup>state).element_class
*/
    break;
    case XML_COMMENT_NODE:

    /* "src/lxml/classlookup.pxi":315
 *             return _Element
 *     elif c_node.type == tree.XML_COMMENT_NODE:
 *         if state is not None:             # <<<<<<<<<<<<<<
 *             return (<ElementDefaultClassLookup>state).comment_class
 *         else:
*/
    __pyx_t_1 = (__pyx_v_state != Py_None);
    if (__pyx_t_1) {

      /* "src/lxml/classlookup.pxi":316
 *     elif c_node.type == tree.XML_COMMENT_NODE:
 *         if state is not None:
 *             return (<ElementDefaultClassLookup>state).comment_class             # <<<<<<<<<<<<<<
 *         else:
 *             return _Comment
*/
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_state)->comment_class);
      __pyx_r = ((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_state)->comment_class;
      goto __pyx_L0;

      /* "src/lxml/classlookup.pxi":315
 *             return _Element
 *     elif c_node.type == tree.XML_COMMENT_NODE:
 *         if state is not None:             # <<<<<<<<<<<<<<
 *             return (<ElementDefaultClassLookup>state).comment_class
 *         else:
*/
    }

    /* "src/lxml/classlookup.pxi":318
 *             return (<ElementDefaultClassLookup>state).comment_class
 *         else:
 *             return _Comment             # <<<<<<<<<<<<<<
 *     elif c_node.type == tree.XML_ENTITY_REF_NODE:
 *         if state is not None:
*/
    /*else*/ {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Comment);
      __pyx_r = ((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Comment);
      goto __pyx_L0;
    }

    /* "src/lxml/classlookup.pxi":314
 *         else:
 *             return _Element
 *     elif c_node.type == tree.XML_COMMENT_NODE:             # <<<<<<<<<<<<<<
 *         if state is not None:
 *             return (<ElementDefaultClassLookup>state).comment_class
*/
    break;
    case XML_ENTITY_REF_NODE:

    /* "src/lxml/classlookup.pxi":320
 *             return _Comment
 *     elif c_node.type == tree.XML_ENTITY_REF_NODE:
 *         if state is not None:             # <<<<<<<<<<<<<<
 *             return (<ElementDefaultClassLookup>state).entity_class
 *         else:
*/
    __pyx_t_1 = (__pyx_v_state != Py_None);
    if (__pyx_t_1) {

      /* "src/lxml/classlookup.pxi":321
 *     elif c_node.type == tree.XML_ENTITY_REF_NODE:
 *         if state is not None:
 *             return (<ElementDefaultClassLookup>state).entity_class             # <<<<<<<<<<<<<<
 *         else:
 *             return _Entity
*/
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_state)->entity_class);
      __pyx_r = ((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_state)->entity_class;
      goto __pyx_L0;

      /* "src/lxml/classlookup.pxi":320
 *             return _Comment
 *     elif c_node.type == tree.XML_ENTITY_REF_NODE:
 *         if state is not None:             # <<<<<<<<<<<<<<
 *             return (<ElementDefaultClassLookup>state).entity_class
 *         else:
*/
    }

    /* "src/lxml/classlookup.pxi":323
 *             return (<ElementDefaultClassLookup>state).entity_class
 *         else:
 *             return _Entity             # <<<<<<<<<<<<<<
 *     elif c_node.type == tree.XML_PI_NODE:
 *         if state is None or (<ElementDefaultClassLookup>state).pi_class is None:
*/
    /*else*/ {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Entity);
      __pyx_r = ((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Entity);
      goto __pyx_L0;
    }

    /* "src/lxml/classlookup.pxi":319
 *         else:
 *             return _Comment
 *     elif c_node.type == tree.XML_ENTITY_REF_NODE:             # <<<<<<<<<<<<<<
 *         if state is not None:
 *             return (<ElementDefaultClassLookup>state).entity_class
*/
    break;
    case XML_PI_NODE:

    /* "src/lxml/classlookup.pxi":325
 *             return _Entity
 *     elif c_node.type == tree.XML_PI_NODE:
 *         if state is None or (<ElementDefaultClassLookup>state).pi_class is None:             # <<<<<<<<<<<<<<
 *             # special case XSLT-PI
 *             if c_node.name is not NULL and c_node.content is not NULL:
*/
    __pyx_t_2 = (__pyx_v_state == Py_None);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_2 = (((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_state)->pi_class == Py_None);
    __pyx_t_1 = __pyx_t_2;
    __pyx_L7_bool_binop_done:;
    if (__pyx_t_1) {

      /* "src/lxml/classlookup.pxi":327
 *         if state is None or (<ElementDefaultClassLookup>state).pi_class is None:
 *             # special case XSLT-PI
 *             if c_node.name is not NULL and c_node.content is not NULL:             # <<<<<<<<<<<<<<
 *                 if tree.xmlStrcmp(c_node.name, <unsigned char*>"xml-stylesheet") == 0:
 *                     if tree.xmlStrstr(c_node.content, <unsigned char*>"text/xsl") is not NULL or \
*/
      __pyx_t_2 = (__pyx_v_c_node->name != NULL);
      if (__pyx_t_2) {
      } else {
        __pyx_t_1 = __pyx_t_2;
        goto __pyx_L10_bool_binop_done;
      }
      __pyx_t_2 = (__pyx_v_c_node->content != NULL);
      __pyx_t_1 = __pyx_t_2;
      __pyx_L10_bool_binop_done:;
      if (__pyx_t_1) {

        /* "src/lxml/classlookup.pxi":328
 *             # special case XSLT-PI
 *             if c_node.name is not NULL and c_node.content is not NULL:
 *                 if tree.xmlStrcmp(c_node.name, <unsigned char*>"xml-stylesheet") == 0:             # <<<<<<<<<<<<<<
 *                     if tree.xmlStrstr(c_node.content, <unsigned char*>"text/xsl") is not NULL or \
 *                            tree.xmlStrstr(c_node.content, <unsigned char*>"text/xml") is not NULL:
*/
        __pyx_t_1 = (xmlStrcmp(__pyx_v_c_node->name, ((unsigned char *)((unsigned char *)((char *)"xml-stylesheet")))) == 0);
        if (__pyx_t_1) {

          /* "src/lxml/classlookup.pxi":329
 *             if c_node.name is not NULL and c_node.content is not NULL:
 *                 if tree.xmlStrcmp(c_node.name, <unsigned char*>"xml-stylesheet") == 0:
 *                     if tree.xmlStrstr(c_node.content, <unsigned char*>"text/xsl") is not NULL or \             # <<<<<<<<<<<<<<
 *                            tree.xmlStrstr(c_node.content, <unsigned char*>"text/xml") is not NULL:
 *                         return _XSLTProcessingInstruction
*/
          __pyx_t_2 = (xmlStrstr(__pyx_v_c_node->content, ((unsigned char *)((unsigned char *)((char *)"text/xsl")))) != NULL);
          if (!__pyx_t_2) {
          } else {
            __pyx_t_1 = __pyx_t_2;
            goto __pyx_L14_bool_binop_done;
          }

          /* "src/lxml/classlookup.pxi":330
 *                 if tree.xmlStrcmp(c_node.name, <unsigned char*>"xml-stylesheet") == 0:
 *                     if tree.xmlStrstr(c_node.content, <unsigned char*>"text/xsl") is not NULL or \
 *                            tree.xmlStrstr(c_node.content, <unsigned char*>"text/xml") is not NULL:             # <<<<<<<<<<<<<<
 *                         return _XSLTProcessingInstruction
 *             return _ProcessingInstruction
*/
          __pyx_t_2 = (xmlStrstr(__pyx_v_c_node->content, ((unsigned char *)((unsigned char *)((char *)"text/xml")))) != NULL);
          __pyx_t_1 = __pyx_t_2;
          __pyx_L14_bool_binop_done:;

          /* "src/lxml/classlookup.pxi":329
 *             if c_node.name is not NULL and c_node.content is not NULL:
 *                 if tree.xmlStrcmp(c_node.name, <unsigned char*>"xml-stylesheet") == 0:
 *                     if tree.xmlStrstr(c_node.content, <unsigned char*>"text/xsl") is not NULL or \             # <<<<<<<<<<<<<<
 *                            tree.xmlStrstr(c_node.content, <unsigned char*>"text/xml") is not NULL:
 *                         return _XSLTProcessingInstruction
*/
          if (__pyx_t_1) {

            /* "src/lxml/classlookup.pxi":331
 *                     if tree.xmlStrstr(c_node.content, <unsigned char*>"text/xsl") is not NULL or \
 *                            tree.xmlStrstr(c_node.content, <unsigned char*>"text/xml") is not NULL:
 *                         return _XSLTProcessingInstruction             # <<<<<<<<<<<<<<
 *             return _ProcessingInstruction
 *         else:
*/
            __Pyx_XDECREF(__pyx_r);
            __Pyx_INCREF((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__XSLTProcessingInstruction);
            __pyx_r = ((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__XSLTProcessingInstruction);
            goto __pyx_L0;

            /* "src/lxml/classlookup.pxi":329
 *             if c_node.name is not NULL and c_node.content is not NULL:
 *                 if tree.xmlStrcmp(c_node.name, <unsigned char*>"xml-stylesheet") == 0:
 *                     if tree.xmlStrstr(c_node.content, <unsigned char*>"text/xsl") is not NULL or \             # <<<<<<<<<<<<<<
 *                            tree.xmlStrstr(c_node.content, <unsigned char*>"text/xml") is not NULL:
 *                         return _XSLTProcessingInstruction
*/
          }

          /* "src/lxml/classlookup.pxi":328
 *             # special case XSLT-PI
 *             if c_node.name is not NULL and c_node.content is not NULL:
 *                 if tree.xmlStrcmp(c_node.name, <unsigned char*>"xml-stylesheet") == 0:             # <<<<<<<<<<<<<<
 *                     if tree.xmlStrstr(c_node.content, <unsigned char*>"text/xsl") is not NULL or \
 *                            tree.xmlStrstr(c_node.content, <unsigned char*>"text/xml") is not NULL:
*/
        }

        /* "src/lxml/classlookup.pxi":327
 *         if state is None or (<ElementDefaultClassLookup>state).pi_class is None:
 *             # special case XSLT-PI
 *             if c_node.name is not NULL and c_node.content is not NULL:             # <<<<<<<<<<<<<<
 *                 if tree.xmlStrcmp(c_node.name, <unsigned char*>"xml-stylesheet") == 0:
 *                     if tree.xmlStrstr(c_node.content, <unsigned char*>"text/xsl") is not NULL or \
*/
      }

      /* "src/lxml/classlookup.pxi":332
 *                            tree.xmlStrstr(c_node.content, <unsigned char*>"text/xml") is not NULL:
 *                         return _XSLTProcessingInstruction
 *             return _ProcessingInstruction             # <<<<<<<<<<<<<<
 *         else:
 *             return (<ElementDefaultClassLookup>state).pi_class
*/
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ProcessingInstruction);
      __pyx_r = ((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ProcessingInstruction);
      goto __pyx_L0;

      /* "src/lxml/classlookup.pxi":325
 *             return _Entity
 *     elif c_node.type == tree.XML_PI_NODE:
 *         if state is None or (<ElementDefaultClassLookup>state).pi_class is None:             # <<<<<<<<<<<<<<
 *             # special case XSLT-PI
 *             if c_node.name is not NULL and c_node.content is not NULL:
*/
    }

    /* "src/lxml/classlookup.pxi":334
 *             return _ProcessingInstruction
 *         else:
 *             return (<ElementDefaultClassLookup>state).pi_class             # <<<<<<<<<<<<<<
 *     else:
 *         assert False, f"Unknown node type: {c_node.type}"
*/
    /*else*/ {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_state)->pi_class);
      __pyx_r = ((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_state)->pi_class;
      goto __pyx_L0;
    }

    /* "src/lxml/classlookup.pxi":324
 *         else:
 *             return _Entity
 *     elif c_node.type == tree.XML_PI_NODE:             # <<<<<<<<<<<<<<
 *         if state is None or (<ElementDefaultClassLookup>state).pi_class is None:
 *             # special case XSLT-PI
*/
    break;
    default:

    /* "src/lxml/classlookup.pxi":336
 *             return (<ElementDefaultClassLookup>state).pi_class
 *     else:
 *         assert False, f"Unknown node type: {c_node.type}"             # <<<<<<<<<<<<<<
 * 
 * 
*/
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(__pyx_assertions_enabled())) {
      if (unlikely(!0)) {
        __pyx_t_3 = __Pyx_PyUnicode_From_xmlElementType(__pyx_v_c_node->type, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 336, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_Unknown_node_type, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 336, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_t_4, 0, 0);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __PYX_ERR(10, 336, __pyx_L1_error)
      }
    }
    #else
    if ((1)); else __PYX_ERR(10, 336, __pyx_L1_error)
    #endif
    break;
  }

  /* "src/lxml/classlookup.pxi":307
 *             raise TypeError, "PI class must be subclass of PIBase"
 * 
 * cdef object _lookupDefaultElementClass(state, _Document _doc, xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     "Trivial class lookup function that always returns the default class."
 *     if c_node.type == tree.XML_ELEMENT_NODE:
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._lookupDefaultElementClass", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/classlookup.pxi":359
 *     cdef const_xmlChar* _c_ns
 *     cdef const_xmlChar* _c_name
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._lookup_function = _attribute_class_lookup
 * 
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_32AttributeBasedElementClassLookup_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_32AttributeBasedElementClassLookup_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, __pyx_nargs); return -1; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return -1;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__cinit__", __pyx_kwds); return -1;}
  __pyx_r = __pyx_pf_4lxml_5etree_32AttributeBasedElementClassLookup___cinit__(((struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_32AttributeBasedElementClassLookup___cinit__(struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup *__pyx_v_self) {
  int __pyx_r;

  /* "src/lxml/classlookup.pxi":360
 *     cdef const_xmlChar* _c_name
 *     def __cinit__(self):
 *         self._lookup_function = _attribute_class_lookup             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, attribute_name, class_mapping,
*/
  __pyx_v_self->__pyx_base.__pyx_base._lookup_function = __pyx_f_4lxml_5etree__attribute_class_lookup;

  /* "src/lxml/classlookup.pxi":359
 *     cdef const_xmlChar* _c_ns
 *     cdef const_xmlChar* _c_name
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._lookup_function = _attribute_class_lookup
 * 
*/

  /* function exit code */
  __pyx_r = 0;
  return __pyx_r;
}

/* "src/lxml/classlookup.pxi":362
 *         self._lookup_function = _attribute_class_lookup
 * 
 *     def __init__(self, attribute_name, class_mapping,             # <<<<<<<<<<<<<<
 *                  ElementClassLookup fallback=None):
 *         self._pytag = _getNsTag(attribute_name)
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_32AttributeBasedElementClassLookup_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_32AttributeBasedElementClassLookup_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_attribute_name = 0;
  PyObject *__pyx_v_class_mapping = 0;
  struct LxmlElementClassLookup *__pyx_v_fallback = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_attribute_name,&__pyx_mstate_global->__pyx_n_u_class_mapping,&__pyx_mstate_global->__pyx_n_u_fallback,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(10, 362, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(10, 362, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(10, 362, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(10, 362, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(10, 362, __pyx_L3_error)

      /* "src/lxml/classlookup.pxi":363
 * 
 *     def __init__(self, attribute_name, class_mapping,
 *                  ElementClassLookup fallback=None):             # <<<<<<<<<<<<<<
 *         self._pytag = _getNsTag(attribute_name)
 *         ns, name = self._pytag
*/
      if (!values[2]) values[2] = __Pyx_NewRef((PyObject *)((struct LxmlElementClassLookup *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 3, i); __PYX_ERR(10, 362, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(10, 362, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(10, 362, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(10, 362, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[2]) values[2] = __Pyx_NewRef((PyObject *)((struct LxmlElementClassLookup *)Py_None));
    }
    __pyx_v_attribute_name = values[0];
    __pyx_v_class_mapping = values[1];
    __pyx_v_fallback = ((struct LxmlElementClassLookup *)values[2]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 3, __pyx_nargs); __PYX_ERR(10, 362, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.AttributeBasedElementClassLookup.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fallback), __pyx_mstate_global->__pyx_ptype_4lxml_5etree_ElementClassLookup, 1, "fallback", 0))) __PYX_ERR(10, 363, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_32AttributeBasedElementClassLookup_2__init__(((struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup *)__pyx_v_self), __pyx_v_attribute_name, __pyx_v_class_mapping, __pyx_v_fallback);

  /* "src/lxml/classlookup.pxi":362
 *         self._lookup_function = _attribute_class_lookup
 * 
 *     def __init__(self, attribute_name, class_mapping,             # <<<<<<<<<<<<<<
 *                  ElementClassLookup fallback=None):
 *         self._pytag = _getNsTag(attribute_name)
*/

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_32AttributeBasedElementClassLookup_2__init__(struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup *__pyx_v_self, PyObject *__pyx_v_attribute_name, PyObject *__pyx_v_class_mapping, struct LxmlElementClassLookup *__pyx_v_fallback) {
  PyObject *__pyx_v_ns = NULL;
  PyObject *__pyx_v_name = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "src/lxml/classlookup.pxi":364
 *     def __init__(self, attribute_name, class_mapping,
 *                  ElementClassLookup fallback=None):
 *         self._pytag = _getNsTag(attribute_name)             # <<<<<<<<<<<<<<
 *         ns, name = self._pytag
 *         if ns is None:
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__getNsTag(__pyx_v_attribute_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_pytag);
  __Pyx_DECREF(__pyx_v_self->_pytag);
  __pyx_v_self->_pytag = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/classlookup.pxi":365
 *                  ElementClassLookup fallback=None):
 *         self._pytag = _getNsTag(attribute_name)
 *         ns, name = self._pytag             # <<<<<<<<<<<<<<
 *         if ns is None:
 *             self._c_ns = NULL
*/
  __pyx_t_1 = __pyx_v_self->_pytag;
  __Pyx_INCREF(__pyx_t_1);
  if (likely(__pyx_t_1 != Py_None)) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(10, 365, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 365, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 365, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(10, 365, __pyx_L1_error)
  }
  __pyx_v_ns = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_name = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "src/lxml/classlookup.pxi":366
 *         self._pytag = _getNsTag(attribute_name)
 *         ns, name = self._pytag
 *         if ns is None:             # <<<<<<<<<<<<<<
 *             self._c_ns = NULL
 *         else:
*/
  __pyx_t_4 = (__pyx_v_ns == Py_None);
  if (__pyx_t_4) {

    /* "src/lxml/classlookup.pxi":367
 *         ns, name = self._pytag
 *         if ns is None:
 *             self._c_ns = NULL             # <<<<<<<<<<<<<<
 *         else:
 *             self._c_ns = _xcstr(ns)
*/
    __pyx_v_self->_c_ns = NULL;

    /* "src/lxml/classlookup.pxi":366
 *         self._pytag = _getNsTag(attribute_name)
 *         ns, name = self._pytag
 *         if ns is None:             # <<<<<<<<<<<<<<
 *             self._c_ns = NULL
 *         else:
*/
    goto __pyx_L3;
  }

  /* "src/lxml/classlookup.pxi":369
 *             self._c_ns = NULL
 *         else:
 *             self._c_ns = _xcstr(ns)             # <<<<<<<<<<<<<<
 *         self._c_name = _xcstr(name)
 *         self._class_mapping = dict(class_mapping)
*/
  /*else*/ {
    __pyx_v_self->_c_ns = (const xmlChar*)PyBytes_AS_STRING(__pyx_v_ns);
  }
  __pyx_L3:;

  /* "src/lxml/classlookup.pxi":370
 *         else:
 *             self._c_ns = _xcstr(ns)
 *         self._c_name = _xcstr(name)             # <<<<<<<<<<<<<<
 *         self._class_mapping = dict(class_mapping)
 * 
*/
  __pyx_v_self->_c_name = (const xmlChar*)PyBytes_AS_STRING(__pyx_v_name);

  /* "src/lxml/classlookup.pxi":371
 *             self._c_ns = _xcstr(ns)
 *         self._c_name = _xcstr(name)
 *         self._class_mapping = dict(class_mapping)             # <<<<<<<<<<<<<<
 * 
 *         FallbackElementClassLookup.__init__(self, fallback)
*/
  __pyx_t_3 = NULL;
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_class_mapping};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(&PyDict_Type), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 371, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_class_mapping);
  __Pyx_DECREF(__pyx_v_self->_class_mapping);
  __pyx_v_self->_class_mapping = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "src/lxml/classlookup.pxi":373
 *         self._class_mapping = dict(class_mapping)
 * 
 *         FallbackElementClassLookup.__init__(self, fallback)             # <<<<<<<<<<<<<<
 * 
 * cdef object _attribute_class_lookup(state, _Document doc, xmlNode* c_node):
*/
  __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_FallbackElementClassLookup);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_3, ((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_fallback)};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_init, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 373, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/classlookup.pxi":362
 *         self._lookup_function = _attribute_class_lookup
 * 
 *     def __init__(self, attribute_name, class_mapping,             # <<<<<<<<<<<<<<
 *                  ElementClassLookup fallback=None):
 *         self._pytag = _getNsTag(attribute_name)
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.AttributeBasedElementClassLookup.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ns);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/classlookup.pxi":375
 *         FallbackElementClassLookup.__init__(self, fallback)
 * 
 * cdef object _attribute_class_lookup(state, _Document doc, xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     cdef AttributeBasedElementClassLookup lookup
 *     cdef python.PyObject* dict_result
*/

static PyObject *__pyx_f_4lxml_5etree__attribute_class_lookup(PyObject *__pyx_v_state, struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_node) {
  struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup *__pyx_v_lookup = 0;
  PyObject *__pyx_v_dict_result;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_v_cls = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_attribute_class_lookup", 0);

  /* "src/lxml/classlookup.pxi":379
 *     cdef python.PyObject* dict_result
 * 
 *     lookup = <AttributeBasedElementClassLookup>state             # <<<<<<<<<<<<<<
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         value = _attributeValueFromNsName(
*/
  __pyx_t_1 = __pyx_v_state;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_lookup = ((struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/classlookup.pxi":380
 * 
 *     lookup = <AttributeBasedElementClassLookup>state
 *     if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         value = _attributeValueFromNsName(
 *             c_node, lookup._c_ns, lookup._c_name)
*/
  __pyx_t_2 = (__pyx_v_c_node->type == XML_ELEMENT_NODE);
  if (__pyx_t_2) {

    /* "src/lxml/classlookup.pxi":381
 *     lookup = <AttributeBasedElementClassLookup>state
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         value = _attributeValueFromNsName(             # <<<<<<<<<<<<<<
 *             c_node, lookup._c_ns, lookup._c_name)
 *         dict_result = python.PyDict_GetItem(lookup._class_mapping, value)
*/
    __pyx_t_1 = __pyx_f_4lxml_5etree__attributeValueFromNsName(__pyx_v_c_node, __pyx_v_lookup->_c_ns, __pyx_v_lookup->_c_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 381, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_value = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/classlookup.pxi":383
 *         value = _attributeValueFromNsName(
 *             c_node, lookup._c_ns, lookup._c_name)
 *         dict_result = python.PyDict_GetItem(lookup._class_mapping, value)             # <<<<<<<<<<<<<<
 *         if dict_result is not NULL:
 *             cls = <object>dict_result
*/
    __pyx_t_1 = __pyx_v_lookup->_class_mapping;
    __Pyx_INCREF(__pyx_t_1);
    __pyx_v_dict_result = PyDict_GetItem(__pyx_t_1, __pyx_v_value);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "src/lxml/classlookup.pxi":384
 *             c_node, lookup._c_ns, lookup._c_name)
 *         dict_result = python.PyDict_GetItem(lookup._class_mapping, value)
 *         if dict_result is not NULL:             # <<<<<<<<<<<<<<
 *             cls = <object>dict_result
 *             _validateNodeClass(c_node, cls)
*/
    __pyx_t_2 = (__pyx_v_dict_result != NULL);
    if (__pyx_t_2) {

      /* "src/lxml/classlookup.pxi":385
 *         dict_result = python.PyDict_GetItem(lookup._class_mapping, value)
 *         if dict_result is not NULL:
 *             cls = <object>dict_result             # <<<<<<<<<<<<<<
 *             _validateNodeClass(c_node, cls)
 *             return cls
*/
      __pyx_t_1 = ((PyObject *)__pyx_v_dict_result);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_v_cls = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "src/lxml/classlookup.pxi":386
 *         if dict_result is not NULL:
 *             cls = <object>dict_result
 *             _validateNodeClass(c_node, cls)             # <<<<<<<<<<<<<<
 *             return cls
 *     return _callLookupFallback(lookup, doc, c_node)
*/
      __pyx_t_3 = __pyx_f_4lxml_5etree__validateNodeClass(__pyx_v_c_node, __pyx_v_cls); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(10, 386, __pyx_L1_error)

      /* "src/lxml/classlookup.pxi":387
 *             cls = <object>dict_result
 *             _validateNodeClass(c_node, cls)
 *             return cls             # <<<<<<<<<<<<<<
 *     return _callLookupFallback(lookup, doc, c_node)
 * 
*/
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_cls);
      __pyx_r = __pyx_v_cls;
      goto __pyx_L0;

      /* "src/lxml/classlookup.pxi":384
 *             c_node, lookup._c_ns, lookup._c_name)
 *         dict_result = python.PyDict_GetItem(lookup._class_mapping, value)
 *         if dict_result is not NULL:             # <<<<<<<<<<<<<<
 *             cls = <object>dict_result
 *             _validateNodeClass(c_node, cls)
*/
    }

    /* "src/lxml/classlookup.pxi":380
 * 
 *     lookup = <AttributeBasedElementClassLookup>state
 *     if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         value = _attributeValueFromNsName(
 *             c_node, lookup._c_ns, lookup._c_name)
*/
  }

  /* "src/lxml/classlookup.pxi":388
 *             _validateNodeClass(c_node, cls)
 *             return cls
 *     return _callLookupFallback(lookup, doc, c_node)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree__callLookupFallback(((struct LxmlFallbackElementClassLookup *)__pyx_v_lookup), __pyx_v_doc, __pyx_v_c_node); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 388, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/classlookup.pxi":375
 *         FallbackElementClassLookup.__init__(self, fallback)
 * 
 * cdef object _attribute_class_lookup(state, _Document doc, xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     cdef AttributeBasedElementClassLookup lookup
 *     cdef python.PyObject* dict_result
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._attribute_class_lookup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_lookup);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XDECREF(__pyx_v_cls);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/classlookup.pxi":398
 *     Element class lookup based on the XML parser.
 *     """
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._lookup_function = _parser_class_lookup
 * 
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_29ParserBasedElementClassLookup_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_29ParserBasedElementClassLookup_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, __pyx_nargs); return -1; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return -1;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__cinit__", __pyx_kwds); return -1;}
  __pyx_r = __pyx_pf_4lxml_5etree_29ParserBasedElementClassLookup___cinit__(((struct __pyx_obj_4lxml_5etree_ParserBasedElementClassLookup *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_29ParserBasedElementClassLookup___cinit__(struct __pyx_obj_4lxml_5etree_ParserBasedElementClassLookup *__pyx_v_self) {
  int __pyx_r;

  /* "src/lxml/classlookup.pxi":399
 *     """
 *     def __cinit__(self):
 *         self._lookup_function = _parser_class_lookup             # <<<<<<<<<<<<<<
 * 
 * cdef object _parser_class_lookup(state, _Document doc, xmlNode* c_node):
*/
  __pyx_v_self->__pyx_base.__pyx_base._lookup_function = __pyx_f_4lxml_5etree__parser_class_lookup;

  /* "src/lxml/classlookup.pxi":398
 *     Element class lookup based on the XML parser.
 *     """
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._lookup_function = _parser_class_lookup
 * 
*/

  /* function exit code */
  __pyx_r = 0;
  return __pyx_r;
}

/* "src/lxml/classlookup.pxi":401
 *         self._lookup_function = _parser_class_lookup
 * 
 * cdef object _parser_class_lookup(state, _Document doc, xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     if doc._parser._class_lookup is not None:
 *         return doc._parser._class_lookup._lookup_function(
*/

static PyObject *__pyx_f_4lxml_5etree__parser_class_lookup(PyObject *__pyx_v_state, struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_node) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_parser_class_lookup", 0);

  /* "src/lxml/classlookup.pxi":402
 * 
 * cdef object _parser_class_lookup(state, _Document doc, xmlNode* c_node):
 *     if doc._parser._class_lookup is not None:             # <<<<<<<<<<<<<<
 *         return doc._parser._class_lookup._lookup_function(
 *             doc._parser._class_lookup, doc, c_node)
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_doc->_parser->_class_lookup) != Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/classlookup.pxi":403
 * cdef object _parser_class_lookup(state, _Document doc, xmlNode* c_node):
 *     if doc._parser._class_lookup is not None:
 *         return doc._parser._class_lookup._lookup_function(             # <<<<<<<<<<<<<<
 *             doc._parser._class_lookup, doc, c_node)
 *     return _callLookupFallback(<FallbackElementClassLookup>state, doc, c_node)
*/
    __Pyx_XDECREF(__pyx_r);

    /* "src/lxml/classlookup.pxi":404
 *     if doc._parser._class_lookup is not None:
 *         return doc._parser._class_lookup._lookup_function(
 *             doc._parser._class_lookup, doc, c_node)             # <<<<<<<<<<<<<<
 *     return _callLookupFallback(<FallbackElementClassLookup>state, doc, c_node)
 * 
*/
    __pyx_t_2 = ((PyObject *)__pyx_v_doc->_parser->_class_lookup);
    __Pyx_INCREF(__pyx_t_2);

    /* "src/lxml/classlookup.pxi":403
 * cdef object _parser_class_lookup(state, _Document doc, xmlNode* c_node):
 *     if doc._parser._class_lookup is not None:
 *         return doc._parser._class_lookup._lookup_function(             # <<<<<<<<<<<<<<
 *             doc._parser._class_lookup, doc, c_node)
 *     return _callLookupFallback(<FallbackElementClassLookup>state, doc, c_node)
*/
    __pyx_t_3 = __pyx_v_doc->_parser->_class_lookup->_lookup_function(__pyx_t_2, __pyx_v_doc, __pyx_v_c_node); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 403, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "src/lxml/classlookup.pxi":402
 * 
 * cdef object _parser_class_lookup(state, _Document doc, xmlNode* c_node):
 *     if doc._parser._class_lookup is not None:             # <<<<<<<<<<<<<<
 *         return doc._parser._class_lookup._lookup_function(
 *             doc._parser._class_lookup, doc, c_node)
*/
  }

  /* "src/lxml/classlookup.pxi":405
 *         return doc._parser._class_lookup._lookup_function(
 *             doc._parser._class_lookup, doc, c_node)
 *     return _callLookupFallback(<FallbackElementClassLookup>state, doc, c_node)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __pyx_f_4lxml_5etree__callLookupFallback(((struct LxmlFallbackElementClassLookup *)__pyx_v_state), __pyx_v_doc, __pyx_v_c_node); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 405, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "src/lxml/classlookup.pxi":401
 *         self._lookup_function = _parser_class_lookup
 * 
 * cdef object _parser_class_lookup(state, _Document doc, xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     if doc._parser._class_lookup is not None:
 *         return doc._parser._class_lookup._lookup_function(
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._parser_class_lookup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/classlookup.pxi":427
 *     If you return None from this method, the fallback will be called.
 *     """
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._lookup_function = _custom_class_lookup
 * 
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_24CustomElementClassLookup_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_24CustomElementClassLookup_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, __pyx_nargs); return -1; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return -1;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__cinit__", __pyx_kwds); return -1;}
  __pyx_r = __pyx_pf_4lxml_5etree_24CustomElementClassLookup___cinit__(((struct __pyx_obj_4lxml_5etree_CustomElementClassLookup *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_24CustomElementClassLookup___cinit__(struct __pyx_obj_4lxml_5etree_CustomElementClassLookup *__pyx_v_self) {
  int __pyx_r;

  /* "src/lxml/classlookup.pxi":428
 *     """
 *     def __cinit__(self):
 *         self._lookup_function = _custom_class_lookup             # <<<<<<<<<<<<<<
 * 
 *     def lookup(self, type, doc, namespace, name):
*/
  __pyx_v_self->__pyx_base.__pyx_base._lookup_function = __pyx_f_4lxml_5etree__custom_class_lookup;

  /* "src/lxml/classlookup.pxi":427
 *     If you return None from this method, the fallback will be called.
 *     """
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._lookup_function = _custom_class_lookup
 * 
*/

  /* function exit code */
  __pyx_r = 0;
  return __pyx_r;
}

/* "src/lxml/classlookup.pxi":430
 *         self._lookup_function = _custom_class_lookup
 * 
 *     def lookup(self, type, doc, namespace, name):             # <<<<<<<<<<<<<<
 *         "lookup(self, type, doc, namespace, name)"
 *         return None
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_24CustomElementClassLookup_3lookup(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_24CustomElementClassLookup_2lookup, "lookup(self, type, doc, namespace, name)");
static PyMethodDef __pyx_mdef_4lxml_5etree_24CustomElementClassLookup_3lookup = {"lookup", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_24CustomElementClassLookup_3lookup, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_24CustomElementClassLookup_2lookup};
static PyObject *__pyx_pw_4lxml_5etree_24CustomElementClassLookup_3lookup(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_type = 0;
  CYTHON_UNUSED PyObject *__pyx_v_doc = 0;
  CYTHON_UNUSED PyObject *__pyx_v_namespace = 0;
  CYTHON_UNUSED PyObject *__pyx_v_name = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[4] = {0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lookup (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_type,&__pyx_mstate_global->__pyx_n_u_doc_2,&__pyx_mstate_global->__pyx_n_u_namespace,&__pyx_mstate_global->__pyx_n_u_name,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(10, 430, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(10, 430, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(10, 430, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(10, 430, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(10, 430, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "lookup", 0) < (0)) __PYX_ERR(10, 430, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 4; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("lookup", 1, 4, 4, i); __PYX_ERR(10, 430, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 4)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(10, 430, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(10, 430, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(10, 430, __pyx_L3_error)
      values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(10, 430, __pyx_L3_error)
    }
    __pyx_v_type = values[0];
    __pyx_v_doc = values[1];
    __pyx_v_namespace = values[2];
    __pyx_v_name = values[3];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lookup", 1, 4, 4, __pyx_nargs); __PYX_ERR(10, 430, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.CustomElementClassLookup.lookup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_24CustomElementClassLookup_2lookup(((struct __pyx_obj_4lxml_5etree_CustomElementClassLookup *)__pyx_v_self), __pyx_v_type, __pyx_v_doc, __pyx_v_namespace, __pyx_v_name);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_24CustomElementClassLookup_2lookup(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree_CustomElementClassLookup *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_type, CYTHON_UNUSED PyObject *__pyx_v_doc, CYTHON_UNUSED PyObject *__pyx_v_namespace, CYTHON_UNUSED PyObject *__pyx_v_name) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lookup", 0);

  /* "src/lxml/classlookup.pxi":432
 *     def lookup(self, type, doc, namespace, name):
 *         "lookup(self, type, doc, namespace, name)"
 *         return None             # <<<<<<<<<<<<<<
 * 
 * cdef object _custom_class_lookup(state, _Document doc, xmlNode* c_node):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "src/lxml/classlookup.pxi":430
 *         self._lookup_function = _custom_class_lookup
 * 
 *     def lookup(self, type, doc, namespace, name):             # <<<<<<<<<<<<<<
 *         "lookup(self, type, doc, namespace, name)"
 *         return None
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/classlookup.pxi":434
 *         return None
 * 
 * cdef object _custom_class_lookup(state, _Document doc, xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     cdef CustomElementClassLookup lookup
 * 
*/

static PyObject *__pyx_f_4lxml_5etree__custom_class_lookup(PyObject *__pyx_v_state, struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_node) {
  struct __pyx_obj_4lxml_5etree_CustomElementClassLookup *__pyx_v_lookup = 0;
  PyObject *__pyx_v_element_type = NULL;
  PyObject *__pyx_v_name = NULL;
  const xmlChar *__pyx_v_c_str;
  PyObject *__pyx_v_ns = NULL;
  PyObject *__pyx_v_cls = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_custom_class_lookup", 0);

  /* "src/lxml/classlookup.pxi":437
 *     cdef CustomElementClassLookup lookup
 * 
 *     lookup = <CustomElementClassLookup>state             # <<<<<<<<<<<<<<
 * 
 *     if c_node.type == tree.XML_ELEMENT_NODE:
*/
  __pyx_t_1 = __pyx_v_state;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_lookup = ((struct __pyx_obj_4lxml_5etree_CustomElementClassLookup *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/classlookup.pxi":439
 *     lookup = <CustomElementClassLookup>state
 * 
 *     if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         element_type = "element"
 *     elif c_node.type == tree.XML_COMMENT_NODE:
*/
  switch (__pyx_v_c_node->type) {
    case XML_ELEMENT_NODE:

    /* "src/lxml/classlookup.pxi":440
 * 
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         element_type = "element"             # <<<<<<<<<<<<<<
 *     elif c_node.type == tree.XML_COMMENT_NODE:
 *         element_type = "comment"
*/
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_element);
    __pyx_v_element_type = __pyx_mstate_global->__pyx_n_u_element;

    /* "src/lxml/classlookup.pxi":439
 *     lookup = <CustomElementClassLookup>state
 * 
 *     if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         element_type = "element"
 *     elif c_node.type == tree.XML_COMMENT_NODE:
*/
    break;
    case XML_COMMENT_NODE:

    /* "src/lxml/classlookup.pxi":442
 *         element_type = "element"
 *     elif c_node.type == tree.XML_COMMENT_NODE:
 *         element_type = "comment"             # <<<<<<<<<<<<<<
 *     elif c_node.type == tree.XML_PI_NODE:
 *         element_type = "PI"
*/
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_comment);
    __pyx_v_element_type = __pyx_mstate_global->__pyx_n_u_comment;

    /* "src/lxml/classlookup.pxi":441
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         element_type = "element"
 *     elif c_node.type == tree.XML_COMMENT_NODE:             # <<<<<<<<<<<<<<
 *         element_type = "comment"
 *     elif c_node.type == tree.XML_PI_NODE:
*/
    break;
    case XML_PI_NODE:

    /* "src/lxml/classlookup.pxi":444
 *         element_type = "comment"
 *     elif c_node.type == tree.XML_PI_NODE:
 *         element_type = "PI"             # <<<<<<<<<<<<<<
 *     elif c_node.type == tree.XML_ENTITY_REF_NODE:
 *         element_type = "entity"
*/
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_PI);
    __pyx_v_element_type = __pyx_mstate_global->__pyx_n_u_PI;

    /* "src/lxml/classlookup.pxi":443
 *     elif c_node.type == tree.XML_COMMENT_NODE:
 *         element_type = "comment"
 *     elif c_node.type == tree.XML_PI_NODE:             # <<<<<<<<<<<<<<
 *         element_type = "PI"
 *     elif c_node.type == tree.XML_ENTITY_REF_NODE:
*/
    break;
    case XML_ENTITY_REF_NODE:

    /* "src/lxml/classlookup.pxi":446
 *         element_type = "PI"
 *     elif c_node.type == tree.XML_ENTITY_REF_NODE:
 *         element_type = "entity"             # <<<<<<<<<<<<<<
 *     else:
 *         element_type = "element"
*/
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_entity);
    __pyx_v_element_type = __pyx_mstate_global->__pyx_n_u_entity;

    /* "src/lxml/classlookup.pxi":445
 *     elif c_node.type == tree.XML_PI_NODE:
 *         element_type = "PI"
 *     elif c_node.type == tree.XML_ENTITY_REF_NODE:             # <<<<<<<<<<<<<<
 *         element_type = "entity"
 *     else:
*/
    break;
    default:

    /* "src/lxml/classlookup.pxi":448
 *         element_type = "entity"
 *     else:
 *         element_type = "element"             # <<<<<<<<<<<<<<
 *     if c_node.name is NULL:
 *         name = None
*/
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_element);
    __pyx_v_element_type = __pyx_mstate_global->__pyx_n_u_element;
    break;
  }

  /* "src/lxml/classlookup.pxi":449
 *     else:
 *         element_type = "element"
 *     if c_node.name is NULL:             # <<<<<<<<<<<<<<
 *         name = None
 *     else:
*/
  __pyx_t_2 = (__pyx_v_c_node->name == NULL);
  if (__pyx_t_2) {

    /* "src/lxml/classlookup.pxi":450
 *         element_type = "element"
 *     if c_node.name is NULL:
 *         name = None             # <<<<<<<<<<<<<<
 *     else:
 *         name = funicode(c_node.name)
*/
    __Pyx_INCREF(Py_None);
    __pyx_v_name = ((PyObject*)Py_None);

    /* "src/lxml/classlookup.pxi":449
 *     else:
 *         element_type = "element"
 *     if c_node.name is NULL:             # <<<<<<<<<<<<<<
 *         name = None
 *     else:
*/
    goto __pyx_L3;
  }

  /* "src/lxml/classlookup.pxi":452
 *         name = None
 *     else:
 *         name = funicode(c_node.name)             # <<<<<<<<<<<<<<
 *     c_str = tree._getNs(c_node)
 *     ns = funicode(c_str) if c_str is not NULL else None
*/
  /*else*/ {
    __pyx_t_1 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_node->name); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 452, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_name = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;
  }
  __pyx_L3:;

  /* "src/lxml/classlookup.pxi":453
 *     else:
 *         name = funicode(c_node.name)
 *     c_str = tree._getNs(c_node)             # <<<<<<<<<<<<<<
 *     ns = funicode(c_str) if c_str is not NULL else None
 * 
*/
  __pyx_v_c_str = _getNs(__pyx_v_c_node);

  /* "src/lxml/classlookup.pxi":454
 *         name = funicode(c_node.name)
 *     c_str = tree._getNs(c_node)
 *     ns = funicode(c_str) if c_str is not NULL else None             # <<<<<<<<<<<<<<
 * 
 *     cls = lookup.lookup(element_type, doc, ns, name)
*/
  __pyx_t_2 = (__pyx_v_c_str != NULL);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_str); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 454, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
  } else {
    __Pyx_INCREF(Py_None);
    __pyx_t_1 = Py_None;
  }
  __pyx_v_ns = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "src/lxml/classlookup.pxi":456
 *     ns = funicode(c_str) if c_str is not NULL else None
 * 
 *     cls = lookup.lookup(element_type, doc, ns, name)             # <<<<<<<<<<<<<<
 *     if cls is not None:
 *         _validateNodeClass(c_node, cls)
*/
  __pyx_t_3 = ((PyObject *)__pyx_v_lookup);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[5] = {__pyx_t_3, __pyx_v_element_type, ((PyObject *)__pyx_v_doc), __pyx_v_ns, __pyx_v_name};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_lookup, __pyx_callargs+__pyx_t_4, (5-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 456, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v_cls = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "src/lxml/classlookup.pxi":457
 * 
 *     cls = lookup.lookup(element_type, doc, ns, name)
 *     if cls is not None:             # <<<<<<<<<<<<<<
 *         _validateNodeClass(c_node, cls)
 *         return cls
*/
  __pyx_t_2 = (__pyx_v_cls != Py_None);
  if (__pyx_t_2) {

    /* "src/lxml/classlookup.pxi":458
 *     cls = lookup.lookup(element_type, doc, ns, name)
 *     if cls is not None:
 *         _validateNodeClass(c_node, cls)             # <<<<<<<<<<<<<<
 *         return cls
 *     return _callLookupFallback(lookup, doc, c_node)
*/
    __pyx_t_5 = __pyx_f_4lxml_5etree__validateNodeClass(__pyx_v_c_node, __pyx_v_cls); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(10, 458, __pyx_L1_error)

    /* "src/lxml/classlookup.pxi":459
 *     if cls is not None:
 *         _validateNodeClass(c_node, cls)
 *         return cls             # <<<<<<<<<<<<<<
 *     return _callLookupFallback(lookup, doc, c_node)
 * 
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_cls);
    __pyx_r = __pyx_v_cls;
    goto __pyx_L0;

    /* "src/lxml/classlookup.pxi":457
 * 
 *     cls = lookup.lookup(element_type, doc, ns, name)
 *     if cls is not None:             # <<<<<<<<<<<<<<
 *         _validateNodeClass(c_node, cls)
 *         return cls
*/
  }

  /* "src/lxml/classlookup.pxi":460
 *         _validateNodeClass(c_node, cls)
 *         return cls
 *     return _callLookupFallback(lookup, doc, c_node)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree__callLookupFallback(((struct LxmlFallbackElementClassLookup *)__pyx_v_lookup), __pyx_v_doc, __pyx_v_c_node); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 460, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/classlookup.pxi":434
 *         return None
 * 
 * cdef object _custom_class_lookup(state, _Document doc, xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     cdef CustomElementClassLookup lookup
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._custom_class_lookup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_lookup);
  __Pyx_XDECREF(__pyx_v_element_type);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_ns);
  __Pyx_XDECREF(__pyx_v_cls);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/classlookup.pxi":509
 *     See https://lxml.de/element_classes.html
 *     """
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._lookup_function = _python_class_lookup
 * 
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_24PythonElementClassLookup_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_24PythonElementClassLookup_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, __pyx_nargs); return -1; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return -1;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__cinit__", __pyx_kwds); return -1;}
  __pyx_r = __pyx_pf_4lxml_5etree_24PythonElementClassLookup___cinit__(((struct __pyx_obj_4lxml_5etree_PythonElementClassLookup *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_24PythonElementClassLookup___cinit__(struct __pyx_obj_4lxml_5etree_PythonElementClassLookup *__pyx_v_self) {
  int __pyx_r;

  /* "src/lxml/classlookup.pxi":510
 *     """
 *     def __cinit__(self):
 *         self._lookup_function = _python_class_lookup             # <<<<<<<<<<<<<<
 * 
 *     def lookup(self, doc, element):
*/
  __pyx_v_self->__pyx_base.__pyx_base._lookup_function = __pyx_f_4lxml_5etree__python_class_lookup;

  /* "src/lxml/classlookup.pxi":509
 *     See https://lxml.de/element_classes.html
 *     """
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._lookup_function = _python_class_lookup
 * 
*/

  /* function exit code */
  __pyx_r = 0;
  return __pyx_r;
}

/* "src/lxml/classlookup.pxi":512
 *         self._lookup_function = _python_class_lookup
 * 
 *     def lookup(self, doc, element):             # <<<<<<<<<<<<<<
 *         """lookup(self, doc, element)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_24PythonElementClassLookup_3lookup(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_24PythonElementClassLookup_2lookup, "lookup(self, doc, element)\n\n        Override this method to implement your own lookup scheme.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_24PythonElementClassLookup_3lookup = {"lookup", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_24PythonElementClassLookup_3lookup, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_24PythonElementClassLookup_2lookup};
static PyObject *__pyx_pw_4lxml_5etree_24PythonElementClassLookup_3lookup(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_doc = 0;
  CYTHON_UNUSED PyObject *__pyx_v_element = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lookup (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_doc_2,&__pyx_mstate_global->__pyx_n_u_element,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(10, 512, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(10, 512, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(10, 512, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "lookup", 0) < (0)) __PYX_ERR(10, 512, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("lookup", 1, 2, 2, i); __PYX_ERR(10, 512, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(10, 512, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(10, 512, __pyx_L3_error)
    }
    __pyx_v_doc = values[0];
    __pyx_v_element = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lookup", 1, 2, 2, __pyx_nargs); __PYX_ERR(10, 512, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.PythonElementClassLookup.lookup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_24PythonElementClassLookup_2lookup(((struct __pyx_obj_4lxml_5etree_PythonElementClassLookup *)__pyx_v_self), __pyx_v_doc, __pyx_v_element);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_24PythonElementClassLookup_2lookup(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree_PythonElementClassLookup *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_doc, CYTHON_UNUSED PyObject *__pyx_v_element) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lookup", 0);

  /* "src/lxml/classlookup.pxi":517
 *         Override this method to implement your own lookup scheme.
 *         """
 *         return None             # <<<<<<<<<<<<<<
 * 
 * cdef object _python_class_lookup(state, _Document doc, tree.xmlNode* c_node):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "src/lxml/classlookup.pxi":512
 *         self._lookup_function = _python_class_lookup
 * 
 *     def lookup(self, doc, element):             # <<<<<<<<<<<<<<
 *         """lookup(self, doc, element)
 * 
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/classlookup.pxi":519
 *         return None
 * 
 * cdef object _python_class_lookup(state, _Document doc, tree.xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     cdef PythonElementClassLookup lookup
 *     cdef _ReadOnlyProxy proxy
*/

static PyObject *__pyx_f_4lxml_5etree__python_class_lookup(PyObject *__pyx_v_state, struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_node) {
  struct __pyx_obj_4lxml_5etree_PythonElementClassLookup *__pyx_v_lookup = 0;
  struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_proxy = 0;
  PyObject *__pyx_v_cls = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_python_class_lookup", 0);

  /* "src/lxml/classlookup.pxi":522
 *     cdef PythonElementClassLookup lookup
 *     cdef _ReadOnlyProxy proxy
 *     lookup = <PythonElementClassLookup>state             # <<<<<<<<<<<<<<
 * 
 *     proxy = _newReadOnlyProxy(None, c_node)
*/
  __pyx_t_1 = __pyx_v_state;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_lookup = ((struct __pyx_obj_4lxml_5etree_PythonElementClassLookup *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/classlookup.pxi":524
 *     lookup = <PythonElementClassLookup>state
 * 
 *     proxy = _newReadOnlyProxy(None, c_node)             # <<<<<<<<<<<<<<
 *     cls = lookup.lookup(doc, proxy)
 *     _freeReadOnlyProxies(proxy)
*/
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__newReadOnlyProxy(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)Py_None), __pyx_v_c_node)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 524, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_proxy = ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/classlookup.pxi":525
 * 
 *     proxy = _newReadOnlyProxy(None, c_node)
 *     cls = lookup.lookup(doc, proxy)             # <<<<<<<<<<<<<<
 *     _freeReadOnlyProxies(proxy)
 * 
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_lookup);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_2, ((PyObject *)__pyx_v_doc), ((PyObject *)__pyx_v_proxy)};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_lookup, __pyx_callargs+__pyx_t_3, (3-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 525, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v_cls = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "src/lxml/classlookup.pxi":526
 *     proxy = _newReadOnlyProxy(None, c_node)
 *     cls = lookup.lookup(doc, proxy)
 *     _freeReadOnlyProxies(proxy)             # <<<<<<<<<<<<<<
 * 
 *     if cls is not None:
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__freeReadOnlyProxies(__pyx_v_proxy); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 526, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/classlookup.pxi":528
 *     _freeReadOnlyProxies(proxy)
 * 
 *     if cls is not None:             # <<<<<<<<<<<<<<
 *         _validateNodeClass(c_node, cls)
 *         return cls
*/
  __pyx_t_4 = (__pyx_v_cls != Py_None);
  if (__pyx_t_4) {

    /* "src/lxml/classlookup.pxi":529
 * 
 *     if cls is not None:
 *         _validateNodeClass(c_node, cls)             # <<<<<<<<<<<<<<
 *         return cls
 *     return _callLookupFallback(lookup, doc, c_node)
*/
    __pyx_t_5 = __pyx_f_4lxml_5etree__validateNodeClass(__pyx_v_c_node, __pyx_v_cls); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(10, 529, __pyx_L1_error)

    /* "src/lxml/classlookup.pxi":530
 *     if cls is not None:
 *         _validateNodeClass(c_node, cls)
 *         return cls             # <<<<<<<<<<<<<<
 *     return _callLookupFallback(lookup, doc, c_node)
 * 
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_cls);
    __pyx_r = __pyx_v_cls;
    goto __pyx_L0;

    /* "src/lxml/classlookup.pxi":528
 *     _freeReadOnlyProxies(proxy)
 * 
 *     if cls is not None:             # <<<<<<<<<<<<<<
 *         _validateNodeClass(c_node, cls)
 *         return cls
*/
  }

  /* "src/lxml/classlookup.pxi":531
 *         _validateNodeClass(c_node, cls)
 *         return cls
 *     return _callLookupFallback(lookup, doc, c_node)             # <<<<<<<<<<<<<<
 * 
 * ################################################################################
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree__callLookupFallback(((struct LxmlFallbackElementClassLookup *)__pyx_v_lookup), __pyx_v_doc, __pyx_v_c_node); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 531, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/classlookup.pxi":519
 *         return None
 * 
 * cdef object _python_class_lookup(state, _Document doc, tree.xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     cdef PythonElementClassLookup lookup
 *     cdef _ReadOnlyProxy proxy
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._python_class_lookup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_lookup);
  __Pyx_XDECREF((PyObject *)__pyx_v_proxy);
  __Pyx_XDECREF(__pyx_v_cls);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/classlookup.pxi":539
 * cdef object ELEMENT_CLASS_LOOKUP_STATE
 * 
 * cdef void _setElementClassLookupFunction(             # <<<<<<<<<<<<<<
 *     _element_class_lookup_function function, object state):
 *     global LOOKUP_ELEMENT_CLASS, ELEMENT_CLASS_LOOKUP_STATE
*/

static void __pyx_f_4lxml_5etree__setElementClassLookupFunction(_element_class_lookup_function __pyx_v_function, PyObject *__pyx_v_state) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  _element_class_lookup_function __pyx_t_2;
  __Pyx_RefNannySetupContext("_setElementClassLookupFunction", 0);
  __Pyx_INCREF(__pyx_v_state);

  /* "src/lxml/classlookup.pxi":542
 *     _element_class_lookup_function function, object state):
 *     global LOOKUP_ELEMENT_CLASS, ELEMENT_CLASS_LOOKUP_STATE
 *     if function is NULL:             # <<<<<<<<<<<<<<
 *         state    = DEFAULT_ELEMENT_CLASS_LOOKUP
 *         function = DEFAULT_ELEMENT_CLASS_LOOKUP._lookup_function
*/
  __pyx_t_1 = (__pyx_v_function == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/classlookup.pxi":543
 *     global LOOKUP_ELEMENT_CLASS, ELEMENT_CLASS_LOOKUP_STATE
 *     if function is NULL:
 *         state    = DEFAULT_ELEMENT_CLASS_LOOKUP             # <<<<<<<<<<<<<<
 *         function = DEFAULT_ELEMENT_CLASS_LOOKUP._lookup_function
 * 
*/
    __Pyx_INCREF((PyObject *)__pyx_v_4lxml_5etree_DEFAULT_ELEMENT_CLASS_LOOKUP);
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject *)__pyx_v_4lxml_5etree_DEFAULT_ELEMENT_CLASS_LOOKUP));

    /* "src/lxml/classlookup.pxi":544
 *     if function is NULL:
 *         state    = DEFAULT_ELEMENT_CLASS_LOOKUP
 *         function = DEFAULT_ELEMENT_CLASS_LOOKUP._lookup_function             # <<<<<<<<<<<<<<
 * 
 *     ELEMENT_CLASS_LOOKUP_STATE = state
*/
    __pyx_t_2 = __pyx_v_4lxml_5etree_DEFAULT_ELEMENT_CLASS_LOOKUP->__pyx_base.__pyx_base._lookup_function;
    __pyx_v_function = __pyx_t_2;

    /* "src/lxml/classlookup.pxi":542
 *     _element_class_lookup_function function, object state):
 *     global LOOKUP_ELEMENT_CLASS, ELEMENT_CLASS_LOOKUP_STATE
 *     if function is NULL:             # <<<<<<<<<<<<<<
 *         state    = DEFAULT_ELEMENT_CLASS_LOOKUP
 *         function = DEFAULT_ELEMENT_CLASS_LOOKUP._lookup_function
*/
  }

  /* "src/lxml/classlookup.pxi":546
 *         function = DEFAULT_ELEMENT_CLASS_LOOKUP._lookup_function
 * 
 *     ELEMENT_CLASS_LOOKUP_STATE = state             # <<<<<<<<<<<<<<
 *     LOOKUP_ELEMENT_CLASS = function
 * 
*/
  __Pyx_INCREF(__pyx_v_state);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree_ELEMENT_CLASS_LOOKUP_STATE);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_ELEMENT_CLASS_LOOKUP_STATE, __pyx_v_state);
  __Pyx_GIVEREF(__pyx_v_state);

  /* "src/lxml/classlookup.pxi":547
 * 
 *     ELEMENT_CLASS_LOOKUP_STATE = state
 *     LOOKUP_ELEMENT_CLASS = function             # <<<<<<<<<<<<<<
 * 
 * def set_element_class_lookup(ElementClassLookup lookup = None):
*/
  __pyx_v_4lxml_5etree_LOOKUP_ELEMENT_CLASS = __pyx_v_function;

  /* "src/lxml/classlookup.pxi":539
 * cdef object ELEMENT_CLASS_LOOKUP_STATE
 * 
 * cdef void _setElementClassLookupFunction(             # <<<<<<<<<<<<<<
 *     _element_class_lookup_function function, object state):
 *     global LOOKUP_ELEMENT_CLASS, ELEMENT_CLASS_LOOKUP_STATE
*/

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_RefNannyFinishContext();
}

/* "src/lxml/classlookup.pxi":549
 *     LOOKUP_ELEMENT_CLASS = function
 * 
 * def set_element_class_lookup(ElementClassLookup lookup = None):             # <<<<<<<<<<<<<<
 *     """set_element_class_lookup(lookup = None)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_39set_element_class_lookup(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_38set_element_class_lookup, "set_element_class_lookup(lookup = None)\n\n    Set the global element class lookup method.\n\n    This defines the main entry point for looking up element implementations.\n    The standard implementation uses the :class:`ParserBasedElementClassLookup`\n    to delegate to different lookup schemes for each parser. \n\n    .. warning::\n\n        This should only be changed by applications, not by library packages.\n        In most cases, parser specific lookups should be preferred,\n        which can be configured via\n        :meth:`~lxml.etree.XMLParser.set_element_class_lookup`\n        (and the same for HTML parsers).\n\n        Globally replacing the element class lookup by something other than a\n        :class:`ParserBasedElementClassLookup` will prevent parser specific lookup\n        schemes from working. Several tools rely on parser specific lookups,\n        including :mod:`lxml.html` and :mod:`lxml.objectify`.\n    ");
static PyMethodDef __pyx_mdef_4lxml_5etree_39set_element_class_lookup = {"set_element_class_lookup", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_39set_element_class_lookup, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_38set_element_class_lookup};
static PyObject *__pyx_pw_4lxml_5etree_39set_element_class_lookup(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct LxmlElementClassLookup *__pyx_v_lookup = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_element_class_lookup (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_lookup,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(10, 549, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(10, 549, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "set_element_class_lookup", 0) < (0)) __PYX_ERR(10, 549, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef((PyObject *)((struct LxmlElementClassLookup *)Py_None));
    } else {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(10, 549, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef((PyObject *)((struct LxmlElementClassLookup *)Py_None));
    }
    __pyx_v_lookup = ((struct LxmlElementClassLookup *)values[0]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_element_class_lookup", 0, 0, 1, __pyx_nargs); __PYX_ERR(10, 549, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.set_element_class_lookup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lookup), __pyx_mstate_global->__pyx_ptype_4lxml_5etree_ElementClassLookup, 1, "lookup", 0))) __PYX_ERR(10, 549, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_38set_element_class_lookup(__pyx_self, __pyx_v_lookup);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_38set_element_class_lookup(CYTHON_UNUSED PyObject *__pyx_self, struct LxmlElementClassLookup *__pyx_v_lookup) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_element_class_lookup", 0);

  /* "src/lxml/classlookup.pxi":571
 *         including :mod:`lxml.html` and :mod:`lxml.objectify`.
 *     """
 *     if lookup is None or lookup._lookup_function is NULL:             # <<<<<<<<<<<<<<
 *         _setElementClassLookupFunction(NULL, None)
 *     else:
*/
  __pyx_t_2 = (((PyObject *)__pyx_v_lookup) == Py_None);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_lookup->_lookup_function == NULL);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/classlookup.pxi":572
 *     """
 *     if lookup is None or lookup._lookup_function is NULL:
 *         _setElementClassLookupFunction(NULL, None)             # <<<<<<<<<<<<<<
 *     else:
 *         _setElementClassLookupFunction(lookup._lookup_function, lookup)
*/
    __pyx_f_4lxml_5etree__setElementClassLookupFunction(NULL, Py_None); if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 572, __pyx_L1_error)

    /* "src/lxml/classlookup.pxi":571
 *         including :mod:`lxml.html` and :mod:`lxml.objectify`.
 *     """
 *     if lookup is None or lookup._lookup_function is NULL:             # <<<<<<<<<<<<<<
 *         _setElementClassLookupFunction(NULL, None)
 *     else:
*/
    goto __pyx_L3;
  }

  /* "src/lxml/classlookup.pxi":574
 *         _setElementClassLookupFunction(NULL, None)
 *     else:
 *         _setElementClassLookupFunction(lookup._lookup_function, lookup)             # <<<<<<<<<<<<<<
 * 
 * # default setup: parser delegation
*/
  /*else*/ {
    __pyx_f_4lxml_5etree__setElementClassLookupFunction(__pyx_v_lookup->_lookup_function, ((PyObject *)__pyx_v_lookup)); if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 574, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "src/lxml/classlookup.pxi":549
 *     LOOKUP_ELEMENT_CLASS = function
 * 
 * def set_element_class_lookup(ElementClassLookup lookup = None):             # <<<<<<<<<<<<<<
 *     """set_element_class_lookup(lookup = None)
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.set_element_class_lookup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/nsclasses.pxi":19
 *     cdef dict _entries
 *     cdef char* _c_ns_uri_utf
 *     def __cinit__(self, ns_uri):             # <<<<<<<<<<<<<<
 *         self._ns_uri = ns_uri
 *         if ns_uri is None:
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_18_NamespaceRegistry_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_18_NamespaceRegistry_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_ns_uri = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_ns_uri,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(11, 19, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(11, 19, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__cinit__", 0) < (0)) __PYX_ERR(11, 19, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, i); __PYX_ERR(11, 19, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(11, 19, __pyx_L3_error)
    }
    __pyx_v_ns_uri = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, __pyx_nargs); __PYX_ERR(11, 19, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._NamespaceRegistry.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_18_NamespaceRegistry___cinit__(((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)__pyx_v_self), __pyx_v_ns_uri);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_18_NamespaceRegistry___cinit__(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *__pyx_v_self, PyObject *__pyx_v_ns_uri) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "src/lxml/nsclasses.pxi":20
 *     cdef char* _c_ns_uri_utf
 *     def __cinit__(self, ns_uri):
 *         self._ns_uri = ns_uri             # <<<<<<<<<<<<<<
 *         if ns_uri is None:
 *             self._ns_uri_utf = None
*/
  __Pyx_INCREF(__pyx_v_ns_uri);
  __Pyx_GIVEREF(__pyx_v_ns_uri);
  __Pyx_GOTREF(__pyx_v_self->_ns_uri);
  __Pyx_DECREF(__pyx_v_self->_ns_uri);
  __pyx_v_self->_ns_uri = __pyx_v_ns_uri;

  /* "src/lxml/nsclasses.pxi":21
 *     def __cinit__(self, ns_uri):
 *         self._ns_uri = ns_uri
 *         if ns_uri is None:             # <<<<<<<<<<<<<<
 *             self._ns_uri_utf = None
 *             self._c_ns_uri_utf = NULL
*/
  __pyx_t_1 = (__pyx_v_ns_uri == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/nsclasses.pxi":22
 *         self._ns_uri = ns_uri
 *         if ns_uri is None:
 *             self._ns_uri_utf = None             # <<<<<<<<<<<<<<
 *             self._c_ns_uri_utf = NULL
 *         else:
*/
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_self->_ns_uri_utf);
    __Pyx_DECREF(__pyx_v_self->_ns_uri_utf);
    __pyx_v_self->_ns_uri_utf = ((PyObject*)Py_None);

    /* "src/lxml/nsclasses.pxi":23
 *         if ns_uri is None:
 *             self._ns_uri_utf = None
 *             self._c_ns_uri_utf = NULL             # <<<<<<<<<<<<<<
 *         else:
 *             self._ns_uri_utf = _utf8(ns_uri)
*/
    __pyx_v_self->_c_ns_uri_utf = NULL;

    /* "src/lxml/nsclasses.pxi":21
 *     def __cinit__(self, ns_uri):
 *         self._ns_uri = ns_uri
 *         if ns_uri is None:             # <<<<<<<<<<<<<<
 *             self._ns_uri_utf = None
 *             self._c_ns_uri_utf = NULL
*/
    goto __pyx_L3;
  }

  /* "src/lxml/nsclasses.pxi":25
 *             self._c_ns_uri_utf = NULL
 *         else:
 *             self._ns_uri_utf = _utf8(ns_uri)             # <<<<<<<<<<<<<<
 *             self._c_ns_uri_utf = _cstr(self._ns_uri_utf)
 *         self._entries = {}
*/
  /*else*/ {
    __pyx_t_2 = __pyx_f_4lxml_5etree__utf8(__pyx_v_ns_uri); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 25, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_GOTREF(__pyx_v_self->_ns_uri_utf);
    __Pyx_DECREF(__pyx_v_self->_ns_uri_utf);
    __pyx_v_self->_ns_uri_utf = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/nsclasses.pxi":26
 *         else:
 *             self._ns_uri_utf = _utf8(ns_uri)
 *             self._c_ns_uri_utf = _cstr(self._ns_uri_utf)             # <<<<<<<<<<<<<<
 *         self._entries = {}
 * 
*/
    __pyx_t_2 = __pyx_v_self->_ns_uri_utf;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v_self->_c_ns_uri_utf = PyBytes_AS_STRING(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_L3:;

  /* "src/lxml/nsclasses.pxi":27
 *             self._ns_uri_utf = _utf8(ns_uri)
 *             self._c_ns_uri_utf = _cstr(self._ns_uri_utf)
 *         self._entries = {}             # <<<<<<<<<<<<<<
 * 
 *     def update(self, class_dict_iterable):
*/
  __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 27, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_self->_entries);
  __Pyx_DECREF(__pyx_v_self->_entries);
  __pyx_v_self->_entries = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/nsclasses.pxi":19
 *     cdef dict _entries
 *     cdef char* _c_ns_uri_utf
 *     def __cinit__(self, ns_uri):             # <<<<<<<<<<<<<<
 *         self._ns_uri = ns_uri
 *         if ns_uri is None:
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._NamespaceRegistry.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/nsclasses.pxi":29
 *         self._entries = {}
 * 
 *     def update(self, class_dict_iterable):             # <<<<<<<<<<<<<<
 *         """update(self, class_dict_iterable)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_18_NamespaceRegistry_3update(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_18_NamespaceRegistry_2update, "update(self, class_dict_iterable)\n\n        Forgivingly update the registry.\n\n        ``class_dict_iterable`` may be a dict or some other iterable\n        that yields (name, value) pairs.\n\n        If a value does not match the required type for this registry,\n        or if the name starts with '_', it will be silently discarded.\n        This allows registrations at the module or class level using\n        vars(), globals() etc.");
static PyMethodDef __pyx_mdef_4lxml_5etree_18_NamespaceRegistry_3update = {"update", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_18_NamespaceRegistry_3update, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_18_NamespaceRegistry_2update};
static PyObject *__pyx_pw_4lxml_5etree_18_NamespaceRegistry_3update(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_class_dict_iterable = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("update (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_class_dict_iterable,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(11, 29, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(11, 29, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "update", 0) < (0)) __PYX_ERR(11, 29, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("update", 1, 1, 1, i); __PYX_ERR(11, 29, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(11, 29, __pyx_L3_error)
    }
    __pyx_v_class_dict_iterable = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("update", 1, 1, 1, __pyx_nargs); __PYX_ERR(11, 29, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._NamespaceRegistry.update", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_18_NamespaceRegistry_2update(((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)__pyx_v_self), __pyx_v_class_dict_iterable);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_18_NamespaceRegistry_2update(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *__pyx_v_self, PyObject *__pyx_v_class_dict_iterable) {
  PyObject *__pyx_v_name = NULL;
  PyObject *__pyx_v_item = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  PyObject *(*__pyx_t_6)(PyObject *);
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *(*__pyx_t_10)(PyObject *);
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("update", 0);
  __Pyx_INCREF(__pyx_v_class_dict_iterable);

  /* "src/lxml/nsclasses.pxi":41
 *         This allows registrations at the module or class level using
 *         vars(), globals() etc."""
 *         if hasattr(class_dict_iterable, 'items'):             # <<<<<<<<<<<<<<
 *             class_dict_iterable = class_dict_iterable.items()
 *         for name, item in class_dict_iterable:
*/
  __pyx_t_1 = __Pyx_HasAttr(__pyx_v_class_dict_iterable, __pyx_mstate_global->__pyx_n_u_items); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(11, 41, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/nsclasses.pxi":42
 *         vars(), globals() etc."""
 *         if hasattr(class_dict_iterable, 'items'):
 *             class_dict_iterable = class_dict_iterable.items()             # <<<<<<<<<<<<<<
 *         for name, item in class_dict_iterable:
 *             if (name is None or name[:1] != '_') and callable(item):
*/
    __pyx_t_3 = __pyx_v_class_dict_iterable;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_items, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 42, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_DECREF_SET(__pyx_v_class_dict_iterable, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/nsclasses.pxi":41
 *         This allows registrations at the module or class level using
 *         vars(), globals() etc."""
 *         if hasattr(class_dict_iterable, 'items'):             # <<<<<<<<<<<<<<
 *             class_dict_iterable = class_dict_iterable.items()
 *         for name, item in class_dict_iterable:
*/
  }

  /* "src/lxml/nsclasses.pxi":43
 *         if hasattr(class_dict_iterable, 'items'):
 *             class_dict_iterable = class_dict_iterable.items()
 *         for name, item in class_dict_iterable:             # <<<<<<<<<<<<<<
 *             if (name is None or name[:1] != '_') and callable(item):
 *                 self[name] = item
*/
  if (likely(PyList_CheckExact(__pyx_v_class_dict_iterable)) || PyTuple_CheckExact(__pyx_v_class_dict_iterable)) {
    __pyx_t_2 = __pyx_v_class_dict_iterable; __Pyx_INCREF(__pyx_t_2);
    __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
  } else {
    __pyx_t_5 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_class_dict_iterable); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 43, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(11, 43, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_6)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(11, 43, __pyx_L1_error)
          #endif
          if (__pyx_t_5 >= __pyx_temp) break;
        }
        __pyx_t_3 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_5, __Pyx_ReferenceSharing_OwnStrongReference);
        ++__pyx_t_5;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(11, 43, __pyx_L1_error)
          #endif
          if (__pyx_t_5 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5));
        #else
        __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_5);
        #endif
        ++__pyx_t_5;
      }
      if (unlikely(!__pyx_t_3)) __PYX_ERR(11, 43, __pyx_L1_error)
    } else {
      __pyx_t_3 = __pyx_t_6(__pyx_t_2);
      if (unlikely(!__pyx_t_3)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(11, 43, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_3);
    if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
      PyObject* sequence = __pyx_t_3;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(11, 43, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0);
        __Pyx_INCREF(__pyx_t_7);
        __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1);
        __Pyx_INCREF(__pyx_t_8);
      } else {
        __pyx_t_7 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_7)) __PYX_ERR(11, 43, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_7);
        __pyx_t_8 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_8)) __PYX_ERR(11, 43, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_8);
      }
      #else
      __pyx_t_7 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(11, 43, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(11, 43, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      #endif
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_9 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(11, 43, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_10 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_9);
      index = 0; __pyx_t_7 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_7)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      index = 1; __pyx_t_8 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_8);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 2) < (0)) __PYX_ERR(11, 43, __pyx_L1_error)
      __pyx_t_10 = NULL;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L7_unpacking_done;
      __pyx_L6_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_10 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(11, 43, __pyx_L1_error)
      __pyx_L7_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_7);
    __pyx_t_7 = 0;
    __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_8);
    __pyx_t_8 = 0;

    /* "src/lxml/nsclasses.pxi":44
 *             class_dict_iterable = class_dict_iterable.items()
 *         for name, item in class_dict_iterable:
 *             if (name is None or name[:1] != '_') and callable(item):             # <<<<<<<<<<<<<<
 *                 self[name] = item
 * 
*/
    __pyx_t_11 = (__pyx_v_name == Py_None);
    if (!__pyx_t_11) {
    } else {
      goto __pyx_L10_next_and;
    }
    __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_name, 0, 1, NULL, NULL, &__pyx_mstate_global->__pyx_slice[5], 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(11, 44, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_11 = (__Pyx_PyUnicode_Equals(__pyx_t_3, __pyx_mstate_global->__pyx_n_u__28, Py_NE)); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(11, 44, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_11) {
    } else {
      __pyx_t_1 = __pyx_t_11;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_L10_next_and:;
    __pyx_t_11 = __Pyx_PyCallable_Check(__pyx_v_item); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(11, 44, __pyx_L1_error)
    __pyx_t_1 = __pyx_t_11;
    __pyx_L9_bool_binop_done:;
    if (__pyx_t_1) {

      /* "src/lxml/nsclasses.pxi":45
 *         for name, item in class_dict_iterable:
 *             if (name is None or name[:1] != '_') and callable(item):
 *                 self[name] = item             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, name):
*/
      if (unlikely((PyObject_SetItem(((PyObject *)__pyx_v_self), __pyx_v_name, __pyx_v_item) < 0))) __PYX_ERR(11, 45, __pyx_L1_error)

      /* "src/lxml/nsclasses.pxi":44
 *             class_dict_iterable = class_dict_iterable.items()
 *         for name, item in class_dict_iterable:
 *             if (name is None or name[:1] != '_') and callable(item):             # <<<<<<<<<<<<<<
 *                 self[name] = item
 * 
*/
    }

    /* "src/lxml/nsclasses.pxi":43
 *         if hasattr(class_dict_iterable, 'items'):
 *             class_dict_iterable = class_dict_iterable.items()
 *         for name, item in class_dict_iterable:             # <<<<<<<<<<<<<<
 *             if (name is None or name[:1] != '_') and callable(item):
 *                 self[name] = item
*/
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/nsclasses.pxi":29
 *         self._entries = {}
 * 
 *     def update(self, class_dict_iterable):             # <<<<<<<<<<<<<<
 *         """update(self, class_dict_iterable)
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("lxml.etree._NamespaceRegistry.update", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_XDECREF(__pyx_v_class_dict_iterable);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/nsclasses.pxi":47
 *                 self[name] = item
 * 
 *     def __getitem__(self, name):             # <<<<<<<<<<<<<<
 *         if name is not None:
 *             name = _utf8(name)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_18_NamespaceRegistry_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_name); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_18_NamespaceRegistry_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_name) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_18_NamespaceRegistry_4__getitem__(((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)__pyx_v_self), ((PyObject *)__pyx_v_name));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_18_NamespaceRegistry_4__getitem__(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *__pyx_v_self, PyObject *__pyx_v_name) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);
  __Pyx_INCREF(__pyx_v_name);

  /* "src/lxml/nsclasses.pxi":48
 * 
 *     def __getitem__(self, name):
 *         if name is not None:             # <<<<<<<<<<<<<<
 *             name = _utf8(name)
 *         return self._get(name)
*/
  __pyx_t_1 = (__pyx_v_name != Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/nsclasses.pxi":49
 *     def __getitem__(self, name):
 *         if name is not None:
 *             name = _utf8(name)             # <<<<<<<<<<<<<<
 *         return self._get(name)
 * 
*/
    __pyx_t_2 = __pyx_f_4lxml_5etree__utf8(__pyx_v_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 49, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/nsclasses.pxi":48
 * 
 *     def __getitem__(self, name):
 *         if name is not None:             # <<<<<<<<<<<<<<
 *             name = _utf8(name)
 *         return self._get(name)
*/
  }

  /* "src/lxml/nsclasses.pxi":50
 *         if name is not None:
 *             name = _utf8(name)
 *         return self._get(name)             # <<<<<<<<<<<<<<
 * 
 *     def __delitem__(self, name):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__NamespaceRegistry *)__pyx_v_self->__pyx_vtab)->_get(__pyx_v_self, __pyx_v_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 50, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/nsclasses.pxi":47
 *                 self[name] = item
 * 
 *     def __getitem__(self, name):             # <<<<<<<<<<<<<<
 *         if name is not None:
 *             name = _utf8(name)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._NamespaceRegistry.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/nsclasses.pxi":52
 *         return self._get(name)
 * 
 *     def __delitem__(self, name):             # <<<<<<<<<<<<<<
 *         if name is not None:
 *             name = _utf8(name)
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_18_NamespaceRegistry_7__delitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_name); /*proto*/
static int __pyx_pw_4lxml_5etree_18_NamespaceRegistry_7__delitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_name) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__delitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_18_NamespaceRegistry_6__delitem__(((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)__pyx_v_self), ((PyObject *)__pyx_v_name));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_18_NamespaceRegistry_6__delitem__(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *__pyx_v_self, PyObject *__pyx_v_name) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__delitem__", 0);
  __Pyx_INCREF(__pyx_v_name);

  /* "src/lxml/nsclasses.pxi":53
 * 
 *     def __delitem__(self, name):
 *         if name is not None:             # <<<<<<<<<<<<<<
 *             name = _utf8(name)
 *         del self._entries[name]
*/
  __pyx_t_1 = (__pyx_v_name != Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/nsclasses.pxi":54
 *     def __delitem__(self, name):
 *         if name is not None:
 *             name = _utf8(name)             # <<<<<<<<<<<<<<
 *         del self._entries[name]
 * 
*/
    __pyx_t_2 = __pyx_f_4lxml_5etree__utf8(__pyx_v_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 54, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/nsclasses.pxi":53
 * 
 *     def __delitem__(self, name):
 *         if name is not None:             # <<<<<<<<<<<<<<
 *             name = _utf8(name)
 *         del self._entries[name]
*/
  }

  /* "src/lxml/nsclasses.pxi":55
 *         if name is not None:
 *             name = _utf8(name)
 *         del self._entries[name]             # <<<<<<<<<<<<<<
 * 
 *     cdef object _get(self, object name):
*/
  if (unlikely(__pyx_v_self->_entries == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(11, 55, __pyx_L1_error)
  }
  if (unlikely((PyDict_DelItem(__pyx_v_self->_entries, __pyx_v_name) < 0))) __PYX_ERR(11, 55, __pyx_L1_error)

  /* "src/lxml/nsclasses.pxi":52
 *         return self._get(name)
 * 
 *     def __delitem__(self, name):             # <<<<<<<<<<<<<<
 *         if name is not None:
 *             name = _utf8(name)
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._NamespaceRegistry.__delitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/nsclasses.pxi":57
 *         del self._entries[name]
 * 
 *     cdef object _get(self, object name):             # <<<<<<<<<<<<<<
 *         cdef python.PyObject* dict_result
 *         dict_result = python.PyDict_GetItem(self._entries, name)
*/

static PyObject *__pyx_f_4lxml_5etree_18_NamespaceRegistry__get(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *__pyx_v_self, PyObject *__pyx_v_name) {
  PyObject *__pyx_v_dict_result;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get", 0);

  /* "src/lxml/nsclasses.pxi":59
 *     cdef object _get(self, object name):
 *         cdef python.PyObject* dict_result
 *         dict_result = python.PyDict_GetItem(self._entries, name)             # <<<<<<<<<<<<<<
 *         if dict_result is NULL:
 *             raise KeyError, "Name not registered."
*/
  __pyx_t_1 = __pyx_v_self->_entries;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_dict_result = PyDict_GetItem(__pyx_t_1, __pyx_v_name);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/nsclasses.pxi":60
 *         cdef python.PyObject* dict_result
 *         dict_result = python.PyDict_GetItem(self._entries, name)
 *         if dict_result is NULL:             # <<<<<<<<<<<<<<
 *             raise KeyError, "Name not registered."
 *         return <object>dict_result
*/
  __pyx_t_2 = (__pyx_v_dict_result == NULL);
  if (unlikely(__pyx_t_2)) {

    /* "src/lxml/nsclasses.pxi":61
 *         dict_result = python.PyDict_GetItem(self._entries, name)
 *         if dict_result is NULL:
 *             raise KeyError, "Name not registered."             # <<<<<<<<<<<<<<
 *         return <object>dict_result
 * 
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_KeyError))), __pyx_mstate_global->__pyx_kp_u_Name_not_registered, 0, 0);
    __PYX_ERR(11, 61, __pyx_L1_error)

    /* "src/lxml/nsclasses.pxi":60
 *         cdef python.PyObject* dict_result
 *         dict_result = python.PyDict_GetItem(self._entries, name)
 *         if dict_result is NULL:             # <<<<<<<<<<<<<<
 *             raise KeyError, "Name not registered."
 *         return <object>dict_result
*/
  }

  /* "src/lxml/nsclasses.pxi":62
 *         if dict_result is NULL:
 *             raise KeyError, "Name not registered."
 *         return <object>dict_result             # <<<<<<<<<<<<<<
 * 
 *     cdef object _getForString(self, char* name):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_dict_result));
  __pyx_r = ((PyObject *)__pyx_v_dict_result);
  goto __pyx_L0;

  /* "src/lxml/nsclasses.pxi":57
 *         del self._entries[name]
 * 
 *     cdef object _get(self, object name):             # <<<<<<<<<<<<<<
 *         cdef python.PyObject* dict_result
 *         dict_result = python.PyDict_GetItem(self._entries, name)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._NamespaceRegistry._get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/nsclasses.pxi":64
 *         return <object>dict_result
 * 
 *     cdef object _getForString(self, char* name):             # <<<<<<<<<<<<<<
 *         cdef python.PyObject* dict_result
 *         dict_result = python.PyDict_GetItem(self._entries, name)
*/

static PyObject *__pyx_f_4lxml_5etree_18_NamespaceRegistry__getForString(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *__pyx_v_self, char *__pyx_v_name) {
  PyObject *__pyx_v_dict_result;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_getForString", 0);

  /* "src/lxml/nsclasses.pxi":66
 *     cdef object _getForString(self, char* name):
 *         cdef python.PyObject* dict_result
 *         dict_result = python.PyDict_GetItem(self._entries, name)             # <<<<<<<<<<<<<<
 *         if dict_result is NULL:
 *             raise KeyError, "Name not registered."
*/
  __pyx_t_1 = __pyx_v_self->_entries;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 66, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_dict_result = PyDict_GetItem(__pyx_t_1, __pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/nsclasses.pxi":67
 *         cdef python.PyObject* dict_result
 *         dict_result = python.PyDict_GetItem(self._entries, name)
 *         if dict_result is NULL:             # <<<<<<<<<<<<<<
 *             raise KeyError, "Name not registered."
 *         return <object>dict_result
*/
  __pyx_t_3 = (__pyx_v_dict_result == NULL);
  if (unlikely(__pyx_t_3)) {

    /* "src/lxml/nsclasses.pxi":68
 *         dict_result = python.PyDict_GetItem(self._entries, name)
 *         if dict_result is NULL:
 *             raise KeyError, "Name not registered."             # <<<<<<<<<<<<<<
 *         return <object>dict_result
 * 
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_KeyError))), __pyx_mstate_global->__pyx_kp_u_Name_not_registered, 0, 0);
    __PYX_ERR(11, 68, __pyx_L1_error)

    /* "src/lxml/nsclasses.pxi":67
 *         cdef python.PyObject* dict_result
 *         dict_result = python.PyDict_GetItem(self._entries, name)
 *         if dict_result is NULL:             # <<<<<<<<<<<<<<
 *             raise KeyError, "Name not registered."
 *         return <object>dict_result
*/
  }

  /* "src/lxml/nsclasses.pxi":69
 *         if dict_result is NULL:
 *             raise KeyError, "Name not registered."
 *         return <object>dict_result             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_dict_result));
  __pyx_r = ((PyObject *)__pyx_v_dict_result);
  goto __pyx_L0;

  /* "src/lxml/nsclasses.pxi":64
 *         return <object>dict_result
 * 
 *     cdef object _getForString(self, char* name):             # <<<<<<<<<<<<<<
 *         cdef python.PyObject* dict_result
 *         dict_result = python.PyDict_GetItem(self._entries, name)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._NamespaceRegistry._getForString", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/nsclasses.pxi":71
 *         return <object>dict_result
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return iter(self._entries)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_18_NamespaceRegistry_9__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_18_NamespaceRegistry_9__iter__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_18_NamespaceRegistry_8__iter__(((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_18_NamespaceRegistry_8__iter__(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "src/lxml/nsclasses.pxi":72
 * 
 *     def __iter__(self):
 *         return iter(self._entries)             # <<<<<<<<<<<<<<
 * 
 *     def items(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_v_self->_entries;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 72, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/nsclasses.pxi":71
 *         return <object>dict_result
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return iter(self._entries)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._NamespaceRegistry.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/nsclasses.pxi":74
 *         return iter(self._entries)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         return list(self._entries.items())
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_18_NamespaceRegistry_11items(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_18_NamespaceRegistry_11items = {"items", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_18_NamespaceRegistry_11items, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_18_NamespaceRegistry_11items(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("items", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("items", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_18_NamespaceRegistry_10items(((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_18_NamespaceRegistry_10items(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("items", 0);

  /* "src/lxml/nsclasses.pxi":75
 * 
 *     def items(self):
 *         return list(self._entries.items())             # <<<<<<<<<<<<<<
 * 
 *     def iteritems(self):
*/
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(__pyx_v_self->_entries == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
    __PYX_ERR(11, 75, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyDict_Items(__pyx_v_self->_entries); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 75, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PySequence_ListKeepNew(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 75, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/nsclasses.pxi":74
 *         return iter(self._entries)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         return list(self._entries.items())
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._NamespaceRegistry.items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/nsclasses.pxi":77
 *         return list(self._entries.items())
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         return iter(self._entries.items())
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_18_NamespaceRegistry_13iteritems(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_18_NamespaceRegistry_13iteritems = {"iteritems", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_18_NamespaceRegistry_13iteritems, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_18_NamespaceRegistry_13iteritems(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iteritems (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("iteritems", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("iteritems", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_18_NamespaceRegistry_12iteritems(((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_18_NamespaceRegistry_12iteritems(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("iteritems", 0);

  /* "src/lxml/nsclasses.pxi":78
 * 
 *     def iteritems(self):
 *         return iter(self._entries.items())             # <<<<<<<<<<<<<<
 * 
 *     def clear(self):
*/
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(__pyx_v_self->_entries == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
    __PYX_ERR(11, 78, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyDict_Items(__pyx_v_self->_entries); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 78, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 78, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/nsclasses.pxi":77
 *         return list(self._entries.items())
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         return iter(self._entries.items())
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._NamespaceRegistry.iteritems", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/nsclasses.pxi":80
 *         return iter(self._entries.items())
 * 
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         self._entries.clear()
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_18_NamespaceRegistry_15clear(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_18_NamespaceRegistry_15clear = {"clear", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_18_NamespaceRegistry_15clear, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_18_NamespaceRegistry_15clear(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clear (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("clear", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("clear", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_18_NamespaceRegistry_14clear(((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_18_NamespaceRegistry_14clear(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("clear", 0);

  /* "src/lxml/nsclasses.pxi":81
 * 
 *     def clear(self):
 *         self._entries.clear()             # <<<<<<<<<<<<<<
 * 
 *     def __call__(self, obj):
*/
  if (unlikely(__pyx_v_self->_entries == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "clear");
    __PYX_ERR(11, 81, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyDict_Clear(__pyx_v_self->_entries); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(11, 81, __pyx_L1_error)

  /* "src/lxml/nsclasses.pxi":80
 *         return iter(self._entries.items())
 * 
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         self._entries.clear()
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._NamespaceRegistry.clear", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/nsclasses.pxi":83
 *         self._entries.clear()
 * 
 *     def __call__(self, obj):             # <<<<<<<<<<<<<<
 *         # Usage as decorator:
 *         #   ns = lookup.get_namespace("...")
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_18_NamespaceRegistry_17__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_18_NamespaceRegistry_17__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_obj = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_obj,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(11, 83, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(11, 83, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__call__", 0) < (0)) __PYX_ERR(11, 83, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, i); __PYX_ERR(11, 83, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(11, 83, __pyx_L3_error)
    }
    __pyx_v_obj = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, __pyx_nargs); __PYX_ERR(11, 83, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._NamespaceRegistry.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_18_NamespaceRegistry_16__call__(((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)__pyx_v_self), __pyx_v_obj);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_18_NamespaceRegistry_16__call__(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *__pyx_v_self, PyObject *__pyx_v_obj) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  size_t __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__call__", 0);

  /* "src/lxml/nsclasses.pxi":92
 *         #   class elementname(ElementBase): pass
 * 
 *         if obj is None or python._isString(obj):             # <<<<<<<<<<<<<<
 *             # @ns(None) or @ns('tag')
 *             return partial(self.__deco, obj)
*/
  __pyx_t_2 = (__pyx_v_obj == Py_None);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = _isString(__pyx_v_obj);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/nsclasses.pxi":94
 *         if obj is None or python._isString(obj):
 *             # @ns(None) or @ns('tag')
 *             return partial(self.__deco, obj)             # <<<<<<<<<<<<<<
 *         # plain @ns decorator
 *         self[obj.__name__] = obj
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_v_4lxml_5etree_partial);
    __pyx_t_5 = __pyx_v_4lxml_5etree_partial; 
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_NamespaceRegistry__deco); if (unlikely(!__pyx_t_6)) __PYX_ERR(11, 94, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
      assert(__pyx_t_4);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
      __pyx_t_7 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_t_6, __pyx_v_obj};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(11, 94, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "src/lxml/nsclasses.pxi":92
 *         #   class elementname(ElementBase): pass
 * 
 *         if obj is None or python._isString(obj):             # <<<<<<<<<<<<<<
 *             # @ns(None) or @ns('tag')
 *             return partial(self.__deco, obj)
*/
  }

  /* "src/lxml/nsclasses.pxi":96
 *             return partial(self.__deco, obj)
 *         # plain @ns decorator
 *         self[obj.__name__] = obj             # <<<<<<<<<<<<<<
 *         return obj
 * 
*/
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_obj, __pyx_mstate_global->__pyx_n_u_name_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(11, 96, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (unlikely((PyObject_SetItem(((PyObject *)__pyx_v_self), __pyx_t_3, __pyx_v_obj) < 0))) __PYX_ERR(11, 96, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/nsclasses.pxi":97
 *         # plain @ns decorator
 *         self[obj.__name__] = obj
 *         return obj             # <<<<<<<<<<<<<<
 * 
 *     def __deco(self, name, obj):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_obj);
  __pyx_r = __pyx_v_obj;
  goto __pyx_L0;

  /* "src/lxml/nsclasses.pxi":83
 *         self._entries.clear()
 * 
 *     def __call__(self, obj):             # <<<<<<<<<<<<<<
 *         # Usage as decorator:
 *         #   ns = lookup.get_namespace("...")
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._NamespaceRegistry.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/nsclasses.pxi":99
 *         return obj
 * 
 *     def __deco(self, name, obj):             # <<<<<<<<<<<<<<
 *         self[name] = obj
 *         return obj
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_18_NamespaceRegistry_19_NamespaceRegistry__deco(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_18_NamespaceRegistry_19_NamespaceRegistry__deco = {"_NamespaceRegistry__deco", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_18_NamespaceRegistry_19_NamespaceRegistry__deco, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_18_NamespaceRegistry_19_NamespaceRegistry__deco(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_obj = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_NamespaceRegistry__deco (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_name,&__pyx_mstate_global->__pyx_n_u_obj,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(11, 99, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(11, 99, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(11, 99, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_NamespaceRegistry__deco", 0) < (0)) __PYX_ERR(11, 99, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_NamespaceRegistry__deco", 1, 2, 2, i); __PYX_ERR(11, 99, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(11, 99, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(11, 99, __pyx_L3_error)
    }
    __pyx_v_name = values[0];
    __pyx_v_obj = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_NamespaceRegistry__deco", 1, 2, 2, __pyx_nargs); __PYX_ERR(11, 99, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._NamespaceRegistry._NamespaceRegistry__deco", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_18_NamespaceRegistry_18__deco(((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)__pyx_v_self), __pyx_v_name, __pyx_v_obj);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_18_NamespaceRegistry_18__deco(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_obj) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_NamespaceRegistry__deco", 0);

  /* "src/lxml/nsclasses.pxi":100
 * 
 *     def __deco(self, name, obj):
 *         self[name] = obj             # <<<<<<<<<<<<<<
 *         return obj
 * 
*/
  if (unlikely((PyObject_SetItem(((PyObject *)__pyx_v_self), __pyx_v_name, __pyx_v_obj) < 0))) __PYX_ERR(11, 100, __pyx_L1_error)

  /* "src/lxml/nsclasses.pxi":101
 *     def __deco(self, name, obj):
 *         self[name] = obj
 *         return obj             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_obj);
  __pyx_r = __pyx_v_obj;
  goto __pyx_L0;

  /* "src/lxml/nsclasses.pxi":99
 *         return obj
 * 
 *     def __deco(self, name, obj):             # <<<<<<<<<<<<<<
 *         self[name] = obj
 *         return obj
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._NamespaceRegistry._NamespaceRegistry__deco", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/nsclasses.pxi":108
 * cdef class _ClassNamespaceRegistry(_NamespaceRegistry):
 *     "Dictionary-like registry for namespace implementation classes"
 *     def __setitem__(self, name, item):             # <<<<<<<<<<<<<<
 *         if not isinstance(item, type) or not issubclass(item, ElementBase):
 *             raise NamespaceRegistryError, \
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_23_ClassNamespaceRegistry_1__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_item); /*proto*/
static int __pyx_pw_4lxml_5etree_23_ClassNamespaceRegistry_1__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_item) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_23_ClassNamespaceRegistry___setitem__(((struct __pyx_obj_4lxml_5etree__ClassNamespaceRegistry *)__pyx_v_self), ((PyObject *)__pyx_v_name), ((PyObject *)__pyx_v_item));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_23_ClassNamespaceRegistry___setitem__(struct __pyx_obj_4lxml_5etree__ClassNamespaceRegistry *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_item) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setitem__", 0);
  __Pyx_INCREF(__pyx_v_name);

  /* "src/lxml/nsclasses.pxi":109
 *     "Dictionary-like registry for namespace implementation classes"
 *     def __setitem__(self, name, item):
 *         if not isinstance(item, type) or not issubclass(item, ElementBase):             # <<<<<<<<<<<<<<
 *             raise NamespaceRegistryError, \
 *                 "Registered element classes must be subtypes of ElementBase"
*/
  __pyx_t_2 = PyType_Check(__pyx_v_item); 
  __pyx_t_3 = (!__pyx_t_2);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = PyObject_IsSubclass(__pyx_v_item, ((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_ElementBase)); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(11, 109, __pyx_L1_error)
  __pyx_t_2 = (!__pyx_t_3);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/nsclasses.pxi":110
 *     def __setitem__(self, name, item):
 *         if not isinstance(item, type) or not issubclass(item, ElementBase):
 *             raise NamespaceRegistryError, \             # <<<<<<<<<<<<<<
 *                 "Registered element classes must be subtypes of ElementBase"
 *         if name is not None:
*/
    __Pyx_Raise(((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_NamespaceRegistryError), __pyx_mstate_global->__pyx_kp_u_Registered_element_classes_must, 0, 0);
    __PYX_ERR(11, 110, __pyx_L1_error)

    /* "src/lxml/nsclasses.pxi":109
 *     "Dictionary-like registry for namespace implementation classes"
 *     def __setitem__(self, name, item):
 *         if not isinstance(item, type) or not issubclass(item, ElementBase):             # <<<<<<<<<<<<<<
 *             raise NamespaceRegistryError, \
 *                 "Registered element classes must be subtypes of ElementBase"
*/
  }

  /* "src/lxml/nsclasses.pxi":112
 *             raise NamespaceRegistryError, \
 *                 "Registered element classes must be subtypes of ElementBase"
 *         if name is not None:             # <<<<<<<<<<<<<<
 *             name = _utf8(name)
 *         self._entries[name] = item
*/
  __pyx_t_1 = (__pyx_v_name != Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/nsclasses.pxi":113
 *                 "Registered element classes must be subtypes of ElementBase"
 *         if name is not None:
 *             name = _utf8(name)             # <<<<<<<<<<<<<<
 *         self._entries[name] = item
 * 
*/
    __pyx_t_4 = __pyx_f_4lxml_5etree__utf8(__pyx_v_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(11, 113, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "src/lxml/nsclasses.pxi":112
 *             raise NamespaceRegistryError, \
 *                 "Registered element classes must be subtypes of ElementBase"
 *         if name is not None:             # <<<<<<<<<<<<<<
 *             name = _utf8(name)
 *         self._entries[name] = item
*/
  }

  /* "src/lxml/nsclasses.pxi":114
 *         if name is not None:
 *             name = _utf8(name)
 *         self._entries[name] = item             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
*/
  if (unlikely(__pyx_v_self->__pyx_base._entries == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(11, 114, __pyx_L1_error)
  }
  if (unlikely((PyDict_SetItem(__pyx_v_self->__pyx_base._entries, __pyx_v_name, __pyx_v_item) < 0))) __PYX_ERR(11, 114, __pyx_L1_error)

  /* "src/lxml/nsclasses.pxi":108
 * cdef class _ClassNamespaceRegistry(_NamespaceRegistry):
 *     "Dictionary-like registry for namespace implementation classes"
 *     def __setitem__(self, name, item):             # <<<<<<<<<<<<<<
 *         if not isinstance(item, type) or not issubclass(item, ElementBase):
 *             raise NamespaceRegistryError, \
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._ClassNamespaceRegistry.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/nsclasses.pxi":116
 *         self._entries[name] = item
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "Namespace(%r)" % self._ns_uri
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_23_ClassNamespaceRegistry_3__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_23_ClassNamespaceRegistry_3__repr__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_23_ClassNamespaceRegistry_2__repr__(((struct __pyx_obj_4lxml_5etree__ClassNamespaceRegistry *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_23_ClassNamespaceRegistry_2__repr__(struct __pyx_obj_4lxml_5etree__ClassNamespaceRegistry *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "src/lxml/nsclasses.pxi":117
 * 
 *     def __repr__(self):
 *         return "Namespace(%r)" % self._ns_uri             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyUnicode_FormatSafe(__pyx_mstate_global->__pyx_kp_u_Namespace_r, __pyx_v_self->__pyx_base._ns_uri); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 117, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/nsclasses.pxi":116
 *         self._entries[name] = item
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "Namespace(%r)" % self._ns_uri
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ClassNamespaceRegistry.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/nsclasses.pxi":140
 *     """
 *     cdef dict _namespace_registries
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._namespace_registries = {}
 * 
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_27ElementNamespaceClassLookup_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_27ElementNamespaceClassLookup_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, __pyx_nargs); return -1; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return -1;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__cinit__", __pyx_kwds); return -1;}
  __pyx_r = __pyx_pf_4lxml_5etree_27ElementNamespaceClassLookup___cinit__(((struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_27ElementNamespaceClassLookup___cinit__(struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "src/lxml/nsclasses.pxi":141
 *     cdef dict _namespace_registries
 *     def __cinit__(self):
 *         self._namespace_registries = {}             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, ElementClassLookup fallback=None):
*/
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 141, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_namespace_registries);
  __Pyx_DECREF(__pyx_v_self->_namespace_registries);
  __pyx_v_self->_namespace_registries = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/nsclasses.pxi":140
 *     """
 *     cdef dict _namespace_registries
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._namespace_registries = {}
 * 
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.ElementNamespaceClassLookup.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/nsclasses.pxi":143
 *         self._namespace_registries = {}
 * 
 *     def __init__(self, ElementClassLookup fallback=None):             # <<<<<<<<<<<<<<
 *         FallbackElementClassLookup.__init__(self, fallback)
 *         self._lookup_function = _find_nselement_class
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_27ElementNamespaceClassLookup_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_27ElementNamespaceClassLookup_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct LxmlElementClassLookup *__pyx_v_fallback = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_fallback,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(11, 143, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(11, 143, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(11, 143, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef((PyObject *)((struct LxmlElementClassLookup *)Py_None));
    } else {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(11, 143, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef((PyObject *)((struct LxmlElementClassLookup *)Py_None));
    }
    __pyx_v_fallback = ((struct LxmlElementClassLookup *)values[0]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, __pyx_nargs); __PYX_ERR(11, 143, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.ElementNamespaceClassLookup.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fallback), __pyx_mstate_global->__pyx_ptype_4lxml_5etree_ElementClassLookup, 1, "fallback", 0))) __PYX_ERR(11, 143, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_27ElementNamespaceClassLookup_2__init__(((struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *)__pyx_v_self), __pyx_v_fallback);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_27ElementNamespaceClassLookup_2__init__(struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *__pyx_v_self, struct LxmlElementClassLookup *__pyx_v_fallback) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "src/lxml/nsclasses.pxi":144
 * 
 *     def __init__(self, ElementClassLookup fallback=None):
 *         FallbackElementClassLookup.__init__(self, fallback)             # <<<<<<<<<<<<<<
 *         self._lookup_function = _find_nselement_class
 * 
*/
  __pyx_t_2 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_FallbackElementClassLookup);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_2, ((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_fallback)};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_init, __pyx_callargs+__pyx_t_3, (3-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 144, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/nsclasses.pxi":145
 *     def __init__(self, ElementClassLookup fallback=None):
 *         FallbackElementClassLookup.__init__(self, fallback)
 *         self._lookup_function = _find_nselement_class             # <<<<<<<<<<<<<<
 * 
 *     def get_namespace(self, ns_uri):
*/
  __pyx_v_self->__pyx_base.__pyx_base._lookup_function = __pyx_f_4lxml_5etree__find_nselement_class;

  /* "src/lxml/nsclasses.pxi":143
 *         self._namespace_registries = {}
 * 
 *     def __init__(self, ElementClassLookup fallback=None):             # <<<<<<<<<<<<<<
 *         FallbackElementClassLookup.__init__(self, fallback)
 *         self._lookup_function = _find_nselement_class
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.ElementNamespaceClassLookup.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/nsclasses.pxi":147
 *         self._lookup_function = _find_nselement_class
 * 
 *     def get_namespace(self, ns_uri):             # <<<<<<<<<<<<<<
 *         """get_namespace(self, ns_uri)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_27ElementNamespaceClassLookup_5get_namespace(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_27ElementNamespaceClassLookup_4get_namespace, "get_namespace(self, ns_uri)\n\n        Retrieve the namespace object associated with the given URI.\n        Pass None for the empty namespace.\n\n        Creates a new namespace object if it does not yet exist.");
static PyMethodDef __pyx_mdef_4lxml_5etree_27ElementNamespaceClassLookup_5get_namespace = {"get_namespace", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_27ElementNamespaceClassLookup_5get_namespace, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_27ElementNamespaceClassLookup_4get_namespace};
static PyObject *__pyx_pw_4lxml_5etree_27ElementNamespaceClassLookup_5get_namespace(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_ns_uri = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_namespace (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_ns_uri,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(11, 147, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(11, 147, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "get_namespace", 0) < (0)) __PYX_ERR(11, 147, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("get_namespace", 1, 1, 1, i); __PYX_ERR(11, 147, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(11, 147, __pyx_L3_error)
    }
    __pyx_v_ns_uri = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_namespace", 1, 1, 1, __pyx_nargs); __PYX_ERR(11, 147, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.ElementNamespaceClassLookup.get_namespace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_27ElementNamespaceClassLookup_4get_namespace(((struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *)__pyx_v_self), __pyx_v_ns_uri);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_27ElementNamespaceClassLookup_4get_namespace(struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *__pyx_v_self, PyObject *__pyx_v_ns_uri) {
  PyObject *__pyx_v_ns_utf = NULL;
  struct __pyx_obj_4lxml_5etree__ClassNamespaceRegistry *__pyx_v_registry = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  size_t __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_namespace", 0);

  /* "src/lxml/nsclasses.pxi":154
 * 
 *         Creates a new namespace object if it does not yet exist."""
 *         if ns_uri:             # <<<<<<<<<<<<<<
 *             ns_utf = _utf8(ns_uri)
 *         else:
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_ns_uri); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(11, 154, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/nsclasses.pxi":155
 *         Creates a new namespace object if it does not yet exist."""
 *         if ns_uri:
 *             ns_utf = _utf8(ns_uri)             # <<<<<<<<<<<<<<
 *         else:
 *             ns_utf = None
*/
    __pyx_t_2 = __pyx_f_4lxml_5etree__utf8(__pyx_v_ns_uri); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 155, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_ns_utf = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/nsclasses.pxi":154
 * 
 *         Creates a new namespace object if it does not yet exist."""
 *         if ns_uri:             # <<<<<<<<<<<<<<
 *             ns_utf = _utf8(ns_uri)
 *         else:
*/
    goto __pyx_L3;
  }

  /* "src/lxml/nsclasses.pxi":157
 *             ns_utf = _utf8(ns_uri)
 *         else:
 *             ns_utf = None             # <<<<<<<<<<<<<<
 *         try:
 *             return self._namespace_registries[ns_utf]
*/
  /*else*/ {
    __Pyx_INCREF(Py_None);
    __pyx_v_ns_utf = ((PyObject*)Py_None);
  }
  __pyx_L3:;

  /* "src/lxml/nsclasses.pxi":158
 *         else:
 *             ns_utf = None
 *         try:             # <<<<<<<<<<<<<<
 *             return self._namespace_registries[ns_utf]
 *         except KeyError:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    /*try:*/ {

      /* "src/lxml/nsclasses.pxi":159
 *             ns_utf = None
 *         try:
 *             return self._namespace_registries[ns_utf]             # <<<<<<<<<<<<<<
 *         except KeyError:
 *             registry = self._namespace_registries[ns_utf] = \
*/
      __Pyx_XDECREF(__pyx_r);
      if (unlikely(__pyx_v_self->_namespace_registries == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(11, 159, __pyx_L4_error)
      }
      __pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_v_self->_namespace_registries, __pyx_v_ns_utf); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 159, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L8_try_return;

      /* "src/lxml/nsclasses.pxi":158
 *         else:
 *             ns_utf = None
 *         try:             # <<<<<<<<<<<<<<
 *             return self._namespace_registries[ns_utf]
 *         except KeyError:
*/
    }
    __pyx_L4_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/nsclasses.pxi":160
 *         try:
 *             return self._namespace_registries[ns_utf]
 *         except KeyError:             # <<<<<<<<<<<<<<
 *             registry = self._namespace_registries[ns_utf] = \
 *                        _ClassNamespaceRegistry(ns_uri)
*/
    __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_KeyError))));
    if (__pyx_t_6) {
      __Pyx_AddTraceback("lxml.etree.ElementNamespaceClassLookup.get_namespace", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_7, &__pyx_t_8) < 0) __PYX_ERR(11, 160, __pyx_L6_except_error)
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);

      /* "src/lxml/nsclasses.pxi":162
 *         except KeyError:
 *             registry = self._namespace_registries[ns_utf] = \
 *                        _ClassNamespaceRegistry(ns_uri)             # <<<<<<<<<<<<<<
 *             return registry
 * 
*/
      __pyx_t_10 = NULL;
      __pyx_t_11 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_v_ns_uri};
        __pyx_t_9 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ClassNamespaceRegistry, __pyx_callargs+__pyx_t_11, (2-__pyx_t_11) | (__pyx_t_11*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (unlikely(!__pyx_t_9)) __PYX_ERR(11, 162, __pyx_L6_except_error)
        __Pyx_GOTREF((PyObject *)__pyx_t_9);
      }
      __Pyx_INCREF(__pyx_t_9);
      __pyx_v_registry = ((struct __pyx_obj_4lxml_5etree__ClassNamespaceRegistry *)__pyx_t_9);

      /* "src/lxml/nsclasses.pxi":161
 *             return self._namespace_registries[ns_utf]
 *         except KeyError:
 *             registry = self._namespace_registries[ns_utf] = \             # <<<<<<<<<<<<<<
 *                        _ClassNamespaceRegistry(ns_uri)
 *             return registry
*/
      if (unlikely(__pyx_v_self->_namespace_registries == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(11, 161, __pyx_L6_except_error)
      }
      if (unlikely((PyDict_SetItem(__pyx_v_self->_namespace_registries, __pyx_v_ns_utf, __pyx_t_9) < 0))) __PYX_ERR(11, 161, __pyx_L6_except_error)
      __Pyx_DECREF((PyObject *)__pyx_t_9); __pyx_t_9 = 0;

      /* "src/lxml/nsclasses.pxi":163
 *             registry = self._namespace_registries[ns_utf] = \
 *                        _ClassNamespaceRegistry(ns_uri)
 *             return registry             # <<<<<<<<<<<<<<
 * 
 * cdef object _find_nselement_class(state, _Document doc, xmlNode* c_node):
*/
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF((PyObject *)__pyx_v_registry);
      __pyx_r = ((PyObject *)__pyx_v_registry);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L7_except_return;
    }
    goto __pyx_L6_except_error;

    /* "src/lxml/nsclasses.pxi":158
 *         else:
 *             ns_utf = None
 *         try:             # <<<<<<<<<<<<<<
 *             return self._namespace_registries[ns_utf]
 *         except KeyError:
*/
    __pyx_L6_except_error:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    goto __pyx_L1_error;
    __pyx_L8_try_return:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    goto __pyx_L0;
    __pyx_L7_except_return:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    goto __pyx_L0;
  }

  /* "src/lxml/nsclasses.pxi":147
 *         self._lookup_function = _find_nselement_class
 * 
 *     def get_namespace(self, ns_uri):             # <<<<<<<<<<<<<<
 *         """get_namespace(self, ns_uri)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("lxml.etree.ElementNamespaceClassLookup.get_namespace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ns_utf);
  __Pyx_XDECREF((PyObject *)__pyx_v_registry);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/nsclasses.pxi":165
 *             return registry
 * 
 * cdef object _find_nselement_class(state, _Document doc, xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     cdef python.PyObject* dict_result
 *     cdef ElementNamespaceClassLookup lookup
*/

static PyObject *__pyx_f_4lxml_5etree__find_nselement_class(PyObject *__pyx_v_state, struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_node) {
  PyObject *__pyx_v_dict_result;
  struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *__pyx_v_lookup = 0;
  struct __pyx_obj_4lxml_5etree__NamespaceRegistry *__pyx_v_registry = 0;
  const xmlChar *__pyx_v_c_namespace_utf;
  PyObject *__pyx_v_classes = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_find_nselement_class", 0);

  /* "src/lxml/nsclasses.pxi":169
 *     cdef ElementNamespaceClassLookup lookup
 *     cdef _NamespaceRegistry registry
 *     if state is None:             # <<<<<<<<<<<<<<
 *         return _lookupDefaultElementClass(None, doc, c_node)
 * 
*/
  __pyx_t_1 = (__pyx_v_state == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/nsclasses.pxi":170
 *     cdef _NamespaceRegistry registry
 *     if state is None:
 *         return _lookupDefaultElementClass(None, doc, c_node)             # <<<<<<<<<<<<<<
 * 
 *     lookup = <ElementNamespaceClassLookup>state
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __pyx_f_4lxml_5etree__lookupDefaultElementClass(Py_None, __pyx_v_doc, __pyx_v_c_node); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 170, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "src/lxml/nsclasses.pxi":169
 *     cdef ElementNamespaceClassLookup lookup
 *     cdef _NamespaceRegistry registry
 *     if state is None:             # <<<<<<<<<<<<<<
 *         return _lookupDefaultElementClass(None, doc, c_node)
 * 
*/
  }

  /* "src/lxml/nsclasses.pxi":172
 *         return _lookupDefaultElementClass(None, doc, c_node)
 * 
 *     lookup = <ElementNamespaceClassLookup>state             # <<<<<<<<<<<<<<
 *     if c_node.type != tree.XML_ELEMENT_NODE:
 *         return _callLookupFallback(lookup, doc, c_node)
*/
  __pyx_t_2 = __pyx_v_state;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_lookup = ((struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/nsclasses.pxi":173
 * 
 *     lookup = <ElementNamespaceClassLookup>state
 *     if c_node.type != tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         return _callLookupFallback(lookup, doc, c_node)
 * 
*/
  __pyx_t_1 = (__pyx_v_c_node->type != XML_ELEMENT_NODE);
  if (__pyx_t_1) {

    /* "src/lxml/nsclasses.pxi":174
 *     lookup = <ElementNamespaceClassLookup>state
 *     if c_node.type != tree.XML_ELEMENT_NODE:
 *         return _callLookupFallback(lookup, doc, c_node)             # <<<<<<<<<<<<<<
 * 
 *     c_namespace_utf = _getNs(c_node)
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __pyx_f_4lxml_5etree__callLookupFallback(((struct LxmlFallbackElementClassLookup *)__pyx_v_lookup), __pyx_v_doc, __pyx_v_c_node); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 174, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "src/lxml/nsclasses.pxi":173
 * 
 *     lookup = <ElementNamespaceClassLookup>state
 *     if c_node.type != tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         return _callLookupFallback(lookup, doc, c_node)
 * 
*/
  }

  /* "src/lxml/nsclasses.pxi":176
 *         return _callLookupFallback(lookup, doc, c_node)
 * 
 *     c_namespace_utf = _getNs(c_node)             # <<<<<<<<<<<<<<
 *     if c_namespace_utf is not NULL:
 *         dict_result = python.PyDict_GetItem(
*/
  __pyx_v_c_namespace_utf = _getNs(__pyx_v_c_node);

  /* "src/lxml/nsclasses.pxi":177
 * 
 *     c_namespace_utf = _getNs(c_node)
 *     if c_namespace_utf is not NULL:             # <<<<<<<<<<<<<<
 *         dict_result = python.PyDict_GetItem(
 *             lookup._namespace_registries, <unsigned char*>c_namespace_utf)
*/
  __pyx_t_1 = (__pyx_v_c_namespace_utf != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/nsclasses.pxi":179
 *     if c_namespace_utf is not NULL:
 *         dict_result = python.PyDict_GetItem(
 *             lookup._namespace_registries, <unsigned char*>c_namespace_utf)             # <<<<<<<<<<<<<<
 *     else:
 *         dict_result = python.PyDict_GetItem(
*/
    __pyx_t_2 = __pyx_v_lookup->_namespace_registries;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyBytes_FromCString(((unsigned char *)__pyx_v_c_namespace_utf)); if (unlikely(!__pyx_t_3)) __PYX_ERR(11, 179, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);

    /* "src/lxml/nsclasses.pxi":178
 *     c_namespace_utf = _getNs(c_node)
 *     if c_namespace_utf is not NULL:
 *         dict_result = python.PyDict_GetItem(             # <<<<<<<<<<<<<<
 *             lookup._namespace_registries, <unsigned char*>c_namespace_utf)
 *     else:
*/
    __pyx_v_dict_result = PyDict_GetItem(__pyx_t_2, __pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/nsclasses.pxi":177
 * 
 *     c_namespace_utf = _getNs(c_node)
 *     if c_namespace_utf is not NULL:             # <<<<<<<<<<<<<<
 *         dict_result = python.PyDict_GetItem(
 *             lookup._namespace_registries, <unsigned char*>c_namespace_utf)
*/
    goto __pyx_L5;
  }

  /* "src/lxml/nsclasses.pxi":181
 *             lookup._namespace_registries, <unsigned char*>c_namespace_utf)
 *     else:
 *         dict_result = python.PyDict_GetItem(             # <<<<<<<<<<<<<<
 *             lookup._namespace_registries, None)
 *     if dict_result is not NULL:
*/
  /*else*/ {

    /* "src/lxml/nsclasses.pxi":182
 *     else:
 *         dict_result = python.PyDict_GetItem(
 *             lookup._namespace_registries, None)             # <<<<<<<<<<<<<<
 *     if dict_result is not NULL:
 *         registry = <_NamespaceRegistry>dict_result
*/
    __pyx_t_3 = __pyx_v_lookup->_namespace_registries;
    __Pyx_INCREF(__pyx_t_3);

    /* "src/lxml/nsclasses.pxi":181
 *             lookup._namespace_registries, <unsigned char*>c_namespace_utf)
 *     else:
 *         dict_result = python.PyDict_GetItem(             # <<<<<<<<<<<<<<
 *             lookup._namespace_registries, None)
 *     if dict_result is not NULL:
*/
    __pyx_v_dict_result = PyDict_GetItem(__pyx_t_3, Py_None);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_L5:;

  /* "src/lxml/nsclasses.pxi":183
 *         dict_result = python.PyDict_GetItem(
 *             lookup._namespace_registries, None)
 *     if dict_result is not NULL:             # <<<<<<<<<<<<<<
 *         registry = <_NamespaceRegistry>dict_result
 *         classes = registry._entries
*/
  __pyx_t_1 = (__pyx_v_dict_result != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/nsclasses.pxi":184
 *             lookup._namespace_registries, None)
 *     if dict_result is not NULL:
 *         registry = <_NamespaceRegistry>dict_result             # <<<<<<<<<<<<<<
 *         classes = registry._entries
 * 
*/
    __pyx_t_3 = ((PyObject *)__pyx_v_dict_result);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_v_registry = ((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/nsclasses.pxi":185
 *     if dict_result is not NULL:
 *         registry = <_NamespaceRegistry>dict_result
 *         classes = registry._entries             # <<<<<<<<<<<<<<
 * 
 *         if c_node.name is not NULL:
*/
    __pyx_t_3 = __pyx_v_registry->_entries;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_v_classes = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/nsclasses.pxi":187
 *         classes = registry._entries
 * 
 *         if c_node.name is not NULL:             # <<<<<<<<<<<<<<
 *             dict_result = python.PyDict_GetItem(
 *                 classes, <unsigned char*>c_node.name)
*/
    __pyx_t_1 = (__pyx_v_c_node->name != NULL);
    if (__pyx_t_1) {

      /* "src/lxml/nsclasses.pxi":189
 *         if c_node.name is not NULL:
 *             dict_result = python.PyDict_GetItem(
 *                 classes, <unsigned char*>c_node.name)             # <<<<<<<<<<<<<<
 *         else:
 *             dict_result = NULL
*/
      __pyx_t_3 = __Pyx_PyBytes_FromCString(((unsigned char *)__pyx_v_c_node->name)); if (unlikely(!__pyx_t_3)) __PYX_ERR(11, 189, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);

      /* "src/lxml/nsclasses.pxi":188
 * 
 *         if c_node.name is not NULL:
 *             dict_result = python.PyDict_GetItem(             # <<<<<<<<<<<<<<
 *                 classes, <unsigned char*>c_node.name)
 *         else:
*/
      __pyx_v_dict_result = PyDict_GetItem(__pyx_v_classes, __pyx_t_3);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "src/lxml/nsclasses.pxi":187
 *         classes = registry._entries
 * 
 *         if c_node.name is not NULL:             # <<<<<<<<<<<<<<
 *             dict_result = python.PyDict_GetItem(
 *                 classes, <unsigned char*>c_node.name)
*/
      goto __pyx_L7;
    }

    /* "src/lxml/nsclasses.pxi":191
 *                 classes, <unsigned char*>c_node.name)
 *         else:
 *             dict_result = NULL             # <<<<<<<<<<<<<<
 * 
 *         if dict_result is NULL:
*/
    /*else*/ {
      __pyx_v_dict_result = NULL;
    }
    __pyx_L7:;

    /* "src/lxml/nsclasses.pxi":193
 *             dict_result = NULL
 * 
 *         if dict_result is NULL:             # <<<<<<<<<<<<<<
 *             dict_result = python.PyDict_GetItem(classes, None)
 * 
*/
    __pyx_t_1 = (__pyx_v_dict_result == NULL);
    if (__pyx_t_1) {

      /* "src/lxml/nsclasses.pxi":194
 * 
 *         if dict_result is NULL:
 *             dict_result = python.PyDict_GetItem(classes, None)             # <<<<<<<<<<<<<<
 * 
 *         if dict_result is not NULL:
*/
      __pyx_v_dict_result = PyDict_GetItem(__pyx_v_classes, Py_None);

      /* "src/lxml/nsclasses.pxi":193
 *             dict_result = NULL
 * 
 *         if dict_result is NULL:             # <<<<<<<<<<<<<<
 *             dict_result = python.PyDict_GetItem(classes, None)
 * 
*/
    }

    /* "src/lxml/nsclasses.pxi":196
 *             dict_result = python.PyDict_GetItem(classes, None)
 * 
 *         if dict_result is not NULL:             # <<<<<<<<<<<<<<
 *             return <object>dict_result
 *     return _callLookupFallback(lookup, doc, c_node)
*/
    __pyx_t_1 = (__pyx_v_dict_result != NULL);
    if (__pyx_t_1) {

      /* "src/lxml/nsclasses.pxi":197
 * 
 *         if dict_result is not NULL:
 *             return <object>dict_result             # <<<<<<<<<<<<<<
 *     return _callLookupFallback(lookup, doc, c_node)
 * 
*/
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_dict_result));
      __pyx_r = ((PyObject *)__pyx_v_dict_result);
      goto __pyx_L0;

      /* "src/lxml/nsclasses.pxi":196
 *             dict_result = python.PyDict_GetItem(classes, None)
 * 
 *         if dict_result is not NULL:             # <<<<<<<<<<<<<<
 *             return <object>dict_result
 *     return _callLookupFallback(lookup, doc, c_node)
*/
    }

    /* "src/lxml/nsclasses.pxi":183
 *         dict_result = python.PyDict_GetItem(
 *             lookup._namespace_registries, None)
 *     if dict_result is not NULL:             # <<<<<<<<<<<<<<
 *         registry = <_NamespaceRegistry>dict_result
 *         classes = registry._entries
*/
  }

  /* "src/lxml/nsclasses.pxi":198
 *         if dict_result is not NULL:
 *             return <object>dict_result
 *     return _callLookupFallback(lookup, doc, c_node)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __pyx_f_4lxml_5etree__callLookupFallback(((struct LxmlFallbackElementClassLookup *)__pyx_v_lookup), __pyx_v_doc, __pyx_v_c_node); if (unlikely(!__pyx_t_3)) __PYX_ERR(11, 198, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "src/lxml/nsclasses.pxi":165
 *             return registry
 * 
 * cdef object _find_nselement_class(state, _Document doc, xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     cdef python.PyObject* dict_result
 *     cdef ElementNamespaceClassLookup lookup
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._find_nselement_class", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_lookup);
  __Pyx_XDECREF((PyObject *)__pyx_v_registry);
  __Pyx_XDECREF(__pyx_v_classes);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/nsclasses.pxi":207
 * __FUNCTION_NAMESPACE_REGISTRIES = {}
 * 
 * def FunctionNamespace(ns_uri):             # <<<<<<<<<<<<<<
 *     """FunctionNamespace(ns_uri)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_41FunctionNamespace(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_40FunctionNamespace, "FunctionNamespace(ns_uri)\n\n    Retrieve the function namespace object associated with the given\n    URI.\n\n    Creates a new one if it does not yet exist. A function namespace\n    can only be used to register extension functions.\n\n    Usage:\n\n    >>> ns_functions = FunctionNamespace(\"http://schema.org/Movie\")\n\n    >>> @ns_functions  # uses function name\n    ... def add2(x):\n    ...     return x + 2\n\n    >>> @ns_functions(\"add3\")  # uses explicit name\n    ... def add_three(x):\n    ...     return x + 3\n    ");
static PyMethodDef __pyx_mdef_4lxml_5etree_41FunctionNamespace = {"FunctionNamespace", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_41FunctionNamespace, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_40FunctionNamespace};
static PyObject *__pyx_pw_4lxml_5etree_41FunctionNamespace(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_ns_uri = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("FunctionNamespace (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_ns_uri,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(11, 207, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(11, 207, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "FunctionNamespace", 0) < (0)) __PYX_ERR(11, 207, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("FunctionNamespace", 1, 1, 1, i); __PYX_ERR(11, 207, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(11, 207, __pyx_L3_error)
    }
    __pyx_v_ns_uri = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("FunctionNamespace", 1, 1, 1, __pyx_nargs); __PYX_ERR(11, 207, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.FunctionNamespace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_40FunctionNamespace(__pyx_self, __pyx_v_ns_uri);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_40FunctionNamespace(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_ns_uri) {
  PyObject *__pyx_v_ns_utf = NULL;
  struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *__pyx_v_registry = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  size_t __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("FunctionNamespace", 0);

  /* "src/lxml/nsclasses.pxi":228
 *     ...     return x + 3
 *     """
 *     ns_utf = _utf8(ns_uri) if ns_uri else None             # <<<<<<<<<<<<<<
 *     try:
 *         return __FUNCTION_NAMESPACE_REGISTRIES[ns_utf]
*/
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_ns_uri); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(11, 228, __pyx_L1_error)
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_f_4lxml_5etree__utf8(__pyx_v_ns_uri); if (unlikely(!__pyx_t_3)) __PYX_ERR(11, 228, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
  } else {
    __Pyx_INCREF(Py_None);
    __pyx_t_1 = Py_None;
  }
  __pyx_v_ns_utf = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "src/lxml/nsclasses.pxi":229
 *     """
 *     ns_utf = _utf8(ns_uri) if ns_uri else None
 *     try:             # <<<<<<<<<<<<<<
 *         return __FUNCTION_NAMESPACE_REGISTRIES[ns_utf]
 *     except KeyError:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_6);
    /*try:*/ {

      /* "src/lxml/nsclasses.pxi":230
 *     ns_utf = _utf8(ns_uri) if ns_uri else None
 *     try:
 *         return __FUNCTION_NAMESPACE_REGISTRIES[ns_utf]             # <<<<<<<<<<<<<<
 *     except KeyError:
 *         registry = __FUNCTION_NAMESPACE_REGISTRIES[ns_utf] = \
*/
      __Pyx_XDECREF(__pyx_r);
      if (unlikely(__pyx_v_4lxml_5etree___FUNCTION_NAMESPACE_REGISTRIES == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(11, 230, __pyx_L3_error)
      }
      __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_4lxml_5etree___FUNCTION_NAMESPACE_REGISTRIES, __pyx_v_ns_utf); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 230, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L7_try_return;

      /* "src/lxml/nsclasses.pxi":229
 *     """
 *     ns_utf = _utf8(ns_uri) if ns_uri else None
 *     try:             # <<<<<<<<<<<<<<
 *         return __FUNCTION_NAMESPACE_REGISTRIES[ns_utf]
 *     except KeyError:
*/
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/nsclasses.pxi":231
 *     try:
 *         return __FUNCTION_NAMESPACE_REGISTRIES[ns_utf]
 *     except KeyError:             # <<<<<<<<<<<<<<
 *         registry = __FUNCTION_NAMESPACE_REGISTRIES[ns_utf] = \
 *                    _XPathFunctionNamespaceRegistry(ns_uri)
*/
    __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_KeyError))));
    if (__pyx_t_7) {
      __Pyx_AddTraceback("lxml.etree.FunctionNamespace", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_8) < 0) __PYX_ERR(11, 231, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_1);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_8);

      /* "src/lxml/nsclasses.pxi":233
 *     except KeyError:
 *         registry = __FUNCTION_NAMESPACE_REGISTRIES[ns_utf] = \
 *                    _XPathFunctionNamespaceRegistry(ns_uri)             # <<<<<<<<<<<<<<
 *         return registry
 * 
*/
      __pyx_t_10 = NULL;
      __pyx_t_11 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_v_ns_uri};
        __pyx_t_9 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__XPathFunctionNamespaceRegistry, __pyx_callargs+__pyx_t_11, (2-__pyx_t_11) | (__pyx_t_11*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (unlikely(!__pyx_t_9)) __PYX_ERR(11, 233, __pyx_L5_except_error)
        __Pyx_GOTREF((PyObject *)__pyx_t_9);
      }
      __Pyx_INCREF(__pyx_t_9);
      __pyx_v_registry = ((struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *)__pyx_t_9);

      /* "src/lxml/nsclasses.pxi":232
 *         return __FUNCTION_NAMESPACE_REGISTRIES[ns_utf]
 *     except KeyError:
 *         registry = __FUNCTION_NAMESPACE_REGISTRIES[ns_utf] = \             # <<<<<<<<<<<<<<
 *                    _XPathFunctionNamespaceRegistry(ns_uri)
 *         return registry
*/
      if (unlikely(__pyx_v_4lxml_5etree___FUNCTION_NAMESPACE_REGISTRIES == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(11, 232, __pyx_L5_except_error)
      }
      if (unlikely((PyDict_SetItem(__pyx_v_4lxml_5etree___FUNCTION_NAMESPACE_REGISTRIES, __pyx_v_ns_utf, __pyx_t_9) < 0))) __PYX_ERR(11, 232, __pyx_L5_except_error)
      __Pyx_DECREF((PyObject *)__pyx_t_9); __pyx_t_9 = 0;

      /* "src/lxml/nsclasses.pxi":234
 *         registry = __FUNCTION_NAMESPACE_REGISTRIES[ns_utf] = \
 *                    _XPathFunctionNamespaceRegistry(ns_uri)
 *         return registry             # <<<<<<<<<<<<<<
 * 
 * @cython.internal
*/
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF((PyObject *)__pyx_v_registry);
      __pyx_r = ((PyObject *)__pyx_v_registry);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L6_except_return;
    }
    goto __pyx_L5_except_error;

    /* "src/lxml/nsclasses.pxi":229
 *     """
 *     ns_utf = _utf8(ns_uri) if ns_uri else None
 *     try:             # <<<<<<<<<<<<<<
 *         return __FUNCTION_NAMESPACE_REGISTRIES[ns_utf]
 *     except KeyError:
*/
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    goto __pyx_L1_error;
    __pyx_L7_try_return:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    goto __pyx_L0;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    goto __pyx_L0;
  }

  /* "src/lxml/nsclasses.pxi":207
 * __FUNCTION_NAMESPACE_REGISTRIES = {}
 * 
 * def FunctionNamespace(ns_uri):             # <<<<<<<<<<<<<<
 *     """FunctionNamespace(ns_uri)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("lxml.etree.FunctionNamespace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ns_utf);
  __Pyx_XDECREF((PyObject *)__pyx_v_registry);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/nsclasses.pxi":238
 * @cython.internal
 * cdef class _FunctionNamespaceRegistry(_NamespaceRegistry):
 *     def __setitem__(self, name, item):             # <<<<<<<<<<<<<<
 *         if not callable(item):
 *             raise NamespaceRegistryError, \
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_26_FunctionNamespaceRegistry_1__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_item); /*proto*/
static int __pyx_pw_4lxml_5etree_26_FunctionNamespaceRegistry_1__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_item) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_26_FunctionNamespaceRegistry___setitem__(((struct __pyx_obj_4lxml_5etree__FunctionNamespaceRegistry *)__pyx_v_self), ((PyObject *)__pyx_v_name), ((PyObject *)__pyx_v_item));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_26_FunctionNamespaceRegistry___setitem__(struct __pyx_obj_4lxml_5etree__FunctionNamespaceRegistry *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_item) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setitem__", 0);

  /* "src/lxml/nsclasses.pxi":239
 * cdef class _FunctionNamespaceRegistry(_NamespaceRegistry):
 *     def __setitem__(self, name, item):
 *         if not callable(item):             # <<<<<<<<<<<<<<
 *             raise NamespaceRegistryError, \
 *                 "Registered functions must be callable."
*/
  __pyx_t_1 = __Pyx_PyCallable_Check(__pyx_v_item); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(11, 239, __pyx_L1_error)
  __pyx_t_2 = (!__pyx_t_1);
  if (unlikely(__pyx_t_2)) {

    /* "src/lxml/nsclasses.pxi":240
 *     def __setitem__(self, name, item):
 *         if not callable(item):
 *             raise NamespaceRegistryError, \             # <<<<<<<<<<<<<<
 *                 "Registered functions must be callable."
 *         if not name:
*/
    __Pyx_Raise(((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_NamespaceRegistryError), __pyx_mstate_global->__pyx_kp_u_Registered_functions_must_be_cal, 0, 0);
    __PYX_ERR(11, 240, __pyx_L1_error)

    /* "src/lxml/nsclasses.pxi":239
 * cdef class _FunctionNamespaceRegistry(_NamespaceRegistry):
 *     def __setitem__(self, name, item):
 *         if not callable(item):             # <<<<<<<<<<<<<<
 *             raise NamespaceRegistryError, \
 *                 "Registered functions must be callable."
*/
  }

  /* "src/lxml/nsclasses.pxi":242
 *             raise NamespaceRegistryError, \
 *                 "Registered functions must be callable."
 *         if not name:             # <<<<<<<<<<<<<<
 *             raise ValueError, \
 *                 "extensions must have non empty names"
*/
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_name); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(11, 242, __pyx_L1_error)
  __pyx_t_1 = (!__pyx_t_2);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/nsclasses.pxi":243
 *                 "Registered functions must be callable."
 *         if not name:
 *             raise ValueError, \             # <<<<<<<<<<<<<<
 *                 "extensions must have non empty names"
 *         self._entries[_utf8(name)] = item
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_extensions_must_have_non_empty_n, 0, 0);
    __PYX_ERR(11, 243, __pyx_L1_error)

    /* "src/lxml/nsclasses.pxi":242
 *             raise NamespaceRegistryError, \
 *                 "Registered functions must be callable."
 *         if not name:             # <<<<<<<<<<<<<<
 *             raise ValueError, \
 *                 "extensions must have non empty names"
*/
  }

  /* "src/lxml/nsclasses.pxi":245
 *             raise ValueError, \
 *                 "extensions must have non empty names"
 *         self._entries[_utf8(name)] = item             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
*/
  if (unlikely(__pyx_v_self->__pyx_base._entries == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(11, 245, __pyx_L1_error)
  }
  __pyx_t_3 = __pyx_f_4lxml_5etree__utf8(__pyx_v_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(11, 245, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (unlikely((PyDict_SetItem(__pyx_v_self->__pyx_base._entries, __pyx_t_3, __pyx_v_item) < 0))) __PYX_ERR(11, 245, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/nsclasses.pxi":238
 * @cython.internal
 * cdef class _FunctionNamespaceRegistry(_NamespaceRegistry):
 *     def __setitem__(self, name, item):             # <<<<<<<<<<<<<<
 *         if not callable(item):
 *             raise NamespaceRegistryError, \
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._FunctionNamespaceRegistry.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/nsclasses.pxi":247
 *         self._entries[_utf8(name)] = item
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "FunctionNamespace(%r)" % self._ns_uri
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_26_FunctionNamespaceRegistry_3__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_26_FunctionNamespaceRegistry_3__repr__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_26_FunctionNamespaceRegistry_2__repr__(((struct __pyx_obj_4lxml_5etree__FunctionNamespaceRegistry *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_26_FunctionNamespaceRegistry_2__repr__(struct __pyx_obj_4lxml_5etree__FunctionNamespaceRegistry *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "src/lxml/nsclasses.pxi":248
 * 
 *     def __repr__(self):
 *         return "FunctionNamespace(%r)" % self._ns_uri             # <<<<<<<<<<<<<<
 * 
 * @cython.final
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyUnicode_FormatSafe(__pyx_mstate_global->__pyx_kp_u_FunctionNamespace_r, __pyx_v_self->__pyx_base._ns_uri); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 248, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/nsclasses.pxi":247
 *         self._entries[_utf8(name)] = item
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "FunctionNamespace(%r)" % self._ns_uri
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._FunctionNamespaceRegistry.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/nsclasses.pxi":258
 *     property prefix:
 *         "Namespace prefix for extension functions."
 *         def __del__(self):             # <<<<<<<<<<<<<<
 *             self._prefix = None # no prefix configured
 *             self._prefix_utf = None
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_31_XPathFunctionNamespaceRegistry_6prefix_1__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_4lxml_5etree_31_XPathFunctionNamespaceRegistry_6prefix_1__del__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_31_XPathFunctionNamespaceRegistry_6prefix___del__(((struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_31_XPathFunctionNamespaceRegistry_6prefix___del__(struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);

  /* "src/lxml/nsclasses.pxi":259
 *         "Namespace prefix for extension functions."
 *         def __del__(self):
 *             self._prefix = None # no prefix configured             # <<<<<<<<<<<<<<
 *             self._prefix_utf = None
 *         def __get__(self):
*/
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_prefix);
  __Pyx_DECREF(__pyx_v_self->_prefix);
  __pyx_v_self->_prefix = Py_None;

  /* "src/lxml/nsclasses.pxi":260
 *         def __del__(self):
 *             self._prefix = None # no prefix configured
 *             self._prefix_utf = None             # <<<<<<<<<<<<<<
 *         def __get__(self):
 *             if self._prefix is None:
*/
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_prefix_utf);
  __Pyx_DECREF(__pyx_v_self->_prefix_utf);
  __pyx_v_self->_prefix_utf = ((PyObject*)Py_None);

  /* "src/lxml/nsclasses.pxi":258
 *     property prefix:
 *         "Namespace prefix for extension functions."
 *         def __del__(self):             # <<<<<<<<<<<<<<
 *             self._prefix = None # no prefix configured
 *             self._prefix_utf = None
*/

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/nsclasses.pxi":261
 *             self._prefix = None # no prefix configured
 *             self._prefix_utf = None
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if self._prefix is None:
 *                 return ''
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_31_XPathFunctionNamespaceRegistry_6prefix_3__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_31_XPathFunctionNamespaceRegistry_6prefix_3__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_31_XPathFunctionNamespaceRegistry_6prefix_2__get__(((struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_31_XPathFunctionNamespaceRegistry_6prefix_2__get__(struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "src/lxml/nsclasses.pxi":262
 *             self._prefix_utf = None
 *         def __get__(self):
 *             if self._prefix is None:             # <<<<<<<<<<<<<<
 *                 return ''
 *             else:
*/
  __pyx_t_1 = (__pyx_v_self->_prefix == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/nsclasses.pxi":263
 *         def __get__(self):
 *             if self._prefix is None:
 *                 return ''             # <<<<<<<<<<<<<<
 *             else:
 *                 return self._prefix
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u__8);
    __pyx_r = __pyx_mstate_global->__pyx_kp_u__8;
    goto __pyx_L0;

    /* "src/lxml/nsclasses.pxi":262
 *             self._prefix_utf = None
 *         def __get__(self):
 *             if self._prefix is None:             # <<<<<<<<<<<<<<
 *                 return ''
 *             else:
*/
  }

  /* "src/lxml/nsclasses.pxi":265
 *                 return ''
 *             else:
 *                 return self._prefix             # <<<<<<<<<<<<<<
 *         def __set__(self, prefix):
 *             if prefix == '':
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_self->_prefix);
    __pyx_r = __pyx_v_self->_prefix;
    goto __pyx_L0;
  }

  /* "src/lxml/nsclasses.pxi":261
 *             self._prefix = None # no prefix configured
 *             self._prefix_utf = None
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if self._prefix is None:
 *                 return ''
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/nsclasses.pxi":266
 *             else:
 *                 return self._prefix
 *         def __set__(self, prefix):             # <<<<<<<<<<<<<<
 *             if prefix == '':
 *                 prefix = None # empty prefix
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_31_XPathFunctionNamespaceRegistry_6prefix_5__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_prefix); /*proto*/
static int __pyx_pw_4lxml_5etree_31_XPathFunctionNamespaceRegistry_6prefix_5__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_prefix) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_31_XPathFunctionNamespaceRegistry_6prefix_4__set__(((struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *)__pyx_v_self), ((PyObject *)__pyx_v_prefix));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_31_XPathFunctionNamespaceRegistry_6prefix_4__set__(struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *__pyx_v_self, PyObject *__pyx_v_prefix) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_prefix);

  /* "src/lxml/nsclasses.pxi":267
 *                 return self._prefix
 *         def __set__(self, prefix):
 *             if prefix == '':             # <<<<<<<<<<<<<<
 *                 prefix = None # empty prefix
 *             self._prefix_utf = _utf8(prefix) if prefix is not None else None
*/
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_prefix, __pyx_mstate_global->__pyx_kp_u__8, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(11, 267, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/nsclasses.pxi":268
 *         def __set__(self, prefix):
 *             if prefix == '':
 *                 prefix = None # empty prefix             # <<<<<<<<<<<<<<
 *             self._prefix_utf = _utf8(prefix) if prefix is not None else None
 *             self._prefix = prefix
*/
    __Pyx_INCREF(Py_None);
    __Pyx_DECREF_SET(__pyx_v_prefix, Py_None);

    /* "src/lxml/nsclasses.pxi":267
 *                 return self._prefix
 *         def __set__(self, prefix):
 *             if prefix == '':             # <<<<<<<<<<<<<<
 *                 prefix = None # empty prefix
 *             self._prefix_utf = _utf8(prefix) if prefix is not None else None
*/
  }

  /* "src/lxml/nsclasses.pxi":269
 *             if prefix == '':
 *                 prefix = None # empty prefix
 *             self._prefix_utf = _utf8(prefix) if prefix is not None else None             # <<<<<<<<<<<<<<
 *             self._prefix = prefix
 * 
*/
  __pyx_t_1 = (__pyx_v_prefix != Py_None);
  if (__pyx_t_1) {
    __pyx_t_3 = __pyx_f_4lxml_5etree__utf8(__pyx_v_prefix); if (unlikely(!__pyx_t_3)) __PYX_ERR(11, 269, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __pyx_t_3;
    __pyx_t_3 = 0;
  } else {
    __Pyx_INCREF(Py_None);
    __pyx_t_2 = Py_None;
  }
  if (!(likely(PyBytes_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_2))) __PYX_ERR(11, 269, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_self->_prefix_utf);
  __Pyx_DECREF(__pyx_v_self->_prefix_utf);
  __pyx_v_self->_prefix_utf = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/nsclasses.pxi":270
 *                 prefix = None # empty prefix
 *             self._prefix_utf = _utf8(prefix) if prefix is not None else None
 *             self._prefix = prefix             # <<<<<<<<<<<<<<
 * 
 * cdef list _find_all_extension_prefixes():
*/
  __Pyx_INCREF(__pyx_v_prefix);
  __Pyx_GIVEREF(__pyx_v_prefix);
  __Pyx_GOTREF(__pyx_v_self->_prefix);
  __Pyx_DECREF(__pyx_v_self->_prefix);
  __pyx_v_self->_prefix = __pyx_v_prefix;

  /* "src/lxml/nsclasses.pxi":266
 *             else:
 *                 return self._prefix
 *         def __set__(self, prefix):             # <<<<<<<<<<<<<<
 *             if prefix == '':
 *                 prefix = None # empty prefix
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._XPathFunctionNamespaceRegistry.prefix.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_prefix);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/nsclasses.pxi":272
 *             self._prefix = prefix
 * 
 * cdef list _find_all_extension_prefixes():             # <<<<<<<<<<<<<<
 *     "Internal lookup function to find all function prefixes for XSLT/XPath."
 *     cdef _XPathFunctionNamespaceRegistry registry
*/

static PyObject *__pyx_f_4lxml_5etree__find_all_extension_prefixes(void) {
  struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *__pyx_v_registry = 0;
  PyObject *__pyx_v_ns_prefixes = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_find_all_extension_prefixes", 0);

  /* "src/lxml/nsclasses.pxi":275
 *     "Internal lookup function to find all function prefixes for XSLT/XPath."
 *     cdef _XPathFunctionNamespaceRegistry registry
 *     cdef list ns_prefixes = []             # <<<<<<<<<<<<<<
 *     for registry in __FUNCTION_NAMESPACE_REGISTRIES.itervalues():
 *         if registry._prefix_utf is not None:
*/
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 275, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ns_prefixes = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/nsclasses.pxi":276
 *     cdef _XPathFunctionNamespaceRegistry registry
 *     cdef list ns_prefixes = []
 *     for registry in __FUNCTION_NAMESPACE_REGISTRIES.itervalues():             # <<<<<<<<<<<<<<
 *         if registry._prefix_utf is not None:
 *             if registry._ns_uri_utf is not None:
*/
  __pyx_t_2 = 0;
  if (unlikely(__pyx_v_4lxml_5etree___FUNCTION_NAMESPACE_REGISTRIES == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "itervalues");
    __PYX_ERR(11, 276, __pyx_L1_error)
  }
  __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_4lxml_5etree___FUNCTION_NAMESPACE_REGISTRIES, 1, __pyx_mstate_global->__pyx_n_u_itervalues, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(11, 276, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = __pyx_t_5;
  __pyx_t_5 = 0;
  while (1) {
    __pyx_t_6 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, NULL, &__pyx_t_5, NULL, __pyx_t_4);
    if (unlikely(__pyx_t_6 == 0)) break;
    if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(11, 276, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__XPathFunctionNamespaceRegistry))))) __PYX_ERR(11, 276, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_registry, ((struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *)__pyx_t_5));
    __pyx_t_5 = 0;

    /* "src/lxml/nsclasses.pxi":277
 *     cdef list ns_prefixes = []
 *     for registry in __FUNCTION_NAMESPACE_REGISTRIES.itervalues():
 *         if registry._prefix_utf is not None:             # <<<<<<<<<<<<<<
 *             if registry._ns_uri_utf is not None:
 *                 ns_prefixes.append(
*/
    __pyx_t_7 = (__pyx_v_registry->_prefix_utf != ((PyObject*)Py_None));
    if (__pyx_t_7) {

      /* "src/lxml/nsclasses.pxi":278
 *     for registry in __FUNCTION_NAMESPACE_REGISTRIES.itervalues():
 *         if registry._prefix_utf is not None:
 *             if registry._ns_uri_utf is not None:             # <<<<<<<<<<<<<<
 *                 ns_prefixes.append(
 *                     (registry._prefix_utf, registry._ns_uri_utf))
*/
      __pyx_t_7 = (__pyx_v_registry->__pyx_base.__pyx_base._ns_uri_utf != ((PyObject*)Py_None));
      if (__pyx_t_7) {

        /* "src/lxml/nsclasses.pxi":280
 *             if registry._ns_uri_utf is not None:
 *                 ns_prefixes.append(
 *                     (registry._prefix_utf, registry._ns_uri_utf))             # <<<<<<<<<<<<<<
 *     return ns_prefixes
*/
        __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(11, 280, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_INCREF(__pyx_v_registry->_prefix_utf);
        __Pyx_GIVEREF(__pyx_v_registry->_prefix_utf);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_registry->_prefix_utf) != (0)) __PYX_ERR(11, 280, __pyx_L1_error);
        __Pyx_INCREF(__pyx_v_registry->__pyx_base.__pyx_base._ns_uri_utf);
        __Pyx_GIVEREF(__pyx_v_registry->__pyx_base.__pyx_base._ns_uri_utf);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_registry->__pyx_base.__pyx_base._ns_uri_utf) != (0)) __PYX_ERR(11, 280, __pyx_L1_error);

        /* "src/lxml/nsclasses.pxi":279
 *         if registry._prefix_utf is not None:
 *             if registry._ns_uri_utf is not None:
 *                 ns_prefixes.append(             # <<<<<<<<<<<<<<
 *                     (registry._prefix_utf, registry._ns_uri_utf))
 *     return ns_prefixes
*/
        __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_ns_prefixes, __pyx_t_5); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(11, 279, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "src/lxml/nsclasses.pxi":278
 *     for registry in __FUNCTION_NAMESPACE_REGISTRIES.itervalues():
 *         if registry._prefix_utf is not None:
 *             if registry._ns_uri_utf is not None:             # <<<<<<<<<<<<<<
 *                 ns_prefixes.append(
 *                     (registry._prefix_utf, registry._ns_uri_utf))
*/
      }

      /* "src/lxml/nsclasses.pxi":277
 *     cdef list ns_prefixes = []
 *     for registry in __FUNCTION_NAMESPACE_REGISTRIES.itervalues():
 *         if registry._prefix_utf is not None:             # <<<<<<<<<<<<<<
 *             if registry._ns_uri_utf is not None:
 *                 ns_prefixes.append(
*/
    }
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/nsclasses.pxi":281
 *                 ns_prefixes.append(
 *                     (registry._prefix_utf, registry._ns_uri_utf))
 *     return ns_prefixes             # <<<<<<<<<<<<<<
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_ns_prefixes);
  __pyx_r = __pyx_v_ns_prefixes;
  goto __pyx_L0;

  /* "src/lxml/nsclasses.pxi":272
 *             self._prefix = prefix
 * 
 * cdef list _find_all_extension_prefixes():             # <<<<<<<<<<<<<<
 *     "Internal lookup function to find all function prefixes for XSLT/XPath."
 *     cdef _XPathFunctionNamespaceRegistry registry
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._find_all_extension_prefixes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_registry);
  __Pyx_XDECREF(__pyx_v_ns_prefixes);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/docloader.pxi":19
 *     cdef bint _close_file
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._type = PARSER_DATA_INVALID
 * 
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_14_InputDocument_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_14_InputDocument_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, __pyx_nargs); return -1; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return -1;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__cinit__", __pyx_kwds); return -1;}
  __pyx_r = __pyx_pf_4lxml_5etree_14_InputDocument___cinit__(((struct __pyx_obj_4lxml_5etree__InputDocument *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_14_InputDocument___cinit__(struct __pyx_obj_4lxml_5etree__InputDocument *__pyx_v_self) {
  int __pyx_r;

  /* "src/lxml/docloader.pxi":20
 * 
 *     def __cinit__(self):
 *         self._type = PARSER_DATA_INVALID             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_v_self->_type = __pyx_e_4lxml_5etree_PARSER_DATA_INVALID;

  /* "src/lxml/docloader.pxi":19
 *     cdef bint _close_file
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._type = PARSER_DATA_INVALID
 * 
*/

  /* function exit code */
  __pyx_r = 0;
  return __pyx_r;
}

/* "src/lxml/docloader.pxi":25
 * cdef class Resolver:
 *     "This is the base class of all resolvers."
 *     def resolve(self, system_url, public_id, context):             # <<<<<<<<<<<<<<
 *         """resolve(self, system_url, public_id, context)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8Resolver_1resolve(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8Resolver_resolve, "resolve(self, system_url, public_id, context)\n\n        Override this method to resolve an external source by\n        ``system_url`` and ``public_id``.  The third argument is an\n        opaque context object.\n\n        Return the result of one of the ``resolve_*()`` methods.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_8Resolver_1resolve = {"resolve", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8Resolver_1resolve, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8Resolver_resolve};
static PyObject *__pyx_pw_4lxml_5etree_8Resolver_1resolve(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_system_url = 0;
  CYTHON_UNUSED PyObject *__pyx_v_public_id = 0;
  CYTHON_UNUSED PyObject *__pyx_v_context = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("resolve (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_system_url,&__pyx_mstate_global->__pyx_n_u_public_id,&__pyx_mstate_global->__pyx_n_u_context,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(12, 25, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(12, 25, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(12, 25, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(12, 25, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "resolve", 0) < (0)) __PYX_ERR(12, 25, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("resolve", 1, 3, 3, i); __PYX_ERR(12, 25, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(12, 25, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(12, 25, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(12, 25, __pyx_L3_error)
    }
    __pyx_v_system_url = values[0];
    __pyx_v_public_id = values[1];
    __pyx_v_context = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("resolve", 1, 3, 3, __pyx_nargs); __PYX_ERR(12, 25, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.Resolver.resolve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_8Resolver_resolve(((struct __pyx_obj_4lxml_5etree_Resolver *)__pyx_v_self), __pyx_v_system_url, __pyx_v_public_id, __pyx_v_context);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8Resolver_resolve(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree_Resolver *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_system_url, CYTHON_UNUSED PyObject *__pyx_v_public_id, CYTHON_UNUSED PyObject *__pyx_v_context) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("resolve", 0);

  /* "src/lxml/docloader.pxi":34
 *         Return the result of one of the ``resolve_*()`` methods.
 *         """
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     def resolve_empty(self, context):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "src/lxml/docloader.pxi":25
 * cdef class Resolver:
 *     "This is the base class of all resolvers."
 *     def resolve(self, system_url, public_id, context):             # <<<<<<<<<<<<<<
 *         """resolve(self, system_url, public_id, context)
 * 
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/docloader.pxi":36
 *         return None
 * 
 *     def resolve_empty(self, context):             # <<<<<<<<<<<<<<
 *         """resolve_empty(self, context)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8Resolver_3resolve_empty(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8Resolver_2resolve_empty, "resolve_empty(self, context)\n\n        Return an empty input document.\n\n        Pass context as parameter.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_8Resolver_3resolve_empty = {"resolve_empty", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8Resolver_3resolve_empty, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8Resolver_2resolve_empty};
static PyObject *__pyx_pw_4lxml_5etree_8Resolver_3resolve_empty(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_context = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("resolve_empty (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_context,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(12, 36, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(12, 36, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "resolve_empty", 0) < (0)) __PYX_ERR(12, 36, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("resolve_empty", 1, 1, 1, i); __PYX_ERR(12, 36, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(12, 36, __pyx_L3_error)
    }
    __pyx_v_context = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("resolve_empty", 1, 1, 1, __pyx_nargs); __PYX_ERR(12, 36, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.Resolver.resolve_empty", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_8Resolver_2resolve_empty(((struct __pyx_obj_4lxml_5etree_Resolver *)__pyx_v_self), __pyx_v_context);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8Resolver_2resolve_empty(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree_Resolver *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_context) {
  struct __pyx_obj_4lxml_5etree__InputDocument *__pyx_v_doc_ref = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("resolve_empty", 0);

  /* "src/lxml/docloader.pxi":44
 *         """
 *         cdef _InputDocument doc_ref
 *         doc_ref = _InputDocument()             # <<<<<<<<<<<<<<
 *         doc_ref._type = PARSER_DATA_EMPTY
 *         return doc_ref
*/
  __pyx_t_2 = NULL;
  __pyx_t_3 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__InputDocument, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 44, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __pyx_v_doc_ref = ((struct __pyx_obj_4lxml_5etree__InputDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/docloader.pxi":45
 *         cdef _InputDocument doc_ref
 *         doc_ref = _InputDocument()
 *         doc_ref._type = PARSER_DATA_EMPTY             # <<<<<<<<<<<<<<
 *         return doc_ref
 * 
*/
  __pyx_v_doc_ref->_type = __pyx_e_4lxml_5etree_PARSER_DATA_EMPTY;

  /* "src/lxml/docloader.pxi":46
 *         doc_ref = _InputDocument()
 *         doc_ref._type = PARSER_DATA_EMPTY
 *         return doc_ref             # <<<<<<<<<<<<<<
 * 
 *     def resolve_string(self, string, context, *, base_url=None):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_doc_ref);
  __pyx_r = ((PyObject *)__pyx_v_doc_ref);
  goto __pyx_L0;

  /* "src/lxml/docloader.pxi":36
 *         return None
 * 
 *     def resolve_empty(self, context):             # <<<<<<<<<<<<<<
 *         """resolve_empty(self, context)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.Resolver.resolve_empty", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc_ref);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/docloader.pxi":48
 *         return doc_ref
 * 
 *     def resolve_string(self, string, context, *, base_url=None):             # <<<<<<<<<<<<<<
 *         """resolve_string(self, string, context, base_url=None)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8Resolver_5resolve_string(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8Resolver_4resolve_string, "resolve_string(self, string, context, base_url=None)\n\n        Return a parsable string as input document.\n\n        Pass data string and context as parameters.  You can pass the\n        source URL or filename through the ``base_url`` keyword\n        argument.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_8Resolver_5resolve_string = {"resolve_string", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8Resolver_5resolve_string, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8Resolver_4resolve_string};
static PyObject *__pyx_pw_4lxml_5etree_8Resolver_5resolve_string(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_string = 0;
  CYTHON_UNUSED PyObject *__pyx_v_context = 0;
  PyObject *__pyx_v_base_url = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("resolve_string (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_string_2,&__pyx_mstate_global->__pyx_n_u_context,&__pyx_mstate_global->__pyx_n_u_base_url,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(12, 48, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(12, 48, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(12, 48, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "resolve_string", 0) < (0)) __PYX_ERR(12, 48, __pyx_L3_error)
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("resolve_string", 1, 2, 2, i); __PYX_ERR(12, 48, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(12, 48, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(12, 48, __pyx_L3_error)
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_string = values[0];
    __pyx_v_context = values[1];
    __pyx_v_base_url = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("resolve_string", 1, 2, 2, __pyx_nargs); __PYX_ERR(12, 48, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.Resolver.resolve_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_8Resolver_4resolve_string(((struct __pyx_obj_4lxml_5etree_Resolver *)__pyx_v_self), __pyx_v_string, __pyx_v_context, __pyx_v_base_url);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8Resolver_4resolve_string(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree_Resolver *__pyx_v_self, PyObject *__pyx_v_string, CYTHON_UNUSED PyObject *__pyx_v_context, PyObject *__pyx_v_base_url) {
  struct __pyx_obj_4lxml_5etree__InputDocument *__pyx_v_doc_ref = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("resolve_string", 0);
  __Pyx_INCREF(__pyx_v_string);

  /* "src/lxml/docloader.pxi":58
 *         """
 *         cdef _InputDocument doc_ref
 *         if isinstance(string, unicode):             # <<<<<<<<<<<<<<
 *             string = (<unicode>string).encode('utf8')
 *         elif not isinstance(string, bytes):
*/
  __pyx_t_1 = PyUnicode_Check(__pyx_v_string); 
  if (__pyx_t_1) {

    /* "src/lxml/docloader.pxi":59
 *         cdef _InputDocument doc_ref
 *         if isinstance(string, unicode):
 *             string = (<unicode>string).encode('utf8')             # <<<<<<<<<<<<<<
 *         elif not isinstance(string, bytes):
 *             raise TypeError, "argument must be a byte string or unicode string"
*/
    if (unlikely(__pyx_v_string == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode");
      __PYX_ERR(12, 59, __pyx_L1_error)
    }
    __pyx_t_2 = PyUnicode_AsUTF8String(((PyObject*)__pyx_v_string)); if (unlikely(!__pyx_t_2)) __PYX_ERR(12, 59, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_string, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/docloader.pxi":58
 *         """
 *         cdef _InputDocument doc_ref
 *         if isinstance(string, unicode):             # <<<<<<<<<<<<<<
 *             string = (<unicode>string).encode('utf8')
 *         elif not isinstance(string, bytes):
*/
    goto __pyx_L3;
  }

  /* "src/lxml/docloader.pxi":60
 *         if isinstance(string, unicode):
 *             string = (<unicode>string).encode('utf8')
 *         elif not isinstance(string, bytes):             # <<<<<<<<<<<<<<
 *             raise TypeError, "argument must be a byte string or unicode string"
 *         doc_ref = _InputDocument()
*/
  __pyx_t_1 = PyBytes_Check(__pyx_v_string); 
  __pyx_t_3 = (!__pyx_t_1);
  if (unlikely(__pyx_t_3)) {

    /* "src/lxml/docloader.pxi":61
 *             string = (<unicode>string).encode('utf8')
 *         elif not isinstance(string, bytes):
 *             raise TypeError, "argument must be a byte string or unicode string"             # <<<<<<<<<<<<<<
 *         doc_ref = _InputDocument()
 *         doc_ref._type = PARSER_DATA_STRING
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_argument_must_be_a_byte_string_o, 0, 0);
    __PYX_ERR(12, 61, __pyx_L1_error)

    /* "src/lxml/docloader.pxi":60
 *         if isinstance(string, unicode):
 *             string = (<unicode>string).encode('utf8')
 *         elif not isinstance(string, bytes):             # <<<<<<<<<<<<<<
 *             raise TypeError, "argument must be a byte string or unicode string"
 *         doc_ref = _InputDocument()
*/
  }
  __pyx_L3:;

  /* "src/lxml/docloader.pxi":62
 *         elif not isinstance(string, bytes):
 *             raise TypeError, "argument must be a byte string or unicode string"
 *         doc_ref = _InputDocument()             # <<<<<<<<<<<<<<
 *         doc_ref._type = PARSER_DATA_STRING
 *         doc_ref._data_bytes = string
*/
  __pyx_t_4 = NULL;
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__InputDocument, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(12, 62, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_2);
  }
  __pyx_v_doc_ref = ((struct __pyx_obj_4lxml_5etree__InputDocument *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/docloader.pxi":63
 *             raise TypeError, "argument must be a byte string or unicode string"
 *         doc_ref = _InputDocument()
 *         doc_ref._type = PARSER_DATA_STRING             # <<<<<<<<<<<<<<
 *         doc_ref._data_bytes = string
 *         if base_url is not None:
*/
  __pyx_v_doc_ref->_type = __pyx_e_4lxml_5etree_PARSER_DATA_STRING;

  /* "src/lxml/docloader.pxi":64
 *         doc_ref = _InputDocument()
 *         doc_ref._type = PARSER_DATA_STRING
 *         doc_ref._data_bytes = string             # <<<<<<<<<<<<<<
 *         if base_url is not None:
 *             doc_ref._filename = _encodeFilename(base_url)
*/
  __pyx_t_2 = __pyx_v_string;
  __Pyx_INCREF(__pyx_t_2);
  if (!(likely(PyBytes_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_2))) __PYX_ERR(12, 64, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_doc_ref->_data_bytes);
  __Pyx_DECREF(__pyx_v_doc_ref->_data_bytes);
  __pyx_v_doc_ref->_data_bytes = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/docloader.pxi":65
 *         doc_ref._type = PARSER_DATA_STRING
 *         doc_ref._data_bytes = string
 *         if base_url is not None:             # <<<<<<<<<<<<<<
 *             doc_ref._filename = _encodeFilename(base_url)
 *         return doc_ref
*/
  __pyx_t_3 = (__pyx_v_base_url != Py_None);
  if (__pyx_t_3) {

    /* "src/lxml/docloader.pxi":66
 *         doc_ref._data_bytes = string
 *         if base_url is not None:
 *             doc_ref._filename = _encodeFilename(base_url)             # <<<<<<<<<<<<<<
 *         return doc_ref
 * 
*/
    __pyx_t_2 = __pyx_f_4lxml_5etree__encodeFilename(__pyx_v_base_url); if (unlikely(!__pyx_t_2)) __PYX_ERR(12, 66, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_GOTREF(__pyx_v_doc_ref->_filename);
    __Pyx_DECREF(__pyx_v_doc_ref->_filename);
    __pyx_v_doc_ref->_filename = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "src/lxml/docloader.pxi":65
 *         doc_ref._type = PARSER_DATA_STRING
 *         doc_ref._data_bytes = string
 *         if base_url is not None:             # <<<<<<<<<<<<<<
 *             doc_ref._filename = _encodeFilename(base_url)
 *         return doc_ref
*/
  }

  /* "src/lxml/docloader.pxi":67
 *         if base_url is not None:
 *             doc_ref._filename = _encodeFilename(base_url)
 *         return doc_ref             # <<<<<<<<<<<<<<
 * 
 *     def resolve_filename(self, filename, context):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_doc_ref);
  __pyx_r = ((PyObject *)__pyx_v_doc_ref);
  goto __pyx_L0;

  /* "src/lxml/docloader.pxi":48
 *         return doc_ref
 * 
 *     def resolve_string(self, string, context, *, base_url=None):             # <<<<<<<<<<<<<<
 *         """resolve_string(self, string, context, base_url=None)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.Resolver.resolve_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc_ref);
  __Pyx_XDECREF(__pyx_v_string);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/docloader.pxi":69
 *         return doc_ref
 * 
 *     def resolve_filename(self, filename, context):             # <<<<<<<<<<<<<<
 *         """resolve_filename(self, filename, context)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8Resolver_7resolve_filename(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8Resolver_6resolve_filename, "resolve_filename(self, filename, context)\n\n        Return the name of a parsable file as input document.\n\n        Pass filename and context as parameters.  You can also pass a\n        URL with an HTTP, FTP or file target.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_8Resolver_7resolve_filename = {"resolve_filename", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8Resolver_7resolve_filename, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8Resolver_6resolve_filename};
static PyObject *__pyx_pw_4lxml_5etree_8Resolver_7resolve_filename(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_filename = 0;
  CYTHON_UNUSED PyObject *__pyx_v_context = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("resolve_filename (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_filename,&__pyx_mstate_global->__pyx_n_u_context,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(12, 69, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(12, 69, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(12, 69, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "resolve_filename", 0) < (0)) __PYX_ERR(12, 69, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("resolve_filename", 1, 2, 2, i); __PYX_ERR(12, 69, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(12, 69, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(12, 69, __pyx_L3_error)
    }
    __pyx_v_filename = values[0];
    __pyx_v_context = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("resolve_filename", 1, 2, 2, __pyx_nargs); __PYX_ERR(12, 69, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.Resolver.resolve_filename", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_8Resolver_6resolve_filename(((struct __pyx_obj_4lxml_5etree_Resolver *)__pyx_v_self), __pyx_v_filename, __pyx_v_context);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8Resolver_6resolve_filename(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree_Resolver *__pyx_v_self, PyObject *__pyx_v_filename, CYTHON_UNUSED PyObject *__pyx_v_context) {
  struct __pyx_obj_4lxml_5etree__InputDocument *__pyx_v_doc_ref = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("resolve_filename", 0);

  /* "src/lxml/docloader.pxi":78
 *         """
 *         cdef _InputDocument doc_ref
 *         doc_ref = _InputDocument()             # <<<<<<<<<<<<<<
 *         doc_ref._type = PARSER_DATA_FILENAME
 *         doc_ref._filename = _encodeFilename(filename)
*/
  __pyx_t_2 = NULL;
  __pyx_t_3 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__InputDocument, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 78, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __pyx_v_doc_ref = ((struct __pyx_obj_4lxml_5etree__InputDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/docloader.pxi":79
 *         cdef _InputDocument doc_ref
 *         doc_ref = _InputDocument()
 *         doc_ref._type = PARSER_DATA_FILENAME             # <<<<<<<<<<<<<<
 *         doc_ref._filename = _encodeFilename(filename)
 *         return doc_ref
*/
  __pyx_v_doc_ref->_type = __pyx_e_4lxml_5etree_PARSER_DATA_FILENAME;

  /* "src/lxml/docloader.pxi":80
 *         doc_ref = _InputDocument()
 *         doc_ref._type = PARSER_DATA_FILENAME
 *         doc_ref._filename = _encodeFilename(filename)             # <<<<<<<<<<<<<<
 *         return doc_ref
 * 
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__encodeFilename(__pyx_v_filename); if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 80, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_doc_ref->_filename);
  __Pyx_DECREF(__pyx_v_doc_ref->_filename);
  __pyx_v_doc_ref->_filename = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "src/lxml/docloader.pxi":81
 *         doc_ref._type = PARSER_DATA_FILENAME
 *         doc_ref._filename = _encodeFilename(filename)
 *         return doc_ref             # <<<<<<<<<<<<<<
 * 
 *     def resolve_file(self, f, context, *, base_url=None, bint close=True):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_doc_ref);
  __pyx_r = ((PyObject *)__pyx_v_doc_ref);
  goto __pyx_L0;

  /* "src/lxml/docloader.pxi":69
 *         return doc_ref
 * 
 *     def resolve_filename(self, filename, context):             # <<<<<<<<<<<<<<
 *         """resolve_filename(self, filename, context)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.Resolver.resolve_filename", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc_ref);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/docloader.pxi":83
 *         return doc_ref
 * 
 *     def resolve_file(self, f, context, *, base_url=None, bint close=True):             # <<<<<<<<<<<<<<
 *         """resolve_file(self, f, context, base_url=None, close=True)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8Resolver_9resolve_file(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8Resolver_8resolve_file, "resolve_file(self, f, context, base_url=None, close=True)\n\n        Return an open file-like object as input document.\n\n        Pass open file and context as parameters.  You can pass the\n        base URL or filename of the file through the ``base_url``\n        keyword argument.  If the ``close`` flag is True (the\n        default), the file will be closed after reading.\n\n        Note that using ``.resolve_filename()`` is more efficient,\n        especially in threaded environments.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_8Resolver_9resolve_file = {"resolve_file", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8Resolver_9resolve_file, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8Resolver_8resolve_file};
static PyObject *__pyx_pw_4lxml_5etree_8Resolver_9resolve_file(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_f = 0;
  CYTHON_UNUSED PyObject *__pyx_v_context = 0;
  PyObject *__pyx_v_base_url = 0;
  int __pyx_v_close;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[4] = {0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("resolve_file (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_f,&__pyx_mstate_global->__pyx_n_u_context,&__pyx_mstate_global->__pyx_n_u_base_url,&__pyx_mstate_global->__pyx_n_u_close,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(12, 83, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(12, 83, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(12, 83, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "resolve_file", 0) < (0)) __PYX_ERR(12, 83, __pyx_L3_error)
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("resolve_file", 1, 2, 2, i); __PYX_ERR(12, 83, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(12, 83, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(12, 83, __pyx_L3_error)
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_f = values[0];
    __pyx_v_context = values[1];
    __pyx_v_base_url = values[2];
    if (values[3]) {
      __pyx_v_close = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_close == (int)-1) && PyErr_Occurred())) __PYX_ERR(12, 83, __pyx_L3_error)
    } else {
      __pyx_v_close = ((int)1);
    }
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("resolve_file", 1, 2, 2, __pyx_nargs); __PYX_ERR(12, 83, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.Resolver.resolve_file", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_8Resolver_8resolve_file(((struct __pyx_obj_4lxml_5etree_Resolver *)__pyx_v_self), __pyx_v_f, __pyx_v_context, __pyx_v_base_url, __pyx_v_close);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8Resolver_8resolve_file(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree_Resolver *__pyx_v_self, PyObject *__pyx_v_f, CYTHON_UNUSED PyObject *__pyx_v_context, PyObject *__pyx_v_base_url, int __pyx_v_close) {
  struct __pyx_obj_4lxml_5etree__InputDocument *__pyx_v_doc_ref = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  size_t __pyx_t_8;
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("resolve_file", 0);

  /* "src/lxml/docloader.pxi":97
 *         """
 *         cdef _InputDocument doc_ref
 *         try:             # <<<<<<<<<<<<<<
 *             f.read
 *         except AttributeError:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "src/lxml/docloader.pxi":98
 *         cdef _InputDocument doc_ref
 *         try:
 *             f.read             # <<<<<<<<<<<<<<
 *         except AttributeError:
 *             raise TypeError, "Argument is not a file-like object"
*/
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_mstate_global->__pyx_n_u_read); if (unlikely(!__pyx_t_4)) __PYX_ERR(12, 98, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "src/lxml/docloader.pxi":97
 *         """
 *         cdef _InputDocument doc_ref
 *         try:             # <<<<<<<<<<<<<<
 *             f.read
 *         except AttributeError:
*/
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "src/lxml/docloader.pxi":99
 *         try:
 *             f.read
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             raise TypeError, "Argument is not a file-like object"
 *         doc_ref = _InputDocument()
*/
    __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_AttributeError))));
    if (__pyx_t_5) {
      __Pyx_AddTraceback("lxml.etree.Resolver.resolve_file", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(12, 99, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);

      /* "src/lxml/docloader.pxi":100
 *             f.read
 *         except AttributeError:
 *             raise TypeError, "Argument is not a file-like object"             # <<<<<<<<<<<<<<
 *         doc_ref = _InputDocument()
 *         doc_ref._type = PARSER_DATA_FILE
*/
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_Argument_is_not_a_file_like_obje, 0, 0);
      __PYX_ERR(12, 100, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;

    /* "src/lxml/docloader.pxi":97
 *         """
 *         cdef _InputDocument doc_ref
 *         try:             # <<<<<<<<<<<<<<
 *             f.read
 *         except AttributeError:
*/
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L8_try_end:;
  }

  /* "src/lxml/docloader.pxi":101
 *         except AttributeError:
 *             raise TypeError, "Argument is not a file-like object"
 *         doc_ref = _InputDocument()             # <<<<<<<<<<<<<<
 *         doc_ref._type = PARSER_DATA_FILE
 *         if base_url is not None:
*/
  __pyx_t_6 = NULL;
  __pyx_t_8 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL};
    __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__InputDocument, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_7)) __PYX_ERR(12, 101, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_7);
  }
  __pyx_v_doc_ref = ((struct __pyx_obj_4lxml_5etree__InputDocument *)__pyx_t_7);
  __pyx_t_7 = 0;

  /* "src/lxml/docloader.pxi":102
 *             raise TypeError, "Argument is not a file-like object"
 *         doc_ref = _InputDocument()
 *         doc_ref._type = PARSER_DATA_FILE             # <<<<<<<<<<<<<<
 *         if base_url is not None:
 *             doc_ref._filename = _encodeFilename(base_url)
*/
  __pyx_v_doc_ref->_type = __pyx_e_4lxml_5etree_PARSER_DATA_FILE;

  /* "src/lxml/docloader.pxi":103
 *         doc_ref = _InputDocument()
 *         doc_ref._type = PARSER_DATA_FILE
 *         if base_url is not None:             # <<<<<<<<<<<<<<
 *             doc_ref._filename = _encodeFilename(base_url)
 *         else:
*/
  __pyx_t_9 = (__pyx_v_base_url != Py_None);
  if (__pyx_t_9) {

    /* "src/lxml/docloader.pxi":104
 *         doc_ref._type = PARSER_DATA_FILE
 *         if base_url is not None:
 *             doc_ref._filename = _encodeFilename(base_url)             # <<<<<<<<<<<<<<
 *         else:
 *             doc_ref._filename = _getFilenameForFile(f)
*/
    __pyx_t_7 = __pyx_f_4lxml_5etree__encodeFilename(__pyx_v_base_url); if (unlikely(!__pyx_t_7)) __PYX_ERR(12, 104, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    __Pyx_GOTREF(__pyx_v_doc_ref->_filename);
    __Pyx_DECREF(__pyx_v_doc_ref->_filename);
    __pyx_v_doc_ref->_filename = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "src/lxml/docloader.pxi":103
 *         doc_ref = _InputDocument()
 *         doc_ref._type = PARSER_DATA_FILE
 *         if base_url is not None:             # <<<<<<<<<<<<<<
 *             doc_ref._filename = _encodeFilename(base_url)
 *         else:
*/
    goto __pyx_L11;
  }

  /* "src/lxml/docloader.pxi":106
 *             doc_ref._filename = _encodeFilename(base_url)
 *         else:
 *             doc_ref._filename = _getFilenameForFile(f)             # <<<<<<<<<<<<<<
 *         doc_ref._close_file = close
 *         doc_ref._file = f
*/
  /*else*/ {
    __pyx_t_7 = __pyx_f_4lxml_5etree__getFilenameForFile(__pyx_v_f); if (unlikely(!__pyx_t_7)) __PYX_ERR(12, 106, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    __Pyx_GOTREF(__pyx_v_doc_ref->_filename);
    __Pyx_DECREF(__pyx_v_doc_ref->_filename);
    __pyx_v_doc_ref->_filename = __pyx_t_7;
    __pyx_t_7 = 0;
  }
  __pyx_L11:;

  /* "src/lxml/docloader.pxi":107
 *         else:
 *             doc_ref._filename = _getFilenameForFile(f)
 *         doc_ref._close_file = close             # <<<<<<<<<<<<<<
 *         doc_ref._file = f
 *         return doc_ref
*/
  __pyx_v_doc_ref->_close_file = __pyx_v_close;

  /* "src/lxml/docloader.pxi":108
 *             doc_ref._filename = _getFilenameForFile(f)
 *         doc_ref._close_file = close
 *         doc_ref._file = f             # <<<<<<<<<<<<<<
 *         return doc_ref
 * 
*/
  __Pyx_INCREF(__pyx_v_f);
  __Pyx_GIVEREF(__pyx_v_f);
  __Pyx_GOTREF(__pyx_v_doc_ref->_file);
  __Pyx_DECREF(__pyx_v_doc_ref->_file);
  __pyx_v_doc_ref->_file = __pyx_v_f;

  /* "src/lxml/docloader.pxi":109
 *         doc_ref._close_file = close
 *         doc_ref._file = f
 *         return doc_ref             # <<<<<<<<<<<<<<
 * 
 * @cython.final
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_doc_ref);
  __pyx_r = ((PyObject *)__pyx_v_doc_ref);
  goto __pyx_L0;

  /* "src/lxml/docloader.pxi":83
 *         return doc_ref
 * 
 *     def resolve_file(self, f, context, *, base_url=None, bint close=True):             # <<<<<<<<<<<<<<
 *         """resolve_file(self, f, context, base_url=None, close=True)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree.Resolver.resolve_file", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc_ref);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/docloader.pxi":116
 *     cdef object _resolvers
 *     cdef Resolver _default_resolver
 *     def __cinit__(self, Resolver default_resolver=None):             # <<<<<<<<<<<<<<
 *         self._resolvers = set()
 *         self._default_resolver = default_resolver
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_17_ResolverRegistry_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_17_ResolverRegistry_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_4lxml_5etree_Resolver *__pyx_v_default_resolver = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_default_resolver,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(12, 116, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(12, 116, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__cinit__", 0) < (0)) __PYX_ERR(12, 116, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef((PyObject *)((struct __pyx_obj_4lxml_5etree_Resolver *)Py_None));
    } else {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(12, 116, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef((PyObject *)((struct __pyx_obj_4lxml_5etree_Resolver *)Py_None));
    }
    __pyx_v_default_resolver = ((struct __pyx_obj_4lxml_5etree_Resolver *)values[0]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 1, __pyx_nargs); __PYX_ERR(12, 116, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._ResolverRegistry.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_default_resolver), __pyx_mstate_global->__pyx_ptype_4lxml_5etree_Resolver, 1, "default_resolver", 0))) __PYX_ERR(12, 116, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_17_ResolverRegistry___cinit__(((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_v_self), __pyx_v_default_resolver);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_17_ResolverRegistry___cinit__(struct __pyx_obj_4lxml_5etree__ResolverRegistry *__pyx_v_self, struct __pyx_obj_4lxml_5etree_Resolver *__pyx_v_default_resolver) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "src/lxml/docloader.pxi":117
 *     cdef Resolver _default_resolver
 *     def __cinit__(self, Resolver default_resolver=None):
 *         self._resolvers = set()             # <<<<<<<<<<<<<<
 *         self._default_resolver = default_resolver
 * 
*/
  __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 117, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_resolvers);
  __Pyx_DECREF(__pyx_v_self->_resolvers);
  __pyx_v_self->_resolvers = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "src/lxml/docloader.pxi":118
 *     def __cinit__(self, Resolver default_resolver=None):
 *         self._resolvers = set()
 *         self._default_resolver = default_resolver             # <<<<<<<<<<<<<<
 * 
 *     def add(self, Resolver resolver not None):
*/
  __Pyx_INCREF((PyObject *)__pyx_v_default_resolver);
  __Pyx_GIVEREF((PyObject *)__pyx_v_default_resolver);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_default_resolver);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_default_resolver);
  __pyx_v_self->_default_resolver = __pyx_v_default_resolver;

  /* "src/lxml/docloader.pxi":116
 *     cdef object _resolvers
 *     cdef Resolver _default_resolver
 *     def __cinit__(self, Resolver default_resolver=None):             # <<<<<<<<<<<<<<
 *         self._resolvers = set()
 *         self._default_resolver = default_resolver
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ResolverRegistry.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/docloader.pxi":120
 *         self._default_resolver = default_resolver
 * 
 *     def add(self, Resolver resolver not None):             # <<<<<<<<<<<<<<
 *         """add(self, resolver)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_17_ResolverRegistry_3add(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_17_ResolverRegistry_2add, "add(self, resolver)\n\n        Register a resolver.\n\n        For each requested entity, the 'resolve' method of the resolver will\n        be called and the result will be passed to the parser.  If this method\n        returns None, the request will be delegated to other resolvers or the\n        default resolver.  The resolvers will be tested in an arbitrary order\n        until the first match is found.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_17_ResolverRegistry_3add = {"add", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_17_ResolverRegistry_3add, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_17_ResolverRegistry_2add};
static PyObject *__pyx_pw_4lxml_5etree_17_ResolverRegistry_3add(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct __pyx_obj_4lxml_5etree_Resolver *__pyx_v_resolver = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("add (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_resolver,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(12, 120, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(12, 120, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "add", 0) < (0)) __PYX_ERR(12, 120, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("add", 1, 1, 1, i); __PYX_ERR(12, 120, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(12, 120, __pyx_L3_error)
    }
    __pyx_v_resolver = ((struct __pyx_obj_4lxml_5etree_Resolver *)values[0]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("add", 1, 1, 1, __pyx_nargs); __PYX_ERR(12, 120, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._ResolverRegistry.add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_resolver), __pyx_mstate_global->__pyx_ptype_4lxml_5etree_Resolver, 0, "resolver", 0))) __PYX_ERR(12, 120, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_17_ResolverRegistry_2add(((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_v_self), __pyx_v_resolver);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_17_ResolverRegistry_2add(struct __pyx_obj_4lxml_5etree__ResolverRegistry *__pyx_v_self, struct __pyx_obj_4lxml_5etree_Resolver *__pyx_v_resolver) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("add", 0);

  /* "src/lxml/docloader.pxi":131
 *         until the first match is found.
 *         """
 *         self._resolvers.add(resolver)             # <<<<<<<<<<<<<<
 * 
 *     def remove(self, resolver):
*/
  __pyx_t_2 = __pyx_v_self->_resolvers;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, ((PyObject *)__pyx_v_resolver)};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_add, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 131, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/docloader.pxi":120
 *         self._default_resolver = default_resolver
 * 
 *     def add(self, Resolver resolver not None):             # <<<<<<<<<<<<<<
 *         """add(self, resolver)
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ResolverRegistry.add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/docloader.pxi":133
 *         self._resolvers.add(resolver)
 * 
 *     def remove(self, resolver):             # <<<<<<<<<<<<<<
 *         "remove(self, resolver)"
 *         self._resolvers.discard(resolver)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_17_ResolverRegistry_5remove(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_17_ResolverRegistry_4remove, "remove(self, resolver)");
static PyMethodDef __pyx_mdef_4lxml_5etree_17_ResolverRegistry_5remove = {"remove", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_17_ResolverRegistry_5remove, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_17_ResolverRegistry_4remove};
static PyObject *__pyx_pw_4lxml_5etree_17_ResolverRegistry_5remove(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_resolver = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("remove (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_resolver,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(12, 133, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(12, 133, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "remove", 0) < (0)) __PYX_ERR(12, 133, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("remove", 1, 1, 1, i); __PYX_ERR(12, 133, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(12, 133, __pyx_L3_error)
    }
    __pyx_v_resolver = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("remove", 1, 1, 1, __pyx_nargs); __PYX_ERR(12, 133, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._ResolverRegistry.remove", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_17_ResolverRegistry_4remove(((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_v_self), __pyx_v_resolver);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_17_ResolverRegistry_4remove(struct __pyx_obj_4lxml_5etree__ResolverRegistry *__pyx_v_self, PyObject *__pyx_v_resolver) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("remove", 0);

  /* "src/lxml/docloader.pxi":135
 *     def remove(self, resolver):
 *         "remove(self, resolver)"
 *         self._resolvers.discard(resolver)             # <<<<<<<<<<<<<<
 * 
 *     cdef _ResolverRegistry _copy(self):
*/
  __pyx_t_2 = __pyx_v_self->_resolvers;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_resolver};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_discard, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 135, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/docloader.pxi":133
 *         self._resolvers.add(resolver)
 * 
 *     def remove(self, resolver):             # <<<<<<<<<<<<<<
 *         "remove(self, resolver)"
 *         self._resolvers.discard(resolver)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ResolverRegistry.remove", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/docloader.pxi":137
 *         self._resolvers.discard(resolver)
 * 
 *     cdef _ResolverRegistry _copy(self):             # <<<<<<<<<<<<<<
 *         cdef _ResolverRegistry registry
 *         registry = _ResolverRegistry(self._default_resolver)
*/

static struct __pyx_obj_4lxml_5etree__ResolverRegistry *__pyx_f_4lxml_5etree_17_ResolverRegistry__copy(struct __pyx_obj_4lxml_5etree__ResolverRegistry *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree__ResolverRegistry *__pyx_v_registry = 0;
  struct __pyx_obj_4lxml_5etree__ResolverRegistry *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_copy", 0);

  /* "src/lxml/docloader.pxi":139
 *     cdef _ResolverRegistry _copy(self):
 *         cdef _ResolverRegistry registry
 *         registry = _ResolverRegistry(self._default_resolver)             # <<<<<<<<<<<<<<
 *         registry._resolvers = self._resolvers.copy()
 *         return registry
*/
  __pyx_t_2 = NULL;
  __pyx_t_3 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, ((PyObject *)__pyx_v_self->_default_resolver)};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ResolverRegistry, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 139, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __pyx_v_registry = ((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/docloader.pxi":140
 *         cdef _ResolverRegistry registry
 *         registry = _ResolverRegistry(self._default_resolver)
 *         registry._resolvers = self._resolvers.copy()             # <<<<<<<<<<<<<<
 *         return registry
 * 
*/
  __pyx_t_2 = __pyx_v_self->_resolvers;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_copy, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 140, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_registry->_resolvers);
  __Pyx_DECREF(__pyx_v_registry->_resolvers);
  __pyx_v_registry->_resolvers = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "src/lxml/docloader.pxi":141
 *         registry = _ResolverRegistry(self._default_resolver)
 *         registry._resolvers = self._resolvers.copy()
 *         return registry             # <<<<<<<<<<<<<<
 * 
 *     def copy(self):
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_registry);
  __pyx_r = __pyx_v_registry;
  goto __pyx_L0;

  /* "src/lxml/docloader.pxi":137
 *         self._resolvers.discard(resolver)
 * 
 *     cdef _ResolverRegistry _copy(self):             # <<<<<<<<<<<<<<
 *         cdef _ResolverRegistry registry
 *         registry = _ResolverRegistry(self._default_resolver)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ResolverRegistry._copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_registry);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/docloader.pxi":143
 *         return registry
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         "copy(self)"
 *         return self._copy()
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_17_ResolverRegistry_7copy(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_17_ResolverRegistry_6copy, "copy(self)");
static PyMethodDef __pyx_mdef_4lxml_5etree_17_ResolverRegistry_7copy = {"copy", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_17_ResolverRegistry_7copy, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_17_ResolverRegistry_6copy};
static PyObject *__pyx_pw_4lxml_5etree_17_ResolverRegistry_7copy(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("copy", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("copy", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_17_ResolverRegistry_6copy(((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_17_ResolverRegistry_6copy(struct __pyx_obj_4lxml_5etree__ResolverRegistry *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy", 0);

  /* "src/lxml/docloader.pxi":145
 *     def copy(self):
 *         "copy(self)"
 *         return self._copy()             # <<<<<<<<<<<<<<
 * 
 *     def resolve(self, system_url, public_id, context):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree_17_ResolverRegistry__copy(__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 145, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/docloader.pxi":143
 *         return registry
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         "copy(self)"
 *         return self._copy()
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ResolverRegistry.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/docloader.pxi":147
 *         return self._copy()
 * 
 *     def resolve(self, system_url, public_id, context):             # <<<<<<<<<<<<<<
 *         "resolve(self, system_url, public_id, context)"
 *         for resolver in self._resolvers:
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_17_ResolverRegistry_9resolve(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_17_ResolverRegistry_8resolve, "resolve(self, system_url, public_id, context)");
static PyMethodDef __pyx_mdef_4lxml_5etree_17_ResolverRegistry_9resolve = {"resolve", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_17_ResolverRegistry_9resolve, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_17_ResolverRegistry_8resolve};
static PyObject *__pyx_pw_4lxml_5etree_17_ResolverRegistry_9resolve(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_system_url = 0;
  PyObject *__pyx_v_public_id = 0;
  PyObject *__pyx_v_context = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("resolve (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_system_url,&__pyx_mstate_global->__pyx_n_u_public_id,&__pyx_mstate_global->__pyx_n_u_context,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(12, 147, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(12, 147, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(12, 147, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(12, 147, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "resolve", 0) < (0)) __PYX_ERR(12, 147, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("resolve", 1, 3, 3, i); __PYX_ERR(12, 147, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(12, 147, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(12, 147, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(12, 147, __pyx_L3_error)
    }
    __pyx_v_system_url = values[0];
    __pyx_v_public_id = values[1];
    __pyx_v_context = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("resolve", 1, 3, 3, __pyx_nargs); __PYX_ERR(12, 147, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._ResolverRegistry.resolve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_17_ResolverRegistry_8resolve(((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_v_self), __pyx_v_system_url, __pyx_v_public_id, __pyx_v_context);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_17_ResolverRegistry_8resolve(struct __pyx_obj_4lxml_5etree__ResolverRegistry *__pyx_v_self, PyObject *__pyx_v_system_url, PyObject *__pyx_v_public_id, PyObject *__pyx_v_context) {
  PyObject *__pyx_v_resolver = NULL;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("resolve", 0);

  /* "src/lxml/docloader.pxi":149
 *     def resolve(self, system_url, public_id, context):
 *         "resolve(self, system_url, public_id, context)"
 *         for resolver in self._resolvers:             # <<<<<<<<<<<<<<
 *             result = resolver.resolve(system_url, public_id, context)
 *             if result is not None:
*/
  if (likely(PyList_CheckExact(__pyx_v_self->_resolvers)) || PyTuple_CheckExact(__pyx_v_self->_resolvers)) {
    __pyx_t_1 = __pyx_v_self->_resolvers; __Pyx_INCREF(__pyx_t_1);
    __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_self->_resolvers); if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 149, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(12, 149, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(12, 149, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference);
        ++__pyx_t_2;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(12, 149, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2));
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2);
        #endif
        ++__pyx_t_2;
      }
      if (unlikely(!__pyx_t_4)) __PYX_ERR(12, 149, __pyx_L1_error)
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(12, 149, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XDECREF_SET(__pyx_v_resolver, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "src/lxml/docloader.pxi":150
 *         "resolve(self, system_url, public_id, context)"
 *         for resolver in self._resolvers:
 *             result = resolver.resolve(system_url, public_id, context)             # <<<<<<<<<<<<<<
 *             if result is not None:
 *                 return result
*/
    __pyx_t_5 = __pyx_v_resolver;
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_6 = 0;
    {
      PyObject *__pyx_callargs[4] = {__pyx_t_5, __pyx_v_system_url, __pyx_v_public_id, __pyx_v_context};
      __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_resolve, __pyx_callargs+__pyx_t_6, (4-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(12, 150, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_result, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "src/lxml/docloader.pxi":151
 *         for resolver in self._resolvers:
 *             result = resolver.resolve(system_url, public_id, context)
 *             if result is not None:             # <<<<<<<<<<<<<<
 *                 return result
 *         if self._default_resolver is None:
*/
    __pyx_t_7 = (__pyx_v_result != Py_None);
    if (__pyx_t_7) {

      /* "src/lxml/docloader.pxi":152
 *             result = resolver.resolve(system_url, public_id, context)
 *             if result is not None:
 *                 return result             # <<<<<<<<<<<<<<
 *         if self._default_resolver is None:
 *             return None
*/
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_result);
      __pyx_r = __pyx_v_result;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;

      /* "src/lxml/docloader.pxi":151
 *         for resolver in self._resolvers:
 *             result = resolver.resolve(system_url, public_id, context)
 *             if result is not None:             # <<<<<<<<<<<<<<
 *                 return result
 *         if self._default_resolver is None:
*/
    }

    /* "src/lxml/docloader.pxi":149
 *     def resolve(self, system_url, public_id, context):
 *         "resolve(self, system_url, public_id, context)"
 *         for resolver in self._resolvers:             # <<<<<<<<<<<<<<
 *             result = resolver.resolve(system_url, public_id, context)
 *             if result is not None:
*/
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/docloader.pxi":153
 *             if result is not None:
 *                 return result
 *         if self._default_resolver is None:             # <<<<<<<<<<<<<<
 *             return None
 *         return self._default_resolver.resolve(system_url, public_id, context)
*/
  __pyx_t_7 = (((PyObject *)__pyx_v_self->_default_resolver) == Py_None);
  if (__pyx_t_7) {

    /* "src/lxml/docloader.pxi":154
 *                 return result
 *         if self._default_resolver is None:
 *             return None             # <<<<<<<<<<<<<<
 *         return self._default_resolver.resolve(system_url, public_id, context)
 * 
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/docloader.pxi":153
 *             if result is not None:
 *                 return result
 *         if self._default_resolver is None:             # <<<<<<<<<<<<<<
 *             return None
 *         return self._default_resolver.resolve(system_url, public_id, context)
*/
  }

  /* "src/lxml/docloader.pxi":155
 *         if self._default_resolver is None:
 *             return None
 *         return self._default_resolver.resolve(system_url, public_id, context)             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = ((PyObject *)__pyx_v_self->_default_resolver);
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[4] = {__pyx_t_4, __pyx_v_system_url, __pyx_v_public_id, __pyx_v_context};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_resolve, __pyx_callargs+__pyx_t_6, (4-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 155, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/docloader.pxi":147
 *         return self._copy()
 * 
 *     def resolve(self, system_url, public_id, context):             # <<<<<<<<<<<<<<
 *         "resolve(self, system_url, public_id, context)"
 *         for resolver in self._resolvers:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._ResolverRegistry.resolve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_resolver);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/docloader.pxi":157
 *         return self._default_resolver.resolve(system_url, public_id, context)
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return repr(self._resolvers)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_17_ResolverRegistry_11__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_17_ResolverRegistry_11__repr__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_17_ResolverRegistry_10__repr__(((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_17_ResolverRegistry_10__repr__(struct __pyx_obj_4lxml_5etree__ResolverRegistry *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "src/lxml/docloader.pxi":158
 * 
 *     def __repr__(self):
 *         return repr(self._resolvers)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_v_self->_resolvers;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Repr(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(12, 158, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/docloader.pxi":157
 *         return self._default_resolver.resolve(system_url, public_id, context)
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return repr(self._resolvers)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ResolverRegistry.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/docloader.pxi":166
 *     cdef _TempStore _storage
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef int clear(self) except -1:
 *         _ExceptionContext.clear(self)
*/

static int __pyx_f_4lxml_5etree_16_ResolverContext_clear(struct __pyx_obj_4lxml_5etree__ResolverContext *__pyx_v_self) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/docloader.pxi":168
 *     @cython.final
 *     cdef int clear(self) except -1:
 *         _ExceptionContext.clear(self)             # <<<<<<<<<<<<<<
 *         self._storage.clear()
 *         return 0
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_17_ExceptionContext_clear(((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_v_self)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(12, 168, __pyx_L1_error)

  /* "src/lxml/docloader.pxi":169
 *     cdef int clear(self) except -1:
 *         _ExceptionContext.clear(self)
 *         self._storage.clear()             # <<<<<<<<<<<<<<
 *         return 0
 * 
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_10_TempStore_clear(__pyx_v_self->_storage); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(12, 169, __pyx_L1_error)

  /* "src/lxml/docloader.pxi":170
 *         _ExceptionContext.clear(self)
 *         self._storage.clear()
 *         return 0             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/docloader.pxi":166
 *     cdef _TempStore _storage
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef int clear(self) except -1:
 *         _ExceptionContext.clear(self)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._ResolverContext.clear", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/docloader.pxi":173
 * 
 * 
 * cdef _initResolverContext(_ResolverContext context,             # <<<<<<<<<<<<<<
 *                           _ResolverRegistry resolvers):
 *     if resolvers is None:
*/

static PyObject *__pyx_f_4lxml_5etree__initResolverContext(struct __pyx_obj_4lxml_5etree__ResolverContext *__pyx_v_context, struct __pyx_obj_4lxml_5etree__ResolverRegistry *__pyx_v_resolvers) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_initResolverContext", 0);

  /* "src/lxml/docloader.pxi":175
 * cdef _initResolverContext(_ResolverContext context,
 *                           _ResolverRegistry resolvers):
 *     if resolvers is None:             # <<<<<<<<<<<<<<
 *         context._resolvers = _ResolverRegistry()
 *     else:
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_resolvers) == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/docloader.pxi":176
 *                           _ResolverRegistry resolvers):
 *     if resolvers is None:
 *         context._resolvers = _ResolverRegistry()             # <<<<<<<<<<<<<<
 *     else:
 *         context._resolvers = resolvers
*/
    __pyx_t_3 = NULL;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ResolverRegistry, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(12, 176, __pyx_L1_error)
      __Pyx_GOTREF((PyObject *)__pyx_t_2);
    }
    __Pyx_GIVEREF((PyObject *)__pyx_t_2);
    __Pyx_GOTREF((PyObject *)__pyx_v_context->_resolvers);
    __Pyx_DECREF((PyObject *)__pyx_v_context->_resolvers);
    __pyx_v_context->_resolvers = ((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/docloader.pxi":175
 * cdef _initResolverContext(_ResolverContext context,
 *                           _ResolverRegistry resolvers):
 *     if resolvers is None:             # <<<<<<<<<<<<<<
 *         context._resolvers = _ResolverRegistry()
 *     else:
*/
    goto __pyx_L3;
  }

  /* "src/lxml/docloader.pxi":178
 *         context._resolvers = _ResolverRegistry()
 *     else:
 *         context._resolvers = resolvers             # <<<<<<<<<<<<<<
 *     context._storage = _TempStore()
*/
  /*else*/ {
    __Pyx_INCREF((PyObject *)__pyx_v_resolvers);
    __Pyx_GIVEREF((PyObject *)__pyx_v_resolvers);
    __Pyx_GOTREF((PyObject *)__pyx_v_context->_resolvers);
    __Pyx_DECREF((PyObject *)__pyx_v_context->_resolvers);
    __pyx_v_context->_resolvers = __pyx_v_resolvers;
  }
  __pyx_L3:;

  /* "src/lxml/docloader.pxi":179
 *     else:
 *         context._resolvers = resolvers
 *     context._storage = _TempStore()             # <<<<<<<<<<<<<<
*/
  __pyx_t_3 = NULL;
  __pyx_t_4 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__TempStore, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(12, 179, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_2);
  }
  __Pyx_GIVEREF((PyObject *)__pyx_t_2);
  __Pyx_GOTREF((PyObject *)__pyx_v_context->_storage);
  __Pyx_DECREF((PyObject *)__pyx_v_context->_storage);
  __pyx_v_context->_storage = ((struct __pyx_obj_4lxml_5etree__TempStore *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/docloader.pxi":173
 * 
 * 
 * cdef _initResolverContext(_ResolverContext context,             # <<<<<<<<<<<<<<
 *                           _ResolverRegistry resolvers):
 *     if resolvers is None:
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._initResolverContext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":11
 * except ImportError:
 *     # Python 3.8 - we only need this as return value from "__class_getitem__"
 *     def _GenericAlias(cls, item):             # <<<<<<<<<<<<<<
 *         return f"{cls.__name__}[{item.__name__}]"
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_43_GenericAlias(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_43_GenericAlias = {"_GenericAlias", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_43_GenericAlias, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_43_GenericAlias(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_cls = 0;
  PyObject *__pyx_v_item = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_GenericAlias (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_cls,&__pyx_mstate_global->__pyx_n_u_item,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(2, 11, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(2, 11, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(2, 11, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_GenericAlias", 0) < (0)) __PYX_ERR(2, 11, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_GenericAlias", 1, 2, 2, i); __PYX_ERR(2, 11, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(2, 11, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(2, 11, __pyx_L3_error)
    }
    __pyx_v_cls = values[0];
    __pyx_v_item = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_GenericAlias", 1, 2, 2, __pyx_nargs); __PYX_ERR(2, 11, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._GenericAlias", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_42_GenericAlias(__pyx_self, __pyx_v_cls, __pyx_v_item);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_42_GenericAlias(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cls, PyObject *__pyx_v_item) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4[4];
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_GenericAlias", 0);

  /* "src/lxml/parser.pxi":12
 *     # Python 3.8 - we only need this as return value from "__class_getitem__"
 *     def _GenericAlias(cls, item):
 *         return f"{cls.__name__}[{item.__name__}]"             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_cls, __pyx_mstate_global->__pyx_n_u_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_t_1, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_item, __pyx_mstate_global->__pyx_n_u_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_t_1, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_4[0] = __pyx_t_2;
  __pyx_t_4[1] = __pyx_mstate_global->__pyx_kp_u__21;
  __pyx_t_4[2] = __pyx_t_3;
  __pyx_t_4[3] = __pyx_mstate_global->__pyx_kp_u__22;
  __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_4, 4, __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 1 * 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3));
  if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":11
 * except ImportError:
 *     # Python 3.8 - we only need this as return value from "__class_getitem__"
 *     def _GenericAlias(cls, item):             # <<<<<<<<<<<<<<
 *         return f"{cls.__name__}[{item.__name__}]"
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._GenericAlias", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":20
 *     For compatibility with ElementTree 1.3 and later.
 *     """
 *     def __init__(self, message, code, line, column, filename=None):             # <<<<<<<<<<<<<<
 *         super(_ParseError, self).__init__(message)
 *         self.lineno, self.offset = (line, column - 1)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_10ParseError_1__init__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_10ParseError_1__init__ = {"__init__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_10ParseError_1__init__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_10ParseError_1__init__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_message = 0;
  PyObject *__pyx_v_code = 0;
  PyObject *__pyx_v_line = 0;
  PyObject *__pyx_v_column = 0;
  PyObject *__pyx_v_filename = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[6] = {0,0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_message,&__pyx_mstate_global->__pyx_n_u_code,&__pyx_mstate_global->__pyx_n_u_line_2,&__pyx_mstate_global->__pyx_n_u_column_2,&__pyx_mstate_global->__pyx_n_u_filename,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(2, 20, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  6:
        values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(2, 20, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(2, 20, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(2, 20, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(2, 20, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(2, 20, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(2, 20, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(2, 20, __pyx_L3_error)
      if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 5; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 6, i); __PYX_ERR(2, 20, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  6:
        values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(2, 20, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(2, 20, __pyx_L3_error)
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(2, 20, __pyx_L3_error)
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(2, 20, __pyx_L3_error)
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(2, 20, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(2, 20, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_self = values[0];
    __pyx_v_message = values[1];
    __pyx_v_code = values[2];
    __pyx_v_line = values[3];
    __pyx_v_column = values[4];
    __pyx_v_filename = values[5];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 6, __pyx_nargs); __PYX_ERR(2, 20, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.ParseError.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_10ParseError___init__(__pyx_self, __pyx_v_self, __pyx_v_message, __pyx_v_code, __pyx_v_line, __pyx_v_column, __pyx_v_filename);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_10ParseError___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_message, PyObject *__pyx_v_code, PyObject *__pyx_v_line, PyObject *__pyx_v_column, PyObject *__pyx_v_filename) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "src/lxml/parser.pxi":21
 *     """
 *     def __init__(self, message, code, line, column, filename=None):
 *         super(_ParseError, self).__init__(message)             # <<<<<<<<<<<<<<
 *         self.lineno, self.offset = (line, column - 1)
 *         self.code = code
*/
  __pyx_t_4 = NULL;
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_v_4lxml_5etree__ParseError, __pyx_v_self};
    __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_super, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 21, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  __pyx_t_2 = __pyx_t_3;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_message};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_init, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 21, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/parser.pxi":22
 *     def __init__(self, message, code, line, column, filename=None):
 *         super(_ParseError, self).__init__(message)
 *         self.lineno, self.offset = (line, column - 1)             # <<<<<<<<<<<<<<
 *         self.code = code
 *         self.filename = filename
*/
  __pyx_t_1 = __pyx_v_line;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyLong_SubtractObjC(__pyx_v_column, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 22, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_lineno, __pyx_t_1) < (0)) __PYX_ERR(2, 22, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_offset, __pyx_t_3) < (0)) __PYX_ERR(2, 22, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/parser.pxi":23
 *         super(_ParseError, self).__init__(message)
 *         self.lineno, self.offset = (line, column - 1)
 *         self.code = code             # <<<<<<<<<<<<<<
 *         self.filename = filename
 * 
*/
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_code, __pyx_v_code) < (0)) __PYX_ERR(2, 23, __pyx_L1_error)

  /* "src/lxml/parser.pxi":24
 *         self.lineno, self.offset = (line, column - 1)
 *         self.code = code
 *         self.filename = filename             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_filename, __pyx_v_filename) < (0)) __PYX_ERR(2, 24, __pyx_L1_error)

  /* "src/lxml/parser.pxi":20
 *     For compatibility with ElementTree 1.3 and later.
 *     """
 *     def __init__(self, message, code, line, column, filename=None):             # <<<<<<<<<<<<<<
 *         super(_ParseError, self).__init__(message)
 *         self.lineno, self.offset = (line, column - 1)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.ParseError.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":26
 *         self.filename = filename
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def position(self):
 *         return self.lineno, self.offset + 1
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_10ParseError_3position(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_10ParseError_3position = {"position", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_10ParseError_3position, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_10ParseError_3position(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("position (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(2, 26, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(2, 26, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "position", 0) < (0)) __PYX_ERR(2, 26, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("position", 1, 1, 1, i); __PYX_ERR(2, 26, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(2, 26, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("position", 1, 1, 1, __pyx_nargs); __PYX_ERR(2, 26, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.ParseError.position", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_10ParseError_2position(__pyx_self, __pyx_v_self);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_10ParseError_2position(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("position", 0);

  /* "src/lxml/parser.pxi":28
 *     @property
 *     def position(self):
 *         return self.lineno, self.offset + 1             # <<<<<<<<<<<<<<
 * 
 *     @position.setter
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_lineno); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 28, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_offset); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 28, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyLong_AddObjC(__pyx_t_2, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 28, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 28, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1) != (0)) __PYX_ERR(2, 28, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_3);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3) != (0)) __PYX_ERR(2, 28, __pyx_L1_error);
  __pyx_t_1 = 0;
  __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":26
 *         self.filename = filename
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def position(self):
 *         return self.lineno, self.offset + 1
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.ParseError.position", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":30
 *         return self.lineno, self.offset + 1
 * 
 *     @position.setter             # <<<<<<<<<<<<<<
 *     def position(self, new_pos):
 *         self.lineno, column = new_pos
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_10ParseError_5position(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_10ParseError_5position = {"position", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_10ParseError_5position, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_10ParseError_5position(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_new_pos = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("position (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_new_pos,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(2, 30, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(2, 30, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(2, 30, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "position", 0) < (0)) __PYX_ERR(2, 30, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("position", 1, 2, 2, i); __PYX_ERR(2, 30, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(2, 30, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(2, 30, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
    __pyx_v_new_pos = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("position", 1, 2, 2, __pyx_nargs); __PYX_ERR(2, 30, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.ParseError.position", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_10ParseError_4position(__pyx_self, __pyx_v_self, __pyx_v_new_pos);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_10ParseError_4position(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_new_pos) {
  PyObject *__pyx_v_column = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *(*__pyx_t_4)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("position", 0);

  /* "src/lxml/parser.pxi":32
 *     @position.setter
 *     def position(self, new_pos):
 *         self.lineno, column = new_pos             # <<<<<<<<<<<<<<
 *         self.offset = column - 1
 * 
*/
  if ((likely(PyTuple_CheckExact(__pyx_v_new_pos))) || (PyList_CheckExact(__pyx_v_new_pos))) {
    PyObject* sequence = __pyx_v_new_pos;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(2, 32, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
      __Pyx_INCREF(__pyx_t_2);
    } else {
      __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 32, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
      if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 32, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_2);
    }
    #else
    __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 32, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 32, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    #endif
  } else {
    Py_ssize_t index = -1;
    __pyx_t_3 = PyObject_GetIter(__pyx_v_new_pos); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 32, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3);
    index = 0; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 1; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < (0)) __PYX_ERR(2, 32, __pyx_L1_error)
    __pyx_t_4 = NULL;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(2, 32, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_lineno, __pyx_t_1) < (0)) __PYX_ERR(2, 32, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_column = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "src/lxml/parser.pxi":33
 *     def position(self, new_pos):
 *         self.lineno, column = new_pos
 *         self.offset = column - 1             # <<<<<<<<<<<<<<
 * 
 * cdef object _ParseError = ParseError
*/
  __pyx_t_2 = __Pyx_PyLong_SubtractObjC(__pyx_v_column, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 33, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_offset, __pyx_t_2) < (0)) __PYX_ERR(2, 33, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/parser.pxi":30
 *         return self.lineno, self.offset + 1
 * 
 *     @position.setter             # <<<<<<<<<<<<<<
 *     def position(self, new_pos):
 *         self.lineno, column = new_pos
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.ParseError.position", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_column);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":63
 *     cdef list _implied_parser_contexts
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._implied_parser_contexts = []
 * 
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_24_ParserDictionaryContext_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_24_ParserDictionaryContext_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, __pyx_nargs); return -1; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return -1;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__cinit__", __pyx_kwds); return -1;}
  __pyx_r = __pyx_pf_4lxml_5etree_24_ParserDictionaryContext___cinit__(((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_24_ParserDictionaryContext___cinit__(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "src/lxml/parser.pxi":64
 * 
 *     def __cinit__(self):
 *         self._implied_parser_contexts = []             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
*/
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 64, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_implied_parser_contexts);
  __Pyx_DECREF(__pyx_v_self->_implied_parser_contexts);
  __pyx_v_self->_implied_parser_contexts = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/parser.pxi":63
 *     cdef list _implied_parser_contexts
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._implied_parser_contexts = []
 * 
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ParserDictionaryContext.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":66
 *         self._implied_parser_contexts = []
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._c_dict is not NULL:
 *             xmlparser.xmlDictFree(self._c_dict)
*/

/* Python wrapper */
static void __pyx_pw_4lxml_5etree_24_ParserDictionaryContext_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_4lxml_5etree_24_ParserDictionaryContext_3__dealloc__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_pf_4lxml_5etree_24_ParserDictionaryContext_2__dealloc__(((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_4lxml_5etree_24_ParserDictionaryContext_2__dealloc__(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self) {
  int __pyx_t_1;

  /* "src/lxml/parser.pxi":67
 * 
 *     def __dealloc__(self):
 *         if self._c_dict is not NULL:             # <<<<<<<<<<<<<<
 *             xmlparser.xmlDictFree(self._c_dict)
 * 
*/
  __pyx_t_1 = (__pyx_v_self->_c_dict != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":68
 *     def __dealloc__(self):
 *         if self._c_dict is not NULL:
 *             xmlparser.xmlDictFree(self._c_dict)             # <<<<<<<<<<<<<<
 * 
 *     cdef int initMainParserContext(self) except -1:
*/
    xmlDictFree(__pyx_v_self->_c_dict);

    /* "src/lxml/parser.pxi":67
 * 
 *     def __dealloc__(self):
 *         if self._c_dict is not NULL:             # <<<<<<<<<<<<<<
 *             xmlparser.xmlDictFree(self._c_dict)
 * 
*/
  }

  /* "src/lxml/parser.pxi":66
 *         self._implied_parser_contexts = []
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._c_dict is not NULL:
 *             xmlparser.xmlDictFree(self._c_dict)
*/

  /* function exit code */
}

/* "src/lxml/parser.pxi":70
 *             xmlparser.xmlDictFree(self._c_dict)
 * 
 *     cdef int initMainParserContext(self) except -1:             # <<<<<<<<<<<<<<
 *         """Put the global context into the thread dictionary of the main
 *         thread.  To be called once and only in the main thread."""
*/

static int __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initMainParserContext(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self) {
  PyObject *__pyx_v_thread_dict;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/parser.pxi":73
 *         """Put the global context into the thread dictionary of the main
 *         thread.  To be called once and only in the main thread."""
 *         thread_dict = python.PyThreadState_GetDict()             # <<<<<<<<<<<<<<
 *         if thread_dict is not NULL:
 *             (<dict>thread_dict)["_ParserDictionaryContext"] = self
*/
  __pyx_v_thread_dict = PyThreadState_GetDict();

  /* "src/lxml/parser.pxi":74
 *         thread.  To be called once and only in the main thread."""
 *         thread_dict = python.PyThreadState_GetDict()
 *         if thread_dict is not NULL:             # <<<<<<<<<<<<<<
 *             (<dict>thread_dict)["_ParserDictionaryContext"] = self
 * 
*/
  __pyx_t_1 = (__pyx_v_thread_dict != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":75
 *         thread_dict = python.PyThreadState_GetDict()
 *         if thread_dict is not NULL:
 *             (<dict>thread_dict)["_ParserDictionaryContext"] = self             # <<<<<<<<<<<<<<
 * 
 *     cdef _ParserDictionaryContext _findThreadParserContext(self):
*/
    if (unlikely(((PyObject *)__pyx_v_thread_dict) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(2, 75, __pyx_L1_error)
    }
    if (unlikely((PyDict_SetItem(((PyObject*)__pyx_v_thread_dict), __pyx_mstate_global->__pyx_n_u_ParserDictionaryContext, ((PyObject *)__pyx_v_self)) < 0))) __PYX_ERR(2, 75, __pyx_L1_error)

    /* "src/lxml/parser.pxi":74
 *         thread.  To be called once and only in the main thread."""
 *         thread_dict = python.PyThreadState_GetDict()
 *         if thread_dict is not NULL:             # <<<<<<<<<<<<<<
 *             (<dict>thread_dict)["_ParserDictionaryContext"] = self
 * 
*/
  }

  /* "src/lxml/parser.pxi":70
 *             xmlparser.xmlDictFree(self._c_dict)
 * 
 *     cdef int initMainParserContext(self) except -1:             # <<<<<<<<<<<<<<
 *         """Put the global context into the thread dictionary of the main
 *         thread.  To be called once and only in the main thread."""
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._ParserDictionaryContext.initMainParserContext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/parser.pxi":77
 *             (<dict>thread_dict)["_ParserDictionaryContext"] = self
 * 
 *     cdef _ParserDictionaryContext _findThreadParserContext(self):             # <<<<<<<<<<<<<<
 *         "Find (or create) the _ParserDictionaryContext object for the current thread"
 *         cdef _ParserDictionaryContext context
*/

static struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_f_4lxml_5etree_24_ParserDictionaryContext__findThreadParserContext(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_context = 0;
  PyObject *__pyx_v_thread_dict;
  PyObject *__pyx_v_d = NULL;
  PyObject *__pyx_v_result;
  struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_findThreadParserContext", 0);

  /* "src/lxml/parser.pxi":80
 *         "Find (or create) the _ParserDictionaryContext object for the current thread"
 *         cdef _ParserDictionaryContext context
 *         thread_dict = python.PyThreadState_GetDict()             # <<<<<<<<<<<<<<
 *         if thread_dict is NULL:
 *             return self
*/
  __pyx_v_thread_dict = PyThreadState_GetDict();

  /* "src/lxml/parser.pxi":81
 *         cdef _ParserDictionaryContext context
 *         thread_dict = python.PyThreadState_GetDict()
 *         if thread_dict is NULL:             # <<<<<<<<<<<<<<
 *             return self
 *         d = <dict>thread_dict
*/
  __pyx_t_1 = (__pyx_v_thread_dict == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":82
 *         thread_dict = python.PyThreadState_GetDict()
 *         if thread_dict is NULL:
 *             return self             # <<<<<<<<<<<<<<
 *         d = <dict>thread_dict
 *         result = python.PyDict_GetItem(d, "_ParserDictionaryContext")
*/
    __Pyx_XDECREF((PyObject *)__pyx_r);
    __Pyx_INCREF((PyObject *)__pyx_v_self);
    __pyx_r = __pyx_v_self;
    goto __pyx_L0;

    /* "src/lxml/parser.pxi":81
 *         cdef _ParserDictionaryContext context
 *         thread_dict = python.PyThreadState_GetDict()
 *         if thread_dict is NULL:             # <<<<<<<<<<<<<<
 *             return self
 *         d = <dict>thread_dict
*/
  }

  /* "src/lxml/parser.pxi":83
 *         if thread_dict is NULL:
 *             return self
 *         d = <dict>thread_dict             # <<<<<<<<<<<<<<
 *         result = python.PyDict_GetItem(d, "_ParserDictionaryContext")
 *         if result is not NULL:
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_thread_dict);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_d = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/parser.pxi":84
 *             return self
 *         d = <dict>thread_dict
 *         result = python.PyDict_GetItem(d, "_ParserDictionaryContext")             # <<<<<<<<<<<<<<
 *         if result is not NULL:
 *             return <object>result
*/
  __pyx_v_result = PyDict_GetItem(__pyx_v_d, __pyx_mstate_global->__pyx_n_u_ParserDictionaryContext);

  /* "src/lxml/parser.pxi":85
 *         d = <dict>thread_dict
 *         result = python.PyDict_GetItem(d, "_ParserDictionaryContext")
 *         if result is not NULL:             # <<<<<<<<<<<<<<
 *             return <object>result
 *         context = <_ParserDictionaryContext>_ParserDictionaryContext.__new__(_ParserDictionaryContext)
*/
  __pyx_t_1 = (__pyx_v_result != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":86
 *         result = python.PyDict_GetItem(d, "_ParserDictionaryContext")
 *         if result is not NULL:
 *             return <object>result             # <<<<<<<<<<<<<<
 *         context = <_ParserDictionaryContext>_ParserDictionaryContext.__new__(_ParserDictionaryContext)
 *         d["_ParserDictionaryContext"] = context
*/
    __Pyx_XDECREF((PyObject *)__pyx_r);
    if (!(likely(((((PyObject *)__pyx_v_result)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_result), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ParserDictionaryContext))))) __PYX_ERR(2, 86, __pyx_L1_error)
    __Pyx_INCREF(((PyObject *)__pyx_v_result));
    __pyx_r = ((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)((PyObject *)__pyx_v_result));
    goto __pyx_L0;

    /* "src/lxml/parser.pxi":85
 *         d = <dict>thread_dict
 *         result = python.PyDict_GetItem(d, "_ParserDictionaryContext")
 *         if result is not NULL:             # <<<<<<<<<<<<<<
 *             return <object>result
 *         context = <_ParserDictionaryContext>_ParserDictionaryContext.__new__(_ParserDictionaryContext)
*/
  }

  /* "src/lxml/parser.pxi":87
 *         if result is not NULL:
 *             return <object>result
 *         context = <_ParserDictionaryContext>_ParserDictionaryContext.__new__(_ParserDictionaryContext)             # <<<<<<<<<<<<<<
 *         d["_ParserDictionaryContext"] = context
 *         return context
*/
  __pyx_t_2 = ((PyObject *)__pyx_tp_new_4lxml_5etree__ParserDictionaryContext(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ParserDictionaryContext), __pyx_mstate_global->__pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 87, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_2);
  __pyx_t_3 = ((PyObject *)__pyx_t_2);
  __Pyx_INCREF(__pyx_t_3);
  __Pyx_DECREF((PyObject *)__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/parser.pxi":88
 *             return <object>result
 *         context = <_ParserDictionaryContext>_ParserDictionaryContext.__new__(_ParserDictionaryContext)
 *         d["_ParserDictionaryContext"] = context             # <<<<<<<<<<<<<<
 *         return context
 * 
*/
  if (unlikely(__pyx_v_d == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(2, 88, __pyx_L1_error)
  }
  if (unlikely((PyDict_SetItem(__pyx_v_d, __pyx_mstate_global->__pyx_n_u_ParserDictionaryContext, ((PyObject *)__pyx_v_context)) < 0))) __PYX_ERR(2, 88, __pyx_L1_error)

  /* "src/lxml/parser.pxi":89
 *         context = <_ParserDictionaryContext>_ParserDictionaryContext.__new__(_ParserDictionaryContext)
 *         d["_ParserDictionaryContext"] = context
 *         return context             # <<<<<<<<<<<<<<
 * 
 *     cdef int setDefaultParser(self, _BaseParser parser) except -1:
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_context);
  __pyx_r = __pyx_v_context;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":77
 *             (<dict>thread_dict)["_ParserDictionaryContext"] = self
 * 
 *     cdef _ParserDictionaryContext _findThreadParserContext(self):             # <<<<<<<<<<<<<<
 *         "Find (or create) the _ParserDictionaryContext object for the current thread"
 *         cdef _ParserDictionaryContext context
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._ParserDictionaryContext._findThreadParserContext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_d);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":91
 *         return context
 * 
 *     cdef int setDefaultParser(self, _BaseParser parser) except -1:             # <<<<<<<<<<<<<<
 *         "Set the default parser for the current thread"
 *         cdef _ParserDictionaryContext context
*/

static int __pyx_f_4lxml_5etree_24_ParserDictionaryContext_setDefaultParser(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser) {
  struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_context = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("setDefaultParser", 0);

  /* "src/lxml/parser.pxi":94
 *         "Set the default parser for the current thread"
 *         cdef _ParserDictionaryContext context
 *         context = self._findThreadParserContext()             # <<<<<<<<<<<<<<
 *         context._default_parser = parser
 * 
*/
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree_24_ParserDictionaryContext__findThreadParserContext(__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 94, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/parser.pxi":95
 *         cdef _ParserDictionaryContext context
 *         context = self._findThreadParserContext()
 *         context._default_parser = parser             # <<<<<<<<<<<<<<
 * 
 *     cdef _BaseParser getDefaultParser(self):
*/
  __Pyx_INCREF((PyObject *)__pyx_v_parser);
  __Pyx_GIVEREF((PyObject *)__pyx_v_parser);
  __Pyx_GOTREF((PyObject *)__pyx_v_context->_default_parser);
  __Pyx_DECREF((PyObject *)__pyx_v_context->_default_parser);
  __pyx_v_context->_default_parser = __pyx_v_parser;

  /* "src/lxml/parser.pxi":91
 *         return context
 * 
 *     cdef int setDefaultParser(self, _BaseParser parser) except -1:             # <<<<<<<<<<<<<<
 *         "Set the default parser for the current thread"
 *         cdef _ParserDictionaryContext context
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ParserDictionaryContext.setDefaultParser", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":97
 *         context._default_parser = parser
 * 
 *     cdef _BaseParser getDefaultParser(self):             # <<<<<<<<<<<<<<
 *         "Return (or create) the default parser of the current thread"
 *         cdef _ParserDictionaryContext context
*/

static struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_f_4lxml_5etree_24_ParserDictionaryContext_getDefaultParser(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_context = 0;
  struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getDefaultParser", 0);

  /* "src/lxml/parser.pxi":100
 *         "Return (or create) the default parser of the current thread"
 *         cdef _ParserDictionaryContext context
 *         context = self._findThreadParserContext()             # <<<<<<<<<<<<<<
 *         if context._default_parser is None:
 *             if self._default_parser is None:
*/
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree_24_ParserDictionaryContext__findThreadParserContext(__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 100, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/parser.pxi":101
 *         cdef _ParserDictionaryContext context
 *         context = self._findThreadParserContext()
 *         if context._default_parser is None:             # <<<<<<<<<<<<<<
 *             if self._default_parser is None:
 *                 self._default_parser = __DEFAULT_XML_PARSER._copy()
*/
  __pyx_t_2 = (((PyObject *)__pyx_v_context->_default_parser) == Py_None);
  if (__pyx_t_2) {

    /* "src/lxml/parser.pxi":102
 *         context = self._findThreadParserContext()
 *         if context._default_parser is None:
 *             if self._default_parser is None:             # <<<<<<<<<<<<<<
 *                 self._default_parser = __DEFAULT_XML_PARSER._copy()
 *             if context is not self:
*/
    __pyx_t_2 = (((PyObject *)__pyx_v_self->_default_parser) == Py_None);
    if (__pyx_t_2) {

      /* "src/lxml/parser.pxi":103
 *         if context._default_parser is None:
 *             if self._default_parser is None:
 *                 self._default_parser = __DEFAULT_XML_PARSER._copy()             # <<<<<<<<<<<<<<
 *             if context is not self:
 *                 context._default_parser = self._default_parser._copy()
*/
      __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree_XMLParser *)__pyx_v_4lxml_5etree___DEFAULT_XML_PARSER->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._copy(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_4lxml_5etree___DEFAULT_XML_PARSER))); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 103, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __Pyx_GOTREF((PyObject *)__pyx_v_self->_default_parser);
      __Pyx_DECREF((PyObject *)__pyx_v_self->_default_parser);
      __pyx_v_self->_default_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_1);
      __pyx_t_1 = 0;

      /* "src/lxml/parser.pxi":102
 *         context = self._findThreadParserContext()
 *         if context._default_parser is None:
 *             if self._default_parser is None:             # <<<<<<<<<<<<<<
 *                 self._default_parser = __DEFAULT_XML_PARSER._copy()
 *             if context is not self:
*/
    }

    /* "src/lxml/parser.pxi":104
 *             if self._default_parser is None:
 *                 self._default_parser = __DEFAULT_XML_PARSER._copy()
 *             if context is not self:             # <<<<<<<<<<<<<<
 *                 context._default_parser = self._default_parser._copy()
 *         return context._default_parser
*/
    __pyx_t_2 = (__pyx_v_context != __pyx_v_self);
    if (__pyx_t_2) {

      /* "src/lxml/parser.pxi":105
 *                 self._default_parser = __DEFAULT_XML_PARSER._copy()
 *             if context is not self:
 *                 context._default_parser = self._default_parser._copy()             # <<<<<<<<<<<<<<
 *         return context._default_parser
 * 
*/
      __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)__pyx_v_self->_default_parser->__pyx_vtab)->_copy(__pyx_v_self->_default_parser)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 105, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __Pyx_GOTREF((PyObject *)__pyx_v_context->_default_parser);
      __Pyx_DECREF((PyObject *)__pyx_v_context->_default_parser);
      __pyx_v_context->_default_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_1);
      __pyx_t_1 = 0;

      /* "src/lxml/parser.pxi":104
 *             if self._default_parser is None:
 *                 self._default_parser = __DEFAULT_XML_PARSER._copy()
 *             if context is not self:             # <<<<<<<<<<<<<<
 *                 context._default_parser = self._default_parser._copy()
 *         return context._default_parser
*/
    }

    /* "src/lxml/parser.pxi":101
 *         cdef _ParserDictionaryContext context
 *         context = self._findThreadParserContext()
 *         if context._default_parser is None:             # <<<<<<<<<<<<<<
 *             if self._default_parser is None:
 *                 self._default_parser = __DEFAULT_XML_PARSER._copy()
*/
  }

  /* "src/lxml/parser.pxi":106
 *             if context is not self:
 *                 context._default_parser = self._default_parser._copy()
 *         return context._default_parser             # <<<<<<<<<<<<<<
 * 
 *     cdef tree.xmlDict* _getThreadDict(self, tree.xmlDict* default):
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_context->_default_parser);
  __pyx_r = __pyx_v_context->_default_parser;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":97
 *         context._default_parser = parser
 * 
 *     cdef _BaseParser getDefaultParser(self):             # <<<<<<<<<<<<<<
 *         "Return (or create) the default parser of the current thread"
 *         cdef _ParserDictionaryContext context
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ParserDictionaryContext.getDefaultParser", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":108
 *         return context._default_parser
 * 
 *     cdef tree.xmlDict* _getThreadDict(self, tree.xmlDict* default):             # <<<<<<<<<<<<<<
 *         "Return the thread-local dict or create a new one if necessary."
 *         cdef _ParserDictionaryContext context
*/

static xmlDict *__pyx_f_4lxml_5etree_24_ParserDictionaryContext__getThreadDict(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self, xmlDict *__pyx_v_default) {
  struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_context = 0;
  xmlDict *__pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_getThreadDict", 0);

  /* "src/lxml/parser.pxi":111
 *         "Return the thread-local dict or create a new one if necessary."
 *         cdef _ParserDictionaryContext context
 *         context = self._findThreadParserContext()             # <<<<<<<<<<<<<<
 *         if context._c_dict is NULL:
 *             # thread dict not yet set up => use default or create a new one
*/
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree_24_ParserDictionaryContext__findThreadParserContext(__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 111, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/parser.pxi":112
 *         cdef _ParserDictionaryContext context
 *         context = self._findThreadParserContext()
 *         if context._c_dict is NULL:             # <<<<<<<<<<<<<<
 *             # thread dict not yet set up => use default or create a new one
 *             if default is not NULL:
*/
  __pyx_t_2 = (__pyx_v_context->_c_dict == NULL);
  if (__pyx_t_2) {

    /* "src/lxml/parser.pxi":114
 *         if context._c_dict is NULL:
 *             # thread dict not yet set up => use default or create a new one
 *             if default is not NULL:             # <<<<<<<<<<<<<<
 *                 context._c_dict = default
 *                 xmlparser.xmlDictReference(default)
*/
    __pyx_t_2 = (__pyx_v_default != NULL);
    if (__pyx_t_2) {

      /* "src/lxml/parser.pxi":115
 *             # thread dict not yet set up => use default or create a new one
 *             if default is not NULL:
 *                 context._c_dict = default             # <<<<<<<<<<<<<<
 *                 xmlparser.xmlDictReference(default)
 *                 return default
*/
      __pyx_v_context->_c_dict = __pyx_v_default;

      /* "src/lxml/parser.pxi":116
 *             if default is not NULL:
 *                 context._c_dict = default
 *                 xmlparser.xmlDictReference(default)             # <<<<<<<<<<<<<<
 *                 return default
 *             if self._c_dict is NULL:
*/
      (void)(xmlDictReference(__pyx_v_default));

      /* "src/lxml/parser.pxi":117
 *                 context._c_dict = default
 *                 xmlparser.xmlDictReference(default)
 *                 return default             # <<<<<<<<<<<<<<
 *             if self._c_dict is NULL:
 *                 self._c_dict = xmlparser.xmlDictCreate()
*/
      __pyx_r = __pyx_v_default;
      goto __pyx_L0;

      /* "src/lxml/parser.pxi":114
 *         if context._c_dict is NULL:
 *             # thread dict not yet set up => use default or create a new one
 *             if default is not NULL:             # <<<<<<<<<<<<<<
 *                 context._c_dict = default
 *                 xmlparser.xmlDictReference(default)
*/
    }

    /* "src/lxml/parser.pxi":118
 *                 xmlparser.xmlDictReference(default)
 *                 return default
 *             if self._c_dict is NULL:             # <<<<<<<<<<<<<<
 *                 self._c_dict = xmlparser.xmlDictCreate()
 *             if context is not self:
*/
    __pyx_t_2 = (__pyx_v_self->_c_dict == NULL);
    if (__pyx_t_2) {

      /* "src/lxml/parser.pxi":119
 *                 return default
 *             if self._c_dict is NULL:
 *                 self._c_dict = xmlparser.xmlDictCreate()             # <<<<<<<<<<<<<<
 *             if context is not self:
 *                 context._c_dict = xmlparser.xmlDictCreateSub(self._c_dict)
*/
      __pyx_v_self->_c_dict = xmlDictCreate();

      /* "src/lxml/parser.pxi":118
 *                 xmlparser.xmlDictReference(default)
 *                 return default
 *             if self._c_dict is NULL:             # <<<<<<<<<<<<<<
 *                 self._c_dict = xmlparser.xmlDictCreate()
 *             if context is not self:
*/
    }

    /* "src/lxml/parser.pxi":120
 *             if self._c_dict is NULL:
 *                 self._c_dict = xmlparser.xmlDictCreate()
 *             if context is not self:             # <<<<<<<<<<<<<<
 *                 context._c_dict = xmlparser.xmlDictCreateSub(self._c_dict)
 *         return context._c_dict
*/
    __pyx_t_2 = (__pyx_v_context != __pyx_v_self);
    if (__pyx_t_2) {

      /* "src/lxml/parser.pxi":121
 *                 self._c_dict = xmlparser.xmlDictCreate()
 *             if context is not self:
 *                 context._c_dict = xmlparser.xmlDictCreateSub(self._c_dict)             # <<<<<<<<<<<<<<
 *         return context._c_dict
 * 
*/
      __pyx_v_context->_c_dict = xmlDictCreateSub(__pyx_v_self->_c_dict);

      /* "src/lxml/parser.pxi":120
 *             if self._c_dict is NULL:
 *                 self._c_dict = xmlparser.xmlDictCreate()
 *             if context is not self:             # <<<<<<<<<<<<<<
 *                 context._c_dict = xmlparser.xmlDictCreateSub(self._c_dict)
 *         return context._c_dict
*/
    }

    /* "src/lxml/parser.pxi":112
 *         cdef _ParserDictionaryContext context
 *         context = self._findThreadParserContext()
 *         if context._c_dict is NULL:             # <<<<<<<<<<<<<<
 *             # thread dict not yet set up => use default or create a new one
 *             if default is not NULL:
*/
  }

  /* "src/lxml/parser.pxi":122
 *             if context is not self:
 *                 context._c_dict = xmlparser.xmlDictCreateSub(self._c_dict)
 *         return context._c_dict             # <<<<<<<<<<<<<<
 * 
 *     cdef int initThreadDictRef(self, tree.xmlDict** c_dict_ref) except -1:
*/
  __pyx_r = __pyx_v_context->_c_dict;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":108
 *         return context._default_parser
 * 
 *     cdef tree.xmlDict* _getThreadDict(self, tree.xmlDict* default):             # <<<<<<<<<<<<<<
 *         "Return the thread-local dict or create a new one if necessary."
 *         cdef _ParserDictionaryContext context
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ParserDictionaryContext._getThreadDict", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":124
 *         return context._c_dict
 * 
 *     cdef int initThreadDictRef(self, tree.xmlDict** c_dict_ref) except -1:             # <<<<<<<<<<<<<<
 *         c_dict = c_dict_ref[0]
 *         c_thread_dict = self._getThreadDict(c_dict)
*/

static int __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initThreadDictRef(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self, xmlDict **__pyx_v_c_dict_ref) {
  xmlDict *__pyx_v_c_dict;
  xmlDict *__pyx_v_c_thread_dict;
  int __pyx_r;
  xmlDict *__pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/parser.pxi":125
 * 
 *     cdef int initThreadDictRef(self, tree.xmlDict** c_dict_ref) except -1:
 *         c_dict = c_dict_ref[0]             # <<<<<<<<<<<<<<
 *         c_thread_dict = self._getThreadDict(c_dict)
 *         if c_dict is c_thread_dict:
*/
  __pyx_v_c_dict = (__pyx_v_c_dict_ref[0]);

  /* "src/lxml/parser.pxi":126
 *     cdef int initThreadDictRef(self, tree.xmlDict** c_dict_ref) except -1:
 *         c_dict = c_dict_ref[0]
 *         c_thread_dict = self._getThreadDict(c_dict)             # <<<<<<<<<<<<<<
 *         if c_dict is c_thread_dict:
 *             return 0
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_24_ParserDictionaryContext__getThreadDict(__pyx_v_self, __pyx_v_c_dict); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 126, __pyx_L1_error)
  __pyx_v_c_thread_dict = __pyx_t_1;

  /* "src/lxml/parser.pxi":127
 *         c_dict = c_dict_ref[0]
 *         c_thread_dict = self._getThreadDict(c_dict)
 *         if c_dict is c_thread_dict:             # <<<<<<<<<<<<<<
 *             return 0
 *         if c_dict is not NULL:
*/
  __pyx_t_2 = (__pyx_v_c_dict == __pyx_v_c_thread_dict);
  if (__pyx_t_2) {

    /* "src/lxml/parser.pxi":128
 *         c_thread_dict = self._getThreadDict(c_dict)
 *         if c_dict is c_thread_dict:
 *             return 0             # <<<<<<<<<<<<<<
 *         if c_dict is not NULL:
 *             xmlparser.xmlDictFree(c_dict)
*/
    __pyx_r = 0;
    goto __pyx_L0;

    /* "src/lxml/parser.pxi":127
 *         c_dict = c_dict_ref[0]
 *         c_thread_dict = self._getThreadDict(c_dict)
 *         if c_dict is c_thread_dict:             # <<<<<<<<<<<<<<
 *             return 0
 *         if c_dict is not NULL:
*/
  }

  /* "src/lxml/parser.pxi":129
 *         if c_dict is c_thread_dict:
 *             return 0
 *         if c_dict is not NULL:             # <<<<<<<<<<<<<<
 *             xmlparser.xmlDictFree(c_dict)
 *         c_dict_ref[0] = c_thread_dict
*/
  __pyx_t_2 = (__pyx_v_c_dict != NULL);
  if (__pyx_t_2) {

    /* "src/lxml/parser.pxi":130
 *             return 0
 *         if c_dict is not NULL:
 *             xmlparser.xmlDictFree(c_dict)             # <<<<<<<<<<<<<<
 *         c_dict_ref[0] = c_thread_dict
 *         xmlparser.xmlDictReference(c_thread_dict)
*/
    xmlDictFree(__pyx_v_c_dict);

    /* "src/lxml/parser.pxi":129
 *         if c_dict is c_thread_dict:
 *             return 0
 *         if c_dict is not NULL:             # <<<<<<<<<<<<<<
 *             xmlparser.xmlDictFree(c_dict)
 *         c_dict_ref[0] = c_thread_dict
*/
  }

  /* "src/lxml/parser.pxi":131
 *         if c_dict is not NULL:
 *             xmlparser.xmlDictFree(c_dict)
 *         c_dict_ref[0] = c_thread_dict             # <<<<<<<<<<<<<<
 *         xmlparser.xmlDictReference(c_thread_dict)
 * 
*/
  (__pyx_v_c_dict_ref[0]) = __pyx_v_c_thread_dict;

  /* "src/lxml/parser.pxi":132
 *             xmlparser.xmlDictFree(c_dict)
 *         c_dict_ref[0] = c_thread_dict
 *         xmlparser.xmlDictReference(c_thread_dict)             # <<<<<<<<<<<<<<
 * 
 *     cdef int initParserDict(self, xmlparser.xmlParserCtxt* pctxt) except -1:
*/
  (void)(xmlDictReference(__pyx_v_c_thread_dict));

  /* "src/lxml/parser.pxi":124
 *         return context._c_dict
 * 
 *     cdef int initThreadDictRef(self, tree.xmlDict** c_dict_ref) except -1:             # <<<<<<<<<<<<<<
 *         c_dict = c_dict_ref[0]
 *         c_thread_dict = self._getThreadDict(c_dict)
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._ParserDictionaryContext.initThreadDictRef", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/parser.pxi":134
 *         xmlparser.xmlDictReference(c_thread_dict)
 * 
 *     cdef int initParserDict(self, xmlparser.xmlParserCtxt* pctxt) except -1:             # <<<<<<<<<<<<<<
 *         "Assure we always use the same string dictionary."
 *         self.initThreadDictRef(&pctxt.dict)
*/

static int __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initParserDict(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self, xmlParserCtxt *__pyx_v_pctxt) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/parser.pxi":136
 *     cdef int initParserDict(self, xmlparser.xmlParserCtxt* pctxt) except -1:
 *         "Assure we always use the same string dictionary."
 *         self.initThreadDictRef(&pctxt.dict)             # <<<<<<<<<<<<<<
 *         pctxt.dictNames = 1
 * 
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initThreadDictRef(__pyx_v_self, (&__pyx_v_pctxt->dict)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(2, 136, __pyx_L1_error)

  /* "src/lxml/parser.pxi":137
 *         "Assure we always use the same string dictionary."
 *         self.initThreadDictRef(&pctxt.dict)
 *         pctxt.dictNames = 1             # <<<<<<<<<<<<<<
 * 
 *     cdef int initXPathParserDict(self, xpath.xmlXPathContext* pctxt) except -1:
*/
  __pyx_v_pctxt->dictNames = 1;

  /* "src/lxml/parser.pxi":134
 *         xmlparser.xmlDictReference(c_thread_dict)
 * 
 *     cdef int initParserDict(self, xmlparser.xmlParserCtxt* pctxt) except -1:             # <<<<<<<<<<<<<<
 *         "Assure we always use the same string dictionary."
 *         self.initThreadDictRef(&pctxt.dict)
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._ParserDictionaryContext.initParserDict", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/parser.pxi":139
 *         pctxt.dictNames = 1
 * 
 *     cdef int initXPathParserDict(self, xpath.xmlXPathContext* pctxt) except -1:             # <<<<<<<<<<<<<<
 *         "Assure we always use the same string dictionary."
 *         self.initThreadDictRef(&pctxt.dict)
*/

static int __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initXPathParserDict(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self, xmlXPathContext *__pyx_v_pctxt) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/parser.pxi":141
 *     cdef int initXPathParserDict(self, xpath.xmlXPathContext* pctxt) except -1:
 *         "Assure we always use the same string dictionary."
 *         self.initThreadDictRef(&pctxt.dict)             # <<<<<<<<<<<<<<
 * 
 *     cdef int initDocDict(self, xmlDoc* result) except -1:
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initThreadDictRef(__pyx_v_self, (&__pyx_v_pctxt->dict)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(2, 141, __pyx_L1_error)

  /* "src/lxml/parser.pxi":139
 *         pctxt.dictNames = 1
 * 
 *     cdef int initXPathParserDict(self, xpath.xmlXPathContext* pctxt) except -1:             # <<<<<<<<<<<<<<
 *         "Assure we always use the same string dictionary."
 *         self.initThreadDictRef(&pctxt.dict)
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._ParserDictionaryContext.initXPathParserDict", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/parser.pxi":143
 *         self.initThreadDictRef(&pctxt.dict)
 * 
 *     cdef int initDocDict(self, xmlDoc* result) except -1:             # <<<<<<<<<<<<<<
 *         "Store dict of last object parsed if no shared dict yet"
 *         # XXX We also free the result dict here if there already was one.
*/

static int __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initDocDict(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self, xmlDoc *__pyx_v_result) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/parser.pxi":148
 *         # This case should only occur for new documents with empty dicts,
 *         # otherwise we'd free data that's in use => segfault
 *         self.initThreadDictRef(&result.dict)             # <<<<<<<<<<<<<<
 * 
 *     cdef _ParserContext findImpliedContext(self):
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initThreadDictRef(__pyx_v_self, (&__pyx_v_result->dict)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(2, 148, __pyx_L1_error)

  /* "src/lxml/parser.pxi":143
 *         self.initThreadDictRef(&pctxt.dict)
 * 
 *     cdef int initDocDict(self, xmlDoc* result) except -1:             # <<<<<<<<<<<<<<
 *         "Store dict of last object parsed if no shared dict yet"
 *         # XXX We also free the result dict here if there already was one.
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._ParserDictionaryContext.initDocDict", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/parser.pxi":150
 *         self.initThreadDictRef(&result.dict)
 * 
 *     cdef _ParserContext findImpliedContext(self):             # <<<<<<<<<<<<<<
 *         """Return any current implied xml parser context for the current
 *         thread.  This is used when the resolver functions are called
*/

static struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_f_4lxml_5etree_24_ParserDictionaryContext_findImpliedContext(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_context = 0;
  struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_implied_context = 0;
  struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("findImpliedContext", 0);

  /* "src/lxml/parser.pxi":160
 * 
 *         # see if we have a current implied parser
 *         context = self._findThreadParserContext()             # <<<<<<<<<<<<<<
 *         if context._implied_parser_contexts:
 *             implied_context = context._implied_parser_contexts[-1]
*/
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree_24_ParserDictionaryContext__findThreadParserContext(__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 160, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/parser.pxi":161
 *         # see if we have a current implied parser
 *         context = self._findThreadParserContext()
 *         if context._implied_parser_contexts:             # <<<<<<<<<<<<<<
 *             implied_context = context._implied_parser_contexts[-1]
 *             return implied_context
*/
  if (__pyx_v_context->_implied_parser_contexts == Py_None) __pyx_t_2 = 0;
  else
  {
    Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_v_context->_implied_parser_contexts);
    if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(2, 161, __pyx_L1_error)
    __pyx_t_2 = (__pyx_temp != 0);
  }

  if (__pyx_t_2) {

    /* "src/lxml/parser.pxi":162
 *         context = self._findThreadParserContext()
 *         if context._implied_parser_contexts:
 *             implied_context = context._implied_parser_contexts[-1]             # <<<<<<<<<<<<<<
 *             return implied_context
 *         return None
*/
    if (unlikely(__pyx_v_context->_implied_parser_contexts == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(2, 162, __pyx_L1_error)
    }
    __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_context->_implied_parser_contexts, -1L, long, 1, __Pyx_PyLong_From_long, 1, 1, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 162, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ParserContext))))) __PYX_ERR(2, 162, __pyx_L1_error)
    __pyx_v_implied_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/parser.pxi":163
 *         if context._implied_parser_contexts:
 *             implied_context = context._implied_parser_contexts[-1]
 *             return implied_context             # <<<<<<<<<<<<<<
 *         return None
 * 
*/
    __Pyx_XDECREF((PyObject *)__pyx_r);
    __Pyx_INCREF((PyObject *)__pyx_v_implied_context);
    __pyx_r = __pyx_v_implied_context;
    goto __pyx_L0;

    /* "src/lxml/parser.pxi":161
 *         # see if we have a current implied parser
 *         context = self._findThreadParserContext()
 *         if context._implied_parser_contexts:             # <<<<<<<<<<<<<<
 *             implied_context = context._implied_parser_contexts[-1]
 *             return implied_context
*/
  }

  /* "src/lxml/parser.pxi":164
 *             implied_context = context._implied_parser_contexts[-1]
 *             return implied_context
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     cdef int pushImpliedContextFromParser(self, _BaseParser parser) except -1:
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __pyx_r = ((struct __pyx_obj_4lxml_5etree__ParserContext *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":150
 *         self.initThreadDictRef(&result.dict)
 * 
 *     cdef _ParserContext findImpliedContext(self):             # <<<<<<<<<<<<<<
 *         """Return any current implied xml parser context for the current
 *         thread.  This is used when the resolver functions are called
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ParserDictionaryContext.findImpliedContext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_XDECREF((PyObject *)__pyx_v_implied_context);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":166
 *         return None
 * 
 *     cdef int pushImpliedContextFromParser(self, _BaseParser parser) except -1:             # <<<<<<<<<<<<<<
 *         "Push a new implied context object taken from the parser."
 *         if parser is not None:
*/

static int __pyx_f_4lxml_5etree_24_ParserDictionaryContext_pushImpliedContextFromParser(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("pushImpliedContextFromParser", 0);

  /* "src/lxml/parser.pxi":168
 *     cdef int pushImpliedContextFromParser(self, _BaseParser parser) except -1:
 *         "Push a new implied context object taken from the parser."
 *         if parser is not None:             # <<<<<<<<<<<<<<
 *             self.pushImpliedContext(parser._getParserContext())
 *         else:
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_parser) != Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":169
 *         "Push a new implied context object taken from the parser."
 *         if parser is not None:
 *             self.pushImpliedContext(parser._getParserContext())             # <<<<<<<<<<<<<<
 *         else:
 *             self.pushImpliedContext(None)
*/
    __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)__pyx_v_parser->__pyx_vtab)->_getParserContext(__pyx_v_parser)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 169, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __pyx_f_4lxml_5etree_24_ParserDictionaryContext_pushImpliedContext(__pyx_v_self, ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_2)); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 169, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/parser.pxi":168
 *     cdef int pushImpliedContextFromParser(self, _BaseParser parser) except -1:
 *         "Push a new implied context object taken from the parser."
 *         if parser is not None:             # <<<<<<<<<<<<<<
 *             self.pushImpliedContext(parser._getParserContext())
 *         else:
*/
    goto __pyx_L3;
  }

  /* "src/lxml/parser.pxi":171
 *             self.pushImpliedContext(parser._getParserContext())
 *         else:
 *             self.pushImpliedContext(None)             # <<<<<<<<<<<<<<
 * 
 *     cdef int pushImpliedContext(self, _ParserContext parser_context) except -1:
*/
  /*else*/ {
    __pyx_t_3 = __pyx_f_4lxml_5etree_24_ParserDictionaryContext_pushImpliedContext(__pyx_v_self, ((struct __pyx_obj_4lxml_5etree__ParserContext *)Py_None)); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 171, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "src/lxml/parser.pxi":166
 *         return None
 * 
 *     cdef int pushImpliedContextFromParser(self, _BaseParser parser) except -1:             # <<<<<<<<<<<<<<
 *         "Push a new implied context object taken from the parser."
 *         if parser is not None:
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ParserDictionaryContext.pushImpliedContextFromParser", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":173
 *             self.pushImpliedContext(None)
 * 
 *     cdef int pushImpliedContext(self, _ParserContext parser_context) except -1:             # <<<<<<<<<<<<<<
 *         "Push a new implied context object."
 *         cdef _ParserDictionaryContext context
*/

static int __pyx_f_4lxml_5etree_24_ParserDictionaryContext_pushImpliedContext(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self, struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_parser_context) {
  struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_context = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("pushImpliedContext", 0);

  /* "src/lxml/parser.pxi":176
 *         "Push a new implied context object."
 *         cdef _ParserDictionaryContext context
 *         context = self._findThreadParserContext()             # <<<<<<<<<<<<<<
 *         context._implied_parser_contexts.append(parser_context)
 * 
*/
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree_24_ParserDictionaryContext__findThreadParserContext(__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 176, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/parser.pxi":177
 *         cdef _ParserDictionaryContext context
 *         context = self._findThreadParserContext()
 *         context._implied_parser_contexts.append(parser_context)             # <<<<<<<<<<<<<<
 * 
 *     cdef int popImpliedContext(self) except -1:
*/
  if (unlikely(__pyx_v_context->_implied_parser_contexts == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
    __PYX_ERR(2, 177, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyList_Append(__pyx_v_context->_implied_parser_contexts, ((PyObject *)__pyx_v_parser_context)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(2, 177, __pyx_L1_error)

  /* "src/lxml/parser.pxi":173
 *             self.pushImpliedContext(None)
 * 
 *     cdef int pushImpliedContext(self, _ParserContext parser_context) except -1:             # <<<<<<<<<<<<<<
 *         "Push a new implied context object."
 *         cdef _ParserDictionaryContext context
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ParserDictionaryContext.pushImpliedContext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":179
 *         context._implied_parser_contexts.append(parser_context)
 * 
 *     cdef int popImpliedContext(self) except -1:             # <<<<<<<<<<<<<<
 *         "Pop the current implied context object."
 *         cdef _ParserDictionaryContext context
*/

static int __pyx_f_4lxml_5etree_24_ParserDictionaryContext_popImpliedContext(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_context = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("popImpliedContext", 0);

  /* "src/lxml/parser.pxi":182
 *         "Pop the current implied context object."
 *         cdef _ParserDictionaryContext context
 *         context = self._findThreadParserContext()             # <<<<<<<<<<<<<<
 *         context._implied_parser_contexts.pop()
 * 
*/
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree_24_ParserDictionaryContext__findThreadParserContext(__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/parser.pxi":183
 *         cdef _ParserDictionaryContext context
 *         context = self._findThreadParserContext()
 *         context._implied_parser_contexts.pop()             # <<<<<<<<<<<<<<
 * 
 * cdef _ParserDictionaryContext __GLOBAL_PARSER_CONTEXT = _ParserDictionaryContext()
*/
  if (unlikely(__pyx_v_context->_implied_parser_contexts == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "pop");
    __PYX_ERR(2, 183, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyList_Pop(__pyx_v_context->_implied_parser_contexts); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 183, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/parser.pxi":179
 *         context._implied_parser_contexts.append(parser_context)
 * 
 *     cdef int popImpliedContext(self) except -1:             # <<<<<<<<<<<<<<
 *         "Pop the current implied context object."
 *         cdef _ParserDictionaryContext context
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ParserDictionaryContext.popImpliedContext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":195
 * cdef const_char* _PY_UNICODE_ENCODING = NULL
 * 
 * cdef int _setupPythonUnicode() except -1:             # <<<<<<<<<<<<<<
 *     """Sets _PY_UNICODE_ENCODING to the internal encoding name of Python unicode
 *     strings if libxml2 supports reading native Python unicode.  This depends
*/

static int __pyx_f_4lxml_5etree__setupPythonUnicode(void) {
  xmlCharEncodingHandler *__pyx_v_enchandler;
  const char *__pyx_v_enc;
  Py_UNICODE *__pyx_v_uchars;
  const xmlChar *__pyx_v_buffer;
  int __pyx_r;
  Py_UNICODE __pyx_t_1[7];
  int __pyx_t_2;
  int __pyx_t_3;

  /* "src/lxml/parser.pxi":204
 *     cdef Py_ssize_t l
 *     cdef const_char* enc
 *     cdef Py_UNICODE *uchars = [c'<', c't', c'e', c's', c't', c'/', c'>']             # <<<<<<<<<<<<<<
 *     cdef const_xmlChar* buffer = <const_xmlChar*>uchars
 *     # apparently, libxml2 can't detect UTF-16 on some systems
*/
  __pyx_t_1[0] = '<';
  __pyx_t_1[1] = 't';
  __pyx_t_1[2] = 'e';
  __pyx_t_1[3] = 's';
  __pyx_t_1[4] = 't';
  __pyx_t_1[5] = '/';
  __pyx_t_1[6] = '>';
  __pyx_v_uchars = __pyx_t_1;

  /* "src/lxml/parser.pxi":205
 *     cdef const_char* enc
 *     cdef Py_UNICODE *uchars = [c'<', c't', c'e', c's', c't', c'/', c'>']
 *     cdef const_xmlChar* buffer = <const_xmlChar*>uchars             # <<<<<<<<<<<<<<
 *     # apparently, libxml2 can't detect UTF-16 on some systems
 *     if (buffer[0] == c'<' and buffer[1] == c'\0' and
*/
  __pyx_v_buffer = ((const xmlChar *)__pyx_v_uchars);

  /* "src/lxml/parser.pxi":207
 *     cdef const_xmlChar* buffer = <const_xmlChar*>uchars
 *     # apparently, libxml2 can't detect UTF-16 on some systems
 *     if (buffer[0] == c'<' and buffer[1] == c'\0' and             # <<<<<<<<<<<<<<
 *             buffer[2] == c't' and buffer[3] == c'\0'):
 *         enc = "UTF-16LE"
*/
  __pyx_t_3 = ((__pyx_v_buffer[0]) == '<');
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = ((__pyx_v_buffer[1]) == '\x00');
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }

  /* "src/lxml/parser.pxi":208
 *     # apparently, libxml2 can't detect UTF-16 on some systems
 *     if (buffer[0] == c'<' and buffer[1] == c'\0' and
 *             buffer[2] == c't' and buffer[3] == c'\0'):             # <<<<<<<<<<<<<<
 *         enc = "UTF-16LE"
 *     elif (buffer[0] == c'\0' and buffer[1] == c'<' and
*/
  __pyx_t_3 = ((__pyx_v_buffer[2]) == 't');
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = ((__pyx_v_buffer[3]) == '\x00');
  __pyx_t_2 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;

  /* "src/lxml/parser.pxi":207
 *     cdef const_xmlChar* buffer = <const_xmlChar*>uchars
 *     # apparently, libxml2 can't detect UTF-16 on some systems
 *     if (buffer[0] == c'<' and buffer[1] == c'\0' and             # <<<<<<<<<<<<<<
 *             buffer[2] == c't' and buffer[3] == c'\0'):
 *         enc = "UTF-16LE"
*/
  if (__pyx_t_2) {

    /* "src/lxml/parser.pxi":209
 *     if (buffer[0] == c'<' and buffer[1] == c'\0' and
 *             buffer[2] == c't' and buffer[3] == c'\0'):
 *         enc = "UTF-16LE"             # <<<<<<<<<<<<<<
 *     elif (buffer[0] == c'\0' and buffer[1] == c'<' and
 *             buffer[2] == c'\0' and buffer[3] == c't'):
*/
    __pyx_v_enc = __pyx_k_UTF_16LE;

    /* "src/lxml/parser.pxi":207
 *     cdef const_xmlChar* buffer = <const_xmlChar*>uchars
 *     # apparently, libxml2 can't detect UTF-16 on some systems
 *     if (buffer[0] == c'<' and buffer[1] == c'\0' and             # <<<<<<<<<<<<<<
 *             buffer[2] == c't' and buffer[3] == c'\0'):
 *         enc = "UTF-16LE"
*/
    goto __pyx_L3;
  }

  /* "src/lxml/parser.pxi":210
 *             buffer[2] == c't' and buffer[3] == c'\0'):
 *         enc = "UTF-16LE"
 *     elif (buffer[0] == c'\0' and buffer[1] == c'<' and             # <<<<<<<<<<<<<<
 *             buffer[2] == c'\0' and buffer[3] == c't'):
 *         enc = "UTF-16BE"
*/
  __pyx_t_3 = ((__pyx_v_buffer[0]) == '\x00');
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L8_bool_binop_done;
  }
  __pyx_t_3 = ((__pyx_v_buffer[1]) == '<');
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L8_bool_binop_done;
  }

  /* "src/lxml/parser.pxi":211
 *         enc = "UTF-16LE"
 *     elif (buffer[0] == c'\0' and buffer[1] == c'<' and
 *             buffer[2] == c'\0' and buffer[3] == c't'):             # <<<<<<<<<<<<<<
 *         enc = "UTF-16BE"
 *     else:
*/
  __pyx_t_3 = ((__pyx_v_buffer[2]) == '\x00');
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L8_bool_binop_done;
  }
  __pyx_t_3 = ((__pyx_v_buffer[3]) == 't');
  __pyx_t_2 = __pyx_t_3;
  __pyx_L8_bool_binop_done:;

  /* "src/lxml/parser.pxi":210
 *             buffer[2] == c't' and buffer[3] == c'\0'):
 *         enc = "UTF-16LE"
 *     elif (buffer[0] == c'\0' and buffer[1] == c'<' and             # <<<<<<<<<<<<<<
 *             buffer[2] == c'\0' and buffer[3] == c't'):
 *         enc = "UTF-16BE"
*/
  if (__pyx_t_2) {

    /* "src/lxml/parser.pxi":212
 *     elif (buffer[0] == c'\0' and buffer[1] == c'<' and
 *             buffer[2] == c'\0' and buffer[3] == c't'):
 *         enc = "UTF-16BE"             # <<<<<<<<<<<<<<
 *     else:
 *         # let libxml2 give it a try
*/
    __pyx_v_enc = __pyx_k_UTF_16BE;

    /* "src/lxml/parser.pxi":210
 *             buffer[2] == c't' and buffer[3] == c'\0'):
 *         enc = "UTF-16LE"
 *     elif (buffer[0] == c'\0' and buffer[1] == c'<' and             # <<<<<<<<<<<<<<
 *             buffer[2] == c'\0' and buffer[3] == c't'):
 *         enc = "UTF-16BE"
*/
    goto __pyx_L3;
  }

  /* "src/lxml/parser.pxi":215
 *     else:
 *         # let libxml2 give it a try
 *         enc = _findEncodingName(buffer, sizeof(Py_UNICODE) * 7)             # <<<<<<<<<<<<<<
 *         if enc is NULL:
 *             # not my fault, it's YOUR broken system :)
*/
  /*else*/ {
    __pyx_v_enc = __pyx_f_4lxml_5etree__findEncodingName(__pyx_v_buffer, ((sizeof(Py_UNICODE)) * 7));

    /* "src/lxml/parser.pxi":216
 *         # let libxml2 give it a try
 *         enc = _findEncodingName(buffer, sizeof(Py_UNICODE) * 7)
 *         if enc is NULL:             # <<<<<<<<<<<<<<
 *             # not my fault, it's YOUR broken system :)
 *             return 0
*/
    __pyx_t_2 = (__pyx_v_enc == NULL);
    if (__pyx_t_2) {

      /* "src/lxml/parser.pxi":218
 *         if enc is NULL:
 *             # not my fault, it's YOUR broken system :)
 *             return 0             # <<<<<<<<<<<<<<
 *     enchandler = tree.xmlFindCharEncodingHandler(enc)
 *     if enchandler is not NULL:
*/
      __pyx_r = 0;
      goto __pyx_L0;

      /* "src/lxml/parser.pxi":216
 *         # let libxml2 give it a try
 *         enc = _findEncodingName(buffer, sizeof(Py_UNICODE) * 7)
 *         if enc is NULL:             # <<<<<<<<<<<<<<
 *             # not my fault, it's YOUR broken system :)
 *             return 0
*/
    }
  }
  __pyx_L3:;

  /* "src/lxml/parser.pxi":219
 *             # not my fault, it's YOUR broken system :)
 *             return 0
 *     enchandler = tree.xmlFindCharEncodingHandler(enc)             # <<<<<<<<<<<<<<
 *     if enchandler is not NULL:
 *         global _PY_UNICODE_ENCODING
*/
  __pyx_v_enchandler = xmlFindCharEncodingHandler(__pyx_v_enc);

  /* "src/lxml/parser.pxi":220
 *             return 0
 *     enchandler = tree.xmlFindCharEncodingHandler(enc)
 *     if enchandler is not NULL:             # <<<<<<<<<<<<<<
 *         global _PY_UNICODE_ENCODING
 *         tree.xmlCharEncCloseFunc(enchandler)
*/
  __pyx_t_2 = (__pyx_v_enchandler != NULL);
  if (__pyx_t_2) {

    /* "src/lxml/parser.pxi":222
 *     if enchandler is not NULL:
 *         global _PY_UNICODE_ENCODING
 *         tree.xmlCharEncCloseFunc(enchandler)             # <<<<<<<<<<<<<<
 *         _PY_UNICODE_ENCODING = enc
 *     return 0
*/
    (void)(xmlCharEncCloseFunc(__pyx_v_enchandler));

    /* "src/lxml/parser.pxi":223
 *         global _PY_UNICODE_ENCODING
 *         tree.xmlCharEncCloseFunc(enchandler)
 *         _PY_UNICODE_ENCODING = enc             # <<<<<<<<<<<<<<
 *     return 0
 * 
*/
    __pyx_v_4lxml_5etree__PY_UNICODE_ENCODING = __pyx_v_enc;

    /* "src/lxml/parser.pxi":220
 *             return 0
 *     enchandler = tree.xmlFindCharEncodingHandler(enc)
 *     if enchandler is not NULL:             # <<<<<<<<<<<<<<
 *         global _PY_UNICODE_ENCODING
 *         tree.xmlCharEncCloseFunc(enchandler)
*/
  }

  /* "src/lxml/parser.pxi":224
 *         tree.xmlCharEncCloseFunc(enchandler)
 *         _PY_UNICODE_ENCODING = enc
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef const_char* _findEncodingName(const_xmlChar* buffer, int size) noexcept:
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":195
 * cdef const_char* _PY_UNICODE_ENCODING = NULL
 * 
 * cdef int _setupPythonUnicode() except -1:             # <<<<<<<<<<<<<<
 *     """Sets _PY_UNICODE_ENCODING to the internal encoding name of Python unicode
 *     strings if libxml2 supports reading native Python unicode.  This depends
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/parser.pxi":226
 *     return 0
 * 
 * cdef const_char* _findEncodingName(const_xmlChar* buffer, int size) noexcept:             # <<<<<<<<<<<<<<
 *     "Work around bug in libxml2: find iconv name of encoding on our own."
 *     cdef tree.xmlCharEncoding enc
*/

static const char *__pyx_f_4lxml_5etree__findEncodingName(const xmlChar *__pyx_v_buffer, int __pyx_v_size) {
  xmlCharEncoding __pyx_v_enc;
  const char *__pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;

  /* "src/lxml/parser.pxi":229
 *     "Work around bug in libxml2: find iconv name of encoding on our own."
 *     cdef tree.xmlCharEncoding enc
 *     enc = tree.xmlDetectCharEncoding(buffer, size)             # <<<<<<<<<<<<<<
 *     if enc == tree.XML_CHAR_ENCODING_UTF16LE:
 *         if size >= 4 and (buffer[0] == <const_xmlChar> b'\xFF' and
*/
  __pyx_v_enc = xmlDetectCharEncoding(__pyx_v_buffer, __pyx_v_size);

  /* "src/lxml/parser.pxi":230
 *     cdef tree.xmlCharEncoding enc
 *     enc = tree.xmlDetectCharEncoding(buffer, size)
 *     if enc == tree.XML_CHAR_ENCODING_UTF16LE:             # <<<<<<<<<<<<<<
 *         if size >= 4 and (buffer[0] == <const_xmlChar> b'\xFF' and
 *                           buffer[1] == <const_xmlChar> b'\xFE' and
*/
  switch (__pyx_v_enc) {
    case XML_CHAR_ENCODING_UTF16LE:

    /* "src/lxml/parser.pxi":231
 *     enc = tree.xmlDetectCharEncoding(buffer, size)
 *     if enc == tree.XML_CHAR_ENCODING_UTF16LE:
 *         if size >= 4 and (buffer[0] == <const_xmlChar> b'\xFF' and             # <<<<<<<<<<<<<<
 *                           buffer[1] == <const_xmlChar> b'\xFE' and
 *                           buffer[2] == 0 and buffer[3] == 0):
*/
    __pyx_t_2 = (__pyx_v_size >= 4);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_2 = ((__pyx_v_buffer[0]) == ((const xmlChar)'\xFF'));
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L4_bool_binop_done;
    }

    /* "src/lxml/parser.pxi":232
 *     if enc == tree.XML_CHAR_ENCODING_UTF16LE:
 *         if size >= 4 and (buffer[0] == <const_xmlChar> b'\xFF' and
 *                           buffer[1] == <const_xmlChar> b'\xFE' and             # <<<<<<<<<<<<<<
 *                           buffer[2] == 0 and buffer[3] == 0):
 *             return "UTF-32LE"  # according to BOM
*/
    __pyx_t_2 = ((__pyx_v_buffer[1]) == ((const xmlChar)'\xFE'));
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L4_bool_binop_done;
    }

    /* "src/lxml/parser.pxi":233
 *         if size >= 4 and (buffer[0] == <const_xmlChar> b'\xFF' and
 *                           buffer[1] == <const_xmlChar> b'\xFE' and
 *                           buffer[2] == 0 and buffer[3] == 0):             # <<<<<<<<<<<<<<
 *             return "UTF-32LE"  # according to BOM
 *         else:
*/
    __pyx_t_2 = ((__pyx_v_buffer[2]) == 0);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_2 = ((__pyx_v_buffer[3]) == 0);
    __pyx_t_1 = __pyx_t_2;
    __pyx_L4_bool_binop_done:;

    /* "src/lxml/parser.pxi":231
 *     enc = tree.xmlDetectCharEncoding(buffer, size)
 *     if enc == tree.XML_CHAR_ENCODING_UTF16LE:
 *         if size >= 4 and (buffer[0] == <const_xmlChar> b'\xFF' and             # <<<<<<<<<<<<<<
 *                           buffer[1] == <const_xmlChar> b'\xFE' and
 *                           buffer[2] == 0 and buffer[3] == 0):
*/
    if (__pyx_t_1) {

      /* "src/lxml/parser.pxi":234
 *                           buffer[1] == <const_xmlChar> b'\xFE' and
 *                           buffer[2] == 0 and buffer[3] == 0):
 *             return "UTF-32LE"  # according to BOM             # <<<<<<<<<<<<<<
 *         else:
 *             return "UTF-16LE"
*/
      __pyx_r = __pyx_k_UTF_32LE;
      goto __pyx_L0;

      /* "src/lxml/parser.pxi":231
 *     enc = tree.xmlDetectCharEncoding(buffer, size)
 *     if enc == tree.XML_CHAR_ENCODING_UTF16LE:
 *         if size >= 4 and (buffer[0] == <const_xmlChar> b'\xFF' and             # <<<<<<<<<<<<<<
 *                           buffer[1] == <const_xmlChar> b'\xFE' and
 *                           buffer[2] == 0 and buffer[3] == 0):
*/
    }

    /* "src/lxml/parser.pxi":236
 *             return "UTF-32LE"  # according to BOM
 *         else:
 *             return "UTF-16LE"             # <<<<<<<<<<<<<<
 *     elif enc == tree.XML_CHAR_ENCODING_UTF16BE:
 *         return "UTF-16BE"
*/
    /*else*/ {
      __pyx_r = __pyx_k_UTF_16LE;
      goto __pyx_L0;
    }

    /* "src/lxml/parser.pxi":230
 *     cdef tree.xmlCharEncoding enc
 *     enc = tree.xmlDetectCharEncoding(buffer, size)
 *     if enc == tree.XML_CHAR_ENCODING_UTF16LE:             # <<<<<<<<<<<<<<
 *         if size >= 4 and (buffer[0] == <const_xmlChar> b'\xFF' and
 *                           buffer[1] == <const_xmlChar> b'\xFE' and
*/
    break;
    case XML_CHAR_ENCODING_UTF16BE:

    /* "src/lxml/parser.pxi":238
 *             return "UTF-16LE"
 *     elif enc == tree.XML_CHAR_ENCODING_UTF16BE:
 *         return "UTF-16BE"             # <<<<<<<<<<<<<<
 *     elif enc == tree.XML_CHAR_ENCODING_UCS4LE:
 *         return "UCS-4LE"
*/
    __pyx_r = __pyx_k_UTF_16BE;
    goto __pyx_L0;

    /* "src/lxml/parser.pxi":237
 *         else:
 *             return "UTF-16LE"
 *     elif enc == tree.XML_CHAR_ENCODING_UTF16BE:             # <<<<<<<<<<<<<<
 *         return "UTF-16BE"
 *     elif enc == tree.XML_CHAR_ENCODING_UCS4LE:
*/
    break;
    case XML_CHAR_ENCODING_UCS4LE:

    /* "src/lxml/parser.pxi":240
 *         return "UTF-16BE"
 *     elif enc == tree.XML_CHAR_ENCODING_UCS4LE:
 *         return "UCS-4LE"             # <<<<<<<<<<<<<<
 *     elif enc == tree.XML_CHAR_ENCODING_UCS4BE:
 *         return "UCS-4BE"
*/
    __pyx_r = __pyx_k_UCS_4LE;
    goto __pyx_L0;

    /* "src/lxml/parser.pxi":239
 *     elif enc == tree.XML_CHAR_ENCODING_UTF16BE:
 *         return "UTF-16BE"
 *     elif enc == tree.XML_CHAR_ENCODING_UCS4LE:             # <<<<<<<<<<<<<<
 *         return "UCS-4LE"
 *     elif enc == tree.XML_CHAR_ENCODING_UCS4BE:
*/
    break;
    case XML_CHAR_ENCODING_UCS4BE:

    /* "src/lxml/parser.pxi":242
 *         return "UCS-4LE"
 *     elif enc == tree.XML_CHAR_ENCODING_UCS4BE:
 *         return "UCS-4BE"             # <<<<<<<<<<<<<<
 *     elif enc == tree.XML_CHAR_ENCODING_NONE:
 *         return NULL
*/
    __pyx_r = __pyx_k_UCS_4BE;
    goto __pyx_L0;

    /* "src/lxml/parser.pxi":241
 *     elif enc == tree.XML_CHAR_ENCODING_UCS4LE:
 *         return "UCS-4LE"
 *     elif enc == tree.XML_CHAR_ENCODING_UCS4BE:             # <<<<<<<<<<<<<<
 *         return "UCS-4BE"
 *     elif enc == tree.XML_CHAR_ENCODING_NONE:
*/
    break;
    case XML_CHAR_ENCODING_NONE:

    /* "src/lxml/parser.pxi":244
 *         return "UCS-4BE"
 *     elif enc == tree.XML_CHAR_ENCODING_NONE:
 *         return NULL             # <<<<<<<<<<<<<<
 *     else:
 *         # returns a constant char*, no need to free it
*/
    __pyx_r = NULL;
    goto __pyx_L0;

    /* "src/lxml/parser.pxi":243
 *     elif enc == tree.XML_CHAR_ENCODING_UCS4BE:
 *         return "UCS-4BE"
 *     elif enc == tree.XML_CHAR_ENCODING_NONE:             # <<<<<<<<<<<<<<
 *         return NULL
 *     else:
*/
    break;
    default:

    /* "src/lxml/parser.pxi":247
 *     else:
 *         # returns a constant char*, no need to free it
 *         return tree.xmlGetCharEncodingName(enc)             # <<<<<<<<<<<<<<
 * 
 * # Python 3.12 removed support for "Py_UNICODE".
*/
    __pyx_r = xmlGetCharEncodingName(__pyx_v_enc);
    goto __pyx_L0;
    break;
  }

  /* "src/lxml/parser.pxi":226
 *     return 0
 * 
 * cdef const_char* _findEncodingName(const_xmlChar* buffer, int size) noexcept:             # <<<<<<<<<<<<<<
 *     "Work around bug in libxml2: find iconv name of encoding on our own."
 *     cdef tree.xmlCharEncoding enc
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/parser.pxi":254
 * 
 * 
 * cdef unicode _find_PyUCS4EncodingName():             # <<<<<<<<<<<<<<
 *     """
 *     Find a suitable encoding for Py_UCS4 PyUnicode strings in libxml2.
*/

static PyObject *__pyx_f_4lxml_5etree__find_PyUCS4EncodingName(void) {
  PyObject *__pyx_v_ustring = NULL;
  xmlChar const *__pyx_v_buffer;
  Py_ssize_t __pyx_v_py_buffer_len;
  PyObject *__pyx_v_encoding_name = NULL;
  xmlCharEncoding __pyx_v_enc;
  xmlCharEncodingHandler *__pyx_v_enchandler;
  const char *__pyx_v_c_name;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  char *__pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  char const *__pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_t_14;
  PyObject *__pyx_t_15 = NULL;
  size_t __pyx_t_16;
  int __pyx_t_17;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_find_PyUCS4EncodingName", 0);

  /* "src/lxml/parser.pxi":258
 *     Find a suitable encoding for Py_UCS4 PyUnicode strings in libxml2.
 *     """
 *     ustring = "<xml>\U0001F92A</xml>"             # <<<<<<<<<<<<<<
 *     cdef const xmlChar* buffer = <const xmlChar*> python.PyUnicode_DATA(ustring)
 *     cdef Py_ssize_t py_buffer_len = python.PyUnicode_GET_LENGTH(ustring)
*/
  __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_xml_xml);
  __pyx_v_ustring = __pyx_mstate_global->__pyx_kp_u_xml_xml;

  /* "src/lxml/parser.pxi":259
 *     """
 *     ustring = "<xml>\U0001F92A</xml>"
 *     cdef const xmlChar* buffer = <const xmlChar*> python.PyUnicode_DATA(ustring)             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t py_buffer_len = python.PyUnicode_GET_LENGTH(ustring)
 * 
*/
  __pyx_v_buffer = ((xmlChar const *)PyUnicode_DATA(__pyx_v_ustring));

  /* "src/lxml/parser.pxi":260
 *     ustring = "<xml>\U0001F92A</xml>"
 *     cdef const xmlChar* buffer = <const xmlChar*> python.PyUnicode_DATA(ustring)
 *     cdef Py_ssize_t py_buffer_len = python.PyUnicode_GET_LENGTH(ustring)             # <<<<<<<<<<<<<<
 * 
 *     encoding_name = ''
*/
  __pyx_v_py_buffer_len = PyUnicode_GET_LENGTH(__pyx_v_ustring);

  /* "src/lxml/parser.pxi":262
 *     cdef Py_ssize_t py_buffer_len = python.PyUnicode_GET_LENGTH(ustring)
 * 
 *     encoding_name = ''             # <<<<<<<<<<<<<<
 *     cdef tree.xmlCharEncoding enc = tree.xmlDetectCharEncoding(buffer, py_buffer_len)
 *     enchandler = tree.xmlGetCharEncodingHandler(enc)
*/
  __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u__8);
  __pyx_v_encoding_name = __pyx_mstate_global->__pyx_kp_u__8;

  /* "src/lxml/parser.pxi":263
 * 
 *     encoding_name = ''
 *     cdef tree.xmlCharEncoding enc = tree.xmlDetectCharEncoding(buffer, py_buffer_len)             # <<<<<<<<<<<<<<
 *     enchandler = tree.xmlGetCharEncodingHandler(enc)
 *     if enchandler is not NULL:
*/
  __pyx_v_enc = xmlDetectCharEncoding(__pyx_v_buffer, __pyx_v_py_buffer_len);

  /* "src/lxml/parser.pxi":264
 *     encoding_name = ''
 *     cdef tree.xmlCharEncoding enc = tree.xmlDetectCharEncoding(buffer, py_buffer_len)
 *     enchandler = tree.xmlGetCharEncodingHandler(enc)             # <<<<<<<<<<<<<<
 *     if enchandler is not NULL:
 *         try:
*/
  __pyx_v_enchandler = xmlGetCharEncodingHandler(__pyx_v_enc);

  /* "src/lxml/parser.pxi":265
 *     cdef tree.xmlCharEncoding enc = tree.xmlDetectCharEncoding(buffer, py_buffer_len)
 *     enchandler = tree.xmlGetCharEncodingHandler(enc)
 *     if enchandler is not NULL:             # <<<<<<<<<<<<<<
 *         try:
 *             if enchandler.name:
*/
  __pyx_t_1 = (__pyx_v_enchandler != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":266
 *     enchandler = tree.xmlGetCharEncodingHandler(enc)
 *     if enchandler is not NULL:
 *         try:             # <<<<<<<<<<<<<<
 *             if enchandler.name:
 *                 encoding_name = enchandler.name.decode('UTF-8')
*/
    /*try:*/ {

      /* "src/lxml/parser.pxi":267
 *     if enchandler is not NULL:
 *         try:
 *             if enchandler.name:             # <<<<<<<<<<<<<<
 *                 encoding_name = enchandler.name.decode('UTF-8')
 *         finally:
*/
      __pyx_t_1 = (__pyx_v_enchandler->name != 0);
      if (__pyx_t_1) {

        /* "src/lxml/parser.pxi":268
 *         try:
 *             if enchandler.name:
 *                 encoding_name = enchandler.name.decode('UTF-8')             # <<<<<<<<<<<<<<
 *         finally:
 *             tree.xmlCharEncCloseFunc(enchandler)
*/
        __pyx_t_2 = __pyx_v_enchandler->name;
        __pyx_t_3 = __Pyx_ssize_strlen(__pyx_t_2); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(2, 268, __pyx_L5_error)
        __pyx_t_4 = __Pyx_decode_c_string(__pyx_t_2, 0, __pyx_t_3, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 268, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_DECREF_SET(__pyx_v_encoding_name, __pyx_t_4);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

        /* "src/lxml/parser.pxi":267
 *     if enchandler is not NULL:
 *         try:
 *             if enchandler.name:             # <<<<<<<<<<<<<<
 *                 encoding_name = enchandler.name.decode('UTF-8')
 *         finally:
*/
      }
    }

    /* "src/lxml/parser.pxi":270
 *                 encoding_name = enchandler.name.decode('UTF-8')
 *         finally:
 *             tree.xmlCharEncCloseFunc(enchandler)             # <<<<<<<<<<<<<<
 *     else:
 *         c_name = tree.xmlGetCharEncodingName(enc)
*/
    /*finally:*/ {
      /*normal exit:*/{
        (void)(xmlCharEncCloseFunc(__pyx_v_enchandler));
        goto __pyx_L6;
      }
      __pyx_L5_error:;
      /*exception exit:*/{
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
         __Pyx_ExceptionSwap(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
        if ( unlikely(__Pyx_GetException(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10) < 0)) __Pyx_ErrFetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
        __Pyx_XGOTREF(__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_9);
        __Pyx_XGOTREF(__pyx_t_10);
        __Pyx_XGOTREF(__pyx_t_11);
        __Pyx_XGOTREF(__pyx_t_12);
        __Pyx_XGOTREF(__pyx_t_13);
        __pyx_t_5 = __pyx_lineno; __pyx_t_6 = __pyx_clineno; __pyx_t_7 = __pyx_filename;
        {
          (void)(xmlCharEncCloseFunc(__pyx_v_enchandler));
        }
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_ErrRestore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
        __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
        __pyx_lineno = __pyx_t_5; __pyx_clineno = __pyx_t_6; __pyx_filename = __pyx_t_7;
        goto __pyx_L1_error;
      }
      __pyx_L6:;
    }

    /* "src/lxml/parser.pxi":265
 *     cdef tree.xmlCharEncoding enc = tree.xmlDetectCharEncoding(buffer, py_buffer_len)
 *     enchandler = tree.xmlGetCharEncodingHandler(enc)
 *     if enchandler is not NULL:             # <<<<<<<<<<<<<<
 *         try:
 *             if enchandler.name:
*/
    goto __pyx_L3;
  }

  /* "src/lxml/parser.pxi":272
 *             tree.xmlCharEncCloseFunc(enchandler)
 *     else:
 *         c_name = tree.xmlGetCharEncodingName(enc)             # <<<<<<<<<<<<<<
 *         if c_name:
 *             encoding_name = c_name.decode('UTF-8')
*/
  /*else*/ {
    __pyx_v_c_name = xmlGetCharEncodingName(__pyx_v_enc);

    /* "src/lxml/parser.pxi":273
 *     else:
 *         c_name = tree.xmlGetCharEncodingName(enc)
 *         if c_name:             # <<<<<<<<<<<<<<
 *             encoding_name = c_name.decode('UTF-8')
 * 
*/
    __pyx_t_1 = (__pyx_v_c_name != 0);
    if (__pyx_t_1) {

      /* "src/lxml/parser.pxi":274
 *         c_name = tree.xmlGetCharEncodingName(enc)
 *         if c_name:
 *             encoding_name = c_name.decode('UTF-8')             # <<<<<<<<<<<<<<
 * 
 * 
*/
      __pyx_t_3 = __Pyx_ssize_strlen(__pyx_v_c_name); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(2, 274, __pyx_L1_error)
      __pyx_t_4 = __Pyx_decode_c_string(__pyx_v_c_name, 0, __pyx_t_3, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 274, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF_SET(__pyx_v_encoding_name, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "src/lxml/parser.pxi":273
 *     else:
 *         c_name = tree.xmlGetCharEncodingName(enc)
 *         if c_name:             # <<<<<<<<<<<<<<
 *             encoding_name = c_name.decode('UTF-8')
 * 
*/
    }
  }
  __pyx_L3:;

  /* "src/lxml/parser.pxi":277
 * 
 * 
 *     if encoding_name and not encoding_name.endswith('LE') and not encoding_name.endswith('BE'):             # <<<<<<<<<<<<<<
 *         encoding_name += 'BE' if python.PY_BIG_ENDIAN else 'LE'
 *     return encoding_name or None
*/
  __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_v_encoding_name); if (unlikely((__pyx_t_14 < 0))) __PYX_ERR(2, 277, __pyx_L1_error)
  if (__pyx_t_14) {
  } else {
    __pyx_t_1 = __pyx_t_14;
    goto __pyx_L12_bool_binop_done;
  }
  __pyx_t_15 = __pyx_v_encoding_name;
  __Pyx_INCREF(__pyx_t_15);
  __pyx_t_16 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_15, __pyx_mstate_global->__pyx_n_u_LE};
    __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_endswith, __pyx_callargs+__pyx_t_16, (2-__pyx_t_16) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 277, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_14 < 0))) __PYX_ERR(2, 277, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_17 = (!__pyx_t_14);
  if (__pyx_t_17) {
  } else {
    __pyx_t_1 = __pyx_t_17;
    goto __pyx_L12_bool_binop_done;
  }
  __pyx_t_15 = __pyx_v_encoding_name;
  __Pyx_INCREF(__pyx_t_15);
  __pyx_t_16 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_15, __pyx_mstate_global->__pyx_n_u_BE};
    __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_endswith, __pyx_callargs+__pyx_t_16, (2-__pyx_t_16) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 277, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_17 < 0))) __PYX_ERR(2, 277, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_14 = (!__pyx_t_17);
  __pyx_t_1 = __pyx_t_14;
  __pyx_L12_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":278
 * 
 *     if encoding_name and not encoding_name.endswith('LE') and not encoding_name.endswith('BE'):
 *         encoding_name += 'BE' if python.PY_BIG_ENDIAN else 'LE'             # <<<<<<<<<<<<<<
 *     return encoding_name or None
 * 
*/
    if (PY_BIG_ENDIAN) {
      __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_BE);
      __pyx_t_4 = __pyx_mstate_global->__pyx_n_u_BE;
    } else {
      __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_LE);
      __pyx_t_4 = __pyx_mstate_global->__pyx_n_u_LE;
    }
    __pyx_t_15 = PyNumber_InPlaceAdd(__pyx_v_encoding_name, __pyx_t_4); if (unlikely(!__pyx_t_15)) __PYX_ERR(2, 278, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_encoding_name, __pyx_t_15);
    __pyx_t_15 = 0;

    /* "src/lxml/parser.pxi":277
 * 
 * 
 *     if encoding_name and not encoding_name.endswith('LE') and not encoding_name.endswith('BE'):             # <<<<<<<<<<<<<<
 *         encoding_name += 'BE' if python.PY_BIG_ENDIAN else 'LE'
 *     return encoding_name or None
*/
  }

  /* "src/lxml/parser.pxi":279
 *     if encoding_name and not encoding_name.endswith('LE') and not encoding_name.endswith('BE'):
 *         encoding_name += 'BE' if python.PY_BIG_ENDIAN else 'LE'
 *     return encoding_name or None             # <<<<<<<<<<<<<<
 * 
 * _pyucs4_encoding_name = _find_PyUCS4EncodingName()
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_encoding_name); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(2, 279, __pyx_L1_error)
  if (!__pyx_t_1) {
  } else {
    __pyx_t_4 = __pyx_v_encoding_name;
    __Pyx_INCREF(__pyx_t_4);
    if (!(likely(PyUnicode_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_4))) __PYX_ERR(2, 279, __pyx_L1_error)
    __pyx_t_15 = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L15_bool_binop_done;
  }
  __Pyx_INCREF(Py_None);
  __pyx_t_15 = Py_None;
  __pyx_L15_bool_binop_done:;
  __pyx_r = ((PyObject*)__pyx_t_15);
  __pyx_t_15 = 0;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":254
 * 
 * 
 * cdef unicode _find_PyUCS4EncodingName():             # <<<<<<<<<<<<<<
 *     """
 *     Find a suitable encoding for Py_UCS4 PyUnicode strings in libxml2.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_AddTraceback("lxml.etree._find_PyUCS4EncodingName", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ustring);
  __Pyx_XDECREF(__pyx_v_encoding_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":300
 *     cdef bint _close_file_after_read
 * 
 *     def __cinit__(self, filelike, exc_context not None, url, encoding=None, bint close_file=False):             # <<<<<<<<<<<<<<
 *         self._exc_context = exc_context
 *         self._filelike = filelike
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_18_FileReaderContext_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_18_FileReaderContext_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filelike = 0;
  PyObject *__pyx_v_exc_context = 0;
  PyObject *__pyx_v_url = 0;
  PyObject *__pyx_v_encoding = 0;
  int __pyx_v_close_file;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[5] = {0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_filelike,&__pyx_mstate_global->__pyx_n_u_exc_context,&__pyx_mstate_global->__pyx_n_u_url,&__pyx_mstate_global->__pyx_n_u_encoding,&__pyx_mstate_global->__pyx_n_u_close_file,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(2, 300, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  5:
        values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(2, 300, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(2, 300, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(2, 300, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(2, 300, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(2, 300, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__cinit__", 0) < (0)) __PYX_ERR(2, 300, __pyx_L3_error)
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, i); __PYX_ERR(2, 300, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  5:
        values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(2, 300, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(2, 300, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(2, 300, __pyx_L3_error)
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(2, 300, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(2, 300, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_filelike = values[0];
    __pyx_v_exc_context = values[1];
    __pyx_v_url = values[2];
    __pyx_v_encoding = values[3];
    if (values[4]) {
      __pyx_v_close_file = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_close_file == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 300, __pyx_L3_error)
    } else {
      __pyx_v_close_file = ((int)0);
    }
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, __pyx_nargs); __PYX_ERR(2, 300, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._FileReaderContext.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(((PyObject *)__pyx_v_exc_context) == Py_None)) {
    PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "exc_context"); __PYX_ERR(2, 300, __pyx_L1_error)
  }
  __pyx_r = __pyx_pf_4lxml_5etree_18_FileReaderContext___cinit__(((struct __pyx_obj_4lxml_5etree__FileReaderContext *)__pyx_v_self), __pyx_v_filelike, __pyx_v_exc_context, __pyx_v_url, __pyx_v_encoding, __pyx_v_close_file);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_18_FileReaderContext___cinit__(struct __pyx_obj_4lxml_5etree__FileReaderContext *__pyx_v_self, PyObject *__pyx_v_filelike, PyObject *__pyx_v_exc_context, PyObject *__pyx_v_url, PyObject *__pyx_v_encoding, int __pyx_v_close_file) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);
  __Pyx_INCREF(__pyx_v_url);

  /* "src/lxml/parser.pxi":301
 * 
 *     def __cinit__(self, filelike, exc_context not None, url, encoding=None, bint close_file=False):
 *         self._exc_context = exc_context             # <<<<<<<<<<<<<<
 *         self._filelike = filelike
 *         self._close_file_after_read = close_file
*/
  __pyx_t_1 = __pyx_v_exc_context;
  __Pyx_INCREF(__pyx_t_1);
  if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ExceptionContext)))) __PYX_ERR(2, 301, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_exc_context);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_exc_context);
  __pyx_v_self->_exc_context = ((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/parser.pxi":302
 *     def __cinit__(self, filelike, exc_context not None, url, encoding=None, bint close_file=False):
 *         self._exc_context = exc_context
 *         self._filelike = filelike             # <<<<<<<<<<<<<<
 *         self._close_file_after_read = close_file
 *         self._encoding = encoding
*/
  __Pyx_INCREF(__pyx_v_filelike);
  __Pyx_GIVEREF(__pyx_v_filelike);
  __Pyx_GOTREF(__pyx_v_self->_filelike);
  __Pyx_DECREF(__pyx_v_self->_filelike);
  __pyx_v_self->_filelike = __pyx_v_filelike;

  /* "src/lxml/parser.pxi":303
 *         self._exc_context = exc_context
 *         self._filelike = filelike
 *         self._close_file_after_read = close_file             # <<<<<<<<<<<<<<
 *         self._encoding = encoding
 *         if url is not None:
*/
  __pyx_v_self->_close_file_after_read = __pyx_v_close_file;

  /* "src/lxml/parser.pxi":304
 *         self._filelike = filelike
 *         self._close_file_after_read = close_file
 *         self._encoding = encoding             # <<<<<<<<<<<<<<
 *         if url is not None:
 *             url = _encodeFilename(url)
*/
  __Pyx_INCREF(__pyx_v_encoding);
  __Pyx_GIVEREF(__pyx_v_encoding);
  __Pyx_GOTREF(__pyx_v_self->_encoding);
  __Pyx_DECREF(__pyx_v_self->_encoding);
  __pyx_v_self->_encoding = __pyx_v_encoding;

  /* "src/lxml/parser.pxi":305
 *         self._close_file_after_read = close_file
 *         self._encoding = encoding
 *         if url is not None:             # <<<<<<<<<<<<<<
 *             url = _encodeFilename(url)
 *             self._c_url = _cstr(url)
*/
  __pyx_t_2 = (__pyx_v_url != Py_None);
  if (__pyx_t_2) {

    /* "src/lxml/parser.pxi":306
 *         self._encoding = encoding
 *         if url is not None:
 *             url = _encodeFilename(url)             # <<<<<<<<<<<<<<
 *             self._c_url = _cstr(url)
 *         self._url = url
*/
    __pyx_t_1 = __pyx_f_4lxml_5etree__encodeFilename(__pyx_v_url); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 306, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_url, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/parser.pxi":307
 *         if url is not None:
 *             url = _encodeFilename(url)
 *             self._c_url = _cstr(url)             # <<<<<<<<<<<<<<
 *         self._url = url
 *         self._bytes  = b''
*/
    __pyx_v_self->_c_url = PyBytes_AS_STRING(__pyx_v_url);

    /* "src/lxml/parser.pxi":305
 *         self._close_file_after_read = close_file
 *         self._encoding = encoding
 *         if url is not None:             # <<<<<<<<<<<<<<
 *             url = _encodeFilename(url)
 *             self._c_url = _cstr(url)
*/
  }

  /* "src/lxml/parser.pxi":308
 *             url = _encodeFilename(url)
 *             self._c_url = _cstr(url)
 *         self._url = url             # <<<<<<<<<<<<<<
 *         self._bytes  = b''
 *         self._bytes_read = 0
*/
  __Pyx_INCREF(__pyx_v_url);
  __Pyx_GIVEREF(__pyx_v_url);
  __Pyx_GOTREF(__pyx_v_self->_url);
  __Pyx_DECREF(__pyx_v_self->_url);
  __pyx_v_self->_url = __pyx_v_url;

  /* "src/lxml/parser.pxi":309
 *             self._c_url = _cstr(url)
 *         self._url = url
 *         self._bytes  = b''             # <<<<<<<<<<<<<<
 *         self._bytes_read = 0
 * 
*/
  __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_b__8);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_kp_b__8);
  __Pyx_GOTREF(__pyx_v_self->_bytes);
  __Pyx_DECREF(__pyx_v_self->_bytes);
  __pyx_v_self->_bytes = __pyx_mstate_global->__pyx_kp_b__8;

  /* "src/lxml/parser.pxi":310
 *         self._url = url
 *         self._bytes  = b''
 *         self._bytes_read = 0             # <<<<<<<<<<<<<<
 * 
 *     cdef _close_file(self):
*/
  __pyx_v_self->_bytes_read = 0;

  /* "src/lxml/parser.pxi":300
 *     cdef bint _close_file_after_read
 * 
 *     def __cinit__(self, filelike, exc_context not None, url, encoding=None, bint close_file=False):             # <<<<<<<<<<<<<<
 *         self._exc_context = exc_context
 *         self._filelike = filelike
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._FileReaderContext.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_url);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":312
 *         self._bytes_read = 0
 * 
 *     cdef _close_file(self):             # <<<<<<<<<<<<<<
 *         if self._filelike is None or not self._close_file_after_read:
 *             return
*/

static PyObject *__pyx_f_4lxml_5etree_18_FileReaderContext__close_file(struct __pyx_obj_4lxml_5etree__FileReaderContext *__pyx_v_self) {
  PyObject *__pyx_v_close = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_t_8;
  char const *__pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  size_t __pyx_t_15;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_close_file", 0);

  /* "src/lxml/parser.pxi":313
 * 
 *     cdef _close_file(self):
 *         if self._filelike is None or not self._close_file_after_read:             # <<<<<<<<<<<<<<
 *             return
 *         try:
*/
  __pyx_t_2 = (__pyx_v_self->_filelike == Py_None);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (!__pyx_v_self->_close_file_after_read);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":314
 *     cdef _close_file(self):
 *         if self._filelike is None or not self._close_file_after_read:
 *             return             # <<<<<<<<<<<<<<
 *         try:
 *             close = self._filelike.close
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/parser.pxi":313
 * 
 *     cdef _close_file(self):
 *         if self._filelike is None or not self._close_file_after_read:             # <<<<<<<<<<<<<<
 *             return
 *         try:
*/
  }

  /* "src/lxml/parser.pxi":315
 *         if self._filelike is None or not self._close_file_after_read:
 *             return
 *         try:             # <<<<<<<<<<<<<<
 *             close = self._filelike.close
 *         except AttributeError:
*/
  /*try:*/ {
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_5);
      /*try:*/ {

        /* "src/lxml/parser.pxi":316
 *             return
 *         try:
 *             close = self._filelike.close             # <<<<<<<<<<<<<<
 *         except AttributeError:
 *             close = None
*/
        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_filelike, __pyx_mstate_global->__pyx_n_u_close); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 316, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_v_close = __pyx_t_6;
        __pyx_t_6 = 0;

        /* "src/lxml/parser.pxi":315
 *         if self._filelike is None or not self._close_file_after_read:
 *             return
 *         try:             # <<<<<<<<<<<<<<
 *             close = self._filelike.close
 *         except AttributeError:
*/
      }
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L14_try_end;
      __pyx_L9_error:;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "src/lxml/parser.pxi":317
 *         try:
 *             close = self._filelike.close
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             close = None
 *         finally:
*/
      __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_AttributeError))));
      if (__pyx_t_7) {
        __Pyx_ErrRestore(0,0,0);

        /* "src/lxml/parser.pxi":318
 *             close = self._filelike.close
 *         except AttributeError:
 *             close = None             # <<<<<<<<<<<<<<
 *         finally:
 *             self._filelike = None
*/
        __Pyx_INCREF(Py_None);
        __Pyx_XDECREF_SET(__pyx_v_close, Py_None);
        goto __pyx_L10_exception_handled;
      }
      goto __pyx_L11_except_error;

      /* "src/lxml/parser.pxi":315
 *         if self._filelike is None or not self._close_file_after_read:
 *             return
 *         try:             # <<<<<<<<<<<<<<
 *             close = self._filelike.close
 *         except AttributeError:
*/
      __pyx_L11_except_error:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      goto __pyx_L7_error;
      __pyx_L10_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      __pyx_L14_try_end:;
    }
  }

  /* "src/lxml/parser.pxi":320
 *             close = None
 *         finally:
 *             self._filelike = None             # <<<<<<<<<<<<<<
 *         if close is not None:
 *             close()
*/
  /*finally:*/ {
    /*normal exit:*/{
      __Pyx_INCREF(Py_None);
      __Pyx_GIVEREF(Py_None);
      __Pyx_GOTREF(__pyx_v_self->_filelike);
      __Pyx_DECREF(__pyx_v_self->_filelike);
      __pyx_v_self->_filelike = Py_None;
      goto __pyx_L8;
    }
    __pyx_L7_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      if ( unlikely(__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3) < 0)) __Pyx_ErrFetch(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __pyx_t_7 = __pyx_lineno; __pyx_t_8 = __pyx_clineno; __pyx_t_9 = __pyx_filename;
      {
        __Pyx_INCREF(Py_None);
        __Pyx_GIVEREF(Py_None);
        __Pyx_GOTREF(__pyx_v_self->_filelike);
        __Pyx_DECREF(__pyx_v_self->_filelike);
        __pyx_v_self->_filelike = Py_None;
      }
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_ErrRestore(__pyx_t_5, __pyx_t_4, __pyx_t_3);
      __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __pyx_lineno = __pyx_t_7; __pyx_clineno = __pyx_t_8; __pyx_filename = __pyx_t_9;
      goto __pyx_L1_error;
    }
    __pyx_L8:;
  }

  /* "src/lxml/parser.pxi":321
 *         finally:
 *             self._filelike = None
 *         if close is not None:             # <<<<<<<<<<<<<<
 *             close()
 * 
*/
  __pyx_t_1 = (__pyx_v_close != Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":322
 *             self._filelike = None
 *         if close is not None:
 *             close()             # <<<<<<<<<<<<<<
 * 
 *     cdef xmlparser.xmlParserInputBuffer* _createParserInputBuffer(self) noexcept:
*/
    __pyx_t_13 = NULL;
    __Pyx_INCREF(__pyx_v_close);
    __pyx_t_14 = __pyx_v_close; 
    __pyx_t_15 = 1;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_14))) {
      __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_14);
      assert(__pyx_t_13);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_14);
      __Pyx_INCREF(__pyx_t_13);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_14, __pyx__function);
      __pyx_t_15 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_13, NULL};
      __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_14, __pyx_callargs+__pyx_t_15, (1-__pyx_t_15) | (__pyx_t_15*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 322, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "src/lxml/parser.pxi":321
 *         finally:
 *             self._filelike = None
 *         if close is not None:             # <<<<<<<<<<<<<<
 *             close()
 * 
*/
  }

  /* "src/lxml/parser.pxi":312
 *         self._bytes_read = 0
 * 
 *     cdef _close_file(self):             # <<<<<<<<<<<<<<
 *         if self._filelike is None or not self._close_file_after_read:
 *             return
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_AddTraceback("lxml.etree._FileReaderContext._close_file", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_close);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":324
 *             close()
 * 
 *     cdef xmlparser.xmlParserInputBuffer* _createParserInputBuffer(self) noexcept:             # <<<<<<<<<<<<<<
 *         cdef xmlparser.xmlParserInputBuffer* c_buffer = xmlparser.xmlAllocParserInputBuffer(0)
 *         if c_buffer:
*/

static xmlParserInputBuffer *__pyx_f_4lxml_5etree_18_FileReaderContext__createParserInputBuffer(struct __pyx_obj_4lxml_5etree__FileReaderContext *__pyx_v_self) {
  xmlParserInputBuffer *__pyx_v_c_buffer;
  xmlParserInputBuffer *__pyx_r;
  int __pyx_t_1;

  /* "src/lxml/parser.pxi":325
 * 
 *     cdef xmlparser.xmlParserInputBuffer* _createParserInputBuffer(self) noexcept:
 *         cdef xmlparser.xmlParserInputBuffer* c_buffer = xmlparser.xmlAllocParserInputBuffer(0)             # <<<<<<<<<<<<<<
 *         if c_buffer:
 *             c_buffer.readcallback  = _readFilelikeParser
*/
  __pyx_v_c_buffer = xmlAllocParserInputBuffer(0);

  /* "src/lxml/parser.pxi":326
 *     cdef xmlparser.xmlParserInputBuffer* _createParserInputBuffer(self) noexcept:
 *         cdef xmlparser.xmlParserInputBuffer* c_buffer = xmlparser.xmlAllocParserInputBuffer(0)
 *         if c_buffer:             # <<<<<<<<<<<<<<
 *             c_buffer.readcallback  = _readFilelikeParser
 *             c_buffer.context = <python.PyObject*> self
*/
  __pyx_t_1 = (__pyx_v_c_buffer != 0);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":327
 *         cdef xmlparser.xmlParserInputBuffer* c_buffer = xmlparser.xmlAllocParserInputBuffer(0)
 *         if c_buffer:
 *             c_buffer.readcallback  = _readFilelikeParser             # <<<<<<<<<<<<<<
 *             c_buffer.context = <python.PyObject*> self
 *         return c_buffer
*/
    __pyx_v_c_buffer->readcallback = __pyx_f_4lxml_5etree__readFilelikeParser;

    /* "src/lxml/parser.pxi":328
 *         if c_buffer:
 *             c_buffer.readcallback  = _readFilelikeParser
 *             c_buffer.context = <python.PyObject*> self             # <<<<<<<<<<<<<<
 *         return c_buffer
 * 
*/
    __pyx_v_c_buffer->context = ((PyObject *)__pyx_v_self);

    /* "src/lxml/parser.pxi":326
 *     cdef xmlparser.xmlParserInputBuffer* _createParserInputBuffer(self) noexcept:
 *         cdef xmlparser.xmlParserInputBuffer* c_buffer = xmlparser.xmlAllocParserInputBuffer(0)
 *         if c_buffer:             # <<<<<<<<<<<<<<
 *             c_buffer.readcallback  = _readFilelikeParser
 *             c_buffer.context = <python.PyObject*> self
*/
  }

  /* "src/lxml/parser.pxi":329
 *             c_buffer.readcallback  = _readFilelikeParser
 *             c_buffer.context = <python.PyObject*> self
 *         return c_buffer             # <<<<<<<<<<<<<<
 * 
 *     cdef xmlparser.xmlParserInput* _createParserInput(
*/
  __pyx_r = __pyx_v_c_buffer;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":324
 *             close()
 * 
 *     cdef xmlparser.xmlParserInputBuffer* _createParserInputBuffer(self) noexcept:             # <<<<<<<<<<<<<<
 *         cdef xmlparser.xmlParserInputBuffer* c_buffer = xmlparser.xmlAllocParserInputBuffer(0)
 *         if c_buffer:
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/parser.pxi":331
 *         return c_buffer
 * 
 *     cdef xmlparser.xmlParserInput* _createParserInput(             # <<<<<<<<<<<<<<
 *             self, xmlparser.xmlParserCtxt* ctxt) noexcept:
 *         cdef xmlparser.xmlParserInputBuffer* c_buffer = self._createParserInputBuffer()
*/

static xmlParserInput *__pyx_f_4lxml_5etree_18_FileReaderContext__createParserInput(struct __pyx_obj_4lxml_5etree__FileReaderContext *__pyx_v_self, xmlParserCtxt *__pyx_v_ctxt) {
  xmlParserInputBuffer *__pyx_v_c_buffer;
  xmlParserInput *__pyx_r;
  int __pyx_t_1;

  /* "src/lxml/parser.pxi":333
 *     cdef xmlparser.xmlParserInput* _createParserInput(
 *             self, xmlparser.xmlParserCtxt* ctxt) noexcept:
 *         cdef xmlparser.xmlParserInputBuffer* c_buffer = self._createParserInputBuffer()             # <<<<<<<<<<<<<<
 *         if not c_buffer:
 *             return NULL
*/
  __pyx_v_c_buffer = __pyx_f_4lxml_5etree_18_FileReaderContext__createParserInputBuffer(__pyx_v_self);

  /* "src/lxml/parser.pxi":334
 *             self, xmlparser.xmlParserCtxt* ctxt) noexcept:
 *         cdef xmlparser.xmlParserInputBuffer* c_buffer = self._createParserInputBuffer()
 *         if not c_buffer:             # <<<<<<<<<<<<<<
 *             return NULL
 *         return xmlparser.xmlNewIOInputStream(ctxt, c_buffer, 0)
*/
  __pyx_t_1 = (!(__pyx_v_c_buffer != 0));
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":335
 *         cdef xmlparser.xmlParserInputBuffer* c_buffer = self._createParserInputBuffer()
 *         if not c_buffer:
 *             return NULL             # <<<<<<<<<<<<<<
 *         return xmlparser.xmlNewIOInputStream(ctxt, c_buffer, 0)
 * 
*/
    __pyx_r = NULL;
    goto __pyx_L0;

    /* "src/lxml/parser.pxi":334
 *             self, xmlparser.xmlParserCtxt* ctxt) noexcept:
 *         cdef xmlparser.xmlParserInputBuffer* c_buffer = self._createParserInputBuffer()
 *         if not c_buffer:             # <<<<<<<<<<<<<<
 *             return NULL
 *         return xmlparser.xmlNewIOInputStream(ctxt, c_buffer, 0)
*/
  }

  /* "src/lxml/parser.pxi":336
 *         if not c_buffer:
 *             return NULL
 *         return xmlparser.xmlNewIOInputStream(ctxt, c_buffer, 0)             # <<<<<<<<<<<<<<
 * 
 *     cdef tree.xmlDtd* _readDtd(self) noexcept:
*/
  __pyx_r = xmlNewIOInputStream(__pyx_v_ctxt, __pyx_v_c_buffer, 0);
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":331
 *         return c_buffer
 * 
 *     cdef xmlparser.xmlParserInput* _createParserInput(             # <<<<<<<<<<<<<<
 *             self, xmlparser.xmlParserCtxt* ctxt) noexcept:
 *         cdef xmlparser.xmlParserInputBuffer* c_buffer = self._createParserInputBuffer()
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/parser.pxi":338
 *         return xmlparser.xmlNewIOInputStream(ctxt, c_buffer, 0)
 * 
 *     cdef tree.xmlDtd* _readDtd(self) noexcept:             # <<<<<<<<<<<<<<
 *         cdef xmlparser.xmlParserInputBuffer* c_buffer = self._createParserInputBuffer()
 *         if not c_buffer:
*/

static xmlDtd *__pyx_f_4lxml_5etree_18_FileReaderContext__readDtd(struct __pyx_obj_4lxml_5etree__FileReaderContext *__pyx_v_self) {
  xmlParserInputBuffer *__pyx_v_c_buffer;
  xmlDtd *__pyx_r;
  int __pyx_t_1;

  /* "src/lxml/parser.pxi":339
 * 
 *     cdef tree.xmlDtd* _readDtd(self) noexcept:
 *         cdef xmlparser.xmlParserInputBuffer* c_buffer = self._createParserInputBuffer()             # <<<<<<<<<<<<<<
 *         if not c_buffer:
 *             return NULL
*/
  __pyx_v_c_buffer = __pyx_f_4lxml_5etree_18_FileReaderContext__createParserInputBuffer(__pyx_v_self);

  /* "src/lxml/parser.pxi":340
 *     cdef tree.xmlDtd* _readDtd(self) noexcept:
 *         cdef xmlparser.xmlParserInputBuffer* c_buffer = self._createParserInputBuffer()
 *         if not c_buffer:             # <<<<<<<<<<<<<<
 *             return NULL
 *         with nogil:
*/
  __pyx_t_1 = (!(__pyx_v_c_buffer != 0));
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":341
 *         cdef xmlparser.xmlParserInputBuffer* c_buffer = self._createParserInputBuffer()
 *         if not c_buffer:
 *             return NULL             # <<<<<<<<<<<<<<
 *         with nogil:
 *             return xmlparser.xmlIOParseDTD(NULL, c_buffer, 0)
*/
    __pyx_r = NULL;
    goto __pyx_L0;

    /* "src/lxml/parser.pxi":340
 *     cdef tree.xmlDtd* _readDtd(self) noexcept:
 *         cdef xmlparser.xmlParserInputBuffer* c_buffer = self._createParserInputBuffer()
 *         if not c_buffer:             # <<<<<<<<<<<<<<
 *             return NULL
 *         with nogil:
*/
  }

  /* "src/lxml/parser.pxi":342
 *         if not c_buffer:
 *             return NULL
 *         with nogil:             # <<<<<<<<<<<<<<
 *             return xmlparser.xmlIOParseDTD(NULL, c_buffer, 0)
 * 
*/
  {
      PyThreadState * _save;
      _save = PyEval_SaveThread();
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "src/lxml/parser.pxi":343
 *             return NULL
 *         with nogil:
 *             return xmlparser.xmlIOParseDTD(NULL, c_buffer, 0)             # <<<<<<<<<<<<<<
 * 
 *     cdef xmlDoc* _readDoc(self, xmlparser.xmlParserCtxt* ctxt, int options) noexcept:
*/
        __pyx_r = xmlIOParseDTD(NULL, __pyx_v_c_buffer, 0);
        goto __pyx_L4_return;
      }

      /* "src/lxml/parser.pxi":342
 *         if not c_buffer:
 *             return NULL
 *         with nogil:             # <<<<<<<<<<<<<<
 *             return xmlparser.xmlIOParseDTD(NULL, c_buffer, 0)
 * 
*/
      /*finally:*/ {
        __pyx_L4_return: {
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L0;
        }
      }
  }

  /* "src/lxml/parser.pxi":338
 *         return xmlparser.xmlNewIOInputStream(ctxt, c_buffer, 0)
 * 
 *     cdef tree.xmlDtd* _readDtd(self) noexcept:             # <<<<<<<<<<<<<<
 *         cdef xmlparser.xmlParserInputBuffer* c_buffer = self._createParserInputBuffer()
 *         if not c_buffer:
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/parser.pxi":345
 *             return xmlparser.xmlIOParseDTD(NULL, c_buffer, 0)
 * 
 *     cdef xmlDoc* _readDoc(self, xmlparser.xmlParserCtxt* ctxt, int options) noexcept:             # <<<<<<<<<<<<<<
 *         cdef xmlDoc* result
 *         cdef void* c_callback_context = <python.PyObject*> self
*/

static xmlDoc *__pyx_f_4lxml_5etree_18_FileReaderContext__readDoc(struct __pyx_obj_4lxml_5etree__FileReaderContext *__pyx_v_self, xmlParserCtxt *__pyx_v_ctxt, int __pyx_v_options) {
  xmlDoc *__pyx_v_result;
  void *__pyx_v_c_callback_context;
  char *__pyx_v_c_encoding;
  int __pyx_v_orig_options;
  xmlDoc *__pyx_r;
  __Pyx_RefNannyDeclarations
  char *__pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_readDoc", 0);

  /* "src/lxml/parser.pxi":347
 *     cdef xmlDoc* _readDoc(self, xmlparser.xmlParserCtxt* ctxt, int options) noexcept:
 *         cdef xmlDoc* result
 *         cdef void* c_callback_context = <python.PyObject*> self             # <<<<<<<<<<<<<<
 *         cdef char* c_encoding = _cstr(self._encoding) if self._encoding is not None else NULL
 * 
*/
  __pyx_v_c_callback_context = ((PyObject *)__pyx_v_self);

  /* "src/lxml/parser.pxi":348
 *         cdef xmlDoc* result
 *         cdef void* c_callback_context = <python.PyObject*> self
 *         cdef char* c_encoding = _cstr(self._encoding) if self._encoding is not None else NULL             # <<<<<<<<<<<<<<
 * 
 *         orig_options = ctxt.options
*/
  __pyx_t_2 = (__pyx_v_self->_encoding != Py_None);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_v_self->_encoding;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_1 = PyBytes_AS_STRING(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = NULL;
  }
  __pyx_v_c_encoding = __pyx_t_1;

  /* "src/lxml/parser.pxi":350
 *         cdef char* c_encoding = _cstr(self._encoding) if self._encoding is not None else NULL
 * 
 *         orig_options = ctxt.options             # <<<<<<<<<<<<<<
 *         with nogil:
 *             if ctxt.html:
*/
  __pyx_t_4 = __pyx_v_ctxt->options;
  __pyx_v_orig_options = __pyx_t_4;

  /* "src/lxml/parser.pxi":351
 * 
 *         orig_options = ctxt.options
 *         with nogil:             # <<<<<<<<<<<<<<
 *             if ctxt.html:
 *                 result = htmlparser.htmlCtxtReadIO(
*/
  {
      PyThreadState * _save;
      _save = PyEval_SaveThread();
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "src/lxml/parser.pxi":352
 *         orig_options = ctxt.options
 *         with nogil:
 *             if ctxt.html:             # <<<<<<<<<<<<<<
 *                 result = htmlparser.htmlCtxtReadIO(
 *                         ctxt, _readFilelikeParser, NULL, c_callback_context,
*/
        if (__pyx_v_ctxt->html) {

          /* "src/lxml/parser.pxi":353
 *         with nogil:
 *             if ctxt.html:
 *                 result = htmlparser.htmlCtxtReadIO(             # <<<<<<<<<<<<<<
 *                         ctxt, _readFilelikeParser, NULL, c_callback_context,
 *                         self._c_url, c_encoding, options)
*/
          __pyx_v_result = htmlCtxtReadIO(__pyx_v_ctxt, __pyx_f_4lxml_5etree__readFilelikeParser, NULL, __pyx_v_c_callback_context, __pyx_v_self->_c_url, __pyx_v_c_encoding, __pyx_v_options);

          /* "src/lxml/parser.pxi":356
 *                         ctxt, _readFilelikeParser, NULL, c_callback_context,
 *                         self._c_url, c_encoding, options)
 *                 if result is not NULL:             # <<<<<<<<<<<<<<
 *                     if _fixHtmlDictNames(ctxt.dict, result) < 0:
 *                         tree.xmlFreeDoc(result)
*/
          __pyx_t_2 = (__pyx_v_result != NULL);
          if (__pyx_t_2) {

            /* "src/lxml/parser.pxi":357
 *                         self._c_url, c_encoding, options)
 *                 if result is not NULL:
 *                     if _fixHtmlDictNames(ctxt.dict, result) < 0:             # <<<<<<<<<<<<<<
 *                         tree.xmlFreeDoc(result)
 *                         result = NULL
*/
            __pyx_t_2 = (__pyx_f_4lxml_5etree__fixHtmlDictNames(__pyx_v_ctxt->dict, __pyx_v_result) < 0);
            if (__pyx_t_2) {

              /* "src/lxml/parser.pxi":358
 *                 if result is not NULL:
 *                     if _fixHtmlDictNames(ctxt.dict, result) < 0:
 *                         tree.xmlFreeDoc(result)             # <<<<<<<<<<<<<<
 *                         result = NULL
 *             else:
*/
              xmlFreeDoc(__pyx_v_result);

              /* "src/lxml/parser.pxi":359
 *                     if _fixHtmlDictNames(ctxt.dict, result) < 0:
 *                         tree.xmlFreeDoc(result)
 *                         result = NULL             # <<<<<<<<<<<<<<
 *             else:
 *                 result = xmlparser.xmlCtxtReadIO(
*/
              __pyx_v_result = NULL;

              /* "src/lxml/parser.pxi":357
 *                         self._c_url, c_encoding, options)
 *                 if result is not NULL:
 *                     if _fixHtmlDictNames(ctxt.dict, result) < 0:             # <<<<<<<<<<<<<<
 *                         tree.xmlFreeDoc(result)
 *                         result = NULL
*/
            }

            /* "src/lxml/parser.pxi":356
 *                         ctxt, _readFilelikeParser, NULL, c_callback_context,
 *                         self._c_url, c_encoding, options)
 *                 if result is not NULL:             # <<<<<<<<<<<<<<
 *                     if _fixHtmlDictNames(ctxt.dict, result) < 0:
 *                         tree.xmlFreeDoc(result)
*/
          }

          /* "src/lxml/parser.pxi":352
 *         orig_options = ctxt.options
 *         with nogil:
 *             if ctxt.html:             # <<<<<<<<<<<<<<
 *                 result = htmlparser.htmlCtxtReadIO(
 *                         ctxt, _readFilelikeParser, NULL, c_callback_context,
*/
          goto __pyx_L6;
        }

        /* "src/lxml/parser.pxi":361
 *                         result = NULL
 *             else:
 *                 result = xmlparser.xmlCtxtReadIO(             # <<<<<<<<<<<<<<
 *                     ctxt, _readFilelikeParser, NULL, c_callback_context,
 *                     self._c_url, c_encoding, options)
*/
        /*else*/ {

          /* "src/lxml/parser.pxi":363
 *                 result = xmlparser.xmlCtxtReadIO(
 *                     ctxt, _readFilelikeParser, NULL, c_callback_context,
 *                     self._c_url, c_encoding, options)             # <<<<<<<<<<<<<<
 *         ctxt.options = orig_options # work around libxml2 problem
 * 
*/
          __pyx_v_result = xmlCtxtReadIO(__pyx_v_ctxt, __pyx_f_4lxml_5etree__readFilelikeParser, NULL, __pyx_v_c_callback_context, __pyx_v_self->_c_url, __pyx_v_c_encoding, __pyx_v_options);
        }
        __pyx_L6:;
      }

      /* "src/lxml/parser.pxi":351
 * 
 *         orig_options = ctxt.options
 *         with nogil:             # <<<<<<<<<<<<<<
 *             if ctxt.html:
 *                 result = htmlparser.htmlCtxtReadIO(
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "src/lxml/parser.pxi":364
 *                     ctxt, _readFilelikeParser, NULL, c_callback_context,
 *                     self._c_url, c_encoding, options)
 *         ctxt.options = orig_options # work around libxml2 problem             # <<<<<<<<<<<<<<
 * 
 *         try:
*/
  __pyx_v_ctxt->options = __pyx_v_orig_options;

  /* "src/lxml/parser.pxi":366
 *         ctxt.options = orig_options # work around libxml2 problem
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             self._close_file()
 *         except:
*/
  /*try:*/ {
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);
      /*try:*/ {

        /* "src/lxml/parser.pxi":367
 * 
 *         try:
 *             self._close_file()             # <<<<<<<<<<<<<<
 *         except:
 *             self._exc_context._store_raised()
*/
        __pyx_t_3 = __pyx_f_4lxml_5etree_18_FileReaderContext__close_file(__pyx_v_self); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 367, __pyx_L12_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "src/lxml/parser.pxi":366
 *         ctxt.options = orig_options # work around libxml2 problem
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             self._close_file()
 *         except:
*/
      }
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L17_try_end;
      __pyx_L12_error:;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "src/lxml/parser.pxi":368
 *         try:
 *             self._close_file()
 *         except:             # <<<<<<<<<<<<<<
 *             self._exc_context._store_raised()
 *         finally:
*/
      /*except:*/ {
        __Pyx_AddTraceback("lxml.etree._FileReaderContext._readDoc", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_8, &__pyx_t_9) < 0) __PYX_ERR(2, 368, __pyx_L14_except_error)
        __Pyx_XGOTREF(__pyx_t_3);
        __Pyx_XGOTREF(__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_9);

        /* "src/lxml/parser.pxi":369
 *             self._close_file()
 *         except:
 *             self._exc_context._store_raised()             # <<<<<<<<<<<<<<
 *         finally:
 *             return result  # swallow any exceptions
*/
        __pyx_f_4lxml_5etree_17_ExceptionContext__store_raised(__pyx_v_self->_exc_context);
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L13_exception_handled;
      }

      /* "src/lxml/parser.pxi":366
 *         ctxt.options = orig_options # work around libxml2 problem
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             self._close_file()
 *         except:
*/
      __pyx_L14_except_error:;
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
      goto __pyx_L10_error;
      __pyx_L13_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
      __pyx_L17_try_end:;
    }
  }

  /* "src/lxml/parser.pxi":371
 *             self._exc_context._store_raised()
 *         finally:
 *             return result  # swallow any exceptions             # <<<<<<<<<<<<<<
 * 
 *     cdef int copyToBuffer(self, char* c_buffer, int c_requested) noexcept:
*/
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_r = __pyx_v_result;
      goto __pyx_L0;
    }
    __pyx_L10_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_7 = 0; __pyx_t_6 = 0; __pyx_t_5 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      if ( unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_6, &__pyx_t_5) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_6, &__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      {
        __pyx_r = __pyx_v_result;
        goto __pyx_L20_return;
      }
      __pyx_L20_return:;
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      goto __pyx_L0;
    }
  }

  /* "src/lxml/parser.pxi":345
 *             return xmlparser.xmlIOParseDTD(NULL, c_buffer, 0)
 * 
 *     cdef xmlDoc* _readDoc(self, xmlparser.xmlParserCtxt* ctxt, int options) noexcept:             # <<<<<<<<<<<<<<
 *         cdef xmlDoc* result
 *         cdef void* c_callback_context = <python.PyObject*> self
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":373
 *             return result  # swallow any exceptions
 * 
 *     cdef int copyToBuffer(self, char* c_buffer, int c_requested) noexcept:             # <<<<<<<<<<<<<<
 *         cdef int c_byte_count = 0
 *         cdef char* c_start
*/

static int __pyx_f_4lxml_5etree_18_FileReaderContext_copyToBuffer(struct __pyx_obj_4lxml_5etree__FileReaderContext *__pyx_v_self, char *__pyx_v_c_buffer, int __pyx_v_c_requested) {
  int __pyx_v_c_byte_count;
  char *__pyx_v_c_start;
  Py_ssize_t __pyx_v_byte_count;
  Py_ssize_t __pyx_v_remaining;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  size_t __pyx_t_8;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copyToBuffer", 0);

  /* "src/lxml/parser.pxi":374
 * 
 *     cdef int copyToBuffer(self, char* c_buffer, int c_requested) noexcept:
 *         cdef int c_byte_count = 0             # <<<<<<<<<<<<<<
 *         cdef char* c_start
 *         cdef Py_ssize_t byte_count, remaining
*/
  __pyx_v_c_byte_count = 0;

  /* "src/lxml/parser.pxi":377
 *         cdef char* c_start
 *         cdef Py_ssize_t byte_count, remaining
 *         if self._bytes_read < 0:             # <<<<<<<<<<<<<<
 *             return 0
 *         try:
*/
  __pyx_t_1 = (__pyx_v_self->_bytes_read < 0);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":378
 *         cdef Py_ssize_t byte_count, remaining
 *         if self._bytes_read < 0:
 *             return 0             # <<<<<<<<<<<<<<
 *         try:
 *             byte_count = python.PyBytes_GET_SIZE(self._bytes)
*/
    __pyx_r = 0;
    goto __pyx_L0;

    /* "src/lxml/parser.pxi":377
 *         cdef char* c_start
 *         cdef Py_ssize_t byte_count, remaining
 *         if self._bytes_read < 0:             # <<<<<<<<<<<<<<
 *             return 0
 *         try:
*/
  }

  /* "src/lxml/parser.pxi":379
 *         if self._bytes_read < 0:
 *             return 0
 *         try:             # <<<<<<<<<<<<<<
 *             byte_count = python.PyBytes_GET_SIZE(self._bytes)
 *             remaining  = byte_count - self._bytes_read
*/
  /*try:*/ {
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_4);
      /*try:*/ {

        /* "src/lxml/parser.pxi":380
 *             return 0
 *         try:
 *             byte_count = python.PyBytes_GET_SIZE(self._bytes)             # <<<<<<<<<<<<<<
 *             remaining  = byte_count - self._bytes_read
 *             while c_requested > remaining:
*/
        __pyx_t_5 = __pyx_v_self->_bytes;
        __Pyx_INCREF(__pyx_t_5);
        __pyx_v_byte_count = PyBytes_GET_SIZE(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "src/lxml/parser.pxi":381
 *         try:
 *             byte_count = python.PyBytes_GET_SIZE(self._bytes)
 *             remaining  = byte_count - self._bytes_read             # <<<<<<<<<<<<<<
 *             while c_requested > remaining:
 *                 c_start = _cstr(self._bytes) + self._bytes_read
*/
        __pyx_v_remaining = (__pyx_v_byte_count - __pyx_v_self->_bytes_read);

        /* "src/lxml/parser.pxi":382
 *             byte_count = python.PyBytes_GET_SIZE(self._bytes)
 *             remaining  = byte_count - self._bytes_read
 *             while c_requested > remaining:             # <<<<<<<<<<<<<<
 *                 c_start = _cstr(self._bytes) + self._bytes_read
 *                 cstring_h.memcpy(c_buffer, c_start, remaining)
*/
        while (1) {
          __pyx_t_1 = (__pyx_v_c_requested > __pyx_v_remaining);
          if (!__pyx_t_1) break;

          /* "src/lxml/parser.pxi":383
 *             remaining  = byte_count - self._bytes_read
 *             while c_requested > remaining:
 *                 c_start = _cstr(self._bytes) + self._bytes_read             # <<<<<<<<<<<<<<
 *                 cstring_h.memcpy(c_buffer, c_start, remaining)
 *                 c_byte_count += remaining
*/
          __pyx_t_5 = __pyx_v_self->_bytes;
          __Pyx_INCREF(__pyx_t_5);
          __pyx_v_c_start = (PyBytes_AS_STRING(__pyx_t_5) + __pyx_v_self->_bytes_read);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

          /* "src/lxml/parser.pxi":384
 *             while c_requested > remaining:
 *                 c_start = _cstr(self._bytes) + self._bytes_read
 *                 cstring_h.memcpy(c_buffer, c_start, remaining)             # <<<<<<<<<<<<<<
 *                 c_byte_count += remaining
 *                 c_buffer += remaining
*/
          (void)(memcpy(__pyx_v_c_buffer, __pyx_v_c_start, __pyx_v_remaining));

          /* "src/lxml/parser.pxi":385
 *                 c_start = _cstr(self._bytes) + self._bytes_read
 *                 cstring_h.memcpy(c_buffer, c_start, remaining)
 *                 c_byte_count += remaining             # <<<<<<<<<<<<<<
 *                 c_buffer += remaining
 *                 c_requested -= remaining
*/
          __pyx_v_c_byte_count = (__pyx_v_c_byte_count + __pyx_v_remaining);

          /* "src/lxml/parser.pxi":386
 *                 cstring_h.memcpy(c_buffer, c_start, remaining)
 *                 c_byte_count += remaining
 *                 c_buffer += remaining             # <<<<<<<<<<<<<<
 *                 c_requested -= remaining
 * 
*/
          __pyx_v_c_buffer = (__pyx_v_c_buffer + __pyx_v_remaining);

          /* "src/lxml/parser.pxi":387
 *                 c_byte_count += remaining
 *                 c_buffer += remaining
 *                 c_requested -= remaining             # <<<<<<<<<<<<<<
 * 
 *                 self._bytes = self._filelike.read(c_requested)
*/
          __pyx_v_c_requested = (__pyx_v_c_requested - __pyx_v_remaining);

          /* "src/lxml/parser.pxi":389
 *                 c_requested -= remaining
 * 
 *                 self._bytes = self._filelike.read(c_requested)             # <<<<<<<<<<<<<<
 *                 if not isinstance(self._bytes, bytes):
 *                     if isinstance(self._bytes, unicode):
*/
          __pyx_t_6 = __pyx_v_self->_filelike;
          __Pyx_INCREF(__pyx_t_6);
          __pyx_t_7 = __Pyx_PyLong_From_int(__pyx_v_c_requested); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 389, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_8 = 0;
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_7};
            __pyx_t_5 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_read, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 389, __pyx_L7_error)
            __Pyx_GOTREF(__pyx_t_5);
          }
          __Pyx_GIVEREF(__pyx_t_5);
          __Pyx_GOTREF(__pyx_v_self->_bytes);
          __Pyx_DECREF(__pyx_v_self->_bytes);
          __pyx_v_self->_bytes = __pyx_t_5;
          __pyx_t_5 = 0;

          /* "src/lxml/parser.pxi":390
 * 
 *                 self._bytes = self._filelike.read(c_requested)
 *                 if not isinstance(self._bytes, bytes):             # <<<<<<<<<<<<<<
 *                     if isinstance(self._bytes, unicode):
 *                         if self._encoding is None:
*/
          __pyx_t_5 = __pyx_v_self->_bytes;
          __Pyx_INCREF(__pyx_t_5);
          __pyx_t_1 = PyBytes_Check(__pyx_t_5); 
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __pyx_t_9 = (!__pyx_t_1);
          if (__pyx_t_9) {

            /* "src/lxml/parser.pxi":391
 *                 self._bytes = self._filelike.read(c_requested)
 *                 if not isinstance(self._bytes, bytes):
 *                     if isinstance(self._bytes, unicode):             # <<<<<<<<<<<<<<
 *                         if self._encoding is None:
 *                             self._bytes = (<unicode>self._bytes).encode('utf8')
*/
            __pyx_t_5 = __pyx_v_self->_bytes;
            __Pyx_INCREF(__pyx_t_5);
            __pyx_t_9 = PyUnicode_Check(__pyx_t_5); 
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
            if (likely(__pyx_t_9)) {

              /* "src/lxml/parser.pxi":392
 *                 if not isinstance(self._bytes, bytes):
 *                     if isinstance(self._bytes, unicode):
 *                         if self._encoding is None:             # <<<<<<<<<<<<<<
 *                             self._bytes = (<unicode>self._bytes).encode('utf8')
 *                         else:
*/
              __pyx_t_9 = (__pyx_v_self->_encoding == Py_None);
              if (__pyx_t_9) {

                /* "src/lxml/parser.pxi":393
 *                     if isinstance(self._bytes, unicode):
 *                         if self._encoding is None:
 *                             self._bytes = (<unicode>self._bytes).encode('utf8')             # <<<<<<<<<<<<<<
 *                         else:
 *                             self._bytes = python.PyUnicode_AsEncodedString(
*/
                if (unlikely(__pyx_v_self->_bytes == Py_None)) {
                  PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode");
                  __PYX_ERR(2, 393, __pyx_L7_error)
                }
                __pyx_t_5 = PyUnicode_AsUTF8String(((PyObject*)__pyx_v_self->_bytes)); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 393, __pyx_L7_error)
                __Pyx_GOTREF(__pyx_t_5);
                __Pyx_GIVEREF(__pyx_t_5);
                __Pyx_GOTREF(__pyx_v_self->_bytes);
                __Pyx_DECREF(__pyx_v_self->_bytes);
                __pyx_v_self->_bytes = __pyx_t_5;
                __pyx_t_5 = 0;

                /* "src/lxml/parser.pxi":392
 *                 if not isinstance(self._bytes, bytes):
 *                     if isinstance(self._bytes, unicode):
 *                         if self._encoding is None:             # <<<<<<<<<<<<<<
 *                             self._bytes = (<unicode>self._bytes).encode('utf8')
 *                         else:
*/
                goto __pyx_L17;
              }

              /* "src/lxml/parser.pxi":395
 *                             self._bytes = (<unicode>self._bytes).encode('utf8')
 *                         else:
 *                             self._bytes = python.PyUnicode_AsEncodedString(             # <<<<<<<<<<<<<<
 *                                 self._bytes, _cstr(self._encoding), NULL)
 *                     else:
*/
              /*else*/ {

                /* "src/lxml/parser.pxi":396
 *                         else:
 *                             self._bytes = python.PyUnicode_AsEncodedString(
 *                                 self._bytes, _cstr(self._encoding), NULL)             # <<<<<<<<<<<<<<
 *                     else:
 *                         self._close_file()
*/
                __pyx_t_5 = __pyx_v_self->_bytes;
                __Pyx_INCREF(__pyx_t_5);
                __pyx_t_7 = __pyx_v_self->_encoding;
                __Pyx_INCREF(__pyx_t_7);

                /* "src/lxml/parser.pxi":395
 *                             self._bytes = (<unicode>self._bytes).encode('utf8')
 *                         else:
 *                             self._bytes = python.PyUnicode_AsEncodedString(             # <<<<<<<<<<<<<<
 *                                 self._bytes, _cstr(self._encoding), NULL)
 *                     else:
*/
                __pyx_t_6 = PyUnicode_AsEncodedString(__pyx_t_5, PyBytes_AS_STRING(__pyx_t_7), NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 395, __pyx_L7_error)
                __Pyx_GOTREF(__pyx_t_6);
                __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
                __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
                __Pyx_GIVEREF(__pyx_t_6);
                __Pyx_GOTREF(__pyx_v_self->_bytes);
                __Pyx_DECREF(__pyx_v_self->_bytes);
                __pyx_v_self->_bytes = __pyx_t_6;
                __pyx_t_6 = 0;
              }
              __pyx_L17:;

              /* "src/lxml/parser.pxi":391
 *                 self._bytes = self._filelike.read(c_requested)
 *                 if not isinstance(self._bytes, bytes):
 *                     if isinstance(self._bytes, unicode):             # <<<<<<<<<<<<<<
 *                         if self._encoding is None:
 *                             self._bytes = (<unicode>self._bytes).encode('utf8')
*/
              goto __pyx_L16;
            }

            /* "src/lxml/parser.pxi":398
 *                                 self._bytes, _cstr(self._encoding), NULL)
 *                     else:
 *                         self._close_file()             # <<<<<<<<<<<<<<
 *                         raise TypeError, \
 *                             "reading from file-like objects must return byte strings or unicode strings"
*/
            /*else*/ {
              __pyx_t_6 = __pyx_f_4lxml_5etree_18_FileReaderContext__close_file(__pyx_v_self); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 398, __pyx_L7_error)
              __Pyx_GOTREF(__pyx_t_6);
              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

              /* "src/lxml/parser.pxi":399
 *                     else:
 *                         self._close_file()
 *                         raise TypeError, \             # <<<<<<<<<<<<<<
 *                             "reading from file-like objects must return byte strings or unicode strings"
 * 
*/
              __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_reading_from_file_like_objects_m, 0, 0);
              __PYX_ERR(2, 399, __pyx_L7_error)
            }
            __pyx_L16:;

            /* "src/lxml/parser.pxi":390
 * 
 *                 self._bytes = self._filelike.read(c_requested)
 *                 if not isinstance(self._bytes, bytes):             # <<<<<<<<<<<<<<
 *                     if isinstance(self._bytes, unicode):
 *                         if self._encoding is None:
*/
          }

          /* "src/lxml/parser.pxi":402
 *                             "reading from file-like objects must return byte strings or unicode strings"
 * 
 *                 remaining = python.PyBytes_GET_SIZE(self._bytes)             # <<<<<<<<<<<<<<
 *                 if remaining == 0:
 *                     self._bytes_read = -1
*/
          __pyx_t_6 = __pyx_v_self->_bytes;
          __Pyx_INCREF(__pyx_t_6);
          __pyx_v_remaining = PyBytes_GET_SIZE(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

          /* "src/lxml/parser.pxi":403
 * 
 *                 remaining = python.PyBytes_GET_SIZE(self._bytes)
 *                 if remaining == 0:             # <<<<<<<<<<<<<<
 *                     self._bytes_read = -1
 *                     self._close_file()
*/
          __pyx_t_9 = (__pyx_v_remaining == 0);
          if (__pyx_t_9) {

            /* "src/lxml/parser.pxi":404
 *                 remaining = python.PyBytes_GET_SIZE(self._bytes)
 *                 if remaining == 0:
 *                     self._bytes_read = -1             # <<<<<<<<<<<<<<
 *                     self._close_file()
 *                     return c_byte_count
*/
            __pyx_v_self->_bytes_read = -1L;

            /* "src/lxml/parser.pxi":405
 *                 if remaining == 0:
 *                     self._bytes_read = -1
 *                     self._close_file()             # <<<<<<<<<<<<<<
 *                     return c_byte_count
 *                 self._bytes_read = 0
*/
            __pyx_t_6 = __pyx_f_4lxml_5etree_18_FileReaderContext__close_file(__pyx_v_self); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 405, __pyx_L7_error)
            __Pyx_GOTREF(__pyx_t_6);
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

            /* "src/lxml/parser.pxi":406
 *                     self._bytes_read = -1
 *                     self._close_file()
 *                     return c_byte_count             # <<<<<<<<<<<<<<
 *                 self._bytes_read = 0
 * 
*/
            __pyx_r = __pyx_v_c_byte_count;
            goto __pyx_L11_try_return;

            /* "src/lxml/parser.pxi":403
 * 
 *                 remaining = python.PyBytes_GET_SIZE(self._bytes)
 *                 if remaining == 0:             # <<<<<<<<<<<<<<
 *                     self._bytes_read = -1
 *                     self._close_file()
*/
          }

          /* "src/lxml/parser.pxi":407
 *                     self._close_file()
 *                     return c_byte_count
 *                 self._bytes_read = 0             # <<<<<<<<<<<<<<
 * 
 *             if c_requested > 0:
*/
          __pyx_v_self->_bytes_read = 0;
        }

        /* "src/lxml/parser.pxi":409
 *                 self._bytes_read = 0
 * 
 *             if c_requested > 0:             # <<<<<<<<<<<<<<
 *                 c_start = _cstr(self._bytes) + self._bytes_read
 *                 cstring_h.memcpy(c_buffer, c_start, c_requested)
*/
        __pyx_t_9 = (__pyx_v_c_requested > 0);
        if (__pyx_t_9) {

          /* "src/lxml/parser.pxi":410
 * 
 *             if c_requested > 0:
 *                 c_start = _cstr(self._bytes) + self._bytes_read             # <<<<<<<<<<<<<<
 *                 cstring_h.memcpy(c_buffer, c_start, c_requested)
 *                 c_byte_count += c_requested
*/
          __pyx_t_6 = __pyx_v_self->_bytes;
          __Pyx_INCREF(__pyx_t_6);
          __pyx_v_c_start = (PyBytes_AS_STRING(__pyx_t_6) + __pyx_v_self->_bytes_read);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

          /* "src/lxml/parser.pxi":411
 *             if c_requested > 0:
 *                 c_start = _cstr(self._bytes) + self._bytes_read
 *                 cstring_h.memcpy(c_buffer, c_start, c_requested)             # <<<<<<<<<<<<<<
 *                 c_byte_count += c_requested
 *                 self._bytes_read += c_requested
*/
          (void)(memcpy(__pyx_v_c_buffer, __pyx_v_c_start, __pyx_v_c_requested));

          /* "src/lxml/parser.pxi":412
 *                 c_start = _cstr(self._bytes) + self._bytes_read
 *                 cstring_h.memcpy(c_buffer, c_start, c_requested)
 *                 c_byte_count += c_requested             # <<<<<<<<<<<<<<
 *                 self._bytes_read += c_requested
 *         except:
*/
          __pyx_v_c_byte_count = (__pyx_v_c_byte_count + __pyx_v_c_requested);

          /* "src/lxml/parser.pxi":413
 *                 cstring_h.memcpy(c_buffer, c_start, c_requested)
 *                 c_byte_count += c_requested
 *                 self._bytes_read += c_requested             # <<<<<<<<<<<<<<
 *         except:
 *             c_byte_count = -1
*/
          __pyx_v_self->_bytes_read = (__pyx_v_self->_bytes_read + __pyx_v_c_requested);

          /* "src/lxml/parser.pxi":409
 *                 self._bytes_read = 0
 * 
 *             if c_requested > 0:             # <<<<<<<<<<<<<<
 *                 c_start = _cstr(self._bytes) + self._bytes_read
 *                 cstring_h.memcpy(c_buffer, c_start, c_requested)
*/
        }

        /* "src/lxml/parser.pxi":379
 *         if self._bytes_read < 0:
 *             return 0
 *         try:             # <<<<<<<<<<<<<<
 *             byte_count = python.PyBytes_GET_SIZE(self._bytes)
 *             remaining  = byte_count - self._bytes_read
*/
      }
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L12_try_end;
      __pyx_L7_error:;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "src/lxml/parser.pxi":414
 *                 c_byte_count += c_requested
 *                 self._bytes_read += c_requested
 *         except:             # <<<<<<<<<<<<<<
 *             c_byte_count = -1
 *             self._exc_context._store_raised()
*/
      /*except:*/ {
        __Pyx_AddTraceback("lxml.etree._FileReaderContext.copyToBuffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_7, &__pyx_t_5) < 0) __PYX_ERR(2, 414, __pyx_L9_except_error)
        __Pyx_XGOTREF(__pyx_t_6);
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_5);

        /* "src/lxml/parser.pxi":415
 *                 self._bytes_read += c_requested
 *         except:
 *             c_byte_count = -1             # <<<<<<<<<<<<<<
 *             self._exc_context._store_raised()
 *             try:
*/
        __pyx_v_c_byte_count = -1;

        /* "src/lxml/parser.pxi":416
 *         except:
 *             c_byte_count = -1
 *             self._exc_context._store_raised()             # <<<<<<<<<<<<<<
 *             try:
 *                 self._close_file()
*/
        __pyx_f_4lxml_5etree_17_ExceptionContext__store_raised(__pyx_v_self->_exc_context);

        /* "src/lxml/parser.pxi":417
 *             c_byte_count = -1
 *             self._exc_context._store_raised()
 *             try:             # <<<<<<<<<<<<<<
 *                 self._close_file()
 *             except:
*/
        {
          __Pyx_PyThreadState_declare
          __Pyx_PyThreadState_assign
          __Pyx_ExceptionSave(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
          __Pyx_XGOTREF(__pyx_t_10);
          __Pyx_XGOTREF(__pyx_t_11);
          __Pyx_XGOTREF(__pyx_t_12);
          /*try:*/ {

            /* "src/lxml/parser.pxi":418
 *             self._exc_context._store_raised()
 *             try:
 *                 self._close_file()             # <<<<<<<<<<<<<<
 *             except:
 *                 self._exc_context._store_raised()
*/
            __pyx_t_13 = __pyx_f_4lxml_5etree_18_FileReaderContext__close_file(__pyx_v_self); if (unlikely(!__pyx_t_13)) __PYX_ERR(2, 418, __pyx_L22_error)
            __Pyx_GOTREF(__pyx_t_13);
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

            /* "src/lxml/parser.pxi":417
 *             c_byte_count = -1
 *             self._exc_context._store_raised()
 *             try:             # <<<<<<<<<<<<<<
 *                 self._close_file()
 *             except:
*/
          }
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
          goto __pyx_L29_try_end;
          __pyx_L22_error:;
          __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;

          /* "src/lxml/parser.pxi":419
 *             try:
 *                 self._close_file()
 *             except:             # <<<<<<<<<<<<<<
 *                 self._exc_context._store_raised()
 *         finally:
*/
          /*except:*/ {
            __Pyx_AddTraceback("lxml.etree._FileReaderContext.copyToBuffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
            if (__Pyx_GetException(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15) < 0) __PYX_ERR(2, 419, __pyx_L24_except_error)
            __Pyx_XGOTREF(__pyx_t_13);
            __Pyx_XGOTREF(__pyx_t_14);
            __Pyx_XGOTREF(__pyx_t_15);

            /* "src/lxml/parser.pxi":420
 *                 self._close_file()
 *             except:
 *                 self._exc_context._store_raised()             # <<<<<<<<<<<<<<
 *         finally:
 *             return c_byte_count  # swallow any exceptions
*/
            __pyx_f_4lxml_5etree_17_ExceptionContext__store_raised(__pyx_v_self->_exc_context);
            __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
            __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
            __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
            goto __pyx_L23_exception_handled;
          }

          /* "src/lxml/parser.pxi":417
 *             c_byte_count = -1
 *             self._exc_context._store_raised()
 *             try:             # <<<<<<<<<<<<<<
 *                 self._close_file()
 *             except:
*/
          __pyx_L24_except_error:;
          __Pyx_XGIVEREF(__pyx_t_10);
          __Pyx_XGIVEREF(__pyx_t_11);
          __Pyx_XGIVEREF(__pyx_t_12);
          __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
          goto __pyx_L9_except_error;
          __pyx_L23_exception_handled:;
          __Pyx_XGIVEREF(__pyx_t_10);
          __Pyx_XGIVEREF(__pyx_t_11);
          __Pyx_XGIVEREF(__pyx_t_12);
          __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
          __pyx_L29_try_end:;
        }
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        goto __pyx_L8_exception_handled;
      }

      /* "src/lxml/parser.pxi":379
 *         if self._bytes_read < 0:
 *             return 0
 *         try:             # <<<<<<<<<<<<<<
 *             byte_count = python.PyBytes_GET_SIZE(self._bytes)
 *             remaining  = byte_count - self._bytes_read
*/
      __pyx_L9_except_error:;
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
      goto __pyx_L5_error;
      __pyx_L11_try_return:;
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
      goto __pyx_L4_return;
      __pyx_L8_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
      __pyx_L12_try_end:;
    }
  }

  /* "src/lxml/parser.pxi":422
 *                 self._exc_context._store_raised()
 *         finally:
 *             return c_byte_count  # swallow any exceptions             # <<<<<<<<<<<<<<
 * 
 * cdef int _readFilelikeParser(void* ctxt, char* c_buffer, int c_size) noexcept with gil:
*/
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_r = __pyx_v_c_byte_count;
      goto __pyx_L0;
    }
    __pyx_L5_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_12, &__pyx_t_11, &__pyx_t_10);
      if ( unlikely(__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2) < 0)) __Pyx_ErrFetch(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_10);
      {
        __pyx_r = __pyx_v_c_byte_count;
        goto __pyx_L32_return;
      }
      __pyx_L32_return:;
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_11, __pyx_t_10);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_10 = 0;
      goto __pyx_L0;
    }
    __pyx_L4_return: {
      __pyx_r = __pyx_v_c_byte_count;
      goto __pyx_L0;
    }
  }

  /* "src/lxml/parser.pxi":373
 *             return result  # swallow any exceptions
 * 
 *     cdef int copyToBuffer(self, char* c_buffer, int c_requested) noexcept:             # <<<<<<<<<<<<<<
 *         cdef int c_byte_count = 0
 *         cdef char* c_start
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":424
 *             return c_byte_count  # swallow any exceptions
 * 
 * cdef int _readFilelikeParser(void* ctxt, char* c_buffer, int c_size) noexcept with gil:             # <<<<<<<<<<<<<<
 *     return (<_FileReaderContext>ctxt).copyToBuffer(c_buffer, c_size)
 * 
*/

static int __pyx_f_4lxml_5etree__readFilelikeParser(void *__pyx_v_ctxt, char *__pyx_v_c_buffer, int __pyx_v_c_size) {
  int __pyx_r;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();

  /* "src/lxml/parser.pxi":425
 * 
 * cdef int _readFilelikeParser(void* ctxt, char* c_buffer, int c_size) noexcept with gil:
 *     return (<_FileReaderContext>ctxt).copyToBuffer(c_buffer, c_size)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = __pyx_f_4lxml_5etree_18_FileReaderContext_copyToBuffer(((struct __pyx_obj_4lxml_5etree__FileReaderContext *)__pyx_v_ctxt), __pyx_v_c_buffer, __pyx_v_c_size);
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":424
 *             return c_byte_count  # swallow any exceptions
 * 
 * cdef int _readFilelikeParser(void* ctxt, char* c_buffer, int c_size) noexcept with gil:             # <<<<<<<<<<<<<<
 *     return (<_FileReaderContext>ctxt).copyToBuffer(c_buffer, c_size)
 * 
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  return __pyx_r;
}

/* "src/lxml/parser.pxi":432
 * ############################################################
 * 
 * cdef xmlparser.xmlParserInput* _local_resolver(const_char* c_url, const_char* c_pubid,             # <<<<<<<<<<<<<<
 *                                                xmlparser.xmlParserCtxt* c_context) noexcept with gil:
 *     cdef _ResolverContext context
*/

static xmlParserInput *__pyx_f_4lxml_5etree__local_resolver(const char *__pyx_v_c_url, const char *__pyx_v_c_pubid, xmlParserCtxt *__pyx_v_c_context) {
  struct __pyx_obj_4lxml_5etree__ResolverContext *__pyx_v_context = 0;
  xmlParserInput *__pyx_v_c_input;
  struct __pyx_obj_4lxml_5etree__InputDocument *__pyx_v_doc_ref = 0;
  struct __pyx_obj_4lxml_5etree__FileReaderContext *__pyx_v_file_context = 0;
  PyObject *__pyx_v_url = NULL;
  PyObject *__pyx_v_pubid = NULL;
  PyObject *__pyx_v_data = NULL;
  PyObject *__pyx_v_filename = NULL;
  char *__pyx_v_c_filename;
  xmlParserInput *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  size_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  char *__pyx_t_10;
  const xmlChar *__pyx_t_11;
  int __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("_local_resolver", 0);

  /* "src/lxml/parser.pxi":441
 *     # passed, check to see if the thread state object has an implied
 *     # context.
 *     if c_context._private is not NULL:             # <<<<<<<<<<<<<<
 *         context = <_ResolverContext>c_context._private
 *     else:
*/
  __pyx_t_1 = (__pyx_v_c_context->_private != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":442
 *     # context.
 *     if c_context._private is not NULL:
 *         context = <_ResolverContext>c_context._private             # <<<<<<<<<<<<<<
 *     else:
 *         context = __GLOBAL_PARSER_CONTEXT.findImpliedContext()
*/
    __pyx_t_2 = ((PyObject *)__pyx_v_c_context->_private);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ResolverContext *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/parser.pxi":441
 *     # passed, check to see if the thread state object has an implied
 *     # context.
 *     if c_context._private is not NULL:             # <<<<<<<<<<<<<<
 *         context = <_ResolverContext>c_context._private
 *     else:
*/
    goto __pyx_L3;
  }

  /* "src/lxml/parser.pxi":444
 *         context = <_ResolverContext>c_context._private
 *     else:
 *         context = __GLOBAL_PARSER_CONTEXT.findImpliedContext()             # <<<<<<<<<<<<<<
 * 
 *     if context is None:
*/
  /*else*/ {
    __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree_24_ParserDictionaryContext_findImpliedContext(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 444, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ResolverContext *)__pyx_t_2);
    __pyx_t_2 = 0;
  }
  __pyx_L3:;

  /* "src/lxml/parser.pxi":446
 *         context = __GLOBAL_PARSER_CONTEXT.findImpliedContext()
 * 
 *     if context is None:             # <<<<<<<<<<<<<<
 *         if __DEFAULT_ENTITY_LOADER is NULL:
 *             return NULL
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_context) == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":447
 * 
 *     if context is None:
 *         if __DEFAULT_ENTITY_LOADER is NULL:             # <<<<<<<<<<<<<<
 *             return NULL
 *         with nogil:
*/
    __pyx_t_1 = (__pyx_v_4lxml_5etree___DEFAULT_ENTITY_LOADER == NULL);
    if (__pyx_t_1) {

      /* "src/lxml/parser.pxi":448
 *     if context is None:
 *         if __DEFAULT_ENTITY_LOADER is NULL:
 *             return NULL             # <<<<<<<<<<<<<<
 *         with nogil:
 *             # free the GIL as we might do serious I/O here (e.g. HTTP)
*/
      __pyx_r = NULL;
      goto __pyx_L0;

      /* "src/lxml/parser.pxi":447
 * 
 *     if context is None:
 *         if __DEFAULT_ENTITY_LOADER is NULL:             # <<<<<<<<<<<<<<
 *             return NULL
 *         with nogil:
*/
    }

    /* "src/lxml/parser.pxi":449
 *         if __DEFAULT_ENTITY_LOADER is NULL:
 *             return NULL
 *         with nogil:             # <<<<<<<<<<<<<<
 *             # free the GIL as we might do serious I/O here (e.g. HTTP)
 *             c_input = __DEFAULT_ENTITY_LOADER(c_url, c_pubid, c_context)
*/
    {
        PyThreadState * _save;
        _save = PyEval_SaveThread();
        __Pyx_FastGIL_Remember();
        /*try:*/ {

          /* "src/lxml/parser.pxi":451
 *         with nogil:
 *             # free the GIL as we might do serious I/O here (e.g. HTTP)
 *             c_input = __DEFAULT_ENTITY_LOADER(c_url, c_pubid, c_context)             # <<<<<<<<<<<<<<
 *         return c_input
 * 
*/
          __pyx_v_c_input = __pyx_v_4lxml_5etree___DEFAULT_ENTITY_LOADER(__pyx_v_c_url, __pyx_v_c_pubid, __pyx_v_c_context);
        }

        /* "src/lxml/parser.pxi":449
 *         if __DEFAULT_ENTITY_LOADER is NULL:
 *             return NULL
 *         with nogil:             # <<<<<<<<<<<<<<
 *             # free the GIL as we might do serious I/O here (e.g. HTTP)
 *             c_input = __DEFAULT_ENTITY_LOADER(c_url, c_pubid, c_context)
*/
        /*finally:*/ {
          /*normal exit:*/{
            __Pyx_FastGIL_Forget();
            PyEval_RestoreThread(_save);
            goto __pyx_L8;
          }
          __pyx_L8:;
        }
    }

    /* "src/lxml/parser.pxi":452
 *             # free the GIL as we might do serious I/O here (e.g. HTTP)
 *             c_input = __DEFAULT_ENTITY_LOADER(c_url, c_pubid, c_context)
 *         return c_input             # <<<<<<<<<<<<<<
 * 
 *     try:
*/
    __pyx_r = __pyx_v_c_input;
    goto __pyx_L0;

    /* "src/lxml/parser.pxi":446
 *         context = __GLOBAL_PARSER_CONTEXT.findImpliedContext()
 * 
 *     if context is None:             # <<<<<<<<<<<<<<
 *         if __DEFAULT_ENTITY_LOADER is NULL:
 *             return NULL
*/
  }

  /* "src/lxml/parser.pxi":454
 *         return c_input
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         if c_url is NULL:
 *             url = None
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    /*try:*/ {

      /* "src/lxml/parser.pxi":455
 * 
 *     try:
 *         if c_url is NULL:             # <<<<<<<<<<<<<<
 *             url = None
 *         else:
*/
      __pyx_t_1 = (__pyx_v_c_url == NULL);
      if (__pyx_t_1) {

        /* "src/lxml/parser.pxi":456
 *     try:
 *         if c_url is NULL:
 *             url = None             # <<<<<<<<<<<<<<
 *         else:
 *             # parsing a related document (DTD etc.) => UTF-8 encoded URL?
*/
        __Pyx_INCREF(Py_None);
        __pyx_v_url = Py_None;

        /* "src/lxml/parser.pxi":455
 * 
 *     try:
 *         if c_url is NULL:             # <<<<<<<<<<<<<<
 *             url = None
 *         else:
*/
        goto __pyx_L15;
      }

      /* "src/lxml/parser.pxi":459
 *         else:
 *             # parsing a related document (DTD etc.) => UTF-8 encoded URL?
 *             url = _decodeFilename(<const_xmlChar*>c_url)             # <<<<<<<<<<<<<<
 *         if c_pubid is NULL:
 *             pubid = None
*/
      /*else*/ {
        __pyx_t_2 = __pyx_f_4lxml_5etree__decodeFilename(((const xmlChar *)__pyx_v_c_url)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 459, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_v_url = __pyx_t_2;
        __pyx_t_2 = 0;
      }
      __pyx_L15:;

      /* "src/lxml/parser.pxi":460
 *             # parsing a related document (DTD etc.) => UTF-8 encoded URL?
 *             url = _decodeFilename(<const_xmlChar*>c_url)
 *         if c_pubid is NULL:             # <<<<<<<<<<<<<<
 *             pubid = None
 *         else:
*/
      __pyx_t_1 = (__pyx_v_c_pubid == NULL);
      if (__pyx_t_1) {

        /* "src/lxml/parser.pxi":461
 *             url = _decodeFilename(<const_xmlChar*>c_url)
 *         if c_pubid is NULL:
 *             pubid = None             # <<<<<<<<<<<<<<
 *         else:
 *             pubid = funicode(<const_xmlChar*>c_pubid) # always UTF-8
*/
        __Pyx_INCREF(Py_None);
        __pyx_v_pubid = ((PyObject*)Py_None);

        /* "src/lxml/parser.pxi":460
 *             # parsing a related document (DTD etc.) => UTF-8 encoded URL?
 *             url = _decodeFilename(<const_xmlChar*>c_url)
 *         if c_pubid is NULL:             # <<<<<<<<<<<<<<
 *             pubid = None
 *         else:
*/
        goto __pyx_L16;
      }

      /* "src/lxml/parser.pxi":463
 *             pubid = None
 *         else:
 *             pubid = funicode(<const_xmlChar*>c_pubid) # always UTF-8             # <<<<<<<<<<<<<<
 * 
 *         doc_ref = context._resolvers.resolve(url, pubid, context)
*/
      /*else*/ {
        __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(((const xmlChar *)__pyx_v_c_pubid)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 463, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_v_pubid = ((PyObject*)__pyx_t_2);
        __pyx_t_2 = 0;
      }
      __pyx_L16:;

      /* "src/lxml/parser.pxi":465
 *             pubid = funicode(<const_xmlChar*>c_pubid) # always UTF-8
 * 
 *         doc_ref = context._resolvers.resolve(url, pubid, context)             # <<<<<<<<<<<<<<
 *     except:
 *         context._store_raised()
*/
      __pyx_t_6 = ((PyObject *)__pyx_v_context->_resolvers);
      __Pyx_INCREF(__pyx_t_6);
      __pyx_t_7 = 0;
      {
        PyObject *__pyx_callargs[4] = {__pyx_t_6, __pyx_v_url, __pyx_v_pubid, ((PyObject *)__pyx_v_context)};
        __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_resolve, __pyx_callargs+__pyx_t_7, (4-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 465, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__InputDocument))))) __PYX_ERR(2, 465, __pyx_L9_error)
      __pyx_v_doc_ref = ((struct __pyx_obj_4lxml_5etree__InputDocument *)__pyx_t_2);
      __pyx_t_2 = 0;

      /* "src/lxml/parser.pxi":454
 *         return c_input
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         if c_url is NULL:
 *             url = None
*/
    }
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L14_try_end;
    __pyx_L9_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "src/lxml/parser.pxi":466
 * 
 *         doc_ref = context._resolvers.resolve(url, pubid, context)
 *     except:             # <<<<<<<<<<<<<<
 *         context._store_raised()
 *         return NULL
*/
    /*except:*/ {
      __Pyx_AddTraceback("lxml.etree._local_resolver", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_6, &__pyx_t_8) < 0) __PYX_ERR(2, 466, __pyx_L11_except_error)
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_8);

      /* "src/lxml/parser.pxi":467
 *         doc_ref = context._resolvers.resolve(url, pubid, context)
 *     except:
 *         context._store_raised()             # <<<<<<<<<<<<<<
 *         return NULL
 * 
*/
      __pyx_f_4lxml_5etree_17_ExceptionContext__store_raised(((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_v_context));

      /* "src/lxml/parser.pxi":468
 *     except:
 *         context._store_raised()
 *         return NULL             # <<<<<<<<<<<<<<
 * 
 *     if doc_ref is not None:
*/
      __pyx_r = NULL;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L12_except_return;
    }

    /* "src/lxml/parser.pxi":454
 *         return c_input
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         if c_url is NULL:
 *             url = None
*/
    __pyx_L11_except_error:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    goto __pyx_L1_error;
    __pyx_L12_except_return:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    goto __pyx_L0;
    __pyx_L14_try_end:;
  }

  /* "src/lxml/parser.pxi":470
 *         return NULL
 * 
 *     if doc_ref is not None:             # <<<<<<<<<<<<<<
 *         if doc_ref._type == PARSER_DATA_STRING:
 *             data = doc_ref._data_bytes
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_doc_ref) != Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":471
 * 
 *     if doc_ref is not None:
 *         if doc_ref._type == PARSER_DATA_STRING:             # <<<<<<<<<<<<<<
 *             data = doc_ref._data_bytes
 *             filename = doc_ref._filename
*/
    switch (__pyx_v_doc_ref->_type) {
      case __pyx_e_4lxml_5etree_PARSER_DATA_STRING:

      /* "src/lxml/parser.pxi":472
 *     if doc_ref is not None:
 *         if doc_ref._type == PARSER_DATA_STRING:
 *             data = doc_ref._data_bytes             # <<<<<<<<<<<<<<
 *             filename = doc_ref._filename
 *             if not filename:
*/
      __pyx_t_8 = __pyx_v_doc_ref->_data_bytes;
      __Pyx_INCREF(__pyx_t_8);
      __pyx_v_data = __pyx_t_8;
      __pyx_t_8 = 0;

      /* "src/lxml/parser.pxi":473
 *         if doc_ref._type == PARSER_DATA_STRING:
 *             data = doc_ref._data_bytes
 *             filename = doc_ref._filename             # <<<<<<<<<<<<<<
 *             if not filename:
 *                 filename = None
*/
      __pyx_t_8 = __pyx_v_doc_ref->_filename;
      __Pyx_INCREF(__pyx_t_8);
      __pyx_v_filename = __pyx_t_8;
      __pyx_t_8 = 0;

      /* "src/lxml/parser.pxi":474
 *             data = doc_ref._data_bytes
 *             filename = doc_ref._filename
 *             if not filename:             # <<<<<<<<<<<<<<
 *                 filename = None
 *             elif not isinstance(filename, bytes):
*/
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_filename); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(2, 474, __pyx_L1_error)
      __pyx_t_9 = (!__pyx_t_1);
      if (__pyx_t_9) {

        /* "src/lxml/parser.pxi":475
 *             filename = doc_ref._filename
 *             if not filename:
 *                 filename = None             # <<<<<<<<<<<<<<
 *             elif not isinstance(filename, bytes):
 *                 # most likely a text URL
*/
        __Pyx_INCREF(Py_None);
        __Pyx_DECREF_SET(__pyx_v_filename, Py_None);

        /* "src/lxml/parser.pxi":474
 *             data = doc_ref._data_bytes
 *             filename = doc_ref._filename
 *             if not filename:             # <<<<<<<<<<<<<<
 *                 filename = None
 *             elif not isinstance(filename, bytes):
*/
        goto __pyx_L20;
      }

      /* "src/lxml/parser.pxi":476
 *             if not filename:
 *                 filename = None
 *             elif not isinstance(filename, bytes):             # <<<<<<<<<<<<<<
 *                 # most likely a text URL
 *                 filename = filename.encode('utf8')
*/
      __pyx_t_9 = PyBytes_Check(__pyx_v_filename); 
      __pyx_t_1 = (!__pyx_t_9);
      if (__pyx_t_1) {

        /* "src/lxml/parser.pxi":478
 *             elif not isinstance(filename, bytes):
 *                 # most likely a text URL
 *                 filename = filename.encode('utf8')             # <<<<<<<<<<<<<<
 *                 if not isinstance(filename, bytes):
 *                     filename = None
*/
        __pyx_t_6 = __pyx_v_filename;
        __Pyx_INCREF(__pyx_t_6);
        __pyx_t_7 = 0;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_n_u_utf8};
          __pyx_t_8 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 478, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
        }
        __Pyx_DECREF_SET(__pyx_v_filename, __pyx_t_8);
        __pyx_t_8 = 0;

        /* "src/lxml/parser.pxi":479
 *                 # most likely a text URL
 *                 filename = filename.encode('utf8')
 *                 if not isinstance(filename, bytes):             # <<<<<<<<<<<<<<
 *                     filename = None
 * 
*/
        __pyx_t_1 = PyBytes_Check(__pyx_v_filename); 
        __pyx_t_9 = (!__pyx_t_1);
        if (__pyx_t_9) {

          /* "src/lxml/parser.pxi":480
 *                 filename = filename.encode('utf8')
 *                 if not isinstance(filename, bytes):
 *                     filename = None             # <<<<<<<<<<<<<<
 * 
 *             if tree.LIBXML_VERSION >= 21400:
*/
          __Pyx_INCREF(Py_None);
          __Pyx_DECREF_SET(__pyx_v_filename, Py_None);

          /* "src/lxml/parser.pxi":479
 *                 # most likely a text URL
 *                 filename = filename.encode('utf8')
 *                 if not isinstance(filename, bytes):             # <<<<<<<<<<<<<<
 *                     filename = None
 * 
*/
        }

        /* "src/lxml/parser.pxi":476
 *             if not filename:
 *                 filename = None
 *             elif not isinstance(filename, bytes):             # <<<<<<<<<<<<<<
 *                 # most likely a text URL
 *                 filename = filename.encode('utf8')
*/
      }
      __pyx_L20:;

      /* "src/lxml/parser.pxi":482
 *                     filename = None
 * 
 *             if tree.LIBXML_VERSION >= 21400:             # <<<<<<<<<<<<<<
 *                 c_filename = <char *>tree.xmlStrdup(_xcstr(filename)) if filename is not None else NULL
 *                 c_input = xmlparser.xmlNewInputFromMemory(
*/
      __pyx_t_9 = (LIBXML_VERSION >= 0x5398);
      if (__pyx_t_9) {

        /* "src/lxml/parser.pxi":483
 * 
 *             if tree.LIBXML_VERSION >= 21400:
 *                 c_filename = <char *>tree.xmlStrdup(_xcstr(filename)) if filename is not None else NULL             # <<<<<<<<<<<<<<
 *                 c_input = xmlparser.xmlNewInputFromMemory(
 *                     c_filename, _xcstr(data), <size_t> python.PyBytes_GET_SIZE(data), 0)
*/
        __pyx_t_9 = (__pyx_v_filename != Py_None);
        if (__pyx_t_9) {
          __pyx_t_10 = ((char *)xmlStrdup((const xmlChar*)PyBytes_AS_STRING(__pyx_v_filename)));
        } else {
          __pyx_t_10 = NULL;
        }
        __pyx_v_c_filename = __pyx_t_10;

        /* "src/lxml/parser.pxi":484
 *             if tree.LIBXML_VERSION >= 21400:
 *                 c_filename = <char *>tree.xmlStrdup(_xcstr(filename)) if filename is not None else NULL
 *                 c_input = xmlparser.xmlNewInputFromMemory(             # <<<<<<<<<<<<<<
 *                     c_filename, _xcstr(data), <size_t> python.PyBytes_GET_SIZE(data), 0)
 *             else:
*/
        __pyx_v_c_input = xmlNewInputFromMemory(__pyx_v_c_filename, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_data), ((size_t)PyBytes_GET_SIZE(__pyx_v_data)), 0);

        /* "src/lxml/parser.pxi":482
 *                     filename = None
 * 
 *             if tree.LIBXML_VERSION >= 21400:             # <<<<<<<<<<<<<<
 *                 c_filename = <char *>tree.xmlStrdup(_xcstr(filename)) if filename is not None else NULL
 *                 c_input = xmlparser.xmlNewInputFromMemory(
*/
        goto __pyx_L22;
      }

      /* "src/lxml/parser.pxi":487
 *                     c_filename, _xcstr(data), <size_t> python.PyBytes_GET_SIZE(data), 0)
 *             else:
 *                 c_input = xmlparser.xmlNewInputStream(c_context)             # <<<<<<<<<<<<<<
 *                 if c_input is not NULL:
 *                     if filename is not None:
*/
      /*else*/ {
        __pyx_v_c_input = xmlNewInputStream(__pyx_v_c_context);

        /* "src/lxml/parser.pxi":488
 *             else:
 *                 c_input = xmlparser.xmlNewInputStream(c_context)
 *                 if c_input is not NULL:             # <<<<<<<<<<<<<<
 *                     if filename is not None:
 *                         c_input.filename = <char *>tree.xmlStrdup(_xcstr(filename))
*/
        __pyx_t_9 = (__pyx_v_c_input != NULL);
        if (__pyx_t_9) {

          /* "src/lxml/parser.pxi":489
 *                 c_input = xmlparser.xmlNewInputStream(c_context)
 *                 if c_input is not NULL:
 *                     if filename is not None:             # <<<<<<<<<<<<<<
 *                         c_input.filename = <char *>tree.xmlStrdup(_xcstr(filename))
 *                     c_input.base = _xcstr(data)
*/
          __pyx_t_9 = (__pyx_v_filename != Py_None);
          if (__pyx_t_9) {

            /* "src/lxml/parser.pxi":490
 *                 if c_input is not NULL:
 *                     if filename is not None:
 *                         c_input.filename = <char *>tree.xmlStrdup(_xcstr(filename))             # <<<<<<<<<<<<<<
 *                     c_input.base = _xcstr(data)
 *                     c_input.length = python.PyBytes_GET_SIZE(data)
*/
            __pyx_v_c_input->filename = ((char *)xmlStrdup((const xmlChar*)PyBytes_AS_STRING(__pyx_v_filename)));

            /* "src/lxml/parser.pxi":489
 *                 c_input = xmlparser.xmlNewInputStream(c_context)
 *                 if c_input is not NULL:
 *                     if filename is not None:             # <<<<<<<<<<<<<<
 *                         c_input.filename = <char *>tree.xmlStrdup(_xcstr(filename))
 *                     c_input.base = _xcstr(data)
*/
          }

          /* "src/lxml/parser.pxi":491
 *                     if filename is not None:
 *                         c_input.filename = <char *>tree.xmlStrdup(_xcstr(filename))
 *                     c_input.base = _xcstr(data)             # <<<<<<<<<<<<<<
 *                     c_input.length = python.PyBytes_GET_SIZE(data)
 *                     c_input.cur = c_input.base
*/
          __pyx_v_c_input->base = (const xmlChar*)PyBytes_AS_STRING(__pyx_v_data);

          /* "src/lxml/parser.pxi":492
 *                         c_input.filename = <char *>tree.xmlStrdup(_xcstr(filename))
 *                     c_input.base = _xcstr(data)
 *                     c_input.length = python.PyBytes_GET_SIZE(data)             # <<<<<<<<<<<<<<
 *                     c_input.cur = c_input.base
 *                     c_input.end = c_input.base + c_input.length
*/
          __pyx_v_c_input->length = PyBytes_GET_SIZE(__pyx_v_data);

          /* "src/lxml/parser.pxi":493
 *                     c_input.base = _xcstr(data)
 *                     c_input.length = python.PyBytes_GET_SIZE(data)
 *                     c_input.cur = c_input.base             # <<<<<<<<<<<<<<
 *                     c_input.end = c_input.base + c_input.length
 *         elif doc_ref._type == PARSER_DATA_FILENAME:
*/
          __pyx_t_11 = __pyx_v_c_input->base;
          __pyx_v_c_input->cur = __pyx_t_11;

          /* "src/lxml/parser.pxi":494
 *                     c_input.length = python.PyBytes_GET_SIZE(data)
 *                     c_input.cur = c_input.base
 *                     c_input.end = c_input.base + c_input.length             # <<<<<<<<<<<<<<
 *         elif doc_ref._type == PARSER_DATA_FILENAME:
 *             data = None
*/
          __pyx_v_c_input->end = (__pyx_v_c_input->base + __pyx_v_c_input->length);

          /* "src/lxml/parser.pxi":488
 *             else:
 *                 c_input = xmlparser.xmlNewInputStream(c_context)
 *                 if c_input is not NULL:             # <<<<<<<<<<<<<<
 *                     if filename is not None:
 *                         c_input.filename = <char *>tree.xmlStrdup(_xcstr(filename))
*/
        }
      }
      __pyx_L22:;

      /* "src/lxml/parser.pxi":471
 * 
 *     if doc_ref is not None:
 *         if doc_ref._type == PARSER_DATA_STRING:             # <<<<<<<<<<<<<<
 *             data = doc_ref._data_bytes
 *             filename = doc_ref._filename
*/
      break;
      case __pyx_e_4lxml_5etree_PARSER_DATA_FILENAME:

      /* "src/lxml/parser.pxi":496
 *                     c_input.end = c_input.base + c_input.length
 *         elif doc_ref._type == PARSER_DATA_FILENAME:
 *             data = None             # <<<<<<<<<<<<<<
 *             c_filename = _cstr(doc_ref._filename)
 *             with nogil:
*/
      __Pyx_INCREF(Py_None);
      __pyx_v_data = Py_None;

      /* "src/lxml/parser.pxi":497
 *         elif doc_ref._type == PARSER_DATA_FILENAME:
 *             data = None
 *             c_filename = _cstr(doc_ref._filename)             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 # free the GIL as we might do serious I/O here
*/
      __pyx_t_8 = __pyx_v_doc_ref->_filename;
      __Pyx_INCREF(__pyx_t_8);
      __pyx_v_c_filename = PyBytes_AS_STRING(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "src/lxml/parser.pxi":498
 *             data = None
 *             c_filename = _cstr(doc_ref._filename)
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 # free the GIL as we might do serious I/O here
 *                 c_input = xmlparser.xmlNewInputFromFile(
*/
      {
          PyThreadState * _save;
          _save = PyEval_SaveThread();
          __Pyx_FastGIL_Remember();
          /*try:*/ {

            /* "src/lxml/parser.pxi":500
 *             with nogil:
 *                 # free the GIL as we might do serious I/O here
 *                 c_input = xmlparser.xmlNewInputFromFile(             # <<<<<<<<<<<<<<
 *                     c_context, c_filename)
 *         elif doc_ref._type == PARSER_DATA_FILE:
*/
            __pyx_v_c_input = xmlNewInputFromFile(__pyx_v_c_context, __pyx_v_c_filename);
          }

          /* "src/lxml/parser.pxi":498
 *             data = None
 *             c_filename = _cstr(doc_ref._filename)
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 # free the GIL as we might do serious I/O here
 *                 c_input = xmlparser.xmlNewInputFromFile(
*/
          /*finally:*/ {
            /*normal exit:*/{
              __Pyx_FastGIL_Forget();
              PyEval_RestoreThread(_save);
              goto __pyx_L27;
            }
            __pyx_L27:;
          }
      }

      /* "src/lxml/parser.pxi":495
 *                     c_input.cur = c_input.base
 *                     c_input.end = c_input.base + c_input.length
 *         elif doc_ref._type == PARSER_DATA_FILENAME:             # <<<<<<<<<<<<<<
 *             data = None
 *             c_filename = _cstr(doc_ref._filename)
*/
      break;
      case __pyx_e_4lxml_5etree_PARSER_DATA_FILE:

      /* "src/lxml/parser.pxi":503
 *                     c_context, c_filename)
 *         elif doc_ref._type == PARSER_DATA_FILE:
 *             file_context = _FileReaderContext(doc_ref._file, context, url,             # <<<<<<<<<<<<<<
 *                                               None, doc_ref._close_file)
 *             c_input = file_context._createParserInput(c_context)
*/
      __pyx_t_6 = NULL;

      /* "src/lxml/parser.pxi":504
 *         elif doc_ref._type == PARSER_DATA_FILE:
 *             file_context = _FileReaderContext(doc_ref._file, context, url,
 *                                               None, doc_ref._close_file)             # <<<<<<<<<<<<<<
 *             c_input = file_context._createParserInput(c_context)
 *             data = file_context
*/
      __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_doc_ref->_close_file); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 504, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_7 = 1;
      {
        PyObject *__pyx_callargs[6] = {__pyx_t_6, __pyx_v_doc_ref->_file, ((PyObject *)__pyx_v_context), __pyx_v_url, Py_None, __pyx_t_2};
        __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__FileReaderContext, __pyx_callargs+__pyx_t_7, (6-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 503, __pyx_L1_error)
        __Pyx_GOTREF((PyObject *)__pyx_t_8);
      }
      __pyx_v_file_context = ((struct __pyx_obj_4lxml_5etree__FileReaderContext *)__pyx_t_8);
      __pyx_t_8 = 0;

      /* "src/lxml/parser.pxi":505
 *             file_context = _FileReaderContext(doc_ref._file, context, url,
 *                                               None, doc_ref._close_file)
 *             c_input = file_context._createParserInput(c_context)             # <<<<<<<<<<<<<<
 *             data = file_context
 *         else:
*/
      __pyx_v_c_input = __pyx_f_4lxml_5etree_18_FileReaderContext__createParserInput(__pyx_v_file_context, __pyx_v_c_context);

      /* "src/lxml/parser.pxi":506
 *                                               None, doc_ref._close_file)
 *             c_input = file_context._createParserInput(c_context)
 *             data = file_context             # <<<<<<<<<<<<<<
 *         else:
 *             data = None
*/
      __Pyx_INCREF((PyObject *)__pyx_v_file_context);
      __pyx_v_data = ((PyObject *)__pyx_v_file_context);

      /* "src/lxml/parser.pxi":502
 *                 c_input = xmlparser.xmlNewInputFromFile(
 *                     c_context, c_filename)
 *         elif doc_ref._type == PARSER_DATA_FILE:             # <<<<<<<<<<<<<<
 *             file_context = _FileReaderContext(doc_ref._file, context, url,
 *                                               None, doc_ref._close_file)
*/
      break;
      default:

      /* "src/lxml/parser.pxi":508
 *             data = file_context
 *         else:
 *             data = None             # <<<<<<<<<<<<<<
 *             c_input = NULL
 * 
*/
      __Pyx_INCREF(Py_None);
      __pyx_v_data = Py_None;

      /* "src/lxml/parser.pxi":509
 *         else:
 *             data = None
 *             c_input = NULL             # <<<<<<<<<<<<<<
 * 
 *         if data is not None:
*/
      __pyx_v_c_input = NULL;
      break;
    }

    /* "src/lxml/parser.pxi":511
 *             c_input = NULL
 * 
 *         if data is not None:             # <<<<<<<<<<<<<<
 *             context._storage.add(data)
 *         if c_input is not NULL:
*/
    __pyx_t_9 = (__pyx_v_data != Py_None);
    if (__pyx_t_9) {

      /* "src/lxml/parser.pxi":512
 * 
 *         if data is not None:
 *             context._storage.add(data)             # <<<<<<<<<<<<<<
 *         if c_input is not NULL:
 *             return c_input
*/
      __pyx_t_12 = __pyx_f_4lxml_5etree_10_TempStore_add(__pyx_v_context->_storage, __pyx_v_data); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(2, 512, __pyx_L1_error)

      /* "src/lxml/parser.pxi":511
 *             c_input = NULL
 * 
 *         if data is not None:             # <<<<<<<<<<<<<<
 *             context._storage.add(data)
 *         if c_input is not NULL:
*/
    }

    /* "src/lxml/parser.pxi":513
 *         if data is not None:
 *             context._storage.add(data)
 *         if c_input is not NULL:             # <<<<<<<<<<<<<<
 *             return c_input
 * 
*/
    __pyx_t_9 = (__pyx_v_c_input != NULL);
    if (__pyx_t_9) {

      /* "src/lxml/parser.pxi":514
 *             context._storage.add(data)
 *         if c_input is not NULL:
 *             return c_input             # <<<<<<<<<<<<<<
 * 
 *     if __DEFAULT_ENTITY_LOADER is NULL:
*/
      __pyx_r = __pyx_v_c_input;
      goto __pyx_L0;

      /* "src/lxml/parser.pxi":513
 *         if data is not None:
 *             context._storage.add(data)
 *         if c_input is not NULL:             # <<<<<<<<<<<<<<
 *             return c_input
 * 
*/
    }

    /* "src/lxml/parser.pxi":470
 *         return NULL
 * 
 *     if doc_ref is not None:             # <<<<<<<<<<<<<<
 *         if doc_ref._type == PARSER_DATA_STRING:
 *             data = doc_ref._data_bytes
*/
  }

  /* "src/lxml/parser.pxi":516
 *             return c_input
 * 
 *     if __DEFAULT_ENTITY_LOADER is NULL:             # <<<<<<<<<<<<<<
 *         return NULL
 * 
*/
  __pyx_t_9 = (__pyx_v_4lxml_5etree___DEFAULT_ENTITY_LOADER == NULL);
  if (__pyx_t_9) {

    /* "src/lxml/parser.pxi":517
 * 
 *     if __DEFAULT_ENTITY_LOADER is NULL:
 *         return NULL             # <<<<<<<<<<<<<<
 * 
 *     with nogil:
*/
    __pyx_r = NULL;
    goto __pyx_L0;

    /* "src/lxml/parser.pxi":516
 *             return c_input
 * 
 *     if __DEFAULT_ENTITY_LOADER is NULL:             # <<<<<<<<<<<<<<
 *         return NULL
 * 
*/
  }

  /* "src/lxml/parser.pxi":519
 *         return NULL
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         # free the GIL as we might do serious I/O here (e.g. HTTP)
 *         c_input = __DEFAULT_ENTITY_LOADER(c_url, c_pubid, c_context)
*/
  {
      PyThreadState * _save;
      _save = PyEval_SaveThread();
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "src/lxml/parser.pxi":521
 *     with nogil:
 *         # free the GIL as we might do serious I/O here (e.g. HTTP)
 *         c_input = __DEFAULT_ENTITY_LOADER(c_url, c_pubid, c_context)             # <<<<<<<<<<<<<<
 *     return c_input
 * 
*/
        __pyx_v_c_input = __pyx_v_4lxml_5etree___DEFAULT_ENTITY_LOADER(__pyx_v_c_url, __pyx_v_c_pubid, __pyx_v_c_context);
      }

      /* "src/lxml/parser.pxi":519
 *         return NULL
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         # free the GIL as we might do serious I/O here (e.g. HTTP)
 *         c_input = __DEFAULT_ENTITY_LOADER(c_url, c_pubid, c_context)
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L33;
        }
        __pyx_L33:;
      }
  }

  /* "src/lxml/parser.pxi":522
 *         # free the GIL as we might do serious I/O here (e.g. HTTP)
 *         c_input = __DEFAULT_ENTITY_LOADER(c_url, c_pubid, c_context)
 *     return c_input             # <<<<<<<<<<<<<<
 * 
 * cdef xmlparser.xmlExternalEntityLoader __DEFAULT_ENTITY_LOADER
*/
  __pyx_r = __pyx_v_c_input;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":432
 * ############################################################
 * 
 * cdef xmlparser.xmlParserInput* _local_resolver(const_char* c_url, const_char* c_pubid,             # <<<<<<<<<<<<<<
 *                                                xmlparser.xmlParserCtxt* c_context) noexcept with gil:
 *     cdef _ResolverContext context
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_WriteUnraisable("lxml.etree._local_resolver", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_XDECREF((PyObject *)__pyx_v_doc_ref);
  __Pyx_XDECREF((PyObject *)__pyx_v_file_context);
  __Pyx_XDECREF(__pyx_v_url);
  __Pyx_XDECREF(__pyx_v_pubid);
  __Pyx_XDECREF(__pyx_v_data);
  __Pyx_XDECREF(__pyx_v_filename);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  return __pyx_r;
}

/* "src/lxml/parser.pxi":528
 * 
 * 
 * cdef xmlparser.xmlExternalEntityLoader _register_document_loader() noexcept nogil:             # <<<<<<<<<<<<<<
 *     cdef xmlparser.xmlExternalEntityLoader old = xmlparser.xmlGetExternalEntityLoader()
 *     xmlparser.xmlSetExternalEntityLoader(<xmlparser.xmlExternalEntityLoader> _local_resolver)
*/

static xmlExternalEntityLoader __pyx_f_4lxml_5etree__register_document_loader(void) {
  xmlExternalEntityLoader __pyx_v_old;
  xmlExternalEntityLoader __pyx_r;

  /* "src/lxml/parser.pxi":529
 * 
 * cdef xmlparser.xmlExternalEntityLoader _register_document_loader() noexcept nogil:
 *     cdef xmlparser.xmlExternalEntityLoader old = xmlparser.xmlGetExternalEntityLoader()             # <<<<<<<<<<<<<<
 *     xmlparser.xmlSetExternalEntityLoader(<xmlparser.xmlExternalEntityLoader> _local_resolver)
 *     return old
*/
  __pyx_v_old = xmlGetExternalEntityLoader();

  /* "src/lxml/parser.pxi":530
 * cdef xmlparser.xmlExternalEntityLoader _register_document_loader() noexcept nogil:
 *     cdef xmlparser.xmlExternalEntityLoader old = xmlparser.xmlGetExternalEntityLoader()
 *     xmlparser.xmlSetExternalEntityLoader(<xmlparser.xmlExternalEntityLoader> _local_resolver)             # <<<<<<<<<<<<<<
 *     return old
 * 
*/
  xmlSetExternalEntityLoader(((xmlExternalEntityLoader)__pyx_f_4lxml_5etree__local_resolver));

  /* "src/lxml/parser.pxi":531
 *     cdef xmlparser.xmlExternalEntityLoader old = xmlparser.xmlGetExternalEntityLoader()
 *     xmlparser.xmlSetExternalEntityLoader(<xmlparser.xmlExternalEntityLoader> _local_resolver)
 *     return old             # <<<<<<<<<<<<<<
 * 
 * cdef void _reset_document_loader(xmlparser.xmlExternalEntityLoader old) noexcept nogil:
*/
  __pyx_r = __pyx_v_old;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":528
 * 
 * 
 * cdef xmlparser.xmlExternalEntityLoader _register_document_loader() noexcept nogil:             # <<<<<<<<<<<<<<
 *     cdef xmlparser.xmlExternalEntityLoader old = xmlparser.xmlGetExternalEntityLoader()
 *     xmlparser.xmlSetExternalEntityLoader(<xmlparser.xmlExternalEntityLoader> _local_resolver)
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/parser.pxi":533
 *     return old
 * 
 * cdef void _reset_document_loader(xmlparser.xmlExternalEntityLoader old) noexcept nogil:             # <<<<<<<<<<<<<<
 *     xmlparser.xmlSetExternalEntityLoader(old)
 * 
*/

static void __pyx_f_4lxml_5etree__reset_document_loader(xmlExternalEntityLoader __pyx_v_old) {

  /* "src/lxml/parser.pxi":534
 * 
 * cdef void _reset_document_loader(xmlparser.xmlExternalEntityLoader old) noexcept nogil:
 *     xmlparser.xmlSetExternalEntityLoader(old)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  xmlSetExternalEntityLoader(__pyx_v_old);

  /* "src/lxml/parser.pxi":533
 *     return old
 * 
 * cdef void _reset_document_loader(xmlparser.xmlExternalEntityLoader old) noexcept nogil:             # <<<<<<<<<<<<<<
 *     xmlparser.xmlSetExternalEntityLoader(old)
 * 
*/

  /* function exit code */
}

/* "src/lxml/parser.pxi":552
 *     cdef bint _collect_ids
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._collect_ids = True
 *         if config.ENABLE_THREADING:
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_14_ParserContext_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_14_ParserContext_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, __pyx_nargs); return -1; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return -1;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__cinit__", __pyx_kwds); return -1;}
  __pyx_r = __pyx_pf_4lxml_5etree_14_ParserContext___cinit__(((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_14_ParserContext___cinit__(struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "src/lxml/parser.pxi":553
 * 
 *     def __cinit__(self):
 *         self._collect_ids = True             # <<<<<<<<<<<<<<
 *         if config.ENABLE_THREADING:
 *             self._lock = python.PyThread_allocate_lock()
*/
  __pyx_v_self->_collect_ids = 1;

  /* "src/lxml/parser.pxi":554
 *     def __cinit__(self):
 *         self._collect_ids = True
 *         if config.ENABLE_THREADING:             # <<<<<<<<<<<<<<
 *             self._lock = python.PyThread_allocate_lock()
 *         self._error_log = _ErrorLog()
*/
  if (ENABLE_THREADING) {

    /* "src/lxml/parser.pxi":555
 *         self._collect_ids = True
 *         if config.ENABLE_THREADING:
 *             self._lock = python.PyThread_allocate_lock()             # <<<<<<<<<<<<<<
 *         self._error_log = _ErrorLog()
 * 
*/
    __pyx_v_self->_lock = PyThread_allocate_lock();

    /* "src/lxml/parser.pxi":554
 *     def __cinit__(self):
 *         self._collect_ids = True
 *         if config.ENABLE_THREADING:             # <<<<<<<<<<<<<<
 *             self._lock = python.PyThread_allocate_lock()
 *         self._error_log = _ErrorLog()
*/
  }

  /* "src/lxml/parser.pxi":556
 *         if config.ENABLE_THREADING:
 *             self._lock = python.PyThread_allocate_lock()
 *         self._error_log = _ErrorLog()             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
*/
  __pyx_t_2 = NULL;
  __pyx_t_3 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ErrorLog, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 556, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __Pyx_GIVEREF((PyObject *)__pyx_t_1);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_error_log);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_error_log);
  __pyx_v_self->_error_log = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/parser.pxi":552
 *     cdef bint _collect_ids
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._collect_ids = True
 *         if config.ENABLE_THREADING:
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ParserContext.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":558
 *         self._error_log = _ErrorLog()
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if config.ENABLE_THREADING and self._lock is not NULL:
 *             python.PyThread_free_lock(self._lock)
*/

/* Python wrapper */
static void __pyx_pw_4lxml_5etree_14_ParserContext_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_4lxml_5etree_14_ParserContext_3__dealloc__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_pf_4lxml_5etree_14_ParserContext_2__dealloc__(((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_4lxml_5etree_14_ParserContext_2__dealloc__(struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_self) {
  int __pyx_t_1;
  int __pyx_t_2;

  /* "src/lxml/parser.pxi":559
 * 
 *     def __dealloc__(self):
 *         if config.ENABLE_THREADING and self._lock is not NULL:             # <<<<<<<<<<<<<<
 *             python.PyThread_free_lock(self._lock)
 *             self._lock = NULL
*/
  if (ENABLE_THREADING) {
  } else {
    __pyx_t_1 = ENABLE_THREADING;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_self->_lock != NULL);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":560
 *     def __dealloc__(self):
 *         if config.ENABLE_THREADING and self._lock is not NULL:
 *             python.PyThread_free_lock(self._lock)             # <<<<<<<<<<<<<<
 *             self._lock = NULL
 *         if self._c_ctxt is not NULL:
*/
    PyThread_free_lock(__pyx_v_self->_lock);

    /* "src/lxml/parser.pxi":561
 *         if config.ENABLE_THREADING and self._lock is not NULL:
 *             python.PyThread_free_lock(self._lock)
 *             self._lock = NULL             # <<<<<<<<<<<<<<
 *         if self._c_ctxt is not NULL:
 *             if <void*>self._validator is not NULL and self._validator is not None:
*/
    __pyx_v_self->_lock = NULL;

    /* "src/lxml/parser.pxi":559
 * 
 *     def __dealloc__(self):
 *         if config.ENABLE_THREADING and self._lock is not NULL:             # <<<<<<<<<<<<<<
 *             python.PyThread_free_lock(self._lock)
 *             self._lock = NULL
*/
  }

  /* "src/lxml/parser.pxi":562
 *             python.PyThread_free_lock(self._lock)
 *             self._lock = NULL
 *         if self._c_ctxt is not NULL:             # <<<<<<<<<<<<<<
 *             if <void*>self._validator is not NULL and self._validator is not None:
 *                 # If the parser was not closed correctly (e.g. interrupted iterparse()),
*/
  __pyx_t_1 = (__pyx_v_self->_c_ctxt != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":563
 *             self._lock = NULL
 *         if self._c_ctxt is not NULL:
 *             if <void*>self._validator is not NULL and self._validator is not None:             # <<<<<<<<<<<<<<
 *                 # If the parser was not closed correctly (e.g. interrupted iterparse()),
 *                 # and the schema validator wasn't freed and cleaned up yet, the libxml2 SAX
*/
    __pyx_t_2 = (((void *)__pyx_v_self->_validator) != NULL);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L8_bool_binop_done;
    }
    __pyx_t_2 = (((PyObject *)__pyx_v_self->_validator) != Py_None);
    __pyx_t_1 = __pyx_t_2;
    __pyx_L8_bool_binop_done:;
    if (__pyx_t_1) {

      /* "src/lxml/parser.pxi":569
 *                 # crash when trying to xmlFree() a static SAX handler.
 *                 # Thus, make sure we disconnect the handler interceptor here at the latest.
 *                 self._validator.disconnect()             # <<<<<<<<<<<<<<
 *             xmlparser.xmlFreeParserCtxt(self._c_ctxt)
 * 
*/
      __pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_disconnect(__pyx_v_self->_validator);

      /* "src/lxml/parser.pxi":563
 *             self._lock = NULL
 *         if self._c_ctxt is not NULL:
 *             if <void*>self._validator is not NULL and self._validator is not None:             # <<<<<<<<<<<<<<
 *                 # If the parser was not closed correctly (e.g. interrupted iterparse()),
 *                 # and the schema validator wasn't freed and cleaned up yet, the libxml2 SAX
*/
    }

    /* "src/lxml/parser.pxi":570
 *                 # Thus, make sure we disconnect the handler interceptor here at the latest.
 *                 self._validator.disconnect()
 *             xmlparser.xmlFreeParserCtxt(self._c_ctxt)             # <<<<<<<<<<<<<<
 * 
 *     cdef _ParserContext _copy(self):
*/
    xmlFreeParserCtxt(__pyx_v_self->_c_ctxt);

    /* "src/lxml/parser.pxi":562
 *             python.PyThread_free_lock(self._lock)
 *             self._lock = NULL
 *         if self._c_ctxt is not NULL:             # <<<<<<<<<<<<<<
 *             if <void*>self._validator is not NULL and self._validator is not None:
 *                 # If the parser was not closed correctly (e.g. interrupted iterparse()),
*/
  }

  /* "src/lxml/parser.pxi":558
 *         self._error_log = _ErrorLog()
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if config.ENABLE_THREADING and self._lock is not NULL:
 *             python.PyThread_free_lock(self._lock)
*/

  /* function exit code */
}

/* "src/lxml/parser.pxi":572
 *             xmlparser.xmlFreeParserCtxt(self._c_ctxt)
 * 
 *     cdef _ParserContext _copy(self):             # <<<<<<<<<<<<<<
 *         cdef _ParserContext context
 *         context = self.__class__()
*/

static struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_f_4lxml_5etree_14_ParserContext__copy(struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_context = 0;
  struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_copy", 0);

  /* "src/lxml/parser.pxi":574
 *     cdef _ParserContext _copy(self):
 *         cdef _ParserContext context
 *         context = self.__class__()             # <<<<<<<<<<<<<<
 *         context._collect_ids = self._collect_ids
 *         context._validator = self._validator.copy()
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_class, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 574, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ParserContext))))) __PYX_ERR(2, 574, __pyx_L1_error)
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/parser.pxi":575
 *         cdef _ParserContext context
 *         context = self.__class__()
 *         context._collect_ids = self._collect_ids             # <<<<<<<<<<<<<<
 *         context._validator = self._validator.copy()
 *         _initParserContext(context, self._resolvers._copy(), NULL)
*/
  __pyx_t_4 = __pyx_v_self->_collect_ids;
  __pyx_v_context->_collect_ids = __pyx_t_4;

  /* "src/lxml/parser.pxi":576
 *         context = self.__class__()
 *         context._collect_ids = self._collect_ids
 *         context._validator = self._validator.copy()             # <<<<<<<<<<<<<<
 *         _initParserContext(context, self._resolvers._copy(), NULL)
 *         return context
*/
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_copy(__pyx_v_self->_validator)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 576, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF((PyObject *)__pyx_v_context->_validator);
  __Pyx_DECREF((PyObject *)__pyx_v_context->_validator);
  __pyx_v_context->_validator = ((struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/parser.pxi":577
 *         context._collect_ids = self._collect_ids
 *         context._validator = self._validator.copy()
 *         _initParserContext(context, self._resolvers._copy(), NULL)             # <<<<<<<<<<<<<<
 *         return context
 * 
*/
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree_17_ResolverRegistry__copy(__pyx_v_self->__pyx_base._resolvers)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 577, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__initParserContext(__pyx_v_context, ((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 577, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/parser.pxi":578
 *         context._validator = self._validator.copy()
 *         _initParserContext(context, self._resolvers._copy(), NULL)
 *         return context             # <<<<<<<<<<<<<<
 * 
 *     cdef void _initParserContext(self, xmlparser.xmlParserCtxt* c_ctxt) noexcept:
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_context);
  __pyx_r = __pyx_v_context;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":572
 *             xmlparser.xmlFreeParserCtxt(self._c_ctxt)
 * 
 *     cdef _ParserContext _copy(self):             # <<<<<<<<<<<<<<
 *         cdef _ParserContext context
 *         context = self.__class__()
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ParserContext._copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":580
 *         return context
 * 
 *     cdef void _initParserContext(self, xmlparser.xmlParserCtxt* c_ctxt) noexcept:             # <<<<<<<<<<<<<<
 *         """
 *         Connects the libxml2-level context to the lxml-level parser context.
*/

static void __pyx_f_4lxml_5etree_14_ParserContext__initParserContext(struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_self, xmlParserCtxt *__pyx_v_c_ctxt) {

  /* "src/lxml/parser.pxi":584
 *         Connects the libxml2-level context to the lxml-level parser context.
 *         """
 *         self._c_ctxt = c_ctxt             # <<<<<<<<<<<<<<
 *         c_ctxt._private = <void*>self
 * 
*/
  __pyx_v_self->_c_ctxt = __pyx_v_c_ctxt;

  /* "src/lxml/parser.pxi":585
 *         """
 *         self._c_ctxt = c_ctxt
 *         c_ctxt._private = <void*>self             # <<<<<<<<<<<<<<
 * 
 *     cdef void _resetParserContext(self) noexcept:
*/
  __pyx_v_c_ctxt->_private = ((void *)__pyx_v_self);

  /* "src/lxml/parser.pxi":580
 *         return context
 * 
 *     cdef void _initParserContext(self, xmlparser.xmlParserCtxt* c_ctxt) noexcept:             # <<<<<<<<<<<<<<
 *         """
 *         Connects the libxml2-level context to the lxml-level parser context.
*/

  /* function exit code */
}

/* "src/lxml/parser.pxi":587
 *         c_ctxt._private = <void*>self
 * 
 *     cdef void _resetParserContext(self) noexcept:             # <<<<<<<<<<<<<<
 *         if self._c_ctxt is not NULL:
 *             if self._c_ctxt.html:
*/

static void __pyx_f_4lxml_5etree_14_ParserContext__resetParserContext(struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_self) {
  int __pyx_t_1;

  /* "src/lxml/parser.pxi":588
 * 
 *     cdef void _resetParserContext(self) noexcept:
 *         if self._c_ctxt is not NULL:             # <<<<<<<<<<<<<<
 *             if self._c_ctxt.html:
 *                 htmlparser.htmlCtxtReset(self._c_ctxt)
*/
  __pyx_t_1 = (__pyx_v_self->_c_ctxt != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":589
 *     cdef void _resetParserContext(self) noexcept:
 *         if self._c_ctxt is not NULL:
 *             if self._c_ctxt.html:             # <<<<<<<<<<<<<<
 *                 htmlparser.htmlCtxtReset(self._c_ctxt)
 *                 self._c_ctxt.disableSAX = 0 # work around bug in libxml2
*/
    if (__pyx_v_self->_c_ctxt->html) {

      /* "src/lxml/parser.pxi":590
 *         if self._c_ctxt is not NULL:
 *             if self._c_ctxt.html:
 *                 htmlparser.htmlCtxtReset(self._c_ctxt)             # <<<<<<<<<<<<<<
 *                 self._c_ctxt.disableSAX = 0 # work around bug in libxml2
 *             else:
*/
      htmlCtxtReset(__pyx_v_self->_c_ctxt);

      /* "src/lxml/parser.pxi":591
 *             if self._c_ctxt.html:
 *                 htmlparser.htmlCtxtReset(self._c_ctxt)
 *                 self._c_ctxt.disableSAX = 0 # work around bug in libxml2             # <<<<<<<<<<<<<<
 *             else:
 *                 xmlparser.xmlClearParserCtxt(self._c_ctxt)
*/
      __pyx_v_self->_c_ctxt->disableSAX = 0;

      /* "src/lxml/parser.pxi":589
 *     cdef void _resetParserContext(self) noexcept:
 *         if self._c_ctxt is not NULL:
 *             if self._c_ctxt.html:             # <<<<<<<<<<<<<<
 *                 htmlparser.htmlCtxtReset(self._c_ctxt)
 *                 self._c_ctxt.disableSAX = 0 # work around bug in libxml2
*/
      goto __pyx_L4;
    }

    /* "src/lxml/parser.pxi":593
 *                 self._c_ctxt.disableSAX = 0 # work around bug in libxml2
 *             else:
 *                 xmlparser.xmlClearParserCtxt(self._c_ctxt)             # <<<<<<<<<<<<<<
 *                 # work around bug in libxml2 [2.9.10 .. 2.9.14]:
 *                 # https://gitlab.gnome.org/GNOME/libxml2/-/issues/378
*/
    /*else*/ {
      xmlClearParserCtxt(__pyx_v_self->_c_ctxt);

      /* "src/lxml/parser.pxi":596
 *                 # work around bug in libxml2 [2.9.10 .. 2.9.14]:
 *                 # https://gitlab.gnome.org/GNOME/libxml2/-/issues/378
 *                 self._c_ctxt.nsNr = 0             # <<<<<<<<<<<<<<
 * 
 *     cdef int prepare(self, bint set_document_loader=True) except -1:
*/
      __pyx_v_self->_c_ctxt->nsNr = 0;
    }
    __pyx_L4:;

    /* "src/lxml/parser.pxi":588
 * 
 *     cdef void _resetParserContext(self) noexcept:
 *         if self._c_ctxt is not NULL:             # <<<<<<<<<<<<<<
 *             if self._c_ctxt.html:
 *                 htmlparser.htmlCtxtReset(self._c_ctxt)
*/
  }

  /* "src/lxml/parser.pxi":587
 *         c_ctxt._private = <void*>self
 * 
 *     cdef void _resetParserContext(self) noexcept:             # <<<<<<<<<<<<<<
 *         if self._c_ctxt is not NULL:
 *             if self._c_ctxt.html:
*/

  /* function exit code */
}

/* "src/lxml/parser.pxi":598
 *                 self._c_ctxt.nsNr = 0
 * 
 *     cdef int prepare(self, bint set_document_loader=True) except -1:             # <<<<<<<<<<<<<<
 *         cdef int result
 *         if config.ENABLE_THREADING and self._lock is not NULL:
*/

static int __pyx_f_4lxml_5etree_14_ParserContext_prepare(struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_self, struct __pyx_opt_args_4lxml_5etree_14_ParserContext_prepare *__pyx_optional_args) {
  int __pyx_v_set_document_loader = ((int)1);
  int __pyx_v_result;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  xmlExternalEntityLoader __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("prepare", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_set_document_loader = __pyx_optional_args->set_document_loader;
    }
  }

  /* "src/lxml/parser.pxi":600
 *     cdef int prepare(self, bint set_document_loader=True) except -1:
 *         cdef int result
 *         if config.ENABLE_THREADING and self._lock is not NULL:             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 result = python.PyThread_acquire_lock(
*/
  if (ENABLE_THREADING) {
  } else {
    __pyx_t_1 = ENABLE_THREADING;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_self->_lock != NULL);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":601
 *         cdef int result
 *         if config.ENABLE_THREADING and self._lock is not NULL:
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 result = python.PyThread_acquire_lock(
 *                     self._lock, python.WAIT_LOCK)
*/
    {
        PyThreadState * _save;
        _save = PyEval_SaveThread();
        __Pyx_FastGIL_Remember();
        /*try:*/ {

          /* "src/lxml/parser.pxi":602
 *         if config.ENABLE_THREADING and self._lock is not NULL:
 *             with nogil:
 *                 result = python.PyThread_acquire_lock(             # <<<<<<<<<<<<<<
 *                     self._lock, python.WAIT_LOCK)
 *             if result == 0:
*/
          __pyx_v_result = PyThread_acquire_lock(__pyx_v_self->_lock, WAIT_LOCK);
        }

        /* "src/lxml/parser.pxi":601
 *         cdef int result
 *         if config.ENABLE_THREADING and self._lock is not NULL:
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 result = python.PyThread_acquire_lock(
 *                     self._lock, python.WAIT_LOCK)
*/
        /*finally:*/ {
          /*normal exit:*/{
            __Pyx_FastGIL_Forget();
            PyEval_RestoreThread(_save);
            goto __pyx_L8;
          }
          __pyx_L8:;
        }
    }

    /* "src/lxml/parser.pxi":604
 *                 result = python.PyThread_acquire_lock(
 *                     self._lock, python.WAIT_LOCK)
 *             if result == 0:             # <<<<<<<<<<<<<<
 *                 raise ParserError, "parser locking failed"
 *         self._error_log.clear()
*/
    __pyx_t_1 = (__pyx_v_result == 0);
    if (unlikely(__pyx_t_1)) {

      /* "src/lxml/parser.pxi":605
 *                     self._lock, python.WAIT_LOCK)
 *             if result == 0:
 *                 raise ParserError, "parser locking failed"             # <<<<<<<<<<<<<<
 *         self._error_log.clear()
 *         self._doc = None
*/
      __Pyx_Raise(((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_ParserError), __pyx_mstate_global->__pyx_kp_u_parser_locking_failed, 0, 0);
      __PYX_ERR(2, 605, __pyx_L1_error)

      /* "src/lxml/parser.pxi":604
 *                 result = python.PyThread_acquire_lock(
 *                     self._lock, python.WAIT_LOCK)
 *             if result == 0:             # <<<<<<<<<<<<<<
 *                 raise ParserError, "parser locking failed"
 *         self._error_log.clear()
*/
    }

    /* "src/lxml/parser.pxi":600
 *     cdef int prepare(self, bint set_document_loader=True) except -1:
 *         cdef int result
 *         if config.ENABLE_THREADING and self._lock is not NULL:             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 result = python.PyThread_acquire_lock(
*/
  }

  /* "src/lxml/parser.pxi":606
 *             if result == 0:
 *                 raise ParserError, "parser locking failed"
 *         self._error_log.clear()             # <<<<<<<<<<<<<<
 *         self._doc = None
 *         # Connect the lxml error log with libxml2's error handling. In the case of parsing
*/
  __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)__pyx_v_self->_error_log->__pyx_base.__pyx_base.__pyx_vtab)->clear(__pyx_v_self->_error_log, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 606, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/parser.pxi":607
 *                 raise ParserError, "parser locking failed"
 *         self._error_log.clear()
 *         self._doc = None             # <<<<<<<<<<<<<<
 *         # Connect the lxml error log with libxml2's error handling. In the case of parsing
 *         # HTML, ctxt->sax is not set to null, so this always works. The libxml2 function
*/
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_doc);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_doc);
  __pyx_v_self->_doc = ((struct LxmlDocument *)Py_None);

  /* "src/lxml/parser.pxi":615
 *         # parserInternals.c.
 *         # Need a cast here because older libxml2 releases do not use 'const' in the functype.
 *         self._c_ctxt.sax.serror = <xmlerror.xmlStructuredErrorFunc> _receiveParserError             # <<<<<<<<<<<<<<
 *         self._orig_loader = _register_document_loader() if set_document_loader else NULL
 *         if self._validator is not None:
*/
  __pyx_v_self->_c_ctxt->sax->serror = ((xmlStructuredErrorFunc)__pyx_f_4lxml_5etree__receiveParserError);

  /* "src/lxml/parser.pxi":616
 *         # Need a cast here because older libxml2 releases do not use 'const' in the functype.
 *         self._c_ctxt.sax.serror = <xmlerror.xmlStructuredErrorFunc> _receiveParserError
 *         self._orig_loader = _register_document_loader() if set_document_loader else NULL             # <<<<<<<<<<<<<<
 *         if self._validator is not None:
 *             self._validator.connect(self._c_ctxt, self._error_log)
*/
  if (__pyx_v_set_document_loader) {
    __pyx_t_4 = __pyx_f_4lxml_5etree__register_document_loader();
  } else {
    __pyx_t_4 = NULL;
  }
  __pyx_v_self->_orig_loader = __pyx_t_4;

  /* "src/lxml/parser.pxi":617
 *         self._c_ctxt.sax.serror = <xmlerror.xmlStructuredErrorFunc> _receiveParserError
 *         self._orig_loader = _register_document_loader() if set_document_loader else NULL
 *         if self._validator is not None:             # <<<<<<<<<<<<<<
 *             self._validator.connect(self._c_ctxt, self._error_log)
 *         return 0
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_self->_validator) != Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":618
 *         self._orig_loader = _register_document_loader() if set_document_loader else NULL
 *         if self._validator is not None:
 *             self._validator.connect(self._c_ctxt, self._error_log)             # <<<<<<<<<<<<<<
 *         return 0
 * 
*/
    __pyx_t_3 = ((PyObject *)__pyx_v_self->_error_log);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_5 = __pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_connect(__pyx_v_self->_validator, __pyx_v_self->_c_ctxt, ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_t_3)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(2, 618, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/parser.pxi":617
 *         self._c_ctxt.sax.serror = <xmlerror.xmlStructuredErrorFunc> _receiveParserError
 *         self._orig_loader = _register_document_loader() if set_document_loader else NULL
 *         if self._validator is not None:             # <<<<<<<<<<<<<<
 *             self._validator.connect(self._c_ctxt, self._error_log)
 *         return 0
*/
  }

  /* "src/lxml/parser.pxi":619
 *         if self._validator is not None:
 *             self._validator.connect(self._c_ctxt, self._error_log)
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     cdef int cleanup(self) except -1:
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":598
 *                 self._c_ctxt.nsNr = 0
 * 
 *     cdef int prepare(self, bint set_document_loader=True) except -1:             # <<<<<<<<<<<<<<
 *         cdef int result
 *         if config.ENABLE_THREADING and self._lock is not NULL:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._ParserContext.prepare", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":621
 *         return 0
 * 
 *     cdef int cleanup(self) except -1:             # <<<<<<<<<<<<<<
 *         if self._orig_loader is not NULL:
 *             _reset_document_loader(self._orig_loader)
*/

static int __pyx_f_4lxml_5etree_14_ParserContext_cleanup(struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  char const *__pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("cleanup", 0);

  /* "src/lxml/parser.pxi":622
 * 
 *     cdef int cleanup(self) except -1:
 *         if self._orig_loader is not NULL:             # <<<<<<<<<<<<<<
 *             _reset_document_loader(self._orig_loader)
 *         try:
*/
  __pyx_t_1 = (__pyx_v_self->_orig_loader != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":623
 *     cdef int cleanup(self) except -1:
 *         if self._orig_loader is not NULL:
 *             _reset_document_loader(self._orig_loader)             # <<<<<<<<<<<<<<
 *         try:
 *             if self._validator is not None:
*/
    __pyx_f_4lxml_5etree__reset_document_loader(__pyx_v_self->_orig_loader);

    /* "src/lxml/parser.pxi":622
 * 
 *     cdef int cleanup(self) except -1:
 *         if self._orig_loader is not NULL:             # <<<<<<<<<<<<<<
 *             _reset_document_loader(self._orig_loader)
 *         try:
*/
  }

  /* "src/lxml/parser.pxi":624
 *         if self._orig_loader is not NULL:
 *             _reset_document_loader(self._orig_loader)
 *         try:             # <<<<<<<<<<<<<<
 *             if self._validator is not None:
 *                 self._validator.disconnect()
*/
  /*try:*/ {

    /* "src/lxml/parser.pxi":625
 *             _reset_document_loader(self._orig_loader)
 *         try:
 *             if self._validator is not None:             # <<<<<<<<<<<<<<
 *                 self._validator.disconnect()
 *             self._resetParserContext()
*/
    __pyx_t_1 = (((PyObject *)__pyx_v_self->_validator) != Py_None);
    if (__pyx_t_1) {

      /* "src/lxml/parser.pxi":626
 *         try:
 *             if self._validator is not None:
 *                 self._validator.disconnect()             # <<<<<<<<<<<<<<
 *             self._resetParserContext()
 *             self.clear()
*/
      __pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_disconnect(__pyx_v_self->_validator);

      /* "src/lxml/parser.pxi":625
 *             _reset_document_loader(self._orig_loader)
 *         try:
 *             if self._validator is not None:             # <<<<<<<<<<<<<<
 *                 self._validator.disconnect()
 *             self._resetParserContext()
*/
    }

    /* "src/lxml/parser.pxi":627
 *             if self._validator is not None:
 *                 self._validator.disconnect()
 *             self._resetParserContext()             # <<<<<<<<<<<<<<
 *             self.clear()
 *             self._doc = None
*/
    ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->_resetParserContext(__pyx_v_self);

    /* "src/lxml/parser.pxi":628
 *                 self._validator.disconnect()
 *             self._resetParserContext()
 *             self.clear()             # <<<<<<<<<<<<<<
 *             self._doc = None
 *             self._c_ctxt.sax.serror = NULL
*/
    __pyx_t_2 = __pyx_f_4lxml_5etree_16_ResolverContext_clear(((struct __pyx_obj_4lxml_5etree__ResolverContext *)__pyx_v_self)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(2, 628, __pyx_L5_error)

    /* "src/lxml/parser.pxi":629
 *             self._resetParserContext()
 *             self.clear()
 *             self._doc = None             # <<<<<<<<<<<<<<
 *             self._c_ctxt.sax.serror = NULL
 *         finally:
*/
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF((PyObject *)__pyx_v_self->_doc);
    __Pyx_DECREF((PyObject *)__pyx_v_self->_doc);
    __pyx_v_self->_doc = ((struct LxmlDocument *)Py_None);

    /* "src/lxml/parser.pxi":630
 *             self.clear()
 *             self._doc = None
 *             self._c_ctxt.sax.serror = NULL             # <<<<<<<<<<<<<<
 *         finally:
 *             if config.ENABLE_THREADING and self._lock is not NULL:
*/
    __pyx_v_self->_c_ctxt->sax->serror = NULL;
  }

  /* "src/lxml/parser.pxi":632
 *             self._c_ctxt.sax.serror = NULL
 *         finally:
 *             if config.ENABLE_THREADING and self._lock is not NULL:             # <<<<<<<<<<<<<<
 *                 python.PyThread_release_lock(self._lock)
 *         return 0
*/
  /*finally:*/ {
    /*normal exit:*/{
      if (ENABLE_THREADING) {
      } else {
        __pyx_t_1 = ENABLE_THREADING;
        goto __pyx_L9_bool_binop_done;
      }
      __pyx_t_3 = (__pyx_v_self->_lock != NULL);
      __pyx_t_1 = __pyx_t_3;
      __pyx_L9_bool_binop_done:;
      if (__pyx_t_1) {

        /* "src/lxml/parser.pxi":633
 *         finally:
 *             if config.ENABLE_THREADING and self._lock is not NULL:
 *                 python.PyThread_release_lock(self._lock)             # <<<<<<<<<<<<<<
 *         return 0
 * 
*/
        PyThread_release_lock(__pyx_v_self->_lock);

        /* "src/lxml/parser.pxi":632
 *             self._c_ctxt.sax.serror = NULL
 *         finally:
 *             if config.ENABLE_THREADING and self._lock is not NULL:             # <<<<<<<<<<<<<<
 *                 python.PyThread_release_lock(self._lock)
 *         return 0
*/
      }
      goto __pyx_L6;
    }
    __pyx_L5_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      if ( unlikely(__Pyx_GetException(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8) < 0)) __Pyx_ErrFetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __pyx_t_2 = __pyx_lineno; __pyx_t_4 = __pyx_clineno; __pyx_t_5 = __pyx_filename;
      {
        if (ENABLE_THREADING) {
        } else {
          __pyx_t_1 = ENABLE_THREADING;
          goto __pyx_L14_bool_binop_done;
        }
        __pyx_t_3 = (__pyx_v_self->_lock != NULL);
        __pyx_t_1 = __pyx_t_3;
        __pyx_L14_bool_binop_done:;
        if (__pyx_t_1) {

          /* "src/lxml/parser.pxi":633
 *         finally:
 *             if config.ENABLE_THREADING and self._lock is not NULL:
 *                 python.PyThread_release_lock(self._lock)             # <<<<<<<<<<<<<<
 *         return 0
 * 
*/
          PyThread_release_lock(__pyx_v_self->_lock);

          /* "src/lxml/parser.pxi":632
 *             self._c_ctxt.sax.serror = NULL
 *         finally:
 *             if config.ENABLE_THREADING and self._lock is not NULL:             # <<<<<<<<<<<<<<
 *                 python.PyThread_release_lock(self._lock)
 *         return 0
*/
        }
      }
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_ErrRestore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
      __pyx_lineno = __pyx_t_2; __pyx_clineno = __pyx_t_4; __pyx_filename = __pyx_t_5;
      goto __pyx_L1_error;
    }
    __pyx_L6:;
  }

  /* "src/lxml/parser.pxi":634
 *             if config.ENABLE_THREADING and self._lock is not NULL:
 *                 python.PyThread_release_lock(self._lock)
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     cdef object _handleParseResult(self, _BaseParser parser,
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":621
 *         return 0
 * 
 *     cdef int cleanup(self) except -1:             # <<<<<<<<<<<<<<
 *         if self._orig_loader is not NULL:
 *             _reset_document_loader(self._orig_loader)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._ParserContext.cleanup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":636
 *         return 0
 * 
 *     cdef object _handleParseResult(self, _BaseParser parser,             # <<<<<<<<<<<<<<
 *                                    xmlDoc* result, filename):
 *         c_doc = self._handleParseResultDoc(parser, result, filename)
*/

static PyObject *__pyx_f_4lxml_5etree_14_ParserContext__handleParseResult(struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_self, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser, xmlDoc *__pyx_v_result, PyObject *__pyx_v_filename) {
  xmlDoc *__pyx_v_c_doc;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  xmlDoc *__pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_handleParseResult", 0);

  /* "src/lxml/parser.pxi":638
 *     cdef object _handleParseResult(self, _BaseParser parser,
 *                                    xmlDoc* result, filename):
 *         c_doc = self._handleParseResultDoc(parser, result, filename)             # <<<<<<<<<<<<<<
 *         if self._doc is not None and self._doc._c_doc is c_doc:
 *             return self._doc
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->_handleParseResultDoc(__pyx_v_self, __pyx_v_parser, __pyx_v_result, __pyx_v_filename); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(2, 638, __pyx_L1_error)
  __pyx_v_c_doc = __pyx_t_1;

  /* "src/lxml/parser.pxi":639
 *                                    xmlDoc* result, filename):
 *         c_doc = self._handleParseResultDoc(parser, result, filename)
 *         if self._doc is not None and self._doc._c_doc is c_doc:             # <<<<<<<<<<<<<<
 *             return self._doc
 *         else:
*/
  __pyx_t_3 = (((PyObject *)__pyx_v_self->_doc) != Py_None);
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_self->_doc->_c_doc == __pyx_v_c_doc);
  __pyx_t_2 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "src/lxml/parser.pxi":640
 *         c_doc = self._handleParseResultDoc(parser, result, filename)
 *         if self._doc is not None and self._doc._c_doc is c_doc:
 *             return self._doc             # <<<<<<<<<<<<<<
 *         else:
 *             return _documentFactory(c_doc, parser)
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF((PyObject *)__pyx_v_self->_doc);
    __pyx_r = ((PyObject *)__pyx_v_self->_doc);
    goto __pyx_L0;

    /* "src/lxml/parser.pxi":639
 *                                    xmlDoc* result, filename):
 *         c_doc = self._handleParseResultDoc(parser, result, filename)
 *         if self._doc is not None and self._doc._c_doc is c_doc:             # <<<<<<<<<<<<<<
 *             return self._doc
 *         else:
*/
  }

  /* "src/lxml/parser.pxi":642
 *             return self._doc
 *         else:
 *             return _documentFactory(c_doc, parser)             # <<<<<<<<<<<<<<
 * 
 *     cdef xmlDoc* _handleParseResultDoc(self, _BaseParser parser,
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, __pyx_v_parser)); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 642, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "src/lxml/parser.pxi":636
 *         return 0
 * 
 *     cdef object _handleParseResult(self, _BaseParser parser,             # <<<<<<<<<<<<<<
 *                                    xmlDoc* result, filename):
 *         c_doc = self._handleParseResultDoc(parser, result, filename)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._ParserContext._handleParseResult", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":644
 *             return _documentFactory(c_doc, parser)
 * 
 *     cdef xmlDoc* _handleParseResultDoc(self, _BaseParser parser,             # <<<<<<<<<<<<<<
 *                                        xmlDoc* result, filename) except NULL:
 *         recover = parser._parse_options & xmlparser.XML_PARSE_RECOVER
*/

static xmlDoc *__pyx_f_4lxml_5etree_14_ParserContext__handleParseResultDoc(struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_self, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser, xmlDoc *__pyx_v_result, PyObject *__pyx_v_filename) {
  int __pyx_v_recover;
  xmlDoc *__pyx_r;
  int __pyx_t_1;
  xmlDoc *__pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/parser.pxi":646
 *     cdef xmlDoc* _handleParseResultDoc(self, _BaseParser parser,
 *                                        xmlDoc* result, filename) except NULL:
 *         recover = parser._parse_options & xmlparser.XML_PARSE_RECOVER             # <<<<<<<<<<<<<<
 *         return _handleParseResult(self, self._c_ctxt, result,
 *                                   filename, recover,
*/
  __pyx_v_recover = (__pyx_v_parser->_parse_options & XML_PARSE_RECOVER);

  /* "src/lxml/parser.pxi":649
 *         return _handleParseResult(self, self._c_ctxt, result,
 *                                   filename, recover,
 *                                   free_doc=self._doc is None)             # <<<<<<<<<<<<<<
 * 
 * cdef _initParserContext(_ParserContext context,
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_self->_doc) == Py_None);

  /* "src/lxml/parser.pxi":647
 *                                        xmlDoc* result, filename) except NULL:
 *         recover = parser._parse_options & xmlparser.XML_PARSE_RECOVER
 *         return _handleParseResult(self, self._c_ctxt, result,             # <<<<<<<<<<<<<<
 *                                   filename, recover,
 *                                   free_doc=self._doc is None)
*/
  __pyx_t_2 = __pyx_f_4lxml_5etree__handleParseResult(__pyx_v_self, __pyx_v_self->_c_ctxt, __pyx_v_result, __pyx_v_filename, __pyx_v_recover, __pyx_t_1); if (unlikely(__pyx_t_2 == ((void *)NULL))) __PYX_ERR(2, 647, __pyx_L1_error)
  __pyx_r = __pyx_t_2;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":644
 *             return _documentFactory(c_doc, parser)
 * 
 *     cdef xmlDoc* _handleParseResultDoc(self, _BaseParser parser,             # <<<<<<<<<<<<<<
 *                                        xmlDoc* result, filename) except NULL:
 *         recover = parser._parse_options & xmlparser.XML_PARSE_RECOVER
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._ParserContext._handleParseResultDoc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/parser.pxi":651
 *                                   free_doc=self._doc is None)
 * 
 * cdef _initParserContext(_ParserContext context,             # <<<<<<<<<<<<<<
 *                         _ResolverRegistry resolvers,
 *                         xmlparser.xmlParserCtxt* c_ctxt):
*/

static PyObject *__pyx_f_4lxml_5etree__initParserContext(struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_context, struct __pyx_obj_4lxml_5etree__ResolverRegistry *__pyx_v_resolvers, xmlParserCtxt *__pyx_v_c_ctxt) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_initParserContext", 0);

  /* "src/lxml/parser.pxi":654
 *                         _ResolverRegistry resolvers,
 *                         xmlparser.xmlParserCtxt* c_ctxt):
 *     _initResolverContext(context, resolvers)             # <<<<<<<<<<<<<<
 *     if c_ctxt is not NULL:
 *         context._initParserContext(c_ctxt)
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__initResolverContext(((struct __pyx_obj_4lxml_5etree__ResolverContext *)__pyx_v_context), __pyx_v_resolvers); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 654, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/parser.pxi":655
 *                         xmlparser.xmlParserCtxt* c_ctxt):
 *     _initResolverContext(context, resolvers)
 *     if c_ctxt is not NULL:             # <<<<<<<<<<<<<<
 *         context._initParserContext(c_ctxt)
 * 
*/
  __pyx_t_2 = (__pyx_v_c_ctxt != NULL);
  if (__pyx_t_2) {

    /* "src/lxml/parser.pxi":656
 *     _initResolverContext(context, resolvers)
 *     if c_ctxt is not NULL:
 *         context._initParserContext(c_ctxt)             # <<<<<<<<<<<<<<
 * 
 * cdef void _forwardParserError(xmlparser.xmlParserCtxt* _parser_context, const xmlerror.xmlError* error) noexcept with gil:
*/
    ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->_initParserContext(__pyx_v_context, __pyx_v_c_ctxt);

    /* "src/lxml/parser.pxi":655
 *                         xmlparser.xmlParserCtxt* c_ctxt):
 *     _initResolverContext(context, resolvers)
 *     if c_ctxt is not NULL:             # <<<<<<<<<<<<<<
 *         context._initParserContext(c_ctxt)
 * 
*/
  }

  /* "src/lxml/parser.pxi":651
 *                                   free_doc=self._doc is None)
 * 
 * cdef _initParserContext(_ParserContext context,             # <<<<<<<<<<<<<<
 *                         _ResolverRegistry resolvers,
 *                         xmlparser.xmlParserCtxt* c_ctxt):
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._initParserContext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":658
 *         context._initParserContext(c_ctxt)
 * 
 * cdef void _forwardParserError(xmlparser.xmlParserCtxt* _parser_context, const xmlerror.xmlError* error) noexcept with gil:             # <<<<<<<<<<<<<<
 *     """
 *     Add an error created by libxml2 to the lxml-level error_log.
*/

static void __pyx_f_4lxml_5etree__forwardParserError(xmlParserCtxt *__pyx_v__parser_context, xmlError const *__pyx_v_error) {
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();

  /* "src/lxml/parser.pxi":662
 *     Add an error created by libxml2 to the lxml-level error_log.
 *     """
 *     (<_ParserContext>_parser_context._private)._error_log._receive(error)             # <<<<<<<<<<<<<<
 * 
 * cdef void _receiveParserError(void* c_context, const xmlerror.xmlError* error) noexcept nogil:
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_13_BaseErrorLog__receive(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_v__parser_context->_private)->_error_log), __pyx_v_error); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(2, 662, __pyx_L1_error)

  /* "src/lxml/parser.pxi":658
 *         context._initParserContext(c_ctxt)
 * 
 * cdef void _forwardParserError(xmlparser.xmlParserCtxt* _parser_context, const xmlerror.xmlError* error) noexcept with gil:             # <<<<<<<<<<<<<<
 *     """
 *     Add an error created by libxml2 to the lxml-level error_log.
*/

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("lxml.etree._forwardParserError", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
}

/* "src/lxml/parser.pxi":664
 *     (<_ParserContext>_parser_context._private)._error_log._receive(error)
 * 
 * cdef void _receiveParserError(void* c_context, const xmlerror.xmlError* error) noexcept nogil:             # <<<<<<<<<<<<<<
 *     if __DEBUG:
 *         if c_context is NULL or (<xmlparser.xmlParserCtxt*>c_context)._private is NULL:
*/

static void __pyx_f_4lxml_5etree__receiveParserError(void *__pyx_v_c_context, xmlError const *__pyx_v_error) {
  int __pyx_t_1;
  int __pyx_t_2;

  /* "src/lxml/parser.pxi":666
 * cdef void _receiveParserError(void* c_context, const xmlerror.xmlError* error) noexcept nogil:
 *     if __DEBUG:
 *         if c_context is NULL or (<xmlparser.xmlParserCtxt*>c_context)._private is NULL:             # <<<<<<<<<<<<<<
 *             _forwardError(NULL, error)
 *         else:
*/
  __pyx_t_2 = (__pyx_v_c_context == NULL);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (((xmlParserCtxt *)__pyx_v_c_context)->_private == NULL);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":667
 *     if __DEBUG:
 *         if c_context is NULL or (<xmlparser.xmlParserCtxt*>c_context)._private is NULL:
 *             _forwardError(NULL, error)             # <<<<<<<<<<<<<<
 *         else:
 *             _forwardParserError(<xmlparser.xmlParserCtxt*>c_context, error)
*/
    __pyx_f_4lxml_5etree__forwardError(NULL, __pyx_v_error);

    /* "src/lxml/parser.pxi":666
 * cdef void _receiveParserError(void* c_context, const xmlerror.xmlError* error) noexcept nogil:
 *     if __DEBUG:
 *         if c_context is NULL or (<xmlparser.xmlParserCtxt*>c_context)._private is NULL:             # <<<<<<<<<<<<<<
 *             _forwardError(NULL, error)
 *         else:
*/
    goto __pyx_L3;
  }

  /* "src/lxml/parser.pxi":669
 *             _forwardError(NULL, error)
 *         else:
 *             _forwardParserError(<xmlparser.xmlParserCtxt*>c_context, error)             # <<<<<<<<<<<<<<
 * 
 * cdef int _raiseParseError(xmlparser.xmlParserCtxt* ctxt, filename,
*/
  /*else*/ {
    __pyx_f_4lxml_5etree__forwardParserError(((xmlParserCtxt *)__pyx_v_c_context), __pyx_v_error);
  }
  __pyx_L3:;

  /* "src/lxml/parser.pxi":664
 *     (<_ParserContext>_parser_context._private)._error_log._receive(error)
 * 
 * cdef void _receiveParserError(void* c_context, const xmlerror.xmlError* error) noexcept nogil:             # <<<<<<<<<<<<<<
 *     if __DEBUG:
 *         if c_context is NULL or (<xmlparser.xmlParserCtxt*>c_context)._private is NULL:
*/

  /* function exit code */
}

/* "src/lxml/parser.pxi":671
 *             _forwardParserError(<xmlparser.xmlParserCtxt*>c_context, error)
 * 
 * cdef int _raiseParseError(xmlparser.xmlParserCtxt* ctxt, filename,             # <<<<<<<<<<<<<<
 *                           _ErrorLog error_log) except -1:
 *     if filename is not None and \
*/

static int __pyx_f_4lxml_5etree__raiseParseError(xmlParserCtxt *__pyx_v_ctxt, PyObject *__pyx_v_filename, struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_error_log) {
  PyObject *__pyx_v_message = NULL;
  int __pyx_v_code;
  int __pyx_v_line;
  int __pyx_v_column;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  const xmlChar *__pyx_t_3;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  char *__pyx_t_9;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14[4];
  PyObject *__pyx_t_15[3];
  size_t __pyx_t_16;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_raiseParseError", 0);
  __Pyx_INCREF(__pyx_v_filename);

  /* "src/lxml/parser.pxi":673
 * cdef int _raiseParseError(xmlparser.xmlParserCtxt* ctxt, filename,
 *                           _ErrorLog error_log) except -1:
 *     if filename is not None and \             # <<<<<<<<<<<<<<
 *            ctxt.lastError.domain == xmlerror.XML_FROM_IO:
 *         if isinstance(filename, bytes):
*/
  __pyx_t_2 = (__pyx_v_filename != Py_None);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }

  /* "src/lxml/parser.pxi":674
 *                           _ErrorLog error_log) except -1:
 *     if filename is not None and \
 *            ctxt.lastError.domain == xmlerror.XML_FROM_IO:             # <<<<<<<<<<<<<<
 *         if isinstance(filename, bytes):
 *             filename = _decodeFilenameWithLength(
*/
  __pyx_t_2 = (__pyx_v_ctxt->lastError.domain == XML_FROM_IO);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;

  /* "src/lxml/parser.pxi":673
 * cdef int _raiseParseError(xmlparser.xmlParserCtxt* ctxt, filename,
 *                           _ErrorLog error_log) except -1:
 *     if filename is not None and \             # <<<<<<<<<<<<<<
 *            ctxt.lastError.domain == xmlerror.XML_FROM_IO:
 *         if isinstance(filename, bytes):
*/
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":675
 *     if filename is not None and \
 *            ctxt.lastError.domain == xmlerror.XML_FROM_IO:
 *         if isinstance(filename, bytes):             # <<<<<<<<<<<<<<
 *             filename = _decodeFilenameWithLength(
 *                 <bytes>filename, len(<bytes>filename))
*/
    __pyx_t_1 = PyBytes_Check(__pyx_v_filename); 
    if (__pyx_t_1) {

      /* "src/lxml/parser.pxi":677
 *         if isinstance(filename, bytes):
 *             filename = _decodeFilenameWithLength(
 *                 <bytes>filename, len(<bytes>filename))             # <<<<<<<<<<<<<<
 *         if ctxt.lastError.message is not NULL:
 *             try:
*/
      if (unlikely(__pyx_v_filename == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
        __PYX_ERR(2, 677, __pyx_L1_error)
      }
      __pyx_t_3 = __Pyx_PyBytes_AsUString(__pyx_v_filename); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(2, 677, __pyx_L1_error)
      if (unlikely(__pyx_v_filename == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
        __PYX_ERR(2, 677, __pyx_L1_error)
      }
      __pyx_t_4 = __Pyx_PyBytes_GET_SIZE(((PyObject*)__pyx_v_filename)); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(2, 677, __pyx_L1_error)

      /* "src/lxml/parser.pxi":676
 *            ctxt.lastError.domain == xmlerror.XML_FROM_IO:
 *         if isinstance(filename, bytes):
 *             filename = _decodeFilenameWithLength(             # <<<<<<<<<<<<<<
 *                 <bytes>filename, len(<bytes>filename))
 *         if ctxt.lastError.message is not NULL:
*/
      __pyx_t_5 = __pyx_f_4lxml_5etree__decodeFilenameWithLength(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 676, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF_SET(__pyx_v_filename, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "src/lxml/parser.pxi":675
 *     if filename is not None and \
 *            ctxt.lastError.domain == xmlerror.XML_FROM_IO:
 *         if isinstance(filename, bytes):             # <<<<<<<<<<<<<<
 *             filename = _decodeFilenameWithLength(
 *                 <bytes>filename, len(<bytes>filename))
*/
    }

    /* "src/lxml/parser.pxi":678
 *             filename = _decodeFilenameWithLength(
 *                 <bytes>filename, len(<bytes>filename))
 *         if ctxt.lastError.message is not NULL:             # <<<<<<<<<<<<<<
 *             try:
 *                 message = ctxt.lastError.message.decode('utf-8')
*/
    __pyx_t_1 = (__pyx_v_ctxt->lastError.message != NULL);
    if (__pyx_t_1) {

      /* "src/lxml/parser.pxi":679
 *                 <bytes>filename, len(<bytes>filename))
 *         if ctxt.lastError.message is not NULL:
 *             try:             # <<<<<<<<<<<<<<
 *                 message = ctxt.lastError.message.decode('utf-8')
 *             except UnicodeDecodeError:
*/
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_6);
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_8);
        /*try:*/ {

          /* "src/lxml/parser.pxi":680
 *         if ctxt.lastError.message is not NULL:
 *             try:
 *                 message = ctxt.lastError.message.decode('utf-8')             # <<<<<<<<<<<<<<
 *             except UnicodeDecodeError:
 *                 # the filename may be in there => play it safe
*/
          __pyx_t_9 = __pyx_v_ctxt->lastError.message;
          __pyx_t_4 = __Pyx_ssize_strlen(__pyx_t_9); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(2, 680, __pyx_L8_error)
          __pyx_t_5 = __Pyx_decode_c_string(__pyx_t_9, 0, __pyx_t_4, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 680, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_5);
          __pyx_v_message = __pyx_t_5;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

          /* "src/lxml/parser.pxi":679
 *                 <bytes>filename, len(<bytes>filename))
 *         if ctxt.lastError.message is not NULL:
 *             try:             # <<<<<<<<<<<<<<
 *                 message = ctxt.lastError.message.decode('utf-8')
 *             except UnicodeDecodeError:
*/
        }
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L13_try_end;
        __pyx_L8_error:;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "src/lxml/parser.pxi":681
 *             try:
 *                 message = ctxt.lastError.message.decode('utf-8')
 *             except UnicodeDecodeError:             # <<<<<<<<<<<<<<
 *                 # the filename may be in there => play it safe
 *                 message = ctxt.lastError.message.decode('iso8859-1')
*/
        __pyx_t_10 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_UnicodeDecodeError))));
        if (__pyx_t_10) {
          __Pyx_AddTraceback("lxml.etree._raiseParseError", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_11, &__pyx_t_12) < 0) __PYX_ERR(2, 681, __pyx_L10_except_error)
          __Pyx_XGOTREF(__pyx_t_5);
          __Pyx_XGOTREF(__pyx_t_11);
          __Pyx_XGOTREF(__pyx_t_12);

          /* "src/lxml/parser.pxi":683
 *             except UnicodeDecodeError:
 *                 # the filename may be in there => play it safe
 *                 message = ctxt.lastError.message.decode('iso8859-1')             # <<<<<<<<<<<<<<
 *             message = f"Error reading file '{filename}': {message.strip()}"
 *         else:
*/
          __pyx_t_9 = __pyx_v_ctxt->lastError.message;
          __pyx_t_4 = __Pyx_ssize_strlen(__pyx_t_9); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(2, 683, __pyx_L10_except_error)
          __pyx_t_13 = __Pyx_decode_c_string(__pyx_t_9, 0, __pyx_t_4, NULL, NULL, PyUnicode_DecodeLatin1); if (unlikely(!__pyx_t_13)) __PYX_ERR(2, 683, __pyx_L10_except_error)
          __Pyx_GOTREF(__pyx_t_13);
          __Pyx_INCREF(__pyx_t_13);
          __Pyx_XDECREF_SET(__pyx_v_message, __pyx_t_13);
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
          goto __pyx_L9_exception_handled;
        }
        goto __pyx_L10_except_error;

        /* "src/lxml/parser.pxi":679
 *                 <bytes>filename, len(<bytes>filename))
 *         if ctxt.lastError.message is not NULL:
 *             try:             # <<<<<<<<<<<<<<
 *                 message = ctxt.lastError.message.decode('utf-8')
 *             except UnicodeDecodeError:
*/
        __pyx_L10_except_error:;
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
        goto __pyx_L1_error;
        __pyx_L9_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
        __pyx_L13_try_end:;
      }

      /* "src/lxml/parser.pxi":684
 *                 # the filename may be in there => play it safe
 *                 message = ctxt.lastError.message.decode('iso8859-1')
 *             message = f"Error reading file '{filename}': {message.strip()}"             # <<<<<<<<<<<<<<
 *         else:
 *             message = f"Error reading '{filename}'"
*/
      __pyx_t_12 = __Pyx_PyObject_FormatSimple(__pyx_v_filename, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_12)) __PYX_ERR(2, 684, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_message, __pyx_mstate_global->__pyx_n_u_strip); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 684, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_11); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 684, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_11 = __Pyx_PyObject_FormatSimple(__pyx_t_5, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 684, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_14[0] = __pyx_mstate_global->__pyx_kp_u_Error_reading_file;
      __pyx_t_14[1] = __pyx_t_12;
      __pyx_t_14[2] = __pyx_mstate_global->__pyx_kp_u__29;
      __pyx_t_14[3] = __pyx_t_11;
      __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_14, 4, 20 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_12) + 3 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_11), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_12) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_11));
      if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 684, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF_SET(__pyx_v_message, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "src/lxml/parser.pxi":678
 *             filename = _decodeFilenameWithLength(
 *                 <bytes>filename, len(<bytes>filename))
 *         if ctxt.lastError.message is not NULL:             # <<<<<<<<<<<<<<
 *             try:
 *                 message = ctxt.lastError.message.decode('utf-8')
*/
      goto __pyx_L7;
    }

    /* "src/lxml/parser.pxi":686
 *             message = f"Error reading file '{filename}': {message.strip()}"
 *         else:
 *             message = f"Error reading '{filename}'"             # <<<<<<<<<<<<<<
 *         raise IOError, message
 *     elif error_log:
*/
    /*else*/ {
      __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_v_filename, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 686, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_15[0] = __pyx_mstate_global->__pyx_kp_u_Error_reading;
      __pyx_t_15[1] = __pyx_t_5;
      __pyx_t_15[2] = __pyx_mstate_global->__pyx_kp_u__4;
      __pyx_t_11 = __Pyx_PyUnicode_Join(__pyx_t_15, 3, 15 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5));
      if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 686, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_v_message = __pyx_t_11;
      __pyx_t_11 = 0;
    }
    __pyx_L7:;

    /* "src/lxml/parser.pxi":687
 *         else:
 *             message = f"Error reading '{filename}'"
 *         raise IOError, message             # <<<<<<<<<<<<<<
 *     elif error_log:
 *         raise error_log._buildParseException(
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_IOError))), __pyx_v_message, 0, 0);
    __PYX_ERR(2, 687, __pyx_L1_error)

    /* "src/lxml/parser.pxi":673
 * cdef int _raiseParseError(xmlparser.xmlParserCtxt* ctxt, filename,
 *                           _ErrorLog error_log) except -1:
 *     if filename is not None and \             # <<<<<<<<<<<<<<
 *            ctxt.lastError.domain == xmlerror.XML_FROM_IO:
 *         if isinstance(filename, bytes):
*/
  }

  /* "src/lxml/parser.pxi":688
 *             message = f"Error reading '{filename}'"
 *         raise IOError, message
 *     elif error_log:             # <<<<<<<<<<<<<<
 *         raise error_log._buildParseException(
 *             XMLSyntaxError, "Document is not well formed")
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_error_log)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(2, 688, __pyx_L1_error)
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/parser.pxi":690
 *     elif error_log:
 *         raise error_log._buildParseException(
 *             XMLSyntaxError, "Document is not well formed")             # <<<<<<<<<<<<<<
 *     elif ctxt.lastError.message is not NULL:
 *         message = ctxt.lastError.message.strip()
*/
    __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_XMLSyntaxError); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 690, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);

    /* "src/lxml/parser.pxi":689
 *         raise IOError, message
 *     elif error_log:
 *         raise error_log._buildParseException(             # <<<<<<<<<<<<<<
 *             XMLSyntaxError, "Document is not well formed")
 *     elif ctxt.lastError.message is not NULL:
*/
    __pyx_t_5 = __pyx_f_4lxml_5etree_13_BaseErrorLog__buildParseException(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_error_log), __pyx_t_11, __pyx_mstate_global->__pyx_kp_u_Document_is_not_well_formed); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 689, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __PYX_ERR(2, 689, __pyx_L1_error)

    /* "src/lxml/parser.pxi":688
 *             message = f"Error reading '{filename}'"
 *         raise IOError, message
 *     elif error_log:             # <<<<<<<<<<<<<<
 *         raise error_log._buildParseException(
 *             XMLSyntaxError, "Document is not well formed")
*/
  }

  /* "src/lxml/parser.pxi":691
 *         raise error_log._buildParseException(
 *             XMLSyntaxError, "Document is not well formed")
 *     elif ctxt.lastError.message is not NULL:             # <<<<<<<<<<<<<<
 *         message = ctxt.lastError.message.strip()
 *         code = ctxt.lastError.code
*/
  __pyx_t_1 = (__pyx_v_ctxt->lastError.message != NULL);
  if (likely(__pyx_t_1)) {

    /* "src/lxml/parser.pxi":692
 *             XMLSyntaxError, "Document is not well formed")
 *     elif ctxt.lastError.message is not NULL:
 *         message = ctxt.lastError.message.strip()             # <<<<<<<<<<<<<<
 *         code = ctxt.lastError.code
 *         line = ctxt.lastError.line
*/
    __pyx_t_12 = __Pyx_PyBytes_FromString(__pyx_v_ctxt->lastError.message); if (unlikely(!__pyx_t_12)) __PYX_ERR(2, 692, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_11 = __pyx_t_12;
    __Pyx_INCREF(__pyx_t_11);
    __pyx_t_16 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_11, NULL};
      __pyx_t_5 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_strip, __pyx_callargs+__pyx_t_16, (1-__pyx_t_16) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 692, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    }
    __pyx_v_message = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "src/lxml/parser.pxi":693
 *     elif ctxt.lastError.message is not NULL:
 *         message = ctxt.lastError.message.strip()
 *         code = ctxt.lastError.code             # <<<<<<<<<<<<<<
 *         line = ctxt.lastError.line
 *         column = ctxt.lastError.int2
*/
    __pyx_t_10 = __pyx_v_ctxt->lastError.code;
    __pyx_v_code = __pyx_t_10;

    /* "src/lxml/parser.pxi":694
 *         message = ctxt.lastError.message.strip()
 *         code = ctxt.lastError.code
 *         line = ctxt.lastError.line             # <<<<<<<<<<<<<<
 *         column = ctxt.lastError.int2
 *         if ctxt.lastError.line > 0:
*/
    __pyx_t_10 = __pyx_v_ctxt->lastError.line;
    __pyx_v_line = __pyx_t_10;

    /* "src/lxml/parser.pxi":695
 *         code = ctxt.lastError.code
 *         line = ctxt.lastError.line
 *         column = ctxt.lastError.int2             # <<<<<<<<<<<<<<
 *         if ctxt.lastError.line > 0:
 *             message = f"line {line}: {message}"
*/
    __pyx_t_10 = __pyx_v_ctxt->lastError.int2;
    __pyx_v_column = __pyx_t_10;

    /* "src/lxml/parser.pxi":696
 *         line = ctxt.lastError.line
 *         column = ctxt.lastError.int2
 *         if ctxt.lastError.line > 0:             # <<<<<<<<<<<<<<
 *             message = f"line {line}: {message}"
 *         raise XMLSyntaxError(message, code, line, column, filename)
*/
    __pyx_t_1 = (__pyx_v_ctxt->lastError.line > 0);
    if (__pyx_t_1) {

      /* "src/lxml/parser.pxi":697
 *         column = ctxt.lastError.int2
 *         if ctxt.lastError.line > 0:
 *             message = f"line {line}: {message}"             # <<<<<<<<<<<<<<
 *         raise XMLSyntaxError(message, code, line, column, filename)
 *     else:
*/
      __pyx_t_5 = __Pyx_PyUnicode_From_int(__pyx_v_line, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 697, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_12 = __Pyx_PyObject_FormatSimple(__pyx_v_message, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_12)) __PYX_ERR(2, 697, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_14[0] = __pyx_mstate_global->__pyx_kp_u_line_3;
      __pyx_t_14[1] = __pyx_t_5;
      __pyx_t_14[2] = __pyx_mstate_global->__pyx_kp_u_;
      __pyx_t_14[3] = __pyx_t_12;
      __pyx_t_11 = __Pyx_PyUnicode_Join(__pyx_t_14, 4, 5 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_12), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_12));
      if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 697, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF_SET(__pyx_v_message, __pyx_t_11);
      __pyx_t_11 = 0;

      /* "src/lxml/parser.pxi":696
 *         line = ctxt.lastError.line
 *         column = ctxt.lastError.int2
 *         if ctxt.lastError.line > 0:             # <<<<<<<<<<<<<<
 *             message = f"line {line}: {message}"
 *         raise XMLSyntaxError(message, code, line, column, filename)
*/
    }

    /* "src/lxml/parser.pxi":698
 *         if ctxt.lastError.line > 0:
 *             message = f"line {line}: {message}"
 *         raise XMLSyntaxError(message, code, line, column, filename)             # <<<<<<<<<<<<<<
 *     else:
 *         raise XMLSyntaxError(None, xmlerror.XML_ERR_INTERNAL_ERROR, 0, 0,
*/
    __pyx_t_12 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_XMLSyntaxError); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 698, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_13 = __Pyx_PyLong_From_int(__pyx_v_code); if (unlikely(!__pyx_t_13)) __PYX_ERR(2, 698, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_17 = __Pyx_PyLong_From_int(__pyx_v_line); if (unlikely(!__pyx_t_17)) __PYX_ERR(2, 698, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_17);
    __pyx_t_18 = __Pyx_PyLong_From_int(__pyx_v_column); if (unlikely(!__pyx_t_18)) __PYX_ERR(2, 698, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_18);
    __pyx_t_16 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_5);
      assert(__pyx_t_12);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_12);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
      __pyx_t_16 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[6] = {__pyx_t_12, __pyx_v_message, __pyx_t_13, __pyx_t_17, __pyx_t_18, __pyx_v_filename};
      __pyx_t_11 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_16, (6-__pyx_t_16) | (__pyx_t_16*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
      __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 698, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
    }
    __Pyx_Raise(__pyx_t_11, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __PYX_ERR(2, 698, __pyx_L1_error)

    /* "src/lxml/parser.pxi":691
 *         raise error_log._buildParseException(
 *             XMLSyntaxError, "Document is not well formed")
 *     elif ctxt.lastError.message is not NULL:             # <<<<<<<<<<<<<<
 *         message = ctxt.lastError.message.strip()
 *         code = ctxt.lastError.code
*/
  }

  /* "src/lxml/parser.pxi":700
 *         raise XMLSyntaxError(message, code, line, column, filename)
 *     else:
 *         raise XMLSyntaxError(None, xmlerror.XML_ERR_INTERNAL_ERROR, 0, 0,             # <<<<<<<<<<<<<<
 *                              filename)
 * 
*/
  /*else*/ {
    __pyx_t_5 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_18, __pyx_mstate_global->__pyx_n_u_XMLSyntaxError); if (unlikely(!__pyx_t_18)) __PYX_ERR(2, 700, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_18);
    __pyx_t_17 = __Pyx_PyLong_From_xmlParserErrors(XML_ERR_INTERNAL_ERROR); if (unlikely(!__pyx_t_17)) __PYX_ERR(2, 700, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_17);

    /* "src/lxml/parser.pxi":701
 *     else:
 *         raise XMLSyntaxError(None, xmlerror.XML_ERR_INTERNAL_ERROR, 0, 0,
 *                              filename)             # <<<<<<<<<<<<<<
 * 
 * cdef xmlDoc* _handleParseResult(_ParserContext context,
*/
    __pyx_t_16 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_18))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_18);
      assert(__pyx_t_5);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_18);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_18, __pyx__function);
      __pyx_t_16 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[6] = {__pyx_t_5, Py_None, __pyx_t_17, __pyx_mstate_global->__pyx_int_0, __pyx_mstate_global->__pyx_int_0, __pyx_v_filename};
      __pyx_t_11 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_18, __pyx_callargs+__pyx_t_16, (6-__pyx_t_16) | (__pyx_t_16*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
      __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
      if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 700, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
    }
    __Pyx_Raise(__pyx_t_11, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __PYX_ERR(2, 700, __pyx_L1_error)
  }

  /* "src/lxml/parser.pxi":671
 *             _forwardParserError(<xmlparser.xmlParserCtxt*>c_context, error)
 * 
 * cdef int _raiseParseError(xmlparser.xmlParserCtxt* ctxt, filename,             # <<<<<<<<<<<<<<
 *                           _ErrorLog error_log) except -1:
 *     if filename is not None and \
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_17);
  __Pyx_XDECREF(__pyx_t_18);
  __Pyx_AddTraceback("lxml.etree._raiseParseError", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_XDECREF(__pyx_v_message);
  __Pyx_XDECREF(__pyx_v_filename);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":703
 *                              filename)
 * 
 * cdef xmlDoc* _handleParseResult(_ParserContext context,             # <<<<<<<<<<<<<<
 *                                 xmlparser.xmlParserCtxt* c_ctxt,
 *                                 xmlDoc* result, filename,
*/

static xmlDoc *__pyx_f_4lxml_5etree__handleParseResult(struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_context, xmlParserCtxt *__pyx_v_c_ctxt, xmlDoc *__pyx_v_result, PyObject *__pyx_v_filename, int __pyx_v_recover, int __pyx_v_free_doc) {
  int __pyx_v_well_formed;
  PyObject *__pyx_v_error = NULL;
  PyObject *__pyx_9genexpr11__pyx_v_error = NULL;
  xmlDoc *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  size_t __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_handleParseResult", 0);

  /* "src/lxml/parser.pxi":710
 *     # to parse the document.
 *     cdef bint well_formed
 *     if result is not NULL:             # <<<<<<<<<<<<<<
 *         __GLOBAL_PARSER_CONTEXT.initDocDict(result)
 * 
*/
  __pyx_t_1 = (__pyx_v_result != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":711
 *     cdef bint well_formed
 *     if result is not NULL:
 *         __GLOBAL_PARSER_CONTEXT.initDocDict(result)             # <<<<<<<<<<<<<<
 * 
 *     if c_ctxt.myDoc is not NULL:
*/
    __pyx_t_2 = __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initDocDict(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, __pyx_v_result); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(2, 711, __pyx_L1_error)

    /* "src/lxml/parser.pxi":710
 *     # to parse the document.
 *     cdef bint well_formed
 *     if result is not NULL:             # <<<<<<<<<<<<<<
 *         __GLOBAL_PARSER_CONTEXT.initDocDict(result)
 * 
*/
  }

  /* "src/lxml/parser.pxi":713
 *         __GLOBAL_PARSER_CONTEXT.initDocDict(result)
 * 
 *     if c_ctxt.myDoc is not NULL:             # <<<<<<<<<<<<<<
 *         if c_ctxt.myDoc is not result:
 *             __GLOBAL_PARSER_CONTEXT.initDocDict(c_ctxt.myDoc)
*/
  __pyx_t_1 = (__pyx_v_c_ctxt->myDoc != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":714
 * 
 *     if c_ctxt.myDoc is not NULL:
 *         if c_ctxt.myDoc is not result:             # <<<<<<<<<<<<<<
 *             __GLOBAL_PARSER_CONTEXT.initDocDict(c_ctxt.myDoc)
 *             tree.xmlFreeDoc(c_ctxt.myDoc)
*/
    __pyx_t_1 = (__pyx_v_c_ctxt->myDoc != __pyx_v_result);
    if (__pyx_t_1) {

      /* "src/lxml/parser.pxi":715
 *     if c_ctxt.myDoc is not NULL:
 *         if c_ctxt.myDoc is not result:
 *             __GLOBAL_PARSER_CONTEXT.initDocDict(c_ctxt.myDoc)             # <<<<<<<<<<<<<<
 *             tree.xmlFreeDoc(c_ctxt.myDoc)
 *         c_ctxt.myDoc = NULL
*/
      __pyx_t_2 = __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initDocDict(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, __pyx_v_c_ctxt->myDoc); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(2, 715, __pyx_L1_error)

      /* "src/lxml/parser.pxi":716
 *         if c_ctxt.myDoc is not result:
 *             __GLOBAL_PARSER_CONTEXT.initDocDict(c_ctxt.myDoc)
 *             tree.xmlFreeDoc(c_ctxt.myDoc)             # <<<<<<<<<<<<<<
 *         c_ctxt.myDoc = NULL
 * 
*/
      xmlFreeDoc(__pyx_v_c_ctxt->myDoc);

      /* "src/lxml/parser.pxi":714
 * 
 *     if c_ctxt.myDoc is not NULL:
 *         if c_ctxt.myDoc is not result:             # <<<<<<<<<<<<<<
 *             __GLOBAL_PARSER_CONTEXT.initDocDict(c_ctxt.myDoc)
 *             tree.xmlFreeDoc(c_ctxt.myDoc)
*/
    }

    /* "src/lxml/parser.pxi":717
 *             __GLOBAL_PARSER_CONTEXT.initDocDict(c_ctxt.myDoc)
 *             tree.xmlFreeDoc(c_ctxt.myDoc)
 *         c_ctxt.myDoc = NULL             # <<<<<<<<<<<<<<
 * 
 *     if result is not NULL:
*/
    __pyx_v_c_ctxt->myDoc = NULL;

    /* "src/lxml/parser.pxi":713
 *         __GLOBAL_PARSER_CONTEXT.initDocDict(result)
 * 
 *     if c_ctxt.myDoc is not NULL:             # <<<<<<<<<<<<<<
 *         if c_ctxt.myDoc is not result:
 *             __GLOBAL_PARSER_CONTEXT.initDocDict(c_ctxt.myDoc)
*/
  }

  /* "src/lxml/parser.pxi":719
 *         c_ctxt.myDoc = NULL
 * 
 *     if result is not NULL:             # <<<<<<<<<<<<<<
 *         # "wellFormed" in libxml2 is 0 if the parser found fatal errors. It still returns a
 *         # parse result document if 'recover=True'. Here, we determine if we can present
*/
  __pyx_t_1 = (__pyx_v_result != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":723
 *         # parse result document if 'recover=True'. Here, we determine if we can present
 *         # the document to the user or consider it incorrect or broken enough to raise an error.
 *         if (context._validator is not None and             # <<<<<<<<<<<<<<
 *                 not context._validator.isvalid()):
 *             well_formed = 0  # actually not 'valid', but anyway ...
*/
    __pyx_t_3 = (((PyObject *)__pyx_v_context->_validator) != Py_None);
    if (__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L8_bool_binop_done;
    }

    /* "src/lxml/parser.pxi":724
 *         # the document to the user or consider it incorrect or broken enough to raise an error.
 *         if (context._validator is not None and
 *                 not context._validator.isvalid()):             # <<<<<<<<<<<<<<
 *             well_formed = 0  # actually not 'valid', but anyway ...
 *         elif (not c_ctxt.wellFormed and not c_ctxt.html and
*/
    __pyx_t_3 = (!__pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_isvalid(__pyx_v_context->_validator));
    __pyx_t_1 = __pyx_t_3;
    __pyx_L8_bool_binop_done:;

    /* "src/lxml/parser.pxi":723
 *         # parse result document if 'recover=True'. Here, we determine if we can present
 *         # the document to the user or consider it incorrect or broken enough to raise an error.
 *         if (context._validator is not None and             # <<<<<<<<<<<<<<
 *                 not context._validator.isvalid()):
 *             well_formed = 0  # actually not 'valid', but anyway ...
*/
    if (__pyx_t_1) {

      /* "src/lxml/parser.pxi":725
 *         if (context._validator is not None and
 *                 not context._validator.isvalid()):
 *             well_formed = 0  # actually not 'valid', but anyway ...             # <<<<<<<<<<<<<<
 *         elif (not c_ctxt.wellFormed and not c_ctxt.html and
 *                 c_ctxt.charset == tree.XML_CHAR_ENCODING_8859_1 and
*/
      __pyx_v_well_formed = 0;

      /* "src/lxml/parser.pxi":723
 *         # parse result document if 'recover=True'. Here, we determine if we can present
 *         # the document to the user or consider it incorrect or broken enough to raise an error.
 *         if (context._validator is not None and             # <<<<<<<<<<<<<<
 *                 not context._validator.isvalid()):
 *             well_formed = 0  # actually not 'valid', but anyway ...
*/
      goto __pyx_L7;
    }

    /* "src/lxml/parser.pxi":726
 *                 not context._validator.isvalid()):
 *             well_formed = 0  # actually not 'valid', but anyway ...
 *         elif (not c_ctxt.wellFormed and not c_ctxt.html and             # <<<<<<<<<<<<<<
 *                 c_ctxt.charset == tree.XML_CHAR_ENCODING_8859_1 and
 *                 [1 for error in context._error_log
*/
    __pyx_t_3 = (!__pyx_v_c_ctxt->wellFormed);
    if (__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L10_bool_binop_done;
    }
    __pyx_t_3 = (!__pyx_v_c_ctxt->html);
    if (__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L10_bool_binop_done;
    }

    /* "src/lxml/parser.pxi":727
 *             well_formed = 0  # actually not 'valid', but anyway ...
 *         elif (not c_ctxt.wellFormed and not c_ctxt.html and
 *                 c_ctxt.charset == tree.XML_CHAR_ENCODING_8859_1 and             # <<<<<<<<<<<<<<
 *                 [1 for error in context._error_log
 *                  if error.type == ErrorTypes.ERR_INVALID_CHAR]):
*/
    __pyx_t_3 = (__pyx_v_c_ctxt->charset == XML_CHAR_ENCODING_8859_1);
    if (__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L10_bool_binop_done;
    }

    /* "src/lxml/parser.pxi":728
 *         elif (not c_ctxt.wellFormed and not c_ctxt.html and
 *                 c_ctxt.charset == tree.XML_CHAR_ENCODING_8859_1 and
 *                 [1 for error in context._error_log             # <<<<<<<<<<<<<<
 *                  if error.type == ErrorTypes.ERR_INVALID_CHAR]):
 *             # An encoding error occurred and libxml2 switched from UTF-8
*/
    { /* enter inner scope */
      __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 728, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (likely(PyList_CheckExact(((PyObject *)__pyx_v_context->_error_log))) || PyTuple_CheckExact(((PyObject *)__pyx_v_context->_error_log))) {
        __pyx_t_5 = ((PyObject *)__pyx_v_context->_error_log); __Pyx_INCREF(__pyx_t_5);
        __pyx_t_6 = 0;
        __pyx_t_7 = NULL;
      } else {
        __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(((PyObject *)__pyx_v_context->_error_log)); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 728, __pyx_L16_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 728, __pyx_L16_error)
      }
      for (;;) {
        if (likely(!__pyx_t_7)) {
          if (likely(PyList_CheckExact(__pyx_t_5))) {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_5);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(2, 728, __pyx_L16_error)
              #endif
              if (__pyx_t_6 >= __pyx_temp) break;
            }
            __pyx_t_8 = __Pyx_PyList_GetItemRefFast(__pyx_t_5, __pyx_t_6, __Pyx_ReferenceSharing_OwnStrongReference);
            ++__pyx_t_6;
          } else {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_5);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(2, 728, __pyx_L16_error)
              #endif
              if (__pyx_t_6 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_8 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6));
            #else
            __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_5, __pyx_t_6);
            #endif
            ++__pyx_t_6;
          }
          if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 728, __pyx_L16_error)
        } else {
          __pyx_t_8 = __pyx_t_7(__pyx_t_5);
          if (unlikely(!__pyx_t_8)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(2, 728, __pyx_L16_error)
              PyErr_Clear();
            }
            break;
          }
        }
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_XDECREF_SET(__pyx_9genexpr11__pyx_v_error, __pyx_t_8);
        __pyx_t_8 = 0;

        /* "src/lxml/parser.pxi":729
 *                 c_ctxt.charset == tree.XML_CHAR_ENCODING_8859_1 and
 *                 [1 for error in context._error_log
 *                  if error.type == ErrorTypes.ERR_INVALID_CHAR]):             # <<<<<<<<<<<<<<
 *             # An encoding error occurred and libxml2 switched from UTF-8
 *             # input to (undecoded) Latin-1, at some arbitrary point in the
*/
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_9genexpr11__pyx_v_error, __pyx_mstate_global->__pyx_n_u_type); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 729, __pyx_L16_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_ErrorTypes); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 729, __pyx_L16_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_ERR_INVALID_CHAR); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 729, __pyx_L16_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_9 = PyObject_RichCompare(__pyx_t_8, __pyx_t_10, Py_EQ); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 729, __pyx_L16_error)
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(2, 729, __pyx_L16_error)
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (__pyx_t_3) {
          if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_mstate_global->__pyx_int_1))) __PYX_ERR(2, 728, __pyx_L16_error)
        }

        /* "src/lxml/parser.pxi":728
 *         elif (not c_ctxt.wellFormed and not c_ctxt.html and
 *                 c_ctxt.charset == tree.XML_CHAR_ENCODING_8859_1 and
 *                 [1 for error in context._error_log             # <<<<<<<<<<<<<<
 *                  if error.type == ErrorTypes.ERR_INVALID_CHAR]):
 *             # An encoding error occurred and libxml2 switched from UTF-8
*/
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_9genexpr11__pyx_v_error); __pyx_9genexpr11__pyx_v_error = 0;
      goto __pyx_L21_exit_scope;
      __pyx_L16_error:;
      __Pyx_XDECREF(__pyx_9genexpr11__pyx_v_error); __pyx_9genexpr11__pyx_v_error = 0;
      goto __pyx_L1_error;
      __pyx_L21_exit_scope:;
    } /* exit inner scope */
    {
      Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_4);
      if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(2, 728, __pyx_L1_error)
      __pyx_t_3 = (__pyx_temp != 0);
    }

    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_1 = __pyx_t_3;
    __pyx_L10_bool_binop_done:;

    /* "src/lxml/parser.pxi":726
 *                 not context._validator.isvalid()):
 *             well_formed = 0  # actually not 'valid', but anyway ...
 *         elif (not c_ctxt.wellFormed and not c_ctxt.html and             # <<<<<<<<<<<<<<
 *                 c_ctxt.charset == tree.XML_CHAR_ENCODING_8859_1 and
 *                 [1 for error in context._error_log
*/
    if (__pyx_t_1) {

      /* "src/lxml/parser.pxi":734
 *             # document.  Better raise an error than allowing for a broken
 *             # tree with mixed encodings. This is fixed in libxml2 2.12.
 *             well_formed = 0             # <<<<<<<<<<<<<<
 *         elif recover or (c_ctxt.wellFormed and
 *                          c_ctxt.lastError.level < xmlerror.XML_ERR_ERROR):
*/
      __pyx_v_well_formed = 0;

      /* "src/lxml/parser.pxi":726
 *                 not context._validator.isvalid()):
 *             well_formed = 0  # actually not 'valid', but anyway ...
 *         elif (not c_ctxt.wellFormed and not c_ctxt.html and             # <<<<<<<<<<<<<<
 *                 c_ctxt.charset == tree.XML_CHAR_ENCODING_8859_1 and
 *                 [1 for error in context._error_log
*/
      goto __pyx_L7;
    }

    /* "src/lxml/parser.pxi":735
 *             # tree with mixed encodings. This is fixed in libxml2 2.12.
 *             well_formed = 0
 *         elif recover or (c_ctxt.wellFormed and             # <<<<<<<<<<<<<<
 *                          c_ctxt.lastError.level < xmlerror.XML_ERR_ERROR):
 *             well_formed = 1
*/
    if (!__pyx_v_recover) {
    } else {
      __pyx_t_1 = __pyx_v_recover;
      goto __pyx_L22_bool_binop_done;
    }
    if (__pyx_v_c_ctxt->wellFormed) {
    } else {
      __pyx_t_1 = __pyx_v_c_ctxt->wellFormed;
      goto __pyx_L22_bool_binop_done;
    }

    /* "src/lxml/parser.pxi":736
 *             well_formed = 0
 *         elif recover or (c_ctxt.wellFormed and
 *                          c_ctxt.lastError.level < xmlerror.XML_ERR_ERROR):             # <<<<<<<<<<<<<<
 *             well_formed = 1
 *         elif not c_ctxt.replaceEntities and not c_ctxt.validate \
*/
    __pyx_t_3 = (__pyx_v_c_ctxt->lastError.level < XML_ERR_ERROR);
    __pyx_t_1 = __pyx_t_3;
    __pyx_L22_bool_binop_done:;

    /* "src/lxml/parser.pxi":735
 *             # tree with mixed encodings. This is fixed in libxml2 2.12.
 *             well_formed = 0
 *         elif recover or (c_ctxt.wellFormed and             # <<<<<<<<<<<<<<
 *                          c_ctxt.lastError.level < xmlerror.XML_ERR_ERROR):
 *             well_formed = 1
*/
    if (__pyx_t_1) {

      /* "src/lxml/parser.pxi":737
 *         elif recover or (c_ctxt.wellFormed and
 *                          c_ctxt.lastError.level < xmlerror.XML_ERR_ERROR):
 *             well_formed = 1             # <<<<<<<<<<<<<<
 *         elif not c_ctxt.replaceEntities and not c_ctxt.validate \
 *                  and context is not None:
*/
      __pyx_v_well_formed = 1;

      /* "src/lxml/parser.pxi":735
 *             # tree with mixed encodings. This is fixed in libxml2 2.12.
 *             well_formed = 0
 *         elif recover or (c_ctxt.wellFormed and             # <<<<<<<<<<<<<<
 *                          c_ctxt.lastError.level < xmlerror.XML_ERR_ERROR):
 *             well_formed = 1
*/
      goto __pyx_L7;
    }

    /* "src/lxml/parser.pxi":738
 *                          c_ctxt.lastError.level < xmlerror.XML_ERR_ERROR):
 *             well_formed = 1
 *         elif not c_ctxt.replaceEntities and not c_ctxt.validate \             # <<<<<<<<<<<<<<
 *                  and context is not None:
 *             # in this mode, we ignore errors about undefined entities
*/
    __pyx_t_3 = (!__pyx_v_c_ctxt->replaceEntities);
    if (__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L25_bool_binop_done;
    }

    /* "src/lxml/parser.pxi":739
 *             well_formed = 1
 *         elif not c_ctxt.replaceEntities and not c_ctxt.validate \
 *                  and context is not None:             # <<<<<<<<<<<<<<
 *             # in this mode, we ignore errors about undefined entities
 *             for error in context._error_log.filter_from_errors():
*/
    __pyx_t_3 = (!__pyx_v_c_ctxt->validate);
    if (__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L25_bool_binop_done;
    }
    __pyx_t_3 = (((PyObject *)__pyx_v_context) != Py_None);
    __pyx_t_1 = __pyx_t_3;
    __pyx_L25_bool_binop_done:;

    /* "src/lxml/parser.pxi":738
 *                          c_ctxt.lastError.level < xmlerror.XML_ERR_ERROR):
 *             well_formed = 1
 *         elif not c_ctxt.replaceEntities and not c_ctxt.validate \             # <<<<<<<<<<<<<<
 *                  and context is not None:
 *             # in this mode, we ignore errors about undefined entities
*/
    if (__pyx_t_1) {

      /* "src/lxml/parser.pxi":741
 *                  and context is not None:
 *             # in this mode, we ignore errors about undefined entities
 *             for error in context._error_log.filter_from_errors():             # <<<<<<<<<<<<<<
 *                 if error.type != ErrorTypes.WAR_UNDECLARED_ENTITY and \
 *                        error.type != ErrorTypes.ERR_UNDECLARED_ENTITY:
*/
      __pyx_t_5 = ((PyObject *)__pyx_v_context->_error_log);
      __Pyx_INCREF(__pyx_t_5);
      __pyx_t_11 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};
        __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_filter_from_errors, __pyx_callargs+__pyx_t_11, (1-__pyx_t_11) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 741, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
      }
      if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
        __pyx_t_5 = __pyx_t_4; __Pyx_INCREF(__pyx_t_5);
        __pyx_t_6 = 0;
        __pyx_t_7 = NULL;
      } else {
        __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 741, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 741, __pyx_L1_error)
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      for (;;) {
        if (likely(!__pyx_t_7)) {
          if (likely(PyList_CheckExact(__pyx_t_5))) {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_5);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(2, 741, __pyx_L1_error)
              #endif
              if (__pyx_t_6 >= __pyx_temp) break;
            }
            __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_5, __pyx_t_6, __Pyx_ReferenceSharing_OwnStrongReference);
            ++__pyx_t_6;
          } else {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_5);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(2, 741, __pyx_L1_error)
              #endif
              if (__pyx_t_6 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6));
            #else
            __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_5, __pyx_t_6);
            #endif
            ++__pyx_t_6;
          }
          if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 741, __pyx_L1_error)
        } else {
          __pyx_t_4 = __pyx_t_7(__pyx_t_5);
          if (unlikely(!__pyx_t_4)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(2, 741, __pyx_L1_error)
              PyErr_Clear();
            }
            break;
          }
        }
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_XDECREF_SET(__pyx_v_error, __pyx_t_4);
        __pyx_t_4 = 0;

        /* "src/lxml/parser.pxi":742
 *             # in this mode, we ignore errors about undefined entities
 *             for error in context._error_log.filter_from_errors():
 *                 if error.type != ErrorTypes.WAR_UNDECLARED_ENTITY and \             # <<<<<<<<<<<<<<
 *                        error.type != ErrorTypes.ERR_UNDECLARED_ENTITY:
 *                     well_formed = 0
*/
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_error, __pyx_mstate_global->__pyx_n_u_type); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 742, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_ErrorTypes); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 742, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_WAR_UNDECLARED_ENTITY); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 742, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_9 = PyObject_RichCompare(__pyx_t_4, __pyx_t_10, Py_NE); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 742, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(2, 742, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (__pyx_t_3) {
        } else {
          __pyx_t_1 = __pyx_t_3;
          goto __pyx_L31_bool_binop_done;
        }

        /* "src/lxml/parser.pxi":743
 *             for error in context._error_log.filter_from_errors():
 *                 if error.type != ErrorTypes.WAR_UNDECLARED_ENTITY and \
 *                        error.type != ErrorTypes.ERR_UNDECLARED_ENTITY:             # <<<<<<<<<<<<<<
 *                     well_formed = 0
 *                     break
*/
        __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_error, __pyx_mstate_global->__pyx_n_u_type); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 743, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_ErrorTypes); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 743, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_ERR_UNDECLARED_ENTITY); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 743, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_10 = PyObject_RichCompare(__pyx_t_9, __pyx_t_4, Py_NE); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 743, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(2, 743, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_1 = __pyx_t_3;
        __pyx_L31_bool_binop_done:;

        /* "src/lxml/parser.pxi":742
 *             # in this mode, we ignore errors about undefined entities
 *             for error in context._error_log.filter_from_errors():
 *                 if error.type != ErrorTypes.WAR_UNDECLARED_ENTITY and \             # <<<<<<<<<<<<<<
 *                        error.type != ErrorTypes.ERR_UNDECLARED_ENTITY:
 *                     well_formed = 0
*/
        if (__pyx_t_1) {

          /* "src/lxml/parser.pxi":744
 *                 if error.type != ErrorTypes.WAR_UNDECLARED_ENTITY and \
 *                        error.type != ErrorTypes.ERR_UNDECLARED_ENTITY:
 *                     well_formed = 0             # <<<<<<<<<<<<<<
 *                     break
 *             else:
*/
          __pyx_v_well_formed = 0;

          /* "src/lxml/parser.pxi":745
 *                        error.type != ErrorTypes.ERR_UNDECLARED_ENTITY:
 *                     well_formed = 0
 *                     break             # <<<<<<<<<<<<<<
 *             else:
 *                 well_formed = 1
*/
          goto __pyx_L29_break;

          /* "src/lxml/parser.pxi":742
 *             # in this mode, we ignore errors about undefined entities
 *             for error in context._error_log.filter_from_errors():
 *                 if error.type != ErrorTypes.WAR_UNDECLARED_ENTITY and \             # <<<<<<<<<<<<<<
 *                        error.type != ErrorTypes.ERR_UNDECLARED_ENTITY:
 *                     well_formed = 0
*/
        }

        /* "src/lxml/parser.pxi":741
 *                  and context is not None:
 *             # in this mode, we ignore errors about undefined entities
 *             for error in context._error_log.filter_from_errors():             # <<<<<<<<<<<<<<
 *                 if error.type != ErrorTypes.WAR_UNDECLARED_ENTITY and \
 *                        error.type != ErrorTypes.ERR_UNDECLARED_ENTITY:
*/
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L33_for_else;
      __pyx_L29_break:;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L34_for_end;
      /*else*/ {
        __pyx_L33_for_else:;

        /* "src/lxml/parser.pxi":747
 *                     break
 *             else:
 *                 well_formed = 1             # <<<<<<<<<<<<<<
 *         else:
 *             well_formed = 0
*/
        __pyx_v_well_formed = 1;
      }
      __pyx_L34_for_end:;

      /* "src/lxml/parser.pxi":738
 *                          c_ctxt.lastError.level < xmlerror.XML_ERR_ERROR):
 *             well_formed = 1
 *         elif not c_ctxt.replaceEntities and not c_ctxt.validate \             # <<<<<<<<<<<<<<
 *                  and context is not None:
 *             # in this mode, we ignore errors about undefined entities
*/
      goto __pyx_L7;
    }

    /* "src/lxml/parser.pxi":749
 *                 well_formed = 1
 *         else:
 *             well_formed = 0             # <<<<<<<<<<<<<<
 * 
 *         if not well_formed:
*/
    /*else*/ {
      __pyx_v_well_formed = 0;
    }
    __pyx_L7:;

    /* "src/lxml/parser.pxi":751
 *             well_formed = 0
 * 
 *         if not well_formed:             # <<<<<<<<<<<<<<
 *             if free_doc:
 *                 tree.xmlFreeDoc(result)
*/
    __pyx_t_1 = (!__pyx_v_well_formed);
    if (__pyx_t_1) {

      /* "src/lxml/parser.pxi":752
 * 
 *         if not well_formed:
 *             if free_doc:             # <<<<<<<<<<<<<<
 *                 tree.xmlFreeDoc(result)
 *             result = NULL
*/
      if (__pyx_v_free_doc) {

        /* "src/lxml/parser.pxi":753
 *         if not well_formed:
 *             if free_doc:
 *                 tree.xmlFreeDoc(result)             # <<<<<<<<<<<<<<
 *             result = NULL
 * 
*/
        xmlFreeDoc(__pyx_v_result);

        /* "src/lxml/parser.pxi":752
 * 
 *         if not well_formed:
 *             if free_doc:             # <<<<<<<<<<<<<<
 *                 tree.xmlFreeDoc(result)
 *             result = NULL
*/
      }

      /* "src/lxml/parser.pxi":754
 *             if free_doc:
 *                 tree.xmlFreeDoc(result)
 *             result = NULL             # <<<<<<<<<<<<<<
 * 
 *     if context is not None and context._has_raised():
*/
      __pyx_v_result = NULL;

      /* "src/lxml/parser.pxi":751
 *             well_formed = 0
 * 
 *         if not well_formed:             # <<<<<<<<<<<<<<
 *             if free_doc:
 *                 tree.xmlFreeDoc(result)
*/
    }

    /* "src/lxml/parser.pxi":719
 *         c_ctxt.myDoc = NULL
 * 
 *     if result is not NULL:             # <<<<<<<<<<<<<<
 *         # "wellFormed" in libxml2 is 0 if the parser found fatal errors. It still returns a
 *         # parse result document if 'recover=True'. Here, we determine if we can present
*/
  }

  /* "src/lxml/parser.pxi":756
 *             result = NULL
 * 
 *     if context is not None and context._has_raised():             # <<<<<<<<<<<<<<
 *         if result is not NULL:
 *             if free_doc:
*/
  __pyx_t_3 = (((PyObject *)__pyx_v_context) != Py_None);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L38_bool_binop_done;
  }
  __pyx_t_3 = __pyx_f_4lxml_5etree_17_ExceptionContext__has_raised(((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_v_context)); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 756, __pyx_L1_error)
  __pyx_t_1 = __pyx_t_3;
  __pyx_L38_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":757
 * 
 *     if context is not None and context._has_raised():
 *         if result is not NULL:             # <<<<<<<<<<<<<<
 *             if free_doc:
 *                 tree.xmlFreeDoc(result)
*/
    __pyx_t_1 = (__pyx_v_result != NULL);
    if (__pyx_t_1) {

      /* "src/lxml/parser.pxi":758
 *     if context is not None and context._has_raised():
 *         if result is not NULL:
 *             if free_doc:             # <<<<<<<<<<<<<<
 *                 tree.xmlFreeDoc(result)
 *             result = NULL
*/
      if (__pyx_v_free_doc) {

        /* "src/lxml/parser.pxi":759
 *         if result is not NULL:
 *             if free_doc:
 *                 tree.xmlFreeDoc(result)             # <<<<<<<<<<<<<<
 *             result = NULL
 *         context._raise_if_stored()
*/
        xmlFreeDoc(__pyx_v_result);

        /* "src/lxml/parser.pxi":758
 *     if context is not None and context._has_raised():
 *         if result is not NULL:
 *             if free_doc:             # <<<<<<<<<<<<<<
 *                 tree.xmlFreeDoc(result)
 *             result = NULL
*/
      }

      /* "src/lxml/parser.pxi":760
 *             if free_doc:
 *                 tree.xmlFreeDoc(result)
 *             result = NULL             # <<<<<<<<<<<<<<
 *         context._raise_if_stored()
 * 
*/
      __pyx_v_result = NULL;

      /* "src/lxml/parser.pxi":757
 * 
 *     if context is not None and context._has_raised():
 *         if result is not NULL:             # <<<<<<<<<<<<<<
 *             if free_doc:
 *                 tree.xmlFreeDoc(result)
*/
    }

    /* "src/lxml/parser.pxi":761
 *                 tree.xmlFreeDoc(result)
 *             result = NULL
 *         context._raise_if_stored()             # <<<<<<<<<<<<<<
 * 
 *     if result is NULL:
*/
    __pyx_t_2 = __pyx_f_4lxml_5etree_17_ExceptionContext__raise_if_stored(((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_v_context)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(2, 761, __pyx_L1_error)

    /* "src/lxml/parser.pxi":756
 *             result = NULL
 * 
 *     if context is not None and context._has_raised():             # <<<<<<<<<<<<<<
 *         if result is not NULL:
 *             if free_doc:
*/
  }

  /* "src/lxml/parser.pxi":763
 *         context._raise_if_stored()
 * 
 *     if result is NULL:             # <<<<<<<<<<<<<<
 *         if context is not None:
 *             _raiseParseError(c_ctxt, filename, context._error_log)
*/
  __pyx_t_1 = (__pyx_v_result == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":764
 * 
 *     if result is NULL:
 *         if context is not None:             # <<<<<<<<<<<<<<
 *             _raiseParseError(c_ctxt, filename, context._error_log)
 *         else:
*/
    __pyx_t_1 = (((PyObject *)__pyx_v_context) != Py_None);
    if (__pyx_t_1) {

      /* "src/lxml/parser.pxi":765
 *     if result is NULL:
 *         if context is not None:
 *             _raiseParseError(c_ctxt, filename, context._error_log)             # <<<<<<<<<<<<<<
 *         else:
 *             _raiseParseError(c_ctxt, filename, None)
*/
      __pyx_t_5 = ((PyObject *)__pyx_v_context->_error_log);
      __Pyx_INCREF(__pyx_t_5);
      __pyx_t_2 = __pyx_f_4lxml_5etree__raiseParseError(__pyx_v_c_ctxt, __pyx_v_filename, ((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_t_5)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(2, 765, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "src/lxml/parser.pxi":764
 * 
 *     if result is NULL:
 *         if context is not None:             # <<<<<<<<<<<<<<
 *             _raiseParseError(c_ctxt, filename, context._error_log)
 *         else:
*/
      goto __pyx_L43;
    }

    /* "src/lxml/parser.pxi":767
 *             _raiseParseError(c_ctxt, filename, context._error_log)
 *         else:
 *             _raiseParseError(c_ctxt, filename, None)             # <<<<<<<<<<<<<<
 *     else:
 *         if result.URL is NULL and filename is not None:
*/
    /*else*/ {
      __pyx_t_2 = __pyx_f_4lxml_5etree__raiseParseError(__pyx_v_c_ctxt, __pyx_v_filename, ((struct __pyx_obj_4lxml_5etree__ErrorLog *)Py_None)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(2, 767, __pyx_L1_error)
    }
    __pyx_L43:;

    /* "src/lxml/parser.pxi":763
 *         context._raise_if_stored()
 * 
 *     if result is NULL:             # <<<<<<<<<<<<<<
 *         if context is not None:
 *             _raiseParseError(c_ctxt, filename, context._error_log)
*/
    goto __pyx_L42;
  }

  /* "src/lxml/parser.pxi":769
 *             _raiseParseError(c_ctxt, filename, None)
 *     else:
 *         if result.URL is NULL and filename is not None:             # <<<<<<<<<<<<<<
 *             result.URL = tree.xmlStrdup(_xcstr(filename))
 *         if result.encoding is NULL:
*/
  /*else*/ {
    __pyx_t_3 = (__pyx_v_result->URL == NULL);
    if (__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L45_bool_binop_done;
    }
    __pyx_t_3 = (__pyx_v_filename != Py_None);
    __pyx_t_1 = __pyx_t_3;
    __pyx_L45_bool_binop_done:;
    if (__pyx_t_1) {

      /* "src/lxml/parser.pxi":770
 *     else:
 *         if result.URL is NULL and filename is not None:
 *             result.URL = tree.xmlStrdup(_xcstr(filename))             # <<<<<<<<<<<<<<
 *         if result.encoding is NULL:
 *             result.encoding = tree.xmlStrdup(<unsigned char*>"UTF-8")
*/
      __pyx_v_result->URL = xmlStrdup((const xmlChar*)PyBytes_AS_STRING(__pyx_v_filename));

      /* "src/lxml/parser.pxi":769
 *             _raiseParseError(c_ctxt, filename, None)
 *     else:
 *         if result.URL is NULL and filename is not None:             # <<<<<<<<<<<<<<
 *             result.URL = tree.xmlStrdup(_xcstr(filename))
 *         if result.encoding is NULL:
*/
    }

    /* "src/lxml/parser.pxi":771
 *         if result.URL is NULL and filename is not None:
 *             result.URL = tree.xmlStrdup(_xcstr(filename))
 *         if result.encoding is NULL:             # <<<<<<<<<<<<<<
 *             result.encoding = tree.xmlStrdup(<unsigned char*>"UTF-8")
 * 
*/
    __pyx_t_1 = (__pyx_v_result->encoding == NULL);
    if (__pyx_t_1) {

      /* "src/lxml/parser.pxi":772
 *             result.URL = tree.xmlStrdup(_xcstr(filename))
 *         if result.encoding is NULL:
 *             result.encoding = tree.xmlStrdup(<unsigned char*>"UTF-8")             # <<<<<<<<<<<<<<
 * 
 *     if context._validator is not None and \
*/
      __pyx_v_result->encoding = xmlStrdup(((unsigned char *)((unsigned char *)((char *)"UTF-8"))));

      /* "src/lxml/parser.pxi":771
 *         if result.URL is NULL and filename is not None:
 *             result.URL = tree.xmlStrdup(_xcstr(filename))
 *         if result.encoding is NULL:             # <<<<<<<<<<<<<<
 *             result.encoding = tree.xmlStrdup(<unsigned char*>"UTF-8")
 * 
*/
    }
  }
  __pyx_L42:;

  /* "src/lxml/parser.pxi":774
 *             result.encoding = tree.xmlStrdup(<unsigned char*>"UTF-8")
 * 
 *     if context._validator is not None and \             # <<<<<<<<<<<<<<
 *            context._validator._add_default_attributes:
 *         # we currently need to do this here as libxml2 does not
*/
  __pyx_t_3 = (((PyObject *)__pyx_v_context->_validator) != Py_None);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L49_bool_binop_done;
  }

  /* "src/lxml/parser.pxi":775
 * 
 *     if context._validator is not None and \
 *            context._validator._add_default_attributes:             # <<<<<<<<<<<<<<
 *         # we currently need to do this here as libxml2 does not
 *         # support inserting default attributes during parse-time
*/
  __pyx_t_1 = __pyx_v_context->_validator->_add_default_attributes;
  __pyx_L49_bool_binop_done:;

  /* "src/lxml/parser.pxi":774
 *             result.encoding = tree.xmlStrdup(<unsigned char*>"UTF-8")
 * 
 *     if context._validator is not None and \             # <<<<<<<<<<<<<<
 *            context._validator._add_default_attributes:
 *         # we currently need to do this here as libxml2 does not
*/
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":779
 *         # support inserting default attributes during parse-time
 *         # validation
 *         context._validator.inject_default_attributes(result)             # <<<<<<<<<<<<<<
 * 
 *     return result
*/
    __pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_inject_default_attributes(__pyx_v_context->_validator, __pyx_v_result);

    /* "src/lxml/parser.pxi":774
 *             result.encoding = tree.xmlStrdup(<unsigned char*>"UTF-8")
 * 
 *     if context._validator is not None and \             # <<<<<<<<<<<<<<
 *            context._validator._add_default_attributes:
 *         # we currently need to do this here as libxml2 does not
*/
  }

  /* "src/lxml/parser.pxi":781
 *         context._validator.inject_default_attributes(result)
 * 
 *     return result             # <<<<<<<<<<<<<<
 * 
 * cdef int _fixHtmlDictNames(tree.xmlDict* c_dict, xmlDoc* c_doc) noexcept nogil:
*/
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":703
 *                              filename)
 * 
 * cdef xmlDoc* _handleParseResult(_ParserContext context,             # <<<<<<<<<<<<<<
 *                                 xmlparser.xmlParserCtxt* c_ctxt,
 *                                 xmlDoc* result, filename,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("lxml.etree._handleParseResult", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_error);
  __Pyx_XDECREF(__pyx_9genexpr11__pyx_v_error);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":783
 *     return result
 * 
 * cdef int _fixHtmlDictNames(tree.xmlDict* c_dict, xmlDoc* c_doc) noexcept nogil:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     if c_doc is NULL:
*/

static int __pyx_f_4lxml_5etree__fixHtmlDictNames(xmlDict *__pyx_v_c_dict, xmlDoc *__pyx_v_c_doc) {
  xmlNode *__pyx_v_c_node;
  int __pyx_r;
  int __pyx_t_1;
  xmlNode *__pyx_t_2;

  /* "src/lxml/parser.pxi":785
 * cdef int _fixHtmlDictNames(tree.xmlDict* c_dict, xmlDoc* c_doc) noexcept nogil:
 *     cdef xmlNode* c_node
 *     if c_doc is NULL:             # <<<<<<<<<<<<<<
 *         return 0
 *     c_node = c_doc.children
*/
  __pyx_t_1 = (__pyx_v_c_doc == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":786
 *     cdef xmlNode* c_node
 *     if c_doc is NULL:
 *         return 0             # <<<<<<<<<<<<<<
 *     c_node = c_doc.children
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(<xmlNode*>c_doc, c_node, 1)
*/
    __pyx_r = 0;
    goto __pyx_L0;

    /* "src/lxml/parser.pxi":785
 * cdef int _fixHtmlDictNames(tree.xmlDict* c_dict, xmlDoc* c_doc) noexcept nogil:
 *     cdef xmlNode* c_node
 *     if c_doc is NULL:             # <<<<<<<<<<<<<<
 *         return 0
 *     c_node = c_doc.children
*/
  }

  /* "src/lxml/parser.pxi":787
 *     if c_doc is NULL:
 *         return 0
 *     c_node = c_doc.children             # <<<<<<<<<<<<<<
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(<xmlNode*>c_doc, c_node, 1)
 *     if c_node.type == tree.XML_ELEMENT_NODE:
*/
  __pyx_t_2 = __pyx_v_c_doc->children;
  __pyx_v_c_node = __pyx_t_2;

  /* "src/lxml/parser.pxi":788
 *         return 0
 *     c_node = c_doc.children
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(<xmlNode*>c_doc, c_node, 1)             # <<<<<<<<<<<<<<
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         if _fixHtmlDictNodeNames(c_dict, c_node) < 0:
*/
  BEGIN_FOR_EACH_ELEMENT_FROM(((xmlNode *)__pyx_v_c_doc), __pyx_v_c_node, 1);

  /* "src/lxml/parser.pxi":789
 *     c_node = c_doc.children
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(<xmlNode*>c_doc, c_node, 1)
 *     if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         if _fixHtmlDictNodeNames(c_dict, c_node) < 0:
 *             return -1
*/
  __pyx_t_1 = (__pyx_v_c_node->type == XML_ELEMENT_NODE);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":790
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(<xmlNode*>c_doc, c_node, 1)
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         if _fixHtmlDictNodeNames(c_dict, c_node) < 0:             # <<<<<<<<<<<<<<
 *             return -1
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)
*/
    __pyx_t_1 = (__pyx_f_4lxml_5etree__fixHtmlDictNodeNames(__pyx_v_c_dict, __pyx_v_c_node) < 0);
    if (__pyx_t_1) {

      /* "src/lxml/parser.pxi":791
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         if _fixHtmlDictNodeNames(c_dict, c_node) < 0:
 *             return -1             # <<<<<<<<<<<<<<
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 *     return 0
*/
      __pyx_r = -1;
      goto __pyx_L0;

      /* "src/lxml/parser.pxi":790
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(<xmlNode*>c_doc, c_node, 1)
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         if _fixHtmlDictNodeNames(c_dict, c_node) < 0:             # <<<<<<<<<<<<<<
 *             return -1
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)
*/
    }

    /* "src/lxml/parser.pxi":789
 *     c_node = c_doc.children
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(<xmlNode*>c_doc, c_node, 1)
 *     if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         if _fixHtmlDictNodeNames(c_dict, c_node) < 0:
 *             return -1
*/
  }

  /* "src/lxml/parser.pxi":792
 *         if _fixHtmlDictNodeNames(c_dict, c_node) < 0:
 *             return -1
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)             # <<<<<<<<<<<<<<
 *     return 0
 * 
*/
  END_FOR_EACH_ELEMENT_FROM(__pyx_v_c_node);

  /* "src/lxml/parser.pxi":793
 *             return -1
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int _fixHtmlDictSubtreeNames(tree.xmlDict* c_dict, xmlDoc* c_doc,
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":783
 *     return result
 * 
 * cdef int _fixHtmlDictNames(tree.xmlDict* c_dict, xmlDoc* c_doc) noexcept nogil:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     if c_doc is NULL:
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/parser.pxi":795
 *     return 0
 * 
 * cdef int _fixHtmlDictSubtreeNames(tree.xmlDict* c_dict, xmlDoc* c_doc,             # <<<<<<<<<<<<<<
 *                                   xmlNode* c_start_node) noexcept nogil:
 *     """
*/

static int __pyx_f_4lxml_5etree__fixHtmlDictSubtreeNames(xmlDict *__pyx_v_c_dict, xmlDoc *__pyx_v_c_doc, xmlNode *__pyx_v_c_start_node) {
  xmlNode *__pyx_v_c_node;
  int __pyx_r;
  int __pyx_t_1;

  /* "src/lxml/parser.pxi":802
 *     """
 *     cdef xmlNode* c_node
 *     if not c_doc:             # <<<<<<<<<<<<<<
 *         return 0
 *     if not c_start_node:
*/
  __pyx_t_1 = (!(__pyx_v_c_doc != 0));
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":803
 *     cdef xmlNode* c_node
 *     if not c_doc:
 *         return 0             # <<<<<<<<<<<<<<
 *     if not c_start_node:
 *         return _fixHtmlDictNames(c_dict, c_doc)
*/
    __pyx_r = 0;
    goto __pyx_L0;

    /* "src/lxml/parser.pxi":802
 *     """
 *     cdef xmlNode* c_node
 *     if not c_doc:             # <<<<<<<<<<<<<<
 *         return 0
 *     if not c_start_node:
*/
  }

  /* "src/lxml/parser.pxi":804
 *     if not c_doc:
 *         return 0
 *     if not c_start_node:             # <<<<<<<<<<<<<<
 *         return _fixHtmlDictNames(c_dict, c_doc)
 *     c_node = c_start_node
*/
  __pyx_t_1 = (!(__pyx_v_c_start_node != 0));
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":805
 *         return 0
 *     if not c_start_node:
 *         return _fixHtmlDictNames(c_dict, c_doc)             # <<<<<<<<<<<<<<
 *     c_node = c_start_node
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(<xmlNode*>c_doc, c_node, 1)
*/
    __pyx_r = __pyx_f_4lxml_5etree__fixHtmlDictNames(__pyx_v_c_dict, __pyx_v_c_doc);
    goto __pyx_L0;

    /* "src/lxml/parser.pxi":804
 *     if not c_doc:
 *         return 0
 *     if not c_start_node:             # <<<<<<<<<<<<<<
 *         return _fixHtmlDictNames(c_dict, c_doc)
 *     c_node = c_start_node
*/
  }

  /* "src/lxml/parser.pxi":806
 *     if not c_start_node:
 *         return _fixHtmlDictNames(c_dict, c_doc)
 *     c_node = c_start_node             # <<<<<<<<<<<<<<
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(<xmlNode*>c_doc, c_node, 1)
 *     if c_node.type == tree.XML_ELEMENT_NODE:
*/
  __pyx_v_c_node = __pyx_v_c_start_node;

  /* "src/lxml/parser.pxi":807
 *         return _fixHtmlDictNames(c_dict, c_doc)
 *     c_node = c_start_node
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(<xmlNode*>c_doc, c_node, 1)             # <<<<<<<<<<<<<<
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         if _fixHtmlDictNodeNames(c_dict, c_node) < 0:
*/
  BEGIN_FOR_EACH_ELEMENT_FROM(((xmlNode *)__pyx_v_c_doc), __pyx_v_c_node, 1);

  /* "src/lxml/parser.pxi":808
 *     c_node = c_start_node
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(<xmlNode*>c_doc, c_node, 1)
 *     if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         if _fixHtmlDictNodeNames(c_dict, c_node) < 0:
 *             return -1
*/
  __pyx_t_1 = (__pyx_v_c_node->type == XML_ELEMENT_NODE);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":809
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(<xmlNode*>c_doc, c_node, 1)
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         if _fixHtmlDictNodeNames(c_dict, c_node) < 0:             # <<<<<<<<<<<<<<
 *             return -1
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)
*/
    __pyx_t_1 = (__pyx_f_4lxml_5etree__fixHtmlDictNodeNames(__pyx_v_c_dict, __pyx_v_c_node) < 0);
    if (__pyx_t_1) {

      /* "src/lxml/parser.pxi":810
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         if _fixHtmlDictNodeNames(c_dict, c_node) < 0:
 *             return -1             # <<<<<<<<<<<<<<
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 *     return 0
*/
      __pyx_r = -1;
      goto __pyx_L0;

      /* "src/lxml/parser.pxi":809
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(<xmlNode*>c_doc, c_node, 1)
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         if _fixHtmlDictNodeNames(c_dict, c_node) < 0:             # <<<<<<<<<<<<<<
 *             return -1
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)
*/
    }

    /* "src/lxml/parser.pxi":808
 *     c_node = c_start_node
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(<xmlNode*>c_doc, c_node, 1)
 *     if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         if _fixHtmlDictNodeNames(c_dict, c_node) < 0:
 *             return -1
*/
  }

  /* "src/lxml/parser.pxi":811
 *         if _fixHtmlDictNodeNames(c_dict, c_node) < 0:
 *             return -1
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)             # <<<<<<<<<<<<<<
 *     return 0
 * 
*/
  END_FOR_EACH_ELEMENT_FROM(__pyx_v_c_node);

  /* "src/lxml/parser.pxi":812
 *             return -1
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef inline int _fixHtmlDictNodeNames(tree.xmlDict* c_dict,
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":795
 *     return 0
 * 
 * cdef int _fixHtmlDictSubtreeNames(tree.xmlDict* c_dict, xmlDoc* c_doc,             # <<<<<<<<<<<<<<
 *                                   xmlNode* c_start_node) noexcept nogil:
 *     """
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/parser.pxi":814
 *     return 0
 * 
 * cdef inline int _fixHtmlDictNodeNames(tree.xmlDict* c_dict,             # <<<<<<<<<<<<<<
 *                                       xmlNode* c_node) noexcept nogil:
 *     cdef xmlNode* c_attr
*/

static CYTHON_INLINE int __pyx_f_4lxml_5etree__fixHtmlDictNodeNames(xmlDict *__pyx_v_c_dict, xmlNode *__pyx_v_c_node) {
  xmlNode *__pyx_v_c_attr;
  const xmlChar *__pyx_v_c_name;
  int __pyx_r;
  int __pyx_t_1;
  xmlNode *__pyx_t_2;

  /* "src/lxml/parser.pxi":817
 *                                       xmlNode* c_node) noexcept nogil:
 *     cdef xmlNode* c_attr
 *     c_name = tree.xmlDictLookup(c_dict, c_node.name, -1)             # <<<<<<<<<<<<<<
 *     if c_name is NULL:
 *         return -1
*/
  __pyx_v_c_name = xmlDictLookup(__pyx_v_c_dict, __pyx_v_c_node->name, -1);

  /* "src/lxml/parser.pxi":818
 *     cdef xmlNode* c_attr
 *     c_name = tree.xmlDictLookup(c_dict, c_node.name, -1)
 *     if c_name is NULL:             # <<<<<<<<<<<<<<
 *         return -1
 *     if c_name is not c_node.name:
*/
  __pyx_t_1 = (__pyx_v_c_name == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":819
 *     c_name = tree.xmlDictLookup(c_dict, c_node.name, -1)
 *     if c_name is NULL:
 *         return -1             # <<<<<<<<<<<<<<
 *     if c_name is not c_node.name:
 *         tree.xmlFree(<char*>c_node.name)
*/
    __pyx_r = -1;
    goto __pyx_L0;

    /* "src/lxml/parser.pxi":818
 *     cdef xmlNode* c_attr
 *     c_name = tree.xmlDictLookup(c_dict, c_node.name, -1)
 *     if c_name is NULL:             # <<<<<<<<<<<<<<
 *         return -1
 *     if c_name is not c_node.name:
*/
  }

  /* "src/lxml/parser.pxi":820
 *     if c_name is NULL:
 *         return -1
 *     if c_name is not c_node.name:             # <<<<<<<<<<<<<<
 *         tree.xmlFree(<char*>c_node.name)
 *         c_node.name = c_name
*/
  __pyx_t_1 = (__pyx_v_c_name != __pyx_v_c_node->name);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":821
 *         return -1
 *     if c_name is not c_node.name:
 *         tree.xmlFree(<char*>c_node.name)             # <<<<<<<<<<<<<<
 *         c_node.name = c_name
 *     c_attr = <xmlNode*>c_node.properties
*/
    xmlFree(((char *)__pyx_v_c_node->name));

    /* "src/lxml/parser.pxi":822
 *     if c_name is not c_node.name:
 *         tree.xmlFree(<char*>c_node.name)
 *         c_node.name = c_name             # <<<<<<<<<<<<<<
 *     c_attr = <xmlNode*>c_node.properties
 *     while c_attr is not NULL:
*/
    __pyx_v_c_node->name = __pyx_v_c_name;

    /* "src/lxml/parser.pxi":820
 *     if c_name is NULL:
 *         return -1
 *     if c_name is not c_node.name:             # <<<<<<<<<<<<<<
 *         tree.xmlFree(<char*>c_node.name)
 *         c_node.name = c_name
*/
  }

  /* "src/lxml/parser.pxi":823
 *         tree.xmlFree(<char*>c_node.name)
 *         c_node.name = c_name
 *     c_attr = <xmlNode*>c_node.properties             # <<<<<<<<<<<<<<
 *     while c_attr is not NULL:
 *         c_name = tree.xmlDictLookup(c_dict, c_attr.name, -1)
*/
  __pyx_v_c_attr = ((xmlNode *)__pyx_v_c_node->properties);

  /* "src/lxml/parser.pxi":824
 *         c_node.name = c_name
 *     c_attr = <xmlNode*>c_node.properties
 *     while c_attr is not NULL:             # <<<<<<<<<<<<<<
 *         c_name = tree.xmlDictLookup(c_dict, c_attr.name, -1)
 *         if c_name is NULL:
*/
  while (1) {
    __pyx_t_1 = (__pyx_v_c_attr != NULL);
    if (!__pyx_t_1) break;

    /* "src/lxml/parser.pxi":825
 *     c_attr = <xmlNode*>c_node.properties
 *     while c_attr is not NULL:
 *         c_name = tree.xmlDictLookup(c_dict, c_attr.name, -1)             # <<<<<<<<<<<<<<
 *         if c_name is NULL:
 *             return -1
*/
    __pyx_v_c_name = xmlDictLookup(__pyx_v_c_dict, __pyx_v_c_attr->name, -1);

    /* "src/lxml/parser.pxi":826
 *     while c_attr is not NULL:
 *         c_name = tree.xmlDictLookup(c_dict, c_attr.name, -1)
 *         if c_name is NULL:             # <<<<<<<<<<<<<<
 *             return -1
 *         if c_name is not c_attr.name:
*/
    __pyx_t_1 = (__pyx_v_c_name == NULL);
    if (__pyx_t_1) {

      /* "src/lxml/parser.pxi":827
 *         c_name = tree.xmlDictLookup(c_dict, c_attr.name, -1)
 *         if c_name is NULL:
 *             return -1             # <<<<<<<<<<<<<<
 *         if c_name is not c_attr.name:
 *             tree.xmlFree(<char*>c_attr.name)
*/
      __pyx_r = -1;
      goto __pyx_L0;

      /* "src/lxml/parser.pxi":826
 *     while c_attr is not NULL:
 *         c_name = tree.xmlDictLookup(c_dict, c_attr.name, -1)
 *         if c_name is NULL:             # <<<<<<<<<<<<<<
 *             return -1
 *         if c_name is not c_attr.name:
*/
    }

    /* "src/lxml/parser.pxi":828
 *         if c_name is NULL:
 *             return -1
 *         if c_name is not c_attr.name:             # <<<<<<<<<<<<<<
 *             tree.xmlFree(<char*>c_attr.name)
 *             c_attr.name = c_name
*/
    __pyx_t_1 = (__pyx_v_c_name != __pyx_v_c_attr->name);
    if (__pyx_t_1) {

      /* "src/lxml/parser.pxi":829
 *             return -1
 *         if c_name is not c_attr.name:
 *             tree.xmlFree(<char*>c_attr.name)             # <<<<<<<<<<<<<<
 *             c_attr.name = c_name
 *         c_attr = c_attr.next
*/
      xmlFree(((char *)__pyx_v_c_attr->name));

      /* "src/lxml/parser.pxi":830
 *         if c_name is not c_attr.name:
 *             tree.xmlFree(<char*>c_attr.name)
 *             c_attr.name = c_name             # <<<<<<<<<<<<<<
 *         c_attr = c_attr.next
 *     return 0
*/
      __pyx_v_c_attr->name = __pyx_v_c_name;

      /* "src/lxml/parser.pxi":828
 *         if c_name is NULL:
 *             return -1
 *         if c_name is not c_attr.name:             # <<<<<<<<<<<<<<
 *             tree.xmlFree(<char*>c_attr.name)
 *             c_attr.name = c_name
*/
    }

    /* "src/lxml/parser.pxi":831
 *             tree.xmlFree(<char*>c_attr.name)
 *             c_attr.name = c_name
 *         c_attr = c_attr.next             # <<<<<<<<<<<<<<
 *     return 0
 * 
*/
    __pyx_t_2 = __pyx_v_c_attr->next;
    __pyx_v_c_attr = __pyx_t_2;
  }

  /* "src/lxml/parser.pxi":832
 *             c_attr.name = c_name
 *         c_attr = c_attr.next
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":814
 *     return 0
 * 
 * cdef inline int _fixHtmlDictNodeNames(tree.xmlDict* c_dict,             # <<<<<<<<<<<<<<
 *                                       xmlNode* c_node) noexcept nogil:
 *     cdef xmlNode* c_attr
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/parser.pxi":854
 *     cdef tuple _events_to_collect  # (event_types, tag)
 * 
 *     def __init__(self, int parse_options, bint for_html, XMLSchema schema,             # <<<<<<<<<<<<<<
 *                  remove_comments, remove_pis, strip_cdata, collect_ids,
 *                  target, encoding, bint resolve_external_entities=True):
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_11_BaseParser_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_11_BaseParser_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_parse_options;
  int __pyx_v_for_html;
  struct __pyx_obj_4lxml_5etree_XMLSchema *__pyx_v_schema = 0;
  PyObject *__pyx_v_remove_comments = 0;
  PyObject *__pyx_v_remove_pis = 0;
  PyObject *__pyx_v_strip_cdata = 0;
  PyObject *__pyx_v_collect_ids = 0;
  PyObject *__pyx_v_target = 0;
  PyObject *__pyx_v_encoding = 0;
  int __pyx_v_resolve_external_entities;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_parse_options,&__pyx_mstate_global->__pyx_n_u_for_html,&__pyx_mstate_global->__pyx_n_u_schema,&__pyx_mstate_global->__pyx_n_u_remove_comments,&__pyx_mstate_global->__pyx_n_u_remove_pis,&__pyx_mstate_global->__pyx_n_u_strip_cdata,&__pyx_mstate_global->__pyx_n_u_collect_ids,&__pyx_mstate_global->__pyx_n_u_target,&__pyx_mstate_global->__pyx_n_u_encoding,&__pyx_mstate_global->__pyx_n_u_resolve_external_entities,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(2, 854, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case 10:
        values[9] = __Pyx_ArgRef_VARARGS(__pyx_args, 9);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[9])) __PYX_ERR(2, 854, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  9:
        values[8] = __Pyx_ArgRef_VARARGS(__pyx_args, 8);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[8])) __PYX_ERR(2, 854, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  8:
        values[7] = __Pyx_ArgRef_VARARGS(__pyx_args, 7);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[7])) __PYX_ERR(2, 854, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  7:
        values[6] = __Pyx_ArgRef_VARARGS(__pyx_args, 6);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(2, 854, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  6:
        values[5] = __Pyx_ArgRef_VARARGS(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(2, 854, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(2, 854, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(2, 854, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(2, 854, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(2, 854, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(2, 854, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(2, 854, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 9; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 0, 9, 10, i); __PYX_ERR(2, 854, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case 10:
        values[9] = __Pyx_ArgRef_VARARGS(__pyx_args, 9);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[9])) __PYX_ERR(2, 854, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  9:
        values[8] = __Pyx_ArgRef_VARARGS(__pyx_args, 8);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[8])) __PYX_ERR(2, 854, __pyx_L3_error)
        values[7] = __Pyx_ArgRef_VARARGS(__pyx_args, 7);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[7])) __PYX_ERR(2, 854, __pyx_L3_error)
        values[6] = __Pyx_ArgRef_VARARGS(__pyx_args, 6);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(2, 854, __pyx_L3_error)
        values[5] = __Pyx_ArgRef_VARARGS(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(2, 854, __pyx_L3_error)
        values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(2, 854, __pyx_L3_error)
        values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(2, 854, __pyx_L3_error)
        values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(2, 854, __pyx_L3_error)
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(2, 854, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(2, 854, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_parse_options = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_parse_options == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 854, __pyx_L3_error)
    __pyx_v_for_html = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_for_html == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 854, __pyx_L3_error)
    __pyx_v_schema = ((struct __pyx_obj_4lxml_5etree_XMLSchema *)values[2]);
    __pyx_v_remove_comments = values[3];
    __pyx_v_remove_pis = values[4];
    __pyx_v_strip_cdata = values[5];
    __pyx_v_collect_ids = values[6];
    __pyx_v_target = values[7];
    __pyx_v_encoding = values[8];
    if (values[9]) {
      __pyx_v_resolve_external_entities = __Pyx_PyObject_IsTrue(values[9]); if (unlikely((__pyx_v_resolve_external_entities == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 856, __pyx_L3_error)
    } else {

      /* "src/lxml/parser.pxi":856
 *     def __init__(self, int parse_options, bint for_html, XMLSchema schema,
 *                  remove_comments, remove_pis, strip_cdata, collect_ids,
 *                  target, encoding, bint resolve_external_entities=True):             # <<<<<<<<<<<<<<
 *         cdef tree.xmlCharEncodingHandler* enchandler
 *         cdef int c_encoding
*/
      __pyx_v_resolve_external_entities = ((int)1);
    }
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 9, 10, __pyx_nargs); __PYX_ERR(2, 854, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._BaseParser.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_schema), __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XMLSchema, 1, "schema", 0))) __PYX_ERR(2, 854, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_11_BaseParser___init__(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self), __pyx_v_parse_options, __pyx_v_for_html, __pyx_v_schema, __pyx_v_remove_comments, __pyx_v_remove_pis, __pyx_v_strip_cdata, __pyx_v_collect_ids, __pyx_v_target, __pyx_v_encoding, __pyx_v_resolve_external_entities);

  /* "src/lxml/parser.pxi":854
 *     cdef tuple _events_to_collect  # (event_types, tag)
 * 
 *     def __init__(self, int parse_options, bint for_html, XMLSchema schema,             # <<<<<<<<<<<<<<
 *                  remove_comments, remove_pis, strip_cdata, collect_ids,
 *                  target, encoding, bint resolve_external_entities=True):
*/

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_11_BaseParser___init__(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self, int __pyx_v_parse_options, int __pyx_v_for_html, struct __pyx_obj_4lxml_5etree_XMLSchema *__pyx_v_schema, PyObject *__pyx_v_remove_comments, PyObject *__pyx_v_remove_pis, PyObject *__pyx_v_strip_cdata, PyObject *__pyx_v_collect_ids, PyObject *__pyx_v_target, PyObject *__pyx_v_encoding, int __pyx_v_resolve_external_entities) {
  xmlCharEncodingHandler *__pyx_v_enchandler;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  PyObject *__pyx_t_7[3];
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_INCREF(__pyx_v_encoding);

  /* "src/lxml/parser.pxi":859
 *         cdef tree.xmlCharEncodingHandler* enchandler
 *         cdef int c_encoding
 *         if not isinstance(self, (XMLParser, HTMLParser)):             # <<<<<<<<<<<<<<
 *             raise TypeError, "This class cannot be instantiated"
 * 
*/
  __pyx_t_2 = __Pyx_TypeCheck(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XMLParser); 
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = __Pyx_TypeCheck(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_ptype_4lxml_5etree_HTMLParser); 
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  __pyx_t_2 = (!__pyx_t_1);
  if (unlikely(__pyx_t_2)) {

    /* "src/lxml/parser.pxi":860
 *         cdef int c_encoding
 *         if not isinstance(self, (XMLParser, HTMLParser)):
 *             raise TypeError, "This class cannot be instantiated"             # <<<<<<<<<<<<<<
 * 
 *         if not collect_ids and tree.LIBXML_VERSION >= 21500:
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_This_class_cannot_be_instantiate, 0, 0);
    __PYX_ERR(2, 860, __pyx_L1_error)

    /* "src/lxml/parser.pxi":859
 *         cdef tree.xmlCharEncodingHandler* enchandler
 *         cdef int c_encoding
 *         if not isinstance(self, (XMLParser, HTMLParser)):             # <<<<<<<<<<<<<<
 *             raise TypeError, "This class cannot be instantiated"
 * 
*/
  }

  /* "src/lxml/parser.pxi":862
 *             raise TypeError, "This class cannot be instantiated"
 * 
 *         if not collect_ids and tree.LIBXML_VERSION >= 21500:             # <<<<<<<<<<<<<<
 *             parse_options |= xmlparser.XML_PARSE_SKIP_IDS
 * 
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_collect_ids); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(2, 862, __pyx_L1_error)
  __pyx_t_3 = (!__pyx_t_1);
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L7_bool_binop_done;
  }
  __pyx_t_3 = (LIBXML_VERSION >= 0x53FC);
  __pyx_t_2 = __pyx_t_3;
  __pyx_L7_bool_binop_done:;
  if (__pyx_t_2) {

    /* "src/lxml/parser.pxi":863
 * 
 *         if not collect_ids and tree.LIBXML_VERSION >= 21500:
 *             parse_options |= xmlparser.XML_PARSE_SKIP_IDS             # <<<<<<<<<<<<<<
 * 
 *         self._parse_options = parse_options
*/
    __pyx_v_parse_options = (__pyx_v_parse_options | XML_PARSE_SKIP_IDS);

    /* "src/lxml/parser.pxi":862
 *             raise TypeError, "This class cannot be instantiated"
 * 
 *         if not collect_ids and tree.LIBXML_VERSION >= 21500:             # <<<<<<<<<<<<<<
 *             parse_options |= xmlparser.XML_PARSE_SKIP_IDS
 * 
*/
  }

  /* "src/lxml/parser.pxi":865
 *             parse_options |= xmlparser.XML_PARSE_SKIP_IDS
 * 
 *         self._parse_options = parse_options             # <<<<<<<<<<<<<<
 *         self.target = target
 *         self._for_html = for_html
*/
  __pyx_v_self->_parse_options = __pyx_v_parse_options;

  /* "src/lxml/parser.pxi":866
 * 
 *         self._parse_options = parse_options
 *         self.target = target             # <<<<<<<<<<<<<<
 *         self._for_html = for_html
 *         self._remove_comments = remove_comments
*/
  __Pyx_INCREF(__pyx_v_target);
  __Pyx_GIVEREF(__pyx_v_target);
  __Pyx_GOTREF(__pyx_v_self->target);
  __Pyx_DECREF(__pyx_v_self->target);
  __pyx_v_self->target = __pyx_v_target;

  /* "src/lxml/parser.pxi":867
 *         self._parse_options = parse_options
 *         self.target = target
 *         self._for_html = for_html             # <<<<<<<<<<<<<<
 *         self._remove_comments = remove_comments
 *         self._remove_pis = remove_pis
*/
  __pyx_v_self->_for_html = __pyx_v_for_html;

  /* "src/lxml/parser.pxi":868
 *         self.target = target
 *         self._for_html = for_html
 *         self._remove_comments = remove_comments             # <<<<<<<<<<<<<<
 *         self._remove_pis = remove_pis
 *         self._strip_cdata = strip_cdata
*/
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_remove_comments); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 868, __pyx_L1_error)
  __pyx_v_self->_remove_comments = __pyx_t_2;

  /* "src/lxml/parser.pxi":869
 *         self._for_html = for_html
 *         self._remove_comments = remove_comments
 *         self._remove_pis = remove_pis             # <<<<<<<<<<<<<<
 *         self._strip_cdata = strip_cdata
 *         self._collect_ids = collect_ids
*/
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_remove_pis); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 869, __pyx_L1_error)
  __pyx_v_self->_remove_pis = __pyx_t_2;

  /* "src/lxml/parser.pxi":870
 *         self._remove_comments = remove_comments
 *         self._remove_pis = remove_pis
 *         self._strip_cdata = strip_cdata             # <<<<<<<<<<<<<<
 *         self._collect_ids = collect_ids
 *         self._resolve_external_entities = resolve_external_entities
*/
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_strip_cdata); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 870, __pyx_L1_error)
  __pyx_v_self->_strip_cdata = __pyx_t_2;

  /* "src/lxml/parser.pxi":871
 *         self._remove_pis = remove_pis
 *         self._strip_cdata = strip_cdata
 *         self._collect_ids = collect_ids             # <<<<<<<<<<<<<<
 *         self._resolve_external_entities = resolve_external_entities
 *         self._schema = schema
*/
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_collect_ids); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 871, __pyx_L1_error)
  __pyx_v_self->_collect_ids = __pyx_t_2;

  /* "src/lxml/parser.pxi":872
 *         self._strip_cdata = strip_cdata
 *         self._collect_ids = collect_ids
 *         self._resolve_external_entities = resolve_external_entities             # <<<<<<<<<<<<<<
 *         self._schema = schema
 * 
*/
  __pyx_v_self->_resolve_external_entities = __pyx_v_resolve_external_entities;

  /* "src/lxml/parser.pxi":873
 *         self._collect_ids = collect_ids
 *         self._resolve_external_entities = resolve_external_entities
 *         self._schema = schema             # <<<<<<<<<<<<<<
 * 
 *         self._resolvers = _ResolverRegistry()
*/
  __Pyx_INCREF((PyObject *)__pyx_v_schema);
  __Pyx_GIVEREF((PyObject *)__pyx_v_schema);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_schema);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_schema);
  __pyx_v_self->_schema = __pyx_v_schema;

  /* "src/lxml/parser.pxi":875
 *         self._schema = schema
 * 
 *         self._resolvers = _ResolverRegistry()             # <<<<<<<<<<<<<<
 * 
 *         if encoding is None:
*/
  __pyx_t_5 = NULL;
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};
    __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ResolverRegistry, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 875, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_4);
  }
  __Pyx_GIVEREF((PyObject *)__pyx_t_4);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_resolvers);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_resolvers);
  __pyx_v_self->_resolvers = ((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "src/lxml/parser.pxi":877
 *         self._resolvers = _ResolverRegistry()
 * 
 *         if encoding is None:             # <<<<<<<<<<<<<<
 *             self._default_encoding = None
 *         else:
*/
  __pyx_t_2 = (__pyx_v_encoding == Py_None);
  if (__pyx_t_2) {

    /* "src/lxml/parser.pxi":878
 * 
 *         if encoding is None:
 *             self._default_encoding = None             # <<<<<<<<<<<<<<
 *         else:
 *             encoding = _utf8(encoding)
*/
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_self->_default_encoding);
    __Pyx_DECREF(__pyx_v_self->_default_encoding);
    __pyx_v_self->_default_encoding = Py_None;

    /* "src/lxml/parser.pxi":877
 *         self._resolvers = _ResolverRegistry()
 * 
 *         if encoding is None:             # <<<<<<<<<<<<<<
 *             self._default_encoding = None
 *         else:
*/
    goto __pyx_L9;
  }

  /* "src/lxml/parser.pxi":880
 *             self._default_encoding = None
 *         else:
 *             encoding = _utf8(encoding)             # <<<<<<<<<<<<<<
 *             enchandler = tree.xmlFindCharEncodingHandler(_cstr(encoding))
 *             if enchandler is NULL:
*/
  /*else*/ {
    __pyx_t_4 = __pyx_f_4lxml_5etree__utf8(__pyx_v_encoding); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 880, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v_encoding, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "src/lxml/parser.pxi":881
 *         else:
 *             encoding = _utf8(encoding)
 *             enchandler = tree.xmlFindCharEncodingHandler(_cstr(encoding))             # <<<<<<<<<<<<<<
 *             if enchandler is NULL:
 *                 raise LookupError, f"unknown encoding: '{encoding}'"
*/
    __pyx_v_enchandler = xmlFindCharEncodingHandler(PyBytes_AS_STRING(__pyx_v_encoding));

    /* "src/lxml/parser.pxi":882
 *             encoding = _utf8(encoding)
 *             enchandler = tree.xmlFindCharEncodingHandler(_cstr(encoding))
 *             if enchandler is NULL:             # <<<<<<<<<<<<<<
 *                 raise LookupError, f"unknown encoding: '{encoding}'"
 *             tree.xmlCharEncCloseFunc(enchandler)
*/
    __pyx_t_2 = (__pyx_v_enchandler == NULL);
    if (unlikely(__pyx_t_2)) {

      /* "src/lxml/parser.pxi":883
 *             enchandler = tree.xmlFindCharEncodingHandler(_cstr(encoding))
 *             if enchandler is NULL:
 *                 raise LookupError, f"unknown encoding: '{encoding}'"             # <<<<<<<<<<<<<<
 *             tree.xmlCharEncCloseFunc(enchandler)
 *             self._default_encoding = encoding
*/
      __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_encoding, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 883, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_7[0] = __pyx_mstate_global->__pyx_kp_u_unknown_encoding;
      __pyx_t_7[1] = __pyx_t_4;
      __pyx_t_7[2] = __pyx_mstate_global->__pyx_kp_u__4;
      __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_7, 3, 19 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4));
      if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 883, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_LookupError))), __pyx_t_5, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __PYX_ERR(2, 883, __pyx_L1_error)

      /* "src/lxml/parser.pxi":882
 *             encoding = _utf8(encoding)
 *             enchandler = tree.xmlFindCharEncodingHandler(_cstr(encoding))
 *             if enchandler is NULL:             # <<<<<<<<<<<<<<
 *                 raise LookupError, f"unknown encoding: '{encoding}'"
 *             tree.xmlCharEncCloseFunc(enchandler)
*/
    }

    /* "src/lxml/parser.pxi":884
 *             if enchandler is NULL:
 *                 raise LookupError, f"unknown encoding: '{encoding}'"
 *             tree.xmlCharEncCloseFunc(enchandler)             # <<<<<<<<<<<<<<
 *             self._default_encoding = encoding
 * 
*/
    (void)(xmlCharEncCloseFunc(__pyx_v_enchandler));

    /* "src/lxml/parser.pxi":885
 *                 raise LookupError, f"unknown encoding: '{encoding}'"
 *             tree.xmlCharEncCloseFunc(enchandler)
 *             self._default_encoding = encoding             # <<<<<<<<<<<<<<
 * 
 *     cdef _setBaseURL(self, base_url):
*/
    __Pyx_INCREF(__pyx_v_encoding);
    __Pyx_GIVEREF(__pyx_v_encoding);
    __Pyx_GOTREF(__pyx_v_self->_default_encoding);
    __Pyx_DECREF(__pyx_v_self->_default_encoding);
    __pyx_v_self->_default_encoding = __pyx_v_encoding;
  }
  __pyx_L9:;

  /* "src/lxml/parser.pxi":854
 *     cdef tuple _events_to_collect  # (event_types, tag)
 * 
 *     def __init__(self, int parse_options, bint for_html, XMLSchema schema,             # <<<<<<<<<<<<<<
 *                  remove_comments, remove_pis, strip_cdata, collect_ids,
 *                  target, encoding, bint resolve_external_entities=True):
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._BaseParser.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_encoding);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":887
 *             self._default_encoding = encoding
 * 
 *     cdef _setBaseURL(self, base_url):             # <<<<<<<<<<<<<<
 *         self._filename = _encodeFilename(base_url)
 * 
*/

static PyObject *__pyx_f_4lxml_5etree_11_BaseParser__setBaseURL(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self, PyObject *__pyx_v_base_url) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_setBaseURL", 0);

  /* "src/lxml/parser.pxi":888
 * 
 *     cdef _setBaseURL(self, base_url):
 *         self._filename = _encodeFilename(base_url)             # <<<<<<<<<<<<<<
 * 
 *     cdef _collectEvents(self, event_types, tag):
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__encodeFilename(__pyx_v_base_url); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 888, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_1))) __PYX_ERR(2, 888, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_filename);
  __Pyx_DECREF(__pyx_v_self->_filename);
  __pyx_v_self->_filename = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/parser.pxi":887
 *             self._default_encoding = encoding
 * 
 *     cdef _setBaseURL(self, base_url):             # <<<<<<<<<<<<<<
 *         self._filename = _encodeFilename(base_url)
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._BaseParser._setBaseURL", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":890
 *         self._filename = _encodeFilename(base_url)
 * 
 *     cdef _collectEvents(self, event_types, tag):             # <<<<<<<<<<<<<<
 *         if event_types is None:
 *             event_types = ()
*/

static PyObject *__pyx_f_4lxml_5etree_11_BaseParser__collectEvents(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self, PyObject *__pyx_v_event_types, PyObject *__pyx_v_tag) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_collectEvents", 0);
  __Pyx_INCREF(__pyx_v_event_types);

  /* "src/lxml/parser.pxi":891
 * 
 *     cdef _collectEvents(self, event_types, tag):
 *         if event_types is None:             # <<<<<<<<<<<<<<
 *             event_types = ()
 *         else:
*/
  __pyx_t_1 = (__pyx_v_event_types == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":892
 *     cdef _collectEvents(self, event_types, tag):
 *         if event_types is None:
 *             event_types = ()             # <<<<<<<<<<<<<<
 *         else:
 *             event_types = tuple(set(event_types))
*/
    __Pyx_INCREF(__pyx_mstate_global->__pyx_empty_tuple);
    __Pyx_DECREF_SET(__pyx_v_event_types, __pyx_mstate_global->__pyx_empty_tuple);

    /* "src/lxml/parser.pxi":891
 * 
 *     cdef _collectEvents(self, event_types, tag):
 *         if event_types is None:             # <<<<<<<<<<<<<<
 *             event_types = ()
 *         else:
*/
    goto __pyx_L3;
  }

  /* "src/lxml/parser.pxi":894
 *             event_types = ()
 *         else:
 *             event_types = tuple(set(event_types))             # <<<<<<<<<<<<<<
 *             _buildParseEventFilter(event_types)  # purely for validation
 *         self._events_to_collect = (event_types, tag)
*/
  /*else*/ {
    __pyx_t_2 = PySet_New(__pyx_v_event_types); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 894, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_Tuple(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 894, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF_SET(__pyx_v_event_types, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/parser.pxi":895
 *         else:
 *             event_types = tuple(set(event_types))
 *             _buildParseEventFilter(event_types)  # purely for validation             # <<<<<<<<<<<<<<
 *         self._events_to_collect = (event_types, tag)
 * 
*/
    __pyx_t_4 = __pyx_f_4lxml_5etree__buildParseEventFilter(__pyx_v_event_types); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 895, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "src/lxml/parser.pxi":896
 *             event_types = tuple(set(event_types))
 *             _buildParseEventFilter(event_types)  # purely for validation
 *         self._events_to_collect = (event_types, tag)             # <<<<<<<<<<<<<<
 * 
 *     cdef _ParserContext _getParserContext(self):
*/
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 896, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_event_types);
  __Pyx_GIVEREF(__pyx_v_event_types);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_event_types) != (0)) __PYX_ERR(2, 896, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_tag);
  __Pyx_GIVEREF(__pyx_v_tag);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_tag) != (0)) __PYX_ERR(2, 896, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_v_self->_events_to_collect);
  __Pyx_DECREF(__pyx_v_self->_events_to_collect);
  __pyx_v_self->_events_to_collect = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/parser.pxi":890
 *         self._filename = _encodeFilename(base_url)
 * 
 *     cdef _collectEvents(self, event_types, tag):             # <<<<<<<<<<<<<<
 *         if event_types is None:
 *             event_types = ()
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._BaseParser._collectEvents", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_event_types);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":898
 *         self._events_to_collect = (event_types, tag)
 * 
 *     cdef _ParserContext _getParserContext(self):             # <<<<<<<<<<<<<<
 *         cdef xmlparser.xmlParserCtxt* pctxt
 *         if self._parser_context is None:
*/

static struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_f_4lxml_5etree_11_BaseParser__getParserContext(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self) {
  xmlParserCtxt *__pyx_v_pctxt;
  struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  xmlParserCtxt *__pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_getParserContext", 0);

  /* "src/lxml/parser.pxi":900
 *     cdef _ParserContext _getParserContext(self):
 *         cdef xmlparser.xmlParserCtxt* pctxt
 *         if self._parser_context is None:             # <<<<<<<<<<<<<<
 *             self._parser_context = self._createContext(self.target, None)
 *             self._parser_context._collect_ids = self._collect_ids
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_self->_parser_context) == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":901
 *         cdef xmlparser.xmlParserCtxt* pctxt
 *         if self._parser_context is None:
 *             self._parser_context = self._createContext(self.target, None)             # <<<<<<<<<<<<<<
 *             self._parser_context._collect_ids = self._collect_ids
 *             if self._schema is not None:
*/
    __pyx_t_2 = __pyx_v_self->target;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)__pyx_v_self->__pyx_vtab)->_createContext(__pyx_v_self, __pyx_t_2, Py_None)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 901, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF((PyObject *)__pyx_v_self->_parser_context);
    __Pyx_DECREF((PyObject *)__pyx_v_self->_parser_context);
    __pyx_v_self->_parser_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/parser.pxi":902
 *         if self._parser_context is None:
 *             self._parser_context = self._createContext(self.target, None)
 *             self._parser_context._collect_ids = self._collect_ids             # <<<<<<<<<<<<<<
 *             if self._schema is not None:
 *                 self._parser_context._validator = \
*/
    __pyx_t_1 = __pyx_v_self->_collect_ids;
    __pyx_v_self->_parser_context->_collect_ids = __pyx_t_1;

    /* "src/lxml/parser.pxi":903
 *             self._parser_context = self._createContext(self.target, None)
 *             self._parser_context._collect_ids = self._collect_ids
 *             if self._schema is not None:             # <<<<<<<<<<<<<<
 *                 self._parser_context._validator = \
 *                     self._schema._newSaxValidator(
*/
    __pyx_t_1 = (((PyObject *)__pyx_v_self->_schema) != Py_None);
    if (__pyx_t_1) {

      /* "src/lxml/parser.pxi":905
 *             if self._schema is not None:
 *                 self._parser_context._validator = \
 *                     self._schema._newSaxValidator(             # <<<<<<<<<<<<<<
 *                         self._parse_options & xmlparser.XML_PARSE_DTDATTR)
 *             pctxt = self._newParserCtxt()
*/
      __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree_XMLSchema *)__pyx_v_self->_schema->__pyx_base.__pyx_vtab)->_newSaxValidator(__pyx_v_self->_schema, (__pyx_v_self->_parse_options & XML_PARSE_DTDATTR))); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 905, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);

      /* "src/lxml/parser.pxi":904
 *             self._parser_context._collect_ids = self._collect_ids
 *             if self._schema is not None:
 *                 self._parser_context._validator = \             # <<<<<<<<<<<<<<
 *                     self._schema._newSaxValidator(
 *                         self._parse_options & xmlparser.XML_PARSE_DTDATTR)
*/
      __Pyx_GIVEREF(__pyx_t_3);
      __Pyx_GOTREF((PyObject *)__pyx_v_self->_parser_context->_validator);
      __Pyx_DECREF((PyObject *)__pyx_v_self->_parser_context->_validator);
      __pyx_v_self->_parser_context->_validator = ((struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *)__pyx_t_3);
      __pyx_t_3 = 0;

      /* "src/lxml/parser.pxi":903
 *             self._parser_context = self._createContext(self.target, None)
 *             self._parser_context._collect_ids = self._collect_ids
 *             if self._schema is not None:             # <<<<<<<<<<<<<<
 *                 self._parser_context._validator = \
 *                     self._schema._newSaxValidator(
*/
    }

    /* "src/lxml/parser.pxi":907
 *                     self._schema._newSaxValidator(
 *                         self._parse_options & xmlparser.XML_PARSE_DTDATTR)
 *             pctxt = self._newParserCtxt()             # <<<<<<<<<<<<<<
 *             _initParserContext(self._parser_context, self._resolvers, pctxt)
 *             self._configureSaxContext(pctxt)
*/
    __pyx_t_4 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)__pyx_v_self->__pyx_vtab)->_newParserCtxt(__pyx_v_self); if (unlikely(__pyx_t_4 == ((void *)NULL))) __PYX_ERR(2, 907, __pyx_L1_error)
    __pyx_v_pctxt = __pyx_t_4;

    /* "src/lxml/parser.pxi":908
 *                         self._parse_options & xmlparser.XML_PARSE_DTDATTR)
 *             pctxt = self._newParserCtxt()
 *             _initParserContext(self._parser_context, self._resolvers, pctxt)             # <<<<<<<<<<<<<<
 *             self._configureSaxContext(pctxt)
 *         return self._parser_context
*/
    __pyx_t_3 = ((PyObject *)__pyx_v_self->_parser_context);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_2 = ((PyObject *)__pyx_v_self->_resolvers);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_5 = __pyx_f_4lxml_5etree__initParserContext(((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_3), ((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_t_2), __pyx_v_pctxt); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 908, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "src/lxml/parser.pxi":909
 *             pctxt = self._newParserCtxt()
 *             _initParserContext(self._parser_context, self._resolvers, pctxt)
 *             self._configureSaxContext(pctxt)             # <<<<<<<<<<<<<<
 *         return self._parser_context
 * 
*/
    __pyx_t_6 = __pyx_f_4lxml_5etree_11_BaseParser__configureSaxContext(__pyx_v_self, __pyx_v_pctxt); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 909, __pyx_L1_error)

    /* "src/lxml/parser.pxi":900
 *     cdef _ParserContext _getParserContext(self):
 *         cdef xmlparser.xmlParserCtxt* pctxt
 *         if self._parser_context is None:             # <<<<<<<<<<<<<<
 *             self._parser_context = self._createContext(self.target, None)
 *             self._parser_context._collect_ids = self._collect_ids
*/
  }

  /* "src/lxml/parser.pxi":910
 *             _initParserContext(self._parser_context, self._resolvers, pctxt)
 *             self._configureSaxContext(pctxt)
 *         return self._parser_context             # <<<<<<<<<<<<<<
 * 
 *     cdef _ParserContext _getPushParserContext(self):
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_self->_parser_context);
  __pyx_r = __pyx_v_self->_parser_context;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":898
 *         self._events_to_collect = (event_types, tag)
 * 
 *     cdef _ParserContext _getParserContext(self):             # <<<<<<<<<<<<<<
 *         cdef xmlparser.xmlParserCtxt* pctxt
 *         if self._parser_context is None:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._BaseParser._getParserContext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":912
 *         return self._parser_context
 * 
 *     cdef _ParserContext _getPushParserContext(self):             # <<<<<<<<<<<<<<
 *         cdef xmlparser.xmlParserCtxt* pctxt
 *         if self._push_parser_context is None:
*/

static struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_f_4lxml_5etree_11_BaseParser__getPushParserContext(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self) {
  xmlParserCtxt *__pyx_v_pctxt;
  struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  xmlParserCtxt *__pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_getPushParserContext", 0);

  /* "src/lxml/parser.pxi":914
 *     cdef _ParserContext _getPushParserContext(self):
 *         cdef xmlparser.xmlParserCtxt* pctxt
 *         if self._push_parser_context is None:             # <<<<<<<<<<<<<<
 *             self._push_parser_context = self._createContext(
 *                 self.target, self._events_to_collect)
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_self->_push_parser_context) == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":916
 *         if self._push_parser_context is None:
 *             self._push_parser_context = self._createContext(
 *                 self.target, self._events_to_collect)             # <<<<<<<<<<<<<<
 *             self._push_parser_context._collect_ids = self._collect_ids
 *             if self._schema is not None:
*/
    __pyx_t_2 = __pyx_v_self->target;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = __pyx_v_self->_events_to_collect;
    __Pyx_INCREF(__pyx_t_3);

    /* "src/lxml/parser.pxi":915
 *         cdef xmlparser.xmlParserCtxt* pctxt
 *         if self._push_parser_context is None:
 *             self._push_parser_context = self._createContext(             # <<<<<<<<<<<<<<
 *                 self.target, self._events_to_collect)
 *             self._push_parser_context._collect_ids = self._collect_ids
*/
    __pyx_t_4 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)__pyx_v_self->__pyx_vtab)->_createContext(__pyx_v_self, __pyx_t_2, __pyx_t_3)); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 915, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GIVEREF(__pyx_t_4);
    __Pyx_GOTREF((PyObject *)__pyx_v_self->_push_parser_context);
    __Pyx_DECREF((PyObject *)__pyx_v_self->_push_parser_context);
    __pyx_v_self->_push_parser_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "src/lxml/parser.pxi":917
 *             self._push_parser_context = self._createContext(
 *                 self.target, self._events_to_collect)
 *             self._push_parser_context._collect_ids = self._collect_ids             # <<<<<<<<<<<<<<
 *             if self._schema is not None:
 *                 self._push_parser_context._validator = \
*/
    __pyx_t_1 = __pyx_v_self->_collect_ids;
    __pyx_v_self->_push_parser_context->_collect_ids = __pyx_t_1;

    /* "src/lxml/parser.pxi":918
 *                 self.target, self._events_to_collect)
 *             self._push_parser_context._collect_ids = self._collect_ids
 *             if self._schema is not None:             # <<<<<<<<<<<<<<
 *                 self._push_parser_context._validator = \
 *                     self._schema._newSaxValidator(
*/
    __pyx_t_1 = (((PyObject *)__pyx_v_self->_schema) != Py_None);
    if (__pyx_t_1) {

      /* "src/lxml/parser.pxi":920
 *             if self._schema is not None:
 *                 self._push_parser_context._validator = \
 *                     self._schema._newSaxValidator(             # <<<<<<<<<<<<<<
 *                         self._parse_options & xmlparser.XML_PARSE_DTDATTR)
 *             pctxt = self._newPushParserCtxt()
*/
      __pyx_t_4 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree_XMLSchema *)__pyx_v_self->_schema->__pyx_base.__pyx_vtab)->_newSaxValidator(__pyx_v_self->_schema, (__pyx_v_self->_parse_options & XML_PARSE_DTDATTR))); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 920, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);

      /* "src/lxml/parser.pxi":919
 *             self._push_parser_context._collect_ids = self._collect_ids
 *             if self._schema is not None:
 *                 self._push_parser_context._validator = \             # <<<<<<<<<<<<<<
 *                     self._schema._newSaxValidator(
 *                         self._parse_options & xmlparser.XML_PARSE_DTDATTR)
*/
      __Pyx_GIVEREF(__pyx_t_4);
      __Pyx_GOTREF((PyObject *)__pyx_v_self->_push_parser_context->_validator);
      __Pyx_DECREF((PyObject *)__pyx_v_self->_push_parser_context->_validator);
      __pyx_v_self->_push_parser_context->_validator = ((struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *)__pyx_t_4);
      __pyx_t_4 = 0;

      /* "src/lxml/parser.pxi":918
 *                 self.target, self._events_to_collect)
 *             self._push_parser_context._collect_ids = self._collect_ids
 *             if self._schema is not None:             # <<<<<<<<<<<<<<
 *                 self._push_parser_context._validator = \
 *                     self._schema._newSaxValidator(
*/
    }

    /* "src/lxml/parser.pxi":922
 *                     self._schema._newSaxValidator(
 *                         self._parse_options & xmlparser.XML_PARSE_DTDATTR)
 *             pctxt = self._newPushParserCtxt()             # <<<<<<<<<<<<<<
 *             _initParserContext(
 *                 self._push_parser_context, self._resolvers, pctxt)
*/
    __pyx_t_5 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)__pyx_v_self->__pyx_vtab)->_newPushParserCtxt(__pyx_v_self); if (unlikely(__pyx_t_5 == ((void *)NULL))) __PYX_ERR(2, 922, __pyx_L1_error)
    __pyx_v_pctxt = __pyx_t_5;

    /* "src/lxml/parser.pxi":924
 *             pctxt = self._newPushParserCtxt()
 *             _initParserContext(
 *                 self._push_parser_context, self._resolvers, pctxt)             # <<<<<<<<<<<<<<
 *             self._configureSaxContext(pctxt)
 *         return self._push_parser_context
*/
    __pyx_t_4 = ((PyObject *)__pyx_v_self->_push_parser_context);
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_3 = ((PyObject *)__pyx_v_self->_resolvers);
    __Pyx_INCREF(__pyx_t_3);

    /* "src/lxml/parser.pxi":923
 *                         self._parse_options & xmlparser.XML_PARSE_DTDATTR)
 *             pctxt = self._newPushParserCtxt()
 *             _initParserContext(             # <<<<<<<<<<<<<<
 *                 self._push_parser_context, self._resolvers, pctxt)
 *             self._configureSaxContext(pctxt)
*/
    __pyx_t_2 = __pyx_f_4lxml_5etree__initParserContext(((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_4), ((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_t_3), __pyx_v_pctxt); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 923, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/parser.pxi":925
 *             _initParserContext(
 *                 self._push_parser_context, self._resolvers, pctxt)
 *             self._configureSaxContext(pctxt)             # <<<<<<<<<<<<<<
 *         return self._push_parser_context
 * 
*/
    __pyx_t_6 = __pyx_f_4lxml_5etree_11_BaseParser__configureSaxContext(__pyx_v_self, __pyx_v_pctxt); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 925, __pyx_L1_error)

    /* "src/lxml/parser.pxi":914
 *     cdef _ParserContext _getPushParserContext(self):
 *         cdef xmlparser.xmlParserCtxt* pctxt
 *         if self._push_parser_context is None:             # <<<<<<<<<<<<<<
 *             self._push_parser_context = self._createContext(
 *                 self.target, self._events_to_collect)
*/
  }

  /* "src/lxml/parser.pxi":926
 *                 self._push_parser_context, self._resolvers, pctxt)
 *             self._configureSaxContext(pctxt)
 *         return self._push_parser_context             # <<<<<<<<<<<<<<
 * 
 *     cdef _ParserContext _createContext(self, target, events_to_collect):
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_self->_push_parser_context);
  __pyx_r = __pyx_v_self->_push_parser_context;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":912
 *         return self._parser_context
 * 
 *     cdef _ParserContext _getPushParserContext(self):             # <<<<<<<<<<<<<<
 *         cdef xmlparser.xmlParserCtxt* pctxt
 *         if self._push_parser_context is None:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._BaseParser._getPushParserContext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":928
 *         return self._push_parser_context
 * 
 *     cdef _ParserContext _createContext(self, target, events_to_collect):             # <<<<<<<<<<<<<<
 *         """
 *         This method creates and configures the lxml-level parser.
*/

static struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_f_4lxml_5etree_11_BaseParser__createContext(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self, PyObject *__pyx_v_target, PyObject *__pyx_v_events_to_collect) {
  struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_sax_context = 0;
  PyObject *__pyx_v_events = NULL;
  PyObject *__pyx_v_tag = NULL;
  struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_createContext", 0);

  /* "src/lxml/parser.pxi":933
 *         """
 *         cdef _SaxParserContext sax_context
 *         if target is not None:             # <<<<<<<<<<<<<<
 *             sax_context = _TargetParserContext(self)
 *             (<_TargetParserContext>sax_context)._setTarget(target)
*/
  __pyx_t_1 = (__pyx_v_target != Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":934
 *         cdef _SaxParserContext sax_context
 *         if target is not None:
 *             sax_context = _TargetParserContext(self)             # <<<<<<<<<<<<<<
 *             (<_TargetParserContext>sax_context)._setTarget(target)
 *         elif events_to_collect:
*/
    __pyx_t_3 = NULL;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, ((PyObject *)__pyx_v_self)};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__TargetParserContext, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 934, __pyx_L1_error)
      __Pyx_GOTREF((PyObject *)__pyx_t_2);
    }
    __pyx_v_sax_context = ((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/parser.pxi":935
 *         if target is not None:
 *             sax_context = _TargetParserContext(self)
 *             (<_TargetParserContext>sax_context)._setTarget(target)             # <<<<<<<<<<<<<<
 *         elif events_to_collect:
 *             sax_context = _SaxParserContext(self)
*/
    __pyx_t_5 = __pyx_f_4lxml_5etree_20_TargetParserContext__setTarget(((struct __pyx_obj_4lxml_5etree__TargetParserContext *)__pyx_v_sax_context), __pyx_v_target); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(2, 935, __pyx_L1_error)

    /* "src/lxml/parser.pxi":933
 *         """
 *         cdef _SaxParserContext sax_context
 *         if target is not None:             # <<<<<<<<<<<<<<
 *             sax_context = _TargetParserContext(self)
 *             (<_TargetParserContext>sax_context)._setTarget(target)
*/
    goto __pyx_L3;
  }

  /* "src/lxml/parser.pxi":936
 *             sax_context = _TargetParserContext(self)
 *             (<_TargetParserContext>sax_context)._setTarget(target)
 *         elif events_to_collect:             # <<<<<<<<<<<<<<
 *             sax_context = _SaxParserContext(self)
 *         else:
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_events_to_collect); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(2, 936, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":937
 *             (<_TargetParserContext>sax_context)._setTarget(target)
 *         elif events_to_collect:
 *             sax_context = _SaxParserContext(self)             # <<<<<<<<<<<<<<
 *         else:
 *             # nothing special to configure
*/
    __pyx_t_3 = NULL;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, ((PyObject *)__pyx_v_self)};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__SaxParserContext, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 937, __pyx_L1_error)
      __Pyx_GOTREF((PyObject *)__pyx_t_2);
    }
    __pyx_v_sax_context = ((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/parser.pxi":936
 *             sax_context = _TargetParserContext(self)
 *             (<_TargetParserContext>sax_context)._setTarget(target)
 *         elif events_to_collect:             # <<<<<<<<<<<<<<
 *             sax_context = _SaxParserContext(self)
 *         else:
*/
    goto __pyx_L3;
  }

  /* "src/lxml/parser.pxi":940
 *         else:
 *             # nothing special to configure
 *             return _ParserContext()             # <<<<<<<<<<<<<<
 *         if events_to_collect:
 *             events, tag = events_to_collect
*/
  /*else*/ {
    __Pyx_XDECREF((PyObject *)__pyx_r);
    __pyx_t_3 = NULL;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ParserContext, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 940, __pyx_L1_error)
      __Pyx_GOTREF((PyObject *)__pyx_t_2);
    }
    __pyx_r = ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }
  __pyx_L3:;

  /* "src/lxml/parser.pxi":941
 *             # nothing special to configure
 *             return _ParserContext()
 *         if events_to_collect:             # <<<<<<<<<<<<<<
 *             events, tag = events_to_collect
 *             sax_context._setEventFilter(events, tag)
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_events_to_collect); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(2, 941, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":942
 *             return _ParserContext()
 *         if events_to_collect:
 *             events, tag = events_to_collect             # <<<<<<<<<<<<<<
 *             sax_context._setEventFilter(events, tag)
 *         return sax_context
*/
    if ((likely(PyTuple_CheckExact(__pyx_v_events_to_collect))) || (PyList_CheckExact(__pyx_v_events_to_collect))) {
      PyObject* sequence = __pyx_v_events_to_collect;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(2, 942, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
        __Pyx_INCREF(__pyx_t_2);
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
        __Pyx_INCREF(__pyx_t_3);
      } else {
        __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 942, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_2);
        __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 942, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_3);
      }
      #else
      __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 942, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 942, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      #endif
    } else {
      Py_ssize_t index = -1;
      __pyx_t_6 = PyObject_GetIter(__pyx_v_events_to_collect); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 942, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_6);
      index = 0; __pyx_t_2 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_2);
      index = 1; __pyx_t_3 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < (0)) __PYX_ERR(2, 942, __pyx_L1_error)
      __pyx_t_7 = NULL;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L6_unpacking_done;
      __pyx_L5_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_7 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(2, 942, __pyx_L1_error)
      __pyx_L6_unpacking_done:;
    }
    __pyx_v_events = __pyx_t_2;
    __pyx_t_2 = 0;
    __pyx_v_tag = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "src/lxml/parser.pxi":943
 *         if events_to_collect:
 *             events, tag = events_to_collect
 *             sax_context._setEventFilter(events, tag)             # <<<<<<<<<<<<<<
 *         return sax_context
 * 
*/
    __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext *)__pyx_v_sax_context->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->_setEventFilter(__pyx_v_sax_context, __pyx_v_events, __pyx_v_tag); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 943, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/parser.pxi":941
 *             # nothing special to configure
 *             return _ParserContext()
 *         if events_to_collect:             # <<<<<<<<<<<<<<
 *             events, tag = events_to_collect
 *             sax_context._setEventFilter(events, tag)
*/
  }

  /* "src/lxml/parser.pxi":944
 *             events, tag = events_to_collect
 *             sax_context._setEventFilter(events, tag)
 *         return sax_context             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_sax_context);
  __pyx_r = ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_v_sax_context);
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":928
 *         return self._push_parser_context
 * 
 *     cdef _ParserContext _createContext(self, target, events_to_collect):             # <<<<<<<<<<<<<<
 *         """
 *         This method creates and configures the lxml-level parser.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._BaseParser._createContext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_sax_context);
  __Pyx_XDECREF(__pyx_v_events);
  __Pyx_XDECREF(__pyx_v_tag);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":946
 *         return sax_context
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef int _configureSaxContext(self, xmlparser.xmlParserCtxt* pctxt) except -1:
 *         if self._remove_comments:
*/

static int __pyx_f_4lxml_5etree_11_BaseParser__configureSaxContext(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self, xmlParserCtxt *__pyx_v_pctxt) {
  int __pyx_r;
  int __pyx_t_1;

  /* "src/lxml/parser.pxi":948
 *     @cython.final
 *     cdef int _configureSaxContext(self, xmlparser.xmlParserCtxt* pctxt) except -1:
 *         if self._remove_comments:             # <<<<<<<<<<<<<<
 *             pctxt.sax.comment = NULL
 *         if self._remove_pis:
*/
  if (__pyx_v_self->_remove_comments) {

    /* "src/lxml/parser.pxi":949
 *     cdef int _configureSaxContext(self, xmlparser.xmlParserCtxt* pctxt) except -1:
 *         if self._remove_comments:
 *             pctxt.sax.comment = NULL             # <<<<<<<<<<<<<<
 *         if self._remove_pis:
 *             pctxt.sax.processingInstruction = NULL
*/
    __pyx_v_pctxt->sax->comment = NULL;

    /* "src/lxml/parser.pxi":948
 *     @cython.final
 *     cdef int _configureSaxContext(self, xmlparser.xmlParserCtxt* pctxt) except -1:
 *         if self._remove_comments:             # <<<<<<<<<<<<<<
 *             pctxt.sax.comment = NULL
 *         if self._remove_pis:
*/
  }

  /* "src/lxml/parser.pxi":950
 *         if self._remove_comments:
 *             pctxt.sax.comment = NULL
 *         if self._remove_pis:             # <<<<<<<<<<<<<<
 *             pctxt.sax.processingInstruction = NULL
 *         if self._strip_cdata:
*/
  if (__pyx_v_self->_remove_pis) {

    /* "src/lxml/parser.pxi":951
 *             pctxt.sax.comment = NULL
 *         if self._remove_pis:
 *             pctxt.sax.processingInstruction = NULL             # <<<<<<<<<<<<<<
 *         if self._strip_cdata:
 *             # hard switch-off for CDATA nodes => makes them plain text
*/
    __pyx_v_pctxt->sax->processingInstruction = NULL;

    /* "src/lxml/parser.pxi":950
 *         if self._remove_comments:
 *             pctxt.sax.comment = NULL
 *         if self._remove_pis:             # <<<<<<<<<<<<<<
 *             pctxt.sax.processingInstruction = NULL
 *         if self._strip_cdata:
*/
  }

  /* "src/lxml/parser.pxi":952
 *         if self._remove_pis:
 *             pctxt.sax.processingInstruction = NULL
 *         if self._strip_cdata:             # <<<<<<<<<<<<<<
 *             # hard switch-off for CDATA nodes => makes them plain text
 *             pctxt.sax.cdataBlock = NULL
*/
  if (__pyx_v_self->_strip_cdata) {

    /* "src/lxml/parser.pxi":954
 *         if self._strip_cdata:
 *             # hard switch-off for CDATA nodes => makes them plain text
 *             pctxt.sax.cdataBlock = NULL             # <<<<<<<<<<<<<<
 *         if not self._resolve_external_entities:
 *             pctxt.sax.getEntity = _getInternalEntityOnly
*/
    __pyx_v_pctxt->sax->cdataBlock = NULL;

    /* "src/lxml/parser.pxi":952
 *         if self._remove_pis:
 *             pctxt.sax.processingInstruction = NULL
 *         if self._strip_cdata:             # <<<<<<<<<<<<<<
 *             # hard switch-off for CDATA nodes => makes them plain text
 *             pctxt.sax.cdataBlock = NULL
*/
  }

  /* "src/lxml/parser.pxi":955
 *             # hard switch-off for CDATA nodes => makes them plain text
 *             pctxt.sax.cdataBlock = NULL
 *         if not self._resolve_external_entities:             # <<<<<<<<<<<<<<
 *             pctxt.sax.getEntity = _getInternalEntityOnly
 * 
*/
  __pyx_t_1 = (!__pyx_v_self->_resolve_external_entities);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":956
 *             pctxt.sax.cdataBlock = NULL
 *         if not self._resolve_external_entities:
 *             pctxt.sax.getEntity = _getInternalEntityOnly             # <<<<<<<<<<<<<<
 * 
 *     cdef int _registerHtmlErrorHandler(self, xmlparser.xmlParserCtxt* c_ctxt) except -1:
*/
    __pyx_v_pctxt->sax->getEntity = __pyx_f_4lxml_5etree__getInternalEntityOnly;

    /* "src/lxml/parser.pxi":955
 *             # hard switch-off for CDATA nodes => makes them plain text
 *             pctxt.sax.cdataBlock = NULL
 *         if not self._resolve_external_entities:             # <<<<<<<<<<<<<<
 *             pctxt.sax.getEntity = _getInternalEntityOnly
 * 
*/
  }

  /* "src/lxml/parser.pxi":946
 *         return sax_context
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef int _configureSaxContext(self, xmlparser.xmlParserCtxt* pctxt) except -1:
 *         if self._remove_comments:
*/

  /* function exit code */
  __pyx_r = 0;
  return __pyx_r;
}

/* "src/lxml/parser.pxi":958
 *             pctxt.sax.getEntity = _getInternalEntityOnly
 * 
 *     cdef int _registerHtmlErrorHandler(self, xmlparser.xmlParserCtxt* c_ctxt) except -1:             # <<<<<<<<<<<<<<
 *         cdef xmlparser.xmlSAXHandler* sax = c_ctxt.sax
 *         if sax is not NULL and sax.initialized and sax.initialized != xmlparser.XML_SAX2_MAGIC:
*/

static int __pyx_f_4lxml_5etree_11_BaseParser__registerHtmlErrorHandler(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self, xmlParserCtxt *__pyx_v_c_ctxt) {
  xmlSAXHandler *__pyx_v_sax;
  int __pyx_r;
  xmlSAXHandler *__pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/parser.pxi":959
 * 
 *     cdef int _registerHtmlErrorHandler(self, xmlparser.xmlParserCtxt* c_ctxt) except -1:
 *         cdef xmlparser.xmlSAXHandler* sax = c_ctxt.sax             # <<<<<<<<<<<<<<
 *         if sax is not NULL and sax.initialized and sax.initialized != xmlparser.XML_SAX2_MAGIC:
 *             # need to extend SAX1 context to SAX2 to get proper error reports
*/
  __pyx_t_1 = __pyx_v_c_ctxt->sax;
  __pyx_v_sax = __pyx_t_1;

  /* "src/lxml/parser.pxi":960
 *     cdef int _registerHtmlErrorHandler(self, xmlparser.xmlParserCtxt* c_ctxt) except -1:
 *         cdef xmlparser.xmlSAXHandler* sax = c_ctxt.sax
 *         if sax is not NULL and sax.initialized and sax.initialized != xmlparser.XML_SAX2_MAGIC:             # <<<<<<<<<<<<<<
 *             # need to extend SAX1 context to SAX2 to get proper error reports
 *             if <xmlparser.xmlSAXHandlerV1*>sax is &htmlparser.htmlDefaultSAXHandler:
*/
  __pyx_t_3 = (__pyx_v_sax != NULL);
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_sax->initialized != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_sax->initialized != XML_SAX2_MAGIC);
  __pyx_t_2 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "src/lxml/parser.pxi":962
 *         if sax is not NULL and sax.initialized and sax.initialized != xmlparser.XML_SAX2_MAGIC:
 *             # need to extend SAX1 context to SAX2 to get proper error reports
 *             if <xmlparser.xmlSAXHandlerV1*>sax is &htmlparser.htmlDefaultSAXHandler:             # <<<<<<<<<<<<<<
 *                 sax = <xmlparser.xmlSAXHandler*> tree.xmlMalloc(sizeof(xmlparser.xmlSAXHandler))
 *                 if sax is NULL:
*/
    __pyx_t_2 = (((xmlSAXHandlerV1 *)__pyx_v_sax) == (&htmlDefaultSAXHandler));
    if (__pyx_t_2) {

      /* "src/lxml/parser.pxi":963
 *             # need to extend SAX1 context to SAX2 to get proper error reports
 *             if <xmlparser.xmlSAXHandlerV1*>sax is &htmlparser.htmlDefaultSAXHandler:
 *                 sax = <xmlparser.xmlSAXHandler*> tree.xmlMalloc(sizeof(xmlparser.xmlSAXHandler))             # <<<<<<<<<<<<<<
 *                 if sax is NULL:
 *                     raise MemoryError()
*/
      __pyx_v_sax = ((xmlSAXHandler *)xmlMalloc((sizeof(xmlSAXHandler))));

      /* "src/lxml/parser.pxi":964
 *             if <xmlparser.xmlSAXHandlerV1*>sax is &htmlparser.htmlDefaultSAXHandler:
 *                 sax = <xmlparser.xmlSAXHandler*> tree.xmlMalloc(sizeof(xmlparser.xmlSAXHandler))
 *                 if sax is NULL:             # <<<<<<<<<<<<<<
 *                     raise MemoryError()
 *                 cstring_h.memcpy(sax, &htmlparser.htmlDefaultSAXHandler,
*/
      __pyx_t_2 = (__pyx_v_sax == NULL);
      if (unlikely(__pyx_t_2)) {

        /* "src/lxml/parser.pxi":965
 *                 sax = <xmlparser.xmlSAXHandler*> tree.xmlMalloc(sizeof(xmlparser.xmlSAXHandler))
 *                 if sax is NULL:
 *                     raise MemoryError()             # <<<<<<<<<<<<<<
 *                 cstring_h.memcpy(sax, &htmlparser.htmlDefaultSAXHandler,
 *                                  sizeof(htmlparser.htmlDefaultSAXHandler))
*/
        PyErr_NoMemory(); __PYX_ERR(2, 965, __pyx_L1_error)

        /* "src/lxml/parser.pxi":964
 *             if <xmlparser.xmlSAXHandlerV1*>sax is &htmlparser.htmlDefaultSAXHandler:
 *                 sax = <xmlparser.xmlSAXHandler*> tree.xmlMalloc(sizeof(xmlparser.xmlSAXHandler))
 *                 if sax is NULL:             # <<<<<<<<<<<<<<
 *                     raise MemoryError()
 *                 cstring_h.memcpy(sax, &htmlparser.htmlDefaultSAXHandler,
*/
      }

      /* "src/lxml/parser.pxi":966
 *                 if sax is NULL:
 *                     raise MemoryError()
 *                 cstring_h.memcpy(sax, &htmlparser.htmlDefaultSAXHandler,             # <<<<<<<<<<<<<<
 *                                  sizeof(htmlparser.htmlDefaultSAXHandler))
 *                 c_ctxt.sax = sax
*/
      (void)(memcpy(__pyx_v_sax, (&htmlDefaultSAXHandler), (sizeof(htmlDefaultSAXHandler))));

      /* "src/lxml/parser.pxi":968
 *                 cstring_h.memcpy(sax, &htmlparser.htmlDefaultSAXHandler,
 *                                  sizeof(htmlparser.htmlDefaultSAXHandler))
 *                 c_ctxt.sax = sax             # <<<<<<<<<<<<<<
 *             sax.initialized = xmlparser.XML_SAX2_MAGIC
 *             # Need a cast here because older libxml2 releases do not use 'const' in the functype.
*/
      __pyx_v_c_ctxt->sax = __pyx_v_sax;

      /* "src/lxml/parser.pxi":962
 *         if sax is not NULL and sax.initialized and sax.initialized != xmlparser.XML_SAX2_MAGIC:
 *             # need to extend SAX1 context to SAX2 to get proper error reports
 *             if <xmlparser.xmlSAXHandlerV1*>sax is &htmlparser.htmlDefaultSAXHandler:             # <<<<<<<<<<<<<<
 *                 sax = <xmlparser.xmlSAXHandler*> tree.xmlMalloc(sizeof(xmlparser.xmlSAXHandler))
 *                 if sax is NULL:
*/
    }

    /* "src/lxml/parser.pxi":969
 *                                  sizeof(htmlparser.htmlDefaultSAXHandler))
 *                 c_ctxt.sax = sax
 *             sax.initialized = xmlparser.XML_SAX2_MAGIC             # <<<<<<<<<<<<<<
 *             # Need a cast here because older libxml2 releases do not use 'const' in the functype.
 *             sax.serror = <xmlerror.xmlStructuredErrorFunc> _receiveParserError
*/
    __pyx_v_sax->initialized = XML_SAX2_MAGIC;

    /* "src/lxml/parser.pxi":971
 *             sax.initialized = xmlparser.XML_SAX2_MAGIC
 *             # Need a cast here because older libxml2 releases do not use 'const' in the functype.
 *             sax.serror = <xmlerror.xmlStructuredErrorFunc> _receiveParserError             # <<<<<<<<<<<<<<
 *             sax.startElementNs = NULL
 *             sax.endElementNs = NULL
*/
    __pyx_v_sax->serror = ((xmlStructuredErrorFunc)__pyx_f_4lxml_5etree__receiveParserError);

    /* "src/lxml/parser.pxi":972
 *             # Need a cast here because older libxml2 releases do not use 'const' in the functype.
 *             sax.serror = <xmlerror.xmlStructuredErrorFunc> _receiveParserError
 *             sax.startElementNs = NULL             # <<<<<<<<<<<<<<
 *             sax.endElementNs = NULL
 *             sax._private = NULL
*/
    __pyx_v_sax->startElementNs = NULL;

    /* "src/lxml/parser.pxi":973
 *             sax.serror = <xmlerror.xmlStructuredErrorFunc> _receiveParserError
 *             sax.startElementNs = NULL
 *             sax.endElementNs = NULL             # <<<<<<<<<<<<<<
 *             sax._private = NULL
 *         return 0
*/
    __pyx_v_sax->endElementNs = NULL;

    /* "src/lxml/parser.pxi":974
 *             sax.startElementNs = NULL
 *             sax.endElementNs = NULL
 *             sax._private = NULL             # <<<<<<<<<<<<<<
 *         return 0
 * 
*/
    __pyx_v_sax->_private = NULL;

    /* "src/lxml/parser.pxi":960
 *     cdef int _registerHtmlErrorHandler(self, xmlparser.xmlParserCtxt* c_ctxt) except -1:
 *         cdef xmlparser.xmlSAXHandler* sax = c_ctxt.sax
 *         if sax is not NULL and sax.initialized and sax.initialized != xmlparser.XML_SAX2_MAGIC:             # <<<<<<<<<<<<<<
 *             # need to extend SAX1 context to SAX2 to get proper error reports
 *             if <xmlparser.xmlSAXHandlerV1*>sax is &htmlparser.htmlDefaultSAXHandler:
*/
  }

  /* "src/lxml/parser.pxi":975
 *             sax.endElementNs = NULL
 *             sax._private = NULL
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     cdef xmlparser.xmlParserCtxt* _newParserCtxt(self) except NULL:
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":958
 *             pctxt.sax.getEntity = _getInternalEntityOnly
 * 
 *     cdef int _registerHtmlErrorHandler(self, xmlparser.xmlParserCtxt* c_ctxt) except -1:             # <<<<<<<<<<<<<<
 *         cdef xmlparser.xmlSAXHandler* sax = c_ctxt.sax
 *         if sax is not NULL and sax.initialized and sax.initialized != xmlparser.XML_SAX2_MAGIC:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._BaseParser._registerHtmlErrorHandler", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/parser.pxi":977
 *         return 0
 * 
 *     cdef xmlparser.xmlParserCtxt* _newParserCtxt(self) except NULL:             # <<<<<<<<<<<<<<
 *         """
 *         Create and initialise a libxml2-level parser context.
*/

static xmlParserCtxt *__pyx_f_4lxml_5etree_11_BaseParser__newParserCtxt(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self) {
  xmlParserCtxt *__pyx_v_c_ctxt;
  xmlParserCtxt *__pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/parser.pxi":982
 *         """
 *         cdef xmlparser.xmlParserCtxt* c_ctxt
 *         if self._for_html:             # <<<<<<<<<<<<<<
 *             c_ctxt = htmlparser.htmlCreateMemoryParserCtxt('dummy', 5)
 *             if c_ctxt is not NULL:
*/
  if (__pyx_v_self->_for_html) {

    /* "src/lxml/parser.pxi":983
 *         cdef xmlparser.xmlParserCtxt* c_ctxt
 *         if self._for_html:
 *             c_ctxt = htmlparser.htmlCreateMemoryParserCtxt('dummy', 5)             # <<<<<<<<<<<<<<
 *             if c_ctxt is not NULL:
 *                 self._registerHtmlErrorHandler(c_ctxt)
*/
    __pyx_v_c_ctxt = htmlCreateMemoryParserCtxt(((char *)"dummy"), 5);

    /* "src/lxml/parser.pxi":984
 *         if self._for_html:
 *             c_ctxt = htmlparser.htmlCreateMemoryParserCtxt('dummy', 5)
 *             if c_ctxt is not NULL:             # <<<<<<<<<<<<<<
 *                 self._registerHtmlErrorHandler(c_ctxt)
 *         else:
*/
    __pyx_t_1 = (__pyx_v_c_ctxt != NULL);
    if (__pyx_t_1) {

      /* "src/lxml/parser.pxi":985
 *             c_ctxt = htmlparser.htmlCreateMemoryParserCtxt('dummy', 5)
 *             if c_ctxt is not NULL:
 *                 self._registerHtmlErrorHandler(c_ctxt)             # <<<<<<<<<<<<<<
 *         else:
 *             c_ctxt = xmlparser.xmlNewParserCtxt()
*/
      __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)__pyx_v_self->__pyx_vtab)->_registerHtmlErrorHandler(__pyx_v_self, __pyx_v_c_ctxt); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(2, 985, __pyx_L1_error)

      /* "src/lxml/parser.pxi":984
 *         if self._for_html:
 *             c_ctxt = htmlparser.htmlCreateMemoryParserCtxt('dummy', 5)
 *             if c_ctxt is not NULL:             # <<<<<<<<<<<<<<
 *                 self._registerHtmlErrorHandler(c_ctxt)
 *         else:
*/
    }

    /* "src/lxml/parser.pxi":982
 *         """
 *         cdef xmlparser.xmlParserCtxt* c_ctxt
 *         if self._for_html:             # <<<<<<<<<<<<<<
 *             c_ctxt = htmlparser.htmlCreateMemoryParserCtxt('dummy', 5)
 *             if c_ctxt is not NULL:
*/
    goto __pyx_L3;
  }

  /* "src/lxml/parser.pxi":987
 *                 self._registerHtmlErrorHandler(c_ctxt)
 *         else:
 *             c_ctxt = xmlparser.xmlNewParserCtxt()             # <<<<<<<<<<<<<<
 *         if c_ctxt is NULL:
 *             raise MemoryError
*/
  /*else*/ {
    __pyx_v_c_ctxt = xmlNewParserCtxt();
  }
  __pyx_L3:;

  /* "src/lxml/parser.pxi":988
 *         else:
 *             c_ctxt = xmlparser.xmlNewParserCtxt()
 *         if c_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError
 *         c_ctxt.sax.startDocument = _initSaxDocument
*/
  __pyx_t_1 = (__pyx_v_c_ctxt == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/parser.pxi":989
 *             c_ctxt = xmlparser.xmlNewParserCtxt()
 *         if c_ctxt is NULL:
 *             raise MemoryError             # <<<<<<<<<<<<<<
 *         c_ctxt.sax.startDocument = _initSaxDocument
 *         return c_ctxt
*/
    PyErr_NoMemory(); __PYX_ERR(2, 989, __pyx_L1_error)

    /* "src/lxml/parser.pxi":988
 *         else:
 *             c_ctxt = xmlparser.xmlNewParserCtxt()
 *         if c_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError
 *         c_ctxt.sax.startDocument = _initSaxDocument
*/
  }

  /* "src/lxml/parser.pxi":990
 *         if c_ctxt is NULL:
 *             raise MemoryError
 *         c_ctxt.sax.startDocument = _initSaxDocument             # <<<<<<<<<<<<<<
 *         return c_ctxt
 * 
*/
  __pyx_v_c_ctxt->sax->startDocument = __pyx_f_4lxml_5etree__initSaxDocument;

  /* "src/lxml/parser.pxi":991
 *             raise MemoryError
 *         c_ctxt.sax.startDocument = _initSaxDocument
 *         return c_ctxt             # <<<<<<<<<<<<<<
 * 
 *     cdef xmlparser.xmlParserCtxt* _newPushParserCtxt(self) except NULL:
*/
  __pyx_r = __pyx_v_c_ctxt;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":977
 *         return 0
 * 
 *     cdef xmlparser.xmlParserCtxt* _newParserCtxt(self) except NULL:             # <<<<<<<<<<<<<<
 *         """
 *         Create and initialise a libxml2-level parser context.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._BaseParser._newParserCtxt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/parser.pxi":993
 *         return c_ctxt
 * 
 *     cdef xmlparser.xmlParserCtxt* _newPushParserCtxt(self) except NULL:             # <<<<<<<<<<<<<<
 *         cdef xmlparser.xmlParserCtxt* c_ctxt
 *         cdef char* c_filename = _cstr(self._filename) if self._filename is not None else NULL
*/

static xmlParserCtxt *__pyx_f_4lxml_5etree_11_BaseParser__newPushParserCtxt(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self) {
  xmlParserCtxt *__pyx_v_c_ctxt;
  char *__pyx_v_c_filename;
  xmlParserCtxt *__pyx_r;
  __Pyx_RefNannyDeclarations
  char *__pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_newPushParserCtxt", 0);

  /* "src/lxml/parser.pxi":995
 *     cdef xmlparser.xmlParserCtxt* _newPushParserCtxt(self) except NULL:
 *         cdef xmlparser.xmlParserCtxt* c_ctxt
 *         cdef char* c_filename = _cstr(self._filename) if self._filename is not None else NULL             # <<<<<<<<<<<<<<
 *         if self._for_html:
 *             c_ctxt = htmlparser.htmlCreatePushParserCtxt(
*/
  __pyx_t_2 = (__pyx_v_self->_filename != ((PyObject*)Py_None));
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_v_self->_filename;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_1 = PyBytes_AS_STRING(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = NULL;
  }
  __pyx_v_c_filename = __pyx_t_1;

  /* "src/lxml/parser.pxi":996
 *         cdef xmlparser.xmlParserCtxt* c_ctxt
 *         cdef char* c_filename = _cstr(self._filename) if self._filename is not None else NULL
 *         if self._for_html:             # <<<<<<<<<<<<<<
 *             c_ctxt = htmlparser.htmlCreatePushParserCtxt(
 *                 NULL, NULL, NULL, 0, c_filename, tree.XML_CHAR_ENCODING_NONE)
*/
  if (__pyx_v_self->_for_html) {

    /* "src/lxml/parser.pxi":997
 *         cdef char* c_filename = _cstr(self._filename) if self._filename is not None else NULL
 *         if self._for_html:
 *             c_ctxt = htmlparser.htmlCreatePushParserCtxt(             # <<<<<<<<<<<<<<
 *                 NULL, NULL, NULL, 0, c_filename, tree.XML_CHAR_ENCODING_NONE)
 *             if c_ctxt is not NULL:
*/
    __pyx_v_c_ctxt = htmlCreatePushParserCtxt(NULL, NULL, NULL, 0, __pyx_v_c_filename, XML_CHAR_ENCODING_NONE);

    /* "src/lxml/parser.pxi":999
 *             c_ctxt = htmlparser.htmlCreatePushParserCtxt(
 *                 NULL, NULL, NULL, 0, c_filename, tree.XML_CHAR_ENCODING_NONE)
 *             if c_ctxt is not NULL:             # <<<<<<<<<<<<<<
 *                 self._registerHtmlErrorHandler(c_ctxt)
 *                 htmlparser.htmlCtxtUseOptions(c_ctxt, self._parse_options)
*/
    __pyx_t_2 = (__pyx_v_c_ctxt != NULL);
    if (__pyx_t_2) {

      /* "src/lxml/parser.pxi":1000
 *                 NULL, NULL, NULL, 0, c_filename, tree.XML_CHAR_ENCODING_NONE)
 *             if c_ctxt is not NULL:
 *                 self._registerHtmlErrorHandler(c_ctxt)             # <<<<<<<<<<<<<<
 *                 htmlparser.htmlCtxtUseOptions(c_ctxt, self._parse_options)
 *         else:
*/
      __pyx_t_4 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)__pyx_v_self->__pyx_vtab)->_registerHtmlErrorHandler(__pyx_v_self, __pyx_v_c_ctxt); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 1000, __pyx_L1_error)

      /* "src/lxml/parser.pxi":1001
 *             if c_ctxt is not NULL:
 *                 self._registerHtmlErrorHandler(c_ctxt)
 *                 htmlparser.htmlCtxtUseOptions(c_ctxt, self._parse_options)             # <<<<<<<<<<<<<<
 *         else:
 *             c_ctxt = xmlparser.xmlCreatePushParserCtxt(
*/
      (void)(htmlCtxtUseOptions(__pyx_v_c_ctxt, __pyx_v_self->_parse_options));

      /* "src/lxml/parser.pxi":999
 *             c_ctxt = htmlparser.htmlCreatePushParserCtxt(
 *                 NULL, NULL, NULL, 0, c_filename, tree.XML_CHAR_ENCODING_NONE)
 *             if c_ctxt is not NULL:             # <<<<<<<<<<<<<<
 *                 self._registerHtmlErrorHandler(c_ctxt)
 *                 htmlparser.htmlCtxtUseOptions(c_ctxt, self._parse_options)
*/
    }

    /* "src/lxml/parser.pxi":996
 *         cdef xmlparser.xmlParserCtxt* c_ctxt
 *         cdef char* c_filename = _cstr(self._filename) if self._filename is not None else NULL
 *         if self._for_html:             # <<<<<<<<<<<<<<
 *             c_ctxt = htmlparser.htmlCreatePushParserCtxt(
 *                 NULL, NULL, NULL, 0, c_filename, tree.XML_CHAR_ENCODING_NONE)
*/
    goto __pyx_L3;
  }

  /* "src/lxml/parser.pxi":1003
 *                 htmlparser.htmlCtxtUseOptions(c_ctxt, self._parse_options)
 *         else:
 *             c_ctxt = xmlparser.xmlCreatePushParserCtxt(             # <<<<<<<<<<<<<<
 *                 NULL, NULL, NULL, 0, c_filename)
 *             if c_ctxt is not NULL:
*/
  /*else*/ {

    /* "src/lxml/parser.pxi":1004
 *         else:
 *             c_ctxt = xmlparser.xmlCreatePushParserCtxt(
 *                 NULL, NULL, NULL, 0, c_filename)             # <<<<<<<<<<<<<<
 *             if c_ctxt is not NULL:
 *                 xmlparser.xmlCtxtUseOptions(c_ctxt, self._parse_options)
*/
    __pyx_v_c_ctxt = xmlCreatePushParserCtxt(NULL, NULL, NULL, 0, __pyx_v_c_filename);

    /* "src/lxml/parser.pxi":1005
 *             c_ctxt = xmlparser.xmlCreatePushParserCtxt(
 *                 NULL, NULL, NULL, 0, c_filename)
 *             if c_ctxt is not NULL:             # <<<<<<<<<<<<<<
 *                 xmlparser.xmlCtxtUseOptions(c_ctxt, self._parse_options)
 *         if c_ctxt is NULL:
*/
    __pyx_t_2 = (__pyx_v_c_ctxt != NULL);
    if (__pyx_t_2) {

      /* "src/lxml/parser.pxi":1006
 *                 NULL, NULL, NULL, 0, c_filename)
 *             if c_ctxt is not NULL:
 *                 xmlparser.xmlCtxtUseOptions(c_ctxt, self._parse_options)             # <<<<<<<<<<<<<<
 *         if c_ctxt is NULL:
 *             raise MemoryError()
*/
      (void)(xmlCtxtUseOptions(__pyx_v_c_ctxt, __pyx_v_self->_parse_options));

      /* "src/lxml/parser.pxi":1005
 *             c_ctxt = xmlparser.xmlCreatePushParserCtxt(
 *                 NULL, NULL, NULL, 0, c_filename)
 *             if c_ctxt is not NULL:             # <<<<<<<<<<<<<<
 *                 xmlparser.xmlCtxtUseOptions(c_ctxt, self._parse_options)
 *         if c_ctxt is NULL:
*/
    }
  }
  __pyx_L3:;

  /* "src/lxml/parser.pxi":1007
 *             if c_ctxt is not NULL:
 *                 xmlparser.xmlCtxtUseOptions(c_ctxt, self._parse_options)
 *         if c_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 *         c_ctxt.sax.startDocument = _initSaxDocument
*/
  __pyx_t_2 = (__pyx_v_c_ctxt == NULL);
  if (unlikely(__pyx_t_2)) {

    /* "src/lxml/parser.pxi":1008
 *                 xmlparser.xmlCtxtUseOptions(c_ctxt, self._parse_options)
 *         if c_ctxt is NULL:
 *             raise MemoryError()             # <<<<<<<<<<<<<<
 *         c_ctxt.sax.startDocument = _initSaxDocument
 *         return c_ctxt
*/
    PyErr_NoMemory(); __PYX_ERR(2, 1008, __pyx_L1_error)

    /* "src/lxml/parser.pxi":1007
 *             if c_ctxt is not NULL:
 *                 xmlparser.xmlCtxtUseOptions(c_ctxt, self._parse_options)
 *         if c_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 *         c_ctxt.sax.startDocument = _initSaxDocument
*/
  }

  /* "src/lxml/parser.pxi":1009
 *         if c_ctxt is NULL:
 *             raise MemoryError()
 *         c_ctxt.sax.startDocument = _initSaxDocument             # <<<<<<<<<<<<<<
 *         return c_ctxt
 * 
*/
  __pyx_v_c_ctxt->sax->startDocument = __pyx_f_4lxml_5etree__initSaxDocument;

  /* "src/lxml/parser.pxi":1010
 *             raise MemoryError()
 *         c_ctxt.sax.startDocument = _initSaxDocument
 *         return c_ctxt             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __pyx_r = __pyx_v_c_ctxt;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":993
 *         return c_ctxt
 * 
 *     cdef xmlparser.xmlParserCtxt* _newPushParserCtxt(self) except NULL:             # <<<<<<<<<<<<<<
 *         cdef xmlparser.xmlParserCtxt* c_ctxt
 *         cdef char* c_filename = _cstr(self._filename) if self._filename is not None else NULL
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._BaseParser._newPushParserCtxt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":1012
 *         return c_ctxt
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def error_log(self):
 *         """The error log of the last parser run.
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_11_BaseParser_9error_log_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_11_BaseParser_9error_log_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_11_BaseParser_9error_log___get__(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_11_BaseParser_9error_log___get__(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_context = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "src/lxml/parser.pxi":1017
 *         """
 *         cdef _ParserContext context
 *         context = self._getParserContext()             # <<<<<<<<<<<<<<
 *         return context._error_log.copy()
 * 
*/
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)__pyx_v_self->__pyx_vtab)->_getParserContext(__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1017, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/parser.pxi":1018
 *         cdef _ParserContext context
 *         context = self._getParserContext()
 *         return context._error_log.copy()             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)__pyx_v_context->_error_log->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.copy(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_context->_error_log), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1018, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":1012
 *         return c_ctxt
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def error_log(self):
 *         """The error log of the last parser run.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._BaseParser.error_log.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":1020
 *         return context._error_log.copy()
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def resolvers(self):
 *         """The custom resolver registry of this parser."""
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_11_BaseParser_9resolvers_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_11_BaseParser_9resolvers_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_11_BaseParser_9resolvers___get__(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_11_BaseParser_9resolvers___get__(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "src/lxml/parser.pxi":1023
 *     def resolvers(self):
 *         """The custom resolver registry of this parser."""
 *         return self._resolvers             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_self->_resolvers);
  __pyx_r = ((PyObject *)__pyx_v_self->_resolvers);
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":1020
 *         return context._error_log.copy()
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def resolvers(self):
 *         """The custom resolver registry of this parser."""
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":1025
 *         return self._resolvers
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def version(self):
 *         """The version of the underlying XML parser."""
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_11_BaseParser_7version_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_11_BaseParser_7version_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_11_BaseParser_7version___get__(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_11_BaseParser_7version___get__(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "src/lxml/parser.pxi":1028
 *     def version(self):
 *         """The version of the underlying XML parser."""
 *         return "libxml2 %d.%d.%d" % LIBXML_VERSION             # <<<<<<<<<<<<<<
 * 
 *     def set_element_class_lookup(self, ElementClassLookup lookup = None):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_LIBXML_VERSION); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1028, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyUnicode_FormatSafe(__pyx_mstate_global->__pyx_kp_u_libxml2_d_d_d, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1028, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":1025
 *         return self._resolvers
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def version(self):
 *         """The version of the underlying XML parser."""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._BaseParser.version.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":1030
 *         return "libxml2 %d.%d.%d" % LIBXML_VERSION
 * 
 *     def set_element_class_lookup(self, ElementClassLookup lookup = None):             # <<<<<<<<<<<<<<
 *         """set_element_class_lookup(self, lookup = None)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_11_BaseParser_3set_element_class_lookup(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_11_BaseParser_2set_element_class_lookup, "set_element_class_lookup(self, lookup = None)\n\n        Set a lookup scheme for element classes generated from this parser.\n\n        Reset it by passing None or nothing.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_11_BaseParser_3set_element_class_lookup = {"set_element_class_lookup", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_11_BaseParser_3set_element_class_lookup, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_11_BaseParser_2set_element_class_lookup};
static PyObject *__pyx_pw_4lxml_5etree_11_BaseParser_3set_element_class_lookup(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct LxmlElementClassLookup *__pyx_v_lookup = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_element_class_lookup (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_lookup,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(2, 1030, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(2, 1030, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "set_element_class_lookup", 0) < (0)) __PYX_ERR(2, 1030, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef((PyObject *)((struct LxmlElementClassLookup *)Py_None));
    } else {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(2, 1030, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef((PyObject *)((struct LxmlElementClassLookup *)Py_None));
    }
    __pyx_v_lookup = ((struct LxmlElementClassLookup *)values[0]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_element_class_lookup", 0, 0, 1, __pyx_nargs); __PYX_ERR(2, 1030, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._BaseParser.set_element_class_lookup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lookup), __pyx_mstate_global->__pyx_ptype_4lxml_5etree_ElementClassLookup, 1, "lookup", 0))) __PYX_ERR(2, 1030, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_11_BaseParser_2set_element_class_lookup(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self), __pyx_v_lookup);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_11_BaseParser_2set_element_class_lookup(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self, struct LxmlElementClassLookup *__pyx_v_lookup) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_element_class_lookup", 0);

  /* "src/lxml/parser.pxi":1037
 *         Reset it by passing None or nothing.
 *         """
 *         self._class_lookup = lookup             # <<<<<<<<<<<<<<
 * 
 *     cdef _BaseParser _copy(self):
*/
  __Pyx_INCREF((PyObject *)__pyx_v_lookup);
  __Pyx_GIVEREF((PyObject *)__pyx_v_lookup);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_class_lookup);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_class_lookup);
  __pyx_v_self->_class_lookup = __pyx_v_lookup;

  /* "src/lxml/parser.pxi":1030
 *         return "libxml2 %d.%d.%d" % LIBXML_VERSION
 * 
 *     def set_element_class_lookup(self, ElementClassLookup lookup = None):             # <<<<<<<<<<<<<<
 *         """set_element_class_lookup(self, lookup = None)
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":1039
 *         self._class_lookup = lookup
 * 
 *     cdef _BaseParser _copy(self):             # <<<<<<<<<<<<<<
 *         "Create a new parser with the same configuration."
 *         cdef _BaseParser parser
*/

static struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_f_4lxml_5etree_11_BaseParser__copy(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser = 0;
  struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_copy", 0);

  /* "src/lxml/parser.pxi":1042
 *         "Create a new parser with the same configuration."
 *         cdef _BaseParser parser
 *         parser = self.__class__()             # <<<<<<<<<<<<<<
 *         parser._parse_options = self._parse_options
 *         parser._for_html = self._for_html
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_class, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1042, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__BaseParser))))) __PYX_ERR(2, 1042, __pyx_L1_error)
  __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/parser.pxi":1043
 *         cdef _BaseParser parser
 *         parser = self.__class__()
 *         parser._parse_options = self._parse_options             # <<<<<<<<<<<<<<
 *         parser._for_html = self._for_html
 *         parser._remove_comments = self._remove_comments
*/
  __pyx_t_4 = __pyx_v_self->_parse_options;
  __pyx_v_parser->_parse_options = __pyx_t_4;

  /* "src/lxml/parser.pxi":1044
 *         parser = self.__class__()
 *         parser._parse_options = self._parse_options
 *         parser._for_html = self._for_html             # <<<<<<<<<<<<<<
 *         parser._remove_comments = self._remove_comments
 *         parser._remove_pis = self._remove_pis
*/
  __pyx_t_5 = __pyx_v_self->_for_html;
  __pyx_v_parser->_for_html = __pyx_t_5;

  /* "src/lxml/parser.pxi":1045
 *         parser._parse_options = self._parse_options
 *         parser._for_html = self._for_html
 *         parser._remove_comments = self._remove_comments             # <<<<<<<<<<<<<<
 *         parser._remove_pis = self._remove_pis
 *         parser._strip_cdata = self._strip_cdata
*/
  __pyx_t_5 = __pyx_v_self->_remove_comments;
  __pyx_v_parser->_remove_comments = __pyx_t_5;

  /* "src/lxml/parser.pxi":1046
 *         parser._for_html = self._for_html
 *         parser._remove_comments = self._remove_comments
 *         parser._remove_pis = self._remove_pis             # <<<<<<<<<<<<<<
 *         parser._strip_cdata = self._strip_cdata
 *         parser._filename = self._filename
*/
  __pyx_t_5 = __pyx_v_self->_remove_pis;
  __pyx_v_parser->_remove_pis = __pyx_t_5;

  /* "src/lxml/parser.pxi":1047
 *         parser._remove_comments = self._remove_comments
 *         parser._remove_pis = self._remove_pis
 *         parser._strip_cdata = self._strip_cdata             # <<<<<<<<<<<<<<
 *         parser._filename = self._filename
 *         parser._resolvers = self._resolvers
*/
  __pyx_t_5 = __pyx_v_self->_strip_cdata;
  __pyx_v_parser->_strip_cdata = __pyx_t_5;

  /* "src/lxml/parser.pxi":1048
 *         parser._remove_pis = self._remove_pis
 *         parser._strip_cdata = self._strip_cdata
 *         parser._filename = self._filename             # <<<<<<<<<<<<<<
 *         parser._resolvers = self._resolvers
 *         parser.target = self.target
*/
  __pyx_t_1 = __pyx_v_self->_filename;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_parser->_filename);
  __Pyx_DECREF(__pyx_v_parser->_filename);
  __pyx_v_parser->_filename = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/parser.pxi":1049
 *         parser._strip_cdata = self._strip_cdata
 *         parser._filename = self._filename
 *         parser._resolvers = self._resolvers             # <<<<<<<<<<<<<<
 *         parser.target = self.target
 *         parser._class_lookup  = self._class_lookup
*/
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_resolvers);
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF((PyObject *)__pyx_v_parser->_resolvers);
  __Pyx_DECREF((PyObject *)__pyx_v_parser->_resolvers);
  __pyx_v_parser->_resolvers = ((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/parser.pxi":1050
 *         parser._filename = self._filename
 *         parser._resolvers = self._resolvers
 *         parser.target = self.target             # <<<<<<<<<<<<<<
 *         parser._class_lookup  = self._class_lookup
 *         parser._default_encoding = self._default_encoding
*/
  __pyx_t_1 = __pyx_v_self->target;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_parser->target);
  __Pyx_DECREF(__pyx_v_parser->target);
  __pyx_v_parser->target = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "src/lxml/parser.pxi":1051
 *         parser._resolvers = self._resolvers
 *         parser.target = self.target
 *         parser._class_lookup  = self._class_lookup             # <<<<<<<<<<<<<<
 *         parser._default_encoding = self._default_encoding
 *         parser._schema = self._schema
*/
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_class_lookup);
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF((PyObject *)__pyx_v_parser->_class_lookup);
  __Pyx_DECREF((PyObject *)__pyx_v_parser->_class_lookup);
  __pyx_v_parser->_class_lookup = ((struct LxmlElementClassLookup *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/parser.pxi":1052
 *         parser.target = self.target
 *         parser._class_lookup  = self._class_lookup
 *         parser._default_encoding = self._default_encoding             # <<<<<<<<<<<<<<
 *         parser._schema = self._schema
 *         parser._events_to_collect = self._events_to_collect
*/
  __pyx_t_1 = __pyx_v_self->_default_encoding;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_parser->_default_encoding);
  __Pyx_DECREF(__pyx_v_parser->_default_encoding);
  __pyx_v_parser->_default_encoding = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "src/lxml/parser.pxi":1053
 *         parser._class_lookup  = self._class_lookup
 *         parser._default_encoding = self._default_encoding
 *         parser._schema = self._schema             # <<<<<<<<<<<<<<
 *         parser._events_to_collect = self._events_to_collect
 *         return parser
*/
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_schema);
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF((PyObject *)__pyx_v_parser->_schema);
  __Pyx_DECREF((PyObject *)__pyx_v_parser->_schema);
  __pyx_v_parser->_schema = ((struct __pyx_obj_4lxml_5etree_XMLSchema *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/parser.pxi":1054
 *         parser._default_encoding = self._default_encoding
 *         parser._schema = self._schema
 *         parser._events_to_collect = self._events_to_collect             # <<<<<<<<<<<<<<
 *         return parser
 * 
*/
  __pyx_t_1 = __pyx_v_self->_events_to_collect;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_parser->_events_to_collect);
  __Pyx_DECREF(__pyx_v_parser->_events_to_collect);
  __pyx_v_parser->_events_to_collect = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/parser.pxi":1055
 *         parser._schema = self._schema
 *         parser._events_to_collect = self._events_to_collect
 *         return parser             # <<<<<<<<<<<<<<
 * 
 *     def copy(self):
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_parser);
  __pyx_r = __pyx_v_parser;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":1039
 *         self._class_lookup = lookup
 * 
 *     cdef _BaseParser _copy(self):             # <<<<<<<<<<<<<<
 *         "Create a new parser with the same configuration."
 *         cdef _BaseParser parser
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._BaseParser._copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_parser);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":1057
 *         return parser
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         """copy(self)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_11_BaseParser_5copy(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_11_BaseParser_4copy, "copy(self)\n\n        Create a new parser with the same configuration.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_11_BaseParser_5copy = {"copy", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_11_BaseParser_5copy, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_11_BaseParser_4copy};
static PyObject *__pyx_pw_4lxml_5etree_11_BaseParser_5copy(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("copy", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("copy", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_11_BaseParser_4copy(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_11_BaseParser_4copy(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy", 0);

  /* "src/lxml/parser.pxi":1062
 *         Create a new parser with the same configuration.
 *         """
 *         return self._copy()             # <<<<<<<<<<<<<<
 * 
 *     def makeelement(self, _tag, attrib=None, nsmap=None, **_extra):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)__pyx_v_self->__pyx_vtab)->_copy(__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1062, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":1057
 *         return parser
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         """copy(self)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._BaseParser.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":1064
 *         return self._copy()
 * 
 *     def makeelement(self, _tag, attrib=None, nsmap=None, **_extra):             # <<<<<<<<<<<<<<
 *         """makeelement(self, _tag, attrib=None, nsmap=None, **_extra)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_11_BaseParser_7makeelement(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_11_BaseParser_6makeelement, "makeelement(self, _tag, attrib=None, nsmap=None, **_extra)\n\n        Creates a new element associated with this parser.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_11_BaseParser_7makeelement = {"makeelement", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_11_BaseParser_7makeelement, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_11_BaseParser_6makeelement};
static PyObject *__pyx_pw_4lxml_5etree_11_BaseParser_7makeelement(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v__tag = 0;
  PyObject *__pyx_v_attrib = 0;
  PyObject *__pyx_v_nsmap = 0;
  PyObject *__pyx_v__extra = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("makeelement (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  __pyx_v__extra = PyDict_New(); if (unlikely(!__pyx_v__extra)) return NULL;
  __Pyx_GOTREF(__pyx_v__extra);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_tag_2,&__pyx_mstate_global->__pyx_n_u_attrib,&__pyx_mstate_global->__pyx_n_u_nsmap,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(2, 1064, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(2, 1064, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(2, 1064, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(2, 1064, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v__extra, values, kwd_pos_args, __pyx_kwds_len, "makeelement", 1) < (0)) __PYX_ERR(2, 1064, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("makeelement", 0, 1, 3, i); __PYX_ERR(2, 1064, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(2, 1064, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(2, 1064, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(2, 1064, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v__tag = values[0];
    __pyx_v_attrib = values[1];
    __pyx_v_nsmap = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("makeelement", 0, 1, 3, __pyx_nargs); __PYX_ERR(2, 1064, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v__extra); __pyx_v__extra = 0;
  __Pyx_AddTraceback("lxml.etree._BaseParser.makeelement", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_11_BaseParser_6makeelement(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self), __pyx_v__tag, __pyx_v_attrib, __pyx_v_nsmap, __pyx_v__extra);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v__extra);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_11_BaseParser_6makeelement(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self, PyObject *__pyx_v__tag, PyObject *__pyx_v_attrib, PyObject *__pyx_v_nsmap, PyObject *__pyx_v__extra) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("makeelement", 0);

  /* "src/lxml/parser.pxi":1069
 *         Creates a new element associated with this parser.
 *         """
 *         return _makeElement(_tag, NULL, None, self, None, None,             # <<<<<<<<<<<<<<
 *                             attrib, nsmap, _extra)
 * 
*/
  __Pyx_XDECREF(__pyx_r);

  /* "src/lxml/parser.pxi":1070
 *         """
 *         return _makeElement(_tag, NULL, None, self, None, None,
 *                             attrib, nsmap, _extra)             # <<<<<<<<<<<<<<
 * 
 *     # internal parser methods
*/
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__makeElement(__pyx_v__tag, NULL, ((struct LxmlDocument *)Py_None), __pyx_v_self, Py_None, Py_None, __pyx_v_attrib, __pyx_v_nsmap, __pyx_v__extra)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1069, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":1064
 *         return self._copy()
 * 
 *     def makeelement(self, _tag, attrib=None, nsmap=None, **_extra):             # <<<<<<<<<<<<<<
 *         """makeelement(self, _tag, attrib=None, nsmap=None, **_extra)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._BaseParser.makeelement", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":1074
 *     # internal parser methods
 * 
 *     cdef xmlDoc* _parseUnicodeDoc(self, utext, char* c_filename) except NULL:             # <<<<<<<<<<<<<<
 *         """Parse unicode document, share dictionary if possible.
 *         """
*/

static xmlDoc *__pyx_f_4lxml_5etree_11_BaseParser__parseUnicodeDoc(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self, PyObject *__pyx_v_utext, char *__pyx_v_c_filename) {
  struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_context = 0;
  xmlDoc *__pyx_v_result;
  xmlParserCtxt *__pyx_v_pctxt;
  Py_ssize_t __pyx_v_py_buffer_len;
  int __pyx_v_buffer_len;
  int __pyx_v_c_kind;
  const char *__pyx_v_c_text;
  const char *__pyx_v_c_encoding;
  int __pyx_v_orig_options;
  xmlDoc *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  xmlParserCtxt *__pyx_t_5;
  xmlDoc *__pyx_t_6;
  int __pyx_t_7;
  char const *__pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_t_15;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_parseUnicodeDoc", 0);

  /* "src/lxml/parser.pxi":1083
 *         cdef int buffer_len, c_kind
 *         cdef const_char* c_text
 *         cdef const_char* c_encoding = _PY_UNICODE_ENCODING             # <<<<<<<<<<<<<<
 *         if python.PyUnicode_IS_READY(utext):
 *             # PEP-393 string
*/
  __pyx_v_c_encoding = __pyx_v_4lxml_5etree__PY_UNICODE_ENCODING;

  /* "src/lxml/parser.pxi":1084
 *         cdef const_char* c_text
 *         cdef const_char* c_encoding = _PY_UNICODE_ENCODING
 *         if python.PyUnicode_IS_READY(utext):             # <<<<<<<<<<<<<<
 *             # PEP-393 string
 *             c_text = <const_char*>python.PyUnicode_DATA(utext)
*/
  __pyx_t_1 = PyUnicode_IS_READY(__pyx_v_utext);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":1086
 *         if python.PyUnicode_IS_READY(utext):
 *             # PEP-393 string
 *             c_text = <const_char*>python.PyUnicode_DATA(utext)             # <<<<<<<<<<<<<<
 *             py_buffer_len = python.PyUnicode_GET_LENGTH(utext)
 *             c_kind = python.PyUnicode_KIND(utext)
*/
    __pyx_v_c_text = ((const char *)PyUnicode_DATA(__pyx_v_utext));

    /* "src/lxml/parser.pxi":1087
 *             # PEP-393 string
 *             c_text = <const_char*>python.PyUnicode_DATA(utext)
 *             py_buffer_len = python.PyUnicode_GET_LENGTH(utext)             # <<<<<<<<<<<<<<
 *             c_kind = python.PyUnicode_KIND(utext)
 *             if c_kind == 1:
*/
    __pyx_v_py_buffer_len = PyUnicode_GET_LENGTH(__pyx_v_utext);

    /* "src/lxml/parser.pxi":1088
 *             c_text = <const_char*>python.PyUnicode_DATA(utext)
 *             py_buffer_len = python.PyUnicode_GET_LENGTH(utext)
 *             c_kind = python.PyUnicode_KIND(utext)             # <<<<<<<<<<<<<<
 *             if c_kind == 1:
 *                 if python.PyUnicode_MAX_CHAR_VALUE(utext) <= 127:
*/
    __pyx_v_c_kind = PyUnicode_KIND(__pyx_v_utext);

    /* "src/lxml/parser.pxi":1089
 *             py_buffer_len = python.PyUnicode_GET_LENGTH(utext)
 *             c_kind = python.PyUnicode_KIND(utext)
 *             if c_kind == 1:             # <<<<<<<<<<<<<<
 *                 if python.PyUnicode_MAX_CHAR_VALUE(utext) <= 127:
 *                     c_encoding = 'UTF-8'
*/
    switch (__pyx_v_c_kind) {
      case 1:

      /* "src/lxml/parser.pxi":1090
 *             c_kind = python.PyUnicode_KIND(utext)
 *             if c_kind == 1:
 *                 if python.PyUnicode_MAX_CHAR_VALUE(utext) <= 127:             # <<<<<<<<<<<<<<
 *                     c_encoding = 'UTF-8'
 *                 else:
*/
      __pyx_t_1 = (PyUnicode_MAX_CHAR_VALUE(__pyx_v_utext) <= 0x7F);
      if (__pyx_t_1) {

        /* "src/lxml/parser.pxi":1091
 *             if c_kind == 1:
 *                 if python.PyUnicode_MAX_CHAR_VALUE(utext) <= 127:
 *                     c_encoding = 'UTF-8'             # <<<<<<<<<<<<<<
 *                 else:
 *                     c_encoding = 'ISO-8859-1'
*/
        __pyx_v_c_encoding = __pyx_k_UTF_8;

        /* "src/lxml/parser.pxi":1090
 *             c_kind = python.PyUnicode_KIND(utext)
 *             if c_kind == 1:
 *                 if python.PyUnicode_MAX_CHAR_VALUE(utext) <= 127:             # <<<<<<<<<<<<<<
 *                     c_encoding = 'UTF-8'
 *                 else:
*/
        goto __pyx_L4;
      }

      /* "src/lxml/parser.pxi":1093
 *                     c_encoding = 'UTF-8'
 *                 else:
 *                     c_encoding = 'ISO-8859-1'             # <<<<<<<<<<<<<<
 *             elif c_kind == 2:
 *                 py_buffer_len *= 2
*/
      /*else*/ {
        __pyx_v_c_encoding = __pyx_k_ISO_8859_1;
      }
      __pyx_L4:;

      /* "src/lxml/parser.pxi":1089
 *             py_buffer_len = python.PyUnicode_GET_LENGTH(utext)
 *             c_kind = python.PyUnicode_KIND(utext)
 *             if c_kind == 1:             # <<<<<<<<<<<<<<
 *                 if python.PyUnicode_MAX_CHAR_VALUE(utext) <= 127:
 *                     c_encoding = 'UTF-8'
*/
      break;
      case 2:

      /* "src/lxml/parser.pxi":1095
 *                     c_encoding = 'ISO-8859-1'
 *             elif c_kind == 2:
 *                 py_buffer_len *= 2             # <<<<<<<<<<<<<<
 *                 if python.PY_BIG_ENDIAN:
 *                     c_encoding = 'UTF-16BE'  # actually UCS-2
*/
      __pyx_v_py_buffer_len = (__pyx_v_py_buffer_len * 2);

      /* "src/lxml/parser.pxi":1096
 *             elif c_kind == 2:
 *                 py_buffer_len *= 2
 *                 if python.PY_BIG_ENDIAN:             # <<<<<<<<<<<<<<
 *                     c_encoding = 'UTF-16BE'  # actually UCS-2
 *                 else:
*/
      if (PY_BIG_ENDIAN) {

        /* "src/lxml/parser.pxi":1097
 *                 py_buffer_len *= 2
 *                 if python.PY_BIG_ENDIAN:
 *                     c_encoding = 'UTF-16BE'  # actually UCS-2             # <<<<<<<<<<<<<<
 *                 else:
 *                     c_encoding = 'UTF-16LE'  # actually UCS-2
*/
        __pyx_v_c_encoding = __pyx_k_UTF_16BE;

        /* "src/lxml/parser.pxi":1096
 *             elif c_kind == 2:
 *                 py_buffer_len *= 2
 *                 if python.PY_BIG_ENDIAN:             # <<<<<<<<<<<<<<
 *                     c_encoding = 'UTF-16BE'  # actually UCS-2
 *                 else:
*/
        goto __pyx_L5;
      }

      /* "src/lxml/parser.pxi":1099
 *                     c_encoding = 'UTF-16BE'  # actually UCS-2
 *                 else:
 *                     c_encoding = 'UTF-16LE'  # actually UCS-2             # <<<<<<<<<<<<<<
 *             elif c_kind == 4:
 *                 py_buffer_len *= 4
*/
      /*else*/ {
        __pyx_v_c_encoding = __pyx_k_UTF_16LE;
      }
      __pyx_L5:;

      /* "src/lxml/parser.pxi":1094
 *                 else:
 *                     c_encoding = 'ISO-8859-1'
 *             elif c_kind == 2:             # <<<<<<<<<<<<<<
 *                 py_buffer_len *= 2
 *                 if python.PY_BIG_ENDIAN:
*/
      break;
      case 4:

      /* "src/lxml/parser.pxi":1101
 *                     c_encoding = 'UTF-16LE'  # actually UCS-2
 *             elif c_kind == 4:
 *                 py_buffer_len *= 4             # <<<<<<<<<<<<<<
 *                 if python.PY_BIG_ENDIAN:
 *                     c_encoding = 'UTF-32BE'  # actually UCS-4
*/
      __pyx_v_py_buffer_len = (__pyx_v_py_buffer_len * 4);

      /* "src/lxml/parser.pxi":1102
 *             elif c_kind == 4:
 *                 py_buffer_len *= 4
 *                 if python.PY_BIG_ENDIAN:             # <<<<<<<<<<<<<<
 *                     c_encoding = 'UTF-32BE'  # actually UCS-4
 *                 else:
*/
      if (PY_BIG_ENDIAN) {

        /* "src/lxml/parser.pxi":1103
 *                 py_buffer_len *= 4
 *                 if python.PY_BIG_ENDIAN:
 *                     c_encoding = 'UTF-32BE'  # actually UCS-4             # <<<<<<<<<<<<<<
 *                 else:
 *                     c_encoding = 'UTF-32LE'  # actually UCS-4
*/
        __pyx_v_c_encoding = __pyx_k_UTF_32BE;

        /* "src/lxml/parser.pxi":1102
 *             elif c_kind == 4:
 *                 py_buffer_len *= 4
 *                 if python.PY_BIG_ENDIAN:             # <<<<<<<<<<<<<<
 *                     c_encoding = 'UTF-32BE'  # actually UCS-4
 *                 else:
*/
        goto __pyx_L6;
      }

      /* "src/lxml/parser.pxi":1105
 *                     c_encoding = 'UTF-32BE'  # actually UCS-4
 *                 else:
 *                     c_encoding = 'UTF-32LE'  # actually UCS-4             # <<<<<<<<<<<<<<
 *             else:
 *                 assert False, f"Illegal Unicode kind {c_kind}"
*/
      /*else*/ {
        __pyx_v_c_encoding = __pyx_k_UTF_32LE;
      }
      __pyx_L6:;

      /* "src/lxml/parser.pxi":1100
 *                 else:
 *                     c_encoding = 'UTF-16LE'  # actually UCS-2
 *             elif c_kind == 4:             # <<<<<<<<<<<<<<
 *                 py_buffer_len *= 4
 *                 if python.PY_BIG_ENDIAN:
*/
      break;
      default:

      /* "src/lxml/parser.pxi":1107
 *                     c_encoding = 'UTF-32LE'  # actually UCS-4
 *             else:
 *                 assert False, f"Illegal Unicode kind {c_kind}"             # <<<<<<<<<<<<<<
 *         else:
 *             # old Py_UNICODE string
*/
      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(__pyx_assertions_enabled())) {
        if (unlikely(!0)) {
          __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_c_kind, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1107, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_3 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_Illegal_Unicode_kind, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1107, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_t_3, 0, 0);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __PYX_ERR(2, 1107, __pyx_L1_error)
        }
      }
      #else
      if ((1)); else __PYX_ERR(2, 1107, __pyx_L1_error)
      #endif
      break;
    }

    /* "src/lxml/parser.pxi":1084
 *         cdef const_char* c_text
 *         cdef const_char* c_encoding = _PY_UNICODE_ENCODING
 *         if python.PyUnicode_IS_READY(utext):             # <<<<<<<<<<<<<<
 *             # PEP-393 string
 *             c_text = <const_char*>python.PyUnicode_DATA(utext)
*/
    goto __pyx_L3;
  }

  /* "src/lxml/parser.pxi":1110
 *         else:
 *             # old Py_UNICODE string
 *             py_buffer_len = python.PyUnicode_GET_DATA_SIZE(utext)             # <<<<<<<<<<<<<<
 *             c_text = python.PyUnicode_AS_DATA(utext)
 *         assert 0 <= py_buffer_len <= limits.INT_MAX
*/
  /*else*/ {
    __pyx_v_py_buffer_len = PyUnicode_GET_DATA_SIZE(__pyx_v_utext);

    /* "src/lxml/parser.pxi":1111
 *             # old Py_UNICODE string
 *             py_buffer_len = python.PyUnicode_GET_DATA_SIZE(utext)
 *             c_text = python.PyUnicode_AS_DATA(utext)             # <<<<<<<<<<<<<<
 *         assert 0 <= py_buffer_len <= limits.INT_MAX
 *         buffer_len = py_buffer_len
*/
    __pyx_v_c_text = PyUnicode_AS_DATA(__pyx_v_utext);
  }
  __pyx_L3:;

  /* "src/lxml/parser.pxi":1112
 *             py_buffer_len = python.PyUnicode_GET_DATA_SIZE(utext)
 *             c_text = python.PyUnicode_AS_DATA(utext)
 *         assert 0 <= py_buffer_len <= limits.INT_MAX             # <<<<<<<<<<<<<<
 *         buffer_len = py_buffer_len
 * 
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = (0 <= __pyx_v_py_buffer_len);
    if (__pyx_t_1) {
      __pyx_t_1 = (__pyx_v_py_buffer_len <= INT_MAX);
    }
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
      __PYX_ERR(2, 1112, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(2, 1112, __pyx_L1_error)
  #endif

  /* "src/lxml/parser.pxi":1113
 *             c_text = python.PyUnicode_AS_DATA(utext)
 *         assert 0 <= py_buffer_len <= limits.INT_MAX
 *         buffer_len = py_buffer_len             # <<<<<<<<<<<<<<
 * 
 *         context = self._getParserContext()
*/
  __pyx_v_buffer_len = __pyx_v_py_buffer_len;

  /* "src/lxml/parser.pxi":1115
 *         buffer_len = py_buffer_len
 * 
 *         context = self._getParserContext()             # <<<<<<<<<<<<<<
 *         context.prepare()
 *         try:
*/
  __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)__pyx_v_self->__pyx_vtab)->_getParserContext(__pyx_v_self)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1115, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/parser.pxi":1116
 * 
 *         context = self._getParserContext()
 *         context.prepare()             # <<<<<<<<<<<<<<
 *         try:
 *             pctxt = context._c_ctxt
*/
  __pyx_t_4 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->prepare(__pyx_v_context, NULL); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 1116, __pyx_L1_error)

  /* "src/lxml/parser.pxi":1117
 *         context = self._getParserContext()
 *         context.prepare()
 *         try:             # <<<<<<<<<<<<<<
 *             pctxt = context._c_ctxt
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
*/
  /*try:*/ {

    /* "src/lxml/parser.pxi":1118
 *         context.prepare()
 *         try:
 *             pctxt = context._c_ctxt             # <<<<<<<<<<<<<<
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
 *             orig_options = pctxt.options
*/
    __pyx_t_5 = __pyx_v_context->_c_ctxt;
    __pyx_v_pctxt = __pyx_t_5;

    /* "src/lxml/parser.pxi":1119
 *         try:
 *             pctxt = context._c_ctxt
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)             # <<<<<<<<<<<<<<
 *             orig_options = pctxt.options
 *             with nogil:
*/
    __pyx_t_4 = __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initParserDict(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, __pyx_v_pctxt); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 1119, __pyx_L8_error)

    /* "src/lxml/parser.pxi":1120
 *             pctxt = context._c_ctxt
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
 *             orig_options = pctxt.options             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 if self._for_html:
*/
    __pyx_t_4 = __pyx_v_pctxt->options;
    __pyx_v_orig_options = __pyx_t_4;

    /* "src/lxml/parser.pxi":1121
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
 *             orig_options = pctxt.options
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 if self._for_html:
 *                     result = htmlparser.htmlCtxtReadMemory(
*/
    {
        PyThreadState * _save;
        _save = PyEval_SaveThread();
        __Pyx_FastGIL_Remember();
        /*try:*/ {

          /* "src/lxml/parser.pxi":1122
 *             orig_options = pctxt.options
 *             with nogil:
 *                 if self._for_html:             # <<<<<<<<<<<<<<
 *                     result = htmlparser.htmlCtxtReadMemory(
 *                         pctxt, c_text, buffer_len, c_filename, c_encoding,
*/
          if (__pyx_v_self->_for_html) {

            /* "src/lxml/parser.pxi":1123
 *             with nogil:
 *                 if self._for_html:
 *                     result = htmlparser.htmlCtxtReadMemory(             # <<<<<<<<<<<<<<
 *                         pctxt, c_text, buffer_len, c_filename, c_encoding,
 *                         self._parse_options)
*/
            __pyx_v_result = htmlCtxtReadMemory(__pyx_v_pctxt, __pyx_v_c_text, __pyx_v_buffer_len, __pyx_v_c_filename, __pyx_v_c_encoding, __pyx_v_self->_parse_options);

            /* "src/lxml/parser.pxi":1126
 *                         pctxt, c_text, buffer_len, c_filename, c_encoding,
 *                         self._parse_options)
 *                     if result is not NULL:             # <<<<<<<<<<<<<<
 *                         if _fixHtmlDictNames(pctxt.dict, result) < 0:
 *                             tree.xmlFreeDoc(result)
*/
            __pyx_t_1 = (__pyx_v_result != NULL);
            if (__pyx_t_1) {

              /* "src/lxml/parser.pxi":1127
 *                         self._parse_options)
 *                     if result is not NULL:
 *                         if _fixHtmlDictNames(pctxt.dict, result) < 0:             # <<<<<<<<<<<<<<
 *                             tree.xmlFreeDoc(result)
 *                             result = NULL
*/
              __pyx_t_1 = (__pyx_f_4lxml_5etree__fixHtmlDictNames(__pyx_v_pctxt->dict, __pyx_v_result) < 0);
              if (__pyx_t_1) {

                /* "src/lxml/parser.pxi":1128
 *                     if result is not NULL:
 *                         if _fixHtmlDictNames(pctxt.dict, result) < 0:
 *                             tree.xmlFreeDoc(result)             # <<<<<<<<<<<<<<
 *                             result = NULL
 *                 else:
*/
                xmlFreeDoc(__pyx_v_result);

                /* "src/lxml/parser.pxi":1129
 *                         if _fixHtmlDictNames(pctxt.dict, result) < 0:
 *                             tree.xmlFreeDoc(result)
 *                             result = NULL             # <<<<<<<<<<<<<<
 *                 else:
 *                     result = xmlparser.xmlCtxtReadMemory(
*/
                __pyx_v_result = NULL;

                /* "src/lxml/parser.pxi":1127
 *                         self._parse_options)
 *                     if result is not NULL:
 *                         if _fixHtmlDictNames(pctxt.dict, result) < 0:             # <<<<<<<<<<<<<<
 *                             tree.xmlFreeDoc(result)
 *                             result = NULL
*/
              }

              /* "src/lxml/parser.pxi":1126
 *                         pctxt, c_text, buffer_len, c_filename, c_encoding,
 *                         self._parse_options)
 *                     if result is not NULL:             # <<<<<<<<<<<<<<
 *                         if _fixHtmlDictNames(pctxt.dict, result) < 0:
 *                             tree.xmlFreeDoc(result)
*/
            }

            /* "src/lxml/parser.pxi":1122
 *             orig_options = pctxt.options
 *             with nogil:
 *                 if self._for_html:             # <<<<<<<<<<<<<<
 *                     result = htmlparser.htmlCtxtReadMemory(
 *                         pctxt, c_text, buffer_len, c_filename, c_encoding,
*/
            goto __pyx_L13;
          }

          /* "src/lxml/parser.pxi":1131
 *                             result = NULL
 *                 else:
 *                     result = xmlparser.xmlCtxtReadMemory(             # <<<<<<<<<<<<<<
 *                         pctxt, c_text, buffer_len, c_filename, c_encoding,
 *                         self._parse_options)
*/
          /*else*/ {

            /* "src/lxml/parser.pxi":1133
 *                     result = xmlparser.xmlCtxtReadMemory(
 *                         pctxt, c_text, buffer_len, c_filename, c_encoding,
 *                         self._parse_options)             # <<<<<<<<<<<<<<
 *             pctxt.options = orig_options # work around libxml2 problem
 * 
*/
            __pyx_v_result = xmlCtxtReadMemory(__pyx_v_pctxt, __pyx_v_c_text, __pyx_v_buffer_len, __pyx_v_c_filename, __pyx_v_c_encoding, __pyx_v_self->_parse_options);
          }
          __pyx_L13:;
        }

        /* "src/lxml/parser.pxi":1121
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
 *             orig_options = pctxt.options
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 if self._for_html:
 *                     result = htmlparser.htmlCtxtReadMemory(
*/
        /*finally:*/ {
          /*normal exit:*/{
            __Pyx_FastGIL_Forget();
            PyEval_RestoreThread(_save);
            goto __pyx_L12;
          }
          __pyx_L12:;
        }
    }

    /* "src/lxml/parser.pxi":1134
 *                         pctxt, c_text, buffer_len, c_filename, c_encoding,
 *                         self._parse_options)
 *             pctxt.options = orig_options # work around libxml2 problem             # <<<<<<<<<<<<<<
 * 
 *             return context._handleParseResultDoc(self, result, None)
*/
    __pyx_v_pctxt->options = __pyx_v_orig_options;

    /* "src/lxml/parser.pxi":1136
 *             pctxt.options = orig_options # work around libxml2 problem
 * 
 *             return context._handleParseResultDoc(self, result, None)             # <<<<<<<<<<<<<<
 *         finally:
 *             context.cleanup()
*/
    __pyx_t_6 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->_handleParseResultDoc(__pyx_v_context, __pyx_v_self, __pyx_v_result, Py_None); if (unlikely(__pyx_t_6 == ((void *)NULL))) __PYX_ERR(2, 1136, __pyx_L8_error)
    __pyx_r = __pyx_t_6;
    goto __pyx_L7_return;
  }

  /* "src/lxml/parser.pxi":1138
 *             return context._handleParseResultDoc(self, result, None)
 *         finally:
 *             context.cleanup()             # <<<<<<<<<<<<<<
 * 
 *     cdef xmlDoc* _parseDoc(self, const char* c_text, int c_len, char* c_filename) except NULL:
*/
  /*finally:*/ {
    __pyx_L8_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
      if ( unlikely(__Pyx_GetException(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11) < 0)) __Pyx_ErrFetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_14);
      __pyx_t_4 = __pyx_lineno; __pyx_t_7 = __pyx_clineno; __pyx_t_8 = __pyx_filename;
      {
        __pyx_t_15 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->cleanup(__pyx_v_context); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(2, 1138, __pyx_L17_error)
      }
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_XGIVEREF(__pyx_t_14);
      __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_ErrRestore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
      __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_7; __pyx_filename = __pyx_t_8;
      goto __pyx_L1_error;
      __pyx_L17_error:;
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_XGIVEREF(__pyx_t_14);
      __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L7_return: {
      __pyx_t_6 = __pyx_r;
      __pyx_t_7 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->cleanup(__pyx_v_context); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(2, 1138, __pyx_L1_error)
      __pyx_r = __pyx_t_6;
      goto __pyx_L0;
    }
  }

  /* "src/lxml/parser.pxi":1074
 *     # internal parser methods
 * 
 *     cdef xmlDoc* _parseUnicodeDoc(self, utext, char* c_filename) except NULL:             # <<<<<<<<<<<<<<
 *         """Parse unicode document, share dictionary if possible.
 *         """
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._BaseParser._parseUnicodeDoc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":1140
 *             context.cleanup()
 * 
 *     cdef xmlDoc* _parseDoc(self, const char* c_text, int c_len, char* c_filename) except NULL:             # <<<<<<<<<<<<<<
 *         """Parse document, share dictionary if possible.
 *         """
*/

static xmlDoc *__pyx_f_4lxml_5etree_11_BaseParser__parseDoc(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self, char const *__pyx_v_c_text, int __pyx_v_c_len, char *__pyx_v_c_filename) {
  struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_context = 0;
  xmlDoc *__pyx_v_result;
  xmlParserCtxt *__pyx_v_pctxt;
  char *__pyx_v_c_encoding;
  xmlCharEncoding __pyx_v_enc;
  int __pyx_v_orig_options;
  xmlDoc *__pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  xmlParserCtxt *__pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  xmlDoc *__pyx_t_6;
  int __pyx_t_7;
  char const *__pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_t_15;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_parseDoc", 0);

  /* "src/lxml/parser.pxi":1148
 *         cdef char* c_encoding
 *         cdef tree.xmlCharEncoding enc
 *         context = self._getParserContext()             # <<<<<<<<<<<<<<
 *         context.prepare()
 *         try:
*/
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)__pyx_v_self->__pyx_vtab)->_getParserContext(__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1148, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/parser.pxi":1149
 *         cdef tree.xmlCharEncoding enc
 *         context = self._getParserContext()
 *         context.prepare()             # <<<<<<<<<<<<<<
 *         try:
 *             pctxt = context._c_ctxt
*/
  __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->prepare(__pyx_v_context, NULL); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(2, 1149, __pyx_L1_error)

  /* "src/lxml/parser.pxi":1150
 *         context = self._getParserContext()
 *         context.prepare()
 *         try:             # <<<<<<<<<<<<<<
 *             pctxt = context._c_ctxt
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
*/
  /*try:*/ {

    /* "src/lxml/parser.pxi":1151
 *         context.prepare()
 *         try:
 *             pctxt = context._c_ctxt             # <<<<<<<<<<<<<<
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
 * 
*/
    __pyx_t_3 = __pyx_v_context->_c_ctxt;
    __pyx_v_pctxt = __pyx_t_3;

    /* "src/lxml/parser.pxi":1152
 *         try:
 *             pctxt = context._c_ctxt
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)             # <<<<<<<<<<<<<<
 * 
 *             if self._default_encoding is None:
*/
    __pyx_t_2 = __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initParserDict(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, __pyx_v_pctxt); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(2, 1152, __pyx_L4_error)

    /* "src/lxml/parser.pxi":1154
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
 * 
 *             if self._default_encoding is None:             # <<<<<<<<<<<<<<
 *                 c_encoding = NULL
 *                 # libxml2 (at least 2.9.3) does not recognise UTF-32 BOMs
*/
    __pyx_t_4 = (__pyx_v_self->_default_encoding == Py_None);
    if (__pyx_t_4) {

      /* "src/lxml/parser.pxi":1155
 * 
 *             if self._default_encoding is None:
 *                 c_encoding = NULL             # <<<<<<<<<<<<<<
 *                 # libxml2 (at least 2.9.3) does not recognise UTF-32 BOMs
 *                 # NOTE: limit to problematic cases because it changes character offsets
*/
      __pyx_v_c_encoding = NULL;

      /* "src/lxml/parser.pxi":1158
 *                 # libxml2 (at least 2.9.3) does not recognise UTF-32 BOMs
 *                 # NOTE: limit to problematic cases because it changes character offsets
 *                 if c_len >= 4 and (c_text[0] == b'\xFF' and c_text[1] == b'\xFE' and             # <<<<<<<<<<<<<<
 *                                    c_text[2] == 0 and c_text[3] == 0):
 *                     c_encoding = "UTF-32LE"
*/
      __pyx_t_5 = (__pyx_v_c_len >= 4);
      if (__pyx_t_5) {
      } else {
        __pyx_t_4 = __pyx_t_5;
        goto __pyx_L8_bool_binop_done;
      }
      __pyx_t_5 = ((__pyx_v_c_text[0]) == '\xFF');
      if (__pyx_t_5) {
      } else {
        __pyx_t_4 = __pyx_t_5;
        goto __pyx_L8_bool_binop_done;
      }
      __pyx_t_5 = ((__pyx_v_c_text[1]) == '\xFE');
      if (__pyx_t_5) {
      } else {
        __pyx_t_4 = __pyx_t_5;
        goto __pyx_L8_bool_binop_done;
      }

      /* "src/lxml/parser.pxi":1159
 *                 # NOTE: limit to problematic cases because it changes character offsets
 *                 if c_len >= 4 and (c_text[0] == b'\xFF' and c_text[1] == b'\xFE' and
 *                                    c_text[2] == 0 and c_text[3] == 0):             # <<<<<<<<<<<<<<
 *                     c_encoding = "UTF-32LE"
 *                     c_text += 4
*/
      __pyx_t_5 = ((__pyx_v_c_text[2]) == 0);
      if (__pyx_t_5) {
      } else {
        __pyx_t_4 = __pyx_t_5;
        goto __pyx_L8_bool_binop_done;
      }
      __pyx_t_5 = ((__pyx_v_c_text[3]) == 0);
      __pyx_t_4 = __pyx_t_5;
      __pyx_L8_bool_binop_done:;

      /* "src/lxml/parser.pxi":1158
 *                 # libxml2 (at least 2.9.3) does not recognise UTF-32 BOMs
 *                 # NOTE: limit to problematic cases because it changes character offsets
 *                 if c_len >= 4 and (c_text[0] == b'\xFF' and c_text[1] == b'\xFE' and             # <<<<<<<<<<<<<<
 *                                    c_text[2] == 0 and c_text[3] == 0):
 *                     c_encoding = "UTF-32LE"
*/
      if (__pyx_t_4) {

        /* "src/lxml/parser.pxi":1160
 *                 if c_len >= 4 and (c_text[0] == b'\xFF' and c_text[1] == b'\xFE' and
 *                                    c_text[2] == 0 and c_text[3] == 0):
 *                     c_encoding = "UTF-32LE"             # <<<<<<<<<<<<<<
 *                     c_text += 4
 *                     c_len -= 4
*/
        __pyx_v_c_encoding = ((char *)"UTF-32LE");

        /* "src/lxml/parser.pxi":1161
 *                                    c_text[2] == 0 and c_text[3] == 0):
 *                     c_encoding = "UTF-32LE"
 *                     c_text += 4             # <<<<<<<<<<<<<<
 *                     c_len -= 4
 *                 elif c_len >= 4 and (c_text[0] == 0 and c_text[1] == 0 and
*/
        __pyx_v_c_text = (__pyx_v_c_text + 4);

        /* "src/lxml/parser.pxi":1162
 *                     c_encoding = "UTF-32LE"
 *                     c_text += 4
 *                     c_len -= 4             # <<<<<<<<<<<<<<
 *                 elif c_len >= 4 and (c_text[0] == 0 and c_text[1] == 0 and
 *                                      c_text[2] == b'\xFE' and c_text[3] == b'\xFF'):
*/
        __pyx_v_c_len = (__pyx_v_c_len - 4);

        /* "src/lxml/parser.pxi":1158
 *                 # libxml2 (at least 2.9.3) does not recognise UTF-32 BOMs
 *                 # NOTE: limit to problematic cases because it changes character offsets
 *                 if c_len >= 4 and (c_text[0] == b'\xFF' and c_text[1] == b'\xFE' and             # <<<<<<<<<<<<<<
 *                                    c_text[2] == 0 and c_text[3] == 0):
 *                     c_encoding = "UTF-32LE"
*/
        goto __pyx_L7;
      }

      /* "src/lxml/parser.pxi":1163
 *                     c_text += 4
 *                     c_len -= 4
 *                 elif c_len >= 4 and (c_text[0] == 0 and c_text[1] == 0 and             # <<<<<<<<<<<<<<
 *                                      c_text[2] == b'\xFE' and c_text[3] == b'\xFF'):
 *                     c_encoding = "UTF-32BE"
*/
      __pyx_t_5 = (__pyx_v_c_len >= 4);
      if (__pyx_t_5) {
      } else {
        __pyx_t_4 = __pyx_t_5;
        goto __pyx_L13_bool_binop_done;
      }
      __pyx_t_5 = ((__pyx_v_c_text[0]) == 0);
      if (__pyx_t_5) {
      } else {
        __pyx_t_4 = __pyx_t_5;
        goto __pyx_L13_bool_binop_done;
      }
      __pyx_t_5 = ((__pyx_v_c_text[1]) == 0);
      if (__pyx_t_5) {
      } else {
        __pyx_t_4 = __pyx_t_5;
        goto __pyx_L13_bool_binop_done;
      }

      /* "src/lxml/parser.pxi":1164
 *                     c_len -= 4
 *                 elif c_len >= 4 and (c_text[0] == 0 and c_text[1] == 0 and
 *                                      c_text[2] == b'\xFE' and c_text[3] == b'\xFF'):             # <<<<<<<<<<<<<<
 *                     c_encoding = "UTF-32BE"
 *                     c_text += 4
*/
      __pyx_t_5 = ((__pyx_v_c_text[2]) == '\xFE');
      if (__pyx_t_5) {
      } else {
        __pyx_t_4 = __pyx_t_5;
        goto __pyx_L13_bool_binop_done;
      }
      __pyx_t_5 = ((__pyx_v_c_text[3]) == '\xFF');
      __pyx_t_4 = __pyx_t_5;
      __pyx_L13_bool_binop_done:;

      /* "src/lxml/parser.pxi":1163
 *                     c_text += 4
 *                     c_len -= 4
 *                 elif c_len >= 4 and (c_text[0] == 0 and c_text[1] == 0 and             # <<<<<<<<<<<<<<
 *                                      c_text[2] == b'\xFE' and c_text[3] == b'\xFF'):
 *                     c_encoding = "UTF-32BE"
*/
      if (__pyx_t_4) {

        /* "src/lxml/parser.pxi":1165
 *                 elif c_len >= 4 and (c_text[0] == 0 and c_text[1] == 0 and
 *                                      c_text[2] == b'\xFE' and c_text[3] == b'\xFF'):
 *                     c_encoding = "UTF-32BE"             # <<<<<<<<<<<<<<
 *                     c_text += 4
 *                     c_len -= 4
*/
        __pyx_v_c_encoding = ((char *)"UTF-32BE");

        /* "src/lxml/parser.pxi":1166
 *                                      c_text[2] == b'\xFE' and c_text[3] == b'\xFF'):
 *                     c_encoding = "UTF-32BE"
 *                     c_text += 4             # <<<<<<<<<<<<<<
 *                     c_len -= 4
 *                 else:
*/
        __pyx_v_c_text = (__pyx_v_c_text + 4);

        /* "src/lxml/parser.pxi":1167
 *                     c_encoding = "UTF-32BE"
 *                     c_text += 4
 *                     c_len -= 4             # <<<<<<<<<<<<<<
 *                 else:
 *                     # no BOM => try to determine encoding
*/
        __pyx_v_c_len = (__pyx_v_c_len - 4);

        /* "src/lxml/parser.pxi":1163
 *                     c_text += 4
 *                     c_len -= 4
 *                 elif c_len >= 4 and (c_text[0] == 0 and c_text[1] == 0 and             # <<<<<<<<<<<<<<
 *                                      c_text[2] == b'\xFE' and c_text[3] == b'\xFF'):
 *                     c_encoding = "UTF-32BE"
*/
        goto __pyx_L7;
      }

      /* "src/lxml/parser.pxi":1170
 *                 else:
 *                     # no BOM => try to determine encoding
 *                     enc = tree.xmlDetectCharEncoding(<const_xmlChar*>c_text, c_len)             # <<<<<<<<<<<<<<
 *                     if enc == tree.XML_CHAR_ENCODING_UCS4LE:
 *                         c_encoding = 'UTF-32LE'
*/
      /*else*/ {
        __pyx_v_enc = xmlDetectCharEncoding(((const xmlChar *)__pyx_v_c_text), __pyx_v_c_len);

        /* "src/lxml/parser.pxi":1171
 *                     # no BOM => try to determine encoding
 *                     enc = tree.xmlDetectCharEncoding(<const_xmlChar*>c_text, c_len)
 *                     if enc == tree.XML_CHAR_ENCODING_UCS4LE:             # <<<<<<<<<<<<<<
 *                         c_encoding = 'UTF-32LE'
 *                     elif enc == tree.XML_CHAR_ENCODING_UCS4BE:
*/
        switch (__pyx_v_enc) {
          case XML_CHAR_ENCODING_UCS4LE:

          /* "src/lxml/parser.pxi":1172
 *                     enc = tree.xmlDetectCharEncoding(<const_xmlChar*>c_text, c_len)
 *                     if enc == tree.XML_CHAR_ENCODING_UCS4LE:
 *                         c_encoding = 'UTF-32LE'             # <<<<<<<<<<<<<<
 *                     elif enc == tree.XML_CHAR_ENCODING_UCS4BE:
 *                         c_encoding = 'UTF-32BE'
*/
          __pyx_v_c_encoding = ((char *)"UTF-32LE");

          /* "src/lxml/parser.pxi":1171
 *                     # no BOM => try to determine encoding
 *                     enc = tree.xmlDetectCharEncoding(<const_xmlChar*>c_text, c_len)
 *                     if enc == tree.XML_CHAR_ENCODING_UCS4LE:             # <<<<<<<<<<<<<<
 *                         c_encoding = 'UTF-32LE'
 *                     elif enc == tree.XML_CHAR_ENCODING_UCS4BE:
*/
          break;
          case XML_CHAR_ENCODING_UCS4BE:

          /* "src/lxml/parser.pxi":1174
 *                         c_encoding = 'UTF-32LE'
 *                     elif enc == tree.XML_CHAR_ENCODING_UCS4BE:
 *                         c_encoding = 'UTF-32BE'             # <<<<<<<<<<<<<<
 *             else:
 *                 c_encoding = _cstr(self._default_encoding)
*/
          __pyx_v_c_encoding = ((char *)"UTF-32BE");

          /* "src/lxml/parser.pxi":1173
 *                     if enc == tree.XML_CHAR_ENCODING_UCS4LE:
 *                         c_encoding = 'UTF-32LE'
 *                     elif enc == tree.XML_CHAR_ENCODING_UCS4BE:             # <<<<<<<<<<<<<<
 *                         c_encoding = 'UTF-32BE'
 *             else:
*/
          break;
          default: break;
        }
      }
      __pyx_L7:;

      /* "src/lxml/parser.pxi":1154
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
 * 
 *             if self._default_encoding is None:             # <<<<<<<<<<<<<<
 *                 c_encoding = NULL
 *                 # libxml2 (at least 2.9.3) does not recognise UTF-32 BOMs
*/
      goto __pyx_L6;
    }

    /* "src/lxml/parser.pxi":1176
 *                         c_encoding = 'UTF-32BE'
 *             else:
 *                 c_encoding = _cstr(self._default_encoding)             # <<<<<<<<<<<<<<
 * 
 *             orig_options = pctxt.options
*/
    /*else*/ {
      __pyx_t_1 = __pyx_v_self->_default_encoding;
      __Pyx_INCREF(__pyx_t_1);
      __pyx_v_c_encoding = PyBytes_AS_STRING(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __pyx_L6:;

    /* "src/lxml/parser.pxi":1178
 *                 c_encoding = _cstr(self._default_encoding)
 * 
 *             orig_options = pctxt.options             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 if self._for_html:
*/
    __pyx_t_2 = __pyx_v_pctxt->options;
    __pyx_v_orig_options = __pyx_t_2;

    /* "src/lxml/parser.pxi":1179
 * 
 *             orig_options = pctxt.options
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 if self._for_html:
 *                     result = htmlparser.htmlCtxtReadMemory(
*/
    {
        PyThreadState * _save;
        _save = PyEval_SaveThread();
        __Pyx_FastGIL_Remember();
        /*try:*/ {

          /* "src/lxml/parser.pxi":1180
 *             orig_options = pctxt.options
 *             with nogil:
 *                 if self._for_html:             # <<<<<<<<<<<<<<
 *                     result = htmlparser.htmlCtxtReadMemory(
 *                         pctxt, c_text, c_len, c_filename,
*/
          if (__pyx_v_self->_for_html) {

            /* "src/lxml/parser.pxi":1181
 *             with nogil:
 *                 if self._for_html:
 *                     result = htmlparser.htmlCtxtReadMemory(             # <<<<<<<<<<<<<<
 *                         pctxt, c_text, c_len, c_filename,
 *                         c_encoding, self._parse_options)
*/
            __pyx_v_result = htmlCtxtReadMemory(__pyx_v_pctxt, __pyx_v_c_text, __pyx_v_c_len, __pyx_v_c_filename, __pyx_v_c_encoding, __pyx_v_self->_parse_options);

            /* "src/lxml/parser.pxi":1184
 *                         pctxt, c_text, c_len, c_filename,
 *                         c_encoding, self._parse_options)
 *                     if result is not NULL:             # <<<<<<<<<<<<<<
 *                         if _fixHtmlDictNames(pctxt.dict, result) < 0:
 *                             tree.xmlFreeDoc(result)
*/
            __pyx_t_4 = (__pyx_v_result != NULL);
            if (__pyx_t_4) {

              /* "src/lxml/parser.pxi":1185
 *                         c_encoding, self._parse_options)
 *                     if result is not NULL:
 *                         if _fixHtmlDictNames(pctxt.dict, result) < 0:             # <<<<<<<<<<<<<<
 *                             tree.xmlFreeDoc(result)
 *                             result = NULL
*/
              __pyx_t_4 = (__pyx_f_4lxml_5etree__fixHtmlDictNames(__pyx_v_pctxt->dict, __pyx_v_result) < 0);
              if (__pyx_t_4) {

                /* "src/lxml/parser.pxi":1186
 *                     if result is not NULL:
 *                         if _fixHtmlDictNames(pctxt.dict, result) < 0:
 *                             tree.xmlFreeDoc(result)             # <<<<<<<<<<<<<<
 *                             result = NULL
 *                 else:
*/
                xmlFreeDoc(__pyx_v_result);

                /* "src/lxml/parser.pxi":1187
 *                         if _fixHtmlDictNames(pctxt.dict, result) < 0:
 *                             tree.xmlFreeDoc(result)
 *                             result = NULL             # <<<<<<<<<<<<<<
 *                 else:
 *                     result = xmlparser.xmlCtxtReadMemory(
*/
                __pyx_v_result = NULL;

                /* "src/lxml/parser.pxi":1185
 *                         c_encoding, self._parse_options)
 *                     if result is not NULL:
 *                         if _fixHtmlDictNames(pctxt.dict, result) < 0:             # <<<<<<<<<<<<<<
 *                             tree.xmlFreeDoc(result)
 *                             result = NULL
*/
              }

              /* "src/lxml/parser.pxi":1184
 *                         pctxt, c_text, c_len, c_filename,
 *                         c_encoding, self._parse_options)
 *                     if result is not NULL:             # <<<<<<<<<<<<<<
 *                         if _fixHtmlDictNames(pctxt.dict, result) < 0:
 *                             tree.xmlFreeDoc(result)
*/
            }

            /* "src/lxml/parser.pxi":1180
 *             orig_options = pctxt.options
 *             with nogil:
 *                 if self._for_html:             # <<<<<<<<<<<<<<
 *                     result = htmlparser.htmlCtxtReadMemory(
 *                         pctxt, c_text, c_len, c_filename,
*/
            goto __pyx_L21;
          }

          /* "src/lxml/parser.pxi":1189
 *                             result = NULL
 *                 else:
 *                     result = xmlparser.xmlCtxtReadMemory(             # <<<<<<<<<<<<<<
 *                         pctxt, c_text, c_len, c_filename,
 *                         c_encoding, self._parse_options)
*/
          /*else*/ {

            /* "src/lxml/parser.pxi":1191
 *                     result = xmlparser.xmlCtxtReadMemory(
 *                         pctxt, c_text, c_len, c_filename,
 *                         c_encoding, self._parse_options)             # <<<<<<<<<<<<<<
 *             pctxt.options = orig_options # work around libxml2 problem
 * 
*/
            __pyx_v_result = xmlCtxtReadMemory(__pyx_v_pctxt, __pyx_v_c_text, __pyx_v_c_len, __pyx_v_c_filename, __pyx_v_c_encoding, __pyx_v_self->_parse_options);
          }
          __pyx_L21:;
        }

        /* "src/lxml/parser.pxi":1179
 * 
 *             orig_options = pctxt.options
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 if self._for_html:
 *                     result = htmlparser.htmlCtxtReadMemory(
*/
        /*finally:*/ {
          /*normal exit:*/{
            __Pyx_FastGIL_Forget();
            PyEval_RestoreThread(_save);
            goto __pyx_L20;
          }
          __pyx_L20:;
        }
    }

    /* "src/lxml/parser.pxi":1192
 *                         pctxt, c_text, c_len, c_filename,
 *                         c_encoding, self._parse_options)
 *             pctxt.options = orig_options # work around libxml2 problem             # <<<<<<<<<<<<<<
 * 
 *             return context._handleParseResultDoc(self, result, None)
*/
    __pyx_v_pctxt->options = __pyx_v_orig_options;

    /* "src/lxml/parser.pxi":1194
 *             pctxt.options = orig_options # work around libxml2 problem
 * 
 *             return context._handleParseResultDoc(self, result, None)             # <<<<<<<<<<<<<<
 *         finally:
 *             context.cleanup()
*/
    __pyx_t_6 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->_handleParseResultDoc(__pyx_v_context, __pyx_v_self, __pyx_v_result, Py_None); if (unlikely(__pyx_t_6 == ((void *)NULL))) __PYX_ERR(2, 1194, __pyx_L4_error)
    __pyx_r = __pyx_t_6;
    goto __pyx_L3_return;
  }

  /* "src/lxml/parser.pxi":1196
 *             return context._handleParseResultDoc(self, result, None)
 *         finally:
 *             context.cleanup()             # <<<<<<<<<<<<<<
 * 
 *     cdef xmlDoc* _parseDocFromFile(self, char* c_filename) except NULL:
*/
  /*finally:*/ {
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
      if ( unlikely(__Pyx_GetException(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11) < 0)) __Pyx_ErrFetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_14);
      __pyx_t_2 = __pyx_lineno; __pyx_t_7 = __pyx_clineno; __pyx_t_8 = __pyx_filename;
      {
        __pyx_t_15 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->cleanup(__pyx_v_context); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(2, 1196, __pyx_L25_error)
      }
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_XGIVEREF(__pyx_t_14);
      __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_ErrRestore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
      __pyx_lineno = __pyx_t_2; __pyx_clineno = __pyx_t_7; __pyx_filename = __pyx_t_8;
      goto __pyx_L1_error;
      __pyx_L25_error:;
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_XGIVEREF(__pyx_t_14);
      __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L3_return: {
      __pyx_t_6 = __pyx_r;
      __pyx_t_7 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->cleanup(__pyx_v_context); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(2, 1196, __pyx_L1_error)
      __pyx_r = __pyx_t_6;
      goto __pyx_L0;
    }
  }

  /* "src/lxml/parser.pxi":1140
 *             context.cleanup()
 * 
 *     cdef xmlDoc* _parseDoc(self, const char* c_text, int c_len, char* c_filename) except NULL:             # <<<<<<<<<<<<<<
 *         """Parse document, share dictionary if possible.
 *         """
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._BaseParser._parseDoc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":1198
 *             context.cleanup()
 * 
 *     cdef xmlDoc* _parseDocFromFile(self, char* c_filename) except NULL:             # <<<<<<<<<<<<<<
 *         cdef _ParserContext context
 *         cdef xmlDoc* result
*/

static xmlDoc *__pyx_f_4lxml_5etree_11_BaseParser__parseDocFromFile(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self, char *__pyx_v_c_filename) {
  struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_context = 0;
  xmlDoc *__pyx_v_result;
  xmlParserCtxt *__pyx_v_pctxt;
  char *__pyx_v_c_encoding;
  int __pyx_v_orig_options;
  xmlDoc *__pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  xmlParserCtxt *__pyx_t_3;
  int __pyx_t_4;
  xmlDoc *__pyx_t_5;
  int __pyx_t_6;
  char const *__pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_parseDocFromFile", 0);

  /* "src/lxml/parser.pxi":1203
 *         cdef xmlparser.xmlParserCtxt* pctxt
 *         cdef char* c_encoding
 *         result = NULL             # <<<<<<<<<<<<<<
 * 
 *         context = self._getParserContext()
*/
  __pyx_v_result = NULL;

  /* "src/lxml/parser.pxi":1205
 *         result = NULL
 * 
 *         context = self._getParserContext()             # <<<<<<<<<<<<<<
 *         context.prepare()
 *         try:
*/
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)__pyx_v_self->__pyx_vtab)->_getParserContext(__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1205, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/parser.pxi":1206
 * 
 *         context = self._getParserContext()
 *         context.prepare()             # <<<<<<<<<<<<<<
 *         try:
 *             pctxt = context._c_ctxt
*/
  __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->prepare(__pyx_v_context, NULL); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(2, 1206, __pyx_L1_error)

  /* "src/lxml/parser.pxi":1207
 *         context = self._getParserContext()
 *         context.prepare()
 *         try:             # <<<<<<<<<<<<<<
 *             pctxt = context._c_ctxt
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
*/
  /*try:*/ {

    /* "src/lxml/parser.pxi":1208
 *         context.prepare()
 *         try:
 *             pctxt = context._c_ctxt             # <<<<<<<<<<<<<<
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
 * 
*/
    __pyx_t_3 = __pyx_v_context->_c_ctxt;
    __pyx_v_pctxt = __pyx_t_3;

    /* "src/lxml/parser.pxi":1209
 *         try:
 *             pctxt = context._c_ctxt
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)             # <<<<<<<<<<<<<<
 * 
 *             if self._default_encoding is None:
*/
    __pyx_t_2 = __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initParserDict(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, __pyx_v_pctxt); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(2, 1209, __pyx_L4_error)

    /* "src/lxml/parser.pxi":1211
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
 * 
 *             if self._default_encoding is None:             # <<<<<<<<<<<<<<
 *                 c_encoding = NULL
 *             else:
*/
    __pyx_t_4 = (__pyx_v_self->_default_encoding == Py_None);
    if (__pyx_t_4) {

      /* "src/lxml/parser.pxi":1212
 * 
 *             if self._default_encoding is None:
 *                 c_encoding = NULL             # <<<<<<<<<<<<<<
 *             else:
 *                 c_encoding = _cstr(self._default_encoding)
*/
      __pyx_v_c_encoding = NULL;

      /* "src/lxml/parser.pxi":1211
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
 * 
 *             if self._default_encoding is None:             # <<<<<<<<<<<<<<
 *                 c_encoding = NULL
 *             else:
*/
      goto __pyx_L6;
    }

    /* "src/lxml/parser.pxi":1214
 *                 c_encoding = NULL
 *             else:
 *                 c_encoding = _cstr(self._default_encoding)             # <<<<<<<<<<<<<<
 * 
 *             orig_options = pctxt.options
*/
    /*else*/ {
      __pyx_t_1 = __pyx_v_self->_default_encoding;
      __Pyx_INCREF(__pyx_t_1);
      __pyx_v_c_encoding = PyBytes_AS_STRING(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __pyx_L6:;

    /* "src/lxml/parser.pxi":1216
 *                 c_encoding = _cstr(self._default_encoding)
 * 
 *             orig_options = pctxt.options             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 if self._for_html:
*/
    __pyx_t_2 = __pyx_v_pctxt->options;
    __pyx_v_orig_options = __pyx_t_2;

    /* "src/lxml/parser.pxi":1217
 * 
 *             orig_options = pctxt.options
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 if self._for_html:
 *                     result = htmlparser.htmlCtxtReadFile(
*/
    {
        PyThreadState * _save;
        _save = PyEval_SaveThread();
        __Pyx_FastGIL_Remember();
        /*try:*/ {

          /* "src/lxml/parser.pxi":1218
 *             orig_options = pctxt.options
 *             with nogil:
 *                 if self._for_html:             # <<<<<<<<<<<<<<
 *                     result = htmlparser.htmlCtxtReadFile(
 *                         pctxt, c_filename, c_encoding, self._parse_options)
*/
          if (__pyx_v_self->_for_html) {

            /* "src/lxml/parser.pxi":1219
 *             with nogil:
 *                 if self._for_html:
 *                     result = htmlparser.htmlCtxtReadFile(             # <<<<<<<<<<<<<<
 *                         pctxt, c_filename, c_encoding, self._parse_options)
 *                     if result is not NULL:
*/
            __pyx_v_result = htmlCtxtReadFile(__pyx_v_pctxt, __pyx_v_c_filename, __pyx_v_c_encoding, __pyx_v_self->_parse_options);

            /* "src/lxml/parser.pxi":1221
 *                     result = htmlparser.htmlCtxtReadFile(
 *                         pctxt, c_filename, c_encoding, self._parse_options)
 *                     if result is not NULL:             # <<<<<<<<<<<<<<
 *                         if _fixHtmlDictNames(pctxt.dict, result) < 0:
 *                             tree.xmlFreeDoc(result)
*/
            __pyx_t_4 = (__pyx_v_result != NULL);
            if (__pyx_t_4) {

              /* "src/lxml/parser.pxi":1222
 *                         pctxt, c_filename, c_encoding, self._parse_options)
 *                     if result is not NULL:
 *                         if _fixHtmlDictNames(pctxt.dict, result) < 0:             # <<<<<<<<<<<<<<
 *                             tree.xmlFreeDoc(result)
 *                             result = NULL
*/
              __pyx_t_4 = (__pyx_f_4lxml_5etree__fixHtmlDictNames(__pyx_v_pctxt->dict, __pyx_v_result) < 0);
              if (__pyx_t_4) {

                /* "src/lxml/parser.pxi":1223
 *                     if result is not NULL:
 *                         if _fixHtmlDictNames(pctxt.dict, result) < 0:
 *                             tree.xmlFreeDoc(result)             # <<<<<<<<<<<<<<
 *                             result = NULL
 *                 else:
*/
                xmlFreeDoc(__pyx_v_result);

                /* "src/lxml/parser.pxi":1224
 *                         if _fixHtmlDictNames(pctxt.dict, result) < 0:
 *                             tree.xmlFreeDoc(result)
 *                             result = NULL             # <<<<<<<<<<<<<<
 *                 else:
 *                     result = xmlparser.xmlCtxtReadFile(
*/
                __pyx_v_result = NULL;

                /* "src/lxml/parser.pxi":1222
 *                         pctxt, c_filename, c_encoding, self._parse_options)
 *                     if result is not NULL:
 *                         if _fixHtmlDictNames(pctxt.dict, result) < 0:             # <<<<<<<<<<<<<<
 *                             tree.xmlFreeDoc(result)
 *                             result = NULL
*/
              }

              /* "src/lxml/parser.pxi":1221
 *                     result = htmlparser.htmlCtxtReadFile(
 *                         pctxt, c_filename, c_encoding, self._parse_options)
 *                     if result is not NULL:             # <<<<<<<<<<<<<<
 *                         if _fixHtmlDictNames(pctxt.dict, result) < 0:
 *                             tree.xmlFreeDoc(result)
*/
            }

            /* "src/lxml/parser.pxi":1218
 *             orig_options = pctxt.options
 *             with nogil:
 *                 if self._for_html:             # <<<<<<<<<<<<<<
 *                     result = htmlparser.htmlCtxtReadFile(
 *                         pctxt, c_filename, c_encoding, self._parse_options)
*/
            goto __pyx_L10;
          }

          /* "src/lxml/parser.pxi":1226
 *                             result = NULL
 *                 else:
 *                     result = xmlparser.xmlCtxtReadFile(             # <<<<<<<<<<<<<<
 *                         pctxt, c_filename, c_encoding, self._parse_options)
 *             pctxt.options = orig_options # work around libxml2 problem
*/
          /*else*/ {

            /* "src/lxml/parser.pxi":1227
 *                 else:
 *                     result = xmlparser.xmlCtxtReadFile(
 *                         pctxt, c_filename, c_encoding, self._parse_options)             # <<<<<<<<<<<<<<
 *             pctxt.options = orig_options # work around libxml2 problem
 * 
*/
            __pyx_v_result = xmlCtxtReadFile(__pyx_v_pctxt, __pyx_v_c_filename, __pyx_v_c_encoding, __pyx_v_self->_parse_options);
          }
          __pyx_L10:;
        }

        /* "src/lxml/parser.pxi":1217
 * 
 *             orig_options = pctxt.options
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 if self._for_html:
 *                     result = htmlparser.htmlCtxtReadFile(
*/
        /*finally:*/ {
          /*normal exit:*/{
            __Pyx_FastGIL_Forget();
            PyEval_RestoreThread(_save);
            goto __pyx_L9;
          }
          __pyx_L9:;
        }
    }

    /* "src/lxml/parser.pxi":1228
 *                     result = xmlparser.xmlCtxtReadFile(
 *                         pctxt, c_filename, c_encoding, self._parse_options)
 *             pctxt.options = orig_options # work around libxml2 problem             # <<<<<<<<<<<<<<
 * 
 *             return context._handleParseResultDoc(self, result, c_filename)
*/
    __pyx_v_pctxt->options = __pyx_v_orig_options;

    /* "src/lxml/parser.pxi":1230
 *             pctxt.options = orig_options # work around libxml2 problem
 * 
 *             return context._handleParseResultDoc(self, result, c_filename)             # <<<<<<<<<<<<<<
 *         finally:
 *             context.cleanup()
*/
    __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_c_filename); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1230, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->_handleParseResultDoc(__pyx_v_context, __pyx_v_self, __pyx_v_result, __pyx_t_1); if (unlikely(__pyx_t_5 == ((void *)NULL))) __PYX_ERR(2, 1230, __pyx_L4_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_r = __pyx_t_5;
    goto __pyx_L3_return;
  }

  /* "src/lxml/parser.pxi":1232
 *             return context._handleParseResultDoc(self, result, c_filename)
 *         finally:
 *             context.cleanup()             # <<<<<<<<<<<<<<
 * 
 *     cdef xmlDoc* _parseDocFromFilelike(self, filelike, filename,
*/
  /*finally:*/ {
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
      if ( unlikely(__Pyx_GetException(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10) < 0)) __Pyx_ErrFetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      __pyx_t_2 = __pyx_lineno; __pyx_t_6 = __pyx_clineno; __pyx_t_7 = __pyx_filename;
      {
        __pyx_t_14 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->cleanup(__pyx_v_context); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(2, 1232, __pyx_L14_error)
      }
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_ErrRestore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
      __pyx_lineno = __pyx_t_2; __pyx_clineno = __pyx_t_6; __pyx_filename = __pyx_t_7;
      goto __pyx_L1_error;
      __pyx_L14_error:;
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L3_return: {
      __pyx_t_5 = __pyx_r;
      __pyx_t_6 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->cleanup(__pyx_v_context); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 1232, __pyx_L1_error)
      __pyx_r = __pyx_t_5;
      goto __pyx_L0;
    }
  }

  /* "src/lxml/parser.pxi":1198
 *             context.cleanup()
 * 
 *     cdef xmlDoc* _parseDocFromFile(self, char* c_filename) except NULL:             # <<<<<<<<<<<<<<
 *         cdef _ParserContext context
 *         cdef xmlDoc* result
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._BaseParser._parseDocFromFile", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":1234
 *             context.cleanup()
 * 
 *     cdef xmlDoc* _parseDocFromFilelike(self, filelike, filename,             # <<<<<<<<<<<<<<
 *                                        encoding) except NULL:
 *         cdef _ParserContext context
*/

static xmlDoc *__pyx_f_4lxml_5etree_11_BaseParser__parseDocFromFilelike(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self, PyObject *__pyx_v_filelike, PyObject *__pyx_v_filename, PyObject *__pyx_v_encoding) {
  struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_context = 0;
  struct __pyx_obj_4lxml_5etree__FileReaderContext *__pyx_v_file_context = 0;
  xmlDoc *__pyx_v_result;
  xmlParserCtxt *__pyx_v_pctxt;
  xmlDoc *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  xmlParserCtxt *__pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  size_t __pyx_t_8;
  xmlDoc *__pyx_t_9;
  int __pyx_t_10;
  char const *__pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  int __pyx_t_18;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_parseDocFromFilelike", 0);
  __Pyx_INCREF(__pyx_v_filename);

  /* "src/lxml/parser.pxi":1241
 *         cdef xmlparser.xmlParserCtxt* pctxt
 *         cdef char* c_filename
 *         if not filename:             # <<<<<<<<<<<<<<
 *             filename = None
 * 
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_filename); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(2, 1241, __pyx_L1_error)
  __pyx_t_2 = (!__pyx_t_1);
  if (__pyx_t_2) {

    /* "src/lxml/parser.pxi":1242
 *         cdef char* c_filename
 *         if not filename:
 *             filename = None             # <<<<<<<<<<<<<<
 * 
 *         context = self._getParserContext()
*/
    __Pyx_INCREF(Py_None);
    __Pyx_DECREF_SET(__pyx_v_filename, Py_None);

    /* "src/lxml/parser.pxi":1241
 *         cdef xmlparser.xmlParserCtxt* pctxt
 *         cdef char* c_filename
 *         if not filename:             # <<<<<<<<<<<<<<
 *             filename = None
 * 
*/
  }

  /* "src/lxml/parser.pxi":1244
 *             filename = None
 * 
 *         context = self._getParserContext()             # <<<<<<<<<<<<<<
 *         context.prepare()
 *         try:
*/
  __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)__pyx_v_self->__pyx_vtab)->_getParserContext(__pyx_v_self)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/parser.pxi":1245
 * 
 *         context = self._getParserContext()
 *         context.prepare()             # <<<<<<<<<<<<<<
 *         try:
 *             pctxt = context._c_ctxt
*/
  __pyx_t_4 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->prepare(__pyx_v_context, NULL); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 1245, __pyx_L1_error)

  /* "src/lxml/parser.pxi":1246
 *         context = self._getParserContext()
 *         context.prepare()
 *         try:             # <<<<<<<<<<<<<<
 *             pctxt = context._c_ctxt
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
*/
  /*try:*/ {

    /* "src/lxml/parser.pxi":1247
 *         context.prepare()
 *         try:
 *             pctxt = context._c_ctxt             # <<<<<<<<<<<<<<
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
 *             file_context = _FileReaderContext(
*/
    __pyx_t_5 = __pyx_v_context->_c_ctxt;
    __pyx_v_pctxt = __pyx_t_5;

    /* "src/lxml/parser.pxi":1248
 *         try:
 *             pctxt = context._c_ctxt
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)             # <<<<<<<<<<<<<<
 *             file_context = _FileReaderContext(
 *                 filelike, context, filename,
*/
    __pyx_t_4 = __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initParserDict(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, __pyx_v_pctxt); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 1248, __pyx_L5_error)

    /* "src/lxml/parser.pxi":1249
 *             pctxt = context._c_ctxt
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
 *             file_context = _FileReaderContext(             # <<<<<<<<<<<<<<
 *                 filelike, context, filename,
 *                 encoding or self._default_encoding)
*/
    __pyx_t_6 = NULL;

    /* "src/lxml/parser.pxi":1251
 *             file_context = _FileReaderContext(
 *                 filelike, context, filename,
 *                 encoding or self._default_encoding)             # <<<<<<<<<<<<<<
 *             result = file_context._readDoc(pctxt, self._parse_options)
 * 
*/
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_encoding); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(2, 1251, __pyx_L5_error)
    if (!__pyx_t_2) {
    } else {
      __Pyx_INCREF(__pyx_v_encoding);
      __pyx_t_7 = __pyx_v_encoding;
      goto __pyx_L7_bool_binop_done;
    }
    __Pyx_INCREF(__pyx_v_self->_default_encoding);
    __pyx_t_7 = __pyx_v_self->_default_encoding;
    __pyx_L7_bool_binop_done:;
    __pyx_t_8 = 1;
    {
      PyObject *__pyx_callargs[5] = {__pyx_t_6, __pyx_v_filelike, ((PyObject *)__pyx_v_context), __pyx_v_filename, __pyx_t_7};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__FileReaderContext, __pyx_callargs+__pyx_t_8, (5-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1249, __pyx_L5_error)
      __Pyx_GOTREF((PyObject *)__pyx_t_3);
    }
    __pyx_v_file_context = ((struct __pyx_obj_4lxml_5etree__FileReaderContext *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/parser.pxi":1252
 *                 filelike, context, filename,
 *                 encoding or self._default_encoding)
 *             result = file_context._readDoc(pctxt, self._parse_options)             # <<<<<<<<<<<<<<
 * 
 *             return context._handleParseResultDoc(
*/
    __pyx_v_result = __pyx_f_4lxml_5etree_18_FileReaderContext__readDoc(__pyx_v_file_context, __pyx_v_pctxt, __pyx_v_self->_parse_options);

    /* "src/lxml/parser.pxi":1254
 *             result = file_context._readDoc(pctxt, self._parse_options)
 * 
 *             return context._handleParseResultDoc(             # <<<<<<<<<<<<<<
 *                 self, result, filename)
 *         finally:
*/
    __pyx_t_9 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->_handleParseResultDoc(__pyx_v_context, __pyx_v_self, __pyx_v_result, __pyx_v_filename); if (unlikely(__pyx_t_9 == ((void *)NULL))) __PYX_ERR(2, 1254, __pyx_L5_error)
    __pyx_r = __pyx_t_9;
    goto __pyx_L4_return;
  }

  /* "src/lxml/parser.pxi":1257
 *                 self, result, filename)
 *         finally:
 *             context.cleanup()             # <<<<<<<<<<<<<<
 * 
 * 
*/
  /*finally:*/ {
    __pyx_L5_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17);
      if ( unlikely(__Pyx_GetException(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14) < 0)) __Pyx_ErrFetch(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_14);
      __Pyx_XGOTREF(__pyx_t_15);
      __Pyx_XGOTREF(__pyx_t_16);
      __Pyx_XGOTREF(__pyx_t_17);
      __pyx_t_4 = __pyx_lineno; __pyx_t_10 = __pyx_clineno; __pyx_t_11 = __pyx_filename;
      {
        __pyx_t_18 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->cleanup(__pyx_v_context); if (unlikely(__pyx_t_18 == ((int)-1))) __PYX_ERR(2, 1257, __pyx_L10_error)
      }
      __Pyx_XGIVEREF(__pyx_t_15);
      __Pyx_XGIVEREF(__pyx_t_16);
      __Pyx_XGIVEREF(__pyx_t_17);
      __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_XGIVEREF(__pyx_t_14);
      __Pyx_ErrRestore(__pyx_t_12, __pyx_t_13, __pyx_t_14);
      __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0;
      __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_10; __pyx_filename = __pyx_t_11;
      goto __pyx_L1_error;
      __pyx_L10_error:;
      __Pyx_XGIVEREF(__pyx_t_15);
      __Pyx_XGIVEREF(__pyx_t_16);
      __Pyx_XGIVEREF(__pyx_t_17);
      __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17);
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L4_return: {
      __pyx_t_9 = __pyx_r;
      __pyx_t_10 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->cleanup(__pyx_v_context); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(2, 1257, __pyx_L1_error)
      __pyx_r = __pyx_t_9;
      goto __pyx_L0;
    }
  }

  /* "src/lxml/parser.pxi":1234
 *             context.cleanup()
 * 
 *     cdef xmlDoc* _parseDocFromFilelike(self, filelike, filename,             # <<<<<<<<<<<<<<
 *                                        encoding) except NULL:
 *         cdef _ParserContext context
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree._BaseParser._parseDocFromFilelike", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_XDECREF((PyObject *)__pyx_v_file_context);
  __Pyx_XDECREF(__pyx_v_filename);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":850
 *     cdef XMLSchema _schema
 *     cdef bytes _filename
 *     cdef readonly object target             # <<<<<<<<<<<<<<
 *     cdef object _default_encoding
 *     cdef tuple _events_to_collect  # (event_types, tag)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_11_BaseParser_6target_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_11_BaseParser_6target_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_11_BaseParser_6target___get__(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_11_BaseParser_6target___get__(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->target);
  __pyx_r = __pyx_v_self->target;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":1260
 * 
 * 
 * cdef tree.xmlEntity* _getInternalEntityOnly(void* ctxt, const_xmlChar* name) noexcept nogil:             # <<<<<<<<<<<<<<
 *     """
 *     Callback function to intercept the entity resolution when external entity loading is disabled.
*/

static xmlEntity *__pyx_f_4lxml_5etree__getInternalEntityOnly(void *__pyx_v_ctxt, const xmlChar *__pyx_v_name) {
  xmlEntity *__pyx_v_entity;
  xmlError __pyx_v_c_error;
  xmlStructuredErrorFunc __pyx_v_err_func;
  xmlParserInput *__pyx_v_parser_input;
  void *__pyx_v_err_context;
  xmlParserCtxt *__pyx_v_c_ctxt;
  xmlEntity *__pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  xmlParserInput *__pyx_t_3;
  xmlError __pyx_t_4;
  int __pyx_t_5;

  /* "src/lxml/parser.pxi":1264
 *     Callback function to intercept the entity resolution when external entity loading is disabled.
 *     """
 *     cdef tree.xmlEntity* entity = xmlparser.xmlSAX2GetEntity(ctxt, name)             # <<<<<<<<<<<<<<
 *     if not entity:
 *         return NULL
*/
  __pyx_v_entity = xmlSAX2GetEntity(__pyx_v_ctxt, __pyx_v_name);

  /* "src/lxml/parser.pxi":1265
 *     """
 *     cdef tree.xmlEntity* entity = xmlparser.xmlSAX2GetEntity(ctxt, name)
 *     if not entity:             # <<<<<<<<<<<<<<
 *         return NULL
 *     if entity.etype not in (
*/
  __pyx_t_1 = (!(__pyx_v_entity != 0));
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":1266
 *     cdef tree.xmlEntity* entity = xmlparser.xmlSAX2GetEntity(ctxt, name)
 *     if not entity:
 *         return NULL             # <<<<<<<<<<<<<<
 *     if entity.etype not in (
 *             tree.xmlEntityType.XML_EXTERNAL_GENERAL_PARSED_ENTITY,
*/
    __pyx_r = NULL;
    goto __pyx_L0;

    /* "src/lxml/parser.pxi":1265
 *     """
 *     cdef tree.xmlEntity* entity = xmlparser.xmlSAX2GetEntity(ctxt, name)
 *     if not entity:             # <<<<<<<<<<<<<<
 *         return NULL
 *     if entity.etype not in (
*/
  }

  /* "src/lxml/parser.pxi":1267
 *     if not entity:
 *         return NULL
 *     if entity.etype not in (             # <<<<<<<<<<<<<<
 *             tree.xmlEntityType.XML_EXTERNAL_GENERAL_PARSED_ENTITY,
 *             tree.xmlEntityType.XML_EXTERNAL_GENERAL_UNPARSED_ENTITY,
*/
  switch (__pyx_v_entity->etype) {
    case XML_EXTERNAL_GENERAL_PARSED_ENTITY:

    /* "src/lxml/parser.pxi":1268
 *         return NULL
 *     if entity.etype not in (
 *             tree.xmlEntityType.XML_EXTERNAL_GENERAL_PARSED_ENTITY,             # <<<<<<<<<<<<<<
 *             tree.xmlEntityType.XML_EXTERNAL_GENERAL_UNPARSED_ENTITY,
 *             tree.xmlEntityType.XML_EXTERNAL_PARAMETER_ENTITY):
*/
    case XML_EXTERNAL_GENERAL_UNPARSED_ENTITY:

    /* "src/lxml/parser.pxi":1269
 *     if entity.etype not in (
 *             tree.xmlEntityType.XML_EXTERNAL_GENERAL_PARSED_ENTITY,
 *             tree.xmlEntityType.XML_EXTERNAL_GENERAL_UNPARSED_ENTITY,             # <<<<<<<<<<<<<<
 *             tree.xmlEntityType.XML_EXTERNAL_PARAMETER_ENTITY):
 *         return entity
*/
    case XML_EXTERNAL_PARAMETER_ENTITY:

    /* "src/lxml/parser.pxi":1267
 *     if not entity:
 *         return NULL
 *     if entity.etype not in (             # <<<<<<<<<<<<<<
 *             tree.xmlEntityType.XML_EXTERNAL_GENERAL_PARSED_ENTITY,
 *             tree.xmlEntityType.XML_EXTERNAL_GENERAL_UNPARSED_ENTITY,
*/
    __pyx_t_1 = 0;
    break;
    default:
    __pyx_t_1 = 1;
    break;
  }
  __pyx_t_2 = __pyx_t_1;
  if (__pyx_t_2) {

    /* "src/lxml/parser.pxi":1271
 *             tree.xmlEntityType.XML_EXTERNAL_GENERAL_UNPARSED_ENTITY,
 *             tree.xmlEntityType.XML_EXTERNAL_PARAMETER_ENTITY):
 *         return entity             # <<<<<<<<<<<<<<
 * 
 *     # Reject all external entities and fail the parsing instead. There is currently
*/
    __pyx_r = __pyx_v_entity;
    goto __pyx_L0;

    /* "src/lxml/parser.pxi":1267
 *     if not entity:
 *         return NULL
 *     if entity.etype not in (             # <<<<<<<<<<<<<<
 *             tree.xmlEntityType.XML_EXTERNAL_GENERAL_PARSED_ENTITY,
 *             tree.xmlEntityType.XML_EXTERNAL_GENERAL_UNPARSED_ENTITY,
*/
  }

  /* "src/lxml/parser.pxi":1280
 *     cdef void* err_context
 * 
 *     c_ctxt = <xmlparser.xmlParserCtxt *> ctxt             # <<<<<<<<<<<<<<
 *     err_func = xmlerror.xmlStructuredError
 *     if err_func:
*/
  __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt);

  /* "src/lxml/parser.pxi":1281
 * 
 *     c_ctxt = <xmlparser.xmlParserCtxt *> ctxt
 *     err_func = xmlerror.xmlStructuredError             # <<<<<<<<<<<<<<
 *     if err_func:
 *         parser_input = c_ctxt.input
*/
  __pyx_v_err_func = xmlStructuredError;

  /* "src/lxml/parser.pxi":1282
 *     c_ctxt = <xmlparser.xmlParserCtxt *> ctxt
 *     err_func = xmlerror.xmlStructuredError
 *     if err_func:             # <<<<<<<<<<<<<<
 *         parser_input = c_ctxt.input
 *         # Copied from xmlVErrParser() in libxml2: get current input from stack.
*/
  __pyx_t_2 = (__pyx_v_err_func != 0);
  if (__pyx_t_2) {

    /* "src/lxml/parser.pxi":1283
 *     err_func = xmlerror.xmlStructuredError
 *     if err_func:
 *         parser_input = c_ctxt.input             # <<<<<<<<<<<<<<
 *         # Copied from xmlVErrParser() in libxml2: get current input from stack.
 *         if parser_input and parser_input.filename is NULL and c_ctxt.inputNr > 1:
*/
    __pyx_t_3 = __pyx_v_c_ctxt->input;
    __pyx_v_parser_input = __pyx_t_3;

    /* "src/lxml/parser.pxi":1285
 *         parser_input = c_ctxt.input
 *         # Copied from xmlVErrParser() in libxml2: get current input from stack.
 *         if parser_input and parser_input.filename is NULL and c_ctxt.inputNr > 1:             # <<<<<<<<<<<<<<
 *             parser_input = c_ctxt.inputTab[c_ctxt.inputNr - 2]
 * 
*/
    __pyx_t_1 = (__pyx_v_parser_input != 0);
    if (__pyx_t_1) {
    } else {
      __pyx_t_2 = __pyx_t_1;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_1 = (__pyx_v_parser_input->filename == NULL);
    if (__pyx_t_1) {
    } else {
      __pyx_t_2 = __pyx_t_1;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_1 = (__pyx_v_c_ctxt->inputNr > 1);
    __pyx_t_2 = __pyx_t_1;
    __pyx_L7_bool_binop_done:;
    if (__pyx_t_2) {

      /* "src/lxml/parser.pxi":1286
 *         # Copied from xmlVErrParser() in libxml2: get current input from stack.
 *         if parser_input and parser_input.filename is NULL and c_ctxt.inputNr > 1:
 *             parser_input = c_ctxt.inputTab[c_ctxt.inputNr - 2]             # <<<<<<<<<<<<<<
 * 
 *         c_error = xmlerror.xmlError(
*/
      __pyx_v_parser_input = (__pyx_v_c_ctxt->inputTab[(__pyx_v_c_ctxt->inputNr - 2)]);

      /* "src/lxml/parser.pxi":1285
 *         parser_input = c_ctxt.input
 *         # Copied from xmlVErrParser() in libxml2: get current input from stack.
 *         if parser_input and parser_input.filename is NULL and c_ctxt.inputNr > 1:             # <<<<<<<<<<<<<<
 *             parser_input = c_ctxt.inputTab[c_ctxt.inputNr - 2]
 * 
*/
    }

    /* "src/lxml/parser.pxi":1289
 * 
 *         c_error = xmlerror.xmlError(
 *             domain=xmlerror.xmlErrorDomain.XML_FROM_PARSER,             # <<<<<<<<<<<<<<
 *             code=xmlerror.xmlParserErrors.XML_ERR_EXT_ENTITY_STANDALONE,
 *             level=xmlerror.xmlErrorLevel.XML_ERR_FATAL,
*/
    __pyx_t_4.domain = XML_FROM_PARSER;

    /* "src/lxml/parser.pxi":1290
 *         c_error = xmlerror.xmlError(
 *             domain=xmlerror.xmlErrorDomain.XML_FROM_PARSER,
 *             code=xmlerror.xmlParserErrors.XML_ERR_EXT_ENTITY_STANDALONE,             # <<<<<<<<<<<<<<
 *             level=xmlerror.xmlErrorLevel.XML_ERR_FATAL,
 *             message=b"External entity resolution is disabled for security reasons "
*/
    __pyx_t_4.code = XML_ERR_EXT_ENTITY_STANDALONE;

    /* "src/lxml/parser.pxi":1291
 *             domain=xmlerror.xmlErrorDomain.XML_FROM_PARSER,
 *             code=xmlerror.xmlParserErrors.XML_ERR_EXT_ENTITY_STANDALONE,
 *             level=xmlerror.xmlErrorLevel.XML_ERR_FATAL,             # <<<<<<<<<<<<<<
 *             message=b"External entity resolution is disabled for security reasons "
 *                     b"when resolving '&%s;'. Use 'XMLParser(resolve_entities=True)' "
*/
    __pyx_t_4.level = XML_ERR_FATAL;
    __pyx_t_4.message = ((char *)"External entity resolution is disabled for security reasons when resolving '&%s;'. Use 'XMLParser(resolve_entities=True)' if you consider it safe to enable it.");

    /* "src/lxml/parser.pxi":1295
 *                     b"when resolving '&%s;'. Use 'XMLParser(resolve_entities=True)' "
 *                     b"if you consider it safe to enable it.",
 *             file=parser_input.filename,             # <<<<<<<<<<<<<<
 *             node=entity,
 *             str1=<char*> name,
*/
    __pyx_t_4.file = __pyx_v_parser_input->filename;

    /* "src/lxml/parser.pxi":1296
 *                     b"if you consider it safe to enable it.",
 *             file=parser_input.filename,
 *             node=entity,             # <<<<<<<<<<<<<<
 *             str1=<char*> name,
 *             str2=NULL,
*/
    __pyx_t_4.node = __pyx_v_entity;

    /* "src/lxml/parser.pxi":1297
 *             file=parser_input.filename,
 *             node=entity,
 *             str1=<char*> name,             # <<<<<<<<<<<<<<
 *             str2=NULL,
 *             str3=NULL,
*/
    __pyx_t_4.str1 = ((char *)__pyx_v_name);

    /* "src/lxml/parser.pxi":1298
 *             node=entity,
 *             str1=<char*> name,
 *             str2=NULL,             # <<<<<<<<<<<<<<
 *             str3=NULL,
 *             line=parser_input.line if parser_input else 0,
*/
    __pyx_t_4.str2 = NULL;

    /* "src/lxml/parser.pxi":1299
 *             str1=<char*> name,
 *             str2=NULL,
 *             str3=NULL,             # <<<<<<<<<<<<<<
 *             line=parser_input.line if parser_input else 0,
 *             int1=0,
*/
    __pyx_t_4.str3 = NULL;

    /* "src/lxml/parser.pxi":1300
 *             str2=NULL,
 *             str3=NULL,
 *             line=parser_input.line if parser_input else 0,             # <<<<<<<<<<<<<<
 *             int1=0,
 *             int2=parser_input.col if parser_input else 0,
*/
    __pyx_t_2 = (__pyx_v_parser_input != 0);
    if (__pyx_t_2) {
      __pyx_t_5 = __pyx_v_parser_input->line;
    } else {
      __pyx_t_5 = 0;
    }
    __pyx_t_4.line = __pyx_t_5;
    __pyx_t_4.int1 = 0;

    /* "src/lxml/parser.pxi":1302
 *             line=parser_input.line if parser_input else 0,
 *             int1=0,
 *             int2=parser_input.col if parser_input else 0,             # <<<<<<<<<<<<<<
 *         )
 *         err_context = xmlerror.xmlStructuredErrorContext
*/
    __pyx_t_2 = (__pyx_v_parser_input != 0);
    if (__pyx_t_2) {
      __pyx_t_5 = __pyx_v_parser_input->col;
    } else {
      __pyx_t_5 = 0;
    }
    __pyx_t_4.int2 = __pyx_t_5;
    __pyx_v_c_error = __pyx_t_4;

    /* "src/lxml/parser.pxi":1304
 *             int2=parser_input.col if parser_input else 0,
 *         )
 *         err_context = xmlerror.xmlStructuredErrorContext             # <<<<<<<<<<<<<<
 *         err_func(err_context, &c_error)
 * 
*/
    __pyx_v_err_context = xmlStructuredErrorContext;

    /* "src/lxml/parser.pxi":1305
 *         )
 *         err_context = xmlerror.xmlStructuredErrorContext
 *         err_func(err_context, &c_error)             # <<<<<<<<<<<<<<
 * 
 *     c_ctxt.wellFormed = 0
*/
    __pyx_v_err_func(__pyx_v_err_context, (&__pyx_v_c_error));

    /* "src/lxml/parser.pxi":1282
 *     c_ctxt = <xmlparser.xmlParserCtxt *> ctxt
 *     err_func = xmlerror.xmlStructuredError
 *     if err_func:             # <<<<<<<<<<<<<<
 *         parser_input = c_ctxt.input
 *         # Copied from xmlVErrParser() in libxml2: get current input from stack.
*/
  }

  /* "src/lxml/parser.pxi":1307
 *         err_func(err_context, &c_error)
 * 
 *     c_ctxt.wellFormed = 0             # <<<<<<<<<<<<<<
 *     # The entity was looked up and does not need to be freed.
 *     return NULL
*/
  __pyx_v_c_ctxt->wellFormed = 0;

  /* "src/lxml/parser.pxi":1309
 *     c_ctxt.wellFormed = 0
 *     # The entity was looked up and does not need to be freed.
 *     return NULL             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = NULL;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":1260
 * 
 * 
 * cdef tree.xmlEntity* _getInternalEntityOnly(void* ctxt, const_xmlChar* name) noexcept nogil:             # <<<<<<<<<<<<<<
 *     """
 *     Callback function to intercept the entity resolution when external entity loading is disabled.
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/parser.pxi":1312
 * 
 * 
 * cdef void _initSaxDocument(void* ctxt) noexcept with gil:             # <<<<<<<<<<<<<<
 *     xmlparser.xmlSAX2StartDocument(ctxt)
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
*/

static void __pyx_f_4lxml_5etree__initSaxDocument(void *__pyx_v_ctxt) {
  xmlParserCtxt *__pyx_v_c_ctxt;
  xmlDoc *__pyx_v_c_doc;
  struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_context = NULL;
  xmlDict *__pyx_v_c_dict;
  __Pyx_RefNannyDeclarations
  xmlDoc *__pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  xmlDict *__pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("_initSaxDocument", 0);

  /* "src/lxml/parser.pxi":1313
 * 
 * cdef void _initSaxDocument(void* ctxt) noexcept with gil:
 *     xmlparser.xmlSAX2StartDocument(ctxt)             # <<<<<<<<<<<<<<
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     c_doc = c_ctxt.myDoc
*/
  xmlSAX2StartDocument(__pyx_v_ctxt);

  /* "src/lxml/parser.pxi":1314
 * cdef void _initSaxDocument(void* ctxt) noexcept with gil:
 *     xmlparser.xmlSAX2StartDocument(ctxt)
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt             # <<<<<<<<<<<<<<
 *     c_doc = c_ctxt.myDoc
 * 
*/
  __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt);

  /* "src/lxml/parser.pxi":1315
 *     xmlparser.xmlSAX2StartDocument(ctxt)
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     c_doc = c_ctxt.myDoc             # <<<<<<<<<<<<<<
 * 
 *     # set up document dict
*/
  __pyx_t_1 = __pyx_v_c_ctxt->myDoc;
  __pyx_v_c_doc = __pyx_t_1;

  /* "src/lxml/parser.pxi":1318
 * 
 *     # set up document dict
 *     if c_doc and c_ctxt.dict and not c_doc.dict:             # <<<<<<<<<<<<<<
 *         # I have no idea why libxml2 disables this - we need it
 *         c_ctxt.dictNames = 1
*/
  __pyx_t_3 = (__pyx_v_c_doc != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_c_ctxt->dict != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (!(__pyx_v_c_doc->dict != 0));
  __pyx_t_2 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "src/lxml/parser.pxi":1320
 *     if c_doc and c_ctxt.dict and not c_doc.dict:
 *         # I have no idea why libxml2 disables this - we need it
 *         c_ctxt.dictNames = 1             # <<<<<<<<<<<<<<
 *         c_doc.dict = c_ctxt.dict
 *         xmlparser.xmlDictReference(c_ctxt.dict)
*/
    __pyx_v_c_ctxt->dictNames = 1;

    /* "src/lxml/parser.pxi":1321
 *         # I have no idea why libxml2 disables this - we need it
 *         c_ctxt.dictNames = 1
 *         c_doc.dict = c_ctxt.dict             # <<<<<<<<<<<<<<
 *         xmlparser.xmlDictReference(c_ctxt.dict)
 * 
*/
    __pyx_t_4 = __pyx_v_c_ctxt->dict;
    __pyx_v_c_doc->dict = __pyx_t_4;

    /* "src/lxml/parser.pxi":1322
 *         c_ctxt.dictNames = 1
 *         c_doc.dict = c_ctxt.dict
 *         xmlparser.xmlDictReference(c_ctxt.dict)             # <<<<<<<<<<<<<<
 * 
 *     # set up XML ID hash table
*/
    (void)(xmlDictReference(__pyx_v_c_ctxt->dict));

    /* "src/lxml/parser.pxi":1318
 * 
 *     # set up document dict
 *     if c_doc and c_ctxt.dict and not c_doc.dict:             # <<<<<<<<<<<<<<
 *         # I have no idea why libxml2 disables this - we need it
 *         c_ctxt.dictNames = 1
*/
  }

  /* "src/lxml/parser.pxi":1325
 * 
 *     # set up XML ID hash table
 *     if c_ctxt._private:             # <<<<<<<<<<<<<<
 *         context = <_ParserContext>c_ctxt._private
 *         if context._collect_ids:
*/
  __pyx_t_2 = (__pyx_v_c_ctxt->_private != 0);
  if (__pyx_t_2) {

    /* "src/lxml/parser.pxi":1326
 *     # set up XML ID hash table
 *     if c_ctxt._private:
 *         context = <_ParserContext>c_ctxt._private             # <<<<<<<<<<<<<<
 *         if context._collect_ids:
 *             # keep the global parser dict from filling up with XML IDs
*/
    __pyx_t_5 = ((PyObject *)__pyx_v_c_ctxt->_private);
    __Pyx_INCREF(__pyx_t_5);
    __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "src/lxml/parser.pxi":1327
 *     if c_ctxt._private:
 *         context = <_ParserContext>c_ctxt._private
 *         if context._collect_ids:             # <<<<<<<<<<<<<<
 *             # keep the global parser dict from filling up with XML IDs
 *             if c_doc and not c_doc.ids:
*/
    if (__pyx_v_context->_collect_ids) {

      /* "src/lxml/parser.pxi":1329
 *         if context._collect_ids:
 *             # keep the global parser dict from filling up with XML IDs
 *             if c_doc and not c_doc.ids:             # <<<<<<<<<<<<<<
 *                 # memory errors are not fatal here
 *                 c_dict = xmlparser.xmlDictCreate()
*/
      __pyx_t_3 = (__pyx_v_c_doc != 0);
      if (__pyx_t_3) {
      } else {
        __pyx_t_2 = __pyx_t_3;
        goto __pyx_L10_bool_binop_done;
      }
      __pyx_t_3 = (!(__pyx_v_c_doc->ids != 0));
      __pyx_t_2 = __pyx_t_3;
      __pyx_L10_bool_binop_done:;
      if (__pyx_t_2) {

        /* "src/lxml/parser.pxi":1331
 *             if c_doc and not c_doc.ids:
 *                 # memory errors are not fatal here
 *                 c_dict = xmlparser.xmlDictCreate()             # <<<<<<<<<<<<<<
 *                 if c_dict:
 *                     c_doc.ids = tree.xmlHashCreateDict(0, c_dict)
*/
        __pyx_v_c_dict = xmlDictCreate();

        /* "src/lxml/parser.pxi":1332
 *                 # memory errors are not fatal here
 *                 c_dict = xmlparser.xmlDictCreate()
 *                 if c_dict:             # <<<<<<<<<<<<<<
 *                     c_doc.ids = tree.xmlHashCreateDict(0, c_dict)
 *                     xmlparser.xmlDictFree(c_dict)
*/
        __pyx_t_2 = (__pyx_v_c_dict != 0);
        if (__pyx_t_2) {

          /* "src/lxml/parser.pxi":1333
 *                 c_dict = xmlparser.xmlDictCreate()
 *                 if c_dict:
 *                     c_doc.ids = tree.xmlHashCreateDict(0, c_dict)             # <<<<<<<<<<<<<<
 *                     xmlparser.xmlDictFree(c_dict)
 *                 else:
*/
          __pyx_v_c_doc->ids = xmlHashCreateDict(0, __pyx_v_c_dict);

          /* "src/lxml/parser.pxi":1334
 *                 if c_dict:
 *                     c_doc.ids = tree.xmlHashCreateDict(0, c_dict)
 *                     xmlparser.xmlDictFree(c_dict)             # <<<<<<<<<<<<<<
 *                 else:
 *                     c_doc.ids = tree.xmlHashCreate(0)
*/
          xmlDictFree(__pyx_v_c_dict);

          /* "src/lxml/parser.pxi":1332
 *                 # memory errors are not fatal here
 *                 c_dict = xmlparser.xmlDictCreate()
 *                 if c_dict:             # <<<<<<<<<<<<<<
 *                     c_doc.ids = tree.xmlHashCreateDict(0, c_dict)
 *                     xmlparser.xmlDictFree(c_dict)
*/
          goto __pyx_L12;
        }

        /* "src/lxml/parser.pxi":1336
 *                     xmlparser.xmlDictFree(c_dict)
 *                 else:
 *                     c_doc.ids = tree.xmlHashCreate(0)             # <<<<<<<<<<<<<<
 *         else:
 *             c_ctxt.loadsubset |= xmlparser.XML_SKIP_IDS
*/
        /*else*/ {
          __pyx_v_c_doc->ids = xmlHashCreate(0);
        }
        __pyx_L12:;

        /* "src/lxml/parser.pxi":1329
 *         if context._collect_ids:
 *             # keep the global parser dict from filling up with XML IDs
 *             if c_doc and not c_doc.ids:             # <<<<<<<<<<<<<<
 *                 # memory errors are not fatal here
 *                 c_dict = xmlparser.xmlDictCreate()
*/
      }

      /* "src/lxml/parser.pxi":1327
 *     if c_ctxt._private:
 *         context = <_ParserContext>c_ctxt._private
 *         if context._collect_ids:             # <<<<<<<<<<<<<<
 *             # keep the global parser dict from filling up with XML IDs
 *             if c_doc and not c_doc.ids:
*/
      goto __pyx_L8;
    }

    /* "src/lxml/parser.pxi":1338
 *                     c_doc.ids = tree.xmlHashCreate(0)
 *         else:
 *             c_ctxt.loadsubset |= xmlparser.XML_SKIP_IDS             # <<<<<<<<<<<<<<
 *             if c_doc and c_doc.ids and not tree.xmlHashSize(c_doc.ids):
 *                 # already initialised but empty => clear
*/
    /*else*/ {
      __pyx_v_c_ctxt->loadsubset = (__pyx_v_c_ctxt->loadsubset | XML_SKIP_IDS);

      /* "src/lxml/parser.pxi":1339
 *         else:
 *             c_ctxt.loadsubset |= xmlparser.XML_SKIP_IDS
 *             if c_doc and c_doc.ids and not tree.xmlHashSize(c_doc.ids):             # <<<<<<<<<<<<<<
 *                 # already initialised but empty => clear
 *                 tree.xmlHashFree(c_doc.ids, NULL)
*/
      __pyx_t_3 = (__pyx_v_c_doc != 0);
      if (__pyx_t_3) {
      } else {
        __pyx_t_2 = __pyx_t_3;
        goto __pyx_L14_bool_binop_done;
      }
      __pyx_t_3 = (__pyx_v_c_doc->ids != 0);
      if (__pyx_t_3) {
      } else {
        __pyx_t_2 = __pyx_t_3;
        goto __pyx_L14_bool_binop_done;
      }
      __pyx_t_3 = (!(xmlHashSize(__pyx_v_c_doc->ids) != 0));
      __pyx_t_2 = __pyx_t_3;
      __pyx_L14_bool_binop_done:;
      if (__pyx_t_2) {

        /* "src/lxml/parser.pxi":1341
 *             if c_doc and c_doc.ids and not tree.xmlHashSize(c_doc.ids):
 *                 # already initialised but empty => clear
 *                 tree.xmlHashFree(c_doc.ids, NULL)             # <<<<<<<<<<<<<<
 *                 c_doc.ids = NULL
 * 
*/
        xmlHashFree(__pyx_v_c_doc->ids, NULL);

        /* "src/lxml/parser.pxi":1342
 *                 # already initialised but empty => clear
 *                 tree.xmlHashFree(c_doc.ids, NULL)
 *                 c_doc.ids = NULL             # <<<<<<<<<<<<<<
 * 
 * 
*/
        __pyx_v_c_doc->ids = NULL;

        /* "src/lxml/parser.pxi":1339
 *         else:
 *             c_ctxt.loadsubset |= xmlparser.XML_SKIP_IDS
 *             if c_doc and c_doc.ids and not tree.xmlHashSize(c_doc.ids):             # <<<<<<<<<<<<<<
 *                 # already initialised but empty => clear
 *                 tree.xmlHashFree(c_doc.ids, NULL)
*/
      }
    }
    __pyx_L8:;

    /* "src/lxml/parser.pxi":1325
 * 
 *     # set up XML ID hash table
 *     if c_ctxt._private:             # <<<<<<<<<<<<<<
 *         context = <_ParserContext>c_ctxt._private
 *         if context._collect_ids:
*/
  }

  /* "src/lxml/parser.pxi":1312
 * 
 * 
 * cdef void _initSaxDocument(void* ctxt) noexcept with gil:             # <<<<<<<<<<<<<<
 *     xmlparser.xmlSAX2StartDocument(ctxt)
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
*/

  /* function exit code */
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
}

/* "src/lxml/parser.pxi":1352
 *     cdef bint _feed_parser_running
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def feed_error_log(self):
 *         """The error log of the last (or current) run of the feed parser.
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_11_FeedParser_14feed_error_log_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_11_FeedParser_14feed_error_log_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_11_FeedParser_14feed_error_log___get__(((struct __pyx_obj_4lxml_5etree__FeedParser *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_11_FeedParser_14feed_error_log___get__(struct __pyx_obj_4lxml_5etree__FeedParser *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "src/lxml/parser.pxi":1359
 *         different from what the ``error_log`` property returns.
 *         """
 *         return self._getPushParserContext()._error_log.copy()             # <<<<<<<<<<<<<<
 * 
 *     cpdef feed(self, data):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__FeedParser *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._getPushParserContext(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self))); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1359, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_1)->_error_log->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.copy(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_1)->_error_log), 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1359, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":1352
 *     cdef bint _feed_parser_running
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def feed_error_log(self):
 *         """The error log of the last (or current) run of the feed parser.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._FeedParser.feed_error_log.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":1361
 *         return self._getPushParserContext()._error_log.copy()
 * 
 *     cpdef feed(self, data):             # <<<<<<<<<<<<<<
 *         """feed(self, data)
 * 
*/

static PyObject *__pyx_pw_4lxml_5etree_11_FeedParser_1feed(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_4lxml_5etree_11_FeedParser_feed(struct __pyx_obj_4lxml_5etree__FeedParser *__pyx_v_self, PyObject *__pyx_v_data, int __pyx_skip_dispatch) {
  struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_context = 0;
  PyObject *__pyx_v_bstring = 0;
  xmlParserCtxt *__pyx_v_pctxt;
  Py_ssize_t __pyx_v_py_buffer_len;
  Py_ssize_t __pyx_v_ustart;
  const char *__pyx_v_char_data;
  const char *__pyx_v_c_encoding;
  int __pyx_v_buffer_len;
  int __pyx_v_error;
  int __pyx_v_recover;
  char *__pyx_v_c_filename;
  xmlExternalEntityLoader __pyx_v_orig_loader;
  long __pyx_v_fixup_error;
  PyObject *__pyx_v_entry = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_t_6;
  const char *__pyx_t_7;
  Py_ssize_t __pyx_t_8;
  xmlParserCtxt *__pyx_t_9;
  int __pyx_t_10;
  struct __pyx_opt_args_4lxml_5etree_14_ParserContext_prepare __pyx_t_11;
  char *__pyx_t_12;
  int __pyx_t_13;
  char const *__pyx_t_14;
  __pyx_ctuple_int__and_int __pyx_t_15;
  int __pyx_t_16;
  PyObject *(*__pyx_t_17)(PyObject *);
  char const *__pyx_t_18;
  PyObject *__pyx_t_19 = NULL;
  PyObject *__pyx_t_20 = NULL;
  PyObject *__pyx_t_21 = NULL;
  PyObject *__pyx_t_22 = NULL;
  PyObject *__pyx_t_23 = NULL;
  PyObject *__pyx_t_24 = NULL;
  int __pyx_t_25;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("feed", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (
  #if !CYTHON_USE_TYPE_SLOTS
  unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_4lxml_5etree__FeedParser &&
  __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
  #else
  unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
  #endif
  ) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_feed); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1361, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_4lxml_5etree_11_FeedParser_1feed)) {
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_3 = NULL;
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_4 = __pyx_t_1; 
        __pyx_t_5 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
          assert(__pyx_t_3);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
          __pyx_t_5 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_data};
          __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1361, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
        }
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "src/lxml/parser.pxi":1387
 *         cdef int buffer_len
 *         cdef int error
 *         cdef bint recover = self._parse_options & xmlparser.XML_PARSE_RECOVER             # <<<<<<<<<<<<<<
 * 
 *         if isinstance(data, bytes):
*/
  __pyx_v_recover = (__pyx_v_self->__pyx_base._parse_options & XML_PARSE_RECOVER);

  /* "src/lxml/parser.pxi":1389
 *         cdef bint recover = self._parse_options & xmlparser.XML_PARSE_RECOVER
 * 
 *         if isinstance(data, bytes):             # <<<<<<<<<<<<<<
 *             if self._default_encoding is None:
 *                 c_encoding = NULL
*/
  __pyx_t_6 = PyBytes_Check(__pyx_v_data); 
  if (__pyx_t_6) {

    /* "src/lxml/parser.pxi":1390
 * 
 *         if isinstance(data, bytes):
 *             if self._default_encoding is None:             # <<<<<<<<<<<<<<
 *                 c_encoding = NULL
 *             else:
*/
    __pyx_t_6 = (__pyx_v_self->__pyx_base._default_encoding == Py_None);
    if (__pyx_t_6) {

      /* "src/lxml/parser.pxi":1391
 *         if isinstance(data, bytes):
 *             if self._default_encoding is None:
 *                 c_encoding = NULL             # <<<<<<<<<<<<<<
 *             else:
 *                 c_encoding = self._default_encoding
*/
      __pyx_v_c_encoding = NULL;

      /* "src/lxml/parser.pxi":1390
 * 
 *         if isinstance(data, bytes):
 *             if self._default_encoding is None:             # <<<<<<<<<<<<<<
 *                 c_encoding = NULL
 *             else:
*/
      goto __pyx_L4;
    }

    /* "src/lxml/parser.pxi":1393
 *                 c_encoding = NULL
 *             else:
 *                 c_encoding = self._default_encoding             # <<<<<<<<<<<<<<
 *             char_data = _cstr(data)
 *             py_buffer_len = python.PyBytes_GET_SIZE(data)
*/
    /*else*/ {
      __pyx_t_7 = __Pyx_PyObject_AsString(__pyx_v_self->__pyx_base._default_encoding); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(2, 1393, __pyx_L1_error)
      __pyx_v_c_encoding = __pyx_t_7;
    }
    __pyx_L4:;

    /* "src/lxml/parser.pxi":1394
 *             else:
 *                 c_encoding = self._default_encoding
 *             char_data = _cstr(data)             # <<<<<<<<<<<<<<
 *             py_buffer_len = python.PyBytes_GET_SIZE(data)
 *             ustart = 0
*/
    __pyx_v_char_data = PyBytes_AS_STRING(__pyx_v_data);

    /* "src/lxml/parser.pxi":1395
 *                 c_encoding = self._default_encoding
 *             char_data = _cstr(data)
 *             py_buffer_len = python.PyBytes_GET_SIZE(data)             # <<<<<<<<<<<<<<
 *             ustart = 0
 *         elif isinstance(data, unicode):
*/
    __pyx_v_py_buffer_len = PyBytes_GET_SIZE(__pyx_v_data);

    /* "src/lxml/parser.pxi":1396
 *             char_data = _cstr(data)
 *             py_buffer_len = python.PyBytes_GET_SIZE(data)
 *             ustart = 0             # <<<<<<<<<<<<<<
 *         elif isinstance(data, unicode):
 *             c_encoding = b"UTF-8"
*/
    __pyx_v_ustart = 0;

    /* "src/lxml/parser.pxi":1389
 *         cdef bint recover = self._parse_options & xmlparser.XML_PARSE_RECOVER
 * 
 *         if isinstance(data, bytes):             # <<<<<<<<<<<<<<
 *             if self._default_encoding is None:
 *                 c_encoding = NULL
*/
    goto __pyx_L3;
  }

  /* "src/lxml/parser.pxi":1397
 *             py_buffer_len = python.PyBytes_GET_SIZE(data)
 *             ustart = 0
 *         elif isinstance(data, unicode):             # <<<<<<<<<<<<<<
 *             c_encoding = b"UTF-8"
 *             char_data = NULL
*/
  __pyx_t_6 = PyUnicode_Check(__pyx_v_data); 
  if (likely(__pyx_t_6)) {

    /* "src/lxml/parser.pxi":1398
 *             ustart = 0
 *         elif isinstance(data, unicode):
 *             c_encoding = b"UTF-8"             # <<<<<<<<<<<<<<
 *             char_data = NULL
 *             py_buffer_len = len(<unicode> data)
*/
    __pyx_v_c_encoding = __pyx_k_UTF_8;

    /* "src/lxml/parser.pxi":1399
 *         elif isinstance(data, unicode):
 *             c_encoding = b"UTF-8"
 *             char_data = NULL             # <<<<<<<<<<<<<<
 *             py_buffer_len = len(<unicode> data)
 *             ustart = 0
*/
    __pyx_v_char_data = NULL;

    /* "src/lxml/parser.pxi":1400
 *             c_encoding = b"UTF-8"
 *             char_data = NULL
 *             py_buffer_len = len(<unicode> data)             # <<<<<<<<<<<<<<
 *             ustart = 0
 *         else:
*/
    if (unlikely(__pyx_v_data == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
      __PYX_ERR(2, 1400, __pyx_L1_error)
    }
    __pyx_t_8 = __Pyx_PyUnicode_GET_LENGTH(((PyObject*)__pyx_v_data)); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(2, 1400, __pyx_L1_error)
    __pyx_v_py_buffer_len = __pyx_t_8;

    /* "src/lxml/parser.pxi":1401
 *             char_data = NULL
 *             py_buffer_len = len(<unicode> data)
 *             ustart = 0             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError, "Parsing requires string data"
*/
    __pyx_v_ustart = 0;

    /* "src/lxml/parser.pxi":1397
 *             py_buffer_len = python.PyBytes_GET_SIZE(data)
 *             ustart = 0
 *         elif isinstance(data, unicode):             # <<<<<<<<<<<<<<
 *             c_encoding = b"UTF-8"
 *             char_data = NULL
*/
    goto __pyx_L3;
  }

  /* "src/lxml/parser.pxi":1403
 *             ustart = 0
 *         else:
 *             raise TypeError, "Parsing requires string data"             # <<<<<<<<<<<<<<
 * 
 *         context = self._getPushParserContext()
*/
  /*else*/ {
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_Parsing_requires_string_data, 0, 0);
    __PYX_ERR(2, 1403, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "src/lxml/parser.pxi":1405
 *             raise TypeError, "Parsing requires string data"
 * 
 *         context = self._getPushParserContext()             # <<<<<<<<<<<<<<
 *         pctxt = context._c_ctxt
 *         error = 0
*/
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__FeedParser *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._getPushParserContext(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self))); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1405, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/parser.pxi":1406
 * 
 *         context = self._getPushParserContext()
 *         pctxt = context._c_ctxt             # <<<<<<<<<<<<<<
 *         error = 0
 *         if not self._feed_parser_running:
*/
  __pyx_t_9 = __pyx_v_context->_c_ctxt;
  __pyx_v_pctxt = __pyx_t_9;

  /* "src/lxml/parser.pxi":1407
 *         context = self._getPushParserContext()
 *         pctxt = context._c_ctxt
 *         error = 0             # <<<<<<<<<<<<<<
 *         if not self._feed_parser_running:
 *             context.prepare(set_document_loader=False)
*/
  __pyx_v_error = 0;

  /* "src/lxml/parser.pxi":1408
 *         pctxt = context._c_ctxt
 *         error = 0
 *         if not self._feed_parser_running:             # <<<<<<<<<<<<<<
 *             context.prepare(set_document_loader=False)
 *             self._feed_parser_running = 1
*/
  __pyx_t_6 = (!__pyx_v_self->_feed_parser_running);
  if (__pyx_t_6) {

    /* "src/lxml/parser.pxi":1409
 *         error = 0
 *         if not self._feed_parser_running:
 *             context.prepare(set_document_loader=False)             # <<<<<<<<<<<<<<
 *             self._feed_parser_running = 1
 *             c_filename = (_cstr(self._filename)
*/
    __pyx_t_11.__pyx_n = 1;
    __pyx_t_11.set_document_loader = 0;
    __pyx_t_10 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->prepare(__pyx_v_context, &__pyx_t_11); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(2, 1409, __pyx_L1_error)

    /* "src/lxml/parser.pxi":1410
 *         if not self._feed_parser_running:
 *             context.prepare(set_document_loader=False)
 *             self._feed_parser_running = 1             # <<<<<<<<<<<<<<
 *             c_filename = (_cstr(self._filename)
 *                           if self._filename is not None else NULL)
*/
    __pyx_v_self->_feed_parser_running = 1;

    /* "src/lxml/parser.pxi":1412
 *             self._feed_parser_running = 1
 *             c_filename = (_cstr(self._filename)
 *                           if self._filename is not None else NULL)             # <<<<<<<<<<<<<<
 * 
 *             # We have to give *mlCtxtResetPush() enough input to figure
*/
    __pyx_t_6 = (__pyx_v_self->__pyx_base._filename != ((PyObject*)Py_None));
    if (__pyx_t_6) {

      /* "src/lxml/parser.pxi":1411
 *             context.prepare(set_document_loader=False)
 *             self._feed_parser_running = 1
 *             c_filename = (_cstr(self._filename)             # <<<<<<<<<<<<<<
 *                           if self._filename is not None else NULL)
 * 
*/
      __pyx_t_1 = __pyx_v_self->__pyx_base._filename;
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_12 = PyBytes_AS_STRING(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else {

      /* "src/lxml/parser.pxi":1412
 *             self._feed_parser_running = 1
 *             c_filename = (_cstr(self._filename)
 *                           if self._filename is not None else NULL)             # <<<<<<<<<<<<<<
 * 
 *             # We have to give *mlCtxtResetPush() enough input to figure
*/
      __pyx_t_12 = NULL;
    }
    __pyx_v_c_filename = __pyx_t_12;

    /* "src/lxml/parser.pxi":1418
 *             # however if we give it all we got, we'll have nothing for
 *             # *mlParseChunk() and things go wrong.
 *             buffer_len = 0             # <<<<<<<<<<<<<<
 *             if char_data is not NULL:
 *                 buffer_len = 4 if py_buffer_len > 4 else <int>py_buffer_len
*/
    __pyx_v_buffer_len = 0;

    /* "src/lxml/parser.pxi":1419
 *             # *mlParseChunk() and things go wrong.
 *             buffer_len = 0
 *             if char_data is not NULL:             # <<<<<<<<<<<<<<
 *                 buffer_len = 4 if py_buffer_len > 4 else <int>py_buffer_len
 *             orig_loader = _register_document_loader()
*/
    __pyx_t_6 = (__pyx_v_char_data != NULL);
    if (__pyx_t_6) {

      /* "src/lxml/parser.pxi":1420
 *             buffer_len = 0
 *             if char_data is not NULL:
 *                 buffer_len = 4 if py_buffer_len > 4 else <int>py_buffer_len             # <<<<<<<<<<<<<<
 *             orig_loader = _register_document_loader()
 *             if self._for_html:
*/
      __pyx_t_6 = (__pyx_v_py_buffer_len > 4);
      if (__pyx_t_6) {
        __pyx_t_10 = 4;
      } else {
        __pyx_t_10 = ((int)__pyx_v_py_buffer_len);
      }
      __pyx_v_buffer_len = __pyx_t_10;

      /* "src/lxml/parser.pxi":1419
 *             # *mlParseChunk() and things go wrong.
 *             buffer_len = 0
 *             if char_data is not NULL:             # <<<<<<<<<<<<<<
 *                 buffer_len = 4 if py_buffer_len > 4 else <int>py_buffer_len
 *             orig_loader = _register_document_loader()
*/
    }

    /* "src/lxml/parser.pxi":1421
 *             if char_data is not NULL:
 *                 buffer_len = 4 if py_buffer_len > 4 else <int>py_buffer_len
 *             orig_loader = _register_document_loader()             # <<<<<<<<<<<<<<
 *             if self._for_html:
 *                 error = _htmlCtxtResetPush(
*/
    __pyx_v_orig_loader = __pyx_f_4lxml_5etree__register_document_loader();

    /* "src/lxml/parser.pxi":1422
 *                 buffer_len = 4 if py_buffer_len > 4 else <int>py_buffer_len
 *             orig_loader = _register_document_loader()
 *             if self._for_html:             # <<<<<<<<<<<<<<
 *                 error = _htmlCtxtResetPush(
 *                     pctxt, char_data, buffer_len, c_filename, c_encoding,
*/
    if (__pyx_v_self->__pyx_base._for_html) {

      /* "src/lxml/parser.pxi":1423
 *             orig_loader = _register_document_loader()
 *             if self._for_html:
 *                 error = _htmlCtxtResetPush(             # <<<<<<<<<<<<<<
 *                     pctxt, char_data, buffer_len, c_filename, c_encoding,
 *                     self._parse_options)
*/
      __pyx_t_10 = __pyx_f_4lxml_5etree__htmlCtxtResetPush(__pyx_v_pctxt, __pyx_v_char_data, __pyx_v_buffer_len, __pyx_v_c_filename, __pyx_v_c_encoding, __pyx_v_self->__pyx_base._parse_options); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(2, 1423, __pyx_L1_error)
      __pyx_v_error = __pyx_t_10;

      /* "src/lxml/parser.pxi":1422
 *                 buffer_len = 4 if py_buffer_len > 4 else <int>py_buffer_len
 *             orig_loader = _register_document_loader()
 *             if self._for_html:             # <<<<<<<<<<<<<<
 *                 error = _htmlCtxtResetPush(
 *                     pctxt, char_data, buffer_len, c_filename, c_encoding,
*/
      goto __pyx_L7;
    }

    /* "src/lxml/parser.pxi":1427
 *                     self._parse_options)
 *             else:
 *                 xmlparser.xmlCtxtUseOptions(pctxt, self._parse_options)             # <<<<<<<<<<<<<<
 *                 error = xmlparser.xmlCtxtResetPush(
 *                     pctxt, char_data, buffer_len, c_filename, c_encoding)
*/
    /*else*/ {
      (void)(xmlCtxtUseOptions(__pyx_v_pctxt, __pyx_v_self->__pyx_base._parse_options));

      /* "src/lxml/parser.pxi":1428
 *             else:
 *                 xmlparser.xmlCtxtUseOptions(pctxt, self._parse_options)
 *                 error = xmlparser.xmlCtxtResetPush(             # <<<<<<<<<<<<<<
 *                     pctxt, char_data, buffer_len, c_filename, c_encoding)
 *             _reset_document_loader(orig_loader)
*/
      __pyx_v_error = xmlCtxtResetPush(__pyx_v_pctxt, __pyx_v_char_data, __pyx_v_buffer_len, __pyx_v_c_filename, __pyx_v_c_encoding);
    }
    __pyx_L7:;

    /* "src/lxml/parser.pxi":1430
 *                 error = xmlparser.xmlCtxtResetPush(
 *                     pctxt, char_data, buffer_len, c_filename, c_encoding)
 *             _reset_document_loader(orig_loader)             # <<<<<<<<<<<<<<
 *             py_buffer_len -= buffer_len
 *             char_data += buffer_len
*/
    __pyx_f_4lxml_5etree__reset_document_loader(__pyx_v_orig_loader);

    /* "src/lxml/parser.pxi":1431
 *                     pctxt, char_data, buffer_len, c_filename, c_encoding)
 *             _reset_document_loader(orig_loader)
 *             py_buffer_len -= buffer_len             # <<<<<<<<<<<<<<
 *             char_data += buffer_len
 *             if error:
*/
    __pyx_v_py_buffer_len = (__pyx_v_py_buffer_len - __pyx_v_buffer_len);

    /* "src/lxml/parser.pxi":1432
 *             _reset_document_loader(orig_loader)
 *             py_buffer_len -= buffer_len
 *             char_data += buffer_len             # <<<<<<<<<<<<<<
 *             if error:
 *                 raise MemoryError()
*/
    __pyx_v_char_data = (__pyx_v_char_data + __pyx_v_buffer_len);

    /* "src/lxml/parser.pxi":1433
 *             py_buffer_len -= buffer_len
 *             char_data += buffer_len
 *             if error:             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
*/
    __pyx_t_6 = (__pyx_v_error != 0);
    if (unlikely(__pyx_t_6)) {

      /* "src/lxml/parser.pxi":1434
 *             char_data += buffer_len
 *             if error:
 *                 raise MemoryError()             # <<<<<<<<<<<<<<
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
 * 
*/
      PyErr_NoMemory(); __PYX_ERR(2, 1434, __pyx_L1_error)

      /* "src/lxml/parser.pxi":1433
 *             py_buffer_len -= buffer_len
 *             char_data += buffer_len
 *             if error:             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
*/
    }

    /* "src/lxml/parser.pxi":1435
 *             if error:
 *                 raise MemoryError()
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)             # <<<<<<<<<<<<<<
 * 
 *         #print pctxt.charset, 'NONE' if c_encoding is NULL else c_encoding
*/
    __pyx_t_10 = __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initParserDict(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, __pyx_v_pctxt); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(2, 1435, __pyx_L1_error)

    /* "src/lxml/parser.pxi":1408
 *         pctxt = context._c_ctxt
 *         error = 0
 *         if not self._feed_parser_running:             # <<<<<<<<<<<<<<
 *             context.prepare(set_document_loader=False)
 *             self._feed_parser_running = 1
*/
  }

  /* "src/lxml/parser.pxi":1439
 *         #print pctxt.charset, 'NONE' if c_encoding is NULL else c_encoding
 * 
 *         fixup_error = 0             # <<<<<<<<<<<<<<
 *         while py_buffer_len > 0 and (error == 0 or recover):
 *             if char_data is NULL:
*/
  __pyx_v_fixup_error = 0;

  /* "src/lxml/parser.pxi":1440
 * 
 *         fixup_error = 0
 *         while py_buffer_len > 0 and (error == 0 or recover):             # <<<<<<<<<<<<<<
 *             if char_data is NULL:
 *                 # Unicode parsing by converting chunks to UTF-8
*/
  while (1) {
    __pyx_t_13 = (__pyx_v_py_buffer_len > 0);
    if (__pyx_t_13) {
    } else {
      __pyx_t_6 = __pyx_t_13;
      goto __pyx_L11_bool_binop_done;
    }
    __pyx_t_13 = (__pyx_v_error == 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_6 = __pyx_t_13;
      goto __pyx_L11_bool_binop_done;
    }
    __pyx_t_6 = __pyx_v_recover;
    __pyx_L11_bool_binop_done:;
    if (!__pyx_t_6) break;

    /* "src/lxml/parser.pxi":1441
 *         fixup_error = 0
 *         while py_buffer_len > 0 and (error == 0 or recover):
 *             if char_data is NULL:             # <<<<<<<<<<<<<<
 *                 # Unicode parsing by converting chunks to UTF-8
 *                 buffer_len = 2**19  # len(bytes) <= 4 * (2**19) == 2 MiB
*/
    __pyx_t_6 = (__pyx_v_char_data == NULL);
    if (__pyx_t_6) {

      /* "src/lxml/parser.pxi":1443
 *             if char_data is NULL:
 *                 # Unicode parsing by converting chunks to UTF-8
 *                 buffer_len = 2**19  # len(bytes) <= 4 * (2**19) == 2 MiB             # <<<<<<<<<<<<<<
 *                 bstring = (<unicode> data)[ustart : ustart+buffer_len].encode('UTF-8')
 *                 ustart += buffer_len
*/
      __pyx_v_buffer_len = 0x80000;

      /* "src/lxml/parser.pxi":1444
 *                 # Unicode parsing by converting chunks to UTF-8
 *                 buffer_len = 2**19  # len(bytes) <= 4 * (2**19) == 2 MiB
 *                 bstring = (<unicode> data)[ustart : ustart+buffer_len].encode('UTF-8')             # <<<<<<<<<<<<<<
 *                 ustart += buffer_len
 *                 py_buffer_len -= buffer_len  # may end up < 0
*/
      if (unlikely(__pyx_v_data == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(2, 1444, __pyx_L1_error)
      }
      __pyx_t_1 = __Pyx_PyUnicode_Substring(((PyObject*)__pyx_v_data), __pyx_v_ustart, (__pyx_v_ustart + __pyx_v_buffer_len)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1444, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = PyUnicode_AsUTF8String(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1444, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF_SET(__pyx_v_bstring, ((PyObject*)__pyx_t_2));
      __pyx_t_2 = 0;

      /* "src/lxml/parser.pxi":1445
 *                 buffer_len = 2**19  # len(bytes) <= 4 * (2**19) == 2 MiB
 *                 bstring = (<unicode> data)[ustart : ustart+buffer_len].encode('UTF-8')
 *                 ustart += buffer_len             # <<<<<<<<<<<<<<
 *                 py_buffer_len -= buffer_len  # may end up < 0
 *                 error, fixup_error = _parse_data_chunk(pctxt, <const char*> bstring, <int> len(bstring))
*/
      __pyx_v_ustart = (__pyx_v_ustart + __pyx_v_buffer_len);

      /* "src/lxml/parser.pxi":1446
 *                 bstring = (<unicode> data)[ustart : ustart+buffer_len].encode('UTF-8')
 *                 ustart += buffer_len
 *                 py_buffer_len -= buffer_len  # may end up < 0             # <<<<<<<<<<<<<<
 *                 error, fixup_error = _parse_data_chunk(pctxt, <const char*> bstring, <int> len(bstring))
 *             else:
*/
      __pyx_v_py_buffer_len = (__pyx_v_py_buffer_len - __pyx_v_buffer_len);

      /* "src/lxml/parser.pxi":1447
 *                 ustart += buffer_len
 *                 py_buffer_len -= buffer_len  # may end up < 0
 *                 error, fixup_error = _parse_data_chunk(pctxt, <const char*> bstring, <int> len(bstring))             # <<<<<<<<<<<<<<
 *             else:
 *                 # Direct byte string parsing.
*/
      __pyx_t_14 = __Pyx_PyBytes_AsString(__pyx_v_bstring); if (unlikely((!__pyx_t_14) && PyErr_Occurred())) __PYX_ERR(2, 1447, __pyx_L1_error)
      __pyx_t_8 = __Pyx_PyBytes_GET_SIZE(__pyx_v_bstring); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(2, 1447, __pyx_L1_error)
      __pyx_t_15 = __pyx_f_4lxml_5etree__parse_data_chunk(__pyx_v_pctxt, ((char const *)__pyx_t_14), ((int)__pyx_t_8)); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 1447, __pyx_L1_error)
      __pyx_t_10 = __pyx_t_15.f0;
      __pyx_t_16 = __pyx_t_15.f1;
      __pyx_v_error = __pyx_t_10;
      __pyx_v_fixup_error = __pyx_t_16;

      /* "src/lxml/parser.pxi":1441
 *         fixup_error = 0
 *         while py_buffer_len > 0 and (error == 0 or recover):
 *             if char_data is NULL:             # <<<<<<<<<<<<<<
 *                 # Unicode parsing by converting chunks to UTF-8
 *                 buffer_len = 2**19  # len(bytes) <= 4 * (2**19) == 2 MiB
*/
      goto __pyx_L14;
    }

    /* "src/lxml/parser.pxi":1450
 *             else:
 *                 # Direct byte string parsing.
 *                 buffer_len = <int>py_buffer_len if py_buffer_len <= limits.INT_MAX else limits.INT_MAX             # <<<<<<<<<<<<<<
 *                 error, fixup_error = _parse_data_chunk(pctxt, char_data, buffer_len)
 *                 py_buffer_len -= buffer_len
*/
    /*else*/ {
      __pyx_t_6 = (__pyx_v_py_buffer_len <= INT_MAX);
      if (__pyx_t_6) {
        __pyx_t_16 = ((int)__pyx_v_py_buffer_len);
      } else {
        __pyx_t_16 = INT_MAX;
      }
      __pyx_v_buffer_len = __pyx_t_16;

      /* "src/lxml/parser.pxi":1451
 *                 # Direct byte string parsing.
 *                 buffer_len = <int>py_buffer_len if py_buffer_len <= limits.INT_MAX else limits.INT_MAX
 *                 error, fixup_error = _parse_data_chunk(pctxt, char_data, buffer_len)             # <<<<<<<<<<<<<<
 *                 py_buffer_len -= buffer_len
 *                 char_data += buffer_len
*/
      __pyx_t_15 = __pyx_f_4lxml_5etree__parse_data_chunk(__pyx_v_pctxt, __pyx_v_char_data, __pyx_v_buffer_len); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 1451, __pyx_L1_error)
      __pyx_t_16 = __pyx_t_15.f0;
      __pyx_t_10 = __pyx_t_15.f1;
      __pyx_v_error = __pyx_t_16;
      __pyx_v_fixup_error = __pyx_t_10;

      /* "src/lxml/parser.pxi":1452
 *                 buffer_len = <int>py_buffer_len if py_buffer_len <= limits.INT_MAX else limits.INT_MAX
 *                 error, fixup_error = _parse_data_chunk(pctxt, char_data, buffer_len)
 *                 py_buffer_len -= buffer_len             # <<<<<<<<<<<<<<
 *                 char_data += buffer_len
 * 
*/
      __pyx_v_py_buffer_len = (__pyx_v_py_buffer_len - __pyx_v_buffer_len);

      /* "src/lxml/parser.pxi":1453
 *                 error, fixup_error = _parse_data_chunk(pctxt, char_data, buffer_len)
 *                 py_buffer_len -= buffer_len
 *                 char_data += buffer_len             # <<<<<<<<<<<<<<
 * 
 *             if fixup_error:
*/
      __pyx_v_char_data = (__pyx_v_char_data + __pyx_v_buffer_len);
    }
    __pyx_L14:;

    /* "src/lxml/parser.pxi":1455
 *                 char_data += buffer_len
 * 
 *             if fixup_error:             # <<<<<<<<<<<<<<
 *                 context.store_exception(MemoryError())
 * 
*/
    __pyx_t_6 = (__pyx_v_fixup_error != 0);
    if (__pyx_t_6) {

      /* "src/lxml/parser.pxi":1456
 * 
 *             if fixup_error:
 *                 context.store_exception(MemoryError())             # <<<<<<<<<<<<<<
 * 
 *             if context._has_raised():
*/
      __pyx_t_1 = ((PyObject *)__pyx_v_context);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = NULL;
      __pyx_t_5 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
        __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_MemoryError)), __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1456, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
      }
      __pyx_t_5 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_4};
        __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_store_exception, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1456, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "src/lxml/parser.pxi":1455
 *                 char_data += buffer_len
 * 
 *             if fixup_error:             # <<<<<<<<<<<<<<
 *                 context.store_exception(MemoryError())
 * 
*/
    }

    /* "src/lxml/parser.pxi":1458
 *                 context.store_exception(MemoryError())
 * 
 *             if context._has_raised():             # <<<<<<<<<<<<<<
 *                 # propagate Python exceptions immediately
 *                 recover = 0
*/
    __pyx_t_6 = __pyx_f_4lxml_5etree_17_ExceptionContext__has_raised(((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_v_context)); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 1458, __pyx_L1_error)
    if (__pyx_t_6) {

      /* "src/lxml/parser.pxi":1460
 *             if context._has_raised():
 *                 # propagate Python exceptions immediately
 *                 recover = 0             # <<<<<<<<<<<<<<
 *                 error = 1
 *                 break
*/
      __pyx_v_recover = 0;

      /* "src/lxml/parser.pxi":1461
 *                 # propagate Python exceptions immediately
 *                 recover = 0
 *                 error = 1             # <<<<<<<<<<<<<<
 *                 break
 * 
*/
      __pyx_v_error = 1;

      /* "src/lxml/parser.pxi":1462
 *                 recover = 0
 *                 error = 1
 *                 break             # <<<<<<<<<<<<<<
 * 
 *             if error and not pctxt.replaceEntities and not pctxt.validate:
*/
      goto __pyx_L10_break;

      /* "src/lxml/parser.pxi":1458
 *                 context.store_exception(MemoryError())
 * 
 *             if context._has_raised():             # <<<<<<<<<<<<<<
 *                 # propagate Python exceptions immediately
 *                 recover = 0
*/
    }

    /* "src/lxml/parser.pxi":1464
 *                 break
 * 
 *             if error and not pctxt.replaceEntities and not pctxt.validate:             # <<<<<<<<<<<<<<
 *                 # in this mode, we ignore errors about undefined entities
 *                 for entry in context._error_log.filter_from_errors():
*/
    __pyx_t_13 = (__pyx_v_error != 0);
    if (__pyx_t_13) {
    } else {
      __pyx_t_6 = __pyx_t_13;
      goto __pyx_L18_bool_binop_done;
    }
    __pyx_t_13 = (!__pyx_v_pctxt->replaceEntities);
    if (__pyx_t_13) {
    } else {
      __pyx_t_6 = __pyx_t_13;
      goto __pyx_L18_bool_binop_done;
    }
    __pyx_t_13 = (!__pyx_v_pctxt->validate);
    __pyx_t_6 = __pyx_t_13;
    __pyx_L18_bool_binop_done:;
    if (__pyx_t_6) {

      /* "src/lxml/parser.pxi":1466
 *             if error and not pctxt.replaceEntities and not pctxt.validate:
 *                 # in this mode, we ignore errors about undefined entities
 *                 for entry in context._error_log.filter_from_errors():             # <<<<<<<<<<<<<<
 *                     if entry.type != ErrorTypes.WAR_UNDECLARED_ENTITY and \
 *                            entry.type != ErrorTypes.ERR_UNDECLARED_ENTITY:
*/
      __pyx_t_4 = ((PyObject *)__pyx_v_context->_error_log);
      __Pyx_INCREF(__pyx_t_4);
      __pyx_t_5 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
        __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_filter_from_errors, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1466, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
        __pyx_t_4 = __pyx_t_2; __Pyx_INCREF(__pyx_t_4);
        __pyx_t_8 = 0;
        __pyx_t_17 = NULL;
      } else {
        __pyx_t_8 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1466, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_17 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_17)) __PYX_ERR(2, 1466, __pyx_L1_error)
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      for (;;) {
        if (likely(!__pyx_t_17)) {
          if (likely(PyList_CheckExact(__pyx_t_4))) {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_4);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(2, 1466, __pyx_L1_error)
              #endif
              if (__pyx_t_8 >= __pyx_temp) break;
            }
            __pyx_t_2 = __Pyx_PyList_GetItemRefFast(__pyx_t_4, __pyx_t_8, __Pyx_ReferenceSharing_OwnStrongReference);
            ++__pyx_t_8;
          } else {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(2, 1466, __pyx_L1_error)
              #endif
              if (__pyx_t_8 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_2 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_8));
            #else
            __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_8);
            #endif
            ++__pyx_t_8;
          }
          if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1466, __pyx_L1_error)
        } else {
          __pyx_t_2 = __pyx_t_17(__pyx_t_4);
          if (unlikely(!__pyx_t_2)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(2, 1466, __pyx_L1_error)
              PyErr_Clear();
            }
            break;
          }
        }
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_XDECREF_SET(__pyx_v_entry, __pyx_t_2);
        __pyx_t_2 = 0;

        /* "src/lxml/parser.pxi":1467
 *                 # in this mode, we ignore errors about undefined entities
 *                 for entry in context._error_log.filter_from_errors():
 *                     if entry.type != ErrorTypes.WAR_UNDECLARED_ENTITY and \             # <<<<<<<<<<<<<<
 *                            entry.type != ErrorTypes.ERR_UNDECLARED_ENTITY:
 *                         break
*/
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_entry, __pyx_mstate_global->__pyx_n_u_type); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1467, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_ErrorTypes); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1467, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_WAR_UNDECLARED_ENTITY); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1467, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1467, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_13 < 0))) __PYX_ERR(2, 1467, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (__pyx_t_13) {
        } else {
          __pyx_t_6 = __pyx_t_13;
          goto __pyx_L24_bool_binop_done;
        }

        /* "src/lxml/parser.pxi":1468
 *                 for entry in context._error_log.filter_from_errors():
 *                     if entry.type != ErrorTypes.WAR_UNDECLARED_ENTITY and \
 *                            entry.type != ErrorTypes.ERR_UNDECLARED_ENTITY:             # <<<<<<<<<<<<<<
 *                         break
 *                 else:
*/
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_entry, __pyx_mstate_global->__pyx_n_u_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1468, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_ErrorTypes); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1468, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_ERR_UNDECLARED_ENTITY); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1468, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1468, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_13 < 0))) __PYX_ERR(2, 1468, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_6 = __pyx_t_13;
        __pyx_L24_bool_binop_done:;

        /* "src/lxml/parser.pxi":1467
 *                 # in this mode, we ignore errors about undefined entities
 *                 for entry in context._error_log.filter_from_errors():
 *                     if entry.type != ErrorTypes.WAR_UNDECLARED_ENTITY and \             # <<<<<<<<<<<<<<
 *                            entry.type != ErrorTypes.ERR_UNDECLARED_ENTITY:
 *                         break
*/
        if (__pyx_t_6) {

          /* "src/lxml/parser.pxi":1469
 *                     if entry.type != ErrorTypes.WAR_UNDECLARED_ENTITY and \
 *                            entry.type != ErrorTypes.ERR_UNDECLARED_ENTITY:
 *                         break             # <<<<<<<<<<<<<<
 *                 else:
 *                     error = 0
*/
          goto __pyx_L22_break;

          /* "src/lxml/parser.pxi":1467
 *                 # in this mode, we ignore errors about undefined entities
 *                 for entry in context._error_log.filter_from_errors():
 *                     if entry.type != ErrorTypes.WAR_UNDECLARED_ENTITY and \             # <<<<<<<<<<<<<<
 *                            entry.type != ErrorTypes.ERR_UNDECLARED_ENTITY:
 *                         break
*/
        }

        /* "src/lxml/parser.pxi":1466
 *             if error and not pctxt.replaceEntities and not pctxt.validate:
 *                 # in this mode, we ignore errors about undefined entities
 *                 for entry in context._error_log.filter_from_errors():             # <<<<<<<<<<<<<<
 *                     if entry.type != ErrorTypes.WAR_UNDECLARED_ENTITY and \
 *                            entry.type != ErrorTypes.ERR_UNDECLARED_ENTITY:
*/
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L26_for_else;
      __pyx_L22_break:;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L27_for_end;
      /*else*/ {
        __pyx_L26_for_else:;

        /* "src/lxml/parser.pxi":1471
 *                         break
 *                 else:
 *                     error = 0             # <<<<<<<<<<<<<<
 * 
 *         if not pctxt.wellFormed and xmlparser.xmlCtxtIsStopped(pctxt) and context._has_raised():
*/
        __pyx_v_error = 0;
      }
      __pyx_L27_for_end:;

      /* "src/lxml/parser.pxi":1464
 *                 break
 * 
 *             if error and not pctxt.replaceEntities and not pctxt.validate:             # <<<<<<<<<<<<<<
 *                 # in this mode, we ignore errors about undefined entities
 *                 for entry in context._error_log.filter_from_errors():
*/
    }
  }
  __pyx_L10_break:;

  /* "src/lxml/parser.pxi":1473
 *                     error = 0
 * 
 *         if not pctxt.wellFormed and xmlparser.xmlCtxtIsStopped(pctxt) and context._has_raised():             # <<<<<<<<<<<<<<
 *             # propagate Python exceptions immediately
 *             recover = 0
*/
  __pyx_t_13 = (!__pyx_v_pctxt->wellFormed);
  if (__pyx_t_13) {
  } else {
    __pyx_t_6 = __pyx_t_13;
    goto __pyx_L29_bool_binop_done;
  }
  __pyx_t_13 = xmlCtxtIsStopped(__pyx_v_pctxt);
  if (__pyx_t_13) {
  } else {
    __pyx_t_6 = __pyx_t_13;
    goto __pyx_L29_bool_binop_done;
  }
  __pyx_t_13 = __pyx_f_4lxml_5etree_17_ExceptionContext__has_raised(((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_v_context)); if (unlikely(__pyx_t_13 == ((int)-1))) __PYX_ERR(2, 1473, __pyx_L1_error)
  __pyx_t_6 = __pyx_t_13;
  __pyx_L29_bool_binop_done:;
  if (__pyx_t_6) {

    /* "src/lxml/parser.pxi":1475
 *         if not pctxt.wellFormed and xmlparser.xmlCtxtIsStopped(pctxt) and context._has_raised():
 *             # propagate Python exceptions immediately
 *             recover = 0             # <<<<<<<<<<<<<<
 *             error = 1
 * 
*/
    __pyx_v_recover = 0;

    /* "src/lxml/parser.pxi":1476
 *             # propagate Python exceptions immediately
 *             recover = 0
 *             error = 1             # <<<<<<<<<<<<<<
 * 
 *         if fixup_error or not recover and (error or not pctxt.wellFormed):
*/
    __pyx_v_error = 1;

    /* "src/lxml/parser.pxi":1473
 *                     error = 0
 * 
 *         if not pctxt.wellFormed and xmlparser.xmlCtxtIsStopped(pctxt) and context._has_raised():             # <<<<<<<<<<<<<<
 *             # propagate Python exceptions immediately
 *             recover = 0
*/
  }

  /* "src/lxml/parser.pxi":1478
 *             error = 1
 * 
 *         if fixup_error or not recover and (error or not pctxt.wellFormed):             # <<<<<<<<<<<<<<
 *             self._feed_parser_running = 0
 *             try:
*/
  __pyx_t_13 = (__pyx_v_fixup_error != 0);
  if (!__pyx_t_13) {
  } else {
    __pyx_t_6 = __pyx_t_13;
    goto __pyx_L33_bool_binop_done;
  }
  __pyx_t_13 = (!__pyx_v_recover);
  if (__pyx_t_13) {
  } else {
    __pyx_t_6 = __pyx_t_13;
    goto __pyx_L33_bool_binop_done;
  }
  __pyx_t_13 = (__pyx_v_error != 0);
  if (!__pyx_t_13) {
  } else {
    __pyx_t_6 = __pyx_t_13;
    goto __pyx_L33_bool_binop_done;
  }
  __pyx_t_13 = (!__pyx_v_pctxt->wellFormed);
  __pyx_t_6 = __pyx_t_13;
  __pyx_L33_bool_binop_done:;
  if (__pyx_t_6) {

    /* "src/lxml/parser.pxi":1479
 * 
 *         if fixup_error or not recover and (error or not pctxt.wellFormed):
 *             self._feed_parser_running = 0             # <<<<<<<<<<<<<<
 *             try:
 *                 context._handleParseResult(self, pctxt.myDoc, None)
*/
    __pyx_v_self->_feed_parser_running = 0;

    /* "src/lxml/parser.pxi":1480
 *         if fixup_error or not recover and (error or not pctxt.wellFormed):
 *             self._feed_parser_running = 0
 *             try:             # <<<<<<<<<<<<<<
 *                 context._handleParseResult(self, pctxt.myDoc, None)
 *             finally:
*/
    /*try:*/ {

      /* "src/lxml/parser.pxi":1481
 *             self._feed_parser_running = 0
 *             try:
 *                 context._handleParseResult(self, pctxt.myDoc, None)             # <<<<<<<<<<<<<<
 *             finally:
 *                 context.cleanup()
*/
      __pyx_t_4 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->_handleParseResult(__pyx_v_context, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self), __pyx_v_pctxt->myDoc, Py_None); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1481, __pyx_L38_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }

    /* "src/lxml/parser.pxi":1483
 *                 context._handleParseResult(self, pctxt.myDoc, None)
 *             finally:
 *                 context.cleanup()             # <<<<<<<<<<<<<<
 * 
 *     cpdef close(self):
*/
    /*finally:*/ {
      /*normal exit:*/{
        __pyx_t_10 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->cleanup(__pyx_v_context); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(2, 1483, __pyx_L1_error)
        goto __pyx_L39;
      }
      __pyx_L38_error:;
      /*exception exit:*/{
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
         __Pyx_ExceptionSwap(&__pyx_t_22, &__pyx_t_23, &__pyx_t_24);
        if ( unlikely(__Pyx_GetException(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21) < 0)) __Pyx_ErrFetch(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21);
        __Pyx_XGOTREF(__pyx_t_19);
        __Pyx_XGOTREF(__pyx_t_20);
        __Pyx_XGOTREF(__pyx_t_21);
        __Pyx_XGOTREF(__pyx_t_22);
        __Pyx_XGOTREF(__pyx_t_23);
        __Pyx_XGOTREF(__pyx_t_24);
        __pyx_t_10 = __pyx_lineno; __pyx_t_16 = __pyx_clineno; __pyx_t_18 = __pyx_filename;
        {
          __pyx_t_25 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->cleanup(__pyx_v_context); if (unlikely(__pyx_t_25 == ((int)-1))) __PYX_ERR(2, 1483, __pyx_L41_error)
        }
        __Pyx_XGIVEREF(__pyx_t_22);
        __Pyx_XGIVEREF(__pyx_t_23);
        __Pyx_XGIVEREF(__pyx_t_24);
        __Pyx_ExceptionReset(__pyx_t_22, __pyx_t_23, __pyx_t_24);
        __Pyx_XGIVEREF(__pyx_t_19);
        __Pyx_XGIVEREF(__pyx_t_20);
        __Pyx_XGIVEREF(__pyx_t_21);
        __Pyx_ErrRestore(__pyx_t_19, __pyx_t_20, __pyx_t_21);
        __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0;
        __pyx_lineno = __pyx_t_10; __pyx_clineno = __pyx_t_16; __pyx_filename = __pyx_t_18;
        goto __pyx_L1_error;
        __pyx_L41_error:;
        __Pyx_XGIVEREF(__pyx_t_22);
        __Pyx_XGIVEREF(__pyx_t_23);
        __Pyx_XGIVEREF(__pyx_t_24);
        __Pyx_ExceptionReset(__pyx_t_22, __pyx_t_23, __pyx_t_24);
        __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
        __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
        __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
        __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0;
        goto __pyx_L1_error;
      }
      __pyx_L39:;
    }

    /* "src/lxml/parser.pxi":1478
 *             error = 1
 * 
 *         if fixup_error or not recover and (error or not pctxt.wellFormed):             # <<<<<<<<<<<<<<
 *             self._feed_parser_running = 0
 *             try:
*/
  }

  /* "src/lxml/parser.pxi":1361
 *         return self._getPushParserContext()._error_log.copy()
 * 
 *     cpdef feed(self, data):             # <<<<<<<<<<<<<<
 *         """feed(self, data)
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._FeedParser.feed", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_bstring);
  __Pyx_XDECREF(__pyx_v_entry);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_11_FeedParser_1feed(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_11_FeedParser_feed, "feed(self, data)\n\n        Feeds data to the parser.  The argument should be an 8-bit string\n        buffer containing encoded data, although Unicode is supported as long\n        as both string types are not mixed.\n\n        This is the main entry point to the consumer interface of a\n        parser.  The parser will parse as much of the XML stream as it\n        can on each call.  To finish parsing or to reset the parser,\n        call the ``close()`` method.  Both methods may raise\n        ParseError if errors occur in the input data.  If an error is\n        raised, there is no longer a need to call ``close()``.\n\n        The feed parser interface is independent of the normal parser\n        usage.  You can use the same parser as a feed parser and in\n        the ``parse()`` function concurrently.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_11_FeedParser_1feed = {"feed", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_11_FeedParser_1feed, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_11_FeedParser_feed};
static PyObject *__pyx_pw_4lxml_5etree_11_FeedParser_1feed(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_data = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("feed (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_data,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(2, 1361, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(2, 1361, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "feed", 0) < (0)) __PYX_ERR(2, 1361, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("feed", 1, 1, 1, i); __PYX_ERR(2, 1361, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(2, 1361, __pyx_L3_error)
    }
    __pyx_v_data = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("feed", 1, 1, 1, __pyx_nargs); __PYX_ERR(2, 1361, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._FeedParser.feed", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_11_FeedParser_feed(((struct __pyx_obj_4lxml_5etree__FeedParser *)__pyx_v_self), __pyx_v_data);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_11_FeedParser_feed(struct __pyx_obj_4lxml_5etree__FeedParser *__pyx_v_self, PyObject *__pyx_v_data) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("feed", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree_11_FeedParser_feed(__pyx_v_self, __pyx_v_data, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1361, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._FeedParser.feed", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":1485
 *                 context.cleanup()
 * 
 *     cpdef close(self):             # <<<<<<<<<<<<<<
 *         """close(self)
 * 
*/

static PyObject *__pyx_pw_4lxml_5etree_11_FeedParser_3close(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_4lxml_5etree_11_FeedParser_close(struct __pyx_obj_4lxml_5etree__FeedParser *__pyx_v_self, int __pyx_skip_dispatch) {
  struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_context = NULL;
  xmlParserCtxt *__pyx_v_pctxt;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_t_6;
  xmlParserCtxt *__pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  char const *__pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  int __pyx_t_18;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("close", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (
  #if !CYTHON_USE_TYPE_SLOTS
  unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_4lxml_5etree__FeedParser &&
  __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
  #else
  unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
  #endif
  ) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_close); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1485, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_4lxml_5etree_11_FeedParser_3close)) {
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_3 = NULL;
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_4 = __pyx_t_1; 
        __pyx_t_5 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
          assert(__pyx_t_3);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
          __pyx_t_5 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
          __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1485, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
        }
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "src/lxml/parser.pxi":1496
 *         parser interface, all other usage is undefined.
 *         """
 *         if not self._feed_parser_running:             # <<<<<<<<<<<<<<
 *             raise XMLSyntaxError("no element found",
 *                                  xmlerror.XML_ERR_INTERNAL_ERROR, 0, 0,
*/
  __pyx_t_6 = (!__pyx_v_self->_feed_parser_running);
  if (unlikely(__pyx_t_6)) {

    /* "src/lxml/parser.pxi":1497
 *         """
 *         if not self._feed_parser_running:
 *             raise XMLSyntaxError("no element found",             # <<<<<<<<<<<<<<
 *                                  xmlerror.XML_ERR_INTERNAL_ERROR, 0, 0,
 *                                  self._filename)
*/
    __pyx_t_2 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_XMLSyntaxError); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1497, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);

    /* "src/lxml/parser.pxi":1498
 *         if not self._feed_parser_running:
 *             raise XMLSyntaxError("no element found",
 *                                  xmlerror.XML_ERR_INTERNAL_ERROR, 0, 0,             # <<<<<<<<<<<<<<
 *                                  self._filename)
 * 
*/
    __pyx_t_3 = __Pyx_PyLong_From_xmlParserErrors(XML_ERR_INTERNAL_ERROR); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1498, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);

    /* "src/lxml/parser.pxi":1499
 *             raise XMLSyntaxError("no element found",
 *                                  xmlerror.XML_ERR_INTERNAL_ERROR, 0, 0,
 *                                  self._filename)             # <<<<<<<<<<<<<<
 * 
 *         context = self._getPushParserContext()
*/
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[6] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_no_element_found, __pyx_t_3, __pyx_mstate_global->__pyx_int_0, __pyx_mstate_global->__pyx_int_0, __pyx_v_self->__pyx_base._filename};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (6-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1497, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(2, 1497, __pyx_L1_error)

    /* "src/lxml/parser.pxi":1496
 *         parser interface, all other usage is undefined.
 *         """
 *         if not self._feed_parser_running:             # <<<<<<<<<<<<<<
 *             raise XMLSyntaxError("no element found",
 *                                  xmlerror.XML_ERR_INTERNAL_ERROR, 0, 0,
*/
  }

  /* "src/lxml/parser.pxi":1501
 *                                  self._filename)
 * 
 *         context = self._getPushParserContext()             # <<<<<<<<<<<<<<
 *         pctxt = context._c_ctxt
 * 
*/
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__FeedParser *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._getPushParserContext(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self))); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1501, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/parser.pxi":1502
 * 
 *         context = self._getPushParserContext()
 *         pctxt = context._c_ctxt             # <<<<<<<<<<<<<<
 * 
 *         self._feed_parser_running = 0
*/
  __pyx_t_7 = __pyx_v_context->_c_ctxt;
  __pyx_v_pctxt = __pyx_t_7;

  /* "src/lxml/parser.pxi":1504
 *         pctxt = context._c_ctxt
 * 
 *         self._feed_parser_running = 0             # <<<<<<<<<<<<<<
 *         if self._for_html:
 *             htmlparser.htmlParseChunk(pctxt, NULL, 0, 1)
*/
  __pyx_v_self->_feed_parser_running = 0;

  /* "src/lxml/parser.pxi":1505
 * 
 *         self._feed_parser_running = 0
 *         if self._for_html:             # <<<<<<<<<<<<<<
 *             htmlparser.htmlParseChunk(pctxt, NULL, 0, 1)
 *         else:
*/
  if (__pyx_v_self->__pyx_base._for_html) {

    /* "src/lxml/parser.pxi":1506
 *         self._feed_parser_running = 0
 *         if self._for_html:
 *             htmlparser.htmlParseChunk(pctxt, NULL, 0, 1)             # <<<<<<<<<<<<<<
 *         else:
 *             xmlparser.xmlParseChunk(pctxt, NULL, 0, 1)
*/
    (void)(htmlParseChunk(__pyx_v_pctxt, NULL, 0, 1));

    /* "src/lxml/parser.pxi":1505
 * 
 *         self._feed_parser_running = 0
 *         if self._for_html:             # <<<<<<<<<<<<<<
 *             htmlparser.htmlParseChunk(pctxt, NULL, 0, 1)
 *         else:
*/
    goto __pyx_L4;
  }

  /* "src/lxml/parser.pxi":1508
 *             htmlparser.htmlParseChunk(pctxt, NULL, 0, 1)
 *         else:
 *             xmlparser.xmlParseChunk(pctxt, NULL, 0, 1)             # <<<<<<<<<<<<<<
 * 
 *         if (pctxt.recovery and not xmlparser.xmlCtxtIsStopped(pctxt) and
*/
  /*else*/ {
    (void)(xmlParseChunk(__pyx_v_pctxt, NULL, 0, 1));
  }
  __pyx_L4:;

  /* "src/lxml/parser.pxi":1510
 *             xmlparser.xmlParseChunk(pctxt, NULL, 0, 1)
 * 
 *         if (pctxt.recovery and not xmlparser.xmlCtxtIsStopped(pctxt) and             # <<<<<<<<<<<<<<
 *                 isinstance(context, _SaxParserContext)):
 *             # apply any left-over 'end' events
*/
  if (__pyx_v_pctxt->recovery) {
  } else {
    __pyx_t_6 = __pyx_v_pctxt->recovery;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_8 = (!xmlCtxtIsStopped(__pyx_v_pctxt));
  if (__pyx_t_8) {
  } else {
    __pyx_t_6 = __pyx_t_8;
    goto __pyx_L6_bool_binop_done;
  }

  /* "src/lxml/parser.pxi":1511
 * 
 *         if (pctxt.recovery and not xmlparser.xmlCtxtIsStopped(pctxt) and
 *                 isinstance(context, _SaxParserContext)):             # <<<<<<<<<<<<<<
 *             # apply any left-over 'end' events
 *             (<_SaxParserContext>context).flushEvents()
*/
  __pyx_t_8 = __Pyx_TypeCheck(((PyObject *)__pyx_v_context), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__SaxParserContext); 
  __pyx_t_6 = __pyx_t_8;
  __pyx_L6_bool_binop_done:;

  /* "src/lxml/parser.pxi":1510
 *             xmlparser.xmlParseChunk(pctxt, NULL, 0, 1)
 * 
 *         if (pctxt.recovery and not xmlparser.xmlCtxtIsStopped(pctxt) and             # <<<<<<<<<<<<<<
 *                 isinstance(context, _SaxParserContext)):
 *             # apply any left-over 'end' events
*/
  if (__pyx_t_6) {

    /* "src/lxml/parser.pxi":1513
 *                 isinstance(context, _SaxParserContext)):
 *             # apply any left-over 'end' events
 *             (<_SaxParserContext>context).flushEvents()             # <<<<<<<<<<<<<<
 * 
 *         try:
*/
    __pyx_t_9 = ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext *)((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_v_context)->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->flushEvents(((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_v_context)); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 1513, __pyx_L1_error)

    /* "src/lxml/parser.pxi":1510
 *             xmlparser.xmlParseChunk(pctxt, NULL, 0, 1)
 * 
 *         if (pctxt.recovery and not xmlparser.xmlCtxtIsStopped(pctxt) and             # <<<<<<<<<<<<<<
 *                 isinstance(context, _SaxParserContext)):
 *             # apply any left-over 'end' events
*/
  }

  /* "src/lxml/parser.pxi":1515
 *             (<_SaxParserContext>context).flushEvents()
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             result = context._handleParseResult(self, pctxt.myDoc, None)
 *         finally:
*/
  /*try:*/ {

    /* "src/lxml/parser.pxi":1516
 * 
 *         try:
 *             result = context._handleParseResult(self, pctxt.myDoc, None)             # <<<<<<<<<<<<<<
 *         finally:
 *             context.cleanup()
*/
    __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->_handleParseResult(__pyx_v_context, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self), __pyx_v_pctxt->myDoc, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1516, __pyx_L10_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_result = __pyx_t_1;
    __pyx_t_1 = 0;
  }

  /* "src/lxml/parser.pxi":1518
 *             result = context._handleParseResult(self, pctxt.myDoc, None)
 *         finally:
 *             context.cleanup()             # <<<<<<<<<<<<<<
 * 
 *         if isinstance(result, _Document):
*/
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_t_9 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->cleanup(__pyx_v_context); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 1518, __pyx_L1_error)
      goto __pyx_L11;
    }
    __pyx_L10_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17);
      if ( unlikely(__Pyx_GetException(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14) < 0)) __Pyx_ErrFetch(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_14);
      __Pyx_XGOTREF(__pyx_t_15);
      __Pyx_XGOTREF(__pyx_t_16);
      __Pyx_XGOTREF(__pyx_t_17);
      __pyx_t_9 = __pyx_lineno; __pyx_t_10 = __pyx_clineno; __pyx_t_11 = __pyx_filename;
      {
        __pyx_t_18 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->cleanup(__pyx_v_context); if (unlikely(__pyx_t_18 == ((int)-1))) __PYX_ERR(2, 1518, __pyx_L13_error)
      }
      __Pyx_XGIVEREF(__pyx_t_15);
      __Pyx_XGIVEREF(__pyx_t_16);
      __Pyx_XGIVEREF(__pyx_t_17);
      __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_XGIVEREF(__pyx_t_14);
      __Pyx_ErrRestore(__pyx_t_12, __pyx_t_13, __pyx_t_14);
      __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0;
      __pyx_lineno = __pyx_t_9; __pyx_clineno = __pyx_t_10; __pyx_filename = __pyx_t_11;
      goto __pyx_L1_error;
      __pyx_L13_error:;
      __Pyx_XGIVEREF(__pyx_t_15);
      __Pyx_XGIVEREF(__pyx_t_16);
      __Pyx_XGIVEREF(__pyx_t_17);
      __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17);
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L11:;
  }

  /* "src/lxml/parser.pxi":1520
 *             context.cleanup()
 * 
 *         if isinstance(result, _Document):             # <<<<<<<<<<<<<<
 *             return (<_Document>result).getroot()
 *         else:
*/
  __pyx_t_6 = __Pyx_TypeCheck(__pyx_v_result, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Document); 
  if (__pyx_t_6) {

    /* "src/lxml/parser.pxi":1521
 * 
 *         if isinstance(result, _Document):
 *             return (<_Document>result).getroot()             # <<<<<<<<<<<<<<
 *         else:
 *             return result
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __pyx_f_4lxml_5etree_9_Document_getroot(((struct LxmlDocument *)__pyx_v_result)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1521, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "src/lxml/parser.pxi":1520
 *             context.cleanup()
 * 
 *         if isinstance(result, _Document):             # <<<<<<<<<<<<<<
 *             return (<_Document>result).getroot()
 *         else:
*/
  }

  /* "src/lxml/parser.pxi":1523
 *             return (<_Document>result).getroot()
 *         else:
 *             return result             # <<<<<<<<<<<<<<
 * 
 * 
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_result);
    __pyx_r = __pyx_v_result;
    goto __pyx_L0;
  }

  /* "src/lxml/parser.pxi":1485
 *                 context.cleanup()
 * 
 *     cpdef close(self):             # <<<<<<<<<<<<<<
 *         """close(self)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._FeedParser.close", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_11_FeedParser_3close(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_11_FeedParser_2close, "close(self)\n\n        Terminates feeding data to this parser.  This tells the parser to\n        process any remaining data in the feed buffer, and then returns the\n        root Element of the tree that was parsed.\n\n        This method must be called after passing the last chunk of data into\n        the ``feed()`` method.  It should only be called when using the feed\n        parser interface, all other usage is undefined.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_11_FeedParser_3close = {"close", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_11_FeedParser_3close, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_11_FeedParser_2close};
static PyObject *__pyx_pw_4lxml_5etree_11_FeedParser_3close(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("close (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("close", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("close", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_11_FeedParser_2close(((struct __pyx_obj_4lxml_5etree__FeedParser *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_11_FeedParser_2close(struct __pyx_obj_4lxml_5etree__FeedParser *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("close", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree_11_FeedParser_close(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1485, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._FeedParser.close", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":1526
 * 
 * 
 * cdef (int, int) _parse_data_chunk(xmlparser.xmlParserCtxt* c_ctxt,             # <<<<<<<<<<<<<<
 *                                   const char* char_data, int buffer_len):
 *     fixup_error = 0
*/

static __pyx_ctuple_int__and_int __pyx_f_4lxml_5etree__parse_data_chunk(xmlParserCtxt *__pyx_v_c_ctxt, char const *__pyx_v_char_data, int __pyx_v_buffer_len) {
  long __pyx_v_fixup_error;
  xmlNode *__pyx_v_c_node;
  xmlExternalEntityLoader __pyx_v_orig_loader;
  int __pyx_v_error;
  __pyx_ctuple_int__and_int __pyx_r;
  xmlNode *__pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  xmlDict *__pyx_t_4;
  __pyx_ctuple_int__and_int __pyx_t_5;

  /* "src/lxml/parser.pxi":1528
 * cdef (int, int) _parse_data_chunk(xmlparser.xmlParserCtxt* c_ctxt,
 *                                   const char* char_data, int buffer_len):
 *     fixup_error = 0             # <<<<<<<<<<<<<<
 *     with nogil:
 *         if c_ctxt.html:
*/
  __pyx_v_fixup_error = 0;

  /* "src/lxml/parser.pxi":1529
 *                                   const char* char_data, int buffer_len):
 *     fixup_error = 0
 *     with nogil:             # <<<<<<<<<<<<<<
 *         if c_ctxt.html:
 *             c_node = c_ctxt.node  # last node where the parser stopped
*/
  {
      PyThreadState * _save;
      _save = PyEval_SaveThread();
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "src/lxml/parser.pxi":1530
 *     fixup_error = 0
 *     with nogil:
 *         if c_ctxt.html:             # <<<<<<<<<<<<<<
 *             c_node = c_ctxt.node  # last node where the parser stopped
 *             orig_loader = _register_document_loader()
*/
        if (__pyx_v_c_ctxt->html) {

          /* "src/lxml/parser.pxi":1531
 *     with nogil:
 *         if c_ctxt.html:
 *             c_node = c_ctxt.node  # last node where the parser stopped             # <<<<<<<<<<<<<<
 *             orig_loader = _register_document_loader()
 *             error = htmlparser.htmlParseChunk(c_ctxt, char_data, buffer_len, 0)
*/
          __pyx_t_1 = __pyx_v_c_ctxt->node;
          __pyx_v_c_node = __pyx_t_1;

          /* "src/lxml/parser.pxi":1532
 *         if c_ctxt.html:
 *             c_node = c_ctxt.node  # last node where the parser stopped
 *             orig_loader = _register_document_loader()             # <<<<<<<<<<<<<<
 *             error = htmlparser.htmlParseChunk(c_ctxt, char_data, buffer_len, 0)
 *             _reset_document_loader(orig_loader)
*/
          __pyx_v_orig_loader = __pyx_f_4lxml_5etree__register_document_loader();

          /* "src/lxml/parser.pxi":1533
 *             c_node = c_ctxt.node  # last node where the parser stopped
 *             orig_loader = _register_document_loader()
 *             error = htmlparser.htmlParseChunk(c_ctxt, char_data, buffer_len, 0)             # <<<<<<<<<<<<<<
 *             _reset_document_loader(orig_loader)
 *             # and now for the fun part: move node names to the dict
*/
          __pyx_v_error = htmlParseChunk(__pyx_v_c_ctxt, __pyx_v_char_data, __pyx_v_buffer_len, 0);

          /* "src/lxml/parser.pxi":1534
 *             orig_loader = _register_document_loader()
 *             error = htmlparser.htmlParseChunk(c_ctxt, char_data, buffer_len, 0)
 *             _reset_document_loader(orig_loader)             # <<<<<<<<<<<<<<
 *             # and now for the fun part: move node names to the dict
 *             if c_ctxt.myDoc:
*/
          __pyx_f_4lxml_5etree__reset_document_loader(__pyx_v_orig_loader);

          /* "src/lxml/parser.pxi":1536
 *             _reset_document_loader(orig_loader)
 *             # and now for the fun part: move node names to the dict
 *             if c_ctxt.myDoc:             # <<<<<<<<<<<<<<
 *                 fixup_error = _fixHtmlDictSubtreeNames(
 *                     c_ctxt.dict, c_ctxt.myDoc, c_node)
*/
          __pyx_t_2 = (__pyx_v_c_ctxt->myDoc != 0);
          if (__pyx_t_2) {

            /* "src/lxml/parser.pxi":1537
 *             # and now for the fun part: move node names to the dict
 *             if c_ctxt.myDoc:
 *                 fixup_error = _fixHtmlDictSubtreeNames(             # <<<<<<<<<<<<<<
 *                     c_ctxt.dict, c_ctxt.myDoc, c_node)
 *                 if c_ctxt.myDoc.dict and c_ctxt.myDoc.dict is not c_ctxt.dict:
*/
            __pyx_v_fixup_error = __pyx_f_4lxml_5etree__fixHtmlDictSubtreeNames(__pyx_v_c_ctxt->dict, __pyx_v_c_ctxt->myDoc, __pyx_v_c_node);

            /* "src/lxml/parser.pxi":1539
 *                 fixup_error = _fixHtmlDictSubtreeNames(
 *                     c_ctxt.dict, c_ctxt.myDoc, c_node)
 *                 if c_ctxt.myDoc.dict and c_ctxt.myDoc.dict is not c_ctxt.dict:             # <<<<<<<<<<<<<<
 *                     xmlparser.xmlDictFree(c_ctxt.myDoc.dict)
 *                     c_ctxt.myDoc.dict = c_ctxt.dict
*/
            __pyx_t_3 = (__pyx_v_c_ctxt->myDoc->dict != 0);
            if (__pyx_t_3) {
            } else {
              __pyx_t_2 = __pyx_t_3;
              goto __pyx_L9_bool_binop_done;
            }
            __pyx_t_3 = (__pyx_v_c_ctxt->myDoc->dict != __pyx_v_c_ctxt->dict);
            __pyx_t_2 = __pyx_t_3;
            __pyx_L9_bool_binop_done:;
            if (__pyx_t_2) {

              /* "src/lxml/parser.pxi":1540
 *                     c_ctxt.dict, c_ctxt.myDoc, c_node)
 *                 if c_ctxt.myDoc.dict and c_ctxt.myDoc.dict is not c_ctxt.dict:
 *                     xmlparser.xmlDictFree(c_ctxt.myDoc.dict)             # <<<<<<<<<<<<<<
 *                     c_ctxt.myDoc.dict = c_ctxt.dict
 *                     xmlparser.xmlDictReference(c_ctxt.dict)
*/
              xmlDictFree(__pyx_v_c_ctxt->myDoc->dict);

              /* "src/lxml/parser.pxi":1541
 *                 if c_ctxt.myDoc.dict and c_ctxt.myDoc.dict is not c_ctxt.dict:
 *                     xmlparser.xmlDictFree(c_ctxt.myDoc.dict)
 *                     c_ctxt.myDoc.dict = c_ctxt.dict             # <<<<<<<<<<<<<<
 *                     xmlparser.xmlDictReference(c_ctxt.dict)
 *         else:
*/
              __pyx_t_4 = __pyx_v_c_ctxt->dict;
              __pyx_v_c_ctxt->myDoc->dict = __pyx_t_4;

              /* "src/lxml/parser.pxi":1542
 *                     xmlparser.xmlDictFree(c_ctxt.myDoc.dict)
 *                     c_ctxt.myDoc.dict = c_ctxt.dict
 *                     xmlparser.xmlDictReference(c_ctxt.dict)             # <<<<<<<<<<<<<<
 *         else:
 *             orig_loader = _register_document_loader()
*/
              (void)(xmlDictReference(__pyx_v_c_ctxt->dict));

              /* "src/lxml/parser.pxi":1539
 *                 fixup_error = _fixHtmlDictSubtreeNames(
 *                     c_ctxt.dict, c_ctxt.myDoc, c_node)
 *                 if c_ctxt.myDoc.dict and c_ctxt.myDoc.dict is not c_ctxt.dict:             # <<<<<<<<<<<<<<
 *                     xmlparser.xmlDictFree(c_ctxt.myDoc.dict)
 *                     c_ctxt.myDoc.dict = c_ctxt.dict
*/
            }

            /* "src/lxml/parser.pxi":1536
 *             _reset_document_loader(orig_loader)
 *             # and now for the fun part: move node names to the dict
 *             if c_ctxt.myDoc:             # <<<<<<<<<<<<<<
 *                 fixup_error = _fixHtmlDictSubtreeNames(
 *                     c_ctxt.dict, c_ctxt.myDoc, c_node)
*/
          }

          /* "src/lxml/parser.pxi":1530
 *     fixup_error = 0
 *     with nogil:
 *         if c_ctxt.html:             # <<<<<<<<<<<<<<
 *             c_node = c_ctxt.node  # last node where the parser stopped
 *             orig_loader = _register_document_loader()
*/
          goto __pyx_L6;
        }

        /* "src/lxml/parser.pxi":1544
 *                     xmlparser.xmlDictReference(c_ctxt.dict)
 *         else:
 *             orig_loader = _register_document_loader()             # <<<<<<<<<<<<<<
 *             error = xmlparser.xmlParseChunk(c_ctxt, char_data, buffer_len, 0)
 *             _reset_document_loader(orig_loader)
*/
        /*else*/ {
          __pyx_v_orig_loader = __pyx_f_4lxml_5etree__register_document_loader();

          /* "src/lxml/parser.pxi":1545
 *         else:
 *             orig_loader = _register_document_loader()
 *             error = xmlparser.xmlParseChunk(c_ctxt, char_data, buffer_len, 0)             # <<<<<<<<<<<<<<
 *             _reset_document_loader(orig_loader)
 *     return (error, fixup_error)
*/
          __pyx_v_error = xmlParseChunk(__pyx_v_c_ctxt, __pyx_v_char_data, __pyx_v_buffer_len, 0);

          /* "src/lxml/parser.pxi":1546
 *             orig_loader = _register_document_loader()
 *             error = xmlparser.xmlParseChunk(c_ctxt, char_data, buffer_len, 0)
 *             _reset_document_loader(orig_loader)             # <<<<<<<<<<<<<<
 *     return (error, fixup_error)
 * 
*/
          __pyx_f_4lxml_5etree__reset_document_loader(__pyx_v_orig_loader);
        }
        __pyx_L6:;
      }

      /* "src/lxml/parser.pxi":1529
 *                                   const char* char_data, int buffer_len):
 *     fixup_error = 0
 *     with nogil:             # <<<<<<<<<<<<<<
 *         if c_ctxt.html:
 *             c_node = c_ctxt.node  # last node where the parser stopped
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "src/lxml/parser.pxi":1547
 *             error = xmlparser.xmlParseChunk(c_ctxt, char_data, buffer_len, 0)
 *             _reset_document_loader(orig_loader)
 *     return (error, fixup_error)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_5.f0 = __pyx_v_error;
  __pyx_t_5.f1 = __pyx_v_fixup_error;
  __pyx_r = __pyx_t_5;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":1526
 * 
 * 
 * cdef (int, int) _parse_data_chunk(xmlparser.xmlParserCtxt* c_ctxt,             # <<<<<<<<<<<<<<
 *                                   const char* char_data, int buffer_len):
 *     fixup_error = 0
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/parser.pxi":1550
 * 
 * 
 * cdef int _htmlCtxtResetPush(xmlparser.xmlParserCtxt* c_ctxt,             # <<<<<<<<<<<<<<
 *                              const_char* c_data, int buffer_len,
 *                              const_char* c_filename, const_char* c_encoding,
*/

static int __pyx_f_4lxml_5etree__htmlCtxtResetPush(xmlParserCtxt *__pyx_v_c_ctxt, const char *__pyx_v_c_data, int __pyx_v_buffer_len, const char *__pyx_v_c_filename, const char *__pyx_v_c_encoding, int __pyx_v_parse_options) {
  int __pyx_v_error;
  int __pyx_r;
  int __pyx_t_1;

  /* "src/lxml/parser.pxi":1556
 *     cdef xmlparser.xmlParserInput* c_input_stream
 *     # libxml2 lacks an HTML push parser setup function
 *     error = xmlparser.xmlCtxtResetPush(             # <<<<<<<<<<<<<<
 *         c_ctxt, c_data, buffer_len, c_filename, c_encoding)
 *     if error:
*/
  __pyx_v_error = xmlCtxtResetPush(__pyx_v_c_ctxt, __pyx_v_c_data, __pyx_v_buffer_len, __pyx_v_c_filename, __pyx_v_c_encoding);

  /* "src/lxml/parser.pxi":1558
 *     error = xmlparser.xmlCtxtResetPush(
 *         c_ctxt, c_data, buffer_len, c_filename, c_encoding)
 *     if error:             # <<<<<<<<<<<<<<
 *         return error
 * 
*/
  __pyx_t_1 = (__pyx_v_error != 0);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":1559
 *         c_ctxt, c_data, buffer_len, c_filename, c_encoding)
 *     if error:
 *         return error             # <<<<<<<<<<<<<<
 * 
 *     # fix libxml2 setup for HTML
*/
    __pyx_r = __pyx_v_error;
    goto __pyx_L0;

    /* "src/lxml/parser.pxi":1558
 *     error = xmlparser.xmlCtxtResetPush(
 *         c_ctxt, c_data, buffer_len, c_filename, c_encoding)
 *     if error:             # <<<<<<<<<<<<<<
 *         return error
 * 
*/
  }

  /* "src/lxml/parser.pxi":1562
 * 
 *     # fix libxml2 setup for HTML
 *     if tree.LIBXML_VERSION < 21400:             # <<<<<<<<<<<<<<
 *         c_ctxt.progressive = 1  # TODO: remove
 *     c_ctxt.html = 1
*/
  __pyx_t_1 = (LIBXML_VERSION < 0x5398);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":1563
 *     # fix libxml2 setup for HTML
 *     if tree.LIBXML_VERSION < 21400:
 *         c_ctxt.progressive = 1  # TODO: remove             # <<<<<<<<<<<<<<
 *     c_ctxt.html = 1
 *     htmlparser.htmlCtxtUseOptions(c_ctxt, parse_options)
*/
    __pyx_v_c_ctxt->progressive = 1;

    /* "src/lxml/parser.pxi":1562
 * 
 *     # fix libxml2 setup for HTML
 *     if tree.LIBXML_VERSION < 21400:             # <<<<<<<<<<<<<<
 *         c_ctxt.progressive = 1  # TODO: remove
 *     c_ctxt.html = 1
*/
  }

  /* "src/lxml/parser.pxi":1564
 *     if tree.LIBXML_VERSION < 21400:
 *         c_ctxt.progressive = 1  # TODO: remove
 *     c_ctxt.html = 1             # <<<<<<<<<<<<<<
 *     htmlparser.htmlCtxtUseOptions(c_ctxt, parse_options)
 * 
*/
  __pyx_v_c_ctxt->html = 1;

  /* "src/lxml/parser.pxi":1565
 *         c_ctxt.progressive = 1  # TODO: remove
 *     c_ctxt.html = 1
 *     htmlparser.htmlCtxtUseOptions(c_ctxt, parse_options)             # <<<<<<<<<<<<<<
 * 
 *     return 0
*/
  (void)(htmlCtxtUseOptions(__pyx_v_c_ctxt, __pyx_v_parse_options));

  /* "src/lxml/parser.pxi":1567
 *     htmlparser.htmlCtxtUseOptions(c_ctxt, parse_options)
 * 
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":1550
 * 
 * 
 * cdef int _htmlCtxtResetPush(xmlparser.xmlParserCtxt* c_ctxt,             # <<<<<<<<<<<<<<
 *                              const_char* c_data, int buffer_len,
 *                              const_char* c_filename, const_char* c_encoding,
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/parser.pxi":1639
 *     apply to the default parser.
 *     """
 *     def __init__(self, *, encoding=None, attribute_defaults=False,             # <<<<<<<<<<<<<<
 *                  dtd_validation=False, load_dtd=False, no_network=True, decompress=False,
 *                  ns_clean=False, recover=False, XMLSchema schema=None,
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_9XMLParser_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_9XMLParser_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_encoding = 0;
  PyObject *__pyx_v_attribute_defaults = 0;
  PyObject *__pyx_v_dtd_validation = 0;
  PyObject *__pyx_v_load_dtd = 0;
  PyObject *__pyx_v_no_network = 0;
  PyObject *__pyx_v_decompress = 0;
  PyObject *__pyx_v_ns_clean = 0;
  PyObject *__pyx_v_recover = 0;
  struct __pyx_obj_4lxml_5etree_XMLSchema *__pyx_v_schema = 0;
  PyObject *__pyx_v_huge_tree = 0;
  PyObject *__pyx_v_remove_blank_text = 0;
  PyObject *__pyx_v_resolve_entities = 0;
  PyObject *__pyx_v_remove_comments = 0;
  PyObject *__pyx_v_remove_pis = 0;
  PyObject *__pyx_v_strip_cdata = 0;
  PyObject *__pyx_v_collect_ids = 0;
  PyObject *__pyx_v_target = 0;
  PyObject *__pyx_v_compact = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[18] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_encoding,&__pyx_mstate_global->__pyx_n_u_attribute_defaults,&__pyx_mstate_global->__pyx_n_u_dtd_validation,&__pyx_mstate_global->__pyx_n_u_load_dtd,&__pyx_mstate_global->__pyx_n_u_no_network,&__pyx_mstate_global->__pyx_n_u_decompress,&__pyx_mstate_global->__pyx_n_u_ns_clean,&__pyx_mstate_global->__pyx_n_u_recover,&__pyx_mstate_global->__pyx_n_u_schema,&__pyx_mstate_global->__pyx_n_u_huge_tree,&__pyx_mstate_global->__pyx_n_u_remove_blank_text,&__pyx_mstate_global->__pyx_n_u_resolve_entities,&__pyx_mstate_global->__pyx_n_u_remove_comments,&__pyx_mstate_global->__pyx_n_u_remove_pis,&__pyx_mstate_global->__pyx_n_u_strip_cdata,&__pyx_mstate_global->__pyx_n_u_collect_ids,&__pyx_mstate_global->__pyx_n_u_target,&__pyx_mstate_global->__pyx_n_u_compact,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(2, 1639, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, 0, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(2, 1639, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_False));

      /* "src/lxml/parser.pxi":1640
 *     """
 *     def __init__(self, *, encoding=None, attribute_defaults=False,
 *                  dtd_validation=False, load_dtd=False, no_network=True, decompress=False,             # <<<<<<<<<<<<<<
 *                  ns_clean=False, recover=False, XMLSchema schema=None,
 *                  huge_tree=False, remove_blank_text=False, resolve_entities='internal',
*/
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_True));
      if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)Py_False));

      /* "src/lxml/parser.pxi":1641
 *     def __init__(self, *, encoding=None, attribute_defaults=False,
 *                  dtd_validation=False, load_dtd=False, no_network=True, decompress=False,
 *                  ns_clean=False, recover=False, XMLSchema schema=None,             # <<<<<<<<<<<<<<
 *                  huge_tree=False, remove_blank_text=False, resolve_entities='internal',
 *                  remove_comments=False, remove_pis=False, strip_cdata=True,
*/
      if (!values[6]) values[6] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[7]) values[7] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[8]) values[8] = __Pyx_NewRef((PyObject *)((struct __pyx_obj_4lxml_5etree_XMLSchema *)Py_None));

      /* "src/lxml/parser.pxi":1642
 *                  dtd_validation=False, load_dtd=False, no_network=True, decompress=False,
 *                  ns_clean=False, recover=False, XMLSchema schema=None,
 *                  huge_tree=False, remove_blank_text=False, resolve_entities='internal',             # <<<<<<<<<<<<<<
 *                  remove_comments=False, remove_pis=False, strip_cdata=True,
 *                  collect_ids=True, target=None, compact=True):
*/
      if (!values[9]) values[9] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[10]) values[10] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[11]) values[11] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_n_u_internal));

      /* "src/lxml/parser.pxi":1643
 *                  ns_clean=False, recover=False, XMLSchema schema=None,
 *                  huge_tree=False, remove_blank_text=False, resolve_entities='internal',
 *                  remove_comments=False, remove_pis=False, strip_cdata=True,             # <<<<<<<<<<<<<<
 *                  collect_ids=True, target=None, compact=True):
 *         cdef int parse_options
*/
      if (!values[12]) values[12] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[13]) values[13] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[14]) values[14] = __Pyx_NewRef(((PyObject *)Py_True));

      /* "src/lxml/parser.pxi":1644
 *                  huge_tree=False, remove_blank_text=False, resolve_entities='internal',
 *                  remove_comments=False, remove_pis=False, strip_cdata=True,
 *                  collect_ids=True, target=None, compact=True):             # <<<<<<<<<<<<<<
 *         cdef int parse_options
 *         cdef bint resolve_external = True
*/
      if (!values[15]) values[15] = __Pyx_NewRef(((PyObject *)Py_True));
      if (!values[16]) values[16] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[17]) values[17] = __Pyx_NewRef(((PyObject *)Py_True));
    } else if (unlikely(__pyx_nargs != 0)) {
      goto __pyx_L5_argtuple_error;
    } else {

      /* "src/lxml/parser.pxi":1639
 *     apply to the default parser.
 *     """
 *     def __init__(self, *, encoding=None, attribute_defaults=False,             # <<<<<<<<<<<<<<
 *                  dtd_validation=False, load_dtd=False, no_network=True, decompress=False,
 *                  ns_clean=False, recover=False, XMLSchema schema=None,
*/
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_False));

      /* "src/lxml/parser.pxi":1640
 *     """
 *     def __init__(self, *, encoding=None, attribute_defaults=False,
 *                  dtd_validation=False, load_dtd=False, no_network=True, decompress=False,             # <<<<<<<<<<<<<<
 *                  ns_clean=False, recover=False, XMLSchema schema=None,
 *                  huge_tree=False, remove_blank_text=False, resolve_entities='internal',
*/
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_True));
      if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)Py_False));

      /* "src/lxml/parser.pxi":1641
 *     def __init__(self, *, encoding=None, attribute_defaults=False,
 *                  dtd_validation=False, load_dtd=False, no_network=True, decompress=False,
 *                  ns_clean=False, recover=False, XMLSchema schema=None,             # <<<<<<<<<<<<<<
 *                  huge_tree=False, remove_blank_text=False, resolve_entities='internal',
 *                  remove_comments=False, remove_pis=False, strip_cdata=True,
*/
      if (!values[6]) values[6] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[7]) values[7] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[8]) values[8] = __Pyx_NewRef((PyObject *)((struct __pyx_obj_4lxml_5etree_XMLSchema *)Py_None));

      /* "src/lxml/parser.pxi":1642
 *                  dtd_validation=False, load_dtd=False, no_network=True, decompress=False,
 *                  ns_clean=False, recover=False, XMLSchema schema=None,
 *                  huge_tree=False, remove_blank_text=False, resolve_entities='internal',             # <<<<<<<<<<<<<<
 *                  remove_comments=False, remove_pis=False, strip_cdata=True,
 *                  collect_ids=True, target=None, compact=True):
*/
      if (!values[9]) values[9] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[10]) values[10] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[11]) values[11] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_n_u_internal));

      /* "src/lxml/parser.pxi":1643
 *                  ns_clean=False, recover=False, XMLSchema schema=None,
 *                  huge_tree=False, remove_blank_text=False, resolve_entities='internal',
 *                  remove_comments=False, remove_pis=False, strip_cdata=True,             # <<<<<<<<<<<<<<
 *                  collect_ids=True, target=None, compact=True):
 *         cdef int parse_options
*/
      if (!values[12]) values[12] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[13]) values[13] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[14]) values[14] = __Pyx_NewRef(((PyObject *)Py_True));

      /* "src/lxml/parser.pxi":1644
 *                  huge_tree=False, remove_blank_text=False, resolve_entities='internal',
 *                  remove_comments=False, remove_pis=False, strip_cdata=True,
 *                  collect_ids=True, target=None, compact=True):             # <<<<<<<<<<<<<<
 *         cdef int parse_options
 *         cdef bint resolve_external = True
*/
      if (!values[15]) values[15] = __Pyx_NewRef(((PyObject *)Py_True));
      if (!values[16]) values[16] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[17]) values[17] = __Pyx_NewRef(((PyObject *)Py_True));
    }
    __pyx_v_encoding = values[0];
    __pyx_v_attribute_defaults = values[1];
    __pyx_v_dtd_validation = values[2];
    __pyx_v_load_dtd = values[3];
    __pyx_v_no_network = values[4];
    __pyx_v_decompress = values[5];
    __pyx_v_ns_clean = values[6];
    __pyx_v_recover = values[7];
    __pyx_v_schema = ((struct __pyx_obj_4lxml_5etree_XMLSchema *)values[8]);
    __pyx_v_huge_tree = values[9];
    __pyx_v_remove_blank_text = values[10];
    __pyx_v_resolve_entities = values[11];
    __pyx_v_remove_comments = values[12];
    __pyx_v_remove_pis = values[13];
    __pyx_v_strip_cdata = values[14];
    __pyx_v_collect_ids = values[15];
    __pyx_v_target = values[16];
    __pyx_v_compact = values[17];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, __pyx_nargs); __PYX_ERR(2, 1639, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.XMLParser.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_schema), __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XMLSchema, 1, "schema", 0))) __PYX_ERR(2, 1641, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_9XMLParser___init__(((struct __pyx_obj_4lxml_5etree_XMLParser *)__pyx_v_self), __pyx_v_encoding, __pyx_v_attribute_defaults, __pyx_v_dtd_validation, __pyx_v_load_dtd, __pyx_v_no_network, __pyx_v_decompress, __pyx_v_ns_clean, __pyx_v_recover, __pyx_v_schema, __pyx_v_huge_tree, __pyx_v_remove_blank_text, __pyx_v_resolve_entities, __pyx_v_remove_comments, __pyx_v_remove_pis, __pyx_v_strip_cdata, __pyx_v_collect_ids, __pyx_v_target, __pyx_v_compact);

  /* "src/lxml/parser.pxi":1639
 *     apply to the default parser.
 *     """
 *     def __init__(self, *, encoding=None, attribute_defaults=False,             # <<<<<<<<<<<<<<
 *                  dtd_validation=False, load_dtd=False, no_network=True, decompress=False,
 *                  ns_clean=False, recover=False, XMLSchema schema=None,
*/

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_9XMLParser___init__(struct __pyx_obj_4lxml_5etree_XMLParser *__pyx_v_self, PyObject *__pyx_v_encoding, PyObject *__pyx_v_attribute_defaults, PyObject *__pyx_v_dtd_validation, PyObject *__pyx_v_load_dtd, PyObject *__pyx_v_no_network, PyObject *__pyx_v_decompress, PyObject *__pyx_v_ns_clean, PyObject *__pyx_v_recover, struct __pyx_obj_4lxml_5etree_XMLSchema *__pyx_v_schema, PyObject *__pyx_v_huge_tree, PyObject *__pyx_v_remove_blank_text, PyObject *__pyx_v_resolve_entities, PyObject *__pyx_v_remove_comments, PyObject *__pyx_v_remove_pis, PyObject *__pyx_v_strip_cdata, PyObject *__pyx_v_collect_ids, PyObject *__pyx_v_target, PyObject *__pyx_v_compact) {
  int __pyx_v_parse_options;
  int __pyx_v_resolve_external;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  size_t __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "src/lxml/parser.pxi":1646
 *                  collect_ids=True, target=None, compact=True):
 *         cdef int parse_options
 *         cdef bint resolve_external = True             # <<<<<<<<<<<<<<
 *         parse_options = _XML_DEFAULT_PARSE_OPTIONS
 *         if load_dtd:
*/
  __pyx_v_resolve_external = 1;

  /* "src/lxml/parser.pxi":1647
 *         cdef int parse_options
 *         cdef bint resolve_external = True
 *         parse_options = _XML_DEFAULT_PARSE_OPTIONS             # <<<<<<<<<<<<<<
 *         if load_dtd:
 *             parse_options = parse_options | xmlparser.XML_PARSE_DTDLOAD
*/
  __pyx_v_parse_options = __pyx_v_4lxml_5etree__XML_DEFAULT_PARSE_OPTIONS;

  /* "src/lxml/parser.pxi":1648
 *         cdef bint resolve_external = True
 *         parse_options = _XML_DEFAULT_PARSE_OPTIONS
 *         if load_dtd:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options | xmlparser.XML_PARSE_DTDLOAD
 *         if dtd_validation:
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_load_dtd); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(2, 1648, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":1649
 *         parse_options = _XML_DEFAULT_PARSE_OPTIONS
 *         if load_dtd:
 *             parse_options = parse_options | xmlparser.XML_PARSE_DTDLOAD             # <<<<<<<<<<<<<<
 *         if dtd_validation:
 *             parse_options = parse_options | xmlparser.XML_PARSE_DTDVALID | \
*/
    __pyx_v_parse_options = (__pyx_v_parse_options | XML_PARSE_DTDLOAD);

    /* "src/lxml/parser.pxi":1648
 *         cdef bint resolve_external = True
 *         parse_options = _XML_DEFAULT_PARSE_OPTIONS
 *         if load_dtd:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options | xmlparser.XML_PARSE_DTDLOAD
 *         if dtd_validation:
*/
  }

  /* "src/lxml/parser.pxi":1650
 *         if load_dtd:
 *             parse_options = parse_options | xmlparser.XML_PARSE_DTDLOAD
 *         if dtd_validation:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options | xmlparser.XML_PARSE_DTDVALID | \
 *                             xmlparser.XML_PARSE_DTDLOAD
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_dtd_validation); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(2, 1650, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":1651
 *             parse_options = parse_options | xmlparser.XML_PARSE_DTDLOAD
 *         if dtd_validation:
 *             parse_options = parse_options | xmlparser.XML_PARSE_DTDVALID | \             # <<<<<<<<<<<<<<
 *                             xmlparser.XML_PARSE_DTDLOAD
 *         if attribute_defaults:
*/
    __pyx_v_parse_options = ((__pyx_v_parse_options | XML_PARSE_DTDVALID) | XML_PARSE_DTDLOAD);

    /* "src/lxml/parser.pxi":1650
 *         if load_dtd:
 *             parse_options = parse_options | xmlparser.XML_PARSE_DTDLOAD
 *         if dtd_validation:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options | xmlparser.XML_PARSE_DTDVALID | \
 *                             xmlparser.XML_PARSE_DTDLOAD
*/
  }

  /* "src/lxml/parser.pxi":1653
 *             parse_options = parse_options | xmlparser.XML_PARSE_DTDVALID | \
 *                             xmlparser.XML_PARSE_DTDLOAD
 *         if attribute_defaults:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options | xmlparser.XML_PARSE_DTDATTR
 *             if schema is None:
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_attribute_defaults); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(2, 1653, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":1654
 *                             xmlparser.XML_PARSE_DTDLOAD
 *         if attribute_defaults:
 *             parse_options = parse_options | xmlparser.XML_PARSE_DTDATTR             # <<<<<<<<<<<<<<
 *             if schema is None:
 *                 parse_options = parse_options | xmlparser.XML_PARSE_DTDLOAD
*/
    __pyx_v_parse_options = (__pyx_v_parse_options | XML_PARSE_DTDATTR);

    /* "src/lxml/parser.pxi":1655
 *         if attribute_defaults:
 *             parse_options = parse_options | xmlparser.XML_PARSE_DTDATTR
 *             if schema is None:             # <<<<<<<<<<<<<<
 *                 parse_options = parse_options | xmlparser.XML_PARSE_DTDLOAD
 *         if ns_clean:
*/
    __pyx_t_1 = (((PyObject *)__pyx_v_schema) == Py_None);
    if (__pyx_t_1) {

      /* "src/lxml/parser.pxi":1656
 *             parse_options = parse_options | xmlparser.XML_PARSE_DTDATTR
 *             if schema is None:
 *                 parse_options = parse_options | xmlparser.XML_PARSE_DTDLOAD             # <<<<<<<<<<<<<<
 *         if ns_clean:
 *             parse_options = parse_options | xmlparser.XML_PARSE_NSCLEAN
*/
      __pyx_v_parse_options = (__pyx_v_parse_options | XML_PARSE_DTDLOAD);

      /* "src/lxml/parser.pxi":1655
 *         if attribute_defaults:
 *             parse_options = parse_options | xmlparser.XML_PARSE_DTDATTR
 *             if schema is None:             # <<<<<<<<<<<<<<
 *                 parse_options = parse_options | xmlparser.XML_PARSE_DTDLOAD
 *         if ns_clean:
*/
    }

    /* "src/lxml/parser.pxi":1653
 *             parse_options = parse_options | xmlparser.XML_PARSE_DTDVALID | \
 *                             xmlparser.XML_PARSE_DTDLOAD
 *         if attribute_defaults:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options | xmlparser.XML_PARSE_DTDATTR
 *             if schema is None:
*/
  }

  /* "src/lxml/parser.pxi":1657
 *             if schema is None:
 *                 parse_options = parse_options | xmlparser.XML_PARSE_DTDLOAD
 *         if ns_clean:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options | xmlparser.XML_PARSE_NSCLEAN
 *         if recover:
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_ns_clean); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(2, 1657, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":1658
 *                 parse_options = parse_options | xmlparser.XML_PARSE_DTDLOAD
 *         if ns_clean:
 *             parse_options = parse_options | xmlparser.XML_PARSE_NSCLEAN             # <<<<<<<<<<<<<<
 *         if recover:
 *             parse_options = parse_options | xmlparser.XML_PARSE_RECOVER
*/
    __pyx_v_parse_options = (__pyx_v_parse_options | XML_PARSE_NSCLEAN);

    /* "src/lxml/parser.pxi":1657
 *             if schema is None:
 *                 parse_options = parse_options | xmlparser.XML_PARSE_DTDLOAD
 *         if ns_clean:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options | xmlparser.XML_PARSE_NSCLEAN
 *         if recover:
*/
  }

  /* "src/lxml/parser.pxi":1659
 *         if ns_clean:
 *             parse_options = parse_options | xmlparser.XML_PARSE_NSCLEAN
 *         if recover:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options | xmlparser.XML_PARSE_RECOVER
 *         if remove_blank_text:
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_recover); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(2, 1659, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":1660
 *             parse_options = parse_options | xmlparser.XML_PARSE_NSCLEAN
 *         if recover:
 *             parse_options = parse_options | xmlparser.XML_PARSE_RECOVER             # <<<<<<<<<<<<<<
 *         if remove_blank_text:
 *             parse_options = parse_options | xmlparser.XML_PARSE_NOBLANKS
*/
    __pyx_v_parse_options = (__pyx_v_parse_options | XML_PARSE_RECOVER);

    /* "src/lxml/parser.pxi":1659
 *         if ns_clean:
 *             parse_options = parse_options | xmlparser.XML_PARSE_NSCLEAN
 *         if recover:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options | xmlparser.XML_PARSE_RECOVER
 *         if remove_blank_text:
*/
  }

  /* "src/lxml/parser.pxi":1661
 *         if recover:
 *             parse_options = parse_options | xmlparser.XML_PARSE_RECOVER
 *         if remove_blank_text:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options | xmlparser.XML_PARSE_NOBLANKS
 *         if huge_tree:
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_remove_blank_text); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(2, 1661, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":1662
 *             parse_options = parse_options | xmlparser.XML_PARSE_RECOVER
 *         if remove_blank_text:
 *             parse_options = parse_options | xmlparser.XML_PARSE_NOBLANKS             # <<<<<<<<<<<<<<
 *         if huge_tree:
 *             parse_options = parse_options | xmlparser.XML_PARSE_HUGE
*/
    __pyx_v_parse_options = (__pyx_v_parse_options | XML_PARSE_NOBLANKS);

    /* "src/lxml/parser.pxi":1661
 *         if recover:
 *             parse_options = parse_options | xmlparser.XML_PARSE_RECOVER
 *         if remove_blank_text:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options | xmlparser.XML_PARSE_NOBLANKS
 *         if huge_tree:
*/
  }

  /* "src/lxml/parser.pxi":1663
 *         if remove_blank_text:
 *             parse_options = parse_options | xmlparser.XML_PARSE_NOBLANKS
 *         if huge_tree:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options | xmlparser.XML_PARSE_HUGE
 *         if not no_network:
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_huge_tree); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(2, 1663, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":1664
 *             parse_options = parse_options | xmlparser.XML_PARSE_NOBLANKS
 *         if huge_tree:
 *             parse_options = parse_options | xmlparser.XML_PARSE_HUGE             # <<<<<<<<<<<<<<
 *         if not no_network:
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NONET
*/
    __pyx_v_parse_options = (__pyx_v_parse_options | XML_PARSE_HUGE);

    /* "src/lxml/parser.pxi":1663
 *         if remove_blank_text:
 *             parse_options = parse_options | xmlparser.XML_PARSE_NOBLANKS
 *         if huge_tree:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options | xmlparser.XML_PARSE_HUGE
 *         if not no_network:
*/
  }

  /* "src/lxml/parser.pxi":1665
 *         if huge_tree:
 *             parse_options = parse_options | xmlparser.XML_PARSE_HUGE
 *         if not no_network:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NONET
 *         if not compact:
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_no_network); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(2, 1665, __pyx_L1_error)
  __pyx_t_2 = (!__pyx_t_1);
  if (__pyx_t_2) {

    /* "src/lxml/parser.pxi":1666
 *             parse_options = parse_options | xmlparser.XML_PARSE_HUGE
 *         if not no_network:
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NONET             # <<<<<<<<<<<<<<
 *         if not compact:
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_COMPACT
*/
    __pyx_v_parse_options = (__pyx_v_parse_options ^ XML_PARSE_NONET);

    /* "src/lxml/parser.pxi":1665
 *         if huge_tree:
 *             parse_options = parse_options | xmlparser.XML_PARSE_HUGE
 *         if not no_network:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NONET
 *         if not compact:
*/
  }

  /* "src/lxml/parser.pxi":1667
 *         if not no_network:
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NONET
 *         if not compact:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_COMPACT
 *         if not resolve_entities:
*/
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_compact); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(2, 1667, __pyx_L1_error)
  __pyx_t_1 = (!__pyx_t_2);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":1668
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NONET
 *         if not compact:
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_COMPACT             # <<<<<<<<<<<<<<
 *         if not resolve_entities:
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NOENT
*/
    __pyx_v_parse_options = (__pyx_v_parse_options ^ XML_PARSE_COMPACT);

    /* "src/lxml/parser.pxi":1667
 *         if not no_network:
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NONET
 *         if not compact:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_COMPACT
 *         if not resolve_entities:
*/
  }

  /* "src/lxml/parser.pxi":1669
 *         if not compact:
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_COMPACT
 *         if not resolve_entities:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NOENT
 *         elif resolve_entities == 'internal':
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_resolve_entities); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(2, 1669, __pyx_L1_error)
  __pyx_t_2 = (!__pyx_t_1);
  if (__pyx_t_2) {

    /* "src/lxml/parser.pxi":1670
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_COMPACT
 *         if not resolve_entities:
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NOENT             # <<<<<<<<<<<<<<
 *         elif resolve_entities == 'internal':
 *             resolve_external = False
*/
    __pyx_v_parse_options = (__pyx_v_parse_options ^ XML_PARSE_NOENT);

    /* "src/lxml/parser.pxi":1669
 *         if not compact:
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_COMPACT
 *         if not resolve_entities:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NOENT
 *         elif resolve_entities == 'internal':
*/
    goto __pyx_L13;
  }

  /* "src/lxml/parser.pxi":1671
 *         if not resolve_entities:
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NOENT
 *         elif resolve_entities == 'internal':             # <<<<<<<<<<<<<<
 *             resolve_external = False
 *         if not strip_cdata:
*/
  __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_resolve_entities, __pyx_mstate_global->__pyx_n_u_internal, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(2, 1671, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "src/lxml/parser.pxi":1672
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NOENT
 *         elif resolve_entities == 'internal':
 *             resolve_external = False             # <<<<<<<<<<<<<<
 *         if not strip_cdata:
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NOCDATA
*/
    __pyx_v_resolve_external = 0;

    /* "src/lxml/parser.pxi":1671
 *         if not resolve_entities:
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NOENT
 *         elif resolve_entities == 'internal':             # <<<<<<<<<<<<<<
 *             resolve_external = False
 *         if not strip_cdata:
*/
  }
  __pyx_L13:;

  /* "src/lxml/parser.pxi":1673
 *         elif resolve_entities == 'internal':
 *             resolve_external = False
 *         if not strip_cdata:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NOCDATA
 *         if decompress:
*/
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_strip_cdata); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(2, 1673, __pyx_L1_error)
  __pyx_t_1 = (!__pyx_t_2);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":1674
 *             resolve_external = False
 *         if not strip_cdata:
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NOCDATA             # <<<<<<<<<<<<<<
 *         if decompress:
 *             parse_options |= xmlparser.XML_PARSE_UNZIP
*/
    __pyx_v_parse_options = (__pyx_v_parse_options ^ XML_PARSE_NOCDATA);

    /* "src/lxml/parser.pxi":1673
 *         elif resolve_entities == 'internal':
 *             resolve_external = False
 *         if not strip_cdata:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NOCDATA
 *         if decompress:
*/
  }

  /* "src/lxml/parser.pxi":1675
 *         if not strip_cdata:
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NOCDATA
 *         if decompress:             # <<<<<<<<<<<<<<
 *             parse_options |= xmlparser.XML_PARSE_UNZIP
 * 
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_decompress); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(2, 1675, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":1676
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NOCDATA
 *         if decompress:
 *             parse_options |= xmlparser.XML_PARSE_UNZIP             # <<<<<<<<<<<<<<
 * 
 *         _BaseParser.__init__(self, parse_options, False, schema,
*/
    __pyx_v_parse_options = (__pyx_v_parse_options | XML_PARSE_UNZIP);

    /* "src/lxml/parser.pxi":1675
 *         if not strip_cdata:
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NOCDATA
 *         if decompress:             # <<<<<<<<<<<<<<
 *             parse_options |= xmlparser.XML_PARSE_UNZIP
 * 
*/
  }

  /* "src/lxml/parser.pxi":1678
 *             parse_options |= xmlparser.XML_PARSE_UNZIP
 * 
 *         _BaseParser.__init__(self, parse_options, False, schema,             # <<<<<<<<<<<<<<
 *                              remove_comments, remove_pis, strip_cdata,
 *                              collect_ids, target, encoding, resolve_external)
*/
  __pyx_t_4 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__BaseParser);
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyLong_From_int(__pyx_v_parse_options); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 1678, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);

  /* "src/lxml/parser.pxi":1680
 *         _BaseParser.__init__(self, parse_options, False, schema,
 *                              remove_comments, remove_pis, strip_cdata,
 *                              collect_ids, target, encoding, resolve_external)             # <<<<<<<<<<<<<<
 * 
 *     # Allow subscripting XMLParser in type annotions (PEP 560)
*/
  __pyx_t_6 = __Pyx_PyBool_FromLong(__pyx_v_resolve_external); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 1680, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = 0;
  {
    PyObject *__pyx_callargs[12] = {__pyx_t_4, ((PyObject *)__pyx_v_self), __pyx_t_5, Py_False, ((PyObject *)__pyx_v_schema), __pyx_v_remove_comments, __pyx_v_remove_pis, __pyx_v_strip_cdata, __pyx_v_collect_ids, __pyx_v_target, __pyx_v_encoding, __pyx_t_6};
    __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_init, __pyx_callargs+__pyx_t_7, (12-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1678, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/parser.pxi":1639
 *     apply to the default parser.
 *     """
 *     def __init__(self, *, encoding=None, attribute_defaults=False,             # <<<<<<<<<<<<<<
 *                  dtd_validation=False, load_dtd=False, no_network=True, decompress=False,
 *                  ns_clean=False, recover=False, XMLSchema schema=None,
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree.XMLParser.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":1683
 * 
 *     # Allow subscripting XMLParser in type annotions (PEP 560)
 *     def __class_getitem__(cls, item):             # <<<<<<<<<<<<<<
 *         return _GenericAlias(cls, item)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9XMLParser_3__class_getitem__(PyObject *__pyx_v_cls, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_9XMLParser_3__class_getitem__ = {"__class_getitem__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_9XMLParser_3__class_getitem__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_9XMLParser_3__class_getitem__(PyObject *__pyx_v_cls, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_item = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__class_getitem__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_item,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(2, 1683, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(2, 1683, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__class_getitem__", 0) < (0)) __PYX_ERR(2, 1683, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__class_getitem__", 1, 1, 1, i); __PYX_ERR(2, 1683, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(2, 1683, __pyx_L3_error)
    }
    __pyx_v_item = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__class_getitem__", 1, 1, 1, __pyx_nargs); __PYX_ERR(2, 1683, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.XMLParser.__class_getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_9XMLParser_2__class_getitem__(((PyTypeObject*)__pyx_v_cls), __pyx_v_item);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_9XMLParser_2__class_getitem__(PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_item) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__class_getitem__", 0);

  /* "src/lxml/parser.pxi":1684
 *     # Allow subscripting XMLParser in type annotions (PEP 560)
 *     def __class_getitem__(cls, item):
 *         return _GenericAlias(cls, item)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = NULL;
  __Pyx_INCREF(__pyx_v_4lxml_5etree__GenericAlias);
  __pyx_t_3 = __pyx_v_4lxml_5etree__GenericAlias; 
  __pyx_t_4 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_4 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_2, ((PyObject *)__pyx_v_cls), __pyx_v_item};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1684, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":1683
 * 
 *     # Allow subscripting XMLParser in type annotions (PEP 560)
 *     def __class_getitem__(cls, item):             # <<<<<<<<<<<<<<
 *         return _GenericAlias(cls, item)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.XMLParser.__class_getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":1705
 *     source, you can pass the ``base_url``.
 *     """
 *     def __init__(self, events=None, *, tag=None, base_url=None, **kwargs):             # <<<<<<<<<<<<<<
 *         XMLParser.__init__(self, **kwargs)
 *         if events is None:
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_13XMLPullParser_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_13XMLPullParser_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_events = 0;
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_v_base_url = 0;
  PyObject *__pyx_v_kwargs = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1;
  __Pyx_GOTREF(__pyx_v_kwargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_events,&__pyx_mstate_global->__pyx_n_u_tag,&__pyx_mstate_global->__pyx_n_u_base_url,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(2, 1705, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(2, 1705, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v_kwargs, values, kwd_pos_args, __pyx_kwds_len, "__init__", 1) < (0)) __PYX_ERR(2, 1705, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
    } else {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(2, 1705, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_events = values[0];
    __pyx_v_tag = values[1];
    __pyx_v_base_url = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, __pyx_nargs); __PYX_ERR(2, 1705, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("lxml.etree.XMLPullParser.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_13XMLPullParser___init__(((struct __pyx_obj_4lxml_5etree_XMLPullParser *)__pyx_v_self), __pyx_v_events, __pyx_v_tag, __pyx_v_base_url, __pyx_v_kwargs);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_13XMLPullParser___init__(struct __pyx_obj_4lxml_5etree_XMLPullParser *__pyx_v_self, PyObject *__pyx_v_events, PyObject *__pyx_v_tag, PyObject *__pyx_v_base_url, PyObject *__pyx_v_kwargs) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_INCREF(__pyx_v_events);

  /* "src/lxml/parser.pxi":1706
 *     """
 *     def __init__(self, events=None, *, tag=None, base_url=None, **kwargs):
 *         XMLParser.__init__(self, **kwargs)             # <<<<<<<<<<<<<<
 *         if events is None:
 *             events = ('end',)
*/
  __pyx_t_2 = NULL;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XMLParser), __pyx_mstate_global->__pyx_n_u_init); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1706, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1706, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = 1;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_5 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, ((PyObject *)__pyx_v_self)};
    __pyx_t_1 = __Pyx_PyObject_FastCallDict((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1706, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/parser.pxi":1707
 *     def __init__(self, events=None, *, tag=None, base_url=None, **kwargs):
 *         XMLParser.__init__(self, **kwargs)
 *         if events is None:             # <<<<<<<<<<<<<<
 *             events = ('end',)
 *         self._setBaseURL(base_url)
*/
  __pyx_t_6 = (__pyx_v_events == Py_None);
  if (__pyx_t_6) {

    /* "src/lxml/parser.pxi":1708
 *         XMLParser.__init__(self, **kwargs)
 *         if events is None:
 *             events = ('end',)             # <<<<<<<<<<<<<<
 *         self._setBaseURL(base_url)
 *         self._collectEvents(events, tag)
*/
    __Pyx_INCREF(__pyx_mstate_global->__pyx_tuple[6]);
    __Pyx_DECREF_SET(__pyx_v_events, __pyx_mstate_global->__pyx_tuple[6]);

    /* "src/lxml/parser.pxi":1707
 *     def __init__(self, events=None, *, tag=None, base_url=None, **kwargs):
 *         XMLParser.__init__(self, **kwargs)
 *         if events is None:             # <<<<<<<<<<<<<<
 *             events = ('end',)
 *         self._setBaseURL(base_url)
*/
  }

  /* "src/lxml/parser.pxi":1709
 *         if events is None:
 *             events = ('end',)
 *         self._setBaseURL(base_url)             # <<<<<<<<<<<<<<
 *         self._collectEvents(events, tag)
 * 
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree_XMLPullParser *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.__pyx_base._setBaseURL(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self), __pyx_v_base_url); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1709, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/parser.pxi":1710
 *             events = ('end',)
 *         self._setBaseURL(base_url)
 *         self._collectEvents(events, tag)             # <<<<<<<<<<<<<<
 * 
 *     def read_events(self):
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree_XMLPullParser *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.__pyx_base._collectEvents(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self), __pyx_v_events, __pyx_v_tag); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1710, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/parser.pxi":1705
 *     source, you can pass the ``base_url``.
 *     """
 *     def __init__(self, events=None, *, tag=None, base_url=None, **kwargs):             # <<<<<<<<<<<<<<
 *         XMLParser.__init__(self, **kwargs)
 *         if events is None:
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.XMLPullParser.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_events);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":1712
 *         self._collectEvents(events, tag)
 * 
 *     def read_events(self):             # <<<<<<<<<<<<<<
 *         return (<_SaxParserContext?>self._getPushParserContext()).events_iterator
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_13XMLPullParser_3read_events(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_13XMLPullParser_3read_events = {"read_events", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_13XMLPullParser_3read_events, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_13XMLPullParser_3read_events(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("read_events (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("read_events", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("read_events", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_13XMLPullParser_2read_events(((struct __pyx_obj_4lxml_5etree_XMLPullParser *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_13XMLPullParser_2read_events(struct __pyx_obj_4lxml_5etree_XMLPullParser *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("read_events", 0);

  /* "src/lxml/parser.pxi":1713
 * 
 *     def read_events(self):
 *         return (<_SaxParserContext?>self._getPushParserContext()).events_iterator             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree_XMLPullParser *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.__pyx_base._getPushParserContext(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self))); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1713, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__SaxParserContext)))) __PYX_ERR(2, 1713, __pyx_L1_error)
  __Pyx_INCREF((PyObject *)((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_t_1)->events_iterator);
  __pyx_r = ((PyObject *)((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_t_1)->events_iterator);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":1712
 *         self._collectEvents(events, tag)
 * 
 *     def read_events(self):             # <<<<<<<<<<<<<<
 *         return (<_SaxParserContext?>self._getPushParserContext()).events_iterator
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.XMLPullParser.read_events", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":1731
 *     and thus ignores comments and processing instructions.
 *     """
 *     def __init__(self, *, encoding=None, attribute_defaults=False,             # <<<<<<<<<<<<<<
 *                  dtd_validation=False, load_dtd=False, no_network=True, decompress=False,
 *                  ns_clean=False, recover=False, schema=None,
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_17ETCompatXMLParser_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_17ETCompatXMLParser_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_encoding = 0;
  PyObject *__pyx_v_attribute_defaults = 0;
  PyObject *__pyx_v_dtd_validation = 0;
  PyObject *__pyx_v_load_dtd = 0;
  PyObject *__pyx_v_no_network = 0;
  PyObject *__pyx_v_decompress = 0;
  PyObject *__pyx_v_ns_clean = 0;
  PyObject *__pyx_v_recover = 0;
  PyObject *__pyx_v_schema = 0;
  PyObject *__pyx_v_huge_tree = 0;
  PyObject *__pyx_v_remove_blank_text = 0;
  PyObject *__pyx_v_resolve_entities = 0;
  PyObject *__pyx_v_remove_comments = 0;
  PyObject *__pyx_v_remove_pis = 0;
  PyObject *__pyx_v_strip_cdata = 0;
  PyObject *__pyx_v_target = 0;
  PyObject *__pyx_v_compact = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[17] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_encoding,&__pyx_mstate_global->__pyx_n_u_attribute_defaults,&__pyx_mstate_global->__pyx_n_u_dtd_validation,&__pyx_mstate_global->__pyx_n_u_load_dtd,&__pyx_mstate_global->__pyx_n_u_no_network,&__pyx_mstate_global->__pyx_n_u_decompress,&__pyx_mstate_global->__pyx_n_u_ns_clean,&__pyx_mstate_global->__pyx_n_u_recover,&__pyx_mstate_global->__pyx_n_u_schema,&__pyx_mstate_global->__pyx_n_u_huge_tree,&__pyx_mstate_global->__pyx_n_u_remove_blank_text,&__pyx_mstate_global->__pyx_n_u_resolve_entities,&__pyx_mstate_global->__pyx_n_u_remove_comments,&__pyx_mstate_global->__pyx_n_u_remove_pis,&__pyx_mstate_global->__pyx_n_u_strip_cdata,&__pyx_mstate_global->__pyx_n_u_target,&__pyx_mstate_global->__pyx_n_u_compact,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(2, 1731, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, 0, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(2, 1731, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_False));

      /* "src/lxml/parser.pxi":1732
 *     """
 *     def __init__(self, *, encoding=None, attribute_defaults=False,
 *                  dtd_validation=False, load_dtd=False, no_network=True, decompress=False,             # <<<<<<<<<<<<<<
 *                  ns_clean=False, recover=False, schema=None,
 *                  huge_tree=False, remove_blank_text=False, resolve_entities=True,
*/
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_True));
      if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)Py_False));

      /* "src/lxml/parser.pxi":1733
 *     def __init__(self, *, encoding=None, attribute_defaults=False,
 *                  dtd_validation=False, load_dtd=False, no_network=True, decompress=False,
 *                  ns_clean=False, recover=False, schema=None,             # <<<<<<<<<<<<<<
 *                  huge_tree=False, remove_blank_text=False, resolve_entities=True,
 *                  remove_comments=True, remove_pis=True, strip_cdata=True,
*/
      if (!values[6]) values[6] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[7]) values[7] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[8]) values[8] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "src/lxml/parser.pxi":1734
 *                  dtd_validation=False, load_dtd=False, no_network=True, decompress=False,
 *                  ns_clean=False, recover=False, schema=None,
 *                  huge_tree=False, remove_blank_text=False, resolve_entities=True,             # <<<<<<<<<<<<<<
 *                  remove_comments=True, remove_pis=True, strip_cdata=True,
 *                  target=None, compact=True):
*/
      if (!values[9]) values[9] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[10]) values[10] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[11]) values[11] = __Pyx_NewRef(((PyObject *)Py_True));

      /* "src/lxml/parser.pxi":1735
 *                  ns_clean=False, recover=False, schema=None,
 *                  huge_tree=False, remove_blank_text=False, resolve_entities=True,
 *                  remove_comments=True, remove_pis=True, strip_cdata=True,             # <<<<<<<<<<<<<<
 *                  target=None, compact=True):
 *         XMLParser.__init__(self,
*/
      if (!values[12]) values[12] = __Pyx_NewRef(((PyObject *)Py_True));
      if (!values[13]) values[13] = __Pyx_NewRef(((PyObject *)Py_True));
      if (!values[14]) values[14] = __Pyx_NewRef(((PyObject *)Py_True));

      /* "src/lxml/parser.pxi":1736
 *                  huge_tree=False, remove_blank_text=False, resolve_entities=True,
 *                  remove_comments=True, remove_pis=True, strip_cdata=True,
 *                  target=None, compact=True):             # <<<<<<<<<<<<<<
 *         XMLParser.__init__(self,
 *                            attribute_defaults=attribute_defaults,
*/
      if (!values[15]) values[15] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[16]) values[16] = __Pyx_NewRef(((PyObject *)Py_True));
    } else if (unlikely(__pyx_nargs != 0)) {
      goto __pyx_L5_argtuple_error;
    } else {

      /* "src/lxml/parser.pxi":1731
 *     and thus ignores comments and processing instructions.
 *     """
 *     def __init__(self, *, encoding=None, attribute_defaults=False,             # <<<<<<<<<<<<<<
 *                  dtd_validation=False, load_dtd=False, no_network=True, decompress=False,
 *                  ns_clean=False, recover=False, schema=None,
*/
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_False));

      /* "src/lxml/parser.pxi":1732
 *     """
 *     def __init__(self, *, encoding=None, attribute_defaults=False,
 *                  dtd_validation=False, load_dtd=False, no_network=True, decompress=False,             # <<<<<<<<<<<<<<
 *                  ns_clean=False, recover=False, schema=None,
 *                  huge_tree=False, remove_blank_text=False, resolve_entities=True,
*/
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_True));
      if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)Py_False));

      /* "src/lxml/parser.pxi":1733
 *     def __init__(self, *, encoding=None, attribute_defaults=False,
 *                  dtd_validation=False, load_dtd=False, no_network=True, decompress=False,
 *                  ns_clean=False, recover=False, schema=None,             # <<<<<<<<<<<<<<
 *                  huge_tree=False, remove_blank_text=False, resolve_entities=True,
 *                  remove_comments=True, remove_pis=True, strip_cdata=True,
*/
      if (!values[6]) values[6] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[7]) values[7] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[8]) values[8] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "src/lxml/parser.pxi":1734
 *                  dtd_validation=False, load_dtd=False, no_network=True, decompress=False,
 *                  ns_clean=False, recover=False, schema=None,
 *                  huge_tree=False, remove_blank_text=False, resolve_entities=True,             # <<<<<<<<<<<<<<
 *                  remove_comments=True, remove_pis=True, strip_cdata=True,
 *                  target=None, compact=True):
*/
      if (!values[9]) values[9] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[10]) values[10] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[11]) values[11] = __Pyx_NewRef(((PyObject *)Py_True));

      /* "src/lxml/parser.pxi":1735
 *                  ns_clean=False, recover=False, schema=None,
 *                  huge_tree=False, remove_blank_text=False, resolve_entities=True,
 *                  remove_comments=True, remove_pis=True, strip_cdata=True,             # <<<<<<<<<<<<<<
 *                  target=None, compact=True):
 *         XMLParser.__init__(self,
*/
      if (!values[12]) values[12] = __Pyx_NewRef(((PyObject *)Py_True));
      if (!values[13]) values[13] = __Pyx_NewRef(((PyObject *)Py_True));
      if (!values[14]) values[14] = __Pyx_NewRef(((PyObject *)Py_True));

      /* "src/lxml/parser.pxi":1736
 *                  huge_tree=False, remove_blank_text=False, resolve_entities=True,
 *                  remove_comments=True, remove_pis=True, strip_cdata=True,
 *                  target=None, compact=True):             # <<<<<<<<<<<<<<
 *         XMLParser.__init__(self,
 *                            attribute_defaults=attribute_defaults,
*/
      if (!values[15]) values[15] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[16]) values[16] = __Pyx_NewRef(((PyObject *)Py_True));
    }
    __pyx_v_encoding = values[0];
    __pyx_v_attribute_defaults = values[1];
    __pyx_v_dtd_validation = values[2];
    __pyx_v_load_dtd = values[3];
    __pyx_v_no_network = values[4];
    __pyx_v_decompress = values[5];
    __pyx_v_ns_clean = values[6];
    __pyx_v_recover = values[7];
    __pyx_v_schema = values[8];
    __pyx_v_huge_tree = values[9];
    __pyx_v_remove_blank_text = values[10];
    __pyx_v_resolve_entities = values[11];
    __pyx_v_remove_comments = values[12];
    __pyx_v_remove_pis = values[13];
    __pyx_v_strip_cdata = values[14];
    __pyx_v_target = values[15];
    __pyx_v_compact = values[16];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, __pyx_nargs); __PYX_ERR(2, 1731, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.ETCompatXMLParser.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_17ETCompatXMLParser___init__(((struct __pyx_obj_4lxml_5etree_ETCompatXMLParser *)__pyx_v_self), __pyx_v_encoding, __pyx_v_attribute_defaults, __pyx_v_dtd_validation, __pyx_v_load_dtd, __pyx_v_no_network, __pyx_v_decompress, __pyx_v_ns_clean, __pyx_v_recover, __pyx_v_schema, __pyx_v_huge_tree, __pyx_v_remove_blank_text, __pyx_v_resolve_entities, __pyx_v_remove_comments, __pyx_v_remove_pis, __pyx_v_strip_cdata, __pyx_v_target, __pyx_v_compact);

  /* "src/lxml/parser.pxi":1731
 *     and thus ignores comments and processing instructions.
 *     """
 *     def __init__(self, *, encoding=None, attribute_defaults=False,             # <<<<<<<<<<<<<<
 *                  dtd_validation=False, load_dtd=False, no_network=True, decompress=False,
 *                  ns_clean=False, recover=False, schema=None,
*/

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_17ETCompatXMLParser___init__(struct __pyx_obj_4lxml_5etree_ETCompatXMLParser *__pyx_v_self, PyObject *__pyx_v_encoding, PyObject *__pyx_v_attribute_defaults, PyObject *__pyx_v_dtd_validation, PyObject *__pyx_v_load_dtd, PyObject *__pyx_v_no_network, PyObject *__pyx_v_decompress, PyObject *__pyx_v_ns_clean, PyObject *__pyx_v_recover, PyObject *__pyx_v_schema, PyObject *__pyx_v_huge_tree, PyObject *__pyx_v_remove_blank_text, PyObject *__pyx_v_resolve_entities, PyObject *__pyx_v_remove_comments, PyObject *__pyx_v_remove_pis, PyObject *__pyx_v_strip_cdata, PyObject *__pyx_v_target, PyObject *__pyx_v_compact) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "src/lxml/parser.pxi":1737
 *                  remove_comments=True, remove_pis=True, strip_cdata=True,
 *                  target=None, compact=True):
 *         XMLParser.__init__(self,             # <<<<<<<<<<<<<<
 *                            attribute_defaults=attribute_defaults,
 *                            dtd_validation=dtd_validation,
*/
  __pyx_t_2 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XMLParser);
  __Pyx_INCREF(__pyx_t_2);

  /* "src/lxml/parser.pxi":1754
 *                            target=target,
 *                            encoding=encoding,
 *                            schema=schema,             # <<<<<<<<<<<<<<
 *                            )
 * 
*/
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 17 : 0)] = {__pyx_t_2, ((PyObject *)__pyx_v_self)};
    __pyx_t_4 = __Pyx_MakeVectorcallBuilderKwds(17); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1737, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_attribute_defaults, __pyx_v_attribute_defaults, __pyx_t_4, __pyx_callargs+2, 0) < (0)) __PYX_ERR(2, 1737, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtd_validation, __pyx_v_dtd_validation, __pyx_t_4, __pyx_callargs+2, 1) < (0)) __PYX_ERR(2, 1737, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_load_dtd, __pyx_v_load_dtd, __pyx_t_4, __pyx_callargs+2, 2) < (0)) __PYX_ERR(2, 1737, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_no_network, __pyx_v_no_network, __pyx_t_4, __pyx_callargs+2, 3) < (0)) __PYX_ERR(2, 1737, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_decompress, __pyx_v_decompress, __pyx_t_4, __pyx_callargs+2, 4) < (0)) __PYX_ERR(2, 1737, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_ns_clean, __pyx_v_ns_clean, __pyx_t_4, __pyx_callargs+2, 5) < (0)) __PYX_ERR(2, 1737, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_recover, __pyx_v_recover, __pyx_t_4, __pyx_callargs+2, 6) < (0)) __PYX_ERR(2, 1737, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_remove_blank_text, __pyx_v_remove_blank_text, __pyx_t_4, __pyx_callargs+2, 7) < (0)) __PYX_ERR(2, 1737, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_huge_tree, __pyx_v_huge_tree, __pyx_t_4, __pyx_callargs+2, 8) < (0)) __PYX_ERR(2, 1737, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_compact, __pyx_v_compact, __pyx_t_4, __pyx_callargs+2, 9) < (0)) __PYX_ERR(2, 1737, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_resolve_entities, __pyx_v_resolve_entities, __pyx_t_4, __pyx_callargs+2, 10) < (0)) __PYX_ERR(2, 1737, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_remove_comments, __pyx_v_remove_comments, __pyx_t_4, __pyx_callargs+2, 11) < (0)) __PYX_ERR(2, 1737, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_remove_pis, __pyx_v_remove_pis, __pyx_t_4, __pyx_callargs+2, 12) < (0)) __PYX_ERR(2, 1737, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_strip_cdata, __pyx_v_strip_cdata, __pyx_t_4, __pyx_callargs+2, 13) < (0)) __PYX_ERR(2, 1737, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_target, __pyx_v_target, __pyx_t_4, __pyx_callargs+2, 14) < (0)) __PYX_ERR(2, 1737, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_encoding, __pyx_v_encoding, __pyx_t_4, __pyx_callargs+2, 15) < (0)) __PYX_ERR(2, 1737, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_schema, __pyx_v_schema, __pyx_t_4, __pyx_callargs+2, 16) < (0)) __PYX_ERR(2, 1737, __pyx_L1_error)
    __pyx_t_1 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_init, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1737, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/parser.pxi":1731
 *     and thus ignores comments and processing instructions.
 *     """
 *     def __init__(self, *, encoding=None, attribute_defaults=False,             # <<<<<<<<<<<<<<
 *                  dtd_validation=False, load_dtd=False, no_network=True, decompress=False,
 *                  ns_clean=False, recover=False, schema=None,
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.ETCompatXMLParser.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":1766
 * __GLOBAL_PARSER_CONTEXT.setDefaultParser(__DEFAULT_XML_PARSER)
 * 
 * def set_default_parser(_BaseParser parser=None):             # <<<<<<<<<<<<<<
 *     """set_default_parser(parser=None)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_45set_default_parser(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_44set_default_parser, "set_default_parser(parser=None)\n\n    Set a default parser for the current thread.  This parser is used\n    globally whenever no parser is supplied to the various parse functions of\n    the lxml API.  If this function is called without a parser (or if it is\n    None), the default parser is reset to the original configuration.\n\n    Note that the pre-installed default parser is not thread-safe.  Avoid the\n    default parser in multi-threaded environments.  You can create a separate\n    parser for each thread explicitly or use a parser pool.\n    ");
static PyMethodDef __pyx_mdef_4lxml_5etree_45set_default_parser = {"set_default_parser", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_45set_default_parser, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_44set_default_parser};
static PyObject *__pyx_pw_4lxml_5etree_45set_default_parser(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_default_parser (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_parser,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(2, 1766, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(2, 1766, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "set_default_parser", 0) < (0)) __PYX_ERR(2, 1766, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef((PyObject *)((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None));
    } else {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(2, 1766, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef((PyObject *)((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None));
    }
    __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)values[0]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_default_parser", 0, 0, 1, __pyx_nargs); __PYX_ERR(2, 1766, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.set_default_parser", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parser), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__BaseParser, 1, "parser", 0))) __PYX_ERR(2, 1766, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_44set_default_parser(__pyx_self, __pyx_v_parser);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_44set_default_parser(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_default_parser", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_parser);

  /* "src/lxml/parser.pxi":1778
 *     parser for each thread explicitly or use a parser pool.
 *     """
 *     if parser is None:             # <<<<<<<<<<<<<<
 *         parser = __DEFAULT_XML_PARSER
 *     __GLOBAL_PARSER_CONTEXT.setDefaultParser(parser)
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_parser) == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":1779
 *     """
 *     if parser is None:
 *         parser = __DEFAULT_XML_PARSER             # <<<<<<<<<<<<<<
 *     __GLOBAL_PARSER_CONTEXT.setDefaultParser(parser)
 * 
*/
    __Pyx_INCREF((PyObject *)__pyx_v_4lxml_5etree___DEFAULT_XML_PARSER);
    __Pyx_DECREF_SET(__pyx_v_parser, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_4lxml_5etree___DEFAULT_XML_PARSER));

    /* "src/lxml/parser.pxi":1778
 *     parser for each thread explicitly or use a parser pool.
 *     """
 *     if parser is None:             # <<<<<<<<<<<<<<
 *         parser = __DEFAULT_XML_PARSER
 *     __GLOBAL_PARSER_CONTEXT.setDefaultParser(parser)
*/
  }

  /* "src/lxml/parser.pxi":1780
 *     if parser is None:
 *         parser = __DEFAULT_XML_PARSER
 *     __GLOBAL_PARSER_CONTEXT.setDefaultParser(parser)             # <<<<<<<<<<<<<<
 * 
 * def get_default_parser():
*/
  __pyx_t_2 = __pyx_f_4lxml_5etree_24_ParserDictionaryContext_setDefaultParser(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, __pyx_v_parser); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(2, 1780, __pyx_L1_error)

  /* "src/lxml/parser.pxi":1766
 * __GLOBAL_PARSER_CONTEXT.setDefaultParser(__DEFAULT_XML_PARSER)
 * 
 * def set_default_parser(_BaseParser parser=None):             # <<<<<<<<<<<<<<
 *     """set_default_parser(parser=None)
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.set_default_parser", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_parser);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":1782
 *     __GLOBAL_PARSER_CONTEXT.setDefaultParser(parser)
 * 
 * def get_default_parser():             # <<<<<<<<<<<<<<
 *     "get_default_parser()"
 *     return __GLOBAL_PARSER_CONTEXT.getDefaultParser()
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_47get_default_parser(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_46get_default_parser, "get_default_parser()");
static PyMethodDef __pyx_mdef_4lxml_5etree_47get_default_parser = {"get_default_parser", (PyCFunction)__pyx_pw_4lxml_5etree_47get_default_parser, METH_NOARGS, __pyx_doc_4lxml_5etree_46get_default_parser};
static PyObject *__pyx_pw_4lxml_5etree_47get_default_parser(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_default_parser (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_46get_default_parser(__pyx_self);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_46get_default_parser(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_default_parser", 0);

  /* "src/lxml/parser.pxi":1784
 * def get_default_parser():
 *     "get_default_parser()"
 *     return __GLOBAL_PARSER_CONTEXT.getDefaultParser()             # <<<<<<<<<<<<<<
 * 
 * ############################################################
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree_24_ParserDictionaryContext_getDefaultParser(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1784, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":1782
 *     __GLOBAL_PARSER_CONTEXT.setDefaultParser(parser)
 * 
 * def get_default_parser():             # <<<<<<<<<<<<<<
 *     "get_default_parser()"
 *     return __GLOBAL_PARSER_CONTEXT.getDefaultParser()
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.get_default_parser", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":1836
 *     reasons.
 *     """
 *     def __init__(self, *, encoding=None, remove_blank_text=False,             # <<<<<<<<<<<<<<
 *                  remove_comments=False, remove_pis=False, strip_cdata=_UNUSED,
 *                  no_network=True, decompress=False, target=None, XMLSchema schema=None,
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_10HTMLParser_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_10HTMLParser_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_encoding = 0;
  PyObject *__pyx_v_remove_blank_text = 0;
  PyObject *__pyx_v_remove_comments = 0;
  PyObject *__pyx_v_remove_pis = 0;
  PyObject *__pyx_v_strip_cdata = 0;
  PyObject *__pyx_v_no_network = 0;
  PyObject *__pyx_v_decompress = 0;
  PyObject *__pyx_v_target = 0;
  struct __pyx_obj_4lxml_5etree_XMLSchema *__pyx_v_schema = 0;
  PyObject *__pyx_v_recover = 0;
  PyObject *__pyx_v_compact = 0;
  PyObject *__pyx_v_default_doctype = 0;
  PyObject *__pyx_v_collect_ids = 0;
  PyObject *__pyx_v_huge_tree = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[14] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_encoding,&__pyx_mstate_global->__pyx_n_u_remove_blank_text,&__pyx_mstate_global->__pyx_n_u_remove_comments,&__pyx_mstate_global->__pyx_n_u_remove_pis,&__pyx_mstate_global->__pyx_n_u_strip_cdata,&__pyx_mstate_global->__pyx_n_u_no_network,&__pyx_mstate_global->__pyx_n_u_decompress,&__pyx_mstate_global->__pyx_n_u_target,&__pyx_mstate_global->__pyx_n_u_schema,&__pyx_mstate_global->__pyx_n_u_recover,&__pyx_mstate_global->__pyx_n_u_compact,&__pyx_mstate_global->__pyx_n_u_default_doctype,&__pyx_mstate_global->__pyx_n_u_collect_ids,&__pyx_mstate_global->__pyx_n_u_huge_tree,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(2, 1836, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, 0, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(2, 1836, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_False));

      /* "src/lxml/parser.pxi":1837
 *     """
 *     def __init__(self, *, encoding=None, remove_blank_text=False,
 *                  remove_comments=False, remove_pis=False, strip_cdata=_UNUSED,             # <<<<<<<<<<<<<<
 *                  no_network=True, decompress=False, target=None, XMLSchema schema=None,
 *                  recover=True, compact=True, default_doctype=True,
*/
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[4]) values[4] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__30);

      /* "src/lxml/parser.pxi":1838
 *     def __init__(self, *, encoding=None, remove_blank_text=False,
 *                  remove_comments=False, remove_pis=False, strip_cdata=_UNUSED,
 *                  no_network=True, decompress=False, target=None, XMLSchema schema=None,             # <<<<<<<<<<<<<<
 *                  recover=True, compact=True, default_doctype=True,
 *                  collect_ids=True, huge_tree=False):
*/
      if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)Py_True));
      if (!values[6]) values[6] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[7]) values[7] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[8]) values[8] = __Pyx_NewRef((PyObject *)((struct __pyx_obj_4lxml_5etree_XMLSchema *)Py_None));

      /* "src/lxml/parser.pxi":1839
 *                  remove_comments=False, remove_pis=False, strip_cdata=_UNUSED,
 *                  no_network=True, decompress=False, target=None, XMLSchema schema=None,
 *                  recover=True, compact=True, default_doctype=True,             # <<<<<<<<<<<<<<
 *                  collect_ids=True, huge_tree=False):
 *         cdef int parse_options
*/
      if (!values[9]) values[9] = __Pyx_NewRef(((PyObject *)Py_True));
      if (!values[10]) values[10] = __Pyx_NewRef(((PyObject *)Py_True));
      if (!values[11]) values[11] = __Pyx_NewRef(((PyObject *)Py_True));

      /* "src/lxml/parser.pxi":1840
 *                  no_network=True, decompress=False, target=None, XMLSchema schema=None,
 *                  recover=True, compact=True, default_doctype=True,
 *                  collect_ids=True, huge_tree=False):             # <<<<<<<<<<<<<<
 *         cdef int parse_options
 *         parse_options = _HTML_DEFAULT_PARSE_OPTIONS
*/
      if (!values[12]) values[12] = __Pyx_NewRef(((PyObject *)Py_True));
      if (!values[13]) values[13] = __Pyx_NewRef(((PyObject *)Py_False));
    } else if (unlikely(__pyx_nargs != 0)) {
      goto __pyx_L5_argtuple_error;
    } else {

      /* "src/lxml/parser.pxi":1836
 *     reasons.
 *     """
 *     def __init__(self, *, encoding=None, remove_blank_text=False,             # <<<<<<<<<<<<<<
 *                  remove_comments=False, remove_pis=False, strip_cdata=_UNUSED,
 *                  no_network=True, decompress=False, target=None, XMLSchema schema=None,
*/
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_False));

      /* "src/lxml/parser.pxi":1837
 *     """
 *     def __init__(self, *, encoding=None, remove_blank_text=False,
 *                  remove_comments=False, remove_pis=False, strip_cdata=_UNUSED,             # <<<<<<<<<<<<<<
 *                  no_network=True, decompress=False, target=None, XMLSchema schema=None,
 *                  recover=True, compact=True, default_doctype=True,
*/
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[4]) values[4] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__30);

      /* "src/lxml/parser.pxi":1838
 *     def __init__(self, *, encoding=None, remove_blank_text=False,
 *                  remove_comments=False, remove_pis=False, strip_cdata=_UNUSED,
 *                  no_network=True, decompress=False, target=None, XMLSchema schema=None,             # <<<<<<<<<<<<<<
 *                  recover=True, compact=True, default_doctype=True,
 *                  collect_ids=True, huge_tree=False):
*/
      if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)Py_True));
      if (!values[6]) values[6] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[7]) values[7] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[8]) values[8] = __Pyx_NewRef((PyObject *)((struct __pyx_obj_4lxml_5etree_XMLSchema *)Py_None));

      /* "src/lxml/parser.pxi":1839
 *                  remove_comments=False, remove_pis=False, strip_cdata=_UNUSED,
 *                  no_network=True, decompress=False, target=None, XMLSchema schema=None,
 *                  recover=True, compact=True, default_doctype=True,             # <<<<<<<<<<<<<<
 *                  collect_ids=True, huge_tree=False):
 *         cdef int parse_options
*/
      if (!values[9]) values[9] = __Pyx_NewRef(((PyObject *)Py_True));
      if (!values[10]) values[10] = __Pyx_NewRef(((PyObject *)Py_True));
      if (!values[11]) values[11] = __Pyx_NewRef(((PyObject *)Py_True));

      /* "src/lxml/parser.pxi":1840
 *                  no_network=True, decompress=False, target=None, XMLSchema schema=None,
 *                  recover=True, compact=True, default_doctype=True,
 *                  collect_ids=True, huge_tree=False):             # <<<<<<<<<<<<<<
 *         cdef int parse_options
 *         parse_options = _HTML_DEFAULT_PARSE_OPTIONS
*/
      if (!values[12]) values[12] = __Pyx_NewRef(((PyObject *)Py_True));
      if (!values[13]) values[13] = __Pyx_NewRef(((PyObject *)Py_False));
    }
    __pyx_v_encoding = values[0];
    __pyx_v_remove_blank_text = values[1];
    __pyx_v_remove_comments = values[2];
    __pyx_v_remove_pis = values[3];
    __pyx_v_strip_cdata = values[4];
    __pyx_v_no_network = values[5];
    __pyx_v_decompress = values[6];
    __pyx_v_target = values[7];
    __pyx_v_schema = ((struct __pyx_obj_4lxml_5etree_XMLSchema *)values[8]);
    __pyx_v_recover = values[9];
    __pyx_v_compact = values[10];
    __pyx_v_default_doctype = values[11];
    __pyx_v_collect_ids = values[12];
    __pyx_v_huge_tree = values[13];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, __pyx_nargs); __PYX_ERR(2, 1836, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.HTMLParser.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_schema), __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XMLSchema, 1, "schema", 0))) __PYX_ERR(2, 1838, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_10HTMLParser___init__(((struct __pyx_obj_4lxml_5etree_HTMLParser *)__pyx_v_self), __pyx_v_encoding, __pyx_v_remove_blank_text, __pyx_v_remove_comments, __pyx_v_remove_pis, __pyx_v_strip_cdata, __pyx_v_no_network, __pyx_v_decompress, __pyx_v_target, __pyx_v_schema, __pyx_v_recover, __pyx_v_compact, __pyx_v_default_doctype, __pyx_v_collect_ids, __pyx_v_huge_tree);

  /* "src/lxml/parser.pxi":1836
 *     reasons.
 *     """
 *     def __init__(self, *, encoding=None, remove_blank_text=False,             # <<<<<<<<<<<<<<
 *                  remove_comments=False, remove_pis=False, strip_cdata=_UNUSED,
 *                  no_network=True, decompress=False, target=None, XMLSchema schema=None,
*/

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_10HTMLParser___init__(struct __pyx_obj_4lxml_5etree_HTMLParser *__pyx_v_self, PyObject *__pyx_v_encoding, PyObject *__pyx_v_remove_blank_text, PyObject *__pyx_v_remove_comments, PyObject *__pyx_v_remove_pis, PyObject *__pyx_v_strip_cdata, PyObject *__pyx_v_no_network, PyObject *__pyx_v_decompress, PyObject *__pyx_v_target, struct __pyx_obj_4lxml_5etree_XMLSchema *__pyx_v_schema, PyObject *__pyx_v_recover, PyObject *__pyx_v_compact, PyObject *__pyx_v_default_doctype, PyObject *__pyx_v_collect_ids, PyObject *__pyx_v_huge_tree) {
  int __pyx_v_parse_options;
  PyObject *__pyx_v_warnings = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "src/lxml/parser.pxi":1842
 *                  collect_ids=True, huge_tree=False):
 *         cdef int parse_options
 *         parse_options = _HTML_DEFAULT_PARSE_OPTIONS             # <<<<<<<<<<<<<<
 *         if remove_blank_text:
 *             parse_options = parse_options | htmlparser.HTML_PARSE_NOBLANKS
*/
  __pyx_v_parse_options = __pyx_v_4lxml_5etree__HTML_DEFAULT_PARSE_OPTIONS;

  /* "src/lxml/parser.pxi":1843
 *         cdef int parse_options
 *         parse_options = _HTML_DEFAULT_PARSE_OPTIONS
 *         if remove_blank_text:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options | htmlparser.HTML_PARSE_NOBLANKS
 *         if not recover:
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_remove_blank_text); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(2, 1843, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":1844
 *         parse_options = _HTML_DEFAULT_PARSE_OPTIONS
 *         if remove_blank_text:
 *             parse_options = parse_options | htmlparser.HTML_PARSE_NOBLANKS             # <<<<<<<<<<<<<<
 *         if not recover:
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_RECOVER
*/
    __pyx_v_parse_options = (__pyx_v_parse_options | HTML_PARSE_NOBLANKS);

    /* "src/lxml/parser.pxi":1843
 *         cdef int parse_options
 *         parse_options = _HTML_DEFAULT_PARSE_OPTIONS
 *         if remove_blank_text:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options | htmlparser.HTML_PARSE_NOBLANKS
 *         if not recover:
*/
  }

  /* "src/lxml/parser.pxi":1845
 *         if remove_blank_text:
 *             parse_options = parse_options | htmlparser.HTML_PARSE_NOBLANKS
 *         if not recover:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_RECOVER
 *         if not no_network:
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_recover); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(2, 1845, __pyx_L1_error)
  __pyx_t_2 = (!__pyx_t_1);
  if (__pyx_t_2) {

    /* "src/lxml/parser.pxi":1846
 *             parse_options = parse_options | htmlparser.HTML_PARSE_NOBLANKS
 *         if not recover:
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_RECOVER             # <<<<<<<<<<<<<<
 *         if not no_network:
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_NONET
*/
    __pyx_v_parse_options = (__pyx_v_parse_options ^ HTML_PARSE_RECOVER);

    /* "src/lxml/parser.pxi":1845
 *         if remove_blank_text:
 *             parse_options = parse_options | htmlparser.HTML_PARSE_NOBLANKS
 *         if not recover:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_RECOVER
 *         if not no_network:
*/
  }

  /* "src/lxml/parser.pxi":1847
 *         if not recover:
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_RECOVER
 *         if not no_network:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_NONET
 *         if not compact:
*/
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_no_network); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(2, 1847, __pyx_L1_error)
  __pyx_t_1 = (!__pyx_t_2);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":1848
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_RECOVER
 *         if not no_network:
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_NONET             # <<<<<<<<<<<<<<
 *         if not compact:
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_COMPACT
*/
    __pyx_v_parse_options = (__pyx_v_parse_options ^ HTML_PARSE_NONET);

    /* "src/lxml/parser.pxi":1847
 *         if not recover:
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_RECOVER
 *         if not no_network:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_NONET
 *         if not compact:
*/
  }

  /* "src/lxml/parser.pxi":1849
 *         if not no_network:
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_NONET
 *         if not compact:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_COMPACT
 *         if not default_doctype:
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_compact); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(2, 1849, __pyx_L1_error)
  __pyx_t_2 = (!__pyx_t_1);
  if (__pyx_t_2) {

    /* "src/lxml/parser.pxi":1850
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_NONET
 *         if not compact:
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_COMPACT             # <<<<<<<<<<<<<<
 *         if not default_doctype:
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_NODEFDTD
*/
    __pyx_v_parse_options = (__pyx_v_parse_options ^ HTML_PARSE_COMPACT);

    /* "src/lxml/parser.pxi":1849
 *         if not no_network:
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_NONET
 *         if not compact:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_COMPACT
 *         if not default_doctype:
*/
  }

  /* "src/lxml/parser.pxi":1851
 *         if not compact:
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_COMPACT
 *         if not default_doctype:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_NODEFDTD
 *         if huge_tree:
*/
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_default_doctype); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(2, 1851, __pyx_L1_error)
  __pyx_t_1 = (!__pyx_t_2);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":1852
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_COMPACT
 *         if not default_doctype:
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_NODEFDTD             # <<<<<<<<<<<<<<
 *         if huge_tree:
 *             parse_options = parse_options | xmlparser.XML_PARSE_HUGE
*/
    __pyx_v_parse_options = (__pyx_v_parse_options ^ HTML_PARSE_NODEFDTD);

    /* "src/lxml/parser.pxi":1851
 *         if not compact:
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_COMPACT
 *         if not default_doctype:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_NODEFDTD
 *         if huge_tree:
*/
  }

  /* "src/lxml/parser.pxi":1853
 *         if not default_doctype:
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_NODEFDTD
 *         if huge_tree:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options | xmlparser.XML_PARSE_HUGE
 *         if decompress:
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_huge_tree); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(2, 1853, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":1854
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_NODEFDTD
 *         if huge_tree:
 *             parse_options = parse_options | xmlparser.XML_PARSE_HUGE             # <<<<<<<<<<<<<<
 *         if decompress:
 *             parse_options |= xmlparser.XML_PARSE_UNZIP
*/
    __pyx_v_parse_options = (__pyx_v_parse_options | XML_PARSE_HUGE);

    /* "src/lxml/parser.pxi":1853
 *         if not default_doctype:
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_NODEFDTD
 *         if huge_tree:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options | xmlparser.XML_PARSE_HUGE
 *         if decompress:
*/
  }

  /* "src/lxml/parser.pxi":1855
 *         if huge_tree:
 *             parse_options = parse_options | xmlparser.XML_PARSE_HUGE
 *         if decompress:             # <<<<<<<<<<<<<<
 *             parse_options |= xmlparser.XML_PARSE_UNZIP
 * 
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_decompress); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(2, 1855, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":1856
 *             parse_options = parse_options | xmlparser.XML_PARSE_HUGE
 *         if decompress:
 *             parse_options |= xmlparser.XML_PARSE_UNZIP             # <<<<<<<<<<<<<<
 * 
 *         if strip_cdata is not _UNUSED:
*/
    __pyx_v_parse_options = (__pyx_v_parse_options | XML_PARSE_UNZIP);

    /* "src/lxml/parser.pxi":1855
 *         if huge_tree:
 *             parse_options = parse_options | xmlparser.XML_PARSE_HUGE
 *         if decompress:             # <<<<<<<<<<<<<<
 *             parse_options |= xmlparser.XML_PARSE_UNZIP
 * 
*/
  }

  /* "src/lxml/parser.pxi":1858
 *             parse_options |= xmlparser.XML_PARSE_UNZIP
 * 
 *         if strip_cdata is not _UNUSED:             # <<<<<<<<<<<<<<
 *             import warnings
 *             warnings.warn(
*/
  __pyx_t_1 = (__pyx_v_strip_cdata != __pyx_v_4lxml_5etree__UNUSED);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":1859
 * 
 *         if strip_cdata is not _UNUSED:
 *             import warnings             # <<<<<<<<<<<<<<
 *             warnings.warn(
 *                 "The 'strip_cdata' option of HTMLParser() has never done anything and will eventually be removed.",
*/
    __pyx_t_4 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_warnings, 0, 0, NULL, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1859, __pyx_L1_error)
    __pyx_t_3 = __pyx_t_4;
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_warnings = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "src/lxml/parser.pxi":1860
 *         if strip_cdata is not _UNUSED:
 *             import warnings
 *             warnings.warn(             # <<<<<<<<<<<<<<
 *                 "The 'strip_cdata' option of HTMLParser() has never done anything and will eventually be removed.",
 *                 DeprecationWarning)
*/
    __pyx_t_5 = __pyx_v_warnings;
    __Pyx_INCREF(__pyx_t_5);

    /* "src/lxml/parser.pxi":1862
 *             warnings.warn(
 *                 "The 'strip_cdata' option of HTMLParser() has never done anything and will eventually be removed.",
 *                 DeprecationWarning)             # <<<<<<<<<<<<<<
 *         _BaseParser.__init__(self, parse_options, True, schema,
 *                              remove_comments, remove_pis, strip_cdata,
*/
    __pyx_t_6 = 0;
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_The_strip_cdata_option_of_HTMLPa, ((PyObject *)(((PyTypeObject*)PyExc_DeprecationWarning)))};
      __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_warn, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1860, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/parser.pxi":1858
 *             parse_options |= xmlparser.XML_PARSE_UNZIP
 * 
 *         if strip_cdata is not _UNUSED:             # <<<<<<<<<<<<<<
 *             import warnings
 *             warnings.warn(
*/
  }

  /* "src/lxml/parser.pxi":1863
 *                 "The 'strip_cdata' option of HTMLParser() has never done anything and will eventually be removed.",
 *                 DeprecationWarning)
 *         _BaseParser.__init__(self, parse_options, True, schema,             # <<<<<<<<<<<<<<
 *                              remove_comments, remove_pis, strip_cdata,
 *                              collect_ids, target, encoding)
*/
  __pyx_t_5 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__BaseParser);
  __Pyx_INCREF(__pyx_t_5);
  __pyx_t_7 = __Pyx_PyLong_From_int(__pyx_v_parse_options); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 1863, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);

  /* "src/lxml/parser.pxi":1865
 *         _BaseParser.__init__(self, parse_options, True, schema,
 *                              remove_comments, remove_pis, strip_cdata,
 *                              collect_ids, target, encoding)             # <<<<<<<<<<<<<<
 * 
 *     # Allow subscripting HTMLParser in type annotions (PEP 560)
*/
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[11] = {__pyx_t_5, ((PyObject *)__pyx_v_self), __pyx_t_7, Py_True, ((PyObject *)__pyx_v_schema), __pyx_v_remove_comments, __pyx_v_remove_pis, __pyx_v_strip_cdata, __pyx_v_collect_ids, __pyx_v_target, __pyx_v_encoding};
    __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_init, __pyx_callargs+__pyx_t_6, (11-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1863, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/parser.pxi":1836
 *     reasons.
 *     """
 *     def __init__(self, *, encoding=None, remove_blank_text=False,             # <<<<<<<<<<<<<<
 *                  remove_comments=False, remove_pis=False, strip_cdata=_UNUSED,
 *                  no_network=True, decompress=False, target=None, XMLSchema schema=None,
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree.HTMLParser.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warnings);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":1868
 * 
 *     # Allow subscripting HTMLParser in type annotions (PEP 560)
 *     def __class_getitem__(cls, item):             # <<<<<<<<<<<<<<
 *         return _GenericAlias(cls, item)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_10HTMLParser_3__class_getitem__(PyObject *__pyx_v_cls, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_10HTMLParser_3__class_getitem__ = {"__class_getitem__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_10HTMLParser_3__class_getitem__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_10HTMLParser_3__class_getitem__(PyObject *__pyx_v_cls, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_item = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__class_getitem__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_item,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(2, 1868, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(2, 1868, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__class_getitem__", 0) < (0)) __PYX_ERR(2, 1868, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__class_getitem__", 1, 1, 1, i); __PYX_ERR(2, 1868, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(2, 1868, __pyx_L3_error)
    }
    __pyx_v_item = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__class_getitem__", 1, 1, 1, __pyx_nargs); __PYX_ERR(2, 1868, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.HTMLParser.__class_getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_10HTMLParser_2__class_getitem__(((PyTypeObject*)__pyx_v_cls), __pyx_v_item);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_10HTMLParser_2__class_getitem__(PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_item) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__class_getitem__", 0);

  /* "src/lxml/parser.pxi":1869
 *     # Allow subscripting HTMLParser in type annotions (PEP 560)
 *     def __class_getitem__(cls, item):
 *         return _GenericAlias(cls, item)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = NULL;
  __Pyx_INCREF(__pyx_v_4lxml_5etree__GenericAlias);
  __pyx_t_3 = __pyx_v_4lxml_5etree__GenericAlias; 
  __pyx_t_4 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_4 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_2, ((PyObject *)__pyx_v_cls), __pyx_v_item};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1869, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":1868
 * 
 *     # Allow subscripting HTMLParser in type annotions (PEP 560)
 *     def __class_getitem__(cls, item):             # <<<<<<<<<<<<<<
 *         return _GenericAlias(cls, item)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.HTMLParser.__class_getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":1894
 *     source, you can pass the ``base_url``.
 *     """
 *     def __init__(self, events=None, *, tag=None, base_url=None, **kwargs):             # <<<<<<<<<<<<<<
 *         HTMLParser.__init__(self, **kwargs)
 *         if events is None:
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_14HTMLPullParser_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_14HTMLPullParser_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_events = 0;
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_v_base_url = 0;
  PyObject *__pyx_v_kwargs = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1;
  __Pyx_GOTREF(__pyx_v_kwargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_events,&__pyx_mstate_global->__pyx_n_u_tag,&__pyx_mstate_global->__pyx_n_u_base_url,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(2, 1894, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(2, 1894, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v_kwargs, values, kwd_pos_args, __pyx_kwds_len, "__init__", 1) < (0)) __PYX_ERR(2, 1894, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
    } else {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(2, 1894, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_events = values[0];
    __pyx_v_tag = values[1];
    __pyx_v_base_url = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, __pyx_nargs); __PYX_ERR(2, 1894, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("lxml.etree.HTMLPullParser.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_14HTMLPullParser___init__(((struct __pyx_obj_4lxml_5etree_HTMLPullParser *)__pyx_v_self), __pyx_v_events, __pyx_v_tag, __pyx_v_base_url, __pyx_v_kwargs);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_14HTMLPullParser___init__(struct __pyx_obj_4lxml_5etree_HTMLPullParser *__pyx_v_self, PyObject *__pyx_v_events, PyObject *__pyx_v_tag, PyObject *__pyx_v_base_url, PyObject *__pyx_v_kwargs) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_INCREF(__pyx_v_events);

  /* "src/lxml/parser.pxi":1895
 *     """
 *     def __init__(self, events=None, *, tag=None, base_url=None, **kwargs):
 *         HTMLParser.__init__(self, **kwargs)             # <<<<<<<<<<<<<<
 *         if events is None:
 *             events = ('end',)
*/
  __pyx_t_2 = NULL;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_HTMLParser), __pyx_mstate_global->__pyx_n_u_init); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1895, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1895, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = 1;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_5 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, ((PyObject *)__pyx_v_self)};
    __pyx_t_1 = __Pyx_PyObject_FastCallDict((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1895, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/parser.pxi":1896
 *     def __init__(self, events=None, *, tag=None, base_url=None, **kwargs):
 *         HTMLParser.__init__(self, **kwargs)
 *         if events is None:             # <<<<<<<<<<<<<<
 *             events = ('end',)
 *         self._setBaseURL(base_url)
*/
  __pyx_t_6 = (__pyx_v_events == Py_None);
  if (__pyx_t_6) {

    /* "src/lxml/parser.pxi":1897
 *         HTMLParser.__init__(self, **kwargs)
 *         if events is None:
 *             events = ('end',)             # <<<<<<<<<<<<<<
 *         self._setBaseURL(base_url)
 *         self._collectEvents(events, tag)
*/
    __Pyx_INCREF(__pyx_mstate_global->__pyx_tuple[6]);
    __Pyx_DECREF_SET(__pyx_v_events, __pyx_mstate_global->__pyx_tuple[6]);

    /* "src/lxml/parser.pxi":1896
 *     def __init__(self, events=None, *, tag=None, base_url=None, **kwargs):
 *         HTMLParser.__init__(self, **kwargs)
 *         if events is None:             # <<<<<<<<<<<<<<
 *             events = ('end',)
 *         self._setBaseURL(base_url)
*/
  }

  /* "src/lxml/parser.pxi":1898
 *         if events is None:
 *             events = ('end',)
 *         self._setBaseURL(base_url)             # <<<<<<<<<<<<<<
 *         self._collectEvents(events, tag)
 * 
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree_HTMLPullParser *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.__pyx_base._setBaseURL(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self), __pyx_v_base_url); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1898, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/parser.pxi":1899
 *             events = ('end',)
 *         self._setBaseURL(base_url)
 *         self._collectEvents(events, tag)             # <<<<<<<<<<<<<<
 * 
 *     def read_events(self):
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree_HTMLPullParser *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.__pyx_base._collectEvents(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self), __pyx_v_events, __pyx_v_tag); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1899, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/parser.pxi":1894
 *     source, you can pass the ``base_url``.
 *     """
 *     def __init__(self, events=None, *, tag=None, base_url=None, **kwargs):             # <<<<<<<<<<<<<<
 *         HTMLParser.__init__(self, **kwargs)
 *         if events is None:
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.HTMLPullParser.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_events);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":1901
 *         self._collectEvents(events, tag)
 * 
 *     def read_events(self):             # <<<<<<<<<<<<<<
 *         return (<_SaxParserContext?>self._getPushParserContext()).events_iterator
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_14HTMLPullParser_3read_events(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_14HTMLPullParser_3read_events = {"read_events", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_14HTMLPullParser_3read_events, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_14HTMLPullParser_3read_events(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("read_events (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("read_events", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("read_events", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_14HTMLPullParser_2read_events(((struct __pyx_obj_4lxml_5etree_HTMLPullParser *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_14HTMLPullParser_2read_events(struct __pyx_obj_4lxml_5etree_HTMLPullParser *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("read_events", 0);

  /* "src/lxml/parser.pxi":1902
 * 
 *     def read_events(self):
 *         return (<_SaxParserContext?>self._getPushParserContext()).events_iterator             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree_HTMLPullParser *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.__pyx_base._getPushParserContext(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self))); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1902, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__SaxParserContext)))) __PYX_ERR(2, 1902, __pyx_L1_error)
  __Pyx_INCREF((PyObject *)((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_t_1)->events_iterator);
  __pyx_r = ((PyObject *)((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_t_1)->events_iterator);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":1901
 *         self._collectEvents(events, tag)
 * 
 *     def read_events(self):             # <<<<<<<<<<<<<<
 *         return (<_SaxParserContext?>self._getPushParserContext()).events_iterator
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.HTMLPullParser.read_events", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":1909
 * ############################################################
 * 
 * cdef xmlDoc* _parseDoc(text, filename, _BaseParser parser) except NULL:             # <<<<<<<<<<<<<<
 *     cdef char* c_filename
 *     if parser is None:
*/

static xmlDoc *__pyx_f_4lxml_5etree__parseDoc(PyObject *__pyx_v_text, PyObject *__pyx_v_filename, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser) {
  char *__pyx_v_c_filename;
  PyObject *__pyx_v_filename_utf = NULL;
  xmlDoc *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  xmlDoc *__pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_parseDoc", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_parser);

  /* "src/lxml/parser.pxi":1911
 * cdef xmlDoc* _parseDoc(text, filename, _BaseParser parser) except NULL:
 *     cdef char* c_filename
 *     if parser is None:             # <<<<<<<<<<<<<<
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *     if not filename:
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_parser) == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":1912
 *     cdef char* c_filename
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()             # <<<<<<<<<<<<<<
 *     if not filename:
 *         c_filename = NULL
*/
    __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree_24_ParserDictionaryContext_getDefaultParser(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1912, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_parser, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "src/lxml/parser.pxi":1911
 * cdef xmlDoc* _parseDoc(text, filename, _BaseParser parser) except NULL:
 *     cdef char* c_filename
 *     if parser is None:             # <<<<<<<<<<<<<<
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *     if not filename:
*/
  }

  /* "src/lxml/parser.pxi":1913
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *     if not filename:             # <<<<<<<<<<<<<<
 *         c_filename = NULL
 *     else:
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_filename); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(2, 1913, __pyx_L1_error)
  __pyx_t_3 = (!__pyx_t_1);
  if (__pyx_t_3) {

    /* "src/lxml/parser.pxi":1914
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *     if not filename:
 *         c_filename = NULL             # <<<<<<<<<<<<<<
 *     else:
 *         filename_utf = _encodeFilenameUTF8(filename)
*/
    __pyx_v_c_filename = NULL;

    /* "src/lxml/parser.pxi":1913
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *     if not filename:             # <<<<<<<<<<<<<<
 *         c_filename = NULL
 *     else:
*/
    goto __pyx_L4;
  }

  /* "src/lxml/parser.pxi":1916
 *         c_filename = NULL
 *     else:
 *         filename_utf = _encodeFilenameUTF8(filename)             # <<<<<<<<<<<<<<
 *         c_filename = _cstr(filename_utf)
 *     if isinstance(text, bytes):
*/
  /*else*/ {
    __pyx_t_2 = __pyx_f_4lxml_5etree__encodeFilenameUTF8(__pyx_v_filename); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1916, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_filename_utf = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "src/lxml/parser.pxi":1917
 *     else:
 *         filename_utf = _encodeFilenameUTF8(filename)
 *         c_filename = _cstr(filename_utf)             # <<<<<<<<<<<<<<
 *     if isinstance(text, bytes):
 *         return _parseDoc_bytes(<bytes> text, filename, c_filename, parser)
*/
    __pyx_v_c_filename = PyBytes_AS_STRING(__pyx_v_filename_utf);
  }
  __pyx_L4:;

  /* "src/lxml/parser.pxi":1918
 *         filename_utf = _encodeFilenameUTF8(filename)
 *         c_filename = _cstr(filename_utf)
 *     if isinstance(text, bytes):             # <<<<<<<<<<<<<<
 *         return _parseDoc_bytes(<bytes> text, filename, c_filename, parser)
 *     elif isinstance(text, unicode):
*/
  __pyx_t_3 = PyBytes_Check(__pyx_v_text); 
  if (__pyx_t_3) {

    /* "src/lxml/parser.pxi":1919
 *         c_filename = _cstr(filename_utf)
 *     if isinstance(text, bytes):
 *         return _parseDoc_bytes(<bytes> text, filename, c_filename, parser)             # <<<<<<<<<<<<<<
 *     elif isinstance(text, unicode):
 *         return _parseDoc_unicode(<unicode> text, filename, c_filename, parser)
*/
    __pyx_t_4 = __pyx_f_4lxml_5etree__parseDoc_bytes(((PyObject*)__pyx_v_text), __pyx_v_filename, __pyx_v_c_filename, __pyx_v_parser); if (unlikely(__pyx_t_4 == ((void *)NULL))) __PYX_ERR(2, 1919, __pyx_L1_error)
    __pyx_r = __pyx_t_4;
    goto __pyx_L0;

    /* "src/lxml/parser.pxi":1918
 *         filename_utf = _encodeFilenameUTF8(filename)
 *         c_filename = _cstr(filename_utf)
 *     if isinstance(text, bytes):             # <<<<<<<<<<<<<<
 *         return _parseDoc_bytes(<bytes> text, filename, c_filename, parser)
 *     elif isinstance(text, unicode):
*/
  }

  /* "src/lxml/parser.pxi":1920
 *     if isinstance(text, bytes):
 *         return _parseDoc_bytes(<bytes> text, filename, c_filename, parser)
 *     elif isinstance(text, unicode):             # <<<<<<<<<<<<<<
 *         return _parseDoc_unicode(<unicode> text, filename, c_filename, parser)
 *     else:
*/
  __pyx_t_3 = PyUnicode_Check(__pyx_v_text); 
  if (__pyx_t_3) {

    /* "src/lxml/parser.pxi":1921
 *         return _parseDoc_bytes(<bytes> text, filename, c_filename, parser)
 *     elif isinstance(text, unicode):
 *         return _parseDoc_unicode(<unicode> text, filename, c_filename, parser)             # <<<<<<<<<<<<<<
 *     else:
 *         return _parseDoc_charbuffer(text, filename, c_filename, parser)
*/
    __pyx_t_4 = __pyx_f_4lxml_5etree__parseDoc_unicode(((PyObject*)__pyx_v_text), __pyx_v_filename, __pyx_v_c_filename, __pyx_v_parser); if (unlikely(__pyx_t_4 == ((void *)NULL))) __PYX_ERR(2, 1921, __pyx_L1_error)
    __pyx_r = __pyx_t_4;
    goto __pyx_L0;

    /* "src/lxml/parser.pxi":1920
 *     if isinstance(text, bytes):
 *         return _parseDoc_bytes(<bytes> text, filename, c_filename, parser)
 *     elif isinstance(text, unicode):             # <<<<<<<<<<<<<<
 *         return _parseDoc_unicode(<unicode> text, filename, c_filename, parser)
 *     else:
*/
  }

  /* "src/lxml/parser.pxi":1923
 *         return _parseDoc_unicode(<unicode> text, filename, c_filename, parser)
 *     else:
 *         return _parseDoc_charbuffer(text, filename, c_filename, parser)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  /*else*/ {
    __pyx_t_4 = __pyx_f_4lxml_5etree__parseDoc_charbuffer(__pyx_v_text, __pyx_v_filename, __pyx_v_c_filename, __pyx_v_parser); if (unlikely(__pyx_t_4 == ((void *)NULL))) __PYX_ERR(2, 1923, __pyx_L1_error)
    __pyx_r = __pyx_t_4;
    goto __pyx_L0;
  }

  /* "src/lxml/parser.pxi":1909
 * ############################################################
 * 
 * cdef xmlDoc* _parseDoc(text, filename, _BaseParser parser) except NULL:             # <<<<<<<<<<<<<<
 *     cdef char* c_filename
 *     if parser is None:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._parseDoc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_filename_utf);
  __Pyx_XDECREF((PyObject *)__pyx_v_parser);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":1926
 * 
 * 
 * cdef xmlDoc* _parseDoc_unicode(unicode text, filename, char* c_filename, _BaseParser parser) except NULL:             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t c_len
 *     if python.PyUnicode_IS_READY(text):
*/

static xmlDoc *__pyx_f_4lxml_5etree__parseDoc_unicode(PyObject *__pyx_v_text, PyObject *__pyx_v_filename, char *__pyx_v_c_filename, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser) {
  Py_ssize_t __pyx_v_c_len;
  xmlDoc *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  xmlDoc *__pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_parseDoc_unicode", 0);

  /* "src/lxml/parser.pxi":1928
 * cdef xmlDoc* _parseDoc_unicode(unicode text, filename, char* c_filename, _BaseParser parser) except NULL:
 *     cdef Py_ssize_t c_len
 *     if python.PyUnicode_IS_READY(text):             # <<<<<<<<<<<<<<
 *         # PEP-393 Unicode string
 *         c_len = python.PyUnicode_GET_LENGTH(text) * python.PyUnicode_KIND(text)
*/
  __pyx_t_1 = PyUnicode_IS_READY(__pyx_v_text);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":1930
 *     if python.PyUnicode_IS_READY(text):
 *         # PEP-393 Unicode string
 *         c_len = python.PyUnicode_GET_LENGTH(text) * python.PyUnicode_KIND(text)             # <<<<<<<<<<<<<<
 *     else:
 *         # old Py_UNICODE string
*/
    __pyx_v_c_len = (PyUnicode_GET_LENGTH(__pyx_v_text) * PyUnicode_KIND(__pyx_v_text));

    /* "src/lxml/parser.pxi":1928
 * cdef xmlDoc* _parseDoc_unicode(unicode text, filename, char* c_filename, _BaseParser parser) except NULL:
 *     cdef Py_ssize_t c_len
 *     if python.PyUnicode_IS_READY(text):             # <<<<<<<<<<<<<<
 *         # PEP-393 Unicode string
 *         c_len = python.PyUnicode_GET_LENGTH(text) * python.PyUnicode_KIND(text)
*/
    goto __pyx_L3;
  }

  /* "src/lxml/parser.pxi":1933
 *     else:
 *         # old Py_UNICODE string
 *         c_len = python.PyUnicode_GET_DATA_SIZE(text)             # <<<<<<<<<<<<<<
 *     if c_len > limits.INT_MAX:
 *         return parser._parseDocFromFilelike(
*/
  /*else*/ {
    __pyx_v_c_len = PyUnicode_GET_DATA_SIZE(__pyx_v_text);
  }
  __pyx_L3:;

  /* "src/lxml/parser.pxi":1934
 *         # old Py_UNICODE string
 *         c_len = python.PyUnicode_GET_DATA_SIZE(text)
 *     if c_len > limits.INT_MAX:             # <<<<<<<<<<<<<<
 *         return parser._parseDocFromFilelike(
 *             StringIO(text), filename, None)
*/
  __pyx_t_1 = (__pyx_v_c_len > INT_MAX);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":1936
 *     if c_len > limits.INT_MAX:
 *         return parser._parseDocFromFilelike(
 *             StringIO(text), filename, None)             # <<<<<<<<<<<<<<
 *     return parser._parseUnicodeDoc(text, c_filename)
 * 
*/
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_v_4lxml_5etree_StringIO);
    __pyx_t_4 = __pyx_v_4lxml_5etree_StringIO; 
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_text};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1936, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }

    /* "src/lxml/parser.pxi":1935
 *         c_len = python.PyUnicode_GET_DATA_SIZE(text)
 *     if c_len > limits.INT_MAX:
 *         return parser._parseDocFromFilelike(             # <<<<<<<<<<<<<<
 *             StringIO(text), filename, None)
 *     return parser._parseUnicodeDoc(text, c_filename)
*/
    __pyx_t_6 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)__pyx_v_parser->__pyx_vtab)->_parseDocFromFilelike(__pyx_v_parser, __pyx_t_2, __pyx_v_filename, Py_None); if (unlikely(__pyx_t_6 == ((void *)NULL))) __PYX_ERR(2, 1935, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_r = __pyx_t_6;
    goto __pyx_L0;

    /* "src/lxml/parser.pxi":1934
 *         # old Py_UNICODE string
 *         c_len = python.PyUnicode_GET_DATA_SIZE(text)
 *     if c_len > limits.INT_MAX:             # <<<<<<<<<<<<<<
 *         return parser._parseDocFromFilelike(
 *             StringIO(text), filename, None)
*/
  }

  /* "src/lxml/parser.pxi":1937
 *         return parser._parseDocFromFilelike(
 *             StringIO(text), filename, None)
 *     return parser._parseUnicodeDoc(text, c_filename)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_6 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)__pyx_v_parser->__pyx_vtab)->_parseUnicodeDoc(__pyx_v_parser, __pyx_v_text, __pyx_v_c_filename); if (unlikely(__pyx_t_6 == ((void *)NULL))) __PYX_ERR(2, 1937, __pyx_L1_error)
  __pyx_r = __pyx_t_6;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":1926
 * 
 * 
 * cdef xmlDoc* _parseDoc_unicode(unicode text, filename, char* c_filename, _BaseParser parser) except NULL:             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t c_len
 *     if python.PyUnicode_IS_READY(text):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._parseDoc_unicode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":1940
 * 
 * 
 * cdef xmlDoc* _parseDoc_bytes(bytes text, filename, char* c_filename, _BaseParser parser) except NULL:             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t c_len = len(text)
 *     if c_len > limits.INT_MAX:
*/

static xmlDoc *__pyx_f_4lxml_5etree__parseDoc_bytes(PyObject *__pyx_v_text, PyObject *__pyx_v_filename, char *__pyx_v_c_filename, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser) {
  Py_ssize_t __pyx_v_c_len;
  xmlDoc *__pyx_r;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  xmlDoc *__pyx_t_7;
  char const *__pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_parseDoc_bytes", 0);

  /* "src/lxml/parser.pxi":1941
 * 
 * cdef xmlDoc* _parseDoc_bytes(bytes text, filename, char* c_filename, _BaseParser parser) except NULL:
 *     cdef Py_ssize_t c_len = len(text)             # <<<<<<<<<<<<<<
 *     if c_len > limits.INT_MAX:
 *         return parser._parseDocFromFilelike(BytesIO(text), filename, None)
*/
  if (unlikely(__pyx_v_text == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(2, 1941, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyBytes_GET_SIZE(__pyx_v_text); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(2, 1941, __pyx_L1_error)
  __pyx_v_c_len = __pyx_t_1;

  /* "src/lxml/parser.pxi":1942
 * cdef xmlDoc* _parseDoc_bytes(bytes text, filename, char* c_filename, _BaseParser parser) except NULL:
 *     cdef Py_ssize_t c_len = len(text)
 *     if c_len > limits.INT_MAX:             # <<<<<<<<<<<<<<
 *         return parser._parseDocFromFilelike(BytesIO(text), filename, None)
 *     return parser._parseDoc(text, c_len, c_filename)
*/
  __pyx_t_2 = (__pyx_v_c_len > INT_MAX);
  if (__pyx_t_2) {

    /* "src/lxml/parser.pxi":1943
 *     cdef Py_ssize_t c_len = len(text)
 *     if c_len > limits.INT_MAX:
 *         return parser._parseDocFromFilelike(BytesIO(text), filename, None)             # <<<<<<<<<<<<<<
 *     return parser._parseDoc(text, c_len, c_filename)
 * 
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_v_4lxml_5etree_BytesIO);
    __pyx_t_5 = __pyx_v_4lxml_5etree_BytesIO; 
    __pyx_t_6 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
      assert(__pyx_t_4);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
      __pyx_t_6 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_text};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1943, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __pyx_t_7 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)__pyx_v_parser->__pyx_vtab)->_parseDocFromFilelike(__pyx_v_parser, __pyx_t_3, __pyx_v_filename, Py_None); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(2, 1943, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_7;
    goto __pyx_L0;

    /* "src/lxml/parser.pxi":1942
 * cdef xmlDoc* _parseDoc_bytes(bytes text, filename, char* c_filename, _BaseParser parser) except NULL:
 *     cdef Py_ssize_t c_len = len(text)
 *     if c_len > limits.INT_MAX:             # <<<<<<<<<<<<<<
 *         return parser._parseDocFromFilelike(BytesIO(text), filename, None)
 *     return parser._parseDoc(text, c_len, c_filename)
*/
  }

  /* "src/lxml/parser.pxi":1944
 *     if c_len > limits.INT_MAX:
 *         return parser._parseDocFromFilelike(BytesIO(text), filename, None)
 *     return parser._parseDoc(text, c_len, c_filename)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  if (unlikely(__pyx_v_text == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(2, 1944, __pyx_L1_error)
  }
  __pyx_t_8 = __Pyx_PyBytes_AsString(__pyx_v_text); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(2, 1944, __pyx_L1_error)
  __pyx_t_7 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)__pyx_v_parser->__pyx_vtab)->_parseDoc(__pyx_v_parser, __pyx_t_8, __pyx_v_c_len, __pyx_v_c_filename); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(2, 1944, __pyx_L1_error)
  __pyx_r = __pyx_t_7;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":1940
 * 
 * 
 * cdef xmlDoc* _parseDoc_bytes(bytes text, filename, char* c_filename, _BaseParser parser) except NULL:             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t c_len = len(text)
 *     if c_len > limits.INT_MAX:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._parseDoc_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":1947
 * 
 * 
 * cdef xmlDoc* _parseDoc_charbuffer(text, filename, char* c_filename, _BaseParser parser) except NULL:             # <<<<<<<<<<<<<<
 *     cdef const unsigned char[::1] data = memoryview(text).cast('B')  # cast to 'unsigned char' buffer
 *     cdef Py_ssize_t c_len = len(data)
*/

static xmlDoc *__pyx_f_4lxml_5etree__parseDoc_charbuffer(PyObject *__pyx_v_text, PyObject *__pyx_v_filename, char *__pyx_v_c_filename, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser) {
  __Pyx_memviewslice __pyx_v_data = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_v_c_len;
  xmlDoc *__pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_6;
  int __pyx_t_7;
  xmlDoc *__pyx_t_8;
  Py_ssize_t __pyx_t_9;
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_parseDoc_charbuffer", 0);

  /* "src/lxml/parser.pxi":1948
 * 
 * cdef xmlDoc* _parseDoc_charbuffer(text, filename, char* c_filename, _BaseParser parser) except NULL:
 *     cdef const unsigned char[::1] data = memoryview(text).cast('B')  # cast to 'unsigned char' buffer             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t c_len = len(data)
 *     if c_len > limits.INT_MAX:
*/
  __pyx_t_3 = PyMemoryView_FromObject(__pyx_v_text); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1948, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __pyx_t_3;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_n_u_B};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_cast, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1948, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_char__const__(__pyx_t_1, 0); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(2, 1948, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_data = __pyx_t_5;
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;

  /* "src/lxml/parser.pxi":1949
 * cdef xmlDoc* _parseDoc_charbuffer(text, filename, char* c_filename, _BaseParser parser) except NULL:
 *     cdef const unsigned char[::1] data = memoryview(text).cast('B')  # cast to 'unsigned char' buffer
 *     cdef Py_ssize_t c_len = len(data)             # <<<<<<<<<<<<<<
 *     if c_len > limits.INT_MAX:
 *         return parser._parseDocFromFilelike(BytesIO(text), filename, None)
*/
  __pyx_t_6 = __Pyx_MemoryView_Len(__pyx_v_data); 
  __pyx_v_c_len = __pyx_t_6;

  /* "src/lxml/parser.pxi":1950
 *     cdef const unsigned char[::1] data = memoryview(text).cast('B')  # cast to 'unsigned char' buffer
 *     cdef Py_ssize_t c_len = len(data)
 *     if c_len > limits.INT_MAX:             # <<<<<<<<<<<<<<
 *         return parser._parseDocFromFilelike(BytesIO(text), filename, None)
 *     return parser._parseDoc(<const char*>&data[0], c_len, c_filename)
*/
  __pyx_t_7 = (__pyx_v_c_len > INT_MAX);
  if (__pyx_t_7) {

    /* "src/lxml/parser.pxi":1951
 *     cdef Py_ssize_t c_len = len(data)
 *     if c_len > limits.INT_MAX:
 *         return parser._parseDocFromFilelike(BytesIO(text), filename, None)             # <<<<<<<<<<<<<<
 *     return parser._parseDoc(<const char*>&data[0], c_len, c_filename)
 * 
*/
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_v_4lxml_5etree_BytesIO);
    __pyx_t_2 = __pyx_v_4lxml_5etree_BytesIO; 
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_text};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1951, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_t_8 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)__pyx_v_parser->__pyx_vtab)->_parseDocFromFilelike(__pyx_v_parser, __pyx_t_1, __pyx_v_filename, Py_None); if (unlikely(__pyx_t_8 == ((void *)NULL))) __PYX_ERR(2, 1951, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_r = __pyx_t_8;
    goto __pyx_L0;

    /* "src/lxml/parser.pxi":1950
 *     cdef const unsigned char[::1] data = memoryview(text).cast('B')  # cast to 'unsigned char' buffer
 *     cdef Py_ssize_t c_len = len(data)
 *     if c_len > limits.INT_MAX:             # <<<<<<<<<<<<<<
 *         return parser._parseDocFromFilelike(BytesIO(text), filename, None)
 *     return parser._parseDoc(<const char*>&data[0], c_len, c_filename)
*/
  }

  /* "src/lxml/parser.pxi":1952
 *     if c_len > limits.INT_MAX:
 *         return parser._parseDocFromFilelike(BytesIO(text), filename, None)
 *     return parser._parseDoc(<const char*>&data[0], c_len, c_filename)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_9 = 0;
  __pyx_t_10 = -1;
  if (__pyx_t_9 < 0) {
    __pyx_t_9 += __pyx_v_data.shape[0];
    if (unlikely(__pyx_t_9 < 0)) __pyx_t_10 = 0;
  } else if (unlikely(__pyx_t_9 >= __pyx_v_data.shape[0])) __pyx_t_10 = 0;
  if (unlikely(__pyx_t_10 != -1)) {
    __Pyx_RaiseBufferIndexError(__pyx_t_10);
    __PYX_ERR(2, 1952, __pyx_L1_error)
  }
  __pyx_t_8 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)__pyx_v_parser->__pyx_vtab)->_parseDoc(__pyx_v_parser, ((char const *)(&(*((unsigned char const  *) ( /* dim=0 */ ((char *) (((unsigned char const  *) __pyx_v_data.data) + __pyx_t_9)) ))))), __pyx_v_c_len, __pyx_v_c_filename); if (unlikely(__pyx_t_8 == ((void *)NULL))) __PYX_ERR(2, 1952, __pyx_L1_error)
  __pyx_r = __pyx_t_8;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":1947
 * 
 * 
 * cdef xmlDoc* _parseDoc_charbuffer(text, filename, char* c_filename, _BaseParser parser) except NULL:             # <<<<<<<<<<<<<<
 *     cdef const unsigned char[::1] data = memoryview(text).cast('B')  # cast to 'unsigned char' buffer
 *     cdef Py_ssize_t c_len = len(data)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_5, 1);
  __Pyx_AddTraceback("lxml.etree._parseDoc_charbuffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_data, 1);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":1955
 * 
 * 
 * cdef xmlDoc* _parseDocFromFile(filename8, _BaseParser parser) except NULL:             # <<<<<<<<<<<<<<
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
*/

static xmlDoc *__pyx_f_4lxml_5etree__parseDocFromFile(PyObject *__pyx_v_filename8, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser) {
  xmlDoc *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  xmlDoc *__pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_parseDocFromFile", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_parser);

  /* "src/lxml/parser.pxi":1956
 * 
 * cdef xmlDoc* _parseDocFromFile(filename8, _BaseParser parser) except NULL:
 *     if parser is None:             # <<<<<<<<<<<<<<
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *     return (<_BaseParser>parser)._parseDocFromFile(_cstr(filename8))
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_parser) == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":1957
 * cdef xmlDoc* _parseDocFromFile(filename8, _BaseParser parser) except NULL:
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()             # <<<<<<<<<<<<<<
 *     return (<_BaseParser>parser)._parseDocFromFile(_cstr(filename8))
 * 
*/
    __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree_24_ParserDictionaryContext_getDefaultParser(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1957, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_parser, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "src/lxml/parser.pxi":1956
 * 
 * cdef xmlDoc* _parseDocFromFile(filename8, _BaseParser parser) except NULL:
 *     if parser is None:             # <<<<<<<<<<<<<<
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *     return (<_BaseParser>parser)._parseDocFromFile(_cstr(filename8))
*/
  }

  /* "src/lxml/parser.pxi":1958
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *     return (<_BaseParser>parser)._parseDocFromFile(_cstr(filename8))             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_parser)->__pyx_vtab)->_parseDocFromFile(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_parser), PyBytes_AS_STRING(__pyx_v_filename8)); if (unlikely(__pyx_t_3 == ((void *)NULL))) __PYX_ERR(2, 1958, __pyx_L1_error)
  __pyx_r = __pyx_t_3;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":1955
 * 
 * 
 * cdef xmlDoc* _parseDocFromFile(filename8, _BaseParser parser) except NULL:             # <<<<<<<<<<<<<<
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._parseDocFromFile", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_parser);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":1961
 * 
 * 
 * cdef xmlDoc* _parseDocFromFilelike(source, filename,             # <<<<<<<<<<<<<<
 *                                    _BaseParser parser) except NULL:
 *     if parser is None:
*/

static xmlDoc *__pyx_f_4lxml_5etree__parseDocFromFilelike(PyObject *__pyx_v_source, PyObject *__pyx_v_filename, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser) {
  xmlDoc *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  xmlDoc *__pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_parseDocFromFilelike", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_parser);

  /* "src/lxml/parser.pxi":1963
 * cdef xmlDoc* _parseDocFromFilelike(source, filename,
 *                                    _BaseParser parser) except NULL:
 *     if parser is None:             # <<<<<<<<<<<<<<
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *     return (<_BaseParser>parser)._parseDocFromFilelike(source, filename, None)
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_parser) == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":1964
 *                                    _BaseParser parser) except NULL:
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()             # <<<<<<<<<<<<<<
 *     return (<_BaseParser>parser)._parseDocFromFilelike(source, filename, None)
 * 
*/
    __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree_24_ParserDictionaryContext_getDefaultParser(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1964, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_parser, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "src/lxml/parser.pxi":1963
 * cdef xmlDoc* _parseDocFromFilelike(source, filename,
 *                                    _BaseParser parser) except NULL:
 *     if parser is None:             # <<<<<<<<<<<<<<
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *     return (<_BaseParser>parser)._parseDocFromFilelike(source, filename, None)
*/
  }

  /* "src/lxml/parser.pxi":1965
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *     return (<_BaseParser>parser)._parseDocFromFilelike(source, filename, None)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_parser)->__pyx_vtab)->_parseDocFromFilelike(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_parser), __pyx_v_source, __pyx_v_filename, Py_None); if (unlikely(__pyx_t_3 == ((void *)NULL))) __PYX_ERR(2, 1965, __pyx_L1_error)
  __pyx_r = __pyx_t_3;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":1961
 * 
 * 
 * cdef xmlDoc* _parseDocFromFilelike(source, filename,             # <<<<<<<<<<<<<<
 *                                    _BaseParser parser) except NULL:
 *     if parser is None:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._parseDocFromFilelike", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_parser);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":1968
 * 
 * 
 * cdef xmlDoc* _newXMLDoc() except NULL:             # <<<<<<<<<<<<<<
 *     cdef xmlDoc* result
 *     result = tree.xmlNewDoc(NULL)
*/

static xmlDoc *__pyx_f_4lxml_5etree__newXMLDoc(void) {
  xmlDoc *__pyx_v_result;
  xmlDoc *__pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/parser.pxi":1970
 * cdef xmlDoc* _newXMLDoc() except NULL:
 *     cdef xmlDoc* result
 *     result = tree.xmlNewDoc(NULL)             # <<<<<<<<<<<<<<
 *     if result is NULL:
 *         raise MemoryError()
*/
  __pyx_v_result = xmlNewDoc(NULL);

  /* "src/lxml/parser.pxi":1971
 *     cdef xmlDoc* result
 *     result = tree.xmlNewDoc(NULL)
 *     if result is NULL:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     if result.encoding is NULL:
*/
  __pyx_t_1 = (__pyx_v_result == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/parser.pxi":1972
 *     result = tree.xmlNewDoc(NULL)
 *     if result is NULL:
 *         raise MemoryError()             # <<<<<<<<<<<<<<
 *     if result.encoding is NULL:
 *         result.encoding = tree.xmlStrdup(<unsigned char*>"UTF-8")
*/
    PyErr_NoMemory(); __PYX_ERR(2, 1972, __pyx_L1_error)

    /* "src/lxml/parser.pxi":1971
 *     cdef xmlDoc* result
 *     result = tree.xmlNewDoc(NULL)
 *     if result is NULL:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     if result.encoding is NULL:
*/
  }

  /* "src/lxml/parser.pxi":1973
 *     if result is NULL:
 *         raise MemoryError()
 *     if result.encoding is NULL:             # <<<<<<<<<<<<<<
 *         result.encoding = tree.xmlStrdup(<unsigned char*>"UTF-8")
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)
*/
  __pyx_t_1 = (__pyx_v_result->encoding == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":1974
 *         raise MemoryError()
 *     if result.encoding is NULL:
 *         result.encoding = tree.xmlStrdup(<unsigned char*>"UTF-8")             # <<<<<<<<<<<<<<
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)
 *     return result
*/
    __pyx_v_result->encoding = xmlStrdup(((unsigned char *)((unsigned char *)((char *)"UTF-8"))));

    /* "src/lxml/parser.pxi":1973
 *     if result is NULL:
 *         raise MemoryError()
 *     if result.encoding is NULL:             # <<<<<<<<<<<<<<
 *         result.encoding = tree.xmlStrdup(<unsigned char*>"UTF-8")
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)
*/
  }

  /* "src/lxml/parser.pxi":1975
 *     if result.encoding is NULL:
 *         result.encoding = tree.xmlStrdup(<unsigned char*>"UTF-8")
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)             # <<<<<<<<<<<<<<
 *     return result
 * 
*/
  __pyx_t_2 = __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initDocDict(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, __pyx_v_result); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(2, 1975, __pyx_L1_error)

  /* "src/lxml/parser.pxi":1976
 *         result.encoding = tree.xmlStrdup(<unsigned char*>"UTF-8")
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)
 *     return result             # <<<<<<<<<<<<<<
 * 
 * cdef xmlDoc* _newHTMLDoc() except NULL:
*/
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":1968
 * 
 * 
 * cdef xmlDoc* _newXMLDoc() except NULL:             # <<<<<<<<<<<<<<
 *     cdef xmlDoc* result
 *     result = tree.xmlNewDoc(NULL)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._newXMLDoc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/parser.pxi":1978
 *     return result
 * 
 * cdef xmlDoc* _newHTMLDoc() except NULL:             # <<<<<<<<<<<<<<
 *     cdef xmlDoc* result
 *     result = tree.htmlNewDoc(NULL, NULL)
*/

static xmlDoc *__pyx_f_4lxml_5etree__newHTMLDoc(void) {
  xmlDoc *__pyx_v_result;
  xmlDoc *__pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/parser.pxi":1980
 * cdef xmlDoc* _newHTMLDoc() except NULL:
 *     cdef xmlDoc* result
 *     result = tree.htmlNewDoc(NULL, NULL)             # <<<<<<<<<<<<<<
 *     if result is NULL:
 *         raise MemoryError()
*/
  __pyx_v_result = htmlNewDoc(NULL, NULL);

  /* "src/lxml/parser.pxi":1981
 *     cdef xmlDoc* result
 *     result = tree.htmlNewDoc(NULL, NULL)
 *     if result is NULL:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)
*/
  __pyx_t_1 = (__pyx_v_result == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/parser.pxi":1982
 *     result = tree.htmlNewDoc(NULL, NULL)
 *     if result is NULL:
 *         raise MemoryError()             # <<<<<<<<<<<<<<
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)
 *     return result
*/
    PyErr_NoMemory(); __PYX_ERR(2, 1982, __pyx_L1_error)

    /* "src/lxml/parser.pxi":1981
 *     cdef xmlDoc* result
 *     result = tree.htmlNewDoc(NULL, NULL)
 *     if result is NULL:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)
*/
  }

  /* "src/lxml/parser.pxi":1983
 *     if result is NULL:
 *         raise MemoryError()
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)             # <<<<<<<<<<<<<<
 *     return result
 * 
*/
  __pyx_t_2 = __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initDocDict(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, __pyx_v_result); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(2, 1983, __pyx_L1_error)

  /* "src/lxml/parser.pxi":1984
 *         raise MemoryError()
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)
 *     return result             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":1978
 *     return result
 * 
 * cdef xmlDoc* _newHTMLDoc() except NULL:             # <<<<<<<<<<<<<<
 *     cdef xmlDoc* result
 *     result = tree.htmlNewDoc(NULL, NULL)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._newHTMLDoc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/parser.pxi":1987
 * 
 * 
 * cdef xmlDoc* _copyDoc(xmlDoc* c_doc, int recursive) except NULL:             # <<<<<<<<<<<<<<
 *     """Return a copy of c_doc, without moving the names into the dict."""
 *     cdef xmlDoc* result
*/

static xmlDoc *__pyx_f_4lxml_5etree__copyDoc(xmlDoc *__pyx_v_c_doc, int __pyx_v_recursive) {
  xmlDoc *__pyx_v_result;
  xmlDoc *__pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/parser.pxi":1990
 *     """Return a copy of c_doc, without moving the names into the dict."""
 *     cdef xmlDoc* result
 *     if recursive:             # <<<<<<<<<<<<<<
 *         with nogil:
 *             result = tree.xmlCopyDoc(c_doc, recursive)
*/
  __pyx_t_1 = (__pyx_v_recursive != 0);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":1991
 *     cdef xmlDoc* result
 *     if recursive:
 *         with nogil:             # <<<<<<<<<<<<<<
 *             result = tree.xmlCopyDoc(c_doc, recursive)
 *     else:
*/
    {
        PyThreadState * _save;
        _save = PyEval_SaveThread();
        __Pyx_FastGIL_Remember();
        /*try:*/ {

          /* "src/lxml/parser.pxi":1992
 *     if recursive:
 *         with nogil:
 *             result = tree.xmlCopyDoc(c_doc, recursive)             # <<<<<<<<<<<<<<
 *     else:
 *         result = tree.xmlCopyDoc(c_doc, 0)
*/
          __pyx_v_result = xmlCopyDoc(__pyx_v_c_doc, __pyx_v_recursive);
        }

        /* "src/lxml/parser.pxi":1991
 *     cdef xmlDoc* result
 *     if recursive:
 *         with nogil:             # <<<<<<<<<<<<<<
 *             result = tree.xmlCopyDoc(c_doc, recursive)
 *     else:
*/
        /*finally:*/ {
          /*normal exit:*/{
            __Pyx_FastGIL_Forget();
            PyEval_RestoreThread(_save);
            goto __pyx_L6;
          }
          __pyx_L6:;
        }
    }

    /* "src/lxml/parser.pxi":1990
 *     """Return a copy of c_doc, without moving the names into the dict."""
 *     cdef xmlDoc* result
 *     if recursive:             # <<<<<<<<<<<<<<
 *         with nogil:
 *             result = tree.xmlCopyDoc(c_doc, recursive)
*/
    goto __pyx_L3;
  }

  /* "src/lxml/parser.pxi":1994
 *             result = tree.xmlCopyDoc(c_doc, recursive)
 *     else:
 *         result = tree.xmlCopyDoc(c_doc, 0)             # <<<<<<<<<<<<<<
 *     if result is NULL:
 *         raise MemoryError()
*/
  /*else*/ {
    __pyx_v_result = xmlCopyDoc(__pyx_v_c_doc, 0);
  }
  __pyx_L3:;

  /* "src/lxml/parser.pxi":1995
 *     else:
 *         result = tree.xmlCopyDoc(c_doc, 0)
 *     if result is NULL:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)
*/
  __pyx_t_1 = (__pyx_v_result == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/parser.pxi":1996
 *         result = tree.xmlCopyDoc(c_doc, 0)
 *     if result is NULL:
 *         raise MemoryError()             # <<<<<<<<<<<<<<
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)
 *     return result
*/
    PyErr_NoMemory(); __PYX_ERR(2, 1996, __pyx_L1_error)

    /* "src/lxml/parser.pxi":1995
 *     else:
 *         result = tree.xmlCopyDoc(c_doc, 0)
 *     if result is NULL:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)
*/
  }

  /* "src/lxml/parser.pxi":1997
 *     if result is NULL:
 *         raise MemoryError()
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)             # <<<<<<<<<<<<<<
 *     return result
 * 
*/
  __pyx_t_2 = __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initDocDict(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, __pyx_v_result); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(2, 1997, __pyx_L1_error)

  /* "src/lxml/parser.pxi":1998
 *         raise MemoryError()
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)
 *     return result             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":1987
 * 
 * 
 * cdef xmlDoc* _copyDoc(xmlDoc* c_doc, int recursive) except NULL:             # <<<<<<<<<<<<<<
 *     """Return a copy of c_doc, without moving the names into the dict."""
 *     cdef xmlDoc* result
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._copyDoc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/parser.pxi":2001
 * 
 * 
 * cdef xmlDoc* _copyDocRoot(xmlDoc* c_doc, xmlNode* c_new_root) except NULL:             # <<<<<<<<<<<<<<
 *     """Recursively copy the document and make c_new_root the new root node."""
 *     cdef xmlDoc* result
*/

static xmlDoc *__pyx_f_4lxml_5etree__copyDocRoot(xmlDoc *__pyx_v_c_doc, xmlNode *__pyx_v_c_new_root) {
  xmlDoc *__pyx_v_result;
  xmlNode *__pyx_v_c_node;
  xmlDoc *__pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/parser.pxi":2005
 *     cdef xmlDoc* result
 *     cdef xmlNode* c_node
 *     result = tree.xmlCopyDoc(c_doc, 0) # non recursive             # <<<<<<<<<<<<<<
 *     if result is NULL:
 *         raise MemoryError()
*/
  __pyx_v_result = xmlCopyDoc(__pyx_v_c_doc, 0);

  /* "src/lxml/parser.pxi":2006
 *     cdef xmlNode* c_node
 *     result = tree.xmlCopyDoc(c_doc, 0) # non recursive
 *     if result is NULL:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)
*/
  __pyx_t_1 = (__pyx_v_result == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/parser.pxi":2007
 *     result = tree.xmlCopyDoc(c_doc, 0) # non recursive
 *     if result is NULL:
 *         raise MemoryError()             # <<<<<<<<<<<<<<
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)
 * 
*/
    PyErr_NoMemory(); __PYX_ERR(2, 2007, __pyx_L1_error)

    /* "src/lxml/parser.pxi":2006
 *     cdef xmlNode* c_node
 *     result = tree.xmlCopyDoc(c_doc, 0) # non recursive
 *     if result is NULL:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)
*/
  }

  /* "src/lxml/parser.pxi":2008
 *     if result is NULL:
 *         raise MemoryError()
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)             # <<<<<<<<<<<<<<
 * 
 *     with nogil:
*/
  __pyx_t_2 = __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initDocDict(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, __pyx_v_result); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(2, 2008, __pyx_L1_error)

  /* "src/lxml/parser.pxi":2010
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         c_node = tree.xmlDocCopyNode(c_new_root, result, 1) # recursive
 *     if c_node is NULL:
*/
  {
      PyThreadState * _save;
      _save = PyEval_SaveThread();
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "src/lxml/parser.pxi":2011
 * 
 *     with nogil:
 *         c_node = tree.xmlDocCopyNode(c_new_root, result, 1) # recursive             # <<<<<<<<<<<<<<
 *     if c_node is NULL:
 *         tree.xmlFreeDoc(result)
*/
        __pyx_v_c_node = xmlDocCopyNode(__pyx_v_c_new_root, __pyx_v_result, 1);
      }

      /* "src/lxml/parser.pxi":2010
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         c_node = tree.xmlDocCopyNode(c_new_root, result, 1) # recursive
 *     if c_node is NULL:
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L6;
        }
        __pyx_L6:;
      }
  }

  /* "src/lxml/parser.pxi":2012
 *     with nogil:
 *         c_node = tree.xmlDocCopyNode(c_new_root, result, 1) # recursive
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         tree.xmlFreeDoc(result)
 *         raise MemoryError()
*/
  __pyx_t_1 = (__pyx_v_c_node == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/parser.pxi":2013
 *         c_node = tree.xmlDocCopyNode(c_new_root, result, 1) # recursive
 *     if c_node is NULL:
 *         tree.xmlFreeDoc(result)             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 * 
*/
    xmlFreeDoc(__pyx_v_result);

    /* "src/lxml/parser.pxi":2014
 *     if c_node is NULL:
 *         tree.xmlFreeDoc(result)
 *         raise MemoryError()             # <<<<<<<<<<<<<<
 * 
 *     tree.xmlDocSetRootElement(result, c_node)
*/
    PyErr_NoMemory(); __PYX_ERR(2, 2014, __pyx_L1_error)

    /* "src/lxml/parser.pxi":2012
 *     with nogil:
 *         c_node = tree.xmlDocCopyNode(c_new_root, result, 1) # recursive
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         tree.xmlFreeDoc(result)
 *         raise MemoryError()
*/
  }

  /* "src/lxml/parser.pxi":2016
 *         raise MemoryError()
 * 
 *     tree.xmlDocSetRootElement(result, c_node)             # <<<<<<<<<<<<<<
 *     # Copy the tail text after setting the root element since libxml2 otherwise unlinks the tail.
 *     _copyTail(c_new_root.next, c_node)
*/
  (void)(xmlDocSetRootElement(__pyx_v_result, __pyx_v_c_node));

  /* "src/lxml/parser.pxi":2018
 *     tree.xmlDocSetRootElement(result, c_node)
 *     # Copy the tail text after setting the root element since libxml2 otherwise unlinks the tail.
 *     _copyTail(c_new_root.next, c_node)             # <<<<<<<<<<<<<<
 *     return result
 * 
*/
  __pyx_t_2 = __pyx_f_4lxml_5etree__copyTail(__pyx_v_c_new_root->next, __pyx_v_c_node); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(2, 2018, __pyx_L1_error)

  /* "src/lxml/parser.pxi":2019
 *     # Copy the tail text after setting the root element since libxml2 otherwise unlinks the tail.
 *     _copyTail(c_new_root.next, c_node)
 *     return result             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":2001
 * 
 * 
 * cdef xmlDoc* _copyDocRoot(xmlDoc* c_doc, xmlNode* c_new_root) except NULL:             # <<<<<<<<<<<<<<
 *     """Recursively copy the document and make c_new_root the new root node."""
 *     cdef xmlDoc* result
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._copyDocRoot", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/parser.pxi":2022
 * 
 * 
 * cdef xmlNode* _copyNodeToDoc(xmlNode* c_node, xmlDoc* c_doc) except NULL:             # <<<<<<<<<<<<<<
 *     """Recursively copy the element into the document. c_doc is not modified."""
 *     cdef xmlNode* c_root
*/

static xmlNode *__pyx_f_4lxml_5etree__copyNodeToDoc(xmlNode *__pyx_v_c_node, xmlDoc *__pyx_v_c_doc) {
  xmlNode *__pyx_v_c_root;
  xmlNode *__pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/parser.pxi":2025
 *     """Recursively copy the element into the document. c_doc is not modified."""
 *     cdef xmlNode* c_root
 *     c_root = tree.xmlDocCopyNode(c_node, c_doc, 1) # recursive             # <<<<<<<<<<<<<<
 *     if c_root is NULL:
 *         raise MemoryError()
*/
  __pyx_v_c_root = xmlDocCopyNode(__pyx_v_c_node, __pyx_v_c_doc, 1);

  /* "src/lxml/parser.pxi":2026
 *     cdef xmlNode* c_root
 *     c_root = tree.xmlDocCopyNode(c_node, c_doc, 1) # recursive
 *     if c_root is NULL:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     _copyTail(c_node.next, c_root)
*/
  __pyx_t_1 = (__pyx_v_c_root == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/parser.pxi":2027
 *     c_root = tree.xmlDocCopyNode(c_node, c_doc, 1) # recursive
 *     if c_root is NULL:
 *         raise MemoryError()             # <<<<<<<<<<<<<<
 *     _copyTail(c_node.next, c_root)
 *     return c_root
*/
    PyErr_NoMemory(); __PYX_ERR(2, 2027, __pyx_L1_error)

    /* "src/lxml/parser.pxi":2026
 *     cdef xmlNode* c_root
 *     c_root = tree.xmlDocCopyNode(c_node, c_doc, 1) # recursive
 *     if c_root is NULL:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     _copyTail(c_node.next, c_root)
*/
  }

  /* "src/lxml/parser.pxi":2028
 *     if c_root is NULL:
 *         raise MemoryError()
 *     _copyTail(c_node.next, c_root)             # <<<<<<<<<<<<<<
 *     return c_root
 * 
*/
  __pyx_t_2 = __pyx_f_4lxml_5etree__copyTail(__pyx_v_c_node->next, __pyx_v_c_root); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(2, 2028, __pyx_L1_error)

  /* "src/lxml/parser.pxi":2029
 *         raise MemoryError()
 *     _copyTail(c_node.next, c_root)
 *     return c_root             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = __pyx_v_c_root;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":2022
 * 
 * 
 * cdef xmlNode* _copyNodeToDoc(xmlNode* c_node, xmlDoc* c_doc) except NULL:             # <<<<<<<<<<<<<<
 *     """Recursively copy the element into the document. c_doc is not modified."""
 *     cdef xmlNode* c_root
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._copyNodeToDoc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/parser.pxi":2036
 * ############################################################
 * 
 * cdef _Document _parseDocument(source, _BaseParser parser, base_url):             # <<<<<<<<<<<<<<
 *     cdef _Document doc
 *     source = _getFSPathOrObject(source)
*/

static struct LxmlDocument *__pyx_f_4lxml_5etree__parseDocument(PyObject *__pyx_v_source, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser, PyObject *__pyx_v_base_url) {
  struct LxmlDocument *__pyx_v_doc = 0;
  PyObject *__pyx_v_url = NULL;
  struct LxmlDocument *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  size_t __pyx_t_5;
  const char *__pyx_t_6;
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8[3];
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_parseDocument", 0);
  __Pyx_INCREF(__pyx_v_source);
  __Pyx_INCREF(__pyx_v_base_url);

  /* "src/lxml/parser.pxi":2038
 * cdef _Document _parseDocument(source, _BaseParser parser, base_url):
 *     cdef _Document doc
 *     source = _getFSPathOrObject(source)             # <<<<<<<<<<<<<<
 *     if _isString(source):
 *         # parse the file directly from the filesystem
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__getFSPathOrObject(__pyx_v_source); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2038, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_source, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/parser.pxi":2039
 *     cdef _Document doc
 *     source = _getFSPathOrObject(source)
 *     if _isString(source):             # <<<<<<<<<<<<<<
 *         # parse the file directly from the filesystem
 *         doc = _parseDocumentFromURL(_encodeFilename(source), parser)
*/
  __pyx_t_2 = _isString(__pyx_v_source);
  if (__pyx_t_2) {

    /* "src/lxml/parser.pxi":2041
 *     if _isString(source):
 *         # parse the file directly from the filesystem
 *         doc = _parseDocumentFromURL(_encodeFilename(source), parser)             # <<<<<<<<<<<<<<
 *         # fix base URL if requested
 *         if base_url is not None:
*/
    __pyx_t_1 = __pyx_f_4lxml_5etree__encodeFilename(__pyx_v_source); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2041, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__parseDocumentFromURL(__pyx_t_1, __pyx_v_parser)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 2041, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/parser.pxi":2043
 *         doc = _parseDocumentFromURL(_encodeFilename(source), parser)
 *         # fix base URL if requested
 *         if base_url is not None:             # <<<<<<<<<<<<<<
 *             base_url = _encodeFilenameUTF8(base_url)
 *             if doc._c_doc.URL is not NULL:
*/
    __pyx_t_2 = (__pyx_v_base_url != Py_None);
    if (__pyx_t_2) {

      /* "src/lxml/parser.pxi":2044
 *         # fix base URL if requested
 *         if base_url is not None:
 *             base_url = _encodeFilenameUTF8(base_url)             # <<<<<<<<<<<<<<
 *             if doc._c_doc.URL is not NULL:
 *                 tree.xmlFree(<char*>doc._c_doc.URL)
*/
      __pyx_t_3 = __pyx_f_4lxml_5etree__encodeFilenameUTF8(__pyx_v_base_url); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 2044, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_base_url, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "src/lxml/parser.pxi":2045
 *         if base_url is not None:
 *             base_url = _encodeFilenameUTF8(base_url)
 *             if doc._c_doc.URL is not NULL:             # <<<<<<<<<<<<<<
 *                 tree.xmlFree(<char*>doc._c_doc.URL)
 *             doc._c_doc.URL = tree.xmlStrdup(_xcstr(base_url))
*/
      __pyx_t_2 = (__pyx_v_doc->_c_doc->URL != NULL);
      if (__pyx_t_2) {

        /* "src/lxml/parser.pxi":2046
 *             base_url = _encodeFilenameUTF8(base_url)
 *             if doc._c_doc.URL is not NULL:
 *                 tree.xmlFree(<char*>doc._c_doc.URL)             # <<<<<<<<<<<<<<
 *             doc._c_doc.URL = tree.xmlStrdup(_xcstr(base_url))
 *         return doc
*/
        xmlFree(((char *)__pyx_v_doc->_c_doc->URL));

        /* "src/lxml/parser.pxi":2045
 *         if base_url is not None:
 *             base_url = _encodeFilenameUTF8(base_url)
 *             if doc._c_doc.URL is not NULL:             # <<<<<<<<<<<<<<
 *                 tree.xmlFree(<char*>doc._c_doc.URL)
 *             doc._c_doc.URL = tree.xmlStrdup(_xcstr(base_url))
*/
      }

      /* "src/lxml/parser.pxi":2047
 *             if doc._c_doc.URL is not NULL:
 *                 tree.xmlFree(<char*>doc._c_doc.URL)
 *             doc._c_doc.URL = tree.xmlStrdup(_xcstr(base_url))             # <<<<<<<<<<<<<<
 *         return doc
 * 
*/
      __pyx_v_doc->_c_doc->URL = xmlStrdup((const xmlChar*)PyBytes_AS_STRING(__pyx_v_base_url));

      /* "src/lxml/parser.pxi":2043
 *         doc = _parseDocumentFromURL(_encodeFilename(source), parser)
 *         # fix base URL if requested
 *         if base_url is not None:             # <<<<<<<<<<<<<<
 *             base_url = _encodeFilenameUTF8(base_url)
 *             if doc._c_doc.URL is not NULL:
*/
    }

    /* "src/lxml/parser.pxi":2048
 *                 tree.xmlFree(<char*>doc._c_doc.URL)
 *             doc._c_doc.URL = tree.xmlStrdup(_xcstr(base_url))
 *         return doc             # <<<<<<<<<<<<<<
 * 
 *     if base_url is not None:
*/
    __Pyx_XDECREF((PyObject *)__pyx_r);
    __Pyx_INCREF((PyObject *)__pyx_v_doc);
    __pyx_r = __pyx_v_doc;
    goto __pyx_L0;

    /* "src/lxml/parser.pxi":2039
 *     cdef _Document doc
 *     source = _getFSPathOrObject(source)
 *     if _isString(source):             # <<<<<<<<<<<<<<
 *         # parse the file directly from the filesystem
 *         doc = _parseDocumentFromURL(_encodeFilename(source), parser)
*/
  }

  /* "src/lxml/parser.pxi":2050
 *         return doc
 * 
 *     if base_url is not None:             # <<<<<<<<<<<<<<
 *         url = base_url
 *     else:
*/
  __pyx_t_2 = (__pyx_v_base_url != Py_None);
  if (__pyx_t_2) {

    /* "src/lxml/parser.pxi":2051
 * 
 *     if base_url is not None:
 *         url = base_url             # <<<<<<<<<<<<<<
 *     else:
 *         url = _getFilenameForFile(source)
*/
    __Pyx_INCREF(__pyx_v_base_url);
    __pyx_v_url = __pyx_v_base_url;

    /* "src/lxml/parser.pxi":2050
 *         return doc
 * 
 *     if base_url is not None:             # <<<<<<<<<<<<<<
 *         url = base_url
 *     else:
*/
    goto __pyx_L6;
  }

  /* "src/lxml/parser.pxi":2053
 *         url = base_url
 *     else:
 *         url = _getFilenameForFile(source)             # <<<<<<<<<<<<<<
 * 
 *     if hasattr(source, 'getvalue') and hasattr(source, 'tell'):
*/
  /*else*/ {
    __pyx_t_3 = __pyx_f_4lxml_5etree__getFilenameForFile(__pyx_v_source); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 2053, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_url = __pyx_t_3;
    __pyx_t_3 = 0;
  }
  __pyx_L6:;

  /* "src/lxml/parser.pxi":2055
 *         url = _getFilenameForFile(source)
 * 
 *     if hasattr(source, 'getvalue') and hasattr(source, 'tell'):             # <<<<<<<<<<<<<<
 *         # StringIO - reading from start?
 *         if source.tell() == 0:
*/
  __pyx_t_4 = __Pyx_HasAttr(__pyx_v_source, __pyx_mstate_global->__pyx_n_u_getvalue); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 2055, __pyx_L1_error)
  if (__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L8_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_HasAttr(__pyx_v_source, __pyx_mstate_global->__pyx_n_u_tell); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 2055, __pyx_L1_error)
  __pyx_t_2 = __pyx_t_4;
  __pyx_L8_bool_binop_done:;
  if (__pyx_t_2) {

    /* "src/lxml/parser.pxi":2057
 *     if hasattr(source, 'getvalue') and hasattr(source, 'tell'):
 *         # StringIO - reading from start?
 *         if source.tell() == 0:             # <<<<<<<<<<<<<<
 *             return _parseMemoryDocument(source.getvalue(), url, parser)
 * 
*/
    __pyx_t_1 = __pyx_v_source;
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_5 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL};
      __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_tell, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 2057, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __pyx_t_2 = (__Pyx_PyLong_BoolEqObjC(__pyx_t_3, __pyx_mstate_global->__pyx_int_0, 0, 0)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(2, 2057, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_2) {

      /* "src/lxml/parser.pxi":2058
 *         # StringIO - reading from start?
 *         if source.tell() == 0:
 *             return _parseMemoryDocument(source.getvalue(), url, parser)             # <<<<<<<<<<<<<<
 * 
 *     # Support for file-like objects (urlgrabber.urlopen, ...)
*/
      __Pyx_XDECREF((PyObject *)__pyx_r);
      __pyx_t_1 = __pyx_v_source;
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_5 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL};
        __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_getvalue, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 2058, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
      }
      __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__parseMemoryDocument(__pyx_t_3, __pyx_v_url, __pyx_v_parser)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2058, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = ((struct LxmlDocument *)__pyx_t_1);
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* "src/lxml/parser.pxi":2057
 *     if hasattr(source, 'getvalue') and hasattr(source, 'tell'):
 *         # StringIO - reading from start?
 *         if source.tell() == 0:             # <<<<<<<<<<<<<<
 *             return _parseMemoryDocument(source.getvalue(), url, parser)
 * 
*/
    }

    /* "src/lxml/parser.pxi":2055
 *         url = _getFilenameForFile(source)
 * 
 *     if hasattr(source, 'getvalue') and hasattr(source, 'tell'):             # <<<<<<<<<<<<<<
 *         # StringIO - reading from start?
 *         if source.tell() == 0:
*/
  }

  /* "src/lxml/parser.pxi":2061
 * 
 *     # Support for file-like objects (urlgrabber.urlopen, ...)
 *     if hasattr(source, 'read'):             # <<<<<<<<<<<<<<
 *         return _parseFilelikeDocument(source, url, parser)
 * 
*/
  __pyx_t_2 = __Pyx_HasAttr(__pyx_v_source, __pyx_mstate_global->__pyx_n_u_read); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(2, 2061, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "src/lxml/parser.pxi":2062
 *     # Support for file-like objects (urlgrabber.urlopen, ...)
 *     if hasattr(source, 'read'):
 *         return _parseFilelikeDocument(source, url, parser)             # <<<<<<<<<<<<<<
 * 
 *     raise TypeError, f"cannot parse from '{python._fqtypename(source).decode('UTF-8')}'"
*/
    __Pyx_XDECREF((PyObject *)__pyx_r);
    __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__parseFilelikeDocument(__pyx_v_source, __pyx_v_url, __pyx_v_parser)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2062, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = ((struct LxmlDocument *)__pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "src/lxml/parser.pxi":2061
 * 
 *     # Support for file-like objects (urlgrabber.urlopen, ...)
 *     if hasattr(source, 'read'):             # <<<<<<<<<<<<<<
 *         return _parseFilelikeDocument(source, url, parser)
 * 
*/
  }

  /* "src/lxml/parser.pxi":2064
 *         return _parseFilelikeDocument(source, url, parser)
 * 
 *     raise TypeError, f"cannot parse from '{python._fqtypename(source).decode('UTF-8')}'"             # <<<<<<<<<<<<<<
 * 
 * cdef _Document _parseDocumentFromURL(url, _BaseParser parser):
*/
  __pyx_t_6 = _fqtypename(__pyx_v_source);
  __pyx_t_7 = __Pyx_ssize_strlen(__pyx_t_6); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(2, 2064, __pyx_L1_error)
  __pyx_t_1 = __Pyx_decode_c_string(__pyx_t_6, 0, __pyx_t_7, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2064, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_8[0] = __pyx_mstate_global->__pyx_kp_u_cannot_parse_from;
  __pyx_t_8[1] = __pyx_t_1;
  __pyx_t_8[2] = __pyx_mstate_global->__pyx_kp_u__4;
  __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_8, 3, 19 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1));
  if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 2064, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_t_3, 0, 0);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __PYX_ERR(2, 2064, __pyx_L1_error)

  /* "src/lxml/parser.pxi":2036
 * ############################################################
 * 
 * cdef _Document _parseDocument(source, _BaseParser parser, base_url):             # <<<<<<<<<<<<<<
 *     cdef _Document doc
 *     source = _getFSPathOrObject(source)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._parseDocument", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XDECREF(__pyx_v_url);
  __Pyx_XDECREF(__pyx_v_source);
  __Pyx_XDECREF(__pyx_v_base_url);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":2066
 *     raise TypeError, f"cannot parse from '{python._fqtypename(source).decode('UTF-8')}'"
 * 
 * cdef _Document _parseDocumentFromURL(url, _BaseParser parser):             # <<<<<<<<<<<<<<
 *     c_doc = _parseDocFromFile(url, parser)
 *     return _documentFactory(c_doc, parser)
*/

static struct LxmlDocument *__pyx_f_4lxml_5etree__parseDocumentFromURL(PyObject *__pyx_v_url, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser) {
  xmlDoc *__pyx_v_c_doc;
  struct LxmlDocument *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  xmlDoc *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_parseDocumentFromURL", 0);

  /* "src/lxml/parser.pxi":2067
 * 
 * cdef _Document _parseDocumentFromURL(url, _BaseParser parser):
 *     c_doc = _parseDocFromFile(url, parser)             # <<<<<<<<<<<<<<
 *     return _documentFactory(c_doc, parser)
 * 
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__parseDocFromFile(__pyx_v_url, __pyx_v_parser); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(2, 2067, __pyx_L1_error)
  __pyx_v_c_doc = __pyx_t_1;

  /* "src/lxml/parser.pxi":2068
 * cdef _Document _parseDocumentFromURL(url, _BaseParser parser):
 *     c_doc = _parseDocFromFile(url, parser)
 *     return _documentFactory(c_doc, parser)             # <<<<<<<<<<<<<<
 * 
 * cdef _Document _parseMemoryDocument(text, url, _BaseParser parser):
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, __pyx_v_parser)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 2068, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = ((struct LxmlDocument *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":2066
 *     raise TypeError, f"cannot parse from '{python._fqtypename(source).decode('UTF-8')}'"
 * 
 * cdef _Document _parseDocumentFromURL(url, _BaseParser parser):             # <<<<<<<<<<<<<<
 *     c_doc = _parseDocFromFile(url, parser)
 *     return _documentFactory(c_doc, parser)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._parseDocumentFromURL", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":2070
 *     return _documentFactory(c_doc, parser)
 * 
 * cdef _Document _parseMemoryDocument(text, url, _BaseParser parser):             # <<<<<<<<<<<<<<
 *     if isinstance(text, unicode):
 *         if _hasEncodingDeclaration(text):
*/

static struct LxmlDocument *__pyx_f_4lxml_5etree__parseMemoryDocument(PyObject *__pyx_v_text, PyObject *__pyx_v_url, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser) {
  xmlDoc *__pyx_v_c_doc;
  struct LxmlDocument *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  xmlDoc *__pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_parseMemoryDocument", 0);

  /* "src/lxml/parser.pxi":2071
 * 
 * cdef _Document _parseMemoryDocument(text, url, _BaseParser parser):
 *     if isinstance(text, unicode):             # <<<<<<<<<<<<<<
 *         if _hasEncodingDeclaration(text):
 *             raise ValueError(
*/
  __pyx_t_1 = PyUnicode_Check(__pyx_v_text); 
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":2072
 * cdef _Document _parseMemoryDocument(text, url, _BaseParser parser):
 *     if isinstance(text, unicode):
 *         if _hasEncodingDeclaration(text):             # <<<<<<<<<<<<<<
 *             raise ValueError(
 *                 "Unicode strings with encoding declaration are not supported. "
*/
    __pyx_t_1 = __pyx_f_4lxml_5etree__hasEncodingDeclaration(__pyx_v_text); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(2, 2072, __pyx_L1_error)
    if (unlikely(__pyx_t_1)) {

      /* "src/lxml/parser.pxi":2073
 *     if isinstance(text, unicode):
 *         if _hasEncodingDeclaration(text):
 *             raise ValueError(             # <<<<<<<<<<<<<<
 *                 "Unicode strings with encoding declaration are not supported. "
 *                 "Please use bytes input or XML fragments without declaration.")
*/
      __pyx_t_3 = NULL;
      __pyx_t_4 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Unicode_strings_with_encoding_de};
        __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 2073, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(2, 2073, __pyx_L1_error)

      /* "src/lxml/parser.pxi":2072
 * cdef _Document _parseMemoryDocument(text, url, _BaseParser parser):
 *     if isinstance(text, unicode):
 *         if _hasEncodingDeclaration(text):             # <<<<<<<<<<<<<<
 *             raise ValueError(
 *                 "Unicode strings with encoding declaration are not supported. "
*/
    }

    /* "src/lxml/parser.pxi":2071
 * 
 * cdef _Document _parseMemoryDocument(text, url, _BaseParser parser):
 *     if isinstance(text, unicode):             # <<<<<<<<<<<<<<
 *         if _hasEncodingDeclaration(text):
 *             raise ValueError(
*/
  }

  /* "src/lxml/parser.pxi":2076
 *                 "Unicode strings with encoding declaration are not supported. "
 *                 "Please use bytes input or XML fragments without declaration.")
 *     c_doc = _parseDoc(text, url, parser)             # <<<<<<<<<<<<<<
 *     return _documentFactory(c_doc, parser)
 * 
*/
  __pyx_t_5 = __pyx_f_4lxml_5etree__parseDoc(__pyx_v_text, __pyx_v_url, __pyx_v_parser); if (unlikely(__pyx_t_5 == ((void *)NULL))) __PYX_ERR(2, 2076, __pyx_L1_error)
  __pyx_v_c_doc = __pyx_t_5;

  /* "src/lxml/parser.pxi":2077
 *                 "Please use bytes input or XML fragments without declaration.")
 *     c_doc = _parseDoc(text, url, parser)
 *     return _documentFactory(c_doc, parser)             # <<<<<<<<<<<<<<
 * 
 * cdef _Document _parseFilelikeDocument(source, url, _BaseParser parser):
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, __pyx_v_parser)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 2077, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = ((struct LxmlDocument *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":2070
 *     return _documentFactory(c_doc, parser)
 * 
 * cdef _Document _parseMemoryDocument(text, url, _BaseParser parser):             # <<<<<<<<<<<<<<
 *     if isinstance(text, unicode):
 *         if _hasEncodingDeclaration(text):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._parseMemoryDocument", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":2079
 *     return _documentFactory(c_doc, parser)
 * 
 * cdef _Document _parseFilelikeDocument(source, url, _BaseParser parser):             # <<<<<<<<<<<<<<
 *     c_doc = _parseDocFromFilelike(source, url, parser)
 *     return _documentFactory(c_doc, parser)
*/

static struct LxmlDocument *__pyx_f_4lxml_5etree__parseFilelikeDocument(PyObject *__pyx_v_source, PyObject *__pyx_v_url, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser) {
  xmlDoc *__pyx_v_c_doc;
  struct LxmlDocument *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  xmlDoc *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_parseFilelikeDocument", 0);

  /* "src/lxml/parser.pxi":2080
 * 
 * cdef _Document _parseFilelikeDocument(source, url, _BaseParser parser):
 *     c_doc = _parseDocFromFilelike(source, url, parser)             # <<<<<<<<<<<<<<
 *     return _documentFactory(c_doc, parser)
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__parseDocFromFilelike(__pyx_v_source, __pyx_v_url, __pyx_v_parser); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(2, 2080, __pyx_L1_error)
  __pyx_v_c_doc = __pyx_t_1;

  /* "src/lxml/parser.pxi":2081
 * cdef _Document _parseFilelikeDocument(source, url, _BaseParser parser):
 *     c_doc = _parseDocFromFilelike(source, url, parser)
 *     return _documentFactory(c_doc, parser)             # <<<<<<<<<<<<<<
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, __pyx_v_parser)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 2081, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = ((struct LxmlDocument *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":2079
 *     return _documentFactory(c_doc, parser)
 * 
 * cdef _Document _parseFilelikeDocument(source, url, _BaseParser parser):             # <<<<<<<<<<<<<<
 *     c_doc = _parseDocFromFilelike(source, url, parser)
 *     return _documentFactory(c_doc, parser)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._parseFilelikeDocument", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/saxparser.pxi":10
 *     This class may get replaced by a plain XMLSyntaxError in a future version.
 *     """
 *     def __init__(self, message):             # <<<<<<<<<<<<<<
 *         XMLSyntaxError.__init__(self, message, None, 0, 1)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_23XMLSyntaxAssertionError_1__init__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_23XMLSyntaxAssertionError_1__init__ = {"__init__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_23XMLSyntaxAssertionError_1__init__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_23XMLSyntaxAssertionError_1__init__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_message = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_message,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(5, 10, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(5, 10, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(5, 10, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(5, 10, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, i); __PYX_ERR(5, 10, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(5, 10, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(5, 10, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
    __pyx_v_message = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, __pyx_nargs); __PYX_ERR(5, 10, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.XMLSyntaxAssertionError.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_23XMLSyntaxAssertionError___init__(__pyx_self, __pyx_v_self, __pyx_v_message);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_23XMLSyntaxAssertionError___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_message) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "src/lxml/saxparser.pxi":11
 *     """
 *     def __init__(self, message):
 *         XMLSyntaxError.__init__(self, message, None, 0, 1)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_XMLSyntaxError); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 11, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_init); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 11, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
    __pyx_t_5 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[6] = {__pyx_t_2, __pyx_v_self, __pyx_v_message, Py_None, __pyx_mstate_global->__pyx_int_0, __pyx_mstate_global->__pyx_int_1};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (6-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 11, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/saxparser.pxi":10
 *     This class may get replaced by a plain XMLSyntaxError in a future version.
 *     """
 *     def __init__(self, message):             # <<<<<<<<<<<<<<
 *         XMLSyntaxError.__init__(self, message, None, 0, 1)
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.XMLSyntaxAssertionError.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/saxparser.pxi":33
 * 
 * 
 * cdef int _buildParseEventFilter(events) except -1:             # <<<<<<<<<<<<<<
 *     cdef int event_filter = 0
 *     for event in events:
*/

static int __pyx_f_4lxml_5etree__buildParseEventFilter(PyObject *__pyx_v_events) {
  int __pyx_v_event_filter;
  PyObject *__pyx_v_event = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6[3];
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_buildParseEventFilter", 0);

  /* "src/lxml/saxparser.pxi":34
 * 
 * cdef int _buildParseEventFilter(events) except -1:
 *     cdef int event_filter = 0             # <<<<<<<<<<<<<<
 *     for event in events:
 *         if event == 'start':
*/
  __pyx_v_event_filter = 0;

  /* "src/lxml/saxparser.pxi":35
 * cdef int _buildParseEventFilter(events) except -1:
 *     cdef int event_filter = 0
 *     for event in events:             # <<<<<<<<<<<<<<
 *         if event == 'start':
 *             event_filter |= PARSE_EVENT_FILTER_START
*/
  if (likely(PyList_CheckExact(__pyx_v_events)) || PyTuple_CheckExact(__pyx_v_events)) {
    __pyx_t_1 = __pyx_v_events; __Pyx_INCREF(__pyx_t_1);
    __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_events); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 35, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 35, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(5, 35, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference);
        ++__pyx_t_2;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(5, 35, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2));
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2);
        #endif
        ++__pyx_t_2;
      }
      if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 35, __pyx_L1_error)
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(5, 35, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XDECREF_SET(__pyx_v_event, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "src/lxml/saxparser.pxi":36
 *     cdef int event_filter = 0
 *     for event in events:
 *         if event == 'start':             # <<<<<<<<<<<<<<
 *             event_filter |= PARSE_EVENT_FILTER_START
 *         elif event == 'end':
*/
    __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_v_event, __pyx_mstate_global->__pyx_n_u_start, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(5, 36, __pyx_L1_error)
    if (__pyx_t_5) {

      /* "src/lxml/saxparser.pxi":37
 *     for event in events:
 *         if event == 'start':
 *             event_filter |= PARSE_EVENT_FILTER_START             # <<<<<<<<<<<<<<
 *         elif event == 'end':
 *             event_filter |= PARSE_EVENT_FILTER_END
*/
      __pyx_v_event_filter = (__pyx_v_event_filter | __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_START);

      /* "src/lxml/saxparser.pxi":36
 *     cdef int event_filter = 0
 *     for event in events:
 *         if event == 'start':             # <<<<<<<<<<<<<<
 *             event_filter |= PARSE_EVENT_FILTER_START
 *         elif event == 'end':
*/
      goto __pyx_L5;
    }

    /* "src/lxml/saxparser.pxi":38
 *         if event == 'start':
 *             event_filter |= PARSE_EVENT_FILTER_START
 *         elif event == 'end':             # <<<<<<<<<<<<<<
 *             event_filter |= PARSE_EVENT_FILTER_END
 *         elif event == 'start-ns':
*/
    __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_v_event, __pyx_mstate_global->__pyx_n_u_end, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(5, 38, __pyx_L1_error)
    if (__pyx_t_5) {

      /* "src/lxml/saxparser.pxi":39
 *             event_filter |= PARSE_EVENT_FILTER_START
 *         elif event == 'end':
 *             event_filter |= PARSE_EVENT_FILTER_END             # <<<<<<<<<<<<<<
 *         elif event == 'start-ns':
 *             event_filter |= PARSE_EVENT_FILTER_START_NS
*/
      __pyx_v_event_filter = (__pyx_v_event_filter | __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_END);

      /* "src/lxml/saxparser.pxi":38
 *         if event == 'start':
 *             event_filter |= PARSE_EVENT_FILTER_START
 *         elif event == 'end':             # <<<<<<<<<<<<<<
 *             event_filter |= PARSE_EVENT_FILTER_END
 *         elif event == 'start-ns':
*/
      goto __pyx_L5;
    }

    /* "src/lxml/saxparser.pxi":40
 *         elif event == 'end':
 *             event_filter |= PARSE_EVENT_FILTER_END
 *         elif event == 'start-ns':             # <<<<<<<<<<<<<<
 *             event_filter |= PARSE_EVENT_FILTER_START_NS
 *         elif event == 'end-ns':
*/
    __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_v_event, __pyx_mstate_global->__pyx_kp_u_start_ns, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(5, 40, __pyx_L1_error)
    if (__pyx_t_5) {

      /* "src/lxml/saxparser.pxi":41
 *             event_filter |= PARSE_EVENT_FILTER_END
 *         elif event == 'start-ns':
 *             event_filter |= PARSE_EVENT_FILTER_START_NS             # <<<<<<<<<<<<<<
 *         elif event == 'end-ns':
 *             event_filter |= PARSE_EVENT_FILTER_END_NS
*/
      __pyx_v_event_filter = (__pyx_v_event_filter | __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_START_NS);

      /* "src/lxml/saxparser.pxi":40
 *         elif event == 'end':
 *             event_filter |= PARSE_EVENT_FILTER_END
 *         elif event == 'start-ns':             # <<<<<<<<<<<<<<
 *             event_filter |= PARSE_EVENT_FILTER_START_NS
 *         elif event == 'end-ns':
*/
      goto __pyx_L5;
    }

    /* "src/lxml/saxparser.pxi":42
 *         elif event == 'start-ns':
 *             event_filter |= PARSE_EVENT_FILTER_START_NS
 *         elif event == 'end-ns':             # <<<<<<<<<<<<<<
 *             event_filter |= PARSE_EVENT_FILTER_END_NS
 *         elif event == 'comment':
*/
    __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_v_event, __pyx_mstate_global->__pyx_kp_u_end_ns, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(5, 42, __pyx_L1_error)
    if (__pyx_t_5) {

      /* "src/lxml/saxparser.pxi":43
 *             event_filter |= PARSE_EVENT_FILTER_START_NS
 *         elif event == 'end-ns':
 *             event_filter |= PARSE_EVENT_FILTER_END_NS             # <<<<<<<<<<<<<<
 *         elif event == 'comment':
 *             event_filter |= PARSE_EVENT_FILTER_COMMENT
*/
      __pyx_v_event_filter = (__pyx_v_event_filter | __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_END_NS);

      /* "src/lxml/saxparser.pxi":42
 *         elif event == 'start-ns':
 *             event_filter |= PARSE_EVENT_FILTER_START_NS
 *         elif event == 'end-ns':             # <<<<<<<<<<<<<<
 *             event_filter |= PARSE_EVENT_FILTER_END_NS
 *         elif event == 'comment':
*/
      goto __pyx_L5;
    }

    /* "src/lxml/saxparser.pxi":44
 *         elif event == 'end-ns':
 *             event_filter |= PARSE_EVENT_FILTER_END_NS
 *         elif event == 'comment':             # <<<<<<<<<<<<<<
 *             event_filter |= PARSE_EVENT_FILTER_COMMENT
 *         elif event == 'pi':
*/
    __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_v_event, __pyx_mstate_global->__pyx_n_u_comment, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(5, 44, __pyx_L1_error)
    if (__pyx_t_5) {

      /* "src/lxml/saxparser.pxi":45
 *             event_filter |= PARSE_EVENT_FILTER_END_NS
 *         elif event == 'comment':
 *             event_filter |= PARSE_EVENT_FILTER_COMMENT             # <<<<<<<<<<<<<<
 *         elif event == 'pi':
 *             event_filter |= PARSE_EVENT_FILTER_PI
*/
      __pyx_v_event_filter = (__pyx_v_event_filter | __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_COMMENT);

      /* "src/lxml/saxparser.pxi":44
 *         elif event == 'end-ns':
 *             event_filter |= PARSE_EVENT_FILTER_END_NS
 *         elif event == 'comment':             # <<<<<<<<<<<<<<
 *             event_filter |= PARSE_EVENT_FILTER_COMMENT
 *         elif event == 'pi':
*/
      goto __pyx_L5;
    }

    /* "src/lxml/saxparser.pxi":46
 *         elif event == 'comment':
 *             event_filter |= PARSE_EVENT_FILTER_COMMENT
 *         elif event == 'pi':             # <<<<<<<<<<<<<<
 *             event_filter |= PARSE_EVENT_FILTER_PI
 *         else:
*/
    __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_v_event, __pyx_mstate_global->__pyx_n_u_pi, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(5, 46, __pyx_L1_error)
    if (likely(__pyx_t_5)) {

      /* "src/lxml/saxparser.pxi":47
 *             event_filter |= PARSE_EVENT_FILTER_COMMENT
 *         elif event == 'pi':
 *             event_filter |= PARSE_EVENT_FILTER_PI             # <<<<<<<<<<<<<<
 *         else:
 *             raise ValueError, f"invalid event name '{event}'"
*/
      __pyx_v_event_filter = (__pyx_v_event_filter | __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_PI);

      /* "src/lxml/saxparser.pxi":46
 *         elif event == 'comment':
 *             event_filter |= PARSE_EVENT_FILTER_COMMENT
 *         elif event == 'pi':             # <<<<<<<<<<<<<<
 *             event_filter |= PARSE_EVENT_FILTER_PI
 *         else:
*/
      goto __pyx_L5;
    }

    /* "src/lxml/saxparser.pxi":49
 *             event_filter |= PARSE_EVENT_FILTER_PI
 *         else:
 *             raise ValueError, f"invalid event name '{event}'"             # <<<<<<<<<<<<<<
 *     return event_filter
 * 
*/
    /*else*/ {
      __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_event, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 49, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6[0] = __pyx_mstate_global->__pyx_kp_u_invalid_event_name;
      __pyx_t_6[1] = __pyx_t_4;
      __pyx_t_6[2] = __pyx_mstate_global->__pyx_kp_u__4;
      __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_6, 3, 20 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4));
      if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 49, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_t_7, 0, 0);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __PYX_ERR(5, 49, __pyx_L1_error)
    }
    __pyx_L5:;

    /* "src/lxml/saxparser.pxi":35
 * cdef int _buildParseEventFilter(events) except -1:
 *     cdef int event_filter = 0
 *     for event in events:             # <<<<<<<<<<<<<<
 *         if event == 'start':
 *             event_filter |= PARSE_EVENT_FILTER_START
*/
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/saxparser.pxi":50
 *         else:
 *             raise ValueError, f"invalid event name '{event}'"
 *     return event_filter             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = __pyx_v_event_filter;
  goto __pyx_L0;

  /* "src/lxml/saxparser.pxi":33
 * 
 * 
 * cdef int _buildParseEventFilter(events) except -1:             # <<<<<<<<<<<<<<
 *     cdef int event_filter = 0
 *     for event in events:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree._buildParseEventFilter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_event);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/saxparser.pxi":56
 *     cdef int _sax_event_filter
 * 
 *     cdef _handleSaxStart(self, tag, attrib, nsmap):             # <<<<<<<<<<<<<<
 *         return None
 *     cdef _handleSaxEnd(self, tag):
*/

static PyObject *__pyx_f_4lxml_5etree_16_SaxParserTarget__handleSaxStart(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__SaxParserTarget *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_tag, CYTHON_UNUSED PyObject *__pyx_v_attrib, CYTHON_UNUSED PyObject *__pyx_v_nsmap) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_handleSaxStart", 0);

  /* "src/lxml/saxparser.pxi":57
 * 
 *     cdef _handleSaxStart(self, tag, attrib, nsmap):
 *         return None             # <<<<<<<<<<<<<<
 *     cdef _handleSaxEnd(self, tag):
 *         return None
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "src/lxml/saxparser.pxi":56
 *     cdef int _sax_event_filter
 * 
 *     cdef _handleSaxStart(self, tag, attrib, nsmap):             # <<<<<<<<<<<<<<
 *         return None
 *     cdef _handleSaxEnd(self, tag):
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/saxparser.pxi":58
 *     cdef _handleSaxStart(self, tag, attrib, nsmap):
 *         return None
 *     cdef _handleSaxEnd(self, tag):             # <<<<<<<<<<<<<<
 *         return None
 *     cdef int _handleSaxData(self, data) except -1:
*/

static PyObject *__pyx_f_4lxml_5etree_16_SaxParserTarget__handleSaxEnd(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__SaxParserTarget *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_tag) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_handleSaxEnd", 0);

  /* "src/lxml/saxparser.pxi":59
 *         return None
 *     cdef _handleSaxEnd(self, tag):
 *         return None             # <<<<<<<<<<<<<<
 *     cdef int _handleSaxData(self, data) except -1:
 *         return 0
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "src/lxml/saxparser.pxi":58
 *     cdef _handleSaxStart(self, tag, attrib, nsmap):
 *         return None
 *     cdef _handleSaxEnd(self, tag):             # <<<<<<<<<<<<<<
 *         return None
 *     cdef int _handleSaxData(self, data) except -1:
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/saxparser.pxi":60
 *     cdef _handleSaxEnd(self, tag):
 *         return None
 *     cdef int _handleSaxData(self, data) except -1:             # <<<<<<<<<<<<<<
 *         return 0
 *     cdef int _handleSaxDoctype(self, root_tag, public_id, system_id) except -1:
*/

static int __pyx_f_4lxml_5etree_16_SaxParserTarget__handleSaxData(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__SaxParserTarget *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_data) {
  int __pyx_r;

  /* "src/lxml/saxparser.pxi":61
 *         return None
 *     cdef int _handleSaxData(self, data) except -1:
 *         return 0             # <<<<<<<<<<<<<<
 *     cdef int _handleSaxDoctype(self, root_tag, public_id, system_id) except -1:
 *         return 0
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/saxparser.pxi":60
 *     cdef _handleSaxEnd(self, tag):
 *         return None
 *     cdef int _handleSaxData(self, data) except -1:             # <<<<<<<<<<<<<<
 *         return 0
 *     cdef int _handleSaxDoctype(self, root_tag, public_id, system_id) except -1:
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/saxparser.pxi":62
 *     cdef int _handleSaxData(self, data) except -1:
 *         return 0
 *     cdef int _handleSaxDoctype(self, root_tag, public_id, system_id) except -1:             # <<<<<<<<<<<<<<
 *         return 0
 *     cdef _handleSaxPi(self, target, data):
*/

static int __pyx_f_4lxml_5etree_16_SaxParserTarget__handleSaxDoctype(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__SaxParserTarget *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_root_tag, CYTHON_UNUSED PyObject *__pyx_v_public_id, CYTHON_UNUSED PyObject *__pyx_v_system_id) {
  int __pyx_r;

  /* "src/lxml/saxparser.pxi":63
 *         return 0
 *     cdef int _handleSaxDoctype(self, root_tag, public_id, system_id) except -1:
 *         return 0             # <<<<<<<<<<<<<<
 *     cdef _handleSaxPi(self, target, data):
 *         return None
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/saxparser.pxi":62
 *     cdef int _handleSaxData(self, data) except -1:
 *         return 0
 *     cdef int _handleSaxDoctype(self, root_tag, public_id, system_id) except -1:             # <<<<<<<<<<<<<<
 *         return 0
 *     cdef _handleSaxPi(self, target, data):
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/saxparser.pxi":64
 *     cdef int _handleSaxDoctype(self, root_tag, public_id, system_id) except -1:
 *         return 0
 *     cdef _handleSaxPi(self, target, data):             # <<<<<<<<<<<<<<
 *         return None
 *     cdef _handleSaxComment(self, comment):
*/

static PyObject *__pyx_f_4lxml_5etree_16_SaxParserTarget__handleSaxPi(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__SaxParserTarget *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_target, CYTHON_UNUSED PyObject *__pyx_v_data) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_handleSaxPi", 0);

  /* "src/lxml/saxparser.pxi":65
 *         return 0
 *     cdef _handleSaxPi(self, target, data):
 *         return None             # <<<<<<<<<<<<<<
 *     cdef _handleSaxComment(self, comment):
 *         return None
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "src/lxml/saxparser.pxi":64
 *     cdef int _handleSaxDoctype(self, root_tag, public_id, system_id) except -1:
 *         return 0
 *     cdef _handleSaxPi(self, target, data):             # <<<<<<<<<<<<<<
 *         return None
 *     cdef _handleSaxComment(self, comment):
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/saxparser.pxi":66
 *     cdef _handleSaxPi(self, target, data):
 *         return None
 *     cdef _handleSaxComment(self, comment):             # <<<<<<<<<<<<<<
 *         return None
 *     cdef _handleSaxStartNs(self, prefix, uri):
*/

static PyObject *__pyx_f_4lxml_5etree_16_SaxParserTarget__handleSaxComment(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__SaxParserTarget *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_comment) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_handleSaxComment", 0);

  /* "src/lxml/saxparser.pxi":67
 *         return None
 *     cdef _handleSaxComment(self, comment):
 *         return None             # <<<<<<<<<<<<<<
 *     cdef _handleSaxStartNs(self, prefix, uri):
 *         return None
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "src/lxml/saxparser.pxi":66
 *     cdef _handleSaxPi(self, target, data):
 *         return None
 *     cdef _handleSaxComment(self, comment):             # <<<<<<<<<<<<<<
 *         return None
 *     cdef _handleSaxStartNs(self, prefix, uri):
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/saxparser.pxi":68
 *     cdef _handleSaxComment(self, comment):
 *         return None
 *     cdef _handleSaxStartNs(self, prefix, uri):             # <<<<<<<<<<<<<<
 *         return None
 *     cdef _handleSaxEndNs(self, prefix):
*/

static PyObject *__pyx_f_4lxml_5etree_16_SaxParserTarget__handleSaxStartNs(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__SaxParserTarget *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_prefix, CYTHON_UNUSED PyObject *__pyx_v_uri) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_handleSaxStartNs", 0);

  /* "src/lxml/saxparser.pxi":69
 *         return None
 *     cdef _handleSaxStartNs(self, prefix, uri):
 *         return None             # <<<<<<<<<<<<<<
 *     cdef _handleSaxEndNs(self, prefix):
 *         return None
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "src/lxml/saxparser.pxi":68
 *     cdef _handleSaxComment(self, comment):
 *         return None
 *     cdef _handleSaxStartNs(self, prefix, uri):             # <<<<<<<<<<<<<<
 *         return None
 *     cdef _handleSaxEndNs(self, prefix):
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/saxparser.pxi":70
 *     cdef _handleSaxStartNs(self, prefix, uri):
 *         return None
 *     cdef _handleSaxEndNs(self, prefix):             # <<<<<<<<<<<<<<
 *         return None
 * 
*/

static PyObject *__pyx_f_4lxml_5etree_16_SaxParserTarget__handleSaxEndNs(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__SaxParserTarget *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_prefix) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_handleSaxEndNs", 0);

  /* "src/lxml/saxparser.pxi":71
 *         return None
 *     cdef _handleSaxEndNs(self, prefix):
 *         return None             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "src/lxml/saxparser.pxi":70
 *     cdef _handleSaxStartNs(self, prefix, uri):
 *         return None
 *     cdef _handleSaxEndNs(self, prefix):             # <<<<<<<<<<<<<<
 *         return None
 * 
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/saxparser.pxi":103
 *     cdef _MultiTagMatcher _matcher
 * 
 *     def __cinit__(self, _BaseParser parser):             # <<<<<<<<<<<<<<
 *         self._ns_stack = []
 *         self._node_stack = []
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_17_SaxParserContext_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_17_SaxParserContext_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_parser,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(5, 103, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(5, 103, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__cinit__", 0) < (0)) __PYX_ERR(5, 103, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, i); __PYX_ERR(5, 103, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(5, 103, __pyx_L3_error)
    }
    __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)values[0]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, __pyx_nargs); __PYX_ERR(5, 103, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._SaxParserContext.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parser), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__BaseParser, 1, "parser", 0))) __PYX_ERR(5, 103, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_17_SaxParserContext___cinit__(((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_v_self), __pyx_v_parser);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_17_SaxParserContext___cinit__(struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_self, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "src/lxml/saxparser.pxi":104
 * 
 *     def __cinit__(self, _BaseParser parser):
 *         self._ns_stack = []             # <<<<<<<<<<<<<<
 *         self._node_stack = []
 *         self._parser = parser
*/
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 104, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_ns_stack);
  __Pyx_DECREF(__pyx_v_self->_ns_stack);
  __pyx_v_self->_ns_stack = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/saxparser.pxi":105
 *     def __cinit__(self, _BaseParser parser):
 *         self._ns_stack = []
 *         self._node_stack = []             # <<<<<<<<<<<<<<
 *         self._parser = parser
 *         self.events_iterator = _ParseEventsIterator()
*/
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 105, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_node_stack);
  __Pyx_DECREF(__pyx_v_self->_node_stack);
  __pyx_v_self->_node_stack = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/saxparser.pxi":106
 *         self._ns_stack = []
 *         self._node_stack = []
 *         self._parser = parser             # <<<<<<<<<<<<<<
 *         self.events_iterator = _ParseEventsIterator()
 * 
*/
  __Pyx_INCREF((PyObject *)__pyx_v_parser);
  __Pyx_GIVEREF((PyObject *)__pyx_v_parser);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_parser);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_parser);
  __pyx_v_self->_parser = __pyx_v_parser;

  /* "src/lxml/saxparser.pxi":107
 *         self._node_stack = []
 *         self._parser = parser
 *         self.events_iterator = _ParseEventsIterator()             # <<<<<<<<<<<<<<
 * 
 *     cdef void _setSaxParserTarget(self, _SaxParserTarget target) noexcept:
*/
  __pyx_t_2 = NULL;
  __pyx_t_3 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ParseEventsIterator, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 107, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __Pyx_GIVEREF((PyObject *)__pyx_t_1);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->events_iterator);
  __Pyx_DECREF((PyObject *)__pyx_v_self->events_iterator);
  __pyx_v_self->events_iterator = ((struct __pyx_obj_4lxml_5etree__ParseEventsIterator *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/saxparser.pxi":103
 *     cdef _MultiTagMatcher _matcher
 * 
 *     def __cinit__(self, _BaseParser parser):             # <<<<<<<<<<<<<<
 *         self._ns_stack = []
 *         self._node_stack = []
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._SaxParserContext.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/saxparser.pxi":109
 *         self.events_iterator = _ParseEventsIterator()
 * 
 *     cdef void _setSaxParserTarget(self, _SaxParserTarget target) noexcept:             # <<<<<<<<<<<<<<
 *         self._target = target
 * 
*/

static void __pyx_f_4lxml_5etree_17_SaxParserContext__setSaxParserTarget(struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_self, struct __pyx_obj_4lxml_5etree__SaxParserTarget *__pyx_v_target) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_setSaxParserTarget", 0);

  /* "src/lxml/saxparser.pxi":110
 * 
 *     cdef void _setSaxParserTarget(self, _SaxParserTarget target) noexcept:
 *         self._target = target             # <<<<<<<<<<<<<<
 * 
 *     cdef void _initParserContext(self, xmlparser.xmlParserCtxt* c_ctxt) noexcept:
*/
  __Pyx_INCREF((PyObject *)__pyx_v_target);
  __Pyx_GIVEREF((PyObject *)__pyx_v_target);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_target);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_target);
  __pyx_v_self->_target = __pyx_v_target;

  /* "src/lxml/saxparser.pxi":109
 *         self.events_iterator = _ParseEventsIterator()
 * 
 *     cdef void _setSaxParserTarget(self, _SaxParserTarget target) noexcept:             # <<<<<<<<<<<<<<
 *         self._target = target
 * 
*/

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "src/lxml/saxparser.pxi":112
 *         self._target = target
 * 
 *     cdef void _initParserContext(self, xmlparser.xmlParserCtxt* c_ctxt) noexcept:             # <<<<<<<<<<<<<<
 *         _ParserContext._initParserContext(self, c_ctxt)
 *         if self._target is not None:
*/

static void __pyx_f_4lxml_5etree_17_SaxParserContext__initParserContext(struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_self, xmlParserCtxt *__pyx_v_c_ctxt) {
  int __pyx_t_1;

  /* "src/lxml/saxparser.pxi":113
 * 
 *     cdef void _initParserContext(self, xmlparser.xmlParserCtxt* c_ctxt) noexcept:
 *         _ParserContext._initParserContext(self, c_ctxt)             # <<<<<<<<<<<<<<
 *         if self._target is not None:
 *             self._connectTarget(c_ctxt)
*/
  __pyx_f_4lxml_5etree_14_ParserContext__initParserContext(((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_v_self), __pyx_v_c_ctxt);

  /* "src/lxml/saxparser.pxi":114
 *     cdef void _initParserContext(self, xmlparser.xmlParserCtxt* c_ctxt) noexcept:
 *         _ParserContext._initParserContext(self, c_ctxt)
 *         if self._target is not None:             # <<<<<<<<<<<<<<
 *             self._connectTarget(c_ctxt)
 *         elif self._event_filter:
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_self->_target) != Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/saxparser.pxi":115
 *         _ParserContext._initParserContext(self, c_ctxt)
 *         if self._target is not None:
 *             self._connectTarget(c_ctxt)             # <<<<<<<<<<<<<<
 *         elif self._event_filter:
 *             self._connectEvents(c_ctxt)
*/
    ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->_connectTarget(__pyx_v_self, __pyx_v_c_ctxt);

    /* "src/lxml/saxparser.pxi":114
 *     cdef void _initParserContext(self, xmlparser.xmlParserCtxt* c_ctxt) noexcept:
 *         _ParserContext._initParserContext(self, c_ctxt)
 *         if self._target is not None:             # <<<<<<<<<<<<<<
 *             self._connectTarget(c_ctxt)
 *         elif self._event_filter:
*/
    goto __pyx_L3;
  }

  /* "src/lxml/saxparser.pxi":116
 *         if self._target is not None:
 *             self._connectTarget(c_ctxt)
 *         elif self._event_filter:             # <<<<<<<<<<<<<<
 *             self._connectEvents(c_ctxt)
 * 
*/
  __pyx_t_1 = (__pyx_v_self->_event_filter != 0);
  if (__pyx_t_1) {

    /* "src/lxml/saxparser.pxi":117
 *             self._connectTarget(c_ctxt)
 *         elif self._event_filter:
 *             self._connectEvents(c_ctxt)             # <<<<<<<<<<<<<<
 * 
 *     cdef void _connectTarget(self, xmlparser.xmlParserCtxt* c_ctxt) noexcept:
*/
    ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->_connectEvents(__pyx_v_self, __pyx_v_c_ctxt);

    /* "src/lxml/saxparser.pxi":116
 *         if self._target is not None:
 *             self._connectTarget(c_ctxt)
 *         elif self._event_filter:             # <<<<<<<<<<<<<<
 *             self._connectEvents(c_ctxt)
 * 
*/
  }
  __pyx_L3:;

  /* "src/lxml/saxparser.pxi":112
 *         self._target = target
 * 
 *     cdef void _initParserContext(self, xmlparser.xmlParserCtxt* c_ctxt) noexcept:             # <<<<<<<<<<<<<<
 *         _ParserContext._initParserContext(self, c_ctxt)
 *         if self._target is not None:
*/

  /* function exit code */
}

/* "src/lxml/saxparser.pxi":119
 *             self._connectEvents(c_ctxt)
 * 
 *     cdef void _connectTarget(self, xmlparser.xmlParserCtxt* c_ctxt) noexcept:             # <<<<<<<<<<<<<<
 *         """Wrap original SAX2 callbacks to call into parser target.
 *         """
*/

static void __pyx_f_4lxml_5etree_17_SaxParserContext__connectTarget(struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_self, xmlParserCtxt *__pyx_v_c_ctxt) {
  xmlSAXHandler *__pyx_v_sax;
  xmlSAXHandler *__pyx_t_1;
  int __pyx_t_2;
  internalSubsetSAXFunc __pyx_t_3;

  /* "src/lxml/saxparser.pxi":122
 *         """Wrap original SAX2 callbacks to call into parser target.
 *         """
 *         sax = c_ctxt.sax             # <<<<<<<<<<<<<<
 *         self._origSaxStart = sax.startElementNs = NULL
 *         self._origSaxStartNoNs = sax.startElement = NULL
*/
  __pyx_t_1 = __pyx_v_c_ctxt->sax;
  __pyx_v_sax = __pyx_t_1;

  /* "src/lxml/saxparser.pxi":123
 *         """
 *         sax = c_ctxt.sax
 *         self._origSaxStart = sax.startElementNs = NULL             # <<<<<<<<<<<<<<
 *         self._origSaxStartNoNs = sax.startElement = NULL
 *         if self._target._sax_event_filter & (SAX_EVENT_START |
*/
  __pyx_v_self->_origSaxStart = NULL;
  __pyx_v_sax->startElementNs = NULL;

  /* "src/lxml/saxparser.pxi":124
 *         sax = c_ctxt.sax
 *         self._origSaxStart = sax.startElementNs = NULL
 *         self._origSaxStartNoNs = sax.startElement = NULL             # <<<<<<<<<<<<<<
 *         if self._target._sax_event_filter & (SAX_EVENT_START |
 *                                              SAX_EVENT_START_NS |
*/
  __pyx_v_self->_origSaxStartNoNs = NULL;
  __pyx_v_sax->startElement = NULL;

  /* "src/lxml/saxparser.pxi":125
 *         self._origSaxStart = sax.startElementNs = NULL
 *         self._origSaxStartNoNs = sax.startElement = NULL
 *         if self._target._sax_event_filter & (SAX_EVENT_START |             # <<<<<<<<<<<<<<
 *                                              SAX_EVENT_START_NS |
 *                                              SAX_EVENT_END_NS):
*/
  __pyx_t_2 = ((__pyx_v_self->_target->_sax_event_filter & ((__pyx_e_4lxml_5etree_SAX_EVENT_START | __pyx_e_4lxml_5etree_SAX_EVENT_START_NS) | __pyx_e_4lxml_5etree_SAX_EVENT_END_NS)) != 0);
  if (__pyx_t_2) {

    /* "src/lxml/saxparser.pxi":130
 *             # intercept => overwrite orig callback
 *             # FIXME: also intercept on when collecting END events
 *             if sax.initialized == xmlparser.XML_SAX2_MAGIC:             # <<<<<<<<<<<<<<
 *                 sax.startElementNs = _handleSaxTargetStart
 *             if self._target._sax_event_filter & SAX_EVENT_START:
*/
    __pyx_t_2 = (__pyx_v_sax->initialized == XML_SAX2_MAGIC);
    if (__pyx_t_2) {

      /* "src/lxml/saxparser.pxi":131
 *             # FIXME: also intercept on when collecting END events
 *             if sax.initialized == xmlparser.XML_SAX2_MAGIC:
 *                 sax.startElementNs = _handleSaxTargetStart             # <<<<<<<<<<<<<<
 *             if self._target._sax_event_filter & SAX_EVENT_START:
 *                 sax.startElement = _handleSaxTargetStartNoNs
*/
      __pyx_v_sax->startElementNs = __pyx_f_4lxml_5etree__handleSaxTargetStart;

      /* "src/lxml/saxparser.pxi":130
 *             # intercept => overwrite orig callback
 *             # FIXME: also intercept on when collecting END events
 *             if sax.initialized == xmlparser.XML_SAX2_MAGIC:             # <<<<<<<<<<<<<<
 *                 sax.startElementNs = _handleSaxTargetStart
 *             if self._target._sax_event_filter & SAX_EVENT_START:
*/
    }

    /* "src/lxml/saxparser.pxi":132
 *             if sax.initialized == xmlparser.XML_SAX2_MAGIC:
 *                 sax.startElementNs = _handleSaxTargetStart
 *             if self._target._sax_event_filter & SAX_EVENT_START:             # <<<<<<<<<<<<<<
 *                 sax.startElement = _handleSaxTargetStartNoNs
 * 
*/
    __pyx_t_2 = ((__pyx_v_self->_target->_sax_event_filter & __pyx_e_4lxml_5etree_SAX_EVENT_START) != 0);
    if (__pyx_t_2) {

      /* "src/lxml/saxparser.pxi":133
 *                 sax.startElementNs = _handleSaxTargetStart
 *             if self._target._sax_event_filter & SAX_EVENT_START:
 *                 sax.startElement = _handleSaxTargetStartNoNs             # <<<<<<<<<<<<<<
 * 
 *         self._origSaxEnd = sax.endElementNs = NULL
*/
      __pyx_v_sax->startElement = __pyx_f_4lxml_5etree__handleSaxTargetStartNoNs;

      /* "src/lxml/saxparser.pxi":132
 *             if sax.initialized == xmlparser.XML_SAX2_MAGIC:
 *                 sax.startElementNs = _handleSaxTargetStart
 *             if self._target._sax_event_filter & SAX_EVENT_START:             # <<<<<<<<<<<<<<
 *                 sax.startElement = _handleSaxTargetStartNoNs
 * 
*/
    }

    /* "src/lxml/saxparser.pxi":125
 *         self._origSaxStart = sax.startElementNs = NULL
 *         self._origSaxStartNoNs = sax.startElement = NULL
 *         if self._target._sax_event_filter & (SAX_EVENT_START |             # <<<<<<<<<<<<<<
 *                                              SAX_EVENT_START_NS |
 *                                              SAX_EVENT_END_NS):
*/
  }

  /* "src/lxml/saxparser.pxi":135
 *                 sax.startElement = _handleSaxTargetStartNoNs
 * 
 *         self._origSaxEnd = sax.endElementNs = NULL             # <<<<<<<<<<<<<<
 *         self._origSaxEndNoNs = sax.endElement = NULL
 *         if self._target._sax_event_filter & (SAX_EVENT_END |
*/
  __pyx_v_self->_origSaxEnd = NULL;
  __pyx_v_sax->endElementNs = NULL;

  /* "src/lxml/saxparser.pxi":136
 * 
 *         self._origSaxEnd = sax.endElementNs = NULL
 *         self._origSaxEndNoNs = sax.endElement = NULL             # <<<<<<<<<<<<<<
 *         if self._target._sax_event_filter & (SAX_EVENT_END |
 *                                              SAX_EVENT_END_NS):
*/
  __pyx_v_self->_origSaxEndNoNs = NULL;
  __pyx_v_sax->endElement = NULL;

  /* "src/lxml/saxparser.pxi":137
 *         self._origSaxEnd = sax.endElementNs = NULL
 *         self._origSaxEndNoNs = sax.endElement = NULL
 *         if self._target._sax_event_filter & (SAX_EVENT_END |             # <<<<<<<<<<<<<<
 *                                              SAX_EVENT_END_NS):
 *             if sax.initialized == xmlparser.XML_SAX2_MAGIC:
*/
  __pyx_t_2 = ((__pyx_v_self->_target->_sax_event_filter & (__pyx_e_4lxml_5etree_SAX_EVENT_END | __pyx_e_4lxml_5etree_SAX_EVENT_END_NS)) != 0);
  if (__pyx_t_2) {

    /* "src/lxml/saxparser.pxi":139
 *         if self._target._sax_event_filter & (SAX_EVENT_END |
 *                                              SAX_EVENT_END_NS):
 *             if sax.initialized == xmlparser.XML_SAX2_MAGIC:             # <<<<<<<<<<<<<<
 *                 sax.endElementNs = _handleSaxEnd
 *             if self._target._sax_event_filter & SAX_EVENT_END:
*/
    __pyx_t_2 = (__pyx_v_sax->initialized == XML_SAX2_MAGIC);
    if (__pyx_t_2) {

      /* "src/lxml/saxparser.pxi":140
 *                                              SAX_EVENT_END_NS):
 *             if sax.initialized == xmlparser.XML_SAX2_MAGIC:
 *                 sax.endElementNs = _handleSaxEnd             # <<<<<<<<<<<<<<
 *             if self._target._sax_event_filter & SAX_EVENT_END:
 *                 sax.endElement = _handleSaxEndNoNs
*/
      __pyx_v_sax->endElementNs = __pyx_f_4lxml_5etree__handleSaxEnd;

      /* "src/lxml/saxparser.pxi":139
 *         if self._target._sax_event_filter & (SAX_EVENT_END |
 *                                              SAX_EVENT_END_NS):
 *             if sax.initialized == xmlparser.XML_SAX2_MAGIC:             # <<<<<<<<<<<<<<
 *                 sax.endElementNs = _handleSaxEnd
 *             if self._target._sax_event_filter & SAX_EVENT_END:
*/
    }

    /* "src/lxml/saxparser.pxi":141
 *             if sax.initialized == xmlparser.XML_SAX2_MAGIC:
 *                 sax.endElementNs = _handleSaxEnd
 *             if self._target._sax_event_filter & SAX_EVENT_END:             # <<<<<<<<<<<<<<
 *                 sax.endElement = _handleSaxEndNoNs
 * 
*/
    __pyx_t_2 = ((__pyx_v_self->_target->_sax_event_filter & __pyx_e_4lxml_5etree_SAX_EVENT_END) != 0);
    if (__pyx_t_2) {

      /* "src/lxml/saxparser.pxi":142
 *                 sax.endElementNs = _handleSaxEnd
 *             if self._target._sax_event_filter & SAX_EVENT_END:
 *                 sax.endElement = _handleSaxEndNoNs             # <<<<<<<<<<<<<<
 * 
 *         self._origSaxData = sax.characters = sax.cdataBlock = NULL
*/
      __pyx_v_sax->endElement = __pyx_f_4lxml_5etree__handleSaxEndNoNs;

      /* "src/lxml/saxparser.pxi":141
 *             if sax.initialized == xmlparser.XML_SAX2_MAGIC:
 *                 sax.endElementNs = _handleSaxEnd
 *             if self._target._sax_event_filter & SAX_EVENT_END:             # <<<<<<<<<<<<<<
 *                 sax.endElement = _handleSaxEndNoNs
 * 
*/
    }

    /* "src/lxml/saxparser.pxi":137
 *         self._origSaxEnd = sax.endElementNs = NULL
 *         self._origSaxEndNoNs = sax.endElement = NULL
 *         if self._target._sax_event_filter & (SAX_EVENT_END |             # <<<<<<<<<<<<<<
 *                                              SAX_EVENT_END_NS):
 *             if sax.initialized == xmlparser.XML_SAX2_MAGIC:
*/
  }

  /* "src/lxml/saxparser.pxi":144
 *                 sax.endElement = _handleSaxEndNoNs
 * 
 *         self._origSaxData = sax.characters = sax.cdataBlock = NULL             # <<<<<<<<<<<<<<
 *         if self._target._sax_event_filter & SAX_EVENT_DATA:
 *             sax.characters = sax.cdataBlock = _handleSaxData
*/
  __pyx_v_self->_origSaxData = NULL;
  __pyx_v_sax->characters = NULL;
  __pyx_v_sax->cdataBlock = NULL;

  /* "src/lxml/saxparser.pxi":145
 * 
 *         self._origSaxData = sax.characters = sax.cdataBlock = NULL
 *         if self._target._sax_event_filter & SAX_EVENT_DATA:             # <<<<<<<<<<<<<<
 *             sax.characters = sax.cdataBlock = _handleSaxData
 * 
*/
  __pyx_t_2 = ((__pyx_v_self->_target->_sax_event_filter & __pyx_e_4lxml_5etree_SAX_EVENT_DATA) != 0);
  if (__pyx_t_2) {

    /* "src/lxml/saxparser.pxi":146
 *         self._origSaxData = sax.characters = sax.cdataBlock = NULL
 *         if self._target._sax_event_filter & SAX_EVENT_DATA:
 *             sax.characters = sax.cdataBlock = _handleSaxData             # <<<<<<<<<<<<<<
 * 
 *         # doctype propagation is always required for entity replacement
*/
    __pyx_v_sax->characters = __pyx_f_4lxml_5etree__handleSaxData;
    __pyx_v_sax->cdataBlock = __pyx_f_4lxml_5etree__handleSaxData;

    /* "src/lxml/saxparser.pxi":145
 * 
 *         self._origSaxData = sax.characters = sax.cdataBlock = NULL
 *         if self._target._sax_event_filter & SAX_EVENT_DATA:             # <<<<<<<<<<<<<<
 *             sax.characters = sax.cdataBlock = _handleSaxData
 * 
*/
  }

  /* "src/lxml/saxparser.pxi":149
 * 
 *         # doctype propagation is always required for entity replacement
 *         self._origSaxDoctype = sax.internalSubset             # <<<<<<<<<<<<<<
 *         if self._target._sax_event_filter & SAX_EVENT_DOCTYPE:
 *             sax.internalSubset = _handleSaxTargetDoctype
*/
  __pyx_t_3 = __pyx_v_sax->internalSubset;
  __pyx_v_self->_origSaxDoctype = __pyx_t_3;

  /* "src/lxml/saxparser.pxi":150
 *         # doctype propagation is always required for entity replacement
 *         self._origSaxDoctype = sax.internalSubset
 *         if self._target._sax_event_filter & SAX_EVENT_DOCTYPE:             # <<<<<<<<<<<<<<
 *             sax.internalSubset = _handleSaxTargetDoctype
 * 
*/
  __pyx_t_2 = ((__pyx_v_self->_target->_sax_event_filter & __pyx_e_4lxml_5etree_SAX_EVENT_DOCTYPE) != 0);
  if (__pyx_t_2) {

    /* "src/lxml/saxparser.pxi":151
 *         self._origSaxDoctype = sax.internalSubset
 *         if self._target._sax_event_filter & SAX_EVENT_DOCTYPE:
 *             sax.internalSubset = _handleSaxTargetDoctype             # <<<<<<<<<<<<<<
 * 
 *         self._origSaxPI = sax.processingInstruction = NULL
*/
    __pyx_v_sax->internalSubset = __pyx_f_4lxml_5etree__handleSaxTargetDoctype;

    /* "src/lxml/saxparser.pxi":150
 *         # doctype propagation is always required for entity replacement
 *         self._origSaxDoctype = sax.internalSubset
 *         if self._target._sax_event_filter & SAX_EVENT_DOCTYPE:             # <<<<<<<<<<<<<<
 *             sax.internalSubset = _handleSaxTargetDoctype
 * 
*/
  }

  /* "src/lxml/saxparser.pxi":153
 *             sax.internalSubset = _handleSaxTargetDoctype
 * 
 *         self._origSaxPI = sax.processingInstruction = NULL             # <<<<<<<<<<<<<<
 *         if self._target._sax_event_filter & SAX_EVENT_PI:
 *             sax.processingInstruction = _handleSaxTargetPI
*/
  __pyx_v_self->_origSaxPI = NULL;
  __pyx_v_sax->processingInstruction = NULL;

  /* "src/lxml/saxparser.pxi":154
 * 
 *         self._origSaxPI = sax.processingInstruction = NULL
 *         if self._target._sax_event_filter & SAX_EVENT_PI:             # <<<<<<<<<<<<<<
 *             sax.processingInstruction = _handleSaxTargetPI
 * 
*/
  __pyx_t_2 = ((__pyx_v_self->_target->_sax_event_filter & __pyx_e_4lxml_5etree_SAX_EVENT_PI) != 0);
  if (__pyx_t_2) {

    /* "src/lxml/saxparser.pxi":155
 *         self._origSaxPI = sax.processingInstruction = NULL
 *         if self._target._sax_event_filter & SAX_EVENT_PI:
 *             sax.processingInstruction = _handleSaxTargetPI             # <<<<<<<<<<<<<<
 * 
 *         self._origSaxComment = sax.comment = NULL
*/
    __pyx_v_sax->processingInstruction = __pyx_f_4lxml_5etree__handleSaxTargetPI;

    /* "src/lxml/saxparser.pxi":154
 * 
 *         self._origSaxPI = sax.processingInstruction = NULL
 *         if self._target._sax_event_filter & SAX_EVENT_PI:             # <<<<<<<<<<<<<<
 *             sax.processingInstruction = _handleSaxTargetPI
 * 
*/
  }

  /* "src/lxml/saxparser.pxi":157
 *             sax.processingInstruction = _handleSaxTargetPI
 * 
 *         self._origSaxComment = sax.comment = NULL             # <<<<<<<<<<<<<<
 *         if self._target._sax_event_filter & SAX_EVENT_COMMENT:
 *             sax.comment = _handleSaxTargetComment
*/
  __pyx_v_self->_origSaxComment = NULL;
  __pyx_v_sax->comment = NULL;

  /* "src/lxml/saxparser.pxi":158
 * 
 *         self._origSaxComment = sax.comment = NULL
 *         if self._target._sax_event_filter & SAX_EVENT_COMMENT:             # <<<<<<<<<<<<<<
 *             sax.comment = _handleSaxTargetComment
 * 
*/
  __pyx_t_2 = ((__pyx_v_self->_target->_sax_event_filter & __pyx_e_4lxml_5etree_SAX_EVENT_COMMENT) != 0);
  if (__pyx_t_2) {

    /* "src/lxml/saxparser.pxi":159
 *         self._origSaxComment = sax.comment = NULL
 *         if self._target._sax_event_filter & SAX_EVENT_COMMENT:
 *             sax.comment = _handleSaxTargetComment             # <<<<<<<<<<<<<<
 * 
 *         # enforce entity replacement
*/
    __pyx_v_sax->comment = __pyx_f_4lxml_5etree__handleSaxTargetComment;

    /* "src/lxml/saxparser.pxi":158
 * 
 *         self._origSaxComment = sax.comment = NULL
 *         if self._target._sax_event_filter & SAX_EVENT_COMMENT:             # <<<<<<<<<<<<<<
 *             sax.comment = _handleSaxTargetComment
 * 
*/
  }

  /* "src/lxml/saxparser.pxi":162
 * 
 *         # enforce entity replacement
 *         sax.reference = NULL             # <<<<<<<<<<<<<<
 *         c_ctxt.replaceEntities = 1
 * 
*/
  __pyx_v_sax->reference = NULL;

  /* "src/lxml/saxparser.pxi":163
 *         # enforce entity replacement
 *         sax.reference = NULL
 *         c_ctxt.replaceEntities = 1             # <<<<<<<<<<<<<<
 * 
 *     cdef void _connectEvents(self, xmlparser.xmlParserCtxt* c_ctxt) noexcept:
*/
  __pyx_v_c_ctxt->replaceEntities = 1;

  /* "src/lxml/saxparser.pxi":119
 *             self._connectEvents(c_ctxt)
 * 
 *     cdef void _connectTarget(self, xmlparser.xmlParserCtxt* c_ctxt) noexcept:             # <<<<<<<<<<<<<<
 *         """Wrap original SAX2 callbacks to call into parser target.
 *         """
*/

  /* function exit code */
}

/* "src/lxml/saxparser.pxi":165
 *         c_ctxt.replaceEntities = 1
 * 
 *     cdef void _connectEvents(self, xmlparser.xmlParserCtxt* c_ctxt) noexcept:             # <<<<<<<<<<<<<<
 *         """Wrap original SAX2 callbacks to collect parse events without parser target.
 *         """
*/

static void __pyx_f_4lxml_5etree_17_SaxParserContext__connectEvents(struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_self, xmlParserCtxt *__pyx_v_c_ctxt) {
  xmlSAXHandler *__pyx_v_sax;
  xmlSAXHandler *__pyx_t_1;
  startDocumentSAXFunc __pyx_t_2;
  startElementNsSAX2Func __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  startElementSAXFunc __pyx_t_6;
  endElementNsSAX2Func __pyx_t_7;
  endElementSAXFunc __pyx_t_8;
  commentSAXFunc __pyx_t_9;
  processingInstructionSAXFunc __pyx_t_10;

  /* "src/lxml/saxparser.pxi":168
 *         """Wrap original SAX2 callbacks to collect parse events without parser target.
 *         """
 *         sax = c_ctxt.sax             # <<<<<<<<<<<<<<
 *         self._origSaxStartDocument = sax.startDocument
 *         sax.startDocument = _handleSaxStartDocument
*/
  __pyx_t_1 = __pyx_v_c_ctxt->sax;
  __pyx_v_sax = __pyx_t_1;

  /* "src/lxml/saxparser.pxi":169
 *         """
 *         sax = c_ctxt.sax
 *         self._origSaxStartDocument = sax.startDocument             # <<<<<<<<<<<<<<
 *         sax.startDocument = _handleSaxStartDocument
 * 
*/
  __pyx_t_2 = __pyx_v_sax->startDocument;
  __pyx_v_self->_origSaxStartDocument = __pyx_t_2;

  /* "src/lxml/saxparser.pxi":170
 *         sax = c_ctxt.sax
 *         self._origSaxStartDocument = sax.startDocument
 *         sax.startDocument = _handleSaxStartDocument             # <<<<<<<<<<<<<<
 * 
 *         # only override "start" event handler if needed
*/
  __pyx_v_sax->startDocument = __pyx_f_4lxml_5etree__handleSaxStartDocument;

  /* "src/lxml/saxparser.pxi":173
 * 
 *         # only override "start" event handler if needed
 *         self._origSaxStart = sax.startElementNs             # <<<<<<<<<<<<<<
 *         if self._event_filter == 0 or c_ctxt.html or \
 *                self._event_filter & (PARSE_EVENT_FILTER_START |
*/
  __pyx_t_3 = __pyx_v_sax->startElementNs;
  __pyx_v_self->_origSaxStart = __pyx_t_3;

  /* "src/lxml/saxparser.pxi":174
 *         # only override "start" event handler if needed
 *         self._origSaxStart = sax.startElementNs
 *         if self._event_filter == 0 or c_ctxt.html or \             # <<<<<<<<<<<<<<
 *                self._event_filter & (PARSE_EVENT_FILTER_START |
 *                                      PARSE_EVENT_FILTER_END |
*/
  __pyx_t_5 = (__pyx_v_self->_event_filter == 0);
  if (!__pyx_t_5) {
  } else {
    __pyx_t_4 = __pyx_t_5;
    goto __pyx_L4_bool_binop_done;
  }
  if (!__pyx_v_c_ctxt->html) {
  } else {
    __pyx_t_4 = __pyx_v_c_ctxt->html;
    goto __pyx_L4_bool_binop_done;
  }

  /* "src/lxml/saxparser.pxi":175
 *         self._origSaxStart = sax.startElementNs
 *         if self._event_filter == 0 or c_ctxt.html or \
 *                self._event_filter & (PARSE_EVENT_FILTER_START |             # <<<<<<<<<<<<<<
 *                                      PARSE_EVENT_FILTER_END |
 *                                      PARSE_EVENT_FILTER_START_NS |
*/
  __pyx_t_5 = ((__pyx_v_self->_event_filter & (((__pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_START | __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_END) | __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_START_NS) | __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_END_NS)) != 0);
  __pyx_t_4 = __pyx_t_5;
  __pyx_L4_bool_binop_done:;

  /* "src/lxml/saxparser.pxi":174
 *         # only override "start" event handler if needed
 *         self._origSaxStart = sax.startElementNs
 *         if self._event_filter == 0 or c_ctxt.html or \             # <<<<<<<<<<<<<<
 *                self._event_filter & (PARSE_EVENT_FILTER_START |
 *                                      PARSE_EVENT_FILTER_END |
*/
  if (__pyx_t_4) {

    /* "src/lxml/saxparser.pxi":179
 *                                      PARSE_EVENT_FILTER_START_NS |
 *                                      PARSE_EVENT_FILTER_END_NS):
 *             sax.startElementNs = <xmlparser.startElementNsSAX2Func>_handleSaxStart             # <<<<<<<<<<<<<<
 * 
 *         self._origSaxStartNoNs = sax.startElement
*/
    __pyx_v_sax->startElementNs = ((startElementNsSAX2Func)__pyx_f_4lxml_5etree__handleSaxStart);

    /* "src/lxml/saxparser.pxi":174
 *         # only override "start" event handler if needed
 *         self._origSaxStart = sax.startElementNs
 *         if self._event_filter == 0 or c_ctxt.html or \             # <<<<<<<<<<<<<<
 *                self._event_filter & (PARSE_EVENT_FILTER_START |
 *                                      PARSE_EVENT_FILTER_END |
*/
  }

  /* "src/lxml/saxparser.pxi":181
 *             sax.startElementNs = <xmlparser.startElementNsSAX2Func>_handleSaxStart
 * 
 *         self._origSaxStartNoNs = sax.startElement             # <<<<<<<<<<<<<<
 *         if self._event_filter == 0 or c_ctxt.html or \
 *                self._event_filter & (PARSE_EVENT_FILTER_START |
*/
  __pyx_t_6 = __pyx_v_sax->startElement;
  __pyx_v_self->_origSaxStartNoNs = __pyx_t_6;

  /* "src/lxml/saxparser.pxi":182
 * 
 *         self._origSaxStartNoNs = sax.startElement
 *         if self._event_filter == 0 or c_ctxt.html or \             # <<<<<<<<<<<<<<
 *                self._event_filter & (PARSE_EVENT_FILTER_START |
 *                                      PARSE_EVENT_FILTER_END):
*/
  __pyx_t_5 = (__pyx_v_self->_event_filter == 0);
  if (!__pyx_t_5) {
  } else {
    __pyx_t_4 = __pyx_t_5;
    goto __pyx_L8_bool_binop_done;
  }
  if (!__pyx_v_c_ctxt->html) {
  } else {
    __pyx_t_4 = __pyx_v_c_ctxt->html;
    goto __pyx_L8_bool_binop_done;
  }

  /* "src/lxml/saxparser.pxi":183
 *         self._origSaxStartNoNs = sax.startElement
 *         if self._event_filter == 0 or c_ctxt.html or \
 *                self._event_filter & (PARSE_EVENT_FILTER_START |             # <<<<<<<<<<<<<<
 *                                      PARSE_EVENT_FILTER_END):
 *             sax.startElement = <xmlparser.startElementSAXFunc>_handleSaxStartNoNs
*/
  __pyx_t_5 = ((__pyx_v_self->_event_filter & (__pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_START | __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_END)) != 0);
  __pyx_t_4 = __pyx_t_5;
  __pyx_L8_bool_binop_done:;

  /* "src/lxml/saxparser.pxi":182
 * 
 *         self._origSaxStartNoNs = sax.startElement
 *         if self._event_filter == 0 or c_ctxt.html or \             # <<<<<<<<<<<<<<
 *                self._event_filter & (PARSE_EVENT_FILTER_START |
 *                                      PARSE_EVENT_FILTER_END):
*/
  if (__pyx_t_4) {

    /* "src/lxml/saxparser.pxi":185
 *                self._event_filter & (PARSE_EVENT_FILTER_START |
 *                                      PARSE_EVENT_FILTER_END):
 *             sax.startElement = <xmlparser.startElementSAXFunc>_handleSaxStartNoNs             # <<<<<<<<<<<<<<
 * 
 *         # only override "end" event handler if needed
*/
    __pyx_v_sax->startElement = ((startElementSAXFunc)__pyx_f_4lxml_5etree__handleSaxStartNoNs);

    /* "src/lxml/saxparser.pxi":182
 * 
 *         self._origSaxStartNoNs = sax.startElement
 *         if self._event_filter == 0 or c_ctxt.html or \             # <<<<<<<<<<<<<<
 *                self._event_filter & (PARSE_EVENT_FILTER_START |
 *                                      PARSE_EVENT_FILTER_END):
*/
  }

  /* "src/lxml/saxparser.pxi":188
 * 
 *         # only override "end" event handler if needed
 *         self._origSaxEnd = sax.endElementNs             # <<<<<<<<<<<<<<
 *         if self._event_filter == 0 or \
 *                self._event_filter & (PARSE_EVENT_FILTER_END |
*/
  __pyx_t_7 = __pyx_v_sax->endElementNs;
  __pyx_v_self->_origSaxEnd = __pyx_t_7;

  /* "src/lxml/saxparser.pxi":189
 *         # only override "end" event handler if needed
 *         self._origSaxEnd = sax.endElementNs
 *         if self._event_filter == 0 or \             # <<<<<<<<<<<<<<
 *                self._event_filter & (PARSE_EVENT_FILTER_END |
 *                                      PARSE_EVENT_FILTER_END_NS):
*/
  __pyx_t_5 = (__pyx_v_self->_event_filter == 0);
  if (!__pyx_t_5) {
  } else {
    __pyx_t_4 = __pyx_t_5;
    goto __pyx_L12_bool_binop_done;
  }

  /* "src/lxml/saxparser.pxi":190
 *         self._origSaxEnd = sax.endElementNs
 *         if self._event_filter == 0 or \
 *                self._event_filter & (PARSE_EVENT_FILTER_END |             # <<<<<<<<<<<<<<
 *                                      PARSE_EVENT_FILTER_END_NS):
 *             sax.endElementNs = <xmlparser.endElementNsSAX2Func>_handleSaxEnd
*/
  __pyx_t_5 = ((__pyx_v_self->_event_filter & (__pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_END | __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_END_NS)) != 0);
  __pyx_t_4 = __pyx_t_5;
  __pyx_L12_bool_binop_done:;

  /* "src/lxml/saxparser.pxi":189
 *         # only override "end" event handler if needed
 *         self._origSaxEnd = sax.endElementNs
 *         if self._event_filter == 0 or \             # <<<<<<<<<<<<<<
 *                self._event_filter & (PARSE_EVENT_FILTER_END |
 *                                      PARSE_EVENT_FILTER_END_NS):
*/
  if (__pyx_t_4) {

    /* "src/lxml/saxparser.pxi":192
 *                self._event_filter & (PARSE_EVENT_FILTER_END |
 *                                      PARSE_EVENT_FILTER_END_NS):
 *             sax.endElementNs = <xmlparser.endElementNsSAX2Func>_handleSaxEnd             # <<<<<<<<<<<<<<
 * 
 *         self._origSaxEndNoNs = sax.endElement
*/
    __pyx_v_sax->endElementNs = ((endElementNsSAX2Func)__pyx_f_4lxml_5etree__handleSaxEnd);

    /* "src/lxml/saxparser.pxi":189
 *         # only override "end" event handler if needed
 *         self._origSaxEnd = sax.endElementNs
 *         if self._event_filter == 0 or \             # <<<<<<<<<<<<<<
 *                self._event_filter & (PARSE_EVENT_FILTER_END |
 *                                      PARSE_EVENT_FILTER_END_NS):
*/
  }

  /* "src/lxml/saxparser.pxi":194
 *             sax.endElementNs = <xmlparser.endElementNsSAX2Func>_handleSaxEnd
 * 
 *         self._origSaxEndNoNs = sax.endElement             # <<<<<<<<<<<<<<
 *         if self._event_filter == 0 or \
 *                self._event_filter & PARSE_EVENT_FILTER_END:
*/
  __pyx_t_8 = __pyx_v_sax->endElement;
  __pyx_v_self->_origSaxEndNoNs = __pyx_t_8;

  /* "src/lxml/saxparser.pxi":195
 * 
 *         self._origSaxEndNoNs = sax.endElement
 *         if self._event_filter == 0 or \             # <<<<<<<<<<<<<<
 *                self._event_filter & PARSE_EVENT_FILTER_END:
 *             sax.endElement = <xmlparser.endElementSAXFunc>_handleSaxEndNoNs
*/
  __pyx_t_5 = (__pyx_v_self->_event_filter == 0);
  if (!__pyx_t_5) {
  } else {
    __pyx_t_4 = __pyx_t_5;
    goto __pyx_L15_bool_binop_done;
  }

  /* "src/lxml/saxparser.pxi":196
 *         self._origSaxEndNoNs = sax.endElement
 *         if self._event_filter == 0 or \
 *                self._event_filter & PARSE_EVENT_FILTER_END:             # <<<<<<<<<<<<<<
 *             sax.endElement = <xmlparser.endElementSAXFunc>_handleSaxEndNoNs
 * 
*/
  __pyx_t_5 = ((__pyx_v_self->_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_END) != 0);
  __pyx_t_4 = __pyx_t_5;
  __pyx_L15_bool_binop_done:;

  /* "src/lxml/saxparser.pxi":195
 * 
 *         self._origSaxEndNoNs = sax.endElement
 *         if self._event_filter == 0 or \             # <<<<<<<<<<<<<<
 *                self._event_filter & PARSE_EVENT_FILTER_END:
 *             sax.endElement = <xmlparser.endElementSAXFunc>_handleSaxEndNoNs
*/
  if (__pyx_t_4) {

    /* "src/lxml/saxparser.pxi":197
 *         if self._event_filter == 0 or \
 *                self._event_filter & PARSE_EVENT_FILTER_END:
 *             sax.endElement = <xmlparser.endElementSAXFunc>_handleSaxEndNoNs             # <<<<<<<<<<<<<<
 * 
 *         self._origSaxComment = sax.comment
*/
    __pyx_v_sax->endElement = ((endElementSAXFunc)__pyx_f_4lxml_5etree__handleSaxEndNoNs);

    /* "src/lxml/saxparser.pxi":195
 * 
 *         self._origSaxEndNoNs = sax.endElement
 *         if self._event_filter == 0 or \             # <<<<<<<<<<<<<<
 *                self._event_filter & PARSE_EVENT_FILTER_END:
 *             sax.endElement = <xmlparser.endElementSAXFunc>_handleSaxEndNoNs
*/
  }

  /* "src/lxml/saxparser.pxi":199
 *             sax.endElement = <xmlparser.endElementSAXFunc>_handleSaxEndNoNs
 * 
 *         self._origSaxComment = sax.comment             # <<<<<<<<<<<<<<
 *         if self._event_filter & PARSE_EVENT_FILTER_COMMENT:
 *             sax.comment = <xmlparser.commentSAXFunc>_handleSaxComment
*/
  __pyx_t_9 = __pyx_v_sax->comment;
  __pyx_v_self->_origSaxComment = __pyx_t_9;

  /* "src/lxml/saxparser.pxi":200
 * 
 *         self._origSaxComment = sax.comment
 *         if self._event_filter & PARSE_EVENT_FILTER_COMMENT:             # <<<<<<<<<<<<<<
 *             sax.comment = <xmlparser.commentSAXFunc>_handleSaxComment
 * 
*/
  __pyx_t_4 = ((__pyx_v_self->_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_COMMENT) != 0);
  if (__pyx_t_4) {

    /* "src/lxml/saxparser.pxi":201
 *         self._origSaxComment = sax.comment
 *         if self._event_filter & PARSE_EVENT_FILTER_COMMENT:
 *             sax.comment = <xmlparser.commentSAXFunc>_handleSaxComment             # <<<<<<<<<<<<<<
 * 
 *         self._origSaxPI = sax.processingInstruction
*/
    __pyx_v_sax->comment = ((commentSAXFunc)__pyx_f_4lxml_5etree__handleSaxComment);

    /* "src/lxml/saxparser.pxi":200
 * 
 *         self._origSaxComment = sax.comment
 *         if self._event_filter & PARSE_EVENT_FILTER_COMMENT:             # <<<<<<<<<<<<<<
 *             sax.comment = <xmlparser.commentSAXFunc>_handleSaxComment
 * 
*/
  }

  /* "src/lxml/saxparser.pxi":203
 *             sax.comment = <xmlparser.commentSAXFunc>_handleSaxComment
 * 
 *         self._origSaxPI = sax.processingInstruction             # <<<<<<<<<<<<<<
 *         if self._event_filter & PARSE_EVENT_FILTER_PI:
 *             sax.processingInstruction = <xmlparser.processingInstructionSAXFunc>_handleSaxPIEvent
*/
  __pyx_t_10 = __pyx_v_sax->processingInstruction;
  __pyx_v_self->_origSaxPI = __pyx_t_10;

  /* "src/lxml/saxparser.pxi":204
 * 
 *         self._origSaxPI = sax.processingInstruction
 *         if self._event_filter & PARSE_EVENT_FILTER_PI:             # <<<<<<<<<<<<<<
 *             sax.processingInstruction = <xmlparser.processingInstructionSAXFunc>_handleSaxPIEvent
 * 
*/
  __pyx_t_4 = ((__pyx_v_self->_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_PI) != 0);
  if (__pyx_t_4) {

    /* "src/lxml/saxparser.pxi":205
 *         self._origSaxPI = sax.processingInstruction
 *         if self._event_filter & PARSE_EVENT_FILTER_PI:
 *             sax.processingInstruction = <xmlparser.processingInstructionSAXFunc>_handleSaxPIEvent             # <<<<<<<<<<<<<<
 * 
 *     cdef _setEventFilter(self, events, tag):
*/
    __pyx_v_sax->processingInstruction = ((processingInstructionSAXFunc)__pyx_f_4lxml_5etree__handleSaxPIEvent);

    /* "src/lxml/saxparser.pxi":204
 * 
 *         self._origSaxPI = sax.processingInstruction
 *         if self._event_filter & PARSE_EVENT_FILTER_PI:             # <<<<<<<<<<<<<<
 *             sax.processingInstruction = <xmlparser.processingInstructionSAXFunc>_handleSaxPIEvent
 * 
*/
  }

  /* "src/lxml/saxparser.pxi":165
 *         c_ctxt.replaceEntities = 1
 * 
 *     cdef void _connectEvents(self, xmlparser.xmlParserCtxt* c_ctxt) noexcept:             # <<<<<<<<<<<<<<
 *         """Wrap original SAX2 callbacks to collect parse events without parser target.
 *         """
*/

  /* function exit code */
}

/* "src/lxml/saxparser.pxi":207
 *             sax.processingInstruction = <xmlparser.processingInstructionSAXFunc>_handleSaxPIEvent
 * 
 *     cdef _setEventFilter(self, events, tag):             # <<<<<<<<<<<<<<
 *         self._event_filter = _buildParseEventFilter(events)
 *         if not self._event_filter or tag is None or tag == '*':
*/

static PyObject *__pyx_f_4lxml_5etree_17_SaxParserContext__setEventFilter(struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_self, PyObject *__pyx_v_events, PyObject *__pyx_v_tag) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_setEventFilter", 0);

  /* "src/lxml/saxparser.pxi":208
 * 
 *     cdef _setEventFilter(self, events, tag):
 *         self._event_filter = _buildParseEventFilter(events)             # <<<<<<<<<<<<<<
 *         if not self._event_filter or tag is None or tag == '*':
 *             self._matcher = None
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__buildParseEventFilter(__pyx_v_events); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(5, 208, __pyx_L1_error)
  __pyx_v_self->_event_filter = __pyx_t_1;

  /* "src/lxml/saxparser.pxi":209
 *     cdef _setEventFilter(self, events, tag):
 *         self._event_filter = _buildParseEventFilter(events)
 *         if not self._event_filter or tag is None or tag == '*':             # <<<<<<<<<<<<<<
 *             self._matcher = None
 *         else:
*/
  __pyx_t_3 = (!(__pyx_v_self->_event_filter != 0));
  if (!__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_tag == Py_None);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_v_tag, __pyx_mstate_global->__pyx_kp_u__24, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(5, 209, __pyx_L1_error)
  __pyx_t_2 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "src/lxml/saxparser.pxi":210
 *         self._event_filter = _buildParseEventFilter(events)
 *         if not self._event_filter or tag is None or tag == '*':
 *             self._matcher = None             # <<<<<<<<<<<<<<
 *         else:
 *             self._matcher = _MultiTagMatcher.__new__(_MultiTagMatcher, tag)
*/
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF((PyObject *)__pyx_v_self->_matcher);
    __Pyx_DECREF((PyObject *)__pyx_v_self->_matcher);
    __pyx_v_self->_matcher = ((struct __pyx_obj_4lxml_5etree__MultiTagMatcher *)Py_None);

    /* "src/lxml/saxparser.pxi":209
 *     cdef _setEventFilter(self, events, tag):
 *         self._event_filter = _buildParseEventFilter(events)
 *         if not self._event_filter or tag is None or tag == '*':             # <<<<<<<<<<<<<<
 *             self._matcher = None
 *         else:
*/
    goto __pyx_L3;
  }

  /* "src/lxml/saxparser.pxi":212
 *             self._matcher = None
 *         else:
 *             self._matcher = _MultiTagMatcher.__new__(_MultiTagMatcher, tag)             # <<<<<<<<<<<<<<
 * 
 *     cdef int startDocument(self, xmlDoc* c_doc) except -1:
*/
  /*else*/ {
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 212, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_tag);
    __Pyx_GIVEREF(__pyx_v_tag);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_tag) != (0)) __PYX_ERR(5, 212, __pyx_L1_error);
    __pyx_t_5 = ((PyObject *)__pyx_tp_new_4lxml_5etree__MultiTagMatcher(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__MultiTagMatcher), __pyx_t_4, NULL)); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 212, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GIVEREF((PyObject *)__pyx_t_5);
    __Pyx_GOTREF((PyObject *)__pyx_v_self->_matcher);
    __Pyx_DECREF((PyObject *)__pyx_v_self->_matcher);
    __pyx_v_self->_matcher = ((struct __pyx_obj_4lxml_5etree__MultiTagMatcher *)__pyx_t_5);
    __pyx_t_5 = 0;
  }
  __pyx_L3:;

  /* "src/lxml/saxparser.pxi":207
 *             sax.processingInstruction = <xmlparser.processingInstructionSAXFunc>_handleSaxPIEvent
 * 
 *     cdef _setEventFilter(self, events, tag):             # <<<<<<<<<<<<<<
 *         self._event_filter = _buildParseEventFilter(events)
 *         if not self._event_filter or tag is None or tag == '*':
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._SaxParserContext._setEventFilter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/saxparser.pxi":214
 *             self._matcher = _MultiTagMatcher.__new__(_MultiTagMatcher, tag)
 * 
 *     cdef int startDocument(self, xmlDoc* c_doc) except -1:             # <<<<<<<<<<<<<<
 *         try:
 *             self._doc = _documentFactory(c_doc, self._parser)
*/

static int __pyx_f_4lxml_5etree_17_SaxParserContext_startDocument(struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_self, xmlDoc *__pyx_v_c_doc) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  char const *__pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  struct __pyx_opt_args_4lxml_5etree_16_MultiTagMatcher_cacheTags __pyx_t_13;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("startDocument", 0);

  /* "src/lxml/saxparser.pxi":215
 * 
 *     cdef int startDocument(self, xmlDoc* c_doc) except -1:
 *         try:             # <<<<<<<<<<<<<<
 *             self._doc = _documentFactory(c_doc, self._parser)
 *         finally:
*/
  /*try:*/ {

    /* "src/lxml/saxparser.pxi":216
 *     cdef int startDocument(self, xmlDoc* c_doc) except -1:
 *         try:
 *             self._doc = _documentFactory(c_doc, self._parser)             # <<<<<<<<<<<<<<
 *         finally:
 *             self._parser = None  # clear circular reference ASAP
*/
    __pyx_t_1 = ((PyObject *)__pyx_v_self->_parser);
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_1))); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 216, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_GOTREF((PyObject *)__pyx_v_self->__pyx_base._doc);
    __Pyx_DECREF((PyObject *)__pyx_v_self->__pyx_base._doc);
    __pyx_v_self->__pyx_base._doc = ((struct LxmlDocument *)__pyx_t_2);
    __pyx_t_2 = 0;
  }

  /* "src/lxml/saxparser.pxi":218
 *             self._doc = _documentFactory(c_doc, self._parser)
 *         finally:
 *             self._parser = None  # clear circular reference ASAP             # <<<<<<<<<<<<<<
 *         if self._matcher is not None:
 *             self._matcher.cacheTags(self._doc, force_into_dict=True)
*/
  /*finally:*/ {
    /*normal exit:*/{
      __Pyx_INCREF(Py_None);
      __Pyx_GIVEREF(Py_None);
      __Pyx_GOTREF((PyObject *)__pyx_v_self->_parser);
      __Pyx_DECREF((PyObject *)__pyx_v_self->_parser);
      __pyx_v_self->_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None);
      goto __pyx_L5;
    }
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      if ( unlikely(__Pyx_GetException(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8) < 0)) __Pyx_ErrFetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __pyx_t_3 = __pyx_lineno; __pyx_t_4 = __pyx_clineno; __pyx_t_5 = __pyx_filename;
      {
        __Pyx_INCREF(Py_None);
        __Pyx_GIVEREF(Py_None);
        __Pyx_GOTREF((PyObject *)__pyx_v_self->_parser);
        __Pyx_DECREF((PyObject *)__pyx_v_self->_parser);
        __pyx_v_self->_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None);
      }
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_ErrRestore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
      __pyx_lineno = __pyx_t_3; __pyx_clineno = __pyx_t_4; __pyx_filename = __pyx_t_5;
      goto __pyx_L1_error;
    }
    __pyx_L5:;
  }

  /* "src/lxml/saxparser.pxi":219
 *         finally:
 *             self._parser = None  # clear circular reference ASAP
 *         if self._matcher is not None:             # <<<<<<<<<<<<<<
 *             self._matcher.cacheTags(self._doc, force_into_dict=True)
 *         return 0
*/
  __pyx_t_12 = (((PyObject *)__pyx_v_self->_matcher) != Py_None);
  if (__pyx_t_12) {

    /* "src/lxml/saxparser.pxi":220
 *             self._parser = None  # clear circular reference ASAP
 *         if self._matcher is not None:
 *             self._matcher.cacheTags(self._doc, force_into_dict=True)             # <<<<<<<<<<<<<<
 *         return 0
 * 
*/
    __pyx_t_2 = ((PyObject *)__pyx_v_self->__pyx_base._doc);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_13.__pyx_n = 1;
    __pyx_t_13.force_into_dict = 1;
    __pyx_t_4 = __pyx_f_4lxml_5etree_16_MultiTagMatcher_cacheTags(__pyx_v_self->_matcher, ((struct LxmlDocument *)__pyx_t_2), &__pyx_t_13); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(5, 220, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/saxparser.pxi":219
 *         finally:
 *             self._parser = None  # clear circular reference ASAP
 *         if self._matcher is not None:             # <<<<<<<<<<<<<<
 *             self._matcher.cacheTags(self._doc, force_into_dict=True)
 *         return 0
*/
  }

  /* "src/lxml/saxparser.pxi":221
 *         if self._matcher is not None:
 *             self._matcher.cacheTags(self._doc, force_into_dict=True)
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     cdef int pushEvent(self, event, xmlNode* c_node) except -1:
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/saxparser.pxi":214
 *             self._matcher = _MultiTagMatcher.__new__(_MultiTagMatcher, tag)
 * 
 *     cdef int startDocument(self, xmlDoc* c_doc) except -1:             # <<<<<<<<<<<<<<
 *         try:
 *             self._doc = _documentFactory(c_doc, self._parser)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._SaxParserContext.startDocument", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/saxparser.pxi":223
 *         return 0
 * 
 *     cdef int pushEvent(self, event, xmlNode* c_node) except -1:             # <<<<<<<<<<<<<<
 *         cdef _Element root
 *         if self._root is None:
*/

static int __pyx_f_4lxml_5etree_17_SaxParserContext_pushEvent(struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_self, PyObject *__pyx_v_event, xmlNode *__pyx_v_c_node) {
  struct LxmlElement *__pyx_v_root = 0;
  struct LxmlElement *__pyx_v_node = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("pushEvent", 0);

  /* "src/lxml/saxparser.pxi":225
 *     cdef int pushEvent(self, event, xmlNode* c_node) except -1:
 *         cdef _Element root
 *         if self._root is None:             # <<<<<<<<<<<<<<
 *             root = self._doc.getroot()
 *             if root is not None and root._c_node.type == tree.XML_ELEMENT_NODE:
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_self->_root) == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/saxparser.pxi":226
 *         cdef _Element root
 *         if self._root is None:
 *             root = self._doc.getroot()             # <<<<<<<<<<<<<<
 *             if root is not None and root._c_node.type == tree.XML_ELEMENT_NODE:
 *                 self._root = root
*/
    __pyx_t_2 = __pyx_f_4lxml_5etree_9_Document_getroot(__pyx_v_self->__pyx_base._doc); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 226, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element))))) __PYX_ERR(5, 226, __pyx_L1_error)
    __pyx_v_root = ((struct LxmlElement *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/saxparser.pxi":227
 *         if self._root is None:
 *             root = self._doc.getroot()
 *             if root is not None and root._c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *                 self._root = root
 *         node = _elementFactory(self._doc, c_node)
*/
    __pyx_t_3 = (((PyObject *)__pyx_v_root) != Py_None);
    if (__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_3 = (__pyx_v_root->_c_node->type == XML_ELEMENT_NODE);
    __pyx_t_1 = __pyx_t_3;
    __pyx_L5_bool_binop_done:;
    if (__pyx_t_1) {

      /* "src/lxml/saxparser.pxi":228
 *             root = self._doc.getroot()
 *             if root is not None and root._c_node.type == tree.XML_ELEMENT_NODE:
 *                 self._root = root             # <<<<<<<<<<<<<<
 *         node = _elementFactory(self._doc, c_node)
 *         self.events_iterator._events.append( (event, node) )
*/
      __Pyx_INCREF((PyObject *)__pyx_v_root);
      __Pyx_GIVEREF((PyObject *)__pyx_v_root);
      __Pyx_GOTREF((PyObject *)__pyx_v_self->_root);
      __Pyx_DECREF((PyObject *)__pyx_v_self->_root);
      __pyx_v_self->_root = __pyx_v_root;

      /* "src/lxml/saxparser.pxi":227
 *         if self._root is None:
 *             root = self._doc.getroot()
 *             if root is not None and root._c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *                 self._root = root
 *         node = _elementFactory(self._doc, c_node)
*/
    }

    /* "src/lxml/saxparser.pxi":225
 *     cdef int pushEvent(self, event, xmlNode* c_node) except -1:
 *         cdef _Element root
 *         if self._root is None:             # <<<<<<<<<<<<<<
 *             root = self._doc.getroot()
 *             if root is not None and root._c_node.type == tree.XML_ELEMENT_NODE:
*/
  }

  /* "src/lxml/saxparser.pxi":229
 *             if root is not None and root._c_node.type == tree.XML_ELEMENT_NODE:
 *                 self._root = root
 *         node = _elementFactory(self._doc, c_node)             # <<<<<<<<<<<<<<
 *         self.events_iterator._events.append( (event, node) )
 *         return 0
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self->__pyx_base._doc);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_2), __pyx_v_c_node)); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 229, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_node = ((struct LxmlElement *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "src/lxml/saxparser.pxi":230
 *                 self._root = root
 *         node = _elementFactory(self._doc, c_node)
 *         self.events_iterator._events.append( (event, node) )             # <<<<<<<<<<<<<<
 *         return 0
 * 
*/
  if (unlikely(__pyx_v_self->events_iterator->_events == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
    __PYX_ERR(5, 230, __pyx_L1_error)
  }
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 230, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_event);
  __Pyx_GIVEREF(__pyx_v_event);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_event) != (0)) __PYX_ERR(5, 230, __pyx_L1_error);
  __Pyx_INCREF((PyObject *)__pyx_v_node);
  __Pyx_GIVEREF((PyObject *)__pyx_v_node);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_node)) != (0)) __PYX_ERR(5, 230, __pyx_L1_error);
  __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_self->events_iterator->_events, __pyx_t_4); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(5, 230, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "src/lxml/saxparser.pxi":231
 *         node = _elementFactory(self._doc, c_node)
 *         self.events_iterator._events.append( (event, node) )
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     cdef int flushEvents(self) except -1:
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/saxparser.pxi":223
 *         return 0
 * 
 *     cdef int pushEvent(self, event, xmlNode* c_node) except -1:             # <<<<<<<<<<<<<<
 *         cdef _Element root
 *         if self._root is None:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._SaxParserContext.pushEvent", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_root);
  __Pyx_XDECREF((PyObject *)__pyx_v_node);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/saxparser.pxi":233
 *         return 0
 * 
 *     cdef int flushEvents(self) except -1:             # <<<<<<<<<<<<<<
 *         events = self.events_iterator._events
 *         while self._node_stack:
*/

static int __pyx_f_4lxml_5etree_17_SaxParserContext_flushEvents(struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_self) {
  PyObject *__pyx_v_events = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("flushEvents", 0);

  /* "src/lxml/saxparser.pxi":234
 * 
 *     cdef int flushEvents(self) except -1:
 *         events = self.events_iterator._events             # <<<<<<<<<<<<<<
 *         while self._node_stack:
 *             events.append( ('end', self._node_stack.pop()) )
*/
  __pyx_t_1 = __pyx_v_self->events_iterator->_events;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_events = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/saxparser.pxi":235
 *     cdef int flushEvents(self) except -1:
 *         events = self.events_iterator._events
 *         while self._node_stack:             # <<<<<<<<<<<<<<
 *             events.append( ('end', self._node_stack.pop()) )
 *             _pushSaxNsEndEvents(self)
*/
  while (1) {
    if (__pyx_v_self->_node_stack == Py_None) __pyx_t_2 = 0;
    else
    {
      Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_v_self->_node_stack);
      if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(5, 235, __pyx_L1_error)
      __pyx_t_2 = (__pyx_temp != 0);
    }

    if (!__pyx_t_2) break;

    /* "src/lxml/saxparser.pxi":236
 *         events = self.events_iterator._events
 *         while self._node_stack:
 *             events.append( ('end', self._node_stack.pop()) )             # <<<<<<<<<<<<<<
 *             _pushSaxNsEndEvents(self)
 *         while self._ns_stack:
*/
    if (unlikely(__pyx_v_events == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
      __PYX_ERR(5, 236, __pyx_L1_error)
    }
    if (unlikely(__pyx_v_self->_node_stack == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "pop");
      __PYX_ERR(5, 236, __pyx_L1_error)
    }
    __pyx_t_1 = __Pyx_PyList_Pop(__pyx_v_self->_node_stack); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 236, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 236, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_end);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_end);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_mstate_global->__pyx_n_u_end) != (0)) __PYX_ERR(5, 236, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1) != (0)) __PYX_ERR(5, 236, __pyx_L1_error);
    __pyx_t_1 = 0;
    __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_events, __pyx_t_3); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(5, 236, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/saxparser.pxi":237
 *         while self._node_stack:
 *             events.append( ('end', self._node_stack.pop()) )
 *             _pushSaxNsEndEvents(self)             # <<<<<<<<<<<<<<
 *         while self._ns_stack:
 *             _pushSaxNsEndEvents(self)
*/
    __pyx_t_5 = __pyx_f_4lxml_5etree__pushSaxNsEndEvents(__pyx_v_self); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(5, 237, __pyx_L1_error)
  }

  /* "src/lxml/saxparser.pxi":238
 *             events.append( ('end', self._node_stack.pop()) )
 *             _pushSaxNsEndEvents(self)
 *         while self._ns_stack:             # <<<<<<<<<<<<<<
 *             _pushSaxNsEndEvents(self)
 * 
*/
  while (1) {
    if (__pyx_v_self->_ns_stack == Py_None) __pyx_t_2 = 0;
    else
    {
      Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_v_self->_ns_stack);
      if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(5, 238, __pyx_L1_error)
      __pyx_t_2 = (__pyx_temp != 0);
    }

    if (!__pyx_t_2) break;

    /* "src/lxml/saxparser.pxi":239
 *             _pushSaxNsEndEvents(self)
 *         while self._ns_stack:
 *             _pushSaxNsEndEvents(self)             # <<<<<<<<<<<<<<
 * 
 *     cdef void _handleSaxException(self, xmlparser.xmlParserCtxt* c_ctxt) noexcept:
*/
    __pyx_t_5 = __pyx_f_4lxml_5etree__pushSaxNsEndEvents(__pyx_v_self); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(5, 239, __pyx_L1_error)
  }

  /* "src/lxml/saxparser.pxi":233
 *         return 0
 * 
 *     cdef int flushEvents(self) except -1:             # <<<<<<<<<<<<<<
 *         events = self.events_iterator._events
 *         while self._node_stack:
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._SaxParserContext.flushEvents", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_events);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/saxparser.pxi":241
 *             _pushSaxNsEndEvents(self)
 * 
 *     cdef void _handleSaxException(self, xmlparser.xmlParserCtxt* c_ctxt) noexcept:             # <<<<<<<<<<<<<<
 *         if c_ctxt.errNo == xmlerror.XML_ERR_OK:
 *             c_ctxt.errNo = xmlerror.XML_ERR_INTERNAL_ERROR
*/

static void __pyx_f_4lxml_5etree_17_SaxParserContext__handleSaxException(struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_self, xmlParserCtxt *__pyx_v_c_ctxt) {
  int __pyx_t_1;

  /* "src/lxml/saxparser.pxi":242
 * 
 *     cdef void _handleSaxException(self, xmlparser.xmlParserCtxt* c_ctxt) noexcept:
 *         if c_ctxt.errNo == xmlerror.XML_ERR_OK:             # <<<<<<<<<<<<<<
 *             c_ctxt.errNo = xmlerror.XML_ERR_INTERNAL_ERROR
 *         # stop parsing immediately
*/
  __pyx_t_1 = (__pyx_v_c_ctxt->errNo == XML_ERR_OK);
  if (__pyx_t_1) {

    /* "src/lxml/saxparser.pxi":243
 *     cdef void _handleSaxException(self, xmlparser.xmlParserCtxt* c_ctxt) noexcept:
 *         if c_ctxt.errNo == xmlerror.XML_ERR_OK:
 *             c_ctxt.errNo = xmlerror.XML_ERR_INTERNAL_ERROR             # <<<<<<<<<<<<<<
 *         # stop parsing immediately
 *         c_ctxt.wellFormed = 0
*/
    __pyx_v_c_ctxt->errNo = XML_ERR_INTERNAL_ERROR;

    /* "src/lxml/saxparser.pxi":242
 * 
 *     cdef void _handleSaxException(self, xmlparser.xmlParserCtxt* c_ctxt) noexcept:
 *         if c_ctxt.errNo == xmlerror.XML_ERR_OK:             # <<<<<<<<<<<<<<
 *             c_ctxt.errNo = xmlerror.XML_ERR_INTERNAL_ERROR
 *         # stop parsing immediately
*/
  }

  /* "src/lxml/saxparser.pxi":245
 *             c_ctxt.errNo = xmlerror.XML_ERR_INTERNAL_ERROR
 *         # stop parsing immediately
 *         c_ctxt.wellFormed = 0             # <<<<<<<<<<<<<<
 *         c_ctxt.disableSAX = 1
 *         c_ctxt.instate = xmlparser.XML_PARSER_EOF
*/
  __pyx_v_c_ctxt->wellFormed = 0;

  /* "src/lxml/saxparser.pxi":246
 *         # stop parsing immediately
 *         c_ctxt.wellFormed = 0
 *         c_ctxt.disableSAX = 1             # <<<<<<<<<<<<<<
 *         c_ctxt.instate = xmlparser.XML_PARSER_EOF
 *         self._store_raised()
*/
  __pyx_v_c_ctxt->disableSAX = 1;

  /* "src/lxml/saxparser.pxi":247
 *         c_ctxt.wellFormed = 0
 *         c_ctxt.disableSAX = 1
 *         c_ctxt.instate = xmlparser.XML_PARSER_EOF             # <<<<<<<<<<<<<<
 *         self._store_raised()
 * 
*/
  __pyx_v_c_ctxt->instate = XML_PARSER_EOF;

  /* "src/lxml/saxparser.pxi":248
 *         c_ctxt.disableSAX = 1
 *         c_ctxt.instate = xmlparser.XML_PARSER_EOF
 *         self._store_raised()             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_f_4lxml_5etree_17_ExceptionContext__store_raised(((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_v_self));

  /* "src/lxml/saxparser.pxi":241
 *             _pushSaxNsEndEvents(self)
 * 
 *     cdef void _handleSaxException(self, xmlparser.xmlParserCtxt* c_ctxt) noexcept:             # <<<<<<<<<<<<<<
 *         if c_ctxt.errNo == xmlerror.XML_ERR_OK:
 *             c_ctxt.errNo = xmlerror.XML_ERR_INTERNAL_ERROR
*/

  /* function exit code */
}

/* "src/lxml/saxparser.pxi":258
 *     cdef int _event_index
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._events = []
 *         self._event_index = 0
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_20_ParseEventsIterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_20_ParseEventsIterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, __pyx_nargs); return -1; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return -1;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__cinit__", __pyx_kwds); return -1;}
  __pyx_r = __pyx_pf_4lxml_5etree_20_ParseEventsIterator___cinit__(((struct __pyx_obj_4lxml_5etree__ParseEventsIterator *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_20_ParseEventsIterator___cinit__(struct __pyx_obj_4lxml_5etree__ParseEventsIterator *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "src/lxml/saxparser.pxi":259
 * 
 *     def __cinit__(self):
 *         self._events = []             # <<<<<<<<<<<<<<
 *         self._event_index = 0
 * 
*/
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 259, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_events);
  __Pyx_DECREF(__pyx_v_self->_events);
  __pyx_v_self->_events = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/saxparser.pxi":260
 *     def __cinit__(self):
 *         self._events = []
 *         self._event_index = 0             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
*/
  __pyx_v_self->_event_index = 0;

  /* "src/lxml/saxparser.pxi":258
 *     cdef int _event_index
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._events = []
 *         self._event_index = 0
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ParseEventsIterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/saxparser.pxi":262
 *         self._event_index = 0
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_20_ParseEventsIterator_3__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_20_ParseEventsIterator_3__iter__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_20_ParseEventsIterator_2__iter__(((struct __pyx_obj_4lxml_5etree__ParseEventsIterator *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_20_ParseEventsIterator_2__iter__(struct __pyx_obj_4lxml_5etree__ParseEventsIterator *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "src/lxml/saxparser.pxi":263
 * 
 *     def __iter__(self):
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __next__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "src/lxml/saxparser.pxi":262
 *         self._event_index = 0
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/saxparser.pxi":265
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         cdef int event_index = self._event_index
 *         events = self._events
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_20_ParseEventsIterator_5__next__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_20_ParseEventsIterator_5__next__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_20_ParseEventsIterator_4__next__(((struct __pyx_obj_4lxml_5etree__ParseEventsIterator *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_20_ParseEventsIterator_4__next__(struct __pyx_obj_4lxml_5etree__ParseEventsIterator *__pyx_v_self) {
  int __pyx_v_event_index;
  PyObject *__pyx_v_events = NULL;
  PyObject *__pyx_v_item = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_error_without_exception = 0; /* StopIteration */
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__next__", 0);

  /* "src/lxml/saxparser.pxi":266
 * 
 *     def __next__(self):
 *         cdef int event_index = self._event_index             # <<<<<<<<<<<<<<
 *         events = self._events
 *         if event_index >= 2**10 or event_index * 2 >= len(events):
*/
  __pyx_t_1 = __pyx_v_self->_event_index;
  __pyx_v_event_index = __pyx_t_1;

  /* "src/lxml/saxparser.pxi":267
 *     def __next__(self):
 *         cdef int event_index = self._event_index
 *         events = self._events             # <<<<<<<<<<<<<<
 *         if event_index >= 2**10 or event_index * 2 >= len(events):
 *             if event_index:
*/
  __pyx_t_2 = __pyx_v_self->_events;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_events = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/saxparser.pxi":268
 *         cdef int event_index = self._event_index
 *         events = self._events
 *         if event_index >= 2**10 or event_index * 2 >= len(events):             # <<<<<<<<<<<<<<
 *             if event_index:
 *                 # clean up from time to time
*/
  __pyx_t_4 = (__pyx_v_event_index >= 0x400);
  if (!__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  if (unlikely(__pyx_v_events == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(5, 268, __pyx_L1_error)
  }
  __pyx_t_5 = __Pyx_PyList_GET_SIZE(__pyx_v_events); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(5, 268, __pyx_L1_error)
  __pyx_t_4 = ((__pyx_v_event_index * 2) >= __pyx_t_5);
  __pyx_t_3 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_3) {

    /* "src/lxml/saxparser.pxi":269
 *         events = self._events
 *         if event_index >= 2**10 or event_index * 2 >= len(events):
 *             if event_index:             # <<<<<<<<<<<<<<
 *                 # clean up from time to time
 *                 del events[:event_index]
*/
    __pyx_t_3 = (__pyx_v_event_index != 0);
    if (__pyx_t_3) {

      /* "src/lxml/saxparser.pxi":271
 *             if event_index:
 *                 # clean up from time to time
 *                 del events[:event_index]             # <<<<<<<<<<<<<<
 *                 self._event_index = event_index = 0
 *             if event_index >= len(events):
*/
      if (unlikely(__pyx_v_events == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(5, 271, __pyx_L1_error)
      }
      if (__Pyx_PyObject_DelSlice(__pyx_v_events, 0, __pyx_v_event_index, NULL, NULL, NULL, 0, 1, 1) < (0)) __PYX_ERR(5, 271, __pyx_L1_error)

      /* "src/lxml/saxparser.pxi":272
 *                 # clean up from time to time
 *                 del events[:event_index]
 *                 self._event_index = event_index = 0             # <<<<<<<<<<<<<<
 *             if event_index >= len(events):
 *                 raise StopIteration
*/
      __pyx_v_self->_event_index = 0;
      __pyx_v_event_index = 0;

      /* "src/lxml/saxparser.pxi":269
 *         events = self._events
 *         if event_index >= 2**10 or event_index * 2 >= len(events):
 *             if event_index:             # <<<<<<<<<<<<<<
 *                 # clean up from time to time
 *                 del events[:event_index]
*/
    }

    /* "src/lxml/saxparser.pxi":273
 *                 del events[:event_index]
 *                 self._event_index = event_index = 0
 *             if event_index >= len(events):             # <<<<<<<<<<<<<<
 *                 raise StopIteration
 *         item = events[event_index]
*/
    if (unlikely(__pyx_v_events == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
      __PYX_ERR(5, 273, __pyx_L1_error)
    }
    __pyx_t_5 = __Pyx_PyList_GET_SIZE(__pyx_v_events); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(5, 273, __pyx_L1_error)
    __pyx_t_3 = (__pyx_v_event_index >= __pyx_t_5);
    if (unlikely(__pyx_t_3)) {

      /* "src/lxml/saxparser.pxi":274
 *                 self._event_index = event_index = 0
 *             if event_index >= len(events):
 *                 raise StopIteration             # <<<<<<<<<<<<<<
 *         item = events[event_index]
 *         self._event_index = event_index + 1
*/
      __pyx_error_without_exception = 1;
      goto __pyx_L1_error;;

      /* "src/lxml/saxparser.pxi":273
 *                 del events[:event_index]
 *                 self._event_index = event_index = 0
 *             if event_index >= len(events):             # <<<<<<<<<<<<<<
 *                 raise StopIteration
 *         item = events[event_index]
*/
    }

    /* "src/lxml/saxparser.pxi":268
 *         cdef int event_index = self._event_index
 *         events = self._events
 *         if event_index >= 2**10 or event_index * 2 >= len(events):             # <<<<<<<<<<<<<<
 *             if event_index:
 *                 # clean up from time to time
*/
  }

  /* "src/lxml/saxparser.pxi":275
 *             if event_index >= len(events):
 *                 raise StopIteration
 *         item = events[event_index]             # <<<<<<<<<<<<<<
 *         self._event_index = event_index + 1
 *         return item
*/
  if (unlikely(__pyx_v_events == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(5, 275, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_events, __pyx_v_event_index, int, 1, __Pyx_PyLong_From_int, 1, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 275, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_item = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "src/lxml/saxparser.pxi":276
 *                 raise StopIteration
 *         item = events[event_index]
 *         self._event_index = event_index + 1             # <<<<<<<<<<<<<<
 *         return item
 * 
*/
  __pyx_v_self->_event_index = (__pyx_v_event_index + 1);

  /* "src/lxml/saxparser.pxi":277
 *         item = events[event_index]
 *         self._event_index = event_index + 1
 *         return item             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_item);
  __pyx_r = __pyx_v_item;
  goto __pyx_L0;

  /* "src/lxml/saxparser.pxi":265
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         cdef int event_index = self._event_index
 *         events = self._events
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  if (!__pyx_error_without_exception) {
    __Pyx_AddTraceback("lxml.etree._ParseEventsIterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_events);
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/saxparser.pxi":280
 * 
 * 
 * cdef list _build_prefix_uri_list(_SaxParserContext context, int c_nb_namespaces,             # <<<<<<<<<<<<<<
 *                                  const_xmlChar** c_namespaces):
 *     "Build [(prefix, uri)] list of declared namespaces."
*/

static PyObject *__pyx_f_4lxml_5etree__build_prefix_uri_list(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_context, int __pyx_v_c_nb_namespaces, const xmlChar **__pyx_v_c_namespaces) {
  CYTHON_UNUSED int __pyx_v_i;
  PyObject *__pyx_v_namespaces = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_build_prefix_uri_list", 0);

  /* "src/lxml/saxparser.pxi":284
 *     "Build [(prefix, uri)] list of declared namespaces."
 *     cdef int i
 *     namespaces = []             # <<<<<<<<<<<<<<
 *     for i in xrange(c_nb_namespaces):
 *         namespaces.append((funicodeOrEmpty(c_namespaces[0]), funicode(c_namespaces[1])))
*/
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_namespaces = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/saxparser.pxi":285
 *     cdef int i
 *     namespaces = []
 *     for i in xrange(c_nb_namespaces):             # <<<<<<<<<<<<<<
 *         namespaces.append((funicodeOrEmpty(c_namespaces[0]), funicode(c_namespaces[1])))
 *         c_namespaces += 2
*/
  __pyx_t_2 = __pyx_v_c_nb_namespaces;
  __pyx_t_3 = __pyx_t_2;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;

    /* "src/lxml/saxparser.pxi":286
 *     namespaces = []
 *     for i in xrange(c_nb_namespaces):
 *         namespaces.append((funicodeOrEmpty(c_namespaces[0]), funicode(c_namespaces[1])))             # <<<<<<<<<<<<<<
 *         c_namespaces += 2
 *     return namespaces
*/
    __pyx_t_1 = __pyx_f_4lxml_5etree_funicodeOrEmpty((__pyx_v_c_namespaces[0])); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 286, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __pyx_f_4lxml_5etree_funicode((__pyx_v_c_namespaces[1])); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 286, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 286, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1) != (0)) __PYX_ERR(5, 286, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_5);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5) != (0)) __PYX_ERR(5, 286, __pyx_L1_error);
    __pyx_t_1 = 0;
    __pyx_t_5 = 0;
    __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_namespaces, __pyx_t_6); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(5, 286, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "src/lxml/saxparser.pxi":287
 *     for i in xrange(c_nb_namespaces):
 *         namespaces.append((funicodeOrEmpty(c_namespaces[0]), funicode(c_namespaces[1])))
 *         c_namespaces += 2             # <<<<<<<<<<<<<<
 *     return namespaces
 * 
*/
    __pyx_v_c_namespaces = (__pyx_v_c_namespaces + 2);
  }

  /* "src/lxml/saxparser.pxi":288
 *         namespaces.append((funicodeOrEmpty(c_namespaces[0]), funicode(c_namespaces[1])))
 *         c_namespaces += 2
 *     return namespaces             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_namespaces);
  __pyx_r = __pyx_v_namespaces;
  goto __pyx_L0;

  /* "src/lxml/saxparser.pxi":280
 * 
 * 
 * cdef list _build_prefix_uri_list(_SaxParserContext context, int c_nb_namespaces,             # <<<<<<<<<<<<<<
 *                                  const_xmlChar** c_namespaces):
 *     "Build [(prefix, uri)] list of declared namespaces."
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._build_prefix_uri_list", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_namespaces);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/saxparser.pxi":291
 * 
 * 
 * cdef void _handleSaxStart(             # <<<<<<<<<<<<<<
 *         void* ctxt, const_xmlChar* c_localname, const_xmlChar* c_prefix,
 *         const_xmlChar* c_namespace, int c_nb_namespaces,
*/

static void __pyx_f_4lxml_5etree__handleSaxStart(void *__pyx_v_ctxt, const xmlChar *__pyx_v_c_localname, const xmlChar *__pyx_v_c_prefix, const xmlChar *__pyx_v_c_namespace, int __pyx_v_c_nb_namespaces, const xmlChar **__pyx_v_c_namespaces, int __pyx_v_c_nb_attributes, int __pyx_v_c_nb_defaulted, const xmlChar **__pyx_v_c_attributes) {
  xmlParserCtxt *__pyx_v_c_ctxt;
  struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_context = NULL;
  int __pyx_v_event_filter;
  PyObject *__pyx_v_declared_namespaces = NULL;
  PyObject *__pyx_v_prefix_uri_tuple = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  Py_ssize_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("_handleSaxStart", 0);

  /* "src/lxml/saxparser.pxi":299
 *     cdef int i
 *     cdef size_t c_len
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt             # <<<<<<<<<<<<<<
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):
 *         return
*/
  __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt);

  /* "src/lxml/saxparser.pxi":300
 *     cdef size_t c_len
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
*/
  __pyx_t_2 = (__pyx_v_c_ctxt->_private == NULL);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = xmlCtxtIsStopped(__pyx_v_c_ctxt);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/saxparser.pxi":301
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):
 *         return             # <<<<<<<<<<<<<<
 *     context = <_SaxParserContext>c_ctxt._private
 *     cdef int event_filter = context._event_filter
*/
    goto __pyx_L0;

    /* "src/lxml/saxparser.pxi":300
 *     cdef size_t c_len
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
*/
  }

  /* "src/lxml/saxparser.pxi":302
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):
 *         return
 *     context = <_SaxParserContext>c_ctxt._private             # <<<<<<<<<<<<<<
 *     cdef int event_filter = context._event_filter
 *     try:
*/
  __pyx_t_3 = ((PyObject *)__pyx_v_c_ctxt->_private);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/saxparser.pxi":303
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     cdef int event_filter = context._event_filter             # <<<<<<<<<<<<<<
 *     try:
 *         if (c_nb_namespaces and
*/
  __pyx_t_4 = __pyx_v_context->_event_filter;
  __pyx_v_event_filter = __pyx_t_4;

  /* "src/lxml/saxparser.pxi":304
 *     context = <_SaxParserContext>c_ctxt._private
 *     cdef int event_filter = context._event_filter
 *     try:             # <<<<<<<<<<<<<<
 *         if (c_nb_namespaces and
 *                 event_filter & (PARSE_EVENT_FILTER_START_NS |
*/
  /*try:*/ {
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);
      /*try:*/ {

        /* "src/lxml/saxparser.pxi":305
 *     cdef int event_filter = context._event_filter
 *     try:
 *         if (c_nb_namespaces and             # <<<<<<<<<<<<<<
 *                 event_filter & (PARSE_EVENT_FILTER_START_NS |
 *                                 PARSE_EVENT_FILTER_END_NS)):
*/
        __pyx_t_2 = (__pyx_v_c_nb_namespaces != 0);
        if (__pyx_t_2) {
        } else {
          __pyx_t_1 = __pyx_t_2;
          goto __pyx_L16_bool_binop_done;
        }

        /* "src/lxml/saxparser.pxi":306
 *     try:
 *         if (c_nb_namespaces and
 *                 event_filter & (PARSE_EVENT_FILTER_START_NS |             # <<<<<<<<<<<<<<
 *                                 PARSE_EVENT_FILTER_END_NS)):
 *             declared_namespaces = _build_prefix_uri_list(
*/
        __pyx_t_2 = ((__pyx_v_event_filter & (__pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_START_NS | __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_END_NS)) != 0);
        __pyx_t_1 = __pyx_t_2;
        __pyx_L16_bool_binop_done:;

        /* "src/lxml/saxparser.pxi":305
 *     cdef int event_filter = context._event_filter
 *     try:
 *         if (c_nb_namespaces and             # <<<<<<<<<<<<<<
 *                 event_filter & (PARSE_EVENT_FILTER_START_NS |
 *                                 PARSE_EVENT_FILTER_END_NS)):
*/
        if (__pyx_t_1) {

          /* "src/lxml/saxparser.pxi":308
 *                 event_filter & (PARSE_EVENT_FILTER_START_NS |
 *                                 PARSE_EVENT_FILTER_END_NS)):
 *             declared_namespaces = _build_prefix_uri_list(             # <<<<<<<<<<<<<<
 *                 context, c_nb_namespaces, c_namespaces)
 *             if event_filter & PARSE_EVENT_FILTER_START_NS:
*/
          __pyx_t_3 = __pyx_f_4lxml_5etree__build_prefix_uri_list(__pyx_v_context, __pyx_v_c_nb_namespaces, __pyx_v_c_namespaces); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 308, __pyx_L9_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_v_declared_namespaces = ((PyObject*)__pyx_t_3);
          __pyx_t_3 = 0;

          /* "src/lxml/saxparser.pxi":310
 *             declared_namespaces = _build_prefix_uri_list(
 *                 context, c_nb_namespaces, c_namespaces)
 *             if event_filter & PARSE_EVENT_FILTER_START_NS:             # <<<<<<<<<<<<<<
 *                 for prefix_uri_tuple in declared_namespaces:
 *                     context.events_iterator._events.append(("start-ns", prefix_uri_tuple))
*/
          __pyx_t_1 = ((__pyx_v_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_START_NS) != 0);
          if (__pyx_t_1) {

            /* "src/lxml/saxparser.pxi":311
 *                 context, c_nb_namespaces, c_namespaces)
 *             if event_filter & PARSE_EVENT_FILTER_START_NS:
 *                 for prefix_uri_tuple in declared_namespaces:             # <<<<<<<<<<<<<<
 *                     context.events_iterator._events.append(("start-ns", prefix_uri_tuple))
 *         else:
*/
            if (unlikely(__pyx_v_declared_namespaces == Py_None)) {
              PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
              __PYX_ERR(5, 311, __pyx_L9_error)
            }
            __pyx_t_3 = __pyx_v_declared_namespaces; __Pyx_INCREF(__pyx_t_3);
            __pyx_t_8 = 0;
            for (;;) {
              {
                Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
                #if !CYTHON_ASSUME_SAFE_SIZE
                if (unlikely((__pyx_temp < 0))) __PYX_ERR(5, 311, __pyx_L9_error)
                #endif
                if (__pyx_t_8 >= __pyx_temp) break;
              }
              __pyx_t_9 = __Pyx_PyList_GetItemRefFast(__pyx_t_3, __pyx_t_8, __Pyx_ReferenceSharing_OwnStrongReference);
              ++__pyx_t_8;
              if (unlikely(!__pyx_t_9)) __PYX_ERR(5, 311, __pyx_L9_error)
              __Pyx_GOTREF(__pyx_t_9);
              __Pyx_XDECREF_SET(__pyx_v_prefix_uri_tuple, __pyx_t_9);
              __pyx_t_9 = 0;

              /* "src/lxml/saxparser.pxi":312
 *             if event_filter & PARSE_EVENT_FILTER_START_NS:
 *                 for prefix_uri_tuple in declared_namespaces:
 *                     context.events_iterator._events.append(("start-ns", prefix_uri_tuple))             # <<<<<<<<<<<<<<
 *         else:
 *             declared_namespaces = None
*/
              if (unlikely(__pyx_v_context->events_iterator->_events == Py_None)) {
                PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
                __PYX_ERR(5, 312, __pyx_L9_error)
              }
              __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(5, 312, __pyx_L9_error)
              __Pyx_GOTREF(__pyx_t_9);
              __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_start_ns);
              __Pyx_GIVEREF(__pyx_mstate_global->__pyx_kp_u_start_ns);
              if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_mstate_global->__pyx_kp_u_start_ns) != (0)) __PYX_ERR(5, 312, __pyx_L9_error);
              __Pyx_INCREF(__pyx_v_prefix_uri_tuple);
              __Pyx_GIVEREF(__pyx_v_prefix_uri_tuple);
              if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_prefix_uri_tuple) != (0)) __PYX_ERR(5, 312, __pyx_L9_error);
              __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_context->events_iterator->_events, __pyx_t_9); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(5, 312, __pyx_L9_error)
              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

              /* "src/lxml/saxparser.pxi":311
 *                 context, c_nb_namespaces, c_namespaces)
 *             if event_filter & PARSE_EVENT_FILTER_START_NS:
 *                 for prefix_uri_tuple in declared_namespaces:             # <<<<<<<<<<<<<<
 *                     context.events_iterator._events.append(("start-ns", prefix_uri_tuple))
 *         else:
*/
            }
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

            /* "src/lxml/saxparser.pxi":310
 *             declared_namespaces = _build_prefix_uri_list(
 *                 context, c_nb_namespaces, c_namespaces)
 *             if event_filter & PARSE_EVENT_FILTER_START_NS:             # <<<<<<<<<<<<<<
 *                 for prefix_uri_tuple in declared_namespaces:
 *                     context.events_iterator._events.append(("start-ns", prefix_uri_tuple))
*/
          }

          /* "src/lxml/saxparser.pxi":305
 *     cdef int event_filter = context._event_filter
 *     try:
 *         if (c_nb_namespaces and             # <<<<<<<<<<<<<<
 *                 event_filter & (PARSE_EVENT_FILTER_START_NS |
 *                                 PARSE_EVENT_FILTER_END_NS)):
*/
          goto __pyx_L15;
        }

        /* "src/lxml/saxparser.pxi":314
 *                     context.events_iterator._events.append(("start-ns", prefix_uri_tuple))
 *         else:
 *             declared_namespaces = None             # <<<<<<<<<<<<<<
 * 
 *         context._origSaxStart(c_ctxt, c_localname, c_prefix, c_namespace,
*/
        /*else*/ {
          __Pyx_INCREF(Py_None);
          __pyx_v_declared_namespaces = ((PyObject*)Py_None);
        }
        __pyx_L15:;

        /* "src/lxml/saxparser.pxi":316
 *             declared_namespaces = None
 * 
 *         context._origSaxStart(c_ctxt, c_localname, c_prefix, c_namespace,             # <<<<<<<<<<<<<<
 *                               c_nb_namespaces, c_namespaces, c_nb_attributes,
 *                               c_nb_defaulted, c_attributes)
*/
        __pyx_v_context->_origSaxStart(__pyx_v_c_ctxt, __pyx_v_c_localname, __pyx_v_c_prefix, __pyx_v_c_namespace, __pyx_v_c_nb_namespaces, __pyx_v_c_namespaces, __pyx_v_c_nb_attributes, __pyx_v_c_nb_defaulted, __pyx_v_c_attributes);

        /* "src/lxml/saxparser.pxi":319
 *                               c_nb_namespaces, c_namespaces, c_nb_attributes,
 *                               c_nb_defaulted, c_attributes)
 *         if c_ctxt.html:             # <<<<<<<<<<<<<<
 *             _fixHtmlDictNodeNames(c_ctxt.dict, c_ctxt.node)
 *             # The HTML parser in libxml2 reports the missing opening tags when it finds
*/
        if (__pyx_v_c_ctxt->html) {

          /* "src/lxml/saxparser.pxi":320
 *                               c_nb_defaulted, c_attributes)
 *         if c_ctxt.html:
 *             _fixHtmlDictNodeNames(c_ctxt.dict, c_ctxt.node)             # <<<<<<<<<<<<<<
 *             # The HTML parser in libxml2 reports the missing opening tags when it finds
 *             # misplaced ones, but with tag names from C string constants that ignore the
*/
          (void)(__pyx_f_4lxml_5etree__fixHtmlDictNodeNames(__pyx_v_c_ctxt->dict, __pyx_v_c_ctxt->node));

          /* "src/lxml/saxparser.pxi":324
 *             # misplaced ones, but with tag names from C string constants that ignore the
 *             # parser dict.  Thus, we need to intern the name ourselves.
 *             c_localname = tree.xmlDictLookup(c_ctxt.dict, c_localname, -1)             # <<<<<<<<<<<<<<
 *             if c_localname is NULL:
 *                 raise MemoryError()
*/
          __pyx_v_c_localname = xmlDictLookup(__pyx_v_c_ctxt->dict, __pyx_v_c_localname, -1);

          /* "src/lxml/saxparser.pxi":325
 *             # parser dict.  Thus, we need to intern the name ourselves.
 *             c_localname = tree.xmlDictLookup(c_ctxt.dict, c_localname, -1)
 *             if c_localname is NULL:             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 * 
*/
          __pyx_t_1 = (__pyx_v_c_localname == NULL);
          if (unlikely(__pyx_t_1)) {

            /* "src/lxml/saxparser.pxi":326
 *             c_localname = tree.xmlDictLookup(c_ctxt.dict, c_localname, -1)
 *             if c_localname is NULL:
 *                 raise MemoryError()             # <<<<<<<<<<<<<<
 * 
 *         if event_filter & PARSE_EVENT_FILTER_END_NS:
*/
            PyErr_NoMemory(); __PYX_ERR(5, 326, __pyx_L9_error)

            /* "src/lxml/saxparser.pxi":325
 *             # parser dict.  Thus, we need to intern the name ourselves.
 *             c_localname = tree.xmlDictLookup(c_ctxt.dict, c_localname, -1)
 *             if c_localname is NULL:             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 * 
*/
          }

          /* "src/lxml/saxparser.pxi":319
 *                               c_nb_namespaces, c_namespaces, c_nb_attributes,
 *                               c_nb_defaulted, c_attributes)
 *         if c_ctxt.html:             # <<<<<<<<<<<<<<
 *             _fixHtmlDictNodeNames(c_ctxt.dict, c_ctxt.node)
 *             # The HTML parser in libxml2 reports the missing opening tags when it finds
*/
        }

        /* "src/lxml/saxparser.pxi":328
 *                 raise MemoryError()
 * 
 *         if event_filter & PARSE_EVENT_FILTER_END_NS:             # <<<<<<<<<<<<<<
 *             context._ns_stack.append(declared_namespaces)
 *         if event_filter & (PARSE_EVENT_FILTER_END |
*/
        __pyx_t_1 = ((__pyx_v_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_END_NS) != 0);
        if (__pyx_t_1) {

          /* "src/lxml/saxparser.pxi":329
 * 
 *         if event_filter & PARSE_EVENT_FILTER_END_NS:
 *             context._ns_stack.append(declared_namespaces)             # <<<<<<<<<<<<<<
 *         if event_filter & (PARSE_EVENT_FILTER_END |
 *                            PARSE_EVENT_FILTER_START):
*/
          if (unlikely(__pyx_v_context->_ns_stack == Py_None)) {
            PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
            __PYX_ERR(5, 329, __pyx_L9_error)
          }
          __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_context->_ns_stack, __pyx_v_declared_namespaces); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(5, 329, __pyx_L9_error)

          /* "src/lxml/saxparser.pxi":328
 *                 raise MemoryError()
 * 
 *         if event_filter & PARSE_EVENT_FILTER_END_NS:             # <<<<<<<<<<<<<<
 *             context._ns_stack.append(declared_namespaces)
 *         if event_filter & (PARSE_EVENT_FILTER_END |
*/
        }

        /* "src/lxml/saxparser.pxi":330
 *         if event_filter & PARSE_EVENT_FILTER_END_NS:
 *             context._ns_stack.append(declared_namespaces)
 *         if event_filter & (PARSE_EVENT_FILTER_END |             # <<<<<<<<<<<<<<
 *                            PARSE_EVENT_FILTER_START):
 *             _pushSaxStartEvent(context, c_ctxt, c_namespace, c_localname, None)
*/
        __pyx_t_1 = ((__pyx_v_event_filter & (__pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_END | __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_START)) != 0);
        if (__pyx_t_1) {

          /* "src/lxml/saxparser.pxi":332
 *         if event_filter & (PARSE_EVENT_FILTER_END |
 *                            PARSE_EVENT_FILTER_START):
 *             _pushSaxStartEvent(context, c_ctxt, c_namespace, c_localname, None)             # <<<<<<<<<<<<<<
 *     except:
 *         context._handleSaxException(c_ctxt)
*/
          __pyx_t_4 = __pyx_f_4lxml_5etree__pushSaxStartEvent(__pyx_v_context, __pyx_v_c_ctxt, __pyx_v_c_namespace, __pyx_v_c_localname, Py_None); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(5, 332, __pyx_L9_error)

          /* "src/lxml/saxparser.pxi":330
 *         if event_filter & PARSE_EVENT_FILTER_END_NS:
 *             context._ns_stack.append(declared_namespaces)
 *         if event_filter & (PARSE_EVENT_FILTER_END |             # <<<<<<<<<<<<<<
 *                            PARSE_EVENT_FILTER_START):
 *             _pushSaxStartEvent(context, c_ctxt, c_namespace, c_localname, None)
*/
        }

        /* "src/lxml/saxparser.pxi":304
 *     context = <_SaxParserContext>c_ctxt._private
 *     cdef int event_filter = context._event_filter
 *     try:             # <<<<<<<<<<<<<<
 *         if (c_nb_namespaces and
 *                 event_filter & (PARSE_EVENT_FILTER_START_NS |
*/
      }
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L14_try_end;
      __pyx_L9_error:;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "src/lxml/saxparser.pxi":333
 *                            PARSE_EVENT_FILTER_START):
 *             _pushSaxStartEvent(context, c_ctxt, c_namespace, c_localname, None)
 *     except:             # <<<<<<<<<<<<<<
 *         context._handleSaxException(c_ctxt)
 *     finally:
*/
      /*except:*/ {
        __Pyx_AddTraceback("lxml.etree._handleSaxStart", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_9, &__pyx_t_11) < 0) __PYX_ERR(5, 333, __pyx_L11_except_error)
        __Pyx_XGOTREF(__pyx_t_3);
        __Pyx_XGOTREF(__pyx_t_9);
        __Pyx_XGOTREF(__pyx_t_11);

        /* "src/lxml/saxparser.pxi":334
 *             _pushSaxStartEvent(context, c_ctxt, c_namespace, c_localname, None)
 *     except:
 *         context._handleSaxException(c_ctxt)             # <<<<<<<<<<<<<<
 *     finally:
 *         return  # swallow any further exceptions
*/
        ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->_handleSaxException(__pyx_v_context, __pyx_v_c_ctxt);
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        goto __pyx_L10_exception_handled;
      }

      /* "src/lxml/saxparser.pxi":304
 *     context = <_SaxParserContext>c_ctxt._private
 *     cdef int event_filter = context._event_filter
 *     try:             # <<<<<<<<<<<<<<
 *         if (c_nb_namespaces and
 *                 event_filter & (PARSE_EVENT_FILTER_START_NS |
*/
      __pyx_L11_except_error:;
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
      goto __pyx_L7_error;
      __pyx_L10_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
      __pyx_L14_try_end:;
    }
  }

  /* "src/lxml/saxparser.pxi":336
 *         context._handleSaxException(c_ctxt)
 *     finally:
 *         return  # swallow any further exceptions             # <<<<<<<<<<<<<<
 * 
 * 
*/
  /*finally:*/ {
    /*normal exit:*/{
      goto __pyx_L0;
    }
    __pyx_L7_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_7 = 0; __pyx_t_6 = 0; __pyx_t_5 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
      if ( unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_6, &__pyx_t_5) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_6, &__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_14);
      {
        goto __pyx_L28_return;
      }
      __pyx_L28_return:;
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_XGIVEREF(__pyx_t_14);
      __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
      goto __pyx_L0;
    }
  }

  /* "src/lxml/saxparser.pxi":291
 * 
 * 
 * cdef void _handleSaxStart(             # <<<<<<<<<<<<<<
 *         void* ctxt, const_xmlChar* c_localname, const_xmlChar* c_prefix,
 *         const_xmlChar* c_namespace, int c_nb_namespaces,
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_declared_namespaces);
  __Pyx_XDECREF(__pyx_v_prefix_uri_tuple);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
}

/* "src/lxml/saxparser.pxi":339
 * 
 * 
 * cdef void _handleSaxTargetStart(             # <<<<<<<<<<<<<<
 *         void* ctxt, const_xmlChar* c_localname, const_xmlChar* c_prefix,
 *         const_xmlChar* c_namespace, int c_nb_namespaces,
*/

static void __pyx_f_4lxml_5etree__handleSaxTargetStart(void *__pyx_v_ctxt, const xmlChar *__pyx_v_c_localname, CYTHON_UNUSED const xmlChar *__pyx_v_c_prefix, const xmlChar *__pyx_v_c_namespace, int __pyx_v_c_nb_namespaces, const xmlChar **__pyx_v_c_namespaces, int __pyx_v_c_nb_attributes, int __pyx_v_c_nb_defaulted, const xmlChar **__pyx_v_c_attributes) {
  CYTHON_UNUSED int __pyx_v_i;
  size_t __pyx_v_c_len;
  xmlParserCtxt *__pyx_v_c_ctxt;
  struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_context = NULL;
  int __pyx_v_event_filter;
  int __pyx_v_sax_event_filter;
  PyObject *__pyx_v_declared_namespaces = NULL;
  PyObject *__pyx_v_prefix_uri_tuple = NULL;
  PyObject *__pyx_v_prefix = NULL;
  PyObject *__pyx_v_uri = NULL;
  PyObject *__pyx_v_attrib = NULL;
  PyObject *__pyx_v_name = NULL;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_v_nsmap = NULL;
  PyObject *__pyx_v_element = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  Py_ssize_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *(*__pyx_t_14)(PyObject *);
  int __pyx_t_15;
  int __pyx_t_16;
  size_t __pyx_t_17;
  PyObject *__pyx_t_18 = NULL;
  PyObject *__pyx_t_19 = NULL;
  PyObject *__pyx_t_20 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("_handleSaxTargetStart", 0);

  /* "src/lxml/saxparser.pxi":347
 *     cdef int i
 *     cdef size_t c_len
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt             # <<<<<<<<<<<<<<
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):
 *         return
*/
  __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt);

  /* "src/lxml/saxparser.pxi":348
 *     cdef size_t c_len
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
*/
  __pyx_t_2 = (__pyx_v_c_ctxt->_private == NULL);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = xmlCtxtIsStopped(__pyx_v_c_ctxt);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/saxparser.pxi":349
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):
 *         return             # <<<<<<<<<<<<<<
 *     context = <_SaxParserContext>c_ctxt._private
 * 
*/
    goto __pyx_L0;

    /* "src/lxml/saxparser.pxi":348
 *     cdef size_t c_len
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
*/
  }

  /* "src/lxml/saxparser.pxi":350
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):
 *         return
 *     context = <_SaxParserContext>c_ctxt._private             # <<<<<<<<<<<<<<
 * 
 *     cdef int event_filter = context._event_filter
*/
  __pyx_t_3 = ((PyObject *)__pyx_v_c_ctxt->_private);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/saxparser.pxi":352
 *     context = <_SaxParserContext>c_ctxt._private
 * 
 *     cdef int event_filter = context._event_filter             # <<<<<<<<<<<<<<
 *     cdef int sax_event_filter = context._target._sax_event_filter
 *     try:
*/
  __pyx_t_4 = __pyx_v_context->_event_filter;
  __pyx_v_event_filter = __pyx_t_4;

  /* "src/lxml/saxparser.pxi":353
 * 
 *     cdef int event_filter = context._event_filter
 *     cdef int sax_event_filter = context._target._sax_event_filter             # <<<<<<<<<<<<<<
 *     try:
 *         if c_nb_namespaces:
*/
  __pyx_t_4 = __pyx_v_context->_target->_sax_event_filter;
  __pyx_v_sax_event_filter = __pyx_t_4;

  /* "src/lxml/saxparser.pxi":354
 *     cdef int event_filter = context._event_filter
 *     cdef int sax_event_filter = context._target._sax_event_filter
 *     try:             # <<<<<<<<<<<<<<
 *         if c_nb_namespaces:
 *             declared_namespaces = _build_prefix_uri_list(
*/
  /*try:*/ {
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);
      /*try:*/ {

        /* "src/lxml/saxparser.pxi":355
 *     cdef int sax_event_filter = context._target._sax_event_filter
 *     try:
 *         if c_nb_namespaces:             # <<<<<<<<<<<<<<
 *             declared_namespaces = _build_prefix_uri_list(
 *                 context, c_nb_namespaces, c_namespaces)
*/
        __pyx_t_1 = (__pyx_v_c_nb_namespaces != 0);
        if (__pyx_t_1) {

          /* "src/lxml/saxparser.pxi":356
 *     try:
 *         if c_nb_namespaces:
 *             declared_namespaces = _build_prefix_uri_list(             # <<<<<<<<<<<<<<
 *                 context, c_nb_namespaces, c_namespaces)
 * 
*/
          __pyx_t_3 = __pyx_f_4lxml_5etree__build_prefix_uri_list(__pyx_v_context, __pyx_v_c_nb_namespaces, __pyx_v_c_namespaces); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 356, __pyx_L9_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_v_declared_namespaces = ((PyObject*)__pyx_t_3);
          __pyx_t_3 = 0;

          /* "src/lxml/saxparser.pxi":359
 *                 context, c_nb_namespaces, c_namespaces)
 * 
 *             if event_filter & PARSE_EVENT_FILTER_START_NS:             # <<<<<<<<<<<<<<
 *                 for prefix_uri_tuple in declared_namespaces:
 *                     context.events_iterator._events.append(("start-ns", prefix_uri_tuple))
*/
          __pyx_t_1 = ((__pyx_v_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_START_NS) != 0);
          if (__pyx_t_1) {

            /* "src/lxml/saxparser.pxi":360
 * 
 *             if event_filter & PARSE_EVENT_FILTER_START_NS:
 *                 for prefix_uri_tuple in declared_namespaces:             # <<<<<<<<<<<<<<
 *                     context.events_iterator._events.append(("start-ns", prefix_uri_tuple))
 * 
*/
            if (unlikely(__pyx_v_declared_namespaces == Py_None)) {
              PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
              __PYX_ERR(5, 360, __pyx_L9_error)
            }
            __pyx_t_3 = __pyx_v_declared_namespaces; __Pyx_INCREF(__pyx_t_3);
            __pyx_t_8 = 0;
            for (;;) {
              {
                Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
                #if !CYTHON_ASSUME_SAFE_SIZE
                if (unlikely((__pyx_temp < 0))) __PYX_ERR(5, 360, __pyx_L9_error)
                #endif
                if (__pyx_t_8 >= __pyx_temp) break;
              }
              __pyx_t_9 = __Pyx_PyList_GetItemRefFast(__pyx_t_3, __pyx_t_8, __Pyx_ReferenceSharing_OwnStrongReference);
              ++__pyx_t_8;
              if (unlikely(!__pyx_t_9)) __PYX_ERR(5, 360, __pyx_L9_error)
              __Pyx_GOTREF(__pyx_t_9);
              __Pyx_XDECREF_SET(__pyx_v_prefix_uri_tuple, __pyx_t_9);
              __pyx_t_9 = 0;

              /* "src/lxml/saxparser.pxi":361
 *             if event_filter & PARSE_EVENT_FILTER_START_NS:
 *                 for prefix_uri_tuple in declared_namespaces:
 *                     context.events_iterator._events.append(("start-ns", prefix_uri_tuple))             # <<<<<<<<<<<<<<
 * 
 *             if sax_event_filter & SAX_EVENT_START_NS:
*/
              if (unlikely(__pyx_v_context->events_iterator->_events == Py_None)) {
                PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
                __PYX_ERR(5, 361, __pyx_L9_error)
              }
              __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(5, 361, __pyx_L9_error)
              __Pyx_GOTREF(__pyx_t_9);
              __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_start_ns);
              __Pyx_GIVEREF(__pyx_mstate_global->__pyx_kp_u_start_ns);
              if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_mstate_global->__pyx_kp_u_start_ns) != (0)) __PYX_ERR(5, 361, __pyx_L9_error);
              __Pyx_INCREF(__pyx_v_prefix_uri_tuple);
              __Pyx_GIVEREF(__pyx_v_prefix_uri_tuple);
              if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_prefix_uri_tuple) != (0)) __PYX_ERR(5, 361, __pyx_L9_error);
              __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_context->events_iterator->_events, __pyx_t_9); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(5, 361, __pyx_L9_error)
              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

              /* "src/lxml/saxparser.pxi":360
 * 
 *             if event_filter & PARSE_EVENT_FILTER_START_NS:
 *                 for prefix_uri_tuple in declared_namespaces:             # <<<<<<<<<<<<<<
 *                     context.events_iterator._events.append(("start-ns", prefix_uri_tuple))
 * 
*/
            }
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

            /* "src/lxml/saxparser.pxi":359
 *                 context, c_nb_namespaces, c_namespaces)
 * 
 *             if event_filter & PARSE_EVENT_FILTER_START_NS:             # <<<<<<<<<<<<<<
 *                 for prefix_uri_tuple in declared_namespaces:
 *                     context.events_iterator._events.append(("start-ns", prefix_uri_tuple))
*/
          }

          /* "src/lxml/saxparser.pxi":363
 *                     context.events_iterator._events.append(("start-ns", prefix_uri_tuple))
 * 
 *             if sax_event_filter & SAX_EVENT_START_NS:             # <<<<<<<<<<<<<<
 *                 for prefix, uri in declared_namespaces:
 *                     context._target._handleSaxStartNs(prefix, uri)
*/
          __pyx_t_1 = ((__pyx_v_sax_event_filter & __pyx_e_4lxml_5etree_SAX_EVENT_START_NS) != 0);
          if (__pyx_t_1) {

            /* "src/lxml/saxparser.pxi":364
 * 
 *             if sax_event_filter & SAX_EVENT_START_NS:
 *                 for prefix, uri in declared_namespaces:             # <<<<<<<<<<<<<<
 *                     context._target._handleSaxStartNs(prefix, uri)
 *         else:
*/
            if (unlikely(__pyx_v_declared_namespaces == Py_None)) {
              PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
              __PYX_ERR(5, 364, __pyx_L9_error)
            }
            __pyx_t_3 = __pyx_v_declared_namespaces; __Pyx_INCREF(__pyx_t_3);
            __pyx_t_8 = 0;
            for (;;) {
              {
                Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
                #if !CYTHON_ASSUME_SAFE_SIZE
                if (unlikely((__pyx_temp < 0))) __PYX_ERR(5, 364, __pyx_L9_error)
                #endif
                if (__pyx_t_8 >= __pyx_temp) break;
              }
              __pyx_t_9 = __Pyx_PyList_GetItemRefFast(__pyx_t_3, __pyx_t_8, __Pyx_ReferenceSharing_OwnStrongReference);
              ++__pyx_t_8;
              if (unlikely(!__pyx_t_9)) __PYX_ERR(5, 364, __pyx_L9_error)
              __Pyx_GOTREF(__pyx_t_9);
              if ((likely(PyTuple_CheckExact(__pyx_t_9))) || (PyList_CheckExact(__pyx_t_9))) {
                PyObject* sequence = __pyx_t_9;
                Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
                if (unlikely(size != 2)) {
                  if (size > 2) __Pyx_RaiseTooManyValuesError(2);
                  else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
                  __PYX_ERR(5, 364, __pyx_L9_error)
                }
                #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                if (likely(PyTuple_CheckExact(sequence))) {
                  __pyx_t_11 = PyTuple_GET_ITEM(sequence, 0);
                  __Pyx_INCREF(__pyx_t_11);
                  __pyx_t_12 = PyTuple_GET_ITEM(sequence, 1);
                  __Pyx_INCREF(__pyx_t_12);
                } else {
                  __pyx_t_11 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
                  if (unlikely(!__pyx_t_11)) __PYX_ERR(5, 364, __pyx_L9_error)
                  __Pyx_XGOTREF(__pyx_t_11);
                  __pyx_t_12 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
                  if (unlikely(!__pyx_t_12)) __PYX_ERR(5, 364, __pyx_L9_error)
                  __Pyx_XGOTREF(__pyx_t_12);
                }
                #else
                __pyx_t_11 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(5, 364, __pyx_L9_error)
                __Pyx_GOTREF(__pyx_t_11);
                __pyx_t_12 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_12)) __PYX_ERR(5, 364, __pyx_L9_error)
                __Pyx_GOTREF(__pyx_t_12);
                #endif
                __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
              } else {
                Py_ssize_t index = -1;
                __pyx_t_13 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_13)) __PYX_ERR(5, 364, __pyx_L9_error)
                __Pyx_GOTREF(__pyx_t_13);
                __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
                __pyx_t_14 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_13);
                index = 0; __pyx_t_11 = __pyx_t_14(__pyx_t_13); if (unlikely(!__pyx_t_11)) goto __pyx_L23_unpacking_failed;
                __Pyx_GOTREF(__pyx_t_11);
                index = 1; __pyx_t_12 = __pyx_t_14(__pyx_t_13); if (unlikely(!__pyx_t_12)) goto __pyx_L23_unpacking_failed;
                __Pyx_GOTREF(__pyx_t_12);
                if (__Pyx_IternextUnpackEndCheck(__pyx_t_14(__pyx_t_13), 2) < (0)) __PYX_ERR(5, 364, __pyx_L9_error)
                __pyx_t_14 = NULL;
                __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
                goto __pyx_L24_unpacking_done;
                __pyx_L23_unpacking_failed:;
                __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
                __pyx_t_14 = NULL;
                if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
                __PYX_ERR(5, 364, __pyx_L9_error)
                __pyx_L24_unpacking_done:;
              }
              __Pyx_XDECREF_SET(__pyx_v_prefix, __pyx_t_11);
              __pyx_t_11 = 0;
              __Pyx_XDECREF_SET(__pyx_v_uri, __pyx_t_12);
              __pyx_t_12 = 0;

              /* "src/lxml/saxparser.pxi":365
 *             if sax_event_filter & SAX_EVENT_START_NS:
 *                 for prefix, uri in declared_namespaces:
 *                     context._target._handleSaxStartNs(prefix, uri)             # <<<<<<<<<<<<<<
 *         else:
 *             declared_namespaces = None
*/
              __pyx_t_9 = ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserTarget *)__pyx_v_context->_target->__pyx_vtab)->_handleSaxStartNs(__pyx_v_context->_target, __pyx_v_prefix, __pyx_v_uri); if (unlikely(!__pyx_t_9)) __PYX_ERR(5, 365, __pyx_L9_error)
              __Pyx_GOTREF(__pyx_t_9);
              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

              /* "src/lxml/saxparser.pxi":364
 * 
 *             if sax_event_filter & SAX_EVENT_START_NS:
 *                 for prefix, uri in declared_namespaces:             # <<<<<<<<<<<<<<
 *                     context._target._handleSaxStartNs(prefix, uri)
 *         else:
*/
            }
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

            /* "src/lxml/saxparser.pxi":363
 *                     context.events_iterator._events.append(("start-ns", prefix_uri_tuple))
 * 
 *             if sax_event_filter & SAX_EVENT_START_NS:             # <<<<<<<<<<<<<<
 *                 for prefix, uri in declared_namespaces:
 *                     context._target._handleSaxStartNs(prefix, uri)
*/
          }

          /* "src/lxml/saxparser.pxi":355
 *     cdef int sax_event_filter = context._target._sax_event_filter
 *     try:
 *         if c_nb_namespaces:             # <<<<<<<<<<<<<<
 *             declared_namespaces = _build_prefix_uri_list(
 *                 context, c_nb_namespaces, c_namespaces)
*/
          goto __pyx_L15;
        }

        /* "src/lxml/saxparser.pxi":367
 *                     context._target._handleSaxStartNs(prefix, uri)
 *         else:
 *             declared_namespaces = None             # <<<<<<<<<<<<<<
 * 
 *         if sax_event_filter & SAX_EVENT_START:
*/
        /*else*/ {
          __Pyx_INCREF(Py_None);
          __pyx_v_declared_namespaces = ((PyObject*)Py_None);
        }
        __pyx_L15:;

        /* "src/lxml/saxparser.pxi":369
 *             declared_namespaces = None
 * 
 *         if sax_event_filter & SAX_EVENT_START:             # <<<<<<<<<<<<<<
 *             if c_nb_defaulted > 0:
 *                 # only add default attributes if we asked for them
*/
        __pyx_t_1 = ((__pyx_v_sax_event_filter & __pyx_e_4lxml_5etree_SAX_EVENT_START) != 0);
        if (__pyx_t_1) {

          /* "src/lxml/saxparser.pxi":370
 * 
 *         if sax_event_filter & SAX_EVENT_START:
 *             if c_nb_defaulted > 0:             # <<<<<<<<<<<<<<
 *                 # only add default attributes if we asked for them
 *                 if c_ctxt.loadsubset & xmlparser.XML_COMPLETE_ATTRS == 0:
*/
          __pyx_t_1 = (__pyx_v_c_nb_defaulted > 0);
          if (__pyx_t_1) {

            /* "src/lxml/saxparser.pxi":372
 *             if c_nb_defaulted > 0:
 *                 # only add default attributes if we asked for them
 *                 if c_ctxt.loadsubset & xmlparser.XML_COMPLETE_ATTRS == 0:             # <<<<<<<<<<<<<<
 *                     c_nb_attributes -= c_nb_defaulted
 *             if c_nb_attributes == 0:
*/
            __pyx_t_1 = ((__pyx_v_c_ctxt->loadsubset & XML_COMPLETE_ATTRS) == 0);
            if (__pyx_t_1) {

              /* "src/lxml/saxparser.pxi":373
 *                 # only add default attributes if we asked for them
 *                 if c_ctxt.loadsubset & xmlparser.XML_COMPLETE_ATTRS == 0:
 *                     c_nb_attributes -= c_nb_defaulted             # <<<<<<<<<<<<<<
 *             if c_nb_attributes == 0:
 *                 attrib = IMMUTABLE_EMPTY_MAPPING
*/
              __pyx_v_c_nb_attributes = (__pyx_v_c_nb_attributes - __pyx_v_c_nb_defaulted);

              /* "src/lxml/saxparser.pxi":372
 *             if c_nb_defaulted > 0:
 *                 # only add default attributes if we asked for them
 *                 if c_ctxt.loadsubset & xmlparser.XML_COMPLETE_ATTRS == 0:             # <<<<<<<<<<<<<<
 *                     c_nb_attributes -= c_nb_defaulted
 *             if c_nb_attributes == 0:
*/
            }

            /* "src/lxml/saxparser.pxi":370
 * 
 *         if sax_event_filter & SAX_EVENT_START:
 *             if c_nb_defaulted > 0:             # <<<<<<<<<<<<<<
 *                 # only add default attributes if we asked for them
 *                 if c_ctxt.loadsubset & xmlparser.XML_COMPLETE_ATTRS == 0:
*/
          }

          /* "src/lxml/saxparser.pxi":374
 *                 if c_ctxt.loadsubset & xmlparser.XML_COMPLETE_ATTRS == 0:
 *                     c_nb_attributes -= c_nb_defaulted
 *             if c_nb_attributes == 0:             # <<<<<<<<<<<<<<
 *                 attrib = IMMUTABLE_EMPTY_MAPPING
 *             else:
*/
          __pyx_t_1 = (__pyx_v_c_nb_attributes == 0);
          if (__pyx_t_1) {

            /* "src/lxml/saxparser.pxi":375
 *                     c_nb_attributes -= c_nb_defaulted
 *             if c_nb_attributes == 0:
 *                 attrib = IMMUTABLE_EMPTY_MAPPING             # <<<<<<<<<<<<<<
 *             else:
 *                 attrib = {}
*/
            __Pyx_INCREF(__pyx_v_4lxml_5etree_IMMUTABLE_EMPTY_MAPPING);
            __pyx_v_attrib = __pyx_v_4lxml_5etree_IMMUTABLE_EMPTY_MAPPING;

            /* "src/lxml/saxparser.pxi":374
 *                 if c_ctxt.loadsubset & xmlparser.XML_COMPLETE_ATTRS == 0:
 *                     c_nb_attributes -= c_nb_defaulted
 *             if c_nb_attributes == 0:             # <<<<<<<<<<<<<<
 *                 attrib = IMMUTABLE_EMPTY_MAPPING
 *             else:
*/
            goto __pyx_L29;
          }

          /* "src/lxml/saxparser.pxi":377
 *                 attrib = IMMUTABLE_EMPTY_MAPPING
 *             else:
 *                 attrib = {}             # <<<<<<<<<<<<<<
 *                 for i in xrange(c_nb_attributes):
 *                     name = _namespacedNameFromNsName(
*/
          /*else*/ {
            __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 377, __pyx_L9_error)
            __Pyx_GOTREF(__pyx_t_3);
            __pyx_v_attrib = __pyx_t_3;
            __pyx_t_3 = 0;

            /* "src/lxml/saxparser.pxi":378
 *             else:
 *                 attrib = {}
 *                 for i in xrange(c_nb_attributes):             # <<<<<<<<<<<<<<
 *                     name = _namespacedNameFromNsName(
 *                         c_attributes[2], c_attributes[0])
*/
            __pyx_t_4 = __pyx_v_c_nb_attributes;
            __pyx_t_15 = __pyx_t_4;
            for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
              __pyx_v_i = __pyx_t_16;

              /* "src/lxml/saxparser.pxi":379
 *                 attrib = {}
 *                 for i in xrange(c_nb_attributes):
 *                     name = _namespacedNameFromNsName(             # <<<<<<<<<<<<<<
 *                         c_attributes[2], c_attributes[0])
 *                     if c_attributes[3] is NULL:
*/
              __pyx_t_3 = __pyx_f_4lxml_5etree__namespacedNameFromNsName((__pyx_v_c_attributes[2]), (__pyx_v_c_attributes[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 379, __pyx_L9_error)
              __Pyx_GOTREF(__pyx_t_3);
              __Pyx_XDECREF_SET(__pyx_v_name, ((PyObject*)__pyx_t_3));
              __pyx_t_3 = 0;

              /* "src/lxml/saxparser.pxi":381
 *                     name = _namespacedNameFromNsName(
 *                         c_attributes[2], c_attributes[0])
 *                     if c_attributes[3] is NULL:             # <<<<<<<<<<<<<<
 *                         value = ''
 *                     else:
*/
              __pyx_t_1 = ((__pyx_v_c_attributes[3]) == NULL);
              if (__pyx_t_1) {

                /* "src/lxml/saxparser.pxi":382
 *                         c_attributes[2], c_attributes[0])
 *                     if c_attributes[3] is NULL:
 *                         value = ''             # <<<<<<<<<<<<<<
 *                     else:
 *                         c_len = c_attributes[4] - c_attributes[3]
*/
                __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u__8);
                __Pyx_XDECREF_SET(__pyx_v_value, __pyx_mstate_global->__pyx_kp_u__8);

                /* "src/lxml/saxparser.pxi":381
 *                     name = _namespacedNameFromNsName(
 *                         c_attributes[2], c_attributes[0])
 *                     if c_attributes[3] is NULL:             # <<<<<<<<<<<<<<
 *                         value = ''
 *                     else:
*/
                goto __pyx_L32;
              }

              /* "src/lxml/saxparser.pxi":384
 *                         value = ''
 *                     else:
 *                         c_len = c_attributes[4] - c_attributes[3]             # <<<<<<<<<<<<<<
 *                         value = c_attributes[3][:c_len].decode('utf8')
 *                     attrib[name] = value
*/
              /*else*/ {
                __pyx_v_c_len = ((__pyx_v_c_attributes[4]) - (__pyx_v_c_attributes[3]));

                /* "src/lxml/saxparser.pxi":385
 *                     else:
 *                         c_len = c_attributes[4] - c_attributes[3]
 *                         value = c_attributes[3][:c_len].decode('utf8')             # <<<<<<<<<<<<<<
 *                     attrib[name] = value
 *                     c_attributes += 5
*/
                __pyx_t_3 = __Pyx_decode_c_string(((char const *)(__pyx_v_c_attributes[3])), 0, __pyx_v_c_len, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 385, __pyx_L9_error)
                __Pyx_GOTREF(__pyx_t_3);
                __Pyx_XDECREF_SET(__pyx_v_value, ((PyObject*)__pyx_t_3));
                __pyx_t_3 = 0;
              }
              __pyx_L32:;

              /* "src/lxml/saxparser.pxi":386
 *                         c_len = c_attributes[4] - c_attributes[3]
 *                         value = c_attributes[3][:c_len].decode('utf8')
 *                     attrib[name] = value             # <<<<<<<<<<<<<<
 *                     c_attributes += 5
 * 
*/
              if (unlikely((PyObject_SetItem(__pyx_v_attrib, __pyx_v_name, __pyx_v_value) < 0))) __PYX_ERR(5, 386, __pyx_L9_error)

              /* "src/lxml/saxparser.pxi":387
 *                         value = c_attributes[3][:c_len].decode('utf8')
 *                     attrib[name] = value
 *                     c_attributes += 5             # <<<<<<<<<<<<<<
 * 
 *             nsmap = dict(declared_namespaces) if c_nb_namespaces else IMMUTABLE_EMPTY_MAPPING
*/
              __pyx_v_c_attributes = (__pyx_v_c_attributes + 5);
            }
          }
          __pyx_L29:;

          /* "src/lxml/saxparser.pxi":389
 *                     c_attributes += 5
 * 
 *             nsmap = dict(declared_namespaces) if c_nb_namespaces else IMMUTABLE_EMPTY_MAPPING             # <<<<<<<<<<<<<<
 * 
 *             element = _callTargetSaxStart(
*/
          __pyx_t_1 = (__pyx_v_c_nb_namespaces != 0);
          if (__pyx_t_1) {
            __pyx_t_12 = NULL;
            __pyx_t_17 = 1;
            {
              PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_v_declared_namespaces};
              __pyx_t_9 = __Pyx_PyObject_FastCall((PyObject*)(&PyDict_Type), __pyx_callargs+__pyx_t_17, (2-__pyx_t_17) | (__pyx_t_17*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
              __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
              if (unlikely(!__pyx_t_9)) __PYX_ERR(5, 389, __pyx_L9_error)
              __Pyx_GOTREF(__pyx_t_9);
            }
            __pyx_t_3 = __pyx_t_9;
            __pyx_t_9 = 0;
          } else {
            __Pyx_INCREF(__pyx_v_4lxml_5etree_IMMUTABLE_EMPTY_MAPPING);
            __pyx_t_3 = __pyx_v_4lxml_5etree_IMMUTABLE_EMPTY_MAPPING;
          }
          __pyx_v_nsmap = __pyx_t_3;
          __pyx_t_3 = 0;

          /* "src/lxml/saxparser.pxi":393
 *             element = _callTargetSaxStart(
 *                 context, c_ctxt,
 *                 _namespacedNameFromNsName(c_namespace, c_localname),             # <<<<<<<<<<<<<<
 *                 attrib, nsmap)
 *         else:
*/
          __pyx_t_3 = __pyx_f_4lxml_5etree__namespacedNameFromNsName(__pyx_v_c_namespace, __pyx_v_c_localname); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 393, __pyx_L9_error)
          __Pyx_GOTREF(__pyx_t_3);

          /* "src/lxml/saxparser.pxi":391
 *             nsmap = dict(declared_namespaces) if c_nb_namespaces else IMMUTABLE_EMPTY_MAPPING
 * 
 *             element = _callTargetSaxStart(             # <<<<<<<<<<<<<<
 *                 context, c_ctxt,
 *                 _namespacedNameFromNsName(c_namespace, c_localname),
*/
          __pyx_t_9 = __pyx_f_4lxml_5etree__callTargetSaxStart(__pyx_v_context, __pyx_v_c_ctxt, __pyx_t_3, __pyx_v_attrib, __pyx_v_nsmap); if (unlikely(!__pyx_t_9)) __PYX_ERR(5, 391, __pyx_L9_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_v_element = __pyx_t_9;
          __pyx_t_9 = 0;

          /* "src/lxml/saxparser.pxi":369
 *             declared_namespaces = None
 * 
 *         if sax_event_filter & SAX_EVENT_START:             # <<<<<<<<<<<<<<
 *             if c_nb_defaulted > 0:
 *                 # only add default attributes if we asked for them
*/
          goto __pyx_L26;
        }

        /* "src/lxml/saxparser.pxi":396
 *                 attrib, nsmap)
 *         else:
 *             element = None             # <<<<<<<<<<<<<<
 * 
 *         if (event_filter & PARSE_EVENT_FILTER_END_NS or
*/
        /*else*/ {
          __Pyx_INCREF(Py_None);
          __pyx_v_element = Py_None;
        }
        __pyx_L26:;

        /* "src/lxml/saxparser.pxi":398
 *             element = None
 * 
 *         if (event_filter & PARSE_EVENT_FILTER_END_NS or             # <<<<<<<<<<<<<<
 *                 sax_event_filter & SAX_EVENT_END_NS):
 *             context._ns_stack.append(declared_namespaces)
*/
        __pyx_t_2 = ((__pyx_v_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_END_NS) != 0);
        if (!__pyx_t_2) {
        } else {
          __pyx_t_1 = __pyx_t_2;
          goto __pyx_L34_bool_binop_done;
        }

        /* "src/lxml/saxparser.pxi":399
 * 
 *         if (event_filter & PARSE_EVENT_FILTER_END_NS or
 *                 sax_event_filter & SAX_EVENT_END_NS):             # <<<<<<<<<<<<<<
 *             context._ns_stack.append(declared_namespaces)
 *         if event_filter & (PARSE_EVENT_FILTER_END |
*/
        __pyx_t_2 = ((__pyx_v_sax_event_filter & __pyx_e_4lxml_5etree_SAX_EVENT_END_NS) != 0);
        __pyx_t_1 = __pyx_t_2;
        __pyx_L34_bool_binop_done:;

        /* "src/lxml/saxparser.pxi":398
 *             element = None
 * 
 *         if (event_filter & PARSE_EVENT_FILTER_END_NS or             # <<<<<<<<<<<<<<
 *                 sax_event_filter & SAX_EVENT_END_NS):
 *             context._ns_stack.append(declared_namespaces)
*/
        if (__pyx_t_1) {

          /* "src/lxml/saxparser.pxi":400
 *         if (event_filter & PARSE_EVENT_FILTER_END_NS or
 *                 sax_event_filter & SAX_EVENT_END_NS):
 *             context._ns_stack.append(declared_namespaces)             # <<<<<<<<<<<<<<
 *         if event_filter & (PARSE_EVENT_FILTER_END |
 *                            PARSE_EVENT_FILTER_START):
*/
          if (unlikely(__pyx_v_context->_ns_stack == Py_None)) {
            PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
            __PYX_ERR(5, 400, __pyx_L9_error)
          }
          __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_context->_ns_stack, __pyx_v_declared_namespaces); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(5, 400, __pyx_L9_error)

          /* "src/lxml/saxparser.pxi":398
 *             element = None
 * 
 *         if (event_filter & PARSE_EVENT_FILTER_END_NS or             # <<<<<<<<<<<<<<
 *                 sax_event_filter & SAX_EVENT_END_NS):
 *             context._ns_stack.append(declared_namespaces)
*/
        }

        /* "src/lxml/saxparser.pxi":401
 *                 sax_event_filter & SAX_EVENT_END_NS):
 *             context._ns_stack.append(declared_namespaces)
 *         if event_filter & (PARSE_EVENT_FILTER_END |             # <<<<<<<<<<<<<<
 *                            PARSE_EVENT_FILTER_START):
 *             _pushSaxStartEvent(context, c_ctxt, c_namespace,
*/
        __pyx_t_1 = ((__pyx_v_event_filter & (__pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_END | __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_START)) != 0);
        if (__pyx_t_1) {

          /* "src/lxml/saxparser.pxi":403
 *         if event_filter & (PARSE_EVENT_FILTER_END |
 *                            PARSE_EVENT_FILTER_START):
 *             _pushSaxStartEvent(context, c_ctxt, c_namespace,             # <<<<<<<<<<<<<<
 *                                c_localname, element)
 *     except:
*/
          __pyx_t_4 = __pyx_f_4lxml_5etree__pushSaxStartEvent(__pyx_v_context, __pyx_v_c_ctxt, __pyx_v_c_namespace, __pyx_v_c_localname, __pyx_v_element); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(5, 403, __pyx_L9_error)

          /* "src/lxml/saxparser.pxi":401
 *                 sax_event_filter & SAX_EVENT_END_NS):
 *             context._ns_stack.append(declared_namespaces)
 *         if event_filter & (PARSE_EVENT_FILTER_END |             # <<<<<<<<<<<<<<
 *                            PARSE_EVENT_FILTER_START):
 *             _pushSaxStartEvent(context, c_ctxt, c_namespace,
*/
        }

        /* "src/lxml/saxparser.pxi":354
 *     cdef int event_filter = context._event_filter
 *     cdef int sax_event_filter = context._target._sax_event_filter
 *     try:             # <<<<<<<<<<<<<<
 *         if c_nb_namespaces:
 *             declared_namespaces = _build_prefix_uri_list(
*/
      }
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L14_try_end;
      __pyx_L9_error:;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "src/lxml/saxparser.pxi":405
 *             _pushSaxStartEvent(context, c_ctxt, c_namespace,
 *                                c_localname, element)
 *     except:             # <<<<<<<<<<<<<<
 *         context._handleSaxException(c_ctxt)
 *     finally:
*/
      /*except:*/ {
        __Pyx_AddTraceback("lxml.etree._handleSaxTargetStart", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_3, &__pyx_t_12) < 0) __PYX_ERR(5, 405, __pyx_L11_except_error)
        __Pyx_XGOTREF(__pyx_t_9);
        __Pyx_XGOTREF(__pyx_t_3);
        __Pyx_XGOTREF(__pyx_t_12);

        /* "src/lxml/saxparser.pxi":406
 *                                c_localname, element)
 *     except:
 *         context._handleSaxException(c_ctxt)             # <<<<<<<<<<<<<<
 *     finally:
 *         return  # swallow any further exceptions
*/
        ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->_handleSaxException(__pyx_v_context, __pyx_v_c_ctxt);
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        goto __pyx_L10_exception_handled;
      }

      /* "src/lxml/saxparser.pxi":354
 *     cdef int event_filter = context._event_filter
 *     cdef int sax_event_filter = context._target._sax_event_filter
 *     try:             # <<<<<<<<<<<<<<
 *         if c_nb_namespaces:
 *             declared_namespaces = _build_prefix_uri_list(
*/
      __pyx_L11_except_error:;
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
      goto __pyx_L7_error;
      __pyx_L10_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
      __pyx_L14_try_end:;
    }
  }

  /* "src/lxml/saxparser.pxi":408
 *         context._handleSaxException(c_ctxt)
 *     finally:
 *         return  # swallow any further exceptions             # <<<<<<<<<<<<<<
 * 
 * 
*/
  /*finally:*/ {
    /*normal exit:*/{
      goto __pyx_L0;
    }
    __pyx_L7_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_7 = 0; __pyx_t_6 = 0; __pyx_t_5 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20);
      if ( unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_6, &__pyx_t_5) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_6, &__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_18);
      __Pyx_XGOTREF(__pyx_t_19);
      __Pyx_XGOTREF(__pyx_t_20);
      {
        goto __pyx_L39_return;
      }
      __pyx_L39_return:;
      __Pyx_XGIVEREF(__pyx_t_18);
      __Pyx_XGIVEREF(__pyx_t_19);
      __Pyx_XGIVEREF(__pyx_t_20);
      __Pyx_ExceptionReset(__pyx_t_18, __pyx_t_19, __pyx_t_20);
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0;
      goto __pyx_L0;
    }
  }

  /* "src/lxml/saxparser.pxi":339
 * 
 * 
 * cdef void _handleSaxTargetStart(             # <<<<<<<<<<<<<<
 *         void* ctxt, const_xmlChar* c_localname, const_xmlChar* c_prefix,
 *         const_xmlChar* c_namespace, int c_nb_namespaces,
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_declared_namespaces);
  __Pyx_XDECREF(__pyx_v_prefix_uri_tuple);
  __Pyx_XDECREF(__pyx_v_prefix);
  __Pyx_XDECREF(__pyx_v_uri);
  __Pyx_XDECREF(__pyx_v_attrib);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XDECREF(__pyx_v_nsmap);
  __Pyx_XDECREF(__pyx_v_element);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
}

/* "src/lxml/saxparser.pxi":411
 * 
 * 
 * cdef void _handleSaxStartNoNs(void* ctxt, const_xmlChar* c_name,             # <<<<<<<<<<<<<<
 *                               const_xmlChar** c_attributes) noexcept with gil:
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
*/

static void __pyx_f_4lxml_5etree__handleSaxStartNoNs(void *__pyx_v_ctxt, const xmlChar *__pyx_v_c_name, const xmlChar **__pyx_v_c_attributes) {
  xmlParserCtxt *__pyx_v_c_ctxt;
  struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_context = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("_handleSaxStartNoNs", 0);

  /* "src/lxml/saxparser.pxi":413
 * cdef void _handleSaxStartNoNs(void* ctxt, const_xmlChar* c_name,
 *                               const_xmlChar** c_attributes) noexcept with gil:
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt             # <<<<<<<<<<<<<<
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):
 *         return
*/
  __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt);

  /* "src/lxml/saxparser.pxi":414
 *                               const_xmlChar** c_attributes) noexcept with gil:
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
*/
  __pyx_t_2 = (__pyx_v_c_ctxt->_private == NULL);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = xmlCtxtIsStopped(__pyx_v_c_ctxt);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/saxparser.pxi":415
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):
 *         return             # <<<<<<<<<<<<<<
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:
*/
    goto __pyx_L0;

    /* "src/lxml/saxparser.pxi":414
 *                               const_xmlChar** c_attributes) noexcept with gil:
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
*/
  }

  /* "src/lxml/saxparser.pxi":416
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):
 *         return
 *     context = <_SaxParserContext>c_ctxt._private             # <<<<<<<<<<<<<<
 *     try:
 *         context._origSaxStartNoNs(c_ctxt, c_name, c_attributes)
*/
  __pyx_t_3 = ((PyObject *)__pyx_v_c_ctxt->_private);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/saxparser.pxi":417
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:             # <<<<<<<<<<<<<<
 *         context._origSaxStartNoNs(c_ctxt, c_name, c_attributes)
 *         if c_ctxt.html:
*/
  /*try:*/ {
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_6);
      /*try:*/ {

        /* "src/lxml/saxparser.pxi":418
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:
 *         context._origSaxStartNoNs(c_ctxt, c_name, c_attributes)             # <<<<<<<<<<<<<<
 *         if c_ctxt.html:
 *             _fixHtmlDictNodeNames(c_ctxt.dict, c_ctxt.node)
*/
        __pyx_v_context->_origSaxStartNoNs(__pyx_v_c_ctxt, __pyx_v_c_name, __pyx_v_c_attributes);

        /* "src/lxml/saxparser.pxi":419
 *     try:
 *         context._origSaxStartNoNs(c_ctxt, c_name, c_attributes)
 *         if c_ctxt.html:             # <<<<<<<<<<<<<<
 *             _fixHtmlDictNodeNames(c_ctxt.dict, c_ctxt.node)
 *             # The HTML parser in libxml2 reports the missing opening tags when it finds
*/
        if (__pyx_v_c_ctxt->html) {

          /* "src/lxml/saxparser.pxi":420
 *         context._origSaxStartNoNs(c_ctxt, c_name, c_attributes)
 *         if c_ctxt.html:
 *             _fixHtmlDictNodeNames(c_ctxt.dict, c_ctxt.node)             # <<<<<<<<<<<<<<
 *             # The HTML parser in libxml2 reports the missing opening tags when it finds
 *             # misplaced ones, but with tag names from C string constants that ignore the
*/
          (void)(__pyx_f_4lxml_5etree__fixHtmlDictNodeNames(__pyx_v_c_ctxt->dict, __pyx_v_c_ctxt->node));

          /* "src/lxml/saxparser.pxi":424
 *             # misplaced ones, but with tag names from C string constants that ignore the
 *             # parser dict.  Thus, we need to intern the name ourselves.
 *             c_name = tree.xmlDictLookup(c_ctxt.dict, c_name, -1)             # <<<<<<<<<<<<<<
 *             if c_name is NULL:
 *                 raise MemoryError()
*/
          __pyx_v_c_name = xmlDictLookup(__pyx_v_c_ctxt->dict, __pyx_v_c_name, -1);

          /* "src/lxml/saxparser.pxi":425
 *             # parser dict.  Thus, we need to intern the name ourselves.
 *             c_name = tree.xmlDictLookup(c_ctxt.dict, c_name, -1)
 *             if c_name is NULL:             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 *         if context._event_filter & (PARSE_EVENT_FILTER_END |
*/
          __pyx_t_1 = (__pyx_v_c_name == NULL);
          if (unlikely(__pyx_t_1)) {

            /* "src/lxml/saxparser.pxi":426
 *             c_name = tree.xmlDictLookup(c_ctxt.dict, c_name, -1)
 *             if c_name is NULL:
 *                 raise MemoryError()             # <<<<<<<<<<<<<<
 *         if context._event_filter & (PARSE_EVENT_FILTER_END |
 *                                     PARSE_EVENT_FILTER_START):
*/
            PyErr_NoMemory(); __PYX_ERR(5, 426, __pyx_L9_error)

            /* "src/lxml/saxparser.pxi":425
 *             # parser dict.  Thus, we need to intern the name ourselves.
 *             c_name = tree.xmlDictLookup(c_ctxt.dict, c_name, -1)
 *             if c_name is NULL:             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 *         if context._event_filter & (PARSE_EVENT_FILTER_END |
*/
          }

          /* "src/lxml/saxparser.pxi":419
 *     try:
 *         context._origSaxStartNoNs(c_ctxt, c_name, c_attributes)
 *         if c_ctxt.html:             # <<<<<<<<<<<<<<
 *             _fixHtmlDictNodeNames(c_ctxt.dict, c_ctxt.node)
 *             # The HTML parser in libxml2 reports the missing opening tags when it finds
*/
        }

        /* "src/lxml/saxparser.pxi":427
 *             if c_name is NULL:
 *                 raise MemoryError()
 *         if context._event_filter & (PARSE_EVENT_FILTER_END |             # <<<<<<<<<<<<<<
 *                                     PARSE_EVENT_FILTER_START):
 *             _pushSaxStartEvent(context, c_ctxt, NULL, c_name, None)
*/
        __pyx_t_1 = ((__pyx_v_context->_event_filter & (__pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_END | __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_START)) != 0);
        if (__pyx_t_1) {

          /* "src/lxml/saxparser.pxi":429
 *         if context._event_filter & (PARSE_EVENT_FILTER_END |
 *                                     PARSE_EVENT_FILTER_START):
 *             _pushSaxStartEvent(context, c_ctxt, NULL, c_name, None)             # <<<<<<<<<<<<<<
 *     except:
 *         context._handleSaxException(c_ctxt)
*/
          __pyx_t_7 = __pyx_f_4lxml_5etree__pushSaxStartEvent(__pyx_v_context, __pyx_v_c_ctxt, NULL, __pyx_v_c_name, Py_None); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(5, 429, __pyx_L9_error)

          /* "src/lxml/saxparser.pxi":427
 *             if c_name is NULL:
 *                 raise MemoryError()
 *         if context._event_filter & (PARSE_EVENT_FILTER_END |             # <<<<<<<<<<<<<<
 *                                     PARSE_EVENT_FILTER_START):
 *             _pushSaxStartEvent(context, c_ctxt, NULL, c_name, None)
*/
        }

        /* "src/lxml/saxparser.pxi":417
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:             # <<<<<<<<<<<<<<
 *         context._origSaxStartNoNs(c_ctxt, c_name, c_attributes)
 *         if c_ctxt.html:
*/
      }
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L14_try_end;
      __pyx_L9_error:;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "src/lxml/saxparser.pxi":430
 *                                     PARSE_EVENT_FILTER_START):
 *             _pushSaxStartEvent(context, c_ctxt, NULL, c_name, None)
 *     except:             # <<<<<<<<<<<<<<
 *         context._handleSaxException(c_ctxt)
 *     finally:
*/
      /*except:*/ {
        __Pyx_AddTraceback("lxml.etree._handleSaxStartNoNs", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_8, &__pyx_t_9) < 0) __PYX_ERR(5, 430, __pyx_L11_except_error)
        __Pyx_XGOTREF(__pyx_t_3);
        __Pyx_XGOTREF(__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_9);

        /* "src/lxml/saxparser.pxi":431
 *             _pushSaxStartEvent(context, c_ctxt, NULL, c_name, None)
 *     except:
 *         context._handleSaxException(c_ctxt)             # <<<<<<<<<<<<<<
 *     finally:
 *         return  # swallow any further exceptions
*/
        ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->_handleSaxException(__pyx_v_context, __pyx_v_c_ctxt);
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L10_exception_handled;
      }

      /* "src/lxml/saxparser.pxi":417
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:             # <<<<<<<<<<<<<<
 *         context._origSaxStartNoNs(c_ctxt, c_name, c_attributes)
 *         if c_ctxt.html:
*/
      __pyx_L11_except_error:;
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
      goto __pyx_L7_error;
      __pyx_L10_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
      __pyx_L14_try_end:;
    }
  }

  /* "src/lxml/saxparser.pxi":433
 *         context._handleSaxException(c_ctxt)
 *     finally:
 *         return  # swallow any further exceptions             # <<<<<<<<<<<<<<
 * 
 * 
*/
  /*finally:*/ {
    /*normal exit:*/{
      goto __pyx_L0;
    }
    __pyx_L7_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_6 = 0; __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      if ( unlikely(__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4) < 0)) __Pyx_ErrFetch(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      {
        goto __pyx_L20_return;
      }
      __pyx_L20_return:;
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      goto __pyx_L0;
    }
  }

  /* "src/lxml/saxparser.pxi":411
 * 
 * 
 * cdef void _handleSaxStartNoNs(void* ctxt, const_xmlChar* c_name,             # <<<<<<<<<<<<<<
 *                               const_xmlChar** c_attributes) noexcept with gil:
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
}

/* "src/lxml/saxparser.pxi":436
 * 
 * 
 * cdef void _handleSaxTargetStartNoNs(void* ctxt, const_xmlChar* c_name,             # <<<<<<<<<<<<<<
 *                                     const_xmlChar** c_attributes) noexcept with gil:
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
*/

static void __pyx_f_4lxml_5etree__handleSaxTargetStartNoNs(void *__pyx_v_ctxt, const xmlChar *__pyx_v_c_name, const xmlChar **__pyx_v_c_attributes) {
  xmlParserCtxt *__pyx_v_c_ctxt;
  struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_context = NULL;
  PyObject *__pyx_v_attrib = NULL;
  PyObject *__pyx_v_name = NULL;
  PyObject *__pyx_v_element = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("_handleSaxTargetStartNoNs", 0);

  /* "src/lxml/saxparser.pxi":438
 * cdef void _handleSaxTargetStartNoNs(void* ctxt, const_xmlChar* c_name,
 *                                     const_xmlChar** c_attributes) noexcept with gil:
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt             # <<<<<<<<<<<<<<
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):
 *         return
*/
  __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt);

  /* "src/lxml/saxparser.pxi":439
 *                                     const_xmlChar** c_attributes) noexcept with gil:
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
*/
  __pyx_t_2 = (__pyx_v_c_ctxt->_private == NULL);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = xmlCtxtIsStopped(__pyx_v_c_ctxt);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/saxparser.pxi":440
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):
 *         return             # <<<<<<<<<<<<<<
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:
*/
    goto __pyx_L0;

    /* "src/lxml/saxparser.pxi":439
 *                                     const_xmlChar** c_attributes) noexcept with gil:
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
*/
  }

  /* "src/lxml/saxparser.pxi":441
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):
 *         return
 *     context = <_SaxParserContext>c_ctxt._private             # <<<<<<<<<<<<<<
 *     try:
 *         if c_attributes is NULL:
*/
  __pyx_t_3 = ((PyObject *)__pyx_v_c_ctxt->_private);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/saxparser.pxi":442
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:             # <<<<<<<<<<<<<<
 *         if c_attributes is NULL:
 *             attrib = IMMUTABLE_EMPTY_MAPPING
*/
  /*try:*/ {
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_6);
      /*try:*/ {

        /* "src/lxml/saxparser.pxi":443
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:
 *         if c_attributes is NULL:             # <<<<<<<<<<<<<<
 *             attrib = IMMUTABLE_EMPTY_MAPPING
 *         else:
*/
        __pyx_t_1 = (__pyx_v_c_attributes == NULL);
        if (__pyx_t_1) {

          /* "src/lxml/saxparser.pxi":444
 *     try:
 *         if c_attributes is NULL:
 *             attrib = IMMUTABLE_EMPTY_MAPPING             # <<<<<<<<<<<<<<
 *         else:
 *             attrib = {}
*/
          __Pyx_INCREF(__pyx_v_4lxml_5etree_IMMUTABLE_EMPTY_MAPPING);
          __pyx_v_attrib = __pyx_v_4lxml_5etree_IMMUTABLE_EMPTY_MAPPING;

          /* "src/lxml/saxparser.pxi":443
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:
 *         if c_attributes is NULL:             # <<<<<<<<<<<<<<
 *             attrib = IMMUTABLE_EMPTY_MAPPING
 *         else:
*/
          goto __pyx_L15;
        }

        /* "src/lxml/saxparser.pxi":446
 *             attrib = IMMUTABLE_EMPTY_MAPPING
 *         else:
 *             attrib = {}             # <<<<<<<<<<<<<<
 *             while c_attributes[0] is not NULL:
 *                 name = funicode(c_attributes[0])
*/
        /*else*/ {
          __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 446, __pyx_L9_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_v_attrib = __pyx_t_3;
          __pyx_t_3 = 0;

          /* "src/lxml/saxparser.pxi":447
 *         else:
 *             attrib = {}
 *             while c_attributes[0] is not NULL:             # <<<<<<<<<<<<<<
 *                 name = funicode(c_attributes[0])
 *                 attrib[name] = funicodeOrEmpty(c_attributes[1])
*/
          while (1) {
            __pyx_t_1 = ((__pyx_v_c_attributes[0]) != NULL);
            if (!__pyx_t_1) break;

            /* "src/lxml/saxparser.pxi":448
 *             attrib = {}
 *             while c_attributes[0] is not NULL:
 *                 name = funicode(c_attributes[0])             # <<<<<<<<<<<<<<
 *                 attrib[name] = funicodeOrEmpty(c_attributes[1])
 *                 c_attributes += 2
*/
            __pyx_t_3 = __pyx_f_4lxml_5etree_funicode((__pyx_v_c_attributes[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 448, __pyx_L9_error)
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_XDECREF_SET(__pyx_v_name, ((PyObject*)__pyx_t_3));
            __pyx_t_3 = 0;

            /* "src/lxml/saxparser.pxi":449
 *             while c_attributes[0] is not NULL:
 *                 name = funicode(c_attributes[0])
 *                 attrib[name] = funicodeOrEmpty(c_attributes[1])             # <<<<<<<<<<<<<<
 *                 c_attributes += 2
 *         element = _callTargetSaxStart(
*/
            __pyx_t_3 = __pyx_f_4lxml_5etree_funicodeOrEmpty((__pyx_v_c_attributes[1])); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 449, __pyx_L9_error)
            __Pyx_GOTREF(__pyx_t_3);
            if (unlikely((PyObject_SetItem(__pyx_v_attrib, __pyx_v_name, __pyx_t_3) < 0))) __PYX_ERR(5, 449, __pyx_L9_error)
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

            /* "src/lxml/saxparser.pxi":450
 *                 name = funicode(c_attributes[0])
 *                 attrib[name] = funicodeOrEmpty(c_attributes[1])
 *                 c_attributes += 2             # <<<<<<<<<<<<<<
 *         element = _callTargetSaxStart(
 *             context, c_ctxt, funicode(c_name),
*/
            __pyx_v_c_attributes = (__pyx_v_c_attributes + 2);
          }
        }
        __pyx_L15:;

        /* "src/lxml/saxparser.pxi":452
 *                 c_attributes += 2
 *         element = _callTargetSaxStart(
 *             context, c_ctxt, funicode(c_name),             # <<<<<<<<<<<<<<
 *             attrib, IMMUTABLE_EMPTY_MAPPING)
 *         if context._event_filter & (PARSE_EVENT_FILTER_END |
*/
        __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 452, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_3);

        /* "src/lxml/saxparser.pxi":453
 *         element = _callTargetSaxStart(
 *             context, c_ctxt, funicode(c_name),
 *             attrib, IMMUTABLE_EMPTY_MAPPING)             # <<<<<<<<<<<<<<
 *         if context._event_filter & (PARSE_EVENT_FILTER_END |
 *                                     PARSE_EVENT_FILTER_START):
*/
        __pyx_t_7 = __pyx_v_4lxml_5etree_IMMUTABLE_EMPTY_MAPPING;
        __Pyx_INCREF(__pyx_t_7);

        /* "src/lxml/saxparser.pxi":451
 *                 attrib[name] = funicodeOrEmpty(c_attributes[1])
 *                 c_attributes += 2
 *         element = _callTargetSaxStart(             # <<<<<<<<<<<<<<
 *             context, c_ctxt, funicode(c_name),
 *             attrib, IMMUTABLE_EMPTY_MAPPING)
*/
        __pyx_t_8 = __pyx_f_4lxml_5etree__callTargetSaxStart(__pyx_v_context, __pyx_v_c_ctxt, __pyx_t_3, __pyx_v_attrib, __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 451, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_element = __pyx_t_8;
        __pyx_t_8 = 0;

        /* "src/lxml/saxparser.pxi":454
 *             context, c_ctxt, funicode(c_name),
 *             attrib, IMMUTABLE_EMPTY_MAPPING)
 *         if context._event_filter & (PARSE_EVENT_FILTER_END |             # <<<<<<<<<<<<<<
 *                                     PARSE_EVENT_FILTER_START):
 *             _pushSaxStartEvent(context, c_ctxt, NULL, c_name, element)
*/
        __pyx_t_1 = ((__pyx_v_context->_event_filter & (__pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_END | __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_START)) != 0);
        if (__pyx_t_1) {

          /* "src/lxml/saxparser.pxi":456
 *         if context._event_filter & (PARSE_EVENT_FILTER_END |
 *                                     PARSE_EVENT_FILTER_START):
 *             _pushSaxStartEvent(context, c_ctxt, NULL, c_name, element)             # <<<<<<<<<<<<<<
 *     except:
 *         context._handleSaxException(c_ctxt)
*/
          __pyx_t_9 = __pyx_f_4lxml_5etree__pushSaxStartEvent(__pyx_v_context, __pyx_v_c_ctxt, NULL, __pyx_v_c_name, __pyx_v_element); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(5, 456, __pyx_L9_error)

          /* "src/lxml/saxparser.pxi":454
 *             context, c_ctxt, funicode(c_name),
 *             attrib, IMMUTABLE_EMPTY_MAPPING)
 *         if context._event_filter & (PARSE_EVENT_FILTER_END |             # <<<<<<<<<<<<<<
 *                                     PARSE_EVENT_FILTER_START):
 *             _pushSaxStartEvent(context, c_ctxt, NULL, c_name, element)
*/
        }

        /* "src/lxml/saxparser.pxi":442
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:             # <<<<<<<<<<<<<<
 *         if c_attributes is NULL:
 *             attrib = IMMUTABLE_EMPTY_MAPPING
*/
      }
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L14_try_end;
      __pyx_L9_error:;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "src/lxml/saxparser.pxi":457
 *                                     PARSE_EVENT_FILTER_START):
 *             _pushSaxStartEvent(context, c_ctxt, NULL, c_name, element)
 *     except:             # <<<<<<<<<<<<<<
 *         context._handleSaxException(c_ctxt)
 *     finally:
*/
      /*except:*/ {
        __Pyx_AddTraceback("lxml.etree._handleSaxTargetStartNoNs", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_7, &__pyx_t_3) < 0) __PYX_ERR(5, 457, __pyx_L11_except_error)
        __Pyx_XGOTREF(__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_3);

        /* "src/lxml/saxparser.pxi":458
 *             _pushSaxStartEvent(context, c_ctxt, NULL, c_name, element)
 *     except:
 *         context._handleSaxException(c_ctxt)             # <<<<<<<<<<<<<<
 *     finally:
 *         return  # swallow any further exceptions
*/
        ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->_handleSaxException(__pyx_v_context, __pyx_v_c_ctxt);
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        goto __pyx_L10_exception_handled;
      }

      /* "src/lxml/saxparser.pxi":442
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:             # <<<<<<<<<<<<<<
 *         if c_attributes is NULL:
 *             attrib = IMMUTABLE_EMPTY_MAPPING
*/
      __pyx_L11_except_error:;
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
      goto __pyx_L7_error;
      __pyx_L10_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
      __pyx_L14_try_end:;
    }
  }

  /* "src/lxml/saxparser.pxi":460
 *         context._handleSaxException(c_ctxt)
 *     finally:
 *         return  # swallow any further exceptions             # <<<<<<<<<<<<<<
 * 
 * 
*/
  /*finally:*/ {
    /*normal exit:*/{
      goto __pyx_L0;
    }
    __pyx_L7_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_6 = 0; __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      if ( unlikely(__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4) < 0)) __Pyx_ErrFetch(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      {
        goto __pyx_L21_return;
      }
      __pyx_L21_return:;
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      goto __pyx_L0;
    }
  }

  /* "src/lxml/saxparser.pxi":436
 * 
 * 
 * cdef void _handleSaxTargetStartNoNs(void* ctxt, const_xmlChar* c_name,             # <<<<<<<<<<<<<<
 *                                     const_xmlChar** c_attributes) noexcept with gil:
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_attrib);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_element);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
}

/* "src/lxml/saxparser.pxi":463
 * 
 * 
 * cdef _callTargetSaxStart(_SaxParserContext context,             # <<<<<<<<<<<<<<
 *                          xmlparser.xmlParserCtxt* c_ctxt,
 *                          tag, attrib, nsmap):
*/

static PyObject *__pyx_f_4lxml_5etree__callTargetSaxStart(struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_context, xmlParserCtxt *__pyx_v_c_ctxt, PyObject *__pyx_v_tag, PyObject *__pyx_v_attrib, PyObject *__pyx_v_nsmap) {
  PyObject *__pyx_v_element = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  unsigned short __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_callTargetSaxStart", 0);

  /* "src/lxml/saxparser.pxi":466
 *                          xmlparser.xmlParserCtxt* c_ctxt,
 *                          tag, attrib, nsmap):
 *     element = context._target._handleSaxStart(tag, attrib, nsmap)             # <<<<<<<<<<<<<<
 *     if element is not None and c_ctxt.input is not NULL:
 *         if isinstance(element, _Element):
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserTarget *)__pyx_v_context->_target->__pyx_vtab)->_handleSaxStart(__pyx_v_context->_target, __pyx_v_tag, __pyx_v_attrib, __pyx_v_nsmap); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 466, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_element = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "src/lxml/saxparser.pxi":467
 *                          tag, attrib, nsmap):
 *     element = context._target._handleSaxStart(tag, attrib, nsmap)
 *     if element is not None and c_ctxt.input is not NULL:             # <<<<<<<<<<<<<<
 *         if isinstance(element, _Element):
 *             (<_Element>element)._c_node.line = (
*/
  __pyx_t_3 = (__pyx_v_element != Py_None);
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_c_ctxt->input != NULL);
  __pyx_t_2 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "src/lxml/saxparser.pxi":468
 *     element = context._target._handleSaxStart(tag, attrib, nsmap)
 *     if element is not None and c_ctxt.input is not NULL:
 *         if isinstance(element, _Element):             # <<<<<<<<<<<<<<
 *             (<_Element>element)._c_node.line = (
 *                 <unsigned short>c_ctxt.input.line
*/
    __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_element, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element); 
    if (__pyx_t_2) {

      /* "src/lxml/saxparser.pxi":471
 *             (<_Element>element)._c_node.line = (
 *                 <unsigned short>c_ctxt.input.line
 *                 if c_ctxt.input.line < 65535 else 65535)             # <<<<<<<<<<<<<<
 *     return element
 * 
*/
      __pyx_t_2 = (__pyx_v_c_ctxt->input->line < 0xFFFF);
      if (__pyx_t_2) {

        /* "src/lxml/saxparser.pxi":470
 *         if isinstance(element, _Element):
 *             (<_Element>element)._c_node.line = (
 *                 <unsigned short>c_ctxt.input.line             # <<<<<<<<<<<<<<
 *                 if c_ctxt.input.line < 65535 else 65535)
 *     return element
*/
        __pyx_t_4 = ((unsigned short)__pyx_v_c_ctxt->input->line);
      } else {
        __pyx_t_4 = 0xFFFF;
      }

      /* "src/lxml/saxparser.pxi":469
 *     if element is not None and c_ctxt.input is not NULL:
 *         if isinstance(element, _Element):
 *             (<_Element>element)._c_node.line = (             # <<<<<<<<<<<<<<
 *                 <unsigned short>c_ctxt.input.line
 *                 if c_ctxt.input.line < 65535 else 65535)
*/
      ((struct LxmlElement *)__pyx_v_element)->_c_node->line = __pyx_t_4;

      /* "src/lxml/saxparser.pxi":468
 *     element = context._target._handleSaxStart(tag, attrib, nsmap)
 *     if element is not None and c_ctxt.input is not NULL:
 *         if isinstance(element, _Element):             # <<<<<<<<<<<<<<
 *             (<_Element>element)._c_node.line = (
 *                 <unsigned short>c_ctxt.input.line
*/
    }

    /* "src/lxml/saxparser.pxi":467
 *                          tag, attrib, nsmap):
 *     element = context._target._handleSaxStart(tag, attrib, nsmap)
 *     if element is not None and c_ctxt.input is not NULL:             # <<<<<<<<<<<<<<
 *         if isinstance(element, _Element):
 *             (<_Element>element)._c_node.line = (
*/
  }

  /* "src/lxml/saxparser.pxi":472
 *                 <unsigned short>c_ctxt.input.line
 *                 if c_ctxt.input.line < 65535 else 65535)
 *     return element             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_element);
  __pyx_r = __pyx_v_element;
  goto __pyx_L0;

  /* "src/lxml/saxparser.pxi":463
 * 
 * 
 * cdef _callTargetSaxStart(_SaxParserContext context,             # <<<<<<<<<<<<<<
 *                          xmlparser.xmlParserCtxt* c_ctxt,
 *                          tag, attrib, nsmap):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._callTargetSaxStart", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_element);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/saxparser.pxi":475
 * 
 * 
 * cdef int _pushSaxStartEvent(_SaxParserContext context,             # <<<<<<<<<<<<<<
 *                             xmlparser.xmlParserCtxt* c_ctxt,
 *                             const_xmlChar* c_href,
*/

static int __pyx_f_4lxml_5etree__pushSaxStartEvent(struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_context, xmlParserCtxt *__pyx_v_c_ctxt, const xmlChar *__pyx_v_c_href, const xmlChar *__pyx_v_c_name, PyObject *__pyx_v_node) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_pushSaxStartEvent", 0);
  __Pyx_INCREF(__pyx_v_node);

  /* "src/lxml/saxparser.pxi":479
 *                             const_xmlChar* c_href,
 *                             const_xmlChar* c_name, node) except -1:
 *     if (context._matcher is None or             # <<<<<<<<<<<<<<
 *             context._matcher.matchesNsTag(c_href, c_name)):
 *         if node is None and context._target is None:
*/
  __pyx_t_2 = (((PyObject *)__pyx_v_context->_matcher) == Py_None);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }

  /* "src/lxml/saxparser.pxi":480
 *                             const_xmlChar* c_name, node) except -1:
 *     if (context._matcher is None or
 *             context._matcher.matchesNsTag(c_href, c_name)):             # <<<<<<<<<<<<<<
 *         if node is None and context._target is None:
 *             assert context._doc is not None
*/
  __pyx_t_2 = __pyx_f_4lxml_5etree_16_MultiTagMatcher_matchesNsTag(__pyx_v_context->_matcher, __pyx_v_c_href, __pyx_v_c_name);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;

  /* "src/lxml/saxparser.pxi":479
 *                             const_xmlChar* c_href,
 *                             const_xmlChar* c_name, node) except -1:
 *     if (context._matcher is None or             # <<<<<<<<<<<<<<
 *             context._matcher.matchesNsTag(c_href, c_name)):
 *         if node is None and context._target is None:
*/
  if (__pyx_t_1) {

    /* "src/lxml/saxparser.pxi":481
 *     if (context._matcher is None or
 *             context._matcher.matchesNsTag(c_href, c_name)):
 *         if node is None and context._target is None:             # <<<<<<<<<<<<<<
 *             assert context._doc is not None
 *             node = _elementFactory(context._doc, c_ctxt.node)
*/
    __pyx_t_2 = (__pyx_v_node == Py_None);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_2 = (((PyObject *)__pyx_v_context->_target) == Py_None);
    __pyx_t_1 = __pyx_t_2;
    __pyx_L7_bool_binop_done:;
    if (__pyx_t_1) {

      /* "src/lxml/saxparser.pxi":482
 *             context._matcher.matchesNsTag(c_href, c_name)):
 *         if node is None and context._target is None:
 *             assert context._doc is not None             # <<<<<<<<<<<<<<
 *             node = _elementFactory(context._doc, c_ctxt.node)
 *         if context._event_filter & PARSE_EVENT_FILTER_START:
*/
      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(__pyx_assertions_enabled())) {
        __pyx_t_1 = (((PyObject *)__pyx_v_context->__pyx_base._doc) != Py_None);
        if (unlikely(!__pyx_t_1)) {
          __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
          __PYX_ERR(5, 482, __pyx_L1_error)
        }
      }
      #else
      if ((1)); else __PYX_ERR(5, 482, __pyx_L1_error)
      #endif

      /* "src/lxml/saxparser.pxi":483
 *         if node is None and context._target is None:
 *             assert context._doc is not None
 *             node = _elementFactory(context._doc, c_ctxt.node)             # <<<<<<<<<<<<<<
 *         if context._event_filter & PARSE_EVENT_FILTER_START:
 *             context.events_iterator._events.append(('start', node))
*/
      __pyx_t_3 = ((PyObject *)__pyx_v_context->__pyx_base._doc);
      __Pyx_INCREF(__pyx_t_3);
      __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_3), __pyx_v_c_ctxt->node)); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 483, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF_SET(__pyx_v_node, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "src/lxml/saxparser.pxi":481
 *     if (context._matcher is None or
 *             context._matcher.matchesNsTag(c_href, c_name)):
 *         if node is None and context._target is None:             # <<<<<<<<<<<<<<
 *             assert context._doc is not None
 *             node = _elementFactory(context._doc, c_ctxt.node)
*/
    }

    /* "src/lxml/saxparser.pxi":484
 *             assert context._doc is not None
 *             node = _elementFactory(context._doc, c_ctxt.node)
 *         if context._event_filter & PARSE_EVENT_FILTER_START:             # <<<<<<<<<<<<<<
 *             context.events_iterator._events.append(('start', node))
 *         if (context._target is None and
*/
    __pyx_t_1 = ((__pyx_v_context->_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_START) != 0);
    if (__pyx_t_1) {

      /* "src/lxml/saxparser.pxi":485
 *             node = _elementFactory(context._doc, c_ctxt.node)
 *         if context._event_filter & PARSE_EVENT_FILTER_START:
 *             context.events_iterator._events.append(('start', node))             # <<<<<<<<<<<<<<
 *         if (context._target is None and
 *                 context._event_filter & PARSE_EVENT_FILTER_END):
*/
      if (unlikely(__pyx_v_context->events_iterator->_events == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
        __PYX_ERR(5, 485, __pyx_L1_error)
      }
      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 485, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_start);
      __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_start);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_mstate_global->__pyx_n_u_start) != (0)) __PYX_ERR(5, 485, __pyx_L1_error);
      __Pyx_INCREF(__pyx_v_node);
      __Pyx_GIVEREF(__pyx_v_node);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_node) != (0)) __PYX_ERR(5, 485, __pyx_L1_error);
      __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_context->events_iterator->_events, __pyx_t_4); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(5, 485, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "src/lxml/saxparser.pxi":484
 *             assert context._doc is not None
 *             node = _elementFactory(context._doc, c_ctxt.node)
 *         if context._event_filter & PARSE_EVENT_FILTER_START:             # <<<<<<<<<<<<<<
 *             context.events_iterator._events.append(('start', node))
 *         if (context._target is None and
*/
    }

    /* "src/lxml/saxparser.pxi":486
 *         if context._event_filter & PARSE_EVENT_FILTER_START:
 *             context.events_iterator._events.append(('start', node))
 *         if (context._target is None and             # <<<<<<<<<<<<<<
 *                 context._event_filter & PARSE_EVENT_FILTER_END):
 *             context._node_stack.append(node)
*/
    __pyx_t_2 = (((PyObject *)__pyx_v_context->_target) == Py_None);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L11_bool_binop_done;
    }

    /* "src/lxml/saxparser.pxi":487
 *             context.events_iterator._events.append(('start', node))
 *         if (context._target is None and
 *                 context._event_filter & PARSE_EVENT_FILTER_END):             # <<<<<<<<<<<<<<
 *             context._node_stack.append(node)
 *     return 0
*/
    __pyx_t_2 = ((__pyx_v_context->_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_END) != 0);
    __pyx_t_1 = __pyx_t_2;
    __pyx_L11_bool_binop_done:;

    /* "src/lxml/saxparser.pxi":486
 *         if context._event_filter & PARSE_EVENT_FILTER_START:
 *             context.events_iterator._events.append(('start', node))
 *         if (context._target is None and             # <<<<<<<<<<<<<<
 *                 context._event_filter & PARSE_EVENT_FILTER_END):
 *             context._node_stack.append(node)
*/
    if (__pyx_t_1) {

      /* "src/lxml/saxparser.pxi":488
 *         if (context._target is None and
 *                 context._event_filter & PARSE_EVENT_FILTER_END):
 *             context._node_stack.append(node)             # <<<<<<<<<<<<<<
 *     return 0
 * 
*/
      if (unlikely(__pyx_v_context->_node_stack == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
        __PYX_ERR(5, 488, __pyx_L1_error)
      }
      __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_context->_node_stack, __pyx_v_node); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(5, 488, __pyx_L1_error)

      /* "src/lxml/saxparser.pxi":486
 *         if context._event_filter & PARSE_EVENT_FILTER_START:
 *             context.events_iterator._events.append(('start', node))
 *         if (context._target is None and             # <<<<<<<<<<<<<<
 *                 context._event_filter & PARSE_EVENT_FILTER_END):
 *             context._node_stack.append(node)
*/
    }

    /* "src/lxml/saxparser.pxi":479
 *                             const_xmlChar* c_href,
 *                             const_xmlChar* c_name, node) except -1:
 *     if (context._matcher is None or             # <<<<<<<<<<<<<<
 *             context._matcher.matchesNsTag(c_href, c_name)):
 *         if node is None and context._target is None:
*/
  }

  /* "src/lxml/saxparser.pxi":489
 *                 context._event_filter & PARSE_EVENT_FILTER_END):
 *             context._node_stack.append(node)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/saxparser.pxi":475
 * 
 * 
 * cdef int _pushSaxStartEvent(_SaxParserContext context,             # <<<<<<<<<<<<<<
 *                             xmlparser.xmlParserCtxt* c_ctxt,
 *                             const_xmlChar* c_href,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._pushSaxStartEvent", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_node);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/saxparser.pxi":492
 * 
 * 
 * cdef void _handleSaxEnd(void* ctxt, const_xmlChar* c_localname,             # <<<<<<<<<<<<<<
 *                         const_xmlChar* c_prefix,
 *                         const_xmlChar* c_namespace) noexcept with gil:
*/

static void __pyx_f_4lxml_5etree__handleSaxEnd(void *__pyx_v_ctxt, const xmlChar *__pyx_v_c_localname, const xmlChar *__pyx_v_c_prefix, const xmlChar *__pyx_v_c_namespace) {
  xmlParserCtxt *__pyx_v_c_ctxt;
  struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_context = NULL;
  PyObject *__pyx_v_node = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("_handleSaxEnd", 0);

  /* "src/lxml/saxparser.pxi":495
 *                         const_xmlChar* c_prefix,
 *                         const_xmlChar* c_namespace) noexcept with gil:
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt             # <<<<<<<<<<<<<<
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):
 *         return
*/
  __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt);

  /* "src/lxml/saxparser.pxi":496
 *                         const_xmlChar* c_namespace) noexcept with gil:
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
*/
  __pyx_t_2 = (__pyx_v_c_ctxt->_private == NULL);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = xmlCtxtIsStopped(__pyx_v_c_ctxt);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/saxparser.pxi":497
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):
 *         return             # <<<<<<<<<<<<<<
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:
*/
    goto __pyx_L0;

    /* "src/lxml/saxparser.pxi":496
 *                         const_xmlChar* c_namespace) noexcept with gil:
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
*/
  }

  /* "src/lxml/saxparser.pxi":498
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):
 *         return
 *     context = <_SaxParserContext>c_ctxt._private             # <<<<<<<<<<<<<<
 *     try:
 *         if context._target is not None:
*/
  __pyx_t_3 = ((PyObject *)__pyx_v_c_ctxt->_private);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/saxparser.pxi":499
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:             # <<<<<<<<<<<<<<
 *         if context._target is not None:
 *             if context._target._sax_event_filter & SAX_EVENT_END:
*/
  /*try:*/ {
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_6);
      /*try:*/ {

        /* "src/lxml/saxparser.pxi":500
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:
 *         if context._target is not None:             # <<<<<<<<<<<<<<
 *             if context._target._sax_event_filter & SAX_EVENT_END:
 *                 node = context._target._handleSaxEnd(
*/
        __pyx_t_1 = (((PyObject *)__pyx_v_context->_target) != Py_None);
        if (__pyx_t_1) {

          /* "src/lxml/saxparser.pxi":501
 *     try:
 *         if context._target is not None:
 *             if context._target._sax_event_filter & SAX_EVENT_END:             # <<<<<<<<<<<<<<
 *                 node = context._target._handleSaxEnd(
 *                     _namespacedNameFromNsName(c_namespace, c_localname))
*/
          __pyx_t_1 = ((__pyx_v_context->_target->_sax_event_filter & __pyx_e_4lxml_5etree_SAX_EVENT_END) != 0);
          if (__pyx_t_1) {

            /* "src/lxml/saxparser.pxi":503
 *             if context._target._sax_event_filter & SAX_EVENT_END:
 *                 node = context._target._handleSaxEnd(
 *                     _namespacedNameFromNsName(c_namespace, c_localname))             # <<<<<<<<<<<<<<
 *             else:
 *                 node = None
*/
            __pyx_t_3 = __pyx_f_4lxml_5etree__namespacedNameFromNsName(__pyx_v_c_namespace, __pyx_v_c_localname); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 503, __pyx_L9_error)
            __Pyx_GOTREF(__pyx_t_3);

            /* "src/lxml/saxparser.pxi":502
 *         if context._target is not None:
 *             if context._target._sax_event_filter & SAX_EVENT_END:
 *                 node = context._target._handleSaxEnd(             # <<<<<<<<<<<<<<
 *                     _namespacedNameFromNsName(c_namespace, c_localname))
 *             else:
*/
            __pyx_t_7 = ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserTarget *)__pyx_v_context->_target->__pyx_vtab)->_handleSaxEnd(__pyx_v_context->_target, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 502, __pyx_L9_error)
            __Pyx_GOTREF(__pyx_t_7);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            __pyx_v_node = __pyx_t_7;
            __pyx_t_7 = 0;

            /* "src/lxml/saxparser.pxi":501
 *     try:
 *         if context._target is not None:
 *             if context._target._sax_event_filter & SAX_EVENT_END:             # <<<<<<<<<<<<<<
 *                 node = context._target._handleSaxEnd(
 *                     _namespacedNameFromNsName(c_namespace, c_localname))
*/
            goto __pyx_L16;
          }

          /* "src/lxml/saxparser.pxi":505
 *                     _namespacedNameFromNsName(c_namespace, c_localname))
 *             else:
 *                 node = None             # <<<<<<<<<<<<<<
 *         else:
 *             context._origSaxEnd(c_ctxt, c_localname, c_prefix, c_namespace)
*/
          /*else*/ {
            __Pyx_INCREF(Py_None);
            __pyx_v_node = Py_None;
          }
          __pyx_L16:;

          /* "src/lxml/saxparser.pxi":500
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:
 *         if context._target is not None:             # <<<<<<<<<<<<<<
 *             if context._target._sax_event_filter & SAX_EVENT_END:
 *                 node = context._target._handleSaxEnd(
*/
          goto __pyx_L15;
        }

        /* "src/lxml/saxparser.pxi":507
 *                 node = None
 *         else:
 *             context._origSaxEnd(c_ctxt, c_localname, c_prefix, c_namespace)             # <<<<<<<<<<<<<<
 *             node = None
 *         _pushSaxEndEvent(context, c_namespace, c_localname, node)
*/
        /*else*/ {
          __pyx_v_context->_origSaxEnd(__pyx_v_c_ctxt, __pyx_v_c_localname, __pyx_v_c_prefix, __pyx_v_c_namespace);

          /* "src/lxml/saxparser.pxi":508
 *         else:
 *             context._origSaxEnd(c_ctxt, c_localname, c_prefix, c_namespace)
 *             node = None             # <<<<<<<<<<<<<<
 *         _pushSaxEndEvent(context, c_namespace, c_localname, node)
 *         _pushSaxNsEndEvents(context)
*/
          __Pyx_INCREF(Py_None);
          __pyx_v_node = Py_None;
        }
        __pyx_L15:;

        /* "src/lxml/saxparser.pxi":509
 *             context._origSaxEnd(c_ctxt, c_localname, c_prefix, c_namespace)
 *             node = None
 *         _pushSaxEndEvent(context, c_namespace, c_localname, node)             # <<<<<<<<<<<<<<
 *         _pushSaxNsEndEvents(context)
 *     except:
*/
        __pyx_t_8 = __pyx_f_4lxml_5etree__pushSaxEndEvent(__pyx_v_context, __pyx_v_c_namespace, __pyx_v_c_localname, __pyx_v_node); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(5, 509, __pyx_L9_error)

        /* "src/lxml/saxparser.pxi":510
 *             node = None
 *         _pushSaxEndEvent(context, c_namespace, c_localname, node)
 *         _pushSaxNsEndEvents(context)             # <<<<<<<<<<<<<<
 *     except:
 *         context._handleSaxException(c_ctxt)
*/
        __pyx_t_8 = __pyx_f_4lxml_5etree__pushSaxNsEndEvents(__pyx_v_context); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(5, 510, __pyx_L9_error)

        /* "src/lxml/saxparser.pxi":499
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:             # <<<<<<<<<<<<<<
 *         if context._target is not None:
 *             if context._target._sax_event_filter & SAX_EVENT_END:
*/
      }
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L14_try_end;
      __pyx_L9_error:;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "src/lxml/saxparser.pxi":511
 *         _pushSaxEndEvent(context, c_namespace, c_localname, node)
 *         _pushSaxNsEndEvents(context)
 *     except:             # <<<<<<<<<<<<<<
 *         context._handleSaxException(c_ctxt)
 *     finally:
*/
      /*except:*/ {
        __Pyx_AddTraceback("lxml.etree._handleSaxEnd", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_3, &__pyx_t_9) < 0) __PYX_ERR(5, 511, __pyx_L11_except_error)
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_3);
        __Pyx_XGOTREF(__pyx_t_9);

        /* "src/lxml/saxparser.pxi":512
 *         _pushSaxNsEndEvents(context)
 *     except:
 *         context._handleSaxException(c_ctxt)             # <<<<<<<<<<<<<<
 *     finally:
 *         return  # swallow any further exceptions
*/
        ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->_handleSaxException(__pyx_v_context, __pyx_v_c_ctxt);
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L10_exception_handled;
      }

      /* "src/lxml/saxparser.pxi":499
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:             # <<<<<<<<<<<<<<
 *         if context._target is not None:
 *             if context._target._sax_event_filter & SAX_EVENT_END:
*/
      __pyx_L11_except_error:;
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
      goto __pyx_L7_error;
      __pyx_L10_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
      __pyx_L14_try_end:;
    }
  }

  /* "src/lxml/saxparser.pxi":514
 *         context._handleSaxException(c_ctxt)
 *     finally:
 *         return  # swallow any further exceptions             # <<<<<<<<<<<<<<
 * 
 * 
*/
  /*finally:*/ {
    /*normal exit:*/{
      goto __pyx_L0;
    }
    __pyx_L7_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_6 = 0; __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      if ( unlikely(__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4) < 0)) __Pyx_ErrFetch(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      {
        goto __pyx_L19_return;
      }
      __pyx_L19_return:;
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      goto __pyx_L0;
    }
  }

  /* "src/lxml/saxparser.pxi":492
 * 
 * 
 * cdef void _handleSaxEnd(void* ctxt, const_xmlChar* c_localname,             # <<<<<<<<<<<<<<
 *                         const_xmlChar* c_prefix,
 *                         const_xmlChar* c_namespace) noexcept with gil:
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_node);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
}

/* "src/lxml/saxparser.pxi":517
 * 
 * 
 * cdef void _handleSaxEndNoNs(void* ctxt, const_xmlChar* c_name) noexcept with gil:             # <<<<<<<<<<<<<<
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):
*/

static void __pyx_f_4lxml_5etree__handleSaxEndNoNs(void *__pyx_v_ctxt, const xmlChar *__pyx_v_c_name) {
  xmlParserCtxt *__pyx_v_c_ctxt;
  struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_context = NULL;
  PyObject *__pyx_v_node = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("_handleSaxEndNoNs", 0);

  /* "src/lxml/saxparser.pxi":518
 * 
 * cdef void _handleSaxEndNoNs(void* ctxt, const_xmlChar* c_name) noexcept with gil:
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt             # <<<<<<<<<<<<<<
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):
 *         return
*/
  __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt);

  /* "src/lxml/saxparser.pxi":519
 * cdef void _handleSaxEndNoNs(void* ctxt, const_xmlChar* c_name) noexcept with gil:
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
*/
  __pyx_t_2 = (__pyx_v_c_ctxt->_private == NULL);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = xmlCtxtIsStopped(__pyx_v_c_ctxt);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/saxparser.pxi":520
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):
 *         return             # <<<<<<<<<<<<<<
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:
*/
    goto __pyx_L0;

    /* "src/lxml/saxparser.pxi":519
 * cdef void _handleSaxEndNoNs(void* ctxt, const_xmlChar* c_name) noexcept with gil:
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
*/
  }

  /* "src/lxml/saxparser.pxi":521
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):
 *         return
 *     context = <_SaxParserContext>c_ctxt._private             # <<<<<<<<<<<<<<
 *     try:
 *         if context._target is not None:
*/
  __pyx_t_3 = ((PyObject *)__pyx_v_c_ctxt->_private);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/saxparser.pxi":522
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:             # <<<<<<<<<<<<<<
 *         if context._target is not None:
 *             node = context._target._handleSaxEnd(funicode(c_name))
*/
  /*try:*/ {
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_6);
      /*try:*/ {

        /* "src/lxml/saxparser.pxi":523
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:
 *         if context._target is not None:             # <<<<<<<<<<<<<<
 *             node = context._target._handleSaxEnd(funicode(c_name))
 *         else:
*/
        __pyx_t_1 = (((PyObject *)__pyx_v_context->_target) != Py_None);
        if (__pyx_t_1) {

          /* "src/lxml/saxparser.pxi":524
 *     try:
 *         if context._target is not None:
 *             node = context._target._handleSaxEnd(funicode(c_name))             # <<<<<<<<<<<<<<
 *         else:
 *             context._origSaxEndNoNs(c_ctxt, c_name)
*/
          __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 524, __pyx_L9_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_7 = ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserTarget *)__pyx_v_context->_target->__pyx_vtab)->_handleSaxEnd(__pyx_v_context->_target, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 524, __pyx_L9_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_v_node = __pyx_t_7;
          __pyx_t_7 = 0;

          /* "src/lxml/saxparser.pxi":523
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:
 *         if context._target is not None:             # <<<<<<<<<<<<<<
 *             node = context._target._handleSaxEnd(funicode(c_name))
 *         else:
*/
          goto __pyx_L15;
        }

        /* "src/lxml/saxparser.pxi":526
 *             node = context._target._handleSaxEnd(funicode(c_name))
 *         else:
 *             context._origSaxEndNoNs(c_ctxt, c_name)             # <<<<<<<<<<<<<<
 *             node = None
 *         _pushSaxEndEvent(context, NULL, c_name, node)
*/
        /*else*/ {
          __pyx_v_context->_origSaxEndNoNs(__pyx_v_c_ctxt, __pyx_v_c_name);

          /* "src/lxml/saxparser.pxi":527
 *         else:
 *             context._origSaxEndNoNs(c_ctxt, c_name)
 *             node = None             # <<<<<<<<<<<<<<
 *         _pushSaxEndEvent(context, NULL, c_name, node)
 *     except:
*/
          __Pyx_INCREF(Py_None);
          __pyx_v_node = Py_None;
        }
        __pyx_L15:;

        /* "src/lxml/saxparser.pxi":528
 *             context._origSaxEndNoNs(c_ctxt, c_name)
 *             node = None
 *         _pushSaxEndEvent(context, NULL, c_name, node)             # <<<<<<<<<<<<<<
 *     except:
 *         context._handleSaxException(c_ctxt)
*/
        __pyx_t_8 = __pyx_f_4lxml_5etree__pushSaxEndEvent(__pyx_v_context, NULL, __pyx_v_c_name, __pyx_v_node); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(5, 528, __pyx_L9_error)

        /* "src/lxml/saxparser.pxi":522
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:             # <<<<<<<<<<<<<<
 *         if context._target is not None:
 *             node = context._target._handleSaxEnd(funicode(c_name))
*/
      }
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L14_try_end;
      __pyx_L9_error:;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "src/lxml/saxparser.pxi":529
 *             node = None
 *         _pushSaxEndEvent(context, NULL, c_name, node)
 *     except:             # <<<<<<<<<<<<<<
 *         context._handleSaxException(c_ctxt)
 *     finally:
*/
      /*except:*/ {
        __Pyx_AddTraceback("lxml.etree._handleSaxEndNoNs", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_3, &__pyx_t_9) < 0) __PYX_ERR(5, 529, __pyx_L11_except_error)
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_3);
        __Pyx_XGOTREF(__pyx_t_9);

        /* "src/lxml/saxparser.pxi":530
 *         _pushSaxEndEvent(context, NULL, c_name, node)
 *     except:
 *         context._handleSaxException(c_ctxt)             # <<<<<<<<<<<<<<
 *     finally:
 *         return  # swallow any further exceptions
*/
        ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->_handleSaxException(__pyx_v_context, __pyx_v_c_ctxt);
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L10_exception_handled;
      }

      /* "src/lxml/saxparser.pxi":522
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:             # <<<<<<<<<<<<<<
 *         if context._target is not None:
 *             node = context._target._handleSaxEnd(funicode(c_name))
*/
      __pyx_L11_except_error:;
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
      goto __pyx_L7_error;
      __pyx_L10_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
      __pyx_L14_try_end:;
    }
  }

  /* "src/lxml/saxparser.pxi":532
 *         context._handleSaxException(c_ctxt)
 *     finally:
 *         return  # swallow any further exceptions             # <<<<<<<<<<<<<<
 * 
 * 
*/
  /*finally:*/ {
    /*normal exit:*/{
      goto __pyx_L0;
    }
    __pyx_L7_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_6 = 0; __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      if ( unlikely(__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4) < 0)) __Pyx_ErrFetch(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      {
        goto __pyx_L18_return;
      }
      __pyx_L18_return:;
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      goto __pyx_L0;
    }
  }

  /* "src/lxml/saxparser.pxi":517
 * 
 * 
 * cdef void _handleSaxEndNoNs(void* ctxt, const_xmlChar* c_name) noexcept with gil:             # <<<<<<<<<<<<<<
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_node);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
}

/* "src/lxml/saxparser.pxi":535
 * 
 * 
 * cdef int _pushSaxNsEndEvents(_SaxParserContext context) except -1:             # <<<<<<<<<<<<<<
 *     cdef bint build_events = context._event_filter & PARSE_EVENT_FILTER_END_NS
 *     cdef bint call_target = (
*/

static int __pyx_f_4lxml_5etree__pushSaxNsEndEvents(struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_context) {
  int __pyx_v_build_events;
  int __pyx_v_call_target;
  PyObject *__pyx_v_declared_namespaces = 0;
  PyObject *__pyx_v_prefix_uri = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_pushSaxNsEndEvents", 0);

  /* "src/lxml/saxparser.pxi":536
 * 
 * cdef int _pushSaxNsEndEvents(_SaxParserContext context) except -1:
 *     cdef bint build_events = context._event_filter & PARSE_EVENT_FILTER_END_NS             # <<<<<<<<<<<<<<
 *     cdef bint call_target = (
 *         context._target is not None
*/
  __pyx_v_build_events = (__pyx_v_context->_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_END_NS);

  /* "src/lxml/saxparser.pxi":538
 *     cdef bint build_events = context._event_filter & PARSE_EVENT_FILTER_END_NS
 *     cdef bint call_target = (
 *         context._target is not None             # <<<<<<<<<<<<<<
 *         and context._target._sax_event_filter & SAX_EVENT_END_NS)
 *     if not build_events and not call_target:
*/
  __pyx_t_2 = (((PyObject *)__pyx_v_context->_target) != Py_None);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L3_bool_binop_done;
  }

  /* "src/lxml/saxparser.pxi":539
 *     cdef bint call_target = (
 *         context._target is not None
 *         and context._target._sax_event_filter & SAX_EVENT_END_NS)             # <<<<<<<<<<<<<<
 *     if not build_events and not call_target:
 *         return 0
*/
  __pyx_t_2 = ((__pyx_v_context->_target->_sax_event_filter & __pyx_e_4lxml_5etree_SAX_EVENT_END_NS) != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L3_bool_binop_done:;
  __pyx_v_call_target = __pyx_t_1;

  /* "src/lxml/saxparser.pxi":540
 *         context._target is not None
 *         and context._target._sax_event_filter & SAX_EVENT_END_NS)
 *     if not build_events and not call_target:             # <<<<<<<<<<<<<<
 *         return 0
 * 
*/
  __pyx_t_2 = (!__pyx_v_build_events);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_2 = (!__pyx_v_call_target);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L6_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/saxparser.pxi":541
 *         and context._target._sax_event_filter & SAX_EVENT_END_NS)
 *     if not build_events and not call_target:
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     cdef list declared_namespaces = context._ns_stack.pop()
*/
    __pyx_r = 0;
    goto __pyx_L0;

    /* "src/lxml/saxparser.pxi":540
 *         context._target is not None
 *         and context._target._sax_event_filter & SAX_EVENT_END_NS)
 *     if not build_events and not call_target:             # <<<<<<<<<<<<<<
 *         return 0
 * 
*/
  }

  /* "src/lxml/saxparser.pxi":543
 *         return 0
 * 
 *     cdef list declared_namespaces = context._ns_stack.pop()             # <<<<<<<<<<<<<<
 *     if declared_namespaces is None:
 *         return 0
*/
  if (unlikely(__pyx_v_context->_ns_stack == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "pop");
    __PYX_ERR(5, 543, __pyx_L1_error)
  }
  __pyx_t_3 = __Pyx_PyList_Pop(__pyx_v_context->_ns_stack); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 543, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (!(likely(PyList_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None) || __Pyx_RaiseUnexpectedTypeError("list", __pyx_t_3))) __PYX_ERR(5, 543, __pyx_L1_error)
  __pyx_v_declared_namespaces = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/saxparser.pxi":544
 * 
 *     cdef list declared_namespaces = context._ns_stack.pop()
 *     if declared_namespaces is None:             # <<<<<<<<<<<<<<
 *         return 0
 * 
*/
  __pyx_t_1 = (__pyx_v_declared_namespaces == ((PyObject*)Py_None));
  if (__pyx_t_1) {

    /* "src/lxml/saxparser.pxi":545
 *     cdef list declared_namespaces = context._ns_stack.pop()
 *     if declared_namespaces is None:
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     cdef tuple prefix_uri
*/
    __pyx_r = 0;
    goto __pyx_L0;

    /* "src/lxml/saxparser.pxi":544
 * 
 *     cdef list declared_namespaces = context._ns_stack.pop()
 *     if declared_namespaces is None:             # <<<<<<<<<<<<<<
 *         return 0
 * 
*/
  }

  /* "src/lxml/saxparser.pxi":548
 * 
 *     cdef tuple prefix_uri
 *     for prefix_uri in reversed(declared_namespaces):             # <<<<<<<<<<<<<<
 *         if call_target:
 *             context._target._handleSaxEndNs(prefix_uri[0])
*/
  if (unlikely(__pyx_v_declared_namespaces == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(5, 548, __pyx_L1_error)
  }
  __pyx_t_3 = __pyx_v_declared_namespaces; __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyList_GET_SIZE(__pyx_t_3);
  #if !CYTHON_ASSUME_SAFE_SIZE
  if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(5, 548, __pyx_L1_error)
  #endif
  --__pyx_t_4;
  for (;;) {
    if (__pyx_t_4 < 0) break;
    {
      Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
      #if !CYTHON_ASSUME_SAFE_SIZE
      if (unlikely((__pyx_temp < 0))) __PYX_ERR(5, 548, __pyx_L1_error)
      #endif
      if (__pyx_t_4 >= __pyx_temp) break;
    }
    __pyx_t_5 = __Pyx_PyList_GetItemRefFast(__pyx_t_3, __pyx_t_4, __Pyx_ReferenceSharing_OwnStrongReference);
    --__pyx_t_4;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 548, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (!(likely(PyTuple_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_5))) __PYX_ERR(5, 548, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_prefix_uri, ((PyObject*)__pyx_t_5));
    __pyx_t_5 = 0;

    /* "src/lxml/saxparser.pxi":549
 *     cdef tuple prefix_uri
 *     for prefix_uri in reversed(declared_namespaces):
 *         if call_target:             # <<<<<<<<<<<<<<
 *             context._target._handleSaxEndNs(prefix_uri[0])
 *         if build_events:
*/
    if (__pyx_v_call_target) {

      /* "src/lxml/saxparser.pxi":550
 *     for prefix_uri in reversed(declared_namespaces):
 *         if call_target:
 *             context._target._handleSaxEndNs(prefix_uri[0])             # <<<<<<<<<<<<<<
 *         if build_events:
 *             context.events_iterator._events.append(('end-ns', None))
*/
      if (unlikely(__pyx_v_prefix_uri == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(5, 550, __pyx_L1_error)
      }
      __pyx_t_5 = __Pyx_GetItemInt_Tuple(__pyx_v_prefix_uri, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 550, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserTarget *)__pyx_v_context->_target->__pyx_vtab)->_handleSaxEndNs(__pyx_v_context->_target, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 550, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "src/lxml/saxparser.pxi":549
 *     cdef tuple prefix_uri
 *     for prefix_uri in reversed(declared_namespaces):
 *         if call_target:             # <<<<<<<<<<<<<<
 *             context._target._handleSaxEndNs(prefix_uri[0])
 *         if build_events:
*/
    }

    /* "src/lxml/saxparser.pxi":551
 *         if call_target:
 *             context._target._handleSaxEndNs(prefix_uri[0])
 *         if build_events:             # <<<<<<<<<<<<<<
 *             context.events_iterator._events.append(('end-ns', None))
 * 
*/
    if (__pyx_v_build_events) {

      /* "src/lxml/saxparser.pxi":552
 *             context._target._handleSaxEndNs(prefix_uri[0])
 *         if build_events:
 *             context.events_iterator._events.append(('end-ns', None))             # <<<<<<<<<<<<<<
 * 
 *     return 0
*/
      if (unlikely(__pyx_v_context->events_iterator->_events == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
        __PYX_ERR(5, 552, __pyx_L1_error)
      }
      __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_context->events_iterator->_events, __pyx_mstate_global->__pyx_tuple[7]); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(5, 552, __pyx_L1_error)

      /* "src/lxml/saxparser.pxi":551
 *         if call_target:
 *             context._target._handleSaxEndNs(prefix_uri[0])
 *         if build_events:             # <<<<<<<<<<<<<<
 *             context.events_iterator._events.append(('end-ns', None))
 * 
*/
    }

    /* "src/lxml/saxparser.pxi":548
 * 
 *     cdef tuple prefix_uri
 *     for prefix_uri in reversed(declared_namespaces):             # <<<<<<<<<<<<<<
 *         if call_target:
 *             context._target._handleSaxEndNs(prefix_uri[0])
*/
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/saxparser.pxi":554
 *             context.events_iterator._events.append(('end-ns', None))
 * 
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/saxparser.pxi":535
 * 
 * 
 * cdef int _pushSaxNsEndEvents(_SaxParserContext context) except -1:             # <<<<<<<<<<<<<<
 *     cdef bint build_events = context._event_filter & PARSE_EVENT_FILTER_END_NS
 *     cdef bint call_target = (
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._pushSaxNsEndEvents", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_declared_namespaces);
  __Pyx_XDECREF(__pyx_v_prefix_uri);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/saxparser.pxi":557
 * 
 * 
 * cdef int _pushSaxEndEvent(_SaxParserContext context,             # <<<<<<<<<<<<<<
 *                           const_xmlChar* c_href,
 *                           const_xmlChar* c_name, node) except -1:
*/

static int __pyx_f_4lxml_5etree__pushSaxEndEvent(struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_context, const xmlChar *__pyx_v_c_href, const xmlChar *__pyx_v_c_name, PyObject *__pyx_v_node) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_pushSaxEndEvent", 0);
  __Pyx_INCREF(__pyx_v_node);

  /* "src/lxml/saxparser.pxi":560
 *                           const_xmlChar* c_href,
 *                           const_xmlChar* c_name, node) except -1:
 *     if context._event_filter & PARSE_EVENT_FILTER_END:             # <<<<<<<<<<<<<<
 *         if (context._matcher is None or
 *                 context._matcher.matchesNsTag(c_href, c_name)):
*/
  __pyx_t_1 = ((__pyx_v_context->_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_END) != 0);
  if (__pyx_t_1) {

    /* "src/lxml/saxparser.pxi":561
 *                           const_xmlChar* c_name, node) except -1:
 *     if context._event_filter & PARSE_EVENT_FILTER_END:
 *         if (context._matcher is None or             # <<<<<<<<<<<<<<
 *                 context._matcher.matchesNsTag(c_href, c_name)):
 *             if context._target is None:
*/
    __pyx_t_2 = (((PyObject *)__pyx_v_context->_matcher) == Py_None);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L5_bool_binop_done;
    }

    /* "src/lxml/saxparser.pxi":562
 *     if context._event_filter & PARSE_EVENT_FILTER_END:
 *         if (context._matcher is None or
 *                 context._matcher.matchesNsTag(c_href, c_name)):             # <<<<<<<<<<<<<<
 *             if context._target is None:
 *                 node = context._node_stack.pop()
*/
    __pyx_t_2 = __pyx_f_4lxml_5etree_16_MultiTagMatcher_matchesNsTag(__pyx_v_context->_matcher, __pyx_v_c_href, __pyx_v_c_name);
    __pyx_t_1 = __pyx_t_2;
    __pyx_L5_bool_binop_done:;

    /* "src/lxml/saxparser.pxi":561
 *                           const_xmlChar* c_name, node) except -1:
 *     if context._event_filter & PARSE_EVENT_FILTER_END:
 *         if (context._matcher is None or             # <<<<<<<<<<<<<<
 *                 context._matcher.matchesNsTag(c_href, c_name)):
 *             if context._target is None:
*/
    if (__pyx_t_1) {

      /* "src/lxml/saxparser.pxi":563
 *         if (context._matcher is None or
 *                 context._matcher.matchesNsTag(c_href, c_name)):
 *             if context._target is None:             # <<<<<<<<<<<<<<
 *                 node = context._node_stack.pop()
 *             context.events_iterator._events.append(('end', node))
*/
      __pyx_t_1 = (((PyObject *)__pyx_v_context->_target) == Py_None);
      if (__pyx_t_1) {

        /* "src/lxml/saxparser.pxi":564
 *                 context._matcher.matchesNsTag(c_href, c_name)):
 *             if context._target is None:
 *                 node = context._node_stack.pop()             # <<<<<<<<<<<<<<
 *             context.events_iterator._events.append(('end', node))
 *     return 0
*/
        if (unlikely(__pyx_v_context->_node_stack == Py_None)) {
          PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "pop");
          __PYX_ERR(5, 564, __pyx_L1_error)
        }
        __pyx_t_3 = __Pyx_PyList_Pop(__pyx_v_context->_node_stack); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 564, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF_SET(__pyx_v_node, __pyx_t_3);
        __pyx_t_3 = 0;

        /* "src/lxml/saxparser.pxi":563
 *         if (context._matcher is None or
 *                 context._matcher.matchesNsTag(c_href, c_name)):
 *             if context._target is None:             # <<<<<<<<<<<<<<
 *                 node = context._node_stack.pop()
 *             context.events_iterator._events.append(('end', node))
*/
      }

      /* "src/lxml/saxparser.pxi":565
 *             if context._target is None:
 *                 node = context._node_stack.pop()
 *             context.events_iterator._events.append(('end', node))             # <<<<<<<<<<<<<<
 *     return 0
 * 
*/
      if (unlikely(__pyx_v_context->events_iterator->_events == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
        __PYX_ERR(5, 565, __pyx_L1_error)
      }
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 565, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_end);
      __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_end);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_mstate_global->__pyx_n_u_end) != (0)) __PYX_ERR(5, 565, __pyx_L1_error);
      __Pyx_INCREF(__pyx_v_node);
      __Pyx_GIVEREF(__pyx_v_node);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_node) != (0)) __PYX_ERR(5, 565, __pyx_L1_error);
      __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_context->events_iterator->_events, __pyx_t_3); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(5, 565, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "src/lxml/saxparser.pxi":561
 *                           const_xmlChar* c_name, node) except -1:
 *     if context._event_filter & PARSE_EVENT_FILTER_END:
 *         if (context._matcher is None or             # <<<<<<<<<<<<<<
 *                 context._matcher.matchesNsTag(c_href, c_name)):
 *             if context._target is None:
*/
    }

    /* "src/lxml/saxparser.pxi":560
 *                           const_xmlChar* c_href,
 *                           const_xmlChar* c_name, node) except -1:
 *     if context._event_filter & PARSE_EVENT_FILTER_END:             # <<<<<<<<<<<<<<
 *         if (context._matcher is None or
 *                 context._matcher.matchesNsTag(c_href, c_name)):
*/
  }

  /* "src/lxml/saxparser.pxi":566
 *                 node = context._node_stack.pop()
 *             context.events_iterator._events.append(('end', node))
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/saxparser.pxi":557
 * 
 * 
 * cdef int _pushSaxEndEvent(_SaxParserContext context,             # <<<<<<<<<<<<<<
 *                           const_xmlChar* c_href,
 *                           const_xmlChar* c_name, node) except -1:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._pushSaxEndEvent", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_node);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/saxparser.pxi":569
 * 
 * 
 * cdef void _handleSaxData(void* ctxt, const_xmlChar* c_data, int data_len) noexcept with gil:             # <<<<<<<<<<<<<<
 *     # can only be called if parsing with a target
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
*/

static void __pyx_f_4lxml_5etree__handleSaxData(void *__pyx_v_ctxt, const xmlChar *__pyx_v_c_data, int __pyx_v_data_len) {
  xmlParserCtxt *__pyx_v_c_ctxt;
  struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_context = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("_handleSaxData", 0);

  /* "src/lxml/saxparser.pxi":571
 * cdef void _handleSaxData(void* ctxt, const_xmlChar* c_data, int data_len) noexcept with gil:
 *     # can only be called if parsing with a target
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt             # <<<<<<<<<<<<<<
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):
 *         return
*/
  __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt);

  /* "src/lxml/saxparser.pxi":572
 *     # can only be called if parsing with a target
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
*/
  __pyx_t_2 = (__pyx_v_c_ctxt->_private == NULL);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = xmlCtxtIsStopped(__pyx_v_c_ctxt);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/saxparser.pxi":573
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):
 *         return             # <<<<<<<<<<<<<<
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:
*/
    goto __pyx_L0;

    /* "src/lxml/saxparser.pxi":572
 *     # can only be called if parsing with a target
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
*/
  }

  /* "src/lxml/saxparser.pxi":574
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):
 *         return
 *     context = <_SaxParserContext>c_ctxt._private             # <<<<<<<<<<<<<<
 *     try:
 *         context._target._handleSaxData(
*/
  __pyx_t_3 = ((PyObject *)__pyx_v_c_ctxt->_private);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/saxparser.pxi":575
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:             # <<<<<<<<<<<<<<
 *         context._target._handleSaxData(
 *             c_data[:data_len].decode('utf8'))
*/
  /*try:*/ {
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_6);
      /*try:*/ {

        /* "src/lxml/saxparser.pxi":577
 *     try:
 *         context._target._handleSaxData(
 *             c_data[:data_len].decode('utf8'))             # <<<<<<<<<<<<<<
 *     except:
 *         context._handleSaxException(c_ctxt)
*/
        __pyx_t_3 = __Pyx_decode_c_string(((char const *)__pyx_v_c_data), 0, __pyx_v_data_len, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 577, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_3);

        /* "src/lxml/saxparser.pxi":576
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:
 *         context._target._handleSaxData(             # <<<<<<<<<<<<<<
 *             c_data[:data_len].decode('utf8'))
 *     except:
*/
        __pyx_t_7 = ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserTarget *)__pyx_v_context->_target->__pyx_vtab)->_handleSaxData(__pyx_v_context->_target, __pyx_t_3); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(5, 576, __pyx_L9_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "src/lxml/saxparser.pxi":575
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:             # <<<<<<<<<<<<<<
 *         context._target._handleSaxData(
 *             c_data[:data_len].decode('utf8'))
*/
      }
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L14_try_end;
      __pyx_L9_error:;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "src/lxml/saxparser.pxi":578
 *         context._target._handleSaxData(
 *             c_data[:data_len].decode('utf8'))
 *     except:             # <<<<<<<<<<<<<<
 *         context._handleSaxException(c_ctxt)
 *     finally:
*/
      /*except:*/ {
        __Pyx_AddTraceback("lxml.etree._handleSaxData", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_8, &__pyx_t_9) < 0) __PYX_ERR(5, 578, __pyx_L11_except_error)
        __Pyx_XGOTREF(__pyx_t_3);
        __Pyx_XGOTREF(__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_9);

        /* "src/lxml/saxparser.pxi":579
 *             c_data[:data_len].decode('utf8'))
 *     except:
 *         context._handleSaxException(c_ctxt)             # <<<<<<<<<<<<<<
 *     finally:
 *         return  # swallow any further exceptions
*/
        ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->_handleSaxException(__pyx_v_context, __pyx_v_c_ctxt);
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L10_exception_handled;
      }

      /* "src/lxml/saxparser.pxi":575
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:             # <<<<<<<<<<<<<<
 *         context._target._handleSaxData(
 *             c_data[:data_len].decode('utf8'))
*/
      __pyx_L11_except_error:;
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
      goto __pyx_L7_error;
      __pyx_L10_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
      __pyx_L14_try_end:;
    }
  }

  /* "src/lxml/saxparser.pxi":581
 *         context._handleSaxException(c_ctxt)
 *     finally:
 *         return  # swallow any further exceptions             # <<<<<<<<<<<<<<
 * 
 * 
*/
  /*finally:*/ {
    /*normal exit:*/{
      goto __pyx_L0;
    }
    __pyx_L7_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_6 = 0; __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      if ( unlikely(__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4) < 0)) __Pyx_ErrFetch(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      {
        goto __pyx_L17_return;
      }
      __pyx_L17_return:;
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      goto __pyx_L0;
    }
  }

  /* "src/lxml/saxparser.pxi":569
 * 
 * 
 * cdef void _handleSaxData(void* ctxt, const_xmlChar* c_data, int data_len) noexcept with gil:             # <<<<<<<<<<<<<<
 *     # can only be called if parsing with a target
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
}

/* "src/lxml/saxparser.pxi":584
 * 
 * 
 * cdef void _handleSaxTargetDoctype(void* ctxt, const_xmlChar* c_name,             # <<<<<<<<<<<<<<
 *                                   const_xmlChar* c_public,
 *                                   const_xmlChar* c_system) noexcept with gil:
*/

static void __pyx_f_4lxml_5etree__handleSaxTargetDoctype(void *__pyx_v_ctxt, const xmlChar *__pyx_v_c_name, const xmlChar *__pyx_v_c_public, const xmlChar *__pyx_v_c_system) {
  xmlParserCtxt *__pyx_v_c_ctxt;
  struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_context = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("_handleSaxTargetDoctype", 0);

  /* "src/lxml/saxparser.pxi":588
 *                                   const_xmlChar* c_system) noexcept with gil:
 *     # can only be called if parsing with a target
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt             # <<<<<<<<<<<<<<
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):
 *         return
*/
  __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt);

  /* "src/lxml/saxparser.pxi":589
 *     # can only be called if parsing with a target
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
*/
  __pyx_t_2 = (__pyx_v_c_ctxt->_private == NULL);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = xmlCtxtIsStopped(__pyx_v_c_ctxt);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/saxparser.pxi":590
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):
 *         return             # <<<<<<<<<<<<<<
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:
*/
    goto __pyx_L0;

    /* "src/lxml/saxparser.pxi":589
 *     # can only be called if parsing with a target
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
*/
  }

  /* "src/lxml/saxparser.pxi":591
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):
 *         return
 *     context = <_SaxParserContext>c_ctxt._private             # <<<<<<<<<<<<<<
 *     try:
 *         context._target._handleSaxDoctype(
*/
  __pyx_t_3 = ((PyObject *)__pyx_v_c_ctxt->_private);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/saxparser.pxi":592
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:             # <<<<<<<<<<<<<<
 *         context._target._handleSaxDoctype(
 *             funicodeOrNone(c_name),
*/
  /*try:*/ {
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_6);
      /*try:*/ {

        /* "src/lxml/saxparser.pxi":594
 *     try:
 *         context._target._handleSaxDoctype(
 *             funicodeOrNone(c_name),             # <<<<<<<<<<<<<<
 *             funicodeOrNone(c_public),
 *             funicodeOrNone(c_system))
*/
        __pyx_t_3 = __pyx_f_4lxml_5etree_funicodeOrNone(__pyx_v_c_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 594, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_3);

        /* "src/lxml/saxparser.pxi":595
 *         context._target._handleSaxDoctype(
 *             funicodeOrNone(c_name),
 *             funicodeOrNone(c_public),             # <<<<<<<<<<<<<<
 *             funicodeOrNone(c_system))
 *     except:
*/
        __pyx_t_7 = __pyx_f_4lxml_5etree_funicodeOrNone(__pyx_v_c_public); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 595, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_7);

        /* "src/lxml/saxparser.pxi":596
 *             funicodeOrNone(c_name),
 *             funicodeOrNone(c_public),
 *             funicodeOrNone(c_system))             # <<<<<<<<<<<<<<
 *     except:
 *         context._handleSaxException(c_ctxt)
*/
        __pyx_t_8 = __pyx_f_4lxml_5etree_funicodeOrNone(__pyx_v_c_system); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 596, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_8);

        /* "src/lxml/saxparser.pxi":593
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:
 *         context._target._handleSaxDoctype(             # <<<<<<<<<<<<<<
 *             funicodeOrNone(c_name),
 *             funicodeOrNone(c_public),
*/
        __pyx_t_9 = ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserTarget *)__pyx_v_context->_target->__pyx_vtab)->_handleSaxDoctype(__pyx_v_context->_target, __pyx_t_3, __pyx_t_7, __pyx_t_8); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(5, 593, __pyx_L9_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

        /* "src/lxml/saxparser.pxi":592
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:             # <<<<<<<<<<<<<<
 *         context._target._handleSaxDoctype(
 *             funicodeOrNone(c_name),
*/
      }
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L14_try_end;
      __pyx_L9_error:;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "src/lxml/saxparser.pxi":597
 *             funicodeOrNone(c_public),
 *             funicodeOrNone(c_system))
 *     except:             # <<<<<<<<<<<<<<
 *         context._handleSaxException(c_ctxt)
 *     finally:
*/
      /*except:*/ {
        __Pyx_AddTraceback("lxml.etree._handleSaxTargetDoctype", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_7, &__pyx_t_3) < 0) __PYX_ERR(5, 597, __pyx_L11_except_error)
        __Pyx_XGOTREF(__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_3);

        /* "src/lxml/saxparser.pxi":598
 *             funicodeOrNone(c_system))
 *     except:
 *         context._handleSaxException(c_ctxt)             # <<<<<<<<<<<<<<
 *     finally:
 *         return  # swallow any further exceptions
*/
        ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->_handleSaxException(__pyx_v_context, __pyx_v_c_ctxt);
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        goto __pyx_L10_exception_handled;
      }

      /* "src/lxml/saxparser.pxi":592
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:             # <<<<<<<<<<<<<<
 *         context._target._handleSaxDoctype(
 *             funicodeOrNone(c_name),
*/
      __pyx_L11_except_error:;
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
      goto __pyx_L7_error;
      __pyx_L10_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
      __pyx_L14_try_end:;
    }
  }

  /* "src/lxml/saxparser.pxi":600
 *         context._handleSaxException(c_ctxt)
 *     finally:
 *         return  # swallow any further exceptions             # <<<<<<<<<<<<<<
 * 
 * 
*/
  /*finally:*/ {
    /*normal exit:*/{
      goto __pyx_L0;
    }
    __pyx_L7_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_6 = 0; __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      if ( unlikely(__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4) < 0)) __Pyx_ErrFetch(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      {
        goto __pyx_L17_return;
      }
      __pyx_L17_return:;
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      goto __pyx_L0;
    }
  }

  /* "src/lxml/saxparser.pxi":584
 * 
 * 
 * cdef void _handleSaxTargetDoctype(void* ctxt, const_xmlChar* c_name,             # <<<<<<<<<<<<<<
 *                                   const_xmlChar* c_public,
 *                                   const_xmlChar* c_system) noexcept with gil:
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
}

/* "src/lxml/saxparser.pxi":603
 * 
 * 
 * cdef void _handleSaxStartDocument(void* ctxt) noexcept with gil:             # <<<<<<<<<<<<<<
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):
*/

static void __pyx_f_4lxml_5etree__handleSaxStartDocument(void *__pyx_v_ctxt) {
  xmlParserCtxt *__pyx_v_c_ctxt;
  struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_context = NULL;
  xmlDoc *__pyx_v_c_doc;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  xmlDoc *__pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("_handleSaxStartDocument", 0);

  /* "src/lxml/saxparser.pxi":604
 * 
 * cdef void _handleSaxStartDocument(void* ctxt) noexcept with gil:
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt             # <<<<<<<<<<<<<<
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):
 *         return
*/
  __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt);

  /* "src/lxml/saxparser.pxi":605
 * cdef void _handleSaxStartDocument(void* ctxt) noexcept with gil:
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
*/
  __pyx_t_2 = (__pyx_v_c_ctxt->_private == NULL);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = xmlCtxtIsStopped(__pyx_v_c_ctxt);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/saxparser.pxi":606
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):
 *         return             # <<<<<<<<<<<<<<
 *     context = <_SaxParserContext>c_ctxt._private
 *     context._origSaxStartDocument(ctxt)
*/
    goto __pyx_L0;

    /* "src/lxml/saxparser.pxi":605
 * cdef void _handleSaxStartDocument(void* ctxt) noexcept with gil:
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
*/
  }

  /* "src/lxml/saxparser.pxi":607
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):
 *         return
 *     context = <_SaxParserContext>c_ctxt._private             # <<<<<<<<<<<<<<
 *     context._origSaxStartDocument(ctxt)
 *     c_doc = c_ctxt.myDoc
*/
  __pyx_t_3 = ((PyObject *)__pyx_v_c_ctxt->_private);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/saxparser.pxi":608
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     context._origSaxStartDocument(ctxt)             # <<<<<<<<<<<<<<
 *     c_doc = c_ctxt.myDoc
 *     try:
*/
  __pyx_v_context->_origSaxStartDocument(__pyx_v_ctxt);

  /* "src/lxml/saxparser.pxi":609
 *     context = <_SaxParserContext>c_ctxt._private
 *     context._origSaxStartDocument(ctxt)
 *     c_doc = c_ctxt.myDoc             # <<<<<<<<<<<<<<
 *     try:
 *         context.startDocument(c_doc)
*/
  __pyx_t_4 = __pyx_v_c_ctxt->myDoc;
  __pyx_v_c_doc = __pyx_t_4;

  /* "src/lxml/saxparser.pxi":610
 *     context._origSaxStartDocument(ctxt)
 *     c_doc = c_ctxt.myDoc
 *     try:             # <<<<<<<<<<<<<<
 *         context.startDocument(c_doc)
 *     except:
*/
  /*try:*/ {
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);
      /*try:*/ {

        /* "src/lxml/saxparser.pxi":611
 *     c_doc = c_ctxt.myDoc
 *     try:
 *         context.startDocument(c_doc)             # <<<<<<<<<<<<<<
 *     except:
 *         context._handleSaxException(c_ctxt)
*/
        __pyx_t_8 = ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->startDocument(__pyx_v_context, __pyx_v_c_doc); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(5, 611, __pyx_L9_error)

        /* "src/lxml/saxparser.pxi":610
 *     context._origSaxStartDocument(ctxt)
 *     c_doc = c_ctxt.myDoc
 *     try:             # <<<<<<<<<<<<<<
 *         context.startDocument(c_doc)
 *     except:
*/
      }
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L14_try_end;
      __pyx_L9_error:;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "src/lxml/saxparser.pxi":612
 *     try:
 *         context.startDocument(c_doc)
 *     except:             # <<<<<<<<<<<<<<
 *         context._handleSaxException(c_ctxt)
 *     finally:
*/
      /*except:*/ {
        __Pyx_AddTraceback("lxml.etree._handleSaxStartDocument", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_9, &__pyx_t_10) < 0) __PYX_ERR(5, 612, __pyx_L11_except_error)
        __Pyx_XGOTREF(__pyx_t_3);
        __Pyx_XGOTREF(__pyx_t_9);
        __Pyx_XGOTREF(__pyx_t_10);

        /* "src/lxml/saxparser.pxi":613
 *         context.startDocument(c_doc)
 *     except:
 *         context._handleSaxException(c_ctxt)             # <<<<<<<<<<<<<<
 *     finally:
 *         return  # swallow any further exceptions
*/
        ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->_handleSaxException(__pyx_v_context, __pyx_v_c_ctxt);
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        goto __pyx_L10_exception_handled;
      }

      /* "src/lxml/saxparser.pxi":610
 *     context._origSaxStartDocument(ctxt)
 *     c_doc = c_ctxt.myDoc
 *     try:             # <<<<<<<<<<<<<<
 *         context.startDocument(c_doc)
 *     except:
*/
      __pyx_L11_except_error:;
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
      goto __pyx_L7_error;
      __pyx_L10_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
      __pyx_L14_try_end:;
    }
  }

  /* "src/lxml/saxparser.pxi":615
 *         context._handleSaxException(c_ctxt)
 *     finally:
 *         return  # swallow any further exceptions             # <<<<<<<<<<<<<<
 * 
 * 
*/
  /*finally:*/ {
    /*normal exit:*/{
      goto __pyx_L0;
    }
    __pyx_L7_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_7 = 0; __pyx_t_6 = 0; __pyx_t_5 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
      if ( unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_6, &__pyx_t_5) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_6, &__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      {
        goto __pyx_L17_return;
      }
      __pyx_L17_return:;
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
      goto __pyx_L0;
    }
  }

  /* "src/lxml/saxparser.pxi":603
 * 
 * 
 * cdef void _handleSaxStartDocument(void* ctxt) noexcept with gil:             # <<<<<<<<<<<<<<
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
}

/* "src/lxml/saxparser.pxi":618
 * 
 * 
 * cdef void _handleSaxTargetPI(void* ctxt, const_xmlChar* c_target,             # <<<<<<<<<<<<<<
 *                              const_xmlChar* c_data) noexcept with gil:
 *     # can only be called if parsing with a target
*/

static void __pyx_f_4lxml_5etree__handleSaxTargetPI(void *__pyx_v_ctxt, const xmlChar *__pyx_v_c_target, const xmlChar *__pyx_v_c_data) {
  xmlParserCtxt *__pyx_v_c_ctxt;
  struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_context = NULL;
  PyObject *__pyx_v_pi = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("_handleSaxTargetPI", 0);

  /* "src/lxml/saxparser.pxi":621
 *                              const_xmlChar* c_data) noexcept with gil:
 *     # can only be called if parsing with a target
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt             # <<<<<<<<<<<<<<
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):
 *         return
*/
  __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt);

  /* "src/lxml/saxparser.pxi":622
 *     # can only be called if parsing with a target
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
*/
  __pyx_t_2 = (__pyx_v_c_ctxt->_private == NULL);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = xmlCtxtIsStopped(__pyx_v_c_ctxt);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/saxparser.pxi":623
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):
 *         return             # <<<<<<<<<<<<<<
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:
*/
    goto __pyx_L0;

    /* "src/lxml/saxparser.pxi":622
 *     # can only be called if parsing with a target
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
*/
  }

  /* "src/lxml/saxparser.pxi":624
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):
 *         return
 *     context = <_SaxParserContext>c_ctxt._private             # <<<<<<<<<<<<<<
 *     try:
 *         pi = context._target._handleSaxPi(
*/
  __pyx_t_3 = ((PyObject *)__pyx_v_c_ctxt->_private);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/saxparser.pxi":625
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:             # <<<<<<<<<<<<<<
 *         pi = context._target._handleSaxPi(
 *             funicodeOrNone(c_target),
*/
  /*try:*/ {
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_6);
      /*try:*/ {

        /* "src/lxml/saxparser.pxi":627
 *     try:
 *         pi = context._target._handleSaxPi(
 *             funicodeOrNone(c_target),             # <<<<<<<<<<<<<<
 *             funicodeOrEmpty(c_data))
 *         if context._event_filter & PARSE_EVENT_FILTER_PI:
*/
        __pyx_t_3 = __pyx_f_4lxml_5etree_funicodeOrNone(__pyx_v_c_target); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 627, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_3);

        /* "src/lxml/saxparser.pxi":628
 *         pi = context._target._handleSaxPi(
 *             funicodeOrNone(c_target),
 *             funicodeOrEmpty(c_data))             # <<<<<<<<<<<<<<
 *         if context._event_filter & PARSE_EVENT_FILTER_PI:
 *             context.events_iterator._events.append(('pi', pi))
*/
        __pyx_t_7 = __pyx_f_4lxml_5etree_funicodeOrEmpty(__pyx_v_c_data); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 628, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_7);

        /* "src/lxml/saxparser.pxi":626
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:
 *         pi = context._target._handleSaxPi(             # <<<<<<<<<<<<<<
 *             funicodeOrNone(c_target),
 *             funicodeOrEmpty(c_data))
*/
        __pyx_t_8 = ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserTarget *)__pyx_v_context->_target->__pyx_vtab)->_handleSaxPi(__pyx_v_context->_target, __pyx_t_3, __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 626, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_pi = __pyx_t_8;
        __pyx_t_8 = 0;

        /* "src/lxml/saxparser.pxi":629
 *             funicodeOrNone(c_target),
 *             funicodeOrEmpty(c_data))
 *         if context._event_filter & PARSE_EVENT_FILTER_PI:             # <<<<<<<<<<<<<<
 *             context.events_iterator._events.append(('pi', pi))
 *     except:
*/
        __pyx_t_1 = ((__pyx_v_context->_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_PI) != 0);
        if (__pyx_t_1) {

          /* "src/lxml/saxparser.pxi":630
 *             funicodeOrEmpty(c_data))
 *         if context._event_filter & PARSE_EVENT_FILTER_PI:
 *             context.events_iterator._events.append(('pi', pi))             # <<<<<<<<<<<<<<
 *     except:
 *         context._handleSaxException(c_ctxt)
*/
          if (unlikely(__pyx_v_context->events_iterator->_events == Py_None)) {
            PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
            __PYX_ERR(5, 630, __pyx_L9_error)
          }
          __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 630, __pyx_L9_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_pi);
          __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_pi);
          if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_mstate_global->__pyx_n_u_pi) != (0)) __PYX_ERR(5, 630, __pyx_L9_error);
          __Pyx_INCREF(__pyx_v_pi);
          __Pyx_GIVEREF(__pyx_v_pi);
          if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_pi) != (0)) __PYX_ERR(5, 630, __pyx_L9_error);
          __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_context->events_iterator->_events, __pyx_t_8); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(5, 630, __pyx_L9_error)
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

          /* "src/lxml/saxparser.pxi":629
 *             funicodeOrNone(c_target),
 *             funicodeOrEmpty(c_data))
 *         if context._event_filter & PARSE_EVENT_FILTER_PI:             # <<<<<<<<<<<<<<
 *             context.events_iterator._events.append(('pi', pi))
 *     except:
*/
        }

        /* "src/lxml/saxparser.pxi":625
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:             # <<<<<<<<<<<<<<
 *         pi = context._target._handleSaxPi(
 *             funicodeOrNone(c_target),
*/
      }
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L14_try_end;
      __pyx_L9_error:;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "src/lxml/saxparser.pxi":631
 *         if context._event_filter & PARSE_EVENT_FILTER_PI:
 *             context.events_iterator._events.append(('pi', pi))
 *     except:             # <<<<<<<<<<<<<<
 *         context._handleSaxException(c_ctxt)
 *     finally:
*/
      /*except:*/ {
        __Pyx_AddTraceback("lxml.etree._handleSaxTargetPI", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_7, &__pyx_t_3) < 0) __PYX_ERR(5, 631, __pyx_L11_except_error)
        __Pyx_XGOTREF(__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_3);

        /* "src/lxml/saxparser.pxi":632
 *             context.events_iterator._events.append(('pi', pi))
 *     except:
 *         context._handleSaxException(c_ctxt)             # <<<<<<<<<<<<<<
 *     finally:
 *         return  # swallow any further exceptions
*/
        ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->_handleSaxException(__pyx_v_context, __pyx_v_c_ctxt);
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        goto __pyx_L10_exception_handled;
      }

      /* "src/lxml/saxparser.pxi":625
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:             # <<<<<<<<<<<<<<
 *         pi = context._target._handleSaxPi(
 *             funicodeOrNone(c_target),
*/
      __pyx_L11_except_error:;
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
      goto __pyx_L7_error;
      __pyx_L10_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
      __pyx_L14_try_end:;
    }
  }

  /* "src/lxml/saxparser.pxi":634
 *         context._handleSaxException(c_ctxt)
 *     finally:
 *         return  # swallow any further exceptions             # <<<<<<<<<<<<<<
 * 
 * 
*/
  /*finally:*/ {
    /*normal exit:*/{
      goto __pyx_L0;
    }
    __pyx_L7_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_6 = 0; __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      if ( unlikely(__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4) < 0)) __Pyx_ErrFetch(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      {
        goto __pyx_L18_return;
      }
      __pyx_L18_return:;
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      goto __pyx_L0;
    }
  }

  /* "src/lxml/saxparser.pxi":618
 * 
 * 
 * cdef void _handleSaxTargetPI(void* ctxt, const_xmlChar* c_target,             # <<<<<<<<<<<<<<
 *                              const_xmlChar* c_data) noexcept with gil:
 *     # can only be called if parsing with a target
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_pi);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
}

/* "src/lxml/saxparser.pxi":637
 * 
 * 
 * cdef void _handleSaxPIEvent(void* ctxt, const_xmlChar* target,             # <<<<<<<<<<<<<<
 *                             const_xmlChar* data) noexcept with gil:
 *     # can only be called when collecting pi events
*/

static void __pyx_f_4lxml_5etree__handleSaxPIEvent(void *__pyx_v_ctxt, const xmlChar *__pyx_v_target, const xmlChar *__pyx_v_data) {
  xmlParserCtxt *__pyx_v_c_ctxt;
  struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_context = NULL;
  xmlNode *__pyx_v_c_node;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("_handleSaxPIEvent", 0);

  /* "src/lxml/saxparser.pxi":640
 *                             const_xmlChar* data) noexcept with gil:
 *     # can only be called when collecting pi events
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt             # <<<<<<<<<<<<<<
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):
 *         return
*/
  __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt);

  /* "src/lxml/saxparser.pxi":641
 *     # can only be called when collecting pi events
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
*/
  __pyx_t_2 = (__pyx_v_c_ctxt->_private == NULL);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = xmlCtxtIsStopped(__pyx_v_c_ctxt);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/saxparser.pxi":642
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):
 *         return             # <<<<<<<<<<<<<<
 *     context = <_SaxParserContext>c_ctxt._private
 *     context._origSaxPI(ctxt, target, data)
*/
    goto __pyx_L0;

    /* "src/lxml/saxparser.pxi":641
 *     # can only be called when collecting pi events
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
*/
  }

  /* "src/lxml/saxparser.pxi":643
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):
 *         return
 *     context = <_SaxParserContext>c_ctxt._private             # <<<<<<<<<<<<<<
 *     context._origSaxPI(ctxt, target, data)
 *     c_node = _findLastEventNode(c_ctxt)
*/
  __pyx_t_3 = ((PyObject *)__pyx_v_c_ctxt->_private);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/saxparser.pxi":644
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     context._origSaxPI(ctxt, target, data)             # <<<<<<<<<<<<<<
 *     c_node = _findLastEventNode(c_ctxt)
 *     if c_node is NULL:
*/
  __pyx_v_context->_origSaxPI(__pyx_v_ctxt, __pyx_v_target, __pyx_v_data);

  /* "src/lxml/saxparser.pxi":645
 *     context = <_SaxParserContext>c_ctxt._private
 *     context._origSaxPI(ctxt, target, data)
 *     c_node = _findLastEventNode(c_ctxt)             # <<<<<<<<<<<<<<
 *     if c_node is NULL:
 *         return
*/
  __pyx_v_c_node = __pyx_f_4lxml_5etree__findLastEventNode(__pyx_v_c_ctxt);

  /* "src/lxml/saxparser.pxi":646
 *     context._origSaxPI(ctxt, target, data)
 *     c_node = _findLastEventNode(c_ctxt)
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         return
 *     try:
*/
  __pyx_t_1 = (__pyx_v_c_node == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/saxparser.pxi":647
 *     c_node = _findLastEventNode(c_ctxt)
 *     if c_node is NULL:
 *         return             # <<<<<<<<<<<<<<
 *     try:
 *         context.pushEvent('pi', c_node)
*/
    goto __pyx_L0;

    /* "src/lxml/saxparser.pxi":646
 *     context._origSaxPI(ctxt, target, data)
 *     c_node = _findLastEventNode(c_ctxt)
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         return
 *     try:
*/
  }

  /* "src/lxml/saxparser.pxi":648
 *     if c_node is NULL:
 *         return
 *     try:             # <<<<<<<<<<<<<<
 *         context.pushEvent('pi', c_node)
 *     except:
*/
  /*try:*/ {
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_6);
      /*try:*/ {

        /* "src/lxml/saxparser.pxi":649
 *         return
 *     try:
 *         context.pushEvent('pi', c_node)             # <<<<<<<<<<<<<<
 *     except:
 *         context._handleSaxException(c_ctxt)
*/
        __pyx_t_7 = ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->pushEvent(__pyx_v_context, __pyx_mstate_global->__pyx_n_u_pi, __pyx_v_c_node); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(5, 649, __pyx_L10_error)

        /* "src/lxml/saxparser.pxi":648
 *     if c_node is NULL:
 *         return
 *     try:             # <<<<<<<<<<<<<<
 *         context.pushEvent('pi', c_node)
 *     except:
*/
      }
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L15_try_end;
      __pyx_L10_error:;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "src/lxml/saxparser.pxi":650
 *     try:
 *         context.pushEvent('pi', c_node)
 *     except:             # <<<<<<<<<<<<<<
 *         context._handleSaxException(c_ctxt)
 *     finally:
*/
      /*except:*/ {
        __Pyx_AddTraceback("lxml.etree._handleSaxPIEvent", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_8, &__pyx_t_9) < 0) __PYX_ERR(5, 650, __pyx_L12_except_error)
        __Pyx_XGOTREF(__pyx_t_3);
        __Pyx_XGOTREF(__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_9);

        /* "src/lxml/saxparser.pxi":651
 *         context.pushEvent('pi', c_node)
 *     except:
 *         context._handleSaxException(c_ctxt)             # <<<<<<<<<<<<<<
 *     finally:
 *         return  # swallow any further exceptions
*/
        ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->_handleSaxException(__pyx_v_context, __pyx_v_c_ctxt);
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L11_exception_handled;
      }

      /* "src/lxml/saxparser.pxi":648
 *     if c_node is NULL:
 *         return
 *     try:             # <<<<<<<<<<<<<<
 *         context.pushEvent('pi', c_node)
 *     except:
*/
      __pyx_L12_except_error:;
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
      goto __pyx_L8_error;
      __pyx_L11_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
      __pyx_L15_try_end:;
    }
  }

  /* "src/lxml/saxparser.pxi":653
 *         context._handleSaxException(c_ctxt)
 *     finally:
 *         return  # swallow any further exceptions             # <<<<<<<<<<<<<<
 * 
 * 
*/
  /*finally:*/ {
    /*normal exit:*/{
      goto __pyx_L0;
    }
    __pyx_L8_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_6 = 0; __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      if ( unlikely(__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4) < 0)) __Pyx_ErrFetch(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      {
        goto __pyx_L18_return;
      }
      __pyx_L18_return:;
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      goto __pyx_L0;
    }
  }

  /* "src/lxml/saxparser.pxi":637
 * 
 * 
 * cdef void _handleSaxPIEvent(void* ctxt, const_xmlChar* target,             # <<<<<<<<<<<<<<
 *                             const_xmlChar* data) noexcept with gil:
 *     # can only be called when collecting pi events
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
}

/* "src/lxml/saxparser.pxi":656
 * 
 * 
 * cdef void _handleSaxTargetComment(void* ctxt, const_xmlChar* c_data) noexcept with gil:             # <<<<<<<<<<<<<<
 *     # can only be called if parsing with a target
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
*/

static void __pyx_f_4lxml_5etree__handleSaxTargetComment(void *__pyx_v_ctxt, const xmlChar *__pyx_v_c_data) {
  xmlParserCtxt *__pyx_v_c_ctxt;
  struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_context = NULL;
  PyObject *__pyx_v_comment = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("_handleSaxTargetComment", 0);

  /* "src/lxml/saxparser.pxi":658
 * cdef void _handleSaxTargetComment(void* ctxt, const_xmlChar* c_data) noexcept with gil:
 *     # can only be called if parsing with a target
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt             # <<<<<<<<<<<<<<
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):
 *         return
*/
  __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt);

  /* "src/lxml/saxparser.pxi":659
 *     # can only be called if parsing with a target
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
*/
  __pyx_t_2 = (__pyx_v_c_ctxt->_private == NULL);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = xmlCtxtIsStopped(__pyx_v_c_ctxt);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/saxparser.pxi":660
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):
 *         return             # <<<<<<<<<<<<<<
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:
*/
    goto __pyx_L0;

    /* "src/lxml/saxparser.pxi":659
 *     # can only be called if parsing with a target
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
*/
  }

  /* "src/lxml/saxparser.pxi":661
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):
 *         return
 *     context = <_SaxParserContext>c_ctxt._private             # <<<<<<<<<<<<<<
 *     try:
 *         comment = context._target._handleSaxComment(funicodeOrEmpty(c_data))
*/
  __pyx_t_3 = ((PyObject *)__pyx_v_c_ctxt->_private);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/saxparser.pxi":662
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:             # <<<<<<<<<<<<<<
 *         comment = context._target._handleSaxComment(funicodeOrEmpty(c_data))
 *         if context._event_filter & PARSE_EVENT_FILTER_COMMENT:
*/
  /*try:*/ {
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_6);
      /*try:*/ {

        /* "src/lxml/saxparser.pxi":663
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:
 *         comment = context._target._handleSaxComment(funicodeOrEmpty(c_data))             # <<<<<<<<<<<<<<
 *         if context._event_filter & PARSE_EVENT_FILTER_COMMENT:
 *             context.events_iterator._events.append(('comment', comment))
*/
        __pyx_t_3 = __pyx_f_4lxml_5etree_funicodeOrEmpty(__pyx_v_c_data); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 663, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_7 = ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserTarget *)__pyx_v_context->_target->__pyx_vtab)->_handleSaxComment(__pyx_v_context->_target, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 663, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_v_comment = __pyx_t_7;
        __pyx_t_7 = 0;

        /* "src/lxml/saxparser.pxi":664
 *     try:
 *         comment = context._target._handleSaxComment(funicodeOrEmpty(c_data))
 *         if context._event_filter & PARSE_EVENT_FILTER_COMMENT:             # <<<<<<<<<<<<<<
 *             context.events_iterator._events.append(('comment', comment))
 *     except:
*/
        __pyx_t_1 = ((__pyx_v_context->_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_COMMENT) != 0);
        if (__pyx_t_1) {

          /* "src/lxml/saxparser.pxi":665
 *         comment = context._target._handleSaxComment(funicodeOrEmpty(c_data))
 *         if context._event_filter & PARSE_EVENT_FILTER_COMMENT:
 *             context.events_iterator._events.append(('comment', comment))             # <<<<<<<<<<<<<<
 *     except:
 *         context._handleSaxException(c_ctxt)
*/
          if (unlikely(__pyx_v_context->events_iterator->_events == Py_None)) {
            PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
            __PYX_ERR(5, 665, __pyx_L9_error)
          }
          __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 665, __pyx_L9_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_comment);
          __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_comment);
          if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_mstate_global->__pyx_n_u_comment) != (0)) __PYX_ERR(5, 665, __pyx_L9_error);
          __Pyx_INCREF(__pyx_v_comment);
          __Pyx_GIVEREF(__pyx_v_comment);
          if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_comment) != (0)) __PYX_ERR(5, 665, __pyx_L9_error);
          __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_context->events_iterator->_events, __pyx_t_7); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(5, 665, __pyx_L9_error)
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

          /* "src/lxml/saxparser.pxi":664
 *     try:
 *         comment = context._target._handleSaxComment(funicodeOrEmpty(c_data))
 *         if context._event_filter & PARSE_EVENT_FILTER_COMMENT:             # <<<<<<<<<<<<<<
 *             context.events_iterator._events.append(('comment', comment))
 *     except:
*/
        }

        /* "src/lxml/saxparser.pxi":662
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:             # <<<<<<<<<<<<<<
 *         comment = context._target._handleSaxComment(funicodeOrEmpty(c_data))
 *         if context._event_filter & PARSE_EVENT_FILTER_COMMENT:
*/
      }
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L14_try_end;
      __pyx_L9_error:;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "src/lxml/saxparser.pxi":666
 *         if context._event_filter & PARSE_EVENT_FILTER_COMMENT:
 *             context.events_iterator._events.append(('comment', comment))
 *     except:             # <<<<<<<<<<<<<<
 *         context._handleSaxException(c_ctxt)
 *     finally:
*/
      /*except:*/ {
        __Pyx_AddTraceback("lxml.etree._handleSaxTargetComment", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_3, &__pyx_t_9) < 0) __PYX_ERR(5, 666, __pyx_L11_except_error)
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_3);
        __Pyx_XGOTREF(__pyx_t_9);

        /* "src/lxml/saxparser.pxi":667
 *             context.events_iterator._events.append(('comment', comment))
 *     except:
 *         context._handleSaxException(c_ctxt)             # <<<<<<<<<<<<<<
 *     finally:
 *         return  # swallow any further exceptions
*/
        ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->_handleSaxException(__pyx_v_context, __pyx_v_c_ctxt);
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L10_exception_handled;
      }

      /* "src/lxml/saxparser.pxi":662
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:             # <<<<<<<<<<<<<<
 *         comment = context._target._handleSaxComment(funicodeOrEmpty(c_data))
 *         if context._event_filter & PARSE_EVENT_FILTER_COMMENT:
*/
      __pyx_L11_except_error:;
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
      goto __pyx_L7_error;
      __pyx_L10_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
      __pyx_L14_try_end:;
    }
  }

  /* "src/lxml/saxparser.pxi":669
 *         context._handleSaxException(c_ctxt)
 *     finally:
 *         return  # swallow any further exceptions             # <<<<<<<<<<<<<<
 * 
 * 
*/
  /*finally:*/ {
    /*normal exit:*/{
      goto __pyx_L0;
    }
    __pyx_L7_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_6 = 0; __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      if ( unlikely(__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4) < 0)) __Pyx_ErrFetch(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      {
        goto __pyx_L18_return;
      }
      __pyx_L18_return:;
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      goto __pyx_L0;
    }
  }

  /* "src/lxml/saxparser.pxi":656
 * 
 * 
 * cdef void _handleSaxTargetComment(void* ctxt, const_xmlChar* c_data) noexcept with gil:             # <<<<<<<<<<<<<<
 *     # can only be called if parsing with a target
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_comment);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
}

/* "src/lxml/saxparser.pxi":672
 * 
 * 
 * cdef void _handleSaxComment(void* ctxt, const_xmlChar* text) noexcept with gil:             # <<<<<<<<<<<<<<
 *     # can only be called when collecting comment events
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
*/

static void __pyx_f_4lxml_5etree__handleSaxComment(void *__pyx_v_ctxt, const xmlChar *__pyx_v_text) {
  xmlParserCtxt *__pyx_v_c_ctxt;
  struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_context = NULL;
  xmlNode *__pyx_v_c_node;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("_handleSaxComment", 0);

  /* "src/lxml/saxparser.pxi":674
 * cdef void _handleSaxComment(void* ctxt, const_xmlChar* text) noexcept with gil:
 *     # can only be called when collecting comment events
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt             # <<<<<<<<<<<<<<
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):
 *         return
*/
  __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt);

  /* "src/lxml/saxparser.pxi":675
 *     # can only be called when collecting comment events
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
*/
  __pyx_t_2 = (__pyx_v_c_ctxt->_private == NULL);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = xmlCtxtIsStopped(__pyx_v_c_ctxt);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/saxparser.pxi":676
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):
 *         return             # <<<<<<<<<<<<<<
 *     context = <_SaxParserContext>c_ctxt._private
 *     context._origSaxComment(ctxt, text)
*/
    goto __pyx_L0;

    /* "src/lxml/saxparser.pxi":675
 *     # can only be called when collecting comment events
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
*/
  }

  /* "src/lxml/saxparser.pxi":677
 *     if c_ctxt._private is NULL or xmlparser.xmlCtxtIsStopped(c_ctxt):
 *         return
 *     context = <_SaxParserContext>c_ctxt._private             # <<<<<<<<<<<<<<
 *     context._origSaxComment(ctxt, text)
 *     c_node = _findLastEventNode(c_ctxt)
*/
  __pyx_t_3 = ((PyObject *)__pyx_v_c_ctxt->_private);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/saxparser.pxi":678
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     context._origSaxComment(ctxt, text)             # <<<<<<<<<<<<<<
 *     c_node = _findLastEventNode(c_ctxt)
 *     if c_node is NULL:
*/
  __pyx_v_context->_origSaxComment(__pyx_v_ctxt, __pyx_v_text);

  /* "src/lxml/saxparser.pxi":679
 *     context = <_SaxParserContext>c_ctxt._private
 *     context._origSaxComment(ctxt, text)
 *     c_node = _findLastEventNode(c_ctxt)             # <<<<<<<<<<<<<<
 *     if c_node is NULL:
 *         return
*/
  __pyx_v_c_node = __pyx_f_4lxml_5etree__findLastEventNode(__pyx_v_c_ctxt);

  /* "src/lxml/saxparser.pxi":680
 *     context._origSaxComment(ctxt, text)
 *     c_node = _findLastEventNode(c_ctxt)
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         return
 *     try:
*/
  __pyx_t_1 = (__pyx_v_c_node == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/saxparser.pxi":681
 *     c_node = _findLastEventNode(c_ctxt)
 *     if c_node is NULL:
 *         return             # <<<<<<<<<<<<<<
 *     try:
 *         context.pushEvent('comment', c_node)
*/
    goto __pyx_L0;

    /* "src/lxml/saxparser.pxi":680
 *     context._origSaxComment(ctxt, text)
 *     c_node = _findLastEventNode(c_ctxt)
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         return
 *     try:
*/
  }

  /* "src/lxml/saxparser.pxi":682
 *     if c_node is NULL:
 *         return
 *     try:             # <<<<<<<<<<<<<<
 *         context.pushEvent('comment', c_node)
 *     except:
*/
  /*try:*/ {
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_6);
      /*try:*/ {

        /* "src/lxml/saxparser.pxi":683
 *         return
 *     try:
 *         context.pushEvent('comment', c_node)             # <<<<<<<<<<<<<<
 *     except:
 *         context._handleSaxException(c_ctxt)
*/
        __pyx_t_7 = ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->pushEvent(__pyx_v_context, __pyx_mstate_global->__pyx_n_u_comment, __pyx_v_c_node); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(5, 683, __pyx_L10_error)

        /* "src/lxml/saxparser.pxi":682
 *     if c_node is NULL:
 *         return
 *     try:             # <<<<<<<<<<<<<<
 *         context.pushEvent('comment', c_node)
 *     except:
*/
      }
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L15_try_end;
      __pyx_L10_error:;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "src/lxml/saxparser.pxi":684
 *     try:
 *         context.pushEvent('comment', c_node)
 *     except:             # <<<<<<<<<<<<<<
 *         context._handleSaxException(c_ctxt)
 *     finally:
*/
      /*except:*/ {
        __Pyx_AddTraceback("lxml.etree._handleSaxComment", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_8, &__pyx_t_9) < 0) __PYX_ERR(5, 684, __pyx_L12_except_error)
        __Pyx_XGOTREF(__pyx_t_3);
        __Pyx_XGOTREF(__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_9);

        /* "src/lxml/saxparser.pxi":685
 *         context.pushEvent('comment', c_node)
 *     except:
 *         context._handleSaxException(c_ctxt)             # <<<<<<<<<<<<<<
 *     finally:
 *         return  # swallow any further exceptions
*/
        ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->_handleSaxException(__pyx_v_context, __pyx_v_c_ctxt);
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L11_exception_handled;
      }

      /* "src/lxml/saxparser.pxi":682
 *     if c_node is NULL:
 *         return
 *     try:             # <<<<<<<<<<<<<<
 *         context.pushEvent('comment', c_node)
 *     except:
*/
      __pyx_L12_except_error:;
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
      goto __pyx_L8_error;
      __pyx_L11_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
      __pyx_L15_try_end:;
    }
  }

  /* "src/lxml/saxparser.pxi":687
 *         context._handleSaxException(c_ctxt)
 *     finally:
 *         return  # swallow any further exceptions             # <<<<<<<<<<<<<<
 * 
 * 
*/
  /*finally:*/ {
    /*normal exit:*/{
      goto __pyx_L0;
    }
    __pyx_L8_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_6 = 0; __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      if ( unlikely(__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4) < 0)) __Pyx_ErrFetch(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      {
        goto __pyx_L18_return;
      }
      __pyx_L18_return:;
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      goto __pyx_L0;
    }
  }

  /* "src/lxml/saxparser.pxi":672
 * 
 * 
 * cdef void _handleSaxComment(void* ctxt, const_xmlChar* text) noexcept with gil:             # <<<<<<<<<<<<<<
 *     # can only be called when collecting comment events
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
}

/* "src/lxml/saxparser.pxi":690
 * 
 * 
 * cdef inline xmlNode* _findLastEventNode(xmlparser.xmlParserCtxt* c_ctxt) noexcept:             # <<<<<<<<<<<<<<
 *     # this mimics what libxml2 creates for comments/PIs
 *     if c_ctxt.inSubset == 1:
*/

static CYTHON_INLINE xmlNode *__pyx_f_4lxml_5etree__findLastEventNode(xmlParserCtxt *__pyx_v_c_ctxt) {
  xmlNode *__pyx_r;
  int __pyx_t_1;

  /* "src/lxml/saxparser.pxi":692
 * cdef inline xmlNode* _findLastEventNode(xmlparser.xmlParserCtxt* c_ctxt) noexcept:
 *     # this mimics what libxml2 creates for comments/PIs
 *     if c_ctxt.inSubset == 1:             # <<<<<<<<<<<<<<
 *         return c_ctxt.myDoc.intSubset.last
 *     elif c_ctxt.inSubset == 2:
*/
  __pyx_t_1 = (__pyx_v_c_ctxt->inSubset == 1);
  if (__pyx_t_1) {

    /* "src/lxml/saxparser.pxi":693
 *     # this mimics what libxml2 creates for comments/PIs
 *     if c_ctxt.inSubset == 1:
 *         return c_ctxt.myDoc.intSubset.last             # <<<<<<<<<<<<<<
 *     elif c_ctxt.inSubset == 2:
 *         return c_ctxt.myDoc.extSubset.last
*/
    __pyx_r = __pyx_v_c_ctxt->myDoc->intSubset->last;
    goto __pyx_L0;

    /* "src/lxml/saxparser.pxi":692
 * cdef inline xmlNode* _findLastEventNode(xmlparser.xmlParserCtxt* c_ctxt) noexcept:
 *     # this mimics what libxml2 creates for comments/PIs
 *     if c_ctxt.inSubset == 1:             # <<<<<<<<<<<<<<
 *         return c_ctxt.myDoc.intSubset.last
 *     elif c_ctxt.inSubset == 2:
*/
  }

  /* "src/lxml/saxparser.pxi":694
 *     if c_ctxt.inSubset == 1:
 *         return c_ctxt.myDoc.intSubset.last
 *     elif c_ctxt.inSubset == 2:             # <<<<<<<<<<<<<<
 *         return c_ctxt.myDoc.extSubset.last
 *     elif c_ctxt.node is NULL:
*/
  __pyx_t_1 = (__pyx_v_c_ctxt->inSubset == 2);
  if (__pyx_t_1) {

    /* "src/lxml/saxparser.pxi":695
 *         return c_ctxt.myDoc.intSubset.last
 *     elif c_ctxt.inSubset == 2:
 *         return c_ctxt.myDoc.extSubset.last             # <<<<<<<<<<<<<<
 *     elif c_ctxt.node is NULL:
 *         return c_ctxt.myDoc.last
*/
    __pyx_r = __pyx_v_c_ctxt->myDoc->extSubset->last;
    goto __pyx_L0;

    /* "src/lxml/saxparser.pxi":694
 *     if c_ctxt.inSubset == 1:
 *         return c_ctxt.myDoc.intSubset.last
 *     elif c_ctxt.inSubset == 2:             # <<<<<<<<<<<<<<
 *         return c_ctxt.myDoc.extSubset.last
 *     elif c_ctxt.node is NULL:
*/
  }

  /* "src/lxml/saxparser.pxi":696
 *     elif c_ctxt.inSubset == 2:
 *         return c_ctxt.myDoc.extSubset.last
 *     elif c_ctxt.node is NULL:             # <<<<<<<<<<<<<<
 *         return c_ctxt.myDoc.last
 *     elif c_ctxt.node.type == tree.XML_ELEMENT_NODE:
*/
  __pyx_t_1 = (__pyx_v_c_ctxt->node == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/saxparser.pxi":697
 *         return c_ctxt.myDoc.extSubset.last
 *     elif c_ctxt.node is NULL:
 *         return c_ctxt.myDoc.last             # <<<<<<<<<<<<<<
 *     elif c_ctxt.node.type == tree.XML_ELEMENT_NODE:
 *         return c_ctxt.node.last
*/
    __pyx_r = __pyx_v_c_ctxt->myDoc->last;
    goto __pyx_L0;

    /* "src/lxml/saxparser.pxi":696
 *     elif c_ctxt.inSubset == 2:
 *         return c_ctxt.myDoc.extSubset.last
 *     elif c_ctxt.node is NULL:             # <<<<<<<<<<<<<<
 *         return c_ctxt.myDoc.last
 *     elif c_ctxt.node.type == tree.XML_ELEMENT_NODE:
*/
  }

  /* "src/lxml/saxparser.pxi":698
 *     elif c_ctxt.node is NULL:
 *         return c_ctxt.myDoc.last
 *     elif c_ctxt.node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         return c_ctxt.node.last
 *     else:
*/
  __pyx_t_1 = (__pyx_v_c_ctxt->node->type == XML_ELEMENT_NODE);
  if (__pyx_t_1) {

    /* "src/lxml/saxparser.pxi":699
 *         return c_ctxt.myDoc.last
 *     elif c_ctxt.node.type == tree.XML_ELEMENT_NODE:
 *         return c_ctxt.node.last             # <<<<<<<<<<<<<<
 *     else:
 *         return c_ctxt.node.next
*/
    __pyx_r = __pyx_v_c_ctxt->node->last;
    goto __pyx_L0;

    /* "src/lxml/saxparser.pxi":698
 *     elif c_ctxt.node is NULL:
 *         return c_ctxt.myDoc.last
 *     elif c_ctxt.node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         return c_ctxt.node.last
 *     else:
*/
  }

  /* "src/lxml/saxparser.pxi":701
 *         return c_ctxt.node.last
 *     else:
 *         return c_ctxt.node.next             # <<<<<<<<<<<<<<
 * 
 * 
*/
  /*else*/ {
    __pyx_r = __pyx_v_c_ctxt->node->next;
    goto __pyx_L0;
  }

  /* "src/lxml/saxparser.pxi":690
 * 
 * 
 * cdef inline xmlNode* _findLastEventNode(xmlparser.xmlParserCtxt* c_ctxt) noexcept:             # <<<<<<<<<<<<<<
 *     # this mimics what libxml2 creates for comments/PIs
 *     if c_ctxt.inSubset == 1:
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/saxparser.pxi":735
 *     cdef bint _insert_pis
 * 
 *     def __init__(self, *, element_factory=None, parser=None,             # <<<<<<<<<<<<<<
 *                  comment_factory=None, pi_factory=None,
 *                  bint insert_comments=True, bint insert_pis=True):
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_11TreeBuilder_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_11TreeBuilder_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_element_factory = 0;
  PyObject *__pyx_v_parser = 0;
  PyObject *__pyx_v_comment_factory = 0;
  PyObject *__pyx_v_pi_factory = 0;
  int __pyx_v_insert_comments;
  int __pyx_v_insert_pis;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[6] = {0,0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_element_factory,&__pyx_mstate_global->__pyx_n_u_parser,&__pyx_mstate_global->__pyx_n_u_comment_factory,&__pyx_mstate_global->__pyx_n_u_pi_factory,&__pyx_mstate_global->__pyx_n_u_insert_comments,&__pyx_mstate_global->__pyx_n_u_insert_pis,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(5, 735, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, 0, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(5, 735, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "src/lxml/saxparser.pxi":736
 * 
 *     def __init__(self, *, element_factory=None, parser=None,
 *                  comment_factory=None, pi_factory=None,             # <<<<<<<<<<<<<<
 *                  bint insert_comments=True, bint insert_pis=True):
 *         self._sax_event_filter = \
*/
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
    } else if (unlikely(__pyx_nargs != 0)) {
      goto __pyx_L5_argtuple_error;
    } else {

      /* "src/lxml/saxparser.pxi":735
 *     cdef bint _insert_pis
 * 
 *     def __init__(self, *, element_factory=None, parser=None,             # <<<<<<<<<<<<<<
 *                  comment_factory=None, pi_factory=None,
 *                  bint insert_comments=True, bint insert_pis=True):
*/
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "src/lxml/saxparser.pxi":736
 * 
 *     def __init__(self, *, element_factory=None, parser=None,
 *                  comment_factory=None, pi_factory=None,             # <<<<<<<<<<<<<<
 *                  bint insert_comments=True, bint insert_pis=True):
 *         self._sax_event_filter = \
*/
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_element_factory = values[0];
    __pyx_v_parser = values[1];
    __pyx_v_comment_factory = values[2];
    __pyx_v_pi_factory = values[3];
    if (values[4]) {
      __pyx_v_insert_comments = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_insert_comments == (int)-1) && PyErr_Occurred())) __PYX_ERR(5, 737, __pyx_L3_error)
    } else {

      /* "src/lxml/saxparser.pxi":737
 *     def __init__(self, *, element_factory=None, parser=None,
 *                  comment_factory=None, pi_factory=None,
 *                  bint insert_comments=True, bint insert_pis=True):             # <<<<<<<<<<<<<<
 *         self._sax_event_filter = \
 *             SAX_EVENT_START | SAX_EVENT_END | SAX_EVENT_DATA | \
*/
      __pyx_v_insert_comments = ((int)1);
    }
    if (values[5]) {
      __pyx_v_insert_pis = __Pyx_PyObject_IsTrue(values[5]); if (unlikely((__pyx_v_insert_pis == (int)-1) && PyErr_Occurred())) __PYX_ERR(5, 737, __pyx_L3_error)
    } else {
      __pyx_v_insert_pis = ((int)1);
    }
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, __pyx_nargs); __PYX_ERR(5, 735, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.TreeBuilder.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_11TreeBuilder___init__(((struct __pyx_obj_4lxml_5etree_TreeBuilder *)__pyx_v_self), __pyx_v_element_factory, __pyx_v_parser, __pyx_v_comment_factory, __pyx_v_pi_factory, __pyx_v_insert_comments, __pyx_v_insert_pis);

  /* "src/lxml/saxparser.pxi":735
 *     cdef bint _insert_pis
 * 
 *     def __init__(self, *, element_factory=None, parser=None,             # <<<<<<<<<<<<<<
 *                  comment_factory=None, pi_factory=None,
 *                  bint insert_comments=True, bint insert_pis=True):
*/

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_11TreeBuilder___init__(struct __pyx_obj_4lxml_5etree_TreeBuilder *__pyx_v_self, PyObject *__pyx_v_element_factory, PyObject *__pyx_v_parser, PyObject *__pyx_v_comment_factory, PyObject *__pyx_v_pi_factory, int __pyx_v_insert_comments, int __pyx_v_insert_pis) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "src/lxml/saxparser.pxi":738
 *                  comment_factory=None, pi_factory=None,
 *                  bint insert_comments=True, bint insert_pis=True):
 *         self._sax_event_filter = \             # <<<<<<<<<<<<<<
 *             SAX_EVENT_START | SAX_EVENT_END | SAX_EVENT_DATA | \
 *             SAX_EVENT_PI | SAX_EVENT_COMMENT
*/
  __pyx_v_self->__pyx_base._sax_event_filter = ((((__pyx_e_4lxml_5etree_SAX_EVENT_START | __pyx_e_4lxml_5etree_SAX_EVENT_END) | __pyx_e_4lxml_5etree_SAX_EVENT_DATA) | __pyx_e_4lxml_5etree_SAX_EVENT_PI) | __pyx_e_4lxml_5etree_SAX_EVENT_COMMENT);

  /* "src/lxml/saxparser.pxi":741
 *             SAX_EVENT_START | SAX_EVENT_END | SAX_EVENT_DATA | \
 *             SAX_EVENT_PI | SAX_EVENT_COMMENT
 *         self._data = [] # data collector             # <<<<<<<<<<<<<<
 *         self._element_stack = [] # element stack
 *         self._element_stack_pop = self._element_stack.pop
*/
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 741, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_data);
  __Pyx_DECREF(__pyx_v_self->_data);
  __pyx_v_self->_data = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/saxparser.pxi":742
 *             SAX_EVENT_PI | SAX_EVENT_COMMENT
 *         self._data = [] # data collector
 *         self._element_stack = [] # element stack             # <<<<<<<<<<<<<<
 *         self._element_stack_pop = self._element_stack.pop
 *         self._last = None # last element
*/
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 742, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_element_stack);
  __Pyx_DECREF(__pyx_v_self->_element_stack);
  __pyx_v_self->_element_stack = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/saxparser.pxi":743
 *         self._data = [] # data collector
 *         self._element_stack = [] # element stack
 *         self._element_stack_pop = self._element_stack.pop             # <<<<<<<<<<<<<<
 *         self._last = None # last element
 *         self._in_tail = 0 # true if we're after an end tag
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_element_stack, __pyx_mstate_global->__pyx_n_u_pop); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 743, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_element_stack_pop);
  __Pyx_DECREF(__pyx_v_self->_element_stack_pop);
  __pyx_v_self->_element_stack_pop = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "src/lxml/saxparser.pxi":744
 *         self._element_stack = [] # element stack
 *         self._element_stack_pop = self._element_stack.pop
 *         self._last = None # last element             # <<<<<<<<<<<<<<
 *         self._in_tail = 0 # true if we're after an end tag
 *         self._factory = element_factory
*/
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_last);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_last);
  __pyx_v_self->_last = ((struct LxmlElement *)Py_None);

  /* "src/lxml/saxparser.pxi":745
 *         self._element_stack_pop = self._element_stack.pop
 *         self._last = None # last element
 *         self._in_tail = 0 # true if we're after an end tag             # <<<<<<<<<<<<<<
 *         self._factory = element_factory
 *         self._comment_factory = comment_factory if comment_factory is not None else Comment
*/
  __pyx_v_self->_in_tail = 0;

  /* "src/lxml/saxparser.pxi":746
 *         self._last = None # last element
 *         self._in_tail = 0 # true if we're after an end tag
 *         self._factory = element_factory             # <<<<<<<<<<<<<<
 *         self._comment_factory = comment_factory if comment_factory is not None else Comment
 *         self._pi_factory = pi_factory if pi_factory is not None else ProcessingInstruction
*/
  __Pyx_INCREF(__pyx_v_element_factory);
  __Pyx_GIVEREF(__pyx_v_element_factory);
  __Pyx_GOTREF(__pyx_v_self->_factory);
  __Pyx_DECREF(__pyx_v_self->_factory);
  __pyx_v_self->_factory = __pyx_v_element_factory;

  /* "src/lxml/saxparser.pxi":747
 *         self._in_tail = 0 # true if we're after an end tag
 *         self._factory = element_factory
 *         self._comment_factory = comment_factory if comment_factory is not None else Comment             # <<<<<<<<<<<<<<
 *         self._pi_factory = pi_factory if pi_factory is not None else ProcessingInstruction
 *         self._insert_comments = insert_comments
*/
  __pyx_t_2 = (__pyx_v_comment_factory != Py_None);
  if (__pyx_t_2) {
    __Pyx_INCREF(__pyx_v_comment_factory);
    __pyx_t_1 = __pyx_v_comment_factory;
  } else {
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_Comment); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 747, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
  }
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_comment_factory);
  __Pyx_DECREF(__pyx_v_self->_comment_factory);
  __pyx_v_self->_comment_factory = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "src/lxml/saxparser.pxi":748
 *         self._factory = element_factory
 *         self._comment_factory = comment_factory if comment_factory is not None else Comment
 *         self._pi_factory = pi_factory if pi_factory is not None else ProcessingInstruction             # <<<<<<<<<<<<<<
 *         self._insert_comments = insert_comments
 *         self._insert_pis = insert_pis
*/
  __pyx_t_2 = (__pyx_v_pi_factory != Py_None);
  if (__pyx_t_2) {
    __Pyx_INCREF(__pyx_v_pi_factory);
    __pyx_t_1 = __pyx_v_pi_factory;
  } else {
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_ProcessingInstruction); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 748, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
  }
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_pi_factory);
  __Pyx_DECREF(__pyx_v_self->_pi_factory);
  __pyx_v_self->_pi_factory = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "src/lxml/saxparser.pxi":749
 *         self._comment_factory = comment_factory if comment_factory is not None else Comment
 *         self._pi_factory = pi_factory if pi_factory is not None else ProcessingInstruction
 *         self._insert_comments = insert_comments             # <<<<<<<<<<<<<<
 *         self._insert_pis = insert_pis
 *         self._parser = parser
*/
  __pyx_v_self->_insert_comments = __pyx_v_insert_comments;

  /* "src/lxml/saxparser.pxi":750
 *         self._pi_factory = pi_factory if pi_factory is not None else ProcessingInstruction
 *         self._insert_comments = insert_comments
 *         self._insert_pis = insert_pis             # <<<<<<<<<<<<<<
 *         self._parser = parser
 * 
*/
  __pyx_v_self->_insert_pis = __pyx_v_insert_pis;

  /* "src/lxml/saxparser.pxi":751
 *         self._insert_comments = insert_comments
 *         self._insert_pis = insert_pis
 *         self._parser = parser             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
*/
  __pyx_t_1 = __pyx_v_parser;
  __Pyx_INCREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__BaseParser))))) __PYX_ERR(5, 751, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_parser);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_parser);
  __pyx_v_self->_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/saxparser.pxi":735
 *     cdef bint _insert_pis
 * 
 *     def __init__(self, *, element_factory=None, parser=None,             # <<<<<<<<<<<<<<
 *                  comment_factory=None, pi_factory=None,
 *                  bint insert_comments=True, bint insert_pis=True):
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.TreeBuilder.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/saxparser.pxi":753
 *         self._parser = parser
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef int _flush(self) except -1:
 *         if self._data:
*/

static int __pyx_f_4lxml_5etree_11TreeBuilder__flush(struct __pyx_obj_4lxml_5etree_TreeBuilder *__pyx_v_self) {
  PyObject *__pyx_v_text = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_flush", 0);

  /* "src/lxml/saxparser.pxi":755
 *     @cython.final
 *     cdef int _flush(self) except -1:
 *         if self._data:             # <<<<<<<<<<<<<<
 *             if self._last is not None:
 *                 text = "".join(self._data)
*/
  if (__pyx_v_self->_data == Py_None) __pyx_t_1 = 0;
  else
  {
    Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_v_self->_data);
    if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(5, 755, __pyx_L1_error)
    __pyx_t_1 = (__pyx_temp != 0);
  }

  if (__pyx_t_1) {

    /* "src/lxml/saxparser.pxi":756
 *     cdef int _flush(self) except -1:
 *         if self._data:
 *             if self._last is not None:             # <<<<<<<<<<<<<<
 *                 text = "".join(self._data)
 *                 if self._in_tail:
*/
    __pyx_t_1 = (((PyObject *)__pyx_v_self->_last) != Py_None);
    if (__pyx_t_1) {

      /* "src/lxml/saxparser.pxi":757
 *         if self._data:
 *             if self._last is not None:
 *                 text = "".join(self._data)             # <<<<<<<<<<<<<<
 *                 if self._in_tail:
 *                     assert self._last.tail is None, "internal error (tail)"
*/
      __pyx_t_2 = __pyx_v_self->_data;
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_3 = PyUnicode_Join(__pyx_mstate_global->__pyx_kp_u__8, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 757, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_text = ((PyObject*)__pyx_t_3);
      __pyx_t_3 = 0;

      /* "src/lxml/saxparser.pxi":758
 *             if self._last is not None:
 *                 text = "".join(self._data)
 *                 if self._in_tail:             # <<<<<<<<<<<<<<
 *                     assert self._last.tail is None, "internal error (tail)"
 *                     self._last.tail = text
*/
      if (__pyx_v_self->_in_tail) {

        /* "src/lxml/saxparser.pxi":759
 *                 text = "".join(self._data)
 *                 if self._in_tail:
 *                     assert self._last.tail is None, "internal error (tail)"             # <<<<<<<<<<<<<<
 *                     self._last.tail = text
 *                 else:
*/
        #ifndef CYTHON_WITHOUT_ASSERTIONS
        if (unlikely(__pyx_assertions_enabled())) {
          __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_last), __pyx_mstate_global->__pyx_n_u_tail); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 759, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_1 = (__pyx_t_3 == Py_None);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          if (unlikely(!__pyx_t_1)) {
            __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_mstate_global->__pyx_kp_u_internal_error_tail, 0, 0);
            __PYX_ERR(5, 759, __pyx_L1_error)
          }
        }
        #else
        if ((1)); else __PYX_ERR(5, 759, __pyx_L1_error)
        #endif

        /* "src/lxml/saxparser.pxi":760
 *                 if self._in_tail:
 *                     assert self._last.tail is None, "internal error (tail)"
 *                     self._last.tail = text             # <<<<<<<<<<<<<<
 *                 else:
 *                     assert self._last.text is None, "internal error (text)"
*/
        if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self->_last), __pyx_mstate_global->__pyx_n_u_tail, __pyx_v_text) < (0)) __PYX_ERR(5, 760, __pyx_L1_error)

        /* "src/lxml/saxparser.pxi":758
 *             if self._last is not None:
 *                 text = "".join(self._data)
 *                 if self._in_tail:             # <<<<<<<<<<<<<<
 *                     assert self._last.tail is None, "internal error (tail)"
 *                     self._last.tail = text
*/
        goto __pyx_L5;
      }

      /* "src/lxml/saxparser.pxi":762
 *                     self._last.tail = text
 *                 else:
 *                     assert self._last.text is None, "internal error (text)"             # <<<<<<<<<<<<<<
 *                     self._last.text = text
 *             del self._data[:]
*/
      /*else*/ {
        #ifndef CYTHON_WITHOUT_ASSERTIONS
        if (unlikely(__pyx_assertions_enabled())) {
          __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_last), __pyx_mstate_global->__pyx_n_u_text); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 762, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_1 = (__pyx_t_3 == Py_None);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          if (unlikely(!__pyx_t_1)) {
            __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_mstate_global->__pyx_kp_u_internal_error_text, 0, 0);
            __PYX_ERR(5, 762, __pyx_L1_error)
          }
        }
        #else
        if ((1)); else __PYX_ERR(5, 762, __pyx_L1_error)
        #endif

        /* "src/lxml/saxparser.pxi":763
 *                 else:
 *                     assert self._last.text is None, "internal error (text)"
 *                     self._last.text = text             # <<<<<<<<<<<<<<
 *             del self._data[:]
 *         return 0
*/
        if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self->_last), __pyx_mstate_global->__pyx_n_u_text, __pyx_v_text) < (0)) __PYX_ERR(5, 763, __pyx_L1_error)
      }
      __pyx_L5:;

      /* "src/lxml/saxparser.pxi":756
 *     cdef int _flush(self) except -1:
 *         if self._data:
 *             if self._last is not None:             # <<<<<<<<<<<<<<
 *                 text = "".join(self._data)
 *                 if self._in_tail:
*/
    }

    /* "src/lxml/saxparser.pxi":764
 *                     assert self._last.text is None, "internal error (text)"
 *                     self._last.text = text
 *             del self._data[:]             # <<<<<<<<<<<<<<
 *         return 0
 * 
*/
    if (unlikely(__pyx_v_self->_data == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(5, 764, __pyx_L1_error)
    }
    if (__Pyx_PyObject_DelSlice(__pyx_v_self->_data, 0, 0, NULL, NULL, NULL, 0, 0, 1) < (0)) __PYX_ERR(5, 764, __pyx_L1_error)

    /* "src/lxml/saxparser.pxi":755
 *     @cython.final
 *     cdef int _flush(self) except -1:
 *         if self._data:             # <<<<<<<<<<<<<<
 *             if self._last is not None:
 *                 text = "".join(self._data)
*/
  }

  /* "src/lxml/saxparser.pxi":765
 *                     self._last.text = text
 *             del self._data[:]
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     # internal SAX event handlers
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/saxparser.pxi":753
 *         self._parser = parser
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef int _flush(self) except -1:
 *         if self._data:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.TreeBuilder._flush", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_text);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/saxparser.pxi":769
 *     # internal SAX event handlers
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef _handleSaxStart(self, tag, attrib, nsmap):
 *         self._flush()
*/

static PyObject *__pyx_f_4lxml_5etree_11TreeBuilder__handleSaxStart(struct __pyx_obj_4lxml_5etree_TreeBuilder *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_attrib, PyObject *__pyx_v_nsmap) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_handleSaxStart", 0);

  /* "src/lxml/saxparser.pxi":771
 *     @cython.final
 *     cdef _handleSaxStart(self, tag, attrib, nsmap):
 *         self._flush()             # <<<<<<<<<<<<<<
 *         if self._factory is not None:
 *             self._last = self._factory(tag, attrib)
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_11TreeBuilder__flush(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(5, 771, __pyx_L1_error)

  /* "src/lxml/saxparser.pxi":772
 *     cdef _handleSaxStart(self, tag, attrib, nsmap):
 *         self._flush()
 *         if self._factory is not None:             # <<<<<<<<<<<<<<
 *             self._last = self._factory(tag, attrib)
 *             if self._element_stack:
*/
  __pyx_t_2 = (__pyx_v_self->_factory != Py_None);
  if (__pyx_t_2) {

    /* "src/lxml/saxparser.pxi":773
 *         self._flush()
 *         if self._factory is not None:
 *             self._last = self._factory(tag, attrib)             # <<<<<<<<<<<<<<
 *             if self._element_stack:
 *                 _appendChild(self._element_stack[-1], self._last)
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_v_self->_factory);
    __pyx_t_5 = __pyx_v_self->_factory; 
    __pyx_t_6 = 1;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
      assert(__pyx_t_4);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
      __pyx_t_6 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_v_tag, __pyx_v_attrib};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 773, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element))))) __PYX_ERR(5, 773, __pyx_L1_error)
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF((PyObject *)__pyx_v_self->_last);
    __Pyx_DECREF((PyObject *)__pyx_v_self->_last);
    __pyx_v_self->_last = ((struct LxmlElement *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/saxparser.pxi":774
 *         if self._factory is not None:
 *             self._last = self._factory(tag, attrib)
 *             if self._element_stack:             # <<<<<<<<<<<<<<
 *                 _appendChild(self._element_stack[-1], self._last)
 *         elif self._element_stack:
*/
    if (__pyx_v_self->_element_stack == Py_None) __pyx_t_2 = 0;
    else
    {
      Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_v_self->_element_stack);
      if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(5, 774, __pyx_L1_error)
      __pyx_t_2 = (__pyx_temp != 0);
    }

    if (__pyx_t_2) {

      /* "src/lxml/saxparser.pxi":775
 *             self._last = self._factory(tag, attrib)
 *             if self._element_stack:
 *                 _appendChild(self._element_stack[-1], self._last)             # <<<<<<<<<<<<<<
 *         elif self._element_stack:
 *             self._last = _makeSubElement(
*/
      if (unlikely(__pyx_v_self->_element_stack == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(5, 775, __pyx_L1_error)
      }
      __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_self->_element_stack, -1L, long, 1, __Pyx_PyLong_From_long, 1, 1, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 775, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element))))) __PYX_ERR(5, 775, __pyx_L1_error)
      __pyx_t_5 = ((PyObject *)__pyx_v_self->_last);
      __Pyx_INCREF(__pyx_t_5);
      __pyx_t_1 = __pyx_f_4lxml_5etree__appendChild(((struct LxmlElement *)__pyx_t_3), ((struct LxmlElement *)__pyx_t_5)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(5, 775, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "src/lxml/saxparser.pxi":774
 *         if self._factory is not None:
 *             self._last = self._factory(tag, attrib)
 *             if self._element_stack:             # <<<<<<<<<<<<<<
 *                 _appendChild(self._element_stack[-1], self._last)
 *         elif self._element_stack:
*/
    }

    /* "src/lxml/saxparser.pxi":772
 *     cdef _handleSaxStart(self, tag, attrib, nsmap):
 *         self._flush()
 *         if self._factory is not None:             # <<<<<<<<<<<<<<
 *             self._last = self._factory(tag, attrib)
 *             if self._element_stack:
*/
    goto __pyx_L3;
  }

  /* "src/lxml/saxparser.pxi":776
 *             if self._element_stack:
 *                 _appendChild(self._element_stack[-1], self._last)
 *         elif self._element_stack:             # <<<<<<<<<<<<<<
 *             self._last = _makeSubElement(
 *                 self._element_stack[-1], tag, None, None, attrib, nsmap, None)
*/
  if (__pyx_v_self->_element_stack == Py_None) __pyx_t_2 = 0;
  else
  {
    Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_v_self->_element_stack);
    if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(5, 776, __pyx_L1_error)
    __pyx_t_2 = (__pyx_temp != 0);
  }

  if (__pyx_t_2) {

    /* "src/lxml/saxparser.pxi":778
 *         elif self._element_stack:
 *             self._last = _makeSubElement(
 *                 self._element_stack[-1], tag, None, None, attrib, nsmap, None)             # <<<<<<<<<<<<<<
 *         else:
 *             self._last = _makeElement(
*/
    if (unlikely(__pyx_v_self->_element_stack == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(5, 778, __pyx_L1_error)
    }
    __pyx_t_5 = __Pyx_GetItemInt_List(__pyx_v_self->_element_stack, -1L, long, 1, __Pyx_PyLong_From_long, 1, 1, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 778, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element))))) __PYX_ERR(5, 778, __pyx_L1_error)

    /* "src/lxml/saxparser.pxi":777
 *                 _appendChild(self._element_stack[-1], self._last)
 *         elif self._element_stack:
 *             self._last = _makeSubElement(             # <<<<<<<<<<<<<<
 *                 self._element_stack[-1], tag, None, None, attrib, nsmap, None)
 *         else:
*/
    __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__makeSubElement(((struct LxmlElement *)__pyx_t_5), __pyx_v_tag, Py_None, Py_None, __pyx_v_attrib, __pyx_v_nsmap, ((PyObject*)Py_None))); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 777, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF((PyObject *)__pyx_v_self->_last);
    __Pyx_DECREF((PyObject *)__pyx_v_self->_last);
    __pyx_v_self->_last = ((struct LxmlElement *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/saxparser.pxi":776
 *             if self._element_stack:
 *                 _appendChild(self._element_stack[-1], self._last)
 *         elif self._element_stack:             # <<<<<<<<<<<<<<
 *             self._last = _makeSubElement(
 *                 self._element_stack[-1], tag, None, None, attrib, nsmap, None)
*/
    goto __pyx_L3;
  }

  /* "src/lxml/saxparser.pxi":780
 *                 self._element_stack[-1], tag, None, None, attrib, nsmap, None)
 *         else:
 *             self._last = _makeElement(             # <<<<<<<<<<<<<<
 *                 tag, NULL, None, self._parser, None, None, attrib, nsmap, None)
 *         self._element_stack.append(self._last)
*/
  /*else*/ {

    /* "src/lxml/saxparser.pxi":781
 *         else:
 *             self._last = _makeElement(
 *                 tag, NULL, None, self._parser, None, None, attrib, nsmap, None)             # <<<<<<<<<<<<<<
 *         self._element_stack.append(self._last)
 *         self._in_tail = 0
*/
    __pyx_t_3 = ((PyObject *)__pyx_v_self->_parser);
    __Pyx_INCREF(__pyx_t_3);

    /* "src/lxml/saxparser.pxi":780
 *                 self._element_stack[-1], tag, None, None, attrib, nsmap, None)
 *         else:
 *             self._last = _makeElement(             # <<<<<<<<<<<<<<
 *                 tag, NULL, None, self._parser, None, None, attrib, nsmap, None)
 *         self._element_stack.append(self._last)
*/
    __pyx_t_5 = ((PyObject *)__pyx_f_4lxml_5etree__makeElement(__pyx_v_tag, NULL, ((struct LxmlDocument *)Py_None), ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_3), Py_None, Py_None, __pyx_v_attrib, __pyx_v_nsmap, ((PyObject*)Py_None))); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 780, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GIVEREF(__pyx_t_5);
    __Pyx_GOTREF((PyObject *)__pyx_v_self->_last);
    __Pyx_DECREF((PyObject *)__pyx_v_self->_last);
    __pyx_v_self->_last = ((struct LxmlElement *)__pyx_t_5);
    __pyx_t_5 = 0;
  }
  __pyx_L3:;

  /* "src/lxml/saxparser.pxi":782
 *             self._last = _makeElement(
 *                 tag, NULL, None, self._parser, None, None, attrib, nsmap, None)
 *         self._element_stack.append(self._last)             # <<<<<<<<<<<<<<
 *         self._in_tail = 0
 *         return self._last
*/
  if (unlikely(__pyx_v_self->_element_stack == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
    __PYX_ERR(5, 782, __pyx_L1_error)
  }
  __pyx_t_5 = ((PyObject *)__pyx_v_self->_last);
  __Pyx_INCREF(__pyx_t_5);
  __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_self->_element_stack, __pyx_t_5); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(5, 782, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "src/lxml/saxparser.pxi":783
 *                 tag, NULL, None, self._parser, None, None, attrib, nsmap, None)
 *         self._element_stack.append(self._last)
 *         self._in_tail = 0             # <<<<<<<<<<<<<<
 *         return self._last
 * 
*/
  __pyx_v_self->_in_tail = 0;

  /* "src/lxml/saxparser.pxi":784
 *         self._element_stack.append(self._last)
 *         self._in_tail = 0
 *         return self._last             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_self->_last);
  __pyx_r = ((PyObject *)__pyx_v_self->_last);
  goto __pyx_L0;

  /* "src/lxml/saxparser.pxi":769
 *     # internal SAX event handlers
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef _handleSaxStart(self, tag, attrib, nsmap):
 *         self._flush()
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree.TreeBuilder._handleSaxStart", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/saxparser.pxi":786
 *         return self._last
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef _handleSaxEnd(self, tag):
 *         self._flush()
*/

static PyObject *__pyx_f_4lxml_5etree_11TreeBuilder__handleSaxEnd(struct __pyx_obj_4lxml_5etree_TreeBuilder *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_tag) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_handleSaxEnd", 0);

  /* "src/lxml/saxparser.pxi":788
 *     @cython.final
 *     cdef _handleSaxEnd(self, tag):
 *         self._flush()             # <<<<<<<<<<<<<<
 *         self._last = self._element_stack_pop()
 *         self._in_tail = 1
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_11TreeBuilder__flush(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(5, 788, __pyx_L1_error)

  /* "src/lxml/saxparser.pxi":789
 *     cdef _handleSaxEnd(self, tag):
 *         self._flush()
 *         self._last = self._element_stack_pop()             # <<<<<<<<<<<<<<
 *         self._in_tail = 1
 *         return self._last
*/
  __pyx_t_3 = NULL;
  __Pyx_INCREF(__pyx_v_self->_element_stack_pop);
  __pyx_t_4 = __pyx_v_self->_element_stack_pop; 
  __pyx_t_5 = 1;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    assert(__pyx_t_3);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
    __pyx_t_5 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 789, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element))))) __PYX_ERR(5, 789, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_last);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_last);
  __pyx_v_self->_last = ((struct LxmlElement *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/saxparser.pxi":790
 *         self._flush()
 *         self._last = self._element_stack_pop()
 *         self._in_tail = 1             # <<<<<<<<<<<<<<
 *         return self._last
 * 
*/
  __pyx_v_self->_in_tail = 1;

  /* "src/lxml/saxparser.pxi":791
 *         self._last = self._element_stack_pop()
 *         self._in_tail = 1
 *         return self._last             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_self->_last);
  __pyx_r = ((PyObject *)__pyx_v_self->_last);
  goto __pyx_L0;

  /* "src/lxml/saxparser.pxi":786
 *         return self._last
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef _handleSaxEnd(self, tag):
 *         self._flush()
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.TreeBuilder._handleSaxEnd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/saxparser.pxi":793
 *         return self._last
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef int _handleSaxData(self, data) except -1:
 *         self._data.append(data)
*/

static int __pyx_f_4lxml_5etree_11TreeBuilder__handleSaxData(struct __pyx_obj_4lxml_5etree_TreeBuilder *__pyx_v_self, PyObject *__pyx_v_data) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/saxparser.pxi":795
 *     @cython.final
 *     cdef int _handleSaxData(self, data) except -1:
 *         self._data.append(data)             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
*/
  if (unlikely(__pyx_v_self->_data == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
    __PYX_ERR(5, 795, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyList_Append(__pyx_v_self->_data, __pyx_v_data); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(5, 795, __pyx_L1_error)

  /* "src/lxml/saxparser.pxi":793
 *         return self._last
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef int _handleSaxData(self, data) except -1:
 *         self._data.append(data)
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.TreeBuilder._handleSaxData", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/saxparser.pxi":797
 *         self._data.append(data)
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef _handleSaxPi(self, target, data):
 *         elem = self._pi_factory(target, data)
*/

static PyObject *__pyx_f_4lxml_5etree_11TreeBuilder__handleSaxPi(struct __pyx_obj_4lxml_5etree_TreeBuilder *__pyx_v_self, PyObject *__pyx_v_target, PyObject *__pyx_v_data) {
  PyObject *__pyx_v_elem = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_handleSaxPi", 0);

  /* "src/lxml/saxparser.pxi":799
 *     @cython.final
 *     cdef _handleSaxPi(self, target, data):
 *         elem = self._pi_factory(target, data)             # <<<<<<<<<<<<<<
 *         if self._insert_pis:
 *             self._flush()
*/
  __pyx_t_2 = NULL;
  __Pyx_INCREF(__pyx_v_self->_pi_factory);
  __pyx_t_3 = __pyx_v_self->_pi_factory; 
  __pyx_t_4 = 1;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_4 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_v_target, __pyx_v_data};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 799, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v_elem = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "src/lxml/saxparser.pxi":800
 *     cdef _handleSaxPi(self, target, data):
 *         elem = self._pi_factory(target, data)
 *         if self._insert_pis:             # <<<<<<<<<<<<<<
 *             self._flush()
 *             self._last = elem
*/
  if (__pyx_v_self->_insert_pis) {

    /* "src/lxml/saxparser.pxi":801
 *         elem = self._pi_factory(target, data)
 *         if self._insert_pis:
 *             self._flush()             # <<<<<<<<<<<<<<
 *             self._last = elem
 *             if self._element_stack:
*/
    __pyx_t_5 = __pyx_f_4lxml_5etree_11TreeBuilder__flush(__pyx_v_self); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(5, 801, __pyx_L1_error)

    /* "src/lxml/saxparser.pxi":802
 *         if self._insert_pis:
 *             self._flush()
 *             self._last = elem             # <<<<<<<<<<<<<<
 *             if self._element_stack:
 *                 _appendChild(self._element_stack[-1], self._last)
*/
    __pyx_t_1 = __pyx_v_elem;
    __Pyx_INCREF(__pyx_t_1);
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element))))) __PYX_ERR(5, 802, __pyx_L1_error)
    __Pyx_GIVEREF(__pyx_t_1);
    __Pyx_GOTREF((PyObject *)__pyx_v_self->_last);
    __Pyx_DECREF((PyObject *)__pyx_v_self->_last);
    __pyx_v_self->_last = ((struct LxmlElement *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/saxparser.pxi":803
 *             self._flush()
 *             self._last = elem
 *             if self._element_stack:             # <<<<<<<<<<<<<<
 *                 _appendChild(self._element_stack[-1], self._last)
 *             self._in_tail = 1
*/
    if (__pyx_v_self->_element_stack == Py_None) __pyx_t_6 = 0;
    else
    {
      Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_v_self->_element_stack);
      if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(5, 803, __pyx_L1_error)
      __pyx_t_6 = (__pyx_temp != 0);
    }

    if (__pyx_t_6) {

      /* "src/lxml/saxparser.pxi":804
 *             self._last = elem
 *             if self._element_stack:
 *                 _appendChild(self._element_stack[-1], self._last)             # <<<<<<<<<<<<<<
 *             self._in_tail = 1
 *         return self._last
*/
      if (unlikely(__pyx_v_self->_element_stack == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(5, 804, __pyx_L1_error)
      }
      __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_self->_element_stack, -1L, long, 1, __Pyx_PyLong_From_long, 1, 1, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 804, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element))))) __PYX_ERR(5, 804, __pyx_L1_error)
      __pyx_t_3 = ((PyObject *)__pyx_v_self->_last);
      __Pyx_INCREF(__pyx_t_3);
      __pyx_t_5 = __pyx_f_4lxml_5etree__appendChild(((struct LxmlElement *)__pyx_t_1), ((struct LxmlElement *)__pyx_t_3)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(5, 804, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "src/lxml/saxparser.pxi":803
 *             self._flush()
 *             self._last = elem
 *             if self._element_stack:             # <<<<<<<<<<<<<<
 *                 _appendChild(self._element_stack[-1], self._last)
 *             self._in_tail = 1
*/
    }

    /* "src/lxml/saxparser.pxi":805
 *             if self._element_stack:
 *                 _appendChild(self._element_stack[-1], self._last)
 *             self._in_tail = 1             # <<<<<<<<<<<<<<
 *         return self._last
 * 
*/
    __pyx_v_self->_in_tail = 1;

    /* "src/lxml/saxparser.pxi":800
 *     cdef _handleSaxPi(self, target, data):
 *         elem = self._pi_factory(target, data)
 *         if self._insert_pis:             # <<<<<<<<<<<<<<
 *             self._flush()
 *             self._last = elem
*/
  }

  /* "src/lxml/saxparser.pxi":806
 *                 _appendChild(self._element_stack[-1], self._last)
 *             self._in_tail = 1
 *         return self._last             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_self->_last);
  __pyx_r = ((PyObject *)__pyx_v_self->_last);
  goto __pyx_L0;

  /* "src/lxml/saxparser.pxi":797
 *         self._data.append(data)
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef _handleSaxPi(self, target, data):
 *         elem = self._pi_factory(target, data)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.TreeBuilder._handleSaxPi", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_elem);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/saxparser.pxi":808
 *         return self._last
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef _handleSaxComment(self, comment):
 *         elem = self._comment_factory(comment)
*/

static PyObject *__pyx_f_4lxml_5etree_11TreeBuilder__handleSaxComment(struct __pyx_obj_4lxml_5etree_TreeBuilder *__pyx_v_self, PyObject *__pyx_v_comment) {
  PyObject *__pyx_v_elem = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_handleSaxComment", 0);

  /* "src/lxml/saxparser.pxi":810
 *     @cython.final
 *     cdef _handleSaxComment(self, comment):
 *         elem = self._comment_factory(comment)             # <<<<<<<<<<<<<<
 *         if self._insert_comments:
 *             self._flush()
*/
  __pyx_t_2 = NULL;
  __Pyx_INCREF(__pyx_v_self->_comment_factory);
  __pyx_t_3 = __pyx_v_self->_comment_factory; 
  __pyx_t_4 = 1;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_4 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_comment};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 810, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v_elem = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "src/lxml/saxparser.pxi":811
 *     cdef _handleSaxComment(self, comment):
 *         elem = self._comment_factory(comment)
 *         if self._insert_comments:             # <<<<<<<<<<<<<<
 *             self._flush()
 *             self._last = elem
*/
  if (__pyx_v_self->_insert_comments) {

    /* "src/lxml/saxparser.pxi":812
 *         elem = self._comment_factory(comment)
 *         if self._insert_comments:
 *             self._flush()             # <<<<<<<<<<<<<<
 *             self._last = elem
 *             if self._element_stack:
*/
    __pyx_t_5 = __pyx_f_4lxml_5etree_11TreeBuilder__flush(__pyx_v_self); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(5, 812, __pyx_L1_error)

    /* "src/lxml/saxparser.pxi":813
 *         if self._insert_comments:
 *             self._flush()
 *             self._last = elem             # <<<<<<<<<<<<<<
 *             if self._element_stack:
 *                 _appendChild(self._element_stack[-1], self._last)
*/
    __pyx_t_1 = __pyx_v_elem;
    __Pyx_INCREF(__pyx_t_1);
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element))))) __PYX_ERR(5, 813, __pyx_L1_error)
    __Pyx_GIVEREF(__pyx_t_1);
    __Pyx_GOTREF((PyObject *)__pyx_v_self->_last);
    __Pyx_DECREF((PyObject *)__pyx_v_self->_last);
    __pyx_v_self->_last = ((struct LxmlElement *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/saxparser.pxi":814
 *             self._flush()
 *             self._last = elem
 *             if self._element_stack:             # <<<<<<<<<<<<<<
 *                 _appendChild(self._element_stack[-1], self._last)
 *             self._in_tail = 1
*/
    if (__pyx_v_self->_element_stack == Py_None) __pyx_t_6 = 0;
    else
    {
      Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_v_self->_element_stack);
      if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(5, 814, __pyx_L1_error)
      __pyx_t_6 = (__pyx_temp != 0);
    }

    if (__pyx_t_6) {

      /* "src/lxml/saxparser.pxi":815
 *             self._last = elem
 *             if self._element_stack:
 *                 _appendChild(self._element_stack[-1], self._last)             # <<<<<<<<<<<<<<
 *             self._in_tail = 1
 *         return elem
*/
      if (unlikely(__pyx_v_self->_element_stack == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(5, 815, __pyx_L1_error)
      }
      __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_self->_element_stack, -1L, long, 1, __Pyx_PyLong_From_long, 1, 1, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 815, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element))))) __PYX_ERR(5, 815, __pyx_L1_error)
      __pyx_t_3 = ((PyObject *)__pyx_v_self->_last);
      __Pyx_INCREF(__pyx_t_3);
      __pyx_t_5 = __pyx_f_4lxml_5etree__appendChild(((struct LxmlElement *)__pyx_t_1), ((struct LxmlElement *)__pyx_t_3)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(5, 815, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "src/lxml/saxparser.pxi":814
 *             self._flush()
 *             self._last = elem
 *             if self._element_stack:             # <<<<<<<<<<<<<<
 *                 _appendChild(self._element_stack[-1], self._last)
 *             self._in_tail = 1
*/
    }

    /* "src/lxml/saxparser.pxi":816
 *             if self._element_stack:
 *                 _appendChild(self._element_stack[-1], self._last)
 *             self._in_tail = 1             # <<<<<<<<<<<<<<
 *         return elem
 * 
*/
    __pyx_v_self->_in_tail = 1;

    /* "src/lxml/saxparser.pxi":811
 *     cdef _handleSaxComment(self, comment):
 *         elem = self._comment_factory(comment)
 *         if self._insert_comments:             # <<<<<<<<<<<<<<
 *             self._flush()
 *             self._last = elem
*/
  }

  /* "src/lxml/saxparser.pxi":817
 *                 _appendChild(self._element_stack[-1], self._last)
 *             self._in_tail = 1
 *         return elem             # <<<<<<<<<<<<<<
 * 
 *     # Python level event handlers
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_elem);
  __pyx_r = __pyx_v_elem;
  goto __pyx_L0;

  /* "src/lxml/saxparser.pxi":808
 *         return self._last
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef _handleSaxComment(self, comment):
 *         elem = self._comment_factory(comment)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.TreeBuilder._handleSaxComment", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_elem);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/saxparser.pxi":821
 *     # Python level event handlers
 * 
 *     def close(self):             # <<<<<<<<<<<<<<
 *         """close(self)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_11TreeBuilder_3close(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_11TreeBuilder_2close, "close(self)\n\n        Flushes the builder buffers, and returns the toplevel document\n        element.  Raises XMLSyntaxError on inconsistencies.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_11TreeBuilder_3close = {"close", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_11TreeBuilder_3close, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_11TreeBuilder_2close};
static PyObject *__pyx_pw_4lxml_5etree_11TreeBuilder_3close(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("close (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("close", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("close", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_11TreeBuilder_2close(((struct __pyx_obj_4lxml_5etree_TreeBuilder *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_11TreeBuilder_2close(struct __pyx_obj_4lxml_5etree_TreeBuilder *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("close", 0);

  /* "src/lxml/saxparser.pxi":827
 *         element.  Raises XMLSyntaxError on inconsistencies.
 *         """
 *         if self._element_stack:             # <<<<<<<<<<<<<<
 *             raise XMLSyntaxAssertionError("missing end tags")
 *         # TODO: this does not necessarily seem like an error case.  Why not just return None?
*/
  if (__pyx_v_self->_element_stack == Py_None) __pyx_t_1 = 0;
  else
  {
    Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_v_self->_element_stack);
    if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(5, 827, __pyx_L1_error)
    __pyx_t_1 = (__pyx_temp != 0);
  }

  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/saxparser.pxi":828
 *         """
 *         if self._element_stack:
 *             raise XMLSyntaxAssertionError("missing end tags")             # <<<<<<<<<<<<<<
 *         # TODO: this does not necessarily seem like an error case.  Why not just return None?
 *         if self._last is None:
*/
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_XMLSyntaxAssertionError); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 828, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_missing_end_tags};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 828, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(5, 828, __pyx_L1_error)

    /* "src/lxml/saxparser.pxi":827
 *         element.  Raises XMLSyntaxError on inconsistencies.
 *         """
 *         if self._element_stack:             # <<<<<<<<<<<<<<
 *             raise XMLSyntaxAssertionError("missing end tags")
 *         # TODO: this does not necessarily seem like an error case.  Why not just return None?
*/
  }

  /* "src/lxml/saxparser.pxi":830
 *             raise XMLSyntaxAssertionError("missing end tags")
 *         # TODO: this does not necessarily seem like an error case.  Why not just return None?
 *         if self._last is None:             # <<<<<<<<<<<<<<
 *             raise XMLSyntaxAssertionError("missing toplevel element")
 *         return self._last
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_self->_last) == Py_None);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/saxparser.pxi":831
 *         # TODO: this does not necessarily seem like an error case.  Why not just return None?
 *         if self._last is None:
 *             raise XMLSyntaxAssertionError("missing toplevel element")             # <<<<<<<<<<<<<<
 *         return self._last
 * 
*/
    __pyx_t_4 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_XMLSyntaxAssertionError); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 831, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_4);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_missing_toplevel_element};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 831, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(5, 831, __pyx_L1_error)

    /* "src/lxml/saxparser.pxi":830
 *             raise XMLSyntaxAssertionError("missing end tags")
 *         # TODO: this does not necessarily seem like an error case.  Why not just return None?
 *         if self._last is None:             # <<<<<<<<<<<<<<
 *             raise XMLSyntaxAssertionError("missing toplevel element")
 *         return self._last
*/
  }

  /* "src/lxml/saxparser.pxi":832
 *         if self._last is None:
 *             raise XMLSyntaxAssertionError("missing toplevel element")
 *         return self._last             # <<<<<<<<<<<<<<
 * 
 *     def data(self, data):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_self->_last);
  __pyx_r = ((PyObject *)__pyx_v_self->_last);
  goto __pyx_L0;

  /* "src/lxml/saxparser.pxi":821
 *     # Python level event handlers
 * 
 *     def close(self):             # <<<<<<<<<<<<<<
 *         """close(self)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.TreeBuilder.close", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/saxparser.pxi":834
 *         return self._last
 * 
 *     def data(self, data):             # <<<<<<<<<<<<<<
 *         """data(self, data)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_11TreeBuilder_5data(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_11TreeBuilder_4data, "data(self, data)\n\n        Adds text to the current element.  The value should be either an\n        8-bit string containing ASCII text, or a Unicode string.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_11TreeBuilder_5data = {"data", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_11TreeBuilder_5data, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_11TreeBuilder_4data};
static PyObject *__pyx_pw_4lxml_5etree_11TreeBuilder_5data(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_data = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("data (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_data,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(5, 834, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(5, 834, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "data", 0) < (0)) __PYX_ERR(5, 834, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("data", 1, 1, 1, i); __PYX_ERR(5, 834, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(5, 834, __pyx_L3_error)
    }
    __pyx_v_data = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("data", 1, 1, 1, __pyx_nargs); __PYX_ERR(5, 834, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.TreeBuilder.data", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_11TreeBuilder_4data(((struct __pyx_obj_4lxml_5etree_TreeBuilder *)__pyx_v_self), __pyx_v_data);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_11TreeBuilder_4data(struct __pyx_obj_4lxml_5etree_TreeBuilder *__pyx_v_self, PyObject *__pyx_v_data) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("data", 0);

  /* "src/lxml/saxparser.pxi":840
 *         8-bit string containing ASCII text, or a Unicode string.
 *         """
 *         self._handleSaxData(data)             # <<<<<<<<<<<<<<
 * 
 *     def start(self, tag, attrs, nsmap=None):
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_11TreeBuilder__handleSaxData(__pyx_v_self, __pyx_v_data); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(5, 840, __pyx_L1_error)

  /* "src/lxml/saxparser.pxi":834
 *         return self._last
 * 
 *     def data(self, data):             # <<<<<<<<<<<<<<
 *         """data(self, data)
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.TreeBuilder.data", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/saxparser.pxi":842
 *         self._handleSaxData(data)
 * 
 *     def start(self, tag, attrs, nsmap=None):             # <<<<<<<<<<<<<<
 *         """start(self, tag, attrs, nsmap=None)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_11TreeBuilder_7start(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_11TreeBuilder_6start, "start(self, tag, attrs, nsmap=None)\n\n        Opens a new element.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_11TreeBuilder_7start = {"start", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_11TreeBuilder_7start, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_11TreeBuilder_6start};
static PyObject *__pyx_pw_4lxml_5etree_11TreeBuilder_7start(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_v_attrs = 0;
  PyObject *__pyx_v_nsmap = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("start (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_tag,&__pyx_mstate_global->__pyx_n_u_attrs,&__pyx_mstate_global->__pyx_n_u_nsmap,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(5, 842, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(5, 842, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(5, 842, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(5, 842, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "start", 0) < (0)) __PYX_ERR(5, 842, __pyx_L3_error)
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("start", 0, 2, 3, i); __PYX_ERR(5, 842, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(5, 842, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(5, 842, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(5, 842, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_tag = values[0];
    __pyx_v_attrs = values[1];
    __pyx_v_nsmap = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("start", 0, 2, 3, __pyx_nargs); __PYX_ERR(5, 842, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.TreeBuilder.start", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_11TreeBuilder_6start(((struct __pyx_obj_4lxml_5etree_TreeBuilder *)__pyx_v_self), __pyx_v_tag, __pyx_v_attrs, __pyx_v_nsmap);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_11TreeBuilder_6start(struct __pyx_obj_4lxml_5etree_TreeBuilder *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_attrs, PyObject *__pyx_v_nsmap) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("start", 0);
  __Pyx_INCREF(__pyx_v_nsmap);

  /* "src/lxml/saxparser.pxi":847
 *         Opens a new element.
 *         """
 *         if nsmap is None:             # <<<<<<<<<<<<<<
 *             nsmap = IMMUTABLE_EMPTY_MAPPING
 *         return self._handleSaxStart(tag, attrs, nsmap)
*/
  __pyx_t_1 = (__pyx_v_nsmap == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/saxparser.pxi":848
 *         """
 *         if nsmap is None:
 *             nsmap = IMMUTABLE_EMPTY_MAPPING             # <<<<<<<<<<<<<<
 *         return self._handleSaxStart(tag, attrs, nsmap)
 * 
*/
    __Pyx_INCREF(__pyx_v_4lxml_5etree_IMMUTABLE_EMPTY_MAPPING);
    __Pyx_DECREF_SET(__pyx_v_nsmap, __pyx_v_4lxml_5etree_IMMUTABLE_EMPTY_MAPPING);

    /* "src/lxml/saxparser.pxi":847
 *         Opens a new element.
 *         """
 *         if nsmap is None:             # <<<<<<<<<<<<<<
 *             nsmap = IMMUTABLE_EMPTY_MAPPING
 *         return self._handleSaxStart(tag, attrs, nsmap)
*/
  }

  /* "src/lxml/saxparser.pxi":849
 *         if nsmap is None:
 *             nsmap = IMMUTABLE_EMPTY_MAPPING
 *         return self._handleSaxStart(tag, attrs, nsmap)             # <<<<<<<<<<<<<<
 * 
 *     def end(self, tag):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree_11TreeBuilder__handleSaxStart(__pyx_v_self, __pyx_v_tag, __pyx_v_attrs, __pyx_v_nsmap); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 849, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/saxparser.pxi":842
 *         self._handleSaxData(data)
 * 
 *     def start(self, tag, attrs, nsmap=None):             # <<<<<<<<<<<<<<
 *         """start(self, tag, attrs, nsmap=None)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.TreeBuilder.start", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nsmap);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/saxparser.pxi":851
 *         return self._handleSaxStart(tag, attrs, nsmap)
 * 
 *     def end(self, tag):             # <<<<<<<<<<<<<<
 *         """end(self, tag)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_11TreeBuilder_9end(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_11TreeBuilder_8end, "end(self, tag)\n\n        Closes the current element.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_11TreeBuilder_9end = {"end", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_11TreeBuilder_9end, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_11TreeBuilder_8end};
static PyObject *__pyx_pw_4lxml_5etree_11TreeBuilder_9end(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_tag = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("end (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_tag,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(5, 851, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(5, 851, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "end", 0) < (0)) __PYX_ERR(5, 851, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("end", 1, 1, 1, i); __PYX_ERR(5, 851, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(5, 851, __pyx_L3_error)
    }
    __pyx_v_tag = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("end", 1, 1, 1, __pyx_nargs); __PYX_ERR(5, 851, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.TreeBuilder.end", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_11TreeBuilder_8end(((struct __pyx_obj_4lxml_5etree_TreeBuilder *)__pyx_v_self), __pyx_v_tag);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_11TreeBuilder_8end(struct __pyx_obj_4lxml_5etree_TreeBuilder *__pyx_v_self, PyObject *__pyx_v_tag) {
  PyObject *__pyx_v_element = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4[5];
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("end", 0);

  /* "src/lxml/saxparser.pxi":856
 *         Closes the current element.
 *         """
 *         element = self._handleSaxEnd(tag)             # <<<<<<<<<<<<<<
 *         assert self._last.tag == tag,\
 *             f"end tag mismatch (expected {self._last.tag}, got {tag})"
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_11TreeBuilder__handleSaxEnd(__pyx_v_self, __pyx_v_tag); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 856, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_element = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "src/lxml/saxparser.pxi":857
 *         """
 *         element = self._handleSaxEnd(tag)
 *         assert self._last.tag == tag,\             # <<<<<<<<<<<<<<
 *             f"end tag mismatch (expected {self._last.tag}, got {tag})"
 *         return element
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_last), __pyx_mstate_global->__pyx_n_u_tag); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 857, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_v_tag, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 857, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(5, 857, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_3)) {

      /* "src/lxml/saxparser.pxi":858
 *         element = self._handleSaxEnd(tag)
 *         assert self._last.tag == tag,\
 *             f"end tag mismatch (expected {self._last.tag}, got {tag})"             # <<<<<<<<<<<<<<
 *         return element
 * 
*/
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_last), __pyx_mstate_global->__pyx_n_u_tag); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 858, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = __Pyx_PyObject_FormatSimple(__pyx_t_2, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 858, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_v_tag, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 858, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u_end_tag_mismatch_expected;
      __pyx_t_4[1] = __pyx_t_1;
      __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u_got_2;
      __pyx_t_4[3] = __pyx_t_2;
      __pyx_t_4[4] = __pyx_mstate_global->__pyx_kp_u__5;
      __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_4, 5, 27 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + 6 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2));
      if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 858, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_t_5, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __PYX_ERR(5, 857, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(5, 857, __pyx_L1_error)
  #endif

  /* "src/lxml/saxparser.pxi":859
 *         assert self._last.tag == tag,\
 *             f"end tag mismatch (expected {self._last.tag}, got {tag})"
 *         return element             # <<<<<<<<<<<<<<
 * 
 *     def pi(self, target, data=None):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_element);
  __pyx_r = __pyx_v_element;
  goto __pyx_L0;

  /* "src/lxml/saxparser.pxi":851
 *         return self._handleSaxStart(tag, attrs, nsmap)
 * 
 *     def end(self, tag):             # <<<<<<<<<<<<<<
 *         """end(self, tag)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree.TreeBuilder.end", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_element);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/saxparser.pxi":861
 *         return element
 * 
 *     def pi(self, target, data=None):             # <<<<<<<<<<<<<<
 *         """pi(self, target, data=None)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_11TreeBuilder_11pi(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_11TreeBuilder_10pi, "pi(self, target, data=None)\n\n        Creates a processing instruction using the factory, appends it\n        (unless disabled) and returns it.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_11TreeBuilder_11pi = {"pi", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_11TreeBuilder_11pi, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_11TreeBuilder_10pi};
static PyObject *__pyx_pw_4lxml_5etree_11TreeBuilder_11pi(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_target = 0;
  PyObject *__pyx_v_data = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pi (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_target,&__pyx_mstate_global->__pyx_n_u_data,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(5, 861, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(5, 861, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(5, 861, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "pi", 0) < (0)) __PYX_ERR(5, 861, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("pi", 0, 1, 2, i); __PYX_ERR(5, 861, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(5, 861, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(5, 861, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_target = values[0];
    __pyx_v_data = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pi", 0, 1, 2, __pyx_nargs); __PYX_ERR(5, 861, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.TreeBuilder.pi", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_11TreeBuilder_10pi(((struct __pyx_obj_4lxml_5etree_TreeBuilder *)__pyx_v_self), __pyx_v_target, __pyx_v_data);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_11TreeBuilder_10pi(struct __pyx_obj_4lxml_5etree_TreeBuilder *__pyx_v_self, PyObject *__pyx_v_target, PyObject *__pyx_v_data) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("pi", 0);

  /* "src/lxml/saxparser.pxi":867
 *         (unless disabled) and returns it.
 *         """
 *         return self._handleSaxPi(target, data)             # <<<<<<<<<<<<<<
 * 
 *     def comment(self, comment):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree_11TreeBuilder__handleSaxPi(__pyx_v_self, __pyx_v_target, __pyx_v_data); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 867, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/saxparser.pxi":861
 *         return element
 * 
 *     def pi(self, target, data=None):             # <<<<<<<<<<<<<<
 *         """pi(self, target, data=None)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.TreeBuilder.pi", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/saxparser.pxi":869
 *         return self._handleSaxPi(target, data)
 * 
 *     def comment(self, comment):             # <<<<<<<<<<<<<<
 *         """comment(self, comment)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_11TreeBuilder_13comment(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_11TreeBuilder_12comment, "comment(self, comment)\n\n        Creates a comment using the factory, appends it (unless disabled)\n        and returns it.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_11TreeBuilder_13comment = {"comment", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_11TreeBuilder_13comment, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_11TreeBuilder_12comment};
static PyObject *__pyx_pw_4lxml_5etree_11TreeBuilder_13comment(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_comment = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("comment (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_comment,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(5, 869, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(5, 869, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "comment", 0) < (0)) __PYX_ERR(5, 869, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("comment", 1, 1, 1, i); __PYX_ERR(5, 869, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(5, 869, __pyx_L3_error)
    }
    __pyx_v_comment = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("comment", 1, 1, 1, __pyx_nargs); __PYX_ERR(5, 869, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.TreeBuilder.comment", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_11TreeBuilder_12comment(((struct __pyx_obj_4lxml_5etree_TreeBuilder *)__pyx_v_self), __pyx_v_comment);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_11TreeBuilder_12comment(struct __pyx_obj_4lxml_5etree_TreeBuilder *__pyx_v_self, PyObject *__pyx_v_comment) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("comment", 0);

  /* "src/lxml/saxparser.pxi":875
 *         and returns it.
 *         """
 *         return self._handleSaxComment(comment)             # <<<<<<<<<<<<<<
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree_11TreeBuilder__handleSaxComment(__pyx_v_self, __pyx_v_comment); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 875, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/saxparser.pxi":869
 *         return self._handleSaxPi(target, data)
 * 
 *     def comment(self, comment):             # <<<<<<<<<<<<<<
 *         """comment(self, comment)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.TreeBuilder.comment", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parsertarget.pxi":14
 *     # to push the Python level parser result through the parser
 *     # machinery towards the API level functions
 *     def __init__(self, result):             # <<<<<<<<<<<<<<
 *         self.result = result
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_19_TargetParserResult_1__init__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_19_TargetParserResult_1__init__ = {"__init__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_19_TargetParserResult_1__init__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_19_TargetParserResult_1__init__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_result = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_result,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(13, 14, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(13, 14, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(13, 14, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(13, 14, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, i); __PYX_ERR(13, 14, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(13, 14, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(13, 14, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
    __pyx_v_result = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, __pyx_nargs); __PYX_ERR(13, 14, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._TargetParserResult.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_19_TargetParserResult___init__(__pyx_self, __pyx_v_self, __pyx_v_result);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_19_TargetParserResult___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_result) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "src/lxml/parsertarget.pxi":15
 *     # machinery towards the API level functions
 *     def __init__(self, result):
 *         self.result = result             # <<<<<<<<<<<<<<
 * 
 * 
*/
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_result, __pyx_v_result) < (0)) __PYX_ERR(13, 15, __pyx_L1_error)

  /* "src/lxml/parsertarget.pxi":14
 *     # to push the Python level parser result through the parser
 *     # machinery towards the API level functions
 *     def __init__(self, result):             # <<<<<<<<<<<<<<
 *         self.result = result
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._TargetParserResult.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parsertarget.pxi":31
 *     cdef bint _start_takes_nsmap
 * 
 *     def __cinit__(self, target):             # <<<<<<<<<<<<<<
 *         cdef int event_filter
 *         event_filter = 0
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_22_PythonSaxParserTarget_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_22_PythonSaxParserTarget_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_target = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_target,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(13, 31, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(13, 31, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__cinit__", 0) < (0)) __PYX_ERR(13, 31, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, i); __PYX_ERR(13, 31, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(13, 31, __pyx_L3_error)
    }
    __pyx_v_target = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, __pyx_nargs); __PYX_ERR(13, 31, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._PythonSaxParserTarget.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_22_PythonSaxParserTarget___cinit__(((struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *)__pyx_v_self), __pyx_v_target);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_22_PythonSaxParserTarget___cinit__(struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *__pyx_v_self, PyObject *__pyx_v_target) {
  int __pyx_v_event_filter;
  PyObject *__pyx_v_arguments = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  size_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  int __pyx_t_13;
  int __pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "src/lxml/parsertarget.pxi":33
 *     def __cinit__(self, target):
 *         cdef int event_filter
 *         event_filter = 0             # <<<<<<<<<<<<<<
 *         self._start_takes_nsmap = 0
 *         try:
*/
  __pyx_v_event_filter = 0;

  /* "src/lxml/parsertarget.pxi":34
 *         cdef int event_filter
 *         event_filter = 0
 *         self._start_takes_nsmap = 0             # <<<<<<<<<<<<<<
 *         try:
 *             self._target_start = target.start
*/
  __pyx_v_self->_start_takes_nsmap = 0;

  /* "src/lxml/parsertarget.pxi":35
 *         event_filter = 0
 *         self._start_takes_nsmap = 0
 *         try:             # <<<<<<<<<<<<<<
 *             self._target_start = target.start
 *             if self._target_start is not None:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "src/lxml/parsertarget.pxi":36
 *         self._start_takes_nsmap = 0
 *         try:
 *             self._target_start = target.start             # <<<<<<<<<<<<<<
 *             if self._target_start is not None:
 *                 event_filter |= SAX_EVENT_START
*/
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_target, __pyx_mstate_global->__pyx_n_u_start); if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 36, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_v_self->_target_start);
      __Pyx_DECREF(__pyx_v_self->_target_start);
      __pyx_v_self->_target_start = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "src/lxml/parsertarget.pxi":37
 *         try:
 *             self._target_start = target.start
 *             if self._target_start is not None:             # <<<<<<<<<<<<<<
 *                 event_filter |= SAX_EVENT_START
 *         except AttributeError:
*/
      __pyx_t_5 = (__pyx_v_self->_target_start != Py_None);
      if (__pyx_t_5) {

        /* "src/lxml/parsertarget.pxi":38
 *             self._target_start = target.start
 *             if self._target_start is not None:
 *                 event_filter |= SAX_EVENT_START             # <<<<<<<<<<<<<<
 *         except AttributeError:
 *             pass
*/
        __pyx_v_event_filter = (__pyx_v_event_filter | __pyx_e_4lxml_5etree_SAX_EVENT_START);

        /* "src/lxml/parsertarget.pxi":37
 *         try:
 *             self._target_start = target.start
 *             if self._target_start is not None:             # <<<<<<<<<<<<<<
 *                 event_filter |= SAX_EVENT_START
 *         except AttributeError:
*/
      }

      /* "src/lxml/parsertarget.pxi":35
 *         event_filter = 0
 *         self._start_takes_nsmap = 0
 *         try:             # <<<<<<<<<<<<<<
 *             self._target_start = target.start
 *             if self._target_start is not None:
*/
    }

    /* "src/lxml/parsertarget.pxi":42
 *             pass
 *         else:
 *             try:             # <<<<<<<<<<<<<<
 *                 arguments = inspect_getargspec(self._target_start)
 *                 if len(arguments[0]) > 3 or arguments[1] is not None:
*/
    /*else:*/ {
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_6);
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_8);
        /*try:*/ {

          /* "src/lxml/parsertarget.pxi":43
 *         else:
 *             try:
 *                 arguments = inspect_getargspec(self._target_start)             # <<<<<<<<<<<<<<
 *                 if len(arguments[0]) > 3 or arguments[1] is not None:
 *                     self._start_takes_nsmap = 1
*/
          __pyx_t_9 = NULL;
          __Pyx_INCREF(__pyx_v_4lxml_5etree_inspect_getargspec);
          __pyx_t_10 = __pyx_v_4lxml_5etree_inspect_getargspec; 
          __pyx_t_11 = 1;
          #if CYTHON_UNPACK_METHODS
          if (unlikely(PyMethod_Check(__pyx_t_10))) {
            __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_10);
            assert(__pyx_t_9);
            PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_10);
            __Pyx_INCREF(__pyx_t_9);
            __Pyx_INCREF(__pyx__function);
            __Pyx_DECREF_SET(__pyx_t_10, __pyx__function);
            __pyx_t_11 = 0;
          }
          #endif
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_v_self->_target_start};
            __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_10, __pyx_callargs+__pyx_t_11, (2-__pyx_t_11) | (__pyx_t_11*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
            __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
            if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 43, __pyx_L10_error)
            __Pyx_GOTREF(__pyx_t_4);
          }
          __pyx_v_arguments = __pyx_t_4;
          __pyx_t_4 = 0;

          /* "src/lxml/parsertarget.pxi":44
 *             try:
 *                 arguments = inspect_getargspec(self._target_start)
 *                 if len(arguments[0]) > 3 or arguments[1] is not None:             # <<<<<<<<<<<<<<
 *                     self._start_takes_nsmap = 1
 *             except TypeError:
*/
          __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_arguments, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 44, __pyx_L10_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_12 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_12 == ((Py_ssize_t)-1))) __PYX_ERR(13, 44, __pyx_L10_error)
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_13 = (__pyx_t_12 > 3);
          if (!__pyx_t_13) {
          } else {
            __pyx_t_5 = __pyx_t_13;
            goto __pyx_L17_bool_binop_done;
          }
          __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_arguments, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 44, __pyx_L10_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_13 = (__pyx_t_4 != Py_None);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_5 = __pyx_t_13;
          __pyx_L17_bool_binop_done:;
          if (__pyx_t_5) {

            /* "src/lxml/parsertarget.pxi":45
 *                 arguments = inspect_getargspec(self._target_start)
 *                 if len(arguments[0]) > 3 or arguments[1] is not None:
 *                     self._start_takes_nsmap = 1             # <<<<<<<<<<<<<<
 *             except TypeError:
 *                 pass
*/
            __pyx_v_self->_start_takes_nsmap = 1;

            /* "src/lxml/parsertarget.pxi":44
 *             try:
 *                 arguments = inspect_getargspec(self._target_start)
 *                 if len(arguments[0]) > 3 or arguments[1] is not None:             # <<<<<<<<<<<<<<
 *                     self._start_takes_nsmap = 1
 *             except TypeError:
*/
          }

          /* "src/lxml/parsertarget.pxi":42
 *             pass
 *         else:
 *             try:             # <<<<<<<<<<<<<<
 *                 arguments = inspect_getargspec(self._target_start)
 *                 if len(arguments[0]) > 3 or arguments[1] is not None:
*/
        }
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L15_try_end;
        __pyx_L10_error:;
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

        /* "src/lxml/parsertarget.pxi":46
 *                 if len(arguments[0]) > 3 or arguments[1] is not None:
 *                     self._start_takes_nsmap = 1
 *             except TypeError:             # <<<<<<<<<<<<<<
 *                 pass
 *         try:
*/
        __pyx_t_14 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_TypeError))));
        if (__pyx_t_14) {
          __Pyx_ErrRestore(0,0,0);
          goto __pyx_L11_exception_handled;
        }
        goto __pyx_L12_except_error;

        /* "src/lxml/parsertarget.pxi":42
 *             pass
 *         else:
 *             try:             # <<<<<<<<<<<<<<
 *                 arguments = inspect_getargspec(self._target_start)
 *                 if len(arguments[0]) > 3 or arguments[1] is not None:
*/
        __pyx_L12_except_error:;
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
        goto __pyx_L5_except_error;
        __pyx_L11_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
        __pyx_L15_try_end:;
      }
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "src/lxml/parsertarget.pxi":39
 *             if self._target_start is not None:
 *                 event_filter |= SAX_EVENT_START
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             pass
 *         else:
*/
    __pyx_t_14 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_AttributeError))));
    if (__pyx_t_14) {
      __Pyx_ErrRestore(0,0,0);
      goto __pyx_L4_exception_handled;
    }
    goto __pyx_L5_except_error;

    /* "src/lxml/parsertarget.pxi":35
 *         event_filter = 0
 *         self._start_takes_nsmap = 0
 *         try:             # <<<<<<<<<<<<<<
 *             self._target_start = target.start
 *             if self._target_start is not None:
*/
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    __pyx_L8_try_end:;
  }

  /* "src/lxml/parsertarget.pxi":48
 *             except TypeError:
 *                 pass
 *         try:             # <<<<<<<<<<<<<<
 *             self._target_end = target.end
 *             if self._target_end is not None:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_1);
    /*try:*/ {

      /* "src/lxml/parsertarget.pxi":49
 *                 pass
 *         try:
 *             self._target_end = target.end             # <<<<<<<<<<<<<<
 *             if self._target_end is not None:
 *                 event_filter |= SAX_EVENT_END
*/
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_target, __pyx_mstate_global->__pyx_n_u_end); if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 49, __pyx_L23_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_v_self->_target_end);
      __Pyx_DECREF(__pyx_v_self->_target_end);
      __pyx_v_self->_target_end = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "src/lxml/parsertarget.pxi":50
 *         try:
 *             self._target_end = target.end
 *             if self._target_end is not None:             # <<<<<<<<<<<<<<
 *                 event_filter |= SAX_EVENT_END
 *         except AttributeError:
*/
      __pyx_t_5 = (__pyx_v_self->_target_end != Py_None);
      if (__pyx_t_5) {

        /* "src/lxml/parsertarget.pxi":51
 *             self._target_end = target.end
 *             if self._target_end is not None:
 *                 event_filter |= SAX_EVENT_END             # <<<<<<<<<<<<<<
 *         except AttributeError:
 *             pass
*/
        __pyx_v_event_filter = (__pyx_v_event_filter | __pyx_e_4lxml_5etree_SAX_EVENT_END);

        /* "src/lxml/parsertarget.pxi":50
 *         try:
 *             self._target_end = target.end
 *             if self._target_end is not None:             # <<<<<<<<<<<<<<
 *                 event_filter |= SAX_EVENT_END
 *         except AttributeError:
*/
      }

      /* "src/lxml/parsertarget.pxi":48
 *             except TypeError:
 *                 pass
 *         try:             # <<<<<<<<<<<<<<
 *             self._target_end = target.end
 *             if self._target_end is not None:
*/
    }
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L28_try_end;
    __pyx_L23_error:;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "src/lxml/parsertarget.pxi":52
 *             if self._target_end is not None:
 *                 event_filter |= SAX_EVENT_END
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             pass
 *         try:
*/
    __pyx_t_14 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_AttributeError))));
    if (__pyx_t_14) {
      __Pyx_ErrRestore(0,0,0);
      goto __pyx_L24_exception_handled;
    }
    goto __pyx_L25_except_error;

    /* "src/lxml/parsertarget.pxi":48
 *             except TypeError:
 *                 pass
 *         try:             # <<<<<<<<<<<<<<
 *             self._target_end = target.end
 *             if self._target_end is not None:
*/
    __pyx_L25_except_error:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1);
    goto __pyx_L1_error;
    __pyx_L24_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1);
    __pyx_L28_try_end:;
  }

  /* "src/lxml/parsertarget.pxi":54
 *         except AttributeError:
 *             pass
 *         try:             # <<<<<<<<<<<<<<
 *             self._target_start_ns = target.start_ns
 *             if self._target_start_ns is not None:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "src/lxml/parsertarget.pxi":55
 *             pass
 *         try:
 *             self._target_start_ns = target.start_ns             # <<<<<<<<<<<<<<
 *             if self._target_start_ns is not None:
 *                 event_filter |= SAX_EVENT_START_NS
*/
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_target, __pyx_mstate_global->__pyx_n_u_start_ns_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 55, __pyx_L32_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_v_self->_target_start_ns);
      __Pyx_DECREF(__pyx_v_self->_target_start_ns);
      __pyx_v_self->_target_start_ns = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "src/lxml/parsertarget.pxi":56
 *         try:
 *             self._target_start_ns = target.start_ns
 *             if self._target_start_ns is not None:             # <<<<<<<<<<<<<<
 *                 event_filter |= SAX_EVENT_START_NS
 *         except AttributeError:
*/
      __pyx_t_5 = (__pyx_v_self->_target_start_ns != Py_None);
      if (__pyx_t_5) {

        /* "src/lxml/parsertarget.pxi":57
 *             self._target_start_ns = target.start_ns
 *             if self._target_start_ns is not None:
 *                 event_filter |= SAX_EVENT_START_NS             # <<<<<<<<<<<<<<
 *         except AttributeError:
 *             pass
*/
        __pyx_v_event_filter = (__pyx_v_event_filter | __pyx_e_4lxml_5etree_SAX_EVENT_START_NS);

        /* "src/lxml/parsertarget.pxi":56
 *         try:
 *             self._target_start_ns = target.start_ns
 *             if self._target_start_ns is not None:             # <<<<<<<<<<<<<<
 *                 event_filter |= SAX_EVENT_START_NS
 *         except AttributeError:
*/
      }

      /* "src/lxml/parsertarget.pxi":54
 *         except AttributeError:
 *             pass
 *         try:             # <<<<<<<<<<<<<<
 *             self._target_start_ns = target.start_ns
 *             if self._target_start_ns is not None:
*/
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L37_try_end;
    __pyx_L32_error:;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "src/lxml/parsertarget.pxi":58
 *             if self._target_start_ns is not None:
 *                 event_filter |= SAX_EVENT_START_NS
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             pass
 *         try:
*/
    __pyx_t_14 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_AttributeError))));
    if (__pyx_t_14) {
      __Pyx_ErrRestore(0,0,0);
      goto __pyx_L33_exception_handled;
    }
    goto __pyx_L34_except_error;

    /* "src/lxml/parsertarget.pxi":54
 *         except AttributeError:
 *             pass
 *         try:             # <<<<<<<<<<<<<<
 *             self._target_start_ns = target.start_ns
 *             if self._target_start_ns is not None:
*/
    __pyx_L34_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L33_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    __pyx_L37_try_end:;
  }

  /* "src/lxml/parsertarget.pxi":60
 *         except AttributeError:
 *             pass
 *         try:             # <<<<<<<<<<<<<<
 *             self._target_end_ns = target.end_ns
 *             if self._target_end_ns is not None:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_1);
    /*try:*/ {

      /* "src/lxml/parsertarget.pxi":61
 *             pass
 *         try:
 *             self._target_end_ns = target.end_ns             # <<<<<<<<<<<<<<
 *             if self._target_end_ns is not None:
 *                 event_filter |= SAX_EVENT_END_NS
*/
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_target, __pyx_mstate_global->__pyx_n_u_end_ns_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 61, __pyx_L41_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_v_self->_target_end_ns);
      __Pyx_DECREF(__pyx_v_self->_target_end_ns);
      __pyx_v_self->_target_end_ns = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "src/lxml/parsertarget.pxi":62
 *         try:
 *             self._target_end_ns = target.end_ns
 *             if self._target_end_ns is not None:             # <<<<<<<<<<<<<<
 *                 event_filter |= SAX_EVENT_END_NS
 *         except AttributeError:
*/
      __pyx_t_5 = (__pyx_v_self->_target_end_ns != Py_None);
      if (__pyx_t_5) {

        /* "src/lxml/parsertarget.pxi":63
 *             self._target_end_ns = target.end_ns
 *             if self._target_end_ns is not None:
 *                 event_filter |= SAX_EVENT_END_NS             # <<<<<<<<<<<<<<
 *         except AttributeError:
 *             pass
*/
        __pyx_v_event_filter = (__pyx_v_event_filter | __pyx_e_4lxml_5etree_SAX_EVENT_END_NS);

        /* "src/lxml/parsertarget.pxi":62
 *         try:
 *             self._target_end_ns = target.end_ns
 *             if self._target_end_ns is not None:             # <<<<<<<<<<<<<<
 *                 event_filter |= SAX_EVENT_END_NS
 *         except AttributeError:
*/
      }

      /* "src/lxml/parsertarget.pxi":60
 *         except AttributeError:
 *             pass
 *         try:             # <<<<<<<<<<<<<<
 *             self._target_end_ns = target.end_ns
 *             if self._target_end_ns is not None:
*/
    }
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L46_try_end;
    __pyx_L41_error:;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "src/lxml/parsertarget.pxi":64
 *             if self._target_end_ns is not None:
 *                 event_filter |= SAX_EVENT_END_NS
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             pass
 *         try:
*/
    __pyx_t_14 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_AttributeError))));
    if (__pyx_t_14) {
      __Pyx_ErrRestore(0,0,0);
      goto __pyx_L42_exception_handled;
    }
    goto __pyx_L43_except_error;

    /* "src/lxml/parsertarget.pxi":60
 *         except AttributeError:
 *             pass
 *         try:             # <<<<<<<<<<<<<<
 *             self._target_end_ns = target.end_ns
 *             if self._target_end_ns is not None:
*/
    __pyx_L43_except_error:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1);
    goto __pyx_L1_error;
    __pyx_L42_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1);
    __pyx_L46_try_end:;
  }

  /* "src/lxml/parsertarget.pxi":66
 *         except AttributeError:
 *             pass
 *         try:             # <<<<<<<<<<<<<<
 *             self._target_data = target.data
 *             if self._target_data is not None:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "src/lxml/parsertarget.pxi":67
 *             pass
 *         try:
 *             self._target_data = target.data             # <<<<<<<<<<<<<<
 *             if self._target_data is not None:
 *                 event_filter |= SAX_EVENT_DATA
*/
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_target, __pyx_mstate_global->__pyx_n_u_data); if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 67, __pyx_L50_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_v_self->_target_data);
      __Pyx_DECREF(__pyx_v_self->_target_data);
      __pyx_v_self->_target_data = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "src/lxml/parsertarget.pxi":68
 *         try:
 *             self._target_data = target.data
 *             if self._target_data is not None:             # <<<<<<<<<<<<<<
 *                 event_filter |= SAX_EVENT_DATA
 *         except AttributeError:
*/
      __pyx_t_5 = (__pyx_v_self->_target_data != Py_None);
      if (__pyx_t_5) {

        /* "src/lxml/parsertarget.pxi":69
 *             self._target_data = target.data
 *             if self._target_data is not None:
 *                 event_filter |= SAX_EVENT_DATA             # <<<<<<<<<<<<<<
 *         except AttributeError:
 *             pass
*/
        __pyx_v_event_filter = (__pyx_v_event_filter | __pyx_e_4lxml_5etree_SAX_EVENT_DATA);

        /* "src/lxml/parsertarget.pxi":68
 *         try:
 *             self._target_data = target.data
 *             if self._target_data is not None:             # <<<<<<<<<<<<<<
 *                 event_filter |= SAX_EVENT_DATA
 *         except AttributeError:
*/
      }

      /* "src/lxml/parsertarget.pxi":66
 *         except AttributeError:
 *             pass
 *         try:             # <<<<<<<<<<<<<<
 *             self._target_data = target.data
 *             if self._target_data is not None:
*/
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L55_try_end;
    __pyx_L50_error:;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "src/lxml/parsertarget.pxi":70
 *             if self._target_data is not None:
 *                 event_filter |= SAX_EVENT_DATA
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             pass
 *         try:
*/
    __pyx_t_14 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_AttributeError))));
    if (__pyx_t_14) {
      __Pyx_ErrRestore(0,0,0);
      goto __pyx_L51_exception_handled;
    }
    goto __pyx_L52_except_error;

    /* "src/lxml/parsertarget.pxi":66
 *         except AttributeError:
 *             pass
 *         try:             # <<<<<<<<<<<<<<
 *             self._target_data = target.data
 *             if self._target_data is not None:
*/
    __pyx_L52_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L51_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    __pyx_L55_try_end:;
  }

  /* "src/lxml/parsertarget.pxi":72
 *         except AttributeError:
 *             pass
 *         try:             # <<<<<<<<<<<<<<
 *             self._target_doctype = target.doctype
 *             if self._target_doctype is not None:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_1);
    /*try:*/ {

      /* "src/lxml/parsertarget.pxi":73
 *             pass
 *         try:
 *             self._target_doctype = target.doctype             # <<<<<<<<<<<<<<
 *             if self._target_doctype is not None:
 *                 event_filter |= SAX_EVENT_DOCTYPE
*/
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_target, __pyx_mstate_global->__pyx_n_u_doctype); if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 73, __pyx_L59_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_v_self->_target_doctype);
      __Pyx_DECREF(__pyx_v_self->_target_doctype);
      __pyx_v_self->_target_doctype = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "src/lxml/parsertarget.pxi":74
 *         try:
 *             self._target_doctype = target.doctype
 *             if self._target_doctype is not None:             # <<<<<<<<<<<<<<
 *                 event_filter |= SAX_EVENT_DOCTYPE
 *         except AttributeError:
*/
      __pyx_t_5 = (__pyx_v_self->_target_doctype != Py_None);
      if (__pyx_t_5) {

        /* "src/lxml/parsertarget.pxi":75
 *             self._target_doctype = target.doctype
 *             if self._target_doctype is not None:
 *                 event_filter |= SAX_EVENT_DOCTYPE             # <<<<<<<<<<<<<<
 *         except AttributeError:
 *             pass
*/
        __pyx_v_event_filter = (__pyx_v_event_filter | __pyx_e_4lxml_5etree_SAX_EVENT_DOCTYPE);

        /* "src/lxml/parsertarget.pxi":74
 *         try:
 *             self._target_doctype = target.doctype
 *             if self._target_doctype is not None:             # <<<<<<<<<<<<<<
 *                 event_filter |= SAX_EVENT_DOCTYPE
 *         except AttributeError:
*/
      }

      /* "src/lxml/parsertarget.pxi":72
 *         except AttributeError:
 *             pass
 *         try:             # <<<<<<<<<<<<<<
 *             self._target_doctype = target.doctype
 *             if self._target_doctype is not None:
*/
    }
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L64_try_end;
    __pyx_L59_error:;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "src/lxml/parsertarget.pxi":76
 *             if self._target_doctype is not None:
 *                 event_filter |= SAX_EVENT_DOCTYPE
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             pass
 *         try:
*/
    __pyx_t_14 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_AttributeError))));
    if (__pyx_t_14) {
      __Pyx_ErrRestore(0,0,0);
      goto __pyx_L60_exception_handled;
    }
    goto __pyx_L61_except_error;

    /* "src/lxml/parsertarget.pxi":72
 *         except AttributeError:
 *             pass
 *         try:             # <<<<<<<<<<<<<<
 *             self._target_doctype = target.doctype
 *             if self._target_doctype is not None:
*/
    __pyx_L61_except_error:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1);
    goto __pyx_L1_error;
    __pyx_L60_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1);
    __pyx_L64_try_end:;
  }

  /* "src/lxml/parsertarget.pxi":78
 *         except AttributeError:
 *             pass
 *         try:             # <<<<<<<<<<<<<<
 *             self._target_pi = target.pi
 *             if self._target_pi is not None:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "src/lxml/parsertarget.pxi":79
 *             pass
 *         try:
 *             self._target_pi = target.pi             # <<<<<<<<<<<<<<
 *             if self._target_pi is not None:
 *                 event_filter |= SAX_EVENT_PI
*/
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_target, __pyx_mstate_global->__pyx_n_u_pi); if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 79, __pyx_L68_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_v_self->_target_pi);
      __Pyx_DECREF(__pyx_v_self->_target_pi);
      __pyx_v_self->_target_pi = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "src/lxml/parsertarget.pxi":80
 *         try:
 *             self._target_pi = target.pi
 *             if self._target_pi is not None:             # <<<<<<<<<<<<<<
 *                 event_filter |= SAX_EVENT_PI
 *         except AttributeError:
*/
      __pyx_t_5 = (__pyx_v_self->_target_pi != Py_None);
      if (__pyx_t_5) {

        /* "src/lxml/parsertarget.pxi":81
 *             self._target_pi = target.pi
 *             if self._target_pi is not None:
 *                 event_filter |= SAX_EVENT_PI             # <<<<<<<<<<<<<<
 *         except AttributeError:
 *             pass
*/
        __pyx_v_event_filter = (__pyx_v_event_filter | __pyx_e_4lxml_5etree_SAX_EVENT_PI);

        /* "src/lxml/parsertarget.pxi":80
 *         try:
 *             self._target_pi = target.pi
 *             if self._target_pi is not None:             # <<<<<<<<<<<<<<
 *                 event_filter |= SAX_EVENT_PI
 *         except AttributeError:
*/
      }

      /* "src/lxml/parsertarget.pxi":78
 *         except AttributeError:
 *             pass
 *         try:             # <<<<<<<<<<<<<<
 *             self._target_pi = target.pi
 *             if self._target_pi is not None:
*/
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L73_try_end;
    __pyx_L68_error:;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "src/lxml/parsertarget.pxi":82
 *             if self._target_pi is not None:
 *                 event_filter |= SAX_EVENT_PI
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             pass
 *         try:
*/
    __pyx_t_14 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_AttributeError))));
    if (__pyx_t_14) {
      __Pyx_ErrRestore(0,0,0);
      goto __pyx_L69_exception_handled;
    }
    goto __pyx_L70_except_error;

    /* "src/lxml/parsertarget.pxi":78
 *         except AttributeError:
 *             pass
 *         try:             # <<<<<<<<<<<<<<
 *             self._target_pi = target.pi
 *             if self._target_pi is not None:
*/
    __pyx_L70_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L69_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    __pyx_L73_try_end:;
  }

  /* "src/lxml/parsertarget.pxi":84
 *         except AttributeError:
 *             pass
 *         try:             # <<<<<<<<<<<<<<
 *             self._target_comment = target.comment
 *             if self._target_comment is not None:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_1);
    /*try:*/ {

      /* "src/lxml/parsertarget.pxi":85
 *             pass
 *         try:
 *             self._target_comment = target.comment             # <<<<<<<<<<<<<<
 *             if self._target_comment is not None:
 *                 event_filter |= SAX_EVENT_COMMENT
*/
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_target, __pyx_mstate_global->__pyx_n_u_comment); if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 85, __pyx_L77_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_v_self->_target_comment);
      __Pyx_DECREF(__pyx_v_self->_target_comment);
      __pyx_v_self->_target_comment = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "src/lxml/parsertarget.pxi":86
 *         try:
 *             self._target_comment = target.comment
 *             if self._target_comment is not None:             # <<<<<<<<<<<<<<
 *                 event_filter |= SAX_EVENT_COMMENT
 *         except AttributeError:
*/
      __pyx_t_5 = (__pyx_v_self->_target_comment != Py_None);
      if (__pyx_t_5) {

        /* "src/lxml/parsertarget.pxi":87
 *             self._target_comment = target.comment
 *             if self._target_comment is not None:
 *                 event_filter |= SAX_EVENT_COMMENT             # <<<<<<<<<<<<<<
 *         except AttributeError:
 *             pass
*/
        __pyx_v_event_filter = (__pyx_v_event_filter | __pyx_e_4lxml_5etree_SAX_EVENT_COMMENT);

        /* "src/lxml/parsertarget.pxi":86
 *         try:
 *             self._target_comment = target.comment
 *             if self._target_comment is not None:             # <<<<<<<<<<<<<<
 *                 event_filter |= SAX_EVENT_COMMENT
 *         except AttributeError:
*/
      }

      /* "src/lxml/parsertarget.pxi":84
 *         except AttributeError:
 *             pass
 *         try:             # <<<<<<<<<<<<<<
 *             self._target_comment = target.comment
 *             if self._target_comment is not None:
*/
    }
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L82_try_end;
    __pyx_L77_error:;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "src/lxml/parsertarget.pxi":88
 *             if self._target_comment is not None:
 *                 event_filter |= SAX_EVENT_COMMENT
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             pass
 *         self._sax_event_filter = event_filter
*/
    __pyx_t_14 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_AttributeError))));
    if (__pyx_t_14) {
      __Pyx_ErrRestore(0,0,0);
      goto __pyx_L78_exception_handled;
    }
    goto __pyx_L79_except_error;

    /* "src/lxml/parsertarget.pxi":84
 *         except AttributeError:
 *             pass
 *         try:             # <<<<<<<<<<<<<<
 *             self._target_comment = target.comment
 *             if self._target_comment is not None:
*/
    __pyx_L79_except_error:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1);
    goto __pyx_L1_error;
    __pyx_L78_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1);
    __pyx_L82_try_end:;
  }

  /* "src/lxml/parsertarget.pxi":90
 *         except AttributeError:
 *             pass
 *         self._sax_event_filter = event_filter             # <<<<<<<<<<<<<<
 * 
 *     cdef _handleSaxStart(self, tag, attrib, nsmap):
*/
  __pyx_v_self->__pyx_base._sax_event_filter = __pyx_v_event_filter;

  /* "src/lxml/parsertarget.pxi":31
 *     cdef bint _start_takes_nsmap
 * 
 *     def __cinit__(self, target):             # <<<<<<<<<<<<<<
 *         cdef int event_filter
 *         event_filter = 0
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("lxml.etree._PythonSaxParserTarget.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_arguments);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parsertarget.pxi":92
 *         self._sax_event_filter = event_filter
 * 
 *     cdef _handleSaxStart(self, tag, attrib, nsmap):             # <<<<<<<<<<<<<<
 *         if self._start_takes_nsmap:
 *             return self._target_start(tag, attrib, nsmap)
*/

static PyObject *__pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxStart(struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_attrib, PyObject *__pyx_v_nsmap) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_handleSaxStart", 0);

  /* "src/lxml/parsertarget.pxi":93
 * 
 *     cdef _handleSaxStart(self, tag, attrib, nsmap):
 *         if self._start_takes_nsmap:             # <<<<<<<<<<<<<<
 *             return self._target_start(tag, attrib, nsmap)
 *         else:
*/
  if (__pyx_v_self->_start_takes_nsmap) {

    /* "src/lxml/parsertarget.pxi":94
 *     cdef _handleSaxStart(self, tag, attrib, nsmap):
 *         if self._start_takes_nsmap:
 *             return self._target_start(tag, attrib, nsmap)             # <<<<<<<<<<<<<<
 *         else:
 *             return self._target_start(tag, attrib)
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = NULL;
    __Pyx_INCREF(__pyx_v_self->_target_start);
    __pyx_t_3 = __pyx_v_self->_target_start; 
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[4] = {__pyx_t_2, __pyx_v_tag, __pyx_v_attrib, __pyx_v_nsmap};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (4-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 94, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "src/lxml/parsertarget.pxi":93
 * 
 *     cdef _handleSaxStart(self, tag, attrib, nsmap):
 *         if self._start_takes_nsmap:             # <<<<<<<<<<<<<<
 *             return self._target_start(tag, attrib, nsmap)
 *         else:
*/
  }

  /* "src/lxml/parsertarget.pxi":96
 *             return self._target_start(tag, attrib, nsmap)
 *         else:
 *             return self._target_start(tag, attrib)             # <<<<<<<<<<<<<<
 * 
 *     cdef _handleSaxEnd(self, tag):
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_v_self->_target_start);
    __pyx_t_2 = __pyx_v_self->_target_start; 
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_v_tag, __pyx_v_attrib};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 96, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
  }

  /* "src/lxml/parsertarget.pxi":92
 *         self._sax_event_filter = event_filter
 * 
 *     cdef _handleSaxStart(self, tag, attrib, nsmap):             # <<<<<<<<<<<<<<
 *         if self._start_takes_nsmap:
 *             return self._target_start(tag, attrib, nsmap)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._PythonSaxParserTarget._handleSaxStart", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parsertarget.pxi":98
 *             return self._target_start(tag, attrib)
 * 
 *     cdef _handleSaxEnd(self, tag):             # <<<<<<<<<<<<<<
 *         return self._target_end(tag)
 * 
*/

static PyObject *__pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxEnd(struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *__pyx_v_self, PyObject *__pyx_v_tag) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_handleSaxEnd", 0);

  /* "src/lxml/parsertarget.pxi":99
 * 
 *     cdef _handleSaxEnd(self, tag):
 *         return self._target_end(tag)             # <<<<<<<<<<<<<<
 * 
 *     cdef _handleSaxStartNs(self, prefix, uri):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = NULL;
  __Pyx_INCREF(__pyx_v_self->_target_end);
  __pyx_t_3 = __pyx_v_self->_target_end; 
  __pyx_t_4 = 1;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_4 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_tag};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 99, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/parsertarget.pxi":98
 *             return self._target_start(tag, attrib)
 * 
 *     cdef _handleSaxEnd(self, tag):             # <<<<<<<<<<<<<<
 *         return self._target_end(tag)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._PythonSaxParserTarget._handleSaxEnd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parsertarget.pxi":101
 *         return self._target_end(tag)
 * 
 *     cdef _handleSaxStartNs(self, prefix, uri):             # <<<<<<<<<<<<<<
 *         return self._target_start_ns(prefix, uri)
 * 
*/

static PyObject *__pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxStartNs(struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *__pyx_v_self, PyObject *__pyx_v_prefix, PyObject *__pyx_v_uri) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_handleSaxStartNs", 0);

  /* "src/lxml/parsertarget.pxi":102
 * 
 *     cdef _handleSaxStartNs(self, prefix, uri):
 *         return self._target_start_ns(prefix, uri)             # <<<<<<<<<<<<<<
 * 
 *     cdef _handleSaxEndNs(self, prefix):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = NULL;
  __Pyx_INCREF(__pyx_v_self->_target_start_ns);
  __pyx_t_3 = __pyx_v_self->_target_start_ns; 
  __pyx_t_4 = 1;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_4 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_v_prefix, __pyx_v_uri};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 102, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/parsertarget.pxi":101
 *         return self._target_end(tag)
 * 
 *     cdef _handleSaxStartNs(self, prefix, uri):             # <<<<<<<<<<<<<<
 *         return self._target_start_ns(prefix, uri)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._PythonSaxParserTarget._handleSaxStartNs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parsertarget.pxi":104
 *         return self._target_start_ns(prefix, uri)
 * 
 *     cdef _handleSaxEndNs(self, prefix):             # <<<<<<<<<<<<<<
 *         return self._target_end_ns(prefix)
 * 
*/

static PyObject *__pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxEndNs(struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *__pyx_v_self, PyObject *__pyx_v_prefix) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_handleSaxEndNs", 0);

  /* "src/lxml/parsertarget.pxi":105
 * 
 *     cdef _handleSaxEndNs(self, prefix):
 *         return self._target_end_ns(prefix)             # <<<<<<<<<<<<<<
 * 
 *     cdef int _handleSaxData(self, data) except -1:
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = NULL;
  __Pyx_INCREF(__pyx_v_self->_target_end_ns);
  __pyx_t_3 = __pyx_v_self->_target_end_ns; 
  __pyx_t_4 = 1;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_4 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_prefix};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 105, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/parsertarget.pxi":104
 *         return self._target_start_ns(prefix, uri)
 * 
 *     cdef _handleSaxEndNs(self, prefix):             # <<<<<<<<<<<<<<
 *         return self._target_end_ns(prefix)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._PythonSaxParserTarget._handleSaxEndNs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parsertarget.pxi":107
 *         return self._target_end_ns(prefix)
 * 
 *     cdef int _handleSaxData(self, data) except -1:             # <<<<<<<<<<<<<<
 *         self._target_data(data)
 * 
*/

static int __pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxData(struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *__pyx_v_self, PyObject *__pyx_v_data) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_handleSaxData", 0);

  /* "src/lxml/parsertarget.pxi":108
 * 
 *     cdef int _handleSaxData(self, data) except -1:
 *         self._target_data(data)             # <<<<<<<<<<<<<<
 * 
 *     cdef int _handleSaxDoctype(self, root_tag, public_id, system_id) except -1:
*/
  __pyx_t_2 = NULL;
  __Pyx_INCREF(__pyx_v_self->_target_data);
  __pyx_t_3 = __pyx_v_self->_target_data; 
  __pyx_t_4 = 1;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_4 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_data};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 108, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/parsertarget.pxi":107
 *         return self._target_end_ns(prefix)
 * 
 *     cdef int _handleSaxData(self, data) except -1:             # <<<<<<<<<<<<<<
 *         self._target_data(data)
 * 
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._PythonSaxParserTarget._handleSaxData", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parsertarget.pxi":110
 *         self._target_data(data)
 * 
 *     cdef int _handleSaxDoctype(self, root_tag, public_id, system_id) except -1:             # <<<<<<<<<<<<<<
 *         self._target_doctype(root_tag, public_id, system_id)
 * 
*/

static int __pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxDoctype(struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *__pyx_v_self, PyObject *__pyx_v_root_tag, PyObject *__pyx_v_public_id, PyObject *__pyx_v_system_id) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_handleSaxDoctype", 0);

  /* "src/lxml/parsertarget.pxi":111
 * 
 *     cdef int _handleSaxDoctype(self, root_tag, public_id, system_id) except -1:
 *         self._target_doctype(root_tag, public_id, system_id)             # <<<<<<<<<<<<<<
 * 
 *     cdef _handleSaxPi(self, target, data):
*/
  __pyx_t_2 = NULL;
  __Pyx_INCREF(__pyx_v_self->_target_doctype);
  __pyx_t_3 = __pyx_v_self->_target_doctype; 
  __pyx_t_4 = 1;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_4 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[4] = {__pyx_t_2, __pyx_v_root_tag, __pyx_v_public_id, __pyx_v_system_id};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (4-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 111, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/parsertarget.pxi":110
 *         self._target_data(data)
 * 
 *     cdef int _handleSaxDoctype(self, root_tag, public_id, system_id) except -1:             # <<<<<<<<<<<<<<
 *         self._target_doctype(root_tag, public_id, system_id)
 * 
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._PythonSaxParserTarget._handleSaxDoctype", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parsertarget.pxi":113
 *         self._target_doctype(root_tag, public_id, system_id)
 * 
 *     cdef _handleSaxPi(self, target, data):             # <<<<<<<<<<<<<<
 *         return self._target_pi(target, data)
 * 
*/

static PyObject *__pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxPi(struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *__pyx_v_self, PyObject *__pyx_v_target, PyObject *__pyx_v_data) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_handleSaxPi", 0);

  /* "src/lxml/parsertarget.pxi":114
 * 
 *     cdef _handleSaxPi(self, target, data):
 *         return self._target_pi(target, data)             # <<<<<<<<<<<<<<
 * 
 *     cdef _handleSaxComment(self, comment):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = NULL;
  __Pyx_INCREF(__pyx_v_self->_target_pi);
  __pyx_t_3 = __pyx_v_self->_target_pi; 
  __pyx_t_4 = 1;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_4 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_v_target, __pyx_v_data};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 114, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/parsertarget.pxi":113
 *         self._target_doctype(root_tag, public_id, system_id)
 * 
 *     cdef _handleSaxPi(self, target, data):             # <<<<<<<<<<<<<<
 *         return self._target_pi(target, data)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._PythonSaxParserTarget._handleSaxPi", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parsertarget.pxi":116
 *         return self._target_pi(target, data)
 * 
 *     cdef _handleSaxComment(self, comment):             # <<<<<<<<<<<<<<
 *         return self._target_comment(comment)
 * 
*/

static PyObject *__pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxComment(struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *__pyx_v_self, PyObject *__pyx_v_comment) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_handleSaxComment", 0);

  /* "src/lxml/parsertarget.pxi":117
 * 
 *     cdef _handleSaxComment(self, comment):
 *         return self._target_comment(comment)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = NULL;
  __Pyx_INCREF(__pyx_v_self->_target_comment);
  __pyx_t_3 = __pyx_v_self->_target_comment; 
  __pyx_t_4 = 1;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_4 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_comment};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 117, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/parsertarget.pxi":116
 *         return self._target_pi(target, data)
 * 
 *     cdef _handleSaxComment(self, comment):             # <<<<<<<<<<<<<<
 *         return self._target_comment(comment)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._PythonSaxParserTarget._handleSaxComment", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parsertarget.pxi":127
 *     """
 *     cdef object _python_target
 *     cdef int _setTarget(self, target) except -1:             # <<<<<<<<<<<<<<
 *         self._python_target = target
 *         if not isinstance(target, _SaxParserTarget) or \
*/

static int __pyx_f_4lxml_5etree_20_TargetParserContext__setTarget(struct __pyx_obj_4lxml_5etree__TargetParserContext *__pyx_v_self, PyObject *__pyx_v_target) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_setTarget", 0);
  __Pyx_INCREF(__pyx_v_target);

  /* "src/lxml/parsertarget.pxi":128
 *     cdef object _python_target
 *     cdef int _setTarget(self, target) except -1:
 *         self._python_target = target             # <<<<<<<<<<<<<<
 *         if not isinstance(target, _SaxParserTarget) or \
 *                 hasattr(target, '__dict__'):
*/
  __Pyx_INCREF(__pyx_v_target);
  __Pyx_GIVEREF(__pyx_v_target);
  __Pyx_GOTREF(__pyx_v_self->_python_target);
  __Pyx_DECREF(__pyx_v_self->_python_target);
  __pyx_v_self->_python_target = __pyx_v_target;

  /* "src/lxml/parsertarget.pxi":129
 *     cdef int _setTarget(self, target) except -1:
 *         self._python_target = target
 *         if not isinstance(target, _SaxParserTarget) or \             # <<<<<<<<<<<<<<
 *                 hasattr(target, '__dict__'):
 *             target = _PythonSaxParserTarget(target)
*/
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_target, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__SaxParserTarget); 
  __pyx_t_3 = (!__pyx_t_2);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }

  /* "src/lxml/parsertarget.pxi":130
 *         self._python_target = target
 *         if not isinstance(target, _SaxParserTarget) or \
 *                 hasattr(target, '__dict__'):             # <<<<<<<<<<<<<<
 *             target = _PythonSaxParserTarget(target)
 *         self._setSaxParserTarget(target)
*/
  __pyx_t_3 = __Pyx_HasAttr(__pyx_v_target, __pyx_mstate_global->__pyx_n_u_dict); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(13, 130, __pyx_L1_error)
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;

  /* "src/lxml/parsertarget.pxi":129
 *     cdef int _setTarget(self, target) except -1:
 *         self._python_target = target
 *         if not isinstance(target, _SaxParserTarget) or \             # <<<<<<<<<<<<<<
 *                 hasattr(target, '__dict__'):
 *             target = _PythonSaxParserTarget(target)
*/
  if (__pyx_t_1) {

    /* "src/lxml/parsertarget.pxi":131
 *         if not isinstance(target, _SaxParserTarget) or \
 *                 hasattr(target, '__dict__'):
 *             target = _PythonSaxParserTarget(target)             # <<<<<<<<<<<<<<
 *         self._setSaxParserTarget(target)
 *         return 0
*/
    __pyx_t_5 = NULL;
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_target};
      __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__PythonSaxParserTarget, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 131, __pyx_L1_error)
      __Pyx_GOTREF((PyObject *)__pyx_t_4);
    }
    __Pyx_DECREF_SET(__pyx_v_target, ((PyObject *)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "src/lxml/parsertarget.pxi":129
 *     cdef int _setTarget(self, target) except -1:
 *         self._python_target = target
 *         if not isinstance(target, _SaxParserTarget) or \             # <<<<<<<<<<<<<<
 *                 hasattr(target, '__dict__'):
 *             target = _PythonSaxParserTarget(target)
*/
  }

  /* "src/lxml/parsertarget.pxi":132
 *                 hasattr(target, '__dict__'):
 *             target = _PythonSaxParserTarget(target)
 *         self._setSaxParserTarget(target)             # <<<<<<<<<<<<<<
 *         return 0
 * 
*/
  if (!(likely(((__pyx_v_target) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_target, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__SaxParserTarget))))) __PYX_ERR(13, 132, __pyx_L1_error)
  ((struct __pyx_vtabstruct_4lxml_5etree__TargetParserContext *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base._setSaxParserTarget(((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_v_self), ((struct __pyx_obj_4lxml_5etree__SaxParserTarget *)__pyx_v_target));

  /* "src/lxml/parsertarget.pxi":133
 *             target = _PythonSaxParserTarget(target)
 *         self._setSaxParserTarget(target)
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     cdef _ParserContext _copy(self):
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/parsertarget.pxi":127
 *     """
 *     cdef object _python_target
 *     cdef int _setTarget(self, target) except -1:             # <<<<<<<<<<<<<<
 *         self._python_target = target
 *         if not isinstance(target, _SaxParserTarget) or \
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._TargetParserContext._setTarget", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_target);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parsertarget.pxi":135
 *         return 0
 * 
 *     cdef _ParserContext _copy(self):             # <<<<<<<<<<<<<<
 *         cdef _TargetParserContext context
 *         context = _ParserContext._copy(self)
*/

static struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_f_4lxml_5etree_20_TargetParserContext__copy(struct __pyx_obj_4lxml_5etree__TargetParserContext *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree__TargetParserContext *__pyx_v_context = 0;
  struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_copy", 0);

  /* "src/lxml/parsertarget.pxi":137
 *     cdef _ParserContext _copy(self):
 *         cdef _TargetParserContext context
 *         context = _ParserContext._copy(self)             # <<<<<<<<<<<<<<
 *         context._setTarget(self._python_target)
 *         return context
*/
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree_14_ParserContext__copy(((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_v_self))); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 137, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__TargetParserContext))))) __PYX_ERR(13, 137, __pyx_L1_error)
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__TargetParserContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/parsertarget.pxi":138
 *         cdef _TargetParserContext context
 *         context = _ParserContext._copy(self)
 *         context._setTarget(self._python_target)             # <<<<<<<<<<<<<<
 *         return context
 * 
*/
  __pyx_t_1 = __pyx_v_self->_python_target;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree_20_TargetParserContext__setTarget(__pyx_v_context, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(13, 138, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/parsertarget.pxi":139
 *         context = _ParserContext._copy(self)
 *         context._setTarget(self._python_target)
 *         return context             # <<<<<<<<<<<<<<
 * 
 *     cdef void _cleanupTargetParserContext(self, xmlDoc* result) noexcept:
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_context);
  __pyx_r = ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_v_context);
  goto __pyx_L0;

  /* "src/lxml/parsertarget.pxi":135
 *         return 0
 * 
 *     cdef _ParserContext _copy(self):             # <<<<<<<<<<<<<<
 *         cdef _TargetParserContext context
 *         context = _ParserContext._copy(self)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._TargetParserContext._copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parsertarget.pxi":141
 *         return context
 * 
 *     cdef void _cleanupTargetParserContext(self, xmlDoc* result) noexcept:             # <<<<<<<<<<<<<<
 *         if self._c_ctxt.myDoc is not NULL:
 *             if self._c_ctxt.myDoc is not result and \
*/

static void __pyx_f_4lxml_5etree_20_TargetParserContext__cleanupTargetParserContext(struct __pyx_obj_4lxml_5etree__TargetParserContext *__pyx_v_self, xmlDoc *__pyx_v_result) {
  int __pyx_t_1;
  int __pyx_t_2;

  /* "src/lxml/parsertarget.pxi":142
 * 
 *     cdef void _cleanupTargetParserContext(self, xmlDoc* result) noexcept:
 *         if self._c_ctxt.myDoc is not NULL:             # <<<<<<<<<<<<<<
 *             if self._c_ctxt.myDoc is not result and \
 *                     self._c_ctxt.myDoc._private is NULL:
*/
  __pyx_t_1 = (__pyx_v_self->__pyx_base.__pyx_base._c_ctxt->myDoc != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/parsertarget.pxi":143
 *     cdef void _cleanupTargetParserContext(self, xmlDoc* result) noexcept:
 *         if self._c_ctxt.myDoc is not NULL:
 *             if self._c_ctxt.myDoc is not result and \             # <<<<<<<<<<<<<<
 *                     self._c_ctxt.myDoc._private is NULL:
 *                 # no _Document proxy => orphen
*/
    __pyx_t_2 = (__pyx_v_self->__pyx_base.__pyx_base._c_ctxt->myDoc != __pyx_v_result);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L5_bool_binop_done;
    }

    /* "src/lxml/parsertarget.pxi":144
 *         if self._c_ctxt.myDoc is not NULL:
 *             if self._c_ctxt.myDoc is not result and \
 *                     self._c_ctxt.myDoc._private is NULL:             # <<<<<<<<<<<<<<
 *                 # no _Document proxy => orphen
 *                 tree.xmlFreeDoc(self._c_ctxt.myDoc)
*/
    __pyx_t_2 = (__pyx_v_self->__pyx_base.__pyx_base._c_ctxt->myDoc->_private == NULL);
    __pyx_t_1 = __pyx_t_2;
    __pyx_L5_bool_binop_done:;

    /* "src/lxml/parsertarget.pxi":143
 *     cdef void _cleanupTargetParserContext(self, xmlDoc* result) noexcept:
 *         if self._c_ctxt.myDoc is not NULL:
 *             if self._c_ctxt.myDoc is not result and \             # <<<<<<<<<<<<<<
 *                     self._c_ctxt.myDoc._private is NULL:
 *                 # no _Document proxy => orphen
*/
    if (__pyx_t_1) {

      /* "src/lxml/parsertarget.pxi":146
 *                     self._c_ctxt.myDoc._private is NULL:
 *                 # no _Document proxy => orphen
 *                 tree.xmlFreeDoc(self._c_ctxt.myDoc)             # <<<<<<<<<<<<<<
 *             self._c_ctxt.myDoc = NULL
 * 
*/
      xmlFreeDoc(__pyx_v_self->__pyx_base.__pyx_base._c_ctxt->myDoc);

      /* "src/lxml/parsertarget.pxi":143
 *     cdef void _cleanupTargetParserContext(self, xmlDoc* result) noexcept:
 *         if self._c_ctxt.myDoc is not NULL:
 *             if self._c_ctxt.myDoc is not result and \             # <<<<<<<<<<<<<<
 *                     self._c_ctxt.myDoc._private is NULL:
 *                 # no _Document proxy => orphen
*/
    }

    /* "src/lxml/parsertarget.pxi":147
 *                 # no _Document proxy => orphen
 *                 tree.xmlFreeDoc(self._c_ctxt.myDoc)
 *             self._c_ctxt.myDoc = NULL             # <<<<<<<<<<<<<<
 * 
 *     cdef object _handleParseResult(self, _BaseParser parser, xmlDoc* result,
*/
    __pyx_v_self->__pyx_base.__pyx_base._c_ctxt->myDoc = NULL;

    /* "src/lxml/parsertarget.pxi":142
 * 
 *     cdef void _cleanupTargetParserContext(self, xmlDoc* result) noexcept:
 *         if self._c_ctxt.myDoc is not NULL:             # <<<<<<<<<<<<<<
 *             if self._c_ctxt.myDoc is not result and \
 *                     self._c_ctxt.myDoc._private is NULL:
*/
  }

  /* "src/lxml/parsertarget.pxi":141
 *         return context
 * 
 *     cdef void _cleanupTargetParserContext(self, xmlDoc* result) noexcept:             # <<<<<<<<<<<<<<
 *         if self._c_ctxt.myDoc is not NULL:
 *             if self._c_ctxt.myDoc is not result and \
*/

  /* function exit code */
}

/* "src/lxml/parsertarget.pxi":149
 *             self._c_ctxt.myDoc = NULL
 * 
 *     cdef object _handleParseResult(self, _BaseParser parser, xmlDoc* result,             # <<<<<<<<<<<<<<
 *                                    filename):
 *         cdef bint recover
*/

static PyObject *__pyx_f_4lxml_5etree_20_TargetParserContext__handleParseResult(struct __pyx_obj_4lxml_5etree__TargetParserContext *__pyx_v_self, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser, xmlDoc *__pyx_v_result, PyObject *__pyx_v_filename) {
  int __pyx_v_recover;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  size_t __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_handleParseResult", 0);

  /* "src/lxml/parsertarget.pxi":152
 *                                    filename):
 *         cdef bint recover
 *         recover = parser._parse_options & xmlparser.XML_PARSE_RECOVER             # <<<<<<<<<<<<<<
 *         try:
 *             if self._has_raised():
*/
  __pyx_v_recover = (__pyx_v_parser->_parse_options & XML_PARSE_RECOVER);

  /* "src/lxml/parsertarget.pxi":153
 *         cdef bint recover
 *         recover = parser._parse_options & xmlparser.XML_PARSE_RECOVER
 *         try:             # <<<<<<<<<<<<<<
 *             if self._has_raised():
 *                 self._cleanupTargetParserContext(result)
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "src/lxml/parsertarget.pxi":154
 *         recover = parser._parse_options & xmlparser.XML_PARSE_RECOVER
 *         try:
 *             if self._has_raised():             # <<<<<<<<<<<<<<
 *                 self._cleanupTargetParserContext(result)
 *                 self._raise_if_stored()
*/
      __pyx_t_4 = __pyx_f_4lxml_5etree_17_ExceptionContext__has_raised(((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_v_self)); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(13, 154, __pyx_L3_error)
      if (__pyx_t_4) {

        /* "src/lxml/parsertarget.pxi":155
 *         try:
 *             if self._has_raised():
 *                 self._cleanupTargetParserContext(result)             # <<<<<<<<<<<<<<
 *                 self._raise_if_stored()
 *             if not self._c_ctxt.wellFormed and not recover:
*/
        __pyx_f_4lxml_5etree_20_TargetParserContext__cleanupTargetParserContext(__pyx_v_self, __pyx_v_result);

        /* "src/lxml/parsertarget.pxi":156
 *             if self._has_raised():
 *                 self._cleanupTargetParserContext(result)
 *                 self._raise_if_stored()             # <<<<<<<<<<<<<<
 *             if not self._c_ctxt.wellFormed and not recover:
 *                 _raiseParseError(self._c_ctxt, filename, self._error_log)
*/
        __pyx_t_5 = __pyx_f_4lxml_5etree_17_ExceptionContext__raise_if_stored(((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_v_self)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(13, 156, __pyx_L3_error)

        /* "src/lxml/parsertarget.pxi":154
 *         recover = parser._parse_options & xmlparser.XML_PARSE_RECOVER
 *         try:
 *             if self._has_raised():             # <<<<<<<<<<<<<<
 *                 self._cleanupTargetParserContext(result)
 *                 self._raise_if_stored()
*/
      }

      /* "src/lxml/parsertarget.pxi":157
 *                 self._cleanupTargetParserContext(result)
 *                 self._raise_if_stored()
 *             if not self._c_ctxt.wellFormed and not recover:             # <<<<<<<<<<<<<<
 *                 _raiseParseError(self._c_ctxt, filename, self._error_log)
 *         except:
*/
      __pyx_t_6 = (!__pyx_v_self->__pyx_base.__pyx_base._c_ctxt->wellFormed);
      if (__pyx_t_6) {
      } else {
        __pyx_t_4 = __pyx_t_6;
        goto __pyx_L11_bool_binop_done;
      }
      __pyx_t_6 = (!__pyx_v_recover);
      __pyx_t_4 = __pyx_t_6;
      __pyx_L11_bool_binop_done:;
      if (__pyx_t_4) {

        /* "src/lxml/parsertarget.pxi":158
 *                 self._raise_if_stored()
 *             if not self._c_ctxt.wellFormed and not recover:
 *                 _raiseParseError(self._c_ctxt, filename, self._error_log)             # <<<<<<<<<<<<<<
 *         except:
 *             self._python_target.close()
*/
        __pyx_t_7 = ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base._error_log);
        __Pyx_INCREF(__pyx_t_7);
        __pyx_t_5 = __pyx_f_4lxml_5etree__raiseParseError(__pyx_v_self->__pyx_base.__pyx_base._c_ctxt, __pyx_v_filename, ((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_t_7)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(13, 158, __pyx_L3_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

        /* "src/lxml/parsertarget.pxi":157
 *                 self._cleanupTargetParserContext(result)
 *                 self._raise_if_stored()
 *             if not self._c_ctxt.wellFormed and not recover:             # <<<<<<<<<<<<<<
 *                 _raiseParseError(self._c_ctxt, filename, self._error_log)
 *         except:
*/
      }

      /* "src/lxml/parsertarget.pxi":153
 *         cdef bint recover
 *         recover = parser._parse_options & xmlparser.XML_PARSE_RECOVER
 *         try:             # <<<<<<<<<<<<<<
 *             if self._has_raised():
 *                 self._cleanupTargetParserContext(result)
*/
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "src/lxml/parsertarget.pxi":159
 *             if not self._c_ctxt.wellFormed and not recover:
 *                 _raiseParseError(self._c_ctxt, filename, self._error_log)
 *         except:             # <<<<<<<<<<<<<<
 *             self._python_target.close()
 *             raise
*/
    /*except:*/ {
      __Pyx_AddTraceback("lxml.etree._TargetParserContext._handleParseResult", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0) __PYX_ERR(13, 159, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);

      /* "src/lxml/parsertarget.pxi":160
 *                 _raiseParseError(self._c_ctxt, filename, self._error_log)
 *         except:
 *             self._python_target.close()             # <<<<<<<<<<<<<<
 *             raise
 *         return self._python_target.close()
*/
      __pyx_t_11 = __pyx_v_self->_python_target;
      __Pyx_INCREF(__pyx_t_11);
      __pyx_t_12 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_11, NULL};
        __pyx_t_10 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_close, __pyx_callargs+__pyx_t_12, (1-__pyx_t_12) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        if (unlikely(!__pyx_t_10)) __PYX_ERR(13, 160, __pyx_L5_except_error)
        __Pyx_GOTREF(__pyx_t_10);
      }
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

      /* "src/lxml/parsertarget.pxi":161
 *         except:
 *             self._python_target.close()
 *             raise             # <<<<<<<<<<<<<<
 *         return self._python_target.close()
 * 
*/
      __Pyx_GIVEREF(__pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_ErrRestoreWithState(__pyx_t_7, __pyx_t_8, __pyx_t_9);
      __pyx_t_7 = 0;  __pyx_t_8 = 0;  __pyx_t_9 = 0; 
      __PYX_ERR(13, 161, __pyx_L5_except_error)
    }

    /* "src/lxml/parsertarget.pxi":153
 *         cdef bint recover
 *         recover = parser._parse_options & xmlparser.XML_PARSE_RECOVER
 *         try:             # <<<<<<<<<<<<<<
 *             if self._has_raised():
 *                 self._cleanupTargetParserContext(result)
*/
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L8_try_end:;
  }

  /* "src/lxml/parsertarget.pxi":162
 *             self._python_target.close()
 *             raise
 *         return self._python_target.close()             # <<<<<<<<<<<<<<
 * 
 *     cdef xmlDoc* _handleParseResultDoc(self, _BaseParser parser,
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_8 = __pyx_v_self->_python_target;
  __Pyx_INCREF(__pyx_t_8);
  __pyx_t_12 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_8, NULL};
    __pyx_t_9 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_close, __pyx_callargs+__pyx_t_12, (1-__pyx_t_12) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_9)) __PYX_ERR(13, 162, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
  }
  __pyx_r = __pyx_t_9;
  __pyx_t_9 = 0;
  goto __pyx_L0;

  /* "src/lxml/parsertarget.pxi":149
 *             self._c_ctxt.myDoc = NULL
 * 
 *     cdef object _handleParseResult(self, _BaseParser parser, xmlDoc* result,             # <<<<<<<<<<<<<<
 *                                    filename):
 *         cdef bint recover
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("lxml.etree._TargetParserContext._handleParseResult", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parsertarget.pxi":164
 *         return self._python_target.close()
 * 
 *     cdef xmlDoc* _handleParseResultDoc(self, _BaseParser parser,             # <<<<<<<<<<<<<<
 *                                        xmlDoc* result, filename) except NULL:
 *         cdef bint recover
*/

static xmlDoc *__pyx_f_4lxml_5etree_20_TargetParserContext__handleParseResultDoc(struct __pyx_obj_4lxml_5etree__TargetParserContext *__pyx_v_self, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser, xmlDoc *__pyx_v_result, PyObject *__pyx_v_filename) {
  int __pyx_v_recover;
  PyObject *__pyx_v_parse_result = NULL;
  xmlDoc *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  size_t __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_handleParseResultDoc", 0);

  /* "src/lxml/parsertarget.pxi":167
 *                                        xmlDoc* result, filename) except NULL:
 *         cdef bint recover
 *         recover = parser._parse_options & xmlparser.XML_PARSE_RECOVER             # <<<<<<<<<<<<<<
 *         if result is not NULL and result._private is NULL:
 *             # no _Document proxy => orphen
*/
  __pyx_v_recover = (__pyx_v_parser->_parse_options & XML_PARSE_RECOVER);

  /* "src/lxml/parsertarget.pxi":168
 *         cdef bint recover
 *         recover = parser._parse_options & xmlparser.XML_PARSE_RECOVER
 *         if result is not NULL and result._private is NULL:             # <<<<<<<<<<<<<<
 *             # no _Document proxy => orphen
 *             tree.xmlFreeDoc(result)
*/
  __pyx_t_2 = (__pyx_v_result != NULL);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_result->_private == NULL);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/parsertarget.pxi":170
 *         if result is not NULL and result._private is NULL:
 *             # no _Document proxy => orphen
 *             tree.xmlFreeDoc(result)             # <<<<<<<<<<<<<<
 *         try:
 *             self._cleanupTargetParserContext(result)
*/
    xmlFreeDoc(__pyx_v_result);

    /* "src/lxml/parsertarget.pxi":168
 *         cdef bint recover
 *         recover = parser._parse_options & xmlparser.XML_PARSE_RECOVER
 *         if result is not NULL and result._private is NULL:             # <<<<<<<<<<<<<<
 *             # no _Document proxy => orphen
 *             tree.xmlFreeDoc(result)
*/
  }

  /* "src/lxml/parsertarget.pxi":171
 *             # no _Document proxy => orphen
 *             tree.xmlFreeDoc(result)
 *         try:             # <<<<<<<<<<<<<<
 *             self._cleanupTargetParserContext(result)
 *             self._raise_if_stored()
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    /*try:*/ {

      /* "src/lxml/parsertarget.pxi":172
 *             tree.xmlFreeDoc(result)
 *         try:
 *             self._cleanupTargetParserContext(result)             # <<<<<<<<<<<<<<
 *             self._raise_if_stored()
 *             if not self._c_ctxt.wellFormed and not recover:
*/
      __pyx_f_4lxml_5etree_20_TargetParserContext__cleanupTargetParserContext(__pyx_v_self, __pyx_v_result);

      /* "src/lxml/parsertarget.pxi":173
 *         try:
 *             self._cleanupTargetParserContext(result)
 *             self._raise_if_stored()             # <<<<<<<<<<<<<<
 *             if not self._c_ctxt.wellFormed and not recover:
 *                 _raiseParseError(self._c_ctxt, filename, self._error_log)
*/
      __pyx_t_6 = __pyx_f_4lxml_5etree_17_ExceptionContext__raise_if_stored(((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_v_self)); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(13, 173, __pyx_L6_error)

      /* "src/lxml/parsertarget.pxi":174
 *             self._cleanupTargetParserContext(result)
 *             self._raise_if_stored()
 *             if not self._c_ctxt.wellFormed and not recover:             # <<<<<<<<<<<<<<
 *                 _raiseParseError(self._c_ctxt, filename, self._error_log)
 *         except:
*/
      __pyx_t_2 = (!__pyx_v_self->__pyx_base.__pyx_base._c_ctxt->wellFormed);
      if (__pyx_t_2) {
      } else {
        __pyx_t_1 = __pyx_t_2;
        goto __pyx_L13_bool_binop_done;
      }
      __pyx_t_2 = (!__pyx_v_recover);
      __pyx_t_1 = __pyx_t_2;
      __pyx_L13_bool_binop_done:;
      if (__pyx_t_1) {

        /* "src/lxml/parsertarget.pxi":175
 *             self._raise_if_stored()
 *             if not self._c_ctxt.wellFormed and not recover:
 *                 _raiseParseError(self._c_ctxt, filename, self._error_log)             # <<<<<<<<<<<<<<
 *         except:
 *             self._python_target.close()
*/
        __pyx_t_7 = ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base._error_log);
        __Pyx_INCREF(__pyx_t_7);
        __pyx_t_6 = __pyx_f_4lxml_5etree__raiseParseError(__pyx_v_self->__pyx_base.__pyx_base._c_ctxt, __pyx_v_filename, ((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_t_7)); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(13, 175, __pyx_L6_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

        /* "src/lxml/parsertarget.pxi":174
 *             self._cleanupTargetParserContext(result)
 *             self._raise_if_stored()
 *             if not self._c_ctxt.wellFormed and not recover:             # <<<<<<<<<<<<<<
 *                 _raiseParseError(self._c_ctxt, filename, self._error_log)
 *         except:
*/
      }

      /* "src/lxml/parsertarget.pxi":171
 *             # no _Document proxy => orphen
 *             tree.xmlFreeDoc(result)
 *         try:             # <<<<<<<<<<<<<<
 *             self._cleanupTargetParserContext(result)
 *             self._raise_if_stored()
*/
    }
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L11_try_end;
    __pyx_L6_error:;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "src/lxml/parsertarget.pxi":176
 *             if not self._c_ctxt.wellFormed and not recover:
 *                 _raiseParseError(self._c_ctxt, filename, self._error_log)
 *         except:             # <<<<<<<<<<<<<<
 *             self._python_target.close()
 *             raise
*/
    /*except:*/ {
      __Pyx_AddTraceback("lxml.etree._TargetParserContext._handleParseResultDoc", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0) __PYX_ERR(13, 176, __pyx_L8_except_error)
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);

      /* "src/lxml/parsertarget.pxi":177
 *                 _raiseParseError(self._c_ctxt, filename, self._error_log)
 *         except:
 *             self._python_target.close()             # <<<<<<<<<<<<<<
 *             raise
 *         parse_result = self._python_target.close()
*/
      __pyx_t_11 = __pyx_v_self->_python_target;
      __Pyx_INCREF(__pyx_t_11);
      __pyx_t_12 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_11, NULL};
        __pyx_t_10 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_close, __pyx_callargs+__pyx_t_12, (1-__pyx_t_12) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        if (unlikely(!__pyx_t_10)) __PYX_ERR(13, 177, __pyx_L8_except_error)
        __Pyx_GOTREF(__pyx_t_10);
      }
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

      /* "src/lxml/parsertarget.pxi":178
 *         except:
 *             self._python_target.close()
 *             raise             # <<<<<<<<<<<<<<
 *         parse_result = self._python_target.close()
 *         raise _TargetParserResult(parse_result)
*/
      __Pyx_GIVEREF(__pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_ErrRestoreWithState(__pyx_t_7, __pyx_t_8, __pyx_t_9);
      __pyx_t_7 = 0;  __pyx_t_8 = 0;  __pyx_t_9 = 0; 
      __PYX_ERR(13, 178, __pyx_L8_except_error)
    }

    /* "src/lxml/parsertarget.pxi":171
 *             # no _Document proxy => orphen
 *             tree.xmlFreeDoc(result)
 *         try:             # <<<<<<<<<<<<<<
 *             self._cleanupTargetParserContext(result)
 *             self._raise_if_stored()
*/
    __pyx_L8_except_error:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    goto __pyx_L1_error;
    __pyx_L11_try_end:;
  }

  /* "src/lxml/parsertarget.pxi":179
 *             self._python_target.close()
 *             raise
 *         parse_result = self._python_target.close()             # <<<<<<<<<<<<<<
 *         raise _TargetParserResult(parse_result)
*/
  __pyx_t_8 = __pyx_v_self->_python_target;
  __Pyx_INCREF(__pyx_t_8);
  __pyx_t_12 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_8, NULL};
    __pyx_t_9 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_close, __pyx_callargs+__pyx_t_12, (1-__pyx_t_12) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_9)) __PYX_ERR(13, 179, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
  }
  __pyx_v_parse_result = __pyx_t_9;
  __pyx_t_9 = 0;

  /* "src/lxml/parsertarget.pxi":180
 *             raise
 *         parse_result = self._python_target.close()
 *         raise _TargetParserResult(parse_result)             # <<<<<<<<<<<<<<
*/
  __pyx_t_8 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_TargetParserResult); if (unlikely(!__pyx_t_7)) __PYX_ERR(13, 180, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_12 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
    assert(__pyx_t_8);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
    __Pyx_INCREF(__pyx_t_8);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
    __pyx_t_12 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_v_parse_result};
    __pyx_t_9 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_12, (2-__pyx_t_12) | (__pyx_t_12*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_9)) __PYX_ERR(13, 180, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
  }
  __Pyx_Raise(__pyx_t_9, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __PYX_ERR(13, 180, __pyx_L1_error)

  /* "src/lxml/parsertarget.pxi":164
 *         return self._python_target.close()
 * 
 *     cdef xmlDoc* _handleParseResultDoc(self, _BaseParser parser,             # <<<<<<<<<<<<<<
 *                                        xmlDoc* result, filename) except NULL:
 *         cdef bint recover
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("lxml.etree._TargetParserContext._handleParseResultDoc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XDECREF(__pyx_v_parse_result);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":18
 * 
 * 
 * cdef int _findOutputMethod(method) except -1:             # <<<<<<<<<<<<<<
 *     if method is None:
 *         return OUTPUT_METHOD_XML
*/

static int __pyx_f_4lxml_5etree__findOutputMethod(PyObject *__pyx_v_method) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_findOutputMethod", 0);
  __Pyx_INCREF(__pyx_v_method);

  /* "src/lxml/serializer.pxi":19
 * 
 * cdef int _findOutputMethod(method) except -1:
 *     if method is None:             # <<<<<<<<<<<<<<
 *         return OUTPUT_METHOD_XML
 *     method = method.lower()
*/
  __pyx_t_1 = (__pyx_v_method == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":20
 * cdef int _findOutputMethod(method) except -1:
 *     if method is None:
 *         return OUTPUT_METHOD_XML             # <<<<<<<<<<<<<<
 *     method = method.lower()
 *     if method == "xml":
*/
    __pyx_r = __pyx_e_4lxml_5etree_OUTPUT_METHOD_XML;
    goto __pyx_L0;

    /* "src/lxml/serializer.pxi":19
 * 
 * cdef int _findOutputMethod(method) except -1:
 *     if method is None:             # <<<<<<<<<<<<<<
 *         return OUTPUT_METHOD_XML
 *     method = method.lower()
*/
  }

  /* "src/lxml/serializer.pxi":21
 *     if method is None:
 *         return OUTPUT_METHOD_XML
 *     method = method.lower()             # <<<<<<<<<<<<<<
 *     if method == "xml":
 *         return OUTPUT_METHOD_XML
*/
  __pyx_t_3 = __pyx_v_method;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
    __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_lower, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 21, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __Pyx_DECREF_SET(__pyx_v_method, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/serializer.pxi":22
 *         return OUTPUT_METHOD_XML
 *     method = method.lower()
 *     if method == "xml":             # <<<<<<<<<<<<<<
 *         return OUTPUT_METHOD_XML
 *     if method == "html":
*/
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_method, __pyx_mstate_global->__pyx_n_u_xml, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(6, 22, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":23
 *     method = method.lower()
 *     if method == "xml":
 *         return OUTPUT_METHOD_XML             # <<<<<<<<<<<<<<
 *     if method == "html":
 *         return OUTPUT_METHOD_HTML
*/
    __pyx_r = __pyx_e_4lxml_5etree_OUTPUT_METHOD_XML;
    goto __pyx_L0;

    /* "src/lxml/serializer.pxi":22
 *         return OUTPUT_METHOD_XML
 *     method = method.lower()
 *     if method == "xml":             # <<<<<<<<<<<<<<
 *         return OUTPUT_METHOD_XML
 *     if method == "html":
*/
  }

  /* "src/lxml/serializer.pxi":24
 *     if method == "xml":
 *         return OUTPUT_METHOD_XML
 *     if method == "html":             # <<<<<<<<<<<<<<
 *         return OUTPUT_METHOD_HTML
 *     if method == "text":
*/
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_method, __pyx_mstate_global->__pyx_n_u_html, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(6, 24, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":25
 *         return OUTPUT_METHOD_XML
 *     if method == "html":
 *         return OUTPUT_METHOD_HTML             # <<<<<<<<<<<<<<
 *     if method == "text":
 *         return OUTPUT_METHOD_TEXT
*/
    __pyx_r = __pyx_e_4lxml_5etree_OUTPUT_METHOD_HTML;
    goto __pyx_L0;

    /* "src/lxml/serializer.pxi":24
 *     if method == "xml":
 *         return OUTPUT_METHOD_XML
 *     if method == "html":             # <<<<<<<<<<<<<<
 *         return OUTPUT_METHOD_HTML
 *     if method == "text":
*/
  }

  /* "src/lxml/serializer.pxi":26
 *     if method == "html":
 *         return OUTPUT_METHOD_HTML
 *     if method == "text":             # <<<<<<<<<<<<<<
 *         return OUTPUT_METHOD_TEXT
 *     raise ValueError(f"unknown output method {method!r}")
*/
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_method, __pyx_mstate_global->__pyx_n_u_text, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(6, 26, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":27
 *         return OUTPUT_METHOD_HTML
 *     if method == "text":
 *         return OUTPUT_METHOD_TEXT             # <<<<<<<<<<<<<<
 *     raise ValueError(f"unknown output method {method!r}")
 * 
*/
    __pyx_r = __pyx_e_4lxml_5etree_OUTPUT_METHOD_TEXT;
    goto __pyx_L0;

    /* "src/lxml/serializer.pxi":26
 *     if method == "html":
 *         return OUTPUT_METHOD_HTML
 *     if method == "text":             # <<<<<<<<<<<<<<
 *         return OUTPUT_METHOD_TEXT
 *     raise ValueError(f"unknown output method {method!r}")
*/
  }

  /* "src/lxml/serializer.pxi":28
 *     if method == "text":
 *         return OUTPUT_METHOD_TEXT
 *     raise ValueError(f"unknown output method {method!r}")             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_3 = NULL;
  __pyx_t_5 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_method), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 28, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_unknown_output_method, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 28, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_4 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_6};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 28, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __Pyx_Raise(__pyx_t_2, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __PYX_ERR(6, 28, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":18
 * 
 * 
 * cdef int _findOutputMethod(method) except -1:             # <<<<<<<<<<<<<<
 *     if method is None:
 *         return OUTPUT_METHOD_XML
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._findOutputMethod", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_method);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":31
 * 
 * 
 * cdef _textToString(xmlNode* c_node, encoding, bint with_tail):             # <<<<<<<<<<<<<<
 *     cdef bint needs_conversion
 *     cdef const_xmlChar* c_text
*/

static PyObject *__pyx_f_4lxml_5etree__textToString(xmlNode *__pyx_v_c_node, PyObject *__pyx_v_encoding, int __pyx_v_with_tail) {
  int __pyx_v_needs_conversion;
  const xmlChar *__pyx_v_c_text;
  xmlNode *__pyx_v_c_text_node;
  xmlBuffer *__pyx_v_c_buffer;
  int __pyx_v_error_result;
  PyObject *__pyx_v_text = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  char *__pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  char const *__pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_textToString", 0);
  __Pyx_INCREF(__pyx_v_encoding);

  /* "src/lxml/serializer.pxi":38
 *     cdef int error_result
 * 
 *     c_buffer = tree.xmlBufferCreate()             # <<<<<<<<<<<<<<
 *     if c_buffer is NULL:
 *         raise MemoryError()
*/
  __pyx_v_c_buffer = xmlBufferCreate();

  /* "src/lxml/serializer.pxi":39
 * 
 *     c_buffer = tree.xmlBufferCreate()
 *     if c_buffer is NULL:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 * 
*/
  __pyx_t_1 = (__pyx_v_c_buffer == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/serializer.pxi":40
 *     c_buffer = tree.xmlBufferCreate()
 *     if c_buffer is NULL:
 *         raise MemoryError()             # <<<<<<<<<<<<<<
 * 
 *     with nogil:
*/
    PyErr_NoMemory(); __PYX_ERR(6, 40, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":39
 * 
 *     c_buffer = tree.xmlBufferCreate()
 *     if c_buffer is NULL:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 * 
*/
  }

  /* "src/lxml/serializer.pxi":42
 *         raise MemoryError()
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         error_result = tree.xmlNodeBufGetContent(c_buffer, c_node)
 *         if with_tail:
*/
  {
      PyThreadState * _save;
      _save = PyEval_SaveThread();
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "src/lxml/serializer.pxi":43
 * 
 *     with nogil:
 *         error_result = tree.xmlNodeBufGetContent(c_buffer, c_node)             # <<<<<<<<<<<<<<
 *         if with_tail:
 *             c_text_node = _textNodeOrSkip(c_node.next)
*/
        __pyx_v_error_result = xmlNodeBufGetContent(__pyx_v_c_buffer, __pyx_v_c_node);

        /* "src/lxml/serializer.pxi":44
 *     with nogil:
 *         error_result = tree.xmlNodeBufGetContent(c_buffer, c_node)
 *         if with_tail:             # <<<<<<<<<<<<<<
 *             c_text_node = _textNodeOrSkip(c_node.next)
 *             while c_text_node is not NULL:
*/
        if (__pyx_v_with_tail) {

          /* "src/lxml/serializer.pxi":45
 *         error_result = tree.xmlNodeBufGetContent(c_buffer, c_node)
 *         if with_tail:
 *             c_text_node = _textNodeOrSkip(c_node.next)             # <<<<<<<<<<<<<<
 *             while c_text_node is not NULL:
 *                 tree.xmlBufferWriteChar(c_buffer, <const_char*>c_text_node.content)
*/
          __pyx_v_c_text_node = __pyx_f_4lxml_5etree__textNodeOrSkip(__pyx_v_c_node->next);

          /* "src/lxml/serializer.pxi":46
 *         if with_tail:
 *             c_text_node = _textNodeOrSkip(c_node.next)
 *             while c_text_node is not NULL:             # <<<<<<<<<<<<<<
 *                 tree.xmlBufferWriteChar(c_buffer, <const_char*>c_text_node.content)
 *                 c_text_node = _textNodeOrSkip(c_text_node.next)
*/
          while (1) {
            __pyx_t_1 = (__pyx_v_c_text_node != NULL);
            if (!__pyx_t_1) break;

            /* "src/lxml/serializer.pxi":47
 *             c_text_node = _textNodeOrSkip(c_node.next)
 *             while c_text_node is not NULL:
 *                 tree.xmlBufferWriteChar(c_buffer, <const_char*>c_text_node.content)             # <<<<<<<<<<<<<<
 *                 c_text_node = _textNodeOrSkip(c_text_node.next)
 *         c_text = tree.xmlBufferContent(c_buffer)
*/
            xmlBufferWriteChar(__pyx_v_c_buffer, ((const char *)__pyx_v_c_text_node->content));

            /* "src/lxml/serializer.pxi":48
 *             while c_text_node is not NULL:
 *                 tree.xmlBufferWriteChar(c_buffer, <const_char*>c_text_node.content)
 *                 c_text_node = _textNodeOrSkip(c_text_node.next)             # <<<<<<<<<<<<<<
 *         c_text = tree.xmlBufferContent(c_buffer)
 * 
*/
            __pyx_v_c_text_node = __pyx_f_4lxml_5etree__textNodeOrSkip(__pyx_v_c_text_node->next);
          }

          /* "src/lxml/serializer.pxi":44
 *     with nogil:
 *         error_result = tree.xmlNodeBufGetContent(c_buffer, c_node)
 *         if with_tail:             # <<<<<<<<<<<<<<
 *             c_text_node = _textNodeOrSkip(c_node.next)
 *             while c_text_node is not NULL:
*/
        }

        /* "src/lxml/serializer.pxi":49
 *                 tree.xmlBufferWriteChar(c_buffer, <const_char*>c_text_node.content)
 *                 c_text_node = _textNodeOrSkip(c_text_node.next)
 *         c_text = tree.xmlBufferContent(c_buffer)             # <<<<<<<<<<<<<<
 * 
 *     if error_result < 0 or c_text is NULL:
*/
        __pyx_v_c_text = xmlBufferContent(__pyx_v_c_buffer);
      }

      /* "src/lxml/serializer.pxi":42
 *         raise MemoryError()
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         error_result = tree.xmlNodeBufGetContent(c_buffer, c_node)
 *         if with_tail:
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L6;
        }
        __pyx_L6:;
      }
  }

  /* "src/lxml/serializer.pxi":51
 *         c_text = tree.xmlBufferContent(c_buffer)
 * 
 *     if error_result < 0 or c_text is NULL:             # <<<<<<<<<<<<<<
 *         tree.xmlBufferFree(c_buffer)
 *         raise SerialisationError, "Error during serialisation (out of memory?)"
*/
  __pyx_t_2 = (__pyx_v_error_result < 0);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L11_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_c_text == NULL);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L11_bool_binop_done:;
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/serializer.pxi":52
 * 
 *     if error_result < 0 or c_text is NULL:
 *         tree.xmlBufferFree(c_buffer)             # <<<<<<<<<<<<<<
 *         raise SerialisationError, "Error during serialisation (out of memory?)"
 * 
*/
    xmlBufferFree(__pyx_v_c_buffer);

    /* "src/lxml/serializer.pxi":53
 *     if error_result < 0 or c_text is NULL:
 *         tree.xmlBufferFree(c_buffer)
 *         raise SerialisationError, "Error during serialisation (out of memory?)"             # <<<<<<<<<<<<<<
 * 
 *     try:
*/
    __Pyx_Raise(((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_SerialisationError), __pyx_mstate_global->__pyx_kp_u_Error_during_serialisation_out_o, 0, 0);
    __PYX_ERR(6, 53, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":51
 *         c_text = tree.xmlBufferContent(c_buffer)
 * 
 *     if error_result < 0 or c_text is NULL:             # <<<<<<<<<<<<<<
 *         tree.xmlBufferFree(c_buffer)
 *         raise SerialisationError, "Error during serialisation (out of memory?)"
*/
  }

  /* "src/lxml/serializer.pxi":55
 *         raise SerialisationError, "Error during serialisation (out of memory?)"
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         needs_conversion = 0
 *         if encoding is unicode:
*/
  /*try:*/ {

    /* "src/lxml/serializer.pxi":56
 * 
 *     try:
 *         needs_conversion = 0             # <<<<<<<<<<<<<<
 *         if encoding is unicode:
 *             needs_conversion = 1
*/
    __pyx_v_needs_conversion = 0;

    /* "src/lxml/serializer.pxi":57
 *     try:
 *         needs_conversion = 0
 *         if encoding is unicode:             # <<<<<<<<<<<<<<
 *             needs_conversion = 1
 *         elif encoding is not None:
*/
    __pyx_t_1 = (__pyx_v_encoding == ((PyObject *)(&PyUnicode_Type)));
    if (__pyx_t_1) {

      /* "src/lxml/serializer.pxi":58
 *         needs_conversion = 0
 *         if encoding is unicode:
 *             needs_conversion = 1             # <<<<<<<<<<<<<<
 *         elif encoding is not None:
 *             # Python prefers lower case encoding names
*/
      __pyx_v_needs_conversion = 1;

      /* "src/lxml/serializer.pxi":57
 *     try:
 *         needs_conversion = 0
 *         if encoding is unicode:             # <<<<<<<<<<<<<<
 *             needs_conversion = 1
 *         elif encoding is not None:
*/
      goto __pyx_L16;
    }

    /* "src/lxml/serializer.pxi":59
 *         if encoding is unicode:
 *             needs_conversion = 1
 *         elif encoding is not None:             # <<<<<<<<<<<<<<
 *             # Python prefers lower case encoding names
 *             encoding = encoding.lower()
*/
    __pyx_t_1 = (__pyx_v_encoding != Py_None);
    if (__pyx_t_1) {

      /* "src/lxml/serializer.pxi":61
 *         elif encoding is not None:
 *             # Python prefers lower case encoding names
 *             encoding = encoding.lower()             # <<<<<<<<<<<<<<
 *             if encoding not in ('utf8', 'utf-8'):
 *                 if encoding == 'ascii':
*/
      __pyx_t_4 = __pyx_v_encoding;
      __Pyx_INCREF(__pyx_t_4);
      __pyx_t_5 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
        __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_lower, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 61, __pyx_L14_error)
        __Pyx_GOTREF(__pyx_t_3);
      }
      __Pyx_DECREF_SET(__pyx_v_encoding, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "src/lxml/serializer.pxi":62
 *             # Python prefers lower case encoding names
 *             encoding = encoding.lower()
 *             if encoding not in ('utf8', 'utf-8'):             # <<<<<<<<<<<<<<
 *                 if encoding == 'ascii':
 *                     if isutf8l(c_text, tree.xmlBufferLength(c_buffer)):
*/
      __Pyx_INCREF(__pyx_v_encoding);
      __pyx_t_3 = __pyx_v_encoding;
      __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_utf8, Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(6, 62, __pyx_L14_error)
      if (__pyx_t_2) {
      } else {
        __pyx_t_1 = __pyx_t_2;
        goto __pyx_L18_bool_binop_done;
      }
      __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_utf_8, Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(6, 62, __pyx_L14_error)
      __pyx_t_1 = __pyx_t_2;
      __pyx_L18_bool_binop_done:;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_2 = __pyx_t_1;
      if (__pyx_t_2) {

        /* "src/lxml/serializer.pxi":63
 *             encoding = encoding.lower()
 *             if encoding not in ('utf8', 'utf-8'):
 *                 if encoding == 'ascii':             # <<<<<<<<<<<<<<
 *                     if isutf8l(c_text, tree.xmlBufferLength(c_buffer)):
 *                         # will raise a decode error below
*/
        __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_encoding, __pyx_mstate_global->__pyx_n_u_ascii, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(6, 63, __pyx_L14_error)
        if (__pyx_t_2) {

          /* "src/lxml/serializer.pxi":64
 *             if encoding not in ('utf8', 'utf-8'):
 *                 if encoding == 'ascii':
 *                     if isutf8l(c_text, tree.xmlBufferLength(c_buffer)):             # <<<<<<<<<<<<<<
 *                         # will raise a decode error below
 *                         needs_conversion = 1
*/
          __pyx_t_2 = __pyx_f_4lxml_5etree_isutf8l(__pyx_v_c_text, xmlBufferLength(__pyx_v_c_buffer));
          if (__pyx_t_2) {

            /* "src/lxml/serializer.pxi":66
 *                     if isutf8l(c_text, tree.xmlBufferLength(c_buffer)):
 *                         # will raise a decode error below
 *                         needs_conversion = 1             # <<<<<<<<<<<<<<
 *                 else:
 *                     needs_conversion = 1
*/
            __pyx_v_needs_conversion = 1;

            /* "src/lxml/serializer.pxi":64
 *             if encoding not in ('utf8', 'utf-8'):
 *                 if encoding == 'ascii':
 *                     if isutf8l(c_text, tree.xmlBufferLength(c_buffer)):             # <<<<<<<<<<<<<<
 *                         # will raise a decode error below
 *                         needs_conversion = 1
*/
          }

          /* "src/lxml/serializer.pxi":63
 *             encoding = encoding.lower()
 *             if encoding not in ('utf8', 'utf-8'):
 *                 if encoding == 'ascii':             # <<<<<<<<<<<<<<
 *                     if isutf8l(c_text, tree.xmlBufferLength(c_buffer)):
 *                         # will raise a decode error below
*/
          goto __pyx_L20;
        }

        /* "src/lxml/serializer.pxi":68
 *                         needs_conversion = 1
 *                 else:
 *                     needs_conversion = 1             # <<<<<<<<<<<<<<
 * 
 *         if needs_conversion:
*/
        /*else*/ {
          __pyx_v_needs_conversion = 1;
        }
        __pyx_L20:;

        /* "src/lxml/serializer.pxi":62
 *             # Python prefers lower case encoding names
 *             encoding = encoding.lower()
 *             if encoding not in ('utf8', 'utf-8'):             # <<<<<<<<<<<<<<
 *                 if encoding == 'ascii':
 *                     if isutf8l(c_text, tree.xmlBufferLength(c_buffer)):
*/
      }

      /* "src/lxml/serializer.pxi":59
 *         if encoding is unicode:
 *             needs_conversion = 1
 *         elif encoding is not None:             # <<<<<<<<<<<<<<
 *             # Python prefers lower case encoding names
 *             encoding = encoding.lower()
*/
    }
    __pyx_L16:;

    /* "src/lxml/serializer.pxi":70
 *                     needs_conversion = 1
 * 
 *         if needs_conversion:             # <<<<<<<<<<<<<<
 *             text = (<const_char*>c_text)[:tree.xmlBufferLength(c_buffer)].decode('utf8')
 *             if encoding is not unicode:
*/
    if (__pyx_v_needs_conversion) {

      /* "src/lxml/serializer.pxi":71
 * 
 *         if needs_conversion:
 *             text = (<const_char*>c_text)[:tree.xmlBufferLength(c_buffer)].decode('utf8')             # <<<<<<<<<<<<<<
 *             if encoding is not unicode:
 *                 encoding = _utf8(encoding)
*/
      __pyx_t_3 = __Pyx_decode_c_string(((const char *)__pyx_v_c_text), 0, xmlBufferLength(__pyx_v_c_buffer), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 71, __pyx_L14_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_v_text = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "src/lxml/serializer.pxi":72
 *         if needs_conversion:
 *             text = (<const_char*>c_text)[:tree.xmlBufferLength(c_buffer)].decode('utf8')
 *             if encoding is not unicode:             # <<<<<<<<<<<<<<
 *                 encoding = _utf8(encoding)
 *                 text = python.PyUnicode_AsEncodedString(
*/
      __pyx_t_2 = (__pyx_v_encoding != ((PyObject *)(&PyUnicode_Type)));
      if (__pyx_t_2) {

        /* "src/lxml/serializer.pxi":73
 *             text = (<const_char*>c_text)[:tree.xmlBufferLength(c_buffer)].decode('utf8')
 *             if encoding is not unicode:
 *                 encoding = _utf8(encoding)             # <<<<<<<<<<<<<<
 *                 text = python.PyUnicode_AsEncodedString(
 *                     text, encoding, 'strict')
*/
        __pyx_t_3 = __pyx_f_4lxml_5etree__utf8(__pyx_v_encoding); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 73, __pyx_L14_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF_SET(__pyx_v_encoding, __pyx_t_3);
        __pyx_t_3 = 0;

        /* "src/lxml/serializer.pxi":75
 *                 encoding = _utf8(encoding)
 *                 text = python.PyUnicode_AsEncodedString(
 *                     text, encoding, 'strict')             # <<<<<<<<<<<<<<
 *         else:
 *             text = (<unsigned char*>c_text)[:tree.xmlBufferLength(c_buffer)]
*/
        __pyx_t_6 = __Pyx_PyObject_AsWritableString(__pyx_v_encoding); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(6, 75, __pyx_L14_error)

        /* "src/lxml/serializer.pxi":74
 *             if encoding is not unicode:
 *                 encoding = _utf8(encoding)
 *                 text = python.PyUnicode_AsEncodedString(             # <<<<<<<<<<<<<<
 *                     text, encoding, 'strict')
 *         else:
*/
        __pyx_t_3 = PyUnicode_AsEncodedString(__pyx_v_text, __pyx_t_6, ((char *)"strict")); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 74, __pyx_L14_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF_SET(__pyx_v_text, __pyx_t_3);
        __pyx_t_3 = 0;

        /* "src/lxml/serializer.pxi":72
 *         if needs_conversion:
 *             text = (<const_char*>c_text)[:tree.xmlBufferLength(c_buffer)].decode('utf8')
 *             if encoding is not unicode:             # <<<<<<<<<<<<<<
 *                 encoding = _utf8(encoding)
 *                 text = python.PyUnicode_AsEncodedString(
*/
      }

      /* "src/lxml/serializer.pxi":70
 *                     needs_conversion = 1
 * 
 *         if needs_conversion:             # <<<<<<<<<<<<<<
 *             text = (<const_char*>c_text)[:tree.xmlBufferLength(c_buffer)].decode('utf8')
 *             if encoding is not unicode:
*/
      goto __pyx_L22;
    }

    /* "src/lxml/serializer.pxi":77
 *                     text, encoding, 'strict')
 *         else:
 *             text = (<unsigned char*>c_text)[:tree.xmlBufferLength(c_buffer)]             # <<<<<<<<<<<<<<
 *     finally:
 *         tree.xmlBufferFree(c_buffer)
*/
    /*else*/ {
      __pyx_t_3 = __Pyx_PyBytes_FromStringAndSize(((char const *)((unsigned char *)__pyx_v_c_text)) + 0, xmlBufferLength(__pyx_v_c_buffer) - 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 77, __pyx_L14_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_v_text = __pyx_t_3;
      __pyx_t_3 = 0;
    }
    __pyx_L22:;
  }

  /* "src/lxml/serializer.pxi":79
 *             text = (<unsigned char*>c_text)[:tree.xmlBufferLength(c_buffer)]
 *     finally:
 *         tree.xmlBufferFree(c_buffer)             # <<<<<<<<<<<<<<
 *     return text
 * 
*/
  /*finally:*/ {
    /*normal exit:*/{
      xmlBufferFree(__pyx_v_c_buffer);
      goto __pyx_L15;
    }
    __pyx_L14_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
      if ( unlikely(__Pyx_GetException(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12) < 0)) __Pyx_ErrFetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_14);
      __Pyx_XGOTREF(__pyx_t_15);
      __pyx_t_7 = __pyx_lineno; __pyx_t_8 = __pyx_clineno; __pyx_t_9 = __pyx_filename;
      {
        xmlBufferFree(__pyx_v_c_buffer);
      }
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_XGIVEREF(__pyx_t_14);
      __Pyx_XGIVEREF(__pyx_t_15);
      __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ErrRestore(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      __pyx_lineno = __pyx_t_7; __pyx_clineno = __pyx_t_8; __pyx_filename = __pyx_t_9;
      goto __pyx_L1_error;
    }
    __pyx_L15:;
  }

  /* "src/lxml/serializer.pxi":80
 *     finally:
 *         tree.xmlBufferFree(c_buffer)
 *     return text             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_text);
  __pyx_r = __pyx_v_text;
  goto __pyx_L0;

  /* "src/lxml/serializer.pxi":31
 * 
 * 
 * cdef _textToString(xmlNode* c_node, encoding, bint with_tail):             # <<<<<<<<<<<<<<
 *     cdef bint needs_conversion
 *     cdef const_xmlChar* c_text
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._textToString", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_text);
  __Pyx_XDECREF(__pyx_v_encoding);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":83
 * 
 * 
 * cdef _tostring(_Element element, encoding, doctype, method,             # <<<<<<<<<<<<<<
 *                bint write_xml_declaration, bint write_complete_document,
 *                bint pretty_print, bint with_tail, int standalone):
*/

static PyObject *__pyx_f_4lxml_5etree__tostring(struct LxmlElement *__pyx_v_element, PyObject *__pyx_v_encoding, PyObject *__pyx_v_doctype, PyObject *__pyx_v_method, int __pyx_v_write_xml_declaration, int __pyx_v_write_complete_document, int __pyx_v_pretty_print, int __pyx_v_with_tail, int __pyx_v_standalone) {
  xmlOutputBuffer *__pyx_v_c_buffer;
  xmlBuf *__pyx_v_c_result_buffer;
  xmlCharEncodingHandler *__pyx_v_enchandler;
  const char *__pyx_v_c_enc;
  const xmlChar *__pyx_v_c_doctype;
  int __pyx_v_c_method;
  int __pyx_v_error_result;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  PyObject *__pyx_t_7[3];
  xmlBuf *__pyx_t_8;
  int __pyx_t_9;
  char const *__pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_tostring", 0);
  __Pyx_INCREF(__pyx_v_encoding);
  __Pyx_INCREF(__pyx_v_doctype);

  /* "src/lxml/serializer.pxi":97
 *     cdef int c_method
 *     cdef int error_result
 *     if element is None:             # <<<<<<<<<<<<<<
 *         return None
 *     _assertValidNode(element)
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_element) == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":98
 *     cdef int error_result
 *     if element is None:
 *         return None             # <<<<<<<<<<<<<<
 *     _assertValidNode(element)
 *     c_method = _findOutputMethod(method)
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/serializer.pxi":97
 *     cdef int c_method
 *     cdef int error_result
 *     if element is None:             # <<<<<<<<<<<<<<
 *         return None
 *     _assertValidNode(element)
*/
  }

  /* "src/lxml/serializer.pxi":99
 *     if element is None:
 *         return None
 *     _assertValidNode(element)             # <<<<<<<<<<<<<<
 *     c_method = _findOutputMethod(method)
 *     if c_method == OUTPUT_METHOD_TEXT:
*/
  __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_element); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(6, 99, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":100
 *         return None
 *     _assertValidNode(element)
 *     c_method = _findOutputMethod(method)             # <<<<<<<<<<<<<<
 *     if c_method == OUTPUT_METHOD_TEXT:
 *         return _textToString(element._c_node, encoding, with_tail)
*/
  __pyx_t_2 = __pyx_f_4lxml_5etree__findOutputMethod(__pyx_v_method); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(6, 100, __pyx_L1_error)
  __pyx_v_c_method = __pyx_t_2;

  /* "src/lxml/serializer.pxi":101
 *     _assertValidNode(element)
 *     c_method = _findOutputMethod(method)
 *     if c_method == OUTPUT_METHOD_TEXT:             # <<<<<<<<<<<<<<
 *         return _textToString(element._c_node, encoding, with_tail)
 *     if encoding is None or encoding is unicode:
*/
  __pyx_t_1 = (__pyx_v_c_method == __pyx_e_4lxml_5etree_OUTPUT_METHOD_TEXT);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":102
 *     c_method = _findOutputMethod(method)
 *     if c_method == OUTPUT_METHOD_TEXT:
 *         return _textToString(element._c_node, encoding, with_tail)             # <<<<<<<<<<<<<<
 *     if encoding is None or encoding is unicode:
 *         c_enc = NULL
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __pyx_f_4lxml_5etree__textToString(__pyx_v_element->_c_node, __pyx_v_encoding, __pyx_v_with_tail); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 102, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "src/lxml/serializer.pxi":101
 *     _assertValidNode(element)
 *     c_method = _findOutputMethod(method)
 *     if c_method == OUTPUT_METHOD_TEXT:             # <<<<<<<<<<<<<<
 *         return _textToString(element._c_node, encoding, with_tail)
 *     if encoding is None or encoding is unicode:
*/
  }

  /* "src/lxml/serializer.pxi":103
 *     if c_method == OUTPUT_METHOD_TEXT:
 *         return _textToString(element._c_node, encoding, with_tail)
 *     if encoding is None or encoding is unicode:             # <<<<<<<<<<<<<<
 *         c_enc = NULL
 *     else:
*/
  __pyx_t_4 = (__pyx_v_encoding == Py_None);
  if (!__pyx_t_4) {
  } else {
    __pyx_t_1 = __pyx_t_4;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_4 = (__pyx_v_encoding == ((PyObject *)(&PyUnicode_Type)));
  __pyx_t_1 = __pyx_t_4;
  __pyx_L6_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":104
 *         return _textToString(element._c_node, encoding, with_tail)
 *     if encoding is None or encoding is unicode:
 *         c_enc = NULL             # <<<<<<<<<<<<<<
 *     else:
 *         encoding = _utf8(encoding)
*/
    __pyx_v_c_enc = NULL;

    /* "src/lxml/serializer.pxi":103
 *     if c_method == OUTPUT_METHOD_TEXT:
 *         return _textToString(element._c_node, encoding, with_tail)
 *     if encoding is None or encoding is unicode:             # <<<<<<<<<<<<<<
 *         c_enc = NULL
 *     else:
*/
    goto __pyx_L5;
  }

  /* "src/lxml/serializer.pxi":106
 *         c_enc = NULL
 *     else:
 *         encoding = _utf8(encoding)             # <<<<<<<<<<<<<<
 *         c_enc = _cstr(encoding)
 *     if doctype is None:
*/
  /*else*/ {
    __pyx_t_3 = __pyx_f_4lxml_5etree__utf8(__pyx_v_encoding); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 106, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_encoding, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":107
 *     else:
 *         encoding = _utf8(encoding)
 *         c_enc = _cstr(encoding)             # <<<<<<<<<<<<<<
 *     if doctype is None:
 *         c_doctype = NULL
*/
    __pyx_v_c_enc = PyBytes_AS_STRING(__pyx_v_encoding);
  }
  __pyx_L5:;

  /* "src/lxml/serializer.pxi":108
 *         encoding = _utf8(encoding)
 *         c_enc = _cstr(encoding)
 *     if doctype is None:             # <<<<<<<<<<<<<<
 *         c_doctype = NULL
 *     else:
*/
  __pyx_t_1 = (__pyx_v_doctype == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":109
 *         c_enc = _cstr(encoding)
 *     if doctype is None:
 *         c_doctype = NULL             # <<<<<<<<<<<<<<
 *     else:
 *         doctype = _utf8(doctype)
*/
    __pyx_v_c_doctype = NULL;

    /* "src/lxml/serializer.pxi":108
 *         encoding = _utf8(encoding)
 *         c_enc = _cstr(encoding)
 *     if doctype is None:             # <<<<<<<<<<<<<<
 *         c_doctype = NULL
 *     else:
*/
    goto __pyx_L8;
  }

  /* "src/lxml/serializer.pxi":111
 *         c_doctype = NULL
 *     else:
 *         doctype = _utf8(doctype)             # <<<<<<<<<<<<<<
 *         c_doctype = _xcstr(doctype)
 *     # it is necessary to *and* find the encoding handler *and* use
*/
  /*else*/ {
    __pyx_t_3 = __pyx_f_4lxml_5etree__utf8(__pyx_v_doctype); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 111, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_doctype, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":112
 *     else:
 *         doctype = _utf8(doctype)
 *         c_doctype = _xcstr(doctype)             # <<<<<<<<<<<<<<
 *     # it is necessary to *and* find the encoding handler *and* use
 *     # encoding during output
*/
    __pyx_v_c_doctype = (const xmlChar*)PyBytes_AS_STRING(__pyx_v_doctype);
  }
  __pyx_L8:;

  /* "src/lxml/serializer.pxi":115
 *     # it is necessary to *and* find the encoding handler *and* use
 *     # encoding during output
 *     enchandler = tree.xmlFindCharEncodingHandler(c_enc)             # <<<<<<<<<<<<<<
 *     if enchandler is NULL and c_enc is not NULL:
 *         if encoding is not None:
*/
  __pyx_v_enchandler = xmlFindCharEncodingHandler(__pyx_v_c_enc);

  /* "src/lxml/serializer.pxi":116
 *     # encoding during output
 *     enchandler = tree.xmlFindCharEncodingHandler(c_enc)
 *     if enchandler is NULL and c_enc is not NULL:             # <<<<<<<<<<<<<<
 *         if encoding is not None:
 *             encoding = encoding.decode('UTF-8')
*/
  __pyx_t_4 = (__pyx_v_enchandler == NULL);
  if (__pyx_t_4) {
  } else {
    __pyx_t_1 = __pyx_t_4;
    goto __pyx_L10_bool_binop_done;
  }
  __pyx_t_4 = (__pyx_v_c_enc != NULL);
  __pyx_t_1 = __pyx_t_4;
  __pyx_L10_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":117
 *     enchandler = tree.xmlFindCharEncodingHandler(c_enc)
 *     if enchandler is NULL and c_enc is not NULL:
 *         if encoding is not None:             # <<<<<<<<<<<<<<
 *             encoding = encoding.decode('UTF-8')
 *         raise LookupError, f"unknown encoding: '{encoding}'"
*/
    __pyx_t_1 = (__pyx_v_encoding != Py_None);
    if (__pyx_t_1) {

      /* "src/lxml/serializer.pxi":118
 *     if enchandler is NULL and c_enc is not NULL:
 *         if encoding is not None:
 *             encoding = encoding.decode('UTF-8')             # <<<<<<<<<<<<<<
 *         raise LookupError, f"unknown encoding: '{encoding}'"
 *     c_buffer = tree.xmlAllocOutputBuffer(enchandler)
*/
      __pyx_t_5 = __pyx_v_encoding;
      __Pyx_INCREF(__pyx_t_5);
      __pyx_t_6 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_UTF_8};
        __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_decode, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 118, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
      }
      __Pyx_DECREF_SET(__pyx_v_encoding, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "src/lxml/serializer.pxi":117
 *     enchandler = tree.xmlFindCharEncodingHandler(c_enc)
 *     if enchandler is NULL and c_enc is not NULL:
 *         if encoding is not None:             # <<<<<<<<<<<<<<
 *             encoding = encoding.decode('UTF-8')
 *         raise LookupError, f"unknown encoding: '{encoding}'"
*/
    }

    /* "src/lxml/serializer.pxi":119
 *         if encoding is not None:
 *             encoding = encoding.decode('UTF-8')
 *         raise LookupError, f"unknown encoding: '{encoding}'"             # <<<<<<<<<<<<<<
 *     c_buffer = tree.xmlAllocOutputBuffer(enchandler)
 *     if c_buffer is NULL:
*/
    __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_v_encoding, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 119, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7[0] = __pyx_mstate_global->__pyx_kp_u_unknown_encoding;
    __pyx_t_7[1] = __pyx_t_3;
    __pyx_t_7[2] = __pyx_mstate_global->__pyx_kp_u__4;
    __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_7, 3, 19 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3));
    if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 119, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_LookupError))), __pyx_t_5, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __PYX_ERR(6, 119, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":116
 *     # encoding during output
 *     enchandler = tree.xmlFindCharEncodingHandler(c_enc)
 *     if enchandler is NULL and c_enc is not NULL:             # <<<<<<<<<<<<<<
 *         if encoding is not None:
 *             encoding = encoding.decode('UTF-8')
*/
  }

  /* "src/lxml/serializer.pxi":120
 *             encoding = encoding.decode('UTF-8')
 *         raise LookupError, f"unknown encoding: '{encoding}'"
 *     c_buffer = tree.xmlAllocOutputBuffer(enchandler)             # <<<<<<<<<<<<<<
 *     if c_buffer is NULL:
 *         tree.xmlCharEncCloseFunc(enchandler)
*/
  __pyx_v_c_buffer = xmlAllocOutputBuffer(__pyx_v_enchandler);

  /* "src/lxml/serializer.pxi":121
 *         raise LookupError, f"unknown encoding: '{encoding}'"
 *     c_buffer = tree.xmlAllocOutputBuffer(enchandler)
 *     if c_buffer is NULL:             # <<<<<<<<<<<<<<
 *         tree.xmlCharEncCloseFunc(enchandler)
 *         raise MemoryError()
*/
  __pyx_t_1 = (__pyx_v_c_buffer == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/serializer.pxi":122
 *     c_buffer = tree.xmlAllocOutputBuffer(enchandler)
 *     if c_buffer is NULL:
 *         tree.xmlCharEncCloseFunc(enchandler)             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 * 
*/
    (void)(xmlCharEncCloseFunc(__pyx_v_enchandler));

    /* "src/lxml/serializer.pxi":123
 *     if c_buffer is NULL:
 *         tree.xmlCharEncCloseFunc(enchandler)
 *         raise MemoryError()             # <<<<<<<<<<<<<<
 * 
 *     with nogil:
*/
    PyErr_NoMemory(); __PYX_ERR(6, 123, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":121
 *         raise LookupError, f"unknown encoding: '{encoding}'"
 *     c_buffer = tree.xmlAllocOutputBuffer(enchandler)
 *     if c_buffer is NULL:             # <<<<<<<<<<<<<<
 *         tree.xmlCharEncCloseFunc(enchandler)
 *         raise MemoryError()
*/
  }

  /* "src/lxml/serializer.pxi":125
 *         raise MemoryError()
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         _writeNodeToBuffer(c_buffer, element._c_node, c_enc, c_doctype, c_method,
 *                            write_xml_declaration, write_complete_document,
*/
  {
      PyThreadState * _save;
      _save = PyEval_SaveThread();
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "src/lxml/serializer.pxi":126
 * 
 *     with nogil:
 *         _writeNodeToBuffer(c_buffer, element._c_node, c_enc, c_doctype, c_method,             # <<<<<<<<<<<<<<
 *                            write_xml_declaration, write_complete_document,
 *                            pretty_print, with_tail, standalone)
*/
        __pyx_f_4lxml_5etree__writeNodeToBuffer(__pyx_v_c_buffer, __pyx_v_element->_c_node, __pyx_v_c_enc, __pyx_v_c_doctype, __pyx_v_c_method, __pyx_v_write_xml_declaration, __pyx_v_write_complete_document, __pyx_v_pretty_print, __pyx_v_with_tail, __pyx_v_standalone);

        /* "src/lxml/serializer.pxi":129
 *                            write_xml_declaration, write_complete_document,
 *                            pretty_print, with_tail, standalone)
 *         tree.xmlOutputBufferFlush(c_buffer)             # <<<<<<<<<<<<<<
 *         if c_buffer.conv is not NULL:
 *             c_result_buffer = c_buffer.conv
*/
        (void)(xmlOutputBufferFlush(__pyx_v_c_buffer));

        /* "src/lxml/serializer.pxi":130
 *                            pretty_print, with_tail, standalone)
 *         tree.xmlOutputBufferFlush(c_buffer)
 *         if c_buffer.conv is not NULL:             # <<<<<<<<<<<<<<
 *             c_result_buffer = c_buffer.conv
 *         else:
*/
        __pyx_t_1 = (__pyx_v_c_buffer->conv != NULL);
        if (__pyx_t_1) {

          /* "src/lxml/serializer.pxi":131
 *         tree.xmlOutputBufferFlush(c_buffer)
 *         if c_buffer.conv is not NULL:
 *             c_result_buffer = c_buffer.conv             # <<<<<<<<<<<<<<
 *         else:
 *             c_result_buffer = c_buffer.buffer
*/
          __pyx_t_8 = __pyx_v_c_buffer->conv;
          __pyx_v_c_result_buffer = __pyx_t_8;

          /* "src/lxml/serializer.pxi":130
 *                            pretty_print, with_tail, standalone)
 *         tree.xmlOutputBufferFlush(c_buffer)
 *         if c_buffer.conv is not NULL:             # <<<<<<<<<<<<<<
 *             c_result_buffer = c_buffer.conv
 *         else:
*/
          goto __pyx_L17;
        }

        /* "src/lxml/serializer.pxi":133
 *             c_result_buffer = c_buffer.conv
 *         else:
 *             c_result_buffer = c_buffer.buffer             # <<<<<<<<<<<<<<
 * 
 *     error_result = c_buffer.error
*/
        /*else*/ {
          __pyx_t_8 = __pyx_v_c_buffer->buffer;
          __pyx_v_c_result_buffer = __pyx_t_8;
        }
        __pyx_L17:;
      }

      /* "src/lxml/serializer.pxi":125
 *         raise MemoryError()
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         _writeNodeToBuffer(c_buffer, element._c_node, c_enc, c_doctype, c_method,
 *                            write_xml_declaration, write_complete_document,
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L16;
        }
        __pyx_L16:;
      }
  }

  /* "src/lxml/serializer.pxi":135
 *             c_result_buffer = c_buffer.buffer
 * 
 *     error_result = c_buffer.error             # <<<<<<<<<<<<<<
 *     if error_result != xmlerror.XML_ERR_OK:
 *         tree.xmlOutputBufferClose(c_buffer)
*/
  __pyx_t_2 = __pyx_v_c_buffer->error;
  __pyx_v_error_result = __pyx_t_2;

  /* "src/lxml/serializer.pxi":136
 * 
 *     error_result = c_buffer.error
 *     if error_result != xmlerror.XML_ERR_OK:             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferClose(c_buffer)
 *         _raiseSerialisationError(error_result)
*/
  __pyx_t_1 = (__pyx_v_error_result != XML_ERR_OK);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":137
 *     error_result = c_buffer.error
 *     if error_result != xmlerror.XML_ERR_OK:
 *         tree.xmlOutputBufferClose(c_buffer)             # <<<<<<<<<<<<<<
 *         _raiseSerialisationError(error_result)
 * 
*/
    (void)(xmlOutputBufferClose(__pyx_v_c_buffer));

    /* "src/lxml/serializer.pxi":138
 *     if error_result != xmlerror.XML_ERR_OK:
 *         tree.xmlOutputBufferClose(c_buffer)
 *         _raiseSerialisationError(error_result)             # <<<<<<<<<<<<<<
 * 
 *     try:
*/
    __pyx_t_5 = __pyx_f_4lxml_5etree__raiseSerialisationError(__pyx_v_error_result); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 138, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "src/lxml/serializer.pxi":136
 * 
 *     error_result = c_buffer.error
 *     if error_result != xmlerror.XML_ERR_OK:             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferClose(c_buffer)
 *         _raiseSerialisationError(error_result)
*/
  }

  /* "src/lxml/serializer.pxi":140
 *         _raiseSerialisationError(error_result)
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         if encoding is unicode:
 *             result = (<unsigned char*>tree.xmlBufContent(
*/
  /*try:*/ {

    /* "src/lxml/serializer.pxi":141
 * 
 *     try:
 *         if encoding is unicode:             # <<<<<<<<<<<<<<
 *             result = (<unsigned char*>tree.xmlBufContent(
 *                 c_result_buffer))[:tree.xmlBufUse(c_result_buffer)].decode('UTF-8')
*/
    __pyx_t_1 = (__pyx_v_encoding == ((PyObject *)(&PyUnicode_Type)));
    if (__pyx_t_1) {

      /* "src/lxml/serializer.pxi":143
 *         if encoding is unicode:
 *             result = (<unsigned char*>tree.xmlBufContent(
 *                 c_result_buffer))[:tree.xmlBufUse(c_result_buffer)].decode('UTF-8')             # <<<<<<<<<<<<<<
 *         else:
 *             result = <bytes>(<unsigned char*>tree.xmlBufContent(
*/
      __pyx_t_5 = __Pyx_decode_c_string(((char const *)((unsigned char *)xmlBufContent(__pyx_v_c_result_buffer))), 0, xmlBufUse(__pyx_v_c_result_buffer), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 143, __pyx_L20_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_v_result = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "src/lxml/serializer.pxi":141
 * 
 *     try:
 *         if encoding is unicode:             # <<<<<<<<<<<<<<
 *             result = (<unsigned char*>tree.xmlBufContent(
 *                 c_result_buffer))[:tree.xmlBufUse(c_result_buffer)].decode('UTF-8')
*/
      goto __pyx_L22;
    }

    /* "src/lxml/serializer.pxi":145
 *                 c_result_buffer))[:tree.xmlBufUse(c_result_buffer)].decode('UTF-8')
 *         else:
 *             result = <bytes>(<unsigned char*>tree.xmlBufContent(             # <<<<<<<<<<<<<<
 *                 c_result_buffer))[:tree.xmlBufUse(c_result_buffer)]
 *     finally:
*/
    /*else*/ {

      /* "src/lxml/serializer.pxi":146
 *         else:
 *             result = <bytes>(<unsigned char*>tree.xmlBufContent(
 *                 c_result_buffer))[:tree.xmlBufUse(c_result_buffer)]             # <<<<<<<<<<<<<<
 *     finally:
 *         error_result = tree.xmlOutputBufferClose(c_buffer)
*/
      __pyx_t_5 = __Pyx_PyBytes_FromStringAndSize(((char const *)((unsigned char *)xmlBufContent(__pyx_v_c_result_buffer))) + 0, xmlBufUse(__pyx_v_c_result_buffer) - 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 146, __pyx_L20_error)
      __Pyx_GOTREF(__pyx_t_5);

      /* "src/lxml/serializer.pxi":145
 *                 c_result_buffer))[:tree.xmlBufUse(c_result_buffer)].decode('UTF-8')
 *         else:
 *             result = <bytes>(<unsigned char*>tree.xmlBufContent(             # <<<<<<<<<<<<<<
 *                 c_result_buffer))[:tree.xmlBufUse(c_result_buffer)]
 *     finally:
*/
      __pyx_t_3 = __pyx_t_5;
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_v_result = __pyx_t_3;
      __pyx_t_3 = 0;
    }
    __pyx_L22:;
  }

  /* "src/lxml/serializer.pxi":148
 *                 c_result_buffer))[:tree.xmlBufUse(c_result_buffer)]
 *     finally:
 *         error_result = tree.xmlOutputBufferClose(c_buffer)             # <<<<<<<<<<<<<<
 *     if error_result == -1:
 *         _raiseSerialisationError(error_result)
*/
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_v_error_result = xmlOutputBufferClose(__pyx_v_c_buffer);
      goto __pyx_L21;
    }
    __pyx_L20_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16);
      if ( unlikely(__Pyx_GetException(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13) < 0)) __Pyx_ErrFetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_14);
      __Pyx_XGOTREF(__pyx_t_15);
      __Pyx_XGOTREF(__pyx_t_16);
      __pyx_t_2 = __pyx_lineno; __pyx_t_9 = __pyx_clineno; __pyx_t_10 = __pyx_filename;
      {
        __pyx_v_error_result = xmlOutputBufferClose(__pyx_v_c_buffer);
      }
      __Pyx_XGIVEREF(__pyx_t_14);
      __Pyx_XGIVEREF(__pyx_t_15);
      __Pyx_XGIVEREF(__pyx_t_16);
      __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_ErrRestore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
      __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
      __pyx_lineno = __pyx_t_2; __pyx_clineno = __pyx_t_9; __pyx_filename = __pyx_t_10;
      goto __pyx_L1_error;
    }
    __pyx_L21:;
  }

  /* "src/lxml/serializer.pxi":149
 *     finally:
 *         error_result = tree.xmlOutputBufferClose(c_buffer)
 *     if error_result == -1:             # <<<<<<<<<<<<<<
 *         _raiseSerialisationError(error_result)
 *     return result
*/
  __pyx_t_1 = (__pyx_v_error_result == -1L);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":150
 *         error_result = tree.xmlOutputBufferClose(c_buffer)
 *     if error_result == -1:
 *         _raiseSerialisationError(error_result)             # <<<<<<<<<<<<<<
 *     return result
 * 
*/
    __pyx_t_3 = __pyx_f_4lxml_5etree__raiseSerialisationError(__pyx_v_error_result); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 150, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":149
 *     finally:
 *         error_result = tree.xmlOutputBufferClose(c_buffer)
 *     if error_result == -1:             # <<<<<<<<<<<<<<
 *         _raiseSerialisationError(error_result)
 *     return result
*/
  }

  /* "src/lxml/serializer.pxi":151
 *     if error_result == -1:
 *         _raiseSerialisationError(error_result)
 *     return result             # <<<<<<<<<<<<<<
 * 
 * cdef bytes _tostringC14N(element_or_tree, bint exclusive, bint with_comments, inclusive_ns_prefixes):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "src/lxml/serializer.pxi":83
 * 
 * 
 * cdef _tostring(_Element element, encoding, doctype, method,             # <<<<<<<<<<<<<<
 *                bint write_xml_declaration, bint write_complete_document,
 *                bint pretty_print, bint with_tail, int standalone):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._tostring", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_encoding);
  __Pyx_XDECREF(__pyx_v_doctype);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":153
 *     return result
 * 
 * cdef bytes _tostringC14N(element_or_tree, bint exclusive, bint with_comments, inclusive_ns_prefixes):             # <<<<<<<<<<<<<<
 *     cdef xmlDoc* c_doc
 *     cdef xmlChar* c_buffer = NULL
*/

static PyObject *__pyx_f_4lxml_5etree__tostringC14N(PyObject *__pyx_v_element_or_tree, int __pyx_v_exclusive, int __pyx_v_with_comments, PyObject *__pyx_v_inclusive_ns_prefixes) {
  xmlDoc *__pyx_v_c_doc;
  xmlChar *__pyx_v_c_buffer;
  int __pyx_v_byte_count;
  PyObject *__pyx_v_result = 0;
  struct LxmlDocument *__pyx_v_doc = 0;
  xmlChar **__pyx_v_c_inclusive_ns_prefixes;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  xmlDoc *__pyx_t_4;
  xmlChar **__pyx_t_5;
  xmlChar **__pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  char const *__pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_tostringC14N", 0);

  /* "src/lxml/serializer.pxi":155
 * cdef bytes _tostringC14N(element_or_tree, bint exclusive, bint with_comments, inclusive_ns_prefixes):
 *     cdef xmlDoc* c_doc
 *     cdef xmlChar* c_buffer = NULL             # <<<<<<<<<<<<<<
 *     cdef int byte_count = -1
 *     cdef bytes result
*/
  __pyx_v_c_buffer = NULL;

  /* "src/lxml/serializer.pxi":156
 *     cdef xmlDoc* c_doc
 *     cdef xmlChar* c_buffer = NULL
 *     cdef int byte_count = -1             # <<<<<<<<<<<<<<
 *     cdef bytes result
 *     cdef _Document doc
*/
  __pyx_v_byte_count = -1;

  /* "src/lxml/serializer.pxi":162
 *     cdef xmlChar **c_inclusive_ns_prefixes
 * 
 *     if isinstance(element_or_tree, _Element):             # <<<<<<<<<<<<<<
 *         _assertValidNode(<_Element>element_or_tree)
 *         doc = (<_Element>element_or_tree)._doc
*/
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_element_or_tree, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element); 
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":163
 * 
 *     if isinstance(element_or_tree, _Element):
 *         _assertValidNode(<_Element>element_or_tree)             # <<<<<<<<<<<<<<
 *         doc = (<_Element>element_or_tree)._doc
 *         c_doc = _plainFakeRootDoc(doc._c_doc, (<_Element>element_or_tree)._c_node, 0)
*/
    __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_element_or_tree)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(6, 163, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":164
 *     if isinstance(element_or_tree, _Element):
 *         _assertValidNode(<_Element>element_or_tree)
 *         doc = (<_Element>element_or_tree)._doc             # <<<<<<<<<<<<<<
 *         c_doc = _plainFakeRootDoc(doc._c_doc, (<_Element>element_or_tree)._c_node, 0)
 *     else:
*/
    __pyx_t_3 = ((PyObject *)((struct LxmlElement *)__pyx_v_element_or_tree)->_doc);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":165
 *         _assertValidNode(<_Element>element_or_tree)
 *         doc = (<_Element>element_or_tree)._doc
 *         c_doc = _plainFakeRootDoc(doc._c_doc, (<_Element>element_or_tree)._c_node, 0)             # <<<<<<<<<<<<<<
 *     else:
 *         doc = _documentOrRaise(element_or_tree)
*/
    __pyx_t_4 = __pyx_f_4lxml_5etree__plainFakeRootDoc(__pyx_v_doc->_c_doc, ((struct LxmlElement *)__pyx_v_element_or_tree)->_c_node, 0); if (unlikely(__pyx_t_4 == ((void *)NULL))) __PYX_ERR(6, 165, __pyx_L1_error)
    __pyx_v_c_doc = __pyx_t_4;

    /* "src/lxml/serializer.pxi":162
 *     cdef xmlChar **c_inclusive_ns_prefixes
 * 
 *     if isinstance(element_or_tree, _Element):             # <<<<<<<<<<<<<<
 *         _assertValidNode(<_Element>element_or_tree)
 *         doc = (<_Element>element_or_tree)._doc
*/
    goto __pyx_L3;
  }

  /* "src/lxml/serializer.pxi":167
 *         c_doc = _plainFakeRootDoc(doc._c_doc, (<_Element>element_or_tree)._c_node, 0)
 *     else:
 *         doc = _documentOrRaise(element_or_tree)             # <<<<<<<<<<<<<<
 *         _assertValidDoc(doc)
 *         c_doc = doc._c_doc
*/
  /*else*/ {
    __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__documentOrRaise(__pyx_v_element_or_tree)); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 167, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":168
 *     else:
 *         doc = _documentOrRaise(element_or_tree)
 *         _assertValidDoc(doc)             # <<<<<<<<<<<<<<
 *         c_doc = doc._c_doc
 * 
*/
    __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidDoc(__pyx_v_doc); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(6, 168, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":169
 *         doc = _documentOrRaise(element_or_tree)
 *         _assertValidDoc(doc)
 *         c_doc = doc._c_doc             # <<<<<<<<<<<<<<
 * 
 *     c_inclusive_ns_prefixes = _convert_ns_prefixes(c_doc.dict, inclusive_ns_prefixes) if inclusive_ns_prefixes else NULL
*/
    __pyx_t_4 = __pyx_v_doc->_c_doc;
    __pyx_v_c_doc = __pyx_t_4;
  }
  __pyx_L3:;

  /* "src/lxml/serializer.pxi":171
 *         c_doc = doc._c_doc
 * 
 *     c_inclusive_ns_prefixes = _convert_ns_prefixes(c_doc.dict, inclusive_ns_prefixes) if inclusive_ns_prefixes else NULL             # <<<<<<<<<<<<<<
 *     try:
 *          with nogil:
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_inclusive_ns_prefixes); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(6, 171, __pyx_L1_error)
  if (__pyx_t_1) {
    __pyx_t_6 = __pyx_f_4lxml_5etree__convert_ns_prefixes(__pyx_v_c_doc->dict, __pyx_v_inclusive_ns_prefixes); if (unlikely(__pyx_t_6 == ((void *)NULL))) __PYX_ERR(6, 171, __pyx_L1_error)
    __pyx_t_5 = __pyx_t_6;
  } else {
    __pyx_t_5 = NULL;
  }
  __pyx_v_c_inclusive_ns_prefixes = __pyx_t_5;

  /* "src/lxml/serializer.pxi":172
 * 
 *     c_inclusive_ns_prefixes = _convert_ns_prefixes(c_doc.dict, inclusive_ns_prefixes) if inclusive_ns_prefixes else NULL
 *     try:             # <<<<<<<<<<<<<<
 *          with nogil:
 *              byte_count = c14n.xmlC14NDocDumpMemory(
*/
  /*try:*/ {

    /* "src/lxml/serializer.pxi":173
 *     c_inclusive_ns_prefixes = _convert_ns_prefixes(c_doc.dict, inclusive_ns_prefixes) if inclusive_ns_prefixes else NULL
 *     try:
 *          with nogil:             # <<<<<<<<<<<<<<
 *              byte_count = c14n.xmlC14NDocDumpMemory(
 *                  c_doc, NULL, exclusive, c_inclusive_ns_prefixes, with_comments, &c_buffer)
*/
    {
        PyThreadState * _save;
        _save = PyEval_SaveThread();
        __Pyx_FastGIL_Remember();
        /*try:*/ {

          /* "src/lxml/serializer.pxi":174
 *     try:
 *          with nogil:
 *              byte_count = c14n.xmlC14NDocDumpMemory(             # <<<<<<<<<<<<<<
 *                  c_doc, NULL, exclusive, c_inclusive_ns_prefixes, with_comments, &c_buffer)
 * 
*/
          __pyx_v_byte_count = xmlC14NDocDumpMemory(__pyx_v_c_doc, NULL, __pyx_v_exclusive, __pyx_v_c_inclusive_ns_prefixes, __pyx_v_with_comments, (&__pyx_v_c_buffer));
        }

        /* "src/lxml/serializer.pxi":173
 *     c_inclusive_ns_prefixes = _convert_ns_prefixes(c_doc.dict, inclusive_ns_prefixes) if inclusive_ns_prefixes else NULL
 *     try:
 *          with nogil:             # <<<<<<<<<<<<<<
 *              byte_count = c14n.xmlC14NDocDumpMemory(
 *                  c_doc, NULL, exclusive, c_inclusive_ns_prefixes, with_comments, &c_buffer)
*/
        /*finally:*/ {
          /*normal exit:*/{
            __Pyx_FastGIL_Forget();
            PyEval_RestoreThread(_save);
            goto __pyx_L9;
          }
          __pyx_L9:;
        }
    }
  }

  /* "src/lxml/serializer.pxi":178
 * 
 *     finally:
 *          _destroyFakeDoc(doc._c_doc, c_doc)             # <<<<<<<<<<<<<<
 *          if c_inclusive_ns_prefixes is not NULL:
 *             python.lxml_free(c_inclusive_ns_prefixes)
*/
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_f_4lxml_5etree__destroyFakeDoc(__pyx_v_doc->_c_doc, __pyx_v_c_doc);

      /* "src/lxml/serializer.pxi":179
 *     finally:
 *          _destroyFakeDoc(doc._c_doc, c_doc)
 *          if c_inclusive_ns_prefixes is not NULL:             # <<<<<<<<<<<<<<
 *             python.lxml_free(c_inclusive_ns_prefixes)
 * 
*/
      __pyx_t_1 = (__pyx_v_c_inclusive_ns_prefixes != NULL);
      if (__pyx_t_1) {

        /* "src/lxml/serializer.pxi":180
 *          _destroyFakeDoc(doc._c_doc, c_doc)
 *          if c_inclusive_ns_prefixes is not NULL:
 *             python.lxml_free(c_inclusive_ns_prefixes)             # <<<<<<<<<<<<<<
 * 
 *     if byte_count < 0 or c_buffer is NULL:
*/
        lxml_free(__pyx_v_c_inclusive_ns_prefixes);

        /* "src/lxml/serializer.pxi":179
 *     finally:
 *          _destroyFakeDoc(doc._c_doc, c_doc)
 *          if c_inclusive_ns_prefixes is not NULL:             # <<<<<<<<<<<<<<
 *             python.lxml_free(c_inclusive_ns_prefixes)
 * 
*/
      }
      goto __pyx_L6;
    }
    __pyx_L6:;
  }

  /* "src/lxml/serializer.pxi":182
 *             python.lxml_free(c_inclusive_ns_prefixes)
 * 
 *     if byte_count < 0 or c_buffer is NULL:             # <<<<<<<<<<<<<<
 *         if c_buffer is not NULL:
 *             tree.xmlFree(c_buffer)
*/
  __pyx_t_7 = (__pyx_v_byte_count < 0);
  if (!__pyx_t_7) {
  } else {
    __pyx_t_1 = __pyx_t_7;
    goto __pyx_L12_bool_binop_done;
  }
  __pyx_t_7 = (__pyx_v_c_buffer == NULL);
  __pyx_t_1 = __pyx_t_7;
  __pyx_L12_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":183
 * 
 *     if byte_count < 0 or c_buffer is NULL:
 *         if c_buffer is not NULL:             # <<<<<<<<<<<<<<
 *             tree.xmlFree(c_buffer)
 *         raise C14NError, "C14N failed"
*/
    __pyx_t_1 = (__pyx_v_c_buffer != NULL);
    if (__pyx_t_1) {

      /* "src/lxml/serializer.pxi":184
 *     if byte_count < 0 or c_buffer is NULL:
 *         if c_buffer is not NULL:
 *             tree.xmlFree(c_buffer)             # <<<<<<<<<<<<<<
 *         raise C14NError, "C14N failed"
 *     try:
*/
      xmlFree(__pyx_v_c_buffer);

      /* "src/lxml/serializer.pxi":183
 * 
 *     if byte_count < 0 or c_buffer is NULL:
 *         if c_buffer is not NULL:             # <<<<<<<<<<<<<<
 *             tree.xmlFree(c_buffer)
 *         raise C14NError, "C14N failed"
*/
    }

    /* "src/lxml/serializer.pxi":185
 *         if c_buffer is not NULL:
 *             tree.xmlFree(c_buffer)
 *         raise C14NError, "C14N failed"             # <<<<<<<<<<<<<<
 *     try:
 *         result = c_buffer[:byte_count]
*/
    __Pyx_Raise(((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_C14NError), __pyx_mstate_global->__pyx_kp_u_C14N_failed, 0, 0);
    __PYX_ERR(6, 185, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":182
 *             python.lxml_free(c_inclusive_ns_prefixes)
 * 
 *     if byte_count < 0 or c_buffer is NULL:             # <<<<<<<<<<<<<<
 *         if c_buffer is not NULL:
 *             tree.xmlFree(c_buffer)
*/
  }

  /* "src/lxml/serializer.pxi":186
 *             tree.xmlFree(c_buffer)
 *         raise C14NError, "C14N failed"
 *     try:             # <<<<<<<<<<<<<<
 *         result = c_buffer[:byte_count]
 *     finally:
*/
  /*try:*/ {

    /* "src/lxml/serializer.pxi":187
 *         raise C14NError, "C14N failed"
 *     try:
 *         result = c_buffer[:byte_count]             # <<<<<<<<<<<<<<
 *     finally:
 *         tree.xmlFree(c_buffer)
*/
    __pyx_t_3 = __Pyx_PyBytes_FromStringAndSize(((char const *)__pyx_v_c_buffer) + 0, __pyx_v_byte_count - 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 187, __pyx_L16_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_result = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;
  }

  /* "src/lxml/serializer.pxi":189
 *         result = c_buffer[:byte_count]
 *     finally:
 *         tree.xmlFree(c_buffer)             # <<<<<<<<<<<<<<
 *     return result
 * 
*/
  /*finally:*/ {
    /*normal exit:*/{
      xmlFree(__pyx_v_c_buffer);
      goto __pyx_L17;
    }
    __pyx_L16_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
      if ( unlikely(__Pyx_GetException(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12) < 0)) __Pyx_ErrFetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_14);
      __Pyx_XGOTREF(__pyx_t_15);
      __pyx_t_2 = __pyx_lineno; __pyx_t_8 = __pyx_clineno; __pyx_t_9 = __pyx_filename;
      {
        xmlFree(__pyx_v_c_buffer);
      }
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_XGIVEREF(__pyx_t_14);
      __Pyx_XGIVEREF(__pyx_t_15);
      __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ErrRestore(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      __pyx_lineno = __pyx_t_2; __pyx_clineno = __pyx_t_8; __pyx_filename = __pyx_t_9;
      goto __pyx_L1_error;
    }
    __pyx_L17:;
  }

  /* "src/lxml/serializer.pxi":190
 *     finally:
 *         tree.xmlFree(c_buffer)
 *     return result             # <<<<<<<<<<<<<<
 * 
 * cdef _raiseSerialisationError(int error_result):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "src/lxml/serializer.pxi":153
 *     return result
 * 
 * cdef bytes _tostringC14N(element_or_tree, bint exclusive, bint with_comments, inclusive_ns_prefixes):             # <<<<<<<<<<<<<<
 *     cdef xmlDoc* c_doc
 *     cdef xmlChar* c_buffer = NULL
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._tostringC14N", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":192
 *     return result
 * 
 * cdef _raiseSerialisationError(int error_result):             # <<<<<<<<<<<<<<
 *     if error_result == xmlerror.XML_ERR_NO_MEMORY:
 *         raise MemoryError()
*/

static PyObject *__pyx_f_4lxml_5etree__raiseSerialisationError(int __pyx_v_error_result) {
  PyObject *__pyx_v_message = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_raiseSerialisationError", 0);

  /* "src/lxml/serializer.pxi":193
 * 
 * cdef _raiseSerialisationError(int error_result):
 *     if error_result == xmlerror.XML_ERR_NO_MEMORY:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     message = ErrorTypes._getName(error_result)
*/
  __pyx_t_1 = (__pyx_v_error_result == XML_ERR_NO_MEMORY);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/serializer.pxi":194
 * cdef _raiseSerialisationError(int error_result):
 *     if error_result == xmlerror.XML_ERR_NO_MEMORY:
 *         raise MemoryError()             # <<<<<<<<<<<<<<
 *     message = ErrorTypes._getName(error_result)
 *     if message is None:
*/
    PyErr_NoMemory(); __PYX_ERR(6, 194, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":193
 * 
 * cdef _raiseSerialisationError(int error_result):
 *     if error_result == xmlerror.XML_ERR_NO_MEMORY:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     message = ErrorTypes._getName(error_result)
*/
  }

  /* "src/lxml/serializer.pxi":195
 *     if error_result == xmlerror.XML_ERR_NO_MEMORY:
 *         raise MemoryError()
 *     message = ErrorTypes._getName(error_result)             # <<<<<<<<<<<<<<
 *     if message is None:
 *         message = f"unknown error {error_result}"
*/
  __pyx_t_3 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_ErrorTypes); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_getName); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyLong_From_int(__pyx_v_error_result); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
    assert(__pyx_t_3);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
    __pyx_t_6 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_4};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 195, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_v_message = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "src/lxml/serializer.pxi":196
 *         raise MemoryError()
 *     message = ErrorTypes._getName(error_result)
 *     if message is None:             # <<<<<<<<<<<<<<
 *         message = f"unknown error {error_result}"
 *     raise SerialisationError, message
*/
  __pyx_t_1 = (__pyx_v_message == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":197
 *     message = ErrorTypes._getName(error_result)
 *     if message is None:
 *         message = f"unknown error {error_result}"             # <<<<<<<<<<<<<<
 *     raise SerialisationError, message
 * 
*/
    __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_error_result, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 197, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_unknown_error_2, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 197, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF_SET(__pyx_v_message, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "src/lxml/serializer.pxi":196
 *         raise MemoryError()
 *     message = ErrorTypes._getName(error_result)
 *     if message is None:             # <<<<<<<<<<<<<<
 *         message = f"unknown error {error_result}"
 *     raise SerialisationError, message
*/
  }

  /* "src/lxml/serializer.pxi":198
 *     if message is None:
 *         message = f"unknown error {error_result}"
 *     raise SerialisationError, message             # <<<<<<<<<<<<<<
 * 
 * ############################################################
*/
  __Pyx_Raise(((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_SerialisationError), __pyx_v_message, 0, 0);
  __PYX_ERR(6, 198, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":192
 *     return result
 * 
 * cdef _raiseSerialisationError(int error_result):             # <<<<<<<<<<<<<<
 *     if error_result == xmlerror.XML_ERR_NO_MEMORY:
 *         raise MemoryError()
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._raiseSerialisationError", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __Pyx_XDECREF(__pyx_v_message);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":203
 * # low-level serialisation functions
 * 
 * cdef void _writeDoctype(tree.xmlOutputBuffer* c_buffer,             # <<<<<<<<<<<<<<
 *                         const_xmlChar* c_doctype) noexcept nogil:
 *     tree.xmlOutputBufferWrite(c_buffer, tree.xmlStrlen(c_doctype),
*/

static void __pyx_f_4lxml_5etree__writeDoctype(xmlOutputBuffer *__pyx_v_c_buffer, const xmlChar *__pyx_v_c_doctype) {

  /* "src/lxml/serializer.pxi":205
 * cdef void _writeDoctype(tree.xmlOutputBuffer* c_buffer,
 *                         const_xmlChar* c_doctype) noexcept nogil:
 *     tree.xmlOutputBufferWrite(c_buffer, tree.xmlStrlen(c_doctype),             # <<<<<<<<<<<<<<
 *                               <const_char*>c_doctype)
 *     tree.xmlOutputBufferWriteString(c_buffer, "\n")
*/
  (void)(xmlOutputBufferWrite(__pyx_v_c_buffer, xmlStrlen(__pyx_v_c_doctype), ((const char *)__pyx_v_c_doctype)));

  /* "src/lxml/serializer.pxi":207
 *     tree.xmlOutputBufferWrite(c_buffer, tree.xmlStrlen(c_doctype),
 *                               <const_char*>c_doctype)
 *     tree.xmlOutputBufferWriteString(c_buffer, "\n")             # <<<<<<<<<<<<<<
 * 
 * cdef void _writeNodeToBuffer(tree.xmlOutputBuffer* c_buffer,
*/
  (void)(xmlOutputBufferWriteString(__pyx_v_c_buffer, __pyx_k__12));

  /* "src/lxml/serializer.pxi":203
 * # low-level serialisation functions
 * 
 * cdef void _writeDoctype(tree.xmlOutputBuffer* c_buffer,             # <<<<<<<<<<<<<<
 *                         const_xmlChar* c_doctype) noexcept nogil:
 *     tree.xmlOutputBufferWrite(c_buffer, tree.xmlStrlen(c_doctype),
*/

  /* function exit code */
}

/* "src/lxml/serializer.pxi":209
 *     tree.xmlOutputBufferWriteString(c_buffer, "\n")
 * 
 * cdef void _writeNodeToBuffer(tree.xmlOutputBuffer* c_buffer,             # <<<<<<<<<<<<<<
 *                              xmlNode* c_node, const_char* encoding, const_xmlChar* c_doctype,
 *                              int c_method, bint write_xml_declaration,
*/

static void __pyx_f_4lxml_5etree__writeNodeToBuffer(xmlOutputBuffer *__pyx_v_c_buffer, xmlNode *__pyx_v_c_node, const char *__pyx_v_encoding, const xmlChar *__pyx_v_c_doctype, int __pyx_v_c_method, int __pyx_v_write_xml_declaration, int __pyx_v_write_complete_document, int __pyx_v_pretty_print, int __pyx_v_with_tail, int __pyx_v_standalone) {
  xmlNode *__pyx_v_c_nsdecl_node;
  xmlDoc *__pyx_v_c_doc;
  xmlDoc *__pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  xmlNode *__pyx_t_4;

  /* "src/lxml/serializer.pxi":216
 *                              int standalone) noexcept nogil:
 *     cdef xmlNode* c_nsdecl_node
 *     cdef xmlDoc* c_doc = c_node.doc             # <<<<<<<<<<<<<<
 *     if write_xml_declaration and c_method == OUTPUT_METHOD_XML:
 *         _writeDeclarationToBuffer(c_buffer, c_doc.version, encoding, standalone)
*/
  __pyx_t_1 = __pyx_v_c_node->doc;
  __pyx_v_c_doc = __pyx_t_1;

  /* "src/lxml/serializer.pxi":217
 *     cdef xmlNode* c_nsdecl_node
 *     cdef xmlDoc* c_doc = c_node.doc
 *     if write_xml_declaration and c_method == OUTPUT_METHOD_XML:             # <<<<<<<<<<<<<<
 *         _writeDeclarationToBuffer(c_buffer, c_doc.version, encoding, standalone)
 * 
*/
  if (__pyx_v_write_xml_declaration) {
  } else {
    __pyx_t_2 = __pyx_v_write_xml_declaration;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_c_method == __pyx_e_4lxml_5etree_OUTPUT_METHOD_XML);
  __pyx_t_2 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "src/lxml/serializer.pxi":218
 *     cdef xmlDoc* c_doc = c_node.doc
 *     if write_xml_declaration and c_method == OUTPUT_METHOD_XML:
 *         _writeDeclarationToBuffer(c_buffer, c_doc.version, encoding, standalone)             # <<<<<<<<<<<<<<
 * 
 *     # comments/processing instructions before doctype declaration
*/
    __pyx_f_4lxml_5etree__writeDeclarationToBuffer(__pyx_v_c_buffer, __pyx_v_c_doc->version, __pyx_v_encoding, __pyx_v_standalone);

    /* "src/lxml/serializer.pxi":217
 *     cdef xmlNode* c_nsdecl_node
 *     cdef xmlDoc* c_doc = c_node.doc
 *     if write_xml_declaration and c_method == OUTPUT_METHOD_XML:             # <<<<<<<<<<<<<<
 *         _writeDeclarationToBuffer(c_buffer, c_doc.version, encoding, standalone)
 * 
*/
  }

  /* "src/lxml/serializer.pxi":221
 * 
 *     # comments/processing instructions before doctype declaration
 *     if write_complete_document and not c_buffer.error and c_doc.intSubset:             # <<<<<<<<<<<<<<
 *         _writePrevSiblings(c_buffer, <xmlNode*>c_doc.intSubset, encoding, pretty_print)
 * 
*/
  if (__pyx_v_write_complete_document) {
  } else {
    __pyx_t_2 = __pyx_v_write_complete_document;
    goto __pyx_L7_bool_binop_done;
  }
  __pyx_t_3 = (!(__pyx_v_c_buffer->error != 0));
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L7_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_c_doc->intSubset != 0);
  __pyx_t_2 = __pyx_t_3;
  __pyx_L7_bool_binop_done:;
  if (__pyx_t_2) {

    /* "src/lxml/serializer.pxi":222
 *     # comments/processing instructions before doctype declaration
 *     if write_complete_document and not c_buffer.error and c_doc.intSubset:
 *         _writePrevSiblings(c_buffer, <xmlNode*>c_doc.intSubset, encoding, pretty_print)             # <<<<<<<<<<<<<<
 * 
 *     if c_doctype:
*/
    __pyx_f_4lxml_5etree__writePrevSiblings(__pyx_v_c_buffer, ((xmlNode *)__pyx_v_c_doc->intSubset), __pyx_v_encoding, __pyx_v_pretty_print);

    /* "src/lxml/serializer.pxi":221
 * 
 *     # comments/processing instructions before doctype declaration
 *     if write_complete_document and not c_buffer.error and c_doc.intSubset:             # <<<<<<<<<<<<<<
 *         _writePrevSiblings(c_buffer, <xmlNode*>c_doc.intSubset, encoding, pretty_print)
 * 
*/
  }

  /* "src/lxml/serializer.pxi":224
 *         _writePrevSiblings(c_buffer, <xmlNode*>c_doc.intSubset, encoding, pretty_print)
 * 
 *     if c_doctype:             # <<<<<<<<<<<<<<
 *         _writeDoctype(c_buffer, c_doctype)
 *     # write internal DTD subset, preceding PIs/comments, etc.
*/
  __pyx_t_2 = (__pyx_v_c_doctype != 0);
  if (__pyx_t_2) {

    /* "src/lxml/serializer.pxi":225
 * 
 *     if c_doctype:
 *         _writeDoctype(c_buffer, c_doctype)             # <<<<<<<<<<<<<<
 *     # write internal DTD subset, preceding PIs/comments, etc.
 *     if write_complete_document and not c_buffer.error:
*/
    __pyx_f_4lxml_5etree__writeDoctype(__pyx_v_c_buffer, __pyx_v_c_doctype);

    /* "src/lxml/serializer.pxi":224
 *         _writePrevSiblings(c_buffer, <xmlNode*>c_doc.intSubset, encoding, pretty_print)
 * 
 *     if c_doctype:             # <<<<<<<<<<<<<<
 *         _writeDoctype(c_buffer, c_doctype)
 *     # write internal DTD subset, preceding PIs/comments, etc.
*/
  }

  /* "src/lxml/serializer.pxi":227
 *         _writeDoctype(c_buffer, c_doctype)
 *     # write internal DTD subset, preceding PIs/comments, etc.
 *     if write_complete_document and not c_buffer.error:             # <<<<<<<<<<<<<<
 *         if c_doctype is NULL:
 *             _writeDtdToBuffer(c_buffer, c_doc, c_node.name, c_method, encoding)
*/
  if (__pyx_v_write_complete_document) {
  } else {
    __pyx_t_2 = __pyx_v_write_complete_document;
    goto __pyx_L12_bool_binop_done;
  }
  __pyx_t_3 = (!(__pyx_v_c_buffer->error != 0));
  __pyx_t_2 = __pyx_t_3;
  __pyx_L12_bool_binop_done:;
  if (__pyx_t_2) {

    /* "src/lxml/serializer.pxi":228
 *     # write internal DTD subset, preceding PIs/comments, etc.
 *     if write_complete_document and not c_buffer.error:
 *         if c_doctype is NULL:             # <<<<<<<<<<<<<<
 *             _writeDtdToBuffer(c_buffer, c_doc, c_node.name, c_method, encoding)
 *         _writePrevSiblings(c_buffer, c_node, encoding, pretty_print)
*/
    __pyx_t_2 = (__pyx_v_c_doctype == NULL);
    if (__pyx_t_2) {

      /* "src/lxml/serializer.pxi":229
 *     if write_complete_document and not c_buffer.error:
 *         if c_doctype is NULL:
 *             _writeDtdToBuffer(c_buffer, c_doc, c_node.name, c_method, encoding)             # <<<<<<<<<<<<<<
 *         _writePrevSiblings(c_buffer, c_node, encoding, pretty_print)
 * 
*/
      __pyx_f_4lxml_5etree__writeDtdToBuffer(__pyx_v_c_buffer, __pyx_v_c_doc, __pyx_v_c_node->name, __pyx_v_c_method, __pyx_v_encoding);

      /* "src/lxml/serializer.pxi":228
 *     # write internal DTD subset, preceding PIs/comments, etc.
 *     if write_complete_document and not c_buffer.error:
 *         if c_doctype is NULL:             # <<<<<<<<<<<<<<
 *             _writeDtdToBuffer(c_buffer, c_doc, c_node.name, c_method, encoding)
 *         _writePrevSiblings(c_buffer, c_node, encoding, pretty_print)
*/
    }

    /* "src/lxml/serializer.pxi":230
 *         if c_doctype is NULL:
 *             _writeDtdToBuffer(c_buffer, c_doc, c_node.name, c_method, encoding)
 *         _writePrevSiblings(c_buffer, c_node, encoding, pretty_print)             # <<<<<<<<<<<<<<
 * 
 *     c_nsdecl_node = c_node
*/
    __pyx_f_4lxml_5etree__writePrevSiblings(__pyx_v_c_buffer, __pyx_v_c_node, __pyx_v_encoding, __pyx_v_pretty_print);

    /* "src/lxml/serializer.pxi":227
 *         _writeDoctype(c_buffer, c_doctype)
 *     # write internal DTD subset, preceding PIs/comments, etc.
 *     if write_complete_document and not c_buffer.error:             # <<<<<<<<<<<<<<
 *         if c_doctype is NULL:
 *             _writeDtdToBuffer(c_buffer, c_doc, c_node.name, c_method, encoding)
*/
  }

  /* "src/lxml/serializer.pxi":232
 *         _writePrevSiblings(c_buffer, c_node, encoding, pretty_print)
 * 
 *     c_nsdecl_node = c_node             # <<<<<<<<<<<<<<
 *     if not c_node.parent or c_node.parent.type != tree.XML_DOCUMENT_NODE:
 *         # copy the node and add namespaces from parents
*/
  __pyx_v_c_nsdecl_node = __pyx_v_c_node;

  /* "src/lxml/serializer.pxi":233
 * 
 *     c_nsdecl_node = c_node
 *     if not c_node.parent or c_node.parent.type != tree.XML_DOCUMENT_NODE:             # <<<<<<<<<<<<<<
 *         # copy the node and add namespaces from parents
 *         # this is required to make libxml write them
*/
  __pyx_t_3 = (!(__pyx_v_c_node->parent != 0));
  if (!__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L16_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_c_node->parent->type != XML_DOCUMENT_NODE);
  __pyx_t_2 = __pyx_t_3;
  __pyx_L16_bool_binop_done:;
  if (__pyx_t_2) {

    /* "src/lxml/serializer.pxi":236
 *         # copy the node and add namespaces from parents
 *         # this is required to make libxml write them
 *         c_nsdecl_node = tree.xmlCopyNode(c_node, 2)             # <<<<<<<<<<<<<<
 *         if not c_nsdecl_node:
 *             c_buffer.error = xmlerror.XML_ERR_NO_MEMORY
*/
    __pyx_v_c_nsdecl_node = xmlCopyNode(__pyx_v_c_node, 2);

    /* "src/lxml/serializer.pxi":237
 *         # this is required to make libxml write them
 *         c_nsdecl_node = tree.xmlCopyNode(c_node, 2)
 *         if not c_nsdecl_node:             # <<<<<<<<<<<<<<
 *             c_buffer.error = xmlerror.XML_ERR_NO_MEMORY
 *             return
*/
    __pyx_t_2 = (!(__pyx_v_c_nsdecl_node != 0));
    if (__pyx_t_2) {

      /* "src/lxml/serializer.pxi":238
 *         c_nsdecl_node = tree.xmlCopyNode(c_node, 2)
 *         if not c_nsdecl_node:
 *             c_buffer.error = xmlerror.XML_ERR_NO_MEMORY             # <<<<<<<<<<<<<<
 *             return
 *         _copyParentNamespaces(c_node, c_nsdecl_node)
*/
      __pyx_v_c_buffer->error = XML_ERR_NO_MEMORY;

      /* "src/lxml/serializer.pxi":239
 *         if not c_nsdecl_node:
 *             c_buffer.error = xmlerror.XML_ERR_NO_MEMORY
 *             return             # <<<<<<<<<<<<<<
 *         _copyParentNamespaces(c_node, c_nsdecl_node)
 * 
*/
      goto __pyx_L0;

      /* "src/lxml/serializer.pxi":237
 *         # this is required to make libxml write them
 *         c_nsdecl_node = tree.xmlCopyNode(c_node, 2)
 *         if not c_nsdecl_node:             # <<<<<<<<<<<<<<
 *             c_buffer.error = xmlerror.XML_ERR_NO_MEMORY
 *             return
*/
    }

    /* "src/lxml/serializer.pxi":240
 *             c_buffer.error = xmlerror.XML_ERR_NO_MEMORY
 *             return
 *         _copyParentNamespaces(c_node, c_nsdecl_node)             # <<<<<<<<<<<<<<
 * 
 *         c_nsdecl_node.parent = c_node.parent
*/
    __pyx_f_4lxml_5etree__copyParentNamespaces(__pyx_v_c_node, __pyx_v_c_nsdecl_node);

    /* "src/lxml/serializer.pxi":242
 *         _copyParentNamespaces(c_node, c_nsdecl_node)
 * 
 *         c_nsdecl_node.parent = c_node.parent             # <<<<<<<<<<<<<<
 *         c_nsdecl_node.children = c_node.children
 *         c_nsdecl_node.last = c_node.last
*/
    __pyx_t_4 = __pyx_v_c_node->parent;
    __pyx_v_c_nsdecl_node->parent = __pyx_t_4;

    /* "src/lxml/serializer.pxi":243
 * 
 *         c_nsdecl_node.parent = c_node.parent
 *         c_nsdecl_node.children = c_node.children             # <<<<<<<<<<<<<<
 *         c_nsdecl_node.last = c_node.last
 * 
*/
    __pyx_t_4 = __pyx_v_c_node->children;
    __pyx_v_c_nsdecl_node->children = __pyx_t_4;

    /* "src/lxml/serializer.pxi":244
 *         c_nsdecl_node.parent = c_node.parent
 *         c_nsdecl_node.children = c_node.children
 *         c_nsdecl_node.last = c_node.last             # <<<<<<<<<<<<<<
 * 
 *     # write node
*/
    __pyx_t_4 = __pyx_v_c_node->last;
    __pyx_v_c_nsdecl_node->last = __pyx_t_4;

    /* "src/lxml/serializer.pxi":233
 * 
 *     c_nsdecl_node = c_node
 *     if not c_node.parent or c_node.parent.type != tree.XML_DOCUMENT_NODE:             # <<<<<<<<<<<<<<
 *         # copy the node and add namespaces from parents
 *         # this is required to make libxml write them
*/
  }

  /* "src/lxml/serializer.pxi":247
 * 
 *     # write node
 *     if c_method == OUTPUT_METHOD_HTML:             # <<<<<<<<<<<<<<
 *         tree.htmlNodeDumpFormatOutput(
 *             c_buffer, c_doc, c_nsdecl_node, encoding, pretty_print)
*/
  __pyx_t_2 = (__pyx_v_c_method == __pyx_e_4lxml_5etree_OUTPUT_METHOD_HTML);
  if (__pyx_t_2) {

    /* "src/lxml/serializer.pxi":248
 *     # write node
 *     if c_method == OUTPUT_METHOD_HTML:
 *         tree.htmlNodeDumpFormatOutput(             # <<<<<<<<<<<<<<
 *             c_buffer, c_doc, c_nsdecl_node, encoding, pretty_print)
 *     else:
*/
    htmlNodeDumpFormatOutput(__pyx_v_c_buffer, __pyx_v_c_doc, __pyx_v_c_nsdecl_node, __pyx_v_encoding, __pyx_v_pretty_print);

    /* "src/lxml/serializer.pxi":247
 * 
 *     # write node
 *     if c_method == OUTPUT_METHOD_HTML:             # <<<<<<<<<<<<<<
 *         tree.htmlNodeDumpFormatOutput(
 *             c_buffer, c_doc, c_nsdecl_node, encoding, pretty_print)
*/
    goto __pyx_L19;
  }

  /* "src/lxml/serializer.pxi":251
 *             c_buffer, c_doc, c_nsdecl_node, encoding, pretty_print)
 *     else:
 *         tree.xmlNodeDumpOutput(             # <<<<<<<<<<<<<<
 *             c_buffer, c_doc, c_nsdecl_node, 0, pretty_print, encoding)
 * 
*/
  /*else*/ {

    /* "src/lxml/serializer.pxi":252
 *     else:
 *         tree.xmlNodeDumpOutput(
 *             c_buffer, c_doc, c_nsdecl_node, 0, pretty_print, encoding)             # <<<<<<<<<<<<<<
 * 
 *     if c_nsdecl_node is not c_node:
*/
    xmlNodeDumpOutput(__pyx_v_c_buffer, __pyx_v_c_doc, __pyx_v_c_nsdecl_node, 0, __pyx_v_pretty_print, __pyx_v_encoding);
  }
  __pyx_L19:;

  /* "src/lxml/serializer.pxi":254
 *             c_buffer, c_doc, c_nsdecl_node, 0, pretty_print, encoding)
 * 
 *     if c_nsdecl_node is not c_node:             # <<<<<<<<<<<<<<
 *         # clean up
 *         c_nsdecl_node.children = c_nsdecl_node.last = NULL
*/
  __pyx_t_2 = (__pyx_v_c_nsdecl_node != __pyx_v_c_node);
  if (__pyx_t_2) {

    /* "src/lxml/serializer.pxi":256
 *     if c_nsdecl_node is not c_node:
 *         # clean up
 *         c_nsdecl_node.children = c_nsdecl_node.last = NULL             # <<<<<<<<<<<<<<
 *         tree.xmlFreeNode(c_nsdecl_node)
 * 
*/
    __pyx_v_c_nsdecl_node->children = NULL;
    __pyx_v_c_nsdecl_node->last = NULL;

    /* "src/lxml/serializer.pxi":257
 *         # clean up
 *         c_nsdecl_node.children = c_nsdecl_node.last = NULL
 *         tree.xmlFreeNode(c_nsdecl_node)             # <<<<<<<<<<<<<<
 * 
 *     if c_buffer.error:
*/
    xmlFreeNode(__pyx_v_c_nsdecl_node);

    /* "src/lxml/serializer.pxi":254
 *             c_buffer, c_doc, c_nsdecl_node, 0, pretty_print, encoding)
 * 
 *     if c_nsdecl_node is not c_node:             # <<<<<<<<<<<<<<
 *         # clean up
 *         c_nsdecl_node.children = c_nsdecl_node.last = NULL
*/
  }

  /* "src/lxml/serializer.pxi":259
 *         tree.xmlFreeNode(c_nsdecl_node)
 * 
 *     if c_buffer.error:             # <<<<<<<<<<<<<<
 *         return
 * 
*/
  __pyx_t_2 = (__pyx_v_c_buffer->error != 0);
  if (__pyx_t_2) {

    /* "src/lxml/serializer.pxi":260
 * 
 *     if c_buffer.error:
 *         return             # <<<<<<<<<<<<<<
 * 
 *     # write tail, trailing comments, etc.
*/
    goto __pyx_L0;

    /* "src/lxml/serializer.pxi":259
 *         tree.xmlFreeNode(c_nsdecl_node)
 * 
 *     if c_buffer.error:             # <<<<<<<<<<<<<<
 *         return
 * 
*/
  }

  /* "src/lxml/serializer.pxi":263
 * 
 *     # write tail, trailing comments, etc.
 *     if with_tail:             # <<<<<<<<<<<<<<
 *         _writeTail(c_buffer, c_node, encoding, c_method, pretty_print)
 *     if write_complete_document:
*/
  if (__pyx_v_with_tail) {

    /* "src/lxml/serializer.pxi":264
 *     # write tail, trailing comments, etc.
 *     if with_tail:
 *         _writeTail(c_buffer, c_node, encoding, c_method, pretty_print)             # <<<<<<<<<<<<<<
 *     if write_complete_document:
 *         _writeNextSiblings(c_buffer, c_node, encoding, pretty_print)
*/
    __pyx_f_4lxml_5etree__writeTail(__pyx_v_c_buffer, __pyx_v_c_node, __pyx_v_encoding, __pyx_v_c_method, __pyx_v_pretty_print);

    /* "src/lxml/serializer.pxi":263
 * 
 *     # write tail, trailing comments, etc.
 *     if with_tail:             # <<<<<<<<<<<<<<
 *         _writeTail(c_buffer, c_node, encoding, c_method, pretty_print)
 *     if write_complete_document:
*/
  }

  /* "src/lxml/serializer.pxi":265
 *     if with_tail:
 *         _writeTail(c_buffer, c_node, encoding, c_method, pretty_print)
 *     if write_complete_document:             # <<<<<<<<<<<<<<
 *         _writeNextSiblings(c_buffer, c_node, encoding, pretty_print)
 *     if pretty_print:
*/
  if (__pyx_v_write_complete_document) {

    /* "src/lxml/serializer.pxi":266
 *         _writeTail(c_buffer, c_node, encoding, c_method, pretty_print)
 *     if write_complete_document:
 *         _writeNextSiblings(c_buffer, c_node, encoding, pretty_print)             # <<<<<<<<<<<<<<
 *     if pretty_print:
 *         tree.xmlOutputBufferWrite(c_buffer, 1, "\n")
*/
    __pyx_f_4lxml_5etree__writeNextSiblings(__pyx_v_c_buffer, __pyx_v_c_node, __pyx_v_encoding, __pyx_v_pretty_print);

    /* "src/lxml/serializer.pxi":265
 *     if with_tail:
 *         _writeTail(c_buffer, c_node, encoding, c_method, pretty_print)
 *     if write_complete_document:             # <<<<<<<<<<<<<<
 *         _writeNextSiblings(c_buffer, c_node, encoding, pretty_print)
 *     if pretty_print:
*/
  }

  /* "src/lxml/serializer.pxi":267
 *     if write_complete_document:
 *         _writeNextSiblings(c_buffer, c_node, encoding, pretty_print)
 *     if pretty_print:             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferWrite(c_buffer, 1, "\n")
 * 
*/
  if (__pyx_v_pretty_print) {

    /* "src/lxml/serializer.pxi":268
 *         _writeNextSiblings(c_buffer, c_node, encoding, pretty_print)
 *     if pretty_print:
 *         tree.xmlOutputBufferWrite(c_buffer, 1, "\n")             # <<<<<<<<<<<<<<
 * 
 * cdef void _writeDeclarationToBuffer(tree.xmlOutputBuffer* c_buffer,
*/
    (void)(xmlOutputBufferWrite(__pyx_v_c_buffer, 1, __pyx_k__12));

    /* "src/lxml/serializer.pxi":267
 *     if write_complete_document:
 *         _writeNextSiblings(c_buffer, c_node, encoding, pretty_print)
 *     if pretty_print:             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferWrite(c_buffer, 1, "\n")
 * 
*/
  }

  /* "src/lxml/serializer.pxi":209
 *     tree.xmlOutputBufferWriteString(c_buffer, "\n")
 * 
 * cdef void _writeNodeToBuffer(tree.xmlOutputBuffer* c_buffer,             # <<<<<<<<<<<<<<
 *                              xmlNode* c_node, const_char* encoding, const_xmlChar* c_doctype,
 *                              int c_method, bint write_xml_declaration,
*/

  /* function exit code */
  __pyx_L0:;
}

/* "src/lxml/serializer.pxi":270
 *         tree.xmlOutputBufferWrite(c_buffer, 1, "\n")
 * 
 * cdef void _writeDeclarationToBuffer(tree.xmlOutputBuffer* c_buffer,             # <<<<<<<<<<<<<<
 *                                     const_xmlChar* version, const_char* encoding,
 *                                     int standalone) noexcept nogil:
*/

static void __pyx_f_4lxml_5etree__writeDeclarationToBuffer(xmlOutputBuffer *__pyx_v_c_buffer, const xmlChar *__pyx_v_version, const char *__pyx_v_encoding, int __pyx_v_standalone) {
  int __pyx_t_1;

  /* "src/lxml/serializer.pxi":273
 *                                     const_xmlChar* version, const_char* encoding,
 *                                     int standalone) noexcept nogil:
 *     if version is NULL:             # <<<<<<<<<<<<<<
 *         version = <unsigned char*>"1.0"
 *     tree.xmlOutputBufferWrite(c_buffer, 15, "<?xml version='")
*/
  __pyx_t_1 = (__pyx_v_version == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":274
 *                                     int standalone) noexcept nogil:
 *     if version is NULL:
 *         version = <unsigned char*>"1.0"             # <<<<<<<<<<<<<<
 *     tree.xmlOutputBufferWrite(c_buffer, 15, "<?xml version='")
 *     tree.xmlOutputBufferWriteString(c_buffer, <const_char*>version)
*/
    __pyx_v_version = ((unsigned char *)((unsigned char *)((char *)"1.0")));

    /* "src/lxml/serializer.pxi":273
 *                                     const_xmlChar* version, const_char* encoding,
 *                                     int standalone) noexcept nogil:
 *     if version is NULL:             # <<<<<<<<<<<<<<
 *         version = <unsigned char*>"1.0"
 *     tree.xmlOutputBufferWrite(c_buffer, 15, "<?xml version='")
*/
  }

  /* "src/lxml/serializer.pxi":275
 *     if version is NULL:
 *         version = <unsigned char*>"1.0"
 *     tree.xmlOutputBufferWrite(c_buffer, 15, "<?xml version='")             # <<<<<<<<<<<<<<
 *     tree.xmlOutputBufferWriteString(c_buffer, <const_char*>version)
 *     tree.xmlOutputBufferWrite(c_buffer, 12, "' encoding='")
*/
  (void)(xmlOutputBufferWrite(__pyx_v_c_buffer, 15, __pyx_k_xml_version));

  /* "src/lxml/serializer.pxi":276
 *         version = <unsigned char*>"1.0"
 *     tree.xmlOutputBufferWrite(c_buffer, 15, "<?xml version='")
 *     tree.xmlOutputBufferWriteString(c_buffer, <const_char*>version)             # <<<<<<<<<<<<<<
 *     tree.xmlOutputBufferWrite(c_buffer, 12, "' encoding='")
 *     tree.xmlOutputBufferWriteString(c_buffer, encoding)
*/
  (void)(xmlOutputBufferWriteString(__pyx_v_c_buffer, ((const char *)__pyx_v_version)));

  /* "src/lxml/serializer.pxi":277
 *     tree.xmlOutputBufferWrite(c_buffer, 15, "<?xml version='")
 *     tree.xmlOutputBufferWriteString(c_buffer, <const_char*>version)
 *     tree.xmlOutputBufferWrite(c_buffer, 12, "' encoding='")             # <<<<<<<<<<<<<<
 *     tree.xmlOutputBufferWriteString(c_buffer, encoding)
 *     if standalone == 0:
*/
  (void)(xmlOutputBufferWrite(__pyx_v_c_buffer, 12, __pyx_k_encoding_2));

  /* "src/lxml/serializer.pxi":278
 *     tree.xmlOutputBufferWriteString(c_buffer, <const_char*>version)
 *     tree.xmlOutputBufferWrite(c_buffer, 12, "' encoding='")
 *     tree.xmlOutputBufferWriteString(c_buffer, encoding)             # <<<<<<<<<<<<<<
 *     if standalone == 0:
 *         tree.xmlOutputBufferWrite(c_buffer, 20, "' standalone='no'?>\n")
*/
  (void)(xmlOutputBufferWriteString(__pyx_v_c_buffer, __pyx_v_encoding));

  /* "src/lxml/serializer.pxi":279
 *     tree.xmlOutputBufferWrite(c_buffer, 12, "' encoding='")
 *     tree.xmlOutputBufferWriteString(c_buffer, encoding)
 *     if standalone == 0:             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferWrite(c_buffer, 20, "' standalone='no'?>\n")
 *     elif standalone == 1:
*/
  switch (__pyx_v_standalone) {
    case 0:

    /* "src/lxml/serializer.pxi":280
 *     tree.xmlOutputBufferWriteString(c_buffer, encoding)
 *     if standalone == 0:
 *         tree.xmlOutputBufferWrite(c_buffer, 20, "' standalone='no'?>\n")             # <<<<<<<<<<<<<<
 *     elif standalone == 1:
 *         tree.xmlOutputBufferWrite(c_buffer, 21, "' standalone='yes'?>\n")
*/
    (void)(xmlOutputBufferWrite(__pyx_v_c_buffer, 20, __pyx_k_standalone_no));

    /* "src/lxml/serializer.pxi":279
 *     tree.xmlOutputBufferWrite(c_buffer, 12, "' encoding='")
 *     tree.xmlOutputBufferWriteString(c_buffer, encoding)
 *     if standalone == 0:             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferWrite(c_buffer, 20, "' standalone='no'?>\n")
 *     elif standalone == 1:
*/
    break;
    case 1:

    /* "src/lxml/serializer.pxi":282
 *         tree.xmlOutputBufferWrite(c_buffer, 20, "' standalone='no'?>\n")
 *     elif standalone == 1:
 *         tree.xmlOutputBufferWrite(c_buffer, 21, "' standalone='yes'?>\n")             # <<<<<<<<<<<<<<
 *     else:
 *         tree.xmlOutputBufferWrite(c_buffer, 4, "'?>\n")
*/
    (void)(xmlOutputBufferWrite(__pyx_v_c_buffer, 21, __pyx_k_standalone_yes));

    /* "src/lxml/serializer.pxi":281
 *     if standalone == 0:
 *         tree.xmlOutputBufferWrite(c_buffer, 20, "' standalone='no'?>\n")
 *     elif standalone == 1:             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferWrite(c_buffer, 21, "' standalone='yes'?>\n")
 *     else:
*/
    break;
    default:

    /* "src/lxml/serializer.pxi":284
 *         tree.xmlOutputBufferWrite(c_buffer, 21, "' standalone='yes'?>\n")
 *     else:
 *         tree.xmlOutputBufferWrite(c_buffer, 4, "'?>\n")             # <<<<<<<<<<<<<<
 * 
 * cdef void _writeDtdToBuffer(tree.xmlOutputBuffer* c_buffer,
*/
    (void)(xmlOutputBufferWrite(__pyx_v_c_buffer, 4, __pyx_k__31));
    break;
  }

  /* "src/lxml/serializer.pxi":270
 *         tree.xmlOutputBufferWrite(c_buffer, 1, "\n")
 * 
 * cdef void _writeDeclarationToBuffer(tree.xmlOutputBuffer* c_buffer,             # <<<<<<<<<<<<<<
 *                                     const_xmlChar* version, const_char* encoding,
 *                                     int standalone) noexcept nogil:
*/

  /* function exit code */
}

/* "src/lxml/serializer.pxi":286
 *         tree.xmlOutputBufferWrite(c_buffer, 4, "'?>\n")
 * 
 * cdef void _writeDtdToBuffer(tree.xmlOutputBuffer* c_buffer,             # <<<<<<<<<<<<<<
 *                             xmlDoc* c_doc, const_xmlChar* c_root_name,
 *                             int c_method, const_char* encoding) noexcept nogil:
*/

static void __pyx_f_4lxml_5etree__writeDtdToBuffer(xmlOutputBuffer *__pyx_v_c_buffer, xmlDoc *__pyx_v_c_doc, const xmlChar *__pyx_v_c_root_name, int __pyx_v_c_method, const char *__pyx_v_encoding) {
  xmlDtd *__pyx_v_c_dtd;
  xmlNode *__pyx_v_c_node;
  char *__pyx_v_quotechar;
  const xmlChar *__pyx_v_public_id;
  const xmlChar *__pyx_v_sys_url;
  xmlBuffer *__pyx_v_c_buf;
  xmlDtd *__pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  const xmlChar *__pyx_t_4;
  xmlNode *__pyx_t_5;

  /* "src/lxml/serializer.pxi":292
 *     cdef xmlNode* c_node
 *     cdef char* quotechar
 *     c_dtd = c_doc.intSubset             # <<<<<<<<<<<<<<
 *     if not c_dtd or not c_dtd.name:
 *         return
*/
  __pyx_t_1 = __pyx_v_c_doc->intSubset;
  __pyx_v_c_dtd = __pyx_t_1;

  /* "src/lxml/serializer.pxi":293
 *     cdef char* quotechar
 *     c_dtd = c_doc.intSubset
 *     if not c_dtd or not c_dtd.name:             # <<<<<<<<<<<<<<
 *         return
 * 
*/
  __pyx_t_3 = (!(__pyx_v_c_dtd != 0));
  if (!__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (!(__pyx_v_c_dtd->name != 0));
  __pyx_t_2 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "src/lxml/serializer.pxi":294
 *     c_dtd = c_doc.intSubset
 *     if not c_dtd or not c_dtd.name:
 *         return             # <<<<<<<<<<<<<<
 * 
 *     # Name in document type declaration must match the root element tag.
*/
    goto __pyx_L0;

    /* "src/lxml/serializer.pxi":293
 *     cdef char* quotechar
 *     c_dtd = c_doc.intSubset
 *     if not c_dtd or not c_dtd.name:             # <<<<<<<<<<<<<<
 *         return
 * 
*/
  }

  /* "src/lxml/serializer.pxi":298
 *     # Name in document type declaration must match the root element tag.
 *     # For XML, case sensitive match, for HTML insensitive.
 *     if c_method == OUTPUT_METHOD_HTML:             # <<<<<<<<<<<<<<
 *         if tree.xmlStrcasecmp(c_root_name, c_dtd.name) != 0:
 *             return
*/
  __pyx_t_2 = (__pyx_v_c_method == __pyx_e_4lxml_5etree_OUTPUT_METHOD_HTML);
  if (__pyx_t_2) {

    /* "src/lxml/serializer.pxi":299
 *     # For XML, case sensitive match, for HTML insensitive.
 *     if c_method == OUTPUT_METHOD_HTML:
 *         if tree.xmlStrcasecmp(c_root_name, c_dtd.name) != 0:             # <<<<<<<<<<<<<<
 *             return
 *     else:
*/
    __pyx_t_2 = (xmlStrcasecmp(__pyx_v_c_root_name, __pyx_v_c_dtd->name) != 0);
    if (__pyx_t_2) {

      /* "src/lxml/serializer.pxi":300
 *     if c_method == OUTPUT_METHOD_HTML:
 *         if tree.xmlStrcasecmp(c_root_name, c_dtd.name) != 0:
 *             return             # <<<<<<<<<<<<<<
 *     else:
 *         if tree.xmlStrcmp(c_root_name, c_dtd.name) != 0:
*/
      goto __pyx_L0;

      /* "src/lxml/serializer.pxi":299
 *     # For XML, case sensitive match, for HTML insensitive.
 *     if c_method == OUTPUT_METHOD_HTML:
 *         if tree.xmlStrcasecmp(c_root_name, c_dtd.name) != 0:             # <<<<<<<<<<<<<<
 *             return
 *     else:
*/
    }

    /* "src/lxml/serializer.pxi":298
 *     # Name in document type declaration must match the root element tag.
 *     # For XML, case sensitive match, for HTML insensitive.
 *     if c_method == OUTPUT_METHOD_HTML:             # <<<<<<<<<<<<<<
 *         if tree.xmlStrcasecmp(c_root_name, c_dtd.name) != 0:
 *             return
*/
    goto __pyx_L6;
  }

  /* "src/lxml/serializer.pxi":302
 *             return
 *     else:
 *         if tree.xmlStrcmp(c_root_name, c_dtd.name) != 0:             # <<<<<<<<<<<<<<
 *             return
 * 
*/
  /*else*/ {
    __pyx_t_2 = (xmlStrcmp(__pyx_v_c_root_name, __pyx_v_c_dtd->name) != 0);
    if (__pyx_t_2) {

      /* "src/lxml/serializer.pxi":303
 *     else:
 *         if tree.xmlStrcmp(c_root_name, c_dtd.name) != 0:
 *             return             # <<<<<<<<<<<<<<
 * 
 *     tree.xmlOutputBufferWrite(c_buffer, 10, "<!DOCTYPE ")
*/
      goto __pyx_L0;

      /* "src/lxml/serializer.pxi":302
 *             return
 *     else:
 *         if tree.xmlStrcmp(c_root_name, c_dtd.name) != 0:             # <<<<<<<<<<<<<<
 *             return
 * 
*/
    }
  }
  __pyx_L6:;

  /* "src/lxml/serializer.pxi":305
 *             return
 * 
 *     tree.xmlOutputBufferWrite(c_buffer, 10, "<!DOCTYPE ")             # <<<<<<<<<<<<<<
 *     tree.xmlOutputBufferWriteString(c_buffer, <const_char*>c_dtd.name)
 * 
*/
  (void)(xmlOutputBufferWrite(__pyx_v_c_buffer, 10, __pyx_k_DOCTYPE));

  /* "src/lxml/serializer.pxi":306
 * 
 *     tree.xmlOutputBufferWrite(c_buffer, 10, "<!DOCTYPE ")
 *     tree.xmlOutputBufferWriteString(c_buffer, <const_char*>c_dtd.name)             # <<<<<<<<<<<<<<
 * 
 *     cdef const_xmlChar* public_id = c_dtd.ExternalID
*/
  (void)(xmlOutputBufferWriteString(__pyx_v_c_buffer, ((const char *)__pyx_v_c_dtd->name)));

  /* "src/lxml/serializer.pxi":308
 *     tree.xmlOutputBufferWriteString(c_buffer, <const_char*>c_dtd.name)
 * 
 *     cdef const_xmlChar* public_id = c_dtd.ExternalID             # <<<<<<<<<<<<<<
 *     cdef const_xmlChar* sys_url = c_dtd.SystemID
 *     if public_id and public_id[0] == b'\0':
*/
  __pyx_t_4 = __pyx_v_c_dtd->ExternalID;
  __pyx_v_public_id = __pyx_t_4;

  /* "src/lxml/serializer.pxi":309
 * 
 *     cdef const_xmlChar* public_id = c_dtd.ExternalID
 *     cdef const_xmlChar* sys_url = c_dtd.SystemID             # <<<<<<<<<<<<<<
 *     if public_id and public_id[0] == b'\0':
 *         public_id = NULL
*/
  __pyx_t_4 = __pyx_v_c_dtd->SystemID;
  __pyx_v_sys_url = __pyx_t_4;

  /* "src/lxml/serializer.pxi":310
 *     cdef const_xmlChar* public_id = c_dtd.ExternalID
 *     cdef const_xmlChar* sys_url = c_dtd.SystemID
 *     if public_id and public_id[0] == b'\0':             # <<<<<<<<<<<<<<
 *         public_id = NULL
 *     if sys_url and sys_url[0] == b'\0':
*/
  __pyx_t_3 = (__pyx_v_public_id != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L10_bool_binop_done;
  }
  __pyx_t_3 = ((__pyx_v_public_id[0]) == '\x00');
  __pyx_t_2 = __pyx_t_3;
  __pyx_L10_bool_binop_done:;
  if (__pyx_t_2) {

    /* "src/lxml/serializer.pxi":311
 *     cdef const_xmlChar* sys_url = c_dtd.SystemID
 *     if public_id and public_id[0] == b'\0':
 *         public_id = NULL             # <<<<<<<<<<<<<<
 *     if sys_url and sys_url[0] == b'\0':
 *         sys_url = NULL
*/
    __pyx_v_public_id = NULL;

    /* "src/lxml/serializer.pxi":310
 *     cdef const_xmlChar* public_id = c_dtd.ExternalID
 *     cdef const_xmlChar* sys_url = c_dtd.SystemID
 *     if public_id and public_id[0] == b'\0':             # <<<<<<<<<<<<<<
 *         public_id = NULL
 *     if sys_url and sys_url[0] == b'\0':
*/
  }

  /* "src/lxml/serializer.pxi":312
 *     if public_id and public_id[0] == b'\0':
 *         public_id = NULL
 *     if sys_url and sys_url[0] == b'\0':             # <<<<<<<<<<<<<<
 *         sys_url = NULL
 * 
*/
  __pyx_t_3 = (__pyx_v_sys_url != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L13_bool_binop_done;
  }
  __pyx_t_3 = ((__pyx_v_sys_url[0]) == '\x00');
  __pyx_t_2 = __pyx_t_3;
  __pyx_L13_bool_binop_done:;
  if (__pyx_t_2) {

    /* "src/lxml/serializer.pxi":313
 *         public_id = NULL
 *     if sys_url and sys_url[0] == b'\0':
 *         sys_url = NULL             # <<<<<<<<<<<<<<
 * 
 *     if public_id:
*/
    __pyx_v_sys_url = NULL;

    /* "src/lxml/serializer.pxi":312
 *     if public_id and public_id[0] == b'\0':
 *         public_id = NULL
 *     if sys_url and sys_url[0] == b'\0':             # <<<<<<<<<<<<<<
 *         sys_url = NULL
 * 
*/
  }

  /* "src/lxml/serializer.pxi":315
 *         sys_url = NULL
 * 
 *     if public_id:             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferWrite(c_buffer, 9, ' PUBLIC "')
 *         tree.xmlOutputBufferWriteString(c_buffer, <const_char*>public_id)
*/
  __pyx_t_2 = (__pyx_v_public_id != 0);
  if (__pyx_t_2) {

    /* "src/lxml/serializer.pxi":316
 * 
 *     if public_id:
 *         tree.xmlOutputBufferWrite(c_buffer, 9, ' PUBLIC "')             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferWriteString(c_buffer, <const_char*>public_id)
 *         if sys_url:
*/
    (void)(xmlOutputBufferWrite(__pyx_v_c_buffer, 9, __pyx_k_PUBLIC));

    /* "src/lxml/serializer.pxi":317
 *     if public_id:
 *         tree.xmlOutputBufferWrite(c_buffer, 9, ' PUBLIC "')
 *         tree.xmlOutputBufferWriteString(c_buffer, <const_char*>public_id)             # <<<<<<<<<<<<<<
 *         if sys_url:
 *             tree.xmlOutputBufferWrite(c_buffer, 2, '" ')
*/
    (void)(xmlOutputBufferWriteString(__pyx_v_c_buffer, ((const char *)__pyx_v_public_id)));

    /* "src/lxml/serializer.pxi":318
 *         tree.xmlOutputBufferWrite(c_buffer, 9, ' PUBLIC "')
 *         tree.xmlOutputBufferWriteString(c_buffer, <const_char*>public_id)
 *         if sys_url:             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferWrite(c_buffer, 2, '" ')
 *         else:
*/
    __pyx_t_2 = (__pyx_v_sys_url != 0);
    if (__pyx_t_2) {

      /* "src/lxml/serializer.pxi":319
 *         tree.xmlOutputBufferWriteString(c_buffer, <const_char*>public_id)
 *         if sys_url:
 *             tree.xmlOutputBufferWrite(c_buffer, 2, '" ')             # <<<<<<<<<<<<<<
 *         else:
 *             tree.xmlOutputBufferWrite(c_buffer, 1, '"')
*/
      (void)(xmlOutputBufferWrite(__pyx_v_c_buffer, 2, __pyx_k__15));

      /* "src/lxml/serializer.pxi":318
 *         tree.xmlOutputBufferWrite(c_buffer, 9, ' PUBLIC "')
 *         tree.xmlOutputBufferWriteString(c_buffer, <const_char*>public_id)
 *         if sys_url:             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferWrite(c_buffer, 2, '" ')
 *         else:
*/
      goto __pyx_L16;
    }

    /* "src/lxml/serializer.pxi":321
 *             tree.xmlOutputBufferWrite(c_buffer, 2, '" ')
 *         else:
 *             tree.xmlOutputBufferWrite(c_buffer, 1, '"')             # <<<<<<<<<<<<<<
 *     elif sys_url:
 *         tree.xmlOutputBufferWrite(c_buffer, 8, ' SYSTEM ')
*/
    /*else*/ {
      (void)(xmlOutputBufferWrite(__pyx_v_c_buffer, 1, __pyx_k__14));
    }
    __pyx_L16:;

    /* "src/lxml/serializer.pxi":315
 *         sys_url = NULL
 * 
 *     if public_id:             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferWrite(c_buffer, 9, ' PUBLIC "')
 *         tree.xmlOutputBufferWriteString(c_buffer, <const_char*>public_id)
*/
    goto __pyx_L15;
  }

  /* "src/lxml/serializer.pxi":322
 *         else:
 *             tree.xmlOutputBufferWrite(c_buffer, 1, '"')
 *     elif sys_url:             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferWrite(c_buffer, 8, ' SYSTEM ')
 * 
*/
  __pyx_t_2 = (__pyx_v_sys_url != 0);
  if (__pyx_t_2) {

    /* "src/lxml/serializer.pxi":323
 *             tree.xmlOutputBufferWrite(c_buffer, 1, '"')
 *     elif sys_url:
 *         tree.xmlOutputBufferWrite(c_buffer, 8, ' SYSTEM ')             # <<<<<<<<<<<<<<
 * 
 *     if sys_url:
*/
    (void)(xmlOutputBufferWrite(__pyx_v_c_buffer, 8, __pyx_k_SYSTEM));

    /* "src/lxml/serializer.pxi":322
 *         else:
 *             tree.xmlOutputBufferWrite(c_buffer, 1, '"')
 *     elif sys_url:             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferWrite(c_buffer, 8, ' SYSTEM ')
 * 
*/
  }
  __pyx_L15:;

  /* "src/lxml/serializer.pxi":325
 *         tree.xmlOutputBufferWrite(c_buffer, 8, ' SYSTEM ')
 * 
 *     if sys_url:             # <<<<<<<<<<<<<<
 *         if tree.xmlStrchr(sys_url, b'"'):
 *             quotechar = '\''
*/
  __pyx_t_2 = (__pyx_v_sys_url != 0);
  if (__pyx_t_2) {

    /* "src/lxml/serializer.pxi":326
 * 
 *     if sys_url:
 *         if tree.xmlStrchr(sys_url, b'"'):             # <<<<<<<<<<<<<<
 *             quotechar = '\''
 *         else:
*/
    __pyx_t_2 = (xmlStrchr(__pyx_v_sys_url, '"') != 0);
    if (__pyx_t_2) {

      /* "src/lxml/serializer.pxi":327
 *     if sys_url:
 *         if tree.xmlStrchr(sys_url, b'"'):
 *             quotechar = '\''             # <<<<<<<<<<<<<<
 *         else:
 *             quotechar = '"'
*/
      __pyx_v_quotechar = ((char *)"'");

      /* "src/lxml/serializer.pxi":326
 * 
 *     if sys_url:
 *         if tree.xmlStrchr(sys_url, b'"'):             # <<<<<<<<<<<<<<
 *             quotechar = '\''
 *         else:
*/
      goto __pyx_L18;
    }

    /* "src/lxml/serializer.pxi":329
 *             quotechar = '\''
 *         else:
 *             quotechar = '"'             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferWrite(c_buffer, 1, quotechar)
 *         tree.xmlOutputBufferWriteString(c_buffer, <const_char*>sys_url)
*/
    /*else*/ {
      __pyx_v_quotechar = ((char *)"\"");
    }
    __pyx_L18:;

    /* "src/lxml/serializer.pxi":330
 *         else:
 *             quotechar = '"'
 *         tree.xmlOutputBufferWrite(c_buffer, 1, quotechar)             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferWriteString(c_buffer, <const_char*>sys_url)
 *         tree.xmlOutputBufferWrite(c_buffer, 1, quotechar)
*/
    (void)(xmlOutputBufferWrite(__pyx_v_c_buffer, 1, __pyx_v_quotechar));

    /* "src/lxml/serializer.pxi":331
 *             quotechar = '"'
 *         tree.xmlOutputBufferWrite(c_buffer, 1, quotechar)
 *         tree.xmlOutputBufferWriteString(c_buffer, <const_char*>sys_url)             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferWrite(c_buffer, 1, quotechar)
 * 
*/
    (void)(xmlOutputBufferWriteString(__pyx_v_c_buffer, ((const char *)__pyx_v_sys_url)));

    /* "src/lxml/serializer.pxi":332
 *         tree.xmlOutputBufferWrite(c_buffer, 1, quotechar)
 *         tree.xmlOutputBufferWriteString(c_buffer, <const_char*>sys_url)
 *         tree.xmlOutputBufferWrite(c_buffer, 1, quotechar)             # <<<<<<<<<<<<<<
 * 
 *     if (not c_dtd.entities and not c_dtd.elements and
*/
    (void)(xmlOutputBufferWrite(__pyx_v_c_buffer, 1, __pyx_v_quotechar));

    /* "src/lxml/serializer.pxi":325
 *         tree.xmlOutputBufferWrite(c_buffer, 8, ' SYSTEM ')
 * 
 *     if sys_url:             # <<<<<<<<<<<<<<
 *         if tree.xmlStrchr(sys_url, b'"'):
 *             quotechar = '\''
*/
  }

  /* "src/lxml/serializer.pxi":334
 *         tree.xmlOutputBufferWrite(c_buffer, 1, quotechar)
 * 
 *     if (not c_dtd.entities and not c_dtd.elements and             # <<<<<<<<<<<<<<
 *            not c_dtd.attributes and not c_dtd.notations and
 *            not c_dtd.pentities):
*/
  __pyx_t_3 = (!(__pyx_v_c_dtd->entities != 0));
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L20_bool_binop_done;
  }
  __pyx_t_3 = (!(__pyx_v_c_dtd->elements != 0));
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L20_bool_binop_done;
  }

  /* "src/lxml/serializer.pxi":335
 * 
 *     if (not c_dtd.entities and not c_dtd.elements and
 *            not c_dtd.attributes and not c_dtd.notations and             # <<<<<<<<<<<<<<
 *            not c_dtd.pentities):
 *         tree.xmlOutputBufferWrite(c_buffer, 2, '>\n')
*/
  __pyx_t_3 = (!(__pyx_v_c_dtd->attributes != 0));
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L20_bool_binop_done;
  }
  __pyx_t_3 = (!(__pyx_v_c_dtd->notations != 0));
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L20_bool_binop_done;
  }

  /* "src/lxml/serializer.pxi":336
 *     if (not c_dtd.entities and not c_dtd.elements and
 *            not c_dtd.attributes and not c_dtd.notations and
 *            not c_dtd.pentities):             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferWrite(c_buffer, 2, '>\n')
 *         return
*/
  __pyx_t_3 = (!(__pyx_v_c_dtd->pentities != 0));
  __pyx_t_2 = __pyx_t_3;
  __pyx_L20_bool_binop_done:;

  /* "src/lxml/serializer.pxi":334
 *         tree.xmlOutputBufferWrite(c_buffer, 1, quotechar)
 * 
 *     if (not c_dtd.entities and not c_dtd.elements and             # <<<<<<<<<<<<<<
 *            not c_dtd.attributes and not c_dtd.notations and
 *            not c_dtd.pentities):
*/
  if (__pyx_t_2) {

    /* "src/lxml/serializer.pxi":337
 *            not c_dtd.attributes and not c_dtd.notations and
 *            not c_dtd.pentities):
 *         tree.xmlOutputBufferWrite(c_buffer, 2, '>\n')             # <<<<<<<<<<<<<<
 *         return
 * 
*/
    (void)(xmlOutputBufferWrite(__pyx_v_c_buffer, 2, __pyx_k__32));

    /* "src/lxml/serializer.pxi":338
 *            not c_dtd.pentities):
 *         tree.xmlOutputBufferWrite(c_buffer, 2, '>\n')
 *         return             # <<<<<<<<<<<<<<
 * 
 *     tree.xmlOutputBufferWrite(c_buffer, 3, ' [\n')
*/
    goto __pyx_L0;

    /* "src/lxml/serializer.pxi":334
 *         tree.xmlOutputBufferWrite(c_buffer, 1, quotechar)
 * 
 *     if (not c_dtd.entities and not c_dtd.elements and             # <<<<<<<<<<<<<<
 *            not c_dtd.attributes and not c_dtd.notations and
 *            not c_dtd.pentities):
*/
  }

  /* "src/lxml/serializer.pxi":340
 *         return
 * 
 *     tree.xmlOutputBufferWrite(c_buffer, 3, ' [\n')             # <<<<<<<<<<<<<<
 *     if c_dtd.notations and not c_buffer.error:
 *         c_buf = tree.xmlBufferCreate()
*/
  (void)(xmlOutputBufferWrite(__pyx_v_c_buffer, 3, __pyx_k__33));

  /* "src/lxml/serializer.pxi":341
 * 
 *     tree.xmlOutputBufferWrite(c_buffer, 3, ' [\n')
 *     if c_dtd.notations and not c_buffer.error:             # <<<<<<<<<<<<<<
 *         c_buf = tree.xmlBufferCreate()
 *         if not c_buf:
*/
  __pyx_t_3 = (__pyx_v_c_dtd->notations != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L26_bool_binop_done;
  }
  __pyx_t_3 = (!(__pyx_v_c_buffer->error != 0));
  __pyx_t_2 = __pyx_t_3;
  __pyx_L26_bool_binop_done:;
  if (__pyx_t_2) {

    /* "src/lxml/serializer.pxi":342
 *     tree.xmlOutputBufferWrite(c_buffer, 3, ' [\n')
 *     if c_dtd.notations and not c_buffer.error:
 *         c_buf = tree.xmlBufferCreate()             # <<<<<<<<<<<<<<
 *         if not c_buf:
 *             c_buffer.error = xmlerror.XML_ERR_NO_MEMORY
*/
    __pyx_v_c_buf = xmlBufferCreate();

    /* "src/lxml/serializer.pxi":343
 *     if c_dtd.notations and not c_buffer.error:
 *         c_buf = tree.xmlBufferCreate()
 *         if not c_buf:             # <<<<<<<<<<<<<<
 *             c_buffer.error = xmlerror.XML_ERR_NO_MEMORY
 *             return
*/
    __pyx_t_2 = (!(__pyx_v_c_buf != 0));
    if (__pyx_t_2) {

      /* "src/lxml/serializer.pxi":344
 *         c_buf = tree.xmlBufferCreate()
 *         if not c_buf:
 *             c_buffer.error = xmlerror.XML_ERR_NO_MEMORY             # <<<<<<<<<<<<<<
 *             return
 *         tree.xmlDumpNotationTable(c_buf, <tree.xmlNotationTable*>c_dtd.notations)
*/
      __pyx_v_c_buffer->error = XML_ERR_NO_MEMORY;

      /* "src/lxml/serializer.pxi":345
 *         if not c_buf:
 *             c_buffer.error = xmlerror.XML_ERR_NO_MEMORY
 *             return             # <<<<<<<<<<<<<<
 *         tree.xmlDumpNotationTable(c_buf, <tree.xmlNotationTable*>c_dtd.notations)
 *         tree.xmlOutputBufferWrite(
*/
      goto __pyx_L0;

      /* "src/lxml/serializer.pxi":343
 *     if c_dtd.notations and not c_buffer.error:
 *         c_buf = tree.xmlBufferCreate()
 *         if not c_buf:             # <<<<<<<<<<<<<<
 *             c_buffer.error = xmlerror.XML_ERR_NO_MEMORY
 *             return
*/
    }

    /* "src/lxml/serializer.pxi":346
 *             c_buffer.error = xmlerror.XML_ERR_NO_MEMORY
 *             return
 *         tree.xmlDumpNotationTable(c_buf, <tree.xmlNotationTable*>c_dtd.notations)             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferWrite(
 *             c_buffer, tree.xmlBufferLength(c_buf),
*/
    xmlDumpNotationTable(__pyx_v_c_buf, ((xmlNotationTable *)__pyx_v_c_dtd->notations));

    /* "src/lxml/serializer.pxi":347
 *             return
 *         tree.xmlDumpNotationTable(c_buf, <tree.xmlNotationTable*>c_dtd.notations)
 *         tree.xmlOutputBufferWrite(             # <<<<<<<<<<<<<<
 *             c_buffer, tree.xmlBufferLength(c_buf),
 *             <const_char*>tree.xmlBufferContent(c_buf))
*/
    (void)(xmlOutputBufferWrite(__pyx_v_c_buffer, xmlBufferLength(__pyx_v_c_buf), ((const char *)xmlBufferContent(__pyx_v_c_buf))));

    /* "src/lxml/serializer.pxi":350
 *             c_buffer, tree.xmlBufferLength(c_buf),
 *             <const_char*>tree.xmlBufferContent(c_buf))
 *         tree.xmlBufferFree(c_buf)             # <<<<<<<<<<<<<<
 *     c_node = c_dtd.children
 *     while c_node and not c_buffer.error:
*/
    xmlBufferFree(__pyx_v_c_buf);

    /* "src/lxml/serializer.pxi":341
 * 
 *     tree.xmlOutputBufferWrite(c_buffer, 3, ' [\n')
 *     if c_dtd.notations and not c_buffer.error:             # <<<<<<<<<<<<<<
 *         c_buf = tree.xmlBufferCreate()
 *         if not c_buf:
*/
  }

  /* "src/lxml/serializer.pxi":351
 *             <const_char*>tree.xmlBufferContent(c_buf))
 *         tree.xmlBufferFree(c_buf)
 *     c_node = c_dtd.children             # <<<<<<<<<<<<<<
 *     while c_node and not c_buffer.error:
 *         tree.xmlNodeDumpOutput(c_buffer, c_node.doc, c_node, 0, 0, encoding)
*/
  __pyx_t_5 = __pyx_v_c_dtd->children;
  __pyx_v_c_node = __pyx_t_5;

  /* "src/lxml/serializer.pxi":352
 *         tree.xmlBufferFree(c_buf)
 *     c_node = c_dtd.children
 *     while c_node and not c_buffer.error:             # <<<<<<<<<<<<<<
 *         tree.xmlNodeDumpOutput(c_buffer, c_node.doc, c_node, 0, 0, encoding)
 *         c_node = c_node.next
*/
  while (1) {
    __pyx_t_3 = (__pyx_v_c_node != 0);
    if (__pyx_t_3) {
    } else {
      __pyx_t_2 = __pyx_t_3;
      goto __pyx_L31_bool_binop_done;
    }
    __pyx_t_3 = (!(__pyx_v_c_buffer->error != 0));
    __pyx_t_2 = __pyx_t_3;
    __pyx_L31_bool_binop_done:;
    if (!__pyx_t_2) break;

    /* "src/lxml/serializer.pxi":353
 *     c_node = c_dtd.children
 *     while c_node and not c_buffer.error:
 *         tree.xmlNodeDumpOutput(c_buffer, c_node.doc, c_node, 0, 0, encoding)             # <<<<<<<<<<<<<<
 *         c_node = c_node.next
 *     tree.xmlOutputBufferWrite(c_buffer, 3, "]>\n")
*/
    xmlNodeDumpOutput(__pyx_v_c_buffer, __pyx_v_c_node->doc, __pyx_v_c_node, 0, 0, __pyx_v_encoding);

    /* "src/lxml/serializer.pxi":354
 *     while c_node and not c_buffer.error:
 *         tree.xmlNodeDumpOutput(c_buffer, c_node.doc, c_node, 0, 0, encoding)
 *         c_node = c_node.next             # <<<<<<<<<<<<<<
 *     tree.xmlOutputBufferWrite(c_buffer, 3, "]>\n")
 * 
*/
    __pyx_t_5 = __pyx_v_c_node->next;
    __pyx_v_c_node = __pyx_t_5;
  }

  /* "src/lxml/serializer.pxi":355
 *         tree.xmlNodeDumpOutput(c_buffer, c_node.doc, c_node, 0, 0, encoding)
 *         c_node = c_node.next
 *     tree.xmlOutputBufferWrite(c_buffer, 3, "]>\n")             # <<<<<<<<<<<<<<
 * 
 * cdef void _writeTail(tree.xmlOutputBuffer* c_buffer, xmlNode* c_node,
*/
  (void)(xmlOutputBufferWrite(__pyx_v_c_buffer, 3, __pyx_k__34));

  /* "src/lxml/serializer.pxi":286
 *         tree.xmlOutputBufferWrite(c_buffer, 4, "'?>\n")
 * 
 * cdef void _writeDtdToBuffer(tree.xmlOutputBuffer* c_buffer,             # <<<<<<<<<<<<<<
 *                             xmlDoc* c_doc, const_xmlChar* c_root_name,
 *                             int c_method, const_char* encoding) noexcept nogil:
*/

  /* function exit code */
  __pyx_L0:;
}

/* "src/lxml/serializer.pxi":357
 *     tree.xmlOutputBufferWrite(c_buffer, 3, "]>\n")
 * 
 * cdef void _writeTail(tree.xmlOutputBuffer* c_buffer, xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                      const_char* encoding, int c_method, bint pretty_print) noexcept nogil:
 *     "Write the element tail."
*/

static void __pyx_f_4lxml_5etree__writeTail(xmlOutputBuffer *__pyx_v_c_buffer, xmlNode *__pyx_v_c_node, const char *__pyx_v_encoding, int __pyx_v_c_method, int __pyx_v_pretty_print) {
  xmlNode *__pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;

  /* "src/lxml/serializer.pxi":360
 *                      const_char* encoding, int c_method, bint pretty_print) noexcept nogil:
 *     "Write the element tail."
 *     c_node = c_node.next             # <<<<<<<<<<<<<<
 *     while c_node and not c_buffer.error and c_node.type in (
 *             tree.XML_TEXT_NODE, tree.XML_CDATA_SECTION_NODE):
*/
  __pyx_t_1 = __pyx_v_c_node->next;
  __pyx_v_c_node = __pyx_t_1;

  /* "src/lxml/serializer.pxi":361
 *     "Write the element tail."
 *     c_node = c_node.next
 *     while c_node and not c_buffer.error and c_node.type in (             # <<<<<<<<<<<<<<
 *             tree.XML_TEXT_NODE, tree.XML_CDATA_SECTION_NODE):
 *         if c_method == OUTPUT_METHOD_HTML:
*/
  while (1) {
    __pyx_t_3 = (__pyx_v_c_node != 0);
    if (__pyx_t_3) {
    } else {
      __pyx_t_2 = __pyx_t_3;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_3 = (!(__pyx_v_c_buffer->error != 0));
    if (__pyx_t_3) {
    } else {
      __pyx_t_2 = __pyx_t_3;
      goto __pyx_L5_bool_binop_done;
    }

    /* "src/lxml/serializer.pxi":362
 *     c_node = c_node.next
 *     while c_node and not c_buffer.error and c_node.type in (
 *             tree.XML_TEXT_NODE, tree.XML_CDATA_SECTION_NODE):             # <<<<<<<<<<<<<<
 *         if c_method == OUTPUT_METHOD_HTML:
 *             tree.htmlNodeDumpFormatOutput(
*/
    switch (__pyx_v_c_node->type) {
      case XML_TEXT_NODE:
      case XML_CDATA_SECTION_NODE:

      /* "src/lxml/serializer.pxi":361
 *     "Write the element tail."
 *     c_node = c_node.next
 *     while c_node and not c_buffer.error and c_node.type in (             # <<<<<<<<<<<<<<
 *             tree.XML_TEXT_NODE, tree.XML_CDATA_SECTION_NODE):
 *         if c_method == OUTPUT_METHOD_HTML:
*/
      __pyx_t_3 = 1;
      break;
      default:
      __pyx_t_3 = 0;
      break;
    }
    __pyx_t_4 = __pyx_t_3;
    __pyx_t_2 = __pyx_t_4;
    __pyx_L5_bool_binop_done:;
    if (!__pyx_t_2) break;

    /* "src/lxml/serializer.pxi":363
 *     while c_node and not c_buffer.error and c_node.type in (
 *             tree.XML_TEXT_NODE, tree.XML_CDATA_SECTION_NODE):
 *         if c_method == OUTPUT_METHOD_HTML:             # <<<<<<<<<<<<<<
 *             tree.htmlNodeDumpFormatOutput(
 *                 c_buffer, c_node.doc, c_node, encoding, pretty_print)
*/
    __pyx_t_2 = (__pyx_v_c_method == __pyx_e_4lxml_5etree_OUTPUT_METHOD_HTML);
    if (__pyx_t_2) {

      /* "src/lxml/serializer.pxi":364
 *             tree.XML_TEXT_NODE, tree.XML_CDATA_SECTION_NODE):
 *         if c_method == OUTPUT_METHOD_HTML:
 *             tree.htmlNodeDumpFormatOutput(             # <<<<<<<<<<<<<<
 *                 c_buffer, c_node.doc, c_node, encoding, pretty_print)
 *         else:
*/
      htmlNodeDumpFormatOutput(__pyx_v_c_buffer, __pyx_v_c_node->doc, __pyx_v_c_node, __pyx_v_encoding, __pyx_v_pretty_print);

      /* "src/lxml/serializer.pxi":363
 *     while c_node and not c_buffer.error and c_node.type in (
 *             tree.XML_TEXT_NODE, tree.XML_CDATA_SECTION_NODE):
 *         if c_method == OUTPUT_METHOD_HTML:             # <<<<<<<<<<<<<<
 *             tree.htmlNodeDumpFormatOutput(
 *                 c_buffer, c_node.doc, c_node, encoding, pretty_print)
*/
      goto __pyx_L8;
    }

    /* "src/lxml/serializer.pxi":367
 *                 c_buffer, c_node.doc, c_node, encoding, pretty_print)
 *         else:
 *             tree.xmlNodeDumpOutput(             # <<<<<<<<<<<<<<
 *                 c_buffer, c_node.doc, c_node, 0, pretty_print, encoding)
 *         c_node = c_node.next
*/
    /*else*/ {

      /* "src/lxml/serializer.pxi":368
 *         else:
 *             tree.xmlNodeDumpOutput(
 *                 c_buffer, c_node.doc, c_node, 0, pretty_print, encoding)             # <<<<<<<<<<<<<<
 *         c_node = c_node.next
 * 
*/
      xmlNodeDumpOutput(__pyx_v_c_buffer, __pyx_v_c_node->doc, __pyx_v_c_node, 0, __pyx_v_pretty_print, __pyx_v_encoding);
    }
    __pyx_L8:;

    /* "src/lxml/serializer.pxi":369
 *             tree.xmlNodeDumpOutput(
 *                 c_buffer, c_node.doc, c_node, 0, pretty_print, encoding)
 *         c_node = c_node.next             # <<<<<<<<<<<<<<
 * 
 * cdef void _writePrevSiblings(tree.xmlOutputBuffer* c_buffer, xmlNode* c_node,
*/
    __pyx_t_1 = __pyx_v_c_node->next;
    __pyx_v_c_node = __pyx_t_1;
  }

  /* "src/lxml/serializer.pxi":357
 *     tree.xmlOutputBufferWrite(c_buffer, 3, "]>\n")
 * 
 * cdef void _writeTail(tree.xmlOutputBuffer* c_buffer, xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                      const_char* encoding, int c_method, bint pretty_print) noexcept nogil:
 *     "Write the element tail."
*/

  /* function exit code */
}

/* "src/lxml/serializer.pxi":371
 *         c_node = c_node.next
 * 
 * cdef void _writePrevSiblings(tree.xmlOutputBuffer* c_buffer, xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                              const_char* encoding, bint pretty_print) noexcept nogil:
 *     cdef xmlNode* c_sibling
*/

static void __pyx_f_4lxml_5etree__writePrevSiblings(xmlOutputBuffer *__pyx_v_c_buffer, xmlNode *__pyx_v_c_node, const char *__pyx_v_encoding, int __pyx_v_pretty_print) {
  xmlNode *__pyx_v_c_sibling;
  int __pyx_t_1;
  int __pyx_t_2;
  xmlNode *__pyx_t_3;

  /* "src/lxml/serializer.pxi":374
 *                              const_char* encoding, bint pretty_print) noexcept nogil:
 *     cdef xmlNode* c_sibling
 *     if c_node.parent and _isElement(c_node.parent):             # <<<<<<<<<<<<<<
 *         return
 *     # we are at a root node, so add PI and comment siblings
*/
  __pyx_t_2 = (__pyx_v_c_node->parent != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = _isElement(__pyx_v_c_node->parent);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":375
 *     cdef xmlNode* c_sibling
 *     if c_node.parent and _isElement(c_node.parent):
 *         return             # <<<<<<<<<<<<<<
 *     # we are at a root node, so add PI and comment siblings
 *     c_sibling = c_node
*/
    goto __pyx_L0;

    /* "src/lxml/serializer.pxi":374
 *                              const_char* encoding, bint pretty_print) noexcept nogil:
 *     cdef xmlNode* c_sibling
 *     if c_node.parent and _isElement(c_node.parent):             # <<<<<<<<<<<<<<
 *         return
 *     # we are at a root node, so add PI and comment siblings
*/
  }

  /* "src/lxml/serializer.pxi":377
 *         return
 *     # we are at a root node, so add PI and comment siblings
 *     c_sibling = c_node             # <<<<<<<<<<<<<<
 *     while c_sibling.prev and \
 *             (c_sibling.prev.type == tree.XML_PI_NODE or
*/
  __pyx_v_c_sibling = __pyx_v_c_node;

  /* "src/lxml/serializer.pxi":378
 *     # we are at a root node, so add PI and comment siblings
 *     c_sibling = c_node
 *     while c_sibling.prev and \             # <<<<<<<<<<<<<<
 *             (c_sibling.prev.type == tree.XML_PI_NODE or
 *              c_sibling.prev.type == tree.XML_COMMENT_NODE):
*/
  while (1) {
    __pyx_t_2 = (__pyx_v_c_sibling->prev != 0);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L8_bool_binop_done;
    }

    /* "src/lxml/serializer.pxi":379
 *     c_sibling = c_node
 *     while c_sibling.prev and \
 *             (c_sibling.prev.type == tree.XML_PI_NODE or             # <<<<<<<<<<<<<<
 *              c_sibling.prev.type == tree.XML_COMMENT_NODE):
 *         c_sibling = c_sibling.prev
*/
    switch (__pyx_v_c_sibling->prev->type) {
      case XML_PI_NODE:
      case XML_COMMENT_NODE:

      /* "src/lxml/serializer.pxi":380
 *     while c_sibling.prev and \
 *             (c_sibling.prev.type == tree.XML_PI_NODE or
 *              c_sibling.prev.type == tree.XML_COMMENT_NODE):             # <<<<<<<<<<<<<<
 *         c_sibling = c_sibling.prev
 *     while c_sibling is not c_node and not c_buffer.error:
*/
      __pyx_t_2 = 1;

      /* "src/lxml/serializer.pxi":379
 *     c_sibling = c_node
 *     while c_sibling.prev and \
 *             (c_sibling.prev.type == tree.XML_PI_NODE or             # <<<<<<<<<<<<<<
 *              c_sibling.prev.type == tree.XML_COMMENT_NODE):
 *         c_sibling = c_sibling.prev
*/
      break;
      default:
      __pyx_t_2 = 0;
      break;
    }
    __pyx_t_1 = __pyx_t_2;
    __pyx_L8_bool_binop_done:;
    if (!__pyx_t_1) break;

    /* "src/lxml/serializer.pxi":381
 *             (c_sibling.prev.type == tree.XML_PI_NODE or
 *              c_sibling.prev.type == tree.XML_COMMENT_NODE):
 *         c_sibling = c_sibling.prev             # <<<<<<<<<<<<<<
 *     while c_sibling is not c_node and not c_buffer.error:
 *         tree.xmlNodeDumpOutput(c_buffer, c_node.doc, c_sibling, 0,
*/
    __pyx_t_3 = __pyx_v_c_sibling->prev;
    __pyx_v_c_sibling = __pyx_t_3;
  }

  /* "src/lxml/serializer.pxi":382
 *              c_sibling.prev.type == tree.XML_COMMENT_NODE):
 *         c_sibling = c_sibling.prev
 *     while c_sibling is not c_node and not c_buffer.error:             # <<<<<<<<<<<<<<
 *         tree.xmlNodeDumpOutput(c_buffer, c_node.doc, c_sibling, 0,
 *                                pretty_print, encoding)
*/
  while (1) {
    __pyx_t_2 = (__pyx_v_c_sibling != __pyx_v_c_node);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L12_bool_binop_done;
    }
    __pyx_t_2 = (!(__pyx_v_c_buffer->error != 0));
    __pyx_t_1 = __pyx_t_2;
    __pyx_L12_bool_binop_done:;
    if (!__pyx_t_1) break;

    /* "src/lxml/serializer.pxi":383
 *         c_sibling = c_sibling.prev
 *     while c_sibling is not c_node and not c_buffer.error:
 *         tree.xmlNodeDumpOutput(c_buffer, c_node.doc, c_sibling, 0,             # <<<<<<<<<<<<<<
 *                                pretty_print, encoding)
 *         if pretty_print:
*/
    xmlNodeDumpOutput(__pyx_v_c_buffer, __pyx_v_c_node->doc, __pyx_v_c_sibling, 0, __pyx_v_pretty_print, __pyx_v_encoding);

    /* "src/lxml/serializer.pxi":385
 *         tree.xmlNodeDumpOutput(c_buffer, c_node.doc, c_sibling, 0,
 *                                pretty_print, encoding)
 *         if pretty_print:             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferWriteString(c_buffer, "\n")
 *         c_sibling = c_sibling.next
*/
    if (__pyx_v_pretty_print) {

      /* "src/lxml/serializer.pxi":386
 *                                pretty_print, encoding)
 *         if pretty_print:
 *             tree.xmlOutputBufferWriteString(c_buffer, "\n")             # <<<<<<<<<<<<<<
 *         c_sibling = c_sibling.next
 * 
*/
      (void)(xmlOutputBufferWriteString(__pyx_v_c_buffer, __pyx_k__12));

      /* "src/lxml/serializer.pxi":385
 *         tree.xmlNodeDumpOutput(c_buffer, c_node.doc, c_sibling, 0,
 *                                pretty_print, encoding)
 *         if pretty_print:             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferWriteString(c_buffer, "\n")
 *         c_sibling = c_sibling.next
*/
    }

    /* "src/lxml/serializer.pxi":387
 *         if pretty_print:
 *             tree.xmlOutputBufferWriteString(c_buffer, "\n")
 *         c_sibling = c_sibling.next             # <<<<<<<<<<<<<<
 * 
 * cdef void _writeNextSiblings(tree.xmlOutputBuffer* c_buffer, xmlNode* c_node,
*/
    __pyx_t_3 = __pyx_v_c_sibling->next;
    __pyx_v_c_sibling = __pyx_t_3;
  }

  /* "src/lxml/serializer.pxi":371
 *         c_node = c_node.next
 * 
 * cdef void _writePrevSiblings(tree.xmlOutputBuffer* c_buffer, xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                              const_char* encoding, bint pretty_print) noexcept nogil:
 *     cdef xmlNode* c_sibling
*/

  /* function exit code */
  __pyx_L0:;
}

/* "src/lxml/serializer.pxi":389
 *         c_sibling = c_sibling.next
 * 
 * cdef void _writeNextSiblings(tree.xmlOutputBuffer* c_buffer, xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                              const_char* encoding, bint pretty_print) noexcept nogil:
 *     cdef xmlNode* c_sibling
*/

static void __pyx_f_4lxml_5etree__writeNextSiblings(xmlOutputBuffer *__pyx_v_c_buffer, xmlNode *__pyx_v_c_node, const char *__pyx_v_encoding, int __pyx_v_pretty_print) {
  xmlNode *__pyx_v_c_sibling;
  int __pyx_t_1;
  int __pyx_t_2;
  xmlNode *__pyx_t_3;

  /* "src/lxml/serializer.pxi":392
 *                              const_char* encoding, bint pretty_print) noexcept nogil:
 *     cdef xmlNode* c_sibling
 *     if c_node.parent and _isElement(c_node.parent):             # <<<<<<<<<<<<<<
 *         return
 *     # we are at a root node, so add PI and comment siblings
*/
  __pyx_t_2 = (__pyx_v_c_node->parent != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = _isElement(__pyx_v_c_node->parent);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":393
 *     cdef xmlNode* c_sibling
 *     if c_node.parent and _isElement(c_node.parent):
 *         return             # <<<<<<<<<<<<<<
 *     # we are at a root node, so add PI and comment siblings
 *     c_sibling = c_node.next
*/
    goto __pyx_L0;

    /* "src/lxml/serializer.pxi":392
 *                              const_char* encoding, bint pretty_print) noexcept nogil:
 *     cdef xmlNode* c_sibling
 *     if c_node.parent and _isElement(c_node.parent):             # <<<<<<<<<<<<<<
 *         return
 *     # we are at a root node, so add PI and comment siblings
*/
  }

  /* "src/lxml/serializer.pxi":395
 *         return
 *     # we are at a root node, so add PI and comment siblings
 *     c_sibling = c_node.next             # <<<<<<<<<<<<<<
 *     while not c_buffer.error and c_sibling and \
 *             (c_sibling.type == tree.XML_PI_NODE or
*/
  __pyx_t_3 = __pyx_v_c_node->next;
  __pyx_v_c_sibling = __pyx_t_3;

  /* "src/lxml/serializer.pxi":396
 *     # we are at a root node, so add PI and comment siblings
 *     c_sibling = c_node.next
 *     while not c_buffer.error and c_sibling and \             # <<<<<<<<<<<<<<
 *             (c_sibling.type == tree.XML_PI_NODE or
 *              c_sibling.type == tree.XML_COMMENT_NODE):
*/
  while (1) {
    __pyx_t_2 = (!(__pyx_v_c_buffer->error != 0));
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L8_bool_binop_done;
    }
    __pyx_t_2 = (__pyx_v_c_sibling != 0);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L8_bool_binop_done;
    }

    /* "src/lxml/serializer.pxi":397
 *     c_sibling = c_node.next
 *     while not c_buffer.error and c_sibling and \
 *             (c_sibling.type == tree.XML_PI_NODE or             # <<<<<<<<<<<<<<
 *              c_sibling.type == tree.XML_COMMENT_NODE):
 *         if pretty_print:
*/
    switch (__pyx_v_c_sibling->type) {
      case XML_PI_NODE:
      case XML_COMMENT_NODE:

      /* "src/lxml/serializer.pxi":398
 *     while not c_buffer.error and c_sibling and \
 *             (c_sibling.type == tree.XML_PI_NODE or
 *              c_sibling.type == tree.XML_COMMENT_NODE):             # <<<<<<<<<<<<<<
 *         if pretty_print:
 *             tree.xmlOutputBufferWriteString(c_buffer, "\n")
*/
      __pyx_t_2 = 1;

      /* "src/lxml/serializer.pxi":397
 *     c_sibling = c_node.next
 *     while not c_buffer.error and c_sibling and \
 *             (c_sibling.type == tree.XML_PI_NODE or             # <<<<<<<<<<<<<<
 *              c_sibling.type == tree.XML_COMMENT_NODE):
 *         if pretty_print:
*/
      break;
      default:
      __pyx_t_2 = 0;
      break;
    }
    __pyx_t_1 = __pyx_t_2;
    __pyx_L8_bool_binop_done:;
    if (!__pyx_t_1) break;

    /* "src/lxml/serializer.pxi":399
 *             (c_sibling.type == tree.XML_PI_NODE or
 *              c_sibling.type == tree.XML_COMMENT_NODE):
 *         if pretty_print:             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferWriteString(c_buffer, "\n")
 *         tree.xmlNodeDumpOutput(c_buffer, c_node.doc, c_sibling, 0,
*/
    if (__pyx_v_pretty_print) {

      /* "src/lxml/serializer.pxi":400
 *              c_sibling.type == tree.XML_COMMENT_NODE):
 *         if pretty_print:
 *             tree.xmlOutputBufferWriteString(c_buffer, "\n")             # <<<<<<<<<<<<<<
 *         tree.xmlNodeDumpOutput(c_buffer, c_node.doc, c_sibling, 0,
 *                                pretty_print, encoding)
*/
      (void)(xmlOutputBufferWriteString(__pyx_v_c_buffer, __pyx_k__12));

      /* "src/lxml/serializer.pxi":399
 *             (c_sibling.type == tree.XML_PI_NODE or
 *              c_sibling.type == tree.XML_COMMENT_NODE):
 *         if pretty_print:             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferWriteString(c_buffer, "\n")
 *         tree.xmlNodeDumpOutput(c_buffer, c_node.doc, c_sibling, 0,
*/
    }

    /* "src/lxml/serializer.pxi":401
 *         if pretty_print:
 *             tree.xmlOutputBufferWriteString(c_buffer, "\n")
 *         tree.xmlNodeDumpOutput(c_buffer, c_node.doc, c_sibling, 0,             # <<<<<<<<<<<<<<
 *                                pretty_print, encoding)
 *         c_sibling = c_sibling.next
*/
    xmlNodeDumpOutput(__pyx_v_c_buffer, __pyx_v_c_node->doc, __pyx_v_c_sibling, 0, __pyx_v_pretty_print, __pyx_v_encoding);

    /* "src/lxml/serializer.pxi":403
 *         tree.xmlNodeDumpOutput(c_buffer, c_node.doc, c_sibling, 0,
 *                                pretty_print, encoding)
 *         c_sibling = c_sibling.next             # <<<<<<<<<<<<<<
 * 
 * 
*/
    __pyx_t_3 = __pyx_v_c_sibling->next;
    __pyx_v_c_sibling = __pyx_t_3;
  }

  /* "src/lxml/serializer.pxi":389
 *         c_sibling = c_sibling.next
 * 
 * cdef void _writeNextSiblings(tree.xmlOutputBuffer* c_buffer, xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                              const_char* encoding, bint pretty_print) noexcept nogil:
 *     cdef xmlNode* c_sibling
*/

  /* function exit code */
  __pyx_L0:;
}

/* "src/lxml/serializer.pxi":407
 * 
 * # copied and adapted from libxml2 (xmlBufAttrSerializeTxtContent())
 * cdef _write_attr_string(tree.xmlOutputBuffer* buf, const char *string):             # <<<<<<<<<<<<<<
 *     cdef const char *base
 *     cdef const char *cur
*/

static PyObject *__pyx_f_4lxml_5etree__write_attr_string(xmlOutputBuffer *__pyx_v_buf, char const *__pyx_v_string) {
  char const *__pyx_v_base;
  char const *__pyx_v_cur;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_write_attr_string", 0);

  /* "src/lxml/serializer.pxi":411
 *     cdef const char *cur
 * 
 *     if string == NULL:             # <<<<<<<<<<<<<<
 *         return
 * 
*/
  __pyx_t_1 = (__pyx_v_string == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":412
 * 
 *     if string == NULL:
 *         return             # <<<<<<<<<<<<<<
 * 
 *     base = cur = <const char*>string
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/serializer.pxi":411
 *     cdef const char *cur
 * 
 *     if string == NULL:             # <<<<<<<<<<<<<<
 *         return
 * 
*/
  }

  /* "src/lxml/serializer.pxi":414
 *         return
 * 
 *     base = cur = <const char*>string             # <<<<<<<<<<<<<<
 *     while cur[0] != 0:
 *         if cur[0] == b'\n':
*/
  __pyx_v_base = ((char const *)__pyx_v_string);
  __pyx_v_cur = ((char const *)__pyx_v_string);

  /* "src/lxml/serializer.pxi":415
 * 
 *     base = cur = <const char*>string
 *     while cur[0] != 0:             # <<<<<<<<<<<<<<
 *         if cur[0] == b'\n':
 *             if base != cur:
*/
  while (1) {
    __pyx_t_1 = ((__pyx_v_cur[0]) != 0);
    if (!__pyx_t_1) break;

    /* "src/lxml/serializer.pxi":416
 *     base = cur = <const char*>string
 *     while cur[0] != 0:
 *         if cur[0] == b'\n':             # <<<<<<<<<<<<<<
 *             if base != cur:
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
*/
    __pyx_t_1 = ((__pyx_v_cur[0]) == '\n');
    if (__pyx_t_1) {

      /* "src/lxml/serializer.pxi":417
 *     while cur[0] != 0:
 *         if cur[0] == b'\n':
 *             if base != cur:             # <<<<<<<<<<<<<<
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
 * 
*/
      __pyx_t_1 = (__pyx_v_base != __pyx_v_cur);
      if (__pyx_t_1) {

        /* "src/lxml/serializer.pxi":418
 *         if cur[0] == b'\n':
 *             if base != cur:
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)             # <<<<<<<<<<<<<<
 * 
 *             tree.xmlOutputBufferWrite(buf, 5, "&#10;")
*/
        (void)(xmlOutputBufferWrite(__pyx_v_buf, (__pyx_v_cur - __pyx_v_base), __pyx_v_base));

        /* "src/lxml/serializer.pxi":417
 *     while cur[0] != 0:
 *         if cur[0] == b'\n':
 *             if base != cur:             # <<<<<<<<<<<<<<
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
 * 
*/
      }

      /* "src/lxml/serializer.pxi":420
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
 * 
 *             tree.xmlOutputBufferWrite(buf, 5, "&#10;")             # <<<<<<<<<<<<<<
 *             cur += 1
 *             base = cur
*/
      (void)(xmlOutputBufferWrite(__pyx_v_buf, 5, __pyx_k_10));

      /* "src/lxml/serializer.pxi":421
 * 
 *             tree.xmlOutputBufferWrite(buf, 5, "&#10;")
 *             cur += 1             # <<<<<<<<<<<<<<
 *             base = cur
 * 
*/
      __pyx_v_cur = (__pyx_v_cur + 1);

      /* "src/lxml/serializer.pxi":422
 *             tree.xmlOutputBufferWrite(buf, 5, "&#10;")
 *             cur += 1
 *             base = cur             # <<<<<<<<<<<<<<
 * 
 *         elif cur[0] == b'\r':
*/
      __pyx_v_base = __pyx_v_cur;

      /* "src/lxml/serializer.pxi":416
 *     base = cur = <const char*>string
 *     while cur[0] != 0:
 *         if cur[0] == b'\n':             # <<<<<<<<<<<<<<
 *             if base != cur:
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
*/
      goto __pyx_L6;
    }

    /* "src/lxml/serializer.pxi":424
 *             base = cur
 * 
 *         elif cur[0] == b'\r':             # <<<<<<<<<<<<<<
 *             if base != cur:
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
*/
    __pyx_t_1 = ((__pyx_v_cur[0]) == '\r');
    if (__pyx_t_1) {

      /* "src/lxml/serializer.pxi":425
 * 
 *         elif cur[0] == b'\r':
 *             if base != cur:             # <<<<<<<<<<<<<<
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
 * 
*/
      __pyx_t_1 = (__pyx_v_base != __pyx_v_cur);
      if (__pyx_t_1) {

        /* "src/lxml/serializer.pxi":426
 *         elif cur[0] == b'\r':
 *             if base != cur:
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)             # <<<<<<<<<<<<<<
 * 
 *             tree.xmlOutputBufferWrite(buf, 5, "&#13;")
*/
        (void)(xmlOutputBufferWrite(__pyx_v_buf, (__pyx_v_cur - __pyx_v_base), __pyx_v_base));

        /* "src/lxml/serializer.pxi":425
 * 
 *         elif cur[0] == b'\r':
 *             if base != cur:             # <<<<<<<<<<<<<<
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
 * 
*/
      }

      /* "src/lxml/serializer.pxi":428
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
 * 
 *             tree.xmlOutputBufferWrite(buf, 5, "&#13;")             # <<<<<<<<<<<<<<
 *             cur += 1
 *             base = cur
*/
      (void)(xmlOutputBufferWrite(__pyx_v_buf, 5, __pyx_k_13));

      /* "src/lxml/serializer.pxi":429
 * 
 *             tree.xmlOutputBufferWrite(buf, 5, "&#13;")
 *             cur += 1             # <<<<<<<<<<<<<<
 *             base = cur
 * 
*/
      __pyx_v_cur = (__pyx_v_cur + 1);

      /* "src/lxml/serializer.pxi":430
 *             tree.xmlOutputBufferWrite(buf, 5, "&#13;")
 *             cur += 1
 *             base = cur             # <<<<<<<<<<<<<<
 * 
 *         elif cur[0] == b'\t':
*/
      __pyx_v_base = __pyx_v_cur;

      /* "src/lxml/serializer.pxi":424
 *             base = cur
 * 
 *         elif cur[0] == b'\r':             # <<<<<<<<<<<<<<
 *             if base != cur:
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
*/
      goto __pyx_L6;
    }

    /* "src/lxml/serializer.pxi":432
 *             base = cur
 * 
 *         elif cur[0] == b'\t':             # <<<<<<<<<<<<<<
 *             if base != cur:
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
*/
    __pyx_t_1 = ((__pyx_v_cur[0]) == '\t');
    if (__pyx_t_1) {

      /* "src/lxml/serializer.pxi":433
 * 
 *         elif cur[0] == b'\t':
 *             if base != cur:             # <<<<<<<<<<<<<<
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
 * 
*/
      __pyx_t_1 = (__pyx_v_base != __pyx_v_cur);
      if (__pyx_t_1) {

        /* "src/lxml/serializer.pxi":434
 *         elif cur[0] == b'\t':
 *             if base != cur:
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)             # <<<<<<<<<<<<<<
 * 
 *             tree.xmlOutputBufferWrite(buf, 4, "&#9;")
*/
        (void)(xmlOutputBufferWrite(__pyx_v_buf, (__pyx_v_cur - __pyx_v_base), __pyx_v_base));

        /* "src/lxml/serializer.pxi":433
 * 
 *         elif cur[0] == b'\t':
 *             if base != cur:             # <<<<<<<<<<<<<<
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
 * 
*/
      }

      /* "src/lxml/serializer.pxi":436
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
 * 
 *             tree.xmlOutputBufferWrite(buf, 4, "&#9;")             # <<<<<<<<<<<<<<
 *             cur += 1
 *             base = cur
*/
      (void)(xmlOutputBufferWrite(__pyx_v_buf, 4, __pyx_k_9));

      /* "src/lxml/serializer.pxi":437
 * 
 *             tree.xmlOutputBufferWrite(buf, 4, "&#9;")
 *             cur += 1             # <<<<<<<<<<<<<<
 *             base = cur
 * 
*/
      __pyx_v_cur = (__pyx_v_cur + 1);

      /* "src/lxml/serializer.pxi":438
 *             tree.xmlOutputBufferWrite(buf, 4, "&#9;")
 *             cur += 1
 *             base = cur             # <<<<<<<<<<<<<<
 * 
 *         elif cur[0] == b'"':
*/
      __pyx_v_base = __pyx_v_cur;

      /* "src/lxml/serializer.pxi":432
 *             base = cur
 * 
 *         elif cur[0] == b'\t':             # <<<<<<<<<<<<<<
 *             if base != cur:
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
*/
      goto __pyx_L6;
    }

    /* "src/lxml/serializer.pxi":440
 *             base = cur
 * 
 *         elif cur[0] == b'"':             # <<<<<<<<<<<<<<
 *             if base != cur:
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
*/
    __pyx_t_1 = ((__pyx_v_cur[0]) == '"');
    if (__pyx_t_1) {

      /* "src/lxml/serializer.pxi":441
 * 
 *         elif cur[0] == b'"':
 *             if base != cur:             # <<<<<<<<<<<<<<
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
 * 
*/
      __pyx_t_1 = (__pyx_v_base != __pyx_v_cur);
      if (__pyx_t_1) {

        /* "src/lxml/serializer.pxi":442
 *         elif cur[0] == b'"':
 *             if base != cur:
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)             # <<<<<<<<<<<<<<
 * 
 *             tree.xmlOutputBufferWrite(buf, 6, "&quot;")
*/
        (void)(xmlOutputBufferWrite(__pyx_v_buf, (__pyx_v_cur - __pyx_v_base), __pyx_v_base));

        /* "src/lxml/serializer.pxi":441
 * 
 *         elif cur[0] == b'"':
 *             if base != cur:             # <<<<<<<<<<<<<<
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
 * 
*/
      }

      /* "src/lxml/serializer.pxi":444
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
 * 
 *             tree.xmlOutputBufferWrite(buf, 6, "&quot;")             # <<<<<<<<<<<<<<
 *             cur += 1
 *             base = cur
*/
      (void)(xmlOutputBufferWrite(__pyx_v_buf, 6, __pyx_k_quot));

      /* "src/lxml/serializer.pxi":445
 * 
 *             tree.xmlOutputBufferWrite(buf, 6, "&quot;")
 *             cur += 1             # <<<<<<<<<<<<<<
 *             base = cur
 * 
*/
      __pyx_v_cur = (__pyx_v_cur + 1);

      /* "src/lxml/serializer.pxi":446
 *             tree.xmlOutputBufferWrite(buf, 6, "&quot;")
 *             cur += 1
 *             base = cur             # <<<<<<<<<<<<<<
 * 
 *         elif cur[0] == b'<':
*/
      __pyx_v_base = __pyx_v_cur;

      /* "src/lxml/serializer.pxi":440
 *             base = cur
 * 
 *         elif cur[0] == b'"':             # <<<<<<<<<<<<<<
 *             if base != cur:
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
*/
      goto __pyx_L6;
    }

    /* "src/lxml/serializer.pxi":448
 *             base = cur
 * 
 *         elif cur[0] == b'<':             # <<<<<<<<<<<<<<
 *             if base != cur:
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
*/
    __pyx_t_1 = ((__pyx_v_cur[0]) == '<');
    if (__pyx_t_1) {

      /* "src/lxml/serializer.pxi":449
 * 
 *         elif cur[0] == b'<':
 *             if base != cur:             # <<<<<<<<<<<<<<
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
 * 
*/
      __pyx_t_1 = (__pyx_v_base != __pyx_v_cur);
      if (__pyx_t_1) {

        /* "src/lxml/serializer.pxi":450
 *         elif cur[0] == b'<':
 *             if base != cur:
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)             # <<<<<<<<<<<<<<
 * 
 *             tree.xmlOutputBufferWrite(buf, 4, "&lt;")
*/
        (void)(xmlOutputBufferWrite(__pyx_v_buf, (__pyx_v_cur - __pyx_v_base), __pyx_v_base));

        /* "src/lxml/serializer.pxi":449
 * 
 *         elif cur[0] == b'<':
 *             if base != cur:             # <<<<<<<<<<<<<<
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
 * 
*/
      }

      /* "src/lxml/serializer.pxi":452
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
 * 
 *             tree.xmlOutputBufferWrite(buf, 4, "&lt;")             # <<<<<<<<<<<<<<
 *             cur += 1
 *             base = cur
*/
      (void)(xmlOutputBufferWrite(__pyx_v_buf, 4, __pyx_k_lt));

      /* "src/lxml/serializer.pxi":453
 * 
 *             tree.xmlOutputBufferWrite(buf, 4, "&lt;")
 *             cur += 1             # <<<<<<<<<<<<<<
 *             base = cur
 * 
*/
      __pyx_v_cur = (__pyx_v_cur + 1);

      /* "src/lxml/serializer.pxi":454
 *             tree.xmlOutputBufferWrite(buf, 4, "&lt;")
 *             cur += 1
 *             base = cur             # <<<<<<<<<<<<<<
 * 
 *         elif cur[0] == b'>':
*/
      __pyx_v_base = __pyx_v_cur;

      /* "src/lxml/serializer.pxi":448
 *             base = cur
 * 
 *         elif cur[0] == b'<':             # <<<<<<<<<<<<<<
 *             if base != cur:
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
*/
      goto __pyx_L6;
    }

    /* "src/lxml/serializer.pxi":456
 *             base = cur
 * 
 *         elif cur[0] == b'>':             # <<<<<<<<<<<<<<
 *             if base != cur:
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
*/
    __pyx_t_1 = ((__pyx_v_cur[0]) == '>');
    if (__pyx_t_1) {

      /* "src/lxml/serializer.pxi":457
 * 
 *         elif cur[0] == b'>':
 *             if base != cur:             # <<<<<<<<<<<<<<
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
 * 
*/
      __pyx_t_1 = (__pyx_v_base != __pyx_v_cur);
      if (__pyx_t_1) {

        /* "src/lxml/serializer.pxi":458
 *         elif cur[0] == b'>':
 *             if base != cur:
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)             # <<<<<<<<<<<<<<
 * 
 *             tree.xmlOutputBufferWrite(buf, 4, "&gt;")
*/
        (void)(xmlOutputBufferWrite(__pyx_v_buf, (__pyx_v_cur - __pyx_v_base), __pyx_v_base));

        /* "src/lxml/serializer.pxi":457
 * 
 *         elif cur[0] == b'>':
 *             if base != cur:             # <<<<<<<<<<<<<<
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
 * 
*/
      }

      /* "src/lxml/serializer.pxi":460
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
 * 
 *             tree.xmlOutputBufferWrite(buf, 4, "&gt;")             # <<<<<<<<<<<<<<
 *             cur += 1
 *             base = cur
*/
      (void)(xmlOutputBufferWrite(__pyx_v_buf, 4, __pyx_k_gt));

      /* "src/lxml/serializer.pxi":461
 * 
 *             tree.xmlOutputBufferWrite(buf, 4, "&gt;")
 *             cur += 1             # <<<<<<<<<<<<<<
 *             base = cur
 *         elif cur[0] == b'&':
*/
      __pyx_v_cur = (__pyx_v_cur + 1);

      /* "src/lxml/serializer.pxi":462
 *             tree.xmlOutputBufferWrite(buf, 4, "&gt;")
 *             cur += 1
 *             base = cur             # <<<<<<<<<<<<<<
 *         elif cur[0] == b'&':
 *             if base != cur:
*/
      __pyx_v_base = __pyx_v_cur;

      /* "src/lxml/serializer.pxi":456
 *             base = cur
 * 
 *         elif cur[0] == b'>':             # <<<<<<<<<<<<<<
 *             if base != cur:
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
*/
      goto __pyx_L6;
    }

    /* "src/lxml/serializer.pxi":463
 *             cur += 1
 *             base = cur
 *         elif cur[0] == b'&':             # <<<<<<<<<<<<<<
 *             if base != cur:
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
*/
    __pyx_t_1 = ((__pyx_v_cur[0]) == '&');
    if (__pyx_t_1) {

      /* "src/lxml/serializer.pxi":464
 *             base = cur
 *         elif cur[0] == b'&':
 *             if base != cur:             # <<<<<<<<<<<<<<
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
 * 
*/
      __pyx_t_1 = (__pyx_v_base != __pyx_v_cur);
      if (__pyx_t_1) {

        /* "src/lxml/serializer.pxi":465
 *         elif cur[0] == b'&':
 *             if base != cur:
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)             # <<<<<<<<<<<<<<
 * 
 *             tree.xmlOutputBufferWrite(buf, 5, "&amp;")
*/
        (void)(xmlOutputBufferWrite(__pyx_v_buf, (__pyx_v_cur - __pyx_v_base), __pyx_v_base));

        /* "src/lxml/serializer.pxi":464
 *             base = cur
 *         elif cur[0] == b'&':
 *             if base != cur:             # <<<<<<<<<<<<<<
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
 * 
*/
      }

      /* "src/lxml/serializer.pxi":467
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
 * 
 *             tree.xmlOutputBufferWrite(buf, 5, "&amp;")             # <<<<<<<<<<<<<<
 *             cur += 1
 *             base = cur
*/
      (void)(xmlOutputBufferWrite(__pyx_v_buf, 5, __pyx_k_amp));

      /* "src/lxml/serializer.pxi":468
 * 
 *             tree.xmlOutputBufferWrite(buf, 5, "&amp;")
 *             cur += 1             # <<<<<<<<<<<<<<
 *             base = cur
 * 
*/
      __pyx_v_cur = (__pyx_v_cur + 1);

      /* "src/lxml/serializer.pxi":469
 *             tree.xmlOutputBufferWrite(buf, 5, "&amp;")
 *             cur += 1
 *             base = cur             # <<<<<<<<<<<<<<
 * 
 *         else:
*/
      __pyx_v_base = __pyx_v_cur;

      /* "src/lxml/serializer.pxi":463
 *             cur += 1
 *             base = cur
 *         elif cur[0] == b'&':             # <<<<<<<<<<<<<<
 *             if base != cur:
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
*/
      goto __pyx_L6;
    }

    /* "src/lxml/serializer.pxi":473
 *         else:
 *             # Leave further encoding and escaping to the buffer encoder.
 *             cur += 1             # <<<<<<<<<<<<<<
 * 
 *     if base != cur:
*/
    /*else*/ {
      __pyx_v_cur = (__pyx_v_cur + 1);
    }
    __pyx_L6:;
  }

  /* "src/lxml/serializer.pxi":475
 *             cur += 1
 * 
 *     if base != cur:             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferWrite(buf, cur - base, base)
 * 
*/
  __pyx_t_1 = (__pyx_v_base != __pyx_v_cur);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":476
 * 
 *     if base != cur:
 *         tree.xmlOutputBufferWrite(buf, cur - base, base)             # <<<<<<<<<<<<<<
 * 
 * 
*/
    (void)(xmlOutputBufferWrite(__pyx_v_buf, (__pyx_v_cur - __pyx_v_base), __pyx_v_base));

    /* "src/lxml/serializer.pxi":475
 *             cur += 1
 * 
 *     if base != cur:             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferWrite(buf, cur - base, base)
 * 
*/
  }

  /* "src/lxml/serializer.pxi":407
 * 
 * # copied and adapted from libxml2 (xmlBufAttrSerializeTxtContent())
 * cdef _write_attr_string(tree.xmlOutputBuffer* buf, const char *string):             # <<<<<<<<<<<<<<
 *     cdef const char *base
 *     cdef const char *cur
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":479
 * 
 * 
 * cdef void _write_cdata_section(tree.xmlOutputBuffer* buf, const char* c_data, const char* c_end):             # <<<<<<<<<<<<<<
 *     tree.xmlOutputBufferWrite(buf, 9, "<![CDATA[")
 *     while c_end - c_data > limits.INT_MAX:
*/

static void __pyx_f_4lxml_5etree__write_cdata_section(xmlOutputBuffer *__pyx_v_buf, char const *__pyx_v_c_data, char const *__pyx_v_c_end) {
  int __pyx_t_1;

  /* "src/lxml/serializer.pxi":480
 * 
 * cdef void _write_cdata_section(tree.xmlOutputBuffer* buf, const char* c_data, const char* c_end):
 *     tree.xmlOutputBufferWrite(buf, 9, "<![CDATA[")             # <<<<<<<<<<<<<<
 *     while c_end - c_data > limits.INT_MAX:
 *         tree.xmlOutputBufferWrite(buf, limits.INT_MAX, c_data)
*/
  (void)(xmlOutputBufferWrite(__pyx_v_buf, 9, __pyx_k_CDATA));

  /* "src/lxml/serializer.pxi":481
 * cdef void _write_cdata_section(tree.xmlOutputBuffer* buf, const char* c_data, const char* c_end):
 *     tree.xmlOutputBufferWrite(buf, 9, "<![CDATA[")
 *     while c_end - c_data > limits.INT_MAX:             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferWrite(buf, limits.INT_MAX, c_data)
 *         c_data += limits.INT_MAX
*/
  while (1) {
    __pyx_t_1 = ((__pyx_v_c_end - __pyx_v_c_data) > INT_MAX);
    if (!__pyx_t_1) break;

    /* "src/lxml/serializer.pxi":482
 *     tree.xmlOutputBufferWrite(buf, 9, "<![CDATA[")
 *     while c_end - c_data > limits.INT_MAX:
 *         tree.xmlOutputBufferWrite(buf, limits.INT_MAX, c_data)             # <<<<<<<<<<<<<<
 *         c_data += limits.INT_MAX
 *     tree.xmlOutputBufferWrite(buf, c_end - c_data, c_data)
*/
    (void)(xmlOutputBufferWrite(__pyx_v_buf, INT_MAX, __pyx_v_c_data));

    /* "src/lxml/serializer.pxi":483
 *     while c_end - c_data > limits.INT_MAX:
 *         tree.xmlOutputBufferWrite(buf, limits.INT_MAX, c_data)
 *         c_data += limits.INT_MAX             # <<<<<<<<<<<<<<
 *     tree.xmlOutputBufferWrite(buf, c_end - c_data, c_data)
 *     tree.xmlOutputBufferWrite(buf, 3, "]]>")
*/
    __pyx_v_c_data = (__pyx_v_c_data + INT_MAX);
  }

  /* "src/lxml/serializer.pxi":484
 *         tree.xmlOutputBufferWrite(buf, limits.INT_MAX, c_data)
 *         c_data += limits.INT_MAX
 *     tree.xmlOutputBufferWrite(buf, c_end - c_data, c_data)             # <<<<<<<<<<<<<<
 *     tree.xmlOutputBufferWrite(buf, 3, "]]>")
 * 
*/
  (void)(xmlOutputBufferWrite(__pyx_v_buf, (__pyx_v_c_end - __pyx_v_c_data), __pyx_v_c_data));

  /* "src/lxml/serializer.pxi":485
 *         c_data += limits.INT_MAX
 *     tree.xmlOutputBufferWrite(buf, c_end - c_data, c_data)
 *     tree.xmlOutputBufferWrite(buf, 3, "]]>")             # <<<<<<<<<<<<<<
 * 
 * 
*/
  (void)(xmlOutputBufferWrite(__pyx_v_buf, 3, __pyx_k__35));

  /* "src/lxml/serializer.pxi":479
 * 
 * 
 * cdef void _write_cdata_section(tree.xmlOutputBuffer* buf, const char* c_data, const char* c_end):             # <<<<<<<<<<<<<<
 *     tree.xmlOutputBufferWrite(buf, 9, "<![CDATA[")
 *     while c_end - c_data > limits.INT_MAX:
*/

  /* function exit code */
}

/* "src/lxml/serializer.pxi":488
 * 
 * 
 * cdef _write_cdata_string(tree.xmlOutputBuffer* buf, bytes bstring):             # <<<<<<<<<<<<<<
 *     cdef const char* c_data = bstring
 *     cdef const char* c_end = c_data + len(bstring)
*/

static PyObject *__pyx_f_4lxml_5etree__write_cdata_string(xmlOutputBuffer *__pyx_v_buf, PyObject *__pyx_v_bstring) {
  char const *__pyx_v_c_data;
  char const *__pyx_v_c_end;
  char const *__pyx_v_c_pos;
  int __pyx_v_nothing_written;
  char __pyx_v_next_char;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  char const *__pyx_t_1;
  Py_ssize_t __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_write_cdata_string", 0);

  /* "src/lxml/serializer.pxi":489
 * 
 * cdef _write_cdata_string(tree.xmlOutputBuffer* buf, bytes bstring):
 *     cdef const char* c_data = bstring             # <<<<<<<<<<<<<<
 *     cdef const char* c_end = c_data + len(bstring)
 *     cdef const char* c_pos = c_data
*/
  if (unlikely(__pyx_v_bstring == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(6, 489, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyBytes_AsString(__pyx_v_bstring); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(6, 489, __pyx_L1_error)
  __pyx_v_c_data = __pyx_t_1;

  /* "src/lxml/serializer.pxi":490
 * cdef _write_cdata_string(tree.xmlOutputBuffer* buf, bytes bstring):
 *     cdef const char* c_data = bstring
 *     cdef const char* c_end = c_data + len(bstring)             # <<<<<<<<<<<<<<
 *     cdef const char* c_pos = c_data
 *     cdef bint nothing_written = True
*/
  if (unlikely(__pyx_v_bstring == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(6, 490, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyBytes_GET_SIZE(__pyx_v_bstring); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(6, 490, __pyx_L1_error)
  __pyx_v_c_end = (__pyx_v_c_data + __pyx_t_2);

  /* "src/lxml/serializer.pxi":491
 *     cdef const char* c_data = bstring
 *     cdef const char* c_end = c_data + len(bstring)
 *     cdef const char* c_pos = c_data             # <<<<<<<<<<<<<<
 *     cdef bint nothing_written = True
 * 
*/
  __pyx_v_c_pos = __pyx_v_c_data;

  /* "src/lxml/serializer.pxi":492
 *     cdef const char* c_end = c_data + len(bstring)
 *     cdef const char* c_pos = c_data
 *     cdef bint nothing_written = True             # <<<<<<<<<<<<<<
 * 
 *     while True:
*/
  __pyx_v_nothing_written = 1;

  /* "src/lxml/serializer.pxi":494
 *     cdef bint nothing_written = True
 * 
 *     while True:             # <<<<<<<<<<<<<<
 *         c_pos = <const char*> cstring_h.memchr(c_pos, b']', c_end - c_pos)
 *         if not c_pos:
*/
  while (1) {

    /* "src/lxml/serializer.pxi":495
 * 
 *     while True:
 *         c_pos = <const char*> cstring_h.memchr(c_pos, b']', c_end - c_pos)             # <<<<<<<<<<<<<<
 *         if not c_pos:
 *             break
*/
    __pyx_v_c_pos = ((char const *)memchr(__pyx_v_c_pos, ']', (__pyx_v_c_end - __pyx_v_c_pos)));

    /* "src/lxml/serializer.pxi":496
 *     while True:
 *         c_pos = <const char*> cstring_h.memchr(c_pos, b']', c_end - c_pos)
 *         if not c_pos:             # <<<<<<<<<<<<<<
 *             break
 *         c_pos += 1
*/
    __pyx_t_3 = (!(__pyx_v_c_pos != 0));
    if (__pyx_t_3) {

      /* "src/lxml/serializer.pxi":497
 *         c_pos = <const char*> cstring_h.memchr(c_pos, b']', c_end - c_pos)
 *         if not c_pos:
 *             break             # <<<<<<<<<<<<<<
 *         c_pos += 1
 *         next_char = c_pos[0]
*/
      goto __pyx_L4_break;

      /* "src/lxml/serializer.pxi":496
 *     while True:
 *         c_pos = <const char*> cstring_h.memchr(c_pos, b']', c_end - c_pos)
 *         if not c_pos:             # <<<<<<<<<<<<<<
 *             break
 *         c_pos += 1
*/
    }

    /* "src/lxml/serializer.pxi":498
 *         if not c_pos:
 *             break
 *         c_pos += 1             # <<<<<<<<<<<<<<
 *         next_char = c_pos[0]
 *         c_pos += 1
*/
    __pyx_v_c_pos = (__pyx_v_c_pos + 1);

    /* "src/lxml/serializer.pxi":499
 *             break
 *         c_pos += 1
 *         next_char = c_pos[0]             # <<<<<<<<<<<<<<
 *         c_pos += 1
 *         if next_char != b']':
*/
    __pyx_v_next_char = (__pyx_v_c_pos[0]);

    /* "src/lxml/serializer.pxi":500
 *         c_pos += 1
 *         next_char = c_pos[0]
 *         c_pos += 1             # <<<<<<<<<<<<<<
 *         if next_char != b']':
 *             continue
*/
    __pyx_v_c_pos = (__pyx_v_c_pos + 1);

    /* "src/lxml/serializer.pxi":501
 *         next_char = c_pos[0]
 *         c_pos += 1
 *         if next_char != b']':             # <<<<<<<<<<<<<<
 *             continue
 *         # Found ']]', c_pos points to next character.
*/
    __pyx_t_3 = (__pyx_v_next_char != ']');
    if (__pyx_t_3) {

      /* "src/lxml/serializer.pxi":502
 *         c_pos += 1
 *         if next_char != b']':
 *             continue             # <<<<<<<<<<<<<<
 *         # Found ']]', c_pos points to next character.
 *         while c_pos[0] == b']':
*/
      goto __pyx_L3_continue;

      /* "src/lxml/serializer.pxi":501
 *         next_char = c_pos[0]
 *         c_pos += 1
 *         if next_char != b']':             # <<<<<<<<<<<<<<
 *             continue
 *         # Found ']]', c_pos points to next character.
*/
    }

    /* "src/lxml/serializer.pxi":504
 *             continue
 *         # Found ']]', c_pos points to next character.
 *         while c_pos[0] == b']':             # <<<<<<<<<<<<<<
 *             c_pos += 1
 *         if c_pos[0] != b'>':
*/
    while (1) {
      __pyx_t_3 = ((__pyx_v_c_pos[0]) == ']');
      if (!__pyx_t_3) break;

      /* "src/lxml/serializer.pxi":505
 *         # Found ']]', c_pos points to next character.
 *         while c_pos[0] == b']':
 *             c_pos += 1             # <<<<<<<<<<<<<<
 *         if c_pos[0] != b'>':
 *             if c_pos == c_end:
*/
      __pyx_v_c_pos = (__pyx_v_c_pos + 1);
    }

    /* "src/lxml/serializer.pxi":506
 *         while c_pos[0] == b']':
 *             c_pos += 1
 *         if c_pos[0] != b'>':             # <<<<<<<<<<<<<<
 *             if c_pos == c_end:
 *                 break
*/
    __pyx_t_3 = ((__pyx_v_c_pos[0]) != '>');
    if (__pyx_t_3) {

      /* "src/lxml/serializer.pxi":507
 *             c_pos += 1
 *         if c_pos[0] != b'>':
 *             if c_pos == c_end:             # <<<<<<<<<<<<<<
 *                 break
 *             # c_pos[0] is neither ']' nor '>', continue with next character.
*/
      __pyx_t_3 = (__pyx_v_c_pos == __pyx_v_c_end);
      if (__pyx_t_3) {

        /* "src/lxml/serializer.pxi":508
 *         if c_pos[0] != b'>':
 *             if c_pos == c_end:
 *                 break             # <<<<<<<<<<<<<<
 *             # c_pos[0] is neither ']' nor '>', continue with next character.
 *             c_pos += 1
*/
        goto __pyx_L4_break;

        /* "src/lxml/serializer.pxi":507
 *             c_pos += 1
 *         if c_pos[0] != b'>':
 *             if c_pos == c_end:             # <<<<<<<<<<<<<<
 *                 break
 *             # c_pos[0] is neither ']' nor '>', continue with next character.
*/
      }

      /* "src/lxml/serializer.pxi":510
 *                 break
 *             # c_pos[0] is neither ']' nor '>', continue with next character.
 *             c_pos += 1             # <<<<<<<<<<<<<<
 *             continue
 * 
*/
      __pyx_v_c_pos = (__pyx_v_c_pos + 1);

      /* "src/lxml/serializer.pxi":511
 *             # c_pos[0] is neither ']' nor '>', continue with next character.
 *             c_pos += 1
 *             continue             # <<<<<<<<<<<<<<
 * 
 *         # Write section up to ']]' and start next block at trailing '>'.
*/
      goto __pyx_L3_continue;

      /* "src/lxml/serializer.pxi":506
 *         while c_pos[0] == b']':
 *             c_pos += 1
 *         if c_pos[0] != b'>':             # <<<<<<<<<<<<<<
 *             if c_pos == c_end:
 *                 break
*/
    }

    /* "src/lxml/serializer.pxi":514
 * 
 *         # Write section up to ']]' and start next block at trailing '>'.
 *         _write_cdata_section(buf, c_data, c_pos)             # <<<<<<<<<<<<<<
 *         nothing_written = False
 *         c_data = c_pos
*/
    __pyx_f_4lxml_5etree__write_cdata_section(__pyx_v_buf, __pyx_v_c_data, __pyx_v_c_pos); if (unlikely(PyErr_Occurred())) __PYX_ERR(6, 514, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":515
 *         # Write section up to ']]' and start next block at trailing '>'.
 *         _write_cdata_section(buf, c_data, c_pos)
 *         nothing_written = False             # <<<<<<<<<<<<<<
 *         c_data = c_pos
 *         c_pos += 1
*/
    __pyx_v_nothing_written = 0;

    /* "src/lxml/serializer.pxi":516
 *         _write_cdata_section(buf, c_data, c_pos)
 *         nothing_written = False
 *         c_data = c_pos             # <<<<<<<<<<<<<<
 *         c_pos += 1
 * 
*/
    __pyx_v_c_data = __pyx_v_c_pos;

    /* "src/lxml/serializer.pxi":517
 *         nothing_written = False
 *         c_data = c_pos
 *         c_pos += 1             # <<<<<<<<<<<<<<
 * 
 *     if nothing_written or c_data < c_end:
*/
    __pyx_v_c_pos = (__pyx_v_c_pos + 1);
    __pyx_L3_continue:;
  }
  __pyx_L4_break:;

  /* "src/lxml/serializer.pxi":519
 *         c_pos += 1
 * 
 *     if nothing_written or c_data < c_end:             # <<<<<<<<<<<<<<
 *         _write_cdata_section(buf, c_data, c_end)
 * 
*/
  if (!__pyx_v_nothing_written) {
  } else {
    __pyx_t_3 = __pyx_v_nothing_written;
    goto __pyx_L12_bool_binop_done;
  }
  __pyx_t_4 = (__pyx_v_c_data < __pyx_v_c_end);
  __pyx_t_3 = __pyx_t_4;
  __pyx_L12_bool_binop_done:;
  if (__pyx_t_3) {

    /* "src/lxml/serializer.pxi":520
 * 
 *     if nothing_written or c_data < c_end:
 *         _write_cdata_section(buf, c_data, c_end)             # <<<<<<<<<<<<<<
 * 
 * 
*/
    __pyx_f_4lxml_5etree__write_cdata_section(__pyx_v_buf, __pyx_v_c_data, __pyx_v_c_end); if (unlikely(PyErr_Occurred())) __PYX_ERR(6, 520, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":519
 *         c_pos += 1
 * 
 *     if nothing_written or c_data < c_end:             # <<<<<<<<<<<<<<
 *         _write_cdata_section(buf, c_data, c_end)
 * 
*/
  }

  /* "src/lxml/serializer.pxi":488
 * 
 * 
 * cdef _write_cdata_string(tree.xmlOutputBuffer* buf, bytes bstring):             # <<<<<<<<<<<<<<
 *     cdef const char* c_data = bstring
 *     cdef const char* c_end = c_data + len(bstring)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._write_cdata_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_4lxml_5etree_50generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "src/lxml/serializer.pxi":541
 * cdef object _open_utf8_file
 * 
 * @contextmanager             # <<<<<<<<<<<<<<
 * def _open_utf8_file(file, compression=0):
 *     file = _getFSPathOrObject(file)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_49_open_utf8_file(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_49_open_utf8_file = {"_open_utf8_file", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_49_open_utf8_file, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_49_open_utf8_file(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_file = 0;
  PyObject *__pyx_v_compression = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_open_utf8_file (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_file,&__pyx_mstate_global->__pyx_n_u_compression,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(6, 541, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(6, 541, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 541, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_open_utf8_file", 0) < (0)) __PYX_ERR(6, 541, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_int_0)));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_open_utf8_file", 0, 1, 2, i); __PYX_ERR(6, 541, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(6, 541, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 541, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_int_0)));
    }
    __pyx_v_file = values[0];
    __pyx_v_compression = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_open_utf8_file", 0, 1, 2, __pyx_nargs); __PYX_ERR(6, 541, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._open_utf8_file", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_48_open_utf8_file(__pyx_self, __pyx_v_file, __pyx_v_compression);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_48_open_utf8_file(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_file, PyObject *__pyx_v_compression) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct___open_utf8_file *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_open_utf8_file", 0);
  __pyx_cur_scope = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct___open_utf8_file *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct___open_utf8_file(__pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct___open_utf8_file, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct___open_utf8_file *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(6, 541, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_file = __pyx_v_file;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_file);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_file);
  __pyx_cur_scope->__pyx_v_compression = __pyx_v_compression;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_compression);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_compression);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4lxml_5etree_50generator, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[0]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_open_utf8_file, __pyx_mstate_global->__pyx_n_u_open_utf8_file, __pyx_mstate_global->__pyx_n_u_lxml_etree); if (unlikely(!gen)) __PYX_ERR(6, 541, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._open_utf8_file", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_4lxml_5etree_50generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct___open_utf8_file *__pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct___open_utf8_file *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_open_utf8_file", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L16_resume_from_yield;
    case 2: goto __pyx_L31_resume_from_yield;
    case 3: goto __pyx_L47_resume_from_yield;
    case 4: goto __pyx_L52_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(__pyx_sent_value != Py_None)) {
    if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator");
    __PYX_ERR(6, 541, __pyx_L1_error)
  }

  /* "src/lxml/serializer.pxi":543
 * @contextmanager
 * def _open_utf8_file(file, compression=0):
 *     file = _getFSPathOrObject(file)             # <<<<<<<<<<<<<<
 *     if _isString(file):
 *         if compression:
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__getFSPathOrObject(__pyx_cur_scope->__pyx_v_file); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 543, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_file);
  __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_file, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/serializer.pxi":544
 * def _open_utf8_file(file, compression=0):
 *     file = _getFSPathOrObject(file)
 *     if _isString(file):             # <<<<<<<<<<<<<<
 *         if compression:
 *             with gzip.GzipFile(file, mode='wb', compresslevel=compression) as zf:
*/
  __pyx_t_2 = _isString(__pyx_cur_scope->__pyx_v_file);
  if (__pyx_t_2) {

    /* "src/lxml/serializer.pxi":545
 *     file = _getFSPathOrObject(file)
 *     if _isString(file):
 *         if compression:             # <<<<<<<<<<<<<<
 *             with gzip.GzipFile(file, mode='wb', compresslevel=compression) as zf:
 *                 yield utf8_writer(zf)
*/
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_compression); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(6, 545, __pyx_L1_error)
    if (__pyx_t_2) {

      /* "src/lxml/serializer.pxi":546
 *     if _isString(file):
 *         if compression:
 *             with gzip.GzipFile(file, mode='wb', compresslevel=compression) as zf:             # <<<<<<<<<<<<<<
 *                 yield utf8_writer(zf)
 *         else:
*/
      /*with:*/ {
        __pyx_t_3 = __pyx_v_4lxml_5etree_gzip;
        __Pyx_INCREF(__pyx_t_3);
        __pyx_t_4 = 0;
        {
          PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_3, __pyx_cur_scope->__pyx_v_file};
          __pyx_t_5 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 546, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_mode, __pyx_mstate_global->__pyx_n_u_wb, __pyx_t_5, __pyx_callargs+2, 0) < (0)) __PYX_ERR(6, 546, __pyx_L1_error)
          if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_compresslevel, __pyx_cur_scope->__pyx_v_compression, __pyx_t_5, __pyx_callargs+2, 1) < (0)) __PYX_ERR(6, 546, __pyx_L1_error)
          __pyx_t_1 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_GzipFile, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_5);
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 546, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
        }
        __pyx_t_6 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 546, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_3 = NULL;
        __pyx_t_7 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_enter); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 546, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_4 = 1;
        #if CYTHON_UNPACK_METHODS
        if (likely(PyMethod_Check(__pyx_t_7))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7);
          assert(__pyx_t_3);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
          __pyx_t_4 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
          __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 546, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_5);
        }
        __pyx_t_7 = __pyx_t_5;
        __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        /*try:*/ {
          {
            __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
            __Pyx_XGOTREF(__pyx_t_8);
            __Pyx_XGOTREF(__pyx_t_9);
            __Pyx_XGOTREF(__pyx_t_10);
            /*try:*/ {
              __Pyx_GIVEREF(__pyx_t_7);
              __pyx_cur_scope->__pyx_v_zf = __pyx_t_7;
              __pyx_t_7 = 0;

              /* "src/lxml/serializer.pxi":547
 *         if compression:
 *             with gzip.GzipFile(file, mode='wb', compresslevel=compression) as zf:
 *                 yield utf8_writer(zf)             # <<<<<<<<<<<<<<
 *         else:
 *             with io_open(file, 'w', encoding='utf8') as f:
*/
              __pyx_t_1 = NULL;
              __Pyx_INCREF(__pyx_v_4lxml_5etree_utf8_writer);
              __pyx_t_5 = __pyx_v_4lxml_5etree_utf8_writer; 
              __pyx_t_4 = 1;
              #if CYTHON_UNPACK_METHODS
              if (unlikely(PyMethod_Check(__pyx_t_5))) {
                __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5);
                assert(__pyx_t_1);
                PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
                __Pyx_INCREF(__pyx_t_1);
                __Pyx_INCREF(__pyx__function);
                __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
                __pyx_t_4 = 0;
              }
              #endif
              {
                PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_cur_scope->__pyx_v_zf};
                __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
                __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
                __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
                if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 547, __pyx_L10_error)
                __Pyx_GOTREF(__pyx_t_7);
              }
              __pyx_r = __pyx_t_7;
              __pyx_t_7 = 0;
              __Pyx_XGIVEREF(__pyx_t_6);
              __pyx_cur_scope->__pyx_t_0 = __pyx_t_6;
              __Pyx_XGIVEREF(__pyx_t_8);
              __pyx_cur_scope->__pyx_t_1 = __pyx_t_8;
              __Pyx_XGIVEREF(__pyx_t_9);
              __pyx_cur_scope->__pyx_t_2 = __pyx_t_9;
              __Pyx_XGIVEREF(__pyx_t_10);
              __pyx_cur_scope->__pyx_t_3 = __pyx_t_10;
              __Pyx_XGIVEREF(__pyx_r);
              __Pyx_RefNannyFinishContext();
              __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
              /* return from generator, yielding value */
              __pyx_generator->resume_label = 1;
              return __pyx_r;
              __pyx_L16_resume_from_yield:;
              __pyx_t_6 = __pyx_cur_scope->__pyx_t_0;
              __pyx_cur_scope->__pyx_t_0 = 0;
              __Pyx_XGOTREF(__pyx_t_6);
              __pyx_t_8 = __pyx_cur_scope->__pyx_t_1;
              __pyx_cur_scope->__pyx_t_1 = 0;
              __Pyx_XGOTREF(__pyx_t_8);
              __pyx_t_9 = __pyx_cur_scope->__pyx_t_2;
              __pyx_cur_scope->__pyx_t_2 = 0;
              __Pyx_XGOTREF(__pyx_t_9);
              __pyx_t_10 = __pyx_cur_scope->__pyx_t_3;
              __pyx_cur_scope->__pyx_t_3 = 0;
              __Pyx_XGOTREF(__pyx_t_10);
              if (unlikely(!__pyx_sent_value)) __PYX_ERR(6, 547, __pyx_L10_error)

              /* "src/lxml/serializer.pxi":546
 *     if _isString(file):
 *         if compression:
 *             with gzip.GzipFile(file, mode='wb', compresslevel=compression) as zf:             # <<<<<<<<<<<<<<
 *                 yield utf8_writer(zf)
 *         else:
*/
            }
            __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
            __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
            __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
            goto __pyx_L15_try_end;
            __pyx_L10_error:;
            __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
            __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
            /*except:*/ {
              __Pyx_AddTraceback("lxml.etree._open_utf8_file", __pyx_clineno, __pyx_lineno, __pyx_filename);
              if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(6, 546, __pyx_L12_except_error)
              __Pyx_XGOTREF(__pyx_t_7);
              __Pyx_XGOTREF(__pyx_t_5);
              __Pyx_XGOTREF(__pyx_t_1);
              __pyx_t_3 = PyTuple_Pack(3, __pyx_t_7, __pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 546, __pyx_L12_except_error)
              __Pyx_GOTREF(__pyx_t_3);
              __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_3, NULL);
              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
              if (unlikely(!__pyx_t_11)) __PYX_ERR(6, 546, __pyx_L12_except_error)
              __Pyx_GOTREF(__pyx_t_11);
              __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_11);
              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
              if (__pyx_t_2 < (0)) __PYX_ERR(6, 546, __pyx_L12_except_error)
              __pyx_t_12 = (!__pyx_t_2);
              if (unlikely(__pyx_t_12)) {
                __Pyx_GIVEREF(__pyx_t_7);
                __Pyx_GIVEREF(__pyx_t_5);
                __Pyx_XGIVEREF(__pyx_t_1);
                __Pyx_ErrRestoreWithState(__pyx_t_7, __pyx_t_5, __pyx_t_1);
                __pyx_t_7 = 0;  __pyx_t_5 = 0;  __pyx_t_1 = 0; 
                __PYX_ERR(6, 546, __pyx_L12_except_error)
              }
              __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
              __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
              __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
              goto __pyx_L11_exception_handled;
            }
            __pyx_L12_except_error:;
            __Pyx_XGIVEREF(__pyx_t_8);
            __Pyx_XGIVEREF(__pyx_t_9);
            __Pyx_XGIVEREF(__pyx_t_10);
            __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
            goto __pyx_L1_error;
            __pyx_L11_exception_handled:;
            __Pyx_XGIVEREF(__pyx_t_8);
            __Pyx_XGIVEREF(__pyx_t_9);
            __Pyx_XGIVEREF(__pyx_t_10);
            __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
            __pyx_L15_try_end:;
          }
        }
        /*finally:*/ {
          /*normal exit:*/{
            if (__pyx_t_6) {
              __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_mstate_global->__pyx_tuple[3], NULL);
              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
              if (unlikely(!__pyx_t_10)) __PYX_ERR(6, 546, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_10);
              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
            }
            goto __pyx_L9;
          }
          __pyx_L9:;
        }
        goto __pyx_L20;
        __pyx_L6_error:;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        goto __pyx_L1_error;
        __pyx_L20:;
      }

      /* "src/lxml/serializer.pxi":545
 *     file = _getFSPathOrObject(file)
 *     if _isString(file):
 *         if compression:             # <<<<<<<<<<<<<<
 *             with gzip.GzipFile(file, mode='wb', compresslevel=compression) as zf:
 *                 yield utf8_writer(zf)
*/
      goto __pyx_L5;
    }

    /* "src/lxml/serializer.pxi":549
 *                 yield utf8_writer(zf)
 *         else:
 *             with io_open(file, 'w', encoding='utf8') as f:             # <<<<<<<<<<<<<<
 *                 yield f
 *     else:
*/
    /*else*/ {
      /*with:*/ {
        __pyx_t_5 = NULL;
        __Pyx_INCREF(__pyx_v_4lxml_5etree_io_open);
        __pyx_t_7 = __pyx_v_4lxml_5etree_io_open; 
        __pyx_t_4 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_7))) {
          __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7);
          assert(__pyx_t_5);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
          __pyx_t_4 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[3 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_5, __pyx_cur_scope->__pyx_v_file, __pyx_mstate_global->__pyx_n_u_w};
          __pyx_t_3 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 549, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_encoding, __pyx_mstate_global->__pyx_n_u_utf8, __pyx_t_3, __pyx_callargs+3, 0) < (0)) __PYX_ERR(6, 549, __pyx_L1_error)
          __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_3);
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 549, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
        }
        __pyx_t_6 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 549, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_3 = NULL;
        __pyx_t_5 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_enter); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 549, __pyx_L21_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_4 = 1;
        #if CYTHON_UNPACK_METHODS
        if (likely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
          assert(__pyx_t_3);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
          __pyx_t_4 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
          __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 549, __pyx_L21_error)
          __Pyx_GOTREF(__pyx_t_7);
        }
        __pyx_t_5 = __pyx_t_7;
        __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        /*try:*/ {
          {
            __Pyx_ExceptionSave(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
            __Pyx_XGOTREF(__pyx_t_10);
            __Pyx_XGOTREF(__pyx_t_9);
            __Pyx_XGOTREF(__pyx_t_8);
            /*try:*/ {
              __Pyx_GIVEREF(__pyx_t_5);
              __pyx_cur_scope->__pyx_v_f = __pyx_t_5;
              __pyx_t_5 = 0;

              /* "src/lxml/serializer.pxi":550
 *         else:
 *             with io_open(file, 'w', encoding='utf8') as f:
 *                 yield f             # <<<<<<<<<<<<<<
 *     else:
 *         if compression:
*/
              __Pyx_INCREF(__pyx_cur_scope->__pyx_v_f);
              __pyx_r = __pyx_cur_scope->__pyx_v_f;
              __Pyx_XGIVEREF(__pyx_t_6);
              __pyx_cur_scope->__pyx_t_0 = __pyx_t_6;
              __Pyx_XGIVEREF(__pyx_t_8);
              __pyx_cur_scope->__pyx_t_1 = __pyx_t_8;
              __Pyx_XGIVEREF(__pyx_t_9);
              __pyx_cur_scope->__pyx_t_2 = __pyx_t_9;
              __Pyx_XGIVEREF(__pyx_t_10);
              __pyx_cur_scope->__pyx_t_3 = __pyx_t_10;
              __Pyx_XGIVEREF(__pyx_r);
              __Pyx_RefNannyFinishContext();
              __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
              /* return from generator, yielding value */
              __pyx_generator->resume_label = 2;
              return __pyx_r;
              __pyx_L31_resume_from_yield:;
              __pyx_t_6 = __pyx_cur_scope->__pyx_t_0;
              __pyx_cur_scope->__pyx_t_0 = 0;
              __Pyx_XGOTREF(__pyx_t_6);
              __pyx_t_8 = __pyx_cur_scope->__pyx_t_1;
              __pyx_cur_scope->__pyx_t_1 = 0;
              __Pyx_XGOTREF(__pyx_t_8);
              __pyx_t_9 = __pyx_cur_scope->__pyx_t_2;
              __pyx_cur_scope->__pyx_t_2 = 0;
              __Pyx_XGOTREF(__pyx_t_9);
              __pyx_t_10 = __pyx_cur_scope->__pyx_t_3;
              __pyx_cur_scope->__pyx_t_3 = 0;
              __Pyx_XGOTREF(__pyx_t_10);
              if (unlikely(!__pyx_sent_value)) __PYX_ERR(6, 550, __pyx_L25_error)

              /* "src/lxml/serializer.pxi":549
 *                 yield utf8_writer(zf)
 *         else:
 *             with io_open(file, 'w', encoding='utf8') as f:             # <<<<<<<<<<<<<<
 *                 yield f
 *     else:
*/
            }
            __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
            __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
            __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
            goto __pyx_L30_try_end;
            __pyx_L25_error:;
            __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
            __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
            /*except:*/ {
              __Pyx_AddTraceback("lxml.etree._open_utf8_file", __pyx_clineno, __pyx_lineno, __pyx_filename);
              if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_1, &__pyx_t_7) < 0) __PYX_ERR(6, 549, __pyx_L27_except_error)
              __Pyx_XGOTREF(__pyx_t_5);
              __Pyx_XGOTREF(__pyx_t_1);
              __Pyx_XGOTREF(__pyx_t_7);
              __pyx_t_3 = PyTuple_Pack(3, __pyx_t_5, __pyx_t_1, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 549, __pyx_L27_except_error)
              __Pyx_GOTREF(__pyx_t_3);
              __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_3, NULL);
              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
              if (unlikely(!__pyx_t_11)) __PYX_ERR(6, 549, __pyx_L27_except_error)
              __Pyx_GOTREF(__pyx_t_11);
              __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_11);
              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
              if (__pyx_t_12 < (0)) __PYX_ERR(6, 549, __pyx_L27_except_error)
              __pyx_t_2 = (!__pyx_t_12);
              if (unlikely(__pyx_t_2)) {
                __Pyx_GIVEREF(__pyx_t_5);
                __Pyx_GIVEREF(__pyx_t_1);
                __Pyx_XGIVEREF(__pyx_t_7);
                __Pyx_ErrRestoreWithState(__pyx_t_5, __pyx_t_1, __pyx_t_7);
                __pyx_t_5 = 0;  __pyx_t_1 = 0;  __pyx_t_7 = 0; 
                __PYX_ERR(6, 549, __pyx_L27_except_error)
              }
              __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
              __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
              __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
              goto __pyx_L26_exception_handled;
            }
            __pyx_L27_except_error:;
            __Pyx_XGIVEREF(__pyx_t_10);
            __Pyx_XGIVEREF(__pyx_t_9);
            __Pyx_XGIVEREF(__pyx_t_8);
            __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_9, __pyx_t_8);
            goto __pyx_L1_error;
            __pyx_L26_exception_handled:;
            __Pyx_XGIVEREF(__pyx_t_10);
            __Pyx_XGIVEREF(__pyx_t_9);
            __Pyx_XGIVEREF(__pyx_t_8);
            __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_9, __pyx_t_8);
            __pyx_L30_try_end:;
          }
        }
        /*finally:*/ {
          /*normal exit:*/{
            if (__pyx_t_6) {
              __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_mstate_global->__pyx_tuple[3], NULL);
              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
              if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 549, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_8);
              __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            }
            goto __pyx_L24;
          }
          __pyx_L24:;
        }
        goto __pyx_L35;
        __pyx_L21_error:;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        goto __pyx_L1_error;
        __pyx_L35:;
      }
    }
    __pyx_L5:;

    /* "src/lxml/serializer.pxi":544
 * def _open_utf8_file(file, compression=0):
 *     file = _getFSPathOrObject(file)
 *     if _isString(file):             # <<<<<<<<<<<<<<
 *         if compression:
 *             with gzip.GzipFile(file, mode='wb', compresslevel=compression) as zf:
*/
    goto __pyx_L4;
  }

  /* "src/lxml/serializer.pxi":552
 *                 yield f
 *     else:
 *         if compression:             # <<<<<<<<<<<<<<
 *             with gzip.GzipFile(fileobj=file, mode='wb', compresslevel=compression) as zf:
 *                 yield utf8_writer(zf)
*/
  /*else*/ {
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_compression); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(6, 552, __pyx_L1_error)
    if (__pyx_t_2) {

      /* "src/lxml/serializer.pxi":553
 *     else:
 *         if compression:
 *             with gzip.GzipFile(fileobj=file, mode='wb', compresslevel=compression) as zf:             # <<<<<<<<<<<<<<
 *                 yield utf8_writer(zf)
 *         else:
*/
      /*with:*/ {
        __pyx_t_1 = __pyx_v_4lxml_5etree_gzip;
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_4 = 0;
        {
          PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 3 : 0)] = {__pyx_t_1, NULL};
          __pyx_t_5 = __Pyx_MakeVectorcallBuilderKwds(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 553, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_fileobj, __pyx_cur_scope->__pyx_v_file, __pyx_t_5, __pyx_callargs+1, 0) < (0)) __PYX_ERR(6, 553, __pyx_L1_error)
          if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_mode, __pyx_mstate_global->__pyx_n_u_wb, __pyx_t_5, __pyx_callargs+1, 1) < (0)) __PYX_ERR(6, 553, __pyx_L1_error)
          if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_compresslevel, __pyx_cur_scope->__pyx_v_compression, __pyx_t_5, __pyx_callargs+1, 2) < (0)) __PYX_ERR(6, 553, __pyx_L1_error)
          __pyx_t_7 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_GzipFile, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_5);
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 553, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
        }
        __pyx_t_6 = __Pyx_PyObject_LookupSpecial(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 553, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_1 = NULL;
        __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_enter); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 553, __pyx_L37_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = 1;
        #if CYTHON_UNPACK_METHODS
        if (likely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
          assert(__pyx_t_1);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
          __pyx_t_4 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL};
          __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 553, __pyx_L37_error)
          __Pyx_GOTREF(__pyx_t_5);
        }
        __pyx_t_3 = __pyx_t_5;
        __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        /*try:*/ {
          {
            __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
            __Pyx_XGOTREF(__pyx_t_8);
            __Pyx_XGOTREF(__pyx_t_9);
            __Pyx_XGOTREF(__pyx_t_10);
            /*try:*/ {
              __Pyx_GIVEREF(__pyx_t_3);
              __pyx_cur_scope->__pyx_v_zf = __pyx_t_3;
              __pyx_t_3 = 0;

              /* "src/lxml/serializer.pxi":554
 *         if compression:
 *             with gzip.GzipFile(fileobj=file, mode='wb', compresslevel=compression) as zf:
 *                 yield utf8_writer(zf)             # <<<<<<<<<<<<<<
 *         else:
 *             yield utf8_writer(file)
*/
              __pyx_t_7 = NULL;
              __Pyx_INCREF(__pyx_v_4lxml_5etree_utf8_writer);
              __pyx_t_5 = __pyx_v_4lxml_5etree_utf8_writer; 
              __pyx_t_4 = 1;
              #if CYTHON_UNPACK_METHODS
              if (unlikely(PyMethod_Check(__pyx_t_5))) {
                __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
                assert(__pyx_t_7);
                PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
                __Pyx_INCREF(__pyx_t_7);
                __Pyx_INCREF(__pyx__function);
                __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
                __pyx_t_4 = 0;
              }
              #endif
              {
                PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_cur_scope->__pyx_v_zf};
                __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
                __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
                __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
                if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 554, __pyx_L41_error)
                __Pyx_GOTREF(__pyx_t_3);
              }
              __pyx_r = __pyx_t_3;
              __pyx_t_3 = 0;
              __Pyx_XGIVEREF(__pyx_t_6);
              __pyx_cur_scope->__pyx_t_0 = __pyx_t_6;
              __Pyx_XGIVEREF(__pyx_t_8);
              __pyx_cur_scope->__pyx_t_1 = __pyx_t_8;
              __Pyx_XGIVEREF(__pyx_t_9);
              __pyx_cur_scope->__pyx_t_2 = __pyx_t_9;
              __Pyx_XGIVEREF(__pyx_t_10);
              __pyx_cur_scope->__pyx_t_3 = __pyx_t_10;
              __Pyx_XGIVEREF(__pyx_r);
              __Pyx_RefNannyFinishContext();
              __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
              /* return from generator, yielding value */
              __pyx_generator->resume_label = 3;
              return __pyx_r;
              __pyx_L47_resume_from_yield:;
              __pyx_t_6 = __pyx_cur_scope->__pyx_t_0;
              __pyx_cur_scope->__pyx_t_0 = 0;
              __Pyx_XGOTREF(__pyx_t_6);
              __pyx_t_8 = __pyx_cur_scope->__pyx_t_1;
              __pyx_cur_scope->__pyx_t_1 = 0;
              __Pyx_XGOTREF(__pyx_t_8);
              __pyx_t_9 = __pyx_cur_scope->__pyx_t_2;
              __pyx_cur_scope->__pyx_t_2 = 0;
              __Pyx_XGOTREF(__pyx_t_9);
              __pyx_t_10 = __pyx_cur_scope->__pyx_t_3;
              __pyx_cur_scope->__pyx_t_3 = 0;
              __Pyx_XGOTREF(__pyx_t_10);
              if (unlikely(!__pyx_sent_value)) __PYX_ERR(6, 554, __pyx_L41_error)

              /* "src/lxml/serializer.pxi":553
 *     else:
 *         if compression:
 *             with gzip.GzipFile(fileobj=file, mode='wb', compresslevel=compression) as zf:             # <<<<<<<<<<<<<<
 *                 yield utf8_writer(zf)
 *         else:
*/
            }
            __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
            __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
            __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
            goto __pyx_L46_try_end;
            __pyx_L41_error:;
            __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
            __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
            /*except:*/ {
              __Pyx_AddTraceback("lxml.etree._open_utf8_file", __pyx_clineno, __pyx_lineno, __pyx_filename);
              if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_5, &__pyx_t_7) < 0) __PYX_ERR(6, 553, __pyx_L43_except_error)
              __Pyx_XGOTREF(__pyx_t_3);
              __Pyx_XGOTREF(__pyx_t_5);
              __Pyx_XGOTREF(__pyx_t_7);
              __pyx_t_1 = PyTuple_Pack(3, __pyx_t_3, __pyx_t_5, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 553, __pyx_L43_except_error)
              __Pyx_GOTREF(__pyx_t_1);
              __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_1, NULL);
              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
              __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
              if (unlikely(!__pyx_t_11)) __PYX_ERR(6, 553, __pyx_L43_except_error)
              __Pyx_GOTREF(__pyx_t_11);
              __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_11);
              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
              if (__pyx_t_2 < (0)) __PYX_ERR(6, 553, __pyx_L43_except_error)
              __pyx_t_12 = (!__pyx_t_2);
              if (unlikely(__pyx_t_12)) {
                __Pyx_GIVEREF(__pyx_t_3);
                __Pyx_GIVEREF(__pyx_t_5);
                __Pyx_XGIVEREF(__pyx_t_7);
                __Pyx_ErrRestoreWithState(__pyx_t_3, __pyx_t_5, __pyx_t_7);
                __pyx_t_3 = 0;  __pyx_t_5 = 0;  __pyx_t_7 = 0; 
                __PYX_ERR(6, 553, __pyx_L43_except_error)
              }
              __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
              __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
              __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
              goto __pyx_L42_exception_handled;
            }
            __pyx_L43_except_error:;
            __Pyx_XGIVEREF(__pyx_t_8);
            __Pyx_XGIVEREF(__pyx_t_9);
            __Pyx_XGIVEREF(__pyx_t_10);
            __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
            goto __pyx_L1_error;
            __pyx_L42_exception_handled:;
            __Pyx_XGIVEREF(__pyx_t_8);
            __Pyx_XGIVEREF(__pyx_t_9);
            __Pyx_XGIVEREF(__pyx_t_10);
            __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
            __pyx_L46_try_end:;
          }
        }
        /*finally:*/ {
          /*normal exit:*/{
            if (__pyx_t_6) {
              __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_mstate_global->__pyx_tuple[3], NULL);
              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
              if (unlikely(!__pyx_t_10)) __PYX_ERR(6, 553, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_10);
              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
            }
            goto __pyx_L40;
          }
          __pyx_L40:;
        }
        goto __pyx_L51;
        __pyx_L37_error:;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        goto __pyx_L1_error;
        __pyx_L51:;
      }

      /* "src/lxml/serializer.pxi":552
 *                 yield f
 *     else:
 *         if compression:             # <<<<<<<<<<<<<<
 *             with gzip.GzipFile(fileobj=file, mode='wb', compresslevel=compression) as zf:
 *                 yield utf8_writer(zf)
*/
      goto __pyx_L36;
    }

    /* "src/lxml/serializer.pxi":556
 *                 yield utf8_writer(zf)
 *         else:
 *             yield utf8_writer(file)             # <<<<<<<<<<<<<<
 * 
 * 
*/
    /*else*/ {
      __pyx_t_5 = NULL;
      __Pyx_INCREF(__pyx_v_4lxml_5etree_utf8_writer);
      __pyx_t_3 = __pyx_v_4lxml_5etree_utf8_writer; 
      __pyx_t_4 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
        assert(__pyx_t_5);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
        __pyx_t_4 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_cur_scope->__pyx_v_file};
        __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 556, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
      }
      __pyx_r = __pyx_t_7;
      __pyx_t_7 = 0;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, yielding value */
      __pyx_generator->resume_label = 4;
      return __pyx_r;
      __pyx_L52_resume_from_yield:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(6, 556, __pyx_L1_error)
    }
    __pyx_L36:;
  }
  __pyx_L4:;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "src/lxml/serializer.pxi":541
 * cdef object _open_utf8_file
 * 
 * @contextmanager             # <<<<<<<<<<<<<<
 * def _open_utf8_file(file, compression=0):
 *     file = _getFSPathOrObject(file)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("_open_utf8_file", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":567
 *     cdef _ErrorLog error_log
 * 
 *     def __cinit__(self, filelike, exc_context=None, compression=None, close=False):             # <<<<<<<<<<<<<<
 *         if compression is not None and compression > 0:
 *             filelike = GzipFile(
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_15_FilelikeWriter_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_15_FilelikeWriter_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filelike = 0;
  PyObject *__pyx_v_exc_context = 0;
  PyObject *__pyx_v_compression = 0;
  PyObject *__pyx_v_close = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[4] = {0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_filelike,&__pyx_mstate_global->__pyx_n_u_exc_context,&__pyx_mstate_global->__pyx_n_u_compression,&__pyx_mstate_global->__pyx_n_u_close,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(6, 567, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  4:
        values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(6, 567, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(6, 567, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(6, 567, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 567, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__cinit__", 0) < (0)) __PYX_ERR(6, 567, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_False));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 4, i); __PYX_ERR(6, 567, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  4:
        values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(6, 567, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(6, 567, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(6, 567, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 567, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_False));
    }
    __pyx_v_filelike = values[0];
    __pyx_v_exc_context = values[1];
    __pyx_v_compression = values[2];
    __pyx_v_close = values[3];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 4, __pyx_nargs); __PYX_ERR(6, 567, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._FilelikeWriter.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_15_FilelikeWriter___cinit__(((struct __pyx_obj_4lxml_5etree__FilelikeWriter *)__pyx_v_self), __pyx_v_filelike, __pyx_v_exc_context, __pyx_v_compression, __pyx_v_close);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_15_FilelikeWriter___cinit__(struct __pyx_obj_4lxml_5etree__FilelikeWriter *__pyx_v_self, PyObject *__pyx_v_filelike, PyObject *__pyx_v_exc_context, PyObject *__pyx_v_compression, PyObject *__pyx_v_close) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);
  __Pyx_INCREF(__pyx_v_filelike);

  /* "src/lxml/serializer.pxi":568
 * 
 *     def __cinit__(self, filelike, exc_context=None, compression=None, close=False):
 *         if compression is not None and compression > 0:             # <<<<<<<<<<<<<<
 *             filelike = GzipFile(
 *                 fileobj=filelike, mode='wb', compresslevel=compression)
*/
  __pyx_t_2 = (__pyx_v_compression != Py_None);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = PyObject_RichCompare(__pyx_v_compression, __pyx_mstate_global->__pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 568, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(6, 568, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":569
 *     def __cinit__(self, filelike, exc_context=None, compression=None, close=False):
 *         if compression is not None and compression > 0:
 *             filelike = GzipFile(             # <<<<<<<<<<<<<<
 *                 fileobj=filelike, mode='wb', compresslevel=compression)
 *             self._close_filelike = filelike.close
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_v_4lxml_5etree_GzipFile);
    __pyx_t_5 = __pyx_v_4lxml_5etree_GzipFile; 

    /* "src/lxml/serializer.pxi":570
 *         if compression is not None and compression > 0:
 *             filelike = GzipFile(
 *                 fileobj=filelike, mode='wb', compresslevel=compression)             # <<<<<<<<<<<<<<
 *             self._close_filelike = filelike.close
 *         elif close:
*/
    __pyx_t_6 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
      assert(__pyx_t_4);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
      __pyx_t_6 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 3 : 0)] = {__pyx_t_4, NULL};
      __pyx_t_7 = __Pyx_MakeVectorcallBuilderKwds(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 569, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_fileobj, __pyx_v_filelike, __pyx_t_7, __pyx_callargs+1, 0) < (0)) __PYX_ERR(6, 569, __pyx_L1_error)
      if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_mode, __pyx_mstate_global->__pyx_n_u_wb, __pyx_t_7, __pyx_callargs+1, 1) < (0)) __PYX_ERR(6, 569, __pyx_L1_error)
      if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_compresslevel, __pyx_v_compression, __pyx_t_7, __pyx_callargs+1, 2) < (0)) __PYX_ERR(6, 569, __pyx_L1_error)
      __pyx_t_3 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_7);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 569, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_DECREF_SET(__pyx_v_filelike, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":571
 *             filelike = GzipFile(
 *                 fileobj=filelike, mode='wb', compresslevel=compression)
 *             self._close_filelike = filelike.close             # <<<<<<<<<<<<<<
 *         elif close:
 *             self._close_filelike = filelike.close
*/
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_filelike, __pyx_mstate_global->__pyx_n_u_close); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 571, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF(__pyx_v_self->_close_filelike);
    __Pyx_DECREF(__pyx_v_self->_close_filelike);
    __pyx_v_self->_close_filelike = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":568
 * 
 *     def __cinit__(self, filelike, exc_context=None, compression=None, close=False):
 *         if compression is not None and compression > 0:             # <<<<<<<<<<<<<<
 *             filelike = GzipFile(
 *                 fileobj=filelike, mode='wb', compresslevel=compression)
*/
    goto __pyx_L3;
  }

  /* "src/lxml/serializer.pxi":572
 *                 fileobj=filelike, mode='wb', compresslevel=compression)
 *             self._close_filelike = filelike.close
 *         elif close:             # <<<<<<<<<<<<<<
 *             self._close_filelike = filelike.close
 *         self._filelike = filelike
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_close); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(6, 572, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":573
 *             self._close_filelike = filelike.close
 *         elif close:
 *             self._close_filelike = filelike.close             # <<<<<<<<<<<<<<
 *         self._filelike = filelike
 *         if exc_context is None:
*/
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_filelike, __pyx_mstate_global->__pyx_n_u_close); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 573, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF(__pyx_v_self->_close_filelike);
    __Pyx_DECREF(__pyx_v_self->_close_filelike);
    __pyx_v_self->_close_filelike = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":572
 *                 fileobj=filelike, mode='wb', compresslevel=compression)
 *             self._close_filelike = filelike.close
 *         elif close:             # <<<<<<<<<<<<<<
 *             self._close_filelike = filelike.close
 *         self._filelike = filelike
*/
  }
  __pyx_L3:;

  /* "src/lxml/serializer.pxi":574
 *         elif close:
 *             self._close_filelike = filelike.close
 *         self._filelike = filelike             # <<<<<<<<<<<<<<
 *         if exc_context is None:
 *             self._exc_context = _ExceptionContext()
*/
  __Pyx_INCREF(__pyx_v_filelike);
  __Pyx_GIVEREF(__pyx_v_filelike);
  __Pyx_GOTREF(__pyx_v_self->_filelike);
  __Pyx_DECREF(__pyx_v_self->_filelike);
  __pyx_v_self->_filelike = __pyx_v_filelike;

  /* "src/lxml/serializer.pxi":575
 *             self._close_filelike = filelike.close
 *         self._filelike = filelike
 *         if exc_context is None:             # <<<<<<<<<<<<<<
 *             self._exc_context = _ExceptionContext()
 *         else:
*/
  __pyx_t_1 = (__pyx_v_exc_context == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":576
 *         self._filelike = filelike
 *         if exc_context is None:
 *             self._exc_context = _ExceptionContext()             # <<<<<<<<<<<<<<
 *         else:
 *             self._exc_context = exc_context
*/
    __pyx_t_5 = NULL;
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ExceptionContext, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 576, __pyx_L1_error)
      __Pyx_GOTREF((PyObject *)__pyx_t_3);
    }
    __Pyx_GIVEREF((PyObject *)__pyx_t_3);
    __Pyx_GOTREF((PyObject *)__pyx_v_self->_exc_context);
    __Pyx_DECREF((PyObject *)__pyx_v_self->_exc_context);
    __pyx_v_self->_exc_context = ((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":575
 *             self._close_filelike = filelike.close
 *         self._filelike = filelike
 *         if exc_context is None:             # <<<<<<<<<<<<<<
 *             self._exc_context = _ExceptionContext()
 *         else:
*/
    goto __pyx_L6;
  }

  /* "src/lxml/serializer.pxi":578
 *             self._exc_context = _ExceptionContext()
 *         else:
 *             self._exc_context = exc_context             # <<<<<<<<<<<<<<
 *         self.error_log = _ErrorLog()
 * 
*/
  /*else*/ {
    __pyx_t_3 = __pyx_v_exc_context;
    __Pyx_INCREF(__pyx_t_3);
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ExceptionContext))))) __PYX_ERR(6, 578, __pyx_L1_error)
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF((PyObject *)__pyx_v_self->_exc_context);
    __Pyx_DECREF((PyObject *)__pyx_v_self->_exc_context);
    __pyx_v_self->_exc_context = ((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_t_3);
    __pyx_t_3 = 0;
  }
  __pyx_L6:;

  /* "src/lxml/serializer.pxi":579
 *         else:
 *             self._exc_context = exc_context
 *         self.error_log = _ErrorLog()             # <<<<<<<<<<<<<<
 * 
 *     cdef tree.xmlOutputBuffer* _createOutputBuffer(
*/
  __pyx_t_5 = NULL;
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};
    __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ErrorLog, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 579, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_3);
  }
  __Pyx_GIVEREF((PyObject *)__pyx_t_3);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->error_log);
  __Pyx_DECREF((PyObject *)__pyx_v_self->error_log);
  __pyx_v_self->error_log = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/serializer.pxi":567
 *     cdef _ErrorLog error_log
 * 
 *     def __cinit__(self, filelike, exc_context=None, compression=None, close=False):             # <<<<<<<<<<<<<<
 *         if compression is not None and compression > 0:
 *             filelike = GzipFile(
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree._FilelikeWriter.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_filelike);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":581
 *         self.error_log = _ErrorLog()
 * 
 *     cdef tree.xmlOutputBuffer* _createOutputBuffer(             # <<<<<<<<<<<<<<
 *         self, tree.xmlCharEncodingHandler* enchandler) except NULL:
 *         cdef tree.xmlOutputBuffer* c_buffer
*/

static xmlOutputBuffer *__pyx_f_4lxml_5etree_15_FilelikeWriter__createOutputBuffer(struct __pyx_obj_4lxml_5etree__FilelikeWriter *__pyx_v_self, xmlCharEncodingHandler *__pyx_v_enchandler) {
  xmlOutputBuffer *__pyx_v_c_buffer;
  xmlOutputBuffer *__pyx_r;
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/serializer.pxi":584
 *         self, tree.xmlCharEncodingHandler* enchandler) except NULL:
 *         cdef tree.xmlOutputBuffer* c_buffer
 *         c_buffer = tree.xmlOutputBufferCreateIO(             # <<<<<<<<<<<<<<
 *             <tree.xmlOutputWriteCallback>_writeFilelikeWriter, _closeFilelikeWriter,
 *             <python.PyObject*>self, enchandler)
*/
  __pyx_v_c_buffer = xmlOutputBufferCreateIO(((xmlOutputWriteCallback)__pyx_f_4lxml_5etree__writeFilelikeWriter), __pyx_f_4lxml_5etree__closeFilelikeWriter, ((PyObject *)__pyx_v_self), __pyx_v_enchandler);

  /* "src/lxml/serializer.pxi":587
 *             <tree.xmlOutputWriteCallback>_writeFilelikeWriter, _closeFilelikeWriter,
 *             <python.PyObject*>self, enchandler)
 *         if c_buffer is NULL:             # <<<<<<<<<<<<<<
 *             raise IOError, "Could not create I/O writer context."
 *         return c_buffer
*/
  __pyx_t_1 = (__pyx_v_c_buffer == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/serializer.pxi":588
 *             <python.PyObject*>self, enchandler)
 *         if c_buffer is NULL:
 *             raise IOError, "Could not create I/O writer context."             # <<<<<<<<<<<<<<
 *         return c_buffer
 * 
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_IOError))), __pyx_mstate_global->__pyx_kp_u_Could_not_create_I_O_writer_cont, 0, 0);
    __PYX_ERR(6, 588, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":587
 *             <tree.xmlOutputWriteCallback>_writeFilelikeWriter, _closeFilelikeWriter,
 *             <python.PyObject*>self, enchandler)
 *         if c_buffer is NULL:             # <<<<<<<<<<<<<<
 *             raise IOError, "Could not create I/O writer context."
 *         return c_buffer
*/
  }

  /* "src/lxml/serializer.pxi":589
 *         if c_buffer is NULL:
 *             raise IOError, "Could not create I/O writer context."
 *         return c_buffer             # <<<<<<<<<<<<<<
 * 
 *     cdef int write(self, char* c_buffer, int size) noexcept:
*/
  __pyx_r = __pyx_v_c_buffer;
  goto __pyx_L0;

  /* "src/lxml/serializer.pxi":581
 *         self.error_log = _ErrorLog()
 * 
 *     cdef tree.xmlOutputBuffer* _createOutputBuffer(             # <<<<<<<<<<<<<<
 *         self, tree.xmlCharEncodingHandler* enchandler) except NULL:
 *         cdef tree.xmlOutputBuffer* c_buffer
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._FilelikeWriter._createOutputBuffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":591
 *         return c_buffer
 * 
 *     cdef int write(self, char* c_buffer, int size) noexcept:             # <<<<<<<<<<<<<<
 *         try:
 *             if self._filelike is None:
*/

static int __pyx_f_4lxml_5etree_15_FilelikeWriter_write(struct __pyx_obj_4lxml_5etree__FilelikeWriter *__pyx_v_self, char *__pyx_v_c_buffer, int __pyx_v_size) {
  PyObject *__pyx_v_py_buffer = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  size_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("write", 0);

  /* "src/lxml/serializer.pxi":592
 * 
 *     cdef int write(self, char* c_buffer, int size) noexcept:
 *         try:             # <<<<<<<<<<<<<<
 *             if self._filelike is None:
 *                 raise IOError, "File is already closed"
*/
  /*try:*/ {
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_1);
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_3);
      /*try:*/ {

        /* "src/lxml/serializer.pxi":593
 *     cdef int write(self, char* c_buffer, int size) noexcept:
 *         try:
 *             if self._filelike is None:             # <<<<<<<<<<<<<<
 *                 raise IOError, "File is already closed"
 *             py_buffer = <bytes>c_buffer[:size]
*/
        __pyx_t_4 = (__pyx_v_self->_filelike == Py_None);
        if (unlikely(__pyx_t_4)) {

          /* "src/lxml/serializer.pxi":594
 *         try:
 *             if self._filelike is None:
 *                 raise IOError, "File is already closed"             # <<<<<<<<<<<<<<
 *             py_buffer = <bytes>c_buffer[:size]
 *             self._filelike.write(py_buffer)
*/
          __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_IOError))), __pyx_mstate_global->__pyx_kp_u_File_is_already_closed, 0, 0);
          __PYX_ERR(6, 594, __pyx_L6_error)

          /* "src/lxml/serializer.pxi":593
 *     cdef int write(self, char* c_buffer, int size) noexcept:
 *         try:
 *             if self._filelike is None:             # <<<<<<<<<<<<<<
 *                 raise IOError, "File is already closed"
 *             py_buffer = <bytes>c_buffer[:size]
*/
        }

        /* "src/lxml/serializer.pxi":595
 *             if self._filelike is None:
 *                 raise IOError, "File is already closed"
 *             py_buffer = <bytes>c_buffer[:size]             # <<<<<<<<<<<<<<
 *             self._filelike.write(py_buffer)
 *         except:
*/
        __pyx_t_5 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_c_buffer + 0, __pyx_v_size - 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 595, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_6 = __pyx_t_5;
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_v_py_buffer = ((PyObject*)__pyx_t_6);
        __pyx_t_6 = 0;

        /* "src/lxml/serializer.pxi":596
 *                 raise IOError, "File is already closed"
 *             py_buffer = <bytes>c_buffer[:size]
 *             self._filelike.write(py_buffer)             # <<<<<<<<<<<<<<
 *         except:
 *             size = -1
*/
        __pyx_t_5 = __pyx_v_self->_filelike;
        __Pyx_INCREF(__pyx_t_5);
        __pyx_t_7 = 0;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_py_buffer};
          __pyx_t_6 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_write, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 596, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_6);
        }
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

        /* "src/lxml/serializer.pxi":592
 * 
 *     cdef int write(self, char* c_buffer, int size) noexcept:
 *         try:             # <<<<<<<<<<<<<<
 *             if self._filelike is None:
 *                 raise IOError, "File is already closed"
*/
      }
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L11_try_end;
      __pyx_L6_error:;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "src/lxml/serializer.pxi":597
 *             py_buffer = <bytes>c_buffer[:size]
 *             self._filelike.write(py_buffer)
 *         except:             # <<<<<<<<<<<<<<
 *             size = -1
 *             self._exc_context._store_raised()
*/
      /*except:*/ {
        __Pyx_AddTraceback("lxml.etree._FilelikeWriter.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_8) < 0) __PYX_ERR(6, 597, __pyx_L8_except_error)
        __Pyx_XGOTREF(__pyx_t_6);
        __Pyx_XGOTREF(__pyx_t_5);
        __Pyx_XGOTREF(__pyx_t_8);

        /* "src/lxml/serializer.pxi":598
 *             self._filelike.write(py_buffer)
 *         except:
 *             size = -1             # <<<<<<<<<<<<<<
 *             self._exc_context._store_raised()
 *         finally:
*/
        __pyx_v_size = -1;

        /* "src/lxml/serializer.pxi":599
 *         except:
 *             size = -1
 *             self._exc_context._store_raised()             # <<<<<<<<<<<<<<
 *         finally:
 *             return size  # and swallow any further exceptions
*/
        __pyx_f_4lxml_5etree_17_ExceptionContext__store_raised(__pyx_v_self->_exc_context);
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L7_exception_handled;
      }

      /* "src/lxml/serializer.pxi":592
 * 
 *     cdef int write(self, char* c_buffer, int size) noexcept:
 *         try:             # <<<<<<<<<<<<<<
 *             if self._filelike is None:
 *                 raise IOError, "File is already closed"
*/
      __pyx_L8_except_error:;
      __Pyx_XGIVEREF(__pyx_t_1);
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
      goto __pyx_L4_error;
      __pyx_L7_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_1);
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
      __pyx_L11_try_end:;
    }
  }

  /* "src/lxml/serializer.pxi":601
 *             self._exc_context._store_raised()
 *         finally:
 *             return size  # and swallow any further exceptions             # <<<<<<<<<<<<<<
 * 
 *     cdef int close(self) noexcept:
*/
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_r = __pyx_v_size;
      goto __pyx_L0;
    }
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_1 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      if ( unlikely(__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1) < 0)) __Pyx_ErrFetch(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_1);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      {
        __pyx_r = __pyx_v_size;
        goto __pyx_L15_return;
      }
      __pyx_L15_return:;
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
      goto __pyx_L0;
    }
  }

  /* "src/lxml/serializer.pxi":591
 *         return c_buffer
 * 
 *     cdef int write(self, char* c_buffer, int size) noexcept:             # <<<<<<<<<<<<<<
 *         try:
 *             if self._filelike is None:
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_py_buffer);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":603
 *             return size  # and swallow any further exceptions
 * 
 *     cdef int close(self) noexcept:             # <<<<<<<<<<<<<<
 *         retval = 0
 *         try:
*/

static int __pyx_f_4lxml_5etree_15_FilelikeWriter_close(struct __pyx_obj_4lxml_5etree__FilelikeWriter *__pyx_v_self) {
  long __pyx_v_retval;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  size_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("close", 0);

  /* "src/lxml/serializer.pxi":604
 * 
 *     cdef int close(self) noexcept:
 *         retval = 0             # <<<<<<<<<<<<<<
 *         try:
 *             if self._close_filelike is not None:
*/
  __pyx_v_retval = 0;

  /* "src/lxml/serializer.pxi":605
 *     cdef int close(self) noexcept:
 *         retval = 0
 *         try:             # <<<<<<<<<<<<<<
 *             if self._close_filelike is not None:
 *                 self._close_filelike()
*/
  /*try:*/ {
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_1);
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_3);
      /*try:*/ {

        /* "src/lxml/serializer.pxi":606
 *         retval = 0
 *         try:
 *             if self._close_filelike is not None:             # <<<<<<<<<<<<<<
 *                 self._close_filelike()
 *             # we should not close the file here as we didn't open it
*/
        __pyx_t_4 = (__pyx_v_self->_close_filelike != Py_None);
        if (__pyx_t_4) {

          /* "src/lxml/serializer.pxi":607
 *         try:
 *             if self._close_filelike is not None:
 *                 self._close_filelike()             # <<<<<<<<<<<<<<
 *             # we should not close the file here as we didn't open it
 *             self._filelike = None
*/
          __pyx_t_6 = NULL;
          __Pyx_INCREF(__pyx_v_self->_close_filelike);
          __pyx_t_7 = __pyx_v_self->_close_filelike; 
          __pyx_t_8 = 1;
          #if CYTHON_UNPACK_METHODS
          if (likely(PyMethod_Check(__pyx_t_7))) {
            __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
            assert(__pyx_t_6);
            PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
            __Pyx_INCREF(__pyx_t_6);
            __Pyx_INCREF(__pyx__function);
            __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
            __pyx_t_8 = 0;
          }
          #endif
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL};
            __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 607, __pyx_L6_error)
            __Pyx_GOTREF(__pyx_t_5);
          }
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

          /* "src/lxml/serializer.pxi":606
 *         retval = 0
 *         try:
 *             if self._close_filelike is not None:             # <<<<<<<<<<<<<<
 *                 self._close_filelike()
 *             # we should not close the file here as we didn't open it
*/
        }

        /* "src/lxml/serializer.pxi":609
 *                 self._close_filelike()
 *             # we should not close the file here as we didn't open it
 *             self._filelike = None             # <<<<<<<<<<<<<<
 *         except:
 *             retval = -1
*/
        __Pyx_INCREF(Py_None);
        __Pyx_GIVEREF(Py_None);
        __Pyx_GOTREF(__pyx_v_self->_filelike);
        __Pyx_DECREF(__pyx_v_self->_filelike);
        __pyx_v_self->_filelike = Py_None;

        /* "src/lxml/serializer.pxi":605
 *     cdef int close(self) noexcept:
 *         retval = 0
 *         try:             # <<<<<<<<<<<<<<
 *             if self._close_filelike is not None:
 *                 self._close_filelike()
*/
      }
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L11_try_end;
      __pyx_L6_error:;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "src/lxml/serializer.pxi":610
 *             # we should not close the file here as we didn't open it
 *             self._filelike = None
 *         except:             # <<<<<<<<<<<<<<
 *             retval = -1
 *             self._exc_context._store_raised()
*/
      /*except:*/ {
        __Pyx_AddTraceback("lxml.etree._FilelikeWriter.close", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_7, &__pyx_t_6) < 0) __PYX_ERR(6, 610, __pyx_L8_except_error)
        __Pyx_XGOTREF(__pyx_t_5);
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_6);

        /* "src/lxml/serializer.pxi":611
 *             self._filelike = None
 *         except:
 *             retval = -1             # <<<<<<<<<<<<<<
 *             self._exc_context._store_raised()
 *         finally:
*/
        __pyx_v_retval = -1L;

        /* "src/lxml/serializer.pxi":612
 *         except:
 *             retval = -1
 *             self._exc_context._store_raised()             # <<<<<<<<<<<<<<
 *         finally:
 *             return retval  # and swallow any further exceptions
*/
        __pyx_f_4lxml_5etree_17_ExceptionContext__store_raised(__pyx_v_self->_exc_context);
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        goto __pyx_L7_exception_handled;
      }

      /* "src/lxml/serializer.pxi":605
 *     cdef int close(self) noexcept:
 *         retval = 0
 *         try:             # <<<<<<<<<<<<<<
 *             if self._close_filelike is not None:
 *                 self._close_filelike()
*/
      __pyx_L8_except_error:;
      __Pyx_XGIVEREF(__pyx_t_1);
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
      goto __pyx_L4_error;
      __pyx_L7_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_1);
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
      __pyx_L11_try_end:;
    }
  }

  /* "src/lxml/serializer.pxi":614
 *             self._exc_context._store_raised()
 *         finally:
 *             return retval  # and swallow any further exceptions             # <<<<<<<<<<<<<<
 * 
 * cdef int _writeFilelikeWriter(void* ctxt, char* c_buffer, int length) noexcept:
*/
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_r = __pyx_v_retval;
      goto __pyx_L0;
    }
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_1 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      if ( unlikely(__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1) < 0)) __Pyx_ErrFetch(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_1);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      {
        __pyx_r = __pyx_v_retval;
        goto __pyx_L15_return;
      }
      __pyx_L15_return:;
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
      goto __pyx_L0;
    }
  }

  /* "src/lxml/serializer.pxi":603
 *             return size  # and swallow any further exceptions
 * 
 *     cdef int close(self) noexcept:             # <<<<<<<<<<<<<<
 *         retval = 0
 *         try:
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":616
 *             return retval  # and swallow any further exceptions
 * 
 * cdef int _writeFilelikeWriter(void* ctxt, char* c_buffer, int length) noexcept:             # <<<<<<<<<<<<<<
 *     return (<_FilelikeWriter>ctxt).write(c_buffer, length)
 * 
*/

static int __pyx_f_4lxml_5etree__writeFilelikeWriter(void *__pyx_v_ctxt, char *__pyx_v_c_buffer, int __pyx_v_length) {
  int __pyx_r;

  /* "src/lxml/serializer.pxi":617
 * 
 * cdef int _writeFilelikeWriter(void* ctxt, char* c_buffer, int length) noexcept:
 *     return (<_FilelikeWriter>ctxt).write(c_buffer, length)             # <<<<<<<<<<<<<<
 * 
 * cdef int _closeFilelikeWriter(void* ctxt) noexcept:
*/
  __pyx_r = __pyx_f_4lxml_5etree_15_FilelikeWriter_write(((struct __pyx_obj_4lxml_5etree__FilelikeWriter *)__pyx_v_ctxt), __pyx_v_c_buffer, __pyx_v_length);
  goto __pyx_L0;

  /* "src/lxml/serializer.pxi":616
 *             return retval  # and swallow any further exceptions
 * 
 * cdef int _writeFilelikeWriter(void* ctxt, char* c_buffer, int length) noexcept:             # <<<<<<<<<<<<<<
 *     return (<_FilelikeWriter>ctxt).write(c_buffer, length)
 * 
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":619
 *     return (<_FilelikeWriter>ctxt).write(c_buffer, length)
 * 
 * cdef int _closeFilelikeWriter(void* ctxt) noexcept:             # <<<<<<<<<<<<<<
 *     return (<_FilelikeWriter>ctxt).close()
 * 
*/

static int __pyx_f_4lxml_5etree__closeFilelikeWriter(void *__pyx_v_ctxt) {
  int __pyx_r;

  /* "src/lxml/serializer.pxi":620
 * 
 * cdef int _closeFilelikeWriter(void* ctxt) noexcept:
 *     return (<_FilelikeWriter>ctxt).close()             # <<<<<<<<<<<<<<
 * 
 * cdef _tofilelike(f, _Element element, encoding, doctype, method,
*/
  __pyx_r = __pyx_f_4lxml_5etree_15_FilelikeWriter_close(((struct __pyx_obj_4lxml_5etree__FilelikeWriter *)__pyx_v_ctxt));
  goto __pyx_L0;

  /* "src/lxml/serializer.pxi":619
 *     return (<_FilelikeWriter>ctxt).write(c_buffer, length)
 * 
 * cdef int _closeFilelikeWriter(void* ctxt) noexcept:             # <<<<<<<<<<<<<<
 *     return (<_FilelikeWriter>ctxt).close()
 * 
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":622
 *     return (<_FilelikeWriter>ctxt).close()
 * 
 * cdef _tofilelike(f, _Element element, encoding, doctype, method,             # <<<<<<<<<<<<<<
 *                  bint write_xml_declaration, bint write_doctype,
 *                  bint pretty_print, bint with_tail, int standalone,
*/

static PyObject *__pyx_f_4lxml_5etree__tofilelike(PyObject *__pyx_v_f, struct LxmlElement *__pyx_v_element, PyObject *__pyx_v_encoding, PyObject *__pyx_v_doctype, PyObject *__pyx_v_method, int __pyx_v_write_xml_declaration, int __pyx_v_write_doctype, int __pyx_v_pretty_print, int __pyx_v_with_tail, int __pyx_v_standalone, int __pyx_v_compression) {
  struct __pyx_obj_4lxml_5etree__FilelikeWriter *__pyx_v_writer = 0;
  xmlOutputBuffer *__pyx_v_c_buffer;
  const char *__pyx_v_c_enc;
  const xmlChar *__pyx_v_c_doctype;
  int __pyx_v_error_result;
  int __pyx_v_c_method;
  PyObject *__pyx_v_data = NULL;
  PyObject *__pyx_v_bytes_out = NULL;
  PyObject *__pyx_v_gzip_file = NULL;
  PyObject *__pyx_v_filename8 = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_tofilelike", 0);
  __Pyx_INCREF(__pyx_v_f);
  __Pyx_INCREF(__pyx_v_encoding);
  __Pyx_INCREF(__pyx_v_doctype);

  /* "src/lxml/serializer.pxi":626
 *                  bint pretty_print, bint with_tail, int standalone,
 *                  int compression):
 *     cdef _FilelikeWriter writer = None             # <<<<<<<<<<<<<<
 *     cdef tree.xmlOutputBuffer* c_buffer
 *     cdef tree.xmlCharEncodingHandler* enchandler
*/
  __Pyx_INCREF(Py_None);
  __pyx_v_writer = ((struct __pyx_obj_4lxml_5etree__FilelikeWriter *)Py_None);

  /* "src/lxml/serializer.pxi":633
 *     cdef int error_result
 * 
 *     c_method = _findOutputMethod(method)             # <<<<<<<<<<<<<<
 *     if c_method == OUTPUT_METHOD_TEXT:
 *         data = _textToString(element._c_node, encoding, with_tail)
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__findOutputMethod(__pyx_v_method); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(6, 633, __pyx_L1_error)
  __pyx_v_c_method = __pyx_t_1;

  /* "src/lxml/serializer.pxi":634
 * 
 *     c_method = _findOutputMethod(method)
 *     if c_method == OUTPUT_METHOD_TEXT:             # <<<<<<<<<<<<<<
 *         data = _textToString(element._c_node, encoding, with_tail)
 *         if compression:
*/
  __pyx_t_2 = (__pyx_v_c_method == __pyx_e_4lxml_5etree_OUTPUT_METHOD_TEXT);
  if (__pyx_t_2) {

    /* "src/lxml/serializer.pxi":635
 *     c_method = _findOutputMethod(method)
 *     if c_method == OUTPUT_METHOD_TEXT:
 *         data = _textToString(element._c_node, encoding, with_tail)             # <<<<<<<<<<<<<<
 *         if compression:
 *             bytes_out = BytesIO()
*/
    __pyx_t_3 = __pyx_f_4lxml_5etree__textToString(__pyx_v_element->_c_node, __pyx_v_encoding, __pyx_v_with_tail); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 635, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_data = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":636
 *     if c_method == OUTPUT_METHOD_TEXT:
 *         data = _textToString(element._c_node, encoding, with_tail)
 *         if compression:             # <<<<<<<<<<<<<<
 *             bytes_out = BytesIO()
 *             with GzipFile(fileobj=bytes_out, mode='wb', compresslevel=compression) as gzip_file:
*/
    __pyx_t_2 = (__pyx_v_compression != 0);
    if (__pyx_t_2) {

      /* "src/lxml/serializer.pxi":637
 *         data = _textToString(element._c_node, encoding, with_tail)
 *         if compression:
 *             bytes_out = BytesIO()             # <<<<<<<<<<<<<<
 *             with GzipFile(fileobj=bytes_out, mode='wb', compresslevel=compression) as gzip_file:
 *                 gzip_file.write(data)
*/
      __pyx_t_4 = NULL;
      __Pyx_INCREF(__pyx_v_4lxml_5etree_BytesIO);
      __pyx_t_5 = __pyx_v_4lxml_5etree_BytesIO; 
      __pyx_t_6 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
        assert(__pyx_t_4);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
        __pyx_t_6 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
        __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 637, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
      }
      __pyx_v_bytes_out = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "src/lxml/serializer.pxi":638
 *         if compression:
 *             bytes_out = BytesIO()
 *             with GzipFile(fileobj=bytes_out, mode='wb', compresslevel=compression) as gzip_file:             # <<<<<<<<<<<<<<
 *                 gzip_file.write(data)
 *             data = bytes_out.getvalue()
*/
      /*with:*/ {
        __pyx_t_5 = NULL;
        __Pyx_INCREF(__pyx_v_4lxml_5etree_GzipFile);
        __pyx_t_4 = __pyx_v_4lxml_5etree_GzipFile; 
        __pyx_t_7 = __Pyx_PyLong_From_int(__pyx_v_compression); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 638, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_6 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
          assert(__pyx_t_5);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
          __pyx_t_6 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 3 : 0)] = {__pyx_t_5, NULL};
          __pyx_t_8 = __Pyx_MakeVectorcallBuilderKwds(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 638, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_fileobj, __pyx_v_bytes_out, __pyx_t_8, __pyx_callargs+1, 0) < (0)) __PYX_ERR(6, 638, __pyx_L1_error)
          if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_mode, __pyx_mstate_global->__pyx_n_u_wb, __pyx_t_8, __pyx_callargs+1, 1) < (0)) __PYX_ERR(6, 638, __pyx_L1_error)
          if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_compresslevel, __pyx_t_7, __pyx_t_8, __pyx_callargs+1, 2) < (0)) __PYX_ERR(6, 638, __pyx_L1_error)
          __pyx_t_3 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_8);
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 638, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
        }
        __pyx_t_9 = __Pyx_PyObject_LookupSpecial(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 638, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_8 = NULL;
        __pyx_t_7 = __Pyx_PyObject_LookupSpecial(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_enter); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 638, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_6 = 1;
        #if CYTHON_UNPACK_METHODS
        if (likely(PyMethod_Check(__pyx_t_7))) {
          __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
          assert(__pyx_t_8);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_8);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
          __pyx_t_6 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_8, NULL};
          __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 638, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_4);
        }
        __pyx_t_7 = __pyx_t_4;
        __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        /*try:*/ {
          {
            __Pyx_PyThreadState_declare
            __Pyx_PyThreadState_assign
            __Pyx_ExceptionSave(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
            __Pyx_XGOTREF(__pyx_t_10);
            __Pyx_XGOTREF(__pyx_t_11);
            __Pyx_XGOTREF(__pyx_t_12);
            /*try:*/ {
              __pyx_v_gzip_file = __pyx_t_7;
              __pyx_t_7 = 0;

              /* "src/lxml/serializer.pxi":639
 *             bytes_out = BytesIO()
 *             with GzipFile(fileobj=bytes_out, mode='wb', compresslevel=compression) as gzip_file:
 *                 gzip_file.write(data)             # <<<<<<<<<<<<<<
 *             data = bytes_out.getvalue()
 *         f = _getFSPathOrObject(f)
*/
              __pyx_t_3 = __pyx_v_gzip_file;
              __Pyx_INCREF(__pyx_t_3);
              __pyx_t_6 = 0;
              {
                PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_data};
                __pyx_t_7 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_write, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
                __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
                if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 639, __pyx_L9_error)
                __Pyx_GOTREF(__pyx_t_7);
              }
              __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

              /* "src/lxml/serializer.pxi":638
 *         if compression:
 *             bytes_out = BytesIO()
 *             with GzipFile(fileobj=bytes_out, mode='wb', compresslevel=compression) as gzip_file:             # <<<<<<<<<<<<<<
 *                 gzip_file.write(data)
 *             data = bytes_out.getvalue()
*/
            }
            __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
            __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
            __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
            goto __pyx_L14_try_end;
            __pyx_L9_error:;
            __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
            __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
            __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
            __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
            /*except:*/ {
              __Pyx_AddTraceback("lxml.etree._tofilelike", __pyx_clineno, __pyx_lineno, __pyx_filename);
              if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_3, &__pyx_t_4) < 0) __PYX_ERR(6, 638, __pyx_L11_except_error)
              __Pyx_XGOTREF(__pyx_t_7);
              __Pyx_XGOTREF(__pyx_t_3);
              __Pyx_XGOTREF(__pyx_t_4);
              __pyx_t_8 = PyTuple_Pack(3, __pyx_t_7, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 638, __pyx_L11_except_error)
              __Pyx_GOTREF(__pyx_t_8);
              __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_8, NULL);
              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
              __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
              if (unlikely(!__pyx_t_13)) __PYX_ERR(6, 638, __pyx_L11_except_error)
              __Pyx_GOTREF(__pyx_t_13);
              __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_13);
              __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
              if (__pyx_t_2 < (0)) __PYX_ERR(6, 638, __pyx_L11_except_error)
              __pyx_t_14 = (!__pyx_t_2);
              if (unlikely(__pyx_t_14)) {
                __Pyx_GIVEREF(__pyx_t_7);
                __Pyx_GIVEREF(__pyx_t_3);
                __Pyx_XGIVEREF(__pyx_t_4);
                __Pyx_ErrRestoreWithState(__pyx_t_7, __pyx_t_3, __pyx_t_4);
                __pyx_t_7 = 0;  __pyx_t_3 = 0;  __pyx_t_4 = 0; 
                __PYX_ERR(6, 638, __pyx_L11_except_error)
              }
              __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
              __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
              __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
              goto __pyx_L10_exception_handled;
            }
            __pyx_L11_except_error:;
            __Pyx_XGIVEREF(__pyx_t_10);
            __Pyx_XGIVEREF(__pyx_t_11);
            __Pyx_XGIVEREF(__pyx_t_12);
            __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
            goto __pyx_L1_error;
            __pyx_L10_exception_handled:;
            __Pyx_XGIVEREF(__pyx_t_10);
            __Pyx_XGIVEREF(__pyx_t_11);
            __Pyx_XGIVEREF(__pyx_t_12);
            __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
            __pyx_L14_try_end:;
          }
        }
        /*finally:*/ {
          /*normal exit:*/{
            if (__pyx_t_9) {
              __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_mstate_global->__pyx_tuple[3], NULL);
              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
              if (unlikely(!__pyx_t_12)) __PYX_ERR(6, 638, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_12);
              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
            }
            goto __pyx_L8;
          }
          __pyx_L8:;
        }
        goto __pyx_L18;
        __pyx_L5_error:;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L1_error;
        __pyx_L18:;
      }

      /* "src/lxml/serializer.pxi":640
 *             with GzipFile(fileobj=bytes_out, mode='wb', compresslevel=compression) as gzip_file:
 *                 gzip_file.write(data)
 *             data = bytes_out.getvalue()             # <<<<<<<<<<<<<<
 *         f = _getFSPathOrObject(f)
 *         if _isString(f):
*/
      __pyx_t_3 = __pyx_v_bytes_out;
      __Pyx_INCREF(__pyx_t_3);
      __pyx_t_6 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
        __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_getvalue, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 640, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
      }
      __Pyx_DECREF_SET(__pyx_v_data, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "src/lxml/serializer.pxi":636
 *     if c_method == OUTPUT_METHOD_TEXT:
 *         data = _textToString(element._c_node, encoding, with_tail)
 *         if compression:             # <<<<<<<<<<<<<<
 *             bytes_out = BytesIO()
 *             with GzipFile(fileobj=bytes_out, mode='wb', compresslevel=compression) as gzip_file:
*/
    }

    /* "src/lxml/serializer.pxi":641
 *                 gzip_file.write(data)
 *             data = bytes_out.getvalue()
 *         f = _getFSPathOrObject(f)             # <<<<<<<<<<<<<<
 *         if _isString(f):
 *             filename8 = _encodeFilename(f)
*/
    __pyx_t_4 = __pyx_f_4lxml_5etree__getFSPathOrObject(__pyx_v_f); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 641, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v_f, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "src/lxml/serializer.pxi":642
 *             data = bytes_out.getvalue()
 *         f = _getFSPathOrObject(f)
 *         if _isString(f):             # <<<<<<<<<<<<<<
 *             filename8 = _encodeFilename(f)
 *             with open(filename8, 'wb') as f:
*/
    __pyx_t_14 = _isString(__pyx_v_f);
    if (__pyx_t_14) {

      /* "src/lxml/serializer.pxi":643
 *         f = _getFSPathOrObject(f)
 *         if _isString(f):
 *             filename8 = _encodeFilename(f)             # <<<<<<<<<<<<<<
 *             with open(filename8, 'wb') as f:
 *                 f.write(data)
*/
      __pyx_t_4 = __pyx_f_4lxml_5etree__encodeFilename(__pyx_v_f); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 643, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_v_filename8 = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "src/lxml/serializer.pxi":644
 *         if _isString(f):
 *             filename8 = _encodeFilename(f)
 *             with open(filename8, 'wb') as f:             # <<<<<<<<<<<<<<
 *                 f.write(data)
 *         else:
*/
      /*with:*/ {
        __pyx_t_3 = NULL;
        __pyx_t_6 = 1;
        {
          PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_v_filename8, __pyx_mstate_global->__pyx_n_u_wb};
          __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_open, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 644, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
        }
        __pyx_t_9 = __Pyx_PyObject_LookupSpecial(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 644, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_7 = NULL;
        __pyx_t_8 = __Pyx_PyObject_LookupSpecial(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_enter); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 644, __pyx_L20_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_6 = 1;
        #if CYTHON_UNPACK_METHODS
        if (likely(PyMethod_Check(__pyx_t_8))) {
          __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8);
          assert(__pyx_t_7);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_8);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_8, __pyx__function);
          __pyx_t_6 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_7, NULL};
          __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_8, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 644, __pyx_L20_error)
          __Pyx_GOTREF(__pyx_t_3);
        }
        __pyx_t_8 = __pyx_t_3;
        __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        /*try:*/ {
          {
            __Pyx_PyThreadState_declare
            __Pyx_PyThreadState_assign
            __Pyx_ExceptionSave(&__pyx_t_12, &__pyx_t_11, &__pyx_t_10);
            __Pyx_XGOTREF(__pyx_t_12);
            __Pyx_XGOTREF(__pyx_t_11);
            __Pyx_XGOTREF(__pyx_t_10);
            /*try:*/ {
              __Pyx_DECREF_SET(__pyx_v_f, __pyx_t_8);
              __pyx_t_8 = 0;

              /* "src/lxml/serializer.pxi":645
 *             filename8 = _encodeFilename(f)
 *             with open(filename8, 'wb') as f:
 *                 f.write(data)             # <<<<<<<<<<<<<<
 *         else:
 *             f.write(data)
*/
              __pyx_t_4 = __pyx_v_f;
              __Pyx_INCREF(__pyx_t_4);
              __pyx_t_6 = 0;
              {
                PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_data};
                __pyx_t_8 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_write, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
                __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
                if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 645, __pyx_L24_error)
                __Pyx_GOTREF(__pyx_t_8);
              }
              __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

              /* "src/lxml/serializer.pxi":644
 *         if _isString(f):
 *             filename8 = _encodeFilename(f)
 *             with open(filename8, 'wb') as f:             # <<<<<<<<<<<<<<
 *                 f.write(data)
 *         else:
*/
            }
            __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
            __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
            __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
            goto __pyx_L29_try_end;
            __pyx_L24_error:;
            __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
            __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
            __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
            __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
            /*except:*/ {
              __Pyx_AddTraceback("lxml.etree._tofilelike", __pyx_clineno, __pyx_lineno, __pyx_filename);
              if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_4, &__pyx_t_3) < 0) __PYX_ERR(6, 644, __pyx_L26_except_error)
              __Pyx_XGOTREF(__pyx_t_8);
              __Pyx_XGOTREF(__pyx_t_4);
              __Pyx_XGOTREF(__pyx_t_3);
              __pyx_t_7 = PyTuple_Pack(3, __pyx_t_8, __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 644, __pyx_L26_except_error)
              __Pyx_GOTREF(__pyx_t_7);
              __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_7, NULL);
              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
              __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
              if (unlikely(!__pyx_t_13)) __PYX_ERR(6, 644, __pyx_L26_except_error)
              __Pyx_GOTREF(__pyx_t_13);
              __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_13);
              __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
              if (__pyx_t_14 < (0)) __PYX_ERR(6, 644, __pyx_L26_except_error)
              __pyx_t_2 = (!__pyx_t_14);
              if (unlikely(__pyx_t_2)) {
                __Pyx_GIVEREF(__pyx_t_8);
                __Pyx_GIVEREF(__pyx_t_4);
                __Pyx_XGIVEREF(__pyx_t_3);
                __Pyx_ErrRestoreWithState(__pyx_t_8, __pyx_t_4, __pyx_t_3);
                __pyx_t_8 = 0;  __pyx_t_4 = 0;  __pyx_t_3 = 0; 
                __PYX_ERR(6, 644, __pyx_L26_except_error)
              }
              __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
              __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
              __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
              goto __pyx_L25_exception_handled;
            }
            __pyx_L26_except_error:;
            __Pyx_XGIVEREF(__pyx_t_12);
            __Pyx_XGIVEREF(__pyx_t_11);
            __Pyx_XGIVEREF(__pyx_t_10);
            __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_11, __pyx_t_10);
            goto __pyx_L1_error;
            __pyx_L25_exception_handled:;
            __Pyx_XGIVEREF(__pyx_t_12);
            __Pyx_XGIVEREF(__pyx_t_11);
            __Pyx_XGIVEREF(__pyx_t_10);
            __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_11, __pyx_t_10);
            __pyx_L29_try_end:;
          }
        }
        /*finally:*/ {
          /*normal exit:*/{
            if (__pyx_t_9) {
              __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_mstate_global->__pyx_tuple[3], NULL);
              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
              if (unlikely(!__pyx_t_10)) __PYX_ERR(6, 644, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_10);
              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
            }
            goto __pyx_L23;
          }
          __pyx_L23:;
        }
        goto __pyx_L33;
        __pyx_L20_error:;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L1_error;
        __pyx_L33:;
      }

      /* "src/lxml/serializer.pxi":642
 *             data = bytes_out.getvalue()
 *         f = _getFSPathOrObject(f)
 *         if _isString(f):             # <<<<<<<<<<<<<<
 *             filename8 = _encodeFilename(f)
 *             with open(filename8, 'wb') as f:
*/
      goto __pyx_L19;
    }

    /* "src/lxml/serializer.pxi":647
 *                 f.write(data)
 *         else:
 *             f.write(data)             # <<<<<<<<<<<<<<
 *         return
 * 
*/
    /*else*/ {
      __pyx_t_4 = __pyx_v_f;
      __Pyx_INCREF(__pyx_t_4);
      __pyx_t_6 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_data};
        __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_write, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 647, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __pyx_L19:;

    /* "src/lxml/serializer.pxi":648
 *         else:
 *             f.write(data)
 *         return             # <<<<<<<<<<<<<<
 * 
 *     if encoding is None:
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/serializer.pxi":634
 * 
 *     c_method = _findOutputMethod(method)
 *     if c_method == OUTPUT_METHOD_TEXT:             # <<<<<<<<<<<<<<
 *         data = _textToString(element._c_node, encoding, with_tail)
 *         if compression:
*/
  }

  /* "src/lxml/serializer.pxi":650
 *         return
 * 
 *     if encoding is None:             # <<<<<<<<<<<<<<
 *         c_enc = NULL
 *     else:
*/
  __pyx_t_2 = (__pyx_v_encoding == Py_None);
  if (__pyx_t_2) {

    /* "src/lxml/serializer.pxi":651
 * 
 *     if encoding is None:
 *         c_enc = NULL             # <<<<<<<<<<<<<<
 *     else:
 *         encoding = _utf8(encoding)
*/
    __pyx_v_c_enc = NULL;

    /* "src/lxml/serializer.pxi":650
 *         return
 * 
 *     if encoding is None:             # <<<<<<<<<<<<<<
 *         c_enc = NULL
 *     else:
*/
    goto __pyx_L34;
  }

  /* "src/lxml/serializer.pxi":653
 *         c_enc = NULL
 *     else:
 *         encoding = _utf8(encoding)             # <<<<<<<<<<<<<<
 *         c_enc = _cstr(encoding)
 *     if doctype is None:
*/
  /*else*/ {
    __pyx_t_3 = __pyx_f_4lxml_5etree__utf8(__pyx_v_encoding); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 653, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_encoding, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":654
 *     else:
 *         encoding = _utf8(encoding)
 *         c_enc = _cstr(encoding)             # <<<<<<<<<<<<<<
 *     if doctype is None:
 *         c_doctype = NULL
*/
    __pyx_v_c_enc = PyBytes_AS_STRING(__pyx_v_encoding);
  }
  __pyx_L34:;

  /* "src/lxml/serializer.pxi":655
 *         encoding = _utf8(encoding)
 *         c_enc = _cstr(encoding)
 *     if doctype is None:             # <<<<<<<<<<<<<<
 *         c_doctype = NULL
 *     else:
*/
  __pyx_t_2 = (__pyx_v_doctype == Py_None);
  if (__pyx_t_2) {

    /* "src/lxml/serializer.pxi":656
 *         c_enc = _cstr(encoding)
 *     if doctype is None:
 *         c_doctype = NULL             # <<<<<<<<<<<<<<
 *     else:
 *         doctype = _utf8(doctype)
*/
    __pyx_v_c_doctype = NULL;

    /* "src/lxml/serializer.pxi":655
 *         encoding = _utf8(encoding)
 *         c_enc = _cstr(encoding)
 *     if doctype is None:             # <<<<<<<<<<<<<<
 *         c_doctype = NULL
 *     else:
*/
    goto __pyx_L35;
  }

  /* "src/lxml/serializer.pxi":658
 *         c_doctype = NULL
 *     else:
 *         doctype = _utf8(doctype)             # <<<<<<<<<<<<<<
 *         c_doctype = _xcstr(doctype)
 * 
*/
  /*else*/ {
    __pyx_t_3 = __pyx_f_4lxml_5etree__utf8(__pyx_v_doctype); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 658, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_doctype, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":659
 *     else:
 *         doctype = _utf8(doctype)
 *         c_doctype = _xcstr(doctype)             # <<<<<<<<<<<<<<
 * 
 *     writer = _create_output_buffer(f, c_enc, compression, &c_buffer, close=False)
*/
    __pyx_v_c_doctype = (const xmlChar*)PyBytes_AS_STRING(__pyx_v_doctype);
  }
  __pyx_L35:;

  /* "src/lxml/serializer.pxi":661
 *         c_doctype = _xcstr(doctype)
 * 
 *     writer = _create_output_buffer(f, c_enc, compression, &c_buffer, close=False)             # <<<<<<<<<<<<<<
 *     if writer is None:
 *         with nogil:
*/
  __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__create_output_buffer(__pyx_v_f, __pyx_v_c_enc, __pyx_v_compression, (&__pyx_v_c_buffer), 0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 661, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF_SET(__pyx_v_writer, ((struct __pyx_obj_4lxml_5etree__FilelikeWriter *)__pyx_t_3));
  __pyx_t_3 = 0;

  /* "src/lxml/serializer.pxi":662
 * 
 *     writer = _create_output_buffer(f, c_enc, compression, &c_buffer, close=False)
 *     if writer is None:             # <<<<<<<<<<<<<<
 *         with nogil:
 *             error_result = _serialise_node(
*/
  __pyx_t_2 = (((PyObject *)__pyx_v_writer) == Py_None);
  if (__pyx_t_2) {

    /* "src/lxml/serializer.pxi":663
 *     writer = _create_output_buffer(f, c_enc, compression, &c_buffer, close=False)
 *     if writer is None:
 *         with nogil:             # <<<<<<<<<<<<<<
 *             error_result = _serialise_node(
 *                 c_buffer, c_doctype, c_enc, element._c_node, c_method,
*/
    {
        PyThreadState * _save;
        _save = PyEval_SaveThread();
        __Pyx_FastGIL_Remember();
        /*try:*/ {

          /* "src/lxml/serializer.pxi":664
 *     if writer is None:
 *         with nogil:
 *             error_result = _serialise_node(             # <<<<<<<<<<<<<<
 *                 c_buffer, c_doctype, c_enc, element._c_node, c_method,
 *                 write_xml_declaration, write_doctype, pretty_print, with_tail, standalone)
*/
          __pyx_v_error_result = __pyx_f_4lxml_5etree__serialise_node(__pyx_v_c_buffer, __pyx_v_c_doctype, __pyx_v_c_enc, __pyx_v_element->_c_node, __pyx_v_c_method, __pyx_v_write_xml_declaration, __pyx_v_write_doctype, __pyx_v_pretty_print, __pyx_v_with_tail, __pyx_v_standalone);
        }

        /* "src/lxml/serializer.pxi":663
 *     writer = _create_output_buffer(f, c_enc, compression, &c_buffer, close=False)
 *     if writer is None:
 *         with nogil:             # <<<<<<<<<<<<<<
 *             error_result = _serialise_node(
 *                 c_buffer, c_doctype, c_enc, element._c_node, c_method,
*/
        /*finally:*/ {
          /*normal exit:*/{
            __Pyx_FastGIL_Forget();
            PyEval_RestoreThread(_save);
            goto __pyx_L39;
          }
          __pyx_L39:;
        }
    }

    /* "src/lxml/serializer.pxi":662
 * 
 *     writer = _create_output_buffer(f, c_enc, compression, &c_buffer, close=False)
 *     if writer is None:             # <<<<<<<<<<<<<<
 *         with nogil:
 *             error_result = _serialise_node(
*/
    goto __pyx_L36;
  }

  /* "src/lxml/serializer.pxi":668
 *                 write_xml_declaration, write_doctype, pretty_print, with_tail, standalone)
 *     else:
 *         error_result = _serialise_node(             # <<<<<<<<<<<<<<
 *             c_buffer, c_doctype, c_enc, element._c_node, c_method,
 *             write_xml_declaration, write_doctype, pretty_print, with_tail, standalone)
*/
  /*else*/ {

    /* "src/lxml/serializer.pxi":670
 *         error_result = _serialise_node(
 *             c_buffer, c_doctype, c_enc, element._c_node, c_method,
 *             write_xml_declaration, write_doctype, pretty_print, with_tail, standalone)             # <<<<<<<<<<<<<<
 * 
 *     if writer is not None:
*/
    __pyx_v_error_result = __pyx_f_4lxml_5etree__serialise_node(__pyx_v_c_buffer, __pyx_v_c_doctype, __pyx_v_c_enc, __pyx_v_element->_c_node, __pyx_v_c_method, __pyx_v_write_xml_declaration, __pyx_v_write_doctype, __pyx_v_pretty_print, __pyx_v_with_tail, __pyx_v_standalone);
  }
  __pyx_L36:;

  /* "src/lxml/serializer.pxi":672
 *             write_xml_declaration, write_doctype, pretty_print, with_tail, standalone)
 * 
 *     if writer is not None:             # <<<<<<<<<<<<<<
 *         writer._exc_context._raise_if_stored()
 *     if error_result != xmlerror.XML_ERR_OK:
*/
  __pyx_t_2 = (((PyObject *)__pyx_v_writer) != Py_None);
  if (__pyx_t_2) {

    /* "src/lxml/serializer.pxi":673
 * 
 *     if writer is not None:
 *         writer._exc_context._raise_if_stored()             # <<<<<<<<<<<<<<
 *     if error_result != xmlerror.XML_ERR_OK:
 *         _raiseSerialisationError(error_result)
*/
    __pyx_t_1 = __pyx_f_4lxml_5etree_17_ExceptionContext__raise_if_stored(__pyx_v_writer->_exc_context); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(6, 673, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":672
 *             write_xml_declaration, write_doctype, pretty_print, with_tail, standalone)
 * 
 *     if writer is not None:             # <<<<<<<<<<<<<<
 *         writer._exc_context._raise_if_stored()
 *     if error_result != xmlerror.XML_ERR_OK:
*/
  }

  /* "src/lxml/serializer.pxi":674
 *     if writer is not None:
 *         writer._exc_context._raise_if_stored()
 *     if error_result != xmlerror.XML_ERR_OK:             # <<<<<<<<<<<<<<
 *         _raiseSerialisationError(error_result)
 * 
*/
  __pyx_t_2 = (__pyx_v_error_result != XML_ERR_OK);
  if (__pyx_t_2) {

    /* "src/lxml/serializer.pxi":675
 *         writer._exc_context._raise_if_stored()
 *     if error_result != xmlerror.XML_ERR_OK:
 *         _raiseSerialisationError(error_result)             # <<<<<<<<<<<<<<
 * 
 * 
*/
    __pyx_t_3 = __pyx_f_4lxml_5etree__raiseSerialisationError(__pyx_v_error_result); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 675, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":674
 *     if writer is not None:
 *         writer._exc_context._raise_if_stored()
 *     if error_result != xmlerror.XML_ERR_OK:             # <<<<<<<<<<<<<<
 *         _raiseSerialisationError(error_result)
 * 
*/
  }

  /* "src/lxml/serializer.pxi":622
 *     return (<_FilelikeWriter>ctxt).close()
 * 
 * cdef _tofilelike(f, _Element element, encoding, doctype, method,             # <<<<<<<<<<<<<<
 *                  bint write_xml_declaration, bint write_doctype,
 *                  bint pretty_print, bint with_tail, int standalone,
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("lxml.etree._tofilelike", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_writer);
  __Pyx_XDECREF(__pyx_v_data);
  __Pyx_XDECREF(__pyx_v_bytes_out);
  __Pyx_XDECREF(__pyx_v_gzip_file);
  __Pyx_XDECREF(__pyx_v_filename8);
  __Pyx_XDECREF(__pyx_v_f);
  __Pyx_XDECREF(__pyx_v_encoding);
  __Pyx_XDECREF(__pyx_v_doctype);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":678
 * 
 * 
 * cdef int _serialise_node(tree.xmlOutputBuffer* c_buffer, const_xmlChar* c_doctype,             # <<<<<<<<<<<<<<
 *                          const_char* c_enc, xmlNode* c_node, int c_method,
 *                          bint write_xml_declaration, bint write_doctype, bint pretty_print,
*/

static int __pyx_f_4lxml_5etree__serialise_node(xmlOutputBuffer *__pyx_v_c_buffer, const xmlChar *__pyx_v_c_doctype, const char *__pyx_v_c_enc, xmlNode *__pyx_v_c_node, int __pyx_v_c_method, int __pyx_v_write_xml_declaration, int __pyx_v_write_doctype, int __pyx_v_pretty_print, int __pyx_v_with_tail, int __pyx_v_standalone) {
  int __pyx_v_error_result;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;

  /* "src/lxml/serializer.pxi":682
 *                          bint write_xml_declaration, bint write_doctype, bint pretty_print,
 *                          bint with_tail, int standalone) noexcept nogil:
 *     _writeNodeToBuffer(             # <<<<<<<<<<<<<<
 *         c_buffer, c_node, c_enc, c_doctype, c_method,
 *         write_xml_declaration, write_doctype, pretty_print, with_tail, standalone)
*/
  __pyx_f_4lxml_5etree__writeNodeToBuffer(__pyx_v_c_buffer, __pyx_v_c_node, __pyx_v_c_enc, __pyx_v_c_doctype, __pyx_v_c_method, __pyx_v_write_xml_declaration, __pyx_v_write_doctype, __pyx_v_pretty_print, __pyx_v_with_tail, __pyx_v_standalone);

  /* "src/lxml/serializer.pxi":685
 *         c_buffer, c_node, c_enc, c_doctype, c_method,
 *         write_xml_declaration, write_doctype, pretty_print, with_tail, standalone)
 *     error_result = c_buffer.error             # <<<<<<<<<<<<<<
 *     if error_result == xmlerror.XML_ERR_OK:
 *         error_result = tree.xmlOutputBufferClose(c_buffer)
*/
  __pyx_t_1 = __pyx_v_c_buffer->error;
  __pyx_v_error_result = __pyx_t_1;

  /* "src/lxml/serializer.pxi":686
 *         write_xml_declaration, write_doctype, pretty_print, with_tail, standalone)
 *     error_result = c_buffer.error
 *     if error_result == xmlerror.XML_ERR_OK:             # <<<<<<<<<<<<<<
 *         error_result = tree.xmlOutputBufferClose(c_buffer)
 *         if error_result != -1:
*/
  __pyx_t_2 = (__pyx_v_error_result == XML_ERR_OK);
  if (__pyx_t_2) {

    /* "src/lxml/serializer.pxi":687
 *     error_result = c_buffer.error
 *     if error_result == xmlerror.XML_ERR_OK:
 *         error_result = tree.xmlOutputBufferClose(c_buffer)             # <<<<<<<<<<<<<<
 *         if error_result != -1:
 *             error_result = xmlerror.XML_ERR_OK
*/
    __pyx_v_error_result = xmlOutputBufferClose(__pyx_v_c_buffer);

    /* "src/lxml/serializer.pxi":688
 *     if error_result == xmlerror.XML_ERR_OK:
 *         error_result = tree.xmlOutputBufferClose(c_buffer)
 *         if error_result != -1:             # <<<<<<<<<<<<<<
 *             error_result = xmlerror.XML_ERR_OK
 *     else:
*/
    __pyx_t_2 = (__pyx_v_error_result != -1L);
    if (__pyx_t_2) {

      /* "src/lxml/serializer.pxi":689
 *         error_result = tree.xmlOutputBufferClose(c_buffer)
 *         if error_result != -1:
 *             error_result = xmlerror.XML_ERR_OK             # <<<<<<<<<<<<<<
 *     else:
 *         tree.xmlOutputBufferClose(c_buffer)
*/
      __pyx_v_error_result = XML_ERR_OK;

      /* "src/lxml/serializer.pxi":688
 *     if error_result == xmlerror.XML_ERR_OK:
 *         error_result = tree.xmlOutputBufferClose(c_buffer)
 *         if error_result != -1:             # <<<<<<<<<<<<<<
 *             error_result = xmlerror.XML_ERR_OK
 *     else:
*/
    }

    /* "src/lxml/serializer.pxi":686
 *         write_xml_declaration, write_doctype, pretty_print, with_tail, standalone)
 *     error_result = c_buffer.error
 *     if error_result == xmlerror.XML_ERR_OK:             # <<<<<<<<<<<<<<
 *         error_result = tree.xmlOutputBufferClose(c_buffer)
 *         if error_result != -1:
*/
    goto __pyx_L3;
  }

  /* "src/lxml/serializer.pxi":691
 *             error_result = xmlerror.XML_ERR_OK
 *     else:
 *         tree.xmlOutputBufferClose(c_buffer)             # <<<<<<<<<<<<<<
 *     return error_result
 * 
*/
  /*else*/ {
    (void)(xmlOutputBufferClose(__pyx_v_c_buffer));
  }
  __pyx_L3:;

  /* "src/lxml/serializer.pxi":692
 *     else:
 *         tree.xmlOutputBufferClose(c_buffer)
 *     return error_result             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = __pyx_v_error_result;
  goto __pyx_L0;

  /* "src/lxml/serializer.pxi":678
 * 
 * 
 * cdef int _serialise_node(tree.xmlOutputBuffer* c_buffer, const_xmlChar* c_doctype,             # <<<<<<<<<<<<<<
 *                          const_char* c_enc, xmlNode* c_node, int c_method,
 *                          bint write_xml_declaration, bint write_doctype, bint pretty_print,
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":695
 * 
 * 
 * cdef _FilelikeWriter _create_output_buffer(             # <<<<<<<<<<<<<<
 *         f, const_char* c_enc, int c_compression,
 *         tree.xmlOutputBuffer** c_buffer_ret, bint close):
*/

static struct __pyx_obj_4lxml_5etree__FilelikeWriter *__pyx_f_4lxml_5etree__create_output_buffer(PyObject *__pyx_v_f, const char *__pyx_v_c_enc, int __pyx_v_c_compression, xmlOutputBuffer **__pyx_v_c_buffer_ret, int __pyx_v_close) {
  xmlOutputBuffer *__pyx_v_c_buffer;
  struct __pyx_obj_4lxml_5etree__FilelikeWriter *__pyx_v_writer = 0;
  PyObject *__pyx_v_filename8 = 0;
  xmlCharEncodingHandler *__pyx_v_enchandler;
  struct __pyx_obj_4lxml_5etree__FilelikeWriter *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7[3];
  size_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  xmlChar const *__pyx_t_13;
  int __pyx_t_14;
  int __pyx_t_15;
  PyObject *__pyx_t_16 = NULL;
  xmlOutputBuffer *__pyx_t_17;
  const char *__pyx_t_18;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_create_output_buffer", 0);
  __Pyx_INCREF(__pyx_v_f);

  /* "src/lxml/serializer.pxi":701
 *     cdef _FilelikeWriter writer
 *     cdef bytes filename8
 *     enchandler = tree.xmlFindCharEncodingHandler(c_enc)             # <<<<<<<<<<<<<<
 *     if enchandler is NULL:
 *         raise LookupError(
*/
  __pyx_v_enchandler = xmlFindCharEncodingHandler(__pyx_v_c_enc);

  /* "src/lxml/serializer.pxi":702
 *     cdef bytes filename8
 *     enchandler = tree.xmlFindCharEncodingHandler(c_enc)
 *     if enchandler is NULL:             # <<<<<<<<<<<<<<
 *         raise LookupError(
 *             f"unknown encoding: '{c_enc.decode('UTF-8') if c_enc is not NULL else u''}'")
*/
  __pyx_t_1 = (__pyx_v_enchandler == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/serializer.pxi":703
 *     enchandler = tree.xmlFindCharEncodingHandler(c_enc)
 *     if enchandler is NULL:
 *         raise LookupError(             # <<<<<<<<<<<<<<
 *             f"unknown encoding: '{c_enc.decode('UTF-8') if c_enc is not NULL else u''}'")
 *     try:
*/
    __pyx_t_3 = NULL;

    /* "src/lxml/serializer.pxi":704
 *     if enchandler is NULL:
 *         raise LookupError(
 *             f"unknown encoding: '{c_enc.decode('UTF-8') if c_enc is not NULL else u''}'")             # <<<<<<<<<<<<<<
 *     try:
 *         f = _getFSPathOrObject(f)
*/
    __pyx_t_1 = (__pyx_v_c_enc != NULL);
    if (__pyx_t_1) {
      __pyx_t_5 = __Pyx_ssize_strlen(__pyx_v_c_enc); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(6, 704, __pyx_L1_error)
      __pyx_t_6 = __Pyx_decode_c_string(__pyx_v_c_enc, 0, __pyx_t_5, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 704, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_4 = __pyx_t_6;
      __pyx_t_6 = 0;
    } else {
      __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u__8);
      __pyx_t_4 = __pyx_mstate_global->__pyx_kp_u__8;
    }
    __pyx_t_6 = __Pyx_PyUnicode_Unicode(__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 704, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_7[0] = __pyx_mstate_global->__pyx_kp_u_unknown_encoding;
    __pyx_t_7[1] = __pyx_t_6;
    __pyx_t_7[2] = __pyx_mstate_global->__pyx_kp_u__4;
    __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_7, 3, 19 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6));
    if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 704, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_8 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_4};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_LookupError)), __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 703, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(6, 703, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":702
 *     cdef bytes filename8
 *     enchandler = tree.xmlFindCharEncodingHandler(c_enc)
 *     if enchandler is NULL:             # <<<<<<<<<<<<<<
 *         raise LookupError(
 *             f"unknown encoding: '{c_enc.decode('UTF-8') if c_enc is not NULL else u''}'")
*/
  }

  /* "src/lxml/serializer.pxi":705
 *         raise LookupError(
 *             f"unknown encoding: '{c_enc.decode('UTF-8') if c_enc is not NULL else u''}'")
 *     try:             # <<<<<<<<<<<<<<
 *         f = _getFSPathOrObject(f)
 * 
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
    __Pyx_XGOTREF(__pyx_t_9);
    __Pyx_XGOTREF(__pyx_t_10);
    __Pyx_XGOTREF(__pyx_t_11);
    /*try:*/ {

      /* "src/lxml/serializer.pxi":706
 *             f"unknown encoding: '{c_enc.decode('UTF-8') if c_enc is not NULL else u''}'")
 *     try:
 *         f = _getFSPathOrObject(f)             # <<<<<<<<<<<<<<
 * 
 *         if c_compression and not HAS_ZLIB_COMPRESSION and _isString(f):
*/
      __pyx_t_2 = __pyx_f_4lxml_5etree__getFSPathOrObject(__pyx_v_f); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 706, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF_SET(__pyx_v_f, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "src/lxml/serializer.pxi":708
 *         f = _getFSPathOrObject(f)
 * 
 *         if c_compression and not HAS_ZLIB_COMPRESSION and _isString(f):             # <<<<<<<<<<<<<<
 *             # Let "_FilelikeWriter" fall back to Python's GzipFile.
 *             f = open(f, mode="wb")
*/
      __pyx_t_12 = (__pyx_v_c_compression != 0);
      if (__pyx_t_12) {
      } else {
        __pyx_t_1 = __pyx_t_12;
        goto __pyx_L11_bool_binop_done;
      }
      __pyx_t_12 = (!__pyx_v_4lxml_5etree_HAS_ZLIB_COMPRESSION);
      if (__pyx_t_12) {
      } else {
        __pyx_t_1 = __pyx_t_12;
        goto __pyx_L11_bool_binop_done;
      }
      __pyx_t_12 = _isString(__pyx_v_f);
      __pyx_t_1 = __pyx_t_12;
      __pyx_L11_bool_binop_done:;
      if (__pyx_t_1) {

        /* "src/lxml/serializer.pxi":710
 *         if c_compression and not HAS_ZLIB_COMPRESSION and _isString(f):
 *             # Let "_FilelikeWriter" fall back to Python's GzipFile.
 *             f = open(f, mode="wb")             # <<<<<<<<<<<<<<
 *             close = True
 * 
*/
        __pyx_t_4 = NULL;
        __pyx_t_8 = 1;
        {
          PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_4, __pyx_v_f};
          __pyx_t_3 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 710, __pyx_L4_error)
          __Pyx_GOTREF(__pyx_t_3);
          if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_mode, __pyx_mstate_global->__pyx_n_u_wb, __pyx_t_3, __pyx_callargs+2, 0) < (0)) __PYX_ERR(6, 710, __pyx_L4_error)
          __pyx_t_2 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_builtin_open, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_3);
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 710, __pyx_L4_error)
          __Pyx_GOTREF(__pyx_t_2);
        }
        __Pyx_DECREF_SET(__pyx_v_f, __pyx_t_2);
        __pyx_t_2 = 0;

        /* "src/lxml/serializer.pxi":711
 *             # Let "_FilelikeWriter" fall back to Python's GzipFile.
 *             f = open(f, mode="wb")
 *             close = True             # <<<<<<<<<<<<<<
 * 
 *         if _isString(f):
*/
        __pyx_v_close = 1;

        /* "src/lxml/serializer.pxi":708
 *         f = _getFSPathOrObject(f)
 * 
 *         if c_compression and not HAS_ZLIB_COMPRESSION and _isString(f):             # <<<<<<<<<<<<<<
 *             # Let "_FilelikeWriter" fall back to Python's GzipFile.
 *             f = open(f, mode="wb")
*/
      }

      /* "src/lxml/serializer.pxi":713
 *             close = True
 * 
 *         if _isString(f):             # <<<<<<<<<<<<<<
 *             filename8 = _encodeFilename(f)
 *             if b'%' in filename8 and (
*/
      __pyx_t_1 = _isString(__pyx_v_f);
      if (__pyx_t_1) {

        /* "src/lxml/serializer.pxi":714
 * 
 *         if _isString(f):
 *             filename8 = _encodeFilename(f)             # <<<<<<<<<<<<<<
 *             if b'%' in filename8 and (
 *                     # Exclude absolute Windows paths and file:// URLs.
*/
        __pyx_t_2 = __pyx_f_4lxml_5etree__encodeFilename(__pyx_v_f); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 714, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_2);
        if (!(likely(PyBytes_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_2))) __PYX_ERR(6, 714, __pyx_L4_error)
        __pyx_v_filename8 = ((PyObject*)__pyx_t_2);
        __pyx_t_2 = 0;

        /* "src/lxml/serializer.pxi":715
 *         if _isString(f):
 *             filename8 = _encodeFilename(f)
 *             if b'%' in filename8 and (             # <<<<<<<<<<<<<<
 *                     # Exclude absolute Windows paths and file:// URLs.
 *                     _isFilePath(<const xmlChar*>filename8) not in (NO_FILE_PATH, ABS_WIN_FILE_PATH)
*/
        __pyx_t_12 = (__Pyx_PySequence_ContainsTF(__pyx_mstate_global->__pyx_kp_b__36, __pyx_v_filename8, Py_EQ)); if (unlikely((__pyx_t_12 < 0))) __PYX_ERR(6, 715, __pyx_L4_error)
        if (__pyx_t_12) {
        } else {
          __pyx_t_1 = __pyx_t_12;
          goto __pyx_L16_bool_binop_done;
        }

        /* "src/lxml/serializer.pxi":717
 *             if b'%' in filename8 and (
 *                     # Exclude absolute Windows paths and file:// URLs.
 *                     _isFilePath(<const xmlChar*>filename8) not in (NO_FILE_PATH, ABS_WIN_FILE_PATH)             # <<<<<<<<<<<<<<
 *                     or filename8[:7].lower() == b'file://'):
 *                 # A file path (not a URL) containing the '%' URL escape character.
*/
        if (unlikely(__pyx_v_filename8 == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
          __PYX_ERR(6, 717, __pyx_L4_error)
        }
        __pyx_t_13 = __Pyx_PyBytes_AsUString(__pyx_v_filename8); if (unlikely((!__pyx_t_13) && PyErr_Occurred())) __PYX_ERR(6, 717, __pyx_L4_error)
        __pyx_t_12 = __pyx_f_4lxml_5etree__isFilePath(((xmlChar const *)__pyx_t_13));
        __pyx_t_15 = (__pyx_t_12 != __pyx_e_4lxml_5etree_NO_FILE_PATH);
        if (__pyx_t_15) {
        } else {
          __pyx_t_14 = __pyx_t_15;
          goto __pyx_L19_bool_binop_done;
        }
        __pyx_t_15 = (__pyx_t_12 != __pyx_e_4lxml_5etree_ABS_WIN_FILE_PATH);
        __pyx_t_14 = __pyx_t_15;
        __pyx_L19_bool_binop_done:;
        __pyx_t_12 = __pyx_t_14;
        if (!__pyx_t_12) {
        } else {
          __pyx_t_1 = __pyx_t_12;
          goto __pyx_L16_bool_binop_done;
        }

        /* "src/lxml/serializer.pxi":718
 *                     # Exclude absolute Windows paths and file:// URLs.
 *                     _isFilePath(<const xmlChar*>filename8) not in (NO_FILE_PATH, ABS_WIN_FILE_PATH)
 *                     or filename8[:7].lower() == b'file://'):             # <<<<<<<<<<<<<<
 *                 # A file path (not a URL) containing the '%' URL escape character.
 *                 # libxml2 uses URL-unescaping on these, so escape the path before passing it in.
*/
        if (unlikely(__pyx_v_filename8 == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(6, 718, __pyx_L4_error)
        }
        __pyx_t_4 = PySequence_GetSlice(__pyx_v_filename8, 0, 7); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 718, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_3 = __pyx_t_4;
        __Pyx_INCREF(__pyx_t_3);
        __pyx_t_8 = 0;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
          __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_lower, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 718, __pyx_L4_error)
          __Pyx_GOTREF(__pyx_t_2);
        }
        __pyx_t_12 = (__Pyx_PyBytes_Equals(__pyx_t_2, __pyx_mstate_global->__pyx_kp_b_file_2, Py_EQ)); if (unlikely((__pyx_t_12 < 0))) __PYX_ERR(6, 718, __pyx_L4_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_1 = __pyx_t_12;
        __pyx_L16_bool_binop_done:;

        /* "src/lxml/serializer.pxi":715
 *         if _isString(f):
 *             filename8 = _encodeFilename(f)
 *             if b'%' in filename8 and (             # <<<<<<<<<<<<<<
 *                     # Exclude absolute Windows paths and file:// URLs.
 *                     _isFilePath(<const xmlChar*>filename8) not in (NO_FILE_PATH, ABS_WIN_FILE_PATH)
*/
        if (__pyx_t_1) {

          /* "src/lxml/serializer.pxi":721
 *                 # A file path (not a URL) containing the '%' URL escape character.
 *                 # libxml2 uses URL-unescaping on these, so escape the path before passing it in.
 *                 filename8 = filename8.replace(b'%', b'%25')             # <<<<<<<<<<<<<<
 *             c_buffer = tree.xmlOutputBufferCreateFilename(
 *                 _cstr(filename8), enchandler, c_compression)
*/
          __pyx_t_2 = __Pyx_CallUnboundCMethod2(&__pyx_mstate_global->__pyx_umethod_PyBytes_Type__replace, __pyx_v_filename8, __pyx_mstate_global->__pyx_kp_b__36, __pyx_mstate_global->__pyx_kp_b_25); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 721, __pyx_L4_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF_SET(__pyx_v_filename8, ((PyObject*)__pyx_t_2));
          __pyx_t_2 = 0;

          /* "src/lxml/serializer.pxi":715
 *         if _isString(f):
 *             filename8 = _encodeFilename(f)
 *             if b'%' in filename8 and (             # <<<<<<<<<<<<<<
 *                     # Exclude absolute Windows paths and file:// URLs.
 *                     _isFilePath(<const xmlChar*>filename8) not in (NO_FILE_PATH, ABS_WIN_FILE_PATH)
*/
        }

        /* "src/lxml/serializer.pxi":722
 *                 # libxml2 uses URL-unescaping on these, so escape the path before passing it in.
 *                 filename8 = filename8.replace(b'%', b'%25')
 *             c_buffer = tree.xmlOutputBufferCreateFilename(             # <<<<<<<<<<<<<<
 *                 _cstr(filename8), enchandler, c_compression)
 *             if c_buffer is NULL:
*/
        __pyx_v_c_buffer = xmlOutputBufferCreateFilename(PyBytes_AS_STRING(__pyx_v_filename8), __pyx_v_enchandler, __pyx_v_c_compression);

        /* "src/lxml/serializer.pxi":724
 *             c_buffer = tree.xmlOutputBufferCreateFilename(
 *                 _cstr(filename8), enchandler, c_compression)
 *             if c_buffer is NULL:             # <<<<<<<<<<<<<<
 *                 python.PyErr_SetFromErrno(IOError)  # raises IOError
 *             writer = None
*/
        __pyx_t_1 = (__pyx_v_c_buffer == NULL);
        if (__pyx_t_1) {

          /* "src/lxml/serializer.pxi":725
 *                 _cstr(filename8), enchandler, c_compression)
 *             if c_buffer is NULL:
 *                 python.PyErr_SetFromErrno(IOError)  # raises IOError             # <<<<<<<<<<<<<<
 *             writer = None
 *         elif hasattr(f, 'write'):
*/
          __pyx_t_2 = PyErr_SetFromErrno(((PyObject *)(((PyTypeObject*)PyExc_IOError)))); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 725, __pyx_L4_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

          /* "src/lxml/serializer.pxi":724
 *             c_buffer = tree.xmlOutputBufferCreateFilename(
 *                 _cstr(filename8), enchandler, c_compression)
 *             if c_buffer is NULL:             # <<<<<<<<<<<<<<
 *                 python.PyErr_SetFromErrno(IOError)  # raises IOError
 *             writer = None
*/
        }

        /* "src/lxml/serializer.pxi":726
 *             if c_buffer is NULL:
 *                 python.PyErr_SetFromErrno(IOError)  # raises IOError
 *             writer = None             # <<<<<<<<<<<<<<
 *         elif hasattr(f, 'write'):
 *             writer = _FilelikeWriter(f, compression=c_compression, close=close)
*/
        __Pyx_INCREF(Py_None);
        __pyx_v_writer = ((struct __pyx_obj_4lxml_5etree__FilelikeWriter *)Py_None);

        /* "src/lxml/serializer.pxi":713
 *             close = True
 * 
 *         if _isString(f):             # <<<<<<<<<<<<<<
 *             filename8 = _encodeFilename(f)
 *             if b'%' in filename8 and (
*/
        goto __pyx_L14;
      }

      /* "src/lxml/serializer.pxi":727
 *                 python.PyErr_SetFromErrno(IOError)  # raises IOError
 *             writer = None
 *         elif hasattr(f, 'write'):             # <<<<<<<<<<<<<<
 *             writer = _FilelikeWriter(f, compression=c_compression, close=close)
 *             c_buffer = writer._createOutputBuffer(enchandler)
*/
      __pyx_t_1 = __Pyx_HasAttr(__pyx_v_f, __pyx_mstate_global->__pyx_n_u_write); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(6, 727, __pyx_L4_error)
      if (likely(__pyx_t_1)) {

        /* "src/lxml/serializer.pxi":728
 *             writer = None
 *         elif hasattr(f, 'write'):
 *             writer = _FilelikeWriter(f, compression=c_compression, close=close)             # <<<<<<<<<<<<<<
 *             c_buffer = writer._createOutputBuffer(enchandler)
 *         else:
*/
        __pyx_t_4 = NULL;
        __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_c_compression); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 728, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_6 = __Pyx_PyBool_FromLong(__pyx_v_close); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 728, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_8 = 1;
        {
          PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_4, __pyx_v_f};
          __pyx_t_16 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_16)) __PYX_ERR(6, 728, __pyx_L4_error)
          __Pyx_GOTREF(__pyx_t_16);
          if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_compression, __pyx_t_3, __pyx_t_16, __pyx_callargs+2, 0) < (0)) __PYX_ERR(6, 728, __pyx_L4_error)
          if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_close, __pyx_t_6, __pyx_t_16, __pyx_callargs+2, 1) < (0)) __PYX_ERR(6, 728, __pyx_L4_error)
          __pyx_t_2 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__FilelikeWriter, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_16);
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 728, __pyx_L4_error)
          __Pyx_GOTREF((PyObject *)__pyx_t_2);
        }
        __pyx_v_writer = ((struct __pyx_obj_4lxml_5etree__FilelikeWriter *)__pyx_t_2);
        __pyx_t_2 = 0;

        /* "src/lxml/serializer.pxi":729
 *         elif hasattr(f, 'write'):
 *             writer = _FilelikeWriter(f, compression=c_compression, close=close)
 *             c_buffer = writer._createOutputBuffer(enchandler)             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError(
*/
        __pyx_t_17 = __pyx_f_4lxml_5etree_15_FilelikeWriter__createOutputBuffer(__pyx_v_writer, __pyx_v_enchandler); if (unlikely(__pyx_t_17 == ((void *)NULL))) __PYX_ERR(6, 729, __pyx_L4_error)
        __pyx_v_c_buffer = __pyx_t_17;

        /* "src/lxml/serializer.pxi":727
 *                 python.PyErr_SetFromErrno(IOError)  # raises IOError
 *             writer = None
 *         elif hasattr(f, 'write'):             # <<<<<<<<<<<<<<
 *             writer = _FilelikeWriter(f, compression=c_compression, close=close)
 *             c_buffer = writer._createOutputBuffer(enchandler)
*/
        goto __pyx_L14;
      }

      /* "src/lxml/serializer.pxi":731
 *             c_buffer = writer._createOutputBuffer(enchandler)
 *         else:
 *             raise TypeError(             # <<<<<<<<<<<<<<
 *                 f"File or filename expected, got '{python._fqtypename(f).decode('UTF-8')}'")
 *     except:
*/
      /*else*/ {
        __pyx_t_16 = NULL;

        /* "src/lxml/serializer.pxi":732
 *         else:
 *             raise TypeError(
 *                 f"File or filename expected, got '{python._fqtypename(f).decode('UTF-8')}'")             # <<<<<<<<<<<<<<
 *     except:
 *         tree.xmlCharEncCloseFunc(enchandler)
*/
        __pyx_t_18 = _fqtypename(__pyx_v_f);
        __pyx_t_5 = __Pyx_ssize_strlen(__pyx_t_18); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(6, 732, __pyx_L4_error)
        __pyx_t_6 = __Pyx_decode_c_string(__pyx_t_18, 0, __pyx_t_5, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 732, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_7[0] = __pyx_mstate_global->__pyx_kp_u_File_or_filename_expected_got;
        __pyx_t_7[1] = __pyx_t_6;
        __pyx_t_7[2] = __pyx_mstate_global->__pyx_kp_u__4;
        __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_7, 3, 32 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6));
        if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 732, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_8 = 1;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_16, __pyx_t_3};
          __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 731, __pyx_L4_error)
          __Pyx_GOTREF(__pyx_t_2);
        }
        __Pyx_Raise(__pyx_t_2, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __PYX_ERR(6, 731, __pyx_L4_error)
      }
      __pyx_L14:;

      /* "src/lxml/serializer.pxi":705
 *         raise LookupError(
 *             f"unknown encoding: '{c_enc.decode('UTF-8') if c_enc is not NULL else u''}'")
 *     try:             # <<<<<<<<<<<<<<
 *         f = _getFSPathOrObject(f)
 * 
*/
    }
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    goto __pyx_L9_try_end;
    __pyx_L4_error:;
    __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "src/lxml/serializer.pxi":733
 *             raise TypeError(
 *                 f"File or filename expected, got '{python._fqtypename(f).decode('UTF-8')}'")
 *     except:             # <<<<<<<<<<<<<<
 *         tree.xmlCharEncCloseFunc(enchandler)
 *         raise
*/
    /*except:*/ {
      __Pyx_AddTraceback("lxml.etree._create_output_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_16) < 0) __PYX_ERR(6, 733, __pyx_L6_except_error)
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_16);

      /* "src/lxml/serializer.pxi":734
 *                 f"File or filename expected, got '{python._fqtypename(f).decode('UTF-8')}'")
 *     except:
 *         tree.xmlCharEncCloseFunc(enchandler)             # <<<<<<<<<<<<<<
 *         raise
 *     c_buffer_ret[0] = c_buffer
*/
      (void)(xmlCharEncCloseFunc(__pyx_v_enchandler));

      /* "src/lxml/serializer.pxi":735
 *     except:
 *         tree.xmlCharEncCloseFunc(enchandler)
 *         raise             # <<<<<<<<<<<<<<
 *     c_buffer_ret[0] = c_buffer
 *     return writer
*/
      __Pyx_GIVEREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_16);
      __Pyx_ErrRestoreWithState(__pyx_t_2, __pyx_t_3, __pyx_t_16);
      __pyx_t_2 = 0;  __pyx_t_3 = 0;  __pyx_t_16 = 0; 
      __PYX_ERR(6, 735, __pyx_L6_except_error)
    }

    /* "src/lxml/serializer.pxi":705
 *         raise LookupError(
 *             f"unknown encoding: '{c_enc.decode('UTF-8') if c_enc is not NULL else u''}'")
 *     try:             # <<<<<<<<<<<<<<
 *         f = _getFSPathOrObject(f)
 * 
*/
    __pyx_L6_except_error:;
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_XGIVEREF(__pyx_t_10);
    __Pyx_XGIVEREF(__pyx_t_11);
    __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
    goto __pyx_L1_error;
    __pyx_L9_try_end:;
  }

  /* "src/lxml/serializer.pxi":736
 *         tree.xmlCharEncCloseFunc(enchandler)
 *         raise
 *     c_buffer_ret[0] = c_buffer             # <<<<<<<<<<<<<<
 *     return writer
 * 
*/
  (__pyx_v_c_buffer_ret[0]) = __pyx_v_c_buffer;

  /* "src/lxml/serializer.pxi":737
 *         raise
 *     c_buffer_ret[0] = c_buffer
 *     return writer             # <<<<<<<<<<<<<<
 * 
 * cdef xmlChar **_convert_ns_prefixes(tree.xmlDict* c_dict, ns_prefixes) except NULL:
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_writer);
  __pyx_r = __pyx_v_writer;
  goto __pyx_L0;

  /* "src/lxml/serializer.pxi":695
 * 
 * 
 * cdef _FilelikeWriter _create_output_buffer(             # <<<<<<<<<<<<<<
 *         f, const_char* c_enc, int c_compression,
 *         tree.xmlOutputBuffer** c_buffer_ret, bint close):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_AddTraceback("lxml.etree._create_output_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_writer);
  __Pyx_XDECREF(__pyx_v_filename8);
  __Pyx_XDECREF(__pyx_v_f);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":739
 *     return writer
 * 
 * cdef xmlChar **_convert_ns_prefixes(tree.xmlDict* c_dict, ns_prefixes) except NULL:             # <<<<<<<<<<<<<<
 *     cdef size_t i, num_ns_prefixes = len(ns_prefixes)
 *     # Need to allocate one extra memory block to handle last NULL entry
*/

static xmlChar **__pyx_f_4lxml_5etree__convert_ns_prefixes(xmlDict *__pyx_v_c_dict, PyObject *__pyx_v_ns_prefixes) {
  size_t __pyx_v_i;
  size_t __pyx_v_num_ns_prefixes;
  xmlChar **__pyx_v_c_ns_prefixes;
  PyObject *__pyx_v_prefix = NULL;
  PyObject *__pyx_v_prefix_utf = NULL;
  Py_ssize_t __pyx_v_c_prefix_len;
  const xmlChar *__pyx_v_c_prefix;
  xmlChar **__pyx_r;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyObject *__pyx_t_8 = NULL;
  Py_ssize_t __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  size_t __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_convert_ns_prefixes", 0);

  /* "src/lxml/serializer.pxi":740
 * 
 * cdef xmlChar **_convert_ns_prefixes(tree.xmlDict* c_dict, ns_prefixes) except NULL:
 *     cdef size_t i, num_ns_prefixes = len(ns_prefixes)             # <<<<<<<<<<<<<<
 *     # Need to allocate one extra memory block to handle last NULL entry
 *     c_ns_prefixes = <xmlChar **>python.lxml_malloc(num_ns_prefixes + 1, sizeof(xmlChar*))
*/
  __pyx_t_1 = PyObject_Length(__pyx_v_ns_prefixes); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(6, 740, __pyx_L1_error)
  __pyx_v_num_ns_prefixes = __pyx_t_1;

  /* "src/lxml/serializer.pxi":742
 *     cdef size_t i, num_ns_prefixes = len(ns_prefixes)
 *     # Need to allocate one extra memory block to handle last NULL entry
 *     c_ns_prefixes = <xmlChar **>python.lxml_malloc(num_ns_prefixes + 1, sizeof(xmlChar*))             # <<<<<<<<<<<<<<
 *     if not c_ns_prefixes:
 *         raise MemoryError()
*/
  __pyx_v_c_ns_prefixes = ((xmlChar **)lxml_malloc((__pyx_v_num_ns_prefixes + 1), (sizeof(xmlChar *))));

  /* "src/lxml/serializer.pxi":743
 *     # Need to allocate one extra memory block to handle last NULL entry
 *     c_ns_prefixes = <xmlChar **>python.lxml_malloc(num_ns_prefixes + 1, sizeof(xmlChar*))
 *     if not c_ns_prefixes:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     i = 0
*/
  __pyx_t_2 = (!(__pyx_v_c_ns_prefixes != 0));
  if (unlikely(__pyx_t_2)) {

    /* "src/lxml/serializer.pxi":744
 *     c_ns_prefixes = <xmlChar **>python.lxml_malloc(num_ns_prefixes + 1, sizeof(xmlChar*))
 *     if not c_ns_prefixes:
 *         raise MemoryError()             # <<<<<<<<<<<<<<
 *     i = 0
 *     try:
*/
    PyErr_NoMemory(); __PYX_ERR(6, 744, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":743
 *     # Need to allocate one extra memory block to handle last NULL entry
 *     c_ns_prefixes = <xmlChar **>python.lxml_malloc(num_ns_prefixes + 1, sizeof(xmlChar*))
 *     if not c_ns_prefixes:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     i = 0
*/
  }

  /* "src/lxml/serializer.pxi":745
 *     if not c_ns_prefixes:
 *         raise MemoryError()
 *     i = 0             # <<<<<<<<<<<<<<
 *     try:
 *         for prefix in ns_prefixes:
*/
  __pyx_v_i = 0;

  /* "src/lxml/serializer.pxi":746
 *         raise MemoryError()
 *     i = 0
 *     try:             # <<<<<<<<<<<<<<
 *         for prefix in ns_prefixes:
 *              prefix_utf = _utf8(prefix)
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    /*try:*/ {

      /* "src/lxml/serializer.pxi":747
 *     i = 0
 *     try:
 *         for prefix in ns_prefixes:             # <<<<<<<<<<<<<<
 *              prefix_utf = _utf8(prefix)
 *              c_prefix_len = len(prefix_utf)
*/
      if (likely(PyList_CheckExact(__pyx_v_ns_prefixes)) || PyTuple_CheckExact(__pyx_v_ns_prefixes)) {
        __pyx_t_6 = __pyx_v_ns_prefixes; __Pyx_INCREF(__pyx_t_6);
        __pyx_t_1 = 0;
        __pyx_t_7 = NULL;
      } else {
        __pyx_t_1 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_ns_prefixes); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 747, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 747, __pyx_L4_error)
      }
      for (;;) {
        if (likely(!__pyx_t_7)) {
          if (likely(PyList_CheckExact(__pyx_t_6))) {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_6);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(6, 747, __pyx_L4_error)
              #endif
              if (__pyx_t_1 >= __pyx_temp) break;
            }
            __pyx_t_8 = __Pyx_PyList_GetItemRefFast(__pyx_t_6, __pyx_t_1, __Pyx_ReferenceSharing_OwnStrongReference);
            ++__pyx_t_1;
          } else {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_6);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(6, 747, __pyx_L4_error)
              #endif
              if (__pyx_t_1 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_8 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_1));
            #else
            __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_1);
            #endif
            ++__pyx_t_1;
          }
          if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 747, __pyx_L4_error)
        } else {
          __pyx_t_8 = __pyx_t_7(__pyx_t_6);
          if (unlikely(!__pyx_t_8)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(6, 747, __pyx_L4_error)
              PyErr_Clear();
            }
            break;
          }
        }
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_XDECREF_SET(__pyx_v_prefix, __pyx_t_8);
        __pyx_t_8 = 0;

        /* "src/lxml/serializer.pxi":748
 *     try:
 *         for prefix in ns_prefixes:
 *              prefix_utf = _utf8(prefix)             # <<<<<<<<<<<<<<
 *              c_prefix_len = len(prefix_utf)
 *              if c_prefix_len > limits.INT_MAX:
*/
        __pyx_t_8 = __pyx_f_4lxml_5etree__utf8(__pyx_v_prefix); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 748, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_XDECREF_SET(__pyx_v_prefix_utf, ((PyObject*)__pyx_t_8));
        __pyx_t_8 = 0;

        /* "src/lxml/serializer.pxi":749
 *         for prefix in ns_prefixes:
 *              prefix_utf = _utf8(prefix)
 *              c_prefix_len = len(prefix_utf)             # <<<<<<<<<<<<<<
 *              if c_prefix_len > limits.INT_MAX:
 *                 raise ValueError("Prefix too long")
*/
        if (unlikely(__pyx_v_prefix_utf == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
          __PYX_ERR(6, 749, __pyx_L4_error)
        }
        __pyx_t_9 = __Pyx_PyBytes_GET_SIZE(__pyx_v_prefix_utf); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(6, 749, __pyx_L4_error)
        __pyx_v_c_prefix_len = __pyx_t_9;

        /* "src/lxml/serializer.pxi":750
 *              prefix_utf = _utf8(prefix)
 *              c_prefix_len = len(prefix_utf)
 *              if c_prefix_len > limits.INT_MAX:             # <<<<<<<<<<<<<<
 *                 raise ValueError("Prefix too long")
 *              c_prefix = tree.xmlDictExists(c_dict, _xcstr(prefix_utf), <int> c_prefix_len)
*/
        __pyx_t_2 = (__pyx_v_c_prefix_len > INT_MAX);
        if (unlikely(__pyx_t_2)) {

          /* "src/lxml/serializer.pxi":751
 *              c_prefix_len = len(prefix_utf)
 *              if c_prefix_len > limits.INT_MAX:
 *                 raise ValueError("Prefix too long")             # <<<<<<<<<<<<<<
 *              c_prefix = tree.xmlDictExists(c_dict, _xcstr(prefix_utf), <int> c_prefix_len)
 *              if c_prefix:
*/
          __pyx_t_10 = NULL;
          __pyx_t_11 = 1;
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_mstate_global->__pyx_kp_u_Prefix_too_long};
            __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_11, (2-__pyx_t_11) | (__pyx_t_11*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
            if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 751, __pyx_L4_error)
            __Pyx_GOTREF(__pyx_t_8);
          }
          __Pyx_Raise(__pyx_t_8, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __PYX_ERR(6, 751, __pyx_L4_error)

          /* "src/lxml/serializer.pxi":750
 *              prefix_utf = _utf8(prefix)
 *              c_prefix_len = len(prefix_utf)
 *              if c_prefix_len > limits.INT_MAX:             # <<<<<<<<<<<<<<
 *                 raise ValueError("Prefix too long")
 *              c_prefix = tree.xmlDictExists(c_dict, _xcstr(prefix_utf), <int> c_prefix_len)
*/
        }

        /* "src/lxml/serializer.pxi":752
 *              if c_prefix_len > limits.INT_MAX:
 *                 raise ValueError("Prefix too long")
 *              c_prefix = tree.xmlDictExists(c_dict, _xcstr(prefix_utf), <int> c_prefix_len)             # <<<<<<<<<<<<<<
 *              if c_prefix:
 *                  # unknown prefixes do not need to get serialised
*/
        __pyx_v_c_prefix = xmlDictExists(__pyx_v_c_dict, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_prefix_utf), ((int)__pyx_v_c_prefix_len));

        /* "src/lxml/serializer.pxi":753
 *                 raise ValueError("Prefix too long")
 *              c_prefix = tree.xmlDictExists(c_dict, _xcstr(prefix_utf), <int> c_prefix_len)
 *              if c_prefix:             # <<<<<<<<<<<<<<
 *                  # unknown prefixes do not need to get serialised
 *                  c_ns_prefixes[i] = <xmlChar*>c_prefix
*/
        __pyx_t_2 = (__pyx_v_c_prefix != 0);
        if (__pyx_t_2) {

          /* "src/lxml/serializer.pxi":755
 *              if c_prefix:
 *                  # unknown prefixes do not need to get serialised
 *                  c_ns_prefixes[i] = <xmlChar*>c_prefix             # <<<<<<<<<<<<<<
 *                  i += 1
 *     except:
*/
          (__pyx_v_c_ns_prefixes[__pyx_v_i]) = ((xmlChar *)__pyx_v_c_prefix);

          /* "src/lxml/serializer.pxi":756
 *                  # unknown prefixes do not need to get serialised
 *                  c_ns_prefixes[i] = <xmlChar*>c_prefix
 *                  i += 1             # <<<<<<<<<<<<<<
 *     except:
 *         python.lxml_free(c_ns_prefixes)
*/
          __pyx_v_i = (__pyx_v_i + 1);

          /* "src/lxml/serializer.pxi":753
 *                 raise ValueError("Prefix too long")
 *              c_prefix = tree.xmlDictExists(c_dict, _xcstr(prefix_utf), <int> c_prefix_len)
 *              if c_prefix:             # <<<<<<<<<<<<<<
 *                  # unknown prefixes do not need to get serialised
 *                  c_ns_prefixes[i] = <xmlChar*>c_prefix
*/
        }

        /* "src/lxml/serializer.pxi":747
 *     i = 0
 *     try:
 *         for prefix in ns_prefixes:             # <<<<<<<<<<<<<<
 *              prefix_utf = _utf8(prefix)
 *              c_prefix_len = len(prefix_utf)
*/
      }
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "src/lxml/serializer.pxi":746
 *         raise MemoryError()
 *     i = 0
 *     try:             # <<<<<<<<<<<<<<
 *         for prefix in ns_prefixes:
 *              prefix_utf = _utf8(prefix)
*/
    }
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L9_try_end;
    __pyx_L4_error:;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "src/lxml/serializer.pxi":757
 *                  c_ns_prefixes[i] = <xmlChar*>c_prefix
 *                  i += 1
 *     except:             # <<<<<<<<<<<<<<
 *         python.lxml_free(c_ns_prefixes)
 *         raise
*/
    /*except:*/ {
      __Pyx_AddTraceback("lxml.etree._convert_ns_prefixes", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_8, &__pyx_t_10) < 0) __PYX_ERR(6, 757, __pyx_L6_except_error)
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_10);

      /* "src/lxml/serializer.pxi":758
 *                  i += 1
 *     except:
 *         python.lxml_free(c_ns_prefixes)             # <<<<<<<<<<<<<<
 *         raise
 * 
*/
      lxml_free(__pyx_v_c_ns_prefixes);

      /* "src/lxml/serializer.pxi":759
 *     except:
 *         python.lxml_free(c_ns_prefixes)
 *         raise             # <<<<<<<<<<<<<<
 * 
 *     c_ns_prefixes[i] = NULL  # append end marker
*/
      __Pyx_GIVEREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_ErrRestoreWithState(__pyx_t_6, __pyx_t_8, __pyx_t_10);
      __pyx_t_6 = 0;  __pyx_t_8 = 0;  __pyx_t_10 = 0; 
      __PYX_ERR(6, 759, __pyx_L6_except_error)
    }

    /* "src/lxml/serializer.pxi":746
 *         raise MemoryError()
 *     i = 0
 *     try:             # <<<<<<<<<<<<<<
 *         for prefix in ns_prefixes:
 *              prefix_utf = _utf8(prefix)
*/
    __pyx_L6_except_error:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    goto __pyx_L1_error;
    __pyx_L9_try_end:;
  }

  /* "src/lxml/serializer.pxi":761
 *         raise
 * 
 *     c_ns_prefixes[i] = NULL  # append end marker             # <<<<<<<<<<<<<<
 *     return c_ns_prefixes
 * 
*/
  (__pyx_v_c_ns_prefixes[__pyx_v_i]) = NULL;

  /* "src/lxml/serializer.pxi":762
 * 
 *     c_ns_prefixes[i] = NULL  # append end marker
 *     return c_ns_prefixes             # <<<<<<<<<<<<<<
 * 
 * cdef _tofilelikeC14N(f, _Element element, bint exclusive, bint with_comments,
*/
  __pyx_r = __pyx_v_c_ns_prefixes;
  goto __pyx_L0;

  /* "src/lxml/serializer.pxi":739
 *     return writer
 * 
 * cdef xmlChar **_convert_ns_prefixes(tree.xmlDict* c_dict, ns_prefixes) except NULL:             # <<<<<<<<<<<<<<
 *     cdef size_t i, num_ns_prefixes = len(ns_prefixes)
 *     # Need to allocate one extra memory block to handle last NULL entry
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("lxml.etree._convert_ns_prefixes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_prefix);
  __Pyx_XDECREF(__pyx_v_prefix_utf);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":764
 *     return c_ns_prefixes
 * 
 * cdef _tofilelikeC14N(f, _Element element, bint exclusive, bint with_comments,             # <<<<<<<<<<<<<<
 *                      int compression, inclusive_ns_prefixes):
 *     cdef _FilelikeWriter writer = None
*/

static PyObject *__pyx_f_4lxml_5etree__tofilelikeC14N(PyObject *__pyx_v_f, struct LxmlElement *__pyx_v_element, int __pyx_v_exclusive, int __pyx_v_with_comments, int __pyx_v_compression, PyObject *__pyx_v_inclusive_ns_prefixes) {
  struct __pyx_obj_4lxml_5etree__FilelikeWriter *__pyx_v_writer = 0;
  xmlOutputBuffer *__pyx_v_c_buffer;
  xmlChar **__pyx_v_c_inclusive_ns_prefixes;
  char *__pyx_v_c_filename;
  xmlDoc *__pyx_v_c_base_doc;
  xmlDoc *__pyx_v_c_doc;
  int __pyx_v_bytes_count;
  int __pyx_v_error;
  int __pyx_v_close;
  PyObject *__pyx_v_filename8 = NULL;
  PyObject *__pyx_v_message = NULL;
  struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_errors = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  xmlDoc *__pyx_t_1;
  xmlChar **__pyx_t_2;
  int __pyx_t_3;
  xmlChar **__pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  size_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  xmlOutputBuffer *__pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_t_14;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  int __pyx_t_18;
  char const *__pyx_t_19;
  PyObject *__pyx_t_20 = NULL;
  PyObject *__pyx_t_21 = NULL;
  const char *__pyx_t_22;
  Py_ssize_t __pyx_t_23;
  PyObject *__pyx_t_24[3];
  char const *__pyx_t_25;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_tofilelikeC14N", 0);
  __Pyx_INCREF(__pyx_v_f);

  /* "src/lxml/serializer.pxi":766
 * cdef _tofilelikeC14N(f, _Element element, bint exclusive, bint with_comments,
 *                      int compression, inclusive_ns_prefixes):
 *     cdef _FilelikeWriter writer = None             # <<<<<<<<<<<<<<
 *     cdef tree.xmlOutputBuffer* c_buffer
 *     cdef xmlChar **c_inclusive_ns_prefixes = NULL
*/
  __Pyx_INCREF(Py_None);
  __pyx_v_writer = ((struct __pyx_obj_4lxml_5etree__FilelikeWriter *)Py_None);

  /* "src/lxml/serializer.pxi":768
 *     cdef _FilelikeWriter writer = None
 *     cdef tree.xmlOutputBuffer* c_buffer
 *     cdef xmlChar **c_inclusive_ns_prefixes = NULL             # <<<<<<<<<<<<<<
 *     cdef char* c_filename
 *     cdef xmlDoc* c_base_doc
*/
  __pyx_v_c_inclusive_ns_prefixes = NULL;

  /* "src/lxml/serializer.pxi":772
 *     cdef xmlDoc* c_base_doc
 *     cdef xmlDoc* c_doc
 *     cdef int bytes_count, error = 0             # <<<<<<<<<<<<<<
 * 
 *     c_base_doc = element._c_node.doc
*/
  __pyx_v_error = 0;

  /* "src/lxml/serializer.pxi":774
 *     cdef int bytes_count, error = 0
 * 
 *     c_base_doc = element._c_node.doc             # <<<<<<<<<<<<<<
 *     c_doc = _fakeRootDoc(c_base_doc, element._c_node)
 *     try:
*/
  __pyx_t_1 = __pyx_v_element->_c_node->doc;
  __pyx_v_c_base_doc = __pyx_t_1;

  /* "src/lxml/serializer.pxi":775
 * 
 *     c_base_doc = element._c_node.doc
 *     c_doc = _fakeRootDoc(c_base_doc, element._c_node)             # <<<<<<<<<<<<<<
 *     try:
 *         c_inclusive_ns_prefixes = (
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__fakeRootDoc(__pyx_v_c_base_doc, __pyx_v_element->_c_node); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(6, 775, __pyx_L1_error)
  __pyx_v_c_doc = __pyx_t_1;

  /* "src/lxml/serializer.pxi":776
 *     c_base_doc = element._c_node.doc
 *     c_doc = _fakeRootDoc(c_base_doc, element._c_node)
 *     try:             # <<<<<<<<<<<<<<
 *         c_inclusive_ns_prefixes = (
 *             _convert_ns_prefixes(c_doc.dict, inclusive_ns_prefixes)
*/
  /*try:*/ {

    /* "src/lxml/serializer.pxi":779
 *         c_inclusive_ns_prefixes = (
 *             _convert_ns_prefixes(c_doc.dict, inclusive_ns_prefixes)
 *             if inclusive_ns_prefixes else NULL)             # <<<<<<<<<<<<<<
 * 
 *         f = _getFSPathOrObject(f)
*/
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_inclusive_ns_prefixes); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(6, 779, __pyx_L4_error)
    if (__pyx_t_3) {

      /* "src/lxml/serializer.pxi":778
 *     try:
 *         c_inclusive_ns_prefixes = (
 *             _convert_ns_prefixes(c_doc.dict, inclusive_ns_prefixes)             # <<<<<<<<<<<<<<
 *             if inclusive_ns_prefixes else NULL)
 * 
*/
      __pyx_t_4 = __pyx_f_4lxml_5etree__convert_ns_prefixes(__pyx_v_c_doc->dict, __pyx_v_inclusive_ns_prefixes); if (unlikely(__pyx_t_4 == ((void *)NULL))) __PYX_ERR(6, 778, __pyx_L4_error)
      __pyx_t_2 = __pyx_t_4;
    } else {

      /* "src/lxml/serializer.pxi":779
 *         c_inclusive_ns_prefixes = (
 *             _convert_ns_prefixes(c_doc.dict, inclusive_ns_prefixes)
 *             if inclusive_ns_prefixes else NULL)             # <<<<<<<<<<<<<<
 * 
 *         f = _getFSPathOrObject(f)
*/
      __pyx_t_2 = NULL;
    }
    __pyx_v_c_inclusive_ns_prefixes = __pyx_t_2;

    /* "src/lxml/serializer.pxi":781
 *             if inclusive_ns_prefixes else NULL)
 * 
 *         f = _getFSPathOrObject(f)             # <<<<<<<<<<<<<<
 * 
 *         close = False
*/
    __pyx_t_5 = __pyx_f_4lxml_5etree__getFSPathOrObject(__pyx_v_f); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 781, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF_SET(__pyx_v_f, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "src/lxml/serializer.pxi":783
 *         f = _getFSPathOrObject(f)
 * 
 *         close = False             # <<<<<<<<<<<<<<
 *         if compression and not HAS_ZLIB_COMPRESSION and _isString(f):
 *             # Let "_FilelikeWriter" fall back to Python's GzipFile.
*/
    __pyx_v_close = 0;

    /* "src/lxml/serializer.pxi":784
 * 
 *         close = False
 *         if compression and not HAS_ZLIB_COMPRESSION and _isString(f):             # <<<<<<<<<<<<<<
 *             # Let "_FilelikeWriter" fall back to Python's GzipFile.
 *             f = open(f, mode="wb")
*/
    __pyx_t_6 = (__pyx_v_compression != 0);
    if (__pyx_t_6) {
    } else {
      __pyx_t_3 = __pyx_t_6;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_6 = (!__pyx_v_4lxml_5etree_HAS_ZLIB_COMPRESSION);
    if (__pyx_t_6) {
    } else {
      __pyx_t_3 = __pyx_t_6;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_6 = _isString(__pyx_v_f);
    __pyx_t_3 = __pyx_t_6;
    __pyx_L7_bool_binop_done:;
    if (__pyx_t_3) {

      /* "src/lxml/serializer.pxi":786
 *         if compression and not HAS_ZLIB_COMPRESSION and _isString(f):
 *             # Let "_FilelikeWriter" fall back to Python's GzipFile.
 *             f = open(f, mode="wb")             # <<<<<<<<<<<<<<
 *             close = True
 * 
*/
      __pyx_t_7 = NULL;
      __pyx_t_8 = 1;
      {
        PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_7, __pyx_v_f};
        __pyx_t_9 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 786, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_9);
        if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_mode, __pyx_mstate_global->__pyx_n_u_wb, __pyx_t_9, __pyx_callargs+2, 0) < (0)) __PYX_ERR(6, 786, __pyx_L4_error)
        __pyx_t_5 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_builtin_open, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_9);
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 786, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_5);
      }
      __Pyx_DECREF_SET(__pyx_v_f, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "src/lxml/serializer.pxi":787
 *             # Let "_FilelikeWriter" fall back to Python's GzipFile.
 *             f = open(f, mode="wb")
 *             close = True             # <<<<<<<<<<<<<<
 * 
 *         if _isString(f):
*/
      __pyx_v_close = 1;

      /* "src/lxml/serializer.pxi":784
 * 
 *         close = False
 *         if compression and not HAS_ZLIB_COMPRESSION and _isString(f):             # <<<<<<<<<<<<<<
 *             # Let "_FilelikeWriter" fall back to Python's GzipFile.
 *             f = open(f, mode="wb")
*/
    }

    /* "src/lxml/serializer.pxi":789
 *             close = True
 * 
 *         if _isString(f):             # <<<<<<<<<<<<<<
 *             filename8 = _encodeFilename(f)
 *             c_filename = _cstr(filename8)
*/
    __pyx_t_3 = _isString(__pyx_v_f);
    if (__pyx_t_3) {

      /* "src/lxml/serializer.pxi":790
 * 
 *         if _isString(f):
 *             filename8 = _encodeFilename(f)             # <<<<<<<<<<<<<<
 *             c_filename = _cstr(filename8)
 *             with nogil:
*/
      __pyx_t_5 = __pyx_f_4lxml_5etree__encodeFilename(__pyx_v_f); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 790, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_v_filename8 = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "src/lxml/serializer.pxi":791
 *         if _isString(f):
 *             filename8 = _encodeFilename(f)
 *             c_filename = _cstr(filename8)             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 error = c14n.xmlC14NDocSave(
*/
      __pyx_v_c_filename = PyBytes_AS_STRING(__pyx_v_filename8);

      /* "src/lxml/serializer.pxi":792
 *             filename8 = _encodeFilename(f)
 *             c_filename = _cstr(filename8)
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 error = c14n.xmlC14NDocSave(
 *                     c_doc, NULL, exclusive, c_inclusive_ns_prefixes,
*/
      {
          PyThreadState * _save;
          _save = PyEval_SaveThread();
          __Pyx_FastGIL_Remember();
          /*try:*/ {

            /* "src/lxml/serializer.pxi":793
 *             c_filename = _cstr(filename8)
 *             with nogil:
 *                 error = c14n.xmlC14NDocSave(             # <<<<<<<<<<<<<<
 *                     c_doc, NULL, exclusive, c_inclusive_ns_prefixes,
 *                     with_comments, c_filename, compression)
*/
            __pyx_v_error = xmlC14NDocSave(__pyx_v_c_doc, NULL, __pyx_v_exclusive, __pyx_v_c_inclusive_ns_prefixes, __pyx_v_with_comments, __pyx_v_c_filename, __pyx_v_compression);
          }

          /* "src/lxml/serializer.pxi":792
 *             filename8 = _encodeFilename(f)
 *             c_filename = _cstr(filename8)
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 error = c14n.xmlC14NDocSave(
 *                     c_doc, NULL, exclusive, c_inclusive_ns_prefixes,
*/
          /*finally:*/ {
            /*normal exit:*/{
              __Pyx_FastGIL_Forget();
              PyEval_RestoreThread(_save);
              goto __pyx_L13;
            }
            __pyx_L13:;
          }
      }

      /* "src/lxml/serializer.pxi":789
 *             close = True
 * 
 *         if _isString(f):             # <<<<<<<<<<<<<<
 *             filename8 = _encodeFilename(f)
 *             c_filename = _cstr(filename8)
*/
      goto __pyx_L10;
    }

    /* "src/lxml/serializer.pxi":796
 *                     c_doc, NULL, exclusive, c_inclusive_ns_prefixes,
 *                     with_comments, c_filename, compression)
 *         elif hasattr(f, 'write'):             # <<<<<<<<<<<<<<
 *             writer   = _FilelikeWriter(f, compression=compression, close=close)
 *             c_buffer = writer._createOutputBuffer(NULL)
*/
    __pyx_t_3 = __Pyx_HasAttr(__pyx_v_f, __pyx_mstate_global->__pyx_n_u_write); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(6, 796, __pyx_L4_error)
    if (likely(__pyx_t_3)) {

      /* "src/lxml/serializer.pxi":797
 *                     with_comments, c_filename, compression)
 *         elif hasattr(f, 'write'):
 *             writer   = _FilelikeWriter(f, compression=compression, close=close)             # <<<<<<<<<<<<<<
 *             c_buffer = writer._createOutputBuffer(NULL)
 *             try:
*/
      __pyx_t_9 = NULL;
      __pyx_t_7 = __Pyx_PyLong_From_int(__pyx_v_compression); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 797, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_10 = __Pyx_PyBool_FromLong(__pyx_v_close); if (unlikely(!__pyx_t_10)) __PYX_ERR(6, 797, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_8 = 1;
      {
        PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_9, __pyx_v_f};
        __pyx_t_11 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(6, 797, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_11);
        if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_compression, __pyx_t_7, __pyx_t_11, __pyx_callargs+2, 0) < (0)) __PYX_ERR(6, 797, __pyx_L4_error)
        if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_close, __pyx_t_10, __pyx_t_11, __pyx_callargs+2, 1) < (0)) __PYX_ERR(6, 797, __pyx_L4_error)
        __pyx_t_5 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__FilelikeWriter, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_11);
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 797, __pyx_L4_error)
        __Pyx_GOTREF((PyObject *)__pyx_t_5);
      }
      __Pyx_DECREF_SET(__pyx_v_writer, ((struct __pyx_obj_4lxml_5etree__FilelikeWriter *)__pyx_t_5));
      __pyx_t_5 = 0;

      /* "src/lxml/serializer.pxi":798
 *         elif hasattr(f, 'write'):
 *             writer   = _FilelikeWriter(f, compression=compression, close=close)
 *             c_buffer = writer._createOutputBuffer(NULL)             # <<<<<<<<<<<<<<
 *             try:
 *                 with writer.error_log:
*/
      __pyx_t_12 = __pyx_f_4lxml_5etree_15_FilelikeWriter__createOutputBuffer(__pyx_v_writer, NULL); if (unlikely(__pyx_t_12 == ((void *)NULL))) __PYX_ERR(6, 798, __pyx_L4_error)
      __pyx_v_c_buffer = __pyx_t_12;

      /* "src/lxml/serializer.pxi":799
 *             writer   = _FilelikeWriter(f, compression=compression, close=close)
 *             c_buffer = writer._createOutputBuffer(NULL)
 *             try:             # <<<<<<<<<<<<<<
 *                 with writer.error_log:
 *                     bytes_count = c14n.xmlC14NDocSaveTo(
*/
      /*try:*/ {

        /* "src/lxml/serializer.pxi":800
 *             c_buffer = writer._createOutputBuffer(NULL)
 *             try:
 *                 with writer.error_log:             # <<<<<<<<<<<<<<
 *                     bytes_count = c14n.xmlC14NDocSaveTo(
 *                         c_doc, NULL, exclusive, c_inclusive_ns_prefixes,
*/
        /*with:*/ {
          __pyx_t_13 = __Pyx_PyObject_LookupSpecial(((PyObject *)__pyx_v_writer->error_log), __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_13)) __PYX_ERR(6, 800, __pyx_L15_error)
          __Pyx_GOTREF(__pyx_t_13);
          __pyx_t_14 = __pyx_f_4lxml_5etree_9_ErrorLog___enter__(__pyx_v_writer->error_log); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(6, 800, __pyx_L17_error)
          /*try:*/ {
            {
              (void)__pyx_t_15; (void)__pyx_t_16; (void)__pyx_t_17; /* mark used */
              /*try:*/ {

                /* "src/lxml/serializer.pxi":801
 *             try:
 *                 with writer.error_log:
 *                     bytes_count = c14n.xmlC14NDocSaveTo(             # <<<<<<<<<<<<<<
 *                         c_doc, NULL, exclusive, c_inclusive_ns_prefixes,
 *                         with_comments, c_buffer)
*/
                __pyx_v_bytes_count = xmlC14NDocSaveTo(__pyx_v_c_doc, NULL, __pyx_v_exclusive, __pyx_v_c_inclusive_ns_prefixes, __pyx_v_with_comments, __pyx_v_c_buffer);

                /* "src/lxml/serializer.pxi":800
 *             c_buffer = writer._createOutputBuffer(NULL)
 *             try:
 *                 with writer.error_log:             # <<<<<<<<<<<<<<
 *                     bytes_count = c14n.xmlC14NDocSaveTo(
 *                         c_doc, NULL, exclusive, c_inclusive_ns_prefixes,
*/
              }
            }
          }
          /*finally:*/ {
            /*normal exit:*/{
              if (__pyx_t_13) {
                __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_mstate_global->__pyx_tuple[3], NULL);
                __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
                if (unlikely(!__pyx_t_17)) __PYX_ERR(6, 800, __pyx_L15_error)
                __Pyx_GOTREF(__pyx_t_17);
                __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
              }
              goto __pyx_L20;
            }
            __pyx_L20:;
          }
          goto __pyx_L27;
          __pyx_L17_error:;
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          goto __pyx_L15_error;
          __pyx_L27:;
        }
      }

      /* "src/lxml/serializer.pxi":805
 *                         with_comments, c_buffer)
 *             finally:
 *                 error = tree.xmlOutputBufferClose(c_buffer)             # <<<<<<<<<<<<<<
 *             if bytes_count < 0:
 *                 error = bytes_count
*/
      /*finally:*/ {
        /*normal exit:*/{
          __pyx_v_error = xmlOutputBufferClose(__pyx_v_c_buffer);
          goto __pyx_L16;
        }
        __pyx_L15_error:;
        /*exception exit:*/{
          __Pyx_PyThreadState_declare
          __Pyx_PyThreadState_assign
          __pyx_t_13 = 0; __pyx_t_17 = 0; __pyx_t_16 = 0; __pyx_t_15 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0;
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
           __Pyx_ExceptionSwap(&__pyx_t_15, &__pyx_t_20, &__pyx_t_21);
          if ( unlikely(__Pyx_GetException(&__pyx_t_13, &__pyx_t_17, &__pyx_t_16) < 0)) __Pyx_ErrFetch(&__pyx_t_13, &__pyx_t_17, &__pyx_t_16);
          __Pyx_XGOTREF(__pyx_t_13);
          __Pyx_XGOTREF(__pyx_t_17);
          __Pyx_XGOTREF(__pyx_t_16);
          __Pyx_XGOTREF(__pyx_t_15);
          __Pyx_XGOTREF(__pyx_t_20);
          __Pyx_XGOTREF(__pyx_t_21);
          __pyx_t_14 = __pyx_lineno; __pyx_t_18 = __pyx_clineno; __pyx_t_19 = __pyx_filename;
          {
            __pyx_v_error = xmlOutputBufferClose(__pyx_v_c_buffer);
          }
          __Pyx_XGIVEREF(__pyx_t_15);
          __Pyx_XGIVEREF(__pyx_t_20);
          __Pyx_XGIVEREF(__pyx_t_21);
          __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_20, __pyx_t_21);
          __Pyx_XGIVEREF(__pyx_t_13);
          __Pyx_XGIVEREF(__pyx_t_17);
          __Pyx_XGIVEREF(__pyx_t_16);
          __Pyx_ErrRestore(__pyx_t_13, __pyx_t_17, __pyx_t_16);
          __pyx_t_13 = 0; __pyx_t_17 = 0; __pyx_t_16 = 0; __pyx_t_15 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0;
          __pyx_lineno = __pyx_t_14; __pyx_clineno = __pyx_t_18; __pyx_filename = __pyx_t_19;
          goto __pyx_L4_error;
        }
        __pyx_L16:;
      }

      /* "src/lxml/serializer.pxi":806
 *             finally:
 *                 error = tree.xmlOutputBufferClose(c_buffer)
 *             if bytes_count < 0:             # <<<<<<<<<<<<<<
 *                 error = bytes_count
 *             elif error != -1:
*/
      __pyx_t_3 = (__pyx_v_bytes_count < 0);
      if (__pyx_t_3) {

        /* "src/lxml/serializer.pxi":807
 *                 error = tree.xmlOutputBufferClose(c_buffer)
 *             if bytes_count < 0:
 *                 error = bytes_count             # <<<<<<<<<<<<<<
 *             elif error != -1:
 *                 error = xmlerror.XML_ERR_OK
*/
        __pyx_v_error = __pyx_v_bytes_count;

        /* "src/lxml/serializer.pxi":806
 *             finally:
 *                 error = tree.xmlOutputBufferClose(c_buffer)
 *             if bytes_count < 0:             # <<<<<<<<<<<<<<
 *                 error = bytes_count
 *             elif error != -1:
*/
        goto __pyx_L30;
      }

      /* "src/lxml/serializer.pxi":808
 *             if bytes_count < 0:
 *                 error = bytes_count
 *             elif error != -1:             # <<<<<<<<<<<<<<
 *                 error = xmlerror.XML_ERR_OK
 *         else:
*/
      __pyx_t_3 = (__pyx_v_error != -1L);
      if (__pyx_t_3) {

        /* "src/lxml/serializer.pxi":809
 *                 error = bytes_count
 *             elif error != -1:
 *                 error = xmlerror.XML_ERR_OK             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError(f"File or filename expected, got '{python._fqtypename(f).decode('UTF-8')}'")
*/
        __pyx_v_error = XML_ERR_OK;

        /* "src/lxml/serializer.pxi":808
 *             if bytes_count < 0:
 *                 error = bytes_count
 *             elif error != -1:             # <<<<<<<<<<<<<<
 *                 error = xmlerror.XML_ERR_OK
 *         else:
*/
      }
      __pyx_L30:;

      /* "src/lxml/serializer.pxi":796
 *                     c_doc, NULL, exclusive, c_inclusive_ns_prefixes,
 *                     with_comments, c_filename, compression)
 *         elif hasattr(f, 'write'):             # <<<<<<<<<<<<<<
 *             writer   = _FilelikeWriter(f, compression=compression, close=close)
 *             c_buffer = writer._createOutputBuffer(NULL)
*/
      goto __pyx_L10;
    }

    /* "src/lxml/serializer.pxi":811
 *                 error = xmlerror.XML_ERR_OK
 *         else:
 *             raise TypeError(f"File or filename expected, got '{python._fqtypename(f).decode('UTF-8')}'")             # <<<<<<<<<<<<<<
 *     finally:
 *         _destroyFakeDoc(c_base_doc, c_doc)
*/
    /*else*/ {
      __pyx_t_11 = NULL;
      __pyx_t_22 = _fqtypename(__pyx_v_f);
      __pyx_t_23 = __Pyx_ssize_strlen(__pyx_t_22); if (unlikely(__pyx_t_23 == ((Py_ssize_t)-1))) __PYX_ERR(6, 811, __pyx_L4_error)
      __pyx_t_10 = __Pyx_decode_c_string(__pyx_t_22, 0, __pyx_t_23, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_10)) __PYX_ERR(6, 811, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_24[0] = __pyx_mstate_global->__pyx_kp_u_File_or_filename_expected_got;
      __pyx_t_24[1] = __pyx_t_10;
      __pyx_t_24[2] = __pyx_mstate_global->__pyx_kp_u__4;
      __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_24, 3, 32 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_10) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_10));
      if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 811, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_8 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_t_7};
        __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 811, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_5);
      }
      __Pyx_Raise(__pyx_t_5, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __PYX_ERR(6, 811, __pyx_L4_error)
    }
    __pyx_L10:;
  }

  /* "src/lxml/serializer.pxi":813
 *             raise TypeError(f"File or filename expected, got '{python._fqtypename(f).decode('UTF-8')}'")
 *     finally:
 *         _destroyFakeDoc(c_base_doc, c_doc)             # <<<<<<<<<<<<<<
 *         if c_inclusive_ns_prefixes is not NULL:
 *             python.lxml_free(c_inclusive_ns_prefixes)
*/
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_f_4lxml_5etree__destroyFakeDoc(__pyx_v_c_base_doc, __pyx_v_c_doc);

      /* "src/lxml/serializer.pxi":814
 *     finally:
 *         _destroyFakeDoc(c_base_doc, c_doc)
 *         if c_inclusive_ns_prefixes is not NULL:             # <<<<<<<<<<<<<<
 *             python.lxml_free(c_inclusive_ns_prefixes)
 * 
*/
      __pyx_t_3 = (__pyx_v_c_inclusive_ns_prefixes != NULL);
      if (__pyx_t_3) {

        /* "src/lxml/serializer.pxi":815
 *         _destroyFakeDoc(c_base_doc, c_doc)
 *         if c_inclusive_ns_prefixes is not NULL:
 *             python.lxml_free(c_inclusive_ns_prefixes)             # <<<<<<<<<<<<<<
 * 
 *     if writer is not None:
*/
        lxml_free(__pyx_v_c_inclusive_ns_prefixes);

        /* "src/lxml/serializer.pxi":814
 *     finally:
 *         _destroyFakeDoc(c_base_doc, c_doc)
 *         if c_inclusive_ns_prefixes is not NULL:             # <<<<<<<<<<<<<<
 *             python.lxml_free(c_inclusive_ns_prefixes)
 * 
*/
      }
      goto __pyx_L5;
    }
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_21 = 0; __pyx_t_20 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_16, &__pyx_t_17, &__pyx_t_13);
      if ( unlikely(__Pyx_GetException(&__pyx_t_21, &__pyx_t_20, &__pyx_t_15) < 0)) __Pyx_ErrFetch(&__pyx_t_21, &__pyx_t_20, &__pyx_t_15);
      __Pyx_XGOTREF(__pyx_t_21);
      __Pyx_XGOTREF(__pyx_t_20);
      __Pyx_XGOTREF(__pyx_t_15);
      __Pyx_XGOTREF(__pyx_t_16);
      __Pyx_XGOTREF(__pyx_t_17);
      __Pyx_XGOTREF(__pyx_t_13);
      __pyx_t_18 = __pyx_lineno; __pyx_t_14 = __pyx_clineno; __pyx_t_25 = __pyx_filename;
      {

        /* "src/lxml/serializer.pxi":813
 *             raise TypeError(f"File or filename expected, got '{python._fqtypename(f).decode('UTF-8')}'")
 *     finally:
 *         _destroyFakeDoc(c_base_doc, c_doc)             # <<<<<<<<<<<<<<
 *         if c_inclusive_ns_prefixes is not NULL:
 *             python.lxml_free(c_inclusive_ns_prefixes)
*/
        __pyx_f_4lxml_5etree__destroyFakeDoc(__pyx_v_c_base_doc, __pyx_v_c_doc);

        /* "src/lxml/serializer.pxi":814
 *     finally:
 *         _destroyFakeDoc(c_base_doc, c_doc)
 *         if c_inclusive_ns_prefixes is not NULL:             # <<<<<<<<<<<<<<
 *             python.lxml_free(c_inclusive_ns_prefixes)
 * 
*/
        __pyx_t_3 = (__pyx_v_c_inclusive_ns_prefixes != NULL);
        if (__pyx_t_3) {

          /* "src/lxml/serializer.pxi":815
 *         _destroyFakeDoc(c_base_doc, c_doc)
 *         if c_inclusive_ns_prefixes is not NULL:
 *             python.lxml_free(c_inclusive_ns_prefixes)             # <<<<<<<<<<<<<<
 * 
 *     if writer is not None:
*/
          lxml_free(__pyx_v_c_inclusive_ns_prefixes);

          /* "src/lxml/serializer.pxi":814
 *     finally:
 *         _destroyFakeDoc(c_base_doc, c_doc)
 *         if c_inclusive_ns_prefixes is not NULL:             # <<<<<<<<<<<<<<
 *             python.lxml_free(c_inclusive_ns_prefixes)
 * 
*/
        }
      }
      __Pyx_XGIVEREF(__pyx_t_16);
      __Pyx_XGIVEREF(__pyx_t_17);
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_ExceptionReset(__pyx_t_16, __pyx_t_17, __pyx_t_13);
      __Pyx_XGIVEREF(__pyx_t_21);
      __Pyx_XGIVEREF(__pyx_t_20);
      __Pyx_XGIVEREF(__pyx_t_15);
      __Pyx_ErrRestore(__pyx_t_21, __pyx_t_20, __pyx_t_15);
      __pyx_t_21 = 0; __pyx_t_20 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_13 = 0;
      __pyx_lineno = __pyx_t_18; __pyx_clineno = __pyx_t_14; __pyx_filename = __pyx_t_25;
      goto __pyx_L1_error;
    }
    __pyx_L5:;
  }

  /* "src/lxml/serializer.pxi":817
 *             python.lxml_free(c_inclusive_ns_prefixes)
 * 
 *     if writer is not None:             # <<<<<<<<<<<<<<
 *         writer._exc_context._raise_if_stored()
 * 
*/
  __pyx_t_3 = (((PyObject *)__pyx_v_writer) != Py_None);
  if (__pyx_t_3) {

    /* "src/lxml/serializer.pxi":818
 * 
 *     if writer is not None:
 *         writer._exc_context._raise_if_stored()             # <<<<<<<<<<<<<<
 * 
 *     if error < 0:
*/
    __pyx_t_14 = __pyx_f_4lxml_5etree_17_ExceptionContext__raise_if_stored(__pyx_v_writer->_exc_context); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(6, 818, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":817
 *             python.lxml_free(c_inclusive_ns_prefixes)
 * 
 *     if writer is not None:             # <<<<<<<<<<<<<<
 *         writer._exc_context._raise_if_stored()
 * 
*/
  }

  /* "src/lxml/serializer.pxi":820
 *         writer._exc_context._raise_if_stored()
 * 
 *     if error < 0:             # <<<<<<<<<<<<<<
 *         message = "C14N failed"
 *         if writer is not None:
*/
  __pyx_t_3 = (__pyx_v_error < 0);
  if (__pyx_t_3) {

    /* "src/lxml/serializer.pxi":821
 * 
 *     if error < 0:
 *         message = "C14N failed"             # <<<<<<<<<<<<<<
 *         if writer is not None:
 *             errors = writer.error_log
*/
    __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_C14N_failed);
    __pyx_v_message = __pyx_mstate_global->__pyx_kp_u_C14N_failed;

    /* "src/lxml/serializer.pxi":822
 *     if error < 0:
 *         message = "C14N failed"
 *         if writer is not None:             # <<<<<<<<<<<<<<
 *             errors = writer.error_log
 *             if len(errors):
*/
    __pyx_t_3 = (((PyObject *)__pyx_v_writer) != Py_None);
    if (__pyx_t_3) {

      /* "src/lxml/serializer.pxi":823
 *         message = "C14N failed"
 *         if writer is not None:
 *             errors = writer.error_log             # <<<<<<<<<<<<<<
 *             if len(errors):
 *                 message = errors[0].message
*/
      __pyx_t_5 = ((PyObject *)__pyx_v_writer->error_log);
      __Pyx_INCREF(__pyx_t_5);
      __pyx_v_errors = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_t_5);
      __pyx_t_5 = 0;

      /* "src/lxml/serializer.pxi":824
 *         if writer is not None:
 *             errors = writer.error_log
 *             if len(errors):             # <<<<<<<<<<<<<<
 *                 message = errors[0].message
 *         raise C14NError(message)
*/
      __pyx_t_23 = PyObject_Length(((PyObject *)__pyx_v_errors)); if (unlikely(__pyx_t_23 == ((Py_ssize_t)-1))) __PYX_ERR(6, 824, __pyx_L1_error)
      __pyx_t_3 = (__pyx_t_23 != 0);
      if (__pyx_t_3) {

        /* "src/lxml/serializer.pxi":825
 *             errors = writer.error_log
 *             if len(errors):
 *                 message = errors[0].message             # <<<<<<<<<<<<<<
 *         raise C14NError(message)
 * 
*/
        __pyx_t_5 = __Pyx_GetItemInt(((PyObject *)__pyx_v_errors), 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 825, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_message); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 825, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF_SET(__pyx_v_message, __pyx_t_7);
        __pyx_t_7 = 0;

        /* "src/lxml/serializer.pxi":824
 *         if writer is not None:
 *             errors = writer.error_log
 *             if len(errors):             # <<<<<<<<<<<<<<
 *                 message = errors[0].message
 *         raise C14NError(message)
*/
      }

      /* "src/lxml/serializer.pxi":822
 *     if error < 0:
 *         message = "C14N failed"
 *         if writer is not None:             # <<<<<<<<<<<<<<
 *             errors = writer.error_log
 *             if len(errors):
*/
    }

    /* "src/lxml/serializer.pxi":826
 *             if len(errors):
 *                 message = errors[0].message
 *         raise C14NError(message)             # <<<<<<<<<<<<<<
 * 
 * 
*/
    __pyx_t_5 = NULL;
    __pyx_t_8 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_message};
      __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_C14NError, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 826, __pyx_L1_error)
      __Pyx_GOTREF((PyObject *)__pyx_t_7);
    }
    __Pyx_Raise(((PyObject *)__pyx_t_7), 0, 0, 0);
    __Pyx_DECREF((PyObject *)__pyx_t_7); __pyx_t_7 = 0;
    __PYX_ERR(6, 826, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":820
 *         writer._exc_context._raise_if_stored()
 * 
 *     if error < 0:             # <<<<<<<<<<<<<<
 *         message = "C14N failed"
 *         if writer is not None:
*/
  }

  /* "src/lxml/serializer.pxi":764
 *     return c_ns_prefixes
 * 
 * cdef _tofilelikeC14N(f, _Element element, bint exclusive, bint with_comments,             # <<<<<<<<<<<<<<
 *                      int compression, inclusive_ns_prefixes):
 *     cdef _FilelikeWriter writer = None
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("lxml.etree._tofilelikeC14N", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_writer);
  __Pyx_XDECREF(__pyx_v_filename8);
  __Pyx_XDECREF(__pyx_v_message);
  __Pyx_XDECREF((PyObject *)__pyx_v_errors);
  __Pyx_XDECREF(__pyx_v_f);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":831
 * # C14N 2.0
 * 
 * def canonicalize(xml_data=None, *, out=None, from_file=None, **options):             # <<<<<<<<<<<<<<
 *     """Convert XML to its C14N 2.0 serialised form.
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_52canonicalize(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_51canonicalize, "Convert XML to its C14N 2.0 serialised form.\n\n    If *out* is provided, it must be a file or file-like object that receives\n    the serialised canonical XML output (text, not bytes) through its ``.write()``\n    method.  To write to a file, open it in text mode with encoding \"utf-8\".\n    If *out* is not provided, this function returns the output as text string.\n\n    Either *xml_data* (an XML string, tree or Element) or *file*\n    (a file path or file-like object) must be provided as input.\n\n    The configuration options are the same as for the ``C14NWriterTarget``.\n    ");
static PyMethodDef __pyx_mdef_4lxml_5etree_52canonicalize = {"canonicalize", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_52canonicalize, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_51canonicalize};
static PyObject *__pyx_pw_4lxml_5etree_52canonicalize(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_xml_data = 0;
  PyObject *__pyx_v_out = 0;
  PyObject *__pyx_v_from_file = 0;
  PyObject *__pyx_v_options = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("canonicalize (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  __pyx_v_options = PyDict_New(); if (unlikely(!__pyx_v_options)) return NULL;
  __Pyx_GOTREF(__pyx_v_options);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_xml_data,&__pyx_mstate_global->__pyx_n_u_out,&__pyx_mstate_global->__pyx_n_u_from_file,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(6, 831, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 831, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v_options, values, kwd_pos_args, __pyx_kwds_len, "canonicalize", 1) < (0)) __PYX_ERR(6, 831, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
    } else {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 831, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_xml_data = values[0];
    __pyx_v_out = values[1];
    __pyx_v_from_file = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("canonicalize", 0, 0, 1, __pyx_nargs); __PYX_ERR(6, 831, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v_options); __pyx_v_options = 0;
  __Pyx_AddTraceback("lxml.etree.canonicalize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_51canonicalize(__pyx_self, __pyx_v_xml_data, __pyx_v_out, __pyx_v_from_file, __pyx_v_options);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v_options);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_51canonicalize(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_xml_data, PyObject *__pyx_v_out, PyObject *__pyx_v_from_file, PyObject *__pyx_v_options) {
  PyObject *__pyx_v_sio = NULL;
  struct __pyx_obj_4lxml_5etree_C14NWriterTarget *__pyx_v_target = NULL;
  struct __pyx_obj_4lxml_5etree__FeedParser *__pyx_v_parser = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("canonicalize", 0);
  __Pyx_INCREF(__pyx_v_out);

  /* "src/lxml/serializer.pxi":844
 *     The configuration options are the same as for the ``C14NWriterTarget``.
 *     """
 *     if xml_data is None and from_file is None:             # <<<<<<<<<<<<<<
 *         raise ValueError("Either 'xml_data' or 'from_file' must be provided as input")
 * 
*/
  __pyx_t_2 = (__pyx_v_xml_data == Py_None);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_from_file == Py_None);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/serializer.pxi":845
 *     """
 *     if xml_data is None and from_file is None:
 *         raise ValueError("Either 'xml_data' or 'from_file' must be provided as input")             # <<<<<<<<<<<<<<
 * 
 *     sio = None
*/
    __pyx_t_4 = NULL;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Either_xml_data_or_from_file_mus};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 845, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(6, 845, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":844
 *     The configuration options are the same as for the ``C14NWriterTarget``.
 *     """
 *     if xml_data is None and from_file is None:             # <<<<<<<<<<<<<<
 *         raise ValueError("Either 'xml_data' or 'from_file' must be provided as input")
 * 
*/
  }

  /* "src/lxml/serializer.pxi":847
 *         raise ValueError("Either 'xml_data' or 'from_file' must be provided as input")
 * 
 *     sio = None             # <<<<<<<<<<<<<<
 *     if out is None:
 *         sio = out = StringIO()
*/
  __Pyx_INCREF(Py_None);
  __pyx_v_sio = Py_None;

  /* "src/lxml/serializer.pxi":848
 * 
 *     sio = None
 *     if out is None:             # <<<<<<<<<<<<<<
 *         sio = out = StringIO()
 * 
*/
  __pyx_t_1 = (__pyx_v_out == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":849
 *     sio = None
 *     if out is None:
 *         sio = out = StringIO()             # <<<<<<<<<<<<<<
 * 
 *     target = C14NWriterTarget(out.write, **options)
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_v_4lxml_5etree_StringIO);
    __pyx_t_6 = __pyx_v_4lxml_5etree_StringIO; 
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
      assert(__pyx_t_4);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 849, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_sio, __pyx_t_3);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_out, __pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":848
 * 
 *     sio = None
 *     if out is None:             # <<<<<<<<<<<<<<
 *         sio = out = StringIO()
 * 
*/
  }

  /* "src/lxml/serializer.pxi":851
 *         sio = out = StringIO()
 * 
 *     target = C14NWriterTarget(out.write, **options)             # <<<<<<<<<<<<<<
 * 
 *     if xml_data is not None and not isinstance(xml_data, basestring):
*/
  __pyx_t_6 = NULL;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_out, __pyx_mstate_global->__pyx_n_u_write); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 851, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_7 = PyDict_Copy(__pyx_v_options); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 851, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_4};
    __pyx_t_3 = __Pyx_PyObject_FastCallDict((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_C14NWriterTarget, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_7);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 851, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_3);
  }
  __pyx_v_target = ((struct __pyx_obj_4lxml_5etree_C14NWriterTarget *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/serializer.pxi":853
 *     target = C14NWriterTarget(out.write, **options)
 * 
 *     if xml_data is not None and not isinstance(xml_data, basestring):             # <<<<<<<<<<<<<<
 *         _tree_to_target(xml_data, target)
 *         return sio.getvalue() if sio is not None else None
*/
  __pyx_t_2 = (__pyx_v_xml_data != Py_None);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L8_bool_binop_done;
  }
  __pyx_t_2 = PyUnicode_Check(__pyx_v_xml_data); 
  __pyx_t_8 = (!__pyx_t_2);
  __pyx_t_1 = __pyx_t_8;
  __pyx_L8_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":854
 * 
 *     if xml_data is not None and not isinstance(xml_data, basestring):
 *         _tree_to_target(xml_data, target)             # <<<<<<<<<<<<<<
 *         return sio.getvalue() if sio is not None else None
 * 
*/
    __pyx_t_3 = __pyx_f_4lxml_5etree__tree_to_target(__pyx_v_xml_data, ((PyObject *)__pyx_v_target)); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 854, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":855
 *     if xml_data is not None and not isinstance(xml_data, basestring):
 *         _tree_to_target(xml_data, target)
 *         return sio.getvalue() if sio is not None else None             # <<<<<<<<<<<<<<
 * 
 *     cdef _FeedParser parser = XMLParser(
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = (__pyx_v_sio != Py_None);
    if (__pyx_t_1) {
      __pyx_t_4 = __pyx_v_sio;
      __Pyx_INCREF(__pyx_t_4);
      __pyx_t_5 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
        __pyx_t_7 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_getvalue, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 855, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
      }
      __pyx_t_3 = __pyx_t_7;
      __pyx_t_7 = 0;
    } else {
      __Pyx_INCREF(Py_None);
      __pyx_t_3 = Py_None;
    }
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "src/lxml/serializer.pxi":853
 *     target = C14NWriterTarget(out.write, **options)
 * 
 *     if xml_data is not None and not isinstance(xml_data, basestring):             # <<<<<<<<<<<<<<
 *         _tree_to_target(xml_data, target)
 *         return sio.getvalue() if sio is not None else None
*/
  }

  /* "src/lxml/serializer.pxi":857
 *         return sio.getvalue() if sio is not None else None
 * 
 *     cdef _FeedParser parser = XMLParser(             # <<<<<<<<<<<<<<
 *         target=target,
 *         attribute_defaults=True,
*/
  __pyx_t_7 = NULL;

  /* "src/lxml/serializer.pxi":860
 *         target=target,
 *         attribute_defaults=True,
 *         collect_ids=False,             # <<<<<<<<<<<<<<
 *     )
 * 
*/
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 3 : 0)] = {__pyx_t_7, NULL};
    __pyx_t_4 = __Pyx_MakeVectorcallBuilderKwds(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 857, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_target, ((PyObject *)__pyx_v_target), __pyx_t_4, __pyx_callargs+1, 0) < (0)) __PYX_ERR(6, 857, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_attribute_defaults, Py_True, __pyx_t_4, __pyx_callargs+1, 1) < (0)) __PYX_ERR(6, 857, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_collect_ids, Py_False, __pyx_t_4, __pyx_callargs+1, 2) < (0)) __PYX_ERR(6, 857, __pyx_L1_error)
    __pyx_t_3 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XMLParser, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 857, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_3);
  }
  __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__FeedParser *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/serializer.pxi":863
 *     )
 * 
 *     if xml_data is not None:             # <<<<<<<<<<<<<<
 *         parser.feed(xml_data)
 *         parser.close()
*/
  __pyx_t_1 = (__pyx_v_xml_data != Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":864
 * 
 *     if xml_data is not None:
 *         parser.feed(xml_data)             # <<<<<<<<<<<<<<
 *         parser.close()
 *     elif from_file is not None:
*/
    __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree__FeedParser *)__pyx_v_parser->__pyx_base.__pyx_vtab)->feed(__pyx_v_parser, __pyx_v_xml_data, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 864, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":865
 *     if xml_data is not None:
 *         parser.feed(xml_data)
 *         parser.close()             # <<<<<<<<<<<<<<
 *     elif from_file is not None:
 *         try:
*/
    __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree__FeedParser *)__pyx_v_parser->__pyx_base.__pyx_vtab)->close(__pyx_v_parser, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 865, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":863
 *     )
 * 
 *     if xml_data is not None:             # <<<<<<<<<<<<<<
 *         parser.feed(xml_data)
 *         parser.close()
*/
    goto __pyx_L10;
  }

  /* "src/lxml/serializer.pxi":866
 *         parser.feed(xml_data)
 *         parser.close()
 *     elif from_file is not None:             # <<<<<<<<<<<<<<
 *         try:
 *             _parseDocument(from_file, parser, base_url=None)
*/
  __pyx_t_1 = (__pyx_v_from_file != Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":867
 *         parser.close()
 *     elif from_file is not None:
 *         try:             # <<<<<<<<<<<<<<
 *             _parseDocument(from_file, parser, base_url=None)
 *         except _TargetParserResult:
*/
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      /*try:*/ {

        /* "src/lxml/serializer.pxi":868
 *     elif from_file is not None:
 *         try:
 *             _parseDocument(from_file, parser, base_url=None)             # <<<<<<<<<<<<<<
 *         except _TargetParserResult:
 *             pass
*/
        __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__parseDocument(__pyx_v_from_file, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_parser), Py_None)); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 868, __pyx_L11_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "src/lxml/serializer.pxi":867
 *         parser.close()
 *     elif from_file is not None:
 *         try:             # <<<<<<<<<<<<<<
 *             _parseDocument(from_file, parser, base_url=None)
 *         except _TargetParserResult:
*/
      }
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      goto __pyx_L16_try_end;
      __pyx_L11_error:;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "src/lxml/serializer.pxi":869
 *         try:
 *             _parseDocument(from_file, parser, base_url=None)
 *         except _TargetParserResult:             # <<<<<<<<<<<<<<
 *             pass
 * 
*/
      __Pyx_ErrFetch(&__pyx_t_3, &__pyx_t_4, &__pyx_t_7);
      __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_TargetParserResult); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 869, __pyx_L13_except_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_12 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_3, __pyx_t_6);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_ErrRestore(__pyx_t_3, __pyx_t_4, __pyx_t_7);
      __pyx_t_3 = 0; __pyx_t_4 = 0; __pyx_t_7 = 0;
      if (__pyx_t_12) {
        __Pyx_ErrRestore(0,0,0);
        goto __pyx_L12_exception_handled;
      }
      goto __pyx_L13_except_error;

      /* "src/lxml/serializer.pxi":867
 *         parser.close()
 *     elif from_file is not None:
 *         try:             # <<<<<<<<<<<<<<
 *             _parseDocument(from_file, parser, base_url=None)
 *         except _TargetParserResult:
*/
      __pyx_L13_except_error:;
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      goto __pyx_L1_error;
      __pyx_L12_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      __pyx_L16_try_end:;
    }

    /* "src/lxml/serializer.pxi":866
 *         parser.feed(xml_data)
 *         parser.close()
 *     elif from_file is not None:             # <<<<<<<<<<<<<<
 *         try:
 *             _parseDocument(from_file, parser, base_url=None)
*/
  }
  __pyx_L10:;

  /* "src/lxml/serializer.pxi":872
 *             pass
 * 
 *     return sio.getvalue() if sio is not None else None             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = (__pyx_v_sio != Py_None);
  if (__pyx_t_1) {
    __pyx_t_3 = __pyx_v_sio;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_5 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_getvalue, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 872, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __pyx_t_7 = __pyx_t_4;
    __pyx_t_4 = 0;
  } else {
    __Pyx_INCREF(Py_None);
    __pyx_t_7 = Py_None;
  }
  __pyx_r = __pyx_t_7;
  __pyx_t_7 = 0;
  goto __pyx_L0;

  /* "src/lxml/serializer.pxi":831
 * # C14N 2.0
 * 
 * def canonicalize(xml_data=None, *, out=None, from_file=None, **options):             # <<<<<<<<<<<<<<
 *     """Convert XML to its C14N 2.0 serialised form.
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree.canonicalize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_sio);
  __Pyx_XDECREF((PyObject *)__pyx_v_target);
  __Pyx_XDECREF((PyObject *)__pyx_v_parser);
  __Pyx_XDECREF(__pyx_v_out);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":875
 * 
 * 
 * cdef _tree_to_target(element, target):             # <<<<<<<<<<<<<<
 *     for event, elem in iterwalk(element, events=('start', 'end', 'start-ns', 'comment', 'pi')):
 *         text = None
*/

static PyObject *__pyx_f_4lxml_5etree__tree_to_target(PyObject *__pyx_v_element, PyObject *__pyx_v_target) {
  PyObject *__pyx_v_event = NULL;
  PyObject *__pyx_v_elem = NULL;
  PyObject *__pyx_v_text = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *(*__pyx_t_6)(PyObject *);
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *(*__pyx_t_9)(PyObject *);
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_tree_to_target", 0);

  /* "src/lxml/serializer.pxi":876
 * 
 * cdef _tree_to_target(element, target):
 *     for event, elem in iterwalk(element, events=('start', 'end', 'start-ns', 'comment', 'pi')):             # <<<<<<<<<<<<<<
 *         text = None
 *         if event == 'start':
*/
  __pyx_t_2 = NULL;
  __pyx_t_3 = 1;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_2, __pyx_v_element};
    __pyx_t_4 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 876, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_events, __pyx_mstate_global->__pyx_tuple[8], __pyx_t_4, __pyx_callargs+2, 0) < (0)) __PYX_ERR(6, 876, __pyx_L1_error)
    __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_iterwalk, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 876, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  if (likely(PyList_CheckExact(((PyObject *)__pyx_t_1))) || PyTuple_CheckExact(((PyObject *)__pyx_t_1))) {
    __pyx_t_4 = ((PyObject *)__pyx_t_1); __Pyx_INCREF(__pyx_t_4);
    __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
  } else {
    __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 876, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 876, __pyx_L1_error)
  }
  __Pyx_DECREF((PyObject *)__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_6)) {
      if (likely(PyList_CheckExact(__pyx_t_4))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_4);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(6, 876, __pyx_L1_error)
          #endif
          if (__pyx_t_5 >= __pyx_temp) break;
        }
        __pyx_t_1 = __Pyx_PyList_GetItemRefFast(__pyx_t_4, __pyx_t_5, __Pyx_ReferenceSharing_OwnStrongReference);
        ++__pyx_t_5;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(6, 876, __pyx_L1_error)
          #endif
          if (__pyx_t_5 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5));
        #else
        __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_5);
        #endif
        ++__pyx_t_5;
      }
      if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 876, __pyx_L1_error)
    } else {
      __pyx_t_1 = __pyx_t_6(__pyx_t_4);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(6, 876, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_1);
    if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
      PyObject* sequence = __pyx_t_1;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(6, 876, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
        __Pyx_INCREF(__pyx_t_2);
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1);
        __Pyx_INCREF(__pyx_t_7);
      } else {
        __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 876, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_2);
        __pyx_t_7 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 876, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_7);
      }
      #else
      __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 876, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_7 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 876, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_8 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 876, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_9 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_8);
      index = 0; __pyx_t_2 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_2);
      index = 1; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < (0)) __PYX_ERR(6, 876, __pyx_L1_error)
      __pyx_t_9 = NULL;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L6_unpacking_done;
      __pyx_L5_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_9 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(6, 876, __pyx_L1_error)
      __pyx_L6_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_event, __pyx_t_2);
    __pyx_t_2 = 0;
    __Pyx_XDECREF_SET(__pyx_v_elem, __pyx_t_7);
    __pyx_t_7 = 0;

    /* "src/lxml/serializer.pxi":877
 * cdef _tree_to_target(element, target):
 *     for event, elem in iterwalk(element, events=('start', 'end', 'start-ns', 'comment', 'pi')):
 *         text = None             # <<<<<<<<<<<<<<
 *         if event == 'start':
 *             target.start(elem.tag, elem.attrib)
*/
    __Pyx_INCREF(Py_None);
    __Pyx_XDECREF_SET(__pyx_v_text, Py_None);

    /* "src/lxml/serializer.pxi":878
 *     for event, elem in iterwalk(element, events=('start', 'end', 'start-ns', 'comment', 'pi')):
 *         text = None
 *         if event == 'start':             # <<<<<<<<<<<<<<
 *             target.start(elem.tag, elem.attrib)
 *             text = elem.text
*/
    __pyx_t_10 = (__Pyx_PyUnicode_Equals(__pyx_v_event, __pyx_mstate_global->__pyx_n_u_start, Py_EQ)); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(6, 878, __pyx_L1_error)
    if (__pyx_t_10) {

      /* "src/lxml/serializer.pxi":879
 *         text = None
 *         if event == 'start':
 *             target.start(elem.tag, elem.attrib)             # <<<<<<<<<<<<<<
 *             text = elem.text
 *         elif event == 'end':
*/
      __pyx_t_7 = __pyx_v_target;
      __Pyx_INCREF(__pyx_t_7);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_elem, __pyx_mstate_global->__pyx_n_u_tag); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 879, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_elem, __pyx_mstate_global->__pyx_n_u_attrib); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 879, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_3 = 0;
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_7, __pyx_t_2, __pyx_t_8};
        __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_start, __pyx_callargs+__pyx_t_3, (3-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 879, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "src/lxml/serializer.pxi":880
 *         if event == 'start':
 *             target.start(elem.tag, elem.attrib)
 *             text = elem.text             # <<<<<<<<<<<<<<
 *         elif event == 'end':
 *             target.end(elem.tag)
*/
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_elem, __pyx_mstate_global->__pyx_n_u_text); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 880, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF_SET(__pyx_v_text, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "src/lxml/serializer.pxi":878
 *     for event, elem in iterwalk(element, events=('start', 'end', 'start-ns', 'comment', 'pi')):
 *         text = None
 *         if event == 'start':             # <<<<<<<<<<<<<<
 *             target.start(elem.tag, elem.attrib)
 *             text = elem.text
*/
      goto __pyx_L7;
    }

    /* "src/lxml/serializer.pxi":881
 *             target.start(elem.tag, elem.attrib)
 *             text = elem.text
 *         elif event == 'end':             # <<<<<<<<<<<<<<
 *             target.end(elem.tag)
 *             text = elem.tail
*/
    __pyx_t_10 = (__Pyx_PyUnicode_Equals(__pyx_v_event, __pyx_mstate_global->__pyx_n_u_end, Py_EQ)); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(6, 881, __pyx_L1_error)
    if (__pyx_t_10) {

      /* "src/lxml/serializer.pxi":882
 *             text = elem.text
 *         elif event == 'end':
 *             target.end(elem.tag)             # <<<<<<<<<<<<<<
 *             text = elem.tail
 *         elif event == 'start-ns':
*/
      __pyx_t_8 = __pyx_v_target;
      __Pyx_INCREF(__pyx_t_8);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_elem, __pyx_mstate_global->__pyx_n_u_tag); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 882, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_t_2};
        __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_end, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 882, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "src/lxml/serializer.pxi":883
 *         elif event == 'end':
 *             target.end(elem.tag)
 *             text = elem.tail             # <<<<<<<<<<<<<<
 *         elif event == 'start-ns':
 *             target.start_ns(*elem)
*/
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_elem, __pyx_mstate_global->__pyx_n_u_tail); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 883, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF_SET(__pyx_v_text, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "src/lxml/serializer.pxi":881
 *             target.start(elem.tag, elem.attrib)
 *             text = elem.text
 *         elif event == 'end':             # <<<<<<<<<<<<<<
 *             target.end(elem.tag)
 *             text = elem.tail
*/
      goto __pyx_L7;
    }

    /* "src/lxml/serializer.pxi":884
 *             target.end(elem.tag)
 *             text = elem.tail
 *         elif event == 'start-ns':             # <<<<<<<<<<<<<<
 *             target.start_ns(*elem)
 *             continue
*/
    __pyx_t_10 = (__Pyx_PyUnicode_Equals(__pyx_v_event, __pyx_mstate_global->__pyx_kp_u_start_ns, Py_EQ)); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(6, 884, __pyx_L1_error)
    if (__pyx_t_10) {

      /* "src/lxml/serializer.pxi":885
 *             text = elem.tail
 *         elif event == 'start-ns':
 *             target.start_ns(*elem)             # <<<<<<<<<<<<<<
 *             continue
 *         elif event == 'comment':
*/
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_target, __pyx_mstate_global->__pyx_n_u_start_ns_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 885, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PySequence_Tuple(__pyx_v_elem); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 885, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 885, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "src/lxml/serializer.pxi":886
 *         elif event == 'start-ns':
 *             target.start_ns(*elem)
 *             continue             # <<<<<<<<<<<<<<
 *         elif event == 'comment':
 *             target.comment(elem.text)
*/
      goto __pyx_L3_continue;

      /* "src/lxml/serializer.pxi":884
 *             target.end(elem.tag)
 *             text = elem.tail
 *         elif event == 'start-ns':             # <<<<<<<<<<<<<<
 *             target.start_ns(*elem)
 *             continue
*/
    }

    /* "src/lxml/serializer.pxi":887
 *             target.start_ns(*elem)
 *             continue
 *         elif event == 'comment':             # <<<<<<<<<<<<<<
 *             target.comment(elem.text)
 *             text = elem.tail
*/
    __pyx_t_10 = (__Pyx_PyUnicode_Equals(__pyx_v_event, __pyx_mstate_global->__pyx_n_u_comment, Py_EQ)); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(6, 887, __pyx_L1_error)
    if (__pyx_t_10) {

      /* "src/lxml/serializer.pxi":888
 *             continue
 *         elif event == 'comment':
 *             target.comment(elem.text)             # <<<<<<<<<<<<<<
 *             text = elem.tail
 *         elif event == 'pi':
*/
      __pyx_t_2 = __pyx_v_target;
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_elem, __pyx_mstate_global->__pyx_n_u_text); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 888, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_1};
        __pyx_t_8 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_comment, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 888, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
      }
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "src/lxml/serializer.pxi":889
 *         elif event == 'comment':
 *             target.comment(elem.text)
 *             text = elem.tail             # <<<<<<<<<<<<<<
 *         elif event == 'pi':
 *             target.pi(elem.target, elem.text)
*/
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_elem, __pyx_mstate_global->__pyx_n_u_tail); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 889, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF_SET(__pyx_v_text, __pyx_t_8);
      __pyx_t_8 = 0;

      /* "src/lxml/serializer.pxi":887
 *             target.start_ns(*elem)
 *             continue
 *         elif event == 'comment':             # <<<<<<<<<<<<<<
 *             target.comment(elem.text)
 *             text = elem.tail
*/
      goto __pyx_L7;
    }

    /* "src/lxml/serializer.pxi":890
 *             target.comment(elem.text)
 *             text = elem.tail
 *         elif event == 'pi':             # <<<<<<<<<<<<<<
 *             target.pi(elem.target, elem.text)
 *             text = elem.tail
*/
    __pyx_t_10 = (__Pyx_PyUnicode_Equals(__pyx_v_event, __pyx_mstate_global->__pyx_n_u_pi, Py_EQ)); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(6, 890, __pyx_L1_error)
    if (__pyx_t_10) {

      /* "src/lxml/serializer.pxi":891
 *             text = elem.tail
 *         elif event == 'pi':
 *             target.pi(elem.target, elem.text)             # <<<<<<<<<<<<<<
 *             text = elem.tail
 *         if text:
*/
      __pyx_t_1 = __pyx_v_target;
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_elem, __pyx_mstate_global->__pyx_n_u_target); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 891, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_elem, __pyx_mstate_global->__pyx_n_u_text); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 891, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_3 = 0;
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_1, __pyx_t_2, __pyx_t_7};
        __pyx_t_8 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_pi, __pyx_callargs+__pyx_t_3, (3-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 891, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
      }
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "src/lxml/serializer.pxi":892
 *         elif event == 'pi':
 *             target.pi(elem.target, elem.text)
 *             text = elem.tail             # <<<<<<<<<<<<<<
 *         if text:
 *             target.data(text)
*/
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_elem, __pyx_mstate_global->__pyx_n_u_tail); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 892, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF_SET(__pyx_v_text, __pyx_t_8);
      __pyx_t_8 = 0;

      /* "src/lxml/serializer.pxi":890
 *             target.comment(elem.text)
 *             text = elem.tail
 *         elif event == 'pi':             # <<<<<<<<<<<<<<
 *             target.pi(elem.target, elem.text)
 *             text = elem.tail
*/
    }
    __pyx_L7:;

    /* "src/lxml/serializer.pxi":893
 *             target.pi(elem.target, elem.text)
 *             text = elem.tail
 *         if text:             # <<<<<<<<<<<<<<
 *             target.data(text)
 *     return target.close()
*/
    __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_v_text); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(6, 893, __pyx_L1_error)
    if (__pyx_t_10) {

      /* "src/lxml/serializer.pxi":894
 *             text = elem.tail
 *         if text:
 *             target.data(text)             # <<<<<<<<<<<<<<
 *     return target.close()
 * 
*/
      __pyx_t_7 = __pyx_v_target;
      __Pyx_INCREF(__pyx_t_7);
      __pyx_t_3 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_v_text};
        __pyx_t_8 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_data, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 894, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
      }
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "src/lxml/serializer.pxi":893
 *             target.pi(elem.target, elem.text)
 *             text = elem.tail
 *         if text:             # <<<<<<<<<<<<<<
 *             target.data(text)
 *     return target.close()
*/
    }

    /* "src/lxml/serializer.pxi":876
 * 
 * cdef _tree_to_target(element, target):
 *     for event, elem in iterwalk(element, events=('start', 'end', 'start-ns', 'comment', 'pi')):             # <<<<<<<<<<<<<<
 *         text = None
 *         if event == 'start':
*/
    __pyx_L3_continue:;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "src/lxml/serializer.pxi":895
 *         if text:
 *             target.data(text)
 *     return target.close()             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_8 = __pyx_v_target;
  __Pyx_INCREF(__pyx_t_8);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_8, NULL};
    __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_close, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 895, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "src/lxml/serializer.pxi":875
 * 
 * 
 * cdef _tree_to_target(element, target):             # <<<<<<<<<<<<<<
 *     for event, elem in iterwalk(element, events=('start', 'end', 'start-ns', 'comment', 'pi')):
 *         text = None
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("lxml.etree._tree_to_target", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_event);
  __Pyx_XDECREF(__pyx_v_elem);
  __Pyx_XDECREF(__pyx_v_text);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":937
 *     cdef bint _root_done
 * 
 *     def __init__(self, write, *,             # <<<<<<<<<<<<<<
 *                  with_comments=False, strip_text=False, rewrite_prefixes=False,
 *                  qname_aware_tags=None, qname_aware_attrs=None,
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_16C14NWriterTarget_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_16C14NWriterTarget_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_write = 0;
  PyObject *__pyx_v_with_comments = 0;
  PyObject *__pyx_v_strip_text = 0;
  PyObject *__pyx_v_rewrite_prefixes = 0;
  PyObject *__pyx_v_qname_aware_tags = 0;
  PyObject *__pyx_v_qname_aware_attrs = 0;
  PyObject *__pyx_v_exclude_attrs = 0;
  PyObject *__pyx_v_exclude_tags = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[8] = {0,0,0,0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_write,&__pyx_mstate_global->__pyx_n_u_with_comments,&__pyx_mstate_global->__pyx_n_u_strip_text,&__pyx_mstate_global->__pyx_n_u_rewrite_prefixes,&__pyx_mstate_global->__pyx_n_u_qname_aware_tags,&__pyx_mstate_global->__pyx_n_u_qname_aware_attrs,&__pyx_mstate_global->__pyx_n_u_exclude_attrs,&__pyx_mstate_global->__pyx_n_u_exclude_tags,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(6, 937, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 937, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(6, 937, __pyx_L3_error)

      /* "src/lxml/serializer.pxi":938
 * 
 *     def __init__(self, write, *,
 *                  with_comments=False, strip_text=False, rewrite_prefixes=False,             # <<<<<<<<<<<<<<
 *                  qname_aware_tags=None, qname_aware_attrs=None,
 *                  exclude_attrs=None, exclude_tags=None):
*/
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_False));

      /* "src/lxml/serializer.pxi":939
 *     def __init__(self, write, *,
 *                  with_comments=False, strip_text=False, rewrite_prefixes=False,
 *                  qname_aware_tags=None, qname_aware_attrs=None,             # <<<<<<<<<<<<<<
 *                  exclude_attrs=None, exclude_tags=None):
 *         self._write = write
*/
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "src/lxml/serializer.pxi":940
 *                  with_comments=False, strip_text=False, rewrite_prefixes=False,
 *                  qname_aware_tags=None, qname_aware_attrs=None,
 *                  exclude_attrs=None, exclude_tags=None):             # <<<<<<<<<<<<<<
 *         self._write = write
 *         self._data = []
*/
      if (!values[6]) values[6] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[7]) values[7] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, i); __PYX_ERR(6, 937, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 937, __pyx_L3_error)

      /* "src/lxml/serializer.pxi":938
 * 
 *     def __init__(self, write, *,
 *                  with_comments=False, strip_text=False, rewrite_prefixes=False,             # <<<<<<<<<<<<<<
 *                  qname_aware_tags=None, qname_aware_attrs=None,
 *                  exclude_attrs=None, exclude_tags=None):
*/
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_False));

      /* "src/lxml/serializer.pxi":939
 *     def __init__(self, write, *,
 *                  with_comments=False, strip_text=False, rewrite_prefixes=False,
 *                  qname_aware_tags=None, qname_aware_attrs=None,             # <<<<<<<<<<<<<<
 *                  exclude_attrs=None, exclude_tags=None):
 *         self._write = write
*/
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "src/lxml/serializer.pxi":940
 *                  with_comments=False, strip_text=False, rewrite_prefixes=False,
 *                  qname_aware_tags=None, qname_aware_attrs=None,
 *                  exclude_attrs=None, exclude_tags=None):             # <<<<<<<<<<<<<<
 *         self._write = write
 *         self._data = []
*/
      if (!values[6]) values[6] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[7]) values[7] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_write = values[0];
    __pyx_v_with_comments = values[1];
    __pyx_v_strip_text = values[2];
    __pyx_v_rewrite_prefixes = values[3];
    __pyx_v_qname_aware_tags = values[4];
    __pyx_v_qname_aware_attrs = values[5];
    __pyx_v_exclude_attrs = values[6];
    __pyx_v_exclude_tags = values[7];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, __pyx_nargs); __PYX_ERR(6, 937, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.C14NWriterTarget.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_16C14NWriterTarget___init__(((struct __pyx_obj_4lxml_5etree_C14NWriterTarget *)__pyx_v_self), __pyx_v_write, __pyx_v_with_comments, __pyx_v_strip_text, __pyx_v_rewrite_prefixes, __pyx_v_qname_aware_tags, __pyx_v_qname_aware_attrs, __pyx_v_exclude_attrs, __pyx_v_exclude_tags);

  /* "src/lxml/serializer.pxi":937
 *     cdef bint _root_done
 * 
 *     def __init__(self, write, *,             # <<<<<<<<<<<<<<
 *                  with_comments=False, strip_text=False, rewrite_prefixes=False,
 *                  qname_aware_tags=None, qname_aware_attrs=None,
*/

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_16C14NWriterTarget___init__(struct __pyx_obj_4lxml_5etree_C14NWriterTarget *__pyx_v_self, PyObject *__pyx_v_write, PyObject *__pyx_v_with_comments, PyObject *__pyx_v_strip_text, PyObject *__pyx_v_rewrite_prefixes, PyObject *__pyx_v_qname_aware_tags, PyObject *__pyx_v_qname_aware_attrs, PyObject *__pyx_v_exclude_attrs, PyObject *__pyx_v_exclude_tags) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "src/lxml/serializer.pxi":941
 *                  qname_aware_tags=None, qname_aware_attrs=None,
 *                  exclude_attrs=None, exclude_tags=None):
 *         self._write = write             # <<<<<<<<<<<<<<
 *         self._data = []
 *         self._with_comments = with_comments
*/
  __Pyx_INCREF(__pyx_v_write);
  __Pyx_GIVEREF(__pyx_v_write);
  __Pyx_GOTREF(__pyx_v_self->_write);
  __Pyx_DECREF(__pyx_v_self->_write);
  __pyx_v_self->_write = __pyx_v_write;

  /* "src/lxml/serializer.pxi":942
 *                  exclude_attrs=None, exclude_tags=None):
 *         self._write = write
 *         self._data = []             # <<<<<<<<<<<<<<
 *         self._with_comments = with_comments
 *         self._strip_text = strip_text
*/
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 942, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_data);
  __Pyx_DECREF(__pyx_v_self->_data);
  __pyx_v_self->_data = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/serializer.pxi":943
 *         self._write = write
 *         self._data = []
 *         self._with_comments = with_comments             # <<<<<<<<<<<<<<
 *         self._strip_text = strip_text
 *         self._exclude_attrs = set(exclude_attrs) if exclude_attrs else None
*/
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_with_comments); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(6, 943, __pyx_L1_error)
  __pyx_v_self->_with_comments = __pyx_t_2;

  /* "src/lxml/serializer.pxi":944
 *         self._data = []
 *         self._with_comments = with_comments
 *         self._strip_text = strip_text             # <<<<<<<<<<<<<<
 *         self._exclude_attrs = set(exclude_attrs) if exclude_attrs else None
 *         self._exclude_tags = set(exclude_tags) if exclude_tags else None
*/
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_strip_text); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(6, 944, __pyx_L1_error)
  __pyx_v_self->_strip_text = __pyx_t_2;

  /* "src/lxml/serializer.pxi":945
 *         self._with_comments = with_comments
 *         self._strip_text = strip_text
 *         self._exclude_attrs = set(exclude_attrs) if exclude_attrs else None             # <<<<<<<<<<<<<<
 *         self._exclude_tags = set(exclude_tags) if exclude_tags else None
 * 
*/
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_exclude_attrs); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(6, 945, __pyx_L1_error)
  if (__pyx_t_2) {
    __pyx_t_3 = PySet_New(__pyx_v_exclude_attrs); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 945, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
  } else {
    __Pyx_INCREF(Py_None);
    __pyx_t_1 = Py_None;
  }
  if (!(likely(PySet_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("set", __pyx_t_1))) __PYX_ERR(6, 945, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_exclude_attrs);
  __Pyx_DECREF(__pyx_v_self->_exclude_attrs);
  __pyx_v_self->_exclude_attrs = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/serializer.pxi":946
 *         self._strip_text = strip_text
 *         self._exclude_attrs = set(exclude_attrs) if exclude_attrs else None
 *         self._exclude_tags = set(exclude_tags) if exclude_tags else None             # <<<<<<<<<<<<<<
 * 
 *         self._rewrite_prefixes = rewrite_prefixes
*/
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_exclude_tags); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(6, 946, __pyx_L1_error)
  if (__pyx_t_2) {
    __pyx_t_3 = PySet_New(__pyx_v_exclude_tags); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 946, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
  } else {
    __Pyx_INCREF(Py_None);
    __pyx_t_1 = Py_None;
  }
  if (!(likely(PySet_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("set", __pyx_t_1))) __PYX_ERR(6, 946, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_exclude_tags);
  __Pyx_DECREF(__pyx_v_self->_exclude_tags);
  __pyx_v_self->_exclude_tags = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/serializer.pxi":948
 *         self._exclude_tags = set(exclude_tags) if exclude_tags else None
 * 
 *         self._rewrite_prefixes = rewrite_prefixes             # <<<<<<<<<<<<<<
 *         if qname_aware_tags:
 *             self._qname_aware_tags = set(qname_aware_tags)
*/
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_rewrite_prefixes); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(6, 948, __pyx_L1_error)
  __pyx_v_self->_rewrite_prefixes = __pyx_t_2;

  /* "src/lxml/serializer.pxi":949
 * 
 *         self._rewrite_prefixes = rewrite_prefixes
 *         if qname_aware_tags:             # <<<<<<<<<<<<<<
 *             self._qname_aware_tags = set(qname_aware_tags)
 *         else:
*/
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_qname_aware_tags); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(6, 949, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "src/lxml/serializer.pxi":950
 *         self._rewrite_prefixes = rewrite_prefixes
 *         if qname_aware_tags:
 *             self._qname_aware_tags = set(qname_aware_tags)             # <<<<<<<<<<<<<<
 *         else:
 *             self._qname_aware_tags = None
*/
    __pyx_t_1 = PySet_New(__pyx_v_qname_aware_tags); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 950, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __Pyx_GOTREF(__pyx_v_self->_qname_aware_tags);
    __Pyx_DECREF(__pyx_v_self->_qname_aware_tags);
    __pyx_v_self->_qname_aware_tags = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/serializer.pxi":949
 * 
 *         self._rewrite_prefixes = rewrite_prefixes
 *         if qname_aware_tags:             # <<<<<<<<<<<<<<
 *             self._qname_aware_tags = set(qname_aware_tags)
 *         else:
*/
    goto __pyx_L3;
  }

  /* "src/lxml/serializer.pxi":952
 *             self._qname_aware_tags = set(qname_aware_tags)
 *         else:
 *             self._qname_aware_tags = None             # <<<<<<<<<<<<<<
 *         if qname_aware_attrs:
 *             self._find_qname_aware_attrs = set(qname_aware_attrs).intersection
*/
  /*else*/ {
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_self->_qname_aware_tags);
    __Pyx_DECREF(__pyx_v_self->_qname_aware_tags);
    __pyx_v_self->_qname_aware_tags = ((PyObject*)Py_None);
  }
  __pyx_L3:;

  /* "src/lxml/serializer.pxi":953
 *         else:
 *             self._qname_aware_tags = None
 *         if qname_aware_attrs:             # <<<<<<<<<<<<<<
 *             self._find_qname_aware_attrs = set(qname_aware_attrs).intersection
 *         else:
*/
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_qname_aware_attrs); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(6, 953, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "src/lxml/serializer.pxi":954
 *             self._qname_aware_tags = None
 *         if qname_aware_attrs:
 *             self._find_qname_aware_attrs = set(qname_aware_attrs).intersection             # <<<<<<<<<<<<<<
 *         else:
 *             self._find_qname_aware_attrs = None
*/
    __pyx_t_1 = PySet_New(__pyx_v_qname_aware_attrs); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 954, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_intersection); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 954, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF(__pyx_v_self->_find_qname_aware_attrs);
    __Pyx_DECREF(__pyx_v_self->_find_qname_aware_attrs);
    __pyx_v_self->_find_qname_aware_attrs = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":953
 *         else:
 *             self._qname_aware_tags = None
 *         if qname_aware_attrs:             # <<<<<<<<<<<<<<
 *             self._find_qname_aware_attrs = set(qname_aware_attrs).intersection
 *         else:
*/
    goto __pyx_L4;
  }

  /* "src/lxml/serializer.pxi":956
 *             self._find_qname_aware_attrs = set(qname_aware_attrs).intersection
 *         else:
 *             self._find_qname_aware_attrs = None             # <<<<<<<<<<<<<<
 * 
 *         # Stack with globally and newly declared namespaces as (uri, prefix) pairs.
*/
  /*else*/ {
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_self->_find_qname_aware_attrs);
    __Pyx_DECREF(__pyx_v_self->_find_qname_aware_attrs);
    __pyx_v_self->_find_qname_aware_attrs = Py_None;
  }
  __pyx_L4:;

  /* "src/lxml/serializer.pxi":959
 * 
 *         # Stack with globally and newly declared namespaces as (uri, prefix) pairs.
 *         self._declared_ns_stack = [[             # <<<<<<<<<<<<<<
 *             ("http://www.w3.org/XML/1998/namespace", "xml"),
 *         ]]
*/
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 959, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_mstate_global->__pyx_tuple[9]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[9]);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, __pyx_mstate_global->__pyx_tuple[9]) != (0)) __PYX_ERR(6, 959, __pyx_L1_error);
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 959, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_3);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_3) != (0)) __PYX_ERR(6, 959, __pyx_L1_error);
  __pyx_t_3 = 0;
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_declared_ns_stack);
  __Pyx_DECREF(__pyx_v_self->_declared_ns_stack);
  __pyx_v_self->_declared_ns_stack = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/serializer.pxi":963
 *         ]]
 *         # Stack with user declared namespace prefixes as (uri, prefix) pairs.
 *         self._ns_stack = []             # <<<<<<<<<<<<<<
 *         if not rewrite_prefixes:
 *             self._ns_stack.append(_DEFAULT_NAMESPACE_PREFIXES_ITEMS)
*/
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 963, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_ns_stack);
  __Pyx_DECREF(__pyx_v_self->_ns_stack);
  __pyx_v_self->_ns_stack = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/serializer.pxi":964
 *         # Stack with user declared namespace prefixes as (uri, prefix) pairs.
 *         self._ns_stack = []
 *         if not rewrite_prefixes:             # <<<<<<<<<<<<<<
 *             self._ns_stack.append(_DEFAULT_NAMESPACE_PREFIXES_ITEMS)
 *         self._ns_stack.append([])
*/
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_rewrite_prefixes); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(6, 964, __pyx_L1_error)
  __pyx_t_4 = (!__pyx_t_2);
  if (__pyx_t_4) {

    /* "src/lxml/serializer.pxi":965
 *         self._ns_stack = []
 *         if not rewrite_prefixes:
 *             self._ns_stack.append(_DEFAULT_NAMESPACE_PREFIXES_ITEMS)             # <<<<<<<<<<<<<<
 *         self._ns_stack.append([])
 *         self._prefix_map = {}
*/
    if (unlikely(__pyx_v_self->_ns_stack == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
      __PYX_ERR(6, 965, __pyx_L1_error)
    }
    __pyx_t_1 = __pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES_ITEMS;
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_self->_ns_stack, __pyx_t_1); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(6, 965, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "src/lxml/serializer.pxi":964
 *         # Stack with user declared namespace prefixes as (uri, prefix) pairs.
 *         self._ns_stack = []
 *         if not rewrite_prefixes:             # <<<<<<<<<<<<<<
 *             self._ns_stack.append(_DEFAULT_NAMESPACE_PREFIXES_ITEMS)
 *         self._ns_stack.append([])
*/
  }

  /* "src/lxml/serializer.pxi":966
 *         if not rewrite_prefixes:
 *             self._ns_stack.append(_DEFAULT_NAMESPACE_PREFIXES_ITEMS)
 *         self._ns_stack.append([])             # <<<<<<<<<<<<<<
 *         self._prefix_map = {}
 *         self._preserve_space = [False]
*/
  if (unlikely(__pyx_v_self->_ns_stack == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
    __PYX_ERR(6, 966, __pyx_L1_error)
  }
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 966, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_self->_ns_stack, __pyx_t_1); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(6, 966, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/serializer.pxi":967
 *             self._ns_stack.append(_DEFAULT_NAMESPACE_PREFIXES_ITEMS)
 *         self._ns_stack.append([])
 *         self._prefix_map = {}             # <<<<<<<<<<<<<<
 *         self._preserve_space = [False]
 *         self._pending_start = None
*/
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 967, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_prefix_map);
  __Pyx_DECREF(__pyx_v_self->_prefix_map);
  __pyx_v_self->_prefix_map = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/serializer.pxi":968
 *         self._ns_stack.append([])
 *         self._prefix_map = {}
 *         self._preserve_space = [False]             # <<<<<<<<<<<<<<
 *         self._pending_start = None
 *         self._ignored_depth = 0
*/
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 968, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(Py_False);
  __Pyx_GIVEREF(Py_False);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, Py_False) != (0)) __PYX_ERR(6, 968, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_preserve_space);
  __Pyx_DECREF(__pyx_v_self->_preserve_space);
  __pyx_v_self->_preserve_space = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/serializer.pxi":969
 *         self._prefix_map = {}
 *         self._preserve_space = [False]
 *         self._pending_start = None             # <<<<<<<<<<<<<<
 *         self._ignored_depth = 0
 *         self._root_seen = False
*/
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_pending_start);
  __Pyx_DECREF(__pyx_v_self->_pending_start);
  __pyx_v_self->_pending_start = ((PyObject*)Py_None);

  /* "src/lxml/serializer.pxi":970
 *         self._preserve_space = [False]
 *         self._pending_start = None
 *         self._ignored_depth = 0             # <<<<<<<<<<<<<<
 *         self._root_seen = False
 *         self._root_done = False
*/
  __pyx_v_self->_ignored_depth = 0;

  /* "src/lxml/serializer.pxi":971
 *         self._pending_start = None
 *         self._ignored_depth = 0
 *         self._root_seen = False             # <<<<<<<<<<<<<<
 *         self._root_done = False
 * 
*/
  __pyx_v_self->_root_seen = 0;

  /* "src/lxml/serializer.pxi":972
 *         self._ignored_depth = 0
 *         self._root_seen = False
 *         self._root_done = False             # <<<<<<<<<<<<<<
 * 
 *     def _iter_namespaces(self, ns_stack):
*/
  __pyx_v_self->_root_done = 0;

  /* "src/lxml/serializer.pxi":937
 *     cdef bint _root_done
 * 
 *     def __init__(self, write, *,             # <<<<<<<<<<<<<<
 *                  with_comments=False, strip_text=False, rewrite_prefixes=False,
 *                  qname_aware_tags=None, qname_aware_attrs=None,
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.C14NWriterTarget.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_4lxml_5etree_16C14NWriterTarget_4generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "src/lxml/serializer.pxi":974
 *         self._root_done = False
 * 
 *     def _iter_namespaces(self, ns_stack):             # <<<<<<<<<<<<<<
 *         for namespaces in reversed(ns_stack):
 *             if namespaces:  # almost no element declares new namespaces
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_16C14NWriterTarget_3_iter_namespaces(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_16C14NWriterTarget_3_iter_namespaces = {"_iter_namespaces", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_16C14NWriterTarget_3_iter_namespaces, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_16C14NWriterTarget_3_iter_namespaces(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_ns_stack = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_iter_namespaces (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_ns_stack,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(6, 974, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 974, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_iter_namespaces", 0) < (0)) __PYX_ERR(6, 974, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_iter_namespaces", 1, 1, 1, i); __PYX_ERR(6, 974, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 974, __pyx_L3_error)
    }
    __pyx_v_ns_stack = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_iter_namespaces", 1, 1, 1, __pyx_nargs); __PYX_ERR(6, 974, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.C14NWriterTarget._iter_namespaces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_16C14NWriterTarget_2_iter_namespaces(((struct __pyx_obj_4lxml_5etree_C14NWriterTarget *)__pyx_v_self), __pyx_v_ns_stack);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_16C14NWriterTarget_2_iter_namespaces(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree_C14NWriterTarget *__pyx_v_self, PyObject *__pyx_v_ns_stack) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_1__iter_namespaces *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_iter_namespaces", 0);
  __pyx_cur_scope = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_1__iter_namespaces *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_1__iter_namespaces(__pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_1__iter_namespaces, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_1__iter_namespaces *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(6, 974, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_ns_stack = __pyx_v_ns_stack;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_ns_stack);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_ns_stack);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4lxml_5etree_16C14NWriterTarget_4generator1, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[1]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_iter_namespaces, __pyx_mstate_global->__pyx_n_u_C14NWriterTarget__iter_namespace, __pyx_mstate_global->__pyx_n_u_lxml_etree); if (unlikely(!gen)) __PYX_ERR(6, 974, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.C14NWriterTarget._iter_namespaces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_4lxml_5etree_16C14NWriterTarget_4generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_1__iter_namespaces *__pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_1__iter_namespaces *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  PyObject *(*__pyx_t_5)(PyObject *);
  int __pyx_t_6;
  __Pyx_PySendResult __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_iter_namespaces", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L7_resume_from_yield_from;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(__pyx_sent_value != Py_None)) {
    if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator");
    __PYX_ERR(6, 974, __pyx_L1_error)
  }

  /* "src/lxml/serializer.pxi":975
 * 
 *     def _iter_namespaces(self, ns_stack):
 *         for namespaces in reversed(ns_stack):             # <<<<<<<<<<<<<<
 *             if namespaces:  # almost no element declares new namespaces
 *                 yield from namespaces
*/
  __pyx_t_2 = NULL;
  __pyx_t_3 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_cur_scope->__pyx_v_ns_stack};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_reversed, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 975, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2);
    __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
  } else {
    __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 975, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 975, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_5)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(6, 975, __pyx_L1_error)
          #endif
          if (__pyx_t_4 >= __pyx_temp) break;
        }
        __pyx_t_1 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_4, __Pyx_ReferenceSharing_OwnStrongReference);
        ++__pyx_t_4;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(6, 975, __pyx_L1_error)
          #endif
          if (__pyx_t_4 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4));
        #else
        __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_4);
        #endif
        ++__pyx_t_4;
      }
      if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 975, __pyx_L1_error)
    } else {
      __pyx_t_1 = __pyx_t_5(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(6, 975, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_namespaces);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_namespaces, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/serializer.pxi":976
 *     def _iter_namespaces(self, ns_stack):
 *         for namespaces in reversed(ns_stack):
 *             if namespaces:  # almost no element declares new namespaces             # <<<<<<<<<<<<<<
 *                 yield from namespaces
 * 
*/
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_namespaces); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(6, 976, __pyx_L1_error)
    if (__pyx_t_6) {

      /* "src/lxml/serializer.pxi":977
 *         for namespaces in reversed(ns_stack):
 *             if namespaces:  # almost no element declares new namespaces
 *                 yield from namespaces             # <<<<<<<<<<<<<<
 * 
 *     cdef _resolve_prefix_name(self, prefixed_name):
*/
      __pyx_t_7 = __Pyx_Generator_Yield_From(__pyx_generator, __pyx_cur_scope->__pyx_v_namespaces, &__pyx_r);
      if (likely(__pyx_t_7 == PYGEN_NEXT)) {
        __Pyx_GOTREF(__pyx_r);
        __Pyx_XGIVEREF(__pyx_t_2);
        __pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
        __pyx_cur_scope->__pyx_t_1 = __pyx_t_4;
        __pyx_cur_scope->__pyx_t_2 = __pyx_t_5;
        __Pyx_XGIVEREF(__pyx_r);
        __Pyx_RefNannyFinishContext();
        __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
        /* return from generator, yielding value */
        __pyx_generator->resume_label = 1;
        return __pyx_r;
        __pyx_L7_resume_from_yield_from:;
        __pyx_t_2 = __pyx_cur_scope->__pyx_t_0;
        __pyx_cur_scope->__pyx_t_0 = 0;
        __Pyx_XGOTREF(__pyx_t_2);
        __pyx_t_4 = __pyx_cur_scope->__pyx_t_1;
        __pyx_t_5 = __pyx_cur_scope->__pyx_t_2;
        if (unlikely(!__pyx_sent_value)) __PYX_ERR(6, 977, __pyx_L1_error)
      } else if (likely(__pyx_t_7 == PYGEN_RETURN)) {
        __Pyx_GOTREF(__pyx_r);
        __Pyx_DECREF(__pyx_r); __pyx_r = 0;
      } else {
        __Pyx_XGOTREF(__pyx_r);
        __PYX_ERR(6, 977, __pyx_L1_error)
      }

      /* "src/lxml/serializer.pxi":976
 *     def _iter_namespaces(self, ns_stack):
 *         for namespaces in reversed(ns_stack):
 *             if namespaces:  # almost no element declares new namespaces             # <<<<<<<<<<<<<<
 *                 yield from namespaces
 * 
*/
    }

    /* "src/lxml/serializer.pxi":975
 * 
 *     def _iter_namespaces(self, ns_stack):
 *         for namespaces in reversed(ns_stack):             # <<<<<<<<<<<<<<
 *             if namespaces:  # almost no element declares new namespaces
 *                 yield from namespaces
*/
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "src/lxml/serializer.pxi":974
 *         self._root_done = False
 * 
 *     def _iter_namespaces(self, ns_stack):             # <<<<<<<<<<<<<<
 *         for namespaces in reversed(ns_stack):
 *             if namespaces:  # almost no element declares new namespaces
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("_iter_namespaces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":979
 *                 yield from namespaces
 * 
 *     cdef _resolve_prefix_name(self, prefixed_name):             # <<<<<<<<<<<<<<
 *         prefix, name = prefixed_name.split(':', 1)
 *         for uri, p in self._iter_namespaces(self._ns_stack):
*/

static PyObject *__pyx_f_4lxml_5etree_16C14NWriterTarget__resolve_prefix_name(struct __pyx_obj_4lxml_5etree_C14NWriterTarget *__pyx_v_self, PyObject *__pyx_v_prefixed_name) {
  PyObject *__pyx_v_prefix = NULL;
  PyObject *__pyx_v_name = NULL;
  PyObject *__pyx_v_uri = NULL;
  PyObject *__pyx_v_p = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  size_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  PyObject *(*__pyx_t_8)(PyObject *);
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11[4];
  PyObject *__pyx_t_12[5];
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_resolve_prefix_name", 0);

  /* "src/lxml/serializer.pxi":980
 * 
 *     cdef _resolve_prefix_name(self, prefixed_name):
 *         prefix, name = prefixed_name.split(':', 1)             # <<<<<<<<<<<<<<
 *         for uri, p in self._iter_namespaces(self._ns_stack):
 *             if p == prefix:
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_prefixed_name, __pyx_mstate_global->__pyx_n_u_split); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 980, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_mstate_global->__pyx_tuple[10], NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 980, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(6, 980, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
      __Pyx_INCREF(__pyx_t_3);
    } else {
      __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
      if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 980, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_1);
      __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
      if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 980, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_3);
    }
    #else
    __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 980, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 980, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 980, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_5 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4);
    index = 0; __pyx_t_1 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < (0)) __PYX_ERR(6, 980, __pyx_L1_error)
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(6, 980, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_prefix = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_name = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "src/lxml/serializer.pxi":981
 *     cdef _resolve_prefix_name(self, prefixed_name):
 *         prefix, name = prefixed_name.split(':', 1)
 *         for uri, p in self._iter_namespaces(self._ns_stack):             # <<<<<<<<<<<<<<
 *             if p == prefix:
 *                 return f'{{{uri}}}{name}'
*/
  __pyx_t_3 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_self->_ns_stack};
    __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_iter_namespaces, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 981, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
    __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3);
    __pyx_t_7 = 0;
    __pyx_t_8 = NULL;
  } else {
    __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 981, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 981, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  for (;;) {
    if (likely(!__pyx_t_8)) {
      if (likely(PyList_CheckExact(__pyx_t_3))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(6, 981, __pyx_L1_error)
          #endif
          if (__pyx_t_7 >= __pyx_temp) break;
        }
        __pyx_t_2 = __Pyx_PyList_GetItemRefFast(__pyx_t_3, __pyx_t_7, __Pyx_ReferenceSharing_OwnStrongReference);
        ++__pyx_t_7;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(6, 981, __pyx_L1_error)
          #endif
          if (__pyx_t_7 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7));
        #else
        __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_7);
        #endif
        ++__pyx_t_7;
      }
      if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 981, __pyx_L1_error)
    } else {
      __pyx_t_2 = __pyx_t_8(__pyx_t_3);
      if (unlikely(!__pyx_t_2)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(6, 981, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_2);
    if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
      PyObject* sequence = __pyx_t_2;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(6, 981, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
        __Pyx_INCREF(__pyx_t_4);
      } else {
        __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 981, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_1);
        __pyx_t_4 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 981, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_4);
      }
      #else
      __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 981, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 981, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      #endif
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_9 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 981, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_5 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_9);
      index = 0; __pyx_t_1 = __pyx_t_5(__pyx_t_9); if (unlikely(!__pyx_t_1)) goto __pyx_L7_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_1);
      index = 1; __pyx_t_4 = __pyx_t_5(__pyx_t_9); if (unlikely(!__pyx_t_4)) goto __pyx_L7_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_9), 2) < (0)) __PYX_ERR(6, 981, __pyx_L1_error)
      __pyx_t_5 = NULL;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L8_unpacking_done;
      __pyx_L7_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_5 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(6, 981, __pyx_L1_error)
      __pyx_L8_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_uri, __pyx_t_1);
    __pyx_t_1 = 0;
    __Pyx_XDECREF_SET(__pyx_v_p, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "src/lxml/serializer.pxi":982
 *         prefix, name = prefixed_name.split(':', 1)
 *         for uri, p in self._iter_namespaces(self._ns_stack):
 *             if p == prefix:             # <<<<<<<<<<<<<<
 *                 return f'{{{uri}}}{name}'
 *         raise ValueError(f'Prefix {prefix} of QName "{prefixed_name}" is not declared in scope')
*/
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_p, __pyx_v_prefix, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 982, __pyx_L1_error)
    __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(6, 982, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_10) {

      /* "src/lxml/serializer.pxi":983
 *         for uri, p in self._iter_namespaces(self._ns_stack):
 *             if p == prefix:
 *                 return f'{{{uri}}}{name}'             # <<<<<<<<<<<<<<
 *         raise ValueError(f'Prefix {prefix} of QName "{prefixed_name}" is not declared in scope')
 * 
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_v_uri, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 983, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_name, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 983, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_11[0] = __pyx_mstate_global->__pyx_kp_u__10;
      __pyx_t_11[1] = __pyx_t_2;
      __pyx_t_11[2] = __pyx_mstate_global->__pyx_kp_u__11;
      __pyx_t_11[3] = __pyx_t_4;
      __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_11, 4, 1 * 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4));
      if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 983, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L0;

      /* "src/lxml/serializer.pxi":982
 *         prefix, name = prefixed_name.split(':', 1)
 *         for uri, p in self._iter_namespaces(self._ns_stack):
 *             if p == prefix:             # <<<<<<<<<<<<<<
 *                 return f'{{{uri}}}{name}'
 *         raise ValueError(f'Prefix {prefix} of QName "{prefixed_name}" is not declared in scope')
*/
    }

    /* "src/lxml/serializer.pxi":981
 *     cdef _resolve_prefix_name(self, prefixed_name):
 *         prefix, name = prefixed_name.split(':', 1)
 *         for uri, p in self._iter_namespaces(self._ns_stack):             # <<<<<<<<<<<<<<
 *             if p == prefix:
 *                 return f'{{{uri}}}{name}'
*/
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/serializer.pxi":984
 *             if p == prefix:
 *                 return f'{{{uri}}}{name}'
 *         raise ValueError(f'Prefix {prefix} of QName "{prefixed_name}" is not declared in scope')             # <<<<<<<<<<<<<<
 * 
 *     cdef _qname(self, qname, uri=None):
*/
  __pyx_t_1 = NULL;
  __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_prefix, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 984, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_v_prefixed_name, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 984, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_12[0] = __pyx_mstate_global->__pyx_kp_u_Prefix;
  __pyx_t_12[1] = __pyx_t_4;
  __pyx_t_12[2] = __pyx_mstate_global->__pyx_kp_u_of_QName;
  __pyx_t_12[3] = __pyx_t_2;
  __pyx_t_12[4] = __pyx_mstate_global->__pyx_kp_u_is_not_declared_in_scope;
  __pyx_t_9 = __Pyx_PyUnicode_Join(__pyx_t_12, 5, 7 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4) + 11 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 26, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2));
  if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 984, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_9};
    __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 984, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __PYX_ERR(6, 984, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":979
 *                 yield from namespaces
 * 
 *     cdef _resolve_prefix_name(self, prefixed_name):             # <<<<<<<<<<<<<<
 *         prefix, name = prefixed_name.split(':', 1)
 *         for uri, p in self._iter_namespaces(self._ns_stack):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("lxml.etree.C14NWriterTarget._resolve_prefix_name", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_prefix);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_uri);
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":986
 *         raise ValueError(f'Prefix {prefix} of QName "{prefixed_name}" is not declared in scope')
 * 
 *     cdef _qname(self, qname, uri=None):             # <<<<<<<<<<<<<<
 *         if uri is None:
 *             uri, tag = qname[1:].rsplit('}', 1) if qname[:1] == '{' else ('', qname)
*/

static PyObject *__pyx_f_4lxml_5etree_16C14NWriterTarget__qname(struct __pyx_obj_4lxml_5etree_C14NWriterTarget *__pyx_v_self, PyObject *__pyx_v_qname, struct __pyx_opt_args_4lxml_5etree_16C14NWriterTarget__qname *__pyx_optional_args) {
  PyObject *__pyx_v_uri = ((PyObject *)Py_None);
  PyObject *__pyx_v_tag = NULL;
  PyObject *__pyx_v_prefixes_seen = NULL;
  PyObject *__pyx_v_u = NULL;
  PyObject *__pyx_v_prefix = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *(*__pyx_t_6)(PyObject *);
  size_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  PyObject *(*__pyx_t_9)(PyObject *);
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  PyObject *__pyx_t_12[3];
  int __pyx_t_13;
  int __pyx_t_14;
  PyObject *__pyx_t_15[5];
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_qname", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_uri = __pyx_optional_args->uri;
    }
  }
  __Pyx_INCREF(__pyx_v_uri);

  /* "src/lxml/serializer.pxi":987
 * 
 *     cdef _qname(self, qname, uri=None):
 *         if uri is None:             # <<<<<<<<<<<<<<
 *             uri, tag = qname[1:].rsplit('}', 1) if qname[:1] == '{' else ('', qname)
 *         else:
*/
  __pyx_t_1 = (__pyx_v_uri == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":988
 *     cdef _qname(self, qname, uri=None):
 *         if uri is None:
 *             uri, tag = qname[1:].rsplit('}', 1) if qname[:1] == '{' else ('', qname)             # <<<<<<<<<<<<<<
 *         else:
 *             tag = qname
*/
    __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_qname, 0, 1, NULL, NULL, &__pyx_mstate_global->__pyx_slice[5], 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 988, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_t_3, __pyx_mstate_global->__pyx_kp_u__10, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(6, 988, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_1) {
      __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_qname, 1, 0, NULL, NULL, &__pyx_mstate_global->__pyx_slice[7], 1, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 988, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_rsplit); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 988, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_mstate_global->__pyx_tuple[11], NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 988, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_2 = __pyx_t_3;
      __pyx_t_3 = 0;
    } else {
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 988, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u__8);
      __Pyx_GIVEREF(__pyx_mstate_global->__pyx_kp_u__8);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_mstate_global->__pyx_kp_u__8) != (0)) __PYX_ERR(6, 988, __pyx_L1_error);
      __Pyx_INCREF(__pyx_v_qname);
      __Pyx_GIVEREF(__pyx_v_qname);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_qname) != (0)) __PYX_ERR(6, 988, __pyx_L1_error);
      __pyx_t_2 = __pyx_t_3;
      __pyx_t_3 = 0;
    }
    if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
      PyObject* sequence = __pyx_t_2;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(6, 988, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
        __Pyx_INCREF(__pyx_t_3);
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
        __Pyx_INCREF(__pyx_t_4);
      } else {
        __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 988, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_3);
        __pyx_t_4 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 988, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_4);
      }
      #else
      __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 988, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 988, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      #endif
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 988, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_6 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_5);
      index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L4_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L4_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < (0)) __PYX_ERR(6, 988, __pyx_L1_error)
      __pyx_t_6 = NULL;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L5_unpacking_done;
      __pyx_L4_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(6, 988, __pyx_L1_error)
      __pyx_L5_unpacking_done:;
    }
    __Pyx_DECREF_SET(__pyx_v_uri, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_v_tag = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "src/lxml/serializer.pxi":987
 * 
 *     cdef _qname(self, qname, uri=None):
 *         if uri is None:             # <<<<<<<<<<<<<<
 *             uri, tag = qname[1:].rsplit('}', 1) if qname[:1] == '{' else ('', qname)
 *         else:
*/
    goto __pyx_L3;
  }

  /* "src/lxml/serializer.pxi":990
 *             uri, tag = qname[1:].rsplit('}', 1) if qname[:1] == '{' else ('', qname)
 *         else:
 *             tag = qname             # <<<<<<<<<<<<<<
 * 
 *         prefixes_seen = set()
*/
  /*else*/ {
    __Pyx_INCREF(__pyx_v_qname);
    __pyx_v_tag = __pyx_v_qname;
  }
  __pyx_L3:;

  /* "src/lxml/serializer.pxi":992
 *             tag = qname
 * 
 *         prefixes_seen = set()             # <<<<<<<<<<<<<<
 *         for u, prefix in self._iter_namespaces(self._declared_ns_stack):
 *             if u == uri and prefix not in prefixes_seen:
*/
  __pyx_t_2 = PySet_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 992, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_prefixes_seen = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/serializer.pxi":993
 * 
 *         prefixes_seen = set()
 *         for u, prefix in self._iter_namespaces(self._declared_ns_stack):             # <<<<<<<<<<<<<<
 *             if u == uri and prefix not in prefixes_seen:
 *                 return f'{prefix}:{tag}' if prefix else tag, tag, uri
*/
  __pyx_t_4 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_7 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_self->_declared_ns_stack};
    __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_iter_namespaces, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 993, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
    __pyx_t_4 = __pyx_t_2; __Pyx_INCREF(__pyx_t_4);
    __pyx_t_8 = 0;
    __pyx_t_9 = NULL;
  } else {
    __pyx_t_8 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 993, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_9 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 993, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  for (;;) {
    if (likely(!__pyx_t_9)) {
      if (likely(PyList_CheckExact(__pyx_t_4))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_4);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(6, 993, __pyx_L1_error)
          #endif
          if (__pyx_t_8 >= __pyx_temp) break;
        }
        __pyx_t_2 = __Pyx_PyList_GetItemRefFast(__pyx_t_4, __pyx_t_8, __Pyx_ReferenceSharing_OwnStrongReference);
        ++__pyx_t_8;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(6, 993, __pyx_L1_error)
          #endif
          if (__pyx_t_8 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_8));
        #else
        __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_8);
        #endif
        ++__pyx_t_8;
      }
      if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 993, __pyx_L1_error)
    } else {
      __pyx_t_2 = __pyx_t_9(__pyx_t_4);
      if (unlikely(!__pyx_t_2)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(6, 993, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_2);
    if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
      PyObject* sequence = __pyx_t_2;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(6, 993, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
        __Pyx_INCREF(__pyx_t_3);
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1);
        __Pyx_INCREF(__pyx_t_5);
      } else {
        __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 993, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_3);
        __pyx_t_5 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 993, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_5);
      }
      #else
      __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 993, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 993, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      #endif
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_10 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(6, 993, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_6 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_10);
      index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_10); if (unlikely(!__pyx_t_3)) goto __pyx_L8_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 1; __pyx_t_5 = __pyx_t_6(__pyx_t_10); if (unlikely(!__pyx_t_5)) goto __pyx_L8_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_10), 2) < (0)) __PYX_ERR(6, 993, __pyx_L1_error)
      __pyx_t_6 = NULL;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      goto __pyx_L9_unpacking_done;
      __pyx_L8_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_6 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(6, 993, __pyx_L1_error)
      __pyx_L9_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_u, __pyx_t_3);
    __pyx_t_3 = 0;
    __Pyx_XDECREF_SET(__pyx_v_prefix, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "src/lxml/serializer.pxi":994
 *         prefixes_seen = set()
 *         for u, prefix in self._iter_namespaces(self._declared_ns_stack):
 *             if u == uri and prefix not in prefixes_seen:             # <<<<<<<<<<<<<<
 *                 return f'{prefix}:{tag}' if prefix else tag, tag, uri
 *             prefixes_seen.add(prefix)
*/
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_u, __pyx_v_uri, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 994, __pyx_L1_error)
    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(6, 994, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_11) {
    } else {
      __pyx_t_1 = __pyx_t_11;
      goto __pyx_L11_bool_binop_done;
    }
    __pyx_t_11 = (__Pyx_PySet_ContainsTF(__pyx_v_prefix, __pyx_v_prefixes_seen, Py_NE)); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(6, 994, __pyx_L1_error)
    __pyx_t_1 = __pyx_t_11;
    __pyx_L11_bool_binop_done:;
    if (__pyx_t_1) {

      /* "src/lxml/serializer.pxi":995
 *         for u, prefix in self._iter_namespaces(self._declared_ns_stack):
 *             if u == uri and prefix not in prefixes_seen:
 *                 return f'{prefix}:{tag}' if prefix else tag, tag, uri             # <<<<<<<<<<<<<<
 *             prefixes_seen.add(prefix)
 * 
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_prefix); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(6, 995, __pyx_L1_error)
      if (__pyx_t_1) {
        __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_v_prefix, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 995, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_v_tag, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 995, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_12[0] = __pyx_t_5;
        __pyx_t_12[1] = __pyx_mstate_global->__pyx_kp_u__9;
        __pyx_t_12[2] = __pyx_t_3;
        __pyx_t_10 = __Pyx_PyUnicode_Join(__pyx_t_12, 3, __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 1 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3));
        if (unlikely(!__pyx_t_10)) __PYX_ERR(6, 995, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_2 = __pyx_t_10;
        __pyx_t_10 = 0;
      } else {
        __Pyx_INCREF(__pyx_v_tag);
        __pyx_t_2 = __pyx_v_tag;
      }
      __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) __PYX_ERR(6, 995, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_2);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_2) != (0)) __PYX_ERR(6, 995, __pyx_L1_error);
      __Pyx_INCREF(__pyx_v_tag);
      __Pyx_GIVEREF(__pyx_v_tag);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_tag) != (0)) __PYX_ERR(6, 995, __pyx_L1_error);
      __Pyx_INCREF(__pyx_v_uri);
      __Pyx_GIVEREF(__pyx_v_uri);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_v_uri) != (0)) __PYX_ERR(6, 995, __pyx_L1_error);
      __pyx_t_2 = 0;
      __pyx_r = __pyx_t_10;
      __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L0;

      /* "src/lxml/serializer.pxi":994
 *         prefixes_seen = set()
 *         for u, prefix in self._iter_namespaces(self._declared_ns_stack):
 *             if u == uri and prefix not in prefixes_seen:             # <<<<<<<<<<<<<<
 *                 return f'{prefix}:{tag}' if prefix else tag, tag, uri
 *             prefixes_seen.add(prefix)
*/
    }

    /* "src/lxml/serializer.pxi":996
 *             if u == uri and prefix not in prefixes_seen:
 *                 return f'{prefix}:{tag}' if prefix else tag, tag, uri
 *             prefixes_seen.add(prefix)             # <<<<<<<<<<<<<<
 * 
 *         # Not declared yet => add new declaration.
*/
    __pyx_t_13 = PySet_Add(__pyx_v_prefixes_seen, __pyx_v_prefix); if (unlikely(__pyx_t_13 == ((int)-1))) __PYX_ERR(6, 996, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":993
 * 
 *         prefixes_seen = set()
 *         for u, prefix in self._iter_namespaces(self._declared_ns_stack):             # <<<<<<<<<<<<<<
 *             if u == uri and prefix not in prefixes_seen:
 *                 return f'{prefix}:{tag}' if prefix else tag, tag, uri
*/
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "src/lxml/serializer.pxi":999
 * 
 *         # Not declared yet => add new declaration.
 *         if self._rewrite_prefixes:             # <<<<<<<<<<<<<<
 *             if uri in self._prefix_map:
 *                 prefix = self._prefix_map[uri]
*/
  if (__pyx_v_self->_rewrite_prefixes) {

    /* "src/lxml/serializer.pxi":1000
 *         # Not declared yet => add new declaration.
 *         if self._rewrite_prefixes:
 *             if uri in self._prefix_map:             # <<<<<<<<<<<<<<
 *                 prefix = self._prefix_map[uri]
 *             else:
*/
    if (unlikely(__pyx_v_self->_prefix_map == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
      __PYX_ERR(6, 1000, __pyx_L1_error)
    }
    __pyx_t_1 = (__Pyx_PyDict_ContainsTF(__pyx_v_uri, __pyx_v_self->_prefix_map, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(6, 1000, __pyx_L1_error)
    if (__pyx_t_1) {

      /* "src/lxml/serializer.pxi":1001
 *         if self._rewrite_prefixes:
 *             if uri in self._prefix_map:
 *                 prefix = self._prefix_map[uri]             # <<<<<<<<<<<<<<
 *             else:
 *                 prefix = self._prefix_map[uri] = f'n{len(self._prefix_map)}'
*/
      if (unlikely(__pyx_v_self->_prefix_map == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(6, 1001, __pyx_L1_error)
      }
      __pyx_t_4 = __Pyx_PyDict_GetItem(__pyx_v_self->_prefix_map, __pyx_v_uri); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 1001, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_XDECREF_SET(__pyx_v_prefix, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "src/lxml/serializer.pxi":1000
 *         # Not declared yet => add new declaration.
 *         if self._rewrite_prefixes:
 *             if uri in self._prefix_map:             # <<<<<<<<<<<<<<
 *                 prefix = self._prefix_map[uri]
 *             else:
*/
      goto __pyx_L15;
    }

    /* "src/lxml/serializer.pxi":1003
 *                 prefix = self._prefix_map[uri]
 *             else:
 *                 prefix = self._prefix_map[uri] = f'n{len(self._prefix_map)}'             # <<<<<<<<<<<<<<
 *             self._declared_ns_stack[-1].append((uri, prefix))
 *             return f'{prefix}:{tag}', tag, uri
*/
    /*else*/ {
      __pyx_t_4 = __pyx_v_self->_prefix_map;
      __Pyx_INCREF(__pyx_t_4);
      if (unlikely(__pyx_t_4 == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
        __PYX_ERR(6, 1003, __pyx_L1_error)
      }
      __pyx_t_8 = PyDict_Size(__pyx_t_4); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(6, 1003, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_t_8, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 1003, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_10 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_n_u_n, __pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(6, 1003, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_INCREF(__pyx_t_10);
      __Pyx_XDECREF_SET(__pyx_v_prefix, __pyx_t_10);
      if (unlikely(__pyx_v_self->_prefix_map == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(6, 1003, __pyx_L1_error)
      }
      if (unlikely((PyDict_SetItem(__pyx_v_self->_prefix_map, __pyx_v_uri, __pyx_t_10) < 0))) __PYX_ERR(6, 1003, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    }
    __pyx_L15:;

    /* "src/lxml/serializer.pxi":1004
 *             else:
 *                 prefix = self._prefix_map[uri] = f'n{len(self._prefix_map)}'
 *             self._declared_ns_stack[-1].append((uri, prefix))             # <<<<<<<<<<<<<<
 *             return f'{prefix}:{tag}', tag, uri
 * 
*/
    if (unlikely(__pyx_v_self->_declared_ns_stack == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(6, 1004, __pyx_L1_error)
    }
    __pyx_t_10 = __Pyx_GetItemInt_List(__pyx_v_self->_declared_ns_stack, -1L, long, 1, __Pyx_PyLong_From_long, 1, 1, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_10)) __PYX_ERR(6, 1004, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 1004, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_uri);
    __Pyx_GIVEREF(__pyx_v_uri);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_uri) != (0)) __PYX_ERR(6, 1004, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_prefix);
    __Pyx_GIVEREF(__pyx_v_prefix);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_prefix) != (0)) __PYX_ERR(6, 1004, __pyx_L1_error);
    __pyx_t_13 = __Pyx_PyObject_Append(__pyx_t_10, __pyx_t_4); if (unlikely(__pyx_t_13 == ((int)-1))) __PYX_ERR(6, 1004, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "src/lxml/serializer.pxi":1005
 *                 prefix = self._prefix_map[uri] = f'n{len(self._prefix_map)}'
 *             self._declared_ns_stack[-1].append((uri, prefix))
 *             return f'{prefix}:{tag}', tag, uri             # <<<<<<<<<<<<<<
 * 
 *         if not uri and '' not in prefixes_seen:
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_prefix, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 1005, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_10 = __Pyx_PyObject_FormatSimple(__pyx_v_tag, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_10)) __PYX_ERR(6, 1005, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_12[0] = __pyx_t_4;
    __pyx_t_12[1] = __pyx_mstate_global->__pyx_kp_u__9;
    __pyx_t_12[2] = __pyx_t_10;
    __pyx_t_2 = __Pyx_PyUnicode_Join(__pyx_t_12, 3, __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4) + 1 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_10), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_10));
    if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1005, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) __PYX_ERR(6, 1005, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_GIVEREF(__pyx_t_2);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_2) != (0)) __PYX_ERR(6, 1005, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_tag);
    __Pyx_GIVEREF(__pyx_v_tag);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_tag) != (0)) __PYX_ERR(6, 1005, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_uri);
    __Pyx_GIVEREF(__pyx_v_uri);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_v_uri) != (0)) __PYX_ERR(6, 1005, __pyx_L1_error);
    __pyx_t_2 = 0;
    __pyx_r = __pyx_t_10;
    __pyx_t_10 = 0;
    goto __pyx_L0;

    /* "src/lxml/serializer.pxi":999
 * 
 *         # Not declared yet => add new declaration.
 *         if self._rewrite_prefixes:             # <<<<<<<<<<<<<<
 *             if uri in self._prefix_map:
 *                 prefix = self._prefix_map[uri]
*/
  }

  /* "src/lxml/serializer.pxi":1007
 *             return f'{prefix}:{tag}', tag, uri
 * 
 *         if not uri and '' not in prefixes_seen:             # <<<<<<<<<<<<<<
 *             # No default namespace declared => no prefix needed.
 *             return tag, tag, uri
*/
  __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_v_uri); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(6, 1007, __pyx_L1_error)
  __pyx_t_14 = (!__pyx_t_11);
  if (__pyx_t_14) {
  } else {
    __pyx_t_1 = __pyx_t_14;
    goto __pyx_L17_bool_binop_done;
  }
  __pyx_t_14 = (__Pyx_PySet_ContainsTF(__pyx_mstate_global->__pyx_kp_u__8, __pyx_v_prefixes_seen, Py_NE)); if (unlikely((__pyx_t_14 < 0))) __PYX_ERR(6, 1007, __pyx_L1_error)
  __pyx_t_1 = __pyx_t_14;
  __pyx_L17_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1009
 *         if not uri and '' not in prefixes_seen:
 *             # No default namespace declared => no prefix needed.
 *             return tag, tag, uri             # <<<<<<<<<<<<<<
 * 
 *         for u, prefix in self._iter_namespaces(self._ns_stack):
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) __PYX_ERR(6, 1009, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_INCREF(__pyx_v_tag);
    __Pyx_GIVEREF(__pyx_v_tag);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_tag) != (0)) __PYX_ERR(6, 1009, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_tag);
    __Pyx_GIVEREF(__pyx_v_tag);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_tag) != (0)) __PYX_ERR(6, 1009, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_uri);
    __Pyx_GIVEREF(__pyx_v_uri);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_v_uri) != (0)) __PYX_ERR(6, 1009, __pyx_L1_error);
    __pyx_r = __pyx_t_10;
    __pyx_t_10 = 0;
    goto __pyx_L0;

    /* "src/lxml/serializer.pxi":1007
 *             return f'{prefix}:{tag}', tag, uri
 * 
 *         if not uri and '' not in prefixes_seen:             # <<<<<<<<<<<<<<
 *             # No default namespace declared => no prefix needed.
 *             return tag, tag, uri
*/
  }

  /* "src/lxml/serializer.pxi":1011
 *             return tag, tag, uri
 * 
 *         for u, prefix in self._iter_namespaces(self._ns_stack):             # <<<<<<<<<<<<<<
 *             if u == uri:
 *                 self._declared_ns_stack[-1].append((uri, prefix))
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_7 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_self->_ns_stack};
    __pyx_t_10 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_iter_namespaces, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_10)) __PYX_ERR(6, 1011, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
  }
  if (likely(PyList_CheckExact(__pyx_t_10)) || PyTuple_CheckExact(__pyx_t_10)) {
    __pyx_t_2 = __pyx_t_10; __Pyx_INCREF(__pyx_t_2);
    __pyx_t_8 = 0;
    __pyx_t_9 = NULL;
  } else {
    __pyx_t_8 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1011, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_9 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 1011, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  for (;;) {
    if (likely(!__pyx_t_9)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(6, 1011, __pyx_L1_error)
          #endif
          if (__pyx_t_8 >= __pyx_temp) break;
        }
        __pyx_t_10 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_8, __Pyx_ReferenceSharing_OwnStrongReference);
        ++__pyx_t_8;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(6, 1011, __pyx_L1_error)
          #endif
          if (__pyx_t_8 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_10 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_8));
        #else
        __pyx_t_10 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_8);
        #endif
        ++__pyx_t_8;
      }
      if (unlikely(!__pyx_t_10)) __PYX_ERR(6, 1011, __pyx_L1_error)
    } else {
      __pyx_t_10 = __pyx_t_9(__pyx_t_2);
      if (unlikely(!__pyx_t_10)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(6, 1011, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_10);
    if ((likely(PyTuple_CheckExact(__pyx_t_10))) || (PyList_CheckExact(__pyx_t_10))) {
      PyObject* sequence = __pyx_t_10;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(6, 1011, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
        __Pyx_INCREF(__pyx_t_4);
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
        __Pyx_INCREF(__pyx_t_3);
      } else {
        __pyx_t_4 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 1011, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_4);
        __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1011, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_3);
      }
      #else
      __pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 1011, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1011, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      #endif
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_5 = PyObject_GetIter(__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 1011, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_6 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_5);
      index = 0; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L21_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      index = 1; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L21_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < (0)) __PYX_ERR(6, 1011, __pyx_L1_error)
      __pyx_t_6 = NULL;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L22_unpacking_done;
      __pyx_L21_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(6, 1011, __pyx_L1_error)
      __pyx_L22_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_u, __pyx_t_4);
    __pyx_t_4 = 0;
    __Pyx_XDECREF_SET(__pyx_v_prefix, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":1012
 * 
 *         for u, prefix in self._iter_namespaces(self._ns_stack):
 *             if u == uri:             # <<<<<<<<<<<<<<
 *                 self._declared_ns_stack[-1].append((uri, prefix))
 *                 return f'{prefix}:{tag}' if prefix else tag, tag, uri
*/
    __pyx_t_10 = PyObject_RichCompare(__pyx_v_u, __pyx_v_uri, Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(6, 1012, __pyx_L1_error)
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(6, 1012, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    if (__pyx_t_1) {

      /* "src/lxml/serializer.pxi":1013
 *         for u, prefix in self._iter_namespaces(self._ns_stack):
 *             if u == uri:
 *                 self._declared_ns_stack[-1].append((uri, prefix))             # <<<<<<<<<<<<<<
 *                 return f'{prefix}:{tag}' if prefix else tag, tag, uri
 * 
*/
      if (unlikely(__pyx_v_self->_declared_ns_stack == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(6, 1013, __pyx_L1_error)
      }
      __pyx_t_10 = __Pyx_GetItemInt_List(__pyx_v_self->_declared_ns_stack, -1L, long, 1, __Pyx_PyLong_From_long, 1, 1, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_10)) __PYX_ERR(6, 1013, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1013, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_v_uri);
      __Pyx_GIVEREF(__pyx_v_uri);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_uri) != (0)) __PYX_ERR(6, 1013, __pyx_L1_error);
      __Pyx_INCREF(__pyx_v_prefix);
      __Pyx_GIVEREF(__pyx_v_prefix);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_prefix) != (0)) __PYX_ERR(6, 1013, __pyx_L1_error);
      __pyx_t_13 = __Pyx_PyObject_Append(__pyx_t_10, __pyx_t_3); if (unlikely(__pyx_t_13 == ((int)-1))) __PYX_ERR(6, 1013, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "src/lxml/serializer.pxi":1014
 *             if u == uri:
 *                 self._declared_ns_stack[-1].append((uri, prefix))
 *                 return f'{prefix}:{tag}' if prefix else tag, tag, uri             # <<<<<<<<<<<<<<
 * 
 *         if not uri:
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_prefix); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(6, 1014, __pyx_L1_error)
      if (__pyx_t_1) {
        __pyx_t_10 = __Pyx_PyObject_FormatSimple(__pyx_v_prefix, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_10)) __PYX_ERR(6, 1014, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_tag, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 1014, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_12[0] = __pyx_t_10;
        __pyx_t_12[1] = __pyx_mstate_global->__pyx_kp_u__9;
        __pyx_t_12[2] = __pyx_t_4;
        __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_12, 3, __Pyx_PyUnicode_GET_LENGTH(__pyx_t_10) + 1 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_10) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4));
        if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 1014, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_3 = __pyx_t_5;
        __pyx_t_5 = 0;
      } else {
        __Pyx_INCREF(__pyx_v_tag);
        __pyx_t_3 = __pyx_v_tag;
      }
      __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 1014, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_3);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3) != (0)) __PYX_ERR(6, 1014, __pyx_L1_error);
      __Pyx_INCREF(__pyx_v_tag);
      __Pyx_GIVEREF(__pyx_v_tag);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_tag) != (0)) __PYX_ERR(6, 1014, __pyx_L1_error);
      __Pyx_INCREF(__pyx_v_uri);
      __Pyx_GIVEREF(__pyx_v_uri);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_uri) != (0)) __PYX_ERR(6, 1014, __pyx_L1_error);
      __pyx_t_3 = 0;
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L0;

      /* "src/lxml/serializer.pxi":1012
 * 
 *         for u, prefix in self._iter_namespaces(self._ns_stack):
 *             if u == uri:             # <<<<<<<<<<<<<<
 *                 self._declared_ns_stack[-1].append((uri, prefix))
 *                 return f'{prefix}:{tag}' if prefix else tag, tag, uri
*/
    }

    /* "src/lxml/serializer.pxi":1011
 *             return tag, tag, uri
 * 
 *         for u, prefix in self._iter_namespaces(self._ns_stack):             # <<<<<<<<<<<<<<
 *             if u == uri:
 *                 self._declared_ns_stack[-1].append((uri, prefix))
*/
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/serializer.pxi":1016
 *                 return f'{prefix}:{tag}' if prefix else tag, tag, uri
 * 
 *         if not uri:             # <<<<<<<<<<<<<<
 *             # As soon as a default namespace is defined,
 *             # anything that has no namespace (and thus, no prefix) goes there.
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_uri); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(6, 1016, __pyx_L1_error)
  __pyx_t_14 = (!__pyx_t_1);
  if (__pyx_t_14) {

    /* "src/lxml/serializer.pxi":1019
 *             # As soon as a default namespace is defined,
 *             # anything that has no namespace (and thus, no prefix) goes there.
 *             return tag, tag, uri             # <<<<<<<<<<<<<<
 * 
 *         raise ValueError(f'Namespace "{uri}" of name "{tag}" is not declared in scope')
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1019, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_tag);
    __Pyx_GIVEREF(__pyx_v_tag);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_tag) != (0)) __PYX_ERR(6, 1019, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_tag);
    __Pyx_GIVEREF(__pyx_v_tag);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_tag) != (0)) __PYX_ERR(6, 1019, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_uri);
    __Pyx_GIVEREF(__pyx_v_uri);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_uri) != (0)) __PYX_ERR(6, 1019, __pyx_L1_error);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "src/lxml/serializer.pxi":1016
 *                 return f'{prefix}:{tag}' if prefix else tag, tag, uri
 * 
 *         if not uri:             # <<<<<<<<<<<<<<
 *             # As soon as a default namespace is defined,
 *             # anything that has no namespace (and thus, no prefix) goes there.
*/
  }

  /* "src/lxml/serializer.pxi":1021
 *             return tag, tag, uri
 * 
 *         raise ValueError(f'Namespace "{uri}" of name "{tag}" is not declared in scope')             # <<<<<<<<<<<<<<
 * 
 *     def data(self, data):
*/
  __pyx_t_5 = NULL;
  __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_v_uri, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1021, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_tag, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 1021, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_15[0] = __pyx_mstate_global->__pyx_kp_u_Namespace;
  __pyx_t_15[1] = __pyx_t_3;
  __pyx_t_15[2] = __pyx_mstate_global->__pyx_kp_u_of_name;
  __pyx_t_15[3] = __pyx_t_4;
  __pyx_t_15[4] = __pyx_mstate_global->__pyx_kp_u_is_not_declared_in_scope;
  __pyx_t_10 = __Pyx_PyUnicode_Join(__pyx_t_15, 5, 11 * 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4) + 26, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4));
  if (unlikely(!__pyx_t_10)) __PYX_ERR(6, 1021, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_7 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_10};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1021, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __Pyx_Raise(__pyx_t_2, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __PYX_ERR(6, 1021, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":986
 *         raise ValueError(f'Prefix {prefix} of QName "{prefixed_name}" is not declared in scope')
 * 
 *     cdef _qname(self, qname, uri=None):             # <<<<<<<<<<<<<<
 *         if uri is None:
 *             uri, tag = qname[1:].rsplit('}', 1) if qname[:1] == '{' else ('', qname)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("lxml.etree.C14NWriterTarget._qname", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tag);
  __Pyx_XDECREF(__pyx_v_prefixes_seen);
  __Pyx_XDECREF(__pyx_v_u);
  __Pyx_XDECREF(__pyx_v_prefix);
  __Pyx_XDECREF(__pyx_v_uri);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1023
 *         raise ValueError(f'Namespace "{uri}" of name "{tag}" is not declared in scope')
 * 
 *     def data(self, data):             # <<<<<<<<<<<<<<
 *         if not self._ignored_depth:
 *             self._data.append(data)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_16C14NWriterTarget_6data(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_16C14NWriterTarget_6data = {"data", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_16C14NWriterTarget_6data, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_16C14NWriterTarget_6data(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_data = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("data (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_data,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(6, 1023, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 1023, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "data", 0) < (0)) __PYX_ERR(6, 1023, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("data", 1, 1, 1, i); __PYX_ERR(6, 1023, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 1023, __pyx_L3_error)
    }
    __pyx_v_data = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("data", 1, 1, 1, __pyx_nargs); __PYX_ERR(6, 1023, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.C14NWriterTarget.data", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_16C14NWriterTarget_5data(((struct __pyx_obj_4lxml_5etree_C14NWriterTarget *)__pyx_v_self), __pyx_v_data);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_16C14NWriterTarget_5data(struct __pyx_obj_4lxml_5etree_C14NWriterTarget *__pyx_v_self, PyObject *__pyx_v_data) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("data", 0);

  /* "src/lxml/serializer.pxi":1024
 * 
 *     def data(self, data):
 *         if not self._ignored_depth:             # <<<<<<<<<<<<<<
 *             self._data.append(data)
 * 
*/
  __pyx_t_1 = (!(__pyx_v_self->_ignored_depth != 0));
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1025
 *     def data(self, data):
 *         if not self._ignored_depth:
 *             self._data.append(data)             # <<<<<<<<<<<<<<
 * 
 *     cdef _flush(self):
*/
    if (unlikely(__pyx_v_self->_data == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
      __PYX_ERR(6, 1025, __pyx_L1_error)
    }
    __pyx_t_2 = __Pyx_PyList_Append(__pyx_v_self->_data, __pyx_v_data); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(6, 1025, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":1024
 * 
 *     def data(self, data):
 *         if not self._ignored_depth:             # <<<<<<<<<<<<<<
 *             self._data.append(data)
 * 
*/
  }

  /* "src/lxml/serializer.pxi":1023
 *         raise ValueError(f'Namespace "{uri}" of name "{tag}" is not declared in scope')
 * 
 *     def data(self, data):             # <<<<<<<<<<<<<<
 *         if not self._ignored_depth:
 *             self._data.append(data)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.C14NWriterTarget.data", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1027
 *             self._data.append(data)
 * 
 *     cdef _flush(self):             # <<<<<<<<<<<<<<
 *         cdef unicode data = ''.join(self._data)
 *         del self._data[:]
*/

static PyObject *__pyx_f_4lxml_5etree_16C14NWriterTarget__flush(struct __pyx_obj_4lxml_5etree_C14NWriterTarget *__pyx_v_self) {
  PyObject *__pyx_v_data = 0;
  PyObject *__pyx_v_tag = NULL;
  PyObject *__pyx_v_attrs = NULL;
  PyObject *__pyx_v_new_namespaces = NULL;
  PyObject *__pyx_v_qname_text = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  size_t __pyx_t_9;
  struct __pyx_opt_args_4lxml_5etree_16C14NWriterTarget__start __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_flush", 0);

  /* "src/lxml/serializer.pxi":1028
 * 
 *     cdef _flush(self):
 *         cdef unicode data = ''.join(self._data)             # <<<<<<<<<<<<<<
 *         del self._data[:]
 *         if self._strip_text and not self._preserve_space[-1]:
*/
  __pyx_t_1 = __pyx_v_self->_data;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = PyUnicode_Join(__pyx_mstate_global->__pyx_kp_u__8, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1028, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_data = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/serializer.pxi":1029
 *     cdef _flush(self):
 *         cdef unicode data = ''.join(self._data)
 *         del self._data[:]             # <<<<<<<<<<<<<<
 *         if self._strip_text and not self._preserve_space[-1]:
 *             data = data.strip()
*/
  if (unlikely(__pyx_v_self->_data == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(6, 1029, __pyx_L1_error)
  }
  if (__Pyx_PyObject_DelSlice(__pyx_v_self->_data, 0, 0, NULL, NULL, NULL, 0, 0, 1) < (0)) __PYX_ERR(6, 1029, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1030
 *         cdef unicode data = ''.join(self._data)
 *         del self._data[:]
 *         if self._strip_text and not self._preserve_space[-1]:             # <<<<<<<<<<<<<<
 *             data = data.strip()
 *         if self._pending_start is not None:
*/
  if (__pyx_v_self->_strip_text) {
  } else {
    __pyx_t_3 = __pyx_v_self->_strip_text;
    goto __pyx_L4_bool_binop_done;
  }
  if (unlikely(__pyx_v_self->_preserve_space == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(6, 1030, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_self->_preserve_space, -1L, long, 1, __Pyx_PyLong_From_long, 1, 1, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1030, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(6, 1030, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = (!__pyx_t_4);
  __pyx_t_3 = __pyx_t_5;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_3) {

    /* "src/lxml/serializer.pxi":1031
 *         del self._data[:]
 *         if self._strip_text and not self._preserve_space[-1]:
 *             data = data.strip()             # <<<<<<<<<<<<<<
 *         if self._pending_start is not None:
 *             (tag, attrs, new_namespaces), self._pending_start = self._pending_start, None
*/
    __pyx_t_2 = __Pyx_CallUnboundCMethod0(&__pyx_mstate_global->__pyx_umethod_PyUnicode_Type__strip, __pyx_v_data); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1031, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_data, ((PyObject*)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "src/lxml/serializer.pxi":1030
 *         cdef unicode data = ''.join(self._data)
 *         del self._data[:]
 *         if self._strip_text and not self._preserve_space[-1]:             # <<<<<<<<<<<<<<
 *             data = data.strip()
 *         if self._pending_start is not None:
*/
  }

  /* "src/lxml/serializer.pxi":1032
 *         if self._strip_text and not self._preserve_space[-1]:
 *             data = data.strip()
 *         if self._pending_start is not None:             # <<<<<<<<<<<<<<
 *             (tag, attrs, new_namespaces), self._pending_start = self._pending_start, None
 *             qname_text = data if ':' in data and _looks_like_prefix_name(data) else None
*/
  __pyx_t_3 = (__pyx_v_self->_pending_start != ((PyObject*)Py_None));
  if (__pyx_t_3) {

    /* "src/lxml/serializer.pxi":1033
 *             data = data.strip()
 *         if self._pending_start is not None:
 *             (tag, attrs, new_namespaces), self._pending_start = self._pending_start, None             # <<<<<<<<<<<<<<
 *             qname_text = data if ':' in data and _looks_like_prefix_name(data) else None
 *             self._start(tag, attrs, new_namespaces, qname_text)
*/
    __pyx_t_2 = __pyx_v_self->_pending_start;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_1 = Py_None;
    __Pyx_INCREF(__pyx_t_1);
    if (likely(__pyx_t_2 != Py_None)) {
      PyObject* sequence = __pyx_t_2;
      Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(sequence);
      if (unlikely(size != 3)) {
        if (size > 3) __Pyx_RaiseTooManyValuesError(3);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(6, 1033, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0);
      __Pyx_INCREF(__pyx_t_6);
      __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1);
      __Pyx_INCREF(__pyx_t_7);
      __pyx_t_8 = PyTuple_GET_ITEM(sequence, 2);
      __Pyx_INCREF(__pyx_t_8);
      #else
      __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 1033, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 1033, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = __Pyx_PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 1033, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      #endif
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(6, 1033, __pyx_L1_error)
    }
    __pyx_v_tag = __pyx_t_6;
    __pyx_t_6 = 0;
    __pyx_v_attrs = __pyx_t_7;
    __pyx_t_7 = 0;
    __pyx_v_new_namespaces = __pyx_t_8;
    __pyx_t_8 = 0;
    __Pyx_GIVEREF(__pyx_t_1);
    __Pyx_GOTREF(__pyx_v_self->_pending_start);
    __Pyx_DECREF(__pyx_v_self->_pending_start);
    __pyx_v_self->_pending_start = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/serializer.pxi":1034
 *         if self._pending_start is not None:
 *             (tag, attrs, new_namespaces), self._pending_start = self._pending_start, None
 *             qname_text = data if ':' in data and _looks_like_prefix_name(data) else None             # <<<<<<<<<<<<<<
 *             self._start(tag, attrs, new_namespaces, qname_text)
 *             if qname_text is not None:
*/
    if (unlikely(__pyx_v_data == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
      __PYX_ERR(6, 1034, __pyx_L1_error)
    }
    __pyx_t_5 = (__Pyx_PyUnicode_ContainsTF(__pyx_mstate_global->__pyx_kp_u__9, __pyx_v_data, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(6, 1034, __pyx_L1_error)
    if (__pyx_t_5) {
    } else {
      __pyx_t_3 = __pyx_t_5;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_8 = NULL;
    __Pyx_INCREF(__pyx_v_4lxml_5etree__looks_like_prefix_name);
    __pyx_t_7 = __pyx_v_4lxml_5etree__looks_like_prefix_name; 
    __pyx_t_9 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
      assert(__pyx_t_8);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
      __pyx_t_9 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_v_data};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1034, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(6, 1034, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_3 = __pyx_t_5;
    __pyx_L7_bool_binop_done:;
    if (__pyx_t_3) {
      __Pyx_INCREF(__pyx_v_data);
      __pyx_t_1 = __pyx_v_data;
    } else {
      __Pyx_INCREF(Py_None);
      __pyx_t_1 = Py_None;
    }
    __pyx_v_qname_text = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "src/lxml/serializer.pxi":1035
 *             (tag, attrs, new_namespaces), self._pending_start = self._pending_start, None
 *             qname_text = data if ':' in data and _looks_like_prefix_name(data) else None
 *             self._start(tag, attrs, new_namespaces, qname_text)             # <<<<<<<<<<<<<<
 *             if qname_text is not None:
 *                 return
*/
    __pyx_t_10.__pyx_n = 1;
    __pyx_t_10.qname_text = __pyx_v_qname_text;
    __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree_C14NWriterTarget *)__pyx_v_self->__pyx_vtab)->_start(__pyx_v_self, __pyx_v_tag, __pyx_v_attrs, __pyx_v_new_namespaces, &__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1035, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "src/lxml/serializer.pxi":1036
 *             qname_text = data if ':' in data and _looks_like_prefix_name(data) else None
 *             self._start(tag, attrs, new_namespaces, qname_text)
 *             if qname_text is not None:             # <<<<<<<<<<<<<<
 *                 return
 *         if data and self._root_seen:
*/
    __pyx_t_3 = (__pyx_v_qname_text != Py_None);
    if (__pyx_t_3) {

      /* "src/lxml/serializer.pxi":1037
 *             self._start(tag, attrs, new_namespaces, qname_text)
 *             if qname_text is not None:
 *                 return             # <<<<<<<<<<<<<<
 *         if data and self._root_seen:
 *             self._write(_escape_cdata_c14n(data))
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;

      /* "src/lxml/serializer.pxi":1036
 *             qname_text = data if ':' in data and _looks_like_prefix_name(data) else None
 *             self._start(tag, attrs, new_namespaces, qname_text)
 *             if qname_text is not None:             # <<<<<<<<<<<<<<
 *                 return
 *         if data and self._root_seen:
*/
    }

    /* "src/lxml/serializer.pxi":1032
 *         if self._strip_text and not self._preserve_space[-1]:
 *             data = data.strip()
 *         if self._pending_start is not None:             # <<<<<<<<<<<<<<
 *             (tag, attrs, new_namespaces), self._pending_start = self._pending_start, None
 *             qname_text = data if ':' in data and _looks_like_prefix_name(data) else None
*/
  }

  /* "src/lxml/serializer.pxi":1038
 *             if qname_text is not None:
 *                 return
 *         if data and self._root_seen:             # <<<<<<<<<<<<<<
 *             self._write(_escape_cdata_c14n(data))
 * 
*/
  if (__pyx_v_data == Py_None) __pyx_t_5 = 0;
  else
  {
    Py_ssize_t __pyx_temp = __Pyx_PyUnicode_IS_TRUE(__pyx_v_data);
    if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(6, 1038, __pyx_L1_error)
    __pyx_t_5 = (__pyx_temp != 0);
  }

  if (__pyx_t_5) {
  } else {
    __pyx_t_3 = __pyx_t_5;
    goto __pyx_L11_bool_binop_done;
  }
  __pyx_t_3 = __pyx_v_self->_root_seen;
  __pyx_L11_bool_binop_done:;
  if (__pyx_t_3) {

    /* "src/lxml/serializer.pxi":1039
 *                 return
 *         if data and self._root_seen:
 *             self._write(_escape_cdata_c14n(data))             # <<<<<<<<<<<<<<
 * 
 *     def start_ns(self, prefix, uri):
*/
    __pyx_t_2 = NULL;
    __Pyx_INCREF(__pyx_v_self->_write);
    __pyx_t_7 = __pyx_v_self->_write; 
    __pyx_t_8 = __pyx_f_4lxml_5etree__escape_cdata_c14n(__pyx_v_data); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 1039, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = 1;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_7);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
      __pyx_t_9 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_8};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1039, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "src/lxml/serializer.pxi":1038
 *             if qname_text is not None:
 *                 return
 *         if data and self._root_seen:             # <<<<<<<<<<<<<<
 *             self._write(_escape_cdata_c14n(data))
 * 
*/
  }

  /* "src/lxml/serializer.pxi":1027
 *             self._data.append(data)
 * 
 *     cdef _flush(self):             # <<<<<<<<<<<<<<
 *         cdef unicode data = ''.join(self._data)
 *         del self._data[:]
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("lxml.etree.C14NWriterTarget._flush", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_data);
  __Pyx_XDECREF(__pyx_v_tag);
  __Pyx_XDECREF(__pyx_v_attrs);
  __Pyx_XDECREF(__pyx_v_new_namespaces);
  __Pyx_XDECREF(__pyx_v_qname_text);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1041
 *             self._write(_escape_cdata_c14n(data))
 * 
 *     def start_ns(self, prefix, uri):             # <<<<<<<<<<<<<<
 *         if self._ignored_depth:
 *             return
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_16C14NWriterTarget_8start_ns(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_16C14NWriterTarget_8start_ns = {"start_ns", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_16C14NWriterTarget_8start_ns, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_16C14NWriterTarget_8start_ns(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_prefix = 0;
  PyObject *__pyx_v_uri = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("start_ns (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_prefix,&__pyx_mstate_global->__pyx_n_u_uri,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(6, 1041, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(6, 1041, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 1041, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "start_ns", 0) < (0)) __PYX_ERR(6, 1041, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("start_ns", 1, 2, 2, i); __PYX_ERR(6, 1041, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 1041, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(6, 1041, __pyx_L3_error)
    }
    __pyx_v_prefix = values[0];
    __pyx_v_uri = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("start_ns", 1, 2, 2, __pyx_nargs); __PYX_ERR(6, 1041, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.C14NWriterTarget.start_ns", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_16C14NWriterTarget_7start_ns(((struct __pyx_obj_4lxml_5etree_C14NWriterTarget *)__pyx_v_self), __pyx_v_prefix, __pyx_v_uri);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_16C14NWriterTarget_7start_ns(struct __pyx_obj_4lxml_5etree_C14NWriterTarget *__pyx_v_self, PyObject *__pyx_v_prefix, PyObject *__pyx_v_uri) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("start_ns", 0);

  /* "src/lxml/serializer.pxi":1042
 * 
 *     def start_ns(self, prefix, uri):
 *         if self._ignored_depth:             # <<<<<<<<<<<<<<
 *             return
 *         # we may have to resolve qnames in text content
*/
  __pyx_t_1 = (__pyx_v_self->_ignored_depth != 0);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1043
 *     def start_ns(self, prefix, uri):
 *         if self._ignored_depth:
 *             return             # <<<<<<<<<<<<<<
 *         # we may have to resolve qnames in text content
 *         if self._data:
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/serializer.pxi":1042
 * 
 *     def start_ns(self, prefix, uri):
 *         if self._ignored_depth:             # <<<<<<<<<<<<<<
 *             return
 *         # we may have to resolve qnames in text content
*/
  }

  /* "src/lxml/serializer.pxi":1045
 *             return
 *         # we may have to resolve qnames in text content
 *         if self._data:             # <<<<<<<<<<<<<<
 *             self._flush()
 *         self._ns_stack[-1].append((uri, prefix))
*/
  if (__pyx_v_self->_data == Py_None) __pyx_t_1 = 0;
  else
  {
    Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_v_self->_data);
    if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(6, 1045, __pyx_L1_error)
    __pyx_t_1 = (__pyx_temp != 0);
  }

  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1046
 *         # we may have to resolve qnames in text content
 *         if self._data:
 *             self._flush()             # <<<<<<<<<<<<<<
 *         self._ns_stack[-1].append((uri, prefix))
 * 
*/
    __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree_C14NWriterTarget *)__pyx_v_self->__pyx_vtab)->_flush(__pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1046, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/serializer.pxi":1045
 *             return
 *         # we may have to resolve qnames in text content
 *         if self._data:             # <<<<<<<<<<<<<<
 *             self._flush()
 *         self._ns_stack[-1].append((uri, prefix))
*/
  }

  /* "src/lxml/serializer.pxi":1047
 *         if self._data:
 *             self._flush()
 *         self._ns_stack[-1].append((uri, prefix))             # <<<<<<<<<<<<<<
 * 
 *     def start(self, tag, attrs):
*/
  if (unlikely(__pyx_v_self->_ns_stack == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(6, 1047, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_self->_ns_stack, -1L, long, 1, __Pyx_PyLong_From_long, 1, 1, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1047, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1047, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_uri);
  __Pyx_GIVEREF(__pyx_v_uri);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_uri) != (0)) __PYX_ERR(6, 1047, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_prefix);
  __Pyx_GIVEREF(__pyx_v_prefix);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_prefix) != (0)) __PYX_ERR(6, 1047, __pyx_L1_error);
  __pyx_t_4 = __Pyx_PyObject_Append(__pyx_t_2, __pyx_t_3); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(6, 1047, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/serializer.pxi":1041
 *             self._write(_escape_cdata_c14n(data))
 * 
 *     def start_ns(self, prefix, uri):             # <<<<<<<<<<<<<<
 *         if self._ignored_depth:
 *             return
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.C14NWriterTarget.start_ns", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1049
 *         self._ns_stack[-1].append((uri, prefix))
 * 
 *     def start(self, tag, attrs):             # <<<<<<<<<<<<<<
 *         if self._exclude_tags is not None and (
 *                 self._ignored_depth or tag in self._exclude_tags):
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_16C14NWriterTarget_10start(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_16C14NWriterTarget_10start = {"start", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_16C14NWriterTarget_10start, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_16C14NWriterTarget_10start(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_v_attrs = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("start (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_tag,&__pyx_mstate_global->__pyx_n_u_attrs,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(6, 1049, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(6, 1049, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 1049, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "start", 0) < (0)) __PYX_ERR(6, 1049, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("start", 1, 2, 2, i); __PYX_ERR(6, 1049, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 1049, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(6, 1049, __pyx_L3_error)
    }
    __pyx_v_tag = values[0];
    __pyx_v_attrs = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("start", 1, 2, 2, __pyx_nargs); __PYX_ERR(6, 1049, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.C14NWriterTarget.start", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_16C14NWriterTarget_9start(((struct __pyx_obj_4lxml_5etree_C14NWriterTarget *)__pyx_v_self), __pyx_v_tag, __pyx_v_attrs);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_16C14NWriterTarget_9start(struct __pyx_obj_4lxml_5etree_C14NWriterTarget *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_attrs) {
  PyObject *__pyx_v_new_namespaces = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("start", 0);

  /* "src/lxml/serializer.pxi":1050
 * 
 *     def start(self, tag, attrs):
 *         if self._exclude_tags is not None and (             # <<<<<<<<<<<<<<
 *                 self._ignored_depth or tag in self._exclude_tags):
 *             self._ignored_depth += 1
*/
  __pyx_t_2 = (__pyx_v_self->_exclude_tags != ((PyObject*)Py_None));
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }

  /* "src/lxml/serializer.pxi":1051
 *     def start(self, tag, attrs):
 *         if self._exclude_tags is not None and (
 *                 self._ignored_depth or tag in self._exclude_tags):             # <<<<<<<<<<<<<<
 *             self._ignored_depth += 1
 *             return
*/
  __pyx_t_2 = (__pyx_v_self->_ignored_depth != 0);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  if (unlikely(__pyx_v_self->_exclude_tags == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(6, 1051, __pyx_L1_error)
  }
  __pyx_t_2 = (__Pyx_PySet_ContainsTF(__pyx_v_tag, __pyx_v_self->_exclude_tags, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(6, 1051, __pyx_L1_error)
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;

  /* "src/lxml/serializer.pxi":1050
 * 
 *     def start(self, tag, attrs):
 *         if self._exclude_tags is not None and (             # <<<<<<<<<<<<<<
 *                 self._ignored_depth or tag in self._exclude_tags):
 *             self._ignored_depth += 1
*/
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1052
 *         if self._exclude_tags is not None and (
 *                 self._ignored_depth or tag in self._exclude_tags):
 *             self._ignored_depth += 1             # <<<<<<<<<<<<<<
 *             return
 *         if self._data:
*/
    __pyx_v_self->_ignored_depth = (__pyx_v_self->_ignored_depth + 1);

    /* "src/lxml/serializer.pxi":1053
 *                 self._ignored_depth or tag in self._exclude_tags):
 *             self._ignored_depth += 1
 *             return             # <<<<<<<<<<<<<<
 *         if self._data:
 *             self._flush()
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/serializer.pxi":1050
 * 
 *     def start(self, tag, attrs):
 *         if self._exclude_tags is not None and (             # <<<<<<<<<<<<<<
 *                 self._ignored_depth or tag in self._exclude_tags):
 *             self._ignored_depth += 1
*/
  }

  /* "src/lxml/serializer.pxi":1054
 *             self._ignored_depth += 1
 *             return
 *         if self._data:             # <<<<<<<<<<<<<<
 *             self._flush()
 * 
*/
  if (__pyx_v_self->_data == Py_None) __pyx_t_1 = 0;
  else
  {
    Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_v_self->_data);
    if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(6, 1054, __pyx_L1_error)
    __pyx_t_1 = (__pyx_temp != 0);
  }

  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1055
 *             return
 *         if self._data:
 *             self._flush()             # <<<<<<<<<<<<<<
 * 
 *         new_namespaces = []
*/
    __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree_C14NWriterTarget *)__pyx_v_self->__pyx_vtab)->_flush(__pyx_v_self); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1055, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":1054
 *             self._ignored_depth += 1
 *             return
 *         if self._data:             # <<<<<<<<<<<<<<
 *             self._flush()
 * 
*/
  }

  /* "src/lxml/serializer.pxi":1057
 *             self._flush()
 * 
 *         new_namespaces = []             # <<<<<<<<<<<<<<
 *         self._declared_ns_stack.append(new_namespaces)
 * 
*/
  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1057, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_new_namespaces = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/serializer.pxi":1058
 * 
 *         new_namespaces = []
 *         self._declared_ns_stack.append(new_namespaces)             # <<<<<<<<<<<<<<
 * 
 *         if self._qname_aware_tags is not None and tag in self._qname_aware_tags:
*/
  if (unlikely(__pyx_v_self->_declared_ns_stack == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
    __PYX_ERR(6, 1058, __pyx_L1_error)
  }
  __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_self->_declared_ns_stack, __pyx_v_new_namespaces); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(6, 1058, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1060
 *         self._declared_ns_stack.append(new_namespaces)
 * 
 *         if self._qname_aware_tags is not None and tag in self._qname_aware_tags:             # <<<<<<<<<<<<<<
 *             # Need to parse text first to see if it requires a prefix declaration.
 *             self._pending_start = (tag, attrs, new_namespaces)
*/
  __pyx_t_2 = (__pyx_v_self->_qname_aware_tags != ((PyObject*)Py_None));
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L9_bool_binop_done;
  }
  if (unlikely(__pyx_v_self->_qname_aware_tags == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(6, 1060, __pyx_L1_error)
  }
  __pyx_t_2 = (__Pyx_PySet_ContainsTF(__pyx_v_tag, __pyx_v_self->_qname_aware_tags, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(6, 1060, __pyx_L1_error)
  __pyx_t_1 = __pyx_t_2;
  __pyx_L9_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1062
 *         if self._qname_aware_tags is not None and tag in self._qname_aware_tags:
 *             # Need to parse text first to see if it requires a prefix declaration.
 *             self._pending_start = (tag, attrs, new_namespaces)             # <<<<<<<<<<<<<<
 *             return
 *         self._start(tag, attrs, new_namespaces)
*/
    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1062, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_tag);
    __Pyx_GIVEREF(__pyx_v_tag);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_tag) != (0)) __PYX_ERR(6, 1062, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_attrs);
    __Pyx_GIVEREF(__pyx_v_attrs);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_attrs) != (0)) __PYX_ERR(6, 1062, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_new_namespaces);
    __Pyx_GIVEREF(__pyx_v_new_namespaces);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_new_namespaces) != (0)) __PYX_ERR(6, 1062, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF(__pyx_v_self->_pending_start);
    __Pyx_DECREF(__pyx_v_self->_pending_start);
    __pyx_v_self->_pending_start = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":1063
 *             # Need to parse text first to see if it requires a prefix declaration.
 *             self._pending_start = (tag, attrs, new_namespaces)
 *             return             # <<<<<<<<<<<<<<
 *         self._start(tag, attrs, new_namespaces)
 * 
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/serializer.pxi":1060
 *         self._declared_ns_stack.append(new_namespaces)
 * 
 *         if self._qname_aware_tags is not None and tag in self._qname_aware_tags:             # <<<<<<<<<<<<<<
 *             # Need to parse text first to see if it requires a prefix declaration.
 *             self._pending_start = (tag, attrs, new_namespaces)
*/
  }

  /* "src/lxml/serializer.pxi":1064
 *             self._pending_start = (tag, attrs, new_namespaces)
 *             return
 *         self._start(tag, attrs, new_namespaces)             # <<<<<<<<<<<<<<
 * 
 *     cdef _start(self, tag, attrs, new_namespaces, qname_text=None):
*/
  __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree_C14NWriterTarget *)__pyx_v_self->__pyx_vtab)->_start(__pyx_v_self, __pyx_v_tag, __pyx_v_attrs, __pyx_v_new_namespaces, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1064, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/serializer.pxi":1049
 *         self._ns_stack[-1].append((uri, prefix))
 * 
 *     def start(self, tag, attrs):             # <<<<<<<<<<<<<<
 *         if self._exclude_tags is not None and (
 *                 self._ignored_depth or tag in self._exclude_tags):
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.C14NWriterTarget.start", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_new_namespaces);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1092
 *         # Assign prefixes in lexicographical order of used URIs.
 *         parsed_qnames = {n: self._qname(n) for n in sorted(
 *             qnames, key=lambda n: n.split('}', 1))}             # <<<<<<<<<<<<<<
 * 
 *         # Write namespace declarations in prefix order ...
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_16C14NWriterTarget_6_start_lambda(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_16C14NWriterTarget_6_start_lambda = {"lambda", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_16C14NWriterTarget_6_start_lambda, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_16C14NWriterTarget_6_start_lambda(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_n = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lambda (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_n,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(6, 1092, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 1092, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "lambda", 0) < (0)) __PYX_ERR(6, 1092, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("lambda", 1, 1, 1, i); __PYX_ERR(6, 1092, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 1092, __pyx_L3_error)
    }
    __pyx_v_n = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lambda", 1, 1, 1, __pyx_nargs); __PYX_ERR(6, 1092, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.C14NWriterTarget._start.lambda", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_lambda_funcdef_lambda(__pyx_self, __pyx_v_n);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_lambda_funcdef_lambda(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_n) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("lambda", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_n, __pyx_mstate_global->__pyx_n_u_split); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1092, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_mstate_global->__pyx_tuple[11], NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1092, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.C14NWriterTarget._start.lambda", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1066
 *         self._start(tag, attrs, new_namespaces)
 * 
 *     cdef _start(self, tag, attrs, new_namespaces, qname_text=None):             # <<<<<<<<<<<<<<
 *         if self._exclude_attrs is not None and attrs:
 *             attrs = {k: v for k, v in attrs.items() if k not in self._exclude_attrs}
*/

static PyObject *__pyx_f_4lxml_5etree_16C14NWriterTarget__start(struct __pyx_obj_4lxml_5etree_C14NWriterTarget *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_attrs, PyObject *__pyx_v_new_namespaces, struct __pyx_opt_args_4lxml_5etree_16C14NWriterTarget__start *__pyx_optional_args) {
  PyObject *__pyx_v_qname_text = ((PyObject *)Py_None);
  PyObject *__pyx_v_qnames = NULL;
  PyObject *__pyx_v_resolved_names = NULL;
  PyObject *__pyx_v_qname = NULL;
  PyObject *__pyx_v_qattrs = NULL;
  PyObject *__pyx_v_attr_name = NULL;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_v_parsed_qnames = NULL;
  PyObject *__pyx_v_attr_list = NULL;
  PyObject *__pyx_v_k = NULL;
  PyObject *__pyx_v_v = NULL;
  PyObject *__pyx_v_attr_qname = NULL;
  PyObject *__pyx_v_uri = NULL;
  PyObject *__pyx_v_space_behaviour = NULL;
  PyObject *__pyx_v_write = NULL;
  PyObject *__pyx_9genexpr12__pyx_v_k = NULL;
  PyObject *__pyx_9genexpr12__pyx_v_v = NULL;
  PyObject *__pyx_9genexpr13__pyx_v_n = NULL;
  PyObject *__pyx_9genexpr14__pyx_v_uri = NULL;
  PyObject *__pyx_9genexpr14__pyx_v_prefix = NULL;
  PyObject *__pyx_9genexpr15__pyx_v_k = NULL;
  PyObject *__pyx_9genexpr15__pyx_v_v = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_t_11;
  size_t __pyx_t_12;
  PyObject *(*__pyx_t_13)(PyObject *);
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *(*__pyx_t_16)(PyObject *);
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  PyObject *__pyx_t_19 = NULL;
  PyObject *__pyx_t_20[5];
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_start", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_qname_text = __pyx_optional_args->qname_text;
    }
  }
  __Pyx_INCREF(__pyx_v_attrs);

  /* "src/lxml/serializer.pxi":1067
 * 
 *     cdef _start(self, tag, attrs, new_namespaces, qname_text=None):
 *         if self._exclude_attrs is not None and attrs:             # <<<<<<<<<<<<<<
 *             attrs = {k: v for k, v in attrs.items() if k not in self._exclude_attrs}
 * 
*/
  __pyx_t_2 = (__pyx_v_self->_exclude_attrs != ((PyObject*)Py_None));
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_attrs); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(6, 1067, __pyx_L1_error)
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1068
 *     cdef _start(self, tag, attrs, new_namespaces, qname_text=None):
 *         if self._exclude_attrs is not None and attrs:
 *             attrs = {k: v for k, v in attrs.items() if k not in self._exclude_attrs}             # <<<<<<<<<<<<<<
 * 
 *         qnames = {tag, *attrs}
*/
    { /* enter inner scope */
      __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1068, __pyx_L8_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = 0;
      if (unlikely(__pyx_v_attrs == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
        __PYX_ERR(6, 1068, __pyx_L8_error)
      }
      __pyx_t_8 = __Pyx_dict_iterator(__pyx_v_attrs, 0, __pyx_mstate_global->__pyx_n_u_items, (&__pyx_t_6), (&__pyx_t_7)); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 1068, __pyx_L8_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_XDECREF(__pyx_t_4);
      __pyx_t_4 = __pyx_t_8;
      __pyx_t_8 = 0;
      while (1) {
        __pyx_t_10 = __Pyx_dict_iter_next(__pyx_t_4, __pyx_t_6, &__pyx_t_5, &__pyx_t_8, &__pyx_t_9, NULL, __pyx_t_7);
        if (unlikely(__pyx_t_10 == 0)) break;
        if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(6, 1068, __pyx_L8_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_XDECREF_SET(__pyx_9genexpr12__pyx_v_k, __pyx_t_8);
        __pyx_t_8 = 0;
        __Pyx_XDECREF_SET(__pyx_9genexpr12__pyx_v_v, __pyx_t_9);
        __pyx_t_9 = 0;
        if (unlikely(__pyx_v_self->_exclude_attrs == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
          __PYX_ERR(6, 1068, __pyx_L8_error)
        }
        __pyx_t_1 = (__Pyx_PySet_ContainsTF(__pyx_9genexpr12__pyx_v_k, __pyx_v_self->_exclude_attrs, Py_NE)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(6, 1068, __pyx_L8_error)
        if (__pyx_t_1) {
          if (unlikely(PyDict_SetItem(__pyx_t_3, (PyObject*)__pyx_9genexpr12__pyx_v_k, (PyObject*)__pyx_9genexpr12__pyx_v_v))) __PYX_ERR(6, 1068, __pyx_L8_error)
        }
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_9genexpr12__pyx_v_k); __pyx_9genexpr12__pyx_v_k = 0;
      __Pyx_XDECREF(__pyx_9genexpr12__pyx_v_v); __pyx_9genexpr12__pyx_v_v = 0;
      goto __pyx_L12_exit_scope;
      __pyx_L8_error:;
      __Pyx_XDECREF(__pyx_9genexpr12__pyx_v_k); __pyx_9genexpr12__pyx_v_k = 0;
      __Pyx_XDECREF(__pyx_9genexpr12__pyx_v_v); __pyx_9genexpr12__pyx_v_v = 0;
      goto __pyx_L1_error;
      __pyx_L12_exit_scope:;
    } /* exit inner scope */
    __Pyx_DECREF_SET(__pyx_v_attrs, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":1067
 * 
 *     cdef _start(self, tag, attrs, new_namespaces, qname_text=None):
 *         if self._exclude_attrs is not None and attrs:             # <<<<<<<<<<<<<<
 *             attrs = {k: v for k, v in attrs.items() if k not in self._exclude_attrs}
 * 
*/
  }

  /* "src/lxml/serializer.pxi":1070
 *             attrs = {k: v for k, v in attrs.items() if k not in self._exclude_attrs}
 * 
 *         qnames = {tag, *attrs}             # <<<<<<<<<<<<<<
 *         resolved_names = {}
 * 
*/
  __pyx_t_4 = PySet_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 1070, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PySet_Add(__pyx_t_4, __pyx_v_tag) < (0)) __PYX_ERR(6, 1070, __pyx_L1_error)
  __pyx_t_3 = __pyx_t_4;
  __pyx_t_4 = 0;
  if (unlikely(__pyx_v_attrs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "argument after * must be an iterable, not NoneType");
    __PYX_ERR(6, 1070, __pyx_L1_error)
  }
  if (__Pyx_PySet_Update(__pyx_t_3, __pyx_v_attrs) < (0)) __PYX_ERR(6, 1070, __pyx_L1_error)
  __pyx_v_qnames = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/serializer.pxi":1071
 * 
 *         qnames = {tag, *attrs}
 *         resolved_names = {}             # <<<<<<<<<<<<<<
 * 
 *         # Resolve prefixes in attribute and tag text.
*/
  __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1071, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_resolved_names = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/serializer.pxi":1074
 * 
 *         # Resolve prefixes in attribute and tag text.
 *         if qname_text is not None:             # <<<<<<<<<<<<<<
 *             qname = resolved_names[qname_text] = self._resolve_prefix_name(qname_text)
 *             qnames.add(qname)
*/
  __pyx_t_1 = (__pyx_v_qname_text != Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1075
 *         # Resolve prefixes in attribute and tag text.
 *         if qname_text is not None:
 *             qname = resolved_names[qname_text] = self._resolve_prefix_name(qname_text)             # <<<<<<<<<<<<<<
 *             qnames.add(qname)
 *         if self._find_qname_aware_attrs is not None and attrs:
*/
    __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree_C14NWriterTarget *)__pyx_v_self->__pyx_vtab)->_resolve_prefix_name(__pyx_v_self, __pyx_v_qname_text); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1075, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_v_qname = __pyx_t_3;
    if (unlikely((PyDict_SetItem(__pyx_v_resolved_names, __pyx_v_qname_text, __pyx_t_3) < 0))) __PYX_ERR(6, 1075, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":1076
 *         if qname_text is not None:
 *             qname = resolved_names[qname_text] = self._resolve_prefix_name(qname_text)
 *             qnames.add(qname)             # <<<<<<<<<<<<<<
 *         if self._find_qname_aware_attrs is not None and attrs:
 *             qattrs = self._find_qname_aware_attrs(attrs)
*/
    __pyx_t_11 = PySet_Add(__pyx_v_qnames, __pyx_v_qname); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(6, 1076, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":1074
 * 
 *         # Resolve prefixes in attribute and tag text.
 *         if qname_text is not None:             # <<<<<<<<<<<<<<
 *             qname = resolved_names[qname_text] = self._resolve_prefix_name(qname_text)
 *             qnames.add(qname)
*/
  }

  /* "src/lxml/serializer.pxi":1077
 *             qname = resolved_names[qname_text] = self._resolve_prefix_name(qname_text)
 *             qnames.add(qname)
 *         if self._find_qname_aware_attrs is not None and attrs:             # <<<<<<<<<<<<<<
 *             qattrs = self._find_qname_aware_attrs(attrs)
 *             if qattrs:
*/
  __pyx_t_2 = (__pyx_v_self->_find_qname_aware_attrs != Py_None);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L15_bool_binop_done;
  }
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_attrs); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(6, 1077, __pyx_L1_error)
  __pyx_t_1 = __pyx_t_2;
  __pyx_L15_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1078
 *             qnames.add(qname)
 *         if self._find_qname_aware_attrs is not None and attrs:
 *             qattrs = self._find_qname_aware_attrs(attrs)             # <<<<<<<<<<<<<<
 *             if qattrs:
 *                 for attr_name in qattrs:
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_v_self->_find_qname_aware_attrs);
    __pyx_t_9 = __pyx_v_self->_find_qname_aware_attrs; 
    __pyx_t_12 = 1;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_9);
      assert(__pyx_t_4);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_9, __pyx__function);
      __pyx_t_12 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_attrs};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_9, __pyx_callargs+__pyx_t_12, (2-__pyx_t_12) | (__pyx_t_12*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1078, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __pyx_v_qattrs = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":1079
 *         if self._find_qname_aware_attrs is not None and attrs:
 *             qattrs = self._find_qname_aware_attrs(attrs)
 *             if qattrs:             # <<<<<<<<<<<<<<
 *                 for attr_name in qattrs:
 *                     value = attrs[attr_name]
*/
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_qattrs); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(6, 1079, __pyx_L1_error)
    if (__pyx_t_1) {

      /* "src/lxml/serializer.pxi":1080
 *             qattrs = self._find_qname_aware_attrs(attrs)
 *             if qattrs:
 *                 for attr_name in qattrs:             # <<<<<<<<<<<<<<
 *                     value = attrs[attr_name]
 *                     if _looks_like_prefix_name(value):
*/
      if (likely(PyList_CheckExact(__pyx_v_qattrs)) || PyTuple_CheckExact(__pyx_v_qattrs)) {
        __pyx_t_3 = __pyx_v_qattrs; __Pyx_INCREF(__pyx_t_3);
        __pyx_t_6 = 0;
        __pyx_t_13 = NULL;
      } else {
        __pyx_t_6 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_qattrs); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1080, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_13 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_13)) __PYX_ERR(6, 1080, __pyx_L1_error)
      }
      for (;;) {
        if (likely(!__pyx_t_13)) {
          if (likely(PyList_CheckExact(__pyx_t_3))) {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(6, 1080, __pyx_L1_error)
              #endif
              if (__pyx_t_6 >= __pyx_temp) break;
            }
            __pyx_t_9 = __Pyx_PyList_GetItemRefFast(__pyx_t_3, __pyx_t_6, __Pyx_ReferenceSharing_OwnStrongReference);
            ++__pyx_t_6;
          } else {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(6, 1080, __pyx_L1_error)
              #endif
              if (__pyx_t_6 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_9 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_6));
            #else
            __pyx_t_9 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_6);
            #endif
            ++__pyx_t_6;
          }
          if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 1080, __pyx_L1_error)
        } else {
          __pyx_t_9 = __pyx_t_13(__pyx_t_3);
          if (unlikely(!__pyx_t_9)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(6, 1080, __pyx_L1_error)
              PyErr_Clear();
            }
            break;
          }
        }
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_XDECREF_SET(__pyx_v_attr_name, __pyx_t_9);
        __pyx_t_9 = 0;

        /* "src/lxml/serializer.pxi":1081
 *             if qattrs:
 *                 for attr_name in qattrs:
 *                     value = attrs[attr_name]             # <<<<<<<<<<<<<<
 *                     if _looks_like_prefix_name(value):
 *                         qname = resolved_names[value] = self._resolve_prefix_name(value)
*/
        __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_v_attrs, __pyx_v_attr_name); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 1081, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_9);
        __pyx_t_9 = 0;

        /* "src/lxml/serializer.pxi":1082
 *                 for attr_name in qattrs:
 *                     value = attrs[attr_name]
 *                     if _looks_like_prefix_name(value):             # <<<<<<<<<<<<<<
 *                         qname = resolved_names[value] = self._resolve_prefix_name(value)
 *                         qnames.add(qname)
*/
        __pyx_t_4 = NULL;
        __Pyx_INCREF(__pyx_v_4lxml_5etree__looks_like_prefix_name);
        __pyx_t_8 = __pyx_v_4lxml_5etree__looks_like_prefix_name; 
        __pyx_t_12 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_8))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_8);
          assert(__pyx_t_4);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_8);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_8, __pyx__function);
          __pyx_t_12 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_value};
          __pyx_t_9 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_8, __pyx_callargs+__pyx_t_12, (2-__pyx_t_12) | (__pyx_t_12*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 1082, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
        }
        __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(6, 1082, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (__pyx_t_1) {

          /* "src/lxml/serializer.pxi":1083
 *                     value = attrs[attr_name]
 *                     if _looks_like_prefix_name(value):
 *                         qname = resolved_names[value] = self._resolve_prefix_name(value)             # <<<<<<<<<<<<<<
 *                         qnames.add(qname)
 *             else:
*/
          __pyx_t_9 = ((struct __pyx_vtabstruct_4lxml_5etree_C14NWriterTarget *)__pyx_v_self->__pyx_vtab)->_resolve_prefix_name(__pyx_v_self, __pyx_v_value); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 1083, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_XDECREF_SET(__pyx_v_qname, __pyx_t_9);
          if (unlikely((PyDict_SetItem(__pyx_v_resolved_names, __pyx_v_value, __pyx_t_9) < 0))) __PYX_ERR(6, 1083, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

          /* "src/lxml/serializer.pxi":1084
 *                     if _looks_like_prefix_name(value):
 *                         qname = resolved_names[value] = self._resolve_prefix_name(value)
 *                         qnames.add(qname)             # <<<<<<<<<<<<<<
 *             else:
 *                 qattrs = None
*/
          __pyx_t_11 = PySet_Add(__pyx_v_qnames, __pyx_v_qname); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(6, 1084, __pyx_L1_error)

          /* "src/lxml/serializer.pxi":1082
 *                 for attr_name in qattrs:
 *                     value = attrs[attr_name]
 *                     if _looks_like_prefix_name(value):             # <<<<<<<<<<<<<<
 *                         qname = resolved_names[value] = self._resolve_prefix_name(value)
 *                         qnames.add(qname)
*/
        }

        /* "src/lxml/serializer.pxi":1080
 *             qattrs = self._find_qname_aware_attrs(attrs)
 *             if qattrs:
 *                 for attr_name in qattrs:             # <<<<<<<<<<<<<<
 *                     value = attrs[attr_name]
 *                     if _looks_like_prefix_name(value):
*/
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "src/lxml/serializer.pxi":1079
 *         if self._find_qname_aware_attrs is not None and attrs:
 *             qattrs = self._find_qname_aware_attrs(attrs)
 *             if qattrs:             # <<<<<<<<<<<<<<
 *                 for attr_name in qattrs:
 *                     value = attrs[attr_name]
*/
      goto __pyx_L17;
    }

    /* "src/lxml/serializer.pxi":1086
 *                         qnames.add(qname)
 *             else:
 *                 qattrs = None             # <<<<<<<<<<<<<<
 *         else:
 *             qattrs = None
*/
    /*else*/ {
      __Pyx_INCREF(Py_None);
      __Pyx_DECREF_SET(__pyx_v_qattrs, Py_None);
    }
    __pyx_L17:;

    /* "src/lxml/serializer.pxi":1077
 *             qname = resolved_names[qname_text] = self._resolve_prefix_name(qname_text)
 *             qnames.add(qname)
 *         if self._find_qname_aware_attrs is not None and attrs:             # <<<<<<<<<<<<<<
 *             qattrs = self._find_qname_aware_attrs(attrs)
 *             if qattrs:
*/
    goto __pyx_L14;
  }

  /* "src/lxml/serializer.pxi":1088
 *                 qattrs = None
 *         else:
 *             qattrs = None             # <<<<<<<<<<<<<<
 * 
 *         # Assign prefixes in lexicographical order of used URIs.
*/
  /*else*/ {
    __Pyx_INCREF(Py_None);
    __pyx_v_qattrs = Py_None;
  }
  __pyx_L14:;

  /* "src/lxml/serializer.pxi":1091
 * 
 *         # Assign prefixes in lexicographical order of used URIs.
 *         parsed_qnames = {n: self._qname(n) for n in sorted(             # <<<<<<<<<<<<<<
 *             qnames, key=lambda n: n.split('}', 1))}
 * 
*/
  { /* enter inner scope */
    __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1091, __pyx_L24_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = NULL;

    /* "src/lxml/serializer.pxi":1092
 *         # Assign prefixes in lexicographical order of used URIs.
 *         parsed_qnames = {n: self._qname(n) for n in sorted(
 *             qnames, key=lambda n: n.split('}', 1))}             # <<<<<<<<<<<<<<
 * 
 *         # Write namespace declarations in prefix order ...
*/
    __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_16C14NWriterTarget_6_start_lambda, 0, __pyx_mstate_global->__pyx_n_u_C14NWriterTarget__start_locals_l, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[2])); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 1092, __pyx_L24_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_12 = 1;
    {
      PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_8, __pyx_v_qnames};
      __pyx_t_14 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_14)) __PYX_ERR(6, 1091, __pyx_L24_error)
      __Pyx_GOTREF(__pyx_t_14);
      if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_key, __pyx_t_4, __pyx_t_14, __pyx_callargs+2, 0) < (0)) __PYX_ERR(6, 1091, __pyx_L24_error)
      __pyx_t_9 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_builtin_sorted, __pyx_callargs+__pyx_t_12, (2-__pyx_t_12) | (__pyx_t_12*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_14);
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 1091, __pyx_L24_error)
      __Pyx_GOTREF(__pyx_t_9);
    }

    /* "src/lxml/serializer.pxi":1091
 * 
 *         # Assign prefixes in lexicographical order of used URIs.
 *         parsed_qnames = {n: self._qname(n) for n in sorted(             # <<<<<<<<<<<<<<
 *             qnames, key=lambda n: n.split('}', 1))}
 * 
*/
    if (likely(PyList_CheckExact(__pyx_t_9)) || PyTuple_CheckExact(__pyx_t_9)) {
      __pyx_t_14 = __pyx_t_9; __Pyx_INCREF(__pyx_t_14);
      __pyx_t_6 = 0;
      __pyx_t_13 = NULL;
    } else {
      __pyx_t_6 = -1; __pyx_t_14 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_14)) __PYX_ERR(6, 1091, __pyx_L24_error)
      __Pyx_GOTREF(__pyx_t_14);
      __pyx_t_13 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_14); if (unlikely(!__pyx_t_13)) __PYX_ERR(6, 1091, __pyx_L24_error)
    }
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    for (;;) {
      if (likely(!__pyx_t_13)) {
        if (likely(PyList_CheckExact(__pyx_t_14))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_14);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(6, 1091, __pyx_L24_error)
            #endif
            if (__pyx_t_6 >= __pyx_temp) break;
          }
          __pyx_t_9 = __Pyx_PyList_GetItemRefFast(__pyx_t_14, __pyx_t_6, __Pyx_ReferenceSharing_OwnStrongReference);
          ++__pyx_t_6;
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_14);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(6, 1091, __pyx_L24_error)
            #endif
            if (__pyx_t_6 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_9 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_14, __pyx_t_6));
          #else
          __pyx_t_9 = __Pyx_PySequence_ITEM(__pyx_t_14, __pyx_t_6);
          #endif
          ++__pyx_t_6;
        }
        if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 1091, __pyx_L24_error)
      } else {
        __pyx_t_9 = __pyx_t_13(__pyx_t_14);
        if (unlikely(!__pyx_t_9)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(6, 1091, __pyx_L24_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_XDECREF_SET(__pyx_9genexpr13__pyx_v_n, __pyx_t_9);
      __pyx_t_9 = 0;
      __pyx_t_9 = ((struct __pyx_vtabstruct_4lxml_5etree_C14NWriterTarget *)__pyx_v_self->__pyx_vtab)->_qname(__pyx_v_self, __pyx_9genexpr13__pyx_v_n, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 1091, __pyx_L24_error)
      __Pyx_GOTREF(__pyx_t_9);
      if (unlikely(PyDict_SetItem(__pyx_t_3, (PyObject*)__pyx_9genexpr13__pyx_v_n, (PyObject*)__pyx_t_9))) __PYX_ERR(6, 1091, __pyx_L24_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_XDECREF(__pyx_9genexpr13__pyx_v_n); __pyx_9genexpr13__pyx_v_n = 0;
    goto __pyx_L28_exit_scope;
    __pyx_L24_error:;
    __Pyx_XDECREF(__pyx_9genexpr13__pyx_v_n); __pyx_9genexpr13__pyx_v_n = 0;
    goto __pyx_L1_error;
    __pyx_L28_exit_scope:;
  } /* exit inner scope */
  __pyx_v_parsed_qnames = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/serializer.pxi":1095
 * 
 *         # Write namespace declarations in prefix order ...
 *         if new_namespaces:             # <<<<<<<<<<<<<<
 *             attr_list = [
 *                 ('xmlns:' + prefix if prefix else 'xmlns', uri)
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_new_namespaces); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(6, 1095, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1096
 *         # Write namespace declarations in prefix order ...
 *         if new_namespaces:
 *             attr_list = [             # <<<<<<<<<<<<<<
 *                 ('xmlns:' + prefix if prefix else 'xmlns', uri)
 *                 for uri, prefix in new_namespaces
*/
    { /* enter inner scope */
      __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1096, __pyx_L32_error)
      __Pyx_GOTREF(__pyx_t_3);

      /* "src/lxml/serializer.pxi":1098
 *             attr_list = [
 *                 ('xmlns:' + prefix if prefix else 'xmlns', uri)
 *                 for uri, prefix in new_namespaces             # <<<<<<<<<<<<<<
 *             ]
 *             attr_list.sort()
*/
      if (likely(PyList_CheckExact(__pyx_v_new_namespaces)) || PyTuple_CheckExact(__pyx_v_new_namespaces)) {
        __pyx_t_14 = __pyx_v_new_namespaces; __Pyx_INCREF(__pyx_t_14);
        __pyx_t_6 = 0;
        __pyx_t_13 = NULL;
      } else {
        __pyx_t_6 = -1; __pyx_t_14 = PyObject_GetIter(__pyx_v_new_namespaces); if (unlikely(!__pyx_t_14)) __PYX_ERR(6, 1098, __pyx_L32_error)
        __Pyx_GOTREF(__pyx_t_14);
        __pyx_t_13 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_14); if (unlikely(!__pyx_t_13)) __PYX_ERR(6, 1098, __pyx_L32_error)
      }
      for (;;) {
        if (likely(!__pyx_t_13)) {
          if (likely(PyList_CheckExact(__pyx_t_14))) {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_14);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(6, 1098, __pyx_L32_error)
              #endif
              if (__pyx_t_6 >= __pyx_temp) break;
            }
            __pyx_t_9 = __Pyx_PyList_GetItemRefFast(__pyx_t_14, __pyx_t_6, __Pyx_ReferenceSharing_OwnStrongReference);
            ++__pyx_t_6;
          } else {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_14);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(6, 1098, __pyx_L32_error)
              #endif
              if (__pyx_t_6 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_9 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_14, __pyx_t_6));
            #else
            __pyx_t_9 = __Pyx_PySequence_ITEM(__pyx_t_14, __pyx_t_6);
            #endif
            ++__pyx_t_6;
          }
          if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 1098, __pyx_L32_error)
        } else {
          __pyx_t_9 = __pyx_t_13(__pyx_t_14);
          if (unlikely(!__pyx_t_9)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(6, 1098, __pyx_L32_error)
              PyErr_Clear();
            }
            break;
          }
        }
        __Pyx_GOTREF(__pyx_t_9);
        if ((likely(PyTuple_CheckExact(__pyx_t_9))) || (PyList_CheckExact(__pyx_t_9))) {
          PyObject* sequence = __pyx_t_9;
          Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
          if (unlikely(size != 2)) {
            if (size > 2) __Pyx_RaiseTooManyValuesError(2);
            else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
            __PYX_ERR(6, 1098, __pyx_L32_error)
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          if (likely(PyTuple_CheckExact(sequence))) {
            __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
            __Pyx_INCREF(__pyx_t_4);
            __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1);
            __Pyx_INCREF(__pyx_t_8);
          } else {
            __pyx_t_4 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
            if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 1098, __pyx_L32_error)
            __Pyx_XGOTREF(__pyx_t_4);
            __pyx_t_8 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
            if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 1098, __pyx_L32_error)
            __Pyx_XGOTREF(__pyx_t_8);
          }
          #else
          __pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 1098, __pyx_L32_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_8 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 1098, __pyx_L32_error)
          __Pyx_GOTREF(__pyx_t_8);
          #endif
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        } else {
          Py_ssize_t index = -1;
          __pyx_t_15 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_15)) __PYX_ERR(6, 1098, __pyx_L32_error)
          __Pyx_GOTREF(__pyx_t_15);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_t_16 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_15);
          index = 0; __pyx_t_4 = __pyx_t_16(__pyx_t_15); if (unlikely(!__pyx_t_4)) goto __pyx_L35_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_4);
          index = 1; __pyx_t_8 = __pyx_t_16(__pyx_t_15); if (unlikely(!__pyx_t_8)) goto __pyx_L35_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_8);
          if (__Pyx_IternextUnpackEndCheck(__pyx_t_16(__pyx_t_15), 2) < (0)) __PYX_ERR(6, 1098, __pyx_L32_error)
          __pyx_t_16 = NULL;
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          goto __pyx_L36_unpacking_done;
          __pyx_L35_unpacking_failed:;
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          __pyx_t_16 = NULL;
          if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
          __PYX_ERR(6, 1098, __pyx_L32_error)
          __pyx_L36_unpacking_done:;
        }
        __Pyx_XDECREF_SET(__pyx_9genexpr14__pyx_v_uri, __pyx_t_4);
        __pyx_t_4 = 0;
        __Pyx_XDECREF_SET(__pyx_9genexpr14__pyx_v_prefix, __pyx_t_8);
        __pyx_t_8 = 0;

        /* "src/lxml/serializer.pxi":1097
 *         if new_namespaces:
 *             attr_list = [
 *                 ('xmlns:' + prefix if prefix else 'xmlns', uri)             # <<<<<<<<<<<<<<
 *                 for uri, prefix in new_namespaces
 *             ]
*/
        __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_9genexpr14__pyx_v_prefix); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(6, 1097, __pyx_L32_error)
        if (__pyx_t_1) {
          __pyx_t_8 = PyNumber_Add(__pyx_mstate_global->__pyx_kp_u_xmlns, __pyx_9genexpr14__pyx_v_prefix); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 1097, __pyx_L32_error)
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_9 = __pyx_t_8;
          __pyx_t_8 = 0;
        } else {
          __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_xmlns_2);
          __pyx_t_9 = __pyx_mstate_global->__pyx_n_u_xmlns_2;
        }
        __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 1097, __pyx_L32_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_GIVEREF(__pyx_t_9);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9) != (0)) __PYX_ERR(6, 1097, __pyx_L32_error);
        __Pyx_INCREF(__pyx_9genexpr14__pyx_v_uri);
        __Pyx_GIVEREF(__pyx_9genexpr14__pyx_v_uri);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_9genexpr14__pyx_v_uri) != (0)) __PYX_ERR(6, 1097, __pyx_L32_error);
        __pyx_t_9 = 0;
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_8))) __PYX_ERR(6, 1096, __pyx_L32_error)
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

        /* "src/lxml/serializer.pxi":1098
 *             attr_list = [
 *                 ('xmlns:' + prefix if prefix else 'xmlns', uri)
 *                 for uri, prefix in new_namespaces             # <<<<<<<<<<<<<<
 *             ]
 *             attr_list.sort()
*/
      }
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_9genexpr14__pyx_v_prefix); __pyx_9genexpr14__pyx_v_prefix = 0;
      __Pyx_XDECREF(__pyx_9genexpr14__pyx_v_uri); __pyx_9genexpr14__pyx_v_uri = 0;
      goto __pyx_L38_exit_scope;
      __pyx_L32_error:;
      __Pyx_XDECREF(__pyx_9genexpr14__pyx_v_prefix); __pyx_9genexpr14__pyx_v_prefix = 0;
      __Pyx_XDECREF(__pyx_9genexpr14__pyx_v_uri); __pyx_9genexpr14__pyx_v_uri = 0;
      goto __pyx_L1_error;
      __pyx_L38_exit_scope:;
    } /* exit inner scope */
    __pyx_v_attr_list = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":1100
 *                 for uri, prefix in new_namespaces
 *             ]
 *             attr_list.sort()             # <<<<<<<<<<<<<<
 *         else:
 *             # almost always empty
*/
    __pyx_t_11 = PyList_Sort(__pyx_v_attr_list); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(6, 1100, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":1095
 * 
 *         # Write namespace declarations in prefix order ...
 *         if new_namespaces:             # <<<<<<<<<<<<<<
 *             attr_list = [
 *                 ('xmlns:' + prefix if prefix else 'xmlns', uri)
*/
    goto __pyx_L29;
  }

  /* "src/lxml/serializer.pxi":1103
 *         else:
 *             # almost always empty
 *             attr_list = []             # <<<<<<<<<<<<<<
 * 
 *         # ... followed by attributes in URI+name order
*/
  /*else*/ {
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1103, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_attr_list = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;
  }
  __pyx_L29:;

  /* "src/lxml/serializer.pxi":1106
 * 
 *         # ... followed by attributes in URI+name order
 *         if attrs:             # <<<<<<<<<<<<<<
 *             for k, v in sorted(attrs.items()):
 *                 if qattrs is not None and k in qattrs and v in resolved_names:
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_attrs); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(6, 1106, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1107
 *         # ... followed by attributes in URI+name order
 *         if attrs:
 *             for k, v in sorted(attrs.items()):             # <<<<<<<<<<<<<<
 *                 if qattrs is not None and k in qattrs and v in resolved_names:
 *                     v = parsed_qnames[resolved_names[v]][0]
*/
    __pyx_t_14 = __pyx_v_attrs;
    __Pyx_INCREF(__pyx_t_14);
    __pyx_t_12 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_14, NULL};
      __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_items, __pyx_callargs+__pyx_t_12, (1-__pyx_t_12) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1107, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __pyx_t_14 = PySequence_List(__pyx_t_3); if (unlikely(!__pyx_t_14)) __PYX_ERR(6, 1107, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely((PyList_Sort(__pyx_t_14) < 0))) __PYX_ERR(6, 1107, __pyx_L1_error)
    __pyx_t_3 = __pyx_t_14; __Pyx_INCREF(__pyx_t_3);
    __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    for (;;) {
      {
        Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely((__pyx_temp < 0))) __PYX_ERR(6, 1107, __pyx_L1_error)
        #endif
        if (__pyx_t_6 >= __pyx_temp) break;
      }
      __pyx_t_14 = __Pyx_PyList_GetItemRefFast(__pyx_t_3, __pyx_t_6, __Pyx_ReferenceSharing_OwnStrongReference);
      ++__pyx_t_6;
      if (unlikely(!__pyx_t_14)) __PYX_ERR(6, 1107, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      if ((likely(PyTuple_CheckExact(__pyx_t_14))) || (PyList_CheckExact(__pyx_t_14))) {
        PyObject* sequence = __pyx_t_14;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(6, 1107, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0);
          __Pyx_INCREF(__pyx_t_8);
          __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1);
          __Pyx_INCREF(__pyx_t_9);
        } else {
          __pyx_t_8 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
          if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 1107, __pyx_L1_error)
          __Pyx_XGOTREF(__pyx_t_8);
          __pyx_t_9 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
          if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 1107, __pyx_L1_error)
          __Pyx_XGOTREF(__pyx_t_9);
        }
        #else
        __pyx_t_8 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 1107, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_9 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 1107, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        #endif
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_4 = PyObject_GetIter(__pyx_t_14); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 1107, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __pyx_t_16 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4);
        index = 0; __pyx_t_8 = __pyx_t_16(__pyx_t_4); if (unlikely(!__pyx_t_8)) goto __pyx_L42_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_8);
        index = 1; __pyx_t_9 = __pyx_t_16(__pyx_t_4); if (unlikely(!__pyx_t_9)) goto __pyx_L42_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_9);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_16(__pyx_t_4), 2) < (0)) __PYX_ERR(6, 1107, __pyx_L1_error)
        __pyx_t_16 = NULL;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        goto __pyx_L43_unpacking_done;
        __pyx_L42_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_16 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(6, 1107, __pyx_L1_error)
        __pyx_L43_unpacking_done:;
      }
      __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_8);
      __pyx_t_8 = 0;
      __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_9);
      __pyx_t_9 = 0;

      /* "src/lxml/serializer.pxi":1108
 *         if attrs:
 *             for k, v in sorted(attrs.items()):
 *                 if qattrs is not None and k in qattrs and v in resolved_names:             # <<<<<<<<<<<<<<
 *                     v = parsed_qnames[resolved_names[v]][0]
 *                 attr_qname, attr_name, uri = parsed_qnames[k]
*/
      __pyx_t_2 = (__pyx_v_qattrs != Py_None);
      if (__pyx_t_2) {
      } else {
        __pyx_t_1 = __pyx_t_2;
        goto __pyx_L45_bool_binop_done;
      }
      __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_v_k, __pyx_v_qattrs, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(6, 1108, __pyx_L1_error)
      if (__pyx_t_2) {
      } else {
        __pyx_t_1 = __pyx_t_2;
        goto __pyx_L45_bool_binop_done;
      }
      __pyx_t_2 = (__Pyx_PyDict_ContainsTF(__pyx_v_v, __pyx_v_resolved_names, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(6, 1108, __pyx_L1_error)
      __pyx_t_1 = __pyx_t_2;
      __pyx_L45_bool_binop_done:;
      if (__pyx_t_1) {

        /* "src/lxml/serializer.pxi":1109
 *             for k, v in sorted(attrs.items()):
 *                 if qattrs is not None and k in qattrs and v in resolved_names:
 *                     v = parsed_qnames[resolved_names[v]][0]             # <<<<<<<<<<<<<<
 *                 attr_qname, attr_name, uri = parsed_qnames[k]
 *                 # No prefix for attributes in default ('') namespace.
*/
        __pyx_t_14 = __Pyx_PyDict_GetItem(__pyx_v_resolved_names, __pyx_v_v); if (unlikely(!__pyx_t_14)) __PYX_ERR(6, 1109, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        __pyx_t_9 = __Pyx_PyDict_GetItem(__pyx_v_parsed_qnames, __pyx_t_14); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 1109, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __pyx_t_14 = __Pyx_GetItemInt(__pyx_t_9, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_14)) __PYX_ERR(6, 1109, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF_SET(__pyx_v_v, __pyx_t_14);
        __pyx_t_14 = 0;

        /* "src/lxml/serializer.pxi":1108
 *         if attrs:
 *             for k, v in sorted(attrs.items()):
 *                 if qattrs is not None and k in qattrs and v in resolved_names:             # <<<<<<<<<<<<<<
 *                     v = parsed_qnames[resolved_names[v]][0]
 *                 attr_qname, attr_name, uri = parsed_qnames[k]
*/
      }

      /* "src/lxml/serializer.pxi":1110
 *                 if qattrs is not None and k in qattrs and v in resolved_names:
 *                     v = parsed_qnames[resolved_names[v]][0]
 *                 attr_qname, attr_name, uri = parsed_qnames[k]             # <<<<<<<<<<<<<<
 *                 # No prefix for attributes in default ('') namespace.
 *                 attr_list.append((attr_qname if uri else attr_name, v))
*/
      __pyx_t_14 = __Pyx_PyDict_GetItem(__pyx_v_parsed_qnames, __pyx_v_k); if (unlikely(!__pyx_t_14)) __PYX_ERR(6, 1110, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      if ((likely(PyTuple_CheckExact(__pyx_t_14))) || (PyList_CheckExact(__pyx_t_14))) {
        PyObject* sequence = __pyx_t_14;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 3)) {
          if (size > 3) __Pyx_RaiseTooManyValuesError(3);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(6, 1110, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0);
          __Pyx_INCREF(__pyx_t_9);
          __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1);
          __Pyx_INCREF(__pyx_t_8);
          __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2);
          __Pyx_INCREF(__pyx_t_4);
        } else {
          __pyx_t_9 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
          if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 1110, __pyx_L1_error)
          __Pyx_XGOTREF(__pyx_t_9);
          __pyx_t_8 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
          if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 1110, __pyx_L1_error)
          __Pyx_XGOTREF(__pyx_t_8);
          __pyx_t_4 = __Pyx_PyList_GetItemRefFast(sequence, 2, __Pyx_ReferenceSharing_SharedReference);
          if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 1110, __pyx_L1_error)
          __Pyx_XGOTREF(__pyx_t_4);
        }
        #else
        __pyx_t_9 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 1110, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_8 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 1110, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 1110, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_15 = PyObject_GetIter(__pyx_t_14); if (unlikely(!__pyx_t_15)) __PYX_ERR(6, 1110, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __pyx_t_16 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_15);
        index = 0; __pyx_t_9 = __pyx_t_16(__pyx_t_15); if (unlikely(!__pyx_t_9)) goto __pyx_L48_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_9);
        index = 1; __pyx_t_8 = __pyx_t_16(__pyx_t_15); if (unlikely(!__pyx_t_8)) goto __pyx_L48_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_8);
        index = 2; __pyx_t_4 = __pyx_t_16(__pyx_t_15); if (unlikely(!__pyx_t_4)) goto __pyx_L48_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_4);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_16(__pyx_t_15), 3) < (0)) __PYX_ERR(6, 1110, __pyx_L1_error)
        __pyx_t_16 = NULL;
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        goto __pyx_L49_unpacking_done;
        __pyx_L48_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __pyx_t_16 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(6, 1110, __pyx_L1_error)
        __pyx_L49_unpacking_done:;
      }
      __Pyx_XDECREF_SET(__pyx_v_attr_qname, __pyx_t_9);
      __pyx_t_9 = 0;
      __Pyx_XDECREF_SET(__pyx_v_attr_name, __pyx_t_8);
      __pyx_t_8 = 0;
      __Pyx_XDECREF_SET(__pyx_v_uri, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "src/lxml/serializer.pxi":1112
 *                 attr_qname, attr_name, uri = parsed_qnames[k]
 *                 # No prefix for attributes in default ('') namespace.
 *                 attr_list.append((attr_qname if uri else attr_name, v))             # <<<<<<<<<<<<<<
 * 
 *         # Honour xml:space attributes.
*/
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_uri); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(6, 1112, __pyx_L1_error)
      if (__pyx_t_1) {
        __Pyx_INCREF(__pyx_v_attr_qname);
        __pyx_t_14 = __pyx_v_attr_qname;
      } else {
        __Pyx_INCREF(__pyx_v_attr_name);
        __pyx_t_14 = __pyx_v_attr_name;
      }
      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 1112, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_14);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_14) != (0)) __PYX_ERR(6, 1112, __pyx_L1_error);
      __Pyx_INCREF(__pyx_v_v);
      __Pyx_GIVEREF(__pyx_v_v);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_v) != (0)) __PYX_ERR(6, 1112, __pyx_L1_error);
      __pyx_t_14 = 0;
      __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_attr_list, __pyx_t_4); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(6, 1112, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "src/lxml/serializer.pxi":1107
 *         # ... followed by attributes in URI+name order
 *         if attrs:
 *             for k, v in sorted(attrs.items()):             # <<<<<<<<<<<<<<
 *                 if qattrs is not None and k in qattrs and v in resolved_names:
 *                     v = parsed_qnames[resolved_names[v]][0]
*/
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":1106
 * 
 *         # ... followed by attributes in URI+name order
 *         if attrs:             # <<<<<<<<<<<<<<
 *             for k, v in sorted(attrs.items()):
 *                 if qattrs is not None and k in qattrs and v in resolved_names:
*/
  }

  /* "src/lxml/serializer.pxi":1115
 * 
 *         # Honour xml:space attributes.
 *         space_behaviour = attrs.get('{http://www.w3.org/XML/1998/namespace}space')             # <<<<<<<<<<<<<<
 *         self._preserve_space.append(
 *             space_behaviour == 'preserve' if space_behaviour
*/
  __pyx_t_4 = __pyx_v_attrs;
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_12 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_http_www_w3_org_XML_1998_namesp};
    __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get, __pyx_callargs+__pyx_t_12, (2-__pyx_t_12) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1115, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  __pyx_v_space_behaviour = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "src/lxml/serializer.pxi":1116
 *         # Honour xml:space attributes.
 *         space_behaviour = attrs.get('{http://www.w3.org/XML/1998/namespace}space')
 *         self._preserve_space.append(             # <<<<<<<<<<<<<<
 *             space_behaviour == 'preserve' if space_behaviour
 *             else self._preserve_space[-1])
*/
  if (unlikely(__pyx_v_self->_preserve_space == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
    __PYX_ERR(6, 1116, __pyx_L1_error)
  }

  /* "src/lxml/serializer.pxi":1117
 *         space_behaviour = attrs.get('{http://www.w3.org/XML/1998/namespace}space')
 *         self._preserve_space.append(
 *             space_behaviour == 'preserve' if space_behaviour             # <<<<<<<<<<<<<<
 *             else self._preserve_space[-1])
 * 
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_space_behaviour); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(6, 1117, __pyx_L1_error)
  if (__pyx_t_1) {
    __pyx_t_4 = PyObject_RichCompare(__pyx_v_space_behaviour, __pyx_mstate_global->__pyx_n_u_preserve, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 1117, __pyx_L1_error)
    __pyx_t_3 = __pyx_t_4;
    __pyx_t_4 = 0;
  } else {

    /* "src/lxml/serializer.pxi":1118
 *         self._preserve_space.append(
 *             space_behaviour == 'preserve' if space_behaviour
 *             else self._preserve_space[-1])             # <<<<<<<<<<<<<<
 * 
 *         # Write the tag.
*/
    if (unlikely(__pyx_v_self->_preserve_space == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(6, 1118, __pyx_L1_error)
    }
    __pyx_t_4 = __Pyx_GetItemInt_List(__pyx_v_self->_preserve_space, -1L, long, 1, __Pyx_PyLong_From_long, 1, 1, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 1118, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __pyx_t_4;
    __pyx_t_4 = 0;
  }

  /* "src/lxml/serializer.pxi":1116
 *         # Honour xml:space attributes.
 *         space_behaviour = attrs.get('{http://www.w3.org/XML/1998/namespace}space')
 *         self._preserve_space.append(             # <<<<<<<<<<<<<<
 *             space_behaviour == 'preserve' if space_behaviour
 *             else self._preserve_space[-1])
*/
  __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_self->_preserve_space, __pyx_t_3); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(6, 1116, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/serializer.pxi":1121
 * 
 *         # Write the tag.
 *         write = self._write             # <<<<<<<<<<<<<<
 *         write('<' + parsed_qnames[tag][0])
 *         if attr_list:
*/
  __pyx_t_3 = __pyx_v_self->_write;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_v_write = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "src/lxml/serializer.pxi":1122
 *         # Write the tag.
 *         write = self._write
 *         write('<' + parsed_qnames[tag][0])             # <<<<<<<<<<<<<<
 *         if attr_list:
 *             write(''.join([f' {k}="{_escape_attrib_c14n(v)}"' for k, v in attr_list]))
*/
  __pyx_t_4 = NULL;
  __Pyx_INCREF(__pyx_v_write);
  __pyx_t_14 = __pyx_v_write; 
  __pyx_t_8 = __Pyx_PyDict_GetItem(__pyx_v_parsed_qnames, __pyx_v_tag); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 1122, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = __Pyx_GetItemInt(__pyx_t_8, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 1122, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyNumber_Add(__pyx_mstate_global->__pyx_kp_u__37, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 1122, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_12 = 1;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_14))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_14);
    assert(__pyx_t_4);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_14);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_14, __pyx__function);
    __pyx_t_12 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_8};
    __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_14, __pyx_callargs+__pyx_t_12, (2-__pyx_t_12) | (__pyx_t_12*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1122, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/serializer.pxi":1123
 *         write = self._write
 *         write('<' + parsed_qnames[tag][0])
 *         if attr_list:             # <<<<<<<<<<<<<<
 *             write(''.join([f' {k}="{_escape_attrib_c14n(v)}"' for k, v in attr_list]))
 *         write('>')
*/
  {
    Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_v_attr_list);
    if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(6, 1123, __pyx_L1_error)
    __pyx_t_1 = (__pyx_temp != 0);
  }

  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1124
 *         write('<' + parsed_qnames[tag][0])
 *         if attr_list:
 *             write(''.join([f' {k}="{_escape_attrib_c14n(v)}"' for k, v in attr_list]))             # <<<<<<<<<<<<<<
 *         write('>')
 * 
*/
    __pyx_t_14 = NULL;
    __Pyx_INCREF(__pyx_v_write);
    __pyx_t_8 = __pyx_v_write; 
    { /* enter inner scope */
      __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 1124, __pyx_L54_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_9 = __pyx_v_attr_list; __Pyx_INCREF(__pyx_t_9);
      __pyx_t_6 = 0;
      for (;;) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_9);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(6, 1124, __pyx_L54_error)
          #endif
          if (__pyx_t_6 >= __pyx_temp) break;
        }
        __pyx_t_15 = __Pyx_PyList_GetItemRefFast(__pyx_t_9, __pyx_t_6, __Pyx_ReferenceSharing_OwnStrongReference);
        ++__pyx_t_6;
        if (unlikely(!__pyx_t_15)) __PYX_ERR(6, 1124, __pyx_L54_error)
        __Pyx_GOTREF(__pyx_t_15);
        if ((likely(PyTuple_CheckExact(__pyx_t_15))) || (PyList_CheckExact(__pyx_t_15))) {
          PyObject* sequence = __pyx_t_15;
          Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
          if (unlikely(size != 2)) {
            if (size > 2) __Pyx_RaiseTooManyValuesError(2);
            else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
            __PYX_ERR(6, 1124, __pyx_L54_error)
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          if (likely(PyTuple_CheckExact(sequence))) {
            __pyx_t_17 = PyTuple_GET_ITEM(sequence, 0);
            __Pyx_INCREF(__pyx_t_17);
            __pyx_t_18 = PyTuple_GET_ITEM(sequence, 1);
            __Pyx_INCREF(__pyx_t_18);
          } else {
            __pyx_t_17 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
            if (unlikely(!__pyx_t_17)) __PYX_ERR(6, 1124, __pyx_L54_error)
            __Pyx_XGOTREF(__pyx_t_17);
            __pyx_t_18 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
            if (unlikely(!__pyx_t_18)) __PYX_ERR(6, 1124, __pyx_L54_error)
            __Pyx_XGOTREF(__pyx_t_18);
          }
          #else
          __pyx_t_17 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_17)) __PYX_ERR(6, 1124, __pyx_L54_error)
          __Pyx_GOTREF(__pyx_t_17);
          __pyx_t_18 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_18)) __PYX_ERR(6, 1124, __pyx_L54_error)
          __Pyx_GOTREF(__pyx_t_18);
          #endif
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        } else {
          Py_ssize_t index = -1;
          __pyx_t_19 = PyObject_GetIter(__pyx_t_15); if (unlikely(!__pyx_t_19)) __PYX_ERR(6, 1124, __pyx_L54_error)
          __Pyx_GOTREF(__pyx_t_19);
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          __pyx_t_16 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_19);
          index = 0; __pyx_t_17 = __pyx_t_16(__pyx_t_19); if (unlikely(!__pyx_t_17)) goto __pyx_L57_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_17);
          index = 1; __pyx_t_18 = __pyx_t_16(__pyx_t_19); if (unlikely(!__pyx_t_18)) goto __pyx_L57_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_18);
          if (__Pyx_IternextUnpackEndCheck(__pyx_t_16(__pyx_t_19), 2) < (0)) __PYX_ERR(6, 1124, __pyx_L54_error)
          __pyx_t_16 = NULL;
          __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
          goto __pyx_L58_unpacking_done;
          __pyx_L57_unpacking_failed:;
          __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
          __pyx_t_16 = NULL;
          if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
          __PYX_ERR(6, 1124, __pyx_L54_error)
          __pyx_L58_unpacking_done:;
        }
        __Pyx_XDECREF_SET(__pyx_9genexpr15__pyx_v_k, __pyx_t_17);
        __pyx_t_17 = 0;
        __Pyx_XDECREF_SET(__pyx_9genexpr15__pyx_v_v, __pyx_t_18);
        __pyx_t_18 = 0;
        __pyx_t_15 = __Pyx_PyObject_FormatSimple(__pyx_9genexpr15__pyx_v_k, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_15)) __PYX_ERR(6, 1124, __pyx_L54_error)
        __Pyx_GOTREF(__pyx_t_15);
        __pyx_t_18 = __pyx_f_4lxml_5etree__escape_attrib_c14n(__pyx_9genexpr15__pyx_v_v); if (unlikely(!__pyx_t_18)) __PYX_ERR(6, 1124, __pyx_L54_error)
        __Pyx_GOTREF(__pyx_t_18);
        __pyx_t_17 = __Pyx_PyUnicode_Unicode(__pyx_t_18); if (unlikely(!__pyx_t_17)) __PYX_ERR(6, 1124, __pyx_L54_error)
        __Pyx_GOTREF(__pyx_t_17);
        __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
        __pyx_t_20[0] = __pyx_mstate_global->__pyx_kp_u__7;
        __pyx_t_20[1] = __pyx_t_15;
        __pyx_t_20[2] = __pyx_mstate_global->__pyx_kp_u__38;
        __pyx_t_20[3] = __pyx_t_17;
        __pyx_t_20[4] = __pyx_mstate_global->__pyx_kp_u__14;
        __pyx_t_18 = __Pyx_PyUnicode_Join(__pyx_t_20, 5, 1 * 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_15) + 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_17), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_15) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_17));
        if (unlikely(!__pyx_t_18)) __PYX_ERR(6, 1124, __pyx_L54_error)
        __Pyx_GOTREF(__pyx_t_18);
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_t_18))) __PYX_ERR(6, 1124, __pyx_L54_error)
        __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
      }
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_XDECREF(__pyx_9genexpr15__pyx_v_k); __pyx_9genexpr15__pyx_v_k = 0;
      __Pyx_XDECREF(__pyx_9genexpr15__pyx_v_v); __pyx_9genexpr15__pyx_v_v = 0;
      goto __pyx_L60_exit_scope;
      __pyx_L54_error:;
      __Pyx_XDECREF(__pyx_9genexpr15__pyx_v_k); __pyx_9genexpr15__pyx_v_k = 0;
      __Pyx_XDECREF(__pyx_9genexpr15__pyx_v_v); __pyx_9genexpr15__pyx_v_v = 0;
      goto __pyx_L1_error;
      __pyx_L60_exit_scope:;
    } /* exit inner scope */
    __pyx_t_9 = PyUnicode_Join(__pyx_mstate_global->__pyx_kp_u__8, __pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 1124, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_12 = 1;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_8);
      assert(__pyx_t_14);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_14);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_8, __pyx__function);
      __pyx_t_12 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_14, __pyx_t_9};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_8, __pyx_callargs+__pyx_t_12, (2-__pyx_t_12) | (__pyx_t_12*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1124, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":1123
 *         write = self._write
 *         write('<' + parsed_qnames[tag][0])
 *         if attr_list:             # <<<<<<<<<<<<<<
 *             write(''.join([f' {k}="{_escape_attrib_c14n(v)}"' for k, v in attr_list]))
 *         write('>')
*/
  }

  /* "src/lxml/serializer.pxi":1125
 *         if attr_list:
 *             write(''.join([f' {k}="{_escape_attrib_c14n(v)}"' for k, v in attr_list]))
 *         write('>')             # <<<<<<<<<<<<<<
 * 
 *         # Write the resolved qname text content.
*/
  __pyx_t_8 = NULL;
  __Pyx_INCREF(__pyx_v_write);
  __pyx_t_9 = __pyx_v_write; 
  __pyx_t_12 = 1;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_9))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_9);
    assert(__pyx_t_8);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_9);
    __Pyx_INCREF(__pyx_t_8);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_9, __pyx__function);
    __pyx_t_12 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_mstate_global->__pyx_kp_u__3};
    __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_9, __pyx_callargs+__pyx_t_12, (2-__pyx_t_12) | (__pyx_t_12*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1125, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/serializer.pxi":1128
 * 
 *         # Write the resolved qname text content.
 *         if qname_text is not None:             # <<<<<<<<<<<<<<
 *             write(_escape_cdata_c14n(parsed_qnames[resolved_names[qname_text]][0]))
 * 
*/
  __pyx_t_1 = (__pyx_v_qname_text != Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1129
 *         # Write the resolved qname text content.
 *         if qname_text is not None:
 *             write(_escape_cdata_c14n(parsed_qnames[resolved_names[qname_text]][0]))             # <<<<<<<<<<<<<<
 * 
 *         self._root_seen = True
*/
    __pyx_t_9 = NULL;
    __Pyx_INCREF(__pyx_v_write);
    __pyx_t_8 = __pyx_v_write; 
    __pyx_t_14 = __Pyx_PyDict_GetItem(__pyx_v_resolved_names, __pyx_v_qname_text); if (unlikely(!__pyx_t_14)) __PYX_ERR(6, 1129, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_4 = __Pyx_PyDict_GetItem(__pyx_v_parsed_qnames, __pyx_t_14); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 1129, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_14 = __Pyx_GetItemInt(__pyx_t_4, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_14)) __PYX_ERR(6, 1129, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __pyx_f_4lxml_5etree__escape_cdata_c14n(__pyx_t_14); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 1129, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_12 = 1;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
      assert(__pyx_t_9);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_8, __pyx__function);
      __pyx_t_12 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_t_4};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_8, __pyx_callargs+__pyx_t_12, (2-__pyx_t_12) | (__pyx_t_12*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1129, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":1128
 * 
 *         # Write the resolved qname text content.
 *         if qname_text is not None:             # <<<<<<<<<<<<<<
 *             write(_escape_cdata_c14n(parsed_qnames[resolved_names[qname_text]][0]))
 * 
*/
  }

  /* "src/lxml/serializer.pxi":1131
 *             write(_escape_cdata_c14n(parsed_qnames[resolved_names[qname_text]][0]))
 * 
 *         self._root_seen = True             # <<<<<<<<<<<<<<
 *         self._ns_stack.append([])
 * 
*/
  __pyx_v_self->_root_seen = 1;

  /* "src/lxml/serializer.pxi":1132
 * 
 *         self._root_seen = True
 *         self._ns_stack.append([])             # <<<<<<<<<<<<<<
 * 
 *     def end(self, tag):
*/
  if (unlikely(__pyx_v_self->_ns_stack == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
    __PYX_ERR(6, 1132, __pyx_L1_error)
  }
  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1132, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_self->_ns_stack, __pyx_t_3); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(6, 1132, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/serializer.pxi":1066
 *         self._start(tag, attrs, new_namespaces)
 * 
 *     cdef _start(self, tag, attrs, new_namespaces, qname_text=None):             # <<<<<<<<<<<<<<
 *         if self._exclude_attrs is not None and attrs:
 *             attrs = {k: v for k, v in attrs.items() if k not in self._exclude_attrs}
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_17);
  __Pyx_XDECREF(__pyx_t_18);
  __Pyx_XDECREF(__pyx_t_19);
  __Pyx_AddTraceback("lxml.etree.C14NWriterTarget._start", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_qnames);
  __Pyx_XDECREF(__pyx_v_resolved_names);
  __Pyx_XDECREF(__pyx_v_qname);
  __Pyx_XDECREF(__pyx_v_qattrs);
  __Pyx_XDECREF(__pyx_v_attr_name);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XDECREF(__pyx_v_parsed_qnames);
  __Pyx_XDECREF(__pyx_v_attr_list);
  __Pyx_XDECREF(__pyx_v_k);
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XDECREF(__pyx_v_attr_qname);
  __Pyx_XDECREF(__pyx_v_uri);
  __Pyx_XDECREF(__pyx_v_space_behaviour);
  __Pyx_XDECREF(__pyx_v_write);
  __Pyx_XDECREF(__pyx_9genexpr12__pyx_v_k);
  __Pyx_XDECREF(__pyx_9genexpr12__pyx_v_v);
  __Pyx_XDECREF(__pyx_9genexpr13__pyx_v_n);
  __Pyx_XDECREF(__pyx_9genexpr14__pyx_v_uri);
  __Pyx_XDECREF(__pyx_9genexpr14__pyx_v_prefix);
  __Pyx_XDECREF(__pyx_9genexpr15__pyx_v_k);
  __Pyx_XDECREF(__pyx_9genexpr15__pyx_v_v);
  __Pyx_XDECREF(__pyx_v_attrs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1134
 *         self._ns_stack.append([])
 * 
 *     def end(self, tag):             # <<<<<<<<<<<<<<
 *         if self._ignored_depth:
 *             self._ignored_depth -= 1
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_16C14NWriterTarget_12end(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_16C14NWriterTarget_12end = {"end", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_16C14NWriterTarget_12end, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_16C14NWriterTarget_12end(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_tag = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("end (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_tag,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(6, 1134, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 1134, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "end", 0) < (0)) __PYX_ERR(6, 1134, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("end", 1, 1, 1, i); __PYX_ERR(6, 1134, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 1134, __pyx_L3_error)
    }
    __pyx_v_tag = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("end", 1, 1, 1, __pyx_nargs); __PYX_ERR(6, 1134, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.C14NWriterTarget.end", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_16C14NWriterTarget_11end(((struct __pyx_obj_4lxml_5etree_C14NWriterTarget *)__pyx_v_self), __pyx_v_tag);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_16C14NWriterTarget_11end(struct __pyx_obj_4lxml_5etree_C14NWriterTarget *__pyx_v_self, PyObject *__pyx_v_tag) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7[3];
  size_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("end", 0);

  /* "src/lxml/serializer.pxi":1135
 * 
 *     def end(self, tag):
 *         if self._ignored_depth:             # <<<<<<<<<<<<<<
 *             self._ignored_depth -= 1
 *             return
*/
  __pyx_t_1 = (__pyx_v_self->_ignored_depth != 0);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1136
 *     def end(self, tag):
 *         if self._ignored_depth:
 *             self._ignored_depth -= 1             # <<<<<<<<<<<<<<
 *             return
 *         if self._data:
*/
    __pyx_v_self->_ignored_depth = (__pyx_v_self->_ignored_depth - 1);

    /* "src/lxml/serializer.pxi":1137
 *         if self._ignored_depth:
 *             self._ignored_depth -= 1
 *             return             # <<<<<<<<<<<<<<
 *         if self._data:
 *             self._flush()
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/serializer.pxi":1135
 * 
 *     def end(self, tag):
 *         if self._ignored_depth:             # <<<<<<<<<<<<<<
 *             self._ignored_depth -= 1
 *             return
*/
  }

  /* "src/lxml/serializer.pxi":1138
 *             self._ignored_depth -= 1
 *             return
 *         if self._data:             # <<<<<<<<<<<<<<
 *             self._flush()
 *         self._write(f'</{self._qname(tag)[0]}>')
*/
  if (__pyx_v_self->_data == Py_None) __pyx_t_1 = 0;
  else
  {
    Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_v_self->_data);
    if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(6, 1138, __pyx_L1_error)
    __pyx_t_1 = (__pyx_temp != 0);
  }

  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1139
 *             return
 *         if self._data:
 *             self._flush()             # <<<<<<<<<<<<<<
 *         self._write(f'</{self._qname(tag)[0]}>')
 *         self._preserve_space.pop()
*/
    __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree_C14NWriterTarget *)__pyx_v_self->__pyx_vtab)->_flush(__pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1139, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/serializer.pxi":1138
 *             self._ignored_depth -= 1
 *             return
 *         if self._data:             # <<<<<<<<<<<<<<
 *             self._flush()
 *         self._write(f'</{self._qname(tag)[0]}>')
*/
  }

  /* "src/lxml/serializer.pxi":1140
 *         if self._data:
 *             self._flush()
 *         self._write(f'</{self._qname(tag)[0]}>')             # <<<<<<<<<<<<<<
 *         self._preserve_space.pop()
 *         self._root_done = len(self._preserve_space) == 1
*/
  __pyx_t_3 = NULL;
  __Pyx_INCREF(__pyx_v_self->_write);
  __pyx_t_4 = __pyx_v_self->_write; 
  __pyx_t_5 = ((struct __pyx_vtabstruct_4lxml_5etree_C14NWriterTarget *)__pyx_v_self->__pyx_vtab)->_qname(__pyx_v_self, __pyx_v_tag, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 1140, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_5, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 1140, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_t_6, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 1140, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_7[0] = __pyx_mstate_global->__pyx_kp_u__39;
  __pyx_t_7[1] = __pyx_t_5;
  __pyx_t_7[2] = __pyx_mstate_global->__pyx_kp_u__3;
  __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_7, 3, 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5));
  if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 1140, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_8 = 1;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    assert(__pyx_t_3);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
    __pyx_t_8 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_6};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1140, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/serializer.pxi":1141
 *             self._flush()
 *         self._write(f'</{self._qname(tag)[0]}>')
 *         self._preserve_space.pop()             # <<<<<<<<<<<<<<
 *         self._root_done = len(self._preserve_space) == 1
 *         self._declared_ns_stack.pop()
*/
  if (unlikely(__pyx_v_self->_preserve_space == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "pop");
    __PYX_ERR(6, 1141, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyList_Pop(__pyx_v_self->_preserve_space); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1141, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/serializer.pxi":1142
 *         self._write(f'</{self._qname(tag)[0]}>')
 *         self._preserve_space.pop()
 *         self._root_done = len(self._preserve_space) == 1             # <<<<<<<<<<<<<<
 *         self._declared_ns_stack.pop()
 *         self._ns_stack.pop()
*/
  __pyx_t_2 = __pyx_v_self->_preserve_space;
  __Pyx_INCREF(__pyx_t_2);
  if (unlikely(__pyx_t_2 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(6, 1142, __pyx_L1_error)
  }
  __pyx_t_9 = __Pyx_PyList_GET_SIZE(__pyx_t_2); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(6, 1142, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_self->_root_done = (__pyx_t_9 == 1);

  /* "src/lxml/serializer.pxi":1143
 *         self._preserve_space.pop()
 *         self._root_done = len(self._preserve_space) == 1
 *         self._declared_ns_stack.pop()             # <<<<<<<<<<<<<<
 *         self._ns_stack.pop()
 * 
*/
  if (unlikely(__pyx_v_self->_declared_ns_stack == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "pop");
    __PYX_ERR(6, 1143, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyList_Pop(__pyx_v_self->_declared_ns_stack); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/serializer.pxi":1144
 *         self._root_done = len(self._preserve_space) == 1
 *         self._declared_ns_stack.pop()
 *         self._ns_stack.pop()             # <<<<<<<<<<<<<<
 * 
 *     def comment(self, text):
*/
  if (unlikely(__pyx_v_self->_ns_stack == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "pop");
    __PYX_ERR(6, 1144, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyList_Pop(__pyx_v_self->_ns_stack); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1144, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/serializer.pxi":1134
 *         self._ns_stack.append([])
 * 
 *     def end(self, tag):             # <<<<<<<<<<<<<<
 *         if self._ignored_depth:
 *             self._ignored_depth -= 1
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree.C14NWriterTarget.end", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1146
 *         self._ns_stack.pop()
 * 
 *     def comment(self, text):             # <<<<<<<<<<<<<<
 *         if not self._with_comments:
 *             return
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_16C14NWriterTarget_14comment(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_16C14NWriterTarget_14comment = {"comment", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_16C14NWriterTarget_14comment, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_16C14NWriterTarget_14comment(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_text = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("comment (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_text,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(6, 1146, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 1146, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "comment", 0) < (0)) __PYX_ERR(6, 1146, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("comment", 1, 1, 1, i); __PYX_ERR(6, 1146, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 1146, __pyx_L3_error)
    }
    __pyx_v_text = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("comment", 1, 1, 1, __pyx_nargs); __PYX_ERR(6, 1146, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.C14NWriterTarget.comment", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_16C14NWriterTarget_13comment(((struct __pyx_obj_4lxml_5etree_C14NWriterTarget *)__pyx_v_self), __pyx_v_text);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_16C14NWriterTarget_13comment(struct __pyx_obj_4lxml_5etree_C14NWriterTarget *__pyx_v_self, PyObject *__pyx_v_text) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9[3];
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("comment", 0);

  /* "src/lxml/serializer.pxi":1147
 * 
 *     def comment(self, text):
 *         if not self._with_comments:             # <<<<<<<<<<<<<<
 *             return
 *         if self._ignored_depth:
*/
  __pyx_t_1 = (!__pyx_v_self->_with_comments);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1148
 *     def comment(self, text):
 *         if not self._with_comments:
 *             return             # <<<<<<<<<<<<<<
 *         if self._ignored_depth:
 *             return
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/serializer.pxi":1147
 * 
 *     def comment(self, text):
 *         if not self._with_comments:             # <<<<<<<<<<<<<<
 *             return
 *         if self._ignored_depth:
*/
  }

  /* "src/lxml/serializer.pxi":1149
 *         if not self._with_comments:
 *             return
 *         if self._ignored_depth:             # <<<<<<<<<<<<<<
 *             return
 *         if self._root_done:
*/
  __pyx_t_1 = (__pyx_v_self->_ignored_depth != 0);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1150
 *             return
 *         if self._ignored_depth:
 *             return             # <<<<<<<<<<<<<<
 *         if self._root_done:
 *             self._write('\n')
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/serializer.pxi":1149
 *         if not self._with_comments:
 *             return
 *         if self._ignored_depth:             # <<<<<<<<<<<<<<
 *             return
 *         if self._root_done:
*/
  }

  /* "src/lxml/serializer.pxi":1151
 *         if self._ignored_depth:
 *             return
 *         if self._root_done:             # <<<<<<<<<<<<<<
 *             self._write('\n')
 *         elif self._root_seen and self._data:
*/
  if (__pyx_v_self->_root_done) {

    /* "src/lxml/serializer.pxi":1152
 *             return
 *         if self._root_done:
 *             self._write('\n')             # <<<<<<<<<<<<<<
 *         elif self._root_seen and self._data:
 *             self._flush()
*/
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_v_self->_write);
    __pyx_t_4 = __pyx_v_self->_write; 
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u__12};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1152, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/serializer.pxi":1151
 *         if self._ignored_depth:
 *             return
 *         if self._root_done:             # <<<<<<<<<<<<<<
 *             self._write('\n')
 *         elif self._root_seen and self._data:
*/
    goto __pyx_L5;
  }

  /* "src/lxml/serializer.pxi":1153
 *         if self._root_done:
 *             self._write('\n')
 *         elif self._root_seen and self._data:             # <<<<<<<<<<<<<<
 *             self._flush()
 *         self._write(f'<!--{_escape_cdata_c14n(text)}-->')
*/
  if (__pyx_v_self->_root_seen) {
  } else {
    __pyx_t_1 = __pyx_v_self->_root_seen;
    goto __pyx_L6_bool_binop_done;
  }
  if (__pyx_v_self->_data == Py_None) __pyx_t_6 = 0;
  else
  {
    Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_v_self->_data);
    if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(6, 1153, __pyx_L1_error)
    __pyx_t_6 = (__pyx_temp != 0);
  }

  __pyx_t_1 = __pyx_t_6;
  __pyx_L6_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1154
 *             self._write('\n')
 *         elif self._root_seen and self._data:
 *             self._flush()             # <<<<<<<<<<<<<<
 *         self._write(f'<!--{_escape_cdata_c14n(text)}-->')
 *         if not self._root_seen:
*/
    __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree_C14NWriterTarget *)__pyx_v_self->__pyx_vtab)->_flush(__pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1154, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/serializer.pxi":1153
 *         if self._root_done:
 *             self._write('\n')
 *         elif self._root_seen and self._data:             # <<<<<<<<<<<<<<
 *             self._flush()
 *         self._write(f'<!--{_escape_cdata_c14n(text)}-->')
*/
  }
  __pyx_L5:;

  /* "src/lxml/serializer.pxi":1155
 *         elif self._root_seen and self._data:
 *             self._flush()
 *         self._write(f'<!--{_escape_cdata_c14n(text)}-->')             # <<<<<<<<<<<<<<
 *         if not self._root_seen:
 *             self._write('\n')
*/
  __pyx_t_4 = NULL;
  __Pyx_INCREF(__pyx_v_self->_write);
  __pyx_t_3 = __pyx_v_self->_write; 
  __pyx_t_7 = __pyx_f_4lxml_5etree__escape_cdata_c14n(__pyx_v_text); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 1155, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = __Pyx_PyUnicode_Unicode(__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 1155, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_9[0] = __pyx_mstate_global->__pyx_kp_u__40;
  __pyx_t_9[1] = __pyx_t_8;
  __pyx_t_9[2] = __pyx_mstate_global->__pyx_kp_u__41;
  __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_9, 3, 4 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8) + 3, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8));
  if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 1155, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_5 = 1;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_4);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_5 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_7};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1155, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/serializer.pxi":1156
 *             self._flush()
 *         self._write(f'<!--{_escape_cdata_c14n(text)}-->')
 *         if not self._root_seen:             # <<<<<<<<<<<<<<
 *             self._write('\n')
 * 
*/
  __pyx_t_1 = (!__pyx_v_self->_root_seen);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1157
 *         self._write(f'<!--{_escape_cdata_c14n(text)}-->')
 *         if not self._root_seen:
 *             self._write('\n')             # <<<<<<<<<<<<<<
 * 
 *     def pi(self, target, data):
*/
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_v_self->_write);
    __pyx_t_7 = __pyx_v_self->_write; 
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u__12};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1157, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/serializer.pxi":1156
 *             self._flush()
 *         self._write(f'<!--{_escape_cdata_c14n(text)}-->')
 *         if not self._root_seen:             # <<<<<<<<<<<<<<
 *             self._write('\n')
 * 
*/
  }

  /* "src/lxml/serializer.pxi":1146
 *         self._ns_stack.pop()
 * 
 *     def comment(self, text):             # <<<<<<<<<<<<<<
 *         if not self._with_comments:
 *             return
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("lxml.etree.C14NWriterTarget.comment", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1159
 *             self._write('\n')
 * 
 *     def pi(self, target, data):             # <<<<<<<<<<<<<<
 *         if self._ignored_depth:
 *             return
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_16C14NWriterTarget_16pi(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_16C14NWriterTarget_16pi = {"pi", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_16C14NWriterTarget_16pi, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_16C14NWriterTarget_16pi(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_target = 0;
  PyObject *__pyx_v_data = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pi (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_target,&__pyx_mstate_global->__pyx_n_u_data,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(6, 1159, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(6, 1159, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 1159, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "pi", 0) < (0)) __PYX_ERR(6, 1159, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("pi", 1, 2, 2, i); __PYX_ERR(6, 1159, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 1159, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(6, 1159, __pyx_L3_error)
    }
    __pyx_v_target = values[0];
    __pyx_v_data = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pi", 1, 2, 2, __pyx_nargs); __PYX_ERR(6, 1159, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.C14NWriterTarget.pi", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_16C14NWriterTarget_15pi(((struct __pyx_obj_4lxml_5etree_C14NWriterTarget *)__pyx_v_self), __pyx_v_target, __pyx_v_data);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_16C14NWriterTarget_15pi(struct __pyx_obj_4lxml_5etree_C14NWriterTarget *__pyx_v_self, PyObject *__pyx_v_target, PyObject *__pyx_v_data) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11[5];
  PyObject *__pyx_t_12[3];
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("pi", 0);

  /* "src/lxml/serializer.pxi":1160
 * 
 *     def pi(self, target, data):
 *         if self._ignored_depth:             # <<<<<<<<<<<<<<
 *             return
 *         if self._root_done:
*/
  __pyx_t_1 = (__pyx_v_self->_ignored_depth != 0);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1161
 *     def pi(self, target, data):
 *         if self._ignored_depth:
 *             return             # <<<<<<<<<<<<<<
 *         if self._root_done:
 *             self._write('\n')
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/serializer.pxi":1160
 * 
 *     def pi(self, target, data):
 *         if self._ignored_depth:             # <<<<<<<<<<<<<<
 *             return
 *         if self._root_done:
*/
  }

  /* "src/lxml/serializer.pxi":1162
 *         if self._ignored_depth:
 *             return
 *         if self._root_done:             # <<<<<<<<<<<<<<
 *             self._write('\n')
 *         elif self._root_seen and self._data:
*/
  if (__pyx_v_self->_root_done) {

    /* "src/lxml/serializer.pxi":1163
 *             return
 *         if self._root_done:
 *             self._write('\n')             # <<<<<<<<<<<<<<
 *         elif self._root_seen and self._data:
 *             self._flush()
*/
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_v_self->_write);
    __pyx_t_4 = __pyx_v_self->_write; 
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u__12};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1163, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/serializer.pxi":1162
 *         if self._ignored_depth:
 *             return
 *         if self._root_done:             # <<<<<<<<<<<<<<
 *             self._write('\n')
 *         elif self._root_seen and self._data:
*/
    goto __pyx_L4;
  }

  /* "src/lxml/serializer.pxi":1164
 *         if self._root_done:
 *             self._write('\n')
 *         elif self._root_seen and self._data:             # <<<<<<<<<<<<<<
 *             self._flush()
 *         self._write(
*/
  if (__pyx_v_self->_root_seen) {
  } else {
    __pyx_t_1 = __pyx_v_self->_root_seen;
    goto __pyx_L5_bool_binop_done;
  }
  if (__pyx_v_self->_data == Py_None) __pyx_t_6 = 0;
  else
  {
    Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_v_self->_data);
    if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(6, 1164, __pyx_L1_error)
    __pyx_t_6 = (__pyx_temp != 0);
  }

  __pyx_t_1 = __pyx_t_6;
  __pyx_L5_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1165
 *             self._write('\n')
 *         elif self._root_seen and self._data:
 *             self._flush()             # <<<<<<<<<<<<<<
 *         self._write(
 *             f'<?{target} {_escape_cdata_c14n(data)}?>' if data else f'<?{target}?>')
*/
    __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree_C14NWriterTarget *)__pyx_v_self->__pyx_vtab)->_flush(__pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1165, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/serializer.pxi":1164
 *         if self._root_done:
 *             self._write('\n')
 *         elif self._root_seen and self._data:             # <<<<<<<<<<<<<<
 *             self._flush()
 *         self._write(
*/
  }
  __pyx_L4:;

  /* "src/lxml/serializer.pxi":1166
 *         elif self._root_seen and self._data:
 *             self._flush()
 *         self._write(             # <<<<<<<<<<<<<<
 *             f'<?{target} {_escape_cdata_c14n(data)}?>' if data else f'<?{target}?>')
 *         if not self._root_seen:
*/
  __pyx_t_4 = NULL;
  __Pyx_INCREF(__pyx_v_self->_write);
  __pyx_t_3 = __pyx_v_self->_write; 

  /* "src/lxml/serializer.pxi":1167
 *             self._flush()
 *         self._write(
 *             f'<?{target} {_escape_cdata_c14n(data)}?>' if data else f'<?{target}?>')             # <<<<<<<<<<<<<<
 *         if not self._root_seen:
 *             self._write('\n')
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_data); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(6, 1167, __pyx_L1_error)
  if (__pyx_t_1) {
    __pyx_t_8 = __Pyx_PyObject_FormatSimple(__pyx_v_target, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 1167, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = __pyx_f_4lxml_5etree__escape_cdata_c14n(__pyx_v_data); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 1167, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = __Pyx_PyUnicode_Unicode(__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(6, 1167, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_11[0] = __pyx_mstate_global->__pyx_kp_u__17;
    __pyx_t_11[1] = __pyx_t_8;
    __pyx_t_11[2] = __pyx_mstate_global->__pyx_kp_u__7;
    __pyx_t_11[3] = __pyx_t_10;
    __pyx_t_11[4] = __pyx_mstate_global->__pyx_kp_u__18;
    __pyx_t_9 = __Pyx_PyUnicode_Join(__pyx_t_11, 5, 2 * 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8) + 1 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_10), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_10));
    if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 1167, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_7 = __pyx_t_9;
    __pyx_t_9 = 0;
  } else {
    __pyx_t_9 = __Pyx_PyObject_FormatSimple(__pyx_v_target, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 1167, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_12[0] = __pyx_mstate_global->__pyx_kp_u__17;
    __pyx_t_12[1] = __pyx_t_9;
    __pyx_t_12[2] = __pyx_mstate_global->__pyx_kp_u__18;
    __pyx_t_10 = __Pyx_PyUnicode_Join(__pyx_t_12, 3, 2 * 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_9), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_9));
    if (unlikely(!__pyx_t_10)) __PYX_ERR(6, 1167, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_7 = __pyx_t_10;
    __pyx_t_10 = 0;
  }
  __pyx_t_5 = 1;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_4);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_5 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_7};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1166, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/serializer.pxi":1168
 *         self._write(
 *             f'<?{target} {_escape_cdata_c14n(data)}?>' if data else f'<?{target}?>')
 *         if not self._root_seen:             # <<<<<<<<<<<<<<
 *             self._write('\n')
 * 
*/
  __pyx_t_1 = (!__pyx_v_self->_root_seen);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1169
 *             f'<?{target} {_escape_cdata_c14n(data)}?>' if data else f'<?{target}?>')
 *         if not self._root_seen:
 *             self._write('\n')             # <<<<<<<<<<<<<<
 * 
 *     def close(self):
*/
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_v_self->_write);
    __pyx_t_7 = __pyx_v_self->_write; 
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u__12};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1169, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/serializer.pxi":1168
 *         self._write(
 *             f'<?{target} {_escape_cdata_c14n(data)}?>' if data else f'<?{target}?>')
 *         if not self._root_seen:             # <<<<<<<<<<<<<<
 *             self._write('\n')
 * 
*/
  }

  /* "src/lxml/serializer.pxi":1159
 *             self._write('\n')
 * 
 *     def pi(self, target, data):             # <<<<<<<<<<<<<<
 *         if self._ignored_depth:
 *             return
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("lxml.etree.C14NWriterTarget.pi", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1171
 *             self._write('\n')
 * 
 *     def close(self):             # <<<<<<<<<<<<<<
 *         return None
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_16C14NWriterTarget_18close(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_16C14NWriterTarget_18close = {"close", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_16C14NWriterTarget_18close, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_16C14NWriterTarget_18close(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("close (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("close", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("close", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_16C14NWriterTarget_17close(((struct __pyx_obj_4lxml_5etree_C14NWriterTarget *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_16C14NWriterTarget_17close(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree_C14NWriterTarget *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("close", 0);

  /* "src/lxml/serializer.pxi":1172
 * 
 *     def close(self):
 *         return None             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "src/lxml/serializer.pxi":1171
 *             self._write('\n')
 * 
 *     def close(self):             # <<<<<<<<<<<<<<
 *         return None
 * 
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1175
 * 
 * 
 * cdef _raise_serialization_error(text):             # <<<<<<<<<<<<<<
 *     raise TypeError("cannot serialize %r (type %s)" % (text, type(text).__name__))
 * 
*/

static PyObject *__pyx_f_4lxml_5etree__raise_serialization_error(PyObject *__pyx_v_text) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6[5];
  size_t __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_raise_serialization_error", 0);

  /* "src/lxml/serializer.pxi":1176
 * 
 * cdef _raise_serialization_error(text):
 *     raise TypeError("cannot serialize %r (type %s)" % (text, type(text).__name__))             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_2 = NULL;
  __pyx_t_3 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_text), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1176, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(__pyx_v_text)), __pyx_mstate_global->__pyx_n_u_name_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 1176, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_t_4), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 1176, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_6[0] = __pyx_mstate_global->__pyx_kp_u_cannot_serialize;
  __pyx_t_6[1] = __pyx_t_3;
  __pyx_t_6[2] = __pyx_mstate_global->__pyx_kp_u_type_2;
  __pyx_t_6[3] = __pyx_t_5;
  __pyx_t_6[4] = __pyx_mstate_global->__pyx_kp_u__5;
  __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_6, 5, 17 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 7 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5));
  if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 1176, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_7 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1176, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(6, 1176, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1175
 * 
 * 
 * cdef _raise_serialization_error(text):             # <<<<<<<<<<<<<<
 *     raise TypeError("cannot serialize %r (type %s)" % (text, type(text).__name__))
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._raise_serialization_error", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1179
 * 
 * 
 * cdef unicode _escape_cdata_c14n(stext):             # <<<<<<<<<<<<<<
 *     # escape character data
 *     cdef unicode text
*/

static PyObject *__pyx_f_4lxml_5etree__escape_cdata_c14n(PyObject *__pyx_v_stext) {
  PyObject *__pyx_v_text = 0;
  Py_UCS4 __pyx_v_ch;
  Py_ssize_t __pyx_v_start;
  Py_ssize_t __pyx_v_pos;
  PyObject *__pyx_v_substrings = 0;
  PyObject *__pyx_v_escape = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  Py_ssize_t __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  void *__pyx_t_13;
  int __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  int __pyx_t_16;
  int __pyx_t_17;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_escape_cdata_c14n", 0);

  /* "src/lxml/serializer.pxi":1183
 *     cdef unicode text
 *     cdef Py_UCS4 ch
 *     cdef Py_ssize_t start = 0, pos = 0             # <<<<<<<<<<<<<<
 *     cdef list substrings = None
 *     try:
*/
  __pyx_v_start = 0;
  __pyx_v_pos = 0;

  /* "src/lxml/serializer.pxi":1184
 *     cdef Py_UCS4 ch
 *     cdef Py_ssize_t start = 0, pos = 0
 *     cdef list substrings = None             # <<<<<<<<<<<<<<
 *     try:
 *         text = unicode(stext)
*/
  __Pyx_INCREF(Py_None);
  __pyx_v_substrings = ((PyObject*)Py_None);

  /* "src/lxml/serializer.pxi":1185
 *     cdef Py_ssize_t start = 0, pos = 0
 *     cdef list substrings = None
 *     try:             # <<<<<<<<<<<<<<
 *         text = unicode(stext)
 *     except (TypeError, AttributeError):
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "src/lxml/serializer.pxi":1186
 *     cdef list substrings = None
 *     try:
 *         text = unicode(stext)             # <<<<<<<<<<<<<<
 *     except (TypeError, AttributeError):
 *         return _raise_serialization_error(stext)
*/
      __pyx_t_4 = __Pyx_PyObject_Unicode(__pyx_v_stext); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 1186, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_v_text = ((PyObject*)__pyx_t_4);
      __pyx_t_4 = 0;

      /* "src/lxml/serializer.pxi":1185
 *     cdef Py_ssize_t start = 0, pos = 0
 *     cdef list substrings = None
 *     try:             # <<<<<<<<<<<<<<
 *         text = unicode(stext)
 *     except (TypeError, AttributeError):
*/
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "src/lxml/serializer.pxi":1187
 *     try:
 *         text = unicode(stext)
 *     except (TypeError, AttributeError):             # <<<<<<<<<<<<<<
 *         return _raise_serialization_error(stext)
 * 
*/
    __pyx_t_5 = __Pyx_PyErr_ExceptionMatches2(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), ((PyObject *)(((PyTypeObject*)PyExc_AttributeError))));
    if (__pyx_t_5) {
      __Pyx_AddTraceback("lxml.etree._escape_cdata_c14n", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(6, 1187, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);

      /* "src/lxml/serializer.pxi":1188
 *         text = unicode(stext)
 *     except (TypeError, AttributeError):
 *         return _raise_serialization_error(stext)             # <<<<<<<<<<<<<<
 * 
 *     for pos, ch in enumerate(text):
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_8 = __pyx_f_4lxml_5etree__raise_serialization_error(__pyx_v_stext); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 1188, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (!(likely(PyUnicode_CheckExact(__pyx_t_8))||((__pyx_t_8) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_8))) __PYX_ERR(6, 1188, __pyx_L5_except_error)
      __pyx_r = ((PyObject*)__pyx_t_8);
      __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L6_except_return;
    }
    goto __pyx_L5_except_error;

    /* "src/lxml/serializer.pxi":1185
 *     cdef Py_ssize_t start = 0, pos = 0
 *     cdef list substrings = None
 *     try:             # <<<<<<<<<<<<<<
 *         text = unicode(stext)
 *     except (TypeError, AttributeError):
*/
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L8_try_end:;
  }

  /* "src/lxml/serializer.pxi":1190
 *         return _raise_serialization_error(stext)
 * 
 *     for pos, ch in enumerate(text):             # <<<<<<<<<<<<<<
 *         if ch == '&':
 *             escape = '&amp;'
*/
  __pyx_t_9 = 0;
  __Pyx_INCREF(__pyx_v_text);
  __pyx_t_10 = __pyx_v_text;
  __pyx_t_14 = __Pyx_init_unicode_iteration(__pyx_t_10, (&__pyx_t_12), (&__pyx_t_13), (&__pyx_t_5)); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(6, 1190, __pyx_L1_error)
  for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_12; __pyx_t_15++) {
    __pyx_t_11 = __pyx_t_15;
    __pyx_v_ch = __Pyx_PyUnicode_READ(__pyx_t_5, __pyx_t_13, __pyx_t_11);

    /* "src/lxml/serializer.pxi":1191
 * 
 *     for pos, ch in enumerate(text):
 *         if ch == '&':             # <<<<<<<<<<<<<<
 *             escape = '&amp;'
 *         elif ch == '<':
*/
    __pyx_v_pos = __pyx_t_9;

    /* "src/lxml/serializer.pxi":1190
 *         return _raise_serialization_error(stext)
 * 
 *     for pos, ch in enumerate(text):             # <<<<<<<<<<<<<<
 *         if ch == '&':
 *             escape = '&amp;'
*/
    __pyx_t_9 = (__pyx_t_9 + 1);

    /* "src/lxml/serializer.pxi":1191
 * 
 *     for pos, ch in enumerate(text):
 *         if ch == '&':             # <<<<<<<<<<<<<<
 *             escape = '&amp;'
 *         elif ch == '<':
*/
    switch (__pyx_v_ch) {
      case 38:

      /* "src/lxml/serializer.pxi":1192
 *     for pos, ch in enumerate(text):
 *         if ch == '&':
 *             escape = '&amp;'             # <<<<<<<<<<<<<<
 *         elif ch == '<':
 *             escape = '&lt;'
*/
      __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_amp);
      __Pyx_XDECREF_SET(__pyx_v_escape, __pyx_mstate_global->__pyx_kp_u_amp);

      /* "src/lxml/serializer.pxi":1191
 * 
 *     for pos, ch in enumerate(text):
 *         if ch == '&':             # <<<<<<<<<<<<<<
 *             escape = '&amp;'
 *         elif ch == '<':
*/
      break;
      case 60:

      /* "src/lxml/serializer.pxi":1194
 *             escape = '&amp;'
 *         elif ch == '<':
 *             escape = '&lt;'             # <<<<<<<<<<<<<<
 *         elif ch == '>':
 *             escape = '&gt;'
*/
      __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_lt);
      __Pyx_XDECREF_SET(__pyx_v_escape, __pyx_mstate_global->__pyx_kp_u_lt);

      /* "src/lxml/serializer.pxi":1193
 *         if ch == '&':
 *             escape = '&amp;'
 *         elif ch == '<':             # <<<<<<<<<<<<<<
 *             escape = '&lt;'
 *         elif ch == '>':
*/
      break;
      case 62:

      /* "src/lxml/serializer.pxi":1196
 *             escape = '&lt;'
 *         elif ch == '>':
 *             escape = '&gt;'             # <<<<<<<<<<<<<<
 *         elif ch == '\r':
 *             escape = '&#xD;'
*/
      __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_gt);
      __Pyx_XDECREF_SET(__pyx_v_escape, __pyx_mstate_global->__pyx_kp_u_gt);

      /* "src/lxml/serializer.pxi":1195
 *         elif ch == '<':
 *             escape = '&lt;'
 *         elif ch == '>':             # <<<<<<<<<<<<<<
 *             escape = '&gt;'
 *         elif ch == '\r':
*/
      break;
      case 13:

      /* "src/lxml/serializer.pxi":1198
 *             escape = '&gt;'
 *         elif ch == '\r':
 *             escape = '&#xD;'             # <<<<<<<<<<<<<<
 *         else:
 *             continue
*/
      __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_xD);
      __Pyx_XDECREF_SET(__pyx_v_escape, __pyx_mstate_global->__pyx_kp_u_xD);

      /* "src/lxml/serializer.pxi":1197
 *         elif ch == '>':
 *             escape = '&gt;'
 *         elif ch == '\r':             # <<<<<<<<<<<<<<
 *             escape = '&#xD;'
 *         else:
*/
      break;
      default:

      /* "src/lxml/serializer.pxi":1200
 *             escape = '&#xD;'
 *         else:
 *             continue             # <<<<<<<<<<<<<<
 * 
 *         if substrings is None:
*/
      goto __pyx_L11_continue;
      break;
    }

    /* "src/lxml/serializer.pxi":1202
 *             continue
 * 
 *         if substrings is None:             # <<<<<<<<<<<<<<
 *             substrings = []
 *         if pos > start:
*/
    __pyx_t_16 = (__pyx_v_substrings == ((PyObject*)Py_None));
    if (__pyx_t_16) {

      /* "src/lxml/serializer.pxi":1203
 * 
 *         if substrings is None:
 *             substrings = []             # <<<<<<<<<<<<<<
 *         if pos > start:
 *             substrings.append(text[start:pos])
*/
      __pyx_t_7 = PyList_New(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 1203, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF_SET(__pyx_v_substrings, ((PyObject*)__pyx_t_7));
      __pyx_t_7 = 0;

      /* "src/lxml/serializer.pxi":1202
 *             continue
 * 
 *         if substrings is None:             # <<<<<<<<<<<<<<
 *             substrings = []
 *         if pos > start:
*/
    }

    /* "src/lxml/serializer.pxi":1204
 *         if substrings is None:
 *             substrings = []
 *         if pos > start:             # <<<<<<<<<<<<<<
 *             substrings.append(text[start:pos])
 *         substrings.append(escape)
*/
    __pyx_t_16 = (__pyx_v_pos > __pyx_v_start);
    if (__pyx_t_16) {

      /* "src/lxml/serializer.pxi":1205
 *             substrings = []
 *         if pos > start:
 *             substrings.append(text[start:pos])             # <<<<<<<<<<<<<<
 *         substrings.append(escape)
 *         start = pos + 1
*/
      if (unlikely(__pyx_v_substrings == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
        __PYX_ERR(6, 1205, __pyx_L1_error)
      }
      __pyx_t_7 = __Pyx_PyUnicode_Substring(__pyx_v_text, __pyx_v_start, __pyx_v_pos); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 1205, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_17 = __Pyx_PyList_Append(__pyx_v_substrings, __pyx_t_7); if (unlikely(__pyx_t_17 == ((int)-1))) __PYX_ERR(6, 1205, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "src/lxml/serializer.pxi":1204
 *         if substrings is None:
 *             substrings = []
 *         if pos > start:             # <<<<<<<<<<<<<<
 *             substrings.append(text[start:pos])
 *         substrings.append(escape)
*/
    }

    /* "src/lxml/serializer.pxi":1206
 *         if pos > start:
 *             substrings.append(text[start:pos])
 *         substrings.append(escape)             # <<<<<<<<<<<<<<
 *         start = pos + 1
 * 
*/
    if (unlikely(__pyx_v_substrings == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
      __PYX_ERR(6, 1206, __pyx_L1_error)
    }
    __pyx_t_17 = __Pyx_PyList_Append(__pyx_v_substrings, __pyx_v_escape); if (unlikely(__pyx_t_17 == ((int)-1))) __PYX_ERR(6, 1206, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":1207
 *             substrings.append(text[start:pos])
 *         substrings.append(escape)
 *         start = pos + 1             # <<<<<<<<<<<<<<
 * 
 *     if substrings is None:
*/
    __pyx_v_start = (__pyx_v_pos + 1);
    __pyx_L11_continue:;
  }
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

  /* "src/lxml/serializer.pxi":1209
 *         start = pos + 1
 * 
 *     if substrings is None:             # <<<<<<<<<<<<<<
 *         return text
 *     if pos >= start:
*/
  __pyx_t_16 = (__pyx_v_substrings == ((PyObject*)Py_None));
  if (__pyx_t_16) {

    /* "src/lxml/serializer.pxi":1210
 * 
 *     if substrings is None:
 *         return text             # <<<<<<<<<<<<<<
 *     if pos >= start:
 *         substrings.append(text[start:pos+1])
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_text);
    __pyx_r = __pyx_v_text;
    goto __pyx_L0;

    /* "src/lxml/serializer.pxi":1209
 *         start = pos + 1
 * 
 *     if substrings is None:             # <<<<<<<<<<<<<<
 *         return text
 *     if pos >= start:
*/
  }

  /* "src/lxml/serializer.pxi":1211
 *     if substrings is None:
 *         return text
 *     if pos >= start:             # <<<<<<<<<<<<<<
 *         substrings.append(text[start:pos+1])
 *     return ''.join(substrings)
*/
  __pyx_t_16 = (__pyx_v_pos >= __pyx_v_start);
  if (__pyx_t_16) {

    /* "src/lxml/serializer.pxi":1212
 *         return text
 *     if pos >= start:
 *         substrings.append(text[start:pos+1])             # <<<<<<<<<<<<<<
 *     return ''.join(substrings)
 * 
*/
    if (unlikely(__pyx_v_substrings == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
      __PYX_ERR(6, 1212, __pyx_L1_error)
    }
    __pyx_t_7 = __Pyx_PyUnicode_Substring(__pyx_v_text, __pyx_v_start, (__pyx_v_pos + 1)); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 1212, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_17 = __Pyx_PyList_Append(__pyx_v_substrings, __pyx_t_7); if (unlikely(__pyx_t_17 == ((int)-1))) __PYX_ERR(6, 1212, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "src/lxml/serializer.pxi":1211
 *     if substrings is None:
 *         return text
 *     if pos >= start:             # <<<<<<<<<<<<<<
 *         substrings.append(text[start:pos+1])
 *     return ''.join(substrings)
*/
  }

  /* "src/lxml/serializer.pxi":1213
 *     if pos >= start:
 *         substrings.append(text[start:pos+1])
 *     return ''.join(substrings)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_7 = PyUnicode_Join(__pyx_mstate_global->__pyx_kp_u__8, __pyx_v_substrings); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 1213, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_r = ((PyObject*)__pyx_t_7);
  __pyx_t_7 = 0;
  goto __pyx_L0;

  /* "src/lxml/serializer.pxi":1179
 * 
 * 
 * cdef unicode _escape_cdata_c14n(stext):             # <<<<<<<<<<<<<<
 *     # escape character data
 *     cdef unicode text
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("lxml.etree._escape_cdata_c14n", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_text);
  __Pyx_XDECREF(__pyx_v_substrings);
  __Pyx_XDECREF(__pyx_v_escape);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1216
 * 
 * 
 * cdef unicode _escape_attrib_c14n(stext):             # <<<<<<<<<<<<<<
 *     # escape attribute value
 *     cdef unicode text
*/

static PyObject *__pyx_f_4lxml_5etree__escape_attrib_c14n(PyObject *__pyx_v_stext) {
  PyObject *__pyx_v_text = 0;
  Py_UCS4 __pyx_v_ch;
  Py_ssize_t __pyx_v_start;
  Py_ssize_t __pyx_v_pos;
  PyObject *__pyx_v_substrings = 0;
  PyObject *__pyx_v_escape = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  Py_ssize_t __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  void *__pyx_t_13;
  int __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  int __pyx_t_16;
  int __pyx_t_17;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_escape_attrib_c14n", 0);

  /* "src/lxml/serializer.pxi":1220
 *     cdef unicode text
 *     cdef Py_UCS4 ch
 *     cdef Py_ssize_t start = 0, pos = 0             # <<<<<<<<<<<<<<
 *     cdef list substrings = None
 *     try:
*/
  __pyx_v_start = 0;
  __pyx_v_pos = 0;

  /* "src/lxml/serializer.pxi":1221
 *     cdef Py_UCS4 ch
 *     cdef Py_ssize_t start = 0, pos = 0
 *     cdef list substrings = None             # <<<<<<<<<<<<<<
 *     try:
 *         text = unicode(stext)
*/
  __Pyx_INCREF(Py_None);
  __pyx_v_substrings = ((PyObject*)Py_None);

  /* "src/lxml/serializer.pxi":1222
 *     cdef Py_ssize_t start = 0, pos = 0
 *     cdef list substrings = None
 *     try:             # <<<<<<<<<<<<<<
 *         text = unicode(stext)
 *     except (TypeError, AttributeError):
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "src/lxml/serializer.pxi":1223
 *     cdef list substrings = None
 *     try:
 *         text = unicode(stext)             # <<<<<<<<<<<<<<
 *     except (TypeError, AttributeError):
 *         return _raise_serialization_error(stext)
*/
      __pyx_t_4 = __Pyx_PyObject_Unicode(__pyx_v_stext); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 1223, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_v_text = ((PyObject*)__pyx_t_4);
      __pyx_t_4 = 0;

      /* "src/lxml/serializer.pxi":1222
 *     cdef Py_ssize_t start = 0, pos = 0
 *     cdef list substrings = None
 *     try:             # <<<<<<<<<<<<<<
 *         text = unicode(stext)
 *     except (TypeError, AttributeError):
*/
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "src/lxml/serializer.pxi":1224
 *     try:
 *         text = unicode(stext)
 *     except (TypeError, AttributeError):             # <<<<<<<<<<<<<<
 *         return _raise_serialization_error(stext)
 * 
*/
    __pyx_t_5 = __Pyx_PyErr_ExceptionMatches2(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), ((PyObject *)(((PyTypeObject*)PyExc_AttributeError))));
    if (__pyx_t_5) {
      __Pyx_AddTraceback("lxml.etree._escape_attrib_c14n", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(6, 1224, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);

      /* "src/lxml/serializer.pxi":1225
 *         text = unicode(stext)
 *     except (TypeError, AttributeError):
 *         return _raise_serialization_error(stext)             # <<<<<<<<<<<<<<
 * 
 *     for pos, ch in enumerate(text):
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_8 = __pyx_f_4lxml_5etree__raise_serialization_error(__pyx_v_stext); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 1225, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (!(likely(PyUnicode_CheckExact(__pyx_t_8))||((__pyx_t_8) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_8))) __PYX_ERR(6, 1225, __pyx_L5_except_error)
      __pyx_r = ((PyObject*)__pyx_t_8);
      __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L6_except_return;
    }
    goto __pyx_L5_except_error;

    /* "src/lxml/serializer.pxi":1222
 *     cdef Py_ssize_t start = 0, pos = 0
 *     cdef list substrings = None
 *     try:             # <<<<<<<<<<<<<<
 *         text = unicode(stext)
 *     except (TypeError, AttributeError):
*/
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L8_try_end:;
  }

  /* "src/lxml/serializer.pxi":1227
 *         return _raise_serialization_error(stext)
 * 
 *     for pos, ch in enumerate(text):             # <<<<<<<<<<<<<<
 *         if ch == '&':
 *             escape = '&amp;'
*/
  __pyx_t_9 = 0;
  __Pyx_INCREF(__pyx_v_text);
  __pyx_t_10 = __pyx_v_text;
  __pyx_t_14 = __Pyx_init_unicode_iteration(__pyx_t_10, (&__pyx_t_12), (&__pyx_t_13), (&__pyx_t_5)); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(6, 1227, __pyx_L1_error)
  for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_12; __pyx_t_15++) {
    __pyx_t_11 = __pyx_t_15;
    __pyx_v_ch = __Pyx_PyUnicode_READ(__pyx_t_5, __pyx_t_13, __pyx_t_11);

    /* "src/lxml/serializer.pxi":1228
 * 
 *     for pos, ch in enumerate(text):
 *         if ch == '&':             # <<<<<<<<<<<<<<
 *             escape = '&amp;'
 *         elif ch == '<':
*/
    __pyx_v_pos = __pyx_t_9;

    /* "src/lxml/serializer.pxi":1227
 *         return _raise_serialization_error(stext)
 * 
 *     for pos, ch in enumerate(text):             # <<<<<<<<<<<<<<
 *         if ch == '&':
 *             escape = '&amp;'
*/
    __pyx_t_9 = (__pyx_t_9 + 1);

    /* "src/lxml/serializer.pxi":1228
 * 
 *     for pos, ch in enumerate(text):
 *         if ch == '&':             # <<<<<<<<<<<<<<
 *             escape = '&amp;'
 *         elif ch == '<':
*/
    switch (__pyx_v_ch) {
      case 38:

      /* "src/lxml/serializer.pxi":1229
 *     for pos, ch in enumerate(text):
 *         if ch == '&':
 *             escape = '&amp;'             # <<<<<<<<<<<<<<
 *         elif ch == '<':
 *             escape = '&lt;'
*/
      __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_amp);
      __Pyx_XDECREF_SET(__pyx_v_escape, __pyx_mstate_global->__pyx_kp_u_amp);

      /* "src/lxml/serializer.pxi":1228
 * 
 *     for pos, ch in enumerate(text):
 *         if ch == '&':             # <<<<<<<<<<<<<<
 *             escape = '&amp;'
 *         elif ch == '<':
*/
      break;
      case 60:

      /* "src/lxml/serializer.pxi":1231
 *             escape = '&amp;'
 *         elif ch == '<':
 *             escape = '&lt;'             # <<<<<<<<<<<<<<
 *         elif ch == '"':
 *             escape = '&quot;'
*/
      __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_lt);
      __Pyx_XDECREF_SET(__pyx_v_escape, __pyx_mstate_global->__pyx_kp_u_lt);

      /* "src/lxml/serializer.pxi":1230
 *         if ch == '&':
 *             escape = '&amp;'
 *         elif ch == '<':             # <<<<<<<<<<<<<<
 *             escape = '&lt;'
 *         elif ch == '"':
*/
      break;
      case 34:

      /* "src/lxml/serializer.pxi":1233
 *             escape = '&lt;'
 *         elif ch == '"':
 *             escape = '&quot;'             # <<<<<<<<<<<<<<
 *         elif ch == '\t':
 *             escape = '&#x9;'
*/
      __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_quot);
      __Pyx_XDECREF_SET(__pyx_v_escape, __pyx_mstate_global->__pyx_kp_u_quot);

      /* "src/lxml/serializer.pxi":1232
 *         elif ch == '<':
 *             escape = '&lt;'
 *         elif ch == '"':             # <<<<<<<<<<<<<<
 *             escape = '&quot;'
 *         elif ch == '\t':
*/
      break;
      case 9:

      /* "src/lxml/serializer.pxi":1235
 *             escape = '&quot;'
 *         elif ch == '\t':
 *             escape = '&#x9;'             # <<<<<<<<<<<<<<
 *         elif ch == '\n':
 *             escape = '&#xA;'
*/
      __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_x9);
      __Pyx_XDECREF_SET(__pyx_v_escape, __pyx_mstate_global->__pyx_kp_u_x9);

      /* "src/lxml/serializer.pxi":1234
 *         elif ch == '"':
 *             escape = '&quot;'
 *         elif ch == '\t':             # <<<<<<<<<<<<<<
 *             escape = '&#x9;'
 *         elif ch == '\n':
*/
      break;
      case 10:

      /* "src/lxml/serializer.pxi":1237
 *             escape = '&#x9;'
 *         elif ch == '\n':
 *             escape = '&#xA;'             # <<<<<<<<<<<<<<
 *         elif ch == '\r':
 *             escape = '&#xD;'
*/
      __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_xA);
      __Pyx_XDECREF_SET(__pyx_v_escape, __pyx_mstate_global->__pyx_kp_u_xA);

      /* "src/lxml/serializer.pxi":1236
 *         elif ch == '\t':
 *             escape = '&#x9;'
 *         elif ch == '\n':             # <<<<<<<<<<<<<<
 *             escape = '&#xA;'
 *         elif ch == '\r':
*/
      break;
      case 13:

      /* "src/lxml/serializer.pxi":1239
 *             escape = '&#xA;'
 *         elif ch == '\r':
 *             escape = '&#xD;'             # <<<<<<<<<<<<<<
 *         else:
 *             continue
*/
      __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_xD);
      __Pyx_XDECREF_SET(__pyx_v_escape, __pyx_mstate_global->__pyx_kp_u_xD);

      /* "src/lxml/serializer.pxi":1238
 *         elif ch == '\n':
 *             escape = '&#xA;'
 *         elif ch == '\r':             # <<<<<<<<<<<<<<
 *             escape = '&#xD;'
 *         else:
*/
      break;
      default:

      /* "src/lxml/serializer.pxi":1241
 *             escape = '&#xD;'
 *         else:
 *             continue             # <<<<<<<<<<<<<<
 * 
 *         if substrings is None:
*/
      goto __pyx_L11_continue;
      break;
    }

    /* "src/lxml/serializer.pxi":1243
 *             continue
 * 
 *         if substrings is None:             # <<<<<<<<<<<<<<
 *             substrings = []
 *         if pos > start:
*/
    __pyx_t_16 = (__pyx_v_substrings == ((PyObject*)Py_None));
    if (__pyx_t_16) {

      /* "src/lxml/serializer.pxi":1244
 * 
 *         if substrings is None:
 *             substrings = []             # <<<<<<<<<<<<<<
 *         if pos > start:
 *             substrings.append(text[start:pos])
*/
      __pyx_t_7 = PyList_New(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 1244, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF_SET(__pyx_v_substrings, ((PyObject*)__pyx_t_7));
      __pyx_t_7 = 0;

      /* "src/lxml/serializer.pxi":1243
 *             continue
 * 
 *         if substrings is None:             # <<<<<<<<<<<<<<
 *             substrings = []
 *         if pos > start:
*/
    }

    /* "src/lxml/serializer.pxi":1245
 *         if substrings is None:
 *             substrings = []
 *         if pos > start:             # <<<<<<<<<<<<<<
 *             substrings.append(text[start:pos])
 *         substrings.append(escape)
*/
    __pyx_t_16 = (__pyx_v_pos > __pyx_v_start);
    if (__pyx_t_16) {

      /* "src/lxml/serializer.pxi":1246
 *             substrings = []
 *         if pos > start:
 *             substrings.append(text[start:pos])             # <<<<<<<<<<<<<<
 *         substrings.append(escape)
 *         start = pos + 1
*/
      if (unlikely(__pyx_v_substrings == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
        __PYX_ERR(6, 1246, __pyx_L1_error)
      }
      __pyx_t_7 = __Pyx_PyUnicode_Substring(__pyx_v_text, __pyx_v_start, __pyx_v_pos); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 1246, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_17 = __Pyx_PyList_Append(__pyx_v_substrings, __pyx_t_7); if (unlikely(__pyx_t_17 == ((int)-1))) __PYX_ERR(6, 1246, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "src/lxml/serializer.pxi":1245
 *         if substrings is None:
 *             substrings = []
 *         if pos > start:             # <<<<<<<<<<<<<<
 *             substrings.append(text[start:pos])
 *         substrings.append(escape)
*/
    }

    /* "src/lxml/serializer.pxi":1247
 *         if pos > start:
 *             substrings.append(text[start:pos])
 *         substrings.append(escape)             # <<<<<<<<<<<<<<
 *         start = pos + 1
 * 
*/
    if (unlikely(__pyx_v_substrings == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
      __PYX_ERR(6, 1247, __pyx_L1_error)
    }
    __pyx_t_17 = __Pyx_PyList_Append(__pyx_v_substrings, __pyx_v_escape); if (unlikely(__pyx_t_17 == ((int)-1))) __PYX_ERR(6, 1247, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":1248
 *             substrings.append(text[start:pos])
 *         substrings.append(escape)
 *         start = pos + 1             # <<<<<<<<<<<<<<
 * 
 *     if substrings is None:
*/
    __pyx_v_start = (__pyx_v_pos + 1);
    __pyx_L11_continue:;
  }
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

  /* "src/lxml/serializer.pxi":1250
 *         start = pos + 1
 * 
 *     if substrings is None:             # <<<<<<<<<<<<<<
 *         return text
 *     if pos >= start:
*/
  __pyx_t_16 = (__pyx_v_substrings == ((PyObject*)Py_None));
  if (__pyx_t_16) {

    /* "src/lxml/serializer.pxi":1251
 * 
 *     if substrings is None:
 *         return text             # <<<<<<<<<<<<<<
 *     if pos >= start:
 *         substrings.append(text[start:pos+1])
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_text);
    __pyx_r = __pyx_v_text;
    goto __pyx_L0;

    /* "src/lxml/serializer.pxi":1250
 *         start = pos + 1
 * 
 *     if substrings is None:             # <<<<<<<<<<<<<<
 *         return text
 *     if pos >= start:
*/
  }

  /* "src/lxml/serializer.pxi":1252
 *     if substrings is None:
 *         return text
 *     if pos >= start:             # <<<<<<<<<<<<<<
 *         substrings.append(text[start:pos+1])
 *     return ''.join(substrings)
*/
  __pyx_t_16 = (__pyx_v_pos >= __pyx_v_start);
  if (__pyx_t_16) {

    /* "src/lxml/serializer.pxi":1253
 *         return text
 *     if pos >= start:
 *         substrings.append(text[start:pos+1])             # <<<<<<<<<<<<<<
 *     return ''.join(substrings)
 * 
*/
    if (unlikely(__pyx_v_substrings == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
      __PYX_ERR(6, 1253, __pyx_L1_error)
    }
    __pyx_t_7 = __Pyx_PyUnicode_Substring(__pyx_v_text, __pyx_v_start, (__pyx_v_pos + 1)); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 1253, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_17 = __Pyx_PyList_Append(__pyx_v_substrings, __pyx_t_7); if (unlikely(__pyx_t_17 == ((int)-1))) __PYX_ERR(6, 1253, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "src/lxml/serializer.pxi":1252
 *     if substrings is None:
 *         return text
 *     if pos >= start:             # <<<<<<<<<<<<<<
 *         substrings.append(text[start:pos+1])
 *     return ''.join(substrings)
*/
  }

  /* "src/lxml/serializer.pxi":1254
 *     if pos >= start:
 *         substrings.append(text[start:pos+1])
 *     return ''.join(substrings)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_7 = PyUnicode_Join(__pyx_mstate_global->__pyx_kp_u__8, __pyx_v_substrings); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 1254, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_r = ((PyObject*)__pyx_t_7);
  __pyx_t_7 = 0;
  goto __pyx_L0;

  /* "src/lxml/serializer.pxi":1216
 * 
 * 
 * cdef unicode _escape_attrib_c14n(stext):             # <<<<<<<<<<<<<<
 *     # escape attribute value
 *     cdef unicode text
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("lxml.etree._escape_attrib_c14n", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_text);
  __Pyx_XDECREF(__pyx_v_substrings);
  __Pyx_XDECREF(__pyx_v_escape);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1304
 *     cdef int method
 * 
 *     def __init__(self, output_file not None, encoding=None, compression=None,             # <<<<<<<<<<<<<<
 *                  close=False, buffered=True):
 *         self.output_file = output_file
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_7xmlfile_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_7xmlfile_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_output_file = 0;
  PyObject *__pyx_v_encoding = 0;
  PyObject *__pyx_v_compression = 0;
  PyObject *__pyx_v_close = 0;
  PyObject *__pyx_v_buffered = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[5] = {0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_output_file,&__pyx_mstate_global->__pyx_n_u_encoding,&__pyx_mstate_global->__pyx_n_u_compression,&__pyx_mstate_global->__pyx_n_u_close,&__pyx_mstate_global->__pyx_n_u_buffered,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(6, 1304, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  5:
        values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(6, 1304, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(6, 1304, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(6, 1304, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(6, 1304, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 1304, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(6, 1304, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "src/lxml/serializer.pxi":1305
 * 
 *     def __init__(self, output_file not None, encoding=None, compression=None,
 *                  close=False, buffered=True):             # <<<<<<<<<<<<<<
 *         self.output_file = output_file
 *         self.encoding = _utf8orNone(encoding)
*/
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_True));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 5, i); __PYX_ERR(6, 1304, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  5:
        values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(6, 1304, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(6, 1304, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(6, 1304, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(6, 1304, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 1304, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }

      /* "src/lxml/serializer.pxi":1304
 *     cdef int method
 * 
 *     def __init__(self, output_file not None, encoding=None, compression=None,             # <<<<<<<<<<<<<<
 *                  close=False, buffered=True):
 *         self.output_file = output_file
*/
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "src/lxml/serializer.pxi":1305
 * 
 *     def __init__(self, output_file not None, encoding=None, compression=None,
 *                  close=False, buffered=True):             # <<<<<<<<<<<<<<
 *         self.output_file = output_file
 *         self.encoding = _utf8orNone(encoding)
*/
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_True));
    }
    __pyx_v_output_file = values[0];
    __pyx_v_encoding = values[1];
    __pyx_v_compression = values[2];
    __pyx_v_close = values[3];
    __pyx_v_buffered = values[4];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 5, __pyx_nargs); __PYX_ERR(6, 1304, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.xmlfile.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(((PyObject *)__pyx_v_output_file) == Py_None)) {
    PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "output_file"); __PYX_ERR(6, 1304, __pyx_L1_error)
  }
  __pyx_r = __pyx_pf_4lxml_5etree_7xmlfile___init__(((struct __pyx_obj_4lxml_5etree_xmlfile *)__pyx_v_self), __pyx_v_output_file, __pyx_v_encoding, __pyx_v_compression, __pyx_v_close, __pyx_v_buffered);

  /* "src/lxml/serializer.pxi":1304
 *     cdef int method
 * 
 *     def __init__(self, output_file not None, encoding=None, compression=None,             # <<<<<<<<<<<<<<
 *                  close=False, buffered=True):
 *         self.output_file = output_file
*/

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_7xmlfile___init__(struct __pyx_obj_4lxml_5etree_xmlfile *__pyx_v_self, PyObject *__pyx_v_output_file, PyObject *__pyx_v_encoding, PyObject *__pyx_v_compression, PyObject *__pyx_v_close, PyObject *__pyx_v_buffered) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "src/lxml/serializer.pxi":1306
 *     def __init__(self, output_file not None, encoding=None, compression=None,
 *                  close=False, buffered=True):
 *         self.output_file = output_file             # <<<<<<<<<<<<<<
 *         self.encoding = _utf8orNone(encoding)
 *         self.compresslevel = compression or 0
*/
  __Pyx_INCREF(__pyx_v_output_file);
  __Pyx_GIVEREF(__pyx_v_output_file);
  __Pyx_GOTREF(__pyx_v_self->output_file);
  __Pyx_DECREF(__pyx_v_self->output_file);
  __pyx_v_self->output_file = __pyx_v_output_file;

  /* "src/lxml/serializer.pxi":1307
 *                  close=False, buffered=True):
 *         self.output_file = output_file
 *         self.encoding = _utf8orNone(encoding)             # <<<<<<<<<<<<<<
 *         self.compresslevel = compression or 0
 *         self.close = close
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__utf8orNone(__pyx_v_encoding); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1307, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->encoding);
  __Pyx_DECREF(__pyx_v_self->encoding);
  __pyx_v_self->encoding = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/serializer.pxi":1308
 *         self.output_file = output_file
 *         self.encoding = _utf8orNone(encoding)
 *         self.compresslevel = compression or 0             # <<<<<<<<<<<<<<
 *         self.close = close
 *         self.buffered = buffered
*/
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_compression); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(6, 1308, __pyx_L1_error)
  if (!__pyx_t_3) {
  } else {
    __pyx_t_4 = __Pyx_PyLong_As_int(__pyx_v_compression); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(6, 1308, __pyx_L1_error)
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L3_bool_binop_done;
  }
  __pyx_t_2 = 0;
  __pyx_L3_bool_binop_done:;
  __pyx_v_self->compresslevel = __pyx_t_2;

  /* "src/lxml/serializer.pxi":1309
 *         self.encoding = _utf8orNone(encoding)
 *         self.compresslevel = compression or 0
 *         self.close = close             # <<<<<<<<<<<<<<
 *         self.buffered = buffered
 *         self.method = OUTPUT_METHOD_XML
*/
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_close); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(6, 1309, __pyx_L1_error)
  __pyx_v_self->close = __pyx_t_3;

  /* "src/lxml/serializer.pxi":1310
 *         self.compresslevel = compression or 0
 *         self.close = close
 *         self.buffered = buffered             # <<<<<<<<<<<<<<
 *         self.method = OUTPUT_METHOD_XML
 * 
*/
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_buffered); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(6, 1310, __pyx_L1_error)
  __pyx_v_self->buffered = __pyx_t_3;

  /* "src/lxml/serializer.pxi":1311
 *         self.close = close
 *         self.buffered = buffered
 *         self.method = OUTPUT_METHOD_XML             # <<<<<<<<<<<<<<
 * 
 *     def __enter__(self):
*/
  __pyx_v_self->method = __pyx_e_4lxml_5etree_OUTPUT_METHOD_XML;

  /* "src/lxml/serializer.pxi":1304
 *     cdef int method
 * 
 *     def __init__(self, output_file not None, encoding=None, compression=None,             # <<<<<<<<<<<<<<
 *                  close=False, buffered=True):
 *         self.output_file = output_file
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.xmlfile.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1313
 *         self.method = OUTPUT_METHOD_XML
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         assert self.output_file is not None
 *         self.writer = _IncrementalFileWriter(
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7xmlfile_3__enter__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_7xmlfile_3__enter__ = {"__enter__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7xmlfile_3__enter__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_7xmlfile_3__enter__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__enter__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__enter__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_7xmlfile_2__enter__(((struct __pyx_obj_4lxml_5etree_xmlfile *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_7xmlfile_2__enter__(struct __pyx_obj_4lxml_5etree_xmlfile *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  size_t __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__enter__", 0);

  /* "src/lxml/serializer.pxi":1314
 * 
 *     def __enter__(self):
 *         assert self.output_file is not None             # <<<<<<<<<<<<<<
 *         self.writer = _IncrementalFileWriter(
 *             self.output_file, self.encoding, self.compresslevel,
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = (__pyx_v_self->output_file != Py_None);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
      __PYX_ERR(6, 1314, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(6, 1314, __pyx_L1_error)
  #endif

  /* "src/lxml/serializer.pxi":1315
 *     def __enter__(self):
 *         assert self.output_file is not None
 *         self.writer = _IncrementalFileWriter(             # <<<<<<<<<<<<<<
 *             self.output_file, self.encoding, self.compresslevel,
 *             self.close, self.buffered, self.method)
*/
  __pyx_t_3 = NULL;

  /* "src/lxml/serializer.pxi":1316
 *         assert self.output_file is not None
 *         self.writer = _IncrementalFileWriter(
 *             self.output_file, self.encoding, self.compresslevel,             # <<<<<<<<<<<<<<
 *             self.close, self.buffered, self.method)
 *         return self.writer
*/
  __pyx_t_4 = __Pyx_PyLong_From_int(__pyx_v_self->compresslevel); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 1316, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "src/lxml/serializer.pxi":1317
 *         self.writer = _IncrementalFileWriter(
 *             self.output_file, self.encoding, self.compresslevel,
 *             self.close, self.buffered, self.method)             # <<<<<<<<<<<<<<
 *         return self.writer
 * 
*/
  __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_v_self->close); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 1317, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyBool_FromLong(__pyx_v_self->buffered); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 1317, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = __Pyx_PyLong_From_int(__pyx_v_self->method); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 1317, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = 1;
  {
    PyObject *__pyx_callargs[7] = {__pyx_t_3, __pyx_v_self->output_file, __pyx_v_self->encoding, __pyx_t_4, __pyx_t_5, __pyx_t_6, __pyx_t_7};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__IncrementalFileWriter, __pyx_callargs+__pyx_t_8, (7-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1315, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_2);
  }

  /* "src/lxml/serializer.pxi":1315
 *     def __enter__(self):
 *         assert self.output_file is not None
 *         self.writer = _IncrementalFileWriter(             # <<<<<<<<<<<<<<
 *             self.output_file, self.encoding, self.compresslevel,
 *             self.close, self.buffered, self.method)
*/
  __Pyx_GIVEREF((PyObject *)__pyx_t_2);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->writer);
  __Pyx_DECREF((PyObject *)__pyx_v_self->writer);
  __pyx_v_self->writer = ((struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/serializer.pxi":1318
 *             self.output_file, self.encoding, self.compresslevel,
 *             self.close, self.buffered, self.method)
 *         return self.writer             # <<<<<<<<<<<<<<
 * 
 *     def __exit__(self, exc_type, exc_val, exc_tb):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_self->writer);
  __pyx_r = ((PyObject *)__pyx_v_self->writer);
  goto __pyx_L0;

  /* "src/lxml/serializer.pxi":1313
 *         self.method = OUTPUT_METHOD_XML
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         assert self.output_file is not None
 *         self.writer = _IncrementalFileWriter(
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree.xmlfile.__enter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1320
 *         return self.writer
 * 
 *     def __exit__(self, exc_type, exc_val, exc_tb):             # <<<<<<<<<<<<<<
 *         if self.writer is not None:
 *             old_writer, self.writer = self.writer, None
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7xmlfile_5__exit__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_7xmlfile_5__exit__ = {"__exit__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7xmlfile_5__exit__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_7xmlfile_5__exit__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_exc_type = 0;
  CYTHON_UNUSED PyObject *__pyx_v_exc_val = 0;
  CYTHON_UNUSED PyObject *__pyx_v_exc_tb = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__exit__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_exc_type,&__pyx_mstate_global->__pyx_n_u_exc_val,&__pyx_mstate_global->__pyx_n_u_exc_tb,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(6, 1320, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(6, 1320, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(6, 1320, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 1320, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__exit__", 0) < (0)) __PYX_ERR(6, 1320, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, i); __PYX_ERR(6, 1320, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 1320, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(6, 1320, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(6, 1320, __pyx_L3_error)
    }
    __pyx_v_exc_type = values[0];
    __pyx_v_exc_val = values[1];
    __pyx_v_exc_tb = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, __pyx_nargs); __PYX_ERR(6, 1320, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.xmlfile.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_7xmlfile_4__exit__(((struct __pyx_obj_4lxml_5etree_xmlfile *)__pyx_v_self), __pyx_v_exc_type, __pyx_v_exc_val, __pyx_v_exc_tb);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_7xmlfile_4__exit__(struct __pyx_obj_4lxml_5etree_xmlfile *__pyx_v_self, PyObject *__pyx_v_exc_type, CYTHON_UNUSED PyObject *__pyx_v_exc_val, CYTHON_UNUSED PyObject *__pyx_v_exc_tb) {
  struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_old_writer = NULL;
  PyObject *__pyx_v_raise_on_error = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__exit__", 0);

  /* "src/lxml/serializer.pxi":1321
 * 
 *     def __exit__(self, exc_type, exc_val, exc_tb):
 *         if self.writer is not None:             # <<<<<<<<<<<<<<
 *             old_writer, self.writer = self.writer, None
 *             raise_on_error = exc_type is None
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_self->writer) != Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1322
 *     def __exit__(self, exc_type, exc_val, exc_tb):
 *         if self.writer is not None:
 *             old_writer, self.writer = self.writer, None             # <<<<<<<<<<<<<<
 *             raise_on_error = exc_type is None
 *             old_writer._close(raise_on_error)
*/
    __pyx_t_2 = ((PyObject *)__pyx_v_self->writer);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = Py_None;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_v_old_writer = ((struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *)__pyx_t_2);
    __pyx_t_2 = 0;
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF((PyObject *)__pyx_v_self->writer);
    __Pyx_DECREF((PyObject *)__pyx_v_self->writer);
    __pyx_v_self->writer = ((struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":1323
 *         if self.writer is not None:
 *             old_writer, self.writer = self.writer, None
 *             raise_on_error = exc_type is None             # <<<<<<<<<<<<<<
 *             old_writer._close(raise_on_error)
 *             if self.close:
*/
    __pyx_t_1 = (__pyx_v_exc_type == Py_None);
    __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1323, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_raise_on_error = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":1324
 *             old_writer, self.writer = self.writer, None
 *             raise_on_error = exc_type is None
 *             old_writer._close(raise_on_error)             # <<<<<<<<<<<<<<
 *             if self.close:
 *                 self.output_file = None
*/
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_raise_on_error); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(6, 1324, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_4lxml_5etree_22_IncrementalFileWriter__close(__pyx_v_old_writer, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1324, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":1325
 *             raise_on_error = exc_type is None
 *             old_writer._close(raise_on_error)
 *             if self.close:             # <<<<<<<<<<<<<<
 *                 self.output_file = None
 * 
*/
    if (__pyx_v_self->close) {

      /* "src/lxml/serializer.pxi":1326
 *             old_writer._close(raise_on_error)
 *             if self.close:
 *                 self.output_file = None             # <<<<<<<<<<<<<<
 * 
 *     async def __aenter__(self):
*/
      __Pyx_INCREF(Py_None);
      __Pyx_GIVEREF(Py_None);
      __Pyx_GOTREF(__pyx_v_self->output_file);
      __Pyx_DECREF(__pyx_v_self->output_file);
      __pyx_v_self->output_file = Py_None;

      /* "src/lxml/serializer.pxi":1325
 *             raise_on_error = exc_type is None
 *             old_writer._close(raise_on_error)
 *             if self.close:             # <<<<<<<<<<<<<<
 *                 self.output_file = None
 * 
*/
    }

    /* "src/lxml/serializer.pxi":1321
 * 
 *     def __exit__(self, exc_type, exc_val, exc_tb):
 *         if self.writer is not None:             # <<<<<<<<<<<<<<
 *             old_writer, self.writer = self.writer, None
 *             raise_on_error = exc_type is None
*/
  }

  /* "src/lxml/serializer.pxi":1320
 *         return self.writer
 * 
 *     def __exit__(self, exc_type, exc_val, exc_tb):             # <<<<<<<<<<<<<<
 *         if self.writer is not None:
 *             old_writer, self.writer = self.writer, None
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.xmlfile.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_old_writer);
  __Pyx_XDECREF(__pyx_v_raise_on_error);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_4lxml_5etree_7xmlfile_8generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "src/lxml/serializer.pxi":1328
 *                 self.output_file = None
 * 
 *     async def __aenter__(self):             # <<<<<<<<<<<<<<
 *         assert self.output_file is not None
 *         if isinstance(self.output_file, basestring):
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7xmlfile_7__aenter__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_7xmlfile_7__aenter__ = {"__aenter__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7xmlfile_7__aenter__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_7xmlfile_7__aenter__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__aenter__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__aenter__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__aenter__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_7xmlfile_6__aenter__(((struct __pyx_obj_4lxml_5etree_xmlfile *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_7xmlfile_6__aenter__(struct __pyx_obj_4lxml_5etree_xmlfile *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_2___aenter__ *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__aenter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_2___aenter__ *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_2___aenter__(__pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_2___aenter__, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_2___aenter__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(6, 1328, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_CoroutineObject *gen = __Pyx_Coroutine_New((__pyx_coroutine_body_t) __pyx_gb_4lxml_5etree_7xmlfile_8generator2, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[3]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_aenter, __pyx_mstate_global->__pyx_n_u_xmlfile___aenter, __pyx_mstate_global->__pyx_n_u_lxml_etree); if (unlikely(!gen)) __PYX_ERR(6, 1328, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.xmlfile.__aenter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_4lxml_5etree_7xmlfile_8generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_2___aenter__ *__pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_2___aenter__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__aenter__", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(__pyx_sent_value != Py_None)) {
    if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started coroutine");
    __PYX_ERR(6, 1328, __pyx_L1_error)
  }

  /* "src/lxml/serializer.pxi":1329
 * 
 *     async def __aenter__(self):
 *         assert self.output_file is not None             # <<<<<<<<<<<<<<
 *         if isinstance(self.output_file, basestring):
 *             raise TypeError("Cannot asynchronously write to a plain file")
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = (__pyx_cur_scope->__pyx_v_self->output_file != Py_None);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
      __PYX_ERR(6, 1329, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(6, 1329, __pyx_L1_error)
  #endif

  /* "src/lxml/serializer.pxi":1330
 *     async def __aenter__(self):
 *         assert self.output_file is not None
 *         if isinstance(self.output_file, basestring):             # <<<<<<<<<<<<<<
 *             raise TypeError("Cannot asynchronously write to a plain file")
 *         if not hasattr(self.output_file, 'write'):
*/
  __pyx_t_2 = __pyx_cur_scope->__pyx_v_self->output_file;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_1 = PyUnicode_Check(__pyx_t_2); 
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/serializer.pxi":1331
 *         assert self.output_file is not None
 *         if isinstance(self.output_file, basestring):
 *             raise TypeError("Cannot asynchronously write to a plain file")             # <<<<<<<<<<<<<<
 *         if not hasattr(self.output_file, 'write'):
 *             raise TypeError("Output file needs an async .write() method")
*/
    __pyx_t_3 = NULL;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Cannot_asynchronously_write_to_a};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1331, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(6, 1331, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":1330
 *     async def __aenter__(self):
 *         assert self.output_file is not None
 *         if isinstance(self.output_file, basestring):             # <<<<<<<<<<<<<<
 *             raise TypeError("Cannot asynchronously write to a plain file")
 *         if not hasattr(self.output_file, 'write'):
*/
  }

  /* "src/lxml/serializer.pxi":1332
 *         if isinstance(self.output_file, basestring):
 *             raise TypeError("Cannot asynchronously write to a plain file")
 *         if not hasattr(self.output_file, 'write'):             # <<<<<<<<<<<<<<
 *             raise TypeError("Output file needs an async .write() method")
 *         self.async_writer = _AsyncIncrementalFileWriter(
*/
  __pyx_t_2 = __pyx_cur_scope->__pyx_v_self->output_file;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_HasAttr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_write); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(6, 1332, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = (!__pyx_t_1);
  if (unlikely(__pyx_t_5)) {

    /* "src/lxml/serializer.pxi":1333
 *             raise TypeError("Cannot asynchronously write to a plain file")
 *         if not hasattr(self.output_file, 'write'):
 *             raise TypeError("Output file needs an async .write() method")             # <<<<<<<<<<<<<<
 *         self.async_writer = _AsyncIncrementalFileWriter(
 *             self.output_file, self.encoding, self.compresslevel,
*/
    __pyx_t_3 = NULL;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Output_file_needs_an_async_write};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1333, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(6, 1333, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":1332
 *         if isinstance(self.output_file, basestring):
 *             raise TypeError("Cannot asynchronously write to a plain file")
 *         if not hasattr(self.output_file, 'write'):             # <<<<<<<<<<<<<<
 *             raise TypeError("Output file needs an async .write() method")
 *         self.async_writer = _AsyncIncrementalFileWriter(
*/
  }

  /* "src/lxml/serializer.pxi":1334
 *         if not hasattr(self.output_file, 'write'):
 *             raise TypeError("Output file needs an async .write() method")
 *         self.async_writer = _AsyncIncrementalFileWriter(             # <<<<<<<<<<<<<<
 *             self.output_file, self.encoding, self.compresslevel,
 *             self.close, self.buffered, self.method)
*/
  __pyx_t_3 = NULL;

  /* "src/lxml/serializer.pxi":1335
 *             raise TypeError("Output file needs an async .write() method")
 *         self.async_writer = _AsyncIncrementalFileWriter(
 *             self.output_file, self.encoding, self.compresslevel,             # <<<<<<<<<<<<<<
 *             self.close, self.buffered, self.method)
 *         return self.async_writer
*/
  __pyx_t_6 = __Pyx_PyLong_From_int(__pyx_cur_scope->__pyx_v_self->compresslevel); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 1335, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);

  /* "src/lxml/serializer.pxi":1336
 *         self.async_writer = _AsyncIncrementalFileWriter(
 *             self.output_file, self.encoding, self.compresslevel,
 *             self.close, self.buffered, self.method)             # <<<<<<<<<<<<<<
 *         return self.async_writer
 * 
*/
  __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_cur_scope->__pyx_v_self->close); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 1336, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = __Pyx_PyBool_FromLong(__pyx_cur_scope->__pyx_v_self->buffered); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 1336, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = __Pyx_PyLong_From_int(__pyx_cur_scope->__pyx_v_self->method); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 1336, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_4 = 1;
  {
    PyObject *__pyx_callargs[7] = {__pyx_t_3, __pyx_cur_scope->__pyx_v_self->output_file, __pyx_cur_scope->__pyx_v_self->encoding, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__AsyncIncrementalFileWriter, __pyx_callargs+__pyx_t_4, (7-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1334, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_2);
  }

  /* "src/lxml/serializer.pxi":1334
 *         if not hasattr(self.output_file, 'write'):
 *             raise TypeError("Output file needs an async .write() method")
 *         self.async_writer = _AsyncIncrementalFileWriter(             # <<<<<<<<<<<<<<
 *             self.output_file, self.encoding, self.compresslevel,
 *             self.close, self.buffered, self.method)
*/
  __Pyx_GIVEREF((PyObject *)__pyx_t_2);
  __Pyx_GOTREF((PyObject *)__pyx_cur_scope->__pyx_v_self->async_writer);
  __Pyx_DECREF((PyObject *)__pyx_cur_scope->__pyx_v_self->async_writer);
  __pyx_cur_scope->__pyx_v_self->async_writer = ((struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/serializer.pxi":1337
 *             self.output_file, self.encoding, self.compresslevel,
 *             self.close, self.buffered, self.method)
 *         return self.async_writer             # <<<<<<<<<<<<<<
 * 
 *     async def __aexit__(self, exc_type, exc_val, exc_tb):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self->async_writer);
  __pyx_r = ((PyObject *)__pyx_cur_scope->__pyx_v_self->async_writer);
  goto __pyx_L0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "src/lxml/serializer.pxi":1328
 *                 self.output_file = None
 * 
 *     async def __aenter__(self):             # <<<<<<<<<<<<<<
 *         assert self.output_file is not None
 *         if isinstance(self.output_file, basestring):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("__aenter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_4lxml_5etree_7xmlfile_11generator3(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "src/lxml/serializer.pxi":1339
 *         return self.async_writer
 * 
 *     async def __aexit__(self, exc_type, exc_val, exc_tb):             # <<<<<<<<<<<<<<
 *         if self.async_writer is not None:
 *             old_writer, self.async_writer = self.async_writer, None
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7xmlfile_10__aexit__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_7xmlfile_10__aexit__ = {"__aexit__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7xmlfile_10__aexit__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_7xmlfile_10__aexit__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_exc_type = 0;
  CYTHON_UNUSED PyObject *__pyx_v_exc_val = 0;
  CYTHON_UNUSED PyObject *__pyx_v_exc_tb = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__aexit__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_exc_type,&__pyx_mstate_global->__pyx_n_u_exc_val,&__pyx_mstate_global->__pyx_n_u_exc_tb,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(6, 1339, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(6, 1339, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(6, 1339, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 1339, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__aexit__", 0) < (0)) __PYX_ERR(6, 1339, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__aexit__", 1, 3, 3, i); __PYX_ERR(6, 1339, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 1339, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(6, 1339, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(6, 1339, __pyx_L3_error)
    }
    __pyx_v_exc_type = values[0];
    __pyx_v_exc_val = values[1];
    __pyx_v_exc_tb = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__aexit__", 1, 3, 3, __pyx_nargs); __PYX_ERR(6, 1339, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.xmlfile.__aexit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_7xmlfile_9__aexit__(((struct __pyx_obj_4lxml_5etree_xmlfile *)__pyx_v_self), __pyx_v_exc_type, __pyx_v_exc_val, __pyx_v_exc_tb);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_7xmlfile_9__aexit__(struct __pyx_obj_4lxml_5etree_xmlfile *__pyx_v_self, PyObject *__pyx_v_exc_type, CYTHON_UNUSED PyObject *__pyx_v_exc_val, CYTHON_UNUSED PyObject *__pyx_v_exc_tb) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_3___aexit__ *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__aexit__", 0);
  __pyx_cur_scope = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_3___aexit__ *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_3___aexit__(__pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_3___aexit__, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_3___aexit__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(6, 1339, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_exc_type = __pyx_v_exc_type;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_exc_type);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_exc_type);
  __pyx_cur_scope->__pyx_v_exc_val = __pyx_v_exc_val;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_exc_val);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_exc_val);
  __pyx_cur_scope->__pyx_v_exc_tb = __pyx_v_exc_tb;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_exc_tb);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_exc_tb);
  {
    __pyx_CoroutineObject *gen = __Pyx_Coroutine_New((__pyx_coroutine_body_t) __pyx_gb_4lxml_5etree_7xmlfile_11generator3, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[4]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_aexit, __pyx_mstate_global->__pyx_n_u_xmlfile___aexit, __pyx_mstate_global->__pyx_n_u_lxml_etree); if (unlikely(!gen)) __PYX_ERR(6, 1339, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.xmlfile.__aexit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_4lxml_5etree_7xmlfile_11generator3(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_3___aexit__ *__pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_3___aexit__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  __Pyx_PySendResult __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__aexit__", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L5_resume_from_await;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(__pyx_sent_value != Py_None)) {
    if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started coroutine");
    __PYX_ERR(6, 1339, __pyx_L1_error)
  }

  /* "src/lxml/serializer.pxi":1340
 * 
 *     async def __aexit__(self, exc_type, exc_val, exc_tb):
 *         if self.async_writer is not None:             # <<<<<<<<<<<<<<
 *             old_writer, self.async_writer = self.async_writer, None
 *             raise_on_error = exc_type is None
*/
  __pyx_t_1 = (((PyObject *)__pyx_cur_scope->__pyx_v_self->async_writer) != Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1341
 *     async def __aexit__(self, exc_type, exc_val, exc_tb):
 *         if self.async_writer is not None:
 *             old_writer, self.async_writer = self.async_writer, None             # <<<<<<<<<<<<<<
 *             raise_on_error = exc_type is None
 *             await old_writer._close(raise_on_error)
*/
    __pyx_t_2 = ((PyObject *)__pyx_cur_scope->__pyx_v_self->async_writer);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = Py_None;
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_cur_scope->__pyx_v_old_writer = ((struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *)__pyx_t_2);
    __pyx_t_2 = 0;
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope->__pyx_v_self->async_writer);
    __Pyx_DECREF((PyObject *)__pyx_cur_scope->__pyx_v_self->async_writer);
    __pyx_cur_scope->__pyx_v_self->async_writer = ((struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":1342
 *         if self.async_writer is not None:
 *             old_writer, self.async_writer = self.async_writer, None
 *             raise_on_error = exc_type is None             # <<<<<<<<<<<<<<
 *             await old_writer._close(raise_on_error)
 *             if self.close:
*/
    __pyx_t_1 = (__pyx_cur_scope->__pyx_v_exc_type == Py_None);
    __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1342, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_cur_scope->__pyx_v_raise_on_error = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":1343
 *             old_writer, self.async_writer = self.async_writer, None
 *             raise_on_error = exc_type is None
 *             await old_writer._close(raise_on_error)             # <<<<<<<<<<<<<<
 *             if self.close:
 *                 self.output_file = None
*/
    __pyx_t_2 = ((PyObject *)__pyx_cur_scope->__pyx_v_old_writer);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_4 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_cur_scope->__pyx_v_raise_on_error};
      __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_close_2, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1343, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __pyx_t_5 = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_3, &__pyx_r);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (likely(__pyx_t_5 == PYGEN_NEXT)) {
      __Pyx_GOTREF(__pyx_r);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, awaiting value */
      __pyx_generator->resume_label = 1;
      return __pyx_r;
      __pyx_L5_resume_from_await:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(6, 1343, __pyx_L1_error)
    } else if (likely(__pyx_t_5 == PYGEN_RETURN)) {
      __Pyx_GOTREF(__pyx_r);
      __Pyx_DECREF(__pyx_r); __pyx_r = 0;
    } else {
      __Pyx_XGOTREF(__pyx_r);
      __PYX_ERR(6, 1343, __pyx_L1_error)
    }

    /* "src/lxml/serializer.pxi":1344
 *             raise_on_error = exc_type is None
 *             await old_writer._close(raise_on_error)
 *             if self.close:             # <<<<<<<<<<<<<<
 *                 self.output_file = None
 * 
*/
    if (__pyx_cur_scope->__pyx_v_self->close) {

      /* "src/lxml/serializer.pxi":1345
 *             await old_writer._close(raise_on_error)
 *             if self.close:
 *                 self.output_file = None             # <<<<<<<<<<<<<<
 * 
 * 
*/
      __Pyx_INCREF(Py_None);
      __Pyx_GIVEREF(Py_None);
      __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->output_file);
      __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->output_file);
      __pyx_cur_scope->__pyx_v_self->output_file = Py_None;

      /* "src/lxml/serializer.pxi":1344
 *             raise_on_error = exc_type is None
 *             await old_writer._close(raise_on_error)
 *             if self.close:             # <<<<<<<<<<<<<<
 *                 self.output_file = None
 * 
*/
    }

    /* "src/lxml/serializer.pxi":1340
 * 
 *     async def __aexit__(self, exc_type, exc_val, exc_tb):
 *         if self.async_writer is not None:             # <<<<<<<<<<<<<<
 *             old_writer, self.async_writer = self.async_writer, None
 *             raise_on_error = exc_type is None
*/
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "src/lxml/serializer.pxi":1339
 *         return self.async_writer
 * 
 *     async def __aexit__(self, exc_type, exc_val, exc_tb):             # <<<<<<<<<<<<<<
 *         if self.async_writer is not None:
 *             old_writer, self.async_writer = self.async_writer, None
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("__aexit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1354
 *     xmlfile.
 *     """
 *     def __init__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         super().__init__(*args, **kwargs)
 *         self.method = OUTPUT_METHOD_HTML
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_8htmlfile_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_8htmlfile_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kwargs = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return -1;
  if (__pyx_kwds_len > 0) {
    if (unlikely(__Pyx_CheckKeywordStrings("__init__", __pyx_kwds) == -1)) return -1;
    __pyx_v_kwargs = __Pyx_KwargsAsDict_VARARGS(__pyx_kwds, __pyx_kwvalues);
    if (unlikely(!__pyx_v_kwargs)) return -1;
    __Pyx_GOTREF(__pyx_v_kwargs);
  } else {
    __pyx_v_kwargs = PyDict_New();
    if (unlikely(!__pyx_v_kwargs)) return -1;
    __Pyx_GOTREF(__pyx_v_kwargs);
  }
  __Pyx_INCREF(__pyx_args);
  __pyx_v_args = __pyx_args;
  __pyx_r = __pyx_pf_4lxml_5etree_8htmlfile___init__(((struct __pyx_obj_4lxml_5etree_htmlfile *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs);

  /* function exit code */
  __Pyx_DECREF(__pyx_v_args);
  __Pyx_DECREF(__pyx_v_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_8htmlfile___init__(struct __pyx_obj_4lxml_5etree_htmlfile *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "src/lxml/serializer.pxi":1355
 *     """
 *     def __init__(self, *args, **kwargs):
 *         super().__init__(*args, **kwargs)             # <<<<<<<<<<<<<<
 *         self.method = OUTPUT_METHOD_HTML
 * 
*/
  __pyx_t_2 = NULL;
  __pyx_t_3 = 1;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_2, ((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_htmlfile), ((PyObject *)__pyx_v_self)};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_super, __pyx_callargs+__pyx_t_3, (3-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1355, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1355, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1355, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_v_args, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 1355, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "src/lxml/serializer.pxi":1356
 *     def __init__(self, *args, **kwargs):
 *         super().__init__(*args, **kwargs)
 *         self.method = OUTPUT_METHOD_HTML             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_v_self->__pyx_base.method = __pyx_e_4lxml_5etree_OUTPUT_METHOD_HTML;

  /* "src/lxml/serializer.pxi":1354
 *     xmlfile.
 *     """
 *     def __init__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         super().__init__(*args, **kwargs)
 *         self.method = OUTPUT_METHOD_HTML
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.htmlfile.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1379
 *     cdef bint _buffered
 * 
 *     def __cinit__(self, outfile, bytes encoding, int compresslevel, bint close,             # <<<<<<<<<<<<<<
 *                   bint buffered, int method):
 *         self._status = WRITER_STARTING
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_22_IncrementalFileWriter_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_22_IncrementalFileWriter_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_outfile = 0;
  PyObject *__pyx_v_encoding = 0;
  int __pyx_v_compresslevel;
  int __pyx_v_close;
  int __pyx_v_buffered;
  int __pyx_v_method;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[6] = {0,0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_outfile,&__pyx_mstate_global->__pyx_n_u_encoding,&__pyx_mstate_global->__pyx_n_u_compresslevel,&__pyx_mstate_global->__pyx_n_u_close,&__pyx_mstate_global->__pyx_n_u_buffered,&__pyx_mstate_global->__pyx_n_u_method,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(6, 1379, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  6:
        values[5] = __Pyx_ArgRef_VARARGS(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(6, 1379, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(6, 1379, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(6, 1379, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(6, 1379, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(6, 1379, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 1379, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__cinit__", 0) < (0)) __PYX_ERR(6, 1379, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 6; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 6, 6, i); __PYX_ERR(6, 1379, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 6)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 1379, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(6, 1379, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(6, 1379, __pyx_L3_error)
      values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(6, 1379, __pyx_L3_error)
      values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(6, 1379, __pyx_L3_error)
      values[5] = __Pyx_ArgRef_VARARGS(__pyx_args, 5);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(6, 1379, __pyx_L3_error)
    }
    __pyx_v_outfile = values[0];
    __pyx_v_encoding = ((PyObject*)values[1]);
    __pyx_v_compresslevel = __Pyx_PyLong_As_int(values[2]); if (unlikely((__pyx_v_compresslevel == (int)-1) && PyErr_Occurred())) __PYX_ERR(6, 1379, __pyx_L3_error)
    __pyx_v_close = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_close == (int)-1) && PyErr_Occurred())) __PYX_ERR(6, 1379, __pyx_L3_error)
    __pyx_v_buffered = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_buffered == (int)-1) && PyErr_Occurred())) __PYX_ERR(6, 1380, __pyx_L3_error)
    __pyx_v_method = __Pyx_PyLong_As_int(values[5]); if (unlikely((__pyx_v_method == (int)-1) && PyErr_Occurred())) __PYX_ERR(6, 1380, __pyx_L3_error)
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 6, 6, __pyx_nargs); __PYX_ERR(6, 1379, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._IncrementalFileWriter.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_encoding), (&PyBytes_Type), 1, "encoding", 1))) __PYX_ERR(6, 1379, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_22_IncrementalFileWriter___cinit__(((struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *)__pyx_v_self), __pyx_v_outfile, __pyx_v_encoding, __pyx_v_compresslevel, __pyx_v_close, __pyx_v_buffered, __pyx_v_method);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_22_IncrementalFileWriter___cinit__(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_outfile, PyObject *__pyx_v_encoding, int __pyx_v_compresslevel, int __pyx_v_close, int __pyx_v_buffered, int __pyx_v_method) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);
  __Pyx_INCREF(__pyx_v_encoding);

  /* "src/lxml/serializer.pxi":1381
 *     def __cinit__(self, outfile, bytes encoding, int compresslevel, bint close,
 *                   bint buffered, int method):
 *         self._status = WRITER_STARTING             # <<<<<<<<<<<<<<
 *         self._element_stack = []
 *         if encoding is None:
*/
  __pyx_v_self->_status = __pyx_e_4lxml_5etree_WRITER_STARTING;

  /* "src/lxml/serializer.pxi":1382
 *                   bint buffered, int method):
 *         self._status = WRITER_STARTING
 *         self._element_stack = []             # <<<<<<<<<<<<<<
 *         if encoding is None:
 *             # We always need a document encoding to make the attribute serialisation
*/
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1382, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_element_stack);
  __Pyx_DECREF(__pyx_v_self->_element_stack);
  __pyx_v_self->_element_stack = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/serializer.pxi":1383
 *         self._status = WRITER_STARTING
 *         self._element_stack = []
 *         if encoding is None:             # <<<<<<<<<<<<<<
 *             # We always need a document encoding to make the attribute serialisation
 *             # of libxml2 identical to ours.
*/
  __pyx_t_2 = (__pyx_v_encoding == ((PyObject*)Py_None));
  if (__pyx_t_2) {

    /* "src/lxml/serializer.pxi":1386
 *             # We always need a document encoding to make the attribute serialisation
 *             # of libxml2 identical to ours.
 *             encoding = b'ASCII'             # <<<<<<<<<<<<<<
 *         self._encoding = encoding
 *         self._c_encoding = _cstr(encoding)
*/
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_b_ASCII);
    __Pyx_DECREF_SET(__pyx_v_encoding, __pyx_mstate_global->__pyx_n_b_ASCII);

    /* "src/lxml/serializer.pxi":1383
 *         self._status = WRITER_STARTING
 *         self._element_stack = []
 *         if encoding is None:             # <<<<<<<<<<<<<<
 *             # We always need a document encoding to make the attribute serialisation
 *             # of libxml2 identical to ours.
*/
  }

  /* "src/lxml/serializer.pxi":1387
 *             # of libxml2 identical to ours.
 *             encoding = b'ASCII'
 *         self._encoding = encoding             # <<<<<<<<<<<<<<
 *         self._c_encoding = _cstr(encoding)
 *         self._buffered = buffered
*/
  __Pyx_INCREF(__pyx_v_encoding);
  __Pyx_GIVEREF(__pyx_v_encoding);
  __Pyx_GOTREF(__pyx_v_self->_encoding);
  __Pyx_DECREF(__pyx_v_self->_encoding);
  __pyx_v_self->_encoding = __pyx_v_encoding;

  /* "src/lxml/serializer.pxi":1388
 *             encoding = b'ASCII'
 *         self._encoding = encoding
 *         self._c_encoding = _cstr(encoding)             # <<<<<<<<<<<<<<
 *         self._buffered = buffered
 *         self._target = _create_output_buffer(
*/
  __pyx_v_self->_c_encoding = PyBytes_AS_STRING(__pyx_v_encoding);

  /* "src/lxml/serializer.pxi":1389
 *         self._encoding = encoding
 *         self._c_encoding = _cstr(encoding)
 *         self._buffered = buffered             # <<<<<<<<<<<<<<
 *         self._target = _create_output_buffer(
 *             outfile, self._c_encoding, compresslevel, &self._c_out, close)
*/
  __pyx_v_self->_buffered = __pyx_v_buffered;

  /* "src/lxml/serializer.pxi":1390
 *         self._c_encoding = _cstr(encoding)
 *         self._buffered = buffered
 *         self._target = _create_output_buffer(             # <<<<<<<<<<<<<<
 *             outfile, self._c_encoding, compresslevel, &self._c_out, close)
 *         self._method = method
*/
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__create_output_buffer(__pyx_v_outfile, __pyx_v_self->_c_encoding, __pyx_v_compresslevel, (&__pyx_v_self->_c_out), __pyx_v_close)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1390, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_target);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_target);
  __pyx_v_self->_target = ((struct __pyx_obj_4lxml_5etree__FilelikeWriter *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/serializer.pxi":1392
 *         self._target = _create_output_buffer(
 *             outfile, self._c_encoding, compresslevel, &self._c_out, close)
 *         self._method = method             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
*/
  __pyx_v_self->_method = __pyx_v_method;

  /* "src/lxml/serializer.pxi":1379
 *     cdef bint _buffered
 * 
 *     def __cinit__(self, outfile, bytes encoding, int compresslevel, bint close,             # <<<<<<<<<<<<<<
 *                   bint buffered, int method):
 *         self._status = WRITER_STARTING
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._IncrementalFileWriter.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_encoding);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1394
 *         self._method = method
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._c_out is not NULL:
 *             tree.xmlOutputBufferClose(self._c_out)
*/

/* Python wrapper */
static void __pyx_pw_4lxml_5etree_22_IncrementalFileWriter_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_4lxml_5etree_22_IncrementalFileWriter_3__dealloc__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_pf_4lxml_5etree_22_IncrementalFileWriter_2__dealloc__(((struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_4lxml_5etree_22_IncrementalFileWriter_2__dealloc__(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self) {
  int __pyx_t_1;

  /* "src/lxml/serializer.pxi":1395
 * 
 *     def __dealloc__(self):
 *         if self._c_out is not NULL:             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferClose(self._c_out)
 * 
*/
  __pyx_t_1 = (__pyx_v_self->_c_out != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1396
 *     def __dealloc__(self):
 *         if self._c_out is not NULL:
 *             tree.xmlOutputBufferClose(self._c_out)             # <<<<<<<<<<<<<<
 * 
 *     def write_declaration(self, version=None, standalone=None, doctype=None):
*/
    (void)(xmlOutputBufferClose(__pyx_v_self->_c_out));

    /* "src/lxml/serializer.pxi":1395
 * 
 *     def __dealloc__(self):
 *         if self._c_out is not NULL:             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferClose(self._c_out)
 * 
*/
  }

  /* "src/lxml/serializer.pxi":1394
 *         self._method = method
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._c_out is not NULL:
 *             tree.xmlOutputBufferClose(self._c_out)
*/

  /* function exit code */
}

/* "src/lxml/serializer.pxi":1398
 *             tree.xmlOutputBufferClose(self._c_out)
 * 
 *     def write_declaration(self, version=None, standalone=None, doctype=None):             # <<<<<<<<<<<<<<
 *         """write_declaration(self, version=None, standalone=None, doctype=None)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_22_IncrementalFileWriter_5write_declaration(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_22_IncrementalFileWriter_4write_declaration, "write_declaration(self, version=None, standalone=None, doctype=None)\n\n        Write an XML declaration and (optionally) a doctype into the file.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_22_IncrementalFileWriter_5write_declaration = {"write_declaration", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_22_IncrementalFileWriter_5write_declaration, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_22_IncrementalFileWriter_4write_declaration};
static PyObject *__pyx_pw_4lxml_5etree_22_IncrementalFileWriter_5write_declaration(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_version = 0;
  PyObject *__pyx_v_standalone = 0;
  PyObject *__pyx_v_doctype = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write_declaration (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_version,&__pyx_mstate_global->__pyx_n_u_standalone,&__pyx_mstate_global->__pyx_n_u_doctype,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(6, 1398, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(6, 1398, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(6, 1398, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 1398, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "write_declaration", 0) < (0)) __PYX_ERR(6, 1398, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
    } else {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(6, 1398, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(6, 1398, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 1398, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_version = values[0];
    __pyx_v_standalone = values[1];
    __pyx_v_doctype = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("write_declaration", 0, 0, 3, __pyx_nargs); __PYX_ERR(6, 1398, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._IncrementalFileWriter.write_declaration", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_22_IncrementalFileWriter_4write_declaration(((struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *)__pyx_v_self), __pyx_v_version, __pyx_v_standalone, __pyx_v_doctype);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_22_IncrementalFileWriter_4write_declaration(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_version, PyObject *__pyx_v_standalone, PyObject *__pyx_v_doctype) {
  const xmlChar *__pyx_v_c_version;
  int __pyx_v_c_standalone;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  const xmlChar *__pyx_t_6;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("write_declaration", 0);
  __Pyx_INCREF(__pyx_v_version);
  __Pyx_INCREF(__pyx_v_doctype);

  /* "src/lxml/serializer.pxi":1403
 *         Write an XML declaration and (optionally) a doctype into the file.
 *         """
 *         assert self._c_out is not NULL             # <<<<<<<<<<<<<<
 *         cdef const_xmlChar* c_version
 *         cdef int c_standalone
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = (__pyx_v_self->_c_out != NULL);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
      __PYX_ERR(6, 1403, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(6, 1403, __pyx_L1_error)
  #endif

  /* "src/lxml/serializer.pxi":1406
 *         cdef const_xmlChar* c_version
 *         cdef int c_standalone
 *         if self._method != OUTPUT_METHOD_XML:             # <<<<<<<<<<<<<<
 *             raise LxmlSyntaxError("only XML documents have declarations")
 *         if self._status >= WRITER_DECL_WRITTEN:
*/
  __pyx_t_1 = (__pyx_v_self->_method != __pyx_e_4lxml_5etree_OUTPUT_METHOD_XML);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/serializer.pxi":1407
 *         cdef int c_standalone
 *         if self._method != OUTPUT_METHOD_XML:
 *             raise LxmlSyntaxError("only XML documents have declarations")             # <<<<<<<<<<<<<<
 *         if self._status >= WRITER_DECL_WRITTEN:
 *             raise LxmlSyntaxError("XML declaration already written")
*/
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_LxmlSyntaxError); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 1407, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_only_XML_documents_have_declarat};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1407, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(6, 1407, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":1406
 *         cdef const_xmlChar* c_version
 *         cdef int c_standalone
 *         if self._method != OUTPUT_METHOD_XML:             # <<<<<<<<<<<<<<
 *             raise LxmlSyntaxError("only XML documents have declarations")
 *         if self._status >= WRITER_DECL_WRITTEN:
*/
  }

  /* "src/lxml/serializer.pxi":1408
 *         if self._method != OUTPUT_METHOD_XML:
 *             raise LxmlSyntaxError("only XML documents have declarations")
 *         if self._status >= WRITER_DECL_WRITTEN:             # <<<<<<<<<<<<<<
 *             raise LxmlSyntaxError("XML declaration already written")
 *         version = _utf8orNone(version)
*/
  __pyx_t_1 = (__pyx_v_self->_status >= __pyx_e_4lxml_5etree_WRITER_DECL_WRITTEN);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/serializer.pxi":1409
 *             raise LxmlSyntaxError("only XML documents have declarations")
 *         if self._status >= WRITER_DECL_WRITTEN:
 *             raise LxmlSyntaxError("XML declaration already written")             # <<<<<<<<<<<<<<
 *         version = _utf8orNone(version)
 *         c_version = _xcstr(version) if version is not None else NULL
*/
    __pyx_t_4 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_LxmlSyntaxError); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1409, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_4);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_XML_declaration_already_written};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1409, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(6, 1409, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":1408
 *         if self._method != OUTPUT_METHOD_XML:
 *             raise LxmlSyntaxError("only XML documents have declarations")
 *         if self._status >= WRITER_DECL_WRITTEN:             # <<<<<<<<<<<<<<
 *             raise LxmlSyntaxError("XML declaration already written")
 *         version = _utf8orNone(version)
*/
  }

  /* "src/lxml/serializer.pxi":1410
 *         if self._status >= WRITER_DECL_WRITTEN:
 *             raise LxmlSyntaxError("XML declaration already written")
 *         version = _utf8orNone(version)             # <<<<<<<<<<<<<<
 *         c_version = _xcstr(version) if version is not None else NULL
 *         doctype = _utf8orNone(doctype)
*/
  __pyx_t_2 = __pyx_f_4lxml_5etree__utf8orNone(__pyx_v_version); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1410, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_version, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/serializer.pxi":1411
 *             raise LxmlSyntaxError("XML declaration already written")
 *         version = _utf8orNone(version)
 *         c_version = _xcstr(version) if version is not None else NULL             # <<<<<<<<<<<<<<
 *         doctype = _utf8orNone(doctype)
 *         if standalone is None:
*/
  __pyx_t_1 = (__pyx_v_version != Py_None);
  if (__pyx_t_1) {
    __pyx_t_6 = (const xmlChar*)PyBytes_AS_STRING(__pyx_v_version);
  } else {
    __pyx_t_6 = NULL;
  }
  __pyx_v_c_version = __pyx_t_6;

  /* "src/lxml/serializer.pxi":1412
 *         version = _utf8orNone(version)
 *         c_version = _xcstr(version) if version is not None else NULL
 *         doctype = _utf8orNone(doctype)             # <<<<<<<<<<<<<<
 *         if standalone is None:
 *             c_standalone = -1
*/
  __pyx_t_2 = __pyx_f_4lxml_5etree__utf8orNone(__pyx_v_doctype); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1412, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_doctype, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/serializer.pxi":1413
 *         c_version = _xcstr(version) if version is not None else NULL
 *         doctype = _utf8orNone(doctype)
 *         if standalone is None:             # <<<<<<<<<<<<<<
 *             c_standalone = -1
 *         else:
*/
  __pyx_t_1 = (__pyx_v_standalone == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1414
 *         doctype = _utf8orNone(doctype)
 *         if standalone is None:
 *             c_standalone = -1             # <<<<<<<<<<<<<<
 *         else:
 *             c_standalone = 1 if standalone else 0
*/
    __pyx_v_c_standalone = -1;

    /* "src/lxml/serializer.pxi":1413
 *         c_version = _xcstr(version) if version is not None else NULL
 *         doctype = _utf8orNone(doctype)
 *         if standalone is None:             # <<<<<<<<<<<<<<
 *             c_standalone = -1
 *         else:
*/
    goto __pyx_L5;
  }

  /* "src/lxml/serializer.pxi":1416
 *             c_standalone = -1
 *         else:
 *             c_standalone = 1 if standalone else 0             # <<<<<<<<<<<<<<
 *         _writeDeclarationToBuffer(self._c_out, c_version, self._c_encoding, c_standalone)
 *         if doctype is not None:
*/
  /*else*/ {
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_standalone); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(6, 1416, __pyx_L1_error)
    if (__pyx_t_1) {
      __pyx_t_7 = 1;
    } else {
      __pyx_t_7 = 0;
    }
    __pyx_v_c_standalone = __pyx_t_7;
  }
  __pyx_L5:;

  /* "src/lxml/serializer.pxi":1417
 *         else:
 *             c_standalone = 1 if standalone else 0
 *         _writeDeclarationToBuffer(self._c_out, c_version, self._c_encoding, c_standalone)             # <<<<<<<<<<<<<<
 *         if doctype is not None:
 *             _writeDoctype(self._c_out, _xcstr(doctype))
*/
  __pyx_f_4lxml_5etree__writeDeclarationToBuffer(__pyx_v_self->_c_out, __pyx_v_c_version, __pyx_v_self->_c_encoding, __pyx_v_c_standalone);

  /* "src/lxml/serializer.pxi":1418
 *             c_standalone = 1 if standalone else 0
 *         _writeDeclarationToBuffer(self._c_out, c_version, self._c_encoding, c_standalone)
 *         if doctype is not None:             # <<<<<<<<<<<<<<
 *             _writeDoctype(self._c_out, _xcstr(doctype))
 *             self._status = WRITER_DTD_WRITTEN
*/
  __pyx_t_1 = (__pyx_v_doctype != Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1419
 *         _writeDeclarationToBuffer(self._c_out, c_version, self._c_encoding, c_standalone)
 *         if doctype is not None:
 *             _writeDoctype(self._c_out, _xcstr(doctype))             # <<<<<<<<<<<<<<
 *             self._status = WRITER_DTD_WRITTEN
 *         else:
*/
    __pyx_f_4lxml_5etree__writeDoctype(__pyx_v_self->_c_out, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_doctype));

    /* "src/lxml/serializer.pxi":1420
 *         if doctype is not None:
 *             _writeDoctype(self._c_out, _xcstr(doctype))
 *             self._status = WRITER_DTD_WRITTEN             # <<<<<<<<<<<<<<
 *         else:
 *             self._status = WRITER_DECL_WRITTEN
*/
    __pyx_v_self->_status = __pyx_e_4lxml_5etree_WRITER_DTD_WRITTEN;

    /* "src/lxml/serializer.pxi":1418
 *             c_standalone = 1 if standalone else 0
 *         _writeDeclarationToBuffer(self._c_out, c_version, self._c_encoding, c_standalone)
 *         if doctype is not None:             # <<<<<<<<<<<<<<
 *             _writeDoctype(self._c_out, _xcstr(doctype))
 *             self._status = WRITER_DTD_WRITTEN
*/
    goto __pyx_L6;
  }

  /* "src/lxml/serializer.pxi":1422
 *             self._status = WRITER_DTD_WRITTEN
 *         else:
 *             self._status = WRITER_DECL_WRITTEN             # <<<<<<<<<<<<<<
 *         if not self._buffered:
 *             tree.xmlOutputBufferFlush(self._c_out)
*/
  /*else*/ {
    __pyx_v_self->_status = __pyx_e_4lxml_5etree_WRITER_DECL_WRITTEN;
  }
  __pyx_L6:;

  /* "src/lxml/serializer.pxi":1423
 *         else:
 *             self._status = WRITER_DECL_WRITTEN
 *         if not self._buffered:             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferFlush(self._c_out)
 *         self._handle_error(self._c_out.error)
*/
  __pyx_t_1 = (!__pyx_v_self->_buffered);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1424
 *             self._status = WRITER_DECL_WRITTEN
 *         if not self._buffered:
 *             tree.xmlOutputBufferFlush(self._c_out)             # <<<<<<<<<<<<<<
 *         self._handle_error(self._c_out.error)
 * 
*/
    (void)(xmlOutputBufferFlush(__pyx_v_self->_c_out));

    /* "src/lxml/serializer.pxi":1423
 *         else:
 *             self._status = WRITER_DECL_WRITTEN
 *         if not self._buffered:             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferFlush(self._c_out)
 *         self._handle_error(self._c_out.error)
*/
  }

  /* "src/lxml/serializer.pxi":1425
 *         if not self._buffered:
 *             tree.xmlOutputBufferFlush(self._c_out)
 *         self._handle_error(self._c_out.error)             # <<<<<<<<<<<<<<
 * 
 *     def write_doctype(self, doctype):
*/
  __pyx_t_2 = __pyx_f_4lxml_5etree_22_IncrementalFileWriter__handle_error(__pyx_v_self, __pyx_v_self->_c_out->error); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1425, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/serializer.pxi":1398
 *             tree.xmlOutputBufferClose(self._c_out)
 * 
 *     def write_declaration(self, version=None, standalone=None, doctype=None):             # <<<<<<<<<<<<<<
 *         """write_declaration(self, version=None, standalone=None, doctype=None)
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._IncrementalFileWriter.write_declaration", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_version);
  __Pyx_XDECREF(__pyx_v_doctype);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1427
 *         self._handle_error(self._c_out.error)
 * 
 *     def write_doctype(self, doctype):             # <<<<<<<<<<<<<<
 *         """write_doctype(self, doctype)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_22_IncrementalFileWriter_7write_doctype(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_22_IncrementalFileWriter_6write_doctype, "write_doctype(self, doctype)\n\n        Writes the given doctype declaration verbatimly into the file.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_22_IncrementalFileWriter_7write_doctype = {"write_doctype", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_22_IncrementalFileWriter_7write_doctype, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_22_IncrementalFileWriter_6write_doctype};
static PyObject *__pyx_pw_4lxml_5etree_22_IncrementalFileWriter_7write_doctype(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_doctype = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write_doctype (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_doctype,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(6, 1427, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 1427, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "write_doctype", 0) < (0)) __PYX_ERR(6, 1427, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("write_doctype", 1, 1, 1, i); __PYX_ERR(6, 1427, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 1427, __pyx_L3_error)
    }
    __pyx_v_doctype = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("write_doctype", 1, 1, 1, __pyx_nargs); __PYX_ERR(6, 1427, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._IncrementalFileWriter.write_doctype", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_22_IncrementalFileWriter_6write_doctype(((struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *)__pyx_v_self), __pyx_v_doctype);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_22_IncrementalFileWriter_6write_doctype(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_doctype) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("write_doctype", 0);
  __Pyx_INCREF(__pyx_v_doctype);

  /* "src/lxml/serializer.pxi":1432
 *         Writes the given doctype declaration verbatimly into the file.
 *         """
 *         assert self._c_out is not NULL             # <<<<<<<<<<<<<<
 *         if doctype is None:
 *             return
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = (__pyx_v_self->_c_out != NULL);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
      __PYX_ERR(6, 1432, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(6, 1432, __pyx_L1_error)
  #endif

  /* "src/lxml/serializer.pxi":1433
 *         """
 *         assert self._c_out is not NULL
 *         if doctype is None:             # <<<<<<<<<<<<<<
 *             return
 *         if self._status >= WRITER_DTD_WRITTEN:
*/
  __pyx_t_1 = (__pyx_v_doctype == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1434
 *         assert self._c_out is not NULL
 *         if doctype is None:
 *             return             # <<<<<<<<<<<<<<
 *         if self._status >= WRITER_DTD_WRITTEN:
 *             raise LxmlSyntaxError("DOCTYPE already written or cannot write it here")
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/serializer.pxi":1433
 *         """
 *         assert self._c_out is not NULL
 *         if doctype is None:             # <<<<<<<<<<<<<<
 *             return
 *         if self._status >= WRITER_DTD_WRITTEN:
*/
  }

  /* "src/lxml/serializer.pxi":1435
 *         if doctype is None:
 *             return
 *         if self._status >= WRITER_DTD_WRITTEN:             # <<<<<<<<<<<<<<
 *             raise LxmlSyntaxError("DOCTYPE already written or cannot write it here")
 *         doctype = _utf8(doctype)
*/
  __pyx_t_1 = (__pyx_v_self->_status >= __pyx_e_4lxml_5etree_WRITER_DTD_WRITTEN);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/serializer.pxi":1436
 *             return
 *         if self._status >= WRITER_DTD_WRITTEN:
 *             raise LxmlSyntaxError("DOCTYPE already written or cannot write it here")             # <<<<<<<<<<<<<<
 *         doctype = _utf8(doctype)
 *         _writeDoctype(self._c_out, _xcstr(doctype))
*/
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_LxmlSyntaxError); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 1436, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_DOCTYPE_already_written_or_canno};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1436, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(6, 1436, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":1435
 *         if doctype is None:
 *             return
 *         if self._status >= WRITER_DTD_WRITTEN:             # <<<<<<<<<<<<<<
 *             raise LxmlSyntaxError("DOCTYPE already written or cannot write it here")
 *         doctype = _utf8(doctype)
*/
  }

  /* "src/lxml/serializer.pxi":1437
 *         if self._status >= WRITER_DTD_WRITTEN:
 *             raise LxmlSyntaxError("DOCTYPE already written or cannot write it here")
 *         doctype = _utf8(doctype)             # <<<<<<<<<<<<<<
 *         _writeDoctype(self._c_out, _xcstr(doctype))
 *         self._status = WRITER_DTD_WRITTEN
*/
  __pyx_t_2 = __pyx_f_4lxml_5etree__utf8(__pyx_v_doctype); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1437, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_doctype, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/serializer.pxi":1438
 *             raise LxmlSyntaxError("DOCTYPE already written or cannot write it here")
 *         doctype = _utf8(doctype)
 *         _writeDoctype(self._c_out, _xcstr(doctype))             # <<<<<<<<<<<<<<
 *         self._status = WRITER_DTD_WRITTEN
 *         if not self._buffered:
*/
  __pyx_f_4lxml_5etree__writeDoctype(__pyx_v_self->_c_out, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_doctype));

  /* "src/lxml/serializer.pxi":1439
 *         doctype = _utf8(doctype)
 *         _writeDoctype(self._c_out, _xcstr(doctype))
 *         self._status = WRITER_DTD_WRITTEN             # <<<<<<<<<<<<<<
 *         if not self._buffered:
 *             tree.xmlOutputBufferFlush(self._c_out)
*/
  __pyx_v_self->_status = __pyx_e_4lxml_5etree_WRITER_DTD_WRITTEN;

  /* "src/lxml/serializer.pxi":1440
 *         _writeDoctype(self._c_out, _xcstr(doctype))
 *         self._status = WRITER_DTD_WRITTEN
 *         if not self._buffered:             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferFlush(self._c_out)
 *         self._handle_error(self._c_out.error)
*/
  __pyx_t_1 = (!__pyx_v_self->_buffered);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1441
 *         self._status = WRITER_DTD_WRITTEN
 *         if not self._buffered:
 *             tree.xmlOutputBufferFlush(self._c_out)             # <<<<<<<<<<<<<<
 *         self._handle_error(self._c_out.error)
 * 
*/
    (void)(xmlOutputBufferFlush(__pyx_v_self->_c_out));

    /* "src/lxml/serializer.pxi":1440
 *         _writeDoctype(self._c_out, _xcstr(doctype))
 *         self._status = WRITER_DTD_WRITTEN
 *         if not self._buffered:             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferFlush(self._c_out)
 *         self._handle_error(self._c_out.error)
*/
  }

  /* "src/lxml/serializer.pxi":1442
 *         if not self._buffered:
 *             tree.xmlOutputBufferFlush(self._c_out)
 *         self._handle_error(self._c_out.error)             # <<<<<<<<<<<<<<
 * 
 *     def method(self, method):
*/
  __pyx_t_2 = __pyx_f_4lxml_5etree_22_IncrementalFileWriter__handle_error(__pyx_v_self, __pyx_v_self->_c_out->error); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1442, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/serializer.pxi":1427
 *         self._handle_error(self._c_out.error)
 * 
 *     def write_doctype(self, doctype):             # <<<<<<<<<<<<<<
 *         """write_doctype(self, doctype)
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._IncrementalFileWriter.write_doctype", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_doctype);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1444
 *         self._handle_error(self._c_out.error)
 * 
 *     def method(self, method):             # <<<<<<<<<<<<<<
 *         """method(self, method)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_22_IncrementalFileWriter_9method(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_22_IncrementalFileWriter_8method, "method(self, method)\n\n        Returns a context manager that overrides and restores the output method.\n        method is one of (None, 'xml', 'html') where None means 'xml'.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_22_IncrementalFileWriter_9method = {"method", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_22_IncrementalFileWriter_9method, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_22_IncrementalFileWriter_8method};
static PyObject *__pyx_pw_4lxml_5etree_22_IncrementalFileWriter_9method(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_method = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("method (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_method,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(6, 1444, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 1444, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "method", 0) < (0)) __PYX_ERR(6, 1444, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("method", 1, 1, 1, i); __PYX_ERR(6, 1444, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 1444, __pyx_L3_error)
    }
    __pyx_v_method = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("method", 1, 1, 1, __pyx_nargs); __PYX_ERR(6, 1444, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._IncrementalFileWriter.method", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_22_IncrementalFileWriter_8method(((struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *)__pyx_v_self), __pyx_v_method);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_22_IncrementalFileWriter_8method(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_method) {
  int __pyx_v_c_method;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  size_t __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("method", 0);

  /* "src/lxml/serializer.pxi":1450
 *         method is one of (None, 'xml', 'html') where None means 'xml'.
 *         """
 *         assert self._c_out is not NULL             # <<<<<<<<<<<<<<
 *         c_method = self._method if method is None else _findOutputMethod(method)
 *         return _MethodChanger(self, c_method)
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = (__pyx_v_self->_c_out != NULL);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
      __PYX_ERR(6, 1450, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(6, 1450, __pyx_L1_error)
  #endif

  /* "src/lxml/serializer.pxi":1451
 *         """
 *         assert self._c_out is not NULL
 *         c_method = self._method if method is None else _findOutputMethod(method)             # <<<<<<<<<<<<<<
 *         return _MethodChanger(self, c_method)
 * 
*/
  __pyx_t_1 = (__pyx_v_method == Py_None);
  if (__pyx_t_1) {
    __pyx_t_2 = __pyx_v_self->_method;
  } else {
    __pyx_t_3 = __pyx_f_4lxml_5etree__findOutputMethod(__pyx_v_method); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(6, 1451, __pyx_L1_error)
    __pyx_t_2 = __pyx_t_3;
  }
  __pyx_v_c_method = __pyx_t_2;

  /* "src/lxml/serializer.pxi":1452
 *         assert self._c_out is not NULL
 *         c_method = self._method if method is None else _findOutputMethod(method)
 *         return _MethodChanger(self, c_method)             # <<<<<<<<<<<<<<
 * 
 *     def element(self, tag, attrib=None, nsmap=None, method=None, **_extra):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = NULL;
  __pyx_t_6 = __Pyx_PyLong_From_int(__pyx_v_c_method); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 1452, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = 1;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_5, ((PyObject *)__pyx_v_self), __pyx_t_6};
    __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__MethodChanger, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 1452, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_4);
  }
  __pyx_r = ((PyObject *)__pyx_t_4);
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "src/lxml/serializer.pxi":1444
 *         self._handle_error(self._c_out.error)
 * 
 *     def method(self, method):             # <<<<<<<<<<<<<<
 *         """method(self, method)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._IncrementalFileWriter.method", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1454
 *         return _MethodChanger(self, c_method)
 * 
 *     def element(self, tag, attrib=None, nsmap=None, method=None, **_extra):             # <<<<<<<<<<<<<<
 *         """element(self, tag, attrib=None, nsmap=None, method, **_extra)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_22_IncrementalFileWriter_11element(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_22_IncrementalFileWriter_10element, "element(self, tag, attrib=None, nsmap=None, method, **_extra)\n\n        Returns a context manager that writes an opening and closing tag.\n        method is one of (None, 'xml', 'html') where None means 'xml'.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_22_IncrementalFileWriter_11element = {"element", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_22_IncrementalFileWriter_11element, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_22_IncrementalFileWriter_10element};
static PyObject *__pyx_pw_4lxml_5etree_22_IncrementalFileWriter_11element(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_v_attrib = 0;
  PyObject *__pyx_v_nsmap = 0;
  PyObject *__pyx_v_method = 0;
  PyObject *__pyx_v__extra = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[4] = {0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("element (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  __pyx_v__extra = PyDict_New(); if (unlikely(!__pyx_v__extra)) return NULL;
  __Pyx_GOTREF(__pyx_v__extra);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_tag,&__pyx_mstate_global->__pyx_n_u_attrib,&__pyx_mstate_global->__pyx_n_u_nsmap,&__pyx_mstate_global->__pyx_n_u_method,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(6, 1454, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(6, 1454, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(6, 1454, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(6, 1454, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 1454, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v__extra, values, kwd_pos_args, __pyx_kwds_len, "element", 1) < (0)) __PYX_ERR(6, 1454, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("element", 0, 1, 4, i); __PYX_ERR(6, 1454, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(6, 1454, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(6, 1454, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(6, 1454, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 1454, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_tag = values[0];
    __pyx_v_attrib = values[1];
    __pyx_v_nsmap = values[2];
    __pyx_v_method = values[3];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("element", 0, 1, 4, __pyx_nargs); __PYX_ERR(6, 1454, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v__extra); __pyx_v__extra = 0;
  __Pyx_AddTraceback("lxml.etree._IncrementalFileWriter.element", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_22_IncrementalFileWriter_10element(((struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *)__pyx_v_self), __pyx_v_tag, __pyx_v_attrib, __pyx_v_nsmap, __pyx_v_method, __pyx_v__extra);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v__extra);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_22_IncrementalFileWriter_10element(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_attrib, PyObject *__pyx_v_nsmap, PyObject *__pyx_v_method, PyObject *__pyx_v__extra) {
  PyObject *__pyx_v_attributes = NULL;
  PyObject *__pyx_v_name = NULL;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_v_ns = NULL;
  PyObject *__pyx_v_reversed_nsmap = NULL;
  PyObject *__pyx_v_prefix = NULL;
  int __pyx_v_c_method;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *(*__pyx_t_9)(PyObject *);
  int __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  size_t __pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("element", 0);

  /* "src/lxml/serializer.pxi":1460
 *         method is one of (None, 'xml', 'html') where None means 'xml'.
 *         """
 *         assert self._c_out is not NULL             # <<<<<<<<<<<<<<
 *         attributes = []
 *         if attrib is not None:
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = (__pyx_v_self->_c_out != NULL);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
      __PYX_ERR(6, 1460, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(6, 1460, __pyx_L1_error)
  #endif

  /* "src/lxml/serializer.pxi":1461
 *         """
 *         assert self._c_out is not NULL
 *         attributes = []             # <<<<<<<<<<<<<<
 *         if attrib is not None:
 *             for name, value in _iter_attrib(attrib):
*/
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1461, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_attributes = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/serializer.pxi":1462
 *         assert self._c_out is not NULL
 *         attributes = []
 *         if attrib is not None:             # <<<<<<<<<<<<<<
 *             for name, value in _iter_attrib(attrib):
 *                 if name not in _extra:
*/
  __pyx_t_1 = (__pyx_v_attrib != Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1463
 *         attributes = []
 *         if attrib is not None:
 *             for name, value in _iter_attrib(attrib):             # <<<<<<<<<<<<<<
 *                 if name not in _extra:
 *                     ns, name = _getNsTag(name)
*/
    __pyx_t_2 = __pyx_f_4lxml_5etree__iter_attrib(__pyx_v_attrib); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1463, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
      __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3);
      __pyx_t_4 = 0;
      __pyx_t_5 = NULL;
    } else {
      __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1463, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 1463, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    for (;;) {
      if (likely(!__pyx_t_5)) {
        if (likely(PyList_CheckExact(__pyx_t_3))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(6, 1463, __pyx_L1_error)
            #endif
            if (__pyx_t_4 >= __pyx_temp) break;
          }
          __pyx_t_2 = __Pyx_PyList_GetItemRefFast(__pyx_t_3, __pyx_t_4, __Pyx_ReferenceSharing_OwnStrongReference);
          ++__pyx_t_4;
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(6, 1463, __pyx_L1_error)
            #endif
            if (__pyx_t_4 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4));
          #else
          __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_4);
          #endif
          ++__pyx_t_4;
        }
        if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1463, __pyx_L1_error)
      } else {
        __pyx_t_2 = __pyx_t_5(__pyx_t_3);
        if (unlikely(!__pyx_t_2)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(6, 1463, __pyx_L1_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_2);
      if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
        PyObject* sequence = __pyx_t_2;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(6, 1463, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0);
          __Pyx_INCREF(__pyx_t_6);
          __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1);
          __Pyx_INCREF(__pyx_t_7);
        } else {
          __pyx_t_6 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
          if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 1463, __pyx_L1_error)
          __Pyx_XGOTREF(__pyx_t_6);
          __pyx_t_7 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
          if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 1463, __pyx_L1_error)
          __Pyx_XGOTREF(__pyx_t_7);
        }
        #else
        __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 1463, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_7 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 1463, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        #endif
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_8 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 1463, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_9 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_8);
        index = 0; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_6);
        index = 1; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L6_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_7);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < (0)) __PYX_ERR(6, 1463, __pyx_L1_error)
        __pyx_t_9 = NULL;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L7_unpacking_done;
        __pyx_L6_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_9 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(6, 1463, __pyx_L1_error)
        __pyx_L7_unpacking_done:;
      }
      __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_6);
      __pyx_t_6 = 0;
      __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_7);
      __pyx_t_7 = 0;

      /* "src/lxml/serializer.pxi":1464
 *         if attrib is not None:
 *             for name, value in _iter_attrib(attrib):
 *                 if name not in _extra:             # <<<<<<<<<<<<<<
 *                     ns, name = _getNsTag(name)
 *                     attributes.append((ns, name, _utf8(value)))
*/
      __pyx_t_1 = (__Pyx_PyDict_ContainsTF(__pyx_v_name, __pyx_v__extra, Py_NE)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(6, 1464, __pyx_L1_error)
      if (__pyx_t_1) {

        /* "src/lxml/serializer.pxi":1465
 *             for name, value in _iter_attrib(attrib):
 *                 if name not in _extra:
 *                     ns, name = _getNsTag(name)             # <<<<<<<<<<<<<<
 *                     attributes.append((ns, name, _utf8(value)))
 *         if _extra:
*/
        __pyx_t_2 = __pyx_f_4lxml_5etree__getNsTag(__pyx_v_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1465, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        if (likely(__pyx_t_2 != Py_None)) {
          PyObject* sequence = __pyx_t_2;
          Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(sequence);
          if (unlikely(size != 2)) {
            if (size > 2) __Pyx_RaiseTooManyValuesError(2);
            else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
            __PYX_ERR(6, 1465, __pyx_L1_error)
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0);
          __Pyx_INCREF(__pyx_t_7);
          __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1);
          __Pyx_INCREF(__pyx_t_6);
          #else
          __pyx_t_7 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 1465, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 1465, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          #endif
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        } else {
          __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(6, 1465, __pyx_L1_error)
        }
        __Pyx_XDECREF_SET(__pyx_v_ns, __pyx_t_7);
        __pyx_t_7 = 0;
        __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_6);
        __pyx_t_6 = 0;

        /* "src/lxml/serializer.pxi":1466
 *                 if name not in _extra:
 *                     ns, name = _getNsTag(name)
 *                     attributes.append((ns, name, _utf8(value)))             # <<<<<<<<<<<<<<
 *         if _extra:
 *             for name, value in _extra.iteritems():
*/
        __pyx_t_2 = __pyx_f_4lxml_5etree__utf8(__pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1466, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 1466, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_INCREF(__pyx_v_ns);
        __Pyx_GIVEREF(__pyx_v_ns);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_ns) != (0)) __PYX_ERR(6, 1466, __pyx_L1_error);
        __Pyx_INCREF(__pyx_v_name);
        __Pyx_GIVEREF(__pyx_v_name);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_name) != (0)) __PYX_ERR(6, 1466, __pyx_L1_error);
        __Pyx_GIVEREF(__pyx_t_2);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_2) != (0)) __PYX_ERR(6, 1466, __pyx_L1_error);
        __pyx_t_2 = 0;
        __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_attributes, __pyx_t_6); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(6, 1466, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

        /* "src/lxml/serializer.pxi":1464
 *         if attrib is not None:
 *             for name, value in _iter_attrib(attrib):
 *                 if name not in _extra:             # <<<<<<<<<<<<<<
 *                     ns, name = _getNsTag(name)
 *                     attributes.append((ns, name, _utf8(value)))
*/
      }

      /* "src/lxml/serializer.pxi":1463
 *         attributes = []
 *         if attrib is not None:
 *             for name, value in _iter_attrib(attrib):             # <<<<<<<<<<<<<<
 *                 if name not in _extra:
 *                     ns, name = _getNsTag(name)
*/
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":1462
 *         assert self._c_out is not NULL
 *         attributes = []
 *         if attrib is not None:             # <<<<<<<<<<<<<<
 *             for name, value in _iter_attrib(attrib):
 *                 if name not in _extra:
*/
  }

  /* "src/lxml/serializer.pxi":1467
 *                     ns, name = _getNsTag(name)
 *                     attributes.append((ns, name, _utf8(value)))
 *         if _extra:             # <<<<<<<<<<<<<<
 *             for name, value in _extra.iteritems():
 *                 ns, name = _getNsTag(name)
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v__extra); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(6, 1467, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1468
 *                     attributes.append((ns, name, _utf8(value)))
 *         if _extra:
 *             for name, value in _extra.iteritems():             # <<<<<<<<<<<<<<
 *                 ns, name = _getNsTag(name)
 *                 attributes.append((ns, name, _utf8(value)))
*/
    __pyx_t_4 = 0;
    __pyx_t_6 = __Pyx_dict_iterator(__pyx_v__extra, 1, __pyx_mstate_global->__pyx_n_u_iteritems, (&__pyx_t_11), (&__pyx_t_12)); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 1468, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_3);
    __pyx_t_3 = __pyx_t_6;
    __pyx_t_6 = 0;
    while (1) {
      __pyx_t_13 = __Pyx_dict_iter_next(__pyx_t_3, __pyx_t_11, &__pyx_t_4, &__pyx_t_6, &__pyx_t_2, NULL, __pyx_t_12);
      if (unlikely(__pyx_t_13 == 0)) break;
      if (unlikely(__pyx_t_13 == -1)) __PYX_ERR(6, 1468, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_6);
      __pyx_t_6 = 0;
      __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "src/lxml/serializer.pxi":1469
 *         if _extra:
 *             for name, value in _extra.iteritems():
 *                 ns, name = _getNsTag(name)             # <<<<<<<<<<<<<<
 *                 attributes.append((ns, name, _utf8(value)))
 *         reversed_nsmap = {}
*/
      __pyx_t_2 = __pyx_f_4lxml_5etree__getNsTag(__pyx_v_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1469, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (likely(__pyx_t_2 != Py_None)) {
        PyObject* sequence = __pyx_t_2;
        Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(6, 1469, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0);
        __Pyx_INCREF(__pyx_t_6);
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1);
        __Pyx_INCREF(__pyx_t_7);
        #else
        __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 1469, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_7 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 1469, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        #endif
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else {
        __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(6, 1469, __pyx_L1_error)
      }
      __Pyx_XDECREF_SET(__pyx_v_ns, __pyx_t_6);
      __pyx_t_6 = 0;
      __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_7);
      __pyx_t_7 = 0;

      /* "src/lxml/serializer.pxi":1470
 *             for name, value in _extra.iteritems():
 *                 ns, name = _getNsTag(name)
 *                 attributes.append((ns, name, _utf8(value)))             # <<<<<<<<<<<<<<
 *         reversed_nsmap = {}
 *         if nsmap:
*/
      __pyx_t_2 = __pyx_f_4lxml_5etree__utf8(__pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1470, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 1470, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_v_ns);
      __Pyx_GIVEREF(__pyx_v_ns);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_ns) != (0)) __PYX_ERR(6, 1470, __pyx_L1_error);
      __Pyx_INCREF(__pyx_v_name);
      __Pyx_GIVEREF(__pyx_v_name);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_name) != (0)) __PYX_ERR(6, 1470, __pyx_L1_error);
      __Pyx_GIVEREF(__pyx_t_2);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_2) != (0)) __PYX_ERR(6, 1470, __pyx_L1_error);
      __pyx_t_2 = 0;
      __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_attributes, __pyx_t_7); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(6, 1470, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":1467
 *                     ns, name = _getNsTag(name)
 *                     attributes.append((ns, name, _utf8(value)))
 *         if _extra:             # <<<<<<<<<<<<<<
 *             for name, value in _extra.iteritems():
 *                 ns, name = _getNsTag(name)
*/
  }

  /* "src/lxml/serializer.pxi":1471
 *                 ns, name = _getNsTag(name)
 *                 attributes.append((ns, name, _utf8(value)))
 *         reversed_nsmap = {}             # <<<<<<<<<<<<<<
 *         if nsmap:
 *             for prefix, ns in nsmap.items():
*/
  __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1471, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_reversed_nsmap = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/serializer.pxi":1472
 *                 attributes.append((ns, name, _utf8(value)))
 *         reversed_nsmap = {}
 *         if nsmap:             # <<<<<<<<<<<<<<
 *             for prefix, ns in nsmap.items():
 *                 if prefix is not None:
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_nsmap); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(6, 1472, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1473
 *         reversed_nsmap = {}
 *         if nsmap:
 *             for prefix, ns in nsmap.items():             # <<<<<<<<<<<<<<
 *                 if prefix is not None:
 *                     prefix = _utf8(prefix)
*/
    __pyx_t_11 = 0;
    if (unlikely(__pyx_v_nsmap == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
      __PYX_ERR(6, 1473, __pyx_L1_error)
    }
    __pyx_t_7 = __Pyx_dict_iterator(__pyx_v_nsmap, 0, __pyx_mstate_global->__pyx_n_u_items, (&__pyx_t_4), (&__pyx_t_12)); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 1473, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_XDECREF(__pyx_t_3);
    __pyx_t_3 = __pyx_t_7;
    __pyx_t_7 = 0;
    while (1) {
      __pyx_t_13 = __Pyx_dict_iter_next(__pyx_t_3, __pyx_t_4, &__pyx_t_11, &__pyx_t_7, &__pyx_t_2, NULL, __pyx_t_12);
      if (unlikely(__pyx_t_13 == 0)) break;
      if (unlikely(__pyx_t_13 == -1)) __PYX_ERR(6, 1473, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_XDECREF_SET(__pyx_v_prefix, __pyx_t_7);
      __pyx_t_7 = 0;
      __Pyx_XDECREF_SET(__pyx_v_ns, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "src/lxml/serializer.pxi":1474
 *         if nsmap:
 *             for prefix, ns in nsmap.items():
 *                 if prefix is not None:             # <<<<<<<<<<<<<<
 *                     prefix = _utf8(prefix)
 *                     _prefixValidOrRaise(prefix)
*/
      __pyx_t_1 = (__pyx_v_prefix != Py_None);
      if (__pyx_t_1) {

        /* "src/lxml/serializer.pxi":1475
 *             for prefix, ns in nsmap.items():
 *                 if prefix is not None:
 *                     prefix = _utf8(prefix)             # <<<<<<<<<<<<<<
 *                     _prefixValidOrRaise(prefix)
 *                 reversed_nsmap[_utf8(ns)] = prefix
*/
        __pyx_t_2 = __pyx_f_4lxml_5etree__utf8(__pyx_v_prefix); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1475, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF_SET(__pyx_v_prefix, __pyx_t_2);
        __pyx_t_2 = 0;

        /* "src/lxml/serializer.pxi":1476
 *                 if prefix is not None:
 *                     prefix = _utf8(prefix)
 *                     _prefixValidOrRaise(prefix)             # <<<<<<<<<<<<<<
 *                 reversed_nsmap[_utf8(ns)] = prefix
 *         ns, name = _getNsTag(tag)
*/
        __pyx_t_13 = __pyx_f_4lxml_5etree__prefixValidOrRaise(__pyx_v_prefix); if (unlikely(__pyx_t_13 == ((int)-1))) __PYX_ERR(6, 1476, __pyx_L1_error)

        /* "src/lxml/serializer.pxi":1474
 *         if nsmap:
 *             for prefix, ns in nsmap.items():
 *                 if prefix is not None:             # <<<<<<<<<<<<<<
 *                     prefix = _utf8(prefix)
 *                     _prefixValidOrRaise(prefix)
*/
      }

      /* "src/lxml/serializer.pxi":1477
 *                     prefix = _utf8(prefix)
 *                     _prefixValidOrRaise(prefix)
 *                 reversed_nsmap[_utf8(ns)] = prefix             # <<<<<<<<<<<<<<
 *         ns, name = _getNsTag(tag)
 * 
*/
      __pyx_t_2 = __pyx_f_4lxml_5etree__utf8(__pyx_v_ns); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1477, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (unlikely((PyDict_SetItem(__pyx_v_reversed_nsmap, __pyx_t_2, __pyx_v_prefix) < 0))) __PYX_ERR(6, 1477, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":1472
 *                 attributes.append((ns, name, _utf8(value)))
 *         reversed_nsmap = {}
 *         if nsmap:             # <<<<<<<<<<<<<<
 *             for prefix, ns in nsmap.items():
 *                 if prefix is not None:
*/
  }

  /* "src/lxml/serializer.pxi":1478
 *                     _prefixValidOrRaise(prefix)
 *                 reversed_nsmap[_utf8(ns)] = prefix
 *         ns, name = _getNsTag(tag)             # <<<<<<<<<<<<<<
 * 
 *         c_method = self._method if method is None else _findOutputMethod(method)
*/
  __pyx_t_3 = __pyx_f_4lxml_5etree__getNsTag(__pyx_v_tag); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1478, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (likely(__pyx_t_3 != Py_None)) {
    PyObject* sequence = __pyx_t_3;
    Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(6, 1478, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1);
    __Pyx_INCREF(__pyx_t_7);
    #else
    __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1478, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 1478, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    #endif
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(6, 1478, __pyx_L1_error)
  }
  __Pyx_XDECREF_SET(__pyx_v_ns, __pyx_t_2);
  __pyx_t_2 = 0;
  __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_7);
  __pyx_t_7 = 0;

  /* "src/lxml/serializer.pxi":1480
 *         ns, name = _getNsTag(tag)
 * 
 *         c_method = self._method if method is None else _findOutputMethod(method)             # <<<<<<<<<<<<<<
 * 
 *         return _FileWriterElement(self, (ns, name, attributes, reversed_nsmap), c_method)
*/
  __pyx_t_1 = (__pyx_v_method == Py_None);
  if (__pyx_t_1) {
    __pyx_t_12 = __pyx_v_self->_method;
  } else {
    __pyx_t_13 = __pyx_f_4lxml_5etree__findOutputMethod(__pyx_v_method); if (unlikely(__pyx_t_13 == ((int)-1))) __PYX_ERR(6, 1480, __pyx_L1_error)
    __pyx_t_12 = __pyx_t_13;
  }
  __pyx_v_c_method = __pyx_t_12;

  /* "src/lxml/serializer.pxi":1482
 *         c_method = self._method if method is None else _findOutputMethod(method)
 * 
 *         return _FileWriterElement(self, (ns, name, attributes, reversed_nsmap), c_method)             # <<<<<<<<<<<<<<
 * 
 *     cdef _write_qname(self, bytes name, bytes prefix):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_7 = NULL;
  __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1482, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_ns);
  __Pyx_GIVEREF(__pyx_v_ns);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_ns) != (0)) __PYX_ERR(6, 1482, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_name);
  __Pyx_GIVEREF(__pyx_v_name);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_name) != (0)) __PYX_ERR(6, 1482, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_attributes);
  __Pyx_GIVEREF(__pyx_v_attributes);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_attributes) != (0)) __PYX_ERR(6, 1482, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_reversed_nsmap);
  __Pyx_GIVEREF(__pyx_v_reversed_nsmap);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_reversed_nsmap) != (0)) __PYX_ERR(6, 1482, __pyx_L1_error);
  __pyx_t_6 = __Pyx_PyLong_From_int(__pyx_v_c_method); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 1482, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_14 = 1;
  {
    PyObject *__pyx_callargs[4] = {__pyx_t_7, ((PyObject *)__pyx_v_self), __pyx_t_2, __pyx_t_6};
    __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__FileWriterElement, __pyx_callargs+__pyx_t_14, (4-__pyx_t_14) | (__pyx_t_14*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1482, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_3);
  }
  __pyx_r = ((PyObject *)__pyx_t_3);
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "src/lxml/serializer.pxi":1454
 *         return _MethodChanger(self, c_method)
 * 
 *     def element(self, tag, attrib=None, nsmap=None, method=None, **_extra):             # <<<<<<<<<<<<<<
 *         """element(self, tag, attrib=None, nsmap=None, method, **_extra)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("lxml.etree._IncrementalFileWriter.element", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_attributes);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XDECREF(__pyx_v_ns);
  __Pyx_XDECREF(__pyx_v_reversed_nsmap);
  __Pyx_XDECREF(__pyx_v_prefix);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1484
 *         return _FileWriterElement(self, (ns, name, attributes, reversed_nsmap), c_method)
 * 
 *     cdef _write_qname(self, bytes name, bytes prefix):             # <<<<<<<<<<<<<<
 *         if prefix:  # empty bytes for no prefix (not None to allow sorting)
 *             tree.xmlOutputBufferWrite(self._c_out, len(prefix), _cstr(prefix))
*/

static PyObject *__pyx_f_4lxml_5etree_22_IncrementalFileWriter__write_qname(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_prefix) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_write_qname", 0);

  /* "src/lxml/serializer.pxi":1485
 * 
 *     cdef _write_qname(self, bytes name, bytes prefix):
 *         if prefix:  # empty bytes for no prefix (not None to allow sorting)             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferWrite(self._c_out, len(prefix), _cstr(prefix))
 *             tree.xmlOutputBufferWrite(self._c_out, 1, ':')
*/
  if (__pyx_v_prefix == Py_None) __pyx_t_1 = 0;
  else
  {
    Py_ssize_t __pyx_temp = __Pyx_PyBytes_GET_SIZE(__pyx_v_prefix);
    if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(6, 1485, __pyx_L1_error)
    __pyx_t_1 = (__pyx_temp != 0);
  }

  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1486
 *     cdef _write_qname(self, bytes name, bytes prefix):
 *         if prefix:  # empty bytes for no prefix (not None to allow sorting)
 *             tree.xmlOutputBufferWrite(self._c_out, len(prefix), _cstr(prefix))             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferWrite(self._c_out, 1, ':')
 *         tree.xmlOutputBufferWrite(self._c_out, len(name), _cstr(name))
*/
    if (unlikely(__pyx_v_prefix == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
      __PYX_ERR(6, 1486, __pyx_L1_error)
    }
    __pyx_t_2 = __Pyx_PyBytes_GET_SIZE(__pyx_v_prefix); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(6, 1486, __pyx_L1_error)
    (void)(xmlOutputBufferWrite(__pyx_v_self->_c_out, __pyx_t_2, PyBytes_AS_STRING(__pyx_v_prefix)));

    /* "src/lxml/serializer.pxi":1487
 *         if prefix:  # empty bytes for no prefix (not None to allow sorting)
 *             tree.xmlOutputBufferWrite(self._c_out, len(prefix), _cstr(prefix))
 *             tree.xmlOutputBufferWrite(self._c_out, 1, ':')             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferWrite(self._c_out, len(name), _cstr(name))
 * 
*/
    (void)(xmlOutputBufferWrite(__pyx_v_self->_c_out, 1, __pyx_k__9));

    /* "src/lxml/serializer.pxi":1485
 * 
 *     cdef _write_qname(self, bytes name, bytes prefix):
 *         if prefix:  # empty bytes for no prefix (not None to allow sorting)             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferWrite(self._c_out, len(prefix), _cstr(prefix))
 *             tree.xmlOutputBufferWrite(self._c_out, 1, ':')
*/
  }

  /* "src/lxml/serializer.pxi":1488
 *             tree.xmlOutputBufferWrite(self._c_out, len(prefix), _cstr(prefix))
 *             tree.xmlOutputBufferWrite(self._c_out, 1, ':')
 *         tree.xmlOutputBufferWrite(self._c_out, len(name), _cstr(name))             # <<<<<<<<<<<<<<
 * 
 *     cdef _write_start_element(self, element_config):
*/
  if (unlikely(__pyx_v_name == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(6, 1488, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyBytes_GET_SIZE(__pyx_v_name); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(6, 1488, __pyx_L1_error)
  (void)(xmlOutputBufferWrite(__pyx_v_self->_c_out, __pyx_t_2, PyBytes_AS_STRING(__pyx_v_name)));

  /* "src/lxml/serializer.pxi":1484
 *         return _FileWriterElement(self, (ns, name, attributes, reversed_nsmap), c_method)
 * 
 *     cdef _write_qname(self, bytes name, bytes prefix):             # <<<<<<<<<<<<<<
 *         if prefix:  # empty bytes for no prefix (not None to allow sorting)
 *             tree.xmlOutputBufferWrite(self._c_out, len(prefix), _cstr(prefix))
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._IncrementalFileWriter._write_qname", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1490
 *         tree.xmlOutputBufferWrite(self._c_out, len(name), _cstr(name))
 * 
 *     cdef _write_start_element(self, element_config):             # <<<<<<<<<<<<<<
 *         if self._status > WRITER_IN_ELEMENT:
 *             raise LxmlSyntaxError("cannot append trailing element to complete XML document")
*/

static PyObject *__pyx_f_4lxml_5etree_22_IncrementalFileWriter__write_start_element(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_element_config) {
  PyObject *__pyx_v_ns = NULL;
  PyObject *__pyx_v_name = NULL;
  PyObject *__pyx_v_attributes = NULL;
  PyObject *__pyx_v_nsmap = NULL;
  PyObject *__pyx_v_flat_namespace_map = NULL;
  PyObject *__pyx_v_new_namespaces = NULL;
  PyObject *__pyx_v_prefix = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_write_start_element", 0);

  /* "src/lxml/serializer.pxi":1491
 * 
 *     cdef _write_start_element(self, element_config):
 *         if self._status > WRITER_IN_ELEMENT:             # <<<<<<<<<<<<<<
 *             raise LxmlSyntaxError("cannot append trailing element to complete XML document")
 *         ns, name, attributes, nsmap = element_config
*/
  __pyx_t_1 = (__pyx_v_self->_status > __pyx_e_4lxml_5etree_WRITER_IN_ELEMENT);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/serializer.pxi":1492
 *     cdef _write_start_element(self, element_config):
 *         if self._status > WRITER_IN_ELEMENT:
 *             raise LxmlSyntaxError("cannot append trailing element to complete XML document")             # <<<<<<<<<<<<<<
 *         ns, name, attributes, nsmap = element_config
 *         flat_namespace_map, new_namespaces = self._collect_namespaces(nsmap)
*/
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_LxmlSyntaxError); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 1492, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_cannot_append_trailing_element_t};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1492, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(6, 1492, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":1491
 * 
 *     cdef _write_start_element(self, element_config):
 *         if self._status > WRITER_IN_ELEMENT:             # <<<<<<<<<<<<<<
 *             raise LxmlSyntaxError("cannot append trailing element to complete XML document")
 *         ns, name, attributes, nsmap = element_config
*/
  }

  /* "src/lxml/serializer.pxi":1493
 *         if self._status > WRITER_IN_ELEMENT:
 *             raise LxmlSyntaxError("cannot append trailing element to complete XML document")
 *         ns, name, attributes, nsmap = element_config             # <<<<<<<<<<<<<<
 *         flat_namespace_map, new_namespaces = self._collect_namespaces(nsmap)
 *         prefix = self._find_prefix(ns, flat_namespace_map, new_namespaces)
*/
  if ((likely(PyTuple_CheckExact(__pyx_v_element_config))) || (PyList_CheckExact(__pyx_v_element_config))) {
    PyObject* sequence = __pyx_v_element_config;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 4)) {
      if (size > 4) __Pyx_RaiseTooManyValuesError(4);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(6, 1493, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
      __Pyx_INCREF(__pyx_t_4);
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 2);
      __Pyx_INCREF(__pyx_t_3);
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 3);
      __Pyx_INCREF(__pyx_t_6);
    } else {
      __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
      if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1493, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_2);
      __pyx_t_4 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
      if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 1493, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_4);
      __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 2, __Pyx_ReferenceSharing_SharedReference);
      if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1493, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_3);
      __pyx_t_6 = __Pyx_PyList_GetItemRefFast(sequence, 3, __Pyx_ReferenceSharing_SharedReference);
      if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 1493, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_6);
    }
    #else
    {
      Py_ssize_t i;
      PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_4,&__pyx_t_3,&__pyx_t_6};
      for (i=0; i < 4; i++) {
        PyObject* item = __Pyx_PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(6, 1493, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
  } else {
    Py_ssize_t index = -1;
    PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_4,&__pyx_t_3,&__pyx_t_6};
    __pyx_t_7 = PyObject_GetIter(__pyx_v_element_config); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 1493, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7);
    for (index=0; index < 4; index++) {
      PyObject* item = __pyx_t_8(__pyx_t_7); if (unlikely(!item)) goto __pyx_L4_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 4) < (0)) __PYX_ERR(6, 1493, __pyx_L1_error)
    __pyx_t_8 = NULL;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    goto __pyx_L5_unpacking_done;
    __pyx_L4_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_8 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(6, 1493, __pyx_L1_error)
    __pyx_L5_unpacking_done:;
  }
  __pyx_v_ns = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_name = __pyx_t_4;
  __pyx_t_4 = 0;
  __pyx_v_attributes = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_nsmap = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "src/lxml/serializer.pxi":1494
 *             raise LxmlSyntaxError("cannot append trailing element to complete XML document")
 *         ns, name, attributes, nsmap = element_config
 *         flat_namespace_map, new_namespaces = self._collect_namespaces(nsmap)             # <<<<<<<<<<<<<<
 *         prefix = self._find_prefix(ns, flat_namespace_map, new_namespaces)
 *         tree.xmlOutputBufferWrite(self._c_out, 1, '<')
*/
  __pyx_t_6 = __pyx_v_nsmap;
  __Pyx_INCREF(__pyx_t_6);
  if (!(likely(PyDict_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_t_6))) __PYX_ERR(6, 1494, __pyx_L1_error)
  __pyx_t_3 = __pyx_f_4lxml_5etree_22_IncrementalFileWriter__collect_namespaces(__pyx_v_self, ((PyObject*)__pyx_t_6)); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1494, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
    PyObject* sequence = __pyx_t_3;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(6, 1494, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0);
      __Pyx_INCREF(__pyx_t_6);
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
      __Pyx_INCREF(__pyx_t_4);
    } else {
      __pyx_t_6 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
      if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 1494, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_6);
      __pyx_t_4 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
      if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 1494, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_4);
    }
    #else
    __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 1494, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 1494, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1494, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2);
    index = 0; __pyx_t_6 = __pyx_t_8(__pyx_t_2); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_6);
    index = 1; __pyx_t_4 = __pyx_t_8(__pyx_t_2); if (unlikely(!__pyx_t_4)) goto __pyx_L6_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_2), 2) < (0)) __PYX_ERR(6, 1494, __pyx_L1_error)
    __pyx_t_8 = NULL;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L7_unpacking_done;
    __pyx_L6_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_8 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(6, 1494, __pyx_L1_error)
    __pyx_L7_unpacking_done:;
  }
  __pyx_v_flat_namespace_map = __pyx_t_6;
  __pyx_t_6 = 0;
  __pyx_v_new_namespaces = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "src/lxml/serializer.pxi":1495
 *         ns, name, attributes, nsmap = element_config
 *         flat_namespace_map, new_namespaces = self._collect_namespaces(nsmap)
 *         prefix = self._find_prefix(ns, flat_namespace_map, new_namespaces)             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferWrite(self._c_out, 1, '<')
 *         self._write_qname(name, prefix)
*/
  __pyx_t_3 = __pyx_v_ns;
  __Pyx_INCREF(__pyx_t_3);
  if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_3))) __PYX_ERR(6, 1495, __pyx_L1_error)
  __pyx_t_4 = __pyx_v_flat_namespace_map;
  __Pyx_INCREF(__pyx_t_4);
  if (!(likely(PyDict_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_t_4))) __PYX_ERR(6, 1495, __pyx_L1_error)
  __pyx_t_6 = __pyx_v_new_namespaces;
  __Pyx_INCREF(__pyx_t_6);
  if (!(likely(PyList_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None) || __Pyx_RaiseUnexpectedTypeError("list", __pyx_t_6))) __PYX_ERR(6, 1495, __pyx_L1_error)
  __pyx_t_2 = __pyx_f_4lxml_5etree_22_IncrementalFileWriter__find_prefix(__pyx_v_self, ((PyObject*)__pyx_t_3), ((PyObject*)__pyx_t_4), ((PyObject*)__pyx_t_6)); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1495, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_v_prefix = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "src/lxml/serializer.pxi":1496
 *         flat_namespace_map, new_namespaces = self._collect_namespaces(nsmap)
 *         prefix = self._find_prefix(ns, flat_namespace_map, new_namespaces)
 *         tree.xmlOutputBufferWrite(self._c_out, 1, '<')             # <<<<<<<<<<<<<<
 *         self._write_qname(name, prefix)
 * 
*/
  (void)(xmlOutputBufferWrite(__pyx_v_self->_c_out, 1, __pyx_k__37));

  /* "src/lxml/serializer.pxi":1497
 *         prefix = self._find_prefix(ns, flat_namespace_map, new_namespaces)
 *         tree.xmlOutputBufferWrite(self._c_out, 1, '<')
 *         self._write_qname(name, prefix)             # <<<<<<<<<<<<<<
 * 
 *         self._write_attributes_and_namespaces(
*/
  __pyx_t_2 = __pyx_v_name;
  __Pyx_INCREF(__pyx_t_2);
  if (!(likely(PyBytes_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_2))) __PYX_ERR(6, 1497, __pyx_L1_error)
  __pyx_t_6 = __pyx_v_prefix;
  __Pyx_INCREF(__pyx_t_6);
  if (!(likely(PyBytes_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_6))) __PYX_ERR(6, 1497, __pyx_L1_error)
  __pyx_t_4 = __pyx_f_4lxml_5etree_22_IncrementalFileWriter__write_qname(__pyx_v_self, ((PyObject*)__pyx_t_2), ((PyObject*)__pyx_t_6)); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 1497, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "src/lxml/serializer.pxi":1500
 * 
 *         self._write_attributes_and_namespaces(
 *             attributes, flat_namespace_map, new_namespaces)             # <<<<<<<<<<<<<<
 * 
 *         tree.xmlOutputBufferWrite(self._c_out, 1, '>')
*/
  __pyx_t_4 = __pyx_v_attributes;
  __Pyx_INCREF(__pyx_t_4);
  if (!(likely(PyList_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("list", __pyx_t_4))) __PYX_ERR(6, 1500, __pyx_L1_error)
  __pyx_t_6 = __pyx_v_flat_namespace_map;
  __Pyx_INCREF(__pyx_t_6);
  if (!(likely(PyDict_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_t_6))) __PYX_ERR(6, 1500, __pyx_L1_error)
  __pyx_t_2 = __pyx_v_new_namespaces;
  __Pyx_INCREF(__pyx_t_2);
  if (!(likely(PyList_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None) || __Pyx_RaiseUnexpectedTypeError("list", __pyx_t_2))) __PYX_ERR(6, 1500, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1499
 *         self._write_qname(name, prefix)
 * 
 *         self._write_attributes_and_namespaces(             # <<<<<<<<<<<<<<
 *             attributes, flat_namespace_map, new_namespaces)
 * 
*/
  __pyx_t_3 = __pyx_f_4lxml_5etree_22_IncrementalFileWriter__write_attributes_and_namespaces(__pyx_v_self, ((PyObject*)__pyx_t_4), ((PyObject*)__pyx_t_6), ((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1499, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/serializer.pxi":1502
 *             attributes, flat_namespace_map, new_namespaces)
 * 
 *         tree.xmlOutputBufferWrite(self._c_out, 1, '>')             # <<<<<<<<<<<<<<
 *         if not self._buffered:
 *             tree.xmlOutputBufferFlush(self._c_out)
*/
  (void)(xmlOutputBufferWrite(__pyx_v_self->_c_out, 1, __pyx_k__3));

  /* "src/lxml/serializer.pxi":1503
 * 
 *         tree.xmlOutputBufferWrite(self._c_out, 1, '>')
 *         if not self._buffered:             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferFlush(self._c_out)
 *         self._handle_error(self._c_out.error)
*/
  __pyx_t_1 = (!__pyx_v_self->_buffered);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1504
 *         tree.xmlOutputBufferWrite(self._c_out, 1, '>')
 *         if not self._buffered:
 *             tree.xmlOutputBufferFlush(self._c_out)             # <<<<<<<<<<<<<<
 *         self._handle_error(self._c_out.error)
 * 
*/
    (void)(xmlOutputBufferFlush(__pyx_v_self->_c_out));

    /* "src/lxml/serializer.pxi":1503
 * 
 *         tree.xmlOutputBufferWrite(self._c_out, 1, '>')
 *         if not self._buffered:             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferFlush(self._c_out)
 *         self._handle_error(self._c_out.error)
*/
  }

  /* "src/lxml/serializer.pxi":1505
 *         if not self._buffered:
 *             tree.xmlOutputBufferFlush(self._c_out)
 *         self._handle_error(self._c_out.error)             # <<<<<<<<<<<<<<
 * 
 *         self._element_stack.append((ns, name, prefix, flat_namespace_map))
*/
  __pyx_t_3 = __pyx_f_4lxml_5etree_22_IncrementalFileWriter__handle_error(__pyx_v_self, __pyx_v_self->_c_out->error); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1505, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/serializer.pxi":1507
 *         self._handle_error(self._c_out.error)
 * 
 *         self._element_stack.append((ns, name, prefix, flat_namespace_map))             # <<<<<<<<<<<<<<
 *         self._status = WRITER_IN_ELEMENT
 * 
*/
  if (unlikely(__pyx_v_self->_element_stack == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
    __PYX_ERR(6, 1507, __pyx_L1_error)
  }
  __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1507, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_ns);
  __Pyx_GIVEREF(__pyx_v_ns);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_ns) != (0)) __PYX_ERR(6, 1507, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_name);
  __Pyx_GIVEREF(__pyx_v_name);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_name) != (0)) __PYX_ERR(6, 1507, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_prefix);
  __Pyx_GIVEREF(__pyx_v_prefix);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_prefix) != (0)) __PYX_ERR(6, 1507, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_flat_namespace_map);
  __Pyx_GIVEREF(__pyx_v_flat_namespace_map);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_v_flat_namespace_map) != (0)) __PYX_ERR(6, 1507, __pyx_L1_error);
  __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_self->_element_stack, __pyx_t_3); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(6, 1507, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/serializer.pxi":1508
 * 
 *         self._element_stack.append((ns, name, prefix, flat_namespace_map))
 *         self._status = WRITER_IN_ELEMENT             # <<<<<<<<<<<<<<
 * 
 *     cdef _write_attributes_and_namespaces(self, list attributes,
*/
  __pyx_v_self->_status = __pyx_e_4lxml_5etree_WRITER_IN_ELEMENT;

  /* "src/lxml/serializer.pxi":1490
 *         tree.xmlOutputBufferWrite(self._c_out, len(name), _cstr(name))
 * 
 *     cdef _write_start_element(self, element_config):             # <<<<<<<<<<<<<<
 *         if self._status > WRITER_IN_ELEMENT:
 *             raise LxmlSyntaxError("cannot append trailing element to complete XML document")
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree._IncrementalFileWriter._write_start_element", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ns);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_attributes);
  __Pyx_XDECREF(__pyx_v_nsmap);
  __Pyx_XDECREF(__pyx_v_flat_namespace_map);
  __Pyx_XDECREF(__pyx_v_new_namespaces);
  __Pyx_XDECREF(__pyx_v_prefix);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1510
 *         self._status = WRITER_IN_ELEMENT
 * 
 *     cdef _write_attributes_and_namespaces(self, list attributes,             # <<<<<<<<<<<<<<
 *                                           dict flat_namespace_map,
 *                                           list new_namespaces):
*/

static PyObject *__pyx_f_4lxml_5etree_22_IncrementalFileWriter__write_attributes_and_namespaces(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_attributes, PyObject *__pyx_v_flat_namespace_map, PyObject *__pyx_v_new_namespaces) {
  PyObject *__pyx_9genexpr16__pyx_v_ns = NULL;
  PyObject *__pyx_9genexpr16__pyx_v_name = NULL;
  PyObject *__pyx_9genexpr16__pyx_v_value = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *(*__pyx_t_10)(PyObject *);
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_write_attributes_and_namespaces", 0);
  __Pyx_INCREF(__pyx_v_attributes);

  /* "src/lxml/serializer.pxi":1513
 *                                           dict flat_namespace_map,
 *                                           list new_namespaces):
 *         if attributes:             # <<<<<<<<<<<<<<
 *             # _find_prefix() may append to new_namespaces => build them first
 *             attributes = [
*/
  if (__pyx_v_attributes == Py_None) __pyx_t_1 = 0;
  else
  {
    Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_v_attributes);
    if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(6, 1513, __pyx_L1_error)
    __pyx_t_1 = (__pyx_temp != 0);
  }

  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1515
 *         if attributes:
 *             # _find_prefix() may append to new_namespaces => build them first
 *             attributes = [             # <<<<<<<<<<<<<<
 *                 (self._find_prefix(ns, flat_namespace_map, new_namespaces), name, value)
 *                 for ns, name, value in attributes ]
*/
    { /* enter inner scope */
      __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1515, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_2);

      /* "src/lxml/serializer.pxi":1517
 *             attributes = [
 *                 (self._find_prefix(ns, flat_namespace_map, new_namespaces), name, value)
 *                 for ns, name, value in attributes ]             # <<<<<<<<<<<<<<
 *         if new_namespaces:
 *             new_namespaces.sort()
*/
      if (unlikely(__pyx_v_attributes == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
        __PYX_ERR(6, 1517, __pyx_L6_error)
      }
      __pyx_t_3 = __pyx_v_attributes; __Pyx_INCREF(__pyx_t_3);
      __pyx_t_4 = 0;
      for (;;) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(6, 1517, __pyx_L6_error)
          #endif
          if (__pyx_t_4 >= __pyx_temp) break;
        }
        __pyx_t_5 = __Pyx_PyList_GetItemRefFast(__pyx_t_3, __pyx_t_4, __Pyx_ReferenceSharing_OwnStrongReference);
        ++__pyx_t_4;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 1517, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_5);
        if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
          PyObject* sequence = __pyx_t_5;
          Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
          if (unlikely(size != 3)) {
            if (size > 3) __Pyx_RaiseTooManyValuesError(3);
            else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
            __PYX_ERR(6, 1517, __pyx_L6_error)
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          if (likely(PyTuple_CheckExact(sequence))) {
            __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0);
            __Pyx_INCREF(__pyx_t_6);
            __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1);
            __Pyx_INCREF(__pyx_t_7);
            __pyx_t_8 = PyTuple_GET_ITEM(sequence, 2);
            __Pyx_INCREF(__pyx_t_8);
          } else {
            __pyx_t_6 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
            if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 1517, __pyx_L6_error)
            __Pyx_XGOTREF(__pyx_t_6);
            __pyx_t_7 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
            if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 1517, __pyx_L6_error)
            __Pyx_XGOTREF(__pyx_t_7);
            __pyx_t_8 = __Pyx_PyList_GetItemRefFast(sequence, 2, __Pyx_ReferenceSharing_SharedReference);
            if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 1517, __pyx_L6_error)
            __Pyx_XGOTREF(__pyx_t_8);
          }
          #else
          __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 1517, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_7 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 1517, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_8 = __Pyx_PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 1517, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_8);
          #endif
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        } else {
          Py_ssize_t index = -1;
          __pyx_t_9 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 1517, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __pyx_t_10 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_9);
          index = 0; __pyx_t_6 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_6)) goto __pyx_L9_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_6);
          index = 1; __pyx_t_7 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_7)) goto __pyx_L9_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_7);
          index = 2; __pyx_t_8 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L9_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_8);
          if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 3) < (0)) __PYX_ERR(6, 1517, __pyx_L6_error)
          __pyx_t_10 = NULL;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          goto __pyx_L10_unpacking_done;
          __pyx_L9_unpacking_failed:;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_t_10 = NULL;
          if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
          __PYX_ERR(6, 1517, __pyx_L6_error)
          __pyx_L10_unpacking_done:;
        }
        __Pyx_XDECREF_SET(__pyx_9genexpr16__pyx_v_ns, __pyx_t_6);
        __pyx_t_6 = 0;
        __Pyx_XDECREF_SET(__pyx_9genexpr16__pyx_v_name, __pyx_t_7);
        __pyx_t_7 = 0;
        __Pyx_XDECREF_SET(__pyx_9genexpr16__pyx_v_value, __pyx_t_8);
        __pyx_t_8 = 0;

        /* "src/lxml/serializer.pxi":1516
 *             # _find_prefix() may append to new_namespaces => build them first
 *             attributes = [
 *                 (self._find_prefix(ns, flat_namespace_map, new_namespaces), name, value)             # <<<<<<<<<<<<<<
 *                 for ns, name, value in attributes ]
 *         if new_namespaces:
*/
        __pyx_t_5 = __pyx_9genexpr16__pyx_v_ns;
        __Pyx_INCREF(__pyx_t_5);
        if (!(likely(PyBytes_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_5))) __PYX_ERR(6, 1516, __pyx_L6_error)
        __pyx_t_8 = __pyx_f_4lxml_5etree_22_IncrementalFileWriter__find_prefix(__pyx_v_self, ((PyObject*)__pyx_t_5), __pyx_v_flat_namespace_map, __pyx_v_new_namespaces); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 1516, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 1516, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_8);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_8) != (0)) __PYX_ERR(6, 1516, __pyx_L6_error);
        __Pyx_INCREF(__pyx_9genexpr16__pyx_v_name);
        __Pyx_GIVEREF(__pyx_9genexpr16__pyx_v_name);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_9genexpr16__pyx_v_name) != (0)) __PYX_ERR(6, 1516, __pyx_L6_error);
        __Pyx_INCREF(__pyx_9genexpr16__pyx_v_value);
        __Pyx_GIVEREF(__pyx_9genexpr16__pyx_v_value);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_9genexpr16__pyx_v_value) != (0)) __PYX_ERR(6, 1516, __pyx_L6_error);
        __pyx_t_8 = 0;
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) __PYX_ERR(6, 1515, __pyx_L6_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "src/lxml/serializer.pxi":1517
 *             attributes = [
 *                 (self._find_prefix(ns, flat_namespace_map, new_namespaces), name, value)
 *                 for ns, name, value in attributes ]             # <<<<<<<<<<<<<<
 *         if new_namespaces:
 *             new_namespaces.sort()
*/
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_9genexpr16__pyx_v_name); __pyx_9genexpr16__pyx_v_name = 0;
      __Pyx_XDECREF(__pyx_9genexpr16__pyx_v_ns); __pyx_9genexpr16__pyx_v_ns = 0;
      __Pyx_XDECREF(__pyx_9genexpr16__pyx_v_value); __pyx_9genexpr16__pyx_v_value = 0;
      goto __pyx_L12_exit_scope;
      __pyx_L6_error:;
      __Pyx_XDECREF(__pyx_9genexpr16__pyx_v_name); __pyx_9genexpr16__pyx_v_name = 0;
      __Pyx_XDECREF(__pyx_9genexpr16__pyx_v_ns); __pyx_9genexpr16__pyx_v_ns = 0;
      __Pyx_XDECREF(__pyx_9genexpr16__pyx_v_value); __pyx_9genexpr16__pyx_v_value = 0;
      goto __pyx_L1_error;
      __pyx_L12_exit_scope:;
    } /* exit inner scope */
    __Pyx_DECREF_SET(__pyx_v_attributes, ((PyObject*)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "src/lxml/serializer.pxi":1513
 *                                           dict flat_namespace_map,
 *                                           list new_namespaces):
 *         if attributes:             # <<<<<<<<<<<<<<
 *             # _find_prefix() may append to new_namespaces => build them first
 *             attributes = [
*/
  }

  /* "src/lxml/serializer.pxi":1518
 *                 (self._find_prefix(ns, flat_namespace_map, new_namespaces), name, value)
 *                 for ns, name, value in attributes ]
 *         if new_namespaces:             # <<<<<<<<<<<<<<
 *             new_namespaces.sort()
 *             self._write_attributes_list(new_namespaces)
*/
  if (__pyx_v_new_namespaces == Py_None) __pyx_t_1 = 0;
  else
  {
    Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_v_new_namespaces);
    if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(6, 1518, __pyx_L1_error)
    __pyx_t_1 = (__pyx_temp != 0);
  }

  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1519
 *                 for ns, name, value in attributes ]
 *         if new_namespaces:
 *             new_namespaces.sort()             # <<<<<<<<<<<<<<
 *             self._write_attributes_list(new_namespaces)
 *         if attributes:
*/
    if (unlikely(__pyx_v_new_namespaces == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "sort");
      __PYX_ERR(6, 1519, __pyx_L1_error)
    }
    __pyx_t_11 = PyList_Sort(__pyx_v_new_namespaces); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(6, 1519, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":1520
 *         if new_namespaces:
 *             new_namespaces.sort()
 *             self._write_attributes_list(new_namespaces)             # <<<<<<<<<<<<<<
 *         if attributes:
 *             self._write_attributes_list(attributes)
*/
    __pyx_t_2 = __pyx_f_4lxml_5etree_22_IncrementalFileWriter__write_attributes_list(__pyx_v_self, __pyx_v_new_namespaces); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1520, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/serializer.pxi":1518
 *                 (self._find_prefix(ns, flat_namespace_map, new_namespaces), name, value)
 *                 for ns, name, value in attributes ]
 *         if new_namespaces:             # <<<<<<<<<<<<<<
 *             new_namespaces.sort()
 *             self._write_attributes_list(new_namespaces)
*/
  }

  /* "src/lxml/serializer.pxi":1521
 *             new_namespaces.sort()
 *             self._write_attributes_list(new_namespaces)
 *         if attributes:             # <<<<<<<<<<<<<<
 *             self._write_attributes_list(attributes)
 * 
*/
  if (__pyx_v_attributes == Py_None) __pyx_t_1 = 0;
  else
  {
    Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_v_attributes);
    if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(6, 1521, __pyx_L1_error)
    __pyx_t_1 = (__pyx_temp != 0);
  }

  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1522
 *             self._write_attributes_list(new_namespaces)
 *         if attributes:
 *             self._write_attributes_list(attributes)             # <<<<<<<<<<<<<<
 * 
 *     cdef _write_attributes_list(self, list attributes):
*/
    __pyx_t_2 = __pyx_f_4lxml_5etree_22_IncrementalFileWriter__write_attributes_list(__pyx_v_self, __pyx_v_attributes); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1522, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/serializer.pxi":1521
 *             new_namespaces.sort()
 *             self._write_attributes_list(new_namespaces)
 *         if attributes:             # <<<<<<<<<<<<<<
 *             self._write_attributes_list(attributes)
 * 
*/
  }

  /* "src/lxml/serializer.pxi":1510
 *         self._status = WRITER_IN_ELEMENT
 * 
 *     cdef _write_attributes_and_namespaces(self, list attributes,             # <<<<<<<<<<<<<<
 *                                           dict flat_namespace_map,
 *                                           list new_namespaces):
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("lxml.etree._IncrementalFileWriter._write_attributes_and_namespaces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_9genexpr16__pyx_v_ns);
  __Pyx_XDECREF(__pyx_9genexpr16__pyx_v_name);
  __Pyx_XDECREF(__pyx_9genexpr16__pyx_v_value);
  __Pyx_XDECREF(__pyx_v_attributes);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1524
 *             self._write_attributes_list(attributes)
 * 
 *     cdef _write_attributes_list(self, list attributes):             # <<<<<<<<<<<<<<
 *         for prefix, name, value in attributes:
 *             tree.xmlOutputBufferWrite(self._c_out, 1, ' ')
*/

static PyObject *__pyx_f_4lxml_5etree_22_IncrementalFileWriter__write_attributes_list(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_attributes) {
  PyObject *__pyx_v_prefix = NULL;
  PyObject *__pyx_v_name = NULL;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_write_attributes_list", 0);

  /* "src/lxml/serializer.pxi":1525
 * 
 *     cdef _write_attributes_list(self, list attributes):
 *         for prefix, name, value in attributes:             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferWrite(self._c_out, 1, ' ')
 *             self._write_qname(name, prefix)
*/
  if (unlikely(__pyx_v_attributes == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(6, 1525, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_v_attributes; __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = 0;
  for (;;) {
    {
      Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
      #if !CYTHON_ASSUME_SAFE_SIZE
      if (unlikely((__pyx_temp < 0))) __PYX_ERR(6, 1525, __pyx_L1_error)
      #endif
      if (__pyx_t_2 >= __pyx_temp) break;
    }
    __pyx_t_3 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference);
    ++__pyx_t_2;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1525, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
      PyObject* sequence = __pyx_t_3;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 3)) {
        if (size > 3) __Pyx_RaiseTooManyValuesError(3);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(6, 1525, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
        __Pyx_INCREF(__pyx_t_4);
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1);
        __Pyx_INCREF(__pyx_t_5);
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2);
        __Pyx_INCREF(__pyx_t_6);
      } else {
        __pyx_t_4 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 1525, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_4);
        __pyx_t_5 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 1525, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_5);
        __pyx_t_6 = __Pyx_PyList_GetItemRefFast(sequence, 2, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 1525, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_6);
      }
      #else
      __pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 1525, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 1525, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 1525, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      #endif
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 1525, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7);
      index = 0; __pyx_t_4 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      index = 1; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 2; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 3) < (0)) __PYX_ERR(6, 1525, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L6_unpacking_done;
      __pyx_L5_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(6, 1525, __pyx_L1_error)
      __pyx_L6_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_prefix, __pyx_t_4);
    __pyx_t_4 = 0;
    __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "src/lxml/serializer.pxi":1526
 *     cdef _write_attributes_list(self, list attributes):
 *         for prefix, name, value in attributes:
 *             tree.xmlOutputBufferWrite(self._c_out, 1, ' ')             # <<<<<<<<<<<<<<
 *             self._write_qname(name, prefix)
 *             tree.xmlOutputBufferWrite(self._c_out, 2, '="')
*/
    (void)(xmlOutputBufferWrite(__pyx_v_self->_c_out, 1, __pyx_k__7));

    /* "src/lxml/serializer.pxi":1527
 *         for prefix, name, value in attributes:
 *             tree.xmlOutputBufferWrite(self._c_out, 1, ' ')
 *             self._write_qname(name, prefix)             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferWrite(self._c_out, 2, '="')
 *             _write_attr_string(self._c_out, _cstr(value))
*/
    __pyx_t_3 = __pyx_v_name;
    __Pyx_INCREF(__pyx_t_3);
    if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_3))) __PYX_ERR(6, 1527, __pyx_L1_error)
    __pyx_t_6 = __pyx_v_prefix;
    __Pyx_INCREF(__pyx_t_6);
    if (!(likely(PyBytes_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_6))) __PYX_ERR(6, 1527, __pyx_L1_error)
    __pyx_t_5 = __pyx_f_4lxml_5etree_22_IncrementalFileWriter__write_qname(__pyx_v_self, ((PyObject*)__pyx_t_3), ((PyObject*)__pyx_t_6)); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 1527, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "src/lxml/serializer.pxi":1528
 *             tree.xmlOutputBufferWrite(self._c_out, 1, ' ')
 *             self._write_qname(name, prefix)
 *             tree.xmlOutputBufferWrite(self._c_out, 2, '="')             # <<<<<<<<<<<<<<
 *             _write_attr_string(self._c_out, _cstr(value))
 * 
*/
    (void)(xmlOutputBufferWrite(__pyx_v_self->_c_out, 2, __pyx_k__38));

    /* "src/lxml/serializer.pxi":1529
 *             self._write_qname(name, prefix)
 *             tree.xmlOutputBufferWrite(self._c_out, 2, '="')
 *             _write_attr_string(self._c_out, _cstr(value))             # <<<<<<<<<<<<<<
 * 
 *             tree.xmlOutputBufferWrite(self._c_out, 1, '"')
*/
    __pyx_t_5 = __pyx_f_4lxml_5etree__write_attr_string(__pyx_v_self->_c_out, PyBytes_AS_STRING(__pyx_v_value)); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 1529, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "src/lxml/serializer.pxi":1531
 *             _write_attr_string(self._c_out, _cstr(value))
 * 
 *             tree.xmlOutputBufferWrite(self._c_out, 1, '"')             # <<<<<<<<<<<<<<
 * 
 *     cdef _write_end_element(self, element_config):
*/
    (void)(xmlOutputBufferWrite(__pyx_v_self->_c_out, 1, __pyx_k__14));

    /* "src/lxml/serializer.pxi":1525
 * 
 *     cdef _write_attributes_list(self, list attributes):
 *         for prefix, name, value in attributes:             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferWrite(self._c_out, 1, ' ')
 *             self._write_qname(name, prefix)
*/
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/serializer.pxi":1524
 *             self._write_attributes_list(attributes)
 * 
 *     cdef _write_attributes_list(self, list attributes):             # <<<<<<<<<<<<<<
 *         for prefix, name, value in attributes:
 *             tree.xmlOutputBufferWrite(self._c_out, 1, ' ')
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree._IncrementalFileWriter._write_attributes_list", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_prefix);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1533
 *             tree.xmlOutputBufferWrite(self._c_out, 1, '"')
 * 
 *     cdef _write_end_element(self, element_config):             # <<<<<<<<<<<<<<
 *         if self._status != WRITER_IN_ELEMENT:
 *             raise LxmlSyntaxError("not in an element")
*/

static PyObject *__pyx_f_4lxml_5etree_22_IncrementalFileWriter__write_end_element(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_element_config) {
  PyObject *__pyx_v_ok_to_write = NULL;
  PyObject *__pyx_v_name = NULL;
  PyObject *__pyx_v_prefix = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *(*__pyx_t_9)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_write_end_element", 0);

  /* "src/lxml/serializer.pxi":1534
 * 
 *     cdef _write_end_element(self, element_config):
 *         if self._status != WRITER_IN_ELEMENT:             # <<<<<<<<<<<<<<
 *             raise LxmlSyntaxError("not in an element")
 *         if not self._element_stack or self._element_stack[-1][:2] != element_config[:2]:
*/
  __pyx_t_1 = (__pyx_v_self->_status != __pyx_e_4lxml_5etree_WRITER_IN_ELEMENT);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/serializer.pxi":1535
 *     cdef _write_end_element(self, element_config):
 *         if self._status != WRITER_IN_ELEMENT:
 *             raise LxmlSyntaxError("not in an element")             # <<<<<<<<<<<<<<
 *         if not self._element_stack or self._element_stack[-1][:2] != element_config[:2]:
 *             raise LxmlSyntaxError("inconsistent exit action in context manager")
*/
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_LxmlSyntaxError); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 1535, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_not_in_an_element};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1535, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(6, 1535, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":1534
 * 
 *     cdef _write_end_element(self, element_config):
 *         if self._status != WRITER_IN_ELEMENT:             # <<<<<<<<<<<<<<
 *             raise LxmlSyntaxError("not in an element")
 *         if not self._element_stack or self._element_stack[-1][:2] != element_config[:2]:
*/
  }

  /* "src/lxml/serializer.pxi":1536
 *         if self._status != WRITER_IN_ELEMENT:
 *             raise LxmlSyntaxError("not in an element")
 *         if not self._element_stack or self._element_stack[-1][:2] != element_config[:2]:             # <<<<<<<<<<<<<<
 *             raise LxmlSyntaxError("inconsistent exit action in context manager")
 * 
*/
  if (__pyx_v_self->_element_stack == Py_None) __pyx_t_6 = 0;
  else
  {
    Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_v_self->_element_stack);
    if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(6, 1536, __pyx_L1_error)
    __pyx_t_6 = (__pyx_temp != 0);
  }

  __pyx_t_7 = (!__pyx_t_6);
  if (!__pyx_t_7) {
  } else {
    __pyx_t_1 = __pyx_t_7;
    goto __pyx_L5_bool_binop_done;
  }
  if (unlikely(__pyx_v_self->_element_stack == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(6, 1536, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_self->_element_stack, -1L, long, 1, __Pyx_PyLong_From_long, 1, 1, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1536, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetSlice(__pyx_t_2, 0, 2, NULL, NULL, &__pyx_mstate_global->__pyx_slice[8], 0, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 1536, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_element_config, 0, 2, NULL, NULL, &__pyx_mstate_global->__pyx_slice[8], 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1536, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_4, __pyx_t_2, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1536, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(6, 1536, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_1 = __pyx_t_7;
  __pyx_L5_bool_binop_done:;
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/serializer.pxi":1537
 *             raise LxmlSyntaxError("not in an element")
 *         if not self._element_stack or self._element_stack[-1][:2] != element_config[:2]:
 *             raise LxmlSyntaxError("inconsistent exit action in context manager")             # <<<<<<<<<<<<<<
 * 
 *         # If previous write operations failed, the context manager exit might still call us.
*/
    __pyx_t_2 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_LxmlSyntaxError); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 1537, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_inconsistent_exit_action_in_cont};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1537, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(6, 1537, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":1536
 *         if self._status != WRITER_IN_ELEMENT:
 *             raise LxmlSyntaxError("not in an element")
 *         if not self._element_stack or self._element_stack[-1][:2] != element_config[:2]:             # <<<<<<<<<<<<<<
 *             raise LxmlSyntaxError("inconsistent exit action in context manager")
 * 
*/
  }

  /* "src/lxml/serializer.pxi":1542
 *         # That is ok, but we stop writing closing tags and handling errors in that case.
 *         # For all non-I/O errors, we continue writing closing tags if we can.
 *         ok_to_write = self._c_out.error == xmlerror.XML_ERR_OK             # <<<<<<<<<<<<<<
 * 
 *         name, prefix = self._element_stack.pop()[1:3]
*/
  __pyx_t_3 = __Pyx_PyBool_FromLong((__pyx_v_self->_c_out->error == XML_ERR_OK)); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1542, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_ok_to_write = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "src/lxml/serializer.pxi":1544
 *         ok_to_write = self._c_out.error == xmlerror.XML_ERR_OK
 * 
 *         name, prefix = self._element_stack.pop()[1:3]             # <<<<<<<<<<<<<<
 *         if ok_to_write:
 *             tree.xmlOutputBufferWrite(self._c_out, 2, '</')
*/
  if (unlikely(__pyx_v_self->_element_stack == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "pop");
    __PYX_ERR(6, 1544, __pyx_L1_error)
  }
  __pyx_t_3 = __Pyx_PyList_Pop(__pyx_v_self->_element_stack); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1544, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetSlice(__pyx_t_3, 1, 3, NULL, NULL, &__pyx_mstate_global->__pyx_slice[9], 1, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 1544, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
    PyObject* sequence = __pyx_t_4;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(6, 1544, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
      __Pyx_INCREF(__pyx_t_3);
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
      __Pyx_INCREF(__pyx_t_2);
    } else {
      __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
      if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1544, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_3);
      __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
      if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1544, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_2);
    }
    #else
    __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1544, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1544, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    #endif
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_8 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 1544, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_9 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_8);
    index = 0; __pyx_t_3 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_3)) goto __pyx_L7_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 1; __pyx_t_2 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_2)) goto __pyx_L7_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < (0)) __PYX_ERR(6, 1544, __pyx_L1_error)
    __pyx_t_9 = NULL;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    goto __pyx_L8_unpacking_done;
    __pyx_L7_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_9 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(6, 1544, __pyx_L1_error)
    __pyx_L8_unpacking_done:;
  }
  __pyx_v_name = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_prefix = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "src/lxml/serializer.pxi":1545
 * 
 *         name, prefix = self._element_stack.pop()[1:3]
 *         if ok_to_write:             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferWrite(self._c_out, 2, '</')
 *             self._write_qname(name, prefix)
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_ok_to_write); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(6, 1545, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1546
 *         name, prefix = self._element_stack.pop()[1:3]
 *         if ok_to_write:
 *             tree.xmlOutputBufferWrite(self._c_out, 2, '</')             # <<<<<<<<<<<<<<
 *             self._write_qname(name, prefix)
 *             tree.xmlOutputBufferWrite(self._c_out, 1, '>')
*/
    (void)(xmlOutputBufferWrite(__pyx_v_self->_c_out, 2, __pyx_k__39));

    /* "src/lxml/serializer.pxi":1547
 *         if ok_to_write:
 *             tree.xmlOutputBufferWrite(self._c_out, 2, '</')
 *             self._write_qname(name, prefix)             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferWrite(self._c_out, 1, '>')
 * 
*/
    __pyx_t_4 = __pyx_v_name;
    __Pyx_INCREF(__pyx_t_4);
    if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_4))) __PYX_ERR(6, 1547, __pyx_L1_error)
    __pyx_t_2 = __pyx_v_prefix;
    __Pyx_INCREF(__pyx_t_2);
    if (!(likely(PyBytes_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_2))) __PYX_ERR(6, 1547, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_4lxml_5etree_22_IncrementalFileWriter__write_qname(__pyx_v_self, ((PyObject*)__pyx_t_4), ((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1547, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":1548
 *             tree.xmlOutputBufferWrite(self._c_out, 2, '</')
 *             self._write_qname(name, prefix)
 *             tree.xmlOutputBufferWrite(self._c_out, 1, '>')             # <<<<<<<<<<<<<<
 * 
 *         if not self._element_stack:
*/
    (void)(xmlOutputBufferWrite(__pyx_v_self->_c_out, 1, __pyx_k__3));

    /* "src/lxml/serializer.pxi":1545
 * 
 *         name, prefix = self._element_stack.pop()[1:3]
 *         if ok_to_write:             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferWrite(self._c_out, 2, '</')
 *             self._write_qname(name, prefix)
*/
  }

  /* "src/lxml/serializer.pxi":1550
 *             tree.xmlOutputBufferWrite(self._c_out, 1, '>')
 * 
 *         if not self._element_stack:             # <<<<<<<<<<<<<<
 *             self._status = WRITER_FINISHED
 *         if ok_to_write:
*/
  if (__pyx_v_self->_element_stack == Py_None) __pyx_t_1 = 0;
  else
  {
    Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_v_self->_element_stack);
    if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(6, 1550, __pyx_L1_error)
    __pyx_t_1 = (__pyx_temp != 0);
  }

  __pyx_t_7 = (!__pyx_t_1);
  if (__pyx_t_7) {

    /* "src/lxml/serializer.pxi":1551
 * 
 *         if not self._element_stack:
 *             self._status = WRITER_FINISHED             # <<<<<<<<<<<<<<
 *         if ok_to_write:
 *             if not self._buffered:
*/
    __pyx_v_self->_status = __pyx_e_4lxml_5etree_WRITER_FINISHED;

    /* "src/lxml/serializer.pxi":1550
 *             tree.xmlOutputBufferWrite(self._c_out, 1, '>')
 * 
 *         if not self._element_stack:             # <<<<<<<<<<<<<<
 *             self._status = WRITER_FINISHED
 *         if ok_to_write:
*/
  }

  /* "src/lxml/serializer.pxi":1552
 *         if not self._element_stack:
 *             self._status = WRITER_FINISHED
 *         if ok_to_write:             # <<<<<<<<<<<<<<
 *             if not self._buffered:
 *                 tree.xmlOutputBufferFlush(self._c_out)
*/
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_ok_to_write); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(6, 1552, __pyx_L1_error)
  if (__pyx_t_7) {

    /* "src/lxml/serializer.pxi":1553
 *             self._status = WRITER_FINISHED
 *         if ok_to_write:
 *             if not self._buffered:             # <<<<<<<<<<<<<<
 *                 tree.xmlOutputBufferFlush(self._c_out)
 *             self._handle_error(self._c_out.error)
*/
    __pyx_t_7 = (!__pyx_v_self->_buffered);
    if (__pyx_t_7) {

      /* "src/lxml/serializer.pxi":1554
 *         if ok_to_write:
 *             if not self._buffered:
 *                 tree.xmlOutputBufferFlush(self._c_out)             # <<<<<<<<<<<<<<
 *             self._handle_error(self._c_out.error)
 * 
*/
      (void)(xmlOutputBufferFlush(__pyx_v_self->_c_out));

      /* "src/lxml/serializer.pxi":1553
 *             self._status = WRITER_FINISHED
 *         if ok_to_write:
 *             if not self._buffered:             # <<<<<<<<<<<<<<
 *                 tree.xmlOutputBufferFlush(self._c_out)
 *             self._handle_error(self._c_out.error)
*/
    }

    /* "src/lxml/serializer.pxi":1555
 *             if not self._buffered:
 *                 tree.xmlOutputBufferFlush(self._c_out)
 *             self._handle_error(self._c_out.error)             # <<<<<<<<<<<<<<
 * 
 *     cdef _find_prefix(self, bytes href, dict flat_namespaces_map, list new_namespaces):
*/
    __pyx_t_3 = __pyx_f_4lxml_5etree_22_IncrementalFileWriter__handle_error(__pyx_v_self, __pyx_v_self->_c_out->error); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1555, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":1552
 *         if not self._element_stack:
 *             self._status = WRITER_FINISHED
 *         if ok_to_write:             # <<<<<<<<<<<<<<
 *             if not self._buffered:
 *                 tree.xmlOutputBufferFlush(self._c_out)
*/
  }

  /* "src/lxml/serializer.pxi":1533
 *             tree.xmlOutputBufferWrite(self._c_out, 1, '"')
 * 
 *     cdef _write_end_element(self, element_config):             # <<<<<<<<<<<<<<
 *         if self._status != WRITER_IN_ELEMENT:
 *             raise LxmlSyntaxError("not in an element")
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("lxml.etree._IncrementalFileWriter._write_end_element", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ok_to_write);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_prefix);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1557
 *             self._handle_error(self._c_out.error)
 * 
 *     cdef _find_prefix(self, bytes href, dict flat_namespaces_map, list new_namespaces):             # <<<<<<<<<<<<<<
 *         if href is None:
 *             return None
*/

static PyObject *__pyx_f_4lxml_5etree_22_IncrementalFileWriter__find_prefix(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_href, PyObject *__pyx_v_flat_namespaces_map, PyObject *__pyx_v_new_namespaces) {
  PyObject *__pyx_v_prefixes = NULL;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_prefix = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_find_prefix", 0);

  /* "src/lxml/serializer.pxi":1558
 * 
 *     cdef _find_prefix(self, bytes href, dict flat_namespaces_map, list new_namespaces):
 *         if href is None:             # <<<<<<<<<<<<<<
 *             return None
 *         if href in flat_namespaces_map:
*/
  __pyx_t_1 = (__pyx_v_href == ((PyObject*)Py_None));
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1559
 *     cdef _find_prefix(self, bytes href, dict flat_namespaces_map, list new_namespaces):
 *         if href is None:
 *             return None             # <<<<<<<<<<<<<<
 *         if href in flat_namespaces_map:
 *             return flat_namespaces_map[href]
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/serializer.pxi":1558
 * 
 *     cdef _find_prefix(self, bytes href, dict flat_namespaces_map, list new_namespaces):
 *         if href is None:             # <<<<<<<<<<<<<<
 *             return None
 *         if href in flat_namespaces_map:
*/
  }

  /* "src/lxml/serializer.pxi":1560
 *         if href is None:
 *             return None
 *         if href in flat_namespaces_map:             # <<<<<<<<<<<<<<
 *             return flat_namespaces_map[href]
 *         # need to create a new prefix
*/
  if (unlikely(__pyx_v_flat_namespaces_map == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(6, 1560, __pyx_L1_error)
  }
  __pyx_t_1 = (__Pyx_PyDict_ContainsTF(__pyx_v_href, __pyx_v_flat_namespaces_map, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(6, 1560, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1561
 *             return None
 *         if href in flat_namespaces_map:
 *             return flat_namespaces_map[href]             # <<<<<<<<<<<<<<
 *         # need to create a new prefix
 *         prefixes = flat_namespaces_map.values()
*/
    __Pyx_XDECREF(__pyx_r);
    if (unlikely(__pyx_v_flat_namespaces_map == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(6, 1561, __pyx_L1_error)
    }
    __pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_v_flat_namespaces_map, __pyx_v_href); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1561, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "src/lxml/serializer.pxi":1560
 *         if href is None:
 *             return None
 *         if href in flat_namespaces_map:             # <<<<<<<<<<<<<<
 *             return flat_namespaces_map[href]
 *         # need to create a new prefix
*/
  }

  /* "src/lxml/serializer.pxi":1563
 *             return flat_namespaces_map[href]
 *         # need to create a new prefix
 *         prefixes = flat_namespaces_map.values()             # <<<<<<<<<<<<<<
 *         i = 0
 *         while True:
*/
  if (unlikely(__pyx_v_flat_namespaces_map == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "values");
    __PYX_ERR(6, 1563, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyDict_Values(__pyx_v_flat_namespaces_map); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1563, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_prefixes = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "src/lxml/serializer.pxi":1564
 *         # need to create a new prefix
 *         prefixes = flat_namespaces_map.values()
 *         i = 0             # <<<<<<<<<<<<<<
 *         while True:
 *             prefix = _utf8('ns%d' % i)
*/
  __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0);
  __pyx_v_i = __pyx_mstate_global->__pyx_int_0;

  /* "src/lxml/serializer.pxi":1565
 *         prefixes = flat_namespaces_map.values()
 *         i = 0
 *         while True:             # <<<<<<<<<<<<<<
 *             prefix = _utf8('ns%d' % i)
 *             if prefix not in prefixes:
*/
  while (1) {

    /* "src/lxml/serializer.pxi":1566
 *         i = 0
 *         while True:
 *             prefix = _utf8('ns%d' % i)             # <<<<<<<<<<<<<<
 *             if prefix not in prefixes:
 *                 new_namespaces.append((b'xmlns', prefix, href))
*/
    __pyx_t_2 = __Pyx_PyUnicode_FormatSafe(__pyx_mstate_global->__pyx_kp_u_ns_d, __pyx_v_i); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1566, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __pyx_f_4lxml_5etree__utf8(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1566, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF_SET(__pyx_v_prefix, ((PyObject*)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":1567
 *         while True:
 *             prefix = _utf8('ns%d' % i)
 *             if prefix not in prefixes:             # <<<<<<<<<<<<<<
 *                 new_namespaces.append((b'xmlns', prefix, href))
 *                 flat_namespaces_map[href] = prefix
*/
    __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_v_prefix, __pyx_v_prefixes, Py_NE)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(6, 1567, __pyx_L1_error)
    if (__pyx_t_1) {

      /* "src/lxml/serializer.pxi":1568
 *             prefix = _utf8('ns%d' % i)
 *             if prefix not in prefixes:
 *                 new_namespaces.append((b'xmlns', prefix, href))             # <<<<<<<<<<<<<<
 *                 flat_namespaces_map[href] = prefix
 *                 return prefix
*/
      if (unlikely(__pyx_v_new_namespaces == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
        __PYX_ERR(6, 1568, __pyx_L1_error)
      }
      __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1568, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_mstate_global->__pyx_n_b_xmlns_2);
      __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_b_xmlns_2);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_mstate_global->__pyx_n_b_xmlns_2) != (0)) __PYX_ERR(6, 1568, __pyx_L1_error);
      __Pyx_INCREF(__pyx_v_prefix);
      __Pyx_GIVEREF(__pyx_v_prefix);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_prefix) != (0)) __PYX_ERR(6, 1568, __pyx_L1_error);
      __Pyx_INCREF(__pyx_v_href);
      __Pyx_GIVEREF(__pyx_v_href);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_href) != (0)) __PYX_ERR(6, 1568, __pyx_L1_error);
      __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_new_namespaces, __pyx_t_3); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(6, 1568, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "src/lxml/serializer.pxi":1569
 *             if prefix not in prefixes:
 *                 new_namespaces.append((b'xmlns', prefix, href))
 *                 flat_namespaces_map[href] = prefix             # <<<<<<<<<<<<<<
 *                 return prefix
 *             i += 1
*/
      if (unlikely(__pyx_v_flat_namespaces_map == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(6, 1569, __pyx_L1_error)
      }
      if (unlikely((PyDict_SetItem(__pyx_v_flat_namespaces_map, __pyx_v_href, __pyx_v_prefix) < 0))) __PYX_ERR(6, 1569, __pyx_L1_error)

      /* "src/lxml/serializer.pxi":1570
 *                 new_namespaces.append((b'xmlns', prefix, href))
 *                 flat_namespaces_map[href] = prefix
 *                 return prefix             # <<<<<<<<<<<<<<
 *             i += 1
 * 
*/
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_prefix);
      __pyx_r = __pyx_v_prefix;
      goto __pyx_L0;

      /* "src/lxml/serializer.pxi":1567
 *         while True:
 *             prefix = _utf8('ns%d' % i)
 *             if prefix not in prefixes:             # <<<<<<<<<<<<<<
 *                 new_namespaces.append((b'xmlns', prefix, href))
 *                 flat_namespaces_map[href] = prefix
*/
    }

    /* "src/lxml/serializer.pxi":1571
 *                 flat_namespaces_map[href] = prefix
 *                 return prefix
 *             i += 1             # <<<<<<<<<<<<<<
 * 
 *     cdef _collect_namespaces(self, dict nsmap):
*/
    __pyx_t_3 = __Pyx_PyLong_AddObjC(__pyx_v_i, __pyx_mstate_global->__pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1571, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_i, __pyx_t_3);
    __pyx_t_3 = 0;
  }

  /* "src/lxml/serializer.pxi":1557
 *             self._handle_error(self._c_out.error)
 * 
 *     cdef _find_prefix(self, bytes href, dict flat_namespaces_map, list new_namespaces):             # <<<<<<<<<<<<<<
 *         if href is None:
 *             return None
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._IncrementalFileWriter._find_prefix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_prefixes);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_prefix);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1573
 *             i += 1
 * 
 *     cdef _collect_namespaces(self, dict nsmap):             # <<<<<<<<<<<<<<
 *         new_namespaces = []
 *         flat_namespaces_map = {}
*/

static PyObject *__pyx_f_4lxml_5etree_22_IncrementalFileWriter__collect_namespaces(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_nsmap) {
  PyObject *__pyx_v_new_namespaces = NULL;
  PyObject *__pyx_v_flat_namespaces_map = NULL;
  PyObject *__pyx_v_ns = NULL;
  PyObject *__pyx_v_prefix = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_collect_namespaces", 0);

  /* "src/lxml/serializer.pxi":1574
 * 
 *     cdef _collect_namespaces(self, dict nsmap):
 *         new_namespaces = []             # <<<<<<<<<<<<<<
 *         flat_namespaces_map = {}
 *         for ns, prefix in nsmap.iteritems():
*/
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1574, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_new_namespaces = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/serializer.pxi":1575
 *     cdef _collect_namespaces(self, dict nsmap):
 *         new_namespaces = []
 *         flat_namespaces_map = {}             # <<<<<<<<<<<<<<
 *         for ns, prefix in nsmap.iteritems():
 *             flat_namespaces_map[ns] = prefix
*/
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1575, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_flat_namespaces_map = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/serializer.pxi":1576
 *         new_namespaces = []
 *         flat_namespaces_map = {}
 *         for ns, prefix in nsmap.iteritems():             # <<<<<<<<<<<<<<
 *             flat_namespaces_map[ns] = prefix
 *             if prefix is None:
*/
  __pyx_t_2 = 0;
  if (unlikely(__pyx_v_nsmap == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "iteritems");
    __PYX_ERR(6, 1576, __pyx_L1_error)
  }
  __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_nsmap, 1, __pyx_mstate_global->__pyx_n_u_iteritems, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 1576, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = __pyx_t_5;
  __pyx_t_5 = 0;
  while (1) {
    __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, &__pyx_t_5, &__pyx_t_6, NULL, __pyx_t_4);
    if (unlikely(__pyx_t_7 == 0)) break;
    if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(6, 1576, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF_SET(__pyx_v_ns, __pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_prefix, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "src/lxml/serializer.pxi":1577
 *         flat_namespaces_map = {}
 *         for ns, prefix in nsmap.iteritems():
 *             flat_namespaces_map[ns] = prefix             # <<<<<<<<<<<<<<
 *             if prefix is None:
 *                 # use empty bytes rather than None to allow sorting
*/
    if (unlikely((PyDict_SetItem(__pyx_v_flat_namespaces_map, __pyx_v_ns, __pyx_v_prefix) < 0))) __PYX_ERR(6, 1577, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":1578
 *         for ns, prefix in nsmap.iteritems():
 *             flat_namespaces_map[ns] = prefix
 *             if prefix is None:             # <<<<<<<<<<<<<<
 *                 # use empty bytes rather than None to allow sorting
 *                 new_namespaces.append((b'', b'xmlns', ns))
*/
    __pyx_t_8 = (__pyx_v_prefix == Py_None);
    if (__pyx_t_8) {

      /* "src/lxml/serializer.pxi":1580
 *             if prefix is None:
 *                 # use empty bytes rather than None to allow sorting
 *                 new_namespaces.append((b'', b'xmlns', ns))             # <<<<<<<<<<<<<<
 *             else:
 *                 new_namespaces.append((b'xmlns', prefix, ns))
*/
      __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 1580, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_b__8);
      __Pyx_GIVEREF(__pyx_mstate_global->__pyx_kp_b__8);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_mstate_global->__pyx_kp_b__8) != (0)) __PYX_ERR(6, 1580, __pyx_L1_error);
      __Pyx_INCREF(__pyx_mstate_global->__pyx_n_b_xmlns_2);
      __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_b_xmlns_2);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_mstate_global->__pyx_n_b_xmlns_2) != (0)) __PYX_ERR(6, 1580, __pyx_L1_error);
      __Pyx_INCREF(__pyx_v_ns);
      __Pyx_GIVEREF(__pyx_v_ns);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_ns) != (0)) __PYX_ERR(6, 1580, __pyx_L1_error);
      __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_new_namespaces, __pyx_t_6); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(6, 1580, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "src/lxml/serializer.pxi":1578
 *         for ns, prefix in nsmap.iteritems():
 *             flat_namespaces_map[ns] = prefix
 *             if prefix is None:             # <<<<<<<<<<<<<<
 *                 # use empty bytes rather than None to allow sorting
 *                 new_namespaces.append((b'', b'xmlns', ns))
*/
      goto __pyx_L5;
    }

    /* "src/lxml/serializer.pxi":1582
 *                 new_namespaces.append((b'', b'xmlns', ns))
 *             else:
 *                 new_namespaces.append((b'xmlns', prefix, ns))             # <<<<<<<<<<<<<<
 *         # merge in flat namespace map of parent
 *         if self._element_stack:
*/
    /*else*/ {
      __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 1582, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_mstate_global->__pyx_n_b_xmlns_2);
      __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_b_xmlns_2);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_mstate_global->__pyx_n_b_xmlns_2) != (0)) __PYX_ERR(6, 1582, __pyx_L1_error);
      __Pyx_INCREF(__pyx_v_prefix);
      __Pyx_GIVEREF(__pyx_v_prefix);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_prefix) != (0)) __PYX_ERR(6, 1582, __pyx_L1_error);
      __Pyx_INCREF(__pyx_v_ns);
      __Pyx_GIVEREF(__pyx_v_ns);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_ns) != (0)) __PYX_ERR(6, 1582, __pyx_L1_error);
      __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_new_namespaces, __pyx_t_6); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(6, 1582, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __pyx_L5:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/serializer.pxi":1584
 *                 new_namespaces.append((b'xmlns', prefix, ns))
 *         # merge in flat namespace map of parent
 *         if self._element_stack:             # <<<<<<<<<<<<<<
 *             for ns, prefix in (<dict>self._element_stack[-1][-1]).iteritems():
 *                 if flat_namespaces_map.get(ns) is None:
*/
  if (__pyx_v_self->_element_stack == Py_None) __pyx_t_8 = 0;
  else
  {
    Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_v_self->_element_stack);
    if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(6, 1584, __pyx_L1_error)
    __pyx_t_8 = (__pyx_temp != 0);
  }

  if (__pyx_t_8) {

    /* "src/lxml/serializer.pxi":1585
 *         # merge in flat namespace map of parent
 *         if self._element_stack:
 *             for ns, prefix in (<dict>self._element_stack[-1][-1]).iteritems():             # <<<<<<<<<<<<<<
 *                 if flat_namespaces_map.get(ns) is None:
 *                     # unknown or empty prefix => prefer a 'real' prefix
*/
    __pyx_t_3 = 0;
    if (unlikely(__pyx_v_self->_element_stack == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(6, 1585, __pyx_L1_error)
    }
    __pyx_t_6 = __Pyx_GetItemInt_List(__pyx_v_self->_element_stack, -1L, long, 1, __Pyx_PyLong_From_long, 1, 1, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 1585, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_6, -1L, long, 1, __Pyx_PyLong_From_long, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 1585, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(__pyx_t_5 == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "iteritems");
      __PYX_ERR(6, 1585, __pyx_L1_error)
    }
    __pyx_t_6 = __Pyx_dict_iterator(((PyObject*)__pyx_t_5), 1, __pyx_mstate_global->__pyx_n_u_iteritems, (&__pyx_t_2), (&__pyx_t_4)); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 1585, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_1);
    __pyx_t_1 = __pyx_t_6;
    __pyx_t_6 = 0;
    while (1) {
      __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_2, &__pyx_t_3, &__pyx_t_6, &__pyx_t_5, NULL, __pyx_t_4);
      if (unlikely(__pyx_t_7 == 0)) break;
      if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(6, 1585, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_XDECREF_SET(__pyx_v_ns, __pyx_t_6);
      __pyx_t_6 = 0;
      __Pyx_XDECREF_SET(__pyx_v_prefix, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "src/lxml/serializer.pxi":1586
 *         if self._element_stack:
 *             for ns, prefix in (<dict>self._element_stack[-1][-1]).iteritems():
 *                 if flat_namespaces_map.get(ns) is None:             # <<<<<<<<<<<<<<
 *                     # unknown or empty prefix => prefer a 'real' prefix
 *                     flat_namespaces_map[ns] = prefix
*/
      __pyx_t_5 = __Pyx_PyDict_GetItemDefault(__pyx_v_flat_namespaces_map, __pyx_v_ns, Py_None); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 1586, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_8 = (__pyx_t_5 == Py_None);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_8) {

        /* "src/lxml/serializer.pxi":1588
 *                 if flat_namespaces_map.get(ns) is None:
 *                     # unknown or empty prefix => prefer a 'real' prefix
 *                     flat_namespaces_map[ns] = prefix             # <<<<<<<<<<<<<<
 *         return flat_namespaces_map, new_namespaces
 * 
*/
        if (unlikely((PyDict_SetItem(__pyx_v_flat_namespaces_map, __pyx_v_ns, __pyx_v_prefix) < 0))) __PYX_ERR(6, 1588, __pyx_L1_error)

        /* "src/lxml/serializer.pxi":1586
 *         if self._element_stack:
 *             for ns, prefix in (<dict>self._element_stack[-1][-1]).iteritems():
 *                 if flat_namespaces_map.get(ns) is None:             # <<<<<<<<<<<<<<
 *                     # unknown or empty prefix => prefer a 'real' prefix
 *                     flat_namespaces_map[ns] = prefix
*/
      }
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "src/lxml/serializer.pxi":1584
 *                 new_namespaces.append((b'xmlns', prefix, ns))
 *         # merge in flat namespace map of parent
 *         if self._element_stack:             # <<<<<<<<<<<<<<
 *             for ns, prefix in (<dict>self._element_stack[-1][-1]).iteritems():
 *                 if flat_namespaces_map.get(ns) is None:
*/
  }

  /* "src/lxml/serializer.pxi":1589
 *                     # unknown or empty prefix => prefer a 'real' prefix
 *                     flat_namespaces_map[ns] = prefix
 *         return flat_namespaces_map, new_namespaces             # <<<<<<<<<<<<<<
 * 
 *     def write(self, *args, bint with_tail=True, bint pretty_print=False, method=None):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1589, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_flat_namespaces_map);
  __Pyx_GIVEREF(__pyx_v_flat_namespaces_map);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_flat_namespaces_map) != (0)) __PYX_ERR(6, 1589, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_new_namespaces);
  __Pyx_GIVEREF(__pyx_v_new_namespaces);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_new_namespaces) != (0)) __PYX_ERR(6, 1589, __pyx_L1_error);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/serializer.pxi":1573
 *             i += 1
 * 
 *     cdef _collect_namespaces(self, dict nsmap):             # <<<<<<<<<<<<<<
 *         new_namespaces = []
 *         flat_namespaces_map = {}
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._IncrementalFileWriter._collect_namespaces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_new_namespaces);
  __Pyx_XDECREF(__pyx_v_flat_namespaces_map);
  __Pyx_XDECREF(__pyx_v_ns);
  __Pyx_XDECREF(__pyx_v_prefix);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1591
 *         return flat_namespaces_map, new_namespaces
 * 
 *     def write(self, *args, bint with_tail=True, bint pretty_print=False, method=None):             # <<<<<<<<<<<<<<
 *         """write(self, *args, with_tail=True, pretty_print=False, method=None)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_22_IncrementalFileWriter_13write(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_22_IncrementalFileWriter_12write, "write(self, *args, with_tail=True, pretty_print=False, method=None)\n\n        Write subtrees or strings into the file.\n\n        If method is not None, it should be one of ('html', 'xml', 'text')\n        to temporarily override the output method.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_22_IncrementalFileWriter_13write = {"write", (PyCFunction)(void(*)(void))(PyCFunctionWithKeywords)__pyx_pw_4lxml_5etree_22_IncrementalFileWriter_13write, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4lxml_5etree_22_IncrementalFileWriter_12write};
static PyObject *__pyx_pw_4lxml_5etree_22_IncrementalFileWriter_13write(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_with_tail;
  int __pyx_v_pretty_print;
  PyObject *__pyx_v_method = 0;
  PyObject *__pyx_v_args = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __Pyx_INCREF(__pyx_args);
  __pyx_v_args = __pyx_args;
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_with_tail,&__pyx_mstate_global->__pyx_n_u_pretty_print,&__pyx_mstate_global->__pyx_n_u_method,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(6, 1591, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        default:
        case  0: break;
      }
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, 0, __pyx_kwds_len, "write", 0) < (0)) __PYX_ERR(6, 1591, __pyx_L3_error)
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
    } else if (unlikely(__pyx_nargs < 0)) {
      goto __pyx_L5_argtuple_error;
    } else {
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    if (values[0]) {
      __pyx_v_with_tail = __Pyx_PyObject_IsTrue(values[0]); if (unlikely((__pyx_v_with_tail == (int)-1) && PyErr_Occurred())) __PYX_ERR(6, 1591, __pyx_L3_error)
    } else {
      __pyx_v_with_tail = ((int)1);
    }
    if (values[1]) {
      __pyx_v_pretty_print = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_pretty_print == (int)-1) && PyErr_Occurred())) __PYX_ERR(6, 1591, __pyx_L3_error)
    } else {
      __pyx_v_pretty_print = ((int)0);
    }
    __pyx_v_method = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("write", 0, 0, 0, __pyx_nargs); __PYX_ERR(6, 1591, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0;
  __Pyx_AddTraceback("lxml.etree._IncrementalFileWriter.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_22_IncrementalFileWriter_12write(((struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *)__pyx_v_self), __pyx_v_with_tail, __pyx_v_pretty_print, __pyx_v_method, __pyx_v_args);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v_args);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_22_IncrementalFileWriter_12write(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self, int __pyx_v_with_tail, int __pyx_v_pretty_print, PyObject *__pyx_v_method, PyObject *__pyx_v_args) {
  int __pyx_v_c_method;
  PyObject *__pyx_v_content = NULL;
  PyObject *__pyx_v_bstring = NULL;
  PyObject *__pyx_v_ns = NULL;
  PyObject *__pyx_v_name = NULL;
  CYTHON_UNUSED PyObject *__pyx_v__ = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  size_t __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *(*__pyx_t_14)(PyObject *);
  int __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  PyObject *__pyx_t_17[3];
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("write", 0);

  /* "src/lxml/serializer.pxi":1599
 *         to temporarily override the output method.
 *         """
 *         assert self._c_out is not NULL             # <<<<<<<<<<<<<<
 *         c_method = self._method if method is None else _findOutputMethod(method)
 * 
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = (__pyx_v_self->_c_out != NULL);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
      __PYX_ERR(6, 1599, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(6, 1599, __pyx_L1_error)
  #endif

  /* "src/lxml/serializer.pxi":1600
 *         """
 *         assert self._c_out is not NULL
 *         c_method = self._method if method is None else _findOutputMethod(method)             # <<<<<<<<<<<<<<
 * 
 *         for content in args:
*/
  __pyx_t_1 = (__pyx_v_method == Py_None);
  if (__pyx_t_1) {
    __pyx_t_2 = __pyx_v_self->_method;
  } else {
    __pyx_t_3 = __pyx_f_4lxml_5etree__findOutputMethod(__pyx_v_method); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(6, 1600, __pyx_L1_error)
    __pyx_t_2 = __pyx_t_3;
  }
  __pyx_v_c_method = __pyx_t_2;

  /* "src/lxml/serializer.pxi":1602
 *         c_method = self._method if method is None else _findOutputMethod(method)
 * 
 *         for content in args:             # <<<<<<<<<<<<<<
 *             if _isString(content):
 *                 if self._status != WRITER_IN_ELEMENT:
*/
  __pyx_t_4 = __pyx_v_args; __Pyx_INCREF(__pyx_t_4);
  __pyx_t_5 = 0;
  for (;;) {
    {
      Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4);
      #if !CYTHON_ASSUME_SAFE_SIZE
      if (unlikely((__pyx_temp < 0))) __PYX_ERR(6, 1602, __pyx_L1_error)
      #endif
      if (__pyx_t_5 >= __pyx_temp) break;
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_6 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5));
    #else
    __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_5);
    #endif
    ++__pyx_t_5;
    if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 1602, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF_SET(__pyx_v_content, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "src/lxml/serializer.pxi":1603
 * 
 *         for content in args:
 *             if _isString(content):             # <<<<<<<<<<<<<<
 *                 if self._status != WRITER_IN_ELEMENT:
 *                     if self._status > WRITER_IN_ELEMENT or content.strip():
*/
    __pyx_t_1 = _isString(__pyx_v_content);
    if (__pyx_t_1) {

      /* "src/lxml/serializer.pxi":1604
 *         for content in args:
 *             if _isString(content):
 *                 if self._status != WRITER_IN_ELEMENT:             # <<<<<<<<<<<<<<
 *                     if self._status > WRITER_IN_ELEMENT or content.strip():
 *                         raise LxmlSyntaxError("not in an element")
*/
      __pyx_t_1 = (__pyx_v_self->_status != __pyx_e_4lxml_5etree_WRITER_IN_ELEMENT);
      if (__pyx_t_1) {

        /* "src/lxml/serializer.pxi":1605
 *             if _isString(content):
 *                 if self._status != WRITER_IN_ELEMENT:
 *                     if self._status > WRITER_IN_ELEMENT or content.strip():             # <<<<<<<<<<<<<<
 *                         raise LxmlSyntaxError("not in an element")
 *                 bstring = _utf8(content)
*/
        __pyx_t_7 = (__pyx_v_self->_status > __pyx_e_4lxml_5etree_WRITER_IN_ELEMENT);
        if (!__pyx_t_7) {
        } else {
          __pyx_t_1 = __pyx_t_7;
          goto __pyx_L8_bool_binop_done;
        }
        __pyx_t_8 = __pyx_v_content;
        __Pyx_INCREF(__pyx_t_8);
        __pyx_t_9 = 0;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_8, NULL};
          __pyx_t_6 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_strip, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 1605, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
        }
        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(6, 1605, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_1 = __pyx_t_7;
        __pyx_L8_bool_binop_done:;
        if (unlikely(__pyx_t_1)) {

          /* "src/lxml/serializer.pxi":1606
 *                 if self._status != WRITER_IN_ELEMENT:
 *                     if self._status > WRITER_IN_ELEMENT or content.strip():
 *                         raise LxmlSyntaxError("not in an element")             # <<<<<<<<<<<<<<
 *                 bstring = _utf8(content)
 *                 if not bstring:
*/
          __pyx_t_8 = NULL;
          __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_LxmlSyntaxError); if (unlikely(!__pyx_t_10)) __PYX_ERR(6, 1606, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __pyx_t_9 = 1;
          #if CYTHON_UNPACK_METHODS
          if (unlikely(PyMethod_Check(__pyx_t_10))) {
            __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_10);
            assert(__pyx_t_8);
            PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_10);
            __Pyx_INCREF(__pyx_t_8);
            __Pyx_INCREF(__pyx__function);
            __Pyx_DECREF_SET(__pyx_t_10, __pyx__function);
            __pyx_t_9 = 0;
          }
          #endif
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_mstate_global->__pyx_kp_u_not_in_an_element};
            __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_10, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
            __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
            if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 1606, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_6);
          }
          __Pyx_Raise(__pyx_t_6, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __PYX_ERR(6, 1606, __pyx_L1_error)

          /* "src/lxml/serializer.pxi":1605
 *             if _isString(content):
 *                 if self._status != WRITER_IN_ELEMENT:
 *                     if self._status > WRITER_IN_ELEMENT or content.strip():             # <<<<<<<<<<<<<<
 *                         raise LxmlSyntaxError("not in an element")
 *                 bstring = _utf8(content)
*/
        }

        /* "src/lxml/serializer.pxi":1604
 *         for content in args:
 *             if _isString(content):
 *                 if self._status != WRITER_IN_ELEMENT:             # <<<<<<<<<<<<<<
 *                     if self._status > WRITER_IN_ELEMENT or content.strip():
 *                         raise LxmlSyntaxError("not in an element")
*/
      }

      /* "src/lxml/serializer.pxi":1607
 *                     if self._status > WRITER_IN_ELEMENT or content.strip():
 *                         raise LxmlSyntaxError("not in an element")
 *                 bstring = _utf8(content)             # <<<<<<<<<<<<<<
 *                 if not bstring:
 *                     continue
*/
      __pyx_t_6 = __pyx_f_4lxml_5etree__utf8(__pyx_v_content); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 1607, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_XDECREF_SET(__pyx_v_bstring, ((PyObject*)__pyx_t_6));
      __pyx_t_6 = 0;

      /* "src/lxml/serializer.pxi":1608
 *                         raise LxmlSyntaxError("not in an element")
 *                 bstring = _utf8(content)
 *                 if not bstring:             # <<<<<<<<<<<<<<
 *                     continue
 * 
*/
      if (__pyx_v_bstring == Py_None) __pyx_t_1 = 0;
      else
      {
        Py_ssize_t __pyx_temp = __Pyx_PyBytes_GET_SIZE(__pyx_v_bstring);
        if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(6, 1608, __pyx_L1_error)
        __pyx_t_1 = (__pyx_temp != 0);
      }

      __pyx_t_7 = (!__pyx_t_1);
      if (__pyx_t_7) {

        /* "src/lxml/serializer.pxi":1609
 *                 bstring = _utf8(content)
 *                 if not bstring:
 *                     continue             # <<<<<<<<<<<<<<
 * 
 *                 ns, name, _, _ = self._element_stack[-1]
*/
        goto __pyx_L3_continue;

        /* "src/lxml/serializer.pxi":1608
 *                         raise LxmlSyntaxError("not in an element")
 *                 bstring = _utf8(content)
 *                 if not bstring:             # <<<<<<<<<<<<<<
 *                     continue
 * 
*/
      }

      /* "src/lxml/serializer.pxi":1611
 *                     continue
 * 
 *                 ns, name, _, _ = self._element_stack[-1]             # <<<<<<<<<<<<<<
 *                 if (c_method == OUTPUT_METHOD_HTML and
 *                         ns in (None, b'http://www.w3.org/1999/xhtml') and
*/
      if (unlikely(__pyx_v_self->_element_stack == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(6, 1611, __pyx_L1_error)
      }
      __pyx_t_6 = __Pyx_GetItemInt_List(__pyx_v_self->_element_stack, -1L, long, 1, __Pyx_PyLong_From_long, 1, 1, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 1611, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) {
        PyObject* sequence = __pyx_t_6;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 4)) {
          if (size > 4) __Pyx_RaiseTooManyValuesError(4);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(6, 1611, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_10 = PyTuple_GET_ITEM(sequence, 0);
          __Pyx_INCREF(__pyx_t_10);
          __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1);
          __Pyx_INCREF(__pyx_t_8);
          __pyx_t_11 = PyTuple_GET_ITEM(sequence, 2);
          __Pyx_INCREF(__pyx_t_11);
          __pyx_t_12 = PyTuple_GET_ITEM(sequence, 3);
          __Pyx_INCREF(__pyx_t_12);
        } else {
          __pyx_t_10 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
          if (unlikely(!__pyx_t_10)) __PYX_ERR(6, 1611, __pyx_L1_error)
          __Pyx_XGOTREF(__pyx_t_10);
          __pyx_t_8 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
          if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 1611, __pyx_L1_error)
          __Pyx_XGOTREF(__pyx_t_8);
          __pyx_t_11 = __Pyx_PyList_GetItemRefFast(sequence, 2, __Pyx_ReferenceSharing_SharedReference);
          if (unlikely(!__pyx_t_11)) __PYX_ERR(6, 1611, __pyx_L1_error)
          __Pyx_XGOTREF(__pyx_t_11);
          __pyx_t_12 = __Pyx_PyList_GetItemRefFast(sequence, 3, __Pyx_ReferenceSharing_SharedReference);
          if (unlikely(!__pyx_t_12)) __PYX_ERR(6, 1611, __pyx_L1_error)
          __Pyx_XGOTREF(__pyx_t_12);
        }
        #else
        {
          Py_ssize_t i;
          PyObject** temps[4] = {&__pyx_t_10,&__pyx_t_8,&__pyx_t_11,&__pyx_t_12};
          for (i=0; i < 4; i++) {
            PyObject* item = __Pyx_PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(6, 1611, __pyx_L1_error)
            __Pyx_GOTREF(item);
            *(temps[i]) = item;
          }
        }
        #endif
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else {
        Py_ssize_t index = -1;
        PyObject** temps[4] = {&__pyx_t_10,&__pyx_t_8,&__pyx_t_11,&__pyx_t_12};
        __pyx_t_13 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_13)) __PYX_ERR(6, 1611, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_14 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_13);
        for (index=0; index < 4; index++) {
          PyObject* item = __pyx_t_14(__pyx_t_13); if (unlikely(!item)) goto __pyx_L11_unpacking_failed;
          __Pyx_GOTREF(item);
          *(temps[index]) = item;
        }
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_14(__pyx_t_13), 4) < (0)) __PYX_ERR(6, 1611, __pyx_L1_error)
        __pyx_t_14 = NULL;
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        goto __pyx_L12_unpacking_done;
        __pyx_L11_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __pyx_t_14 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(6, 1611, __pyx_L1_error)
        __pyx_L12_unpacking_done:;
      }
      __Pyx_XDECREF_SET(__pyx_v_ns, __pyx_t_10);
      __pyx_t_10 = 0;
      __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_8);
      __pyx_t_8 = 0;
      __Pyx_XDECREF_SET(__pyx_v__, __pyx_t_11);
      __pyx_t_11 = 0;
      __Pyx_DECREF_SET(__pyx_v__, __pyx_t_12);
      __pyx_t_12 = 0;

      /* "src/lxml/serializer.pxi":1612
 * 
 *                 ns, name, _, _ = self._element_stack[-1]
 *                 if (c_method == OUTPUT_METHOD_HTML and             # <<<<<<<<<<<<<<
 *                         ns in (None, b'http://www.w3.org/1999/xhtml') and
 *                         name in (b'script', b'style')):
*/
      __pyx_t_1 = (__pyx_v_c_method == __pyx_e_4lxml_5etree_OUTPUT_METHOD_HTML);
      if (__pyx_t_1) {
      } else {
        __pyx_t_7 = __pyx_t_1;
        goto __pyx_L14_bool_binop_done;
      }

      /* "src/lxml/serializer.pxi":1613
 *                 ns, name, _, _ = self._element_stack[-1]
 *                 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(bstring), _cstr(bstring))
*/
      __Pyx_INCREF(__pyx_v_ns);
      __pyx_t_6 = __pyx_v_ns;
      __pyx_t_12 = PyObject_RichCompare(__pyx_t_6, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) __PYX_ERR(6, 1613, __pyx_L1_error)
      __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(6, 1613, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      if (!__pyx_t_15) {
      } else {
        __pyx_t_1 = __pyx_t_15;
        goto __pyx_L17_bool_binop_done;
      }
      __pyx_t_15 = (__Pyx_PyBytes_Equals(__pyx_t_6, __pyx_mstate_global->__pyx_kp_b_http_www_w3_org_1999_xhtml, Py_EQ)); if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(6, 1613, __pyx_L1_error)
      __pyx_t_1 = __pyx_t_15;
      __pyx_L17_bool_binop_done:;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_15 = __pyx_t_1;
      if (__pyx_t_15) {
      } else {
        __pyx_t_7 = __pyx_t_15;
        goto __pyx_L14_bool_binop_done;
      }

      /* "src/lxml/serializer.pxi":1614
 *                 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(bstring), _cstr(bstring))
 * 
*/
      __Pyx_INCREF(__pyx_v_name);
      __pyx_t_6 = __pyx_v_name;
      __pyx_t_1 = (__Pyx_PyBytes_Equals(__pyx_t_6, __pyx_mstate_global->__pyx_n_b_script, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(6, 1614, __pyx_L1_error)
      if (!__pyx_t_1) {
      } else {
        __pyx_t_15 = __pyx_t_1;
        goto __pyx_L19_bool_binop_done;
      }
      __pyx_t_1 = (__Pyx_PyBytes_Equals(__pyx_t_6, __pyx_mstate_global->__pyx_n_b_style, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(6, 1614, __pyx_L1_error)
      __pyx_t_15 = __pyx_t_1;
      __pyx_L19_bool_binop_done:;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_1 = __pyx_t_15;
      __pyx_t_7 = __pyx_t_1;
      __pyx_L14_bool_binop_done:;

      /* "src/lxml/serializer.pxi":1612
 * 
 *                 ns, name, _, _ = self._element_stack[-1]
 *                 if (c_method == OUTPUT_METHOD_HTML and             # <<<<<<<<<<<<<<
 *                         ns in (None, b'http://www.w3.org/1999/xhtml') and
 *                         name in (b'script', b'style')):
*/
      if (__pyx_t_7) {

        /* "src/lxml/serializer.pxi":1615
 *                         ns in (None, b'http://www.w3.org/1999/xhtml') and
 *                         name in (b'script', b'style')):
 *                     tree.xmlOutputBufferWrite(self._c_out, len(bstring), _cstr(bstring))             # <<<<<<<<<<<<<<
 * 
 *                 else:
*/
        if (unlikely(__pyx_v_bstring == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
          __PYX_ERR(6, 1615, __pyx_L1_error)
        }
        __pyx_t_16 = __Pyx_PyBytes_GET_SIZE(__pyx_v_bstring); if (unlikely(__pyx_t_16 == ((Py_ssize_t)-1))) __PYX_ERR(6, 1615, __pyx_L1_error)
        (void)(xmlOutputBufferWrite(__pyx_v_self->_c_out, __pyx_t_16, PyBytes_AS_STRING(__pyx_v_bstring)));

        /* "src/lxml/serializer.pxi":1612
 * 
 *                 ns, name, _, _ = self._element_stack[-1]
 *                 if (c_method == OUTPUT_METHOD_HTML and             # <<<<<<<<<<<<<<
 *                         ns in (None, b'http://www.w3.org/1999/xhtml') and
 *                         name in (b'script', b'style')):
*/
        goto __pyx_L13;
      }

      /* "src/lxml/serializer.pxi":1618
 * 
 *                 else:
 *                     tree.xmlOutputBufferWriteEscape(self._c_out, _xcstr(bstring), NULL)             # <<<<<<<<<<<<<<
 * 
 *             elif isinstance(content, CDATA):
*/
      /*else*/ {
        (void)(xmlOutputBufferWriteEscape(__pyx_v_self->_c_out, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_bstring), NULL));
      }
      __pyx_L13:;

      /* "src/lxml/serializer.pxi":1603
 * 
 *         for content in args:
 *             if _isString(content):             # <<<<<<<<<<<<<<
 *                 if self._status != WRITER_IN_ELEMENT:
 *                     if self._status > WRITER_IN_ELEMENT or content.strip():
*/
      goto __pyx_L5;
    }

    /* "src/lxml/serializer.pxi":1620
 *                     tree.xmlOutputBufferWriteEscape(self._c_out, _xcstr(bstring), NULL)
 * 
 *             elif isinstance(content, CDATA):             # <<<<<<<<<<<<<<
 *                 if self._status > WRITER_IN_ELEMENT:
 *                     raise LxmlSyntaxError("not in an element")
*/
    __pyx_t_7 = __Pyx_TypeCheck(__pyx_v_content, __pyx_mstate_global->__pyx_ptype_4lxml_5etree_CDATA); 
    if (__pyx_t_7) {

      /* "src/lxml/serializer.pxi":1621
 * 
 *             elif isinstance(content, CDATA):
 *                 if self._status > WRITER_IN_ELEMENT:             # <<<<<<<<<<<<<<
 *                     raise LxmlSyntaxError("not in an element")
 *                 _write_cdata_string(self._c_out, (<CDATA>content)._utf8_data)
*/
      __pyx_t_7 = (__pyx_v_self->_status > __pyx_e_4lxml_5etree_WRITER_IN_ELEMENT);
      if (unlikely(__pyx_t_7)) {

        /* "src/lxml/serializer.pxi":1622
 *             elif isinstance(content, CDATA):
 *                 if self._status > WRITER_IN_ELEMENT:
 *                     raise LxmlSyntaxError("not in an element")             # <<<<<<<<<<<<<<
 *                 _write_cdata_string(self._c_out, (<CDATA>content)._utf8_data)
 * 
*/
        __pyx_t_12 = NULL;
        __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_LxmlSyntaxError); if (unlikely(!__pyx_t_11)) __PYX_ERR(6, 1622, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_9 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_11))) {
          __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_11);
          assert(__pyx_t_12);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_11);
          __Pyx_INCREF(__pyx_t_12);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_11, __pyx__function);
          __pyx_t_9 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_mstate_global->__pyx_kp_u_not_in_an_element};
          __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_11, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 1622, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
        }
        __Pyx_Raise(__pyx_t_6, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __PYX_ERR(6, 1622, __pyx_L1_error)

        /* "src/lxml/serializer.pxi":1621
 * 
 *             elif isinstance(content, CDATA):
 *                 if self._status > WRITER_IN_ELEMENT:             # <<<<<<<<<<<<<<
 *                     raise LxmlSyntaxError("not in an element")
 *                 _write_cdata_string(self._c_out, (<CDATA>content)._utf8_data)
*/
      }

      /* "src/lxml/serializer.pxi":1623
 *                 if self._status > WRITER_IN_ELEMENT:
 *                     raise LxmlSyntaxError("not in an element")
 *                 _write_cdata_string(self._c_out, (<CDATA>content)._utf8_data)             # <<<<<<<<<<<<<<
 * 
 *             elif iselement(content):
*/
      __pyx_t_6 = ((struct __pyx_obj_4lxml_5etree_CDATA *)__pyx_v_content)->_utf8_data;
      __Pyx_INCREF(__pyx_t_6);
      __pyx_t_11 = __pyx_f_4lxml_5etree__write_cdata_string(__pyx_v_self->_c_out, ((PyObject*)__pyx_t_6)); if (unlikely(!__pyx_t_11)) __PYX_ERR(6, 1623, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

      /* "src/lxml/serializer.pxi":1620
 *                     tree.xmlOutputBufferWriteEscape(self._c_out, _xcstr(bstring), NULL)
 * 
 *             elif isinstance(content, CDATA):             # <<<<<<<<<<<<<<
 *                 if self._status > WRITER_IN_ELEMENT:
 *                     raise LxmlSyntaxError("not in an element")
*/
      goto __pyx_L5;
    }

    /* "src/lxml/serializer.pxi":1625
 *                 _write_cdata_string(self._c_out, (<CDATA>content)._utf8_data)
 * 
 *             elif iselement(content):             # <<<<<<<<<<<<<<
 *                 if self._status > WRITER_IN_ELEMENT:
 *                     raise LxmlSyntaxError("cannot append trailing element to complete XML document")
*/
    __pyx_t_6 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_iselement); if (unlikely(!__pyx_t_12)) __PYX_ERR(6, 1625, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_9 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_12))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_12);
      assert(__pyx_t_6);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_12);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_12, __pyx__function);
      __pyx_t_9 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_v_content};
      __pyx_t_11 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_12, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      if (unlikely(!__pyx_t_11)) __PYX_ERR(6, 1625, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
    }
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(6, 1625, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    if (__pyx_t_7) {

      /* "src/lxml/serializer.pxi":1626
 * 
 *             elif iselement(content):
 *                 if self._status > WRITER_IN_ELEMENT:             # <<<<<<<<<<<<<<
 *                     raise LxmlSyntaxError("cannot append trailing element to complete XML document")
 *                 _writeNodeToBuffer(self._c_out, (<_Element>content)._c_node,
*/
      __pyx_t_7 = (__pyx_v_self->_status > __pyx_e_4lxml_5etree_WRITER_IN_ELEMENT);
      if (unlikely(__pyx_t_7)) {

        /* "src/lxml/serializer.pxi":1627
 *             elif iselement(content):
 *                 if self._status > WRITER_IN_ELEMENT:
 *                     raise LxmlSyntaxError("cannot append trailing element to complete XML document")             # <<<<<<<<<<<<<<
 *                 _writeNodeToBuffer(self._c_out, (<_Element>content)._c_node,
 *                                    self._c_encoding, NULL, c_method,
*/
        __pyx_t_12 = NULL;
        __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_LxmlSyntaxError); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 1627, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_9 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_6))) {
          __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_6);
          assert(__pyx_t_12);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_12);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
          __pyx_t_9 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_mstate_global->__pyx_kp_u_cannot_append_trailing_element_t};
          __pyx_t_11 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          if (unlikely(!__pyx_t_11)) __PYX_ERR(6, 1627, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_11);
        }
        __Pyx_Raise(__pyx_t_11, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __PYX_ERR(6, 1627, __pyx_L1_error)

        /* "src/lxml/serializer.pxi":1626
 * 
 *             elif iselement(content):
 *                 if self._status > WRITER_IN_ELEMENT:             # <<<<<<<<<<<<<<
 *                     raise LxmlSyntaxError("cannot append trailing element to complete XML document")
 *                 _writeNodeToBuffer(self._c_out, (<_Element>content)._c_node,
*/
      }

      /* "src/lxml/serializer.pxi":1628
 *                 if self._status > WRITER_IN_ELEMENT:
 *                     raise LxmlSyntaxError("cannot append trailing element to complete XML document")
 *                 _writeNodeToBuffer(self._c_out, (<_Element>content)._c_node,             # <<<<<<<<<<<<<<
 *                                    self._c_encoding, NULL, c_method,
 *                                    False, False, pretty_print, with_tail, False)
*/
      __pyx_f_4lxml_5etree__writeNodeToBuffer(__pyx_v_self->_c_out, ((struct LxmlElement *)__pyx_v_content)->_c_node, __pyx_v_self->_c_encoding, NULL, __pyx_v_c_method, 0, 0, __pyx_v_pretty_print, __pyx_v_with_tail, 0);

      /* "src/lxml/serializer.pxi":1631
 *                                    self._c_encoding, NULL, c_method,
 *                                    False, False, pretty_print, with_tail, False)
 *                 if (<_Element>content)._c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *                     if not self._element_stack:
 *                         self._status = WRITER_FINISHED
*/
      __pyx_t_7 = (((struct LxmlElement *)__pyx_v_content)->_c_node->type == XML_ELEMENT_NODE);
      if (__pyx_t_7) {

        /* "src/lxml/serializer.pxi":1632
 *                                    False, False, pretty_print, with_tail, False)
 *                 if (<_Element>content)._c_node.type == tree.XML_ELEMENT_NODE:
 *                     if not self._element_stack:             # <<<<<<<<<<<<<<
 *                         self._status = WRITER_FINISHED
 * 
*/
        if (__pyx_v_self->_element_stack == Py_None) __pyx_t_7 = 0;
        else
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_v_self->_element_stack);
          if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(6, 1632, __pyx_L1_error)
          __pyx_t_7 = (__pyx_temp != 0);
        }

        __pyx_t_1 = (!__pyx_t_7);
        if (__pyx_t_1) {

          /* "src/lxml/serializer.pxi":1633
 *                 if (<_Element>content)._c_node.type == tree.XML_ELEMENT_NODE:
 *                     if not self._element_stack:
 *                         self._status = WRITER_FINISHED             # <<<<<<<<<<<<<<
 * 
 *             elif content is not None:
*/
          __pyx_v_self->_status = __pyx_e_4lxml_5etree_WRITER_FINISHED;

          /* "src/lxml/serializer.pxi":1632
 *                                    False, False, pretty_print, with_tail, False)
 *                 if (<_Element>content)._c_node.type == tree.XML_ELEMENT_NODE:
 *                     if not self._element_stack:             # <<<<<<<<<<<<<<
 *                         self._status = WRITER_FINISHED
 * 
*/
        }

        /* "src/lxml/serializer.pxi":1631
 *                                    self._c_encoding, NULL, c_method,
 *                                    False, False, pretty_print, with_tail, False)
 *                 if (<_Element>content)._c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *                     if not self._element_stack:
 *                         self._status = WRITER_FINISHED
*/
      }

      /* "src/lxml/serializer.pxi":1625
 *                 _write_cdata_string(self._c_out, (<CDATA>content)._utf8_data)
 * 
 *             elif iselement(content):             # <<<<<<<<<<<<<<
 *                 if self._status > WRITER_IN_ELEMENT:
 *                     raise LxmlSyntaxError("cannot append trailing element to complete XML document")
*/
      goto __pyx_L5;
    }

    /* "src/lxml/serializer.pxi":1635
 *                         self._status = WRITER_FINISHED
 * 
 *             elif content is not None:             # <<<<<<<<<<<<<<
 *                 raise TypeError(
 *                     f"got invalid input value of type {type(content)}, expected string, CDATA or Element")
*/
    __pyx_t_1 = (__pyx_v_content != Py_None);
    if (unlikely(__pyx_t_1)) {

      /* "src/lxml/serializer.pxi":1636
 * 
 *             elif content is not None:
 *                 raise TypeError(             # <<<<<<<<<<<<<<
 *                     f"got invalid input value of type {type(content)}, expected string, CDATA or Element")
 * 
*/
      __pyx_t_6 = NULL;

      /* "src/lxml/serializer.pxi":1637
 *             elif content is not None:
 *                 raise TypeError(
 *                     f"got invalid input value of type {type(content)}, expected string, CDATA or Element")             # <<<<<<<<<<<<<<
 * 
 *             self._handle_error(self._c_out.error)
*/
      __pyx_t_12 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(__pyx_v_content)), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_12)) __PYX_ERR(6, 1637, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_17[0] = __pyx_mstate_global->__pyx_kp_u_got_invalid_input_value_of_type;
      __pyx_t_17[1] = __pyx_t_12;
      __pyx_t_17[2] = __pyx_mstate_global->__pyx_kp_u_expected_string_CDATA_or_Elemen;
      __pyx_t_8 = __Pyx_PyUnicode_Join(__pyx_t_17, 3, 32 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_12) + 35, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_12));
      if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 1637, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_9 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_8};
        __pyx_t_11 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (unlikely(!__pyx_t_11)) __PYX_ERR(6, 1636, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
      }
      __Pyx_Raise(__pyx_t_11, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __PYX_ERR(6, 1636, __pyx_L1_error)

      /* "src/lxml/serializer.pxi":1635
 *                         self._status = WRITER_FINISHED
 * 
 *             elif content is not None:             # <<<<<<<<<<<<<<
 *                 raise TypeError(
 *                     f"got invalid input value of type {type(content)}, expected string, CDATA or Element")
*/
    }
    __pyx_L5:;

    /* "src/lxml/serializer.pxi":1639
 *                     f"got invalid input value of type {type(content)}, expected string, CDATA or Element")
 * 
 *             self._handle_error(self._c_out.error)             # <<<<<<<<<<<<<<
 * 
 *         if not self._buffered:
*/
    __pyx_t_11 = __pyx_f_4lxml_5etree_22_IncrementalFileWriter__handle_error(__pyx_v_self, __pyx_v_self->_c_out->error); if (unlikely(!__pyx_t_11)) __PYX_ERR(6, 1639, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

    /* "src/lxml/serializer.pxi":1602
 *         c_method = self._method if method is None else _findOutputMethod(method)
 * 
 *         for content in args:             # <<<<<<<<<<<<<<
 *             if _isString(content):
 *                 if self._status != WRITER_IN_ELEMENT:
*/
    __pyx_L3_continue:;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "src/lxml/serializer.pxi":1641
 *             self._handle_error(self._c_out.error)
 * 
 *         if not self._buffered:             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferFlush(self._c_out)
 *             self._handle_error(self._c_out.error)
*/
  __pyx_t_1 = (!__pyx_v_self->_buffered);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1642
 * 
 *         if not self._buffered:
 *             tree.xmlOutputBufferFlush(self._c_out)             # <<<<<<<<<<<<<<
 *             self._handle_error(self._c_out.error)
 * 
*/
    (void)(xmlOutputBufferFlush(__pyx_v_self->_c_out));

    /* "src/lxml/serializer.pxi":1643
 *         if not self._buffered:
 *             tree.xmlOutputBufferFlush(self._c_out)
 *             self._handle_error(self._c_out.error)             # <<<<<<<<<<<<<<
 * 
 *     def flush(self):
*/
    __pyx_t_4 = __pyx_f_4lxml_5etree_22_IncrementalFileWriter__handle_error(__pyx_v_self, __pyx_v_self->_c_out->error); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 1643, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "src/lxml/serializer.pxi":1641
 *             self._handle_error(self._c_out.error)
 * 
 *         if not self._buffered:             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferFlush(self._c_out)
 *             self._handle_error(self._c_out.error)
*/
  }

  /* "src/lxml/serializer.pxi":1591
 *         return flat_namespaces_map, new_namespaces
 * 
 *     def write(self, *args, bint with_tail=True, bint pretty_print=False, method=None):             # <<<<<<<<<<<<<<
 *         """write(self, *args, with_tail=True, pretty_print=False, method=None)
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("lxml.etree._IncrementalFileWriter.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_content);
  __Pyx_XDECREF(__pyx_v_bstring);
  __Pyx_XDECREF(__pyx_v_ns);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v__);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1645
 *             self._handle_error(self._c_out.error)
 * 
 *     def flush(self):             # <<<<<<<<<<<<<<
 *         """flush(self)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_22_IncrementalFileWriter_15flush(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_22_IncrementalFileWriter_14flush, "flush(self)\n\n        Write any pending content of the current output buffer to the stream.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_22_IncrementalFileWriter_15flush = {"flush", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_22_IncrementalFileWriter_15flush, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_22_IncrementalFileWriter_14flush};
static PyObject *__pyx_pw_4lxml_5etree_22_IncrementalFileWriter_15flush(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("flush (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("flush", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("flush", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_22_IncrementalFileWriter_14flush(((struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_22_IncrementalFileWriter_14flush(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("flush", 0);

  /* "src/lxml/serializer.pxi":1650
 *         Write any pending content of the current output buffer to the stream.
 *         """
 *         assert self._c_out is not NULL             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferFlush(self._c_out)
 *         self._handle_error(self._c_out.error)
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = (__pyx_v_self->_c_out != NULL);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
      __PYX_ERR(6, 1650, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(6, 1650, __pyx_L1_error)
  #endif

  /* "src/lxml/serializer.pxi":1651
 *         """
 *         assert self._c_out is not NULL
 *         tree.xmlOutputBufferFlush(self._c_out)             # <<<<<<<<<<<<<<
 *         self._handle_error(self._c_out.error)
 * 
*/
  (void)(xmlOutputBufferFlush(__pyx_v_self->_c_out));

  /* "src/lxml/serializer.pxi":1652
 *         assert self._c_out is not NULL
 *         tree.xmlOutputBufferFlush(self._c_out)
 *         self._handle_error(self._c_out.error)             # <<<<<<<<<<<<<<
 * 
 *     cdef _close(self, bint raise_on_error):
*/
  __pyx_t_2 = __pyx_f_4lxml_5etree_22_IncrementalFileWriter__handle_error(__pyx_v_self, __pyx_v_self->_c_out->error); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1652, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/serializer.pxi":1645
 *             self._handle_error(self._c_out.error)
 * 
 *     def flush(self):             # <<<<<<<<<<<<<<
 *         """flush(self)
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._IncrementalFileWriter.flush", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1654
 *         self._handle_error(self._c_out.error)
 * 
 *     cdef _close(self, bint raise_on_error):             # <<<<<<<<<<<<<<
 *         if raise_on_error:
 *             if self._status < WRITER_IN_ELEMENT:
*/

static PyObject *__pyx_f_4lxml_5etree_22_IncrementalFileWriter__close(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self, int __pyx_v_raise_on_error) {
  int __pyx_v_error_result;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_close", 0);

  /* "src/lxml/serializer.pxi":1655
 * 
 *     cdef _close(self, bint raise_on_error):
 *         if raise_on_error:             # <<<<<<<<<<<<<<
 *             if self._status < WRITER_IN_ELEMENT:
 *                 raise LxmlSyntaxError("no content written")
*/
  if (__pyx_v_raise_on_error) {

    /* "src/lxml/serializer.pxi":1656
 *     cdef _close(self, bint raise_on_error):
 *         if raise_on_error:
 *             if self._status < WRITER_IN_ELEMENT:             # <<<<<<<<<<<<<<
 *                 raise LxmlSyntaxError("no content written")
 *             if self._element_stack:
*/
    __pyx_t_1 = (__pyx_v_self->_status < __pyx_e_4lxml_5etree_WRITER_IN_ELEMENT);
    if (unlikely(__pyx_t_1)) {

      /* "src/lxml/serializer.pxi":1657
 *         if raise_on_error:
 *             if self._status < WRITER_IN_ELEMENT:
 *                 raise LxmlSyntaxError("no content written")             # <<<<<<<<<<<<<<
 *             if self._element_stack:
 *                 raise LxmlSyntaxError("pending open tags on close")
*/
      __pyx_t_3 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_LxmlSyntaxError); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 1657, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
        assert(__pyx_t_3);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
        __pyx_t_5 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_no_content_written};
        __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1657, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(6, 1657, __pyx_L1_error)

      /* "src/lxml/serializer.pxi":1656
 *     cdef _close(self, bint raise_on_error):
 *         if raise_on_error:
 *             if self._status < WRITER_IN_ELEMENT:             # <<<<<<<<<<<<<<
 *                 raise LxmlSyntaxError("no content written")
 *             if self._element_stack:
*/
    }

    /* "src/lxml/serializer.pxi":1658
 *             if self._status < WRITER_IN_ELEMENT:
 *                 raise LxmlSyntaxError("no content written")
 *             if self._element_stack:             # <<<<<<<<<<<<<<
 *                 raise LxmlSyntaxError("pending open tags on close")
 *         error_result = self._c_out.error
*/
    if (__pyx_v_self->_element_stack == Py_None) __pyx_t_1 = 0;
    else
    {
      Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_v_self->_element_stack);
      if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(6, 1658, __pyx_L1_error)
      __pyx_t_1 = (__pyx_temp != 0);
    }

    if (unlikely(__pyx_t_1)) {

      /* "src/lxml/serializer.pxi":1659
 *                 raise LxmlSyntaxError("no content written")
 *             if self._element_stack:
 *                 raise LxmlSyntaxError("pending open tags on close")             # <<<<<<<<<<<<<<
 *         error_result = self._c_out.error
 *         if error_result == xmlerror.XML_ERR_OK:
*/
      __pyx_t_4 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_LxmlSyntaxError); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1659, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
        assert(__pyx_t_4);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
        __pyx_t_5 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_pending_open_tags_on_close};
        __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1659, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(6, 1659, __pyx_L1_error)

      /* "src/lxml/serializer.pxi":1658
 *             if self._status < WRITER_IN_ELEMENT:
 *                 raise LxmlSyntaxError("no content written")
 *             if self._element_stack:             # <<<<<<<<<<<<<<
 *                 raise LxmlSyntaxError("pending open tags on close")
 *         error_result = self._c_out.error
*/
    }

    /* "src/lxml/serializer.pxi":1655
 * 
 *     cdef _close(self, bint raise_on_error):
 *         if raise_on_error:             # <<<<<<<<<<<<<<
 *             if self._status < WRITER_IN_ELEMENT:
 *                 raise LxmlSyntaxError("no content written")
*/
  }

  /* "src/lxml/serializer.pxi":1660
 *             if self._element_stack:
 *                 raise LxmlSyntaxError("pending open tags on close")
 *         error_result = self._c_out.error             # <<<<<<<<<<<<<<
 *         if error_result == xmlerror.XML_ERR_OK:
 *             error_result = tree.xmlOutputBufferClose(self._c_out)
*/
  __pyx_t_6 = __pyx_v_self->_c_out->error;
  __pyx_v_error_result = __pyx_t_6;

  /* "src/lxml/serializer.pxi":1661
 *                 raise LxmlSyntaxError("pending open tags on close")
 *         error_result = self._c_out.error
 *         if error_result == xmlerror.XML_ERR_OK:             # <<<<<<<<<<<<<<
 *             error_result = tree.xmlOutputBufferClose(self._c_out)
 *             if error_result != -1:
*/
  __pyx_t_1 = (__pyx_v_error_result == XML_ERR_OK);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1662
 *         error_result = self._c_out.error
 *         if error_result == xmlerror.XML_ERR_OK:
 *             error_result = tree.xmlOutputBufferClose(self._c_out)             # <<<<<<<<<<<<<<
 *             if error_result != -1:
 *                 error_result = xmlerror.XML_ERR_OK
*/
    __pyx_v_error_result = xmlOutputBufferClose(__pyx_v_self->_c_out);

    /* "src/lxml/serializer.pxi":1663
 *         if error_result == xmlerror.XML_ERR_OK:
 *             error_result = tree.xmlOutputBufferClose(self._c_out)
 *             if error_result != -1:             # <<<<<<<<<<<<<<
 *                 error_result = xmlerror.XML_ERR_OK
 *         else:
*/
    __pyx_t_1 = (__pyx_v_error_result != -1L);
    if (__pyx_t_1) {

      /* "src/lxml/serializer.pxi":1664
 *             error_result = tree.xmlOutputBufferClose(self._c_out)
 *             if error_result != -1:
 *                 error_result = xmlerror.XML_ERR_OK             # <<<<<<<<<<<<<<
 *         else:
 *             tree.xmlOutputBufferClose(self._c_out)
*/
      __pyx_v_error_result = XML_ERR_OK;

      /* "src/lxml/serializer.pxi":1663
 *         if error_result == xmlerror.XML_ERR_OK:
 *             error_result = tree.xmlOutputBufferClose(self._c_out)
 *             if error_result != -1:             # <<<<<<<<<<<<<<
 *                 error_result = xmlerror.XML_ERR_OK
 *         else:
*/
    }

    /* "src/lxml/serializer.pxi":1661
 *                 raise LxmlSyntaxError("pending open tags on close")
 *         error_result = self._c_out.error
 *         if error_result == xmlerror.XML_ERR_OK:             # <<<<<<<<<<<<<<
 *             error_result = tree.xmlOutputBufferClose(self._c_out)
 *             if error_result != -1:
*/
    goto __pyx_L6;
  }

  /* "src/lxml/serializer.pxi":1666
 *                 error_result = xmlerror.XML_ERR_OK
 *         else:
 *             tree.xmlOutputBufferClose(self._c_out)             # <<<<<<<<<<<<<<
 *         self._status = WRITER_FINISHED
 *         self._c_out = NULL
*/
  /*else*/ {
    (void)(xmlOutputBufferClose(__pyx_v_self->_c_out));
  }
  __pyx_L6:;

  /* "src/lxml/serializer.pxi":1667
 *         else:
 *             tree.xmlOutputBufferClose(self._c_out)
 *         self._status = WRITER_FINISHED             # <<<<<<<<<<<<<<
 *         self._c_out = NULL
 *         del self._element_stack[:]
*/
  __pyx_v_self->_status = __pyx_e_4lxml_5etree_WRITER_FINISHED;

  /* "src/lxml/serializer.pxi":1668
 *             tree.xmlOutputBufferClose(self._c_out)
 *         self._status = WRITER_FINISHED
 *         self._c_out = NULL             # <<<<<<<<<<<<<<
 *         del self._element_stack[:]
 *         if raise_on_error:
*/
  __pyx_v_self->_c_out = NULL;

  /* "src/lxml/serializer.pxi":1669
 *         self._status = WRITER_FINISHED
 *         self._c_out = NULL
 *         del self._element_stack[:]             # <<<<<<<<<<<<<<
 *         if raise_on_error:
 *             self._handle_error(error_result)
*/
  if (unlikely(__pyx_v_self->_element_stack == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(6, 1669, __pyx_L1_error)
  }
  if (__Pyx_PyObject_DelSlice(__pyx_v_self->_element_stack, 0, 0, NULL, NULL, NULL, 0, 0, 1) < (0)) __PYX_ERR(6, 1669, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1670
 *         self._c_out = NULL
 *         del self._element_stack[:]
 *         if raise_on_error:             # <<<<<<<<<<<<<<
 *             self._handle_error(error_result)
 * 
*/
  if (__pyx_v_raise_on_error) {

    /* "src/lxml/serializer.pxi":1671
 *         del self._element_stack[:]
 *         if raise_on_error:
 *             self._handle_error(error_result)             # <<<<<<<<<<<<<<
 * 
 *     cdef _handle_error(self, int error_result):
*/
    __pyx_t_2 = __pyx_f_4lxml_5etree_22_IncrementalFileWriter__handle_error(__pyx_v_self, __pyx_v_error_result); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1671, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/serializer.pxi":1670
 *         self._c_out = NULL
 *         del self._element_stack[:]
 *         if raise_on_error:             # <<<<<<<<<<<<<<
 *             self._handle_error(error_result)
 * 
*/
  }

  /* "src/lxml/serializer.pxi":1654
 *         self._handle_error(self._c_out.error)
 * 
 *     cdef _close(self, bint raise_on_error):             # <<<<<<<<<<<<<<
 *         if raise_on_error:
 *             if self._status < WRITER_IN_ELEMENT:
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._IncrementalFileWriter._close", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1673
 *             self._handle_error(error_result)
 * 
 *     cdef _handle_error(self, int error_result):             # <<<<<<<<<<<<<<
 *         if error_result != xmlerror.XML_ERR_OK:
 *             if self._target is not None:
*/

static PyObject *__pyx_f_4lxml_5etree_22_IncrementalFileWriter__handle_error(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self, int __pyx_v_error_result) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_handle_error", 0);

  /* "src/lxml/serializer.pxi":1674
 * 
 *     cdef _handle_error(self, int error_result):
 *         if error_result != xmlerror.XML_ERR_OK:             # <<<<<<<<<<<<<<
 *             if self._target is not None:
 *                 self._target._exc_context._raise_if_stored()
*/
  __pyx_t_1 = (__pyx_v_error_result != XML_ERR_OK);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1675
 *     cdef _handle_error(self, int error_result):
 *         if error_result != xmlerror.XML_ERR_OK:
 *             if self._target is not None:             # <<<<<<<<<<<<<<
 *                 self._target._exc_context._raise_if_stored()
 *             _raiseSerialisationError(error_result)
*/
    __pyx_t_1 = (((PyObject *)__pyx_v_self->_target) != Py_None);
    if (__pyx_t_1) {

      /* "src/lxml/serializer.pxi":1676
 *         if error_result != xmlerror.XML_ERR_OK:
 *             if self._target is not None:
 *                 self._target._exc_context._raise_if_stored()             # <<<<<<<<<<<<<<
 *             _raiseSerialisationError(error_result)
 * 
*/
      __pyx_t_2 = __pyx_f_4lxml_5etree_17_ExceptionContext__raise_if_stored(__pyx_v_self->_target->_exc_context); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(6, 1676, __pyx_L1_error)

      /* "src/lxml/serializer.pxi":1675
 *     cdef _handle_error(self, int error_result):
 *         if error_result != xmlerror.XML_ERR_OK:
 *             if self._target is not None:             # <<<<<<<<<<<<<<
 *                 self._target._exc_context._raise_if_stored()
 *             _raiseSerialisationError(error_result)
*/
    }

    /* "src/lxml/serializer.pxi":1677
 *             if self._target is not None:
 *                 self._target._exc_context._raise_if_stored()
 *             _raiseSerialisationError(error_result)             # <<<<<<<<<<<<<<
 * 
 * 
*/
    __pyx_t_3 = __pyx_f_4lxml_5etree__raiseSerialisationError(__pyx_v_error_result); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1677, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":1674
 * 
 *     cdef _handle_error(self, int error_result):
 *         if error_result != xmlerror.XML_ERR_OK:             # <<<<<<<<<<<<<<
 *             if self._target is not None:
 *                 self._target._exc_context._raise_if_stored()
*/
  }

  /* "src/lxml/serializer.pxi":1673
 *             self._handle_error(error_result)
 * 
 *     cdef _handle_error(self, int error_result):             # <<<<<<<<<<<<<<
 *         if error_result != xmlerror.XML_ERR_OK:
 *             if self._target is not None:
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._IncrementalFileWriter._handle_error", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1684
 * cdef class _AsyncDataWriter:
 *     cdef list _data
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._data = []
 * 
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_16_AsyncDataWriter_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_16_AsyncDataWriter_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, __pyx_nargs); return -1; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return -1;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__cinit__", __pyx_kwds); return -1;}
  __pyx_r = __pyx_pf_4lxml_5etree_16_AsyncDataWriter___cinit__(((struct __pyx_obj_4lxml_5etree__AsyncDataWriter *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_16_AsyncDataWriter___cinit__(struct __pyx_obj_4lxml_5etree__AsyncDataWriter *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "src/lxml/serializer.pxi":1685
 *     cdef list _data
 *     def __cinit__(self):
 *         self._data = []             # <<<<<<<<<<<<<<
 * 
 *     cdef bytes collect(self):
*/
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1685, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_data);
  __Pyx_DECREF(__pyx_v_self->_data);
  __pyx_v_self->_data = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/serializer.pxi":1684
 * cdef class _AsyncDataWriter:
 *     cdef list _data
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._data = []
 * 
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._AsyncDataWriter.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1687
 *         self._data = []
 * 
 *     cdef bytes collect(self):             # <<<<<<<<<<<<<<
 *         data = b''.join(self._data)
 *         del self._data[:]
*/

static PyObject *__pyx_f_4lxml_5etree_16_AsyncDataWriter_collect(struct __pyx_obj_4lxml_5etree__AsyncDataWriter *__pyx_v_self) {
  PyObject *__pyx_v_data = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("collect", 0);

  /* "src/lxml/serializer.pxi":1688
 * 
 *     cdef bytes collect(self):
 *         data = b''.join(self._data)             # <<<<<<<<<<<<<<
 *         del self._data[:]
 *         return data
*/
  __pyx_t_1 = __pyx_v_self->_data;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyBytes_Join(__pyx_mstate_global->__pyx_kp_b__8, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1688, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_data = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/serializer.pxi":1689
 *     cdef bytes collect(self):
 *         data = b''.join(self._data)
 *         del self._data[:]             # <<<<<<<<<<<<<<
 *         return data
 * 
*/
  if (unlikely(__pyx_v_self->_data == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(6, 1689, __pyx_L1_error)
  }
  if (__Pyx_PyObject_DelSlice(__pyx_v_self->_data, 0, 0, NULL, NULL, NULL, 0, 0, 1) < (0)) __PYX_ERR(6, 1689, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1690
 *         data = b''.join(self._data)
 *         del self._data[:]
 *         return data             # <<<<<<<<<<<<<<
 * 
 *     def write(self, data):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_data);
  __pyx_r = __pyx_v_data;
  goto __pyx_L0;

  /* "src/lxml/serializer.pxi":1687
 *         self._data = []
 * 
 *     cdef bytes collect(self):             # <<<<<<<<<<<<<<
 *         data = b''.join(self._data)
 *         del self._data[:]
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._AsyncDataWriter.collect", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_data);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1692
 *         return data
 * 
 *     def write(self, data):             # <<<<<<<<<<<<<<
 *         self._data.append(data)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_16_AsyncDataWriter_3write(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_16_AsyncDataWriter_3write = {"write", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_16_AsyncDataWriter_3write, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_16_AsyncDataWriter_3write(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_data = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_data,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(6, 1692, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 1692, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "write", 0) < (0)) __PYX_ERR(6, 1692, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("write", 1, 1, 1, i); __PYX_ERR(6, 1692, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 1692, __pyx_L3_error)
    }
    __pyx_v_data = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("write", 1, 1, 1, __pyx_nargs); __PYX_ERR(6, 1692, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._AsyncDataWriter.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_16_AsyncDataWriter_2write(((struct __pyx_obj_4lxml_5etree__AsyncDataWriter *)__pyx_v_self), __pyx_v_data);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_16_AsyncDataWriter_2write(struct __pyx_obj_4lxml_5etree__AsyncDataWriter *__pyx_v_self, PyObject *__pyx_v_data) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("write", 0);

  /* "src/lxml/serializer.pxi":1693
 * 
 *     def write(self, data):
 *         self._data.append(data)             # <<<<<<<<<<<<<<
 * 
 *     def close(self):
*/
  if (unlikely(__pyx_v_self->_data == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
    __PYX_ERR(6, 1693, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyList_Append(__pyx_v_self->_data, __pyx_v_data); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(6, 1693, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1692
 *         return data
 * 
 *     def write(self, data):             # <<<<<<<<<<<<<<
 *         self._data.append(data)
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._AsyncDataWriter.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1695
 *         self._data.append(data)
 * 
 *     def close(self):             # <<<<<<<<<<<<<<
 *         pass
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_16_AsyncDataWriter_5close(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_16_AsyncDataWriter_5close = {"close", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_16_AsyncDataWriter_5close, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_16_AsyncDataWriter_5close(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("close (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("close", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("close", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_16_AsyncDataWriter_4close(((struct __pyx_obj_4lxml_5etree__AsyncDataWriter *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_16_AsyncDataWriter_4close(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__AsyncDataWriter *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("close", 0);

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1709
 *     cdef bint _buffered
 * 
 *     def __cinit__(self, async_outfile, bytes encoding, int compresslevel, bint close,             # <<<<<<<<<<<<<<
 *                   bint buffered, int method):
 *         self._flush_after_writes = 20
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_async_outfile = 0;
  PyObject *__pyx_v_encoding = 0;
  int __pyx_v_compresslevel;
  int __pyx_v_close;
  int __pyx_v_buffered;
  int __pyx_v_method;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[6] = {0,0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_async_outfile,&__pyx_mstate_global->__pyx_n_u_encoding,&__pyx_mstate_global->__pyx_n_u_compresslevel,&__pyx_mstate_global->__pyx_n_u_close,&__pyx_mstate_global->__pyx_n_u_buffered,&__pyx_mstate_global->__pyx_n_u_method,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(6, 1709, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  6:
        values[5] = __Pyx_ArgRef_VARARGS(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(6, 1709, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(6, 1709, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(6, 1709, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(6, 1709, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(6, 1709, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 1709, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__cinit__", 0) < (0)) __PYX_ERR(6, 1709, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 6; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 6, 6, i); __PYX_ERR(6, 1709, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 6)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 1709, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(6, 1709, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(6, 1709, __pyx_L3_error)
      values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(6, 1709, __pyx_L3_error)
      values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(6, 1709, __pyx_L3_error)
      values[5] = __Pyx_ArgRef_VARARGS(__pyx_args, 5);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(6, 1709, __pyx_L3_error)
    }
    __pyx_v_async_outfile = values[0];
    __pyx_v_encoding = ((PyObject*)values[1]);
    __pyx_v_compresslevel = __Pyx_PyLong_As_int(values[2]); if (unlikely((__pyx_v_compresslevel == (int)-1) && PyErr_Occurred())) __PYX_ERR(6, 1709, __pyx_L3_error)
    __pyx_v_close = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_close == (int)-1) && PyErr_Occurred())) __PYX_ERR(6, 1709, __pyx_L3_error)
    __pyx_v_buffered = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_buffered == (int)-1) && PyErr_Occurred())) __PYX_ERR(6, 1710, __pyx_L3_error)
    __pyx_v_method = __Pyx_PyLong_As_int(values[5]); if (unlikely((__pyx_v_method == (int)-1) && PyErr_Occurred())) __PYX_ERR(6, 1710, __pyx_L3_error)
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 6, 6, __pyx_nargs); __PYX_ERR(6, 1709, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._AsyncIncrementalFileWriter.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_encoding), (&PyBytes_Type), 1, "encoding", 1))) __PYX_ERR(6, 1709, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_27_AsyncIncrementalFileWriter___cinit__(((struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *)__pyx_v_self), __pyx_v_async_outfile, __pyx_v_encoding, __pyx_v_compresslevel, __pyx_v_close, __pyx_v_buffered, __pyx_v_method);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_27_AsyncIncrementalFileWriter___cinit__(struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_async_outfile, PyObject *__pyx_v_encoding, int __pyx_v_compresslevel, int __pyx_v_close, int __pyx_v_buffered, int __pyx_v_method) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "src/lxml/serializer.pxi":1711
 *     def __cinit__(self, async_outfile, bytes encoding, int compresslevel, bint close,
 *                   bint buffered, int method):
 *         self._flush_after_writes = 20             # <<<<<<<<<<<<<<
 *         self._async_outfile = async_outfile
 *         self._should_close = close
*/
  __pyx_v_self->_flush_after_writes = 20;

  /* "src/lxml/serializer.pxi":1712
 *                   bint buffered, int method):
 *         self._flush_after_writes = 20
 *         self._async_outfile = async_outfile             # <<<<<<<<<<<<<<
 *         self._should_close = close
 *         self._buffered = buffered
*/
  __Pyx_INCREF(__pyx_v_async_outfile);
  __Pyx_GIVEREF(__pyx_v_async_outfile);
  __Pyx_GOTREF(__pyx_v_self->_async_outfile);
  __Pyx_DECREF(__pyx_v_self->_async_outfile);
  __pyx_v_self->_async_outfile = __pyx_v_async_outfile;

  /* "src/lxml/serializer.pxi":1713
 *         self._flush_after_writes = 20
 *         self._async_outfile = async_outfile
 *         self._should_close = close             # <<<<<<<<<<<<<<
 *         self._buffered = buffered
 *         self._buffer = _AsyncDataWriter()
*/
  __pyx_v_self->_should_close = __pyx_v_close;

  /* "src/lxml/serializer.pxi":1714
 *         self._async_outfile = async_outfile
 *         self._should_close = close
 *         self._buffered = buffered             # <<<<<<<<<<<<<<
 *         self._buffer = _AsyncDataWriter()
 *         self._writer = _IncrementalFileWriter(
*/
  __pyx_v_self->_buffered = __pyx_v_buffered;

  /* "src/lxml/serializer.pxi":1715
 *         self._should_close = close
 *         self._buffered = buffered
 *         self._buffer = _AsyncDataWriter()             # <<<<<<<<<<<<<<
 *         self._writer = _IncrementalFileWriter(
 *             self._buffer, encoding, compresslevel, close=True, buffered=False, method=method)
*/
  __pyx_t_2 = NULL;
  __pyx_t_3 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__AsyncDataWriter, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1715, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __Pyx_GIVEREF((PyObject *)__pyx_t_1);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_buffer);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_buffer);
  __pyx_v_self->_buffer = ((struct __pyx_obj_4lxml_5etree__AsyncDataWriter *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/serializer.pxi":1716
 *         self._buffered = buffered
 *         self._buffer = _AsyncDataWriter()
 *         self._writer = _IncrementalFileWriter(             # <<<<<<<<<<<<<<
 *             self._buffer, encoding, compresslevel, close=True, buffered=False, method=method)
 * 
*/
  __pyx_t_2 = NULL;

  /* "src/lxml/serializer.pxi":1717
 *         self._buffer = _AsyncDataWriter()
 *         self._writer = _IncrementalFileWriter(
 *             self._buffer, encoding, compresslevel, close=True, buffered=False, method=method)             # <<<<<<<<<<<<<<
 * 
 *     cdef bytes _flush(self):
*/
  __pyx_t_4 = __Pyx_PyLong_From_int(__pyx_v_compresslevel); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 1717, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyLong_From_int(__pyx_v_method); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 1717, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = 1;
  {
    PyObject *__pyx_callargs[4 + ((CYTHON_VECTORCALL) ? 3 : 0)] = {__pyx_t_2, ((PyObject *)__pyx_v_self->_buffer), __pyx_v_encoding, __pyx_t_4};
    __pyx_t_6 = __Pyx_MakeVectorcallBuilderKwds(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 1716, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_close, Py_True, __pyx_t_6, __pyx_callargs+4, 0) < (0)) __PYX_ERR(6, 1716, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_buffered, Py_False, __pyx_t_6, __pyx_callargs+4, 1) < (0)) __PYX_ERR(6, 1716, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_method, __pyx_t_5, __pyx_t_6, __pyx_callargs+4, 2) < (0)) __PYX_ERR(6, 1716, __pyx_L1_error)
    __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__IncrementalFileWriter, __pyx_callargs+__pyx_t_3, (4-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1716, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }

  /* "src/lxml/serializer.pxi":1716
 *         self._buffered = buffered
 *         self._buffer = _AsyncDataWriter()
 *         self._writer = _IncrementalFileWriter(             # <<<<<<<<<<<<<<
 *             self._buffer, encoding, compresslevel, close=True, buffered=False, method=method)
 * 
*/
  __Pyx_GIVEREF((PyObject *)__pyx_t_1);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_writer);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_writer);
  __pyx_v_self->_writer = ((struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/serializer.pxi":1709
 *     cdef bint _buffered
 * 
 *     def __cinit__(self, async_outfile, bytes encoding, int compresslevel, bint close,             # <<<<<<<<<<<<<<
 *                   bint buffered, int method):
 *         self._flush_after_writes = 20
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._AsyncIncrementalFileWriter.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1719
 *             self._buffer, encoding, compresslevel, close=True, buffered=False, method=method)
 * 
 *     cdef bytes _flush(self):             # <<<<<<<<<<<<<<
 *         if not self._buffered or len(self._buffer._data) > self._flush_after_writes:
 *             return self._buffer.collect()
*/

static PyObject *__pyx_f_4lxml_5etree_27_AsyncIncrementalFileWriter__flush(struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_flush", 0);

  /* "src/lxml/serializer.pxi":1720
 * 
 *     cdef bytes _flush(self):
 *         if not self._buffered or len(self._buffer._data) > self._flush_after_writes:             # <<<<<<<<<<<<<<
 *             return self._buffer.collect()
 *         return None
*/
  __pyx_t_2 = (!__pyx_v_self->_buffered);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = __pyx_v_self->_buffer->_data;
  __Pyx_INCREF(__pyx_t_3);
  if (unlikely(__pyx_t_3 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(6, 1720, __pyx_L1_error)
  }
  __pyx_t_4 = __Pyx_PyList_GET_SIZE(__pyx_t_3); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(6, 1720, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_2 = (__pyx_t_4 > __pyx_v_self->_flush_after_writes);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1721
 *     cdef bytes _flush(self):
 *         if not self._buffered or len(self._buffer._data) > self._flush_after_writes:
 *             return self._buffer.collect()             # <<<<<<<<<<<<<<
 *         return None
 * 
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __pyx_f_4lxml_5etree_16_AsyncDataWriter_collect(__pyx_v_self->_buffer); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1721, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "src/lxml/serializer.pxi":1720
 * 
 *     cdef bytes _flush(self):
 *         if not self._buffered or len(self._buffer._data) > self._flush_after_writes:             # <<<<<<<<<<<<<<
 *             return self._buffer.collect()
 *         return None
*/
  }

  /* "src/lxml/serializer.pxi":1722
 *         if not self._buffered or len(self._buffer._data) > self._flush_after_writes:
 *             return self._buffer.collect()
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     async def flush(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "src/lxml/serializer.pxi":1719
 *             self._buffer, encoding, compresslevel, close=True, buffered=False, method=method)
 * 
 *     cdef bytes _flush(self):             # <<<<<<<<<<<<<<
 *         if not self._buffered or len(self._buffer._data) > self._flush_after_writes:
 *             return self._buffer.collect()
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._AsyncIncrementalFileWriter._flush", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_4lxml_5etree_27_AsyncIncrementalFileWriter_4generator4(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "src/lxml/serializer.pxi":1724
 *         return None
 * 
 *     async def flush(self):             # <<<<<<<<<<<<<<
 *         self._writer.flush()
 *         data = self._buffer.collect()
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_3flush(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_27_AsyncIncrementalFileWriter_3flush = {"flush", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_3flush, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_3flush(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("flush (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("flush", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("flush", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_27_AsyncIncrementalFileWriter_2flush(((struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_27_AsyncIncrementalFileWriter_2flush(struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_4_flush *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("flush", 0);
  __pyx_cur_scope = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_4_flush *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_4_flush(__pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_4_flush, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_4_flush *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(6, 1724, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_CoroutineObject *gen = __Pyx_Coroutine_New((__pyx_coroutine_body_t) __pyx_gb_4lxml_5etree_27_AsyncIncrementalFileWriter_4generator4, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[5]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_flush, __pyx_mstate_global->__pyx_n_u_AsyncIncrementalFileWriter_flus, __pyx_mstate_global->__pyx_n_u_lxml_etree); if (unlikely(!gen)) __PYX_ERR(6, 1724, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._AsyncIncrementalFileWriter.flush", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_4lxml_5etree_27_AsyncIncrementalFileWriter_4generator4(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_4_flush *__pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_4_flush *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_t_4;
  __Pyx_PySendResult __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("flush", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L5_resume_from_await;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(__pyx_sent_value != Py_None)) {
    if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started coroutine");
    __PYX_ERR(6, 1724, __pyx_L1_error)
  }

  /* "src/lxml/serializer.pxi":1725
 * 
 *     async def flush(self):
 *         self._writer.flush()             # <<<<<<<<<<<<<<
 *         data = self._buffer.collect()
 *         if data:
*/
  __pyx_t_2 = ((PyObject *)__pyx_cur_scope->__pyx_v_self->_writer);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_flush, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1725, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/serializer.pxi":1726
 *     async def flush(self):
 *         self._writer.flush()
 *         data = self._buffer.collect()             # <<<<<<<<<<<<<<
 *         if data:
 *             await self._async_outfile.write(data)
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_16_AsyncDataWriter_collect(__pyx_cur_scope->__pyx_v_self->_buffer); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1726, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_cur_scope->__pyx_v_data = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/serializer.pxi":1727
 *         self._writer.flush()
 *         data = self._buffer.collect()
 *         if data:             # <<<<<<<<<<<<<<
 *             await self._async_outfile.write(data)
 * 
*/
  if (__pyx_cur_scope->__pyx_v_data == Py_None) __pyx_t_4 = 0;
  else
  {
    Py_ssize_t __pyx_temp = __Pyx_PyBytes_GET_SIZE(__pyx_cur_scope->__pyx_v_data);
    if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(6, 1727, __pyx_L1_error)
    __pyx_t_4 = (__pyx_temp != 0);
  }

  if (__pyx_t_4) {

    /* "src/lxml/serializer.pxi":1728
 *         data = self._buffer.collect()
 *         if data:
 *             await self._async_outfile.write(data)             # <<<<<<<<<<<<<<
 * 
 *     async def write_declaration(self, version=None, standalone=None, doctype=None):
*/
    __pyx_t_2 = __pyx_cur_scope->__pyx_v_self->_async_outfile;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_cur_scope->__pyx_v_data};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_write, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1728, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_t_5 = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_1, &__pyx_r);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (likely(__pyx_t_5 == PYGEN_NEXT)) {
      __Pyx_GOTREF(__pyx_r);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, awaiting value */
      __pyx_generator->resume_label = 1;
      return __pyx_r;
      __pyx_L5_resume_from_await:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(6, 1728, __pyx_L1_error)
    } else if (likely(__pyx_t_5 == PYGEN_RETURN)) {
      __Pyx_GOTREF(__pyx_r);
      __Pyx_DECREF(__pyx_r); __pyx_r = 0;
    } else {
      __Pyx_XGOTREF(__pyx_r);
      __PYX_ERR(6, 1728, __pyx_L1_error)
    }

    /* "src/lxml/serializer.pxi":1727
 *         self._writer.flush()
 *         data = self._buffer.collect()
 *         if data:             # <<<<<<<<<<<<<<
 *             await self._async_outfile.write(data)
 * 
*/
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "src/lxml/serializer.pxi":1724
 *         return None
 * 
 *     async def flush(self):             # <<<<<<<<<<<<<<
 *         self._writer.flush()
 *         data = self._buffer.collect()
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("flush", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_4lxml_5etree_27_AsyncIncrementalFileWriter_7generator5(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "src/lxml/serializer.pxi":1730
 *             await self._async_outfile.write(data)
 * 
 *     async def write_declaration(self, version=None, standalone=None, doctype=None):             # <<<<<<<<<<<<<<
 *         self._writer.write_declaration(version, standalone, doctype)
 *         data = self._flush()
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_6write_declaration(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_27_AsyncIncrementalFileWriter_6write_declaration = {"write_declaration", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_6write_declaration, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_6write_declaration(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_version = 0;
  PyObject *__pyx_v_standalone = 0;
  PyObject *__pyx_v_doctype = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write_declaration (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_version,&__pyx_mstate_global->__pyx_n_u_standalone,&__pyx_mstate_global->__pyx_n_u_doctype,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(6, 1730, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(6, 1730, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(6, 1730, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 1730, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "write_declaration", 0) < (0)) __PYX_ERR(6, 1730, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
    } else {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(6, 1730, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(6, 1730, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 1730, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_version = values[0];
    __pyx_v_standalone = values[1];
    __pyx_v_doctype = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("write_declaration", 0, 0, 3, __pyx_nargs); __PYX_ERR(6, 1730, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._AsyncIncrementalFileWriter.write_declaration", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_27_AsyncIncrementalFileWriter_5write_declaration(((struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *)__pyx_v_self), __pyx_v_version, __pyx_v_standalone, __pyx_v_doctype);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_27_AsyncIncrementalFileWriter_5write_declaration(struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_version, PyObject *__pyx_v_standalone, PyObject *__pyx_v_doctype) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_5_write_declaration *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("write_declaration", 0);
  __pyx_cur_scope = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_5_write_declaration *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_5_write_declaration(__pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_5_write_declaration, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_5_write_declaration *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(6, 1730, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_version = __pyx_v_version;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_version);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_version);
  __pyx_cur_scope->__pyx_v_standalone = __pyx_v_standalone;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_standalone);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_standalone);
  __pyx_cur_scope->__pyx_v_doctype = __pyx_v_doctype;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_doctype);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_doctype);
  {
    __pyx_CoroutineObject *gen = __Pyx_Coroutine_New((__pyx_coroutine_body_t) __pyx_gb_4lxml_5etree_27_AsyncIncrementalFileWriter_7generator5, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[6]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_write_declaration, __pyx_mstate_global->__pyx_n_u_AsyncIncrementalFileWriter_writ, __pyx_mstate_global->__pyx_n_u_lxml_etree); if (unlikely(!gen)) __PYX_ERR(6, 1730, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._AsyncIncrementalFileWriter.write_declaration", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_4lxml_5etree_27_AsyncIncrementalFileWriter_7generator5(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_5_write_declaration *__pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_5_write_declaration *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_t_4;
  __Pyx_PySendResult __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write_declaration", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L5_resume_from_await;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(__pyx_sent_value != Py_None)) {
    if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started coroutine");
    __PYX_ERR(6, 1730, __pyx_L1_error)
  }

  /* "src/lxml/serializer.pxi":1731
 * 
 *     async def write_declaration(self, version=None, standalone=None, doctype=None):
 *         self._writer.write_declaration(version, standalone, doctype)             # <<<<<<<<<<<<<<
 *         data = self._flush()
 *         if data:
*/
  __pyx_t_2 = ((PyObject *)__pyx_cur_scope->__pyx_v_self->_writer);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[4] = {__pyx_t_2, __pyx_cur_scope->__pyx_v_version, __pyx_cur_scope->__pyx_v_standalone, __pyx_cur_scope->__pyx_v_doctype};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_write_declaration, __pyx_callargs+__pyx_t_3, (4-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1731, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/serializer.pxi":1732
 *     async def write_declaration(self, version=None, standalone=None, doctype=None):
 *         self._writer.write_declaration(version, standalone, doctype)
 *         data = self._flush()             # <<<<<<<<<<<<<<
 *         if data:
 *             await self._async_outfile.write(data)
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_27_AsyncIncrementalFileWriter__flush(__pyx_cur_scope->__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1732, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_cur_scope->__pyx_v_data = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/serializer.pxi":1733
 *         self._writer.write_declaration(version, standalone, doctype)
 *         data = self._flush()
 *         if data:             # <<<<<<<<<<<<<<
 *             await self._async_outfile.write(data)
 * 
*/
  if (__pyx_cur_scope->__pyx_v_data == Py_None) __pyx_t_4 = 0;
  else
  {
    Py_ssize_t __pyx_temp = __Pyx_PyBytes_GET_SIZE(__pyx_cur_scope->__pyx_v_data);
    if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(6, 1733, __pyx_L1_error)
    __pyx_t_4 = (__pyx_temp != 0);
  }

  if (__pyx_t_4) {

    /* "src/lxml/serializer.pxi":1734
 *         data = self._flush()
 *         if data:
 *             await self._async_outfile.write(data)             # <<<<<<<<<<<<<<
 * 
 *     async def write_doctype(self, doctype):
*/
    __pyx_t_2 = __pyx_cur_scope->__pyx_v_self->_async_outfile;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_cur_scope->__pyx_v_data};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_write, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1734, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_t_5 = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_1, &__pyx_r);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (likely(__pyx_t_5 == PYGEN_NEXT)) {
      __Pyx_GOTREF(__pyx_r);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, awaiting value */
      __pyx_generator->resume_label = 1;
      return __pyx_r;
      __pyx_L5_resume_from_await:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(6, 1734, __pyx_L1_error)
    } else if (likely(__pyx_t_5 == PYGEN_RETURN)) {
      __Pyx_GOTREF(__pyx_r);
      __Pyx_DECREF(__pyx_r); __pyx_r = 0;
    } else {
      __Pyx_XGOTREF(__pyx_r);
      __PYX_ERR(6, 1734, __pyx_L1_error)
    }

    /* "src/lxml/serializer.pxi":1733
 *         self._writer.write_declaration(version, standalone, doctype)
 *         data = self._flush()
 *         if data:             # <<<<<<<<<<<<<<
 *             await self._async_outfile.write(data)
 * 
*/
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "src/lxml/serializer.pxi":1730
 *             await self._async_outfile.write(data)
 * 
 *     async def write_declaration(self, version=None, standalone=None, doctype=None):             # <<<<<<<<<<<<<<
 *         self._writer.write_declaration(version, standalone, doctype)
 *         data = self._flush()
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("write_declaration", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_4lxml_5etree_27_AsyncIncrementalFileWriter_10generator6(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "src/lxml/serializer.pxi":1736
 *             await self._async_outfile.write(data)
 * 
 *     async def write_doctype(self, doctype):             # <<<<<<<<<<<<<<
 *         self._writer.write_doctype(doctype)
 *         data = self._flush()
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_9write_doctype(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_27_AsyncIncrementalFileWriter_9write_doctype = {"write_doctype", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_9write_doctype, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_9write_doctype(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_doctype = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write_doctype (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_doctype,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(6, 1736, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 1736, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "write_doctype", 0) < (0)) __PYX_ERR(6, 1736, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("write_doctype", 1, 1, 1, i); __PYX_ERR(6, 1736, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 1736, __pyx_L3_error)
    }
    __pyx_v_doctype = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("write_doctype", 1, 1, 1, __pyx_nargs); __PYX_ERR(6, 1736, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._AsyncIncrementalFileWriter.write_doctype", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_27_AsyncIncrementalFileWriter_8write_doctype(((struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *)__pyx_v_self), __pyx_v_doctype);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_27_AsyncIncrementalFileWriter_8write_doctype(struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_doctype) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_6_write_doctype *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("write_doctype", 0);
  __pyx_cur_scope = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_6_write_doctype *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_6_write_doctype(__pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_6_write_doctype, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_6_write_doctype *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(6, 1736, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_doctype = __pyx_v_doctype;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_doctype);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_doctype);
  {
    __pyx_CoroutineObject *gen = __Pyx_Coroutine_New((__pyx_coroutine_body_t) __pyx_gb_4lxml_5etree_27_AsyncIncrementalFileWriter_10generator6, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[7]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_write_doctype, __pyx_mstate_global->__pyx_n_u_AsyncIncrementalFileWriter_writ_2, __pyx_mstate_global->__pyx_n_u_lxml_etree); if (unlikely(!gen)) __PYX_ERR(6, 1736, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._AsyncIncrementalFileWriter.write_doctype", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_4lxml_5etree_27_AsyncIncrementalFileWriter_10generator6(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_6_write_doctype *__pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_6_write_doctype *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_t_4;
  __Pyx_PySendResult __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write_doctype", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L5_resume_from_await;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(__pyx_sent_value != Py_None)) {
    if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started coroutine");
    __PYX_ERR(6, 1736, __pyx_L1_error)
  }

  /* "src/lxml/serializer.pxi":1737
 * 
 *     async def write_doctype(self, doctype):
 *         self._writer.write_doctype(doctype)             # <<<<<<<<<<<<<<
 *         data = self._flush()
 *         if data:
*/
  __pyx_t_2 = ((PyObject *)__pyx_cur_scope->__pyx_v_self->_writer);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_cur_scope->__pyx_v_doctype};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_write_doctype, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1737, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/serializer.pxi":1738
 *     async def write_doctype(self, doctype):
 *         self._writer.write_doctype(doctype)
 *         data = self._flush()             # <<<<<<<<<<<<<<
 *         if data:
 *             await self._async_outfile.write(data)
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_27_AsyncIncrementalFileWriter__flush(__pyx_cur_scope->__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1738, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_cur_scope->__pyx_v_data = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/serializer.pxi":1739
 *         self._writer.write_doctype(doctype)
 *         data = self._flush()
 *         if data:             # <<<<<<<<<<<<<<
 *             await self._async_outfile.write(data)
 * 
*/
  if (__pyx_cur_scope->__pyx_v_data == Py_None) __pyx_t_4 = 0;
  else
  {
    Py_ssize_t __pyx_temp = __Pyx_PyBytes_GET_SIZE(__pyx_cur_scope->__pyx_v_data);
    if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(6, 1739, __pyx_L1_error)
    __pyx_t_4 = (__pyx_temp != 0);
  }

  if (__pyx_t_4) {

    /* "src/lxml/serializer.pxi":1740
 *         data = self._flush()
 *         if data:
 *             await self._async_outfile.write(data)             # <<<<<<<<<<<<<<
 * 
 *     async def write(self, *args, with_tail=True, pretty_print=False, method=None):
*/
    __pyx_t_2 = __pyx_cur_scope->__pyx_v_self->_async_outfile;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_cur_scope->__pyx_v_data};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_write, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1740, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_t_5 = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_1, &__pyx_r);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (likely(__pyx_t_5 == PYGEN_NEXT)) {
      __Pyx_GOTREF(__pyx_r);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, awaiting value */
      __pyx_generator->resume_label = 1;
      return __pyx_r;
      __pyx_L5_resume_from_await:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(6, 1740, __pyx_L1_error)
    } else if (likely(__pyx_t_5 == PYGEN_RETURN)) {
      __Pyx_GOTREF(__pyx_r);
      __Pyx_DECREF(__pyx_r); __pyx_r = 0;
    } else {
      __Pyx_XGOTREF(__pyx_r);
      __PYX_ERR(6, 1740, __pyx_L1_error)
    }

    /* "src/lxml/serializer.pxi":1739
 *         self._writer.write_doctype(doctype)
 *         data = self._flush()
 *         if data:             # <<<<<<<<<<<<<<
 *             await self._async_outfile.write(data)
 * 
*/
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "src/lxml/serializer.pxi":1736
 *             await self._async_outfile.write(data)
 * 
 *     async def write_doctype(self, doctype):             # <<<<<<<<<<<<<<
 *         self._writer.write_doctype(doctype)
 *         data = self._flush()
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("write_doctype", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_4lxml_5etree_27_AsyncIncrementalFileWriter_13generator7(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "src/lxml/serializer.pxi":1742
 *             await self._async_outfile.write(data)
 * 
 *     async def write(self, *args, with_tail=True, pretty_print=False, method=None):             # <<<<<<<<<<<<<<
 *         self._writer.write(*args, with_tail=with_tail, pretty_print=pretty_print, method=method)
 *         data = self._flush()
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_12write(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_27_AsyncIncrementalFileWriter_12write = {"write", (PyCFunction)(void(*)(void))(PyCFunctionWithKeywords)__pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_12write, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_12write(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_with_tail = 0;
  PyObject *__pyx_v_pretty_print = 0;
  PyObject *__pyx_v_method = 0;
  PyObject *__pyx_v_args = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __Pyx_INCREF(__pyx_args);
  __pyx_v_args = __pyx_args;
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_with_tail,&__pyx_mstate_global->__pyx_n_u_pretty_print,&__pyx_mstate_global->__pyx_n_u_method,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(6, 1742, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        default:
        case  0: break;
      }
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, 0, __pyx_kwds_len, "write", 0) < (0)) __PYX_ERR(6, 1742, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_True));
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
    } else if (unlikely(__pyx_nargs < 0)) {
      goto __pyx_L5_argtuple_error;
    } else {
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_True));
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_with_tail = values[0];
    __pyx_v_pretty_print = values[1];
    __pyx_v_method = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("write", 0, 0, 0, __pyx_nargs); __PYX_ERR(6, 1742, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_CLEAR(__pyx_v_args);
  __Pyx_AddTraceback("lxml.etree._AsyncIncrementalFileWriter.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_27_AsyncIncrementalFileWriter_11write(((struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *)__pyx_v_self), __pyx_v_with_tail, __pyx_v_pretty_print, __pyx_v_method, __pyx_v_args);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v_args);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_27_AsyncIncrementalFileWriter_11write(struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_with_tail, PyObject *__pyx_v_pretty_print, PyObject *__pyx_v_method, PyObject *__pyx_v_args) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_7_write *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("write", 0);
  __pyx_cur_scope = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_7_write *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_7_write(__pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_7_write, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_7_write *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(6, 1742, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_with_tail = __pyx_v_with_tail;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_with_tail);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_with_tail);
  __pyx_cur_scope->__pyx_v_pretty_print = __pyx_v_pretty_print;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_pretty_print);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_pretty_print);
  __pyx_cur_scope->__pyx_v_method = __pyx_v_method;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_method);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_method);
  __pyx_cur_scope->__pyx_v_args = __pyx_v_args;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_args);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_args);
  {
    __pyx_CoroutineObject *gen = __Pyx_Coroutine_New((__pyx_coroutine_body_t) __pyx_gb_4lxml_5etree_27_AsyncIncrementalFileWriter_13generator7, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[8]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_write, __pyx_mstate_global->__pyx_n_u_AsyncIncrementalFileWriter_writ_3, __pyx_mstate_global->__pyx_n_u_lxml_etree); if (unlikely(!gen)) __PYX_ERR(6, 1742, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._AsyncIncrementalFileWriter.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_4lxml_5etree_27_AsyncIncrementalFileWriter_13generator7(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_7_write *__pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_7_write *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  size_t __pyx_t_5;
  __Pyx_PySendResult __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L5_resume_from_await;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(__pyx_sent_value != Py_None)) {
    if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started coroutine");
    __PYX_ERR(6, 1742, __pyx_L1_error)
  }

  /* "src/lxml/serializer.pxi":1743
 * 
 *     async def write(self, *args, with_tail=True, pretty_print=False, method=None):
 *         self._writer.write(*args, with_tail=with_tail, pretty_print=pretty_print, method=method)             # <<<<<<<<<<<<<<
 *         data = self._flush()
 *         if data:
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self->_writer), __pyx_mstate_global->__pyx_n_u_write); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1743, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1743, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_with_tail, __pyx_cur_scope->__pyx_v_with_tail) < (0)) __PYX_ERR(6, 1743, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_pretty_print, __pyx_cur_scope->__pyx_v_pretty_print) < (0)) __PYX_ERR(6, 1743, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_method, __pyx_cur_scope->__pyx_v_method) < (0)) __PYX_ERR(6, 1743, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_cur_scope->__pyx_v_args, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1743, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/serializer.pxi":1744
 *     async def write(self, *args, with_tail=True, pretty_print=False, method=None):
 *         self._writer.write(*args, with_tail=with_tail, pretty_print=pretty_print, method=method)
 *         data = self._flush()             # <<<<<<<<<<<<<<
 *         if data:
 *             await self._async_outfile.write(data)
*/
  __pyx_t_3 = __pyx_f_4lxml_5etree_27_AsyncIncrementalFileWriter__flush(__pyx_cur_scope->__pyx_v_self); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1744, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_cur_scope->__pyx_v_data = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/serializer.pxi":1745
 *         self._writer.write(*args, with_tail=with_tail, pretty_print=pretty_print, method=method)
 *         data = self._flush()
 *         if data:             # <<<<<<<<<<<<<<
 *             await self._async_outfile.write(data)
 * 
*/
  if (__pyx_cur_scope->__pyx_v_data == Py_None) __pyx_t_4 = 0;
  else
  {
    Py_ssize_t __pyx_temp = __Pyx_PyBytes_GET_SIZE(__pyx_cur_scope->__pyx_v_data);
    if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(6, 1745, __pyx_L1_error)
    __pyx_t_4 = (__pyx_temp != 0);
  }

  if (__pyx_t_4) {

    /* "src/lxml/serializer.pxi":1746
 *         data = self._flush()
 *         if data:
 *             await self._async_outfile.write(data)             # <<<<<<<<<<<<<<
 * 
 *     def method(self, method):
*/
    __pyx_t_2 = __pyx_cur_scope->__pyx_v_self->_async_outfile;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_5 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_cur_scope->__pyx_v_data};
      __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_write, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1746, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __pyx_t_6 = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_3, &__pyx_r);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (likely(__pyx_t_6 == PYGEN_NEXT)) {
      __Pyx_GOTREF(__pyx_r);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, awaiting value */
      __pyx_generator->resume_label = 1;
      return __pyx_r;
      __pyx_L5_resume_from_await:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(6, 1746, __pyx_L1_error)
    } else if (likely(__pyx_t_6 == PYGEN_RETURN)) {
      __Pyx_GOTREF(__pyx_r);
      __Pyx_DECREF(__pyx_r); __pyx_r = 0;
    } else {
      __Pyx_XGOTREF(__pyx_r);
      __PYX_ERR(6, 1746, __pyx_L1_error)
    }

    /* "src/lxml/serializer.pxi":1745
 *         self._writer.write(*args, with_tail=with_tail, pretty_print=pretty_print, method=method)
 *         data = self._flush()
 *         if data:             # <<<<<<<<<<<<<<
 *             await self._async_outfile.write(data)
 * 
*/
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "src/lxml/serializer.pxi":1742
 *             await self._async_outfile.write(data)
 * 
 *     async def write(self, *args, with_tail=True, pretty_print=False, method=None):             # <<<<<<<<<<<<<<
 *         self._writer.write(*args, with_tail=with_tail, pretty_print=pretty_print, method=method)
 *         data = self._flush()
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1748
 *             await self._async_outfile.write(data)
 * 
 *     def method(self, method):             # <<<<<<<<<<<<<<
 *         return self._writer.method(method)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_15method(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_27_AsyncIncrementalFileWriter_15method = {"method", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_15method, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_15method(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_method = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("method (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_method,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(6, 1748, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 1748, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "method", 0) < (0)) __PYX_ERR(6, 1748, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("method", 1, 1, 1, i); __PYX_ERR(6, 1748, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 1748, __pyx_L3_error)
    }
    __pyx_v_method = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("method", 1, 1, 1, __pyx_nargs); __PYX_ERR(6, 1748, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._AsyncIncrementalFileWriter.method", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_27_AsyncIncrementalFileWriter_14method(((struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *)__pyx_v_self), __pyx_v_method);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_27_AsyncIncrementalFileWriter_14method(struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_method) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("method", 0);

  /* "src/lxml/serializer.pxi":1749
 * 
 *     def method(self, method):
 *         return self._writer.method(method)             # <<<<<<<<<<<<<<
 * 
 *     def element(self, tag, attrib=None, nsmap=None, method=None, **_extra):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_v_self->_writer);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_method};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_method, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1749, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/serializer.pxi":1748
 *             await self._async_outfile.write(data)
 * 
 *     def method(self, method):             # <<<<<<<<<<<<<<
 *         return self._writer.method(method)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._AsyncIncrementalFileWriter.method", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1751
 *         return self._writer.method(method)
 * 
 *     def element(self, tag, attrib=None, nsmap=None, method=None, **_extra):             # <<<<<<<<<<<<<<
 *         element_writer = self._writer.element(tag, attrib, nsmap, method, **_extra)
 *         return _AsyncFileWriterElement(element_writer, self)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_17element(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_27_AsyncIncrementalFileWriter_17element = {"element", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_17element, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_17element(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_v_attrib = 0;
  PyObject *__pyx_v_nsmap = 0;
  PyObject *__pyx_v_method = 0;
  PyObject *__pyx_v__extra = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[4] = {0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("element (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  __pyx_v__extra = PyDict_New(); if (unlikely(!__pyx_v__extra)) return NULL;
  __Pyx_GOTREF(__pyx_v__extra);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_tag,&__pyx_mstate_global->__pyx_n_u_attrib,&__pyx_mstate_global->__pyx_n_u_nsmap,&__pyx_mstate_global->__pyx_n_u_method,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(6, 1751, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(6, 1751, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(6, 1751, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(6, 1751, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 1751, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v__extra, values, kwd_pos_args, __pyx_kwds_len, "element", 1) < (0)) __PYX_ERR(6, 1751, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("element", 0, 1, 4, i); __PYX_ERR(6, 1751, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(6, 1751, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(6, 1751, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(6, 1751, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 1751, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_tag = values[0];
    __pyx_v_attrib = values[1];
    __pyx_v_nsmap = values[2];
    __pyx_v_method = values[3];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("element", 0, 1, 4, __pyx_nargs); __PYX_ERR(6, 1751, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v__extra); __pyx_v__extra = 0;
  __Pyx_AddTraceback("lxml.etree._AsyncIncrementalFileWriter.element", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_27_AsyncIncrementalFileWriter_16element(((struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *)__pyx_v_self), __pyx_v_tag, __pyx_v_attrib, __pyx_v_nsmap, __pyx_v_method, __pyx_v__extra);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v__extra);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_27_AsyncIncrementalFileWriter_16element(struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_attrib, PyObject *__pyx_v_nsmap, PyObject *__pyx_v_method, PyObject *__pyx_v__extra) {
  PyObject *__pyx_v_element_writer = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("element", 0);

  /* "src/lxml/serializer.pxi":1752
 * 
 *     def element(self, tag, attrib=None, nsmap=None, method=None, **_extra):
 *         element_writer = self._writer.element(tag, attrib, nsmap, method, **_extra)             # <<<<<<<<<<<<<<
 *         return _AsyncFileWriterElement(element_writer, self)
 * 
*/
  __pyx_t_2 = NULL;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_writer), __pyx_mstate_global->__pyx_n_u_element); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1752, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyDict_Copy(__pyx_v__extra); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 1752, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = 1;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_5 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[5] = {__pyx_t_2, __pyx_v_tag, __pyx_v_attrib, __pyx_v_nsmap, __pyx_v_method};
    __pyx_t_1 = __Pyx_PyObject_FastCallDict((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_5, (5-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1752, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v_element_writer = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "src/lxml/serializer.pxi":1753
 *     def element(self, tag, attrib=None, nsmap=None, method=None, **_extra):
 *         element_writer = self._writer.element(tag, attrib, nsmap, method, **_extra)
 *         return _AsyncFileWriterElement(element_writer, self)             # <<<<<<<<<<<<<<
 * 
 *     async def _close(self, bint raise_on_error):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = NULL;
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_v_element_writer, ((PyObject *)__pyx_v_self)};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__AsyncFileWriterElement, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1753, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __pyx_r = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/serializer.pxi":1751
 *         return self._writer.method(method)
 * 
 *     def element(self, tag, attrib=None, nsmap=None, method=None, **_extra):             # <<<<<<<<<<<<<<
 *         element_writer = self._writer.element(tag, attrib, nsmap, method, **_extra)
 *         return _AsyncFileWriterElement(element_writer, self)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._AsyncIncrementalFileWriter.element", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_element_writer);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_4lxml_5etree_27_AsyncIncrementalFileWriter_20generator8(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "src/lxml/serializer.pxi":1755
 *         return _AsyncFileWriterElement(element_writer, self)
 * 
 *     async def _close(self, bint raise_on_error):             # <<<<<<<<<<<<<<
 *         self._writer._close(raise_on_error)
 *         data = self._buffer.collect()
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_19_close(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_27_AsyncIncrementalFileWriter_19_close = {"_close", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_19_close, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_19_close(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  int __pyx_v_raise_on_error;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_close (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_raise_on_error,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(6, 1755, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 1755, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_close", 0) < (0)) __PYX_ERR(6, 1755, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_close", 1, 1, 1, i); __PYX_ERR(6, 1755, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 1755, __pyx_L3_error)
    }
    __pyx_v_raise_on_error = __Pyx_PyObject_IsTrue(values[0]); if (unlikely((__pyx_v_raise_on_error == (int)-1) && PyErr_Occurred())) __PYX_ERR(6, 1755, __pyx_L3_error)
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_close", 1, 1, 1, __pyx_nargs); __PYX_ERR(6, 1755, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._AsyncIncrementalFileWriter._close", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_27_AsyncIncrementalFileWriter_18_close(((struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *)__pyx_v_self), __pyx_v_raise_on_error);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_27_AsyncIncrementalFileWriter_18_close(struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *__pyx_v_self, int __pyx_v_raise_on_error) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_8__close *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_close", 0);
  __pyx_cur_scope = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_8__close *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_8__close(__pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_8__close, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_8__close *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(6, 1755, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_raise_on_error = __pyx_v_raise_on_error;
  {
    __pyx_CoroutineObject *gen = __Pyx_Coroutine_New((__pyx_coroutine_body_t) __pyx_gb_4lxml_5etree_27_AsyncIncrementalFileWriter_20generator8, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[9]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_close_2, __pyx_mstate_global->__pyx_n_u_AsyncIncrementalFileWriter__clo, __pyx_mstate_global->__pyx_n_u_lxml_etree); if (unlikely(!gen)) __PYX_ERR(6, 1755, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._AsyncIncrementalFileWriter._close", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_4lxml_5etree_27_AsyncIncrementalFileWriter_20generator8(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_8__close *__pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_8__close *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  __Pyx_PySendResult __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_close", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L5_resume_from_await;
    case 2: goto __pyx_L7_resume_from_await;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(__pyx_sent_value != Py_None)) {
    if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started coroutine");
    __PYX_ERR(6, 1755, __pyx_L1_error)
  }

  /* "src/lxml/serializer.pxi":1756
 * 
 *     async def _close(self, bint raise_on_error):
 *         self._writer._close(raise_on_error)             # <<<<<<<<<<<<<<
 *         data = self._buffer.collect()
 *         if data:
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_22_IncrementalFileWriter__close(__pyx_cur_scope->__pyx_v_self->_writer, __pyx_cur_scope->__pyx_v_raise_on_error); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1756, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/serializer.pxi":1757
 *     async def _close(self, bint raise_on_error):
 *         self._writer._close(raise_on_error)
 *         data = self._buffer.collect()             # <<<<<<<<<<<<<<
 *         if data:
 *             await self._async_outfile.write(data)
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_16_AsyncDataWriter_collect(__pyx_cur_scope->__pyx_v_self->_buffer); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1757, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_cur_scope->__pyx_v_data = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/serializer.pxi":1758
 *         self._writer._close(raise_on_error)
 *         data = self._buffer.collect()
 *         if data:             # <<<<<<<<<<<<<<
 *             await self._async_outfile.write(data)
 *         if self._should_close:
*/
  if (__pyx_cur_scope->__pyx_v_data == Py_None) __pyx_t_2 = 0;
  else
  {
    Py_ssize_t __pyx_temp = __Pyx_PyBytes_GET_SIZE(__pyx_cur_scope->__pyx_v_data);
    if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(6, 1758, __pyx_L1_error)
    __pyx_t_2 = (__pyx_temp != 0);
  }

  if (__pyx_t_2) {

    /* "src/lxml/serializer.pxi":1759
 *         data = self._buffer.collect()
 *         if data:
 *             await self._async_outfile.write(data)             # <<<<<<<<<<<<<<
 *         if self._should_close:
 *             await self._async_outfile.close()
*/
    __pyx_t_3 = __pyx_cur_scope->__pyx_v_self->_async_outfile;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_cur_scope->__pyx_v_data};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_write, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1759, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_t_5 = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_1, &__pyx_r);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (likely(__pyx_t_5 == PYGEN_NEXT)) {
      __Pyx_GOTREF(__pyx_r);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, awaiting value */
      __pyx_generator->resume_label = 1;
      return __pyx_r;
      __pyx_L5_resume_from_await:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(6, 1759, __pyx_L1_error)
    } else if (likely(__pyx_t_5 == PYGEN_RETURN)) {
      __Pyx_GOTREF(__pyx_r);
      __Pyx_DECREF(__pyx_r); __pyx_r = 0;
    } else {
      __Pyx_XGOTREF(__pyx_r);
      __PYX_ERR(6, 1759, __pyx_L1_error)
    }

    /* "src/lxml/serializer.pxi":1758
 *         self._writer._close(raise_on_error)
 *         data = self._buffer.collect()
 *         if data:             # <<<<<<<<<<<<<<
 *             await self._async_outfile.write(data)
 *         if self._should_close:
*/
  }

  /* "src/lxml/serializer.pxi":1760
 *         if data:
 *             await self._async_outfile.write(data)
 *         if self._should_close:             # <<<<<<<<<<<<<<
 *             await self._async_outfile.close()
 * 
*/
  if (__pyx_cur_scope->__pyx_v_self->_should_close) {

    /* "src/lxml/serializer.pxi":1761
 *             await self._async_outfile.write(data)
 *         if self._should_close:
 *             await self._async_outfile.close()             # <<<<<<<<<<<<<<
 * 
 * 
*/
    __pyx_t_3 = __pyx_cur_scope->__pyx_v_self->_async_outfile;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_close, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1761, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_t_5 = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_1, &__pyx_r);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (likely(__pyx_t_5 == PYGEN_NEXT)) {
      __Pyx_GOTREF(__pyx_r);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, awaiting value */
      __pyx_generator->resume_label = 2;
      return __pyx_r;
      __pyx_L7_resume_from_await:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(6, 1761, __pyx_L1_error)
    } else if (likely(__pyx_t_5 == PYGEN_RETURN)) {
      __Pyx_GOTREF(__pyx_r);
      __Pyx_DECREF(__pyx_r); __pyx_r = 0;
    } else {
      __Pyx_XGOTREF(__pyx_r);
      __PYX_ERR(6, 1761, __pyx_L1_error)
    }

    /* "src/lxml/serializer.pxi":1760
 *         if data:
 *             await self._async_outfile.write(data)
 *         if self._should_close:             # <<<<<<<<<<<<<<
 *             await self._async_outfile.close()
 * 
*/
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "src/lxml/serializer.pxi":1755
 *         return _AsyncFileWriterElement(element_writer, self)
 * 
 *     async def _close(self, bint raise_on_error):             # <<<<<<<<<<<<<<
 *         self._writer._close(raise_on_error)
 *         data = self._buffer.collect()
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("_close", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1770
 *     cdef _AsyncIncrementalFileWriter _writer
 * 
 *     def __cinit__(self, _FileWriterElement element_writer not None,             # <<<<<<<<<<<<<<
 *                   _AsyncIncrementalFileWriter writer not None):
 *         self._element_writer = element_writer
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_23_AsyncFileWriterElement_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_23_AsyncFileWriterElement_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_4lxml_5etree__FileWriterElement *__pyx_v_element_writer = 0;
  struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *__pyx_v_writer = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_element_writer,&__pyx_mstate_global->__pyx_n_u_writer,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(6, 1770, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(6, 1770, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 1770, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__cinit__", 0) < (0)) __PYX_ERR(6, 1770, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, i); __PYX_ERR(6, 1770, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 1770, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(6, 1770, __pyx_L3_error)
    }
    __pyx_v_element_writer = ((struct __pyx_obj_4lxml_5etree__FileWriterElement *)values[0]);
    __pyx_v_writer = ((struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *)values[1]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, __pyx_nargs); __PYX_ERR(6, 1770, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._AsyncFileWriterElement.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_element_writer), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__FileWriterElement, 0, "element_writer", 0))) __PYX_ERR(6, 1770, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_writer), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__AsyncIncrementalFileWriter, 0, "writer", 0))) __PYX_ERR(6, 1771, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_23_AsyncFileWriterElement___cinit__(((struct __pyx_obj_4lxml_5etree__AsyncFileWriterElement *)__pyx_v_self), __pyx_v_element_writer, __pyx_v_writer);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_23_AsyncFileWriterElement___cinit__(struct __pyx_obj_4lxml_5etree__AsyncFileWriterElement *__pyx_v_self, struct __pyx_obj_4lxml_5etree__FileWriterElement *__pyx_v_element_writer, struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *__pyx_v_writer) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "src/lxml/serializer.pxi":1772
 *     def __cinit__(self, _FileWriterElement element_writer not None,
 *                   _AsyncIncrementalFileWriter writer not None):
 *         self._element_writer = element_writer             # <<<<<<<<<<<<<<
 *         self._writer = writer
 * 
*/
  __Pyx_INCREF((PyObject *)__pyx_v_element_writer);
  __Pyx_GIVEREF((PyObject *)__pyx_v_element_writer);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_element_writer);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_element_writer);
  __pyx_v_self->_element_writer = __pyx_v_element_writer;

  /* "src/lxml/serializer.pxi":1773
 *                   _AsyncIncrementalFileWriter writer not None):
 *         self._element_writer = element_writer
 *         self._writer = writer             # <<<<<<<<<<<<<<
 * 
 *     async def __aenter__(self):
*/
  __Pyx_INCREF((PyObject *)__pyx_v_writer);
  __Pyx_GIVEREF((PyObject *)__pyx_v_writer);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_writer);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_writer);
  __pyx_v_self->_writer = __pyx_v_writer;

  /* "src/lxml/serializer.pxi":1770
 *     cdef _AsyncIncrementalFileWriter _writer
 * 
 *     def __cinit__(self, _FileWriterElement element_writer not None,             # <<<<<<<<<<<<<<
 *                   _AsyncIncrementalFileWriter writer not None):
 *         self._element_writer = element_writer
*/

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_4lxml_5etree_23_AsyncFileWriterElement_4generator9(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "src/lxml/serializer.pxi":1775
 *         self._writer = writer
 * 
 *     async def __aenter__(self):             # <<<<<<<<<<<<<<
 *         self._element_writer.__enter__()
 *         data = self._writer._flush()
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_23_AsyncFileWriterElement_3__aenter__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_23_AsyncFileWriterElement_3__aenter__ = {"__aenter__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_23_AsyncFileWriterElement_3__aenter__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_23_AsyncFileWriterElement_3__aenter__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__aenter__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__aenter__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__aenter__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_23_AsyncFileWriterElement_2__aenter__(((struct __pyx_obj_4lxml_5etree__AsyncFileWriterElement *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_23_AsyncFileWriterElement_2__aenter__(struct __pyx_obj_4lxml_5etree__AsyncFileWriterElement *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_9___aenter__ *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__aenter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_9___aenter__ *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_9___aenter__(__pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_9___aenter__, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_9___aenter__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(6, 1775, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_CoroutineObject *gen = __Pyx_Coroutine_New((__pyx_coroutine_body_t) __pyx_gb_4lxml_5etree_23_AsyncFileWriterElement_4generator9, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[10]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_aenter, __pyx_mstate_global->__pyx_n_u_AsyncFileWriterElement___aenter, __pyx_mstate_global->__pyx_n_u_lxml_etree); if (unlikely(!gen)) __PYX_ERR(6, 1775, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._AsyncFileWriterElement.__aenter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_4lxml_5etree_23_AsyncFileWriterElement_4generator9(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_9___aenter__ *__pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_9___aenter__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_t_4;
  __Pyx_PySendResult __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__aenter__", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L5_resume_from_await;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(__pyx_sent_value != Py_None)) {
    if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started coroutine");
    __PYX_ERR(6, 1775, __pyx_L1_error)
  }

  /* "src/lxml/serializer.pxi":1776
 * 
 *     async def __aenter__(self):
 *         self._element_writer.__enter__()             # <<<<<<<<<<<<<<
 *         data = self._writer._flush()
 *         if data:
*/
  __pyx_t_2 = ((PyObject *)__pyx_cur_scope->__pyx_v_self->_element_writer);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_enter, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1776, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/serializer.pxi":1777
 *     async def __aenter__(self):
 *         self._element_writer.__enter__()
 *         data = self._writer._flush()             # <<<<<<<<<<<<<<
 *         if data:
 *             await self._writer._async_outfile.write(data)
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_27_AsyncIncrementalFileWriter__flush(__pyx_cur_scope->__pyx_v_self->_writer); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1777, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_cur_scope->__pyx_v_data = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/serializer.pxi":1778
 *         self._element_writer.__enter__()
 *         data = self._writer._flush()
 *         if data:             # <<<<<<<<<<<<<<
 *             await self._writer._async_outfile.write(data)
 * 
*/
  if (__pyx_cur_scope->__pyx_v_data == Py_None) __pyx_t_4 = 0;
  else
  {
    Py_ssize_t __pyx_temp = __Pyx_PyBytes_GET_SIZE(__pyx_cur_scope->__pyx_v_data);
    if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(6, 1778, __pyx_L1_error)
    __pyx_t_4 = (__pyx_temp != 0);
  }

  if (__pyx_t_4) {

    /* "src/lxml/serializer.pxi":1779
 *         data = self._writer._flush()
 *         if data:
 *             await self._writer._async_outfile.write(data)             # <<<<<<<<<<<<<<
 * 
 *     async def __aexit__(self, *args):
*/
    __pyx_t_2 = __pyx_cur_scope->__pyx_v_self->_writer->_async_outfile;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_cur_scope->__pyx_v_data};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_write, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1779, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_t_5 = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_1, &__pyx_r);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (likely(__pyx_t_5 == PYGEN_NEXT)) {
      __Pyx_GOTREF(__pyx_r);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, awaiting value */
      __pyx_generator->resume_label = 1;
      return __pyx_r;
      __pyx_L5_resume_from_await:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(6, 1779, __pyx_L1_error)
    } else if (likely(__pyx_t_5 == PYGEN_RETURN)) {
      __Pyx_GOTREF(__pyx_r);
      __Pyx_DECREF(__pyx_r); __pyx_r = 0;
    } else {
      __Pyx_XGOTREF(__pyx_r);
      __PYX_ERR(6, 1779, __pyx_L1_error)
    }

    /* "src/lxml/serializer.pxi":1778
 *         self._element_writer.__enter__()
 *         data = self._writer._flush()
 *         if data:             # <<<<<<<<<<<<<<
 *             await self._writer._async_outfile.write(data)
 * 
*/
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "src/lxml/serializer.pxi":1775
 *         self._writer = writer
 * 
 *     async def __aenter__(self):             # <<<<<<<<<<<<<<
 *         self._element_writer.__enter__()
 *         data = self._writer._flush()
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("__aenter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_4lxml_5etree_23_AsyncFileWriterElement_7generator10(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "src/lxml/serializer.pxi":1781
 *             await self._writer._async_outfile.write(data)
 * 
 *     async def __aexit__(self, *args):             # <<<<<<<<<<<<<<
 *         self._element_writer.__exit__(*args)
 *         data = self._writer._flush()
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_23_AsyncFileWriterElement_6__aexit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_23_AsyncFileWriterElement_6__aexit__ = {"__aexit__", (PyCFunction)(void(*)(void))(PyCFunctionWithKeywords)__pyx_pw_4lxml_5etree_23_AsyncFileWriterElement_6__aexit__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_23_AsyncFileWriterElement_6__aexit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_args = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__aexit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__aexit__", __pyx_kwds); return NULL;}
  __Pyx_INCREF(__pyx_args);
  __pyx_v_args = __pyx_args;
  __pyx_r = __pyx_pf_4lxml_5etree_23_AsyncFileWriterElement_5__aexit__(((struct __pyx_obj_4lxml_5etree__AsyncFileWriterElement *)__pyx_v_self), __pyx_v_args);

  /* function exit code */
  __Pyx_DECREF(__pyx_v_args);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_23_AsyncFileWriterElement_5__aexit__(struct __pyx_obj_4lxml_5etree__AsyncFileWriterElement *__pyx_v_self, PyObject *__pyx_v_args) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_10___aexit__ *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__aexit__", 0);
  __pyx_cur_scope = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_10___aexit__ *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_10___aexit__(__pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_10___aexit__, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_10___aexit__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(6, 1781, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_args = __pyx_v_args;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_args);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_args);
  {
    __pyx_CoroutineObject *gen = __Pyx_Coroutine_New((__pyx_coroutine_body_t) __pyx_gb_4lxml_5etree_23_AsyncFileWriterElement_7generator10, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[11]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_aexit, __pyx_mstate_global->__pyx_n_u_AsyncFileWriterElement___aexit, __pyx_mstate_global->__pyx_n_u_lxml_etree); if (unlikely(!gen)) __PYX_ERR(6, 1781, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._AsyncFileWriterElement.__aexit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_4lxml_5etree_23_AsyncFileWriterElement_7generator10(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_10___aexit__ *__pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_10___aexit__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  size_t __pyx_t_4;
  __Pyx_PySendResult __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__aexit__", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L5_resume_from_await;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(__pyx_sent_value != Py_None)) {
    if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started coroutine");
    __PYX_ERR(6, 1781, __pyx_L1_error)
  }

  /* "src/lxml/serializer.pxi":1782
 * 
 *     async def __aexit__(self, *args):
 *         self._element_writer.__exit__(*args)             # <<<<<<<<<<<<<<
 *         data = self._writer._flush()
 *         if data:
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self->_element_writer), __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1782, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_cur_scope->__pyx_v_args, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1782, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/serializer.pxi":1783
 *     async def __aexit__(self, *args):
 *         self._element_writer.__exit__(*args)
 *         data = self._writer._flush()             # <<<<<<<<<<<<<<
 *         if data:
 *             await self._writer._async_outfile.write(data)
*/
  __pyx_t_2 = __pyx_f_4lxml_5etree_27_AsyncIncrementalFileWriter__flush(__pyx_cur_scope->__pyx_v_self->_writer); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1783, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_cur_scope->__pyx_v_data = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/serializer.pxi":1784
 *         self._element_writer.__exit__(*args)
 *         data = self._writer._flush()
 *         if data:             # <<<<<<<<<<<<<<
 *             await self._writer._async_outfile.write(data)
 * 
*/
  if (__pyx_cur_scope->__pyx_v_data == Py_None) __pyx_t_3 = 0;
  else
  {
    Py_ssize_t __pyx_temp = __Pyx_PyBytes_GET_SIZE(__pyx_cur_scope->__pyx_v_data);
    if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(6, 1784, __pyx_L1_error)
    __pyx_t_3 = (__pyx_temp != 0);
  }

  if (__pyx_t_3) {

    /* "src/lxml/serializer.pxi":1785
 *         data = self._writer._flush()
 *         if data:
 *             await self._writer._async_outfile.write(data)             # <<<<<<<<<<<<<<
 * 
 * 
*/
    __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->_writer->_async_outfile;
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_4 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_cur_scope->__pyx_v_data};
      __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_write, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1785, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_t_5 = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_2, &__pyx_r);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (likely(__pyx_t_5 == PYGEN_NEXT)) {
      __Pyx_GOTREF(__pyx_r);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, awaiting value */
      __pyx_generator->resume_label = 1;
      return __pyx_r;
      __pyx_L5_resume_from_await:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(6, 1785, __pyx_L1_error)
    } else if (likely(__pyx_t_5 == PYGEN_RETURN)) {
      __Pyx_GOTREF(__pyx_r);
      __Pyx_DECREF(__pyx_r); __pyx_r = 0;
    } else {
      __Pyx_XGOTREF(__pyx_r);
      __PYX_ERR(6, 1785, __pyx_L1_error)
    }

    /* "src/lxml/serializer.pxi":1784
 *         self._element_writer.__exit__(*args)
 *         data = self._writer._flush()
 *         if data:             # <<<<<<<<<<<<<<
 *             await self._writer._async_outfile.write(data)
 * 
*/
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "src/lxml/serializer.pxi":1781
 *             await self._writer._async_outfile.write(data)
 * 
 *     async def __aexit__(self, *args):             # <<<<<<<<<<<<<<
 *         self._element_writer.__exit__(*args)
 *         data = self._writer._flush()
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("__aexit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1797
 *     cdef int _old_method
 * 
 *     def __cinit__(self, _IncrementalFileWriter writer not None, element_config, int method):             # <<<<<<<<<<<<<<
 *         self._writer = writer
 *         self._element = element_config
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_18_FileWriterElement_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_18_FileWriterElement_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_writer = 0;
  PyObject *__pyx_v_element_config = 0;
  int __pyx_v_method;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_writer,&__pyx_mstate_global->__pyx_n_u_element_config,&__pyx_mstate_global->__pyx_n_u_method,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(6, 1797, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(6, 1797, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(6, 1797, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 1797, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__cinit__", 0) < (0)) __PYX_ERR(6, 1797, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, i); __PYX_ERR(6, 1797, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 1797, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(6, 1797, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(6, 1797, __pyx_L3_error)
    }
    __pyx_v_writer = ((struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *)values[0]);
    __pyx_v_element_config = values[1];
    __pyx_v_method = __Pyx_PyLong_As_int(values[2]); if (unlikely((__pyx_v_method == (int)-1) && PyErr_Occurred())) __PYX_ERR(6, 1797, __pyx_L3_error)
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, __pyx_nargs); __PYX_ERR(6, 1797, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._FileWriterElement.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_writer), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__IncrementalFileWriter, 0, "writer", 0))) __PYX_ERR(6, 1797, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_18_FileWriterElement___cinit__(((struct __pyx_obj_4lxml_5etree__FileWriterElement *)__pyx_v_self), __pyx_v_writer, __pyx_v_element_config, __pyx_v_method);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_18_FileWriterElement___cinit__(struct __pyx_obj_4lxml_5etree__FileWriterElement *__pyx_v_self, struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_writer, PyObject *__pyx_v_element_config, int __pyx_v_method) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "src/lxml/serializer.pxi":1798
 * 
 *     def __cinit__(self, _IncrementalFileWriter writer not None, element_config, int method):
 *         self._writer = writer             # <<<<<<<<<<<<<<
 *         self._element = element_config
 *         self._new_method = method
*/
  __Pyx_INCREF((PyObject *)__pyx_v_writer);
  __Pyx_GIVEREF((PyObject *)__pyx_v_writer);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_writer);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_writer);
  __pyx_v_self->_writer = __pyx_v_writer;

  /* "src/lxml/serializer.pxi":1799
 *     def __cinit__(self, _IncrementalFileWriter writer not None, element_config, int method):
 *         self._writer = writer
 *         self._element = element_config             # <<<<<<<<<<<<<<
 *         self._new_method = method
 *         self._old_method = writer._method
*/
  __Pyx_INCREF(__pyx_v_element_config);
  __Pyx_GIVEREF(__pyx_v_element_config);
  __Pyx_GOTREF(__pyx_v_self->_element);
  __Pyx_DECREF(__pyx_v_self->_element);
  __pyx_v_self->_element = __pyx_v_element_config;

  /* "src/lxml/serializer.pxi":1800
 *         self._writer = writer
 *         self._element = element_config
 *         self._new_method = method             # <<<<<<<<<<<<<<
 *         self._old_method = writer._method
 * 
*/
  __pyx_v_self->_new_method = __pyx_v_method;

  /* "src/lxml/serializer.pxi":1801
 *         self._element = element_config
 *         self._new_method = method
 *         self._old_method = writer._method             # <<<<<<<<<<<<<<
 * 
 *     def __enter__(self):
*/
  __pyx_t_1 = __pyx_v_writer->_method;
  __pyx_v_self->_old_method = __pyx_t_1;

  /* "src/lxml/serializer.pxi":1797
 *     cdef int _old_method
 * 
 *     def __cinit__(self, _IncrementalFileWriter writer not None, element_config, int method):             # <<<<<<<<<<<<<<
 *         self._writer = writer
 *         self._element = element_config
*/

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1803
 *         self._old_method = writer._method
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         self._writer._method = self._new_method
 *         self._writer._write_start_element(self._element)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_18_FileWriterElement_3__enter__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_18_FileWriterElement_3__enter__ = {"__enter__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_18_FileWriterElement_3__enter__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_18_FileWriterElement_3__enter__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__enter__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__enter__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_18_FileWriterElement_2__enter__(((struct __pyx_obj_4lxml_5etree__FileWriterElement *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_18_FileWriterElement_2__enter__(struct __pyx_obj_4lxml_5etree__FileWriterElement *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__enter__", 0);

  /* "src/lxml/serializer.pxi":1804
 * 
 *     def __enter__(self):
 *         self._writer._method = self._new_method             # <<<<<<<<<<<<<<
 *         self._writer._write_start_element(self._element)
 * 
*/
  __pyx_t_1 = __pyx_v_self->_new_method;
  __pyx_v_self->_writer->_method = __pyx_t_1;

  /* "src/lxml/serializer.pxi":1805
 *     def __enter__(self):
 *         self._writer._method = self._new_method
 *         self._writer._write_start_element(self._element)             # <<<<<<<<<<<<<<
 * 
 *     def __exit__(self, exc_type, exc_val, exc_tb):
*/
  __pyx_t_2 = __pyx_v_self->_element;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = __pyx_f_4lxml_5etree_22_IncrementalFileWriter__write_start_element(__pyx_v_self->_writer, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1805, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/serializer.pxi":1803
 *         self._old_method = writer._method
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         self._writer._method = self._new_method
 *         self._writer._write_start_element(self._element)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._FileWriterElement.__enter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1807
 *         self._writer._write_start_element(self._element)
 * 
 *     def __exit__(self, exc_type, exc_val, exc_tb):             # <<<<<<<<<<<<<<
 *         self._writer._write_end_element(self._element)
 *         self._writer._method = self._old_method
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_18_FileWriterElement_5__exit__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_18_FileWriterElement_5__exit__ = {"__exit__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_18_FileWriterElement_5__exit__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_18_FileWriterElement_5__exit__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_exc_type = 0;
  CYTHON_UNUSED PyObject *__pyx_v_exc_val = 0;
  CYTHON_UNUSED PyObject *__pyx_v_exc_tb = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__exit__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_exc_type,&__pyx_mstate_global->__pyx_n_u_exc_val,&__pyx_mstate_global->__pyx_n_u_exc_tb,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(6, 1807, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(6, 1807, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(6, 1807, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 1807, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__exit__", 0) < (0)) __PYX_ERR(6, 1807, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, i); __PYX_ERR(6, 1807, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 1807, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(6, 1807, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(6, 1807, __pyx_L3_error)
    }
    __pyx_v_exc_type = values[0];
    __pyx_v_exc_val = values[1];
    __pyx_v_exc_tb = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, __pyx_nargs); __PYX_ERR(6, 1807, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._FileWriterElement.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_18_FileWriterElement_4__exit__(((struct __pyx_obj_4lxml_5etree__FileWriterElement *)__pyx_v_self), __pyx_v_exc_type, __pyx_v_exc_val, __pyx_v_exc_tb);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_18_FileWriterElement_4__exit__(struct __pyx_obj_4lxml_5etree__FileWriterElement *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exc_type, CYTHON_UNUSED PyObject *__pyx_v_exc_val, CYTHON_UNUSED PyObject *__pyx_v_exc_tb) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__exit__", 0);

  /* "src/lxml/serializer.pxi":1808
 * 
 *     def __exit__(self, exc_type, exc_val, exc_tb):
 *         self._writer._write_end_element(self._element)             # <<<<<<<<<<<<<<
 *         self._writer._method = self._old_method
 * 
*/
  __pyx_t_1 = __pyx_v_self->_element;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree_22_IncrementalFileWriter__write_end_element(__pyx_v_self->_writer, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1808, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/serializer.pxi":1809
 *     def __exit__(self, exc_type, exc_val, exc_tb):
 *         self._writer._write_end_element(self._element)
 *         self._writer._method = self._old_method             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_3 = __pyx_v_self->_old_method;
  __pyx_v_self->_writer->_method = __pyx_t_3;

  /* "src/lxml/serializer.pxi":1807
 *         self._writer._write_start_element(self._element)
 * 
 *     def __exit__(self, exc_type, exc_val, exc_tb):             # <<<<<<<<<<<<<<
 *         self._writer._write_end_element(self._element)
 *         self._writer._method = self._old_method
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._FileWriterElement.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1822
 *     cdef bint _exited
 * 
 *     def __cinit__(self, _IncrementalFileWriter writer not None, int method):             # <<<<<<<<<<<<<<
 *         self._writer = writer
 *         self._new_method = method
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_14_MethodChanger_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_14_MethodChanger_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_writer = 0;
  int __pyx_v_method;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_writer,&__pyx_mstate_global->__pyx_n_u_method,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(6, 1822, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(6, 1822, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 1822, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__cinit__", 0) < (0)) __PYX_ERR(6, 1822, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, i); __PYX_ERR(6, 1822, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 1822, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(6, 1822, __pyx_L3_error)
    }
    __pyx_v_writer = ((struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *)values[0]);
    __pyx_v_method = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_method == (int)-1) && PyErr_Occurred())) __PYX_ERR(6, 1822, __pyx_L3_error)
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, __pyx_nargs); __PYX_ERR(6, 1822, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._MethodChanger.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_writer), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__IncrementalFileWriter, 0, "writer", 0))) __PYX_ERR(6, 1822, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_14_MethodChanger___cinit__(((struct __pyx_obj_4lxml_5etree__MethodChanger *)__pyx_v_self), __pyx_v_writer, __pyx_v_method);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_14_MethodChanger___cinit__(struct __pyx_obj_4lxml_5etree__MethodChanger *__pyx_v_self, struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_writer, int __pyx_v_method) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "src/lxml/serializer.pxi":1823
 * 
 *     def __cinit__(self, _IncrementalFileWriter writer not None, int method):
 *         self._writer = writer             # <<<<<<<<<<<<<<
 *         self._new_method = method
 *         self._old_method = writer._method
*/
  __Pyx_INCREF((PyObject *)__pyx_v_writer);
  __Pyx_GIVEREF((PyObject *)__pyx_v_writer);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_writer);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_writer);
  __pyx_v_self->_writer = __pyx_v_writer;

  /* "src/lxml/serializer.pxi":1824
 *     def __cinit__(self, _IncrementalFileWriter writer not None, int method):
 *         self._writer = writer
 *         self._new_method = method             # <<<<<<<<<<<<<<
 *         self._old_method = writer._method
 *         self._entered = False
*/
  __pyx_v_self->_new_method = __pyx_v_method;

  /* "src/lxml/serializer.pxi":1825
 *         self._writer = writer
 *         self._new_method = method
 *         self._old_method = writer._method             # <<<<<<<<<<<<<<
 *         self._entered = False
 *         self._exited = False
*/
  __pyx_t_1 = __pyx_v_writer->_method;
  __pyx_v_self->_old_method = __pyx_t_1;

  /* "src/lxml/serializer.pxi":1826
 *         self._new_method = method
 *         self._old_method = writer._method
 *         self._entered = False             # <<<<<<<<<<<<<<
 *         self._exited = False
 * 
*/
  __pyx_v_self->_entered = 0;

  /* "src/lxml/serializer.pxi":1827
 *         self._old_method = writer._method
 *         self._entered = False
 *         self._exited = False             # <<<<<<<<<<<<<<
 * 
 *     def __enter__(self):
*/
  __pyx_v_self->_exited = 0;

  /* "src/lxml/serializer.pxi":1822
 *     cdef bint _exited
 * 
 *     def __cinit__(self, _IncrementalFileWriter writer not None, int method):             # <<<<<<<<<<<<<<
 *         self._writer = writer
 *         self._new_method = method
*/

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1829
 *         self._exited = False
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         if self._entered:
 *             raise LxmlSyntaxError("Inconsistent enter action in context manager")
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_14_MethodChanger_3__enter__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_14_MethodChanger_3__enter__ = {"__enter__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_14_MethodChanger_3__enter__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_14_MethodChanger_3__enter__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__enter__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__enter__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_14_MethodChanger_2__enter__(((struct __pyx_obj_4lxml_5etree__MethodChanger *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_14_MethodChanger_2__enter__(struct __pyx_obj_4lxml_5etree__MethodChanger *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__enter__", 0);

  /* "src/lxml/serializer.pxi":1830
 * 
 *     def __enter__(self):
 *         if self._entered:             # <<<<<<<<<<<<<<
 *             raise LxmlSyntaxError("Inconsistent enter action in context manager")
 *         self._writer._method = self._new_method
*/
  if (unlikely(__pyx_v_self->_entered)) {

    /* "src/lxml/serializer.pxi":1831
 *     def __enter__(self):
 *         if self._entered:
 *             raise LxmlSyntaxError("Inconsistent enter action in context manager")             # <<<<<<<<<<<<<<
 *         self._writer._method = self._new_method
 *         self._entered = True
*/
    __pyx_t_2 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_LxmlSyntaxError); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1831, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_Inconsistent_enter_action_in_con};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1831, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(6, 1831, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":1830
 * 
 *     def __enter__(self):
 *         if self._entered:             # <<<<<<<<<<<<<<
 *             raise LxmlSyntaxError("Inconsistent enter action in context manager")
 *         self._writer._method = self._new_method
*/
  }

  /* "src/lxml/serializer.pxi":1832
 *         if self._entered:
 *             raise LxmlSyntaxError("Inconsistent enter action in context manager")
 *         self._writer._method = self._new_method             # <<<<<<<<<<<<<<
 *         self._entered = True
 * 
*/
  __pyx_t_5 = __pyx_v_self->_new_method;
  __pyx_v_self->_writer->_method = __pyx_t_5;

  /* "src/lxml/serializer.pxi":1833
 *             raise LxmlSyntaxError("Inconsistent enter action in context manager")
 *         self._writer._method = self._new_method
 *         self._entered = True             # <<<<<<<<<<<<<<
 * 
 *     def __exit__(self, exc_type, exc_val, exc_tb):
*/
  __pyx_v_self->_entered = 1;

  /* "src/lxml/serializer.pxi":1829
 *         self._exited = False
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         if self._entered:
 *             raise LxmlSyntaxError("Inconsistent enter action in context manager")
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._MethodChanger.__enter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1835
 *         self._entered = True
 * 
 *     def __exit__(self, exc_type, exc_val, exc_tb):             # <<<<<<<<<<<<<<
 *         if self._exited:
 *             raise LxmlSyntaxError("Inconsistent exit action in context manager")
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_14_MethodChanger_5__exit__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_14_MethodChanger_5__exit__ = {"__exit__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_14_MethodChanger_5__exit__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_14_MethodChanger_5__exit__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_exc_type = 0;
  CYTHON_UNUSED PyObject *__pyx_v_exc_val = 0;
  CYTHON_UNUSED PyObject *__pyx_v_exc_tb = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__exit__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_exc_type,&__pyx_mstate_global->__pyx_n_u_exc_val,&__pyx_mstate_global->__pyx_n_u_exc_tb,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(6, 1835, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(6, 1835, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(6, 1835, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 1835, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__exit__", 0) < (0)) __PYX_ERR(6, 1835, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, i); __PYX_ERR(6, 1835, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(6, 1835, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(6, 1835, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(6, 1835, __pyx_L3_error)
    }
    __pyx_v_exc_type = values[0];
    __pyx_v_exc_val = values[1];
    __pyx_v_exc_tb = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, __pyx_nargs); __PYX_ERR(6, 1835, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._MethodChanger.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_14_MethodChanger_4__exit__(((struct __pyx_obj_4lxml_5etree__MethodChanger *)__pyx_v_self), __pyx_v_exc_type, __pyx_v_exc_val, __pyx_v_exc_tb);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_14_MethodChanger_4__exit__(struct __pyx_obj_4lxml_5etree__MethodChanger *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exc_type, CYTHON_UNUSED PyObject *__pyx_v_exc_val, CYTHON_UNUSED PyObject *__pyx_v_exc_tb) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__exit__", 0);

  /* "src/lxml/serializer.pxi":1836
 * 
 *     def __exit__(self, exc_type, exc_val, exc_tb):
 *         if self._exited:             # <<<<<<<<<<<<<<
 *             raise LxmlSyntaxError("Inconsistent exit action in context manager")
 *         if self._writer._method != self._new_method:
*/
  if (unlikely(__pyx_v_self->_exited)) {

    /* "src/lxml/serializer.pxi":1837
 *     def __exit__(self, exc_type, exc_val, exc_tb):
 *         if self._exited:
 *             raise LxmlSyntaxError("Inconsistent exit action in context manager")             # <<<<<<<<<<<<<<
 *         if self._writer._method != self._new_method:
 *             raise LxmlSyntaxError("Method changed outside of context manager")
*/
    __pyx_t_2 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_LxmlSyntaxError); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1837, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_Inconsistent_exit_action_in_cont};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1837, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(6, 1837, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":1836
 * 
 *     def __exit__(self, exc_type, exc_val, exc_tb):
 *         if self._exited:             # <<<<<<<<<<<<<<
 *             raise LxmlSyntaxError("Inconsistent exit action in context manager")
 *         if self._writer._method != self._new_method:
*/
  }

  /* "src/lxml/serializer.pxi":1838
 *         if self._exited:
 *             raise LxmlSyntaxError("Inconsistent exit action in context manager")
 *         if self._writer._method != self._new_method:             # <<<<<<<<<<<<<<
 *             raise LxmlSyntaxError("Method changed outside of context manager")
 *         self._writer._method = self._old_method
*/
  __pyx_t_5 = (__pyx_v_self->_writer->_method != __pyx_v_self->_new_method);
  if (unlikely(__pyx_t_5)) {

    /* "src/lxml/serializer.pxi":1839
 *             raise LxmlSyntaxError("Inconsistent exit action in context manager")
 *         if self._writer._method != self._new_method:
 *             raise LxmlSyntaxError("Method changed outside of context manager")             # <<<<<<<<<<<<<<
 *         self._writer._method = self._old_method
 *         self._exited = True
*/
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_LxmlSyntaxError); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1839, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Method_changed_outside_of_contex};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1839, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(6, 1839, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":1838
 *         if self._exited:
 *             raise LxmlSyntaxError("Inconsistent exit action in context manager")
 *         if self._writer._method != self._new_method:             # <<<<<<<<<<<<<<
 *             raise LxmlSyntaxError("Method changed outside of context manager")
 *         self._writer._method = self._old_method
*/
  }

  /* "src/lxml/serializer.pxi":1840
 *         if self._writer._method != self._new_method:
 *             raise LxmlSyntaxError("Method changed outside of context manager")
 *         self._writer._method = self._old_method             # <<<<<<<<<<<<<<
 *         self._exited = True
 * 
*/
  __pyx_t_6 = __pyx_v_self->_old_method;
  __pyx_v_self->_writer->_method = __pyx_t_6;

  /* "src/lxml/serializer.pxi":1841
 *             raise LxmlSyntaxError("Method changed outside of context manager")
 *         self._writer._method = self._old_method
 *         self._exited = True             # <<<<<<<<<<<<<<
 * 
 *     async def __aenter__(self):
*/
  __pyx_v_self->_exited = 1;

  /* "src/lxml/serializer.pxi":1835
 *         self._entered = True
 * 
 *     def __exit__(self, exc_type, exc_val, exc_tb):             # <<<<<<<<<<<<<<
 *         if self._exited:
 *             raise LxmlSyntaxError("Inconsistent exit action in context manager")
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._MethodChanger.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_4lxml_5etree_14_MethodChanger_8generator11(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "src/lxml/serializer.pxi":1843
 *         self._exited = True
 * 
 *     async def __aenter__(self):             # <<<<<<<<<<<<<<
 *         # for your async convenience
 *         return self.__enter__()
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_14_MethodChanger_7__aenter__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_14_MethodChanger_7__aenter__ = {"__aenter__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_14_MethodChanger_7__aenter__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_14_MethodChanger_7__aenter__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__aenter__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__aenter__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__aenter__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_14_MethodChanger_6__aenter__(((struct __pyx_obj_4lxml_5etree__MethodChanger *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_14_MethodChanger_6__aenter__(struct __pyx_obj_4lxml_5etree__MethodChanger *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_11___aenter__ *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__aenter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_11___aenter__ *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_11___aenter__(__pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_11___aenter__, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_11___aenter__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(6, 1843, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_CoroutineObject *gen = __Pyx_Coroutine_New((__pyx_coroutine_body_t) __pyx_gb_4lxml_5etree_14_MethodChanger_8generator11, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[12]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_aenter, __pyx_mstate_global->__pyx_n_u_MethodChanger___aenter, __pyx_mstate_global->__pyx_n_u_lxml_etree); if (unlikely(!gen)) __PYX_ERR(6, 1843, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._MethodChanger.__aenter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_4lxml_5etree_14_MethodChanger_8generator11(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_11___aenter__ *__pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_11___aenter__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__aenter__", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(__pyx_sent_value != Py_None)) {
    if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started coroutine");
    __PYX_ERR(6, 1843, __pyx_L1_error)
  }

  /* "src/lxml/serializer.pxi":1845
 *     async def __aenter__(self):
 *         # for your async convenience
 *         return self.__enter__()             # <<<<<<<<<<<<<<
 * 
 *     async def __aexit__(self, *args):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_enter, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1845, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "src/lxml/serializer.pxi":1843
 *         self._exited = True
 * 
 *     async def __aenter__(self):             # <<<<<<<<<<<<<<
 *         # for your async convenience
 *         return self.__enter__()
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("__aenter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_4lxml_5etree_14_MethodChanger_11generator12(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "src/lxml/serializer.pxi":1847
 *         return self.__enter__()
 * 
 *     async def __aexit__(self, *args):             # <<<<<<<<<<<<<<
 *         # for your async convenience
 *         return self.__exit__(*args)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_14_MethodChanger_10__aexit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_14_MethodChanger_10__aexit__ = {"__aexit__", (PyCFunction)(void(*)(void))(PyCFunctionWithKeywords)__pyx_pw_4lxml_5etree_14_MethodChanger_10__aexit__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_14_MethodChanger_10__aexit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_args = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__aexit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__aexit__", __pyx_kwds); return NULL;}
  __Pyx_INCREF(__pyx_args);
  __pyx_v_args = __pyx_args;
  __pyx_r = __pyx_pf_4lxml_5etree_14_MethodChanger_9__aexit__(((struct __pyx_obj_4lxml_5etree__MethodChanger *)__pyx_v_self), __pyx_v_args);

  /* function exit code */
  __Pyx_DECREF(__pyx_v_args);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_14_MethodChanger_9__aexit__(struct __pyx_obj_4lxml_5etree__MethodChanger *__pyx_v_self, PyObject *__pyx_v_args) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_12___aexit__ *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__aexit__", 0);
  __pyx_cur_scope = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_12___aexit__ *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_12___aexit__(__pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_12___aexit__, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_12___aexit__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(6, 1847, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_args = __pyx_v_args;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_args);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_args);
  {
    __pyx_CoroutineObject *gen = __Pyx_Coroutine_New((__pyx_coroutine_body_t) __pyx_gb_4lxml_5etree_14_MethodChanger_11generator12, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[13]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_aexit, __pyx_mstate_global->__pyx_n_u_MethodChanger___aexit, __pyx_mstate_global->__pyx_n_u_lxml_etree); if (unlikely(!gen)) __PYX_ERR(6, 1847, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._MethodChanger.__aexit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_4lxml_5etree_14_MethodChanger_11generator12(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_12___aexit__ *__pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_12___aexit__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__aexit__", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(__pyx_sent_value != Py_None)) {
    if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started coroutine");
    __PYX_ERR(6, 1847, __pyx_L1_error)
  }

  /* "src/lxml/serializer.pxi":1849
 *     async def __aexit__(self, *args):
 *         # for your async convenience
 *         return self.__exit__(*args)             # <<<<<<<<<<<<<<
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1849, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_cur_scope->__pyx_v_args, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1849, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "src/lxml/serializer.pxi":1847
 *         return self.__enter__()
 * 
 *     async def __aexit__(self, *args):             # <<<<<<<<<<<<<<
 *         # for your async convenience
 *         return self.__exit__(*args)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("__aexit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/iterparse.pxi":68
 *     cdef bint _close_source_after_read
 * 
 *     def __init__(self, source, events=("end",), *, tag=None,             # <<<<<<<<<<<<<<
 *                  attribute_defaults=False, dtd_validation=False,
 *                  load_dtd=False, no_network=True, remove_blank_text=False,
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_9iterparse_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_9iterparse_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_source = 0;
  PyObject *__pyx_v_events = 0;
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_v_attribute_defaults = 0;
  PyObject *__pyx_v_dtd_validation = 0;
  PyObject *__pyx_v_load_dtd = 0;
  PyObject *__pyx_v_no_network = 0;
  PyObject *__pyx_v_remove_blank_text = 0;
  PyObject *__pyx_v_compact = 0;
  PyObject *__pyx_v_resolve_entities = 0;
  PyObject *__pyx_v_remove_comments = 0;
  PyObject *__pyx_v_remove_pis = 0;
  PyObject *__pyx_v_strip_cdata = 0;
  PyObject *__pyx_v_encoding = 0;
  PyObject *__pyx_v_html = 0;
  PyObject *__pyx_v_recover = 0;
  PyObject *__pyx_v_huge_tree = 0;
  CYTHON_UNUSED PyObject *__pyx_v_collect_ids = 0;
  struct __pyx_obj_4lxml_5etree_XMLSchema *__pyx_v_schema = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[19] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_source,&__pyx_mstate_global->__pyx_n_u_events,&__pyx_mstate_global->__pyx_n_u_tag,&__pyx_mstate_global->__pyx_n_u_attribute_defaults,&__pyx_mstate_global->__pyx_n_u_dtd_validation,&__pyx_mstate_global->__pyx_n_u_load_dtd,&__pyx_mstate_global->__pyx_n_u_no_network,&__pyx_mstate_global->__pyx_n_u_remove_blank_text,&__pyx_mstate_global->__pyx_n_u_compact,&__pyx_mstate_global->__pyx_n_u_resolve_entities,&__pyx_mstate_global->__pyx_n_u_remove_comments,&__pyx_mstate_global->__pyx_n_u_remove_pis,&__pyx_mstate_global->__pyx_n_u_strip_cdata,&__pyx_mstate_global->__pyx_n_u_encoding,&__pyx_mstate_global->__pyx_n_u_html,&__pyx_mstate_global->__pyx_n_u_recover,&__pyx_mstate_global->__pyx_n_u_huge_tree,&__pyx_mstate_global->__pyx_n_u_collect_ids,&__pyx_mstate_global->__pyx_n_u_schema,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(14, 68, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(14, 68, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(14, 68, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(14, 68, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_tuple[6]));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "src/lxml/iterparse.pxi":69
 * 
 *     def __init__(self, source, events=("end",), *, tag=None,
 *                  attribute_defaults=False, dtd_validation=False,             # <<<<<<<<<<<<<<
 *                  load_dtd=False, no_network=True, remove_blank_text=False,
 *                  compact=True, resolve_entities=True, remove_comments=False,
*/
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_False));

      /* "src/lxml/iterparse.pxi":70
 *     def __init__(self, source, events=("end",), *, tag=None,
 *                  attribute_defaults=False, dtd_validation=False,
 *                  load_dtd=False, no_network=True, remove_blank_text=False,             # <<<<<<<<<<<<<<
 *                  compact=True, resolve_entities=True, remove_comments=False,
 *                  remove_pis=False, strip_cdata=True, encoding=None,
*/
      if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[6]) values[6] = __Pyx_NewRef(((PyObject *)Py_True));
      if (!values[7]) values[7] = __Pyx_NewRef(((PyObject *)Py_False));

      /* "src/lxml/iterparse.pxi":71
 *                  attribute_defaults=False, dtd_validation=False,
 *                  load_dtd=False, no_network=True, remove_blank_text=False,
 *                  compact=True, resolve_entities=True, remove_comments=False,             # <<<<<<<<<<<<<<
 *                  remove_pis=False, strip_cdata=True, encoding=None,
 *                  html=False, recover=None, huge_tree=False, collect_ids=True,
*/
      if (!values[8]) values[8] = __Pyx_NewRef(((PyObject *)Py_True));
      if (!values[9]) values[9] = __Pyx_NewRef(((PyObject *)Py_True));
      if (!values[10]) values[10] = __Pyx_NewRef(((PyObject *)Py_False));

      /* "src/lxml/iterparse.pxi":72
 *                  load_dtd=False, no_network=True, remove_blank_text=False,
 *                  compact=True, resolve_entities=True, remove_comments=False,
 *                  remove_pis=False, strip_cdata=True, encoding=None,             # <<<<<<<<<<<<<<
 *                  html=False, recover=None, huge_tree=False, collect_ids=True,
 *                  XMLSchema schema=None):
*/
      if (!values[11]) values[11] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[12]) values[12] = __Pyx_NewRef(((PyObject *)Py_True));
      if (!values[13]) values[13] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "src/lxml/iterparse.pxi":73
 *                  compact=True, resolve_entities=True, remove_comments=False,
 *                  remove_pis=False, strip_cdata=True, encoding=None,
 *                  html=False, recover=None, huge_tree=False, collect_ids=True,             # <<<<<<<<<<<<<<
 *                  XMLSchema schema=None):
 *         if not hasattr(source, 'read'):
*/
      if (!values[14]) values[14] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[15]) values[15] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[16]) values[16] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[17]) values[17] = __Pyx_NewRef(((PyObject *)Py_True));

      /* "src/lxml/iterparse.pxi":74
 *                  remove_pis=False, strip_cdata=True, encoding=None,
 *                  html=False, recover=None, huge_tree=False, collect_ids=True,
 *                  XMLSchema schema=None):             # <<<<<<<<<<<<<<
 *         if not hasattr(source, 'read'):
 *             source = _getFSPathOrObject(source)
*/
      if (!values[18]) values[18] = __Pyx_NewRef((PyObject *)((struct __pyx_obj_4lxml_5etree_XMLSchema *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, i); __PYX_ERR(14, 68, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(14, 68, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(14, 68, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }

      /* "src/lxml/iterparse.pxi":68
 *     cdef bint _close_source_after_read
 * 
 *     def __init__(self, source, events=("end",), *, tag=None,             # <<<<<<<<<<<<<<
 *                  attribute_defaults=False, dtd_validation=False,
 *                  load_dtd=False, no_network=True, remove_blank_text=False,
*/
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_tuple[6]));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "src/lxml/iterparse.pxi":69
 * 
 *     def __init__(self, source, events=("end",), *, tag=None,
 *                  attribute_defaults=False, dtd_validation=False,             # <<<<<<<<<<<<<<
 *                  load_dtd=False, no_network=True, remove_blank_text=False,
 *                  compact=True, resolve_entities=True, remove_comments=False,
*/
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_False));

      /* "src/lxml/iterparse.pxi":70
 *     def __init__(self, source, events=("end",), *, tag=None,
 *                  attribute_defaults=False, dtd_validation=False,
 *                  load_dtd=False, no_network=True, remove_blank_text=False,             # <<<<<<<<<<<<<<
 *                  compact=True, resolve_entities=True, remove_comments=False,
 *                  remove_pis=False, strip_cdata=True, encoding=None,
*/
      if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[6]) values[6] = __Pyx_NewRef(((PyObject *)Py_True));
      if (!values[7]) values[7] = __Pyx_NewRef(((PyObject *)Py_False));

      /* "src/lxml/iterparse.pxi":71
 *                  attribute_defaults=False, dtd_validation=False,
 *                  load_dtd=False, no_network=True, remove_blank_text=False,
 *                  compact=True, resolve_entities=True, remove_comments=False,             # <<<<<<<<<<<<<<
 *                  remove_pis=False, strip_cdata=True, encoding=None,
 *                  html=False, recover=None, huge_tree=False, collect_ids=True,
*/
      if (!values[8]) values[8] = __Pyx_NewRef(((PyObject *)Py_True));
      if (!values[9]) values[9] = __Pyx_NewRef(((PyObject *)Py_True));
      if (!values[10]) values[10] = __Pyx_NewRef(((PyObject *)Py_False));

      /* "src/lxml/iterparse.pxi":72
 *                  load_dtd=False, no_network=True, remove_blank_text=False,
 *                  compact=True, resolve_entities=True, remove_comments=False,
 *                  remove_pis=False, strip_cdata=True, encoding=None,             # <<<<<<<<<<<<<<
 *                  html=False, recover=None, huge_tree=False, collect_ids=True,
 *                  XMLSchema schema=None):
*/
      if (!values[11]) values[11] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[12]) values[12] = __Pyx_NewRef(((PyObject *)Py_True));
      if (!values[13]) values[13] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "src/lxml/iterparse.pxi":73
 *                  compact=True, resolve_entities=True, remove_comments=False,
 *                  remove_pis=False, strip_cdata=True, encoding=None,
 *                  html=False, recover=None, huge_tree=False, collect_ids=True,             # <<<<<<<<<<<<<<
 *                  XMLSchema schema=None):
 *         if not hasattr(source, 'read'):
*/
      if (!values[14]) values[14] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[15]) values[15] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[16]) values[16] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[17]) values[17] = __Pyx_NewRef(((PyObject *)Py_True));

      /* "src/lxml/iterparse.pxi":74
 *                  remove_pis=False, strip_cdata=True, encoding=None,
 *                  html=False, recover=None, huge_tree=False, collect_ids=True,
 *                  XMLSchema schema=None):             # <<<<<<<<<<<<<<
 *         if not hasattr(source, 'read'):
 *             source = _getFSPathOrObject(source)
*/
      if (!values[18]) values[18] = __Pyx_NewRef((PyObject *)((struct __pyx_obj_4lxml_5etree_XMLSchema *)Py_None));
    }
    __pyx_v_source = values[0];
    __pyx_v_events = values[1];
    __pyx_v_tag = values[2];
    __pyx_v_attribute_defaults = values[3];
    __pyx_v_dtd_validation = values[4];
    __pyx_v_load_dtd = values[5];
    __pyx_v_no_network = values[6];
    __pyx_v_remove_blank_text = values[7];
    __pyx_v_compact = values[8];
    __pyx_v_resolve_entities = values[9];
    __pyx_v_remove_comments = values[10];
    __pyx_v_remove_pis = values[11];
    __pyx_v_strip_cdata = values[12];
    __pyx_v_encoding = values[13];
    __pyx_v_html = values[14];
    __pyx_v_recover = values[15];
    __pyx_v_huge_tree = values[16];
    __pyx_v_collect_ids = values[17];
    __pyx_v_schema = ((struct __pyx_obj_4lxml_5etree_XMLSchema *)values[18]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, __pyx_nargs); __PYX_ERR(14, 68, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.iterparse.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_schema), __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XMLSchema, 1, "schema", 0))) __PYX_ERR(14, 74, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_9iterparse___init__(((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self), __pyx_v_source, __pyx_v_events, __pyx_v_tag, __pyx_v_attribute_defaults, __pyx_v_dtd_validation, __pyx_v_load_dtd, __pyx_v_no_network, __pyx_v_remove_blank_text, __pyx_v_compact, __pyx_v_resolve_entities, __pyx_v_remove_comments, __pyx_v_remove_pis, __pyx_v_strip_cdata, __pyx_v_encoding, __pyx_v_html, __pyx_v_recover, __pyx_v_huge_tree, __pyx_v_collect_ids, __pyx_v_schema);

  /* "src/lxml/iterparse.pxi":68
 *     cdef bint _close_source_after_read
 * 
 *     def __init__(self, source, events=("end",), *, tag=None,             # <<<<<<<<<<<<<<
 *                  attribute_defaults=False, dtd_validation=False,
 *                  load_dtd=False, no_network=True, remove_blank_text=False,
*/

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_9iterparse___init__(struct __pyx_obj_4lxml_5etree_iterparse *__pyx_v_self, PyObject *__pyx_v_source, PyObject *__pyx_v_events, PyObject *__pyx_v_tag, PyObject *__pyx_v_attribute_defaults, PyObject *__pyx_v_dtd_validation, PyObject *__pyx_v_load_dtd, PyObject *__pyx_v_no_network, PyObject *__pyx_v_remove_blank_text, PyObject *__pyx_v_compact, PyObject *__pyx_v_resolve_entities, PyObject *__pyx_v_remove_comments, PyObject *__pyx_v_remove_pis, PyObject *__pyx_v_strip_cdata, PyObject *__pyx_v_encoding, PyObject *__pyx_v_html, PyObject *__pyx_v_recover, PyObject *__pyx_v_huge_tree, CYTHON_UNUSED PyObject *__pyx_v_collect_ids, struct __pyx_obj_4lxml_5etree_XMLSchema *__pyx_v_schema) {
  struct __pyx_obj_4lxml_5etree__FeedParser *__pyx_v_parser = NULL;
  PyObject *__pyx_9genexpr17__pyx_v_event = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_INCREF(__pyx_v_source);
  __Pyx_INCREF(__pyx_v_events);
  __Pyx_INCREF(__pyx_v_recover);

  /* "src/lxml/iterparse.pxi":75
 *                  html=False, recover=None, huge_tree=False, collect_ids=True,
 *                  XMLSchema schema=None):
 *         if not hasattr(source, 'read'):             # <<<<<<<<<<<<<<
 *             source = _getFSPathOrObject(source)
 *             self._filename = source
*/
  __pyx_t_1 = __Pyx_HasAttr(__pyx_v_source, __pyx_mstate_global->__pyx_n_u_read); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(14, 75, __pyx_L1_error)
  __pyx_t_2 = (!__pyx_t_1);
  if (__pyx_t_2) {

    /* "src/lxml/iterparse.pxi":76
 *                  XMLSchema schema=None):
 *         if not hasattr(source, 'read'):
 *             source = _getFSPathOrObject(source)             # <<<<<<<<<<<<<<
 *             self._filename = source
 *             self._source = open(source, 'rb')
*/
    __pyx_t_3 = __pyx_f_4lxml_5etree__getFSPathOrObject(__pyx_v_source); if (unlikely(!__pyx_t_3)) __PYX_ERR(14, 76, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_source, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/iterparse.pxi":77
 *         if not hasattr(source, 'read'):
 *             source = _getFSPathOrObject(source)
 *             self._filename = source             # <<<<<<<<<<<<<<
 *             self._source = open(source, 'rb')
 *             self._close_source_after_read = True
*/
    __Pyx_INCREF(__pyx_v_source);
    __Pyx_GIVEREF(__pyx_v_source);
    __Pyx_GOTREF(__pyx_v_self->_filename);
    __Pyx_DECREF(__pyx_v_self->_filename);
    __pyx_v_self->_filename = __pyx_v_source;

    /* "src/lxml/iterparse.pxi":78
 *             source = _getFSPathOrObject(source)
 *             self._filename = source
 *             self._source = open(source, 'rb')             # <<<<<<<<<<<<<<
 *             self._close_source_after_read = True
 *         else:
*/
    __pyx_t_4 = NULL;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_v_source, __pyx_mstate_global->__pyx_n_u_rb};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_open, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(14, 78, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF(__pyx_v_self->_source);
    __Pyx_DECREF(__pyx_v_self->_source);
    __pyx_v_self->_source = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "src/lxml/iterparse.pxi":79
 *             self._filename = source
 *             self._source = open(source, 'rb')
 *             self._close_source_after_read = True             # <<<<<<<<<<<<<<
 *         else:
 *             self._filename = _getFilenameForFile(source)
*/
    __pyx_v_self->_close_source_after_read = 1;

    /* "src/lxml/iterparse.pxi":75
 *                  html=False, recover=None, huge_tree=False, collect_ids=True,
 *                  XMLSchema schema=None):
 *         if not hasattr(source, 'read'):             # <<<<<<<<<<<<<<
 *             source = _getFSPathOrObject(source)
 *             self._filename = source
*/
    goto __pyx_L3;
  }

  /* "src/lxml/iterparse.pxi":81
 *             self._close_source_after_read = True
 *         else:
 *             self._filename = _getFilenameForFile(source)             # <<<<<<<<<<<<<<
 *             self._source = source
 *             self._close_source_after_read = False
*/
  /*else*/ {
    __pyx_t_3 = __pyx_f_4lxml_5etree__getFilenameForFile(__pyx_v_source); if (unlikely(!__pyx_t_3)) __PYX_ERR(14, 81, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF(__pyx_v_self->_filename);
    __Pyx_DECREF(__pyx_v_self->_filename);
    __pyx_v_self->_filename = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "src/lxml/iterparse.pxi":82
 *         else:
 *             self._filename = _getFilenameForFile(source)
 *             self._source = source             # <<<<<<<<<<<<<<
 *             self._close_source_after_read = False
 * 
*/
    __Pyx_INCREF(__pyx_v_source);
    __Pyx_GIVEREF(__pyx_v_source);
    __Pyx_GOTREF(__pyx_v_self->_source);
    __Pyx_DECREF(__pyx_v_self->_source);
    __pyx_v_self->_source = __pyx_v_source;

    /* "src/lxml/iterparse.pxi":83
 *             self._filename = _getFilenameForFile(source)
 *             self._source = source
 *             self._close_source_after_read = False             # <<<<<<<<<<<<<<
 * 
 *         if recover is None:
*/
    __pyx_v_self->_close_source_after_read = 0;
  }
  __pyx_L3:;

  /* "src/lxml/iterparse.pxi":85
 *             self._close_source_after_read = False
 * 
 *         if recover is None:             # <<<<<<<<<<<<<<
 *             recover = html
 * 
*/
  __pyx_t_2 = (__pyx_v_recover == Py_None);
  if (__pyx_t_2) {

    /* "src/lxml/iterparse.pxi":86
 * 
 *         if recover is None:
 *             recover = html             # <<<<<<<<<<<<<<
 * 
 *         if html:
*/
    __Pyx_INCREF(__pyx_v_html);
    __Pyx_DECREF_SET(__pyx_v_recover, __pyx_v_html);

    /* "src/lxml/iterparse.pxi":85
 *             self._close_source_after_read = False
 * 
 *         if recover is None:             # <<<<<<<<<<<<<<
 *             recover = html
 * 
*/
  }

  /* "src/lxml/iterparse.pxi":88
 *             recover = html
 * 
 *         if html:             # <<<<<<<<<<<<<<
 *             # make sure we're not looking for namespaces
 *             events = [event for event in events
*/
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_html); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(14, 88, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "src/lxml/iterparse.pxi":90
 *         if html:
 *             # make sure we're not looking for namespaces
 *             events = [event for event in events             # <<<<<<<<<<<<<<
 *                       if event not in ('start-ns', 'end-ns')]
 *             parser = HTMLPullParser(
*/
    { /* enter inner scope */
      __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(14, 90, __pyx_L8_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (likely(PyList_CheckExact(__pyx_v_events)) || PyTuple_CheckExact(__pyx_v_events)) {
        __pyx_t_4 = __pyx_v_events; __Pyx_INCREF(__pyx_t_4);
        __pyx_t_6 = 0;
        __pyx_t_7 = NULL;
      } else {
        __pyx_t_6 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_events); if (unlikely(!__pyx_t_4)) __PYX_ERR(14, 90, __pyx_L8_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(14, 90, __pyx_L8_error)
      }
      for (;;) {
        if (likely(!__pyx_t_7)) {
          if (likely(PyList_CheckExact(__pyx_t_4))) {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_4);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(14, 90, __pyx_L8_error)
              #endif
              if (__pyx_t_6 >= __pyx_temp) break;
            }
            __pyx_t_8 = __Pyx_PyList_GetItemRefFast(__pyx_t_4, __pyx_t_6, __Pyx_ReferenceSharing_OwnStrongReference);
            ++__pyx_t_6;
          } else {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(14, 90, __pyx_L8_error)
              #endif
              if (__pyx_t_6 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_8 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_6));
            #else
            __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_6);
            #endif
            ++__pyx_t_6;
          }
          if (unlikely(!__pyx_t_8)) __PYX_ERR(14, 90, __pyx_L8_error)
        } else {
          __pyx_t_8 = __pyx_t_7(__pyx_t_4);
          if (unlikely(!__pyx_t_8)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(14, 90, __pyx_L8_error)
              PyErr_Clear();
            }
            break;
          }
        }
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_XDECREF_SET(__pyx_9genexpr17__pyx_v_event, __pyx_t_8);
        __pyx_t_8 = 0;

        /* "src/lxml/iterparse.pxi":91
 *             # make sure we're not looking for namespaces
 *             events = [event for event in events
 *                       if event not in ('start-ns', 'end-ns')]             # <<<<<<<<<<<<<<
 *             parser = HTMLPullParser(
 *                 events,
*/
        __Pyx_INCREF(__pyx_9genexpr17__pyx_v_event);
        __pyx_t_8 = __pyx_9genexpr17__pyx_v_event;
        __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_t_8, __pyx_mstate_global->__pyx_kp_u_start_ns, Py_NE)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(14, 91, __pyx_L8_error)
        if (__pyx_t_1) {
        } else {
          __pyx_t_2 = __pyx_t_1;
          goto __pyx_L12_bool_binop_done;
        }
        __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_t_8, __pyx_mstate_global->__pyx_kp_u_end_ns, Py_NE)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(14, 91, __pyx_L8_error)
        __pyx_t_2 = __pyx_t_1;
        __pyx_L12_bool_binop_done:;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_1 = __pyx_t_2;
        if (__pyx_t_1) {

          /* "src/lxml/iterparse.pxi":90
 *         if html:
 *             # make sure we're not looking for namespaces
 *             events = [event for event in events             # <<<<<<<<<<<<<<
 *                       if event not in ('start-ns', 'end-ns')]
 *             parser = HTMLPullParser(
*/
          if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_9genexpr17__pyx_v_event))) __PYX_ERR(14, 90, __pyx_L8_error)

          /* "src/lxml/iterparse.pxi":91
 *             # make sure we're not looking for namespaces
 *             events = [event for event in events
 *                       if event not in ('start-ns', 'end-ns')]             # <<<<<<<<<<<<<<
 *             parser = HTMLPullParser(
 *                 events,
*/
        }

        /* "src/lxml/iterparse.pxi":90
 *         if html:
 *             # make sure we're not looking for namespaces
 *             events = [event for event in events             # <<<<<<<<<<<<<<
 *                       if event not in ('start-ns', 'end-ns')]
 *             parser = HTMLPullParser(
*/
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_9genexpr17__pyx_v_event); __pyx_9genexpr17__pyx_v_event = 0;
      goto __pyx_L15_exit_scope;
      __pyx_L8_error:;
      __Pyx_XDECREF(__pyx_9genexpr17__pyx_v_event); __pyx_9genexpr17__pyx_v_event = 0;
      goto __pyx_L1_error;
      __pyx_L15_exit_scope:;
    } /* exit inner scope */
    __Pyx_DECREF_SET(__pyx_v_events, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/iterparse.pxi":92
 *             events = [event for event in events
 *                       if event not in ('start-ns', 'end-ns')]
 *             parser = HTMLPullParser(             # <<<<<<<<<<<<<<
 *                 events,
 *                 tag=tag,
*/
    __pyx_t_4 = NULL;

    /* "src/lxml/iterparse.pxi":104
 *                 target=None,  # TODO
 *                 schema=schema,
 *                 compact=compact)             # <<<<<<<<<<<<<<
 *         else:
 *             parser = XMLPullParser(
*/
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 11 : 0)] = {__pyx_t_4, __pyx_v_events};
      __pyx_t_8 = __Pyx_MakeVectorcallBuilderKwds(11); if (unlikely(!__pyx_t_8)) __PYX_ERR(14, 92, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_tag, __pyx_v_tag, __pyx_t_8, __pyx_callargs+2, 0) < (0)) __PYX_ERR(14, 92, __pyx_L1_error)
      if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_recover, __pyx_v_recover, __pyx_t_8, __pyx_callargs+2, 1) < (0)) __PYX_ERR(14, 92, __pyx_L1_error)
      if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_base_url, __pyx_v_self->_filename, __pyx_t_8, __pyx_callargs+2, 2) < (0)) __PYX_ERR(14, 92, __pyx_L1_error)
      if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_encoding, __pyx_v_encoding, __pyx_t_8, __pyx_callargs+2, 3) < (0)) __PYX_ERR(14, 92, __pyx_L1_error)
      if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_remove_blank_text, __pyx_v_remove_blank_text, __pyx_t_8, __pyx_callargs+2, 4) < (0)) __PYX_ERR(14, 92, __pyx_L1_error)
      if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_remove_comments, __pyx_v_remove_comments, __pyx_t_8, __pyx_callargs+2, 5) < (0)) __PYX_ERR(14, 92, __pyx_L1_error)
      if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_remove_pis, __pyx_v_remove_pis, __pyx_t_8, __pyx_callargs+2, 6) < (0)) __PYX_ERR(14, 92, __pyx_L1_error)
      if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_no_network, __pyx_v_no_network, __pyx_t_8, __pyx_callargs+2, 7) < (0)) __PYX_ERR(14, 92, __pyx_L1_error)
      if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_target, Py_None, __pyx_t_8, __pyx_callargs+2, 8) < (0)) __PYX_ERR(14, 92, __pyx_L1_error)
      if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_schema, ((PyObject *)__pyx_v_schema), __pyx_t_8, __pyx_callargs+2, 9) < (0)) __PYX_ERR(14, 92, __pyx_L1_error)
      if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_compact, __pyx_v_compact, __pyx_t_8, __pyx_callargs+2, 10) < (0)) __PYX_ERR(14, 92, __pyx_L1_error)
      __pyx_t_3 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_HTMLPullParser, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_8);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(14, 92, __pyx_L1_error)
      __Pyx_GOTREF((PyObject *)__pyx_t_3);
    }
    __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__FeedParser *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/iterparse.pxi":88
 *             recover = html
 * 
 *         if html:             # <<<<<<<<<<<<<<
 *             # make sure we're not looking for namespaces
 *             events = [event for event in events
*/
    goto __pyx_L5;
  }

  /* "src/lxml/iterparse.pxi":106
 *                 compact=compact)
 *         else:
 *             parser = XMLPullParser(             # <<<<<<<<<<<<<<
 *                 events,
 *                 tag=tag,
*/
  /*else*/ {
    __pyx_t_8 = NULL;

    /* "src/lxml/iterparse.pxi":125
 *                 collect_ids=True,
 *                 target=None,  # TODO
 *                 compact=compact)             # <<<<<<<<<<<<<<
 * 
 *         self._events = parser.read_events()
*/
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 18 : 0)] = {__pyx_t_8, __pyx_v_events};
      __pyx_t_4 = __Pyx_MakeVectorcallBuilderKwds(18); if (unlikely(!__pyx_t_4)) __PYX_ERR(14, 106, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_tag, __pyx_v_tag, __pyx_t_4, __pyx_callargs+2, 0) < (0)) __PYX_ERR(14, 106, __pyx_L1_error)
      if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_recover, __pyx_v_recover, __pyx_t_4, __pyx_callargs+2, 1) < (0)) __PYX_ERR(14, 106, __pyx_L1_error)
      if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_base_url, __pyx_v_self->_filename, __pyx_t_4, __pyx_callargs+2, 2) < (0)) __PYX_ERR(14, 106, __pyx_L1_error)
      if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_encoding, __pyx_v_encoding, __pyx_t_4, __pyx_callargs+2, 3) < (0)) __PYX_ERR(14, 106, __pyx_L1_error)
      if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_attribute_defaults, __pyx_v_attribute_defaults, __pyx_t_4, __pyx_callargs+2, 4) < (0)) __PYX_ERR(14, 106, __pyx_L1_error)
      if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtd_validation, __pyx_v_dtd_validation, __pyx_t_4, __pyx_callargs+2, 5) < (0)) __PYX_ERR(14, 106, __pyx_L1_error)
      if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_load_dtd, __pyx_v_load_dtd, __pyx_t_4, __pyx_callargs+2, 6) < (0)) __PYX_ERR(14, 106, __pyx_L1_error)
      if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_no_network, __pyx_v_no_network, __pyx_t_4, __pyx_callargs+2, 7) < (0)) __PYX_ERR(14, 106, __pyx_L1_error)
      if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_schema, ((PyObject *)__pyx_v_schema), __pyx_t_4, __pyx_callargs+2, 8) < (0)) __PYX_ERR(14, 106, __pyx_L1_error)
      if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_huge_tree, __pyx_v_huge_tree, __pyx_t_4, __pyx_callargs+2, 9) < (0)) __PYX_ERR(14, 106, __pyx_L1_error)
      if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_remove_blank_text, __pyx_v_remove_blank_text, __pyx_t_4, __pyx_callargs+2, 10) < (0)) __PYX_ERR(14, 106, __pyx_L1_error)
      if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_resolve_entities, __pyx_v_resolve_entities, __pyx_t_4, __pyx_callargs+2, 11) < (0)) __PYX_ERR(14, 106, __pyx_L1_error)
      if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_remove_comments, __pyx_v_remove_comments, __pyx_t_4, __pyx_callargs+2, 12) < (0)) __PYX_ERR(14, 106, __pyx_L1_error)
      if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_remove_pis, __pyx_v_remove_pis, __pyx_t_4, __pyx_callargs+2, 13) < (0)) __PYX_ERR(14, 106, __pyx_L1_error)
      if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_strip_cdata, __pyx_v_strip_cdata, __pyx_t_4, __pyx_callargs+2, 14) < (0)) __PYX_ERR(14, 106, __pyx_L1_error)
      if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_collect_ids, Py_True, __pyx_t_4, __pyx_callargs+2, 15) < (0)) __PYX_ERR(14, 106, __pyx_L1_error)
      if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_target, Py_None, __pyx_t_4, __pyx_callargs+2, 16) < (0)) __PYX_ERR(14, 106, __pyx_L1_error)
      if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_compact, __pyx_v_compact, __pyx_t_4, __pyx_callargs+2, 17) < (0)) __PYX_ERR(14, 106, __pyx_L1_error)
      __pyx_t_3 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XMLPullParser, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_4);
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(14, 106, __pyx_L1_error)
      __Pyx_GOTREF((PyObject *)__pyx_t_3);
    }
    __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__FeedParser *)__pyx_t_3);
    __pyx_t_3 = 0;
  }
  __pyx_L5:;

  /* "src/lxml/iterparse.pxi":127
 *                 compact=compact)
 * 
 *         self._events = parser.read_events()             # <<<<<<<<<<<<<<
 *         self._parser = parser
 * 
*/
  __pyx_t_4 = ((PyObject *)__pyx_v_parser);
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
    __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_read_events, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(14, 127, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_v_self->_events);
  __Pyx_DECREF(__pyx_v_self->_events);
  __pyx_v_self->_events = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "src/lxml/iterparse.pxi":128
 * 
 *         self._events = parser.read_events()
 *         self._parser = parser             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_INCREF((PyObject *)__pyx_v_parser);
  __Pyx_GIVEREF((PyObject *)__pyx_v_parser);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_parser);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_parser);
  __pyx_v_self->_parser = __pyx_v_parser;

  /* "src/lxml/iterparse.pxi":68
 *     cdef bint _close_source_after_read
 * 
 *     def __init__(self, source, events=("end",), *, tag=None,             # <<<<<<<<<<<<<<
 *                  attribute_defaults=False, dtd_validation=False,
 *                  load_dtd=False, no_network=True, remove_blank_text=False,
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("lxml.etree.iterparse.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_parser);
  __Pyx_XDECREF(__pyx_9genexpr17__pyx_v_event);
  __Pyx_XDECREF(__pyx_v_source);
  __Pyx_XDECREF(__pyx_v_events);
  __Pyx_XDECREF(__pyx_v_recover);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/iterparse.pxi":130
 *         self._parser = parser
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def error_log(self):
 *         """The error log of the last (or current) parser run.
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9iterparse_9error_log_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_9iterparse_9error_log_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_9iterparse_9error_log___get__(((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_9iterparse_9error_log___get__(struct __pyx_obj_4lxml_5etree_iterparse *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "src/lxml/iterparse.pxi":134
 *         """The error log of the last (or current) parser run.
 *         """
 *         return self._parser.feed_error_log             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_parser), __pyx_mstate_global->__pyx_n_u_feed_error_log); if (unlikely(!__pyx_t_1)) __PYX_ERR(14, 134, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/iterparse.pxi":130
 *         self._parser = parser
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def error_log(self):
 *         """The error log of the last (or current) parser run.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.iterparse.error_log.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/iterparse.pxi":136
 *         return self._parser.feed_error_log
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def resolvers(self):
 *         """The custom resolver registry of the last (or current) parser run.
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9iterparse_9resolvers_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_9iterparse_9resolvers_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_9iterparse_9resolvers___get__(((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_9iterparse_9resolvers___get__(struct __pyx_obj_4lxml_5etree_iterparse *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "src/lxml/iterparse.pxi":140
 *         """The custom resolver registry of the last (or current) parser run.
 *         """
 *         return self._parser.resolvers             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_parser), __pyx_mstate_global->__pyx_n_u_resolvers); if (unlikely(!__pyx_t_1)) __PYX_ERR(14, 140, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/iterparse.pxi":136
 *         return self._parser.feed_error_log
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def resolvers(self):
 *         """The custom resolver registry of the last (or current) parser run.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.iterparse.resolvers.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/iterparse.pxi":142
 *         return self._parser.resolvers
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def version(self):
 *         """The version of the underlying XML parser."""
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9iterparse_7version_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_9iterparse_7version_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_9iterparse_7version___get__(((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_9iterparse_7version___get__(struct __pyx_obj_4lxml_5etree_iterparse *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "src/lxml/iterparse.pxi":145
 *     def version(self):
 *         """The version of the underlying XML parser."""
 *         return self._parser.version             # <<<<<<<<<<<<<<
 * 
 *     def set_element_class_lookup(self, ElementClassLookup lookup = None):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_parser), __pyx_mstate_global->__pyx_n_u_version); if (unlikely(!__pyx_t_1)) __PYX_ERR(14, 145, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/iterparse.pxi":142
 *         return self._parser.resolvers
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def version(self):
 *         """The version of the underlying XML parser."""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.iterparse.version.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/iterparse.pxi":147
 *         return self._parser.version
 * 
 *     def set_element_class_lookup(self, ElementClassLookup lookup = None):             # <<<<<<<<<<<<<<
 *         """set_element_class_lookup(self, lookup = None)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9iterparse_3set_element_class_lookup(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_9iterparse_2set_element_class_lookup, "set_element_class_lookup(self, lookup = None)\n\n        Set a lookup scheme for element classes generated from this parser.\n\n        Reset it by passing None or nothing.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_9iterparse_3set_element_class_lookup = {"set_element_class_lookup", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_9iterparse_3set_element_class_lookup, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_9iterparse_2set_element_class_lookup};
static PyObject *__pyx_pw_4lxml_5etree_9iterparse_3set_element_class_lookup(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct LxmlElementClassLookup *__pyx_v_lookup = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_element_class_lookup (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_lookup,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(14, 147, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(14, 147, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "set_element_class_lookup", 0) < (0)) __PYX_ERR(14, 147, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef((PyObject *)((struct LxmlElementClassLookup *)Py_None));
    } else {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(14, 147, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef((PyObject *)((struct LxmlElementClassLookup *)Py_None));
    }
    __pyx_v_lookup = ((struct LxmlElementClassLookup *)values[0]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_element_class_lookup", 0, 0, 1, __pyx_nargs); __PYX_ERR(14, 147, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.iterparse.set_element_class_lookup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lookup), __pyx_mstate_global->__pyx_ptype_4lxml_5etree_ElementClassLookup, 1, "lookup", 0))) __PYX_ERR(14, 147, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_9iterparse_2set_element_class_lookup(((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self), __pyx_v_lookup);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_9iterparse_2set_element_class_lookup(struct __pyx_obj_4lxml_5etree_iterparse *__pyx_v_self, struct LxmlElementClassLookup *__pyx_v_lookup) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_element_class_lookup", 0);

  /* "src/lxml/iterparse.pxi":154
 *         Reset it by passing None or nothing.
 *         """
 *         self._parser.set_element_class_lookup(lookup)             # <<<<<<<<<<<<<<
 * 
 *     def makeelement(self, _tag, attrib=None, nsmap=None, **_extra):
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self->_parser);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, ((PyObject *)__pyx_v_lookup)};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_set_element_class_lookup, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(14, 154, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/iterparse.pxi":147
 *         return self._parser.version
 * 
 *     def set_element_class_lookup(self, ElementClassLookup lookup = None):             # <<<<<<<<<<<<<<
 *         """set_element_class_lookup(self, lookup = None)
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.iterparse.set_element_class_lookup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/iterparse.pxi":156
 *         self._parser.set_element_class_lookup(lookup)
 * 
 *     def makeelement(self, _tag, attrib=None, nsmap=None, **_extra):             # <<<<<<<<<<<<<<
 *         """makeelement(self, _tag, attrib=None, nsmap=None, **_extra)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9iterparse_5makeelement(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_9iterparse_4makeelement, "makeelement(self, _tag, attrib=None, nsmap=None, **_extra)\n\n        Creates a new element associated with this parser.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_9iterparse_5makeelement = {"makeelement", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_9iterparse_5makeelement, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_9iterparse_4makeelement};
static PyObject *__pyx_pw_4lxml_5etree_9iterparse_5makeelement(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v__tag = 0;
  CYTHON_UNUSED PyObject *__pyx_v_attrib = 0;
  CYTHON_UNUSED PyObject *__pyx_v_nsmap = 0;
  PyObject *__pyx_v__extra = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("makeelement (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  __pyx_v__extra = PyDict_New(); if (unlikely(!__pyx_v__extra)) return NULL;
  __Pyx_GOTREF(__pyx_v__extra);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_tag_2,&__pyx_mstate_global->__pyx_n_u_attrib,&__pyx_mstate_global->__pyx_n_u_nsmap,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(14, 156, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(14, 156, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(14, 156, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(14, 156, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v__extra, values, kwd_pos_args, __pyx_kwds_len, "makeelement", 1) < (0)) __PYX_ERR(14, 156, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("makeelement", 0, 1, 3, i); __PYX_ERR(14, 156, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(14, 156, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(14, 156, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(14, 156, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v__tag = values[0];
    __pyx_v_attrib = values[1];
    __pyx_v_nsmap = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("makeelement", 0, 1, 3, __pyx_nargs); __PYX_ERR(14, 156, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v__extra); __pyx_v__extra = 0;
  __Pyx_AddTraceback("lxml.etree.iterparse.makeelement", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_9iterparse_4makeelement(((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self), __pyx_v__tag, __pyx_v_attrib, __pyx_v_nsmap, __pyx_v__extra);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v__extra);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_9iterparse_4makeelement(struct __pyx_obj_4lxml_5etree_iterparse *__pyx_v_self, PyObject *__pyx_v__tag, CYTHON_UNUSED PyObject *__pyx_v_attrib, CYTHON_UNUSED PyObject *__pyx_v_nsmap, PyObject *__pyx_v__extra) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("makeelement", 0);

  /* "src/lxml/iterparse.pxi":161
 *         Creates a new element associated with this parser.
 *         """
 *         self._parser.makeelement(             # <<<<<<<<<<<<<<
 *             _tag, attrib=None, nsmap=None, **_extra)
 * 
*/
  __pyx_t_2 = NULL;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_parser), __pyx_mstate_global->__pyx_n_u_makeelement); if (unlikely(!__pyx_t_3)) __PYX_ERR(14, 161, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "src/lxml/iterparse.pxi":162
 *         """
 *         self._parser.makeelement(
 *             _tag, attrib=None, nsmap=None, **_extra)             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
*/
  __pyx_t_5 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(14, 162, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_attrib, Py_None) < (0)) __PYX_ERR(14, 162, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_nsmap, Py_None) < (0)) __PYX_ERR(14, 162, __pyx_L1_error)
  __pyx_t_4 = __pyx_t_5;
  __pyx_t_5 = 0;
  if (__Pyx_MergeKeywords(__pyx_t_4, __pyx_v__extra) < (0)) __PYX_ERR(14, 162, __pyx_L1_error)
  __pyx_t_6 = 1;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_6 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v__tag};
    __pyx_t_1 = __Pyx_PyObject_FastCallDict((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(14, 161, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/iterparse.pxi":156
 *         self._parser.set_element_class_lookup(lookup)
 * 
 *     def makeelement(self, _tag, attrib=None, nsmap=None, **_extra):             # <<<<<<<<<<<<<<
 *         """makeelement(self, _tag, attrib=None, nsmap=None, **_extra)
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree.iterparse.makeelement", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/iterparse.pxi":164
 *             _tag, attrib=None, nsmap=None, **_extra)
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef _close_source(self):
 *         if self._source is None:
*/

static PyObject *__pyx_f_4lxml_5etree_9iterparse__close_source(struct __pyx_obj_4lxml_5etree_iterparse *__pyx_v_self) {
  PyObject *__pyx_v_close = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  char const *__pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  size_t __pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_close_source", 0);

  /* "src/lxml/iterparse.pxi":166
 *     @cython.final
 *     cdef _close_source(self):
 *         if self._source is None:             # <<<<<<<<<<<<<<
 *             return
 *         if not self._close_source_after_read:
*/
  __pyx_t_1 = (__pyx_v_self->_source == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/iterparse.pxi":167
 *     cdef _close_source(self):
 *         if self._source is None:
 *             return             # <<<<<<<<<<<<<<
 *         if not self._close_source_after_read:
 *             self._source = None
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/iterparse.pxi":166
 *     @cython.final
 *     cdef _close_source(self):
 *         if self._source is None:             # <<<<<<<<<<<<<<
 *             return
 *         if not self._close_source_after_read:
*/
  }

  /* "src/lxml/iterparse.pxi":168
 *         if self._source is None:
 *             return
 *         if not self._close_source_after_read:             # <<<<<<<<<<<<<<
 *             self._source = None
 *             return
*/
  __pyx_t_1 = (!__pyx_v_self->_close_source_after_read);
  if (__pyx_t_1) {

    /* "src/lxml/iterparse.pxi":169
 *             return
 *         if not self._close_source_after_read:
 *             self._source = None             # <<<<<<<<<<<<<<
 *             return
 *         try:
*/
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_self->_source);
    __Pyx_DECREF(__pyx_v_self->_source);
    __pyx_v_self->_source = Py_None;

    /* "src/lxml/iterparse.pxi":170
 *         if not self._close_source_after_read:
 *             self._source = None
 *             return             # <<<<<<<<<<<<<<
 *         try:
 *             close = self._source.close
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/iterparse.pxi":168
 *         if self._source is None:
 *             return
 *         if not self._close_source_after_read:             # <<<<<<<<<<<<<<
 *             self._source = None
 *             return
*/
  }

  /* "src/lxml/iterparse.pxi":171
 *             self._source = None
 *             return
 *         try:             # <<<<<<<<<<<<<<
 *             close = self._source.close
 *         except AttributeError:
*/
  /*try:*/ {
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_4);
      /*try:*/ {

        /* "src/lxml/iterparse.pxi":172
 *             return
 *         try:
 *             close = self._source.close             # <<<<<<<<<<<<<<
 *         except AttributeError:
 *             close = None
*/
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_source, __pyx_mstate_global->__pyx_n_u_close); if (unlikely(!__pyx_t_5)) __PYX_ERR(14, 172, __pyx_L8_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_v_close = __pyx_t_5;
        __pyx_t_5 = 0;

        /* "src/lxml/iterparse.pxi":171
 *             self._source = None
 *             return
 *         try:             # <<<<<<<<<<<<<<
 *             close = self._source.close
 *         except AttributeError:
*/
      }
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L13_try_end;
      __pyx_L8_error:;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "src/lxml/iterparse.pxi":173
 *         try:
 *             close = self._source.close
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             close = None
 *         finally:
*/
      __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_AttributeError))));
      if (__pyx_t_6) {
        __Pyx_ErrRestore(0,0,0);

        /* "src/lxml/iterparse.pxi":174
 *             close = self._source.close
 *         except AttributeError:
 *             close = None             # <<<<<<<<<<<<<<
 *         finally:
 *             self._source = None
*/
        __Pyx_INCREF(Py_None);
        __Pyx_XDECREF_SET(__pyx_v_close, Py_None);
        goto __pyx_L9_exception_handled;
      }
      goto __pyx_L10_except_error;

      /* "src/lxml/iterparse.pxi":171
 *             self._source = None
 *             return
 *         try:             # <<<<<<<<<<<<<<
 *             close = self._source.close
 *         except AttributeError:
*/
      __pyx_L10_except_error:;
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
      goto __pyx_L6_error;
      __pyx_L9_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
      __pyx_L13_try_end:;
    }
  }

  /* "src/lxml/iterparse.pxi":176
 *             close = None
 *         finally:
 *             self._source = None             # <<<<<<<<<<<<<<
 *         if close is not None:
 *             close()
*/
  /*finally:*/ {
    /*normal exit:*/{
      __Pyx_INCREF(Py_None);
      __Pyx_GIVEREF(Py_None);
      __Pyx_GOTREF(__pyx_v_self->_source);
      __Pyx_DECREF(__pyx_v_self->_source);
      __pyx_v_self->_source = Py_None;
      goto __pyx_L7;
    }
    __pyx_L6_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      if ( unlikely(__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2) < 0)) __Pyx_ErrFetch(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __pyx_t_6 = __pyx_lineno; __pyx_t_7 = __pyx_clineno; __pyx_t_8 = __pyx_filename;
      {
        __Pyx_INCREF(Py_None);
        __Pyx_GIVEREF(Py_None);
        __Pyx_GOTREF(__pyx_v_self->_source);
        __Pyx_DECREF(__pyx_v_self->_source);
        __pyx_v_self->_source = Py_None;
      }
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_ErrRestore(__pyx_t_4, __pyx_t_3, __pyx_t_2);
      __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
      __pyx_lineno = __pyx_t_6; __pyx_clineno = __pyx_t_7; __pyx_filename = __pyx_t_8;
      goto __pyx_L1_error;
    }
    __pyx_L7:;
  }

  /* "src/lxml/iterparse.pxi":177
 *         finally:
 *             self._source = None
 *         if close is not None:             # <<<<<<<<<<<<<<
 *             close()
 * 
*/
  __pyx_t_1 = (__pyx_v_close != Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/iterparse.pxi":178
 *             self._source = None
 *         if close is not None:
 *             close()             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
*/
    __pyx_t_12 = NULL;
    __Pyx_INCREF(__pyx_v_close);
    __pyx_t_13 = __pyx_v_close; 
    __pyx_t_14 = 1;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_13))) {
      __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_13);
      assert(__pyx_t_12);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_13);
      __Pyx_INCREF(__pyx_t_12);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_13, __pyx__function);
      __pyx_t_14 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_12, NULL};
      __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_13, __pyx_callargs+__pyx_t_14, (1-__pyx_t_14) | (__pyx_t_14*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(14, 178, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "src/lxml/iterparse.pxi":177
 *         finally:
 *             self._source = None
 *         if close is not None:             # <<<<<<<<<<<<<<
 *             close()
 * 
*/
  }

  /* "src/lxml/iterparse.pxi":164
 *             _tag, attrib=None, nsmap=None, **_extra)
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef _close_source(self):
 *         if self._source is None:
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("lxml.etree.iterparse._close_source", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_close);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/iterparse.pxi":180
 *             close()
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9iterparse_7__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_9iterparse_7__iter__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_9iterparse_6__iter__(((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_9iterparse_6__iter__(struct __pyx_obj_4lxml_5etree_iterparse *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "src/lxml/iterparse.pxi":181
 * 
 *     def __iter__(self):
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __next__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "src/lxml/iterparse.pxi":180
 *             close()
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/iterparse.pxi":183
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         try:
 *             return next(self._events)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9iterparse_9__next__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_9iterparse_9__next__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_9iterparse_8__next__(((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_9iterparse_8__next__(struct __pyx_obj_4lxml_5etree_iterparse *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_context = NULL;
  int __pyx_v_done;
  PyObject *__pyx_v_e = NULL;
  PyObject *__pyx_v_error = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_error_without_exception = 0; /* StopIteration */
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_t_15;
  char const *__pyx_t_16;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  PyObject *__pyx_t_19 = NULL;
  int __pyx_t_20;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__next__", 0);

  /* "src/lxml/iterparse.pxi":184
 * 
 *     def __next__(self):
 *         try:             # <<<<<<<<<<<<<<
 *             return next(self._events)
 *         except StopIteration:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "src/lxml/iterparse.pxi":185
 *     def __next__(self):
 *         try:
 *             return next(self._events)             # <<<<<<<<<<<<<<
 *         except StopIteration:
 *             pass
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = __pyx_v_self->_events;
      __Pyx_INCREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyIter_Next(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(14, 185, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L7_try_return;

      /* "src/lxml/iterparse.pxi":184
 * 
 *     def __next__(self):
 *         try:             # <<<<<<<<<<<<<<
 *             return next(self._events)
 *         except StopIteration:
*/
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "src/lxml/iterparse.pxi":186
 *         try:
 *             return next(self._events)
 *         except StopIteration:             # <<<<<<<<<<<<<<
 *             pass
 *         context = <_SaxParserContext>self._parser._getPushParserContext()
*/
    __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_StopIteration))));
    if (__pyx_t_6) {
      __Pyx_ErrRestore(0,0,0);
      goto __pyx_L4_exception_handled;
    }
    goto __pyx_L5_except_error;

    /* "src/lxml/iterparse.pxi":184
 * 
 *     def __next__(self):
 *         try:             # <<<<<<<<<<<<<<
 *             return next(self._events)
 *         except StopIteration:
*/
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L7_try_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  }

  /* "src/lxml/iterparse.pxi":188
 *         except StopIteration:
 *             pass
 *         context = <_SaxParserContext>self._parser._getPushParserContext()             # <<<<<<<<<<<<<<
 *         if self._source is not None:
 *             done = False
*/
  __pyx_t_5 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__FeedParser *)__pyx_v_self->_parser->__pyx_base.__pyx_vtab)->__pyx_base._getPushParserContext(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self->_parser))); if (unlikely(!__pyx_t_5)) __PYX_ERR(14, 188, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __pyx_t_5;
  __Pyx_INCREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "src/lxml/iterparse.pxi":189
 *             pass
 *         context = <_SaxParserContext>self._parser._getPushParserContext()
 *         if self._source is not None:             # <<<<<<<<<<<<<<
 *             done = False
 *             while not done:
*/
  __pyx_t_7 = (__pyx_v_self->_source != Py_None);
  if (__pyx_t_7) {

    /* "src/lxml/iterparse.pxi":190
 *         context = <_SaxParserContext>self._parser._getPushParserContext()
 *         if self._source is not None:
 *             done = False             # <<<<<<<<<<<<<<
 *             while not done:
 *                 try:
*/
    __pyx_v_done = 0;

    /* "src/lxml/iterparse.pxi":191
 *         if self._source is not None:
 *             done = False
 *             while not done:             # <<<<<<<<<<<<<<
 *                 try:
 *                     done = self._read_more_events(context)
*/
    while (1) {
      __pyx_t_7 = (!__pyx_v_done);
      if (!__pyx_t_7) break;

      /* "src/lxml/iterparse.pxi":192
 *             done = False
 *             while not done:
 *                 try:             # <<<<<<<<<<<<<<
 *                     done = self._read_more_events(context)
 *                     return next(self._events)
*/
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1);
        __Pyx_XGOTREF(__pyx_t_3);
        __Pyx_XGOTREF(__pyx_t_2);
        __Pyx_XGOTREF(__pyx_t_1);
        /*try:*/ {

          /* "src/lxml/iterparse.pxi":193
 *             while not done:
 *                 try:
 *                     done = self._read_more_events(context)             # <<<<<<<<<<<<<<
 *                     return next(self._events)
 *                 except StopIteration:
*/
          __pyx_t_7 = __pyx_f_4lxml_5etree_9iterparse__read_more_events(__pyx_v_self, __pyx_v_context); if (unlikely(__pyx_t_7 == ((int)-123))) __PYX_ERR(14, 193, __pyx_L14_error)
          __pyx_v_done = __pyx_t_7;

          /* "src/lxml/iterparse.pxi":194
 *                 try:
 *                     done = self._read_more_events(context)
 *                     return next(self._events)             # <<<<<<<<<<<<<<
 *                 except StopIteration:
 *                     pass  # no events yet
*/
          __Pyx_XDECREF(__pyx_r);
          __pyx_t_4 = __pyx_v_self->_events;
          __Pyx_INCREF(__pyx_t_4);
          __pyx_t_5 = __Pyx_PyIter_Next(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(14, 194, __pyx_L14_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_r = __pyx_t_5;
          __pyx_t_5 = 0;
          goto __pyx_L18_try_return;

          /* "src/lxml/iterparse.pxi":192
 *             done = False
 *             while not done:
 *                 try:             # <<<<<<<<<<<<<<
 *                     done = self._read_more_events(context)
 *                     return next(self._events)
*/
        }
        __pyx_L14_error:;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "src/lxml/iterparse.pxi":195
 *                     done = self._read_more_events(context)
 *                     return next(self._events)
 *                 except StopIteration:             # <<<<<<<<<<<<<<
 *                     pass  # no events yet
 *                 except Exception as e:
*/
        __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_StopIteration))));
        if (__pyx_t_6) {
          __Pyx_ErrRestore(0,0,0);
          goto __pyx_L15_exception_handled;
        }

        /* "src/lxml/iterparse.pxi":197
 *                 except StopIteration:
 *                     pass  # no events yet
 *                 except Exception as e:             # <<<<<<<<<<<<<<
 *                     self._error = e
 *                     self._close_source()
*/
        __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception))));
        if (__pyx_t_6) {
          __Pyx_AddTraceback("lxml.etree.iterparse.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_8) < 0) __PYX_ERR(14, 197, __pyx_L16_except_error)
          __Pyx_XGOTREF(__pyx_t_5);
          __Pyx_XGOTREF(__pyx_t_4);
          __Pyx_XGOTREF(__pyx_t_8);
          __Pyx_INCREF(__pyx_t_4);
          __pyx_v_e = __pyx_t_4;
          /*try:*/ {

            /* "src/lxml/iterparse.pxi":198
 *                     pass  # no events yet
 *                 except Exception as e:
 *                     self._error = e             # <<<<<<<<<<<<<<
 *                     self._close_source()
 *                     try:
*/
            __Pyx_INCREF(__pyx_v_e);
            __Pyx_GIVEREF(__pyx_v_e);
            __Pyx_GOTREF(__pyx_v_self->_error);
            __Pyx_DECREF(__pyx_v_self->_error);
            __pyx_v_self->_error = __pyx_v_e;

            /* "src/lxml/iterparse.pxi":199
 *                 except Exception as e:
 *                     self._error = e
 *                     self._close_source()             # <<<<<<<<<<<<<<
 *                     try:
 *                         return next(self._events)
*/
            __pyx_t_9 = __pyx_f_4lxml_5etree_9iterparse__close_source(__pyx_v_self); if (unlikely(!__pyx_t_9)) __PYX_ERR(14, 199, __pyx_L29_error)
            __Pyx_GOTREF(__pyx_t_9);
            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

            /* "src/lxml/iterparse.pxi":200
 *                     self._error = e
 *                     self._close_source()
 *                     try:             # <<<<<<<<<<<<<<
 *                         return next(self._events)
 *                     except StopIteration:
*/
            {
              __Pyx_PyThreadState_declare
              __Pyx_PyThreadState_assign
              __Pyx_ExceptionSave(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
              __Pyx_XGOTREF(__pyx_t_10);
              __Pyx_XGOTREF(__pyx_t_11);
              __Pyx_XGOTREF(__pyx_t_12);
              /*try:*/ {

                /* "src/lxml/iterparse.pxi":201
 *                     self._close_source()
 *                     try:
 *                         return next(self._events)             # <<<<<<<<<<<<<<
 *                     except StopIteration:
 *                         break
*/
                __Pyx_XDECREF(__pyx_r);
                __pyx_t_9 = __pyx_v_self->_events;
                __Pyx_INCREF(__pyx_t_9);
                __pyx_t_13 = __Pyx_PyIter_Next(__pyx_t_9); if (unlikely(!__pyx_t_13)) __PYX_ERR(14, 201, __pyx_L31_error)
                __Pyx_GOTREF(__pyx_t_13);
                __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
                __pyx_r = __pyx_t_13;
                __pyx_t_13 = 0;
                __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
                __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
                __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
                goto __pyx_L35_try_return;

                /* "src/lxml/iterparse.pxi":200
 *                     self._error = e
 *                     self._close_source()
 *                     try:             # <<<<<<<<<<<<<<
 *                         return next(self._events)
 *                     except StopIteration:
*/
              }
              __pyx_L31_error:;
              __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
              __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

              /* "src/lxml/iterparse.pxi":202
 *                     try:
 *                         return next(self._events)
 *                     except StopIteration:             # <<<<<<<<<<<<<<
 *                         break
 *         # nothing left to read or return
*/
              __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_StopIteration))));
              if (__pyx_t_6) {
                __Pyx_AddTraceback("lxml.etree.iterparse.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
                if (__Pyx_GetException(&__pyx_t_13, &__pyx_t_9, &__pyx_t_14) < 0) __PYX_ERR(14, 202, __pyx_L33_except_error)
                __Pyx_XGOTREF(__pyx_t_13);
                __Pyx_XGOTREF(__pyx_t_9);
                __Pyx_XGOTREF(__pyx_t_14);

                /* "src/lxml/iterparse.pxi":203
 *                         return next(self._events)
 *                     except StopIteration:
 *                         break             # <<<<<<<<<<<<<<
 *         # nothing left to read or return
 *         if self._error is not None:
*/
                goto __pyx_L40_except_break;
                __pyx_L40_except_break:;
                __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
                __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
                __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
                goto __pyx_L36_try_break;
              }
              goto __pyx_L33_except_error;

              /* "src/lxml/iterparse.pxi":200
 *                     self._error = e
 *                     self._close_source()
 *                     try:             # <<<<<<<<<<<<<<
 *                         return next(self._events)
 *                     except StopIteration:
*/
              __pyx_L33_except_error:;
              __Pyx_XGIVEREF(__pyx_t_10);
              __Pyx_XGIVEREF(__pyx_t_11);
              __Pyx_XGIVEREF(__pyx_t_12);
              __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
              goto __pyx_L29_error;
              __pyx_L36_try_break:;
              __Pyx_XGIVEREF(__pyx_t_10);
              __Pyx_XGIVEREF(__pyx_t_11);
              __Pyx_XGIVEREF(__pyx_t_12);
              __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
              goto __pyx_L27_break;
              __pyx_L35_try_return:;
              __Pyx_XGIVEREF(__pyx_t_10);
              __Pyx_XGIVEREF(__pyx_t_11);
              __Pyx_XGIVEREF(__pyx_t_12);
              __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
              goto __pyx_L28_return;
            }
          }

          /* "src/lxml/iterparse.pxi":197
 *                 except StopIteration:
 *                     pass  # no events yet
 *                 except Exception as e:             # <<<<<<<<<<<<<<
 *                     self._error = e
 *                     self._close_source()
*/
          /*finally:*/ {
            __pyx_L29_error:;
            /*exception exit:*/{
              __Pyx_PyThreadState_declare
              __Pyx_PyThreadState_assign
              __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0;
              __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
              __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
              __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
               __Pyx_ExceptionSwap(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19);
              if ( unlikely(__Pyx_GetException(&__pyx_t_12, &__pyx_t_11, &__pyx_t_10) < 0)) __Pyx_ErrFetch(&__pyx_t_12, &__pyx_t_11, &__pyx_t_10);
              __Pyx_XGOTREF(__pyx_t_12);
              __Pyx_XGOTREF(__pyx_t_11);
              __Pyx_XGOTREF(__pyx_t_10);
              __Pyx_XGOTREF(__pyx_t_17);
              __Pyx_XGOTREF(__pyx_t_18);
              __Pyx_XGOTREF(__pyx_t_19);
              __pyx_t_6 = __pyx_lineno; __pyx_t_15 = __pyx_clineno; __pyx_t_16 = __pyx_filename;
              {
                __Pyx_DECREF(__pyx_v_e); __pyx_v_e = 0;
              }
              __Pyx_XGIVEREF(__pyx_t_17);
              __Pyx_XGIVEREF(__pyx_t_18);
              __Pyx_XGIVEREF(__pyx_t_19);
              __Pyx_ExceptionReset(__pyx_t_17, __pyx_t_18, __pyx_t_19);
              __Pyx_XGIVEREF(__pyx_t_12);
              __Pyx_XGIVEREF(__pyx_t_11);
              __Pyx_XGIVEREF(__pyx_t_10);
              __Pyx_ErrRestore(__pyx_t_12, __pyx_t_11, __pyx_t_10);
              __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0;
              __pyx_lineno = __pyx_t_6; __pyx_clineno = __pyx_t_15; __pyx_filename = __pyx_t_16;
              goto __pyx_L16_except_error;
            }
            __pyx_L27_break: {
              __Pyx_DECREF(__pyx_v_e); __pyx_v_e = 0;
              goto __pyx_L25_except_break;
            }
            __pyx_L28_return: {
              __pyx_t_19 = __pyx_r;
              __pyx_r = 0;
              __Pyx_DECREF(__pyx_v_e); __pyx_v_e = 0;
              __pyx_r = __pyx_t_19;
              __pyx_t_19 = 0;
              goto __pyx_L17_except_return;
            }
          }
          __pyx_L25_except_break:;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          goto __pyx_L19_try_break;
        }
        goto __pyx_L16_except_error;

        /* "src/lxml/iterparse.pxi":192
 *             done = False
 *             while not done:
 *                 try:             # <<<<<<<<<<<<<<
 *                     done = self._read_more_events(context)
 *                     return next(self._events)
*/
        __pyx_L16_except_error:;
        __Pyx_XGIVEREF(__pyx_t_3);
        __Pyx_XGIVEREF(__pyx_t_2);
        __Pyx_XGIVEREF(__pyx_t_1);
        __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1);
        goto __pyx_L1_error;
        __pyx_L19_try_break:;
        __Pyx_XGIVEREF(__pyx_t_3);
        __Pyx_XGIVEREF(__pyx_t_2);
        __Pyx_XGIVEREF(__pyx_t_1);
        __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1);
        goto __pyx_L13_break;
        __pyx_L18_try_return:;
        __Pyx_XGIVEREF(__pyx_t_3);
        __Pyx_XGIVEREF(__pyx_t_2);
        __Pyx_XGIVEREF(__pyx_t_1);
        __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1);
        goto __pyx_L0;
        __pyx_L17_except_return:;
        __Pyx_XGIVEREF(__pyx_t_3);
        __Pyx_XGIVEREF(__pyx_t_2);
        __Pyx_XGIVEREF(__pyx_t_1);
        __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1);
        goto __pyx_L0;
        __pyx_L15_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_3);
        __Pyx_XGIVEREF(__pyx_t_2);
        __Pyx_XGIVEREF(__pyx_t_1);
        __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1);
      }
    }
    __pyx_L13_break:;

    /* "src/lxml/iterparse.pxi":189
 *             pass
 *         context = <_SaxParserContext>self._parser._getPushParserContext()
 *         if self._source is not None:             # <<<<<<<<<<<<<<
 *             done = False
 *             while not done:
*/
  }

  /* "src/lxml/iterparse.pxi":205
 *                         break
 *         # nothing left to read or return
 *         if self._error is not None:             # <<<<<<<<<<<<<<
 *             error = self._error
 *             self._error = None
*/
  __pyx_t_7 = (__pyx_v_self->_error != Py_None);
  if (unlikely(__pyx_t_7)) {

    /* "src/lxml/iterparse.pxi":206
 *         # nothing left to read or return
 *         if self._error is not None:
 *             error = self._error             # <<<<<<<<<<<<<<
 *             self._error = None
 *             raise error
*/
    __pyx_t_8 = __pyx_v_self->_error;
    __Pyx_INCREF(__pyx_t_8);
    __pyx_v_error = __pyx_t_8;
    __pyx_t_8 = 0;

    /* "src/lxml/iterparse.pxi":207
 *         if self._error is not None:
 *             error = self._error
 *             self._error = None             # <<<<<<<<<<<<<<
 *             raise error
 *         if (context._validator is not None
*/
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_self->_error);
    __Pyx_DECREF(__pyx_v_self->_error);
    __pyx_v_self->_error = Py_None;

    /* "src/lxml/iterparse.pxi":208
 *             error = self._error
 *             self._error = None
 *             raise error             # <<<<<<<<<<<<<<
 *         if (context._validator is not None
 *                 and not context._validator.isvalid()):
*/
    __Pyx_Raise(__pyx_v_error, 0, 0, 0);
    __PYX_ERR(14, 208, __pyx_L1_error)

    /* "src/lxml/iterparse.pxi":205
 *                         break
 *         # nothing left to read or return
 *         if self._error is not None:             # <<<<<<<<<<<<<<
 *             error = self._error
 *             self._error = None
*/
  }

  /* "src/lxml/iterparse.pxi":209
 *             self._error = None
 *             raise error
 *         if (context._validator is not None             # <<<<<<<<<<<<<<
 *                 and not context._validator.isvalid()):
 *             _raiseParseError(context._c_ctxt, self._filename,
*/
  __pyx_t_20 = (((PyObject *)__pyx_v_context->__pyx_base._validator) != Py_None);
  if (__pyx_t_20) {
  } else {
    __pyx_t_7 = __pyx_t_20;
    goto __pyx_L47_bool_binop_done;
  }

  /* "src/lxml/iterparse.pxi":210
 *             raise error
 *         if (context._validator is not None
 *                 and not context._validator.isvalid()):             # <<<<<<<<<<<<<<
 *             _raiseParseError(context._c_ctxt, self._filename,
 *                              context._error_log)
*/
  __pyx_t_20 = (!__pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_isvalid(__pyx_v_context->__pyx_base._validator));
  __pyx_t_7 = __pyx_t_20;
  __pyx_L47_bool_binop_done:;

  /* "src/lxml/iterparse.pxi":209
 *             self._error = None
 *             raise error
 *         if (context._validator is not None             # <<<<<<<<<<<<<<
 *                 and not context._validator.isvalid()):
 *             _raiseParseError(context._c_ctxt, self._filename,
*/
  if (__pyx_t_7) {

    /* "src/lxml/iterparse.pxi":211
 *         if (context._validator is not None
 *                 and not context._validator.isvalid()):
 *             _raiseParseError(context._c_ctxt, self._filename,             # <<<<<<<<<<<<<<
 *                              context._error_log)
 *         # no errors => all done
*/
    __pyx_t_8 = __pyx_v_self->_filename;
    __Pyx_INCREF(__pyx_t_8);

    /* "src/lxml/iterparse.pxi":212
 *                 and not context._validator.isvalid()):
 *             _raiseParseError(context._c_ctxt, self._filename,
 *                              context._error_log)             # <<<<<<<<<<<<<<
 *         # no errors => all done
 *         raise StopIteration
*/
    __pyx_t_4 = ((PyObject *)__pyx_v_context->__pyx_base._error_log);
    __Pyx_INCREF(__pyx_t_4);

    /* "src/lxml/iterparse.pxi":211
 *         if (context._validator is not None
 *                 and not context._validator.isvalid()):
 *             _raiseParseError(context._c_ctxt, self._filename,             # <<<<<<<<<<<<<<
 *                              context._error_log)
 *         # no errors => all done
*/
    __pyx_t_15 = __pyx_f_4lxml_5etree__raiseParseError(__pyx_v_context->__pyx_base._c_ctxt, __pyx_t_8, ((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_t_4)); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(14, 211, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "src/lxml/iterparse.pxi":209
 *             self._error = None
 *             raise error
 *         if (context._validator is not None             # <<<<<<<<<<<<<<
 *                 and not context._validator.isvalid()):
 *             _raiseParseError(context._c_ctxt, self._filename,
*/
  }

  /* "src/lxml/iterparse.pxi":214
 *                              context._error_log)
 *         # no errors => all done
 *         raise StopIteration             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
*/
  __pyx_error_without_exception = 1;
  goto __pyx_L1_error;;

  /* "src/lxml/iterparse.pxi":183
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         try:
 *             return next(self._events)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  if (!__pyx_error_without_exception) {
    __Pyx_AddTraceback("lxml.etree.iterparse.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_e);
  __Pyx_XDECREF(__pyx_v_error);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/iterparse.pxi":216
 *         raise StopIteration
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef bint _read_more_events(self, _SaxParserContext context) except -123:
 *         data = self._source.read(__ITERPARSE_CHUNK_SIZE)
*/

static int __pyx_f_4lxml_5etree_9iterparse__read_more_events(struct __pyx_obj_4lxml_5etree_iterparse *__pyx_v_self, CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_context) {
  PyObject *__pyx_v_data = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  char const *__pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_read_more_events", 0);

  /* "src/lxml/iterparse.pxi":218
 *     @cython.final
 *     cdef bint _read_more_events(self, _SaxParserContext context) except -123:
 *         data = self._source.read(__ITERPARSE_CHUNK_SIZE)             # <<<<<<<<<<<<<<
 *         if not isinstance(data, bytes):
 *             self._close_source()
*/
  __pyx_t_2 = __pyx_v_self->_source;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_int_32768};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_read, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(14, 218, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v_data = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "src/lxml/iterparse.pxi":219
 *     cdef bint _read_more_events(self, _SaxParserContext context) except -123:
 *         data = self._source.read(__ITERPARSE_CHUNK_SIZE)
 *         if not isinstance(data, bytes):             # <<<<<<<<<<<<<<
 *             self._close_source()
 *             raise TypeError("reading file objects must return bytes objects")
*/
  __pyx_t_4 = PyBytes_Check(__pyx_v_data); 
  __pyx_t_5 = (!__pyx_t_4);
  if (unlikely(__pyx_t_5)) {

    /* "src/lxml/iterparse.pxi":220
 *         data = self._source.read(__ITERPARSE_CHUNK_SIZE)
 *         if not isinstance(data, bytes):
 *             self._close_source()             # <<<<<<<<<<<<<<
 *             raise TypeError("reading file objects must return bytes objects")
 *         if not data:
*/
    __pyx_t_1 = __pyx_f_4lxml_5etree_9iterparse__close_source(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(14, 220, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "src/lxml/iterparse.pxi":221
 *         if not isinstance(data, bytes):
 *             self._close_source()
 *             raise TypeError("reading file objects must return bytes objects")             # <<<<<<<<<<<<<<
 *         if not data:
 *             try:
*/
    __pyx_t_2 = NULL;
    __pyx_t_3 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_reading_file_objects_must_return};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(14, 221, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(14, 221, __pyx_L1_error)

    /* "src/lxml/iterparse.pxi":219
 *     cdef bint _read_more_events(self, _SaxParserContext context) except -123:
 *         data = self._source.read(__ITERPARSE_CHUNK_SIZE)
 *         if not isinstance(data, bytes):             # <<<<<<<<<<<<<<
 *             self._close_source()
 *             raise TypeError("reading file objects must return bytes objects")
*/
  }

  /* "src/lxml/iterparse.pxi":222
 *             self._close_source()
 *             raise TypeError("reading file objects must return bytes objects")
 *         if not data:             # <<<<<<<<<<<<<<
 *             try:
 *                 self.root = self._parser.close()
*/
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_data); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(14, 222, __pyx_L1_error)
  __pyx_t_4 = (!__pyx_t_5);
  if (__pyx_t_4) {

    /* "src/lxml/iterparse.pxi":223
 *             raise TypeError("reading file objects must return bytes objects")
 *         if not data:
 *             try:             # <<<<<<<<<<<<<<
 *                 self.root = self._parser.close()
 *             finally:
*/
    /*try:*/ {

      /* "src/lxml/iterparse.pxi":224
 *         if not data:
 *             try:
 *                 self.root = self._parser.close()             # <<<<<<<<<<<<<<
 *             finally:
 *                 self._close_source()
*/
      __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__FeedParser *)__pyx_v_self->_parser->__pyx_base.__pyx_vtab)->close(__pyx_v_self->_parser, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(14, 224, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_v_self->root);
      __Pyx_DECREF(__pyx_v_self->root);
      __pyx_v_self->root = __pyx_t_1;
      __pyx_t_1 = 0;
    }

    /* "src/lxml/iterparse.pxi":226
 *                 self.root = self._parser.close()
 *             finally:
 *                 self._close_source()             # <<<<<<<<<<<<<<
 *             return True
 *         self._parser.feed(data)
*/
    /*finally:*/ {
      /*normal exit:*/{
        __pyx_t_1 = __pyx_f_4lxml_5etree_9iterparse__close_source(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(14, 226, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L7;
      }
      __pyx_L6_error:;
      /*exception exit:*/{
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
         __Pyx_ExceptionSwap(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
        if ( unlikely(__Pyx_GetException(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11) < 0)) __Pyx_ErrFetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
        __Pyx_XGOTREF(__pyx_t_9);
        __Pyx_XGOTREF(__pyx_t_10);
        __Pyx_XGOTREF(__pyx_t_11);
        __Pyx_XGOTREF(__pyx_t_12);
        __Pyx_XGOTREF(__pyx_t_13);
        __Pyx_XGOTREF(__pyx_t_14);
        __pyx_t_6 = __pyx_lineno; __pyx_t_7 = __pyx_clineno; __pyx_t_8 = __pyx_filename;
        {
          __pyx_t_1 = __pyx_f_4lxml_5etree_9iterparse__close_source(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(14, 226, __pyx_L9_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        }
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_ErrRestore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
        __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
        __pyx_lineno = __pyx_t_6; __pyx_clineno = __pyx_t_7; __pyx_filename = __pyx_t_8;
        goto __pyx_L1_error;
        __pyx_L9_error:;
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
        goto __pyx_L1_error;
      }
      __pyx_L7:;
    }

    /* "src/lxml/iterparse.pxi":227
 *             finally:
 *                 self._close_source()
 *             return True             # <<<<<<<<<<<<<<
 *         self._parser.feed(data)
 *         return False
*/
    __pyx_r = 1;
    goto __pyx_L0;

    /* "src/lxml/iterparse.pxi":222
 *             self._close_source()
 *             raise TypeError("reading file objects must return bytes objects")
 *         if not data:             # <<<<<<<<<<<<<<
 *             try:
 *                 self.root = self._parser.close()
*/
  }

  /* "src/lxml/iterparse.pxi":228
 *                 self._close_source()
 *             return True
 *         self._parser.feed(data)             # <<<<<<<<<<<<<<
 *         return False
 * 
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__FeedParser *)__pyx_v_self->_parser->__pyx_base.__pyx_vtab)->feed(__pyx_v_self->_parser, __pyx_v_data, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(14, 228, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/iterparse.pxi":229
 *             return True
 *         self._parser.feed(data)
 *         return False             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/iterparse.pxi":216
 *         raise StopIteration
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef bint _read_more_events(self, _SaxParserContext context) except -123:
 *         data = self._source.read(__ITERPARSE_CHUNK_SIZE)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.iterparse._read_more_events", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -123;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_data);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/iterparse.pxi":62
 *     cdef object _tag
 *     cdef object _events
 *     cdef readonly object root             # <<<<<<<<<<<<<<
 *     cdef object _source
 *     cdef object _filename
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9iterparse_4root_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_9iterparse_4root_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_9iterparse_4root___get__(((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_9iterparse_4root___get__(struct __pyx_obj_4lxml_5etree_iterparse *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->root);
  __pyx_r = __pyx_v_self->root;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/iterparse.pxi":261
 *     cdef _IterwalkSkipStates _skip_state
 * 
 *     def __init__(self, element_or_tree, events=("end",), tag=None):             # <<<<<<<<<<<<<<
 *         cdef _Element root
 *         cdef int ns_count
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_8iterwalk_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_8iterwalk_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_element_or_tree = 0;
  PyObject *__pyx_v_events = 0;
  PyObject *__pyx_v_tag = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_element_or_tree,&__pyx_mstate_global->__pyx_n_u_events,&__pyx_mstate_global->__pyx_n_u_tag,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(14, 261, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(14, 261, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(14, 261, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(14, 261, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(14, 261, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_tuple[6]));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 3, i); __PYX_ERR(14, 261, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(14, 261, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(14, 261, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(14, 261, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_tuple[6]));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_element_or_tree = values[0];
    __pyx_v_events = values[1];
    __pyx_v_tag = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 3, __pyx_nargs); __PYX_ERR(14, 261, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.iterwalk.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_8iterwalk___init__(((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self), __pyx_v_element_or_tree, __pyx_v_events, __pyx_v_tag);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_8iterwalk___init__(struct __pyx_obj_4lxml_5etree_iterwalk *__pyx_v_self, PyObject *__pyx_v_element_or_tree, PyObject *__pyx_v_events, PyObject *__pyx_v_tag) {
  struct LxmlElement *__pyx_v_root = 0;
  int __pyx_v_ns_count;
  PyObject *__pyx_v_elem = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  Py_ssize_t __pyx_t_8;
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "src/lxml/iterparse.pxi":264
 *         cdef _Element root
 *         cdef int ns_count
 *         root = _rootNodeOrRaise(element_or_tree)             # <<<<<<<<<<<<<<
 *         self._event_filter = _buildParseEventFilter(events)
 *         if tag is None or tag == '*':
*/
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__rootNodeOrRaise(__pyx_v_element_or_tree)); if (unlikely(!__pyx_t_1)) __PYX_ERR(14, 264, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_root = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/iterparse.pxi":265
 *         cdef int ns_count
 *         root = _rootNodeOrRaise(element_or_tree)
 *         self._event_filter = _buildParseEventFilter(events)             # <<<<<<<<<<<<<<
 *         if tag is None or tag == '*':
 *             self._matcher = None
*/
  __pyx_t_2 = __pyx_f_4lxml_5etree__buildParseEventFilter(__pyx_v_events); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(14, 265, __pyx_L1_error)
  __pyx_v_self->_event_filter = __pyx_t_2;

  /* "src/lxml/iterparse.pxi":266
 *         root = _rootNodeOrRaise(element_or_tree)
 *         self._event_filter = _buildParseEventFilter(events)
 *         if tag is None or tag == '*':             # <<<<<<<<<<<<<<
 *             self._matcher = None
 *         else:
*/
  __pyx_t_4 = (__pyx_v_tag == Py_None);
  if (!__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_v_tag, __pyx_mstate_global->__pyx_kp_u__24, Py_EQ)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(14, 266, __pyx_L1_error)
  __pyx_t_3 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_3) {

    /* "src/lxml/iterparse.pxi":267
 *         self._event_filter = _buildParseEventFilter(events)
 *         if tag is None or tag == '*':
 *             self._matcher = None             # <<<<<<<<<<<<<<
 *         else:
 *             self._matcher = _MultiTagMatcher.__new__(_MultiTagMatcher, tag)
*/
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF((PyObject *)__pyx_v_self->_matcher);
    __Pyx_DECREF((PyObject *)__pyx_v_self->_matcher);
    __pyx_v_self->_matcher = ((struct __pyx_obj_4lxml_5etree__MultiTagMatcher *)Py_None);

    /* "src/lxml/iterparse.pxi":266
 *         root = _rootNodeOrRaise(element_or_tree)
 *         self._event_filter = _buildParseEventFilter(events)
 *         if tag is None or tag == '*':             # <<<<<<<<<<<<<<
 *             self._matcher = None
 *         else:
*/
    goto __pyx_L3;
  }

  /* "src/lxml/iterparse.pxi":269
 *             self._matcher = None
 *         else:
 *             self._matcher = _MultiTagMatcher.__new__(_MultiTagMatcher, tag)             # <<<<<<<<<<<<<<
 *         self._node_stack  = []
 *         self._events = []
*/
  /*else*/ {
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(14, 269, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v_tag);
    __Pyx_GIVEREF(__pyx_v_tag);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_tag) != (0)) __PYX_ERR(14, 269, __pyx_L1_error);
    __pyx_t_5 = ((PyObject *)__pyx_tp_new_4lxml_5etree__MultiTagMatcher(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__MultiTagMatcher), __pyx_t_1, NULL)); if (unlikely(!__pyx_t_5)) __PYX_ERR(14, 269, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GIVEREF((PyObject *)__pyx_t_5);
    __Pyx_GOTREF((PyObject *)__pyx_v_self->_matcher);
    __Pyx_DECREF((PyObject *)__pyx_v_self->_matcher);
    __pyx_v_self->_matcher = ((struct __pyx_obj_4lxml_5etree__MultiTagMatcher *)__pyx_t_5);
    __pyx_t_5 = 0;
  }
  __pyx_L3:;

  /* "src/lxml/iterparse.pxi":270
 *         else:
 *             self._matcher = _MultiTagMatcher.__new__(_MultiTagMatcher, tag)
 *         self._node_stack  = []             # <<<<<<<<<<<<<<
 *         self._events = []
 *         self._pop_event = self._events.pop
*/
  __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(14, 270, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __Pyx_GOTREF(__pyx_v_self->_node_stack);
  __Pyx_DECREF(__pyx_v_self->_node_stack);
  __pyx_v_self->_node_stack = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "src/lxml/iterparse.pxi":271
 *             self._matcher = _MultiTagMatcher.__new__(_MultiTagMatcher, tag)
 *         self._node_stack  = []
 *         self._events = []             # <<<<<<<<<<<<<<
 *         self._pop_event = self._events.pop
 *         self._skip_state = IWSKIP_CANNOT_SKIP  # ignore all skip requests by default
*/
  __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(14, 271, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __Pyx_GOTREF(__pyx_v_self->_events);
  __Pyx_DECREF(__pyx_v_self->_events);
  __pyx_v_self->_events = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "src/lxml/iterparse.pxi":272
 *         self._node_stack  = []
 *         self._events = []
 *         self._pop_event = self._events.pop             # <<<<<<<<<<<<<<
 *         self._skip_state = IWSKIP_CANNOT_SKIP  # ignore all skip requests by default
 * 
*/
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_events, __pyx_mstate_global->__pyx_n_u_pop); if (unlikely(!__pyx_t_5)) __PYX_ERR(14, 272, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __Pyx_GOTREF(__pyx_v_self->_pop_event);
  __Pyx_DECREF(__pyx_v_self->_pop_event);
  __pyx_v_self->_pop_event = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "src/lxml/iterparse.pxi":273
 *         self._events = []
 *         self._pop_event = self._events.pop
 *         self._skip_state = IWSKIP_CANNOT_SKIP  # ignore all skip requests by default             # <<<<<<<<<<<<<<
 * 
 *         if self._event_filter:
*/
  __pyx_v_self->_skip_state = __pyx_e_4lxml_5etree_IWSKIP_CANNOT_SKIP;

  /* "src/lxml/iterparse.pxi":275
 *         self._skip_state = IWSKIP_CANNOT_SKIP  # ignore all skip requests by default
 * 
 *         if self._event_filter:             # <<<<<<<<<<<<<<
 *             self._index = 0
 *             if self._matcher is not None and self._event_filter & PARSE_EVENT_FILTER_START:
*/
  __pyx_t_3 = (__pyx_v_self->_event_filter != 0);
  if (__pyx_t_3) {

    /* "src/lxml/iterparse.pxi":276
 * 
 *         if self._event_filter:
 *             self._index = 0             # <<<<<<<<<<<<<<
 *             if self._matcher is not None and self._event_filter & PARSE_EVENT_FILTER_START:
 *                 self._matcher.cacheTags(root._doc)
*/
    __pyx_v_self->_index = 0;

    /* "src/lxml/iterparse.pxi":277
 *         if self._event_filter:
 *             self._index = 0
 *             if self._matcher is not None and self._event_filter & PARSE_EVENT_FILTER_START:             # <<<<<<<<<<<<<<
 *                 self._matcher.cacheTags(root._doc)
 * 
*/
    __pyx_t_4 = (((PyObject *)__pyx_v_self->_matcher) != Py_None);
    if (__pyx_t_4) {
    } else {
      __pyx_t_3 = __pyx_t_4;
      goto __pyx_L8_bool_binop_done;
    }
    __pyx_t_4 = ((__pyx_v_self->_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_START) != 0);
    __pyx_t_3 = __pyx_t_4;
    __pyx_L8_bool_binop_done:;
    if (__pyx_t_3) {

      /* "src/lxml/iterparse.pxi":278
 *             self._index = 0
 *             if self._matcher is not None and self._event_filter & PARSE_EVENT_FILTER_START:
 *                 self._matcher.cacheTags(root._doc)             # <<<<<<<<<<<<<<
 * 
 *             # When processing an ElementTree, add events for the preceding comments/PIs.
*/
      __pyx_t_5 = ((PyObject *)__pyx_v_root->_doc);
      __Pyx_INCREF(__pyx_t_5);
      __pyx_t_2 = __pyx_f_4lxml_5etree_16_MultiTagMatcher_cacheTags(__pyx_v_self->_matcher, ((struct LxmlDocument *)__pyx_t_5), NULL); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(14, 278, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "src/lxml/iterparse.pxi":277
 *         if self._event_filter:
 *             self._index = 0
 *             if self._matcher is not None and self._event_filter & PARSE_EVENT_FILTER_START:             # <<<<<<<<<<<<<<
 *                 self._matcher.cacheTags(root._doc)
 * 
*/
    }

    /* "src/lxml/iterparse.pxi":281
 * 
 *             # When processing an ElementTree, add events for the preceding comments/PIs.
 *             if self._event_filter & (PARSE_EVENT_FILTER_COMMENT | PARSE_EVENT_FILTER_PI):             # <<<<<<<<<<<<<<
 *                 if isinstance(element_or_tree, _ElementTree):
 *                     self._include_siblings = root
*/
    __pyx_t_3 = ((__pyx_v_self->_event_filter & (__pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_COMMENT | __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_PI)) != 0);
    if (__pyx_t_3) {

      /* "src/lxml/iterparse.pxi":282
 *             # When processing an ElementTree, add events for the preceding comments/PIs.
 *             if self._event_filter & (PARSE_EVENT_FILTER_COMMENT | PARSE_EVENT_FILTER_PI):
 *                 if isinstance(element_or_tree, _ElementTree):             # <<<<<<<<<<<<<<
 *                     self._include_siblings = root
 *                     for elem in list(root.itersiblings(preceding=True))[::-1]:
*/
      __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_element_or_tree, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ElementTree); 
      if (__pyx_t_3) {

        /* "src/lxml/iterparse.pxi":283
 *             if self._event_filter & (PARSE_EVENT_FILTER_COMMENT | PARSE_EVENT_FILTER_PI):
 *                 if isinstance(element_or_tree, _ElementTree):
 *                     self._include_siblings = root             # <<<<<<<<<<<<<<
 *                     for elem in list(root.itersiblings(preceding=True))[::-1]:
 *                         if self._event_filter & PARSE_EVENT_FILTER_COMMENT and elem.tag is Comment:
*/
        __Pyx_INCREF((PyObject *)__pyx_v_root);
        __Pyx_GIVEREF((PyObject *)__pyx_v_root);
        __Pyx_GOTREF(__pyx_v_self->_include_siblings);
        __Pyx_DECREF(__pyx_v_self->_include_siblings);
        __pyx_v_self->_include_siblings = ((PyObject *)__pyx_v_root);

        /* "src/lxml/iterparse.pxi":284
 *                 if isinstance(element_or_tree, _ElementTree):
 *                     self._include_siblings = root
 *                     for elem in list(root.itersiblings(preceding=True))[::-1]:             # <<<<<<<<<<<<<<
 *                         if self._event_filter & PARSE_EVENT_FILTER_COMMENT and elem.tag is Comment:
 *                             self._events.append(('comment', elem))
*/
        __pyx_t_1 = ((PyObject *)__pyx_v_root);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_6 = 0;
        {
          PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_1, NULL};
          __pyx_t_7 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(14, 284, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_preceding, Py_True, __pyx_t_7, __pyx_callargs+1, 0) < (0)) __PYX_ERR(14, 284, __pyx_L1_error)
          __pyx_t_5 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_itersiblings, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_7);
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (unlikely(!__pyx_t_5)) __PYX_ERR(14, 284, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
        }
        __pyx_t_7 = __Pyx_PySequence_ListKeepNew(__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(14, 284, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_7, __pyx_mstate_global->__pyx_slice[6]); if (unlikely(!__pyx_t_5)) __PYX_ERR(14, 284, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = __pyx_t_5; __Pyx_INCREF(__pyx_t_7);
        __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        for (;;) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_7);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(14, 284, __pyx_L1_error)
            #endif
            if (__pyx_t_8 >= __pyx_temp) break;
          }
          __pyx_t_5 = __Pyx_PyList_GetItemRefFast(__pyx_t_7, __pyx_t_8, __Pyx_ReferenceSharing_OwnStrongReference);
          ++__pyx_t_8;
          if (unlikely(!__pyx_t_5)) __PYX_ERR(14, 284, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_XDECREF_SET(__pyx_v_elem, __pyx_t_5);
          __pyx_t_5 = 0;

          /* "src/lxml/iterparse.pxi":285
 *                     self._include_siblings = root
 *                     for elem in list(root.itersiblings(preceding=True))[::-1]:
 *                         if self._event_filter & PARSE_EVENT_FILTER_COMMENT and elem.tag is Comment:             # <<<<<<<<<<<<<<
 *                             self._events.append(('comment', elem))
 *                         elif self._event_filter & PARSE_EVENT_FILTER_PI and elem.tag is PI:
*/
          __pyx_t_4 = ((__pyx_v_self->_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_COMMENT) != 0);
          if (__pyx_t_4) {
          } else {
            __pyx_t_3 = __pyx_t_4;
            goto __pyx_L15_bool_binop_done;
          }
          __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_elem, __pyx_mstate_global->__pyx_n_u_tag); if (unlikely(!__pyx_t_5)) __PYX_ERR(14, 285, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_Comment); if (unlikely(!__pyx_t_1)) __PYX_ERR(14, 285, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_4 = (__pyx_t_5 == __pyx_t_1);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_3 = __pyx_t_4;
          __pyx_L15_bool_binop_done:;
          if (__pyx_t_3) {

            /* "src/lxml/iterparse.pxi":286
 *                     for elem in list(root.itersiblings(preceding=True))[::-1]:
 *                         if self._event_filter & PARSE_EVENT_FILTER_COMMENT and elem.tag is Comment:
 *                             self._events.append(('comment', elem))             # <<<<<<<<<<<<<<
 *                         elif self._event_filter & PARSE_EVENT_FILTER_PI and elem.tag is PI:
 *                             self._events.append(('pi', elem))
*/
            if (unlikely(__pyx_v_self->_events == Py_None)) {
              PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
              __PYX_ERR(14, 286, __pyx_L1_error)
            }
            __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(14, 286, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_comment);
            __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_comment);
            if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_mstate_global->__pyx_n_u_comment) != (0)) __PYX_ERR(14, 286, __pyx_L1_error);
            __Pyx_INCREF(__pyx_v_elem);
            __Pyx_GIVEREF(__pyx_v_elem);
            if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_elem) != (0)) __PYX_ERR(14, 286, __pyx_L1_error);
            __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_self->_events, __pyx_t_1); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(14, 286, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

            /* "src/lxml/iterparse.pxi":285
 *                     self._include_siblings = root
 *                     for elem in list(root.itersiblings(preceding=True))[::-1]:
 *                         if self._event_filter & PARSE_EVENT_FILTER_COMMENT and elem.tag is Comment:             # <<<<<<<<<<<<<<
 *                             self._events.append(('comment', elem))
 *                         elif self._event_filter & PARSE_EVENT_FILTER_PI and elem.tag is PI:
*/
            goto __pyx_L14;
          }

          /* "src/lxml/iterparse.pxi":287
 *                         if self._event_filter & PARSE_EVENT_FILTER_COMMENT and elem.tag is Comment:
 *                             self._events.append(('comment', elem))
 *                         elif self._event_filter & PARSE_EVENT_FILTER_PI and elem.tag is PI:             # <<<<<<<<<<<<<<
 *                             self._events.append(('pi', elem))
 * 
*/
          __pyx_t_4 = ((__pyx_v_self->_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_PI) != 0);
          if (__pyx_t_4) {
          } else {
            __pyx_t_3 = __pyx_t_4;
            goto __pyx_L17_bool_binop_done;
          }
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_elem, __pyx_mstate_global->__pyx_n_u_tag); if (unlikely(!__pyx_t_1)) __PYX_ERR(14, 287, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_PI); if (unlikely(!__pyx_t_5)) __PYX_ERR(14, 287, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_4 = (__pyx_t_1 == __pyx_t_5);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __pyx_t_3 = __pyx_t_4;
          __pyx_L17_bool_binop_done:;
          if (__pyx_t_3) {

            /* "src/lxml/iterparse.pxi":288
 *                             self._events.append(('comment', elem))
 *                         elif self._event_filter & PARSE_EVENT_FILTER_PI and elem.tag is PI:
 *                             self._events.append(('pi', elem))             # <<<<<<<<<<<<<<
 * 
 *             ns_count = self._start_node(root)
*/
            if (unlikely(__pyx_v_self->_events == Py_None)) {
              PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
              __PYX_ERR(14, 288, __pyx_L1_error)
            }
            __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(14, 288, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_5);
            __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_pi);
            __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_pi);
            if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_mstate_global->__pyx_n_u_pi) != (0)) __PYX_ERR(14, 288, __pyx_L1_error);
            __Pyx_INCREF(__pyx_v_elem);
            __Pyx_GIVEREF(__pyx_v_elem);
            if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_elem) != (0)) __PYX_ERR(14, 288, __pyx_L1_error);
            __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_self->_events, __pyx_t_5); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(14, 288, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

            /* "src/lxml/iterparse.pxi":287
 *                         if self._event_filter & PARSE_EVENT_FILTER_COMMENT and elem.tag is Comment:
 *                             self._events.append(('comment', elem))
 *                         elif self._event_filter & PARSE_EVENT_FILTER_PI and elem.tag is PI:             # <<<<<<<<<<<<<<
 *                             self._events.append(('pi', elem))
 * 
*/
          }
          __pyx_L14:;

          /* "src/lxml/iterparse.pxi":284
 *                 if isinstance(element_or_tree, _ElementTree):
 *                     self._include_siblings = root
 *                     for elem in list(root.itersiblings(preceding=True))[::-1]:             # <<<<<<<<<<<<<<
 *                         if self._event_filter & PARSE_EVENT_FILTER_COMMENT and elem.tag is Comment:
 *                             self._events.append(('comment', elem))
*/
        }
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

        /* "src/lxml/iterparse.pxi":282
 *             # When processing an ElementTree, add events for the preceding comments/PIs.
 *             if self._event_filter & (PARSE_EVENT_FILTER_COMMENT | PARSE_EVENT_FILTER_PI):
 *                 if isinstance(element_or_tree, _ElementTree):             # <<<<<<<<<<<<<<
 *                     self._include_siblings = root
 *                     for elem in list(root.itersiblings(preceding=True))[::-1]:
*/
      }

      /* "src/lxml/iterparse.pxi":281
 * 
 *             # When processing an ElementTree, add events for the preceding comments/PIs.
 *             if self._event_filter & (PARSE_EVENT_FILTER_COMMENT | PARSE_EVENT_FILTER_PI):             # <<<<<<<<<<<<<<
 *                 if isinstance(element_or_tree, _ElementTree):
 *                     self._include_siblings = root
*/
    }

    /* "src/lxml/iterparse.pxi":290
 *                             self._events.append(('pi', elem))
 * 
 *             ns_count = self._start_node(root)             # <<<<<<<<<<<<<<
 *             self._node_stack.append( (root, ns_count) )
 *         else:
*/
    __pyx_t_2 = __pyx_f_4lxml_5etree_8iterwalk__start_node(__pyx_v_self, __pyx_v_root); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(14, 290, __pyx_L1_error)
    __pyx_v_ns_count = __pyx_t_2;

    /* "src/lxml/iterparse.pxi":291
 * 
 *             ns_count = self._start_node(root)
 *             self._node_stack.append( (root, ns_count) )             # <<<<<<<<<<<<<<
 *         else:
 *             self._index = -1
*/
    if (unlikely(__pyx_v_self->_node_stack == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
      __PYX_ERR(14, 291, __pyx_L1_error)
    }
    __pyx_t_7 = __Pyx_PyLong_From_int(__pyx_v_ns_count); if (unlikely(!__pyx_t_7)) __PYX_ERR(14, 291, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(14, 291, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF((PyObject *)__pyx_v_root);
    __Pyx_GIVEREF((PyObject *)__pyx_v_root);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_root)) != (0)) __PYX_ERR(14, 291, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_7);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_7) != (0)) __PYX_ERR(14, 291, __pyx_L1_error);
    __pyx_t_7 = 0;
    __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_self->_node_stack, __pyx_t_5); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(14, 291, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "src/lxml/iterparse.pxi":275
 *         self._skip_state = IWSKIP_CANNOT_SKIP  # ignore all skip requests by default
 * 
 *         if self._event_filter:             # <<<<<<<<<<<<<<
 *             self._index = 0
 *             if self._matcher is not None and self._event_filter & PARSE_EVENT_FILTER_START:
*/
    goto __pyx_L6;
  }

  /* "src/lxml/iterparse.pxi":293
 *             self._node_stack.append( (root, ns_count) )
 *         else:
 *             self._index = -1             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
*/
  /*else*/ {
    __pyx_v_self->_index = -1;
  }
  __pyx_L6:;

  /* "src/lxml/iterparse.pxi":261
 *     cdef _IterwalkSkipStates _skip_state
 * 
 *     def __init__(self, element_or_tree, events=("end",), tag=None):             # <<<<<<<<<<<<<<
 *         cdef _Element root
 *         cdef int ns_count
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree.iterwalk.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_root);
  __Pyx_XDECREF(__pyx_v_elem);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/iterparse.pxi":295
 *             self._index = -1
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8iterwalk_3__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_8iterwalk_3__iter__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_8iterwalk_2__iter__(((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8iterwalk_2__iter__(struct __pyx_obj_4lxml_5etree_iterwalk *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "src/lxml/iterparse.pxi":296
 * 
 *     def __iter__(self):
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __next__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "src/lxml/iterparse.pxi":295
 *             self._index = -1
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/iterparse.pxi":298
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         cdef xmlNode* c_child
 *         cdef _Element node
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8iterwalk_5__next__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_8iterwalk_5__next__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_8iterwalk_4__next__(((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8iterwalk_4__next__(struct __pyx_obj_4lxml_5etree_iterwalk *__pyx_v_self) {
  xmlNode *__pyx_v_c_child;
  struct LxmlElement *__pyx_v_node = 0;
  struct LxmlElement *__pyx_v_next_node = 0;
  int __pyx_v_ns_count;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_error_without_exception = 0; /* StopIteration */
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  xmlNode *__pyx_t_6;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__next__", 0);

  /* "src/lxml/iterparse.pxi":302
 *         cdef _Element node
 *         cdef _Element next_node
 *         cdef int ns_count = 0             # <<<<<<<<<<<<<<
 *         if self._events:
 *             return self._next_event()
*/
  __pyx_v_ns_count = 0;

  /* "src/lxml/iterparse.pxi":303
 *         cdef _Element next_node
 *         cdef int ns_count = 0
 *         if self._events:             # <<<<<<<<<<<<<<
 *             return self._next_event()
 *         if self._matcher is not None and self._index >= 0:
*/
  if (__pyx_v_self->_events == Py_None) __pyx_t_1 = 0;
  else
  {
    Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_v_self->_events);
    if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(14, 303, __pyx_L1_error)
    __pyx_t_1 = (__pyx_temp != 0);
  }

  if (__pyx_t_1) {

    /* "src/lxml/iterparse.pxi":304
 *         cdef int ns_count = 0
 *         if self._events:
 *             return self._next_event()             # <<<<<<<<<<<<<<
 *         if self._matcher is not None and self._index >= 0:
 *             node = self._node_stack[self._index][0]
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __pyx_f_4lxml_5etree_8iterwalk__next_event(__pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(14, 304, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "src/lxml/iterparse.pxi":303
 *         cdef _Element next_node
 *         cdef int ns_count = 0
 *         if self._events:             # <<<<<<<<<<<<<<
 *             return self._next_event()
 *         if self._matcher is not None and self._index >= 0:
*/
  }

  /* "src/lxml/iterparse.pxi":305
 *         if self._events:
 *             return self._next_event()
 *         if self._matcher is not None and self._index >= 0:             # <<<<<<<<<<<<<<
 *             node = self._node_stack[self._index][0]
 *             self._matcher.cacheTags(node._doc)
*/
  __pyx_t_3 = (((PyObject *)__pyx_v_self->_matcher) != Py_None);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_self->_index >= 0);
  __pyx_t_1 = __pyx_t_3;
  __pyx_L5_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/iterparse.pxi":306
 *             return self._next_event()
 *         if self._matcher is not None and self._index >= 0:
 *             node = self._node_stack[self._index][0]             # <<<<<<<<<<<<<<
 *             self._matcher.cacheTags(node._doc)
 * 
*/
    if (unlikely(__pyx_v_self->_node_stack == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(14, 306, __pyx_L1_error)
    }
    __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_self->_node_stack, __pyx_v_self->_index, int, 1, __Pyx_PyLong_From_int, 1, 1, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_2)) __PYX_ERR(14, 306, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_4)) __PYX_ERR(14, 306, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element))))) __PYX_ERR(14, 306, __pyx_L1_error)
    __pyx_v_node = ((struct LxmlElement *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "src/lxml/iterparse.pxi":307
 *         if self._matcher is not None and self._index >= 0:
 *             node = self._node_stack[self._index][0]
 *             self._matcher.cacheTags(node._doc)             # <<<<<<<<<<<<<<
 * 
 *         # find next node
*/
    __pyx_t_4 = ((PyObject *)__pyx_v_node->_doc);
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_5 = __pyx_f_4lxml_5etree_16_MultiTagMatcher_cacheTags(__pyx_v_self->_matcher, ((struct LxmlDocument *)__pyx_t_4), NULL); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(14, 307, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "src/lxml/iterparse.pxi":305
 *         if self._events:
 *             return self._next_event()
 *         if self._matcher is not None and self._index >= 0:             # <<<<<<<<<<<<<<
 *             node = self._node_stack[self._index][0]
 *             self._matcher.cacheTags(node._doc)
*/
  }

  /* "src/lxml/iterparse.pxi":310
 * 
 *         # find next node
 *         while self._index >= 0:             # <<<<<<<<<<<<<<
 *             node = self._node_stack[self._index][0]
 * 
*/
  while (1) {
    __pyx_t_1 = (__pyx_v_self->_index >= 0);
    if (!__pyx_t_1) break;

    /* "src/lxml/iterparse.pxi":311
 *         # find next node
 *         while self._index >= 0:
 *             node = self._node_stack[self._index][0]             # <<<<<<<<<<<<<<
 * 
 *             if self._skip_state == IWSKIP_SKIP_NEXT:
*/
    if (unlikely(__pyx_v_self->_node_stack == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(14, 311, __pyx_L1_error)
    }
    __pyx_t_4 = __Pyx_GetItemInt_List(__pyx_v_self->_node_stack, __pyx_v_self->_index, int, 1, __Pyx_PyLong_From_int, 1, 1, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_4)) __PYX_ERR(14, 311, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_4, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_2)) __PYX_ERR(14, 311, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element))))) __PYX_ERR(14, 311, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_node, ((struct LxmlElement *)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "src/lxml/iterparse.pxi":313
 *             node = self._node_stack[self._index][0]
 * 
 *             if self._skip_state == IWSKIP_SKIP_NEXT:             # <<<<<<<<<<<<<<
 *                 c_child = NULL
 *             else:
*/
    __pyx_t_1 = (__pyx_v_self->_skip_state == __pyx_e_4lxml_5etree_IWSKIP_SKIP_NEXT);
    if (__pyx_t_1) {

      /* "src/lxml/iterparse.pxi":314
 * 
 *             if self._skip_state == IWSKIP_SKIP_NEXT:
 *                 c_child = NULL             # <<<<<<<<<<<<<<
 *             else:
 *                 c_child = self._process_non_elements(
*/
      __pyx_v_c_child = NULL;

      /* "src/lxml/iterparse.pxi":313
 *             node = self._node_stack[self._index][0]
 * 
 *             if self._skip_state == IWSKIP_SKIP_NEXT:             # <<<<<<<<<<<<<<
 *                 c_child = NULL
 *             else:
*/
      goto __pyx_L9;
    }

    /* "src/lxml/iterparse.pxi":316
 *                 c_child = NULL
 *             else:
 *                 c_child = self._process_non_elements(             # <<<<<<<<<<<<<<
 *                     node._doc, _findChildForwards(node._c_node, 0))
 *             self._skip_state = IWSKIP_CANNOT_SKIP
*/
    /*else*/ {

      /* "src/lxml/iterparse.pxi":317
 *             else:
 *                 c_child = self._process_non_elements(
 *                     node._doc, _findChildForwards(node._c_node, 0))             # <<<<<<<<<<<<<<
 *             self._skip_state = IWSKIP_CANNOT_SKIP
 * 
*/
      __pyx_t_2 = ((PyObject *)__pyx_v_node->_doc);
      __Pyx_INCREF(__pyx_t_2);

      /* "src/lxml/iterparse.pxi":316
 *                 c_child = NULL
 *             else:
 *                 c_child = self._process_non_elements(             # <<<<<<<<<<<<<<
 *                     node._doc, _findChildForwards(node._c_node, 0))
 *             self._skip_state = IWSKIP_CANNOT_SKIP
*/
      __pyx_t_6 = __pyx_f_4lxml_5etree_8iterwalk__process_non_elements(__pyx_v_self, ((struct LxmlDocument *)__pyx_t_2), __pyx_f_4lxml_5etree__findChildForwards(__pyx_v_node->_c_node, 0)); if (unlikely(PyErr_Occurred())) __PYX_ERR(14, 316, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_c_child = __pyx_t_6;
    }
    __pyx_L9:;

    /* "src/lxml/iterparse.pxi":318
 *                 c_child = self._process_non_elements(
 *                     node._doc, _findChildForwards(node._c_node, 0))
 *             self._skip_state = IWSKIP_CANNOT_SKIP             # <<<<<<<<<<<<<<
 * 
 *             while c_child is NULL:
*/
    __pyx_v_self->_skip_state = __pyx_e_4lxml_5etree_IWSKIP_CANNOT_SKIP;

    /* "src/lxml/iterparse.pxi":320
 *             self._skip_state = IWSKIP_CANNOT_SKIP
 * 
 *             while c_child is NULL:             # <<<<<<<<<<<<<<
 *                 # back off through parents
 *                 self._index -= 1
*/
    while (1) {
      __pyx_t_1 = (__pyx_v_c_child == NULL);
      if (!__pyx_t_1) break;

      /* "src/lxml/iterparse.pxi":322
 *             while c_child is NULL:
 *                 # back off through parents
 *                 self._index -= 1             # <<<<<<<<<<<<<<
 *                 node = self._end_node()
 *                 if self._index < 0:
*/
      __pyx_v_self->_index = (__pyx_v_self->_index - 1);

      /* "src/lxml/iterparse.pxi":323
 *                 # back off through parents
 *                 self._index -= 1
 *                 node = self._end_node()             # <<<<<<<<<<<<<<
 *                 if self._index < 0:
 *                     break
*/
      __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree_8iterwalk__end_node(__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(14, 323, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF_SET(__pyx_v_node, ((struct LxmlElement *)__pyx_t_2));
      __pyx_t_2 = 0;

      /* "src/lxml/iterparse.pxi":324
 *                 self._index -= 1
 *                 node = self._end_node()
 *                 if self._index < 0:             # <<<<<<<<<<<<<<
 *                     break
 *                 c_child = self._process_non_elements(
*/
      __pyx_t_1 = (__pyx_v_self->_index < 0);
      if (__pyx_t_1) {

        /* "src/lxml/iterparse.pxi":325
 *                 node = self._end_node()
 *                 if self._index < 0:
 *                     break             # <<<<<<<<<<<<<<
 *                 c_child = self._process_non_elements(
 *                     node._doc, _nextElement(node._c_node))
*/
        goto __pyx_L11_break;

        /* "src/lxml/iterparse.pxi":324
 *                 self._index -= 1
 *                 node = self._end_node()
 *                 if self._index < 0:             # <<<<<<<<<<<<<<
 *                     break
 *                 c_child = self._process_non_elements(
*/
      }

      /* "src/lxml/iterparse.pxi":327
 *                     break
 *                 c_child = self._process_non_elements(
 *                     node._doc, _nextElement(node._c_node))             # <<<<<<<<<<<<<<
 * 
 *             if c_child is not NULL:
*/
      __pyx_t_2 = ((PyObject *)__pyx_v_node->_doc);
      __Pyx_INCREF(__pyx_t_2);

      /* "src/lxml/iterparse.pxi":326
 *                 if self._index < 0:
 *                     break
 *                 c_child = self._process_non_elements(             # <<<<<<<<<<<<<<
 *                     node._doc, _nextElement(node._c_node))
 * 
*/
      __pyx_t_6 = __pyx_f_4lxml_5etree_8iterwalk__process_non_elements(__pyx_v_self, ((struct LxmlDocument *)__pyx_t_2), __pyx_f_4lxml_5etree__nextElement(__pyx_v_node->_c_node)); if (unlikely(PyErr_Occurred())) __PYX_ERR(14, 326, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_c_child = __pyx_t_6;
    }
    __pyx_L11_break:;

    /* "src/lxml/iterparse.pxi":329
 *                     node._doc, _nextElement(node._c_node))
 * 
 *             if c_child is not NULL:             # <<<<<<<<<<<<<<
 *                 next_node = _elementFactory(node._doc, c_child)
 *                 if self._event_filter & (PARSE_EVENT_FILTER_START |
*/
    __pyx_t_1 = (__pyx_v_c_child != NULL);
    if (__pyx_t_1) {

      /* "src/lxml/iterparse.pxi":330
 * 
 *             if c_child is not NULL:
 *                 next_node = _elementFactory(node._doc, c_child)             # <<<<<<<<<<<<<<
 *                 if self._event_filter & (PARSE_EVENT_FILTER_START |
 *                                          PARSE_EVENT_FILTER_START_NS):
*/
      __pyx_t_2 = ((PyObject *)__pyx_v_node->_doc);
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_2), __pyx_v_c_child)); if (unlikely(!__pyx_t_4)) __PYX_ERR(14, 330, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF_SET(__pyx_v_next_node, ((struct LxmlElement *)__pyx_t_4));
      __pyx_t_4 = 0;

      /* "src/lxml/iterparse.pxi":331
 *             if c_child is not NULL:
 *                 next_node = _elementFactory(node._doc, c_child)
 *                 if self._event_filter & (PARSE_EVENT_FILTER_START |             # <<<<<<<<<<<<<<
 *                                          PARSE_EVENT_FILTER_START_NS):
 *                     ns_count = self._start_node(next_node)
*/
      __pyx_t_1 = ((__pyx_v_self->_event_filter & (__pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_START | __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_START_NS)) != 0);
      if (__pyx_t_1) {

        /* "src/lxml/iterparse.pxi":333
 *                 if self._event_filter & (PARSE_EVENT_FILTER_START |
 *                                          PARSE_EVENT_FILTER_START_NS):
 *                     ns_count = self._start_node(next_node)             # <<<<<<<<<<<<<<
 *                 elif self._event_filter & PARSE_EVENT_FILTER_END_NS:
 *                     ns_count = _countNsDefs(next_node._c_node)
*/
        __pyx_t_5 = __pyx_f_4lxml_5etree_8iterwalk__start_node(__pyx_v_self, __pyx_v_next_node); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(14, 333, __pyx_L1_error)
        __pyx_v_ns_count = __pyx_t_5;

        /* "src/lxml/iterparse.pxi":331
 *             if c_child is not NULL:
 *                 next_node = _elementFactory(node._doc, c_child)
 *                 if self._event_filter & (PARSE_EVENT_FILTER_START |             # <<<<<<<<<<<<<<
 *                                          PARSE_EVENT_FILTER_START_NS):
 *                     ns_count = self._start_node(next_node)
*/
        goto __pyx_L14;
      }

      /* "src/lxml/iterparse.pxi":334
 *                                          PARSE_EVENT_FILTER_START_NS):
 *                     ns_count = self._start_node(next_node)
 *                 elif self._event_filter & PARSE_EVENT_FILTER_END_NS:             # <<<<<<<<<<<<<<
 *                     ns_count = _countNsDefs(next_node._c_node)
 *                 self._node_stack.append( (next_node, ns_count) )
*/
      __pyx_t_1 = ((__pyx_v_self->_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_END_NS) != 0);
      if (__pyx_t_1) {

        /* "src/lxml/iterparse.pxi":335
 *                     ns_count = self._start_node(next_node)
 *                 elif self._event_filter & PARSE_EVENT_FILTER_END_NS:
 *                     ns_count = _countNsDefs(next_node._c_node)             # <<<<<<<<<<<<<<
 *                 self._node_stack.append( (next_node, ns_count) )
 *                 self._index += 1
*/
        __pyx_v_ns_count = __pyx_f_4lxml_5etree__countNsDefs(__pyx_v_next_node->_c_node);

        /* "src/lxml/iterparse.pxi":334
 *                                          PARSE_EVENT_FILTER_START_NS):
 *                     ns_count = self._start_node(next_node)
 *                 elif self._event_filter & PARSE_EVENT_FILTER_END_NS:             # <<<<<<<<<<<<<<
 *                     ns_count = _countNsDefs(next_node._c_node)
 *                 self._node_stack.append( (next_node, ns_count) )
*/
      }
      __pyx_L14:;

      /* "src/lxml/iterparse.pxi":336
 *                 elif self._event_filter & PARSE_EVENT_FILTER_END_NS:
 *                     ns_count = _countNsDefs(next_node._c_node)
 *                 self._node_stack.append( (next_node, ns_count) )             # <<<<<<<<<<<<<<
 *                 self._index += 1
 *             if self._events:
*/
      if (unlikely(__pyx_v_self->_node_stack == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
        __PYX_ERR(14, 336, __pyx_L1_error)
      }
      __pyx_t_4 = __Pyx_PyLong_From_int(__pyx_v_ns_count); if (unlikely(!__pyx_t_4)) __PYX_ERR(14, 336, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(14, 336, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF((PyObject *)__pyx_v_next_node);
      __Pyx_GIVEREF((PyObject *)__pyx_v_next_node);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_next_node)) != (0)) __PYX_ERR(14, 336, __pyx_L1_error);
      __Pyx_GIVEREF(__pyx_t_4);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4) != (0)) __PYX_ERR(14, 336, __pyx_L1_error);
      __pyx_t_4 = 0;
      __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_self->_node_stack, __pyx_t_2); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(14, 336, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "src/lxml/iterparse.pxi":337
 *                     ns_count = _countNsDefs(next_node._c_node)
 *                 self._node_stack.append( (next_node, ns_count) )
 *                 self._index += 1             # <<<<<<<<<<<<<<
 *             if self._events:
 *                 return self._next_event()
*/
      __pyx_v_self->_index = (__pyx_v_self->_index + 1);

      /* "src/lxml/iterparse.pxi":329
 *                     node._doc, _nextElement(node._c_node))
 * 
 *             if c_child is not NULL:             # <<<<<<<<<<<<<<
 *                 next_node = _elementFactory(node._doc, c_child)
 *                 if self._event_filter & (PARSE_EVENT_FILTER_START |
*/
    }

    /* "src/lxml/iterparse.pxi":338
 *                 self._node_stack.append( (next_node, ns_count) )
 *                 self._index += 1
 *             if self._events:             # <<<<<<<<<<<<<<
 *                 return self._next_event()
 * 
*/
    if (__pyx_v_self->_events == Py_None) __pyx_t_1 = 0;
    else
    {
      Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_v_self->_events);
      if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(14, 338, __pyx_L1_error)
      __pyx_t_1 = (__pyx_temp != 0);
    }

    if (__pyx_t_1) {

      /* "src/lxml/iterparse.pxi":339
 *                 self._index += 1
 *             if self._events:
 *                 return self._next_event()             # <<<<<<<<<<<<<<
 * 
 *         if self._include_siblings is not None:
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = __pyx_f_4lxml_5etree_8iterwalk__next_event(__pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(14, 339, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;

      /* "src/lxml/iterparse.pxi":338
 *                 self._node_stack.append( (next_node, ns_count) )
 *                 self._index += 1
 *             if self._events:             # <<<<<<<<<<<<<<
 *                 return self._next_event()
 * 
*/
    }
  }

  /* "src/lxml/iterparse.pxi":341
 *                 return self._next_event()
 * 
 *         if self._include_siblings is not None:             # <<<<<<<<<<<<<<
 *             node, self._include_siblings = self._include_siblings, None
 *             self._process_non_elements(node._doc, _nextElement(node._c_node))
*/
  __pyx_t_1 = (__pyx_v_self->_include_siblings != Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/iterparse.pxi":342
 * 
 *         if self._include_siblings is not None:
 *             node, self._include_siblings = self._include_siblings, None             # <<<<<<<<<<<<<<
 *             self._process_non_elements(node._doc, _nextElement(node._c_node))
 *             if self._events:
*/
    __pyx_t_2 = __pyx_v_self->_include_siblings;
    __Pyx_INCREF(__pyx_t_2);
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element))))) __PYX_ERR(14, 342, __pyx_L1_error)
    __pyx_t_4 = Py_None;
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_XDECREF_SET(__pyx_v_node, ((struct LxmlElement *)__pyx_t_2));
    __pyx_t_2 = 0;
    __Pyx_GIVEREF(__pyx_t_4);
    __Pyx_GOTREF(__pyx_v_self->_include_siblings);
    __Pyx_DECREF(__pyx_v_self->_include_siblings);
    __pyx_v_self->_include_siblings = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "src/lxml/iterparse.pxi":343
 *         if self._include_siblings is not None:
 *             node, self._include_siblings = self._include_siblings, None
 *             self._process_non_elements(node._doc, _nextElement(node._c_node))             # <<<<<<<<<<<<<<
 *             if self._events:
 *                 return self._next_event()
*/
    __pyx_t_4 = ((PyObject *)__pyx_v_node->_doc);
    __Pyx_INCREF(__pyx_t_4);
    __pyx_f_4lxml_5etree_8iterwalk__process_non_elements(__pyx_v_self, ((struct LxmlDocument *)__pyx_t_4), __pyx_f_4lxml_5etree__nextElement(__pyx_v_node->_c_node)); if (unlikely(PyErr_Occurred())) __PYX_ERR(14, 343, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "src/lxml/iterparse.pxi":344
 *             node, self._include_siblings = self._include_siblings, None
 *             self._process_non_elements(node._doc, _nextElement(node._c_node))
 *             if self._events:             # <<<<<<<<<<<<<<
 *                 return self._next_event()
 * 
*/
    if (__pyx_v_self->_events == Py_None) __pyx_t_1 = 0;
    else
    {
      Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_v_self->_events);
      if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(14, 344, __pyx_L1_error)
      __pyx_t_1 = (__pyx_temp != 0);
    }

    if (__pyx_t_1) {

      /* "src/lxml/iterparse.pxi":345
 *             self._process_non_elements(node._doc, _nextElement(node._c_node))
 *             if self._events:
 *                 return self._next_event()             # <<<<<<<<<<<<<<
 * 
 *         raise StopIteration
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = __pyx_f_4lxml_5etree_8iterwalk__next_event(__pyx_v_self); if (unlikely(!__pyx_t_4)) __PYX_ERR(14, 345, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L0;

      /* "src/lxml/iterparse.pxi":344
 *             node, self._include_siblings = self._include_siblings, None
 *             self._process_non_elements(node._doc, _nextElement(node._c_node))
 *             if self._events:             # <<<<<<<<<<<<<<
 *                 return self._next_event()
 * 
*/
    }

    /* "src/lxml/iterparse.pxi":341
 *                 return self._next_event()
 * 
 *         if self._include_siblings is not None:             # <<<<<<<<<<<<<<
 *             node, self._include_siblings = self._include_siblings, None
 *             self._process_non_elements(node._doc, _nextElement(node._c_node))
*/
  }

  /* "src/lxml/iterparse.pxi":347
 *                 return self._next_event()
 * 
 *         raise StopIteration             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
*/
  __pyx_error_without_exception = 1;
  goto __pyx_L1_error;;

  /* "src/lxml/iterparse.pxi":298
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         cdef xmlNode* c_child
 *         cdef _Element node
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  if (!__pyx_error_without_exception) {
    __Pyx_AddTraceback("lxml.etree.iterwalk.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_node);
  __Pyx_XDECREF((PyObject *)__pyx_v_next_node);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/iterparse.pxi":349
 *         raise StopIteration
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef xmlNode* _process_non_elements(self, _Document doc, xmlNode* c_node):
 *         while c_node is not NULL and c_node.type != tree.XML_ELEMENT_NODE:
*/

static xmlNode *__pyx_f_4lxml_5etree_8iterwalk__process_non_elements(struct __pyx_obj_4lxml_5etree_iterwalk *__pyx_v_self, struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_node) {
  xmlNode *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_process_non_elements", 0);

  /* "src/lxml/iterparse.pxi":351
 *     @cython.final
 *     cdef xmlNode* _process_non_elements(self, _Document doc, xmlNode* c_node):
 *         while c_node is not NULL and c_node.type != tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *             if c_node.type == tree.XML_COMMENT_NODE:
 *                 if self._event_filter & PARSE_EVENT_FILTER_COMMENT:
*/
  while (1) {
    __pyx_t_2 = (__pyx_v_c_node != NULL);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_2 = (__pyx_v_c_node->type != XML_ELEMENT_NODE);
    __pyx_t_1 = __pyx_t_2;
    __pyx_L5_bool_binop_done:;
    if (!__pyx_t_1) break;

    /* "src/lxml/iterparse.pxi":352
 *     cdef xmlNode* _process_non_elements(self, _Document doc, xmlNode* c_node):
 *         while c_node is not NULL and c_node.type != tree.XML_ELEMENT_NODE:
 *             if c_node.type == tree.XML_COMMENT_NODE:             # <<<<<<<<<<<<<<
 *                 if self._event_filter & PARSE_EVENT_FILTER_COMMENT:
 *                     self._events.append(
*/
    switch (__pyx_v_c_node->type) {
      case XML_COMMENT_NODE:

      /* "src/lxml/iterparse.pxi":353
 *         while c_node is not NULL and c_node.type != tree.XML_ELEMENT_NODE:
 *             if c_node.type == tree.XML_COMMENT_NODE:
 *                 if self._event_filter & PARSE_EVENT_FILTER_COMMENT:             # <<<<<<<<<<<<<<
 *                     self._events.append(
 *                         ("comment", _elementFactory(doc, c_node)))
*/
      __pyx_t_1 = ((__pyx_v_self->_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_COMMENT) != 0);
      if (__pyx_t_1) {

        /* "src/lxml/iterparse.pxi":354
 *             if c_node.type == tree.XML_COMMENT_NODE:
 *                 if self._event_filter & PARSE_EVENT_FILTER_COMMENT:
 *                     self._events.append(             # <<<<<<<<<<<<<<
 *                         ("comment", _elementFactory(doc, c_node)))
 *                 c_node = _nextElement(c_node)
*/
        if (unlikely(__pyx_v_self->_events == Py_None)) {
          PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
          __PYX_ERR(14, 354, __pyx_L1_error)
        }

        /* "src/lxml/iterparse.pxi":355
 *                 if self._event_filter & PARSE_EVENT_FILTER_COMMENT:
 *                     self._events.append(
 *                         ("comment", _elementFactory(doc, c_node)))             # <<<<<<<<<<<<<<
 *                 c_node = _nextElement(c_node)
 *             elif c_node.type == tree.XML_PI_NODE:
*/
        __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(__pyx_v_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_3)) __PYX_ERR(14, 355, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(14, 355, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_comment);
        __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_comment);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_mstate_global->__pyx_n_u_comment) != (0)) __PYX_ERR(14, 355, __pyx_L1_error);
        __Pyx_GIVEREF(__pyx_t_3);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3) != (0)) __PYX_ERR(14, 355, __pyx_L1_error);
        __pyx_t_3 = 0;

        /* "src/lxml/iterparse.pxi":354
 *             if c_node.type == tree.XML_COMMENT_NODE:
 *                 if self._event_filter & PARSE_EVENT_FILTER_COMMENT:
 *                     self._events.append(             # <<<<<<<<<<<<<<
 *                         ("comment", _elementFactory(doc, c_node)))
 *                 c_node = _nextElement(c_node)
*/
        __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_self->_events, __pyx_t_4); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(14, 354, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

        /* "src/lxml/iterparse.pxi":353
 *         while c_node is not NULL and c_node.type != tree.XML_ELEMENT_NODE:
 *             if c_node.type == tree.XML_COMMENT_NODE:
 *                 if self._event_filter & PARSE_EVENT_FILTER_COMMENT:             # <<<<<<<<<<<<<<
 *                     self._events.append(
 *                         ("comment", _elementFactory(doc, c_node)))
*/
      }

      /* "src/lxml/iterparse.pxi":356
 *                     self._events.append(
 *                         ("comment", _elementFactory(doc, c_node)))
 *                 c_node = _nextElement(c_node)             # <<<<<<<<<<<<<<
 *             elif c_node.type == tree.XML_PI_NODE:
 *                 if self._event_filter & PARSE_EVENT_FILTER_PI:
*/
      __pyx_v_c_node = __pyx_f_4lxml_5etree__nextElement(__pyx_v_c_node);

      /* "src/lxml/iterparse.pxi":352
 *     cdef xmlNode* _process_non_elements(self, _Document doc, xmlNode* c_node):
 *         while c_node is not NULL and c_node.type != tree.XML_ELEMENT_NODE:
 *             if c_node.type == tree.XML_COMMENT_NODE:             # <<<<<<<<<<<<<<
 *                 if self._event_filter & PARSE_EVENT_FILTER_COMMENT:
 *                     self._events.append(
*/
      break;
      case XML_PI_NODE:

      /* "src/lxml/iterparse.pxi":358
 *                 c_node = _nextElement(c_node)
 *             elif c_node.type == tree.XML_PI_NODE:
 *                 if self._event_filter & PARSE_EVENT_FILTER_PI:             # <<<<<<<<<<<<<<
 *                     self._events.append(
 *                         ("pi", _elementFactory(doc, c_node)))
*/
      __pyx_t_1 = ((__pyx_v_self->_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_PI) != 0);
      if (__pyx_t_1) {

        /* "src/lxml/iterparse.pxi":359
 *             elif c_node.type == tree.XML_PI_NODE:
 *                 if self._event_filter & PARSE_EVENT_FILTER_PI:
 *                     self._events.append(             # <<<<<<<<<<<<<<
 *                         ("pi", _elementFactory(doc, c_node)))
 *                 c_node = _nextElement(c_node)
*/
        if (unlikely(__pyx_v_self->_events == Py_None)) {
          PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
          __PYX_ERR(14, 359, __pyx_L1_error)
        }

        /* "src/lxml/iterparse.pxi":360
 *                 if self._event_filter & PARSE_EVENT_FILTER_PI:
 *                     self._events.append(
 *                         ("pi", _elementFactory(doc, c_node)))             # <<<<<<<<<<<<<<
 *                 c_node = _nextElement(c_node)
 *             else:
*/
        __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(__pyx_v_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_4)) __PYX_ERR(14, 360, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(14, 360, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_pi);
        __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_pi);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_mstate_global->__pyx_n_u_pi) != (0)) __PYX_ERR(14, 360, __pyx_L1_error);
        __Pyx_GIVEREF(__pyx_t_4);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4) != (0)) __PYX_ERR(14, 360, __pyx_L1_error);
        __pyx_t_4 = 0;

        /* "src/lxml/iterparse.pxi":359
 *             elif c_node.type == tree.XML_PI_NODE:
 *                 if self._event_filter & PARSE_EVENT_FILTER_PI:
 *                     self._events.append(             # <<<<<<<<<<<<<<
 *                         ("pi", _elementFactory(doc, c_node)))
 *                 c_node = _nextElement(c_node)
*/
        __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_self->_events, __pyx_t_3); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(14, 359, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "src/lxml/iterparse.pxi":358
 *                 c_node = _nextElement(c_node)
 *             elif c_node.type == tree.XML_PI_NODE:
 *                 if self._event_filter & PARSE_EVENT_FILTER_PI:             # <<<<<<<<<<<<<<
 *                     self._events.append(
 *                         ("pi", _elementFactory(doc, c_node)))
*/
      }

      /* "src/lxml/iterparse.pxi":361
 *                     self._events.append(
 *                         ("pi", _elementFactory(doc, c_node)))
 *                 c_node = _nextElement(c_node)             # <<<<<<<<<<<<<<
 *             else:
 *                 break
*/
      __pyx_v_c_node = __pyx_f_4lxml_5etree__nextElement(__pyx_v_c_node);

      /* "src/lxml/iterparse.pxi":357
 *                         ("comment", _elementFactory(doc, c_node)))
 *                 c_node = _nextElement(c_node)
 *             elif c_node.type == tree.XML_PI_NODE:             # <<<<<<<<<<<<<<
 *                 if self._event_filter & PARSE_EVENT_FILTER_PI:
 *                     self._events.append(
*/
      break;
      default:

      /* "src/lxml/iterparse.pxi":363
 *                 c_node = _nextElement(c_node)
 *             else:
 *                 break             # <<<<<<<<<<<<<<
 *         return c_node
 * 
*/
      goto __pyx_L4_break;
      break;
    }
  }
  __pyx_L4_break:;

  /* "src/lxml/iterparse.pxi":364
 *             else:
 *                 break
 *         return c_node             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
*/
  __pyx_r = __pyx_v_c_node;
  goto __pyx_L0;

  /* "src/lxml/iterparse.pxi":349
 *         raise StopIteration
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef xmlNode* _process_non_elements(self, _Document doc, xmlNode* c_node):
 *         while c_node is not NULL and c_node.type != tree.XML_ELEMENT_NODE:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.iterwalk._process_non_elements", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/iterparse.pxi":366
 *         return c_node
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef _next_event(self):
 *         if self._skip_state == IWSKIP_NEXT_IS_START:
*/

static PyObject *__pyx_f_4lxml_5etree_8iterwalk__next_event(struct __pyx_obj_4lxml_5etree_iterwalk *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_next_event", 0);

  /* "src/lxml/iterparse.pxi":368
 *     @cython.final
 *     cdef _next_event(self):
 *         if self._skip_state == IWSKIP_NEXT_IS_START:             # <<<<<<<<<<<<<<
 *             if self._events[0][0] in ('start', 'start-ns'):
 *                 self._skip_state = IWSKIP_CAN_SKIP
*/
  __pyx_t_1 = (__pyx_v_self->_skip_state == __pyx_e_4lxml_5etree_IWSKIP_NEXT_IS_START);
  if (__pyx_t_1) {

    /* "src/lxml/iterparse.pxi":369
 *     cdef _next_event(self):
 *         if self._skip_state == IWSKIP_NEXT_IS_START:
 *             if self._events[0][0] in ('start', 'start-ns'):             # <<<<<<<<<<<<<<
 *                 self._skip_state = IWSKIP_CAN_SKIP
 *         return self._pop_event(0)
*/
    if (unlikely(__pyx_v_self->_events == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(14, 369, __pyx_L1_error)
    }
    __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_self->_events, 0, long, 1, __Pyx_PyLong_From_long, 1, 0, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_2)) __PYX_ERR(14, 369, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_3)) __PYX_ERR(14, 369, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_start, Py_EQ)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(14, 369, __pyx_L1_error)
    if (!__pyx_t_4) {
    } else {
      __pyx_t_1 = __pyx_t_4;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_start_ns, Py_EQ)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(14, 369, __pyx_L1_error)
    __pyx_t_1 = __pyx_t_4;
    __pyx_L5_bool_binop_done:;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_4 = __pyx_t_1;
    if (__pyx_t_4) {

      /* "src/lxml/iterparse.pxi":370
 *         if self._skip_state == IWSKIP_NEXT_IS_START:
 *             if self._events[0][0] in ('start', 'start-ns'):
 *                 self._skip_state = IWSKIP_CAN_SKIP             # <<<<<<<<<<<<<<
 *         return self._pop_event(0)
 * 
*/
      __pyx_v_self->_skip_state = __pyx_e_4lxml_5etree_IWSKIP_CAN_SKIP;

      /* "src/lxml/iterparse.pxi":369
 *     cdef _next_event(self):
 *         if self._skip_state == IWSKIP_NEXT_IS_START:
 *             if self._events[0][0] in ('start', 'start-ns'):             # <<<<<<<<<<<<<<
 *                 self._skip_state = IWSKIP_CAN_SKIP
 *         return self._pop_event(0)
*/
    }

    /* "src/lxml/iterparse.pxi":368
 *     @cython.final
 *     cdef _next_event(self):
 *         if self._skip_state == IWSKIP_NEXT_IS_START:             # <<<<<<<<<<<<<<
 *             if self._events[0][0] in ('start', 'start-ns'):
 *                 self._skip_state = IWSKIP_CAN_SKIP
*/
  }

  /* "src/lxml/iterparse.pxi":371
 *             if self._events[0][0] in ('start', 'start-ns'):
 *                 self._skip_state = IWSKIP_CAN_SKIP
 *         return self._pop_event(0)             # <<<<<<<<<<<<<<
 * 
 *     def skip_subtree(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = NULL;
  __Pyx_INCREF(__pyx_v_self->_pop_event);
  __pyx_t_5 = __pyx_v_self->_pop_event; 
  __pyx_t_6 = 1;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
    __pyx_t_6 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_int_0};
    __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(14, 371, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "src/lxml/iterparse.pxi":366
 *         return c_node
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef _next_event(self):
 *         if self._skip_state == IWSKIP_NEXT_IS_START:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree.iterwalk._next_event", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/iterparse.pxi":373
 *         return self._pop_event(0)
 * 
 *     def skip_subtree(self):             # <<<<<<<<<<<<<<
 *         """Prevent descending into the current subtree.
 *         Instead, the next returned event will be the 'end' event of the current element
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8iterwalk_7skip_subtree(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8iterwalk_6skip_subtree, "Prevent descending into the current subtree.\n        Instead, the next returned event will be the 'end' event of the current element\n        (if included), ignoring any children or descendants.\n\n        This has no effect right after an 'end' or 'end-ns' event.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_8iterwalk_7skip_subtree = {"skip_subtree", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8iterwalk_7skip_subtree, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8iterwalk_6skip_subtree};
static PyObject *__pyx_pw_4lxml_5etree_8iterwalk_7skip_subtree(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("skip_subtree (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("skip_subtree", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("skip_subtree", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_8iterwalk_6skip_subtree(((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8iterwalk_6skip_subtree(struct __pyx_obj_4lxml_5etree_iterwalk *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("skip_subtree", 0);

  /* "src/lxml/iterparse.pxi":380
 *         This has no effect right after an 'end' or 'end-ns' event.
 *         """
 *         if self._skip_state == IWSKIP_CAN_SKIP:             # <<<<<<<<<<<<<<
 *             self._skip_state = IWSKIP_SKIP_NEXT
 * 
*/
  __pyx_t_1 = (__pyx_v_self->_skip_state == __pyx_e_4lxml_5etree_IWSKIP_CAN_SKIP);
  if (__pyx_t_1) {

    /* "src/lxml/iterparse.pxi":381
 *         """
 *         if self._skip_state == IWSKIP_CAN_SKIP:
 *             self._skip_state = IWSKIP_SKIP_NEXT             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
*/
    __pyx_v_self->_skip_state = __pyx_e_4lxml_5etree_IWSKIP_SKIP_NEXT;

    /* "src/lxml/iterparse.pxi":380
 *         This has no effect right after an 'end' or 'end-ns' event.
 *         """
 *         if self._skip_state == IWSKIP_CAN_SKIP:             # <<<<<<<<<<<<<<
 *             self._skip_state = IWSKIP_SKIP_NEXT
 * 
*/
  }

  /* "src/lxml/iterparse.pxi":373
 *         return self._pop_event(0)
 * 
 *     def skip_subtree(self):             # <<<<<<<<<<<<<<
 *         """Prevent descending into the current subtree.
 *         Instead, the next returned event will be the 'end' event of the current element
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/iterparse.pxi":383
 *             self._skip_state = IWSKIP_SKIP_NEXT
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef int _start_node(self, _Element node) except -1:
 *         cdef int ns_count
*/

static int __pyx_f_4lxml_5etree_8iterwalk__start_node(struct __pyx_obj_4lxml_5etree_iterwalk *__pyx_v_self, struct LxmlElement *__pyx_v_node) {
  int __pyx_v_ns_count;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_start_node", 0);

  /* "src/lxml/iterparse.pxi":386
 *     cdef int _start_node(self, _Element node) except -1:
 *         cdef int ns_count
 *         if self._event_filter & PARSE_EVENT_FILTER_START_NS:             # <<<<<<<<<<<<<<
 *             ns_count = _appendStartNsEvents(node._c_node, self._events)
 *             if self._events:
*/
  __pyx_t_1 = ((__pyx_v_self->_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_START_NS) != 0);
  if (__pyx_t_1) {

    /* "src/lxml/iterparse.pxi":387
 *         cdef int ns_count
 *         if self._event_filter & PARSE_EVENT_FILTER_START_NS:
 *             ns_count = _appendStartNsEvents(node._c_node, self._events)             # <<<<<<<<<<<<<<
 *             if self._events:
 *                 self._skip_state = IWSKIP_NEXT_IS_START
*/
    __pyx_t_2 = __pyx_v_self->_events;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = __pyx_f_4lxml_5etree__appendStartNsEvents(__pyx_v_node->_c_node, ((PyObject*)__pyx_t_2)); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(14, 387, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_ns_count = __pyx_t_3;

    /* "src/lxml/iterparse.pxi":388
 *         if self._event_filter & PARSE_EVENT_FILTER_START_NS:
 *             ns_count = _appendStartNsEvents(node._c_node, self._events)
 *             if self._events:             # <<<<<<<<<<<<<<
 *                 self._skip_state = IWSKIP_NEXT_IS_START
 *         elif self._event_filter & PARSE_EVENT_FILTER_END_NS:
*/
    if (__pyx_v_self->_events == Py_None) __pyx_t_1 = 0;
    else
    {
      Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_v_self->_events);
      if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(14, 388, __pyx_L1_error)
      __pyx_t_1 = (__pyx_temp != 0);
    }

    if (__pyx_t_1) {

      /* "src/lxml/iterparse.pxi":389
 *             ns_count = _appendStartNsEvents(node._c_node, self._events)
 *             if self._events:
 *                 self._skip_state = IWSKIP_NEXT_IS_START             # <<<<<<<<<<<<<<
 *         elif self._event_filter & PARSE_EVENT_FILTER_END_NS:
 *             ns_count = _countNsDefs(node._c_node)
*/
      __pyx_v_self->_skip_state = __pyx_e_4lxml_5etree_IWSKIP_NEXT_IS_START;

      /* "src/lxml/iterparse.pxi":388
 *         if self._event_filter & PARSE_EVENT_FILTER_START_NS:
 *             ns_count = _appendStartNsEvents(node._c_node, self._events)
 *             if self._events:             # <<<<<<<<<<<<<<
 *                 self._skip_state = IWSKIP_NEXT_IS_START
 *         elif self._event_filter & PARSE_EVENT_FILTER_END_NS:
*/
    }

    /* "src/lxml/iterparse.pxi":386
 *     cdef int _start_node(self, _Element node) except -1:
 *         cdef int ns_count
 *         if self._event_filter & PARSE_EVENT_FILTER_START_NS:             # <<<<<<<<<<<<<<
 *             ns_count = _appendStartNsEvents(node._c_node, self._events)
 *             if self._events:
*/
    goto __pyx_L3;
  }

  /* "src/lxml/iterparse.pxi":390
 *             if self._events:
 *                 self._skip_state = IWSKIP_NEXT_IS_START
 *         elif self._event_filter & PARSE_EVENT_FILTER_END_NS:             # <<<<<<<<<<<<<<
 *             ns_count = _countNsDefs(node._c_node)
 *         else:
*/
  __pyx_t_1 = ((__pyx_v_self->_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_END_NS) != 0);
  if (__pyx_t_1) {

    /* "src/lxml/iterparse.pxi":391
 *                 self._skip_state = IWSKIP_NEXT_IS_START
 *         elif self._event_filter & PARSE_EVENT_FILTER_END_NS:
 *             ns_count = _countNsDefs(node._c_node)             # <<<<<<<<<<<<<<
 *         else:
 *             ns_count = 0
*/
    __pyx_v_ns_count = __pyx_f_4lxml_5etree__countNsDefs(__pyx_v_node->_c_node);

    /* "src/lxml/iterparse.pxi":390
 *             if self._events:
 *                 self._skip_state = IWSKIP_NEXT_IS_START
 *         elif self._event_filter & PARSE_EVENT_FILTER_END_NS:             # <<<<<<<<<<<<<<
 *             ns_count = _countNsDefs(node._c_node)
 *         else:
*/
    goto __pyx_L3;
  }

  /* "src/lxml/iterparse.pxi":393
 *             ns_count = _countNsDefs(node._c_node)
 *         else:
 *             ns_count = 0             # <<<<<<<<<<<<<<
 *         if self._event_filter & PARSE_EVENT_FILTER_START:
 *             if self._matcher is None or self._matcher.matches(node._c_node):
*/
  /*else*/ {
    __pyx_v_ns_count = 0;
  }
  __pyx_L3:;

  /* "src/lxml/iterparse.pxi":394
 *         else:
 *             ns_count = 0
 *         if self._event_filter & PARSE_EVENT_FILTER_START:             # <<<<<<<<<<<<<<
 *             if self._matcher is None or self._matcher.matches(node._c_node):
 *                 self._events.append( ("start", node) )
*/
  __pyx_t_1 = ((__pyx_v_self->_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_START) != 0);
  if (__pyx_t_1) {

    /* "src/lxml/iterparse.pxi":395
 *             ns_count = 0
 *         if self._event_filter & PARSE_EVENT_FILTER_START:
 *             if self._matcher is None or self._matcher.matches(node._c_node):             # <<<<<<<<<<<<<<
 *                 self._events.append( ("start", node) )
 *                 self._skip_state = IWSKIP_NEXT_IS_START
*/
    __pyx_t_4 = (((PyObject *)__pyx_v_self->_matcher) == Py_None);
    if (!__pyx_t_4) {
    } else {
      __pyx_t_1 = __pyx_t_4;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_4 = __pyx_f_4lxml_5etree_16_MultiTagMatcher_matches(__pyx_v_self->_matcher, __pyx_v_node->_c_node);
    __pyx_t_1 = __pyx_t_4;
    __pyx_L7_bool_binop_done:;
    if (__pyx_t_1) {

      /* "src/lxml/iterparse.pxi":396
 *         if self._event_filter & PARSE_EVENT_FILTER_START:
 *             if self._matcher is None or self._matcher.matches(node._c_node):
 *                 self._events.append( ("start", node) )             # <<<<<<<<<<<<<<
 *                 self._skip_state = IWSKIP_NEXT_IS_START
 *         return ns_count
*/
      if (unlikely(__pyx_v_self->_events == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
        __PYX_ERR(14, 396, __pyx_L1_error)
      }
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(14, 396, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_start);
      __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_start);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_mstate_global->__pyx_n_u_start) != (0)) __PYX_ERR(14, 396, __pyx_L1_error);
      __Pyx_INCREF((PyObject *)__pyx_v_node);
      __Pyx_GIVEREF((PyObject *)__pyx_v_node);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_node)) != (0)) __PYX_ERR(14, 396, __pyx_L1_error);
      __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_self->_events, __pyx_t_2); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(14, 396, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "src/lxml/iterparse.pxi":397
 *             if self._matcher is None or self._matcher.matches(node._c_node):
 *                 self._events.append( ("start", node) )
 *                 self._skip_state = IWSKIP_NEXT_IS_START             # <<<<<<<<<<<<<<
 *         return ns_count
 * 
*/
      __pyx_v_self->_skip_state = __pyx_e_4lxml_5etree_IWSKIP_NEXT_IS_START;

      /* "src/lxml/iterparse.pxi":395
 *             ns_count = 0
 *         if self._event_filter & PARSE_EVENT_FILTER_START:
 *             if self._matcher is None or self._matcher.matches(node._c_node):             # <<<<<<<<<<<<<<
 *                 self._events.append( ("start", node) )
 *                 self._skip_state = IWSKIP_NEXT_IS_START
*/
    }

    /* "src/lxml/iterparse.pxi":394
 *         else:
 *             ns_count = 0
 *         if self._event_filter & PARSE_EVENT_FILTER_START:             # <<<<<<<<<<<<<<
 *             if self._matcher is None or self._matcher.matches(node._c_node):
 *                 self._events.append( ("start", node) )
*/
  }

  /* "src/lxml/iterparse.pxi":398
 *                 self._events.append( ("start", node) )
 *                 self._skip_state = IWSKIP_NEXT_IS_START
 *         return ns_count             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
*/
  __pyx_r = __pyx_v_ns_count;
  goto __pyx_L0;

  /* "src/lxml/iterparse.pxi":383
 *             self._skip_state = IWSKIP_SKIP_NEXT
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef int _start_node(self, _Element node) except -1:
 *         cdef int ns_count
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.iterwalk._start_node", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/iterparse.pxi":400
 *         return ns_count
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef _Element _end_node(self):
 *         cdef _Element node
*/

static struct LxmlElement *__pyx_f_4lxml_5etree_8iterwalk__end_node(struct __pyx_obj_4lxml_5etree_iterwalk *__pyx_v_self) {
  struct LxmlElement *__pyx_v_node = 0;
  CYTHON_UNUSED int __pyx_v_i;
  int __pyx_v_ns_count;
  PyObject *__pyx_v_event = NULL;
  struct LxmlElement *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_end_node", 0);

  /* "src/lxml/iterparse.pxi":404
 *         cdef _Element node
 *         cdef int i, ns_count
 *         node, ns_count = self._node_stack.pop()             # <<<<<<<<<<<<<<
 *         if self._event_filter & PARSE_EVENT_FILTER_END:
 *             if self._matcher is None or self._matcher.matches(node._c_node):
*/
  if (unlikely(__pyx_v_self->_node_stack == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "pop");
    __PYX_ERR(14, 404, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyList_Pop(__pyx_v_self->_node_stack); if (unlikely(!__pyx_t_1)) __PYX_ERR(14, 404, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(14, 404, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
      __Pyx_INCREF(__pyx_t_3);
    } else {
      __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
      if (unlikely(!__pyx_t_2)) __PYX_ERR(14, 404, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
      if (unlikely(!__pyx_t_3)) __PYX_ERR(14, 404, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_3);
    }
    #else
    __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(14, 404, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(14, 404, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(14, 404, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4);
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < (0)) __PYX_ERR(14, 404, __pyx_L1_error)
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(14, 404, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element))))) __PYX_ERR(14, 404, __pyx_L1_error)
  __pyx_t_6 = __Pyx_PyLong_As_int(__pyx_t_3); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(14, 404, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_node = ((struct LxmlElement *)__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_v_ns_count = __pyx_t_6;

  /* "src/lxml/iterparse.pxi":405
 *         cdef int i, ns_count
 *         node, ns_count = self._node_stack.pop()
 *         if self._event_filter & PARSE_EVENT_FILTER_END:             # <<<<<<<<<<<<<<
 *             if self._matcher is None or self._matcher.matches(node._c_node):
 *                 self._events.append( ("end", node) )
*/
  __pyx_t_7 = ((__pyx_v_self->_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_END) != 0);
  if (__pyx_t_7) {

    /* "src/lxml/iterparse.pxi":406
 *         node, ns_count = self._node_stack.pop()
 *         if self._event_filter & PARSE_EVENT_FILTER_END:
 *             if self._matcher is None or self._matcher.matches(node._c_node):             # <<<<<<<<<<<<<<
 *                 self._events.append( ("end", node) )
 *         if self._event_filter & PARSE_EVENT_FILTER_END_NS and ns_count:
*/
    __pyx_t_8 = (((PyObject *)__pyx_v_self->_matcher) == Py_None);
    if (!__pyx_t_8) {
    } else {
      __pyx_t_7 = __pyx_t_8;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_8 = __pyx_f_4lxml_5etree_16_MultiTagMatcher_matches(__pyx_v_self->_matcher, __pyx_v_node->_c_node);
    __pyx_t_7 = __pyx_t_8;
    __pyx_L7_bool_binop_done:;
    if (__pyx_t_7) {

      /* "src/lxml/iterparse.pxi":407
 *         if self._event_filter & PARSE_EVENT_FILTER_END:
 *             if self._matcher is None or self._matcher.matches(node._c_node):
 *                 self._events.append( ("end", node) )             # <<<<<<<<<<<<<<
 *         if self._event_filter & PARSE_EVENT_FILTER_END_NS and ns_count:
 *             event = ("end-ns", None)
*/
      if (unlikely(__pyx_v_self->_events == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
        __PYX_ERR(14, 407, __pyx_L1_error)
      }
      __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(14, 407, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_end);
      __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_end);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_mstate_global->__pyx_n_u_end) != (0)) __PYX_ERR(14, 407, __pyx_L1_error);
      __Pyx_INCREF((PyObject *)__pyx_v_node);
      __Pyx_GIVEREF((PyObject *)__pyx_v_node);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_node)) != (0)) __PYX_ERR(14, 407, __pyx_L1_error);
      __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_self->_events, __pyx_t_1); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(14, 407, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "src/lxml/iterparse.pxi":406
 *         node, ns_count = self._node_stack.pop()
 *         if self._event_filter & PARSE_EVENT_FILTER_END:
 *             if self._matcher is None or self._matcher.matches(node._c_node):             # <<<<<<<<<<<<<<
 *                 self._events.append( ("end", node) )
 *         if self._event_filter & PARSE_EVENT_FILTER_END_NS and ns_count:
*/
    }

    /* "src/lxml/iterparse.pxi":405
 *         cdef int i, ns_count
 *         node, ns_count = self._node_stack.pop()
 *         if self._event_filter & PARSE_EVENT_FILTER_END:             # <<<<<<<<<<<<<<
 *             if self._matcher is None or self._matcher.matches(node._c_node):
 *                 self._events.append( ("end", node) )
*/
  }

  /* "src/lxml/iterparse.pxi":408
 *             if self._matcher is None or self._matcher.matches(node._c_node):
 *                 self._events.append( ("end", node) )
 *         if self._event_filter & PARSE_EVENT_FILTER_END_NS and ns_count:             # <<<<<<<<<<<<<<
 *             event = ("end-ns", None)
 *             for i in range(ns_count):
*/
  __pyx_t_8 = ((__pyx_v_self->_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_END_NS) != 0);
  if (__pyx_t_8) {
  } else {
    __pyx_t_7 = __pyx_t_8;
    goto __pyx_L10_bool_binop_done;
  }
  __pyx_t_8 = (__pyx_v_ns_count != 0);
  __pyx_t_7 = __pyx_t_8;
  __pyx_L10_bool_binop_done:;
  if (__pyx_t_7) {

    /* "src/lxml/iterparse.pxi":409
 *                 self._events.append( ("end", node) )
 *         if self._event_filter & PARSE_EVENT_FILTER_END_NS and ns_count:
 *             event = ("end-ns", None)             # <<<<<<<<<<<<<<
 *             for i in range(ns_count):
 *                 self._events.append(event)
*/
    __Pyx_INCREF(__pyx_mstate_global->__pyx_tuple[7]);
    __pyx_v_event = __pyx_mstate_global->__pyx_tuple[7];

    /* "src/lxml/iterparse.pxi":410
 *         if self._event_filter & PARSE_EVENT_FILTER_END_NS and ns_count:
 *             event = ("end-ns", None)
 *             for i in range(ns_count):             # <<<<<<<<<<<<<<
 *                 self._events.append(event)
 *         return node
*/
    __pyx_t_6 = __pyx_v_ns_count;
    __pyx_t_10 = __pyx_t_6;
    for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
      __pyx_v_i = __pyx_t_11;

      /* "src/lxml/iterparse.pxi":411
 *             event = ("end-ns", None)
 *             for i in range(ns_count):
 *                 self._events.append(event)             # <<<<<<<<<<<<<<
 *         return node
 * 
*/
      if (unlikely(__pyx_v_self->_events == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
        __PYX_ERR(14, 411, __pyx_L1_error)
      }
      __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_self->_events, __pyx_v_event); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(14, 411, __pyx_L1_error)
    }

    /* "src/lxml/iterparse.pxi":408
 *             if self._matcher is None or self._matcher.matches(node._c_node):
 *                 self._events.append( ("end", node) )
 *         if self._event_filter & PARSE_EVENT_FILTER_END_NS and ns_count:             # <<<<<<<<<<<<<<
 *             event = ("end-ns", None)
 *             for i in range(ns_count):
*/
  }

  /* "src/lxml/iterparse.pxi":412
 *             for i in range(ns_count):
 *                 self._events.append(event)
 *         return node             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_node);
  __pyx_r = __pyx_v_node;
  goto __pyx_L0;

  /* "src/lxml/iterparse.pxi":400
 *         return ns_count
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef _Element _end_node(self):
 *         cdef _Element node
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.iterwalk._end_node", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_node);
  __Pyx_XDECREF(__pyx_v_event);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/iterparse.pxi":415
 * 
 * 
 * cdef int _countNsDefs(xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *     cdef xmlNs* c_ns
 *     cdef int count
*/

static int __pyx_f_4lxml_5etree__countNsDefs(xmlNode *__pyx_v_c_node) {
  xmlNs *__pyx_v_c_ns;
  int __pyx_v_count;
  int __pyx_r;
  xmlNs *__pyx_t_1;
  int __pyx_t_2;

  /* "src/lxml/iterparse.pxi":418
 *     cdef xmlNs* c_ns
 *     cdef int count
 *     count = 0             # <<<<<<<<<<<<<<
 *     c_ns = c_node.nsDef
 *     while c_ns is not NULL:
*/
  __pyx_v_count = 0;

  /* "src/lxml/iterparse.pxi":419
 *     cdef int count
 *     count = 0
 *     c_ns = c_node.nsDef             # <<<<<<<<<<<<<<
 *     while c_ns is not NULL:
 *         count += (c_ns.href is not NULL)
*/
  __pyx_t_1 = __pyx_v_c_node->nsDef;
  __pyx_v_c_ns = __pyx_t_1;

  /* "src/lxml/iterparse.pxi":420
 *     count = 0
 *     c_ns = c_node.nsDef
 *     while c_ns is not NULL:             # <<<<<<<<<<<<<<
 *         count += (c_ns.href is not NULL)
 *         c_ns = c_ns.next
*/
  while (1) {
    __pyx_t_2 = (__pyx_v_c_ns != NULL);
    if (!__pyx_t_2) break;

    /* "src/lxml/iterparse.pxi":421
 *     c_ns = c_node.nsDef
 *     while c_ns is not NULL:
 *         count += (c_ns.href is not NULL)             # <<<<<<<<<<<<<<
 *         c_ns = c_ns.next
 *     return count
*/
    __pyx_v_count = (__pyx_v_count + (__pyx_v_c_ns->href != NULL));

    /* "src/lxml/iterparse.pxi":422
 *     while c_ns is not NULL:
 *         count += (c_ns.href is not NULL)
 *         c_ns = c_ns.next             # <<<<<<<<<<<<<<
 *     return count
 * 
*/
    __pyx_t_1 = __pyx_v_c_ns->next;
    __pyx_v_c_ns = __pyx_t_1;
  }

  /* "src/lxml/iterparse.pxi":423
 *         count += (c_ns.href is not NULL)
 *         c_ns = c_ns.next
 *     return count             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = __pyx_v_count;
  goto __pyx_L0;

  /* "src/lxml/iterparse.pxi":415
 * 
 * 
 * cdef int _countNsDefs(xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *     cdef xmlNs* c_ns
 *     cdef int count
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/iterparse.pxi":426
 * 
 * 
 * cdef int _appendStartNsEvents(xmlNode* c_node, list event_list) except -1:             # <<<<<<<<<<<<<<
 *     cdef xmlNs* c_ns
 *     cdef int count
*/

static int __pyx_f_4lxml_5etree__appendStartNsEvents(xmlNode *__pyx_v_c_node, PyObject *__pyx_v_event_list) {
  xmlNs *__pyx_v_c_ns;
  int __pyx_v_count;
  PyObject *__pyx_v_ns_tuple = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  xmlNs *__pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_appendStartNsEvents", 0);

  /* "src/lxml/iterparse.pxi":429
 *     cdef xmlNs* c_ns
 *     cdef int count
 *     count = 0             # <<<<<<<<<<<<<<
 *     c_ns = c_node.nsDef
 *     while c_ns is not NULL:
*/
  __pyx_v_count = 0;

  /* "src/lxml/iterparse.pxi":430
 *     cdef int count
 *     count = 0
 *     c_ns = c_node.nsDef             # <<<<<<<<<<<<<<
 *     while c_ns is not NULL:
 *         if c_ns.href:
*/
  __pyx_t_1 = __pyx_v_c_node->nsDef;
  __pyx_v_c_ns = __pyx_t_1;

  /* "src/lxml/iterparse.pxi":431
 *     count = 0
 *     c_ns = c_node.nsDef
 *     while c_ns is not NULL:             # <<<<<<<<<<<<<<
 *         if c_ns.href:
 *             ns_tuple = (funicodeOrEmpty(c_ns.prefix),
*/
  while (1) {
    __pyx_t_2 = (__pyx_v_c_ns != NULL);
    if (!__pyx_t_2) break;

    /* "src/lxml/iterparse.pxi":432
 *     c_ns = c_node.nsDef
 *     while c_ns is not NULL:
 *         if c_ns.href:             # <<<<<<<<<<<<<<
 *             ns_tuple = (funicodeOrEmpty(c_ns.prefix),
 *                         funicode(c_ns.href))
*/
    __pyx_t_2 = (__pyx_v_c_ns->href != 0);
    if (__pyx_t_2) {

      /* "src/lxml/iterparse.pxi":433
 *     while c_ns is not NULL:
 *         if c_ns.href:
 *             ns_tuple = (funicodeOrEmpty(c_ns.prefix),             # <<<<<<<<<<<<<<
 *                         funicode(c_ns.href))
 *             event_list.append( ("start-ns", ns_tuple) )
*/
      __pyx_t_3 = __pyx_f_4lxml_5etree_funicodeOrEmpty(__pyx_v_c_ns->prefix); if (unlikely(!__pyx_t_3)) __PYX_ERR(14, 433, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);

      /* "src/lxml/iterparse.pxi":434
 *         if c_ns.href:
 *             ns_tuple = (funicodeOrEmpty(c_ns.prefix),
 *                         funicode(c_ns.href))             # <<<<<<<<<<<<<<
 *             event_list.append( ("start-ns", ns_tuple) )
 *             count += 1
*/
      __pyx_t_4 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_ns->href); if (unlikely(!__pyx_t_4)) __PYX_ERR(14, 434, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);

      /* "src/lxml/iterparse.pxi":433
 *     while c_ns is not NULL:
 *         if c_ns.href:
 *             ns_tuple = (funicodeOrEmpty(c_ns.prefix),             # <<<<<<<<<<<<<<
 *                         funicode(c_ns.href))
 *             event_list.append( ("start-ns", ns_tuple) )
*/
      __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(14, 433, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_3);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3) != (0)) __PYX_ERR(14, 433, __pyx_L1_error);
      __Pyx_GIVEREF(__pyx_t_4);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4) != (0)) __PYX_ERR(14, 433, __pyx_L1_error);
      __pyx_t_3 = 0;
      __pyx_t_4 = 0;
      __Pyx_XDECREF_SET(__pyx_v_ns_tuple, ((PyObject*)__pyx_t_5));
      __pyx_t_5 = 0;

      /* "src/lxml/iterparse.pxi":435
 *             ns_tuple = (funicodeOrEmpty(c_ns.prefix),
 *                         funicode(c_ns.href))
 *             event_list.append( ("start-ns", ns_tuple) )             # <<<<<<<<<<<<<<
 *             count += 1
 *         c_ns = c_ns.next
*/
      if (unlikely(__pyx_v_event_list == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
        __PYX_ERR(14, 435, __pyx_L1_error)
      }
      __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(14, 435, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_start_ns);
      __Pyx_GIVEREF(__pyx_mstate_global->__pyx_kp_u_start_ns);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_mstate_global->__pyx_kp_u_start_ns) != (0)) __PYX_ERR(14, 435, __pyx_L1_error);
      __Pyx_INCREF(__pyx_v_ns_tuple);
      __Pyx_GIVEREF(__pyx_v_ns_tuple);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_ns_tuple) != (0)) __PYX_ERR(14, 435, __pyx_L1_error);
      __pyx_t_6 = __Pyx_PyList_Append(__pyx_v_event_list, __pyx_t_5); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(14, 435, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "src/lxml/iterparse.pxi":436
 *                         funicode(c_ns.href))
 *             event_list.append( ("start-ns", ns_tuple) )
 *             count += 1             # <<<<<<<<<<<<<<
 *         c_ns = c_ns.next
 *     return count
*/
      __pyx_v_count = (__pyx_v_count + 1);

      /* "src/lxml/iterparse.pxi":432
 *     c_ns = c_node.nsDef
 *     while c_ns is not NULL:
 *         if c_ns.href:             # <<<<<<<<<<<<<<
 *             ns_tuple = (funicodeOrEmpty(c_ns.prefix),
 *                         funicode(c_ns.href))
*/
    }

    /* "src/lxml/iterparse.pxi":437
 *             event_list.append( ("start-ns", ns_tuple) )
 *             count += 1
 *         c_ns = c_ns.next             # <<<<<<<<<<<<<<
 *     return count
*/
    __pyx_t_1 = __pyx_v_c_ns->next;
    __pyx_v_c_ns = __pyx_t_1;
  }

  /* "src/lxml/iterparse.pxi":438
 *             count += 1
 *         c_ns = c_ns.next
 *     return count             # <<<<<<<<<<<<<<
*/
  __pyx_r = __pyx_v_count;
  goto __pyx_L0;

  /* "src/lxml/iterparse.pxi":426
 * 
 * 
 * cdef int _appendStartNsEvents(xmlNode* c_node, list event_list) except -1:             # <<<<<<<<<<<<<<
 *     cdef xmlNs* c_ns
 *     cdef int count
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._appendStartNsEvents", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ns_tuple);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlid.pxi":3
 * cdef object _find_id_attributes
 * 
 * def XMLID(text, parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     """XMLID(text, parser=None, base_url=None)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_54XMLID(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_53XMLID, "XMLID(text, parser=None, base_url=None)\n\n    Parse the text and return a tuple (root node, ID dictionary).  The root\n    node is the same as returned by the XML() function.  The dictionary\n    contains string-element pairs.  The dictionary keys are the values of 'id'\n    attributes.  The elements referenced by the ID are stored as dictionary\n    values.\n    ");
static PyMethodDef __pyx_mdef_4lxml_5etree_54XMLID = {"XMLID", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_54XMLID, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_53XMLID};
static PyObject *__pyx_pw_4lxml_5etree_54XMLID(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_text = 0;
  PyObject *__pyx_v_parser = 0;
  PyObject *__pyx_v_base_url = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("XMLID (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_text,&__pyx_mstate_global->__pyx_n_u_parser,&__pyx_mstate_global->__pyx_n_u_base_url,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(15, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(15, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(15, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "XMLID", 0) < (0)) __PYX_ERR(15, 3, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("XMLID", 0, 1, 2, i); __PYX_ERR(15, 3, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(15, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(15, 3, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_text = values[0];
    __pyx_v_parser = values[1];
    __pyx_v_base_url = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("XMLID", 0, 1, 2, __pyx_nargs); __PYX_ERR(15, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.XMLID", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_53XMLID(__pyx_self, __pyx_v_text, __pyx_v_parser, __pyx_v_base_url);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_53XMLID(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_text, PyObject *__pyx_v_parser, PyObject *__pyx_v_base_url) {
  PyObject *__pyx_v_dic = 0;
  PyObject *__pyx_v_root = NULL;
  PyObject *__pyx_v_elem = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  PyObject *(*__pyx_t_8)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("XMLID", 0);

  /* "src/lxml/xmlid.pxi":14
 *     cdef dict dic
 *     global _find_id_attributes
 *     if _find_id_attributes is None:             # <<<<<<<<<<<<<<
 *         _find_id_attributes = XPath('//[inserted by cython to avoid comment start]*[string(@id)]')
 * 
*/
  __pyx_t_1 = (__pyx_v_4lxml_5etree__find_id_attributes == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/xmlid.pxi":15
 *     global _find_id_attributes
 *     if _find_id_attributes is None:
 *         _find_id_attributes = XPath('//[inserted by cython to avoid comment start]*[string(@id)]')             # <<<<<<<<<<<<<<
 * 
 *     # ElementTree compatible implementation: parse and look for 'id' attributes
*/
    __pyx_t_3 = NULL;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_string_id};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XPath, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(15, 15, __pyx_L1_error)
      __Pyx_GOTREF((PyObject *)__pyx_t_2);
    }
    __Pyx_XGOTREF(__pyx_v_4lxml_5etree__find_id_attributes);
    __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__find_id_attributes, ((PyObject *)__pyx_t_2));
    __Pyx_GIVEREF((PyObject *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/xmlid.pxi":14
 *     cdef dict dic
 *     global _find_id_attributes
 *     if _find_id_attributes is None:             # <<<<<<<<<<<<<<
 *         _find_id_attributes = XPath('//[inserted by cython to avoid comment start]*[string(@id)]')
 * 
*/
  }

  /* "src/lxml/xmlid.pxi":18
 * 
 *     # ElementTree compatible implementation: parse and look for 'id' attributes
 *     root = XML(text, parser, base_url=base_url)             # <<<<<<<<<<<<<<
 *     dic = {}
 *     for elem in _find_id_attributes(root):
*/
  __pyx_t_3 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_XML); if (unlikely(!__pyx_t_5)) __PYX_ERR(15, 18, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
    assert(__pyx_t_3);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
    __pyx_t_4 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[3 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_3, __pyx_v_text, __pyx_v_parser};
    __pyx_t_6 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(15, 18, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_base_url, __pyx_v_base_url, __pyx_t_6, __pyx_callargs+3, 0) < (0)) __PYX_ERR(15, 18, __pyx_L1_error)
    __pyx_t_2 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(15, 18, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_v_root = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "src/lxml/xmlid.pxi":19
 *     # ElementTree compatible implementation: parse and look for 'id' attributes
 *     root = XML(text, parser, base_url=base_url)
 *     dic = {}             # <<<<<<<<<<<<<<
 *     for elem in _find_id_attributes(root):
 *         dic[elem.get('id')] = elem
*/
  __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(15, 19, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_dic = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/xmlid.pxi":20
 *     root = XML(text, parser, base_url=base_url)
 *     dic = {}
 *     for elem in _find_id_attributes(root):             # <<<<<<<<<<<<<<
 *         dic[elem.get('id')] = elem
 *     return root, dic
*/
  __pyx_t_5 = NULL;
  __Pyx_INCREF(__pyx_v_4lxml_5etree__find_id_attributes);
  __pyx_t_6 = __pyx_v_4lxml_5etree__find_id_attributes; 
  __pyx_t_4 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
    assert(__pyx_t_5);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
    __pyx_t_4 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_root};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(15, 20, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
    __pyx_t_6 = __pyx_t_2; __Pyx_INCREF(__pyx_t_6);
    __pyx_t_7 = 0;
    __pyx_t_8 = NULL;
  } else {
    __pyx_t_7 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(15, 20, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(15, 20, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  for (;;) {
    if (likely(!__pyx_t_8)) {
      if (likely(PyList_CheckExact(__pyx_t_6))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_6);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(15, 20, __pyx_L1_error)
          #endif
          if (__pyx_t_7 >= __pyx_temp) break;
        }
        __pyx_t_2 = __Pyx_PyList_GetItemRefFast(__pyx_t_6, __pyx_t_7, __Pyx_ReferenceSharing_OwnStrongReference);
        ++__pyx_t_7;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_6);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(15, 20, __pyx_L1_error)
          #endif
          if (__pyx_t_7 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_7));
        #else
        __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_7);
        #endif
        ++__pyx_t_7;
      }
      if (unlikely(!__pyx_t_2)) __PYX_ERR(15, 20, __pyx_L1_error)
    } else {
      __pyx_t_2 = __pyx_t_8(__pyx_t_6);
      if (unlikely(!__pyx_t_2)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(15, 20, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XDECREF_SET(__pyx_v_elem, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/xmlid.pxi":21
 *     dic = {}
 *     for elem in _find_id_attributes(root):
 *         dic[elem.get('id')] = elem             # <<<<<<<<<<<<<<
 *     return root, dic
 * 
*/
    __pyx_t_5 = __pyx_v_elem;
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_4 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_n_u_id};
      __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(15, 21, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    if (unlikely((PyDict_SetItem(__pyx_v_dic, __pyx_t_2, __pyx_v_elem) < 0))) __PYX_ERR(15, 21, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/xmlid.pxi":20
 *     root = XML(text, parser, base_url=base_url)
 *     dic = {}
 *     for elem in _find_id_attributes(root):             # <<<<<<<<<<<<<<
 *         dic[elem.get('id')] = elem
 *     return root, dic
*/
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "src/lxml/xmlid.pxi":22
 *     for elem in _find_id_attributes(root):
 *         dic[elem.get('id')] = elem
 *     return root, dic             # <<<<<<<<<<<<<<
 * 
 * def XMLDTDID(text, parser=None, *, base_url=None):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(15, 22, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(__pyx_v_root);
  __Pyx_GIVEREF(__pyx_v_root);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_root) != (0)) __PYX_ERR(15, 22, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_dic);
  __Pyx_GIVEREF(__pyx_v_dic);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_dic) != (0)) __PYX_ERR(15, 22, __pyx_L1_error);
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "src/lxml/xmlid.pxi":3
 * cdef object _find_id_attributes
 * 
 * def XMLID(text, parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     """XMLID(text, parser=None, base_url=None)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree.XMLID", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_dic);
  __Pyx_XDECREF(__pyx_v_root);
  __Pyx_XDECREF(__pyx_v_elem);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlid.pxi":24
 *     return root, dic
 * 
 * def XMLDTDID(text, parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     """XMLDTDID(text, parser=None, base_url=None)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_56XMLDTDID(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_55XMLDTDID, "XMLDTDID(text, parser=None, base_url=None)\n\n    Parse the text and return a tuple (root node, ID dictionary).  The root\n    node is the same as returned by the XML() function.  The dictionary\n    contains string-element pairs.  The dictionary keys are the values of ID\n    attributes as defined by the DTD.  The elements referenced by the ID are\n    stored as dictionary values.\n\n    Note that you must not modify the XML tree if you use the ID dictionary.\n    The results are undefined.\n    ");
static PyMethodDef __pyx_mdef_4lxml_5etree_56XMLDTDID = {"XMLDTDID", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_56XMLDTDID, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_55XMLDTDID};
static PyObject *__pyx_pw_4lxml_5etree_56XMLDTDID(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_text = 0;
  PyObject *__pyx_v_parser = 0;
  PyObject *__pyx_v_base_url = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("XMLDTDID (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_text,&__pyx_mstate_global->__pyx_n_u_parser,&__pyx_mstate_global->__pyx_n_u_base_url,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(15, 24, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(15, 24, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(15, 24, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "XMLDTDID", 0) < (0)) __PYX_ERR(15, 24, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("XMLDTDID", 0, 1, 2, i); __PYX_ERR(15, 24, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(15, 24, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(15, 24, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_text = values[0];
    __pyx_v_parser = values[1];
    __pyx_v_base_url = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("XMLDTDID", 0, 1, 2, __pyx_nargs); __PYX_ERR(15, 24, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.XMLDTDID", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_55XMLDTDID(__pyx_self, __pyx_v_text, __pyx_v_parser, __pyx_v_base_url);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_55XMLDTDID(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_text, PyObject *__pyx_v_parser, PyObject *__pyx_v_base_url) {
  struct LxmlElement *__pyx_v_root = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("XMLDTDID", 0);

  /* "src/lxml/xmlid.pxi":37
 *     """
 *     cdef _Element root
 *     root = XML(text, parser, base_url=base_url)             # <<<<<<<<<<<<<<
 *     # xml:id spec compatible implementation: use DTD ID attributes from libxml2
 *     if root._doc._c_doc.ids is NULL:
*/
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_XML); if (unlikely(!__pyx_t_3)) __PYX_ERR(15, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_4 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[3 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_2, __pyx_v_text, __pyx_v_parser};
    __pyx_t_5 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(15, 37, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_base_url, __pyx_v_base_url, __pyx_t_5, __pyx_callargs+3, 0) < (0)) __PYX_ERR(15, 37, __pyx_L1_error)
    __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_5);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(15, 37, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element))))) __PYX_ERR(15, 37, __pyx_L1_error)
  __pyx_v_root = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xmlid.pxi":39
 *     root = XML(text, parser, base_url=base_url)
 *     # xml:id spec compatible implementation: use DTD ID attributes from libxml2
 *     if root._doc._c_doc.ids is NULL:             # <<<<<<<<<<<<<<
 *         return root, {}
 *     else:
*/
  __pyx_t_6 = (__pyx_v_root->_doc->_c_doc->ids == NULL);
  if (__pyx_t_6) {

    /* "src/lxml/xmlid.pxi":40
 *     # xml:id spec compatible implementation: use DTD ID attributes from libxml2
 *     if root._doc._c_doc.ids is NULL:
 *         return root, {}             # <<<<<<<<<<<<<<
 *     else:
 *         return root, _IDDict(root)
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(15, 40, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(15, 40, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF((PyObject *)__pyx_v_root);
    __Pyx_GIVEREF((PyObject *)__pyx_v_root);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_root)) != (0)) __PYX_ERR(15, 40, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1) != (0)) __PYX_ERR(15, 40, __pyx_L1_error);
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "src/lxml/xmlid.pxi":39
 *     root = XML(text, parser, base_url=base_url)
 *     # xml:id spec compatible implementation: use DTD ID attributes from libxml2
 *     if root._doc._c_doc.ids is NULL:             # <<<<<<<<<<<<<<
 *         return root, {}
 *     else:
*/
  }

  /* "src/lxml/xmlid.pxi":42
 *         return root, {}
 *     else:
 *         return root, _IDDict(root)             # <<<<<<<<<<<<<<
 * 
 * def parseid(source, parser=None, *, base_url=None):
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = NULL;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_1, ((PyObject *)__pyx_v_root)};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__IDDict, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(15, 42, __pyx_L1_error)
      __Pyx_GOTREF((PyObject *)__pyx_t_3);
    }
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(15, 42, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF((PyObject *)__pyx_v_root);
    __Pyx_GIVEREF((PyObject *)__pyx_v_root);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_root)) != (0)) __PYX_ERR(15, 42, __pyx_L1_error);
    __Pyx_GIVEREF((PyObject *)__pyx_t_3);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_t_3)) != (0)) __PYX_ERR(15, 42, __pyx_L1_error);
    __pyx_t_3 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
  }

  /* "src/lxml/xmlid.pxi":24
 *     return root, dic
 * 
 * def XMLDTDID(text, parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     """XMLDTDID(text, parser=None, base_url=None)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree.XMLDTDID", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_root);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlid.pxi":44
 *         return root, _IDDict(root)
 * 
 * def parseid(source, parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     """parseid(source, parser=None)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_58parseid(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_57parseid, "parseid(source, parser=None)\n\n    Parses the source into a tuple containing an ElementTree object and an\n    ID dictionary.  If no parser is provided as second argument, the default\n    parser is used.\n\n    Note that you must not modify the XML tree if you use the ID dictionary.\n    The results are undefined.\n    ");
static PyMethodDef __pyx_mdef_4lxml_5etree_58parseid = {"parseid", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_58parseid, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_57parseid};
static PyObject *__pyx_pw_4lxml_5etree_58parseid(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_source = 0;
  PyObject *__pyx_v_parser = 0;
  PyObject *__pyx_v_base_url = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("parseid (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_source,&__pyx_mstate_global->__pyx_n_u_parser,&__pyx_mstate_global->__pyx_n_u_base_url,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(15, 44, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(15, 44, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(15, 44, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "parseid", 0) < (0)) __PYX_ERR(15, 44, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("parseid", 0, 1, 2, i); __PYX_ERR(15, 44, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(15, 44, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(15, 44, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_source = values[0];
    __pyx_v_parser = values[1];
    __pyx_v_base_url = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("parseid", 0, 1, 2, __pyx_nargs); __PYX_ERR(15, 44, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.parseid", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_57parseid(__pyx_self, __pyx_v_source, __pyx_v_parser, __pyx_v_base_url);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_57parseid(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_source, PyObject *__pyx_v_parser, PyObject *__pyx_v_base_url) {
  struct LxmlDocument *__pyx_v_doc = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("parseid", 0);

  /* "src/lxml/xmlid.pxi":55
 *     """
 *     cdef _Document doc
 *     doc = _parseDocument(source, parser, base_url)             # <<<<<<<<<<<<<<
 *     return _elementTreeFactory(doc, None), _IDDict(doc)
 * 
*/
  if (!(likely(((__pyx_v_parser) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_parser, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__BaseParser))))) __PYX_ERR(15, 55, __pyx_L1_error)
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__parseDocument(__pyx_v_source, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_parser), __pyx_v_base_url)); if (unlikely(!__pyx_t_1)) __PYX_ERR(15, 55, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xmlid.pxi":56
 *     cdef _Document doc
 *     doc = _parseDocument(source, parser, base_url)
 *     return _elementTreeFactory(doc, None), _IDDict(doc)             # <<<<<<<<<<<<<<
 * 
 * cdef class _IDDict:
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__elementTreeFactory(__pyx_v_doc, ((struct LxmlElement *)Py_None))); if (unlikely(!__pyx_t_1)) __PYX_ERR(15, 56, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, ((PyObject *)__pyx_v_doc)};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__IDDict, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(15, 56, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_2);
  }
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(15, 56, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1) != (0)) __PYX_ERR(15, 56, __pyx_L1_error);
  __Pyx_GIVEREF((PyObject *)__pyx_t_2);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_t_2)) != (0)) __PYX_ERR(15, 56, __pyx_L1_error);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "src/lxml/xmlid.pxi":44
 *         return root, _IDDict(root)
 * 
 * def parseid(source, parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     """parseid(source, parser=None)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.parseid", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlid.pxi":69
 *     cdef object _keys
 *     cdef object _items
 *     def __cinit__(self, etree):             # <<<<<<<<<<<<<<
 *         cdef _Document doc
 *         doc = _documentOrRaise(etree)
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_7_IDDict_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_7_IDDict_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_etree = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_etree,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(15, 69, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(15, 69, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__cinit__", 0) < (0)) __PYX_ERR(15, 69, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, i); __PYX_ERR(15, 69, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(15, 69, __pyx_L3_error)
    }
    __pyx_v_etree = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, __pyx_nargs); __PYX_ERR(15, 69, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._IDDict.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_7_IDDict___cinit__(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self), __pyx_v_etree);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_7_IDDict___cinit__(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self, PyObject *__pyx_v_etree) {
  struct LxmlDocument *__pyx_v_doc = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "src/lxml/xmlid.pxi":71
 *     def __cinit__(self, etree):
 *         cdef _Document doc
 *         doc = _documentOrRaise(etree)             # <<<<<<<<<<<<<<
 *         if doc._c_doc.ids is NULL:
 *             raise ValueError, "No ID dictionary available."
*/
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__documentOrRaise(__pyx_v_etree)); if (unlikely(!__pyx_t_1)) __PYX_ERR(15, 71, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xmlid.pxi":72
 *         cdef _Document doc
 *         doc = _documentOrRaise(etree)
 *         if doc._c_doc.ids is NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError, "No ID dictionary available."
 *         self._doc = doc
*/
  __pyx_t_2 = (__pyx_v_doc->_c_doc->ids == NULL);
  if (unlikely(__pyx_t_2)) {

    /* "src/lxml/xmlid.pxi":73
 *         doc = _documentOrRaise(etree)
 *         if doc._c_doc.ids is NULL:
 *             raise ValueError, "No ID dictionary available."             # <<<<<<<<<<<<<<
 *         self._doc = doc
 *         self._keys  = None
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_No_ID_dictionary_available, 0, 0);
    __PYX_ERR(15, 73, __pyx_L1_error)

    /* "src/lxml/xmlid.pxi":72
 *         cdef _Document doc
 *         doc = _documentOrRaise(etree)
 *         if doc._c_doc.ids is NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError, "No ID dictionary available."
 *         self._doc = doc
*/
  }

  /* "src/lxml/xmlid.pxi":74
 *         if doc._c_doc.ids is NULL:
 *             raise ValueError, "No ID dictionary available."
 *         self._doc = doc             # <<<<<<<<<<<<<<
 *         self._keys  = None
 *         self._items = None
*/
  __Pyx_INCREF((PyObject *)__pyx_v_doc);
  __Pyx_GIVEREF((PyObject *)__pyx_v_doc);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_doc);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_doc);
  __pyx_v_self->_doc = __pyx_v_doc;

  /* "src/lxml/xmlid.pxi":75
 *             raise ValueError, "No ID dictionary available."
 *         self._doc = doc
 *         self._keys  = None             # <<<<<<<<<<<<<<
 *         self._items = None
 * 
*/
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_keys);
  __Pyx_DECREF(__pyx_v_self->_keys);
  __pyx_v_self->_keys = Py_None;

  /* "src/lxml/xmlid.pxi":76
 *         self._doc = doc
 *         self._keys  = None
 *         self._items = None             # <<<<<<<<<<<<<<
 * 
 *     def copy(self):
*/
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_items);
  __Pyx_DECREF(__pyx_v_self->_items);
  __pyx_v_self->_items = Py_None;

  /* "src/lxml/xmlid.pxi":69
 *     cdef object _keys
 *     cdef object _items
 *     def __cinit__(self, etree):             # <<<<<<<<<<<<<<
 *         cdef _Document doc
 *         doc = _documentOrRaise(etree)
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._IDDict.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlid.pxi":78
 *         self._items = None
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         return _IDDict(self._doc)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_IDDict_3copy(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_7_IDDict_3copy = {"copy", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_IDDict_3copy, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_7_IDDict_3copy(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("copy", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("copy", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_7_IDDict_2copy(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_2copy(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy", 0);

  /* "src/lxml/xmlid.pxi":79
 * 
 *     def copy(self):
 *         return _IDDict(self._doc)             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, id_name):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = NULL;
  __pyx_t_3 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, ((PyObject *)__pyx_v_self->_doc)};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__IDDict, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(15, 79, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __pyx_r = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/xmlid.pxi":78
 *         self._items = None
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         return _IDDict(self._doc)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._IDDict.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlid.pxi":81
 *         return _IDDict(self._doc)
 * 
 *     def __getitem__(self, id_name):             # <<<<<<<<<<<<<<
 *         cdef tree.xmlHashTable* c_ids
 *         cdef tree.xmlID* c_id
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_IDDict_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_id_name); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7_IDDict_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_id_name) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_7_IDDict_4__getitem__(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self), ((PyObject *)__pyx_v_id_name));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_4__getitem__(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self, PyObject *__pyx_v_id_name) {
  xmlHashTable *__pyx_v_c_ids;
  xmlID *__pyx_v_c_id;
  xmlAttr *__pyx_v_c_attr;
  PyObject *__pyx_v_id_utf = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  xmlHashTable *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  xmlAttr *__pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "src/lxml/xmlid.pxi":85
 *         cdef tree.xmlID* c_id
 *         cdef xmlAttr* c_attr
 *         c_ids = self._doc._c_doc.ids             # <<<<<<<<<<<<<<
 *         id_utf = _utf8(id_name)
 *         c_id = <tree.xmlID*>tree.xmlHashLookup(c_ids, _xcstr(id_utf))
*/
  __pyx_t_1 = __pyx_v_self->_doc->_c_doc->ids;
  __pyx_v_c_ids = __pyx_t_1;

  /* "src/lxml/xmlid.pxi":86
 *         cdef xmlAttr* c_attr
 *         c_ids = self._doc._c_doc.ids
 *         id_utf = _utf8(id_name)             # <<<<<<<<<<<<<<
 *         c_id = <tree.xmlID*>tree.xmlHashLookup(c_ids, _xcstr(id_utf))
 *         if c_id is NULL:
*/
  __pyx_t_2 = __pyx_f_4lxml_5etree__utf8(__pyx_v_id_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(15, 86, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_id_utf = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/xmlid.pxi":87
 *         c_ids = self._doc._c_doc.ids
 *         id_utf = _utf8(id_name)
 *         c_id = <tree.xmlID*>tree.xmlHashLookup(c_ids, _xcstr(id_utf))             # <<<<<<<<<<<<<<
 *         if c_id is NULL:
 *             raise KeyError, "key not found."
*/
  __pyx_v_c_id = ((xmlID *)xmlHashLookup(__pyx_v_c_ids, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_id_utf)));

  /* "src/lxml/xmlid.pxi":88
 *         id_utf = _utf8(id_name)
 *         c_id = <tree.xmlID*>tree.xmlHashLookup(c_ids, _xcstr(id_utf))
 *         if c_id is NULL:             # <<<<<<<<<<<<<<
 *             raise KeyError, "key not found."
 *         c_attr = c_id.attr
*/
  __pyx_t_3 = (__pyx_v_c_id == NULL);
  if (unlikely(__pyx_t_3)) {

    /* "src/lxml/xmlid.pxi":89
 *         c_id = <tree.xmlID*>tree.xmlHashLookup(c_ids, _xcstr(id_utf))
 *         if c_id is NULL:
 *             raise KeyError, "key not found."             # <<<<<<<<<<<<<<
 *         c_attr = c_id.attr
 *         if c_attr is NULL or c_attr.parent is NULL:
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_KeyError))), __pyx_mstate_global->__pyx_kp_u_key_not_found, 0, 0);
    __PYX_ERR(15, 89, __pyx_L1_error)

    /* "src/lxml/xmlid.pxi":88
 *         id_utf = _utf8(id_name)
 *         c_id = <tree.xmlID*>tree.xmlHashLookup(c_ids, _xcstr(id_utf))
 *         if c_id is NULL:             # <<<<<<<<<<<<<<
 *             raise KeyError, "key not found."
 *         c_attr = c_id.attr
*/
  }

  /* "src/lxml/xmlid.pxi":90
 *         if c_id is NULL:
 *             raise KeyError, "key not found."
 *         c_attr = c_id.attr             # <<<<<<<<<<<<<<
 *         if c_attr is NULL or c_attr.parent is NULL:
 *             raise KeyError, "ID attribute not found."
*/
  __pyx_t_4 = __pyx_v_c_id->attr;
  __pyx_v_c_attr = __pyx_t_4;

  /* "src/lxml/xmlid.pxi":91
 *             raise KeyError, "key not found."
 *         c_attr = c_id.attr
 *         if c_attr is NULL or c_attr.parent is NULL:             # <<<<<<<<<<<<<<
 *             raise KeyError, "ID attribute not found."
 *         return _elementFactory(self._doc, c_attr.parent)
*/
  __pyx_t_5 = (__pyx_v_c_attr == NULL);
  if (!__pyx_t_5) {
  } else {
    __pyx_t_3 = __pyx_t_5;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_5 = (__pyx_v_c_attr->parent == NULL);
  __pyx_t_3 = __pyx_t_5;
  __pyx_L5_bool_binop_done:;
  if (unlikely(__pyx_t_3)) {

    /* "src/lxml/xmlid.pxi":92
 *         c_attr = c_id.attr
 *         if c_attr is NULL or c_attr.parent is NULL:
 *             raise KeyError, "ID attribute not found."             # <<<<<<<<<<<<<<
 *         return _elementFactory(self._doc, c_attr.parent)
 * 
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_KeyError))), __pyx_mstate_global->__pyx_kp_u_ID_attribute_not_found, 0, 0);
    __PYX_ERR(15, 92, __pyx_L1_error)

    /* "src/lxml/xmlid.pxi":91
 *             raise KeyError, "key not found."
 *         c_attr = c_id.attr
 *         if c_attr is NULL or c_attr.parent is NULL:             # <<<<<<<<<<<<<<
 *             raise KeyError, "ID attribute not found."
 *         return _elementFactory(self._doc, c_attr.parent)
*/
  }

  /* "src/lxml/xmlid.pxi":93
 *         if c_attr is NULL or c_attr.parent is NULL:
 *             raise KeyError, "ID attribute not found."
 *         return _elementFactory(self._doc, c_attr.parent)             # <<<<<<<<<<<<<<
 * 
 *     def get(self, id_name):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_v_self->_doc);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_6 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_2), __pyx_v_c_attr->parent)); if (unlikely(!__pyx_t_6)) __PYX_ERR(15, 93, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "src/lxml/xmlid.pxi":81
 *         return _IDDict(self._doc)
 * 
 *     def __getitem__(self, id_name):             # <<<<<<<<<<<<<<
 *         cdef tree.xmlHashTable* c_ids
 *         cdef tree.xmlID* c_id
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._IDDict.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_id_utf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlid.pxi":95
 *         return _elementFactory(self._doc, c_attr.parent)
 * 
 *     def get(self, id_name):             # <<<<<<<<<<<<<<
 *         return self[id_name]
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_IDDict_7get(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_7_IDDict_7get = {"get", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_IDDict_7get, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_7_IDDict_7get(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_id_name = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_id_name,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(15, 95, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(15, 95, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "get", 0) < (0)) __PYX_ERR(15, 95, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("get", 1, 1, 1, i); __PYX_ERR(15, 95, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(15, 95, __pyx_L3_error)
    }
    __pyx_v_id_name = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get", 1, 1, 1, __pyx_nargs); __PYX_ERR(15, 95, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._IDDict.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_7_IDDict_6get(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self), __pyx_v_id_name);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_6get(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self, PyObject *__pyx_v_id_name) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get", 0);

  /* "src/lxml/xmlid.pxi":96
 * 
 *     def get(self, id_name):
 *         return self[id_name]             # <<<<<<<<<<<<<<
 * 
 *     def __contains__(self, id_name):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_id_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(15, 96, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/xmlid.pxi":95
 *         return _elementFactory(self._doc, c_attr.parent)
 * 
 *     def get(self, id_name):             # <<<<<<<<<<<<<<
 *         return self[id_name]
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._IDDict.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlid.pxi":98
 *         return self[id_name]
 * 
 *     def __contains__(self, id_name):             # <<<<<<<<<<<<<<
 *         cdef tree.xmlID* c_id
 *         id_utf = _utf8(id_name)
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_7_IDDict_9__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_id_name); /*proto*/
static int __pyx_pw_4lxml_5etree_7_IDDict_9__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_id_name) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_7_IDDict_8__contains__(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self), ((PyObject *)__pyx_v_id_name));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_7_IDDict_8__contains__(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self, PyObject *__pyx_v_id_name) {
  xmlID *__pyx_v_c_id;
  PyObject *__pyx_v_id_utf = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__contains__", 0);

  /* "src/lxml/xmlid.pxi":100
 *     def __contains__(self, id_name):
 *         cdef tree.xmlID* c_id
 *         id_utf = _utf8(id_name)             # <<<<<<<<<<<<<<
 *         c_id = <tree.xmlID*>tree.xmlHashLookup(
 *             self._doc._c_doc.ids, _xcstr(id_utf))
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__utf8(__pyx_v_id_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(15, 100, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_id_utf = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xmlid.pxi":101
 *         cdef tree.xmlID* c_id
 *         id_utf = _utf8(id_name)
 *         c_id = <tree.xmlID*>tree.xmlHashLookup(             # <<<<<<<<<<<<<<
 *             self._doc._c_doc.ids, _xcstr(id_utf))
 *         return c_id is not NULL
*/
  __pyx_v_c_id = ((xmlID *)xmlHashLookup(__pyx_v_self->_doc->_c_doc->ids, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_id_utf)));

  /* "src/lxml/xmlid.pxi":103
 *         c_id = <tree.xmlID*>tree.xmlHashLookup(
 *             self._doc._c_doc.ids, _xcstr(id_utf))
 *         return c_id is not NULL             # <<<<<<<<<<<<<<
 * 
 *     def has_key(self, id_name):
*/
  __pyx_r = (__pyx_v_c_id != NULL);
  goto __pyx_L0;

  /* "src/lxml/xmlid.pxi":98
 *         return self[id_name]
 * 
 *     def __contains__(self, id_name):             # <<<<<<<<<<<<<<
 *         cdef tree.xmlID* c_id
 *         id_utf = _utf8(id_name)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._IDDict.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_id_utf);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlid.pxi":105
 *         return c_id is not NULL
 * 
 *     def has_key(self, id_name):             # <<<<<<<<<<<<<<
 *         return id_name in self
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_IDDict_11has_key(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_7_IDDict_11has_key = {"has_key", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_IDDict_11has_key, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_7_IDDict_11has_key(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_id_name = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("has_key (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_id_name,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(15, 105, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(15, 105, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "has_key", 0) < (0)) __PYX_ERR(15, 105, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("has_key", 1, 1, 1, i); __PYX_ERR(15, 105, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(15, 105, __pyx_L3_error)
    }
    __pyx_v_id_name = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("has_key", 1, 1, 1, __pyx_nargs); __PYX_ERR(15, 105, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._IDDict.has_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_7_IDDict_10has_key(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self), __pyx_v_id_name);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_10has_key(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self, PyObject *__pyx_v_id_name) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("has_key", 0);

  /* "src/lxml/xmlid.pxi":106
 * 
 *     def has_key(self, id_name):
 *         return id_name in self             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_v_id_name, ((PyObject *)__pyx_v_self), Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(15, 106, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(15, 106, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/xmlid.pxi":105
 *         return c_id is not NULL
 * 
 *     def has_key(self, id_name):             # <<<<<<<<<<<<<<
 *         return id_name in self
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._IDDict.has_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlid.pxi":108
 *         return id_name in self
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return repr(dict(self))
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_IDDict_13__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7_IDDict_13__repr__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_7_IDDict_12__repr__(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_12__repr__(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "src/lxml/xmlid.pxi":109
 * 
 *     def __repr__(self):
 *         return repr(dict(self))             # <<<<<<<<<<<<<<
 * 
 *     def keys(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = NULL;
  __pyx_t_3 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, ((PyObject *)__pyx_v_self)};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(&PyDict_Type), __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(15, 109, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_2 = PyObject_Repr(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(15, 109, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/xmlid.pxi":108
 *         return id_name in self
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return repr(dict(self))
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._IDDict.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlid.pxi":111
 *         return repr(dict(self))
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         if self._keys is None:
 *             self._keys = self._build_keys()
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_IDDict_15keys(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_7_IDDict_15keys = {"keys", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_IDDict_15keys, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_7_IDDict_15keys(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("keys (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("keys", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("keys", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_7_IDDict_14keys(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_14keys(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("keys", 0);

  /* "src/lxml/xmlid.pxi":112
 * 
 *     def keys(self):
 *         if self._keys is None:             # <<<<<<<<<<<<<<
 *             self._keys = self._build_keys()
 *         return self._keys[:]
*/
  __pyx_t_1 = (__pyx_v_self->_keys == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/xmlid.pxi":113
 *     def keys(self):
 *         if self._keys is None:
 *             self._keys = self._build_keys()             # <<<<<<<<<<<<<<
 *         return self._keys[:]
 * 
*/
    __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__IDDict *)__pyx_v_self->__pyx_vtab)->_build_keys(__pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(15, 113, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_GOTREF(__pyx_v_self->_keys);
    __Pyx_DECREF(__pyx_v_self->_keys);
    __pyx_v_self->_keys = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "src/lxml/xmlid.pxi":112
 * 
 *     def keys(self):
 *         if self._keys is None:             # <<<<<<<<<<<<<<
 *             self._keys = self._build_keys()
 *         return self._keys[:]
*/
  }

  /* "src/lxml/xmlid.pxi":114
 *         if self._keys is None:
 *             self._keys = self._build_keys()
 *         return self._keys[:]             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_self->_keys, 0, 0, NULL, NULL, &__pyx_mstate_global->__pyx_slice[0], 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(15, 114, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/xmlid.pxi":111
 *         return repr(dict(self))
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         if self._keys is None:
 *             self._keys = self._build_keys()
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._IDDict.keys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlid.pxi":116
 *         return self._keys[:]
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         if self._keys is None:
 *             self._keys = self._build_keys()
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_IDDict_17__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7_IDDict_17__iter__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_7_IDDict_16__iter__(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_16__iter__(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "src/lxml/xmlid.pxi":117
 * 
 *     def __iter__(self):
 *         if self._keys is None:             # <<<<<<<<<<<<<<
 *             self._keys = self._build_keys()
 *         return iter(self._keys)
*/
  __pyx_t_1 = (__pyx_v_self->_keys == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/xmlid.pxi":118
 *     def __iter__(self):
 *         if self._keys is None:
 *             self._keys = self._build_keys()             # <<<<<<<<<<<<<<
 *         return iter(self._keys)
 * 
*/
    __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__IDDict *)__pyx_v_self->__pyx_vtab)->_build_keys(__pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(15, 118, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_GOTREF(__pyx_v_self->_keys);
    __Pyx_DECREF(__pyx_v_self->_keys);
    __pyx_v_self->_keys = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "src/lxml/xmlid.pxi":117
 * 
 *     def __iter__(self):
 *         if self._keys is None:             # <<<<<<<<<<<<<<
 *             self._keys = self._build_keys()
 *         return iter(self._keys)
*/
  }

  /* "src/lxml/xmlid.pxi":119
 *         if self._keys is None:
 *             self._keys = self._build_keys()
 *         return iter(self._keys)             # <<<<<<<<<<<<<<
 * 
 *     def iterkeys(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_v_self->_keys;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(15, 119, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "src/lxml/xmlid.pxi":116
 *         return self._keys[:]
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         if self._keys is None:
 *             self._keys = self._build_keys()
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._IDDict.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlid.pxi":121
 *         return iter(self._keys)
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_IDDict_19iterkeys(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_7_IDDict_19iterkeys = {"iterkeys", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_IDDict_19iterkeys, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_7_IDDict_19iterkeys(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iterkeys (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("iterkeys", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("iterkeys", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_7_IDDict_18iterkeys(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_18iterkeys(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iterkeys", 0);

  /* "src/lxml/xmlid.pxi":122
 * 
 *     def iterkeys(self):
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "src/lxml/xmlid.pxi":121
 *         return iter(self._keys)
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlid.pxi":124
 *         return self
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         if self._keys is None:
 *             self._keys = self._build_keys()
*/

/* Python wrapper */
static Py_ssize_t __pyx_pw_4lxml_5etree_7_IDDict_21__len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_pw_4lxml_5etree_7_IDDict_21__len__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_7_IDDict_20__len__(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_ssize_t __pyx_pf_4lxml_5etree_7_IDDict_20__len__(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "src/lxml/xmlid.pxi":125
 * 
 *     def __len__(self):
 *         if self._keys is None:             # <<<<<<<<<<<<<<
 *             self._keys = self._build_keys()
 *         return len(self._keys)
*/
  __pyx_t_1 = (__pyx_v_self->_keys == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/xmlid.pxi":126
 *     def __len__(self):
 *         if self._keys is None:
 *             self._keys = self._build_keys()             # <<<<<<<<<<<<<<
 *         return len(self._keys)
 * 
*/
    __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__IDDict *)__pyx_v_self->__pyx_vtab)->_build_keys(__pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(15, 126, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_GOTREF(__pyx_v_self->_keys);
    __Pyx_DECREF(__pyx_v_self->_keys);
    __pyx_v_self->_keys = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "src/lxml/xmlid.pxi":125
 * 
 *     def __len__(self):
 *         if self._keys is None:             # <<<<<<<<<<<<<<
 *             self._keys = self._build_keys()
 *         return len(self._keys)
*/
  }

  /* "src/lxml/xmlid.pxi":127
 *         if self._keys is None:
 *             self._keys = self._build_keys()
 *         return len(self._keys)             # <<<<<<<<<<<<<<
 * 
 *     def items(self):
*/
  __pyx_t_2 = __pyx_v_self->_keys;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(15, 127, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  goto __pyx_L0;

  /* "src/lxml/xmlid.pxi":124
 *         return self
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         if self._keys is None:
 *             self._keys = self._build_keys()
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._IDDict.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlid.pxi":129
 *         return len(self._keys)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         if self._items is None:
 *             self._items = self._build_items()
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_IDDict_23items(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_7_IDDict_23items = {"items", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_IDDict_23items, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_7_IDDict_23items(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("items", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("items", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_7_IDDict_22items(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_22items(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("items", 0);

  /* "src/lxml/xmlid.pxi":130
 * 
 *     def items(self):
 *         if self._items is None:             # <<<<<<<<<<<<<<
 *             self._items = self._build_items()
 *         return self._items[:]
*/
  __pyx_t_1 = (__pyx_v_self->_items == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/xmlid.pxi":131
 *     def items(self):
 *         if self._items is None:
 *             self._items = self._build_items()             # <<<<<<<<<<<<<<
 *         return self._items[:]
 * 
*/
    __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__IDDict *)__pyx_v_self->__pyx_vtab)->_build_items(__pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(15, 131, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_GOTREF(__pyx_v_self->_items);
    __Pyx_DECREF(__pyx_v_self->_items);
    __pyx_v_self->_items = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "src/lxml/xmlid.pxi":130
 * 
 *     def items(self):
 *         if self._items is None:             # <<<<<<<<<<<<<<
 *             self._items = self._build_items()
 *         return self._items[:]
*/
  }

  /* "src/lxml/xmlid.pxi":132
 *         if self._items is None:
 *             self._items = self._build_items()
 *         return self._items[:]             # <<<<<<<<<<<<<<
 * 
 *     def iteritems(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_self->_items, 0, 0, NULL, NULL, &__pyx_mstate_global->__pyx_slice[0], 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(15, 132, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/xmlid.pxi":129
 *         return len(self._keys)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         if self._items is None:
 *             self._items = self._build_items()
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._IDDict.items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlid.pxi":134
 *         return self._items[:]
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         if self._items is None:
 *             self._items = self._build_items()
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_IDDict_25iteritems(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_7_IDDict_25iteritems = {"iteritems", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_IDDict_25iteritems, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_7_IDDict_25iteritems(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iteritems (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("iteritems", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("iteritems", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_7_IDDict_24iteritems(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_24iteritems(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("iteritems", 0);

  /* "src/lxml/xmlid.pxi":135
 * 
 *     def iteritems(self):
 *         if self._items is None:             # <<<<<<<<<<<<<<
 *             self._items = self._build_items()
 *         return iter(self._items)
*/
  __pyx_t_1 = (__pyx_v_self->_items == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/xmlid.pxi":136
 *     def iteritems(self):
 *         if self._items is None:
 *             self._items = self._build_items()             # <<<<<<<<<<<<<<
 *         return iter(self._items)
 * 
*/
    __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__IDDict *)__pyx_v_self->__pyx_vtab)->_build_items(__pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(15, 136, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_GOTREF(__pyx_v_self->_items);
    __Pyx_DECREF(__pyx_v_self->_items);
    __pyx_v_self->_items = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "src/lxml/xmlid.pxi":135
 * 
 *     def iteritems(self):
 *         if self._items is None:             # <<<<<<<<<<<<<<
 *             self._items = self._build_items()
 *         return iter(self._items)
*/
  }

  /* "src/lxml/xmlid.pxi":137
 *         if self._items is None:
 *             self._items = self._build_items()
 *         return iter(self._items)             # <<<<<<<<<<<<<<
 * 
 *     def values(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_v_self->_items;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(15, 137, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "src/lxml/xmlid.pxi":134
 *         return self._items[:]
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         if self._items is None:
 *             self._items = self._build_items()
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._IDDict.iteritems", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlid.pxi":139
 *         return iter(self._items)
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         cdef list values = []
 *         if self._items is None:
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_IDDict_27values(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_7_IDDict_27values = {"values", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_IDDict_27values, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_7_IDDict_27values(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("values (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("values", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("values", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_7_IDDict_26values(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_26values(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self) {
  PyObject *__pyx_v_values = 0;
  PyObject *__pyx_v_item = NULL;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("values", 0);

  /* "src/lxml/xmlid.pxi":140
 * 
 *     def values(self):
 *         cdef list values = []             # <<<<<<<<<<<<<<
 *         if self._items is None:
 *             self._items = self._build_items()
*/
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(15, 140, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_values = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xmlid.pxi":141
 *     def values(self):
 *         cdef list values = []
 *         if self._items is None:             # <<<<<<<<<<<<<<
 *             self._items = self._build_items()
 *         for item in self._items:
*/
  __pyx_t_2 = (__pyx_v_self->_items == Py_None);
  if (__pyx_t_2) {

    /* "src/lxml/xmlid.pxi":142
 *         cdef list values = []
 *         if self._items is None:
 *             self._items = self._build_items()             # <<<<<<<<<<<<<<
 *         for item in self._items:
 *             value = python.PyTuple_GET_ITEM(item, 1)
*/
    __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__IDDict *)__pyx_v_self->__pyx_vtab)->_build_items(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(15, 142, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __Pyx_GOTREF(__pyx_v_self->_items);
    __Pyx_DECREF(__pyx_v_self->_items);
    __pyx_v_self->_items = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "src/lxml/xmlid.pxi":141
 *     def values(self):
 *         cdef list values = []
 *         if self._items is None:             # <<<<<<<<<<<<<<
 *             self._items = self._build_items()
 *         for item in self._items:
*/
  }

  /* "src/lxml/xmlid.pxi":143
 *         if self._items is None:
 *             self._items = self._build_items()
 *         for item in self._items:             # <<<<<<<<<<<<<<
 *             value = python.PyTuple_GET_ITEM(item, 1)
 *             python.Py_INCREF(value)
*/
  if (likely(PyList_CheckExact(__pyx_v_self->_items)) || PyTuple_CheckExact(__pyx_v_self->_items)) {
    __pyx_t_1 = __pyx_v_self->_items; __Pyx_INCREF(__pyx_t_1);
    __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_self->_items); if (unlikely(!__pyx_t_1)) __PYX_ERR(15, 143, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(15, 143, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(15, 143, __pyx_L1_error)
          #endif
          if (__pyx_t_3 >= __pyx_temp) break;
        }
        __pyx_t_5 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_3, __Pyx_ReferenceSharing_OwnStrongReference);
        ++__pyx_t_3;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(15, 143, __pyx_L1_error)
          #endif
          if (__pyx_t_3 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3));
        #else
        __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_3);
        #endif
        ++__pyx_t_3;
      }
      if (unlikely(!__pyx_t_5)) __PYX_ERR(15, 143, __pyx_L1_error)
    } else {
      __pyx_t_5 = __pyx_t_4(__pyx_t_1);
      if (unlikely(!__pyx_t_5)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(15, 143, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "src/lxml/xmlid.pxi":144
 *             self._items = self._build_items()
 *         for item in self._items:
 *             value = python.PyTuple_GET_ITEM(item, 1)             # <<<<<<<<<<<<<<
 *             python.Py_INCREF(value)
 *             values.append(value)
*/
    __pyx_t_5 = PyTuple_GET_ITEM(__pyx_v_item, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(15, 144, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "src/lxml/xmlid.pxi":145
 *         for item in self._items:
 *             value = python.PyTuple_GET_ITEM(item, 1)
 *             python.Py_INCREF(value)             # <<<<<<<<<<<<<<
 *             values.append(value)
 *         return values
*/
    Py_INCREF(__pyx_v_value);

    /* "src/lxml/xmlid.pxi":146
 *             value = python.PyTuple_GET_ITEM(item, 1)
 *             python.Py_INCREF(value)
 *             values.append(value)             # <<<<<<<<<<<<<<
 *         return values
 * 
*/
    __pyx_t_6 = __Pyx_PyList_Append(__pyx_v_values, __pyx_v_value); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(15, 146, __pyx_L1_error)

    /* "src/lxml/xmlid.pxi":143
 *         if self._items is None:
 *             self._items = self._build_items()
 *         for item in self._items:             # <<<<<<<<<<<<<<
 *             value = python.PyTuple_GET_ITEM(item, 1)
 *             python.Py_INCREF(value)
*/
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xmlid.pxi":147
 *             python.Py_INCREF(value)
 *             values.append(value)
 *         return values             # <<<<<<<<<<<<<<
 * 
 *     def itervalues(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_values);
  __pyx_r = __pyx_v_values;
  goto __pyx_L0;

  /* "src/lxml/xmlid.pxi":139
 *         return iter(self._items)
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         cdef list values = []
 *         if self._items is None:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._IDDict.values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_values);
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlid.pxi":149
 *         return values
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         return iter(self.values())
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_IDDict_29itervalues(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_7_IDDict_29itervalues = {"itervalues", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_IDDict_29itervalues, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_7_IDDict_29itervalues(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("itervalues (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("itervalues", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("itervalues", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_7_IDDict_28itervalues(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_28itervalues(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("itervalues", 0);

  /* "src/lxml/xmlid.pxi":150
 * 
 *     def itervalues(self):
 *         return iter(self.values())             # <<<<<<<<<<<<<<
 * 
 *     cdef object _build_keys(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_values, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(15, 150, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(15, 150, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/xmlid.pxi":149
 *         return values
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         return iter(self.values())
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._IDDict.itervalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlid.pxi":152
 *         return iter(self.values())
 * 
 *     cdef object _build_keys(self):             # <<<<<<<<<<<<<<
 *         keys = []
 *         tree.xmlHashScan(<tree.xmlHashTable*>self._doc._c_doc.ids,
*/

static PyObject *__pyx_f_4lxml_5etree_7_IDDict__build_keys(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self) {
  PyObject *__pyx_v_keys = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_build_keys", 0);

  /* "src/lxml/xmlid.pxi":153
 * 
 *     cdef object _build_keys(self):
 *         keys = []             # <<<<<<<<<<<<<<
 *         tree.xmlHashScan(<tree.xmlHashTable*>self._doc._c_doc.ids,
 *                          <tree.xmlHashScanner>_collectIdHashKeys, <python.PyObject*>keys)
*/
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(15, 153, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_keys = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xmlid.pxi":154
 *     cdef object _build_keys(self):
 *         keys = []
 *         tree.xmlHashScan(<tree.xmlHashTable*>self._doc._c_doc.ids,             # <<<<<<<<<<<<<<
 *                          <tree.xmlHashScanner>_collectIdHashKeys, <python.PyObject*>keys)
 *         return keys
*/
  xmlHashScan(((xmlHashTable *)__pyx_v_self->_doc->_c_doc->ids), ((xmlHashScanner)__pyx_f_4lxml_5etree__collectIdHashKeys), ((PyObject *)__pyx_v_keys));

  /* "src/lxml/xmlid.pxi":156
 *         tree.xmlHashScan(<tree.xmlHashTable*>self._doc._c_doc.ids,
 *                          <tree.xmlHashScanner>_collectIdHashKeys, <python.PyObject*>keys)
 *         return keys             # <<<<<<<<<<<<<<
 * 
 *     cdef object _build_items(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_keys);
  __pyx_r = __pyx_v_keys;
  goto __pyx_L0;

  /* "src/lxml/xmlid.pxi":152
 *         return iter(self.values())
 * 
 *     cdef object _build_keys(self):             # <<<<<<<<<<<<<<
 *         keys = []
 *         tree.xmlHashScan(<tree.xmlHashTable*>self._doc._c_doc.ids,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._IDDict._build_keys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_keys);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlid.pxi":158
 *         return keys
 * 
 *     cdef object _build_items(self):             # <<<<<<<<<<<<<<
 *         items = []
 *         context = (items, self._doc)
*/

static PyObject *__pyx_f_4lxml_5etree_7_IDDict__build_items(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self) {
  PyObject *__pyx_v_items = NULL;
  PyObject *__pyx_v_context = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_build_items", 0);

  /* "src/lxml/xmlid.pxi":159
 * 
 *     cdef object _build_items(self):
 *         items = []             # <<<<<<<<<<<<<<
 *         context = (items, self._doc)
 *         tree.xmlHashScan(<tree.xmlHashTable*>self._doc._c_doc.ids,
*/
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(15, 159, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_items = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xmlid.pxi":160
 *     cdef object _build_items(self):
 *         items = []
 *         context = (items, self._doc)             # <<<<<<<<<<<<<<
 *         tree.xmlHashScan(<tree.xmlHashTable*>self._doc._c_doc.ids,
 *                          <tree.xmlHashScanner>_collectIdHashItemList, <python.PyObject*>context)
*/
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(15, 160, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_items);
  __Pyx_GIVEREF(__pyx_v_items);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_items) != (0)) __PYX_ERR(15, 160, __pyx_L1_error);
  __Pyx_INCREF((PyObject *)__pyx_v_self->_doc);
  __Pyx_GIVEREF((PyObject *)__pyx_v_self->_doc);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self->_doc)) != (0)) __PYX_ERR(15, 160, __pyx_L1_error);
  __pyx_v_context = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xmlid.pxi":161
 *         items = []
 *         context = (items, self._doc)
 *         tree.xmlHashScan(<tree.xmlHashTable*>self._doc._c_doc.ids,             # <<<<<<<<<<<<<<
 *                          <tree.xmlHashScanner>_collectIdHashItemList, <python.PyObject*>context)
 *         return items
*/
  xmlHashScan(((xmlHashTable *)__pyx_v_self->_doc->_c_doc->ids), ((xmlHashScanner)__pyx_f_4lxml_5etree__collectIdHashItemList), ((PyObject *)__pyx_v_context));

  /* "src/lxml/xmlid.pxi":163
 *         tree.xmlHashScan(<tree.xmlHashTable*>self._doc._c_doc.ids,
 *                          <tree.xmlHashScanner>_collectIdHashItemList, <python.PyObject*>context)
 *         return items             # <<<<<<<<<<<<<<
 * 
 * cdef void _collectIdHashItemList(void* payload, void* context, xmlChar* name) noexcept:
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_items);
  __pyx_r = __pyx_v_items;
  goto __pyx_L0;

  /* "src/lxml/xmlid.pxi":158
 *         return keys
 * 
 *     cdef object _build_items(self):             # <<<<<<<<<<<<<<
 *         items = []
 *         context = (items, self._doc)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._IDDict._build_items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_items);
  __Pyx_XDECREF(__pyx_v_context);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlid.pxi":165
 *         return items
 * 
 * cdef void _collectIdHashItemList(void* payload, void* context, xmlChar* name) noexcept:             # <<<<<<<<<<<<<<
 *     # collect elements from ID attribute hash table
 *     cdef list lst
*/

static void __pyx_f_4lxml_5etree__collectIdHashItemList(void *__pyx_v_payload, void *__pyx_v_context, xmlChar *__pyx_v_name) {
  PyObject *__pyx_v_lst = 0;
  xmlID *__pyx_v_c_id;
  PyObject *__pyx_v_doc = NULL;
  struct LxmlElement *__pyx_v_element = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_collectIdHashItemList", 0);

  /* "src/lxml/xmlid.pxi":168
 *     # collect elements from ID attribute hash table
 *     cdef list lst
 *     c_id = <tree.xmlID*>payload             # <<<<<<<<<<<<<<
 *     if c_id is NULL or c_id.attr is NULL or c_id.attr.parent is NULL:
 *         return
*/
  __pyx_v_c_id = ((xmlID *)__pyx_v_payload);

  /* "src/lxml/xmlid.pxi":169
 *     cdef list lst
 *     c_id = <tree.xmlID*>payload
 *     if c_id is NULL or c_id.attr is NULL or c_id.attr.parent is NULL:             # <<<<<<<<<<<<<<
 *         return
 *     lst, doc = <tuple>context
*/
  __pyx_t_2 = (__pyx_v_c_id == NULL);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_c_id->attr == NULL);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_c_id->attr->parent == NULL);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/xmlid.pxi":170
 *     c_id = <tree.xmlID*>payload
 *     if c_id is NULL or c_id.attr is NULL or c_id.attr.parent is NULL:
 *         return             # <<<<<<<<<<<<<<
 *     lst, doc = <tuple>context
 *     element = _elementFactory(doc, c_id.attr.parent)
*/
    goto __pyx_L0;

    /* "src/lxml/xmlid.pxi":169
 *     cdef list lst
 *     c_id = <tree.xmlID*>payload
 *     if c_id is NULL or c_id.attr is NULL or c_id.attr.parent is NULL:             # <<<<<<<<<<<<<<
 *         return
 *     lst, doc = <tuple>context
*/
  }

  /* "src/lxml/xmlid.pxi":171
 *     if c_id is NULL or c_id.attr is NULL or c_id.attr.parent is NULL:
 *         return
 *     lst, doc = <tuple>context             # <<<<<<<<<<<<<<
 *     element = _elementFactory(doc, c_id.attr.parent)
 *     lst.append( (funicode(name), element) )
*/
  __pyx_t_3 = ((PyObject *)__pyx_v_context);
  __Pyx_INCREF(__pyx_t_3);
  if (likely(__pyx_t_3 != Py_None)) {
    PyObject* sequence = __pyx_t_3;
    Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(15, 171, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1);
    __Pyx_INCREF(__pyx_t_5);
    #else
    __pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(15, 171, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(15, 171, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    #endif
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(15, 171, __pyx_L1_error)
  }
  if (!(likely(PyList_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("list", __pyx_t_4))) __PYX_ERR(15, 171, __pyx_L1_error)
  __pyx_v_lst = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_v_doc = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "src/lxml/xmlid.pxi":172
 *         return
 *     lst, doc = <tuple>context
 *     element = _elementFactory(doc, c_id.attr.parent)             # <<<<<<<<<<<<<<
 *     lst.append( (funicode(name), element) )
 * 
*/
  if (!(likely(((__pyx_v_doc) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_doc, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Document))))) __PYX_ERR(15, 172, __pyx_L1_error)
  __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_v_doc), __pyx_v_c_id->attr->parent)); if (unlikely(!__pyx_t_3)) __PYX_ERR(15, 172, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_element = ((struct LxmlElement *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/xmlid.pxi":173
 *     lst, doc = <tuple>context
 *     element = _elementFactory(doc, c_id.attr.parent)
 *     lst.append( (funicode(name), element) )             # <<<<<<<<<<<<<<
 * 
 * cdef void _collectIdHashKeys(void* payload, void* collect_list, xmlChar* name) noexcept:
*/
  if (unlikely(__pyx_v_lst == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
    __PYX_ERR(15, 173, __pyx_L1_error)
  }
  __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(15, 173, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(15, 173, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_3);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3) != (0)) __PYX_ERR(15, 173, __pyx_L1_error);
  __Pyx_INCREF((PyObject *)__pyx_v_element);
  __Pyx_GIVEREF((PyObject *)__pyx_v_element);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_v_element)) != (0)) __PYX_ERR(15, 173, __pyx_L1_error);
  __pyx_t_3 = 0;
  __pyx_t_6 = __Pyx_PyList_Append(__pyx_v_lst, __pyx_t_5); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(15, 173, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "src/lxml/xmlid.pxi":165
 *         return items
 * 
 * cdef void _collectIdHashItemList(void* payload, void* context, xmlChar* name) noexcept:             # <<<<<<<<<<<<<<
 *     # collect elements from ID attribute hash table
 *     cdef list lst
*/

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_WriteUnraisable("lxml.etree._collectIdHashItemList", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_lst);
  __Pyx_XDECREF(__pyx_v_doc);
  __Pyx_XDECREF((PyObject *)__pyx_v_element);
  __Pyx_RefNannyFinishContext();
}

/* "src/lxml/xmlid.pxi":175
 *     lst.append( (funicode(name), element) )
 * 
 * cdef void _collectIdHashKeys(void* payload, void* collect_list, xmlChar* name) noexcept:             # <<<<<<<<<<<<<<
 *     c_id = <tree.xmlID*>payload
 *     if c_id is NULL or c_id.attr is NULL or c_id.attr.parent is NULL:
*/

static void __pyx_f_4lxml_5etree__collectIdHashKeys(void *__pyx_v_payload, void *__pyx_v_collect_list, xmlChar *__pyx_v_name) {
  xmlID *__pyx_v_c_id;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_collectIdHashKeys", 0);

  /* "src/lxml/xmlid.pxi":176
 * 
 * cdef void _collectIdHashKeys(void* payload, void* collect_list, xmlChar* name) noexcept:
 *     c_id = <tree.xmlID*>payload             # <<<<<<<<<<<<<<
 *     if c_id is NULL or c_id.attr is NULL or c_id.attr.parent is NULL:
 *         return
*/
  __pyx_v_c_id = ((xmlID *)__pyx_v_payload);

  /* "src/lxml/xmlid.pxi":177
 * cdef void _collectIdHashKeys(void* payload, void* collect_list, xmlChar* name) noexcept:
 *     c_id = <tree.xmlID*>payload
 *     if c_id is NULL or c_id.attr is NULL or c_id.attr.parent is NULL:             # <<<<<<<<<<<<<<
 *         return
 *     (<list>collect_list).append(funicode(name))
*/
  __pyx_t_2 = (__pyx_v_c_id == NULL);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_c_id->attr == NULL);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_c_id->attr->parent == NULL);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/xmlid.pxi":178
 *     c_id = <tree.xmlID*>payload
 *     if c_id is NULL or c_id.attr is NULL or c_id.attr.parent is NULL:
 *         return             # <<<<<<<<<<<<<<
 *     (<list>collect_list).append(funicode(name))
*/
    goto __pyx_L0;

    /* "src/lxml/xmlid.pxi":177
 * cdef void _collectIdHashKeys(void* payload, void* collect_list, xmlChar* name) noexcept:
 *     c_id = <tree.xmlID*>payload
 *     if c_id is NULL or c_id.attr is NULL or c_id.attr.parent is NULL:             # <<<<<<<<<<<<<<
 *         return
 *     (<list>collect_list).append(funicode(name))
*/
  }

  /* "src/lxml/xmlid.pxi":179
 *     if c_id is NULL or c_id.attr is NULL or c_id.attr.parent is NULL:
 *         return
 *     (<list>collect_list).append(funicode(name))             # <<<<<<<<<<<<<<
*/
  if (unlikely(((PyObject *)__pyx_v_collect_list) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
    __PYX_ERR(15, 179, __pyx_L1_error)
  }
  __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(15, 179, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyList_Append(((PyObject*)__pyx_v_collect_list), __pyx_t_3); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(15, 179, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/xmlid.pxi":175
 *     lst.append( (funicode(name), element) )
 * 
 * cdef void _collectIdHashKeys(void* payload, void* collect_list, xmlChar* name) noexcept:             # <<<<<<<<<<<<<<
 *     c_id = <tree.xmlID*>payload
 *     if c_id is NULL or c_id.attr is NULL or c_id.attr.parent is NULL:
*/

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_WriteUnraisable("lxml.etree._collectIdHashKeys", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "src/lxml/xinclude.pxi":19
 *     """
 *     cdef _ErrorLog _error_log
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self._error_log = _ErrorLog()
 * 
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_8XInclude_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_8XInclude_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, __pyx_nargs); return -1; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return -1;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__init__", __pyx_kwds); return -1;}
  __pyx_r = __pyx_pf_4lxml_5etree_8XInclude___init__(((struct __pyx_obj_4lxml_5etree_XInclude *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_8XInclude___init__(struct __pyx_obj_4lxml_5etree_XInclude *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "src/lxml/xinclude.pxi":20
 *     cdef _ErrorLog _error_log
 *     def __init__(self):
 *         self._error_log = _ErrorLog()             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __pyx_t_2 = NULL;
  __pyx_t_3 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ErrorLog, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(16, 20, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __Pyx_GIVEREF((PyObject *)__pyx_t_1);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_error_log);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_error_log);
  __pyx_v_self->_error_log = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xinclude.pxi":19
 *     """
 *     cdef _ErrorLog _error_log
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self._error_log = _ErrorLog()
 * 
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.XInclude.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xinclude.pxi":22
 *         self._error_log = _ErrorLog()
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def error_log(self):
 *         assert self._error_log is not None, "XInclude instance not initialised"
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8XInclude_9error_log_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_8XInclude_9error_log_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_8XInclude_9error_log___get__(((struct __pyx_obj_4lxml_5etree_XInclude *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8XInclude_9error_log___get__(struct __pyx_obj_4lxml_5etree_XInclude *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "src/lxml/xinclude.pxi":24
 *     @property
 *     def error_log(self):
 *         assert self._error_log is not None, "XInclude instance not initialised"             # <<<<<<<<<<<<<<
 *         return self._error_log.copy()
 * 
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = (((PyObject *)__pyx_v_self->_error_log) != Py_None);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_mstate_global->__pyx_kp_u_XInclude_instance_not_initialise, 0, 0);
      __PYX_ERR(16, 24, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(16, 24, __pyx_L1_error)
  #endif

  /* "src/lxml/xinclude.pxi":25
 *     def error_log(self):
 *         assert self._error_log is not None, "XInclude instance not initialised"
 *         return self._error_log.copy()             # <<<<<<<<<<<<<<
 * 
 *     def __call__(self, _Element node not None):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)__pyx_v_self->_error_log->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.copy(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self->_error_log), 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(16, 25, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/xinclude.pxi":22
 *         self._error_log = _ErrorLog()
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def error_log(self):
 *         assert self._error_log is not None, "XInclude instance not initialised"
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.XInclude.error_log.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xinclude.pxi":27
 *         return self._error_log.copy()
 * 
 *     def __call__(self, _Element node not None):             # <<<<<<<<<<<<<<
 *         "__call__(self, node)"
 *         # We cannot pass the XML_PARSE_NOXINCNODE option as this would free
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8XInclude_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8XInclude_2__call__, "__call__(self, node)");
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_8XInclude_2__call__;
#endif
static PyObject *__pyx_pw_4lxml_5etree_8XInclude_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct LxmlElement *__pyx_v_node = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_node,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(16, 27, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(16, 27, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__call__", 0) < (0)) __PYX_ERR(16, 27, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, i); __PYX_ERR(16, 27, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(16, 27, __pyx_L3_error)
    }
    __pyx_v_node = ((struct LxmlElement *)values[0]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, __pyx_nargs); __PYX_ERR(16, 27, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.XInclude.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_node), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element, 0, "node", 0))) __PYX_ERR(16, 27, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_8XInclude_2__call__(((struct __pyx_obj_4lxml_5etree_XInclude *)__pyx_v_self), __pyx_v_node);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8XInclude_2__call__(struct __pyx_obj_4lxml_5etree_XInclude *__pyx_v_self, struct LxmlElement *__pyx_v_node) {
  int __pyx_v_result;
  long __pyx_v_parse_options;
  struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_context = NULL;
  void *__pyx_v_c_context;
  xmlExternalEntityLoader __pyx_v_orig_loader;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  size_t __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__call__", 0);

  /* "src/lxml/xinclude.pxi":37
 *         # i.e. as a sibling, which does not conflict with traversal.
 *         cdef int result
 *         _assertValidNode(node)             # <<<<<<<<<<<<<<
 *         assert self._error_log is not None, "XInclude processor not initialised"
 *         if node._doc._parser is not None:
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_node); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(16, 37, __pyx_L1_error)

  /* "src/lxml/xinclude.pxi":38
 *         cdef int result
 *         _assertValidNode(node)
 *         assert self._error_log is not None, "XInclude processor not initialised"             # <<<<<<<<<<<<<<
 *         if node._doc._parser is not None:
 *             parse_options = node._doc._parser._parse_options
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_2 = (((PyObject *)__pyx_v_self->_error_log) != Py_None);
    if (unlikely(!__pyx_t_2)) {
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_mstate_global->__pyx_kp_u_XInclude_processor_not_initialis, 0, 0);
      __PYX_ERR(16, 38, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(16, 38, __pyx_L1_error)
  #endif

  /* "src/lxml/xinclude.pxi":39
 *         _assertValidNode(node)
 *         assert self._error_log is not None, "XInclude processor not initialised"
 *         if node._doc._parser is not None:             # <<<<<<<<<<<<<<
 *             parse_options = node._doc._parser._parse_options
 *             context = node._doc._parser._getParserContext()
*/
  __pyx_t_2 = (((PyObject *)__pyx_v_node->_doc->_parser) != Py_None);
  if (__pyx_t_2) {

    /* "src/lxml/xinclude.pxi":40
 *         assert self._error_log is not None, "XInclude processor not initialised"
 *         if node._doc._parser is not None:
 *             parse_options = node._doc._parser._parse_options             # <<<<<<<<<<<<<<
 *             context = node._doc._parser._getParserContext()
 *             c_context = <void*>context
*/
    __pyx_t_1 = __pyx_v_node->_doc->_parser->_parse_options;
    __pyx_v_parse_options = __pyx_t_1;

    /* "src/lxml/xinclude.pxi":41
 *         if node._doc._parser is not None:
 *             parse_options = node._doc._parser._parse_options
 *             context = node._doc._parser._getParserContext()             # <<<<<<<<<<<<<<
 *             c_context = <void*>context
 *         else:
*/
    __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)__pyx_v_node->_doc->_parser->__pyx_vtab)->_getParserContext(__pyx_v_node->_doc->_parser)); if (unlikely(!__pyx_t_3)) __PYX_ERR(16, 41, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/xinclude.pxi":42
 *             parse_options = node._doc._parser._parse_options
 *             context = node._doc._parser._getParserContext()
 *             c_context = <void*>context             # <<<<<<<<<<<<<<
 *         else:
 *             parse_options = 0
*/
    __pyx_v_c_context = ((void *)__pyx_v_context);

    /* "src/lxml/xinclude.pxi":39
 *         _assertValidNode(node)
 *         assert self._error_log is not None, "XInclude processor not initialised"
 *         if node._doc._parser is not None:             # <<<<<<<<<<<<<<
 *             parse_options = node._doc._parser._parse_options
 *             context = node._doc._parser._getParserContext()
*/
    goto __pyx_L3;
  }

  /* "src/lxml/xinclude.pxi":44
 *             c_context = <void*>context
 *         else:
 *             parse_options = 0             # <<<<<<<<<<<<<<
 *             context = None
 *             c_context = NULL
*/
  /*else*/ {
    __pyx_v_parse_options = 0;

    /* "src/lxml/xinclude.pxi":45
 *         else:
 *             parse_options = 0
 *             context = None             # <<<<<<<<<<<<<<
 *             c_context = NULL
 * 
*/
    __Pyx_INCREF(Py_None);
    __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)Py_None);

    /* "src/lxml/xinclude.pxi":46
 *             parse_options = 0
 *             context = None
 *             c_context = NULL             # <<<<<<<<<<<<<<
 * 
 *         self._error_log.connect()
*/
    __pyx_v_c_context = NULL;
  }
  __pyx_L3:;

  /* "src/lxml/xinclude.pxi":48
 *             c_context = NULL
 * 
 *         self._error_log.connect()             # <<<<<<<<<<<<<<
 *         if tree.LIBXML_VERSION < 20704 or not c_context:
 *             __GLOBAL_PARSER_CONTEXT.pushImpliedContext(context)
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_9_ErrorLog_connect(__pyx_v_self->_error_log); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(16, 48, __pyx_L1_error)

  /* "src/lxml/xinclude.pxi":49
 * 
 *         self._error_log.connect()
 *         if tree.LIBXML_VERSION < 20704 or not c_context:             # <<<<<<<<<<<<<<
 *             __GLOBAL_PARSER_CONTEXT.pushImpliedContext(context)
 *         with nogil:
*/
  __pyx_t_4 = (LIBXML_VERSION < 0x50E0);
  if (!__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_4 = (!(__pyx_v_c_context != 0));
  __pyx_t_2 = __pyx_t_4;
  __pyx_L5_bool_binop_done:;
  if (__pyx_t_2) {

    /* "src/lxml/xinclude.pxi":50
 *         self._error_log.connect()
 *         if tree.LIBXML_VERSION < 20704 or not c_context:
 *             __GLOBAL_PARSER_CONTEXT.pushImpliedContext(context)             # <<<<<<<<<<<<<<
 *         with nogil:
 *             orig_loader = _register_document_loader()
*/
    __pyx_t_1 = __pyx_f_4lxml_5etree_24_ParserDictionaryContext_pushImpliedContext(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, __pyx_v_context); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(16, 50, __pyx_L1_error)

    /* "src/lxml/xinclude.pxi":49
 * 
 *         self._error_log.connect()
 *         if tree.LIBXML_VERSION < 20704 or not c_context:             # <<<<<<<<<<<<<<
 *             __GLOBAL_PARSER_CONTEXT.pushImpliedContext(context)
 *         with nogil:
*/
  }

  /* "src/lxml/xinclude.pxi":51
 *         if tree.LIBXML_VERSION < 20704 or not c_context:
 *             __GLOBAL_PARSER_CONTEXT.pushImpliedContext(context)
 *         with nogil:             # <<<<<<<<<<<<<<
 *             orig_loader = _register_document_loader()
 *             if c_context:
*/
  {
      PyThreadState * _save;
      _save = PyEval_SaveThread();
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "src/lxml/xinclude.pxi":52
 *             __GLOBAL_PARSER_CONTEXT.pushImpliedContext(context)
 *         with nogil:
 *             orig_loader = _register_document_loader()             # <<<<<<<<<<<<<<
 *             if c_context:
 *                 result = xinclude.xmlXIncludeProcessTreeFlagsData(
*/
        __pyx_v_orig_loader = __pyx_f_4lxml_5etree__register_document_loader();

        /* "src/lxml/xinclude.pxi":53
 *         with nogil:
 *             orig_loader = _register_document_loader()
 *             if c_context:             # <<<<<<<<<<<<<<
 *                 result = xinclude.xmlXIncludeProcessTreeFlagsData(
 *                     node._c_node, parse_options, c_context)
*/
        __pyx_t_2 = (__pyx_v_c_context != 0);
        if (__pyx_t_2) {

          /* "src/lxml/xinclude.pxi":54
 *             orig_loader = _register_document_loader()
 *             if c_context:
 *                 result = xinclude.xmlXIncludeProcessTreeFlagsData(             # <<<<<<<<<<<<<<
 *                     node._c_node, parse_options, c_context)
 *             else:
*/
          __pyx_v_result = xmlXIncludeProcessTreeFlagsData(__pyx_v_node->_c_node, __pyx_v_parse_options, __pyx_v_c_context);

          /* "src/lxml/xinclude.pxi":53
 *         with nogil:
 *             orig_loader = _register_document_loader()
 *             if c_context:             # <<<<<<<<<<<<<<
 *                 result = xinclude.xmlXIncludeProcessTreeFlagsData(
 *                     node._c_node, parse_options, c_context)
*/
          goto __pyx_L10;
        }

        /* "src/lxml/xinclude.pxi":57
 *                     node._c_node, parse_options, c_context)
 *             else:
 *                 result = xinclude.xmlXIncludeProcessTree(node._c_node)             # <<<<<<<<<<<<<<
 *             _reset_document_loader(orig_loader)
 *         if tree.LIBXML_VERSION < 20704 or not c_context:
*/
        /*else*/ {
          __pyx_v_result = xmlXIncludeProcessTree(__pyx_v_node->_c_node);
        }
        __pyx_L10:;

        /* "src/lxml/xinclude.pxi":58
 *             else:
 *                 result = xinclude.xmlXIncludeProcessTree(node._c_node)
 *             _reset_document_loader(orig_loader)             # <<<<<<<<<<<<<<
 *         if tree.LIBXML_VERSION < 20704 or not c_context:
 *             __GLOBAL_PARSER_CONTEXT.popImpliedContext()
*/
        __pyx_f_4lxml_5etree__reset_document_loader(__pyx_v_orig_loader);
      }

      /* "src/lxml/xinclude.pxi":51
 *         if tree.LIBXML_VERSION < 20704 or not c_context:
 *             __GLOBAL_PARSER_CONTEXT.pushImpliedContext(context)
 *         with nogil:             # <<<<<<<<<<<<<<
 *             orig_loader = _register_document_loader()
 *             if c_context:
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L9;
        }
        __pyx_L9:;
      }
  }

  /* "src/lxml/xinclude.pxi":59
 *                 result = xinclude.xmlXIncludeProcessTree(node._c_node)
 *             _reset_document_loader(orig_loader)
 *         if tree.LIBXML_VERSION < 20704 or not c_context:             # <<<<<<<<<<<<<<
 *             __GLOBAL_PARSER_CONTEXT.popImpliedContext()
 *         self._error_log.disconnect()
*/
  __pyx_t_4 = (LIBXML_VERSION < 0x50E0);
  if (!__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L12_bool_binop_done;
  }
  __pyx_t_4 = (!(__pyx_v_c_context != 0));
  __pyx_t_2 = __pyx_t_4;
  __pyx_L12_bool_binop_done:;
  if (__pyx_t_2) {

    /* "src/lxml/xinclude.pxi":60
 *             _reset_document_loader(orig_loader)
 *         if tree.LIBXML_VERSION < 20704 or not c_context:
 *             __GLOBAL_PARSER_CONTEXT.popImpliedContext()             # <<<<<<<<<<<<<<
 *         self._error_log.disconnect()
 * 
*/
    __pyx_t_1 = __pyx_f_4lxml_5etree_24_ParserDictionaryContext_popImpliedContext(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(16, 60, __pyx_L1_error)

    /* "src/lxml/xinclude.pxi":59
 *                 result = xinclude.xmlXIncludeProcessTree(node._c_node)
 *             _reset_document_loader(orig_loader)
 *         if tree.LIBXML_VERSION < 20704 or not c_context:             # <<<<<<<<<<<<<<
 *             __GLOBAL_PARSER_CONTEXT.popImpliedContext()
 *         self._error_log.disconnect()
*/
  }

  /* "src/lxml/xinclude.pxi":61
 *         if tree.LIBXML_VERSION < 20704 or not c_context:
 *             __GLOBAL_PARSER_CONTEXT.popImpliedContext()
 *         self._error_log.disconnect()             # <<<<<<<<<<<<<<
 * 
 *         if result == -1:
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_9_ErrorLog_disconnect(__pyx_v_self->_error_log); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(16, 61, __pyx_L1_error)

  /* "src/lxml/xinclude.pxi":63
 *         self._error_log.disconnect()
 * 
 *         if result == -1:             # <<<<<<<<<<<<<<
 *             raise XIncludeError(
 *                 self._error_log._buildExceptionMessage(
*/
  __pyx_t_2 = (__pyx_v_result == -1L);
  if (unlikely(__pyx_t_2)) {

    /* "src/lxml/xinclude.pxi":64
 * 
 *         if result == -1:
 *             raise XIncludeError(             # <<<<<<<<<<<<<<
 *                 self._error_log._buildExceptionMessage(
 *                     "XInclude processing failed"),
*/
    __pyx_t_5 = NULL;

    /* "src/lxml/xinclude.pxi":65
 *         if result == -1:
 *             raise XIncludeError(
 *                 self._error_log._buildExceptionMessage(             # <<<<<<<<<<<<<<
 *                     "XInclude processing failed"),
 *                 self._error_log)
*/
    __pyx_t_6 = __pyx_f_4lxml_5etree_13_BaseErrorLog__buildExceptionMessage(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self->_error_log), __pyx_mstate_global->__pyx_kp_u_XInclude_processing_failed); if (unlikely(!__pyx_t_6)) __PYX_ERR(16, 65, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);

    /* "src/lxml/xinclude.pxi":67
 *                 self._error_log._buildExceptionMessage(
 *                     "XInclude processing failed"),
 *                 self._error_log)             # <<<<<<<<<<<<<<
*/
    __pyx_t_7 = 1;
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_t_6, ((PyObject *)__pyx_v_self->_error_log)};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XIncludeError, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(16, 64, __pyx_L1_error)
      __Pyx_GOTREF((PyObject *)__pyx_t_3);
    }
    __Pyx_Raise(((PyObject *)__pyx_t_3), 0, 0, 0);
    __Pyx_DECREF((PyObject *)__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(16, 64, __pyx_L1_error)

    /* "src/lxml/xinclude.pxi":63
 *         self._error_log.disconnect()
 * 
 *         if result == -1:             # <<<<<<<<<<<<<<
 *             raise XIncludeError(
 *                 self._error_log._buildExceptionMessage(
*/
  }

  /* "src/lxml/xinclude.pxi":27
 *         return self._error_log.copy()
 * 
 *     def __call__(self, _Element node not None):             # <<<<<<<<<<<<<<
 *         "__call__(self, node)"
 *         # We cannot pass the XML_PARSE_NOXINCNODE option as this would free
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree.XInclude.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/cleanup.pxi":3
 * # functions for tree cleanup and removing elements from subtrees
 * 
 * def cleanup_namespaces(tree_or_element, top_nsmap=None, keep_ns_prefixes=None):             # <<<<<<<<<<<<<<
 *     """cleanup_namespaces(tree_or_element, top_nsmap=None, keep_ns_prefixes=None)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_60cleanup_namespaces(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_59cleanup_namespaces, "cleanup_namespaces(tree_or_element, top_nsmap=None, keep_ns_prefixes=None)\n\n    Remove all namespace declarations from a subtree that are not used\n    by any of the elements or attributes in that tree.\n\n    If a 'top_nsmap' is provided, it must be a mapping from prefixes\n    to namespace URIs.  These namespaces will be declared on the top\n    element of the subtree before running the cleanup, which allows\n    moving namespace declarations to the top of the tree.\n\n    If a 'keep_ns_prefixes' is provided, it must be a list of prefixes.\n    These prefixes will not be removed as part of the cleanup.\n    ");
static PyMethodDef __pyx_mdef_4lxml_5etree_60cleanup_namespaces = {"cleanup_namespaces", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_60cleanup_namespaces, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_59cleanup_namespaces};
static PyObject *__pyx_pw_4lxml_5etree_60cleanup_namespaces(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_tree_or_element = 0;
  PyObject *__pyx_v_top_nsmap = 0;
  PyObject *__pyx_v_keep_ns_prefixes = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("cleanup_namespaces (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_tree_or_element,&__pyx_mstate_global->__pyx_n_u_top_nsmap,&__pyx_mstate_global->__pyx_n_u_keep_ns_prefixes,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(17, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(17, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(17, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(17, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "cleanup_namespaces", 0) < (0)) __PYX_ERR(17, 3, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("cleanup_namespaces", 0, 1, 3, i); __PYX_ERR(17, 3, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(17, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(17, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(17, 3, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_tree_or_element = values[0];
    __pyx_v_top_nsmap = values[1];
    __pyx_v_keep_ns_prefixes = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("cleanup_namespaces", 0, 1, 3, __pyx_nargs); __PYX_ERR(17, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.cleanup_namespaces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_59cleanup_namespaces(__pyx_self, __pyx_v_tree_or_element, __pyx_v_top_nsmap, __pyx_v_keep_ns_prefixes);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_59cleanup_namespaces(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tree_or_element, PyObject *__pyx_v_top_nsmap, PyObject *__pyx_v_keep_ns_prefixes) {
  struct LxmlElement *__pyx_v_element = NULL;
  xmlNode *__pyx_v_c_element;
  struct LxmlDocument *__pyx_v_doc = NULL;
  PyObject *__pyx_9genexpr18__pyx_v_prefix = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  xmlNode *__pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  PyObject *(*__pyx_t_8)(PyObject *);
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("cleanup_namespaces", 0);
  __Pyx_INCREF(__pyx_v_keep_ns_prefixes);

  /* "src/lxml/cleanup.pxi":17
 *     These prefixes will not be removed as part of the cleanup.
 *     """
 *     element = _rootNodeOrRaise(tree_or_element)             # <<<<<<<<<<<<<<
 *     c_element = element._c_node
 * 
*/
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__rootNodeOrRaise(__pyx_v_tree_or_element)); if (unlikely(!__pyx_t_1)) __PYX_ERR(17, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_element = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/cleanup.pxi":18
 *     """
 *     element = _rootNodeOrRaise(tree_or_element)
 *     c_element = element._c_node             # <<<<<<<<<<<<<<
 * 
 *     if top_nsmap:
*/
  __pyx_t_2 = __pyx_v_element->_c_node;
  __pyx_v_c_element = __pyx_t_2;

  /* "src/lxml/cleanup.pxi":20
 *     c_element = element._c_node
 * 
 *     if top_nsmap:             # <<<<<<<<<<<<<<
 *         doc = element._doc
 *         # declare namespaces from nsmap, then apply them to the subtree
*/
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_top_nsmap); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(17, 20, __pyx_L1_error)
  if (__pyx_t_3) {

    /* "src/lxml/cleanup.pxi":21
 * 
 *     if top_nsmap:
 *         doc = element._doc             # <<<<<<<<<<<<<<
 *         # declare namespaces from nsmap, then apply them to the subtree
 *         _setNodeNamespaces(c_element, doc, None, top_nsmap)
*/
    __pyx_t_1 = ((PyObject *)__pyx_v_element->_doc);
    __Pyx_INCREF(__pyx_t_1);
    __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/cleanup.pxi":23
 *         doc = element._doc
 *         # declare namespaces from nsmap, then apply them to the subtree
 *         _setNodeNamespaces(c_element, doc, None, top_nsmap)             # <<<<<<<<<<<<<<
 *         moveNodeToDocument(doc, c_element.doc, c_element)
 * 
*/
    __pyx_t_4 = __pyx_f_4lxml_5etree__setNodeNamespaces(__pyx_v_c_element, __pyx_v_doc, Py_None, __pyx_v_top_nsmap); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(17, 23, __pyx_L1_error)

    /* "src/lxml/cleanup.pxi":24
 *         # declare namespaces from nsmap, then apply them to the subtree
 *         _setNodeNamespaces(c_element, doc, None, top_nsmap)
 *         moveNodeToDocument(doc, c_element.doc, c_element)             # <<<<<<<<<<<<<<
 * 
 *     keep_ns_prefixes = (
*/
    __pyx_t_4 = __pyx_f_4lxml_5etree_moveNodeToDocument(__pyx_v_doc, __pyx_v_c_element->doc, __pyx_v_c_element); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(17, 24, __pyx_L1_error)

    /* "src/lxml/cleanup.pxi":20
 *     c_element = element._c_node
 * 
 *     if top_nsmap:             # <<<<<<<<<<<<<<
 *         doc = element._doc
 *         # declare namespaces from nsmap, then apply them to the subtree
*/
  }

  /* "src/lxml/cleanup.pxi":28
 *     keep_ns_prefixes = (
 *         set([_utf8(prefix) for prefix in keep_ns_prefixes])
 *         if keep_ns_prefixes else None)             # <<<<<<<<<<<<<<
 * 
 *     _removeUnusedNamespaceDeclarations(c_element, keep_ns_prefixes)
*/
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_keep_ns_prefixes); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(17, 28, __pyx_L1_error)
  if (__pyx_t_3) {

    /* "src/lxml/cleanup.pxi":27
 * 
 *     keep_ns_prefixes = (
 *         set([_utf8(prefix) for prefix in keep_ns_prefixes])             # <<<<<<<<<<<<<<
 *         if keep_ns_prefixes else None)
 * 
*/
    { /* enter inner scope */
      __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(17, 27, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (likely(PyList_CheckExact(__pyx_v_keep_ns_prefixes)) || PyTuple_CheckExact(__pyx_v_keep_ns_prefixes)) {
        __pyx_t_6 = __pyx_v_keep_ns_prefixes; __Pyx_INCREF(__pyx_t_6);
        __pyx_t_7 = 0;
        __pyx_t_8 = NULL;
      } else {
        __pyx_t_7 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_keep_ns_prefixes); if (unlikely(!__pyx_t_6)) __PYX_ERR(17, 27, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(17, 27, __pyx_L6_error)
      }
      for (;;) {
        if (likely(!__pyx_t_8)) {
          if (likely(PyList_CheckExact(__pyx_t_6))) {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_6);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(17, 27, __pyx_L6_error)
              #endif
              if (__pyx_t_7 >= __pyx_temp) break;
            }
            __pyx_t_9 = __Pyx_PyList_GetItemRefFast(__pyx_t_6, __pyx_t_7, __Pyx_ReferenceSharing_OwnStrongReference);
            ++__pyx_t_7;
          } else {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_6);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(17, 27, __pyx_L6_error)
              #endif
              if (__pyx_t_7 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_9 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_7));
            #else
            __pyx_t_9 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_7);
            #endif
            ++__pyx_t_7;
          }
          if (unlikely(!__pyx_t_9)) __PYX_ERR(17, 27, __pyx_L6_error)
        } else {
          __pyx_t_9 = __pyx_t_8(__pyx_t_6);
          if (unlikely(!__pyx_t_9)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(17, 27, __pyx_L6_error)
              PyErr_Clear();
            }
            break;
          }
        }
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_XDECREF_SET(__pyx_9genexpr18__pyx_v_prefix, __pyx_t_9);
        __pyx_t_9 = 0;
        __pyx_t_9 = __pyx_f_4lxml_5etree__utf8(__pyx_9genexpr18__pyx_v_prefix); if (unlikely(!__pyx_t_9)) __PYX_ERR(17, 27, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_9);
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_5, (PyObject*)__pyx_t_9))) __PYX_ERR(17, 27, __pyx_L6_error)
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      }
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_9genexpr18__pyx_v_prefix); __pyx_9genexpr18__pyx_v_prefix = 0;
      goto __pyx_L10_exit_scope;
      __pyx_L6_error:;
      __Pyx_XDECREF(__pyx_9genexpr18__pyx_v_prefix); __pyx_9genexpr18__pyx_v_prefix = 0;
      goto __pyx_L1_error;
      __pyx_L10_exit_scope:;
    } /* exit inner scope */
    __pyx_t_6 = PySet_New(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(17, 27, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_1 = __pyx_t_6;
    __pyx_t_6 = 0;
  } else {

    /* "src/lxml/cleanup.pxi":28
 *     keep_ns_prefixes = (
 *         set([_utf8(prefix) for prefix in keep_ns_prefixes])
 *         if keep_ns_prefixes else None)             # <<<<<<<<<<<<<<
 * 
 *     _removeUnusedNamespaceDeclarations(c_element, keep_ns_prefixes)
*/
    __Pyx_INCREF(Py_None);
    __pyx_t_1 = Py_None;
  }
  __Pyx_DECREF_SET(__pyx_v_keep_ns_prefixes, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/cleanup.pxi":30
 *         if keep_ns_prefixes else None)
 * 
 *     _removeUnusedNamespaceDeclarations(c_element, keep_ns_prefixes)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_1 = __pyx_v_keep_ns_prefixes;
  __Pyx_INCREF(__pyx_t_1);
  if (!(likely(PySet_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("set", __pyx_t_1))) __PYX_ERR(17, 30, __pyx_L1_error)
  __pyx_t_4 = __pyx_f_4lxml_5etree__removeUnusedNamespaceDeclarations(__pyx_v_c_element, ((PyObject*)__pyx_t_1)); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(17, 30, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/cleanup.pxi":3
 * # functions for tree cleanup and removing elements from subtrees
 * 
 * def cleanup_namespaces(tree_or_element, top_nsmap=None, keep_ns_prefixes=None):             # <<<<<<<<<<<<<<
 *     """cleanup_namespaces(tree_or_element, top_nsmap=None, keep_ns_prefixes=None)
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("lxml.etree.cleanup_namespaces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_element);
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XDECREF(__pyx_9genexpr18__pyx_v_prefix);
  __Pyx_XDECREF(__pyx_v_keep_ns_prefixes);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/cleanup.pxi":33
 * 
 * 
 * def strip_attributes(tree_or_element, *attribute_names):             # <<<<<<<<<<<<<<
 *     """strip_attributes(tree_or_element, *attribute_names)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_62strip_attributes(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_61strip_attributes, "strip_attributes(tree_or_element, *attribute_names)\n\n    Delete all attributes with the provided attribute names from an\n    Element (or ElementTree) and its descendants.\n\n    Attribute names can contain wildcards as in `_Element.iter`.\n\n    Example usage::\n\n        strip_attributes(root_element,\n                         'simpleattr',\n                         '{http://some/ns}attrname',\n                         '{http://other/ns}*')\n    ");
static PyMethodDef __pyx_mdef_4lxml_5etree_62strip_attributes = {"strip_attributes", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_62strip_attributes, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_61strip_attributes};
static PyObject *__pyx_pw_4lxml_5etree_62strip_attributes(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_tree_or_element = 0;
  PyObject *__pyx_v_attribute_names = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("strip_attributes (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  __pyx_v_attribute_names = __Pyx_ArgsSlice_FASTCALL(__pyx_args, 1, __pyx_nargs);
  if (unlikely(!__pyx_v_attribute_names)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_v_attribute_names);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_tree_or_element,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(17, 33, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        default:
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(17, 33, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      const Py_ssize_t used_pos_args = (kwd_pos_args < 1) ? kwd_pos_args : 1;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, used_pos_args, __pyx_kwds_len, "strip_attributes", 0) < (0)) __PYX_ERR(17, 33, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("strip_attributes", 0, 1, 1, i); __PYX_ERR(17, 33, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs < 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(17, 33, __pyx_L3_error)
    }
    __pyx_v_tree_or_element = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("strip_attributes", 0, 1, 1, __pyx_nargs); __PYX_ERR(17, 33, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v_attribute_names); __pyx_v_attribute_names = 0;
  __Pyx_AddTraceback("lxml.etree.strip_attributes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_61strip_attributes(__pyx_self, __pyx_v_tree_or_element, __pyx_v_attribute_names);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v_attribute_names);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_61strip_attributes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tree_or_element, PyObject *__pyx_v_attribute_names) {
  struct __pyx_obj_4lxml_5etree__MultiTagMatcher *__pyx_v_matcher = 0;
  struct LxmlElement *__pyx_v_element = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("strip_attributes", 0);

  /* "src/lxml/cleanup.pxi":49
 *     """
 *     cdef _MultiTagMatcher matcher
 *     element = _rootNodeOrRaise(tree_or_element)             # <<<<<<<<<<<<<<
 *     if not attribute_names:
 *         return
*/
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__rootNodeOrRaise(__pyx_v_tree_or_element)); if (unlikely(!__pyx_t_1)) __PYX_ERR(17, 49, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_element = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/cleanup.pxi":50
 *     cdef _MultiTagMatcher matcher
 *     element = _rootNodeOrRaise(tree_or_element)
 *     if not attribute_names:             # <<<<<<<<<<<<<<
 *         return
 * 
*/
  {
    Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_v_attribute_names);
    if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(17, 50, __pyx_L1_error)
    __pyx_t_2 = (__pyx_temp != 0);
  }

  __pyx_t_3 = (!__pyx_t_2);
  if (__pyx_t_3) {

    /* "src/lxml/cleanup.pxi":51
 *     element = _rootNodeOrRaise(tree_or_element)
 *     if not attribute_names:
 *         return             # <<<<<<<<<<<<<<
 * 
 *     matcher = _MultiTagMatcher.__new__(_MultiTagMatcher, attribute_names)
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/cleanup.pxi":50
 *     cdef _MultiTagMatcher matcher
 *     element = _rootNodeOrRaise(tree_or_element)
 *     if not attribute_names:             # <<<<<<<<<<<<<<
 *         return
 * 
*/
  }

  /* "src/lxml/cleanup.pxi":53
 *         return
 * 
 *     matcher = _MultiTagMatcher.__new__(_MultiTagMatcher, attribute_names)             # <<<<<<<<<<<<<<
 *     matcher.cacheTags(element._doc)
 *     if matcher.rejectsAllAttributes():
*/
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(17, 53, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_attribute_names);
  __Pyx_GIVEREF(__pyx_v_attribute_names);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_attribute_names) != (0)) __PYX_ERR(17, 53, __pyx_L1_error);
  __pyx_t_4 = ((PyObject *)__pyx_tp_new_4lxml_5etree__MultiTagMatcher(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__MultiTagMatcher), __pyx_t_1, NULL)); if (unlikely(!__pyx_t_4)) __PYX_ERR(17, 53, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_matcher = ((struct __pyx_obj_4lxml_5etree__MultiTagMatcher *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "src/lxml/cleanup.pxi":54
 * 
 *     matcher = _MultiTagMatcher.__new__(_MultiTagMatcher, attribute_names)
 *     matcher.cacheTags(element._doc)             # <<<<<<<<<<<<<<
 *     if matcher.rejectsAllAttributes():
 *         return
*/
  __pyx_t_4 = ((PyObject *)__pyx_v_element->_doc);
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_5 = __pyx_f_4lxml_5etree_16_MultiTagMatcher_cacheTags(__pyx_v_matcher, ((struct LxmlDocument *)__pyx_t_4), NULL); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(17, 54, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "src/lxml/cleanup.pxi":55
 *     matcher = _MultiTagMatcher.__new__(_MultiTagMatcher, attribute_names)
 *     matcher.cacheTags(element._doc)
 *     if matcher.rejectsAllAttributes():             # <<<<<<<<<<<<<<
 *         return
 *     _strip_attributes(element._c_node, matcher)
*/
  __pyx_t_3 = __pyx_f_4lxml_5etree_16_MultiTagMatcher_rejectsAllAttributes(__pyx_v_matcher);
  if (__pyx_t_3) {

    /* "src/lxml/cleanup.pxi":56
 *     matcher.cacheTags(element._doc)
 *     if matcher.rejectsAllAttributes():
 *         return             # <<<<<<<<<<<<<<
 *     _strip_attributes(element._c_node, matcher)
 * 
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/cleanup.pxi":55
 *     matcher = _MultiTagMatcher.__new__(_MultiTagMatcher, attribute_names)
 *     matcher.cacheTags(element._doc)
 *     if matcher.rejectsAllAttributes():             # <<<<<<<<<<<<<<
 *         return
 *     _strip_attributes(element._c_node, matcher)
*/
  }

  /* "src/lxml/cleanup.pxi":57
 *     if matcher.rejectsAllAttributes():
 *         return
 *     _strip_attributes(element._c_node, matcher)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_4 = __pyx_f_4lxml_5etree__strip_attributes(__pyx_v_element->_c_node, __pyx_v_matcher); if (unlikely(!__pyx_t_4)) __PYX_ERR(17, 57, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "src/lxml/cleanup.pxi":33
 * 
 * 
 * def strip_attributes(tree_or_element, *attribute_names):             # <<<<<<<<<<<<<<
 *     """strip_attributes(tree_or_element, *attribute_names)
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.strip_attributes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_matcher);
  __Pyx_XDECREF((PyObject *)__pyx_v_element);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/cleanup.pxi":60
 * 
 * 
 * cdef _strip_attributes(xmlNode* c_node, _MultiTagMatcher matcher):             # <<<<<<<<<<<<<<
 *     cdef xmlAttr* c_attr
 *     cdef xmlAttr* c_next_attr
*/

static PyObject *__pyx_f_4lxml_5etree__strip_attributes(xmlNode *__pyx_v_c_node, struct __pyx_obj_4lxml_5etree__MultiTagMatcher *__pyx_v_matcher) {
  xmlAttr *__pyx_v_c_attr;
  xmlAttr *__pyx_v_c_next_attr;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  xmlAttr *__pyx_t_2;
  __Pyx_RefNannySetupContext("_strip_attributes", 0);

  /* "src/lxml/cleanup.pxi":63
 *     cdef xmlAttr* c_attr
 *     cdef xmlAttr* c_next_attr
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_node, c_node, 1)             # <<<<<<<<<<<<<<
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         c_attr = c_node.properties
*/
  BEGIN_FOR_EACH_ELEMENT_FROM(__pyx_v_c_node, __pyx_v_c_node, 1);

  /* "src/lxml/cleanup.pxi":64
 *     cdef xmlAttr* c_next_attr
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_node, c_node, 1)
 *     if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         c_attr = c_node.properties
 *         while c_attr is not NULL:
*/
  __pyx_t_1 = (__pyx_v_c_node->type == XML_ELEMENT_NODE);
  if (__pyx_t_1) {

    /* "src/lxml/cleanup.pxi":65
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_node, c_node, 1)
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         c_attr = c_node.properties             # <<<<<<<<<<<<<<
 *         while c_attr is not NULL:
 *             c_next_attr = c_attr.next
*/
    __pyx_t_2 = __pyx_v_c_node->properties;
    __pyx_v_c_attr = __pyx_t_2;

    /* "src/lxml/cleanup.pxi":66
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         c_attr = c_node.properties
 *         while c_attr is not NULL:             # <<<<<<<<<<<<<<
 *             c_next_attr = c_attr.next
 *             if matcher.matchesAttribute(c_attr):
*/
    while (1) {
      __pyx_t_1 = (__pyx_v_c_attr != NULL);
      if (!__pyx_t_1) break;

      /* "src/lxml/cleanup.pxi":67
 *         c_attr = c_node.properties
 *         while c_attr is not NULL:
 *             c_next_attr = c_attr.next             # <<<<<<<<<<<<<<
 *             if matcher.matchesAttribute(c_attr):
 *                 tree.xmlRemoveProp(c_attr)
*/
      __pyx_t_2 = __pyx_v_c_attr->next;
      __pyx_v_c_next_attr = __pyx_t_2;

      /* "src/lxml/cleanup.pxi":68
 *         while c_attr is not NULL:
 *             c_next_attr = c_attr.next
 *             if matcher.matchesAttribute(c_attr):             # <<<<<<<<<<<<<<
 *                 tree.xmlRemoveProp(c_attr)
 *             c_attr = c_next_attr
*/
      __pyx_t_1 = __pyx_f_4lxml_5etree_16_MultiTagMatcher_matchesAttribute(__pyx_v_matcher, __pyx_v_c_attr);
      if (__pyx_t_1) {

        /* "src/lxml/cleanup.pxi":69
 *             c_next_attr = c_attr.next
 *             if matcher.matchesAttribute(c_attr):
 *                 tree.xmlRemoveProp(c_attr)             # <<<<<<<<<<<<<<
 *             c_attr = c_next_attr
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)
*/
        (void)(xmlRemoveProp(__pyx_v_c_attr));

        /* "src/lxml/cleanup.pxi":68
 *         while c_attr is not NULL:
 *             c_next_attr = c_attr.next
 *             if matcher.matchesAttribute(c_attr):             # <<<<<<<<<<<<<<
 *                 tree.xmlRemoveProp(c_attr)
 *             c_attr = c_next_attr
*/
      }

      /* "src/lxml/cleanup.pxi":70
 *             if matcher.matchesAttribute(c_attr):
 *                 tree.xmlRemoveProp(c_attr)
 *             c_attr = c_next_attr             # <<<<<<<<<<<<<<
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 * 
*/
      __pyx_v_c_attr = __pyx_v_c_next_attr;
    }

    /* "src/lxml/cleanup.pxi":64
 *     cdef xmlAttr* c_next_attr
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_node, c_node, 1)
 *     if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         c_attr = c_node.properties
 *         while c_attr is not NULL:
*/
  }

  /* "src/lxml/cleanup.pxi":71
 *                 tree.xmlRemoveProp(c_attr)
 *             c_attr = c_next_attr
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  END_FOR_EACH_ELEMENT_FROM(__pyx_v_c_node);

  /* "src/lxml/cleanup.pxi":60
 * 
 * 
 * cdef _strip_attributes(xmlNode* c_node, _MultiTagMatcher matcher):             # <<<<<<<<<<<<<<
 *     cdef xmlAttr* c_attr
 *     cdef xmlAttr* c_next_attr
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/cleanup.pxi":74
 * 
 * 
 * def strip_elements(tree_or_element, *tag_names, bint with_tail=True):             # <<<<<<<<<<<<<<
 *     """strip_elements(tree_or_element, *tag_names, with_tail=True)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_64strip_elements(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_63strip_elements, "strip_elements(tree_or_element, *tag_names, with_tail=True)\n\n    Delete all elements with the provided tag names from a tree or\n    subtree.  This will remove the elements and their entire subtree,\n    including all their attributes, text content and descendants.  It\n    will also remove the tail text of the element unless you\n    explicitly set the ``with_tail`` keyword argument option to False.\n\n    Tag names can contain wildcards as in `_Element.iter`.\n\n    Note that this will not delete the element (or ElementTree root\n    element) that you passed even if it matches.  It will only treat\n    its descendants.  If you want to include the root element, check\n    its tag name directly before even calling this function.\n\n    Example usage::\n\n        strip_elements(some_element,\n            'simpletagname',             # non-namespaced tag\n            '{http://some/ns}tagname',   # namespaced tag\n            '{http://some/other/ns}*'    # any tag from a namespace\n            lxml.etree.Comment           # comments\n            )\n    ");
static PyMethodDef __pyx_mdef_4lxml_5etree_64strip_elements = {"strip_elements", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_64strip_elements, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_63strip_elements};
static PyObject *__pyx_pw_4lxml_5etree_64strip_elements(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_tree_or_element = 0;
  int __pyx_v_with_tail;
  PyObject *__pyx_v_tag_names = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("strip_elements (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  __pyx_v_tag_names = __Pyx_ArgsSlice_FASTCALL(__pyx_args, 1, __pyx_nargs);
  if (unlikely(!__pyx_v_tag_names)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_v_tag_names);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_tree_or_element,&__pyx_mstate_global->__pyx_n_u_with_tail,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(17, 74, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        default:
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(17, 74, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      const Py_ssize_t used_pos_args = (kwd_pos_args < 1) ? kwd_pos_args : 1;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, used_pos_args, __pyx_kwds_len, "strip_elements", 0) < (0)) __PYX_ERR(17, 74, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("strip_elements", 0, 1, 1, i); __PYX_ERR(17, 74, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs < 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(17, 74, __pyx_L3_error)
    }
    __pyx_v_tree_or_element = values[0];
    if (values[1]) {
      __pyx_v_with_tail = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_with_tail == (int)-1) && PyErr_Occurred())) __PYX_ERR(17, 74, __pyx_L3_error)
    } else {
      __pyx_v_with_tail = ((int)((int)1));
    }
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("strip_elements", 0, 1, 1, __pyx_nargs); __PYX_ERR(17, 74, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v_tag_names); __pyx_v_tag_names = 0;
  __Pyx_AddTraceback("lxml.etree.strip_elements", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_63strip_elements(__pyx_self, __pyx_v_tree_or_element, __pyx_v_with_tail, __pyx_v_tag_names);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v_tag_names);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_63strip_elements(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tree_or_element, int __pyx_v_with_tail, PyObject *__pyx_v_tag_names) {
  struct __pyx_obj_4lxml_5etree__MultiTagMatcher *__pyx_v_matcher = 0;
  struct LxmlDocument *__pyx_v_doc = NULL;
  struct LxmlElement *__pyx_v_element = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("strip_elements", 0);

  /* "src/lxml/cleanup.pxi":100
 *     """
 *     cdef _MultiTagMatcher matcher
 *     doc = _documentOrRaise(tree_or_element)             # <<<<<<<<<<<<<<
 *     element = _rootNodeOrRaise(tree_or_element)
 *     if not tag_names:
*/
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__documentOrRaise(__pyx_v_tree_or_element)); if (unlikely(!__pyx_t_1)) __PYX_ERR(17, 100, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/cleanup.pxi":101
 *     cdef _MultiTagMatcher matcher
 *     doc = _documentOrRaise(tree_or_element)
 *     element = _rootNodeOrRaise(tree_or_element)             # <<<<<<<<<<<<<<
 *     if not tag_names:
 *         return
*/
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__rootNodeOrRaise(__pyx_v_tree_or_element)); if (unlikely(!__pyx_t_1)) __PYX_ERR(17, 101, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_element = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/cleanup.pxi":102
 *     doc = _documentOrRaise(tree_or_element)
 *     element = _rootNodeOrRaise(tree_or_element)
 *     if not tag_names:             # <<<<<<<<<<<<<<
 *         return
 * 
*/
  {
    Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_v_tag_names);
    if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(17, 102, __pyx_L1_error)
    __pyx_t_2 = (__pyx_temp != 0);
  }

  __pyx_t_3 = (!__pyx_t_2);
  if (__pyx_t_3) {

    /* "src/lxml/cleanup.pxi":103
 *     element = _rootNodeOrRaise(tree_or_element)
 *     if not tag_names:
 *         return             # <<<<<<<<<<<<<<
 * 
 *     matcher = _MultiTagMatcher.__new__(_MultiTagMatcher, tag_names)
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/cleanup.pxi":102
 *     doc = _documentOrRaise(tree_or_element)
 *     element = _rootNodeOrRaise(tree_or_element)
 *     if not tag_names:             # <<<<<<<<<<<<<<
 *         return
 * 
*/
  }

  /* "src/lxml/cleanup.pxi":105
 *         return
 * 
 *     matcher = _MultiTagMatcher.__new__(_MultiTagMatcher, tag_names)             # <<<<<<<<<<<<<<
 *     matcher.cacheTags(doc)
 *     if matcher.rejectsAll():
*/
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(17, 105, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_tag_names);
  __Pyx_GIVEREF(__pyx_v_tag_names);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_tag_names) != (0)) __PYX_ERR(17, 105, __pyx_L1_error);
  __pyx_t_4 = ((PyObject *)__pyx_tp_new_4lxml_5etree__MultiTagMatcher(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__MultiTagMatcher), __pyx_t_1, NULL)); if (unlikely(!__pyx_t_4)) __PYX_ERR(17, 105, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_matcher = ((struct __pyx_obj_4lxml_5etree__MultiTagMatcher *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "src/lxml/cleanup.pxi":106
 * 
 *     matcher = _MultiTagMatcher.__new__(_MultiTagMatcher, tag_names)
 *     matcher.cacheTags(doc)             # <<<<<<<<<<<<<<
 *     if matcher.rejectsAll():
 *         return
*/
  __pyx_t_5 = __pyx_f_4lxml_5etree_16_MultiTagMatcher_cacheTags(__pyx_v_matcher, __pyx_v_doc, NULL); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(17, 106, __pyx_L1_error)

  /* "src/lxml/cleanup.pxi":107
 *     matcher = _MultiTagMatcher.__new__(_MultiTagMatcher, tag_names)
 *     matcher.cacheTags(doc)
 *     if matcher.rejectsAll():             # <<<<<<<<<<<<<<
 *         return
 * 
*/
  __pyx_t_3 = __pyx_f_4lxml_5etree_16_MultiTagMatcher_rejectsAll(__pyx_v_matcher);
  if (__pyx_t_3) {

    /* "src/lxml/cleanup.pxi":108
 *     matcher.cacheTags(doc)
 *     if matcher.rejectsAll():
 *         return             # <<<<<<<<<<<<<<
 * 
 *     if isinstance(tree_or_element, _ElementTree):
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/cleanup.pxi":107
 *     matcher = _MultiTagMatcher.__new__(_MultiTagMatcher, tag_names)
 *     matcher.cacheTags(doc)
 *     if matcher.rejectsAll():             # <<<<<<<<<<<<<<
 *         return
 * 
*/
  }

  /* "src/lxml/cleanup.pxi":110
 *         return
 * 
 *     if isinstance(tree_or_element, _ElementTree):             # <<<<<<<<<<<<<<
 *         # include PIs and comments next to the root node
 *         if matcher.matchesType(tree.XML_COMMENT_NODE):
*/
  __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_tree_or_element, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ElementTree); 
  if (__pyx_t_3) {

    /* "src/lxml/cleanup.pxi":112
 *     if isinstance(tree_or_element, _ElementTree):
 *         # include PIs and comments next to the root node
 *         if matcher.matchesType(tree.XML_COMMENT_NODE):             # <<<<<<<<<<<<<<
 *             _removeSiblings(element._c_node, tree.XML_COMMENT_NODE, with_tail)
 *         if matcher.matchesType(tree.XML_PI_NODE):
*/
    __pyx_t_3 = __pyx_f_4lxml_5etree_16_MultiTagMatcher_matchesType(__pyx_v_matcher, XML_COMMENT_NODE);
    if (__pyx_t_3) {

      /* "src/lxml/cleanup.pxi":113
 *         # include PIs and comments next to the root node
 *         if matcher.matchesType(tree.XML_COMMENT_NODE):
 *             _removeSiblings(element._c_node, tree.XML_COMMENT_NODE, with_tail)             # <<<<<<<<<<<<<<
 *         if matcher.matchesType(tree.XML_PI_NODE):
 *             _removeSiblings(element._c_node, tree.XML_PI_NODE, with_tail)
*/
      __pyx_t_5 = __pyx_f_4lxml_5etree__removeSiblings(__pyx_v_element->_c_node, XML_COMMENT_NODE, __pyx_v_with_tail); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(17, 113, __pyx_L1_error)

      /* "src/lxml/cleanup.pxi":112
 *     if isinstance(tree_or_element, _ElementTree):
 *         # include PIs and comments next to the root node
 *         if matcher.matchesType(tree.XML_COMMENT_NODE):             # <<<<<<<<<<<<<<
 *             _removeSiblings(element._c_node, tree.XML_COMMENT_NODE, with_tail)
 *         if matcher.matchesType(tree.XML_PI_NODE):
*/
    }

    /* "src/lxml/cleanup.pxi":114
 *         if matcher.matchesType(tree.XML_COMMENT_NODE):
 *             _removeSiblings(element._c_node, tree.XML_COMMENT_NODE, with_tail)
 *         if matcher.matchesType(tree.XML_PI_NODE):             # <<<<<<<<<<<<<<
 *             _removeSiblings(element._c_node, tree.XML_PI_NODE, with_tail)
 *     _strip_elements(doc, element._c_node, matcher, with_tail)
*/
    __pyx_t_3 = __pyx_f_4lxml_5etree_16_MultiTagMatcher_matchesType(__pyx_v_matcher, XML_PI_NODE);
    if (__pyx_t_3) {

      /* "src/lxml/cleanup.pxi":115
 *             _removeSiblings(element._c_node, tree.XML_COMMENT_NODE, with_tail)
 *         if matcher.matchesType(tree.XML_PI_NODE):
 *             _removeSiblings(element._c_node, tree.XML_PI_NODE, with_tail)             # <<<<<<<<<<<<<<
 *     _strip_elements(doc, element._c_node, matcher, with_tail)
 * 
*/
      __pyx_t_5 = __pyx_f_4lxml_5etree__removeSiblings(__pyx_v_element->_c_node, XML_PI_NODE, __pyx_v_with_tail); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(17, 115, __pyx_L1_error)

      /* "src/lxml/cleanup.pxi":114
 *         if matcher.matchesType(tree.XML_COMMENT_NODE):
 *             _removeSiblings(element._c_node, tree.XML_COMMENT_NODE, with_tail)
 *         if matcher.matchesType(tree.XML_PI_NODE):             # <<<<<<<<<<<<<<
 *             _removeSiblings(element._c_node, tree.XML_PI_NODE, with_tail)
 *     _strip_elements(doc, element._c_node, matcher, with_tail)
*/
    }

    /* "src/lxml/cleanup.pxi":110
 *         return
 * 
 *     if isinstance(tree_or_element, _ElementTree):             # <<<<<<<<<<<<<<
 *         # include PIs and comments next to the root node
 *         if matcher.matchesType(tree.XML_COMMENT_NODE):
*/
  }

  /* "src/lxml/cleanup.pxi":116
 *         if matcher.matchesType(tree.XML_PI_NODE):
 *             _removeSiblings(element._c_node, tree.XML_PI_NODE, with_tail)
 *     _strip_elements(doc, element._c_node, matcher, with_tail)             # <<<<<<<<<<<<<<
 * 
 * cdef _strip_elements(_Document doc, xmlNode* c_node, _MultiTagMatcher matcher,
*/
  __pyx_t_4 = __pyx_f_4lxml_5etree__strip_elements(__pyx_v_doc, __pyx_v_element->_c_node, __pyx_v_matcher, __pyx_v_with_tail); if (unlikely(!__pyx_t_4)) __PYX_ERR(17, 116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "src/lxml/cleanup.pxi":74
 * 
 * 
 * def strip_elements(tree_or_element, *tag_names, bint with_tail=True):             # <<<<<<<<<<<<<<
 *     """strip_elements(tree_or_element, *tag_names, with_tail=True)
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.strip_elements", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_matcher);
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XDECREF((PyObject *)__pyx_v_element);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/cleanup.pxi":118
 *     _strip_elements(doc, element._c_node, matcher, with_tail)
 * 
 * cdef _strip_elements(_Document doc, xmlNode* c_node, _MultiTagMatcher matcher,             # <<<<<<<<<<<<<<
 *                      bint with_tail):
 *     cdef xmlNode* c_child
*/

static PyObject *__pyx_f_4lxml_5etree__strip_elements(struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_node, struct __pyx_obj_4lxml_5etree__MultiTagMatcher *__pyx_v_matcher, int __pyx_v_with_tail) {
  xmlNode *__pyx_v_c_child;
  xmlNode *__pyx_v_c_next;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_strip_elements", 0);

  /* "src/lxml/cleanup.pxi":123
 *     cdef xmlNode* c_next
 * 
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_node, c_node, 1)             # <<<<<<<<<<<<<<
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         # we run through the children here to prevent any problems
*/
  BEGIN_FOR_EACH_ELEMENT_FROM(__pyx_v_c_node, __pyx_v_c_node, 1);

  /* "src/lxml/cleanup.pxi":124
 * 
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_node, c_node, 1)
 *     if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         # we run through the children here to prevent any problems
 *         # with the tree iteration which would occur if we unlinked the
*/
  __pyx_t_1 = (__pyx_v_c_node->type == XML_ELEMENT_NODE);
  if (__pyx_t_1) {

    /* "src/lxml/cleanup.pxi":128
 *         # with the tree iteration which would occur if we unlinked the
 *         # c_node itself
 *         c_child = _findChildForwards(c_node, 0)             # <<<<<<<<<<<<<<
 *         while c_child is not NULL:
 *             c_next = _nextElement(c_child)
*/
    __pyx_v_c_child = __pyx_f_4lxml_5etree__findChildForwards(__pyx_v_c_node, 0);

    /* "src/lxml/cleanup.pxi":129
 *         # c_node itself
 *         c_child = _findChildForwards(c_node, 0)
 *         while c_child is not NULL:             # <<<<<<<<<<<<<<
 *             c_next = _nextElement(c_child)
 *             if matcher.matches(c_child):
*/
    while (1) {
      __pyx_t_1 = (__pyx_v_c_child != NULL);
      if (!__pyx_t_1) break;

      /* "src/lxml/cleanup.pxi":130
 *         c_child = _findChildForwards(c_node, 0)
 *         while c_child is not NULL:
 *             c_next = _nextElement(c_child)             # <<<<<<<<<<<<<<
 *             if matcher.matches(c_child):
 *                 if c_child.type == tree.XML_ELEMENT_NODE:
*/
      __pyx_v_c_next = __pyx_f_4lxml_5etree__nextElement(__pyx_v_c_child);

      /* "src/lxml/cleanup.pxi":131
 *         while c_child is not NULL:
 *             c_next = _nextElement(c_child)
 *             if matcher.matches(c_child):             # <<<<<<<<<<<<<<
 *                 if c_child.type == tree.XML_ELEMENT_NODE:
 *                     if not with_tail:
*/
      __pyx_t_1 = __pyx_f_4lxml_5etree_16_MultiTagMatcher_matches(__pyx_v_matcher, __pyx_v_c_child);
      if (__pyx_t_1) {

        /* "src/lxml/cleanup.pxi":132
 *             c_next = _nextElement(c_child)
 *             if matcher.matches(c_child):
 *                 if c_child.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *                     if not with_tail:
 *                         tree.xmlUnlinkNode(c_child)
*/
        __pyx_t_1 = (__pyx_v_c_child->type == XML_ELEMENT_NODE);
        if (__pyx_t_1) {

          /* "src/lxml/cleanup.pxi":133
 *             if matcher.matches(c_child):
 *                 if c_child.type == tree.XML_ELEMENT_NODE:
 *                     if not with_tail:             # <<<<<<<<<<<<<<
 *                         tree.xmlUnlinkNode(c_child)
 *                     _removeNode(doc, c_child)
*/
          __pyx_t_1 = (!__pyx_v_with_tail);
          if (__pyx_t_1) {

            /* "src/lxml/cleanup.pxi":134
 *                 if c_child.type == tree.XML_ELEMENT_NODE:
 *                     if not with_tail:
 *                         tree.xmlUnlinkNode(c_child)             # <<<<<<<<<<<<<<
 *                     _removeNode(doc, c_child)
 *                 else:
*/
            xmlUnlinkNode(__pyx_v_c_child);

            /* "src/lxml/cleanup.pxi":133
 *             if matcher.matches(c_child):
 *                 if c_child.type == tree.XML_ELEMENT_NODE:
 *                     if not with_tail:             # <<<<<<<<<<<<<<
 *                         tree.xmlUnlinkNode(c_child)
 *                     _removeNode(doc, c_child)
*/
          }

          /* "src/lxml/cleanup.pxi":135
 *                     if not with_tail:
 *                         tree.xmlUnlinkNode(c_child)
 *                     _removeNode(doc, c_child)             # <<<<<<<<<<<<<<
 *                 else:
 *                     if with_tail:
*/
          __pyx_t_2 = __pyx_f_4lxml_5etree__removeNode(__pyx_v_doc, __pyx_v_c_child); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(17, 135, __pyx_L1_error)

          /* "src/lxml/cleanup.pxi":132
 *             c_next = _nextElement(c_child)
 *             if matcher.matches(c_child):
 *                 if c_child.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *                     if not with_tail:
 *                         tree.xmlUnlinkNode(c_child)
*/
          goto __pyx_L7;
        }

        /* "src/lxml/cleanup.pxi":137
 *                     _removeNode(doc, c_child)
 *                 else:
 *                     if with_tail:             # <<<<<<<<<<<<<<
 *                         _removeText(c_child.next)
 *                     tree.xmlUnlinkNode(c_child)
*/
        /*else*/ {
          if (__pyx_v_with_tail) {

            /* "src/lxml/cleanup.pxi":138
 *                 else:
 *                     if with_tail:
 *                         _removeText(c_child.next)             # <<<<<<<<<<<<<<
 *                     tree.xmlUnlinkNode(c_child)
 *                     attemptDeallocation(c_child)
*/
            __pyx_f_4lxml_5etree__removeText(__pyx_v_c_child->next);

            /* "src/lxml/cleanup.pxi":137
 *                     _removeNode(doc, c_child)
 *                 else:
 *                     if with_tail:             # <<<<<<<<<<<<<<
 *                         _removeText(c_child.next)
 *                     tree.xmlUnlinkNode(c_child)
*/
          }

          /* "src/lxml/cleanup.pxi":139
 *                     if with_tail:
 *                         _removeText(c_child.next)
 *                     tree.xmlUnlinkNode(c_child)             # <<<<<<<<<<<<<<
 *                     attemptDeallocation(c_child)
 *             c_child = c_next
*/
          xmlUnlinkNode(__pyx_v_c_child);

          /* "src/lxml/cleanup.pxi":140
 *                         _removeText(c_child.next)
 *                     tree.xmlUnlinkNode(c_child)
 *                     attemptDeallocation(c_child)             # <<<<<<<<<<<<<<
 *             c_child = c_next
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)
*/
          (void)(__pyx_f_4lxml_5etree_attemptDeallocation(__pyx_v_c_child));
        }
        __pyx_L7:;

        /* "src/lxml/cleanup.pxi":131
 *         while c_child is not NULL:
 *             c_next = _nextElement(c_child)
 *             if matcher.matches(c_child):             # <<<<<<<<<<<<<<
 *                 if c_child.type == tree.XML_ELEMENT_NODE:
 *                     if not with_tail:
*/
      }

      /* "src/lxml/cleanup.pxi":141
 *                     tree.xmlUnlinkNode(c_child)
 *                     attemptDeallocation(c_child)
 *             c_child = c_next             # <<<<<<<<<<<<<<
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 * 
*/
      __pyx_v_c_child = __pyx_v_c_next;
    }

    /* "src/lxml/cleanup.pxi":124
 * 
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_node, c_node, 1)
 *     if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         # we run through the children here to prevent any problems
 *         # with the tree iteration which would occur if we unlinked the
*/
  }

  /* "src/lxml/cleanup.pxi":142
 *                     attemptDeallocation(c_child)
 *             c_child = c_next
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  END_FOR_EACH_ELEMENT_FROM(__pyx_v_c_node);

  /* "src/lxml/cleanup.pxi":118
 *     _strip_elements(doc, element._c_node, matcher, with_tail)
 * 
 * cdef _strip_elements(_Document doc, xmlNode* c_node, _MultiTagMatcher matcher,             # <<<<<<<<<<<<<<
 *                      bint with_tail):
 *     cdef xmlNode* c_child
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._strip_elements", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/cleanup.pxi":145
 * 
 * 
 * def strip_tags(tree_or_element, *tag_names):             # <<<<<<<<<<<<<<
 *     """strip_tags(tree_or_element, *tag_names)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_66strip_tags(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_65strip_tags, "strip_tags(tree_or_element, *tag_names)\n\n    Delete all elements with the provided tag names from a tree or\n    subtree.  This will remove the elements and their attributes, but\n    *not* their text/tail content or descendants.  Instead, it will\n    merge the text content and children of the element into its\n    parent.\n\n    Tag names can contain wildcards as in `_Element.iter`.\n\n    Note that this will not delete the element (or ElementTree root\n    element) that you passed even if it matches.  It will only treat\n    its descendants.\n\n    Example usage::\n\n        strip_tags(some_element,\n            'simpletagname',             # non-namespaced tag\n            '{http://some/ns}tagname',   # namespaced tag\n            '{http://some/other/ns}*'    # any tag from a namespace\n            Comment                      # comments (including their text!)\n            )\n    ");
static PyMethodDef __pyx_mdef_4lxml_5etree_66strip_tags = {"strip_tags", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_66strip_tags, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_65strip_tags};
static PyObject *__pyx_pw_4lxml_5etree_66strip_tags(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_tree_or_element = 0;
  PyObject *__pyx_v_tag_names = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("strip_tags (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  __pyx_v_tag_names = __Pyx_ArgsSlice_FASTCALL(__pyx_args, 1, __pyx_nargs);
  if (unlikely(!__pyx_v_tag_names)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_v_tag_names);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_tree_or_element,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(17, 145, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        default:
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(17, 145, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      const Py_ssize_t used_pos_args = (kwd_pos_args < 1) ? kwd_pos_args : 1;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, used_pos_args, __pyx_kwds_len, "strip_tags", 0) < (0)) __PYX_ERR(17, 145, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("strip_tags", 0, 1, 1, i); __PYX_ERR(17, 145, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs < 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(17, 145, __pyx_L3_error)
    }
    __pyx_v_tree_or_element = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("strip_tags", 0, 1, 1, __pyx_nargs); __PYX_ERR(17, 145, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v_tag_names); __pyx_v_tag_names = 0;
  __Pyx_AddTraceback("lxml.etree.strip_tags", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_65strip_tags(__pyx_self, __pyx_v_tree_or_element, __pyx_v_tag_names);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v_tag_names);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_65strip_tags(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tree_or_element, PyObject *__pyx_v_tag_names) {
  struct __pyx_obj_4lxml_5etree__MultiTagMatcher *__pyx_v_matcher = 0;
  struct LxmlDocument *__pyx_v_doc = NULL;
  struct LxmlElement *__pyx_v_element = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("strip_tags", 0);

  /* "src/lxml/cleanup.pxi":170
 *     """
 *     cdef _MultiTagMatcher matcher
 *     doc = _documentOrRaise(tree_or_element)             # <<<<<<<<<<<<<<
 *     element = _rootNodeOrRaise(tree_or_element)
 *     if not tag_names:
*/
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__documentOrRaise(__pyx_v_tree_or_element)); if (unlikely(!__pyx_t_1)) __PYX_ERR(17, 170, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/cleanup.pxi":171
 *     cdef _MultiTagMatcher matcher
 *     doc = _documentOrRaise(tree_or_element)
 *     element = _rootNodeOrRaise(tree_or_element)             # <<<<<<<<<<<<<<
 *     if not tag_names:
 *         return
*/
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__rootNodeOrRaise(__pyx_v_tree_or_element)); if (unlikely(!__pyx_t_1)) __PYX_ERR(17, 171, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_element = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/cleanup.pxi":172
 *     doc = _documentOrRaise(tree_or_element)
 *     element = _rootNodeOrRaise(tree_or_element)
 *     if not tag_names:             # <<<<<<<<<<<<<<
 *         return
 * 
*/
  {
    Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_v_tag_names);
    if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(17, 172, __pyx_L1_error)
    __pyx_t_2 = (__pyx_temp != 0);
  }

  __pyx_t_3 = (!__pyx_t_2);
  if (__pyx_t_3) {

    /* "src/lxml/cleanup.pxi":173
 *     element = _rootNodeOrRaise(tree_or_element)
 *     if not tag_names:
 *         return             # <<<<<<<<<<<<<<
 * 
 *     matcher = _MultiTagMatcher.__new__(_MultiTagMatcher, tag_names)
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/cleanup.pxi":172
 *     doc = _documentOrRaise(tree_or_element)
 *     element = _rootNodeOrRaise(tree_or_element)
 *     if not tag_names:             # <<<<<<<<<<<<<<
 *         return
 * 
*/
  }

  /* "src/lxml/cleanup.pxi":175
 *         return
 * 
 *     matcher = _MultiTagMatcher.__new__(_MultiTagMatcher, tag_names)             # <<<<<<<<<<<<<<
 *     matcher.cacheTags(doc)
 *     if matcher.rejectsAll():
*/
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(17, 175, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_tag_names);
  __Pyx_GIVEREF(__pyx_v_tag_names);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_tag_names) != (0)) __PYX_ERR(17, 175, __pyx_L1_error);
  __pyx_t_4 = ((PyObject *)__pyx_tp_new_4lxml_5etree__MultiTagMatcher(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__MultiTagMatcher), __pyx_t_1, NULL)); if (unlikely(!__pyx_t_4)) __PYX_ERR(17, 175, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_matcher = ((struct __pyx_obj_4lxml_5etree__MultiTagMatcher *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "src/lxml/cleanup.pxi":176
 * 
 *     matcher = _MultiTagMatcher.__new__(_MultiTagMatcher, tag_names)
 *     matcher.cacheTags(doc)             # <<<<<<<<<<<<<<
 *     if matcher.rejectsAll():
 *         return
*/
  __pyx_t_5 = __pyx_f_4lxml_5etree_16_MultiTagMatcher_cacheTags(__pyx_v_matcher, __pyx_v_doc, NULL); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(17, 176, __pyx_L1_error)

  /* "src/lxml/cleanup.pxi":177
 *     matcher = _MultiTagMatcher.__new__(_MultiTagMatcher, tag_names)
 *     matcher.cacheTags(doc)
 *     if matcher.rejectsAll():             # <<<<<<<<<<<<<<
 *         return
 * 
*/
  __pyx_t_3 = __pyx_f_4lxml_5etree_16_MultiTagMatcher_rejectsAll(__pyx_v_matcher);
  if (__pyx_t_3) {

    /* "src/lxml/cleanup.pxi":178
 *     matcher.cacheTags(doc)
 *     if matcher.rejectsAll():
 *         return             # <<<<<<<<<<<<<<
 * 
 *     if isinstance(tree_or_element, _ElementTree):
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/cleanup.pxi":177
 *     matcher = _MultiTagMatcher.__new__(_MultiTagMatcher, tag_names)
 *     matcher.cacheTags(doc)
 *     if matcher.rejectsAll():             # <<<<<<<<<<<<<<
 *         return
 * 
*/
  }

  /* "src/lxml/cleanup.pxi":180
 *         return
 * 
 *     if isinstance(tree_or_element, _ElementTree):             # <<<<<<<<<<<<<<
 *         # include PIs and comments next to the root node
 *         if matcher.matchesType(tree.XML_COMMENT_NODE):
*/
  __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_tree_or_element, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ElementTree); 
  if (__pyx_t_3) {

    /* "src/lxml/cleanup.pxi":182
 *     if isinstance(tree_or_element, _ElementTree):
 *         # include PIs and comments next to the root node
 *         if matcher.matchesType(tree.XML_COMMENT_NODE):             # <<<<<<<<<<<<<<
 *             _removeSiblings(element._c_node, tree.XML_COMMENT_NODE, 0)
 *         if matcher.matchesType(tree.XML_PI_NODE):
*/
    __pyx_t_3 = __pyx_f_4lxml_5etree_16_MultiTagMatcher_matchesType(__pyx_v_matcher, XML_COMMENT_NODE);
    if (__pyx_t_3) {

      /* "src/lxml/cleanup.pxi":183
 *         # include PIs and comments next to the root node
 *         if matcher.matchesType(tree.XML_COMMENT_NODE):
 *             _removeSiblings(element._c_node, tree.XML_COMMENT_NODE, 0)             # <<<<<<<<<<<<<<
 *         if matcher.matchesType(tree.XML_PI_NODE):
 *             _removeSiblings(element._c_node, tree.XML_PI_NODE, 0)
*/
      __pyx_t_5 = __pyx_f_4lxml_5etree__removeSiblings(__pyx_v_element->_c_node, XML_COMMENT_NODE, 0); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(17, 183, __pyx_L1_error)

      /* "src/lxml/cleanup.pxi":182
 *     if isinstance(tree_or_element, _ElementTree):
 *         # include PIs and comments next to the root node
 *         if matcher.matchesType(tree.XML_COMMENT_NODE):             # <<<<<<<<<<<<<<
 *             _removeSiblings(element._c_node, tree.XML_COMMENT_NODE, 0)
 *         if matcher.matchesType(tree.XML_PI_NODE):
*/
    }

    /* "src/lxml/cleanup.pxi":184
 *         if matcher.matchesType(tree.XML_COMMENT_NODE):
 *             _removeSiblings(element._c_node, tree.XML_COMMENT_NODE, 0)
 *         if matcher.matchesType(tree.XML_PI_NODE):             # <<<<<<<<<<<<<<
 *             _removeSiblings(element._c_node, tree.XML_PI_NODE, 0)
 *     _strip_tags(doc, element._c_node, matcher)
*/
    __pyx_t_3 = __pyx_f_4lxml_5etree_16_MultiTagMatcher_matchesType(__pyx_v_matcher, XML_PI_NODE);
    if (__pyx_t_3) {

      /* "src/lxml/cleanup.pxi":185
 *             _removeSiblings(element._c_node, tree.XML_COMMENT_NODE, 0)
 *         if matcher.matchesType(tree.XML_PI_NODE):
 *             _removeSiblings(element._c_node, tree.XML_PI_NODE, 0)             # <<<<<<<<<<<<<<
 *     _strip_tags(doc, element._c_node, matcher)
 * 
*/
      __pyx_t_5 = __pyx_f_4lxml_5etree__removeSiblings(__pyx_v_element->_c_node, XML_PI_NODE, 0); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(17, 185, __pyx_L1_error)

      /* "src/lxml/cleanup.pxi":184
 *         if matcher.matchesType(tree.XML_COMMENT_NODE):
 *             _removeSiblings(element._c_node, tree.XML_COMMENT_NODE, 0)
 *         if matcher.matchesType(tree.XML_PI_NODE):             # <<<<<<<<<<<<<<
 *             _removeSiblings(element._c_node, tree.XML_PI_NODE, 0)
 *     _strip_tags(doc, element._c_node, matcher)
*/
    }

    /* "src/lxml/cleanup.pxi":180
 *         return
 * 
 *     if isinstance(tree_or_element, _ElementTree):             # <<<<<<<<<<<<<<
 *         # include PIs and comments next to the root node
 *         if matcher.matchesType(tree.XML_COMMENT_NODE):
*/
  }

  /* "src/lxml/cleanup.pxi":186
 *         if matcher.matchesType(tree.XML_PI_NODE):
 *             _removeSiblings(element._c_node, tree.XML_PI_NODE, 0)
 *     _strip_tags(doc, element._c_node, matcher)             # <<<<<<<<<<<<<<
 * 
 * cdef _strip_tags(_Document doc, xmlNode* c_node, _MultiTagMatcher matcher):
*/
  __pyx_t_4 = __pyx_f_4lxml_5etree__strip_tags(__pyx_v_doc, __pyx_v_element->_c_node, __pyx_v_matcher); if (unlikely(!__pyx_t_4)) __PYX_ERR(17, 186, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "src/lxml/cleanup.pxi":145
 * 
 * 
 * def strip_tags(tree_or_element, *tag_names):             # <<<<<<<<<<<<<<
 *     """strip_tags(tree_or_element, *tag_names)
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.strip_tags", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_matcher);
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XDECREF((PyObject *)__pyx_v_element);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/cleanup.pxi":188
 *     _strip_tags(doc, element._c_node, matcher)
 * 
 * cdef _strip_tags(_Document doc, xmlNode* c_node, _MultiTagMatcher matcher):             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_child
 *     cdef xmlNode* c_next
*/

static PyObject *__pyx_f_4lxml_5etree__strip_tags(struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_node, struct __pyx_obj_4lxml_5etree__MultiTagMatcher *__pyx_v_matcher) {
  xmlNode *__pyx_v_c_child;
  xmlNode *__pyx_v_c_next;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  xmlNode *__pyx_t_2;
  xmlNode *__pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_strip_tags", 0);

  /* "src/lxml/cleanup.pxi":192
 *     cdef xmlNode* c_next
 * 
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_node, c_node, 1)             # <<<<<<<<<<<<<<
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         # we run through the children here to prevent any problems
*/
  BEGIN_FOR_EACH_ELEMENT_FROM(__pyx_v_c_node, __pyx_v_c_node, 1);

  /* "src/lxml/cleanup.pxi":193
 * 
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_node, c_node, 1)
 *     if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         # we run through the children here to prevent any problems
 *         # with the tree iteration which would occur if we unlinked the
*/
  __pyx_t_1 = (__pyx_v_c_node->type == XML_ELEMENT_NODE);
  if (__pyx_t_1) {

    /* "src/lxml/cleanup.pxi":197
 *         # with the tree iteration which would occur if we unlinked the
 *         # c_node itself
 *         c_child = _findChildForwards(c_node, 0)             # <<<<<<<<<<<<<<
 *         while c_child is not NULL:
 *             if not matcher.matches(c_child):
*/
    __pyx_v_c_child = __pyx_f_4lxml_5etree__findChildForwards(__pyx_v_c_node, 0);

    /* "src/lxml/cleanup.pxi":198
 *         # c_node itself
 *         c_child = _findChildForwards(c_node, 0)
 *         while c_child is not NULL:             # <<<<<<<<<<<<<<
 *             if not matcher.matches(c_child):
 *                 c_child = _nextElement(c_child)
*/
    while (1) {
      __pyx_t_1 = (__pyx_v_c_child != NULL);
      if (!__pyx_t_1) break;

      /* "src/lxml/cleanup.pxi":199
 *         c_child = _findChildForwards(c_node, 0)
 *         while c_child is not NULL:
 *             if not matcher.matches(c_child):             # <<<<<<<<<<<<<<
 *                 c_child = _nextElement(c_child)
 *                 continue
*/
      __pyx_t_1 = (!__pyx_f_4lxml_5etree_16_MultiTagMatcher_matches(__pyx_v_matcher, __pyx_v_c_child));
      if (__pyx_t_1) {

        /* "src/lxml/cleanup.pxi":200
 *         while c_child is not NULL:
 *             if not matcher.matches(c_child):
 *                 c_child = _nextElement(c_child)             # <<<<<<<<<<<<<<
 *                 continue
 *             if c_child.type == tree.XML_ELEMENT_NODE:
*/
        __pyx_v_c_child = __pyx_f_4lxml_5etree__nextElement(__pyx_v_c_child);

        /* "src/lxml/cleanup.pxi":201
 *             if not matcher.matches(c_child):
 *                 c_child = _nextElement(c_child)
 *                 continue             # <<<<<<<<<<<<<<
 *             if c_child.type == tree.XML_ELEMENT_NODE:
 *                 c_next = _findChildForwards(c_child, 0) or _nextElement(c_child)
*/
        goto __pyx_L4_continue;

        /* "src/lxml/cleanup.pxi":199
 *         c_child = _findChildForwards(c_node, 0)
 *         while c_child is not NULL:
 *             if not matcher.matches(c_child):             # <<<<<<<<<<<<<<
 *                 c_child = _nextElement(c_child)
 *                 continue
*/
      }

      /* "src/lxml/cleanup.pxi":202
 *                 c_child = _nextElement(c_child)
 *                 continue
 *             if c_child.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *                 c_next = _findChildForwards(c_child, 0) or _nextElement(c_child)
 *                 _replaceNodeByChildren(doc, c_child)
*/
      __pyx_t_1 = (__pyx_v_c_child->type == XML_ELEMENT_NODE);
      if (__pyx_t_1) {

        /* "src/lxml/cleanup.pxi":203
 *                 continue
 *             if c_child.type == tree.XML_ELEMENT_NODE:
 *                 c_next = _findChildForwards(c_child, 0) or _nextElement(c_child)             # <<<<<<<<<<<<<<
 *                 _replaceNodeByChildren(doc, c_child)
 *                 if not attemptDeallocation(c_child):
*/
        __pyx_t_3 = __pyx_f_4lxml_5etree__findChildForwards(__pyx_v_c_child, 0);
        if (!__pyx_t_3) {
        } else {
          __pyx_t_2 = __pyx_t_3;
          goto __pyx_L8_bool_binop_done;
        }
        __pyx_t_3 = __pyx_f_4lxml_5etree__nextElement(__pyx_v_c_child);
        __pyx_t_2 = __pyx_t_3;
        __pyx_L8_bool_binop_done:;
        __pyx_v_c_next = __pyx_t_2;

        /* "src/lxml/cleanup.pxi":204
 *             if c_child.type == tree.XML_ELEMENT_NODE:
 *                 c_next = _findChildForwards(c_child, 0) or _nextElement(c_child)
 *                 _replaceNodeByChildren(doc, c_child)             # <<<<<<<<<<<<<<
 *                 if not attemptDeallocation(c_child):
 *                     if c_child.nsDef is not NULL:
*/
        __pyx_t_4 = __pyx_f_4lxml_5etree__replaceNodeByChildren(__pyx_v_doc, __pyx_v_c_child); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(17, 204, __pyx_L1_error)

        /* "src/lxml/cleanup.pxi":205
 *                 c_next = _findChildForwards(c_child, 0) or _nextElement(c_child)
 *                 _replaceNodeByChildren(doc, c_child)
 *                 if not attemptDeallocation(c_child):             # <<<<<<<<<<<<<<
 *                     if c_child.nsDef is not NULL:
 *                         # make namespaces absolute
*/
        __pyx_t_1 = (!(__pyx_f_4lxml_5etree_attemptDeallocation(__pyx_v_c_child) != 0));
        if (__pyx_t_1) {

          /* "src/lxml/cleanup.pxi":206
 *                 _replaceNodeByChildren(doc, c_child)
 *                 if not attemptDeallocation(c_child):
 *                     if c_child.nsDef is not NULL:             # <<<<<<<<<<<<<<
 *                         # make namespaces absolute
 *                         moveNodeToDocument(doc, doc._c_doc, c_child)
*/
          __pyx_t_1 = (__pyx_v_c_child->nsDef != NULL);
          if (__pyx_t_1) {

            /* "src/lxml/cleanup.pxi":208
 *                     if c_child.nsDef is not NULL:
 *                         # make namespaces absolute
 *                         moveNodeToDocument(doc, doc._c_doc, c_child)             # <<<<<<<<<<<<<<
 *                 c_child = c_next
 *             else:
*/
            __pyx_t_4 = __pyx_f_4lxml_5etree_moveNodeToDocument(__pyx_v_doc, __pyx_v_doc->_c_doc, __pyx_v_c_child); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(17, 208, __pyx_L1_error)

            /* "src/lxml/cleanup.pxi":206
 *                 _replaceNodeByChildren(doc, c_child)
 *                 if not attemptDeallocation(c_child):
 *                     if c_child.nsDef is not NULL:             # <<<<<<<<<<<<<<
 *                         # make namespaces absolute
 *                         moveNodeToDocument(doc, doc._c_doc, c_child)
*/
          }

          /* "src/lxml/cleanup.pxi":205
 *                 c_next = _findChildForwards(c_child, 0) or _nextElement(c_child)
 *                 _replaceNodeByChildren(doc, c_child)
 *                 if not attemptDeallocation(c_child):             # <<<<<<<<<<<<<<
 *                     if c_child.nsDef is not NULL:
 *                         # make namespaces absolute
*/
        }

        /* "src/lxml/cleanup.pxi":209
 *                         # make namespaces absolute
 *                         moveNodeToDocument(doc, doc._c_doc, c_child)
 *                 c_child = c_next             # <<<<<<<<<<<<<<
 *             else:
 *                 c_next = _nextElement(c_child)
*/
        __pyx_v_c_child = __pyx_v_c_next;

        /* "src/lxml/cleanup.pxi":202
 *                 c_child = _nextElement(c_child)
 *                 continue
 *             if c_child.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *                 c_next = _findChildForwards(c_child, 0) or _nextElement(c_child)
 *                 _replaceNodeByChildren(doc, c_child)
*/
        goto __pyx_L7;
      }

      /* "src/lxml/cleanup.pxi":211
 *                 c_child = c_next
 *             else:
 *                 c_next = _nextElement(c_child)             # <<<<<<<<<<<<<<
 *                 tree.xmlUnlinkNode(c_child)
 *                 attemptDeallocation(c_child)
*/
      /*else*/ {
        __pyx_v_c_next = __pyx_f_4lxml_5etree__nextElement(__pyx_v_c_child);

        /* "src/lxml/cleanup.pxi":212
 *             else:
 *                 c_next = _nextElement(c_child)
 *                 tree.xmlUnlinkNode(c_child)             # <<<<<<<<<<<<<<
 *                 attemptDeallocation(c_child)
 *                 c_child = c_next
*/
        xmlUnlinkNode(__pyx_v_c_child);

        /* "src/lxml/cleanup.pxi":213
 *                 c_next = _nextElement(c_child)
 *                 tree.xmlUnlinkNode(c_child)
 *                 attemptDeallocation(c_child)             # <<<<<<<<<<<<<<
 *                 c_child = c_next
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)
*/
        (void)(__pyx_f_4lxml_5etree_attemptDeallocation(__pyx_v_c_child));

        /* "src/lxml/cleanup.pxi":214
 *                 tree.xmlUnlinkNode(c_child)
 *                 attemptDeallocation(c_child)
 *                 c_child = c_next             # <<<<<<<<<<<<<<
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)
*/
        __pyx_v_c_child = __pyx_v_c_next;
      }
      __pyx_L7:;
      __pyx_L4_continue:;
    }

    /* "src/lxml/cleanup.pxi":193
 * 
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_node, c_node, 1)
 *     if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         # we run through the children here to prevent any problems
 *         # with the tree iteration which would occur if we unlinked the
*/
  }

  /* "src/lxml/cleanup.pxi":215
 *                 attemptDeallocation(c_child)
 *                 c_child = c_next
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)             # <<<<<<<<<<<<<<
*/
  END_FOR_EACH_ELEMENT_FROM(__pyx_v_c_node);

  /* "src/lxml/cleanup.pxi":188
 *     _strip_tags(doc, element._c_node, matcher)
 * 
 * cdef _strip_tags(_Document doc, xmlNode* c_node, _MultiTagMatcher matcher):             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_child
 *     cdef xmlNode* c_next
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._strip_tags", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/extensions.pxi":45
 *     cdef _ErrorLog _error_log
 * 
 *     def __init__(self, namespaces, extensions, error_log, enable_regexp,             # <<<<<<<<<<<<<<
 *                  build_smart_strings):
 *         cdef _ExsltRegExp _regexp
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_12_BaseContext_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_12_BaseContext_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_namespaces = 0;
  PyObject *__pyx_v_extensions = 0;
  PyObject *__pyx_v_error_log = 0;
  PyObject *__pyx_v_enable_regexp = 0;
  PyObject *__pyx_v_build_smart_strings = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[5] = {0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_namespaces,&__pyx_mstate_global->__pyx_n_u_extensions,&__pyx_mstate_global->__pyx_n_u_error_log,&__pyx_mstate_global->__pyx_n_u_enable_regexp,&__pyx_mstate_global->__pyx_n_u_build_smart_strings,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(18, 45, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  5:
        values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(18, 45, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(18, 45, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(18, 45, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(18, 45, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(18, 45, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(18, 45, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 5; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, i); __PYX_ERR(18, 45, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 5)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(18, 45, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(18, 45, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(18, 45, __pyx_L3_error)
      values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(18, 45, __pyx_L3_error)
      values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(18, 45, __pyx_L3_error)
    }
    __pyx_v_namespaces = values[0];
    __pyx_v_extensions = values[1];
    __pyx_v_error_log = values[2];
    __pyx_v_enable_regexp = values[3];
    __pyx_v_build_smart_strings = values[4];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, __pyx_nargs); __PYX_ERR(18, 45, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._BaseContext.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_12_BaseContext___init__(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self), __pyx_v_namespaces, __pyx_v_extensions, __pyx_v_error_log, __pyx_v_enable_regexp, __pyx_v_build_smart_strings);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_12_BaseContext___init__(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, PyObject *__pyx_v_namespaces, PyObject *__pyx_v_extensions, PyObject *__pyx_v_error_log, PyObject *__pyx_v_enable_regexp, PyObject *__pyx_v_build_smart_strings) {
  struct __pyx_obj_4lxml_5etree__ExsltRegExp *__pyx_v__regexp = 0;
  PyObject *__pyx_v_new_extensions = 0;
  PyObject *__pyx_v_ns = 0;
  PyObject *__pyx_v_extension = NULL;
  PyObject *__pyx_v_ns_uri = NULL;
  PyObject *__pyx_v_name = NULL;
  PyObject *__pyx_v_function = NULL;
  PyObject *__pyx_v_ns_utf = NULL;
  PyObject *__pyx_v_name_utf = NULL;
  PyObject *__pyx_v_prefix = NULL;
  PyObject *__pyx_v_prefix_utf = NULL;
  PyObject *__pyx_v_ns_uri_utf = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *(*__pyx_t_15)(PyObject *);
  size_t __pyx_t_16;
  int __pyx_t_17;
  int __pyx_t_18;
  int __pyx_t_19;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_INCREF(__pyx_v_namespaces);
  __Pyx_INCREF(__pyx_v_extensions);

  /* "src/lxml/extensions.pxi":50
 *         cdef dict new_extensions
 *         cdef list ns
 *         self._utf_refs = {}             # <<<<<<<<<<<<<<
 *         self._global_namespaces = []
 *         self._function_cache = {}
*/
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 50, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_utf_refs);
  __Pyx_DECREF(__pyx_v_self->_utf_refs);
  __pyx_v_self->_utf_refs = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":51
 *         cdef list ns
 *         self._utf_refs = {}
 *         self._global_namespaces = []             # <<<<<<<<<<<<<<
 *         self._function_cache = {}
 *         self._eval_context_dict = None
*/
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 51, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_global_namespaces);
  __Pyx_DECREF(__pyx_v_self->_global_namespaces);
  __pyx_v_self->_global_namespaces = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":52
 *         self._utf_refs = {}
 *         self._global_namespaces = []
 *         self._function_cache = {}             # <<<<<<<<<<<<<<
 *         self._eval_context_dict = None
 *         self._error_log = error_log
*/
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 52, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_function_cache);
  __Pyx_DECREF(__pyx_v_self->_function_cache);
  __pyx_v_self->_function_cache = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":53
 *         self._global_namespaces = []
 *         self._function_cache = {}
 *         self._eval_context_dict = None             # <<<<<<<<<<<<<<
 *         self._error_log = error_log
 * 
*/
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_eval_context_dict);
  __Pyx_DECREF(__pyx_v_self->_eval_context_dict);
  __pyx_v_self->_eval_context_dict = ((PyObject*)Py_None);

  /* "src/lxml/extensions.pxi":54
 *         self._function_cache = {}
 *         self._eval_context_dict = None
 *         self._error_log = error_log             # <<<<<<<<<<<<<<
 * 
 *         if extensions is not None:
*/
  __pyx_t_1 = __pyx_v_error_log;
  __Pyx_INCREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ErrorLog))))) __PYX_ERR(18, 54, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_error_log);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_error_log);
  __pyx_v_self->_error_log = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":56
 *         self._error_log = error_log
 * 
 *         if extensions is not None:             # <<<<<<<<<<<<<<
 *             # convert extensions to UTF-8
 *             if isinstance(extensions, dict):
*/
  __pyx_t_2 = (__pyx_v_extensions != Py_None);
  if (__pyx_t_2) {

    /* "src/lxml/extensions.pxi":58
 *         if extensions is not None:
 *             # convert extensions to UTF-8
 *             if isinstance(extensions, dict):             # <<<<<<<<<<<<<<
 *                 extensions = (extensions,)
 *             # format: [ {(ns, name):function} ] -> {(ns_utf, name_utf):function}
*/
    __pyx_t_2 = PyDict_Check(__pyx_v_extensions); 
    if (__pyx_t_2) {

      /* "src/lxml/extensions.pxi":59
 *             # convert extensions to UTF-8
 *             if isinstance(extensions, dict):
 *                 extensions = (extensions,)             # <<<<<<<<<<<<<<
 *             # format: [ {(ns, name):function} ] -> {(ns_utf, name_utf):function}
 *             new_extensions = {}
*/
      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 59, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_v_extensions);
      __Pyx_GIVEREF(__pyx_v_extensions);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_extensions) != (0)) __PYX_ERR(18, 59, __pyx_L1_error);
      __Pyx_DECREF_SET(__pyx_v_extensions, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "src/lxml/extensions.pxi":58
 *         if extensions is not None:
 *             # convert extensions to UTF-8
 *             if isinstance(extensions, dict):             # <<<<<<<<<<<<<<
 *                 extensions = (extensions,)
 *             # format: [ {(ns, name):function} ] -> {(ns_utf, name_utf):function}
*/
    }

    /* "src/lxml/extensions.pxi":61
 *                 extensions = (extensions,)
 *             # format: [ {(ns, name):function} ] -> {(ns_utf, name_utf):function}
 *             new_extensions = {}             # <<<<<<<<<<<<<<
 *             for extension in extensions:
 *                 for (ns_uri, name), function in extension.items():
*/
    __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 61, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_new_extensions = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/extensions.pxi":62
 *             # format: [ {(ns, name):function} ] -> {(ns_utf, name_utf):function}
 *             new_extensions = {}
 *             for extension in extensions:             # <<<<<<<<<<<<<<
 *                 for (ns_uri, name), function in extension.items():
 *                     if name is None:
*/
    if (likely(PyList_CheckExact(__pyx_v_extensions)) || PyTuple_CheckExact(__pyx_v_extensions)) {
      __pyx_t_1 = __pyx_v_extensions; __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = 0;
      __pyx_t_4 = NULL;
    } else {
      __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_extensions); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 62, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(18, 62, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_4)) {
        if (likely(PyList_CheckExact(__pyx_t_1))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(18, 62, __pyx_L1_error)
            #endif
            if (__pyx_t_3 >= __pyx_temp) break;
          }
          __pyx_t_5 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_3, __Pyx_ReferenceSharing_OwnStrongReference);
          ++__pyx_t_3;
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(18, 62, __pyx_L1_error)
            #endif
            if (__pyx_t_3 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3));
          #else
          __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_3);
          #endif
          ++__pyx_t_3;
        }
        if (unlikely(!__pyx_t_5)) __PYX_ERR(18, 62, __pyx_L1_error)
      } else {
        __pyx_t_5 = __pyx_t_4(__pyx_t_1);
        if (unlikely(!__pyx_t_5)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(18, 62, __pyx_L1_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_XDECREF_SET(__pyx_v_extension, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "src/lxml/extensions.pxi":63
 *             new_extensions = {}
 *             for extension in extensions:
 *                 for (ns_uri, name), function in extension.items():             # <<<<<<<<<<<<<<
 *                     if name is None:
 *                         raise ValueError, "extensions must have non empty names"
*/
      __pyx_t_6 = 0;
      if (unlikely(__pyx_v_extension == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
        __PYX_ERR(18, 63, __pyx_L1_error)
      }
      __pyx_t_9 = __Pyx_dict_iterator(__pyx_v_extension, 0, __pyx_mstate_global->__pyx_n_u_items, (&__pyx_t_7), (&__pyx_t_8)); if (unlikely(!__pyx_t_9)) __PYX_ERR(18, 63, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_XDECREF(__pyx_t_5);
      __pyx_t_5 = __pyx_t_9;
      __pyx_t_9 = 0;
      while (1) {
        __pyx_t_11 = __Pyx_dict_iter_next(__pyx_t_5, __pyx_t_7, &__pyx_t_6, &__pyx_t_9, &__pyx_t_10, NULL, __pyx_t_8);
        if (unlikely(__pyx_t_11 == 0)) break;
        if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(18, 63, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_GOTREF(__pyx_t_10);
        if ((likely(PyTuple_CheckExact(__pyx_t_9))) || (PyList_CheckExact(__pyx_t_9))) {
          PyObject* sequence = __pyx_t_9;
          Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
          if (unlikely(size != 2)) {
            if (size > 2) __Pyx_RaiseTooManyValuesError(2);
            else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
            __PYX_ERR(18, 63, __pyx_L1_error)
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          if (likely(PyTuple_CheckExact(sequence))) {
            __pyx_t_12 = PyTuple_GET_ITEM(sequence, 0);
            __Pyx_INCREF(__pyx_t_12);
            __pyx_t_13 = PyTuple_GET_ITEM(sequence, 1);
            __Pyx_INCREF(__pyx_t_13);
          } else {
            __pyx_t_12 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
            if (unlikely(!__pyx_t_12)) __PYX_ERR(18, 63, __pyx_L1_error)
            __Pyx_XGOTREF(__pyx_t_12);
            __pyx_t_13 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
            if (unlikely(!__pyx_t_13)) __PYX_ERR(18, 63, __pyx_L1_error)
            __Pyx_XGOTREF(__pyx_t_13);
          }
          #else
          __pyx_t_12 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_12)) __PYX_ERR(18, 63, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          __pyx_t_13 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_13)) __PYX_ERR(18, 63, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_13);
          #endif
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        } else {
          Py_ssize_t index = -1;
          __pyx_t_14 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_14)) __PYX_ERR(18, 63, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_14);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_t_15 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_14);
          index = 0; __pyx_t_12 = __pyx_t_15(__pyx_t_14); if (unlikely(!__pyx_t_12)) goto __pyx_L9_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_12);
          index = 1; __pyx_t_13 = __pyx_t_15(__pyx_t_14); if (unlikely(!__pyx_t_13)) goto __pyx_L9_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_13);
          if (__Pyx_IternextUnpackEndCheck(__pyx_t_15(__pyx_t_14), 2) < (0)) __PYX_ERR(18, 63, __pyx_L1_error)
          __pyx_t_15 = NULL;
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          goto __pyx_L10_unpacking_done;
          __pyx_L9_unpacking_failed:;
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __pyx_t_15 = NULL;
          if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
          __PYX_ERR(18, 63, __pyx_L1_error)
          __pyx_L10_unpacking_done:;
        }
        __Pyx_XDECREF_SET(__pyx_v_ns_uri, __pyx_t_12);
        __pyx_t_12 = 0;
        __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_13);
        __pyx_t_13 = 0;
        __Pyx_XDECREF_SET(__pyx_v_function, __pyx_t_10);
        __pyx_t_10 = 0;

        /* "src/lxml/extensions.pxi":64
 *             for extension in extensions:
 *                 for (ns_uri, name), function in extension.items():
 *                     if name is None:             # <<<<<<<<<<<<<<
 *                         raise ValueError, "extensions must have non empty names"
 *                     ns_utf   = self._to_utf(ns_uri)
*/
        __pyx_t_2 = (__pyx_v_name == Py_None);
        if (unlikely(__pyx_t_2)) {

          /* "src/lxml/extensions.pxi":65
 *                 for (ns_uri, name), function in extension.items():
 *                     if name is None:
 *                         raise ValueError, "extensions must have non empty names"             # <<<<<<<<<<<<<<
 *                     ns_utf   = self._to_utf(ns_uri)
 *                     name_utf = self._to_utf(name)
*/
          __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_extensions_must_have_non_empty_n, 0, 0);
          __PYX_ERR(18, 65, __pyx_L1_error)

          /* "src/lxml/extensions.pxi":64
 *             for extension in extensions:
 *                 for (ns_uri, name), function in extension.items():
 *                     if name is None:             # <<<<<<<<<<<<<<
 *                         raise ValueError, "extensions must have non empty names"
 *                     ns_utf   = self._to_utf(ns_uri)
*/
        }

        /* "src/lxml/extensions.pxi":66
 *                     if name is None:
 *                         raise ValueError, "extensions must have non empty names"
 *                     ns_utf   = self._to_utf(ns_uri)             # <<<<<<<<<<<<<<
 *                     name_utf = self._to_utf(name)
 *                     new_extensions[(ns_utf, name_utf)] = function
*/
        __pyx_t_10 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseContext *)__pyx_v_self->__pyx_vtab)->_to_utf(__pyx_v_self, __pyx_v_ns_uri); if (unlikely(!__pyx_t_10)) __PYX_ERR(18, 66, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_XDECREF_SET(__pyx_v_ns_utf, ((PyObject*)__pyx_t_10));
        __pyx_t_10 = 0;

        /* "src/lxml/extensions.pxi":67
 *                         raise ValueError, "extensions must have non empty names"
 *                     ns_utf   = self._to_utf(ns_uri)
 *                     name_utf = self._to_utf(name)             # <<<<<<<<<<<<<<
 *                     new_extensions[(ns_utf, name_utf)] = function
 *             extensions = new_extensions or None
*/
        __pyx_t_10 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseContext *)__pyx_v_self->__pyx_vtab)->_to_utf(__pyx_v_self, __pyx_v_name); if (unlikely(!__pyx_t_10)) __PYX_ERR(18, 67, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_XDECREF_SET(__pyx_v_name_utf, ((PyObject*)__pyx_t_10));
        __pyx_t_10 = 0;

        /* "src/lxml/extensions.pxi":68
 *                     ns_utf   = self._to_utf(ns_uri)
 *                     name_utf = self._to_utf(name)
 *                     new_extensions[(ns_utf, name_utf)] = function             # <<<<<<<<<<<<<<
 *             extensions = new_extensions or None
 * 
*/
        __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(18, 68, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_INCREF(__pyx_v_ns_utf);
        __Pyx_GIVEREF(__pyx_v_ns_utf);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_ns_utf) != (0)) __PYX_ERR(18, 68, __pyx_L1_error);
        __Pyx_INCREF(__pyx_v_name_utf);
        __Pyx_GIVEREF(__pyx_v_name_utf);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_name_utf) != (0)) __PYX_ERR(18, 68, __pyx_L1_error);
        if (unlikely((PyDict_SetItem(__pyx_v_new_extensions, __pyx_t_10, __pyx_v_function) < 0))) __PYX_ERR(18, 68, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "src/lxml/extensions.pxi":62
 *             # format: [ {(ns, name):function} ] -> {(ns_utf, name_utf):function}
 *             new_extensions = {}
 *             for extension in extensions:             # <<<<<<<<<<<<<<
 *                 for (ns_uri, name), function in extension.items():
 *                     if name is None:
*/
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "src/lxml/extensions.pxi":69
 *                     name_utf = self._to_utf(name)
 *                     new_extensions[(ns_utf, name_utf)] = function
 *             extensions = new_extensions or None             # <<<<<<<<<<<<<<
 * 
 *         if namespaces is not None:
*/
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_new_extensions); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(18, 69, __pyx_L1_error)
    if (!__pyx_t_2) {
    } else {
      __Pyx_INCREF(__pyx_v_new_extensions);
      __pyx_t_1 = __pyx_v_new_extensions;
      goto __pyx_L13_bool_binop_done;
    }
    __Pyx_INCREF(Py_None);
    __pyx_t_1 = Py_None;
    __pyx_L13_bool_binop_done:;
    __Pyx_DECREF_SET(__pyx_v_extensions, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/extensions.pxi":56
 *         self._error_log = error_log
 * 
 *         if extensions is not None:             # <<<<<<<<<<<<<<
 *             # convert extensions to UTF-8
 *             if isinstance(extensions, dict):
*/
  }

  /* "src/lxml/extensions.pxi":71
 *             extensions = new_extensions or None
 * 
 *         if namespaces is not None:             # <<<<<<<<<<<<<<
 *             if isinstance(namespaces, dict):
 *                 namespaces = namespaces.items()
*/
  __pyx_t_2 = (__pyx_v_namespaces != Py_None);
  if (__pyx_t_2) {

    /* "src/lxml/extensions.pxi":72
 * 
 *         if namespaces is not None:
 *             if isinstance(namespaces, dict):             # <<<<<<<<<<<<<<
 *                 namespaces = namespaces.items()
 *             if namespaces:
*/
    __pyx_t_2 = PyDict_Check(__pyx_v_namespaces); 
    if (__pyx_t_2) {

      /* "src/lxml/extensions.pxi":73
 *         if namespaces is not None:
 *             if isinstance(namespaces, dict):
 *                 namespaces = namespaces.items()             # <<<<<<<<<<<<<<
 *             if namespaces:
 *                 ns = []
*/
      __pyx_t_5 = __pyx_v_namespaces;
      __Pyx_INCREF(__pyx_t_5);
      __pyx_t_16 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};
        __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_items, __pyx_callargs+__pyx_t_16, (1-__pyx_t_16) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 73, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_DECREF_SET(__pyx_v_namespaces, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "src/lxml/extensions.pxi":72
 * 
 *         if namespaces is not None:
 *             if isinstance(namespaces, dict):             # <<<<<<<<<<<<<<
 *                 namespaces = namespaces.items()
 *             if namespaces:
*/
    }

    /* "src/lxml/extensions.pxi":74
 *             if isinstance(namespaces, dict):
 *                 namespaces = namespaces.items()
 *             if namespaces:             # <<<<<<<<<<<<<<
 *                 ns = []
 *                 for prefix, ns_uri in namespaces:
*/
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_namespaces); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(18, 74, __pyx_L1_error)
    if (__pyx_t_2) {

      /* "src/lxml/extensions.pxi":75
 *                 namespaces = namespaces.items()
 *             if namespaces:
 *                 ns = []             # <<<<<<<<<<<<<<
 *                 for prefix, ns_uri in namespaces:
 *                     if prefix is None or not prefix:
*/
      __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 75, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_ns = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;

      /* "src/lxml/extensions.pxi":76
 *             if namespaces:
 *                 ns = []
 *                 for prefix, ns_uri in namespaces:             # <<<<<<<<<<<<<<
 *                     if prefix is None or not prefix:
 *                         raise TypeError, \
*/
      if (likely(PyList_CheckExact(__pyx_v_namespaces)) || PyTuple_CheckExact(__pyx_v_namespaces)) {
        __pyx_t_1 = __pyx_v_namespaces; __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = 0;
        __pyx_t_4 = NULL;
      } else {
        __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_namespaces); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 76, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(18, 76, __pyx_L1_error)
      }
      for (;;) {
        if (likely(!__pyx_t_4)) {
          if (likely(PyList_CheckExact(__pyx_t_1))) {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(18, 76, __pyx_L1_error)
              #endif
              if (__pyx_t_3 >= __pyx_temp) break;
            }
            __pyx_t_5 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_3, __Pyx_ReferenceSharing_OwnStrongReference);
            ++__pyx_t_3;
          } else {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(18, 76, __pyx_L1_error)
              #endif
              if (__pyx_t_3 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3));
            #else
            __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_3);
            #endif
            ++__pyx_t_3;
          }
          if (unlikely(!__pyx_t_5)) __PYX_ERR(18, 76, __pyx_L1_error)
        } else {
          __pyx_t_5 = __pyx_t_4(__pyx_t_1);
          if (unlikely(!__pyx_t_5)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(18, 76, __pyx_L1_error)
              PyErr_Clear();
            }
            break;
          }
        }
        __Pyx_GOTREF(__pyx_t_5);
        if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
          PyObject* sequence = __pyx_t_5;
          Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
          if (unlikely(size != 2)) {
            if (size > 2) __Pyx_RaiseTooManyValuesError(2);
            else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
            __PYX_ERR(18, 76, __pyx_L1_error)
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          if (likely(PyTuple_CheckExact(sequence))) {
            __pyx_t_10 = PyTuple_GET_ITEM(sequence, 0);
            __Pyx_INCREF(__pyx_t_10);
            __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1);
            __Pyx_INCREF(__pyx_t_9);
          } else {
            __pyx_t_10 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
            if (unlikely(!__pyx_t_10)) __PYX_ERR(18, 76, __pyx_L1_error)
            __Pyx_XGOTREF(__pyx_t_10);
            __pyx_t_9 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
            if (unlikely(!__pyx_t_9)) __PYX_ERR(18, 76, __pyx_L1_error)
            __Pyx_XGOTREF(__pyx_t_9);
          }
          #else
          __pyx_t_10 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(18, 76, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __pyx_t_9 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(18, 76, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          #endif
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        } else {
          Py_ssize_t index = -1;
          __pyx_t_13 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_13)) __PYX_ERR(18, 76, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_13);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __pyx_t_15 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_13);
          index = 0; __pyx_t_10 = __pyx_t_15(__pyx_t_13); if (unlikely(!__pyx_t_10)) goto __pyx_L20_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_10);
          index = 1; __pyx_t_9 = __pyx_t_15(__pyx_t_13); if (unlikely(!__pyx_t_9)) goto __pyx_L20_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_9);
          if (__Pyx_IternextUnpackEndCheck(__pyx_t_15(__pyx_t_13), 2) < (0)) __PYX_ERR(18, 76, __pyx_L1_error)
          __pyx_t_15 = NULL;
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          goto __pyx_L21_unpacking_done;
          __pyx_L20_unpacking_failed:;
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          __pyx_t_15 = NULL;
          if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
          __PYX_ERR(18, 76, __pyx_L1_error)
          __pyx_L21_unpacking_done:;
        }
        __Pyx_XDECREF_SET(__pyx_v_prefix, __pyx_t_10);
        __pyx_t_10 = 0;
        __Pyx_XDECREF_SET(__pyx_v_ns_uri, __pyx_t_9);
        __pyx_t_9 = 0;

        /* "src/lxml/extensions.pxi":77
 *                 ns = []
 *                 for prefix, ns_uri in namespaces:
 *                     if prefix is None or not prefix:             # <<<<<<<<<<<<<<
 *                         raise TypeError, \
 *                             "empty namespace prefix is not supported in XPath"
*/
        __pyx_t_17 = (__pyx_v_prefix == Py_None);
        if (!__pyx_t_17) {
        } else {
          __pyx_t_2 = __pyx_t_17;
          goto __pyx_L23_bool_binop_done;
        }
        __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_v_prefix); if (unlikely((__pyx_t_17 < 0))) __PYX_ERR(18, 77, __pyx_L1_error)
        __pyx_t_18 = (!__pyx_t_17);
        __pyx_t_2 = __pyx_t_18;
        __pyx_L23_bool_binop_done:;
        if (unlikely(__pyx_t_2)) {

          /* "src/lxml/extensions.pxi":78
 *                 for prefix, ns_uri in namespaces:
 *                     if prefix is None or not prefix:
 *                         raise TypeError, \             # <<<<<<<<<<<<<<
 *                             "empty namespace prefix is not supported in XPath"
 *                     if ns_uri is None or not ns_uri:
*/
          __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_empty_namespace_prefix_is_not_su, 0, 0);
          __PYX_ERR(18, 78, __pyx_L1_error)

          /* "src/lxml/extensions.pxi":77
 *                 ns = []
 *                 for prefix, ns_uri in namespaces:
 *                     if prefix is None or not prefix:             # <<<<<<<<<<<<<<
 *                         raise TypeError, \
 *                             "empty namespace prefix is not supported in XPath"
*/
        }

        /* "src/lxml/extensions.pxi":80
 *                         raise TypeError, \
 *                             "empty namespace prefix is not supported in XPath"
 *                     if ns_uri is None or not ns_uri:             # <<<<<<<<<<<<<<
 *                         raise TypeError, \
 *                             "setting default namespace is not supported in XPath"
*/
        __pyx_t_18 = (__pyx_v_ns_uri == Py_None);
        if (!__pyx_t_18) {
        } else {
          __pyx_t_2 = __pyx_t_18;
          goto __pyx_L26_bool_binop_done;
        }
        __pyx_t_18 = __Pyx_PyObject_IsTrue(__pyx_v_ns_uri); if (unlikely((__pyx_t_18 < 0))) __PYX_ERR(18, 80, __pyx_L1_error)
        __pyx_t_17 = (!__pyx_t_18);
        __pyx_t_2 = __pyx_t_17;
        __pyx_L26_bool_binop_done:;
        if (unlikely(__pyx_t_2)) {

          /* "src/lxml/extensions.pxi":81
 *                             "empty namespace prefix is not supported in XPath"
 *                     if ns_uri is None or not ns_uri:
 *                         raise TypeError, \             # <<<<<<<<<<<<<<
 *                             "setting default namespace is not supported in XPath"
 *                     prefix_utf = self._to_utf(prefix)
*/
          __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_setting_default_namespace_is_not, 0, 0);
          __PYX_ERR(18, 81, __pyx_L1_error)

          /* "src/lxml/extensions.pxi":80
 *                         raise TypeError, \
 *                             "empty namespace prefix is not supported in XPath"
 *                     if ns_uri is None or not ns_uri:             # <<<<<<<<<<<<<<
 *                         raise TypeError, \
 *                             "setting default namespace is not supported in XPath"
*/
        }

        /* "src/lxml/extensions.pxi":83
 *                         raise TypeError, \
 *                             "setting default namespace is not supported in XPath"
 *                     prefix_utf = self._to_utf(prefix)             # <<<<<<<<<<<<<<
 *                     ns_uri_utf = self._to_utf(ns_uri)
 *                     ns.append( (prefix_utf, ns_uri_utf) )
*/
        __pyx_t_5 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseContext *)__pyx_v_self->__pyx_vtab)->_to_utf(__pyx_v_self, __pyx_v_prefix); if (unlikely(!__pyx_t_5)) __PYX_ERR(18, 83, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_XDECREF_SET(__pyx_v_prefix_utf, ((PyObject*)__pyx_t_5));
        __pyx_t_5 = 0;

        /* "src/lxml/extensions.pxi":84
 *                             "setting default namespace is not supported in XPath"
 *                     prefix_utf = self._to_utf(prefix)
 *                     ns_uri_utf = self._to_utf(ns_uri)             # <<<<<<<<<<<<<<
 *                     ns.append( (prefix_utf, ns_uri_utf) )
 *                 namespaces = ns
*/
        __pyx_t_5 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseContext *)__pyx_v_self->__pyx_vtab)->_to_utf(__pyx_v_self, __pyx_v_ns_uri); if (unlikely(!__pyx_t_5)) __PYX_ERR(18, 84, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_XDECREF_SET(__pyx_v_ns_uri_utf, ((PyObject*)__pyx_t_5));
        __pyx_t_5 = 0;

        /* "src/lxml/extensions.pxi":85
 *                     prefix_utf = self._to_utf(prefix)
 *                     ns_uri_utf = self._to_utf(ns_uri)
 *                     ns.append( (prefix_utf, ns_uri_utf) )             # <<<<<<<<<<<<<<
 *                 namespaces = ns
 *             else:
*/
        __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(18, 85, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_INCREF(__pyx_v_prefix_utf);
        __Pyx_GIVEREF(__pyx_v_prefix_utf);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_prefix_utf) != (0)) __PYX_ERR(18, 85, __pyx_L1_error);
        __Pyx_INCREF(__pyx_v_ns_uri_utf);
        __Pyx_GIVEREF(__pyx_v_ns_uri_utf);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_ns_uri_utf) != (0)) __PYX_ERR(18, 85, __pyx_L1_error);
        __pyx_t_19 = __Pyx_PyList_Append(__pyx_v_ns, __pyx_t_5); if (unlikely(__pyx_t_19 == ((int)-1))) __PYX_ERR(18, 85, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "src/lxml/extensions.pxi":76
 *             if namespaces:
 *                 ns = []
 *                 for prefix, ns_uri in namespaces:             # <<<<<<<<<<<<<<
 *                     if prefix is None or not prefix:
 *                         raise TypeError, \
*/
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "src/lxml/extensions.pxi":86
 *                     ns_uri_utf = self._to_utf(ns_uri)
 *                     ns.append( (prefix_utf, ns_uri_utf) )
 *                 namespaces = ns             # <<<<<<<<<<<<<<
 *             else:
 *                 namespaces = None
*/
      __Pyx_INCREF(__pyx_v_ns);
      __Pyx_DECREF_SET(__pyx_v_namespaces, __pyx_v_ns);

      /* "src/lxml/extensions.pxi":74
 *             if isinstance(namespaces, dict):
 *                 namespaces = namespaces.items()
 *             if namespaces:             # <<<<<<<<<<<<<<
 *                 ns = []
 *                 for prefix, ns_uri in namespaces:
*/
      goto __pyx_L17;
    }

    /* "src/lxml/extensions.pxi":88
 *                 namespaces = ns
 *             else:
 *                 namespaces = None             # <<<<<<<<<<<<<<
 * 
 *         self._doc        = None
*/
    /*else*/ {
      __Pyx_INCREF(Py_None);
      __Pyx_DECREF_SET(__pyx_v_namespaces, Py_None);
    }
    __pyx_L17:;

    /* "src/lxml/extensions.pxi":71
 *             extensions = new_extensions or None
 * 
 *         if namespaces is not None:             # <<<<<<<<<<<<<<
 *             if isinstance(namespaces, dict):
 *                 namespaces = namespaces.items()
*/
  }

  /* "src/lxml/extensions.pxi":90
 *                 namespaces = None
 * 
 *         self._doc        = None             # <<<<<<<<<<<<<<
 *         self._exc        = _ExceptionContext()
 *         self._extensions = extensions
*/
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_doc);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_doc);
  __pyx_v_self->_doc = ((struct LxmlDocument *)Py_None);

  /* "src/lxml/extensions.pxi":91
 * 
 *         self._doc        = None
 *         self._exc        = _ExceptionContext()             # <<<<<<<<<<<<<<
 *         self._extensions = extensions
 *         self._namespaces = namespaces
*/
  __pyx_t_5 = NULL;
  __pyx_t_16 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ExceptionContext, __pyx_callargs+__pyx_t_16, (1-__pyx_t_16) | (__pyx_t_16*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 91, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __Pyx_GIVEREF((PyObject *)__pyx_t_1);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_exc);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_exc);
  __pyx_v_self->_exc = ((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":92
 *         self._doc        = None
 *         self._exc        = _ExceptionContext()
 *         self._extensions = extensions             # <<<<<<<<<<<<<<
 *         self._namespaces = namespaces
 *         self._temp_refs  = _TempStore()
*/
  __pyx_t_1 = __pyx_v_extensions;
  __Pyx_INCREF(__pyx_t_1);
  if (!(likely(PyDict_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_t_1))) __PYX_ERR(18, 92, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_extensions);
  __Pyx_DECREF(__pyx_v_self->_extensions);
  __pyx_v_self->_extensions = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":93
 *         self._exc        = _ExceptionContext()
 *         self._extensions = extensions
 *         self._namespaces = namespaces             # <<<<<<<<<<<<<<
 *         self._temp_refs  = _TempStore()
 *         self._temp_documents  = set()
*/
  __pyx_t_1 = __pyx_v_namespaces;
  __Pyx_INCREF(__pyx_t_1);
  if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("list", __pyx_t_1))) __PYX_ERR(18, 93, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_namespaces);
  __Pyx_DECREF(__pyx_v_self->_namespaces);
  __pyx_v_self->_namespaces = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":94
 *         self._extensions = extensions
 *         self._namespaces = namespaces
 *         self._temp_refs  = _TempStore()             # <<<<<<<<<<<<<<
 *         self._temp_documents  = set()
 *         self._build_smart_strings = build_smart_strings
*/
  __pyx_t_5 = NULL;
  __pyx_t_16 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__TempStore, __pyx_callargs+__pyx_t_16, (1-__pyx_t_16) | (__pyx_t_16*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 94, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __Pyx_GIVEREF((PyObject *)__pyx_t_1);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_temp_refs);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_temp_refs);
  __pyx_v_self->_temp_refs = ((struct __pyx_obj_4lxml_5etree__TempStore *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":95
 *         self._namespaces = namespaces
 *         self._temp_refs  = _TempStore()
 *         self._temp_documents  = set()             # <<<<<<<<<<<<<<
 *         self._build_smart_strings = build_smart_strings
 * 
*/
  __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 95, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_temp_documents);
  __Pyx_DECREF(__pyx_v_self->_temp_documents);
  __pyx_v_self->_temp_documents = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":96
 *         self._temp_refs  = _TempStore()
 *         self._temp_documents  = set()
 *         self._build_smart_strings = build_smart_strings             # <<<<<<<<<<<<<<
 * 
 *         if enable_regexp:
*/
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_build_smart_strings); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(18, 96, __pyx_L1_error)
  __pyx_v_self->_build_smart_strings = __pyx_t_2;

  /* "src/lxml/extensions.pxi":98
 *         self._build_smart_strings = build_smart_strings
 * 
 *         if enable_regexp:             # <<<<<<<<<<<<<<
 *             _regexp = _ExsltRegExp()
 *             _regexp._register_in_context(self)
*/
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_enable_regexp); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(18, 98, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "src/lxml/extensions.pxi":99
 * 
 *         if enable_regexp:
 *             _regexp = _ExsltRegExp()             # <<<<<<<<<<<<<<
 *             _regexp._register_in_context(self)
 * 
*/
    __pyx_t_5 = NULL;
    __pyx_t_16 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ExsltRegExp, __pyx_callargs+__pyx_t_16, (1-__pyx_t_16) | (__pyx_t_16*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 99, __pyx_L1_error)
      __Pyx_GOTREF((PyObject *)__pyx_t_1);
    }
    __pyx_v__regexp = ((struct __pyx_obj_4lxml_5etree__ExsltRegExp *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/extensions.pxi":100
 *         if enable_regexp:
 *             _regexp = _ExsltRegExp()
 *             _regexp._register_in_context(self)             # <<<<<<<<<<<<<<
 * 
 *     cdef _BaseContext _copy(self):
*/
    __pyx_t_1 = __pyx_f_4lxml_5etree_12_ExsltRegExp__register_in_context(__pyx_v__regexp, __pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 100, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "src/lxml/extensions.pxi":98
 *         self._build_smart_strings = build_smart_strings
 * 
 *         if enable_regexp:             # <<<<<<<<<<<<<<
 *             _regexp = _ExsltRegExp()
 *             _regexp._register_in_context(self)
*/
  }

  /* "src/lxml/extensions.pxi":45
 *     cdef _ErrorLog _error_log
 * 
 *     def __init__(self, namespaces, extensions, error_log, enable_regexp,             # <<<<<<<<<<<<<<
 *                  build_smart_strings):
 *         cdef _ExsltRegExp _regexp
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_AddTraceback("lxml.etree._BaseContext.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v__regexp);
  __Pyx_XDECREF(__pyx_v_new_extensions);
  __Pyx_XDECREF(__pyx_v_ns);
  __Pyx_XDECREF(__pyx_v_extension);
  __Pyx_XDECREF(__pyx_v_ns_uri);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_function);
  __Pyx_XDECREF(__pyx_v_ns_utf);
  __Pyx_XDECREF(__pyx_v_name_utf);
  __Pyx_XDECREF(__pyx_v_prefix);
  __Pyx_XDECREF(__pyx_v_prefix_utf);
  __Pyx_XDECREF(__pyx_v_ns_uri_utf);
  __Pyx_XDECREF(__pyx_v_namespaces);
  __Pyx_XDECREF(__pyx_v_extensions);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/extensions.pxi":102
 *             _regexp._register_in_context(self)
 * 
 *     cdef _BaseContext _copy(self):             # <<<<<<<<<<<<<<
 *         cdef _BaseContext context
 *         if self._namespaces is not None:
*/

static struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_f_4lxml_5etree_12_BaseContext__copy(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_context = 0;
  PyObject *__pyx_v_namespaces = NULL;
  struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_copy", 0);

  /* "src/lxml/extensions.pxi":104
 *     cdef _BaseContext _copy(self):
 *         cdef _BaseContext context
 *         if self._namespaces is not None:             # <<<<<<<<<<<<<<
 *             namespaces = self._namespaces[:]
 *         else:
*/
  __pyx_t_1 = (__pyx_v_self->_namespaces != ((PyObject*)Py_None));
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":105
 *         cdef _BaseContext context
 *         if self._namespaces is not None:
 *             namespaces = self._namespaces[:]             # <<<<<<<<<<<<<<
 *         else:
 *             namespaces = None
*/
    if (unlikely(__pyx_v_self->_namespaces == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(18, 105, __pyx_L1_error)
    }
    __pyx_t_2 = __Pyx_PyList_GetSlice(__pyx_v_self->_namespaces, 0, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 105, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_namespaces = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/extensions.pxi":104
 *     cdef _BaseContext _copy(self):
 *         cdef _BaseContext context
 *         if self._namespaces is not None:             # <<<<<<<<<<<<<<
 *             namespaces = self._namespaces[:]
 *         else:
*/
    goto __pyx_L3;
  }

  /* "src/lxml/extensions.pxi":107
 *             namespaces = self._namespaces[:]
 *         else:
 *             namespaces = None             # <<<<<<<<<<<<<<
 *         context = self.__class__(namespaces, None, self._error_log, False,
 *                                  self._build_smart_strings)
*/
  /*else*/ {
    __Pyx_INCREF(Py_None);
    __pyx_v_namespaces = ((PyObject*)Py_None);
  }
  __pyx_L3:;

  /* "src/lxml/extensions.pxi":108
 *         else:
 *             namespaces = None
 *         context = self.__class__(namespaces, None, self._error_log, False,             # <<<<<<<<<<<<<<
 *                                  self._build_smart_strings)
 *         if self._extensions is not None:
*/
  __pyx_t_3 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_3);

  /* "src/lxml/extensions.pxi":109
 *             namespaces = None
 *         context = self.__class__(namespaces, None, self._error_log, False,
 *                                  self._build_smart_strings)             # <<<<<<<<<<<<<<
 *         if self._extensions is not None:
 *             context._extensions = self._extensions.copy()
*/
  __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_self->_build_smart_strings); if (unlikely(!__pyx_t_4)) __PYX_ERR(18, 109, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[6] = {__pyx_t_3, __pyx_v_namespaces, Py_None, ((PyObject *)__pyx_v_self->_error_log), Py_False, __pyx_t_4};
    __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_class, __pyx_callargs+__pyx_t_5, (6-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 108, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }

  /* "src/lxml/extensions.pxi":108
 *         else:
 *             namespaces = None
 *         context = self.__class__(namespaces, None, self._error_log, False,             # <<<<<<<<<<<<<<
 *                                  self._build_smart_strings)
 *         if self._extensions is not None:
*/
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__BaseContext))))) __PYX_ERR(18, 108, __pyx_L1_error)
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/extensions.pxi":110
 *         context = self.__class__(namespaces, None, self._error_log, False,
 *                                  self._build_smart_strings)
 *         if self._extensions is not None:             # <<<<<<<<<<<<<<
 *             context._extensions = self._extensions.copy()
 *         return context
*/
  __pyx_t_1 = (__pyx_v_self->_extensions != ((PyObject*)Py_None));
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":111
 *                                  self._build_smart_strings)
 *         if self._extensions is not None:
 *             context._extensions = self._extensions.copy()             # <<<<<<<<<<<<<<
 *         return context
 * 
*/
    if (unlikely(__pyx_v_self->_extensions == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "copy");
      __PYX_ERR(18, 111, __pyx_L1_error)
    }
    __pyx_t_2 = PyDict_Copy(__pyx_v_self->_extensions); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 111, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_GOTREF(__pyx_v_context->_extensions);
    __Pyx_DECREF(__pyx_v_context->_extensions);
    __pyx_v_context->_extensions = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/extensions.pxi":110
 *         context = self.__class__(namespaces, None, self._error_log, False,
 *                                  self._build_smart_strings)
 *         if self._extensions is not None:             # <<<<<<<<<<<<<<
 *             context._extensions = self._extensions.copy()
 *         return context
*/
  }

  /* "src/lxml/extensions.pxi":112
 *         if self._extensions is not None:
 *             context._extensions = self._extensions.copy()
 *         return context             # <<<<<<<<<<<<<<
 * 
 *     cdef bytes _to_utf(self, s):
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_context);
  __pyx_r = __pyx_v_context;
  goto __pyx_L0;

  /* "src/lxml/extensions.pxi":102
 *             _regexp._register_in_context(self)
 * 
 *     cdef _BaseContext _copy(self):             # <<<<<<<<<<<<<<
 *         cdef _BaseContext context
 *         if self._namespaces is not None:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._BaseContext._copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_namespaces);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/extensions.pxi":114
 *         return context
 * 
 *     cdef bytes _to_utf(self, s):             # <<<<<<<<<<<<<<
 *         "Convert to UTF-8 and keep a reference to the encoded string"
 *         cdef python.PyObject* dict_result
*/

static PyObject *__pyx_f_4lxml_5etree_12_BaseContext__to_utf(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, PyObject *__pyx_v_s) {
  PyObject *__pyx_v_dict_result;
  PyObject *__pyx_v_utf = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_to_utf", 0);

  /* "src/lxml/extensions.pxi":117
 *         "Convert to UTF-8 and keep a reference to the encoded string"
 *         cdef python.PyObject* dict_result
 *         if s is None:             # <<<<<<<<<<<<<<
 *             return None
 *         dict_result = python.PyDict_GetItem(self._utf_refs, s)
*/
  __pyx_t_1 = (__pyx_v_s == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":118
 *         cdef python.PyObject* dict_result
 *         if s is None:
 *             return None             # <<<<<<<<<<<<<<
 *         dict_result = python.PyDict_GetItem(self._utf_refs, s)
 *         if dict_result is not NULL:
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/extensions.pxi":117
 *         "Convert to UTF-8 and keep a reference to the encoded string"
 *         cdef python.PyObject* dict_result
 *         if s is None:             # <<<<<<<<<<<<<<
 *             return None
 *         dict_result = python.PyDict_GetItem(self._utf_refs, s)
*/
  }

  /* "src/lxml/extensions.pxi":119
 *         if s is None:
 *             return None
 *         dict_result = python.PyDict_GetItem(self._utf_refs, s)             # <<<<<<<<<<<<<<
 *         if dict_result is not NULL:
 *             return <bytes>dict_result
*/
  __pyx_t_2 = __pyx_v_self->_utf_refs;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_dict_result = PyDict_GetItem(__pyx_t_2, __pyx_v_s);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/extensions.pxi":120
 *             return None
 *         dict_result = python.PyDict_GetItem(self._utf_refs, s)
 *         if dict_result is not NULL:             # <<<<<<<<<<<<<<
 *             return <bytes>dict_result
 *         utf = _utf8(s)
*/
  __pyx_t_1 = (__pyx_v_dict_result != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":121
 *         dict_result = python.PyDict_GetItem(self._utf_refs, s)
 *         if dict_result is not NULL:
 *             return <bytes>dict_result             # <<<<<<<<<<<<<<
 *         utf = _utf8(s)
 *         self._utf_refs[s] = utf
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject*)__pyx_v_dict_result));
    __pyx_r = ((PyObject*)__pyx_v_dict_result);
    goto __pyx_L0;

    /* "src/lxml/extensions.pxi":120
 *             return None
 *         dict_result = python.PyDict_GetItem(self._utf_refs, s)
 *         if dict_result is not NULL:             # <<<<<<<<<<<<<<
 *             return <bytes>dict_result
 *         utf = _utf8(s)
*/
  }

  /* "src/lxml/extensions.pxi":122
 *         if dict_result is not NULL:
 *             return <bytes>dict_result
 *         utf = _utf8(s)             # <<<<<<<<<<<<<<
 *         self._utf_refs[s] = utf
 *         if python.IS_PYPY:
*/
  __pyx_t_2 = __pyx_f_4lxml_5etree__utf8(__pyx_v_s); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 122, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_utf = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/extensions.pxi":123
 *             return <bytes>dict_result
 *         utf = _utf8(s)
 *         self._utf_refs[s] = utf             # <<<<<<<<<<<<<<
 *         if python.IS_PYPY:
 *             # use C level refs, PyPy refs are not enough!
*/
  if (unlikely(__pyx_v_self->_utf_refs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(18, 123, __pyx_L1_error)
  }
  if (unlikely((PyDict_SetItem(__pyx_v_self->_utf_refs, __pyx_v_s, __pyx_v_utf) < 0))) __PYX_ERR(18, 123, __pyx_L1_error)

  /* "src/lxml/extensions.pxi":124
 *         utf = _utf8(s)
 *         self._utf_refs[s] = utf
 *         if python.IS_PYPY:             # <<<<<<<<<<<<<<
 *             # use C level refs, PyPy refs are not enough!
 *             python.Py_INCREF(utf)
*/
  if (IS_PYPY) {

    /* "src/lxml/extensions.pxi":126
 *         if python.IS_PYPY:
 *             # use C level refs, PyPy refs are not enough!
 *             python.Py_INCREF(utf)             # <<<<<<<<<<<<<<
 *         return utf
 * 
*/
    Py_INCREF(__pyx_v_utf);

    /* "src/lxml/extensions.pxi":124
 *         utf = _utf8(s)
 *         self._utf_refs[s] = utf
 *         if python.IS_PYPY:             # <<<<<<<<<<<<<<
 *             # use C level refs, PyPy refs are not enough!
 *             python.Py_INCREF(utf)
*/
  }

  /* "src/lxml/extensions.pxi":127
 *             # use C level refs, PyPy refs are not enough!
 *             python.Py_INCREF(utf)
 *         return utf             # <<<<<<<<<<<<<<
 * 
 *     cdef void _set_xpath_context(self, xpath.xmlXPathContext* xpathCtxt) noexcept:
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_utf);
  __pyx_r = __pyx_v_utf;
  goto __pyx_L0;

  /* "src/lxml/extensions.pxi":114
 *         return context
 * 
 *     cdef bytes _to_utf(self, s):             # <<<<<<<<<<<<<<
 *         "Convert to UTF-8 and keep a reference to the encoded string"
 *         cdef python.PyObject* dict_result
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._BaseContext._to_utf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_utf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/extensions.pxi":129
 *         return utf
 * 
 *     cdef void _set_xpath_context(self, xpath.xmlXPathContext* xpathCtxt) noexcept:             # <<<<<<<<<<<<<<
 *         self._xpathCtxt = xpathCtxt
 *         xpathCtxt.userData = <void*>self
*/

static void __pyx_f_4lxml_5etree_12_BaseContext__set_xpath_context(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, xmlXPathContext *__pyx_v_xpathCtxt) {

  /* "src/lxml/extensions.pxi":130
 * 
 *     cdef void _set_xpath_context(self, xpath.xmlXPathContext* xpathCtxt) noexcept:
 *         self._xpathCtxt = xpathCtxt             # <<<<<<<<<<<<<<
 *         xpathCtxt.userData = <void*>self
 *         # Need a cast here because older libxml2 releases do not use 'const' in the functype.
*/
  __pyx_v_self->_xpathCtxt = __pyx_v_xpathCtxt;

  /* "src/lxml/extensions.pxi":131
 *     cdef void _set_xpath_context(self, xpath.xmlXPathContext* xpathCtxt) noexcept:
 *         self._xpathCtxt = xpathCtxt
 *         xpathCtxt.userData = <void*>self             # <<<<<<<<<<<<<<
 *         # Need a cast here because older libxml2 releases do not use 'const' in the functype.
 *         xpathCtxt.error = <xmlerror.xmlStructuredErrorFunc> _receiveXPathError
*/
  __pyx_v_xpathCtxt->userData = ((void *)__pyx_v_self);

  /* "src/lxml/extensions.pxi":133
 *         xpathCtxt.userData = <void*>self
 *         # Need a cast here because older libxml2 releases do not use 'const' in the functype.
 *         xpathCtxt.error = <xmlerror.xmlStructuredErrorFunc> _receiveXPathError             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
*/
  __pyx_v_xpathCtxt->error = ((xmlStructuredErrorFunc)__pyx_f_4lxml_5etree__receiveXPathError);

  /* "src/lxml/extensions.pxi":129
 *         return utf
 * 
 *     cdef void _set_xpath_context(self, xpath.xmlXPathContext* xpathCtxt) noexcept:             # <<<<<<<<<<<<<<
 *         self._xpathCtxt = xpathCtxt
 *         xpathCtxt.userData = <void*>self
*/

  /* function exit code */
}

/* "src/lxml/extensions.pxi":135
 *         xpathCtxt.error = <xmlerror.xmlStructuredErrorFunc> _receiveXPathError
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef _register_context(self, _Document doc):
 *         self._doc = doc
*/

static PyObject *__pyx_f_4lxml_5etree_12_BaseContext__register_context(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, struct LxmlDocument *__pyx_v_doc) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_register_context", 0);

  /* "src/lxml/extensions.pxi":137
 *     @cython.final
 *     cdef _register_context(self, _Document doc):
 *         self._doc = doc             # <<<<<<<<<<<<<<
 *         self._exc.clear()
 * 
*/
  __Pyx_INCREF((PyObject *)__pyx_v_doc);
  __Pyx_GIVEREF((PyObject *)__pyx_v_doc);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_doc);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_doc);
  __pyx_v_self->_doc = __pyx_v_doc;

  /* "src/lxml/extensions.pxi":138
 *     cdef _register_context(self, _Document doc):
 *         self._doc = doc
 *         self._exc.clear()             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext *)__pyx_v_self->_exc->__pyx_vtab)->clear(__pyx_v_self->_exc); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(18, 138, __pyx_L1_error)

  /* "src/lxml/extensions.pxi":135
 *         xpathCtxt.error = <xmlerror.xmlStructuredErrorFunc> _receiveXPathError
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef _register_context(self, _Document doc):
 *         self._doc = doc
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._BaseContext._register_context", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/extensions.pxi":140
 *         self._exc.clear()
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef _cleanup_context(self):
 *         #xpath.xmlXPathRegisteredNsCleanup(self._xpathCtxt)
*/

static PyObject *__pyx_f_4lxml_5etree_12_BaseContext__cleanup_context(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self) {
  PyObject *__pyx_v_ref = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_cleanup_context", 0);

  /* "src/lxml/extensions.pxi":144
 *         #xpath.xmlXPathRegisteredNsCleanup(self._xpathCtxt)
 *         #self.unregisterGlobalNamespaces()
 *         if python.IS_PYPY:             # <<<<<<<<<<<<<<
 *             # clean up double refs in PyPy (see "_to_utf()" method)
 *             for ref in self._utf_refs.itervalues():
*/
  if (IS_PYPY) {

    /* "src/lxml/extensions.pxi":146
 *         if python.IS_PYPY:
 *             # clean up double refs in PyPy (see "_to_utf()" method)
 *             for ref in self._utf_refs.itervalues():             # <<<<<<<<<<<<<<
 *                 python.Py_DECREF(ref)
 *         self._utf_refs.clear()
*/
    __pyx_t_2 = 0;
    if (unlikely(__pyx_v_self->_utf_refs == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "itervalues");
      __PYX_ERR(18, 146, __pyx_L1_error)
    }
    __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_self->_utf_refs, 1, __pyx_mstate_global->__pyx_n_u_itervalues, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(18, 146, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_1);
    __pyx_t_1 = __pyx_t_5;
    __pyx_t_5 = 0;
    while (1) {
      __pyx_t_6 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, NULL, &__pyx_t_5, NULL, __pyx_t_4);
      if (unlikely(__pyx_t_6 == 0)) break;
      if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(18, 146, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_XDECREF_SET(__pyx_v_ref, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "src/lxml/extensions.pxi":147
 *             # clean up double refs in PyPy (see "_to_utf()" method)
 *             for ref in self._utf_refs.itervalues():
 *                 python.Py_DECREF(ref)             # <<<<<<<<<<<<<<
 *         self._utf_refs.clear()
 *         self._eval_context_dict = None
*/
      Py_DECREF(__pyx_v_ref);
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "src/lxml/extensions.pxi":144
 *         #xpath.xmlXPathRegisteredNsCleanup(self._xpathCtxt)
 *         #self.unregisterGlobalNamespaces()
 *         if python.IS_PYPY:             # <<<<<<<<<<<<<<
 *             # clean up double refs in PyPy (see "_to_utf()" method)
 *             for ref in self._utf_refs.itervalues():
*/
  }

  /* "src/lxml/extensions.pxi":148
 *             for ref in self._utf_refs.itervalues():
 *                 python.Py_DECREF(ref)
 *         self._utf_refs.clear()             # <<<<<<<<<<<<<<
 *         self._eval_context_dict = None
 *         self._doc = None
*/
  if (unlikely(__pyx_v_self->_utf_refs == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "clear");
    __PYX_ERR(18, 148, __pyx_L1_error)
  }
  __pyx_t_7 = __Pyx_PyDict_Clear(__pyx_v_self->_utf_refs); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(18, 148, __pyx_L1_error)

  /* "src/lxml/extensions.pxi":149
 *                 python.Py_DECREF(ref)
 *         self._utf_refs.clear()
 *         self._eval_context_dict = None             # <<<<<<<<<<<<<<
 *         self._doc = None
 * 
*/
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_eval_context_dict);
  __Pyx_DECREF(__pyx_v_self->_eval_context_dict);
  __pyx_v_self->_eval_context_dict = ((PyObject*)Py_None);

  /* "src/lxml/extensions.pxi":150
 *         self._utf_refs.clear()
 *         self._eval_context_dict = None
 *         self._doc = None             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
*/
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_doc);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_doc);
  __pyx_v_self->_doc = ((struct LxmlDocument *)Py_None);

  /* "src/lxml/extensions.pxi":140
 *         self._exc.clear()
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef _cleanup_context(self):
 *         #xpath.xmlXPathRegisteredNsCleanup(self._xpathCtxt)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._BaseContext._cleanup_context", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ref);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/extensions.pxi":152
 *         self._doc = None
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef _release_context(self):
 *         if self._xpathCtxt is not NULL:
*/

static PyObject *__pyx_f_4lxml_5etree_12_BaseContext__release_context(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_release_context", 0);

  /* "src/lxml/extensions.pxi":154
 *     @cython.final
 *     cdef _release_context(self):
 *         if self._xpathCtxt is not NULL:             # <<<<<<<<<<<<<<
 *             self._xpathCtxt.userData = NULL
 *             self._xpathCtxt = NULL
*/
  __pyx_t_1 = (__pyx_v_self->_xpathCtxt != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":155
 *     cdef _release_context(self):
 *         if self._xpathCtxt is not NULL:
 *             self._xpathCtxt.userData = NULL             # <<<<<<<<<<<<<<
 *             self._xpathCtxt = NULL
 * 
*/
    __pyx_v_self->_xpathCtxt->userData = NULL;

    /* "src/lxml/extensions.pxi":156
 *         if self._xpathCtxt is not NULL:
 *             self._xpathCtxt.userData = NULL
 *             self._xpathCtxt = NULL             # <<<<<<<<<<<<<<
 * 
 *     # namespaces (internal UTF-8 methods with leading '_')
*/
    __pyx_v_self->_xpathCtxt = NULL;

    /* "src/lxml/extensions.pxi":154
 *     @cython.final
 *     cdef _release_context(self):
 *         if self._xpathCtxt is not NULL:             # <<<<<<<<<<<<<<
 *             self._xpathCtxt.userData = NULL
 *             self._xpathCtxt = NULL
*/
  }

  /* "src/lxml/extensions.pxi":152
 *         self._doc = None
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef _release_context(self):
 *         if self._xpathCtxt is not NULL:
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/extensions.pxi":160
 *     # namespaces (internal UTF-8 methods with leading '_')
 * 
 *     cdef addNamespace(self, prefix, ns_uri):             # <<<<<<<<<<<<<<
 *         cdef list namespaces
 *         if prefix is None:
*/

static PyObject *__pyx_f_4lxml_5etree_12_BaseContext_addNamespace(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, PyObject *__pyx_v_prefix, PyObject *__pyx_v_ns_uri) {
  PyObject *__pyx_v_namespaces = 0;
  PyObject *__pyx_v_prefix_utf = NULL;
  PyObject *__pyx_v_ns_uri_utf = NULL;
  PyObject *__pyx_v_new_item = NULL;
  PyObject *__pyx_v_item = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("addNamespace", 0);

  /* "src/lxml/extensions.pxi":162
 *     cdef addNamespace(self, prefix, ns_uri):
 *         cdef list namespaces
 *         if prefix is None:             # <<<<<<<<<<<<<<
 *             raise TypeError, "empty prefix is not supported in XPath"
 *         prefix_utf = self._to_utf(prefix)
*/
  __pyx_t_1 = (__pyx_v_prefix == Py_None);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/extensions.pxi":163
 *         cdef list namespaces
 *         if prefix is None:
 *             raise TypeError, "empty prefix is not supported in XPath"             # <<<<<<<<<<<<<<
 *         prefix_utf = self._to_utf(prefix)
 *         ns_uri_utf = self._to_utf(ns_uri)
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_empty_prefix_is_not_supported_in, 0, 0);
    __PYX_ERR(18, 163, __pyx_L1_error)

    /* "src/lxml/extensions.pxi":162
 *     cdef addNamespace(self, prefix, ns_uri):
 *         cdef list namespaces
 *         if prefix is None:             # <<<<<<<<<<<<<<
 *             raise TypeError, "empty prefix is not supported in XPath"
 *         prefix_utf = self._to_utf(prefix)
*/
  }

  /* "src/lxml/extensions.pxi":164
 *         if prefix is None:
 *             raise TypeError, "empty prefix is not supported in XPath"
 *         prefix_utf = self._to_utf(prefix)             # <<<<<<<<<<<<<<
 *         ns_uri_utf = self._to_utf(ns_uri)
 *         new_item = (prefix_utf, ns_uri_utf)
*/
  __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseContext *)__pyx_v_self->__pyx_vtab)->_to_utf(__pyx_v_self, __pyx_v_prefix); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 164, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_prefix_utf = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/extensions.pxi":165
 *             raise TypeError, "empty prefix is not supported in XPath"
 *         prefix_utf = self._to_utf(prefix)
 *         ns_uri_utf = self._to_utf(ns_uri)             # <<<<<<<<<<<<<<
 *         new_item = (prefix_utf, ns_uri_utf)
 *         if self._namespaces is None:
*/
  __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseContext *)__pyx_v_self->__pyx_vtab)->_to_utf(__pyx_v_self, __pyx_v_ns_uri); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 165, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_ns_uri_utf = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/extensions.pxi":166
 *         prefix_utf = self._to_utf(prefix)
 *         ns_uri_utf = self._to_utf(ns_uri)
 *         new_item = (prefix_utf, ns_uri_utf)             # <<<<<<<<<<<<<<
 *         if self._namespaces is None:
 *             self._namespaces = [new_item]
*/
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 166, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_prefix_utf);
  __Pyx_GIVEREF(__pyx_v_prefix_utf);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_prefix_utf) != (0)) __PYX_ERR(18, 166, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_ns_uri_utf);
  __Pyx_GIVEREF(__pyx_v_ns_uri_utf);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_ns_uri_utf) != (0)) __PYX_ERR(18, 166, __pyx_L1_error);
  __pyx_v_new_item = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/extensions.pxi":167
 *         ns_uri_utf = self._to_utf(ns_uri)
 *         new_item = (prefix_utf, ns_uri_utf)
 *         if self._namespaces is None:             # <<<<<<<<<<<<<<
 *             self._namespaces = [new_item]
 *         else:
*/
  __pyx_t_1 = (__pyx_v_self->_namespaces == ((PyObject*)Py_None));
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":168
 *         new_item = (prefix_utf, ns_uri_utf)
 *         if self._namespaces is None:
 *             self._namespaces = [new_item]             # <<<<<<<<<<<<<<
 *         else:
 *             namespaces = []
*/
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 168, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_new_item);
    __Pyx_GIVEREF(__pyx_v_new_item);
    if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_v_new_item) != (0)) __PYX_ERR(18, 168, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_GOTREF(__pyx_v_self->_namespaces);
    __Pyx_DECREF(__pyx_v_self->_namespaces);
    __pyx_v_self->_namespaces = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/extensions.pxi":167
 *         ns_uri_utf = self._to_utf(ns_uri)
 *         new_item = (prefix_utf, ns_uri_utf)
 *         if self._namespaces is None:             # <<<<<<<<<<<<<<
 *             self._namespaces = [new_item]
 *         else:
*/
    goto __pyx_L4;
  }

  /* "src/lxml/extensions.pxi":170
 *             self._namespaces = [new_item]
 *         else:
 *             namespaces = []             # <<<<<<<<<<<<<<
 *             for item in self._namespaces:
 *                 if item[0] == prefix_utf:
*/
  /*else*/ {
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 170, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_namespaces = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/extensions.pxi":171
 *         else:
 *             namespaces = []
 *             for item in self._namespaces:             # <<<<<<<<<<<<<<
 *                 if item[0] == prefix_utf:
 *                     item = new_item
*/
    if (unlikely(__pyx_v_self->_namespaces == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
      __PYX_ERR(18, 171, __pyx_L1_error)
    }
    __pyx_t_2 = __pyx_v_self->_namespaces; __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = 0;
    for (;;) {
      {
        Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely((__pyx_temp < 0))) __PYX_ERR(18, 171, __pyx_L1_error)
        #endif
        if (__pyx_t_3 >= __pyx_temp) break;
      }
      __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_3, __Pyx_ReferenceSharing_OwnStrongReference);
      ++__pyx_t_3;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(18, 171, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "src/lxml/extensions.pxi":172
 *             namespaces = []
 *             for item in self._namespaces:
 *                 if item[0] == prefix_utf:             # <<<<<<<<<<<<<<
 *                     item = new_item
 *                     new_item = None
*/
      __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_item, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_4)) __PYX_ERR(18, 172, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = (__Pyx_PyBytes_Equals(__pyx_t_4, __pyx_v_prefix_utf, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(18, 172, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_1) {

        /* "src/lxml/extensions.pxi":173
 *             for item in self._namespaces:
 *                 if item[0] == prefix_utf:
 *                     item = new_item             # <<<<<<<<<<<<<<
 *                     new_item = None
 *                 namespaces.append(item)
*/
        __Pyx_INCREF(__pyx_v_new_item);
        __Pyx_DECREF_SET(__pyx_v_item, __pyx_v_new_item);

        /* "src/lxml/extensions.pxi":174
 *                 if item[0] == prefix_utf:
 *                     item = new_item
 *                     new_item = None             # <<<<<<<<<<<<<<
 *                 namespaces.append(item)
 *             if new_item is not None:
*/
        __Pyx_INCREF(Py_None);
        __Pyx_DECREF_SET(__pyx_v_new_item, ((PyObject*)Py_None));

        /* "src/lxml/extensions.pxi":172
 *             namespaces = []
 *             for item in self._namespaces:
 *                 if item[0] == prefix_utf:             # <<<<<<<<<<<<<<
 *                     item = new_item
 *                     new_item = None
*/
      }

      /* "src/lxml/extensions.pxi":175
 *                     item = new_item
 *                     new_item = None
 *                 namespaces.append(item)             # <<<<<<<<<<<<<<
 *             if new_item is not None:
 *                 namespaces.append(new_item)
*/
      __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_namespaces, __pyx_v_item); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(18, 175, __pyx_L1_error)

      /* "src/lxml/extensions.pxi":171
 *         else:
 *             namespaces = []
 *             for item in self._namespaces:             # <<<<<<<<<<<<<<
 *                 if item[0] == prefix_utf:
 *                     item = new_item
*/
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/extensions.pxi":176
 *                     new_item = None
 *                 namespaces.append(item)
 *             if new_item is not None:             # <<<<<<<<<<<<<<
 *                 namespaces.append(new_item)
 *             self._namespaces = namespaces
*/
    __pyx_t_1 = (__pyx_v_new_item != ((PyObject*)Py_None));
    if (__pyx_t_1) {

      /* "src/lxml/extensions.pxi":177
 *                 namespaces.append(item)
 *             if new_item is not None:
 *                 namespaces.append(new_item)             # <<<<<<<<<<<<<<
 *             self._namespaces = namespaces
 *         if self._xpathCtxt is not NULL:
*/
      __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_namespaces, __pyx_v_new_item); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(18, 177, __pyx_L1_error)

      /* "src/lxml/extensions.pxi":176
 *                     new_item = None
 *                 namespaces.append(item)
 *             if new_item is not None:             # <<<<<<<<<<<<<<
 *                 namespaces.append(new_item)
 *             self._namespaces = namespaces
*/
    }

    /* "src/lxml/extensions.pxi":178
 *             if new_item is not None:
 *                 namespaces.append(new_item)
 *             self._namespaces = namespaces             # <<<<<<<<<<<<<<
 *         if self._xpathCtxt is not NULL:
 *             xpath.xmlXPathRegisterNs(
*/
    __Pyx_INCREF(__pyx_v_namespaces);
    __Pyx_GIVEREF(__pyx_v_namespaces);
    __Pyx_GOTREF(__pyx_v_self->_namespaces);
    __Pyx_DECREF(__pyx_v_self->_namespaces);
    __pyx_v_self->_namespaces = __pyx_v_namespaces;
  }
  __pyx_L4:;

  /* "src/lxml/extensions.pxi":179
 *                 namespaces.append(new_item)
 *             self._namespaces = namespaces
 *         if self._xpathCtxt is not NULL:             # <<<<<<<<<<<<<<
 *             xpath.xmlXPathRegisterNs(
 *                 self._xpathCtxt, _xcstr(prefix_utf), _xcstr(ns_uri_utf))
*/
  __pyx_t_1 = (__pyx_v_self->_xpathCtxt != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":180
 *             self._namespaces = namespaces
 *         if self._xpathCtxt is not NULL:
 *             xpath.xmlXPathRegisterNs(             # <<<<<<<<<<<<<<
 *                 self._xpathCtxt, _xcstr(prefix_utf), _xcstr(ns_uri_utf))
 * 
*/
    (void)(xmlXPathRegisterNs(__pyx_v_self->_xpathCtxt, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_prefix_utf), (const xmlChar*)PyBytes_AS_STRING(__pyx_v_ns_uri_utf)));

    /* "src/lxml/extensions.pxi":179
 *                 namespaces.append(new_item)
 *             self._namespaces = namespaces
 *         if self._xpathCtxt is not NULL:             # <<<<<<<<<<<<<<
 *             xpath.xmlXPathRegisterNs(
 *                 self._xpathCtxt, _xcstr(prefix_utf), _xcstr(ns_uri_utf))
*/
  }

  /* "src/lxml/extensions.pxi":160
 *     # namespaces (internal UTF-8 methods with leading '_')
 * 
 *     cdef addNamespace(self, prefix, ns_uri):             # <<<<<<<<<<<<<<
 *         cdef list namespaces
 *         if prefix is None:
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._BaseContext.addNamespace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_namespaces);
  __Pyx_XDECREF(__pyx_v_prefix_utf);
  __Pyx_XDECREF(__pyx_v_ns_uri_utf);
  __Pyx_XDECREF(__pyx_v_new_item);
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/extensions.pxi":183
 *                 self._xpathCtxt, _xcstr(prefix_utf), _xcstr(ns_uri_utf))
 * 
 *     cdef registerNamespace(self, prefix, ns_uri):             # <<<<<<<<<<<<<<
 *         if prefix is None:
 *             raise TypeError, "empty prefix is not supported in XPath"
*/

static PyObject *__pyx_f_4lxml_5etree_12_BaseContext_registerNamespace(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, PyObject *__pyx_v_prefix, PyObject *__pyx_v_ns_uri) {
  PyObject *__pyx_v_prefix_utf = NULL;
  PyObject *__pyx_v_ns_uri_utf = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("registerNamespace", 0);

  /* "src/lxml/extensions.pxi":184
 * 
 *     cdef registerNamespace(self, prefix, ns_uri):
 *         if prefix is None:             # <<<<<<<<<<<<<<
 *             raise TypeError, "empty prefix is not supported in XPath"
 *         prefix_utf = self._to_utf(prefix)
*/
  __pyx_t_1 = (__pyx_v_prefix == Py_None);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/extensions.pxi":185
 *     cdef registerNamespace(self, prefix, ns_uri):
 *         if prefix is None:
 *             raise TypeError, "empty prefix is not supported in XPath"             # <<<<<<<<<<<<<<
 *         prefix_utf = self._to_utf(prefix)
 *         ns_uri_utf = self._to_utf(ns_uri)
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_empty_prefix_is_not_supported_in, 0, 0);
    __PYX_ERR(18, 185, __pyx_L1_error)

    /* "src/lxml/extensions.pxi":184
 * 
 *     cdef registerNamespace(self, prefix, ns_uri):
 *         if prefix is None:             # <<<<<<<<<<<<<<
 *             raise TypeError, "empty prefix is not supported in XPath"
 *         prefix_utf = self._to_utf(prefix)
*/
  }

  /* "src/lxml/extensions.pxi":186
 *         if prefix is None:
 *             raise TypeError, "empty prefix is not supported in XPath"
 *         prefix_utf = self._to_utf(prefix)             # <<<<<<<<<<<<<<
 *         ns_uri_utf = self._to_utf(ns_uri)
 *         self._global_namespaces.append(prefix_utf)
*/
  __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseContext *)__pyx_v_self->__pyx_vtab)->_to_utf(__pyx_v_self, __pyx_v_prefix); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 186, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_prefix_utf = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/extensions.pxi":187
 *             raise TypeError, "empty prefix is not supported in XPath"
 *         prefix_utf = self._to_utf(prefix)
 *         ns_uri_utf = self._to_utf(ns_uri)             # <<<<<<<<<<<<<<
 *         self._global_namespaces.append(prefix_utf)
 *         xpath.xmlXPathRegisterNs(self._xpathCtxt,
*/
  __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseContext *)__pyx_v_self->__pyx_vtab)->_to_utf(__pyx_v_self, __pyx_v_ns_uri); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 187, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_ns_uri_utf = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/extensions.pxi":188
 *         prefix_utf = self._to_utf(prefix)
 *         ns_uri_utf = self._to_utf(ns_uri)
 *         self._global_namespaces.append(prefix_utf)             # <<<<<<<<<<<<<<
 *         xpath.xmlXPathRegisterNs(self._xpathCtxt,
 *                                  _xcstr(prefix_utf), _xcstr(ns_uri_utf))
*/
  if (unlikely(__pyx_v_self->_global_namespaces == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
    __PYX_ERR(18, 188, __pyx_L1_error)
  }
  __pyx_t_3 = __Pyx_PyList_Append(__pyx_v_self->_global_namespaces, __pyx_v_prefix_utf); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(18, 188, __pyx_L1_error)

  /* "src/lxml/extensions.pxi":189
 *         ns_uri_utf = self._to_utf(ns_uri)
 *         self._global_namespaces.append(prefix_utf)
 *         xpath.xmlXPathRegisterNs(self._xpathCtxt,             # <<<<<<<<<<<<<<
 *                                  _xcstr(prefix_utf), _xcstr(ns_uri_utf))
 * 
*/
  (void)(xmlXPathRegisterNs(__pyx_v_self->_xpathCtxt, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_prefix_utf), (const xmlChar*)PyBytes_AS_STRING(__pyx_v_ns_uri_utf)));

  /* "src/lxml/extensions.pxi":183
 *                 self._xpathCtxt, _xcstr(prefix_utf), _xcstr(ns_uri_utf))
 * 
 *     cdef registerNamespace(self, prefix, ns_uri):             # <<<<<<<<<<<<<<
 *         if prefix is None:
 *             raise TypeError, "empty prefix is not supported in XPath"
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._BaseContext.registerNamespace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_prefix_utf);
  __Pyx_XDECREF(__pyx_v_ns_uri_utf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/extensions.pxi":192
 *                                  _xcstr(prefix_utf), _xcstr(ns_uri_utf))
 * 
 *     cdef registerLocalNamespaces(self):             # <<<<<<<<<<<<<<
 *         if self._namespaces is None:
 *             return
*/

static PyObject *__pyx_f_4lxml_5etree_12_BaseContext_registerLocalNamespaces(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self) {
  PyObject *__pyx_v_prefix_utf = NULL;
  PyObject *__pyx_v_ns_uri_utf = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("registerLocalNamespaces", 0);

  /* "src/lxml/extensions.pxi":193
 * 
 *     cdef registerLocalNamespaces(self):
 *         if self._namespaces is None:             # <<<<<<<<<<<<<<
 *             return
 *         for prefix_utf, ns_uri_utf in self._namespaces:
*/
  __pyx_t_1 = (__pyx_v_self->_namespaces == ((PyObject*)Py_None));
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":194
 *     cdef registerLocalNamespaces(self):
 *         if self._namespaces is None:
 *             return             # <<<<<<<<<<<<<<
 *         for prefix_utf, ns_uri_utf in self._namespaces:
 *             xpath.xmlXPathRegisterNs(
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/extensions.pxi":193
 * 
 *     cdef registerLocalNamespaces(self):
 *         if self._namespaces is None:             # <<<<<<<<<<<<<<
 *             return
 *         for prefix_utf, ns_uri_utf in self._namespaces:
*/
  }

  /* "src/lxml/extensions.pxi":195
 *         if self._namespaces is None:
 *             return
 *         for prefix_utf, ns_uri_utf in self._namespaces:             # <<<<<<<<<<<<<<
 *             xpath.xmlXPathRegisterNs(
 *                 self._xpathCtxt, _xcstr(prefix_utf), _xcstr(ns_uri_utf))
*/
  if (unlikely(__pyx_v_self->_namespaces == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(18, 195, __pyx_L1_error)
  }
  __pyx_t_2 = __pyx_v_self->_namespaces; __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  for (;;) {
    {
      Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
      #if !CYTHON_ASSUME_SAFE_SIZE
      if (unlikely((__pyx_temp < 0))) __PYX_ERR(18, 195, __pyx_L1_error)
      #endif
      if (__pyx_t_3 >= __pyx_temp) break;
    }
    __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_3, __Pyx_ReferenceSharing_OwnStrongReference);
    ++__pyx_t_3;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(18, 195, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
      PyObject* sequence = __pyx_t_4;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(18, 195, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0);
        __Pyx_INCREF(__pyx_t_5);
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1);
        __Pyx_INCREF(__pyx_t_6);
      } else {
        __pyx_t_5 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_5)) __PYX_ERR(18, 195, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_5);
        __pyx_t_6 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_6)) __PYX_ERR(18, 195, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_6);
      }
      #else
      __pyx_t_5 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(18, 195, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(18, 195, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(18, 195, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7);
      index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < (0)) __PYX_ERR(18, 195, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L7_unpacking_done;
      __pyx_L6_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(18, 195, __pyx_L1_error)
      __pyx_L7_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_prefix_utf, __pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_ns_uri_utf, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "src/lxml/extensions.pxi":196
 *             return
 *         for prefix_utf, ns_uri_utf in self._namespaces:
 *             xpath.xmlXPathRegisterNs(             # <<<<<<<<<<<<<<
 *                 self._xpathCtxt, _xcstr(prefix_utf), _xcstr(ns_uri_utf))
 * 
*/
    (void)(xmlXPathRegisterNs(__pyx_v_self->_xpathCtxt, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_prefix_utf), (const xmlChar*)PyBytes_AS_STRING(__pyx_v_ns_uri_utf)));

    /* "src/lxml/extensions.pxi":195
 *         if self._namespaces is None:
 *             return
 *         for prefix_utf, ns_uri_utf in self._namespaces:             # <<<<<<<<<<<<<<
 *             xpath.xmlXPathRegisterNs(
 *                 self._xpathCtxt, _xcstr(prefix_utf), _xcstr(ns_uri_utf))
*/
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/extensions.pxi":192
 *                                  _xcstr(prefix_utf), _xcstr(ns_uri_utf))
 * 
 *     cdef registerLocalNamespaces(self):             # <<<<<<<<<<<<<<
 *         if self._namespaces is None:
 *             return
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree._BaseContext.registerLocalNamespaces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_prefix_utf);
  __Pyx_XDECREF(__pyx_v_ns_uri_utf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/extensions.pxi":199
 *                 self._xpathCtxt, _xcstr(prefix_utf), _xcstr(ns_uri_utf))
 * 
 *     cdef registerGlobalNamespaces(self):             # <<<<<<<<<<<<<<
 *         cdef list ns_prefixes = _find_all_extension_prefixes()
 *         if python.PyList_GET_SIZE(ns_prefixes) > 0:
*/

static PyObject *__pyx_f_4lxml_5etree_12_BaseContext_registerGlobalNamespaces(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self) {
  PyObject *__pyx_v_ns_prefixes = 0;
  PyObject *__pyx_v_prefix_utf = NULL;
  PyObject *__pyx_v_ns_uri_utf = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("registerGlobalNamespaces", 0);

  /* "src/lxml/extensions.pxi":200
 * 
 *     cdef registerGlobalNamespaces(self):
 *         cdef list ns_prefixes = _find_all_extension_prefixes()             # <<<<<<<<<<<<<<
 *         if python.PyList_GET_SIZE(ns_prefixes) > 0:
 *             for prefix_utf, ns_uri_utf in ns_prefixes:
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__find_all_extension_prefixes(); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 200, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ns_prefixes = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":201
 *     cdef registerGlobalNamespaces(self):
 *         cdef list ns_prefixes = _find_all_extension_prefixes()
 *         if python.PyList_GET_SIZE(ns_prefixes) > 0:             # <<<<<<<<<<<<<<
 *             for prefix_utf, ns_uri_utf in ns_prefixes:
 *                 self._global_namespaces.append(prefix_utf)
*/
  __pyx_t_2 = (PyList_GET_SIZE(__pyx_v_ns_prefixes) > 0);
  if (__pyx_t_2) {

    /* "src/lxml/extensions.pxi":202
 *         cdef list ns_prefixes = _find_all_extension_prefixes()
 *         if python.PyList_GET_SIZE(ns_prefixes) > 0:
 *             for prefix_utf, ns_uri_utf in ns_prefixes:             # <<<<<<<<<<<<<<
 *                 self._global_namespaces.append(prefix_utf)
 *                 xpath.xmlXPathRegisterNs(
*/
    if (unlikely(__pyx_v_ns_prefixes == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
      __PYX_ERR(18, 202, __pyx_L1_error)
    }
    __pyx_t_1 = __pyx_v_ns_prefixes; __Pyx_INCREF(__pyx_t_1);
    __pyx_t_3 = 0;
    for (;;) {
      {
        Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely((__pyx_temp < 0))) __PYX_ERR(18, 202, __pyx_L1_error)
        #endif
        if (__pyx_t_3 >= __pyx_temp) break;
      }
      __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_3, __Pyx_ReferenceSharing_OwnStrongReference);
      ++__pyx_t_3;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(18, 202, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
        PyObject* sequence = __pyx_t_4;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(18, 202, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0);
          __Pyx_INCREF(__pyx_t_5);
          __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1);
          __Pyx_INCREF(__pyx_t_6);
        } else {
          __pyx_t_5 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
          if (unlikely(!__pyx_t_5)) __PYX_ERR(18, 202, __pyx_L1_error)
          __Pyx_XGOTREF(__pyx_t_5);
          __pyx_t_6 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
          if (unlikely(!__pyx_t_6)) __PYX_ERR(18, 202, __pyx_L1_error)
          __Pyx_XGOTREF(__pyx_t_6);
        }
        #else
        __pyx_t_5 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(18, 202, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(18, 202, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        #endif
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(18, 202, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7);
        index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L6_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_5);
        index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_6);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < (0)) __PYX_ERR(18, 202, __pyx_L1_error)
        __pyx_t_8 = NULL;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        goto __pyx_L7_unpacking_done;
        __pyx_L6_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_8 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(18, 202, __pyx_L1_error)
        __pyx_L7_unpacking_done:;
      }
      __Pyx_XDECREF_SET(__pyx_v_prefix_utf, __pyx_t_5);
      __pyx_t_5 = 0;
      __Pyx_XDECREF_SET(__pyx_v_ns_uri_utf, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "src/lxml/extensions.pxi":203
 *         if python.PyList_GET_SIZE(ns_prefixes) > 0:
 *             for prefix_utf, ns_uri_utf in ns_prefixes:
 *                 self._global_namespaces.append(prefix_utf)             # <<<<<<<<<<<<<<
 *                 xpath.xmlXPathRegisterNs(
 *                     self._xpathCtxt, _xcstr(prefix_utf), _xcstr(ns_uri_utf))
*/
      if (unlikely(__pyx_v_self->_global_namespaces == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
        __PYX_ERR(18, 203, __pyx_L1_error)
      }
      __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_self->_global_namespaces, __pyx_v_prefix_utf); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(18, 203, __pyx_L1_error)

      /* "src/lxml/extensions.pxi":204
 *             for prefix_utf, ns_uri_utf in ns_prefixes:
 *                 self._global_namespaces.append(prefix_utf)
 *                 xpath.xmlXPathRegisterNs(             # <<<<<<<<<<<<<<
 *                     self._xpathCtxt, _xcstr(prefix_utf), _xcstr(ns_uri_utf))
 * 
*/
      (void)(xmlXPathRegisterNs(__pyx_v_self->_xpathCtxt, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_prefix_utf), (const xmlChar*)PyBytes_AS_STRING(__pyx_v_ns_uri_utf)));

      /* "src/lxml/extensions.pxi":202
 *         cdef list ns_prefixes = _find_all_extension_prefixes()
 *         if python.PyList_GET_SIZE(ns_prefixes) > 0:
 *             for prefix_utf, ns_uri_utf in ns_prefixes:             # <<<<<<<<<<<<<<
 *                 self._global_namespaces.append(prefix_utf)
 *                 xpath.xmlXPathRegisterNs(
*/
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "src/lxml/extensions.pxi":201
 *     cdef registerGlobalNamespaces(self):
 *         cdef list ns_prefixes = _find_all_extension_prefixes()
 *         if python.PyList_GET_SIZE(ns_prefixes) > 0:             # <<<<<<<<<<<<<<
 *             for prefix_utf, ns_uri_utf in ns_prefixes:
 *                 self._global_namespaces.append(prefix_utf)
*/
  }

  /* "src/lxml/extensions.pxi":199
 *                 self._xpathCtxt, _xcstr(prefix_utf), _xcstr(ns_uri_utf))
 * 
 *     cdef registerGlobalNamespaces(self):             # <<<<<<<<<<<<<<
 *         cdef list ns_prefixes = _find_all_extension_prefixes()
 *         if python.PyList_GET_SIZE(ns_prefixes) > 0:
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree._BaseContext.registerGlobalNamespaces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ns_prefixes);
  __Pyx_XDECREF(__pyx_v_prefix_utf);
  __Pyx_XDECREF(__pyx_v_ns_uri_utf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/extensions.pxi":207
 *                     self._xpathCtxt, _xcstr(prefix_utf), _xcstr(ns_uri_utf))
 * 
 *     cdef unregisterGlobalNamespaces(self):             # <<<<<<<<<<<<<<
 *         if python.PyList_GET_SIZE(self._global_namespaces) > 0:
 *             for prefix_utf in self._global_namespaces:
*/

static PyObject *__pyx_f_4lxml_5etree_12_BaseContext_unregisterGlobalNamespaces(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self) {
  PyObject *__pyx_v_prefix_utf = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("unregisterGlobalNamespaces", 0);

  /* "src/lxml/extensions.pxi":208
 * 
 *     cdef unregisterGlobalNamespaces(self):
 *         if python.PyList_GET_SIZE(self._global_namespaces) > 0:             # <<<<<<<<<<<<<<
 *             for prefix_utf in self._global_namespaces:
 *                 xpath.xmlXPathRegisterNs(self._xpathCtxt,
*/
  __pyx_t_1 = __pyx_v_self->_global_namespaces;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = (PyList_GET_SIZE(__pyx_t_1) > 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "src/lxml/extensions.pxi":209
 *     cdef unregisterGlobalNamespaces(self):
 *         if python.PyList_GET_SIZE(self._global_namespaces) > 0:
 *             for prefix_utf in self._global_namespaces:             # <<<<<<<<<<<<<<
 *                 xpath.xmlXPathRegisterNs(self._xpathCtxt,
 *                                          _xcstr(prefix_utf), NULL)
*/
    if (unlikely(__pyx_v_self->_global_namespaces == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
      __PYX_ERR(18, 209, __pyx_L1_error)
    }
    __pyx_t_1 = __pyx_v_self->_global_namespaces; __Pyx_INCREF(__pyx_t_1);
    __pyx_t_3 = 0;
    for (;;) {
      {
        Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely((__pyx_temp < 0))) __PYX_ERR(18, 209, __pyx_L1_error)
        #endif
        if (__pyx_t_3 >= __pyx_temp) break;
      }
      __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_3, __Pyx_ReferenceSharing_OwnStrongReference);
      ++__pyx_t_3;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(18, 209, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_XDECREF_SET(__pyx_v_prefix_utf, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "src/lxml/extensions.pxi":210
 *         if python.PyList_GET_SIZE(self._global_namespaces) > 0:
 *             for prefix_utf in self._global_namespaces:
 *                 xpath.xmlXPathRegisterNs(self._xpathCtxt,             # <<<<<<<<<<<<<<
 *                                          _xcstr(prefix_utf), NULL)
 *             del self._global_namespaces[:]
*/
      (void)(xmlXPathRegisterNs(__pyx_v_self->_xpathCtxt, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_prefix_utf), NULL));

      /* "src/lxml/extensions.pxi":209
 *     cdef unregisterGlobalNamespaces(self):
 *         if python.PyList_GET_SIZE(self._global_namespaces) > 0:
 *             for prefix_utf in self._global_namespaces:             # <<<<<<<<<<<<<<
 *                 xpath.xmlXPathRegisterNs(self._xpathCtxt,
 *                                          _xcstr(prefix_utf), NULL)
*/
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "src/lxml/extensions.pxi":212
 *                 xpath.xmlXPathRegisterNs(self._xpathCtxt,
 *                                          _xcstr(prefix_utf), NULL)
 *             del self._global_namespaces[:]             # <<<<<<<<<<<<<<
 * 
 *     cdef void _unregisterNamespace(self, prefix_utf) noexcept:
*/
    if (unlikely(__pyx_v_self->_global_namespaces == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(18, 212, __pyx_L1_error)
    }
    if (__Pyx_PyObject_DelSlice(__pyx_v_self->_global_namespaces, 0, 0, NULL, NULL, NULL, 0, 0, 1) < (0)) __PYX_ERR(18, 212, __pyx_L1_error)

    /* "src/lxml/extensions.pxi":208
 * 
 *     cdef unregisterGlobalNamespaces(self):
 *         if python.PyList_GET_SIZE(self._global_namespaces) > 0:             # <<<<<<<<<<<<<<
 *             for prefix_utf in self._global_namespaces:
 *                 xpath.xmlXPathRegisterNs(self._xpathCtxt,
*/
  }

  /* "src/lxml/extensions.pxi":207
 *                     self._xpathCtxt, _xcstr(prefix_utf), _xcstr(ns_uri_utf))
 * 
 *     cdef unregisterGlobalNamespaces(self):             # <<<<<<<<<<<<<<
 *         if python.PyList_GET_SIZE(self._global_namespaces) > 0:
 *             for prefix_utf in self._global_namespaces:
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._BaseContext.unregisterGlobalNamespaces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_prefix_utf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/extensions.pxi":214
 *             del self._global_namespaces[:]
 * 
 *     cdef void _unregisterNamespace(self, prefix_utf) noexcept:             # <<<<<<<<<<<<<<
 *         xpath.xmlXPathRegisterNs(self._xpathCtxt,
 *                                  _xcstr(prefix_utf), NULL)
*/

static void __pyx_f_4lxml_5etree_12_BaseContext__unregisterNamespace(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, PyObject *__pyx_v_prefix_utf) {

  /* "src/lxml/extensions.pxi":215
 * 
 *     cdef void _unregisterNamespace(self, prefix_utf) noexcept:
 *         xpath.xmlXPathRegisterNs(self._xpathCtxt,             # <<<<<<<<<<<<<<
 *                                  _xcstr(prefix_utf), NULL)
 * 
*/
  (void)(xmlXPathRegisterNs(__pyx_v_self->_xpathCtxt, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_prefix_utf), NULL));

  /* "src/lxml/extensions.pxi":214
 *             del self._global_namespaces[:]
 * 
 *     cdef void _unregisterNamespace(self, prefix_utf) noexcept:             # <<<<<<<<<<<<<<
 *         xpath.xmlXPathRegisterNs(self._xpathCtxt,
 *                                  _xcstr(prefix_utf), NULL)
*/

  /* function exit code */
}

/* "src/lxml/extensions.pxi":220
 *     # extension functions
 * 
 *     cdef int _addLocalExtensionFunction(self, ns_utf, name_utf, function) except -1:             # <<<<<<<<<<<<<<
 *         if self._extensions is None:
 *             self._extensions = {}
*/

static int __pyx_f_4lxml_5etree_12_BaseContext__addLocalExtensionFunction(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, PyObject *__pyx_v_ns_utf, PyObject *__pyx_v_name_utf, PyObject *__pyx_v_function) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_addLocalExtensionFunction", 0);

  /* "src/lxml/extensions.pxi":221
 * 
 *     cdef int _addLocalExtensionFunction(self, ns_utf, name_utf, function) except -1:
 *         if self._extensions is None:             # <<<<<<<<<<<<<<
 *             self._extensions = {}
 *         self._extensions[(ns_utf, name_utf)] = function
*/
  __pyx_t_1 = (__pyx_v_self->_extensions == ((PyObject*)Py_None));
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":222
 *     cdef int _addLocalExtensionFunction(self, ns_utf, name_utf, function) except -1:
 *         if self._extensions is None:
 *             self._extensions = {}             # <<<<<<<<<<<<<<
 *         self._extensions[(ns_utf, name_utf)] = function
 *         return 0
*/
    __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 222, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_GOTREF(__pyx_v_self->_extensions);
    __Pyx_DECREF(__pyx_v_self->_extensions);
    __pyx_v_self->_extensions = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/extensions.pxi":221
 * 
 *     cdef int _addLocalExtensionFunction(self, ns_utf, name_utf, function) except -1:
 *         if self._extensions is None:             # <<<<<<<<<<<<<<
 *             self._extensions = {}
 *         self._extensions[(ns_utf, name_utf)] = function
*/
  }

  /* "src/lxml/extensions.pxi":223
 *         if self._extensions is None:
 *             self._extensions = {}
 *         self._extensions[(ns_utf, name_utf)] = function             # <<<<<<<<<<<<<<
 *         return 0
 * 
*/
  if (unlikely(__pyx_v_self->_extensions == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(18, 223, __pyx_L1_error)
  }
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 223, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_ns_utf);
  __Pyx_GIVEREF(__pyx_v_ns_utf);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_ns_utf) != (0)) __PYX_ERR(18, 223, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_name_utf);
  __Pyx_GIVEREF(__pyx_v_name_utf);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_name_utf) != (0)) __PYX_ERR(18, 223, __pyx_L1_error);
  if (unlikely((PyDict_SetItem(__pyx_v_self->_extensions, __pyx_t_2, __pyx_v_function) < 0))) __PYX_ERR(18, 223, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/extensions.pxi":224
 *             self._extensions = {}
 *         self._extensions[(ns_utf, name_utf)] = function
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     cdef registerGlobalFunctions(self, void* ctxt,
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/extensions.pxi":220
 *     # extension functions
 * 
 *     cdef int _addLocalExtensionFunction(self, ns_utf, name_utf, function) except -1:             # <<<<<<<<<<<<<<
 *         if self._extensions is None:
 *             self._extensions = {}
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._BaseContext._addLocalExtensionFunction", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/extensions.pxi":226
 *         return 0
 * 
 *     cdef registerGlobalFunctions(self, void* ctxt,             # <<<<<<<<<<<<<<
 *                                  _register_function reg_func):
 *         cdef python.PyObject* dict_result
*/

static PyObject *__pyx_f_4lxml_5etree_12_BaseContext_registerGlobalFunctions(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, void *__pyx_v_ctxt, __pyx_t_4lxml_5etree__register_function __pyx_v_reg_func) {
  PyObject *__pyx_v_dict_result;
  PyObject *__pyx_v_d = 0;
  PyObject *__pyx_v_ns_utf = NULL;
  PyObject *__pyx_v_ns_functions = NULL;
  PyObject *__pyx_v_name_utf = NULL;
  PyObject *__pyx_v_function = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("registerGlobalFunctions", 0);

  /* "src/lxml/extensions.pxi":230
 *         cdef python.PyObject* dict_result
 *         cdef dict d
 *         for ns_utf, ns_functions in __FUNCTION_NAMESPACE_REGISTRIES.iteritems():             # <<<<<<<<<<<<<<
 *             dict_result = python.PyDict_GetItem(
 *                 self._function_cache, ns_utf)
*/
  __pyx_t_2 = 0;
  if (unlikely(__pyx_v_4lxml_5etree___FUNCTION_NAMESPACE_REGISTRIES == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "iteritems");
    __PYX_ERR(18, 230, __pyx_L1_error)
  }
  __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_4lxml_5etree___FUNCTION_NAMESPACE_REGISTRIES, 1, __pyx_mstate_global->__pyx_n_u_iteritems, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(18, 230, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = __pyx_t_5;
  __pyx_t_5 = 0;
  while (1) {
    __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, &__pyx_t_5, &__pyx_t_6, NULL, __pyx_t_4);
    if (unlikely(__pyx_t_7 == 0)) break;
    if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(18, 230, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF_SET(__pyx_v_ns_utf, __pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_ns_functions, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "src/lxml/extensions.pxi":232
 *         for ns_utf, ns_functions in __FUNCTION_NAMESPACE_REGISTRIES.iteritems():
 *             dict_result = python.PyDict_GetItem(
 *                 self._function_cache, ns_utf)             # <<<<<<<<<<<<<<
 *             if dict_result is not NULL:
 *                 d = <dict>dict_result
*/
    __pyx_t_6 = __pyx_v_self->_function_cache;
    __Pyx_INCREF(__pyx_t_6);

    /* "src/lxml/extensions.pxi":231
 *         cdef dict d
 *         for ns_utf, ns_functions in __FUNCTION_NAMESPACE_REGISTRIES.iteritems():
 *             dict_result = python.PyDict_GetItem(             # <<<<<<<<<<<<<<
 *                 self._function_cache, ns_utf)
 *             if dict_result is not NULL:
*/
    __pyx_v_dict_result = PyDict_GetItem(__pyx_t_6, __pyx_v_ns_utf);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "src/lxml/extensions.pxi":233
 *             dict_result = python.PyDict_GetItem(
 *                 self._function_cache, ns_utf)
 *             if dict_result is not NULL:             # <<<<<<<<<<<<<<
 *                 d = <dict>dict_result
 *             else:
*/
    __pyx_t_8 = (__pyx_v_dict_result != NULL);
    if (__pyx_t_8) {

      /* "src/lxml/extensions.pxi":234
 *                 self._function_cache, ns_utf)
 *             if dict_result is not NULL:
 *                 d = <dict>dict_result             # <<<<<<<<<<<<<<
 *             else:
 *                 d = {}
*/
      __pyx_t_6 = ((PyObject *)__pyx_v_dict_result);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_XDECREF_SET(__pyx_v_d, ((PyObject*)__pyx_t_6));
      __pyx_t_6 = 0;

      /* "src/lxml/extensions.pxi":233
 *             dict_result = python.PyDict_GetItem(
 *                 self._function_cache, ns_utf)
 *             if dict_result is not NULL:             # <<<<<<<<<<<<<<
 *                 d = <dict>dict_result
 *             else:
*/
      goto __pyx_L5;
    }

    /* "src/lxml/extensions.pxi":236
 *                 d = <dict>dict_result
 *             else:
 *                 d = {}             # <<<<<<<<<<<<<<
 *                 self._function_cache[ns_utf] = d
 *             for name_utf, function in ns_functions.iteritems():
*/
    /*else*/ {
      __pyx_t_6 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(18, 236, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_XDECREF_SET(__pyx_v_d, ((PyObject*)__pyx_t_6));
      __pyx_t_6 = 0;

      /* "src/lxml/extensions.pxi":237
 *             else:
 *                 d = {}
 *                 self._function_cache[ns_utf] = d             # <<<<<<<<<<<<<<
 *             for name_utf, function in ns_functions.iteritems():
 *                 d[name_utf] = function
*/
      if (unlikely(__pyx_v_self->_function_cache == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(18, 237, __pyx_L1_error)
      }
      if (unlikely((PyDict_SetItem(__pyx_v_self->_function_cache, __pyx_v_ns_utf, __pyx_v_d) < 0))) __PYX_ERR(18, 237, __pyx_L1_error)
    }
    __pyx_L5:;

    /* "src/lxml/extensions.pxi":238
 *                 d = {}
 *                 self._function_cache[ns_utf] = d
 *             for name_utf, function in ns_functions.iteritems():             # <<<<<<<<<<<<<<
 *                 d[name_utf] = function
 *                 reg_func(ctxt, name_utf, ns_utf)
*/
    __pyx_t_9 = 0;
    if (unlikely(__pyx_v_ns_functions == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "iteritems");
      __PYX_ERR(18, 238, __pyx_L1_error)
    }
    __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_ns_functions, 0, __pyx_mstate_global->__pyx_n_u_iteritems, (&__pyx_t_10), (&__pyx_t_7)); if (unlikely(!__pyx_t_5)) __PYX_ERR(18, 238, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_6);
    __pyx_t_6 = __pyx_t_5;
    __pyx_t_5 = 0;
    while (1) {
      __pyx_t_12 = __Pyx_dict_iter_next(__pyx_t_6, __pyx_t_10, &__pyx_t_9, &__pyx_t_5, &__pyx_t_11, NULL, __pyx_t_7);
      if (unlikely(__pyx_t_12 == 0)) break;
      if (unlikely(__pyx_t_12 == -1)) __PYX_ERR(18, 238, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_XDECREF_SET(__pyx_v_name_utf, __pyx_t_5);
      __pyx_t_5 = 0;
      __Pyx_XDECREF_SET(__pyx_v_function, __pyx_t_11);
      __pyx_t_11 = 0;

      /* "src/lxml/extensions.pxi":239
 *                 self._function_cache[ns_utf] = d
 *             for name_utf, function in ns_functions.iteritems():
 *                 d[name_utf] = function             # <<<<<<<<<<<<<<
 *                 reg_func(ctxt, name_utf, ns_utf)
 * 
*/
      if (unlikely(__pyx_v_d == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(18, 239, __pyx_L1_error)
      }
      if (unlikely((PyDict_SetItem(__pyx_v_d, __pyx_v_name_utf, __pyx_v_function) < 0))) __PYX_ERR(18, 239, __pyx_L1_error)

      /* "src/lxml/extensions.pxi":240
 *             for name_utf, function in ns_functions.iteritems():
 *                 d[name_utf] = function
 *                 reg_func(ctxt, name_utf, ns_utf)             # <<<<<<<<<<<<<<
 * 
 *     cdef registerLocalFunctions(self, void* ctxt,
*/
      __pyx_v_reg_func(__pyx_v_ctxt, __pyx_v_name_utf, __pyx_v_ns_utf); if (unlikely(PyErr_Occurred())) __PYX_ERR(18, 240, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":226
 *         return 0
 * 
 *     cdef registerGlobalFunctions(self, void* ctxt,             # <<<<<<<<<<<<<<
 *                                  _register_function reg_func):
 *         cdef python.PyObject* dict_result
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("lxml.etree._BaseContext.registerGlobalFunctions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_d);
  __Pyx_XDECREF(__pyx_v_ns_utf);
  __Pyx_XDECREF(__pyx_v_ns_functions);
  __Pyx_XDECREF(__pyx_v_name_utf);
  __Pyx_XDECREF(__pyx_v_function);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/extensions.pxi":242
 *                 reg_func(ctxt, name_utf, ns_utf)
 * 
 *     cdef registerLocalFunctions(self, void* ctxt,             # <<<<<<<<<<<<<<
 *                                 _register_function reg_func):
 *         cdef python.PyObject* dict_result
*/

static PyObject *__pyx_f_4lxml_5etree_12_BaseContext_registerLocalFunctions(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, void *__pyx_v_ctxt, __pyx_t_4lxml_5etree__register_function __pyx_v_reg_func) {
  PyObject *__pyx_v_dict_result;
  PyObject *__pyx_v_d = 0;
  PyObject *__pyx_v_last_ns = NULL;
  PyObject *__pyx_v_ns_utf = NULL;
  PyObject *__pyx_v_name_utf = NULL;
  PyObject *__pyx_v_function = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *(*__pyx_t_12)(PyObject *);
  int __pyx_t_13;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("registerLocalFunctions", 0);

  /* "src/lxml/extensions.pxi":246
 *         cdef python.PyObject* dict_result
 *         cdef dict d
 *         if self._extensions is None:             # <<<<<<<<<<<<<<
 *             return # done
 *         last_ns = None
*/
  __pyx_t_1 = (__pyx_v_self->_extensions == ((PyObject*)Py_None));
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":247
 *         cdef dict d
 *         if self._extensions is None:
 *             return # done             # <<<<<<<<<<<<<<
 *         last_ns = None
 *         d = None
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/extensions.pxi":246
 *         cdef python.PyObject* dict_result
 *         cdef dict d
 *         if self._extensions is None:             # <<<<<<<<<<<<<<
 *             return # done
 *         last_ns = None
*/
  }

  /* "src/lxml/extensions.pxi":248
 *         if self._extensions is None:
 *             return # done
 *         last_ns = None             # <<<<<<<<<<<<<<
 *         d = None
 *         for (ns_utf, name_utf), function in self._extensions.iteritems():
*/
  __Pyx_INCREF(Py_None);
  __pyx_v_last_ns = Py_None;

  /* "src/lxml/extensions.pxi":249
 *             return # done
 *         last_ns = None
 *         d = None             # <<<<<<<<<<<<<<
 *         for (ns_utf, name_utf), function in self._extensions.iteritems():
 *             if ns_utf is not last_ns or d is None:
*/
  __Pyx_INCREF(Py_None);
  __pyx_v_d = ((PyObject*)Py_None);

  /* "src/lxml/extensions.pxi":250
 *         last_ns = None
 *         d = None
 *         for (ns_utf, name_utf), function in self._extensions.iteritems():             # <<<<<<<<<<<<<<
 *             if ns_utf is not last_ns or d is None:
 *                 last_ns = ns_utf
*/
  __pyx_t_3 = 0;
  if (unlikely(__pyx_v_self->_extensions == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "iteritems");
    __PYX_ERR(18, 250, __pyx_L1_error)
  }
  __pyx_t_6 = __Pyx_dict_iterator(__pyx_v_self->_extensions, 1, __pyx_mstate_global->__pyx_n_u_iteritems, (&__pyx_t_4), (&__pyx_t_5)); if (unlikely(!__pyx_t_6)) __PYX_ERR(18, 250, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_2);
  __pyx_t_2 = __pyx_t_6;
  __pyx_t_6 = 0;
  while (1) {
    __pyx_t_8 = __Pyx_dict_iter_next(__pyx_t_2, __pyx_t_4, &__pyx_t_3, &__pyx_t_6, &__pyx_t_7, NULL, __pyx_t_5);
    if (unlikely(__pyx_t_8 == 0)) break;
    if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(18, 250, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GOTREF(__pyx_t_7);
    if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) {
      PyObject* sequence = __pyx_t_6;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(18, 250, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0);
        __Pyx_INCREF(__pyx_t_9);
        __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1);
        __Pyx_INCREF(__pyx_t_10);
      } else {
        __pyx_t_9 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_9)) __PYX_ERR(18, 250, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_9);
        __pyx_t_10 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_10)) __PYX_ERR(18, 250, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_10);
      }
      #else
      __pyx_t_9 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(18, 250, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(18, 250, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      #endif
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_11 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_11)) __PYX_ERR(18, 250, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_12 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_11);
      index = 0; __pyx_t_9 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_9)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_9);
      index = 1; __pyx_t_10 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_10)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_10);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 2) < (0)) __PYX_ERR(18, 250, __pyx_L1_error)
      __pyx_t_12 = NULL;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      goto __pyx_L7_unpacking_done;
      __pyx_L6_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_12 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(18, 250, __pyx_L1_error)
      __pyx_L7_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_ns_utf, __pyx_t_9);
    __pyx_t_9 = 0;
    __Pyx_XDECREF_SET(__pyx_v_name_utf, __pyx_t_10);
    __pyx_t_10 = 0;
    __Pyx_XDECREF_SET(__pyx_v_function, __pyx_t_7);
    __pyx_t_7 = 0;

    /* "src/lxml/extensions.pxi":251
 *         d = None
 *         for (ns_utf, name_utf), function in self._extensions.iteritems():
 *             if ns_utf is not last_ns or d is None:             # <<<<<<<<<<<<<<
 *                 last_ns = ns_utf
 *                 dict_result = python.PyDict_GetItem(
*/
    __pyx_t_13 = (__pyx_v_ns_utf != __pyx_v_last_ns);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_1 = __pyx_t_13;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_13 = (__pyx_v_d == ((PyObject*)Py_None));
    __pyx_t_1 = __pyx_t_13;
    __pyx_L9_bool_binop_done:;
    if (__pyx_t_1) {

      /* "src/lxml/extensions.pxi":252
 *         for (ns_utf, name_utf), function in self._extensions.iteritems():
 *             if ns_utf is not last_ns or d is None:
 *                 last_ns = ns_utf             # <<<<<<<<<<<<<<
 *                 dict_result = python.PyDict_GetItem(
 *                     self._function_cache, ns_utf)
*/
      __Pyx_INCREF(__pyx_v_ns_utf);
      __Pyx_DECREF_SET(__pyx_v_last_ns, __pyx_v_ns_utf);

      /* "src/lxml/extensions.pxi":254
 *                 last_ns = ns_utf
 *                 dict_result = python.PyDict_GetItem(
 *                     self._function_cache, ns_utf)             # <<<<<<<<<<<<<<
 *                 if dict_result is not NULL:
 *                     d = <dict>dict_result
*/
      __pyx_t_7 = __pyx_v_self->_function_cache;
      __Pyx_INCREF(__pyx_t_7);

      /* "src/lxml/extensions.pxi":253
 *             if ns_utf is not last_ns or d is None:
 *                 last_ns = ns_utf
 *                 dict_result = python.PyDict_GetItem(             # <<<<<<<<<<<<<<
 *                     self._function_cache, ns_utf)
 *                 if dict_result is not NULL:
*/
      __pyx_v_dict_result = PyDict_GetItem(__pyx_t_7, __pyx_v_ns_utf);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "src/lxml/extensions.pxi":255
 *                 dict_result = python.PyDict_GetItem(
 *                     self._function_cache, ns_utf)
 *                 if dict_result is not NULL:             # <<<<<<<<<<<<<<
 *                     d = <dict>dict_result
 *                 else:
*/
      __pyx_t_1 = (__pyx_v_dict_result != NULL);
      if (__pyx_t_1) {

        /* "src/lxml/extensions.pxi":256
 *                     self._function_cache, ns_utf)
 *                 if dict_result is not NULL:
 *                     d = <dict>dict_result             # <<<<<<<<<<<<<<
 *                 else:
 *                     d = {}
*/
        __pyx_t_7 = ((PyObject *)__pyx_v_dict_result);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_DECREF_SET(__pyx_v_d, ((PyObject*)__pyx_t_7));
        __pyx_t_7 = 0;

        /* "src/lxml/extensions.pxi":255
 *                 dict_result = python.PyDict_GetItem(
 *                     self._function_cache, ns_utf)
 *                 if dict_result is not NULL:             # <<<<<<<<<<<<<<
 *                     d = <dict>dict_result
 *                 else:
*/
        goto __pyx_L11;
      }

      /* "src/lxml/extensions.pxi":258
 *                     d = <dict>dict_result
 *                 else:
 *                     d = {}             # <<<<<<<<<<<<<<
 *                     self._function_cache[ns_utf] = d
 *             d[name_utf] = function
*/
      /*else*/ {
        __pyx_t_7 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(18, 258, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF_SET(__pyx_v_d, ((PyObject*)__pyx_t_7));
        __pyx_t_7 = 0;

        /* "src/lxml/extensions.pxi":259
 *                 else:
 *                     d = {}
 *                     self._function_cache[ns_utf] = d             # <<<<<<<<<<<<<<
 *             d[name_utf] = function
 *             reg_func(ctxt, name_utf, ns_utf)
*/
        if (unlikely(__pyx_v_self->_function_cache == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(18, 259, __pyx_L1_error)
        }
        if (unlikely((PyDict_SetItem(__pyx_v_self->_function_cache, __pyx_v_ns_utf, __pyx_v_d) < 0))) __PYX_ERR(18, 259, __pyx_L1_error)
      }
      __pyx_L11:;

      /* "src/lxml/extensions.pxi":251
 *         d = None
 *         for (ns_utf, name_utf), function in self._extensions.iteritems():
 *             if ns_utf is not last_ns or d is None:             # <<<<<<<<<<<<<<
 *                 last_ns = ns_utf
 *                 dict_result = python.PyDict_GetItem(
*/
    }

    /* "src/lxml/extensions.pxi":260
 *                     d = {}
 *                     self._function_cache[ns_utf] = d
 *             d[name_utf] = function             # <<<<<<<<<<<<<<
 *             reg_func(ctxt, name_utf, ns_utf)
 * 
*/
    if (unlikely(__pyx_v_d == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(18, 260, __pyx_L1_error)
    }
    if (unlikely((PyDict_SetItem(__pyx_v_d, __pyx_v_name_utf, __pyx_v_function) < 0))) __PYX_ERR(18, 260, __pyx_L1_error)

    /* "src/lxml/extensions.pxi":261
 *                     self._function_cache[ns_utf] = d
 *             d[name_utf] = function
 *             reg_func(ctxt, name_utf, ns_utf)             # <<<<<<<<<<<<<<
 * 
 *     cdef unregisterAllFunctions(self, void* ctxt,
*/
    __pyx_v_reg_func(__pyx_v_ctxt, __pyx_v_name_utf, __pyx_v_ns_utf); if (unlikely(PyErr_Occurred())) __PYX_ERR(18, 261, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/extensions.pxi":242
 *                 reg_func(ctxt, name_utf, ns_utf)
 * 
 *     cdef registerLocalFunctions(self, void* ctxt,             # <<<<<<<<<<<<<<
 *                                 _register_function reg_func):
 *         cdef python.PyObject* dict_result
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("lxml.etree._BaseContext.registerLocalFunctions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_d);
  __Pyx_XDECREF(__pyx_v_last_ns);
  __Pyx_XDECREF(__pyx_v_ns_utf);
  __Pyx_XDECREF(__pyx_v_name_utf);
  __Pyx_XDECREF(__pyx_v_function);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/extensions.pxi":263
 *             reg_func(ctxt, name_utf, ns_utf)
 * 
 *     cdef unregisterAllFunctions(self, void* ctxt,             # <<<<<<<<<<<<<<
 *                                       _register_function unreg_func):
 *         for ns_utf, functions in self._function_cache.iteritems():
*/

static PyObject *__pyx_f_4lxml_5etree_12_BaseContext_unregisterAllFunctions(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, void *__pyx_v_ctxt, __pyx_t_4lxml_5etree__register_function __pyx_v_unreg_func) {
  PyObject *__pyx_v_ns_utf = NULL;
  PyObject *__pyx_v_functions = NULL;
  PyObject *__pyx_v_name_utf = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  PyObject *(*__pyx_t_9)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("unregisterAllFunctions", 0);

  /* "src/lxml/extensions.pxi":265
 *     cdef unregisterAllFunctions(self, void* ctxt,
 *                                       _register_function unreg_func):
 *         for ns_utf, functions in self._function_cache.iteritems():             # <<<<<<<<<<<<<<
 *             for name_utf in functions:
 *                 unreg_func(ctxt, name_utf, ns_utf)
*/
  __pyx_t_2 = 0;
  if (unlikely(__pyx_v_self->_function_cache == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "iteritems");
    __PYX_ERR(18, 265, __pyx_L1_error)
  }
  __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_self->_function_cache, 1, __pyx_mstate_global->__pyx_n_u_iteritems, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(18, 265, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = __pyx_t_5;
  __pyx_t_5 = 0;
  while (1) {
    __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, &__pyx_t_5, &__pyx_t_6, NULL, __pyx_t_4);
    if (unlikely(__pyx_t_7 == 0)) break;
    if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(18, 265, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF_SET(__pyx_v_ns_utf, __pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_functions, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "src/lxml/extensions.pxi":266
 *                                       _register_function unreg_func):
 *         for ns_utf, functions in self._function_cache.iteritems():
 *             for name_utf in functions:             # <<<<<<<<<<<<<<
 *                 unreg_func(ctxt, name_utf, ns_utf)
 * 
*/
    if (likely(PyList_CheckExact(__pyx_v_functions)) || PyTuple_CheckExact(__pyx_v_functions)) {
      __pyx_t_6 = __pyx_v_functions; __Pyx_INCREF(__pyx_t_6);
      __pyx_t_8 = 0;
      __pyx_t_9 = NULL;
    } else {
      __pyx_t_8 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_functions); if (unlikely(!__pyx_t_6)) __PYX_ERR(18, 266, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_9 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(18, 266, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_9)) {
        if (likely(PyList_CheckExact(__pyx_t_6))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_6);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(18, 266, __pyx_L1_error)
            #endif
            if (__pyx_t_8 >= __pyx_temp) break;
          }
          __pyx_t_5 = __Pyx_PyList_GetItemRefFast(__pyx_t_6, __pyx_t_8, __Pyx_ReferenceSharing_OwnStrongReference);
          ++__pyx_t_8;
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_6);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(18, 266, __pyx_L1_error)
            #endif
            if (__pyx_t_8 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_8));
          #else
          __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_8);
          #endif
          ++__pyx_t_8;
        }
        if (unlikely(!__pyx_t_5)) __PYX_ERR(18, 266, __pyx_L1_error)
      } else {
        __pyx_t_5 = __pyx_t_9(__pyx_t_6);
        if (unlikely(!__pyx_t_5)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(18, 266, __pyx_L1_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_XDECREF_SET(__pyx_v_name_utf, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "src/lxml/extensions.pxi":267
 *         for ns_utf, functions in self._function_cache.iteritems():
 *             for name_utf in functions:
 *                 unreg_func(ctxt, name_utf, ns_utf)             # <<<<<<<<<<<<<<
 * 
 *     cdef unregisterGlobalFunctions(self, void* ctxt,
*/
      __pyx_v_unreg_func(__pyx_v_ctxt, __pyx_v_name_utf, __pyx_v_ns_utf); if (unlikely(PyErr_Occurred())) __PYX_ERR(18, 267, __pyx_L1_error)

      /* "src/lxml/extensions.pxi":266
 *                                       _register_function unreg_func):
 *         for ns_utf, functions in self._function_cache.iteritems():
 *             for name_utf in functions:             # <<<<<<<<<<<<<<
 *                 unreg_func(ctxt, name_utf, ns_utf)
 * 
*/
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":263
 *             reg_func(ctxt, name_utf, ns_utf)
 * 
 *     cdef unregisterAllFunctions(self, void* ctxt,             # <<<<<<<<<<<<<<
 *                                       _register_function unreg_func):
 *         for ns_utf, functions in self._function_cache.iteritems():
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._BaseContext.unregisterAllFunctions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ns_utf);
  __Pyx_XDECREF(__pyx_v_functions);
  __Pyx_XDECREF(__pyx_v_name_utf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/extensions.pxi":269
 *                 unreg_func(ctxt, name_utf, ns_utf)
 * 
 *     cdef unregisterGlobalFunctions(self, void* ctxt,             # <<<<<<<<<<<<<<
 *                                          _register_function unreg_func):
 *         for ns_utf, functions in self._function_cache.items():
*/

static PyObject *__pyx_f_4lxml_5etree_12_BaseContext_unregisterGlobalFunctions(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, void *__pyx_v_ctxt, __pyx_t_4lxml_5etree__register_function __pyx_v_unreg_func) {
  PyObject *__pyx_v_ns_utf = NULL;
  PyObject *__pyx_v_functions = NULL;
  PyObject *__pyx_v_name_utf = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  PyObject *(*__pyx_t_9)(PyObject *);
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("unregisterGlobalFunctions", 0);

  /* "src/lxml/extensions.pxi":271
 *     cdef unregisterGlobalFunctions(self, void* ctxt,
 *                                          _register_function unreg_func):
 *         for ns_utf, functions in self._function_cache.items():             # <<<<<<<<<<<<<<
 *             for name_utf in functions:
 *                 if self._extensions is None or \
*/
  __pyx_t_2 = 0;
  if (unlikely(__pyx_v_self->_function_cache == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
    __PYX_ERR(18, 271, __pyx_L1_error)
  }
  __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_self->_function_cache, 1, __pyx_mstate_global->__pyx_n_u_items, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(18, 271, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = __pyx_t_5;
  __pyx_t_5 = 0;
  while (1) {
    __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, &__pyx_t_5, &__pyx_t_6, NULL, __pyx_t_4);
    if (unlikely(__pyx_t_7 == 0)) break;
    if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(18, 271, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF_SET(__pyx_v_ns_utf, __pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_functions, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "src/lxml/extensions.pxi":272
 *                                          _register_function unreg_func):
 *         for ns_utf, functions in self._function_cache.items():
 *             for name_utf in functions:             # <<<<<<<<<<<<<<
 *                 if self._extensions is None or \
 *                        (ns_utf, name_utf) not in self._extensions:
*/
    if (likely(PyList_CheckExact(__pyx_v_functions)) || PyTuple_CheckExact(__pyx_v_functions)) {
      __pyx_t_6 = __pyx_v_functions; __Pyx_INCREF(__pyx_t_6);
      __pyx_t_8 = 0;
      __pyx_t_9 = NULL;
    } else {
      __pyx_t_8 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_functions); if (unlikely(!__pyx_t_6)) __PYX_ERR(18, 272, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_9 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(18, 272, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_9)) {
        if (likely(PyList_CheckExact(__pyx_t_6))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_6);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(18, 272, __pyx_L1_error)
            #endif
            if (__pyx_t_8 >= __pyx_temp) break;
          }
          __pyx_t_5 = __Pyx_PyList_GetItemRefFast(__pyx_t_6, __pyx_t_8, __Pyx_ReferenceSharing_OwnStrongReference);
          ++__pyx_t_8;
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_6);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(18, 272, __pyx_L1_error)
            #endif
            if (__pyx_t_8 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_8));
          #else
          __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_8);
          #endif
          ++__pyx_t_8;
        }
        if (unlikely(!__pyx_t_5)) __PYX_ERR(18, 272, __pyx_L1_error)
      } else {
        __pyx_t_5 = __pyx_t_9(__pyx_t_6);
        if (unlikely(!__pyx_t_5)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(18, 272, __pyx_L1_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_XDECREF_SET(__pyx_v_name_utf, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "src/lxml/extensions.pxi":273
 *         for ns_utf, functions in self._function_cache.items():
 *             for name_utf in functions:
 *                 if self._extensions is None or \             # <<<<<<<<<<<<<<
 *                        (ns_utf, name_utf) not in self._extensions:
 *                     unreg_func(ctxt, name_utf, ns_utf)
*/
      __pyx_t_11 = (__pyx_v_self->_extensions == ((PyObject*)Py_None));
      if (!__pyx_t_11) {
      } else {
        __pyx_t_10 = __pyx_t_11;
        goto __pyx_L8_bool_binop_done;
      }

      /* "src/lxml/extensions.pxi":274
 *             for name_utf in functions:
 *                 if self._extensions is None or \
 *                        (ns_utf, name_utf) not in self._extensions:             # <<<<<<<<<<<<<<
 *                     unreg_func(ctxt, name_utf, ns_utf)
 * 
*/
      __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(18, 274, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_v_ns_utf);
      __Pyx_GIVEREF(__pyx_v_ns_utf);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_ns_utf) != (0)) __PYX_ERR(18, 274, __pyx_L1_error);
      __Pyx_INCREF(__pyx_v_name_utf);
      __Pyx_GIVEREF(__pyx_v_name_utf);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_name_utf) != (0)) __PYX_ERR(18, 274, __pyx_L1_error);
      if (unlikely(__pyx_v_self->_extensions == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
        __PYX_ERR(18, 274, __pyx_L1_error)
      }
      __pyx_t_11 = (__Pyx_PyDict_ContainsTF(__pyx_t_5, __pyx_v_self->_extensions, Py_NE)); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(18, 274, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_10 = __pyx_t_11;
      __pyx_L8_bool_binop_done:;

      /* "src/lxml/extensions.pxi":273
 *         for ns_utf, functions in self._function_cache.items():
 *             for name_utf in functions:
 *                 if self._extensions is None or \             # <<<<<<<<<<<<<<
 *                        (ns_utf, name_utf) not in self._extensions:
 *                     unreg_func(ctxt, name_utf, ns_utf)
*/
      if (__pyx_t_10) {

        /* "src/lxml/extensions.pxi":275
 *                 if self._extensions is None or \
 *                        (ns_utf, name_utf) not in self._extensions:
 *                     unreg_func(ctxt, name_utf, ns_utf)             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
*/
        __pyx_v_unreg_func(__pyx_v_ctxt, __pyx_v_name_utf, __pyx_v_ns_utf); if (unlikely(PyErr_Occurred())) __PYX_ERR(18, 275, __pyx_L1_error)

        /* "src/lxml/extensions.pxi":273
 *         for ns_utf, functions in self._function_cache.items():
 *             for name_utf in functions:
 *                 if self._extensions is None or \             # <<<<<<<<<<<<<<
 *                        (ns_utf, name_utf) not in self._extensions:
 *                     unreg_func(ctxt, name_utf, ns_utf)
*/
      }

      /* "src/lxml/extensions.pxi":272
 *                                          _register_function unreg_func):
 *         for ns_utf, functions in self._function_cache.items():
 *             for name_utf in functions:             # <<<<<<<<<<<<<<
 *                 if self._extensions is None or \
 *                        (ns_utf, name_utf) not in self._extensions:
*/
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":269
 *                 unreg_func(ctxt, name_utf, ns_utf)
 * 
 *     cdef unregisterGlobalFunctions(self, void* ctxt,             # <<<<<<<<<<<<<<
 *                                          _register_function unreg_func):
 *         for ns_utf, functions in self._function_cache.items():
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._BaseContext.unregisterGlobalFunctions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ns_utf);
  __Pyx_XDECREF(__pyx_v_functions);
  __Pyx_XDECREF(__pyx_v_name_utf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/extensions.pxi":277
 *                     unreg_func(ctxt, name_utf, ns_utf)
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef _find_cached_function(self, const_xmlChar* c_ns_uri, const_xmlChar* c_name):
 *         """Lookup an extension function in the cache and return it.
*/

static PyObject *__pyx_f_4lxml_5etree_12_BaseContext__find_cached_function(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, const xmlChar *__pyx_v_c_ns_uri, const xmlChar *__pyx_v_c_name) {
  PyObject *__pyx_v_c_dict;
  PyObject *__pyx_v_dict_result;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_find_cached_function", 0);

  /* "src/lxml/extensions.pxi":286
 *         cdef python.PyObject* dict_result
 *         c_dict = python.PyDict_GetItem(
 *             self._function_cache, None if c_ns_uri is NULL else c_ns_uri)             # <<<<<<<<<<<<<<
 *         if c_dict is not NULL:
 *             dict_result = python.PyDict_GetItem(
*/
  __pyx_t_1 = __pyx_v_self->_function_cache;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_3 = (__pyx_v_c_ns_uri == NULL);
  if (__pyx_t_3) {
    __Pyx_INCREF(Py_None);
    __pyx_t_2 = Py_None;
  } else {
    __pyx_t_4 = __Pyx_PyBytes_FromCString(__pyx_v_c_ns_uri); if (unlikely(!__pyx_t_4)) __PYX_ERR(18, 286, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = __pyx_t_4;
    __pyx_t_4 = 0;
  }

  /* "src/lxml/extensions.pxi":285
 *         cdef python.PyObject* c_dict
 *         cdef python.PyObject* dict_result
 *         c_dict = python.PyDict_GetItem(             # <<<<<<<<<<<<<<
 *             self._function_cache, None if c_ns_uri is NULL else c_ns_uri)
 *         if c_dict is not NULL:
*/
  __pyx_v_c_dict = PyDict_GetItem(__pyx_t_1, __pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/extensions.pxi":287
 *         c_dict = python.PyDict_GetItem(
 *             self._function_cache, None if c_ns_uri is NULL else c_ns_uri)
 *         if c_dict is not NULL:             # <<<<<<<<<<<<<<
 *             dict_result = python.PyDict_GetItem(
 *                 <object>c_dict, <unsigned char*>c_name)
*/
  __pyx_t_3 = (__pyx_v_c_dict != NULL);
  if (__pyx_t_3) {

    /* "src/lxml/extensions.pxi":289
 *         if c_dict is not NULL:
 *             dict_result = python.PyDict_GetItem(
 *                 <object>c_dict, <unsigned char*>c_name)             # <<<<<<<<<<<<<<
 *             if dict_result is not NULL:
 *                 return <object>dict_result
*/
    __pyx_t_2 = __Pyx_PyBytes_FromCString(((unsigned char *)__pyx_v_c_name)); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 289, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);

    /* "src/lxml/extensions.pxi":288
 *             self._function_cache, None if c_ns_uri is NULL else c_ns_uri)
 *         if c_dict is not NULL:
 *             dict_result = python.PyDict_GetItem(             # <<<<<<<<<<<<<<
 *                 <object>c_dict, <unsigned char*>c_name)
 *             if dict_result is not NULL:
*/
    __pyx_v_dict_result = PyDict_GetItem(((PyObject *)__pyx_v_c_dict), __pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/extensions.pxi":290
 *             dict_result = python.PyDict_GetItem(
 *                 <object>c_dict, <unsigned char*>c_name)
 *             if dict_result is not NULL:             # <<<<<<<<<<<<<<
 *                 return <object>dict_result
 *         return None
*/
    __pyx_t_3 = (__pyx_v_dict_result != NULL);
    if (__pyx_t_3) {

      /* "src/lxml/extensions.pxi":291
 *                 <object>c_dict, <unsigned char*>c_name)
 *             if dict_result is not NULL:
 *                 return <object>dict_result             # <<<<<<<<<<<<<<
 *         return None
 * 
*/
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_dict_result));
      __pyx_r = ((PyObject *)__pyx_v_dict_result);
      goto __pyx_L0;

      /* "src/lxml/extensions.pxi":290
 *             dict_result = python.PyDict_GetItem(
 *                 <object>c_dict, <unsigned char*>c_name)
 *             if dict_result is not NULL:             # <<<<<<<<<<<<<<
 *                 return <object>dict_result
 *         return None
*/
    }

    /* "src/lxml/extensions.pxi":287
 *         c_dict = python.PyDict_GetItem(
 *             self._function_cache, None if c_ns_uri is NULL else c_ns_uri)
 *         if c_dict is not NULL:             # <<<<<<<<<<<<<<
 *             dict_result = python.PyDict_GetItem(
 *                 <object>c_dict, <unsigned char*>c_name)
*/
  }

  /* "src/lxml/extensions.pxi":292
 *             if dict_result is not NULL:
 *                 return <object>dict_result
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     # Python access to the XPath context for extension functions
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "src/lxml/extensions.pxi":277
 *                     unreg_func(ctxt, name_utf, ns_utf)
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef _find_cached_function(self, const_xmlChar* c_ns_uri, const_xmlChar* c_name):
 *         """Lookup an extension function in the cache and return it.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._BaseContext._find_cached_function", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/extensions.pxi":296
 *     # Python access to the XPath context for extension functions
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def context_node(self):
 *         cdef xmlNode* c_node
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_BaseContext_12context_node_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_12_BaseContext_12context_node_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_12_BaseContext_12context_node___get__(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_12_BaseContext_12context_node___get__(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self) {
  xmlNode *__pyx_v_c_node;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  xmlNode *__pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "src/lxml/extensions.pxi":299
 *     def context_node(self):
 *         cdef xmlNode* c_node
 *         if self._xpathCtxt is NULL:             # <<<<<<<<<<<<<<
 *             raise XPathError, \
 *                 "XPath context is only usable during the evaluation"
*/
  __pyx_t_1 = (__pyx_v_self->_xpathCtxt == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/extensions.pxi":300
 *         cdef xmlNode* c_node
 *         if self._xpathCtxt is NULL:
 *             raise XPathError, \             # <<<<<<<<<<<<<<
 *                 "XPath context is only usable during the evaluation"
 *         c_node = self._xpathCtxt.node
*/
    __Pyx_Raise(((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XPathError), __pyx_mstate_global->__pyx_kp_u_XPath_context_is_only_usable_dur, 0, 0);
    __PYX_ERR(18, 300, __pyx_L1_error)

    /* "src/lxml/extensions.pxi":299
 *     def context_node(self):
 *         cdef xmlNode* c_node
 *         if self._xpathCtxt is NULL:             # <<<<<<<<<<<<<<
 *             raise XPathError, \
 *                 "XPath context is only usable during the evaluation"
*/
  }

  /* "src/lxml/extensions.pxi":302
 *             raise XPathError, \
 *                 "XPath context is only usable during the evaluation"
 *         c_node = self._xpathCtxt.node             # <<<<<<<<<<<<<<
 *         if c_node is NULL:
 *             raise XPathError, "no context node"
*/
  __pyx_t_2 = __pyx_v_self->_xpathCtxt->node;
  __pyx_v_c_node = __pyx_t_2;

  /* "src/lxml/extensions.pxi":303
 *                 "XPath context is only usable during the evaluation"
 *         c_node = self._xpathCtxt.node
 *         if c_node is NULL:             # <<<<<<<<<<<<<<
 *             raise XPathError, "no context node"
 *         if c_node.doc != self._xpathCtxt.doc:
*/
  __pyx_t_1 = (__pyx_v_c_node == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/extensions.pxi":304
 *         c_node = self._xpathCtxt.node
 *         if c_node is NULL:
 *             raise XPathError, "no context node"             # <<<<<<<<<<<<<<
 *         if c_node.doc != self._xpathCtxt.doc:
 *             raise XPathError, \
*/
    __Pyx_Raise(((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XPathError), __pyx_mstate_global->__pyx_kp_u_no_context_node, 0, 0);
    __PYX_ERR(18, 304, __pyx_L1_error)

    /* "src/lxml/extensions.pxi":303
 *                 "XPath context is only usable during the evaluation"
 *         c_node = self._xpathCtxt.node
 *         if c_node is NULL:             # <<<<<<<<<<<<<<
 *             raise XPathError, "no context node"
 *         if c_node.doc != self._xpathCtxt.doc:
*/
  }

  /* "src/lxml/extensions.pxi":305
 *         if c_node is NULL:
 *             raise XPathError, "no context node"
 *         if c_node.doc != self._xpathCtxt.doc:             # <<<<<<<<<<<<<<
 *             raise XPathError, \
 *                 "document-external context nodes are not supported"
*/
  __pyx_t_1 = (__pyx_v_c_node->doc != __pyx_v_self->_xpathCtxt->doc);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/extensions.pxi":306
 *             raise XPathError, "no context node"
 *         if c_node.doc != self._xpathCtxt.doc:
 *             raise XPathError, \             # <<<<<<<<<<<<<<
 *                 "document-external context nodes are not supported"
 *         if self._doc is None:
*/
    __Pyx_Raise(((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XPathError), __pyx_mstate_global->__pyx_kp_u_document_external_context_nodes, 0, 0);
    __PYX_ERR(18, 306, __pyx_L1_error)

    /* "src/lxml/extensions.pxi":305
 *         if c_node is NULL:
 *             raise XPathError, "no context node"
 *         if c_node.doc != self._xpathCtxt.doc:             # <<<<<<<<<<<<<<
 *             raise XPathError, \
 *                 "document-external context nodes are not supported"
*/
  }

  /* "src/lxml/extensions.pxi":308
 *             raise XPathError, \
 *                 "document-external context nodes are not supported"
 *         if self._doc is None:             # <<<<<<<<<<<<<<
 *             raise XPathError, "document context is missing"
 *         return _elementFactory(self._doc, c_node)
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_self->_doc) == Py_None);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/extensions.pxi":309
 *                 "document-external context nodes are not supported"
 *         if self._doc is None:
 *             raise XPathError, "document context is missing"             # <<<<<<<<<<<<<<
 *         return _elementFactory(self._doc, c_node)
 * 
*/
    __Pyx_Raise(((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XPathError), __pyx_mstate_global->__pyx_kp_u_document_context_is_missing, 0, 0);
    __PYX_ERR(18, 309, __pyx_L1_error)

    /* "src/lxml/extensions.pxi":308
 *             raise XPathError, \
 *                 "document-external context nodes are not supported"
 *         if self._doc is None:             # <<<<<<<<<<<<<<
 *             raise XPathError, "document context is missing"
 *         return _elementFactory(self._doc, c_node)
*/
  }

  /* "src/lxml/extensions.pxi":310
 *         if self._doc is None:
 *             raise XPathError, "document context is missing"
 *         return _elementFactory(self._doc, c_node)             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_v_self->_doc);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_3), __pyx_v_c_node)); if (unlikely(!__pyx_t_4)) __PYX_ERR(18, 310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "src/lxml/extensions.pxi":296
 *     # Python access to the XPath context for extension functions
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def context_node(self):
 *         cdef xmlNode* c_node
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._BaseContext.context_node.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/extensions.pxi":312
 *         return _elementFactory(self._doc, c_node)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def eval_context(self):
 *         if self._eval_context_dict is None:
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_BaseContext_12eval_context_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_12_BaseContext_12eval_context_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_12_BaseContext_12eval_context___get__(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_12_BaseContext_12eval_context___get__(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "src/lxml/extensions.pxi":314
 *     @property
 *     def eval_context(self):
 *         if self._eval_context_dict is None:             # <<<<<<<<<<<<<<
 *             self._eval_context_dict = {}
 *         return self._eval_context_dict
*/
  __pyx_t_1 = (__pyx_v_self->_eval_context_dict == ((PyObject*)Py_None));
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":315
 *     def eval_context(self):
 *         if self._eval_context_dict is None:
 *             self._eval_context_dict = {}             # <<<<<<<<<<<<<<
 *         return self._eval_context_dict
 * 
*/
    __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 315, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_GOTREF(__pyx_v_self->_eval_context_dict);
    __Pyx_DECREF(__pyx_v_self->_eval_context_dict);
    __pyx_v_self->_eval_context_dict = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/extensions.pxi":314
 *     @property
 *     def eval_context(self):
 *         if self._eval_context_dict is None:             # <<<<<<<<<<<<<<
 *             self._eval_context_dict = {}
 *         return self._eval_context_dict
*/
  }

  /* "src/lxml/extensions.pxi":316
 *         if self._eval_context_dict is None:
 *             self._eval_context_dict = {}
 *         return self._eval_context_dict             # <<<<<<<<<<<<<<
 * 
 *     # Python reference keeping during XPath function evaluation
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_eval_context_dict);
  __pyx_r = __pyx_v_self->_eval_context_dict;
  goto __pyx_L0;

  /* "src/lxml/extensions.pxi":312
 *         return _elementFactory(self._doc, c_node)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def eval_context(self):
 *         if self._eval_context_dict is None:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._BaseContext.eval_context.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/extensions.pxi":320
 *     # Python reference keeping during XPath function evaluation
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef _release_temp_refs(self):
 *         "Free temporarily referenced objects from this context."
*/

static PyObject *__pyx_f_4lxml_5etree_12_BaseContext__release_temp_refs(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_release_temp_refs", 0);

  /* "src/lxml/extensions.pxi":323
 *     cdef _release_temp_refs(self):
 *         "Free temporarily referenced objects from this context."
 *         self._temp_refs.clear()             # <<<<<<<<<<<<<<
 *         self._temp_documents.clear()
 * 
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_10_TempStore_clear(__pyx_v_self->_temp_refs); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(18, 323, __pyx_L1_error)

  /* "src/lxml/extensions.pxi":324
 *         "Free temporarily referenced objects from this context."
 *         self._temp_refs.clear()
 *         self._temp_documents.clear()             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
*/
  if (unlikely(__pyx_v_self->_temp_documents == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "clear");
    __PYX_ERR(18, 324, __pyx_L1_error)
  }
  __pyx_t_2 = PySet_Clear(__pyx_v_self->_temp_documents); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(18, 324, __pyx_L1_error)

  /* "src/lxml/extensions.pxi":320
 *     # Python reference keeping during XPath function evaluation
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef _release_temp_refs(self):
 *         "Free temporarily referenced objects from this context."
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._BaseContext._release_temp_refs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/extensions.pxi":326
 *         self._temp_documents.clear()
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef _hold(self, obj):
 *         """A way to temporarily hold references to nodes in the evaluator.
*/

static PyObject *__pyx_f_4lxml_5etree_12_BaseContext__hold(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, PyObject *__pyx_v_obj) {
  PyObject *__pyx_v_o = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_hold", 0);

  /* "src/lxml/extensions.pxi":335
 *         """
 *         cdef _Element element
 *         if isinstance(obj, _Element):             # <<<<<<<<<<<<<<
 *             self._temp_refs.add(obj)
 *             self._temp_documents.add((<_Element>obj)._doc)
*/
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element); 
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":336
 *         cdef _Element element
 *         if isinstance(obj, _Element):
 *             self._temp_refs.add(obj)             # <<<<<<<<<<<<<<
 *             self._temp_documents.add((<_Element>obj)._doc)
 *             return
*/
    __pyx_t_2 = __pyx_f_4lxml_5etree_10_TempStore_add(__pyx_v_self->_temp_refs, __pyx_v_obj); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(18, 336, __pyx_L1_error)

    /* "src/lxml/extensions.pxi":337
 *         if isinstance(obj, _Element):
 *             self._temp_refs.add(obj)
 *             self._temp_documents.add((<_Element>obj)._doc)             # <<<<<<<<<<<<<<
 *             return
 *         elif _isString(obj) or not python.PySequence_Check(obj):
*/
    if (unlikely(__pyx_v_self->_temp_documents == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "add");
      __PYX_ERR(18, 337, __pyx_L1_error)
    }
    __pyx_t_3 = ((PyObject *)((struct LxmlElement *)__pyx_v_obj)->_doc);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = PySet_Add(__pyx_v_self->_temp_documents, __pyx_t_3); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(18, 337, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/extensions.pxi":338
 *             self._temp_refs.add(obj)
 *             self._temp_documents.add((<_Element>obj)._doc)
 *             return             # <<<<<<<<<<<<<<
 *         elif _isString(obj) or not python.PySequence_Check(obj):
 *             return
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/extensions.pxi":335
 *         """
 *         cdef _Element element
 *         if isinstance(obj, _Element):             # <<<<<<<<<<<<<<
 *             self._temp_refs.add(obj)
 *             self._temp_documents.add((<_Element>obj)._doc)
*/
  }

  /* "src/lxml/extensions.pxi":339
 *             self._temp_documents.add((<_Element>obj)._doc)
 *             return
 *         elif _isString(obj) or not python.PySequence_Check(obj):             # <<<<<<<<<<<<<<
 *             return
 *         for o in obj:
*/
  __pyx_t_5 = _isString(__pyx_v_obj);
  if (!__pyx_t_5) {
  } else {
    __pyx_t_1 = __pyx_t_5;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_5 = (!PySequence_Check(__pyx_v_obj));
  __pyx_t_1 = __pyx_t_5;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":340
 *             return
 *         elif _isString(obj) or not python.PySequence_Check(obj):
 *             return             # <<<<<<<<<<<<<<
 *         for o in obj:
 *             if isinstance(o, _Element):
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/extensions.pxi":339
 *             self._temp_documents.add((<_Element>obj)._doc)
 *             return
 *         elif _isString(obj) or not python.PySequence_Check(obj):             # <<<<<<<<<<<<<<
 *             return
 *         for o in obj:
*/
  }

  /* "src/lxml/extensions.pxi":341
 *         elif _isString(obj) or not python.PySequence_Check(obj):
 *             return
 *         for o in obj:             # <<<<<<<<<<<<<<
 *             if isinstance(o, _Element):
 *                 #print "Holding element:", <int>element._c_node
*/
  if (likely(PyList_CheckExact(__pyx_v_obj)) || PyTuple_CheckExact(__pyx_v_obj)) {
    __pyx_t_3 = __pyx_v_obj; __Pyx_INCREF(__pyx_t_3);
    __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
  } else {
    __pyx_t_6 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_obj); if (unlikely(!__pyx_t_3)) __PYX_ERR(18, 341, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(18, 341, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_7)) {
      if (likely(PyList_CheckExact(__pyx_t_3))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(18, 341, __pyx_L1_error)
          #endif
          if (__pyx_t_6 >= __pyx_temp) break;
        }
        __pyx_t_8 = __Pyx_PyList_GetItemRefFast(__pyx_t_3, __pyx_t_6, __Pyx_ReferenceSharing_OwnStrongReference);
        ++__pyx_t_6;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(18, 341, __pyx_L1_error)
          #endif
          if (__pyx_t_6 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_8 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_6));
        #else
        __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_6);
        #endif
        ++__pyx_t_6;
      }
      if (unlikely(!__pyx_t_8)) __PYX_ERR(18, 341, __pyx_L1_error)
    } else {
      __pyx_t_8 = __pyx_t_7(__pyx_t_3);
      if (unlikely(!__pyx_t_8)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(18, 341, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_XDECREF_SET(__pyx_v_o, __pyx_t_8);
    __pyx_t_8 = 0;

    /* "src/lxml/extensions.pxi":342
 *             return
 *         for o in obj:
 *             if isinstance(o, _Element):             # <<<<<<<<<<<<<<
 *                 #print "Holding element:", <int>element._c_node
 *                 self._temp_refs.add(o)
*/
    __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element); 
    if (__pyx_t_1) {

      /* "src/lxml/extensions.pxi":344
 *             if isinstance(o, _Element):
 *                 #print "Holding element:", <int>element._c_node
 *                 self._temp_refs.add(o)             # <<<<<<<<<<<<<<
 *                 #print "Holding document:", <int>element._doc._c_doc
 *                 self._temp_documents.add((<_Element>o)._doc)
*/
      __pyx_t_2 = __pyx_f_4lxml_5etree_10_TempStore_add(__pyx_v_self->_temp_refs, __pyx_v_o); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(18, 344, __pyx_L1_error)

      /* "src/lxml/extensions.pxi":346
 *                 self._temp_refs.add(o)
 *                 #print "Holding document:", <int>element._doc._c_doc
 *                 self._temp_documents.add((<_Element>o)._doc)             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
*/
      if (unlikely(__pyx_v_self->_temp_documents == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "add");
        __PYX_ERR(18, 346, __pyx_L1_error)
      }
      __pyx_t_8 = ((PyObject *)((struct LxmlElement *)__pyx_v_o)->_doc);
      __Pyx_INCREF(__pyx_t_8);
      __pyx_t_4 = PySet_Add(__pyx_v_self->_temp_documents, __pyx_t_8); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(18, 346, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "src/lxml/extensions.pxi":342
 *             return
 *         for o in obj:
 *             if isinstance(o, _Element):             # <<<<<<<<<<<<<<
 *                 #print "Holding element:", <int>element._c_node
 *                 self._temp_refs.add(o)
*/
    }

    /* "src/lxml/extensions.pxi":341
 *         elif _isString(obj) or not python.PySequence_Check(obj):
 *             return
 *         for o in obj:             # <<<<<<<<<<<<<<
 *             if isinstance(o, _Element):
 *                 #print "Holding element:", <int>element._c_node
*/
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/extensions.pxi":326
 *         self._temp_documents.clear()
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef _hold(self, obj):
 *         """A way to temporarily hold references to nodes in the evaluator.
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("lxml.etree._BaseContext._hold", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_o);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/extensions.pxi":348
 *                 self._temp_documents.add((<_Element>o)._doc)
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef _Document _findDocumentForNode(self, xmlNode* c_node):
 *         """If an XPath expression returns an element from a different
*/

static struct LxmlDocument *__pyx_f_4lxml_5etree_12_BaseContext__findDocumentForNode(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, xmlNode *__pyx_v_c_node) {
  struct LxmlDocument *__pyx_v_doc = 0;
  struct LxmlDocument *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_findDocumentForNode", 0);

  /* "src/lxml/extensions.pxi":356
 *         """
 *         cdef _Document doc
 *         for doc in self._temp_documents:             # <<<<<<<<<<<<<<
 *             if doc is not None and doc._c_doc is c_node.doc:
 *                 return doc
*/
  __pyx_t_2 = 0;
  __pyx_t_5 = __Pyx_set_iterator(__pyx_v_self->_temp_documents, 1, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(18, 356, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = __pyx_t_5;
  __pyx_t_5 = 0;
  while (1) {
    __pyx_t_6 = __Pyx_set_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, &__pyx_t_5, __pyx_t_4);
    if (unlikely(__pyx_t_6 == 0)) break;
    if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(18, 356, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Document))))) __PYX_ERR(18, 356, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_doc, ((struct LxmlDocument *)__pyx_t_5));
    __pyx_t_5 = 0;

    /* "src/lxml/extensions.pxi":357
 *         cdef _Document doc
 *         for doc in self._temp_documents:
 *             if doc is not None and doc._c_doc is c_node.doc:             # <<<<<<<<<<<<<<
 *                 return doc
 *         return None
*/
    __pyx_t_8 = (((PyObject *)__pyx_v_doc) != Py_None);
    if (__pyx_t_8) {
    } else {
      __pyx_t_7 = __pyx_t_8;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_8 = (__pyx_v_doc->_c_doc == __pyx_v_c_node->doc);
    __pyx_t_7 = __pyx_t_8;
    __pyx_L6_bool_binop_done:;
    if (__pyx_t_7) {

      /* "src/lxml/extensions.pxi":358
 *         for doc in self._temp_documents:
 *             if doc is not None and doc._c_doc is c_node.doc:
 *                 return doc             # <<<<<<<<<<<<<<
 *         return None
 * 
*/
      __Pyx_XDECREF((PyObject *)__pyx_r);
      __Pyx_INCREF((PyObject *)__pyx_v_doc);
      __pyx_r = __pyx_v_doc;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;

      /* "src/lxml/extensions.pxi":357
 *         cdef _Document doc
 *         for doc in self._temp_documents:
 *             if doc is not None and doc._c_doc is c_node.doc:             # <<<<<<<<<<<<<<
 *                 return doc
 *         return None
*/
    }
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":359
 *             if doc is not None and doc._c_doc is c_node.doc:
 *                 return doc
 *         return None             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __pyx_r = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "src/lxml/extensions.pxi":348
 *                 self._temp_documents.add((<_Element>o)._doc)
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef _Document _findDocumentForNode(self, xmlNode* c_node):
 *         """If an XPath expression returns an element from a different
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._BaseContext._findDocumentForNode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/extensions.pxi":394
 * )
 * 
 * cdef void _forwardXPathError(void* c_ctxt, const xmlerror.xmlError* c_error) noexcept with gil:             # <<<<<<<<<<<<<<
 *     cdef xmlerror.xmlError error
 *     cdef int xpath_code
*/

static void __pyx_f_4lxml_5etree__forwardXPathError(void *__pyx_v_c_ctxt, xmlError const *__pyx_v_c_error) {
  xmlError __pyx_v_error;
  int __pyx_v_xpath_code;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  char *__pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  xmlErrorLevel __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("_forwardXPathError", 0);

  /* "src/lxml/extensions.pxi":397
 *     cdef xmlerror.xmlError error
 *     cdef int xpath_code
 *     if c_error.message is not NULL:             # <<<<<<<<<<<<<<
 *         error.message = c_error.message
 *     else:
*/
  __pyx_t_1 = (__pyx_v_c_error->message != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":398
 *     cdef int xpath_code
 *     if c_error.message is not NULL:
 *         error.message = c_error.message             # <<<<<<<<<<<<<<
 *     else:
 *         xpath_code = c_error.code - xmlerror.XML_XPATH_EXPRESSION_OK
*/
    __pyx_t_2 = __pyx_v_c_error->message;
    __pyx_v_error.message = __pyx_t_2;

    /* "src/lxml/extensions.pxi":397
 *     cdef xmlerror.xmlError error
 *     cdef int xpath_code
 *     if c_error.message is not NULL:             # <<<<<<<<<<<<<<
 *         error.message = c_error.message
 *     else:
*/
    goto __pyx_L3;
  }

  /* "src/lxml/extensions.pxi":400
 *         error.message = c_error.message
 *     else:
 *         xpath_code = c_error.code - xmlerror.XML_XPATH_EXPRESSION_OK             # <<<<<<<<<<<<<<
 *         if 0 <= xpath_code < len(LIBXML2_XPATH_ERROR_MESSAGES):
 *             error.message = _cstr(LIBXML2_XPATH_ERROR_MESSAGES[xpath_code])
*/
  /*else*/ {
    __pyx_v_xpath_code = (__pyx_v_c_error->code - XML_XPATH_EXPRESSION_OK);

    /* "src/lxml/extensions.pxi":401
 *     else:
 *         xpath_code = c_error.code - xmlerror.XML_XPATH_EXPRESSION_OK
 *         if 0 <= xpath_code < len(LIBXML2_XPATH_ERROR_MESSAGES):             # <<<<<<<<<<<<<<
 *             error.message = _cstr(LIBXML2_XPATH_ERROR_MESSAGES[xpath_code])
 *         else:
*/
    __pyx_t_1 = (0 <= __pyx_v_xpath_code);
    if (__pyx_t_1) {
      __pyx_t_3 = __pyx_v_4lxml_5etree_LIBXML2_XPATH_ERROR_MESSAGES;
      __Pyx_INCREF(__pyx_t_3);
      if (unlikely(__pyx_t_3 == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
        __PYX_ERR(18, 401, __pyx_L1_error)
      }
      __pyx_t_4 = __Pyx_PyTuple_GET_SIZE(__pyx_t_3); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(18, 401, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_1 = (__pyx_v_xpath_code < __pyx_t_4);
    }
    if (__pyx_t_1) {

      /* "src/lxml/extensions.pxi":402
 *         xpath_code = c_error.code - xmlerror.XML_XPATH_EXPRESSION_OK
 *         if 0 <= xpath_code < len(LIBXML2_XPATH_ERROR_MESSAGES):
 *             error.message = _cstr(LIBXML2_XPATH_ERROR_MESSAGES[xpath_code])             # <<<<<<<<<<<<<<
 *         else:
 *             error.message = b"unknown error"
*/
      if (unlikely(__pyx_v_4lxml_5etree_LIBXML2_XPATH_ERROR_MESSAGES == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(18, 402, __pyx_L1_error)
      }
      __pyx_t_3 = __Pyx_GetItemInt_Tuple(__pyx_v_4lxml_5etree_LIBXML2_XPATH_ERROR_MESSAGES, __pyx_v_xpath_code, int, 1, __Pyx_PyLong_From_int, 0, 1, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_3)) __PYX_ERR(18, 402, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_v_error.message = PyBytes_AS_STRING(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "src/lxml/extensions.pxi":401
 *     else:
 *         xpath_code = c_error.code - xmlerror.XML_XPATH_EXPRESSION_OK
 *         if 0 <= xpath_code < len(LIBXML2_XPATH_ERROR_MESSAGES):             # <<<<<<<<<<<<<<
 *             error.message = _cstr(LIBXML2_XPATH_ERROR_MESSAGES[xpath_code])
 *         else:
*/
      goto __pyx_L4;
    }

    /* "src/lxml/extensions.pxi":404
 *             error.message = _cstr(LIBXML2_XPATH_ERROR_MESSAGES[xpath_code])
 *         else:
 *             error.message = b"unknown error"             # <<<<<<<<<<<<<<
 *     error.domain = c_error.domain
 *     error.code = c_error.code
*/
    /*else*/ {
      __pyx_v_error.message = ((char *)"unknown error");
    }
    __pyx_L4:;
  }
  __pyx_L3:;

  /* "src/lxml/extensions.pxi":405
 *         else:
 *             error.message = b"unknown error"
 *     error.domain = c_error.domain             # <<<<<<<<<<<<<<
 *     error.code = c_error.code
 *     error.level = c_error.level
*/
  __pyx_t_5 = __pyx_v_c_error->domain;
  __pyx_v_error.domain = __pyx_t_5;

  /* "src/lxml/extensions.pxi":406
 *             error.message = b"unknown error"
 *     error.domain = c_error.domain
 *     error.code = c_error.code             # <<<<<<<<<<<<<<
 *     error.level = c_error.level
 *     error.line = c_error.line
*/
  __pyx_t_5 = __pyx_v_c_error->code;
  __pyx_v_error.code = __pyx_t_5;

  /* "src/lxml/extensions.pxi":407
 *     error.domain = c_error.domain
 *     error.code = c_error.code
 *     error.level = c_error.level             # <<<<<<<<<<<<<<
 *     error.line = c_error.line
 *     error.int2 = c_error.int1 # column
*/
  __pyx_t_6 = __pyx_v_c_error->level;
  __pyx_v_error.level = __pyx_t_6;

  /* "src/lxml/extensions.pxi":408
 *     error.code = c_error.code
 *     error.level = c_error.level
 *     error.line = c_error.line             # <<<<<<<<<<<<<<
 *     error.int2 = c_error.int1 # column
 *     error.file = c_error.file
*/
  __pyx_t_5 = __pyx_v_c_error->line;
  __pyx_v_error.line = __pyx_t_5;

  /* "src/lxml/extensions.pxi":409
 *     error.level = c_error.level
 *     error.line = c_error.line
 *     error.int2 = c_error.int1 # column             # <<<<<<<<<<<<<<
 *     error.file = c_error.file
 *     error.node = NULL
*/
  __pyx_t_5 = __pyx_v_c_error->int1;
  __pyx_v_error.int2 = __pyx_t_5;

  /* "src/lxml/extensions.pxi":410
 *     error.line = c_error.line
 *     error.int2 = c_error.int1 # column
 *     error.file = c_error.file             # <<<<<<<<<<<<<<
 *     error.node = NULL
 * 
*/
  __pyx_t_2 = __pyx_v_c_error->file;
  __pyx_v_error.file = __pyx_t_2;

  /* "src/lxml/extensions.pxi":411
 *     error.int2 = c_error.int1 # column
 *     error.file = c_error.file
 *     error.node = NULL             # <<<<<<<<<<<<<<
 * 
 *     (<_BaseContext>c_ctxt)._error_log._receive(&error)
*/
  __pyx_v_error.node = NULL;

  /* "src/lxml/extensions.pxi":413
 *     error.node = NULL
 * 
 *     (<_BaseContext>c_ctxt)._error_log._receive(&error)             # <<<<<<<<<<<<<<
 * 
 * cdef void _receiveXPathError(void* c_context, const xmlerror.xmlError* error) noexcept nogil:
*/
  __pyx_t_5 = __pyx_f_4lxml_5etree_13_BaseErrorLog__receive(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_c_ctxt)->_error_log), (&__pyx_v_error)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(18, 413, __pyx_L1_error)

  /* "src/lxml/extensions.pxi":394
 * )
 * 
 * cdef void _forwardXPathError(void* c_ctxt, const xmlerror.xmlError* c_error) noexcept with gil:             # <<<<<<<<<<<<<<
 *     cdef xmlerror.xmlError error
 *     cdef int xpath_code
*/

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_WriteUnraisable("lxml.etree._forwardXPathError", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
}

/* "src/lxml/extensions.pxi":415
 *     (<_BaseContext>c_ctxt)._error_log._receive(&error)
 * 
 * cdef void _receiveXPathError(void* c_context, const xmlerror.xmlError* error) noexcept nogil:             # <<<<<<<<<<<<<<
 *     if not __DEBUG:
 *         return
*/

static void __pyx_f_4lxml_5etree__receiveXPathError(void *__pyx_v_c_context, xmlError const *__pyx_v_error) {
  int __pyx_t_1;

  /* "src/lxml/extensions.pxi":418
 *     if not __DEBUG:
 *         return
 *     if c_context is NULL:             # <<<<<<<<<<<<<<
 *         _forwardError(NULL, error)
 *     else:
*/
  __pyx_t_1 = (__pyx_v_c_context == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":419
 *         return
 *     if c_context is NULL:
 *         _forwardError(NULL, error)             # <<<<<<<<<<<<<<
 *     else:
 *         _forwardXPathError(c_context, error)
*/
    __pyx_f_4lxml_5etree__forwardError(NULL, __pyx_v_error);

    /* "src/lxml/extensions.pxi":418
 *     if not __DEBUG:
 *         return
 *     if c_context is NULL:             # <<<<<<<<<<<<<<
 *         _forwardError(NULL, error)
 *     else:
*/
    goto __pyx_L3;
  }

  /* "src/lxml/extensions.pxi":421
 *         _forwardError(NULL, error)
 *     else:
 *         _forwardXPathError(c_context, error)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  /*else*/ {
    __pyx_f_4lxml_5etree__forwardXPathError(__pyx_v_c_context, __pyx_v_error);
  }
  __pyx_L3:;

  /* "src/lxml/extensions.pxi":415
 *     (<_BaseContext>c_ctxt)._error_log._receive(&error)
 * 
 * cdef void _receiveXPathError(void* c_context, const xmlerror.xmlError* error) noexcept nogil:             # <<<<<<<<<<<<<<
 *     if not __DEBUG:
 *         return
*/

  /* function exit code */
}

/* "src/lxml/extensions.pxi":424
 * 
 * 
 * def Extension(module, function_mapping=None, *, ns=None):             # <<<<<<<<<<<<<<
 *     """Extension(module, function_mapping=None, ns=None)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_68Extension(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_67Extension, "Extension(module, function_mapping=None, ns=None)\n\n    Build a dictionary of extension functions from the functions\n    defined in a module or the methods of an object.\n\n    As second argument, you can pass an additional mapping of\n    attribute names to XPath function names, or a list of function\n    names that should be taken.\n\n    The ``ns`` keyword argument accepts a namespace URI for the XPath\n    functions.\n    ");
static PyMethodDef __pyx_mdef_4lxml_5etree_68Extension = {"Extension", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_68Extension, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_67Extension};
static PyObject *__pyx_pw_4lxml_5etree_68Extension(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_module = 0;
  PyObject *__pyx_v_function_mapping = 0;
  PyObject *__pyx_v_ns = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Extension (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_module,&__pyx_mstate_global->__pyx_n_u_function_mapping,&__pyx_mstate_global->__pyx_n_u_ns,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(18, 424, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(18, 424, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(18, 424, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "Extension", 0) < (0)) __PYX_ERR(18, 424, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("Extension", 0, 1, 2, i); __PYX_ERR(18, 424, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(18, 424, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(18, 424, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_module = values[0];
    __pyx_v_function_mapping = values[1];
    __pyx_v_ns = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("Extension", 0, 1, 2, __pyx_nargs); __PYX_ERR(18, 424, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.Extension", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_67Extension(__pyx_self, __pyx_v_module, __pyx_v_function_mapping, __pyx_v_ns);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_67Extension(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_module, PyObject *__pyx_v_function_mapping, PyObject *__pyx_v_ns) {
  PyObject *__pyx_v_functions = 0;
  PyObject *__pyx_v_function_name = NULL;
  PyObject *__pyx_v_xpath_name = NULL;
  PyObject *__pyx_9genexpr19__pyx_v_name = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *(*__pyx_t_9)(PyObject *);
  PyObject *__pyx_t_10 = NULL;
  size_t __pyx_t_11;
  int __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("Extension", 0);
  __Pyx_INCREF(__pyx_v_function_mapping);

  /* "src/lxml/extensions.pxi":437
 *     functions.
 *     """
 *     cdef dict functions = {}             # <<<<<<<<<<<<<<
 *     if isinstance(function_mapping, dict):
 *         for function_name, xpath_name in function_mapping.items():
*/
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 437, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_functions = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":438
 *     """
 *     cdef dict functions = {}
 *     if isinstance(function_mapping, dict):             # <<<<<<<<<<<<<<
 *         for function_name, xpath_name in function_mapping.items():
 *             functions[(ns, xpath_name)] = getattr(module, function_name)
*/
  __pyx_t_2 = PyDict_Check(__pyx_v_function_mapping); 
  if (__pyx_t_2) {

    /* "src/lxml/extensions.pxi":439
 *     cdef dict functions = {}
 *     if isinstance(function_mapping, dict):
 *         for function_name, xpath_name in function_mapping.items():             # <<<<<<<<<<<<<<
 *             functions[(ns, xpath_name)] = getattr(module, function_name)
 *     else:
*/
    __pyx_t_3 = 0;
    if (unlikely(__pyx_v_function_mapping == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
      __PYX_ERR(18, 439, __pyx_L1_error)
    }
    __pyx_t_6 = __Pyx_dict_iterator(__pyx_v_function_mapping, 0, __pyx_mstate_global->__pyx_n_u_items, (&__pyx_t_4), (&__pyx_t_5)); if (unlikely(!__pyx_t_6)) __PYX_ERR(18, 439, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_1);
    __pyx_t_1 = __pyx_t_6;
    __pyx_t_6 = 0;
    while (1) {
      __pyx_t_8 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_4, &__pyx_t_3, &__pyx_t_6, &__pyx_t_7, NULL, __pyx_t_5);
      if (unlikely(__pyx_t_8 == 0)) break;
      if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(18, 439, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_XDECREF_SET(__pyx_v_function_name, __pyx_t_6);
      __pyx_t_6 = 0;
      __Pyx_XDECREF_SET(__pyx_v_xpath_name, __pyx_t_7);
      __pyx_t_7 = 0;

      /* "src/lxml/extensions.pxi":440
 *     if isinstance(function_mapping, dict):
 *         for function_name, xpath_name in function_mapping.items():
 *             functions[(ns, xpath_name)] = getattr(module, function_name)             # <<<<<<<<<<<<<<
 *     else:
 *         if function_mapping is None:
*/
      __pyx_t_7 = __Pyx_GetAttr(__pyx_v_module, __pyx_v_function_name); if (unlikely(!__pyx_t_7)) __PYX_ERR(18, 440, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(18, 440, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_v_ns);
      __Pyx_GIVEREF(__pyx_v_ns);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_ns) != (0)) __PYX_ERR(18, 440, __pyx_L1_error);
      __Pyx_INCREF(__pyx_v_xpath_name);
      __Pyx_GIVEREF(__pyx_v_xpath_name);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_xpath_name) != (0)) __PYX_ERR(18, 440, __pyx_L1_error);
      if (unlikely((PyDict_SetItem(__pyx_v_functions, __pyx_t_6, __pyx_t_7) < 0))) __PYX_ERR(18, 440, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "src/lxml/extensions.pxi":438
 *     """
 *     cdef dict functions = {}
 *     if isinstance(function_mapping, dict):             # <<<<<<<<<<<<<<
 *         for function_name, xpath_name in function_mapping.items():
 *             functions[(ns, xpath_name)] = getattr(module, function_name)
*/
    goto __pyx_L3;
  }

  /* "src/lxml/extensions.pxi":442
 *             functions[(ns, xpath_name)] = getattr(module, function_name)
 *     else:
 *         if function_mapping is None:             # <<<<<<<<<<<<<<
 *             function_mapping = [ name for name in dir(module)
 *                                  if not name.startswith('_') ]
*/
  /*else*/ {
    __pyx_t_2 = (__pyx_v_function_mapping == Py_None);
    if (__pyx_t_2) {

      /* "src/lxml/extensions.pxi":443
 *     else:
 *         if function_mapping is None:
 *             function_mapping = [ name for name in dir(module)             # <<<<<<<<<<<<<<
 *                                  if not name.startswith('_') ]
 *         for function_name in function_mapping:
*/
      { /* enter inner scope */
        __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 443, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_7 = PyObject_Dir(__pyx_v_module); if (unlikely(!__pyx_t_7)) __PYX_ERR(18, 443, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_7);
        if (likely(PyList_CheckExact(__pyx_t_7)) || PyTuple_CheckExact(__pyx_t_7)) {
          __pyx_t_6 = __pyx_t_7; __Pyx_INCREF(__pyx_t_6);
          __pyx_t_4 = 0;
          __pyx_t_9 = NULL;
        } else {
          __pyx_t_4 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(18, 443, __pyx_L9_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_9 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(18, 443, __pyx_L9_error)
        }
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        for (;;) {
          if (likely(!__pyx_t_9)) {
            if (likely(PyList_CheckExact(__pyx_t_6))) {
              {
                Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_6);
                #if !CYTHON_ASSUME_SAFE_SIZE
                if (unlikely((__pyx_temp < 0))) __PYX_ERR(18, 443, __pyx_L9_error)
                #endif
                if (__pyx_t_4 >= __pyx_temp) break;
              }
              __pyx_t_7 = __Pyx_PyList_GetItemRefFast(__pyx_t_6, __pyx_t_4, __Pyx_ReferenceSharing_OwnStrongReference);
              ++__pyx_t_4;
            } else {
              {
                Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_6);
                #if !CYTHON_ASSUME_SAFE_SIZE
                if (unlikely((__pyx_temp < 0))) __PYX_ERR(18, 443, __pyx_L9_error)
                #endif
                if (__pyx_t_4 >= __pyx_temp) break;
              }
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_7 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_4));
              #else
              __pyx_t_7 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_4);
              #endif
              ++__pyx_t_4;
            }
            if (unlikely(!__pyx_t_7)) __PYX_ERR(18, 443, __pyx_L9_error)
          } else {
            __pyx_t_7 = __pyx_t_9(__pyx_t_6);
            if (unlikely(!__pyx_t_7)) {
              PyObject* exc_type = PyErr_Occurred();
              if (exc_type) {
                if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(18, 443, __pyx_L9_error)
                PyErr_Clear();
              }
              break;
            }
          }
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_XDECREF_SET(__pyx_9genexpr19__pyx_v_name, __pyx_t_7);
          __pyx_t_7 = 0;

          /* "src/lxml/extensions.pxi":444
 *         if function_mapping is None:
 *             function_mapping = [ name for name in dir(module)
 *                                  if not name.startswith('_') ]             # <<<<<<<<<<<<<<
 *         for function_name in function_mapping:
 *             functions[(ns, function_name)] = getattr(module, function_name)
*/
          __pyx_t_10 = __pyx_9genexpr19__pyx_v_name;
          __Pyx_INCREF(__pyx_t_10);
          __pyx_t_11 = 0;
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_mstate_global->__pyx_n_u__28};
            __pyx_t_7 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_startswith, __pyx_callargs+__pyx_t_11, (2-__pyx_t_11) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
            if (unlikely(!__pyx_t_7)) __PYX_ERR(18, 444, __pyx_L9_error)
            __Pyx_GOTREF(__pyx_t_7);
          }
          __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(18, 444, __pyx_L9_error)
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_12 = (!__pyx_t_2);
          if (__pyx_t_12) {

            /* "src/lxml/extensions.pxi":443
 *     else:
 *         if function_mapping is None:
 *             function_mapping = [ name for name in dir(module)             # <<<<<<<<<<<<<<
 *                                  if not name.startswith('_') ]
 *         for function_name in function_mapping:
*/
            if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_9genexpr19__pyx_v_name))) __PYX_ERR(18, 443, __pyx_L9_error)

            /* "src/lxml/extensions.pxi":444
 *         if function_mapping is None:
 *             function_mapping = [ name for name in dir(module)
 *                                  if not name.startswith('_') ]             # <<<<<<<<<<<<<<
 *         for function_name in function_mapping:
 *             functions[(ns, function_name)] = getattr(module, function_name)
*/
          }

          /* "src/lxml/extensions.pxi":443
 *     else:
 *         if function_mapping is None:
 *             function_mapping = [ name for name in dir(module)             # <<<<<<<<<<<<<<
 *                                  if not name.startswith('_') ]
 *         for function_name in function_mapping:
*/
        }
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_9genexpr19__pyx_v_name); __pyx_9genexpr19__pyx_v_name = 0;
        goto __pyx_L14_exit_scope;
        __pyx_L9_error:;
        __Pyx_XDECREF(__pyx_9genexpr19__pyx_v_name); __pyx_9genexpr19__pyx_v_name = 0;
        goto __pyx_L1_error;
        __pyx_L14_exit_scope:;
      } /* exit inner scope */
      __Pyx_DECREF_SET(__pyx_v_function_mapping, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "src/lxml/extensions.pxi":442
 *             functions[(ns, xpath_name)] = getattr(module, function_name)
 *     else:
 *         if function_mapping is None:             # <<<<<<<<<<<<<<
 *             function_mapping = [ name for name in dir(module)
 *                                  if not name.startswith('_') ]
*/
    }

    /* "src/lxml/extensions.pxi":445
 *             function_mapping = [ name for name in dir(module)
 *                                  if not name.startswith('_') ]
 *         for function_name in function_mapping:             # <<<<<<<<<<<<<<
 *             functions[(ns, function_name)] = getattr(module, function_name)
 *     return functions
*/
    if (likely(PyList_CheckExact(__pyx_v_function_mapping)) || PyTuple_CheckExact(__pyx_v_function_mapping)) {
      __pyx_t_1 = __pyx_v_function_mapping; __Pyx_INCREF(__pyx_t_1);
      __pyx_t_4 = 0;
      __pyx_t_9 = NULL;
    } else {
      __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_function_mapping); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 445, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_9 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(18, 445, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_9)) {
        if (likely(PyList_CheckExact(__pyx_t_1))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(18, 445, __pyx_L1_error)
            #endif
            if (__pyx_t_4 >= __pyx_temp) break;
          }
          __pyx_t_6 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_4, __Pyx_ReferenceSharing_OwnStrongReference);
          ++__pyx_t_4;
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(18, 445, __pyx_L1_error)
            #endif
            if (__pyx_t_4 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_6 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4));
          #else
          __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_4);
          #endif
          ++__pyx_t_4;
        }
        if (unlikely(!__pyx_t_6)) __PYX_ERR(18, 445, __pyx_L1_error)
      } else {
        __pyx_t_6 = __pyx_t_9(__pyx_t_1);
        if (unlikely(!__pyx_t_6)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(18, 445, __pyx_L1_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_XDECREF_SET(__pyx_v_function_name, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "src/lxml/extensions.pxi":446
 *                                  if not name.startswith('_') ]
 *         for function_name in function_mapping:
 *             functions[(ns, function_name)] = getattr(module, function_name)             # <<<<<<<<<<<<<<
 *     return functions
 * 
*/
      __pyx_t_6 = __Pyx_GetAttr(__pyx_v_module, __pyx_v_function_name); if (unlikely(!__pyx_t_6)) __PYX_ERR(18, 446, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(18, 446, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_v_ns);
      __Pyx_GIVEREF(__pyx_v_ns);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_ns) != (0)) __PYX_ERR(18, 446, __pyx_L1_error);
      __Pyx_INCREF(__pyx_v_function_name);
      __Pyx_GIVEREF(__pyx_v_function_name);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_function_name) != (0)) __PYX_ERR(18, 446, __pyx_L1_error);
      if (unlikely((PyDict_SetItem(__pyx_v_functions, __pyx_t_7, __pyx_t_6) < 0))) __PYX_ERR(18, 446, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "src/lxml/extensions.pxi":445
 *             function_mapping = [ name for name in dir(module)
 *                                  if not name.startswith('_') ]
 *         for function_name in function_mapping:             # <<<<<<<<<<<<<<
 *             functions[(ns, function_name)] = getattr(module, function_name)
 *     return functions
*/
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __pyx_L3:;

  /* "src/lxml/extensions.pxi":447
 *         for function_name in function_mapping:
 *             functions[(ns, function_name)] = getattr(module, function_name)
 *     return functions             # <<<<<<<<<<<<<<
 * 
 * ################################################################################
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_functions);
  __pyx_r = __pyx_v_functions;
  goto __pyx_L0;

  /* "src/lxml/extensions.pxi":424
 * 
 * 
 * def Extension(module, function_mapping=None, *, ns=None):             # <<<<<<<<<<<<<<
 *     """Extension(module, function_mapping=None, ns=None)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("lxml.etree.Extension", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_functions);
  __Pyx_XDECREF(__pyx_v_function_name);
  __Pyx_XDECREF(__pyx_v_xpath_name);
  __Pyx_XDECREF(__pyx_9genexpr19__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_function_mapping);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/extensions.pxi":456
 * cdef class _ExsltRegExp:
 *     cdef dict _compile_map
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._compile_map = {}
 * 
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_12_ExsltRegExp_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_12_ExsltRegExp_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, __pyx_nargs); return -1; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return -1;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__cinit__", __pyx_kwds); return -1;}
  __pyx_r = __pyx_pf_4lxml_5etree_12_ExsltRegExp___cinit__(((struct __pyx_obj_4lxml_5etree__ExsltRegExp *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_12_ExsltRegExp___cinit__(struct __pyx_obj_4lxml_5etree__ExsltRegExp *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "src/lxml/extensions.pxi":457
 *     cdef dict _compile_map
 *     def __cinit__(self):
 *         self._compile_map = {}             # <<<<<<<<<<<<<<
 * 
 *     cdef _make_string(self, value):
*/
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 457, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_compile_map);
  __Pyx_DECREF(__pyx_v_self->_compile_map);
  __pyx_v_self->_compile_map = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":456
 * cdef class _ExsltRegExp:
 *     cdef dict _compile_map
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._compile_map = {}
 * 
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ExsltRegExp.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/extensions.pxi":459
 *         self._compile_map = {}
 * 
 *     cdef _make_string(self, value):             # <<<<<<<<<<<<<<
 *         if _isString(value):
 *             return value
*/

static PyObject *__pyx_f_4lxml_5etree_12_ExsltRegExp__make_string(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__ExsltRegExp *__pyx_v_self, PyObject *__pyx_v_value) {
  PyObject *__pyx_v_firstnode = NULL;
  xmlChar *__pyx_v_c_text;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  char const *__pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_make_string", 0);

  /* "src/lxml/extensions.pxi":460
 * 
 *     cdef _make_string(self, value):
 *         if _isString(value):             # <<<<<<<<<<<<<<
 *             return value
 *         elif isinstance(value, list):
*/
  __pyx_t_1 = _isString(__pyx_v_value);
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":461
 *     cdef _make_string(self, value):
 *         if _isString(value):
 *             return value             # <<<<<<<<<<<<<<
 *         elif isinstance(value, list):
 *             # node set: take recursive text concatenation of first element
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_value);
    __pyx_r = __pyx_v_value;
    goto __pyx_L0;

    /* "src/lxml/extensions.pxi":460
 * 
 *     cdef _make_string(self, value):
 *         if _isString(value):             # <<<<<<<<<<<<<<
 *             return value
 *         elif isinstance(value, list):
*/
  }

  /* "src/lxml/extensions.pxi":462
 *         if _isString(value):
 *             return value
 *         elif isinstance(value, list):             # <<<<<<<<<<<<<<
 *             # node set: take recursive text concatenation of first element
 *             if python.PyList_GET_SIZE(value) == 0:
*/
  __pyx_t_1 = PyList_Check(__pyx_v_value); 
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":464
 *         elif isinstance(value, list):
 *             # node set: take recursive text concatenation of first element
 *             if python.PyList_GET_SIZE(value) == 0:             # <<<<<<<<<<<<<<
 *                 return ''
 *             firstnode = value[0]
*/
    __pyx_t_1 = (PyList_GET_SIZE(__pyx_v_value) == 0);
    if (__pyx_t_1) {

      /* "src/lxml/extensions.pxi":465
 *             # node set: take recursive text concatenation of first element
 *             if python.PyList_GET_SIZE(value) == 0:
 *                 return ''             # <<<<<<<<<<<<<<
 *             firstnode = value[0]
 *             if _isString(firstnode):
*/
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u__8);
      __pyx_r = __pyx_mstate_global->__pyx_kp_u__8;
      goto __pyx_L0;

      /* "src/lxml/extensions.pxi":464
 *         elif isinstance(value, list):
 *             # node set: take recursive text concatenation of first element
 *             if python.PyList_GET_SIZE(value) == 0:             # <<<<<<<<<<<<<<
 *                 return ''
 *             firstnode = value[0]
*/
    }

    /* "src/lxml/extensions.pxi":466
 *             if python.PyList_GET_SIZE(value) == 0:
 *                 return ''
 *             firstnode = value[0]             # <<<<<<<<<<<<<<
 *             if _isString(firstnode):
 *                 return firstnode
*/
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 466, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_firstnode = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "src/lxml/extensions.pxi":467
 *                 return ''
 *             firstnode = value[0]
 *             if _isString(firstnode):             # <<<<<<<<<<<<<<
 *                 return firstnode
 *             elif isinstance(firstnode, _Element):
*/
    __pyx_t_1 = _isString(__pyx_v_firstnode);
    if (__pyx_t_1) {

      /* "src/lxml/extensions.pxi":468
 *             firstnode = value[0]
 *             if _isString(firstnode):
 *                 return firstnode             # <<<<<<<<<<<<<<
 *             elif isinstance(firstnode, _Element):
 *                 c_text = tree.xmlNodeGetContent((<_Element>firstnode)._c_node)
*/
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_firstnode);
      __pyx_r = __pyx_v_firstnode;
      goto __pyx_L0;

      /* "src/lxml/extensions.pxi":467
 *                 return ''
 *             firstnode = value[0]
 *             if _isString(firstnode):             # <<<<<<<<<<<<<<
 *                 return firstnode
 *             elif isinstance(firstnode, _Element):
*/
    }

    /* "src/lxml/extensions.pxi":469
 *             if _isString(firstnode):
 *                 return firstnode
 *             elif isinstance(firstnode, _Element):             # <<<<<<<<<<<<<<
 *                 c_text = tree.xmlNodeGetContent((<_Element>firstnode)._c_node)
 *                 if c_text is NULL:
*/
    __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_firstnode, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element); 
    if (__pyx_t_1) {

      /* "src/lxml/extensions.pxi":470
 *                 return firstnode
 *             elif isinstance(firstnode, _Element):
 *                 c_text = tree.xmlNodeGetContent((<_Element>firstnode)._c_node)             # <<<<<<<<<<<<<<
 *                 if c_text is NULL:
 *                     raise MemoryError()
*/
      __pyx_v_c_text = xmlNodeGetContent(((struct LxmlElement *)__pyx_v_firstnode)->_c_node);

      /* "src/lxml/extensions.pxi":471
 *             elif isinstance(firstnode, _Element):
 *                 c_text = tree.xmlNodeGetContent((<_Element>firstnode)._c_node)
 *                 if c_text is NULL:             # <<<<<<<<<<<<<<
 *                     raise MemoryError()
 *                 try:
*/
      __pyx_t_1 = (__pyx_v_c_text == NULL);
      if (unlikely(__pyx_t_1)) {

        /* "src/lxml/extensions.pxi":472
 *                 c_text = tree.xmlNodeGetContent((<_Element>firstnode)._c_node)
 *                 if c_text is NULL:
 *                     raise MemoryError()             # <<<<<<<<<<<<<<
 *                 try:
 *                     return funicode(c_text)
*/
        PyErr_NoMemory(); __PYX_ERR(18, 472, __pyx_L1_error)

        /* "src/lxml/extensions.pxi":471
 *             elif isinstance(firstnode, _Element):
 *                 c_text = tree.xmlNodeGetContent((<_Element>firstnode)._c_node)
 *                 if c_text is NULL:             # <<<<<<<<<<<<<<
 *                     raise MemoryError()
 *                 try:
*/
      }

      /* "src/lxml/extensions.pxi":473
 *                 if c_text is NULL:
 *                     raise MemoryError()
 *                 try:             # <<<<<<<<<<<<<<
 *                     return funicode(c_text)
 *                 finally:
*/
      /*try:*/ {

        /* "src/lxml/extensions.pxi":474
 *                     raise MemoryError()
 *                 try:
 *                     return funicode(c_text)             # <<<<<<<<<<<<<<
 *                 finally:
 *                     tree.xmlFree(c_text)
*/
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_text); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 474, __pyx_L8_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        goto __pyx_L7_return;
      }

      /* "src/lxml/extensions.pxi":476
 *                     return funicode(c_text)
 *                 finally:
 *                     tree.xmlFree(c_text)             # <<<<<<<<<<<<<<
 *             else:
 *                 return unicode(firstnode)
*/
      /*finally:*/ {
        __pyx_L8_error:;
        /*exception exit:*/{
          __Pyx_PyThreadState_declare
          __Pyx_PyThreadState_assign
          __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
           __Pyx_ExceptionSwap(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
          if ( unlikely(__Pyx_GetException(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8) < 0)) __Pyx_ErrFetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
          __Pyx_XGOTREF(__pyx_t_6);
          __Pyx_XGOTREF(__pyx_t_7);
          __Pyx_XGOTREF(__pyx_t_8);
          __Pyx_XGOTREF(__pyx_t_9);
          __Pyx_XGOTREF(__pyx_t_10);
          __Pyx_XGOTREF(__pyx_t_11);
          __pyx_t_3 = __pyx_lineno; __pyx_t_4 = __pyx_clineno; __pyx_t_5 = __pyx_filename;
          {
            xmlFree(__pyx_v_c_text);
          }
          __Pyx_XGIVEREF(__pyx_t_9);
          __Pyx_XGIVEREF(__pyx_t_10);
          __Pyx_XGIVEREF(__pyx_t_11);
          __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
          __Pyx_XGIVEREF(__pyx_t_6);
          __Pyx_XGIVEREF(__pyx_t_7);
          __Pyx_XGIVEREF(__pyx_t_8);
          __Pyx_ErrRestore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
          __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
          __pyx_lineno = __pyx_t_3; __pyx_clineno = __pyx_t_4; __pyx_filename = __pyx_t_5;
          goto __pyx_L1_error;
        }
        __pyx_L7_return: {
          __pyx_t_11 = __pyx_r;
          __pyx_r = 0;
          xmlFree(__pyx_v_c_text);
          __pyx_r = __pyx_t_11;
          __pyx_t_11 = 0;
          goto __pyx_L0;
        }
      }

      /* "src/lxml/extensions.pxi":469
 *             if _isString(firstnode):
 *                 return firstnode
 *             elif isinstance(firstnode, _Element):             # <<<<<<<<<<<<<<
 *                 c_text = tree.xmlNodeGetContent((<_Element>firstnode)._c_node)
 *                 if c_text is NULL:
*/
    }

    /* "src/lxml/extensions.pxi":478
 *                     tree.xmlFree(c_text)
 *             else:
 *                 return unicode(firstnode)             # <<<<<<<<<<<<<<
 *         else:
 *             return unicode(value)
*/
    /*else*/ {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = __Pyx_PyObject_Unicode(__pyx_v_firstnode); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 478, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;
    }

    /* "src/lxml/extensions.pxi":462
 *         if _isString(value):
 *             return value
 *         elif isinstance(value, list):             # <<<<<<<<<<<<<<
 *             # node set: take recursive text concatenation of first element
 *             if python.PyList_GET_SIZE(value) == 0:
*/
  }

  /* "src/lxml/extensions.pxi":480
 *                 return unicode(firstnode)
 *         else:
 *             return unicode(value)             # <<<<<<<<<<<<<<
 * 
 *     cdef _compile(self, rexp, ignore_case):
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyObject_Unicode(__pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 480, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "src/lxml/extensions.pxi":459
 *         self._compile_map = {}
 * 
 *     cdef _make_string(self, value):             # <<<<<<<<<<<<<<
 *         if _isString(value):
 *             return value
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ExsltRegExp._make_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_firstnode);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/extensions.pxi":482
 *             return unicode(value)
 * 
 *     cdef _compile(self, rexp, ignore_case):             # <<<<<<<<<<<<<<
 *         cdef python.PyObject* c_result
 *         rexp = self._make_string(rexp)
*/

static PyObject *__pyx_f_4lxml_5etree_12_ExsltRegExp__compile(struct __pyx_obj_4lxml_5etree__ExsltRegExp *__pyx_v_self, PyObject *__pyx_v_rexp, PyObject *__pyx_v_ignore_case) {
  PyObject *__pyx_v_c_result;
  PyObject *__pyx_v_key = NULL;
  PyObject *__pyx_v_py_flags = NULL;
  PyObject *__pyx_v_rexp_compiled = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_compile", 0);
  __Pyx_INCREF(__pyx_v_rexp);

  /* "src/lxml/extensions.pxi":484
 *     cdef _compile(self, rexp, ignore_case):
 *         cdef python.PyObject* c_result
 *         rexp = self._make_string(rexp)             # <<<<<<<<<<<<<<
 *         key = (rexp, ignore_case)
 *         c_result = python.PyDict_GetItem(self._compile_map, key)
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_12_ExsltRegExp__make_string(__pyx_v_self, __pyx_v_rexp); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 484, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_rexp, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":485
 *         cdef python.PyObject* c_result
 *         rexp = self._make_string(rexp)
 *         key = (rexp, ignore_case)             # <<<<<<<<<<<<<<
 *         c_result = python.PyDict_GetItem(self._compile_map, key)
 *         if c_result is not NULL:
*/
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 485, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_rexp);
  __Pyx_GIVEREF(__pyx_v_rexp);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_rexp) != (0)) __PYX_ERR(18, 485, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_ignore_case);
  __Pyx_GIVEREF(__pyx_v_ignore_case);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_ignore_case) != (0)) __PYX_ERR(18, 485, __pyx_L1_error);
  __pyx_v_key = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":486
 *         rexp = self._make_string(rexp)
 *         key = (rexp, ignore_case)
 *         c_result = python.PyDict_GetItem(self._compile_map, key)             # <<<<<<<<<<<<<<
 *         if c_result is not NULL:
 *             return <object>c_result
*/
  __pyx_t_1 = __pyx_v_self->_compile_map;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_c_result = PyDict_GetItem(__pyx_t_1, __pyx_v_key);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":487
 *         key = (rexp, ignore_case)
 *         c_result = python.PyDict_GetItem(self._compile_map, key)
 *         if c_result is not NULL:             # <<<<<<<<<<<<<<
 *             return <object>c_result
 *         py_flags = re.UNICODE
*/
  __pyx_t_2 = (__pyx_v_c_result != NULL);
  if (__pyx_t_2) {

    /* "src/lxml/extensions.pxi":488
 *         c_result = python.PyDict_GetItem(self._compile_map, key)
 *         if c_result is not NULL:
 *             return <object>c_result             # <<<<<<<<<<<<<<
 *         py_flags = re.UNICODE
 *         if ignore_case:
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_c_result));
    __pyx_r = ((PyObject *)__pyx_v_c_result);
    goto __pyx_L0;

    /* "src/lxml/extensions.pxi":487
 *         key = (rexp, ignore_case)
 *         c_result = python.PyDict_GetItem(self._compile_map, key)
 *         if c_result is not NULL:             # <<<<<<<<<<<<<<
 *             return <object>c_result
 *         py_flags = re.UNICODE
*/
  }

  /* "src/lxml/extensions.pxi":489
 *         if c_result is not NULL:
 *             return <object>c_result
 *         py_flags = re.UNICODE             # <<<<<<<<<<<<<<
 *         if ignore_case:
 *             py_flags = py_flags | re.IGNORECASE
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree_re, __pyx_mstate_global->__pyx_n_u_UNICODE); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 489, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_py_flags = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":490
 *             return <object>c_result
 *         py_flags = re.UNICODE
 *         if ignore_case:             # <<<<<<<<<<<<<<
 *             py_flags = py_flags | re.IGNORECASE
 *         rexp_compiled = re.compile(rexp, py_flags)
*/
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_ignore_case); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(18, 490, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "src/lxml/extensions.pxi":491
 *         py_flags = re.UNICODE
 *         if ignore_case:
 *             py_flags = py_flags | re.IGNORECASE             # <<<<<<<<<<<<<<
 *         rexp_compiled = re.compile(rexp, py_flags)
 *         self._compile_map[key] = rexp_compiled
*/
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree_re, __pyx_mstate_global->__pyx_n_u_IGNORECASE); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 491, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyNumber_Or(__pyx_v_py_flags, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(18, 491, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_py_flags, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/extensions.pxi":490
 *             return <object>c_result
 *         py_flags = re.UNICODE
 *         if ignore_case:             # <<<<<<<<<<<<<<
 *             py_flags = py_flags | re.IGNORECASE
 *         rexp_compiled = re.compile(rexp, py_flags)
*/
  }

  /* "src/lxml/extensions.pxi":492
 *         if ignore_case:
 *             py_flags = py_flags | re.IGNORECASE
 *         rexp_compiled = re.compile(rexp, py_flags)             # <<<<<<<<<<<<<<
 *         self._compile_map[key] = rexp_compiled
 *         return rexp_compiled
*/
  __pyx_t_1 = __pyx_v_4lxml_5etree_re;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_1, __pyx_v_rexp, __pyx_v_py_flags};
    __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_compile, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(18, 492, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  __pyx_v_rexp_compiled = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "src/lxml/extensions.pxi":493
 *             py_flags = py_flags | re.IGNORECASE
 *         rexp_compiled = re.compile(rexp, py_flags)
 *         self._compile_map[key] = rexp_compiled             # <<<<<<<<<<<<<<
 *         return rexp_compiled
 * 
*/
  if (unlikely(__pyx_v_self->_compile_map == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(18, 493, __pyx_L1_error)
  }
  if (unlikely((PyDict_SetItem(__pyx_v_self->_compile_map, __pyx_v_key, __pyx_v_rexp_compiled) < 0))) __PYX_ERR(18, 493, __pyx_L1_error)

  /* "src/lxml/extensions.pxi":494
 *         rexp_compiled = re.compile(rexp, py_flags)
 *         self._compile_map[key] = rexp_compiled
 *         return rexp_compiled             # <<<<<<<<<<<<<<
 * 
 *     def test(self, ctxt, s, rexp, flags=''):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_rexp_compiled);
  __pyx_r = __pyx_v_rexp_compiled;
  goto __pyx_L0;

  /* "src/lxml/extensions.pxi":482
 *             return unicode(value)
 * 
 *     cdef _compile(self, rexp, ignore_case):             # <<<<<<<<<<<<<<
 *         cdef python.PyObject* c_result
 *         rexp = self._make_string(rexp)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._ExsltRegExp._compile", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XDECREF(__pyx_v_py_flags);
  __Pyx_XDECREF(__pyx_v_rexp_compiled);
  __Pyx_XDECREF(__pyx_v_rexp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/extensions.pxi":496
 *         return rexp_compiled
 * 
 *     def test(self, ctxt, s, rexp, flags=''):             # <<<<<<<<<<<<<<
 *         flags = self._make_string(flags)
 *         s = self._make_string(s)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ExsltRegExp_3test(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_12_ExsltRegExp_3test = {"test", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ExsltRegExp_3test, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_12_ExsltRegExp_3test(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_ctxt = 0;
  PyObject *__pyx_v_s = 0;
  PyObject *__pyx_v_rexp = 0;
  PyObject *__pyx_v_flags = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[4] = {0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("test (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_ctxt,&__pyx_mstate_global->__pyx_n_u_s_4,&__pyx_mstate_global->__pyx_n_u_rexp,&__pyx_mstate_global->__pyx_n_u_flags,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(18, 496, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(18, 496, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(18, 496, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(18, 496, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(18, 496, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "test", 0) < (0)) __PYX_ERR(18, 496, __pyx_L3_error)
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_kp_u__8));
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("test", 0, 3, 4, i); __PYX_ERR(18, 496, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(18, 496, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(18, 496, __pyx_L3_error)
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(18, 496, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(18, 496, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_kp_u__8));
    }
    __pyx_v_ctxt = values[0];
    __pyx_v_s = values[1];
    __pyx_v_rexp = values[2];
    __pyx_v_flags = values[3];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("test", 0, 3, 4, __pyx_nargs); __PYX_ERR(18, 496, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._ExsltRegExp.test", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_12_ExsltRegExp_2test(((struct __pyx_obj_4lxml_5etree__ExsltRegExp *)__pyx_v_self), __pyx_v_ctxt, __pyx_v_s, __pyx_v_rexp, __pyx_v_flags);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_12_ExsltRegExp_2test(struct __pyx_obj_4lxml_5etree__ExsltRegExp *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_ctxt, PyObject *__pyx_v_s, PyObject *__pyx_v_rexp, PyObject *__pyx_v_flags) {
  PyObject *__pyx_v_rexpc = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("test", 0);
  __Pyx_INCREF(__pyx_v_s);
  __Pyx_INCREF(__pyx_v_flags);

  /* "src/lxml/extensions.pxi":497
 * 
 *     def test(self, ctxt, s, rexp, flags=''):
 *         flags = self._make_string(flags)             # <<<<<<<<<<<<<<
 *         s = self._make_string(s)
 *         rexpc = self._compile(rexp, 'i' in flags)
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_12_ExsltRegExp__make_string(__pyx_v_self, __pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 497, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_flags, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":498
 *     def test(self, ctxt, s, rexp, flags=''):
 *         flags = self._make_string(flags)
 *         s = self._make_string(s)             # <<<<<<<<<<<<<<
 *         rexpc = self._compile(rexp, 'i' in flags)
 *         if rexpc.search(s) is None:
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_12_ExsltRegExp__make_string(__pyx_v_self, __pyx_v_s); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 498, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":499
 *         flags = self._make_string(flags)
 *         s = self._make_string(s)
 *         rexpc = self._compile(rexp, 'i' in flags)             # <<<<<<<<<<<<<<
 *         if rexpc.search(s) is None:
 *             return False
*/
  __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_mstate_global->__pyx_n_u_i, __pyx_v_flags, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(18, 499, __pyx_L1_error)
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 499, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __pyx_f_4lxml_5etree_12_ExsltRegExp__compile(__pyx_v_self, __pyx_v_rexp, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(18, 499, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_rexpc = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "src/lxml/extensions.pxi":500
 *         s = self._make_string(s)
 *         rexpc = self._compile(rexp, 'i' in flags)
 *         if rexpc.search(s) is None:             # <<<<<<<<<<<<<<
 *             return False
 *         else:
*/
  __pyx_t_1 = __pyx_v_rexpc;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_v_s};
    __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_search, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(18, 500, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  __pyx_t_2 = (__pyx_t_3 == Py_None);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_2) {

    /* "src/lxml/extensions.pxi":501
 *         rexpc = self._compile(rexp, 'i' in flags)
 *         if rexpc.search(s) is None:
 *             return False             # <<<<<<<<<<<<<<
 *         else:
 *             return True
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;

    /* "src/lxml/extensions.pxi":500
 *         s = self._make_string(s)
 *         rexpc = self._compile(rexp, 'i' in flags)
 *         if rexpc.search(s) is None:             # <<<<<<<<<<<<<<
 *             return False
 *         else:
*/
  }

  /* "src/lxml/extensions.pxi":503
 *             return False
 *         else:
 *             return True             # <<<<<<<<<<<<<<
 * 
 *     def match(self, ctxt, s, rexp, flags=''):
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;
  }

  /* "src/lxml/extensions.pxi":496
 *         return rexp_compiled
 * 
 *     def test(self, ctxt, s, rexp, flags=''):             # <<<<<<<<<<<<<<
 *         flags = self._make_string(flags)
 *         s = self._make_string(s)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._ExsltRegExp.test", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rexpc);
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XDECREF(__pyx_v_flags);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/extensions.pxi":505
 *             return True
 * 
 *     def match(self, ctxt, s, rexp, flags=''):             # <<<<<<<<<<<<<<
 *         cdef list result_list
 *         flags = self._make_string(flags)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ExsltRegExp_5match(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_12_ExsltRegExp_5match = {"match", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ExsltRegExp_5match, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_12_ExsltRegExp_5match(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_ctxt = 0;
  PyObject *__pyx_v_s = 0;
  PyObject *__pyx_v_rexp = 0;
  PyObject *__pyx_v_flags = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[4] = {0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("match (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_ctxt,&__pyx_mstate_global->__pyx_n_u_s_4,&__pyx_mstate_global->__pyx_n_u_rexp,&__pyx_mstate_global->__pyx_n_u_flags,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(18, 505, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(18, 505, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(18, 505, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(18, 505, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(18, 505, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "match", 0) < (0)) __PYX_ERR(18, 505, __pyx_L3_error)
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_kp_u__8));
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("match", 0, 3, 4, i); __PYX_ERR(18, 505, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(18, 505, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(18, 505, __pyx_L3_error)
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(18, 505, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(18, 505, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_kp_u__8));
    }
    __pyx_v_ctxt = values[0];
    __pyx_v_s = values[1];
    __pyx_v_rexp = values[2];
    __pyx_v_flags = values[3];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("match", 0, 3, 4, __pyx_nargs); __PYX_ERR(18, 505, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._ExsltRegExp.match", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_12_ExsltRegExp_4match(((struct __pyx_obj_4lxml_5etree__ExsltRegExp *)__pyx_v_self), __pyx_v_ctxt, __pyx_v_s, __pyx_v_rexp, __pyx_v_flags);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_12_ExsltRegExp_4match(struct __pyx_obj_4lxml_5etree__ExsltRegExp *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_ctxt, PyObject *__pyx_v_s, PyObject *__pyx_v_rexp, PyObject *__pyx_v_flags) {
  PyObject *__pyx_v_result_list = 0;
  PyObject *__pyx_v_rexpc = NULL;
  PyObject *__pyx_v_results = NULL;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_v_root = NULL;
  PyObject *__pyx_v_s_match = NULL;
  PyObject *__pyx_v_elem = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  Py_ssize_t __pyx_t_8;
  PyObject *(*__pyx_t_9)(PyObject *);
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("match", 0);
  __Pyx_INCREF(__pyx_v_s);
  __Pyx_INCREF(__pyx_v_flags);

  /* "src/lxml/extensions.pxi":507
 *     def match(self, ctxt, s, rexp, flags=''):
 *         cdef list result_list
 *         flags = self._make_string(flags)             # <<<<<<<<<<<<<<
 *         s = self._make_string(s)
 *         rexpc = self._compile(rexp, 'i' in flags)
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_12_ExsltRegExp__make_string(__pyx_v_self, __pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 507, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_flags, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":508
 *         cdef list result_list
 *         flags = self._make_string(flags)
 *         s = self._make_string(s)             # <<<<<<<<<<<<<<
 *         rexpc = self._compile(rexp, 'i' in flags)
 *         if 'g' in flags:
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_12_ExsltRegExp__make_string(__pyx_v_self, __pyx_v_s); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 508, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":509
 *         flags = self._make_string(flags)
 *         s = self._make_string(s)
 *         rexpc = self._compile(rexp, 'i' in flags)             # <<<<<<<<<<<<<<
 *         if 'g' in flags:
 *             results = rexpc.findall(s)
*/
  __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_mstate_global->__pyx_n_u_i, __pyx_v_flags, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(18, 509, __pyx_L1_error)
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 509, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __pyx_f_4lxml_5etree_12_ExsltRegExp__compile(__pyx_v_self, __pyx_v_rexp, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(18, 509, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_rexpc = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "src/lxml/extensions.pxi":510
 *         s = self._make_string(s)
 *         rexpc = self._compile(rexp, 'i' in flags)
 *         if 'g' in flags:             # <<<<<<<<<<<<<<
 *             results = rexpc.findall(s)
 *             if not results:
*/
  __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_mstate_global->__pyx_n_u_g, __pyx_v_flags, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(18, 510, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "src/lxml/extensions.pxi":511
 *         rexpc = self._compile(rexp, 'i' in flags)
 *         if 'g' in flags:
 *             results = rexpc.findall(s)             # <<<<<<<<<<<<<<
 *             if not results:
 *                 return ()
*/
    __pyx_t_1 = __pyx_v_rexpc;
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_4 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_v_s};
      __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_findall, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(18, 511, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __pyx_v_results = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "src/lxml/extensions.pxi":512
 *         if 'g' in flags:
 *             results = rexpc.findall(s)
 *             if not results:             # <<<<<<<<<<<<<<
 *                 return ()
 *         else:
*/
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_results); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(18, 512, __pyx_L1_error)
    __pyx_t_5 = (!__pyx_t_2);
    if (__pyx_t_5) {

      /* "src/lxml/extensions.pxi":513
 *             results = rexpc.findall(s)
 *             if not results:
 *                 return ()             # <<<<<<<<<<<<<<
 *         else:
 *             result = rexpc.search(s)
*/
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_mstate_global->__pyx_empty_tuple);
      __pyx_r = __pyx_mstate_global->__pyx_empty_tuple;
      goto __pyx_L0;

      /* "src/lxml/extensions.pxi":512
 *         if 'g' in flags:
 *             results = rexpc.findall(s)
 *             if not results:             # <<<<<<<<<<<<<<
 *                 return ()
 *         else:
*/
    }

    /* "src/lxml/extensions.pxi":510
 *         s = self._make_string(s)
 *         rexpc = self._compile(rexp, 'i' in flags)
 *         if 'g' in flags:             # <<<<<<<<<<<<<<
 *             results = rexpc.findall(s)
 *             if not results:
*/
    goto __pyx_L3;
  }

  /* "src/lxml/extensions.pxi":515
 *                 return ()
 *         else:
 *             result = rexpc.search(s)             # <<<<<<<<<<<<<<
 *             if not result:
 *                 return ()
*/
  /*else*/ {
    __pyx_t_1 = __pyx_v_rexpc;
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_4 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_v_s};
      __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_search, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(18, 515, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __pyx_v_result = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "src/lxml/extensions.pxi":516
 *         else:
 *             result = rexpc.search(s)
 *             if not result:             # <<<<<<<<<<<<<<
 *                 return ()
 *             results = [ result.group() ]
*/
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_result); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(18, 516, __pyx_L1_error)
    __pyx_t_2 = (!__pyx_t_5);
    if (__pyx_t_2) {

      /* "src/lxml/extensions.pxi":517
 *             result = rexpc.search(s)
 *             if not result:
 *                 return ()             # <<<<<<<<<<<<<<
 *             results = [ result.group() ]
 *             results.extend( result.groups('') )
*/
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_mstate_global->__pyx_empty_tuple);
      __pyx_r = __pyx_mstate_global->__pyx_empty_tuple;
      goto __pyx_L0;

      /* "src/lxml/extensions.pxi":516
 *         else:
 *             result = rexpc.search(s)
 *             if not result:             # <<<<<<<<<<<<<<
 *                 return ()
 *             results = [ result.group() ]
*/
    }

    /* "src/lxml/extensions.pxi":518
 *             if not result:
 *                 return ()
 *             results = [ result.group() ]             # <<<<<<<<<<<<<<
 *             results.extend( result.groups('') )
 *         result_list = []
*/
    __pyx_t_1 = __pyx_v_result;
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_4 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL};
      __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_group, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(18, 518, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 518, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_3);
    if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_3) != (0)) __PYX_ERR(18, 518, __pyx_L1_error);
    __pyx_t_3 = 0;
    __pyx_v_results = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "src/lxml/extensions.pxi":519
 *                 return ()
 *             results = [ result.group() ]
 *             results.extend( result.groups('') )             # <<<<<<<<<<<<<<
 *         result_list = []
 *         root = Element('matches')
*/
    __pyx_t_3 = __pyx_v_results;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_7 = __pyx_v_result;
    __Pyx_INCREF(__pyx_t_7);
    __pyx_t_4 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_mstate_global->__pyx_kp_u__8};
      __pyx_t_6 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_groups, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(18, 519, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
    }
    __pyx_t_4 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_6};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_extend, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 519, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __pyx_L3:;

  /* "src/lxml/extensions.pxi":520
 *             results = [ result.group() ]
 *             results.extend( result.groups('') )
 *         result_list = []             # <<<<<<<<<<<<<<
 *         root = Element('matches')
 *         for s_match in results:
*/
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 520, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_result_list = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":521
 *             results.extend( result.groups('') )
 *         result_list = []
 *         root = Element('matches')             # <<<<<<<<<<<<<<
 *         for s_match in results:
 *             if python.PyTuple_CheckExact(s_match):
*/
  __pyx_t_6 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_Element_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(18, 521, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_6);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_6);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_4 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_n_u_matches};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 521, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v_root = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":522
 *         result_list = []
 *         root = Element('matches')
 *         for s_match in results:             # <<<<<<<<<<<<<<
 *             if python.PyTuple_CheckExact(s_match):
 *                 s_match = ''.join(s_match)
*/
  if (likely(PyList_CheckExact(__pyx_v_results)) || PyTuple_CheckExact(__pyx_v_results)) {
    __pyx_t_1 = __pyx_v_results; __Pyx_INCREF(__pyx_t_1);
    __pyx_t_8 = 0;
    __pyx_t_9 = NULL;
  } else {
    __pyx_t_8 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_results); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 522, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(18, 522, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_9)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(18, 522, __pyx_L1_error)
          #endif
          if (__pyx_t_8 >= __pyx_temp) break;
        }
        __pyx_t_3 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_8, __Pyx_ReferenceSharing_OwnStrongReference);
        ++__pyx_t_8;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(18, 522, __pyx_L1_error)
          #endif
          if (__pyx_t_8 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_8));
        #else
        __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_8);
        #endif
        ++__pyx_t_8;
      }
      if (unlikely(!__pyx_t_3)) __PYX_ERR(18, 522, __pyx_L1_error)
    } else {
      __pyx_t_3 = __pyx_t_9(__pyx_t_1);
      if (unlikely(!__pyx_t_3)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(18, 522, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_s_match, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/extensions.pxi":523
 *         root = Element('matches')
 *         for s_match in results:
 *             if python.PyTuple_CheckExact(s_match):             # <<<<<<<<<<<<<<
 *                 s_match = ''.join(s_match)
 *             elem = SubElement(root, 'match')
*/
    __pyx_t_2 = PyTuple_CheckExact(__pyx_v_s_match);
    if (__pyx_t_2) {

      /* "src/lxml/extensions.pxi":524
 *         for s_match in results:
 *             if python.PyTuple_CheckExact(s_match):
 *                 s_match = ''.join(s_match)             # <<<<<<<<<<<<<<
 *             elem = SubElement(root, 'match')
 *             elem.text = s_match
*/
      __pyx_t_3 = PyUnicode_Join(__pyx_mstate_global->__pyx_kp_u__8, __pyx_v_s_match); if (unlikely(!__pyx_t_3)) __PYX_ERR(18, 524, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_s_match, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "src/lxml/extensions.pxi":523
 *         root = Element('matches')
 *         for s_match in results:
 *             if python.PyTuple_CheckExact(s_match):             # <<<<<<<<<<<<<<
 *                 s_match = ''.join(s_match)
 *             elem = SubElement(root, 'match')
*/
    }

    /* "src/lxml/extensions.pxi":525
 *             if python.PyTuple_CheckExact(s_match):
 *                 s_match = ''.join(s_match)
 *             elem = SubElement(root, 'match')             # <<<<<<<<<<<<<<
 *             elem.text = s_match
 *             result_list.append(elem)
*/
    __pyx_t_6 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_SubElement); if (unlikely(!__pyx_t_7)) __PYX_ERR(18, 525, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
      assert(__pyx_t_6);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_v_root, __pyx_mstate_global->__pyx_n_u_match};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(18, 525, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_XDECREF_SET(__pyx_v_elem, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/extensions.pxi":526
 *                 s_match = ''.join(s_match)
 *             elem = SubElement(root, 'match')
 *             elem.text = s_match             # <<<<<<<<<<<<<<
 *             result_list.append(elem)
 *         return result_list
*/
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_elem, __pyx_mstate_global->__pyx_n_u_text, __pyx_v_s_match) < (0)) __PYX_ERR(18, 526, __pyx_L1_error)

    /* "src/lxml/extensions.pxi":527
 *             elem = SubElement(root, 'match')
 *             elem.text = s_match
 *             result_list.append(elem)             # <<<<<<<<<<<<<<
 *         return result_list
 * 
*/
    __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_result_list, __pyx_v_elem); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(18, 527, __pyx_L1_error)

    /* "src/lxml/extensions.pxi":522
 *         result_list = []
 *         root = Element('matches')
 *         for s_match in results:             # <<<<<<<<<<<<<<
 *             if python.PyTuple_CheckExact(s_match):
 *                 s_match = ''.join(s_match)
*/
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":528
 *             elem.text = s_match
 *             result_list.append(elem)
 *         return result_list             # <<<<<<<<<<<<<<
 * 
 *     def replace(self, ctxt, s, rexp, flags, replacement):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result_list);
  __pyx_r = __pyx_v_result_list;
  goto __pyx_L0;

  /* "src/lxml/extensions.pxi":505
 *             return True
 * 
 *     def match(self, ctxt, s, rexp, flags=''):             # <<<<<<<<<<<<<<
 *         cdef list result_list
 *         flags = self._make_string(flags)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree._ExsltRegExp.match", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_result_list);
  __Pyx_XDECREF(__pyx_v_rexpc);
  __Pyx_XDECREF(__pyx_v_results);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_root);
  __Pyx_XDECREF(__pyx_v_s_match);
  __Pyx_XDECREF(__pyx_v_elem);
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XDECREF(__pyx_v_flags);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/extensions.pxi":530
 *         return result_list
 * 
 *     def replace(self, ctxt, s, rexp, flags, replacement):             # <<<<<<<<<<<<<<
 *         replacement = self._make_string(replacement)
 *         flags = self._make_string(flags)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ExsltRegExp_7replace(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_12_ExsltRegExp_7replace = {"replace", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ExsltRegExp_7replace, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_12_ExsltRegExp_7replace(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_ctxt = 0;
  PyObject *__pyx_v_s = 0;
  PyObject *__pyx_v_rexp = 0;
  PyObject *__pyx_v_flags = 0;
  PyObject *__pyx_v_replacement = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[5] = {0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("replace (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_ctxt,&__pyx_mstate_global->__pyx_n_u_s_4,&__pyx_mstate_global->__pyx_n_u_rexp,&__pyx_mstate_global->__pyx_n_u_flags,&__pyx_mstate_global->__pyx_n_u_replacement,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(18, 530, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(18, 530, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(18, 530, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(18, 530, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(18, 530, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(18, 530, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "replace", 0) < (0)) __PYX_ERR(18, 530, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 5; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("replace", 1, 5, 5, i); __PYX_ERR(18, 530, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 5)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(18, 530, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(18, 530, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(18, 530, __pyx_L3_error)
      values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(18, 530, __pyx_L3_error)
      values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(18, 530, __pyx_L3_error)
    }
    __pyx_v_ctxt = values[0];
    __pyx_v_s = values[1];
    __pyx_v_rexp = values[2];
    __pyx_v_flags = values[3];
    __pyx_v_replacement = values[4];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("replace", 1, 5, 5, __pyx_nargs); __PYX_ERR(18, 530, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._ExsltRegExp.replace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_12_ExsltRegExp_6replace(((struct __pyx_obj_4lxml_5etree__ExsltRegExp *)__pyx_v_self), __pyx_v_ctxt, __pyx_v_s, __pyx_v_rexp, __pyx_v_flags, __pyx_v_replacement);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_12_ExsltRegExp_6replace(struct __pyx_obj_4lxml_5etree__ExsltRegExp *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_ctxt, PyObject *__pyx_v_s, PyObject *__pyx_v_rexp, PyObject *__pyx_v_flags, PyObject *__pyx_v_replacement) {
  PyObject *__pyx_v_rexpc = NULL;
  PyObject *__pyx_v_count = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("replace", 0);
  __Pyx_INCREF(__pyx_v_s);
  __Pyx_INCREF(__pyx_v_flags);
  __Pyx_INCREF(__pyx_v_replacement);

  /* "src/lxml/extensions.pxi":531
 * 
 *     def replace(self, ctxt, s, rexp, flags, replacement):
 *         replacement = self._make_string(replacement)             # <<<<<<<<<<<<<<
 *         flags = self._make_string(flags)
 *         s = self._make_string(s)
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_12_ExsltRegExp__make_string(__pyx_v_self, __pyx_v_replacement); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 531, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_replacement, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":532
 *     def replace(self, ctxt, s, rexp, flags, replacement):
 *         replacement = self._make_string(replacement)
 *         flags = self._make_string(flags)             # <<<<<<<<<<<<<<
 *         s = self._make_string(s)
 *         rexpc = self._compile(rexp, 'i' in flags)
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_12_ExsltRegExp__make_string(__pyx_v_self, __pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 532, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_flags, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":533
 *         replacement = self._make_string(replacement)
 *         flags = self._make_string(flags)
 *         s = self._make_string(s)             # <<<<<<<<<<<<<<
 *         rexpc = self._compile(rexp, 'i' in flags)
 *         count: object = 0 if 'g' in flags else 1
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_12_ExsltRegExp__make_string(__pyx_v_self, __pyx_v_s); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 533, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":534
 *         flags = self._make_string(flags)
 *         s = self._make_string(s)
 *         rexpc = self._compile(rexp, 'i' in flags)             # <<<<<<<<<<<<<<
 *         count: object = 0 if 'g' in flags else 1
 *         return rexpc.sub(replacement, s, count)
*/
  __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_mstate_global->__pyx_n_u_i, __pyx_v_flags, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(18, 534, __pyx_L1_error)
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 534, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __pyx_f_4lxml_5etree_12_ExsltRegExp__compile(__pyx_v_self, __pyx_v_rexp, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(18, 534, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_rexpc = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "src/lxml/extensions.pxi":535
 *         s = self._make_string(s)
 *         rexpc = self._compile(rexp, 'i' in flags)
 *         count: object = 0 if 'g' in flags else 1             # <<<<<<<<<<<<<<
 *         return rexpc.sub(replacement, s, count)
 * 
*/
  __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_mstate_global->__pyx_n_u_g, __pyx_v_flags, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(18, 535, __pyx_L1_error)
  if (__pyx_t_2) {
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0);
    __pyx_t_3 = __pyx_mstate_global->__pyx_int_0;
  } else {
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_1);
    __pyx_t_3 = __pyx_mstate_global->__pyx_int_1;
  }
  __pyx_v_count = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "src/lxml/extensions.pxi":536
 *         rexpc = self._compile(rexp, 'i' in flags)
 *         count: object = 0 if 'g' in flags else 1
 *         return rexpc.sub(replacement, s, count)             # <<<<<<<<<<<<<<
 * 
 *     cdef _register_in_context(self, _BaseContext context):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_v_rexpc;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[4] = {__pyx_t_1, __pyx_v_replacement, __pyx_v_s, __pyx_v_count};
    __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_sub, __pyx_callargs+__pyx_t_4, (4-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(18, 536, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "src/lxml/extensions.pxi":530
 *         return result_list
 * 
 *     def replace(self, ctxt, s, rexp, flags, replacement):             # <<<<<<<<<<<<<<
 *         replacement = self._make_string(replacement)
 *         flags = self._make_string(flags)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._ExsltRegExp.replace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rexpc);
  __Pyx_XDECREF(__pyx_v_count);
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XDECREF(__pyx_v_flags);
  __Pyx_XDECREF(__pyx_v_replacement);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/extensions.pxi":538
 *         return rexpc.sub(replacement, s, count)
 * 
 *     cdef _register_in_context(self, _BaseContext context):             # <<<<<<<<<<<<<<
 *         ns = b"http://exslt.org/regular-expressions"
 *         context._addLocalExtensionFunction(ns, b"test",    self.test)
*/

static PyObject *__pyx_f_4lxml_5etree_12_ExsltRegExp__register_in_context(struct __pyx_obj_4lxml_5etree__ExsltRegExp *__pyx_v_self, struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_context) {
  PyObject *__pyx_v_ns = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_register_in_context", 0);

  /* "src/lxml/extensions.pxi":539
 * 
 *     cdef _register_in_context(self, _BaseContext context):
 *         ns = b"http://exslt.org/regular-expressions"             # <<<<<<<<<<<<<<
 *         context._addLocalExtensionFunction(ns, b"test",    self.test)
 *         context._addLocalExtensionFunction(ns, b"match",   self.match)
*/
  __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_b_http_exslt_org_regular_expressio);
  __pyx_v_ns = __pyx_mstate_global->__pyx_kp_b_http_exslt_org_regular_expressio;

  /* "src/lxml/extensions.pxi":540
 *     cdef _register_in_context(self, _BaseContext context):
 *         ns = b"http://exslt.org/regular-expressions"
 *         context._addLocalExtensionFunction(ns, b"test",    self.test)             # <<<<<<<<<<<<<<
 *         context._addLocalExtensionFunction(ns, b"match",   self.match)
 *         context._addLocalExtensionFunction(ns, b"replace", self.replace)
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_test); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 540, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseContext *)__pyx_v_context->__pyx_vtab)->_addLocalExtensionFunction(__pyx_v_context, __pyx_v_ns, __pyx_mstate_global->__pyx_n_b_test, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(18, 540, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":541
 *         ns = b"http://exslt.org/regular-expressions"
 *         context._addLocalExtensionFunction(ns, b"test",    self.test)
 *         context._addLocalExtensionFunction(ns, b"match",   self.match)             # <<<<<<<<<<<<<<
 *         context._addLocalExtensionFunction(ns, b"replace", self.replace)
 * 
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_match); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 541, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseContext *)__pyx_v_context->__pyx_vtab)->_addLocalExtensionFunction(__pyx_v_context, __pyx_v_ns, __pyx_mstate_global->__pyx_n_b_match, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(18, 541, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":542
 *         context._addLocalExtensionFunction(ns, b"test",    self.test)
 *         context._addLocalExtensionFunction(ns, b"match",   self.match)
 *         context._addLocalExtensionFunction(ns, b"replace", self.replace)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_replace); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 542, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseContext *)__pyx_v_context->__pyx_vtab)->_addLocalExtensionFunction(__pyx_v_context, __pyx_v_ns, __pyx_mstate_global->__pyx_n_b_replace, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(18, 542, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":538
 *         return rexpc.sub(replacement, s, count)
 * 
 *     cdef _register_in_context(self, _BaseContext context):             # <<<<<<<<<<<<<<
 *         ns = b"http://exslt.org/regular-expressions"
 *         context._addLocalExtensionFunction(ns, b"test",    self.test)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ExsltRegExp._register_in_context", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ns);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/extensions.pxi":548
 * # helper functions
 * 
 * cdef xpath.xmlXPathObject* _wrapXPathObject(object obj, _Document doc,             # <<<<<<<<<<<<<<
 *                                             _BaseContext context) except NULL:
 *     cdef xpath.xmlNodeSet* resultSet
*/

static xmlXPathObject *__pyx_f_4lxml_5etree__wrapXPathObject(PyObject *__pyx_v_obj, struct LxmlDocument *__pyx_v_doc, struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_context) {
  xmlNodeSet *__pyx_v_resultSet;
  struct LxmlElement *__pyx_v_fake_node = 0;
  xmlNode *__pyx_v_c_node;
  PyObject *__pyx_v_value = NULL;
  xmlXPathObject *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  double __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  Py_ssize_t __pyx_t_8;
  PyObject *(*__pyx_t_9)(PyObject *);
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  const char *__pyx_t_13;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_wrapXPathObject", 0);
  __Pyx_INCREF(__pyx_v_obj);

  /* "src/lxml/extensions.pxi":551
 *                                             _BaseContext context) except NULL:
 *     cdef xpath.xmlNodeSet* resultSet
 *     cdef _Element fake_node = None             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 * 
*/
  __Pyx_INCREF(Py_None);
  __pyx_v_fake_node = ((struct LxmlElement *)Py_None);

  /* "src/lxml/extensions.pxi":554
 *     cdef xmlNode* c_node
 * 
 *     if isinstance(obj, unicode):             # <<<<<<<<<<<<<<
 *         obj = _utf8(obj)
 *     if isinstance(obj, bytes):
*/
  __pyx_t_1 = PyUnicode_Check(__pyx_v_obj); 
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":555
 * 
 *     if isinstance(obj, unicode):
 *         obj = _utf8(obj)             # <<<<<<<<<<<<<<
 *     if isinstance(obj, bytes):
 *         # libxml2 copies the string value
*/
    __pyx_t_2 = __pyx_f_4lxml_5etree__utf8(__pyx_v_obj); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 555, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/extensions.pxi":554
 *     cdef xmlNode* c_node
 * 
 *     if isinstance(obj, unicode):             # <<<<<<<<<<<<<<
 *         obj = _utf8(obj)
 *     if isinstance(obj, bytes):
*/
  }

  /* "src/lxml/extensions.pxi":556
 *     if isinstance(obj, unicode):
 *         obj = _utf8(obj)
 *     if isinstance(obj, bytes):             # <<<<<<<<<<<<<<
 *         # libxml2 copies the string value
 *         return xpath.xmlXPathNewCString(_cstr(obj))
*/
  __pyx_t_1 = PyBytes_Check(__pyx_v_obj); 
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":558
 *     if isinstance(obj, bytes):
 *         # libxml2 copies the string value
 *         return xpath.xmlXPathNewCString(_cstr(obj))             # <<<<<<<<<<<<<<
 *     if isinstance(obj, bool):
 *         return xpath.xmlXPathNewBoolean(obj)
*/
    __pyx_r = xmlXPathNewCString(PyBytes_AS_STRING(__pyx_v_obj));
    goto __pyx_L0;

    /* "src/lxml/extensions.pxi":556
 *     if isinstance(obj, unicode):
 *         obj = _utf8(obj)
 *     if isinstance(obj, bytes):             # <<<<<<<<<<<<<<
 *         # libxml2 copies the string value
 *         return xpath.xmlXPathNewCString(_cstr(obj))
*/
  }

  /* "src/lxml/extensions.pxi":559
 *         # libxml2 copies the string value
 *         return xpath.xmlXPathNewCString(_cstr(obj))
 *     if isinstance(obj, bool):             # <<<<<<<<<<<<<<
 *         return xpath.xmlXPathNewBoolean(obj)
 *     if python.PyNumber_Check(obj):
*/
  __pyx_t_1 = PyBool_Check(__pyx_v_obj); 
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":560
 *         return xpath.xmlXPathNewCString(_cstr(obj))
 *     if isinstance(obj, bool):
 *         return xpath.xmlXPathNewBoolean(obj)             # <<<<<<<<<<<<<<
 *     if python.PyNumber_Check(obj):
 *         return xpath.xmlXPathNewFloat(obj)
*/
    __pyx_t_3 = __Pyx_PyLong_As_int(__pyx_v_obj); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(18, 560, __pyx_L1_error)
    __pyx_r = xmlXPathNewBoolean(__pyx_t_3);
    goto __pyx_L0;

    /* "src/lxml/extensions.pxi":559
 *         # libxml2 copies the string value
 *         return xpath.xmlXPathNewCString(_cstr(obj))
 *     if isinstance(obj, bool):             # <<<<<<<<<<<<<<
 *         return xpath.xmlXPathNewBoolean(obj)
 *     if python.PyNumber_Check(obj):
*/
  }

  /* "src/lxml/extensions.pxi":561
 *     if isinstance(obj, bool):
 *         return xpath.xmlXPathNewBoolean(obj)
 *     if python.PyNumber_Check(obj):             # <<<<<<<<<<<<<<
 *         return xpath.xmlXPathNewFloat(obj)
 *     if obj is None:
*/
  __pyx_t_1 = PyNumber_Check(__pyx_v_obj);
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":562
 *         return xpath.xmlXPathNewBoolean(obj)
 *     if python.PyNumber_Check(obj):
 *         return xpath.xmlXPathNewFloat(obj)             # <<<<<<<<<<<<<<
 *     if obj is None:
 *         resultSet = xpath.xmlXPathNodeSetCreate(NULL)
*/
    __pyx_t_4 = __Pyx_PyFloat_AsDouble(__pyx_v_obj); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) __PYX_ERR(18, 562, __pyx_L1_error)
    __pyx_r = xmlXPathNewFloat(__pyx_t_4);
    goto __pyx_L0;

    /* "src/lxml/extensions.pxi":561
 *     if isinstance(obj, bool):
 *         return xpath.xmlXPathNewBoolean(obj)
 *     if python.PyNumber_Check(obj):             # <<<<<<<<<<<<<<
 *         return xpath.xmlXPathNewFloat(obj)
 *     if obj is None:
*/
  }

  /* "src/lxml/extensions.pxi":563
 *     if python.PyNumber_Check(obj):
 *         return xpath.xmlXPathNewFloat(obj)
 *     if obj is None:             # <<<<<<<<<<<<<<
 *         resultSet = xpath.xmlXPathNodeSetCreate(NULL)
 *     elif isinstance(obj, _Element):
*/
  __pyx_t_1 = (__pyx_v_obj == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":564
 *         return xpath.xmlXPathNewFloat(obj)
 *     if obj is None:
 *         resultSet = xpath.xmlXPathNodeSetCreate(NULL)             # <<<<<<<<<<<<<<
 *     elif isinstance(obj, _Element):
 *         resultSet = xpath.xmlXPathNodeSetCreate((<_Element>obj)._c_node)
*/
    __pyx_v_resultSet = xmlXPathNodeSetCreate(NULL);

    /* "src/lxml/extensions.pxi":563
 *     if python.PyNumber_Check(obj):
 *         return xpath.xmlXPathNewFloat(obj)
 *     if obj is None:             # <<<<<<<<<<<<<<
 *         resultSet = xpath.xmlXPathNodeSetCreate(NULL)
 *     elif isinstance(obj, _Element):
*/
    goto __pyx_L7;
  }

  /* "src/lxml/extensions.pxi":565
 *     if obj is None:
 *         resultSet = xpath.xmlXPathNodeSetCreate(NULL)
 *     elif isinstance(obj, _Element):             # <<<<<<<<<<<<<<
 *         resultSet = xpath.xmlXPathNodeSetCreate((<_Element>obj)._c_node)
 *     elif python.PySequence_Check(obj):
*/
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element); 
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":566
 *         resultSet = xpath.xmlXPathNodeSetCreate(NULL)
 *     elif isinstance(obj, _Element):
 *         resultSet = xpath.xmlXPathNodeSetCreate((<_Element>obj)._c_node)             # <<<<<<<<<<<<<<
 *     elif python.PySequence_Check(obj):
 *         resultSet = xpath.xmlXPathNodeSetCreate(NULL)
*/
    __pyx_v_resultSet = xmlXPathNodeSetCreate(((struct LxmlElement *)__pyx_v_obj)->_c_node);

    /* "src/lxml/extensions.pxi":565
 *     if obj is None:
 *         resultSet = xpath.xmlXPathNodeSetCreate(NULL)
 *     elif isinstance(obj, _Element):             # <<<<<<<<<<<<<<
 *         resultSet = xpath.xmlXPathNodeSetCreate((<_Element>obj)._c_node)
 *     elif python.PySequence_Check(obj):
*/
    goto __pyx_L7;
  }

  /* "src/lxml/extensions.pxi":567
 *     elif isinstance(obj, _Element):
 *         resultSet = xpath.xmlXPathNodeSetCreate((<_Element>obj)._c_node)
 *     elif python.PySequence_Check(obj):             # <<<<<<<<<<<<<<
 *         resultSet = xpath.xmlXPathNodeSetCreate(NULL)
 *         try:
*/
  __pyx_t_1 = PySequence_Check(__pyx_v_obj);
  if (likely(__pyx_t_1)) {

    /* "src/lxml/extensions.pxi":568
 *         resultSet = xpath.xmlXPathNodeSetCreate((<_Element>obj)._c_node)
 *     elif python.PySequence_Check(obj):
 *         resultSet = xpath.xmlXPathNodeSetCreate(NULL)             # <<<<<<<<<<<<<<
 *         try:
 *             for value in obj:
*/
    __pyx_v_resultSet = xmlXPathNodeSetCreate(NULL);

    /* "src/lxml/extensions.pxi":569
 *     elif python.PySequence_Check(obj):
 *         resultSet = xpath.xmlXPathNodeSetCreate(NULL)
 *         try:             # <<<<<<<<<<<<<<
 *             for value in obj:
 *                 if isinstance(value, _Element):
*/
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);
      /*try:*/ {

        /* "src/lxml/extensions.pxi":570
 *         resultSet = xpath.xmlXPathNodeSetCreate(NULL)
 *         try:
 *             for value in obj:             # <<<<<<<<<<<<<<
 *                 if isinstance(value, _Element):
 *                     if context is not None:
*/
        if (likely(PyList_CheckExact(__pyx_v_obj)) || PyTuple_CheckExact(__pyx_v_obj)) {
          __pyx_t_2 = __pyx_v_obj; __Pyx_INCREF(__pyx_t_2);
          __pyx_t_8 = 0;
          __pyx_t_9 = NULL;
        } else {
          __pyx_t_8 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_obj); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 570, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_9 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(18, 570, __pyx_L8_error)
        }
        for (;;) {
          if (likely(!__pyx_t_9)) {
            if (likely(PyList_CheckExact(__pyx_t_2))) {
              {
                Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
                #if !CYTHON_ASSUME_SAFE_SIZE
                if (unlikely((__pyx_temp < 0))) __PYX_ERR(18, 570, __pyx_L8_error)
                #endif
                if (__pyx_t_8 >= __pyx_temp) break;
              }
              __pyx_t_10 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_8, __Pyx_ReferenceSharing_OwnStrongReference);
              ++__pyx_t_8;
            } else {
              {
                Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2);
                #if !CYTHON_ASSUME_SAFE_SIZE
                if (unlikely((__pyx_temp < 0))) __PYX_ERR(18, 570, __pyx_L8_error)
                #endif
                if (__pyx_t_8 >= __pyx_temp) break;
              }
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_10 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_8));
              #else
              __pyx_t_10 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_8);
              #endif
              ++__pyx_t_8;
            }
            if (unlikely(!__pyx_t_10)) __PYX_ERR(18, 570, __pyx_L8_error)
          } else {
            __pyx_t_10 = __pyx_t_9(__pyx_t_2);
            if (unlikely(!__pyx_t_10)) {
              PyObject* exc_type = PyErr_Occurred();
              if (exc_type) {
                if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(18, 570, __pyx_L8_error)
                PyErr_Clear();
              }
              break;
            }
          }
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_10);
          __pyx_t_10 = 0;

          /* "src/lxml/extensions.pxi":571
 *         try:
 *             for value in obj:
 *                 if isinstance(value, _Element):             # <<<<<<<<<<<<<<
 *                     if context is not None:
 *                         context._hold(value)
*/
          __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_value, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element); 
          if (__pyx_t_1) {

            /* "src/lxml/extensions.pxi":572
 *             for value in obj:
 *                 if isinstance(value, _Element):
 *                     if context is not None:             # <<<<<<<<<<<<<<
 *                         context._hold(value)
 *                     xpath.xmlXPathNodeSetAdd(resultSet, (<_Element>value)._c_node)
*/
            __pyx_t_1 = (((PyObject *)__pyx_v_context) != Py_None);
            if (__pyx_t_1) {

              /* "src/lxml/extensions.pxi":573
 *                 if isinstance(value, _Element):
 *                     if context is not None:
 *                         context._hold(value)             # <<<<<<<<<<<<<<
 *                     xpath.xmlXPathNodeSetAdd(resultSet, (<_Element>value)._c_node)
 *                 else:
*/
              __pyx_t_10 = __pyx_f_4lxml_5etree_12_BaseContext__hold(__pyx_v_context, __pyx_v_value); if (unlikely(!__pyx_t_10)) __PYX_ERR(18, 573, __pyx_L8_error)
              __Pyx_GOTREF(__pyx_t_10);
              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

              /* "src/lxml/extensions.pxi":572
 *             for value in obj:
 *                 if isinstance(value, _Element):
 *                     if context is not None:             # <<<<<<<<<<<<<<
 *                         context._hold(value)
 *                     xpath.xmlXPathNodeSetAdd(resultSet, (<_Element>value)._c_node)
*/
            }

            /* "src/lxml/extensions.pxi":574
 *                     if context is not None:
 *                         context._hold(value)
 *                     xpath.xmlXPathNodeSetAdd(resultSet, (<_Element>value)._c_node)             # <<<<<<<<<<<<<<
 *                 else:
 *                     if context is None or doc is None:
*/
            xmlXPathNodeSetAdd(__pyx_v_resultSet, ((struct LxmlElement *)__pyx_v_value)->_c_node);

            /* "src/lxml/extensions.pxi":571
 *         try:
 *             for value in obj:
 *                 if isinstance(value, _Element):             # <<<<<<<<<<<<<<
 *                     if context is not None:
 *                         context._hold(value)
*/
            goto __pyx_L16;
          }

          /* "src/lxml/extensions.pxi":576
 *                     xpath.xmlXPathNodeSetAdd(resultSet, (<_Element>value)._c_node)
 *                 else:
 *                     if context is None or doc is None:             # <<<<<<<<<<<<<<
 *                         raise XPathResultError, \
 *                               f"Non-Element values not supported at this point - got {value!r}"
*/
          /*else*/ {
            __pyx_t_11 = (((PyObject *)__pyx_v_context) == Py_None);
            if (!__pyx_t_11) {
            } else {
              __pyx_t_1 = __pyx_t_11;
              goto __pyx_L19_bool_binop_done;
            }
            __pyx_t_11 = (((PyObject *)__pyx_v_doc) == Py_None);
            __pyx_t_1 = __pyx_t_11;
            __pyx_L19_bool_binop_done:;
            if (unlikely(__pyx_t_1)) {

              /* "src/lxml/extensions.pxi":578
 *                     if context is None or doc is None:
 *                         raise XPathResultError, \
 *                               f"Non-Element values not supported at this point - got {value!r}"             # <<<<<<<<<<<<<<
 *                     # support strings by appending text nodes to an Element
 *                     if isinstance(value, unicode):
*/
              __pyx_t_10 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_value), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_10)) __PYX_ERR(18, 578, __pyx_L8_error)
              __Pyx_GOTREF(__pyx_t_10);
              __pyx_t_12 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_Non_Element_values_not_supported, __pyx_t_10); if (unlikely(!__pyx_t_12)) __PYX_ERR(18, 578, __pyx_L8_error)
              __Pyx_GOTREF(__pyx_t_12);
              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
              __Pyx_Raise(((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XPathResultError), __pyx_t_12, 0, 0);
              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
              __PYX_ERR(18, 577, __pyx_L8_error)

              /* "src/lxml/extensions.pxi":576
 *                     xpath.xmlXPathNodeSetAdd(resultSet, (<_Element>value)._c_node)
 *                 else:
 *                     if context is None or doc is None:             # <<<<<<<<<<<<<<
 *                         raise XPathResultError, \
 *                               f"Non-Element values not supported at this point - got {value!r}"
*/
            }

            /* "src/lxml/extensions.pxi":580
 *                               f"Non-Element values not supported at this point - got {value!r}"
 *                     # support strings by appending text nodes to an Element
 *                     if isinstance(value, unicode):             # <<<<<<<<<<<<<<
 *                         value = _utf8(value)
 *                     if isinstance(value, bytes):
*/
            __pyx_t_1 = PyUnicode_Check(__pyx_v_value); 
            if (__pyx_t_1) {

              /* "src/lxml/extensions.pxi":581
 *                     # support strings by appending text nodes to an Element
 *                     if isinstance(value, unicode):
 *                         value = _utf8(value)             # <<<<<<<<<<<<<<
 *                     if isinstance(value, bytes):
 *                         if fake_node is None:
*/
              __pyx_t_12 = __pyx_f_4lxml_5etree__utf8(__pyx_v_value); if (unlikely(!__pyx_t_12)) __PYX_ERR(18, 581, __pyx_L8_error)
              __Pyx_GOTREF(__pyx_t_12);
              __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_12);
              __pyx_t_12 = 0;

              /* "src/lxml/extensions.pxi":580
 *                               f"Non-Element values not supported at this point - got {value!r}"
 *                     # support strings by appending text nodes to an Element
 *                     if isinstance(value, unicode):             # <<<<<<<<<<<<<<
 *                         value = _utf8(value)
 *                     if isinstance(value, bytes):
*/
            }

            /* "src/lxml/extensions.pxi":582
 *                     if isinstance(value, unicode):
 *                         value = _utf8(value)
 *                     if isinstance(value, bytes):             # <<<<<<<<<<<<<<
 *                         if fake_node is None:
 *                             fake_node = _makeElement("text-root", NULL, doc, None,
*/
            __pyx_t_1 = PyBytes_Check(__pyx_v_value); 
            if (likely(__pyx_t_1)) {

              /* "src/lxml/extensions.pxi":583
 *                         value = _utf8(value)
 *                     if isinstance(value, bytes):
 *                         if fake_node is None:             # <<<<<<<<<<<<<<
 *                             fake_node = _makeElement("text-root", NULL, doc, None,
 *                                                      None, None, None, None, None)
*/
              __pyx_t_1 = (((PyObject *)__pyx_v_fake_node) == Py_None);
              if (__pyx_t_1) {

                /* "src/lxml/extensions.pxi":584
 *                     if isinstance(value, bytes):
 *                         if fake_node is None:
 *                             fake_node = _makeElement("text-root", NULL, doc, None,             # <<<<<<<<<<<<<<
 *                                                      None, None, None, None, None)
 *                             context._hold(fake_node)
*/
                __pyx_t_12 = ((PyObject *)__pyx_f_4lxml_5etree__makeElement(__pyx_mstate_global->__pyx_kp_u_text_root, NULL, __pyx_v_doc, ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None), Py_None, Py_None, Py_None, Py_None, ((PyObject*)Py_None))); if (unlikely(!__pyx_t_12)) __PYX_ERR(18, 584, __pyx_L8_error)
                __Pyx_GOTREF(__pyx_t_12);
                __Pyx_DECREF_SET(__pyx_v_fake_node, ((struct LxmlElement *)__pyx_t_12));
                __pyx_t_12 = 0;

                /* "src/lxml/extensions.pxi":586
 *                             fake_node = _makeElement("text-root", NULL, doc, None,
 *                                                      None, None, None, None, None)
 *                             context._hold(fake_node)             # <<<<<<<<<<<<<<
 *                         else:
 *                             # append a comment node to keep the text nodes separate
*/
                __pyx_t_12 = __pyx_f_4lxml_5etree_12_BaseContext__hold(__pyx_v_context, ((PyObject *)__pyx_v_fake_node)); if (unlikely(!__pyx_t_12)) __PYX_ERR(18, 586, __pyx_L8_error)
                __Pyx_GOTREF(__pyx_t_12);
                __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

                /* "src/lxml/extensions.pxi":583
 *                         value = _utf8(value)
 *                     if isinstance(value, bytes):
 *                         if fake_node is None:             # <<<<<<<<<<<<<<
 *                             fake_node = _makeElement("text-root", NULL, doc, None,
 *                                                      None, None, None, None, None)
*/
                goto __pyx_L23;
              }

              /* "src/lxml/extensions.pxi":589
 *                         else:
 *                             # append a comment node to keep the text nodes separate
 *                             c_node = tree.xmlNewDocComment(doc._c_doc, <unsigned char*>"")             # <<<<<<<<<<<<<<
 *                             if c_node is NULL:
 *                                 raise MemoryError()
*/
              /*else*/ {
                __pyx_v_c_node = xmlNewDocComment(__pyx_v_doc->_c_doc, ((unsigned char *)((unsigned char *)((char *)""))));

                /* "src/lxml/extensions.pxi":590
 *                             # append a comment node to keep the text nodes separate
 *                             c_node = tree.xmlNewDocComment(doc._c_doc, <unsigned char*>"")
 *                             if c_node is NULL:             # <<<<<<<<<<<<<<
 *                                 raise MemoryError()
 *                             tree.xmlAddChild(fake_node._c_node, c_node)
*/
                __pyx_t_1 = (__pyx_v_c_node == NULL);
                if (unlikely(__pyx_t_1)) {

                  /* "src/lxml/extensions.pxi":591
 *                             c_node = tree.xmlNewDocComment(doc._c_doc, <unsigned char*>"")
 *                             if c_node is NULL:
 *                                 raise MemoryError()             # <<<<<<<<<<<<<<
 *                             tree.xmlAddChild(fake_node._c_node, c_node)
 *                         context._hold(value)
*/
                  PyErr_NoMemory(); __PYX_ERR(18, 591, __pyx_L8_error)

                  /* "src/lxml/extensions.pxi":590
 *                             # append a comment node to keep the text nodes separate
 *                             c_node = tree.xmlNewDocComment(doc._c_doc, <unsigned char*>"")
 *                             if c_node is NULL:             # <<<<<<<<<<<<<<
 *                                 raise MemoryError()
 *                             tree.xmlAddChild(fake_node._c_node, c_node)
*/
                }

                /* "src/lxml/extensions.pxi":592
 *                             if c_node is NULL:
 *                                 raise MemoryError()
 *                             tree.xmlAddChild(fake_node._c_node, c_node)             # <<<<<<<<<<<<<<
 *                         context._hold(value)
 *                         c_node = tree.xmlNewDocText(doc._c_doc, _xcstr(value))
*/
                (void)(xmlAddChild(__pyx_v_fake_node->_c_node, __pyx_v_c_node));
              }
              __pyx_L23:;

              /* "src/lxml/extensions.pxi":593
 *                                 raise MemoryError()
 *                             tree.xmlAddChild(fake_node._c_node, c_node)
 *                         context._hold(value)             # <<<<<<<<<<<<<<
 *                         c_node = tree.xmlNewDocText(doc._c_doc, _xcstr(value))
 *                         if c_node is NULL:
*/
              __pyx_t_12 = __pyx_f_4lxml_5etree_12_BaseContext__hold(__pyx_v_context, __pyx_v_value); if (unlikely(!__pyx_t_12)) __PYX_ERR(18, 593, __pyx_L8_error)
              __Pyx_GOTREF(__pyx_t_12);
              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

              /* "src/lxml/extensions.pxi":594
 *                             tree.xmlAddChild(fake_node._c_node, c_node)
 *                         context._hold(value)
 *                         c_node = tree.xmlNewDocText(doc._c_doc, _xcstr(value))             # <<<<<<<<<<<<<<
 *                         if c_node is NULL:
 *                             raise MemoryError()
*/
              __pyx_v_c_node = xmlNewDocText(__pyx_v_doc->_c_doc, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_value));

              /* "src/lxml/extensions.pxi":595
 *                         context._hold(value)
 *                         c_node = tree.xmlNewDocText(doc._c_doc, _xcstr(value))
 *                         if c_node is NULL:             # <<<<<<<<<<<<<<
 *                             raise MemoryError()
 *                         tree.xmlAddChild(fake_node._c_node, c_node)
*/
              __pyx_t_1 = (__pyx_v_c_node == NULL);
              if (unlikely(__pyx_t_1)) {

                /* "src/lxml/extensions.pxi":596
 *                         c_node = tree.xmlNewDocText(doc._c_doc, _xcstr(value))
 *                         if c_node is NULL:
 *                             raise MemoryError()             # <<<<<<<<<<<<<<
 *                         tree.xmlAddChild(fake_node._c_node, c_node)
 *                         xpath.xmlXPathNodeSetAdd(resultSet, c_node)
*/
                PyErr_NoMemory(); __PYX_ERR(18, 596, __pyx_L8_error)

                /* "src/lxml/extensions.pxi":595
 *                         context._hold(value)
 *                         c_node = tree.xmlNewDocText(doc._c_doc, _xcstr(value))
 *                         if c_node is NULL:             # <<<<<<<<<<<<<<
 *                             raise MemoryError()
 *                         tree.xmlAddChild(fake_node._c_node, c_node)
*/
              }

              /* "src/lxml/extensions.pxi":597
 *                         if c_node is NULL:
 *                             raise MemoryError()
 *                         tree.xmlAddChild(fake_node._c_node, c_node)             # <<<<<<<<<<<<<<
 *                         xpath.xmlXPathNodeSetAdd(resultSet, c_node)
 *                     else:
*/
              (void)(xmlAddChild(__pyx_v_fake_node->_c_node, __pyx_v_c_node));

              /* "src/lxml/extensions.pxi":598
 *                             raise MemoryError()
 *                         tree.xmlAddChild(fake_node._c_node, c_node)
 *                         xpath.xmlXPathNodeSetAdd(resultSet, c_node)             # <<<<<<<<<<<<<<
 *                     else:
 *                         raise XPathResultError, \
*/
              xmlXPathNodeSetAdd(__pyx_v_resultSet, __pyx_v_c_node);

              /* "src/lxml/extensions.pxi":582
 *                     if isinstance(value, unicode):
 *                         value = _utf8(value)
 *                     if isinstance(value, bytes):             # <<<<<<<<<<<<<<
 *                         if fake_node is None:
 *                             fake_node = _makeElement("text-root", NULL, doc, None,
*/
              goto __pyx_L22;
            }

            /* "src/lxml/extensions.pxi":600
 *                         xpath.xmlXPathNodeSetAdd(resultSet, c_node)
 *                     else:
 *                         raise XPathResultError, \             # <<<<<<<<<<<<<<
 *                               f"This is not a supported node-set result: {value!r}"
 *         except:
*/
            /*else*/ {

              /* "src/lxml/extensions.pxi":601
 *                     else:
 *                         raise XPathResultError, \
 *                               f"This is not a supported node-set result: {value!r}"             # <<<<<<<<<<<<<<
 *         except:
 *             xpath.xmlXPathFreeNodeSet(resultSet)
*/
              __pyx_t_12 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_value), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_12)) __PYX_ERR(18, 601, __pyx_L8_error)
              __Pyx_GOTREF(__pyx_t_12);
              __pyx_t_10 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_This_is_not_a_supported_node_set, __pyx_t_12); if (unlikely(!__pyx_t_10)) __PYX_ERR(18, 601, __pyx_L8_error)
              __Pyx_GOTREF(__pyx_t_10);
              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
              __Pyx_Raise(((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XPathResultError), __pyx_t_10, 0, 0);
              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
              __PYX_ERR(18, 600, __pyx_L8_error)
            }
            __pyx_L22:;
          }
          __pyx_L16:;

          /* "src/lxml/extensions.pxi":570
 *         resultSet = xpath.xmlXPathNodeSetCreate(NULL)
 *         try:
 *             for value in obj:             # <<<<<<<<<<<<<<
 *                 if isinstance(value, _Element):
 *                     if context is not None:
*/
        }
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "src/lxml/extensions.pxi":569
 *     elif python.PySequence_Check(obj):
 *         resultSet = xpath.xmlXPathNodeSetCreate(NULL)
 *         try:             # <<<<<<<<<<<<<<
 *             for value in obj:
 *                 if isinstance(value, _Element):
*/
      }
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L13_try_end;
      __pyx_L8_error:;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "src/lxml/extensions.pxi":602
 *                         raise XPathResultError, \
 *                               f"This is not a supported node-set result: {value!r}"
 *         except:             # <<<<<<<<<<<<<<
 *             xpath.xmlXPathFreeNodeSet(resultSet)
 *             raise
*/
      /*except:*/ {
        __Pyx_AddTraceback("lxml.etree._wrapXPathObject", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_10, &__pyx_t_12) < 0) __PYX_ERR(18, 602, __pyx_L10_except_error)
        __Pyx_XGOTREF(__pyx_t_2);
        __Pyx_XGOTREF(__pyx_t_10);
        __Pyx_XGOTREF(__pyx_t_12);

        /* "src/lxml/extensions.pxi":603
 *                               f"This is not a supported node-set result: {value!r}"
 *         except:
 *             xpath.xmlXPathFreeNodeSet(resultSet)             # <<<<<<<<<<<<<<
 *             raise
 *     else:
*/
        xmlXPathFreeNodeSet(__pyx_v_resultSet);

        /* "src/lxml/extensions.pxi":604
 *         except:
 *             xpath.xmlXPathFreeNodeSet(resultSet)
 *             raise             # <<<<<<<<<<<<<<
 *     else:
 *         raise XPathResultError, f"Unknown return type: {python._fqtypename(obj).decode('utf8')}"
*/
        __Pyx_GIVEREF(__pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_ErrRestoreWithState(__pyx_t_2, __pyx_t_10, __pyx_t_12);
        __pyx_t_2 = 0;  __pyx_t_10 = 0;  __pyx_t_12 = 0; 
        __PYX_ERR(18, 604, __pyx_L10_except_error)
      }

      /* "src/lxml/extensions.pxi":569
 *     elif python.PySequence_Check(obj):
 *         resultSet = xpath.xmlXPathNodeSetCreate(NULL)
 *         try:             # <<<<<<<<<<<<<<
 *             for value in obj:
 *                 if isinstance(value, _Element):
*/
      __pyx_L10_except_error:;
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
      goto __pyx_L1_error;
      __pyx_L13_try_end:;
    }

    /* "src/lxml/extensions.pxi":567
 *     elif isinstance(obj, _Element):
 *         resultSet = xpath.xmlXPathNodeSetCreate((<_Element>obj)._c_node)
 *     elif python.PySequence_Check(obj):             # <<<<<<<<<<<<<<
 *         resultSet = xpath.xmlXPathNodeSetCreate(NULL)
 *         try:
*/
    goto __pyx_L7;
  }

  /* "src/lxml/extensions.pxi":606
 *             raise
 *     else:
 *         raise XPathResultError, f"Unknown return type: {python._fqtypename(obj).decode('utf8')}"             # <<<<<<<<<<<<<<
 *     return xpath.xmlXPathWrapNodeSet(resultSet)
 * 
*/
  /*else*/ {
    __pyx_t_13 = _fqtypename(__pyx_v_obj);
    __pyx_t_8 = __Pyx_ssize_strlen(__pyx_t_13); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(18, 606, __pyx_L1_error)
    __pyx_t_12 = __Pyx_decode_c_string(__pyx_t_13, 0, __pyx_t_8, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_12)) __PYX_ERR(18, 606, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_10 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_Unknown_return_type, __pyx_t_12); if (unlikely(!__pyx_t_10)) __PYX_ERR(18, 606, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_Raise(((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XPathResultError), __pyx_t_10, 0, 0);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __PYX_ERR(18, 606, __pyx_L1_error)
  }
  __pyx_L7:;

  /* "src/lxml/extensions.pxi":607
 *     else:
 *         raise XPathResultError, f"Unknown return type: {python._fqtypename(obj).decode('utf8')}"
 *     return xpath.xmlXPathWrapNodeSet(resultSet)             # <<<<<<<<<<<<<<
 * 
 * cdef object _unwrapXPathObject(xpath.xmlXPathObject* xpathObj,
*/
  __pyx_r = xmlXPathWrapNodeSet(__pyx_v_resultSet);
  goto __pyx_L0;

  /* "src/lxml/extensions.pxi":548
 * # helper functions
 * 
 * cdef xpath.xmlXPathObject* _wrapXPathObject(object obj, _Document doc,             # <<<<<<<<<<<<<<
 *                                             _BaseContext context) except NULL:
 *     cdef xpath.xmlNodeSet* resultSet
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("lxml.etree._wrapXPathObject", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_fake_node);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XDECREF(__pyx_v_obj);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/extensions.pxi":609
 *     return xpath.xmlXPathWrapNodeSet(resultSet)
 * 
 * cdef object _unwrapXPathObject(xpath.xmlXPathObject* xpathObj,             # <<<<<<<<<<<<<<
 *                                _Document doc, _BaseContext context):
 *     if xpathObj.type == xpath.XPATH_UNDEFINED:
*/

static PyObject *__pyx_f_4lxml_5etree__unwrapXPathObject(xmlXPathObject *__pyx_v_xpathObj, struct LxmlDocument *__pyx_v_doc, struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_context) {
  PyObject *__pyx_v_stringval = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_unwrapXPathObject", 0);

  /* "src/lxml/extensions.pxi":611
 * cdef object _unwrapXPathObject(xpath.xmlXPathObject* xpathObj,
 *                                _Document doc, _BaseContext context):
 *     if xpathObj.type == xpath.XPATH_UNDEFINED:             # <<<<<<<<<<<<<<
 *         raise XPathResultError, "Undefined xpath result"
 *     elif xpathObj.type == xpath.XPATH_NODESET:
*/
  switch (__pyx_v_xpathObj->type) {
    case XPATH_UNDEFINED:

    /* "src/lxml/extensions.pxi":612
 *                                _Document doc, _BaseContext context):
 *     if xpathObj.type == xpath.XPATH_UNDEFINED:
 *         raise XPathResultError, "Undefined xpath result"             # <<<<<<<<<<<<<<
 *     elif xpathObj.type == xpath.XPATH_NODESET:
 *         return _createNodeSetResult(xpathObj, doc, context)
*/
    __Pyx_Raise(((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XPathResultError), __pyx_mstate_global->__pyx_kp_u_Undefined_xpath_result, 0, 0);
    __PYX_ERR(18, 612, __pyx_L1_error)

    /* "src/lxml/extensions.pxi":611
 * cdef object _unwrapXPathObject(xpath.xmlXPathObject* xpathObj,
 *                                _Document doc, _BaseContext context):
 *     if xpathObj.type == xpath.XPATH_UNDEFINED:             # <<<<<<<<<<<<<<
 *         raise XPathResultError, "Undefined xpath result"
 *     elif xpathObj.type == xpath.XPATH_NODESET:
*/
    break;
    case XPATH_NODESET:

    /* "src/lxml/extensions.pxi":614
 *         raise XPathResultError, "Undefined xpath result"
 *     elif xpathObj.type == xpath.XPATH_NODESET:
 *         return _createNodeSetResult(xpathObj, doc, context)             # <<<<<<<<<<<<<<
 *     elif xpathObj.type == xpath.XPATH_BOOLEAN:
 *         return xpathObj.boolval
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __pyx_f_4lxml_5etree__createNodeSetResult(__pyx_v_xpathObj, __pyx_v_doc, __pyx_v_context); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 614, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "src/lxml/extensions.pxi":613
 *     if xpathObj.type == xpath.XPATH_UNDEFINED:
 *         raise XPathResultError, "Undefined xpath result"
 *     elif xpathObj.type == xpath.XPATH_NODESET:             # <<<<<<<<<<<<<<
 *         return _createNodeSetResult(xpathObj, doc, context)
 *     elif xpathObj.type == xpath.XPATH_BOOLEAN:
*/
    break;
    case XPATH_BOOLEAN:

    /* "src/lxml/extensions.pxi":616
 *         return _createNodeSetResult(xpathObj, doc, context)
 *     elif xpathObj.type == xpath.XPATH_BOOLEAN:
 *         return xpathObj.boolval             # <<<<<<<<<<<<<<
 *     elif xpathObj.type == xpath.XPATH_NUMBER:
 *         return xpathObj.floatval
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_xpathObj->boolval); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 616, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "src/lxml/extensions.pxi":615
 *     elif xpathObj.type == xpath.XPATH_NODESET:
 *         return _createNodeSetResult(xpathObj, doc, context)
 *     elif xpathObj.type == xpath.XPATH_BOOLEAN:             # <<<<<<<<<<<<<<
 *         return xpathObj.boolval
 *     elif xpathObj.type == xpath.XPATH_NUMBER:
*/
    break;
    case XPATH_NUMBER:

    /* "src/lxml/extensions.pxi":618
 *         return xpathObj.boolval
 *     elif xpathObj.type == xpath.XPATH_NUMBER:
 *         return xpathObj.floatval             # <<<<<<<<<<<<<<
 *     elif xpathObj.type == xpath.XPATH_STRING:
 *         stringval = funicode(xpathObj.stringval)
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = PyFloat_FromDouble(__pyx_v_xpathObj->floatval); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 618, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "src/lxml/extensions.pxi":617
 *     elif xpathObj.type == xpath.XPATH_BOOLEAN:
 *         return xpathObj.boolval
 *     elif xpathObj.type == xpath.XPATH_NUMBER:             # <<<<<<<<<<<<<<
 *         return xpathObj.floatval
 *     elif xpathObj.type == xpath.XPATH_STRING:
*/
    break;
    case XPATH_STRING:

    /* "src/lxml/extensions.pxi":620
 *         return xpathObj.floatval
 *     elif xpathObj.type == xpath.XPATH_STRING:
 *         stringval = funicode(xpathObj.stringval)             # <<<<<<<<<<<<<<
 *         if context._build_smart_strings:
 *             stringval = _elementStringResultFactory(
*/
    __pyx_t_1 = __pyx_f_4lxml_5etree_funicode(__pyx_v_xpathObj->stringval); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 620, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_stringval = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "src/lxml/extensions.pxi":621
 *     elif xpathObj.type == xpath.XPATH_STRING:
 *         stringval = funicode(xpathObj.stringval)
 *         if context._build_smart_strings:             # <<<<<<<<<<<<<<
 *             stringval = _elementStringResultFactory(
 *                 stringval, None, None, False)
*/
    if (__pyx_v_context->_build_smart_strings) {

      /* "src/lxml/extensions.pxi":622
 *         stringval = funicode(xpathObj.stringval)
 *         if context._build_smart_strings:
 *             stringval = _elementStringResultFactory(             # <<<<<<<<<<<<<<
 *                 stringval, None, None, False)
 *         return stringval
*/
      __pyx_t_1 = __pyx_f_4lxml_5etree__elementStringResultFactory(__pyx_v_stringval, ((struct LxmlElement *)Py_None), Py_None, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 622, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF_SET(__pyx_v_stringval, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "src/lxml/extensions.pxi":621
 *     elif xpathObj.type == xpath.XPATH_STRING:
 *         stringval = funicode(xpathObj.stringval)
 *         if context._build_smart_strings:             # <<<<<<<<<<<<<<
 *             stringval = _elementStringResultFactory(
 *                 stringval, None, None, False)
*/
    }

    /* "src/lxml/extensions.pxi":624
 *             stringval = _elementStringResultFactory(
 *                 stringval, None, None, False)
 *         return stringval             # <<<<<<<<<<<<<<
 *     elif xpathObj.type == xpath.XPATH_POINT:
 *         raise NotImplementedError, "XPATH_POINT"
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_stringval);
    __pyx_r = __pyx_v_stringval;
    goto __pyx_L0;

    /* "src/lxml/extensions.pxi":619
 *     elif xpathObj.type == xpath.XPATH_NUMBER:
 *         return xpathObj.floatval
 *     elif xpathObj.type == xpath.XPATH_STRING:             # <<<<<<<<<<<<<<
 *         stringval = funicode(xpathObj.stringval)
 *         if context._build_smart_strings:
*/
    break;
    case XPATH_POINT:

    /* "src/lxml/extensions.pxi":626
 *         return stringval
 *     elif xpathObj.type == xpath.XPATH_POINT:
 *         raise NotImplementedError, "XPATH_POINT"             # <<<<<<<<<<<<<<
 *     elif xpathObj.type == xpath.XPATH_RANGE:
 *         raise NotImplementedError, "XPATH_RANGE"
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_NotImplementedError))), __pyx_mstate_global->__pyx_n_u_XPATH_POINT, 0, 0);
    __PYX_ERR(18, 626, __pyx_L1_error)

    /* "src/lxml/extensions.pxi":625
 *                 stringval, None, None, False)
 *         return stringval
 *     elif xpathObj.type == xpath.XPATH_POINT:             # <<<<<<<<<<<<<<
 *         raise NotImplementedError, "XPATH_POINT"
 *     elif xpathObj.type == xpath.XPATH_RANGE:
*/
    break;
    case XPATH_RANGE:

    /* "src/lxml/extensions.pxi":628
 *         raise NotImplementedError, "XPATH_POINT"
 *     elif xpathObj.type == xpath.XPATH_RANGE:
 *         raise NotImplementedError, "XPATH_RANGE"             # <<<<<<<<<<<<<<
 *     elif xpathObj.type == xpath.XPATH_LOCATIONSET:
 *         raise NotImplementedError, "XPATH_LOCATIONSET"
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_NotImplementedError))), __pyx_mstate_global->__pyx_n_u_XPATH_RANGE, 0, 0);
    __PYX_ERR(18, 628, __pyx_L1_error)

    /* "src/lxml/extensions.pxi":627
 *     elif xpathObj.type == xpath.XPATH_POINT:
 *         raise NotImplementedError, "XPATH_POINT"
 *     elif xpathObj.type == xpath.XPATH_RANGE:             # <<<<<<<<<<<<<<
 *         raise NotImplementedError, "XPATH_RANGE"
 *     elif xpathObj.type == xpath.XPATH_LOCATIONSET:
*/
    break;
    case XPATH_LOCATIONSET:

    /* "src/lxml/extensions.pxi":630
 *         raise NotImplementedError, "XPATH_RANGE"
 *     elif xpathObj.type == xpath.XPATH_LOCATIONSET:
 *         raise NotImplementedError, "XPATH_LOCATIONSET"             # <<<<<<<<<<<<<<
 *     elif xpathObj.type == xpath.XPATH_USERS:
 *         raise NotImplementedError, "XPATH_USERS"
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_NotImplementedError))), __pyx_mstate_global->__pyx_n_u_XPATH_LOCATIONSET, 0, 0);
    __PYX_ERR(18, 630, __pyx_L1_error)

    /* "src/lxml/extensions.pxi":629
 *     elif xpathObj.type == xpath.XPATH_RANGE:
 *         raise NotImplementedError, "XPATH_RANGE"
 *     elif xpathObj.type == xpath.XPATH_LOCATIONSET:             # <<<<<<<<<<<<<<
 *         raise NotImplementedError, "XPATH_LOCATIONSET"
 *     elif xpathObj.type == xpath.XPATH_USERS:
*/
    break;
    case XPATH_USERS:

    /* "src/lxml/extensions.pxi":632
 *         raise NotImplementedError, "XPATH_LOCATIONSET"
 *     elif xpathObj.type == xpath.XPATH_USERS:
 *         raise NotImplementedError, "XPATH_USERS"             # <<<<<<<<<<<<<<
 *     elif xpathObj.type == xpath.XPATH_XSLT_TREE:
 *         return _createNodeSetResult(xpathObj, doc, context)
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_NotImplementedError))), __pyx_mstate_global->__pyx_n_u_XPATH_USERS, 0, 0);
    __PYX_ERR(18, 632, __pyx_L1_error)

    /* "src/lxml/extensions.pxi":631
 *     elif xpathObj.type == xpath.XPATH_LOCATIONSET:
 *         raise NotImplementedError, "XPATH_LOCATIONSET"
 *     elif xpathObj.type == xpath.XPATH_USERS:             # <<<<<<<<<<<<<<
 *         raise NotImplementedError, "XPATH_USERS"
 *     elif xpathObj.type == xpath.XPATH_XSLT_TREE:
*/
    break;
    case XPATH_XSLT_TREE:

    /* "src/lxml/extensions.pxi":634
 *         raise NotImplementedError, "XPATH_USERS"
 *     elif xpathObj.type == xpath.XPATH_XSLT_TREE:
 *         return _createNodeSetResult(xpathObj, doc, context)             # <<<<<<<<<<<<<<
 *     else:
 *         raise XPathResultError, f"Unknown xpath result {xpathObj.type}"
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __pyx_f_4lxml_5etree__createNodeSetResult(__pyx_v_xpathObj, __pyx_v_doc, __pyx_v_context); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 634, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "src/lxml/extensions.pxi":633
 *     elif xpathObj.type == xpath.XPATH_USERS:
 *         raise NotImplementedError, "XPATH_USERS"
 *     elif xpathObj.type == xpath.XPATH_XSLT_TREE:             # <<<<<<<<<<<<<<
 *         return _createNodeSetResult(xpathObj, doc, context)
 *     else:
*/
    break;
    default:

    /* "src/lxml/extensions.pxi":636
 *         return _createNodeSetResult(xpathObj, doc, context)
 *     else:
 *         raise XPathResultError, f"Unknown xpath result {xpathObj.type}"             # <<<<<<<<<<<<<<
 * 
 * cdef object _createNodeSetResult(xpath.xmlXPathObject* xpathObj, _Document doc,
*/
    __pyx_t_1 = __Pyx_PyUnicode_From_xmlXPathObjectType(__pyx_v_xpathObj->type, 0, ' ', 'd'); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 636, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_Unknown_xpath_result, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 636, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_Raise(((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XPathResultError), __pyx_t_2, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(18, 636, __pyx_L1_error)
    break;
  }

  /* "src/lxml/extensions.pxi":609
 *     return xpath.xmlXPathWrapNodeSet(resultSet)
 * 
 * cdef object _unwrapXPathObject(xpath.xmlXPathObject* xpathObj,             # <<<<<<<<<<<<<<
 *                                _Document doc, _BaseContext context):
 *     if xpathObj.type == xpath.XPATH_UNDEFINED:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._unwrapXPathObject", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_stringval);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/extensions.pxi":638
 *         raise XPathResultError, f"Unknown xpath result {xpathObj.type}"
 * 
 * cdef object _createNodeSetResult(xpath.xmlXPathObject* xpathObj, _Document doc,             # <<<<<<<<<<<<<<
 *                                  _BaseContext context):
 *     cdef xmlNode* c_node
*/

static PyObject *__pyx_f_4lxml_5etree__createNodeSetResult(xmlXPathObject *__pyx_v_xpathObj, struct LxmlDocument *__pyx_v_doc, struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_context) {
  xmlNode *__pyx_v_c_node;
  int __pyx_v_i;
  PyObject *__pyx_v_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_createNodeSetResult", 0);

  /* "src/lxml/extensions.pxi":643
 *     cdef int i
 *     cdef list result
 *     result = []             # <<<<<<<<<<<<<<
 *     if xpathObj.nodesetval is NULL:
 *         return result
*/
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 643, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_result = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":644
 *     cdef list result
 *     result = []
 *     if xpathObj.nodesetval is NULL:             # <<<<<<<<<<<<<<
 *         return result
 *     for i in range(xpathObj.nodesetval.nodeNr):
*/
  __pyx_t_2 = (__pyx_v_xpathObj->nodesetval == NULL);
  if (__pyx_t_2) {

    /* "src/lxml/extensions.pxi":645
 *     result = []
 *     if xpathObj.nodesetval is NULL:
 *         return result             # <<<<<<<<<<<<<<
 *     for i in range(xpathObj.nodesetval.nodeNr):
 *         c_node = xpathObj.nodesetval.nodeTab[i]
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_result);
    __pyx_r = __pyx_v_result;
    goto __pyx_L0;

    /* "src/lxml/extensions.pxi":644
 *     cdef list result
 *     result = []
 *     if xpathObj.nodesetval is NULL:             # <<<<<<<<<<<<<<
 *         return result
 *     for i in range(xpathObj.nodesetval.nodeNr):
*/
  }

  /* "src/lxml/extensions.pxi":646
 *     if xpathObj.nodesetval is NULL:
 *         return result
 *     for i in range(xpathObj.nodesetval.nodeNr):             # <<<<<<<<<<<<<<
 *         c_node = xpathObj.nodesetval.nodeTab[i]
 *         _unpackNodeSetEntry(result, c_node, doc, context,
*/
  __pyx_t_3 = __pyx_v_xpathObj->nodesetval->nodeNr;
  __pyx_t_4 = __pyx_t_3;
  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
    __pyx_v_i = __pyx_t_5;

    /* "src/lxml/extensions.pxi":647
 *         return result
 *     for i in range(xpathObj.nodesetval.nodeNr):
 *         c_node = xpathObj.nodesetval.nodeTab[i]             # <<<<<<<<<<<<<<
 *         _unpackNodeSetEntry(result, c_node, doc, context,
 *                             xpathObj.type == xpath.XPATH_XSLT_TREE)
*/
    __pyx_v_c_node = (__pyx_v_xpathObj->nodesetval->nodeTab[__pyx_v_i]);

    /* "src/lxml/extensions.pxi":648
 *     for i in range(xpathObj.nodesetval.nodeNr):
 *         c_node = xpathObj.nodesetval.nodeTab[i]
 *         _unpackNodeSetEntry(result, c_node, doc, context,             # <<<<<<<<<<<<<<
 *                             xpathObj.type == xpath.XPATH_XSLT_TREE)
 *     return result
*/
    __pyx_t_1 = __pyx_f_4lxml_5etree__unpackNodeSetEntry(__pyx_v_result, __pyx_v_c_node, __pyx_v_doc, __pyx_v_context, (__pyx_v_xpathObj->type == XPATH_XSLT_TREE)); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 648, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "src/lxml/extensions.pxi":650
 *         _unpackNodeSetEntry(result, c_node, doc, context,
 *                             xpathObj.type == xpath.XPATH_XSLT_TREE)
 *     return result             # <<<<<<<<<<<<<<
 * 
 * cdef _unpackNodeSetEntry(list results, xmlNode* c_node, _Document doc,
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "src/lxml/extensions.pxi":638
 *         raise XPathResultError, f"Unknown xpath result {xpathObj.type}"
 * 
 * cdef object _createNodeSetResult(xpath.xmlXPathObject* xpathObj, _Document doc,             # <<<<<<<<<<<<<<
 *                                  _BaseContext context):
 *     cdef xmlNode* c_node
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._createNodeSetResult", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/extensions.pxi":652
 *     return result
 * 
 * cdef _unpackNodeSetEntry(list results, xmlNode* c_node, _Document doc,             # <<<<<<<<<<<<<<
 *                          _BaseContext context, bint is_fragment):
 *     cdef xmlNode* c_child
*/

static PyObject *__pyx_f_4lxml_5etree__unpackNodeSetEntry(PyObject *__pyx_v_results, xmlNode *__pyx_v_c_node, struct LxmlDocument *__pyx_v_doc, struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_context, int __pyx_v_is_fragment) {
  xmlNode *__pyx_v_c_child;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  xmlNode *__pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_unpackNodeSetEntry", 0);

  /* "src/lxml/extensions.pxi":655
 *                          _BaseContext context, bint is_fragment):
 *     cdef xmlNode* c_child
 *     if _isElement(c_node):             # <<<<<<<<<<<<<<
 *         if c_node.doc != doc._c_doc and c_node.doc._private is NULL:
 *             # XXX: works, but maybe not always the right thing to do?
*/
  __pyx_t_1 = _isElement(__pyx_v_c_node);
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":656
 *     cdef xmlNode* c_child
 *     if _isElement(c_node):
 *         if c_node.doc != doc._c_doc and c_node.doc._private is NULL:             # <<<<<<<<<<<<<<
 *             # XXX: works, but maybe not always the right thing to do?
 *             # XPath: only runs when extensions create or copy trees
*/
    __pyx_t_2 = (__pyx_v_c_node->doc != __pyx_v_doc->_c_doc);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_2 = (__pyx_v_c_node->doc->_private == NULL);
    __pyx_t_1 = __pyx_t_2;
    __pyx_L5_bool_binop_done:;
    if (__pyx_t_1) {

      /* "src/lxml/extensions.pxi":661
 *             #        -> we store Python refs to these, so that is OK
 *             # XSLT: can it leak when merging trees from multiple sources?
 *             c_node = tree.xmlDocCopyNode(c_node, doc._c_doc, 1)             # <<<<<<<<<<<<<<
 *             if not c_node:
 *                 raise MemoryError()
*/
      __pyx_v_c_node = xmlDocCopyNode(__pyx_v_c_node, __pyx_v_doc->_c_doc, 1);

      /* "src/lxml/extensions.pxi":662
 *             # XSLT: can it leak when merging trees from multiple sources?
 *             c_node = tree.xmlDocCopyNode(c_node, doc._c_doc, 1)
 *             if not c_node:             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 *             # FIXME: call _instantiateElementFromXPath() instead?
*/
      __pyx_t_1 = (!(__pyx_v_c_node != 0));
      if (unlikely(__pyx_t_1)) {

        /* "src/lxml/extensions.pxi":663
 *             c_node = tree.xmlDocCopyNode(c_node, doc._c_doc, 1)
 *             if not c_node:
 *                 raise MemoryError()             # <<<<<<<<<<<<<<
 *             # FIXME: call _instantiateElementFromXPath() instead?
 *         results.append(
*/
        PyErr_NoMemory(); __PYX_ERR(18, 663, __pyx_L1_error)

        /* "src/lxml/extensions.pxi":662
 *             # XSLT: can it leak when merging trees from multiple sources?
 *             c_node = tree.xmlDocCopyNode(c_node, doc._c_doc, 1)
 *             if not c_node:             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 *             # FIXME: call _instantiateElementFromXPath() instead?
*/
      }

      /* "src/lxml/extensions.pxi":656
 *     cdef xmlNode* c_child
 *     if _isElement(c_node):
 *         if c_node.doc != doc._c_doc and c_node.doc._private is NULL:             # <<<<<<<<<<<<<<
 *             # XXX: works, but maybe not always the right thing to do?
 *             # XPath: only runs when extensions create or copy trees
*/
    }

    /* "src/lxml/extensions.pxi":665
 *                 raise MemoryError()
 *             # FIXME: call _instantiateElementFromXPath() instead?
 *         results.append(             # <<<<<<<<<<<<<<
 *             _fakeDocElementFactory(doc, c_node))
 *     elif c_node.type == tree.XML_TEXT_NODE or \
*/
    if (unlikely(__pyx_v_results == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
      __PYX_ERR(18, 665, __pyx_L1_error)
    }

    /* "src/lxml/extensions.pxi":666
 *             # FIXME: call _instantiateElementFromXPath() instead?
 *         results.append(
 *             _fakeDocElementFactory(doc, c_node))             # <<<<<<<<<<<<<<
 *     elif c_node.type == tree.XML_TEXT_NODE or \
 *              c_node.type == tree.XML_CDATA_SECTION_NODE or \
*/
    __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__fakeDocElementFactory(__pyx_v_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_3)) __PYX_ERR(18, 666, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);

    /* "src/lxml/extensions.pxi":665
 *                 raise MemoryError()
 *             # FIXME: call _instantiateElementFromXPath() instead?
 *         results.append(             # <<<<<<<<<<<<<<
 *             _fakeDocElementFactory(doc, c_node))
 *     elif c_node.type == tree.XML_TEXT_NODE or \
*/
    __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_results, __pyx_t_3); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(18, 665, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/extensions.pxi":655
 *                          _BaseContext context, bint is_fragment):
 *     cdef xmlNode* c_child
 *     if _isElement(c_node):             # <<<<<<<<<<<<<<
 *         if c_node.doc != doc._c_doc and c_node.doc._private is NULL:
 *             # XXX: works, but maybe not always the right thing to do?
*/
    goto __pyx_L3;
  }

  /* "src/lxml/extensions.pxi":667
 *         results.append(
 *             _fakeDocElementFactory(doc, c_node))
 *     elif c_node.type == tree.XML_TEXT_NODE or \             # <<<<<<<<<<<<<<
 *              c_node.type == tree.XML_CDATA_SECTION_NODE or \
 *              c_node.type == tree.XML_ATTRIBUTE_NODE:
*/
  switch (__pyx_v_c_node->type) {
    case XML_TEXT_NODE:
    case XML_CDATA_SECTION_NODE:

    /* "src/lxml/extensions.pxi":668
 *             _fakeDocElementFactory(doc, c_node))
 *     elif c_node.type == tree.XML_TEXT_NODE or \
 *              c_node.type == tree.XML_CDATA_SECTION_NODE or \             # <<<<<<<<<<<<<<
 *              c_node.type == tree.XML_ATTRIBUTE_NODE:
 *         results.append(
*/
    case XML_ATTRIBUTE_NODE:

    /* "src/lxml/extensions.pxi":667
 *         results.append(
 *             _fakeDocElementFactory(doc, c_node))
 *     elif c_node.type == tree.XML_TEXT_NODE or \             # <<<<<<<<<<<<<<
 *              c_node.type == tree.XML_CDATA_SECTION_NODE or \
 *              c_node.type == tree.XML_ATTRIBUTE_NODE:
*/
    __pyx_t_1 = 1;
    break;
    default:
    __pyx_t_1 = 0;
    break;
  }
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":670
 *              c_node.type == tree.XML_CDATA_SECTION_NODE or \
 *              c_node.type == tree.XML_ATTRIBUTE_NODE:
 *         results.append(             # <<<<<<<<<<<<<<
 *             _buildElementStringResult(doc, c_node, context))
 *     elif c_node.type == tree.XML_NAMESPACE_DECL:
*/
    if (unlikely(__pyx_v_results == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
      __PYX_ERR(18, 670, __pyx_L1_error)
    }

    /* "src/lxml/extensions.pxi":671
 *              c_node.type == tree.XML_ATTRIBUTE_NODE:
 *         results.append(
 *             _buildElementStringResult(doc, c_node, context))             # <<<<<<<<<<<<<<
 *     elif c_node.type == tree.XML_NAMESPACE_DECL:
 *         results.append( (funicodeOrNone((<xmlNs*>c_node).prefix),
*/
    __pyx_t_3 = __pyx_f_4lxml_5etree__buildElementStringResult(__pyx_v_doc, __pyx_v_c_node, __pyx_v_context); if (unlikely(!__pyx_t_3)) __PYX_ERR(18, 671, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);

    /* "src/lxml/extensions.pxi":670
 *              c_node.type == tree.XML_CDATA_SECTION_NODE or \
 *              c_node.type == tree.XML_ATTRIBUTE_NODE:
 *         results.append(             # <<<<<<<<<<<<<<
 *             _buildElementStringResult(doc, c_node, context))
 *     elif c_node.type == tree.XML_NAMESPACE_DECL:
*/
    __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_results, __pyx_t_3); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(18, 670, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/extensions.pxi":667
 *         results.append(
 *             _fakeDocElementFactory(doc, c_node))
 *     elif c_node.type == tree.XML_TEXT_NODE or \             # <<<<<<<<<<<<<<
 *              c_node.type == tree.XML_CDATA_SECTION_NODE or \
 *              c_node.type == tree.XML_ATTRIBUTE_NODE:
*/
    goto __pyx_L3;
  }

  /* "src/lxml/extensions.pxi":672
 *         results.append(
 *             _buildElementStringResult(doc, c_node, context))
 *     elif c_node.type == tree.XML_NAMESPACE_DECL:             # <<<<<<<<<<<<<<
 *         results.append( (funicodeOrNone((<xmlNs*>c_node).prefix),
 *                          funicodeOrNone((<xmlNs*>c_node).href)) )
*/
  __pyx_t_1 = (__pyx_v_c_node->type == XML_NAMESPACE_DECL);
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":673
 *             _buildElementStringResult(doc, c_node, context))
 *     elif c_node.type == tree.XML_NAMESPACE_DECL:
 *         results.append( (funicodeOrNone((<xmlNs*>c_node).prefix),             # <<<<<<<<<<<<<<
 *                          funicodeOrNone((<xmlNs*>c_node).href)) )
 *     elif c_node.type == tree.XML_DOCUMENT_NODE or \
*/
    if (unlikely(__pyx_v_results == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
      __PYX_ERR(18, 673, __pyx_L1_error)
    }
    __pyx_t_3 = __pyx_f_4lxml_5etree_funicodeOrNone(((xmlNs *)__pyx_v_c_node)->prefix); if (unlikely(!__pyx_t_3)) __PYX_ERR(18, 673, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);

    /* "src/lxml/extensions.pxi":674
 *     elif c_node.type == tree.XML_NAMESPACE_DECL:
 *         results.append( (funicodeOrNone((<xmlNs*>c_node).prefix),
 *                          funicodeOrNone((<xmlNs*>c_node).href)) )             # <<<<<<<<<<<<<<
 *     elif c_node.type == tree.XML_DOCUMENT_NODE or \
 *             c_node.type == tree.XML_HTML_DOCUMENT_NODE:
*/
    __pyx_t_5 = __pyx_f_4lxml_5etree_funicodeOrNone(((xmlNs *)__pyx_v_c_node)->href); if (unlikely(!__pyx_t_5)) __PYX_ERR(18, 674, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);

    /* "src/lxml/extensions.pxi":673
 *             _buildElementStringResult(doc, c_node, context))
 *     elif c_node.type == tree.XML_NAMESPACE_DECL:
 *         results.append( (funicodeOrNone((<xmlNs*>c_node).prefix),             # <<<<<<<<<<<<<<
 *                          funicodeOrNone((<xmlNs*>c_node).href)) )
 *     elif c_node.type == tree.XML_DOCUMENT_NODE or \
*/
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(18, 673, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_3);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3) != (0)) __PYX_ERR(18, 673, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_5);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5) != (0)) __PYX_ERR(18, 673, __pyx_L1_error);
    __pyx_t_3 = 0;
    __pyx_t_5 = 0;
    __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_results, __pyx_t_6); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(18, 673, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "src/lxml/extensions.pxi":672
 *         results.append(
 *             _buildElementStringResult(doc, c_node, context))
 *     elif c_node.type == tree.XML_NAMESPACE_DECL:             # <<<<<<<<<<<<<<
 *         results.append( (funicodeOrNone((<xmlNs*>c_node).prefix),
 *                          funicodeOrNone((<xmlNs*>c_node).href)) )
*/
    goto __pyx_L3;
  }

  /* "src/lxml/extensions.pxi":675
 *         results.append( (funicodeOrNone((<xmlNs*>c_node).prefix),
 *                          funicodeOrNone((<xmlNs*>c_node).href)) )
 *     elif c_node.type == tree.XML_DOCUMENT_NODE or \             # <<<<<<<<<<<<<<
 *             c_node.type == tree.XML_HTML_DOCUMENT_NODE:
 *         # ignored for everything but result tree fragments
*/
  switch (__pyx_v_c_node->type) {
    case XML_DOCUMENT_NODE:
    case XML_HTML_DOCUMENT_NODE:

    /* "src/lxml/extensions.pxi":676
 *                          funicodeOrNone((<xmlNs*>c_node).href)) )
 *     elif c_node.type == tree.XML_DOCUMENT_NODE or \
 *             c_node.type == tree.XML_HTML_DOCUMENT_NODE:             # <<<<<<<<<<<<<<
 *         # ignored for everything but result tree fragments
 *         if is_fragment:
*/
    __pyx_t_1 = 1;

    /* "src/lxml/extensions.pxi":675
 *         results.append( (funicodeOrNone((<xmlNs*>c_node).prefix),
 *                          funicodeOrNone((<xmlNs*>c_node).href)) )
 *     elif c_node.type == tree.XML_DOCUMENT_NODE or \             # <<<<<<<<<<<<<<
 *             c_node.type == tree.XML_HTML_DOCUMENT_NODE:
 *         # ignored for everything but result tree fragments
*/
    break;
    default:
    __pyx_t_1 = 0;
    break;
  }
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":678
 *             c_node.type == tree.XML_HTML_DOCUMENT_NODE:
 *         # ignored for everything but result tree fragments
 *         if is_fragment:             # <<<<<<<<<<<<<<
 *             c_child = c_node.children
 *             while c_child is not NULL:
*/
    if (__pyx_v_is_fragment) {

      /* "src/lxml/extensions.pxi":679
 *         # ignored for everything but result tree fragments
 *         if is_fragment:
 *             c_child = c_node.children             # <<<<<<<<<<<<<<
 *             while c_child is not NULL:
 *                 _unpackNodeSetEntry(results, c_child, doc, context, 0)
*/
      __pyx_t_7 = __pyx_v_c_node->children;
      __pyx_v_c_child = __pyx_t_7;

      /* "src/lxml/extensions.pxi":680
 *         if is_fragment:
 *             c_child = c_node.children
 *             while c_child is not NULL:             # <<<<<<<<<<<<<<
 *                 _unpackNodeSetEntry(results, c_child, doc, context, 0)
 *                 c_child = c_child.next
*/
      while (1) {
        __pyx_t_1 = (__pyx_v_c_child != NULL);
        if (!__pyx_t_1) break;

        /* "src/lxml/extensions.pxi":681
 *             c_child = c_node.children
 *             while c_child is not NULL:
 *                 _unpackNodeSetEntry(results, c_child, doc, context, 0)             # <<<<<<<<<<<<<<
 *                 c_child = c_child.next
 *     elif c_node.type == tree.XML_XINCLUDE_START or \
*/
        __pyx_t_6 = __pyx_f_4lxml_5etree__unpackNodeSetEntry(__pyx_v_results, __pyx_v_c_child, __pyx_v_doc, __pyx_v_context, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(18, 681, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

        /* "src/lxml/extensions.pxi":682
 *             while c_child is not NULL:
 *                 _unpackNodeSetEntry(results, c_child, doc, context, 0)
 *                 c_child = c_child.next             # <<<<<<<<<<<<<<
 *     elif c_node.type == tree.XML_XINCLUDE_START or \
 *             c_node.type == tree.XML_XINCLUDE_END:
*/
        __pyx_t_7 = __pyx_v_c_child->next;
        __pyx_v_c_child = __pyx_t_7;
      }

      /* "src/lxml/extensions.pxi":678
 *             c_node.type == tree.XML_HTML_DOCUMENT_NODE:
 *         # ignored for everything but result tree fragments
 *         if is_fragment:             # <<<<<<<<<<<<<<
 *             c_child = c_node.children
 *             while c_child is not NULL:
*/
    }

    /* "src/lxml/extensions.pxi":675
 *         results.append( (funicodeOrNone((<xmlNs*>c_node).prefix),
 *                          funicodeOrNone((<xmlNs*>c_node).href)) )
 *     elif c_node.type == tree.XML_DOCUMENT_NODE or \             # <<<<<<<<<<<<<<
 *             c_node.type == tree.XML_HTML_DOCUMENT_NODE:
 *         # ignored for everything but result tree fragments
*/
    goto __pyx_L3;
  }

  /* "src/lxml/extensions.pxi":683
 *                 _unpackNodeSetEntry(results, c_child, doc, context, 0)
 *                 c_child = c_child.next
 *     elif c_node.type == tree.XML_XINCLUDE_START or \             # <<<<<<<<<<<<<<
 *             c_node.type == tree.XML_XINCLUDE_END:
 *         pass
*/
  switch (__pyx_v_c_node->type) {
    case XML_XINCLUDE_START:
    case XML_XINCLUDE_END:

    /* "src/lxml/extensions.pxi":684
 *                 c_child = c_child.next
 *     elif c_node.type == tree.XML_XINCLUDE_START or \
 *             c_node.type == tree.XML_XINCLUDE_END:             # <<<<<<<<<<<<<<
 *         pass
 *     else:
*/
    __pyx_t_1 = 1;

    /* "src/lxml/extensions.pxi":683
 *                 _unpackNodeSetEntry(results, c_child, doc, context, 0)
 *                 c_child = c_child.next
 *     elif c_node.type == tree.XML_XINCLUDE_START or \             # <<<<<<<<<<<<<<
 *             c_node.type == tree.XML_XINCLUDE_END:
 *         pass
*/
    break;
    default:
    __pyx_t_1 = 0;
    break;
  }
  if (likely(__pyx_t_1)) {
    goto __pyx_L3;
  }

  /* "src/lxml/extensions.pxi":687
 *         pass
 *     else:
 *         raise NotImplementedError, \             # <<<<<<<<<<<<<<
 *             f"Not yet implemented result node type: {c_node.type}"
 * 
*/
  /*else*/ {

    /* "src/lxml/extensions.pxi":688
 *     else:
 *         raise NotImplementedError, \
 *             f"Not yet implemented result node type: {c_node.type}"             # <<<<<<<<<<<<<<
 * 
 * cdef void _freeXPathObject(xpath.xmlXPathObject* xpathObj) noexcept:
*/
    __pyx_t_6 = __Pyx_PyUnicode_From_xmlElementType(__pyx_v_c_node->type, 0, ' ', 'd'); if (unlikely(!__pyx_t_6)) __PYX_ERR(18, 688, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_Not_yet_implemented_result_node, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(18, 688, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_NotImplementedError))), __pyx_t_5, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __PYX_ERR(18, 687, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "src/lxml/extensions.pxi":652
 *     return result
 * 
 * cdef _unpackNodeSetEntry(list results, xmlNode* c_node, _Document doc,             # <<<<<<<<<<<<<<
 *                          _BaseContext context, bint is_fragment):
 *     cdef xmlNode* c_child
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._unpackNodeSetEntry", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/extensions.pxi":690
 *             f"Not yet implemented result node type: {c_node.type}"
 * 
 * cdef void _freeXPathObject(xpath.xmlXPathObject* xpathObj) noexcept:             # <<<<<<<<<<<<<<
 *     """Free the XPath object, but *never* free the *content* of node sets.
 *     Python dealloc will do that for us.
*/

static void __pyx_f_4lxml_5etree__freeXPathObject(xmlXPathObject *__pyx_v_xpathObj) {
  int __pyx_t_1;

  /* "src/lxml/extensions.pxi":694
 *     Python dealloc will do that for us.
 *     """
 *     if xpathObj.nodesetval is not NULL:             # <<<<<<<<<<<<<<
 *         xpath.xmlXPathFreeNodeSet(xpathObj.nodesetval)
 *         xpathObj.nodesetval = NULL
*/
  __pyx_t_1 = (__pyx_v_xpathObj->nodesetval != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":695
 *     """
 *     if xpathObj.nodesetval is not NULL:
 *         xpath.xmlXPathFreeNodeSet(xpathObj.nodesetval)             # <<<<<<<<<<<<<<
 *         xpathObj.nodesetval = NULL
 *     xpath.xmlXPathFreeObject(xpathObj)
*/
    xmlXPathFreeNodeSet(__pyx_v_xpathObj->nodesetval);

    /* "src/lxml/extensions.pxi":696
 *     if xpathObj.nodesetval is not NULL:
 *         xpath.xmlXPathFreeNodeSet(xpathObj.nodesetval)
 *         xpathObj.nodesetval = NULL             # <<<<<<<<<<<<<<
 *     xpath.xmlXPathFreeObject(xpathObj)
 * 
*/
    __pyx_v_xpathObj->nodesetval = NULL;

    /* "src/lxml/extensions.pxi":694
 *     Python dealloc will do that for us.
 *     """
 *     if xpathObj.nodesetval is not NULL:             # <<<<<<<<<<<<<<
 *         xpath.xmlXPathFreeNodeSet(xpathObj.nodesetval)
 *         xpathObj.nodesetval = NULL
*/
  }

  /* "src/lxml/extensions.pxi":697
 *         xpath.xmlXPathFreeNodeSet(xpathObj.nodesetval)
 *         xpathObj.nodesetval = NULL
 *     xpath.xmlXPathFreeObject(xpathObj)             # <<<<<<<<<<<<<<
 * 
 * cdef _Element _instantiateElementFromXPath(xmlNode* c_node, _Document doc,
*/
  xmlXPathFreeObject(__pyx_v_xpathObj);

  /* "src/lxml/extensions.pxi":690
 *             f"Not yet implemented result node type: {c_node.type}"
 * 
 * cdef void _freeXPathObject(xpath.xmlXPathObject* xpathObj) noexcept:             # <<<<<<<<<<<<<<
 *     """Free the XPath object, but *never* free the *content* of node sets.
 *     Python dealloc will do that for us.
*/

  /* function exit code */
}

/* "src/lxml/extensions.pxi":699
 *     xpath.xmlXPathFreeObject(xpathObj)
 * 
 * cdef _Element _instantiateElementFromXPath(xmlNode* c_node, _Document doc,             # <<<<<<<<<<<<<<
 *                                            _BaseContext context):
 *     # NOTE: this may copy the element - only call this when it can't leak
*/

static struct LxmlElement *__pyx_f_4lxml_5etree__instantiateElementFromXPath(xmlNode *__pyx_v_c_node, struct LxmlDocument *__pyx_v_doc, struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_context) {
  struct LxmlDocument *__pyx_v_node_doc = NULL;
  struct LxmlElement *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_instantiateElementFromXPath", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_doc);

  /* "src/lxml/extensions.pxi":702
 *                                            _BaseContext context):
 *     # NOTE: this may copy the element - only call this when it can't leak
 *     if c_node.doc != doc._c_doc and c_node.doc._private is NULL:             # <<<<<<<<<<<<<<
 *         # not from the context document and not from a fake document
 *         # either => may still be from a known document, e.g. one
*/
  __pyx_t_2 = (__pyx_v_c_node->doc != __pyx_v_doc->_c_doc);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_c_node->doc->_private == NULL);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":706
 *         # either => may still be from a known document, e.g. one
 *         # created by an extension function
 *         node_doc = context._findDocumentForNode(c_node)             # <<<<<<<<<<<<<<
 *         if node_doc is None:
 *             # not from a known document at all! => can only make a
*/
    __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree_12_BaseContext__findDocumentForNode(__pyx_v_context, __pyx_v_c_node)); if (unlikely(!__pyx_t_3)) __PYX_ERR(18, 706, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_node_doc = ((struct LxmlDocument *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/extensions.pxi":707
 *         # created by an extension function
 *         node_doc = context._findDocumentForNode(c_node)
 *         if node_doc is None:             # <<<<<<<<<<<<<<
 *             # not from a known document at all! => can only make a
 *             # safety copy here
*/
    __pyx_t_1 = (((PyObject *)__pyx_v_node_doc) == Py_None);
    if (__pyx_t_1) {

      /* "src/lxml/extensions.pxi":710
 *             # not from a known document at all! => can only make a
 *             # safety copy here
 *             c_node = tree.xmlDocCopyNode(c_node, doc._c_doc, 1)             # <<<<<<<<<<<<<<
 *             if not c_node:
 *                 raise MemoryError()
*/
      __pyx_v_c_node = xmlDocCopyNode(__pyx_v_c_node, __pyx_v_doc->_c_doc, 1);

      /* "src/lxml/extensions.pxi":711
 *             # safety copy here
 *             c_node = tree.xmlDocCopyNode(c_node, doc._c_doc, 1)
 *             if not c_node:             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 *         else:
*/
      __pyx_t_1 = (!(__pyx_v_c_node != 0));
      if (unlikely(__pyx_t_1)) {

        /* "src/lxml/extensions.pxi":712
 *             c_node = tree.xmlDocCopyNode(c_node, doc._c_doc, 1)
 *             if not c_node:
 *                 raise MemoryError()             # <<<<<<<<<<<<<<
 *         else:
 *             doc = node_doc
*/
        PyErr_NoMemory(); __PYX_ERR(18, 712, __pyx_L1_error)

        /* "src/lxml/extensions.pxi":711
 *             # safety copy here
 *             c_node = tree.xmlDocCopyNode(c_node, doc._c_doc, 1)
 *             if not c_node:             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 *         else:
*/
      }

      /* "src/lxml/extensions.pxi":707
 *         # created by an extension function
 *         node_doc = context._findDocumentForNode(c_node)
 *         if node_doc is None:             # <<<<<<<<<<<<<<
 *             # not from a known document at all! => can only make a
 *             # safety copy here
*/
      goto __pyx_L6;
    }

    /* "src/lxml/extensions.pxi":714
 *                 raise MemoryError()
 *         else:
 *             doc = node_doc             # <<<<<<<<<<<<<<
 *     return _fakeDocElementFactory(doc, c_node)
 * 
*/
    /*else*/ {
      __Pyx_INCREF((PyObject *)__pyx_v_node_doc);
      __Pyx_DECREF_SET(__pyx_v_doc, __pyx_v_node_doc);
    }
    __pyx_L6:;

    /* "src/lxml/extensions.pxi":702
 *                                            _BaseContext context):
 *     # NOTE: this may copy the element - only call this when it can't leak
 *     if c_node.doc != doc._c_doc and c_node.doc._private is NULL:             # <<<<<<<<<<<<<<
 *         # not from the context document and not from a fake document
 *         # either => may still be from a known document, e.g. one
*/
  }

  /* "src/lxml/extensions.pxi":715
 *         else:
 *             doc = node_doc
 *     return _fakeDocElementFactory(doc, c_node)             # <<<<<<<<<<<<<<
 * 
 * ################################################################################
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__fakeDocElementFactory(__pyx_v_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_3)) __PYX_ERR(18, 715, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = ((struct LxmlElement *)__pyx_t_3);
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "src/lxml/extensions.pxi":699
 *     xpath.xmlXPathFreeObject(xpathObj)
 * 
 * cdef _Element _instantiateElementFromXPath(xmlNode* c_node, _Document doc,             # <<<<<<<<<<<<<<
 *                                            _BaseContext context):
 *     # NOTE: this may copy the element - only call this when it can't leak
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._instantiateElementFromXPath", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_node_doc);
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/extensions.pxi":726
 *     cdef readonly bint is_tail
 * 
 *     def getparent(self):             # <<<<<<<<<<<<<<
 *         return self._parent
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_21_ElementUnicodeResult_1getparent(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_21_ElementUnicodeResult_1getparent = {"getparent", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_21_ElementUnicodeResult_1getparent, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_21_ElementUnicodeResult_1getparent(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getparent (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("getparent", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("getparent", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_21_ElementUnicodeResult_getparent(((struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_21_ElementUnicodeResult_getparent(struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getparent", 0);

  /* "src/lxml/extensions.pxi":727
 * 
 *     def getparent(self):
 *         return self._parent             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_self->_parent);
  __pyx_r = ((PyObject *)__pyx_v_self->_parent);
  goto __pyx_L0;

  /* "src/lxml/extensions.pxi":726
 *     cdef readonly bint is_tail
 * 
 *     def getparent(self):             # <<<<<<<<<<<<<<
 *         return self._parent
 * 
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/extensions.pxi":729
 *         return self._parent
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def is_text(self):
 *         return self._parent is not None and not (self.is_tail or self.attrname is not None)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_21_ElementUnicodeResult_7is_text_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_21_ElementUnicodeResult_7is_text_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_21_ElementUnicodeResult_7is_text___get__(((struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_21_ElementUnicodeResult_7is_text___get__(struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "src/lxml/extensions.pxi":731
 *     @property
 *     def is_text(self):
 *         return self._parent is not None and not (self.is_tail or self.attrname is not None)             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = (((PyObject *)__pyx_v_self->_parent) != Py_None);
  if (__pyx_t_2) {
  } else {
    __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(18, 731, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L3_bool_binop_done;
  }
  if (!__pyx_v_self->is_tail) {
  } else {
    __pyx_t_2 = __pyx_v_self->is_tail;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_4 = (__pyx_v_self->attrname != Py_None);
  __pyx_t_2 = __pyx_t_4;
  __pyx_L5_bool_binop_done:;
  __pyx_t_4 = (!__pyx_t_2);
  __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(18, 731, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_L3_bool_binop_done:;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/extensions.pxi":729
 *         return self._parent
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def is_text(self):
 *         return self._parent is not None and not (self.is_tail or self.attrname is not None)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._ElementUnicodeResult.is_text.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/extensions.pxi":733
 *         return self._parent is not None and not (self.is_tail or self.attrname is not None)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def is_attribute(self):
 *         return self.attrname is not None
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_21_ElementUnicodeResult_12is_attribute_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_21_ElementUnicodeResult_12is_attribute_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_21_ElementUnicodeResult_12is_attribute___get__(((struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_21_ElementUnicodeResult_12is_attribute___get__(struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "src/lxml/extensions.pxi":735
 *     @property
 *     def is_attribute(self):
 *         return self.attrname is not None             # <<<<<<<<<<<<<<
 * 
 * cdef object _elementStringResultFactory(string_value, _Element parent,
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = (__pyx_v_self->attrname != Py_None);
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 735, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/extensions.pxi":733
 *         return self._parent is not None and not (self.is_tail or self.attrname is not None)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def is_attribute(self):
 *         return self.attrname is not None
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ElementUnicodeResult.is_attribute.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/extensions.pxi":723
 * cdef class _ElementUnicodeResult(unicode):
 *     cdef _Element _parent
 *     cdef readonly object attrname             # <<<<<<<<<<<<<<
 *     cdef readonly bint is_tail
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_21_ElementUnicodeResult_8attrname_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_21_ElementUnicodeResult_8attrname_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_21_ElementUnicodeResult_8attrname___get__(((struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_21_ElementUnicodeResult_8attrname___get__(struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->attrname);
  __pyx_r = __pyx_v_self->attrname;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/extensions.pxi":724
 *     cdef _Element _parent
 *     cdef readonly object attrname
 *     cdef readonly bint is_tail             # <<<<<<<<<<<<<<
 * 
 *     def getparent(self):
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_21_ElementUnicodeResult_7is_tail_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_21_ElementUnicodeResult_7is_tail_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_21_ElementUnicodeResult_7is_tail___get__(((struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_21_ElementUnicodeResult_7is_tail___get__(struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->is_tail); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 724, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ElementUnicodeResult.is_tail.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/extensions.pxi":737
 *         return self.attrname is not None
 * 
 * cdef object _elementStringResultFactory(string_value, _Element parent,             # <<<<<<<<<<<<<<
 *                                         attrname, bint is_tail):
 *     result = _ElementUnicodeResult(string_value)
*/

static PyObject *__pyx_f_4lxml_5etree__elementStringResultFactory(PyObject *__pyx_v_string_value, struct LxmlElement *__pyx_v_parent, PyObject *__pyx_v_attrname, int __pyx_v_is_tail) {
  struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *__pyx_v_result = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_elementStringResultFactory", 0);

  /* "src/lxml/extensions.pxi":739
 * cdef object _elementStringResultFactory(string_value, _Element parent,
 *                                         attrname, bint is_tail):
 *     result = _ElementUnicodeResult(string_value)             # <<<<<<<<<<<<<<
 *     result._parent = parent
 *     result.is_tail = is_tail
*/
  __pyx_t_2 = NULL;
  __pyx_t_3 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_string_value};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ElementUnicodeResult, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 739, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __pyx_v_result = ((struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":740
 *                                         attrname, bint is_tail):
 *     result = _ElementUnicodeResult(string_value)
 *     result._parent = parent             # <<<<<<<<<<<<<<
 *     result.is_tail = is_tail
 *     result.attrname = attrname
*/
  __Pyx_INCREF((PyObject *)__pyx_v_parent);
  __Pyx_GIVEREF((PyObject *)__pyx_v_parent);
  __Pyx_GOTREF((PyObject *)__pyx_v_result->_parent);
  __Pyx_DECREF((PyObject *)__pyx_v_result->_parent);
  __pyx_v_result->_parent = __pyx_v_parent;

  /* "src/lxml/extensions.pxi":741
 *     result = _ElementUnicodeResult(string_value)
 *     result._parent = parent
 *     result.is_tail = is_tail             # <<<<<<<<<<<<<<
 *     result.attrname = attrname
 *     return result
*/
  __pyx_v_result->is_tail = __pyx_v_is_tail;

  /* "src/lxml/extensions.pxi":742
 *     result._parent = parent
 *     result.is_tail = is_tail
 *     result.attrname = attrname             # <<<<<<<<<<<<<<
 *     return result
 * 
*/
  __Pyx_INCREF(__pyx_v_attrname);
  __Pyx_GIVEREF(__pyx_v_attrname);
  __Pyx_GOTREF(__pyx_v_result->attrname);
  __Pyx_DECREF(__pyx_v_result->attrname);
  __pyx_v_result->attrname = __pyx_v_attrname;

  /* "src/lxml/extensions.pxi":743
 *     result.is_tail = is_tail
 *     result.attrname = attrname
 *     return result             # <<<<<<<<<<<<<<
 * 
 * cdef object _buildElementStringResult(_Document doc, xmlNode* c_node,
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_result);
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  /* "src/lxml/extensions.pxi":737
 *         return self.attrname is not None
 * 
 * cdef object _elementStringResultFactory(string_value, _Element parent,             # <<<<<<<<<<<<<<
 *                                         attrname, bint is_tail):
 *     result = _ElementUnicodeResult(string_value)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._elementStringResultFactory", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/extensions.pxi":745
 *     return result
 * 
 * cdef object _buildElementStringResult(_Document doc, xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                                       _BaseContext context):
 *     cdef _Element parent = None
*/

static PyObject *__pyx_f_4lxml_5etree__buildElementStringResult(struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_node, struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_context) {
  struct LxmlElement *__pyx_v_parent = 0;
  PyObject *__pyx_v_attrname = 0;
  xmlNode *__pyx_v_c_element;
  int __pyx_v_is_tail;
  xmlChar *__pyx_v_s;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  char const *__pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  xmlNode *__pyx_t_12;
  int __pyx_t_13;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_buildElementStringResult", 0);

  /* "src/lxml/extensions.pxi":747
 * cdef object _buildElementStringResult(_Document doc, xmlNode* c_node,
 *                                       _BaseContext context):
 *     cdef _Element parent = None             # <<<<<<<<<<<<<<
 *     cdef object attrname = None
 *     cdef xmlNode* c_element
*/
  __Pyx_INCREF(Py_None);
  __pyx_v_parent = ((struct LxmlElement *)Py_None);

  /* "src/lxml/extensions.pxi":748
 *                                       _BaseContext context):
 *     cdef _Element parent = None
 *     cdef object attrname = None             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_element
 *     cdef bint is_tail
*/
  __Pyx_INCREF(Py_None);
  __pyx_v_attrname = Py_None;

  /* "src/lxml/extensions.pxi":752
 *     cdef bint is_tail
 * 
 *     if c_node.type == tree.XML_ATTRIBUTE_NODE:             # <<<<<<<<<<<<<<
 *         attrname = _namespacedName(c_node)
 *         is_tail = 0
*/
  __pyx_t_1 = (__pyx_v_c_node->type == XML_ATTRIBUTE_NODE);
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":753
 * 
 *     if c_node.type == tree.XML_ATTRIBUTE_NODE:
 *         attrname = _namespacedName(c_node)             # <<<<<<<<<<<<<<
 *         is_tail = 0
 *         s = tree.xmlNodeGetContent(c_node)
*/
    __pyx_t_2 = __pyx_f_4lxml_5etree__namespacedName(__pyx_v_c_node); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 753, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_attrname, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/extensions.pxi":754
 *     if c_node.type == tree.XML_ATTRIBUTE_NODE:
 *         attrname = _namespacedName(c_node)
 *         is_tail = 0             # <<<<<<<<<<<<<<
 *         s = tree.xmlNodeGetContent(c_node)
 *         if s is NULL:
*/
    __pyx_v_is_tail = 0;

    /* "src/lxml/extensions.pxi":755
 *         attrname = _namespacedName(c_node)
 *         is_tail = 0
 *         s = tree.xmlNodeGetContent(c_node)             # <<<<<<<<<<<<<<
 *         if s is NULL:
 *             raise MemoryError()
*/
    __pyx_v_s = xmlNodeGetContent(__pyx_v_c_node);

    /* "src/lxml/extensions.pxi":756
 *         is_tail = 0
 *         s = tree.xmlNodeGetContent(c_node)
 *         if s is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 *         try:
*/
    __pyx_t_1 = (__pyx_v_s == NULL);
    if (unlikely(__pyx_t_1)) {

      /* "src/lxml/extensions.pxi":757
 *         s = tree.xmlNodeGetContent(c_node)
 *         if s is NULL:
 *             raise MemoryError()             # <<<<<<<<<<<<<<
 *         try:
 *             value = funicode(s)
*/
      PyErr_NoMemory(); __PYX_ERR(18, 757, __pyx_L1_error)

      /* "src/lxml/extensions.pxi":756
 *         is_tail = 0
 *         s = tree.xmlNodeGetContent(c_node)
 *         if s is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 *         try:
*/
    }

    /* "src/lxml/extensions.pxi":758
 *         if s is NULL:
 *             raise MemoryError()
 *         try:             # <<<<<<<<<<<<<<
 *             value = funicode(s)
 *         finally:
*/
    /*try:*/ {

      /* "src/lxml/extensions.pxi":759
 *             raise MemoryError()
 *         try:
 *             value = funicode(s)             # <<<<<<<<<<<<<<
 *         finally:
 *             tree.xmlFree(s)
*/
      __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_s); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 759, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_v_value = ((PyObject*)__pyx_t_2);
      __pyx_t_2 = 0;
    }

    /* "src/lxml/extensions.pxi":761
 *             value = funicode(s)
 *         finally:
 *             tree.xmlFree(s)             # <<<<<<<<<<<<<<
 *         c_element = NULL
 *     else:
*/
    /*finally:*/ {
      /*normal exit:*/{
        xmlFree(__pyx_v_s);
        goto __pyx_L7;
      }
      __pyx_L6_error:;
      /*exception exit:*/{
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
         __Pyx_ExceptionSwap(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
        if ( unlikely(__Pyx_GetException(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8) < 0)) __Pyx_ErrFetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_6);
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_9);
        __Pyx_XGOTREF(__pyx_t_10);
        __Pyx_XGOTREF(__pyx_t_11);
        __pyx_t_3 = __pyx_lineno; __pyx_t_4 = __pyx_clineno; __pyx_t_5 = __pyx_filename;
        {
          xmlFree(__pyx_v_s);
        }
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_ErrRestore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
        __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
        __pyx_lineno = __pyx_t_3; __pyx_clineno = __pyx_t_4; __pyx_filename = __pyx_t_5;
        goto __pyx_L1_error;
      }
      __pyx_L7:;
    }

    /* "src/lxml/extensions.pxi":762
 *         finally:
 *             tree.xmlFree(s)
 *         c_element = NULL             # <<<<<<<<<<<<<<
 *     else:
 *         #assert c_node.type == tree.XML_TEXT_NODE or c_node.type == tree.XML_CDATA_SECTION_NODE, "invalid node type"
*/
    __pyx_v_c_element = NULL;

    /* "src/lxml/extensions.pxi":752
 *     cdef bint is_tail
 * 
 *     if c_node.type == tree.XML_ATTRIBUTE_NODE:             # <<<<<<<<<<<<<<
 *         attrname = _namespacedName(c_node)
 *         is_tail = 0
*/
    goto __pyx_L3;
  }

  /* "src/lxml/extensions.pxi":766
 *         #assert c_node.type == tree.XML_TEXT_NODE or c_node.type == tree.XML_CDATA_SECTION_NODE, "invalid node type"
 *         # may be tail text or normal text
 *         value = funicode(c_node.content)             # <<<<<<<<<<<<<<
 *         c_element = _previousElement(c_node)
 *         is_tail = c_element is not NULL
*/
  /*else*/ {
    __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_node->content); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 766, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_value = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/extensions.pxi":767
 *         # may be tail text or normal text
 *         value = funicode(c_node.content)
 *         c_element = _previousElement(c_node)             # <<<<<<<<<<<<<<
 *         is_tail = c_element is not NULL
 * 
*/
    __pyx_v_c_element = __pyx_f_4lxml_5etree__previousElement(__pyx_v_c_node);

    /* "src/lxml/extensions.pxi":768
 *         value = funicode(c_node.content)
 *         c_element = _previousElement(c_node)
 *         is_tail = c_element is not NULL             # <<<<<<<<<<<<<<
 * 
 *     if not context._build_smart_strings:
*/
    __pyx_v_is_tail = (__pyx_v_c_element != NULL);
  }
  __pyx_L3:;

  /* "src/lxml/extensions.pxi":770
 *         is_tail = c_element is not NULL
 * 
 *     if not context._build_smart_strings:             # <<<<<<<<<<<<<<
 *         return value
 * 
*/
  __pyx_t_1 = (!__pyx_v_context->_build_smart_strings);
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":771
 * 
 *     if not context._build_smart_strings:
 *         return value             # <<<<<<<<<<<<<<
 * 
 *     if c_element is NULL:
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_value);
    __pyx_r = __pyx_v_value;
    goto __pyx_L0;

    /* "src/lxml/extensions.pxi":770
 *         is_tail = c_element is not NULL
 * 
 *     if not context._build_smart_strings:             # <<<<<<<<<<<<<<
 *         return value
 * 
*/
  }

  /* "src/lxml/extensions.pxi":773
 *         return value
 * 
 *     if c_element is NULL:             # <<<<<<<<<<<<<<
 *         # non-tail text or attribute text
 *         c_element = c_node.parent
*/
  __pyx_t_1 = (__pyx_v_c_element == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":775
 *     if c_element is NULL:
 *         # non-tail text or attribute text
 *         c_element = c_node.parent             # <<<<<<<<<<<<<<
 *         while c_element is not NULL and not _isElement(c_element):
 *             c_element = c_element.parent
*/
    __pyx_t_12 = __pyx_v_c_node->parent;
    __pyx_v_c_element = __pyx_t_12;

    /* "src/lxml/extensions.pxi":776
 *         # non-tail text or attribute text
 *         c_element = c_node.parent
 *         while c_element is not NULL and not _isElement(c_element):             # <<<<<<<<<<<<<<
 *             c_element = c_element.parent
 * 
*/
    while (1) {
      __pyx_t_13 = (__pyx_v_c_element != NULL);
      if (__pyx_t_13) {
      } else {
        __pyx_t_1 = __pyx_t_13;
        goto __pyx_L14_bool_binop_done;
      }
      __pyx_t_13 = (!_isElement(__pyx_v_c_element));
      __pyx_t_1 = __pyx_t_13;
      __pyx_L14_bool_binop_done:;
      if (!__pyx_t_1) break;

      /* "src/lxml/extensions.pxi":777
 *         c_element = c_node.parent
 *         while c_element is not NULL and not _isElement(c_element):
 *             c_element = c_element.parent             # <<<<<<<<<<<<<<
 * 
 *     if c_element is not NULL:
*/
      __pyx_t_12 = __pyx_v_c_element->parent;
      __pyx_v_c_element = __pyx_t_12;
    }

    /* "src/lxml/extensions.pxi":773
 *         return value
 * 
 *     if c_element is NULL:             # <<<<<<<<<<<<<<
 *         # non-tail text or attribute text
 *         c_element = c_node.parent
*/
  }

  /* "src/lxml/extensions.pxi":779
 *             c_element = c_element.parent
 * 
 *     if c_element is not NULL:             # <<<<<<<<<<<<<<
 *         parent = _instantiateElementFromXPath(c_element, doc, context)
 * 
*/
  __pyx_t_1 = (__pyx_v_c_element != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":780
 * 
 *     if c_element is not NULL:
 *         parent = _instantiateElementFromXPath(c_element, doc, context)             # <<<<<<<<<<<<<<
 * 
 *     return _elementStringResultFactory(
*/
    __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__instantiateElementFromXPath(__pyx_v_c_element, __pyx_v_doc, __pyx_v_context)); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 780, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_parent, ((struct LxmlElement *)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "src/lxml/extensions.pxi":779
 *             c_element = c_element.parent
 * 
 *     if c_element is not NULL:             # <<<<<<<<<<<<<<
 *         parent = _instantiateElementFromXPath(c_element, doc, context)
 * 
*/
  }

  /* "src/lxml/extensions.pxi":782
 *         parent = _instantiateElementFromXPath(c_element, doc, context)
 * 
 *     return _elementStringResultFactory(             # <<<<<<<<<<<<<<
 *         value, parent, attrname, is_tail)
 * 
*/
  __Pyx_XDECREF(__pyx_r);

  /* "src/lxml/extensions.pxi":783
 * 
 *     return _elementStringResultFactory(
 *         value, parent, attrname, is_tail)             # <<<<<<<<<<<<<<
 * 
 * ################################################################################
*/
  __pyx_t_2 = __pyx_f_4lxml_5etree__elementStringResultFactory(__pyx_v_value, __pyx_v_parent, __pyx_v_attrname, __pyx_v_is_tail); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 782, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/extensions.pxi":745
 *     return result
 * 
 * cdef object _buildElementStringResult(_Document doc, xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                                       _BaseContext context):
 *     cdef _Element parent = None
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._buildElementStringResult", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_parent);
  __Pyx_XDECREF(__pyx_v_attrname);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/extensions.pxi":788
 * # callbacks for XPath/XSLT extension functions
 * 
 * cdef void _extension_function_call(_BaseContext context, function,             # <<<<<<<<<<<<<<
 *                                    xpath.xmlXPathParserContext* ctxt, int nargs) noexcept:
 *     cdef _Document doc
*/

static void __pyx_f_4lxml_5etree__extension_function_call(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_context, PyObject *__pyx_v_function, xmlXPathParserContext *__pyx_v_ctxt, int __pyx_v_nargs) {
  struct LxmlDocument *__pyx_v_doc = 0;
  xmlXPathObject *__pyx_v_obj;
  PyObject *__pyx_v_args = 0;
  CYTHON_UNUSED int __pyx_v_i;
  PyObject *__pyx_v_o = NULL;
  PyObject *__pyx_v_res = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  char const *__pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  int __pyx_t_17;
  PyObject *__pyx_t_18 = NULL;
  PyObject *__pyx_t_19 = NULL;
  xmlXPathObject *__pyx_t_20;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_extension_function_call", 0);

  /* "src/lxml/extensions.pxi":794
 *     cdef list args
 *     cdef int i
 *     doc = context._doc             # <<<<<<<<<<<<<<
 *     try:
 *         args = []
*/
  __pyx_t_1 = ((PyObject *)__pyx_v_context->_doc);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":795
 *     cdef int i
 *     doc = context._doc
 *     try:             # <<<<<<<<<<<<<<
 *         args = []
 *         for i in range(nargs):
*/
  /*try:*/ {
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_4);
      /*try:*/ {

        /* "src/lxml/extensions.pxi":796
 *     doc = context._doc
 *     try:
 *         args = []             # <<<<<<<<<<<<<<
 *         for i in range(nargs):
 *             obj = xpath.valuePop(ctxt)
*/
        __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 796, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_v_args = ((PyObject*)__pyx_t_1);
        __pyx_t_1 = 0;

        /* "src/lxml/extensions.pxi":797
 *     try:
 *         args = []
 *         for i in range(nargs):             # <<<<<<<<<<<<<<
 *             obj = xpath.valuePop(ctxt)
 *             try:
*/
        __pyx_t_5 = __pyx_v_nargs;
        __pyx_t_6 = __pyx_t_5;
        for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
          __pyx_v_i = __pyx_t_7;

          /* "src/lxml/extensions.pxi":798
 *         args = []
 *         for i in range(nargs):
 *             obj = xpath.valuePop(ctxt)             # <<<<<<<<<<<<<<
 *             try:
 *                 o = _unwrapXPathObject(obj, doc, context)
*/
          __pyx_v_obj = valuePop(__pyx_v_ctxt);

          /* "src/lxml/extensions.pxi":799
 *         for i in range(nargs):
 *             obj = xpath.valuePop(ctxt)
 *             try:             # <<<<<<<<<<<<<<
 *                 o = _unwrapXPathObject(obj, doc, context)
 *             finally:
*/
          /*try:*/ {

            /* "src/lxml/extensions.pxi":800
 *             obj = xpath.valuePop(ctxt)
 *             try:
 *                 o = _unwrapXPathObject(obj, doc, context)             # <<<<<<<<<<<<<<
 *             finally:
 *                 _freeXPathObject(obj)
*/
            __pyx_t_1 = __pyx_f_4lxml_5etree__unwrapXPathObject(__pyx_v_obj, __pyx_v_doc, __pyx_v_context); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 800, __pyx_L17_error)
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_XDECREF_SET(__pyx_v_o, __pyx_t_1);
            __pyx_t_1 = 0;
          }

          /* "src/lxml/extensions.pxi":802
 *                 o = _unwrapXPathObject(obj, doc, context)
 *             finally:
 *                 _freeXPathObject(obj)             # <<<<<<<<<<<<<<
 *             args.append(o)
 *         args.reverse()
*/
          /*finally:*/ {
            /*normal exit:*/{
              __pyx_f_4lxml_5etree__freeXPathObject(__pyx_v_obj);
              goto __pyx_L18;
            }
            __pyx_L17_error:;
            /*exception exit:*/{
              __Pyx_PyThreadState_declare
              __Pyx_PyThreadState_assign
              __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
              __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
               __Pyx_ExceptionSwap(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16);
              if ( unlikely(__Pyx_GetException(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13) < 0)) __Pyx_ErrFetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
              __Pyx_XGOTREF(__pyx_t_11);
              __Pyx_XGOTREF(__pyx_t_12);
              __Pyx_XGOTREF(__pyx_t_13);
              __Pyx_XGOTREF(__pyx_t_14);
              __Pyx_XGOTREF(__pyx_t_15);
              __Pyx_XGOTREF(__pyx_t_16);
              __pyx_t_8 = __pyx_lineno; __pyx_t_9 = __pyx_clineno; __pyx_t_10 = __pyx_filename;
              {
                __pyx_f_4lxml_5etree__freeXPathObject(__pyx_v_obj);
              }
              __Pyx_XGIVEREF(__pyx_t_14);
              __Pyx_XGIVEREF(__pyx_t_15);
              __Pyx_XGIVEREF(__pyx_t_16);
              __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16);
              __Pyx_XGIVEREF(__pyx_t_11);
              __Pyx_XGIVEREF(__pyx_t_12);
              __Pyx_XGIVEREF(__pyx_t_13);
              __Pyx_ErrRestore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
              __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
              __pyx_lineno = __pyx_t_8; __pyx_clineno = __pyx_t_9; __pyx_filename = __pyx_t_10;
              goto __pyx_L6_error;
            }
            __pyx_L18:;
          }

          /* "src/lxml/extensions.pxi":803
 *             finally:
 *                 _freeXPathObject(obj)
 *             args.append(o)             # <<<<<<<<<<<<<<
 *         args.reverse()
 * 
*/
          __pyx_t_17 = __Pyx_PyList_Append(__pyx_v_args, __pyx_v_o); if (unlikely(__pyx_t_17 == ((int)-1))) __PYX_ERR(18, 803, __pyx_L6_error)
        }

        /* "src/lxml/extensions.pxi":804
 *                 _freeXPathObject(obj)
 *             args.append(o)
 *         args.reverse()             # <<<<<<<<<<<<<<
 * 
 *         res = function(context, *args)
*/
        __pyx_t_17 = PyList_Reverse(__pyx_v_args); if (unlikely(__pyx_t_17 == ((int)-1))) __PYX_ERR(18, 804, __pyx_L6_error)

        /* "src/lxml/extensions.pxi":806
 *         args.reverse()
 * 
 *         res = function(context, *args)             # <<<<<<<<<<<<<<
 *         # wrap result for XPath consumption
 *         obj = _wrapXPathObject(res, doc, context)
*/
        __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 806, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_INCREF((PyObject *)__pyx_v_context);
        __Pyx_GIVEREF((PyObject *)__pyx_v_context);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_context)) != (0)) __PYX_ERR(18, 806, __pyx_L6_error);
        __pyx_t_18 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_18)) __PYX_ERR(18, 806, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_18);
        __pyx_t_19 = PyNumber_Add(__pyx_t_1, __pyx_t_18); if (unlikely(!__pyx_t_19)) __PYX_ERR(18, 806, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_19);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
        __pyx_t_18 = __Pyx_PyObject_Call(__pyx_v_function, __pyx_t_19, NULL); if (unlikely(!__pyx_t_18)) __PYX_ERR(18, 806, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_18);
        __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
        __pyx_v_res = __pyx_t_18;
        __pyx_t_18 = 0;

        /* "src/lxml/extensions.pxi":808
 *         res = function(context, *args)
 *         # wrap result for XPath consumption
 *         obj = _wrapXPathObject(res, doc, context)             # <<<<<<<<<<<<<<
 *         # prevent Python from deallocating elements handed to libxml2
 *         context._hold(res)
*/
        __pyx_t_20 = __pyx_f_4lxml_5etree__wrapXPathObject(__pyx_v_res, __pyx_v_doc, __pyx_v_context); if (unlikely(__pyx_t_20 == ((void *)NULL))) __PYX_ERR(18, 808, __pyx_L6_error)
        __pyx_v_obj = __pyx_t_20;

        /* "src/lxml/extensions.pxi":810
 *         obj = _wrapXPathObject(res, doc, context)
 *         # prevent Python from deallocating elements handed to libxml2
 *         context._hold(res)             # <<<<<<<<<<<<<<
 *         xpath.valuePush(ctxt, obj)
 *     except:
*/
        __pyx_t_18 = __pyx_f_4lxml_5etree_12_BaseContext__hold(__pyx_v_context, __pyx_v_res); if (unlikely(!__pyx_t_18)) __PYX_ERR(18, 810, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_18);
        __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;

        /* "src/lxml/extensions.pxi":811
 *         # prevent Python from deallocating elements handed to libxml2
 *         context._hold(res)
 *         xpath.valuePush(ctxt, obj)             # <<<<<<<<<<<<<<
 *     except:
 *         xpath.xmlXPathErr(ctxt, xpath.XPATH_EXPR_ERROR)
*/
        (void)(valuePush(__pyx_v_ctxt, __pyx_v_obj));

        /* "src/lxml/extensions.pxi":795
 *     cdef int i
 *     doc = context._doc
 *     try:             # <<<<<<<<<<<<<<
 *         args = []
 *         for i in range(nargs):
*/
      }
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L11_try_end;
      __pyx_L6_error:;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
      __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;

      /* "src/lxml/extensions.pxi":812
 *         context._hold(res)
 *         xpath.valuePush(ctxt, obj)
 *     except:             # <<<<<<<<<<<<<<
 *         xpath.xmlXPathErr(ctxt, xpath.XPATH_EXPR_ERROR)
 *         context._exc._store_raised()
*/
      /*except:*/ {
        __Pyx_AddTraceback("lxml.etree._extension_function_call", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_18, &__pyx_t_19, &__pyx_t_1) < 0) __PYX_ERR(18, 812, __pyx_L8_except_error)
        __Pyx_XGOTREF(__pyx_t_18);
        __Pyx_XGOTREF(__pyx_t_19);
        __Pyx_XGOTREF(__pyx_t_1);

        /* "src/lxml/extensions.pxi":813
 *         xpath.valuePush(ctxt, obj)
 *     except:
 *         xpath.xmlXPathErr(ctxt, xpath.XPATH_EXPR_ERROR)             # <<<<<<<<<<<<<<
 *         context._exc._store_raised()
 *     finally:
*/
        xmlXPathErr(__pyx_v_ctxt, XPATH_EXPR_ERROR);

        /* "src/lxml/extensions.pxi":814
 *     except:
 *         xpath.xmlXPathErr(ctxt, xpath.XPATH_EXPR_ERROR)
 *         context._exc._store_raised()             # <<<<<<<<<<<<<<
 *     finally:
 *         return  # swallow any further exceptions
*/
        __pyx_f_4lxml_5etree_17_ExceptionContext__store_raised(__pyx_v_context->_exc);
        __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
        __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L7_exception_handled;
      }

      /* "src/lxml/extensions.pxi":795
 *     cdef int i
 *     doc = context._doc
 *     try:             # <<<<<<<<<<<<<<
 *         args = []
 *         for i in range(nargs):
*/
      __pyx_L8_except_error:;
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
      goto __pyx_L4_error;
      __pyx_L7_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
      __pyx_L11_try_end:;
    }
  }

  /* "src/lxml/extensions.pxi":816
 *         context._exc._store_raised()
 *     finally:
 *         return  # swallow any further exceptions             # <<<<<<<<<<<<<<
 * 
 * # lookup the function by name and call it
*/
  /*finally:*/ {
    /*normal exit:*/{
      goto __pyx_L0;
    }
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_16 = 0; __pyx_t_15 = 0; __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
      __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_16, &__pyx_t_15, &__pyx_t_14);
      if ( unlikely(__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2) < 0)) __Pyx_ErrFetch(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_16);
      __Pyx_XGOTREF(__pyx_t_15);
      __Pyx_XGOTREF(__pyx_t_14);
      {
        goto __pyx_L25_return;
      }
      __pyx_L25_return:;
      __Pyx_XGIVEREF(__pyx_t_16);
      __Pyx_XGIVEREF(__pyx_t_15);
      __Pyx_XGIVEREF(__pyx_t_14);
      __Pyx_ExceptionReset(__pyx_t_16, __pyx_t_15, __pyx_t_14);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_16 = 0; __pyx_t_15 = 0; __pyx_t_14 = 0;
      goto __pyx_L0;
    }
  }

  /* "src/lxml/extensions.pxi":788
 * # callbacks for XPath/XSLT extension functions
 * 
 * cdef void _extension_function_call(_BaseContext context, function,             # <<<<<<<<<<<<<<
 *                                    xpath.xmlXPathParserContext* ctxt, int nargs) noexcept:
 *     cdef _Document doc
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_o);
  __Pyx_XDECREF(__pyx_v_res);
  __Pyx_RefNannyFinishContext();
}

/* "src/lxml/extensions.pxi":820
 * # lookup the function by name and call it
 * 
 * cdef void _xpath_function_call(xpath.xmlXPathParserContext* ctxt,             # <<<<<<<<<<<<<<
 *                                int nargs) noexcept with gil:
 *     cdef _BaseContext context
*/

static void __pyx_f_4lxml_5etree__xpath_function_call(xmlXPathParserContext *__pyx_v_ctxt, int __pyx_v_nargs) {
  struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_context = 0;
  xmlXPathContext *__pyx_v_rctxt;
  PyObject *__pyx_v_function = NULL;
  __Pyx_RefNannyDeclarations
  xmlXPathContext *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10[3];
  size_t __pyx_t_11;
  int __pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("_xpath_function_call", 0);

  /* "src/lxml/extensions.pxi":823
 *                                int nargs) noexcept with gil:
 *     cdef _BaseContext context
 *     cdef xpath.xmlXPathContext* rctxt = ctxt.context             # <<<<<<<<<<<<<<
 *     context = <_BaseContext> rctxt.userData
 *     try:
*/
  __pyx_t_1 = __pyx_v_ctxt->context;
  __pyx_v_rctxt = __pyx_t_1;

  /* "src/lxml/extensions.pxi":824
 *     cdef _BaseContext context
 *     cdef xpath.xmlXPathContext* rctxt = ctxt.context
 *     context = <_BaseContext> rctxt.userData             # <<<<<<<<<<<<<<
 *     try:
 *         function = context._find_cached_function(rctxt.functionURI, rctxt.function)
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_rctxt->userData);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/extensions.pxi":825
 *     cdef xpath.xmlXPathContext* rctxt = ctxt.context
 *     context = <_BaseContext> rctxt.userData
 *     try:             # <<<<<<<<<<<<<<
 *         function = context._find_cached_function(rctxt.functionURI, rctxt.function)
 *         if function is not None:
*/
  /*try:*/ {
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_5);
      /*try:*/ {

        /* "src/lxml/extensions.pxi":826
 *     context = <_BaseContext> rctxt.userData
 *     try:
 *         function = context._find_cached_function(rctxt.functionURI, rctxt.function)             # <<<<<<<<<<<<<<
 *         if function is not None:
 *             _extension_function_call(context, function, ctxt, nargs)
*/
        __pyx_t_2 = __pyx_f_4lxml_5etree_12_BaseContext__find_cached_function(__pyx_v_context, __pyx_v_rctxt->functionURI, __pyx_v_rctxt->function); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 826, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_v_function = __pyx_t_2;
        __pyx_t_2 = 0;

        /* "src/lxml/extensions.pxi":827
 *     try:
 *         function = context._find_cached_function(rctxt.functionURI, rctxt.function)
 *         if function is not None:             # <<<<<<<<<<<<<<
 *             _extension_function_call(context, function, ctxt, nargs)
 *         else:
*/
        __pyx_t_6 = (__pyx_v_function != Py_None);
        if (__pyx_t_6) {

          /* "src/lxml/extensions.pxi":828
 *         function = context._find_cached_function(rctxt.functionURI, rctxt.function)
 *         if function is not None:
 *             _extension_function_call(context, function, ctxt, nargs)             # <<<<<<<<<<<<<<
 *         else:
 *             xpath.xmlXPathErr(ctxt, xpath.XPATH_UNKNOWN_FUNC_ERROR)
*/
          __pyx_f_4lxml_5etree__extension_function_call(__pyx_v_context, __pyx_v_function, __pyx_v_ctxt, __pyx_v_nargs);

          /* "src/lxml/extensions.pxi":827
 *     try:
 *         function = context._find_cached_function(rctxt.functionURI, rctxt.function)
 *         if function is not None:             # <<<<<<<<<<<<<<
 *             _extension_function_call(context, function, ctxt, nargs)
 *         else:
*/
          goto __pyx_L12;
        }

        /* "src/lxml/extensions.pxi":830
 *             _extension_function_call(context, function, ctxt, nargs)
 *         else:
 *             xpath.xmlXPathErr(ctxt, xpath.XPATH_UNKNOWN_FUNC_ERROR)             # <<<<<<<<<<<<<<
 *             context._exc._store_exception(XPathFunctionError(
 *                 f"XPath function '{_namespacedNameFromNsName(rctxt.functionURI, rctxt.function)}' not found"))
*/
        /*else*/ {
          xmlXPathErr(__pyx_v_ctxt, XPATH_UNKNOWN_FUNC_ERROR);

          /* "src/lxml/extensions.pxi":831
 *         else:
 *             xpath.xmlXPathErr(ctxt, xpath.XPATH_UNKNOWN_FUNC_ERROR)
 *             context._exc._store_exception(XPathFunctionError(             # <<<<<<<<<<<<<<
 *                 f"XPath function '{_namespacedNameFromNsName(rctxt.functionURI, rctxt.function)}' not found"))
 *     except:
*/
          __pyx_t_7 = NULL;

          /* "src/lxml/extensions.pxi":832
 *             xpath.xmlXPathErr(ctxt, xpath.XPATH_UNKNOWN_FUNC_ERROR)
 *             context._exc._store_exception(XPathFunctionError(
 *                 f"XPath function '{_namespacedNameFromNsName(rctxt.functionURI, rctxt.function)}' not found"))             # <<<<<<<<<<<<<<
 *     except:
 *         # may not be the right error, but we need to tell libxml2 *something*
*/
          __pyx_t_8 = __pyx_f_4lxml_5etree__namespacedNameFromNsName(__pyx_v_rctxt->functionURI, __pyx_v_rctxt->function); if (unlikely(!__pyx_t_8)) __PYX_ERR(18, 832, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_9 = __Pyx_PyUnicode_Unicode(__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(18, 832, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __pyx_t_10[0] = __pyx_mstate_global->__pyx_kp_u_XPath_function;
          __pyx_t_10[1] = __pyx_t_9;
          __pyx_t_10[2] = __pyx_mstate_global->__pyx_kp_u_not_found;
          __pyx_t_8 = __Pyx_PyUnicode_Join(__pyx_t_10, 3, 16 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_9) + 11, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_9));
          if (unlikely(!__pyx_t_8)) __PYX_ERR(18, 832, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_t_11 = 1;
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_8};
            __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XPathFunctionError, __pyx_callargs+__pyx_t_11, (2-__pyx_t_11) | (__pyx_t_11*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 831, __pyx_L6_error)
            __Pyx_GOTREF((PyObject *)__pyx_t_2);
          }

          /* "src/lxml/extensions.pxi":831
 *         else:
 *             xpath.xmlXPathErr(ctxt, xpath.XPATH_UNKNOWN_FUNC_ERROR)
 *             context._exc._store_exception(XPathFunctionError(             # <<<<<<<<<<<<<<
 *                 f"XPath function '{_namespacedNameFromNsName(rctxt.functionURI, rctxt.function)}' not found"))
 *     except:
*/
          __pyx_t_12 = __pyx_f_4lxml_5etree_17_ExceptionContext__store_exception(__pyx_v_context->_exc, ((PyObject *)__pyx_t_2)); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(18, 831, __pyx_L6_error)
          __Pyx_DECREF((PyObject *)__pyx_t_2); __pyx_t_2 = 0;
        }
        __pyx_L12:;

        /* "src/lxml/extensions.pxi":825
 *     cdef xpath.xmlXPathContext* rctxt = ctxt.context
 *     context = <_BaseContext> rctxt.userData
 *     try:             # <<<<<<<<<<<<<<
 *         function = context._find_cached_function(rctxt.functionURI, rctxt.function)
 *         if function is not None:
*/
      }
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L11_try_end;
      __pyx_L6_error:;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "src/lxml/extensions.pxi":833
 *             context._exc._store_exception(XPathFunctionError(
 *                 f"XPath function '{_namespacedNameFromNsName(rctxt.functionURI, rctxt.function)}' not found"))
 *     except:             # <<<<<<<<<<<<<<
 *         # may not be the right error, but we need to tell libxml2 *something*
 *         xpath.xmlXPathErr(ctxt, xpath.XPATH_UNKNOWN_FUNC_ERROR)
*/
      /*except:*/ {
        __Pyx_AddTraceback("lxml.etree._xpath_function_call", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_8, &__pyx_t_7) < 0) __PYX_ERR(18, 833, __pyx_L8_except_error)
        __Pyx_XGOTREF(__pyx_t_2);
        __Pyx_XGOTREF(__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_7);

        /* "src/lxml/extensions.pxi":835
 *     except:
 *         # may not be the right error, but we need to tell libxml2 *something*
 *         xpath.xmlXPathErr(ctxt, xpath.XPATH_UNKNOWN_FUNC_ERROR)             # <<<<<<<<<<<<<<
 *         context._exc._store_raised()
 *     finally:
*/
        xmlXPathErr(__pyx_v_ctxt, XPATH_UNKNOWN_FUNC_ERROR);

        /* "src/lxml/extensions.pxi":836
 *         # may not be the right error, but we need to tell libxml2 *something*
 *         xpath.xmlXPathErr(ctxt, xpath.XPATH_UNKNOWN_FUNC_ERROR)
 *         context._exc._store_raised()             # <<<<<<<<<<<<<<
 *     finally:
 *         return  # swallow any further exceptions
*/
        __pyx_f_4lxml_5etree_17_ExceptionContext__store_raised(__pyx_v_context->_exc);
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        goto __pyx_L7_exception_handled;
      }

      /* "src/lxml/extensions.pxi":825
 *     cdef xpath.xmlXPathContext* rctxt = ctxt.context
 *     context = <_BaseContext> rctxt.userData
 *     try:             # <<<<<<<<<<<<<<
 *         function = context._find_cached_function(rctxt.functionURI, rctxt.function)
 *         if function is not None:
*/
      __pyx_L8_except_error:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      goto __pyx_L4_error;
      __pyx_L7_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      __pyx_L11_try_end:;
    }
  }

  /* "src/lxml/extensions.pxi":838
 *         context._exc._store_raised()
 *     finally:
 *         return  # swallow any further exceptions             # <<<<<<<<<<<<<<
*/
  /*finally:*/ {
    /*normal exit:*/{
      goto __pyx_L0;
    }
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
      if ( unlikely(__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3) < 0)) __Pyx_ErrFetch(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_14);
      __Pyx_XGOTREF(__pyx_t_15);
      {
        goto __pyx_L15_return;
      }
      __pyx_L15_return:;
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_XGIVEREF(__pyx_t_14);
      __Pyx_XGIVEREF(__pyx_t_15);
      __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      goto __pyx_L0;
    }
  }

  /* "src/lxml/extensions.pxi":820
 * # lookup the function by name and call it
 * 
 * cdef void _xpath_function_call(xpath.xmlXPathParserContext* ctxt,             # <<<<<<<<<<<<<<
 *                                int nargs) noexcept with gil:
 *     cdef _BaseContext context
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_function);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
}

/* "src/lxml/xpath.pxi":29
 * )
 * 
 * cdef int _register_xpath_function(void* ctxt, name_utf, ns_utf) noexcept:             # <<<<<<<<<<<<<<
 *     if ns_utf is None:
 *         return xpath.xmlXPathRegisterFunc(
*/

static int __pyx_f_4lxml_5etree__register_xpath_function(void *__pyx_v_ctxt, PyObject *__pyx_v_name_utf, PyObject *__pyx_v_ns_utf) {
  int __pyx_r;
  int __pyx_t_1;

  /* "src/lxml/xpath.pxi":30
 * 
 * cdef int _register_xpath_function(void* ctxt, name_utf, ns_utf) noexcept:
 *     if ns_utf is None:             # <<<<<<<<<<<<<<
 *         return xpath.xmlXPathRegisterFunc(
 *             <xpath.xmlXPathContext*>ctxt, _xcstr(name_utf),
*/
  __pyx_t_1 = (__pyx_v_ns_utf == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/xpath.pxi":31
 * cdef int _register_xpath_function(void* ctxt, name_utf, ns_utf) noexcept:
 *     if ns_utf is None:
 *         return xpath.xmlXPathRegisterFunc(             # <<<<<<<<<<<<<<
 *             <xpath.xmlXPathContext*>ctxt, _xcstr(name_utf),
 *             _xpath_function_call)
*/
    __pyx_r = xmlXPathRegisterFunc(((xmlXPathContext *)__pyx_v_ctxt), (const xmlChar*)PyBytes_AS_STRING(__pyx_v_name_utf), __pyx_f_4lxml_5etree__xpath_function_call);
    goto __pyx_L0;

    /* "src/lxml/xpath.pxi":30
 * 
 * cdef int _register_xpath_function(void* ctxt, name_utf, ns_utf) noexcept:
 *     if ns_utf is None:             # <<<<<<<<<<<<<<
 *         return xpath.xmlXPathRegisterFunc(
 *             <xpath.xmlXPathContext*>ctxt, _xcstr(name_utf),
*/
  }

  /* "src/lxml/xpath.pxi":35
 *             _xpath_function_call)
 *     else:
 *         return xpath.xmlXPathRegisterFuncNS(             # <<<<<<<<<<<<<<
 *             <xpath.xmlXPathContext*>ctxt, _xcstr(name_utf), _xcstr(ns_utf),
 *             _xpath_function_call)
*/
  /*else*/ {

    /* "src/lxml/xpath.pxi":37
 *         return xpath.xmlXPathRegisterFuncNS(
 *             <xpath.xmlXPathContext*>ctxt, _xcstr(name_utf), _xcstr(ns_utf),
 *             _xpath_function_call)             # <<<<<<<<<<<<<<
 * 
 * cdef int _unregister_xpath_function(void* ctxt, name_utf, ns_utf) noexcept:
*/
    __pyx_r = xmlXPathRegisterFuncNS(((xmlXPathContext *)__pyx_v_ctxt), (const xmlChar*)PyBytes_AS_STRING(__pyx_v_name_utf), (const xmlChar*)PyBytes_AS_STRING(__pyx_v_ns_utf), __pyx_f_4lxml_5etree__xpath_function_call);
    goto __pyx_L0;
  }

  /* "src/lxml/xpath.pxi":29
 * )
 * 
 * cdef int _register_xpath_function(void* ctxt, name_utf, ns_utf) noexcept:             # <<<<<<<<<<<<<<
 *     if ns_utf is None:
 *         return xpath.xmlXPathRegisterFunc(
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/xpath.pxi":39
 *             _xpath_function_call)
 * 
 * cdef int _unregister_xpath_function(void* ctxt, name_utf, ns_utf) noexcept:             # <<<<<<<<<<<<<<
 *     if ns_utf is None:
 *         return xpath.xmlXPathRegisterFunc(
*/

static int __pyx_f_4lxml_5etree__unregister_xpath_function(void *__pyx_v_ctxt, PyObject *__pyx_v_name_utf, PyObject *__pyx_v_ns_utf) {
  int __pyx_r;
  int __pyx_t_1;

  /* "src/lxml/xpath.pxi":40
 * 
 * cdef int _unregister_xpath_function(void* ctxt, name_utf, ns_utf) noexcept:
 *     if ns_utf is None:             # <<<<<<<<<<<<<<
 *         return xpath.xmlXPathRegisterFunc(
 *             <xpath.xmlXPathContext*>ctxt, _xcstr(name_utf), NULL)
*/
  __pyx_t_1 = (__pyx_v_ns_utf == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/xpath.pxi":41
 * cdef int _unregister_xpath_function(void* ctxt, name_utf, ns_utf) noexcept:
 *     if ns_utf is None:
 *         return xpath.xmlXPathRegisterFunc(             # <<<<<<<<<<<<<<
 *             <xpath.xmlXPathContext*>ctxt, _xcstr(name_utf), NULL)
 *     else:
*/
    __pyx_r = xmlXPathRegisterFunc(((xmlXPathContext *)__pyx_v_ctxt), (const xmlChar*)PyBytes_AS_STRING(__pyx_v_name_utf), NULL);
    goto __pyx_L0;

    /* "src/lxml/xpath.pxi":40
 * 
 * cdef int _unregister_xpath_function(void* ctxt, name_utf, ns_utf) noexcept:
 *     if ns_utf is None:             # <<<<<<<<<<<<<<
 *         return xpath.xmlXPathRegisterFunc(
 *             <xpath.xmlXPathContext*>ctxt, _xcstr(name_utf), NULL)
*/
  }

  /* "src/lxml/xpath.pxi":44
 *             <xpath.xmlXPathContext*>ctxt, _xcstr(name_utf), NULL)
 *     else:
 *         return xpath.xmlXPathRegisterFuncNS(             # <<<<<<<<<<<<<<
 *             <xpath.xmlXPathContext*>ctxt, _xcstr(name_utf), _xcstr(ns_utf), NULL)
 * 
*/
  /*else*/ {

    /* "src/lxml/xpath.pxi":45
 *     else:
 *         return xpath.xmlXPathRegisterFuncNS(
 *             <xpath.xmlXPathContext*>ctxt, _xcstr(name_utf), _xcstr(ns_utf), NULL)             # <<<<<<<<<<<<<<
 * 
 * 
*/
    __pyx_r = xmlXPathRegisterFuncNS(((xmlXPathContext *)__pyx_v_ctxt), (const xmlChar*)PyBytes_AS_STRING(__pyx_v_name_utf), (const xmlChar*)PyBytes_AS_STRING(__pyx_v_ns_utf), NULL);
    goto __pyx_L0;
  }

  /* "src/lxml/xpath.pxi":39
 *             _xpath_function_call)
 * 
 * cdef int _unregister_xpath_function(void* ctxt, name_utf, ns_utf) noexcept:             # <<<<<<<<<<<<<<
 *     if ns_utf is None:
 *         return xpath.xmlXPathRegisterFunc(
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/xpath.pxi":52
 * cdef class _XPathContext(_BaseContext):
 *     cdef object _variables
 *     def __init__(self, namespaces, extensions, error_log, enable_regexp, variables,             # <<<<<<<<<<<<<<
 *                  build_smart_strings):
 *         self._variables = variables
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_13_XPathContext_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_13_XPathContext_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_namespaces = 0;
  PyObject *__pyx_v_extensions = 0;
  PyObject *__pyx_v_error_log = 0;
  PyObject *__pyx_v_enable_regexp = 0;
  PyObject *__pyx_v_variables = 0;
  PyObject *__pyx_v_build_smart_strings = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[6] = {0,0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_namespaces,&__pyx_mstate_global->__pyx_n_u_extensions,&__pyx_mstate_global->__pyx_n_u_error_log,&__pyx_mstate_global->__pyx_n_u_enable_regexp,&__pyx_mstate_global->__pyx_n_u_variables,&__pyx_mstate_global->__pyx_n_u_build_smart_strings,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(19, 52, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  6:
        values[5] = __Pyx_ArgRef_VARARGS(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(19, 52, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(19, 52, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(19, 52, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(19, 52, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(19, 52, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(19, 52, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(19, 52, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 6; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, i); __PYX_ERR(19, 52, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 6)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(19, 52, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(19, 52, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(19, 52, __pyx_L3_error)
      values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(19, 52, __pyx_L3_error)
      values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(19, 52, __pyx_L3_error)
      values[5] = __Pyx_ArgRef_VARARGS(__pyx_args, 5);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(19, 52, __pyx_L3_error)
    }
    __pyx_v_namespaces = values[0];
    __pyx_v_extensions = values[1];
    __pyx_v_error_log = values[2];
    __pyx_v_enable_regexp = values[3];
    __pyx_v_variables = values[4];
    __pyx_v_build_smart_strings = values[5];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, __pyx_nargs); __PYX_ERR(19, 52, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._XPathContext.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_13_XPathContext___init__(((struct __pyx_obj_4lxml_5etree__XPathContext *)__pyx_v_self), __pyx_v_namespaces, __pyx_v_extensions, __pyx_v_error_log, __pyx_v_enable_regexp, __pyx_v_variables, __pyx_v_build_smart_strings);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_13_XPathContext___init__(struct __pyx_obj_4lxml_5etree__XPathContext *__pyx_v_self, PyObject *__pyx_v_namespaces, PyObject *__pyx_v_extensions, PyObject *__pyx_v_error_log, PyObject *__pyx_v_enable_regexp, PyObject *__pyx_v_variables, PyObject *__pyx_v_build_smart_strings) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "src/lxml/xpath.pxi":54
 *     def __init__(self, namespaces, extensions, error_log, enable_regexp, variables,
 *                  build_smart_strings):
 *         self._variables = variables             # <<<<<<<<<<<<<<
 *         _BaseContext.__init__(self, namespaces, extensions, error_log, enable_regexp,
 *                               build_smart_strings)
*/
  __Pyx_INCREF(__pyx_v_variables);
  __Pyx_GIVEREF(__pyx_v_variables);
  __Pyx_GOTREF(__pyx_v_self->_variables);
  __Pyx_DECREF(__pyx_v_self->_variables);
  __pyx_v_self->_variables = __pyx_v_variables;

  /* "src/lxml/xpath.pxi":55
 *                  build_smart_strings):
 *         self._variables = variables
 *         _BaseContext.__init__(self, namespaces, extensions, error_log, enable_regexp,             # <<<<<<<<<<<<<<
 *                               build_smart_strings)
 * 
*/
  __pyx_t_2 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__BaseContext);
  __Pyx_INCREF(__pyx_t_2);

  /* "src/lxml/xpath.pxi":56
 *         self._variables = variables
 *         _BaseContext.__init__(self, namespaces, extensions, error_log, enable_regexp,
 *                               build_smart_strings)             # <<<<<<<<<<<<<<
 * 
 *     cdef set_context(self, xpath.xmlXPathContext* xpathCtxt):
*/
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[7] = {__pyx_t_2, ((PyObject *)__pyx_v_self), __pyx_v_namespaces, __pyx_v_extensions, __pyx_v_error_log, __pyx_v_enable_regexp, __pyx_v_build_smart_strings};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_init, __pyx_callargs+__pyx_t_3, (7-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 55, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xpath.pxi":52
 * cdef class _XPathContext(_BaseContext):
 *     cdef object _variables
 *     def __init__(self, namespaces, extensions, error_log, enable_regexp, variables,             # <<<<<<<<<<<<<<
 *                  build_smart_strings):
 *         self._variables = variables
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._XPathContext.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xpath.pxi":58
 *                               build_smart_strings)
 * 
 *     cdef set_context(self, xpath.xmlXPathContext* xpathCtxt):             # <<<<<<<<<<<<<<
 *         self._set_xpath_context(xpathCtxt)
 *         # This would be a good place to set up the XPath parser dict, but
*/

static PyObject *__pyx_f_4lxml_5etree_13_XPathContext_set_context(struct __pyx_obj_4lxml_5etree__XPathContext *__pyx_v_self, xmlXPathContext *__pyx_v_xpathCtxt) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_context", 0);

  /* "src/lxml/xpath.pxi":59
 * 
 *     cdef set_context(self, xpath.xmlXPathContext* xpathCtxt):
 *         self._set_xpath_context(xpathCtxt)             # <<<<<<<<<<<<<<
 *         # This would be a good place to set up the XPath parser dict, but
 *         # we cannot use the current thread dict as we do not know which
*/
  ((struct __pyx_vtabstruct_4lxml_5etree__XPathContext *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._set_xpath_context(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self), __pyx_v_xpathCtxt);

  /* "src/lxml/xpath.pxi":63
 *         # we cannot use the current thread dict as we do not know which
 *         # thread will execute the XPath evaluator - so, no dict for now.
 *         self.registerLocalNamespaces()             # <<<<<<<<<<<<<<
 *         self.registerLocalFunctions(xpathCtxt, _register_xpath_function)
 * 
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__XPathContext *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.registerLocalNamespaces(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 63, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xpath.pxi":64
 *         # thread will execute the XPath evaluator - so, no dict for now.
 *         self.registerLocalNamespaces()
 *         self.registerLocalFunctions(xpathCtxt, _register_xpath_function)             # <<<<<<<<<<<<<<
 * 
 *     cdef register_context(self, _Document doc):
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__XPathContext *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.registerLocalFunctions(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self), __pyx_v_xpathCtxt, __pyx_f_4lxml_5etree__register_xpath_function); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 64, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xpath.pxi":58
 *                               build_smart_strings)
 * 
 *     cdef set_context(self, xpath.xmlXPathContext* xpathCtxt):             # <<<<<<<<<<<<<<
 *         self._set_xpath_context(xpathCtxt)
 *         # This would be a good place to set up the XPath parser dict, but
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._XPathContext.set_context", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xpath.pxi":66
 *         self.registerLocalFunctions(xpathCtxt, _register_xpath_function)
 * 
 *     cdef register_context(self, _Document doc):             # <<<<<<<<<<<<<<
 *         self._register_context(doc)
 *         self.registerGlobalNamespaces()
*/

static PyObject *__pyx_f_4lxml_5etree_13_XPathContext_register_context(struct __pyx_obj_4lxml_5etree__XPathContext *__pyx_v_self, struct LxmlDocument *__pyx_v_doc) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("register_context", 0);

  /* "src/lxml/xpath.pxi":67
 * 
 *     cdef register_context(self, _Document doc):
 *         self._register_context(doc)             # <<<<<<<<<<<<<<
 *         self.registerGlobalNamespaces()
 *         self.registerGlobalFunctions(self._xpathCtxt, _register_xpath_function)
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_12_BaseContext__register_context(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self), __pyx_v_doc); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 67, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xpath.pxi":68
 *     cdef register_context(self, _Document doc):
 *         self._register_context(doc)
 *         self.registerGlobalNamespaces()             # <<<<<<<<<<<<<<
 *         self.registerGlobalFunctions(self._xpathCtxt, _register_xpath_function)
 *         self.registerExsltFunctions()
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__XPathContext *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.registerGlobalNamespaces(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 68, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xpath.pxi":69
 *         self._register_context(doc)
 *         self.registerGlobalNamespaces()
 *         self.registerGlobalFunctions(self._xpathCtxt, _register_xpath_function)             # <<<<<<<<<<<<<<
 *         self.registerExsltFunctions()
 *         if self._variables is not None:
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__XPathContext *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.registerGlobalFunctions(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self), __pyx_v_self->__pyx_base._xpathCtxt, __pyx_f_4lxml_5etree__register_xpath_function); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 69, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xpath.pxi":70
 *         self.registerGlobalNamespaces()
 *         self.registerGlobalFunctions(self._xpathCtxt, _register_xpath_function)
 *         self.registerExsltFunctions()             # <<<<<<<<<<<<<<
 *         if self._variables is not None:
 *             self.registerVariables(self._variables)
*/
  __pyx_f_4lxml_5etree_13_XPathContext_registerExsltFunctions(__pyx_v_self);

  /* "src/lxml/xpath.pxi":71
 *         self.registerGlobalFunctions(self._xpathCtxt, _register_xpath_function)
 *         self.registerExsltFunctions()
 *         if self._variables is not None:             # <<<<<<<<<<<<<<
 *             self.registerVariables(self._variables)
 * 
*/
  __pyx_t_2 = (__pyx_v_self->_variables != Py_None);
  if (__pyx_t_2) {

    /* "src/lxml/xpath.pxi":72
 *         self.registerExsltFunctions()
 *         if self._variables is not None:
 *             self.registerVariables(self._variables)             # <<<<<<<<<<<<<<
 * 
 *     cdef unregister_context(self):
*/
    __pyx_t_1 = __pyx_v_self->_variables;
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_3 = __pyx_f_4lxml_5etree_13_XPathContext_registerVariables(__pyx_v_self, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(19, 72, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/xpath.pxi":71
 *         self.registerGlobalFunctions(self._xpathCtxt, _register_xpath_function)
 *         self.registerExsltFunctions()
 *         if self._variables is not None:             # <<<<<<<<<<<<<<
 *             self.registerVariables(self._variables)
 * 
*/
  }

  /* "src/lxml/xpath.pxi":66
 *         self.registerLocalFunctions(xpathCtxt, _register_xpath_function)
 * 
 *     cdef register_context(self, _Document doc):             # <<<<<<<<<<<<<<
 *         self._register_context(doc)
 *         self.registerGlobalNamespaces()
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._XPathContext.register_context", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xpath.pxi":74
 *             self.registerVariables(self._variables)
 * 
 *     cdef unregister_context(self):             # <<<<<<<<<<<<<<
 *         self.unregisterGlobalFunctions(
 *             self._xpathCtxt, _unregister_xpath_function)
*/

static PyObject *__pyx_f_4lxml_5etree_13_XPathContext_unregister_context(struct __pyx_obj_4lxml_5etree__XPathContext *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("unregister_context", 0);

  /* "src/lxml/xpath.pxi":75
 * 
 *     cdef unregister_context(self):
 *         self.unregisterGlobalFunctions(             # <<<<<<<<<<<<<<
 *             self._xpathCtxt, _unregister_xpath_function)
 *         self.unregisterGlobalNamespaces()
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__XPathContext *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.unregisterGlobalFunctions(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self), __pyx_v_self->__pyx_base._xpathCtxt, __pyx_f_4lxml_5etree__unregister_xpath_function); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 75, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xpath.pxi":77
 *         self.unregisterGlobalFunctions(
 *             self._xpathCtxt, _unregister_xpath_function)
 *         self.unregisterGlobalNamespaces()             # <<<<<<<<<<<<<<
 *         xpath.xmlXPathRegisteredVariablesCleanup(self._xpathCtxt)
 *         self._cleanup_context()
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__XPathContext *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.unregisterGlobalNamespaces(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 77, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xpath.pxi":78
 *             self._xpathCtxt, _unregister_xpath_function)
 *         self.unregisterGlobalNamespaces()
 *         xpath.xmlXPathRegisteredVariablesCleanup(self._xpathCtxt)             # <<<<<<<<<<<<<<
 *         self._cleanup_context()
 * 
*/
  xmlXPathRegisteredVariablesCleanup(__pyx_v_self->__pyx_base._xpathCtxt);

  /* "src/lxml/xpath.pxi":79
 *         self.unregisterGlobalNamespaces()
 *         xpath.xmlXPathRegisteredVariablesCleanup(self._xpathCtxt)
 *         self._cleanup_context()             # <<<<<<<<<<<<<<
 * 
 *     cdef void registerExsltFunctions(self) noexcept:
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_12_BaseContext__cleanup_context(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 79, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xpath.pxi":74
 *             self.registerVariables(self._variables)
 * 
 *     cdef unregister_context(self):             # <<<<<<<<<<<<<<
 *         self.unregisterGlobalFunctions(
 *             self._xpathCtxt, _unregister_xpath_function)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._XPathContext.unregister_context", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xpath.pxi":81
 *         self._cleanup_context()
 * 
 *     cdef void registerExsltFunctions(self) noexcept:             # <<<<<<<<<<<<<<
 *         if xslt.LIBXSLT_VERSION < 10125:
 *             # we'd only execute dummy functions anyway
*/

static void __pyx_f_4lxml_5etree_13_XPathContext_registerExsltFunctions(struct __pyx_obj_4lxml_5etree__XPathContext *__pyx_v_self) {
  int __pyx_t_1;

  /* "src/lxml/xpath.pxi":82
 * 
 *     cdef void registerExsltFunctions(self) noexcept:
 *         if xslt.LIBXSLT_VERSION < 10125:             # <<<<<<<<<<<<<<
 *             # we'd only execute dummy functions anyway
 *             return
*/
  __pyx_t_1 = (LIBXSLT_VERSION < 0x278D);
  if (__pyx_t_1) {

    /* "src/lxml/xpath.pxi":84
 *         if xslt.LIBXSLT_VERSION < 10125:
 *             # we'd only execute dummy functions anyway
 *             return             # <<<<<<<<<<<<<<
 *         tree.xmlHashScan(
 *             self._xpathCtxt.nsHash, _registerExsltFunctionsForNamespaces,
*/
    goto __pyx_L0;

    /* "src/lxml/xpath.pxi":82
 * 
 *     cdef void registerExsltFunctions(self) noexcept:
 *         if xslt.LIBXSLT_VERSION < 10125:             # <<<<<<<<<<<<<<
 *             # we'd only execute dummy functions anyway
 *             return
*/
  }

  /* "src/lxml/xpath.pxi":85
 *             # we'd only execute dummy functions anyway
 *             return
 *         tree.xmlHashScan(             # <<<<<<<<<<<<<<
 *             self._xpathCtxt.nsHash, _registerExsltFunctionsForNamespaces,
 *             self._xpathCtxt)
*/
  xmlHashScan(__pyx_v_self->__pyx_base._xpathCtxt->nsHash, __pyx_f_4lxml_5etree__registerExsltFunctionsForNamespaces, __pyx_v_self->__pyx_base._xpathCtxt);

  /* "src/lxml/xpath.pxi":81
 *         self._cleanup_context()
 * 
 *     cdef void registerExsltFunctions(self) noexcept:             # <<<<<<<<<<<<<<
 *         if xslt.LIBXSLT_VERSION < 10125:
 *             # we'd only execute dummy functions anyway
*/

  /* function exit code */
  __pyx_L0:;
}

/* "src/lxml/xpath.pxi":89
 *             self._xpathCtxt)
 * 
 *     cdef registerVariables(self, variable_dict):             # <<<<<<<<<<<<<<
 *         for name, value in variable_dict.items():
 *             name_utf = self._to_utf(name)
*/

static PyObject *__pyx_f_4lxml_5etree_13_XPathContext_registerVariables(struct __pyx_obj_4lxml_5etree__XPathContext *__pyx_v_self, PyObject *__pyx_v_variable_dict) {
  PyObject *__pyx_v_name = NULL;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_v_name_utf = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  xmlXPathObject *__pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("registerVariables", 0);

  /* "src/lxml/xpath.pxi":90
 * 
 *     cdef registerVariables(self, variable_dict):
 *         for name, value in variable_dict.items():             # <<<<<<<<<<<<<<
 *             name_utf = self._to_utf(name)
 *             xpath.xmlXPathRegisterVariable(
*/
  __pyx_t_2 = 0;
  if (unlikely(__pyx_v_variable_dict == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
    __PYX_ERR(19, 90, __pyx_L1_error)
  }
  __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_variable_dict, 0, __pyx_mstate_global->__pyx_n_u_items, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(19, 90, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = __pyx_t_5;
  __pyx_t_5 = 0;
  while (1) {
    __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, &__pyx_t_5, &__pyx_t_6, NULL, __pyx_t_4);
    if (unlikely(__pyx_t_7 == 0)) break;
    if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(19, 90, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "src/lxml/xpath.pxi":91
 *     cdef registerVariables(self, variable_dict):
 *         for name, value in variable_dict.items():
 *             name_utf = self._to_utf(name)             # <<<<<<<<<<<<<<
 *             xpath.xmlXPathRegisterVariable(
 *                 self._xpathCtxt, _xcstr(name_utf), _wrapXPathObject(value, None, None))
*/
    __pyx_t_6 = ((struct __pyx_vtabstruct_4lxml_5etree__XPathContext *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._to_utf(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self), __pyx_v_name); if (unlikely(!__pyx_t_6)) __PYX_ERR(19, 91, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF_SET(__pyx_v_name_utf, ((PyObject*)__pyx_t_6));
    __pyx_t_6 = 0;

    /* "src/lxml/xpath.pxi":93
 *             name_utf = self._to_utf(name)
 *             xpath.xmlXPathRegisterVariable(
 *                 self._xpathCtxt, _xcstr(name_utf), _wrapXPathObject(value, None, None))             # <<<<<<<<<<<<<<
 * 
 *     cdef registerVariable(self, name, value):
*/
    __pyx_t_8 = __pyx_f_4lxml_5etree__wrapXPathObject(__pyx_v_value, ((struct LxmlDocument *)Py_None), ((struct __pyx_obj_4lxml_5etree__BaseContext *)Py_None)); if (unlikely(__pyx_t_8 == ((void *)NULL))) __PYX_ERR(19, 93, __pyx_L1_error)

    /* "src/lxml/xpath.pxi":92
 *         for name, value in variable_dict.items():
 *             name_utf = self._to_utf(name)
 *             xpath.xmlXPathRegisterVariable(             # <<<<<<<<<<<<<<
 *                 self._xpathCtxt, _xcstr(name_utf), _wrapXPathObject(value, None, None))
 * 
*/
    (void)(xmlXPathRegisterVariable(__pyx_v_self->__pyx_base._xpathCtxt, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_name_utf), __pyx_t_8));
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xpath.pxi":89
 *             self._xpathCtxt)
 * 
 *     cdef registerVariables(self, variable_dict):             # <<<<<<<<<<<<<<
 *         for name, value in variable_dict.items():
 *             name_utf = self._to_utf(name)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._XPathContext.registerVariables", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XDECREF(__pyx_v_name_utf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xpath.pxi":95
 *                 self._xpathCtxt, _xcstr(name_utf), _wrapXPathObject(value, None, None))
 * 
 *     cdef registerVariable(self, name, value):             # <<<<<<<<<<<<<<
 *         name_utf = self._to_utf(name)
 *         xpath.xmlXPathRegisterVariable(
*/

static PyObject *__pyx_f_4lxml_5etree_13_XPathContext_registerVariable(struct __pyx_obj_4lxml_5etree__XPathContext *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value) {
  PyObject *__pyx_v_name_utf = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  xmlXPathObject *__pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("registerVariable", 0);

  /* "src/lxml/xpath.pxi":96
 * 
 *     cdef registerVariable(self, name, value):
 *         name_utf = self._to_utf(name)             # <<<<<<<<<<<<<<
 *         xpath.xmlXPathRegisterVariable(
 *             self._xpathCtxt, _xcstr(name_utf), _wrapXPathObject(value, None, None))
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__XPathContext *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._to_utf(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self), __pyx_v_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 96, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_name_utf = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xpath.pxi":98
 *         name_utf = self._to_utf(name)
 *         xpath.xmlXPathRegisterVariable(
 *             self._xpathCtxt, _xcstr(name_utf), _wrapXPathObject(value, None, None))             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_2 = __pyx_f_4lxml_5etree__wrapXPathObject(__pyx_v_value, ((struct LxmlDocument *)Py_None), ((struct __pyx_obj_4lxml_5etree__BaseContext *)Py_None)); if (unlikely(__pyx_t_2 == ((void *)NULL))) __PYX_ERR(19, 98, __pyx_L1_error)

  /* "src/lxml/xpath.pxi":97
 *     cdef registerVariable(self, name, value):
 *         name_utf = self._to_utf(name)
 *         xpath.xmlXPathRegisterVariable(             # <<<<<<<<<<<<<<
 *             self._xpathCtxt, _xcstr(name_utf), _wrapXPathObject(value, None, None))
 * 
*/
  (void)(xmlXPathRegisterVariable(__pyx_v_self->__pyx_base._xpathCtxt, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_name_utf), __pyx_t_2));

  /* "src/lxml/xpath.pxi":95
 *                 self._xpathCtxt, _xcstr(name_utf), _wrapXPathObject(value, None, None))
 * 
 *     cdef registerVariable(self, name, value):             # <<<<<<<<<<<<<<
 *         name_utf = self._to_utf(name)
 *         xpath.xmlXPathRegisterVariable(
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._XPathContext.registerVariable", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name_utf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xpath.pxi":101
 * 
 * 
 * cdef void _registerExsltFunctionsForNamespaces(             # <<<<<<<<<<<<<<
 *         void* _c_href, void* _ctxt, const_xmlChar* c_prefix) noexcept:
 *     c_href = <const_xmlChar*> _c_href
*/

static void __pyx_f_4lxml_5etree__registerExsltFunctionsForNamespaces(void *__pyx_v__c_href, void *__pyx_v__ctxt, const xmlChar *__pyx_v_c_prefix) {
  const xmlChar *__pyx_v_c_href;
  xmlXPathContext *__pyx_v_ctxt;
  int __pyx_t_1;

  /* "src/lxml/xpath.pxi":103
 * cdef void _registerExsltFunctionsForNamespaces(
 *         void* _c_href, void* _ctxt, const_xmlChar* c_prefix) noexcept:
 *     c_href = <const_xmlChar*> _c_href             # <<<<<<<<<<<<<<
 *     ctxt = <xpath.xmlXPathContext*> _ctxt
 * 
*/
  __pyx_v_c_href = ((const xmlChar *)__pyx_v__c_href);

  /* "src/lxml/xpath.pxi":104
 *         void* _c_href, void* _ctxt, const_xmlChar* c_prefix) noexcept:
 *     c_href = <const_xmlChar*> _c_href
 *     ctxt = <xpath.xmlXPathContext*> _ctxt             # <<<<<<<<<<<<<<
 * 
 *     if tree.xmlStrcmp(c_href, xslt.EXSLT_DATE_NAMESPACE) == 0:
*/
  __pyx_v_ctxt = ((xmlXPathContext *)__pyx_v__ctxt);

  /* "src/lxml/xpath.pxi":106
 *     ctxt = <xpath.xmlXPathContext*> _ctxt
 * 
 *     if tree.xmlStrcmp(c_href, xslt.EXSLT_DATE_NAMESPACE) == 0:             # <<<<<<<<<<<<<<
 *         xslt.exsltDateXpathCtxtRegister(ctxt, c_prefix)
 *     elif tree.xmlStrcmp(c_href, xslt.EXSLT_SETS_NAMESPACE) == 0:
*/
  __pyx_t_1 = (xmlStrcmp(__pyx_v_c_href, EXSLT_DATE_NAMESPACE) == 0);
  if (__pyx_t_1) {

    /* "src/lxml/xpath.pxi":107
 * 
 *     if tree.xmlStrcmp(c_href, xslt.EXSLT_DATE_NAMESPACE) == 0:
 *         xslt.exsltDateXpathCtxtRegister(ctxt, c_prefix)             # <<<<<<<<<<<<<<
 *     elif tree.xmlStrcmp(c_href, xslt.EXSLT_SETS_NAMESPACE) == 0:
 *         xslt.exsltSetsXpathCtxtRegister(ctxt, c_prefix)
*/
    (void)(exsltDateXpathCtxtRegister(__pyx_v_ctxt, __pyx_v_c_prefix));

    /* "src/lxml/xpath.pxi":106
 *     ctxt = <xpath.xmlXPathContext*> _ctxt
 * 
 *     if tree.xmlStrcmp(c_href, xslt.EXSLT_DATE_NAMESPACE) == 0:             # <<<<<<<<<<<<<<
 *         xslt.exsltDateXpathCtxtRegister(ctxt, c_prefix)
 *     elif tree.xmlStrcmp(c_href, xslt.EXSLT_SETS_NAMESPACE) == 0:
*/
    goto __pyx_L3;
  }

  /* "src/lxml/xpath.pxi":108
 *     if tree.xmlStrcmp(c_href, xslt.EXSLT_DATE_NAMESPACE) == 0:
 *         xslt.exsltDateXpathCtxtRegister(ctxt, c_prefix)
 *     elif tree.xmlStrcmp(c_href, xslt.EXSLT_SETS_NAMESPACE) == 0:             # <<<<<<<<<<<<<<
 *         xslt.exsltSetsXpathCtxtRegister(ctxt, c_prefix)
 *     elif tree.xmlStrcmp(c_href, xslt.EXSLT_MATH_NAMESPACE) == 0:
*/
  __pyx_t_1 = (xmlStrcmp(__pyx_v_c_href, EXSLT_SETS_NAMESPACE) == 0);
  if (__pyx_t_1) {

    /* "src/lxml/xpath.pxi":109
 *         xslt.exsltDateXpathCtxtRegister(ctxt, c_prefix)
 *     elif tree.xmlStrcmp(c_href, xslt.EXSLT_SETS_NAMESPACE) == 0:
 *         xslt.exsltSetsXpathCtxtRegister(ctxt, c_prefix)             # <<<<<<<<<<<<<<
 *     elif tree.xmlStrcmp(c_href, xslt.EXSLT_MATH_NAMESPACE) == 0:
 *         xslt.exsltMathXpathCtxtRegister(ctxt, c_prefix)
*/
    (void)(exsltSetsXpathCtxtRegister(__pyx_v_ctxt, __pyx_v_c_prefix));

    /* "src/lxml/xpath.pxi":108
 *     if tree.xmlStrcmp(c_href, xslt.EXSLT_DATE_NAMESPACE) == 0:
 *         xslt.exsltDateXpathCtxtRegister(ctxt, c_prefix)
 *     elif tree.xmlStrcmp(c_href, xslt.EXSLT_SETS_NAMESPACE) == 0:             # <<<<<<<<<<<<<<
 *         xslt.exsltSetsXpathCtxtRegister(ctxt, c_prefix)
 *     elif tree.xmlStrcmp(c_href, xslt.EXSLT_MATH_NAMESPACE) == 0:
*/
    goto __pyx_L3;
  }

  /* "src/lxml/xpath.pxi":110
 *     elif tree.xmlStrcmp(c_href, xslt.EXSLT_SETS_NAMESPACE) == 0:
 *         xslt.exsltSetsXpathCtxtRegister(ctxt, c_prefix)
 *     elif tree.xmlStrcmp(c_href, xslt.EXSLT_MATH_NAMESPACE) == 0:             # <<<<<<<<<<<<<<
 *         xslt.exsltMathXpathCtxtRegister(ctxt, c_prefix)
 *     elif tree.xmlStrcmp(c_href, xslt.EXSLT_STRINGS_NAMESPACE) == 0:
*/
  __pyx_t_1 = (xmlStrcmp(__pyx_v_c_href, EXSLT_MATH_NAMESPACE) == 0);
  if (__pyx_t_1) {

    /* "src/lxml/xpath.pxi":111
 *         xslt.exsltSetsXpathCtxtRegister(ctxt, c_prefix)
 *     elif tree.xmlStrcmp(c_href, xslt.EXSLT_MATH_NAMESPACE) == 0:
 *         xslt.exsltMathXpathCtxtRegister(ctxt, c_prefix)             # <<<<<<<<<<<<<<
 *     elif tree.xmlStrcmp(c_href, xslt.EXSLT_STRINGS_NAMESPACE) == 0:
 *         xslt.exsltStrXpathCtxtRegister(ctxt, c_prefix)
*/
    (void)(exsltMathXpathCtxtRegister(__pyx_v_ctxt, __pyx_v_c_prefix));

    /* "src/lxml/xpath.pxi":110
 *     elif tree.xmlStrcmp(c_href, xslt.EXSLT_SETS_NAMESPACE) == 0:
 *         xslt.exsltSetsXpathCtxtRegister(ctxt, c_prefix)
 *     elif tree.xmlStrcmp(c_href, xslt.EXSLT_MATH_NAMESPACE) == 0:             # <<<<<<<<<<<<<<
 *         xslt.exsltMathXpathCtxtRegister(ctxt, c_prefix)
 *     elif tree.xmlStrcmp(c_href, xslt.EXSLT_STRINGS_NAMESPACE) == 0:
*/
    goto __pyx_L3;
  }

  /* "src/lxml/xpath.pxi":112
 *     elif tree.xmlStrcmp(c_href, xslt.EXSLT_MATH_NAMESPACE) == 0:
 *         xslt.exsltMathXpathCtxtRegister(ctxt, c_prefix)
 *     elif tree.xmlStrcmp(c_href, xslt.EXSLT_STRINGS_NAMESPACE) == 0:             # <<<<<<<<<<<<<<
 *         xslt.exsltStrXpathCtxtRegister(ctxt, c_prefix)
 * 
*/
  __pyx_t_1 = (xmlStrcmp(__pyx_v_c_href, EXSLT_STRINGS_NAMESPACE) == 0);
  if (__pyx_t_1) {

    /* "src/lxml/xpath.pxi":113
 *         xslt.exsltMathXpathCtxtRegister(ctxt, c_prefix)
 *     elif tree.xmlStrcmp(c_href, xslt.EXSLT_STRINGS_NAMESPACE) == 0:
 *         xslt.exsltStrXpathCtxtRegister(ctxt, c_prefix)             # <<<<<<<<<<<<<<
 * 
 * 
*/
    (void)(exsltStrXpathCtxtRegister(__pyx_v_ctxt, __pyx_v_c_prefix));

    /* "src/lxml/xpath.pxi":112
 *     elif tree.xmlStrcmp(c_href, xslt.EXSLT_MATH_NAMESPACE) == 0:
 *         xslt.exsltMathXpathCtxtRegister(ctxt, c_prefix)
 *     elif tree.xmlStrcmp(c_href, xslt.EXSLT_STRINGS_NAMESPACE) == 0:             # <<<<<<<<<<<<<<
 *         xslt.exsltStrXpathCtxtRegister(ctxt, c_prefix)
 * 
*/
  }
  __pyx_L3:;

  /* "src/lxml/xpath.pxi":101
 * 
 * 
 * cdef void _registerExsltFunctionsForNamespaces(             # <<<<<<<<<<<<<<
 *         void* _c_href, void* _ctxt, const_xmlChar* c_prefix) noexcept:
 *     c_href = <const_xmlChar*> _c_href
*/

  /* function exit code */
}

/* "src/lxml/xpath.pxi":121
 *     cdef python.PyThread_type_lock _eval_lock
 *     cdef _ErrorLog _error_log
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._xpathCtxt = NULL
 *         if config.ENABLE_THREADING:
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_19_XPathEvaluatorBase_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_19_XPathEvaluatorBase_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, __pyx_nargs); return -1; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return -1;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__cinit__", __pyx_kwds); return -1;}
  __pyx_r = __pyx_pf_4lxml_5etree_19_XPathEvaluatorBase___cinit__(((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_19_XPathEvaluatorBase___cinit__(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "src/lxml/xpath.pxi":122
 *     cdef _ErrorLog _error_log
 *     def __cinit__(self):
 *         self._xpathCtxt = NULL             # <<<<<<<<<<<<<<
 *         if config.ENABLE_THREADING:
 *             self._eval_lock = python.PyThread_allocate_lock()
*/
  __pyx_v_self->_xpathCtxt = NULL;

  /* "src/lxml/xpath.pxi":123
 *     def __cinit__(self):
 *         self._xpathCtxt = NULL
 *         if config.ENABLE_THREADING:             # <<<<<<<<<<<<<<
 *             self._eval_lock = python.PyThread_allocate_lock()
 *             if self._eval_lock is NULL:
*/
  if (ENABLE_THREADING) {

    /* "src/lxml/xpath.pxi":124
 *         self._xpathCtxt = NULL
 *         if config.ENABLE_THREADING:
 *             self._eval_lock = python.PyThread_allocate_lock()             # <<<<<<<<<<<<<<
 *             if self._eval_lock is NULL:
 *                 raise MemoryError()
*/
    __pyx_v_self->_eval_lock = PyThread_allocate_lock();

    /* "src/lxml/xpath.pxi":125
 *         if config.ENABLE_THREADING:
 *             self._eval_lock = python.PyThread_allocate_lock()
 *             if self._eval_lock is NULL:             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 *         self._error_log = _ErrorLog()
*/
    __pyx_t_1 = (__pyx_v_self->_eval_lock == NULL);
    if (unlikely(__pyx_t_1)) {

      /* "src/lxml/xpath.pxi":126
 *             self._eval_lock = python.PyThread_allocate_lock()
 *             if self._eval_lock is NULL:
 *                 raise MemoryError()             # <<<<<<<<<<<<<<
 *         self._error_log = _ErrorLog()
 * 
*/
      PyErr_NoMemory(); __PYX_ERR(19, 126, __pyx_L1_error)

      /* "src/lxml/xpath.pxi":125
 *         if config.ENABLE_THREADING:
 *             self._eval_lock = python.PyThread_allocate_lock()
 *             if self._eval_lock is NULL:             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 *         self._error_log = _ErrorLog()
*/
    }

    /* "src/lxml/xpath.pxi":123
 *     def __cinit__(self):
 *         self._xpathCtxt = NULL
 *         if config.ENABLE_THREADING:             # <<<<<<<<<<<<<<
 *             self._eval_lock = python.PyThread_allocate_lock()
 *             if self._eval_lock is NULL:
*/
  }

  /* "src/lxml/xpath.pxi":127
 *             if self._eval_lock is NULL:
 *                 raise MemoryError()
 *         self._error_log = _ErrorLog()             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, namespaces, extensions, enable_regexp,
*/
  __pyx_t_3 = NULL;
  __pyx_t_4 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ErrorLog, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(19, 127, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_2);
  }
  __Pyx_GIVEREF((PyObject *)__pyx_t_2);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_error_log);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_error_log);
  __pyx_v_self->_error_log = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/xpath.pxi":121
 *     cdef python.PyThread_type_lock _eval_lock
 *     cdef _ErrorLog _error_log
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._xpathCtxt = NULL
 *         if config.ENABLE_THREADING:
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._XPathEvaluatorBase.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xpath.pxi":129
 *         self._error_log = _ErrorLog()
 * 
 *     def __init__(self, namespaces, extensions, enable_regexp,             # <<<<<<<<<<<<<<
 *                  smart_strings):
 *         self._context = _XPathContext(namespaces, extensions, self._error_log,
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_19_XPathEvaluatorBase_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_19_XPathEvaluatorBase_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_namespaces = 0;
  PyObject *__pyx_v_extensions = 0;
  PyObject *__pyx_v_enable_regexp = 0;
  PyObject *__pyx_v_smart_strings = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[4] = {0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_namespaces,&__pyx_mstate_global->__pyx_n_u_extensions,&__pyx_mstate_global->__pyx_n_u_enable_regexp,&__pyx_mstate_global->__pyx_n_u_smart_strings,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(19, 129, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  4:
        values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(19, 129, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(19, 129, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(19, 129, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(19, 129, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(19, 129, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 4; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, i); __PYX_ERR(19, 129, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 4)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(19, 129, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(19, 129, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(19, 129, __pyx_L3_error)
      values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(19, 129, __pyx_L3_error)
    }
    __pyx_v_namespaces = values[0];
    __pyx_v_extensions = values[1];
    __pyx_v_enable_regexp = values[2];
    __pyx_v_smart_strings = values[3];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, __pyx_nargs); __PYX_ERR(19, 129, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._XPathEvaluatorBase.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_19_XPathEvaluatorBase_2__init__(((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self), __pyx_v_namespaces, __pyx_v_extensions, __pyx_v_enable_regexp, __pyx_v_smart_strings);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_19_XPathEvaluatorBase_2__init__(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *__pyx_v_self, PyObject *__pyx_v_namespaces, PyObject *__pyx_v_extensions, PyObject *__pyx_v_enable_regexp, PyObject *__pyx_v_smart_strings) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "src/lxml/xpath.pxi":131
 *     def __init__(self, namespaces, extensions, enable_regexp,
 *                  smart_strings):
 *         self._context = _XPathContext(namespaces, extensions, self._error_log,             # <<<<<<<<<<<<<<
 *                                       enable_regexp, None, smart_strings)
 * 
*/
  __pyx_t_2 = NULL;

  /* "src/lxml/xpath.pxi":132
 *                  smart_strings):
 *         self._context = _XPathContext(namespaces, extensions, self._error_log,
 *                                       enable_regexp, None, smart_strings)             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __pyx_t_3 = 1;
  {
    PyObject *__pyx_callargs[7] = {__pyx_t_2, __pyx_v_namespaces, __pyx_v_extensions, ((PyObject *)__pyx_v_self->_error_log), __pyx_v_enable_regexp, Py_None, __pyx_v_smart_strings};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__XPathContext, __pyx_callargs+__pyx_t_3, (7-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 131, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }

  /* "src/lxml/xpath.pxi":131
 *     def __init__(self, namespaces, extensions, enable_regexp,
 *                  smart_strings):
 *         self._context = _XPathContext(namespaces, extensions, self._error_log,             # <<<<<<<<<<<<<<
 *                                       enable_regexp, None, smart_strings)
 * 
*/
  __Pyx_GIVEREF((PyObject *)__pyx_t_1);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_context);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_context);
  __pyx_v_self->_context = ((struct __pyx_obj_4lxml_5etree__XPathContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xpath.pxi":129
 *         self._error_log = _ErrorLog()
 * 
 *     def __init__(self, namespaces, extensions, enable_regexp,             # <<<<<<<<<<<<<<
 *                  smart_strings):
 *         self._context = _XPathContext(namespaces, extensions, self._error_log,
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._XPathEvaluatorBase.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xpath.pxi":134
 *                                       enable_regexp, None, smart_strings)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def error_log(self):
 *         assert self._error_log is not None, "XPath evaluator not initialised"
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_19_XPathEvaluatorBase_9error_log_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_19_XPathEvaluatorBase_9error_log_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_19_XPathEvaluatorBase_9error_log___get__(((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_19_XPathEvaluatorBase_9error_log___get__(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "src/lxml/xpath.pxi":136
 *     @property
 *     def error_log(self):
 *         assert self._error_log is not None, "XPath evaluator not initialised"             # <<<<<<<<<<<<<<
 *         return self._error_log.copy()
 * 
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = (((PyObject *)__pyx_v_self->_error_log) != Py_None);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_mstate_global->__pyx_kp_u_XPath_evaluator_not_initialised, 0, 0);
      __PYX_ERR(19, 136, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(19, 136, __pyx_L1_error)
  #endif

  /* "src/lxml/xpath.pxi":137
 *     def error_log(self):
 *         assert self._error_log is not None, "XPath evaluator not initialised"
 *         return self._error_log.copy()             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)__pyx_v_self->_error_log->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.copy(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self->_error_log), 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(19, 137, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/xpath.pxi":134
 *                                       enable_regexp, None, smart_strings)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def error_log(self):
 *         assert self._error_log is not None, "XPath evaluator not initialised"
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._XPathEvaluatorBase.error_log.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xpath.pxi":139
 *         return self._error_log.copy()
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._xpathCtxt is not NULL:
 *             xpath.xmlXPathFreeContext(self._xpathCtxt)
*/

/* Python wrapper */
static void __pyx_pw_4lxml_5etree_19_XPathEvaluatorBase_5__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_4lxml_5etree_19_XPathEvaluatorBase_5__dealloc__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_pf_4lxml_5etree_19_XPathEvaluatorBase_4__dealloc__(((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_4lxml_5etree_19_XPathEvaluatorBase_4__dealloc__(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *__pyx_v_self) {
  int __pyx_t_1;

  /* "src/lxml/xpath.pxi":140
 * 
 *     def __dealloc__(self):
 *         if self._xpathCtxt is not NULL:             # <<<<<<<<<<<<<<
 *             xpath.xmlXPathFreeContext(self._xpathCtxt)
 *         if config.ENABLE_THREADING:
*/
  __pyx_t_1 = (__pyx_v_self->_xpathCtxt != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/xpath.pxi":141
 *     def __dealloc__(self):
 *         if self._xpathCtxt is not NULL:
 *             xpath.xmlXPathFreeContext(self._xpathCtxt)             # <<<<<<<<<<<<<<
 *         if config.ENABLE_THREADING:
 *             if self._eval_lock is not NULL:
*/
    xmlXPathFreeContext(__pyx_v_self->_xpathCtxt);

    /* "src/lxml/xpath.pxi":140
 * 
 *     def __dealloc__(self):
 *         if self._xpathCtxt is not NULL:             # <<<<<<<<<<<<<<
 *             xpath.xmlXPathFreeContext(self._xpathCtxt)
 *         if config.ENABLE_THREADING:
*/
  }

  /* "src/lxml/xpath.pxi":142
 *         if self._xpathCtxt is not NULL:
 *             xpath.xmlXPathFreeContext(self._xpathCtxt)
 *         if config.ENABLE_THREADING:             # <<<<<<<<<<<<<<
 *             if self._eval_lock is not NULL:
 *                 python.PyThread_free_lock(self._eval_lock)
*/
  if (ENABLE_THREADING) {

    /* "src/lxml/xpath.pxi":143
 *             xpath.xmlXPathFreeContext(self._xpathCtxt)
 *         if config.ENABLE_THREADING:
 *             if self._eval_lock is not NULL:             # <<<<<<<<<<<<<<
 *                 python.PyThread_free_lock(self._eval_lock)
 * 
*/
    __pyx_t_1 = (__pyx_v_self->_eval_lock != NULL);
    if (__pyx_t_1) {

      /* "src/lxml/xpath.pxi":144
 *         if config.ENABLE_THREADING:
 *             if self._eval_lock is not NULL:
 *                 python.PyThread_free_lock(self._eval_lock)             # <<<<<<<<<<<<<<
 * 
 *     cdef set_context(self, xpath.xmlXPathContext* xpathCtxt):
*/
      PyThread_free_lock(__pyx_v_self->_eval_lock);

      /* "src/lxml/xpath.pxi":143
 *             xpath.xmlXPathFreeContext(self._xpathCtxt)
 *         if config.ENABLE_THREADING:
 *             if self._eval_lock is not NULL:             # <<<<<<<<<<<<<<
 *                 python.PyThread_free_lock(self._eval_lock)
 * 
*/
    }

    /* "src/lxml/xpath.pxi":142
 *         if self._xpathCtxt is not NULL:
 *             xpath.xmlXPathFreeContext(self._xpathCtxt)
 *         if config.ENABLE_THREADING:             # <<<<<<<<<<<<<<
 *             if self._eval_lock is not NULL:
 *                 python.PyThread_free_lock(self._eval_lock)
*/
  }

  /* "src/lxml/xpath.pxi":139
 *         return self._error_log.copy()
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._xpathCtxt is not NULL:
 *             xpath.xmlXPathFreeContext(self._xpathCtxt)
*/

  /* function exit code */
}

/* "src/lxml/xpath.pxi":146
 *                 python.PyThread_free_lock(self._eval_lock)
 * 
 *     cdef set_context(self, xpath.xmlXPathContext* xpathCtxt):             # <<<<<<<<<<<<<<
 *         self._xpathCtxt = xpathCtxt
 *         self._context.set_context(xpathCtxt)
*/

static PyObject *__pyx_f_4lxml_5etree_19_XPathEvaluatorBase_set_context(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *__pyx_v_self, xmlXPathContext *__pyx_v_xpathCtxt) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_context", 0);

  /* "src/lxml/xpath.pxi":147
 * 
 *     cdef set_context(self, xpath.xmlXPathContext* xpathCtxt):
 *         self._xpathCtxt = xpathCtxt             # <<<<<<<<<<<<<<
 *         self._context.set_context(xpathCtxt)
 * 
*/
  __pyx_v_self->_xpathCtxt = __pyx_v_xpathCtxt;

  /* "src/lxml/xpath.pxi":148
 *     cdef set_context(self, xpath.xmlXPathContext* xpathCtxt):
 *         self._xpathCtxt = xpathCtxt
 *         self._context.set_context(xpathCtxt)             # <<<<<<<<<<<<<<
 * 
 *     cdef bint _checkAbsolutePath(self, char* path) noexcept:
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_13_XPathContext_set_context(__pyx_v_self->_context, __pyx_v_xpathCtxt); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 148, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xpath.pxi":146
 *                 python.PyThread_free_lock(self._eval_lock)
 * 
 *     cdef set_context(self, xpath.xmlXPathContext* xpathCtxt):             # <<<<<<<<<<<<<<
 *         self._xpathCtxt = xpathCtxt
 *         self._context.set_context(xpathCtxt)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._XPathEvaluatorBase.set_context", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xpath.pxi":150
 *         self._context.set_context(xpathCtxt)
 * 
 *     cdef bint _checkAbsolutePath(self, char* path) noexcept:             # <<<<<<<<<<<<<<
 *         cdef char c
 *         if path is NULL:
*/

static int __pyx_f_4lxml_5etree_19_XPathEvaluatorBase__checkAbsolutePath(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *__pyx_v_self, char *__pyx_v_path) {
  char __pyx_v_c;
  int __pyx_r;
  int __pyx_t_1;

  /* "src/lxml/xpath.pxi":152
 *     cdef bint _checkAbsolutePath(self, char* path) noexcept:
 *         cdef char c
 *         if path is NULL:             # <<<<<<<<<<<<<<
 *             return 0
 *         c = path[0]
*/
  __pyx_t_1 = (__pyx_v_path == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/xpath.pxi":153
 *         cdef char c
 *         if path is NULL:
 *             return 0             # <<<<<<<<<<<<<<
 *         c = path[0]
 *         while c == c' ' or c == c'\t':
*/
    __pyx_r = 0;
    goto __pyx_L0;

    /* "src/lxml/xpath.pxi":152
 *     cdef bint _checkAbsolutePath(self, char* path) noexcept:
 *         cdef char c
 *         if path is NULL:             # <<<<<<<<<<<<<<
 *             return 0
 *         c = path[0]
*/
  }

  /* "src/lxml/xpath.pxi":154
 *         if path is NULL:
 *             return 0
 *         c = path[0]             # <<<<<<<<<<<<<<
 *         while c == c' ' or c == c'\t':
 *             path = path + 1
*/
  __pyx_v_c = (__pyx_v_path[0]);

  /* "src/lxml/xpath.pxi":155
 *             return 0
 *         c = path[0]
 *         while c == c' ' or c == c'\t':             # <<<<<<<<<<<<<<
 *             path = path + 1
 *             c = path[0]
*/
  while (1) {
    switch (__pyx_v_c) {
      case ' ':
      case '\t':
      __pyx_t_1 = 1;
      break;
      default:
      __pyx_t_1 = 0;
      break;
    }
    if (!__pyx_t_1) break;

    /* "src/lxml/xpath.pxi":156
 *         c = path[0]
 *         while c == c' ' or c == c'\t':
 *             path = path + 1             # <<<<<<<<<<<<<<
 *             c = path[0]
 *         return c == c'/'
*/
    __pyx_v_path = (__pyx_v_path + 1);

    /* "src/lxml/xpath.pxi":157
 *         while c == c' ' or c == c'\t':
 *             path = path + 1
 *             c = path[0]             # <<<<<<<<<<<<<<
 *         return c == c'/'
 * 
*/
    __pyx_v_c = (__pyx_v_path[0]);
  }

  /* "src/lxml/xpath.pxi":158
 *             path = path + 1
 *             c = path[0]
 *         return c == c'/'             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
*/
  __pyx_r = (__pyx_v_c == '/');
  goto __pyx_L0;

  /* "src/lxml/xpath.pxi":150
 *         self._context.set_context(xpathCtxt)
 * 
 *     cdef bint _checkAbsolutePath(self, char* path) noexcept:             # <<<<<<<<<<<<<<
 *         cdef char c
 *         if path is NULL:
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/xpath.pxi":160
 *         return c == c'/'
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef int _lock(self) except -1:
 *         cdef int result
*/

static int __pyx_f_4lxml_5etree_19_XPathEvaluatorBase__lock(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *__pyx_v_self) {
  int __pyx_v_result;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/xpath.pxi":163
 *     cdef int _lock(self) except -1:
 *         cdef int result
 *         if config.ENABLE_THREADING and self._eval_lock != NULL:             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 result = python.PyThread_acquire_lock(
*/
  if (ENABLE_THREADING) {
  } else {
    __pyx_t_1 = ENABLE_THREADING;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_self->_eval_lock != NULL);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/xpath.pxi":164
 *         cdef int result
 *         if config.ENABLE_THREADING and self._eval_lock != NULL:
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 result = python.PyThread_acquire_lock(
 *                     self._eval_lock, python.WAIT_LOCK)
*/
    {
        PyThreadState * _save;
        _save = PyEval_SaveThread();
        __Pyx_FastGIL_Remember();
        /*try:*/ {

          /* "src/lxml/xpath.pxi":165
 *         if config.ENABLE_THREADING and self._eval_lock != NULL:
 *             with nogil:
 *                 result = python.PyThread_acquire_lock(             # <<<<<<<<<<<<<<
 *                     self._eval_lock, python.WAIT_LOCK)
 *             if result == 0:
*/
          __pyx_v_result = PyThread_acquire_lock(__pyx_v_self->_eval_lock, WAIT_LOCK);
        }

        /* "src/lxml/xpath.pxi":164
 *         cdef int result
 *         if config.ENABLE_THREADING and self._eval_lock != NULL:
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 result = python.PyThread_acquire_lock(
 *                     self._eval_lock, python.WAIT_LOCK)
*/
        /*finally:*/ {
          /*normal exit:*/{
            __Pyx_FastGIL_Forget();
            PyEval_RestoreThread(_save);
            goto __pyx_L8;
          }
          __pyx_L8:;
        }
    }

    /* "src/lxml/xpath.pxi":167
 *                 result = python.PyThread_acquire_lock(
 *                     self._eval_lock, python.WAIT_LOCK)
 *             if result == 0:             # <<<<<<<<<<<<<<
 *                 raise XPathError, "XPath evaluator locking failed"
 *         return 0
*/
    __pyx_t_1 = (__pyx_v_result == 0);
    if (unlikely(__pyx_t_1)) {

      /* "src/lxml/xpath.pxi":168
 *                     self._eval_lock, python.WAIT_LOCK)
 *             if result == 0:
 *                 raise XPathError, "XPath evaluator locking failed"             # <<<<<<<<<<<<<<
 *         return 0
 * 
*/
      __Pyx_Raise(((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XPathError), __pyx_mstate_global->__pyx_kp_u_XPath_evaluator_locking_failed, 0, 0);
      __PYX_ERR(19, 168, __pyx_L1_error)

      /* "src/lxml/xpath.pxi":167
 *                 result = python.PyThread_acquire_lock(
 *                     self._eval_lock, python.WAIT_LOCK)
 *             if result == 0:             # <<<<<<<<<<<<<<
 *                 raise XPathError, "XPath evaluator locking failed"
 *         return 0
*/
    }

    /* "src/lxml/xpath.pxi":163
 *     cdef int _lock(self) except -1:
 *         cdef int result
 *         if config.ENABLE_THREADING and self._eval_lock != NULL:             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 result = python.PyThread_acquire_lock(
*/
  }

  /* "src/lxml/xpath.pxi":169
 *             if result == 0:
 *                 raise XPathError, "XPath evaluator locking failed"
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/xpath.pxi":160
 *         return c == c'/'
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef int _lock(self) except -1:
 *         cdef int result
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._XPathEvaluatorBase._lock", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/xpath.pxi":171
 *         return 0
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef void _unlock(self) noexcept:
 *         if config.ENABLE_THREADING and self._eval_lock != NULL:
*/

static void __pyx_f_4lxml_5etree_19_XPathEvaluatorBase__unlock(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *__pyx_v_self) {
  int __pyx_t_1;
  int __pyx_t_2;

  /* "src/lxml/xpath.pxi":173
 *     @cython.final
 *     cdef void _unlock(self) noexcept:
 *         if config.ENABLE_THREADING and self._eval_lock != NULL:             # <<<<<<<<<<<<<<
 *             python.PyThread_release_lock(self._eval_lock)
 * 
*/
  if (ENABLE_THREADING) {
  } else {
    __pyx_t_1 = ENABLE_THREADING;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_self->_eval_lock != NULL);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/xpath.pxi":174
 *     cdef void _unlock(self) noexcept:
 *         if config.ENABLE_THREADING and self._eval_lock != NULL:
 *             python.PyThread_release_lock(self._eval_lock)             # <<<<<<<<<<<<<<
 * 
 *     cdef _build_parse_error(self):
*/
    PyThread_release_lock(__pyx_v_self->_eval_lock);

    /* "src/lxml/xpath.pxi":173
 *     @cython.final
 *     cdef void _unlock(self) noexcept:
 *         if config.ENABLE_THREADING and self._eval_lock != NULL:             # <<<<<<<<<<<<<<
 *             python.PyThread_release_lock(self._eval_lock)
 * 
*/
  }

  /* "src/lxml/xpath.pxi":171
 *         return 0
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef void _unlock(self) noexcept:
 *         if config.ENABLE_THREADING and self._eval_lock != NULL:
*/

  /* function exit code */
}

/* "src/lxml/xpath.pxi":176
 *             python.PyThread_release_lock(self._eval_lock)
 * 
 *     cdef _build_parse_error(self):             # <<<<<<<<<<<<<<
 *         cdef _BaseErrorLog entries
 *         entries = self._error_log.filter_types(_XPATH_SYNTAX_ERRORS)
*/

static PyObject *__pyx_f_4lxml_5etree_19_XPathEvaluatorBase__build_parse_error(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_entries = 0;
  PyObject *__pyx_v_message = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_build_parse_error", 0);

  /* "src/lxml/xpath.pxi":178
 *     cdef _build_parse_error(self):
 *         cdef _BaseErrorLog entries
 *         entries = self._error_log.filter_types(_XPATH_SYNTAX_ERRORS)             # <<<<<<<<<<<<<<
 *         if entries:
 *             message = entries._buildExceptionMessage(None)
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self->_error_log);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_4lxml_5etree__XPATH_SYNTAX_ERRORS};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_filter_types, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 178, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__BaseErrorLog))))) __PYX_ERR(19, 178, __pyx_L1_error)
  __pyx_v_entries = ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xpath.pxi":179
 *         cdef _BaseErrorLog entries
 *         entries = self._error_log.filter_types(_XPATH_SYNTAX_ERRORS)
 *         if entries:             # <<<<<<<<<<<<<<
 *             message = entries._buildExceptionMessage(None)
 *             if message is not None:
*/
  __pyx_t_4 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_entries)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(19, 179, __pyx_L1_error)
  if (__pyx_t_4) {

    /* "src/lxml/xpath.pxi":180
 *         entries = self._error_log.filter_types(_XPATH_SYNTAX_ERRORS)
 *         if entries:
 *             message = entries._buildExceptionMessage(None)             # <<<<<<<<<<<<<<
 *             if message is not None:
 *                 return XPathSyntaxError(message, self._error_log)
*/
    __pyx_t_1 = __pyx_f_4lxml_5etree_13_BaseErrorLog__buildExceptionMessage(__pyx_v_entries, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 180, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_message = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "src/lxml/xpath.pxi":181
 *         if entries:
 *             message = entries._buildExceptionMessage(None)
 *             if message is not None:             # <<<<<<<<<<<<<<
 *                 return XPathSyntaxError(message, self._error_log)
 *         return XPathSyntaxError(
*/
    __pyx_t_4 = (__pyx_v_message != Py_None);
    if (__pyx_t_4) {

      /* "src/lxml/xpath.pxi":182
 *             message = entries._buildExceptionMessage(None)
 *             if message is not None:
 *                 return XPathSyntaxError(message, self._error_log)             # <<<<<<<<<<<<<<
 *         return XPathSyntaxError(
 *             self._error_log._buildExceptionMessage("Error in xpath expression"),
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_XPathSyntaxError); if (unlikely(!__pyx_t_5)) __PYX_ERR(19, 182, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
        assert(__pyx_t_2);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
        __pyx_t_3 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_v_message, ((PyObject *)__pyx_v_self->_error_log)};
        __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_3, (3-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 182, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* "src/lxml/xpath.pxi":181
 *         if entries:
 *             message = entries._buildExceptionMessage(None)
 *             if message is not None:             # <<<<<<<<<<<<<<
 *                 return XPathSyntaxError(message, self._error_log)
 *         return XPathSyntaxError(
*/
    }

    /* "src/lxml/xpath.pxi":179
 *         cdef _BaseErrorLog entries
 *         entries = self._error_log.filter_types(_XPATH_SYNTAX_ERRORS)
 *         if entries:             # <<<<<<<<<<<<<<
 *             message = entries._buildExceptionMessage(None)
 *             if message is not None:
*/
  }

  /* "src/lxml/xpath.pxi":183
 *             if message is not None:
 *                 return XPathSyntaxError(message, self._error_log)
 *         return XPathSyntaxError(             # <<<<<<<<<<<<<<
 *             self._error_log._buildExceptionMessage("Error in xpath expression"),
 *             self._error_log)
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_XPathSyntaxError); if (unlikely(!__pyx_t_2)) __PYX_ERR(19, 183, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "src/lxml/xpath.pxi":184
 *                 return XPathSyntaxError(message, self._error_log)
 *         return XPathSyntaxError(
 *             self._error_log._buildExceptionMessage("Error in xpath expression"),             # <<<<<<<<<<<<<<
 *             self._error_log)
 * 
*/
  __pyx_t_6 = __pyx_f_4lxml_5etree_13_BaseErrorLog__buildExceptionMessage(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self->_error_log), __pyx_mstate_global->__pyx_kp_u_Error_in_xpath_expression); if (unlikely(!__pyx_t_6)) __PYX_ERR(19, 184, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);

  /* "src/lxml/xpath.pxi":185
 *         return XPathSyntaxError(
 *             self._error_log._buildExceptionMessage("Error in xpath expression"),
 *             self._error_log)             # <<<<<<<<<<<<<<
 * 
 *     cdef _build_eval_error(self):
*/
  __pyx_t_3 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    assert(__pyx_t_5);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
    __pyx_t_3 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_t_6, ((PyObject *)__pyx_v_self->_error_log)};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_3, (3-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 183, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/xpath.pxi":176
 *             python.PyThread_release_lock(self._eval_lock)
 * 
 *     cdef _build_parse_error(self):             # <<<<<<<<<<<<<<
 *         cdef _BaseErrorLog entries
 *         entries = self._error_log.filter_types(_XPATH_SYNTAX_ERRORS)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._XPathEvaluatorBase._build_parse_error", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_entries);
  __Pyx_XDECREF(__pyx_v_message);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xpath.pxi":187
 *             self._error_log)
 * 
 *     cdef _build_eval_error(self):             # <<<<<<<<<<<<<<
 *         cdef _BaseErrorLog entries
 *         entries = self._error_log.filter_types(_XPATH_EVAL_ERRORS)
*/

static PyObject *__pyx_f_4lxml_5etree_19_XPathEvaluatorBase__build_eval_error(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_entries = 0;
  PyObject *__pyx_v_message = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_build_eval_error", 0);

  /* "src/lxml/xpath.pxi":189
 *     cdef _build_eval_error(self):
 *         cdef _BaseErrorLog entries
 *         entries = self._error_log.filter_types(_XPATH_EVAL_ERRORS)             # <<<<<<<<<<<<<<
 *         if not entries:
 *             entries = self._error_log.filter_types(_XPATH_SYNTAX_ERRORS)
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self->_error_log);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_4lxml_5etree__XPATH_EVAL_ERRORS};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_filter_types, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 189, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__BaseErrorLog))))) __PYX_ERR(19, 189, __pyx_L1_error)
  __pyx_v_entries = ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xpath.pxi":190
 *         cdef _BaseErrorLog entries
 *         entries = self._error_log.filter_types(_XPATH_EVAL_ERRORS)
 *         if not entries:             # <<<<<<<<<<<<<<
 *             entries = self._error_log.filter_types(_XPATH_SYNTAX_ERRORS)
 *         if entries:
*/
  __pyx_t_4 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_entries)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(19, 190, __pyx_L1_error)
  __pyx_t_5 = (!__pyx_t_4);
  if (__pyx_t_5) {

    /* "src/lxml/xpath.pxi":191
 *         entries = self._error_log.filter_types(_XPATH_EVAL_ERRORS)
 *         if not entries:
 *             entries = self._error_log.filter_types(_XPATH_SYNTAX_ERRORS)             # <<<<<<<<<<<<<<
 *         if entries:
 *             message = entries._buildExceptionMessage(None)
*/
    __pyx_t_2 = ((PyObject *)__pyx_v_self->_error_log);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_4lxml_5etree__XPATH_SYNTAX_ERRORS};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_filter_types, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 191, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__BaseErrorLog))))) __PYX_ERR(19, 191, __pyx_L1_error)
    __Pyx_DECREF_SET(__pyx_v_entries, ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_t_1));
    __pyx_t_1 = 0;

    /* "src/lxml/xpath.pxi":190
 *         cdef _BaseErrorLog entries
 *         entries = self._error_log.filter_types(_XPATH_EVAL_ERRORS)
 *         if not entries:             # <<<<<<<<<<<<<<
 *             entries = self._error_log.filter_types(_XPATH_SYNTAX_ERRORS)
 *         if entries:
*/
  }

  /* "src/lxml/xpath.pxi":192
 *         if not entries:
 *             entries = self._error_log.filter_types(_XPATH_SYNTAX_ERRORS)
 *         if entries:             # <<<<<<<<<<<<<<
 *             message = entries._buildExceptionMessage(None)
 *             if message is not None:
*/
  __pyx_t_5 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_entries)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(19, 192, __pyx_L1_error)
  if (__pyx_t_5) {

    /* "src/lxml/xpath.pxi":193
 *             entries = self._error_log.filter_types(_XPATH_SYNTAX_ERRORS)
 *         if entries:
 *             message = entries._buildExceptionMessage(None)             # <<<<<<<<<<<<<<
 *             if message is not None:
 *                 return XPathEvalError(message, self._error_log)
*/
    __pyx_t_1 = __pyx_f_4lxml_5etree_13_BaseErrorLog__buildExceptionMessage(__pyx_v_entries, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 193, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_message = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "src/lxml/xpath.pxi":194
 *         if entries:
 *             message = entries._buildExceptionMessage(None)
 *             if message is not None:             # <<<<<<<<<<<<<<
 *                 return XPathEvalError(message, self._error_log)
 *         return XPathEvalError(
*/
    __pyx_t_5 = (__pyx_v_message != Py_None);
    if (__pyx_t_5) {

      /* "src/lxml/xpath.pxi":195
 *             message = entries._buildExceptionMessage(None)
 *             if message is not None:
 *                 return XPathEvalError(message, self._error_log)             # <<<<<<<<<<<<<<
 *         return XPathEvalError(
 *             self._error_log._buildExceptionMessage("Error in xpath expression"),
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = NULL;
      __pyx_t_3 = 1;
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_v_message, ((PyObject *)__pyx_v_self->_error_log)};
        __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XPathEvalError, __pyx_callargs+__pyx_t_3, (3-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 195, __pyx_L1_error)
        __Pyx_GOTREF((PyObject *)__pyx_t_1);
      }
      __pyx_r = ((PyObject *)__pyx_t_1);
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* "src/lxml/xpath.pxi":194
 *         if entries:
 *             message = entries._buildExceptionMessage(None)
 *             if message is not None:             # <<<<<<<<<<<<<<
 *                 return XPathEvalError(message, self._error_log)
 *         return XPathEvalError(
*/
    }

    /* "src/lxml/xpath.pxi":192
 *         if not entries:
 *             entries = self._error_log.filter_types(_XPATH_SYNTAX_ERRORS)
 *         if entries:             # <<<<<<<<<<<<<<
 *             message = entries._buildExceptionMessage(None)
 *             if message is not None:
*/
  }

  /* "src/lxml/xpath.pxi":196
 *             if message is not None:
 *                 return XPathEvalError(message, self._error_log)
 *         return XPathEvalError(             # <<<<<<<<<<<<<<
 *             self._error_log._buildExceptionMessage("Error in xpath expression"),
 *             self._error_log)
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = NULL;

  /* "src/lxml/xpath.pxi":197
 *                 return XPathEvalError(message, self._error_log)
 *         return XPathEvalError(
 *             self._error_log._buildExceptionMessage("Error in xpath expression"),             # <<<<<<<<<<<<<<
 *             self._error_log)
 * 
*/
  __pyx_t_6 = __pyx_f_4lxml_5etree_13_BaseErrorLog__buildExceptionMessage(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self->_error_log), __pyx_mstate_global->__pyx_kp_u_Error_in_xpath_expression); if (unlikely(!__pyx_t_6)) __PYX_ERR(19, 197, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);

  /* "src/lxml/xpath.pxi":198
 *         return XPathEvalError(
 *             self._error_log._buildExceptionMessage("Error in xpath expression"),
 *             self._error_log)             # <<<<<<<<<<<<<<
 * 
 *     cdef object _handle_result(self, xpath.xmlXPathObject* xpathObj, _Document doc):
*/
  __pyx_t_3 = 1;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_t_6, ((PyObject *)__pyx_v_self->_error_log)};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XPathEvalError, __pyx_callargs+__pyx_t_3, (3-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 196, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __pyx_r = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/xpath.pxi":187
 *             self._error_log)
 * 
 *     cdef _build_eval_error(self):             # <<<<<<<<<<<<<<
 *         cdef _BaseErrorLog entries
 *         entries = self._error_log.filter_types(_XPATH_EVAL_ERRORS)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._XPathEvaluatorBase._build_eval_error", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_entries);
  __Pyx_XDECREF(__pyx_v_message);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xpath.pxi":200
 *             self._error_log)
 * 
 *     cdef object _handle_result(self, xpath.xmlXPathObject* xpathObj, _Document doc):             # <<<<<<<<<<<<<<
 *         if self._context._exc._has_raised():
 *             if xpathObj is not NULL:
*/

static PyObject *__pyx_f_4lxml_5etree_19_XPathEvaluatorBase__handle_result(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *__pyx_v_self, xmlXPathObject *__pyx_v_xpathObj, struct LxmlDocument *__pyx_v_doc) {
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  char const *__pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_handle_result", 0);

  /* "src/lxml/xpath.pxi":201
 * 
 *     cdef object _handle_result(self, xpath.xmlXPathObject* xpathObj, _Document doc):
 *         if self._context._exc._has_raised():             # <<<<<<<<<<<<<<
 *             if xpathObj is not NULL:
 *                 _freeXPathObject(xpathObj)
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_17_ExceptionContext__has_raised(__pyx_v_self->_context->__pyx_base._exc); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(19, 201, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/xpath.pxi":202
 *     cdef object _handle_result(self, xpath.xmlXPathObject* xpathObj, _Document doc):
 *         if self._context._exc._has_raised():
 *             if xpathObj is not NULL:             # <<<<<<<<<<<<<<
 *                 _freeXPathObject(xpathObj)
 *                 xpathObj = NULL
*/
    __pyx_t_1 = (__pyx_v_xpathObj != NULL);
    if (__pyx_t_1) {

      /* "src/lxml/xpath.pxi":203
 *         if self._context._exc._has_raised():
 *             if xpathObj is not NULL:
 *                 _freeXPathObject(xpathObj)             # <<<<<<<<<<<<<<
 *                 xpathObj = NULL
 *             self._context._release_temp_refs()
*/
      __pyx_f_4lxml_5etree__freeXPathObject(__pyx_v_xpathObj);

      /* "src/lxml/xpath.pxi":204
 *             if xpathObj is not NULL:
 *                 _freeXPathObject(xpathObj)
 *                 xpathObj = NULL             # <<<<<<<<<<<<<<
 *             self._context._release_temp_refs()
 *             self._context._exc._raise_if_stored()
*/
      __pyx_v_xpathObj = NULL;

      /* "src/lxml/xpath.pxi":202
 *     cdef object _handle_result(self, xpath.xmlXPathObject* xpathObj, _Document doc):
 *         if self._context._exc._has_raised():
 *             if xpathObj is not NULL:             # <<<<<<<<<<<<<<
 *                 _freeXPathObject(xpathObj)
 *                 xpathObj = NULL
*/
    }

    /* "src/lxml/xpath.pxi":205
 *                 _freeXPathObject(xpathObj)
 *                 xpathObj = NULL
 *             self._context._release_temp_refs()             # <<<<<<<<<<<<<<
 *             self._context._exc._raise_if_stored()
 * 
*/
    __pyx_t_2 = __pyx_f_4lxml_5etree_12_BaseContext__release_temp_refs(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self->_context)); if (unlikely(!__pyx_t_2)) __PYX_ERR(19, 205, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/xpath.pxi":206
 *                 xpathObj = NULL
 *             self._context._release_temp_refs()
 *             self._context._exc._raise_if_stored()             # <<<<<<<<<<<<<<
 * 
 *         if xpathObj is NULL:
*/
    __pyx_t_3 = __pyx_f_4lxml_5etree_17_ExceptionContext__raise_if_stored(__pyx_v_self->_context->__pyx_base._exc); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(19, 206, __pyx_L1_error)

    /* "src/lxml/xpath.pxi":201
 * 
 *     cdef object _handle_result(self, xpath.xmlXPathObject* xpathObj, _Document doc):
 *         if self._context._exc._has_raised():             # <<<<<<<<<<<<<<
 *             if xpathObj is not NULL:
 *                 _freeXPathObject(xpathObj)
*/
  }

  /* "src/lxml/xpath.pxi":208
 *             self._context._exc._raise_if_stored()
 * 
 *         if xpathObj is NULL:             # <<<<<<<<<<<<<<
 *             self._context._release_temp_refs()
 *             raise self._build_eval_error()
*/
  __pyx_t_1 = (__pyx_v_xpathObj == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/xpath.pxi":209
 * 
 *         if xpathObj is NULL:
 *             self._context._release_temp_refs()             # <<<<<<<<<<<<<<
 *             raise self._build_eval_error()
 * 
*/
    __pyx_t_2 = __pyx_f_4lxml_5etree_12_BaseContext__release_temp_refs(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self->_context)); if (unlikely(!__pyx_t_2)) __PYX_ERR(19, 209, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/xpath.pxi":210
 *         if xpathObj is NULL:
 *             self._context._release_temp_refs()
 *             raise self._build_eval_error()             # <<<<<<<<<<<<<<
 * 
 *         try:
*/
    __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self->__pyx_vtab)->_build_eval_error(__pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(19, 210, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(19, 210, __pyx_L1_error)

    /* "src/lxml/xpath.pxi":208
 *             self._context._exc._raise_if_stored()
 * 
 *         if xpathObj is NULL:             # <<<<<<<<<<<<<<
 *             self._context._release_temp_refs()
 *             raise self._build_eval_error()
*/
  }

  /* "src/lxml/xpath.pxi":212
 *             raise self._build_eval_error()
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             result = _unwrapXPathObject(xpathObj, doc, self._context)
 *         finally:
*/
  /*try:*/ {

    /* "src/lxml/xpath.pxi":213
 * 
 *         try:
 *             result = _unwrapXPathObject(xpathObj, doc, self._context)             # <<<<<<<<<<<<<<
 *         finally:
 *             _freeXPathObject(xpathObj)
*/
    __pyx_t_2 = ((PyObject *)__pyx_v_self->_context);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_4 = __pyx_f_4lxml_5etree__unwrapXPathObject(__pyx_v_xpathObj, __pyx_v_doc, ((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_t_2)); if (unlikely(!__pyx_t_4)) __PYX_ERR(19, 213, __pyx_L7_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_result = __pyx_t_4;
    __pyx_t_4 = 0;
  }

  /* "src/lxml/xpath.pxi":215
 *             result = _unwrapXPathObject(xpathObj, doc, self._context)
 *         finally:
 *             _freeXPathObject(xpathObj)             # <<<<<<<<<<<<<<
 *             self._context._release_temp_refs()
 * 
*/
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_f_4lxml_5etree__freeXPathObject(__pyx_v_xpathObj);

      /* "src/lxml/xpath.pxi":216
 *         finally:
 *             _freeXPathObject(xpathObj)
 *             self._context._release_temp_refs()             # <<<<<<<<<<<<<<
 * 
 *         return result
*/
      __pyx_t_4 = __pyx_f_4lxml_5etree_12_BaseContext__release_temp_refs(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self->_context)); if (unlikely(!__pyx_t_4)) __PYX_ERR(19, 216, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L8;
    }
    __pyx_L7_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      if ( unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __pyx_t_3 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename;
      {

        /* "src/lxml/xpath.pxi":215
 *             result = _unwrapXPathObject(xpathObj, doc, self._context)
 *         finally:
 *             _freeXPathObject(xpathObj)             # <<<<<<<<<<<<<<
 *             self._context._release_temp_refs()
 * 
*/
        __pyx_f_4lxml_5etree__freeXPathObject(__pyx_v_xpathObj);

        /* "src/lxml/xpath.pxi":216
 *         finally:
 *             _freeXPathObject(xpathObj)
 *             self._context._release_temp_refs()             # <<<<<<<<<<<<<<
 * 
 *         return result
*/
        __pyx_t_4 = __pyx_f_4lxml_5etree_12_BaseContext__release_temp_refs(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self->_context)); if (unlikely(!__pyx_t_4)) __PYX_ERR(19, 216, __pyx_L10_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
      __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __pyx_lineno = __pyx_t_3; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6;
      goto __pyx_L1_error;
      __pyx_L10_error:;
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L8:;
  }

  /* "src/lxml/xpath.pxi":218
 *             self._context._release_temp_refs()
 * 
 *         return result             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "src/lxml/xpath.pxi":200
 *             self._error_log)
 * 
 *     cdef object _handle_result(self, xpath.xmlXPathObject* xpathObj, _Document doc):             # <<<<<<<<<<<<<<
 *         if self._context._exc._has_raised():
 *             if xpathObj is not NULL:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._XPathEvaluatorBase._handle_result", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xpath.pxi":235
 *     """
 *     cdef _Element _element
 *     def __init__(self, _Element element not None, *, namespaces=None,             # <<<<<<<<<<<<<<
 *                  extensions=None, regexp=True, smart_strings=True):
 *         cdef xpath.xmlXPathContext* xpathCtxt
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_21XPathElementEvaluator_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_21XPathElementEvaluator_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct LxmlElement *__pyx_v_element = 0;
  PyObject *__pyx_v_namespaces = 0;
  PyObject *__pyx_v_extensions = 0;
  PyObject *__pyx_v_regexp = 0;
  PyObject *__pyx_v_smart_strings = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[5] = {0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_element,&__pyx_mstate_global->__pyx_n_u_namespaces,&__pyx_mstate_global->__pyx_n_u_extensions,&__pyx_mstate_global->__pyx_n_u_regexp,&__pyx_mstate_global->__pyx_n_u_smart_strings,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(19, 235, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(19, 235, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(19, 235, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "src/lxml/xpath.pxi":236
 *     cdef _Element _element
 *     def __init__(self, _Element element not None, *, namespaces=None,
 *                  extensions=None, regexp=True, smart_strings=True):             # <<<<<<<<<<<<<<
 *         cdef xpath.xmlXPathContext* xpathCtxt
 *         cdef int ns_register_status
*/
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_True));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_True));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, i); __PYX_ERR(19, 235, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(19, 235, __pyx_L3_error)

      /* "src/lxml/xpath.pxi":235
 *     """
 *     cdef _Element _element
 *     def __init__(self, _Element element not None, *, namespaces=None,             # <<<<<<<<<<<<<<
 *                  extensions=None, regexp=True, smart_strings=True):
 *         cdef xpath.xmlXPathContext* xpathCtxt
*/
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "src/lxml/xpath.pxi":236
 *     cdef _Element _element
 *     def __init__(self, _Element element not None, *, namespaces=None,
 *                  extensions=None, regexp=True, smart_strings=True):             # <<<<<<<<<<<<<<
 *         cdef xpath.xmlXPathContext* xpathCtxt
 *         cdef int ns_register_status
*/
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_True));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_True));
    }
    __pyx_v_element = ((struct LxmlElement *)values[0]);
    __pyx_v_namespaces = values[1];
    __pyx_v_extensions = values[2];
    __pyx_v_regexp = values[3];
    __pyx_v_smart_strings = values[4];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, __pyx_nargs); __PYX_ERR(19, 235, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.XPathElementEvaluator.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_element), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element, 0, "element", 0))) __PYX_ERR(19, 235, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_21XPathElementEvaluator___init__(((struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *)__pyx_v_self), __pyx_v_element, __pyx_v_namespaces, __pyx_v_extensions, __pyx_v_regexp, __pyx_v_smart_strings);

  /* "src/lxml/xpath.pxi":235
 *     """
 *     cdef _Element _element
 *     def __init__(self, _Element element not None, *, namespaces=None,             # <<<<<<<<<<<<<<
 *                  extensions=None, regexp=True, smart_strings=True):
 *         cdef xpath.xmlXPathContext* xpathCtxt
*/

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_21XPathElementEvaluator___init__(struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *__pyx_v_self, struct LxmlElement *__pyx_v_element, PyObject *__pyx_v_namespaces, PyObject *__pyx_v_extensions, PyObject *__pyx_v_regexp, PyObject *__pyx_v_smart_strings) {
  xmlXPathContext *__pyx_v_xpathCtxt;
  struct LxmlDocument *__pyx_v_doc = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "src/lxml/xpath.pxi":240
 *         cdef int ns_register_status
 *         cdef _Document doc
 *         _assertValidNode(element)             # <<<<<<<<<<<<<<
 *         _assertValidDoc(element._doc)
 *         self._element = element
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_element); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(19, 240, __pyx_L1_error)

  /* "src/lxml/xpath.pxi":241
 *         cdef _Document doc
 *         _assertValidNode(element)
 *         _assertValidDoc(element._doc)             # <<<<<<<<<<<<<<
 *         self._element = element
 *         doc = element._doc
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_element->_doc);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidDoc(((struct LxmlDocument *)__pyx_t_2)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(19, 241, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/xpath.pxi":242
 *         _assertValidNode(element)
 *         _assertValidDoc(element._doc)
 *         self._element = element             # <<<<<<<<<<<<<<
 *         doc = element._doc
 *         _XPathEvaluatorBase.__init__(self, namespaces, extensions,
*/
  __Pyx_INCREF((PyObject *)__pyx_v_element);
  __Pyx_GIVEREF((PyObject *)__pyx_v_element);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_element);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_element);
  __pyx_v_self->_element = __pyx_v_element;

  /* "src/lxml/xpath.pxi":243
 *         _assertValidDoc(element._doc)
 *         self._element = element
 *         doc = element._doc             # <<<<<<<<<<<<<<
 *         _XPathEvaluatorBase.__init__(self, namespaces, extensions,
 *                                      regexp, smart_strings)
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_element->_doc);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/xpath.pxi":244
 *         self._element = element
 *         doc = element._doc
 *         _XPathEvaluatorBase.__init__(self, namespaces, extensions,             # <<<<<<<<<<<<<<
 *                                      regexp, smart_strings)
 *         xpathCtxt = xpath.xmlXPathNewContext(doc._c_doc)
*/
  __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__XPathEvaluatorBase);
  __Pyx_INCREF(__pyx_t_3);

  /* "src/lxml/xpath.pxi":245
 *         doc = element._doc
 *         _XPathEvaluatorBase.__init__(self, namespaces, extensions,
 *                                      regexp, smart_strings)             # <<<<<<<<<<<<<<
 *         xpathCtxt = xpath.xmlXPathNewContext(doc._c_doc)
 *         if xpathCtxt is NULL:
*/
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[6] = {__pyx_t_3, ((PyObject *)__pyx_v_self), __pyx_v_namespaces, __pyx_v_extensions, __pyx_v_regexp, __pyx_v_smart_strings};
    __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_init, __pyx_callargs+__pyx_t_4, (6-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(19, 244, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/xpath.pxi":246
 *         _XPathEvaluatorBase.__init__(self, namespaces, extensions,
 *                                      regexp, smart_strings)
 *         xpathCtxt = xpath.xmlXPathNewContext(doc._c_doc)             # <<<<<<<<<<<<<<
 *         if xpathCtxt is NULL:
 *             raise MemoryError()
*/
  __pyx_v_xpathCtxt = xmlXPathNewContext(__pyx_v_doc->_c_doc);

  /* "src/lxml/xpath.pxi":247
 *                                      regexp, smart_strings)
 *         xpathCtxt = xpath.xmlXPathNewContext(doc._c_doc)
 *         if xpathCtxt is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 *         self.set_context(xpathCtxt)
*/
  __pyx_t_5 = (__pyx_v_xpathCtxt == NULL);
  if (unlikely(__pyx_t_5)) {

    /* "src/lxml/xpath.pxi":248
 *         xpathCtxt = xpath.xmlXPathNewContext(doc._c_doc)
 *         if xpathCtxt is NULL:
 *             raise MemoryError()             # <<<<<<<<<<<<<<
 *         self.set_context(xpathCtxt)
 * 
*/
    PyErr_NoMemory(); __PYX_ERR(19, 248, __pyx_L1_error)

    /* "src/lxml/xpath.pxi":247
 *                                      regexp, smart_strings)
 *         xpathCtxt = xpath.xmlXPathNewContext(doc._c_doc)
 *         if xpathCtxt is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 *         self.set_context(xpathCtxt)
*/
  }

  /* "src/lxml/xpath.pxi":249
 *         if xpathCtxt is NULL:
 *             raise MemoryError()
 *         self.set_context(xpathCtxt)             # <<<<<<<<<<<<<<
 * 
 *     def register_namespace(self, prefix, uri):
*/
  __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree_XPathElementEvaluator *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_context(((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self), __pyx_v_xpathCtxt); if (unlikely(!__pyx_t_2)) __PYX_ERR(19, 249, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/xpath.pxi":235
 *     """
 *     cdef _Element _element
 *     def __init__(self, _Element element not None, *, namespaces=None,             # <<<<<<<<<<<<<<
 *                  extensions=None, regexp=True, smart_strings=True):
 *         cdef xpath.xmlXPathContext* xpathCtxt
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.XPathElementEvaluator.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xpath.pxi":251
 *         self.set_context(xpathCtxt)
 * 
 *     def register_namespace(self, prefix, uri):             # <<<<<<<<<<<<<<
 *         """Register a namespace with the XPath context.
 *         """
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_21XPathElementEvaluator_3register_namespace(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_21XPathElementEvaluator_2register_namespace, "Register a namespace with the XPath context.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_21XPathElementEvaluator_3register_namespace = {"register_namespace", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_21XPathElementEvaluator_3register_namespace, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_21XPathElementEvaluator_2register_namespace};
static PyObject *__pyx_pw_4lxml_5etree_21XPathElementEvaluator_3register_namespace(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_prefix = 0;
  PyObject *__pyx_v_uri = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("register_namespace (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_prefix,&__pyx_mstate_global->__pyx_n_u_uri,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(19, 251, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(19, 251, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(19, 251, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "register_namespace", 0) < (0)) __PYX_ERR(19, 251, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("register_namespace", 1, 2, 2, i); __PYX_ERR(19, 251, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(19, 251, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(19, 251, __pyx_L3_error)
    }
    __pyx_v_prefix = values[0];
    __pyx_v_uri = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("register_namespace", 1, 2, 2, __pyx_nargs); __PYX_ERR(19, 251, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.XPathElementEvaluator.register_namespace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_21XPathElementEvaluator_2register_namespace(((struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *)__pyx_v_self), __pyx_v_prefix, __pyx_v_uri);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_21XPathElementEvaluator_2register_namespace(struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *__pyx_v_self, PyObject *__pyx_v_prefix, PyObject *__pyx_v_uri) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("register_namespace", 0);

  /* "src/lxml/xpath.pxi":254
 *         """Register a namespace with the XPath context.
 *         """
 *         assert self._xpathCtxt is not NULL, "XPath context not initialised"             # <<<<<<<<<<<<<<
 *         self._context.addNamespace(prefix, uri)
 * 
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = (__pyx_v_self->__pyx_base._xpathCtxt != NULL);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_mstate_global->__pyx_kp_u_XPath_context_not_initialised, 0, 0);
      __PYX_ERR(19, 254, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(19, 254, __pyx_L1_error)
  #endif

  /* "src/lxml/xpath.pxi":255
 *         """
 *         assert self._xpathCtxt is not NULL, "XPath context not initialised"
 *         self._context.addNamespace(prefix, uri)             # <<<<<<<<<<<<<<
 * 
 *     def register_namespaces(self, namespaces):
*/
  __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__XPathContext *)__pyx_v_self->__pyx_base._context->__pyx_base.__pyx_vtab)->__pyx_base.addNamespace(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self->__pyx_base._context), __pyx_v_prefix, __pyx_v_uri); if (unlikely(!__pyx_t_2)) __PYX_ERR(19, 255, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/xpath.pxi":251
 *         self.set_context(xpathCtxt)
 * 
 *     def register_namespace(self, prefix, uri):             # <<<<<<<<<<<<<<
 *         """Register a namespace with the XPath context.
 *         """
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.XPathElementEvaluator.register_namespace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xpath.pxi":257
 *         self._context.addNamespace(prefix, uri)
 * 
 *     def register_namespaces(self, namespaces):             # <<<<<<<<<<<<<<
 *         """Register a prefix -> uri dict.
 *         """
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_21XPathElementEvaluator_5register_namespaces(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_21XPathElementEvaluator_4register_namespaces, "Register a prefix -> uri dict.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_21XPathElementEvaluator_5register_namespaces = {"register_namespaces", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_21XPathElementEvaluator_5register_namespaces, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_21XPathElementEvaluator_4register_namespaces};
static PyObject *__pyx_pw_4lxml_5etree_21XPathElementEvaluator_5register_namespaces(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_namespaces = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("register_namespaces (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_namespaces,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(19, 257, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(19, 257, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "register_namespaces", 0) < (0)) __PYX_ERR(19, 257, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("register_namespaces", 1, 1, 1, i); __PYX_ERR(19, 257, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(19, 257, __pyx_L3_error)
    }
    __pyx_v_namespaces = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("register_namespaces", 1, 1, 1, __pyx_nargs); __PYX_ERR(19, 257, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.XPathElementEvaluator.register_namespaces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_21XPathElementEvaluator_4register_namespaces(((struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *)__pyx_v_self), __pyx_v_namespaces);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_21XPathElementEvaluator_4register_namespaces(struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *__pyx_v_self, PyObject *__pyx_v_namespaces) {
  PyObject *__pyx_v_prefix = NULL;
  PyObject *__pyx_v_uri = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("register_namespaces", 0);

  /* "src/lxml/xpath.pxi":260
 *         """Register a prefix -> uri dict.
 *         """
 *         assert self._xpathCtxt is not NULL, "XPath context not initialised"             # <<<<<<<<<<<<<<
 *         for prefix, uri in namespaces.items():
 *             self._context.addNamespace(prefix, uri)
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = (__pyx_v_self->__pyx_base._xpathCtxt != NULL);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_mstate_global->__pyx_kp_u_XPath_context_not_initialised, 0, 0);
      __PYX_ERR(19, 260, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(19, 260, __pyx_L1_error)
  #endif

  /* "src/lxml/xpath.pxi":261
 *         """
 *         assert self._xpathCtxt is not NULL, "XPath context not initialised"
 *         for prefix, uri in namespaces.items():             # <<<<<<<<<<<<<<
 *             self._context.addNamespace(prefix, uri)
 * 
*/
  __pyx_t_3 = 0;
  if (unlikely(__pyx_v_namespaces == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
    __PYX_ERR(19, 261, __pyx_L1_error)
  }
  __pyx_t_6 = __Pyx_dict_iterator(__pyx_v_namespaces, 0, __pyx_mstate_global->__pyx_n_u_items, (&__pyx_t_4), (&__pyx_t_5)); if (unlikely(!__pyx_t_6)) __PYX_ERR(19, 261, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_2);
  __pyx_t_2 = __pyx_t_6;
  __pyx_t_6 = 0;
  while (1) {
    __pyx_t_8 = __Pyx_dict_iter_next(__pyx_t_2, __pyx_t_4, &__pyx_t_3, &__pyx_t_6, &__pyx_t_7, NULL, __pyx_t_5);
    if (unlikely(__pyx_t_8 == 0)) break;
    if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(19, 261, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_XDECREF_SET(__pyx_v_prefix, __pyx_t_6);
    __pyx_t_6 = 0;
    __Pyx_XDECREF_SET(__pyx_v_uri, __pyx_t_7);
    __pyx_t_7 = 0;

    /* "src/lxml/xpath.pxi":262
 *         assert self._xpathCtxt is not NULL, "XPath context not initialised"
 *         for prefix, uri in namespaces.items():
 *             self._context.addNamespace(prefix, uri)             # <<<<<<<<<<<<<<
 * 
 *     def __call__(self, _path, **_variables):
*/
    __pyx_t_7 = ((struct __pyx_vtabstruct_4lxml_5etree__XPathContext *)__pyx_v_self->__pyx_base._context->__pyx_base.__pyx_vtab)->__pyx_base.addNamespace(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self->__pyx_base._context), __pyx_v_prefix, __pyx_v_uri); if (unlikely(!__pyx_t_7)) __PYX_ERR(19, 262, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/xpath.pxi":257
 *         self._context.addNamespace(prefix, uri)
 * 
 *     def register_namespaces(self, namespaces):             # <<<<<<<<<<<<<<
 *         """Register a prefix -> uri dict.
 *         """
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree.XPathElementEvaluator.register_namespaces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_prefix);
  __Pyx_XDECREF(__pyx_v_uri);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xpath.pxi":264
 *             self._context.addNamespace(prefix, uri)
 * 
 *     def __call__(self, _path, **_variables):             # <<<<<<<<<<<<<<
 *         """__call__(self, _path, **_variables)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_21XPathElementEvaluator_7__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_21XPathElementEvaluator_6__call__, "__call__(self, _path, **_variables)\n\n        Evaluate an XPath expression on the document.\n\n        Variables may be provided as keyword arguments.  Note that namespaces\n        are currently not supported for variables.\n\n        Absolute XPath expressions (starting with '/') will be evaluated\n        against the ElementTree as returned by getroottree().\n        ");
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_21XPathElementEvaluator_6__call__;
#endif
static PyObject *__pyx_pw_4lxml_5etree_21XPathElementEvaluator_7__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v__path = 0;
  PyObject *__pyx_v__variables = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_v__variables = PyDict_New(); if (unlikely(!__pyx_v__variables)) return NULL;
  __Pyx_GOTREF(__pyx_v__variables);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_path_2,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(19, 264, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(19, 264, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v__variables, values, kwd_pos_args, __pyx_kwds_len, "__call__", 1) < (0)) __PYX_ERR(19, 264, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, i); __PYX_ERR(19, 264, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(19, 264, __pyx_L3_error)
    }
    __pyx_v__path = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, __pyx_nargs); __PYX_ERR(19, 264, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v__variables); __pyx_v__variables = 0;
  __Pyx_AddTraceback("lxml.etree.XPathElementEvaluator.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_21XPathElementEvaluator_6__call__(((struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *)__pyx_v_self), __pyx_v__path, __pyx_v__variables);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v__variables);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_21XPathElementEvaluator_6__call__(struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *__pyx_v_self, PyObject *__pyx_v__path, PyObject *__pyx_v__variables) {
  xmlXPathObject *__pyx_v_xpathObj;
  struct LxmlDocument *__pyx_v_doc = 0;
  PyObject *__pyx_v_path = NULL;
  const xmlChar *__pyx_v_c_path;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  xmlNode *__pyx_t_4;
  int __pyx_t_5;
  char const *__pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__call__", 0);

  /* "src/lxml/xpath.pxi":277
 *         cdef xpath.xmlXPathObject*  xpathObj
 *         cdef _Document doc
 *         assert self._xpathCtxt is not NULL, "XPath context not initialised"             # <<<<<<<<<<<<<<
 *         path = _utf8(_path)
 *         doc = self._element._doc
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = (__pyx_v_self->__pyx_base._xpathCtxt != NULL);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_mstate_global->__pyx_kp_u_XPath_context_not_initialised, 0, 0);
      __PYX_ERR(19, 277, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(19, 277, __pyx_L1_error)
  #endif

  /* "src/lxml/xpath.pxi":278
 *         cdef _Document doc
 *         assert self._xpathCtxt is not NULL, "XPath context not initialised"
 *         path = _utf8(_path)             # <<<<<<<<<<<<<<
 *         doc = self._element._doc
 * 
*/
  __pyx_t_2 = __pyx_f_4lxml_5etree__utf8(__pyx_v__path); if (unlikely(!__pyx_t_2)) __PYX_ERR(19, 278, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_path = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/xpath.pxi":279
 *         assert self._xpathCtxt is not NULL, "XPath context not initialised"
 *         path = _utf8(_path)
 *         doc = self._element._doc             # <<<<<<<<<<<<<<
 * 
 *         self._lock()
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self->_element->_doc);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/xpath.pxi":281
 *         doc = self._element._doc
 * 
 *         self._lock()             # <<<<<<<<<<<<<<
 *         self._xpathCtxt.node = self._element._c_node
 *         try:
*/
  __pyx_t_3 = __pyx_f_4lxml_5etree_19_XPathEvaluatorBase__lock(((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self)); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(19, 281, __pyx_L1_error)

  /* "src/lxml/xpath.pxi":282
 * 
 *         self._lock()
 *         self._xpathCtxt.node = self._element._c_node             # <<<<<<<<<<<<<<
 *         try:
 *             self._context.register_context(doc)
*/
  __pyx_t_4 = __pyx_v_self->_element->_c_node;
  __pyx_v_self->__pyx_base._xpathCtxt->node = __pyx_t_4;

  /* "src/lxml/xpath.pxi":283
 *         self._lock()
 *         self._xpathCtxt.node = self._element._c_node
 *         try:             # <<<<<<<<<<<<<<
 *             self._context.register_context(doc)
 *             self._context.registerVariables(_variables)
*/
  /*try:*/ {

    /* "src/lxml/xpath.pxi":284
 *         self._xpathCtxt.node = self._element._c_node
 *         try:
 *             self._context.register_context(doc)             # <<<<<<<<<<<<<<
 *             self._context.registerVariables(_variables)
 *             c_path = _xcstr(path)
*/
    __pyx_t_2 = __pyx_f_4lxml_5etree_13_XPathContext_register_context(__pyx_v_self->__pyx_base._context, __pyx_v_doc); if (unlikely(!__pyx_t_2)) __PYX_ERR(19, 284, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/xpath.pxi":285
 *         try:
 *             self._context.register_context(doc)
 *             self._context.registerVariables(_variables)             # <<<<<<<<<<<<<<
 *             c_path = _xcstr(path)
 *             with nogil:
*/
    __pyx_t_2 = __pyx_f_4lxml_5etree_13_XPathContext_registerVariables(__pyx_v_self->__pyx_base._context, __pyx_v__variables); if (unlikely(!__pyx_t_2)) __PYX_ERR(19, 285, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/xpath.pxi":286
 *             self._context.register_context(doc)
 *             self._context.registerVariables(_variables)
 *             c_path = _xcstr(path)             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 xpathObj = xpath.xmlXPathEvalExpression(
*/
    __pyx_v_c_path = (const xmlChar*)PyBytes_AS_STRING(__pyx_v_path);

    /* "src/lxml/xpath.pxi":287
 *             self._context.registerVariables(_variables)
 *             c_path = _xcstr(path)
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 xpathObj = xpath.xmlXPathEvalExpression(
 *                     c_path, self._xpathCtxt)
*/
    {
        PyThreadState * _save;
        _save = PyEval_SaveThread();
        __Pyx_FastGIL_Remember();
        /*try:*/ {

          /* "src/lxml/xpath.pxi":288
 *             c_path = _xcstr(path)
 *             with nogil:
 *                 xpathObj = xpath.xmlXPathEvalExpression(             # <<<<<<<<<<<<<<
 *                     c_path, self._xpathCtxt)
 *             result = self._handle_result(xpathObj, doc)
*/
          __pyx_v_xpathObj = xmlXPathEvalExpression(__pyx_v_c_path, __pyx_v_self->__pyx_base._xpathCtxt);
        }

        /* "src/lxml/xpath.pxi":287
 *             self._context.registerVariables(_variables)
 *             c_path = _xcstr(path)
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 xpathObj = xpath.xmlXPathEvalExpression(
 *                     c_path, self._xpathCtxt)
*/
        /*finally:*/ {
          /*normal exit:*/{
            __Pyx_FastGIL_Forget();
            PyEval_RestoreThread(_save);
            goto __pyx_L8;
          }
          __pyx_L8:;
        }
    }

    /* "src/lxml/xpath.pxi":290
 *                 xpathObj = xpath.xmlXPathEvalExpression(
 *                     c_path, self._xpathCtxt)
 *             result = self._handle_result(xpathObj, doc)             # <<<<<<<<<<<<<<
 *         finally:
 *             self._context.unregister_context()
*/
    __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree_XPathElementEvaluator *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._handle_result(((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self), __pyx_v_xpathObj, __pyx_v_doc); if (unlikely(!__pyx_t_2)) __PYX_ERR(19, 290, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_result = __pyx_t_2;
    __pyx_t_2 = 0;
  }

  /* "src/lxml/xpath.pxi":292
 *             result = self._handle_result(xpathObj, doc)
 *         finally:
 *             self._context.unregister_context()             # <<<<<<<<<<<<<<
 *             self._unlock()
 * 
*/
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_t_2 = __pyx_f_4lxml_5etree_13_XPathContext_unregister_context(__pyx_v_self->__pyx_base._context); if (unlikely(!__pyx_t_2)) __PYX_ERR(19, 292, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "src/lxml/xpath.pxi":293
 *         finally:
 *             self._context.unregister_context()
 *             self._unlock()             # <<<<<<<<<<<<<<
 * 
 *         return result
*/
      __pyx_f_4lxml_5etree_19_XPathEvaluatorBase__unlock(((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self));
      goto __pyx_L5;
    }
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      if ( unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __pyx_t_3 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename;
      {

        /* "src/lxml/xpath.pxi":292
 *             result = self._handle_result(xpathObj, doc)
 *         finally:
 *             self._context.unregister_context()             # <<<<<<<<<<<<<<
 *             self._unlock()
 * 
*/
        __pyx_t_2 = __pyx_f_4lxml_5etree_13_XPathContext_unregister_context(__pyx_v_self->__pyx_base._context); if (unlikely(!__pyx_t_2)) __PYX_ERR(19, 292, __pyx_L10_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "src/lxml/xpath.pxi":293
 *         finally:
 *             self._context.unregister_context()
 *             self._unlock()             # <<<<<<<<<<<<<<
 * 
 *         return result
*/
        __pyx_f_4lxml_5etree_19_XPathEvaluatorBase__unlock(((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self));
      }
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
      __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __pyx_lineno = __pyx_t_3; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6;
      goto __pyx_L1_error;
      __pyx_L10_error:;
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L5:;
  }

  /* "src/lxml/xpath.pxi":295
 *             self._unlock()
 * 
 *         return result             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "src/lxml/xpath.pxi":264
 *             self._context.addNamespace(prefix, uri)
 * 
 *     def __call__(self, _path, **_variables):             # <<<<<<<<<<<<<<
 *         """__call__(self, _path, **_variables)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.XPathElementEvaluator.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XDECREF(__pyx_v_path);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xpath.pxi":308
 *     you pass ``smart_strings=False``.
 *     """
 *     def __init__(self, _ElementTree etree not None, *, namespaces=None,             # <<<<<<<<<<<<<<
 *                  extensions=None, regexp=True, smart_strings=True):
 *         XPathElementEvaluator.__init__(
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_22XPathDocumentEvaluator_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_22XPathDocumentEvaluator_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct LxmlElementTree *__pyx_v_etree = 0;
  PyObject *__pyx_v_namespaces = 0;
  PyObject *__pyx_v_extensions = 0;
  PyObject *__pyx_v_regexp = 0;
  PyObject *__pyx_v_smart_strings = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[5] = {0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_etree,&__pyx_mstate_global->__pyx_n_u_namespaces,&__pyx_mstate_global->__pyx_n_u_extensions,&__pyx_mstate_global->__pyx_n_u_regexp,&__pyx_mstate_global->__pyx_n_u_smart_strings,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(19, 308, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(19, 308, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(19, 308, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "src/lxml/xpath.pxi":309
 *     """
 *     def __init__(self, _ElementTree etree not None, *, namespaces=None,
 *                  extensions=None, regexp=True, smart_strings=True):             # <<<<<<<<<<<<<<
 *         XPathElementEvaluator.__init__(
 *             self, etree._context_node, namespaces=namespaces,
*/
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_True));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_True));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, i); __PYX_ERR(19, 308, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(19, 308, __pyx_L3_error)

      /* "src/lxml/xpath.pxi":308
 *     you pass ``smart_strings=False``.
 *     """
 *     def __init__(self, _ElementTree etree not None, *, namespaces=None,             # <<<<<<<<<<<<<<
 *                  extensions=None, regexp=True, smart_strings=True):
 *         XPathElementEvaluator.__init__(
*/
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "src/lxml/xpath.pxi":309
 *     """
 *     def __init__(self, _ElementTree etree not None, *, namespaces=None,
 *                  extensions=None, regexp=True, smart_strings=True):             # <<<<<<<<<<<<<<
 *         XPathElementEvaluator.__init__(
 *             self, etree._context_node, namespaces=namespaces,
*/
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_True));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_True));
    }
    __pyx_v_etree = ((struct LxmlElementTree *)values[0]);
    __pyx_v_namespaces = values[1];
    __pyx_v_extensions = values[2];
    __pyx_v_regexp = values[3];
    __pyx_v_smart_strings = values[4];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, __pyx_nargs); __PYX_ERR(19, 308, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.XPathDocumentEvaluator.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_etree), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ElementTree, 0, "etree", 0))) __PYX_ERR(19, 308, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_22XPathDocumentEvaluator___init__(((struct __pyx_obj_4lxml_5etree_XPathDocumentEvaluator *)__pyx_v_self), __pyx_v_etree, __pyx_v_namespaces, __pyx_v_extensions, __pyx_v_regexp, __pyx_v_smart_strings);

  /* "src/lxml/xpath.pxi":308
 *     you pass ``smart_strings=False``.
 *     """
 *     def __init__(self, _ElementTree etree not None, *, namespaces=None,             # <<<<<<<<<<<<<<
 *                  extensions=None, regexp=True, smart_strings=True):
 *         XPathElementEvaluator.__init__(
*/

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_22XPathDocumentEvaluator___init__(struct __pyx_obj_4lxml_5etree_XPathDocumentEvaluator *__pyx_v_self, struct LxmlElementTree *__pyx_v_etree, PyObject *__pyx_v_namespaces, PyObject *__pyx_v_extensions, PyObject *__pyx_v_regexp, PyObject *__pyx_v_smart_strings) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "src/lxml/xpath.pxi":310
 *     def __init__(self, _ElementTree etree not None, *, namespaces=None,
 *                  extensions=None, regexp=True, smart_strings=True):
 *         XPathElementEvaluator.__init__(             # <<<<<<<<<<<<<<
 *             self, etree._context_node, namespaces=namespaces,
 *             extensions=extensions, regexp=regexp,
*/
  __pyx_t_2 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XPathElementEvaluator);
  __Pyx_INCREF(__pyx_t_2);

  /* "src/lxml/xpath.pxi":313
 *             self, etree._context_node, namespaces=namespaces,
 *             extensions=extensions, regexp=regexp,
 *             smart_strings=smart_strings)             # <<<<<<<<<<<<<<
 * 
 *     def __call__(self, _path, **_variables):
*/
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[3 + ((CYTHON_VECTORCALL) ? 4 : 0)] = {__pyx_t_2, ((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_etree->_context_node)};
    __pyx_t_4 = __Pyx_MakeVectorcallBuilderKwds(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(19, 310, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_namespaces, __pyx_v_namespaces, __pyx_t_4, __pyx_callargs+3, 0) < (0)) __PYX_ERR(19, 310, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_extensions, __pyx_v_extensions, __pyx_t_4, __pyx_callargs+3, 1) < (0)) __PYX_ERR(19, 310, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_regexp, __pyx_v_regexp, __pyx_t_4, __pyx_callargs+3, 2) < (0)) __PYX_ERR(19, 310, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_smart_strings, __pyx_v_smart_strings, __pyx_t_4, __pyx_callargs+3, 3) < (0)) __PYX_ERR(19, 310, __pyx_L1_error)
    __pyx_t_1 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_init, __pyx_callargs+__pyx_t_3, (3-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 310, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xpath.pxi":308
 *     you pass ``smart_strings=False``.
 *     """
 *     def __init__(self, _ElementTree etree not None, *, namespaces=None,             # <<<<<<<<<<<<<<
 *                  extensions=None, regexp=True, smart_strings=True):
 *         XPathElementEvaluator.__init__(
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.XPathDocumentEvaluator.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xpath.pxi":315
 *             smart_strings=smart_strings)
 * 
 *     def __call__(self, _path, **_variables):             # <<<<<<<<<<<<<<
 *         """__call__(self, _path, **_variables)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_22XPathDocumentEvaluator_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_22XPathDocumentEvaluator_2__call__, "__call__(self, _path, **_variables)\n\n        Evaluate an XPath expression on the document.\n\n        Variables may be provided as keyword arguments.  Note that namespaces\n        are currently not supported for variables.\n        ");
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_22XPathDocumentEvaluator_2__call__;
#endif
static PyObject *__pyx_pw_4lxml_5etree_22XPathDocumentEvaluator_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v__path = 0;
  PyObject *__pyx_v__variables = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_v__variables = PyDict_New(); if (unlikely(!__pyx_v__variables)) return NULL;
  __Pyx_GOTREF(__pyx_v__variables);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_path_2,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(19, 315, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(19, 315, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v__variables, values, kwd_pos_args, __pyx_kwds_len, "__call__", 1) < (0)) __PYX_ERR(19, 315, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, i); __PYX_ERR(19, 315, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(19, 315, __pyx_L3_error)
    }
    __pyx_v__path = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, __pyx_nargs); __PYX_ERR(19, 315, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v__variables); __pyx_v__variables = 0;
  __Pyx_AddTraceback("lxml.etree.XPathDocumentEvaluator.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_22XPathDocumentEvaluator_2__call__(((struct __pyx_obj_4lxml_5etree_XPathDocumentEvaluator *)__pyx_v_self), __pyx_v__path, __pyx_v__variables);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v__variables);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_22XPathDocumentEvaluator_2__call__(struct __pyx_obj_4lxml_5etree_XPathDocumentEvaluator *__pyx_v_self, PyObject *__pyx_v__path, PyObject *__pyx_v__variables) {
  xmlXPathObject *__pyx_v_xpathObj;
  xmlDoc *__pyx_v_c_doc;
  struct LxmlDocument *__pyx_v_doc = 0;
  PyObject *__pyx_v_path = NULL;
  const xmlChar *__pyx_v_c_path;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  xmlDoc *__pyx_t_4;
  int __pyx_t_5;
  char const *__pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  char const *__pyx_t_13;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__call__", 0);

  /* "src/lxml/xpath.pxi":326
 *         cdef xmlDoc* c_doc
 *         cdef _Document doc
 *         assert self._xpathCtxt is not NULL, "XPath context not initialised"             # <<<<<<<<<<<<<<
 *         path = _utf8(_path)
 *         doc = self._element._doc
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = (__pyx_v_self->__pyx_base.__pyx_base._xpathCtxt != NULL);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_mstate_global->__pyx_kp_u_XPath_context_not_initialised, 0, 0);
      __PYX_ERR(19, 326, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(19, 326, __pyx_L1_error)
  #endif

  /* "src/lxml/xpath.pxi":327
 *         cdef _Document doc
 *         assert self._xpathCtxt is not NULL, "XPath context not initialised"
 *         path = _utf8(_path)             # <<<<<<<<<<<<<<
 *         doc = self._element._doc
 * 
*/
  __pyx_t_2 = __pyx_f_4lxml_5etree__utf8(__pyx_v__path); if (unlikely(!__pyx_t_2)) __PYX_ERR(19, 327, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_path = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/xpath.pxi":328
 *         assert self._xpathCtxt is not NULL, "XPath context not initialised"
 *         path = _utf8(_path)
 *         doc = self._element._doc             # <<<<<<<<<<<<<<
 * 
 *         self._lock()
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self->__pyx_base._element->_doc);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/xpath.pxi":330
 *         doc = self._element._doc
 * 
 *         self._lock()             # <<<<<<<<<<<<<<
 *         try:
 *             self._context.register_context(doc)
*/
  __pyx_t_3 = __pyx_f_4lxml_5etree_19_XPathEvaluatorBase__lock(((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self)); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(19, 330, __pyx_L1_error)

  /* "src/lxml/xpath.pxi":331
 * 
 *         self._lock()
 *         try:             # <<<<<<<<<<<<<<
 *             self._context.register_context(doc)
 *             c_doc = _fakeRootDoc(doc._c_doc, self._element._c_node)
*/
  /*try:*/ {

    /* "src/lxml/xpath.pxi":332
 *         self._lock()
 *         try:
 *             self._context.register_context(doc)             # <<<<<<<<<<<<<<
 *             c_doc = _fakeRootDoc(doc._c_doc, self._element._c_node)
 *             try:
*/
    __pyx_t_2 = __pyx_f_4lxml_5etree_13_XPathContext_register_context(__pyx_v_self->__pyx_base.__pyx_base._context, __pyx_v_doc); if (unlikely(!__pyx_t_2)) __PYX_ERR(19, 332, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/xpath.pxi":333
 *         try:
 *             self._context.register_context(doc)
 *             c_doc = _fakeRootDoc(doc._c_doc, self._element._c_node)             # <<<<<<<<<<<<<<
 *             try:
 *                 self._context.registerVariables(_variables)
*/
    __pyx_t_4 = __pyx_f_4lxml_5etree__fakeRootDoc(__pyx_v_doc->_c_doc, __pyx_v_self->__pyx_base._element->_c_node); if (unlikely(__pyx_t_4 == ((void *)NULL))) __PYX_ERR(19, 333, __pyx_L4_error)
    __pyx_v_c_doc = __pyx_t_4;

    /* "src/lxml/xpath.pxi":334
 *             self._context.register_context(doc)
 *             c_doc = _fakeRootDoc(doc._c_doc, self._element._c_node)
 *             try:             # <<<<<<<<<<<<<<
 *                 self._context.registerVariables(_variables)
 *                 c_path = _xcstr(path)
*/
    /*try:*/ {

      /* "src/lxml/xpath.pxi":335
 *             c_doc = _fakeRootDoc(doc._c_doc, self._element._c_node)
 *             try:
 *                 self._context.registerVariables(_variables)             # <<<<<<<<<<<<<<
 *                 c_path = _xcstr(path)
 *                 with nogil:
*/
      __pyx_t_2 = __pyx_f_4lxml_5etree_13_XPathContext_registerVariables(__pyx_v_self->__pyx_base.__pyx_base._context, __pyx_v__variables); if (unlikely(!__pyx_t_2)) __PYX_ERR(19, 335, __pyx_L7_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "src/lxml/xpath.pxi":336
 *             try:
 *                 self._context.registerVariables(_variables)
 *                 c_path = _xcstr(path)             # <<<<<<<<<<<<<<
 *                 with nogil:
 *                     self._xpathCtxt.doc  = c_doc
*/
      __pyx_v_c_path = (const xmlChar*)PyBytes_AS_STRING(__pyx_v_path);

      /* "src/lxml/xpath.pxi":337
 *                 self._context.registerVariables(_variables)
 *                 c_path = _xcstr(path)
 *                 with nogil:             # <<<<<<<<<<<<<<
 *                     self._xpathCtxt.doc  = c_doc
 *                     self._xpathCtxt.node = tree.xmlDocGetRootElement(c_doc)
*/
      {
          PyThreadState * _save;
          _save = PyEval_SaveThread();
          __Pyx_FastGIL_Remember();
          /*try:*/ {

            /* "src/lxml/xpath.pxi":338
 *                 c_path = _xcstr(path)
 *                 with nogil:
 *                     self._xpathCtxt.doc  = c_doc             # <<<<<<<<<<<<<<
 *                     self._xpathCtxt.node = tree.xmlDocGetRootElement(c_doc)
 *                     xpathObj = xpath.xmlXPathEvalExpression(
*/
            __pyx_v_self->__pyx_base.__pyx_base._xpathCtxt->doc = __pyx_v_c_doc;

            /* "src/lxml/xpath.pxi":339
 *                 with nogil:
 *                     self._xpathCtxt.doc  = c_doc
 *                     self._xpathCtxt.node = tree.xmlDocGetRootElement(c_doc)             # <<<<<<<<<<<<<<
 *                     xpathObj = xpath.xmlXPathEvalExpression(
 *                         c_path, self._xpathCtxt)
*/
            __pyx_v_self->__pyx_base.__pyx_base._xpathCtxt->node = xmlDocGetRootElement(__pyx_v_c_doc);

            /* "src/lxml/xpath.pxi":340
 *                     self._xpathCtxt.doc  = c_doc
 *                     self._xpathCtxt.node = tree.xmlDocGetRootElement(c_doc)
 *                     xpathObj = xpath.xmlXPathEvalExpression(             # <<<<<<<<<<<<<<
 *                         c_path, self._xpathCtxt)
 *                 result = self._handle_result(xpathObj, doc)
*/
            __pyx_v_xpathObj = xmlXPathEvalExpression(__pyx_v_c_path, __pyx_v_self->__pyx_base.__pyx_base._xpathCtxt);
          }

          /* "src/lxml/xpath.pxi":337
 *                 self._context.registerVariables(_variables)
 *                 c_path = _xcstr(path)
 *                 with nogil:             # <<<<<<<<<<<<<<
 *                     self._xpathCtxt.doc  = c_doc
 *                     self._xpathCtxt.node = tree.xmlDocGetRootElement(c_doc)
*/
          /*finally:*/ {
            /*normal exit:*/{
              __Pyx_FastGIL_Forget();
              PyEval_RestoreThread(_save);
              goto __pyx_L11;
            }
            __pyx_L11:;
          }
      }

      /* "src/lxml/xpath.pxi":342
 *                     xpathObj = xpath.xmlXPathEvalExpression(
 *                         c_path, self._xpathCtxt)
 *                 result = self._handle_result(xpathObj, doc)             # <<<<<<<<<<<<<<
 *             finally:
 *                 _destroyFakeDoc(doc._c_doc, c_doc)
*/
      __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree_XPathDocumentEvaluator *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._handle_result(((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self), __pyx_v_xpathObj, __pyx_v_doc); if (unlikely(!__pyx_t_2)) __PYX_ERR(19, 342, __pyx_L7_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_v_result = __pyx_t_2;
      __pyx_t_2 = 0;
    }

    /* "src/lxml/xpath.pxi":344
 *                 result = self._handle_result(xpathObj, doc)
 *             finally:
 *                 _destroyFakeDoc(doc._c_doc, c_doc)             # <<<<<<<<<<<<<<
 *                 self._context.unregister_context()
 *         finally:
*/
    /*finally:*/ {
      /*normal exit:*/{
        __pyx_f_4lxml_5etree__destroyFakeDoc(__pyx_v_doc->_c_doc, __pyx_v_c_doc);

        /* "src/lxml/xpath.pxi":345
 *             finally:
 *                 _destroyFakeDoc(doc._c_doc, c_doc)
 *                 self._context.unregister_context()             # <<<<<<<<<<<<<<
 *         finally:
 *             self._unlock()
*/
        __pyx_t_2 = __pyx_f_4lxml_5etree_13_XPathContext_unregister_context(__pyx_v_self->__pyx_base.__pyx_base._context); if (unlikely(!__pyx_t_2)) __PYX_ERR(19, 345, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        goto __pyx_L8;
      }
      __pyx_L7_error:;
      /*exception exit:*/{
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
         __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
        if ( unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_9);
        __Pyx_XGOTREF(__pyx_t_10);
        __Pyx_XGOTREF(__pyx_t_11);
        __Pyx_XGOTREF(__pyx_t_12);
        __pyx_t_3 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename;
        {

          /* "src/lxml/xpath.pxi":344
 *                 result = self._handle_result(xpathObj, doc)
 *             finally:
 *                 _destroyFakeDoc(doc._c_doc, c_doc)             # <<<<<<<<<<<<<<
 *                 self._context.unregister_context()
 *         finally:
*/
          __pyx_f_4lxml_5etree__destroyFakeDoc(__pyx_v_doc->_c_doc, __pyx_v_c_doc);

          /* "src/lxml/xpath.pxi":345
 *             finally:
 *                 _destroyFakeDoc(doc._c_doc, c_doc)
 *                 self._context.unregister_context()             # <<<<<<<<<<<<<<
 *         finally:
 *             self._unlock()
*/
          __pyx_t_2 = __pyx_f_4lxml_5etree_13_XPathContext_unregister_context(__pyx_v_self->__pyx_base.__pyx_base._context); if (unlikely(!__pyx_t_2)) __PYX_ERR(19, 345, __pyx_L13_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        }
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
        __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
        __pyx_lineno = __pyx_t_3; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6;
        goto __pyx_L4_error;
        __pyx_L13_error:;
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
        goto __pyx_L4_error;
      }
      __pyx_L8:;
    }
  }

  /* "src/lxml/xpath.pxi":347
 *                 self._context.unregister_context()
 *         finally:
 *             self._unlock()             # <<<<<<<<<<<<<<
 * 
 *         return result
*/
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_f_4lxml_5etree_19_XPathEvaluatorBase__unlock(((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self));
      goto __pyx_L5;
    }
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_9 = 0; __pyx_t_8 = 0; __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_9, &__pyx_t_8, &__pyx_t_7);
      if ( unlikely(__Pyx_GetException(&__pyx_t_12, &__pyx_t_11, &__pyx_t_10) < 0)) __Pyx_ErrFetch(&__pyx_t_12, &__pyx_t_11, &__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_7);
      __pyx_t_5 = __pyx_lineno; __pyx_t_3 = __pyx_clineno; __pyx_t_13 = __pyx_filename;
      {
        __pyx_f_4lxml_5etree_19_XPathEvaluatorBase__unlock(((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self));
      }
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_8, __pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_ErrRestore(__pyx_t_12, __pyx_t_11, __pyx_t_10);
      __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_9 = 0; __pyx_t_8 = 0; __pyx_t_7 = 0;
      __pyx_lineno = __pyx_t_5; __pyx_clineno = __pyx_t_3; __pyx_filename = __pyx_t_13;
      goto __pyx_L1_error;
    }
    __pyx_L5:;
  }

  /* "src/lxml/xpath.pxi":349
 *             self._unlock()
 * 
 *         return result             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "src/lxml/xpath.pxi":315
 *             smart_strings=smart_strings)
 * 
 *     def __call__(self, _path, **_variables):             # <<<<<<<<<<<<<<
 *         """__call__(self, _path, **_variables)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.XPathDocumentEvaluator.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XDECREF(__pyx_v_path);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xpath.pxi":352
 * 
 * 
 * def XPathEvaluator(etree_or_element, *, namespaces=None, extensions=None,             # <<<<<<<<<<<<<<
 *                    regexp=True, smart_strings=True):
 *     """XPathEvaluator(etree_or_element, namespaces=None, extensions=None, regexp=True, smart_strings=True)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_70XPathEvaluator(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_69XPathEvaluator, "XPathEvaluator(etree_or_element, namespaces=None, extensions=None, regexp=True, smart_strings=True)\n\n    Creates an XPath evaluator for an ElementTree or an Element.\n\n    The resulting object can be called with an XPath expression as argument\n    and XPath variables provided as keyword arguments.\n\n    Additional namespace declarations can be passed with the\n    'namespace' keyword argument.  EXSLT regular expression support\n    can be disabled with the 'regexp' boolean keyword (defaults to\n    True).  Smart strings will be returned for string results unless\n    you pass ``smart_strings=False``.\n    ");
static PyMethodDef __pyx_mdef_4lxml_5etree_70XPathEvaluator = {"XPathEvaluator", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_70XPathEvaluator, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_69XPathEvaluator};
static PyObject *__pyx_pw_4lxml_5etree_70XPathEvaluator(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_etree_or_element = 0;
  PyObject *__pyx_v_namespaces = 0;
  PyObject *__pyx_v_extensions = 0;
  PyObject *__pyx_v_regexp = 0;
  PyObject *__pyx_v_smart_strings = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[5] = {0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("XPathEvaluator (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_etree_or_element,&__pyx_mstate_global->__pyx_n_u_namespaces,&__pyx_mstate_global->__pyx_n_u_extensions,&__pyx_mstate_global->__pyx_n_u_regexp,&__pyx_mstate_global->__pyx_n_u_smart_strings,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(19, 352, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(19, 352, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "XPathEvaluator", 0) < (0)) __PYX_ERR(19, 352, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "src/lxml/xpath.pxi":353
 * 
 * def XPathEvaluator(etree_or_element, *, namespaces=None, extensions=None,
 *                    regexp=True, smart_strings=True):             # <<<<<<<<<<<<<<
 *     """XPathEvaluator(etree_or_element, namespaces=None, extensions=None, regexp=True, smart_strings=True)
 * 
*/
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)((PyObject*)Py_True)));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)((PyObject*)Py_True)));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("XPathEvaluator", 1, 1, 1, i); __PYX_ERR(19, 352, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(19, 352, __pyx_L3_error)

      /* "src/lxml/xpath.pxi":352
 * 
 * 
 * def XPathEvaluator(etree_or_element, *, namespaces=None, extensions=None,             # <<<<<<<<<<<<<<
 *                    regexp=True, smart_strings=True):
 *     """XPathEvaluator(etree_or_element, namespaces=None, extensions=None, regexp=True, smart_strings=True)
*/
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)((PyObject*)Py_True)));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)((PyObject*)Py_True)));
    }
    __pyx_v_etree_or_element = values[0];
    __pyx_v_namespaces = values[1];
    __pyx_v_extensions = values[2];
    __pyx_v_regexp = values[3];
    __pyx_v_smart_strings = values[4];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("XPathEvaluator", 1, 1, 1, __pyx_nargs); __PYX_ERR(19, 352, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.XPathEvaluator", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_69XPathEvaluator(__pyx_self, __pyx_v_etree_or_element, __pyx_v_namespaces, __pyx_v_extensions, __pyx_v_regexp, __pyx_v_smart_strings);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_69XPathEvaluator(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_etree_or_element, PyObject *__pyx_v_namespaces, PyObject *__pyx_v_extensions, PyObject *__pyx_v_regexp, PyObject *__pyx_v_smart_strings) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("XPathEvaluator", 0);

  /* "src/lxml/xpath.pxi":367
 *     you pass ``smart_strings=False``.
 *     """
 *     if isinstance(etree_or_element, _ElementTree):             # <<<<<<<<<<<<<<
 *         return XPathDocumentEvaluator(
 *             etree_or_element, namespaces=namespaces,
*/
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_etree_or_element, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ElementTree); 
  if (__pyx_t_1) {

    /* "src/lxml/xpath.pxi":368
 *     """
 *     if isinstance(etree_or_element, _ElementTree):
 *         return XPathDocumentEvaluator(             # <<<<<<<<<<<<<<
 *             etree_or_element, namespaces=namespaces,
 *             extensions=extensions, regexp=regexp, smart_strings=smart_strings)
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = NULL;

    /* "src/lxml/xpath.pxi":370
 *         return XPathDocumentEvaluator(
 *             etree_or_element, namespaces=namespaces,
 *             extensions=extensions, regexp=regexp, smart_strings=smart_strings)             # <<<<<<<<<<<<<<
 *     else:
 *         return XPathElementEvaluator(
*/
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 4 : 0)] = {__pyx_t_3, __pyx_v_etree_or_element};
      __pyx_t_5 = __Pyx_MakeVectorcallBuilderKwds(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(19, 368, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_namespaces, __pyx_v_namespaces, __pyx_t_5, __pyx_callargs+2, 0) < (0)) __PYX_ERR(19, 368, __pyx_L1_error)
      if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_extensions, __pyx_v_extensions, __pyx_t_5, __pyx_callargs+2, 1) < (0)) __PYX_ERR(19, 368, __pyx_L1_error)
      if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_regexp, __pyx_v_regexp, __pyx_t_5, __pyx_callargs+2, 2) < (0)) __PYX_ERR(19, 368, __pyx_L1_error)
      if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_smart_strings, __pyx_v_smart_strings, __pyx_t_5, __pyx_callargs+2, 3) < (0)) __PYX_ERR(19, 368, __pyx_L1_error)
      __pyx_t_2 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XPathDocumentEvaluator, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_5);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(19, 368, __pyx_L1_error)
      __Pyx_GOTREF((PyObject *)__pyx_t_2);
    }
    __pyx_r = ((PyObject *)__pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "src/lxml/xpath.pxi":367
 *     you pass ``smart_strings=False``.
 *     """
 *     if isinstance(etree_or_element, _ElementTree):             # <<<<<<<<<<<<<<
 *         return XPathDocumentEvaluator(
 *             etree_or_element, namespaces=namespaces,
*/
  }

  /* "src/lxml/xpath.pxi":372
 *             extensions=extensions, regexp=regexp, smart_strings=smart_strings)
 *     else:
 *         return XPathElementEvaluator(             # <<<<<<<<<<<<<<
 *             etree_or_element, namespaces=namespaces,
 *             extensions=extensions, regexp=regexp, smart_strings=smart_strings)
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = NULL;

    /* "src/lxml/xpath.pxi":374
 *         return XPathElementEvaluator(
 *             etree_or_element, namespaces=namespaces,
 *             extensions=extensions, regexp=regexp, smart_strings=smart_strings)             # <<<<<<<<<<<<<<
 * 
 * 
*/
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 4 : 0)] = {__pyx_t_5, __pyx_v_etree_or_element};
      __pyx_t_3 = __Pyx_MakeVectorcallBuilderKwds(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(19, 372, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_namespaces, __pyx_v_namespaces, __pyx_t_3, __pyx_callargs+2, 0) < (0)) __PYX_ERR(19, 372, __pyx_L1_error)
      if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_extensions, __pyx_v_extensions, __pyx_t_3, __pyx_callargs+2, 1) < (0)) __PYX_ERR(19, 372, __pyx_L1_error)
      if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_regexp, __pyx_v_regexp, __pyx_t_3, __pyx_callargs+2, 2) < (0)) __PYX_ERR(19, 372, __pyx_L1_error)
      if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_smart_strings, __pyx_v_smart_strings, __pyx_t_3, __pyx_callargs+2, 3) < (0)) __PYX_ERR(19, 372, __pyx_L1_error)
      __pyx_t_2 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XPathElementEvaluator, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_3);
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(19, 372, __pyx_L1_error)
      __Pyx_GOTREF((PyObject *)__pyx_t_2);
    }
    __pyx_r = ((PyObject *)__pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "src/lxml/xpath.pxi":352
 * 
 * 
 * def XPathEvaluator(etree_or_element, *, namespaces=None, extensions=None,             # <<<<<<<<<<<<<<
 *                    regexp=True, smart_strings=True):
 *     """XPathEvaluator(etree_or_element, namespaces=None, extensions=None, regexp=True, smart_strings=True)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree.XPathEvaluator", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xpath.pxi":391
 *     cdef xpath.xmlXPathCompExpr* _xpath
 *     cdef bytes _path
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._xpath = NULL
 * 
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_5XPath_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_5XPath_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, __pyx_nargs); return -1; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return -1;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__cinit__", __pyx_kwds); return -1;}
  __pyx_r = __pyx_pf_4lxml_5etree_5XPath___cinit__(((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_5XPath___cinit__(struct __pyx_obj_4lxml_5etree_XPath *__pyx_v_self) {
  int __pyx_r;

  /* "src/lxml/xpath.pxi":392
 *     cdef bytes _path
 *     def __cinit__(self):
 *         self._xpath = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, path, *, namespaces=None, extensions=None,
*/
  __pyx_v_self->_xpath = NULL;

  /* "src/lxml/xpath.pxi":391
 *     cdef xpath.xmlXPathCompExpr* _xpath
 *     cdef bytes _path
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._xpath = NULL
 * 
*/

  /* function exit code */
  __pyx_r = 0;
  return __pyx_r;
}

/* "src/lxml/xpath.pxi":394
 *         self._xpath = NULL
 * 
 *     def __init__(self, path, *, namespaces=None, extensions=None,             # <<<<<<<<<<<<<<
 *                  regexp=True, smart_strings=True):
 *         cdef xpath.xmlXPathContext* xpathCtxt
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_5XPath_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_5XPath_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_path = 0;
  PyObject *__pyx_v_namespaces = 0;
  PyObject *__pyx_v_extensions = 0;
  PyObject *__pyx_v_regexp = 0;
  PyObject *__pyx_v_smart_strings = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[5] = {0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_path,&__pyx_mstate_global->__pyx_n_u_namespaces,&__pyx_mstate_global->__pyx_n_u_extensions,&__pyx_mstate_global->__pyx_n_u_regexp,&__pyx_mstate_global->__pyx_n_u_smart_strings,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(19, 394, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(19, 394, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(19, 394, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "src/lxml/xpath.pxi":395
 * 
 *     def __init__(self, path, *, namespaces=None, extensions=None,
 *                  regexp=True, smart_strings=True):             # <<<<<<<<<<<<<<
 *         cdef xpath.xmlXPathContext* xpathCtxt
 *         _XPathEvaluatorBase.__init__(self, namespaces, extensions,
*/
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_True));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_True));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, i); __PYX_ERR(19, 394, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(19, 394, __pyx_L3_error)

      /* "src/lxml/xpath.pxi":394
 *         self._xpath = NULL
 * 
 *     def __init__(self, path, *, namespaces=None, extensions=None,             # <<<<<<<<<<<<<<
 *                  regexp=True, smart_strings=True):
 *         cdef xpath.xmlXPathContext* xpathCtxt
*/
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "src/lxml/xpath.pxi":395
 * 
 *     def __init__(self, path, *, namespaces=None, extensions=None,
 *                  regexp=True, smart_strings=True):             # <<<<<<<<<<<<<<
 *         cdef xpath.xmlXPathContext* xpathCtxt
 *         _XPathEvaluatorBase.__init__(self, namespaces, extensions,
*/
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_True));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_True));
    }
    __pyx_v_path = values[0];
    __pyx_v_namespaces = values[1];
    __pyx_v_extensions = values[2];
    __pyx_v_regexp = values[3];
    __pyx_v_smart_strings = values[4];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, __pyx_nargs); __PYX_ERR(19, 394, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.XPath.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_5XPath_2__init__(((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_v_self), __pyx_v_path, __pyx_v_namespaces, __pyx_v_extensions, __pyx_v_regexp, __pyx_v_smart_strings);

  /* "src/lxml/xpath.pxi":394
 *         self._xpath = NULL
 * 
 *     def __init__(self, path, *, namespaces=None, extensions=None,             # <<<<<<<<<<<<<<
 *                  regexp=True, smart_strings=True):
 *         cdef xpath.xmlXPathContext* xpathCtxt
*/

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_5XPath_2__init__(struct __pyx_obj_4lxml_5etree_XPath *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_namespaces, PyObject *__pyx_v_extensions, PyObject *__pyx_v_regexp, PyObject *__pyx_v_smart_strings) {
  xmlXPathContext *__pyx_v_xpathCtxt;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "src/lxml/xpath.pxi":397
 *                  regexp=True, smart_strings=True):
 *         cdef xpath.xmlXPathContext* xpathCtxt
 *         _XPathEvaluatorBase.__init__(self, namespaces, extensions,             # <<<<<<<<<<<<<<
 *                                      regexp, smart_strings)
 *         self._path = _utf8(path)
*/
  __pyx_t_2 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__XPathEvaluatorBase);
  __Pyx_INCREF(__pyx_t_2);

  /* "src/lxml/xpath.pxi":398
 *         cdef xpath.xmlXPathContext* xpathCtxt
 *         _XPathEvaluatorBase.__init__(self, namespaces, extensions,
 *                                      regexp, smart_strings)             # <<<<<<<<<<<<<<
 *         self._path = _utf8(path)
 *         xpathCtxt = xpath.xmlXPathNewContext(NULL)
*/
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[6] = {__pyx_t_2, ((PyObject *)__pyx_v_self), __pyx_v_namespaces, __pyx_v_extensions, __pyx_v_regexp, __pyx_v_smart_strings};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_init, __pyx_callargs+__pyx_t_3, (6-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 397, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xpath.pxi":399
 *         _XPathEvaluatorBase.__init__(self, namespaces, extensions,
 *                                      regexp, smart_strings)
 *         self._path = _utf8(path)             # <<<<<<<<<<<<<<
 *         xpathCtxt = xpath.xmlXPathNewContext(NULL)
 *         if xpathCtxt is NULL:
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__utf8(__pyx_v_path); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 399, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_path);
  __Pyx_DECREF(__pyx_v_self->_path);
  __pyx_v_self->_path = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xpath.pxi":400
 *                                      regexp, smart_strings)
 *         self._path = _utf8(path)
 *         xpathCtxt = xpath.xmlXPathNewContext(NULL)             # <<<<<<<<<<<<<<
 *         if xpathCtxt is NULL:
 *             raise MemoryError()
*/
  __pyx_v_xpathCtxt = xmlXPathNewContext(NULL);

  /* "src/lxml/xpath.pxi":401
 *         self._path = _utf8(path)
 *         xpathCtxt = xpath.xmlXPathNewContext(NULL)
 *         if xpathCtxt is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 *         self.set_context(xpathCtxt)
*/
  __pyx_t_4 = (__pyx_v_xpathCtxt == NULL);
  if (unlikely(__pyx_t_4)) {

    /* "src/lxml/xpath.pxi":402
 *         xpathCtxt = xpath.xmlXPathNewContext(NULL)
 *         if xpathCtxt is NULL:
 *             raise MemoryError()             # <<<<<<<<<<<<<<
 *         self.set_context(xpathCtxt)
 *         self._xpath = xpath.xmlXPathCtxtCompile(xpathCtxt, _xcstr(self._path))
*/
    PyErr_NoMemory(); __PYX_ERR(19, 402, __pyx_L1_error)

    /* "src/lxml/xpath.pxi":401
 *         self._path = _utf8(path)
 *         xpathCtxt = xpath.xmlXPathNewContext(NULL)
 *         if xpathCtxt is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 *         self.set_context(xpathCtxt)
*/
  }

  /* "src/lxml/xpath.pxi":403
 *         if xpathCtxt is NULL:
 *             raise MemoryError()
 *         self.set_context(xpathCtxt)             # <<<<<<<<<<<<<<
 *         self._xpath = xpath.xmlXPathCtxtCompile(xpathCtxt, _xcstr(self._path))
 *         if self._xpath is NULL:
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree_XPath *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_context(((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self), __pyx_v_xpathCtxt); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 403, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xpath.pxi":404
 *             raise MemoryError()
 *         self.set_context(xpathCtxt)
 *         self._xpath = xpath.xmlXPathCtxtCompile(xpathCtxt, _xcstr(self._path))             # <<<<<<<<<<<<<<
 *         if self._xpath is NULL:
 *             raise self._build_parse_error()
*/
  __pyx_t_1 = __pyx_v_self->_path;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_self->_xpath = xmlXPathCtxtCompile(__pyx_v_xpathCtxt, (const xmlChar*)PyBytes_AS_STRING(__pyx_t_1));
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xpath.pxi":405
 *         self.set_context(xpathCtxt)
 *         self._xpath = xpath.xmlXPathCtxtCompile(xpathCtxt, _xcstr(self._path))
 *         if self._xpath is NULL:             # <<<<<<<<<<<<<<
 *             raise self._build_parse_error()
 * 
*/
  __pyx_t_4 = (__pyx_v_self->_xpath == NULL);
  if (unlikely(__pyx_t_4)) {

    /* "src/lxml/xpath.pxi":406
 *         self._xpath = xpath.xmlXPathCtxtCompile(xpathCtxt, _xcstr(self._path))
 *         if self._xpath is NULL:
 *             raise self._build_parse_error()             # <<<<<<<<<<<<<<
 * 
 *     def __call__(self, _etree_or_element, **_variables):
*/
    __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree_XPath *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._build_parse_error(((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 406, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(19, 406, __pyx_L1_error)

    /* "src/lxml/xpath.pxi":405
 *         self.set_context(xpathCtxt)
 *         self._xpath = xpath.xmlXPathCtxtCompile(xpathCtxt, _xcstr(self._path))
 *         if self._xpath is NULL:             # <<<<<<<<<<<<<<
 *             raise self._build_parse_error()
 * 
*/
  }

  /* "src/lxml/xpath.pxi":394
 *         self._xpath = NULL
 * 
 *     def __init__(self, path, *, namespaces=None, extensions=None,             # <<<<<<<<<<<<<<
 *                  regexp=True, smart_strings=True):
 *         cdef xpath.xmlXPathContext* xpathCtxt
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.XPath.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xpath.pxi":408
 *             raise self._build_parse_error()
 * 
 *     def __call__(self, _etree_or_element, **_variables):             # <<<<<<<<<<<<<<
 *         "__call__(self, _etree_or_element, **_variables)"
 *         cdef xpath.xmlXPathObject*  xpathObj
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_5XPath_5__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_5XPath_4__call__, "__call__(self, _etree_or_element, **_variables)");
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_5XPath_4__call__;
#endif
static PyObject *__pyx_pw_4lxml_5etree_5XPath_5__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v__etree_or_element = 0;
  PyObject *__pyx_v__variables = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_v__variables = PyDict_New(); if (unlikely(!__pyx_v__variables)) return NULL;
  __Pyx_GOTREF(__pyx_v__variables);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_etree_or_element_2,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(19, 408, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(19, 408, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v__variables, values, kwd_pos_args, __pyx_kwds_len, "__call__", 1) < (0)) __PYX_ERR(19, 408, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, i); __PYX_ERR(19, 408, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(19, 408, __pyx_L3_error)
    }
    __pyx_v__etree_or_element = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, __pyx_nargs); __PYX_ERR(19, 408, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v__variables); __pyx_v__variables = 0;
  __Pyx_AddTraceback("lxml.etree.XPath.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_5XPath_4__call__(((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_v_self), __pyx_v__etree_or_element, __pyx_v__variables);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v__variables);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_5XPath_4__call__(struct __pyx_obj_4lxml_5etree_XPath *__pyx_v_self, PyObject *__pyx_v__etree_or_element, PyObject *__pyx_v__variables) {
  xmlXPathObject *__pyx_v_xpathObj;
  struct LxmlDocument *__pyx_v_document = 0;
  struct LxmlElement *__pyx_v_element = 0;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  xmlDoc *__pyx_t_4;
  xmlNode *__pyx_t_5;
  int __pyx_t_6;
  char const *__pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__call__", 0);

  /* "src/lxml/xpath.pxi":414
 *         cdef _Element element
 * 
 *         assert self._xpathCtxt is not NULL, "XPath context not initialised"             # <<<<<<<<<<<<<<
 *         document = _documentOrRaise(_etree_or_element)
 *         element  = _rootNodeOrRaise(_etree_or_element)
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = (__pyx_v_self->__pyx_base._xpathCtxt != NULL);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_mstate_global->__pyx_kp_u_XPath_context_not_initialised, 0, 0);
      __PYX_ERR(19, 414, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(19, 414, __pyx_L1_error)
  #endif

  /* "src/lxml/xpath.pxi":415
 * 
 *         assert self._xpathCtxt is not NULL, "XPath context not initialised"
 *         document = _documentOrRaise(_etree_or_element)             # <<<<<<<<<<<<<<
 *         element  = _rootNodeOrRaise(_etree_or_element)
 * 
*/
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__documentOrRaise(__pyx_v__etree_or_element)); if (unlikely(!__pyx_t_2)) __PYX_ERR(19, 415, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_document = ((struct LxmlDocument *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/xpath.pxi":416
 *         assert self._xpathCtxt is not NULL, "XPath context not initialised"
 *         document = _documentOrRaise(_etree_or_element)
 *         element  = _rootNodeOrRaise(_etree_or_element)             # <<<<<<<<<<<<<<
 * 
 *         self._lock()
*/
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__rootNodeOrRaise(__pyx_v__etree_or_element)); if (unlikely(!__pyx_t_2)) __PYX_ERR(19, 416, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_element = ((struct LxmlElement *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/xpath.pxi":418
 *         element  = _rootNodeOrRaise(_etree_or_element)
 * 
 *         self._lock()             # <<<<<<<<<<<<<<
 *         self._xpathCtxt.doc  = document._c_doc
 *         self._xpathCtxt.node = element._c_node
*/
  __pyx_t_3 = __pyx_f_4lxml_5etree_19_XPathEvaluatorBase__lock(((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self)); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(19, 418, __pyx_L1_error)

  /* "src/lxml/xpath.pxi":419
 * 
 *         self._lock()
 *         self._xpathCtxt.doc  = document._c_doc             # <<<<<<<<<<<<<<
 *         self._xpathCtxt.node = element._c_node
 * 
*/
  __pyx_t_4 = __pyx_v_document->_c_doc;
  __pyx_v_self->__pyx_base._xpathCtxt->doc = __pyx_t_4;

  /* "src/lxml/xpath.pxi":420
 *         self._lock()
 *         self._xpathCtxt.doc  = document._c_doc
 *         self._xpathCtxt.node = element._c_node             # <<<<<<<<<<<<<<
 * 
 *         try:
*/
  __pyx_t_5 = __pyx_v_element->_c_node;
  __pyx_v_self->__pyx_base._xpathCtxt->node = __pyx_t_5;

  /* "src/lxml/xpath.pxi":422
 *         self._xpathCtxt.node = element._c_node
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             self._context.register_context(document)
 *             self._context.registerVariables(_variables)
*/
  /*try:*/ {

    /* "src/lxml/xpath.pxi":423
 * 
 *         try:
 *             self._context.register_context(document)             # <<<<<<<<<<<<<<
 *             self._context.registerVariables(_variables)
 *             with nogil:
*/
    __pyx_t_2 = __pyx_f_4lxml_5etree_13_XPathContext_register_context(__pyx_v_self->__pyx_base._context, __pyx_v_document); if (unlikely(!__pyx_t_2)) __PYX_ERR(19, 423, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/xpath.pxi":424
 *         try:
 *             self._context.register_context(document)
 *             self._context.registerVariables(_variables)             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 xpathObj = xpath.xmlXPathCompiledEval(
*/
    __pyx_t_2 = __pyx_f_4lxml_5etree_13_XPathContext_registerVariables(__pyx_v_self->__pyx_base._context, __pyx_v__variables); if (unlikely(!__pyx_t_2)) __PYX_ERR(19, 424, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/xpath.pxi":425
 *             self._context.register_context(document)
 *             self._context.registerVariables(_variables)
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 xpathObj = xpath.xmlXPathCompiledEval(
 *                     self._xpath, self._xpathCtxt)
*/
    {
        PyThreadState * _save;
        _save = PyEval_SaveThread();
        __Pyx_FastGIL_Remember();
        /*try:*/ {

          /* "src/lxml/xpath.pxi":426
 *             self._context.registerVariables(_variables)
 *             with nogil:
 *                 xpathObj = xpath.xmlXPathCompiledEval(             # <<<<<<<<<<<<<<
 *                     self._xpath, self._xpathCtxt)
 *             result = self._handle_result(xpathObj, document)
*/
          __pyx_v_xpathObj = xmlXPathCompiledEval(__pyx_v_self->_xpath, __pyx_v_self->__pyx_base._xpathCtxt);
        }

        /* "src/lxml/xpath.pxi":425
 *             self._context.register_context(document)
 *             self._context.registerVariables(_variables)
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 xpathObj = xpath.xmlXPathCompiledEval(
 *                     self._xpath, self._xpathCtxt)
*/
        /*finally:*/ {
          /*normal exit:*/{
            __Pyx_FastGIL_Forget();
            PyEval_RestoreThread(_save);
            goto __pyx_L8;
          }
          __pyx_L8:;
        }
    }

    /* "src/lxml/xpath.pxi":428
 *                 xpathObj = xpath.xmlXPathCompiledEval(
 *                     self._xpath, self._xpathCtxt)
 *             result = self._handle_result(xpathObj, document)             # <<<<<<<<<<<<<<
 *         finally:
 *             self._context.unregister_context()
*/
    __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree_XPath *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._handle_result(((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self), __pyx_v_xpathObj, __pyx_v_document); if (unlikely(!__pyx_t_2)) __PYX_ERR(19, 428, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_result = __pyx_t_2;
    __pyx_t_2 = 0;
  }

  /* "src/lxml/xpath.pxi":430
 *             result = self._handle_result(xpathObj, document)
 *         finally:
 *             self._context.unregister_context()             # <<<<<<<<<<<<<<
 *             self._unlock()
 *         return result
*/
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_t_2 = __pyx_f_4lxml_5etree_13_XPathContext_unregister_context(__pyx_v_self->__pyx_base._context); if (unlikely(!__pyx_t_2)) __PYX_ERR(19, 430, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "src/lxml/xpath.pxi":431
 *         finally:
 *             self._context.unregister_context()
 *             self._unlock()             # <<<<<<<<<<<<<<
 *         return result
 * 
*/
      __pyx_f_4lxml_5etree_19_XPathEvaluatorBase__unlock(((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self));
      goto __pyx_L5;
    }
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
      if ( unlikely(__Pyx_GetException(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10) < 0)) __Pyx_ErrFetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      __pyx_t_3 = __pyx_lineno; __pyx_t_6 = __pyx_clineno; __pyx_t_7 = __pyx_filename;
      {

        /* "src/lxml/xpath.pxi":430
 *             result = self._handle_result(xpathObj, document)
 *         finally:
 *             self._context.unregister_context()             # <<<<<<<<<<<<<<
 *             self._unlock()
 *         return result
*/
        __pyx_t_2 = __pyx_f_4lxml_5etree_13_XPathContext_unregister_context(__pyx_v_self->__pyx_base._context); if (unlikely(!__pyx_t_2)) __PYX_ERR(19, 430, __pyx_L10_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "src/lxml/xpath.pxi":431
 *         finally:
 *             self._context.unregister_context()
 *             self._unlock()             # <<<<<<<<<<<<<<
 *         return result
 * 
*/
        __pyx_f_4lxml_5etree_19_XPathEvaluatorBase__unlock(((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self));
      }
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_ErrRestore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
      __pyx_lineno = __pyx_t_3; __pyx_clineno = __pyx_t_6; __pyx_filename = __pyx_t_7;
      goto __pyx_L1_error;
      __pyx_L10_error:;
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L5:;
  }

  /* "src/lxml/xpath.pxi":432
 *             self._context.unregister_context()
 *             self._unlock()
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "src/lxml/xpath.pxi":408
 *             raise self._build_parse_error()
 * 
 *     def __call__(self, _etree_or_element, **_variables):             # <<<<<<<<<<<<<<
 *         "__call__(self, _etree_or_element, **_variables)"
 *         cdef xpath.xmlXPathObject*  xpathObj
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.XPath.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_document);
  __Pyx_XDECREF((PyObject *)__pyx_v_element);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xpath.pxi":434
 *         return result
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def path(self):
 *         """The literal XPath expression.
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_5XPath_4path_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_5XPath_4path_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_5XPath_4path___get__(((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_5XPath_4path___get__(struct __pyx_obj_4lxml_5etree_XPath *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "src/lxml/xpath.pxi":438
 *         """The literal XPath expression.
 *         """
 *         return self._path.decode('UTF-8')             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(__pyx_v_self->_path == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "decode");
    __PYX_ERR(19, 438, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_decode_bytes(__pyx_v_self->_path, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 438, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/xpath.pxi":434
 *         return result
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def path(self):
 *         """The literal XPath expression.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.XPath.path.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xpath.pxi":440
 *         return self._path.decode('UTF-8')
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._xpath is not NULL:
 *             xpath.xmlXPathFreeCompExpr(self._xpath)
*/

/* Python wrapper */
static void __pyx_pw_4lxml_5etree_5XPath_7__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_4lxml_5etree_5XPath_7__dealloc__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_pf_4lxml_5etree_5XPath_6__dealloc__(((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_4lxml_5etree_5XPath_6__dealloc__(struct __pyx_obj_4lxml_5etree_XPath *__pyx_v_self) {
  int __pyx_t_1;

  /* "src/lxml/xpath.pxi":441
 * 
 *     def __dealloc__(self):
 *         if self._xpath is not NULL:             # <<<<<<<<<<<<<<
 *             xpath.xmlXPathFreeCompExpr(self._xpath)
 * 
*/
  __pyx_t_1 = (__pyx_v_self->_xpath != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/xpath.pxi":442
 *     def __dealloc__(self):
 *         if self._xpath is not NULL:
 *             xpath.xmlXPathFreeCompExpr(self._xpath)             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
*/
    xmlXPathFreeCompExpr(__pyx_v_self->_xpath);

    /* "src/lxml/xpath.pxi":441
 * 
 *     def __dealloc__(self):
 *         if self._xpath is not NULL:             # <<<<<<<<<<<<<<
 *             xpath.xmlXPathFreeCompExpr(self._xpath)
 * 
*/
  }

  /* "src/lxml/xpath.pxi":440
 *         return self._path.decode('UTF-8')
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._xpath is not NULL:
 *             xpath.xmlXPathFreeCompExpr(self._xpath)
*/

  /* function exit code */
}

/* "src/lxml/xpath.pxi":444
 *             xpath.xmlXPathFreeCompExpr(self._xpath)
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return self.path
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_5XPath_9__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_5XPath_9__repr__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_5XPath_8__repr__(((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_5XPath_8__repr__(struct __pyx_obj_4lxml_5etree_XPath *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "src/lxml/xpath.pxi":445
 * 
 *     def __repr__(self):
 *         return self.path             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_path); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 445, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/xpath.pxi":444
 *             xpath.xmlXPathFreeCompExpr(self._xpath)
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return self.path
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.XPath.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xpath.pxi":460
 *     you pass ``smart_strings=False``.
 *     """
 *     def __init__(self, path, *, extensions=None, regexp=True,             # <<<<<<<<<<<<<<
 *                  smart_strings=True):
 *         path, namespaces = self._nsextract_path(path)
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_7ETXPath_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_7ETXPath_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_path = 0;
  PyObject *__pyx_v_extensions = 0;
  PyObject *__pyx_v_regexp = 0;
  PyObject *__pyx_v_smart_strings = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[4] = {0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_path,&__pyx_mstate_global->__pyx_n_u_extensions,&__pyx_mstate_global->__pyx_n_u_regexp,&__pyx_mstate_global->__pyx_n_u_smart_strings,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(19, 460, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(19, 460, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(19, 460, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_True));

      /* "src/lxml/xpath.pxi":461
 *     """
 *     def __init__(self, path, *, extensions=None, regexp=True,
 *                  smart_strings=True):             # <<<<<<<<<<<<<<
 *         path, namespaces = self._nsextract_path(path)
 *         XPath.__init__(self, path, namespaces=namespaces,
*/
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_True));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, i); __PYX_ERR(19, 460, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(19, 460, __pyx_L3_error)

      /* "src/lxml/xpath.pxi":460
 *     you pass ``smart_strings=False``.
 *     """
 *     def __init__(self, path, *, extensions=None, regexp=True,             # <<<<<<<<<<<<<<
 *                  smart_strings=True):
 *         path, namespaces = self._nsextract_path(path)
*/
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_True));

      /* "src/lxml/xpath.pxi":461
 *     """
 *     def __init__(self, path, *, extensions=None, regexp=True,
 *                  smart_strings=True):             # <<<<<<<<<<<<<<
 *         path, namespaces = self._nsextract_path(path)
 *         XPath.__init__(self, path, namespaces=namespaces,
*/
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_True));
    }
    __pyx_v_path = values[0];
    __pyx_v_extensions = values[1];
    __pyx_v_regexp = values[2];
    __pyx_v_smart_strings = values[3];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, __pyx_nargs); __PYX_ERR(19, 460, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.ETXPath.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_7ETXPath___init__(((struct __pyx_obj_4lxml_5etree_ETXPath *)__pyx_v_self), __pyx_v_path, __pyx_v_extensions, __pyx_v_regexp, __pyx_v_smart_strings);

  /* "src/lxml/xpath.pxi":460
 *     you pass ``smart_strings=False``.
 *     """
 *     def __init__(self, path, *, extensions=None, regexp=True,             # <<<<<<<<<<<<<<
 *                  smart_strings=True):
 *         path, namespaces = self._nsextract_path(path)
*/

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_7ETXPath___init__(struct __pyx_obj_4lxml_5etree_ETXPath *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_extensions, PyObject *__pyx_v_regexp, PyObject *__pyx_v_smart_strings) {
  PyObject *__pyx_v_namespaces = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  size_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_INCREF(__pyx_v_path);

  /* "src/lxml/xpath.pxi":462
 *     def __init__(self, path, *, extensions=None, regexp=True,
 *                  smart_strings=True):
 *         path, namespaces = self._nsextract_path(path)             # <<<<<<<<<<<<<<
 *         XPath.__init__(self, path, namespaces=namespaces,
 *                        extensions=extensions, regexp=regexp,
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree_ETXPath *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->_nsextract_path(__pyx_v_self, __pyx_v_path); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 462, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(19, 462, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
      __Pyx_INCREF(__pyx_t_3);
    } else {
      __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
      if (unlikely(!__pyx_t_2)) __PYX_ERR(19, 462, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
      if (unlikely(!__pyx_t_3)) __PYX_ERR(19, 462, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_3);
    }
    #else
    __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(19, 462, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(19, 462, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(19, 462, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4);
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < (0)) __PYX_ERR(19, 462, __pyx_L1_error)
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(19, 462, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __Pyx_DECREF_SET(__pyx_v_path, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_v_namespaces = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "src/lxml/xpath.pxi":463
 *                  smart_strings=True):
 *         path, namespaces = self._nsextract_path(path)
 *         XPath.__init__(self, path, namespaces=namespaces,             # <<<<<<<<<<<<<<
 *                        extensions=extensions, regexp=regexp,
 *                        smart_strings=smart_strings)
*/
  __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XPath);
  __Pyx_INCREF(__pyx_t_3);

  /* "src/lxml/xpath.pxi":465
 *         XPath.__init__(self, path, namespaces=namespaces,
 *                        extensions=extensions, regexp=regexp,
 *                        smart_strings=smart_strings)             # <<<<<<<<<<<<<<
 * 
 *     cdef _nsextract_path(self, path):
*/
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[3 + ((CYTHON_VECTORCALL) ? 4 : 0)] = {__pyx_t_3, ((PyObject *)__pyx_v_self), __pyx_v_path};
    __pyx_t_2 = __Pyx_MakeVectorcallBuilderKwds(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(19, 463, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_namespaces, __pyx_v_namespaces, __pyx_t_2, __pyx_callargs+3, 0) < (0)) __PYX_ERR(19, 463, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_extensions, __pyx_v_extensions, __pyx_t_2, __pyx_callargs+3, 1) < (0)) __PYX_ERR(19, 463, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_regexp, __pyx_v_regexp, __pyx_t_2, __pyx_callargs+3, 2) < (0)) __PYX_ERR(19, 463, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_smart_strings, __pyx_v_smart_strings, __pyx_t_2, __pyx_callargs+3, 3) < (0)) __PYX_ERR(19, 463, __pyx_L1_error)
    __pyx_t_1 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_init, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_2);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 463, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xpath.pxi":460
 *     you pass ``smart_strings=False``.
 *     """
 *     def __init__(self, path, *, extensions=None, regexp=True,             # <<<<<<<<<<<<<<
 *                  smart_strings=True):
 *         path, namespaces = self._nsextract_path(path)
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.ETXPath.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_namespaces);
  __Pyx_XDECREF(__pyx_v_path);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xpath.pxi":467
 *                        smart_strings=smart_strings)
 * 
 *     cdef _nsextract_path(self, path):             # <<<<<<<<<<<<<<
 *         # replace {namespaces} by new prefixes
 *         cdef dict namespaces = {}
*/

static PyObject *__pyx_f_4lxml_5etree_7ETXPath__nsextract_path(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree_ETXPath *__pyx_v_self, PyObject *__pyx_v_path) {
  PyObject *__pyx_v_namespaces = 0;
  PyObject *__pyx_v_namespace_defs = 0;
  int __pyx_v_i;
  PyObject *__pyx_v_path_utf = NULL;
  PyObject *__pyx_v_stripped_path = NULL;
  PyObject *__pyx_v_namespace_def = NULL;
  PyObject *__pyx_v_prefix = NULL;
  PyObject *__pyx_v_namespace = NULL;
  PyObject *__pyx_v_prefix_str = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  PyObject *(*__pyx_t_6)(PyObject *);
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_nsextract_path", 0);
  __Pyx_INCREF(__pyx_v_path);

  /* "src/lxml/xpath.pxi":469
 *     cdef _nsextract_path(self, path):
 *         # replace {namespaces} by new prefixes
 *         cdef dict namespaces = {}             # <<<<<<<<<<<<<<
 *         cdef list namespace_defs = []
 *         cdef int i
*/
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 469, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_namespaces = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xpath.pxi":470
 *         # replace {namespaces} by new prefixes
 *         cdef dict namespaces = {}
 *         cdef list namespace_defs = []             # <<<<<<<<<<<<<<
 *         cdef int i
 *         path_utf = _utf8(path)
*/
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_namespace_defs = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xpath.pxi":472
 *         cdef list namespace_defs = []
 *         cdef int i
 *         path_utf = _utf8(path)             # <<<<<<<<<<<<<<
 *         stripped_path = _replace_strings(b'', path_utf) # remove string literals
 *         i = 1
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__utf8(__pyx_v_path); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 472, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_path_utf = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xpath.pxi":473
 *         cdef int i
 *         path_utf = _utf8(path)
 *         stripped_path = _replace_strings(b'', path_utf) # remove string literals             # <<<<<<<<<<<<<<
 *         i = 1
 *         for namespace_def in _find_namespaces(stripped_path):
*/
  __pyx_t_2 = NULL;
  __Pyx_INCREF(__pyx_v_4lxml_5etree__replace_strings);
  __pyx_t_3 = __pyx_v_4lxml_5etree__replace_strings; 
  __pyx_t_4 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_4 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_b__8, __pyx_v_path_utf};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 473, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v_stripped_path = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "src/lxml/xpath.pxi":474
 *         path_utf = _utf8(path)
 *         stripped_path = _replace_strings(b'', path_utf) # remove string literals
 *         i = 1             # <<<<<<<<<<<<<<
 *         for namespace_def in _find_namespaces(stripped_path):
 *             if namespace_def not in namespace_defs:
*/
  __pyx_v_i = 1;

  /* "src/lxml/xpath.pxi":475
 *         stripped_path = _replace_strings(b'', path_utf) # remove string literals
 *         i = 1
 *         for namespace_def in _find_namespaces(stripped_path):             # <<<<<<<<<<<<<<
 *             if namespace_def not in namespace_defs:
 *                 prefix = python.PyBytes_FromFormat("__xpp%02d", i)
*/
  __pyx_t_3 = NULL;
  __Pyx_INCREF(__pyx_v_4lxml_5etree__find_namespaces);
  __pyx_t_2 = __pyx_v_4lxml_5etree__find_namespaces; 
  __pyx_t_4 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    assert(__pyx_t_3);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
    __pyx_t_4 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_stripped_path};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 475, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2);
    __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
  } else {
    __pyx_t_5 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(19, 475, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(19, 475, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_6)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(19, 475, __pyx_L1_error)
          #endif
          if (__pyx_t_5 >= __pyx_temp) break;
        }
        __pyx_t_1 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_5, __Pyx_ReferenceSharing_OwnStrongReference);
        ++__pyx_t_5;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(19, 475, __pyx_L1_error)
          #endif
          if (__pyx_t_5 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5));
        #else
        __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_5);
        #endif
        ++__pyx_t_5;
      }
      if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 475, __pyx_L1_error)
    } else {
      __pyx_t_1 = __pyx_t_6(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(19, 475, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_XDECREF_SET(__pyx_v_namespace_def, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/xpath.pxi":476
 *         i = 1
 *         for namespace_def in _find_namespaces(stripped_path):
 *             if namespace_def not in namespace_defs:             # <<<<<<<<<<<<<<
 *                 prefix = python.PyBytes_FromFormat("__xpp%02d", i)
 *                 i += 1
*/
    __pyx_t_7 = (__Pyx_PySequence_ContainsTF(__pyx_v_namespace_def, __pyx_v_namespace_defs, Py_NE)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(19, 476, __pyx_L1_error)
    if (__pyx_t_7) {

      /* "src/lxml/xpath.pxi":477
 *         for namespace_def in _find_namespaces(stripped_path):
 *             if namespace_def not in namespace_defs:
 *                 prefix = python.PyBytes_FromFormat("__xpp%02d", i)             # <<<<<<<<<<<<<<
 *                 i += 1
 *                 namespace_defs.append(namespace_def)
*/
      __pyx_t_1 = PyBytes_FromFormat(((char *)"__xpp%02d"), __pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 477, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_XDECREF_SET(__pyx_v_prefix, ((PyObject*)__pyx_t_1));
      __pyx_t_1 = 0;

      /* "src/lxml/xpath.pxi":478
 *             if namespace_def not in namespace_defs:
 *                 prefix = python.PyBytes_FromFormat("__xpp%02d", i)
 *                 i += 1             # <<<<<<<<<<<<<<
 *                 namespace_defs.append(namespace_def)
 *                 namespace = namespace_def[1:-1] # remove '{}'
*/
      __pyx_v_i = (__pyx_v_i + 1);

      /* "src/lxml/xpath.pxi":479
 *                 prefix = python.PyBytes_FromFormat("__xpp%02d", i)
 *                 i += 1
 *                 namespace_defs.append(namespace_def)             # <<<<<<<<<<<<<<
 *                 namespace = namespace_def[1:-1] # remove '{}'
 *                 namespace = (<bytes>namespace).decode('utf8')
*/
      __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_namespace_defs, __pyx_v_namespace_def); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(19, 479, __pyx_L1_error)

      /* "src/lxml/xpath.pxi":480
 *                 i += 1
 *                 namespace_defs.append(namespace_def)
 *                 namespace = namespace_def[1:-1] # remove '{}'             # <<<<<<<<<<<<<<
 *                 namespace = (<bytes>namespace).decode('utf8')
 *                 namespaces[prefix.decode('utf8')] = namespace
*/
      __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_namespace_def, 1, -1L, NULL, NULL, &__pyx_mstate_global->__pyx_slice[10], 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 480, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_XDECREF_SET(__pyx_v_namespace, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "src/lxml/xpath.pxi":481
 *                 namespace_defs.append(namespace_def)
 *                 namespace = namespace_def[1:-1] # remove '{}'
 *                 namespace = (<bytes>namespace).decode('utf8')             # <<<<<<<<<<<<<<
 *                 namespaces[prefix.decode('utf8')] = namespace
 *                 prefix_str = prefix + b':'
*/
      if (unlikely(__pyx_v_namespace == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "decode");
        __PYX_ERR(19, 481, __pyx_L1_error)
      }
      __pyx_t_1 = __Pyx_decode_bytes(((PyObject*)__pyx_v_namespace), 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 481, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF_SET(__pyx_v_namespace, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "src/lxml/xpath.pxi":482
 *                 namespace = namespace_def[1:-1] # remove '{}'
 *                 namespace = (<bytes>namespace).decode('utf8')
 *                 namespaces[prefix.decode('utf8')] = namespace             # <<<<<<<<<<<<<<
 *                 prefix_str = prefix + b':'
 *                 # FIXME: this also replaces {namespaces} within strings!
*/
      if (unlikely(__pyx_v_prefix == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "decode");
        __PYX_ERR(19, 482, __pyx_L1_error)
      }
      __pyx_t_1 = __Pyx_decode_bytes(__pyx_v_prefix, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 482, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (unlikely((PyDict_SetItem(__pyx_v_namespaces, __pyx_t_1, __pyx_v_namespace) < 0))) __PYX_ERR(19, 482, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "src/lxml/xpath.pxi":483
 *                 namespace = (<bytes>namespace).decode('utf8')
 *                 namespaces[prefix.decode('utf8')] = namespace
 *                 prefix_str = prefix + b':'             # <<<<<<<<<<<<<<
 *                 # FIXME: this also replaces {namespaces} within strings!
 *                 path_utf = path_utf.replace(namespace_def, prefix_str)
*/
      __pyx_t_1 = PyNumber_Add(__pyx_v_prefix, __pyx_mstate_global->__pyx_kp_b__9); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 483, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_XDECREF_SET(__pyx_v_prefix_str, ((PyObject*)__pyx_t_1));
      __pyx_t_1 = 0;

      /* "src/lxml/xpath.pxi":485
 *                 prefix_str = prefix + b':'
 *                 # FIXME: this also replaces {namespaces} within strings!
 *                 path_utf = path_utf.replace(namespace_def, prefix_str)             # <<<<<<<<<<<<<<
 *         path = path_utf.decode('utf8')
 *         return path, namespaces
*/
      __pyx_t_1 = __Pyx_CallUnboundCMethod2(&__pyx_mstate_global->__pyx_umethod_PyBytes_Type__replace, __pyx_v_path_utf, __pyx_v_namespace_def, __pyx_v_prefix_str); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 485, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF_SET(__pyx_v_path_utf, ((PyObject*)__pyx_t_1));
      __pyx_t_1 = 0;

      /* "src/lxml/xpath.pxi":476
 *         i = 1
 *         for namespace_def in _find_namespaces(stripped_path):
 *             if namespace_def not in namespace_defs:             # <<<<<<<<<<<<<<
 *                 prefix = python.PyBytes_FromFormat("__xpp%02d", i)
 *                 i += 1
*/
    }

    /* "src/lxml/xpath.pxi":475
 *         stripped_path = _replace_strings(b'', path_utf) # remove string literals
 *         i = 1
 *         for namespace_def in _find_namespaces(stripped_path):             # <<<<<<<<<<<<<<
 *             if namespace_def not in namespace_defs:
 *                 prefix = python.PyBytes_FromFormat("__xpp%02d", i)
*/
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/xpath.pxi":486
 *                 # FIXME: this also replaces {namespaces} within strings!
 *                 path_utf = path_utf.replace(namespace_def, prefix_str)
 *         path = path_utf.decode('utf8')             # <<<<<<<<<<<<<<
 *         return path, namespaces
*/
  if (unlikely(__pyx_v_path_utf == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "decode");
    __PYX_ERR(19, 486, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_decode_bytes(__pyx_v_path_utf, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) __PYX_ERR(19, 486, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_path, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/xpath.pxi":487
 *                 path_utf = path_utf.replace(namespace_def, prefix_str)
 *         path = path_utf.decode('utf8')
 *         return path, namespaces             # <<<<<<<<<<<<<<
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(19, 487, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_path);
  __Pyx_GIVEREF(__pyx_v_path);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_path) != (0)) __PYX_ERR(19, 487, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_namespaces);
  __Pyx_GIVEREF(__pyx_v_namespaces);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_namespaces) != (0)) __PYX_ERR(19, 487, __pyx_L1_error);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/xpath.pxi":467
 *                        smart_strings=smart_strings)
 * 
 *     cdef _nsextract_path(self, path):             # <<<<<<<<<<<<<<
 *         # replace {namespaces} by new prefixes
 *         cdef dict namespaces = {}
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.ETXPath._nsextract_path", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_namespaces);
  __Pyx_XDECREF(__pyx_v_namespace_defs);
  __Pyx_XDECREF(__pyx_v_path_utf);
  __Pyx_XDECREF(__pyx_v_stripped_path);
  __Pyx_XDECREF(__pyx_v_namespace_def);
  __Pyx_XDECREF(__pyx_v_prefix);
  __Pyx_XDECREF(__pyx_v_namespace);
  __Pyx_XDECREF(__pyx_v_prefix_str);
  __Pyx_XDECREF(__pyx_v_path);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xslt.pxi":52
 *     cdef _BaseParser _parser
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef _XSLTResolverContext _copy(self):
 *         cdef _XSLTResolverContext context
*/

static struct __pyx_obj_4lxml_5etree__XSLTResolverContext *__pyx_f_4lxml_5etree_20_XSLTResolverContext__copy(struct __pyx_obj_4lxml_5etree__XSLTResolverContext *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree__XSLTResolverContext *__pyx_v_context = 0;
  struct __pyx_obj_4lxml_5etree__XSLTResolverContext *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  xmlDoc *__pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_copy", 0);

  /* "src/lxml/xslt.pxi":55
 *     cdef _XSLTResolverContext _copy(self):
 *         cdef _XSLTResolverContext context
 *         context = _XSLTResolverContext()             # <<<<<<<<<<<<<<
 *         _initXSLTResolverContext(context, self._parser)
 *         context._c_style_doc = self._c_style_doc
*/
  __pyx_t_2 = NULL;
  __pyx_t_3 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__XSLTResolverContext, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 55, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__XSLTResolverContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xslt.pxi":56
 *         cdef _XSLTResolverContext context
 *         context = _XSLTResolverContext()
 *         _initXSLTResolverContext(context, self._parser)             # <<<<<<<<<<<<<<
 *         context._c_style_doc = self._c_style_doc
 *         return context
*/
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_parser);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__initXSLTResolverContext(__pyx_v_context, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 56, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/xslt.pxi":57
 *         context = _XSLTResolverContext()
 *         _initXSLTResolverContext(context, self._parser)
 *         context._c_style_doc = self._c_style_doc             # <<<<<<<<<<<<<<
 *         return context
 * 
*/
  __pyx_t_4 = __pyx_v_self->_c_style_doc;
  __pyx_v_context->_c_style_doc = __pyx_t_4;

  /* "src/lxml/xslt.pxi":58
 *         _initXSLTResolverContext(context, self._parser)
 *         context._c_style_doc = self._c_style_doc
 *         return context             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_context);
  __pyx_r = __pyx_v_context;
  goto __pyx_L0;

  /* "src/lxml/xslt.pxi":52
 *     cdef _BaseParser _parser
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef _XSLTResolverContext _copy(self):
 *         cdef _XSLTResolverContext context
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._XSLTResolverContext._copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xslt.pxi":61
 * 
 * 
 * cdef _initXSLTResolverContext(_XSLTResolverContext context,             # <<<<<<<<<<<<<<
 *                               _BaseParser parser):
 *     _initResolverContext(context, parser.resolvers)
*/

static PyObject *__pyx_f_4lxml_5etree__initXSLTResolverContext(struct __pyx_obj_4lxml_5etree__XSLTResolverContext *__pyx_v_context, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_initXSLTResolverContext", 0);

  /* "src/lxml/xslt.pxi":63
 * cdef _initXSLTResolverContext(_XSLTResolverContext context,
 *                               _BaseParser parser):
 *     _initResolverContext(context, parser.resolvers)             # <<<<<<<<<<<<<<
 *     context._parser = parser
 *     context._c_style_doc = NULL
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_parser), __pyx_mstate_global->__pyx_n_u_resolvers); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 63, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ResolverRegistry))))) __PYX_ERR(3, 63, __pyx_L1_error)
  __pyx_t_2 = __pyx_f_4lxml_5etree__initResolverContext(((struct __pyx_obj_4lxml_5etree__ResolverContext *)__pyx_v_context), ((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 63, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/xslt.pxi":64
 *                               _BaseParser parser):
 *     _initResolverContext(context, parser.resolvers)
 *     context._parser = parser             # <<<<<<<<<<<<<<
 *     context._c_style_doc = NULL
 * 
*/
  __Pyx_INCREF((PyObject *)__pyx_v_parser);
  __Pyx_GIVEREF((PyObject *)__pyx_v_parser);
  __Pyx_GOTREF((PyObject *)__pyx_v_context->_parser);
  __Pyx_DECREF((PyObject *)__pyx_v_context->_parser);
  __pyx_v_context->_parser = __pyx_v_parser;

  /* "src/lxml/xslt.pxi":65
 *     _initResolverContext(context, parser.resolvers)
 *     context._parser = parser
 *     context._c_style_doc = NULL             # <<<<<<<<<<<<<<
 * 
 * cdef xmlDoc* _xslt_resolve_from_python(const_xmlChar* c_uri, void* c_context,
*/
  __pyx_v_context->_c_style_doc = NULL;

  /* "src/lxml/xslt.pxi":61
 * 
 * 
 * cdef _initXSLTResolverContext(_XSLTResolverContext context,             # <<<<<<<<<<<<<<
 *                               _BaseParser parser):
 *     _initResolverContext(context, parser.resolvers)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._initXSLTResolverContext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xslt.pxi":67
 *     context._c_style_doc = NULL
 * 
 * cdef xmlDoc* _xslt_resolve_from_python(const_xmlChar* c_uri, void* c_context,             # <<<<<<<<<<<<<<
 *                                        int parse_options, int* error) noexcept with gil:
 *     # call the Python document loaders
*/

static xmlDoc *__pyx_f_4lxml_5etree__xslt_resolve_from_python(const xmlChar *__pyx_v_c_uri, void *__pyx_v_c_context, CYTHON_UNUSED int __pyx_v_parse_options, int *__pyx_v_error) {
  struct __pyx_obj_4lxml_5etree__XSLTResolverContext *__pyx_v_context = 0;
  struct __pyx_obj_4lxml_5etree__ResolverRegistry *__pyx_v_resolvers = 0;
  struct __pyx_obj_4lxml_5etree__InputDocument *__pyx_v_doc_ref = 0;
  xmlDoc *__pyx_v_c_doc;
  xmlDoc *__pyx_v_c_return_doc;
  PyObject *__pyx_v_uri = NULL;
  xmlDoc *__pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  xmlDoc *__pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  size_t __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("_xslt_resolve_from_python", 0);

  /* "src/lxml/xslt.pxi":74
 *     cdef _InputDocument doc_ref
 *     cdef xmlDoc* c_doc
 *     cdef xmlDoc* c_return_doc = NULL             # <<<<<<<<<<<<<<
 * 
 *     error[0] = 0
*/
  __pyx_v_c_return_doc = NULL;

  /* "src/lxml/xslt.pxi":76
 *     cdef xmlDoc* c_return_doc = NULL
 * 
 *     error[0] = 0             # <<<<<<<<<<<<<<
 *     context = <_XSLTResolverContext>c_context
 * 
*/
  (__pyx_v_error[0]) = 0;

  /* "src/lxml/xslt.pxi":77
 * 
 *     error[0] = 0
 *     context = <_XSLTResolverContext>c_context             # <<<<<<<<<<<<<<
 * 
 *     # shortcut if we resolve the stylesheet itself
*/
  __pyx_t_1 = ((PyObject *)__pyx_v_c_context);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__XSLTResolverContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xslt.pxi":80
 * 
 *     # shortcut if we resolve the stylesheet itself
 *     c_doc = context._c_style_doc             # <<<<<<<<<<<<<<
 *     try:
 *         if c_doc is not NULL and c_doc.URL is not NULL:
*/
  __pyx_t_2 = __pyx_v_context->_c_style_doc;
  __pyx_v_c_doc = __pyx_t_2;

  /* "src/lxml/xslt.pxi":81
 *     # shortcut if we resolve the stylesheet itself
 *     c_doc = context._c_style_doc
 *     try:             # <<<<<<<<<<<<<<
 *         if c_doc is not NULL and c_doc.URL is not NULL:
 *             if tree.xmlStrcmp(c_uri, c_doc.URL) == 0:
*/
  /*try:*/ {
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_5);
      /*try:*/ {

        /* "src/lxml/xslt.pxi":82
 *     c_doc = context._c_style_doc
 *     try:
 *         if c_doc is not NULL and c_doc.URL is not NULL:             # <<<<<<<<<<<<<<
 *             if tree.xmlStrcmp(c_uri, c_doc.URL) == 0:
 *                 c_return_doc = _copyDoc(c_doc, 1)
*/
        __pyx_t_7 = (__pyx_v_c_doc != NULL);
        if (__pyx_t_7) {
        } else {
          __pyx_t_6 = __pyx_t_7;
          goto __pyx_L13_bool_binop_done;
        }
        __pyx_t_7 = (__pyx_v_c_doc->URL != NULL);
        __pyx_t_6 = __pyx_t_7;
        __pyx_L13_bool_binop_done:;
        if (__pyx_t_6) {

          /* "src/lxml/xslt.pxi":83
 *     try:
 *         if c_doc is not NULL and c_doc.URL is not NULL:
 *             if tree.xmlStrcmp(c_uri, c_doc.URL) == 0:             # <<<<<<<<<<<<<<
 *                 c_return_doc = _copyDoc(c_doc, 1)
 *                 return c_return_doc  # 'goto', see 'finally' below
*/
          __pyx_t_6 = (xmlStrcmp(__pyx_v_c_uri, __pyx_v_c_doc->URL) == 0);
          if (__pyx_t_6) {

            /* "src/lxml/xslt.pxi":84
 *         if c_doc is not NULL and c_doc.URL is not NULL:
 *             if tree.xmlStrcmp(c_uri, c_doc.URL) == 0:
 *                 c_return_doc = _copyDoc(c_doc, 1)             # <<<<<<<<<<<<<<
 *                 return c_return_doc  # 'goto', see 'finally' below
 * 
*/
            __pyx_t_2 = __pyx_f_4lxml_5etree__copyDoc(__pyx_v_c_doc, 1); if (unlikely(__pyx_t_2 == ((void *)NULL))) __PYX_ERR(3, 84, __pyx_L6_error)
            __pyx_v_c_return_doc = __pyx_t_2;

            /* "src/lxml/xslt.pxi":85
 *             if tree.xmlStrcmp(c_uri, c_doc.URL) == 0:
 *                 c_return_doc = _copyDoc(c_doc, 1)
 *                 return c_return_doc  # 'goto', see 'finally' below             # <<<<<<<<<<<<<<
 * 
 *         # delegate to the Python resolvers
*/
            __pyx_r = __pyx_v_c_return_doc;
            goto __pyx_L10_try_return;

            /* "src/lxml/xslt.pxi":83
 *     try:
 *         if c_doc is not NULL and c_doc.URL is not NULL:
 *             if tree.xmlStrcmp(c_uri, c_doc.URL) == 0:             # <<<<<<<<<<<<<<
 *                 c_return_doc = _copyDoc(c_doc, 1)
 *                 return c_return_doc  # 'goto', see 'finally' below
*/
          }

          /* "src/lxml/xslt.pxi":82
 *     c_doc = context._c_style_doc
 *     try:
 *         if c_doc is not NULL and c_doc.URL is not NULL:             # <<<<<<<<<<<<<<
 *             if tree.xmlStrcmp(c_uri, c_doc.URL) == 0:
 *                 c_return_doc = _copyDoc(c_doc, 1)
*/
        }

        /* "src/lxml/xslt.pxi":88
 * 
 *         # delegate to the Python resolvers
 *         resolvers = context._resolvers             # <<<<<<<<<<<<<<
 *         if tree.xmlStrncmp(<unsigned char*>'string://__STRING__XSLT__/', c_uri, 26) == 0:
 *             c_uri += 26
*/
        __pyx_t_1 = ((PyObject *)__pyx_v_context->__pyx_base._resolvers);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_v_resolvers = ((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_t_1);
        __pyx_t_1 = 0;

        /* "src/lxml/xslt.pxi":89
 *         # delegate to the Python resolvers
 *         resolvers = context._resolvers
 *         if tree.xmlStrncmp(<unsigned char*>'string://__STRING__XSLT__/', c_uri, 26) == 0:             # <<<<<<<<<<<<<<
 *             c_uri += 26
 *         uri = _decodeFilename(c_uri)
*/
        __pyx_t_6 = (xmlStrncmp(((unsigned char *)((unsigned char *)((char *)"string://__STRING__XSLT__/"))), __pyx_v_c_uri, 26) == 0);
        if (__pyx_t_6) {

          /* "src/lxml/xslt.pxi":90
 *         resolvers = context._resolvers
 *         if tree.xmlStrncmp(<unsigned char*>'string://__STRING__XSLT__/', c_uri, 26) == 0:
 *             c_uri += 26             # <<<<<<<<<<<<<<
 *         uri = _decodeFilename(c_uri)
 *         doc_ref = resolvers.resolve(uri, None, context)
*/
          __pyx_v_c_uri = (__pyx_v_c_uri + 26);

          /* "src/lxml/xslt.pxi":89
 *         # delegate to the Python resolvers
 *         resolvers = context._resolvers
 *         if tree.xmlStrncmp(<unsigned char*>'string://__STRING__XSLT__/', c_uri, 26) == 0:             # <<<<<<<<<<<<<<
 *             c_uri += 26
 *         uri = _decodeFilename(c_uri)
*/
        }

        /* "src/lxml/xslt.pxi":91
 *         if tree.xmlStrncmp(<unsigned char*>'string://__STRING__XSLT__/', c_uri, 26) == 0:
 *             c_uri += 26
 *         uri = _decodeFilename(c_uri)             # <<<<<<<<<<<<<<
 *         doc_ref = resolvers.resolve(uri, None, context)
 * 
*/
        __pyx_t_1 = __pyx_f_4lxml_5etree__decodeFilename(__pyx_v_c_uri); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 91, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_v_uri = __pyx_t_1;
        __pyx_t_1 = 0;

        /* "src/lxml/xslt.pxi":92
 *             c_uri += 26
 *         uri = _decodeFilename(c_uri)
 *         doc_ref = resolvers.resolve(uri, None, context)             # <<<<<<<<<<<<<<
 * 
 *         if doc_ref is not None:
*/
        __pyx_t_8 = ((PyObject *)__pyx_v_resolvers);
        __Pyx_INCREF(__pyx_t_8);
        __pyx_t_9 = 0;
        {
          PyObject *__pyx_callargs[4] = {__pyx_t_8, __pyx_v_uri, Py_None, ((PyObject *)__pyx_v_context)};
          __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_resolve, __pyx_callargs+__pyx_t_9, (4-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 92, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_1);
        }
        if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__InputDocument))))) __PYX_ERR(3, 92, __pyx_L6_error)
        __pyx_v_doc_ref = ((struct __pyx_obj_4lxml_5etree__InputDocument *)__pyx_t_1);
        __pyx_t_1 = 0;

        /* "src/lxml/xslt.pxi":94
 *         doc_ref = resolvers.resolve(uri, None, context)
 * 
 *         if doc_ref is not None:             # <<<<<<<<<<<<<<
 *             if doc_ref._type == PARSER_DATA_STRING:
 *                 c_return_doc = _parseDoc(
*/
        __pyx_t_6 = (((PyObject *)__pyx_v_doc_ref) != Py_None);
        if (__pyx_t_6) {

          /* "src/lxml/xslt.pxi":95
 * 
 *         if doc_ref is not None:
 *             if doc_ref._type == PARSER_DATA_STRING:             # <<<<<<<<<<<<<<
 *                 c_return_doc = _parseDoc(
 *                     doc_ref._data_bytes, doc_ref._filename, context._parser)
*/
          switch (__pyx_v_doc_ref->_type) {
            case __pyx_e_4lxml_5etree_PARSER_DATA_STRING:

            /* "src/lxml/xslt.pxi":97
 *             if doc_ref._type == PARSER_DATA_STRING:
 *                 c_return_doc = _parseDoc(
 *                     doc_ref._data_bytes, doc_ref._filename, context._parser)             # <<<<<<<<<<<<<<
 *             elif doc_ref._type == PARSER_DATA_FILENAME:
 *                 c_return_doc = _parseDocFromFile(
*/
            __pyx_t_1 = __pyx_v_doc_ref->_data_bytes;
            __Pyx_INCREF(__pyx_t_1);
            __pyx_t_8 = __pyx_v_doc_ref->_filename;
            __Pyx_INCREF(__pyx_t_8);
            __pyx_t_10 = ((PyObject *)__pyx_v_context->_parser);
            __Pyx_INCREF(__pyx_t_10);

            /* "src/lxml/xslt.pxi":96
 *         if doc_ref is not None:
 *             if doc_ref._type == PARSER_DATA_STRING:
 *                 c_return_doc = _parseDoc(             # <<<<<<<<<<<<<<
 *                     doc_ref._data_bytes, doc_ref._filename, context._parser)
 *             elif doc_ref._type == PARSER_DATA_FILENAME:
*/
            __pyx_t_2 = __pyx_f_4lxml_5etree__parseDoc(__pyx_t_1, __pyx_t_8, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_10)); if (unlikely(__pyx_t_2 == ((void *)NULL))) __PYX_ERR(3, 96, __pyx_L6_error)
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
            __pyx_v_c_return_doc = __pyx_t_2;

            /* "src/lxml/xslt.pxi":95
 * 
 *         if doc_ref is not None:
 *             if doc_ref._type == PARSER_DATA_STRING:             # <<<<<<<<<<<<<<
 *                 c_return_doc = _parseDoc(
 *                     doc_ref._data_bytes, doc_ref._filename, context._parser)
*/
            break;
            case __pyx_e_4lxml_5etree_PARSER_DATA_FILENAME:

            /* "src/lxml/xslt.pxi":100
 *             elif doc_ref._type == PARSER_DATA_FILENAME:
 *                 c_return_doc = _parseDocFromFile(
 *                     doc_ref._filename, context._parser)             # <<<<<<<<<<<<<<
 *             elif doc_ref._type == PARSER_DATA_FILE:
 *                 c_return_doc = _parseDocFromFilelike(
*/
            __pyx_t_10 = __pyx_v_doc_ref->_filename;
            __Pyx_INCREF(__pyx_t_10);
            __pyx_t_8 = ((PyObject *)__pyx_v_context->_parser);
            __Pyx_INCREF(__pyx_t_8);

            /* "src/lxml/xslt.pxi":99
 *                     doc_ref._data_bytes, doc_ref._filename, context._parser)
 *             elif doc_ref._type == PARSER_DATA_FILENAME:
 *                 c_return_doc = _parseDocFromFile(             # <<<<<<<<<<<<<<
 *                     doc_ref._filename, context._parser)
 *             elif doc_ref._type == PARSER_DATA_FILE:
*/
            __pyx_t_2 = __pyx_f_4lxml_5etree__parseDocFromFile(__pyx_t_10, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_8)); if (unlikely(__pyx_t_2 == ((void *)NULL))) __PYX_ERR(3, 99, __pyx_L6_error)
            __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            __pyx_v_c_return_doc = __pyx_t_2;

            /* "src/lxml/xslt.pxi":98
 *                 c_return_doc = _parseDoc(
 *                     doc_ref._data_bytes, doc_ref._filename, context._parser)
 *             elif doc_ref._type == PARSER_DATA_FILENAME:             # <<<<<<<<<<<<<<
 *                 c_return_doc = _parseDocFromFile(
 *                     doc_ref._filename, context._parser)
*/
            break;
            case __pyx_e_4lxml_5etree_PARSER_DATA_FILE:

            /* "src/lxml/xslt.pxi":103
 *             elif doc_ref._type == PARSER_DATA_FILE:
 *                 c_return_doc = _parseDocFromFilelike(
 *                     doc_ref._file, doc_ref._filename, context._parser)             # <<<<<<<<<<<<<<
 *             elif doc_ref._type == PARSER_DATA_EMPTY:
 *                 c_return_doc = _newXMLDoc()
*/
            __pyx_t_8 = __pyx_v_doc_ref->_file;
            __Pyx_INCREF(__pyx_t_8);
            __pyx_t_10 = __pyx_v_doc_ref->_filename;
            __Pyx_INCREF(__pyx_t_10);
            __pyx_t_1 = ((PyObject *)__pyx_v_context->_parser);
            __Pyx_INCREF(__pyx_t_1);

            /* "src/lxml/xslt.pxi":102
 *                     doc_ref._filename, context._parser)
 *             elif doc_ref._type == PARSER_DATA_FILE:
 *                 c_return_doc = _parseDocFromFilelike(             # <<<<<<<<<<<<<<
 *                     doc_ref._file, doc_ref._filename, context._parser)
 *             elif doc_ref._type == PARSER_DATA_EMPTY:
*/
            __pyx_t_2 = __pyx_f_4lxml_5etree__parseDocFromFilelike(__pyx_t_8, __pyx_t_10, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_1)); if (unlikely(__pyx_t_2 == ((void *)NULL))) __PYX_ERR(3, 102, __pyx_L6_error)
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            __pyx_v_c_return_doc = __pyx_t_2;

            /* "src/lxml/xslt.pxi":101
 *                 c_return_doc = _parseDocFromFile(
 *                     doc_ref._filename, context._parser)
 *             elif doc_ref._type == PARSER_DATA_FILE:             # <<<<<<<<<<<<<<
 *                 c_return_doc = _parseDocFromFilelike(
 *                     doc_ref._file, doc_ref._filename, context._parser)
*/
            break;
            case __pyx_e_4lxml_5etree_PARSER_DATA_EMPTY:

            /* "src/lxml/xslt.pxi":105
 *                     doc_ref._file, doc_ref._filename, context._parser)
 *             elif doc_ref._type == PARSER_DATA_EMPTY:
 *                 c_return_doc = _newXMLDoc()             # <<<<<<<<<<<<<<
 *             if c_return_doc is not NULL and c_return_doc.URL is NULL:
 *                 c_return_doc.URL = tree.xmlStrdup(c_uri)
*/
            __pyx_t_2 = __pyx_f_4lxml_5etree__newXMLDoc(); if (unlikely(__pyx_t_2 == ((void *)NULL))) __PYX_ERR(3, 105, __pyx_L6_error)
            __pyx_v_c_return_doc = __pyx_t_2;

            /* "src/lxml/xslt.pxi":104
 *                 c_return_doc = _parseDocFromFilelike(
 *                     doc_ref._file, doc_ref._filename, context._parser)
 *             elif doc_ref._type == PARSER_DATA_EMPTY:             # <<<<<<<<<<<<<<
 *                 c_return_doc = _newXMLDoc()
 *             if c_return_doc is not NULL and c_return_doc.URL is NULL:
*/
            break;
            default: break;
          }

          /* "src/lxml/xslt.pxi":106
 *             elif doc_ref._type == PARSER_DATA_EMPTY:
 *                 c_return_doc = _newXMLDoc()
 *             if c_return_doc is not NULL and c_return_doc.URL is NULL:             # <<<<<<<<<<<<<<
 *                 c_return_doc.URL = tree.xmlStrdup(c_uri)
 *     except:
*/
          __pyx_t_7 = (__pyx_v_c_return_doc != NULL);
          if (__pyx_t_7) {
          } else {
            __pyx_t_6 = __pyx_t_7;
            goto __pyx_L19_bool_binop_done;
          }
          __pyx_t_7 = (__pyx_v_c_return_doc->URL == NULL);
          __pyx_t_6 = __pyx_t_7;
          __pyx_L19_bool_binop_done:;
          if (__pyx_t_6) {

            /* "src/lxml/xslt.pxi":107
 *                 c_return_doc = _newXMLDoc()
 *             if c_return_doc is not NULL and c_return_doc.URL is NULL:
 *                 c_return_doc.URL = tree.xmlStrdup(c_uri)             # <<<<<<<<<<<<<<
 *     except:
 *         error[0] = 1
*/
            __pyx_v_c_return_doc->URL = xmlStrdup(__pyx_v_c_uri);

            /* "src/lxml/xslt.pxi":106
 *             elif doc_ref._type == PARSER_DATA_EMPTY:
 *                 c_return_doc = _newXMLDoc()
 *             if c_return_doc is not NULL and c_return_doc.URL is NULL:             # <<<<<<<<<<<<<<
 *                 c_return_doc.URL = tree.xmlStrdup(c_uri)
 *     except:
*/
          }

          /* "src/lxml/xslt.pxi":94
 *         doc_ref = resolvers.resolve(uri, None, context)
 * 
 *         if doc_ref is not None:             # <<<<<<<<<<<<<<
 *             if doc_ref._type == PARSER_DATA_STRING:
 *                 c_return_doc = _parseDoc(
*/
        }

        /* "src/lxml/xslt.pxi":81
 *     # shortcut if we resolve the stylesheet itself
 *     c_doc = context._c_style_doc
 *     try:             # <<<<<<<<<<<<<<
 *         if c_doc is not NULL and c_doc.URL is not NULL:
 *             if tree.xmlStrcmp(c_uri, c_doc.URL) == 0:
*/
      }
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L11_try_end;
      __pyx_L6_error:;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "src/lxml/xslt.pxi":108
 *             if c_return_doc is not NULL and c_return_doc.URL is NULL:
 *                 c_return_doc.URL = tree.xmlStrdup(c_uri)
 *     except:             # <<<<<<<<<<<<<<
 *         error[0] = 1
 *         context._store_raised()
*/
      /*except:*/ {
        __Pyx_AddTraceback("lxml.etree._xslt_resolve_from_python", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_10, &__pyx_t_8) < 0) __PYX_ERR(3, 108, __pyx_L8_except_error)
        __Pyx_XGOTREF(__pyx_t_1);
        __Pyx_XGOTREF(__pyx_t_10);
        __Pyx_XGOTREF(__pyx_t_8);

        /* "src/lxml/xslt.pxi":109
 *                 c_return_doc.URL = tree.xmlStrdup(c_uri)
 *     except:
 *         error[0] = 1             # <<<<<<<<<<<<<<
 *         context._store_raised()
 *     finally:
*/
        (__pyx_v_error[0]) = 1;

        /* "src/lxml/xslt.pxi":110
 *     except:
 *         error[0] = 1
 *         context._store_raised()             # <<<<<<<<<<<<<<
 *     finally:
 *         return c_return_doc  # and swallow any further exceptions
*/
        __pyx_f_4lxml_5etree_17_ExceptionContext__store_raised(((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_v_context));
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L7_exception_handled;
      }

      /* "src/lxml/xslt.pxi":81
 *     # shortcut if we resolve the stylesheet itself
 *     c_doc = context._c_style_doc
 *     try:             # <<<<<<<<<<<<<<
 *         if c_doc is not NULL and c_doc.URL is not NULL:
 *             if tree.xmlStrcmp(c_uri, c_doc.URL) == 0:
*/
      __pyx_L8_except_error:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      goto __pyx_L4_error;
      __pyx_L10_try_return:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      goto __pyx_L3_return;
      __pyx_L7_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      __pyx_L11_try_end:;
    }
  }

  /* "src/lxml/xslt.pxi":112
 *         context._store_raised()
 *     finally:
 *         return c_return_doc  # and swallow any further exceptions             # <<<<<<<<<<<<<<
 * 
 * 
*/
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_r = __pyx_v_c_return_doc;
      goto __pyx_L0;
    }
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
      if ( unlikely(__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3) < 0)) __Pyx_ErrFetch(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      {
        __pyx_r = __pyx_v_c_return_doc;
        goto __pyx_L23_return;
      }
      __pyx_L23_return:;
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
      goto __pyx_L0;
    }
    __pyx_L3_return: {
      __pyx_r = __pyx_v_c_return_doc;
      goto __pyx_L0;
    }
  }

  /* "src/lxml/xslt.pxi":67
 *     context._c_style_doc = NULL
 * 
 * cdef xmlDoc* _xslt_resolve_from_python(const_xmlChar* c_uri, void* c_context,             # <<<<<<<<<<<<<<
 *                                        int parse_options, int* error) noexcept with gil:
 *     # call the Python document loaders
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_XDECREF((PyObject *)__pyx_v_resolvers);
  __Pyx_XDECREF((PyObject *)__pyx_v_doc_ref);
  __Pyx_XDECREF(__pyx_v_uri);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  return __pyx_r;
}

/* "src/lxml/xslt.pxi":115
 * 
 * 
 * cdef void _xslt_store_resolver_exception(const_xmlChar* c_uri, void* context,             # <<<<<<<<<<<<<<
 *                                          xslt.xsltLoadType c_type) noexcept with gil:
 *     try:
*/

static void __pyx_f_4lxml_5etree__xslt_store_resolver_exception(const xmlChar *__pyx_v_c_uri, void *__pyx_v_context, xsltLoadType __pyx_v_c_type) {
  PyObject *__pyx_v_message = NULL;
  struct __pyx_obj_4lxml_5etree_XSLTError *__pyx_v_exception = NULL;
  PyObject *__pyx_v_e = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  size_t __pyx_t_7;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  char const *__pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("_xslt_store_resolver_exception", 0);

  /* "src/lxml/xslt.pxi":117
 * cdef void _xslt_store_resolver_exception(const_xmlChar* c_uri, void* context,
 *                                          xslt.xsltLoadType c_type) noexcept with gil:
 *     try:             # <<<<<<<<<<<<<<
 *         message = f"Cannot resolve URI {_decodeFilename(c_uri)}"
 *         if c_type == xslt.XSLT_LOAD_DOCUMENT:
*/
  /*try:*/ {
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_1);
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_3);
      /*try:*/ {

        /* "src/lxml/xslt.pxi":118
 *                                          xslt.xsltLoadType c_type) noexcept with gil:
 *     try:
 *         message = f"Cannot resolve URI {_decodeFilename(c_uri)}"             # <<<<<<<<<<<<<<
 *         if c_type == xslt.XSLT_LOAD_DOCUMENT:
 *             exception = XSLTApplyError(message)
*/
        __pyx_t_4 = __pyx_f_4lxml_5etree__decodeFilename(__pyx_v_c_uri); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 118, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_t_4, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 118, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_Cannot_resolve_URI, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 118, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_v_message = ((PyObject*)__pyx_t_4);
        __pyx_t_4 = 0;

        /* "src/lxml/xslt.pxi":119
 *     try:
 *         message = f"Cannot resolve URI {_decodeFilename(c_uri)}"
 *         if c_type == xslt.XSLT_LOAD_DOCUMENT:             # <<<<<<<<<<<<<<
 *             exception = XSLTApplyError(message)
 *         else:
*/
        __pyx_t_6 = (__pyx_v_c_type == XSLT_LOAD_DOCUMENT);
        if (__pyx_t_6) {

          /* "src/lxml/xslt.pxi":120
 *         message = f"Cannot resolve URI {_decodeFilename(c_uri)}"
 *         if c_type == xslt.XSLT_LOAD_DOCUMENT:
 *             exception = XSLTApplyError(message)             # <<<<<<<<<<<<<<
 *         else:
 *             exception = XSLTParseError(message)
*/
          __pyx_t_5 = NULL;
          __pyx_t_7 = 1;
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_message};
            __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XSLTApplyError, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
            if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 120, __pyx_L6_error)
            __Pyx_GOTREF((PyObject *)__pyx_t_4);
          }
          __pyx_v_exception = ((struct __pyx_obj_4lxml_5etree_XSLTError *)__pyx_t_4);
          __pyx_t_4 = 0;

          /* "src/lxml/xslt.pxi":119
 *     try:
 *         message = f"Cannot resolve URI {_decodeFilename(c_uri)}"
 *         if c_type == xslt.XSLT_LOAD_DOCUMENT:             # <<<<<<<<<<<<<<
 *             exception = XSLTApplyError(message)
 *         else:
*/
          goto __pyx_L12;
        }

        /* "src/lxml/xslt.pxi":122
 *             exception = XSLTApplyError(message)
 *         else:
 *             exception = XSLTParseError(message)             # <<<<<<<<<<<<<<
 *         (<_XSLTResolverContext>context)._store_exception(exception)
 *     except BaseException as e:
*/
        /*else*/ {
          __pyx_t_5 = NULL;
          __pyx_t_7 = 1;
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_message};
            __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XSLTParseError, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
            if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 122, __pyx_L6_error)
            __Pyx_GOTREF((PyObject *)__pyx_t_4);
          }
          __pyx_v_exception = ((struct __pyx_obj_4lxml_5etree_XSLTError *)__pyx_t_4);
          __pyx_t_4 = 0;
        }
        __pyx_L12:;

        /* "src/lxml/xslt.pxi":123
 *         else:
 *             exception = XSLTParseError(message)
 *         (<_XSLTResolverContext>context)._store_exception(exception)             # <<<<<<<<<<<<<<
 *     except BaseException as e:
 *         (<_XSLTResolverContext>context)._store_exception(e)
*/
        __pyx_t_8 = __pyx_f_4lxml_5etree_17_ExceptionContext__store_exception(((struct __pyx_obj_4lxml_5etree__ExceptionContext *)((struct __pyx_obj_4lxml_5etree__XSLTResolverContext *)__pyx_v_context)), ((PyObject *)__pyx_v_exception)); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(3, 123, __pyx_L6_error)

        /* "src/lxml/xslt.pxi":117
 * cdef void _xslt_store_resolver_exception(const_xmlChar* c_uri, void* context,
 *                                          xslt.xsltLoadType c_type) noexcept with gil:
 *     try:             # <<<<<<<<<<<<<<
 *         message = f"Cannot resolve URI {_decodeFilename(c_uri)}"
 *         if c_type == xslt.XSLT_LOAD_DOCUMENT:
*/
      }
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L11_try_end;
      __pyx_L6_error:;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "src/lxml/xslt.pxi":124
 *             exception = XSLTParseError(message)
 *         (<_XSLTResolverContext>context)._store_exception(exception)
 *     except BaseException as e:             # <<<<<<<<<<<<<<
 *         (<_XSLTResolverContext>context)._store_exception(e)
 *     finally:
*/
      __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_BaseException))));
      if (__pyx_t_8) {
        __Pyx_AddTraceback("lxml.etree._xslt_store_resolver_exception", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_5, &__pyx_t_9) < 0) __PYX_ERR(3, 124, __pyx_L8_except_error)
        __Pyx_XGOTREF(__pyx_t_4);
        __Pyx_XGOTREF(__pyx_t_5);
        __Pyx_XGOTREF(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_5);
        __pyx_v_e = __pyx_t_5;
        /*try:*/ {

          /* "src/lxml/xslt.pxi":125
 *         (<_XSLTResolverContext>context)._store_exception(exception)
 *     except BaseException as e:
 *         (<_XSLTResolverContext>context)._store_exception(e)             # <<<<<<<<<<<<<<
 *     finally:
 *         return  # and swallow any further exceptions
*/
          __pyx_t_8 = __pyx_f_4lxml_5etree_17_ExceptionContext__store_exception(((struct __pyx_obj_4lxml_5etree__ExceptionContext *)((struct __pyx_obj_4lxml_5etree__XSLTResolverContext *)__pyx_v_context)), __pyx_v_e); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(3, 125, __pyx_L18_error)
        }

        /* "src/lxml/xslt.pxi":124
 *             exception = XSLTParseError(message)
 *         (<_XSLTResolverContext>context)._store_exception(exception)
 *     except BaseException as e:             # <<<<<<<<<<<<<<
 *         (<_XSLTResolverContext>context)._store_exception(e)
 *     finally:
*/
        /*finally:*/ {
          /*normal exit:*/{
            __Pyx_DECREF(__pyx_v_e); __pyx_v_e = 0;
            goto __pyx_L19;
          }
          __pyx_L18_error:;
          /*exception exit:*/{
            __Pyx_PyThreadState_declare
            __Pyx_PyThreadState_assign
            __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0;
             __Pyx_ExceptionSwap(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17);
            if ( unlikely(__Pyx_GetException(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14) < 0)) __Pyx_ErrFetch(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
            __Pyx_XGOTREF(__pyx_t_12);
            __Pyx_XGOTREF(__pyx_t_13);
            __Pyx_XGOTREF(__pyx_t_14);
            __Pyx_XGOTREF(__pyx_t_15);
            __Pyx_XGOTREF(__pyx_t_16);
            __Pyx_XGOTREF(__pyx_t_17);
            __pyx_t_8 = __pyx_lineno; __pyx_t_10 = __pyx_clineno; __pyx_t_11 = __pyx_filename;
            {
              __Pyx_DECREF(__pyx_v_e); __pyx_v_e = 0;
            }
            __Pyx_XGIVEREF(__pyx_t_15);
            __Pyx_XGIVEREF(__pyx_t_16);
            __Pyx_XGIVEREF(__pyx_t_17);
            __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17);
            __Pyx_XGIVEREF(__pyx_t_12);
            __Pyx_XGIVEREF(__pyx_t_13);
            __Pyx_XGIVEREF(__pyx_t_14);
            __Pyx_ErrRestore(__pyx_t_12, __pyx_t_13, __pyx_t_14);
            __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0;
            __pyx_lineno = __pyx_t_8; __pyx_clineno = __pyx_t_10; __pyx_filename = __pyx_t_11;
            goto __pyx_L8_except_error;
          }
          __pyx_L19:;
        }
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L7_exception_handled;
      }
      goto __pyx_L8_except_error;

      /* "src/lxml/xslt.pxi":117
 * cdef void _xslt_store_resolver_exception(const_xmlChar* c_uri, void* context,
 *                                          xslt.xsltLoadType c_type) noexcept with gil:
 *     try:             # <<<<<<<<<<<<<<
 *         message = f"Cannot resolve URI {_decodeFilename(c_uri)}"
 *         if c_type == xslt.XSLT_LOAD_DOCUMENT:
*/
      __pyx_L8_except_error:;
      __Pyx_XGIVEREF(__pyx_t_1);
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
      goto __pyx_L4_error;
      __pyx_L7_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_1);
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
      __pyx_L11_try_end:;
    }
  }

  /* "src/lxml/xslt.pxi":127
 *         (<_XSLTResolverContext>context)._store_exception(e)
 *     finally:
 *         return  # and swallow any further exceptions             # <<<<<<<<<<<<<<
 * 
 * 
*/
  /*finally:*/ {
    /*normal exit:*/{
      goto __pyx_L0;
    }
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_1 = 0; __pyx_t_17 = 0; __pyx_t_16 = 0; __pyx_t_15 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_17, &__pyx_t_16, &__pyx_t_15);
      if ( unlikely(__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1) < 0)) __Pyx_ErrFetch(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_1);
      __Pyx_XGOTREF(__pyx_t_17);
      __Pyx_XGOTREF(__pyx_t_16);
      __Pyx_XGOTREF(__pyx_t_15);
      {
        goto __pyx_L24_return;
      }
      __pyx_L24_return:;
      __Pyx_XGIVEREF(__pyx_t_17);
      __Pyx_XGIVEREF(__pyx_t_16);
      __Pyx_XGIVEREF(__pyx_t_15);
      __Pyx_ExceptionReset(__pyx_t_17, __pyx_t_16, __pyx_t_15);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_17 = 0; __pyx_t_16 = 0; __pyx_t_15 = 0;
      goto __pyx_L0;
    }
  }

  /* "src/lxml/xslt.pxi":115
 * 
 * 
 * cdef void _xslt_store_resolver_exception(const_xmlChar* c_uri, void* context,             # <<<<<<<<<<<<<<
 *                                          xslt.xsltLoadType c_type) noexcept with gil:
 *     try:
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_message);
  __Pyx_XDECREF((PyObject *)__pyx_v_exception);
  __Pyx_XDECREF(__pyx_v_e);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
}

/* "src/lxml/xslt.pxi":130
 * 
 * 
 * cdef xmlDoc* _xslt_doc_loader(const_xmlChar* c_uri, tree.xmlDict* c_dict,             # <<<<<<<<<<<<<<
 *                               int parse_options, void* c_ctxt,
 *                               xslt.xsltLoadType c_type) noexcept nogil:
*/

static xmlDoc *__pyx_f_4lxml_5etree__xslt_doc_loader(const xmlChar *__pyx_v_c_uri, xmlDict *__pyx_v_c_dict, int __pyx_v_parse_options, void *__pyx_v_c_ctxt, xsltLoadType __pyx_v_c_type) {
  xmlDoc *__pyx_v_c_doc;
  void *__pyx_v_c_pcontext;
  int __pyx_v_error;
  xmlDoc *__pyx_r;
  void *__pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;

  /* "src/lxml/xslt.pxi":137
 *     cdef xmlDoc* result
 *     cdef void* c_pcontext
 *     cdef int error = 0             # <<<<<<<<<<<<<<
 *     # find resolver contexts of stylesheet and transformed doc
 *     if c_type == xslt.XSLT_LOAD_DOCUMENT:
*/
  __pyx_v_error = 0;

  /* "src/lxml/xslt.pxi":139
 *     cdef int error = 0
 *     # find resolver contexts of stylesheet and transformed doc
 *     if c_type == xslt.XSLT_LOAD_DOCUMENT:             # <<<<<<<<<<<<<<
 *         # transformation time
 *         c_pcontext = (<xslt.xsltTransformContext*>c_ctxt)._private
*/
  switch (__pyx_v_c_type) {
    case XSLT_LOAD_DOCUMENT:

    /* "src/lxml/xslt.pxi":141
 *     if c_type == xslt.XSLT_LOAD_DOCUMENT:
 *         # transformation time
 *         c_pcontext = (<xslt.xsltTransformContext*>c_ctxt)._private             # <<<<<<<<<<<<<<
 *     elif c_type == xslt.XSLT_LOAD_STYLESHEET:
 *         # include/import resolution while parsing
*/
    __pyx_t_1 = ((xsltTransformContext *)__pyx_v_c_ctxt)->_private;
    __pyx_v_c_pcontext = __pyx_t_1;

    /* "src/lxml/xslt.pxi":139
 *     cdef int error = 0
 *     # find resolver contexts of stylesheet and transformed doc
 *     if c_type == xslt.XSLT_LOAD_DOCUMENT:             # <<<<<<<<<<<<<<
 *         # transformation time
 *         c_pcontext = (<xslt.xsltTransformContext*>c_ctxt)._private
*/
    break;
    case XSLT_LOAD_STYLESHEET:

    /* "src/lxml/xslt.pxi":144
 *     elif c_type == xslt.XSLT_LOAD_STYLESHEET:
 *         # include/import resolution while parsing
 *         c_pcontext = (<xslt.xsltStylesheet*>c_ctxt).doc._private             # <<<<<<<<<<<<<<
 *     else:
 *         c_pcontext = NULL
*/
    __pyx_t_1 = ((xsltStylesheet *)__pyx_v_c_ctxt)->doc->_private;
    __pyx_v_c_pcontext = __pyx_t_1;

    /* "src/lxml/xslt.pxi":142
 *         # transformation time
 *         c_pcontext = (<xslt.xsltTransformContext*>c_ctxt)._private
 *     elif c_type == xslt.XSLT_LOAD_STYLESHEET:             # <<<<<<<<<<<<<<
 *         # include/import resolution while parsing
 *         c_pcontext = (<xslt.xsltStylesheet*>c_ctxt).doc._private
*/
    break;
    default:

    /* "src/lxml/xslt.pxi":146
 *         c_pcontext = (<xslt.xsltStylesheet*>c_ctxt).doc._private
 *     else:
 *         c_pcontext = NULL             # <<<<<<<<<<<<<<
 * 
 *     if c_pcontext is NULL:
*/
    __pyx_v_c_pcontext = NULL;
    break;
  }

  /* "src/lxml/xslt.pxi":148
 *         c_pcontext = NULL
 * 
 *     if c_pcontext is NULL:             # <<<<<<<<<<<<<<
 *         # can't call Python without context, fall back to default loader
 *         return XSLT_DOC_DEFAULT_LOADER(
*/
  __pyx_t_2 = (__pyx_v_c_pcontext == NULL);
  if (__pyx_t_2) {

    /* "src/lxml/xslt.pxi":150
 *     if c_pcontext is NULL:
 *         # can't call Python without context, fall back to default loader
 *         return XSLT_DOC_DEFAULT_LOADER(             # <<<<<<<<<<<<<<
 *             c_uri, c_dict, parse_options, c_ctxt, c_type)
 * 
*/
    __pyx_r = __pyx_v_4lxml_5etree_XSLT_DOC_DEFAULT_LOADER(__pyx_v_c_uri, __pyx_v_c_dict, __pyx_v_parse_options, __pyx_v_c_ctxt, __pyx_v_c_type);
    goto __pyx_L0;

    /* "src/lxml/xslt.pxi":148
 *         c_pcontext = NULL
 * 
 *     if c_pcontext is NULL:             # <<<<<<<<<<<<<<
 *         # can't call Python without context, fall back to default loader
 *         return XSLT_DOC_DEFAULT_LOADER(
*/
  }

  /* "src/lxml/xslt.pxi":153
 *             c_uri, c_dict, parse_options, c_ctxt, c_type)
 * 
 *     c_doc = _xslt_resolve_from_python(c_uri, c_pcontext, parse_options, &error)             # <<<<<<<<<<<<<<
 *     if c_doc is NULL and not error:
 *         c_doc = XSLT_DOC_DEFAULT_LOADER(
*/
  __pyx_v_c_doc = __pyx_f_4lxml_5etree__xslt_resolve_from_python(__pyx_v_c_uri, __pyx_v_c_pcontext, __pyx_v_parse_options, (&__pyx_v_error));

  /* "src/lxml/xslt.pxi":154
 * 
 *     c_doc = _xslt_resolve_from_python(c_uri, c_pcontext, parse_options, &error)
 *     if c_doc is NULL and not error:             # <<<<<<<<<<<<<<
 *         c_doc = XSLT_DOC_DEFAULT_LOADER(
 *             c_uri, c_dict, parse_options, c_ctxt, c_type)
*/
  __pyx_t_3 = (__pyx_v_c_doc == NULL);
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_3 = (!(__pyx_v_error != 0));
  __pyx_t_2 = __pyx_t_3;
  __pyx_L5_bool_binop_done:;
  if (__pyx_t_2) {

    /* "src/lxml/xslt.pxi":155
 *     c_doc = _xslt_resolve_from_python(c_uri, c_pcontext, parse_options, &error)
 *     if c_doc is NULL and not error:
 *         c_doc = XSLT_DOC_DEFAULT_LOADER(             # <<<<<<<<<<<<<<
 *             c_uri, c_dict, parse_options, c_ctxt, c_type)
 *         if c_doc is NULL:
*/
    __pyx_v_c_doc = __pyx_v_4lxml_5etree_XSLT_DOC_DEFAULT_LOADER(__pyx_v_c_uri, __pyx_v_c_dict, __pyx_v_parse_options, __pyx_v_c_ctxt, __pyx_v_c_type);

    /* "src/lxml/xslt.pxi":157
 *         c_doc = XSLT_DOC_DEFAULT_LOADER(
 *             c_uri, c_dict, parse_options, c_ctxt, c_type)
 *         if c_doc is NULL:             # <<<<<<<<<<<<<<
 *             _xslt_store_resolver_exception(c_uri, c_pcontext, c_type)
 * 
*/
    __pyx_t_2 = (__pyx_v_c_doc == NULL);
    if (__pyx_t_2) {

      /* "src/lxml/xslt.pxi":158
 *             c_uri, c_dict, parse_options, c_ctxt, c_type)
 *         if c_doc is NULL:
 *             _xslt_store_resolver_exception(c_uri, c_pcontext, c_type)             # <<<<<<<<<<<<<<
 * 
 *     if c_doc is not NULL and c_type == xslt.XSLT_LOAD_STYLESHEET:
*/
      __pyx_f_4lxml_5etree__xslt_store_resolver_exception(__pyx_v_c_uri, __pyx_v_c_pcontext, __pyx_v_c_type);

      /* "src/lxml/xslt.pxi":157
 *         c_doc = XSLT_DOC_DEFAULT_LOADER(
 *             c_uri, c_dict, parse_options, c_ctxt, c_type)
 *         if c_doc is NULL:             # <<<<<<<<<<<<<<
 *             _xslt_store_resolver_exception(c_uri, c_pcontext, c_type)
 * 
*/
    }

    /* "src/lxml/xslt.pxi":154
 * 
 *     c_doc = _xslt_resolve_from_python(c_uri, c_pcontext, parse_options, &error)
 *     if c_doc is NULL and not error:             # <<<<<<<<<<<<<<
 *         c_doc = XSLT_DOC_DEFAULT_LOADER(
 *             c_uri, c_dict, parse_options, c_ctxt, c_type)
*/
  }

  /* "src/lxml/xslt.pxi":160
 *             _xslt_store_resolver_exception(c_uri, c_pcontext, c_type)
 * 
 *     if c_doc is not NULL and c_type == xslt.XSLT_LOAD_STYLESHEET:             # <<<<<<<<<<<<<<
 *         c_doc._private = c_pcontext
 *     return c_doc
*/
  __pyx_t_3 = (__pyx_v_c_doc != NULL);
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L9_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_c_type == XSLT_LOAD_STYLESHEET);
  __pyx_t_2 = __pyx_t_3;
  __pyx_L9_bool_binop_done:;
  if (__pyx_t_2) {

    /* "src/lxml/xslt.pxi":161
 * 
 *     if c_doc is not NULL and c_type == xslt.XSLT_LOAD_STYLESHEET:
 *         c_doc._private = c_pcontext             # <<<<<<<<<<<<<<
 *     return c_doc
 * 
*/
    __pyx_v_c_doc->_private = __pyx_v_c_pcontext;

    /* "src/lxml/xslt.pxi":160
 *             _xslt_store_resolver_exception(c_uri, c_pcontext, c_type)
 * 
 *     if c_doc is not NULL and c_type == xslt.XSLT_LOAD_STYLESHEET:             # <<<<<<<<<<<<<<
 *         c_doc._private = c_pcontext
 *     return c_doc
*/
  }

  /* "src/lxml/xslt.pxi":162
 *     if c_doc is not NULL and c_type == xslt.XSLT_LOAD_STYLESHEET:
 *         c_doc._private = c_pcontext
 *     return c_doc             # <<<<<<<<<<<<<<
 * 
 * cdef xslt.xsltDocLoaderFunc XSLT_DOC_DEFAULT_LOADER = xslt.xsltDocDefaultLoader
*/
  __pyx_r = __pyx_v_c_doc;
  goto __pyx_L0;

  /* "src/lxml/xslt.pxi":130
 * 
 * 
 * cdef xmlDoc* _xslt_doc_loader(const_xmlChar* c_uri, tree.xmlDict* c_dict,             # <<<<<<<<<<<<<<
 *                               int parse_options, void* c_ctxt,
 *                               xslt.xsltLoadType c_type) noexcept nogil:
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/xslt.pxi":192
 *     """
 *     cdef xslt.xsltSecurityPrefs* _prefs
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._prefs = xslt.xsltNewSecurityPrefs()
 *         if self._prefs is NULL:
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_17XSLTAccessControl_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_17XSLTAccessControl_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, __pyx_nargs); return -1; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return -1;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__cinit__", __pyx_kwds); return -1;}
  __pyx_r = __pyx_pf_4lxml_5etree_17XSLTAccessControl___cinit__(((struct __pyx_obj_4lxml_5etree_XSLTAccessControl *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_17XSLTAccessControl___cinit__(struct __pyx_obj_4lxml_5etree_XSLTAccessControl *__pyx_v_self) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/xslt.pxi":193
 *     cdef xslt.xsltSecurityPrefs* _prefs
 *     def __cinit__(self):
 *         self._prefs = xslt.xsltNewSecurityPrefs()             # <<<<<<<<<<<<<<
 *         if self._prefs is NULL:
 *             raise MemoryError()
*/
  __pyx_v_self->_prefs = xsltNewSecurityPrefs();

  /* "src/lxml/xslt.pxi":194
 *     def __cinit__(self):
 *         self._prefs = xslt.xsltNewSecurityPrefs()
 *         if self._prefs is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 * 
*/
  __pyx_t_1 = (__pyx_v_self->_prefs == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/xslt.pxi":195
 *         self._prefs = xslt.xsltNewSecurityPrefs()
 *         if self._prefs is NULL:
 *             raise MemoryError()             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, *, bint read_file=True, bint write_file=True, bint create_dir=True,
*/
    PyErr_NoMemory(); __PYX_ERR(3, 195, __pyx_L1_error)

    /* "src/lxml/xslt.pxi":194
 *     def __cinit__(self):
 *         self._prefs = xslt.xsltNewSecurityPrefs()
 *         if self._prefs is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 * 
*/
  }

  /* "src/lxml/xslt.pxi":192
 *     """
 *     cdef xslt.xsltSecurityPrefs* _prefs
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._prefs = xslt.xsltNewSecurityPrefs()
 *         if self._prefs is NULL:
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.XSLTAccessControl.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/xslt.pxi":197
 *             raise MemoryError()
 * 
 *     def __init__(self, *, bint read_file=True, bint write_file=True, bint create_dir=True,             # <<<<<<<<<<<<<<
 *                  bint read_network=True, bint write_network=True):
 *         self._setAccess(xslt.XSLT_SECPREF_READ_FILE, read_file)
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_17XSLTAccessControl_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_17XSLTAccessControl_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_read_file;
  int __pyx_v_write_file;
  int __pyx_v_create_dir;
  int __pyx_v_read_network;
  int __pyx_v_write_network;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[5] = {0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_read_file,&__pyx_mstate_global->__pyx_n_u_write_file,&__pyx_mstate_global->__pyx_n_u_create_dir,&__pyx_mstate_global->__pyx_n_u_read_network,&__pyx_mstate_global->__pyx_n_u_write_network,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(3, 197, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, 0, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(3, 197, __pyx_L3_error)
    } else if (unlikely(__pyx_nargs != 0)) {
      goto __pyx_L5_argtuple_error;
    } else {
    }
    if (values[0]) {
      __pyx_v_read_file = __Pyx_PyObject_IsTrue(values[0]); if (unlikely((__pyx_v_read_file == (int)-1) && PyErr_Occurred())) __PYX_ERR(3, 197, __pyx_L3_error)
    } else {
      __pyx_v_read_file = ((int)1);
    }
    if (values[1]) {
      __pyx_v_write_file = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_write_file == (int)-1) && PyErr_Occurred())) __PYX_ERR(3, 197, __pyx_L3_error)
    } else {
      __pyx_v_write_file = ((int)1);
    }
    if (values[2]) {
      __pyx_v_create_dir = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_create_dir == (int)-1) && PyErr_Occurred())) __PYX_ERR(3, 197, __pyx_L3_error)
    } else {
      __pyx_v_create_dir = ((int)1);
    }
    if (values[3]) {
      __pyx_v_read_network = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_read_network == (int)-1) && PyErr_Occurred())) __PYX_ERR(3, 198, __pyx_L3_error)
    } else {

      /* "src/lxml/xslt.pxi":198
 * 
 *     def __init__(self, *, bint read_file=True, bint write_file=True, bint create_dir=True,
 *                  bint read_network=True, bint write_network=True):             # <<<<<<<<<<<<<<
 *         self._setAccess(xslt.XSLT_SECPREF_READ_FILE, read_file)
 *         self._setAccess(xslt.XSLT_SECPREF_WRITE_FILE, write_file)
*/
      __pyx_v_read_network = ((int)1);
    }
    if (values[4]) {
      __pyx_v_write_network = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_write_network == (int)-1) && PyErr_Occurred())) __PYX_ERR(3, 198, __pyx_L3_error)
    } else {
      __pyx_v_write_network = ((int)1);
    }
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, __pyx_nargs); __PYX_ERR(3, 197, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.XSLTAccessControl.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_17XSLTAccessControl_2__init__(((struct __pyx_obj_4lxml_5etree_XSLTAccessControl *)__pyx_v_self), __pyx_v_read_file, __pyx_v_write_file, __pyx_v_create_dir, __pyx_v_read_network, __pyx_v_write_network);

  /* "src/lxml/xslt.pxi":197
 *             raise MemoryError()
 * 
 *     def __init__(self, *, bint read_file=True, bint write_file=True, bint create_dir=True,             # <<<<<<<<<<<<<<
 *                  bint read_network=True, bint write_network=True):
 *         self._setAccess(xslt.XSLT_SECPREF_READ_FILE, read_file)
*/

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_17XSLTAccessControl_2__init__(struct __pyx_obj_4lxml_5etree_XSLTAccessControl *__pyx_v_self, int __pyx_v_read_file, int __pyx_v_write_file, int __pyx_v_create_dir, int __pyx_v_read_network, int __pyx_v_write_network) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "src/lxml/xslt.pxi":199
 *     def __init__(self, *, bint read_file=True, bint write_file=True, bint create_dir=True,
 *                  bint read_network=True, bint write_network=True):
 *         self._setAccess(xslt.XSLT_SECPREF_READ_FILE, read_file)             # <<<<<<<<<<<<<<
 *         self._setAccess(xslt.XSLT_SECPREF_WRITE_FILE, write_file)
 *         self._setAccess(xslt.XSLT_SECPREF_CREATE_DIRECTORY, create_dir)
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_17XSLTAccessControl__setAccess(__pyx_v_self, XSLT_SECPREF_READ_FILE, __pyx_v_read_file); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xslt.pxi":200
 *                  bint read_network=True, bint write_network=True):
 *         self._setAccess(xslt.XSLT_SECPREF_READ_FILE, read_file)
 *         self._setAccess(xslt.XSLT_SECPREF_WRITE_FILE, write_file)             # <<<<<<<<<<<<<<
 *         self._setAccess(xslt.XSLT_SECPREF_CREATE_DIRECTORY, create_dir)
 *         self._setAccess(xslt.XSLT_SECPREF_READ_NETWORK, read_network)
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_17XSLTAccessControl__setAccess(__pyx_v_self, XSLT_SECPREF_WRITE_FILE, __pyx_v_write_file); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 200, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xslt.pxi":201
 *         self._setAccess(xslt.XSLT_SECPREF_READ_FILE, read_file)
 *         self._setAccess(xslt.XSLT_SECPREF_WRITE_FILE, write_file)
 *         self._setAccess(xslt.XSLT_SECPREF_CREATE_DIRECTORY, create_dir)             # <<<<<<<<<<<<<<
 *         self._setAccess(xslt.XSLT_SECPREF_READ_NETWORK, read_network)
 *         self._setAccess(xslt.XSLT_SECPREF_WRITE_NETWORK, write_network)
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_17XSLTAccessControl__setAccess(__pyx_v_self, XSLT_SECPREF_CREATE_DIRECTORY, __pyx_v_create_dir); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 201, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xslt.pxi":202
 *         self._setAccess(xslt.XSLT_SECPREF_WRITE_FILE, write_file)
 *         self._setAccess(xslt.XSLT_SECPREF_CREATE_DIRECTORY, create_dir)
 *         self._setAccess(xslt.XSLT_SECPREF_READ_NETWORK, read_network)             # <<<<<<<<<<<<<<
 *         self._setAccess(xslt.XSLT_SECPREF_WRITE_NETWORK, write_network)
 * 
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_17XSLTAccessControl__setAccess(__pyx_v_self, XSLT_SECPREF_READ_NETWORK, __pyx_v_read_network); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xslt.pxi":203
 *         self._setAccess(xslt.XSLT_SECPREF_CREATE_DIRECTORY, create_dir)
 *         self._setAccess(xslt.XSLT_SECPREF_READ_NETWORK, read_network)
 *         self._setAccess(xslt.XSLT_SECPREF_WRITE_NETWORK, write_network)             # <<<<<<<<<<<<<<
 * 
 *     DENY_ALL = XSLTAccessControl(
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_17XSLTAccessControl__setAccess(__pyx_v_self, XSLT_SECPREF_WRITE_NETWORK, __pyx_v_write_network); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xslt.pxi":197
 *             raise MemoryError()
 * 
 *     def __init__(self, *, bint read_file=True, bint write_file=True, bint create_dir=True,             # <<<<<<<<<<<<<<
 *                  bint read_network=True, bint write_network=True):
 *         self._setAccess(xslt.XSLT_SECPREF_READ_FILE, read_file)
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.XSLTAccessControl.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xslt.pxi":213
 *         read_network=True, write_network=False)
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._prefs is not NULL:
 *             xslt.xsltFreeSecurityPrefs(self._prefs)
*/

/* Python wrapper */
static void __pyx_pw_4lxml_5etree_17XSLTAccessControl_5__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_4lxml_5etree_17XSLTAccessControl_5__dealloc__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_pf_4lxml_5etree_17XSLTAccessControl_4__dealloc__(((struct __pyx_obj_4lxml_5etree_XSLTAccessControl *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_4lxml_5etree_17XSLTAccessControl_4__dealloc__(struct __pyx_obj_4lxml_5etree_XSLTAccessControl *__pyx_v_self) {
  int __pyx_t_1;

  /* "src/lxml/xslt.pxi":214
 * 
 *     def __dealloc__(self):
 *         if self._prefs is not NULL:             # <<<<<<<<<<<<<<
 *             xslt.xsltFreeSecurityPrefs(self._prefs)
 * 
*/
  __pyx_t_1 = (__pyx_v_self->_prefs != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/xslt.pxi":215
 *     def __dealloc__(self):
 *         if self._prefs is not NULL:
 *             xslt.xsltFreeSecurityPrefs(self._prefs)             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
*/
    xsltFreeSecurityPrefs(__pyx_v_self->_prefs);

    /* "src/lxml/xslt.pxi":214
 * 
 *     def __dealloc__(self):
 *         if self._prefs is not NULL:             # <<<<<<<<<<<<<<
 *             xslt.xsltFreeSecurityPrefs(self._prefs)
 * 
*/
  }

  /* "src/lxml/xslt.pxi":213
 *         read_network=True, write_network=False)
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._prefs is not NULL:
 *             xslt.xsltFreeSecurityPrefs(self._prefs)
*/

  /* function exit code */
}

/* "src/lxml/xslt.pxi":217
 *             xslt.xsltFreeSecurityPrefs(self._prefs)
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef _setAccess(self, xslt.xsltSecurityOption option, bint allow):
 *         cdef xslt.xsltSecurityCheck function
*/

static PyObject *__pyx_f_4lxml_5etree_17XSLTAccessControl__setAccess(struct __pyx_obj_4lxml_5etree_XSLTAccessControl *__pyx_v_self, xsltSecurityOption __pyx_v_option, int __pyx_v_allow) {
  xsltSecurityCheck __pyx_v_function;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_setAccess", 0);

  /* "src/lxml/xslt.pxi":220
 *     cdef _setAccess(self, xslt.xsltSecurityOption option, bint allow):
 *         cdef xslt.xsltSecurityCheck function
 *         if allow:             # <<<<<<<<<<<<<<
 *             function = xslt.xsltSecurityAllow
 *         else:
*/
  if (__pyx_v_allow) {

    /* "src/lxml/xslt.pxi":221
 *         cdef xslt.xsltSecurityCheck function
 *         if allow:
 *             function = xslt.xsltSecurityAllow             # <<<<<<<<<<<<<<
 *         else:
 *             function = xslt.xsltSecurityForbid
*/
    __pyx_v_function = xsltSecurityAllow;

    /* "src/lxml/xslt.pxi":220
 *     cdef _setAccess(self, xslt.xsltSecurityOption option, bint allow):
 *         cdef xslt.xsltSecurityCheck function
 *         if allow:             # <<<<<<<<<<<<<<
 *             function = xslt.xsltSecurityAllow
 *         else:
*/
    goto __pyx_L3;
  }

  /* "src/lxml/xslt.pxi":223
 *             function = xslt.xsltSecurityAllow
 *         else:
 *             function = xslt.xsltSecurityForbid             # <<<<<<<<<<<<<<
 *         xslt.xsltSetSecurityPrefs(self._prefs, option, function)
 * 
*/
  /*else*/ {
    __pyx_v_function = xsltSecurityForbid;
  }
  __pyx_L3:;

  /* "src/lxml/xslt.pxi":224
 *         else:
 *             function = xslt.xsltSecurityForbid
 *         xslt.xsltSetSecurityPrefs(self._prefs, option, function)             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
*/
  (void)(xsltSetSecurityPrefs(__pyx_v_self->_prefs, __pyx_v_option, __pyx_v_function));

  /* "src/lxml/xslt.pxi":217
 *             xslt.xsltFreeSecurityPrefs(self._prefs)
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef _setAccess(self, xslt.xsltSecurityOption option, bint allow):
 *         cdef xslt.xsltSecurityCheck function
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xslt.pxi":226
 *         xslt.xsltSetSecurityPrefs(self._prefs, option, function)
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef void _register_in_context(self, xslt.xsltTransformContext* ctxt) noexcept:
 *         xslt.xsltSetCtxtSecurityPrefs(self._prefs, ctxt)
*/

static void __pyx_f_4lxml_5etree_17XSLTAccessControl__register_in_context(struct __pyx_obj_4lxml_5etree_XSLTAccessControl *__pyx_v_self, xsltTransformContext *__pyx_v_ctxt) {

  /* "src/lxml/xslt.pxi":228
 *     @cython.final
 *     cdef void _register_in_context(self, xslt.xsltTransformContext* ctxt) noexcept:
 *         xslt.xsltSetCtxtSecurityPrefs(self._prefs, ctxt)             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  (void)(xsltSetCtxtSecurityPrefs(__pyx_v_self->_prefs, __pyx_v_ctxt));

  /* "src/lxml/xslt.pxi":226
 *         xslt.xsltSetSecurityPrefs(self._prefs, option, function)
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef void _register_in_context(self, xslt.xsltTransformContext* ctxt) noexcept:
 *         xslt.xsltSetCtxtSecurityPrefs(self._prefs, ctxt)
*/

  /* function exit code */
}

/* "src/lxml/xslt.pxi":230
 *         xslt.xsltSetCtxtSecurityPrefs(self._prefs, ctxt)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def options(self):
 *         """The access control configuration as a map of options."""
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_17XSLTAccessControl_7options_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_17XSLTAccessControl_7options_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_17XSLTAccessControl_7options___get__(((struct __pyx_obj_4lxml_5etree_XSLTAccessControl *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_17XSLTAccessControl_7options___get__(struct __pyx_obj_4lxml_5etree_XSLTAccessControl *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "src/lxml/xslt.pxi":233
 *     def options(self):
 *         """The access control configuration as a map of options."""
 *         return {             # <<<<<<<<<<<<<<
 *             'read_file': self._optval(xslt.XSLT_SECPREF_READ_FILE),
 *             'write_file': self._optval(xslt.XSLT_SECPREF_WRITE_FILE),
*/
  __Pyx_XDECREF(__pyx_r);

  /* "src/lxml/xslt.pxi":234
 *         """The access control configuration as a map of options."""
 *         return {
 *             'read_file': self._optval(xslt.XSLT_SECPREF_READ_FILE),             # <<<<<<<<<<<<<<
 *             'write_file': self._optval(xslt.XSLT_SECPREF_WRITE_FILE),
 *             'create_dir': self._optval(xslt.XSLT_SECPREF_CREATE_DIRECTORY),
*/
  __pyx_t_1 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 234, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree_17XSLTAccessControl__optval(__pyx_v_self, XSLT_SECPREF_READ_FILE); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 234, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_read_file, __pyx_t_2) < (0)) __PYX_ERR(3, 234, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/xslt.pxi":235
 *         return {
 *             'read_file': self._optval(xslt.XSLT_SECPREF_READ_FILE),
 *             'write_file': self._optval(xslt.XSLT_SECPREF_WRITE_FILE),             # <<<<<<<<<<<<<<
 *             'create_dir': self._optval(xslt.XSLT_SECPREF_CREATE_DIRECTORY),
 *             'read_network': self._optval(xslt.XSLT_SECPREF_READ_NETWORK),
*/
  __pyx_t_2 = __pyx_f_4lxml_5etree_17XSLTAccessControl__optval(__pyx_v_self, XSLT_SECPREF_WRITE_FILE); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_write_file, __pyx_t_2) < (0)) __PYX_ERR(3, 234, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/xslt.pxi":236
 *             'read_file': self._optval(xslt.XSLT_SECPREF_READ_FILE),
 *             'write_file': self._optval(xslt.XSLT_SECPREF_WRITE_FILE),
 *             'create_dir': self._optval(xslt.XSLT_SECPREF_CREATE_DIRECTORY),             # <<<<<<<<<<<<<<
 *             'read_network': self._optval(xslt.XSLT_SECPREF_READ_NETWORK),
 *             'write_network': self._optval(xslt.XSLT_SECPREF_WRITE_NETWORK),
*/
  __pyx_t_2 = __pyx_f_4lxml_5etree_17XSLTAccessControl__optval(__pyx_v_self, XSLT_SECPREF_CREATE_DIRECTORY); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 236, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_create_dir, __pyx_t_2) < (0)) __PYX_ERR(3, 234, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/xslt.pxi":237
 *             'write_file': self._optval(xslt.XSLT_SECPREF_WRITE_FILE),
 *             'create_dir': self._optval(xslt.XSLT_SECPREF_CREATE_DIRECTORY),
 *             'read_network': self._optval(xslt.XSLT_SECPREF_READ_NETWORK),             # <<<<<<<<<<<<<<
 *             'write_network': self._optval(xslt.XSLT_SECPREF_WRITE_NETWORK),
 *         }
*/
  __pyx_t_2 = __pyx_f_4lxml_5etree_17XSLTAccessControl__optval(__pyx_v_self, XSLT_SECPREF_READ_NETWORK); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 237, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_read_network, __pyx_t_2) < (0)) __PYX_ERR(3, 234, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/xslt.pxi":238
 *             'create_dir': self._optval(xslt.XSLT_SECPREF_CREATE_DIRECTORY),
 *             'read_network': self._optval(xslt.XSLT_SECPREF_READ_NETWORK),
 *             'write_network': self._optval(xslt.XSLT_SECPREF_WRITE_NETWORK),             # <<<<<<<<<<<<<<
 *         }
 * 
*/
  __pyx_t_2 = __pyx_f_4lxml_5etree_17XSLTAccessControl__optval(__pyx_v_self, XSLT_SECPREF_WRITE_NETWORK); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 238, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_write_network, __pyx_t_2) < (0)) __PYX_ERR(3, 234, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/xslt.pxi":230
 *         xslt.xsltSetCtxtSecurityPrefs(self._prefs, ctxt)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def options(self):
 *         """The access control configuration as a map of options."""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.XSLTAccessControl.options.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xslt.pxi":241
 *         }
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef _optval(self, xslt.xsltSecurityOption option):
 *         cdef xslt.xsltSecurityCheck function
*/

static PyObject *__pyx_f_4lxml_5etree_17XSLTAccessControl__optval(struct __pyx_obj_4lxml_5etree_XSLTAccessControl *__pyx_v_self, xsltSecurityOption __pyx_v_option) {
  xsltSecurityCheck __pyx_v_function;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_optval", 0);

  /* "src/lxml/xslt.pxi":244
 *     cdef _optval(self, xslt.xsltSecurityOption option):
 *         cdef xslt.xsltSecurityCheck function
 *         function = xslt.xsltGetSecurityPrefs(self._prefs, option)             # <<<<<<<<<<<<<<
 *         if function is <xslt.xsltSecurityCheck>xslt.xsltSecurityAllow:
 *             return True
*/
  __pyx_v_function = xsltGetSecurityPrefs(__pyx_v_self->_prefs, __pyx_v_option);

  /* "src/lxml/xslt.pxi":245
 *         cdef xslt.xsltSecurityCheck function
 *         function = xslt.xsltGetSecurityPrefs(self._prefs, option)
 *         if function is <xslt.xsltSecurityCheck>xslt.xsltSecurityAllow:             # <<<<<<<<<<<<<<
 *             return True
 *         elif function is <xslt.xsltSecurityCheck>xslt.xsltSecurityForbid:
*/
  __pyx_t_1 = (__pyx_v_function == ((xsltSecurityCheck)xsltSecurityAllow));
  if (__pyx_t_1) {

    /* "src/lxml/xslt.pxi":246
 *         function = xslt.xsltGetSecurityPrefs(self._prefs, option)
 *         if function is <xslt.xsltSecurityCheck>xslt.xsltSecurityAllow:
 *             return True             # <<<<<<<<<<<<<<
 *         elif function is <xslt.xsltSecurityCheck>xslt.xsltSecurityForbid:
 *             return False
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;

    /* "src/lxml/xslt.pxi":245
 *         cdef xslt.xsltSecurityCheck function
 *         function = xslt.xsltGetSecurityPrefs(self._prefs, option)
 *         if function is <xslt.xsltSecurityCheck>xslt.xsltSecurityAllow:             # <<<<<<<<<<<<<<
 *             return True
 *         elif function is <xslt.xsltSecurityCheck>xslt.xsltSecurityForbid:
*/
  }

  /* "src/lxml/xslt.pxi":247
 *         if function is <xslt.xsltSecurityCheck>xslt.xsltSecurityAllow:
 *             return True
 *         elif function is <xslt.xsltSecurityCheck>xslt.xsltSecurityForbid:             # <<<<<<<<<<<<<<
 *             return False
 *         else:
*/
  __pyx_t_1 = (__pyx_v_function == ((xsltSecurityCheck)xsltSecurityForbid));
  if (__pyx_t_1) {

    /* "src/lxml/xslt.pxi":248
 *             return True
 *         elif function is <xslt.xsltSecurityCheck>xslt.xsltSecurityForbid:
 *             return False             # <<<<<<<<<<<<<<
 *         else:
 *             return None
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;

    /* "src/lxml/xslt.pxi":247
 *         if function is <xslt.xsltSecurityCheck>xslt.xsltSecurityAllow:
 *             return True
 *         elif function is <xslt.xsltSecurityCheck>xslt.xsltSecurityForbid:             # <<<<<<<<<<<<<<
 *             return False
 *         else:
*/
  }

  /* "src/lxml/xslt.pxi":250
 *             return False
 *         else:
 *             return None             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "src/lxml/xslt.pxi":241
 *         }
 * 
 *     @cython.final             # <<<<<<<<<<<<<<
 *     cdef _optval(self, xslt.xsltSecurityOption option):
 *         cdef xslt.xsltSecurityCheck function
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xslt.pxi":252
 *             return None
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         items = sorted(self.options.items())
 *         return "%s(%s)" % (
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_17XSLTAccessControl_7__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_17XSLTAccessControl_7__repr__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_17XSLTAccessControl_6__repr__(((struct __pyx_obj_4lxml_5etree_XSLTAccessControl *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_17XSLTAccessControl_6__repr__(struct __pyx_obj_4lxml_5etree_XSLTAccessControl *__pyx_v_self) {
  PyObject *__pyx_v_items = NULL;
  PyObject *__pyx_9genexpr20__pyx_v_item = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  const char *__pyx_t_5;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8[4];
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "src/lxml/xslt.pxi":253
 * 
 *     def __repr__(self):
 *         items = sorted(self.options.items())             # <<<<<<<<<<<<<<
 *         return "%s(%s)" % (
 *             python._fqtypename(self).decode('UTF-8').split('.')[-1],
*/
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_options); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 253, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __pyx_t_3;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_items, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 253, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_3 = PySequence_List(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 253, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely((PyList_Sort(__pyx_t_3) < 0))) __PYX_ERR(3, 253, __pyx_L1_error)
  __pyx_v_items = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "src/lxml/xslt.pxi":254
 *     def __repr__(self):
 *         items = sorted(self.options.items())
 *         return "%s(%s)" % (             # <<<<<<<<<<<<<<
 *             python._fqtypename(self).decode('UTF-8').split('.')[-1],
 *             ', '.join(["%s=%r" % item for item in items]))
*/
  __Pyx_XDECREF(__pyx_r);

  /* "src/lxml/xslt.pxi":255
 *         items = sorted(self.options.items())
 *         return "%s(%s)" % (
 *             python._fqtypename(self).decode('UTF-8').split('.')[-1],             # <<<<<<<<<<<<<<
 *             ', '.join(["%s=%r" % item for item in items]))
 * 
*/
  __pyx_t_5 = _fqtypename(((PyObject *)__pyx_v_self));
  __pyx_t_6 = __Pyx_ssize_strlen(__pyx_t_5); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(3, 255, __pyx_L1_error)
  __pyx_t_3 = __Pyx_decode_c_string(__pyx_t_5, 0, __pyx_t_6, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 255, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyUnicode_Split(__pyx_t_3, __pyx_mstate_global->__pyx_kp_u__2, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 255, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_t_1, -1L, long, 1, __Pyx_PyLong_From_long, 1, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 255, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_t_3), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 255, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/xslt.pxi":256
 *         return "%s(%s)" % (
 *             python._fqtypename(self).decode('UTF-8').split('.')[-1],
 *             ', '.join(["%s=%r" % item for item in items]))             # <<<<<<<<<<<<<<
 * 
 * ################################################################################
*/
  { /* enter inner scope */
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 256, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __pyx_v_items; __Pyx_INCREF(__pyx_t_2);
    __pyx_t_6 = 0;
    for (;;) {
      {
        Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely((__pyx_temp < 0))) __PYX_ERR(3, 256, __pyx_L5_error)
        #endif
        if (__pyx_t_6 >= __pyx_temp) break;
      }
      __pyx_t_7 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_6, __Pyx_ReferenceSharing_OwnStrongReference);
      ++__pyx_t_6;
      if (unlikely(!__pyx_t_7)) __PYX_ERR(3, 256, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_XDECREF_SET(__pyx_9genexpr20__pyx_v_item, __pyx_t_7);
      __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyUnicode_FormatSafe(__pyx_mstate_global->__pyx_kp_u_s_r, __pyx_9genexpr20__pyx_v_item); if (unlikely(!__pyx_t_7)) __PYX_ERR(3, 256, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_7))) __PYX_ERR(3, 256, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_9genexpr20__pyx_v_item); __pyx_9genexpr20__pyx_v_item = 0;
    goto __pyx_L9_exit_scope;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_9genexpr20__pyx_v_item); __pyx_9genexpr20__pyx_v_item = 0;
    goto __pyx_L1_error;
    __pyx_L9_exit_scope:;
  } /* exit inner scope */
  __pyx_t_2 = PyUnicode_Join(__pyx_mstate_global->__pyx_kp_u__43, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 256, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_8[0] = __pyx_t_1;
  __pyx_t_8[1] = __pyx_mstate_global->__pyx_kp_u__42;
  __pyx_t_8[2] = __pyx_t_2;
  __pyx_t_8[3] = __pyx_mstate_global->__pyx_kp_u__5;

  /* "src/lxml/xslt.pxi":254
 *     def __repr__(self):
 *         items = sorted(self.options.items())
 *         return "%s(%s)" % (             # <<<<<<<<<<<<<<
 *             python._fqtypename(self).decode('UTF-8').split('.')[-1],
 *             ', '.join(["%s=%r" % item for item in items]))
*/
  __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_8, 4, __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + 1 * 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2));
  if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 254, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "src/lxml/xslt.pxi":252
 *             return None
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         items = sorted(self.options.items())
 *         return "%s(%s)" % (
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree.XSLTAccessControl.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_items);
  __Pyx_XDECREF(__pyx_9genexpr20__pyx_v_item);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xslt.pxi":261
 * # XSLT
 * 
 * cdef int _register_xslt_function(void* ctxt, name_utf, ns_utf) noexcept:             # <<<<<<<<<<<<<<
 *     if ns_utf is None:
 *         return 0
*/

static int __pyx_f_4lxml_5etree__register_xslt_function(void *__pyx_v_ctxt, PyObject *__pyx_v_name_utf, PyObject *__pyx_v_ns_utf) {
  int __pyx_r;
  int __pyx_t_1;

  /* "src/lxml/xslt.pxi":262
 * 
 * cdef int _register_xslt_function(void* ctxt, name_utf, ns_utf) noexcept:
 *     if ns_utf is None:             # <<<<<<<<<<<<<<
 *         return 0
 *     # libxml2 internalises the strings if ctxt has a dict
*/
  __pyx_t_1 = (__pyx_v_ns_utf == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/xslt.pxi":263
 * cdef int _register_xslt_function(void* ctxt, name_utf, ns_utf) noexcept:
 *     if ns_utf is None:
 *         return 0             # <<<<<<<<<<<<<<
 *     # libxml2 internalises the strings if ctxt has a dict
 *     return xslt.xsltRegisterExtFunction(
*/
    __pyx_r = 0;
    goto __pyx_L0;

    /* "src/lxml/xslt.pxi":262
 * 
 * cdef int _register_xslt_function(void* ctxt, name_utf, ns_utf) noexcept:
 *     if ns_utf is None:             # <<<<<<<<<<<<<<
 *         return 0
 *     # libxml2 internalises the strings if ctxt has a dict
*/
  }

  /* "src/lxml/xslt.pxi":265
 *         return 0
 *     # libxml2 internalises the strings if ctxt has a dict
 *     return xslt.xsltRegisterExtFunction(             # <<<<<<<<<<<<<<
 *         <xslt.xsltTransformContext*>ctxt, _xcstr(name_utf), _xcstr(ns_utf),
 *         <xslt.xmlXPathFunction>_xpath_function_call)
*/
  __pyx_r = xsltRegisterExtFunction(((xsltTransformContext *)__pyx_v_ctxt), (const xmlChar*)PyBytes_AS_STRING(__pyx_v_name_utf), (const xmlChar*)PyBytes_AS_STRING(__pyx_v_ns_utf), ((xmlXPathFunction)__pyx_f_4lxml_5etree__xpath_function_call));
  goto __pyx_L0;

  /* "src/lxml/xslt.pxi":261
 * # XSLT
 * 
 * cdef int _register_xslt_function(void* ctxt, name_utf, ns_utf) noexcept:             # <<<<<<<<<<<<<<
 *     if ns_utf is None:
 *         return 0
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/xslt.pxi":277
 *     cdef _ReadOnlyElementProxy _extension_element_proxy
 *     cdef dict _extension_elements
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._xsltCtxt = NULL
 *         self._extension_elements = EMPTY_DICT
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_12_XSLTContext_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_12_XSLTContext_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, __pyx_nargs); return -1; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return -1;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__cinit__", __pyx_kwds); return -1;}
  __pyx_r = __pyx_pf_4lxml_5etree_12_XSLTContext___cinit__(((struct __pyx_obj_4lxml_5etree__XSLTContext *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_12_XSLTContext___cinit__(struct __pyx_obj_4lxml_5etree__XSLTContext *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "src/lxml/xslt.pxi":278
 *     cdef dict _extension_elements
 *     def __cinit__(self):
 *         self._xsltCtxt = NULL             # <<<<<<<<<<<<<<
 *         self._extension_elements = EMPTY_DICT
 * 
*/
  __pyx_v_self->_xsltCtxt = NULL;

  /* "src/lxml/xslt.pxi":279
 *     def __cinit__(self):
 *         self._xsltCtxt = NULL
 *         self._extension_elements = EMPTY_DICT             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, namespaces, extensions, error_log, enable_regexp,
*/
  __Pyx_INCREF(__pyx_v_4lxml_5etree_EMPTY_DICT);
  __Pyx_GIVEREF(__pyx_v_4lxml_5etree_EMPTY_DICT);
  __Pyx_GOTREF(__pyx_v_self->_extension_elements);
  __Pyx_DECREF(__pyx_v_self->_extension_elements);
  __pyx_v_self->_extension_elements = __pyx_v_4lxml_5etree_EMPTY_DICT;

  /* "src/lxml/xslt.pxi":277
 *     cdef _ReadOnlyElementProxy _extension_element_proxy
 *     cdef dict _extension_elements
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._xsltCtxt = NULL
 *         self._extension_elements = EMPTY_DICT
*/

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xslt.pxi":281
 *         self._extension_elements = EMPTY_DICT
 * 
 *     def __init__(self, namespaces, extensions, error_log, enable_regexp,             # <<<<<<<<<<<<<<
 *                  build_smart_strings):
 *         if extensions is not None and extensions:
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_12_XSLTContext_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_12_XSLTContext_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_namespaces = 0;
  PyObject *__pyx_v_extensions = 0;
  PyObject *__pyx_v_error_log = 0;
  PyObject *__pyx_v_enable_regexp = 0;
  PyObject *__pyx_v_build_smart_strings = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[5] = {0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_namespaces,&__pyx_mstate_global->__pyx_n_u_extensions,&__pyx_mstate_global->__pyx_n_u_error_log,&__pyx_mstate_global->__pyx_n_u_enable_regexp,&__pyx_mstate_global->__pyx_n_u_build_smart_strings,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(3, 281, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  5:
        values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(3, 281, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(3, 281, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(3, 281, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(3, 281, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(3, 281, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(3, 281, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 5; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, i); __PYX_ERR(3, 281, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 5)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(3, 281, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(3, 281, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(3, 281, __pyx_L3_error)
      values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(3, 281, __pyx_L3_error)
      values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(3, 281, __pyx_L3_error)
    }
    __pyx_v_namespaces = values[0];
    __pyx_v_extensions = values[1];
    __pyx_v_error_log = values[2];
    __pyx_v_enable_regexp = values[3];
    __pyx_v_build_smart_strings = values[4];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, __pyx_nargs); __PYX_ERR(3, 281, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._XSLTContext.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_12_XSLTContext_2__init__(((struct __pyx_obj_4lxml_5etree__XSLTContext *)__pyx_v_self), __pyx_v_namespaces, __pyx_v_extensions, __pyx_v_error_log, __pyx_v_enable_regexp, __pyx_v_build_smart_strings);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_12_XSLTContext_2__init__(struct __pyx_obj_4lxml_5etree__XSLTContext *__pyx_v_self, PyObject *__pyx_v_namespaces, PyObject *__pyx_v_extensions, PyObject *__pyx_v_error_log, PyObject *__pyx_v_enable_regexp, PyObject *__pyx_v_build_smart_strings) {
  PyObject *__pyx_v_ns_name_tuple = NULL;
  PyObject *__pyx_v_extension = NULL;
  PyObject *__pyx_v_ns_utf = NULL;
  PyObject *__pyx_v_name_utf = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  size_t __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_INCREF(__pyx_v_extensions);

  /* "src/lxml/xslt.pxi":283
 *     def __init__(self, namespaces, extensions, error_log, enable_regexp,
 *                  build_smart_strings):
 *         if extensions is not None and extensions:             # <<<<<<<<<<<<<<
 *             for ns_name_tuple, extension in extensions.items():
 *                 if ns_name_tuple[0] is None:
*/
  __pyx_t_2 = (__pyx_v_extensions != Py_None);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_extensions); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(3, 283, __pyx_L1_error)
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/xslt.pxi":284
 *                  build_smart_strings):
 *         if extensions is not None and extensions:
 *             for ns_name_tuple, extension in extensions.items():             # <<<<<<<<<<<<<<
 *                 if ns_name_tuple[0] is None:
 *                     raise XSLTExtensionError, \
*/
    __pyx_t_4 = 0;
    if (unlikely(__pyx_v_extensions == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
      __PYX_ERR(3, 284, __pyx_L1_error)
    }
    __pyx_t_7 = __Pyx_dict_iterator(__pyx_v_extensions, 0, __pyx_mstate_global->__pyx_n_u_items, (&__pyx_t_5), (&__pyx_t_6)); if (unlikely(!__pyx_t_7)) __PYX_ERR(3, 284, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_XDECREF(__pyx_t_3);
    __pyx_t_3 = __pyx_t_7;
    __pyx_t_7 = 0;
    while (1) {
      __pyx_t_9 = __Pyx_dict_iter_next(__pyx_t_3, __pyx_t_5, &__pyx_t_4, &__pyx_t_7, &__pyx_t_8, NULL, __pyx_t_6);
      if (unlikely(__pyx_t_9 == 0)) break;
      if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(3, 284, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_XDECREF_SET(__pyx_v_ns_name_tuple, __pyx_t_7);
      __pyx_t_7 = 0;
      __Pyx_XDECREF_SET(__pyx_v_extension, __pyx_t_8);
      __pyx_t_8 = 0;

      /* "src/lxml/xslt.pxi":285
 *         if extensions is not None and extensions:
 *             for ns_name_tuple, extension in extensions.items():
 *                 if ns_name_tuple[0] is None:             # <<<<<<<<<<<<<<
 *                     raise XSLTExtensionError, \
 *                         "extensions must not have empty namespaces"
*/
      __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_ns_name_tuple, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 285, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_1 = (__pyx_t_8 == Py_None);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(__pyx_t_1)) {

        /* "src/lxml/xslt.pxi":286
 *             for ns_name_tuple, extension in extensions.items():
 *                 if ns_name_tuple[0] is None:
 *                     raise XSLTExtensionError, \             # <<<<<<<<<<<<<<
 *                         "extensions must not have empty namespaces"
 *                 if isinstance(extension, XSLTExtension):
*/
        __Pyx_Raise(((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XSLTExtensionError), __pyx_mstate_global->__pyx_kp_u_extensions_must_not_have_empty_n, 0, 0);
        __PYX_ERR(3, 286, __pyx_L1_error)

        /* "src/lxml/xslt.pxi":285
 *         if extensions is not None and extensions:
 *             for ns_name_tuple, extension in extensions.items():
 *                 if ns_name_tuple[0] is None:             # <<<<<<<<<<<<<<
 *                     raise XSLTExtensionError, \
 *                         "extensions must not have empty namespaces"
*/
      }

      /* "src/lxml/xslt.pxi":288
 *                     raise XSLTExtensionError, \
 *                         "extensions must not have empty namespaces"
 *                 if isinstance(extension, XSLTExtension):             # <<<<<<<<<<<<<<
 *                     if self._extension_elements is EMPTY_DICT:
 *                         self._extension_elements = {}
*/
      __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_extension, __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XSLTExtension); 
      if (__pyx_t_1) {

        /* "src/lxml/xslt.pxi":289
 *                         "extensions must not have empty namespaces"
 *                 if isinstance(extension, XSLTExtension):
 *                     if self._extension_elements is EMPTY_DICT:             # <<<<<<<<<<<<<<
 *                         self._extension_elements = {}
 *                         extensions = extensions.copy()
*/
        __pyx_t_1 = (__pyx_v_self->_extension_elements == __pyx_v_4lxml_5etree_EMPTY_DICT);
        if (__pyx_t_1) {

          /* "src/lxml/xslt.pxi":290
 *                 if isinstance(extension, XSLTExtension):
 *                     if self._extension_elements is EMPTY_DICT:
 *                         self._extension_elements = {}             # <<<<<<<<<<<<<<
 *                         extensions = extensions.copy()
 *                     ns_utf   = _utf8(ns_name_tuple[0])
*/
          __pyx_t_8 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 290, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_GIVEREF(__pyx_t_8);
          __Pyx_GOTREF(__pyx_v_self->_extension_elements);
          __Pyx_DECREF(__pyx_v_self->_extension_elements);
          __pyx_v_self->_extension_elements = ((PyObject*)__pyx_t_8);
          __pyx_t_8 = 0;

          /* "src/lxml/xslt.pxi":291
 *                     if self._extension_elements is EMPTY_DICT:
 *                         self._extension_elements = {}
 *                         extensions = extensions.copy()             # <<<<<<<<<<<<<<
 *                     ns_utf   = _utf8(ns_name_tuple[0])
 *                     name_utf = _utf8(ns_name_tuple[1])
*/
          __pyx_t_7 = __pyx_v_extensions;
          __Pyx_INCREF(__pyx_t_7);
          __pyx_t_10 = 0;
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_7, NULL};
            __pyx_t_8 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_copy, __pyx_callargs+__pyx_t_10, (1-__pyx_t_10) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
            if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 291, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_8);
          }
          __Pyx_DECREF_SET(__pyx_v_extensions, __pyx_t_8);
          __pyx_t_8 = 0;

          /* "src/lxml/xslt.pxi":289
 *                         "extensions must not have empty namespaces"
 *                 if isinstance(extension, XSLTExtension):
 *                     if self._extension_elements is EMPTY_DICT:             # <<<<<<<<<<<<<<
 *                         self._extension_elements = {}
 *                         extensions = extensions.copy()
*/
        }

        /* "src/lxml/xslt.pxi":292
 *                         self._extension_elements = {}
 *                         extensions = extensions.copy()
 *                     ns_utf   = _utf8(ns_name_tuple[0])             # <<<<<<<<<<<<<<
 *                     name_utf = _utf8(ns_name_tuple[1])
 *                     self._extension_elements[(ns_utf, name_utf)] = extension
*/
        __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_ns_name_tuple, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 292, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_7 = __pyx_f_4lxml_5etree__utf8(__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(3, 292, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_XDECREF_SET(__pyx_v_ns_utf, ((PyObject*)__pyx_t_7));
        __pyx_t_7 = 0;

        /* "src/lxml/xslt.pxi":293
 *                         extensions = extensions.copy()
 *                     ns_utf   = _utf8(ns_name_tuple[0])
 *                     name_utf = _utf8(ns_name_tuple[1])             # <<<<<<<<<<<<<<
 *                     self._extension_elements[(ns_utf, name_utf)] = extension
 *                     del extensions[ns_name_tuple]
*/
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_ns_name_tuple, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_7)) __PYX_ERR(3, 293, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_8 = __pyx_f_4lxml_5etree__utf8(__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 293, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF_SET(__pyx_v_name_utf, ((PyObject*)__pyx_t_8));
        __pyx_t_8 = 0;

        /* "src/lxml/xslt.pxi":294
 *                     ns_utf   = _utf8(ns_name_tuple[0])
 *                     name_utf = _utf8(ns_name_tuple[1])
 *                     self._extension_elements[(ns_utf, name_utf)] = extension             # <<<<<<<<<<<<<<
 *                     del extensions[ns_name_tuple]
 *         _BaseContext.__init__(self, namespaces, extensions, error_log, enable_regexp,
*/
        if (unlikely(__pyx_v_self->_extension_elements == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(3, 294, __pyx_L1_error)
        }
        __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 294, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_INCREF(__pyx_v_ns_utf);
        __Pyx_GIVEREF(__pyx_v_ns_utf);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_ns_utf) != (0)) __PYX_ERR(3, 294, __pyx_L1_error);
        __Pyx_INCREF(__pyx_v_name_utf);
        __Pyx_GIVEREF(__pyx_v_name_utf);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_name_utf) != (0)) __PYX_ERR(3, 294, __pyx_L1_error);
        if (unlikely((PyDict_SetItem(__pyx_v_self->_extension_elements, __pyx_t_8, __pyx_v_extension) < 0))) __PYX_ERR(3, 294, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

        /* "src/lxml/xslt.pxi":295
 *                     name_utf = _utf8(ns_name_tuple[1])
 *                     self._extension_elements[(ns_utf, name_utf)] = extension
 *                     del extensions[ns_name_tuple]             # <<<<<<<<<<<<<<
 *         _BaseContext.__init__(self, namespaces, extensions, error_log, enable_regexp,
 *                               build_smart_strings)
*/
        if (unlikely((PyObject_DelItem(__pyx_v_extensions, __pyx_v_ns_name_tuple) < 0))) __PYX_ERR(3, 295, __pyx_L1_error)

        /* "src/lxml/xslt.pxi":288
 *                     raise XSLTExtensionError, \
 *                         "extensions must not have empty namespaces"
 *                 if isinstance(extension, XSLTExtension):             # <<<<<<<<<<<<<<
 *                     if self._extension_elements is EMPTY_DICT:
 *                         self._extension_elements = {}
*/
      }
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/xslt.pxi":283
 *     def __init__(self, namespaces, extensions, error_log, enable_regexp,
 *                  build_smart_strings):
 *         if extensions is not None and extensions:             # <<<<<<<<<<<<<<
 *             for ns_name_tuple, extension in extensions.items():
 *                 if ns_name_tuple[0] is None:
*/
  }

  /* "src/lxml/xslt.pxi":296
 *                     self._extension_elements[(ns_utf, name_utf)] = extension
 *                     del extensions[ns_name_tuple]
 *         _BaseContext.__init__(self, namespaces, extensions, error_log, enable_regexp,             # <<<<<<<<<<<<<<
 *                               build_smart_strings)
 * 
*/
  __pyx_t_8 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__BaseContext);
  __Pyx_INCREF(__pyx_t_8);

  /* "src/lxml/xslt.pxi":297
 *                     del extensions[ns_name_tuple]
 *         _BaseContext.__init__(self, namespaces, extensions, error_log, enable_regexp,
 *                               build_smart_strings)             # <<<<<<<<<<<<<<
 * 
 *     cdef _BaseContext _copy(self):
*/
  __pyx_t_10 = 0;
  {
    PyObject *__pyx_callargs[7] = {__pyx_t_8, ((PyObject *)__pyx_v_self), __pyx_v_namespaces, __pyx_v_extensions, __pyx_v_error_log, __pyx_v_enable_regexp, __pyx_v_build_smart_strings};
    __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_init, __pyx_callargs+__pyx_t_10, (7-__pyx_t_10) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 296, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/xslt.pxi":281
 *         self._extension_elements = EMPTY_DICT
 * 
 *     def __init__(self, namespaces, extensions, error_log, enable_regexp,             # <<<<<<<<<<<<<<
 *                  build_smart_strings):
 *         if extensions is not None and extensions:
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("lxml.etree._XSLTContext.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ns_name_tuple);
  __Pyx_XDECREF(__pyx_v_extension);
  __Pyx_XDECREF(__pyx_v_ns_utf);
  __Pyx_XDECREF(__pyx_v_name_utf);
  __Pyx_XDECREF(__pyx_v_extensions);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xslt.pxi":299
 *                               build_smart_strings)
 * 
 *     cdef _BaseContext _copy(self):             # <<<<<<<<<<<<<<
 *         cdef _XSLTContext context
 *         context = <_XSLTContext>_BaseContext._copy(self)
*/

static struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_f_4lxml_5etree_12_XSLTContext__copy(struct __pyx_obj_4lxml_5etree__XSLTContext *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree__XSLTContext *__pyx_v_context = 0;
  struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_copy", 0);

  /* "src/lxml/xslt.pxi":301
 *     cdef _BaseContext _copy(self):
 *         cdef _XSLTContext context
 *         context = <_XSLTContext>_BaseContext._copy(self)             # <<<<<<<<<<<<<<
 *         context._extension_elements = self._extension_elements
 *         return context
*/
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree_12_BaseContext__copy(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self))); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 301, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_t_1;
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__XSLTContext *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/xslt.pxi":302
 *         cdef _XSLTContext context
 *         context = <_XSLTContext>_BaseContext._copy(self)
 *         context._extension_elements = self._extension_elements             # <<<<<<<<<<<<<<
 *         return context
 * 
*/
  __pyx_t_2 = __pyx_v_self->_extension_elements;
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_context->_extension_elements);
  __Pyx_DECREF(__pyx_v_context->_extension_elements);
  __pyx_v_context->_extension_elements = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/xslt.pxi":303
 *         context = <_XSLTContext>_BaseContext._copy(self)
 *         context._extension_elements = self._extension_elements
 *         return context             # <<<<<<<<<<<<<<
 * 
 *     cdef register_context(self, xslt.xsltTransformContext* xsltCtxt,
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_context);
  __pyx_r = ((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_context);
  goto __pyx_L0;

  /* "src/lxml/xslt.pxi":299
 *                               build_smart_strings)
 * 
 *     cdef _BaseContext _copy(self):             # <<<<<<<<<<<<<<
 *         cdef _XSLTContext context
 *         context = <_XSLTContext>_BaseContext._copy(self)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._XSLTContext._copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xslt.pxi":305
 *         return context
 * 
 *     cdef register_context(self, xslt.xsltTransformContext* xsltCtxt,             # <<<<<<<<<<<<<<
 *                                _Document doc):
 *         self._xsltCtxt = xsltCtxt
*/

static PyObject *__pyx_f_4lxml_5etree_12_XSLTContext_register_context(struct __pyx_obj_4lxml_5etree__XSLTContext *__pyx_v_self, xsltTransformContext *__pyx_v_xsltCtxt, struct LxmlDocument *__pyx_v_doc) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("register_context", 0);

  /* "src/lxml/xslt.pxi":307
 *     cdef register_context(self, xslt.xsltTransformContext* xsltCtxt,
 *                                _Document doc):
 *         self._xsltCtxt = xsltCtxt             # <<<<<<<<<<<<<<
 *         self._set_xpath_context(xsltCtxt.xpathCtxt)
 *         self._register_context(doc)
*/
  __pyx_v_self->_xsltCtxt = __pyx_v_xsltCtxt;

  /* "src/lxml/xslt.pxi":308
 *                                _Document doc):
 *         self._xsltCtxt = xsltCtxt
 *         self._set_xpath_context(xsltCtxt.xpathCtxt)             # <<<<<<<<<<<<<<
 *         self._register_context(doc)
 *         self.registerLocalFunctions(xsltCtxt, _register_xslt_function)
*/
  ((struct __pyx_vtabstruct_4lxml_5etree__XSLTContext *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._set_xpath_context(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self), __pyx_v_xsltCtxt->xpathCtxt);

  /* "src/lxml/xslt.pxi":309
 *         self._xsltCtxt = xsltCtxt
 *         self._set_xpath_context(xsltCtxt.xpathCtxt)
 *         self._register_context(doc)             # <<<<<<<<<<<<<<
 *         self.registerLocalFunctions(xsltCtxt, _register_xslt_function)
 *         self.registerGlobalFunctions(xsltCtxt, _register_xslt_function)
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_12_BaseContext__register_context(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self), __pyx_v_doc); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 309, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xslt.pxi":310
 *         self._set_xpath_context(xsltCtxt.xpathCtxt)
 *         self._register_context(doc)
 *         self.registerLocalFunctions(xsltCtxt, _register_xslt_function)             # <<<<<<<<<<<<<<
 *         self.registerGlobalFunctions(xsltCtxt, _register_xslt_function)
 *         _registerXSLTExtensions(xsltCtxt, self._extension_elements)
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__XSLTContext *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.registerLocalFunctions(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self), __pyx_v_xsltCtxt, __pyx_f_4lxml_5etree__register_xslt_function); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xslt.pxi":311
 *         self._register_context(doc)
 *         self.registerLocalFunctions(xsltCtxt, _register_xslt_function)
 *         self.registerGlobalFunctions(xsltCtxt, _register_xslt_function)             # <<<<<<<<<<<<<<
 *         _registerXSLTExtensions(xsltCtxt, self._extension_elements)
 * 
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__XSLTContext *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.registerGlobalFunctions(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self), __pyx_v_xsltCtxt, __pyx_f_4lxml_5etree__register_xslt_function); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 311, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xslt.pxi":312
 *         self.registerLocalFunctions(xsltCtxt, _register_xslt_function)
 *         self.registerGlobalFunctions(xsltCtxt, _register_xslt_function)
 *         _registerXSLTExtensions(xsltCtxt, self._extension_elements)             # <<<<<<<<<<<<<<
 * 
 *     cdef free_context(self):
*/
  __pyx_t_1 = __pyx_v_self->_extension_elements;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__registerXSLTExtensions(__pyx_v_xsltCtxt, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 312, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/xslt.pxi":305
 *         return context
 * 
 *     cdef register_context(self, xslt.xsltTransformContext* xsltCtxt,             # <<<<<<<<<<<<<<
 *                                _Document doc):
 *         self._xsltCtxt = xsltCtxt
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._XSLTContext.register_context", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xslt.pxi":314
 *         _registerXSLTExtensions(xsltCtxt, self._extension_elements)
 * 
 *     cdef free_context(self):             # <<<<<<<<<<<<<<
 *         self._cleanup_context()
 *         self._release_context()
*/

static PyObject *__pyx_f_4lxml_5etree_12_XSLTContext_free_context(struct __pyx_obj_4lxml_5etree__XSLTContext *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("free_context", 0);

  /* "src/lxml/xslt.pxi":315
 * 
 *     cdef free_context(self):
 *         self._cleanup_context()             # <<<<<<<<<<<<<<
 *         self._release_context()
 *         if self._xsltCtxt is not NULL:
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_12_BaseContext__cleanup_context(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 315, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xslt.pxi":316
 *     cdef free_context(self):
 *         self._cleanup_context()
 *         self._release_context()             # <<<<<<<<<<<<<<
 *         if self._xsltCtxt is not NULL:
 *             xslt.xsltFreeTransformContext(self._xsltCtxt)
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_12_BaseContext__release_context(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 316, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xslt.pxi":317
 *         self._cleanup_context()
 *         self._release_context()
 *         if self._xsltCtxt is not NULL:             # <<<<<<<<<<<<<<
 *             xslt.xsltFreeTransformContext(self._xsltCtxt)
 *             self._xsltCtxt = NULL
*/
  __pyx_t_2 = (__pyx_v_self->_xsltCtxt != NULL);
  if (__pyx_t_2) {

    /* "src/lxml/xslt.pxi":318
 *         self._release_context()
 *         if self._xsltCtxt is not NULL:
 *             xslt.xsltFreeTransformContext(self._xsltCtxt)             # <<<<<<<<<<<<<<
 *             self._xsltCtxt = NULL
 *         self._release_temp_refs()
*/
    xsltFreeTransformContext(__pyx_v_self->_xsltCtxt);

    /* "src/lxml/xslt.pxi":319
 *         if self._xsltCtxt is not NULL:
 *             xslt.xsltFreeTransformContext(self._xsltCtxt)
 *             self._xsltCtxt = NULL             # <<<<<<<<<<<<<<
 *         self._release_temp_refs()
 * 
*/
    __pyx_v_self->_xsltCtxt = NULL;

    /* "src/lxml/xslt.pxi":317
 *         self._cleanup_context()
 *         self._release_context()
 *         if self._xsltCtxt is not NULL:             # <<<<<<<<<<<<<<
 *             xslt.xsltFreeTransformContext(self._xsltCtxt)
 *             self._xsltCtxt = NULL
*/
  }

  /* "src/lxml/xslt.pxi":320
 *             xslt.xsltFreeTransformContext(self._xsltCtxt)
 *             self._xsltCtxt = NULL
 *         self._release_temp_refs()             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_12_BaseContext__release_temp_refs(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 320, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xslt.pxi":314
 *         _registerXSLTExtensions(xsltCtxt, self._extension_elements)
 * 
 *     cdef free_context(self):             # <<<<<<<<<<<<<<
 *         self._cleanup_context()
 *         self._release_context()
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._XSLTContext.free_context", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xslt.pxi":331
 *     """
 *     cdef bytes strval
 *     def __cinit__(self, strval):             # <<<<<<<<<<<<<<
 *         self.strval = _utf8(strval)
 * 
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_22_XSLTQuotedStringParam_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_22_XSLTQuotedStringParam_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_strval = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_strval,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(3, 331, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(3, 331, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__cinit__", 0) < (0)) __PYX_ERR(3, 331, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, i); __PYX_ERR(3, 331, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(3, 331, __pyx_L3_error)
    }
    __pyx_v_strval = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, __pyx_nargs); __PYX_ERR(3, 331, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._XSLTQuotedStringParam.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_22_XSLTQuotedStringParam___cinit__(((struct __pyx_obj_4lxml_5etree__XSLTQuotedStringParam *)__pyx_v_self), __pyx_v_strval);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_22_XSLTQuotedStringParam___cinit__(struct __pyx_obj_4lxml_5etree__XSLTQuotedStringParam *__pyx_v_self, PyObject *__pyx_v_strval) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "src/lxml/xslt.pxi":332
 *     cdef bytes strval
 *     def __cinit__(self, strval):
 *         self.strval = _utf8(strval)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__utf8(__pyx_v_strval); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 332, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->strval);
  __Pyx_DECREF(__pyx_v_self->strval);
  __pyx_v_self->strval = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xslt.pxi":331
 *     """
 *     cdef bytes strval
 *     def __cinit__(self, strval):             # <<<<<<<<<<<<<<
 *         self.strval = _utf8(strval)
 * 
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._XSLTQuotedStringParam.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xslt.pxi":369
 *     cdef _ErrorLog _error_log
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._c_style = NULL
 * 
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_4XSLT_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_4XSLT_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, __pyx_nargs); return -1; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return -1;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__cinit__", __pyx_kwds); return -1;}
  __pyx_r = __pyx_pf_4lxml_5etree_4XSLT___cinit__(((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_4XSLT___cinit__(struct __pyx_obj_4lxml_5etree_XSLT *__pyx_v_self) {
  int __pyx_r;

  /* "src/lxml/xslt.pxi":370
 * 
 *     def __cinit__(self):
 *         self._c_style = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, xslt_input, *, extensions=None, regexp=True,
*/
  __pyx_v_self->_c_style = NULL;

  /* "src/lxml/xslt.pxi":369
 *     cdef _ErrorLog _error_log
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._c_style = NULL
 * 
*/

  /* function exit code */
  __pyx_r = 0;
  return __pyx_r;
}

/* "src/lxml/xslt.pxi":372
 *         self._c_style = NULL
 * 
 *     def __init__(self, xslt_input, *, extensions=None, regexp=True,             # <<<<<<<<<<<<<<
 *                  access_control=None):
 *         cdef xslt.xsltStylesheet* c_style = NULL
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_4XSLT_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_4XSLT_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_xslt_input = 0;
  PyObject *__pyx_v_extensions = 0;
  PyObject *__pyx_v_regexp = 0;
  PyObject *__pyx_v_access_control = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[4] = {0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_xslt_input,&__pyx_mstate_global->__pyx_n_u_extensions,&__pyx_mstate_global->__pyx_n_u_regexp,&__pyx_mstate_global->__pyx_n_u_access_control,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(3, 372, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(3, 372, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(3, 372, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_True));

      /* "src/lxml/xslt.pxi":373
 * 
 *     def __init__(self, xslt_input, *, extensions=None, regexp=True,
 *                  access_control=None):             # <<<<<<<<<<<<<<
 *         cdef xslt.xsltStylesheet* c_style = NULL
 *         cdef xmlDoc* c_doc
*/
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, i); __PYX_ERR(3, 372, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(3, 372, __pyx_L3_error)

      /* "src/lxml/xslt.pxi":372
 *         self._c_style = NULL
 * 
 *     def __init__(self, xslt_input, *, extensions=None, regexp=True,             # <<<<<<<<<<<<<<
 *                  access_control=None):
 *         cdef xslt.xsltStylesheet* c_style = NULL
*/
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_True));

      /* "src/lxml/xslt.pxi":373
 * 
 *     def __init__(self, xslt_input, *, extensions=None, regexp=True,
 *                  access_control=None):             # <<<<<<<<<<<<<<
 *         cdef xslt.xsltStylesheet* c_style = NULL
 *         cdef xmlDoc* c_doc
*/
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_xslt_input = values[0];
    __pyx_v_extensions = values[1];
    __pyx_v_regexp = values[2];
    __pyx_v_access_control = values[3];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, __pyx_nargs); __PYX_ERR(3, 372, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.XSLT.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_4XSLT_2__init__(((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self), __pyx_v_xslt_input, __pyx_v_extensions, __pyx_v_regexp, __pyx_v_access_control);

  /* "src/lxml/xslt.pxi":372
 *         self._c_style = NULL
 * 
 *     def __init__(self, xslt_input, *, extensions=None, regexp=True,             # <<<<<<<<<<<<<<
 *                  access_control=None):
 *         cdef xslt.xsltStylesheet* c_style = NULL
*/

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_4XSLT_2__init__(struct __pyx_obj_4lxml_5etree_XSLT *__pyx_v_self, PyObject *__pyx_v_xslt_input, PyObject *__pyx_v_extensions, PyObject *__pyx_v_regexp, PyObject *__pyx_v_access_control) {
  xsltStylesheet *__pyx_v_c_style;
  xmlDoc *__pyx_v_c_doc;
  struct LxmlDocument *__pyx_v_doc = 0;
  struct LxmlElement *__pyx_v_root_node = 0;
  PyObject *__pyx_v_doc_url_utf = NULL;
  xmlExternalEntityLoader __pyx_v_orig_loader;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  xmlDoc *__pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5[3];
  size_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_t_13;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "src/lxml/xslt.pxi":374
 *     def __init__(self, xslt_input, *, extensions=None, regexp=True,
 *                  access_control=None):
 *         cdef xslt.xsltStylesheet* c_style = NULL             # <<<<<<<<<<<<<<
 *         cdef xmlDoc* c_doc
 *         cdef _Document doc
*/
  __pyx_v_c_style = NULL;

  /* "src/lxml/xslt.pxi":379
 *         cdef _Element root_node
 * 
 *         doc = _documentOrRaise(xslt_input)             # <<<<<<<<<<<<<<
 *         root_node = _rootNodeOrRaise(xslt_input)
 * 
*/
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__documentOrRaise(__pyx_v_xslt_input)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 379, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xslt.pxi":380
 * 
 *         doc = _documentOrRaise(xslt_input)
 *         root_node = _rootNodeOrRaise(xslt_input)             # <<<<<<<<<<<<<<
 * 
 *         # set access control or raise TypeError
*/
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__rootNodeOrRaise(__pyx_v_xslt_input)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 380, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_root_node = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xslt.pxi":383
 * 
 *         # set access control or raise TypeError
 *         self._access_control = access_control             # <<<<<<<<<<<<<<
 * 
 *         # make a copy of the document as stylesheet parsing modifies it
*/
  __pyx_t_1 = __pyx_v_access_control;
  __Pyx_INCREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XSLTAccessControl))))) __PYX_ERR(3, 383, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_access_control);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_access_control);
  __pyx_v_self->_access_control = ((struct __pyx_obj_4lxml_5etree_XSLTAccessControl *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xslt.pxi":386
 * 
 *         # make a copy of the document as stylesheet parsing modifies it
 *         c_doc = _copyDocRoot(doc._c_doc, root_node._c_node)             # <<<<<<<<<<<<<<
 * 
 *         # make sure we always have a stylesheet URL
*/
  __pyx_t_2 = __pyx_f_4lxml_5etree__copyDocRoot(__pyx_v_doc->_c_doc, __pyx_v_root_node->_c_node); if (unlikely(__pyx_t_2 == ((void *)NULL))) __PYX_ERR(3, 386, __pyx_L1_error)
  __pyx_v_c_doc = __pyx_t_2;

  /* "src/lxml/xslt.pxi":389
 * 
 *         # make sure we always have a stylesheet URL
 *         if c_doc.URL is NULL:             # <<<<<<<<<<<<<<
 *             doc_url_utf = python.PyUnicode_AsASCIIString(
 *                 f"string://__STRING__XSLT__/{id(self)}.xslt")
*/
  __pyx_t_3 = (__pyx_v_c_doc->URL == NULL);
  if (__pyx_t_3) {

    /* "src/lxml/xslt.pxi":391
 *         if c_doc.URL is NULL:
 *             doc_url_utf = python.PyUnicode_AsASCIIString(
 *                 f"string://__STRING__XSLT__/{id(self)}.xslt")             # <<<<<<<<<<<<<<
 *             c_doc.URL = tree.xmlStrdup(_xcstr(doc_url_utf))
 * 
*/
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 391, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_t_1, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 391, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5[0] = __pyx_mstate_global->__pyx_kp_u_string___STRING__XSLT_2;
    __pyx_t_5[1] = __pyx_t_4;
    __pyx_t_5[2] = __pyx_mstate_global->__pyx_kp_u_xslt_2;
    __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_5, 3, 26 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4) + 5, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4));
    if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 391, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "src/lxml/xslt.pxi":390
 *         # make sure we always have a stylesheet URL
 *         if c_doc.URL is NULL:
 *             doc_url_utf = python.PyUnicode_AsASCIIString(             # <<<<<<<<<<<<<<
 *                 f"string://__STRING__XSLT__/{id(self)}.xslt")
 *             c_doc.URL = tree.xmlStrdup(_xcstr(doc_url_utf))
*/
    __pyx_t_4 = PyUnicode_AsASCIIString(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 390, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_doc_url_utf = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "src/lxml/xslt.pxi":392
 *             doc_url_utf = python.PyUnicode_AsASCIIString(
 *                 f"string://__STRING__XSLT__/{id(self)}.xslt")
 *             c_doc.URL = tree.xmlStrdup(_xcstr(doc_url_utf))             # <<<<<<<<<<<<<<
 * 
 *         self._error_log = _ErrorLog()
*/
    __pyx_v_c_doc->URL = xmlStrdup((const xmlChar*)PyBytes_AS_STRING(__pyx_v_doc_url_utf));

    /* "src/lxml/xslt.pxi":389
 * 
 *         # make sure we always have a stylesheet URL
 *         if c_doc.URL is NULL:             # <<<<<<<<<<<<<<
 *             doc_url_utf = python.PyUnicode_AsASCIIString(
 *                 f"string://__STRING__XSLT__/{id(self)}.xslt")
*/
  }

  /* "src/lxml/xslt.pxi":394
 *             c_doc.URL = tree.xmlStrdup(_xcstr(doc_url_utf))
 * 
 *         self._error_log = _ErrorLog()             # <<<<<<<<<<<<<<
 *         self._xslt_resolver_context = _XSLTResolverContext()
 *         _initXSLTResolverContext(self._xslt_resolver_context, doc._parser)
*/
  __pyx_t_1 = NULL;
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL};
    __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ErrorLog, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 394, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_4);
  }
  __Pyx_GIVEREF((PyObject *)__pyx_t_4);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_error_log);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_error_log);
  __pyx_v_self->_error_log = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "src/lxml/xslt.pxi":395
 * 
 *         self._error_log = _ErrorLog()
 *         self._xslt_resolver_context = _XSLTResolverContext()             # <<<<<<<<<<<<<<
 *         _initXSLTResolverContext(self._xslt_resolver_context, doc._parser)
 *         # keep a copy in case we need to access the stylesheet via 'document()'
*/
  __pyx_t_1 = NULL;
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL};
    __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__XSLTResolverContext, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 395, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_4);
  }
  __Pyx_GIVEREF((PyObject *)__pyx_t_4);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_xslt_resolver_context);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_xslt_resolver_context);
  __pyx_v_self->_xslt_resolver_context = ((struct __pyx_obj_4lxml_5etree__XSLTResolverContext *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "src/lxml/xslt.pxi":396
 *         self._error_log = _ErrorLog()
 *         self._xslt_resolver_context = _XSLTResolverContext()
 *         _initXSLTResolverContext(self._xslt_resolver_context, doc._parser)             # <<<<<<<<<<<<<<
 *         # keep a copy in case we need to access the stylesheet via 'document()'
 *         self._xslt_resolver_context._c_style_doc = _copyDoc(c_doc, 1)
*/
  __pyx_t_4 = ((PyObject *)__pyx_v_self->_xslt_resolver_context);
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_1 = ((PyObject *)__pyx_v_doc->_parser);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_7 = __pyx_f_4lxml_5etree__initXSLTResolverContext(((struct __pyx_obj_4lxml_5etree__XSLTResolverContext *)__pyx_t_4), ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_1)); if (unlikely(!__pyx_t_7)) __PYX_ERR(3, 396, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "src/lxml/xslt.pxi":398
 *         _initXSLTResolverContext(self._xslt_resolver_context, doc._parser)
 *         # keep a copy in case we need to access the stylesheet via 'document()'
 *         self._xslt_resolver_context._c_style_doc = _copyDoc(c_doc, 1)             # <<<<<<<<<<<<<<
 *         c_doc._private = <python.PyObject*>self._xslt_resolver_context
 * 
*/
  __pyx_t_2 = __pyx_f_4lxml_5etree__copyDoc(__pyx_v_c_doc, 1); if (unlikely(__pyx_t_2 == ((void *)NULL))) __PYX_ERR(3, 398, __pyx_L1_error)
  __pyx_v_self->_xslt_resolver_context->_c_style_doc = __pyx_t_2;

  /* "src/lxml/xslt.pxi":399
 *         # keep a copy in case we need to access the stylesheet via 'document()'
 *         self._xslt_resolver_context._c_style_doc = _copyDoc(c_doc, 1)
 *         c_doc._private = <python.PyObject*>self._xslt_resolver_context             # <<<<<<<<<<<<<<
 * 
 *         with self._error_log:
*/
  __pyx_v_c_doc->_private = ((PyObject *)__pyx_v_self->_xslt_resolver_context);

  /* "src/lxml/xslt.pxi":401
 *         c_doc._private = <python.PyObject*>self._xslt_resolver_context
 * 
 *         with self._error_log:             # <<<<<<<<<<<<<<
 *             orig_loader = _register_document_loader()
 *             c_style = xslt.xsltParseStylesheetDoc(c_doc)
*/
  /*with:*/ {
    __pyx_t_8 = __Pyx_PyObject_LookupSpecial(((PyObject *)__pyx_v_self->_error_log), __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 401, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = __pyx_f_4lxml_5etree_9_ErrorLog___enter__(__pyx_v_self->_error_log); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(3, 401, __pyx_L4_error)
    /*try:*/ {
      {
        (void)__pyx_t_10; (void)__pyx_t_11; (void)__pyx_t_12; /* mark used */
        /*try:*/ {

          /* "src/lxml/xslt.pxi":402
 * 
 *         with self._error_log:
 *             orig_loader = _register_document_loader()             # <<<<<<<<<<<<<<
 *             c_style = xslt.xsltParseStylesheetDoc(c_doc)
 *             _reset_document_loader(orig_loader)
*/
          __pyx_v_orig_loader = __pyx_f_4lxml_5etree__register_document_loader();

          /* "src/lxml/xslt.pxi":403
 *         with self._error_log:
 *             orig_loader = _register_document_loader()
 *             c_style = xslt.xsltParseStylesheetDoc(c_doc)             # <<<<<<<<<<<<<<
 *             _reset_document_loader(orig_loader)
 * 
*/
          __pyx_v_c_style = xsltParseStylesheetDoc(__pyx_v_c_doc);

          /* "src/lxml/xslt.pxi":404
 *             orig_loader = _register_document_loader()
 *             c_style = xslt.xsltParseStylesheetDoc(c_doc)
 *             _reset_document_loader(orig_loader)             # <<<<<<<<<<<<<<
 * 
 *         if c_style is NULL or c_style.errors:
*/
          __pyx_f_4lxml_5etree__reset_document_loader(__pyx_v_orig_loader);

          /* "src/lxml/xslt.pxi":401
 *         c_doc._private = <python.PyObject*>self._xslt_resolver_context
 * 
 *         with self._error_log:             # <<<<<<<<<<<<<<
 *             orig_loader = _register_document_loader()
 *             c_style = xslt.xsltParseStylesheetDoc(c_doc)
*/
        }
      }
    }
    /*finally:*/ {
      /*normal exit:*/{
        if (__pyx_t_8) {
          __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_mstate_global->__pyx_tuple[3], NULL);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          if (unlikely(!__pyx_t_12)) __PYX_ERR(3, 401, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        }
        goto __pyx_L7;
      }
      __pyx_L7:;
    }
    goto __pyx_L14;
    __pyx_L4_error:;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    goto __pyx_L1_error;
    __pyx_L14:;
  }

  /* "src/lxml/xslt.pxi":406
 *             _reset_document_loader(orig_loader)
 * 
 *         if c_style is NULL or c_style.errors:             # <<<<<<<<<<<<<<
 *             tree.xmlFreeDoc(c_doc)
 *             if c_style is not NULL:
*/
  __pyx_t_13 = (__pyx_v_c_style == NULL);
  if (!__pyx_t_13) {
  } else {
    __pyx_t_3 = __pyx_t_13;
    goto __pyx_L16_bool_binop_done;
  }
  __pyx_t_13 = (__pyx_v_c_style->errors != 0);
  __pyx_t_3 = __pyx_t_13;
  __pyx_L16_bool_binop_done:;
  if (__pyx_t_3) {

    /* "src/lxml/xslt.pxi":407
 * 
 *         if c_style is NULL or c_style.errors:
 *             tree.xmlFreeDoc(c_doc)             # <<<<<<<<<<<<<<
 *             if c_style is not NULL:
 *                 xslt.xsltFreeStylesheet(c_style)
*/
    xmlFreeDoc(__pyx_v_c_doc);

    /* "src/lxml/xslt.pxi":408
 *         if c_style is NULL or c_style.errors:
 *             tree.xmlFreeDoc(c_doc)
 *             if c_style is not NULL:             # <<<<<<<<<<<<<<
 *                 xslt.xsltFreeStylesheet(c_style)
 *             self._xslt_resolver_context._raise_if_stored()
*/
    __pyx_t_3 = (__pyx_v_c_style != NULL);
    if (__pyx_t_3) {

      /* "src/lxml/xslt.pxi":409
 *             tree.xmlFreeDoc(c_doc)
 *             if c_style is not NULL:
 *                 xslt.xsltFreeStylesheet(c_style)             # <<<<<<<<<<<<<<
 *             self._xslt_resolver_context._raise_if_stored()
 *             # last error seems to be the most accurate here
*/
      xsltFreeStylesheet(__pyx_v_c_style);

      /* "src/lxml/xslt.pxi":408
 *         if c_style is NULL or c_style.errors:
 *             tree.xmlFreeDoc(c_doc)
 *             if c_style is not NULL:             # <<<<<<<<<<<<<<
 *                 xslt.xsltFreeStylesheet(c_style)
 *             self._xslt_resolver_context._raise_if_stored()
*/
    }

    /* "src/lxml/xslt.pxi":410
 *             if c_style is not NULL:
 *                 xslt.xsltFreeStylesheet(c_style)
 *             self._xslt_resolver_context._raise_if_stored()             # <<<<<<<<<<<<<<
 *             # last error seems to be the most accurate here
 *             if self._error_log.last_error is not None and \
*/
    __pyx_t_9 = __pyx_f_4lxml_5etree_17_ExceptionContext__raise_if_stored(((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_v_self->_xslt_resolver_context)); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(3, 410, __pyx_L1_error)

    /* "src/lxml/xslt.pxi":412
 *             self._xslt_resolver_context._raise_if_stored()
 *             # last error seems to be the most accurate here
 *             if self._error_log.last_error is not None and \             # <<<<<<<<<<<<<<
 *                     self._error_log.last_error.message:
 *                 raise XSLTParseError(self._error_log.last_error.message,
*/
    __pyx_t_13 = (__pyx_v_self->_error_log->__pyx_base.__pyx_base.last_error != Py_None);
    if (__pyx_t_13) {
    } else {
      __pyx_t_3 = __pyx_t_13;
      goto __pyx_L20_bool_binop_done;
    }

    /* "src/lxml/xslt.pxi":413
 *             # last error seems to be the most accurate here
 *             if self._error_log.last_error is not None and \
 *                     self._error_log.last_error.message:             # <<<<<<<<<<<<<<
 *                 raise XSLTParseError(self._error_log.last_error.message,
 *                                      self._error_log)
*/
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_error_log->__pyx_base.__pyx_base.last_error, __pyx_mstate_global->__pyx_n_u_message); if (unlikely(!__pyx_t_7)) __PYX_ERR(3, 413, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_13 < 0))) __PYX_ERR(3, 413, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_3 = __pyx_t_13;
    __pyx_L20_bool_binop_done:;

    /* "src/lxml/xslt.pxi":412
 *             self._xslt_resolver_context._raise_if_stored()
 *             # last error seems to be the most accurate here
 *             if self._error_log.last_error is not None and \             # <<<<<<<<<<<<<<
 *                     self._error_log.last_error.message:
 *                 raise XSLTParseError(self._error_log.last_error.message,
*/
    if (unlikely(__pyx_t_3)) {

      /* "src/lxml/xslt.pxi":414
 *             if self._error_log.last_error is not None and \
 *                     self._error_log.last_error.message:
 *                 raise XSLTParseError(self._error_log.last_error.message,             # <<<<<<<<<<<<<<
 *                                      self._error_log)
 *             else:
*/
      __pyx_t_1 = NULL;
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_error_log->__pyx_base.__pyx_base.last_error, __pyx_mstate_global->__pyx_n_u_message); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 414, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);

      /* "src/lxml/xslt.pxi":415
 *                     self._error_log.last_error.message:
 *                 raise XSLTParseError(self._error_log.last_error.message,
 *                                      self._error_log)             # <<<<<<<<<<<<<<
 *             else:
 *                 raise XSLTParseError(
*/
      __pyx_t_6 = 1;
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_1, __pyx_t_4, ((PyObject *)__pyx_v_self->_error_log)};
        __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XSLTParseError, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_7)) __PYX_ERR(3, 414, __pyx_L1_error)
        __Pyx_GOTREF((PyObject *)__pyx_t_7);
      }
      __Pyx_Raise(((PyObject *)__pyx_t_7), 0, 0, 0);
      __Pyx_DECREF((PyObject *)__pyx_t_7); __pyx_t_7 = 0;
      __PYX_ERR(3, 414, __pyx_L1_error)

      /* "src/lxml/xslt.pxi":412
 *             self._xslt_resolver_context._raise_if_stored()
 *             # last error seems to be the most accurate here
 *             if self._error_log.last_error is not None and \             # <<<<<<<<<<<<<<
 *                     self._error_log.last_error.message:
 *                 raise XSLTParseError(self._error_log.last_error.message,
*/
    }

    /* "src/lxml/xslt.pxi":417
 *                                      self._error_log)
 *             else:
 *                 raise XSLTParseError(             # <<<<<<<<<<<<<<
 *                     self._error_log._buildExceptionMessage(
 *                         "Cannot parse stylesheet"),
*/
    /*else*/ {
      __pyx_t_4 = NULL;

      /* "src/lxml/xslt.pxi":418
 *             else:
 *                 raise XSLTParseError(
 *                     self._error_log._buildExceptionMessage(             # <<<<<<<<<<<<<<
 *                         "Cannot parse stylesheet"),
 *                     self._error_log)
*/
      __pyx_t_1 = __pyx_f_4lxml_5etree_13_BaseErrorLog__buildExceptionMessage(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self->_error_log), __pyx_mstate_global->__pyx_kp_u_Cannot_parse_stylesheet); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 418, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);

      /* "src/lxml/xslt.pxi":420
 *                     self._error_log._buildExceptionMessage(
 *                         "Cannot parse stylesheet"),
 *                     self._error_log)             # <<<<<<<<<<<<<<
 * 
 *         c_doc._private = NULL # no longer used!
*/
      __pyx_t_6 = 1;
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_t_1, ((PyObject *)__pyx_v_self->_error_log)};
        __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XSLTParseError, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(!__pyx_t_7)) __PYX_ERR(3, 417, __pyx_L1_error)
        __Pyx_GOTREF((PyObject *)__pyx_t_7);
      }
      __Pyx_Raise(((PyObject *)__pyx_t_7), 0, 0, 0);
      __Pyx_DECREF((PyObject *)__pyx_t_7); __pyx_t_7 = 0;
      __PYX_ERR(3, 417, __pyx_L1_error)
    }

    /* "src/lxml/xslt.pxi":406
 *             _reset_document_loader(orig_loader)
 * 
 *         if c_style is NULL or c_style.errors:             # <<<<<<<<<<<<<<
 *             tree.xmlFreeDoc(c_doc)
 *             if c_style is not NULL:
*/
  }

  /* "src/lxml/xslt.pxi":422
 *                     self._error_log)
 * 
 *         c_doc._private = NULL # no longer used!             # <<<<<<<<<<<<<<
 *         self._c_style = c_style
 *         self._context = _XSLTContext(None, extensions, self._error_log, regexp, True)
*/
  __pyx_v_c_doc->_private = NULL;

  /* "src/lxml/xslt.pxi":423
 * 
 *         c_doc._private = NULL # no longer used!
 *         self._c_style = c_style             # <<<<<<<<<<<<<<
 *         self._context = _XSLTContext(None, extensions, self._error_log, regexp, True)
 * 
*/
  __pyx_v_self->_c_style = __pyx_v_c_style;

  /* "src/lxml/xslt.pxi":424
 *         c_doc._private = NULL # no longer used!
 *         self._c_style = c_style
 *         self._context = _XSLTContext(None, extensions, self._error_log, regexp, True)             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
*/
  __pyx_t_1 = NULL;
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[6] = {__pyx_t_1, Py_None, __pyx_v_extensions, ((PyObject *)__pyx_v_self->_error_log), __pyx_v_regexp, Py_True};
    __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__XSLTContext, __pyx_callargs+__pyx_t_6, (6-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_7)) __PYX_ERR(3, 424, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_7);
  }
  __Pyx_GIVEREF((PyObject *)__pyx_t_7);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_context);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_context);
  __pyx_v_self->_context = ((struct __pyx_obj_4lxml_5etree__XSLTContext *)__pyx_t_7);
  __pyx_t_7 = 0;

  /* "src/lxml/xslt.pxi":372
 *         self._c_style = NULL
 * 
 *     def __init__(self, xslt_input, *, extensions=None, regexp=True,             # <<<<<<<<<<<<<<
 *                  access_control=None):
 *         cdef xslt.xsltStylesheet* c_style = NULL
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree.XSLT.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XDECREF((PyObject *)__pyx_v_root_node);
  __Pyx_XDECREF(__pyx_v_doc_url_utf);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xslt.pxi":426
 *         self._context = _XSLTContext(None, extensions, self._error_log, regexp, True)
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._xslt_resolver_context is not None and \
 *                self._xslt_resolver_context._c_style_doc is not NULL:
*/

/* Python wrapper */
static void __pyx_pw_4lxml_5etree_4XSLT_5__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_4lxml_5etree_4XSLT_5__dealloc__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_pf_4lxml_5etree_4XSLT_4__dealloc__(((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_4lxml_5etree_4XSLT_4__dealloc__(struct __pyx_obj_4lxml_5etree_XSLT *__pyx_v_self) {
  int __pyx_t_1;
  int __pyx_t_2;

  /* "src/lxml/xslt.pxi":427
 * 
 *     def __dealloc__(self):
 *         if self._xslt_resolver_context is not None and \             # <<<<<<<<<<<<<<
 *                self._xslt_resolver_context._c_style_doc is not NULL:
 *             tree.xmlFreeDoc(self._xslt_resolver_context._c_style_doc)
*/
  __pyx_t_2 = (((PyObject *)__pyx_v_self->_xslt_resolver_context) != Py_None);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }

  /* "src/lxml/xslt.pxi":428
 *     def __dealloc__(self):
 *         if self._xslt_resolver_context is not None and \
 *                self._xslt_resolver_context._c_style_doc is not NULL:             # <<<<<<<<<<<<<<
 *             tree.xmlFreeDoc(self._xslt_resolver_context._c_style_doc)
 *         # this cleans up the doc copy as well
*/
  __pyx_t_2 = (__pyx_v_self->_xslt_resolver_context->_c_style_doc != NULL);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;

  /* "src/lxml/xslt.pxi":427
 * 
 *     def __dealloc__(self):
 *         if self._xslt_resolver_context is not None and \             # <<<<<<<<<<<<<<
 *                self._xslt_resolver_context._c_style_doc is not NULL:
 *             tree.xmlFreeDoc(self._xslt_resolver_context._c_style_doc)
*/
  if (__pyx_t_1) {

    /* "src/lxml/xslt.pxi":429
 *         if self._xslt_resolver_context is not None and \
 *                self._xslt_resolver_context._c_style_doc is not NULL:
 *             tree.xmlFreeDoc(self._xslt_resolver_context._c_style_doc)             # <<<<<<<<<<<<<<
 *         # this cleans up the doc copy as well
 *         if self._c_style is not NULL:
*/
    xmlFreeDoc(__pyx_v_self->_xslt_resolver_context->_c_style_doc);

    /* "src/lxml/xslt.pxi":427
 * 
 *     def __dealloc__(self):
 *         if self._xslt_resolver_context is not None and \             # <<<<<<<<<<<<<<
 *                self._xslt_resolver_context._c_style_doc is not NULL:
 *             tree.xmlFreeDoc(self._xslt_resolver_context._c_style_doc)
*/
  }

  /* "src/lxml/xslt.pxi":431
 *             tree.xmlFreeDoc(self._xslt_resolver_context._c_style_doc)
 *         # this cleans up the doc copy as well
 *         if self._c_style is not NULL:             # <<<<<<<<<<<<<<
 *             xslt.xsltFreeStylesheet(self._c_style)
 * 
*/
  __pyx_t_1 = (__pyx_v_self->_c_style != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/xslt.pxi":432
 *         # this cleans up the doc copy as well
 *         if self._c_style is not NULL:
 *             xslt.xsltFreeStylesheet(self._c_style)             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
    xsltFreeStylesheet(__pyx_v_self->_c_style);

    /* "src/lxml/xslt.pxi":431
 *             tree.xmlFreeDoc(self._xslt_resolver_context._c_style_doc)
 *         # this cleans up the doc copy as well
 *         if self._c_style is not NULL:             # <<<<<<<<<<<<<<
 *             xslt.xsltFreeStylesheet(self._c_style)
 * 
*/
  }

  /* "src/lxml/xslt.pxi":426
 *         self._context = _XSLTContext(None, extensions, self._error_log, regexp, True)
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._xslt_resolver_context is not None and \
 *                self._xslt_resolver_context._c_style_doc is not NULL:
*/

  /* function exit code */
}

/* "src/lxml/xslt.pxi":434
 *             xslt.xsltFreeStylesheet(self._c_style)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def error_log(self):
 *         """The log of errors and warnings of an XSLT execution."""
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_4XSLT_9error_log_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_4XSLT_9error_log_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_4XSLT_9error_log___get__(((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_4XSLT_9error_log___get__(struct __pyx_obj_4lxml_5etree_XSLT *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "src/lxml/xslt.pxi":437
 *     def error_log(self):
 *         """The log of errors and warnings of an XSLT execution."""
 *         return self._error_log.copy()             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)__pyx_v_self->_error_log->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.copy(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self->_error_log), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 437, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/xslt.pxi":434
 *             xslt.xsltFreeStylesheet(self._c_style)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def error_log(self):
 *         """The log of errors and warnings of an XSLT execution."""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.XSLT.error_log.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xslt.pxi":439
 *         return self._error_log.copy()
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def strparam(strval):
 *         """strparam(strval)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_4XSLT_7strparam(CYTHON_UNUSED PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_4XSLT_6strparam, "strparam(strval)\n\n        Mark an XSLT string parameter that requires quote escaping\n        before passing it into the transformation.  Use it like this::\n\n            result = transform(doc, some_strval = XSLT.strparam(\n                '''it's \"Monty Python's\" ...'''))\n\n        Escaped string parameters can be reused without restriction.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_4XSLT_7strparam = {"strparam", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_4XSLT_7strparam, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_4XSLT_6strparam};
static PyObject *__pyx_pw_4lxml_5etree_4XSLT_7strparam(CYTHON_UNUSED PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_strval = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("strparam (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_strval,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(3, 439, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(3, 439, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "strparam", 0) < (0)) __PYX_ERR(3, 439, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("strparam", 1, 1, 1, i); __PYX_ERR(3, 439, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(3, 439, __pyx_L3_error)
    }
    __pyx_v_strval = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("strparam", 1, 1, 1, __pyx_nargs); __PYX_ERR(3, 439, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.XSLT.strparam", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_4XSLT_6strparam(__pyx_v_strval);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_4XSLT_6strparam(PyObject *__pyx_v_strval) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("strparam", 0);

  /* "src/lxml/xslt.pxi":451
 *         Escaped string parameters can be reused without restriction.
 *         """
 *         return _XSLTQuotedStringParam(strval)             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = NULL;
  __pyx_t_3 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_strval};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__XSLTQuotedStringParam, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 451, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __pyx_r = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/xslt.pxi":439
 *         return self._error_log.copy()
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def strparam(strval):
 *         """strparam(strval)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.XSLT.strparam", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xslt.pxi":453
 *         return _XSLTQuotedStringParam(strval)
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def set_global_max_depth(int max_depth):
 *         """set_global_max_depth(max_depth)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_4XSLT_9set_global_max_depth(CYTHON_UNUSED PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_4XSLT_8set_global_max_depth, "set_global_max_depth(max_depth)\n\n        The maximum traversal depth that the stylesheet engine will allow.\n        This does not only count the template recursion depth but also takes\n        the number of variables/parameters into account.  The required setting\n        for a run depends on both the stylesheet and the input data.\n\n        Example::\n\n            XSLT.set_global_max_depth(5000)\n\n        Note that this is currently a global, module-wide setting because\n        libxslt does not support it at a per-stylesheet level.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_4XSLT_9set_global_max_depth = {"set_global_max_depth", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_4XSLT_9set_global_max_depth, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_4XSLT_8set_global_max_depth};
static PyObject *__pyx_pw_4lxml_5etree_4XSLT_9set_global_max_depth(CYTHON_UNUSED PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  int __pyx_v_max_depth;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_global_max_depth (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_max_depth,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(3, 453, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(3, 453, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "set_global_max_depth", 0) < (0)) __PYX_ERR(3, 453, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("set_global_max_depth", 1, 1, 1, i); __PYX_ERR(3, 453, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(3, 453, __pyx_L3_error)
    }
    __pyx_v_max_depth = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_max_depth == (int)-1) && PyErr_Occurred())) __PYX_ERR(3, 454, __pyx_L3_error)
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_global_max_depth", 1, 1, 1, __pyx_nargs); __PYX_ERR(3, 453, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.XSLT.set_global_max_depth", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_4XSLT_8set_global_max_depth(__pyx_v_max_depth);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_4XSLT_8set_global_max_depth(int __pyx_v_max_depth) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_global_max_depth", 0);

  /* "src/lxml/xslt.pxi":469
 *         libxslt does not support it at a per-stylesheet level.
 *         """
 *         if max_depth < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError("cannot set a maximum stylesheet traversal depth < 0")
 *         xslt.xsltMaxDepth = max_depth
*/
  __pyx_t_1 = (__pyx_v_max_depth < 0);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/xslt.pxi":470
 *         """
 *         if max_depth < 0:
 *             raise ValueError("cannot set a maximum stylesheet traversal depth < 0")             # <<<<<<<<<<<<<<
 *         xslt.xsltMaxDepth = max_depth
 * 
*/
    __pyx_t_3 = NULL;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_cannot_set_a_maximum_stylesheet};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 470, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(3, 470, __pyx_L1_error)

    /* "src/lxml/xslt.pxi":469
 *         libxslt does not support it at a per-stylesheet level.
 *         """
 *         if max_depth < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError("cannot set a maximum stylesheet traversal depth < 0")
 *         xslt.xsltMaxDepth = max_depth
*/
  }

  /* "src/lxml/xslt.pxi":471
 *         if max_depth < 0:
 *             raise ValueError("cannot set a maximum stylesheet traversal depth < 0")
 *         xslt.xsltMaxDepth = max_depth             # <<<<<<<<<<<<<<
 * 
 *     def tostring(self, _ElementTree result_tree):
*/
  xsltMaxDepth = __pyx_v_max_depth;

  /* "src/lxml/xslt.pxi":453
 *         return _XSLTQuotedStringParam(strval)
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def set_global_max_depth(int max_depth):
 *         """set_global_max_depth(max_depth)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.XSLT.set_global_max_depth", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xslt.pxi":473
 *         xslt.xsltMaxDepth = max_depth
 * 
 *     def tostring(self, _ElementTree result_tree):             # <<<<<<<<<<<<<<
 *         """tostring(self, result_tree)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_4XSLT_11tostring(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_4XSLT_10tostring, "tostring(self, result_tree)\n\n        Save result doc to string based on stylesheet output method.\n\n        :deprecated: use str(result_tree) instead.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_4XSLT_11tostring = {"tostring", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_4XSLT_11tostring, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_4XSLT_10tostring};
static PyObject *__pyx_pw_4lxml_5etree_4XSLT_11tostring(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct LxmlElementTree *__pyx_v_result_tree = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("tostring (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_result_tree,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(3, 473, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(3, 473, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "tostring", 0) < (0)) __PYX_ERR(3, 473, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("tostring", 1, 1, 1, i); __PYX_ERR(3, 473, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(3, 473, __pyx_L3_error)
    }
    __pyx_v_result_tree = ((struct LxmlElementTree *)values[0]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("tostring", 1, 1, 1, __pyx_nargs); __PYX_ERR(3, 473, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.XSLT.tostring", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_result_tree), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ElementTree, 1, "result_tree", 0))) __PYX_ERR(3, 473, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_4XSLT_10tostring(((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self), __pyx_v_result_tree);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_4XSLT_10tostring(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree_XSLT *__pyx_v_self, struct LxmlElementTree *__pyx_v_result_tree) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("tostring", 0);

  /* "src/lxml/xslt.pxi":480
 *         :deprecated: use str(result_tree) instead.
 *         """
 *         return str(result_tree)             # <<<<<<<<<<<<<<
 * 
 *     def __deepcopy__(self, memo):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_Unicode(((PyObject *)__pyx_v_result_tree)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 480, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/xslt.pxi":473
 *         xslt.xsltMaxDepth = max_depth
 * 
 *     def tostring(self, _ElementTree result_tree):             # <<<<<<<<<<<<<<
 *         """tostring(self, result_tree)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.XSLT.tostring", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xslt.pxi":482
 *         return str(result_tree)
 * 
 *     def __deepcopy__(self, memo):             # <<<<<<<<<<<<<<
 *         return self.__copy__()
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_4XSLT_13__deepcopy__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_4XSLT_13__deepcopy__ = {"__deepcopy__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_4XSLT_13__deepcopy__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_4XSLT_13__deepcopy__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_memo = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__deepcopy__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_memo,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(3, 482, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(3, 482, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__deepcopy__", 0) < (0)) __PYX_ERR(3, 482, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__deepcopy__", 1, 1, 1, i); __PYX_ERR(3, 482, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(3, 482, __pyx_L3_error)
    }
    __pyx_v_memo = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__deepcopy__", 1, 1, 1, __pyx_nargs); __PYX_ERR(3, 482, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.XSLT.__deepcopy__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_4XSLT_12__deepcopy__(((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self), __pyx_v_memo);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_4XSLT_12__deepcopy__(struct __pyx_obj_4lxml_5etree_XSLT *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_memo) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__deepcopy__", 0);

  /* "src/lxml/xslt.pxi":483
 * 
 *     def __deepcopy__(self, memo):
 *         return self.__copy__()             # <<<<<<<<<<<<<<
 * 
 *     def __copy__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_copy_2, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 483, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/xslt.pxi":482
 *         return str(result_tree)
 * 
 *     def __deepcopy__(self, memo):             # <<<<<<<<<<<<<<
 *         return self.__copy__()
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.XSLT.__deepcopy__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xslt.pxi":485
 *         return self.__copy__()
 * 
 *     def __copy__(self):             # <<<<<<<<<<<<<<
 *         return _copyXSLT(self)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_4XSLT_15__copy__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_4XSLT_15__copy__ = {"__copy__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_4XSLT_15__copy__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_4XSLT_15__copy__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__copy__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__copy__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__copy__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_4XSLT_14__copy__(((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_4XSLT_14__copy__(struct __pyx_obj_4lxml_5etree_XSLT *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__copy__", 0);

  /* "src/lxml/xslt.pxi":486
 * 
 *     def __copy__(self):
 *         return _copyXSLT(self)             # <<<<<<<<<<<<<<
 * 
 *     def __call__(self, _input, *, profile_run=False, **kw):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__copyXSLT(__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 486, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/xslt.pxi":485
 *         return self.__copy__()
 * 
 *     def __copy__(self):             # <<<<<<<<<<<<<<
 *         return _copyXSLT(self)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.XSLT.__copy__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xslt.pxi":488
 *         return _copyXSLT(self)
 * 
 *     def __call__(self, _input, *, profile_run=False, **kw):             # <<<<<<<<<<<<<<
 *         """__call__(self, _input, profile_run=False, **kw)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_4XSLT_17__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_4XSLT_16__call__, "__call__(self, _input, profile_run=False, **kw)\n\n        Execute the XSL transformation on a tree or Element.\n\n        Pass the ``profile_run`` option to get profile information\n        about the XSLT.  The result of the XSLT will have a property\n        xslt_profile that holds an XML tree with profiling data.\n        ");
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_4XSLT_16__call__;
#endif
static PyObject *__pyx_pw_4lxml_5etree_4XSLT_17__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v__input = 0;
  PyObject *__pyx_v_profile_run = 0;
  PyObject *__pyx_v_kw = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_v_kw = PyDict_New(); if (unlikely(!__pyx_v_kw)) return NULL;
  __Pyx_GOTREF(__pyx_v_kw);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_input,&__pyx_mstate_global->__pyx_n_u_profile_run,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(3, 488, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(3, 488, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v_kw, values, kwd_pos_args, __pyx_kwds_len, "__call__", 1) < (0)) __PYX_ERR(3, 488, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_False));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, i); __PYX_ERR(3, 488, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(3, 488, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_False));
    }
    __pyx_v__input = values[0];
    __pyx_v_profile_run = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, __pyx_nargs); __PYX_ERR(3, 488, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v_kw); __pyx_v_kw = 0;
  __Pyx_AddTraceback("lxml.etree.XSLT.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_4XSLT_16__call__(((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self), __pyx_v__input, __pyx_v_profile_run, __pyx_v_kw);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v_kw);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_4XSLT_16__call__(struct __pyx_obj_4lxml_5etree_XSLT *__pyx_v_self, PyObject *__pyx_v__input, PyObject *__pyx_v_profile_run, PyObject *__pyx_v_kw) {
  struct __pyx_obj_4lxml_5etree__XSLTContext *__pyx_v_context = 0;
  struct __pyx_obj_4lxml_5etree__XSLTResolverContext *__pyx_v_resolver_context = 0;
  struct LxmlDocument *__pyx_v_input_doc = 0;
  struct LxmlElement *__pyx_v_root_node = 0;
  struct LxmlDocument *__pyx_v_result_doc = 0;
  struct LxmlDocument *__pyx_v_profile_doc = 0;
  xmlDoc *__pyx_v_c_profile_doc;
  xsltTransformContext *__pyx_v_transform_ctxt;
  xmlDoc *__pyx_v_c_result;
  xmlDoc *__pyx_v_c_doc;
  xmlDict *__pyx_v_c_dict;
  const char **__pyx_v_params;
  PyObject *__pyx_v_error = NULL;
  PyObject *__pyx_v_message = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  xmlDoc *__pyx_t_3;
  xmlDict *__pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  char const *__pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_t_15;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17[3];
  size_t __pyx_t_18;
  char const *__pyx_t_19;
  int __pyx_t_20;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__call__", 0);

  /* "src/lxml/xslt.pxi":497
 *         xslt_profile that holds an XML tree with profiling data.
 *         """
 *         cdef _XSLTContext context = None             # <<<<<<<<<<<<<<
 *         cdef _XSLTResolverContext resolver_context
 *         cdef _Document input_doc
*/
  __Pyx_INCREF(Py_None);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__XSLTContext *)Py_None);

  /* "src/lxml/xslt.pxi":502
 *         cdef _Element root_node
 *         cdef _Document result_doc
 *         cdef _Document profile_doc = None             # <<<<<<<<<<<<<<
 *         cdef xmlDoc* c_profile_doc
 *         cdef xslt.xsltTransformContext* transform_ctxt
*/
  __Pyx_INCREF(Py_None);
  __pyx_v_profile_doc = ((struct LxmlDocument *)Py_None);

  /* "src/lxml/xslt.pxi":505
 *         cdef xmlDoc* c_profile_doc
 *         cdef xslt.xsltTransformContext* transform_ctxt
 *         cdef xmlDoc* c_result = NULL             # <<<<<<<<<<<<<<
 *         cdef xmlDoc* c_doc
 *         cdef tree.xmlDict* c_dict
*/
  __pyx_v_c_result = NULL;

  /* "src/lxml/xslt.pxi":508
 *         cdef xmlDoc* c_doc
 *         cdef tree.xmlDict* c_dict
 *         cdef const_char** params = NULL             # <<<<<<<<<<<<<<
 * 
 *         assert self._c_style is not NULL, "XSLT stylesheet not initialised"
*/
  __pyx_v_params = NULL;

  /* "src/lxml/xslt.pxi":510
 *         cdef const_char** params = NULL
 * 
 *         assert self._c_style is not NULL, "XSLT stylesheet not initialised"             # <<<<<<<<<<<<<<
 *         input_doc = _documentOrRaise(_input)
 *         root_node = _rootNodeOrRaise(_input)
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = (__pyx_v_self->_c_style != NULL);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_mstate_global->__pyx_kp_u_XSLT_stylesheet_not_initialised, 0, 0);
      __PYX_ERR(3, 510, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(3, 510, __pyx_L1_error)
  #endif

  /* "src/lxml/xslt.pxi":511
 * 
 *         assert self._c_style is not NULL, "XSLT stylesheet not initialised"
 *         input_doc = _documentOrRaise(_input)             # <<<<<<<<<<<<<<
 *         root_node = _rootNodeOrRaise(_input)
 * 
*/
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__documentOrRaise(__pyx_v__input)); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 511, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_input_doc = ((struct LxmlDocument *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/xslt.pxi":512
 *         assert self._c_style is not NULL, "XSLT stylesheet not initialised"
 *         input_doc = _documentOrRaise(_input)
 *         root_node = _rootNodeOrRaise(_input)             # <<<<<<<<<<<<<<
 * 
 *         c_doc = _fakeRootDoc(input_doc._c_doc, root_node._c_node)
*/
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__rootNodeOrRaise(__pyx_v__input)); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 512, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_root_node = ((struct LxmlElement *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/xslt.pxi":514
 *         root_node = _rootNodeOrRaise(_input)
 * 
 *         c_doc = _fakeRootDoc(input_doc._c_doc, root_node._c_node)             # <<<<<<<<<<<<<<
 * 
 *         transform_ctxt = xslt.xsltNewTransformContext(self._c_style, c_doc)
*/
  __pyx_t_3 = __pyx_f_4lxml_5etree__fakeRootDoc(__pyx_v_input_doc->_c_doc, __pyx_v_root_node->_c_node); if (unlikely(__pyx_t_3 == ((void *)NULL))) __PYX_ERR(3, 514, __pyx_L1_error)
  __pyx_v_c_doc = __pyx_t_3;

  /* "src/lxml/xslt.pxi":516
 *         c_doc = _fakeRootDoc(input_doc._c_doc, root_node._c_node)
 * 
 *         transform_ctxt = xslt.xsltNewTransformContext(self._c_style, c_doc)             # <<<<<<<<<<<<<<
 *         if transform_ctxt is NULL:
 *             _destroyFakeDoc(input_doc._c_doc, c_doc)
*/
  __pyx_v_transform_ctxt = xsltNewTransformContext(__pyx_v_self->_c_style, __pyx_v_c_doc);

  /* "src/lxml/xslt.pxi":517
 * 
 *         transform_ctxt = xslt.xsltNewTransformContext(self._c_style, c_doc)
 *         if transform_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             _destroyFakeDoc(input_doc._c_doc, c_doc)
 *             raise MemoryError()
*/
  __pyx_t_1 = (__pyx_v_transform_ctxt == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/xslt.pxi":518
 *         transform_ctxt = xslt.xsltNewTransformContext(self._c_style, c_doc)
 *         if transform_ctxt is NULL:
 *             _destroyFakeDoc(input_doc._c_doc, c_doc)             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 * 
*/
    __pyx_f_4lxml_5etree__destroyFakeDoc(__pyx_v_input_doc->_c_doc, __pyx_v_c_doc);

    /* "src/lxml/xslt.pxi":519
 *         if transform_ctxt is NULL:
 *             _destroyFakeDoc(input_doc._c_doc, c_doc)
 *             raise MemoryError()             # <<<<<<<<<<<<<<
 * 
 *         # using the stylesheet dict is safer than using a possibly
*/
    PyErr_NoMemory(); __PYX_ERR(3, 519, __pyx_L1_error)

    /* "src/lxml/xslt.pxi":517
 * 
 *         transform_ctxt = xslt.xsltNewTransformContext(self._c_style, c_doc)
 *         if transform_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             _destroyFakeDoc(input_doc._c_doc, c_doc)
 *             raise MemoryError()
*/
  }

  /* "src/lxml/xslt.pxi":525
 *         # non-input tag/attr names will come from the stylesheet
 *         # anyway.
 *         if transform_ctxt.dict is not NULL:             # <<<<<<<<<<<<<<
 *             xmlparser.xmlDictFree(transform_ctxt.dict)
 *         if kw:
*/
  __pyx_t_1 = (__pyx_v_transform_ctxt->dict != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/xslt.pxi":526
 *         # anyway.
 *         if transform_ctxt.dict is not NULL:
 *             xmlparser.xmlDictFree(transform_ctxt.dict)             # <<<<<<<<<<<<<<
 *         if kw:
 *             # parameter values are stored in the dict
*/
    xmlDictFree(__pyx_v_transform_ctxt->dict);

    /* "src/lxml/xslt.pxi":525
 *         # non-input tag/attr names will come from the stylesheet
 *         # anyway.
 *         if transform_ctxt.dict is not NULL:             # <<<<<<<<<<<<<<
 *             xmlparser.xmlDictFree(transform_ctxt.dict)
 *         if kw:
*/
  }

  /* "src/lxml/xslt.pxi":527
 *         if transform_ctxt.dict is not NULL:
 *             xmlparser.xmlDictFree(transform_ctxt.dict)
 *         if kw:             # <<<<<<<<<<<<<<
 *             # parameter values are stored in the dict
 *             # => avoid unnecessarily cluttering the global dict
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_kw); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(3, 527, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/xslt.pxi":530
 *             # parameter values are stored in the dict
 *             # => avoid unnecessarily cluttering the global dict
 *             transform_ctxt.dict = xmlparser.xmlDictCreateSub(self._c_style.doc.dict)             # <<<<<<<<<<<<<<
 *             if transform_ctxt.dict is NULL:
 *                 xslt.xsltFreeTransformContext(transform_ctxt)
*/
    __pyx_v_transform_ctxt->dict = xmlDictCreateSub(__pyx_v_self->_c_style->doc->dict);

    /* "src/lxml/xslt.pxi":531
 *             # => avoid unnecessarily cluttering the global dict
 *             transform_ctxt.dict = xmlparser.xmlDictCreateSub(self._c_style.doc.dict)
 *             if transform_ctxt.dict is NULL:             # <<<<<<<<<<<<<<
 *                 xslt.xsltFreeTransformContext(transform_ctxt)
 *                 raise MemoryError()
*/
    __pyx_t_1 = (__pyx_v_transform_ctxt->dict == NULL);
    if (unlikely(__pyx_t_1)) {

      /* "src/lxml/xslt.pxi":532
 *             transform_ctxt.dict = xmlparser.xmlDictCreateSub(self._c_style.doc.dict)
 *             if transform_ctxt.dict is NULL:
 *                 xslt.xsltFreeTransformContext(transform_ctxt)             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 *         else:
*/
      xsltFreeTransformContext(__pyx_v_transform_ctxt);

      /* "src/lxml/xslt.pxi":533
 *             if transform_ctxt.dict is NULL:
 *                 xslt.xsltFreeTransformContext(transform_ctxt)
 *                 raise MemoryError()             # <<<<<<<<<<<<<<
 *         else:
 *             transform_ctxt.dict = self._c_style.doc.dict
*/
      PyErr_NoMemory(); __PYX_ERR(3, 533, __pyx_L1_error)

      /* "src/lxml/xslt.pxi":531
 *             # => avoid unnecessarily cluttering the global dict
 *             transform_ctxt.dict = xmlparser.xmlDictCreateSub(self._c_style.doc.dict)
 *             if transform_ctxt.dict is NULL:             # <<<<<<<<<<<<<<
 *                 xslt.xsltFreeTransformContext(transform_ctxt)
 *                 raise MemoryError()
*/
    }

    /* "src/lxml/xslt.pxi":527
 *         if transform_ctxt.dict is not NULL:
 *             xmlparser.xmlDictFree(transform_ctxt.dict)
 *         if kw:             # <<<<<<<<<<<<<<
 *             # parameter values are stored in the dict
 *             # => avoid unnecessarily cluttering the global dict
*/
    goto __pyx_L5;
  }

  /* "src/lxml/xslt.pxi":535
 *                 raise MemoryError()
 *         else:
 *             transform_ctxt.dict = self._c_style.doc.dict             # <<<<<<<<<<<<<<
 *             xmlparser.xmlDictReference(transform_ctxt.dict)
 * 
*/
  /*else*/ {
    __pyx_t_4 = __pyx_v_self->_c_style->doc->dict;
    __pyx_v_transform_ctxt->dict = __pyx_t_4;

    /* "src/lxml/xslt.pxi":536
 *         else:
 *             transform_ctxt.dict = self._c_style.doc.dict
 *             xmlparser.xmlDictReference(transform_ctxt.dict)             # <<<<<<<<<<<<<<
 * 
 *         xslt.xsltSetCtxtParseOptions(
*/
    (void)(xmlDictReference(__pyx_v_transform_ctxt->dict));
  }
  __pyx_L5:;

  /* "src/lxml/xslt.pxi":538
 *             xmlparser.xmlDictReference(transform_ctxt.dict)
 * 
 *         xslt.xsltSetCtxtParseOptions(             # <<<<<<<<<<<<<<
 *             transform_ctxt, input_doc._parser._parse_options)
 * 
*/
  xsltSetCtxtParseOptions(__pyx_v_transform_ctxt, __pyx_v_input_doc->_parser->_parse_options);

  /* "src/lxml/xslt.pxi":541
 *             transform_ctxt, input_doc._parser._parse_options)
 * 
 *         if profile_run:             # <<<<<<<<<<<<<<
 *             transform_ctxt.profile = 1
 * 
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_profile_run); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(3, 541, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/xslt.pxi":542
 * 
 *         if profile_run:
 *             transform_ctxt.profile = 1             # <<<<<<<<<<<<<<
 * 
 *         try:
*/
    __pyx_v_transform_ctxt->profile = 1;

    /* "src/lxml/xslt.pxi":541
 *             transform_ctxt, input_doc._parser._parse_options)
 * 
 *         if profile_run:             # <<<<<<<<<<<<<<
 *             transform_ctxt.profile = 1
 * 
*/
  }

  /* "src/lxml/xslt.pxi":544
 *             transform_ctxt.profile = 1
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             context = self._context._copy()
 *             context.register_context(transform_ctxt, input_doc)
*/
  /*try:*/ {

    /* "src/lxml/xslt.pxi":545
 * 
 *         try:
 *             context = self._context._copy()             # <<<<<<<<<<<<<<
 *             context.register_context(transform_ctxt, input_doc)
 * 
*/
    __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree_12_XSLTContext__copy(__pyx_v_self->_context)); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 545, __pyx_L9_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__XSLTContext))))) __PYX_ERR(3, 545, __pyx_L9_error)
    __Pyx_DECREF_SET(__pyx_v_context, ((struct __pyx_obj_4lxml_5etree__XSLTContext *)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "src/lxml/xslt.pxi":546
 *         try:
 *             context = self._context._copy()
 *             context.register_context(transform_ctxt, input_doc)             # <<<<<<<<<<<<<<
 * 
 *             resolver_context = self._xslt_resolver_context._copy()
*/
    __pyx_t_2 = __pyx_f_4lxml_5etree_12_XSLTContext_register_context(__pyx_v_context, __pyx_v_transform_ctxt, __pyx_v_input_doc); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 546, __pyx_L9_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/xslt.pxi":548
 *             context.register_context(transform_ctxt, input_doc)
 * 
 *             resolver_context = self._xslt_resolver_context._copy()             # <<<<<<<<<<<<<<
 *             transform_ctxt._private = <python.PyObject*>resolver_context
 * 
*/
    __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree_20_XSLTResolverContext__copy(__pyx_v_self->_xslt_resolver_context)); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 548, __pyx_L9_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_resolver_context = ((struct __pyx_obj_4lxml_5etree__XSLTResolverContext *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/xslt.pxi":549
 * 
 *             resolver_context = self._xslt_resolver_context._copy()
 *             transform_ctxt._private = <python.PyObject*>resolver_context             # <<<<<<<<<<<<<<
 * 
 *             _convert_xslt_parameters(transform_ctxt, kw, &params)
*/
    __pyx_v_transform_ctxt->_private = ((PyObject *)__pyx_v_resolver_context);

    /* "src/lxml/xslt.pxi":551
 *             transform_ctxt._private = <python.PyObject*>resolver_context
 * 
 *             _convert_xslt_parameters(transform_ctxt, kw, &params)             # <<<<<<<<<<<<<<
 *             c_result = self._run_transform(
 *                 c_doc, params, context, transform_ctxt)
*/
    __pyx_t_2 = __pyx_f_4lxml_5etree__convert_xslt_parameters(__pyx_v_transform_ctxt, __pyx_v_kw, (&__pyx_v_params)); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 551, __pyx_L9_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/xslt.pxi":552
 * 
 *             _convert_xslt_parameters(transform_ctxt, kw, &params)
 *             c_result = self._run_transform(             # <<<<<<<<<<<<<<
 *                 c_doc, params, context, transform_ctxt)
 * 
*/
    __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree_XSLT *)__pyx_v_self->__pyx_vtab)->_run_transform(__pyx_v_self, __pyx_v_c_doc, __pyx_v_params, __pyx_v_context, __pyx_v_transform_ctxt); if (unlikely(__pyx_t_3 == ((void *)NULL) && PyErr_Occurred())) __PYX_ERR(3, 552, __pyx_L9_error)
    __pyx_v_c_result = __pyx_t_3;

    /* "src/lxml/xslt.pxi":555
 *                 c_doc, params, context, transform_ctxt)
 * 
 *             if transform_ctxt.state != xslt.XSLT_STATE_OK:             # <<<<<<<<<<<<<<
 *                 if c_result is not NULL:
 *                     tree.xmlFreeDoc(c_result)
*/
    __pyx_t_1 = (__pyx_v_transform_ctxt->state != XSLT_STATE_OK);
    if (__pyx_t_1) {

      /* "src/lxml/xslt.pxi":556
 * 
 *             if transform_ctxt.state != xslt.XSLT_STATE_OK:
 *                 if c_result is not NULL:             # <<<<<<<<<<<<<<
 *                     tree.xmlFreeDoc(c_result)
 *                     c_result = NULL
*/
      __pyx_t_1 = (__pyx_v_c_result != NULL);
      if (__pyx_t_1) {

        /* "src/lxml/xslt.pxi":557
 *             if transform_ctxt.state != xslt.XSLT_STATE_OK:
 *                 if c_result is not NULL:
 *                     tree.xmlFreeDoc(c_result)             # <<<<<<<<<<<<<<
 *                     c_result = NULL
 * 
*/
        xmlFreeDoc(__pyx_v_c_result);

        /* "src/lxml/xslt.pxi":558
 *                 if c_result is not NULL:
 *                     tree.xmlFreeDoc(c_result)
 *                     c_result = NULL             # <<<<<<<<<<<<<<
 * 
 *             if transform_ctxt.profile:
*/
        __pyx_v_c_result = NULL;

        /* "src/lxml/xslt.pxi":556
 * 
 *             if transform_ctxt.state != xslt.XSLT_STATE_OK:
 *                 if c_result is not NULL:             # <<<<<<<<<<<<<<
 *                     tree.xmlFreeDoc(c_result)
 *                     c_result = NULL
*/
      }

      /* "src/lxml/xslt.pxi":555
 *                 c_doc, params, context, transform_ctxt)
 * 
 *             if transform_ctxt.state != xslt.XSLT_STATE_OK:             # <<<<<<<<<<<<<<
 *                 if c_result is not NULL:
 *                     tree.xmlFreeDoc(c_result)
*/
    }

    /* "src/lxml/xslt.pxi":560
 *                     c_result = NULL
 * 
 *             if transform_ctxt.profile:             # <<<<<<<<<<<<<<
 *                 c_profile_doc = xslt.xsltGetProfileInformation(transform_ctxt)
 *                 if c_profile_doc is not NULL:
*/
    __pyx_t_1 = (__pyx_v_transform_ctxt->profile != 0);
    if (__pyx_t_1) {

      /* "src/lxml/xslt.pxi":561
 * 
 *             if transform_ctxt.profile:
 *                 c_profile_doc = xslt.xsltGetProfileInformation(transform_ctxt)             # <<<<<<<<<<<<<<
 *                 if c_profile_doc is not NULL:
 *                     profile_doc = _documentFactory(
*/
      __pyx_v_c_profile_doc = xsltGetProfileInformation(__pyx_v_transform_ctxt);

      /* "src/lxml/xslt.pxi":562
 *             if transform_ctxt.profile:
 *                 c_profile_doc = xslt.xsltGetProfileInformation(transform_ctxt)
 *                 if c_profile_doc is not NULL:             # <<<<<<<<<<<<<<
 *                     profile_doc = _documentFactory(
 *                         c_profile_doc, input_doc._parser)
*/
      __pyx_t_1 = (__pyx_v_c_profile_doc != NULL);
      if (__pyx_t_1) {

        /* "src/lxml/xslt.pxi":564
 *                 if c_profile_doc is not NULL:
 *                     profile_doc = _documentFactory(
 *                         c_profile_doc, input_doc._parser)             # <<<<<<<<<<<<<<
 *         finally:
 *             if params is not NULL:
*/
        __pyx_t_2 = ((PyObject *)__pyx_v_input_doc->_parser);
        __Pyx_INCREF(__pyx_t_2);

        /* "src/lxml/xslt.pxi":563
 *                 c_profile_doc = xslt.xsltGetProfileInformation(transform_ctxt)
 *                 if c_profile_doc is not NULL:
 *                     profile_doc = _documentFactory(             # <<<<<<<<<<<<<<
 *                         c_profile_doc, input_doc._parser)
 *         finally:
*/
        __pyx_t_5 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_profile_doc, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_2))); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 563, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF_SET(__pyx_v_profile_doc, ((struct LxmlDocument *)__pyx_t_5));
        __pyx_t_5 = 0;

        /* "src/lxml/xslt.pxi":562
 *             if transform_ctxt.profile:
 *                 c_profile_doc = xslt.xsltGetProfileInformation(transform_ctxt)
 *                 if c_profile_doc is not NULL:             # <<<<<<<<<<<<<<
 *                     profile_doc = _documentFactory(
 *                         c_profile_doc, input_doc._parser)
*/
      }

      /* "src/lxml/xslt.pxi":560
 *                     c_result = NULL
 * 
 *             if transform_ctxt.profile:             # <<<<<<<<<<<<<<
 *                 c_profile_doc = xslt.xsltGetProfileInformation(transform_ctxt)
 *                 if c_profile_doc is not NULL:
*/
    }
  }

  /* "src/lxml/xslt.pxi":566
 *                         c_profile_doc, input_doc._parser)
 *         finally:
 *             if params is not NULL:             # <<<<<<<<<<<<<<
 *                 # deallocate space for parameters
 *                 python.lxml_free(params)
*/
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_t_1 = (__pyx_v_params != NULL);
      if (__pyx_t_1) {

        /* "src/lxml/xslt.pxi":568
 *             if params is not NULL:
 *                 # deallocate space for parameters
 *                 python.lxml_free(params)             # <<<<<<<<<<<<<<
 *             if context is not None:
 *                 context.free_context()
*/
        lxml_free(__pyx_v_params);

        /* "src/lxml/xslt.pxi":566
 *                         c_profile_doc, input_doc._parser)
 *         finally:
 *             if params is not NULL:             # <<<<<<<<<<<<<<
 *                 # deallocate space for parameters
 *                 python.lxml_free(params)
*/
      }

      /* "src/lxml/xslt.pxi":569
 *                 # deallocate space for parameters
 *                 python.lxml_free(params)
 *             if context is not None:             # <<<<<<<<<<<<<<
 *                 context.free_context()
 *             _destroyFakeDoc(input_doc._c_doc, c_doc)
*/
      __pyx_t_1 = (((PyObject *)__pyx_v_context) != Py_None);
      if (__pyx_t_1) {

        /* "src/lxml/xslt.pxi":570
 *                 python.lxml_free(params)
 *             if context is not None:
 *                 context.free_context()             # <<<<<<<<<<<<<<
 *             _destroyFakeDoc(input_doc._c_doc, c_doc)
 * 
*/
        __pyx_t_5 = __pyx_f_4lxml_5etree_12_XSLTContext_free_context(__pyx_v_context); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 570, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "src/lxml/xslt.pxi":569
 *                 # deallocate space for parameters
 *                 python.lxml_free(params)
 *             if context is not None:             # <<<<<<<<<<<<<<
 *                 context.free_context()
 *             _destroyFakeDoc(input_doc._c_doc, c_doc)
*/
      }

      /* "src/lxml/xslt.pxi":571
 *             if context is not None:
 *                 context.free_context()
 *             _destroyFakeDoc(input_doc._c_doc, c_doc)             # <<<<<<<<<<<<<<
 * 
 *         try:
*/
      __pyx_f_4lxml_5etree__destroyFakeDoc(__pyx_v_input_doc->_c_doc, __pyx_v_c_doc);
      goto __pyx_L10;
    }
    __pyx_L9_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
      if ( unlikely(__Pyx_GetException(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11) < 0)) __Pyx_ErrFetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_14);
      __pyx_t_6 = __pyx_lineno; __pyx_t_7 = __pyx_clineno; __pyx_t_8 = __pyx_filename;
      {

        /* "src/lxml/xslt.pxi":566
 *                         c_profile_doc, input_doc._parser)
 *         finally:
 *             if params is not NULL:             # <<<<<<<<<<<<<<
 *                 # deallocate space for parameters
 *                 python.lxml_free(params)
*/
        __pyx_t_1 = (__pyx_v_params != NULL);
        if (__pyx_t_1) {

          /* "src/lxml/xslt.pxi":568
 *             if params is not NULL:
 *                 # deallocate space for parameters
 *                 python.lxml_free(params)             # <<<<<<<<<<<<<<
 *             if context is not None:
 *                 context.free_context()
*/
          lxml_free(__pyx_v_params);

          /* "src/lxml/xslt.pxi":566
 *                         c_profile_doc, input_doc._parser)
 *         finally:
 *             if params is not NULL:             # <<<<<<<<<<<<<<
 *                 # deallocate space for parameters
 *                 python.lxml_free(params)
*/
        }

        /* "src/lxml/xslt.pxi":569
 *                 # deallocate space for parameters
 *                 python.lxml_free(params)
 *             if context is not None:             # <<<<<<<<<<<<<<
 *                 context.free_context()
 *             _destroyFakeDoc(input_doc._c_doc, c_doc)
*/
        __pyx_t_1 = (((PyObject *)__pyx_v_context) != Py_None);
        if (__pyx_t_1) {

          /* "src/lxml/xslt.pxi":570
 *                 python.lxml_free(params)
 *             if context is not None:
 *                 context.free_context()             # <<<<<<<<<<<<<<
 *             _destroyFakeDoc(input_doc._c_doc, c_doc)
 * 
*/
          __pyx_t_5 = __pyx_f_4lxml_5etree_12_XSLTContext_free_context(__pyx_v_context); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 570, __pyx_L18_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

          /* "src/lxml/xslt.pxi":569
 *                 # deallocate space for parameters
 *                 python.lxml_free(params)
 *             if context is not None:             # <<<<<<<<<<<<<<
 *                 context.free_context()
 *             _destroyFakeDoc(input_doc._c_doc, c_doc)
*/
        }

        /* "src/lxml/xslt.pxi":571
 *             if context is not None:
 *                 context.free_context()
 *             _destroyFakeDoc(input_doc._c_doc, c_doc)             # <<<<<<<<<<<<<<
 * 
 *         try:
*/
        __pyx_f_4lxml_5etree__destroyFakeDoc(__pyx_v_input_doc->_c_doc, __pyx_v_c_doc);
      }
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_XGIVEREF(__pyx_t_14);
      __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_ErrRestore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
      __pyx_lineno = __pyx_t_6; __pyx_clineno = __pyx_t_7; __pyx_filename = __pyx_t_8;
      goto __pyx_L1_error;
      __pyx_L18_error:;
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_XGIVEREF(__pyx_t_14);
      __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L10:;
  }

  /* "src/lxml/xslt.pxi":573
 *             _destroyFakeDoc(input_doc._c_doc, c_doc)
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             if resolver_context is not None and resolver_context._has_raised():
 *                 if c_result is not NULL:
*/
  /*try:*/ {

    /* "src/lxml/xslt.pxi":574
 * 
 *         try:
 *             if resolver_context is not None and resolver_context._has_raised():             # <<<<<<<<<<<<<<
 *                 if c_result is not NULL:
 *                     tree.xmlFreeDoc(c_result)
*/
    __pyx_t_15 = (((PyObject *)__pyx_v_resolver_context) != Py_None);
    if (__pyx_t_15) {
    } else {
      __pyx_t_1 = __pyx_t_15;
      goto __pyx_L25_bool_binop_done;
    }
    __pyx_t_15 = __pyx_f_4lxml_5etree_17_ExceptionContext__has_raised(((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_v_resolver_context)); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(3, 574, __pyx_L22_error)
    __pyx_t_1 = __pyx_t_15;
    __pyx_L25_bool_binop_done:;
    if (__pyx_t_1) {

      /* "src/lxml/xslt.pxi":575
 *         try:
 *             if resolver_context is not None and resolver_context._has_raised():
 *                 if c_result is not NULL:             # <<<<<<<<<<<<<<
 *                     tree.xmlFreeDoc(c_result)
 *                     c_result = NULL
*/
      __pyx_t_1 = (__pyx_v_c_result != NULL);
      if (__pyx_t_1) {

        /* "src/lxml/xslt.pxi":576
 *             if resolver_context is not None and resolver_context._has_raised():
 *                 if c_result is not NULL:
 *                     tree.xmlFreeDoc(c_result)             # <<<<<<<<<<<<<<
 *                     c_result = NULL
 *                 resolver_context._raise_if_stored()
*/
        xmlFreeDoc(__pyx_v_c_result);

        /* "src/lxml/xslt.pxi":577
 *                 if c_result is not NULL:
 *                     tree.xmlFreeDoc(c_result)
 *                     c_result = NULL             # <<<<<<<<<<<<<<
 *                 resolver_context._raise_if_stored()
 * 
*/
        __pyx_v_c_result = NULL;

        /* "src/lxml/xslt.pxi":575
 *         try:
 *             if resolver_context is not None and resolver_context._has_raised():
 *                 if c_result is not NULL:             # <<<<<<<<<<<<<<
 *                     tree.xmlFreeDoc(c_result)
 *                     c_result = NULL
*/
      }

      /* "src/lxml/xslt.pxi":578
 *                     tree.xmlFreeDoc(c_result)
 *                     c_result = NULL
 *                 resolver_context._raise_if_stored()             # <<<<<<<<<<<<<<
 * 
 *             if context._exc._has_raised():
*/
      __pyx_t_7 = __pyx_f_4lxml_5etree_17_ExceptionContext__raise_if_stored(((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_v_resolver_context)); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(3, 578, __pyx_L22_error)

      /* "src/lxml/xslt.pxi":574
 * 
 *         try:
 *             if resolver_context is not None and resolver_context._has_raised():             # <<<<<<<<<<<<<<
 *                 if c_result is not NULL:
 *                     tree.xmlFreeDoc(c_result)
*/
    }

    /* "src/lxml/xslt.pxi":580
 *                 resolver_context._raise_if_stored()
 * 
 *             if context._exc._has_raised():             # <<<<<<<<<<<<<<
 *                 if c_result is not NULL:
 *                     tree.xmlFreeDoc(c_result)
*/
    __pyx_t_1 = __pyx_f_4lxml_5etree_17_ExceptionContext__has_raised(__pyx_v_context->__pyx_base._exc); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(3, 580, __pyx_L22_error)
    if (__pyx_t_1) {

      /* "src/lxml/xslt.pxi":581
 * 
 *             if context._exc._has_raised():
 *                 if c_result is not NULL:             # <<<<<<<<<<<<<<
 *                     tree.xmlFreeDoc(c_result)
 *                     c_result = NULL
*/
      __pyx_t_1 = (__pyx_v_c_result != NULL);
      if (__pyx_t_1) {

        /* "src/lxml/xslt.pxi":582
 *             if context._exc._has_raised():
 *                 if c_result is not NULL:
 *                     tree.xmlFreeDoc(c_result)             # <<<<<<<<<<<<<<
 *                     c_result = NULL
 *                 context._exc._raise_if_stored()
*/
        xmlFreeDoc(__pyx_v_c_result);

        /* "src/lxml/xslt.pxi":583
 *                 if c_result is not NULL:
 *                     tree.xmlFreeDoc(c_result)
 *                     c_result = NULL             # <<<<<<<<<<<<<<
 *                 context._exc._raise_if_stored()
 * 
*/
        __pyx_v_c_result = NULL;

        /* "src/lxml/xslt.pxi":581
 * 
 *             if context._exc._has_raised():
 *                 if c_result is not NULL:             # <<<<<<<<<<<<<<
 *                     tree.xmlFreeDoc(c_result)
 *                     c_result = NULL
*/
      }

      /* "src/lxml/xslt.pxi":584
 *                     tree.xmlFreeDoc(c_result)
 *                     c_result = NULL
 *                 context._exc._raise_if_stored()             # <<<<<<<<<<<<<<
 * 
 *             if c_result is NULL:
*/
      __pyx_t_7 = __pyx_f_4lxml_5etree_17_ExceptionContext__raise_if_stored(__pyx_v_context->__pyx_base._exc); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(3, 584, __pyx_L22_error)

      /* "src/lxml/xslt.pxi":580
 *                 resolver_context._raise_if_stored()
 * 
 *             if context._exc._has_raised():             # <<<<<<<<<<<<<<
 *                 if c_result is not NULL:
 *                     tree.xmlFreeDoc(c_result)
*/
    }

    /* "src/lxml/xslt.pxi":586
 *                 context._exc._raise_if_stored()
 * 
 *             if c_result is NULL:             # <<<<<<<<<<<<<<
 *                 # last error seems to be the most accurate here
 *                 error = self._error_log.last_error
*/
    __pyx_t_1 = (__pyx_v_c_result == NULL);
    if (__pyx_t_1) {

      /* "src/lxml/xslt.pxi":588
 *             if c_result is NULL:
 *                 # last error seems to be the most accurate here
 *                 error = self._error_log.last_error             # <<<<<<<<<<<<<<
 *                 if error is not None and error.message:
 *                     if error.line > 0:
*/
      __pyx_t_5 = __pyx_v_self->_error_log->__pyx_base.__pyx_base.last_error;
      __Pyx_INCREF(__pyx_t_5);
      __pyx_v_error = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "src/lxml/xslt.pxi":589
 *                 # last error seems to be the most accurate here
 *                 error = self._error_log.last_error
 *                 if error is not None and error.message:             # <<<<<<<<<<<<<<
 *                     if error.line > 0:
 *                         message = f"{error.message}, line {error.line}"
*/
      __pyx_t_15 = (__pyx_v_error != Py_None);
      if (__pyx_t_15) {
      } else {
        __pyx_t_1 = __pyx_t_15;
        goto __pyx_L32_bool_binop_done;
      }
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_error, __pyx_mstate_global->__pyx_n_u_message); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 589, __pyx_L22_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(3, 589, __pyx_L22_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_1 = __pyx_t_15;
      __pyx_L32_bool_binop_done:;
      if (__pyx_t_1) {

        /* "src/lxml/xslt.pxi":590
 *                 error = self._error_log.last_error
 *                 if error is not None and error.message:
 *                     if error.line > 0:             # <<<<<<<<<<<<<<
 *                         message = f"{error.message}, line {error.line}"
 *                     else:
*/
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_error, __pyx_mstate_global->__pyx_n_u_line_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 590, __pyx_L22_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_2 = PyObject_RichCompare(__pyx_t_5, __pyx_mstate_global->__pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 590, __pyx_L22_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(3, 590, __pyx_L22_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (__pyx_t_1) {

          /* "src/lxml/xslt.pxi":591
 *                 if error is not None and error.message:
 *                     if error.line > 0:
 *                         message = f"{error.message}, line {error.line}"             # <<<<<<<<<<<<<<
 *                     else:
 *                         message = error.message
*/
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_error, __pyx_mstate_global->__pyx_n_u_message); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 591, __pyx_L22_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_t_2, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 591, __pyx_L22_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_error, __pyx_mstate_global->__pyx_n_u_line_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 591, __pyx_L22_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_16 = __Pyx_PyObject_FormatSimple(__pyx_t_2, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_16)) __PYX_ERR(3, 591, __pyx_L22_error)
          __Pyx_GOTREF(__pyx_t_16);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_17[0] = __pyx_t_5;
          __pyx_t_17[1] = __pyx_mstate_global->__pyx_kp_u_line;
          __pyx_t_17[2] = __pyx_t_16;
          __pyx_t_2 = __Pyx_PyUnicode_Join(__pyx_t_17, 3, __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 7 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_16), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_16));
          if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 591, __pyx_L22_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
          __pyx_v_message = __pyx_t_2;
          __pyx_t_2 = 0;

          /* "src/lxml/xslt.pxi":590
 *                 error = self._error_log.last_error
 *                 if error is not None and error.message:
 *                     if error.line > 0:             # <<<<<<<<<<<<<<
 *                         message = f"{error.message}, line {error.line}"
 *                     else:
*/
          goto __pyx_L34;
        }

        /* "src/lxml/xslt.pxi":593
 *                         message = f"{error.message}, line {error.line}"
 *                     else:
 *                         message = error.message             # <<<<<<<<<<<<<<
 *                 elif error is not None and error.line > 0:
 *                     message = f"Error applying stylesheet, line {error.line}"
*/
        /*else*/ {
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_error, __pyx_mstate_global->__pyx_n_u_message); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 593, __pyx_L22_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_v_message = __pyx_t_2;
          __pyx_t_2 = 0;
        }
        __pyx_L34:;

        /* "src/lxml/xslt.pxi":589
 *                 # last error seems to be the most accurate here
 *                 error = self._error_log.last_error
 *                 if error is not None and error.message:             # <<<<<<<<<<<<<<
 *                     if error.line > 0:
 *                         message = f"{error.message}, line {error.line}"
*/
        goto __pyx_L31;
      }

      /* "src/lxml/xslt.pxi":594
 *                     else:
 *                         message = error.message
 *                 elif error is not None and error.line > 0:             # <<<<<<<<<<<<<<
 *                     message = f"Error applying stylesheet, line {error.line}"
 *                 else:
*/
      __pyx_t_15 = (__pyx_v_error != Py_None);
      if (__pyx_t_15) {
      } else {
        __pyx_t_1 = __pyx_t_15;
        goto __pyx_L35_bool_binop_done;
      }
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_error, __pyx_mstate_global->__pyx_n_u_line_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 594, __pyx_L22_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_16 = PyObject_RichCompare(__pyx_t_2, __pyx_mstate_global->__pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_16); if (unlikely(!__pyx_t_16)) __PYX_ERR(3, 594, __pyx_L22_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_16); if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(3, 594, __pyx_L22_error)
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      __pyx_t_1 = __pyx_t_15;
      __pyx_L35_bool_binop_done:;
      if (__pyx_t_1) {

        /* "src/lxml/xslt.pxi":595
 *                         message = error.message
 *                 elif error is not None and error.line > 0:
 *                     message = f"Error applying stylesheet, line {error.line}"             # <<<<<<<<<<<<<<
 *                 else:
 *                     message = "Error applying stylesheet"
*/
        __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_v_error, __pyx_mstate_global->__pyx_n_u_line_2); if (unlikely(!__pyx_t_16)) __PYX_ERR(3, 595, __pyx_L22_error)
        __Pyx_GOTREF(__pyx_t_16);
        __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_t_16, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 595, __pyx_L22_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        __pyx_t_16 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_Error_applying_stylesheet_line, __pyx_t_2); if (unlikely(!__pyx_t_16)) __PYX_ERR(3, 595, __pyx_L22_error)
        __Pyx_GOTREF(__pyx_t_16);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_v_message = __pyx_t_16;
        __pyx_t_16 = 0;

        /* "src/lxml/xslt.pxi":594
 *                     else:
 *                         message = error.message
 *                 elif error is not None and error.line > 0:             # <<<<<<<<<<<<<<
 *                     message = f"Error applying stylesheet, line {error.line}"
 *                 else:
*/
        goto __pyx_L31;
      }

      /* "src/lxml/xslt.pxi":597
 *                     message = f"Error applying stylesheet, line {error.line}"
 *                 else:
 *                     message = "Error applying stylesheet"             # <<<<<<<<<<<<<<
 *                 raise XSLTApplyError(message, self._error_log)
 *         finally:
*/
      /*else*/ {
        __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_Error_applying_stylesheet);
        __pyx_v_message = __pyx_mstate_global->__pyx_kp_u_Error_applying_stylesheet;
      }
      __pyx_L31:;

      /* "src/lxml/xslt.pxi":598
 *                 else:
 *                     message = "Error applying stylesheet"
 *                 raise XSLTApplyError(message, self._error_log)             # <<<<<<<<<<<<<<
 *         finally:
 *             if resolver_context is not None:
*/
      __pyx_t_2 = NULL;
      __pyx_t_18 = 1;
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_v_message, ((PyObject *)__pyx_v_self->_error_log)};
        __pyx_t_16 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XSLTApplyError, __pyx_callargs+__pyx_t_18, (3-__pyx_t_18) | (__pyx_t_18*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!__pyx_t_16)) __PYX_ERR(3, 598, __pyx_L22_error)
        __Pyx_GOTREF((PyObject *)__pyx_t_16);
      }
      __Pyx_Raise(((PyObject *)__pyx_t_16), 0, 0, 0);
      __Pyx_DECREF((PyObject *)__pyx_t_16); __pyx_t_16 = 0;
      __PYX_ERR(3, 598, __pyx_L22_error)

      /* "src/lxml/xslt.pxi":586
 *                 context._exc._raise_if_stored()
 * 
 *             if c_result is NULL:             # <<<<<<<<<<<<<<
 *                 # last error seems to be the most accurate here
 *                 error = self._error_log.last_error
*/
    }
  }

  /* "src/lxml/xslt.pxi":600
 *                 raise XSLTApplyError(message, self._error_log)
 *         finally:
 *             if resolver_context is not None:             # <<<<<<<<<<<<<<
 *                 resolver_context.clear()
 * 
*/
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_t_1 = (((PyObject *)__pyx_v_resolver_context) != Py_None);
      if (__pyx_t_1) {

        /* "src/lxml/xslt.pxi":601
 *         finally:
 *             if resolver_context is not None:
 *                 resolver_context.clear()             # <<<<<<<<<<<<<<
 * 
 *         result_doc = _documentFactory(c_result, input_doc._parser)
*/
        __pyx_t_7 = __pyx_f_4lxml_5etree_16_ResolverContext_clear(((struct __pyx_obj_4lxml_5etree__ResolverContext *)__pyx_v_resolver_context)); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(3, 601, __pyx_L1_error)

        /* "src/lxml/xslt.pxi":600
 *                 raise XSLTApplyError(message, self._error_log)
 *         finally:
 *             if resolver_context is not None:             # <<<<<<<<<<<<<<
 *                 resolver_context.clear()
 * 
*/
      }
      goto __pyx_L23;
    }
    __pyx_L22_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_14 = 0; __pyx_t_13 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_9 = 0;
      __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
      if ( unlikely(__Pyx_GetException(&__pyx_t_14, &__pyx_t_13, &__pyx_t_12) < 0)) __Pyx_ErrFetch(&__pyx_t_14, &__pyx_t_13, &__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_14);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_9);
      __pyx_t_7 = __pyx_lineno; __pyx_t_6 = __pyx_clineno; __pyx_t_19 = __pyx_filename;
      {
        __pyx_t_1 = (((PyObject *)__pyx_v_resolver_context) != Py_None);
        if (__pyx_t_1) {

          /* "src/lxml/xslt.pxi":601
 *         finally:
 *             if resolver_context is not None:
 *                 resolver_context.clear()             # <<<<<<<<<<<<<<
 * 
 *         result_doc = _documentFactory(c_result, input_doc._parser)
*/
          __pyx_t_20 = __pyx_f_4lxml_5etree_16_ResolverContext_clear(((struct __pyx_obj_4lxml_5etree__ResolverContext *)__pyx_v_resolver_context)); if (unlikely(__pyx_t_20 == ((int)-1))) __PYX_ERR(3, 601, __pyx_L39_error)

          /* "src/lxml/xslt.pxi":600
 *                 raise XSLTApplyError(message, self._error_log)
 *         finally:
 *             if resolver_context is not None:             # <<<<<<<<<<<<<<
 *                 resolver_context.clear()
 * 
*/
        }
      }
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_10, __pyx_t_9);
      __Pyx_XGIVEREF(__pyx_t_14);
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ErrRestore(__pyx_t_14, __pyx_t_13, __pyx_t_12);
      __pyx_t_14 = 0; __pyx_t_13 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_9 = 0;
      __pyx_lineno = __pyx_t_7; __pyx_clineno = __pyx_t_6; __pyx_filename = __pyx_t_19;
      goto __pyx_L1_error;
      __pyx_L39_error:;
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_10, __pyx_t_9);
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_9 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L23:;
  }

  /* "src/lxml/xslt.pxi":603
 *                 resolver_context.clear()
 * 
 *         result_doc = _documentFactory(c_result, input_doc._parser)             # <<<<<<<<<<<<<<
 * 
 *         c_dict = c_result.dict
*/
  __pyx_t_16 = ((PyObject *)__pyx_v_input_doc->_parser);
  __Pyx_INCREF(__pyx_t_16);
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_result, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_16))); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 603, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  __pyx_v_result_doc = ((struct LxmlDocument *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/xslt.pxi":605
 *         result_doc = _documentFactory(c_result, input_doc._parser)
 * 
 *         c_dict = c_result.dict             # <<<<<<<<<<<<<<
 *         xmlparser.xmlDictReference(c_dict)
 *         __GLOBAL_PARSER_CONTEXT.initThreadDictRef(&c_result.dict)
*/
  __pyx_t_4 = __pyx_v_c_result->dict;
  __pyx_v_c_dict = __pyx_t_4;

  /* "src/lxml/xslt.pxi":606
 * 
 *         c_dict = c_result.dict
 *         xmlparser.xmlDictReference(c_dict)             # <<<<<<<<<<<<<<
 *         __GLOBAL_PARSER_CONTEXT.initThreadDictRef(&c_result.dict)
 *         if c_dict is not c_result.dict or \
*/
  (void)(xmlDictReference(__pyx_v_c_dict));

  /* "src/lxml/xslt.pxi":607
 *         c_dict = c_result.dict
 *         xmlparser.xmlDictReference(c_dict)
 *         __GLOBAL_PARSER_CONTEXT.initThreadDictRef(&c_result.dict)             # <<<<<<<<<<<<<<
 *         if c_dict is not c_result.dict or \
 *                 self._c_style.doc.dict is not c_result.dict or \
*/
  __pyx_t_6 = __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initThreadDictRef(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, (&__pyx_v_c_result->dict)); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(3, 607, __pyx_L1_error)

  /* "src/lxml/xslt.pxi":608
 *         xmlparser.xmlDictReference(c_dict)
 *         __GLOBAL_PARSER_CONTEXT.initThreadDictRef(&c_result.dict)
 *         if c_dict is not c_result.dict or \             # <<<<<<<<<<<<<<
 *                 self._c_style.doc.dict is not c_result.dict or \
 *                 input_doc._c_doc.dict is not c_result.dict:
*/
  __pyx_t_15 = (__pyx_v_c_dict != __pyx_v_c_result->dict);
  if (!__pyx_t_15) {
  } else {
    __pyx_t_1 = __pyx_t_15;
    goto __pyx_L42_bool_binop_done;
  }

  /* "src/lxml/xslt.pxi":609
 *         __GLOBAL_PARSER_CONTEXT.initThreadDictRef(&c_result.dict)
 *         if c_dict is not c_result.dict or \
 *                 self._c_style.doc.dict is not c_result.dict or \             # <<<<<<<<<<<<<<
 *                 input_doc._c_doc.dict is not c_result.dict:
 *             with nogil:
*/
  __pyx_t_15 = (__pyx_v_self->_c_style->doc->dict != __pyx_v_c_result->dict);
  if (!__pyx_t_15) {
  } else {
    __pyx_t_1 = __pyx_t_15;
    goto __pyx_L42_bool_binop_done;
  }

  /* "src/lxml/xslt.pxi":610
 *         if c_dict is not c_result.dict or \
 *                 self._c_style.doc.dict is not c_result.dict or \
 *                 input_doc._c_doc.dict is not c_result.dict:             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 if c_dict is not c_result.dict:
*/
  __pyx_t_15 = (__pyx_v_input_doc->_c_doc->dict != __pyx_v_c_result->dict);
  __pyx_t_1 = __pyx_t_15;
  __pyx_L42_bool_binop_done:;

  /* "src/lxml/xslt.pxi":608
 *         xmlparser.xmlDictReference(c_dict)
 *         __GLOBAL_PARSER_CONTEXT.initThreadDictRef(&c_result.dict)
 *         if c_dict is not c_result.dict or \             # <<<<<<<<<<<<<<
 *                 self._c_style.doc.dict is not c_result.dict or \
 *                 input_doc._c_doc.dict is not c_result.dict:
*/
  if (__pyx_t_1) {

    /* "src/lxml/xslt.pxi":611
 *                 self._c_style.doc.dict is not c_result.dict or \
 *                 input_doc._c_doc.dict is not c_result.dict:
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 if c_dict is not c_result.dict:
 *                     fixThreadDictNames(<xmlNode*>c_result,
*/
    {
        PyThreadState * _save;
        _save = PyEval_SaveThread();
        __Pyx_FastGIL_Remember();
        /*try:*/ {

          /* "src/lxml/xslt.pxi":612
 *                 input_doc._c_doc.dict is not c_result.dict:
 *             with nogil:
 *                 if c_dict is not c_result.dict:             # <<<<<<<<<<<<<<
 *                     fixThreadDictNames(<xmlNode*>c_result,
 *                                        c_dict, c_result.dict)
*/
          __pyx_t_1 = (__pyx_v_c_dict != __pyx_v_c_result->dict);
          if (__pyx_t_1) {

            /* "src/lxml/xslt.pxi":613
 *             with nogil:
 *                 if c_dict is not c_result.dict:
 *                     fixThreadDictNames(<xmlNode*>c_result,             # <<<<<<<<<<<<<<
 *                                        c_dict, c_result.dict)
 *                 if self._c_style.doc.dict is not c_result.dict:
*/
            __pyx_f_4lxml_5etree_fixThreadDictNames(((xmlNode *)__pyx_v_c_result), __pyx_v_c_dict, __pyx_v_c_result->dict);

            /* "src/lxml/xslt.pxi":612
 *                 input_doc._c_doc.dict is not c_result.dict:
 *             with nogil:
 *                 if c_dict is not c_result.dict:             # <<<<<<<<<<<<<<
 *                     fixThreadDictNames(<xmlNode*>c_result,
 *                                        c_dict, c_result.dict)
*/
          }

          /* "src/lxml/xslt.pxi":615
 *                     fixThreadDictNames(<xmlNode*>c_result,
 *                                        c_dict, c_result.dict)
 *                 if self._c_style.doc.dict is not c_result.dict:             # <<<<<<<<<<<<<<
 *                     fixThreadDictNames(<xmlNode*>c_result,
 *                                        self._c_style.doc.dict, c_result.dict)
*/
          __pyx_t_1 = (__pyx_v_self->_c_style->doc->dict != __pyx_v_c_result->dict);
          if (__pyx_t_1) {

            /* "src/lxml/xslt.pxi":616
 *                                        c_dict, c_result.dict)
 *                 if self._c_style.doc.dict is not c_result.dict:
 *                     fixThreadDictNames(<xmlNode*>c_result,             # <<<<<<<<<<<<<<
 *                                        self._c_style.doc.dict, c_result.dict)
 *                 if input_doc._c_doc.dict is not c_result.dict:
*/
            __pyx_f_4lxml_5etree_fixThreadDictNames(((xmlNode *)__pyx_v_c_result), __pyx_v_self->_c_style->doc->dict, __pyx_v_c_result->dict);

            /* "src/lxml/xslt.pxi":615
 *                     fixThreadDictNames(<xmlNode*>c_result,
 *                                        c_dict, c_result.dict)
 *                 if self._c_style.doc.dict is not c_result.dict:             # <<<<<<<<<<<<<<
 *                     fixThreadDictNames(<xmlNode*>c_result,
 *                                        self._c_style.doc.dict, c_result.dict)
*/
          }

          /* "src/lxml/xslt.pxi":618
 *                     fixThreadDictNames(<xmlNode*>c_result,
 *                                        self._c_style.doc.dict, c_result.dict)
 *                 if input_doc._c_doc.dict is not c_result.dict:             # <<<<<<<<<<<<<<
 *                     fixThreadDictNames(<xmlNode*>c_result,
 *                                        input_doc._c_doc.dict, c_result.dict)
*/
          __pyx_t_1 = (__pyx_v_input_doc->_c_doc->dict != __pyx_v_c_result->dict);
          if (__pyx_t_1) {

            /* "src/lxml/xslt.pxi":619
 *                                        self._c_style.doc.dict, c_result.dict)
 *                 if input_doc._c_doc.dict is not c_result.dict:
 *                     fixThreadDictNames(<xmlNode*>c_result,             # <<<<<<<<<<<<<<
 *                                        input_doc._c_doc.dict, c_result.dict)
 *         xmlparser.xmlDictFree(c_dict)
*/
            __pyx_f_4lxml_5etree_fixThreadDictNames(((xmlNode *)__pyx_v_c_result), __pyx_v_input_doc->_c_doc->dict, __pyx_v_c_result->dict);

            /* "src/lxml/xslt.pxi":618
 *                     fixThreadDictNames(<xmlNode*>c_result,
 *                                        self._c_style.doc.dict, c_result.dict)
 *                 if input_doc._c_doc.dict is not c_result.dict:             # <<<<<<<<<<<<<<
 *                     fixThreadDictNames(<xmlNode*>c_result,
 *                                        input_doc._c_doc.dict, c_result.dict)
*/
          }
        }

        /* "src/lxml/xslt.pxi":611
 *                 self._c_style.doc.dict is not c_result.dict or \
 *                 input_doc._c_doc.dict is not c_result.dict:
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 if c_dict is not c_result.dict:
 *                     fixThreadDictNames(<xmlNode*>c_result,
*/
        /*finally:*/ {
          /*normal exit:*/{
            __Pyx_FastGIL_Forget();
            PyEval_RestoreThread(_save);
            goto __pyx_L47;
          }
          __pyx_L47:;
        }
    }

    /* "src/lxml/xslt.pxi":608
 *         xmlparser.xmlDictReference(c_dict)
 *         __GLOBAL_PARSER_CONTEXT.initThreadDictRef(&c_result.dict)
 *         if c_dict is not c_result.dict or \             # <<<<<<<<<<<<<<
 *                 self._c_style.doc.dict is not c_result.dict or \
 *                 input_doc._c_doc.dict is not c_result.dict:
*/
  }

  /* "src/lxml/xslt.pxi":621
 *                     fixThreadDictNames(<xmlNode*>c_result,
 *                                        input_doc._c_doc.dict, c_result.dict)
 *         xmlparser.xmlDictFree(c_dict)             # <<<<<<<<<<<<<<
 * 
 *         return _xsltResultTreeFactory(result_doc, self, profile_doc)
*/
  xmlDictFree(__pyx_v_c_dict);

  /* "src/lxml/xslt.pxi":623
 *         xmlparser.xmlDictFree(c_dict)
 * 
 *         return _xsltResultTreeFactory(result_doc, self, profile_doc)             # <<<<<<<<<<<<<<
 * 
 *     cdef xmlDoc* _run_transform(self, xmlDoc* c_input_doc,
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree__xsltResultTreeFactory(__pyx_v_result_doc, __pyx_v_self, __pyx_v_profile_doc); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 623, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/xslt.pxi":488
 *         return _copyXSLT(self)
 * 
 *     def __call__(self, _input, *, profile_run=False, **kw):             # <<<<<<<<<<<<<<
 *         """__call__(self, _input, profile_run=False, **kw)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_AddTraceback("lxml.etree.XSLT.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_XDECREF((PyObject *)__pyx_v_resolver_context);
  __Pyx_XDECREF((PyObject *)__pyx_v_input_doc);
  __Pyx_XDECREF((PyObject *)__pyx_v_root_node);
  __Pyx_XDECREF((PyObject *)__pyx_v_result_doc);
  __Pyx_XDECREF((PyObject *)__pyx_v_profile_doc);
  __Pyx_XDECREF(__pyx_v_error);
  __Pyx_XDECREF(__pyx_v_message);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xslt.pxi":625
 *         return _xsltResultTreeFactory(result_doc, self, profile_doc)
 * 
 *     cdef xmlDoc* _run_transform(self, xmlDoc* c_input_doc,             # <<<<<<<<<<<<<<
 *                                 const_char** params, _XSLTContext context,
 *                                 xslt.xsltTransformContext* transform_ctxt) except? NULL:
*/

static xmlDoc *__pyx_f_4lxml_5etree_4XSLT__run_transform(struct __pyx_obj_4lxml_5etree_XSLT *__pyx_v_self, xmlDoc *__pyx_v_c_input_doc, const char **__pyx_v_params, CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__XSLTContext *__pyx_v_context, xsltTransformContext *__pyx_v_transform_ctxt) {
  xmlDoc *__pyx_v_c_result;
  xmlExternalEntityLoader __pyx_v_orig_loader;
  xmlDoc *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_run_transform", 0);

  /* "src/lxml/xslt.pxi":629
 *                                 xslt.xsltTransformContext* transform_ctxt) except? NULL:
 *         cdef xmlDoc* c_result
 *         xslt.xsltSetTransformErrorFunc(transform_ctxt, <void*>self._error_log,             # <<<<<<<<<<<<<<
 *                                        <xmlerror.xmlGenericErrorFunc>_receiveXSLTError)
 *         if self._access_control is not None:
*/
  xsltSetTransformErrorFunc(__pyx_v_transform_ctxt, ((void *)__pyx_v_self->_error_log), ((xmlGenericErrorFunc)__pyx_f_4lxml_5etree__receiveXSLTError));

  /* "src/lxml/xslt.pxi":631
 *         xslt.xsltSetTransformErrorFunc(transform_ctxt, <void*>self._error_log,
 *                                        <xmlerror.xmlGenericErrorFunc>_receiveXSLTError)
 *         if self._access_control is not None:             # <<<<<<<<<<<<<<
 *             self._access_control._register_in_context(transform_ctxt)
 *         with self._error_log, nogil:
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_self->_access_control) != Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/xslt.pxi":632
 *                                        <xmlerror.xmlGenericErrorFunc>_receiveXSLTError)
 *         if self._access_control is not None:
 *             self._access_control._register_in_context(transform_ctxt)             # <<<<<<<<<<<<<<
 *         with self._error_log, nogil:
 *             orig_loader = _register_document_loader()
*/
    __pyx_f_4lxml_5etree_17XSLTAccessControl__register_in_context(__pyx_v_self->_access_control, __pyx_v_transform_ctxt);

    /* "src/lxml/xslt.pxi":631
 *         xslt.xsltSetTransformErrorFunc(transform_ctxt, <void*>self._error_log,
 *                                        <xmlerror.xmlGenericErrorFunc>_receiveXSLTError)
 *         if self._access_control is not None:             # <<<<<<<<<<<<<<
 *             self._access_control._register_in_context(transform_ctxt)
 *         with self._error_log, nogil:
*/
  }

  /* "src/lxml/xslt.pxi":633
 *         if self._access_control is not None:
 *             self._access_control._register_in_context(transform_ctxt)
 *         with self._error_log, nogil:             # <<<<<<<<<<<<<<
 *             orig_loader = _register_document_loader()
 *             c_result = xslt.xsltApplyStylesheetUser(
*/
  /*with:*/ {
    __pyx_t_2 = __Pyx_PyObject_LookupSpecial(((PyObject *)__pyx_v_self->_error_log), __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 633, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __pyx_f_4lxml_5etree_9_ErrorLog___enter__(__pyx_v_self->_error_log); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(3, 633, __pyx_L4_error)
    /*try:*/ {
      {
        (void)__pyx_t_4; (void)__pyx_t_5; (void)__pyx_t_6; /* mark used */
        /*try:*/ {
          {
              PyThreadState * _save;
              _save = PyEval_SaveThread();
              __Pyx_FastGIL_Remember();
              /*try:*/ {

                /* "src/lxml/xslt.pxi":634
 *             self._access_control._register_in_context(transform_ctxt)
 *         with self._error_log, nogil:
 *             orig_loader = _register_document_loader()             # <<<<<<<<<<<<<<
 *             c_result = xslt.xsltApplyStylesheetUser(
 *                 self._c_style, c_input_doc, params, NULL, NULL, transform_ctxt)
*/
                __pyx_v_orig_loader = __pyx_f_4lxml_5etree__register_document_loader();

                /* "src/lxml/xslt.pxi":635
 *         with self._error_log, nogil:
 *             orig_loader = _register_document_loader()
 *             c_result = xslt.xsltApplyStylesheetUser(             # <<<<<<<<<<<<<<
 *                 self._c_style, c_input_doc, params, NULL, NULL, transform_ctxt)
 *             _reset_document_loader(orig_loader)
*/
                __pyx_v_c_result = xsltApplyStylesheetUser(__pyx_v_self->_c_style, __pyx_v_c_input_doc, __pyx_v_params, NULL, NULL, __pyx_v_transform_ctxt);

                /* "src/lxml/xslt.pxi":637
 *             c_result = xslt.xsltApplyStylesheetUser(
 *                 self._c_style, c_input_doc, params, NULL, NULL, transform_ctxt)
 *             _reset_document_loader(orig_loader)             # <<<<<<<<<<<<<<
 *         return c_result
 * 
*/
                __pyx_f_4lxml_5etree__reset_document_loader(__pyx_v_orig_loader);
              }

              /* "src/lxml/xslt.pxi":633
 *         if self._access_control is not None:
 *             self._access_control._register_in_context(transform_ctxt)
 *         with self._error_log, nogil:             # <<<<<<<<<<<<<<
 *             orig_loader = _register_document_loader()
 *             c_result = xslt.xsltApplyStylesheetUser(
*/
              /*finally:*/ {
                /*normal exit:*/{
                  __Pyx_FastGIL_Forget();
                  PyEval_RestoreThread(_save);
                  goto __pyx_L16;
                }
                __pyx_L16:;
              }
          }
        }
      }
    }
    /*finally:*/ {
      /*normal exit:*/{
        if (__pyx_t_2) {
          __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_mstate_global->__pyx_tuple[3], NULL);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 633, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        goto __pyx_L7;
      }
      __pyx_L7:;
    }
    goto __pyx_L17;
    __pyx_L4_error:;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L1_error;
    __pyx_L17:;
  }

  /* "src/lxml/xslt.pxi":638
 *                 self._c_style, c_input_doc, params, NULL, NULL, transform_ctxt)
 *             _reset_document_loader(orig_loader)
 *         return c_result             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = __pyx_v_c_result;
  goto __pyx_L0;

  /* "src/lxml/xslt.pxi":625
 *         return _xsltResultTreeFactory(result_doc, self, profile_doc)
 * 
 *     cdef xmlDoc* _run_transform(self, xmlDoc* c_input_doc,             # <<<<<<<<<<<<<<
 *                                 const_char** params, _XSLTContext context,
 *                                 xslt.xsltTransformContext* transform_ctxt) except? NULL:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.XSLT._run_transform", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xslt.pxi":641
 * 
 * 
 * cdef _convert_xslt_parameters(xslt.xsltTransformContext* transform_ctxt,             # <<<<<<<<<<<<<<
 *                               dict parameters, const_char*** params_ptr):
 *     cdef Py_ssize_t i, parameter_count
*/

static PyObject *__pyx_f_4lxml_5etree__convert_xslt_parameters(xsltTransformContext *__pyx_v_transform_ctxt, PyObject *__pyx_v_parameters, const char ***__pyx_v_params_ptr) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_parameter_count;
  const char **__pyx_v_params;
  xmlDict *__pyx_v_c_dict;
  PyObject *__pyx_v_key = NULL;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_v_k = NULL;
  PyObject *__pyx_v_v = NULL;
  Py_ssize_t __pyx_v_c_len;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  xmlDict *__pyx_t_1;
  Py_ssize_t __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  Py_ssize_t __pyx_t_8;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  size_t __pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_convert_xslt_parameters", 0);

  /* "src/lxml/xslt.pxi":645
 *     cdef Py_ssize_t i, parameter_count
 *     cdef const_char** params
 *     cdef tree.xmlDict* c_dict = transform_ctxt.dict             # <<<<<<<<<<<<<<
 *     params_ptr[0] = NULL
 *     parameter_count = len(parameters)
*/
  __pyx_t_1 = __pyx_v_transform_ctxt->dict;
  __pyx_v_c_dict = __pyx_t_1;

  /* "src/lxml/xslt.pxi":646
 *     cdef const_char** params
 *     cdef tree.xmlDict* c_dict = transform_ctxt.dict
 *     params_ptr[0] = NULL             # <<<<<<<<<<<<<<
 *     parameter_count = len(parameters)
 *     if parameter_count == 0:
*/
  (__pyx_v_params_ptr[0]) = NULL;

  /* "src/lxml/xslt.pxi":647
 *     cdef tree.xmlDict* c_dict = transform_ctxt.dict
 *     params_ptr[0] = NULL
 *     parameter_count = len(parameters)             # <<<<<<<<<<<<<<
 *     if parameter_count == 0:
 *         return
*/
  if (unlikely(__pyx_v_parameters == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(3, 647, __pyx_L1_error)
  }
  __pyx_t_2 = PyDict_Size(__pyx_v_parameters); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(3, 647, __pyx_L1_error)
  __pyx_v_parameter_count = __pyx_t_2;

  /* "src/lxml/xslt.pxi":648
 *     params_ptr[0] = NULL
 *     parameter_count = len(parameters)
 *     if parameter_count == 0:             # <<<<<<<<<<<<<<
 *         return
 *     # allocate space for parameters
*/
  __pyx_t_3 = (__pyx_v_parameter_count == 0);
  if (__pyx_t_3) {

    /* "src/lxml/xslt.pxi":649
 *     parameter_count = len(parameters)
 *     if parameter_count == 0:
 *         return             # <<<<<<<<<<<<<<
 *     # allocate space for parameters
 *     # * 2 as we want an entry for both key and value,
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/xslt.pxi":648
 *     params_ptr[0] = NULL
 *     parameter_count = len(parameters)
 *     if parameter_count == 0:             # <<<<<<<<<<<<<<
 *         return
 *     # allocate space for parameters
*/
  }

  /* "src/lxml/xslt.pxi":653
 *     # * 2 as we want an entry for both key and value,
 *     # and + 1 as array is NULL terminated
 *     params = <const_char**>python.lxml_malloc(parameter_count * 2 + 1, sizeof(const_char*))             # <<<<<<<<<<<<<<
 *     if not params:
 *         raise MemoryError()
*/
  __pyx_v_params = ((const char **)lxml_malloc(((__pyx_v_parameter_count * 2) + 1), (sizeof(const char *))));

  /* "src/lxml/xslt.pxi":654
 *     # and + 1 as array is NULL terminated
 *     params = <const_char**>python.lxml_malloc(parameter_count * 2 + 1, sizeof(const_char*))
 *     if not params:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     try:
*/
  __pyx_t_3 = (!(__pyx_v_params != 0));
  if (unlikely(__pyx_t_3)) {

    /* "src/lxml/xslt.pxi":655
 *     params = <const_char**>python.lxml_malloc(parameter_count * 2 + 1, sizeof(const_char*))
 *     if not params:
 *         raise MemoryError()             # <<<<<<<<<<<<<<
 *     try:
 *         i = 0
*/
    PyErr_NoMemory(); __PYX_ERR(3, 655, __pyx_L1_error)

    /* "src/lxml/xslt.pxi":654
 *     # and + 1 as array is NULL terminated
 *     params = <const_char**>python.lxml_malloc(parameter_count * 2 + 1, sizeof(const_char*))
 *     if not params:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     try:
*/
  }

  /* "src/lxml/xslt.pxi":656
 *     if not params:
 *         raise MemoryError()
 *     try:             # <<<<<<<<<<<<<<
 *         i = 0
 *         for key, value in parameters.iteritems():
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_6);
    /*try:*/ {

      /* "src/lxml/xslt.pxi":657
 *         raise MemoryError()
 *     try:
 *         i = 0             # <<<<<<<<<<<<<<
 *         for key, value in parameters.iteritems():
 *             k = _utf8(key)
*/
      __pyx_v_i = 0;

      /* "src/lxml/xslt.pxi":658
 *     try:
 *         i = 0
 *         for key, value in parameters.iteritems():             # <<<<<<<<<<<<<<
 *             k = _utf8(key)
 *             if isinstance(value, _XSLTQuotedStringParam):
*/
      __pyx_t_2 = 0;
      if (unlikely(__pyx_v_parameters == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "iteritems");
        __PYX_ERR(3, 658, __pyx_L5_error)
      }
      __pyx_t_10 = __Pyx_dict_iterator(__pyx_v_parameters, 1, __pyx_mstate_global->__pyx_n_u_iteritems, (&__pyx_t_8), (&__pyx_t_9)); if (unlikely(!__pyx_t_10)) __PYX_ERR(3, 658, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_XDECREF(__pyx_t_7);
      __pyx_t_7 = __pyx_t_10;
      __pyx_t_10 = 0;
      while (1) {
        __pyx_t_12 = __Pyx_dict_iter_next(__pyx_t_7, __pyx_t_8, &__pyx_t_2, &__pyx_t_10, &__pyx_t_11, NULL, __pyx_t_9);
        if (unlikely(__pyx_t_12 == 0)) break;
        if (unlikely(__pyx_t_12 == -1)) __PYX_ERR(3, 658, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_10);
        __pyx_t_10 = 0;
        __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_11);
        __pyx_t_11 = 0;

        /* "src/lxml/xslt.pxi":659
 *         i = 0
 *         for key, value in parameters.iteritems():
 *             k = _utf8(key)             # <<<<<<<<<<<<<<
 *             if isinstance(value, _XSLTQuotedStringParam):
 *                 v = (<_XSLTQuotedStringParam>value).strval
*/
        __pyx_t_11 = __pyx_f_4lxml_5etree__utf8(__pyx_v_key); if (unlikely(!__pyx_t_11)) __PYX_ERR(3, 659, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_XDECREF_SET(__pyx_v_k, ((PyObject*)__pyx_t_11));
        __pyx_t_11 = 0;

        /* "src/lxml/xslt.pxi":660
 *         for key, value in parameters.iteritems():
 *             k = _utf8(key)
 *             if isinstance(value, _XSLTQuotedStringParam):             # <<<<<<<<<<<<<<
 *                 v = (<_XSLTQuotedStringParam>value).strval
 *                 xslt.xsltQuoteOneUserParam(
*/
        __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_value, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__XSLTQuotedStringParam); 
        if (__pyx_t_3) {

          /* "src/lxml/xslt.pxi":661
 *             k = _utf8(key)
 *             if isinstance(value, _XSLTQuotedStringParam):
 *                 v = (<_XSLTQuotedStringParam>value).strval             # <<<<<<<<<<<<<<
 *                 xslt.xsltQuoteOneUserParam(
 *                     transform_ctxt, _xcstr(k), _xcstr(v))
*/
          __pyx_t_11 = ((struct __pyx_obj_4lxml_5etree__XSLTQuotedStringParam *)__pyx_v_value)->strval;
          __Pyx_INCREF(__pyx_t_11);
          __Pyx_XDECREF_SET(__pyx_v_v, ((PyObject*)__pyx_t_11));
          __pyx_t_11 = 0;

          /* "src/lxml/xslt.pxi":662
 *             if isinstance(value, _XSLTQuotedStringParam):
 *                 v = (<_XSLTQuotedStringParam>value).strval
 *                 xslt.xsltQuoteOneUserParam(             # <<<<<<<<<<<<<<
 *                     transform_ctxt, _xcstr(k), _xcstr(v))
 *             else:
*/
          (void)(xsltQuoteOneUserParam(__pyx_v_transform_ctxt, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_k), (const xmlChar*)PyBytes_AS_STRING(__pyx_v_v)));

          /* "src/lxml/xslt.pxi":660
 *         for key, value in parameters.iteritems():
 *             k = _utf8(key)
 *             if isinstance(value, _XSLTQuotedStringParam):             # <<<<<<<<<<<<<<
 *                 v = (<_XSLTQuotedStringParam>value).strval
 *                 xslt.xsltQuoteOneUserParam(
*/
          goto __pyx_L13;
        }

        /* "src/lxml/xslt.pxi":665
 *                     transform_ctxt, _xcstr(k), _xcstr(v))
 *             else:
 *                 if isinstance(value, XPath):             # <<<<<<<<<<<<<<
 *                     v = (<XPath>value)._path
 *                 else:
*/
        /*else*/ {
          __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_value, __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XPath); 
          if (__pyx_t_3) {

            /* "src/lxml/xslt.pxi":666
 *             else:
 *                 if isinstance(value, XPath):
 *                     v = (<XPath>value)._path             # <<<<<<<<<<<<<<
 *                 else:
 *                     v = _utf8(value)
*/
            __pyx_t_11 = ((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_v_value)->_path;
            __Pyx_INCREF(__pyx_t_11);
            __Pyx_XDECREF_SET(__pyx_v_v, ((PyObject*)__pyx_t_11));
            __pyx_t_11 = 0;

            /* "src/lxml/xslt.pxi":665
 *                     transform_ctxt, _xcstr(k), _xcstr(v))
 *             else:
 *                 if isinstance(value, XPath):             # <<<<<<<<<<<<<<
 *                     v = (<XPath>value)._path
 *                 else:
*/
            goto __pyx_L14;
          }

          /* "src/lxml/xslt.pxi":668
 *                     v = (<XPath>value)._path
 *                 else:
 *                     v = _utf8(value)             # <<<<<<<<<<<<<<
 * 
 *                 c_len = len(k)
*/
          /*else*/ {
            __pyx_t_11 = __pyx_f_4lxml_5etree__utf8(__pyx_v_value); if (unlikely(!__pyx_t_11)) __PYX_ERR(3, 668, __pyx_L5_error)
            __Pyx_GOTREF(__pyx_t_11);
            __Pyx_XDECREF_SET(__pyx_v_v, ((PyObject*)__pyx_t_11));
            __pyx_t_11 = 0;
          }
          __pyx_L14:;

          /* "src/lxml/xslt.pxi":670
 *                     v = _utf8(value)
 * 
 *                 c_len = len(k)             # <<<<<<<<<<<<<<
 *                 if c_len > limits.INT_MAX:
 *                     raise ValueError("Parameter name too long")
*/
          if (unlikely(__pyx_v_k == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
            __PYX_ERR(3, 670, __pyx_L5_error)
          }
          __pyx_t_13 = __Pyx_PyBytes_GET_SIZE(__pyx_v_k); if (unlikely(__pyx_t_13 == ((Py_ssize_t)-1))) __PYX_ERR(3, 670, __pyx_L5_error)
          __pyx_v_c_len = __pyx_t_13;

          /* "src/lxml/xslt.pxi":671
 * 
 *                 c_len = len(k)
 *                 if c_len > limits.INT_MAX:             # <<<<<<<<<<<<<<
 *                     raise ValueError("Parameter name too long")
 *                 params[i] = <const_char*> tree.xmlDictLookup(c_dict, _xcstr(k), <int> c_len)
*/
          __pyx_t_3 = (__pyx_v_c_len > INT_MAX);
          if (unlikely(__pyx_t_3)) {

            /* "src/lxml/xslt.pxi":672
 *                 c_len = len(k)
 *                 if c_len > limits.INT_MAX:
 *                     raise ValueError("Parameter name too long")             # <<<<<<<<<<<<<<
 *                 params[i] = <const_char*> tree.xmlDictLookup(c_dict, _xcstr(k), <int> c_len)
 *                 i += 1
*/
            __pyx_t_10 = NULL;
            __pyx_t_14 = 1;
            {
              PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_mstate_global->__pyx_kp_u_Parameter_name_too_long};
              __pyx_t_11 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_14, (2-__pyx_t_14) | (__pyx_t_14*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
              __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
              if (unlikely(!__pyx_t_11)) __PYX_ERR(3, 672, __pyx_L5_error)
              __Pyx_GOTREF(__pyx_t_11);
            }
            __Pyx_Raise(__pyx_t_11, 0, 0, 0);
            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
            __PYX_ERR(3, 672, __pyx_L5_error)

            /* "src/lxml/xslt.pxi":671
 * 
 *                 c_len = len(k)
 *                 if c_len > limits.INT_MAX:             # <<<<<<<<<<<<<<
 *                     raise ValueError("Parameter name too long")
 *                 params[i] = <const_char*> tree.xmlDictLookup(c_dict, _xcstr(k), <int> c_len)
*/
          }

          /* "src/lxml/xslt.pxi":673
 *                 if c_len > limits.INT_MAX:
 *                     raise ValueError("Parameter name too long")
 *                 params[i] = <const_char*> tree.xmlDictLookup(c_dict, _xcstr(k), <int> c_len)             # <<<<<<<<<<<<<<
 *                 i += 1
 *                 c_len = len(v)
*/
          (__pyx_v_params[__pyx_v_i]) = ((const char *)xmlDictLookup(__pyx_v_c_dict, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_k), ((int)__pyx_v_c_len)));

          /* "src/lxml/xslt.pxi":674
 *                     raise ValueError("Parameter name too long")
 *                 params[i] = <const_char*> tree.xmlDictLookup(c_dict, _xcstr(k), <int> c_len)
 *                 i += 1             # <<<<<<<<<<<<<<
 *                 c_len = len(v)
 *                 if c_len > limits.INT_MAX:
*/
          __pyx_v_i = (__pyx_v_i + 1);

          /* "src/lxml/xslt.pxi":675
 *                 params[i] = <const_char*> tree.xmlDictLookup(c_dict, _xcstr(k), <int> c_len)
 *                 i += 1
 *                 c_len = len(v)             # <<<<<<<<<<<<<<
 *                 if c_len > limits.INT_MAX:
 *                     raise ValueError("Parameter value too long")
*/
          if (unlikely(__pyx_v_v == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
            __PYX_ERR(3, 675, __pyx_L5_error)
          }
          __pyx_t_13 = __Pyx_PyBytes_GET_SIZE(__pyx_v_v); if (unlikely(__pyx_t_13 == ((Py_ssize_t)-1))) __PYX_ERR(3, 675, __pyx_L5_error)
          __pyx_v_c_len = __pyx_t_13;

          /* "src/lxml/xslt.pxi":676
 *                 i += 1
 *                 c_len = len(v)
 *                 if c_len > limits.INT_MAX:             # <<<<<<<<<<<<<<
 *                     raise ValueError("Parameter value too long")
 *                 params[i] = <const_char*> tree.xmlDictLookup(c_dict, _xcstr(v), <int> c_len)
*/
          __pyx_t_3 = (__pyx_v_c_len > INT_MAX);
          if (unlikely(__pyx_t_3)) {

            /* "src/lxml/xslt.pxi":677
 *                 c_len = len(v)
 *                 if c_len > limits.INT_MAX:
 *                     raise ValueError("Parameter value too long")             # <<<<<<<<<<<<<<
 *                 params[i] = <const_char*> tree.xmlDictLookup(c_dict, _xcstr(v), <int> c_len)
 *                 i += 1
*/
            __pyx_t_10 = NULL;
            __pyx_t_14 = 1;
            {
              PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_mstate_global->__pyx_kp_u_Parameter_value_too_long};
              __pyx_t_11 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_14, (2-__pyx_t_14) | (__pyx_t_14*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
              __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
              if (unlikely(!__pyx_t_11)) __PYX_ERR(3, 677, __pyx_L5_error)
              __Pyx_GOTREF(__pyx_t_11);
            }
            __Pyx_Raise(__pyx_t_11, 0, 0, 0);
            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
            __PYX_ERR(3, 677, __pyx_L5_error)

            /* "src/lxml/xslt.pxi":676
 *                 i += 1
 *                 c_len = len(v)
 *                 if c_len > limits.INT_MAX:             # <<<<<<<<<<<<<<
 *                     raise ValueError("Parameter value too long")
 *                 params[i] = <const_char*> tree.xmlDictLookup(c_dict, _xcstr(v), <int> c_len)
*/
          }

          /* "src/lxml/xslt.pxi":678
 *                 if c_len > limits.INT_MAX:
 *                     raise ValueError("Parameter value too long")
 *                 params[i] = <const_char*> tree.xmlDictLookup(c_dict, _xcstr(v), <int> c_len)             # <<<<<<<<<<<<<<
 *                 i += 1
 *     except:
*/
          (__pyx_v_params[__pyx_v_i]) = ((const char *)xmlDictLookup(__pyx_v_c_dict, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_v), ((int)__pyx_v_c_len)));

          /* "src/lxml/xslt.pxi":679
 *                     raise ValueError("Parameter value too long")
 *                 params[i] = <const_char*> tree.xmlDictLookup(c_dict, _xcstr(v), <int> c_len)
 *                 i += 1             # <<<<<<<<<<<<<<
 *     except:
 *         python.lxml_free(params)
*/
          __pyx_v_i = (__pyx_v_i + 1);
        }
        __pyx_L13:;
      }
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "src/lxml/xslt.pxi":656
 *     if not params:
 *         raise MemoryError()
 *     try:             # <<<<<<<<<<<<<<
 *         i = 0
 *         for key, value in parameters.iteritems():
*/
    }
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L10_try_end;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "src/lxml/xslt.pxi":680
 *                 params[i] = <const_char*> tree.xmlDictLookup(c_dict, _xcstr(v), <int> c_len)
 *                 i += 1
 *     except:             # <<<<<<<<<<<<<<
 *         python.lxml_free(params)
 *         raise
*/
    /*except:*/ {
      __Pyx_AddTraceback("lxml.etree._convert_xslt_parameters", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_11, &__pyx_t_10) < 0) __PYX_ERR(3, 680, __pyx_L7_except_error)
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_10);

      /* "src/lxml/xslt.pxi":681
 *                 i += 1
 *     except:
 *         python.lxml_free(params)             # <<<<<<<<<<<<<<
 *         raise
 *     params[i] = NULL
*/
      lxml_free(__pyx_v_params);

      /* "src/lxml/xslt.pxi":682
 *     except:
 *         python.lxml_free(params)
 *         raise             # <<<<<<<<<<<<<<
 *     params[i] = NULL
 *     params_ptr[0] = params
*/
      __Pyx_GIVEREF(__pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_ErrRestoreWithState(__pyx_t_7, __pyx_t_11, __pyx_t_10);
      __pyx_t_7 = 0;  __pyx_t_11 = 0;  __pyx_t_10 = 0; 
      __PYX_ERR(3, 682, __pyx_L7_except_error)
    }

    /* "src/lxml/xslt.pxi":656
 *     if not params:
 *         raise MemoryError()
 *     try:             # <<<<<<<<<<<<<<
 *         i = 0
 *         for key, value in parameters.iteritems():
*/
    __pyx_L7_except_error:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    goto __pyx_L1_error;
    __pyx_L10_try_end:;
  }

  /* "src/lxml/xslt.pxi":683
 *         python.lxml_free(params)
 *         raise
 *     params[i] = NULL             # <<<<<<<<<<<<<<
 *     params_ptr[0] = params
 * 
*/
  (__pyx_v_params[__pyx_v_i]) = NULL;

  /* "src/lxml/xslt.pxi":684
 *         raise
 *     params[i] = NULL
 *     params_ptr[0] = params             # <<<<<<<<<<<<<<
 * 
 * cdef XSLT _copyXSLT(XSLT stylesheet):
*/
  (__pyx_v_params_ptr[0]) = __pyx_v_params;

  /* "src/lxml/xslt.pxi":641
 * 
 * 
 * cdef _convert_xslt_parameters(xslt.xsltTransformContext* transform_ctxt,             # <<<<<<<<<<<<<<
 *                               dict parameters, const_char*** params_ptr):
 *     cdef Py_ssize_t i, parameter_count
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("lxml.etree._convert_xslt_parameters", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XDECREF(__pyx_v_k);
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xslt.pxi":686
 *     params_ptr[0] = params
 * 
 * cdef XSLT _copyXSLT(XSLT stylesheet):             # <<<<<<<<<<<<<<
 *     cdef XSLT new_xslt
 *     cdef xmlDoc* c_doc
*/

static struct __pyx_obj_4lxml_5etree_XSLT *__pyx_f_4lxml_5etree__copyXSLT(struct __pyx_obj_4lxml_5etree_XSLT *__pyx_v_stylesheet) {
  struct __pyx_obj_4lxml_5etree_XSLT *__pyx_v_new_xslt = 0;
  xmlDoc *__pyx_v_c_doc;
  struct __pyx_obj_4lxml_5etree_XSLT *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  xmlDoc *__pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_copyXSLT", 0);

  /* "src/lxml/xslt.pxi":689
 *     cdef XSLT new_xslt
 *     cdef xmlDoc* c_doc
 *     assert stylesheet._c_style is not NULL, "XSLT stylesheet not initialised"             # <<<<<<<<<<<<<<
 *     new_xslt = XSLT.__new__(XSLT)
 *     new_xslt._access_control = stylesheet._access_control
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = (__pyx_v_stylesheet->_c_style != NULL);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_mstate_global->__pyx_kp_u_XSLT_stylesheet_not_initialised, 0, 0);
      __PYX_ERR(3, 689, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(3, 689, __pyx_L1_error)
  #endif

  /* "src/lxml/xslt.pxi":690
 *     cdef xmlDoc* c_doc
 *     assert stylesheet._c_style is not NULL, "XSLT stylesheet not initialised"
 *     new_xslt = XSLT.__new__(XSLT)             # <<<<<<<<<<<<<<
 *     new_xslt._access_control = stylesheet._access_control
 *     new_xslt._error_log = _ErrorLog()
*/
  __pyx_t_2 = ((PyObject *)__pyx_tp_new_4lxml_5etree_XSLT(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XSLT), __pyx_mstate_global->__pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 690, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_2);
  __pyx_v_new_xslt = ((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/xslt.pxi":691
 *     assert stylesheet._c_style is not NULL, "XSLT stylesheet not initialised"
 *     new_xslt = XSLT.__new__(XSLT)
 *     new_xslt._access_control = stylesheet._access_control             # <<<<<<<<<<<<<<
 *     new_xslt._error_log = _ErrorLog()
 *     new_xslt._context = stylesheet._context._copy()
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_stylesheet->_access_control);
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF((PyObject *)__pyx_v_new_xslt->_access_control);
  __Pyx_DECREF((PyObject *)__pyx_v_new_xslt->_access_control);
  __pyx_v_new_xslt->_access_control = ((struct __pyx_obj_4lxml_5etree_XSLTAccessControl *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/xslt.pxi":692
 *     new_xslt = XSLT.__new__(XSLT)
 *     new_xslt._access_control = stylesheet._access_control
 *     new_xslt._error_log = _ErrorLog()             # <<<<<<<<<<<<<<
 *     new_xslt._context = stylesheet._context._copy()
 * 
*/
  __pyx_t_3 = NULL;
  __pyx_t_4 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ErrorLog, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 692, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_2);
  }
  __Pyx_GIVEREF((PyObject *)__pyx_t_2);
  __Pyx_GOTREF((PyObject *)__pyx_v_new_xslt->_error_log);
  __Pyx_DECREF((PyObject *)__pyx_v_new_xslt->_error_log);
  __pyx_v_new_xslt->_error_log = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/xslt.pxi":693
 *     new_xslt._access_control = stylesheet._access_control
 *     new_xslt._error_log = _ErrorLog()
 *     new_xslt._context = stylesheet._context._copy()             # <<<<<<<<<<<<<<
 * 
 *     new_xslt._xslt_resolver_context = stylesheet._xslt_resolver_context._copy()
*/
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree_12_XSLTContext__copy(__pyx_v_stylesheet->_context)); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 693, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__XSLTContext))))) __PYX_ERR(3, 693, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF((PyObject *)__pyx_v_new_xslt->_context);
  __Pyx_DECREF((PyObject *)__pyx_v_new_xslt->_context);
  __pyx_v_new_xslt->_context = ((struct __pyx_obj_4lxml_5etree__XSLTContext *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/xslt.pxi":695
 *     new_xslt._context = stylesheet._context._copy()
 * 
 *     new_xslt._xslt_resolver_context = stylesheet._xslt_resolver_context._copy()             # <<<<<<<<<<<<<<
 *     new_xslt._xslt_resolver_context._c_style_doc = _copyDoc(
 *         stylesheet._xslt_resolver_context._c_style_doc, 1)
*/
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree_20_XSLTResolverContext__copy(__pyx_v_stylesheet->_xslt_resolver_context)); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 695, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF((PyObject *)__pyx_v_new_xslt->_xslt_resolver_context);
  __Pyx_DECREF((PyObject *)__pyx_v_new_xslt->_xslt_resolver_context);
  __pyx_v_new_xslt->_xslt_resolver_context = ((struct __pyx_obj_4lxml_5etree__XSLTResolverContext *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/xslt.pxi":696
 * 
 *     new_xslt._xslt_resolver_context = stylesheet._xslt_resolver_context._copy()
 *     new_xslt._xslt_resolver_context._c_style_doc = _copyDoc(             # <<<<<<<<<<<<<<
 *         stylesheet._xslt_resolver_context._c_style_doc, 1)
 * 
*/
  __pyx_t_5 = __pyx_f_4lxml_5etree__copyDoc(__pyx_v_stylesheet->_xslt_resolver_context->_c_style_doc, 1); if (unlikely(__pyx_t_5 == ((void *)NULL))) __PYX_ERR(3, 696, __pyx_L1_error)
  __pyx_v_new_xslt->_xslt_resolver_context->_c_style_doc = __pyx_t_5;

  /* "src/lxml/xslt.pxi":699
 *         stylesheet._xslt_resolver_context._c_style_doc, 1)
 * 
 *     c_doc = _copyDoc(stylesheet._c_style.doc, 1)             # <<<<<<<<<<<<<<
 *     new_xslt._c_style = xslt.xsltParseStylesheetDoc(c_doc)
 *     if new_xslt._c_style is NULL:
*/
  __pyx_t_5 = __pyx_f_4lxml_5etree__copyDoc(__pyx_v_stylesheet->_c_style->doc, 1); if (unlikely(__pyx_t_5 == ((void *)NULL))) __PYX_ERR(3, 699, __pyx_L1_error)
  __pyx_v_c_doc = __pyx_t_5;

  /* "src/lxml/xslt.pxi":700
 * 
 *     c_doc = _copyDoc(stylesheet._c_style.doc, 1)
 *     new_xslt._c_style = xslt.xsltParseStylesheetDoc(c_doc)             # <<<<<<<<<<<<<<
 *     if new_xslt._c_style is NULL:
 *         tree.xmlFreeDoc(c_doc)
*/
  __pyx_v_new_xslt->_c_style = xsltParseStylesheetDoc(__pyx_v_c_doc);

  /* "src/lxml/xslt.pxi":701
 *     c_doc = _copyDoc(stylesheet._c_style.doc, 1)
 *     new_xslt._c_style = xslt.xsltParseStylesheetDoc(c_doc)
 *     if new_xslt._c_style is NULL:             # <<<<<<<<<<<<<<
 *         tree.xmlFreeDoc(c_doc)
 *         raise MemoryError()
*/
  __pyx_t_1 = (__pyx_v_new_xslt->_c_style == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/xslt.pxi":702
 *     new_xslt._c_style = xslt.xsltParseStylesheetDoc(c_doc)
 *     if new_xslt._c_style is NULL:
 *         tree.xmlFreeDoc(c_doc)             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 * 
*/
    xmlFreeDoc(__pyx_v_c_doc);

    /* "src/lxml/xslt.pxi":703
 *     if new_xslt._c_style is NULL:
 *         tree.xmlFreeDoc(c_doc)
 *         raise MemoryError()             # <<<<<<<<<<<<<<
 * 
 *     return new_xslt
*/
    PyErr_NoMemory(); __PYX_ERR(3, 703, __pyx_L1_error)

    /* "src/lxml/xslt.pxi":701
 *     c_doc = _copyDoc(stylesheet._c_style.doc, 1)
 *     new_xslt._c_style = xslt.xsltParseStylesheetDoc(c_doc)
 *     if new_xslt._c_style is NULL:             # <<<<<<<<<<<<<<
 *         tree.xmlFreeDoc(c_doc)
 *         raise MemoryError()
*/
  }

  /* "src/lxml/xslt.pxi":705
 *         raise MemoryError()
 * 
 *     return new_xslt             # <<<<<<<<<<<<<<
 * 
 * @cython.final
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_new_xslt);
  __pyx_r = __pyx_v_new_xslt;
  goto __pyx_L0;

  /* "src/lxml/xslt.pxi":686
 *     params_ptr[0] = params
 * 
 * cdef XSLT _copyXSLT(XSLT stylesheet):             # <<<<<<<<<<<<<<
 *     cdef XSLT new_xslt
 *     cdef xmlDoc* c_doc
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._copyXSLT", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_new_xslt);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xslt.pxi":720
 *     cdef Py_ssize_t _buffer_refcnt
 * 
 *     def write_output(self, file, *, compression=0):             # <<<<<<<<<<<<<<
 *         """write_output(self, file, *, compression=0)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_15_XSLTResultTree_1write_output(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_15_XSLTResultTree_write_output, "write_output(self, file, *, compression=0)\n\n        Serialise the XSLT output to a file or file-like object.\n\n        As opposed to the generic ``.write()`` method, ``.write_output()`` serialises\n        the result as defined by the ``<xsl:output>`` tag.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_15_XSLTResultTree_1write_output = {"write_output", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_15_XSLTResultTree_1write_output, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_15_XSLTResultTree_write_output};
static PyObject *__pyx_pw_4lxml_5etree_15_XSLTResultTree_1write_output(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_file = 0;
  PyObject *__pyx_v_compression = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write_output (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_file,&__pyx_mstate_global->__pyx_n_u_compression,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(3, 720, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(3, 720, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "write_output", 0) < (0)) __PYX_ERR(3, 720, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_int_0));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("write_output", 1, 1, 1, i); __PYX_ERR(3, 720, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(3, 720, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_int_0));
    }
    __pyx_v_file = values[0];
    __pyx_v_compression = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("write_output", 1, 1, 1, __pyx_nargs); __PYX_ERR(3, 720, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._XSLTResultTree.write_output", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_15_XSLTResultTree_write_output(((struct __pyx_obj_4lxml_5etree__XSLTResultTree *)__pyx_v_self), __pyx_v_file, __pyx_v_compression);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_15_XSLTResultTree_write_output(struct __pyx_obj_4lxml_5etree__XSLTResultTree *__pyx_v_self, PyObject *__pyx_v_file, PyObject *__pyx_v_compression) {
  struct __pyx_obj_4lxml_5etree__FilelikeWriter *__pyx_v_writer = 0;
  struct LxmlDocument *__pyx_v_doc = 0;
  int __pyx_v_r;
  int __pyx_v_rclose;
  int __pyx_v_c_compression;
  const xmlChar *__pyx_v_c_encoding;
  xmlOutputBuffer *__pyx_v_c_buffer;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("write_output", 0);

  /* "src/lxml/xslt.pxi":728
 *         the result as defined by the ``<xsl:output>`` tag.
 *         """
 *         cdef _FilelikeWriter writer = None             # <<<<<<<<<<<<<<
 *         cdef _Document doc
 *         cdef int r, rclose, c_compression
*/
  __Pyx_INCREF(Py_None);
  __pyx_v_writer = ((struct __pyx_obj_4lxml_5etree__FilelikeWriter *)Py_None);

  /* "src/lxml/xslt.pxi":731
 *         cdef _Document doc
 *         cdef int r, rclose, c_compression
 *         cdef const_xmlChar* c_encoding = NULL             # <<<<<<<<<<<<<<
 *         cdef tree.xmlOutputBuffer* c_buffer
 * 
*/
  __pyx_v_c_encoding = NULL;

  /* "src/lxml/xslt.pxi":734
 *         cdef tree.xmlOutputBuffer* c_buffer
 * 
 *         if self._context_node is not None:             # <<<<<<<<<<<<<<
 *             doc = self._context_node._doc
 *         else:
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_self->__pyx_base._context_node) != Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/xslt.pxi":735
 * 
 *         if self._context_node is not None:
 *             doc = self._context_node._doc             # <<<<<<<<<<<<<<
 *         else:
 *             doc = None
*/
    __pyx_t_2 = ((PyObject *)__pyx_v_self->__pyx_base._context_node->_doc);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/xslt.pxi":734
 *         cdef tree.xmlOutputBuffer* c_buffer
 * 
 *         if self._context_node is not None:             # <<<<<<<<<<<<<<
 *             doc = self._context_node._doc
 *         else:
*/
    goto __pyx_L3;
  }

  /* "src/lxml/xslt.pxi":737
 *             doc = self._context_node._doc
 *         else:
 *             doc = None             # <<<<<<<<<<<<<<
 *         if doc is None:
 *             doc = self._doc
*/
  /*else*/ {
    __Pyx_INCREF(Py_None);
    __pyx_v_doc = ((struct LxmlDocument *)Py_None);
  }
  __pyx_L3:;

  /* "src/lxml/xslt.pxi":738
 *         else:
 *             doc = None
 *         if doc is None:             # <<<<<<<<<<<<<<
 *             doc = self._doc
 *             if doc is None:
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_doc) == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/xslt.pxi":739
 *             doc = None
 *         if doc is None:
 *             doc = self._doc             # <<<<<<<<<<<<<<
 *             if doc is None:
 *                 raise XSLTSaveError("No document to serialise")
*/
    __pyx_t_2 = ((PyObject *)__pyx_v_self->__pyx_base._doc);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_doc, ((struct LxmlDocument *)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "src/lxml/xslt.pxi":740
 *         if doc is None:
 *             doc = self._doc
 *             if doc is None:             # <<<<<<<<<<<<<<
 *                 raise XSLTSaveError("No document to serialise")
 *         c_compression = compression or 0
*/
    __pyx_t_1 = (((PyObject *)__pyx_v_doc) == Py_None);
    if (unlikely(__pyx_t_1)) {

      /* "src/lxml/xslt.pxi":741
 *             doc = self._doc
 *             if doc is None:
 *                 raise XSLTSaveError("No document to serialise")             # <<<<<<<<<<<<<<
 *         c_compression = compression or 0
 *         xslt.LXML_GET_XSLT_ENCODING(c_encoding, self._xslt._c_style)
*/
      __pyx_t_3 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_XSLTSaveError); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 741, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
        assert(__pyx_t_3);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
        __pyx_t_5 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_No_document_to_serialise};
        __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 741, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(3, 741, __pyx_L1_error)

      /* "src/lxml/xslt.pxi":740
 *         if doc is None:
 *             doc = self._doc
 *             if doc is None:             # <<<<<<<<<<<<<<
 *                 raise XSLTSaveError("No document to serialise")
 *         c_compression = compression or 0
*/
    }

    /* "src/lxml/xslt.pxi":738
 *         else:
 *             doc = None
 *         if doc is None:             # <<<<<<<<<<<<<<
 *             doc = self._doc
 *             if doc is None:
*/
  }

  /* "src/lxml/xslt.pxi":742
 *             if doc is None:
 *                 raise XSLTSaveError("No document to serialise")
 *         c_compression = compression or 0             # <<<<<<<<<<<<<<
 *         xslt.LXML_GET_XSLT_ENCODING(c_encoding, self._xslt._c_style)
 *         writer = _create_output_buffer(file, <const_char*>c_encoding, c_compression, &c_buffer, close=False)
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_compression); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(3, 742, __pyx_L1_error)
  if (!__pyx_t_1) {
  } else {
    __pyx_t_7 = __Pyx_PyLong_As_int(__pyx_v_compression); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(3, 742, __pyx_L1_error)
    __pyx_t_6 = __pyx_t_7;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_6 = 0;
  __pyx_L6_bool_binop_done:;
  __pyx_v_c_compression = __pyx_t_6;

  /* "src/lxml/xslt.pxi":743
 *                 raise XSLTSaveError("No document to serialise")
 *         c_compression = compression or 0
 *         xslt.LXML_GET_XSLT_ENCODING(c_encoding, self._xslt._c_style)             # <<<<<<<<<<<<<<
 *         writer = _create_output_buffer(file, <const_char*>c_encoding, c_compression, &c_buffer, close=False)
 *         if writer is None:
*/
  LXML_GET_XSLT_ENCODING(__pyx_v_c_encoding, __pyx_v_self->_xslt->_c_style);

  /* "src/lxml/xslt.pxi":744
 *         c_compression = compression or 0
 *         xslt.LXML_GET_XSLT_ENCODING(c_encoding, self._xslt._c_style)
 *         writer = _create_output_buffer(file, <const_char*>c_encoding, c_compression, &c_buffer, close=False)             # <<<<<<<<<<<<<<
 *         if writer is None:
 *             with nogil:
*/
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__create_output_buffer(__pyx_v_file, ((const char *)__pyx_v_c_encoding), __pyx_v_c_compression, (&__pyx_v_c_buffer), 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 744, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_writer, ((struct __pyx_obj_4lxml_5etree__FilelikeWriter *)__pyx_t_2));
  __pyx_t_2 = 0;

  /* "src/lxml/xslt.pxi":745
 *         xslt.LXML_GET_XSLT_ENCODING(c_encoding, self._xslt._c_style)
 *         writer = _create_output_buffer(file, <const_char*>c_encoding, c_compression, &c_buffer, close=False)
 *         if writer is None:             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 r = xslt.xsltSaveResultTo(c_buffer, doc._c_doc, self._xslt._c_style)
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_writer) == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/xslt.pxi":746
 *         writer = _create_output_buffer(file, <const_char*>c_encoding, c_compression, &c_buffer, close=False)
 *         if writer is None:
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 r = xslt.xsltSaveResultTo(c_buffer, doc._c_doc, self._xslt._c_style)
 *                 rclose = tree.xmlOutputBufferClose(c_buffer)
*/
    {
        PyThreadState * _save;
        _save = PyEval_SaveThread();
        __Pyx_FastGIL_Remember();
        /*try:*/ {

          /* "src/lxml/xslt.pxi":747
 *         if writer is None:
 *             with nogil:
 *                 r = xslt.xsltSaveResultTo(c_buffer, doc._c_doc, self._xslt._c_style)             # <<<<<<<<<<<<<<
 *                 rclose = tree.xmlOutputBufferClose(c_buffer)
 *         else:
*/
          __pyx_v_r = xsltSaveResultTo(__pyx_v_c_buffer, __pyx_v_doc->_c_doc, __pyx_v_self->_xslt->_c_style);

          /* "src/lxml/xslt.pxi":748
 *             with nogil:
 *                 r = xslt.xsltSaveResultTo(c_buffer, doc._c_doc, self._xslt._c_style)
 *                 rclose = tree.xmlOutputBufferClose(c_buffer)             # <<<<<<<<<<<<<<
 *         else:
 *             r = xslt.xsltSaveResultTo(c_buffer, doc._c_doc, self._xslt._c_style)
*/
          __pyx_v_rclose = xmlOutputBufferClose(__pyx_v_c_buffer);
        }

        /* "src/lxml/xslt.pxi":746
 *         writer = _create_output_buffer(file, <const_char*>c_encoding, c_compression, &c_buffer, close=False)
 *         if writer is None:
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 r = xslt.xsltSaveResultTo(c_buffer, doc._c_doc, self._xslt._c_style)
 *                 rclose = tree.xmlOutputBufferClose(c_buffer)
*/
        /*finally:*/ {
          /*normal exit:*/{
            __Pyx_FastGIL_Forget();
            PyEval_RestoreThread(_save);
            goto __pyx_L11;
          }
          __pyx_L11:;
        }
    }

    /* "src/lxml/xslt.pxi":745
 *         xslt.LXML_GET_XSLT_ENCODING(c_encoding, self._xslt._c_style)
 *         writer = _create_output_buffer(file, <const_char*>c_encoding, c_compression, &c_buffer, close=False)
 *         if writer is None:             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 r = xslt.xsltSaveResultTo(c_buffer, doc._c_doc, self._xslt._c_style)
*/
    goto __pyx_L8;
  }

  /* "src/lxml/xslt.pxi":750
 *                 rclose = tree.xmlOutputBufferClose(c_buffer)
 *         else:
 *             r = xslt.xsltSaveResultTo(c_buffer, doc._c_doc, self._xslt._c_style)             # <<<<<<<<<<<<<<
 *             rclose = tree.xmlOutputBufferClose(c_buffer)
 *         if writer is not None:
*/
  /*else*/ {
    __pyx_v_r = xsltSaveResultTo(__pyx_v_c_buffer, __pyx_v_doc->_c_doc, __pyx_v_self->_xslt->_c_style);

    /* "src/lxml/xslt.pxi":751
 *         else:
 *             r = xslt.xsltSaveResultTo(c_buffer, doc._c_doc, self._xslt._c_style)
 *             rclose = tree.xmlOutputBufferClose(c_buffer)             # <<<<<<<<<<<<<<
 *         if writer is not None:
 *             writer._exc_context._raise_if_stored()
*/
    __pyx_v_rclose = xmlOutputBufferClose(__pyx_v_c_buffer);
  }
  __pyx_L8:;

  /* "src/lxml/xslt.pxi":752
 *             r = xslt.xsltSaveResultTo(c_buffer, doc._c_doc, self._xslt._c_style)
 *             rclose = tree.xmlOutputBufferClose(c_buffer)
 *         if writer is not None:             # <<<<<<<<<<<<<<
 *             writer._exc_context._raise_if_stored()
 *         if r < 0 or rclose == -1:
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_writer) != Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/xslt.pxi":753
 *             rclose = tree.xmlOutputBufferClose(c_buffer)
 *         if writer is not None:
 *             writer._exc_context._raise_if_stored()             # <<<<<<<<<<<<<<
 *         if r < 0 or rclose == -1:
 *             python.PyErr_SetFromErrno(IOError)  # raises IOError
*/
    __pyx_t_6 = __pyx_f_4lxml_5etree_17_ExceptionContext__raise_if_stored(__pyx_v_writer->_exc_context); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(3, 753, __pyx_L1_error)

    /* "src/lxml/xslt.pxi":752
 *             r = xslt.xsltSaveResultTo(c_buffer, doc._c_doc, self._xslt._c_style)
 *             rclose = tree.xmlOutputBufferClose(c_buffer)
 *         if writer is not None:             # <<<<<<<<<<<<<<
 *             writer._exc_context._raise_if_stored()
 *         if r < 0 or rclose == -1:
*/
  }

  /* "src/lxml/xslt.pxi":754
 *         if writer is not None:
 *             writer._exc_context._raise_if_stored()
 *         if r < 0 or rclose == -1:             # <<<<<<<<<<<<<<
 *             python.PyErr_SetFromErrno(IOError)  # raises IOError
 * 
*/
  __pyx_t_8 = (__pyx_v_r < 0);
  if (!__pyx_t_8) {
  } else {
    __pyx_t_1 = __pyx_t_8;
    goto __pyx_L14_bool_binop_done;
  }
  __pyx_t_8 = (__pyx_v_rclose == -1L);
  __pyx_t_1 = __pyx_t_8;
  __pyx_L14_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/xslt.pxi":755
 *             writer._exc_context._raise_if_stored()
 *         if r < 0 or rclose == -1:
 *             python.PyErr_SetFromErrno(IOError)  # raises IOError             # <<<<<<<<<<<<<<
 * 
 *     cdef _saveToStringAndSize(self, xmlChar** s, int* l):
*/
    __pyx_t_2 = PyErr_SetFromErrno(((PyObject *)(((PyTypeObject*)PyExc_IOError)))); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 755, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/xslt.pxi":754
 *         if writer is not None:
 *             writer._exc_context._raise_if_stored()
 *         if r < 0 or rclose == -1:             # <<<<<<<<<<<<<<
 *             python.PyErr_SetFromErrno(IOError)  # raises IOError
 * 
*/
  }

  /* "src/lxml/xslt.pxi":720
 *     cdef Py_ssize_t _buffer_refcnt
 * 
 *     def write_output(self, file, *, compression=0):             # <<<<<<<<<<<<<<
 *         """write_output(self, file, *, compression=0)
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._XSLTResultTree.write_output", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_writer);
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xslt.pxi":757
 *             python.PyErr_SetFromErrno(IOError)  # raises IOError
 * 
 *     cdef _saveToStringAndSize(self, xmlChar** s, int* l):             # <<<<<<<<<<<<<<
 *         cdef _Document doc
 *         cdef int r
*/

static PyObject *__pyx_f_4lxml_5etree_15_XSLTResultTree__saveToStringAndSize(struct __pyx_obj_4lxml_5etree__XSLTResultTree *__pyx_v_self, xmlChar **__pyx_v_s, int *__pyx_v_l) {
  struct LxmlDocument *__pyx_v_doc = 0;
  int __pyx_v_r;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_saveToStringAndSize", 0);

  /* "src/lxml/xslt.pxi":760
 *         cdef _Document doc
 *         cdef int r
 *         if self._context_node is not None:             # <<<<<<<<<<<<<<
 *             doc = self._context_node._doc
 *         else:
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_self->__pyx_base._context_node) != Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/xslt.pxi":761
 *         cdef int r
 *         if self._context_node is not None:
 *             doc = self._context_node._doc             # <<<<<<<<<<<<<<
 *         else:
 *             doc = None
*/
    __pyx_t_2 = ((PyObject *)__pyx_v_self->__pyx_base._context_node->_doc);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/xslt.pxi":760
 *         cdef _Document doc
 *         cdef int r
 *         if self._context_node is not None:             # <<<<<<<<<<<<<<
 *             doc = self._context_node._doc
 *         else:
*/
    goto __pyx_L3;
  }

  /* "src/lxml/xslt.pxi":763
 *             doc = self._context_node._doc
 *         else:
 *             doc = None             # <<<<<<<<<<<<<<
 *         if doc is None:
 *             doc = self._doc
*/
  /*else*/ {
    __Pyx_INCREF(Py_None);
    __pyx_v_doc = ((struct LxmlDocument *)Py_None);
  }
  __pyx_L3:;

  /* "src/lxml/xslt.pxi":764
 *         else:
 *             doc = None
 *         if doc is None:             # <<<<<<<<<<<<<<
 *             doc = self._doc
 *             if doc is None:
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_doc) == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/xslt.pxi":765
 *             doc = None
 *         if doc is None:
 *             doc = self._doc             # <<<<<<<<<<<<<<
 *             if doc is None:
 *                 s[0] = NULL
*/
    __pyx_t_2 = ((PyObject *)__pyx_v_self->__pyx_base._doc);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_doc, ((struct LxmlDocument *)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "src/lxml/xslt.pxi":766
 *         if doc is None:
 *             doc = self._doc
 *             if doc is None:             # <<<<<<<<<<<<<<
 *                 s[0] = NULL
 *                 return
*/
    __pyx_t_1 = (((PyObject *)__pyx_v_doc) == Py_None);
    if (__pyx_t_1) {

      /* "src/lxml/xslt.pxi":767
 *             doc = self._doc
 *             if doc is None:
 *                 s[0] = NULL             # <<<<<<<<<<<<<<
 *                 return
 *         with nogil:
*/
      (__pyx_v_s[0]) = NULL;

      /* "src/lxml/xslt.pxi":768
 *             if doc is None:
 *                 s[0] = NULL
 *                 return             # <<<<<<<<<<<<<<
 *         with nogil:
 *             r = xslt.xsltSaveResultToString(s, l, doc._c_doc,
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;

      /* "src/lxml/xslt.pxi":766
 *         if doc is None:
 *             doc = self._doc
 *             if doc is None:             # <<<<<<<<<<<<<<
 *                 s[0] = NULL
 *                 return
*/
    }

    /* "src/lxml/xslt.pxi":764
 *         else:
 *             doc = None
 *         if doc is None:             # <<<<<<<<<<<<<<
 *             doc = self._doc
 *             if doc is None:
*/
  }

  /* "src/lxml/xslt.pxi":769
 *                 s[0] = NULL
 *                 return
 *         with nogil:             # <<<<<<<<<<<<<<
 *             r = xslt.xsltSaveResultToString(s, l, doc._c_doc,
 *                                             self._xslt._c_style)
*/
  {
      PyThreadState * _save;
      _save = PyEval_SaveThread();
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "src/lxml/xslt.pxi":770
 *                 return
 *         with nogil:
 *             r = xslt.xsltSaveResultToString(s, l, doc._c_doc,             # <<<<<<<<<<<<<<
 *                                             self._xslt._c_style)
 *         if r == -1:
*/
        __pyx_v_r = xsltSaveResultToString(__pyx_v_s, __pyx_v_l, __pyx_v_doc->_c_doc, __pyx_v_self->_xslt->_c_style);
      }

      /* "src/lxml/xslt.pxi":769
 *                 s[0] = NULL
 *                 return
 *         with nogil:             # <<<<<<<<<<<<<<
 *             r = xslt.xsltSaveResultToString(s, l, doc._c_doc,
 *                                             self._xslt._c_style)
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L8;
        }
        __pyx_L8:;
      }
  }

  /* "src/lxml/xslt.pxi":772
 *             r = xslt.xsltSaveResultToString(s, l, doc._c_doc,
 *                                             self._xslt._c_style)
 *         if r == -1:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 * 
*/
  __pyx_t_1 = (__pyx_v_r == -1L);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/xslt.pxi":773
 *                                             self._xslt._c_style)
 *         if r == -1:
 *             raise MemoryError()             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self):
*/
    PyErr_NoMemory(); __PYX_ERR(3, 773, __pyx_L1_error)

    /* "src/lxml/xslt.pxi":772
 *             r = xslt.xsltSaveResultToString(s, l, doc._c_doc,
 *                                             self._xslt._c_style)
 *         if r == -1:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 * 
*/
  }

  /* "src/lxml/xslt.pxi":757
 *             python.PyErr_SetFromErrno(IOError)  # raises IOError
 * 
 *     cdef _saveToStringAndSize(self, xmlChar** s, int* l):             # <<<<<<<<<<<<<<
 *         cdef _Document doc
 *         cdef int r
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._XSLTResultTree._saveToStringAndSize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xslt.pxi":775
 *             raise MemoryError()
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         cdef xmlChar* encoding
 *         cdef xmlChar* s = NULL
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_15_XSLTResultTree_3__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_15_XSLTResultTree_3__str__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_15_XSLTResultTree_2__str__(((struct __pyx_obj_4lxml_5etree__XSLTResultTree *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_15_XSLTResultTree_2__str__(struct __pyx_obj_4lxml_5etree__XSLTResultTree *__pyx_v_self) {
  xmlChar *__pyx_v_encoding;
  xmlChar *__pyx_v_s;
  int __pyx_v_l;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  xmlChar *__pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  char const *__pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__str__", 0);

  /* "src/lxml/xslt.pxi":777
 *     def __str__(self):
 *         cdef xmlChar* encoding
 *         cdef xmlChar* s = NULL             # <<<<<<<<<<<<<<
 *         cdef int l = 0
 *         self._saveToStringAndSize(&s, &l)
*/
  __pyx_v_s = NULL;

  /* "src/lxml/xslt.pxi":778
 *         cdef xmlChar* encoding
 *         cdef xmlChar* s = NULL
 *         cdef int l = 0             # <<<<<<<<<<<<<<
 *         self._saveToStringAndSize(&s, &l)
 *         if s is NULL:
*/
  __pyx_v_l = 0;

  /* "src/lxml/xslt.pxi":779
 *         cdef xmlChar* s = NULL
 *         cdef int l = 0
 *         self._saveToStringAndSize(&s, &l)             # <<<<<<<<<<<<<<
 *         if s is NULL:
 *             return ''
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_15_XSLTResultTree__saveToStringAndSize(__pyx_v_self, (&__pyx_v_s), (&__pyx_v_l)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 779, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xslt.pxi":780
 *         cdef int l = 0
 *         self._saveToStringAndSize(&s, &l)
 *         if s is NULL:             # <<<<<<<<<<<<<<
 *             return ''
 *         encoding = self._xslt._c_style.encoding
*/
  __pyx_t_2 = (__pyx_v_s == NULL);
  if (__pyx_t_2) {

    /* "src/lxml/xslt.pxi":781
 *         self._saveToStringAndSize(&s, &l)
 *         if s is NULL:
 *             return ''             # <<<<<<<<<<<<<<
 *         encoding = self._xslt._c_style.encoding
 *         try:
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u__8);
    __pyx_r = __pyx_mstate_global->__pyx_kp_u__8;
    goto __pyx_L0;

    /* "src/lxml/xslt.pxi":780
 *         cdef int l = 0
 *         self._saveToStringAndSize(&s, &l)
 *         if s is NULL:             # <<<<<<<<<<<<<<
 *             return ''
 *         encoding = self._xslt._c_style.encoding
*/
  }

  /* "src/lxml/xslt.pxi":782
 *         if s is NULL:
 *             return ''
 *         encoding = self._xslt._c_style.encoding             # <<<<<<<<<<<<<<
 *         try:
 *             if encoding is NULL:
*/
  __pyx_t_3 = __pyx_v_self->_xslt->_c_style->encoding;
  __pyx_v_encoding = __pyx_t_3;

  /* "src/lxml/xslt.pxi":783
 *             return ''
 *         encoding = self._xslt._c_style.encoding
 *         try:             # <<<<<<<<<<<<<<
 *             if encoding is NULL:
 *                 result = s[:l].decode('UTF-8')
*/
  /*try:*/ {

    /* "src/lxml/xslt.pxi":784
 *         encoding = self._xslt._c_style.encoding
 *         try:
 *             if encoding is NULL:             # <<<<<<<<<<<<<<
 *                 result = s[:l].decode('UTF-8')
 *             else:
*/
    __pyx_t_2 = (__pyx_v_encoding == NULL);
    if (__pyx_t_2) {

      /* "src/lxml/xslt.pxi":785
 *         try:
 *             if encoding is NULL:
 *                 result = s[:l].decode('UTF-8')             # <<<<<<<<<<<<<<
 *             else:
 *                 result = s[:l].decode(encoding)
*/
      __pyx_t_1 = __Pyx_decode_c_string(((char const *)__pyx_v_s), 0, __pyx_v_l, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 785, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_result = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;

      /* "src/lxml/xslt.pxi":784
 *         encoding = self._xslt._c_style.encoding
 *         try:
 *             if encoding is NULL:             # <<<<<<<<<<<<<<
 *                 result = s[:l].decode('UTF-8')
 *             else:
*/
      goto __pyx_L7;
    }

    /* "src/lxml/xslt.pxi":787
 *                 result = s[:l].decode('UTF-8')
 *             else:
 *                 result = s[:l].decode(encoding)             # <<<<<<<<<<<<<<
 *         finally:
 *             tree.xmlFree(s)
*/
    /*else*/ {
      __pyx_t_1 = __Pyx_decode_c_string(((char const *)__pyx_v_s), 0, __pyx_v_l, ((char const *)__pyx_v_encoding), NULL, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 787, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_result = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;
    }
    __pyx_L7:;
  }

  /* "src/lxml/xslt.pxi":789
 *                 result = s[:l].decode(encoding)
 *         finally:
 *             tree.xmlFree(s)             # <<<<<<<<<<<<<<
 *         return _stripEncodingDeclaration(result)
 * 
*/
  /*finally:*/ {
    /*normal exit:*/{
      xmlFree(__pyx_v_s);
      goto __pyx_L6;
    }
    __pyx_L5_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      if ( unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename;
      {
        xmlFree(__pyx_v_s);
      }
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
      __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6;
      goto __pyx_L1_error;
    }
    __pyx_L6:;
  }

  /* "src/lxml/xslt.pxi":790
 *         finally:
 *             tree.xmlFree(s)
 *         return _stripEncodingDeclaration(result)             # <<<<<<<<<<<<<<
 * 
 *     def __getbuffer__(self, Py_buffer* buffer, int flags):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree__stripEncodingDeclaration(__pyx_v_result); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 790, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/xslt.pxi":775
 *             raise MemoryError()
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         cdef xmlChar* encoding
 *         cdef xmlChar* s = NULL
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._XSLTResultTree.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xslt.pxi":792
 *         return _stripEncodingDeclaration(result)
 * 
 *     def __getbuffer__(self, Py_buffer* buffer, int flags):             # <<<<<<<<<<<<<<
 *         cdef int l = 0
 *         if buffer is NULL:
*/

/* Python wrapper */
CYTHON_UNUSED static int __pyx_pw_4lxml_5etree_15_XSLTResultTree_5__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_buffer, int __pyx_v_flags); /*proto*/
CYTHON_UNUSED static int __pyx_pw_4lxml_5etree_15_XSLTResultTree_5__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_buffer, int __pyx_v_flags) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_15_XSLTResultTree_4__getbuffer__(((struct __pyx_obj_4lxml_5etree__XSLTResultTree *)__pyx_v_self), ((Py_buffer *)__pyx_v_buffer), ((int)__pyx_v_flags));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_15_XSLTResultTree_4__getbuffer__(struct __pyx_obj_4lxml_5etree__XSLTResultTree *__pyx_v_self, Py_buffer *__pyx_v_buffer, int __pyx_v_flags) {
  int __pyx_v_l;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  xmlChar *__pyx_t_4;
  Py_ssize_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  if (unlikely(__pyx_v_buffer == NULL)) {
    PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
    return -1;
  }
  __Pyx_RefNannySetupContext("__getbuffer__", 0);
  __pyx_v_buffer->obj = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(__pyx_v_buffer->obj);

  /* "src/lxml/xslt.pxi":793
 * 
 *     def __getbuffer__(self, Py_buffer* buffer, int flags):
 *         cdef int l = 0             # <<<<<<<<<<<<<<
 *         if buffer is NULL:
 *             return
*/
  __pyx_v_l = 0;

  /* "src/lxml/xslt.pxi":794
 *     def __getbuffer__(self, Py_buffer* buffer, int flags):
 *         cdef int l = 0
 *         if buffer is NULL:             # <<<<<<<<<<<<<<
 *             return
 *         if self._buffer is NULL or flags & python.PyBUF_WRITABLE:
*/
  __pyx_t_1 = (__pyx_v_buffer == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/xslt.pxi":795
 *         cdef int l = 0
 *         if buffer is NULL:
 *             return             # <<<<<<<<<<<<<<
 *         if self._buffer is NULL or flags & python.PyBUF_WRITABLE:
 *             self._saveToStringAndSize(<xmlChar**>&buffer.buf, &l)
*/
    __pyx_r = 0;
    goto __pyx_L0;

    /* "src/lxml/xslt.pxi":794
 *     def __getbuffer__(self, Py_buffer* buffer, int flags):
 *         cdef int l = 0
 *         if buffer is NULL:             # <<<<<<<<<<<<<<
 *             return
 *         if self._buffer is NULL or flags & python.PyBUF_WRITABLE:
*/
  }

  /* "src/lxml/xslt.pxi":796
 *         if buffer is NULL:
 *             return
 *         if self._buffer is NULL or flags & python.PyBUF_WRITABLE:             # <<<<<<<<<<<<<<
 *             self._saveToStringAndSize(<xmlChar**>&buffer.buf, &l)
 *             buffer.len = l
*/
  __pyx_t_2 = (__pyx_v_self->_buffer == NULL);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L5_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/xslt.pxi":797
 *             return
 *         if self._buffer is NULL or flags & python.PyBUF_WRITABLE:
 *             self._saveToStringAndSize(<xmlChar**>&buffer.buf, &l)             # <<<<<<<<<<<<<<
 *             buffer.len = l
 *             if self._buffer is NULL and not flags & python.PyBUF_WRITABLE:
*/
    __pyx_t_3 = __pyx_f_4lxml_5etree_15_XSLTResultTree__saveToStringAndSize(__pyx_v_self, ((xmlChar **)(&__pyx_v_buffer->buf)), (&__pyx_v_l)); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 797, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/xslt.pxi":798
 *         if self._buffer is NULL or flags & python.PyBUF_WRITABLE:
 *             self._saveToStringAndSize(<xmlChar**>&buffer.buf, &l)
 *             buffer.len = l             # <<<<<<<<<<<<<<
 *             if self._buffer is NULL and not flags & python.PyBUF_WRITABLE:
 *                 self._buffer = <xmlChar*>buffer.buf
*/
    __pyx_v_buffer->len = __pyx_v_l;

    /* "src/lxml/xslt.pxi":799
 *             self._saveToStringAndSize(<xmlChar**>&buffer.buf, &l)
 *             buffer.len = l
 *             if self._buffer is NULL and not flags & python.PyBUF_WRITABLE:             # <<<<<<<<<<<<<<
 *                 self._buffer = <xmlChar*>buffer.buf
 *                 self._buffer_len = l
*/
    __pyx_t_2 = (__pyx_v_self->_buffer == NULL);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L8_bool_binop_done;
    }
    __pyx_t_2 = (!((__pyx_v_flags & PyBUF_WRITABLE) != 0));
    __pyx_t_1 = __pyx_t_2;
    __pyx_L8_bool_binop_done:;
    if (__pyx_t_1) {

      /* "src/lxml/xslt.pxi":800
 *             buffer.len = l
 *             if self._buffer is NULL and not flags & python.PyBUF_WRITABLE:
 *                 self._buffer = <xmlChar*>buffer.buf             # <<<<<<<<<<<<<<
 *                 self._buffer_len = l
 *                 self._buffer_refcnt = 1
*/
      __pyx_v_self->_buffer = ((xmlChar *)__pyx_v_buffer->buf);

      /* "src/lxml/xslt.pxi":801
 *             if self._buffer is NULL and not flags & python.PyBUF_WRITABLE:
 *                 self._buffer = <xmlChar*>buffer.buf
 *                 self._buffer_len = l             # <<<<<<<<<<<<<<
 *                 self._buffer_refcnt = 1
 *         else:
*/
      __pyx_v_self->_buffer_len = __pyx_v_l;

      /* "src/lxml/xslt.pxi":802
 *                 self._buffer = <xmlChar*>buffer.buf
 *                 self._buffer_len = l
 *                 self._buffer_refcnt = 1             # <<<<<<<<<<<<<<
 *         else:
 *             buffer.buf = self._buffer
*/
      __pyx_v_self->_buffer_refcnt = 1;

      /* "src/lxml/xslt.pxi":799
 *             self._saveToStringAndSize(<xmlChar**>&buffer.buf, &l)
 *             buffer.len = l
 *             if self._buffer is NULL and not flags & python.PyBUF_WRITABLE:             # <<<<<<<<<<<<<<
 *                 self._buffer = <xmlChar*>buffer.buf
 *                 self._buffer_len = l
*/
    }

    /* "src/lxml/xslt.pxi":796
 *         if buffer is NULL:
 *             return
 *         if self._buffer is NULL or flags & python.PyBUF_WRITABLE:             # <<<<<<<<<<<<<<
 *             self._saveToStringAndSize(<xmlChar**>&buffer.buf, &l)
 *             buffer.len = l
*/
    goto __pyx_L4;
  }

  /* "src/lxml/xslt.pxi":804
 *                 self._buffer_refcnt = 1
 *         else:
 *             buffer.buf = self._buffer             # <<<<<<<<<<<<<<
 *             buffer.len = self._buffer_len
 *             self._buffer_refcnt += 1
*/
  /*else*/ {
    __pyx_t_4 = __pyx_v_self->_buffer;
    __pyx_v_buffer->buf = __pyx_t_4;

    /* "src/lxml/xslt.pxi":805
 *         else:
 *             buffer.buf = self._buffer
 *             buffer.len = self._buffer_len             # <<<<<<<<<<<<<<
 *             self._buffer_refcnt += 1
 *         if flags & python.PyBUF_WRITABLE:
*/
    __pyx_t_5 = __pyx_v_self->_buffer_len;
    __pyx_v_buffer->len = __pyx_t_5;

    /* "src/lxml/xslt.pxi":806
 *             buffer.buf = self._buffer
 *             buffer.len = self._buffer_len
 *             self._buffer_refcnt += 1             # <<<<<<<<<<<<<<
 *         if flags & python.PyBUF_WRITABLE:
 *             buffer.readonly = 0
*/
    __pyx_v_self->_buffer_refcnt = (__pyx_v_self->_buffer_refcnt + 1);
  }
  __pyx_L4:;

  /* "src/lxml/xslt.pxi":807
 *             buffer.len = self._buffer_len
 *             self._buffer_refcnt += 1
 *         if flags & python.PyBUF_WRITABLE:             # <<<<<<<<<<<<<<
 *             buffer.readonly = 0
 *         else:
*/
  __pyx_t_1 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0);
  if (__pyx_t_1) {

    /* "src/lxml/xslt.pxi":808
 *             self._buffer_refcnt += 1
 *         if flags & python.PyBUF_WRITABLE:
 *             buffer.readonly = 0             # <<<<<<<<<<<<<<
 *         else:
 *             buffer.readonly = 1
*/
    __pyx_v_buffer->readonly = 0;

    /* "src/lxml/xslt.pxi":807
 *             buffer.len = self._buffer_len
 *             self._buffer_refcnt += 1
 *         if flags & python.PyBUF_WRITABLE:             # <<<<<<<<<<<<<<
 *             buffer.readonly = 0
 *         else:
*/
    goto __pyx_L10;
  }

  /* "src/lxml/xslt.pxi":810
 *             buffer.readonly = 0
 *         else:
 *             buffer.readonly = 1             # <<<<<<<<<<<<<<
 *         if flags & python.PyBUF_FORMAT:
 *             buffer.format = "B"
*/
  /*else*/ {
    __pyx_v_buffer->readonly = 1;
  }
  __pyx_L10:;

  /* "src/lxml/xslt.pxi":811
 *         else:
 *             buffer.readonly = 1
 *         if flags & python.PyBUF_FORMAT:             # <<<<<<<<<<<<<<
 *             buffer.format = "B"
 *         else:
*/
  __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
  if (__pyx_t_1) {

    /* "src/lxml/xslt.pxi":812
 *             buffer.readonly = 1
 *         if flags & python.PyBUF_FORMAT:
 *             buffer.format = "B"             # <<<<<<<<<<<<<<
 *         else:
 *             buffer.format = NULL
*/
    __pyx_v_buffer->format = ((char *)"B");

    /* "src/lxml/xslt.pxi":811
 *         else:
 *             buffer.readonly = 1
 *         if flags & python.PyBUF_FORMAT:             # <<<<<<<<<<<<<<
 *             buffer.format = "B"
 *         else:
*/
    goto __pyx_L11;
  }

  /* "src/lxml/xslt.pxi":814
 *             buffer.format = "B"
 *         else:
 *             buffer.format = NULL             # <<<<<<<<<<<<<<
 *         buffer.ndim = 0
 *         buffer.shape = NULL
*/
  /*else*/ {
    __pyx_v_buffer->format = NULL;
  }
  __pyx_L11:;

  /* "src/lxml/xslt.pxi":815
 *         else:
 *             buffer.format = NULL
 *         buffer.ndim = 0             # <<<<<<<<<<<<<<
 *         buffer.shape = NULL
 *         buffer.strides = NULL
*/
  __pyx_v_buffer->ndim = 0;

  /* "src/lxml/xslt.pxi":816
 *             buffer.format = NULL
 *         buffer.ndim = 0
 *         buffer.shape = NULL             # <<<<<<<<<<<<<<
 *         buffer.strides = NULL
 *         buffer.suboffsets = NULL
*/
  __pyx_v_buffer->shape = NULL;

  /* "src/lxml/xslt.pxi":817
 *         buffer.ndim = 0
 *         buffer.shape = NULL
 *         buffer.strides = NULL             # <<<<<<<<<<<<<<
 *         buffer.suboffsets = NULL
 *         buffer.itemsize = 1
*/
  __pyx_v_buffer->strides = NULL;

  /* "src/lxml/xslt.pxi":818
 *         buffer.shape = NULL
 *         buffer.strides = NULL
 *         buffer.suboffsets = NULL             # <<<<<<<<<<<<<<
 *         buffer.itemsize = 1
 *         buffer.internal = NULL
*/
  __pyx_v_buffer->suboffsets = NULL;

  /* "src/lxml/xslt.pxi":819
 *         buffer.strides = NULL
 *         buffer.suboffsets = NULL
 *         buffer.itemsize = 1             # <<<<<<<<<<<<<<
 *         buffer.internal = NULL
 *         if buffer.obj is not self: # set by Cython?
*/
  __pyx_v_buffer->itemsize = 1;

  /* "src/lxml/xslt.pxi":820
 *         buffer.suboffsets = NULL
 *         buffer.itemsize = 1
 *         buffer.internal = NULL             # <<<<<<<<<<<<<<
 *         if buffer.obj is not self: # set by Cython?
 *             buffer.obj = self
*/
  __pyx_v_buffer->internal = NULL;

  /* "src/lxml/xslt.pxi":821
 *         buffer.itemsize = 1
 *         buffer.internal = NULL
 *         if buffer.obj is not self: # set by Cython?             # <<<<<<<<<<<<<<
 *             buffer.obj = self
 * 
*/
  __pyx_t_1 = (__pyx_v_buffer->obj != ((PyObject *)__pyx_v_self));
  if (__pyx_t_1) {

    /* "src/lxml/xslt.pxi":822
 *         buffer.internal = NULL
 *         if buffer.obj is not self: # set by Cython?
 *             buffer.obj = self             # <<<<<<<<<<<<<<
 * 
 *     def __releasebuffer__(self, Py_buffer* buffer):
*/
    __Pyx_INCREF((PyObject *)__pyx_v_self);
    __Pyx_GIVEREF((PyObject *)__pyx_v_self);
    __Pyx_GOTREF(__pyx_v_buffer->obj);
    __Pyx_DECREF(__pyx_v_buffer->obj);
    __pyx_v_buffer->obj = ((PyObject *)__pyx_v_self);

    /* "src/lxml/xslt.pxi":821
 *         buffer.itemsize = 1
 *         buffer.internal = NULL
 *         if buffer.obj is not self: # set by Cython?             # <<<<<<<<<<<<<<
 *             buffer.obj = self
 * 
*/
  }

  /* "src/lxml/xslt.pxi":792
 *         return _stripEncodingDeclaration(result)
 * 
 *     def __getbuffer__(self, Py_buffer* buffer, int flags):             # <<<<<<<<<<<<<<
 *         cdef int l = 0
 *         if buffer is NULL:
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._XSLTResultTree.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  if (__pyx_v_buffer->obj != NULL) {
    __Pyx_GOTREF(__pyx_v_buffer->obj);
    __Pyx_DECREF(__pyx_v_buffer->obj); __pyx_v_buffer->obj = 0;
  }
  goto __pyx_L2;
  __pyx_L0:;
  if (__pyx_v_buffer->obj == Py_None) {
    __Pyx_GOTREF(__pyx_v_buffer->obj);
    __Pyx_DECREF(__pyx_v_buffer->obj); __pyx_v_buffer->obj = 0;
  }
  __pyx_L2:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xslt.pxi":824
 *             buffer.obj = self
 * 
 *     def __releasebuffer__(self, Py_buffer* buffer):             # <<<<<<<<<<<<<<
 *         if buffer is NULL:
 *             return
*/

/* Python wrapper */
CYTHON_UNUSED static void __pyx_pw_4lxml_5etree_15_XSLTResultTree_7__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_buffer); /*proto*/
CYTHON_UNUSED static void __pyx_pw_4lxml_5etree_15_XSLTResultTree_7__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_buffer) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_pf_4lxml_5etree_15_XSLTResultTree_6__releasebuffer__(((struct __pyx_obj_4lxml_5etree__XSLTResultTree *)__pyx_v_self), ((Py_buffer *)__pyx_v_buffer));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_4lxml_5etree_15_XSLTResultTree_6__releasebuffer__(struct __pyx_obj_4lxml_5etree__XSLTResultTree *__pyx_v_self, Py_buffer *__pyx_v_buffer) {
  int __pyx_t_1;

  /* "src/lxml/xslt.pxi":825
 * 
 *     def __releasebuffer__(self, Py_buffer* buffer):
 *         if buffer is NULL:             # <<<<<<<<<<<<<<
 *             return
 *         if <xmlChar*>buffer.buf is self._buffer:
*/
  __pyx_t_1 = (__pyx_v_buffer == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/xslt.pxi":826
 *     def __releasebuffer__(self, Py_buffer* buffer):
 *         if buffer is NULL:
 *             return             # <<<<<<<<<<<<<<
 *         if <xmlChar*>buffer.buf is self._buffer:
 *             self._buffer_refcnt -= 1
*/
    goto __pyx_L0;

    /* "src/lxml/xslt.pxi":825
 * 
 *     def __releasebuffer__(self, Py_buffer* buffer):
 *         if buffer is NULL:             # <<<<<<<<<<<<<<
 *             return
 *         if <xmlChar*>buffer.buf is self._buffer:
*/
  }

  /* "src/lxml/xslt.pxi":827
 *         if buffer is NULL:
 *             return
 *         if <xmlChar*>buffer.buf is self._buffer:             # <<<<<<<<<<<<<<
 *             self._buffer_refcnt -= 1
 *             if self._buffer_refcnt == 0:
*/
  __pyx_t_1 = (((xmlChar *)__pyx_v_buffer->buf) == __pyx_v_self->_buffer);
  if (__pyx_t_1) {

    /* "src/lxml/xslt.pxi":828
 *             return
 *         if <xmlChar*>buffer.buf is self._buffer:
 *             self._buffer_refcnt -= 1             # <<<<<<<<<<<<<<
 *             if self._buffer_refcnt == 0:
 *                 tree.xmlFree(<char*>self._buffer)
*/
    __pyx_v_self->_buffer_refcnt = (__pyx_v_self->_buffer_refcnt - 1);

    /* "src/lxml/xslt.pxi":829
 *         if <xmlChar*>buffer.buf is self._buffer:
 *             self._buffer_refcnt -= 1
 *             if self._buffer_refcnt == 0:             # <<<<<<<<<<<<<<
 *                 tree.xmlFree(<char*>self._buffer)
 *                 self._buffer = NULL
*/
    __pyx_t_1 = (__pyx_v_self->_buffer_refcnt == 0);
    if (__pyx_t_1) {

      /* "src/lxml/xslt.pxi":830
 *             self._buffer_refcnt -= 1
 *             if self._buffer_refcnt == 0:
 *                 tree.xmlFree(<char*>self._buffer)             # <<<<<<<<<<<<<<
 *                 self._buffer = NULL
 *         else:
*/
      xmlFree(((char *)__pyx_v_self->_buffer));

      /* "src/lxml/xslt.pxi":831
 *             if self._buffer_refcnt == 0:
 *                 tree.xmlFree(<char*>self._buffer)
 *                 self._buffer = NULL             # <<<<<<<<<<<<<<
 *         else:
 *             tree.xmlFree(<char*>buffer.buf)
*/
      __pyx_v_self->_buffer = NULL;

      /* "src/lxml/xslt.pxi":829
 *         if <xmlChar*>buffer.buf is self._buffer:
 *             self._buffer_refcnt -= 1
 *             if self._buffer_refcnt == 0:             # <<<<<<<<<<<<<<
 *                 tree.xmlFree(<char*>self._buffer)
 *                 self._buffer = NULL
*/
    }

    /* "src/lxml/xslt.pxi":827
 *         if buffer is NULL:
 *             return
 *         if <xmlChar*>buffer.buf is self._buffer:             # <<<<<<<<<<<<<<
 *             self._buffer_refcnt -= 1
 *             if self._buffer_refcnt == 0:
*/
    goto __pyx_L4;
  }

  /* "src/lxml/xslt.pxi":833
 *                 self._buffer = NULL
 *         else:
 *             tree.xmlFree(<char*>buffer.buf)             # <<<<<<<<<<<<<<
 *         buffer.buf = NULL
 * 
*/
  /*else*/ {
    xmlFree(((char *)__pyx_v_buffer->buf));
  }
  __pyx_L4:;

  /* "src/lxml/xslt.pxi":834
 *         else:
 *             tree.xmlFree(<char*>buffer.buf)
 *         buffer.buf = NULL             # <<<<<<<<<<<<<<
 * 
 *     property xslt_profile:
*/
  __pyx_v_buffer->buf = NULL;

  /* "src/lxml/xslt.pxi":824
 *             buffer.obj = self
 * 
 *     def __releasebuffer__(self, Py_buffer* buffer):             # <<<<<<<<<<<<<<
 *         if buffer is NULL:
 *             return
*/

  /* function exit code */
  __pyx_L0:;
}

/* "src/lxml/xslt.pxi":839
 *         """Return an ElementTree with profiling data for the stylesheet run.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef object root
 *             if self._profile is None:
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_15_XSLTResultTree_12xslt_profile_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_15_XSLTResultTree_12xslt_profile_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_15_XSLTResultTree_12xslt_profile___get__(((struct __pyx_obj_4lxml_5etree__XSLTResultTree *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_15_XSLTResultTree_12xslt_profile___get__(struct __pyx_obj_4lxml_5etree__XSLTResultTree *__pyx_v_self) {
  PyObject *__pyx_v_root = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "src/lxml/xslt.pxi":841
 *         def __get__(self):
 *             cdef object root
 *             if self._profile is None:             # <<<<<<<<<<<<<<
 *                 return None
 *             root = self._profile.getroot()
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_self->_profile) == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/xslt.pxi":842
 *             cdef object root
 *             if self._profile is None:
 *                 return None             # <<<<<<<<<<<<<<
 *             root = self._profile.getroot()
 *             if root is None:
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/xslt.pxi":841
 *         def __get__(self):
 *             cdef object root
 *             if self._profile is None:             # <<<<<<<<<<<<<<
 *                 return None
 *             root = self._profile.getroot()
*/
  }

  /* "src/lxml/xslt.pxi":843
 *             if self._profile is None:
 *                 return None
 *             root = self._profile.getroot()             # <<<<<<<<<<<<<<
 *             if root is None:
 *                 return None
*/
  __pyx_t_2 = __pyx_f_4lxml_5etree_9_Document_getroot(__pyx_v_self->_profile); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 843, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_root = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "src/lxml/xslt.pxi":844
 *                 return None
 *             root = self._profile.getroot()
 *             if root is None:             # <<<<<<<<<<<<<<
 *                 return None
 *             return ElementTree(root)
*/
  __pyx_t_1 = (__pyx_v_root == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/xslt.pxi":845
 *             root = self._profile.getroot()
 *             if root is None:
 *                 return None             # <<<<<<<<<<<<<<
 *             return ElementTree(root)
 * 
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/xslt.pxi":844
 *                 return None
 *             root = self._profile.getroot()
 *             if root is None:             # <<<<<<<<<<<<<<
 *                 return None
 *             return ElementTree(root)
*/
  }

  /* "src/lxml/xslt.pxi":846
 *             if root is None:
 *                 return None
 *             return ElementTree(root)             # <<<<<<<<<<<<<<
 * 
 *         def __del__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_ElementTree); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 846, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    assert(__pyx_t_3);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
    __pyx_t_5 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_root};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 846, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/xslt.pxi":839
 *         """Return an ElementTree with profiling data for the stylesheet run.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef object root
 *             if self._profile is None:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._XSLTResultTree.xslt_profile.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_root);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xslt.pxi":848
 *             return ElementTree(root)
 * 
 *         def __del__(self):             # <<<<<<<<<<<<<<
 *             self._profile = None
 * 
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_15_XSLTResultTree_12xslt_profile_3__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_4lxml_5etree_15_XSLTResultTree_12xslt_profile_3__del__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_15_XSLTResultTree_12xslt_profile_2__del__(((struct __pyx_obj_4lxml_5etree__XSLTResultTree *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_15_XSLTResultTree_12xslt_profile_2__del__(struct __pyx_obj_4lxml_5etree__XSLTResultTree *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);

  /* "src/lxml/xslt.pxi":849
 * 
 *         def __del__(self):
 *             self._profile = None             # <<<<<<<<<<<<<<
 * 
 * cdef _xsltResultTreeFactory(_Document doc, XSLT xslt, _Document profile):
*/
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_profile);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_profile);
  __pyx_v_self->_profile = ((struct LxmlDocument *)Py_None);

  /* "src/lxml/xslt.pxi":848
 *             return ElementTree(root)
 * 
 *         def __del__(self):             # <<<<<<<<<<<<<<
 *             self._profile = None
 * 
*/

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xslt.pxi":851
 *             self._profile = None
 * 
 * cdef _xsltResultTreeFactory(_Document doc, XSLT xslt, _Document profile):             # <<<<<<<<<<<<<<
 *     cdef _XSLTResultTree result
 *     result = <_XSLTResultTree>_newElementTree(doc, None, _XSLTResultTree)
*/

static PyObject *__pyx_f_4lxml_5etree__xsltResultTreeFactory(struct LxmlDocument *__pyx_v_doc, struct __pyx_obj_4lxml_5etree_XSLT *__pyx_v_xslt, struct LxmlDocument *__pyx_v_profile) {
  struct __pyx_obj_4lxml_5etree__XSLTResultTree *__pyx_v_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_xsltResultTreeFactory", 0);

  /* "src/lxml/xslt.pxi":853
 * cdef _xsltResultTreeFactory(_Document doc, XSLT xslt, _Document profile):
 *     cdef _XSLTResultTree result
 *     result = <_XSLTResultTree>_newElementTree(doc, None, _XSLTResultTree)             # <<<<<<<<<<<<<<
 *     result._xslt = xslt
 *     result._profile = profile
*/
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__newElementTree(__pyx_v_doc, ((struct LxmlElement *)Py_None), ((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__XSLTResultTree))); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 853, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_t_1;
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_result = ((struct __pyx_obj_4lxml_5etree__XSLTResultTree *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/xslt.pxi":854
 *     cdef _XSLTResultTree result
 *     result = <_XSLTResultTree>_newElementTree(doc, None, _XSLTResultTree)
 *     result._xslt = xslt             # <<<<<<<<<<<<<<
 *     result._profile = profile
 *     return result
*/
  __Pyx_INCREF((PyObject *)__pyx_v_xslt);
  __Pyx_GIVEREF((PyObject *)__pyx_v_xslt);
  __Pyx_GOTREF((PyObject *)__pyx_v_result->_xslt);
  __Pyx_DECREF((PyObject *)__pyx_v_result->_xslt);
  __pyx_v_result->_xslt = __pyx_v_xslt;

  /* "src/lxml/xslt.pxi":855
 *     result = <_XSLTResultTree>_newElementTree(doc, None, _XSLTResultTree)
 *     result._xslt = xslt
 *     result._profile = profile             # <<<<<<<<<<<<<<
 *     return result
 * 
*/
  __Pyx_INCREF((PyObject *)__pyx_v_profile);
  __Pyx_GIVEREF((PyObject *)__pyx_v_profile);
  __Pyx_GOTREF((PyObject *)__pyx_v_result->_profile);
  __Pyx_DECREF((PyObject *)__pyx_v_result->_profile);
  __pyx_v_result->_profile = __pyx_v_profile;

  /* "src/lxml/xslt.pxi":856
 *     result._xslt = xslt
 *     result._profile = profile
 *     return result             # <<<<<<<<<<<<<<
 * 
 * # functions like "output" and "write" are a potential security risk, but we
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_result);
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  /* "src/lxml/xslt.pxi":851
 *             self._profile = None
 * 
 * cdef _xsltResultTreeFactory(_Document doc, XSLT xslt, _Document profile):             # <<<<<<<<<<<<<<
 *     cdef _XSLTResultTree result
 *     result = <_XSLTResultTree>_newElementTree(doc, None, _XSLTResultTree)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._xsltResultTreeFactory", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xslt.pxi":874
 * cdef XPath __findStylesheetByID = None
 * 
 * cdef _findStylesheetByID(_Document doc, id):             # <<<<<<<<<<<<<<
 *     global __findStylesheetByID
 *     if __findStylesheetByID is None:
*/

static PyObject *__pyx_f_4lxml_5etree__findStylesheetByID(struct LxmlDocument *__pyx_v_doc, PyObject *__pyx_v_id) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_findStylesheetByID", 0);

  /* "src/lxml/xslt.pxi":876
 * cdef _findStylesheetByID(_Document doc, id):
 *     global __findStylesheetByID
 *     if __findStylesheetByID is None:             # <<<<<<<<<<<<<<
 *         __findStylesheetByID = XPath(
 *             "//xsl:stylesheet[@xml:id = $id]",
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_4lxml_5etree___findStylesheetByID) == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/xslt.pxi":877
 *     global __findStylesheetByID
 *     if __findStylesheetByID is None:
 *         __findStylesheetByID = XPath(             # <<<<<<<<<<<<<<
 *             "//xsl:stylesheet[@xml:id = $id]",
 *             namespaces={"xsl" : "http://www.w3.org/1999/XSL/Transform"})
*/
    __pyx_t_3 = NULL;

    /* "src/lxml/xslt.pxi":879
 *         __findStylesheetByID = XPath(
 *             "//xsl:stylesheet[@xml:id = $id]",
 *             namespaces={"xsl" : "http://www.w3.org/1999/XSL/Transform"})             # <<<<<<<<<<<<<<
 *     return __findStylesheetByID(doc, id=id)
 * 
*/
    __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 879, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_xsl, __pyx_mstate_global->__pyx_kp_u_http_www_w3_org_1999_XSL_Transfo) < (0)) __PYX_ERR(3, 879, __pyx_L1_error)
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_xsl_stylesheet_xml_id_id};
      __pyx_t_6 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 877, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_namespaces, __pyx_t_4, __pyx_t_6, __pyx_callargs+2, 0) < (0)) __PYX_ERR(3, 877, __pyx_L1_error)
      __pyx_t_2 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XPath, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_6);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 877, __pyx_L1_error)
      __Pyx_GOTREF((PyObject *)__pyx_t_2);
    }
    __Pyx_XGOTREF((PyObject *)__pyx_v_4lxml_5etree___findStylesheetByID);
    __Pyx_DECREF_SET(__pyx_v_4lxml_5etree___findStylesheetByID, ((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_t_2));
    __Pyx_GIVEREF((PyObject *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/xslt.pxi":876
 * cdef _findStylesheetByID(_Document doc, id):
 *     global __findStylesheetByID
 *     if __findStylesheetByID is None:             # <<<<<<<<<<<<<<
 *         __findStylesheetByID = XPath(
 *             "//xsl:stylesheet[@xml:id = $id]",
*/
  }

  /* "src/lxml/xslt.pxi":880
 *             "//xsl:stylesheet[@xml:id = $id]",
 *             namespaces={"xsl" : "http://www.w3.org/1999/XSL/Transform"})
 *     return __findStylesheetByID(doc, id=id)             # <<<<<<<<<<<<<<
 * 
 * cdef class _XSLTProcessingInstruction(PIBase):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = NULL;
  __Pyx_INCREF((PyObject *)__pyx_v_4lxml_5etree___findStylesheetByID);
  __pyx_t_4 = ((PyObject *)__pyx_v_4lxml_5etree___findStylesheetByID); 
  __pyx_t_5 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
    assert(__pyx_t_6);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_6);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
    __pyx_t_5 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_6, ((PyObject *)__pyx_v_doc)};
    __pyx_t_3 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 880, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_id, __pyx_v_id, __pyx_t_3, __pyx_callargs+2, 0) < (0)) __PYX_ERR(3, 880, __pyx_L1_error)
    __pyx_t_2 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_3);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 880, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/xslt.pxi":874
 * cdef XPath __findStylesheetByID = None
 * 
 * cdef _findStylesheetByID(_Document doc, id):             # <<<<<<<<<<<<<<
 *     global __findStylesheetByID
 *     if __findStylesheetByID is None:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._findStylesheetByID", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xslt.pxi":883
 * 
 * cdef class _XSLTProcessingInstruction(PIBase):
 *     def parseXSL(self, parser=None):             # <<<<<<<<<<<<<<
 *         """parseXSL(self, parser=None)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_26_XSLTProcessingInstruction_1parseXSL(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_26_XSLTProcessingInstruction_parseXSL, "parseXSL(self, parser=None)\n\n        Try to parse the stylesheet referenced by this PI and return\n        an ElementTree for it.  If the stylesheet is embedded in the\n        same document (referenced via xml:id), find and return an\n        ElementTree for the stylesheet Element.\n\n        The optional ``parser`` keyword argument can be passed to specify the\n        parser used to read from external stylesheet URLs.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_26_XSLTProcessingInstruction_1parseXSL = {"parseXSL", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_26_XSLTProcessingInstruction_1parseXSL, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_26_XSLTProcessingInstruction_parseXSL};
static PyObject *__pyx_pw_4lxml_5etree_26_XSLTProcessingInstruction_1parseXSL(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_parser = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("parseXSL (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_parser,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(3, 883, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(3, 883, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "parseXSL", 0) < (0)) __PYX_ERR(3, 883, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
    } else {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(3, 883, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_parser = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("parseXSL", 0, 0, 1, __pyx_nargs); __PYX_ERR(3, 883, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._XSLTProcessingInstruction.parseXSL", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_26_XSLTProcessingInstruction_parseXSL(((struct __pyx_obj_4lxml_5etree__XSLTProcessingInstruction *)__pyx_v_self), __pyx_v_parser);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_26_XSLTProcessingInstruction_parseXSL(struct __pyx_obj_4lxml_5etree__XSLTProcessingInstruction *__pyx_v_self, PyObject *__pyx_v_parser) {
  struct LxmlDocument *__pyx_v_result_doc = 0;
  struct LxmlElement *__pyx_v_result_node = 0;
  PyObject *__pyx_v_href_utf = 0;
  const xmlChar *__pyx_v_c_href;
  xmlAttr *__pyx_v_c_attr;
  PyObject *__pyx_v_hrefs = NULL;
  PyObject *__pyx_v_root = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  unsigned char *__pyx_t_6;
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  size_t __pyx_t_10;
  int __pyx_t_11;
  char const *__pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  int __pyx_t_19;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("parseXSL", 0);

  /* "src/lxml/xslt.pxi":899
 *         cdef const_xmlChar* c_href
 *         cdef xmlAttr* c_attr
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         if self._c_node.content is NULL:
 *             raise ValueError, "PI lacks content"
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(3, 899, __pyx_L1_error)

  /* "src/lxml/xslt.pxi":900
 *         cdef xmlAttr* c_attr
 *         _assertValidNode(self)
 *         if self._c_node.content is NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError, "PI lacks content"
 *         hrefs = _FIND_PI_HREF(' ' + (<unsigned char*>self._c_node.content).decode('UTF-8'))
*/
  __pyx_t_2 = (__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_base._c_node->content == NULL);
  if (unlikely(__pyx_t_2)) {

    /* "src/lxml/xslt.pxi":901
 *         _assertValidNode(self)
 *         if self._c_node.content is NULL:
 *             raise ValueError, "PI lacks content"             # <<<<<<<<<<<<<<
 *         hrefs = _FIND_PI_HREF(' ' + (<unsigned char*>self._c_node.content).decode('UTF-8'))
 *         if len(hrefs) != 1:
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_PI_lacks_content, 0, 0);
    __PYX_ERR(3, 901, __pyx_L1_error)

    /* "src/lxml/xslt.pxi":900
 *         cdef xmlAttr* c_attr
 *         _assertValidNode(self)
 *         if self._c_node.content is NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError, "PI lacks content"
 *         hrefs = _FIND_PI_HREF(' ' + (<unsigned char*>self._c_node.content).decode('UTF-8'))
*/
  }

  /* "src/lxml/xslt.pxi":902
 *         if self._c_node.content is NULL:
 *             raise ValueError, "PI lacks content"
 *         hrefs = _FIND_PI_HREF(' ' + (<unsigned char*>self._c_node.content).decode('UTF-8'))             # <<<<<<<<<<<<<<
 *         if len(hrefs) != 1:
 *             raise ValueError, "malformed PI attributes"
*/
  __pyx_t_4 = NULL;
  __Pyx_INCREF(__pyx_v_4lxml_5etree__FIND_PI_HREF);
  __pyx_t_5 = __pyx_v_4lxml_5etree__FIND_PI_HREF; 
  __pyx_t_6 = ((unsigned char *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_base._c_node->content);
  __pyx_t_7 = __Pyx_ssize_strlen(((char const *)__pyx_t_6)); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(3, 902, __pyx_L1_error)
  __pyx_t_8 = __Pyx_decode_c_string(((char const *)__pyx_t_6), 0, __pyx_t_7, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 902, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u__7, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 902, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_10 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
    assert(__pyx_t_4);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
    __pyx_t_10 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_9};
    __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 902, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  __pyx_v_hrefs = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "src/lxml/xslt.pxi":903
 *             raise ValueError, "PI lacks content"
 *         hrefs = _FIND_PI_HREF(' ' + (<unsigned char*>self._c_node.content).decode('UTF-8'))
 *         if len(hrefs) != 1:             # <<<<<<<<<<<<<<
 *             raise ValueError, "malformed PI attributes"
 *         hrefs = hrefs[0]
*/
  __pyx_t_7 = PyObject_Length(__pyx_v_hrefs); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(3, 903, __pyx_L1_error)
  __pyx_t_2 = (__pyx_t_7 != 1);
  if (unlikely(__pyx_t_2)) {

    /* "src/lxml/xslt.pxi":904
 *         hrefs = _FIND_PI_HREF(' ' + (<unsigned char*>self._c_node.content).decode('UTF-8'))
 *         if len(hrefs) != 1:
 *             raise ValueError, "malformed PI attributes"             # <<<<<<<<<<<<<<
 *         hrefs = hrefs[0]
 *         href_utf = utf8(hrefs[0] or hrefs[1])
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_malformed_PI_attributes, 0, 0);
    __PYX_ERR(3, 904, __pyx_L1_error)

    /* "src/lxml/xslt.pxi":903
 *             raise ValueError, "PI lacks content"
 *         hrefs = _FIND_PI_HREF(' ' + (<unsigned char*>self._c_node.content).decode('UTF-8'))
 *         if len(hrefs) != 1:             # <<<<<<<<<<<<<<
 *             raise ValueError, "malformed PI attributes"
 *         hrefs = hrefs[0]
*/
  }

  /* "src/lxml/xslt.pxi":905
 *         if len(hrefs) != 1:
 *             raise ValueError, "malformed PI attributes"
 *         hrefs = hrefs[0]             # <<<<<<<<<<<<<<
 *         href_utf = utf8(hrefs[0] or hrefs[1])
 *         c_href = _xcstr(href_utf)
*/
  __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_hrefs, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 905, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF_SET(__pyx_v_hrefs, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/xslt.pxi":906
 *             raise ValueError, "malformed PI attributes"
 *         hrefs = hrefs[0]
 *         href_utf = utf8(hrefs[0] or hrefs[1])             # <<<<<<<<<<<<<<
 *         c_href = _xcstr(href_utf)
 * 
*/
  __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_hrefs, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 906, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(3, 906, __pyx_L1_error)
  if (!__pyx_t_2) {
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_3 = __pyx_t_5;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_hrefs, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 906, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_t_5);
  __pyx_t_3 = __pyx_t_5;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_L5_bool_binop_done:;
  __pyx_t_5 = utf8(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 906, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_href_utf = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "src/lxml/xslt.pxi":907
 *         hrefs = hrefs[0]
 *         href_utf = utf8(hrefs[0] or hrefs[1])
 *         c_href = _xcstr(href_utf)             # <<<<<<<<<<<<<<
 * 
 *         if c_href[0] != c'#':
*/
  __pyx_v_c_href = (const xmlChar*)PyBytes_AS_STRING(__pyx_v_href_utf);

  /* "src/lxml/xslt.pxi":909
 *         c_href = _xcstr(href_utf)
 * 
 *         if c_href[0] != c'#':             # <<<<<<<<<<<<<<
 *             # normal URL, try to parse from it
 *             c_href = tree.xmlBuildURI(
*/
  __pyx_t_2 = ((__pyx_v_c_href[0]) != '#');
  if (__pyx_t_2) {

    /* "src/lxml/xslt.pxi":911
 *         if c_href[0] != c'#':
 *             # normal URL, try to parse from it
 *             c_href = tree.xmlBuildURI(             # <<<<<<<<<<<<<<
 *                 c_href,
 *                 tree.xmlNodeGetBase(self._c_node.doc, self._c_node))
*/
    __pyx_v_c_href = xmlBuildURI(__pyx_v_c_href, xmlNodeGetBase(__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_base._c_node->doc, __pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_base._c_node));

    /* "src/lxml/xslt.pxi":914
 *                 c_href,
 *                 tree.xmlNodeGetBase(self._c_node.doc, self._c_node))
 *             if c_href is not NULL:             # <<<<<<<<<<<<<<
 *                 try:
 *                     href_utf = <unsigned char*>c_href
*/
    __pyx_t_2 = (__pyx_v_c_href != NULL);
    if (__pyx_t_2) {

      /* "src/lxml/xslt.pxi":915
 *                 tree.xmlNodeGetBase(self._c_node.doc, self._c_node))
 *             if c_href is not NULL:
 *                 try:             # <<<<<<<<<<<<<<
 *                     href_utf = <unsigned char*>c_href
 *                 finally:
*/
      /*try:*/ {

        /* "src/lxml/xslt.pxi":916
 *             if c_href is not NULL:
 *                 try:
 *                     href_utf = <unsigned char*>c_href             # <<<<<<<<<<<<<<
 *                 finally:
 *                     tree.xmlFree(<char*>c_href)
*/
        __pyx_t_5 = __Pyx_PyBytes_FromCString(((unsigned char *)__pyx_v_c_href)); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 916, __pyx_L10_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF_SET(__pyx_v_href_utf, ((PyObject*)__pyx_t_5));
        __pyx_t_5 = 0;
      }

      /* "src/lxml/xslt.pxi":918
 *                     href_utf = <unsigned char*>c_href
 *                 finally:
 *                     tree.xmlFree(<char*>c_href)             # <<<<<<<<<<<<<<
 *             result_doc = _parseDocumentFromURL(href_utf, parser)
 *             return _elementTreeFactory(result_doc, None)
*/
      /*finally:*/ {
        /*normal exit:*/{
          xmlFree(((char *)__pyx_v_c_href));
          goto __pyx_L11;
        }
        __pyx_L10_error:;
        /*exception exit:*/{
          __Pyx_PyThreadState_declare
          __Pyx_PyThreadState_assign
          __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0;
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
           __Pyx_ExceptionSwap(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
          if ( unlikely(__Pyx_GetException(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15) < 0)) __Pyx_ErrFetch(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
          __Pyx_XGOTREF(__pyx_t_13);
          __Pyx_XGOTREF(__pyx_t_14);
          __Pyx_XGOTREF(__pyx_t_15);
          __Pyx_XGOTREF(__pyx_t_16);
          __Pyx_XGOTREF(__pyx_t_17);
          __Pyx_XGOTREF(__pyx_t_18);
          __pyx_t_1 = __pyx_lineno; __pyx_t_11 = __pyx_clineno; __pyx_t_12 = __pyx_filename;
          {
            xmlFree(((char *)__pyx_v_c_href));
          }
          __Pyx_XGIVEREF(__pyx_t_16);
          __Pyx_XGIVEREF(__pyx_t_17);
          __Pyx_XGIVEREF(__pyx_t_18);
          __Pyx_ExceptionReset(__pyx_t_16, __pyx_t_17, __pyx_t_18);
          __Pyx_XGIVEREF(__pyx_t_13);
          __Pyx_XGIVEREF(__pyx_t_14);
          __Pyx_XGIVEREF(__pyx_t_15);
          __Pyx_ErrRestore(__pyx_t_13, __pyx_t_14, __pyx_t_15);
          __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0;
          __pyx_lineno = __pyx_t_1; __pyx_clineno = __pyx_t_11; __pyx_filename = __pyx_t_12;
          goto __pyx_L1_error;
        }
        __pyx_L11:;
      }

      /* "src/lxml/xslt.pxi":914
 *                 c_href,
 *                 tree.xmlNodeGetBase(self._c_node.doc, self._c_node))
 *             if c_href is not NULL:             # <<<<<<<<<<<<<<
 *                 try:
 *                     href_utf = <unsigned char*>c_href
*/
    }

    /* "src/lxml/xslt.pxi":919
 *                 finally:
 *                     tree.xmlFree(<char*>c_href)
 *             result_doc = _parseDocumentFromURL(href_utf, parser)             # <<<<<<<<<<<<<<
 *             return _elementTreeFactory(result_doc, None)
 * 
*/
    if (!(likely(((__pyx_v_parser) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_parser, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__BaseParser))))) __PYX_ERR(3, 919, __pyx_L1_error)
    __pyx_t_5 = ((PyObject *)__pyx_f_4lxml_5etree__parseDocumentFromURL(__pyx_v_href_utf, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_parser))); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 919, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_v_result_doc = ((struct LxmlDocument *)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "src/lxml/xslt.pxi":920
 *                     tree.xmlFree(<char*>c_href)
 *             result_doc = _parseDocumentFromURL(href_utf, parser)
 *             return _elementTreeFactory(result_doc, None)             # <<<<<<<<<<<<<<
 * 
 *         # ID reference to embedded stylesheet
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = ((PyObject *)__pyx_f_4lxml_5etree__elementTreeFactory(__pyx_v_result_doc, ((struct LxmlElement *)Py_None))); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 920, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "src/lxml/xslt.pxi":909
 *         c_href = _xcstr(href_utf)
 * 
 *         if c_href[0] != c'#':             # <<<<<<<<<<<<<<
 *             # normal URL, try to parse from it
 *             c_href = tree.xmlBuildURI(
*/
  }

  /* "src/lxml/xslt.pxi":924
 *         # ID reference to embedded stylesheet
 *         # try XML:ID lookup
 *         _assertValidDoc(self._doc)             # <<<<<<<<<<<<<<
 *         c_href += 1 # skip leading '#'
 *         c_attr = tree.xmlGetID(self._c_node.doc, c_href)
*/
  __pyx_t_5 = ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_base._doc);
  __Pyx_INCREF(__pyx_t_5);
  __pyx_t_11 = __pyx_f_4lxml_5etree__assertValidDoc(((struct LxmlDocument *)__pyx_t_5)); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(3, 924, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "src/lxml/xslt.pxi":925
 *         # try XML:ID lookup
 *         _assertValidDoc(self._doc)
 *         c_href += 1 # skip leading '#'             # <<<<<<<<<<<<<<
 *         c_attr = tree.xmlGetID(self._c_node.doc, c_href)
 *         if c_attr is not NULL and c_attr.doc is self._c_node.doc:
*/
  __pyx_v_c_href = (__pyx_v_c_href + 1);

  /* "src/lxml/xslt.pxi":926
 *         _assertValidDoc(self._doc)
 *         c_href += 1 # skip leading '#'
 *         c_attr = tree.xmlGetID(self._c_node.doc, c_href)             # <<<<<<<<<<<<<<
 *         if c_attr is not NULL and c_attr.doc is self._c_node.doc:
 *             result_node = _elementFactory(self._doc, c_attr.parent)
*/
  __pyx_v_c_attr = xmlGetID(__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_base._c_node->doc, __pyx_v_c_href);

  /* "src/lxml/xslt.pxi":927
 *         c_href += 1 # skip leading '#'
 *         c_attr = tree.xmlGetID(self._c_node.doc, c_href)
 *         if c_attr is not NULL and c_attr.doc is self._c_node.doc:             # <<<<<<<<<<<<<<
 *             result_node = _elementFactory(self._doc, c_attr.parent)
 *             return _elementTreeFactory(result_node._doc, result_node)
*/
  __pyx_t_19 = (__pyx_v_c_attr != NULL);
  if (__pyx_t_19) {
  } else {
    __pyx_t_2 = __pyx_t_19;
    goto __pyx_L15_bool_binop_done;
  }
  __pyx_t_19 = (__pyx_v_c_attr->doc == __pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_base._c_node->doc);
  __pyx_t_2 = __pyx_t_19;
  __pyx_L15_bool_binop_done:;
  if (__pyx_t_2) {

    /* "src/lxml/xslt.pxi":928
 *         c_attr = tree.xmlGetID(self._c_node.doc, c_href)
 *         if c_attr is not NULL and c_attr.doc is self._c_node.doc:
 *             result_node = _elementFactory(self._doc, c_attr.parent)             # <<<<<<<<<<<<<<
 *             return _elementTreeFactory(result_node._doc, result_node)
 * 
*/
    __pyx_t_5 = ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_base._doc);
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_5), __pyx_v_c_attr->parent)); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 928, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_result_node = ((struct LxmlElement *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/xslt.pxi":929
 *         if c_attr is not NULL and c_attr.doc is self._c_node.doc:
 *             result_node = _elementFactory(self._doc, c_attr.parent)
 *             return _elementTreeFactory(result_node._doc, result_node)             # <<<<<<<<<<<<<<
 * 
 *         # try XPath search
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = ((PyObject *)__pyx_v_result_node->_doc);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_5 = ((PyObject *)__pyx_f_4lxml_5etree__elementTreeFactory(((struct LxmlDocument *)__pyx_t_3), __pyx_v_result_node)); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 929, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "src/lxml/xslt.pxi":927
 *         c_href += 1 # skip leading '#'
 *         c_attr = tree.xmlGetID(self._c_node.doc, c_href)
 *         if c_attr is not NULL and c_attr.doc is self._c_node.doc:             # <<<<<<<<<<<<<<
 *             result_node = _elementFactory(self._doc, c_attr.parent)
 *             return _elementTreeFactory(result_node._doc, result_node)
*/
  }

  /* "src/lxml/xslt.pxi":932
 * 
 *         # try XPath search
 *         root = _findStylesheetByID(self._doc, funicode(c_href))             # <<<<<<<<<<<<<<
 *         if not root:
 *             raise ValueError, "reference to non-existing embedded stylesheet"
*/
  __pyx_t_5 = ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_base._doc);
  __Pyx_INCREF(__pyx_t_5);
  __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_href); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 932, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_9 = __pyx_f_4lxml_5etree__findStylesheetByID(((struct LxmlDocument *)__pyx_t_5), __pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 932, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_root = __pyx_t_9;
  __pyx_t_9 = 0;

  /* "src/lxml/xslt.pxi":933
 *         # try XPath search
 *         root = _findStylesheetByID(self._doc, funicode(c_href))
 *         if not root:             # <<<<<<<<<<<<<<
 *             raise ValueError, "reference to non-existing embedded stylesheet"
 *         elif len(root) > 1:
*/
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_root); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(3, 933, __pyx_L1_error)
  __pyx_t_19 = (!__pyx_t_2);
  if (unlikely(__pyx_t_19)) {

    /* "src/lxml/xslt.pxi":934
 *         root = _findStylesheetByID(self._doc, funicode(c_href))
 *         if not root:
 *             raise ValueError, "reference to non-existing embedded stylesheet"             # <<<<<<<<<<<<<<
 *         elif len(root) > 1:
 *             raise ValueError, "ambiguous reference to embedded stylesheet"
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_reference_to_non_existing_embedd, 0, 0);
    __PYX_ERR(3, 934, __pyx_L1_error)

    /* "src/lxml/xslt.pxi":933
 *         # try XPath search
 *         root = _findStylesheetByID(self._doc, funicode(c_href))
 *         if not root:             # <<<<<<<<<<<<<<
 *             raise ValueError, "reference to non-existing embedded stylesheet"
 *         elif len(root) > 1:
*/
  }

  /* "src/lxml/xslt.pxi":935
 *         if not root:
 *             raise ValueError, "reference to non-existing embedded stylesheet"
 *         elif len(root) > 1:             # <<<<<<<<<<<<<<
 *             raise ValueError, "ambiguous reference to embedded stylesheet"
 *         result_node = root[0]
*/
  __pyx_t_7 = PyObject_Length(__pyx_v_root); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(3, 935, __pyx_L1_error)
  __pyx_t_19 = (__pyx_t_7 > 1);
  if (unlikely(__pyx_t_19)) {

    /* "src/lxml/xslt.pxi":936
 *             raise ValueError, "reference to non-existing embedded stylesheet"
 *         elif len(root) > 1:
 *             raise ValueError, "ambiguous reference to embedded stylesheet"             # <<<<<<<<<<<<<<
 *         result_node = root[0]
 *         return _elementTreeFactory(result_node._doc, result_node)
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_ambiguous_reference_to_embedded, 0, 0);
    __PYX_ERR(3, 936, __pyx_L1_error)

    /* "src/lxml/xslt.pxi":935
 *         if not root:
 *             raise ValueError, "reference to non-existing embedded stylesheet"
 *         elif len(root) > 1:             # <<<<<<<<<<<<<<
 *             raise ValueError, "ambiguous reference to embedded stylesheet"
 *         result_node = root[0]
*/
  }

  /* "src/lxml/xslt.pxi":937
 *         elif len(root) > 1:
 *             raise ValueError, "ambiguous reference to embedded stylesheet"
 *         result_node = root[0]             # <<<<<<<<<<<<<<
 *         return _elementTreeFactory(result_node._doc, result_node)
 * 
*/
  __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_root, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 937, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element))))) __PYX_ERR(3, 937, __pyx_L1_error)
  __pyx_v_result_node = ((struct LxmlElement *)__pyx_t_9);
  __pyx_t_9 = 0;

  /* "src/lxml/xslt.pxi":938
 *             raise ValueError, "ambiguous reference to embedded stylesheet"
 *         result_node = root[0]
 *         return _elementTreeFactory(result_node._doc, result_node)             # <<<<<<<<<<<<<<
 * 
 *     def set(self, key, value):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_9 = ((PyObject *)__pyx_v_result_node->_doc);
  __Pyx_INCREF(__pyx_t_9);
  __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__elementTreeFactory(((struct LxmlDocument *)__pyx_t_9), __pyx_v_result_node)); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 938, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "src/lxml/xslt.pxi":883
 * 
 * cdef class _XSLTProcessingInstruction(PIBase):
 *     def parseXSL(self, parser=None):             # <<<<<<<<<<<<<<
 *         """parseXSL(self, parser=None)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("lxml.etree._XSLTProcessingInstruction.parseXSL", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result_doc);
  __Pyx_XDECREF((PyObject *)__pyx_v_result_node);
  __Pyx_XDECREF(__pyx_v_href_utf);
  __Pyx_XDECREF(__pyx_v_hrefs);
  __Pyx_XDECREF(__pyx_v_root);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xslt.pxi":940
 *         return _elementTreeFactory(result_node._doc, result_node)
 * 
 *     def set(self, key, value):             # <<<<<<<<<<<<<<
 *         """set(self, key, value)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_26_XSLTProcessingInstruction_3set(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_26_XSLTProcessingInstruction_2set, "set(self, key, value)\n\n        Supports setting the 'href' pseudo-attribute in the text of\n        the processing instruction.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_26_XSLTProcessingInstruction_3set = {"set", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_26_XSLTProcessingInstruction_3set, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_26_XSLTProcessingInstruction_2set};
static PyObject *__pyx_pw_4lxml_5etree_26_XSLTProcessingInstruction_3set(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_value = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_key,&__pyx_mstate_global->__pyx_n_u_value,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(3, 940, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(3, 940, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(3, 940, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "set", 0) < (0)) __PYX_ERR(3, 940, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("set", 1, 2, 2, i); __PYX_ERR(3, 940, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(3, 940, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(3, 940, __pyx_L3_error)
    }
    __pyx_v_key = values[0];
    __pyx_v_value = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set", 1, 2, 2, __pyx_nargs); __PYX_ERR(3, 940, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._XSLTProcessingInstruction.set", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_26_XSLTProcessingInstruction_2set(((struct __pyx_obj_4lxml_5etree__XSLTProcessingInstruction *)__pyx_v_self), __pyx_v_key, __pyx_v_value);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_26_XSLTProcessingInstruction_2set(struct __pyx_obj_4lxml_5etree__XSLTProcessingInstruction *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) {
  PyObject *__pyx_v_attrib = NULL;
  PyObject *__pyx_v_text = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4[3];
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  size_t __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set", 0);

  /* "src/lxml/xslt.pxi":946
 *         the processing instruction.
 *         """
 *         if key != "href":             # <<<<<<<<<<<<<<
 *             raise AttributeError, \
 *                 "only setting the 'href' attribute is supported on XSLT-PIs"
*/
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_key, __pyx_mstate_global->__pyx_n_u_href, Py_NE)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(3, 946, __pyx_L1_error)
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/xslt.pxi":947
 *         """
 *         if key != "href":
 *             raise AttributeError, \             # <<<<<<<<<<<<<<
 *                 "only setting the 'href' attribute is supported on XSLT-PIs"
 *         if value is None:
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AttributeError))), __pyx_mstate_global->__pyx_kp_u_only_setting_the_href_attribute, 0, 0);
    __PYX_ERR(3, 947, __pyx_L1_error)

    /* "src/lxml/xslt.pxi":946
 *         the processing instruction.
 *         """
 *         if key != "href":             # <<<<<<<<<<<<<<
 *             raise AttributeError, \
 *                 "only setting the 'href' attribute is supported on XSLT-PIs"
*/
  }

  /* "src/lxml/xslt.pxi":949
 *             raise AttributeError, \
 *                 "only setting the 'href' attribute is supported on XSLT-PIs"
 *         if value is None:             # <<<<<<<<<<<<<<
 *             attrib = ""
 *         elif '"' in value or '>' in value:
*/
  __pyx_t_1 = (__pyx_v_value == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/xslt.pxi":950
 *                 "only setting the 'href' attribute is supported on XSLT-PIs"
 *         if value is None:
 *             attrib = ""             # <<<<<<<<<<<<<<
 *         elif '"' in value or '>' in value:
 *             raise ValueError, "Invalid URL, must not contain '\"' or '>'"
*/
    __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u__8);
    __pyx_v_attrib = __pyx_mstate_global->__pyx_kp_u__8;

    /* "src/lxml/xslt.pxi":949
 *             raise AttributeError, \
 *                 "only setting the 'href' attribute is supported on XSLT-PIs"
 *         if value is None:             # <<<<<<<<<<<<<<
 *             attrib = ""
 *         elif '"' in value or '>' in value:
*/
    goto __pyx_L4;
  }

  /* "src/lxml/xslt.pxi":951
 *         if value is None:
 *             attrib = ""
 *         elif '"' in value or '>' in value:             # <<<<<<<<<<<<<<
 *             raise ValueError, "Invalid URL, must not contain '\"' or '>'"
 *         else:
*/
  __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_mstate_global->__pyx_kp_u__14, __pyx_v_value, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(3, 951, __pyx_L1_error)
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_mstate_global->__pyx_kp_u__3, __pyx_v_value, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(3, 951, __pyx_L1_error)
  __pyx_t_1 = __pyx_t_2;
  __pyx_L5_bool_binop_done:;
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/xslt.pxi":952
 *             attrib = ""
 *         elif '"' in value or '>' in value:
 *             raise ValueError, "Invalid URL, must not contain '\"' or '>'"             # <<<<<<<<<<<<<<
 *         else:
 *             attrib = f' href="{value}"'
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Invalid_URL_must_not_contain_or, 0, 0);
    __PYX_ERR(3, 952, __pyx_L1_error)

    /* "src/lxml/xslt.pxi":951
 *         if value is None:
 *             attrib = ""
 *         elif '"' in value or '>' in value:             # <<<<<<<<<<<<<<
 *             raise ValueError, "Invalid URL, must not contain '\"' or '>'"
 *         else:
*/
  }

  /* "src/lxml/xslt.pxi":954
 *             raise ValueError, "Invalid URL, must not contain '\"' or '>'"
 *         else:
 *             attrib = f' href="{value}"'             # <<<<<<<<<<<<<<
 *         text = ' ' + self.text
 *         if _FIND_PI_HREF(text):
*/
  /*else*/ {
    __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_v_value, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 954, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u_href_2;
    __pyx_t_4[1] = __pyx_t_3;
    __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u__14;
    __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, 7 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3));
    if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 954, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_attrib = ((PyObject*)__pyx_t_5);
    __pyx_t_5 = 0;
  }
  __pyx_L4:;

  /* "src/lxml/xslt.pxi":955
 *         else:
 *             attrib = f' href="{value}"'
 *         text = ' ' + self.text             # <<<<<<<<<<<<<<
 *         if _FIND_PI_HREF(text):
 *             self.text = _REPLACE_PI_HREF(attrib, text)
*/
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_text); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 955, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = PyNumber_Add(__pyx_mstate_global->__pyx_kp_u__7, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 955, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_text = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "src/lxml/xslt.pxi":956
 *             attrib = f' href="{value}"'
 *         text = ' ' + self.text
 *         if _FIND_PI_HREF(text):             # <<<<<<<<<<<<<<
 *             self.text = _REPLACE_PI_HREF(attrib, text)
 *         else:
*/
  __pyx_t_5 = NULL;
  __Pyx_INCREF(__pyx_v_4lxml_5etree__FIND_PI_HREF);
  __pyx_t_6 = __pyx_v_4lxml_5etree__FIND_PI_HREF; 
  __pyx_t_7 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
    assert(__pyx_t_5);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
    __pyx_t_7 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_text};
    __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 956, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(3, 956, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_1) {

    /* "src/lxml/xslt.pxi":957
 *         text = ' ' + self.text
 *         if _FIND_PI_HREF(text):
 *             self.text = _REPLACE_PI_HREF(attrib, text)             # <<<<<<<<<<<<<<
 *         else:
 *             self.text = text + attrib
*/
    __pyx_t_6 = NULL;
    __Pyx_INCREF(__pyx_v_4lxml_5etree__REPLACE_PI_HREF);
    __pyx_t_5 = __pyx_v_4lxml_5etree__REPLACE_PI_HREF; 
    __pyx_t_7 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
      assert(__pyx_t_6);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
      __pyx_t_7 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_v_attrib, __pyx_v_text};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 957, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_text, __pyx_t_3) < (0)) __PYX_ERR(3, 957, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/xslt.pxi":956
 *             attrib = f' href="{value}"'
 *         text = ' ' + self.text
 *         if _FIND_PI_HREF(text):             # <<<<<<<<<<<<<<
 *             self.text = _REPLACE_PI_HREF(attrib, text)
 *         else:
*/
    goto __pyx_L7;
  }

  /* "src/lxml/xslt.pxi":959
 *             self.text = _REPLACE_PI_HREF(attrib, text)
 *         else:
 *             self.text = text + attrib             # <<<<<<<<<<<<<<
*/
  /*else*/ {
    __pyx_t_3 = PyNumber_Add(__pyx_v_text, __pyx_v_attrib); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 959, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_text, __pyx_t_3) < (0)) __PYX_ERR(3, 959, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_L7:;

  /* "src/lxml/xslt.pxi":940
 *         return _elementTreeFactory(result_node._doc, result_node)
 * 
 *     def set(self, key, value):             # <<<<<<<<<<<<<<
 *         """set(self, key, value)
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._XSLTProcessingInstruction.set", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_attrib);
  __Pyx_XDECREF(__pyx_v_text);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xsltext.pxi":6
 *     """Base class of an XSLT extension element.
 *     """
 *     def execute(self, context, self_node, input_node, output_parent):             # <<<<<<<<<<<<<<
 *         """execute(self, context, self_node, input_node, output_parent)
 *         Execute this extension element.
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_13XSLTExtension_1execute(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_13XSLTExtension_execute, "execute(self, context, self_node, input_node, output_parent)\n        Execute this extension element.\n\n        Subclasses must override this method.  They may append\n        elements to the `output_parent` element here, or set its text\n        content.  To this end, the `input_node` provides read-only\n        access to the current node in the input document, and the\n        `self_node` points to the extension element in the stylesheet.\n\n        Note that the `output_parent` parameter may be `None` if there\n        is no parent element in the current context (e.g. no content\n        was added to the output tree yet).\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_13XSLTExtension_1execute = {"execute", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_13XSLTExtension_1execute, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_13XSLTExtension_execute};
static PyObject *__pyx_pw_4lxml_5etree_13XSLTExtension_1execute(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_context = 0;
  CYTHON_UNUSED PyObject *__pyx_v_self_node = 0;
  CYTHON_UNUSED PyObject *__pyx_v_input_node = 0;
  CYTHON_UNUSED PyObject *__pyx_v_output_parent = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[4] = {0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("execute (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_context,&__pyx_mstate_global->__pyx_n_u_self_node,&__pyx_mstate_global->__pyx_n_u_input_node,&__pyx_mstate_global->__pyx_n_u_output_parent,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(20, 6, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(20, 6, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(20, 6, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(20, 6, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(20, 6, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "execute", 0) < (0)) __PYX_ERR(20, 6, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 4; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("execute", 1, 4, 4, i); __PYX_ERR(20, 6, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 4)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(20, 6, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(20, 6, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(20, 6, __pyx_L3_error)
      values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(20, 6, __pyx_L3_error)
    }
    __pyx_v_context = values[0];
    __pyx_v_self_node = values[1];
    __pyx_v_input_node = values[2];
    __pyx_v_output_parent = values[3];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("execute", 1, 4, 4, __pyx_nargs); __PYX_ERR(20, 6, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.XSLTExtension.execute", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_13XSLTExtension_execute(((struct __pyx_obj_4lxml_5etree_XSLTExtension *)__pyx_v_self), __pyx_v_context, __pyx_v_self_node, __pyx_v_input_node, __pyx_v_output_parent);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_13XSLTExtension_execute(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree_XSLTExtension *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_context, CYTHON_UNUSED PyObject *__pyx_v_self_node, CYTHON_UNUSED PyObject *__pyx_v_input_node, CYTHON_UNUSED PyObject *__pyx_v_output_parent) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("execute", 0);

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xsltext.pxi":22
 *         pass
 * 
 *     def apply_templates(self, _XSLTContext context not None, node, output_parent=None,             # <<<<<<<<<<<<<<
 *                         *, elements_only=False, remove_blank_text=False):
 *         """apply_templates(self, context, node, output_parent=None, elements_only=False, remove_blank_text=False)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_13XSLTExtension_3apply_templates(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_13XSLTExtension_2apply_templates, "apply_templates(self, context, node, output_parent=None, elements_only=False, remove_blank_text=False)\n\n        Call this method to retrieve the result of applying templates\n        to an element.\n\n        The return value is a list of elements or text strings that\n        were generated by the XSLT processor.  If you pass\n        ``elements_only=True``, strings will be discarded from the result\n        list.  The option ``remove_blank_text=True`` will only discard\n        strings that consist entirely of whitespace (e.g. formatting).\n        These options do not apply to Elements, only to bare string results.\n\n        If you pass an Element as `output_parent` parameter, the result\n        will instead be appended to the element (including attributes\n        etc.) and the return value will be `None`.  This is a safe way\n        to generate content into the output document directly, without\n        having to take care of special values like text or attributes.\n        Note that the string discarding options will be ignored in this\n        case.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_13XSLTExtension_3apply_templates = {"apply_templates", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_13XSLTExtension_3apply_templates, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_13XSLTExtension_2apply_templates};
static PyObject *__pyx_pw_4lxml_5etree_13XSLTExtension_3apply_templates(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct __pyx_obj_4lxml_5etree__XSLTContext *__pyx_v_context = 0;
  PyObject *__pyx_v_node = 0;
  PyObject *__pyx_v_output_parent = 0;
  PyObject *__pyx_v_elements_only = 0;
  PyObject *__pyx_v_remove_blank_text = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[5] = {0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("apply_templates (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_context,&__pyx_mstate_global->__pyx_n_u_node,&__pyx_mstate_global->__pyx_n_u_output_parent,&__pyx_mstate_global->__pyx_n_u_elements_only,&__pyx_mstate_global->__pyx_n_u_remove_blank_text,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(20, 22, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(20, 22, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(20, 22, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(20, 22, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "apply_templates", 0) < (0)) __PYX_ERR(20, 22, __pyx_L3_error)
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "src/lxml/xsltext.pxi":23
 * 
 *     def apply_templates(self, _XSLTContext context not None, node, output_parent=None,
 *                         *, elements_only=False, remove_blank_text=False):             # <<<<<<<<<<<<<<
 *         """apply_templates(self, context, node, output_parent=None, elements_only=False, remove_blank_text=False)
 * 
*/
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_False));
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("apply_templates", 0, 2, 3, i); __PYX_ERR(20, 22, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(20, 22, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(20, 22, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(20, 22, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }

      /* "src/lxml/xsltext.pxi":22
 *         pass
 * 
 *     def apply_templates(self, _XSLTContext context not None, node, output_parent=None,             # <<<<<<<<<<<<<<
 *                         *, elements_only=False, remove_blank_text=False):
 *         """apply_templates(self, context, node, output_parent=None, elements_only=False, remove_blank_text=False)
*/
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "src/lxml/xsltext.pxi":23
 * 
 *     def apply_templates(self, _XSLTContext context not None, node, output_parent=None,
 *                         *, elements_only=False, remove_blank_text=False):             # <<<<<<<<<<<<<<
 *         """apply_templates(self, context, node, output_parent=None, elements_only=False, remove_blank_text=False)
 * 
*/
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_False));
    }
    __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__XSLTContext *)values[0]);
    __pyx_v_node = values[1];
    __pyx_v_output_parent = values[2];
    __pyx_v_elements_only = values[3];
    __pyx_v_remove_blank_text = values[4];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("apply_templates", 0, 2, 3, __pyx_nargs); __PYX_ERR(20, 22, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.XSLTExtension.apply_templates", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_context), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__XSLTContext, 0, "context", 0))) __PYX_ERR(20, 22, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_13XSLTExtension_2apply_templates(((struct __pyx_obj_4lxml_5etree_XSLTExtension *)__pyx_v_self), __pyx_v_context, __pyx_v_node, __pyx_v_output_parent, __pyx_v_elements_only, __pyx_v_remove_blank_text);

  /* "src/lxml/xsltext.pxi":22
 *         pass
 * 
 *     def apply_templates(self, _XSLTContext context not None, node, output_parent=None,             # <<<<<<<<<<<<<<
 *                         *, elements_only=False, remove_blank_text=False):
 *         """apply_templates(self, context, node, output_parent=None, elements_only=False, remove_blank_text=False)
*/

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_13XSLTExtension_2apply_templates(struct __pyx_obj_4lxml_5etree_XSLTExtension *__pyx_v_self, struct __pyx_obj_4lxml_5etree__XSLTContext *__pyx_v_context, PyObject *__pyx_v_node, PyObject *__pyx_v_output_parent, PyObject *__pyx_v_elements_only, PyObject *__pyx_v_remove_blank_text) {
  xmlNode *__pyx_v_c_parent;
  xmlNode *__pyx_v_c_node;
  xmlNode *__pyx_v_c_context_node;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  xmlNode *__pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  char const *__pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("apply_templates", 0);

  /* "src/lxml/xsltext.pxi":47
 *         cdef xmlNode* c_node
 *         cdef xmlNode* c_context_node
 *         assert context._xsltCtxt is not NULL, "XSLT context not initialised"             # <<<<<<<<<<<<<<
 *         c_context_node = _roNodeOf(node)
 *         #assert c_context_node.doc is context._xsltContext.node.doc, \
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = (__pyx_v_context->_xsltCtxt != NULL);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_mstate_global->__pyx_kp_u_XSLT_context_not_initialised, 0, 0);
      __PYX_ERR(20, 47, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(20, 47, __pyx_L1_error)
  #endif

  /* "src/lxml/xsltext.pxi":48
 *         cdef xmlNode* c_context_node
 *         assert context._xsltCtxt is not NULL, "XSLT context not initialised"
 *         c_context_node = _roNodeOf(node)             # <<<<<<<<<<<<<<
 *         #assert c_context_node.doc is context._xsltContext.node.doc, \
 *         #    "switching input documents during transformation is not currently supported"
*/
  __pyx_t_2 = __pyx_f_4lxml_5etree__roNodeOf(__pyx_v_node); if (unlikely(__pyx_t_2 == ((void *)NULL))) __PYX_ERR(20, 48, __pyx_L1_error)
  __pyx_v_c_context_node = __pyx_t_2;

  /* "src/lxml/xsltext.pxi":52
 *         #    "switching input documents during transformation is not currently supported"
 * 
 *         if output_parent is not None:             # <<<<<<<<<<<<<<
 *             c_parent = _nonRoNodeOf(output_parent)
 *         else:
*/
  __pyx_t_1 = (__pyx_v_output_parent != Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/xsltext.pxi":53
 * 
 *         if output_parent is not None:
 *             c_parent = _nonRoNodeOf(output_parent)             # <<<<<<<<<<<<<<
 *         else:
 *             c_parent = tree.xmlNewDocNode(
*/
    __pyx_t_2 = __pyx_f_4lxml_5etree__nonRoNodeOf(__pyx_v_output_parent); if (unlikely(__pyx_t_2 == ((void *)NULL))) __PYX_ERR(20, 53, __pyx_L1_error)
    __pyx_v_c_parent = __pyx_t_2;

    /* "src/lxml/xsltext.pxi":52
 *         #    "switching input documents during transformation is not currently supported"
 * 
 *         if output_parent is not None:             # <<<<<<<<<<<<<<
 *             c_parent = _nonRoNodeOf(output_parent)
 *         else:
*/
    goto __pyx_L3;
  }

  /* "src/lxml/xsltext.pxi":55
 *             c_parent = _nonRoNodeOf(output_parent)
 *         else:
 *             c_parent = tree.xmlNewDocNode(             # <<<<<<<<<<<<<<
 *                 context._xsltCtxt.output, NULL, <unsigned char*>"fake-parent", NULL)
 * 
*/
  /*else*/ {

    /* "src/lxml/xsltext.pxi":56
 *         else:
 *             c_parent = tree.xmlNewDocNode(
 *                 context._xsltCtxt.output, NULL, <unsigned char*>"fake-parent", NULL)             # <<<<<<<<<<<<<<
 * 
 *         c_node = context._xsltCtxt.insert
*/
    __pyx_v_c_parent = xmlNewDocNode(__pyx_v_context->_xsltCtxt->output, NULL, ((unsigned char *)((unsigned char *)((char *)"fake-parent"))), NULL);
  }
  __pyx_L3:;

  /* "src/lxml/xsltext.pxi":58
 *                 context._xsltCtxt.output, NULL, <unsigned char*>"fake-parent", NULL)
 * 
 *         c_node = context._xsltCtxt.insert             # <<<<<<<<<<<<<<
 *         context._xsltCtxt.insert = c_parent
 *         xslt.xsltProcessOneNode(
*/
  __pyx_t_2 = __pyx_v_context->_xsltCtxt->insert;
  __pyx_v_c_node = __pyx_t_2;

  /* "src/lxml/xsltext.pxi":59
 * 
 *         c_node = context._xsltCtxt.insert
 *         context._xsltCtxt.insert = c_parent             # <<<<<<<<<<<<<<
 *         xslt.xsltProcessOneNode(
 *             context._xsltCtxt, c_context_node, NULL)
*/
  __pyx_v_context->_xsltCtxt->insert = __pyx_v_c_parent;

  /* "src/lxml/xsltext.pxi":60
 *         c_node = context._xsltCtxt.insert
 *         context._xsltCtxt.insert = c_parent
 *         xslt.xsltProcessOneNode(             # <<<<<<<<<<<<<<
 *             context._xsltCtxt, c_context_node, NULL)
 *         context._xsltCtxt.insert = c_node
*/
  xsltProcessOneNode(__pyx_v_context->_xsltCtxt, __pyx_v_c_context_node, NULL);

  /* "src/lxml/xsltext.pxi":62
 *         xslt.xsltProcessOneNode(
 *             context._xsltCtxt, c_context_node, NULL)
 *         context._xsltCtxt.insert = c_node             # <<<<<<<<<<<<<<
 * 
 *         if output_parent is not None:
*/
  __pyx_v_context->_xsltCtxt->insert = __pyx_v_c_node;

  /* "src/lxml/xsltext.pxi":64
 *         context._xsltCtxt.insert = c_node
 * 
 *         if output_parent is not None:             # <<<<<<<<<<<<<<
 *             return None
 * 
*/
  __pyx_t_1 = (__pyx_v_output_parent != Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/xsltext.pxi":65
 * 
 *         if output_parent is not None:
 *             return None             # <<<<<<<<<<<<<<
 * 
 *         try:
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/xsltext.pxi":64
 *         context._xsltCtxt.insert = c_node
 * 
 *         if output_parent is not None:             # <<<<<<<<<<<<<<
 *             return None
 * 
*/
  }

  /* "src/lxml/xsltext.pxi":67
 *             return None
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             return self._collectXSLTResultContent(
 *                 context, c_parent, elements_only, remove_blank_text)
*/
  /*try:*/ {

    /* "src/lxml/xsltext.pxi":68
 * 
 *         try:
 *             return self._collectXSLTResultContent(             # <<<<<<<<<<<<<<
 *                 context, c_parent, elements_only, remove_blank_text)
 *         finally:
*/
    __Pyx_XDECREF(__pyx_r);

    /* "src/lxml/xsltext.pxi":69
 *         try:
 *             return self._collectXSLTResultContent(
 *                 context, c_parent, elements_only, remove_blank_text)             # <<<<<<<<<<<<<<
 *         finally:
 *             # free all intermediate nodes that will not be freed by proxies
*/
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_elements_only); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(20, 69, __pyx_L6_error)
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_remove_blank_text); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(20, 69, __pyx_L6_error)

    /* "src/lxml/xsltext.pxi":68
 * 
 *         try:
 *             return self._collectXSLTResultContent(             # <<<<<<<<<<<<<<
 *                 context, c_parent, elements_only, remove_blank_text)
 *         finally:
*/
    __pyx_t_4 = ((struct __pyx_vtabstruct_4lxml_5etree_XSLTExtension *)__pyx_v_self->__pyx_vtab)->_collectXSLTResultContent(__pyx_v_self, __pyx_v_context, __pyx_v_c_parent, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(20, 68, __pyx_L6_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L5_return;
  }

  /* "src/lxml/xsltext.pxi":72
 *         finally:
 *             # free all intermediate nodes that will not be freed by proxies
 *             tree.xmlFreeNode(c_parent)             # <<<<<<<<<<<<<<
 * 
 *     def process_children(self, _XSLTContext context not None, output_parent=None,
*/
  /*finally:*/ {
    __pyx_L6_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
      if ( unlikely(__Pyx_GetException(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10) < 0)) __Pyx_ErrFetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      __pyx_t_5 = __pyx_lineno; __pyx_t_6 = __pyx_clineno; __pyx_t_7 = __pyx_filename;
      {
        xmlFreeNode(__pyx_v_c_parent);
      }
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_ErrRestore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
      __pyx_lineno = __pyx_t_5; __pyx_clineno = __pyx_t_6; __pyx_filename = __pyx_t_7;
      goto __pyx_L1_error;
    }
    __pyx_L5_return: {
      __pyx_t_13 = __pyx_r;
      __pyx_r = 0;
      xmlFreeNode(__pyx_v_c_parent);
      __pyx_r = __pyx_t_13;
      __pyx_t_13 = 0;
      goto __pyx_L0;
    }
  }

  /* "src/lxml/xsltext.pxi":22
 *         pass
 * 
 *     def apply_templates(self, _XSLTContext context not None, node, output_parent=None,             # <<<<<<<<<<<<<<
 *                         *, elements_only=False, remove_blank_text=False):
 *         """apply_templates(self, context, node, output_parent=None, elements_only=False, remove_blank_text=False)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.XSLTExtension.apply_templates", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xsltext.pxi":74
 *             tree.xmlFreeNode(c_parent)
 * 
 *     def process_children(self, _XSLTContext context not None, output_parent=None,             # <<<<<<<<<<<<<<
 *                          *, elements_only=False, remove_blank_text=False):
 *         """process_children(self, context, output_parent=None, elements_only=False, remove_blank_text=False)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_13XSLTExtension_5process_children(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_13XSLTExtension_4process_children, "process_children(self, context, output_parent=None, elements_only=False, remove_blank_text=False)\n\n        Call this method to process the XSLT content of the extension\n        element itself.\n\n        The return value is a list of elements or text strings that\n        were generated by the XSLT processor.  If you pass\n        ``elements_only=True``, strings will be discarded from the result\n        list.  The option ``remove_blank_text=True`` will only discard\n        strings that consist entirely of whitespace (e.g. formatting).\n        These options do not apply to Elements, only to bare string results.\n\n        If you pass an Element as `output_parent` parameter, the result\n        will instead be appended to the element (including attributes\n        etc.) and the return value will be `None`.  This is a safe way\n        to generate content into the output document directly, without\n        having to take care of special values like text or attributes.\n        Note that the string discarding options will be ignored in this\n        case.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_13XSLTExtension_5process_children = {"process_children", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_13XSLTExtension_5process_children, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_13XSLTExtension_4process_children};
static PyObject *__pyx_pw_4lxml_5etree_13XSLTExtension_5process_children(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct __pyx_obj_4lxml_5etree__XSLTContext *__pyx_v_context = 0;
  PyObject *__pyx_v_output_parent = 0;
  PyObject *__pyx_v_elements_only = 0;
  PyObject *__pyx_v_remove_blank_text = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[4] = {0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("process_children (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_context,&__pyx_mstate_global->__pyx_n_u_output_parent,&__pyx_mstate_global->__pyx_n_u_elements_only,&__pyx_mstate_global->__pyx_n_u_remove_blank_text,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(20, 74, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(20, 74, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(20, 74, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "process_children", 0) < (0)) __PYX_ERR(20, 74, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "src/lxml/xsltext.pxi":75
 * 
 *     def process_children(self, _XSLTContext context not None, output_parent=None,
 *                          *, elements_only=False, remove_blank_text=False):             # <<<<<<<<<<<<<<
 *         """process_children(self, context, output_parent=None, elements_only=False, remove_blank_text=False)
 * 
*/
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_False));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("process_children", 0, 1, 2, i); __PYX_ERR(20, 74, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(20, 74, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(20, 74, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }

      /* "src/lxml/xsltext.pxi":74
 *             tree.xmlFreeNode(c_parent)
 * 
 *     def process_children(self, _XSLTContext context not None, output_parent=None,             # <<<<<<<<<<<<<<
 *                          *, elements_only=False, remove_blank_text=False):
 *         """process_children(self, context, output_parent=None, elements_only=False, remove_blank_text=False)
*/
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "src/lxml/xsltext.pxi":75
 * 
 *     def process_children(self, _XSLTContext context not None, output_parent=None,
 *                          *, elements_only=False, remove_blank_text=False):             # <<<<<<<<<<<<<<
 *         """process_children(self, context, output_parent=None, elements_only=False, remove_blank_text=False)
 * 
*/
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_False));
    }
    __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__XSLTContext *)values[0]);
    __pyx_v_output_parent = values[1];
    __pyx_v_elements_only = values[2];
    __pyx_v_remove_blank_text = values[3];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("process_children", 0, 1, 2, __pyx_nargs); __PYX_ERR(20, 74, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.XSLTExtension.process_children", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_context), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__XSLTContext, 0, "context", 0))) __PYX_ERR(20, 74, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_13XSLTExtension_4process_children(((struct __pyx_obj_4lxml_5etree_XSLTExtension *)__pyx_v_self), __pyx_v_context, __pyx_v_output_parent, __pyx_v_elements_only, __pyx_v_remove_blank_text);

  /* "src/lxml/xsltext.pxi":74
 *             tree.xmlFreeNode(c_parent)
 * 
 *     def process_children(self, _XSLTContext context not None, output_parent=None,             # <<<<<<<<<<<<<<
 *                          *, elements_only=False, remove_blank_text=False):
 *         """process_children(self, context, output_parent=None, elements_only=False, remove_blank_text=False)
*/

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_13XSLTExtension_4process_children(struct __pyx_obj_4lxml_5etree_XSLTExtension *__pyx_v_self, struct __pyx_obj_4lxml_5etree__XSLTContext *__pyx_v_context, PyObject *__pyx_v_output_parent, PyObject *__pyx_v_elements_only, PyObject *__pyx_v_remove_blank_text) {
  xmlNode *__pyx_v_c_parent;
  xsltTransformContext *__pyx_v_c_ctxt;
  xmlNode *__pyx_v_c_old_output_parent;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  xsltTransformContext *__pyx_t_1;
  xmlNode *__pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  char const *__pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("process_children", 0);

  /* "src/lxml/xsltext.pxi":97
 *         """
 *         cdef xmlNode* c_parent
 *         cdef xslt.xsltTransformContext* c_ctxt = context._xsltCtxt             # <<<<<<<<<<<<<<
 *         cdef xmlNode* c_old_output_parent = c_ctxt.insert
 *         assert context._xsltCtxt is not NULL, "XSLT context not initialised"
*/
  __pyx_t_1 = __pyx_v_context->_xsltCtxt;
  __pyx_v_c_ctxt = __pyx_t_1;

  /* "src/lxml/xsltext.pxi":98
 *         cdef xmlNode* c_parent
 *         cdef xslt.xsltTransformContext* c_ctxt = context._xsltCtxt
 *         cdef xmlNode* c_old_output_parent = c_ctxt.insert             # <<<<<<<<<<<<<<
 *         assert context._xsltCtxt is not NULL, "XSLT context not initialised"
 * 
*/
  __pyx_t_2 = __pyx_v_c_ctxt->insert;
  __pyx_v_c_old_output_parent = __pyx_t_2;

  /* "src/lxml/xsltext.pxi":99
 *         cdef xslt.xsltTransformContext* c_ctxt = context._xsltCtxt
 *         cdef xmlNode* c_old_output_parent = c_ctxt.insert
 *         assert context._xsltCtxt is not NULL, "XSLT context not initialised"             # <<<<<<<<<<<<<<
 * 
 *         # output_parent node is used for adding results instead of
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_3 = (__pyx_v_context->_xsltCtxt != NULL);
    if (unlikely(!__pyx_t_3)) {
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_mstate_global->__pyx_kp_u_XSLT_context_not_initialised, 0, 0);
      __PYX_ERR(20, 99, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(20, 99, __pyx_L1_error)
  #endif

  /* "src/lxml/xsltext.pxi":105
 *         # use attributes added to extension element with <xsl:attribute>.
 * 
 *         if output_parent is not None:             # <<<<<<<<<<<<<<
 *             c_parent = _nonRoNodeOf(output_parent)
 *         else:
*/
  __pyx_t_3 = (__pyx_v_output_parent != Py_None);
  if (__pyx_t_3) {

    /* "src/lxml/xsltext.pxi":106
 * 
 *         if output_parent is not None:
 *             c_parent = _nonRoNodeOf(output_parent)             # <<<<<<<<<<<<<<
 *         else:
 *             c_parent = tree.xmlNewDocNode(
*/
    __pyx_t_2 = __pyx_f_4lxml_5etree__nonRoNodeOf(__pyx_v_output_parent); if (unlikely(__pyx_t_2 == ((void *)NULL))) __PYX_ERR(20, 106, __pyx_L1_error)
    __pyx_v_c_parent = __pyx_t_2;

    /* "src/lxml/xsltext.pxi":105
 *         # use attributes added to extension element with <xsl:attribute>.
 * 
 *         if output_parent is not None:             # <<<<<<<<<<<<<<
 *             c_parent = _nonRoNodeOf(output_parent)
 *         else:
*/
    goto __pyx_L3;
  }

  /* "src/lxml/xsltext.pxi":108
 *             c_parent = _nonRoNodeOf(output_parent)
 *         else:
 *             c_parent = tree.xmlNewDocNode(             # <<<<<<<<<<<<<<
 *                 context._xsltCtxt.output, NULL, <unsigned char*>"fake-parent", NULL)
 * 
*/
  /*else*/ {

    /* "src/lxml/xsltext.pxi":109
 *         else:
 *             c_parent = tree.xmlNewDocNode(
 *                 context._xsltCtxt.output, NULL, <unsigned char*>"fake-parent", NULL)             # <<<<<<<<<<<<<<
 * 
 *         c_ctxt.insert = c_parent
*/
    __pyx_v_c_parent = xmlNewDocNode(__pyx_v_context->_xsltCtxt->output, NULL, ((unsigned char *)((unsigned char *)((char *)"fake-parent"))), NULL);
  }
  __pyx_L3:;

  /* "src/lxml/xsltext.pxi":111
 *                 context._xsltCtxt.output, NULL, <unsigned char*>"fake-parent", NULL)
 * 
 *         c_ctxt.insert = c_parent             # <<<<<<<<<<<<<<
 *         xslt.xsltApplyOneTemplate(c_ctxt,
 *             c_ctxt.node, c_ctxt.inst.children, NULL, NULL)
*/
  __pyx_v_c_ctxt->insert = __pyx_v_c_parent;

  /* "src/lxml/xsltext.pxi":112
 * 
 *         c_ctxt.insert = c_parent
 *         xslt.xsltApplyOneTemplate(c_ctxt,             # <<<<<<<<<<<<<<
 *             c_ctxt.node, c_ctxt.inst.children, NULL, NULL)
 *         c_ctxt.insert = c_old_output_parent
*/
  xsltApplyOneTemplate(__pyx_v_c_ctxt, __pyx_v_c_ctxt->node, __pyx_v_c_ctxt->inst->children, NULL, NULL);

  /* "src/lxml/xsltext.pxi":114
 *         xslt.xsltApplyOneTemplate(c_ctxt,
 *             c_ctxt.node, c_ctxt.inst.children, NULL, NULL)
 *         c_ctxt.insert = c_old_output_parent             # <<<<<<<<<<<<<<
 * 
 *         if output_parent is not None:
*/
  __pyx_v_c_ctxt->insert = __pyx_v_c_old_output_parent;

  /* "src/lxml/xsltext.pxi":116
 *         c_ctxt.insert = c_old_output_parent
 * 
 *         if output_parent is not None:             # <<<<<<<<<<<<<<
 *             return None
 * 
*/
  __pyx_t_3 = (__pyx_v_output_parent != Py_None);
  if (__pyx_t_3) {

    /* "src/lxml/xsltext.pxi":117
 * 
 *         if output_parent is not None:
 *             return None             # <<<<<<<<<<<<<<
 * 
 *         try:
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/xsltext.pxi":116
 *         c_ctxt.insert = c_old_output_parent
 * 
 *         if output_parent is not None:             # <<<<<<<<<<<<<<
 *             return None
 * 
*/
  }

  /* "src/lxml/xsltext.pxi":119
 *             return None
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             return self._collectXSLTResultContent(
 *                 context, c_parent, elements_only, remove_blank_text)
*/
  /*try:*/ {

    /* "src/lxml/xsltext.pxi":120
 * 
 *         try:
 *             return self._collectXSLTResultContent(             # <<<<<<<<<<<<<<
 *                 context, c_parent, elements_only, remove_blank_text)
 *         finally:
*/
    __Pyx_XDECREF(__pyx_r);

    /* "src/lxml/xsltext.pxi":121
 *         try:
 *             return self._collectXSLTResultContent(
 *                 context, c_parent, elements_only, remove_blank_text)             # <<<<<<<<<<<<<<
 *         finally:
 *             # free all intermediate nodes that will not be freed by proxies
*/
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_elements_only); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(20, 121, __pyx_L6_error)
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_remove_blank_text); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(20, 121, __pyx_L6_error)

    /* "src/lxml/xsltext.pxi":120
 * 
 *         try:
 *             return self._collectXSLTResultContent(             # <<<<<<<<<<<<<<
 *                 context, c_parent, elements_only, remove_blank_text)
 *         finally:
*/
    __pyx_t_5 = ((struct __pyx_vtabstruct_4lxml_5etree_XSLTExtension *)__pyx_v_self->__pyx_vtab)->_collectXSLTResultContent(__pyx_v_self, __pyx_v_context, __pyx_v_c_parent, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(20, 120, __pyx_L6_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L5_return;
  }

  /* "src/lxml/xsltext.pxi":124
 *         finally:
 *             # free all intermediate nodes that will not be freed by proxies
 *             tree.xmlFreeNode(c_parent)             # <<<<<<<<<<<<<<
 * 
 *     cdef _collectXSLTResultContent(self, _XSLTContext context, xmlNode* c_parent,
*/
  /*finally:*/ {
    __pyx_L6_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
      if ( unlikely(__Pyx_GetException(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11) < 0)) __Pyx_ErrFetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_14);
      __pyx_t_6 = __pyx_lineno; __pyx_t_7 = __pyx_clineno; __pyx_t_8 = __pyx_filename;
      {
        xmlFreeNode(__pyx_v_c_parent);
      }
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_XGIVEREF(__pyx_t_14);
      __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_ErrRestore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
      __pyx_lineno = __pyx_t_6; __pyx_clineno = __pyx_t_7; __pyx_filename = __pyx_t_8;
      goto __pyx_L1_error;
    }
    __pyx_L5_return: {
      __pyx_t_14 = __pyx_r;
      __pyx_r = 0;
      xmlFreeNode(__pyx_v_c_parent);
      __pyx_r = __pyx_t_14;
      __pyx_t_14 = 0;
      goto __pyx_L0;
    }
  }

  /* "src/lxml/xsltext.pxi":74
 *             tree.xmlFreeNode(c_parent)
 * 
 *     def process_children(self, _XSLTContext context not None, output_parent=None,             # <<<<<<<<<<<<<<
 *                          *, elements_only=False, remove_blank_text=False):
 *         """process_children(self, context, output_parent=None, elements_only=False, remove_blank_text=False)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree.XSLTExtension.process_children", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xsltext.pxi":126
 *             tree.xmlFreeNode(c_parent)
 * 
 *     cdef _collectXSLTResultContent(self, _XSLTContext context, xmlNode* c_parent,             # <<<<<<<<<<<<<<
 *                                    bint elements_only, bint remove_blank_text):
 *         cdef xmlNode* c_node
*/

static PyObject *__pyx_f_4lxml_5etree_13XSLTExtension__collectXSLTResultContent(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree_XSLTExtension *__pyx_v_self, struct __pyx_obj_4lxml_5etree__XSLTContext *__pyx_v_context, xmlNode *__pyx_v_c_parent, int __pyx_v_elements_only, int __pyx_v_remove_blank_text) {
  xmlNode *__pyx_v_c_node;
  xmlNode *__pyx_v_c_next;
  struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_proxy = 0;
  PyObject *__pyx_v_results = 0;
  PyObject *__pyx_v_s = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  xmlNode *__pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_collectXSLTResultContent", 0);

  /* "src/lxml/xsltext.pxi":131
 *         cdef xmlNode* c_next
 *         cdef _ReadOnlyProxy proxy
 *         cdef list results = [] # or maybe _collectAttributes(c_parent, 2) ?             # <<<<<<<<<<<<<<
 *         c_node = c_parent.children
 *         while c_node is not NULL:
*/
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 131, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_results = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xsltext.pxi":132
 *         cdef _ReadOnlyProxy proxy
 *         cdef list results = [] # or maybe _collectAttributes(c_parent, 2) ?
 *         c_node = c_parent.children             # <<<<<<<<<<<<<<
 *         while c_node is not NULL:
 *             c_next = c_node.next
*/
  __pyx_t_2 = __pyx_v_c_parent->children;
  __pyx_v_c_node = __pyx_t_2;

  /* "src/lxml/xsltext.pxi":133
 *         cdef list results = [] # or maybe _collectAttributes(c_parent, 2) ?
 *         c_node = c_parent.children
 *         while c_node is not NULL:             # <<<<<<<<<<<<<<
 *             c_next = c_node.next
 *             if c_node.type == tree.XML_TEXT_NODE:
*/
  while (1) {
    __pyx_t_3 = (__pyx_v_c_node != NULL);
    if (!__pyx_t_3) break;

    /* "src/lxml/xsltext.pxi":134
 *         c_node = c_parent.children
 *         while c_node is not NULL:
 *             c_next = c_node.next             # <<<<<<<<<<<<<<
 *             if c_node.type == tree.XML_TEXT_NODE:
 *                 if not elements_only:
*/
    __pyx_t_2 = __pyx_v_c_node->next;
    __pyx_v_c_next = __pyx_t_2;

    /* "src/lxml/xsltext.pxi":135
 *         while c_node is not NULL:
 *             c_next = c_node.next
 *             if c_node.type == tree.XML_TEXT_NODE:             # <<<<<<<<<<<<<<
 *                 if not elements_only:
 *                     s = funicode(c_node.content)
*/
    switch (__pyx_v_c_node->type) {
      case XML_TEXT_NODE:

      /* "src/lxml/xsltext.pxi":136
 *             c_next = c_node.next
 *             if c_node.type == tree.XML_TEXT_NODE:
 *                 if not elements_only:             # <<<<<<<<<<<<<<
 *                     s = funicode(c_node.content)
 *                     if not remove_blank_text or s.strip():
*/
      __pyx_t_3 = (!__pyx_v_elements_only);
      if (__pyx_t_3) {

        /* "src/lxml/xsltext.pxi":137
 *             if c_node.type == tree.XML_TEXT_NODE:
 *                 if not elements_only:
 *                     s = funicode(c_node.content)             # <<<<<<<<<<<<<<
 *                     if not remove_blank_text or s.strip():
 *                         results.append(s)
*/
        __pyx_t_1 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_node->content); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 137, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_XDECREF_SET(__pyx_v_s, ((PyObject*)__pyx_t_1));
        __pyx_t_1 = 0;

        /* "src/lxml/xsltext.pxi":138
 *                 if not elements_only:
 *                     s = funicode(c_node.content)
 *                     if not remove_blank_text or s.strip():             # <<<<<<<<<<<<<<
 *                         results.append(s)
 *                     s = None
*/
        __pyx_t_4 = (!__pyx_v_remove_blank_text);
        if (!__pyx_t_4) {
        } else {
          __pyx_t_3 = __pyx_t_4;
          goto __pyx_L7_bool_binop_done;
        }
        __pyx_t_1 = __Pyx_CallUnboundCMethod0(&__pyx_mstate_global->__pyx_umethod_PyUnicode_Type__strip, __pyx_v_s); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 138, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        {
          Py_ssize_t __pyx_temp = __Pyx_PyUnicode_IS_TRUE(__pyx_t_1);
          if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(20, 138, __pyx_L1_error)
          __pyx_t_4 = (__pyx_temp != 0);
        }

        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_3 = __pyx_t_4;
        __pyx_L7_bool_binop_done:;
        if (__pyx_t_3) {

          /* "src/lxml/xsltext.pxi":139
 *                     s = funicode(c_node.content)
 *                     if not remove_blank_text or s.strip():
 *                         results.append(s)             # <<<<<<<<<<<<<<
 *                     s = None
 *             elif c_node.type == tree.XML_ELEMENT_NODE:
*/
          __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_results, __pyx_v_s); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(20, 139, __pyx_L1_error)

          /* "src/lxml/xsltext.pxi":138
 *                 if not elements_only:
 *                     s = funicode(c_node.content)
 *                     if not remove_blank_text or s.strip():             # <<<<<<<<<<<<<<
 *                         results.append(s)
 *                     s = None
*/
        }

        /* "src/lxml/xsltext.pxi":140
 *                     if not remove_blank_text or s.strip():
 *                         results.append(s)
 *                     s = None             # <<<<<<<<<<<<<<
 *             elif c_node.type == tree.XML_ELEMENT_NODE:
 *                 proxy = _newReadOnlyProxy(
*/
        __Pyx_INCREF(Py_None);
        __Pyx_DECREF_SET(__pyx_v_s, ((PyObject*)Py_None));

        /* "src/lxml/xsltext.pxi":136
 *             c_next = c_node.next
 *             if c_node.type == tree.XML_TEXT_NODE:
 *                 if not elements_only:             # <<<<<<<<<<<<<<
 *                     s = funicode(c_node.content)
 *                     if not remove_blank_text or s.strip():
*/
      }

      /* "src/lxml/xsltext.pxi":135
 *         while c_node is not NULL:
 *             c_next = c_node.next
 *             if c_node.type == tree.XML_TEXT_NODE:             # <<<<<<<<<<<<<<
 *                 if not elements_only:
 *                     s = funicode(c_node.content)
*/
      break;
      case XML_ELEMENT_NODE:

      /* "src/lxml/xsltext.pxi":143
 *             elif c_node.type == tree.XML_ELEMENT_NODE:
 *                 proxy = _newReadOnlyProxy(
 *                     context._extension_element_proxy, c_node)             # <<<<<<<<<<<<<<
 *                 results.append(proxy)
 *                 # unlink node and make sure it will be freed later on
*/
      __pyx_t_1 = ((PyObject *)__pyx_v_context->_extension_element_proxy);
      __Pyx_INCREF(__pyx_t_1);

      /* "src/lxml/xsltext.pxi":142
 *                     s = None
 *             elif c_node.type == tree.XML_ELEMENT_NODE:
 *                 proxy = _newReadOnlyProxy(             # <<<<<<<<<<<<<<
 *                     context._extension_element_proxy, c_node)
 *                 results.append(proxy)
*/
      __pyx_t_6 = ((PyObject *)__pyx_f_4lxml_5etree__newReadOnlyProxy(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_1), __pyx_v_c_node)); if (unlikely(!__pyx_t_6)) __PYX_ERR(20, 142, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF_SET(__pyx_v_proxy, ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_6));
      __pyx_t_6 = 0;

      /* "src/lxml/xsltext.pxi":144
 *                 proxy = _newReadOnlyProxy(
 *                     context._extension_element_proxy, c_node)
 *                 results.append(proxy)             # <<<<<<<<<<<<<<
 *                 # unlink node and make sure it will be freed later on
 *                 tree.xmlUnlinkNode(c_node)
*/
      __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_results, ((PyObject *)__pyx_v_proxy)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(20, 144, __pyx_L1_error)

      /* "src/lxml/xsltext.pxi":146
 *                 results.append(proxy)
 *                 # unlink node and make sure it will be freed later on
 *                 tree.xmlUnlinkNode(c_node)             # <<<<<<<<<<<<<<
 *                 proxy.free_after_use()
 *             else:
*/
      xmlUnlinkNode(__pyx_v_c_node);

      /* "src/lxml/xsltext.pxi":147
 *                 # unlink node and make sure it will be freed later on
 *                 tree.xmlUnlinkNode(c_node)
 *                 proxy.free_after_use()             # <<<<<<<<<<<<<<
 *             else:
 *                 raise TypeError, \
*/
      ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)__pyx_v_proxy->__pyx_vtab)->free_after_use(__pyx_v_proxy);

      /* "src/lxml/xsltext.pxi":141
 *                         results.append(s)
 *                     s = None
 *             elif c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *                 proxy = _newReadOnlyProxy(
 *                     context._extension_element_proxy, c_node)
*/
      break;
      default:

      /* "src/lxml/xsltext.pxi":150
 *             else:
 *                 raise TypeError, \
 *                     f"unsupported XSLT result type: {c_node.type}"             # <<<<<<<<<<<<<<
 *             c_node = c_next
 *         return results
*/
      __pyx_t_6 = __Pyx_PyUnicode_From_xmlElementType(__pyx_v_c_node->type, 0, ' ', 'd'); if (unlikely(!__pyx_t_6)) __PYX_ERR(20, 150, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_1 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_unsupported_XSLT_result_type, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 150, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_t_1, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_ERR(20, 149, __pyx_L1_error)
      break;
    }

    /* "src/lxml/xsltext.pxi":151
 *                 raise TypeError, \
 *                     f"unsupported XSLT result type: {c_node.type}"
 *             c_node = c_next             # <<<<<<<<<<<<<<
 *         return results
 * 
*/
    __pyx_v_c_node = __pyx_v_c_next;
  }

  /* "src/lxml/xsltext.pxi":152
 *                     f"unsupported XSLT result type: {c_node.type}"
 *             c_node = c_next
 *         return results             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_results);
  __pyx_r = __pyx_v_results;
  goto __pyx_L0;

  /* "src/lxml/xsltext.pxi":126
 *             tree.xmlFreeNode(c_parent)
 * 
 *     cdef _collectXSLTResultContent(self, _XSLTContext context, xmlNode* c_parent,             # <<<<<<<<<<<<<<
 *                                    bint elements_only, bint remove_blank_text):
 *         cdef xmlNode* c_node
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree.XSLTExtension._collectXSLTResultContent", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_proxy);
  __Pyx_XDECREF(__pyx_v_results);
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xsltext.pxi":155
 * 
 * 
 * cdef _registerXSLTExtensions(xslt.xsltTransformContext* c_ctxt,             # <<<<<<<<<<<<<<
 *                              extension_dict):
 *     for ns_utf, name_utf in extension_dict:
*/

static PyObject *__pyx_f_4lxml_5etree__registerXSLTExtensions(xsltTransformContext *__pyx_v_c_ctxt, PyObject *__pyx_v_extension_dict) {
  PyObject *__pyx_v_ns_utf = NULL;
  PyObject *__pyx_v_name_utf = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_registerXSLTExtensions", 0);

  /* "src/lxml/xsltext.pxi":157
 * cdef _registerXSLTExtensions(xslt.xsltTransformContext* c_ctxt,
 *                              extension_dict):
 *     for ns_utf, name_utf in extension_dict:             # <<<<<<<<<<<<<<
 *         xslt.xsltRegisterExtElement(
 *             c_ctxt, _xcstr(name_utf), _xcstr(ns_utf),
*/
  if (likely(PyList_CheckExact(__pyx_v_extension_dict)) || PyTuple_CheckExact(__pyx_v_extension_dict)) {
    __pyx_t_1 = __pyx_v_extension_dict; __Pyx_INCREF(__pyx_t_1);
    __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_extension_dict); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 157, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(20, 157, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(20, 157, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference);
        ++__pyx_t_2;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(20, 157, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2));
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2);
        #endif
        ++__pyx_t_2;
      }
      if (unlikely(!__pyx_t_4)) __PYX_ERR(20, 157, __pyx_L1_error)
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(20, 157, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_4);
    if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
      PyObject* sequence = __pyx_t_4;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(20, 157, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0);
        __Pyx_INCREF(__pyx_t_5);
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1);
        __Pyx_INCREF(__pyx_t_6);
      } else {
        __pyx_t_5 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_5)) __PYX_ERR(20, 157, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_5);
        __pyx_t_6 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_6)) __PYX_ERR(20, 157, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_6);
      }
      #else
      __pyx_t_5 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(20, 157, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(20, 157, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(20, 157, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7);
      index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < (0)) __PYX_ERR(20, 157, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L6_unpacking_done;
      __pyx_L5_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(20, 157, __pyx_L1_error)
      __pyx_L6_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_ns_utf, __pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_name_utf, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "src/lxml/xsltext.pxi":158
 *                              extension_dict):
 *     for ns_utf, name_utf in extension_dict:
 *         xslt.xsltRegisterExtElement(             # <<<<<<<<<<<<<<
 *             c_ctxt, _xcstr(name_utf), _xcstr(ns_utf),
 *             <xslt.xsltTransformFunction>_callExtensionElement)
*/
    (void)(xsltRegisterExtElement(__pyx_v_c_ctxt, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_name_utf), (const xmlChar*)PyBytes_AS_STRING(__pyx_v_ns_utf), ((xsltTransformFunction)__pyx_f_4lxml_5etree__callExtensionElement)));

    /* "src/lxml/xsltext.pxi":157
 * cdef _registerXSLTExtensions(xslt.xsltTransformContext* c_ctxt,
 *                              extension_dict):
 *     for ns_utf, name_utf in extension_dict:             # <<<<<<<<<<<<<<
 *         xslt.xsltRegisterExtElement(
 *             c_ctxt, _xcstr(name_utf), _xcstr(ns_utf),
*/
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xsltext.pxi":155
 * 
 * 
 * cdef _registerXSLTExtensions(xslt.xsltTransformContext* c_ctxt,             # <<<<<<<<<<<<<<
 *                              extension_dict):
 *     for ns_utf, name_utf in extension_dict:
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree._registerXSLTExtensions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ns_utf);
  __Pyx_XDECREF(__pyx_v_name_utf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xsltext.pxi":162
 *             <xslt.xsltTransformFunction>_callExtensionElement)
 * 
 * cdef void _callExtensionElement(xslt.xsltTransformContext* c_ctxt,             # <<<<<<<<<<<<<<
 *                                 xmlNode* c_context_node,
 *                                 xmlNode* c_inst_node,
*/

static void __pyx_f_4lxml_5etree__callExtensionElement(xsltTransformContext *__pyx_v_c_ctxt, xmlNode *__pyx_v_c_context_node, xmlNode *__pyx_v_c_inst_node, CYTHON_UNUSED void *__pyx_v_dummy) {
  struct __pyx_obj_4lxml_5etree__XSLTContext *__pyx_v_context = 0;
  struct __pyx_obj_4lxml_5etree_XSLTExtension *__pyx_v_extension = 0;
  PyObject *__pyx_v_dict_result;
  xmlNode *__pyx_v_c_node;
  struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_context_node = 0;
  struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self_node = 0;
  PyObject *__pyx_v_output_parent = 0;
  const xmlChar *__pyx_v_c_uri;
  PyObject *__pyx_v_e = NULL;
  PyObject *__pyx_v_message = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12[3];
  size_t __pyx_t_13;
  int __pyx_t_14;
  int __pyx_t_15;
  char const *__pyx_t_16;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  PyObject *__pyx_t_19 = NULL;
  PyObject *__pyx_t_20 = NULL;
  PyObject *__pyx_t_21 = NULL;
  PyObject *__pyx_t_22 = NULL;
  PyObject *__pyx_t_23 = NULL;
  PyObject *__pyx_t_24 = NULL;
  PyObject *__pyx_t_25 = NULL;
  PyObject *__pyx_t_26 = NULL;
  char *__pyx_t_27;
  char const *__pyx_t_28;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("_callExtensionElement", 0);

  /* "src/lxml/xsltext.pxi":170
 *     cdef python.PyObject* dict_result
 *     cdef xmlNode* c_node
 *     cdef _ReadOnlyProxy context_node = None, self_node = None             # <<<<<<<<<<<<<<
 *     cdef object output_parent # not restricted to ro-nodes
 *     c_uri = _getNs(c_inst_node)
*/
  __Pyx_INCREF(Py_None);
  __pyx_v_context_node = ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)Py_None);
  __Pyx_INCREF(Py_None);
  __pyx_v_self_node = ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)Py_None);

  /* "src/lxml/xsltext.pxi":172
 *     cdef _ReadOnlyProxy context_node = None, self_node = None
 *     cdef object output_parent # not restricted to ro-nodes
 *     c_uri = _getNs(c_inst_node)             # <<<<<<<<<<<<<<
 *     if c_uri is NULL:
 *         # not allowed, and should never happen
*/
  __pyx_v_c_uri = _getNs(__pyx_v_c_inst_node);

  /* "src/lxml/xsltext.pxi":173
 *     cdef object output_parent # not restricted to ro-nodes
 *     c_uri = _getNs(c_inst_node)
 *     if c_uri is NULL:             # <<<<<<<<<<<<<<
 *         # not allowed, and should never happen
 *         return
*/
  __pyx_t_1 = (__pyx_v_c_uri == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/xsltext.pxi":175
 *     if c_uri is NULL:
 *         # not allowed, and should never happen
 *         return             # <<<<<<<<<<<<<<
 *     if c_ctxt.xpathCtxt.userData is NULL:
 *         # just for safety, should never happen
*/
    goto __pyx_L0;

    /* "src/lxml/xsltext.pxi":173
 *     cdef object output_parent # not restricted to ro-nodes
 *     c_uri = _getNs(c_inst_node)
 *     if c_uri is NULL:             # <<<<<<<<<<<<<<
 *         # not allowed, and should never happen
 *         return
*/
  }

  /* "src/lxml/xsltext.pxi":176
 *         # not allowed, and should never happen
 *         return
 *     if c_ctxt.xpathCtxt.userData is NULL:             # <<<<<<<<<<<<<<
 *         # just for safety, should never happen
 *         return
*/
  __pyx_t_1 = (__pyx_v_c_ctxt->xpathCtxt->userData == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/xsltext.pxi":178
 *     if c_ctxt.xpathCtxt.userData is NULL:
 *         # just for safety, should never happen
 *         return             # <<<<<<<<<<<<<<
 *     context = <_XSLTContext>c_ctxt.xpathCtxt.userData
 *     try:
*/
    goto __pyx_L0;

    /* "src/lxml/xsltext.pxi":176
 *         # not allowed, and should never happen
 *         return
 *     if c_ctxt.xpathCtxt.userData is NULL:             # <<<<<<<<<<<<<<
 *         # just for safety, should never happen
 *         return
*/
  }

  /* "src/lxml/xsltext.pxi":179
 *         # just for safety, should never happen
 *         return
 *     context = <_XSLTContext>c_ctxt.xpathCtxt.userData             # <<<<<<<<<<<<<<
 *     try:
 *         try:
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_c_ctxt->xpathCtxt->userData);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__XSLTContext *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/xsltext.pxi":180
 *         return
 *     context = <_XSLTContext>c_ctxt.xpathCtxt.userData
 *     try:             # <<<<<<<<<<<<<<
 *         try:
 *             dict_result = python.PyDict_GetItem(
*/
  /*try:*/ {
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_5);
      /*try:*/ {

        /* "src/lxml/xsltext.pxi":181
 *     context = <_XSLTContext>c_ctxt.xpathCtxt.userData
 *     try:
 *         try:             # <<<<<<<<<<<<<<
 *             dict_result = python.PyDict_GetItem(
 *                 context._extension_elements, (c_uri, c_inst_node.name))
*/
        {
          __Pyx_PyThreadState_declare
          __Pyx_PyThreadState_assign
          __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
          __Pyx_XGOTREF(__pyx_t_6);
          __Pyx_XGOTREF(__pyx_t_7);
          __Pyx_XGOTREF(__pyx_t_8);
          /*try:*/ {

            /* "src/lxml/xsltext.pxi":183
 *         try:
 *             dict_result = python.PyDict_GetItem(
 *                 context._extension_elements, (c_uri, c_inst_node.name))             # <<<<<<<<<<<<<<
 *             if dict_result is NULL:
 *                 raise KeyError, f"extension element {funicode(c_inst_node.name)} not found"
*/
            __pyx_t_2 = __pyx_v_context->_extension_elements;
            __Pyx_INCREF(__pyx_t_2);
            __pyx_t_9 = __Pyx_PyBytes_FromCString(__pyx_v_c_uri); if (unlikely(!__pyx_t_9)) __PYX_ERR(20, 183, __pyx_L14_error)
            __Pyx_GOTREF(__pyx_t_9);
            __pyx_t_10 = __Pyx_PyBytes_FromCString(__pyx_v_c_inst_node->name); if (unlikely(!__pyx_t_10)) __PYX_ERR(20, 183, __pyx_L14_error)
            __Pyx_GOTREF(__pyx_t_10);
            __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(20, 183, __pyx_L14_error)
            __Pyx_GOTREF(__pyx_t_11);
            __Pyx_GIVEREF(__pyx_t_9);
            if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9) != (0)) __PYX_ERR(20, 183, __pyx_L14_error);
            __Pyx_GIVEREF(__pyx_t_10);
            if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_10) != (0)) __PYX_ERR(20, 183, __pyx_L14_error);
            __pyx_t_9 = 0;
            __pyx_t_10 = 0;

            /* "src/lxml/xsltext.pxi":182
 *     try:
 *         try:
 *             dict_result = python.PyDict_GetItem(             # <<<<<<<<<<<<<<
 *                 context._extension_elements, (c_uri, c_inst_node.name))
 *             if dict_result is NULL:
*/
            __pyx_v_dict_result = PyDict_GetItem(__pyx_t_2, __pyx_t_11);
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

            /* "src/lxml/xsltext.pxi":184
 *             dict_result = python.PyDict_GetItem(
 *                 context._extension_elements, (c_uri, c_inst_node.name))
 *             if dict_result is NULL:             # <<<<<<<<<<<<<<
 *                 raise KeyError, f"extension element {funicode(c_inst_node.name)} not found"
 *             extension = <object>dict_result
*/
            __pyx_t_1 = (__pyx_v_dict_result == NULL);
            if (unlikely(__pyx_t_1)) {

              /* "src/lxml/xsltext.pxi":185
 *                 context._extension_elements, (c_uri, c_inst_node.name))
 *             if dict_result is NULL:
 *                 raise KeyError, f"extension element {funicode(c_inst_node.name)} not found"             # <<<<<<<<<<<<<<
 *             extension = <object>dict_result
 * 
*/
              __pyx_t_11 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_inst_node->name); if (unlikely(!__pyx_t_11)) __PYX_ERR(20, 185, __pyx_L14_error)
              __Pyx_GOTREF(__pyx_t_11);
              __pyx_t_2 = __Pyx_PyUnicode_Unicode(__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(20, 185, __pyx_L14_error)
              __Pyx_GOTREF(__pyx_t_2);
              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
              __pyx_t_12[0] = __pyx_mstate_global->__pyx_kp_u_extension_element;
              __pyx_t_12[1] = __pyx_t_2;
              __pyx_t_12[2] = __pyx_mstate_global->__pyx_kp_u_not_found_2;
              __pyx_t_11 = __Pyx_PyUnicode_Join(__pyx_t_12, 3, 18 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 10, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2));
              if (unlikely(!__pyx_t_11)) __PYX_ERR(20, 185, __pyx_L14_error)
              __Pyx_GOTREF(__pyx_t_11);
              __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
              __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_KeyError))), __pyx_t_11, 0, 0);
              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
              __PYX_ERR(20, 185, __pyx_L14_error)

              /* "src/lxml/xsltext.pxi":184
 *             dict_result = python.PyDict_GetItem(
 *                 context._extension_elements, (c_uri, c_inst_node.name))
 *             if dict_result is NULL:             # <<<<<<<<<<<<<<
 *                 raise KeyError, f"extension element {funicode(c_inst_node.name)} not found"
 *             extension = <object>dict_result
*/
            }

            /* "src/lxml/xsltext.pxi":186
 *             if dict_result is NULL:
 *                 raise KeyError, f"extension element {funicode(c_inst_node.name)} not found"
 *             extension = <object>dict_result             # <<<<<<<<<<<<<<
 * 
 *             try:
*/
            __pyx_t_11 = ((PyObject *)__pyx_v_dict_result);
            __Pyx_INCREF(__pyx_t_11);
            if (!(likely(((__pyx_t_11) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_11, __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XSLTExtension))))) __PYX_ERR(20, 186, __pyx_L14_error)
            __pyx_v_extension = ((struct __pyx_obj_4lxml_5etree_XSLTExtension *)__pyx_t_11);
            __pyx_t_11 = 0;

            /* "src/lxml/xsltext.pxi":188
 *             extension = <object>dict_result
 * 
 *             try:             # <<<<<<<<<<<<<<
 *                 # build the context proxy nodes
 *                 self_node = _newReadOnlyProxy(None, c_inst_node)
*/
            /*try:*/ {

              /* "src/lxml/xsltext.pxi":190
 *             try:
 *                 # build the context proxy nodes
 *                 self_node = _newReadOnlyProxy(None, c_inst_node)             # <<<<<<<<<<<<<<
 *                 if _isElement(c_ctxt.insert):
 *                     output_parent = _newAppendOnlyProxy(self_node, c_ctxt.insert)
*/
              __pyx_t_11 = ((PyObject *)__pyx_f_4lxml_5etree__newReadOnlyProxy(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)Py_None), __pyx_v_c_inst_node)); if (unlikely(!__pyx_t_11)) __PYX_ERR(20, 190, __pyx_L22_error)
              __Pyx_GOTREF(__pyx_t_11);
              __Pyx_DECREF_SET(__pyx_v_self_node, ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_11));
              __pyx_t_11 = 0;

              /* "src/lxml/xsltext.pxi":191
 *                 # build the context proxy nodes
 *                 self_node = _newReadOnlyProxy(None, c_inst_node)
 *                 if _isElement(c_ctxt.insert):             # <<<<<<<<<<<<<<
 *                     output_parent = _newAppendOnlyProxy(self_node, c_ctxt.insert)
 *                 else:
*/
              __pyx_t_1 = _isElement(__pyx_v_c_ctxt->insert);
              if (__pyx_t_1) {

                /* "src/lxml/xsltext.pxi":192
 *                 self_node = _newReadOnlyProxy(None, c_inst_node)
 *                 if _isElement(c_ctxt.insert):
 *                     output_parent = _newAppendOnlyProxy(self_node, c_ctxt.insert)             # <<<<<<<<<<<<<<
 *                 else:
 *                     # may be the document node or other stuff
*/
                __pyx_t_11 = ((PyObject *)__pyx_f_4lxml_5etree__newAppendOnlyProxy(__pyx_v_self_node, __pyx_v_c_ctxt->insert)); if (unlikely(!__pyx_t_11)) __PYX_ERR(20, 192, __pyx_L22_error)
                __Pyx_GOTREF(__pyx_t_11);
                __pyx_v_output_parent = __pyx_t_11;
                __pyx_t_11 = 0;

                /* "src/lxml/xsltext.pxi":191
 *                 # build the context proxy nodes
 *                 self_node = _newReadOnlyProxy(None, c_inst_node)
 *                 if _isElement(c_ctxt.insert):             # <<<<<<<<<<<<<<
 *                     output_parent = _newAppendOnlyProxy(self_node, c_ctxt.insert)
 *                 else:
*/
                goto __pyx_L24;
              }

              /* "src/lxml/xsltext.pxi":195
 *                 else:
 *                     # may be the document node or other stuff
 *                     output_parent = _newOpaqueAppendOnlyNodeWrapper(c_ctxt.insert)             # <<<<<<<<<<<<<<
 *                 if c_context_node.type in (tree.XML_DOCUMENT_NODE,
 *                                            tree.XML_HTML_DOCUMENT_NODE):
*/
              /*else*/ {
                __pyx_t_11 = ((PyObject *)__pyx_f_4lxml_5etree__newOpaqueAppendOnlyNodeWrapper(__pyx_v_c_ctxt->insert)); if (unlikely(!__pyx_t_11)) __PYX_ERR(20, 195, __pyx_L22_error)
                __Pyx_GOTREF(__pyx_t_11);
                __pyx_v_output_parent = __pyx_t_11;
                __pyx_t_11 = 0;
              }
              __pyx_L24:;

              /* "src/lxml/xsltext.pxi":196
 *                     # may be the document node or other stuff
 *                     output_parent = _newOpaqueAppendOnlyNodeWrapper(c_ctxt.insert)
 *                 if c_context_node.type in (tree.XML_DOCUMENT_NODE,             # <<<<<<<<<<<<<<
 *                                            tree.XML_HTML_DOCUMENT_NODE):
 *                     c_node = tree.xmlDocGetRootElement(<xmlDoc*>c_context_node)
*/
              switch (__pyx_v_c_context_node->type) {
                case XML_DOCUMENT_NODE:
                case XML_HTML_DOCUMENT_NODE:

                /* "src/lxml/xsltext.pxi":198
 *                 if c_context_node.type in (tree.XML_DOCUMENT_NODE,
 *                                            tree.XML_HTML_DOCUMENT_NODE):
 *                     c_node = tree.xmlDocGetRootElement(<xmlDoc*>c_context_node)             # <<<<<<<<<<<<<<
 *                     if c_node is not NULL:
 *                         context_node = _newReadOnlyProxy(self_node, c_node)
*/
                __pyx_v_c_node = xmlDocGetRootElement(((xmlDoc *)__pyx_v_c_context_node));

                /* "src/lxml/xsltext.pxi":199
 *                                            tree.XML_HTML_DOCUMENT_NODE):
 *                     c_node = tree.xmlDocGetRootElement(<xmlDoc*>c_context_node)
 *                     if c_node is not NULL:             # <<<<<<<<<<<<<<
 *                         context_node = _newReadOnlyProxy(self_node, c_node)
 *                     else:
*/
                __pyx_t_1 = (__pyx_v_c_node != NULL);
                if (__pyx_t_1) {

                  /* "src/lxml/xsltext.pxi":200
 *                     c_node = tree.xmlDocGetRootElement(<xmlDoc*>c_context_node)
 *                     if c_node is not NULL:
 *                         context_node = _newReadOnlyProxy(self_node, c_node)             # <<<<<<<<<<<<<<
 *                     else:
 *                         context_node = None
*/
                  __pyx_t_11 = ((PyObject *)__pyx_f_4lxml_5etree__newReadOnlyProxy(__pyx_v_self_node, __pyx_v_c_node)); if (unlikely(!__pyx_t_11)) __PYX_ERR(20, 200, __pyx_L22_error)
                  __Pyx_GOTREF(__pyx_t_11);
                  __Pyx_DECREF_SET(__pyx_v_context_node, ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_11));
                  __pyx_t_11 = 0;

                  /* "src/lxml/xsltext.pxi":199
 *                                            tree.XML_HTML_DOCUMENT_NODE):
 *                     c_node = tree.xmlDocGetRootElement(<xmlDoc*>c_context_node)
 *                     if c_node is not NULL:             # <<<<<<<<<<<<<<
 *                         context_node = _newReadOnlyProxy(self_node, c_node)
 *                     else:
*/
                  goto __pyx_L25;
                }

                /* "src/lxml/xsltext.pxi":202
 *                         context_node = _newReadOnlyProxy(self_node, c_node)
 *                     else:
 *                         context_node = None             # <<<<<<<<<<<<<<
 *                 elif c_context_node.type in (tree.XML_ATTRIBUTE_NODE,
 *                                              tree.XML_TEXT_NODE,
*/
                /*else*/ {
                  __Pyx_INCREF(Py_None);
                  __Pyx_DECREF_SET(__pyx_v_context_node, ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)Py_None));
                }
                __pyx_L25:;

                /* "src/lxml/xsltext.pxi":196
 *                     # may be the document node or other stuff
 *                     output_parent = _newOpaqueAppendOnlyNodeWrapper(c_ctxt.insert)
 *                 if c_context_node.type in (tree.XML_DOCUMENT_NODE,             # <<<<<<<<<<<<<<
 *                                            tree.XML_HTML_DOCUMENT_NODE):
 *                     c_node = tree.xmlDocGetRootElement(<xmlDoc*>c_context_node)
*/
                break;
                case XML_ATTRIBUTE_NODE:

                /* "src/lxml/xsltext.pxi":203
 *                     else:
 *                         context_node = None
 *                 elif c_context_node.type in (tree.XML_ATTRIBUTE_NODE,             # <<<<<<<<<<<<<<
 *                                              tree.XML_TEXT_NODE,
 *                                              tree.XML_CDATA_SECTION_NODE):
*/
                case XML_TEXT_NODE:

                /* "src/lxml/xsltext.pxi":204
 *                         context_node = None
 *                 elif c_context_node.type in (tree.XML_ATTRIBUTE_NODE,
 *                                              tree.XML_TEXT_NODE,             # <<<<<<<<<<<<<<
 *                                              tree.XML_CDATA_SECTION_NODE):
 *                     # this isn't easy to support using read-only
*/
                case XML_CDATA_SECTION_NODE:

                /* "src/lxml/xsltext.pxi":209
 *                     # nodes, as the smart-string factory must
 *                     # instantiate the parent proxy somehow...
 *                     raise TypeError(f"Unsupported element type: {c_context_node.type}")             # <<<<<<<<<<<<<<
 *                 else:
 *                     context_node  = _newReadOnlyProxy(self_node, c_context_node)
*/
                __pyx_t_2 = NULL;
                __pyx_t_10 = __Pyx_PyUnicode_From_xmlElementType(__pyx_v_c_context_node->type, 0, ' ', 'd'); if (unlikely(!__pyx_t_10)) __PYX_ERR(20, 209, __pyx_L22_error)
                __Pyx_GOTREF(__pyx_t_10);
                __pyx_t_9 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_Unsupported_element_type, __pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(20, 209, __pyx_L22_error)
                __Pyx_GOTREF(__pyx_t_9);
                __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
                __pyx_t_13 = 1;
                {
                  PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_9};
                  __pyx_t_11 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __pyx_callargs+__pyx_t_13, (2-__pyx_t_13) | (__pyx_t_13*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
                  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
                  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
                  if (unlikely(!__pyx_t_11)) __PYX_ERR(20, 209, __pyx_L22_error)
                  __Pyx_GOTREF(__pyx_t_11);
                }
                __Pyx_Raise(__pyx_t_11, 0, 0, 0);
                __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
                __PYX_ERR(20, 209, __pyx_L22_error)

                /* "src/lxml/xsltext.pxi":203
 *                     else:
 *                         context_node = None
 *                 elif c_context_node.type in (tree.XML_ATTRIBUTE_NODE,             # <<<<<<<<<<<<<<
 *                                              tree.XML_TEXT_NODE,
 *                                              tree.XML_CDATA_SECTION_NODE):
*/
                break;
                default:

                /* "src/lxml/xsltext.pxi":211
 *                     raise TypeError(f"Unsupported element type: {c_context_node.type}")
 *                 else:
 *                     context_node  = _newReadOnlyProxy(self_node, c_context_node)             # <<<<<<<<<<<<<<
 * 
 *                 # run the XSLT extension
*/
                __pyx_t_11 = ((PyObject *)__pyx_f_4lxml_5etree__newReadOnlyProxy(__pyx_v_self_node, __pyx_v_c_context_node)); if (unlikely(!__pyx_t_11)) __PYX_ERR(20, 211, __pyx_L22_error)
                __Pyx_GOTREF(__pyx_t_11);
                __Pyx_DECREF_SET(__pyx_v_context_node, ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_11));
                __pyx_t_11 = 0;
                break;
              }

              /* "src/lxml/xsltext.pxi":214
 * 
 *                 # run the XSLT extension
 *                 context._extension_element_proxy = self_node             # <<<<<<<<<<<<<<
 *                 extension.execute(context, self_node, context_node, output_parent)
 *             finally:
*/
              __pyx_t_11 = ((PyObject *)__pyx_v_self_node);
              __Pyx_INCREF(__pyx_t_11);
              if (!(likely(((__pyx_t_11) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_11, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ReadOnlyElementProxy))))) __PYX_ERR(20, 214, __pyx_L22_error)
              __Pyx_GIVEREF((PyObject *)__pyx_t_11);
              __Pyx_GOTREF((PyObject *)__pyx_v_context->_extension_element_proxy);
              __Pyx_DECREF((PyObject *)__pyx_v_context->_extension_element_proxy);
              __pyx_v_context->_extension_element_proxy = ((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_t_11);
              __pyx_t_11 = 0;

              /* "src/lxml/xsltext.pxi":215
 *                 # run the XSLT extension
 *                 context._extension_element_proxy = self_node
 *                 extension.execute(context, self_node, context_node, output_parent)             # <<<<<<<<<<<<<<
 *             finally:
 *                 context._extension_element_proxy = None
*/
              __pyx_t_9 = ((PyObject *)__pyx_v_extension);
              __Pyx_INCREF(__pyx_t_9);
              __pyx_t_13 = 0;
              {
                PyObject *__pyx_callargs[5] = {__pyx_t_9, ((PyObject *)__pyx_v_context), ((PyObject *)__pyx_v_self_node), ((PyObject *)__pyx_v_context_node), __pyx_v_output_parent};
                __pyx_t_11 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_execute, __pyx_callargs+__pyx_t_13, (5-__pyx_t_13) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
                __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
                if (unlikely(!__pyx_t_11)) __PYX_ERR(20, 215, __pyx_L22_error)
                __Pyx_GOTREF(__pyx_t_11);
              }
              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
            }

            /* "src/lxml/xsltext.pxi":217
 *                 extension.execute(context, self_node, context_node, output_parent)
 *             finally:
 *                 context._extension_element_proxy = None             # <<<<<<<<<<<<<<
 *                 if self_node is not None:
 *                     _freeReadOnlyProxies(self_node)
*/
            /*finally:*/ {
              /*normal exit:*/{
                __Pyx_INCREF(Py_None);
                __Pyx_GIVEREF(Py_None);
                __Pyx_GOTREF((PyObject *)__pyx_v_context->_extension_element_proxy);
                __Pyx_DECREF((PyObject *)__pyx_v_context->_extension_element_proxy);
                __pyx_v_context->_extension_element_proxy = ((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)Py_None);

                /* "src/lxml/xsltext.pxi":218
 *             finally:
 *                 context._extension_element_proxy = None
 *                 if self_node is not None:             # <<<<<<<<<<<<<<
 *                     _freeReadOnlyProxies(self_node)
 *         except Exception as e:
*/
                __pyx_t_1 = (((PyObject *)__pyx_v_self_node) != Py_None);
                if (__pyx_t_1) {

                  /* "src/lxml/xsltext.pxi":219
 *                 context._extension_element_proxy = None
 *                 if self_node is not None:
 *                     _freeReadOnlyProxies(self_node)             # <<<<<<<<<<<<<<
 *         except Exception as e:
 *             try:
*/
                  __pyx_t_11 = __pyx_f_4lxml_5etree__freeReadOnlyProxies(__pyx_v_self_node); if (unlikely(!__pyx_t_11)) __PYX_ERR(20, 219, __pyx_L14_error)
                  __Pyx_GOTREF(__pyx_t_11);
                  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

                  /* "src/lxml/xsltext.pxi":218
 *             finally:
 *                 context._extension_element_proxy = None
 *                 if self_node is not None:             # <<<<<<<<<<<<<<
 *                     _freeReadOnlyProxies(self_node)
 *         except Exception as e:
*/
                }
                goto __pyx_L23;
              }
              __pyx_L22_error:;
              /*exception exit:*/{
                __Pyx_PyThreadState_declare
                __Pyx_PyThreadState_assign
                __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0;
                __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
                __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
                __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
                __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
                 __Pyx_ExceptionSwap(&__pyx_t_20, &__pyx_t_21, &__pyx_t_22);
                if ( unlikely(__Pyx_GetException(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19) < 0)) __Pyx_ErrFetch(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19);
                __Pyx_XGOTREF(__pyx_t_17);
                __Pyx_XGOTREF(__pyx_t_18);
                __Pyx_XGOTREF(__pyx_t_19);
                __Pyx_XGOTREF(__pyx_t_20);
                __Pyx_XGOTREF(__pyx_t_21);
                __Pyx_XGOTREF(__pyx_t_22);
                __pyx_t_14 = __pyx_lineno; __pyx_t_15 = __pyx_clineno; __pyx_t_16 = __pyx_filename;
                {

                  /* "src/lxml/xsltext.pxi":217
 *                 extension.execute(context, self_node, context_node, output_parent)
 *             finally:
 *                 context._extension_element_proxy = None             # <<<<<<<<<<<<<<
 *                 if self_node is not None:
 *                     _freeReadOnlyProxies(self_node)
*/
                  __Pyx_INCREF(Py_None);
                  __Pyx_GIVEREF(Py_None);
                  __Pyx_GOTREF((PyObject *)__pyx_v_context->_extension_element_proxy);
                  __Pyx_DECREF((PyObject *)__pyx_v_context->_extension_element_proxy);
                  __pyx_v_context->_extension_element_proxy = ((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)Py_None);

                  /* "src/lxml/xsltext.pxi":218
 *             finally:
 *                 context._extension_element_proxy = None
 *                 if self_node is not None:             # <<<<<<<<<<<<<<
 *                     _freeReadOnlyProxies(self_node)
 *         except Exception as e:
*/
                  __pyx_t_1 = (((PyObject *)__pyx_v_self_node) != Py_None);
                  if (__pyx_t_1) {

                    /* "src/lxml/xsltext.pxi":219
 *                 context._extension_element_proxy = None
 *                 if self_node is not None:
 *                     _freeReadOnlyProxies(self_node)             # <<<<<<<<<<<<<<
 *         except Exception as e:
 *             try:
*/
                    __pyx_t_11 = __pyx_f_4lxml_5etree__freeReadOnlyProxies(__pyx_v_self_node); if (unlikely(!__pyx_t_11)) __PYX_ERR(20, 219, __pyx_L28_error)
                    __Pyx_GOTREF(__pyx_t_11);
                    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

                    /* "src/lxml/xsltext.pxi":218
 *             finally:
 *                 context._extension_element_proxy = None
 *                 if self_node is not None:             # <<<<<<<<<<<<<<
 *                     _freeReadOnlyProxies(self_node)
 *         except Exception as e:
*/
                  }
                }
                __Pyx_XGIVEREF(__pyx_t_20);
                __Pyx_XGIVEREF(__pyx_t_21);
                __Pyx_XGIVEREF(__pyx_t_22);
                __Pyx_ExceptionReset(__pyx_t_20, __pyx_t_21, __pyx_t_22);
                __Pyx_XGIVEREF(__pyx_t_17);
                __Pyx_XGIVEREF(__pyx_t_18);
                __Pyx_XGIVEREF(__pyx_t_19);
                __Pyx_ErrRestore(__pyx_t_17, __pyx_t_18, __pyx_t_19);
                __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0;
                __pyx_lineno = __pyx_t_14; __pyx_clineno = __pyx_t_15; __pyx_filename = __pyx_t_16;
                goto __pyx_L14_error;
                __pyx_L28_error:;
                __Pyx_XGIVEREF(__pyx_t_20);
                __Pyx_XGIVEREF(__pyx_t_21);
                __Pyx_XGIVEREF(__pyx_t_22);
                __Pyx_ExceptionReset(__pyx_t_20, __pyx_t_21, __pyx_t_22);
                __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
                __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
                __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
                __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0;
                goto __pyx_L14_error;
              }
              __pyx_L23:;
            }

            /* "src/lxml/xsltext.pxi":181
 *     context = <_XSLTContext>c_ctxt.xpathCtxt.userData
 *     try:
 *         try:             # <<<<<<<<<<<<<<
 *             dict_result = python.PyDict_GetItem(
 *                 context._extension_elements, (c_uri, c_inst_node.name))
*/
          }
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          goto __pyx_L19_try_end;
          __pyx_L14_error:;
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

          /* "src/lxml/xsltext.pxi":220
 *                 if self_node is not None:
 *                     _freeReadOnlyProxies(self_node)
 *         except Exception as e:             # <<<<<<<<<<<<<<
 *             try:
 *                 e = unicode(e).encode("UTF-8")
*/
          __pyx_t_15 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception))));
          if (__pyx_t_15) {
            __Pyx_AddTraceback("lxml.etree._callExtensionElement", __pyx_clineno, __pyx_lineno, __pyx_filename);
            if (__Pyx_GetException(&__pyx_t_11, &__pyx_t_9, &__pyx_t_2) < 0) __PYX_ERR(20, 220, __pyx_L16_except_error)
            __Pyx_XGOTREF(__pyx_t_11);
            __Pyx_XGOTREF(__pyx_t_9);
            __Pyx_XGOTREF(__pyx_t_2);
            __Pyx_INCREF(__pyx_t_9);
            __pyx_v_e = __pyx_t_9;
            /*try:*/ {

              /* "src/lxml/xsltext.pxi":221
 *                     _freeReadOnlyProxies(self_node)
 *         except Exception as e:
 *             try:             # <<<<<<<<<<<<<<
 *                 e = unicode(e).encode("UTF-8")
 *             except:
*/
              {
                __Pyx_PyThreadState_declare
                __Pyx_PyThreadState_assign
                __Pyx_ExceptionSave(&__pyx_t_22, &__pyx_t_21, &__pyx_t_20);
                __Pyx_XGOTREF(__pyx_t_22);
                __Pyx_XGOTREF(__pyx_t_21);
                __Pyx_XGOTREF(__pyx_t_20);
                /*try:*/ {

                  /* "src/lxml/xsltext.pxi":222
 *         except Exception as e:
 *             try:
 *                 e = unicode(e).encode("UTF-8")             # <<<<<<<<<<<<<<
 *             except:
 *                 e = repr(e).encode("UTF-8")
*/
                  __pyx_t_10 = __Pyx_PyObject_Unicode(__pyx_v_e); if (unlikely(!__pyx_t_10)) __PYX_ERR(20, 222, __pyx_L37_error)
                  __Pyx_GOTREF(__pyx_t_10);
                  __pyx_t_23 = PyUnicode_AsUTF8String(((PyObject*)__pyx_t_10)); if (unlikely(!__pyx_t_23)) __PYX_ERR(20, 222, __pyx_L37_error)
                  __Pyx_GOTREF(__pyx_t_23);
                  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
                  __Pyx_DECREF_SET(__pyx_v_e, __pyx_t_23);
                  __pyx_t_23 = 0;

                  /* "src/lxml/xsltext.pxi":221
 *                     _freeReadOnlyProxies(self_node)
 *         except Exception as e:
 *             try:             # <<<<<<<<<<<<<<
 *                 e = unicode(e).encode("UTF-8")
 *             except:
*/
                }
                __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
                __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
                __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
                goto __pyx_L44_try_end;
                __pyx_L37_error:;
                __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
                __Pyx_XDECREF(__pyx_t_23); __pyx_t_23 = 0;

                /* "src/lxml/xsltext.pxi":223
 *             try:
 *                 e = unicode(e).encode("UTF-8")
 *             except:             # <<<<<<<<<<<<<<
 *                 e = repr(e).encode("UTF-8")
 *             message = python.PyBytes_FromFormat(
*/
                /*except:*/ {
                  __Pyx_AddTraceback("lxml.etree._callExtensionElement", __pyx_clineno, __pyx_lineno, __pyx_filename);
                  if (__Pyx_GetException(&__pyx_t_23, &__pyx_t_10, &__pyx_t_24) < 0) __PYX_ERR(20, 223, __pyx_L39_except_error)
                  __Pyx_XGOTREF(__pyx_t_23);
                  __Pyx_XGOTREF(__pyx_t_10);
                  __Pyx_XGOTREF(__pyx_t_24);

                  /* "src/lxml/xsltext.pxi":224
 *                 e = unicode(e).encode("UTF-8")
 *             except:
 *                 e = repr(e).encode("UTF-8")             # <<<<<<<<<<<<<<
 *             message = python.PyBytes_FromFormat(
 *                 "Error executing extension element '%s': %s",
*/
                  __pyx_t_25 = PyObject_Repr(__pyx_v_e); if (unlikely(!__pyx_t_25)) __PYX_ERR(20, 224, __pyx_L39_except_error)
                  __Pyx_GOTREF(__pyx_t_25);
                  if (unlikely(__pyx_t_25 == Py_None)) {
                    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode");
                    __PYX_ERR(20, 224, __pyx_L39_except_error)
                  }
                  __pyx_t_26 = PyUnicode_AsUTF8String(((PyObject*)__pyx_t_25)); if (unlikely(!__pyx_t_26)) __PYX_ERR(20, 224, __pyx_L39_except_error)
                  __Pyx_GOTREF(__pyx_t_26);
                  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
                  __Pyx_DECREF_SET(__pyx_v_e, __pyx_t_26);
                  __pyx_t_26 = 0;
                  __Pyx_XDECREF(__pyx_t_23); __pyx_t_23 = 0;
                  __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
                  __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0;
                  goto __pyx_L38_exception_handled;
                }

                /* "src/lxml/xsltext.pxi":221
 *                     _freeReadOnlyProxies(self_node)
 *         except Exception as e:
 *             try:             # <<<<<<<<<<<<<<
 *                 e = unicode(e).encode("UTF-8")
 *             except:
*/
                __pyx_L39_except_error:;
                __Pyx_XGIVEREF(__pyx_t_22);
                __Pyx_XGIVEREF(__pyx_t_21);
                __Pyx_XGIVEREF(__pyx_t_20);
                __Pyx_ExceptionReset(__pyx_t_22, __pyx_t_21, __pyx_t_20);
                goto __pyx_L35_error;
                __pyx_L38_exception_handled:;
                __Pyx_XGIVEREF(__pyx_t_22);
                __Pyx_XGIVEREF(__pyx_t_21);
                __Pyx_XGIVEREF(__pyx_t_20);
                __Pyx_ExceptionReset(__pyx_t_22, __pyx_t_21, __pyx_t_20);
                __pyx_L44_try_end:;
              }

              /* "src/lxml/xsltext.pxi":225
 *             except:
 *                 e = repr(e).encode("UTF-8")
 *             message = python.PyBytes_FromFormat(             # <<<<<<<<<<<<<<
 *                 "Error executing extension element '%s': %s",
 *                 c_inst_node.name, _cstr(e))
*/
              __pyx_t_24 = PyBytes_FromFormat(((char *)"Error executing extension element '%s': %s"), __pyx_v_c_inst_node->name, PyBytes_AS_STRING(__pyx_v_e)); if (unlikely(!__pyx_t_24)) __PYX_ERR(20, 225, __pyx_L35_error)
              __Pyx_GOTREF(__pyx_t_24);
              __pyx_v_message = ((PyObject*)__pyx_t_24);
              __pyx_t_24 = 0;

              /* "src/lxml/xsltext.pxi":228
 *                 "Error executing extension element '%s': %s",
 *                 c_inst_node.name, _cstr(e))
 *             xslt.xsltTransformError(c_ctxt, NULL, c_inst_node, "%s", message)             # <<<<<<<<<<<<<<
 *             context._exc._store_raised()
 *         except:
*/
              if (unlikely(__pyx_v_message == Py_None)) {
                PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
                __PYX_ERR(20, 228, __pyx_L35_error)
              }
              __pyx_t_27 = __Pyx_PyBytes_AsWritableString(__pyx_v_message); if (unlikely((!__pyx_t_27) && PyErr_Occurred())) __PYX_ERR(20, 228, __pyx_L35_error)
              xsltTransformError(__pyx_v_c_ctxt, NULL, __pyx_v_c_inst_node, ((char *)"%s"), __pyx_t_27);

              /* "src/lxml/xsltext.pxi":229
 *                 c_inst_node.name, _cstr(e))
 *             xslt.xsltTransformError(c_ctxt, NULL, c_inst_node, "%s", message)
 *             context._exc._store_raised()             # <<<<<<<<<<<<<<
 *         except:
 *             # just in case
*/
              __pyx_f_4lxml_5etree_17_ExceptionContext__store_raised(__pyx_v_context->__pyx_base._exc);
            }

            /* "src/lxml/xsltext.pxi":220
 *                 if self_node is not None:
 *                     _freeReadOnlyProxies(self_node)
 *         except Exception as e:             # <<<<<<<<<<<<<<
 *             try:
 *                 e = unicode(e).encode("UTF-8")
*/
            /*finally:*/ {
              /*normal exit:*/{
                __Pyx_DECREF(__pyx_v_e); __pyx_v_e = 0;
                goto __pyx_L36;
              }
              __pyx_L35_error:;
              /*exception exit:*/{
                __Pyx_PyThreadState_declare
                __Pyx_PyThreadState_assign
                __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_19 = 0; __pyx_t_18 = 0; __pyx_t_17 = 0;
                __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
                __Pyx_XDECREF(__pyx_t_23); __pyx_t_23 = 0;
                __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0;
                __Pyx_XDECREF(__pyx_t_25); __pyx_t_25 = 0;
                __Pyx_XDECREF(__pyx_t_26); __pyx_t_26 = 0;
                 __Pyx_ExceptionSwap(&__pyx_t_19, &__pyx_t_18, &__pyx_t_17);
                if ( unlikely(__Pyx_GetException(&__pyx_t_20, &__pyx_t_21, &__pyx_t_22) < 0)) __Pyx_ErrFetch(&__pyx_t_20, &__pyx_t_21, &__pyx_t_22);
                __Pyx_XGOTREF(__pyx_t_20);
                __Pyx_XGOTREF(__pyx_t_21);
                __Pyx_XGOTREF(__pyx_t_22);
                __Pyx_XGOTREF(__pyx_t_19);
                __Pyx_XGOTREF(__pyx_t_18);
                __Pyx_XGOTREF(__pyx_t_17);
                __pyx_t_15 = __pyx_lineno; __pyx_t_14 = __pyx_clineno; __pyx_t_28 = __pyx_filename;
                {
                  __Pyx_DECREF(__pyx_v_e); __pyx_v_e = 0;
                }
                __Pyx_XGIVEREF(__pyx_t_19);
                __Pyx_XGIVEREF(__pyx_t_18);
                __Pyx_XGIVEREF(__pyx_t_17);
                __Pyx_ExceptionReset(__pyx_t_19, __pyx_t_18, __pyx_t_17);
                __Pyx_XGIVEREF(__pyx_t_20);
                __Pyx_XGIVEREF(__pyx_t_21);
                __Pyx_XGIVEREF(__pyx_t_22);
                __Pyx_ErrRestore(__pyx_t_20, __pyx_t_21, __pyx_t_22);
                __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_19 = 0; __pyx_t_18 = 0; __pyx_t_17 = 0;
                __pyx_lineno = __pyx_t_15; __pyx_clineno = __pyx_t_14; __pyx_filename = __pyx_t_28;
                goto __pyx_L16_except_error;
              }
              __pyx_L36:;
            }
            __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
            __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
            __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
            goto __pyx_L15_exception_handled;
          }

          /* "src/lxml/xsltext.pxi":230
 *             xslt.xsltTransformError(c_ctxt, NULL, c_inst_node, "%s", message)
 *             context._exc._store_raised()
 *         except:             # <<<<<<<<<<<<<<
 *             # just in case
 *             message = python.PyBytes_FromFormat(
*/
          /*except:*/ {
            __Pyx_AddTraceback("lxml.etree._callExtensionElement", __pyx_clineno, __pyx_lineno, __pyx_filename);
            if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_9, &__pyx_t_11) < 0) __PYX_ERR(20, 230, __pyx_L16_except_error)
            __Pyx_XGOTREF(__pyx_t_2);
            __Pyx_XGOTREF(__pyx_t_9);
            __Pyx_XGOTREF(__pyx_t_11);

            /* "src/lxml/xsltext.pxi":232
 *         except:
 *             # just in case
 *             message = python.PyBytes_FromFormat(             # <<<<<<<<<<<<<<
 *                 "Error executing extension element '%s'", c_inst_node.name)
 *             xslt.xsltTransformError(c_ctxt, NULL, c_inst_node, "%s", message)
*/
            __pyx_t_24 = PyBytes_FromFormat(((char *)"Error executing extension element '%s'"), __pyx_v_c_inst_node->name); if (unlikely(!__pyx_t_24)) __PYX_ERR(20, 232, __pyx_L16_except_error)
            __Pyx_GOTREF(__pyx_t_24);
            __pyx_v_message = ((PyObject*)__pyx_t_24);
            __pyx_t_24 = 0;

            /* "src/lxml/xsltext.pxi":234
 *             message = python.PyBytes_FromFormat(
 *                 "Error executing extension element '%s'", c_inst_node.name)
 *             xslt.xsltTransformError(c_ctxt, NULL, c_inst_node, "%s", message)             # <<<<<<<<<<<<<<
 *             context._exc._store_raised()
 *     except:
*/
            if (unlikely(__pyx_v_message == Py_None)) {
              PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
              __PYX_ERR(20, 234, __pyx_L16_except_error)
            }
            __pyx_t_27 = __Pyx_PyBytes_AsWritableString(__pyx_v_message); if (unlikely((!__pyx_t_27) && PyErr_Occurred())) __PYX_ERR(20, 234, __pyx_L16_except_error)
            xsltTransformError(__pyx_v_c_ctxt, NULL, __pyx_v_c_inst_node, ((char *)"%s"), __pyx_t_27);

            /* "src/lxml/xsltext.pxi":235
 *                 "Error executing extension element '%s'", c_inst_node.name)
 *             xslt.xsltTransformError(c_ctxt, NULL, c_inst_node, "%s", message)
 *             context._exc._store_raised()             # <<<<<<<<<<<<<<
 *     except:
 *         # no Python functions here - everything can fail...
*/
            __pyx_f_4lxml_5etree_17_ExceptionContext__store_raised(__pyx_v_context->__pyx_base._exc);
            __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
            __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
            __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
            goto __pyx_L15_exception_handled;
          }

          /* "src/lxml/xsltext.pxi":181
 *     context = <_XSLTContext>c_ctxt.xpathCtxt.userData
 *     try:
 *         try:             # <<<<<<<<<<<<<<
 *             dict_result = python.PyDict_GetItem(
 *                 context._extension_elements, (c_uri, c_inst_node.name))
*/
          __pyx_L16_except_error:;
          __Pyx_XGIVEREF(__pyx_t_6);
          __Pyx_XGIVEREF(__pyx_t_7);
          __Pyx_XGIVEREF(__pyx_t_8);
          __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
          goto __pyx_L8_error;
          __pyx_L15_exception_handled:;
          __Pyx_XGIVEREF(__pyx_t_6);
          __Pyx_XGIVEREF(__pyx_t_7);
          __Pyx_XGIVEREF(__pyx_t_8);
          __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
          __pyx_L19_try_end:;
        }

        /* "src/lxml/xsltext.pxi":180
 *         return
 *     context = <_XSLTContext>c_ctxt.xpathCtxt.userData
 *     try:             # <<<<<<<<<<<<<<
 *         try:
 *             dict_result = python.PyDict_GetItem(
*/
      }
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L13_try_end;
      __pyx_L8_error:;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_23); __pyx_t_23 = 0;
      __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0;
      __Pyx_XDECREF(__pyx_t_25); __pyx_t_25 = 0;
      __Pyx_XDECREF(__pyx_t_26); __pyx_t_26 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "src/lxml/xsltext.pxi":236
 *             xslt.xsltTransformError(c_ctxt, NULL, c_inst_node, "%s", message)
 *             context._exc._store_raised()
 *     except:             # <<<<<<<<<<<<<<
 *         # no Python functions here - everything can fail...
 *         xslt.xsltTransformError(c_ctxt, NULL, c_inst_node,
*/
      /*except:*/ {
        __Pyx_AddTraceback("lxml.etree._callExtensionElement", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_11, &__pyx_t_9, &__pyx_t_2) < 0) __PYX_ERR(20, 236, __pyx_L10_except_error)
        __Pyx_XGOTREF(__pyx_t_11);
        __Pyx_XGOTREF(__pyx_t_9);
        __Pyx_XGOTREF(__pyx_t_2);

        /* "src/lxml/xsltext.pxi":238
 *     except:
 *         # no Python functions here - everything can fail...
 *         xslt.xsltTransformError(c_ctxt, NULL, c_inst_node,             # <<<<<<<<<<<<<<
 *                                 "Error during XSLT extension element evaluation")
 *         context._exc._store_raised()
*/
        xsltTransformError(__pyx_v_c_ctxt, NULL, __pyx_v_c_inst_node, ((char *)"Error during XSLT extension element evaluation"));

        /* "src/lxml/xsltext.pxi":240
 *         xslt.xsltTransformError(c_ctxt, NULL, c_inst_node,
 *                                 "Error during XSLT extension element evaluation")
 *         context._exc._store_raised()             # <<<<<<<<<<<<<<
 *     finally:
 *         return  # swallow any further exceptions
*/
        __pyx_f_4lxml_5etree_17_ExceptionContext__store_raised(__pyx_v_context->__pyx_base._exc);
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        goto __pyx_L9_exception_handled;
      }

      /* "src/lxml/xsltext.pxi":180
 *         return
 *     context = <_XSLTContext>c_ctxt.xpathCtxt.userData
 *     try:             # <<<<<<<<<<<<<<
 *         try:
 *             dict_result = python.PyDict_GetItem(
*/
      __pyx_L10_except_error:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      goto __pyx_L6_error;
      __pyx_L9_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      __pyx_L13_try_end:;
    }
  }

  /* "src/lxml/xsltext.pxi":242
 *         context._exc._store_raised()
 *     finally:
 *         return  # swallow any further exceptions             # <<<<<<<<<<<<<<
*/
  /*finally:*/ {
    /*normal exit:*/{
      goto __pyx_L0;
    }
    __pyx_L6_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_8 = 0; __pyx_t_7 = 0; __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_23); __pyx_t_23 = 0;
      __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0;
      __Pyx_XDECREF(__pyx_t_25); __pyx_t_25 = 0;
      __Pyx_XDECREF(__pyx_t_26); __pyx_t_26 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
      if ( unlikely(__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3) < 0)) __Pyx_ErrFetch(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_6);
      {
        goto __pyx_L55_return;
      }
      __pyx_L55_return:;
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_7, __pyx_t_6);
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_8 = 0; __pyx_t_7 = 0; __pyx_t_6 = 0;
      goto __pyx_L0;
    }
  }

  /* "src/lxml/xsltext.pxi":162
 *             <xslt.xsltTransformFunction>_callExtensionElement)
 * 
 * cdef void _callExtensionElement(xslt.xsltTransformContext* c_ctxt,             # <<<<<<<<<<<<<<
 *                                 xmlNode* c_context_node,
 *                                 xmlNode* c_inst_node,
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_XDECREF((PyObject *)__pyx_v_extension);
  __Pyx_XDECREF((PyObject *)__pyx_v_context_node);
  __Pyx_XDECREF((PyObject *)__pyx_v_self_node);
  __Pyx_XDECREF(__pyx_v_output_parent);
  __Pyx_XDECREF(__pyx_v_e);
  __Pyx_XDECREF(__pyx_v_message);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
}

/* "lxml/etree.pyx":3800
 *     "Base class for XML validators."
 *     cdef _ErrorLog _error_log
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._error_log = _ErrorLog()
 * 
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_10_Validator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_10_Validator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, __pyx_nargs); return -1; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return -1;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__cinit__", __pyx_kwds); return -1;}
  __pyx_r = __pyx_pf_4lxml_5etree_10_Validator___cinit__(((struct __pyx_obj_4lxml_5etree__Validator *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_10_Validator___cinit__(struct __pyx_obj_4lxml_5etree__Validator *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "lxml/etree.pyx":3801
 *     cdef _ErrorLog _error_log
 *     def __cinit__(self):
 *         self._error_log = _ErrorLog()             # <<<<<<<<<<<<<<
 * 
 *     def validate(self, etree):
*/
  __pyx_t_2 = NULL;
  __pyx_t_3 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ErrorLog, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3801, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __Pyx_GIVEREF((PyObject *)__pyx_t_1);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_error_log);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_error_log);
  __pyx_v_self->_error_log = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "lxml/etree.pyx":3800
 *     "Base class for XML validators."
 *     cdef _ErrorLog _error_log
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._error_log = _ErrorLog()
 * 
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Validator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":3803
 *         self._error_log = _ErrorLog()
 * 
 *     def validate(self, etree):             # <<<<<<<<<<<<<<
 *         """validate(self, etree)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_10_Validator_3validate(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_10_Validator_2validate, "validate(self, etree)\n\n        Validate the document using this schema.\n\n        Returns true if document is valid, false if not.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_10_Validator_3validate = {"validate", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_10_Validator_3validate, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_10_Validator_2validate};
static PyObject *__pyx_pw_4lxml_5etree_10_Validator_3validate(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_etree = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("validate (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_etree,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 3803, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3803, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "validate", 0) < (0)) __PYX_ERR(0, 3803, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("validate", 1, 1, 1, i); __PYX_ERR(0, 3803, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3803, __pyx_L3_error)
    }
    __pyx_v_etree = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("validate", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 3803, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._Validator.validate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_10_Validator_2validate(((struct __pyx_obj_4lxml_5etree__Validator *)__pyx_v_self), __pyx_v_etree);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_10_Validator_2validate(struct __pyx_obj_4lxml_5etree__Validator *__pyx_v_self, PyObject *__pyx_v_etree) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("validate", 0);

  /* "lxml/etree.pyx":3810
 *         Returns true if document is valid, false if not.
 *         """
 *         return self(etree)             # <<<<<<<<<<<<<<
 * 
 *     def assertValid(self, etree):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = NULL;
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __pyx_t_3 = ((PyObject *)__pyx_v_self); 
  __pyx_t_4 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_4 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_etree};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3810, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":3803
 *         self._error_log = _ErrorLog()
 * 
 *     def validate(self, etree):             # <<<<<<<<<<<<<<
 *         """validate(self, etree)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Validator.validate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":3812
 *         return self(etree)
 * 
 *     def assertValid(self, etree):             # <<<<<<<<<<<<<<
 *         """assertValid(self, etree)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_10_Validator_5assertValid(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_10_Validator_4assertValid, "assertValid(self, etree)\n\n        Raises `DocumentInvalid` if the document does not comply with the schema.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_10_Validator_5assertValid = {"assertValid", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_10_Validator_5assertValid, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_10_Validator_4assertValid};
static PyObject *__pyx_pw_4lxml_5etree_10_Validator_5assertValid(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_etree = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("assertValid (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_etree,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 3812, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3812, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "assertValid", 0) < (0)) __PYX_ERR(0, 3812, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("assertValid", 1, 1, 1, i); __PYX_ERR(0, 3812, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3812, __pyx_L3_error)
    }
    __pyx_v_etree = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("assertValid", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 3812, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._Validator.assertValid", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_10_Validator_4assertValid(((struct __pyx_obj_4lxml_5etree__Validator *)__pyx_v_self), __pyx_v_etree);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_10_Validator_4assertValid(struct __pyx_obj_4lxml_5etree__Validator *__pyx_v_self, PyObject *__pyx_v_etree) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("assertValid", 0);

  /* "lxml/etree.pyx":3817
 *         Raises `DocumentInvalid` if the document does not comply with the schema.
 *         """
 *         if not self(etree):             # <<<<<<<<<<<<<<
 *             raise DocumentInvalid(self._error_log._buildExceptionMessage(
 *                     "Document does not comply with schema"),
*/
  __pyx_t_2 = NULL;
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __pyx_t_3 = ((PyObject *)__pyx_v_self); 
  __pyx_t_4 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_4 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_etree};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3817, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 3817, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_6 = (!__pyx_t_5);
  if (unlikely(__pyx_t_6)) {

    /* "lxml/etree.pyx":3818
 *         """
 *         if not self(etree):
 *             raise DocumentInvalid(self._error_log._buildExceptionMessage(             # <<<<<<<<<<<<<<
 *                     "Document does not comply with schema"),
 *                                   self._error_log)
*/
    __pyx_t_3 = NULL;
    __pyx_t_2 = __pyx_f_4lxml_5etree_13_BaseErrorLog__buildExceptionMessage(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self->_error_log), __pyx_mstate_global->__pyx_kp_u_Document_does_not_comply_with_sc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3818, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);

    /* "lxml/etree.pyx":3820
 *             raise DocumentInvalid(self._error_log._buildExceptionMessage(
 *                     "Document does not comply with schema"),
 *                                   self._error_log)             # <<<<<<<<<<<<<<
 * 
 *     def assert_(self, etree):
*/
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_t_2, ((PyObject *)__pyx_v_self->_error_log)};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_DocumentInvalid, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3818, __pyx_L1_error)
      __Pyx_GOTREF((PyObject *)__pyx_t_1);
    }
    __Pyx_Raise(((PyObject *)__pyx_t_1), 0, 0, 0);
    __Pyx_DECREF((PyObject *)__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 3818, __pyx_L1_error)

    /* "lxml/etree.pyx":3817
 *         Raises `DocumentInvalid` if the document does not comply with the schema.
 *         """
 *         if not self(etree):             # <<<<<<<<<<<<<<
 *             raise DocumentInvalid(self._error_log._buildExceptionMessage(
 *                     "Document does not comply with schema"),
*/
  }

  /* "lxml/etree.pyx":3812
 *         return self(etree)
 * 
 *     def assertValid(self, etree):             # <<<<<<<<<<<<<<
 *         """assertValid(self, etree)
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Validator.assertValid", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":3822
 *                                   self._error_log)
 * 
 *     def assert_(self, etree):             # <<<<<<<<<<<<<<
 *         """assert_(self, etree)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_10_Validator_7assert_(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_10_Validator_6assert_, "assert_(self, etree)\n\n        Raises `AssertionError` if the document does not comply with the schema.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_10_Validator_7assert_ = {"assert_", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_10_Validator_7assert_, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_10_Validator_6assert_};
static PyObject *__pyx_pw_4lxml_5etree_10_Validator_7assert_(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_etree = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("assert_ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_etree,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 3822, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3822, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "assert_", 0) < (0)) __PYX_ERR(0, 3822, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("assert_", 1, 1, 1, i); __PYX_ERR(0, 3822, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3822, __pyx_L3_error)
    }
    __pyx_v_etree = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("assert_", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 3822, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._Validator.assert_", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_10_Validator_6assert_(((struct __pyx_obj_4lxml_5etree__Validator *)__pyx_v_self), __pyx_v_etree);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_10_Validator_6assert_(struct __pyx_obj_4lxml_5etree__Validator *__pyx_v_self, PyObject *__pyx_v_etree) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("assert_", 0);

  /* "lxml/etree.pyx":3827
 *         Raises `AssertionError` if the document does not comply with the schema.
 *         """
 *         if not self(etree):             # <<<<<<<<<<<<<<
 *             raise AssertionError, self._error_log._buildExceptionMessage(
 *                 "Document does not comply with schema")
*/
  __pyx_t_2 = NULL;
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __pyx_t_3 = ((PyObject *)__pyx_v_self); 
  __pyx_t_4 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_4 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_etree};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3827, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 3827, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_6 = (!__pyx_t_5);
  if (unlikely(__pyx_t_6)) {

    /* "lxml/etree.pyx":3828
 *         """
 *         if not self(etree):
 *             raise AssertionError, self._error_log._buildExceptionMessage(             # <<<<<<<<<<<<<<
 *                 "Document does not comply with schema")
 * 
*/
    __pyx_t_1 = __pyx_f_4lxml_5etree_13_BaseErrorLog__buildExceptionMessage(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self->_error_log), __pyx_mstate_global->__pyx_kp_u_Document_does_not_comply_with_sc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3828, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_t_1, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 3828, __pyx_L1_error)

    /* "lxml/etree.pyx":3827
 *         Raises `AssertionError` if the document does not comply with the schema.
 *         """
 *         if not self(etree):             # <<<<<<<<<<<<<<
 *             raise AssertionError, self._error_log._buildExceptionMessage(
 *                 "Document does not comply with schema")
*/
  }

  /* "lxml/etree.pyx":3822
 *                                   self._error_log)
 * 
 *     def assert_(self, etree):             # <<<<<<<<<<<<<<
 *         """assert_(self, etree)
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Validator.assert_", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":3831
 *                 "Document does not comply with schema")
 * 
 *     cpdef _append_log_message(self, int domain, int type, int level, int line,             # <<<<<<<<<<<<<<
 *                               message, filename):
 *         self._error_log._receiveGeneric(domain, type, level, line, message,
*/

static PyObject *__pyx_pw_4lxml_5etree_10_Validator_9_append_log_message(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_4lxml_5etree_10_Validator__append_log_message(struct __pyx_obj_4lxml_5etree__Validator *__pyx_v_self, int __pyx_v_domain, int __pyx_v_type, int __pyx_v_level, int __pyx_v_line, PyObject *__pyx_v_message, PyObject *__pyx_v_filename, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  size_t __pyx_t_9;
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_append_log_message", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (
  #if !CYTHON_USE_TYPE_SLOTS
  unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Validator &&
  __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
  #else
  unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
  #endif
  ) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_append_log_message); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3831, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_4lxml_5etree_10_Validator_9_append_log_message)) {
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_3 = NULL;
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_4 = __pyx_t_1; 
        __pyx_t_5 = __Pyx_PyLong_From_int(__pyx_v_domain); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3831, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_6 = __Pyx_PyLong_From_int(__pyx_v_type); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3831, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_7 = __Pyx_PyLong_From_int(__pyx_v_level); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3831, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_8 = __Pyx_PyLong_From_int(__pyx_v_line); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3831, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_9 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
          assert(__pyx_t_3);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
          __pyx_t_9 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[7] = {__pyx_t_3, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_v_message, __pyx_v_filename};
          __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_9, (7-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3831, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
        }
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "lxml/etree.pyx":3833
 *     cpdef _append_log_message(self, int domain, int type, int level, int line,
 *                               message, filename):
 *         self._error_log._receiveGeneric(domain, type, level, line, message,             # <<<<<<<<<<<<<<
 *                                         filename)
 * 
*/
  __pyx_t_10 = __pyx_f_4lxml_5etree_13_BaseErrorLog__receiveGeneric(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self->_error_log), __pyx_v_domain, __pyx_v_type, __pyx_v_level, __pyx_v_line, __pyx_v_message, __pyx_v_filename); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 3833, __pyx_L1_error)

  /* "lxml/etree.pyx":3831
 *                 "Document does not comply with schema")
 * 
 *     cpdef _append_log_message(self, int domain, int type, int level, int line,             # <<<<<<<<<<<<<<
 *                               message, filename):
 *         self._error_log._receiveGeneric(domain, type, level, line, message,
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("lxml.etree._Validator._append_log_message", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_10_Validator_9_append_log_message(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_10_Validator_9_append_log_message = {"_append_log_message", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_10_Validator_9_append_log_message, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_10_Validator_9_append_log_message(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  int __pyx_v_domain;
  int __pyx_v_type;
  int __pyx_v_level;
  int __pyx_v_line;
  PyObject *__pyx_v_message = 0;
  PyObject *__pyx_v_filename = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[6] = {0,0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_append_log_message (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_domain,&__pyx_mstate_global->__pyx_n_u_type,&__pyx_mstate_global->__pyx_n_u_level,&__pyx_mstate_global->__pyx_n_u_line_2,&__pyx_mstate_global->__pyx_n_u_message,&__pyx_mstate_global->__pyx_n_u_filename,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 3831, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  6:
        values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 3831, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 3831, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 3831, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 3831, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 3831, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3831, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_append_log_message", 0) < (0)) __PYX_ERR(0, 3831, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 6; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_append_log_message", 1, 6, 6, i); __PYX_ERR(0, 3831, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 6)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3831, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 3831, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 3831, __pyx_L3_error)
      values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 3831, __pyx_L3_error)
      values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 3831, __pyx_L3_error)
      values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 3831, __pyx_L3_error)
    }
    __pyx_v_domain = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_domain == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3831, __pyx_L3_error)
    __pyx_v_type = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_type == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3831, __pyx_L3_error)
    __pyx_v_level = __Pyx_PyLong_As_int(values[2]); if (unlikely((__pyx_v_level == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3831, __pyx_L3_error)
    __pyx_v_line = __Pyx_PyLong_As_int(values[3]); if (unlikely((__pyx_v_line == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3831, __pyx_L3_error)
    __pyx_v_message = values[4];
    __pyx_v_filename = values[5];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_append_log_message", 1, 6, 6, __pyx_nargs); __PYX_ERR(0, 3831, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree._Validator._append_log_message", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_10_Validator_8_append_log_message(((struct __pyx_obj_4lxml_5etree__Validator *)__pyx_v_self), __pyx_v_domain, __pyx_v_type, __pyx_v_level, __pyx_v_line, __pyx_v_message, __pyx_v_filename);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_10_Validator_8_append_log_message(struct __pyx_obj_4lxml_5etree__Validator *__pyx_v_self, int __pyx_v_domain, int __pyx_v_type, int __pyx_v_level, int __pyx_v_line, PyObject *__pyx_v_message, PyObject *__pyx_v_filename) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_append_log_message", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree_10_Validator__append_log_message(__pyx_v_self, __pyx_v_domain, __pyx_v_type, __pyx_v_level, __pyx_v_line, __pyx_v_message, __pyx_v_filename, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3831, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._Validator._append_log_message", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":3836
 *                                         filename)
 * 
 *     cpdef _clear_error_log(self):             # <<<<<<<<<<<<<<
 *         self._error_log.clear()
 * 
*/

static PyObject *__pyx_pw_4lxml_5etree_10_Validator_11_clear_error_log(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_4lxml_5etree_10_Validator__clear_error_log(struct __pyx_obj_4lxml_5etree__Validator *__pyx_v_self, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_clear_error_log", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (
  #if !CYTHON_USE_TYPE_SLOTS
  unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Validator &&
  __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
  #else
  unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
  #endif
  ) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_clear_error_log); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3836, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_4lxml_5etree_10_Validator_11_clear_error_log)) {
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_3 = NULL;
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_4 = __pyx_t_1; 
        __pyx_t_5 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
          assert(__pyx_t_3);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
          __pyx_t_5 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
          __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3836, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
        }
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "lxml/etree.pyx":3837
 * 
 *     cpdef _clear_error_log(self):
 *         self._error_log.clear()             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)__pyx_v_self->_error_log->__pyx_base.__pyx_base.__pyx_vtab)->clear(__pyx_v_self->_error_log, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3837, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":3836
 *                                         filename)
 * 
 *     cpdef _clear_error_log(self):             # <<<<<<<<<<<<<<
 *         self._error_log.clear()
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._Validator._clear_error_log", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_10_Validator_11_clear_error_log(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_10_Validator_11_clear_error_log = {"_clear_error_log", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_10_Validator_11_clear_error_log, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_10_Validator_11_clear_error_log(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_clear_error_log (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("_clear_error_log", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("_clear_error_log", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_10_Validator_10_clear_error_log(((struct __pyx_obj_4lxml_5etree__Validator *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_10_Validator_10_clear_error_log(struct __pyx_obj_4lxml_5etree__Validator *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_clear_error_log", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree_10_Validator__clear_error_log(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3836, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._Validator._clear_error_log", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":3839
 *         self._error_log.clear()
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def error_log(self):
 *         """The log of validation errors and warnings."""
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_10_Validator_9error_log_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_10_Validator_9error_log_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_10_Validator_9error_log___get__(((struct __pyx_obj_4lxml_5etree__Validator *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_10_Validator_9error_log___get__(struct __pyx_obj_4lxml_5etree__Validator *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "lxml/etree.pyx":3842
 *     def error_log(self):
 *         """The log of validation errors and warnings."""
 *         assert self._error_log is not None, "XPath evaluator not initialised"             # <<<<<<<<<<<<<<
 *         return self._error_log.copy()
 * 
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = (((PyObject *)__pyx_v_self->_error_log) != Py_None);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_mstate_global->__pyx_kp_u_XPath_evaluator_not_initialised, 0, 0);
      __PYX_ERR(0, 3842, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(0, 3842, __pyx_L1_error)
  #endif

  /* "lxml/etree.pyx":3843
 *         """The log of validation errors and warnings."""
 *         assert self._error_log is not None, "XPath evaluator not initialised"
 *         return self._error_log.copy()             # <<<<<<<<<<<<<<
 * 
 * include "dtd.pxi"        # DTD
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)__pyx_v_self->_error_log->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.copy(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self->_error_log), 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3843, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":3839
 *         self._error_log.clear()
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def error_log(self):
 *         """The log of validation errors and warnings."""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Validator.error_log.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/dtd.pxi":17
 * 
 * 
 * cdef inline int _assertValidDTDNode(node, void *c_node) except -1:             # <<<<<<<<<<<<<<
 *     assert c_node is not NULL, "invalid DTD proxy at %s" % id(node)
 * 
*/

static CYTHON_INLINE int __pyx_f_4lxml_5etree__assertValidDTDNode(PyObject *__pyx_v_node, void *__pyx_v_c_node) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_assertValidDTDNode", 0);

  /* "src/lxml/dtd.pxi":18
 * 
 * cdef inline int _assertValidDTDNode(node, void *c_node) except -1:
 *     assert c_node is not NULL, "invalid DTD proxy at %s" % id(node)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = (__pyx_v_c_node != NULL);
    if (unlikely(!__pyx_t_1)) {
      __pyx_t_3 = NULL;
      __pyx_t_4 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_node};
        __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_id, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 18, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __pyx_t_3 = __Pyx_PyUnicode_FormatSafe(__pyx_mstate_global->__pyx_kp_u_invalid_DTD_proxy_at_s, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 18, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_t_3, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(21, 18, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(21, 18, __pyx_L1_error)
  #endif

  /* "src/lxml/dtd.pxi":17
 * 
 * 
 * cdef inline int _assertValidDTDNode(node, void *c_node) except -1:             # <<<<<<<<<<<<<<
 *     assert c_node is not NULL, "invalid DTD proxy at %s" % id(node)
 * 
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._assertValidDTDNode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/dtd.pxi":28
 *     cdef tree.xmlElementContent* _c_node
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "<%s.%s object name=%r type=%r occur=%r at 0x%x>" % (self.__class__.__module__, self.__class__.__name__, self.name, self.type, self.occur, id(self))
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_22_DTDElementContentDecl_1__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_22_DTDElementContentDecl_1__repr__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_22_DTDElementContentDecl___repr__(((struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_22_DTDElementContentDecl___repr__(struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8[13];
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "src/lxml/dtd.pxi":29
 * 
 *     def __repr__(self):
 *         return "<%s.%s object name=%r type=%r occur=%r at 0x%x>" % (self.__class__.__module__, self.__class__.__name__, self.name, self.type, self.occur, id(self))             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_class); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_module_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_t_2), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_name_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_t_3), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_3), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(21, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_type); if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_3), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(21, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_occur_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_3), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(21, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = __Pyx_PyObject_Format(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_x); if (unlikely(!__pyx_t_7)) __PYX_ERR(21, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_8[0] = __pyx_mstate_global->__pyx_kp_u__37;
  __pyx_t_8[1] = __pyx_t_1;
  __pyx_t_8[2] = __pyx_mstate_global->__pyx_kp_u__2;
  __pyx_t_8[3] = __pyx_t_2;
  __pyx_t_8[4] = __pyx_mstate_global->__pyx_kp_u_object_name;
  __pyx_t_8[5] = __pyx_t_4;
  __pyx_t_8[6] = __pyx_mstate_global->__pyx_kp_u_type_3;
  __pyx_t_8[7] = __pyx_t_5;
  __pyx_t_8[8] = __pyx_mstate_global->__pyx_kp_u_occur;
  __pyx_t_8[9] = __pyx_t_6;
  __pyx_t_8[10] = __pyx_mstate_global->__pyx_kp_u_at_0x;
  __pyx_t_8[11] = __pyx_t_7;
  __pyx_t_8[12] = __pyx_mstate_global->__pyx_kp_u__3;
  __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_8, 13, 1 * 3 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 13 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4) + 6 * 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 7 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7));
  if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "src/lxml/dtd.pxi":28
 *     cdef tree.xmlElementContent* _c_node
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "<%s.%s object name=%r type=%r occur=%r at 0x%x>" % (self.__class__.__module__, self.__class__.__name__, self.name, self.type, self.occur, id(self))
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree._DTDElementContentDecl.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/dtd.pxi":31
 *         return "<%s.%s object name=%r type=%r occur=%r at 0x%x>" % (self.__class__.__module__, self.__class__.__name__, self.name, self.type, self.occur, id(self))
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def name(self):
 *        _assertValidDTDNode(self, self._c_node)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_22_DTDElementContentDecl_4name_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_22_DTDElementContentDecl_4name_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_22_DTDElementContentDecl_4name___get__(((struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_22_DTDElementContentDecl_4name___get__(struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "src/lxml/dtd.pxi":33
 *     @property
 *     def name(self):
 *        _assertValidDTDNode(self, self._c_node)             # <<<<<<<<<<<<<<
 *        return funicodeOrNone(self._c_node.name)
 * 
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidDTDNode(((PyObject *)__pyx_v_self), __pyx_v_self->_c_node); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(21, 33, __pyx_L1_error)

  /* "src/lxml/dtd.pxi":34
 *     def name(self):
 *        _assertValidDTDNode(self, self._c_node)
 *        return funicodeOrNone(self._c_node.name)             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree_funicodeOrNone(__pyx_v_self->_c_node->name); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 34, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/dtd.pxi":31
 *         return "<%s.%s object name=%r type=%r occur=%r at 0x%x>" % (self.__class__.__module__, self.__class__.__name__, self.name, self.type, self.occur, id(self))
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def name(self):
 *        _assertValidDTDNode(self, self._c_node)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._DTDElementContentDecl.name.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/dtd.pxi":36
 *        return funicodeOrNone(self._c_node.name)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def type(self):
 *        _assertValidDTDNode(self, self._c_node)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_22_DTDElementContentDecl_4type_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_22_DTDElementContentDecl_4type_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_22_DTDElementContentDecl_4type___get__(((struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_22_DTDElementContentDecl_4type___get__(struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *__pyx_v_self) {
  int __pyx_v_type;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  xmlElementContentType __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "src/lxml/dtd.pxi":38
 *     @property
 *     def type(self):
 *        _assertValidDTDNode(self, self._c_node)             # <<<<<<<<<<<<<<
 *        cdef int type = self._c_node.type
 *        if type == tree.XML_ELEMENT_CONTENT_PCDATA:
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidDTDNode(((PyObject *)__pyx_v_self), __pyx_v_self->_c_node); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(21, 38, __pyx_L1_error)

  /* "src/lxml/dtd.pxi":39
 *     def type(self):
 *        _assertValidDTDNode(self, self._c_node)
 *        cdef int type = self._c_node.type             # <<<<<<<<<<<<<<
 *        if type == tree.XML_ELEMENT_CONTENT_PCDATA:
 *            return "pcdata"
*/
  __pyx_t_2 = __pyx_v_self->_c_node->type;
  __pyx_v_type = __pyx_t_2;

  /* "src/lxml/dtd.pxi":40
 *        _assertValidDTDNode(self, self._c_node)
 *        cdef int type = self._c_node.type
 *        if type == tree.XML_ELEMENT_CONTENT_PCDATA:             # <<<<<<<<<<<<<<
 *            return "pcdata"
 *        elif type == tree.XML_ELEMENT_CONTENT_ELEMENT:
*/
  switch (__pyx_v_type) {
    case XML_ELEMENT_CONTENT_PCDATA:

    /* "src/lxml/dtd.pxi":41
 *        cdef int type = self._c_node.type
 *        if type == tree.XML_ELEMENT_CONTENT_PCDATA:
 *            return "pcdata"             # <<<<<<<<<<<<<<
 *        elif type == tree.XML_ELEMENT_CONTENT_ELEMENT:
 *            return "element"
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_pcdata);
    __pyx_r = __pyx_mstate_global->__pyx_n_u_pcdata;
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":40
 *        _assertValidDTDNode(self, self._c_node)
 *        cdef int type = self._c_node.type
 *        if type == tree.XML_ELEMENT_CONTENT_PCDATA:             # <<<<<<<<<<<<<<
 *            return "pcdata"
 *        elif type == tree.XML_ELEMENT_CONTENT_ELEMENT:
*/
    break;
    case XML_ELEMENT_CONTENT_ELEMENT:

    /* "src/lxml/dtd.pxi":43
 *            return "pcdata"
 *        elif type == tree.XML_ELEMENT_CONTENT_ELEMENT:
 *            return "element"             # <<<<<<<<<<<<<<
 *        elif type == tree.XML_ELEMENT_CONTENT_SEQ:
 *            return "seq"
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_element);
    __pyx_r = __pyx_mstate_global->__pyx_n_u_element;
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":42
 *        if type == tree.XML_ELEMENT_CONTENT_PCDATA:
 *            return "pcdata"
 *        elif type == tree.XML_ELEMENT_CONTENT_ELEMENT:             # <<<<<<<<<<<<<<
 *            return "element"
 *        elif type == tree.XML_ELEMENT_CONTENT_SEQ:
*/
    break;
    case XML_ELEMENT_CONTENT_SEQ:

    /* "src/lxml/dtd.pxi":45
 *            return "element"
 *        elif type == tree.XML_ELEMENT_CONTENT_SEQ:
 *            return "seq"             # <<<<<<<<<<<<<<
 *        elif type == tree.XML_ELEMENT_CONTENT_OR:
 *            return "or"
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_seq);
    __pyx_r = __pyx_mstate_global->__pyx_n_u_seq;
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":44
 *        elif type == tree.XML_ELEMENT_CONTENT_ELEMENT:
 *            return "element"
 *        elif type == tree.XML_ELEMENT_CONTENT_SEQ:             # <<<<<<<<<<<<<<
 *            return "seq"
 *        elif type == tree.XML_ELEMENT_CONTENT_OR:
*/
    break;
    case XML_ELEMENT_CONTENT_OR:

    /* "src/lxml/dtd.pxi":47
 *            return "seq"
 *        elif type == tree.XML_ELEMENT_CONTENT_OR:
 *            return "or"             # <<<<<<<<<<<<<<
 *        else:
 *            return None
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_or);
    __pyx_r = __pyx_mstate_global->__pyx_n_u_or;
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":46
 *        elif type == tree.XML_ELEMENT_CONTENT_SEQ:
 *            return "seq"
 *        elif type == tree.XML_ELEMENT_CONTENT_OR:             # <<<<<<<<<<<<<<
 *            return "or"
 *        else:
*/
    break;
    default:

    /* "src/lxml/dtd.pxi":49
 *            return "or"
 *        else:
 *            return None             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
    break;
  }

  /* "src/lxml/dtd.pxi":36
 *        return funicodeOrNone(self._c_node.name)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def type(self):
 *        _assertValidDTDNode(self, self._c_node)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._DTDElementContentDecl.type.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/dtd.pxi":51
 *            return None
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def occur(self):
 *        _assertValidDTDNode(self, self._c_node)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_22_DTDElementContentDecl_5occur_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_22_DTDElementContentDecl_5occur_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_22_DTDElementContentDecl_5occur___get__(((struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_22_DTDElementContentDecl_5occur___get__(struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *__pyx_v_self) {
  int __pyx_v_occur;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  xmlElementContentOccur __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "src/lxml/dtd.pxi":53
 *     @property
 *     def occur(self):
 *        _assertValidDTDNode(self, self._c_node)             # <<<<<<<<<<<<<<
 *        cdef int occur = self._c_node.ocur
 *        if occur == tree.XML_ELEMENT_CONTENT_ONCE:
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidDTDNode(((PyObject *)__pyx_v_self), __pyx_v_self->_c_node); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(21, 53, __pyx_L1_error)

  /* "src/lxml/dtd.pxi":54
 *     def occur(self):
 *        _assertValidDTDNode(self, self._c_node)
 *        cdef int occur = self._c_node.ocur             # <<<<<<<<<<<<<<
 *        if occur == tree.XML_ELEMENT_CONTENT_ONCE:
 *            return "once"
*/
  __pyx_t_2 = __pyx_v_self->_c_node->ocur;
  __pyx_v_occur = __pyx_t_2;

  /* "src/lxml/dtd.pxi":55
 *        _assertValidDTDNode(self, self._c_node)
 *        cdef int occur = self._c_node.ocur
 *        if occur == tree.XML_ELEMENT_CONTENT_ONCE:             # <<<<<<<<<<<<<<
 *            return "once"
 *        elif occur == tree.XML_ELEMENT_CONTENT_OPT:
*/
  switch (__pyx_v_occur) {
    case XML_ELEMENT_CONTENT_ONCE:

    /* "src/lxml/dtd.pxi":56
 *        cdef int occur = self._c_node.ocur
 *        if occur == tree.XML_ELEMENT_CONTENT_ONCE:
 *            return "once"             # <<<<<<<<<<<<<<
 *        elif occur == tree.XML_ELEMENT_CONTENT_OPT:
 *            return "opt"
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_once);
    __pyx_r = __pyx_mstate_global->__pyx_n_u_once;
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":55
 *        _assertValidDTDNode(self, self._c_node)
 *        cdef int occur = self._c_node.ocur
 *        if occur == tree.XML_ELEMENT_CONTENT_ONCE:             # <<<<<<<<<<<<<<
 *            return "once"
 *        elif occur == tree.XML_ELEMENT_CONTENT_OPT:
*/
    break;
    case XML_ELEMENT_CONTENT_OPT:

    /* "src/lxml/dtd.pxi":58
 *            return "once"
 *        elif occur == tree.XML_ELEMENT_CONTENT_OPT:
 *            return "opt"             # <<<<<<<<<<<<<<
 *        elif occur == tree.XML_ELEMENT_CONTENT_MULT:
 *            return "mult"
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_opt);
    __pyx_r = __pyx_mstate_global->__pyx_n_u_opt;
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":57
 *        if occur == tree.XML_ELEMENT_CONTENT_ONCE:
 *            return "once"
 *        elif occur == tree.XML_ELEMENT_CONTENT_OPT:             # <<<<<<<<<<<<<<
 *            return "opt"
 *        elif occur == tree.XML_ELEMENT_CONTENT_MULT:
*/
    break;
    case XML_ELEMENT_CONTENT_MULT:

    /* "src/lxml/dtd.pxi":60
 *            return "opt"
 *        elif occur == tree.XML_ELEMENT_CONTENT_MULT:
 *            return "mult"             # <<<<<<<<<<<<<<
 *        elif occur == tree.XML_ELEMENT_CONTENT_PLUS:
 *            return "plus"
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_mult);
    __pyx_r = __pyx_mstate_global->__pyx_n_u_mult;
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":59
 *        elif occur == tree.XML_ELEMENT_CONTENT_OPT:
 *            return "opt"
 *        elif occur == tree.XML_ELEMENT_CONTENT_MULT:             # <<<<<<<<<<<<<<
 *            return "mult"
 *        elif occur == tree.XML_ELEMENT_CONTENT_PLUS:
*/
    break;
    case XML_ELEMENT_CONTENT_PLUS:

    /* "src/lxml/dtd.pxi":62
 *            return "mult"
 *        elif occur == tree.XML_ELEMENT_CONTENT_PLUS:
 *            return "plus"             # <<<<<<<<<<<<<<
 *        else:
 *            return None
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_plus);
    __pyx_r = __pyx_mstate_global->__pyx_n_u_plus;
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":61
 *        elif occur == tree.XML_ELEMENT_CONTENT_MULT:
 *            return "mult"
 *        elif occur == tree.XML_ELEMENT_CONTENT_PLUS:             # <<<<<<<<<<<<<<
 *            return "plus"
 *        else:
*/
    break;
    default:

    /* "src/lxml/dtd.pxi":64
 *            return "plus"
 *        else:
 *            return None             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
    break;
  }

  /* "src/lxml/dtd.pxi":51
 *            return None
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def occur(self):
 *        _assertValidDTDNode(self, self._c_node)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._DTDElementContentDecl.occur.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/dtd.pxi":66
 *            return None
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def left(self):
 *        _assertValidDTDNode(self, self._c_node)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_22_DTDElementContentDecl_4left_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_22_DTDElementContentDecl_4left_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_22_DTDElementContentDecl_4left___get__(((struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_22_DTDElementContentDecl_4left___get__(struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *__pyx_v_self) {
  xmlElementContent *__pyx_v_c1;
  struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *__pyx_v_node = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  xmlElementContent *__pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "src/lxml/dtd.pxi":68
 *     @property
 *     def left(self):
 *        _assertValidDTDNode(self, self._c_node)             # <<<<<<<<<<<<<<
 *        c1 = self._c_node.c1
 *        if c1:
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidDTDNode(((PyObject *)__pyx_v_self), __pyx_v_self->_c_node); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(21, 68, __pyx_L1_error)

  /* "src/lxml/dtd.pxi":69
 *     def left(self):
 *        _assertValidDTDNode(self, self._c_node)
 *        c1 = self._c_node.c1             # <<<<<<<<<<<<<<
 *        if c1:
 *            node = <_DTDElementContentDecl>_DTDElementContentDecl.__new__(_DTDElementContentDecl)
*/
  __pyx_t_2 = __pyx_v_self->_c_node->c1;
  __pyx_v_c1 = __pyx_t_2;

  /* "src/lxml/dtd.pxi":70
 *        _assertValidDTDNode(self, self._c_node)
 *        c1 = self._c_node.c1
 *        if c1:             # <<<<<<<<<<<<<<
 *            node = <_DTDElementContentDecl>_DTDElementContentDecl.__new__(_DTDElementContentDecl)
 *            node._dtd = self._dtd
*/
  __pyx_t_3 = (__pyx_v_c1 != 0);
  if (__pyx_t_3) {

    /* "src/lxml/dtd.pxi":71
 *        c1 = self._c_node.c1
 *        if c1:
 *            node = <_DTDElementContentDecl>_DTDElementContentDecl.__new__(_DTDElementContentDecl)             # <<<<<<<<<<<<<<
 *            node._dtd = self._dtd
 *            node._c_node = <tree.xmlElementContent*>c1
*/
    __pyx_t_4 = ((PyObject *)__pyx_tp_new_4lxml_5etree__DTDElementContentDecl(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__DTDElementContentDecl), __pyx_mstate_global->__pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_4)) __PYX_ERR(21, 71, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_4);
    __pyx_t_5 = ((PyObject *)__pyx_t_4);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_DECREF((PyObject *)__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_node = ((struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "src/lxml/dtd.pxi":72
 *        if c1:
 *            node = <_DTDElementContentDecl>_DTDElementContentDecl.__new__(_DTDElementContentDecl)
 *            node._dtd = self._dtd             # <<<<<<<<<<<<<<
 *            node._c_node = <tree.xmlElementContent*>c1
 *            return node
*/
    __pyx_t_5 = ((PyObject *)__pyx_v_self->_dtd);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __Pyx_GOTREF((PyObject *)__pyx_v_node->_dtd);
    __Pyx_DECREF((PyObject *)__pyx_v_node->_dtd);
    __pyx_v_node->_dtd = ((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "src/lxml/dtd.pxi":73
 *            node = <_DTDElementContentDecl>_DTDElementContentDecl.__new__(_DTDElementContentDecl)
 *            node._dtd = self._dtd
 *            node._c_node = <tree.xmlElementContent*>c1             # <<<<<<<<<<<<<<
 *            return node
 *        else:
*/
    __pyx_v_node->_c_node = ((xmlElementContent *)__pyx_v_c1);

    /* "src/lxml/dtd.pxi":74
 *            node._dtd = self._dtd
 *            node._c_node = <tree.xmlElementContent*>c1
 *            return node             # <<<<<<<<<<<<<<
 *        else:
 *            return None
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF((PyObject *)__pyx_v_node);
    __pyx_r = ((PyObject *)__pyx_v_node);
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":70
 *        _assertValidDTDNode(self, self._c_node)
 *        c1 = self._c_node.c1
 *        if c1:             # <<<<<<<<<<<<<<
 *            node = <_DTDElementContentDecl>_DTDElementContentDecl.__new__(_DTDElementContentDecl)
 *            node._dtd = self._dtd
*/
  }

  /* "src/lxml/dtd.pxi":76
 *            return node
 *        else:
 *            return None             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "src/lxml/dtd.pxi":66
 *            return None
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def left(self):
 *        _assertValidDTDNode(self, self._c_node)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._DTDElementContentDecl.left.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_node);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/dtd.pxi":78
 *            return None
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def right(self):
 *        _assertValidDTDNode(self, self._c_node)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_22_DTDElementContentDecl_5right_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_22_DTDElementContentDecl_5right_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_22_DTDElementContentDecl_5right___get__(((struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_22_DTDElementContentDecl_5right___get__(struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *__pyx_v_self) {
  xmlElementContent *__pyx_v_c2;
  struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *__pyx_v_node = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  xmlElementContent *__pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "src/lxml/dtd.pxi":80
 *     @property
 *     def right(self):
 *        _assertValidDTDNode(self, self._c_node)             # <<<<<<<<<<<<<<
 *        c2 = self._c_node.c2
 *        if c2:
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidDTDNode(((PyObject *)__pyx_v_self), __pyx_v_self->_c_node); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(21, 80, __pyx_L1_error)

  /* "src/lxml/dtd.pxi":81
 *     def right(self):
 *        _assertValidDTDNode(self, self._c_node)
 *        c2 = self._c_node.c2             # <<<<<<<<<<<<<<
 *        if c2:
 *            node = <_DTDElementContentDecl>_DTDElementContentDecl.__new__(_DTDElementContentDecl)
*/
  __pyx_t_2 = __pyx_v_self->_c_node->c2;
  __pyx_v_c2 = __pyx_t_2;

  /* "src/lxml/dtd.pxi":82
 *        _assertValidDTDNode(self, self._c_node)
 *        c2 = self._c_node.c2
 *        if c2:             # <<<<<<<<<<<<<<
 *            node = <_DTDElementContentDecl>_DTDElementContentDecl.__new__(_DTDElementContentDecl)
 *            node._dtd = self._dtd
*/
  __pyx_t_3 = (__pyx_v_c2 != 0);
  if (__pyx_t_3) {

    /* "src/lxml/dtd.pxi":83
 *        c2 = self._c_node.c2
 *        if c2:
 *            node = <_DTDElementContentDecl>_DTDElementContentDecl.__new__(_DTDElementContentDecl)             # <<<<<<<<<<<<<<
 *            node._dtd = self._dtd
 *            node._c_node = <tree.xmlElementContent*>c2
*/
    __pyx_t_4 = ((PyObject *)__pyx_tp_new_4lxml_5etree__DTDElementContentDecl(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__DTDElementContentDecl), __pyx_mstate_global->__pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_4)) __PYX_ERR(21, 83, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_4);
    __pyx_t_5 = ((PyObject *)__pyx_t_4);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_DECREF((PyObject *)__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_node = ((struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "src/lxml/dtd.pxi":84
 *        if c2:
 *            node = <_DTDElementContentDecl>_DTDElementContentDecl.__new__(_DTDElementContentDecl)
 *            node._dtd = self._dtd             # <<<<<<<<<<<<<<
 *            node._c_node = <tree.xmlElementContent*>c2
 *            return node
*/
    __pyx_t_5 = ((PyObject *)__pyx_v_self->_dtd);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __Pyx_GOTREF((PyObject *)__pyx_v_node->_dtd);
    __Pyx_DECREF((PyObject *)__pyx_v_node->_dtd);
    __pyx_v_node->_dtd = ((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "src/lxml/dtd.pxi":85
 *            node = <_DTDElementContentDecl>_DTDElementContentDecl.__new__(_DTDElementContentDecl)
 *            node._dtd = self._dtd
 *            node._c_node = <tree.xmlElementContent*>c2             # <<<<<<<<<<<<<<
 *            return node
 *        else:
*/
    __pyx_v_node->_c_node = ((xmlElementContent *)__pyx_v_c2);

    /* "src/lxml/dtd.pxi":86
 *            node._dtd = self._dtd
 *            node._c_node = <tree.xmlElementContent*>c2
 *            return node             # <<<<<<<<<<<<<<
 *        else:
 *            return None
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF((PyObject *)__pyx_v_node);
    __pyx_r = ((PyObject *)__pyx_v_node);
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":82
 *        _assertValidDTDNode(self, self._c_node)
 *        c2 = self._c_node.c2
 *        if c2:             # <<<<<<<<<<<<<<
 *            node = <_DTDElementContentDecl>_DTDElementContentDecl.__new__(_DTDElementContentDecl)
 *            node._dtd = self._dtd
*/
  }

  /* "src/lxml/dtd.pxi":88
 *            return node
 *        else:
 *            return None             # <<<<<<<<<<<<<<
 * 
 * 
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "src/lxml/dtd.pxi":78
 *            return None
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def right(self):
 *        _assertValidDTDNode(self, self._c_node)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._DTDElementContentDecl.right.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_node);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/dtd.pxi":98
 *     cdef tree.xmlAttribute* _c_node
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "<%s.%s object name=%r elemname=%r prefix=%r type=%r default=%r default_value=%r at 0x%x>" % (self.__class__.__module__, self.__class__.__name__, self.name, self.elemname, self.prefix, self.type, self.default, self.default_value, id(self))
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_17_DTDAttributeDecl_1__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_17_DTDAttributeDecl_1__repr__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_17_DTDAttributeDecl___repr__(((struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_17_DTDAttributeDecl___repr__(struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11[19];
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "src/lxml/dtd.pxi":99
 * 
 *     def __repr__(self):
 *         return "<%s.%s object name=%r elemname=%r prefix=%r type=%r default=%r default_value=%r at 0x%x>" % (self.__class__.__module__, self.__class__.__name__, self.name, self.elemname, self.prefix, self.type, self.default, self.default_value, id(self))             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_class); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_module_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_t_2), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_name_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_t_3), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_3), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(21, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_elemname_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_3), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(21, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_prefix); if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_3), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(21, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_type); if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_3), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(21, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_default); if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_8 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_3), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_8)) __PYX_ERR(21, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_default_value_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_9 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_3), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_9)) __PYX_ERR(21, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_10 = __Pyx_PyObject_Format(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_x); if (unlikely(!__pyx_t_10)) __PYX_ERR(21, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_11[0] = __pyx_mstate_global->__pyx_kp_u__37;
  __pyx_t_11[1] = __pyx_t_1;
  __pyx_t_11[2] = __pyx_mstate_global->__pyx_kp_u__2;
  __pyx_t_11[3] = __pyx_t_2;
  __pyx_t_11[4] = __pyx_mstate_global->__pyx_kp_u_object_name;
  __pyx_t_11[5] = __pyx_t_4;
  __pyx_t_11[6] = __pyx_mstate_global->__pyx_kp_u_elemname;
  __pyx_t_11[7] = __pyx_t_5;
  __pyx_t_11[8] = __pyx_mstate_global->__pyx_kp_u_prefix_2;
  __pyx_t_11[9] = __pyx_t_6;
  __pyx_t_11[10] = __pyx_mstate_global->__pyx_kp_u_type_3;
  __pyx_t_11[11] = __pyx_t_7;
  __pyx_t_11[12] = __pyx_mstate_global->__pyx_kp_u_default_2;
  __pyx_t_11[13] = __pyx_t_8;
  __pyx_t_11[14] = __pyx_mstate_global->__pyx_kp_u_default_value;
  __pyx_t_11[15] = __pyx_t_9;
  __pyx_t_11[16] = __pyx_mstate_global->__pyx_kp_u_at_0x;
  __pyx_t_11[17] = __pyx_t_10;
  __pyx_t_11[18] = __pyx_mstate_global->__pyx_kp_u__3;
  __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_11, 19, 1 * 3 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 13 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4) + 10 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 8 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6) + 6 * 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7) + 9 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8) + 15 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_9) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_10), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_9) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_10));
  if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "src/lxml/dtd.pxi":98
 *     cdef tree.xmlAttribute* _c_node
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "<%s.%s object name=%r elemname=%r prefix=%r type=%r default=%r default_value=%r at 0x%x>" % (self.__class__.__module__, self.__class__.__name__, self.name, self.elemname, self.prefix, self.type, self.default, self.default_value, id(self))
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("lxml.etree._DTDAttributeDecl.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/dtd.pxi":101
 *         return "<%s.%s object name=%r elemname=%r prefix=%r type=%r default=%r default_value=%r at 0x%x>" % (self.__class__.__module__, self.__class__.__name__, self.name, self.elemname, self.prefix, self.type, self.default, self.default_value, id(self))
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def name(self):
 *        _assertValidDTDNode(self, self._c_node)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_17_DTDAttributeDecl_4name_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_17_DTDAttributeDecl_4name_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_17_DTDAttributeDecl_4name___get__(((struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_17_DTDAttributeDecl_4name___get__(struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "src/lxml/dtd.pxi":103
 *     @property
 *     def name(self):
 *        _assertValidDTDNode(self, self._c_node)             # <<<<<<<<<<<<<<
 *        return funicodeOrNone(self._c_node.name)
 * 
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidDTDNode(((PyObject *)__pyx_v_self), __pyx_v_self->_c_node); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(21, 103, __pyx_L1_error)

  /* "src/lxml/dtd.pxi":104
 *     def name(self):
 *        _assertValidDTDNode(self, self._c_node)
 *        return funicodeOrNone(self._c_node.name)             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree_funicodeOrNone(__pyx_v_self->_c_node->name); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 104, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/dtd.pxi":101
 *         return "<%s.%s object name=%r elemname=%r prefix=%r type=%r default=%r default_value=%r at 0x%x>" % (self.__class__.__module__, self.__class__.__name__, self.name, self.elemname, self.prefix, self.type, self.default, self.default_value, id(self))
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def name(self):
 *        _assertValidDTDNode(self, self._c_node)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._DTDAttributeDecl.name.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/dtd.pxi":106
 *        return funicodeOrNone(self._c_node.name)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def elemname(self):
 *        _assertValidDTDNode(self, self._c_node)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_17_DTDAttributeDecl_8elemname_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_17_DTDAttributeDecl_8elemname_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_17_DTDAttributeDecl_8elemname___get__(((struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_17_DTDAttributeDecl_8elemname___get__(struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "src/lxml/dtd.pxi":108
 *     @property
 *     def elemname(self):
 *        _assertValidDTDNode(self, self._c_node)             # <<<<<<<<<<<<<<
 *        return funicodeOrNone(self._c_node.elem)
 * 
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidDTDNode(((PyObject *)__pyx_v_self), __pyx_v_self->_c_node); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(21, 108, __pyx_L1_error)

  /* "src/lxml/dtd.pxi":109
 *     def elemname(self):
 *        _assertValidDTDNode(self, self._c_node)
 *        return funicodeOrNone(self._c_node.elem)             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree_funicodeOrNone(__pyx_v_self->_c_node->elem); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 109, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/dtd.pxi":106
 *        return funicodeOrNone(self._c_node.name)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def elemname(self):
 *        _assertValidDTDNode(self, self._c_node)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._DTDAttributeDecl.elemname.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/dtd.pxi":111
 *        return funicodeOrNone(self._c_node.elem)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def prefix(self):
 *        _assertValidDTDNode(self, self._c_node)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_17_DTDAttributeDecl_6prefix_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_17_DTDAttributeDecl_6prefix_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_17_DTDAttributeDecl_6prefix___get__(((struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_17_DTDAttributeDecl_6prefix___get__(struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "src/lxml/dtd.pxi":113
 *     @property
 *     def prefix(self):
 *        _assertValidDTDNode(self, self._c_node)             # <<<<<<<<<<<<<<
 *        return funicodeOrNone(self._c_node.prefix)
 * 
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidDTDNode(((PyObject *)__pyx_v_self), __pyx_v_self->_c_node); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(21, 113, __pyx_L1_error)

  /* "src/lxml/dtd.pxi":114
 *     def prefix(self):
 *        _assertValidDTDNode(self, self._c_node)
 *        return funicodeOrNone(self._c_node.prefix)             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree_funicodeOrNone(__pyx_v_self->_c_node->prefix); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 114, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/dtd.pxi":111
 *        return funicodeOrNone(self._c_node.elem)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def prefix(self):
 *        _assertValidDTDNode(self, self._c_node)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._DTDAttributeDecl.prefix.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/dtd.pxi":116
 *        return funicodeOrNone(self._c_node.prefix)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def type(self):
 *        _assertValidDTDNode(self, self._c_node)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_17_DTDAttributeDecl_4type_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_17_DTDAttributeDecl_4type_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_17_DTDAttributeDecl_4type___get__(((struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_17_DTDAttributeDecl_4type___get__(struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *__pyx_v_self) {
  int __pyx_v_type;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  xmlAttributeType __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "src/lxml/dtd.pxi":118
 *     @property
 *     def type(self):
 *        _assertValidDTDNode(self, self._c_node)             # <<<<<<<<<<<<<<
 *        cdef int type = self._c_node.atype
 *        if type == tree.XML_ATTRIBUTE_CDATA:
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidDTDNode(((PyObject *)__pyx_v_self), __pyx_v_self->_c_node); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(21, 118, __pyx_L1_error)

  /* "src/lxml/dtd.pxi":119
 *     def type(self):
 *        _assertValidDTDNode(self, self._c_node)
 *        cdef int type = self._c_node.atype             # <<<<<<<<<<<<<<
 *        if type == tree.XML_ATTRIBUTE_CDATA:
 *            return "cdata"
*/
  __pyx_t_2 = __pyx_v_self->_c_node->atype;
  __pyx_v_type = __pyx_t_2;

  /* "src/lxml/dtd.pxi":120
 *        _assertValidDTDNode(self, self._c_node)
 *        cdef int type = self._c_node.atype
 *        if type == tree.XML_ATTRIBUTE_CDATA:             # <<<<<<<<<<<<<<
 *            return "cdata"
 *        elif type == tree.XML_ATTRIBUTE_ID:
*/
  switch (__pyx_v_type) {
    case XML_ATTRIBUTE_CDATA:

    /* "src/lxml/dtd.pxi":121
 *        cdef int type = self._c_node.atype
 *        if type == tree.XML_ATTRIBUTE_CDATA:
 *            return "cdata"             # <<<<<<<<<<<<<<
 *        elif type == tree.XML_ATTRIBUTE_ID:
 *            return "id"
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_cdata);
    __pyx_r = __pyx_mstate_global->__pyx_n_u_cdata;
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":120
 *        _assertValidDTDNode(self, self._c_node)
 *        cdef int type = self._c_node.atype
 *        if type == tree.XML_ATTRIBUTE_CDATA:             # <<<<<<<<<<<<<<
 *            return "cdata"
 *        elif type == tree.XML_ATTRIBUTE_ID:
*/
    break;
    case XML_ATTRIBUTE_ID:

    /* "src/lxml/dtd.pxi":123
 *            return "cdata"
 *        elif type == tree.XML_ATTRIBUTE_ID:
 *            return "id"             # <<<<<<<<<<<<<<
 *        elif type == tree.XML_ATTRIBUTE_IDREF:
 *            return "idref"
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_id);
    __pyx_r = __pyx_mstate_global->__pyx_n_u_id;
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":122
 *        if type == tree.XML_ATTRIBUTE_CDATA:
 *            return "cdata"
 *        elif type == tree.XML_ATTRIBUTE_ID:             # <<<<<<<<<<<<<<
 *            return "id"
 *        elif type == tree.XML_ATTRIBUTE_IDREF:
*/
    break;
    case XML_ATTRIBUTE_IDREF:

    /* "src/lxml/dtd.pxi":125
 *            return "id"
 *        elif type == tree.XML_ATTRIBUTE_IDREF:
 *            return "idref"             # <<<<<<<<<<<<<<
 *        elif type == tree.XML_ATTRIBUTE_IDREFS:
 *            return "idrefs"
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_idref);
    __pyx_r = __pyx_mstate_global->__pyx_n_u_idref;
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":124
 *        elif type == tree.XML_ATTRIBUTE_ID:
 *            return "id"
 *        elif type == tree.XML_ATTRIBUTE_IDREF:             # <<<<<<<<<<<<<<
 *            return "idref"
 *        elif type == tree.XML_ATTRIBUTE_IDREFS:
*/
    break;
    case XML_ATTRIBUTE_IDREFS:

    /* "src/lxml/dtd.pxi":127
 *            return "idref"
 *        elif type == tree.XML_ATTRIBUTE_IDREFS:
 *            return "idrefs"             # <<<<<<<<<<<<<<
 *        elif type == tree.XML_ATTRIBUTE_ENTITY:
 *            return "entity"
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_idrefs);
    __pyx_r = __pyx_mstate_global->__pyx_n_u_idrefs;
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":126
 *        elif type == tree.XML_ATTRIBUTE_IDREF:
 *            return "idref"
 *        elif type == tree.XML_ATTRIBUTE_IDREFS:             # <<<<<<<<<<<<<<
 *            return "idrefs"
 *        elif type == tree.XML_ATTRIBUTE_ENTITY:
*/
    break;
    case XML_ATTRIBUTE_ENTITY:

    /* "src/lxml/dtd.pxi":129
 *            return "idrefs"
 *        elif type == tree.XML_ATTRIBUTE_ENTITY:
 *            return "entity"             # <<<<<<<<<<<<<<
 *        elif type == tree.XML_ATTRIBUTE_ENTITIES:
 *            return "entities"
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_entity);
    __pyx_r = __pyx_mstate_global->__pyx_n_u_entity;
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":128
 *        elif type == tree.XML_ATTRIBUTE_IDREFS:
 *            return "idrefs"
 *        elif type == tree.XML_ATTRIBUTE_ENTITY:             # <<<<<<<<<<<<<<
 *            return "entity"
 *        elif type == tree.XML_ATTRIBUTE_ENTITIES:
*/
    break;
    case XML_ATTRIBUTE_ENTITIES:

    /* "src/lxml/dtd.pxi":131
 *            return "entity"
 *        elif type == tree.XML_ATTRIBUTE_ENTITIES:
 *            return "entities"             # <<<<<<<<<<<<<<
 *        elif type == tree.XML_ATTRIBUTE_NMTOKEN:
 *            return "nmtoken"
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_entities);
    __pyx_r = __pyx_mstate_global->__pyx_n_u_entities;
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":130
 *        elif type == tree.XML_ATTRIBUTE_ENTITY:
 *            return "entity"
 *        elif type == tree.XML_ATTRIBUTE_ENTITIES:             # <<<<<<<<<<<<<<
 *            return "entities"
 *        elif type == tree.XML_ATTRIBUTE_NMTOKEN:
*/
    break;
    case XML_ATTRIBUTE_NMTOKEN:

    /* "src/lxml/dtd.pxi":133
 *            return "entities"
 *        elif type == tree.XML_ATTRIBUTE_NMTOKEN:
 *            return "nmtoken"             # <<<<<<<<<<<<<<
 *        elif type == tree.XML_ATTRIBUTE_NMTOKENS:
 *            return "nmtokens"
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_nmtoken);
    __pyx_r = __pyx_mstate_global->__pyx_n_u_nmtoken;
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":132
 *        elif type == tree.XML_ATTRIBUTE_ENTITIES:
 *            return "entities"
 *        elif type == tree.XML_ATTRIBUTE_NMTOKEN:             # <<<<<<<<<<<<<<
 *            return "nmtoken"
 *        elif type == tree.XML_ATTRIBUTE_NMTOKENS:
*/
    break;
    case XML_ATTRIBUTE_NMTOKENS:

    /* "src/lxml/dtd.pxi":135
 *            return "nmtoken"
 *        elif type == tree.XML_ATTRIBUTE_NMTOKENS:
 *            return "nmtokens"             # <<<<<<<<<<<<<<
 *        elif type == tree.XML_ATTRIBUTE_ENUMERATION:
 *            return "enumeration"
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_nmtokens);
    __pyx_r = __pyx_mstate_global->__pyx_n_u_nmtokens;
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":134
 *        elif type == tree.XML_ATTRIBUTE_NMTOKEN:
 *            return "nmtoken"
 *        elif type == tree.XML_ATTRIBUTE_NMTOKENS:             # <<<<<<<<<<<<<<
 *            return "nmtokens"
 *        elif type == tree.XML_ATTRIBUTE_ENUMERATION:
*/
    break;
    case XML_ATTRIBUTE_ENUMERATION:

    /* "src/lxml/dtd.pxi":137
 *            return "nmtokens"
 *        elif type == tree.XML_ATTRIBUTE_ENUMERATION:
 *            return "enumeration"             # <<<<<<<<<<<<<<
 *        elif type == tree.XML_ATTRIBUTE_NOTATION:
 *            return "notation"
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_enumeration);
    __pyx_r = __pyx_mstate_global->__pyx_n_u_enumeration;
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":136
 *        elif type == tree.XML_ATTRIBUTE_NMTOKENS:
 *            return "nmtokens"
 *        elif type == tree.XML_ATTRIBUTE_ENUMERATION:             # <<<<<<<<<<<<<<
 *            return "enumeration"
 *        elif type == tree.XML_ATTRIBUTE_NOTATION:
*/
    break;
    case XML_ATTRIBUTE_NOTATION:

    /* "src/lxml/dtd.pxi":139
 *            return "enumeration"
 *        elif type == tree.XML_ATTRIBUTE_NOTATION:
 *            return "notation"             # <<<<<<<<<<<<<<
 *        else:
 *            return None
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_notation);
    __pyx_r = __pyx_mstate_global->__pyx_n_u_notation;
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":138
 *        elif type == tree.XML_ATTRIBUTE_ENUMERATION:
 *            return "enumeration"
 *        elif type == tree.XML_ATTRIBUTE_NOTATION:             # <<<<<<<<<<<<<<
 *            return "notation"
 *        else:
*/
    break;
    default:

    /* "src/lxml/dtd.pxi":141
 *            return "notation"
 *        else:
 *            return None             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
    break;
  }

  /* "src/lxml/dtd.pxi":116
 *        return funicodeOrNone(self._c_node.prefix)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def type(self):
 *        _assertValidDTDNode(self, self._c_node)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._DTDAttributeDecl.type.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/dtd.pxi":143
 *            return None
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def default(self):
 *        _assertValidDTDNode(self, self._c_node)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_17_DTDAttributeDecl_7default_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_17_DTDAttributeDecl_7default_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_17_DTDAttributeDecl_7default___get__(((struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_17_DTDAttributeDecl_7default___get__(struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *__pyx_v_self) {
  int __pyx_v_default;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  xmlAttributeDefault __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "src/lxml/dtd.pxi":145
 *     @property
 *     def default(self):
 *        _assertValidDTDNode(self, self._c_node)             # <<<<<<<<<<<<<<
 *        cdef int default = self._c_node.def_
 *        if default == tree.XML_ATTRIBUTE_NONE:
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidDTDNode(((PyObject *)__pyx_v_self), __pyx_v_self->_c_node); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(21, 145, __pyx_L1_error)

  /* "src/lxml/dtd.pxi":146
 *     def default(self):
 *        _assertValidDTDNode(self, self._c_node)
 *        cdef int default = self._c_node.def_             # <<<<<<<<<<<<<<
 *        if default == tree.XML_ATTRIBUTE_NONE:
 *            return "none"
*/
  __pyx_t_2 = __pyx_v_self->_c_node->def;
  __pyx_v_default = __pyx_t_2;

  /* "src/lxml/dtd.pxi":147
 *        _assertValidDTDNode(self, self._c_node)
 *        cdef int default = self._c_node.def_
 *        if default == tree.XML_ATTRIBUTE_NONE:             # <<<<<<<<<<<<<<
 *            return "none"
 *        elif default == tree.XML_ATTRIBUTE_REQUIRED:
*/
  switch (__pyx_v_default) {
    case XML_ATTRIBUTE_NONE:

    /* "src/lxml/dtd.pxi":148
 *        cdef int default = self._c_node.def_
 *        if default == tree.XML_ATTRIBUTE_NONE:
 *            return "none"             # <<<<<<<<<<<<<<
 *        elif default == tree.XML_ATTRIBUTE_REQUIRED:
 *            return "required"
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_none);
    __pyx_r = __pyx_mstate_global->__pyx_n_u_none;
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":147
 *        _assertValidDTDNode(self, self._c_node)
 *        cdef int default = self._c_node.def_
 *        if default == tree.XML_ATTRIBUTE_NONE:             # <<<<<<<<<<<<<<
 *            return "none"
 *        elif default == tree.XML_ATTRIBUTE_REQUIRED:
*/
    break;
    case XML_ATTRIBUTE_REQUIRED:

    /* "src/lxml/dtd.pxi":150
 *            return "none"
 *        elif default == tree.XML_ATTRIBUTE_REQUIRED:
 *            return "required"             # <<<<<<<<<<<<<<
 *        elif default == tree.XML_ATTRIBUTE_IMPLIED:
 *            return "implied"
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_required);
    __pyx_r = __pyx_mstate_global->__pyx_n_u_required;
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":149
 *        if default == tree.XML_ATTRIBUTE_NONE:
 *            return "none"
 *        elif default == tree.XML_ATTRIBUTE_REQUIRED:             # <<<<<<<<<<<<<<
 *            return "required"
 *        elif default == tree.XML_ATTRIBUTE_IMPLIED:
*/
    break;
    case XML_ATTRIBUTE_IMPLIED:

    /* "src/lxml/dtd.pxi":152
 *            return "required"
 *        elif default == tree.XML_ATTRIBUTE_IMPLIED:
 *            return "implied"             # <<<<<<<<<<<<<<
 *        elif default == tree.XML_ATTRIBUTE_FIXED:
 *            return "fixed"
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_implied);
    __pyx_r = __pyx_mstate_global->__pyx_n_u_implied;
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":151
 *        elif default == tree.XML_ATTRIBUTE_REQUIRED:
 *            return "required"
 *        elif default == tree.XML_ATTRIBUTE_IMPLIED:             # <<<<<<<<<<<<<<
 *            return "implied"
 *        elif default == tree.XML_ATTRIBUTE_FIXED:
*/
    break;
    case XML_ATTRIBUTE_FIXED:

    /* "src/lxml/dtd.pxi":154
 *            return "implied"
 *        elif default == tree.XML_ATTRIBUTE_FIXED:
 *            return "fixed"             # <<<<<<<<<<<<<<
 *        else:
 *            return None
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_fixed);
    __pyx_r = __pyx_mstate_global->__pyx_n_u_fixed;
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":153
 *        elif default == tree.XML_ATTRIBUTE_IMPLIED:
 *            return "implied"
 *        elif default == tree.XML_ATTRIBUTE_FIXED:             # <<<<<<<<<<<<<<
 *            return "fixed"
 *        else:
*/
    break;
    default:

    /* "src/lxml/dtd.pxi":156
 *            return "fixed"
 *        else:
 *            return None             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
    break;
  }

  /* "src/lxml/dtd.pxi":143
 *            return None
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def default(self):
 *        _assertValidDTDNode(self, self._c_node)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._DTDAttributeDecl.default.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/dtd.pxi":158
 *            return None
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def default_value(self):
 *        _assertValidDTDNode(self, self._c_node)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_17_DTDAttributeDecl_13default_value_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_17_DTDAttributeDecl_13default_value_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_17_DTDAttributeDecl_13default_value___get__(((struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_17_DTDAttributeDecl_13default_value___get__(struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "src/lxml/dtd.pxi":160
 *     @property
 *     def default_value(self):
 *        _assertValidDTDNode(self, self._c_node)             # <<<<<<<<<<<<<<
 *        return funicodeOrNone(self._c_node.defaultValue)
 * 
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidDTDNode(((PyObject *)__pyx_v_self), __pyx_v_self->_c_node); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(21, 160, __pyx_L1_error)

  /* "src/lxml/dtd.pxi":161
 *     def default_value(self):
 *        _assertValidDTDNode(self, self._c_node)
 *        return funicodeOrNone(self._c_node.defaultValue)             # <<<<<<<<<<<<<<
 * 
 *     def itervalues(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree_funicodeOrNone(__pyx_v_self->_c_node->defaultValue); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 161, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/dtd.pxi":158
 *            return None
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def default_value(self):
 *        _assertValidDTDNode(self, self._c_node)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._DTDAttributeDecl.default_value.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_4lxml_5etree_17_DTDAttributeDecl_4generator13(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "src/lxml/dtd.pxi":163
 *        return funicodeOrNone(self._c_node.defaultValue)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         _assertValidDTDNode(self, self._c_node)
 *         cdef tree.xmlEnumeration *c_node = self._c_node.tree
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_17_DTDAttributeDecl_3itervalues(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_17_DTDAttributeDecl_3itervalues = {"itervalues", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_17_DTDAttributeDecl_3itervalues, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_17_DTDAttributeDecl_3itervalues(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("itervalues (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("itervalues", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("itervalues", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_17_DTDAttributeDecl_2itervalues(((struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_17_DTDAttributeDecl_2itervalues(struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_13_itervalues *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("itervalues", 0);
  __pyx_cur_scope = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_13_itervalues *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_13_itervalues(__pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_13_itervalues, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_13_itervalues *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(21, 163, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4lxml_5etree_17_DTDAttributeDecl_4generator13, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[14]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_itervalues, __pyx_mstate_global->__pyx_n_u_DTDAttributeDecl_itervalues, __pyx_mstate_global->__pyx_n_u_lxml_etree); if (unlikely(!gen)) __PYX_ERR(21, 163, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._DTDAttributeDecl.itervalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_4lxml_5etree_17_DTDAttributeDecl_4generator13(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_13_itervalues *__pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_13_itervalues *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  xmlEnumeration *__pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("itervalues", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(__pyx_sent_value != Py_None)) {
    if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator");
    __PYX_ERR(21, 163, __pyx_L1_error)
  }

  /* "src/lxml/dtd.pxi":164
 * 
 *     def itervalues(self):
 *         _assertValidDTDNode(self, self._c_node)             # <<<<<<<<<<<<<<
 *         cdef tree.xmlEnumeration *c_node = self._c_node.tree
 *         while c_node is not NULL:
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidDTDNode(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_self->_c_node); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(21, 164, __pyx_L1_error)

  /* "src/lxml/dtd.pxi":165
 *     def itervalues(self):
 *         _assertValidDTDNode(self, self._c_node)
 *         cdef tree.xmlEnumeration *c_node = self._c_node.tree             # <<<<<<<<<<<<<<
 *         while c_node is not NULL:
 *             yield funicode(c_node.name)
*/
  __pyx_t_2 = __pyx_cur_scope->__pyx_v_self->_c_node->tree;
  __pyx_cur_scope->__pyx_v_c_node = __pyx_t_2;

  /* "src/lxml/dtd.pxi":166
 *         _assertValidDTDNode(self, self._c_node)
 *         cdef tree.xmlEnumeration *c_node = self._c_node.tree
 *         while c_node is not NULL:             # <<<<<<<<<<<<<<
 *             yield funicode(c_node.name)
 *             c_node = c_node.next
*/
  while (1) {
    __pyx_t_3 = (__pyx_cur_scope->__pyx_v_c_node != NULL);
    if (!__pyx_t_3) break;

    /* "src/lxml/dtd.pxi":167
 *         cdef tree.xmlEnumeration *c_node = self._c_node.tree
 *         while c_node is not NULL:
 *             yield funicode(c_node.name)             # <<<<<<<<<<<<<<
 *             c_node = c_node.next
 * 
*/
    __pyx_t_4 = __pyx_f_4lxml_5etree_funicode(__pyx_cur_scope->__pyx_v_c_node->name); if (unlikely(!__pyx_t_4)) __PYX_ERR(21, 167, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(21, 167, __pyx_L1_error)

    /* "src/lxml/dtd.pxi":168
 *         while c_node is not NULL:
 *             yield funicode(c_node.name)
 *             c_node = c_node.next             # <<<<<<<<<<<<<<
 * 
 *     def values(self):
*/
    __pyx_t_2 = __pyx_cur_scope->__pyx_v_c_node->next;
    __pyx_cur_scope->__pyx_v_c_node = __pyx_t_2;
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "src/lxml/dtd.pxi":163
 *        return funicodeOrNone(self._c_node.defaultValue)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         _assertValidDTDNode(self, self._c_node)
 *         cdef tree.xmlEnumeration *c_node = self._c_node.tree
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("itervalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/dtd.pxi":170
 *             c_node = c_node.next
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         return list(self.itervalues())
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_17_DTDAttributeDecl_6values(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_17_DTDAttributeDecl_6values = {"values", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_17_DTDAttributeDecl_6values, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_17_DTDAttributeDecl_6values(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("values (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("values", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("values", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_17_DTDAttributeDecl_5values(((struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_17_DTDAttributeDecl_5values(struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("values", 0);

  /* "src/lxml/dtd.pxi":171
 * 
 *     def values(self):
 *         return list(self.itervalues())             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_itervalues, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 171, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_2 = __Pyx_PySequence_ListKeepNew(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 171, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/dtd.pxi":170
 *             c_node = c_node.next
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         return list(self.itervalues())
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._DTDAttributeDecl.values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/dtd.pxi":181
 *     cdef tree.xmlElement* _c_node
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "<%s.%s object name=%r prefix=%r type=%r at 0x%x>" % (self.__class__.__module__, self.__class__.__name__, self.name, self.prefix, self.type, id(self))
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_15_DTDElementDecl_1__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_15_DTDElementDecl_1__repr__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_15_DTDElementDecl___repr__(((struct __pyx_obj_4lxml_5etree__DTDElementDecl *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_15_DTDElementDecl___repr__(struct __pyx_obj_4lxml_5etree__DTDElementDecl *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8[13];
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "src/lxml/dtd.pxi":182
 * 
 *     def __repr__(self):
 *         return "<%s.%s object name=%r prefix=%r type=%r at 0x%x>" % (self.__class__.__module__, self.__class__.__name__, self.name, self.prefix, self.type, id(self))             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_class); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_module_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_t_2), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_name_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_t_3), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_3), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(21, 182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_prefix); if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_3), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(21, 182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_type); if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_3), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(21, 182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = __Pyx_PyObject_Format(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_x); if (unlikely(!__pyx_t_7)) __PYX_ERR(21, 182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_8[0] = __pyx_mstate_global->__pyx_kp_u__37;
  __pyx_t_8[1] = __pyx_t_1;
  __pyx_t_8[2] = __pyx_mstate_global->__pyx_kp_u__2;
  __pyx_t_8[3] = __pyx_t_2;
  __pyx_t_8[4] = __pyx_mstate_global->__pyx_kp_u_object_name;
  __pyx_t_8[5] = __pyx_t_4;
  __pyx_t_8[6] = __pyx_mstate_global->__pyx_kp_u_prefix_2;
  __pyx_t_8[7] = __pyx_t_5;
  __pyx_t_8[8] = __pyx_mstate_global->__pyx_kp_u_type_3;
  __pyx_t_8[9] = __pyx_t_6;
  __pyx_t_8[10] = __pyx_mstate_global->__pyx_kp_u_at_0x;
  __pyx_t_8[11] = __pyx_t_7;
  __pyx_t_8[12] = __pyx_mstate_global->__pyx_kp_u__3;
  __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_8, 13, 1 * 3 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 13 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4) + 8 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 6 * 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7));
  if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "src/lxml/dtd.pxi":181
 *     cdef tree.xmlElement* _c_node
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "<%s.%s object name=%r prefix=%r type=%r at 0x%x>" % (self.__class__.__module__, self.__class__.__name__, self.name, self.prefix, self.type, id(self))
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree._DTDElementDecl.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/dtd.pxi":184
 *         return "<%s.%s object name=%r prefix=%r type=%r at 0x%x>" % (self.__class__.__module__, self.__class__.__name__, self.name, self.prefix, self.type, id(self))
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def name(self):
 *         _assertValidDTDNode(self, self._c_node)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_15_DTDElementDecl_4name_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_15_DTDElementDecl_4name_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_15_DTDElementDecl_4name___get__(((struct __pyx_obj_4lxml_5etree__DTDElementDecl *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_15_DTDElementDecl_4name___get__(struct __pyx_obj_4lxml_5etree__DTDElementDecl *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "src/lxml/dtd.pxi":186
 *     @property
 *     def name(self):
 *         _assertValidDTDNode(self, self._c_node)             # <<<<<<<<<<<<<<
 *         return funicodeOrNone(self._c_node.name)
 * 
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidDTDNode(((PyObject *)__pyx_v_self), __pyx_v_self->_c_node); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(21, 186, __pyx_L1_error)

  /* "src/lxml/dtd.pxi":187
 *     def name(self):
 *         _assertValidDTDNode(self, self._c_node)
 *         return funicodeOrNone(self._c_node.name)             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree_funicodeOrNone(__pyx_v_self->_c_node->name); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 187, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/dtd.pxi":184
 *         return "<%s.%s object name=%r prefix=%r type=%r at 0x%x>" % (self.__class__.__module__, self.__class__.__name__, self.name, self.prefix, self.type, id(self))
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def name(self):
 *         _assertValidDTDNode(self, self._c_node)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._DTDElementDecl.name.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/dtd.pxi":189
 *         return funicodeOrNone(self._c_node.name)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def prefix(self):
 *        _assertValidDTDNode(self, self._c_node)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_15_DTDElementDecl_6prefix_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_15_DTDElementDecl_6prefix_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_15_DTDElementDecl_6prefix___get__(((struct __pyx_obj_4lxml_5etree__DTDElementDecl *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_15_DTDElementDecl_6prefix___get__(struct __pyx_obj_4lxml_5etree__DTDElementDecl *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "src/lxml/dtd.pxi":191
 *     @property
 *     def prefix(self):
 *        _assertValidDTDNode(self, self._c_node)             # <<<<<<<<<<<<<<
 *        return funicodeOrNone(self._c_node.prefix)
 * 
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidDTDNode(((PyObject *)__pyx_v_self), __pyx_v_self->_c_node); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(21, 191, __pyx_L1_error)

  /* "src/lxml/dtd.pxi":192
 *     def prefix(self):
 *        _assertValidDTDNode(self, self._c_node)
 *        return funicodeOrNone(self._c_node.prefix)             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree_funicodeOrNone(__pyx_v_self->_c_node->prefix); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 192, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/dtd.pxi":189
 *         return funicodeOrNone(self._c_node.name)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def prefix(self):
 *        _assertValidDTDNode(self, self._c_node)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._DTDElementDecl.prefix.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/dtd.pxi":194
 *        return funicodeOrNone(self._c_node.prefix)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def type(self):
 *        _assertValidDTDNode(self, self._c_node)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_15_DTDElementDecl_4type_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_15_DTDElementDecl_4type_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_15_DTDElementDecl_4type___get__(((struct __pyx_obj_4lxml_5etree__DTDElementDecl *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_15_DTDElementDecl_4type___get__(struct __pyx_obj_4lxml_5etree__DTDElementDecl *__pyx_v_self) {
  int __pyx_v_type;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  xmlElementTypeVal __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "src/lxml/dtd.pxi":196
 *     @property
 *     def type(self):
 *        _assertValidDTDNode(self, self._c_node)             # <<<<<<<<<<<<<<
 *        cdef int type = self._c_node.etype
 *        if type == tree.XML_ELEMENT_TYPE_UNDEFINED:
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidDTDNode(((PyObject *)__pyx_v_self), __pyx_v_self->_c_node); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(21, 196, __pyx_L1_error)

  /* "src/lxml/dtd.pxi":197
 *     def type(self):
 *        _assertValidDTDNode(self, self._c_node)
 *        cdef int type = self._c_node.etype             # <<<<<<<<<<<<<<
 *        if type == tree.XML_ELEMENT_TYPE_UNDEFINED:
 *            return "undefined"
*/
  __pyx_t_2 = __pyx_v_self->_c_node->etype;
  __pyx_v_type = __pyx_t_2;

  /* "src/lxml/dtd.pxi":198
 *        _assertValidDTDNode(self, self._c_node)
 *        cdef int type = self._c_node.etype
 *        if type == tree.XML_ELEMENT_TYPE_UNDEFINED:             # <<<<<<<<<<<<<<
 *            return "undefined"
 *        elif type == tree.XML_ELEMENT_TYPE_EMPTY:
*/
  switch (__pyx_v_type) {
    case XML_ELEMENT_TYPE_UNDEFINED:

    /* "src/lxml/dtd.pxi":199
 *        cdef int type = self._c_node.etype
 *        if type == tree.XML_ELEMENT_TYPE_UNDEFINED:
 *            return "undefined"             # <<<<<<<<<<<<<<
 *        elif type == tree.XML_ELEMENT_TYPE_EMPTY:
 *            return "empty"
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_undefined);
    __pyx_r = __pyx_mstate_global->__pyx_n_u_undefined;
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":198
 *        _assertValidDTDNode(self, self._c_node)
 *        cdef int type = self._c_node.etype
 *        if type == tree.XML_ELEMENT_TYPE_UNDEFINED:             # <<<<<<<<<<<<<<
 *            return "undefined"
 *        elif type == tree.XML_ELEMENT_TYPE_EMPTY:
*/
    break;
    case XML_ELEMENT_TYPE_EMPTY:

    /* "src/lxml/dtd.pxi":201
 *            return "undefined"
 *        elif type == tree.XML_ELEMENT_TYPE_EMPTY:
 *            return "empty"             # <<<<<<<<<<<<<<
 *        elif type == tree.XML_ELEMENT_TYPE_ANY:
 *            return "any"
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_empty);
    __pyx_r = __pyx_mstate_global->__pyx_n_u_empty;
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":200
 *        if type == tree.XML_ELEMENT_TYPE_UNDEFINED:
 *            return "undefined"
 *        elif type == tree.XML_ELEMENT_TYPE_EMPTY:             # <<<<<<<<<<<<<<
 *            return "empty"
 *        elif type == tree.XML_ELEMENT_TYPE_ANY:
*/
    break;
    case XML_ELEMENT_TYPE_ANY:

    /* "src/lxml/dtd.pxi":203
 *            return "empty"
 *        elif type == tree.XML_ELEMENT_TYPE_ANY:
 *            return "any"             # <<<<<<<<<<<<<<
 *        elif type == tree.XML_ELEMENT_TYPE_MIXED:
 *            return "mixed"
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_any);
    __pyx_r = __pyx_mstate_global->__pyx_n_u_any;
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":202
 *        elif type == tree.XML_ELEMENT_TYPE_EMPTY:
 *            return "empty"
 *        elif type == tree.XML_ELEMENT_TYPE_ANY:             # <<<<<<<<<<<<<<
 *            return "any"
 *        elif type == tree.XML_ELEMENT_TYPE_MIXED:
*/
    break;
    case XML_ELEMENT_TYPE_MIXED:

    /* "src/lxml/dtd.pxi":205
 *            return "any"
 *        elif type == tree.XML_ELEMENT_TYPE_MIXED:
 *            return "mixed"             # <<<<<<<<<<<<<<
 *        elif type == tree.XML_ELEMENT_TYPE_ELEMENT:
 *            return "element"
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_mixed);
    __pyx_r = __pyx_mstate_global->__pyx_n_u_mixed;
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":204
 *        elif type == tree.XML_ELEMENT_TYPE_ANY:
 *            return "any"
 *        elif type == tree.XML_ELEMENT_TYPE_MIXED:             # <<<<<<<<<<<<<<
 *            return "mixed"
 *        elif type == tree.XML_ELEMENT_TYPE_ELEMENT:
*/
    break;
    case XML_ELEMENT_TYPE_ELEMENT:

    /* "src/lxml/dtd.pxi":207
 *            return "mixed"
 *        elif type == tree.XML_ELEMENT_TYPE_ELEMENT:
 *            return "element"             # <<<<<<<<<<<<<<
 *        else:
 *            return None
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_element);
    __pyx_r = __pyx_mstate_global->__pyx_n_u_element;
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":206
 *        elif type == tree.XML_ELEMENT_TYPE_MIXED:
 *            return "mixed"
 *        elif type == tree.XML_ELEMENT_TYPE_ELEMENT:             # <<<<<<<<<<<<<<
 *            return "element"
 *        else:
*/
    break;
    default:

    /* "src/lxml/dtd.pxi":209
 *            return "element"
 *        else:
 *            return None             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
    break;
  }

  /* "src/lxml/dtd.pxi":194
 *        return funicodeOrNone(self._c_node.prefix)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def type(self):
 *        _assertValidDTDNode(self, self._c_node)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._DTDElementDecl.type.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/dtd.pxi":211
 *            return None
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def content(self):
 *        _assertValidDTDNode(self, self._c_node)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_15_DTDElementDecl_7content_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_15_DTDElementDecl_7content_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_15_DTDElementDecl_7content___get__(((struct __pyx_obj_4lxml_5etree__DTDElementDecl *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_15_DTDElementDecl_7content___get__(struct __pyx_obj_4lxml_5etree__DTDElementDecl *__pyx_v_self) {
  xmlElementContent *__pyx_v_content;
  struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *__pyx_v_node = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  xmlElementContent *__pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "src/lxml/dtd.pxi":213
 *     @property
 *     def content(self):
 *        _assertValidDTDNode(self, self._c_node)             # <<<<<<<<<<<<<<
 *        cdef tree.xmlElementContent *content = self._c_node.content
 *        if content:
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidDTDNode(((PyObject *)__pyx_v_self), __pyx_v_self->_c_node); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(21, 213, __pyx_L1_error)

  /* "src/lxml/dtd.pxi":214
 *     def content(self):
 *        _assertValidDTDNode(self, self._c_node)
 *        cdef tree.xmlElementContent *content = self._c_node.content             # <<<<<<<<<<<<<<
 *        if content:
 *            node = <_DTDElementContentDecl>_DTDElementContentDecl.__new__(_DTDElementContentDecl)
*/
  __pyx_t_2 = __pyx_v_self->_c_node->content;
  __pyx_v_content = __pyx_t_2;

  /* "src/lxml/dtd.pxi":215
 *        _assertValidDTDNode(self, self._c_node)
 *        cdef tree.xmlElementContent *content = self._c_node.content
 *        if content:             # <<<<<<<<<<<<<<
 *            node = <_DTDElementContentDecl>_DTDElementContentDecl.__new__(_DTDElementContentDecl)
 *            node._dtd = self._dtd
*/
  __pyx_t_3 = (__pyx_v_content != 0);
  if (__pyx_t_3) {

    /* "src/lxml/dtd.pxi":216
 *        cdef tree.xmlElementContent *content = self._c_node.content
 *        if content:
 *            node = <_DTDElementContentDecl>_DTDElementContentDecl.__new__(_DTDElementContentDecl)             # <<<<<<<<<<<<<<
 *            node._dtd = self._dtd
 *            node._c_node = content
*/
    __pyx_t_4 = ((PyObject *)__pyx_tp_new_4lxml_5etree__DTDElementContentDecl(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__DTDElementContentDecl), __pyx_mstate_global->__pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_4)) __PYX_ERR(21, 216, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_4);
    __pyx_t_5 = ((PyObject *)__pyx_t_4);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_DECREF((PyObject *)__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_node = ((struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "src/lxml/dtd.pxi":217
 *        if content:
 *            node = <_DTDElementContentDecl>_DTDElementContentDecl.__new__(_DTDElementContentDecl)
 *            node._dtd = self._dtd             # <<<<<<<<<<<<<<
 *            node._c_node = content
 *            return node
*/
    __pyx_t_5 = ((PyObject *)__pyx_v_self->_dtd);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __Pyx_GOTREF((PyObject *)__pyx_v_node->_dtd);
    __Pyx_DECREF((PyObject *)__pyx_v_node->_dtd);
    __pyx_v_node->_dtd = ((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "src/lxml/dtd.pxi":218
 *            node = <_DTDElementContentDecl>_DTDElementContentDecl.__new__(_DTDElementContentDecl)
 *            node._dtd = self._dtd
 *            node._c_node = content             # <<<<<<<<<<<<<<
 *            return node
 *        else:
*/
    __pyx_v_node->_c_node = __pyx_v_content;

    /* "src/lxml/dtd.pxi":219
 *            node._dtd = self._dtd
 *            node._c_node = content
 *            return node             # <<<<<<<<<<<<<<
 *        else:
 *            return None
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF((PyObject *)__pyx_v_node);
    __pyx_r = ((PyObject *)__pyx_v_node);
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":215
 *        _assertValidDTDNode(self, self._c_node)
 *        cdef tree.xmlElementContent *content = self._c_node.content
 *        if content:             # <<<<<<<<<<<<<<
 *            node = <_DTDElementContentDecl>_DTDElementContentDecl.__new__(_DTDElementContentDecl)
 *            node._dtd = self._dtd
*/
  }

  /* "src/lxml/dtd.pxi":221
 *            return node
 *        else:
 *            return None             # <<<<<<<<<<<<<<
 * 
 *     def iterattributes(self):
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "src/lxml/dtd.pxi":211
 *            return None
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def content(self):
 *        _assertValidDTDNode(self, self._c_node)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._DTDElementDecl.content.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_node);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_4lxml_5etree_15_DTDElementDecl_4generator14(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "src/lxml/dtd.pxi":223
 *            return None
 * 
 *     def iterattributes(self):             # <<<<<<<<<<<<<<
 *         _assertValidDTDNode(self, self._c_node)
 *         cdef tree.xmlAttribute *c_node = self._c_node.attributes
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_15_DTDElementDecl_3iterattributes(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_15_DTDElementDecl_3iterattributes = {"iterattributes", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_15_DTDElementDecl_3iterattributes, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_15_DTDElementDecl_3iterattributes(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iterattributes (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("iterattributes", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("iterattributes", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_15_DTDElementDecl_2iterattributes(((struct __pyx_obj_4lxml_5etree__DTDElementDecl *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_15_DTDElementDecl_2iterattributes(struct __pyx_obj_4lxml_5etree__DTDElementDecl *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_14_iterattributes *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("iterattributes", 0);
  __pyx_cur_scope = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_14_iterattributes *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_14_iterattributes(__pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_14_iterattributes, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_14_iterattributes *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(21, 223, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4lxml_5etree_15_DTDElementDecl_4generator14, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[15]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_iterattributes, __pyx_mstate_global->__pyx_n_u_DTDElementDecl_iterattributes, __pyx_mstate_global->__pyx_n_u_lxml_etree); if (unlikely(!gen)) __PYX_ERR(21, 223, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._DTDElementDecl.iterattributes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_4lxml_5etree_15_DTDElementDecl_4generator14(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_14_iterattributes *__pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_14_iterattributes *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  xmlAttribute *__pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iterattributes", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(__pyx_sent_value != Py_None)) {
    if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator");
    __PYX_ERR(21, 223, __pyx_L1_error)
  }

  /* "src/lxml/dtd.pxi":224
 * 
 *     def iterattributes(self):
 *         _assertValidDTDNode(self, self._c_node)             # <<<<<<<<<<<<<<
 *         cdef tree.xmlAttribute *c_node = self._c_node.attributes
 *         while c_node:
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidDTDNode(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_self->_c_node); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(21, 224, __pyx_L1_error)

  /* "src/lxml/dtd.pxi":225
 *     def iterattributes(self):
 *         _assertValidDTDNode(self, self._c_node)
 *         cdef tree.xmlAttribute *c_node = self._c_node.attributes             # <<<<<<<<<<<<<<
 *         while c_node:
 *             node = <_DTDAttributeDecl>_DTDAttributeDecl.__new__(_DTDAttributeDecl)
*/
  __pyx_t_2 = __pyx_cur_scope->__pyx_v_self->_c_node->attributes;
  __pyx_cur_scope->__pyx_v_c_node = __pyx_t_2;

  /* "src/lxml/dtd.pxi":226
 *         _assertValidDTDNode(self, self._c_node)
 *         cdef tree.xmlAttribute *c_node = self._c_node.attributes
 *         while c_node:             # <<<<<<<<<<<<<<
 *             node = <_DTDAttributeDecl>_DTDAttributeDecl.__new__(_DTDAttributeDecl)
 *             node._dtd = self._dtd
*/
  while (1) {
    __pyx_t_3 = (__pyx_cur_scope->__pyx_v_c_node != 0);
    if (!__pyx_t_3) break;

    /* "src/lxml/dtd.pxi":227
 *         cdef tree.xmlAttribute *c_node = self._c_node.attributes
 *         while c_node:
 *             node = <_DTDAttributeDecl>_DTDAttributeDecl.__new__(_DTDAttributeDecl)             # <<<<<<<<<<<<<<
 *             node._dtd = self._dtd
 *             node._c_node = c_node
*/
    __pyx_t_4 = ((PyObject *)__pyx_tp_new_4lxml_5etree__DTDAttributeDecl(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__DTDAttributeDecl), __pyx_mstate_global->__pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_4)) __PYX_ERR(21, 227, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_4);
    __pyx_t_5 = ((PyObject *)__pyx_t_4);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_DECREF((PyObject *)__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XGOTREF((PyObject *)__pyx_cur_scope->__pyx_v_node);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_node, ((struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *)__pyx_t_5));
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_5 = 0;

    /* "src/lxml/dtd.pxi":228
 *         while c_node:
 *             node = <_DTDAttributeDecl>_DTDAttributeDecl.__new__(_DTDAttributeDecl)
 *             node._dtd = self._dtd             # <<<<<<<<<<<<<<
 *             node._c_node = c_node
 *             yield node
*/
    __pyx_t_5 = ((PyObject *)__pyx_cur_scope->__pyx_v_self->_dtd);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope->__pyx_v_node->_dtd);
    __Pyx_DECREF((PyObject *)__pyx_cur_scope->__pyx_v_node->_dtd);
    __pyx_cur_scope->__pyx_v_node->_dtd = ((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "src/lxml/dtd.pxi":229
 *             node = <_DTDAttributeDecl>_DTDAttributeDecl.__new__(_DTDAttributeDecl)
 *             node._dtd = self._dtd
 *             node._c_node = c_node             # <<<<<<<<<<<<<<
 *             yield node
 *             c_node = c_node.nexth
*/
    __pyx_cur_scope->__pyx_v_node->_c_node = __pyx_cur_scope->__pyx_v_c_node;

    /* "src/lxml/dtd.pxi":230
 *             node._dtd = self._dtd
 *             node._c_node = c_node
 *             yield node             # <<<<<<<<<<<<<<
 *             c_node = c_node.nexth
 * 
*/
    __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_node);
    __pyx_r = ((PyObject *)__pyx_cur_scope->__pyx_v_node);
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(21, 230, __pyx_L1_error)

    /* "src/lxml/dtd.pxi":231
 *             node._c_node = c_node
 *             yield node
 *             c_node = c_node.nexth             # <<<<<<<<<<<<<<
 * 
 *     def attributes(self):
*/
    __pyx_t_2 = __pyx_cur_scope->__pyx_v_c_node->nexth;
    __pyx_cur_scope->__pyx_v_c_node = __pyx_t_2;
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "src/lxml/dtd.pxi":223
 *            return None
 * 
 *     def iterattributes(self):             # <<<<<<<<<<<<<<
 *         _assertValidDTDNode(self, self._c_node)
 *         cdef tree.xmlAttribute *c_node = self._c_node.attributes
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("iterattributes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/dtd.pxi":233
 *             c_node = c_node.nexth
 * 
 *     def attributes(self):             # <<<<<<<<<<<<<<
 *         return list(self.iterattributes())
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_15_DTDElementDecl_6attributes(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_15_DTDElementDecl_6attributes = {"attributes", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_15_DTDElementDecl_6attributes, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_15_DTDElementDecl_6attributes(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("attributes (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("attributes", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("attributes", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_15_DTDElementDecl_5attributes(((struct __pyx_obj_4lxml_5etree__DTDElementDecl *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_15_DTDElementDecl_5attributes(struct __pyx_obj_4lxml_5etree__DTDElementDecl *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("attributes", 0);

  /* "src/lxml/dtd.pxi":234
 * 
 *     def attributes(self):
 *         return list(self.iterattributes())             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_iterattributes, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 234, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_2 = __Pyx_PySequence_ListKeepNew(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 234, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/dtd.pxi":233
 *             c_node = c_node.nexth
 * 
 *     def attributes(self):             # <<<<<<<<<<<<<<
 *         return list(self.iterattributes())
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._DTDElementDecl.attributes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/dtd.pxi":243
 *     cdef DTD _dtd
 *     cdef tree.xmlEntity* _c_node
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "<%s.%s object name=%r at 0x%x>" % (self.__class__.__module__, self.__class__.__name__, self.name, id(self))
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_14_DTDEntityDecl_1__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_14_DTDEntityDecl_1__repr__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_14_DTDEntityDecl___repr__(((struct __pyx_obj_4lxml_5etree__DTDEntityDecl *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_14_DTDEntityDecl___repr__(struct __pyx_obj_4lxml_5etree__DTDEntityDecl *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6[9];
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "src/lxml/dtd.pxi":244
 *     cdef tree.xmlEntity* _c_node
 *     def __repr__(self):
 *         return "<%s.%s object name=%r at 0x%x>" % (self.__class__.__module__, self.__class__.__name__, self.name, id(self))             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_class); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_module_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_t_2), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_name_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_t_3), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_3), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(21, 244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_Format(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_x); if (unlikely(!__pyx_t_5)) __PYX_ERR(21, 244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_6[0] = __pyx_mstate_global->__pyx_kp_u__37;
  __pyx_t_6[1] = __pyx_t_1;
  __pyx_t_6[2] = __pyx_mstate_global->__pyx_kp_u__2;
  __pyx_t_6[3] = __pyx_t_2;
  __pyx_t_6[4] = __pyx_mstate_global->__pyx_kp_u_object_name;
  __pyx_t_6[5] = __pyx_t_4;
  __pyx_t_6[6] = __pyx_mstate_global->__pyx_kp_u_at_0x;
  __pyx_t_6[7] = __pyx_t_5;
  __pyx_t_6[8] = __pyx_mstate_global->__pyx_kp_u__3;
  __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_6, 9, 1 * 3 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 13 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4) + 6 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5));
  if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "src/lxml/dtd.pxi":243
 *     cdef DTD _dtd
 *     cdef tree.xmlEntity* _c_node
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "<%s.%s object name=%r at 0x%x>" % (self.__class__.__module__, self.__class__.__name__, self.name, id(self))
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._DTDEntityDecl.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/dtd.pxi":246
 *         return "<%s.%s object name=%r at 0x%x>" % (self.__class__.__module__, self.__class__.__name__, self.name, id(self))
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def name(self):
 *         _assertValidDTDNode(self, self._c_node)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_14_DTDEntityDecl_4name_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_14_DTDEntityDecl_4name_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_14_DTDEntityDecl_4name___get__(((struct __pyx_obj_4lxml_5etree__DTDEntityDecl *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_14_DTDEntityDecl_4name___get__(struct __pyx_obj_4lxml_5etree__DTDEntityDecl *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "src/lxml/dtd.pxi":248
 *     @property
 *     def name(self):
 *         _assertValidDTDNode(self, self._c_node)             # <<<<<<<<<<<<<<
 *         return funicodeOrNone(self._c_node.name)
 * 
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidDTDNode(((PyObject *)__pyx_v_self), __pyx_v_self->_c_node); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(21, 248, __pyx_L1_error)

  /* "src/lxml/dtd.pxi":249
 *     def name(self):
 *         _assertValidDTDNode(self, self._c_node)
 *         return funicodeOrNone(self._c_node.name)             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree_funicodeOrNone(__pyx_v_self->_c_node->name); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 249, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/dtd.pxi":246
 *         return "<%s.%s object name=%r at 0x%x>" % (self.__class__.__module__, self.__class__.__name__, self.name, id(self))
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def name(self):
 *         _assertValidDTDNode(self, self._c_node)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._DTDEntityDecl.name.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/dtd.pxi":251
 *         return funicodeOrNone(self._c_node.name)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def orig(self):
 *         _assertValidDTDNode(self, self._c_node)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_14_DTDEntityDecl_4orig_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_14_DTDEntityDecl_4orig_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_14_DTDEntityDecl_4orig___get__(((struct __pyx_obj_4lxml_5etree__DTDEntityDecl *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_14_DTDEntityDecl_4orig___get__(struct __pyx_obj_4lxml_5etree__DTDEntityDecl *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "src/lxml/dtd.pxi":253
 *     @property
 *     def orig(self):
 *         _assertValidDTDNode(self, self._c_node)             # <<<<<<<<<<<<<<
 *         return funicodeOrNone(self._c_node.orig)
 * 
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidDTDNode(((PyObject *)__pyx_v_self), __pyx_v_self->_c_node); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(21, 253, __pyx_L1_error)

  /* "src/lxml/dtd.pxi":254
 *     def orig(self):
 *         _assertValidDTDNode(self, self._c_node)
 *         return funicodeOrNone(self._c_node.orig)             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree_funicodeOrNone(__pyx_v_self->_c_node->orig); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 254, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/dtd.pxi":251
 *         return funicodeOrNone(self._c_node.name)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def orig(self):
 *         _assertValidDTDNode(self, self._c_node)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._DTDEntityDecl.orig.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/dtd.pxi":256
 *         return funicodeOrNone(self._c_node.orig)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def content(self):
 *         _assertValidDTDNode(self, self._c_node)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_14_DTDEntityDecl_7content_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_14_DTDEntityDecl_7content_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_14_DTDEntityDecl_7content___get__(((struct __pyx_obj_4lxml_5etree__DTDEntityDecl *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_14_DTDEntityDecl_7content___get__(struct __pyx_obj_4lxml_5etree__DTDEntityDecl *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "src/lxml/dtd.pxi":258
 *     @property
 *     def content(self):
 *         _assertValidDTDNode(self, self._c_node)             # <<<<<<<<<<<<<<
 *         return funicodeOrNone(self._c_node.content)
 * 
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidDTDNode(((PyObject *)__pyx_v_self), __pyx_v_self->_c_node); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(21, 258, __pyx_L1_error)

  /* "src/lxml/dtd.pxi":259
 *     def content(self):
 *         _assertValidDTDNode(self, self._c_node)
 *         return funicodeOrNone(self._c_node.content)             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree_funicodeOrNone(__pyx_v_self->_c_node->content); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 259, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/dtd.pxi":256
 *         return funicodeOrNone(self._c_node.orig)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def content(self):
 *         _assertValidDTDNode(self, self._c_node)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._DTDEntityDecl.content.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/dtd.pxi":261
 *         return funicodeOrNone(self._c_node.content)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def system_url(self):
 *         _assertValidDTDNode(self, self._c_node)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_14_DTDEntityDecl_10system_url_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_14_DTDEntityDecl_10system_url_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_14_DTDEntityDecl_10system_url___get__(((struct __pyx_obj_4lxml_5etree__DTDEntityDecl *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_14_DTDEntityDecl_10system_url___get__(struct __pyx_obj_4lxml_5etree__DTDEntityDecl *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "src/lxml/dtd.pxi":263
 *     @property
 *     def system_url(self):
 *         _assertValidDTDNode(self, self._c_node)             # <<<<<<<<<<<<<<
 *         return funicodeOrNone(self._c_node.SystemID)
 * 
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidDTDNode(((PyObject *)__pyx_v_self), __pyx_v_self->_c_node); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(21, 263, __pyx_L1_error)

  /* "src/lxml/dtd.pxi":264
 *     def system_url(self):
 *         _assertValidDTDNode(self, self._c_node)
 *         return funicodeOrNone(self._c_node.SystemID)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree_funicodeOrNone(__pyx_v_self->_c_node->SystemID); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 264, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/dtd.pxi":261
 *         return funicodeOrNone(self._c_node.content)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def system_url(self):
 *         _assertValidDTDNode(self, self._c_node)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._DTDEntityDecl.system_url.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/dtd.pxi":279
 *     """
 *     cdef tree.xmlDtd* _c_dtd
 *     def __init__(self, file=None, *, external_id=None):             # <<<<<<<<<<<<<<
 *         _Validator.__init__(self)
 *         if file is not None:
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_3DTD_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_3DTD_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_file = 0;
  PyObject *__pyx_v_external_id = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_file,&__pyx_mstate_global->__pyx_n_u_external_id,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(21, 279, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(21, 279, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(21, 279, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
    } else {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(21, 279, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_file = values[0];
    __pyx_v_external_id = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, __pyx_nargs); __PYX_ERR(21, 279, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.DTD.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_3DTD___init__(((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_v_self), __pyx_v_file, __pyx_v_external_id);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_3DTD___init__(struct __pyx_obj_4lxml_5etree_DTD *__pyx_v_self, PyObject *__pyx_v_file, PyObject *__pyx_v_external_id) {
  xmlExternalEntityLoader __pyx_v_orig_loader;
  PyObject *__pyx_v_external_id_utf = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  xmlDtd *__pyx_t_10;
  const xmlChar *__pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_t_15;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_INCREF(__pyx_v_file);

  /* "src/lxml/dtd.pxi":280
 *     cdef tree.xmlDtd* _c_dtd
 *     def __init__(self, file=None, *, external_id=None):
 *         _Validator.__init__(self)             # <<<<<<<<<<<<<<
 *         if file is not None:
 *             file = _getFSPathOrObject(file)
*/
  __pyx_t_2 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Validator);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, ((PyObject *)__pyx_v_self)};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_init, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 280, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/dtd.pxi":281
 *     def __init__(self, file=None, *, external_id=None):
 *         _Validator.__init__(self)
 *         if file is not None:             # <<<<<<<<<<<<<<
 *             file = _getFSPathOrObject(file)
 *             if _isString(file):
*/
  __pyx_t_4 = (__pyx_v_file != Py_None);
  if (__pyx_t_4) {

    /* "src/lxml/dtd.pxi":282
 *         _Validator.__init__(self)
 *         if file is not None:
 *             file = _getFSPathOrObject(file)             # <<<<<<<<<<<<<<
 *             if _isString(file):
 *                 file = _encodeFilename(file)
*/
    __pyx_t_1 = __pyx_f_4lxml_5etree__getFSPathOrObject(__pyx_v_file); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 282, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_file, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/dtd.pxi":283
 *         if file is not None:
 *             file = _getFSPathOrObject(file)
 *             if _isString(file):             # <<<<<<<<<<<<<<
 *                 file = _encodeFilename(file)
 *                 with self._error_log:
*/
    __pyx_t_4 = _isString(__pyx_v_file);
    if (__pyx_t_4) {

      /* "src/lxml/dtd.pxi":284
 *             file = _getFSPathOrObject(file)
 *             if _isString(file):
 *                 file = _encodeFilename(file)             # <<<<<<<<<<<<<<
 *                 with self._error_log:
 *                     orig_loader = _register_document_loader()
*/
      __pyx_t_1 = __pyx_f_4lxml_5etree__encodeFilename(__pyx_v_file); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 284, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF_SET(__pyx_v_file, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "src/lxml/dtd.pxi":285
 *             if _isString(file):
 *                 file = _encodeFilename(file)
 *                 with self._error_log:             # <<<<<<<<<<<<<<
 *                     orig_loader = _register_document_loader()
 *                     self._c_dtd = xmlparser.xmlParseDTD(NULL, _xcstr(file))
*/
      /*with:*/ {
        __pyx_t_5 = __Pyx_PyObject_LookupSpecial(((PyObject *)__pyx_v_self->__pyx_base._error_log), __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_5)) __PYX_ERR(21, 285, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_6 = __pyx_f_4lxml_5etree_9_ErrorLog___enter__(__pyx_v_self->__pyx_base._error_log); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(21, 285, __pyx_L5_error)
        /*try:*/ {
          {
            (void)__pyx_t_7; (void)__pyx_t_8; (void)__pyx_t_9; /* mark used */
            /*try:*/ {

              /* "src/lxml/dtd.pxi":286
 *                 file = _encodeFilename(file)
 *                 with self._error_log:
 *                     orig_loader = _register_document_loader()             # <<<<<<<<<<<<<<
 *                     self._c_dtd = xmlparser.xmlParseDTD(NULL, _xcstr(file))
 *                     _reset_document_loader(orig_loader)
*/
              __pyx_v_orig_loader = __pyx_f_4lxml_5etree__register_document_loader();

              /* "src/lxml/dtd.pxi":287
 *                 with self._error_log:
 *                     orig_loader = _register_document_loader()
 *                     self._c_dtd = xmlparser.xmlParseDTD(NULL, _xcstr(file))             # <<<<<<<<<<<<<<
 *                     _reset_document_loader(orig_loader)
 *             elif hasattr(file, 'read'):
*/
              __pyx_v_self->_c_dtd = xmlParseDTD(NULL, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_file));

              /* "src/lxml/dtd.pxi":288
 *                     orig_loader = _register_document_loader()
 *                     self._c_dtd = xmlparser.xmlParseDTD(NULL, _xcstr(file))
 *                     _reset_document_loader(orig_loader)             # <<<<<<<<<<<<<<
 *             elif hasattr(file, 'read'):
 *                 orig_loader = _register_document_loader()
*/
              __pyx_f_4lxml_5etree__reset_document_loader(__pyx_v_orig_loader);

              /* "src/lxml/dtd.pxi":285
 *             if _isString(file):
 *                 file = _encodeFilename(file)
 *                 with self._error_log:             # <<<<<<<<<<<<<<
 *                     orig_loader = _register_document_loader()
 *                     self._c_dtd = xmlparser.xmlParseDTD(NULL, _xcstr(file))
*/
            }
          }
        }
        /*finally:*/ {
          /*normal exit:*/{
            if (__pyx_t_5) {
              __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_mstate_global->__pyx_tuple[3], NULL);
              __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
              if (unlikely(!__pyx_t_9)) __PYX_ERR(21, 285, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_9);
              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
            }
            goto __pyx_L8;
          }
          __pyx_L8:;
        }
        goto __pyx_L15;
        __pyx_L5_error:;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        goto __pyx_L1_error;
        __pyx_L15:;
      }

      /* "src/lxml/dtd.pxi":283
 *         if file is not None:
 *             file = _getFSPathOrObject(file)
 *             if _isString(file):             # <<<<<<<<<<<<<<
 *                 file = _encodeFilename(file)
 *                 with self._error_log:
*/
      goto __pyx_L4;
    }

    /* "src/lxml/dtd.pxi":289
 *                     self._c_dtd = xmlparser.xmlParseDTD(NULL, _xcstr(file))
 *                     _reset_document_loader(orig_loader)
 *             elif hasattr(file, 'read'):             # <<<<<<<<<<<<<<
 *                 orig_loader = _register_document_loader()
 *                 self._c_dtd = _parseDtdFromFilelike(file)
*/
    __pyx_t_4 = __Pyx_HasAttr(__pyx_v_file, __pyx_mstate_global->__pyx_n_u_read); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(21, 289, __pyx_L1_error)
    if (likely(__pyx_t_4)) {

      /* "src/lxml/dtd.pxi":290
 *                     _reset_document_loader(orig_loader)
 *             elif hasattr(file, 'read'):
 *                 orig_loader = _register_document_loader()             # <<<<<<<<<<<<<<
 *                 self._c_dtd = _parseDtdFromFilelike(file)
 *                 _reset_document_loader(orig_loader)
*/
      __pyx_v_orig_loader = __pyx_f_4lxml_5etree__register_document_loader();

      /* "src/lxml/dtd.pxi":291
 *             elif hasattr(file, 'read'):
 *                 orig_loader = _register_document_loader()
 *                 self._c_dtd = _parseDtdFromFilelike(file)             # <<<<<<<<<<<<<<
 *                 _reset_document_loader(orig_loader)
 *             else:
*/
      __pyx_t_10 = __pyx_f_4lxml_5etree__parseDtdFromFilelike(__pyx_v_file); if (unlikely(__pyx_t_10 == ((void *)NULL))) __PYX_ERR(21, 291, __pyx_L1_error)
      __pyx_v_self->_c_dtd = __pyx_t_10;

      /* "src/lxml/dtd.pxi":292
 *                 orig_loader = _register_document_loader()
 *                 self._c_dtd = _parseDtdFromFilelike(file)
 *                 _reset_document_loader(orig_loader)             # <<<<<<<<<<<<<<
 *             else:
 *                 raise DTDParseError, "file must be a filename, file-like or path-like object"
*/
      __pyx_f_4lxml_5etree__reset_document_loader(__pyx_v_orig_loader);

      /* "src/lxml/dtd.pxi":289
 *                     self._c_dtd = xmlparser.xmlParseDTD(NULL, _xcstr(file))
 *                     _reset_document_loader(orig_loader)
 *             elif hasattr(file, 'read'):             # <<<<<<<<<<<<<<
 *                 orig_loader = _register_document_loader()
 *                 self._c_dtd = _parseDtdFromFilelike(file)
*/
      goto __pyx_L4;
    }

    /* "src/lxml/dtd.pxi":294
 *                 _reset_document_loader(orig_loader)
 *             else:
 *                 raise DTDParseError, "file must be a filename, file-like or path-like object"             # <<<<<<<<<<<<<<
 *         elif external_id is not None:
 *             external_id_utf = _utf8(external_id)
*/
    /*else*/ {
      __Pyx_Raise(((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_DTDParseError), __pyx_mstate_global->__pyx_kp_u_file_must_be_a_filename_file_lik, 0, 0);
      __PYX_ERR(21, 294, __pyx_L1_error)
    }
    __pyx_L4:;

    /* "src/lxml/dtd.pxi":281
 *     def __init__(self, file=None, *, external_id=None):
 *         _Validator.__init__(self)
 *         if file is not None:             # <<<<<<<<<<<<<<
 *             file = _getFSPathOrObject(file)
 *             if _isString(file):
*/
    goto __pyx_L3;
  }

  /* "src/lxml/dtd.pxi":295
 *             else:
 *                 raise DTDParseError, "file must be a filename, file-like or path-like object"
 *         elif external_id is not None:             # <<<<<<<<<<<<<<
 *             external_id_utf = _utf8(external_id)
 *             with self._error_log:
*/
  __pyx_t_4 = (__pyx_v_external_id != Py_None);
  if (likely(__pyx_t_4)) {

    /* "src/lxml/dtd.pxi":296
 *                 raise DTDParseError, "file must be a filename, file-like or path-like object"
 *         elif external_id is not None:
 *             external_id_utf = _utf8(external_id)             # <<<<<<<<<<<<<<
 *             with self._error_log:
 *                 orig_loader = _register_document_loader()
*/
    __pyx_t_1 = __pyx_f_4lxml_5etree__utf8(__pyx_v_external_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 296, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_external_id_utf = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/dtd.pxi":297
 *         elif external_id is not None:
 *             external_id_utf = _utf8(external_id)
 *             with self._error_log:             # <<<<<<<<<<<<<<
 *                 orig_loader = _register_document_loader()
 *                 self._c_dtd = xmlparser.xmlParseDTD(<const_xmlChar*>external_id_utf, NULL)
*/
    /*with:*/ {
      __pyx_t_5 = __Pyx_PyObject_LookupSpecial(((PyObject *)__pyx_v_self->__pyx_base._error_log), __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_5)) __PYX_ERR(21, 297, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __pyx_f_4lxml_5etree_9_ErrorLog___enter__(__pyx_v_self->__pyx_base._error_log); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(21, 297, __pyx_L16_error)
      /*try:*/ {
        {
          __Pyx_PyThreadState_declare
          __Pyx_PyThreadState_assign
          __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_8, &__pyx_t_7);
          __Pyx_XGOTREF(__pyx_t_9);
          __Pyx_XGOTREF(__pyx_t_8);
          __Pyx_XGOTREF(__pyx_t_7);
          /*try:*/ {

            /* "src/lxml/dtd.pxi":298
 *             external_id_utf = _utf8(external_id)
 *             with self._error_log:
 *                 orig_loader = _register_document_loader()             # <<<<<<<<<<<<<<
 *                 self._c_dtd = xmlparser.xmlParseDTD(<const_xmlChar*>external_id_utf, NULL)
 *                 _reset_document_loader(orig_loader)
*/
            __pyx_v_orig_loader = __pyx_f_4lxml_5etree__register_document_loader();

            /* "src/lxml/dtd.pxi":299
 *             with self._error_log:
 *                 orig_loader = _register_document_loader()
 *                 self._c_dtd = xmlparser.xmlParseDTD(<const_xmlChar*>external_id_utf, NULL)             # <<<<<<<<<<<<<<
 *                 _reset_document_loader(orig_loader)
 *         else:
*/
            if (unlikely(__pyx_v_external_id_utf == Py_None)) {
              PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
              __PYX_ERR(21, 299, __pyx_L20_error)
            }
            __pyx_t_11 = __Pyx_PyBytes_AsUString(__pyx_v_external_id_utf); if (unlikely((!__pyx_t_11) && PyErr_Occurred())) __PYX_ERR(21, 299, __pyx_L20_error)
            __pyx_v_self->_c_dtd = xmlParseDTD(((const xmlChar *)__pyx_t_11), NULL);

            /* "src/lxml/dtd.pxi":300
 *                 orig_loader = _register_document_loader()
 *                 self._c_dtd = xmlparser.xmlParseDTD(<const_xmlChar*>external_id_utf, NULL)
 *                 _reset_document_loader(orig_loader)             # <<<<<<<<<<<<<<
 *         else:
 *             raise DTDParseError, "either filename or external ID required"
*/
            __pyx_f_4lxml_5etree__reset_document_loader(__pyx_v_orig_loader);

            /* "src/lxml/dtd.pxi":297
 *         elif external_id is not None:
 *             external_id_utf = _utf8(external_id)
 *             with self._error_log:             # <<<<<<<<<<<<<<
 *                 orig_loader = _register_document_loader()
 *                 self._c_dtd = xmlparser.xmlParseDTD(<const_xmlChar*>external_id_utf, NULL)
*/
          }
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          goto __pyx_L25_try_end;
          __pyx_L20_error:;
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          /*except:*/ {
            __Pyx_AddTraceback("lxml.etree.DTD.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
            if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_12) < 0) __PYX_ERR(21, 297, __pyx_L22_except_error)
            __Pyx_XGOTREF(__pyx_t_1);
            __Pyx_XGOTREF(__pyx_t_2);
            __Pyx_XGOTREF(__pyx_t_12);
            __pyx_t_13 = PyTuple_Pack(3, __pyx_t_1, __pyx_t_2, __pyx_t_12); if (unlikely(!__pyx_t_13)) __PYX_ERR(21, 297, __pyx_L22_except_error)
            __Pyx_GOTREF(__pyx_t_13);
            __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_13, NULL);
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
            if (unlikely(!__pyx_t_14)) __PYX_ERR(21, 297, __pyx_L22_except_error)
            __Pyx_GOTREF(__pyx_t_14);
            __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_14);
            __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
            if (__pyx_t_4 < (0)) __PYX_ERR(21, 297, __pyx_L22_except_error)
            __pyx_t_15 = (!__pyx_t_4);
            if (unlikely(__pyx_t_15)) {
              __Pyx_GIVEREF(__pyx_t_1);
              __Pyx_GIVEREF(__pyx_t_2);
              __Pyx_XGIVEREF(__pyx_t_12);
              __Pyx_ErrRestoreWithState(__pyx_t_1, __pyx_t_2, __pyx_t_12);
              __pyx_t_1 = 0;  __pyx_t_2 = 0;  __pyx_t_12 = 0; 
              __PYX_ERR(21, 297, __pyx_L22_except_error)
            }
            __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
            __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
            goto __pyx_L21_exception_handled;
          }
          __pyx_L22_except_error:;
          __Pyx_XGIVEREF(__pyx_t_9);
          __Pyx_XGIVEREF(__pyx_t_8);
          __Pyx_XGIVEREF(__pyx_t_7);
          __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_8, __pyx_t_7);
          goto __pyx_L1_error;
          __pyx_L21_exception_handled:;
          __Pyx_XGIVEREF(__pyx_t_9);
          __Pyx_XGIVEREF(__pyx_t_8);
          __Pyx_XGIVEREF(__pyx_t_7);
          __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_8, __pyx_t_7);
          __pyx_L25_try_end:;
        }
      }
      /*finally:*/ {
        /*normal exit:*/{
          if (__pyx_t_5) {
            __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_mstate_global->__pyx_tuple[3], NULL);
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
            if (unlikely(!__pyx_t_7)) __PYX_ERR(21, 297, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_7);
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          }
          goto __pyx_L19;
        }
        __pyx_L19:;
      }
      goto __pyx_L29;
      __pyx_L16_error:;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L1_error;
      __pyx_L29:;
    }

    /* "src/lxml/dtd.pxi":295
 *             else:
 *                 raise DTDParseError, "file must be a filename, file-like or path-like object"
 *         elif external_id is not None:             # <<<<<<<<<<<<<<
 *             external_id_utf = _utf8(external_id)
 *             with self._error_log:
*/
    goto __pyx_L3;
  }

  /* "src/lxml/dtd.pxi":302
 *                 _reset_document_loader(orig_loader)
 *         else:
 *             raise DTDParseError, "either filename or external ID required"             # <<<<<<<<<<<<<<
 * 
 *         if self._c_dtd is NULL:
*/
  /*else*/ {
    __Pyx_Raise(((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_DTDParseError), __pyx_mstate_global->__pyx_kp_u_either_filename_or_external_ID_r, 0, 0);
    __PYX_ERR(21, 302, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "src/lxml/dtd.pxi":304
 *             raise DTDParseError, "either filename or external ID required"
 * 
 *         if self._c_dtd is NULL:             # <<<<<<<<<<<<<<
 *             raise DTDParseError(
 *                 self._error_log._buildExceptionMessage("error parsing DTD"),
*/
  __pyx_t_15 = (__pyx_v_self->_c_dtd == NULL);
  if (unlikely(__pyx_t_15)) {

    /* "src/lxml/dtd.pxi":305
 * 
 *         if self._c_dtd is NULL:
 *             raise DTDParseError(             # <<<<<<<<<<<<<<
 *                 self._error_log._buildExceptionMessage("error parsing DTD"),
 *                 self._error_log)
*/
    __pyx_t_2 = NULL;

    /* "src/lxml/dtd.pxi":306
 *         if self._c_dtd is NULL:
 *             raise DTDParseError(
 *                 self._error_log._buildExceptionMessage("error parsing DTD"),             # <<<<<<<<<<<<<<
 *                 self._error_log)
 * 
*/
    __pyx_t_1 = __pyx_f_4lxml_5etree_13_BaseErrorLog__buildExceptionMessage(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self->__pyx_base._error_log), __pyx_mstate_global->__pyx_kp_u_error_parsing_DTD); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 306, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);

    /* "src/lxml/dtd.pxi":307
 *             raise DTDParseError(
 *                 self._error_log._buildExceptionMessage("error parsing DTD"),
 *                 self._error_log)             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
    __pyx_t_3 = 1;
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_t_1, ((PyObject *)__pyx_v_self->__pyx_base._error_log)};
      __pyx_t_12 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_DTDParseError, __pyx_callargs+__pyx_t_3, (3-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_12)) __PYX_ERR(21, 305, __pyx_L1_error)
      __Pyx_GOTREF((PyObject *)__pyx_t_12);
    }
    __Pyx_Raise(((PyObject *)__pyx_t_12), 0, 0, 0);
    __Pyx_DECREF((PyObject *)__pyx_t_12); __pyx_t_12 = 0;
    __PYX_ERR(21, 305, __pyx_L1_error)

    /* "src/lxml/dtd.pxi":304
 *             raise DTDParseError, "either filename or external ID required"
 * 
 *         if self._c_dtd is NULL:             # <<<<<<<<<<<<<<
 *             raise DTDParseError(
 *                 self._error_log._buildExceptionMessage("error parsing DTD"),
*/
  }

  /* "src/lxml/dtd.pxi":279
 *     """
 *     cdef tree.xmlDtd* _c_dtd
 *     def __init__(self, file=None, *, external_id=None):             # <<<<<<<<<<<<<<
 *         _Validator.__init__(self)
 *         if file is not None:
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("lxml.etree.DTD.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_external_id_utf);
  __Pyx_XDECREF(__pyx_v_file);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/dtd.pxi":309
 *                 self._error_log)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def name(self):
 *        if self._c_dtd is NULL:
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_3DTD_4name_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_3DTD_4name_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_3DTD_4name___get__(((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_3DTD_4name___get__(struct __pyx_obj_4lxml_5etree_DTD *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "src/lxml/dtd.pxi":311
 *     @property
 *     def name(self):
 *        if self._c_dtd is NULL:             # <<<<<<<<<<<<<<
 *            return None
 *        return funicodeOrNone(self._c_dtd.name)
*/
  __pyx_t_1 = (__pyx_v_self->_c_dtd == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/dtd.pxi":312
 *     def name(self):
 *        if self._c_dtd is NULL:
 *            return None             # <<<<<<<<<<<<<<
 *        return funicodeOrNone(self._c_dtd.name)
 * 
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":311
 *     @property
 *     def name(self):
 *        if self._c_dtd is NULL:             # <<<<<<<<<<<<<<
 *            return None
 *        return funicodeOrNone(self._c_dtd.name)
*/
  }

  /* "src/lxml/dtd.pxi":313
 *        if self._c_dtd is NULL:
 *            return None
 *        return funicodeOrNone(self._c_dtd.name)             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree_funicodeOrNone(__pyx_v_self->_c_dtd->name); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 313, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/dtd.pxi":309
 *                 self._error_log)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def name(self):
 *        if self._c_dtd is NULL:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.DTD.name.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/dtd.pxi":315
 *        return funicodeOrNone(self._c_dtd.name)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def external_id(self):
 *        if self._c_dtd is NULL:
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_3DTD_11external_id_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_3DTD_11external_id_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_3DTD_11external_id___get__(((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_3DTD_11external_id___get__(struct __pyx_obj_4lxml_5etree_DTD *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "src/lxml/dtd.pxi":317
 *     @property
 *     def external_id(self):
 *        if self._c_dtd is NULL:             # <<<<<<<<<<<<<<
 *            return None
 *        return funicodeOrNone(self._c_dtd.ExternalID)
*/
  __pyx_t_1 = (__pyx_v_self->_c_dtd == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/dtd.pxi":318
 *     def external_id(self):
 *        if self._c_dtd is NULL:
 *            return None             # <<<<<<<<<<<<<<
 *        return funicodeOrNone(self._c_dtd.ExternalID)
 * 
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":317
 *     @property
 *     def external_id(self):
 *        if self._c_dtd is NULL:             # <<<<<<<<<<<<<<
 *            return None
 *        return funicodeOrNone(self._c_dtd.ExternalID)
*/
  }

  /* "src/lxml/dtd.pxi":319
 *        if self._c_dtd is NULL:
 *            return None
 *        return funicodeOrNone(self._c_dtd.ExternalID)             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree_funicodeOrNone(__pyx_v_self->_c_dtd->ExternalID); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 319, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/dtd.pxi":315
 *        return funicodeOrNone(self._c_dtd.name)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def external_id(self):
 *        if self._c_dtd is NULL:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.DTD.external_id.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/dtd.pxi":321
 *        return funicodeOrNone(self._c_dtd.ExternalID)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def system_url(self):
 *        if self._c_dtd is NULL:
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_3DTD_10system_url_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_3DTD_10system_url_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_3DTD_10system_url___get__(((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_3DTD_10system_url___get__(struct __pyx_obj_4lxml_5etree_DTD *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "src/lxml/dtd.pxi":323
 *     @property
 *     def system_url(self):
 *        if self._c_dtd is NULL:             # <<<<<<<<<<<<<<
 *            return None
 *        return funicodeOrNone(self._c_dtd.SystemID)
*/
  __pyx_t_1 = (__pyx_v_self->_c_dtd == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/dtd.pxi":324
 *     def system_url(self):
 *        if self._c_dtd is NULL:
 *            return None             # <<<<<<<<<<<<<<
 *        return funicodeOrNone(self._c_dtd.SystemID)
 * 
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":323
 *     @property
 *     def system_url(self):
 *        if self._c_dtd is NULL:             # <<<<<<<<<<<<<<
 *            return None
 *        return funicodeOrNone(self._c_dtd.SystemID)
*/
  }

  /* "src/lxml/dtd.pxi":325
 *        if self._c_dtd is NULL:
 *            return None
 *        return funicodeOrNone(self._c_dtd.SystemID)             # <<<<<<<<<<<<<<
 * 
 *     def iterelements(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree_funicodeOrNone(__pyx_v_self->_c_dtd->SystemID); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 325, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/dtd.pxi":321
 *        return funicodeOrNone(self._c_dtd.ExternalID)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def system_url(self):
 *        if self._c_dtd is NULL:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.DTD.system_url.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_4lxml_5etree_3DTD_4generator15(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "src/lxml/dtd.pxi":327
 *        return funicodeOrNone(self._c_dtd.SystemID)
 * 
 *     def iterelements(self):             # <<<<<<<<<<<<<<
 *         cdef tree.xmlNode *c_node = self._c_dtd.children if self._c_dtd is not NULL else NULL
 *         while c_node is not NULL:
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_3DTD_3iterelements(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_3DTD_3iterelements = {"iterelements", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_3DTD_3iterelements, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_3DTD_3iterelements(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iterelements (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("iterelements", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("iterelements", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_3DTD_2iterelements(((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_3DTD_2iterelements(struct __pyx_obj_4lxml_5etree_DTD *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_15_iterelements *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("iterelements", 0);
  __pyx_cur_scope = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_15_iterelements *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_15_iterelements(__pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_15_iterelements, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_15_iterelements *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(21, 327, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4lxml_5etree_3DTD_4generator15, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[16]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_iterelements, __pyx_mstate_global->__pyx_n_u_DTD_iterelements, __pyx_mstate_global->__pyx_n_u_lxml_etree); if (unlikely(!gen)) __PYX_ERR(21, 327, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.DTD.iterelements", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_4lxml_5etree_3DTD_4generator15(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_15_iterelements *__pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_15_iterelements *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  xmlNode *__pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iterelements", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L7_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(__pyx_sent_value != Py_None)) {
    if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator");
    __PYX_ERR(21, 327, __pyx_L1_error)
  }

  /* "src/lxml/dtd.pxi":328
 * 
 *     def iterelements(self):
 *         cdef tree.xmlNode *c_node = self._c_dtd.children if self._c_dtd is not NULL else NULL             # <<<<<<<<<<<<<<
 *         while c_node is not NULL:
 *             if c_node.type == tree.XML_ELEMENT_DECL:
*/
  __pyx_t_2 = (__pyx_cur_scope->__pyx_v_self->_c_dtd != NULL);
  if (__pyx_t_2) {
    __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->_c_dtd->children;
  } else {
    __pyx_t_1 = NULL;
  }
  __pyx_cur_scope->__pyx_v_c_node = __pyx_t_1;

  /* "src/lxml/dtd.pxi":329
 *     def iterelements(self):
 *         cdef tree.xmlNode *c_node = self._c_dtd.children if self._c_dtd is not NULL else NULL
 *         while c_node is not NULL:             # <<<<<<<<<<<<<<
 *             if c_node.type == tree.XML_ELEMENT_DECL:
 *                 node = _DTDElementDecl()
*/
  while (1) {
    __pyx_t_2 = (__pyx_cur_scope->__pyx_v_c_node != NULL);
    if (!__pyx_t_2) break;

    /* "src/lxml/dtd.pxi":330
 *         cdef tree.xmlNode *c_node = self._c_dtd.children if self._c_dtd is not NULL else NULL
 *         while c_node is not NULL:
 *             if c_node.type == tree.XML_ELEMENT_DECL:             # <<<<<<<<<<<<<<
 *                 node = _DTDElementDecl()
 *                 node._dtd = self
*/
    __pyx_t_2 = (__pyx_cur_scope->__pyx_v_c_node->type == XML_ELEMENT_DECL);
    if (__pyx_t_2) {

      /* "src/lxml/dtd.pxi":331
 *         while c_node is not NULL:
 *             if c_node.type == tree.XML_ELEMENT_DECL:
 *                 node = _DTDElementDecl()             # <<<<<<<<<<<<<<
 *                 node._dtd = self
 *                 node._c_node = <tree.xmlElement*>c_node
*/
      __pyx_t_4 = NULL;
      __pyx_t_5 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
        __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__DTDElementDecl, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 331, __pyx_L1_error)
        __Pyx_GOTREF((PyObject *)__pyx_t_3);
      }
      __Pyx_XGOTREF((PyObject *)__pyx_cur_scope->__pyx_v_node);
      __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_node, ((struct __pyx_obj_4lxml_5etree__DTDElementDecl *)__pyx_t_3));
      __Pyx_GIVEREF((PyObject *)__pyx_t_3);
      __pyx_t_3 = 0;

      /* "src/lxml/dtd.pxi":332
 *             if c_node.type == tree.XML_ELEMENT_DECL:
 *                 node = _DTDElementDecl()
 *                 node._dtd = self             # <<<<<<<<<<<<<<
 *                 node._c_node = <tree.xmlElement*>c_node
 *                 yield node
*/
      __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
      __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
      __Pyx_GOTREF((PyObject *)__pyx_cur_scope->__pyx_v_node->_dtd);
      __Pyx_DECREF((PyObject *)__pyx_cur_scope->__pyx_v_node->_dtd);
      __pyx_cur_scope->__pyx_v_node->_dtd = __pyx_cur_scope->__pyx_v_self;

      /* "src/lxml/dtd.pxi":333
 *                 node = _DTDElementDecl()
 *                 node._dtd = self
 *                 node._c_node = <tree.xmlElement*>c_node             # <<<<<<<<<<<<<<
 *                 yield node
 *             c_node = c_node.next
*/
      __pyx_cur_scope->__pyx_v_node->_c_node = ((xmlElement *)__pyx_cur_scope->__pyx_v_c_node);

      /* "src/lxml/dtd.pxi":334
 *                 node._dtd = self
 *                 node._c_node = <tree.xmlElement*>c_node
 *                 yield node             # <<<<<<<<<<<<<<
 *             c_node = c_node.next
 * 
*/
      __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_node);
      __pyx_r = ((PyObject *)__pyx_cur_scope->__pyx_v_node);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, yielding value */
      __pyx_generator->resume_label = 1;
      return __pyx_r;
      __pyx_L7_resume_from_yield:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(21, 334, __pyx_L1_error)

      /* "src/lxml/dtd.pxi":330
 *         cdef tree.xmlNode *c_node = self._c_dtd.children if self._c_dtd is not NULL else NULL
 *         while c_node is not NULL:
 *             if c_node.type == tree.XML_ELEMENT_DECL:             # <<<<<<<<<<<<<<
 *                 node = _DTDElementDecl()
 *                 node._dtd = self
*/
    }

    /* "src/lxml/dtd.pxi":335
 *                 node._c_node = <tree.xmlElement*>c_node
 *                 yield node
 *             c_node = c_node.next             # <<<<<<<<<<<<<<
 * 
 *     def elements(self):
*/
    __pyx_t_1 = __pyx_cur_scope->__pyx_v_c_node->next;
    __pyx_cur_scope->__pyx_v_c_node = __pyx_t_1;
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "src/lxml/dtd.pxi":327
 *        return funicodeOrNone(self._c_dtd.SystemID)
 * 
 *     def iterelements(self):             # <<<<<<<<<<<<<<
 *         cdef tree.xmlNode *c_node = self._c_dtd.children if self._c_dtd is not NULL else NULL
 *         while c_node is not NULL:
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("iterelements", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/dtd.pxi":337
 *             c_node = c_node.next
 * 
 *     def elements(self):             # <<<<<<<<<<<<<<
 *         return list(self.iterelements())
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_3DTD_6elements(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_3DTD_6elements = {"elements", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_3DTD_6elements, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_3DTD_6elements(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("elements (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("elements", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("elements", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_3DTD_5elements(((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_3DTD_5elements(struct __pyx_obj_4lxml_5etree_DTD *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("elements", 0);

  /* "src/lxml/dtd.pxi":338
 * 
 *     def elements(self):
 *         return list(self.iterelements())             # <<<<<<<<<<<<<<
 * 
 *     def iterentities(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_iterelements, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 338, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_2 = __Pyx_PySequence_ListKeepNew(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 338, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/dtd.pxi":337
 *             c_node = c_node.next
 * 
 *     def elements(self):             # <<<<<<<<<<<<<<
 *         return list(self.iterelements())
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.DTD.elements", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_4lxml_5etree_3DTD_9generator16(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "src/lxml/dtd.pxi":340
 *         return list(self.iterelements())
 * 
 *     def iterentities(self):             # <<<<<<<<<<<<<<
 *         cdef tree.xmlNode *c_node = self._c_dtd.children if self._c_dtd is not NULL else NULL
 *         while c_node is not NULL:
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_3DTD_8iterentities(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_3DTD_8iterentities = {"iterentities", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_3DTD_8iterentities, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_3DTD_8iterentities(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iterentities (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("iterentities", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("iterentities", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_3DTD_7iterentities(((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_3DTD_7iterentities(struct __pyx_obj_4lxml_5etree_DTD *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_16_iterentities *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("iterentities", 0);
  __pyx_cur_scope = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_16_iterentities *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_16_iterentities(__pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_16_iterentities, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_16_iterentities *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(21, 340, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4lxml_5etree_3DTD_9generator16, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[17]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_iterentities, __pyx_mstate_global->__pyx_n_u_DTD_iterentities, __pyx_mstate_global->__pyx_n_u_lxml_etree); if (unlikely(!gen)) __PYX_ERR(21, 340, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.DTD.iterentities", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_4lxml_5etree_3DTD_9generator16(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_16_iterentities *__pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_16_iterentities *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  xmlNode *__pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iterentities", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L7_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(__pyx_sent_value != Py_None)) {
    if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator");
    __PYX_ERR(21, 340, __pyx_L1_error)
  }

  /* "src/lxml/dtd.pxi":341
 * 
 *     def iterentities(self):
 *         cdef tree.xmlNode *c_node = self._c_dtd.children if self._c_dtd is not NULL else NULL             # <<<<<<<<<<<<<<
 *         while c_node is not NULL:
 *             if c_node.type == tree.XML_ENTITY_DECL:
*/
  __pyx_t_2 = (__pyx_cur_scope->__pyx_v_self->_c_dtd != NULL);
  if (__pyx_t_2) {
    __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->_c_dtd->children;
  } else {
    __pyx_t_1 = NULL;
  }
  __pyx_cur_scope->__pyx_v_c_node = __pyx_t_1;

  /* "src/lxml/dtd.pxi":342
 *     def iterentities(self):
 *         cdef tree.xmlNode *c_node = self._c_dtd.children if self._c_dtd is not NULL else NULL
 *         while c_node is not NULL:             # <<<<<<<<<<<<<<
 *             if c_node.type == tree.XML_ENTITY_DECL:
 *                 node = _DTDEntityDecl()
*/
  while (1) {
    __pyx_t_2 = (__pyx_cur_scope->__pyx_v_c_node != NULL);
    if (!__pyx_t_2) break;

    /* "src/lxml/dtd.pxi":343
 *         cdef tree.xmlNode *c_node = self._c_dtd.children if self._c_dtd is not NULL else NULL
 *         while c_node is not NULL:
 *             if c_node.type == tree.XML_ENTITY_DECL:             # <<<<<<<<<<<<<<
 *                 node = _DTDEntityDecl()
 *                 node._dtd = self
*/
    __pyx_t_2 = (__pyx_cur_scope->__pyx_v_c_node->type == XML_ENTITY_DECL);
    if (__pyx_t_2) {

      /* "src/lxml/dtd.pxi":344
 *         while c_node is not NULL:
 *             if c_node.type == tree.XML_ENTITY_DECL:
 *                 node = _DTDEntityDecl()             # <<<<<<<<<<<<<<
 *                 node._dtd = self
 *                 node._c_node = <tree.xmlEntity*>c_node
*/
      __pyx_t_4 = NULL;
      __pyx_t_5 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
        __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__DTDEntityDecl, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 344, __pyx_L1_error)
        __Pyx_GOTREF((PyObject *)__pyx_t_3);
      }
      __Pyx_XGOTREF((PyObject *)__pyx_cur_scope->__pyx_v_node);
      __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_node, ((struct __pyx_obj_4lxml_5etree__DTDEntityDecl *)__pyx_t_3));
      __Pyx_GIVEREF((PyObject *)__pyx_t_3);
      __pyx_t_3 = 0;

      /* "src/lxml/dtd.pxi":345
 *             if c_node.type == tree.XML_ENTITY_DECL:
 *                 node = _DTDEntityDecl()
 *                 node._dtd = self             # <<<<<<<<<<<<<<
 *                 node._c_node = <tree.xmlEntity*>c_node
 *                 yield node
*/
      __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
      __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
      __Pyx_GOTREF((PyObject *)__pyx_cur_scope->__pyx_v_node->_dtd);
      __Pyx_DECREF((PyObject *)__pyx_cur_scope->__pyx_v_node->_dtd);
      __pyx_cur_scope->__pyx_v_node->_dtd = __pyx_cur_scope->__pyx_v_self;

      /* "src/lxml/dtd.pxi":346
 *                 node = _DTDEntityDecl()
 *                 node._dtd = self
 *                 node._c_node = <tree.xmlEntity*>c_node             # <<<<<<<<<<<<<<
 *                 yield node
 *             c_node = c_node.next
*/
      __pyx_cur_scope->__pyx_v_node->_c_node = ((xmlEntity *)__pyx_cur_scope->__pyx_v_c_node);

      /* "src/lxml/dtd.pxi":347
 *                 node._dtd = self
 *                 node._c_node = <tree.xmlEntity*>c_node
 *                 yield node             # <<<<<<<<<<<<<<
 *             c_node = c_node.next
 * 
*/
      __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_node);
      __pyx_r = ((PyObject *)__pyx_cur_scope->__pyx_v_node);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, yielding value */
      __pyx_generator->resume_label = 1;
      return __pyx_r;
      __pyx_L7_resume_from_yield:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(21, 347, __pyx_L1_error)

      /* "src/lxml/dtd.pxi":343
 *         cdef tree.xmlNode *c_node = self._c_dtd.children if self._c_dtd is not NULL else NULL
 *         while c_node is not NULL:
 *             if c_node.type == tree.XML_ENTITY_DECL:             # <<<<<<<<<<<<<<
 *                 node = _DTDEntityDecl()
 *                 node._dtd = self
*/
    }

    /* "src/lxml/dtd.pxi":348
 *                 node._c_node = <tree.xmlEntity*>c_node
 *                 yield node
 *             c_node = c_node.next             # <<<<<<<<<<<<<<
 * 
 *     def entities(self):
*/
    __pyx_t_1 = __pyx_cur_scope->__pyx_v_c_node->next;
    __pyx_cur_scope->__pyx_v_c_node = __pyx_t_1;
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "src/lxml/dtd.pxi":340
 *         return list(self.iterelements())
 * 
 *     def iterentities(self):             # <<<<<<<<<<<<<<
 *         cdef tree.xmlNode *c_node = self._c_dtd.children if self._c_dtd is not NULL else NULL
 *         while c_node is not NULL:
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("iterentities", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/dtd.pxi":350
 *             c_node = c_node.next
 * 
 *     def entities(self):             # <<<<<<<<<<<<<<
 *         return list(self.iterentities())
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_3DTD_11entities(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_3DTD_11entities = {"entities", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_3DTD_11entities, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_3DTD_11entities(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("entities (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("entities", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("entities", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_3DTD_10entities(((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_3DTD_10entities(struct __pyx_obj_4lxml_5etree_DTD *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("entities", 0);

  /* "src/lxml/dtd.pxi":351
 * 
 *     def entities(self):
 *         return list(self.iterentities())             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_iterentities, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 351, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_2 = __Pyx_PySequence_ListKeepNew(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 351, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/dtd.pxi":350
 *             c_node = c_node.next
 * 
 *     def entities(self):             # <<<<<<<<<<<<<<
 *         return list(self.iterentities())
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.DTD.entities", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/dtd.pxi":353
 *         return list(self.iterentities())
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         tree.xmlFreeDtd(self._c_dtd)
 * 
*/

/* Python wrapper */
static void __pyx_pw_4lxml_5etree_3DTD_13__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_4lxml_5etree_3DTD_13__dealloc__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_pf_4lxml_5etree_3DTD_12__dealloc__(((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_4lxml_5etree_3DTD_12__dealloc__(struct __pyx_obj_4lxml_5etree_DTD *__pyx_v_self) {

  /* "src/lxml/dtd.pxi":354
 * 
 *     def __dealloc__(self):
 *         tree.xmlFreeDtd(self._c_dtd)             # <<<<<<<<<<<<<<
 * 
 *     def __call__(self, etree):
*/
  xmlFreeDtd(__pyx_v_self->_c_dtd);

  /* "src/lxml/dtd.pxi":353
 *         return list(self.iterentities())
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         tree.xmlFreeDtd(self._c_dtd)
 * 
*/

  /* function exit code */
}

/* "src/lxml/dtd.pxi":356
 *         tree.xmlFreeDtd(self._c_dtd)
 * 
 *     def __call__(self, etree):             # <<<<<<<<<<<<<<
 *         """__call__(self, etree)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_3DTD_15__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_3DTD_14__call__, "__call__(self, etree)\n\n        Validate doc using the DTD.\n\n        Returns true if the document is valid, false if not.\n        ");
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_3DTD_14__call__;
#endif
static PyObject *__pyx_pw_4lxml_5etree_3DTD_15__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_etree = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_etree,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(21, 356, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(21, 356, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__call__", 0) < (0)) __PYX_ERR(21, 356, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, i); __PYX_ERR(21, 356, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(21, 356, __pyx_L3_error)
    }
    __pyx_v_etree = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, __pyx_nargs); __PYX_ERR(21, 356, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.DTD.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_3DTD_14__call__(((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_v_self), __pyx_v_etree);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_3DTD_14__call__(struct __pyx_obj_4lxml_5etree_DTD *__pyx_v_self, PyObject *__pyx_v_etree) {
  struct LxmlDocument *__pyx_v_doc = 0;
  struct LxmlElement *__pyx_v_root_node = 0;
  xmlDoc *__pyx_v_c_doc;
  xmlValidCtxt *__pyx_v_valid_ctxt;
  int __pyx_v_ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  xmlDoc *__pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_t_14;
  int __pyx_t_15;
  char const *__pyx_t_16;
  PyObject *__pyx_t_17 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__call__", 0);

  /* "src/lxml/dtd.pxi":367
 *         cdef xmlDoc* c_doc
 *         cdef dtdvalid.xmlValidCtxt* valid_ctxt
 *         cdef int ret = -1             # <<<<<<<<<<<<<<
 * 
 *         assert self._c_dtd is not NULL, "DTD not initialised"
*/
  __pyx_v_ret = -1;

  /* "src/lxml/dtd.pxi":369
 *         cdef int ret = -1
 * 
 *         assert self._c_dtd is not NULL, "DTD not initialised"             # <<<<<<<<<<<<<<
 *         doc = _documentOrRaise(etree)
 *         root_node = _rootNodeOrRaise(etree)
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = (__pyx_v_self->_c_dtd != NULL);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_mstate_global->__pyx_kp_u_DTD_not_initialised, 0, 0);
      __PYX_ERR(21, 369, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(21, 369, __pyx_L1_error)
  #endif

  /* "src/lxml/dtd.pxi":370
 * 
 *         assert self._c_dtd is not NULL, "DTD not initialised"
 *         doc = _documentOrRaise(etree)             # <<<<<<<<<<<<<<
 *         root_node = _rootNodeOrRaise(etree)
 * 
*/
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__documentOrRaise(__pyx_v_etree)); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 370, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/dtd.pxi":371
 *         assert self._c_dtd is not NULL, "DTD not initialised"
 *         doc = _documentOrRaise(etree)
 *         root_node = _rootNodeOrRaise(etree)             # <<<<<<<<<<<<<<
 * 
 *         valid_ctxt = dtdvalid.xmlNewValidCtxt()
*/
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__rootNodeOrRaise(__pyx_v_etree)); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 371, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_root_node = ((struct LxmlElement *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/dtd.pxi":373
 *         root_node = _rootNodeOrRaise(etree)
 * 
 *         valid_ctxt = dtdvalid.xmlNewValidCtxt()             # <<<<<<<<<<<<<<
 *         if valid_ctxt is NULL:
 *             raise DTDError("Failed to create validation context")
*/
  __pyx_v_valid_ctxt = xmlNewValidCtxt();

  /* "src/lxml/dtd.pxi":374
 * 
 *         valid_ctxt = dtdvalid.xmlNewValidCtxt()
 *         if valid_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             raise DTDError("Failed to create validation context")
 * 
*/
  __pyx_t_1 = (__pyx_v_valid_ctxt == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/dtd.pxi":375
 *         valid_ctxt = dtdvalid.xmlNewValidCtxt()
 *         if valid_ctxt is NULL:
 *             raise DTDError("Failed to create validation context")             # <<<<<<<<<<<<<<
 * 
 *         # work around error reporting bug in libxml2 <= 2.9.1 (and later?)
*/
    __pyx_t_3 = NULL;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Failed_to_create_validation_cont};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_DTDError, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 375, __pyx_L1_error)
      __Pyx_GOTREF((PyObject *)__pyx_t_2);
    }
    __Pyx_Raise(((PyObject *)__pyx_t_2), 0, 0, 0);
    __Pyx_DECREF((PyObject *)__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(21, 375, __pyx_L1_error)

    /* "src/lxml/dtd.pxi":374
 * 
 *         valid_ctxt = dtdvalid.xmlNewValidCtxt()
 *         if valid_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             raise DTDError("Failed to create validation context")
 * 
*/
  }

  /* "src/lxml/dtd.pxi":379
 *         # work around error reporting bug in libxml2 <= 2.9.1 (and later?)
 *         # https://bugzilla.gnome.org/show_bug.cgi?id=724903
 *         valid_ctxt.error = <dtdvalid.xmlValidityErrorFunc>_nullGenericErrorFunc             # <<<<<<<<<<<<<<
 *         valid_ctxt.userData = NULL
 * 
*/
  __pyx_v_valid_ctxt->error = ((xmlValidityErrorFunc)__pyx_f_4lxml_5etree__nullGenericErrorFunc);

  /* "src/lxml/dtd.pxi":380
 *         # https://bugzilla.gnome.org/show_bug.cgi?id=724903
 *         valid_ctxt.error = <dtdvalid.xmlValidityErrorFunc>_nullGenericErrorFunc
 *         valid_ctxt.userData = NULL             # <<<<<<<<<<<<<<
 * 
 *         try:
*/
  __pyx_v_valid_ctxt->userData = NULL;

  /* "src/lxml/dtd.pxi":382
 *         valid_ctxt.userData = NULL
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             with self._error_log:
 *                 c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
*/
  /*try:*/ {

    /* "src/lxml/dtd.pxi":383
 * 
 *         try:
 *             with self._error_log:             # <<<<<<<<<<<<<<
 *                 c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *                 ret = dtdvalid.xmlValidateDtd(valid_ctxt, c_doc, self._c_dtd)
*/
    /*with:*/ {
      __pyx_t_5 = __Pyx_PyObject_LookupSpecial(((PyObject *)__pyx_v_self->__pyx_base._error_log), __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_5)) __PYX_ERR(21, 383, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __pyx_f_4lxml_5etree_9_ErrorLog___enter__(__pyx_v_self->__pyx_base._error_log); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(21, 383, __pyx_L7_error)
      /*try:*/ {
        {
          __Pyx_PyThreadState_declare
          __Pyx_PyThreadState_assign
          __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
          __Pyx_XGOTREF(__pyx_t_7);
          __Pyx_XGOTREF(__pyx_t_8);
          __Pyx_XGOTREF(__pyx_t_9);
          /*try:*/ {

            /* "src/lxml/dtd.pxi":384
 *         try:
 *             with self._error_log:
 *                 c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)             # <<<<<<<<<<<<<<
 *                 ret = dtdvalid.xmlValidateDtd(valid_ctxt, c_doc, self._c_dtd)
 *                 _destroyFakeDoc(doc._c_doc, c_doc)
*/
            __pyx_t_10 = __pyx_f_4lxml_5etree__fakeRootDoc(__pyx_v_doc->_c_doc, __pyx_v_root_node->_c_node); if (unlikely(__pyx_t_10 == ((void *)NULL))) __PYX_ERR(21, 384, __pyx_L11_error)
            __pyx_v_c_doc = __pyx_t_10;

            /* "src/lxml/dtd.pxi":385
 *             with self._error_log:
 *                 c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *                 ret = dtdvalid.xmlValidateDtd(valid_ctxt, c_doc, self._c_dtd)             # <<<<<<<<<<<<<<
 *                 _destroyFakeDoc(doc._c_doc, c_doc)
 *         finally:
*/
            __pyx_v_ret = xmlValidateDtd(__pyx_v_valid_ctxt, __pyx_v_c_doc, __pyx_v_self->_c_dtd);

            /* "src/lxml/dtd.pxi":386
 *                 c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *                 ret = dtdvalid.xmlValidateDtd(valid_ctxt, c_doc, self._c_dtd)
 *                 _destroyFakeDoc(doc._c_doc, c_doc)             # <<<<<<<<<<<<<<
 *         finally:
 *             dtdvalid.xmlFreeValidCtxt(valid_ctxt)
*/
            __pyx_f_4lxml_5etree__destroyFakeDoc(__pyx_v_doc->_c_doc, __pyx_v_c_doc);

            /* "src/lxml/dtd.pxi":383
 * 
 *         try:
 *             with self._error_log:             # <<<<<<<<<<<<<<
 *                 c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *                 ret = dtdvalid.xmlValidateDtd(valid_ctxt, c_doc, self._c_dtd)
*/
          }
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          goto __pyx_L16_try_end;
          __pyx_L11_error:;
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          /*except:*/ {
            __Pyx_AddTraceback("lxml.etree.DTD.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
            if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_11) < 0) __PYX_ERR(21, 383, __pyx_L13_except_error)
            __Pyx_XGOTREF(__pyx_t_2);
            __Pyx_XGOTREF(__pyx_t_3);
            __Pyx_XGOTREF(__pyx_t_11);
            __pyx_t_12 = PyTuple_Pack(3, __pyx_t_2, __pyx_t_3, __pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(21, 383, __pyx_L13_except_error)
            __Pyx_GOTREF(__pyx_t_12);
            __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_12, NULL);
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
            if (unlikely(!__pyx_t_13)) __PYX_ERR(21, 383, __pyx_L13_except_error)
            __Pyx_GOTREF(__pyx_t_13);
            __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_13);
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
            if (__pyx_t_1 < (0)) __PYX_ERR(21, 383, __pyx_L13_except_error)
            __pyx_t_14 = (!__pyx_t_1);
            if (unlikely(__pyx_t_14)) {
              __Pyx_GIVEREF(__pyx_t_2);
              __Pyx_GIVEREF(__pyx_t_3);
              __Pyx_XGIVEREF(__pyx_t_11);
              __Pyx_ErrRestoreWithState(__pyx_t_2, __pyx_t_3, __pyx_t_11);
              __pyx_t_2 = 0;  __pyx_t_3 = 0;  __pyx_t_11 = 0; 
              __PYX_ERR(21, 383, __pyx_L13_except_error)
            }
            __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
            __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
            goto __pyx_L12_exception_handled;
          }
          __pyx_L13_except_error:;
          __Pyx_XGIVEREF(__pyx_t_7);
          __Pyx_XGIVEREF(__pyx_t_8);
          __Pyx_XGIVEREF(__pyx_t_9);
          __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
          goto __pyx_L5_error;
          __pyx_L12_exception_handled:;
          __Pyx_XGIVEREF(__pyx_t_7);
          __Pyx_XGIVEREF(__pyx_t_8);
          __Pyx_XGIVEREF(__pyx_t_9);
          __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
          __pyx_L16_try_end:;
        }
      }
      /*finally:*/ {
        /*normal exit:*/{
          if (__pyx_t_5) {
            __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_mstate_global->__pyx_tuple[3], NULL);
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
            if (unlikely(!__pyx_t_9)) __PYX_ERR(21, 383, __pyx_L5_error)
            __Pyx_GOTREF(__pyx_t_9);
            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          }
          goto __pyx_L10;
        }
        __pyx_L10:;
      }
      goto __pyx_L20;
      __pyx_L7_error:;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L5_error;
      __pyx_L20:;
    }
  }

  /* "src/lxml/dtd.pxi":388
 *                 _destroyFakeDoc(doc._c_doc, c_doc)
 *         finally:
 *             dtdvalid.xmlFreeValidCtxt(valid_ctxt)             # <<<<<<<<<<<<<<
 * 
 *         if ret == -1:
*/
  /*finally:*/ {
    /*normal exit:*/{
      xmlFreeValidCtxt(__pyx_v_valid_ctxt);
      goto __pyx_L6;
    }
    __pyx_L5_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_5 = 0; __pyx_t_9 = 0; __pyx_t_8 = 0; __pyx_t_7 = 0; __pyx_t_13 = 0; __pyx_t_17 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_7, &__pyx_t_13, &__pyx_t_17);
      if ( unlikely(__Pyx_GetException(&__pyx_t_5, &__pyx_t_9, &__pyx_t_8) < 0)) __Pyx_ErrFetch(&__pyx_t_5, &__pyx_t_9, &__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_17);
      __pyx_t_6 = __pyx_lineno; __pyx_t_15 = __pyx_clineno; __pyx_t_16 = __pyx_filename;
      {
        xmlFreeValidCtxt(__pyx_v_valid_ctxt);
      }
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_XGIVEREF(__pyx_t_17);
      __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_13, __pyx_t_17);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_ErrRestore(__pyx_t_5, __pyx_t_9, __pyx_t_8);
      __pyx_t_5 = 0; __pyx_t_9 = 0; __pyx_t_8 = 0; __pyx_t_7 = 0; __pyx_t_13 = 0; __pyx_t_17 = 0;
      __pyx_lineno = __pyx_t_6; __pyx_clineno = __pyx_t_15; __pyx_filename = __pyx_t_16;
      goto __pyx_L1_error;
    }
    __pyx_L6:;
  }

  /* "src/lxml/dtd.pxi":390
 *             dtdvalid.xmlFreeValidCtxt(valid_ctxt)
 * 
 *         if ret == -1:             # <<<<<<<<<<<<<<
 *             raise DTDValidateError("Internal error in DTD validation",
 *                                    self._error_log)
*/
  __pyx_t_14 = (__pyx_v_ret == -1L);
  if (unlikely(__pyx_t_14)) {

    /* "src/lxml/dtd.pxi":391
 * 
 *         if ret == -1:
 *             raise DTDValidateError("Internal error in DTD validation",             # <<<<<<<<<<<<<<
 *                                    self._error_log)
 *         return ret == 1
*/
    __pyx_t_3 = NULL;

    /* "src/lxml/dtd.pxi":392
 *         if ret == -1:
 *             raise DTDValidateError("Internal error in DTD validation",
 *                                    self._error_log)             # <<<<<<<<<<<<<<
 *         return ret == 1
 * 
*/
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Internal_error_in_DTD_validation, ((PyObject *)__pyx_v_self->__pyx_base._error_log)};
      __pyx_t_11 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_DTDValidateError, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_11)) __PYX_ERR(21, 391, __pyx_L1_error)
      __Pyx_GOTREF((PyObject *)__pyx_t_11);
    }
    __Pyx_Raise(((PyObject *)__pyx_t_11), 0, 0, 0);
    __Pyx_DECREF((PyObject *)__pyx_t_11); __pyx_t_11 = 0;
    __PYX_ERR(21, 391, __pyx_L1_error)

    /* "src/lxml/dtd.pxi":390
 *             dtdvalid.xmlFreeValidCtxt(valid_ctxt)
 * 
 *         if ret == -1:             # <<<<<<<<<<<<<<
 *             raise DTDValidateError("Internal error in DTD validation",
 *                                    self._error_log)
*/
  }

  /* "src/lxml/dtd.pxi":393
 *             raise DTDValidateError("Internal error in DTD validation",
 *                                    self._error_log)
 *         return ret == 1             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_11 = __Pyx_PyBool_FromLong((__pyx_v_ret == 1)); if (unlikely(!__pyx_t_11)) __PYX_ERR(21, 393, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_r = __pyx_t_11;
  __pyx_t_11 = 0;
  goto __pyx_L0;

  /* "src/lxml/dtd.pxi":356
 *         tree.xmlFreeDtd(self._c_dtd)
 * 
 *     def __call__(self, etree):             # <<<<<<<<<<<<<<
 *         """__call__(self, etree)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("lxml.etree.DTD.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XDECREF((PyObject *)__pyx_v_root_node);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/dtd.pxi":396
 * 
 * 
 * cdef tree.xmlDtd* _parseDtdFromFilelike(file) except NULL:             # <<<<<<<<<<<<<<
 *     cdef _ExceptionContext exc_context
 *     cdef _FileReaderContext dtd_parser
*/

static xmlDtd *__pyx_f_4lxml_5etree__parseDtdFromFilelike(PyObject *__pyx_v_file) {
  struct __pyx_obj_4lxml_5etree__ExceptionContext *__pyx_v_exc_context = 0;
  struct __pyx_obj_4lxml_5etree__FileReaderContext *__pyx_v_dtd_parser = 0;
  struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_error_log = 0;
  xmlDtd *__pyx_v_c_dtd;
  xmlDtd *__pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_parseDtdFromFilelike", 0);

  /* "src/lxml/dtd.pxi":400
 *     cdef _FileReaderContext dtd_parser
 *     cdef _ErrorLog error_log
 *     cdef tree.xmlDtd* c_dtd = NULL             # <<<<<<<<<<<<<<
 *     exc_context = _ExceptionContext()
 *     dtd_parser = _FileReaderContext(file, exc_context, None)
*/
  __pyx_v_c_dtd = NULL;

  /* "src/lxml/dtd.pxi":401
 *     cdef _ErrorLog error_log
 *     cdef tree.xmlDtd* c_dtd = NULL
 *     exc_context = _ExceptionContext()             # <<<<<<<<<<<<<<
 *     dtd_parser = _FileReaderContext(file, exc_context, None)
 *     error_log = _ErrorLog()
*/
  __pyx_t_2 = NULL;
  __pyx_t_3 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ExceptionContext, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 401, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __pyx_v_exc_context = ((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/dtd.pxi":402
 *     cdef tree.xmlDtd* c_dtd = NULL
 *     exc_context = _ExceptionContext()
 *     dtd_parser = _FileReaderContext(file, exc_context, None)             # <<<<<<<<<<<<<<
 *     error_log = _ErrorLog()
 * 
*/
  __pyx_t_2 = NULL;
  __pyx_t_3 = 1;
  {
    PyObject *__pyx_callargs[4] = {__pyx_t_2, __pyx_v_file, ((PyObject *)__pyx_v_exc_context), Py_None};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__FileReaderContext, __pyx_callargs+__pyx_t_3, (4-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 402, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __pyx_v_dtd_parser = ((struct __pyx_obj_4lxml_5etree__FileReaderContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/dtd.pxi":403
 *     exc_context = _ExceptionContext()
 *     dtd_parser = _FileReaderContext(file, exc_context, None)
 *     error_log = _ErrorLog()             # <<<<<<<<<<<<<<
 * 
 *     with error_log:
*/
  __pyx_t_2 = NULL;
  __pyx_t_3 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ErrorLog, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 403, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __pyx_v_error_log = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/dtd.pxi":405
 *     error_log = _ErrorLog()
 * 
 *     with error_log:             # <<<<<<<<<<<<<<
 *         c_dtd = dtd_parser._readDtd()
 * 
*/
  /*with:*/ {
    __pyx_t_4 = __Pyx_PyObject_LookupSpecial(((PyObject *)__pyx_v_error_log), __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_4)) __PYX_ERR(21, 405, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __pyx_f_4lxml_5etree_9_ErrorLog___enter__(__pyx_v_error_log); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(21, 405, __pyx_L3_error)
    /*try:*/ {
      {
        (void)__pyx_t_6; (void)__pyx_t_7; (void)__pyx_t_8; /* mark used */
        /*try:*/ {

          /* "src/lxml/dtd.pxi":406
 * 
 *     with error_log:
 *         c_dtd = dtd_parser._readDtd()             # <<<<<<<<<<<<<<
 * 
 *     exc_context._raise_if_stored()
*/
          __pyx_v_c_dtd = __pyx_f_4lxml_5etree_18_FileReaderContext__readDtd(__pyx_v_dtd_parser);

          /* "src/lxml/dtd.pxi":405
 *     error_log = _ErrorLog()
 * 
 *     with error_log:             # <<<<<<<<<<<<<<
 *         c_dtd = dtd_parser._readDtd()
 * 
*/
        }
      }
    }
    /*finally:*/ {
      /*normal exit:*/{
        if (__pyx_t_4) {
          __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_mstate_global->__pyx_tuple[3], NULL);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_8)) __PYX_ERR(21, 405, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
        goto __pyx_L6;
      }
      __pyx_L6:;
    }
    goto __pyx_L13;
    __pyx_L3_error:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L1_error;
    __pyx_L13:;
  }

  /* "src/lxml/dtd.pxi":408
 *         c_dtd = dtd_parser._readDtd()
 * 
 *     exc_context._raise_if_stored()             # <<<<<<<<<<<<<<
 *     if c_dtd is NULL:
 *         raise DTDParseError("error parsing DTD", error_log)
*/
  __pyx_t_5 = __pyx_f_4lxml_5etree_17_ExceptionContext__raise_if_stored(__pyx_v_exc_context); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(21, 408, __pyx_L1_error)

  /* "src/lxml/dtd.pxi":409
 * 
 *     exc_context._raise_if_stored()
 *     if c_dtd is NULL:             # <<<<<<<<<<<<<<
 *         raise DTDParseError("error parsing DTD", error_log)
 *     return c_dtd
*/
  __pyx_t_9 = (__pyx_v_c_dtd == NULL);
  if (unlikely(__pyx_t_9)) {

    /* "src/lxml/dtd.pxi":410
 *     exc_context._raise_if_stored()
 *     if c_dtd is NULL:
 *         raise DTDParseError("error parsing DTD", error_log)             # <<<<<<<<<<<<<<
 *     return c_dtd
 * 
*/
    __pyx_t_2 = NULL;
    __pyx_t_3 = 1;
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_error_parsing_DTD, ((PyObject *)__pyx_v_error_log)};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_DTDParseError, __pyx_callargs+__pyx_t_3, (3-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 410, __pyx_L1_error)
      __Pyx_GOTREF((PyObject *)__pyx_t_1);
    }
    __Pyx_Raise(((PyObject *)__pyx_t_1), 0, 0, 0);
    __Pyx_DECREF((PyObject *)__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(21, 410, __pyx_L1_error)

    /* "src/lxml/dtd.pxi":409
 * 
 *     exc_context._raise_if_stored()
 *     if c_dtd is NULL:             # <<<<<<<<<<<<<<
 *         raise DTDParseError("error parsing DTD", error_log)
 *     return c_dtd
*/
  }

  /* "src/lxml/dtd.pxi":411
 *     if c_dtd is NULL:
 *         raise DTDParseError("error parsing DTD", error_log)
 *     return c_dtd             # <<<<<<<<<<<<<<
 * 
 * cdef DTD _dtdFactory(tree.xmlDtd* c_dtd):
*/
  __pyx_r = __pyx_v_c_dtd;
  goto __pyx_L0;

  /* "src/lxml/dtd.pxi":396
 * 
 * 
 * cdef tree.xmlDtd* _parseDtdFromFilelike(file) except NULL:             # <<<<<<<<<<<<<<
 *     cdef _ExceptionContext exc_context
 *     cdef _FileReaderContext dtd_parser
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._parseDtdFromFilelike", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_exc_context);
  __Pyx_XDECREF((PyObject *)__pyx_v_dtd_parser);
  __Pyx_XDECREF((PyObject *)__pyx_v_error_log);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/dtd.pxi":413
 *     return c_dtd
 * 
 * cdef DTD _dtdFactory(tree.xmlDtd* c_dtd):             # <<<<<<<<<<<<<<
 *     # do not run through DTD.__init__()!
 *     cdef DTD dtd
*/

static struct __pyx_obj_4lxml_5etree_DTD *__pyx_f_4lxml_5etree__dtdFactory(xmlDtd *__pyx_v_c_dtd) {
  struct __pyx_obj_4lxml_5etree_DTD *__pyx_v_dtd = 0;
  struct __pyx_obj_4lxml_5etree_DTD *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  xmlDtd *__pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_dtdFactory", 0);

  /* "src/lxml/dtd.pxi":416
 *     # do not run through DTD.__init__()!
 *     cdef DTD dtd
 *     if c_dtd is NULL:             # <<<<<<<<<<<<<<
 *         return None
 *     dtd = DTD.__new__(DTD)
*/
  __pyx_t_1 = (__pyx_v_c_dtd == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/dtd.pxi":417
 *     cdef DTD dtd
 *     if c_dtd is NULL:
 *         return None             # <<<<<<<<<<<<<<
 *     dtd = DTD.__new__(DTD)
 *     dtd._c_dtd = _copyDtd(c_dtd)
*/
    __Pyx_XDECREF((PyObject *)__pyx_r);
    __pyx_r = ((struct __pyx_obj_4lxml_5etree_DTD *)Py_None); __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":416
 *     # do not run through DTD.__init__()!
 *     cdef DTD dtd
 *     if c_dtd is NULL:             # <<<<<<<<<<<<<<
 *         return None
 *     dtd = DTD.__new__(DTD)
*/
  }

  /* "src/lxml/dtd.pxi":418
 *     if c_dtd is NULL:
 *         return None
 *     dtd = DTD.__new__(DTD)             # <<<<<<<<<<<<<<
 *     dtd._c_dtd = _copyDtd(c_dtd)
 *     _Validator.__init__(dtd)
*/
  __pyx_t_2 = ((PyObject *)__pyx_tp_new_4lxml_5etree_DTD(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_DTD), __pyx_mstate_global->__pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 418, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_2);
  __pyx_v_dtd = ((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/dtd.pxi":419
 *         return None
 *     dtd = DTD.__new__(DTD)
 *     dtd._c_dtd = _copyDtd(c_dtd)             # <<<<<<<<<<<<<<
 *     _Validator.__init__(dtd)
 *     return dtd
*/
  __pyx_t_3 = __pyx_f_4lxml_5etree__copyDtd(__pyx_v_c_dtd); if (unlikely(__pyx_t_3 == ((void *)NULL))) __PYX_ERR(21, 419, __pyx_L1_error)
  __pyx_v_dtd->_c_dtd = __pyx_t_3;

  /* "src/lxml/dtd.pxi":420
 *     dtd = DTD.__new__(DTD)
 *     dtd._c_dtd = _copyDtd(c_dtd)
 *     _Validator.__init__(dtd)             # <<<<<<<<<<<<<<
 *     return dtd
 * 
*/
  __pyx_t_4 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Validator);
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, ((PyObject *)__pyx_v_dtd)};
    __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_init, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 420, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/dtd.pxi":421
 *     dtd._c_dtd = _copyDtd(c_dtd)
 *     _Validator.__init__(dtd)
 *     return dtd             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_dtd);
  __pyx_r = __pyx_v_dtd;
  goto __pyx_L0;

  /* "src/lxml/dtd.pxi":413
 *     return c_dtd
 * 
 * cdef DTD _dtdFactory(tree.xmlDtd* c_dtd):             # <<<<<<<<<<<<<<
 *     # do not run through DTD.__init__()!
 *     cdef DTD dtd
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._dtdFactory", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_dtd);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/dtd.pxi":424
 * 
 * 
 * cdef tree.xmlDtd* _copyDtd(tree.xmlDtd* c_orig_dtd) except NULL:             # <<<<<<<<<<<<<<
 *     """
 *     Copy a DTD.  libxml2 (currently) fails to set up the element->attributes
*/

static xmlDtd *__pyx_f_4lxml_5etree__copyDtd(xmlDtd *__pyx_v_c_orig_dtd) {
  xmlDtd *__pyx_v_c_dtd;
  xmlNode *__pyx_v_c_node;
  xmlDtd *__pyx_r;
  int __pyx_t_1;
  xmlNode *__pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/dtd.pxi":429
 *     links when copying DTDs, so we have to rebuild them here.
 *     """
 *     c_dtd = tree.xmlCopyDtd(c_orig_dtd)             # <<<<<<<<<<<<<<
 *     if not c_dtd:
 *         raise MemoryError
*/
  __pyx_v_c_dtd = xmlCopyDtd(__pyx_v_c_orig_dtd);

  /* "src/lxml/dtd.pxi":430
 *     """
 *     c_dtd = tree.xmlCopyDtd(c_orig_dtd)
 *     if not c_dtd:             # <<<<<<<<<<<<<<
 *         raise MemoryError
 *     cdef tree.xmlNode* c_node = c_dtd.children
*/
  __pyx_t_1 = (!(__pyx_v_c_dtd != 0));
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/dtd.pxi":431
 *     c_dtd = tree.xmlCopyDtd(c_orig_dtd)
 *     if not c_dtd:
 *         raise MemoryError             # <<<<<<<<<<<<<<
 *     cdef tree.xmlNode* c_node = c_dtd.children
 *     while c_node:
*/
    PyErr_NoMemory(); __PYX_ERR(21, 431, __pyx_L1_error)

    /* "src/lxml/dtd.pxi":430
 *     """
 *     c_dtd = tree.xmlCopyDtd(c_orig_dtd)
 *     if not c_dtd:             # <<<<<<<<<<<<<<
 *         raise MemoryError
 *     cdef tree.xmlNode* c_node = c_dtd.children
*/
  }

  /* "src/lxml/dtd.pxi":432
 *     if not c_dtd:
 *         raise MemoryError
 *     cdef tree.xmlNode* c_node = c_dtd.children             # <<<<<<<<<<<<<<
 *     while c_node:
 *         if c_node.type == tree.XML_ATTRIBUTE_DECL:
*/
  __pyx_t_2 = __pyx_v_c_dtd->children;
  __pyx_v_c_node = __pyx_t_2;

  /* "src/lxml/dtd.pxi":433
 *         raise MemoryError
 *     cdef tree.xmlNode* c_node = c_dtd.children
 *     while c_node:             # <<<<<<<<<<<<<<
 *         if c_node.type == tree.XML_ATTRIBUTE_DECL:
 *             _linkDtdAttribute(c_dtd, <tree.xmlAttribute*>c_node)
*/
  while (1) {
    __pyx_t_1 = (__pyx_v_c_node != 0);
    if (!__pyx_t_1) break;

    /* "src/lxml/dtd.pxi":434
 *     cdef tree.xmlNode* c_node = c_dtd.children
 *     while c_node:
 *         if c_node.type == tree.XML_ATTRIBUTE_DECL:             # <<<<<<<<<<<<<<
 *             _linkDtdAttribute(c_dtd, <tree.xmlAttribute*>c_node)
 *         c_node = c_node.next
*/
    __pyx_t_1 = (__pyx_v_c_node->type == XML_ATTRIBUTE_DECL);
    if (__pyx_t_1) {

      /* "src/lxml/dtd.pxi":435
 *     while c_node:
 *         if c_node.type == tree.XML_ATTRIBUTE_DECL:
 *             _linkDtdAttribute(c_dtd, <tree.xmlAttribute*>c_node)             # <<<<<<<<<<<<<<
 *         c_node = c_node.next
 *     return c_dtd
*/
      __pyx_f_4lxml_5etree__linkDtdAttribute(__pyx_v_c_dtd, ((xmlAttribute *)__pyx_v_c_node));

      /* "src/lxml/dtd.pxi":434
 *     cdef tree.xmlNode* c_node = c_dtd.children
 *     while c_node:
 *         if c_node.type == tree.XML_ATTRIBUTE_DECL:             # <<<<<<<<<<<<<<
 *             _linkDtdAttribute(c_dtd, <tree.xmlAttribute*>c_node)
 *         c_node = c_node.next
*/
    }

    /* "src/lxml/dtd.pxi":436
 *         if c_node.type == tree.XML_ATTRIBUTE_DECL:
 *             _linkDtdAttribute(c_dtd, <tree.xmlAttribute*>c_node)
 *         c_node = c_node.next             # <<<<<<<<<<<<<<
 *     return c_dtd
 * 
*/
    __pyx_t_2 = __pyx_v_c_node->next;
    __pyx_v_c_node = __pyx_t_2;
  }

  /* "src/lxml/dtd.pxi":437
 *             _linkDtdAttribute(c_dtd, <tree.xmlAttribute*>c_node)
 *         c_node = c_node.next
 *     return c_dtd             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = __pyx_v_c_dtd;
  goto __pyx_L0;

  /* "src/lxml/dtd.pxi":424
 * 
 * 
 * cdef tree.xmlDtd* _copyDtd(tree.xmlDtd* c_orig_dtd) except NULL:             # <<<<<<<<<<<<<<
 *     """
 *     Copy a DTD.  libxml2 (currently) fails to set up the element->attributes
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._copyDtd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/dtd.pxi":440
 * 
 * 
 * cdef void _linkDtdAttribute(tree.xmlDtd* c_dtd, tree.xmlAttribute* c_attr) noexcept:             # <<<<<<<<<<<<<<
 *     """
 *     Create the link to the DTD attribute declaration from the corresponding
*/

static void __pyx_f_4lxml_5etree__linkDtdAttribute(xmlDtd *__pyx_v_c_dtd, xmlAttribute *__pyx_v_c_attr) {
  xmlElement *__pyx_v_c_elem;
  xmlAttribute *__pyx_v_c_pos;
  int __pyx_t_1;
  xmlAttribute *__pyx_t_2;
  int __pyx_t_3;

  /* "src/lxml/dtd.pxi":445
 *     element declaration.
 *     """
 *     c_elem = dtdvalid.xmlGetDtdElementDesc(c_dtd, c_attr.elem)             # <<<<<<<<<<<<<<
 *     if not c_elem:
 *         # no such element? something is wrong with the DTD ...
*/
  __pyx_v_c_elem = xmlGetDtdElementDesc(__pyx_v_c_dtd, __pyx_v_c_attr->elem);

  /* "src/lxml/dtd.pxi":446
 *     """
 *     c_elem = dtdvalid.xmlGetDtdElementDesc(c_dtd, c_attr.elem)
 *     if not c_elem:             # <<<<<<<<<<<<<<
 *         # no such element? something is wrong with the DTD ...
 *         return
*/
  __pyx_t_1 = (!(__pyx_v_c_elem != 0));
  if (__pyx_t_1) {

    /* "src/lxml/dtd.pxi":448
 *     if not c_elem:
 *         # no such element? something is wrong with the DTD ...
 *         return             # <<<<<<<<<<<<<<
 *     c_pos = c_elem.attributes
 *     if not c_pos:
*/
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":446
 *     """
 *     c_elem = dtdvalid.xmlGetDtdElementDesc(c_dtd, c_attr.elem)
 *     if not c_elem:             # <<<<<<<<<<<<<<
 *         # no such element? something is wrong with the DTD ...
 *         return
*/
  }

  /* "src/lxml/dtd.pxi":449
 *         # no such element? something is wrong with the DTD ...
 *         return
 *     c_pos = c_elem.attributes             # <<<<<<<<<<<<<<
 *     if not c_pos:
 *         c_elem.attributes = c_attr
*/
  __pyx_t_2 = __pyx_v_c_elem->attributes;
  __pyx_v_c_pos = __pyx_t_2;

  /* "src/lxml/dtd.pxi":450
 *         return
 *     c_pos = c_elem.attributes
 *     if not c_pos:             # <<<<<<<<<<<<<<
 *         c_elem.attributes = c_attr
 *         c_attr.nexth = NULL
*/
  __pyx_t_1 = (!(__pyx_v_c_pos != 0));
  if (__pyx_t_1) {

    /* "src/lxml/dtd.pxi":451
 *     c_pos = c_elem.attributes
 *     if not c_pos:
 *         c_elem.attributes = c_attr             # <<<<<<<<<<<<<<
 *         c_attr.nexth = NULL
 *         return
*/
    __pyx_v_c_elem->attributes = __pyx_v_c_attr;

    /* "src/lxml/dtd.pxi":452
 *     if not c_pos:
 *         c_elem.attributes = c_attr
 *         c_attr.nexth = NULL             # <<<<<<<<<<<<<<
 *         return
 *     # libxml2 keeps namespace declarations first, and we need to make
*/
    __pyx_v_c_attr->nexth = NULL;

    /* "src/lxml/dtd.pxi":453
 *         c_elem.attributes = c_attr
 *         c_attr.nexth = NULL
 *         return             # <<<<<<<<<<<<<<
 *     # libxml2 keeps namespace declarations first, and we need to make
 *     # sure we don't re-insert attributes that are already there
*/
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":450
 *         return
 *     c_pos = c_elem.attributes
 *     if not c_pos:             # <<<<<<<<<<<<<<
 *         c_elem.attributes = c_attr
 *         c_attr.nexth = NULL
*/
  }

  /* "src/lxml/dtd.pxi":456
 *     # libxml2 keeps namespace declarations first, and we need to make
 *     # sure we don't re-insert attributes that are already there
 *     if _isDtdNsDecl(c_attr):             # <<<<<<<<<<<<<<
 *         if not _isDtdNsDecl(c_pos):
 *             c_elem.attributes = c_attr
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__isDtdNsDecl(__pyx_v_c_attr);
  if (__pyx_t_1) {

    /* "src/lxml/dtd.pxi":457
 *     # sure we don't re-insert attributes that are already there
 *     if _isDtdNsDecl(c_attr):
 *         if not _isDtdNsDecl(c_pos):             # <<<<<<<<<<<<<<
 *             c_elem.attributes = c_attr
 *             c_attr.nexth = c_pos
*/
    __pyx_t_1 = (!__pyx_f_4lxml_5etree__isDtdNsDecl(__pyx_v_c_pos));
    if (__pyx_t_1) {

      /* "src/lxml/dtd.pxi":458
 *     if _isDtdNsDecl(c_attr):
 *         if not _isDtdNsDecl(c_pos):
 *             c_elem.attributes = c_attr             # <<<<<<<<<<<<<<
 *             c_attr.nexth = c_pos
 *             return
*/
      __pyx_v_c_elem->attributes = __pyx_v_c_attr;

      /* "src/lxml/dtd.pxi":459
 *         if not _isDtdNsDecl(c_pos):
 *             c_elem.attributes = c_attr
 *             c_attr.nexth = c_pos             # <<<<<<<<<<<<<<
 *             return
 *         while c_pos != c_attr and c_pos.nexth and _isDtdNsDecl(c_pos.nexth):
*/
      __pyx_v_c_attr->nexth = __pyx_v_c_pos;

      /* "src/lxml/dtd.pxi":460
 *             c_elem.attributes = c_attr
 *             c_attr.nexth = c_pos
 *             return             # <<<<<<<<<<<<<<
 *         while c_pos != c_attr and c_pos.nexth and _isDtdNsDecl(c_pos.nexth):
 *             c_pos = c_pos.nexth
*/
      goto __pyx_L0;

      /* "src/lxml/dtd.pxi":457
 *     # sure we don't re-insert attributes that are already there
 *     if _isDtdNsDecl(c_attr):
 *         if not _isDtdNsDecl(c_pos):             # <<<<<<<<<<<<<<
 *             c_elem.attributes = c_attr
 *             c_attr.nexth = c_pos
*/
    }

    /* "src/lxml/dtd.pxi":461
 *             c_attr.nexth = c_pos
 *             return
 *         while c_pos != c_attr and c_pos.nexth and _isDtdNsDecl(c_pos.nexth):             # <<<<<<<<<<<<<<
 *             c_pos = c_pos.nexth
 *     else:
*/
    while (1) {
      __pyx_t_3 = (__pyx_v_c_pos != __pyx_v_c_attr);
      if (__pyx_t_3) {
      } else {
        __pyx_t_1 = __pyx_t_3;
        goto __pyx_L9_bool_binop_done;
      }
      __pyx_t_3 = (__pyx_v_c_pos->nexth != 0);
      if (__pyx_t_3) {
      } else {
        __pyx_t_1 = __pyx_t_3;
        goto __pyx_L9_bool_binop_done;
      }
      __pyx_t_3 = __pyx_f_4lxml_5etree__isDtdNsDecl(__pyx_v_c_pos->nexth);
      __pyx_t_1 = __pyx_t_3;
      __pyx_L9_bool_binop_done:;
      if (!__pyx_t_1) break;

      /* "src/lxml/dtd.pxi":462
 *             return
 *         while c_pos != c_attr and c_pos.nexth and _isDtdNsDecl(c_pos.nexth):
 *             c_pos = c_pos.nexth             # <<<<<<<<<<<<<<
 *     else:
 *         # append at end
*/
      __pyx_t_2 = __pyx_v_c_pos->nexth;
      __pyx_v_c_pos = __pyx_t_2;
    }

    /* "src/lxml/dtd.pxi":456
 *     # libxml2 keeps namespace declarations first, and we need to make
 *     # sure we don't re-insert attributes that are already there
 *     if _isDtdNsDecl(c_attr):             # <<<<<<<<<<<<<<
 *         if not _isDtdNsDecl(c_pos):
 *             c_elem.attributes = c_attr
*/
    goto __pyx_L5;
  }

  /* "src/lxml/dtd.pxi":465
 *     else:
 *         # append at end
 *         while c_pos != c_attr and c_pos.nexth:             # <<<<<<<<<<<<<<
 *             c_pos = c_pos.nexth
 *     if c_pos == c_attr:
*/
  /*else*/ {
    while (1) {
      __pyx_t_3 = (__pyx_v_c_pos != __pyx_v_c_attr);
      if (__pyx_t_3) {
      } else {
        __pyx_t_1 = __pyx_t_3;
        goto __pyx_L14_bool_binop_done;
      }
      __pyx_t_3 = (__pyx_v_c_pos->nexth != 0);
      __pyx_t_1 = __pyx_t_3;
      __pyx_L14_bool_binop_done:;
      if (!__pyx_t_1) break;

      /* "src/lxml/dtd.pxi":466
 *         # append at end
 *         while c_pos != c_attr and c_pos.nexth:
 *             c_pos = c_pos.nexth             # <<<<<<<<<<<<<<
 *     if c_pos == c_attr:
 *         return
*/
      __pyx_t_2 = __pyx_v_c_pos->nexth;
      __pyx_v_c_pos = __pyx_t_2;
    }
  }
  __pyx_L5:;

  /* "src/lxml/dtd.pxi":467
 *         while c_pos != c_attr and c_pos.nexth:
 *             c_pos = c_pos.nexth
 *     if c_pos == c_attr:             # <<<<<<<<<<<<<<
 *         return
 *     c_attr.nexth = c_pos.nexth
*/
  __pyx_t_1 = (__pyx_v_c_pos == __pyx_v_c_attr);
  if (__pyx_t_1) {

    /* "src/lxml/dtd.pxi":468
 *             c_pos = c_pos.nexth
 *     if c_pos == c_attr:
 *         return             # <<<<<<<<<<<<<<
 *     c_attr.nexth = c_pos.nexth
 *     c_pos.nexth = c_attr
*/
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":467
 *         while c_pos != c_attr and c_pos.nexth:
 *             c_pos = c_pos.nexth
 *     if c_pos == c_attr:             # <<<<<<<<<<<<<<
 *         return
 *     c_attr.nexth = c_pos.nexth
*/
  }

  /* "src/lxml/dtd.pxi":469
 *     if c_pos == c_attr:
 *         return
 *     c_attr.nexth = c_pos.nexth             # <<<<<<<<<<<<<<
 *     c_pos.nexth = c_attr
 * 
*/
  __pyx_t_2 = __pyx_v_c_pos->nexth;
  __pyx_v_c_attr->nexth = __pyx_t_2;

  /* "src/lxml/dtd.pxi":470
 *         return
 *     c_attr.nexth = c_pos.nexth
 *     c_pos.nexth = c_attr             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_v_c_pos->nexth = __pyx_v_c_attr;

  /* "src/lxml/dtd.pxi":440
 * 
 * 
 * cdef void _linkDtdAttribute(tree.xmlDtd* c_dtd, tree.xmlAttribute* c_attr) noexcept:             # <<<<<<<<<<<<<<
 *     """
 *     Create the link to the DTD attribute declaration from the corresponding
*/

  /* function exit code */
  __pyx_L0:;
}

/* "src/lxml/dtd.pxi":473
 * 
 * 
 * cdef bint _isDtdNsDecl(tree.xmlAttribute* c_attr) noexcept:             # <<<<<<<<<<<<<<
 *     if cstring_h.strcmp(<const_char*>c_attr.name, "xmlns") == 0:
 *         return True
*/

static int __pyx_f_4lxml_5etree__isDtdNsDecl(xmlAttribute *__pyx_v_c_attr) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;

  /* "src/lxml/dtd.pxi":474
 * 
 * cdef bint _isDtdNsDecl(tree.xmlAttribute* c_attr) noexcept:
 *     if cstring_h.strcmp(<const_char*>c_attr.name, "xmlns") == 0:             # <<<<<<<<<<<<<<
 *         return True
 *     if (c_attr.prefix is not NULL and
*/
  __pyx_t_1 = (strcmp(((const char *)__pyx_v_c_attr->name), __pyx_k_xmlns_2) == 0);
  if (__pyx_t_1) {

    /* "src/lxml/dtd.pxi":475
 * cdef bint _isDtdNsDecl(tree.xmlAttribute* c_attr) noexcept:
 *     if cstring_h.strcmp(<const_char*>c_attr.name, "xmlns") == 0:
 *         return True             # <<<<<<<<<<<<<<
 *     if (c_attr.prefix is not NULL and
 *             cstring_h.strcmp(<const_char*>c_attr.prefix, "xmlns") == 0):
*/
    __pyx_r = 1;
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":474
 * 
 * cdef bint _isDtdNsDecl(tree.xmlAttribute* c_attr) noexcept:
 *     if cstring_h.strcmp(<const_char*>c_attr.name, "xmlns") == 0:             # <<<<<<<<<<<<<<
 *         return True
 *     if (c_attr.prefix is not NULL and
*/
  }

  /* "src/lxml/dtd.pxi":476
 *     if cstring_h.strcmp(<const_char*>c_attr.name, "xmlns") == 0:
 *         return True
 *     if (c_attr.prefix is not NULL and             # <<<<<<<<<<<<<<
 *             cstring_h.strcmp(<const_char*>c_attr.prefix, "xmlns") == 0):
 *         return True
*/
  __pyx_t_2 = (__pyx_v_c_attr->prefix != NULL);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L5_bool_binop_done;
  }

  /* "src/lxml/dtd.pxi":477
 *         return True
 *     if (c_attr.prefix is not NULL and
 *             cstring_h.strcmp(<const_char*>c_attr.prefix, "xmlns") == 0):             # <<<<<<<<<<<<<<
 *         return True
 *     return False
*/
  __pyx_t_2 = (strcmp(((const char *)__pyx_v_c_attr->prefix), __pyx_k_xmlns_2) == 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L5_bool_binop_done:;

  /* "src/lxml/dtd.pxi":476
 *     if cstring_h.strcmp(<const_char*>c_attr.name, "xmlns") == 0:
 *         return True
 *     if (c_attr.prefix is not NULL and             # <<<<<<<<<<<<<<
 *             cstring_h.strcmp(<const_char*>c_attr.prefix, "xmlns") == 0):
 *         return True
*/
  if (__pyx_t_1) {

    /* "src/lxml/dtd.pxi":478
 *     if (c_attr.prefix is not NULL and
 *             cstring_h.strcmp(<const_char*>c_attr.prefix, "xmlns") == 0):
 *         return True             # <<<<<<<<<<<<<<
 *     return False
*/
    __pyx_r = 1;
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":476
 *     if cstring_h.strcmp(<const_char*>c_attr.name, "xmlns") == 0:
 *         return True
 *     if (c_attr.prefix is not NULL and             # <<<<<<<<<<<<<<
 *             cstring_h.strcmp(<const_char*>c_attr.prefix, "xmlns") == 0):
 *         return True
*/
  }

  /* "src/lxml/dtd.pxi":479
 *             cstring_h.strcmp(<const_char*>c_attr.prefix, "xmlns") == 0):
 *         return True
 *     return False             # <<<<<<<<<<<<<<
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/dtd.pxi":473
 * 
 * 
 * cdef bint _isDtdNsDecl(tree.xmlAttribute* c_attr) noexcept:             # <<<<<<<<<<<<<<
 *     if cstring_h.strcmp(<const_char*>c_attr.name, "xmlns") == 0:
 *         return True
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/relaxng.pxi":11
 * 
 * 
 * cdef int _require_rnc2rng() except -1:             # <<<<<<<<<<<<<<
 *     if _rnc2rng is None:
 *         raise RelaxNGParseError(
*/

static int __pyx_f_4lxml_5etree__require_rnc2rng(void) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_require_rnc2rng", 0);

  /* "src/lxml/relaxng.pxi":12
 * 
 * cdef int _require_rnc2rng() except -1:
 *     if _rnc2rng is None:             # <<<<<<<<<<<<<<
 *         raise RelaxNGParseError(
 *             'compact syntax not supported (please install rnc2rng)')
*/
  __pyx_t_1 = (__pyx_v_4lxml_5etree__rnc2rng == Py_None);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/relaxng.pxi":13
 * cdef int _require_rnc2rng() except -1:
 *     if _rnc2rng is None:
 *         raise RelaxNGParseError(             # <<<<<<<<<<<<<<
 *             'compact syntax not supported (please install rnc2rng)')
 *     return 0
*/
    __pyx_t_3 = NULL;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_compact_syntax_not_supported_ple};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_RelaxNGParseError, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(22, 13, __pyx_L1_error)
      __Pyx_GOTREF((PyObject *)__pyx_t_2);
    }
    __Pyx_Raise(((PyObject *)__pyx_t_2), 0, 0, 0);
    __Pyx_DECREF((PyObject *)__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(22, 13, __pyx_L1_error)

    /* "src/lxml/relaxng.pxi":12
 * 
 * cdef int _require_rnc2rng() except -1:
 *     if _rnc2rng is None:             # <<<<<<<<<<<<<<
 *         raise RelaxNGParseError(
 *             'compact syntax not supported (please install rnc2rng)')
*/
  }

  /* "src/lxml/relaxng.pxi":15
 *         raise RelaxNGParseError(
 *             'compact syntax not supported (please install rnc2rng)')
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/relaxng.pxi":11
 * 
 * 
 * cdef int _require_rnc2rng() except -1:             # <<<<<<<<<<<<<<
 *     if _rnc2rng is None:
 *         raise RelaxNGParseError(
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._require_rnc2rng", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/relaxng.pxi":42
 *     """
 *     cdef relaxng.xmlRelaxNG* _c_schema
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._c_schema = NULL
 * 
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_7RelaxNG_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_7RelaxNG_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, __pyx_nargs); return -1; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return -1;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__cinit__", __pyx_kwds); return -1;}
  __pyx_r = __pyx_pf_4lxml_5etree_7RelaxNG___cinit__(((struct __pyx_obj_4lxml_5etree_RelaxNG *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_7RelaxNG___cinit__(struct __pyx_obj_4lxml_5etree_RelaxNG *__pyx_v_self) {
  int __pyx_r;

  /* "src/lxml/relaxng.pxi":43
 *     cdef relaxng.xmlRelaxNG* _c_schema
 *     def __cinit__(self):
 *         self._c_schema = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, etree=None, *, file=None):
*/
  __pyx_v_self->_c_schema = NULL;

  /* "src/lxml/relaxng.pxi":42
 *     """
 *     cdef relaxng.xmlRelaxNG* _c_schema
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._c_schema = NULL
 * 
*/

  /* function exit code */
  __pyx_r = 0;
  return __pyx_r;
}

/* "src/lxml/relaxng.pxi":45
 *         self._c_schema = NULL
 * 
 *     def __init__(self, etree=None, *, file=None):             # <<<<<<<<<<<<<<
 *         cdef _Document doc
 *         cdef _Element root_node
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_7RelaxNG_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_7RelaxNG_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_etree = 0;
  PyObject *__pyx_v_file = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_etree,&__pyx_mstate_global->__pyx_n_u_file,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(22, 45, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(22, 45, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(22, 45, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
    } else {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(22, 45, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_etree = values[0];
    __pyx_v_file = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, __pyx_nargs); __PYX_ERR(22, 45, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.RelaxNG.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_7RelaxNG_2__init__(((struct __pyx_obj_4lxml_5etree_RelaxNG *)__pyx_v_self), __pyx_v_etree, __pyx_v_file);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_7RelaxNG_2__init__(struct __pyx_obj_4lxml_5etree_RelaxNG *__pyx_v_self, PyObject *__pyx_v_etree, PyObject *__pyx_v_file) {
  struct LxmlDocument *__pyx_v_doc = 0;
  struct LxmlElement *__pyx_v_root_node = 0;
  xmlDoc *__pyx_v_fake_c_doc;
  xmlRelaxNGParserCtxt *__pyx_v_parser_ctxt;
  PyObject *__pyx_v_rng_data_utf8 = NULL;
  PyObject *__pyx_v_filename = NULL;
  xmlExternalEntityLoader __pyx_v_orig_loader;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_t_4;
  xmlDoc *__pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  struct __pyx_opt_args_4lxml_5etree__connectGenericErrorLog __pyx_t_13;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "src/lxml/relaxng.pxi":48
 *         cdef _Document doc
 *         cdef _Element root_node
 *         cdef xmlDoc* fake_c_doc = NULL             # <<<<<<<<<<<<<<
 *         cdef relaxng.xmlRelaxNGParserCtxt* parser_ctxt = NULL
 *         _Validator.__init__(self)
*/
  __pyx_v_fake_c_doc = NULL;

  /* "src/lxml/relaxng.pxi":49
 *         cdef _Element root_node
 *         cdef xmlDoc* fake_c_doc = NULL
 *         cdef relaxng.xmlRelaxNGParserCtxt* parser_ctxt = NULL             # <<<<<<<<<<<<<<
 *         _Validator.__init__(self)
 *         if etree is not None:
*/
  __pyx_v_parser_ctxt = NULL;

  /* "src/lxml/relaxng.pxi":50
 *         cdef xmlDoc* fake_c_doc = NULL
 *         cdef relaxng.xmlRelaxNGParserCtxt* parser_ctxt = NULL
 *         _Validator.__init__(self)             # <<<<<<<<<<<<<<
 *         if etree is not None:
 *             doc = _documentOrRaise(etree)
*/
  __pyx_t_2 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Validator);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, ((PyObject *)__pyx_v_self)};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_init, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(22, 50, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/relaxng.pxi":51
 *         cdef relaxng.xmlRelaxNGParserCtxt* parser_ctxt = NULL
 *         _Validator.__init__(self)
 *         if etree is not None:             # <<<<<<<<<<<<<<
 *             doc = _documentOrRaise(etree)
 *             root_node = _rootNodeOrRaise(etree)
*/
  __pyx_t_4 = (__pyx_v_etree != Py_None);
  if (__pyx_t_4) {

    /* "src/lxml/relaxng.pxi":52
 *         _Validator.__init__(self)
 *         if etree is not None:
 *             doc = _documentOrRaise(etree)             # <<<<<<<<<<<<<<
 *             root_node = _rootNodeOrRaise(etree)
 *             fake_c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
*/
    __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__documentOrRaise(__pyx_v_etree)); if (unlikely(!__pyx_t_1)) __PYX_ERR(22, 52, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/relaxng.pxi":53
 *         if etree is not None:
 *             doc = _documentOrRaise(etree)
 *             root_node = _rootNodeOrRaise(etree)             # <<<<<<<<<<<<<<
 *             fake_c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *             parser_ctxt = relaxng.xmlRelaxNGNewDocParserCtxt(fake_c_doc)
*/
    __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__rootNodeOrRaise(__pyx_v_etree)); if (unlikely(!__pyx_t_1)) __PYX_ERR(22, 53, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_root_node = ((struct LxmlElement *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/relaxng.pxi":54
 *             doc = _documentOrRaise(etree)
 *             root_node = _rootNodeOrRaise(etree)
 *             fake_c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)             # <<<<<<<<<<<<<<
 *             parser_ctxt = relaxng.xmlRelaxNGNewDocParserCtxt(fake_c_doc)
 *         elif file is not None:
*/
    __pyx_t_5 = __pyx_f_4lxml_5etree__fakeRootDoc(__pyx_v_doc->_c_doc, __pyx_v_root_node->_c_node); if (unlikely(__pyx_t_5 == ((void *)NULL))) __PYX_ERR(22, 54, __pyx_L1_error)
    __pyx_v_fake_c_doc = __pyx_t_5;

    /* "src/lxml/relaxng.pxi":55
 *             root_node = _rootNodeOrRaise(etree)
 *             fake_c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *             parser_ctxt = relaxng.xmlRelaxNGNewDocParserCtxt(fake_c_doc)             # <<<<<<<<<<<<<<
 *         elif file is not None:
 *             if _isString(file):
*/
    __pyx_v_parser_ctxt = xmlRelaxNGNewDocParserCtxt(__pyx_v_fake_c_doc);

    /* "src/lxml/relaxng.pxi":51
 *         cdef relaxng.xmlRelaxNGParserCtxt* parser_ctxt = NULL
 *         _Validator.__init__(self)
 *         if etree is not None:             # <<<<<<<<<<<<<<
 *             doc = _documentOrRaise(etree)
 *             root_node = _rootNodeOrRaise(etree)
*/
    goto __pyx_L3;
  }

  /* "src/lxml/relaxng.pxi":56
 *             fake_c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *             parser_ctxt = relaxng.xmlRelaxNGNewDocParserCtxt(fake_c_doc)
 *         elif file is not None:             # <<<<<<<<<<<<<<
 *             if _isString(file):
 *                 if file[-4:].lower() == '.rnc':
*/
  __pyx_t_4 = (__pyx_v_file != Py_None);
  if (likely(__pyx_t_4)) {

    /* "src/lxml/relaxng.pxi":57
 *             parser_ctxt = relaxng.xmlRelaxNGNewDocParserCtxt(fake_c_doc)
 *         elif file is not None:
 *             if _isString(file):             # <<<<<<<<<<<<<<
 *                 if file[-4:].lower() == '.rnc':
 *                     _require_rnc2rng()
*/
    __pyx_t_4 = _isString(__pyx_v_file);
    if (__pyx_t_4) {

      /* "src/lxml/relaxng.pxi":58
 *         elif file is not None:
 *             if _isString(file):
 *                 if file[-4:].lower() == '.rnc':             # <<<<<<<<<<<<<<
 *                     _require_rnc2rng()
 *                     rng_data_utf8 = _utf8(_rnc2rng.dumps(_rnc2rng.load(file)))
*/
      __pyx_t_6 = __Pyx_PyObject_GetSlice(__pyx_v_file, -4L, 0, NULL, NULL, &__pyx_mstate_global->__pyx_slice[11], 1, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(22, 58, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_2 = __pyx_t_6;
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_3 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
        __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_lower, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(22, 58, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_mstate_global->__pyx_kp_u_rnc, Py_EQ)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(22, 58, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__pyx_t_4) {

        /* "src/lxml/relaxng.pxi":59
 *             if _isString(file):
 *                 if file[-4:].lower() == '.rnc':
 *                     _require_rnc2rng()             # <<<<<<<<<<<<<<
 *                     rng_data_utf8 = _utf8(_rnc2rng.dumps(_rnc2rng.load(file)))
 *                     doc = _parseMemoryDocument(rng_data_utf8, parser=None, url=file)
*/
        __pyx_t_7 = __pyx_f_4lxml_5etree__require_rnc2rng(); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(22, 59, __pyx_L1_error)

        /* "src/lxml/relaxng.pxi":60
 *                 if file[-4:].lower() == '.rnc':
 *                     _require_rnc2rng()
 *                     rng_data_utf8 = _utf8(_rnc2rng.dumps(_rnc2rng.load(file)))             # <<<<<<<<<<<<<<
 *                     doc = _parseMemoryDocument(rng_data_utf8, parser=None, url=file)
 *                     parser_ctxt = relaxng.xmlRelaxNGNewDocParserCtxt(doc._c_doc)
*/
        __pyx_t_6 = __pyx_v_4lxml_5etree__rnc2rng;
        __Pyx_INCREF(__pyx_t_6);
        __pyx_t_8 = __pyx_v_4lxml_5etree__rnc2rng;
        __Pyx_INCREF(__pyx_t_8);
        __pyx_t_3 = 0;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_v_file};
          __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_load, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(22, 60, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
        }
        __pyx_t_3 = 0;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_2};
          __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_dumps, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(22, 60, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
        }
        __pyx_t_2 = __pyx_f_4lxml_5etree__utf8(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(22, 60, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_v_rng_data_utf8 = ((PyObject*)__pyx_t_2);
        __pyx_t_2 = 0;

        /* "src/lxml/relaxng.pxi":61
 *                     _require_rnc2rng()
 *                     rng_data_utf8 = _utf8(_rnc2rng.dumps(_rnc2rng.load(file)))
 *                     doc = _parseMemoryDocument(rng_data_utf8, parser=None, url=file)             # <<<<<<<<<<<<<<
 *                     parser_ctxt = relaxng.xmlRelaxNGNewDocParserCtxt(doc._c_doc)
 *                 else:
*/
        __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__parseMemoryDocument(__pyx_v_rng_data_utf8, __pyx_v_file, ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None))); if (unlikely(!__pyx_t_2)) __PYX_ERR(22, 61, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_2);
        __pyx_t_2 = 0;

        /* "src/lxml/relaxng.pxi":62
 *                     rng_data_utf8 = _utf8(_rnc2rng.dumps(_rnc2rng.load(file)))
 *                     doc = _parseMemoryDocument(rng_data_utf8, parser=None, url=file)
 *                     parser_ctxt = relaxng.xmlRelaxNGNewDocParserCtxt(doc._c_doc)             # <<<<<<<<<<<<<<
 *                 else:
 *                     doc = None
*/
        __pyx_v_parser_ctxt = xmlRelaxNGNewDocParserCtxt(__pyx_v_doc->_c_doc);

        /* "src/lxml/relaxng.pxi":58
 *         elif file is not None:
 *             if _isString(file):
 *                 if file[-4:].lower() == '.rnc':             # <<<<<<<<<<<<<<
 *                     _require_rnc2rng()
 *                     rng_data_utf8 = _utf8(_rnc2rng.dumps(_rnc2rng.load(file)))
*/
        goto __pyx_L5;
      }

      /* "src/lxml/relaxng.pxi":64
 *                     parser_ctxt = relaxng.xmlRelaxNGNewDocParserCtxt(doc._c_doc)
 *                 else:
 *                     doc = None             # <<<<<<<<<<<<<<
 *                     filename = _encodeFilename(file)
 *                     with self._error_log:
*/
      /*else*/ {
        __Pyx_INCREF(Py_None);
        __pyx_v_doc = ((struct LxmlDocument *)Py_None);

        /* "src/lxml/relaxng.pxi":65
 *                 else:
 *                     doc = None
 *                     filename = _encodeFilename(file)             # <<<<<<<<<<<<<<
 *                     with self._error_log:
 *                         orig_loader = _register_document_loader()
*/
        __pyx_t_2 = __pyx_f_4lxml_5etree__encodeFilename(__pyx_v_file); if (unlikely(!__pyx_t_2)) __PYX_ERR(22, 65, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_v_filename = __pyx_t_2;
        __pyx_t_2 = 0;

        /* "src/lxml/relaxng.pxi":66
 *                     doc = None
 *                     filename = _encodeFilename(file)
 *                     with self._error_log:             # <<<<<<<<<<<<<<
 *                         orig_loader = _register_document_loader()
 *                         parser_ctxt = relaxng.xmlRelaxNGNewParserCtxt(_cstr(filename))
*/
        /*with:*/ {
          __pyx_t_9 = __Pyx_PyObject_LookupSpecial(((PyObject *)__pyx_v_self->__pyx_base._error_log), __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_9)) __PYX_ERR(22, 66, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_7 = __pyx_f_4lxml_5etree_9_ErrorLog___enter__(__pyx_v_self->__pyx_base._error_log); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(22, 66, __pyx_L6_error)
          /*try:*/ {
            {
              (void)__pyx_t_10; (void)__pyx_t_11; (void)__pyx_t_12; /* mark used */
              /*try:*/ {

                /* "src/lxml/relaxng.pxi":67
 *                     filename = _encodeFilename(file)
 *                     with self._error_log:
 *                         orig_loader = _register_document_loader()             # <<<<<<<<<<<<<<
 *                         parser_ctxt = relaxng.xmlRelaxNGNewParserCtxt(_cstr(filename))
 *                         _reset_document_loader(orig_loader)
*/
                __pyx_v_orig_loader = __pyx_f_4lxml_5etree__register_document_loader();

                /* "src/lxml/relaxng.pxi":68
 *                     with self._error_log:
 *                         orig_loader = _register_document_loader()
 *                         parser_ctxt = relaxng.xmlRelaxNGNewParserCtxt(_cstr(filename))             # <<<<<<<<<<<<<<
 *                         _reset_document_loader(orig_loader)
 *             elif (_getFilenameForFile(file) or '')[-4:].lower() == '.rnc':
*/
                __pyx_v_parser_ctxt = xmlRelaxNGNewParserCtxt(PyBytes_AS_STRING(__pyx_v_filename));

                /* "src/lxml/relaxng.pxi":69
 *                         orig_loader = _register_document_loader()
 *                         parser_ctxt = relaxng.xmlRelaxNGNewParserCtxt(_cstr(filename))
 *                         _reset_document_loader(orig_loader)             # <<<<<<<<<<<<<<
 *             elif (_getFilenameForFile(file) or '')[-4:].lower() == '.rnc':
 *                 _require_rnc2rng()
*/
                __pyx_f_4lxml_5etree__reset_document_loader(__pyx_v_orig_loader);

                /* "src/lxml/relaxng.pxi":66
 *                     doc = None
 *                     filename = _encodeFilename(file)
 *                     with self._error_log:             # <<<<<<<<<<<<<<
 *                         orig_loader = _register_document_loader()
 *                         parser_ctxt = relaxng.xmlRelaxNGNewParserCtxt(_cstr(filename))
*/
              }
            }
          }
          /*finally:*/ {
            /*normal exit:*/{
              if (__pyx_t_9) {
                __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_mstate_global->__pyx_tuple[3], NULL);
                __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
                if (unlikely(!__pyx_t_12)) __PYX_ERR(22, 66, __pyx_L1_error)
                __Pyx_GOTREF(__pyx_t_12);
                __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
              }
              goto __pyx_L9;
            }
            __pyx_L9:;
          }
          goto __pyx_L16;
          __pyx_L6_error:;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          goto __pyx_L1_error;
          __pyx_L16:;
        }
      }
      __pyx_L5:;

      /* "src/lxml/relaxng.pxi":57
 *             parser_ctxt = relaxng.xmlRelaxNGNewDocParserCtxt(fake_c_doc)
 *         elif file is not None:
 *             if _isString(file):             # <<<<<<<<<<<<<<
 *                 if file[-4:].lower() == '.rnc':
 *                     _require_rnc2rng()
*/
      goto __pyx_L4;
    }

    /* "src/lxml/relaxng.pxi":70
 *                         parser_ctxt = relaxng.xmlRelaxNGNewParserCtxt(_cstr(filename))
 *                         _reset_document_loader(orig_loader)
 *             elif (_getFilenameForFile(file) or '')[-4:].lower() == '.rnc':             # <<<<<<<<<<<<<<
 *                 _require_rnc2rng()
 *                 rng_data_utf8 = _utf8(_rnc2rng.dumps(_rnc2rng.load(file)))
*/
    __pyx_t_8 = __pyx_f_4lxml_5etree__getFilenameForFile(__pyx_v_file); if (unlikely(!__pyx_t_8)) __PYX_ERR(22, 70, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(22, 70, __pyx_L1_error)
    if (!__pyx_t_4) {
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    } else {
      __Pyx_INCREF(__pyx_t_8);
      __pyx_t_6 = __pyx_t_8;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L17_bool_binop_done;
    }
    __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u__8);
    __pyx_t_6 = __pyx_mstate_global->__pyx_kp_u__8;
    __pyx_L17_bool_binop_done:;
    __pyx_t_8 = __Pyx_PyObject_GetSlice(__pyx_t_6, -4L, 0, NULL, NULL, &__pyx_mstate_global->__pyx_slice[11], 1, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(22, 70, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_1 = __pyx_t_8;
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_3 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL};
      __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_lower, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(22, 70, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_rnc, Py_EQ)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(22, 70, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_4) {

      /* "src/lxml/relaxng.pxi":71
 *                         _reset_document_loader(orig_loader)
 *             elif (_getFilenameForFile(file) or '')[-4:].lower() == '.rnc':
 *                 _require_rnc2rng()             # <<<<<<<<<<<<<<
 *                 rng_data_utf8 = _utf8(_rnc2rng.dumps(_rnc2rng.load(file)))
 *                 doc = _parseMemoryDocument(
*/
      __pyx_t_7 = __pyx_f_4lxml_5etree__require_rnc2rng(); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(22, 71, __pyx_L1_error)

      /* "src/lxml/relaxng.pxi":72
 *             elif (_getFilenameForFile(file) or '')[-4:].lower() == '.rnc':
 *                 _require_rnc2rng()
 *                 rng_data_utf8 = _utf8(_rnc2rng.dumps(_rnc2rng.load(file)))             # <<<<<<<<<<<<<<
 *                 doc = _parseMemoryDocument(
 *                     rng_data_utf8, parser=None, url=_getFilenameForFile(file))
*/
      __pyx_t_8 = __pyx_v_4lxml_5etree__rnc2rng;
      __Pyx_INCREF(__pyx_t_8);
      __pyx_t_6 = __pyx_v_4lxml_5etree__rnc2rng;
      __Pyx_INCREF(__pyx_t_6);
      __pyx_t_3 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_v_file};
        __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_load, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(22, 72, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __pyx_t_3 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_t_1};
        __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_dumps, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(22, 72, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __pyx_t_1 = __pyx_f_4lxml_5etree__utf8(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(22, 72, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_rng_data_utf8 = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;

      /* "src/lxml/relaxng.pxi":74
 *                 rng_data_utf8 = _utf8(_rnc2rng.dumps(_rnc2rng.load(file)))
 *                 doc = _parseMemoryDocument(
 *                     rng_data_utf8, parser=None, url=_getFilenameForFile(file))             # <<<<<<<<<<<<<<
 *                 parser_ctxt = relaxng.xmlRelaxNGNewDocParserCtxt(doc._c_doc)
 *             else:
*/
      __pyx_t_1 = __pyx_f_4lxml_5etree__getFilenameForFile(__pyx_v_file); if (unlikely(!__pyx_t_1)) __PYX_ERR(22, 74, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);

      /* "src/lxml/relaxng.pxi":73
 *                 _require_rnc2rng()
 *                 rng_data_utf8 = _utf8(_rnc2rng.dumps(_rnc2rng.load(file)))
 *                 doc = _parseMemoryDocument(             # <<<<<<<<<<<<<<
 *                     rng_data_utf8, parser=None, url=_getFilenameForFile(file))
 *                 parser_ctxt = relaxng.xmlRelaxNGNewDocParserCtxt(doc._c_doc)
*/
      __pyx_t_2 = __pyx_t_1;
      __Pyx_INCREF(__pyx_t_2);

      /* "src/lxml/relaxng.pxi":74
 *                 rng_data_utf8 = _utf8(_rnc2rng.dumps(_rnc2rng.load(file)))
 *                 doc = _parseMemoryDocument(
 *                     rng_data_utf8, parser=None, url=_getFilenameForFile(file))             # <<<<<<<<<<<<<<
 *                 parser_ctxt = relaxng.xmlRelaxNGNewDocParserCtxt(doc._c_doc)
 *             else:
*/
      __pyx_t_8 = ((PyObject *)__pyx_f_4lxml_5etree__parseMemoryDocument(__pyx_v_rng_data_utf8, __pyx_t_2, ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None))); if (unlikely(!__pyx_t_8)) __PYX_ERR(22, 73, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "src/lxml/relaxng.pxi":73
 *                 _require_rnc2rng()
 *                 rng_data_utf8 = _utf8(_rnc2rng.dumps(_rnc2rng.load(file)))
 *                 doc = _parseMemoryDocument(             # <<<<<<<<<<<<<<
 *                     rng_data_utf8, parser=None, url=_getFilenameForFile(file))
 *                 parser_ctxt = relaxng.xmlRelaxNGNewDocParserCtxt(doc._c_doc)
*/
      __pyx_t_1 = ((PyObject *)__pyx_t_8);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
      __pyx_t_1 = 0;

      /* "src/lxml/relaxng.pxi":75
 *                 doc = _parseMemoryDocument(
 *                     rng_data_utf8, parser=None, url=_getFilenameForFile(file))
 *                 parser_ctxt = relaxng.xmlRelaxNGNewDocParserCtxt(doc._c_doc)             # <<<<<<<<<<<<<<
 *             else:
 *                 doc = _parseDocument(file, parser=None, base_url=None)
*/
      __pyx_v_parser_ctxt = xmlRelaxNGNewDocParserCtxt(__pyx_v_doc->_c_doc);

      /* "src/lxml/relaxng.pxi":70
 *                         parser_ctxt = relaxng.xmlRelaxNGNewParserCtxt(_cstr(filename))
 *                         _reset_document_loader(orig_loader)
 *             elif (_getFilenameForFile(file) or '')[-4:].lower() == '.rnc':             # <<<<<<<<<<<<<<
 *                 _require_rnc2rng()
 *                 rng_data_utf8 = _utf8(_rnc2rng.dumps(_rnc2rng.load(file)))
*/
      goto __pyx_L4;
    }

    /* "src/lxml/relaxng.pxi":77
 *                 parser_ctxt = relaxng.xmlRelaxNGNewDocParserCtxt(doc._c_doc)
 *             else:
 *                 doc = _parseDocument(file, parser=None, base_url=None)             # <<<<<<<<<<<<<<
 *                 parser_ctxt = relaxng.xmlRelaxNGNewDocParserCtxt(doc._c_doc)
 *         else:
*/
    /*else*/ {
      __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__parseDocument(__pyx_v_file, ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None), Py_None)); if (unlikely(!__pyx_t_1)) __PYX_ERR(22, 77, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
      __pyx_t_1 = 0;

      /* "src/lxml/relaxng.pxi":78
 *             else:
 *                 doc = _parseDocument(file, parser=None, base_url=None)
 *                 parser_ctxt = relaxng.xmlRelaxNGNewDocParserCtxt(doc._c_doc)             # <<<<<<<<<<<<<<
 *         else:
 *             raise RelaxNGParseError, "No tree or file given"
*/
      __pyx_v_parser_ctxt = xmlRelaxNGNewDocParserCtxt(__pyx_v_doc->_c_doc);
    }
    __pyx_L4:;

    /* "src/lxml/relaxng.pxi":56
 *             fake_c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *             parser_ctxt = relaxng.xmlRelaxNGNewDocParserCtxt(fake_c_doc)
 *         elif file is not None:             # <<<<<<<<<<<<<<
 *             if _isString(file):
 *                 if file[-4:].lower() == '.rnc':
*/
    goto __pyx_L3;
  }

  /* "src/lxml/relaxng.pxi":80
 *                 parser_ctxt = relaxng.xmlRelaxNGNewDocParserCtxt(doc._c_doc)
 *         else:
 *             raise RelaxNGParseError, "No tree or file given"             # <<<<<<<<<<<<<<
 * 
 *         if parser_ctxt is NULL:
*/
  /*else*/ {
    __Pyx_Raise(((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_RelaxNGParseError), __pyx_mstate_global->__pyx_kp_u_No_tree_or_file_given, 0, 0);
    __PYX_ERR(22, 80, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "src/lxml/relaxng.pxi":82
 *             raise RelaxNGParseError, "No tree or file given"
 * 
 *         if parser_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             if fake_c_doc is not NULL:
 *                 _destroyFakeDoc(doc._c_doc, fake_c_doc)
*/
  __pyx_t_4 = (__pyx_v_parser_ctxt == NULL);
  if (__pyx_t_4) {

    /* "src/lxml/relaxng.pxi":83
 * 
 *         if parser_ctxt is NULL:
 *             if fake_c_doc is not NULL:             # <<<<<<<<<<<<<<
 *                 _destroyFakeDoc(doc._c_doc, fake_c_doc)
 *             raise RelaxNGParseError(
*/
    __pyx_t_4 = (__pyx_v_fake_c_doc != NULL);
    if (__pyx_t_4) {

      /* "src/lxml/relaxng.pxi":84
 *         if parser_ctxt is NULL:
 *             if fake_c_doc is not NULL:
 *                 _destroyFakeDoc(doc._c_doc, fake_c_doc)             # <<<<<<<<<<<<<<
 *             raise RelaxNGParseError(
 *                 self._error_log._buildExceptionMessage(
*/
      __pyx_f_4lxml_5etree__destroyFakeDoc(__pyx_v_doc->_c_doc, __pyx_v_fake_c_doc);

      /* "src/lxml/relaxng.pxi":83
 * 
 *         if parser_ctxt is NULL:
 *             if fake_c_doc is not NULL:             # <<<<<<<<<<<<<<
 *                 _destroyFakeDoc(doc._c_doc, fake_c_doc)
 *             raise RelaxNGParseError(
*/
    }

    /* "src/lxml/relaxng.pxi":85
 *             if fake_c_doc is not NULL:
 *                 _destroyFakeDoc(doc._c_doc, fake_c_doc)
 *             raise RelaxNGParseError(             # <<<<<<<<<<<<<<
 *                 self._error_log._buildExceptionMessage(
 *                     "Document is not parsable as Relax NG"),
*/
    __pyx_t_8 = NULL;

    /* "src/lxml/relaxng.pxi":86
 *                 _destroyFakeDoc(doc._c_doc, fake_c_doc)
 *             raise RelaxNGParseError(
 *                 self._error_log._buildExceptionMessage(             # <<<<<<<<<<<<<<
 *                     "Document is not parsable as Relax NG"),
 *                 self._error_log)
*/
    __pyx_t_2 = __pyx_f_4lxml_5etree_13_BaseErrorLog__buildExceptionMessage(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self->__pyx_base._error_log), __pyx_mstate_global->__pyx_kp_u_Document_is_not_parsable_as_Rela); if (unlikely(!__pyx_t_2)) __PYX_ERR(22, 86, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);

    /* "src/lxml/relaxng.pxi":88
 *                 self._error_log._buildExceptionMessage(
 *                     "Document is not parsable as Relax NG"),
 *                 self._error_log)             # <<<<<<<<<<<<<<
 * 
 *         # Need a cast here because older libxml2 releases do not use 'const' in the functype.
*/
    __pyx_t_3 = 1;
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_8, __pyx_t_2, ((PyObject *)__pyx_v_self->__pyx_base._error_log)};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_RelaxNGParseError, __pyx_callargs+__pyx_t_3, (3-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(22, 85, __pyx_L1_error)
      __Pyx_GOTREF((PyObject *)__pyx_t_1);
    }
    __Pyx_Raise(((PyObject *)__pyx_t_1), 0, 0, 0);
    __Pyx_DECREF((PyObject *)__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(22, 85, __pyx_L1_error)

    /* "src/lxml/relaxng.pxi":82
 *             raise RelaxNGParseError, "No tree or file given"
 * 
 *         if parser_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             if fake_c_doc is not NULL:
 *                 _destroyFakeDoc(doc._c_doc, fake_c_doc)
*/
  }

  /* "src/lxml/relaxng.pxi":91
 * 
 *         # Need a cast here because older libxml2 releases do not use 'const' in the functype.
 *         relaxng.xmlRelaxNGSetParserStructuredErrors(             # <<<<<<<<<<<<<<
 *             parser_ctxt, <xmlerror.xmlStructuredErrorFunc> _receiveError, <void*>self._error_log)
 *         _connectGenericErrorLog(self._error_log, xmlerror.XML_FROM_RELAXNGP)
*/
  xmlRelaxNGSetParserStructuredErrors(__pyx_v_parser_ctxt, ((xmlStructuredErrorFunc)__pyx_f_4lxml_5etree__receiveError), ((void *)__pyx_v_self->__pyx_base._error_log));

  /* "src/lxml/relaxng.pxi":93
 *         relaxng.xmlRelaxNGSetParserStructuredErrors(
 *             parser_ctxt, <xmlerror.xmlStructuredErrorFunc> _receiveError, <void*>self._error_log)
 *         _connectGenericErrorLog(self._error_log, xmlerror.XML_FROM_RELAXNGP)             # <<<<<<<<<<<<<<
 *         self._c_schema = relaxng.xmlRelaxNGParse(parser_ctxt)
 *         _connectGenericErrorLog(None)
*/
  __pyx_t_1 = ((PyObject *)__pyx_v_self->__pyx_base._error_log);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_13.__pyx_n = 1;
  __pyx_t_13.c_domain = XML_FROM_RELAXNGP;
  __pyx_f_4lxml_5etree__connectGenericErrorLog(__pyx_t_1, &__pyx_t_13); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/relaxng.pxi":94
 *             parser_ctxt, <xmlerror.xmlStructuredErrorFunc> _receiveError, <void*>self._error_log)
 *         _connectGenericErrorLog(self._error_log, xmlerror.XML_FROM_RELAXNGP)
 *         self._c_schema = relaxng.xmlRelaxNGParse(parser_ctxt)             # <<<<<<<<<<<<<<
 *         _connectGenericErrorLog(None)
 * 
*/
  __pyx_v_self->_c_schema = xmlRelaxNGParse(__pyx_v_parser_ctxt);

  /* "src/lxml/relaxng.pxi":95
 *         _connectGenericErrorLog(self._error_log, xmlerror.XML_FROM_RELAXNGP)
 *         self._c_schema = relaxng.xmlRelaxNGParse(parser_ctxt)
 *         _connectGenericErrorLog(None)             # <<<<<<<<<<<<<<
 * 
 *         relaxng.xmlRelaxNGFreeParserCtxt(parser_ctxt)
*/
  __pyx_f_4lxml_5etree__connectGenericErrorLog(Py_None, NULL);

  /* "src/lxml/relaxng.pxi":97
 *         _connectGenericErrorLog(None)
 * 
 *         relaxng.xmlRelaxNGFreeParserCtxt(parser_ctxt)             # <<<<<<<<<<<<<<
 *         if self._c_schema is NULL:
 *             if fake_c_doc is not NULL:
*/
  xmlRelaxNGFreeParserCtxt(__pyx_v_parser_ctxt);

  /* "src/lxml/relaxng.pxi":98
 * 
 *         relaxng.xmlRelaxNGFreeParserCtxt(parser_ctxt)
 *         if self._c_schema is NULL:             # <<<<<<<<<<<<<<
 *             if fake_c_doc is not NULL:
 *                 _destroyFakeDoc(doc._c_doc, fake_c_doc)
*/
  __pyx_t_4 = (__pyx_v_self->_c_schema == NULL);
  if (__pyx_t_4) {

    /* "src/lxml/relaxng.pxi":99
 *         relaxng.xmlRelaxNGFreeParserCtxt(parser_ctxt)
 *         if self._c_schema is NULL:
 *             if fake_c_doc is not NULL:             # <<<<<<<<<<<<<<
 *                 _destroyFakeDoc(doc._c_doc, fake_c_doc)
 *             raise RelaxNGParseError(
*/
    __pyx_t_4 = (__pyx_v_fake_c_doc != NULL);
    if (__pyx_t_4) {

      /* "src/lxml/relaxng.pxi":100
 *         if self._c_schema is NULL:
 *             if fake_c_doc is not NULL:
 *                 _destroyFakeDoc(doc._c_doc, fake_c_doc)             # <<<<<<<<<<<<<<
 *             raise RelaxNGParseError(
 *                 self._error_log._buildExceptionMessage(
*/
      __pyx_f_4lxml_5etree__destroyFakeDoc(__pyx_v_doc->_c_doc, __pyx_v_fake_c_doc);

      /* "src/lxml/relaxng.pxi":99
 *         relaxng.xmlRelaxNGFreeParserCtxt(parser_ctxt)
 *         if self._c_schema is NULL:
 *             if fake_c_doc is not NULL:             # <<<<<<<<<<<<<<
 *                 _destroyFakeDoc(doc._c_doc, fake_c_doc)
 *             raise RelaxNGParseError(
*/
    }

    /* "src/lxml/relaxng.pxi":101
 *             if fake_c_doc is not NULL:
 *                 _destroyFakeDoc(doc._c_doc, fake_c_doc)
 *             raise RelaxNGParseError(             # <<<<<<<<<<<<<<
 *                 self._error_log._buildExceptionMessage(
 *                     "Document is not valid Relax NG"),
*/
    __pyx_t_2 = NULL;

    /* "src/lxml/relaxng.pxi":102
 *                 _destroyFakeDoc(doc._c_doc, fake_c_doc)
 *             raise RelaxNGParseError(
 *                 self._error_log._buildExceptionMessage(             # <<<<<<<<<<<<<<
 *                     "Document is not valid Relax NG"),
 *                 self._error_log)
*/
    __pyx_t_8 = __pyx_f_4lxml_5etree_13_BaseErrorLog__buildExceptionMessage(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self->__pyx_base._error_log), __pyx_mstate_global->__pyx_kp_u_Document_is_not_valid_Relax_NG); if (unlikely(!__pyx_t_8)) __PYX_ERR(22, 102, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);

    /* "src/lxml/relaxng.pxi":104
 *                 self._error_log._buildExceptionMessage(
 *                     "Document is not valid Relax NG"),
 *                 self._error_log)             # <<<<<<<<<<<<<<
 *         if fake_c_doc is not NULL:
 *             _destroyFakeDoc(doc._c_doc, fake_c_doc)
*/
    __pyx_t_3 = 1;
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_t_8, ((PyObject *)__pyx_v_self->__pyx_base._error_log)};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_RelaxNGParseError, __pyx_callargs+__pyx_t_3, (3-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(22, 101, __pyx_L1_error)
      __Pyx_GOTREF((PyObject *)__pyx_t_1);
    }
    __Pyx_Raise(((PyObject *)__pyx_t_1), 0, 0, 0);
    __Pyx_DECREF((PyObject *)__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(22, 101, __pyx_L1_error)

    /* "src/lxml/relaxng.pxi":98
 * 
 *         relaxng.xmlRelaxNGFreeParserCtxt(parser_ctxt)
 *         if self._c_schema is NULL:             # <<<<<<<<<<<<<<
 *             if fake_c_doc is not NULL:
 *                 _destroyFakeDoc(doc._c_doc, fake_c_doc)
*/
  }

  /* "src/lxml/relaxng.pxi":105
 *                     "Document is not valid Relax NG"),
 *                 self._error_log)
 *         if fake_c_doc is not NULL:             # <<<<<<<<<<<<<<
 *             _destroyFakeDoc(doc._c_doc, fake_c_doc)
 * 
*/
  __pyx_t_4 = (__pyx_v_fake_c_doc != NULL);
  if (__pyx_t_4) {

    /* "src/lxml/relaxng.pxi":106
 *                 self._error_log)
 *         if fake_c_doc is not NULL:
 *             _destroyFakeDoc(doc._c_doc, fake_c_doc)             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
*/
    __pyx_f_4lxml_5etree__destroyFakeDoc(__pyx_v_doc->_c_doc, __pyx_v_fake_c_doc);

    /* "src/lxml/relaxng.pxi":105
 *                     "Document is not valid Relax NG"),
 *                 self._error_log)
 *         if fake_c_doc is not NULL:             # <<<<<<<<<<<<<<
 *             _destroyFakeDoc(doc._c_doc, fake_c_doc)
 * 
*/
  }

  /* "src/lxml/relaxng.pxi":45
 *         self._c_schema = NULL
 * 
 *     def __init__(self, etree=None, *, file=None):             # <<<<<<<<<<<<<<
 *         cdef _Document doc
 *         cdef _Element root_node
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("lxml.etree.RelaxNG.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XDECREF((PyObject *)__pyx_v_root_node);
  __Pyx_XDECREF(__pyx_v_rng_data_utf8);
  __Pyx_XDECREF(__pyx_v_filename);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/relaxng.pxi":108
 *             _destroyFakeDoc(doc._c_doc, fake_c_doc)
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         relaxng.xmlRelaxNGFree(self._c_schema)
 * 
*/

/* Python wrapper */
static void __pyx_pw_4lxml_5etree_7RelaxNG_5__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_4lxml_5etree_7RelaxNG_5__dealloc__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_pf_4lxml_5etree_7RelaxNG_4__dealloc__(((struct __pyx_obj_4lxml_5etree_RelaxNG *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_4lxml_5etree_7RelaxNG_4__dealloc__(struct __pyx_obj_4lxml_5etree_RelaxNG *__pyx_v_self) {

  /* "src/lxml/relaxng.pxi":109
 * 
 *     def __dealloc__(self):
 *         relaxng.xmlRelaxNGFree(self._c_schema)             # <<<<<<<<<<<<<<
 * 
 *     def __call__(self, etree):
*/
  xmlRelaxNGFree(__pyx_v_self->_c_schema);

  /* "src/lxml/relaxng.pxi":108
 *             _destroyFakeDoc(doc._c_doc, fake_c_doc)
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         relaxng.xmlRelaxNGFree(self._c_schema)
 * 
*/

  /* function exit code */
}

/* "src/lxml/relaxng.pxi":111
 *         relaxng.xmlRelaxNGFree(self._c_schema)
 * 
 *     def __call__(self, etree):             # <<<<<<<<<<<<<<
 *         """__call__(self, etree)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7RelaxNG_7__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_7RelaxNG_6__call__, "__call__(self, etree)\n\n        Validate doc using Relax NG.\n\n        Returns true if document is valid, false if not.");
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_7RelaxNG_6__call__;
#endif
static PyObject *__pyx_pw_4lxml_5etree_7RelaxNG_7__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_etree = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_etree,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(22, 111, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(22, 111, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__call__", 0) < (0)) __PYX_ERR(22, 111, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, i); __PYX_ERR(22, 111, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(22, 111, __pyx_L3_error)
    }
    __pyx_v_etree = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, __pyx_nargs); __PYX_ERR(22, 111, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.RelaxNG.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_7RelaxNG_6__call__(((struct __pyx_obj_4lxml_5etree_RelaxNG *)__pyx_v_self), __pyx_v_etree);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_7RelaxNG_6__call__(struct __pyx_obj_4lxml_5etree_RelaxNG *__pyx_v_self, PyObject *__pyx_v_etree) {
  struct LxmlDocument *__pyx_v_doc = 0;
  struct LxmlElement *__pyx_v_root_node = 0;
  xmlDoc *__pyx_v_c_doc;
  xmlRelaxNGValidCtxt *__pyx_v_valid_ctxt;
  int __pyx_v_ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  struct __pyx_opt_args_4lxml_5etree__connectGenericErrorLog __pyx_t_3;
  xmlDoc *__pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  char const *__pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  size_t __pyx_t_15;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__call__", 0);

  /* "src/lxml/relaxng.pxi":123
 *         cdef int ret
 * 
 *         assert self._c_schema is not NULL, "RelaxNG instance not initialised"             # <<<<<<<<<<<<<<
 *         doc = _documentOrRaise(etree)
 *         root_node = _rootNodeOrRaise(etree)
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = (__pyx_v_self->_c_schema != NULL);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_mstate_global->__pyx_kp_u_RelaxNG_instance_not_initialised, 0, 0);
      __PYX_ERR(22, 123, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(22, 123, __pyx_L1_error)
  #endif

  /* "src/lxml/relaxng.pxi":124
 * 
 *         assert self._c_schema is not NULL, "RelaxNG instance not initialised"
 *         doc = _documentOrRaise(etree)             # <<<<<<<<<<<<<<
 *         root_node = _rootNodeOrRaise(etree)
 * 
*/
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__documentOrRaise(__pyx_v_etree)); if (unlikely(!__pyx_t_2)) __PYX_ERR(22, 124, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/relaxng.pxi":125
 *         assert self._c_schema is not NULL, "RelaxNG instance not initialised"
 *         doc = _documentOrRaise(etree)
 *         root_node = _rootNodeOrRaise(etree)             # <<<<<<<<<<<<<<
 * 
 *         valid_ctxt = relaxng.xmlRelaxNGNewValidCtxt(self._c_schema)
*/
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__rootNodeOrRaise(__pyx_v_etree)); if (unlikely(!__pyx_t_2)) __PYX_ERR(22, 125, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_root_node = ((struct LxmlElement *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/relaxng.pxi":127
 *         root_node = _rootNodeOrRaise(etree)
 * 
 *         valid_ctxt = relaxng.xmlRelaxNGNewValidCtxt(self._c_schema)             # <<<<<<<<<<<<<<
 *         if valid_ctxt is NULL:
 *             raise MemoryError()
*/
  __pyx_v_valid_ctxt = xmlRelaxNGNewValidCtxt(__pyx_v_self->_c_schema);

  /* "src/lxml/relaxng.pxi":128
 * 
 *         valid_ctxt = relaxng.xmlRelaxNGNewValidCtxt(self._c_schema)
 *         if valid_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 * 
*/
  __pyx_t_1 = (__pyx_v_valid_ctxt == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/relaxng.pxi":129
 *         valid_ctxt = relaxng.xmlRelaxNGNewValidCtxt(self._c_schema)
 *         if valid_ctxt is NULL:
 *             raise MemoryError()             # <<<<<<<<<<<<<<
 * 
 *         try:
*/
    PyErr_NoMemory(); __PYX_ERR(22, 129, __pyx_L1_error)

    /* "src/lxml/relaxng.pxi":128
 * 
 *         valid_ctxt = relaxng.xmlRelaxNGNewValidCtxt(self._c_schema)
 *         if valid_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 * 
*/
  }

  /* "src/lxml/relaxng.pxi":131
 *             raise MemoryError()
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             self._error_log.clear()
 *             # Need a cast here because older libxml2 releases do not use 'const' in the functype.
*/
  /*try:*/ {

    /* "src/lxml/relaxng.pxi":132
 * 
 *         try:
 *             self._error_log.clear()             # <<<<<<<<<<<<<<
 *             # Need a cast here because older libxml2 releases do not use 'const' in the functype.
 *             relaxng.xmlRelaxNGSetValidStructuredErrors(
*/
    __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)__pyx_v_self->__pyx_base._error_log->__pyx_base.__pyx_base.__pyx_vtab)->clear(__pyx_v_self->__pyx_base._error_log, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(22, 132, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/relaxng.pxi":134
 *             self._error_log.clear()
 *             # Need a cast here because older libxml2 releases do not use 'const' in the functype.
 *             relaxng.xmlRelaxNGSetValidStructuredErrors(             # <<<<<<<<<<<<<<
 *                 valid_ctxt, <xmlerror.xmlStructuredErrorFunc> _receiveError, <void*>self._error_log)
 *             _connectGenericErrorLog(self._error_log, xmlerror.XML_FROM_RELAXNGV)
*/
    xmlRelaxNGSetValidStructuredErrors(__pyx_v_valid_ctxt, ((xmlStructuredErrorFunc)__pyx_f_4lxml_5etree__receiveError), ((void *)__pyx_v_self->__pyx_base._error_log));

    /* "src/lxml/relaxng.pxi":136
 *             relaxng.xmlRelaxNGSetValidStructuredErrors(
 *                 valid_ctxt, <xmlerror.xmlStructuredErrorFunc> _receiveError, <void*>self._error_log)
 *             _connectGenericErrorLog(self._error_log, xmlerror.XML_FROM_RELAXNGV)             # <<<<<<<<<<<<<<
 *             c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *             with nogil:
*/
    __pyx_t_2 = ((PyObject *)__pyx_v_self->__pyx_base._error_log);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3.__pyx_n = 1;
    __pyx_t_3.c_domain = XML_FROM_RELAXNGV;
    __pyx_f_4lxml_5etree__connectGenericErrorLog(__pyx_t_2, &__pyx_t_3); 
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/relaxng.pxi":137
 *                 valid_ctxt, <xmlerror.xmlStructuredErrorFunc> _receiveError, <void*>self._error_log)
 *             _connectGenericErrorLog(self._error_log, xmlerror.XML_FROM_RELAXNGV)
 *             c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 ret = relaxng.xmlRelaxNGValidateDoc(valid_ctxt, c_doc)
*/
    __pyx_t_4 = __pyx_f_4lxml_5etree__fakeRootDoc(__pyx_v_doc->_c_doc, __pyx_v_root_node->_c_node); if (unlikely(__pyx_t_4 == ((void *)NULL))) __PYX_ERR(22, 137, __pyx_L5_error)
    __pyx_v_c_doc = __pyx_t_4;

    /* "src/lxml/relaxng.pxi":138
 *             _connectGenericErrorLog(self._error_log, xmlerror.XML_FROM_RELAXNGV)
 *             c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 ret = relaxng.xmlRelaxNGValidateDoc(valid_ctxt, c_doc)
 *             _destroyFakeDoc(doc._c_doc, c_doc)
*/
    {
        PyThreadState * _save;
        _save = PyEval_SaveThread();
        __Pyx_FastGIL_Remember();
        /*try:*/ {

          /* "src/lxml/relaxng.pxi":139
 *             c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *             with nogil:
 *                 ret = relaxng.xmlRelaxNGValidateDoc(valid_ctxt, c_doc)             # <<<<<<<<<<<<<<
 *             _destroyFakeDoc(doc._c_doc, c_doc)
 *         finally:
*/
          __pyx_v_ret = xmlRelaxNGValidateDoc(__pyx_v_valid_ctxt, __pyx_v_c_doc);
        }

        /* "src/lxml/relaxng.pxi":138
 *             _connectGenericErrorLog(self._error_log, xmlerror.XML_FROM_RELAXNGV)
 *             c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 ret = relaxng.xmlRelaxNGValidateDoc(valid_ctxt, c_doc)
 *             _destroyFakeDoc(doc._c_doc, c_doc)
*/
        /*finally:*/ {
          /*normal exit:*/{
            __Pyx_FastGIL_Forget();
            PyEval_RestoreThread(_save);
            goto __pyx_L9;
          }
          __pyx_L9:;
        }
    }

    /* "src/lxml/relaxng.pxi":140
 *             with nogil:
 *                 ret = relaxng.xmlRelaxNGValidateDoc(valid_ctxt, c_doc)
 *             _destroyFakeDoc(doc._c_doc, c_doc)             # <<<<<<<<<<<<<<
 *         finally:
 *             _connectGenericErrorLog(None)
*/
    __pyx_f_4lxml_5etree__destroyFakeDoc(__pyx_v_doc->_c_doc, __pyx_v_c_doc);
  }

  /* "src/lxml/relaxng.pxi":142
 *             _destroyFakeDoc(doc._c_doc, c_doc)
 *         finally:
 *             _connectGenericErrorLog(None)             # <<<<<<<<<<<<<<
 *             relaxng.xmlRelaxNGFreeValidCtxt(valid_ctxt)
 * 
*/
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_f_4lxml_5etree__connectGenericErrorLog(Py_None, NULL);

      /* "src/lxml/relaxng.pxi":143
 *         finally:
 *             _connectGenericErrorLog(None)
 *             relaxng.xmlRelaxNGFreeValidCtxt(valid_ctxt)             # <<<<<<<<<<<<<<
 * 
 *         if ret == -1:
*/
      xmlRelaxNGFreeValidCtxt(__pyx_v_valid_ctxt);
      goto __pyx_L6;
    }
    __pyx_L5_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
      if ( unlikely(__Pyx_GetException(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10) < 0)) __Pyx_ErrFetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      __pyx_t_5 = __pyx_lineno; __pyx_t_6 = __pyx_clineno; __pyx_t_7 = __pyx_filename;
      {

        /* "src/lxml/relaxng.pxi":142
 *             _destroyFakeDoc(doc._c_doc, c_doc)
 *         finally:
 *             _connectGenericErrorLog(None)             # <<<<<<<<<<<<<<
 *             relaxng.xmlRelaxNGFreeValidCtxt(valid_ctxt)
 * 
*/
        __pyx_f_4lxml_5etree__connectGenericErrorLog(Py_None, NULL);

        /* "src/lxml/relaxng.pxi":143
 *         finally:
 *             _connectGenericErrorLog(None)
 *             relaxng.xmlRelaxNGFreeValidCtxt(valid_ctxt)             # <<<<<<<<<<<<<<
 * 
 *         if ret == -1:
*/
        xmlRelaxNGFreeValidCtxt(__pyx_v_valid_ctxt);
      }
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_ErrRestore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
      __pyx_lineno = __pyx_t_5; __pyx_clineno = __pyx_t_6; __pyx_filename = __pyx_t_7;
      goto __pyx_L1_error;
    }
    __pyx_L6:;
  }

  /* "src/lxml/relaxng.pxi":145
 *             relaxng.xmlRelaxNGFreeValidCtxt(valid_ctxt)
 * 
 *         if ret == -1:             # <<<<<<<<<<<<<<
 *             raise RelaxNGValidateError(
 *                 "Internal error in Relax NG validation",
*/
  __pyx_t_1 = (__pyx_v_ret == -1L);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/relaxng.pxi":146
 * 
 *         if ret == -1:
 *             raise RelaxNGValidateError(             # <<<<<<<<<<<<<<
 *                 "Internal error in Relax NG validation",
 *                 self._error_log)
*/
    __pyx_t_14 = NULL;

    /* "src/lxml/relaxng.pxi":148
 *             raise RelaxNGValidateError(
 *                 "Internal error in Relax NG validation",
 *                 self._error_log)             # <<<<<<<<<<<<<<
 *         if ret == 0:
 *             return True
*/
    __pyx_t_15 = 1;
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_14, __pyx_mstate_global->__pyx_kp_u_Internal_error_in_Relax_NG_valid, ((PyObject *)__pyx_v_self->__pyx_base._error_log)};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_RelaxNGValidateError, __pyx_callargs+__pyx_t_15, (3-__pyx_t_15) | (__pyx_t_15*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(22, 146, __pyx_L1_error)
      __Pyx_GOTREF((PyObject *)__pyx_t_2);
    }
    __Pyx_Raise(((PyObject *)__pyx_t_2), 0, 0, 0);
    __Pyx_DECREF((PyObject *)__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(22, 146, __pyx_L1_error)

    /* "src/lxml/relaxng.pxi":145
 *             relaxng.xmlRelaxNGFreeValidCtxt(valid_ctxt)
 * 
 *         if ret == -1:             # <<<<<<<<<<<<<<
 *             raise RelaxNGValidateError(
 *                 "Internal error in Relax NG validation",
*/
  }

  /* "src/lxml/relaxng.pxi":149
 *                 "Internal error in Relax NG validation",
 *                 self._error_log)
 *         if ret == 0:             # <<<<<<<<<<<<<<
 *             return True
 *         else:
*/
  __pyx_t_1 = (__pyx_v_ret == 0);
  if (__pyx_t_1) {

    /* "src/lxml/relaxng.pxi":150
 *                 self._error_log)
 *         if ret == 0:
 *             return True             # <<<<<<<<<<<<<<
 *         else:
 *             return False
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;

    /* "src/lxml/relaxng.pxi":149
 *                 "Internal error in Relax NG validation",
 *                 self._error_log)
 *         if ret == 0:             # <<<<<<<<<<<<<<
 *             return True
 *         else:
*/
  }

  /* "src/lxml/relaxng.pxi":152
 *             return True
 *         else:
 *             return False             # <<<<<<<<<<<<<<
 * 
 *     @classmethod
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;
  }

  /* "src/lxml/relaxng.pxi":111
 *         relaxng.xmlRelaxNGFree(self._c_schema)
 * 
 *     def __call__(self, etree):             # <<<<<<<<<<<<<<
 *         """__call__(self, etree)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_AddTraceback("lxml.etree.RelaxNG.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XDECREF((PyObject *)__pyx_v_root_node);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/relaxng.pxi":154
 *             return False
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def from_rnc_string(cls, src, base_url=None):
 *         """Parse a RelaxNG schema in compact syntax from a text string
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7RelaxNG_9from_rnc_string(PyObject *__pyx_v_cls, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_7RelaxNG_8from_rnc_string, "Parse a RelaxNG schema in compact syntax from a text string\n\n        Requires the rnc2rng package to be installed.\n\n        Passing the source URL or file path of the source as 'base_url'\n        will enable resolving resource references relative to the source.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_7RelaxNG_9from_rnc_string = {"from_rnc_string", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7RelaxNG_9from_rnc_string, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_7RelaxNG_8from_rnc_string};
static PyObject *__pyx_pw_4lxml_5etree_7RelaxNG_9from_rnc_string(PyObject *__pyx_v_cls, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_src = 0;
  PyObject *__pyx_v_base_url = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("from_rnc_string (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_src,&__pyx_mstate_global->__pyx_n_u_base_url,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(22, 154, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(22, 154, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(22, 154, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "from_rnc_string", 0) < (0)) __PYX_ERR(22, 154, __pyx_L3_error)

      /* "src/lxml/relaxng.pxi":155
 * 
 *     @classmethod
 *     def from_rnc_string(cls, src, base_url=None):             # <<<<<<<<<<<<<<
 *         """Parse a RelaxNG schema in compact syntax from a text string
 * 
*/
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("from_rnc_string", 0, 1, 2, i); __PYX_ERR(22, 154, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(22, 154, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(22, 154, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_src = values[0];
    __pyx_v_base_url = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("from_rnc_string", 0, 1, 2, __pyx_nargs); __PYX_ERR(22, 154, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.RelaxNG.from_rnc_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_7RelaxNG_8from_rnc_string(((PyTypeObject*)__pyx_v_cls), __pyx_v_src, __pyx_v_base_url);

  /* "src/lxml/relaxng.pxi":154
 *             return False
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def from_rnc_string(cls, src, base_url=None):
 *         """Parse a RelaxNG schema in compact syntax from a text string
*/

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_7RelaxNG_8from_rnc_string(PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_src, PyObject *__pyx_v_base_url) {
  PyObject *__pyx_v_rng_str = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("from_rnc_string", 0);

  /* "src/lxml/relaxng.pxi":163
 *         will enable resolving resource references relative to the source.
 *         """
 *         _require_rnc2rng()             # <<<<<<<<<<<<<<
 *         rng_str = utf8(_rnc2rng.dumps(_rnc2rng.loads(src)))
 *         return cls(_parseMemoryDocument(rng_str, parser=None, url=base_url))
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__require_rnc2rng(); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(22, 163, __pyx_L1_error)

  /* "src/lxml/relaxng.pxi":164
 *         """
 *         _require_rnc2rng()
 *         rng_str = utf8(_rnc2rng.dumps(_rnc2rng.loads(src)))             # <<<<<<<<<<<<<<
 *         return cls(_parseMemoryDocument(rng_str, parser=None, url=base_url))
*/
  __pyx_t_3 = __pyx_v_4lxml_5etree__rnc2rng;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_5 = __pyx_v_4lxml_5etree__rnc2rng;
  __Pyx_INCREF(__pyx_t_5);
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_src};
    __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_loads, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(22, 164, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_4};
    __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_dumps, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(22, 164, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_t_4 = utf8(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(22, 164, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_rng_str = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "src/lxml/relaxng.pxi":165
 *         _require_rnc2rng()
 *         rng_str = utf8(_rnc2rng.dumps(_rnc2rng.loads(src)))
 *         return cls(_parseMemoryDocument(rng_str, parser=None, url=base_url))             # <<<<<<<<<<<<<<
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = NULL;
  __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__parseMemoryDocument(__pyx_v_rng_str, __pyx_v_base_url, ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None))); if (unlikely(!__pyx_t_3)) __PYX_ERR(22, 165, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3};
    __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_v_cls, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(22, 165, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "src/lxml/relaxng.pxi":154
 *             return False
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def from_rnc_string(cls, src, base_url=None):
 *         """Parse a RelaxNG schema in compact syntax from a text string
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree.RelaxNG.from_rnc_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rng_str);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlschema.pxi":41
 *     cdef bint _add_attribute_defaults
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._has_default_attributes = True # play it safe
 *         self._add_attribute_defaults = False
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_9XMLSchema_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_9XMLSchema_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, __pyx_nargs); return -1; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return -1;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__cinit__", __pyx_kwds); return -1;}
  __pyx_r = __pyx_pf_4lxml_5etree_9XMLSchema___cinit__(((struct __pyx_obj_4lxml_5etree_XMLSchema *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_9XMLSchema___cinit__(struct __pyx_obj_4lxml_5etree_XMLSchema *__pyx_v_self) {
  int __pyx_r;

  /* "src/lxml/xmlschema.pxi":42
 * 
 *     def __cinit__(self):
 *         self._has_default_attributes = True # play it safe             # <<<<<<<<<<<<<<
 *         self._add_attribute_defaults = False
 * 
*/
  __pyx_v_self->_has_default_attributes = 1;

  /* "src/lxml/xmlschema.pxi":43
 *     def __cinit__(self):
 *         self._has_default_attributes = True # play it safe
 *         self._add_attribute_defaults = False             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, etree=None, *, file=None, bint attribute_defaults=False):
*/
  __pyx_v_self->_add_attribute_defaults = 0;

  /* "src/lxml/xmlschema.pxi":41
 *     cdef bint _add_attribute_defaults
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._has_default_attributes = True # play it safe
 *         self._add_attribute_defaults = False
*/

  /* function exit code */
  __pyx_r = 0;
  return __pyx_r;
}

/* "src/lxml/xmlschema.pxi":45
 *         self._add_attribute_defaults = False
 * 
 *     def __init__(self, etree=None, *, file=None, bint attribute_defaults=False):             # <<<<<<<<<<<<<<
 *         cdef xmlschema.xmlSchemaParserCtxt* parser_ctxt
 *         cdef xmlDoc* c_doc
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_9XMLSchema_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_9XMLSchema_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_etree = 0;
  PyObject *__pyx_v_file = 0;
  int __pyx_v_attribute_defaults;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_etree,&__pyx_mstate_global->__pyx_n_u_file,&__pyx_mstate_global->__pyx_n_u_attribute_defaults,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(23, 45, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(23, 45, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(23, 45, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
    } else {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(23, 45, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_etree = values[0];
    __pyx_v_file = values[1];
    if (values[2]) {
      __pyx_v_attribute_defaults = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_attribute_defaults == (int)-1) && PyErr_Occurred())) __PYX_ERR(23, 45, __pyx_L3_error)
    } else {
      __pyx_v_attribute_defaults = ((int)0);
    }
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, __pyx_nargs); __PYX_ERR(23, 45, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.XMLSchema.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_9XMLSchema_2__init__(((struct __pyx_obj_4lxml_5etree_XMLSchema *)__pyx_v_self), __pyx_v_etree, __pyx_v_file, __pyx_v_attribute_defaults);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_9XMLSchema_2__init__(struct __pyx_obj_4lxml_5etree_XMLSchema *__pyx_v_self, PyObject *__pyx_v_etree, PyObject *__pyx_v_file, int __pyx_v_attribute_defaults) {
  xmlSchemaParserCtxt *__pyx_v_parser_ctxt;
  xmlDoc *__pyx_v_c_doc;
  struct LxmlDocument *__pyx_v_doc = NULL;
  struct LxmlElement *__pyx_v_root_node = NULL;
  PyObject *__pyx_v_filename = NULL;
  xmlExternalEntityLoader __pyx_v_orig_loader;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_t_4;
  xmlDoc *__pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_INCREF(__pyx_v_file);

  /* "src/lxml/xmlschema.pxi":49
 *         cdef xmlDoc* c_doc
 * 
 *         self._add_attribute_defaults = attribute_defaults             # <<<<<<<<<<<<<<
 *         _Validator.__init__(self)
 *         c_doc = NULL
*/
  __pyx_v_self->_add_attribute_defaults = __pyx_v_attribute_defaults;

  /* "src/lxml/xmlschema.pxi":50
 * 
 *         self._add_attribute_defaults = attribute_defaults
 *         _Validator.__init__(self)             # <<<<<<<<<<<<<<
 *         c_doc = NULL
 *         if etree is not None:
*/
  __pyx_t_2 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Validator);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, ((PyObject *)__pyx_v_self)};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_init, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(23, 50, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xmlschema.pxi":51
 *         self._add_attribute_defaults = attribute_defaults
 *         _Validator.__init__(self)
 *         c_doc = NULL             # <<<<<<<<<<<<<<
 *         if etree is not None:
 *             doc = _documentOrRaise(etree)
*/
  __pyx_v_c_doc = NULL;

  /* "src/lxml/xmlschema.pxi":52
 *         _Validator.__init__(self)
 *         c_doc = NULL
 *         if etree is not None:             # <<<<<<<<<<<<<<
 *             doc = _documentOrRaise(etree)
 *             root_node = _rootNodeOrRaise(etree)
*/
  __pyx_t_4 = (__pyx_v_etree != Py_None);
  if (__pyx_t_4) {

    /* "src/lxml/xmlschema.pxi":53
 *         c_doc = NULL
 *         if etree is not None:
 *             doc = _documentOrRaise(etree)             # <<<<<<<<<<<<<<
 *             root_node = _rootNodeOrRaise(etree)
 *             c_doc = _copyDocRoot(doc._c_doc, root_node._c_node)
*/
    __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__documentOrRaise(__pyx_v_etree)); if (unlikely(!__pyx_t_1)) __PYX_ERR(23, 53, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/xmlschema.pxi":54
 *         if etree is not None:
 *             doc = _documentOrRaise(etree)
 *             root_node = _rootNodeOrRaise(etree)             # <<<<<<<<<<<<<<
 *             c_doc = _copyDocRoot(doc._c_doc, root_node._c_node)
 *             self._doc = _documentFactory(c_doc, doc._parser)
*/
    __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__rootNodeOrRaise(__pyx_v_etree)); if (unlikely(!__pyx_t_1)) __PYX_ERR(23, 54, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_root_node = ((struct LxmlElement *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/xmlschema.pxi":55
 *             doc = _documentOrRaise(etree)
 *             root_node = _rootNodeOrRaise(etree)
 *             c_doc = _copyDocRoot(doc._c_doc, root_node._c_node)             # <<<<<<<<<<<<<<
 *             self._doc = _documentFactory(c_doc, doc._parser)
 *             parser_ctxt = xmlschema.xmlSchemaNewDocParserCtxt(c_doc)
*/
    __pyx_t_5 = __pyx_f_4lxml_5etree__copyDocRoot(__pyx_v_doc->_c_doc, __pyx_v_root_node->_c_node); if (unlikely(__pyx_t_5 == ((void *)NULL))) __PYX_ERR(23, 55, __pyx_L1_error)
    __pyx_v_c_doc = __pyx_t_5;

    /* "src/lxml/xmlschema.pxi":56
 *             root_node = _rootNodeOrRaise(etree)
 *             c_doc = _copyDocRoot(doc._c_doc, root_node._c_node)
 *             self._doc = _documentFactory(c_doc, doc._parser)             # <<<<<<<<<<<<<<
 *             parser_ctxt = xmlschema.xmlSchemaNewDocParserCtxt(c_doc)
 *         elif file is not None:
*/
    __pyx_t_1 = ((PyObject *)__pyx_v_doc->_parser);
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_1))); if (unlikely(!__pyx_t_2)) __PYX_ERR(23, 56, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_GOTREF((PyObject *)__pyx_v_self->_doc);
    __Pyx_DECREF((PyObject *)__pyx_v_self->_doc);
    __pyx_v_self->_doc = ((struct LxmlDocument *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/xmlschema.pxi":57
 *             c_doc = _copyDocRoot(doc._c_doc, root_node._c_node)
 *             self._doc = _documentFactory(c_doc, doc._parser)
 *             parser_ctxt = xmlschema.xmlSchemaNewDocParserCtxt(c_doc)             # <<<<<<<<<<<<<<
 *         elif file is not None:
 *             file = _getFSPathOrObject(file)
*/
    __pyx_v_parser_ctxt = xmlSchemaNewDocParserCtxt(__pyx_v_c_doc);

    /* "src/lxml/xmlschema.pxi":52
 *         _Validator.__init__(self)
 *         c_doc = NULL
 *         if etree is not None:             # <<<<<<<<<<<<<<
 *             doc = _documentOrRaise(etree)
 *             root_node = _rootNodeOrRaise(etree)
*/
    goto __pyx_L3;
  }

  /* "src/lxml/xmlschema.pxi":58
 *             self._doc = _documentFactory(c_doc, doc._parser)
 *             parser_ctxt = xmlschema.xmlSchemaNewDocParserCtxt(c_doc)
 *         elif file is not None:             # <<<<<<<<<<<<<<
 *             file = _getFSPathOrObject(file)
 *             if _isString(file):
*/
  __pyx_t_4 = (__pyx_v_file != Py_None);
  if (likely(__pyx_t_4)) {

    /* "src/lxml/xmlschema.pxi":59
 *             parser_ctxt = xmlschema.xmlSchemaNewDocParserCtxt(c_doc)
 *         elif file is not None:
 *             file = _getFSPathOrObject(file)             # <<<<<<<<<<<<<<
 *             if _isString(file):
 *                 filename = _encodeFilename(file)
*/
    __pyx_t_2 = __pyx_f_4lxml_5etree__getFSPathOrObject(__pyx_v_file); if (unlikely(!__pyx_t_2)) __PYX_ERR(23, 59, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_file, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/xmlschema.pxi":60
 *         elif file is not None:
 *             file = _getFSPathOrObject(file)
 *             if _isString(file):             # <<<<<<<<<<<<<<
 *                 filename = _encodeFilename(file)
 *                 parser_ctxt = xmlschema.xmlSchemaNewParserCtxt(_cstr(filename))
*/
    __pyx_t_4 = _isString(__pyx_v_file);
    if (__pyx_t_4) {

      /* "src/lxml/xmlschema.pxi":61
 *             file = _getFSPathOrObject(file)
 *             if _isString(file):
 *                 filename = _encodeFilename(file)             # <<<<<<<<<<<<<<
 *                 parser_ctxt = xmlschema.xmlSchemaNewParserCtxt(_cstr(filename))
 *             else:
*/
      __pyx_t_2 = __pyx_f_4lxml_5etree__encodeFilename(__pyx_v_file); if (unlikely(!__pyx_t_2)) __PYX_ERR(23, 61, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_v_filename = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "src/lxml/xmlschema.pxi":62
 *             if _isString(file):
 *                 filename = _encodeFilename(file)
 *                 parser_ctxt = xmlschema.xmlSchemaNewParserCtxt(_cstr(filename))             # <<<<<<<<<<<<<<
 *             else:
 *                 self._doc = _parseDocument(file, None, None)
*/
      __pyx_v_parser_ctxt = xmlSchemaNewParserCtxt(PyBytes_AS_STRING(__pyx_v_filename));

      /* "src/lxml/xmlschema.pxi":60
 *         elif file is not None:
 *             file = _getFSPathOrObject(file)
 *             if _isString(file):             # <<<<<<<<<<<<<<
 *                 filename = _encodeFilename(file)
 *                 parser_ctxt = xmlschema.xmlSchemaNewParserCtxt(_cstr(filename))
*/
      goto __pyx_L4;
    }

    /* "src/lxml/xmlschema.pxi":64
 *                 parser_ctxt = xmlschema.xmlSchemaNewParserCtxt(_cstr(filename))
 *             else:
 *                 self._doc = _parseDocument(file, None, None)             # <<<<<<<<<<<<<<
 *                 parser_ctxt = xmlschema.xmlSchemaNewDocParserCtxt(self._doc._c_doc)
 *         else:
*/
    /*else*/ {
      __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__parseDocument(__pyx_v_file, ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None), Py_None)); if (unlikely(!__pyx_t_2)) __PYX_ERR(23, 64, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __Pyx_GOTREF((PyObject *)__pyx_v_self->_doc);
      __Pyx_DECREF((PyObject *)__pyx_v_self->_doc);
      __pyx_v_self->_doc = ((struct LxmlDocument *)__pyx_t_2);
      __pyx_t_2 = 0;

      /* "src/lxml/xmlschema.pxi":65
 *             else:
 *                 self._doc = _parseDocument(file, None, None)
 *                 parser_ctxt = xmlschema.xmlSchemaNewDocParserCtxt(self._doc._c_doc)             # <<<<<<<<<<<<<<
 *         else:
 *             raise XMLSchemaParseError, "No tree or file given"
*/
      __pyx_v_parser_ctxt = xmlSchemaNewDocParserCtxt(__pyx_v_self->_doc->_c_doc);
    }
    __pyx_L4:;

    /* "src/lxml/xmlschema.pxi":58
 *             self._doc = _documentFactory(c_doc, doc._parser)
 *             parser_ctxt = xmlschema.xmlSchemaNewDocParserCtxt(c_doc)
 *         elif file is not None:             # <<<<<<<<<<<<<<
 *             file = _getFSPathOrObject(file)
 *             if _isString(file):
*/
    goto __pyx_L3;
  }

  /* "src/lxml/xmlschema.pxi":67
 *                 parser_ctxt = xmlschema.xmlSchemaNewDocParserCtxt(self._doc._c_doc)
 *         else:
 *             raise XMLSchemaParseError, "No tree or file given"             # <<<<<<<<<<<<<<
 * 
 *         if parser_ctxt is NULL:
*/
  /*else*/ {
    __Pyx_Raise(((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XMLSchemaParseError), __pyx_mstate_global->__pyx_kp_u_No_tree_or_file_given, 0, 0);
    __PYX_ERR(23, 67, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "src/lxml/xmlschema.pxi":69
 *             raise XMLSchemaParseError, "No tree or file given"
 * 
 *         if parser_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 * 
*/
  __pyx_t_4 = (__pyx_v_parser_ctxt == NULL);
  if (unlikely(__pyx_t_4)) {

    /* "src/lxml/xmlschema.pxi":70
 * 
 *         if parser_ctxt is NULL:
 *             raise MemoryError()             # <<<<<<<<<<<<<<
 * 
 *         # Need a cast here because older libxml2 releases do not use 'const' in the functype.
*/
    PyErr_NoMemory(); __PYX_ERR(23, 70, __pyx_L1_error)

    /* "src/lxml/xmlschema.pxi":69
 *             raise XMLSchemaParseError, "No tree or file given"
 * 
 *         if parser_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 * 
*/
  }

  /* "src/lxml/xmlschema.pxi":73
 * 
 *         # Need a cast here because older libxml2 releases do not use 'const' in the functype.
 *         xmlschema.xmlSchemaSetParserStructuredErrors(             # <<<<<<<<<<<<<<
 *             parser_ctxt, <xmlerror.xmlStructuredErrorFunc> _receiveError, <void*>self._error_log)
 *         if self._doc is not None:
*/
  xmlSchemaSetParserStructuredErrors(__pyx_v_parser_ctxt, ((xmlStructuredErrorFunc)__pyx_f_4lxml_5etree__receiveError), ((void *)__pyx_v_self->__pyx_base._error_log));

  /* "src/lxml/xmlschema.pxi":75
 *         xmlschema.xmlSchemaSetParserStructuredErrors(
 *             parser_ctxt, <xmlerror.xmlStructuredErrorFunc> _receiveError, <void*>self._error_log)
 *         if self._doc is not None:             # <<<<<<<<<<<<<<
 *             # calling xmlSchemaParse on a schema with imports or
 *             # includes will cause libxml2 to create an internal
*/
  __pyx_t_4 = (((PyObject *)__pyx_v_self->_doc) != Py_None);
  if (__pyx_t_4) {

    /* "src/lxml/xmlschema.pxi":80
 *             # context for parsing, so push an implied context to route
 *             # resolve requests to the document's parser
 *             __GLOBAL_PARSER_CONTEXT.pushImpliedContextFromParser(self._doc._parser)             # <<<<<<<<<<<<<<
 *         with nogil:
 *             orig_loader = _register_document_loader()
*/
    __pyx_t_2 = ((PyObject *)__pyx_v_self->_doc->_parser);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_6 = __pyx_f_4lxml_5etree_24_ParserDictionaryContext_pushImpliedContextFromParser(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_2)); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(23, 80, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/xmlschema.pxi":75
 *         xmlschema.xmlSchemaSetParserStructuredErrors(
 *             parser_ctxt, <xmlerror.xmlStructuredErrorFunc> _receiveError, <void*>self._error_log)
 *         if self._doc is not None:             # <<<<<<<<<<<<<<
 *             # calling xmlSchemaParse on a schema with imports or
 *             # includes will cause libxml2 to create an internal
*/
  }

  /* "src/lxml/xmlschema.pxi":81
 *             # resolve requests to the document's parser
 *             __GLOBAL_PARSER_CONTEXT.pushImpliedContextFromParser(self._doc._parser)
 *         with nogil:             # <<<<<<<<<<<<<<
 *             orig_loader = _register_document_loader()
 *             self._c_schema = xmlschema.xmlSchemaParse(parser_ctxt)
*/
  {
      PyThreadState * _save;
      _save = PyEval_SaveThread();
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "src/lxml/xmlschema.pxi":82
 *             __GLOBAL_PARSER_CONTEXT.pushImpliedContextFromParser(self._doc._parser)
 *         with nogil:
 *             orig_loader = _register_document_loader()             # <<<<<<<<<<<<<<
 *             self._c_schema = xmlschema.xmlSchemaParse(parser_ctxt)
 *             _reset_document_loader(orig_loader)
*/
        __pyx_v_orig_loader = __pyx_f_4lxml_5etree__register_document_loader();

        /* "src/lxml/xmlschema.pxi":83
 *         with nogil:
 *             orig_loader = _register_document_loader()
 *             self._c_schema = xmlschema.xmlSchemaParse(parser_ctxt)             # <<<<<<<<<<<<<<
 *             _reset_document_loader(orig_loader)
 *         if self._doc is not None:
*/
        __pyx_v_self->_c_schema = xmlSchemaParse(__pyx_v_parser_ctxt);

        /* "src/lxml/xmlschema.pxi":84
 *             orig_loader = _register_document_loader()
 *             self._c_schema = xmlschema.xmlSchemaParse(parser_ctxt)
 *             _reset_document_loader(orig_loader)             # <<<<<<<<<<<<<<
 *         if self._doc is not None:
 *             __GLOBAL_PARSER_CONTEXT.popImpliedContext()
*/
        __pyx_f_4lxml_5etree__reset_document_loader(__pyx_v_orig_loader);
      }

      /* "src/lxml/xmlschema.pxi":81
 *             # resolve requests to the document's parser
 *             __GLOBAL_PARSER_CONTEXT.pushImpliedContextFromParser(self._doc._parser)
 *         with nogil:             # <<<<<<<<<<<<<<
 *             orig_loader = _register_document_loader()
 *             self._c_schema = xmlschema.xmlSchemaParse(parser_ctxt)
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L9;
        }
        __pyx_L9:;
      }
  }

  /* "src/lxml/xmlschema.pxi":85
 *             self._c_schema = xmlschema.xmlSchemaParse(parser_ctxt)
 *             _reset_document_loader(orig_loader)
 *         if self._doc is not None:             # <<<<<<<<<<<<<<
 *             __GLOBAL_PARSER_CONTEXT.popImpliedContext()
 *         xmlschema.xmlSchemaFreeParserCtxt(parser_ctxt)
*/
  __pyx_t_4 = (((PyObject *)__pyx_v_self->_doc) != Py_None);
  if (__pyx_t_4) {

    /* "src/lxml/xmlschema.pxi":86
 *             _reset_document_loader(orig_loader)
 *         if self._doc is not None:
 *             __GLOBAL_PARSER_CONTEXT.popImpliedContext()             # <<<<<<<<<<<<<<
 *         xmlschema.xmlSchemaFreeParserCtxt(parser_ctxt)
 * 
*/
    __pyx_t_6 = __pyx_f_4lxml_5etree_24_ParserDictionaryContext_popImpliedContext(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(23, 86, __pyx_L1_error)

    /* "src/lxml/xmlschema.pxi":85
 *             self._c_schema = xmlschema.xmlSchemaParse(parser_ctxt)
 *             _reset_document_loader(orig_loader)
 *         if self._doc is not None:             # <<<<<<<<<<<<<<
 *             __GLOBAL_PARSER_CONTEXT.popImpliedContext()
 *         xmlschema.xmlSchemaFreeParserCtxt(parser_ctxt)
*/
  }

  /* "src/lxml/xmlschema.pxi":87
 *         if self._doc is not None:
 *             __GLOBAL_PARSER_CONTEXT.popImpliedContext()
 *         xmlschema.xmlSchemaFreeParserCtxt(parser_ctxt)             # <<<<<<<<<<<<<<
 * 
 *         if self._c_schema is NULL:
*/
  xmlSchemaFreeParserCtxt(__pyx_v_parser_ctxt);

  /* "src/lxml/xmlschema.pxi":89
 *         xmlschema.xmlSchemaFreeParserCtxt(parser_ctxt)
 * 
 *         if self._c_schema is NULL:             # <<<<<<<<<<<<<<
 *             raise XMLSchemaParseError(
 *                 self._error_log._buildExceptionMessage(
*/
  __pyx_t_4 = (__pyx_v_self->_c_schema == NULL);
  if (unlikely(__pyx_t_4)) {

    /* "src/lxml/xmlschema.pxi":90
 * 
 *         if self._c_schema is NULL:
 *             raise XMLSchemaParseError(             # <<<<<<<<<<<<<<
 *                 self._error_log._buildExceptionMessage(
 *                     "Document is not valid XML Schema"),
*/
    __pyx_t_1 = NULL;

    /* "src/lxml/xmlschema.pxi":91
 *         if self._c_schema is NULL:
 *             raise XMLSchemaParseError(
 *                 self._error_log._buildExceptionMessage(             # <<<<<<<<<<<<<<
 *                     "Document is not valid XML Schema"),
 *                 self._error_log)
*/
    __pyx_t_7 = __pyx_f_4lxml_5etree_13_BaseErrorLog__buildExceptionMessage(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self->__pyx_base._error_log), __pyx_mstate_global->__pyx_kp_u_Document_is_not_valid_XML_Schema); if (unlikely(!__pyx_t_7)) __PYX_ERR(23, 91, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);

    /* "src/lxml/xmlschema.pxi":93
 *                 self._error_log._buildExceptionMessage(
 *                     "Document is not valid XML Schema"),
 *                 self._error_log)             # <<<<<<<<<<<<<<
 * 
 *         if self._doc is not None:
*/
    __pyx_t_3 = 1;
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_1, __pyx_t_7, ((PyObject *)__pyx_v_self->__pyx_base._error_log)};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XMLSchemaParseError, __pyx_callargs+__pyx_t_3, (3-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(23, 90, __pyx_L1_error)
      __Pyx_GOTREF((PyObject *)__pyx_t_2);
    }
    __Pyx_Raise(((PyObject *)__pyx_t_2), 0, 0, 0);
    __Pyx_DECREF((PyObject *)__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(23, 90, __pyx_L1_error)

    /* "src/lxml/xmlschema.pxi":89
 *         xmlschema.xmlSchemaFreeParserCtxt(parser_ctxt)
 * 
 *         if self._c_schema is NULL:             # <<<<<<<<<<<<<<
 *             raise XMLSchemaParseError(
 *                 self._error_log._buildExceptionMessage(
*/
  }

  /* "src/lxml/xmlschema.pxi":95
 *                 self._error_log)
 * 
 *         if self._doc is not None:             # <<<<<<<<<<<<<<
 *             self._has_default_attributes = _check_for_default_attributes(self._doc)
 *         self._add_attribute_defaults = attribute_defaults and self._has_default_attributes
*/
  __pyx_t_4 = (((PyObject *)__pyx_v_self->_doc) != Py_None);
  if (__pyx_t_4) {

    /* "src/lxml/xmlschema.pxi":96
 * 
 *         if self._doc is not None:
 *             self._has_default_attributes = _check_for_default_attributes(self._doc)             # <<<<<<<<<<<<<<
 *         self._add_attribute_defaults = attribute_defaults and self._has_default_attributes
 * 
*/
    __pyx_t_7 = NULL;
    __Pyx_INCREF((PyObject *)__pyx_v_4lxml_5etree__check_for_default_attributes);
    __pyx_t_1 = ((PyObject *)__pyx_v_4lxml_5etree__check_for_default_attributes); 
    __pyx_t_3 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1);
      assert(__pyx_t_7);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_1, __pyx__function);
      __pyx_t_3 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, ((PyObject *)__pyx_v_self->_doc)};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_1, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(23, 96, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(23, 96, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->_has_default_attributes = __pyx_t_4;

    /* "src/lxml/xmlschema.pxi":95
 *                 self._error_log)
 * 
 *         if self._doc is not None:             # <<<<<<<<<<<<<<
 *             self._has_default_attributes = _check_for_default_attributes(self._doc)
 *         self._add_attribute_defaults = attribute_defaults and self._has_default_attributes
*/
  }

  /* "src/lxml/xmlschema.pxi":97
 *         if self._doc is not None:
 *             self._has_default_attributes = _check_for_default_attributes(self._doc)
 *         self._add_attribute_defaults = attribute_defaults and self._has_default_attributes             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
*/
  if (__pyx_v_attribute_defaults) {
  } else {
    __pyx_t_4 = __pyx_v_attribute_defaults;
    goto __pyx_L13_bool_binop_done;
  }
  __pyx_t_4 = __pyx_v_self->_has_default_attributes;
  __pyx_L13_bool_binop_done:;
  __pyx_v_self->_add_attribute_defaults = __pyx_t_4;

  /* "src/lxml/xmlschema.pxi":45
 *         self._add_attribute_defaults = False
 * 
 *     def __init__(self, etree=None, *, file=None, bint attribute_defaults=False):             # <<<<<<<<<<<<<<
 *         cdef xmlschema.xmlSchemaParserCtxt* parser_ctxt
 *         cdef xmlDoc* c_doc
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree.XMLSchema.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XDECREF((PyObject *)__pyx_v_root_node);
  __Pyx_XDECREF(__pyx_v_filename);
  __Pyx_XDECREF(__pyx_v_file);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlschema.pxi":99
 *         self._add_attribute_defaults = attribute_defaults and self._has_default_attributes
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         xmlschema.xmlSchemaFree(self._c_schema)
 * 
*/

/* Python wrapper */
static void __pyx_pw_4lxml_5etree_9XMLSchema_5__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_4lxml_5etree_9XMLSchema_5__dealloc__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_pf_4lxml_5etree_9XMLSchema_4__dealloc__(((struct __pyx_obj_4lxml_5etree_XMLSchema *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_4lxml_5etree_9XMLSchema_4__dealloc__(struct __pyx_obj_4lxml_5etree_XMLSchema *__pyx_v_self) {

  /* "src/lxml/xmlschema.pxi":100
 * 
 *     def __dealloc__(self):
 *         xmlschema.xmlSchemaFree(self._c_schema)             # <<<<<<<<<<<<<<
 * 
 *     def __call__(self, etree):
*/
  xmlSchemaFree(__pyx_v_self->_c_schema);

  /* "src/lxml/xmlschema.pxi":99
 *         self._add_attribute_defaults = attribute_defaults and self._has_default_attributes
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         xmlschema.xmlSchemaFree(self._c_schema)
 * 
*/

  /* function exit code */
}

/* "src/lxml/xmlschema.pxi":102
 *         xmlschema.xmlSchemaFree(self._c_schema)
 * 
 *     def __call__(self, etree):             # <<<<<<<<<<<<<<
 *         """__call__(self, etree)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9XMLSchema_7__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_9XMLSchema_6__call__, "__call__(self, etree)\n\n        Validate doc using XML Schema.\n\n        Returns true if document is valid, false if not.\n        ");
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_9XMLSchema_6__call__;
#endif
static PyObject *__pyx_pw_4lxml_5etree_9XMLSchema_7__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_etree = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_etree,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(23, 102, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(23, 102, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__call__", 0) < (0)) __PYX_ERR(23, 102, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, i); __PYX_ERR(23, 102, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(23, 102, __pyx_L3_error)
    }
    __pyx_v_etree = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, __pyx_nargs); __PYX_ERR(23, 102, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.XMLSchema.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_9XMLSchema_6__call__(((struct __pyx_obj_4lxml_5etree_XMLSchema *)__pyx_v_self), __pyx_v_etree);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_9XMLSchema_6__call__(struct __pyx_obj_4lxml_5etree_XMLSchema *__pyx_v_self, PyObject *__pyx_v_etree) {
  xmlSchemaValidCtxt *__pyx_v_valid_ctxt;
  struct LxmlDocument *__pyx_v_doc = 0;
  struct LxmlElement *__pyx_v_root_node = 0;
  xmlDoc *__pyx_v_c_doc;
  int __pyx_v_ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  xmlDoc *__pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  char const *__pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  size_t __pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__call__", 0);

  /* "src/lxml/xmlschema.pxi":115
 *         cdef int ret
 * 
 *         assert self._c_schema is not NULL, "Schema instance not initialised"             # <<<<<<<<<<<<<<
 *         doc = _documentOrRaise(etree)
 *         root_node = _rootNodeOrRaise(etree)
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = (__pyx_v_self->_c_schema != NULL);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_mstate_global->__pyx_kp_u_Schema_instance_not_initialised, 0, 0);
      __PYX_ERR(23, 115, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(23, 115, __pyx_L1_error)
  #endif

  /* "src/lxml/xmlschema.pxi":116
 * 
 *         assert self._c_schema is not NULL, "Schema instance not initialised"
 *         doc = _documentOrRaise(etree)             # <<<<<<<<<<<<<<
 *         root_node = _rootNodeOrRaise(etree)
 * 
*/
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__documentOrRaise(__pyx_v_etree)); if (unlikely(!__pyx_t_2)) __PYX_ERR(23, 116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/xmlschema.pxi":117
 *         assert self._c_schema is not NULL, "Schema instance not initialised"
 *         doc = _documentOrRaise(etree)
 *         root_node = _rootNodeOrRaise(etree)             # <<<<<<<<<<<<<<
 * 
 *         valid_ctxt = xmlschema.xmlSchemaNewValidCtxt(self._c_schema)
*/
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__rootNodeOrRaise(__pyx_v_etree)); if (unlikely(!__pyx_t_2)) __PYX_ERR(23, 117, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_root_node = ((struct LxmlElement *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/xmlschema.pxi":119
 *         root_node = _rootNodeOrRaise(etree)
 * 
 *         valid_ctxt = xmlschema.xmlSchemaNewValidCtxt(self._c_schema)             # <<<<<<<<<<<<<<
 *         if valid_ctxt is NULL:
 *             raise MemoryError()
*/
  __pyx_v_valid_ctxt = xmlSchemaNewValidCtxt(__pyx_v_self->_c_schema);

  /* "src/lxml/xmlschema.pxi":120
 * 
 *         valid_ctxt = xmlschema.xmlSchemaNewValidCtxt(self._c_schema)
 *         if valid_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 * 
*/
  __pyx_t_1 = (__pyx_v_valid_ctxt == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/xmlschema.pxi":121
 *         valid_ctxt = xmlschema.xmlSchemaNewValidCtxt(self._c_schema)
 *         if valid_ctxt is NULL:
 *             raise MemoryError()             # <<<<<<<<<<<<<<
 * 
 *         try:
*/
    PyErr_NoMemory(); __PYX_ERR(23, 121, __pyx_L1_error)

    /* "src/lxml/xmlschema.pxi":120
 * 
 *         valid_ctxt = xmlschema.xmlSchemaNewValidCtxt(self._c_schema)
 *         if valid_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 * 
*/
  }

  /* "src/lxml/xmlschema.pxi":123
 *             raise MemoryError()
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             if self._add_attribute_defaults:
 *                 xmlschema.xmlSchemaSetValidOptions(
*/
  /*try:*/ {

    /* "src/lxml/xmlschema.pxi":124
 * 
 *         try:
 *             if self._add_attribute_defaults:             # <<<<<<<<<<<<<<
 *                 xmlschema.xmlSchemaSetValidOptions(
 *                     valid_ctxt, xmlschema.XML_SCHEMA_VAL_VC_I_CREATE)
*/
    if (__pyx_v_self->_add_attribute_defaults) {

      /* "src/lxml/xmlschema.pxi":125
 *         try:
 *             if self._add_attribute_defaults:
 *                 xmlschema.xmlSchemaSetValidOptions(             # <<<<<<<<<<<<<<
 *                     valid_ctxt, xmlschema.XML_SCHEMA_VAL_VC_I_CREATE)
 * 
*/
      (void)(xmlSchemaSetValidOptions(__pyx_v_valid_ctxt, XML_SCHEMA_VAL_VC_I_CREATE));

      /* "src/lxml/xmlschema.pxi":124
 * 
 *         try:
 *             if self._add_attribute_defaults:             # <<<<<<<<<<<<<<
 *                 xmlschema.xmlSchemaSetValidOptions(
 *                     valid_ctxt, xmlschema.XML_SCHEMA_VAL_VC_I_CREATE)
*/
    }

    /* "src/lxml/xmlschema.pxi":128
 *                     valid_ctxt, xmlschema.XML_SCHEMA_VAL_VC_I_CREATE)
 * 
 *             self._error_log.clear()             # <<<<<<<<<<<<<<
 *             # Need a cast here because older libxml2 releases do not use 'const' in the functype.
 *             xmlschema.xmlSchemaSetValidStructuredErrors(
*/
    __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)__pyx_v_self->__pyx_base._error_log->__pyx_base.__pyx_base.__pyx_vtab)->clear(__pyx_v_self->__pyx_base._error_log, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(23, 128, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/xmlschema.pxi":130
 *             self._error_log.clear()
 *             # Need a cast here because older libxml2 releases do not use 'const' in the functype.
 *             xmlschema.xmlSchemaSetValidStructuredErrors(             # <<<<<<<<<<<<<<
 *                 valid_ctxt, <xmlerror.xmlStructuredErrorFunc> _receiveError, <void*>self._error_log)
 * 
*/
    xmlSchemaSetValidStructuredErrors(__pyx_v_valid_ctxt, ((xmlStructuredErrorFunc)__pyx_f_4lxml_5etree__receiveError), ((void *)__pyx_v_self->__pyx_base._error_log));

    /* "src/lxml/xmlschema.pxi":133
 *                 valid_ctxt, <xmlerror.xmlStructuredErrorFunc> _receiveError, <void*>self._error_log)
 * 
 *             c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 ret = xmlschema.xmlSchemaValidateDoc(valid_ctxt, c_doc)
*/
    __pyx_t_3 = __pyx_f_4lxml_5etree__fakeRootDoc(__pyx_v_doc->_c_doc, __pyx_v_root_node->_c_node); if (unlikely(__pyx_t_3 == ((void *)NULL))) __PYX_ERR(23, 133, __pyx_L5_error)
    __pyx_v_c_doc = __pyx_t_3;

    /* "src/lxml/xmlschema.pxi":134
 * 
 *             c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 ret = xmlschema.xmlSchemaValidateDoc(valid_ctxt, c_doc)
 *             _destroyFakeDoc(doc._c_doc, c_doc)
*/
    {
        PyThreadState * _save;
        _save = PyEval_SaveThread();
        __Pyx_FastGIL_Remember();
        /*try:*/ {

          /* "src/lxml/xmlschema.pxi":135
 *             c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *             with nogil:
 *                 ret = xmlschema.xmlSchemaValidateDoc(valid_ctxt, c_doc)             # <<<<<<<<<<<<<<
 *             _destroyFakeDoc(doc._c_doc, c_doc)
 *         finally:
*/
          __pyx_v_ret = xmlSchemaValidateDoc(__pyx_v_valid_ctxt, __pyx_v_c_doc);
        }

        /* "src/lxml/xmlschema.pxi":134
 * 
 *             c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 ret = xmlschema.xmlSchemaValidateDoc(valid_ctxt, c_doc)
 *             _destroyFakeDoc(doc._c_doc, c_doc)
*/
        /*finally:*/ {
          /*normal exit:*/{
            __Pyx_FastGIL_Forget();
            PyEval_RestoreThread(_save);
            goto __pyx_L10;
          }
          __pyx_L10:;
        }
    }

    /* "src/lxml/xmlschema.pxi":136
 *             with nogil:
 *                 ret = xmlschema.xmlSchemaValidateDoc(valid_ctxt, c_doc)
 *             _destroyFakeDoc(doc._c_doc, c_doc)             # <<<<<<<<<<<<<<
 *         finally:
 *             xmlschema.xmlSchemaFreeValidCtxt(valid_ctxt)
*/
    __pyx_f_4lxml_5etree__destroyFakeDoc(__pyx_v_doc->_c_doc, __pyx_v_c_doc);
  }

  /* "src/lxml/xmlschema.pxi":138
 *             _destroyFakeDoc(doc._c_doc, c_doc)
 *         finally:
 *             xmlschema.xmlSchemaFreeValidCtxt(valid_ctxt)             # <<<<<<<<<<<<<<
 * 
 *         if ret == -1:
*/
  /*finally:*/ {
    /*normal exit:*/{
      xmlSchemaFreeValidCtxt(__pyx_v_valid_ctxt);
      goto __pyx_L6;
    }
    __pyx_L5_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      if ( unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename;
      {
        xmlSchemaFreeValidCtxt(__pyx_v_valid_ctxt);
      }
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
      __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6;
      goto __pyx_L1_error;
    }
    __pyx_L6:;
  }

  /* "src/lxml/xmlschema.pxi":140
 *             xmlschema.xmlSchemaFreeValidCtxt(valid_ctxt)
 * 
 *         if ret == -1:             # <<<<<<<<<<<<<<
 *             raise XMLSchemaValidateError(
 *                 "Internal error in XML Schema validation.",
*/
  __pyx_t_1 = (__pyx_v_ret == -1L);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/xmlschema.pxi":141
 * 
 *         if ret == -1:
 *             raise XMLSchemaValidateError(             # <<<<<<<<<<<<<<
 *                 "Internal error in XML Schema validation.",
 *                 self._error_log)
*/
    __pyx_t_13 = NULL;

    /* "src/lxml/xmlschema.pxi":143
 *             raise XMLSchemaValidateError(
 *                 "Internal error in XML Schema validation.",
 *                 self._error_log)             # <<<<<<<<<<<<<<
 *         if ret == 0:
 *             return True
*/
    __pyx_t_14 = 1;
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_13, __pyx_mstate_global->__pyx_kp_u_Internal_error_in_XML_Schema_val, ((PyObject *)__pyx_v_self->__pyx_base._error_log)};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XMLSchemaValidateError, __pyx_callargs+__pyx_t_14, (3-__pyx_t_14) | (__pyx_t_14*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(23, 141, __pyx_L1_error)
      __Pyx_GOTREF((PyObject *)__pyx_t_2);
    }
    __Pyx_Raise(((PyObject *)__pyx_t_2), 0, 0, 0);
    __Pyx_DECREF((PyObject *)__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(23, 141, __pyx_L1_error)

    /* "src/lxml/xmlschema.pxi":140
 *             xmlschema.xmlSchemaFreeValidCtxt(valid_ctxt)
 * 
 *         if ret == -1:             # <<<<<<<<<<<<<<
 *             raise XMLSchemaValidateError(
 *                 "Internal error in XML Schema validation.",
*/
  }

  /* "src/lxml/xmlschema.pxi":144
 *                 "Internal error in XML Schema validation.",
 *                 self._error_log)
 *         if ret == 0:             # <<<<<<<<<<<<<<
 *             return True
 *         else:
*/
  __pyx_t_1 = (__pyx_v_ret == 0);
  if (__pyx_t_1) {

    /* "src/lxml/xmlschema.pxi":145
 *                 self._error_log)
 *         if ret == 0:
 *             return True             # <<<<<<<<<<<<<<
 *         else:
 *             return False
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;

    /* "src/lxml/xmlschema.pxi":144
 *                 "Internal error in XML Schema validation.",
 *                 self._error_log)
 *         if ret == 0:             # <<<<<<<<<<<<<<
 *             return True
 *         else:
*/
  }

  /* "src/lxml/xmlschema.pxi":147
 *             return True
 *         else:
 *             return False             # <<<<<<<<<<<<<<
 * 
 *     cdef _ParserSchemaValidationContext _newSaxValidator(
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;
  }

  /* "src/lxml/xmlschema.pxi":102
 *         xmlschema.xmlSchemaFree(self._c_schema)
 * 
 *     def __call__(self, etree):             # <<<<<<<<<<<<<<
 *         """__call__(self, etree)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("lxml.etree.XMLSchema.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XDECREF((PyObject *)__pyx_v_root_node);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlschema.pxi":149
 *             return False
 * 
 *     cdef _ParserSchemaValidationContext _newSaxValidator(             # <<<<<<<<<<<<<<
 *             self, bint add_default_attributes):
 *         cdef _ParserSchemaValidationContext context
*/

static struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *__pyx_f_4lxml_5etree_9XMLSchema__newSaxValidator(struct __pyx_obj_4lxml_5etree_XMLSchema *__pyx_v_self, int __pyx_v_add_default_attributes) {
  struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *__pyx_v_context = 0;
  struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_newSaxValidator", 0);

  /* "src/lxml/xmlschema.pxi":152
 *             self, bint add_default_attributes):
 *         cdef _ParserSchemaValidationContext context
 *         context = _ParserSchemaValidationContext.__new__(_ParserSchemaValidationContext)             # <<<<<<<<<<<<<<
 *         context._schema = self
 *         context._add_default_attributes = (self._has_default_attributes and (
*/
  __pyx_t_1 = ((PyObject *)__pyx_tp_new_4lxml_5etree__ParserSchemaValidationContext(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ParserSchemaValidationContext), __pyx_mstate_global->__pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(23, 152, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_1);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xmlschema.pxi":153
 *         cdef _ParserSchemaValidationContext context
 *         context = _ParserSchemaValidationContext.__new__(_ParserSchemaValidationContext)
 *         context._schema = self             # <<<<<<<<<<<<<<
 *         context._add_default_attributes = (self._has_default_attributes and (
 *             add_default_attributes or self._add_attribute_defaults))
*/
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_v_self);
  __Pyx_GOTREF((PyObject *)__pyx_v_context->_schema);
  __Pyx_DECREF((PyObject *)__pyx_v_context->_schema);
  __pyx_v_context->_schema = __pyx_v_self;

  /* "src/lxml/xmlschema.pxi":154
 *         context = _ParserSchemaValidationContext.__new__(_ParserSchemaValidationContext)
 *         context._schema = self
 *         context._add_default_attributes = (self._has_default_attributes and (             # <<<<<<<<<<<<<<
 *             add_default_attributes or self._add_attribute_defaults))
 *         return context
*/
  if (__pyx_v_self->_has_default_attributes) {
  } else {
    __pyx_t_2 = __pyx_v_self->_has_default_attributes;
    goto __pyx_L3_bool_binop_done;
  }

  /* "src/lxml/xmlschema.pxi":155
 *         context._schema = self
 *         context._add_default_attributes = (self._has_default_attributes and (
 *             add_default_attributes or self._add_attribute_defaults))             # <<<<<<<<<<<<<<
 *         return context
 * 
*/
  if (!__pyx_v_add_default_attributes) {
  } else {
    __pyx_t_2 = __pyx_v_add_default_attributes;
    goto __pyx_L3_bool_binop_done;
  }
  __pyx_t_2 = __pyx_v_self->_add_attribute_defaults;
  __pyx_L3_bool_binop_done:;

  /* "src/lxml/xmlschema.pxi":154
 *         context = _ParserSchemaValidationContext.__new__(_ParserSchemaValidationContext)
 *         context._schema = self
 *         context._add_default_attributes = (self._has_default_attributes and (             # <<<<<<<<<<<<<<
 *             add_default_attributes or self._add_attribute_defaults))
 *         return context
*/
  __pyx_v_context->_add_default_attributes = __pyx_t_2;

  /* "src/lxml/xmlschema.pxi":156
 *         context._add_default_attributes = (self._has_default_attributes and (
 *             add_default_attributes or self._add_attribute_defaults))
 *         return context             # <<<<<<<<<<<<<<
 * 
 * @cython.final
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_context);
  __pyx_r = __pyx_v_context;
  goto __pyx_L0;

  /* "src/lxml/xmlschema.pxi":149
 *             return False
 * 
 *     cdef _ParserSchemaValidationContext _newSaxValidator(             # <<<<<<<<<<<<<<
 *             self, bint add_default_attributes):
 *         cdef _ParserSchemaValidationContext context
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.XMLSchema._newSaxValidator", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlschema.pxi":165
 *     cdef xmlschema.xmlSchemaSAXPlugStruct* _sax_plug
 *     cdef bint _add_default_attributes
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._valid_ctxt = NULL
 *         self._sax_plug = NULL
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_30_ParserSchemaValidationContext_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_30_ParserSchemaValidationContext_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, __pyx_nargs); return -1; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return -1;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__cinit__", __pyx_kwds); return -1;}
  __pyx_r = __pyx_pf_4lxml_5etree_30_ParserSchemaValidationContext___cinit__(((struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_30_ParserSchemaValidationContext___cinit__(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *__pyx_v_self) {
  int __pyx_r;

  /* "src/lxml/xmlschema.pxi":166
 *     cdef bint _add_default_attributes
 *     def __cinit__(self):
 *         self._valid_ctxt = NULL             # <<<<<<<<<<<<<<
 *         self._sax_plug = NULL
 *         self._add_default_attributes = False
*/
  __pyx_v_self->_valid_ctxt = NULL;

  /* "src/lxml/xmlschema.pxi":167
 *     def __cinit__(self):
 *         self._valid_ctxt = NULL
 *         self._sax_plug = NULL             # <<<<<<<<<<<<<<
 *         self._add_default_attributes = False
 * 
*/
  __pyx_v_self->_sax_plug = NULL;

  /* "src/lxml/xmlschema.pxi":168
 *         self._valid_ctxt = NULL
 *         self._sax_plug = NULL
 *         self._add_default_attributes = False             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
*/
  __pyx_v_self->_add_default_attributes = 0;

  /* "src/lxml/xmlschema.pxi":165
 *     cdef xmlschema.xmlSchemaSAXPlugStruct* _sax_plug
 *     cdef bint _add_default_attributes
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._valid_ctxt = NULL
 *         self._sax_plug = NULL
*/

  /* function exit code */
  __pyx_r = 0;
  return __pyx_r;
}

/* "src/lxml/xmlschema.pxi":170
 *         self._add_default_attributes = False
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         self.disconnect()
 *         if self._valid_ctxt:
*/

/* Python wrapper */
static void __pyx_pw_4lxml_5etree_30_ParserSchemaValidationContext_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_4lxml_5etree_30_ParserSchemaValidationContext_3__dealloc__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_pf_4lxml_5etree_30_ParserSchemaValidationContext_2__dealloc__(((struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_4lxml_5etree_30_ParserSchemaValidationContext_2__dealloc__(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *__pyx_v_self) {
  int __pyx_t_1;

  /* "src/lxml/xmlschema.pxi":171
 * 
 *     def __dealloc__(self):
 *         self.disconnect()             # <<<<<<<<<<<<<<
 *         if self._valid_ctxt:
 *             xmlschema.xmlSchemaFreeValidCtxt(self._valid_ctxt)
*/
  __pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_disconnect(__pyx_v_self);

  /* "src/lxml/xmlschema.pxi":172
 *     def __dealloc__(self):
 *         self.disconnect()
 *         if self._valid_ctxt:             # <<<<<<<<<<<<<<
 *             xmlschema.xmlSchemaFreeValidCtxt(self._valid_ctxt)
 * 
*/
  __pyx_t_1 = (__pyx_v_self->_valid_ctxt != 0);
  if (__pyx_t_1) {

    /* "src/lxml/xmlschema.pxi":173
 *         self.disconnect()
 *         if self._valid_ctxt:
 *             xmlschema.xmlSchemaFreeValidCtxt(self._valid_ctxt)             # <<<<<<<<<<<<<<
 * 
 *     cdef _ParserSchemaValidationContext copy(self):
*/
    xmlSchemaFreeValidCtxt(__pyx_v_self->_valid_ctxt);

    /* "src/lxml/xmlschema.pxi":172
 *     def __dealloc__(self):
 *         self.disconnect()
 *         if self._valid_ctxt:             # <<<<<<<<<<<<<<
 *             xmlschema.xmlSchemaFreeValidCtxt(self._valid_ctxt)
 * 
*/
  }

  /* "src/lxml/xmlschema.pxi":170
 *         self._add_default_attributes = False
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         self.disconnect()
 *         if self._valid_ctxt:
*/

  /* function exit code */
}

/* "src/lxml/xmlschema.pxi":175
 *             xmlschema.xmlSchemaFreeValidCtxt(self._valid_ctxt)
 * 
 *     cdef _ParserSchemaValidationContext copy(self):             # <<<<<<<<<<<<<<
 *         assert self._schema is not None, "_ParserSchemaValidationContext not initialised"
 *         return self._schema._newSaxValidator(
*/

static struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *__pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_copy(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy", 0);

  /* "src/lxml/xmlschema.pxi":176
 * 
 *     cdef _ParserSchemaValidationContext copy(self):
 *         assert self._schema is not None, "_ParserSchemaValidationContext not initialised"             # <<<<<<<<<<<<<<
 *         return self._schema._newSaxValidator(
 *             self._add_default_attributes)
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = (((PyObject *)__pyx_v_self->_schema) != Py_None);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_mstate_global->__pyx_kp_u_ParserSchemaValidationContext_n, 0, 0);
      __PYX_ERR(23, 176, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(23, 176, __pyx_L1_error)
  #endif

  /* "src/lxml/xmlschema.pxi":177
 *     cdef _ParserSchemaValidationContext copy(self):
 *         assert self._schema is not None, "_ParserSchemaValidationContext not initialised"
 *         return self._schema._newSaxValidator(             # <<<<<<<<<<<<<<
 *             self._add_default_attributes)
 * 
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);

  /* "src/lxml/xmlschema.pxi":178
 *         assert self._schema is not None, "_ParserSchemaValidationContext not initialised"
 *         return self._schema._newSaxValidator(
 *             self._add_default_attributes)             # <<<<<<<<<<<<<<
 * 
 *     cdef void inject_default_attributes(self, xmlDoc* c_doc) noexcept:
*/
  __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree_XMLSchema *)__pyx_v_self->_schema->__pyx_base.__pyx_vtab)->_newSaxValidator(__pyx_v_self->_schema, __pyx_v_self->_add_default_attributes)); if (unlikely(!__pyx_t_2)) __PYX_ERR(23, 177, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = ((struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/xmlschema.pxi":175
 *             xmlschema.xmlSchemaFreeValidCtxt(self._valid_ctxt)
 * 
 *     cdef _ParserSchemaValidationContext copy(self):             # <<<<<<<<<<<<<<
 *         assert self._schema is not None, "_ParserSchemaValidationContext not initialised"
 *         return self._schema._newSaxValidator(
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ParserSchemaValidationContext.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlschema.pxi":180
 *             self._add_default_attributes)
 * 
 *     cdef void inject_default_attributes(self, xmlDoc* c_doc) noexcept:             # <<<<<<<<<<<<<<
 *         # we currently need to insert default attributes manually
 *         # after parsing, as libxml2 does not support this at parse
*/

static void __pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_inject_default_attributes(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *__pyx_v_self, xmlDoc *__pyx_v_c_doc) {

  /* "src/lxml/xmlschema.pxi":184
 *         # after parsing, as libxml2 does not support this at parse
 *         # time
 *         if self._add_default_attributes:             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 xmlschema.xmlSchemaValidateDoc(self._valid_ctxt, c_doc)
*/
  if (__pyx_v_self->_add_default_attributes) {

    /* "src/lxml/xmlschema.pxi":185
 *         # time
 *         if self._add_default_attributes:
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 xmlschema.xmlSchemaValidateDoc(self._valid_ctxt, c_doc)
 * 
*/
    {
        PyThreadState * _save;
        _save = PyEval_SaveThread();
        __Pyx_FastGIL_Remember();
        /*try:*/ {

          /* "src/lxml/xmlschema.pxi":186
 *         if self._add_default_attributes:
 *             with nogil:
 *                 xmlschema.xmlSchemaValidateDoc(self._valid_ctxt, c_doc)             # <<<<<<<<<<<<<<
 * 
 *     cdef int connect(self, xmlparser.xmlParserCtxt* c_ctxt, _BaseErrorLog error_log) except -1:
*/
          (void)(xmlSchemaValidateDoc(__pyx_v_self->_valid_ctxt, __pyx_v_c_doc));
        }

        /* "src/lxml/xmlschema.pxi":185
 *         # time
 *         if self._add_default_attributes:
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 xmlschema.xmlSchemaValidateDoc(self._valid_ctxt, c_doc)
 * 
*/
        /*finally:*/ {
          /*normal exit:*/{
            __Pyx_FastGIL_Forget();
            PyEval_RestoreThread(_save);
            goto __pyx_L6;
          }
          __pyx_L6:;
        }
    }

    /* "src/lxml/xmlschema.pxi":184
 *         # after parsing, as libxml2 does not support this at parse
 *         # time
 *         if self._add_default_attributes:             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 xmlschema.xmlSchemaValidateDoc(self._valid_ctxt, c_doc)
*/
  }

  /* "src/lxml/xmlschema.pxi":180
 *             self._add_default_attributes)
 * 
 *     cdef void inject_default_attributes(self, xmlDoc* c_doc) noexcept:             # <<<<<<<<<<<<<<
 *         # we currently need to insert default attributes manually
 *         # after parsing, as libxml2 does not support this at parse
*/

  /* function exit code */
}

/* "src/lxml/xmlschema.pxi":188
 *                 xmlschema.xmlSchemaValidateDoc(self._valid_ctxt, c_doc)
 * 
 *     cdef int connect(self, xmlparser.xmlParserCtxt* c_ctxt, _BaseErrorLog error_log) except -1:             # <<<<<<<<<<<<<<
 *         if self._valid_ctxt is NULL:
 *             self._valid_ctxt = xmlschema.xmlSchemaNewValidCtxt(
*/

static int __pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_connect(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *__pyx_v_self, xmlParserCtxt *__pyx_v_c_ctxt, struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_error_log) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/xmlschema.pxi":189
 * 
 *     cdef int connect(self, xmlparser.xmlParserCtxt* c_ctxt, _BaseErrorLog error_log) except -1:
 *         if self._valid_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             self._valid_ctxt = xmlschema.xmlSchemaNewValidCtxt(
 *                 self._schema._c_schema)
*/
  __pyx_t_1 = (__pyx_v_self->_valid_ctxt == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/xmlschema.pxi":190
 *     cdef int connect(self, xmlparser.xmlParserCtxt* c_ctxt, _BaseErrorLog error_log) except -1:
 *         if self._valid_ctxt is NULL:
 *             self._valid_ctxt = xmlschema.xmlSchemaNewValidCtxt(             # <<<<<<<<<<<<<<
 *                 self._schema._c_schema)
 *             if self._valid_ctxt is NULL:
*/
    __pyx_v_self->_valid_ctxt = xmlSchemaNewValidCtxt(__pyx_v_self->_schema->_c_schema);

    /* "src/lxml/xmlschema.pxi":192
 *             self._valid_ctxt = xmlschema.xmlSchemaNewValidCtxt(
 *                 self._schema._c_schema)
 *             if self._valid_ctxt is NULL:             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 *             if self._add_default_attributes:
*/
    __pyx_t_1 = (__pyx_v_self->_valid_ctxt == NULL);
    if (unlikely(__pyx_t_1)) {

      /* "src/lxml/xmlschema.pxi":193
 *                 self._schema._c_schema)
 *             if self._valid_ctxt is NULL:
 *                 raise MemoryError()             # <<<<<<<<<<<<<<
 *             if self._add_default_attributes:
 *                 xmlschema.xmlSchemaSetValidOptions(
*/
      PyErr_NoMemory(); __PYX_ERR(23, 193, __pyx_L1_error)

      /* "src/lxml/xmlschema.pxi":192
 *             self._valid_ctxt = xmlschema.xmlSchemaNewValidCtxt(
 *                 self._schema._c_schema)
 *             if self._valid_ctxt is NULL:             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 *             if self._add_default_attributes:
*/
    }

    /* "src/lxml/xmlschema.pxi":194
 *             if self._valid_ctxt is NULL:
 *                 raise MemoryError()
 *             if self._add_default_attributes:             # <<<<<<<<<<<<<<
 *                 xmlschema.xmlSchemaSetValidOptions(
 *                     self._valid_ctxt, xmlschema.XML_SCHEMA_VAL_VC_I_CREATE)
*/
    if (__pyx_v_self->_add_default_attributes) {

      /* "src/lxml/xmlschema.pxi":195
 *                 raise MemoryError()
 *             if self._add_default_attributes:
 *                 xmlschema.xmlSchemaSetValidOptions(             # <<<<<<<<<<<<<<
 *                     self._valid_ctxt, xmlschema.XML_SCHEMA_VAL_VC_I_CREATE)
 *         if error_log is not None:
*/
      (void)(xmlSchemaSetValidOptions(__pyx_v_self->_valid_ctxt, XML_SCHEMA_VAL_VC_I_CREATE));

      /* "src/lxml/xmlschema.pxi":194
 *             if self._valid_ctxt is NULL:
 *                 raise MemoryError()
 *             if self._add_default_attributes:             # <<<<<<<<<<<<<<
 *                 xmlschema.xmlSchemaSetValidOptions(
 *                     self._valid_ctxt, xmlschema.XML_SCHEMA_VAL_VC_I_CREATE)
*/
    }

    /* "src/lxml/xmlschema.pxi":189
 * 
 *     cdef int connect(self, xmlparser.xmlParserCtxt* c_ctxt, _BaseErrorLog error_log) except -1:
 *         if self._valid_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             self._valid_ctxt = xmlschema.xmlSchemaNewValidCtxt(
 *                 self._schema._c_schema)
*/
  }

  /* "src/lxml/xmlschema.pxi":197
 *                 xmlschema.xmlSchemaSetValidOptions(
 *                     self._valid_ctxt, xmlschema.XML_SCHEMA_VAL_VC_I_CREATE)
 *         if error_log is not None:             # <<<<<<<<<<<<<<
 *             # Need a cast here because older libxml2 releases do not use 'const' in the functype.
 *             xmlschema.xmlSchemaSetValidStructuredErrors(
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_error_log) != Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/xmlschema.pxi":199
 *         if error_log is not None:
 *             # Need a cast here because older libxml2 releases do not use 'const' in the functype.
 *             xmlschema.xmlSchemaSetValidStructuredErrors(             # <<<<<<<<<<<<<<
 *                 self._valid_ctxt, <xmlerror.xmlStructuredErrorFunc> _receiveError, <void*>error_log)
 *         self._sax_plug = xmlschema.xmlSchemaSAXPlug(
*/
    xmlSchemaSetValidStructuredErrors(__pyx_v_self->_valid_ctxt, ((xmlStructuredErrorFunc)__pyx_f_4lxml_5etree__receiveError), ((void *)__pyx_v_error_log));

    /* "src/lxml/xmlschema.pxi":197
 *                 xmlschema.xmlSchemaSetValidOptions(
 *                     self._valid_ctxt, xmlschema.XML_SCHEMA_VAL_VC_I_CREATE)
 *         if error_log is not None:             # <<<<<<<<<<<<<<
 *             # Need a cast here because older libxml2 releases do not use 'const' in the functype.
 *             xmlschema.xmlSchemaSetValidStructuredErrors(
*/
  }

  /* "src/lxml/xmlschema.pxi":201
 *             xmlschema.xmlSchemaSetValidStructuredErrors(
 *                 self._valid_ctxt, <xmlerror.xmlStructuredErrorFunc> _receiveError, <void*>error_log)
 *         self._sax_plug = xmlschema.xmlSchemaSAXPlug(             # <<<<<<<<<<<<<<
 *             self._valid_ctxt, &c_ctxt.sax, &c_ctxt.userData)
 * 
*/
  __pyx_v_self->_sax_plug = xmlSchemaSAXPlug(__pyx_v_self->_valid_ctxt, (&__pyx_v_c_ctxt->sax), (&__pyx_v_c_ctxt->userData));

  /* "src/lxml/xmlschema.pxi":188
 *                 xmlschema.xmlSchemaValidateDoc(self._valid_ctxt, c_doc)
 * 
 *     cdef int connect(self, xmlparser.xmlParserCtxt* c_ctxt, _BaseErrorLog error_log) except -1:             # <<<<<<<<<<<<<<
 *         if self._valid_ctxt is NULL:
 *             self._valid_ctxt = xmlschema.xmlSchemaNewValidCtxt(
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._ParserSchemaValidationContext.connect", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/xmlschema.pxi":204
 *             self._valid_ctxt, &c_ctxt.sax, &c_ctxt.userData)
 * 
 *     cdef void disconnect(self) noexcept:             # <<<<<<<<<<<<<<
 *         if self._sax_plug is not NULL:
 *             xmlschema.xmlSchemaSAXUnplug(self._sax_plug)
*/

static void __pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_disconnect(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *__pyx_v_self) {
  int __pyx_t_1;

  /* "src/lxml/xmlschema.pxi":205
 * 
 *     cdef void disconnect(self) noexcept:
 *         if self._sax_plug is not NULL:             # <<<<<<<<<<<<<<
 *             xmlschema.xmlSchemaSAXUnplug(self._sax_plug)
 *             self._sax_plug = NULL
*/
  __pyx_t_1 = (__pyx_v_self->_sax_plug != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/xmlschema.pxi":206
 *     cdef void disconnect(self) noexcept:
 *         if self._sax_plug is not NULL:
 *             xmlschema.xmlSchemaSAXUnplug(self._sax_plug)             # <<<<<<<<<<<<<<
 *             self._sax_plug = NULL
 *         if self._valid_ctxt is not NULL:
*/
    (void)(xmlSchemaSAXUnplug(__pyx_v_self->_sax_plug));

    /* "src/lxml/xmlschema.pxi":207
 *         if self._sax_plug is not NULL:
 *             xmlschema.xmlSchemaSAXUnplug(self._sax_plug)
 *             self._sax_plug = NULL             # <<<<<<<<<<<<<<
 *         if self._valid_ctxt is not NULL:
 *             xmlschema.xmlSchemaSetValidStructuredErrors(
*/
    __pyx_v_self->_sax_plug = NULL;

    /* "src/lxml/xmlschema.pxi":205
 * 
 *     cdef void disconnect(self) noexcept:
 *         if self._sax_plug is not NULL:             # <<<<<<<<<<<<<<
 *             xmlschema.xmlSchemaSAXUnplug(self._sax_plug)
 *             self._sax_plug = NULL
*/
  }

  /* "src/lxml/xmlschema.pxi":208
 *             xmlschema.xmlSchemaSAXUnplug(self._sax_plug)
 *             self._sax_plug = NULL
 *         if self._valid_ctxt is not NULL:             # <<<<<<<<<<<<<<
 *             xmlschema.xmlSchemaSetValidStructuredErrors(
 *                 self._valid_ctxt, NULL, NULL)
*/
  __pyx_t_1 = (__pyx_v_self->_valid_ctxt != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/xmlschema.pxi":209
 *             self._sax_plug = NULL
 *         if self._valid_ctxt is not NULL:
 *             xmlschema.xmlSchemaSetValidStructuredErrors(             # <<<<<<<<<<<<<<
 *                 self._valid_ctxt, NULL, NULL)
 * 
*/
    xmlSchemaSetValidStructuredErrors(__pyx_v_self->_valid_ctxt, NULL, NULL);

    /* "src/lxml/xmlschema.pxi":208
 *             xmlschema.xmlSchemaSAXUnplug(self._sax_plug)
 *             self._sax_plug = NULL
 *         if self._valid_ctxt is not NULL:             # <<<<<<<<<<<<<<
 *             xmlschema.xmlSchemaSetValidStructuredErrors(
 *                 self._valid_ctxt, NULL, NULL)
*/
  }

  /* "src/lxml/xmlschema.pxi":204
 *             self._valid_ctxt, &c_ctxt.sax, &c_ctxt.userData)
 * 
 *     cdef void disconnect(self) noexcept:             # <<<<<<<<<<<<<<
 *         if self._sax_plug is not NULL:
 *             xmlschema.xmlSchemaSAXUnplug(self._sax_plug)
*/

  /* function exit code */
}

/* "src/lxml/xmlschema.pxi":212
 *                 self._valid_ctxt, NULL, NULL)
 * 
 *     cdef bint isvalid(self) noexcept:             # <<<<<<<<<<<<<<
 *         if self._valid_ctxt is NULL:
 *             return 1 # valid
*/

static int __pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_isvalid(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *__pyx_v_self) {
  int __pyx_r;
  int __pyx_t_1;

  /* "src/lxml/xmlschema.pxi":213
 * 
 *     cdef bint isvalid(self) noexcept:
 *         if self._valid_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             return 1 # valid
 *         return xmlschema.xmlSchemaIsValid(self._valid_ctxt)
*/
  __pyx_t_1 = (__pyx_v_self->_valid_ctxt == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/xmlschema.pxi":214
 *     cdef bint isvalid(self) noexcept:
 *         if self._valid_ctxt is NULL:
 *             return 1 # valid             # <<<<<<<<<<<<<<
 *         return xmlschema.xmlSchemaIsValid(self._valid_ctxt)
*/
    __pyx_r = 1;
    goto __pyx_L0;

    /* "src/lxml/xmlschema.pxi":213
 * 
 *     cdef bint isvalid(self) noexcept:
 *         if self._valid_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             return 1 # valid
 *         return xmlschema.xmlSchemaIsValid(self._valid_ctxt)
*/
  }

  /* "src/lxml/xmlschema.pxi":215
 *         if self._valid_ctxt is NULL:
 *             return 1 # valid
 *         return xmlschema.xmlSchemaIsValid(self._valid_ctxt)             # <<<<<<<<<<<<<<
*/
  __pyx_r = xmlSchemaIsValid(__pyx_v_self->_valid_ctxt);
  goto __pyx_L0;

  /* "src/lxml/xmlschema.pxi":212
 *                 self._valid_ctxt, NULL, NULL)
 * 
 *     cdef bint isvalid(self) noexcept:             # <<<<<<<<<<<<<<
 *         if self._valid_ctxt is NULL:
 *             return 1 # valid
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/schematron.pxi":73
 *     cdef xmlDoc* _c_schema_doc
 * 
 *     def __init__(self, etree=None, *, file=None):             # <<<<<<<<<<<<<<
 *         cdef _Document doc
 *         cdef _Element root_node
*/

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_10Schematron_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_10Schematron_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_etree = 0;
  PyObject *__pyx_v_file = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_etree,&__pyx_mstate_global->__pyx_n_u_file,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(24, 73, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(24, 73, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(24, 73, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
    } else {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(24, 73, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_etree = values[0];
    __pyx_v_file = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, __pyx_nargs); __PYX_ERR(24, 73, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.Schematron.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_10Schematron___init__(((struct __pyx_obj_4lxml_5etree_Schematron *)__pyx_v_self), __pyx_v_etree, __pyx_v_file);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_10Schematron___init__(struct __pyx_obj_4lxml_5etree_Schematron *__pyx_v_self, PyObject *__pyx_v_etree, PyObject *__pyx_v_file) {
  struct LxmlDocument *__pyx_v_doc = 0;
  struct LxmlElement *__pyx_v_root_node = 0;
  xmlSchematronParserCtxt *__pyx_v_parser_ctxt;
  PyObject *__pyx_v_warnings = NULL;
  PyObject *__pyx_v_filename = NULL;
  xmlExternalEntityLoader __pyx_v_orig_loader;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  xmlDoc *__pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  char const *__pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "src/lxml/schematron.pxi":78
 *         cdef xmlNode* c_node
 *         cdef char* c_href
 *         cdef schematron.xmlSchematronParserCtxt* parser_ctxt = NULL             # <<<<<<<<<<<<<<
 *         _Validator.__init__(self)
 *         if not config.ENABLE_SCHEMATRON:
*/
  __pyx_v_parser_ctxt = NULL;

  /* "src/lxml/schematron.pxi":79
 *         cdef char* c_href
 *         cdef schematron.xmlSchematronParserCtxt* parser_ctxt = NULL
 *         _Validator.__init__(self)             # <<<<<<<<<<<<<<
 *         if not config.ENABLE_SCHEMATRON:
 *             raise SchematronError, \
*/
  __pyx_t_2 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Validator);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, ((PyObject *)__pyx_v_self)};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_init, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(24, 79, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/schematron.pxi":80
 *         cdef schematron.xmlSchematronParserCtxt* parser_ctxt = NULL
 *         _Validator.__init__(self)
 *         if not config.ENABLE_SCHEMATRON:             # <<<<<<<<<<<<<<
 *             raise SchematronError, \
 *                 "lxml.etree was compiled without Schematron support."
*/
  __pyx_t_4 = (!ENABLE_SCHEMATRON);
  if (unlikely(__pyx_t_4)) {

    /* "src/lxml/schematron.pxi":81
 *         _Validator.__init__(self)
 *         if not config.ENABLE_SCHEMATRON:
 *             raise SchematronError, \             # <<<<<<<<<<<<<<
 *                 "lxml.etree was compiled without Schematron support."
 * 
*/
    __Pyx_Raise(((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_SchematronError), __pyx_mstate_global->__pyx_kp_u_lxml_etree_was_compiled_without, 0, 0);
    __PYX_ERR(24, 81, __pyx_L1_error)

    /* "src/lxml/schematron.pxi":80
 *         cdef schematron.xmlSchematronParserCtxt* parser_ctxt = NULL
 *         _Validator.__init__(self)
 *         if not config.ENABLE_SCHEMATRON:             # <<<<<<<<<<<<<<
 *             raise SchematronError, \
 *                 "lxml.etree was compiled without Schematron support."
*/
  }

  /* "src/lxml/schematron.pxi":84
 *                 "lxml.etree was compiled without Schematron support."
 * 
 *         import warnings             # <<<<<<<<<<<<<<
 *         warnings.warn(
 *             "The (non-ISO) Schematron feature is deprecated and will be removed from libxml2 and lxml. "
*/
  __pyx_t_5 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_warnings, 0, 0, NULL, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(24, 84, __pyx_L1_error)
  __pyx_t_1 = __pyx_t_5;
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_warnings = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "src/lxml/schematron.pxi":85
 * 
 *         import warnings
 *         warnings.warn(             # <<<<<<<<<<<<<<
 *             "The (non-ISO) Schematron feature is deprecated and will be removed from libxml2 and lxml. "
 *             "Use 'lxml.isoschematron' instead.",
*/
  __pyx_t_2 = __pyx_v_warnings;
  __Pyx_INCREF(__pyx_t_2);

  /* "src/lxml/schematron.pxi":88
 *             "The (non-ISO) Schematron feature is deprecated and will be removed from libxml2 and lxml. "
 *             "Use 'lxml.isoschematron' instead.",
 *             DeprecationWarning,             # <<<<<<<<<<<<<<
 *         )
 * 
*/
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_The_non_ISO_Schematron_feature_i, ((PyObject *)(((PyTypeObject*)PyExc_DeprecationWarning)))};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_warn, __pyx_callargs+__pyx_t_3, (3-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(24, 85, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/schematron.pxi":91
 *         )
 * 
 *         if etree is not None:             # <<<<<<<<<<<<<<
 *             doc = _documentOrRaise(etree)
 *             root_node = _rootNodeOrRaise(etree)
*/
  __pyx_t_4 = (__pyx_v_etree != Py_None);
  if (__pyx_t_4) {

    /* "src/lxml/schematron.pxi":92
 * 
 *         if etree is not None:
 *             doc = _documentOrRaise(etree)             # <<<<<<<<<<<<<<
 *             root_node = _rootNodeOrRaise(etree)
 *             self._c_schema_doc = _copyDocRoot(doc._c_doc, root_node._c_node)
*/
    __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__documentOrRaise(__pyx_v_etree)); if (unlikely(!__pyx_t_1)) __PYX_ERR(24, 92, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/schematron.pxi":93
 *         if etree is not None:
 *             doc = _documentOrRaise(etree)
 *             root_node = _rootNodeOrRaise(etree)             # <<<<<<<<<<<<<<
 *             self._c_schema_doc = _copyDocRoot(doc._c_doc, root_node._c_node)
 *             parser_ctxt = schematron.xmlSchematronNewDocParserCtxt(self._c_schema_doc)
*/
    __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__rootNodeOrRaise(__pyx_v_etree)); if (unlikely(!__pyx_t_1)) __PYX_ERR(24, 93, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_root_node = ((struct LxmlElement *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/schematron.pxi":94
 *             doc = _documentOrRaise(etree)
 *             root_node = _rootNodeOrRaise(etree)
 *             self._c_schema_doc = _copyDocRoot(doc._c_doc, root_node._c_node)             # <<<<<<<<<<<<<<
 *             parser_ctxt = schematron.xmlSchematronNewDocParserCtxt(self._c_schema_doc)
 *         elif file is not None:
*/
    __pyx_t_6 = __pyx_f_4lxml_5etree__copyDocRoot(__pyx_v_doc->_c_doc, __pyx_v_root_node->_c_node); if (unlikely(__pyx_t_6 == ((void *)NULL))) __PYX_ERR(24, 94, __pyx_L1_error)
    __pyx_v_self->_c_schema_doc = __pyx_t_6;

    /* "src/lxml/schematron.pxi":95
 *             root_node = _rootNodeOrRaise(etree)
 *             self._c_schema_doc = _copyDocRoot(doc._c_doc, root_node._c_node)
 *             parser_ctxt = schematron.xmlSchematronNewDocParserCtxt(self._c_schema_doc)             # <<<<<<<<<<<<<<
 *         elif file is not None:
 *             filename = _getFilenameForFile(file)
*/
    __pyx_v_parser_ctxt = xmlSchematronNewDocParserCtxt(__pyx_v_self->_c_schema_doc);

    /* "src/lxml/schematron.pxi":91
 *         )
 * 
 *         if etree is not None:             # <<<<<<<<<<<<<<
 *             doc = _documentOrRaise(etree)
 *             root_node = _rootNodeOrRaise(etree)
*/
    goto __pyx_L4;
  }

  /* "src/lxml/schematron.pxi":96
 *             self._c_schema_doc = _copyDocRoot(doc._c_doc, root_node._c_node)
 *             parser_ctxt = schematron.xmlSchematronNewDocParserCtxt(self._c_schema_doc)
 *         elif file is not None:             # <<<<<<<<<<<<<<
 *             filename = _getFilenameForFile(file)
 *             if filename is None:
*/
  __pyx_t_4 = (__pyx_v_file != Py_None);
  if (likely(__pyx_t_4)) {

    /* "src/lxml/schematron.pxi":97
 *             parser_ctxt = schematron.xmlSchematronNewDocParserCtxt(self._c_schema_doc)
 *         elif file is not None:
 *             filename = _getFilenameForFile(file)             # <<<<<<<<<<<<<<
 *             if filename is None:
 *                 # XXX assume a string object
*/
    __pyx_t_1 = __pyx_f_4lxml_5etree__getFilenameForFile(__pyx_v_file); if (unlikely(!__pyx_t_1)) __PYX_ERR(24, 97, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_filename = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "src/lxml/schematron.pxi":98
 *         elif file is not None:
 *             filename = _getFilenameForFile(file)
 *             if filename is None:             # <<<<<<<<<<<<<<
 *                 # XXX assume a string object
 *                 filename = file
*/
    __pyx_t_4 = (__pyx_v_filename == Py_None);
    if (__pyx_t_4) {

      /* "src/lxml/schematron.pxi":100
 *             if filename is None:
 *                 # XXX assume a string object
 *                 filename = file             # <<<<<<<<<<<<<<
 *             filename = _encodeFilename(filename)
 *             with self._error_log:
*/
      __Pyx_INCREF(__pyx_v_file);
      __Pyx_DECREF_SET(__pyx_v_filename, __pyx_v_file);

      /* "src/lxml/schematron.pxi":98
 *         elif file is not None:
 *             filename = _getFilenameForFile(file)
 *             if filename is None:             # <<<<<<<<<<<<<<
 *                 # XXX assume a string object
 *                 filename = file
*/
    }

    /* "src/lxml/schematron.pxi":101
 *                 # XXX assume a string object
 *                 filename = file
 *             filename = _encodeFilename(filename)             # <<<<<<<<<<<<<<
 *             with self._error_log:
 *                 orig_loader = _register_document_loader()
*/
    __pyx_t_1 = __pyx_f_4lxml_5etree__encodeFilename(__pyx_v_filename); if (unlikely(!__pyx_t_1)) __PYX_ERR(24, 101, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_filename, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/schematron.pxi":102
 *                 filename = file
 *             filename = _encodeFilename(filename)
 *             with self._error_log:             # <<<<<<<<<<<<<<
 *                 orig_loader = _register_document_loader()
 *                 parser_ctxt = schematron.xmlSchematronNewParserCtxt(_cstr(filename))
*/
    /*with:*/ {
      __pyx_t_5 = __Pyx_PyObject_LookupSpecial(((PyObject *)__pyx_v_self->__pyx_base._error_log), __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_5)) __PYX_ERR(24, 102, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_7 = __pyx_f_4lxml_5etree_9_ErrorLog___enter__(__pyx_v_self->__pyx_base._error_log); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(24, 102, __pyx_L6_error)
      /*try:*/ {
        {
          (void)__pyx_t_8; (void)__pyx_t_9; (void)__pyx_t_10; /* mark used */
          /*try:*/ {

            /* "src/lxml/schematron.pxi":103
 *             filename = _encodeFilename(filename)
 *             with self._error_log:
 *                 orig_loader = _register_document_loader()             # <<<<<<<<<<<<<<
 *                 parser_ctxt = schematron.xmlSchematronNewParserCtxt(_cstr(filename))
 *                 _reset_document_loader(orig_loader)
*/
            __pyx_v_orig_loader = __pyx_f_4lxml_5etree__register_document_loader();

            /* "src/lxml/schematron.pxi":104
 *             with self._error_log:
 *                 orig_loader = _register_document_loader()
 *                 parser_ctxt = schematron.xmlSchematronNewParserCtxt(_cstr(filename))             # <<<<<<<<<<<<<<
 *                 _reset_document_loader(orig_loader)
 *         else:
*/
            __pyx_v_parser_ctxt = xmlSchematronNewParserCtxt(PyBytes_AS_STRING(__pyx_v_filename));

            /* "src/lxml/schematron.pxi":105
 *                 orig_loader = _register_document_loader()
 *                 parser_ctxt = schematron.xmlSchematronNewParserCtxt(_cstr(filename))
 *                 _reset_document_loader(orig_loader)             # <<<<<<<<<<<<<<
 *         else:
 *             raise SchematronParseError, "No tree or file given"
*/
            __pyx_f_4lxml_5etree__reset_document_loader(__pyx_v_orig_loader);

            /* "src/lxml/schematron.pxi":102
 *                 filename = file
 *             filename = _encodeFilename(filename)
 *             with self._error_log:             # <<<<<<<<<<<<<<
 *                 orig_loader = _register_document_loader()
 *                 parser_ctxt = schematron.xmlSchematronNewParserCtxt(_cstr(filename))
*/
          }
        }
      }
      /*finally:*/ {
        /*normal exit:*/{
          if (__pyx_t_5) {
            __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_mstate_global->__pyx_tuple[3], NULL);
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
            if (unlikely(!__pyx_t_10)) __PYX_ERR(24, 102, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_10);
            __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          }
          goto __pyx_L9;
        }
        __pyx_L9:;
      }
      goto __pyx_L16;
      __pyx_L6_error:;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L1_error;
      __pyx_L16:;
    }

    /* "src/lxml/schematron.pxi":96
 *             self._c_schema_doc = _copyDocRoot(doc._c_doc, root_node._c_node)
 *             parser_ctxt = schematron.xmlSchematronNewDocParserCtxt(self._c_schema_doc)
 *         elif file is not None:             # <<<<<<<<<<<<<<
 *             filename = _getFilenameForFile(file)
 *             if filename is None:
*/
    goto __pyx_L4;
  }

  /* "src/lxml/schematron.pxi":107
 *                 _reset_document_loader(orig_loader)
 *         else:
 *             raise SchematronParseError, "No tree or file given"             # <<<<<<<<<<<<<<
 * 
 *         if parser_ctxt is NULL:
*/
  /*else*/ {
    __Pyx_Raise(((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_SchematronParseError), __pyx_mstate_global->__pyx_kp_u_No_tree_or_file_given, 0, 0);
    __PYX_ERR(24, 107, __pyx_L1_error)
  }
  __pyx_L4:;

  /* "src/lxml/schematron.pxi":109
 *             raise SchematronParseError, "No tree or file given"
 * 
 *         if parser_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             if self._c_schema_doc is not NULL:
 *                 tree.xmlFreeDoc(self._c_schema_doc)
*/
  __pyx_t_4 = (__pyx_v_parser_ctxt == NULL);
  if (__pyx_t_4) {

    /* "src/lxml/schematron.pxi":110
 * 
 *         if parser_ctxt is NULL:
 *             if self._c_schema_doc is not NULL:             # <<<<<<<<<<<<<<
 *                 tree.xmlFreeDoc(self._c_schema_doc)
 *                 self._c_schema_doc = NULL
*/
    __pyx_t_4 = (__pyx_v_self->_c_schema_doc != NULL);
    if (__pyx_t_4) {

      /* "src/lxml/schematron.pxi":111
 *         if parser_ctxt is NULL:
 *             if self._c_schema_doc is not NULL:
 *                 tree.xmlFreeDoc(self._c_schema_doc)             # <<<<<<<<<<<<<<
 *                 self._c_schema_doc = NULL
 *             raise MemoryError()
*/
      xmlFreeDoc(__pyx_v_self->_c_schema_doc);

      /* "src/lxml/schematron.pxi":112
 *             if self._c_schema_doc is not NULL:
 *                 tree.xmlFreeDoc(self._c_schema_doc)
 *                 self._c_schema_doc = NULL             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 * 
*/
      __pyx_v_self->_c_schema_doc = NULL;

      /* "src/lxml/schematron.pxi":110
 * 
 *         if parser_ctxt is NULL:
 *             if self._c_schema_doc is not NULL:             # <<<<<<<<<<<<<<
 *                 tree.xmlFreeDoc(self._c_schema_doc)
 *                 self._c_schema_doc = NULL
*/
    }

    /* "src/lxml/schematron.pxi":113
 *                 tree.xmlFreeDoc(self._c_schema_doc)
 *                 self._c_schema_doc = NULL
 *             raise MemoryError()             # <<<<<<<<<<<<<<
 * 
 *         try:
*/
    PyErr_NoMemory(); __PYX_ERR(24, 113, __pyx_L1_error)

    /* "src/lxml/schematron.pxi":109
 *             raise SchematronParseError, "No tree or file given"
 * 
 *         if parser_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             if self._c_schema_doc is not NULL:
 *                 tree.xmlFreeDoc(self._c_schema_doc)
*/
  }

  /* "src/lxml/schematron.pxi":115
 *             raise MemoryError()
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             with self._error_log:
 *                 orig_loader = _register_document_loader()
*/
  /*try:*/ {

    /* "src/lxml/schematron.pxi":116
 * 
 *         try:
 *             with self._error_log:             # <<<<<<<<<<<<<<
 *                 orig_loader = _register_document_loader()
 *                 self._c_schema = schematron.xmlSchematronParse(parser_ctxt)
*/
    /*with:*/ {
      __pyx_t_5 = __Pyx_PyObject_LookupSpecial(((PyObject *)__pyx_v_self->__pyx_base._error_log), __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_5)) __PYX_ERR(24, 116, __pyx_L20_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_7 = __pyx_f_4lxml_5etree_9_ErrorLog___enter__(__pyx_v_self->__pyx_base._error_log); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(24, 116, __pyx_L22_error)
      /*try:*/ {
        {
          (void)__pyx_t_10; (void)__pyx_t_9; (void)__pyx_t_8; /* mark used */
          /*try:*/ {

            /* "src/lxml/schematron.pxi":117
 *         try:
 *             with self._error_log:
 *                 orig_loader = _register_document_loader()             # <<<<<<<<<<<<<<
 *                 self._c_schema = schematron.xmlSchematronParse(parser_ctxt)
 *                 _reset_document_loader(orig_loader)
*/
            __pyx_v_orig_loader = __pyx_f_4lxml_5etree__register_document_loader();

            /* "src/lxml/schematron.pxi":118
 *             with self._error_log:
 *                 orig_loader = _register_document_loader()
 *                 self._c_schema = schematron.xmlSchematronParse(parser_ctxt)             # <<<<<<<<<<<<<<
 *                 _reset_document_loader(orig_loader)
 *         finally:
*/
            __pyx_v_self->_c_schema = xmlSchematronParse(__pyx_v_parser_ctxt);

            /* "src/lxml/schematron.pxi":119
 *                 orig_loader = _register_document_loader()
 *                 self._c_schema = schematron.xmlSchematronParse(parser_ctxt)
 *                 _reset_document_loader(orig_loader)             # <<<<<<<<<<<<<<
 *         finally:
 *             schematron.xmlSchematronFreeParserCtxt(parser_ctxt)
*/
            __pyx_f_4lxml_5etree__reset_document_loader(__pyx_v_orig_loader);

            /* "src/lxml/schematron.pxi":116
 * 
 *         try:
 *             with self._error_log:             # <<<<<<<<<<<<<<
 *                 orig_loader = _register_document_loader()
 *                 self._c_schema = schematron.xmlSchematronParse(parser_ctxt)
*/
          }
        }
      }
      /*finally:*/ {
        /*normal exit:*/{
          if (__pyx_t_5) {
            __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_mstate_global->__pyx_tuple[3], NULL);
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
            if (unlikely(!__pyx_t_8)) __PYX_ERR(24, 116, __pyx_L20_error)
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          }
          goto __pyx_L25;
        }
        __pyx_L25:;
      }
      goto __pyx_L32;
      __pyx_L22_error:;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L20_error;
      __pyx_L32:;
    }
  }

  /* "src/lxml/schematron.pxi":121
 *                 _reset_document_loader(orig_loader)
 *         finally:
 *             schematron.xmlSchematronFreeParserCtxt(parser_ctxt)             # <<<<<<<<<<<<<<
 * 
 *         if self._c_schema is NULL:
*/
  /*finally:*/ {
    /*normal exit:*/{
      xmlSchematronFreeParserCtxt(__pyx_v_parser_ctxt);
      goto __pyx_L21;
    }
    __pyx_L20_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_5 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_13, &__pyx_t_14);
      if ( unlikely(__Pyx_GetException(&__pyx_t_5, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_5, &__pyx_t_8, &__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_14);
      __pyx_t_7 = __pyx_lineno; __pyx_t_11 = __pyx_clineno; __pyx_t_12 = __pyx_filename;
      {
        xmlSchematronFreeParserCtxt(__pyx_v_parser_ctxt);
      }
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_XGIVEREF(__pyx_t_14);
      __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_13, __pyx_t_14);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_ErrRestore(__pyx_t_5, __pyx_t_8, __pyx_t_9);
      __pyx_t_5 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
      __pyx_lineno = __pyx_t_7; __pyx_clineno = __pyx_t_11; __pyx_filename = __pyx_t_12;
      goto __pyx_L1_error;
    }
    __pyx_L21:;
  }

  /* "src/lxml/schematron.pxi":123
 *             schematron.xmlSchematronFreeParserCtxt(parser_ctxt)
 * 
 *         if self._c_schema is NULL:             # <<<<<<<<<<<<<<
 *             raise SchematronParseError(
 *                 "Document is not a valid Schematron schema",
*/
  __pyx_t_4 = (__pyx_v_self->_c_schema == NULL);
  if (unlikely(__pyx_t_4)) {

    /* "src/lxml/schematron.pxi":124
 * 
 *         if self._c_schema is NULL:
 *             raise SchematronParseError(             # <<<<<<<<<<<<<<
 *                 "Document is not a valid Schematron schema",
 *                 self._error_log)
*/
    __pyx_t_2 = NULL;

    /* "src/lxml/schematron.pxi":126
 *             raise SchematronParseError(
 *                 "Document is not a valid Schematron schema",
 *                 self._error_log)             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
*/
    __pyx_t_3 = 1;
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_Document_is_not_a_valid_Schematr, ((PyObject *)__pyx_v_self->__pyx_base._error_log)};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_SchematronParseError, __pyx_callargs+__pyx_t_3, (3-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(24, 124, __pyx_L1_error)
      __Pyx_GOTREF((PyObject *)__pyx_t_1);
    }
    __Pyx_Raise(((PyObject *)__pyx_t_1), 0, 0, 0);
    __Pyx_DECREF((PyObject *)__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(24, 124, __pyx_L1_error)

    /* "src/lxml/schematron.pxi":123
 *             schematron.xmlSchematronFreeParserCtxt(parser_ctxt)
 * 
 *         if self._c_schema is NULL:             # <<<<<<<<<<<<<<
 *             raise SchematronParseError(
 *                 "Document is not a valid Schematron schema",
*/
  }

  /* "src/lxml/schematron.pxi":73
 *     cdef xmlDoc* _c_schema_doc
 * 
 *     def __init__(self, etree=None, *, file=None):             # <<<<<<<<<<<<<<
 *         cdef _Document doc
 *         cdef _Element root_node
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.Schematron.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XDECREF((PyObject *)__pyx_v_root_node);
  __Pyx_XDECREF(__pyx_v_warnings);
  __Pyx_XDECREF(__pyx_v_filename);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/schematron.pxi":128
 *                 self._error_log)
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         schematron.xmlSchematronFree(self._c_schema)
 *         if self._c_schema_doc is not NULL:
*/

/* Python wrapper */
static void __pyx_pw_4lxml_5etree_10Schematron_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_4lxml_5etree_10Schematron_3__dealloc__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_pf_4lxml_5etree_10Schematron_2__dealloc__(((struct __pyx_obj_4lxml_5etree_Schematron *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_4lxml_5etree_10Schematron_2__dealloc__(struct __pyx_obj_4lxml_5etree_Schematron *__pyx_v_self) {
  int __pyx_t_1;

  /* "src/lxml/schematron.pxi":129
 * 
 *     def __dealloc__(self):
 *         schematron.xmlSchematronFree(self._c_schema)             # <<<<<<<<<<<<<<
 *         if self._c_schema_doc is not NULL:
 *             tree.xmlFreeDoc(self._c_schema_doc)
*/
  xmlSchematronFree(__pyx_v_self->_c_schema);

  /* "src/lxml/schematron.pxi":130
 *     def __dealloc__(self):
 *         schematron.xmlSchematronFree(self._c_schema)
 *         if self._c_schema_doc is not NULL:             # <<<<<<<<<<<<<<
 *             tree.xmlFreeDoc(self._c_schema_doc)
 * 
*/
  __pyx_t_1 = (__pyx_v_self->_c_schema_doc != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/schematron.pxi":131
 *         schematron.xmlSchematronFree(self._c_schema)
 *         if self._c_schema_doc is not NULL:
 *             tree.xmlFreeDoc(self._c_schema_doc)             # <<<<<<<<<<<<<<
 * 
 *     def __call__(self, etree):
*/
    xmlFreeDoc(__pyx_v_self->_c_schema_doc);

    /* "src/lxml/schematron.pxi":130
 *     def __dealloc__(self):
 *         schematron.xmlSchematronFree(self._c_schema)
 *         if self._c_schema_doc is not NULL:             # <<<<<<<<<<<<<<
 *             tree.xmlFreeDoc(self._c_schema_doc)
 * 
*/
  }

  /* "src/lxml/schematron.pxi":128
 *                 self._error_log)
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         schematron.xmlSchematronFree(self._c_schema)
 *         if self._c_schema_doc is not NULL:
*/

  /* function exit code */
}

/* "src/lxml/schematron.pxi":133
 *             tree.xmlFreeDoc(self._c_schema_doc)
 * 
 *     def __call__(self, etree):             # <<<<<<<<<<<<<<
 *         """__call__(self, etree)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_10Schematron_5__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_10Schematron_4__call__, "__call__(self, etree)\n\n        Validate doc using Schematron.\n\n        Returns true if document is valid, false if not.");
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_10Schematron_4__call__;
#endif
static PyObject *__pyx_pw_4lxml_5etree_10Schematron_5__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_etree = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_etree,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(24, 133, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(24, 133, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__call__", 0) < (0)) __PYX_ERR(24, 133, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, i); __PYX_ERR(24, 133, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(24, 133, __pyx_L3_error)
    }
    __pyx_v_etree = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, __pyx_nargs); __PYX_ERR(24, 133, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("lxml.etree.Schematron.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_10Schematron_4__call__(((struct __pyx_obj_4lxml_5etree_Schematron *)__pyx_v_self), __pyx_v_etree);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_10Schematron_4__call__(struct __pyx_obj_4lxml_5etree_Schematron *__pyx_v_self, PyObject *__pyx_v_etree) {
  struct LxmlDocument *__pyx_v_doc = 0;
  struct LxmlElement *__pyx_v_root_node = 0;
  xmlDoc *__pyx_v_c_doc;
  xmlSchematronValidCtxt *__pyx_v_valid_ctxt;
  int __pyx_v_ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  xmlDoc *__pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  char const *__pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  size_t __pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__call__", 0);

  /* "src/lxml/schematron.pxi":145
 *         cdef int ret
 * 
 *         assert self._c_schema is not NULL, "Schematron instance not initialised"             # <<<<<<<<<<<<<<
 *         doc = _documentOrRaise(etree)
 *         root_node = _rootNodeOrRaise(etree)
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = (__pyx_v_self->_c_schema != NULL);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_mstate_global->__pyx_kp_u_Schematron_instance_not_initiali, 0, 0);
      __PYX_ERR(24, 145, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(24, 145, __pyx_L1_error)
  #endif

  /* "src/lxml/schematron.pxi":146
 * 
 *         assert self._c_schema is not NULL, "Schematron instance not initialised"
 *         doc = _documentOrRaise(etree)             # <<<<<<<<<<<<<<
 *         root_node = _rootNodeOrRaise(etree)
 * 
*/
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__documentOrRaise(__pyx_v_etree)); if (unlikely(!__pyx_t_2)) __PYX_ERR(24, 146, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/schematron.pxi":147
 *         assert self._c_schema is not NULL, "Schematron instance not initialised"
 *         doc = _documentOrRaise(etree)
 *         root_node = _rootNodeOrRaise(etree)             # <<<<<<<<<<<<<<
 * 
 *         valid_ctxt = schematron.xmlSchematronNewValidCtxt(
*/
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__rootNodeOrRaise(__pyx_v_etree)); if (unlikely(!__pyx_t_2)) __PYX_ERR(24, 147, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_root_node = ((struct LxmlElement *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/schematron.pxi":149
 *         root_node = _rootNodeOrRaise(etree)
 * 
 *         valid_ctxt = schematron.xmlSchematronNewValidCtxt(             # <<<<<<<<<<<<<<
 *             self._c_schema, schematron.XML_SCHEMATRON_OUT_ERROR)
 *         if valid_ctxt is NULL:
*/
  __pyx_v_valid_ctxt = xmlSchematronNewValidCtxt(__pyx_v_self->_c_schema, XML_SCHEMATRON_OUT_ERROR);

  /* "src/lxml/schematron.pxi":151
 *         valid_ctxt = schematron.xmlSchematronNewValidCtxt(
 *             self._c_schema, schematron.XML_SCHEMATRON_OUT_ERROR)
 *         if valid_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 * 
*/
  __pyx_t_1 = (__pyx_v_valid_ctxt == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/schematron.pxi":152
 *             self._c_schema, schematron.XML_SCHEMATRON_OUT_ERROR)
 *         if valid_ctxt is NULL:
 *             raise MemoryError()             # <<<<<<<<<<<<<<
 * 
 *         try:
*/
    PyErr_NoMemory(); __PYX_ERR(24, 152, __pyx_L1_error)

    /* "src/lxml/schematron.pxi":151
 *         valid_ctxt = schematron.xmlSchematronNewValidCtxt(
 *             self._c_schema, schematron.XML_SCHEMATRON_OUT_ERROR)
 *         if valid_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 * 
*/
  }

  /* "src/lxml/schematron.pxi":154
 *             raise MemoryError()
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             self._error_log.clear()
 *             # Need a cast here because older libxml2 releases do not use 'const' in the functype.
*/
  /*try:*/ {

    /* "src/lxml/schematron.pxi":155
 * 
 *         try:
 *             self._error_log.clear()             # <<<<<<<<<<<<<<
 *             # Need a cast here because older libxml2 releases do not use 'const' in the functype.
 *             schematron.xmlSchematronSetValidStructuredErrors(
*/
    __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)__pyx_v_self->__pyx_base._error_log->__pyx_base.__pyx_base.__pyx_vtab)->clear(__pyx_v_self->__pyx_base._error_log, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(24, 155, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/schematron.pxi":157
 *             self._error_log.clear()
 *             # Need a cast here because older libxml2 releases do not use 'const' in the functype.
 *             schematron.xmlSchematronSetValidStructuredErrors(             # <<<<<<<<<<<<<<
 *                 valid_ctxt, <xmlerror.xmlStructuredErrorFunc> _receiveError, <void*>self._error_log)
 *             c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
*/
    xmlSchematronSetValidStructuredErrors(__pyx_v_valid_ctxt, ((xmlStructuredErrorFunc)__pyx_f_4lxml_5etree__receiveError), ((void *)__pyx_v_self->__pyx_base._error_log));

    /* "src/lxml/schematron.pxi":159
 *             schematron.xmlSchematronSetValidStructuredErrors(
 *                 valid_ctxt, <xmlerror.xmlStructuredErrorFunc> _receiveError, <void*>self._error_log)
 *             c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 ret = schematron.xmlSchematronValidateDoc(valid_ctxt, c_doc)
*/
    __pyx_t_3 = __pyx_f_4lxml_5etree__fakeRootDoc(__pyx_v_doc->_c_doc, __pyx_v_root_node->_c_node); if (unlikely(__pyx_t_3 == ((void *)NULL))) __PYX_ERR(24, 159, __pyx_L5_error)
    __pyx_v_c_doc = __pyx_t_3;

    /* "src/lxml/schematron.pxi":160
 *                 valid_ctxt, <xmlerror.xmlStructuredErrorFunc> _receiveError, <void*>self._error_log)
 *             c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 ret = schematron.xmlSchematronValidateDoc(valid_ctxt, c_doc)
 *             _destroyFakeDoc(doc._c_doc, c_doc)
*/
    {
        PyThreadState * _save;
        _save = PyEval_SaveThread();
        __Pyx_FastGIL_Remember();
        /*try:*/ {

          /* "src/lxml/schematron.pxi":161
 *             c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *             with nogil:
 *                 ret = schematron.xmlSchematronValidateDoc(valid_ctxt, c_doc)             # <<<<<<<<<<<<<<
 *             _destroyFakeDoc(doc._c_doc, c_doc)
 *         finally:
*/
          __pyx_v_ret = xmlSchematronValidateDoc(__pyx_v_valid_ctxt, __pyx_v_c_doc);
        }

        /* "src/lxml/schematron.pxi":160
 *                 valid_ctxt, <xmlerror.xmlStructuredErrorFunc> _receiveError, <void*>self._error_log)
 *             c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 ret = schematron.xmlSchematronValidateDoc(valid_ctxt, c_doc)
 *             _destroyFakeDoc(doc._c_doc, c_doc)
*/
        /*finally:*/ {
          /*normal exit:*/{
            __Pyx_FastGIL_Forget();
            PyEval_RestoreThread(_save);
            goto __pyx_L9;
          }
          __pyx_L9:;
        }
    }

    /* "src/lxml/schematron.pxi":162
 *             with nogil:
 *                 ret = schematron.xmlSchematronValidateDoc(valid_ctxt, c_doc)
 *             _destroyFakeDoc(doc._c_doc, c_doc)             # <<<<<<<<<<<<<<
 *         finally:
 *             schematron.xmlSchematronFreeValidCtxt(valid_ctxt)
*/
    __pyx_f_4lxml_5etree__destroyFakeDoc(__pyx_v_doc->_c_doc, __pyx_v_c_doc);
  }

  /* "src/lxml/schematron.pxi":164
 *             _destroyFakeDoc(doc._c_doc, c_doc)
 *         finally:
 *             schematron.xmlSchematronFreeValidCtxt(valid_ctxt)             # <<<<<<<<<<<<<<
 * 
 *         if ret == -1:
*/
  /*finally:*/ {
    /*normal exit:*/{
      xmlSchematronFreeValidCtxt(__pyx_v_valid_ctxt);
      goto __pyx_L6;
    }
    __pyx_L5_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      if ( unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename;
      {
        xmlSchematronFreeValidCtxt(__pyx_v_valid_ctxt);
      }
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
      __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6;
      goto __pyx_L1_error;
    }
    __pyx_L6:;
  }

  /* "src/lxml/schematron.pxi":166
 *             schematron.xmlSchematronFreeValidCtxt(valid_ctxt)
 * 
 *         if ret == -1:             # <<<<<<<<<<<<<<
 *             raise SchematronValidateError(
 *                 "Internal error in Schematron validation",
*/
  __pyx_t_1 = (__pyx_v_ret == -1L);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/schematron.pxi":167
 * 
 *         if ret == -1:
 *             raise SchematronValidateError(             # <<<<<<<<<<<<<<
 *                 "Internal error in Schematron validation",
 *                 self._error_log)
*/
    __pyx_t_13 = NULL;

    /* "src/lxml/schematron.pxi":169
 *             raise SchematronValidateError(
 *                 "Internal error in Schematron validation",
 *                 self._error_log)             # <<<<<<<<<<<<<<
 *         if ret == 0:
 *             return True
*/
    __pyx_t_14 = 1;
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_13, __pyx_mstate_global->__pyx_kp_u_Internal_error_in_Schematron_val, ((PyObject *)__pyx_v_self->__pyx_base._error_log)};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_SchematronValidateError, __pyx_callargs+__pyx_t_14, (3-__pyx_t_14) | (__pyx_t_14*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(24, 167, __pyx_L1_error)
      __Pyx_GOTREF((PyObject *)__pyx_t_2);
    }
    __Pyx_Raise(((PyObject *)__pyx_t_2), 0, 0, 0);
    __Pyx_DECREF((PyObject *)__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(24, 167, __pyx_L1_error)

    /* "src/lxml/schematron.pxi":166
 *             schematron.xmlSchematronFreeValidCtxt(valid_ctxt)
 * 
 *         if ret == -1:             # <<<<<<<<<<<<<<
 *             raise SchematronValidateError(
 *                 "Internal error in Schematron validation",
*/
  }

  /* "src/lxml/schematron.pxi":170
 *                 "Internal error in Schematron validation",
 *                 self._error_log)
 *         if ret == 0:             # <<<<<<<<<<<<<<
 *             return True
 *         else:
*/
  __pyx_t_1 = (__pyx_v_ret == 0);
  if (__pyx_t_1) {

    /* "src/lxml/schematron.pxi":171
 *                 self._error_log)
 *         if ret == 0:
 *             return True             # <<<<<<<<<<<<<<
 *         else:
 *             return False
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;

    /* "src/lxml/schematron.pxi":170
 *                 "Internal error in Schematron validation",
 *                 self._error_log)
 *         if ret == 0:             # <<<<<<<<<<<<<<
 *             return True
 *         else:
*/
  }

  /* "src/lxml/schematron.pxi":173
 *             return True
 *         else:
 *             return False             # <<<<<<<<<<<<<<
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;
  }

  /* "src/lxml/schematron.pxi":133
 *             tree.xmlFreeDoc(self._c_schema_doc)
 * 
 *     def __call__(self, etree):             # <<<<<<<<<<<<<<
 *         """__call__(self, etree)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("lxml.etree.Schematron.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XDECREF((PyObject *)__pyx_v_root_node);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/public-api.pxi":3
 * # Public C API for lxml.etree
 * 
 * cdef public api _Element deepcopyNodeToDocument(_Document doc, xmlNode* c_root):             # <<<<<<<<<<<<<<
 *     "Recursively copy the element into the document. doc is not modified."
 *     cdef xmlNode* c_node
*/

struct LxmlElement *deepcopyNodeToDocument(struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_root) {
  xmlNode *__pyx_v_c_node;
  struct LxmlElement *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  xmlNode *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("deepcopyNodeToDocument", 0);

  /* "src/lxml/public-api.pxi":6
 *     "Recursively copy the element into the document. doc is not modified."
 *     cdef xmlNode* c_node
 *     c_node = _copyNodeToDoc(c_root, doc._c_doc)             # <<<<<<<<<<<<<<
 *     return _elementFactory(doc, c_node)
 * 
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__copyNodeToDoc(__pyx_v_c_root, __pyx_v_doc->_c_doc); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(25, 6, __pyx_L1_error)
  __pyx_v_c_node = __pyx_t_1;

  /* "src/lxml/public-api.pxi":7
 *     cdef xmlNode* c_node
 *     c_node = _copyNodeToDoc(c_root, doc._c_doc)
 *     return _elementFactory(doc, c_node)             # <<<<<<<<<<<<<<
 * 
 * cdef public api _ElementTree elementTreeFactory(_Element context_node):
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(__pyx_v_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_2)) __PYX_ERR(25, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = ((struct LxmlElement *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":3
 * # Public C API for lxml.etree
 * 
 * cdef public api _Element deepcopyNodeToDocument(_Document doc, xmlNode* c_root):             # <<<<<<<<<<<<<<
 *     "Recursively copy the element into the document. doc is not modified."
 *     cdef xmlNode* c_node
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.deepcopyNodeToDocument", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/public-api.pxi":9
 *     return _elementFactory(doc, c_node)
 * 
 * cdef public api _ElementTree elementTreeFactory(_Element context_node):             # <<<<<<<<<<<<<<
 *     _assertValidNode(context_node)
 *     return newElementTree(context_node, _ElementTree)
*/

struct LxmlElementTree *elementTreeFactory(struct LxmlElement *__pyx_v_context_node) {
  struct LxmlElementTree *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("elementTreeFactory", 0);

  /* "src/lxml/public-api.pxi":10
 * 
 * cdef public api _ElementTree elementTreeFactory(_Element context_node):
 *     _assertValidNode(context_node)             # <<<<<<<<<<<<<<
 *     return newElementTree(context_node, _ElementTree)
 * 
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_context_node); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(25, 10, __pyx_L1_error)

  /* "src/lxml/public-api.pxi":11
 * cdef public api _ElementTree elementTreeFactory(_Element context_node):
 *     _assertValidNode(context_node)
 *     return newElementTree(context_node, _ElementTree)             # <<<<<<<<<<<<<<
 * 
 * cdef public api _ElementTree newElementTree(_Element context_node,
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __pyx_t_2 = ((PyObject *)newElementTree(__pyx_v_context_node, ((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ElementTree))); if (unlikely(!__pyx_t_2)) __PYX_ERR(25, 11, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = ((struct LxmlElementTree *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":9
 *     return _elementFactory(doc, c_node)
 * 
 * cdef public api _ElementTree elementTreeFactory(_Element context_node):             # <<<<<<<<<<<<<<
 *     _assertValidNode(context_node)
 *     return newElementTree(context_node, _ElementTree)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.elementTreeFactory", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/public-api.pxi":13
 *     return newElementTree(context_node, _ElementTree)
 * 
 * cdef public api _ElementTree newElementTree(_Element context_node,             # <<<<<<<<<<<<<<
 *                                             object subclass):
 *     if <void*>context_node is NULL or context_node is None:
*/

struct LxmlElementTree *newElementTree(struct LxmlElement *__pyx_v_context_node, PyObject *__pyx_v_subclass) {
  struct LxmlElementTree *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("newElementTree", 0);

  /* "src/lxml/public-api.pxi":15
 * cdef public api _ElementTree newElementTree(_Element context_node,
 *                                             object subclass):
 *     if <void*>context_node is NULL or context_node is None:             # <<<<<<<<<<<<<<
 *         raise TypeError
 *     _assertValidNode(context_node)
*/
  __pyx_t_2 = (((void *)__pyx_v_context_node) == NULL);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (((PyObject *)__pyx_v_context_node) == Py_None);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/public-api.pxi":16
 *                                             object subclass):
 *     if <void*>context_node is NULL or context_node is None:
 *         raise TypeError             # <<<<<<<<<<<<<<
 *     _assertValidNode(context_node)
 *     return _newElementTree(context_node._doc, context_node, subclass)
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), 0, 0, 0);
    __PYX_ERR(25, 16, __pyx_L1_error)

    /* "src/lxml/public-api.pxi":15
 * cdef public api _ElementTree newElementTree(_Element context_node,
 *                                             object subclass):
 *     if <void*>context_node is NULL or context_node is None:             # <<<<<<<<<<<<<<
 *         raise TypeError
 *     _assertValidNode(context_node)
*/
  }

  /* "src/lxml/public-api.pxi":17
 *     if <void*>context_node is NULL or context_node is None:
 *         raise TypeError
 *     _assertValidNode(context_node)             # <<<<<<<<<<<<<<
 *     return _newElementTree(context_node._doc, context_node, subclass)
 * 
*/
  __pyx_t_3 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_context_node); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(25, 17, __pyx_L1_error)

  /* "src/lxml/public-api.pxi":18
 *         raise TypeError
 *     _assertValidNode(context_node)
 *     return _newElementTree(context_node._doc, context_node, subclass)             # <<<<<<<<<<<<<<
 * 
 * cdef public api _ElementTree adoptExternalDocument(xmlDoc* c_doc, parser, bint is_owned):
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __pyx_t_4 = ((PyObject *)__pyx_v_context_node->_doc);
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_5 = ((PyObject *)__pyx_f_4lxml_5etree__newElementTree(((struct LxmlDocument *)__pyx_t_4), __pyx_v_context_node, __pyx_v_subclass)); if (unlikely(!__pyx_t_5)) __PYX_ERR(25, 18, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = ((struct LxmlElementTree *)__pyx_t_5);
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":13
 *     return newElementTree(context_node, _ElementTree)
 * 
 * cdef public api _ElementTree newElementTree(_Element context_node,             # <<<<<<<<<<<<<<
 *                                             object subclass):
 *     if <void*>context_node is NULL or context_node is None:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree.newElementTree", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/public-api.pxi":20
 *     return _newElementTree(context_node._doc, context_node, subclass)
 * 
 * cdef public api _ElementTree adoptExternalDocument(xmlDoc* c_doc, parser, bint is_owned):             # <<<<<<<<<<<<<<
 *     if c_doc is NULL:
 *         raise TypeError
*/

struct LxmlElementTree *adoptExternalDocument(xmlDoc *__pyx_v_c_doc, PyObject *__pyx_v_parser, int __pyx_v_is_owned) {
  struct LxmlDocument *__pyx_v_doc = NULL;
  struct LxmlElementTree *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  struct __pyx_opt_args_4lxml_5etree__adoptForeignDoc __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("adoptExternalDocument", 0);

  /* "src/lxml/public-api.pxi":21
 * 
 * cdef public api _ElementTree adoptExternalDocument(xmlDoc* c_doc, parser, bint is_owned):
 *     if c_doc is NULL:             # <<<<<<<<<<<<<<
 *         raise TypeError
 *     doc = _adoptForeignDoc(c_doc, parser, is_owned)
*/
  __pyx_t_1 = (__pyx_v_c_doc == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/public-api.pxi":22
 * cdef public api _ElementTree adoptExternalDocument(xmlDoc* c_doc, parser, bint is_owned):
 *     if c_doc is NULL:
 *         raise TypeError             # <<<<<<<<<<<<<<
 *     doc = _adoptForeignDoc(c_doc, parser, is_owned)
 *     return _elementTreeFactory(doc, None)
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), 0, 0, 0);
    __PYX_ERR(25, 22, __pyx_L1_error)

    /* "src/lxml/public-api.pxi":21
 * 
 * cdef public api _ElementTree adoptExternalDocument(xmlDoc* c_doc, parser, bint is_owned):
 *     if c_doc is NULL:             # <<<<<<<<<<<<<<
 *         raise TypeError
 *     doc = _adoptForeignDoc(c_doc, parser, is_owned)
*/
  }

  /* "src/lxml/public-api.pxi":23
 *     if c_doc is NULL:
 *         raise TypeError
 *     doc = _adoptForeignDoc(c_doc, parser, is_owned)             # <<<<<<<<<<<<<<
 *     return _elementTreeFactory(doc, None)
 * 
*/
  if (!(likely(((__pyx_v_parser) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_parser, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__BaseParser))))) __PYX_ERR(25, 23, __pyx_L1_error)
  __pyx_t_3.__pyx_n = 2;
  __pyx_t_3.parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_parser);
  __pyx_t_3.is_owned = __pyx_v_is_owned;
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__adoptForeignDoc(__pyx_v_c_doc, &__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(25, 23, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/public-api.pxi":24
 *         raise TypeError
 *     doc = _adoptForeignDoc(c_doc, parser, is_owned)
 *     return _elementTreeFactory(doc, None)             # <<<<<<<<<<<<<<
 * 
 * cdef public api _Element elementFactory(_Document doc, xmlNode* c_node):
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__elementTreeFactory(__pyx_v_doc, ((struct LxmlElement *)Py_None))); if (unlikely(!__pyx_t_2)) __PYX_ERR(25, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = ((struct LxmlElementTree *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":20
 *     return _newElementTree(context_node._doc, context_node, subclass)
 * 
 * cdef public api _ElementTree adoptExternalDocument(xmlDoc* c_doc, parser, bint is_owned):             # <<<<<<<<<<<<<<
 *     if c_doc is NULL:
 *         raise TypeError
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.adoptExternalDocument", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/public-api.pxi":26
 *     return _elementTreeFactory(doc, None)
 * 
 * cdef public api _Element elementFactory(_Document doc, xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     if c_node is NULL or doc is None:
 *         raise TypeError
*/

struct LxmlElement *elementFactory(struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_node) {
  struct LxmlElement *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("elementFactory", 0);

  /* "src/lxml/public-api.pxi":27
 * 
 * cdef public api _Element elementFactory(_Document doc, xmlNode* c_node):
 *     if c_node is NULL or doc is None:             # <<<<<<<<<<<<<<
 *         raise TypeError
 *     return _elementFactory(doc, c_node)
*/
  __pyx_t_2 = (__pyx_v_c_node == NULL);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (((PyObject *)__pyx_v_doc) == Py_None);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/public-api.pxi":28
 * cdef public api _Element elementFactory(_Document doc, xmlNode* c_node):
 *     if c_node is NULL or doc is None:
 *         raise TypeError             # <<<<<<<<<<<<<<
 *     return _elementFactory(doc, c_node)
 * 
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), 0, 0, 0);
    __PYX_ERR(25, 28, __pyx_L1_error)

    /* "src/lxml/public-api.pxi":27
 * 
 * cdef public api _Element elementFactory(_Document doc, xmlNode* c_node):
 *     if c_node is NULL or doc is None:             # <<<<<<<<<<<<<<
 *         raise TypeError
 *     return _elementFactory(doc, c_node)
*/
  }

  /* "src/lxml/public-api.pxi":29
 *     if c_node is NULL or doc is None:
 *         raise TypeError
 *     return _elementFactory(doc, c_node)             # <<<<<<<<<<<<<<
 * 
 * cdef public api _Element makeElement(tag, _Document doc, parser,
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(__pyx_v_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_3)) __PYX_ERR(25, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = ((struct LxmlElement *)__pyx_t_3);
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":26
 *     return _elementTreeFactory(doc, None)
 * 
 * cdef public api _Element elementFactory(_Document doc, xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     if c_node is NULL or doc is None:
 *         raise TypeError
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.elementFactory", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/public-api.pxi":31
 *     return _elementFactory(doc, c_node)
 * 
 * cdef public api _Element makeElement(tag, _Document doc, parser,             # <<<<<<<<<<<<<<
 *                                      text, tail, attrib, nsmap):
 *     return _makeElement(tag, NULL, doc, parser, text, tail, attrib, nsmap, None)
*/

struct LxmlElement *makeElement(PyObject *__pyx_v_tag, struct LxmlDocument *__pyx_v_doc, PyObject *__pyx_v_parser, PyObject *__pyx_v_text, PyObject *__pyx_v_tail, PyObject *__pyx_v_attrib, PyObject *__pyx_v_nsmap) {
  struct LxmlElement *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("makeElement", 0);

  /* "src/lxml/public-api.pxi":33
 * cdef public api _Element makeElement(tag, _Document doc, parser,
 *                                      text, tail, attrib, nsmap):
 *     return _makeElement(tag, NULL, doc, parser, text, tail, attrib, nsmap, None)             # <<<<<<<<<<<<<<
 * 
 * cdef public api _Element makeSubElement(_Element parent, tag, text, tail,
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  if (!(likely(((__pyx_v_parser) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_parser, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__BaseParser))))) __PYX_ERR(25, 33, __pyx_L1_error)
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__makeElement(__pyx_v_tag, NULL, __pyx_v_doc, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_parser), __pyx_v_text, __pyx_v_tail, __pyx_v_attrib, __pyx_v_nsmap, ((PyObject*)Py_None))); if (unlikely(!__pyx_t_1)) __PYX_ERR(25, 33, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":31
 *     return _elementFactory(doc, c_node)
 * 
 * cdef public api _Element makeElement(tag, _Document doc, parser,             # <<<<<<<<<<<<<<
 *                                      text, tail, attrib, nsmap):
 *     return _makeElement(tag, NULL, doc, parser, text, tail, attrib, nsmap, None)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.makeElement", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/public-api.pxi":35
 *     return _makeElement(tag, NULL, doc, parser, text, tail, attrib, nsmap, None)
 * 
 * cdef public api _Element makeSubElement(_Element parent, tag, text, tail,             # <<<<<<<<<<<<<<
 *                                         attrib, nsmap):
 *     _assertValidNode(parent)
*/

struct LxmlElement *makeSubElement(struct LxmlElement *__pyx_v_parent, PyObject *__pyx_v_tag, PyObject *__pyx_v_text, PyObject *__pyx_v_tail, PyObject *__pyx_v_attrib, PyObject *__pyx_v_nsmap) {
  struct LxmlElement *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("makeSubElement", 0);

  /* "src/lxml/public-api.pxi":37
 * cdef public api _Element makeSubElement(_Element parent, tag, text, tail,
 *                                         attrib, nsmap):
 *     _assertValidNode(parent)             # <<<<<<<<<<<<<<
 *     return _makeSubElement(parent, tag, text, tail, attrib, nsmap, None)
 * 
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_parent); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(25, 37, __pyx_L1_error)

  /* "src/lxml/public-api.pxi":38
 *                                         attrib, nsmap):
 *     _assertValidNode(parent)
 *     return _makeSubElement(parent, tag, text, tail, attrib, nsmap, None)             # <<<<<<<<<<<<<<
 * 
 * cdef public api void setElementClassLookupFunction(
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__makeSubElement(__pyx_v_parent, __pyx_v_tag, __pyx_v_text, __pyx_v_tail, __pyx_v_attrib, __pyx_v_nsmap, ((PyObject*)Py_None))); if (unlikely(!__pyx_t_2)) __PYX_ERR(25, 38, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = ((struct LxmlElement *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":35
 *     return _makeElement(tag, NULL, doc, parser, text, tail, attrib, nsmap, None)
 * 
 * cdef public api _Element makeSubElement(_Element parent, tag, text, tail,             # <<<<<<<<<<<<<<
 *                                         attrib, nsmap):
 *     _assertValidNode(parent)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.makeSubElement", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/public-api.pxi":40
 *     return _makeSubElement(parent, tag, text, tail, attrib, nsmap, None)
 * 
 * cdef public api void setElementClassLookupFunction(             # <<<<<<<<<<<<<<
 *     _element_class_lookup_function function, state):
 *     _setElementClassLookupFunction(function, state)
*/

void setElementClassLookupFunction(_element_class_lookup_function __pyx_v_function, PyObject *__pyx_v_state) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/public-api.pxi":42
 * cdef public api void setElementClassLookupFunction(
 *     _element_class_lookup_function function, state):
 *     _setElementClassLookupFunction(function, state)             # <<<<<<<<<<<<<<
 * 
 * cdef public api object lookupDefaultElementClass(state, doc, xmlNode* c_node):
*/
  __pyx_f_4lxml_5etree__setElementClassLookupFunction(__pyx_v_function, __pyx_v_state); if (unlikely(PyErr_Occurred())) __PYX_ERR(25, 42, __pyx_L1_error)

  /* "src/lxml/public-api.pxi":40
 *     return _makeSubElement(parent, tag, text, tail, attrib, nsmap, None)
 * 
 * cdef public api void setElementClassLookupFunction(             # <<<<<<<<<<<<<<
 *     _element_class_lookup_function function, state):
 *     _setElementClassLookupFunction(function, state)
*/

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.setElementClassLookupFunction", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
}

/* "src/lxml/public-api.pxi":44
 *     _setElementClassLookupFunction(function, state)
 * 
 * cdef public api object lookupDefaultElementClass(state, doc, xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     return _lookupDefaultElementClass(state, doc, c_node)
 * 
*/

PyObject *lookupDefaultElementClass(PyObject *__pyx_v_state, PyObject *__pyx_v_doc, xmlNode *__pyx_v_c_node) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("lookupDefaultElementClass", 0);

  /* "src/lxml/public-api.pxi":45
 * 
 * cdef public api object lookupDefaultElementClass(state, doc, xmlNode* c_node):
 *     return _lookupDefaultElementClass(state, doc, c_node)             # <<<<<<<<<<<<<<
 * 
 * cdef public api object lookupNamespaceElementClass(state, doc, xmlNode* c_node):
*/
  __Pyx_XDECREF(__pyx_r);
  if (!(likely(((__pyx_v_doc) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_doc, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Document))))) __PYX_ERR(25, 45, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_4lxml_5etree__lookupDefaultElementClass(__pyx_v_state, ((struct LxmlDocument *)__pyx_v_doc), __pyx_v_c_node); if (unlikely(!__pyx_t_1)) __PYX_ERR(25, 45, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":44
 *     _setElementClassLookupFunction(function, state)
 * 
 * cdef public api object lookupDefaultElementClass(state, doc, xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     return _lookupDefaultElementClass(state, doc, c_node)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.lookupDefaultElementClass", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/public-api.pxi":47
 *     return _lookupDefaultElementClass(state, doc, c_node)
 * 
 * cdef public api object lookupNamespaceElementClass(state, doc, xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     return _find_nselement_class(state, doc, c_node)
 * 
*/

PyObject *lookupNamespaceElementClass(PyObject *__pyx_v_state, PyObject *__pyx_v_doc, xmlNode *__pyx_v_c_node) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("lookupNamespaceElementClass", 0);

  /* "src/lxml/public-api.pxi":48
 * 
 * cdef public api object lookupNamespaceElementClass(state, doc, xmlNode* c_node):
 *     return _find_nselement_class(state, doc, c_node)             # <<<<<<<<<<<<<<
 * 
 * cdef public api object callLookupFallback(FallbackElementClassLookup lookup,
*/
  __Pyx_XDECREF(__pyx_r);
  if (!(likely(((__pyx_v_doc) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_doc, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Document))))) __PYX_ERR(25, 48, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_4lxml_5etree__find_nselement_class(__pyx_v_state, ((struct LxmlDocument *)__pyx_v_doc), __pyx_v_c_node); if (unlikely(!__pyx_t_1)) __PYX_ERR(25, 48, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":47
 *     return _lookupDefaultElementClass(state, doc, c_node)
 * 
 * cdef public api object lookupNamespaceElementClass(state, doc, xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     return _find_nselement_class(state, doc, c_node)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.lookupNamespaceElementClass", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/public-api.pxi":50
 *     return _find_nselement_class(state, doc, c_node)
 * 
 * cdef public api object callLookupFallback(FallbackElementClassLookup lookup,             # <<<<<<<<<<<<<<
 *                                           _Document doc, xmlNode* c_node):
 *     return _callLookupFallback(lookup, doc, c_node)
*/

PyObject *callLookupFallback(struct LxmlFallbackElementClassLookup *__pyx_v_lookup, struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_node) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("callLookupFallback", 0);

  /* "src/lxml/public-api.pxi":52
 * cdef public api object callLookupFallback(FallbackElementClassLookup lookup,
 *                                           _Document doc, xmlNode* c_node):
 *     return _callLookupFallback(lookup, doc, c_node)             # <<<<<<<<<<<<<<
 * 
 * cdef public api int tagMatches(xmlNode* c_node, const_xmlChar* c_href, const_xmlChar* c_name) noexcept:
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree__callLookupFallback(__pyx_v_lookup, __pyx_v_doc, __pyx_v_c_node); if (unlikely(!__pyx_t_1)) __PYX_ERR(25, 52, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":50
 *     return _find_nselement_class(state, doc, c_node)
 * 
 * cdef public api object callLookupFallback(FallbackElementClassLookup lookup,             # <<<<<<<<<<<<<<
 *                                           _Document doc, xmlNode* c_node):
 *     return _callLookupFallback(lookup, doc, c_node)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.callLookupFallback", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/public-api.pxi":54
 *     return _callLookupFallback(lookup, doc, c_node)
 * 
 * cdef public api int tagMatches(xmlNode* c_node, const_xmlChar* c_href, const_xmlChar* c_name) noexcept:             # <<<<<<<<<<<<<<
 *     if c_node is NULL:
 *         return -1
*/

int tagMatches(xmlNode *__pyx_v_c_node, const xmlChar *__pyx_v_c_href, const xmlChar *__pyx_v_c_name) {
  int __pyx_r;
  int __pyx_t_1;

  /* "src/lxml/public-api.pxi":55
 * 
 * cdef public api int tagMatches(xmlNode* c_node, const_xmlChar* c_href, const_xmlChar* c_name) noexcept:
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         return -1
 *     return _tagMatches(c_node, c_href, c_name)
*/
  __pyx_t_1 = (__pyx_v_c_node == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/public-api.pxi":56
 * cdef public api int tagMatches(xmlNode* c_node, const_xmlChar* c_href, const_xmlChar* c_name) noexcept:
 *     if c_node is NULL:
 *         return -1             # <<<<<<<<<<<<<<
 *     return _tagMatches(c_node, c_href, c_name)
 * 
*/
    __pyx_r = -1;
    goto __pyx_L0;

    /* "src/lxml/public-api.pxi":55
 * 
 * cdef public api int tagMatches(xmlNode* c_node, const_xmlChar* c_href, const_xmlChar* c_name) noexcept:
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         return -1
 *     return _tagMatches(c_node, c_href, c_name)
*/
  }

  /* "src/lxml/public-api.pxi":57
 *     if c_node is NULL:
 *         return -1
 *     return _tagMatches(c_node, c_href, c_name)             # <<<<<<<<<<<<<<
 * 
 * cdef public api _Document documentOrRaise(object input):
*/
  __pyx_r = __pyx_f_4lxml_5etree__tagMatches(__pyx_v_c_node, __pyx_v_c_href, __pyx_v_c_name);
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":54
 *     return _callLookupFallback(lookup, doc, c_node)
 * 
 * cdef public api int tagMatches(xmlNode* c_node, const_xmlChar* c_href, const_xmlChar* c_name) noexcept:             # <<<<<<<<<<<<<<
 *     if c_node is NULL:
 *         return -1
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/public-api.pxi":59
 *     return _tagMatches(c_node, c_href, c_name)
 * 
 * cdef public api _Document documentOrRaise(object input):             # <<<<<<<<<<<<<<
 *     return _documentOrRaise(input)
 * 
*/

struct LxmlDocument *documentOrRaise(PyObject *__pyx_v_input) {
  struct LxmlDocument *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("documentOrRaise", 0);

  /* "src/lxml/public-api.pxi":60
 * 
 * cdef public api _Document documentOrRaise(object input):
 *     return _documentOrRaise(input)             # <<<<<<<<<<<<<<
 * 
 * cdef public api _Element rootNodeOrRaise(object input):
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__documentOrRaise(__pyx_v_input)); if (unlikely(!__pyx_t_1)) __PYX_ERR(25, 60, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":59
 *     return _tagMatches(c_node, c_href, c_name)
 * 
 * cdef public api _Document documentOrRaise(object input):             # <<<<<<<<<<<<<<
 *     return _documentOrRaise(input)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.documentOrRaise", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/public-api.pxi":62
 *     return _documentOrRaise(input)
 * 
 * cdef public api _Element rootNodeOrRaise(object input):             # <<<<<<<<<<<<<<
 *     return _rootNodeOrRaise(input)
 * 
*/

struct LxmlElement *rootNodeOrRaise(PyObject *__pyx_v_input) {
  struct LxmlElement *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("rootNodeOrRaise", 0);

  /* "src/lxml/public-api.pxi":63
 * 
 * cdef public api _Element rootNodeOrRaise(object input):
 *     return _rootNodeOrRaise(input)             # <<<<<<<<<<<<<<
 * 
 * cdef public api bint hasText(xmlNode* c_node) noexcept:
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__rootNodeOrRaise(__pyx_v_input)); if (unlikely(!__pyx_t_1)) __PYX_ERR(25, 63, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":62
 *     return _documentOrRaise(input)
 * 
 * cdef public api _Element rootNodeOrRaise(object input):             # <<<<<<<<<<<<<<
 *     return _rootNodeOrRaise(input)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.rootNodeOrRaise", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/public-api.pxi":65
 *     return _rootNodeOrRaise(input)
 * 
 * cdef public api bint hasText(xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *     return _hasText(c_node)
 * 
*/

int hasText(xmlNode *__pyx_v_c_node) {
  int __pyx_r;

  /* "src/lxml/public-api.pxi":66
 * 
 * cdef public api bint hasText(xmlNode* c_node) noexcept:
 *     return _hasText(c_node)             # <<<<<<<<<<<<<<
 * 
 * cdef public api bint hasTail(xmlNode* c_node) noexcept:
*/
  __pyx_r = __pyx_f_4lxml_5etree__hasText(__pyx_v_c_node);
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":65
 *     return _rootNodeOrRaise(input)
 * 
 * cdef public api bint hasText(xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *     return _hasText(c_node)
 * 
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/public-api.pxi":68
 *     return _hasText(c_node)
 * 
 * cdef public api bint hasTail(xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *     return _hasTail(c_node)
 * 
*/

int hasTail(xmlNode *__pyx_v_c_node) {
  int __pyx_r;

  /* "src/lxml/public-api.pxi":69
 * 
 * cdef public api bint hasTail(xmlNode* c_node) noexcept:
 *     return _hasTail(c_node)             # <<<<<<<<<<<<<<
 * 
 * cdef public api unicode textOf(xmlNode* c_node):
*/
  __pyx_r = __pyx_f_4lxml_5etree__hasTail(__pyx_v_c_node);
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":68
 *     return _hasText(c_node)
 * 
 * cdef public api bint hasTail(xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *     return _hasTail(c_node)
 * 
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/public-api.pxi":71
 *     return _hasTail(c_node)
 * 
 * cdef public api unicode textOf(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     if c_node is NULL:
 *         return None
*/

PyObject *textOf(xmlNode *__pyx_v_c_node) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("textOf", 0);

  /* "src/lxml/public-api.pxi":72
 * 
 * cdef public api unicode textOf(xmlNode* c_node):
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         return None
 *     return _collectText(c_node.children)
*/
  __pyx_t_1 = (__pyx_v_c_node == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/public-api.pxi":73
 * cdef public api unicode textOf(xmlNode* c_node):
 *     if c_node is NULL:
 *         return None             # <<<<<<<<<<<<<<
 *     return _collectText(c_node.children)
 * 
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/public-api.pxi":72
 * 
 * cdef public api unicode textOf(xmlNode* c_node):
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         return None
 *     return _collectText(c_node.children)
*/
  }

  /* "src/lxml/public-api.pxi":74
 *     if c_node is NULL:
 *         return None
 *     return _collectText(c_node.children)             # <<<<<<<<<<<<<<
 * 
 * cdef public api unicode tailOf(xmlNode* c_node):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree__collectText(__pyx_v_c_node->children); if (unlikely(!__pyx_t_2)) __PYX_ERR(25, 74, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":71
 *     return _hasTail(c_node)
 * 
 * cdef public api unicode textOf(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     if c_node is NULL:
 *         return None
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.textOf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/public-api.pxi":76
 *     return _collectText(c_node.children)
 * 
 * cdef public api unicode tailOf(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     if c_node is NULL:
 *         return None
*/

PyObject *tailOf(xmlNode *__pyx_v_c_node) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("tailOf", 0);

  /* "src/lxml/public-api.pxi":77
 * 
 * cdef public api unicode tailOf(xmlNode* c_node):
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         return None
 *     return _collectText(c_node.next)
*/
  __pyx_t_1 = (__pyx_v_c_node == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/public-api.pxi":78
 * cdef public api unicode tailOf(xmlNode* c_node):
 *     if c_node is NULL:
 *         return None             # <<<<<<<<<<<<<<
 *     return _collectText(c_node.next)
 * 
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/public-api.pxi":77
 * 
 * cdef public api unicode tailOf(xmlNode* c_node):
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         return None
 *     return _collectText(c_node.next)
*/
  }

  /* "src/lxml/public-api.pxi":79
 *     if c_node is NULL:
 *         return None
 *     return _collectText(c_node.next)             # <<<<<<<<<<<<<<
 * 
 * cdef public api int setNodeText(xmlNode* c_node, text) except -1:
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree__collectText(__pyx_v_c_node->next); if (unlikely(!__pyx_t_2)) __PYX_ERR(25, 79, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":76
 *     return _collectText(c_node.children)
 * 
 * cdef public api unicode tailOf(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     if c_node is NULL:
 *         return None
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.tailOf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/public-api.pxi":81
 *     return _collectText(c_node.next)
 * 
 * cdef public api int setNodeText(xmlNode* c_node, text) except -1:             # <<<<<<<<<<<<<<
 *     if c_node is NULL:
 *         raise ValueError
*/

int setNodeText(xmlNode *__pyx_v_c_node, PyObject *__pyx_v_text) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/public-api.pxi":82
 * 
 * cdef public api int setNodeText(xmlNode* c_node, text) except -1:
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         raise ValueError
 *     return _setNodeText(c_node, text)
*/
  __pyx_t_1 = (__pyx_v_c_node == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/public-api.pxi":83
 * cdef public api int setNodeText(xmlNode* c_node, text) except -1:
 *     if c_node is NULL:
 *         raise ValueError             # <<<<<<<<<<<<<<
 *     return _setNodeText(c_node, text)
 * 
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), 0, 0, 0);
    __PYX_ERR(25, 83, __pyx_L1_error)

    /* "src/lxml/public-api.pxi":82
 * 
 * cdef public api int setNodeText(xmlNode* c_node, text) except -1:
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         raise ValueError
 *     return _setNodeText(c_node, text)
*/
  }

  /* "src/lxml/public-api.pxi":84
 *     if c_node is NULL:
 *         raise ValueError
 *     return _setNodeText(c_node, text)             # <<<<<<<<<<<<<<
 * 
 * cdef public api int setTailText(xmlNode* c_node, text) except -1:
*/
  __pyx_t_2 = __pyx_f_4lxml_5etree__setNodeText(__pyx_v_c_node, __pyx_v_text); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(25, 84, __pyx_L1_error)
  __pyx_r = __pyx_t_2;
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":81
 *     return _collectText(c_node.next)
 * 
 * cdef public api int setNodeText(xmlNode* c_node, text) except -1:             # <<<<<<<<<<<<<<
 *     if c_node is NULL:
 *         raise ValueError
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.setNodeText", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/public-api.pxi":86
 *     return _setNodeText(c_node, text)
 * 
 * cdef public api int setTailText(xmlNode* c_node, text) except -1:             # <<<<<<<<<<<<<<
 *     if c_node is NULL:
 *         raise ValueError
*/

int setTailText(xmlNode *__pyx_v_c_node, PyObject *__pyx_v_text) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/public-api.pxi":87
 * 
 * cdef public api int setTailText(xmlNode* c_node, text) except -1:
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         raise ValueError
 *     return _setTailText(c_node, text)
*/
  __pyx_t_1 = (__pyx_v_c_node == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/public-api.pxi":88
 * cdef public api int setTailText(xmlNode* c_node, text) except -1:
 *     if c_node is NULL:
 *         raise ValueError             # <<<<<<<<<<<<<<
 *     return _setTailText(c_node, text)
 * 
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), 0, 0, 0);
    __PYX_ERR(25, 88, __pyx_L1_error)

    /* "src/lxml/public-api.pxi":87
 * 
 * cdef public api int setTailText(xmlNode* c_node, text) except -1:
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         raise ValueError
 *     return _setTailText(c_node, text)
*/
  }

  /* "src/lxml/public-api.pxi":89
 *     if c_node is NULL:
 *         raise ValueError
 *     return _setTailText(c_node, text)             # <<<<<<<<<<<<<<
 * 
 * cdef public api unicode attributeValue(xmlNode* c_element, xmlAttr* c_attrib_node):
*/
  __pyx_t_2 = __pyx_f_4lxml_5etree__setTailText(__pyx_v_c_node, __pyx_v_text); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(25, 89, __pyx_L1_error)
  __pyx_r = __pyx_t_2;
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":86
 *     return _setNodeText(c_node, text)
 * 
 * cdef public api int setTailText(xmlNode* c_node, text) except -1:             # <<<<<<<<<<<<<<
 *     if c_node is NULL:
 *         raise ValueError
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.setTailText", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/public-api.pxi":91
 *     return _setTailText(c_node, text)
 * 
 * cdef public api unicode attributeValue(xmlNode* c_element, xmlAttr* c_attrib_node):             # <<<<<<<<<<<<<<
 *     return _attributeValue(c_element, c_attrib_node)
 * 
*/

PyObject *attributeValue(xmlNode *__pyx_v_c_element, xmlAttr *__pyx_v_c_attrib_node) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("attributeValue", 0);

  /* "src/lxml/public-api.pxi":92
 * 
 * cdef public api unicode attributeValue(xmlNode* c_element, xmlAttr* c_attrib_node):
 *     return _attributeValue(c_element, c_attrib_node)             # <<<<<<<<<<<<<<
 * 
 * cdef public api unicode attributeValueFromNsName(xmlNode* c_element,
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree__attributeValue(__pyx_v_c_element, __pyx_v_c_attrib_node); if (unlikely(!__pyx_t_1)) __PYX_ERR(25, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":91
 *     return _setTailText(c_node, text)
 * 
 * cdef public api unicode attributeValue(xmlNode* c_element, xmlAttr* c_attrib_node):             # <<<<<<<<<<<<<<
 *     return _attributeValue(c_element, c_attrib_node)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.attributeValue", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/public-api.pxi":94
 *     return _attributeValue(c_element, c_attrib_node)
 * 
 * cdef public api unicode attributeValueFromNsName(xmlNode* c_element,             # <<<<<<<<<<<<<<
 *                                                 const_xmlChar* ns, const_xmlChar* name):
 *     return _attributeValueFromNsName(c_element, ns, name)
*/

PyObject *attributeValueFromNsName(xmlNode *__pyx_v_c_element, const xmlChar *__pyx_v_ns, const xmlChar *__pyx_v_name) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("attributeValueFromNsName", 0);

  /* "src/lxml/public-api.pxi":96
 * cdef public api unicode attributeValueFromNsName(xmlNode* c_element,
 *                                                 const_xmlChar* ns, const_xmlChar* name):
 *     return _attributeValueFromNsName(c_element, ns, name)             # <<<<<<<<<<<<<<
 * 
 * cdef public api object getAttributeValue(_Element element, key, default):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree__attributeValueFromNsName(__pyx_v_c_element, __pyx_v_ns, __pyx_v_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(25, 96, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":94
 *     return _attributeValue(c_element, c_attrib_node)
 * 
 * cdef public api unicode attributeValueFromNsName(xmlNode* c_element,             # <<<<<<<<<<<<<<
 *                                                 const_xmlChar* ns, const_xmlChar* name):
 *     return _attributeValueFromNsName(c_element, ns, name)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.attributeValueFromNsName", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/public-api.pxi":98
 *     return _attributeValueFromNsName(c_element, ns, name)
 * 
 * cdef public api object getAttributeValue(_Element element, key, default):             # <<<<<<<<<<<<<<
 *     _assertValidNode(element)
 *     return _getAttributeValue(element, key, default)
*/

PyObject *getAttributeValue(struct LxmlElement *__pyx_v_element, PyObject *__pyx_v_key, PyObject *__pyx_v_default) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getAttributeValue", 0);

  /* "src/lxml/public-api.pxi":99
 * 
 * cdef public api object getAttributeValue(_Element element, key, default):
 *     _assertValidNode(element)             # <<<<<<<<<<<<<<
 *     return _getAttributeValue(element, key, default)
 * 
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_element); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(25, 99, __pyx_L1_error)

  /* "src/lxml/public-api.pxi":100
 * cdef public api object getAttributeValue(_Element element, key, default):
 *     _assertValidNode(element)
 *     return _getAttributeValue(element, key, default)             # <<<<<<<<<<<<<<
 * 
 * cdef public api object iterattributes(_Element element, int keysvalues):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree__getAttributeValue(__pyx_v_element, __pyx_v_key, __pyx_v_default); if (unlikely(!__pyx_t_2)) __PYX_ERR(25, 100, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":98
 *     return _attributeValueFromNsName(c_element, ns, name)
 * 
 * cdef public api object getAttributeValue(_Element element, key, default):             # <<<<<<<<<<<<<<
 *     _assertValidNode(element)
 *     return _getAttributeValue(element, key, default)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.getAttributeValue", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/public-api.pxi":102
 *     return _getAttributeValue(element, key, default)
 * 
 * cdef public api object iterattributes(_Element element, int keysvalues):             # <<<<<<<<<<<<<<
 *     _assertValidNode(element)
 *     return _attributeIteratorFactory(element, keysvalues)
*/

PyObject *iterattributes(struct LxmlElement *__pyx_v_element, int __pyx_v_keysvalues) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("iterattributes", 0);

  /* "src/lxml/public-api.pxi":103
 * 
 * cdef public api object iterattributes(_Element element, int keysvalues):
 *     _assertValidNode(element)             # <<<<<<<<<<<<<<
 *     return _attributeIteratorFactory(element, keysvalues)
 * 
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_element); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(25, 103, __pyx_L1_error)

  /* "src/lxml/public-api.pxi":104
 * cdef public api object iterattributes(_Element element, int keysvalues):
 *     _assertValidNode(element)
 *     return _attributeIteratorFactory(element, keysvalues)             # <<<<<<<<<<<<<<
 * 
 * cdef public api list collectAttributes(xmlNode* c_element, int keysvalues):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree__attributeIteratorFactory(__pyx_v_element, __pyx_v_keysvalues); if (unlikely(!__pyx_t_2)) __PYX_ERR(25, 104, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":102
 *     return _getAttributeValue(element, key, default)
 * 
 * cdef public api object iterattributes(_Element element, int keysvalues):             # <<<<<<<<<<<<<<
 *     _assertValidNode(element)
 *     return _attributeIteratorFactory(element, keysvalues)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.iterattributes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/public-api.pxi":106
 *     return _attributeIteratorFactory(element, keysvalues)
 * 
 * cdef public api list collectAttributes(xmlNode* c_element, int keysvalues):             # <<<<<<<<<<<<<<
 *     return _collectAttributes(c_element, keysvalues)
 * 
*/

PyObject *collectAttributes(xmlNode *__pyx_v_c_element, int __pyx_v_keysvalues) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("collectAttributes", 0);

  /* "src/lxml/public-api.pxi":107
 * 
 * cdef public api list collectAttributes(xmlNode* c_element, int keysvalues):
 *     return _collectAttributes(c_element, keysvalues)             # <<<<<<<<<<<<<<
 * 
 * cdef public api int setAttributeValue(_Element element, key, value) except -1:
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree__collectAttributes(__pyx_v_c_element, __pyx_v_keysvalues); if (unlikely(!__pyx_t_1)) __PYX_ERR(25, 107, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":106
 *     return _attributeIteratorFactory(element, keysvalues)
 * 
 * cdef public api list collectAttributes(xmlNode* c_element, int keysvalues):             # <<<<<<<<<<<<<<
 *     return _collectAttributes(c_element, keysvalues)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.collectAttributes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/public-api.pxi":109
 *     return _collectAttributes(c_element, keysvalues)
 * 
 * cdef public api int setAttributeValue(_Element element, key, value) except -1:             # <<<<<<<<<<<<<<
 *     _assertValidNode(element)
 *     return _setAttributeValue(element, key, value)
*/

int setAttributeValue(struct LxmlElement *__pyx_v_element, PyObject *__pyx_v_key, PyObject *__pyx_v_value) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/public-api.pxi":110
 * 
 * cdef public api int setAttributeValue(_Element element, key, value) except -1:
 *     _assertValidNode(element)             # <<<<<<<<<<<<<<
 *     return _setAttributeValue(element, key, value)
 * 
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_element); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(25, 110, __pyx_L1_error)

  /* "src/lxml/public-api.pxi":111
 * cdef public api int setAttributeValue(_Element element, key, value) except -1:
 *     _assertValidNode(element)
 *     return _setAttributeValue(element, key, value)             # <<<<<<<<<<<<<<
 * 
 * cdef public api int delAttribute(_Element element, key) except -1:
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__setAttributeValue(__pyx_v_element, __pyx_v_key, __pyx_v_value); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(25, 111, __pyx_L1_error)
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":109
 *     return _collectAttributes(c_element, keysvalues)
 * 
 * cdef public api int setAttributeValue(_Element element, key, value) except -1:             # <<<<<<<<<<<<<<
 *     _assertValidNode(element)
 *     return _setAttributeValue(element, key, value)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.setAttributeValue", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/public-api.pxi":113
 *     return _setAttributeValue(element, key, value)
 * 
 * cdef public api int delAttribute(_Element element, key) except -1:             # <<<<<<<<<<<<<<
 *     _assertValidNode(element)
 *     return _delAttribute(element, key)
*/

int delAttribute(struct LxmlElement *__pyx_v_element, PyObject *__pyx_v_key) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/public-api.pxi":114
 * 
 * cdef public api int delAttribute(_Element element, key) except -1:
 *     _assertValidNode(element)             # <<<<<<<<<<<<<<
 *     return _delAttribute(element, key)
 * 
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_element); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(25, 114, __pyx_L1_error)

  /* "src/lxml/public-api.pxi":115
 * cdef public api int delAttribute(_Element element, key) except -1:
 *     _assertValidNode(element)
 *     return _delAttribute(element, key)             # <<<<<<<<<<<<<<
 * 
 * cdef public api int delAttributeFromNsName(tree.xmlNode* c_element,
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__delAttribute(__pyx_v_element, __pyx_v_key); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(25, 115, __pyx_L1_error)
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":113
 *     return _setAttributeValue(element, key, value)
 * 
 * cdef public api int delAttribute(_Element element, key) except -1:             # <<<<<<<<<<<<<<
 *     _assertValidNode(element)
 *     return _delAttribute(element, key)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.delAttribute", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/public-api.pxi":117
 *     return _delAttribute(element, key)
 * 
 * cdef public api int delAttributeFromNsName(tree.xmlNode* c_element,             # <<<<<<<<<<<<<<
 *                                            const_xmlChar* c_href, const_xmlChar* c_name) noexcept:
 *     return _delAttributeFromNsName(c_element, c_href, c_name)
*/

int delAttributeFromNsName(xmlNode *__pyx_v_c_element, const xmlChar *__pyx_v_c_href, const xmlChar *__pyx_v_c_name) {
  int __pyx_r;

  /* "src/lxml/public-api.pxi":119
 * cdef public api int delAttributeFromNsName(tree.xmlNode* c_element,
 *                                            const_xmlChar* c_href, const_xmlChar* c_name) noexcept:
 *     return _delAttributeFromNsName(c_element, c_href, c_name)             # <<<<<<<<<<<<<<
 * 
 * cdef public api bint hasChild(xmlNode* c_node) noexcept:
*/
  __pyx_r = __pyx_f_4lxml_5etree__delAttributeFromNsName(__pyx_v_c_element, __pyx_v_c_href, __pyx_v_c_name);
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":117
 *     return _delAttribute(element, key)
 * 
 * cdef public api int delAttributeFromNsName(tree.xmlNode* c_element,             # <<<<<<<<<<<<<<
 *                                            const_xmlChar* c_href, const_xmlChar* c_name) noexcept:
 *     return _delAttributeFromNsName(c_element, c_href, c_name)
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/public-api.pxi":121
 *     return _delAttributeFromNsName(c_element, c_href, c_name)
 * 
 * cdef public api bint hasChild(xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *     return _hasChild(c_node)
 * 
*/

int hasChild(xmlNode *__pyx_v_c_node) {
  int __pyx_r;

  /* "src/lxml/public-api.pxi":122
 * 
 * cdef public api bint hasChild(xmlNode* c_node) noexcept:
 *     return _hasChild(c_node)             # <<<<<<<<<<<<<<
 * 
 * cdef public api xmlNode* findChild(xmlNode* c_node, Py_ssize_t index) noexcept:
*/
  __pyx_r = __pyx_f_4lxml_5etree__hasChild(__pyx_v_c_node);
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":121
 *     return _delAttributeFromNsName(c_element, c_href, c_name)
 * 
 * cdef public api bint hasChild(xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *     return _hasChild(c_node)
 * 
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/public-api.pxi":124
 *     return _hasChild(c_node)
 * 
 * cdef public api xmlNode* findChild(xmlNode* c_node, Py_ssize_t index) noexcept:             # <<<<<<<<<<<<<<
 *     return _findChild(c_node, index)
 * 
*/

xmlNode *findChild(xmlNode *__pyx_v_c_node, Py_ssize_t __pyx_v_index) {
  xmlNode *__pyx_r;

  /* "src/lxml/public-api.pxi":125
 * 
 * cdef public api xmlNode* findChild(xmlNode* c_node, Py_ssize_t index) noexcept:
 *     return _findChild(c_node, index)             # <<<<<<<<<<<<<<
 * 
 * cdef public api xmlNode* findChildForwards(xmlNode* c_node, Py_ssize_t index) noexcept:
*/
  __pyx_r = __pyx_f_4lxml_5etree__findChild(__pyx_v_c_node, __pyx_v_index);
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":124
 *     return _hasChild(c_node)
 * 
 * cdef public api xmlNode* findChild(xmlNode* c_node, Py_ssize_t index) noexcept:             # <<<<<<<<<<<<<<
 *     return _findChild(c_node, index)
 * 
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/public-api.pxi":127
 *     return _findChild(c_node, index)
 * 
 * cdef public api xmlNode* findChildForwards(xmlNode* c_node, Py_ssize_t index) noexcept:             # <<<<<<<<<<<<<<
 *     return _findChildForwards(c_node, index)
 * 
*/

xmlNode *findChildForwards(xmlNode *__pyx_v_c_node, Py_ssize_t __pyx_v_index) {
  xmlNode *__pyx_r;

  /* "src/lxml/public-api.pxi":128
 * 
 * cdef public api xmlNode* findChildForwards(xmlNode* c_node, Py_ssize_t index) noexcept:
 *     return _findChildForwards(c_node, index)             # <<<<<<<<<<<<<<
 * 
 * cdef public api xmlNode* findChildBackwards(xmlNode* c_node, Py_ssize_t index) noexcept:
*/
  __pyx_r = __pyx_f_4lxml_5etree__findChildForwards(__pyx_v_c_node, __pyx_v_index);
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":127
 *     return _findChild(c_node, index)
 * 
 * cdef public api xmlNode* findChildForwards(xmlNode* c_node, Py_ssize_t index) noexcept:             # <<<<<<<<<<<<<<
 *     return _findChildForwards(c_node, index)
 * 
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/public-api.pxi":130
 *     return _findChildForwards(c_node, index)
 * 
 * cdef public api xmlNode* findChildBackwards(xmlNode* c_node, Py_ssize_t index) noexcept:             # <<<<<<<<<<<<<<
 *     return _findChildBackwards(c_node, index)
 * 
*/

xmlNode *findChildBackwards(xmlNode *__pyx_v_c_node, Py_ssize_t __pyx_v_index) {
  xmlNode *__pyx_r;

  /* "src/lxml/public-api.pxi":131
 * 
 * cdef public api xmlNode* findChildBackwards(xmlNode* c_node, Py_ssize_t index) noexcept:
 *     return _findChildBackwards(c_node, index)             # <<<<<<<<<<<<<<
 * 
 * cdef public api xmlNode* nextElement(xmlNode* c_node) noexcept:
*/
  __pyx_r = __pyx_f_4lxml_5etree__findChildBackwards(__pyx_v_c_node, __pyx_v_index);
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":130
 *     return _findChildForwards(c_node, index)
 * 
 * cdef public api xmlNode* findChildBackwards(xmlNode* c_node, Py_ssize_t index) noexcept:             # <<<<<<<<<<<<<<
 *     return _findChildBackwards(c_node, index)
 * 
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/public-api.pxi":133
 *     return _findChildBackwards(c_node, index)
 * 
 * cdef public api xmlNode* nextElement(xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *     return _nextElement(c_node)
 * 
*/

xmlNode *nextElement(xmlNode *__pyx_v_c_node) {
  xmlNode *__pyx_r;

  /* "src/lxml/public-api.pxi":134
 * 
 * cdef public api xmlNode* nextElement(xmlNode* c_node) noexcept:
 *     return _nextElement(c_node)             # <<<<<<<<<<<<<<
 * 
 * cdef public api xmlNode* previousElement(xmlNode* c_node) noexcept:
*/
  __pyx_r = __pyx_f_4lxml_5etree__nextElement(__pyx_v_c_node);
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":133
 *     return _findChildBackwards(c_node, index)
 * 
 * cdef public api xmlNode* nextElement(xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *     return _nextElement(c_node)
 * 
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/public-api.pxi":136
 *     return _nextElement(c_node)
 * 
 * cdef public api xmlNode* previousElement(xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *     return _previousElement(c_node)
 * 
*/

xmlNode *previousElement(xmlNode *__pyx_v_c_node) {
  xmlNode *__pyx_r;

  /* "src/lxml/public-api.pxi":137
 * 
 * cdef public api xmlNode* previousElement(xmlNode* c_node) noexcept:
 *     return _previousElement(c_node)             # <<<<<<<<<<<<<<
 * 
 * cdef public api void appendChild(_Element parent, _Element child):
*/
  __pyx_r = __pyx_f_4lxml_5etree__previousElement(__pyx_v_c_node);
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":136
 *     return _nextElement(c_node)
 * 
 * cdef public api xmlNode* previousElement(xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *     return _previousElement(c_node)
 * 
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/public-api.pxi":139
 *     return _previousElement(c_node)
 * 
 * cdef public api void appendChild(_Element parent, _Element child):             # <<<<<<<<<<<<<<
 *     # deprecated, use appendChildToElement() instead!
 *     _appendChild(parent, child)
*/

void appendChild(struct LxmlElement *__pyx_v_parent, struct LxmlElement *__pyx_v_child) {
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/public-api.pxi":141
 * cdef public api void appendChild(_Element parent, _Element child):
 *     # deprecated, use appendChildToElement() instead!
 *     _appendChild(parent, child)             # <<<<<<<<<<<<<<
 * 
 * cdef public api int appendChildToElement(_Element parent, _Element child) except -1:
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__appendChild(__pyx_v_parent, __pyx_v_child); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(25, 141, __pyx_L1_error)

  /* "src/lxml/public-api.pxi":139
 *     return _previousElement(c_node)
 * 
 * cdef public api void appendChild(_Element parent, _Element child):             # <<<<<<<<<<<<<<
 *     # deprecated, use appendChildToElement() instead!
 *     _appendChild(parent, child)
*/

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.appendChild", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
}

/* "src/lxml/public-api.pxi":143
 *     _appendChild(parent, child)
 * 
 * cdef public api int appendChildToElement(_Element parent, _Element child) except -1:             # <<<<<<<<<<<<<<
 *     return _appendChild(parent, child)
 * 
*/

int appendChildToElement(struct LxmlElement *__pyx_v_parent, struct LxmlElement *__pyx_v_child) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/public-api.pxi":144
 * 
 * cdef public api int appendChildToElement(_Element parent, _Element child) except -1:
 *     return _appendChild(parent, child)             # <<<<<<<<<<<<<<
 * 
 * cdef public api unicode pyunicode(const_xmlChar* s):
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree__appendChild(__pyx_v_parent, __pyx_v_child); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(25, 144, __pyx_L1_error)
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":143
 *     _appendChild(parent, child)
 * 
 * cdef public api int appendChildToElement(_Element parent, _Element child) except -1:             # <<<<<<<<<<<<<<
 *     return _appendChild(parent, child)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.appendChildToElement", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/public-api.pxi":146
 *     return _appendChild(parent, child)
 * 
 * cdef public api unicode pyunicode(const_xmlChar* s):             # <<<<<<<<<<<<<<
 *     if s is NULL:
 *         raise TypeError
*/

PyObject *pyunicode(const xmlChar *__pyx_v_s) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("pyunicode", 0);

  /* "src/lxml/public-api.pxi":147
 * 
 * cdef public api unicode pyunicode(const_xmlChar* s):
 *     if s is NULL:             # <<<<<<<<<<<<<<
 *         raise TypeError
 *     return funicode(s)
*/
  __pyx_t_1 = (__pyx_v_s == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/public-api.pxi":148
 * cdef public api unicode pyunicode(const_xmlChar* s):
 *     if s is NULL:
 *         raise TypeError             # <<<<<<<<<<<<<<
 *     return funicode(s)
 * 
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), 0, 0, 0);
    __PYX_ERR(25, 148, __pyx_L1_error)

    /* "src/lxml/public-api.pxi":147
 * 
 * cdef public api unicode pyunicode(const_xmlChar* s):
 *     if s is NULL:             # <<<<<<<<<<<<<<
 *         raise TypeError
 *     return funicode(s)
*/
  }

  /* "src/lxml/public-api.pxi":149
 *     if s is NULL:
 *         raise TypeError
 *     return funicode(s)             # <<<<<<<<<<<<<<
 * 
 * cdef public api bytes utf8(object s):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_s); if (unlikely(!__pyx_t_2)) __PYX_ERR(25, 149, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":146
 *     return _appendChild(parent, child)
 * 
 * cdef public api unicode pyunicode(const_xmlChar* s):             # <<<<<<<<<<<<<<
 *     if s is NULL:
 *         raise TypeError
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.pyunicode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/public-api.pxi":151
 *     return funicode(s)
 * 
 * cdef public api bytes utf8(object s):             # <<<<<<<<<<<<<<
 *     return _utf8(s)
 * 
*/

PyObject *utf8(PyObject *__pyx_v_s) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("utf8", 0);

  /* "src/lxml/public-api.pxi":152
 * 
 * cdef public api bytes utf8(object s):
 *     return _utf8(s)             # <<<<<<<<<<<<<<
 * 
 * cdef public api tuple getNsTag(object tag):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree__utf8(__pyx_v_s); if (unlikely(!__pyx_t_1)) __PYX_ERR(25, 152, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":151
 *     return funicode(s)
 * 
 * cdef public api bytes utf8(object s):             # <<<<<<<<<<<<<<
 *     return _utf8(s)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.utf8", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/public-api.pxi":154
 *     return _utf8(s)
 * 
 * cdef public api tuple getNsTag(object tag):             # <<<<<<<<<<<<<<
 *     return _getNsTag(tag)
 * 
*/

PyObject *getNsTag(PyObject *__pyx_v_tag) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getNsTag", 0);

  /* "src/lxml/public-api.pxi":155
 * 
 * cdef public api tuple getNsTag(object tag):
 *     return _getNsTag(tag)             # <<<<<<<<<<<<<<
 * 
 * cdef public api tuple getNsTagWithEmptyNs(object tag):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree__getNsTag(__pyx_v_tag); if (unlikely(!__pyx_t_1)) __PYX_ERR(25, 155, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":154
 *     return _utf8(s)
 * 
 * cdef public api tuple getNsTag(object tag):             # <<<<<<<<<<<<<<
 *     return _getNsTag(tag)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.getNsTag", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/public-api.pxi":157
 *     return _getNsTag(tag)
 * 
 * cdef public api tuple getNsTagWithEmptyNs(object tag):             # <<<<<<<<<<<<<<
 *     return _getNsTagWithEmptyNs(tag)
 * 
*/

PyObject *getNsTagWithEmptyNs(PyObject *__pyx_v_tag) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getNsTagWithEmptyNs", 0);

  /* "src/lxml/public-api.pxi":158
 * 
 * cdef public api tuple getNsTagWithEmptyNs(object tag):
 *     return _getNsTagWithEmptyNs(tag)             # <<<<<<<<<<<<<<
 * 
 * cdef public api unicode namespacedName(xmlNode* c_node):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree__getNsTagWithEmptyNs(__pyx_v_tag); if (unlikely(!__pyx_t_1)) __PYX_ERR(25, 158, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":157
 *     return _getNsTag(tag)
 * 
 * cdef public api tuple getNsTagWithEmptyNs(object tag):             # <<<<<<<<<<<<<<
 *     return _getNsTagWithEmptyNs(tag)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.getNsTagWithEmptyNs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/public-api.pxi":160
 *     return _getNsTagWithEmptyNs(tag)
 * 
 * cdef public api unicode namespacedName(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     return _namespacedName(c_node)
 * 
*/

PyObject *namespacedName(xmlNode *__pyx_v_c_node) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("namespacedName", 0);

  /* "src/lxml/public-api.pxi":161
 * 
 * cdef public api unicode namespacedName(xmlNode* c_node):
 *     return _namespacedName(c_node)             # <<<<<<<<<<<<<<
 * 
 * cdef public api unicode namespacedNameFromNsName(const_xmlChar* href, const_xmlChar* name):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree__namespacedName(__pyx_v_c_node); if (unlikely(!__pyx_t_1)) __PYX_ERR(25, 161, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":160
 *     return _getNsTagWithEmptyNs(tag)
 * 
 * cdef public api unicode namespacedName(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     return _namespacedName(c_node)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.namespacedName", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/public-api.pxi":163
 *     return _namespacedName(c_node)
 * 
 * cdef public api unicode namespacedNameFromNsName(const_xmlChar* href, const_xmlChar* name):             # <<<<<<<<<<<<<<
 *     return _namespacedNameFromNsName(href, name)
 * 
*/

PyObject *namespacedNameFromNsName(const xmlChar *__pyx_v_href, const xmlChar *__pyx_v_name) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("namespacedNameFromNsName", 0);

  /* "src/lxml/public-api.pxi":164
 * 
 * cdef public api unicode namespacedNameFromNsName(const_xmlChar* href, const_xmlChar* name):
 *     return _namespacedNameFromNsName(href, name)             # <<<<<<<<<<<<<<
 * 
 * cdef public api void iteratorStoreNext(_ElementIterator iterator, _Element node):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree__namespacedNameFromNsName(__pyx_v_href, __pyx_v_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(25, 164, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":163
 *     return _namespacedName(c_node)
 * 
 * cdef public api unicode namespacedNameFromNsName(const_xmlChar* href, const_xmlChar* name):             # <<<<<<<<<<<<<<
 *     return _namespacedNameFromNsName(href, name)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.namespacedNameFromNsName", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/public-api.pxi":166
 *     return _namespacedNameFromNsName(href, name)
 * 
 * cdef public api void iteratorStoreNext(_ElementIterator iterator, _Element node):             # <<<<<<<<<<<<<<
 *     # deprecated!
 *     iterator._storeNext(node)
*/

void iteratorStoreNext(struct LxmlElementIterator *__pyx_v_iterator, struct LxmlElement *__pyx_v_node) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/public-api.pxi":168
 * cdef public api void iteratorStoreNext(_ElementIterator iterator, _Element node):
 *     # deprecated!
 *     iterator._storeNext(node)             # <<<<<<<<<<<<<<
 * 
 * cdef public api void initTagMatch(_ElementTagMatcher matcher, tag):
*/
  ((struct __pyx_vtabstruct_4lxml_5etree__ElementIterator *)__pyx_v_iterator->__pyx_base.__pyx_vtab)->_storeNext(__pyx_v_iterator, __pyx_v_node); if (unlikely(PyErr_Occurred())) __PYX_ERR(25, 168, __pyx_L1_error)

  /* "src/lxml/public-api.pxi":166
 *     return _namespacedNameFromNsName(href, name)
 * 
 * cdef public api void iteratorStoreNext(_ElementIterator iterator, _Element node):             # <<<<<<<<<<<<<<
 *     # deprecated!
 *     iterator._storeNext(node)
*/

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.iteratorStoreNext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
}

/* "src/lxml/public-api.pxi":170
 *     iterator._storeNext(node)
 * 
 * cdef public api void initTagMatch(_ElementTagMatcher matcher, tag):             # <<<<<<<<<<<<<<
 *     # deprecated!
 *     matcher._initTagMatch(tag)
*/

void initTagMatch(struct LxmlElementTagMatcher *__pyx_v_matcher, PyObject *__pyx_v_tag) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("initTagMatch", 0);

  /* "src/lxml/public-api.pxi":172
 * cdef public api void initTagMatch(_ElementTagMatcher matcher, tag):
 *     # deprecated!
 *     matcher._initTagMatch(tag)             # <<<<<<<<<<<<<<
 * 
 * cdef public api tree.xmlNs* findOrBuildNodeNsPrefix(
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ElementTagMatcher *)__pyx_v_matcher->__pyx_vtab)->_initTagMatch(__pyx_v_matcher, __pyx_v_tag); if (unlikely(!__pyx_t_1)) __PYX_ERR(25, 172, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/public-api.pxi":170
 *     iterator._storeNext(node)
 * 
 * cdef public api void initTagMatch(_ElementTagMatcher matcher, tag):             # <<<<<<<<<<<<<<
 *     # deprecated!
 *     matcher._initTagMatch(tag)
*/

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.initTagMatch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "src/lxml/public-api.pxi":174
 *     matcher._initTagMatch(tag)
 * 
 * cdef public api tree.xmlNs* findOrBuildNodeNsPrefix(             # <<<<<<<<<<<<<<
 *         _Document doc, xmlNode* c_node, const_xmlChar* href, const_xmlChar* prefix) except NULL:
 *     if doc is None:
*/

xmlNs *findOrBuildNodeNsPrefix(struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_node, const xmlChar *__pyx_v_href, const xmlChar *__pyx_v_prefix) {
  xmlNs *__pyx_r;
  int __pyx_t_1;
  xmlNs *__pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/public-api.pxi":176
 * cdef public api tree.xmlNs* findOrBuildNodeNsPrefix(
 *         _Document doc, xmlNode* c_node, const_xmlChar* href, const_xmlChar* prefix) except NULL:
 *     if doc is None:             # <<<<<<<<<<<<<<
 *         raise TypeError
 *     return doc._findOrBuildNodeNs(c_node, href, prefix, 0)
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_doc) == Py_None);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/public-api.pxi":177
 *         _Document doc, xmlNode* c_node, const_xmlChar* href, const_xmlChar* prefix) except NULL:
 *     if doc is None:
 *         raise TypeError             # <<<<<<<<<<<<<<
 *     return doc._findOrBuildNodeNs(c_node, href, prefix, 0)
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), 0, 0, 0);
    __PYX_ERR(25, 177, __pyx_L1_error)

    /* "src/lxml/public-api.pxi":176
 * cdef public api tree.xmlNs* findOrBuildNodeNsPrefix(
 *         _Document doc, xmlNode* c_node, const_xmlChar* href, const_xmlChar* prefix) except NULL:
 *     if doc is None:             # <<<<<<<<<<<<<<
 *         raise TypeError
 *     return doc._findOrBuildNodeNs(c_node, href, prefix, 0)
*/
  }

  /* "src/lxml/public-api.pxi":178
 *     if doc is None:
 *         raise TypeError
 *     return doc._findOrBuildNodeNs(c_node, href, prefix, 0)             # <<<<<<<<<<<<<<
*/
  __pyx_t_2 = __pyx_f_4lxml_5etree_9_Document__findOrBuildNodeNs(__pyx_v_doc, __pyx_v_c_node, __pyx_v_href, __pyx_v_prefix, 0); if (unlikely(__pyx_t_2 == ((void *)NULL))) __PYX_ERR(25, 178, __pyx_L1_error)
  __pyx_r = __pyx_t_2;
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":174
 *     matcher._initTagMatch(tag)
 * 
 * cdef public api tree.xmlNs* findOrBuildNodeNsPrefix(             # <<<<<<<<<<<<<<
 *         _Document doc, xmlNode* c_node, const_xmlChar* href, const_xmlChar* prefix) except NULL:
 *     if doc is None:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.findOrBuildNodeNsPrefix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/debug.pxi":6
 *     """Debugging support for the memory allocation in libxml2.
 *     """
 *     def bytes_used(self):             # <<<<<<<<<<<<<<
 *         """bytes_used(self)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9_MemDebug_1bytes_used(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_9_MemDebug_bytes_used, "bytes_used(self)\n\n        Returns the total amount of memory (in bytes) currently used by libxml2.\n        Note that libxml2 constrains this value to a C int, which limits\n        the accuracy on 64 bit systems.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_9_MemDebug_1bytes_used = {"bytes_used", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_9_MemDebug_1bytes_used, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_9_MemDebug_bytes_used};
static PyObject *__pyx_pw_4lxml_5etree_9_MemDebug_1bytes_used(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bytes_used (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("bytes_used", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("bytes_used", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_9_MemDebug_bytes_used(((struct __pyx_obj_4lxml_5etree__MemDebug *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_9_MemDebug_bytes_used(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__MemDebug *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("bytes_used", 0);

  /* "src/lxml/debug.pxi":13
 *         the accuracy on 64 bit systems.
 *         """
 *         return tree.xmlMemUsed()             # <<<<<<<<<<<<<<
 * 
 *     def blocks_used(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_From_int(xmlMemUsed()); if (unlikely(!__pyx_t_1)) __PYX_ERR(26, 13, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/debug.pxi":6
 *     """Debugging support for the memory allocation in libxml2.
 *     """
 *     def bytes_used(self):             # <<<<<<<<<<<<<<
 *         """bytes_used(self)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._MemDebug.bytes_used", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/debug.pxi":15
 *         return tree.xmlMemUsed()
 * 
 *     def blocks_used(self):             # <<<<<<<<<<<<<<
 *         """blocks_used(self)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9_MemDebug_3blocks_used(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_9_MemDebug_2blocks_used, "blocks_used(self)\n\n        Returns the total number of memory blocks currently allocated by libxml2.\n        Note that libxml2 constrains this value to a C int, which limits\n        the accuracy on 64 bit systems.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_9_MemDebug_3blocks_used = {"blocks_used", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_9_MemDebug_3blocks_used, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_9_MemDebug_2blocks_used};
static PyObject *__pyx_pw_4lxml_5etree_9_MemDebug_3blocks_used(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("blocks_used (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("blocks_used", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("blocks_used", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_9_MemDebug_2blocks_used(((struct __pyx_obj_4lxml_5etree__MemDebug *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_9_MemDebug_2blocks_used(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__MemDebug *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("blocks_used", 0);

  /* "src/lxml/debug.pxi":22
 *         the accuracy on 64 bit systems.
 *         """
 *         return tree.xmlMemBlocks()             # <<<<<<<<<<<<<<
 * 
 *     def dict_size(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_From_int(xmlMemBlocks()); if (unlikely(!__pyx_t_1)) __PYX_ERR(26, 22, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/debug.pxi":15
 *         return tree.xmlMemUsed()
 * 
 *     def blocks_used(self):             # <<<<<<<<<<<<<<
 *         """blocks_used(self)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._MemDebug.blocks_used", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/debug.pxi":24
 *         return tree.xmlMemBlocks()
 * 
 *     def dict_size(self):             # <<<<<<<<<<<<<<
 *         """dict_size(self)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9_MemDebug_5dict_size(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_9_MemDebug_4dict_size, "dict_size(self)\n\n        Returns the current size of the global name dictionary used by libxml2\n        for the current thread.  Each thread has its own dictionary.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_9_MemDebug_5dict_size = {"dict_size", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_9_MemDebug_5dict_size, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_9_MemDebug_4dict_size};
static PyObject *__pyx_pw_4lxml_5etree_9_MemDebug_5dict_size(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("dict_size (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("dict_size", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("dict_size", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4lxml_5etree_9_MemDebug_4dict_size(((struct __pyx_obj_4lxml_5etree__MemDebug *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_9_MemDebug_4dict_size(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__MemDebug *__pyx_v_self) {
  xmlDict *__pyx_v_c_dict;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  xmlDict *__pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("dict_size", 0);

  /* "src/lxml/debug.pxi":30
 *         for the current thread.  Each thread has its own dictionary.
 *         """
 *         c_dict = __GLOBAL_PARSER_CONTEXT._getThreadDict(NULL)             # <<<<<<<<<<<<<<
 *         if c_dict is NULL:
 *             raise MemoryError()
*/
  __pyx_t_1 = __pyx_f_4lxml_5etree_24_ParserDictionaryContext__getThreadDict(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(26, 30, __pyx_L1_error)
  __pyx_v_c_dict = __pyx_t_1;

  /* "src/lxml/debug.pxi":31
 *         """
 *         c_dict = __GLOBAL_PARSER_CONTEXT._getThreadDict(NULL)
 *         if c_dict is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 *         return tree.xmlDictSize(c_dict)
*/
  __pyx_t_2 = (__pyx_v_c_dict == NULL);
  if (unlikely(__pyx_t_2)) {

    /* "src/lxml/debug.pxi":32
 *         c_dict = __GLOBAL_PARSER_CONTEXT._getThreadDict(NULL)
 *         if c_dict is NULL:
 *             raise MemoryError()             # <<<<<<<<<<<<<<
 *         return tree.xmlDictSize(c_dict)
 * 
*/
    PyErr_NoMemory(); __PYX_ERR(26, 32, __pyx_L1_error)

    /* "src/lxml/debug.pxi":31
 *         """
 *         c_dict = __GLOBAL_PARSER_CONTEXT._getThreadDict(NULL)
 *         if c_dict is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 *         return tree.xmlDictSize(c_dict)
*/
  }

  /* "src/lxml/debug.pxi":33
 *         if c_dict is NULL:
 *             raise MemoryError()
 *         return tree.xmlDictSize(c_dict)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyLong_FromSize_t(xmlDictSize(__pyx_v_c_dict)); if (unlikely(!__pyx_t_3)) __PYX_ERR(26, 33, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "src/lxml/debug.pxi":24
 *         return tree.xmlMemBlocks()
 * 
 *     def dict_size(self):             # <<<<<<<<<<<<<<
 *         """dict_size(self)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._MemDebug.dict_size", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* #### Code section: module_exttypes ### */

static PyObject *__pyx_tp_new_4lxml_5etree_Error(PyTypeObject *t, PyObject *a, PyObject *k) {
  PyObject *o = __Pyx_PyType_GetSlot((((PyTypeObject*)PyExc_Exception)), tp_new, newfunc)(t, a, k);
  if (unlikely(!o)) return 0;
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_Error(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree_Error) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  PyObject_GC_Track(o);
  __Pyx_PyType_GetSlot((((PyTypeObject*)PyExc_Exception)), tp_dealloc, destructor)(o);
}

static int __pyx_tp_traverse_4lxml_5etree_Error(PyObject *o, visitproc v, void *a) {
  int e;
  {
    traverseproc traverse = __Pyx_PyType_GetSlot((((PyTypeObject*)PyExc_Exception)), tp_traverse, traverseproc);
    if (!traverse); else { e = traverse(o,v,a); if (e) return e; }
  }
  {
    e = __Pyx_call_type_traverse(o, 0, v, a);
    if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree_Error(PyObject *o) {
  {
    inquiry clear = __Pyx_PyType_GetSlot((((PyTypeObject*)PyExc_Exception)), tp_clear, inquiry);
    if (clear) clear(o);
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_Error_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_Error},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_Error},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_Error},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_Error},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_Error_spec = {
  "lxml.etree.Error",
  sizeof(struct __pyx_obj_4lxml_5etree_Error),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_Error_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_Error = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""Error", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_Error), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_Error, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_Error, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_Error, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_Error, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyMethodDef __pyx_methods_4lxml_5etree_LxmlError[] = {
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_LxmlError_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_Error},
  {Py_tp_doc, (void *)PyDoc_STR("Main exception base class for lxml.  All other exceptions inherit from\n    this one.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_Error},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_Error},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_LxmlError},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_9LxmlError_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_Error},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_LxmlError_spec = {
  "lxml.etree.LxmlError",
  sizeof(struct __pyx_obj_4lxml_5etree_LxmlError),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_LxmlError_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_LxmlError = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""LxmlError", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_LxmlError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_Error, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("Main exception base class for lxml.  All other exceptions inherit from\n    this one.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_Error, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_Error, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_LxmlError, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_4lxml_5etree_9LxmlError_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_Error, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_C14NError_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_Error},
  {Py_tp_doc, (void *)PyDoc_STR("Error during C14N serialisation.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_Error},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_Error},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_Error},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_C14NError_spec = {
  "lxml.etree.C14NError",
  sizeof(struct __pyx_obj_4lxml_5etree_C14NError),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_C14NError_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_C14NError = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""C14NError", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_C14NError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_Error, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("Error during C14N serialisation.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_Error, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_Error, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_9LxmlError_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_Error, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__TempStore __pyx_vtable_4lxml_5etree__TempStore;

static PyObject *__pyx_tp_new_4lxml_5etree__TempStore(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree__TempStore *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 1);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__TempStore *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__TempStore;
  p->_storage = ((PyObject*)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__TempStore(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__TempStore *p = (struct __pyx_obj_4lxml_5etree__TempStore *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_storage);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_4lxml_5etree__TempStore(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__TempStore *p = (struct __pyx_obj_4lxml_5etree__TempStore *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->_storage) {
    e = (*v)(p->_storage, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__TempStore(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__TempStore *p = (struct __pyx_obj_4lxml_5etree__TempStore *)o;
  Py_CLEAR(p->_storage);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__TempStore[] = {
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__TempStore_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__TempStore},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__TempStore},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__TempStore},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__TempStore},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_10_TempStore_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__TempStore},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__TempStore_spec = {
  "lxml.etree._TempStore",
  sizeof(struct __pyx_obj_4lxml_5etree__TempStore),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__TempStore_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__TempStore = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_TempStore", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__TempStore), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__TempStore, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__TempStore, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__TempStore, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__TempStore, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_4lxml_5etree_10_TempStore_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__TempStore, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext __pyx_vtable_4lxml_5etree__ExceptionContext;

static PyObject *__pyx_tp_new_4lxml_5etree__ExceptionContext(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ExceptionContext *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ExceptionContext *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__ExceptionContext;
  p->_exc_info = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__ExceptionContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ExceptionContext *p = (struct __pyx_obj_4lxml_5etree__ExceptionContext *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree__ExceptionContext) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_exc_info);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_4lxml_5etree__ExceptionContext(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__ExceptionContext *p = (struct __pyx_obj_4lxml_5etree__ExceptionContext *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->_exc_info) {
    e = (*v)(p->_exc_info, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__ExceptionContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ExceptionContext *p = (struct __pyx_obj_4lxml_5etree__ExceptionContext *)o;
  Py_CLEAR(p->_exc_info);
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__ExceptionContext_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__ExceptionContext},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__ExceptionContext},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__ExceptionContext},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__ExceptionContext},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__ExceptionContext_spec = {
  "lxml.etree._ExceptionContext",
  sizeof(struct __pyx_obj_4lxml_5etree__ExceptionContext),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__ExceptionContext_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__ExceptionContext = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_ExceptionContext", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ExceptionContext), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ExceptionContext, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ExceptionContext, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ExceptionContext, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__ExceptionContext, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__LogEntry __pyx_vtable_4lxml_5etree__LogEntry;

static PyObject *__pyx_tp_new_4lxml_5etree__LogEntry(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree__LogEntry *p;
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4lxml_5etree__LogEntry > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__LogEntry, sizeof(struct __pyx_obj_4lxml_5etree__LogEntry))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_4lxml_5etree__LogEntry[--__pyx_mstate_global->__pyx_freecount_4lxml_5etree__LogEntry];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_4lxml_5etree__LogEntry));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_4lxml_5etree__LogEntry *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__LogEntry;
  p->_message = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_filename = ((PyObject*)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__LogEntry(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__LogEntry *p = (struct __pyx_obj_4lxml_5etree__LogEntry *)o;
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_4lxml_5etree_9_LogEntry_1__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->_message);
  Py_CLEAR(p->_filename);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4lxml_5etree__LogEntry < 16) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__LogEntry, sizeof(struct __pyx_obj_4lxml_5etree__LogEntry))))
  {
    __pyx_mstate_global->__pyx_freelist_4lxml_5etree__LogEntry[__pyx_mstate_global->__pyx_freecount_4lxml_5etree__LogEntry++] = ((struct __pyx_obj_4lxml_5etree__LogEntry *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static PyObject *__pyx_getprop_4lxml_5etree_9_LogEntry_domain_name(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_9_LogEntry_11domain_name_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_9_LogEntry_type_name(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_9_LogEntry_9type_name_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_9_LogEntry_level_name(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_9_LogEntry_10level_name_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_9_LogEntry_message(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_9_LogEntry_7message_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_9_LogEntry_filename(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_9_LogEntry_8filename_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_9_LogEntry_path(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_9_LogEntry_4path_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_9_LogEntry_domain(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_9_LogEntry_6domain_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_9_LogEntry_type(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_9_LogEntry_4type_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_9_LogEntry_level(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_9_LogEntry_5level_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_9_LogEntry_line(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_9_LogEntry_4line_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_9_LogEntry_column(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_9_LogEntry_6column_1__get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree__LogEntry[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__LogEntry[] = {
  {"domain_name", __pyx_getprop_4lxml_5etree_9_LogEntry_domain_name, 0, PyDoc_STR("The name of the error domain.  See lxml.etree.ErrorDomains\n        "), 0},
  {"type_name", __pyx_getprop_4lxml_5etree_9_LogEntry_type_name, 0, PyDoc_STR("The name of the error type.  See lxml.etree.ErrorTypes\n        "), 0},
  {"level_name", __pyx_getprop_4lxml_5etree_9_LogEntry_level_name, 0, PyDoc_STR("The name of the error level.  See lxml.etree.ErrorLevels\n        "), 0},
  {"message", __pyx_getprop_4lxml_5etree_9_LogEntry_message, 0, PyDoc_STR("The log message string.\n        "), 0},
  {"filename", __pyx_getprop_4lxml_5etree_9_LogEntry_filename, 0, PyDoc_STR("The file path where the report originated, if any.\n        "), 0},
  {"path", __pyx_getprop_4lxml_5etree_9_LogEntry_path, 0, PyDoc_STR("The XPath for the node where the error was detected.\n        "), 0},
  {"domain", __pyx_getprop_4lxml_5etree_9_LogEntry_domain, 0, 0, 0},
  {"type", __pyx_getprop_4lxml_5etree_9_LogEntry_type, 0, 0, 0},
  {"level", __pyx_getprop_4lxml_5etree_9_LogEntry_level, 0, 0, 0},
  {"line", __pyx_getprop_4lxml_5etree_9_LogEntry_line, 0, 0, 0},
  {"column", __pyx_getprop_4lxml_5etree_9_LogEntry_column, 0, 0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__LogEntry_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__LogEntry},
  {Py_tp_repr, (void *)__pyx_pw_4lxml_5etree_9_LogEntry_3__repr__},
  {Py_tp_doc, (void *)PyDoc_STR("A log message entry from an error log.\n\n    Attributes:\n\n    - message: the message text\n    - domain: the domain ID (see lxml.etree.ErrorDomains)\n    - type: the message type ID (see lxml.etree.ErrorTypes)\n    - level: the log level ID (see lxml.etree.ErrorLevels)\n    - line: the line at which the message originated (if applicable)\n    - column: the character column at which the message originated (if applicable)\n    - filename: the name of the file in which the message originated (if applicable)\n    - path: the location in which the error was found (if available)\n    ")},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__LogEntry},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree__LogEntry},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__LogEntry},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__LogEntry_spec = {
  "lxml.etree._LogEntry",
  sizeof(struct __pyx_obj_4lxml_5etree__LogEntry),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER,
  __pyx_type_4lxml_5etree__LogEntry_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__LogEntry = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_LogEntry", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__LogEntry), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__LogEntry, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  __pyx_pw_4lxml_5etree_9_LogEntry_3__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
  PyDoc_STR("A log message entry from an error log.\n\n    Attributes:\n\n    - message: the message text\n    - domain: the domain ID (see lxml.etree.ErrorDomains)\n    - type: the message type ID (see lxml.etree.ErrorTypes)\n    - level: the log level ID (see lxml.etree.ErrorLevels)\n    - line: the line at which the message originated (if applicable)\n    - column: the character column at which the message originated (if applicable)\n    - filename: the name of the file in which the message originated (if applicable)\n    - path: the location in which the error was found (if available)\n    "), /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__LogEntry, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__LogEntry, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__LogEntry, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__BaseErrorLog __pyx_vtable_4lxml_5etree__BaseErrorLog;

static PyObject *__pyx_tp_new_4lxml_5etree__BaseErrorLog(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree__BaseErrorLog *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__BaseErrorLog;
  p->_first_error = ((struct __pyx_obj_4lxml_5etree__LogEntry *)Py_None); Py_INCREF(Py_None);
  p->last_error = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__BaseErrorLog(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__BaseErrorLog *p = (struct __pyx_obj_4lxml_5etree__BaseErrorLog *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree__BaseErrorLog) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_first_error);
  Py_CLEAR(p->last_error);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_4lxml_5etree__BaseErrorLog(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__BaseErrorLog *p = (struct __pyx_obj_4lxml_5etree__BaseErrorLog *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->_first_error) {
    e = (*v)(((PyObject *)p->_first_error), a); if (e) return e;
  }
  if (p->last_error) {
    e = (*v)(p->last_error, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__BaseErrorLog(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__BaseErrorLog *p = (struct __pyx_obj_4lxml_5etree__BaseErrorLog *)o;
  Py_CLEAR(p->_first_error);
  Py_CLEAR(p->last_error);
  return 0;
}

static PyObject *__pyx_getprop_4lxml_5etree_13_BaseErrorLog_last_error(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_13_BaseErrorLog_10last_error_1__get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree__BaseErrorLog[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__BaseErrorLog[] = {
  {"last_error", __pyx_getprop_4lxml_5etree_13_BaseErrorLog_last_error, 0, 0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__BaseErrorLog_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__BaseErrorLog},
  {Py_tp_repr, (void *)__pyx_pw_4lxml_5etree_13_BaseErrorLog_5__repr__},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__BaseErrorLog},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__BaseErrorLog},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__BaseErrorLog},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree__BaseErrorLog},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_13_BaseErrorLog_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__BaseErrorLog},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__BaseErrorLog_spec = {
  "lxml.etree._BaseErrorLog",
  sizeof(struct __pyx_obj_4lxml_5etree__BaseErrorLog),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__BaseErrorLog_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__BaseErrorLog = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_BaseErrorLog", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__BaseErrorLog), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__BaseErrorLog, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  __pyx_pw_4lxml_5etree_13_BaseErrorLog_5__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__BaseErrorLog, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__BaseErrorLog, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__BaseErrorLog, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__BaseErrorLog, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_4lxml_5etree_13_BaseErrorLog_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__BaseErrorLog, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__ListErrorLog __pyx_vtable_4lxml_5etree__ListErrorLog;

static PyObject *__pyx_tp_new_4lxml_5etree__ListErrorLog(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ListErrorLog *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__BaseErrorLog(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ListErrorLog *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__BaseErrorLog*)__pyx_vtabptr_4lxml_5etree__ListErrorLog;
  p->_entries = ((PyObject*)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__ListErrorLog(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ListErrorLog *p = (struct __pyx_obj_4lxml_5etree__ListErrorLog *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree__ListErrorLog) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_entries);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_4lxml_5etree__BaseErrorLog(o);
}

static int __pyx_tp_traverse_4lxml_5etree__ListErrorLog(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__ListErrorLog *p = (struct __pyx_obj_4lxml_5etree__ListErrorLog *)o;
  e = __pyx_tp_traverse_4lxml_5etree__BaseErrorLog(o, v, a); if (e) return e;
  if (p->_entries) {
    e = (*v)(p->_entries, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__ListErrorLog(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ListErrorLog *p = (struct __pyx_obj_4lxml_5etree__ListErrorLog *)o;
  __pyx_tp_clear_4lxml_5etree__BaseErrorLog(o);
  Py_CLEAR(p->_entries);
  return 0;
}

static PyObject *__pyx_sq_item_4lxml_5etree__ListErrorLog(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyLong_FromSsize_t(i); if(!x) return 0;
  #if CYTHON_USE_TYPE_SLOTS || (!CYTHON_USE_TYPE_SPECS && __PYX_LIMITED_VERSION_HEX < 0x030A0000)
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  #else
  r = ((binaryfunc)PyType_GetSlot(Py_TYPE(o), Py_mp_subscript))(o, x);
  #endif
  Py_DECREF(x);
  return r;
}

static PyMethodDef __pyx_methods_4lxml_5etree__ListErrorLog[] = {
  {"filter_domains", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_13_ListErrorLog_17filter_domains, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_13_ListErrorLog_16filter_domains},
  {"filter_types", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_13_ListErrorLog_19filter_types, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_13_ListErrorLog_18filter_types},
  {"filter_levels", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_13_ListErrorLog_21filter_levels, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_13_ListErrorLog_20filter_levels},
  {"filter_from_level", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_13_ListErrorLog_23filter_from_level, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_13_ListErrorLog_22filter_from_level},
  {"filter_from_fatals", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_13_ListErrorLog_25filter_from_fatals, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_13_ListErrorLog_24filter_from_fatals},
  {"filter_from_errors", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_13_ListErrorLog_27filter_from_errors, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_13_ListErrorLog_26filter_from_errors},
  {"filter_from_warnings", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_13_ListErrorLog_29filter_from_warnings, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_13_ListErrorLog_28filter_from_warnings},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__ListErrorLog_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__ListErrorLog},
  {Py_tp_repr, (void *)__pyx_pw_4lxml_5etree_13_ListErrorLog_7__repr__},
  {Py_nb_bool, (void *)__pyx_pw_4lxml_5etree_13_ListErrorLog_15__bool__},
  {Py_sq_length, (void *)__pyx_pw_4lxml_5etree_13_ListErrorLog_11__len__},
  {Py_sq_item, (void *)__pyx_sq_item_4lxml_5etree__ListErrorLog},
  {Py_sq_contains, (void *)__pyx_pw_4lxml_5etree_13_ListErrorLog_13__contains__},
  {Py_mp_length, (void *)__pyx_pw_4lxml_5etree_13_ListErrorLog_11__len__},
  {Py_mp_subscript, (void *)__pyx_pw_4lxml_5etree_13_ListErrorLog_9__getitem__},
  {Py_tp_doc, (void *)PyDoc_STR("Immutable base version of a list based error log.")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__ListErrorLog},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__ListErrorLog},
  {Py_tp_iter, (void *)__pyx_pw_4lxml_5etree_13_ListErrorLog_5__iter__},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__ListErrorLog},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_13_ListErrorLog_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__ListErrorLog},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__ListErrorLog_spec = {
  "lxml.etree._ListErrorLog",
  sizeof(struct __pyx_obj_4lxml_5etree__ListErrorLog),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__ListErrorLog_slots,
};
#else

static PyNumberMethods __pyx_tp_as_number__ListErrorLog = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  __pyx_pw_4lxml_5etree_13_ListErrorLog_15__bool__, /*nb_bool*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  0, /*nb_int*/
  0, /*nb_long (reserved)*/
  0, /*nb_float*/
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  0, /*nb_index*/
  0, /*nb_matrix_multiply*/
  0, /*nb_inplace_matrix_multiply*/
};

static PySequenceMethods __pyx_tp_as_sequence__ListErrorLog = {
  __pyx_pw_4lxml_5etree_13_ListErrorLog_11__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_4lxml_5etree__ListErrorLog, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  __pyx_pw_4lxml_5etree_13_ListErrorLog_13__contains__, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__ListErrorLog = {
  __pyx_pw_4lxml_5etree_13_ListErrorLog_11__len__, /*mp_length*/
  __pyx_pw_4lxml_5etree_13_ListErrorLog_9__getitem__, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_4lxml_5etree__ListErrorLog = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_ListErrorLog", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ListErrorLog), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ListErrorLog, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  __pyx_pw_4lxml_5etree_13_ListErrorLog_7__repr__, /*tp_repr*/
  &__pyx_tp_as_number__ListErrorLog, /*tp_as_number*/
  &__pyx_tp_as_sequence__ListErrorLog, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__ListErrorLog, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("Immutable base version of a list based error log."), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ListErrorLog, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ListErrorLog, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_4lxml_5etree_13_ListErrorLog_5__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__ListErrorLog, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_4lxml_5etree_13_ListErrorLog_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__ListErrorLog, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__ErrorLogContext __pyx_vtable_4lxml_5etree__ErrorLogContext;

static PyObject *__pyx_tp_new_4lxml_5etree__ErrorLogContext(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ErrorLogContext *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 1);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ErrorLogContext *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__ErrorLogContext;
  p->old_xslt_error_log = ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__ErrorLogContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ErrorLogContext *p = (struct __pyx_obj_4lxml_5etree__ErrorLogContext *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->old_xslt_error_log);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_4lxml_5etree__ErrorLogContext(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__ErrorLogContext *p = (struct __pyx_obj_4lxml_5etree__ErrorLogContext *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->old_xslt_error_log) {
    e = (*v)(((PyObject *)p->old_xslt_error_log), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__ErrorLogContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ErrorLogContext *p = (struct __pyx_obj_4lxml_5etree__ErrorLogContext *)o;
  Py_CLEAR(p->old_xslt_error_log);
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__ErrorLogContext_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__ErrorLogContext},
  {Py_tp_doc, (void *)PyDoc_STR("\n    Error log context for the 'with' statement.\n    Stores a reference to the current callbacks to allow for\n    recursively stacked log contexts.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__ErrorLogContext},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__ErrorLogContext},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__ErrorLogContext},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__ErrorLogContext_spec = {
  "lxml.etree._ErrorLogContext",
  sizeof(struct __pyx_obj_4lxml_5etree__ErrorLogContext),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__ErrorLogContext_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__ErrorLogContext = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_ErrorLogContext", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ErrorLogContext), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ErrorLogContext, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("\n    Error log context for the 'with' statement.\n    Stores a reference to the current callbacks to allow for\n    recursively stacked log contexts.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ErrorLogContext, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ErrorLogContext, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__ErrorLogContext, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__ErrorLog __pyx_vtable_4lxml_5etree__ErrorLog;

static PyObject *__pyx_tp_new_4lxml_5etree__ErrorLog(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ErrorLog *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ListErrorLog(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)o);
  p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__BaseErrorLog*)__pyx_vtabptr_4lxml_5etree__ErrorLog;
  p->_logContexts = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_9_ErrorLog_1__cinit__(o, __pyx_mstate_global->__pyx_empty_tuple, NULL) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_4lxml_5etree__ErrorLog(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ErrorLog *p = (struct __pyx_obj_4lxml_5etree__ErrorLog *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree__ErrorLog) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_logContexts);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_4lxml_5etree__ListErrorLog(o);
}

static int __pyx_tp_traverse_4lxml_5etree__ErrorLog(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__ErrorLog *p = (struct __pyx_obj_4lxml_5etree__ErrorLog *)o;
  e = __pyx_tp_traverse_4lxml_5etree__ListErrorLog(o, v, a); if (e) return e;
  if (p->_logContexts) {
    e = (*v)(p->_logContexts, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__ErrorLog(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ErrorLog *p = (struct __pyx_obj_4lxml_5etree__ErrorLog *)o;
  __pyx_tp_clear_4lxml_5etree__ListErrorLog(o);
  Py_CLEAR(p->_logContexts);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__ErrorLog[] = {
  {"__exit__", (PyCFunction)(void(*)(void))(PyCFunctionWithKeywords)__pyx_pw_4lxml_5etree_9_ErrorLog_5__exit__, METH_VARARGS|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__ErrorLog_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__ErrorLog},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__ErrorLog},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__ErrorLog},
  {Py_tp_iter, (void *)__pyx_pw_4lxml_5etree_9_ErrorLog_11__iter__},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__ErrorLog},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_9_ErrorLog_3__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__ErrorLog},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__ErrorLog_spec = {
  "lxml.etree._ErrorLog",
  sizeof(struct __pyx_obj_4lxml_5etree__ErrorLog),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__ErrorLog_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__ErrorLog = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_ErrorLog", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ErrorLog), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ErrorLog, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_13_ListErrorLog_7__repr__, /*tp_repr*/
  #else
  0, /*tp_repr*/
  #endif
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ErrorLog, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ErrorLog, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_4lxml_5etree_9_ErrorLog_11__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__ErrorLog, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_4lxml_5etree_9_ErrorLog_3__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__ErrorLog, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__DomainErrorLog __pyx_vtable_4lxml_5etree__DomainErrorLog;

static PyObject *__pyx_tp_new_4lxml_5etree__DomainErrorLog(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__DomainErrorLog *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ErrorLog(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__DomainErrorLog *)o);
  p->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__BaseErrorLog*)__pyx_vtabptr_4lxml_5etree__DomainErrorLog;
  return o;
}

static PyMethodDef __pyx_methods_4lxml_5etree__DomainErrorLog[] = {
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__DomainErrorLog_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__ErrorLog},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__ErrorLog},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__ErrorLog},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__DomainErrorLog},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_15_DomainErrorLog_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__DomainErrorLog},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__DomainErrorLog_spec = {
  "lxml.etree._DomainErrorLog",
  sizeof(struct __pyx_obj_4lxml_5etree__DomainErrorLog),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__DomainErrorLog_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__DomainErrorLog = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_DomainErrorLog", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__DomainErrorLog), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ErrorLog, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_13_ListErrorLog_7__repr__, /*tp_repr*/
  #else
  0, /*tp_repr*/
  #endif
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ErrorLog, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ErrorLog, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_9_ErrorLog_11__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__DomainErrorLog, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_4lxml_5etree_15_DomainErrorLog_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__DomainErrorLog, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__RotatingErrorLog __pyx_vtable_4lxml_5etree__RotatingErrorLog;

static PyObject *__pyx_tp_new_4lxml_5etree__RotatingErrorLog(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__RotatingErrorLog *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ErrorLog(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__RotatingErrorLog *)o);
  p->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__BaseErrorLog*)__pyx_vtabptr_4lxml_5etree__RotatingErrorLog;
  return o;
}

static PyMethodDef __pyx_methods_4lxml_5etree__RotatingErrorLog[] = {
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__RotatingErrorLog_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__ErrorLog},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__ErrorLog},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__ErrorLog},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__RotatingErrorLog},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_17_RotatingErrorLog_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__RotatingErrorLog},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__RotatingErrorLog_spec = {
  "lxml.etree._RotatingErrorLog",
  sizeof(struct __pyx_obj_4lxml_5etree__RotatingErrorLog),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__RotatingErrorLog_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__RotatingErrorLog = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_RotatingErrorLog", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__RotatingErrorLog), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ErrorLog, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_13_ListErrorLog_7__repr__, /*tp_repr*/
  #else
  0, /*tp_repr*/
  #endif
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ErrorLog, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ErrorLog, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_9_ErrorLog_11__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__RotatingErrorLog, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_4lxml_5etree_17_RotatingErrorLog_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__RotatingErrorLog, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree_PyErrorLog __pyx_vtable_4lxml_5etree_PyErrorLog;

static PyObject *__pyx_tp_new_4lxml_5etree_PyErrorLog(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_PyErrorLog *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__BaseErrorLog(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_PyErrorLog *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__BaseErrorLog*)__pyx_vtabptr_4lxml_5etree_PyErrorLog;
  p->level_map = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_map_level = Py_None; Py_INCREF(Py_None);
  p->_log = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_PyErrorLog(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_PyErrorLog *p = (struct __pyx_obj_4lxml_5etree_PyErrorLog *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree_PyErrorLog) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->level_map);
  Py_CLEAR(p->_map_level);
  Py_CLEAR(p->_log);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_4lxml_5etree__BaseErrorLog(o);
}

static int __pyx_tp_traverse_4lxml_5etree_PyErrorLog(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree_PyErrorLog *p = (struct __pyx_obj_4lxml_5etree_PyErrorLog *)o;
  e = __pyx_tp_traverse_4lxml_5etree__BaseErrorLog(o, v, a); if (e) return e;
  if (p->level_map) {
    e = (*v)(p->level_map, a); if (e) return e;
  }
  if (p->_map_level) {
    e = (*v)(p->_map_level, a); if (e) return e;
  }
  if (p->_log) {
    e = (*v)(p->_log, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree_PyErrorLog(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_PyErrorLog *p = (struct __pyx_obj_4lxml_5etree_PyErrorLog *)o;
  __pyx_tp_clear_4lxml_5etree__BaseErrorLog(o);
  Py_CLEAR(p->level_map);
  Py_CLEAR(p->_map_level);
  Py_CLEAR(p->_log);
  return 0;
}

static PyObject *__pyx_getprop_4lxml_5etree_10PyErrorLog_level_map(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_10PyErrorLog_9level_map_1__get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree_PyErrorLog[] = {
  {"log", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_10PyErrorLog_5log, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_10PyErrorLog_4log},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree_PyErrorLog[] = {
  {"level_map", __pyx_getprop_4lxml_5etree_10PyErrorLog_level_map, 0, 0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_PyErrorLog_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_PyErrorLog},
  {Py_tp_doc, (void *)PyDoc_STR("PyErrorLog(self, logger_name=None, logger=None)\n    A global error log that connects to the Python stdlib logging package.\n\n    The constructor accepts an optional logger name or a readily\n    instantiated logger instance.\n\n    If you want to change the mapping between libxml2's ErrorLevels and Python\n    logging levels, you can modify the level_map dictionary from a subclass.\n\n    The default mapping is::\n\n            ErrorLevels.WARNING = logging.WARNING\n            ErrorLevels.ERROR   = logging.ERROR\n            ErrorLevels.FATAL   = logging.CRITICAL\n\n    You can also override the method ``receive()`` that takes a LogEntry\n    object and calls ``self.log(log_entry, format_string, arg1, arg2, ...)``\n    with appropriate data.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_PyErrorLog},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_PyErrorLog},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_PyErrorLog},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree_PyErrorLog},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_10PyErrorLog_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_PyErrorLog},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_PyErrorLog_spec = {
  "lxml.etree.PyErrorLog",
  sizeof(struct __pyx_obj_4lxml_5etree_PyErrorLog),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_PyErrorLog_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_PyErrorLog = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""PyErrorLog", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_PyErrorLog), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_PyErrorLog, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_13_BaseErrorLog_5__repr__, /*tp_repr*/
  #else
  0, /*tp_repr*/
  #endif
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("PyErrorLog(self, logger_name=None, logger=None)\n    A global error log that connects to the Python stdlib logging package.\n\n    The constructor accepts an optional logger name or a readily\n    instantiated logger instance.\n\n    If you want to change the mapping between libxml2's ErrorLevels and Python\n    logging levels, you can modify the level_map dictionary from a subclass.\n\n    The default mapping is::\n\n            ErrorLevels.WARNING = logging.WARNING\n            ErrorLevels.ERROR   = logging.ERROR\n            ErrorLevels.FATAL   = logging.CRITICAL\n\n    You can also override the method ``receive()`` that takes a LogEntry\n    object and calls ``self.log(log_entry, format_string, arg1, arg2, ...)``\n    with appropriate data.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_PyErrorLog, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_PyErrorLog, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_PyErrorLog, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree_PyErrorLog, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_4lxml_5etree_10PyErrorLog_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_PyErrorLog, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__Document __pyx_vtable_4lxml_5etree__Document;

static PyObject *__pyx_tp_new_4lxml_5etree__Document(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct LxmlDocument *p;
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4lxml_5etree__Document > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Document, sizeof(struct LxmlDocument))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_4lxml_5etree__Document[--__pyx_mstate_global->__pyx_freecount_4lxml_5etree__Document];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct LxmlDocument));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  p = ((struct LxmlDocument *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__Document;
  p->_prefix_tail = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__Document(PyObject *o) {
  struct LxmlDocument *p = (struct LxmlDocument *)o;
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_4lxml_5etree_9_Document_1__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->_prefix_tail);
  Py_CLEAR(p->_parser);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4lxml_5etree__Document < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Document, sizeof(struct LxmlDocument))))
  {
    __pyx_mstate_global->__pyx_freelist_4lxml_5etree__Document[__pyx_mstate_global->__pyx_freecount_4lxml_5etree__Document++] = ((struct LxmlDocument *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_4lxml_5etree__Document(PyObject *o, visitproc v, void *a) {
  int e;
  struct LxmlDocument *p = (struct LxmlDocument *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->_parser) {
    e = (*v)(((PyObject *)p->_parser), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__Document(PyObject *o) {
  struct LxmlDocument *p = (struct LxmlDocument *)o;
  Py_CLEAR(p->_parser);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__Document[] = {
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot LxmlDocumentType_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__Document},
  {Py_tp_doc, (void *)PyDoc_STR("Internal base class to reference a libxml document.\n\n    When instances of this class are garbage collected, the libxml\n    document is cleaned up.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__Document},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__Document},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__Document},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__Document},
  {0, 0},
};
static PyType_Spec LxmlDocumentType_spec = {
  "lxml.etree._Document",
  sizeof(struct LxmlDocument),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  LxmlDocumentType_slots,
};
#else

DL_EXPORT(PyTypeObject) LxmlDocumentType = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_Document", /*tp_name*/
  sizeof(struct LxmlDocument), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__Document, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("Internal base class to reference a libxml document.\n\n    When instances of this class are garbage collected, the libxml\n    document is cleaned up.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__Document, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__Document, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__Document, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__Document, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree_DocInfo __pyx_vtable_4lxml_5etree_DocInfo;

static PyObject *__pyx_tp_new_4lxml_5etree_DocInfo(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_DocInfo *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_DocInfo *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree_DocInfo;
  p->_doc = ((struct LxmlDocument *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_7DocInfo_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_4lxml_5etree_DocInfo(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_DocInfo *p = (struct __pyx_obj_4lxml_5etree_DocInfo *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree_DocInfo) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_doc);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_4lxml_5etree_DocInfo(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree_DocInfo *p = (struct __pyx_obj_4lxml_5etree_DocInfo *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->_doc) {
    e = (*v)(((PyObject *)p->_doc), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree_DocInfo(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_DocInfo *p = (struct __pyx_obj_4lxml_5etree_DocInfo *)o;
  Py_CLEAR(p->_doc);
  return 0;
}

static PyObject *__pyx_getprop_4lxml_5etree_7DocInfo_root_name(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_7DocInfo_9root_name_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_7DocInfo_public_id(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_7DocInfo_9public_id_1__get__(o);
}

static int __pyx_setprop_4lxml_5etree_7DocInfo_public_id(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_4lxml_5etree_7DocInfo_9public_id_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_4lxml_5etree_7DocInfo_system_url(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_7DocInfo_10system_url_1__get__(o);
}

static int __pyx_setprop_4lxml_5etree_7DocInfo_system_url(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_4lxml_5etree_7DocInfo_10system_url_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_4lxml_5etree_7DocInfo_xml_version(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_7DocInfo_11xml_version_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_7DocInfo_encoding(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_7DocInfo_8encoding_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_7DocInfo_standalone(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_7DocInfo_10standalone_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_7DocInfo_URL(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_7DocInfo_3URL_1__get__(o);
}

static int __pyx_setprop_4lxml_5etree_7DocInfo_URL(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_4lxml_5etree_7DocInfo_3URL_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_4lxml_5etree_7DocInfo_doctype(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_7DocInfo_7doctype_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_7DocInfo_internalDTD(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_7DocInfo_11internalDTD_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_7DocInfo_externalDTD(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_7DocInfo_11externalDTD_1__get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree_DocInfo[] = {
  {"clear", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7DocInfo_3clear, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_7DocInfo_2clear},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree_DocInfo[] = {
  {"root_name", __pyx_getprop_4lxml_5etree_7DocInfo_root_name, 0, PyDoc_STR("Returns the name of the root node as defined by the DOCTYPE."), 0},
  {"public_id", __pyx_getprop_4lxml_5etree_7DocInfo_public_id, __pyx_setprop_4lxml_5etree_7DocInfo_public_id, PyDoc_STR("Public ID of the DOCTYPE.\n\n        Mutable.  May be set to a valid string or None.  If a DTD does not\n        exist, setting this variable (even to None) will create one.\n        "), 0},
  {"system_url", __pyx_getprop_4lxml_5etree_7DocInfo_system_url, __pyx_setprop_4lxml_5etree_7DocInfo_system_url, PyDoc_STR("System ID of the DOCTYPE.\n\n        Mutable.  May be set to a valid string or None.  If a DTD does not\n        exist, setting this variable (even to None) will create one.\n        "), 0},
  {"xml_version", __pyx_getprop_4lxml_5etree_7DocInfo_xml_version, 0, PyDoc_STR("Returns the XML version as declared by the document."), 0},
  {"encoding", __pyx_getprop_4lxml_5etree_7DocInfo_encoding, 0, PyDoc_STR("Returns the encoding name as declared by the document."), 0},
  {"standalone", __pyx_getprop_4lxml_5etree_7DocInfo_standalone, 0, PyDoc_STR("Returns the standalone flag as declared by the document.  The possible\n        values are True (``standalone='yes'``), False\n        (``standalone='no'`` or flag not provided in the declaration),\n        and None (unknown or no declaration found).  Note that a\n        normal truth test on this value will always tell if the\n        ``standalone`` flag was set to ``'yes'`` or not.\n        "), 0},
  {"URL", __pyx_getprop_4lxml_5etree_7DocInfo_URL, __pyx_setprop_4lxml_5etree_7DocInfo_URL, PyDoc_STR("The source URL of the document (or None if unknown)."), 0},
  {"doctype", __pyx_getprop_4lxml_5etree_7DocInfo_doctype, 0, PyDoc_STR("Returns a DOCTYPE declaration string for the document."), 0},
  {"internalDTD", __pyx_getprop_4lxml_5etree_7DocInfo_internalDTD, 0, PyDoc_STR("Returns a DTD validator based on the internal subset of the document."), 0},
  {"externalDTD", __pyx_getprop_4lxml_5etree_7DocInfo_externalDTD, 0, PyDoc_STR("Returns a DTD validator based on the external subset of the document."), 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_DocInfo_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_DocInfo},
  {Py_tp_doc, (void *)PyDoc_STR("Document information provided by parser and DTD.")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_DocInfo},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_DocInfo},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_DocInfo},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree_DocInfo},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_DocInfo},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_DocInfo_spec = {
  "lxml.etree.DocInfo",
  sizeof(struct __pyx_obj_4lxml_5etree_DocInfo),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_DocInfo_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_DocInfo = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""DocInfo", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_DocInfo), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_DocInfo, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("Document information provided by parser and DTD."), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_DocInfo, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_DocInfo, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_DocInfo, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree_DocInfo, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_DocInfo, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4lxml_5etree__Element(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct LxmlElement *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct LxmlElement *)o);
  p->_doc = ((struct LxmlDocument *)Py_None); Py_INCREF(Py_None);
  p->_tag = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__Element(PyObject *o) {
  struct LxmlElement *p = (struct LxmlElement *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree__Element) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_4lxml_5etree_8_Element_3__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->_doc);
  Py_CLEAR(p->_tag);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_4lxml_5etree__Element(PyObject *o, visitproc v, void *a) {
  int e;
  struct LxmlElement *p = (struct LxmlElement *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->_doc) {
    e = (*v)(((PyObject *)p->_doc), a); if (e) return e;
  }
  if (p->_tag) {
    e = (*v)(p->_tag, a); if (e) return e;
  }
  return 0;
}

static PyObject *__pyx_sq_item_4lxml_5etree__Element(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyLong_FromSsize_t(i); if(!x) return 0;
  #if CYTHON_USE_TYPE_SLOTS || (!CYTHON_USE_TYPE_SPECS && __PYX_LIMITED_VERSION_HEX < 0x030A0000)
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  #else
  r = ((binaryfunc)PyType_GetSlot(Py_TYPE(o), Py_mp_subscript))(o, x);
  #endif
  Py_DECREF(x);
  return r;
}

static int __pyx_mp_ass_subscript_4lxml_5etree__Element(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_pw_4lxml_5etree_8_Element_5__setitem__(o, i, v);
  }
  else {
    return __pyx_pw_4lxml_5etree_8_Element_7__delitem__(o, i);
  }
}

static PyObject *__pyx_getprop_4lxml_5etree_8_Element_tag(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_8_Element_3tag_1__get__(o);
}

static int __pyx_setprop_4lxml_5etree_8_Element_tag(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_4lxml_5etree_8_Element_3tag_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_4lxml_5etree_8_Element_attrib(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_8_Element_6attrib_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_8_Element_text(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_8_Element_4text_1__get__(o);
}

static int __pyx_setprop_4lxml_5etree_8_Element_text(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_4lxml_5etree_8_Element_4text_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_4lxml_5etree_8_Element_tail(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_8_Element_4tail_1__get__(o);
}

static int __pyx_setprop_4lxml_5etree_8_Element_tail(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_4lxml_5etree_8_Element_4tail_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_4lxml_5etree_8_Element_prefix(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_8_Element_6prefix_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_8_Element_sourceline(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_8_Element_10sourceline_1__get__(o);
}

static int __pyx_setprop_4lxml_5etree_8_Element_sourceline(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_4lxml_5etree_8_Element_10sourceline_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_4lxml_5etree_8_Element_nsmap(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_8_Element_5nsmap_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_8_Element_base(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_8_Element_4base_1__get__(o);
}

static int __pyx_setprop_4lxml_5etree_8_Element_base(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_4lxml_5etree_8_Element_4base_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyMethodDef __pyx_methods_4lxml_5etree__Element[] = {
  {"_init", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_1_init, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element__init},
  {"__deepcopy__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_9__deepcopy__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_8__deepcopy__},
  {"__copy__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_11__copy__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_10__copy__},
  {"set", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_13set, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_12set},
  {"append", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_15append, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_14append},
  {"addnext", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_17addnext, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_16addnext},
  {"addprevious", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_19addprevious, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_18addprevious},
  {"extend", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_21extend, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_20extend},
  {"clear", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_23clear, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_22clear},
  {"insert", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_25insert, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_24insert},
  {"remove", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_27remove, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_26remove},
  {"replace", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_29replace, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_28replace},
  {"__reversed__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_43__reversed__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_42__reversed__},
  {"index", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_45index, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_44index},
  {"get", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_47get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_46get},
  {"keys", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_49keys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_48keys},
  {"values", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_51values, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_50values},
  {"items", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_53items, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_52items},
  {"getchildren", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_55getchildren, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_54getchildren},
  {"getparent", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_57getparent, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_56getparent},
  {"getnext", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_59getnext, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_58getnext},
  {"getprevious", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_61getprevious, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_60getprevious},
  {"itersiblings", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_63itersiblings, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_62itersiblings},
  {"iterancestors", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_65iterancestors, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_64iterancestors},
  {"iterdescendants", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_67iterdescendants, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_66iterdescendants},
  {"iterchildren", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_69iterchildren, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_68iterchildren},
  {"getroottree", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_71getroottree, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_70getroottree},
  {"getiterator", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_73getiterator, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_72getiterator},
  {"iter", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_75iter, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_74iter},
  {"itertext", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_77itertext, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_76itertext},
  {"makeelement", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_79makeelement, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_78makeelement},
  {"find", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_81find, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_80find},
  {"findtext", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_83findtext, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_82findtext},
  {"findall", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_85findall, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_84findall},
  {"iterfind", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_87iterfind, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_86iterfind},
  {"xpath", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_89xpath, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_88xpath},
  {"cssselect", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_91cssselect, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_90cssselect},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__Element[] = {
  {"tag", __pyx_getprop_4lxml_5etree_8_Element_tag, __pyx_setprop_4lxml_5etree_8_Element_tag, PyDoc_STR("Element tag\n        "), 0},
  {"attrib", __pyx_getprop_4lxml_5etree_8_Element_attrib, 0, PyDoc_STR("Element attribute dictionary. Where possible, use get(), set(),\n        keys(), values() and items() to access element attributes.\n        "), 0},
  {"text", __pyx_getprop_4lxml_5etree_8_Element_text, __pyx_setprop_4lxml_5etree_8_Element_text, PyDoc_STR("Text before the first subelement. This is either a string or\n        the value None, if there was no text.\n        "), 0},
  {"tail", __pyx_getprop_4lxml_5etree_8_Element_tail, __pyx_setprop_4lxml_5etree_8_Element_tail, PyDoc_STR("Text after this element's end tag, but before the next sibling\n        element's start tag. This is either a string or the value None, if\n        there was no text.\n        "), 0},
  {"prefix", __pyx_getprop_4lxml_5etree_8_Element_prefix, 0, PyDoc_STR("Namespace prefix or None.\n        "), 0},
  {"sourceline", __pyx_getprop_4lxml_5etree_8_Element_sourceline, __pyx_setprop_4lxml_5etree_8_Element_sourceline, PyDoc_STR("Original line number as found by the parser or None if unknown.\n        "), 0},
  {"nsmap", __pyx_getprop_4lxml_5etree_8_Element_nsmap, 0, PyDoc_STR("Namespace prefix->URI mapping known in the context of this\n        Element.  This includes all namespace declarations of the\n        parents.\n\n        Note that changing the returned dict has no effect on the Element.\n        "), 0},
  {"base", __pyx_getprop_4lxml_5etree_8_Element_base, __pyx_setprop_4lxml_5etree_8_Element_base, PyDoc_STR("The base URI of the Element (xml:base or HTML base URL).\n        None if the base URI is unknown.\n\n        Note that the value depends on the URL of the document that\n        holds the Element if there is no xml:base attribute on the\n        Element or its ancestors.\n\n        Setting this property will set an xml:base attribute on the\n        Element, regardless of the document type (XML or HTML).\n        "), 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot LxmlElementType_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__Element},
  {Py_tp_repr, (void *)__pyx_pw_4lxml_5etree_8_Element_31__repr__},
  {Py_nb_bool, (void *)__pyx_pw_4lxml_5etree_8_Element_37__bool__},
  {Py_sq_length, (void *)__pyx_pw_4lxml_5etree_8_Element_35__len__},
  {Py_sq_item, (void *)__pyx_sq_item_4lxml_5etree__Element},
  {Py_sq_contains, (void *)__pyx_pw_4lxml_5etree_8_Element_39__contains__},
  {Py_mp_length, (void *)__pyx_pw_4lxml_5etree_8_Element_35__len__},
  {Py_mp_subscript, (void *)__pyx_pw_4lxml_5etree_8_Element_33__getitem__},
  {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_4lxml_5etree__Element},
  {Py_tp_doc, (void *)PyDoc_STR("Element class.\n\n    References a document object and a libxml node.\n\n    By pointing to a Document instance, a reference is kept to\n    _Document as long as there is some pointer to a node in it.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__Element},
  {Py_tp_iter, (void *)__pyx_pw_4lxml_5etree_8_Element_41__iter__},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__Element},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree__Element},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__Element},
  {0, 0},
};
static PyType_Spec LxmlElementType_spec = {
  "lxml.etree._Element",
  sizeof(struct LxmlElement),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  LxmlElementType_slots,
};
#else

static PyNumberMethods __pyx_tp_as_number__Element = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  __pyx_pw_4lxml_5etree_8_Element_37__bool__, /*nb_bool*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  0, /*nb_int*/
  0, /*nb_long (reserved)*/
  0, /*nb_float*/
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  0, /*nb_index*/
  0, /*nb_matrix_multiply*/
  0, /*nb_inplace_matrix_multiply*/
};

static PySequenceMethods __pyx_tp_as_sequence__Element = {
  __pyx_pw_4lxml_5etree_8_Element_35__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_4lxml_5etree__Element, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  __pyx_pw_4lxml_5etree_8_Element_39__contains__, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__Element = {
  __pyx_pw_4lxml_5etree_8_Element_35__len__, /*mp_length*/
  __pyx_pw_4lxml_5etree_8_Element_33__getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_4lxml_5etree__Element, /*mp_ass_subscript*/
};

DL_EXPORT(PyTypeObject) LxmlElementType = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_Element", /*tp_name*/
  sizeof(struct LxmlElement), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__Element, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  __pyx_pw_4lxml_5etree_8_Element_31__repr__, /*tp_repr*/
  &__pyx_tp_as_number__Element, /*tp_as_number*/
  &__pyx_tp_as_sequence__Element, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__Element, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("Element class.\n\n    References a document object and a libxml node.\n\n    By pointing to a Document instance, a reference is kept to\n    _Document as long as there is some pointer to a node in it.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__Element, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_4lxml_5etree_8_Element_41__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__Element, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__Element, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__Element, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree___ContentOnlyElement __pyx_vtable_4lxml_5etree___ContentOnlyElement;

static PyObject *__pyx_tp_new_4lxml_5etree___ContentOnlyElement(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree___ContentOnlyElement *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__Element(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree___ContentOnlyElement *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree___ContentOnlyElement;
  return o;
}

static PyObject *__pyx_sq_item_4lxml_5etree___ContentOnlyElement(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyLong_FromSsize_t(i); if(!x) return 0;
  #if CYTHON_USE_TYPE_SLOTS || (!CYTHON_USE_TYPE_SPECS && __PYX_LIMITED_VERSION_HEX < 0x030A0000)
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  #else
  r = ((binaryfunc)PyType_GetSlot(Py_TYPE(o), Py_mp_subscript))(o, x);
  #endif
  Py_DECREF(x);
  return r;
}

static int __pyx_mp_ass_subscript_4lxml_5etree___ContentOnlyElement(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_pw_4lxml_5etree_20__ContentOnlyElement_7__setitem__(o, i, v);
  }
  else {
    __Pyx_TypeName o_type_name;
    objobjargproc f = __Pyx_PyType_TryGetSubSlot(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element, tp_as_mapping, mp_ass_subscript, objobjargproc);
    if (f)
    return f(o, i, v);
    o_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(o));
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript deletion not supported by " __Pyx_FMT_TYPENAME, o_type_name);
    __Pyx_DECREF_TypeName(o_type_name);
    return -1;
  }
}

static PyObject *__pyx_getprop_4lxml_5etree_20__ContentOnlyElement_attrib(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_20__ContentOnlyElement_6attrib_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_20__ContentOnlyElement_text(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_20__ContentOnlyElement_4text_1__get__(o);
}

static int __pyx_setprop_4lxml_5etree_20__ContentOnlyElement_text(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_4lxml_5etree_20__ContentOnlyElement_4text_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyMethodDef __pyx_methods_4lxml_5etree___ContentOnlyElement[] = {
  {"set", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_20__ContentOnlyElement_1set, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_20__ContentOnlyElement_set},
  {"append", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_20__ContentOnlyElement_3append, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_20__ContentOnlyElement_2append},
  {"insert", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_20__ContentOnlyElement_5insert, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_20__ContentOnlyElement_4insert},
  {"get", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_20__ContentOnlyElement_13get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_20__ContentOnlyElement_12get},
  {"keys", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_20__ContentOnlyElement_15keys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_20__ContentOnlyElement_14keys},
  {"items", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_20__ContentOnlyElement_17items, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_20__ContentOnlyElement_16items},
  {"values", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_20__ContentOnlyElement_19values, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_20__ContentOnlyElement_18values},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree___ContentOnlyElement[] = {
  {"attrib", __pyx_getprop_4lxml_5etree_20__ContentOnlyElement_attrib, 0, 0, 0},
  {"text", __pyx_getprop_4lxml_5etree_20__ContentOnlyElement_text, __pyx_setprop_4lxml_5etree_20__ContentOnlyElement_text, 0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree___ContentOnlyElement_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__Element},
  {Py_sq_length, (void *)__pyx_pw_4lxml_5etree_20__ContentOnlyElement_11__len__},
  {Py_sq_item, (void *)__pyx_sq_item_4lxml_5etree___ContentOnlyElement},
  {Py_mp_length, (void *)__pyx_pw_4lxml_5etree_20__ContentOnlyElement_11__len__},
  {Py_mp_subscript, (void *)__pyx_pw_4lxml_5etree_20__ContentOnlyElement_9__getitem__},
  {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_4lxml_5etree___ContentOnlyElement},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__Element},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree___ContentOnlyElement},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree___ContentOnlyElement},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree___ContentOnlyElement},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree___ContentOnlyElement_spec = {
  "lxml.etree.__ContentOnlyElement",
  sizeof(struct __pyx_obj_4lxml_5etree___ContentOnlyElement),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree___ContentOnlyElement_slots,
};
#else

static PySequenceMethods __pyx_tp_as_sequence___ContentOnlyElement = {
  __pyx_pw_4lxml_5etree_20__ContentOnlyElement_11__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_4lxml_5etree___ContentOnlyElement, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_8_Element_39__contains__, /*sq_contains*/
  #else
  0, /*sq_contains*/
  #endif
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping___ContentOnlyElement = {
  __pyx_pw_4lxml_5etree_20__ContentOnlyElement_11__len__, /*mp_length*/
  __pyx_pw_4lxml_5etree_20__ContentOnlyElement_9__getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_4lxml_5etree___ContentOnlyElement, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_4lxml_5etree___ContentOnlyElement = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""__ContentOnlyElement", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree___ContentOnlyElement), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__Element, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_8_Element_31__repr__, /*tp_repr*/
  #else
  0, /*tp_repr*/
  #endif
  0, /*tp_as_number*/
  &__pyx_tp_as_sequence___ContentOnlyElement, /*tp_as_sequence*/
  &__pyx_tp_as_mapping___ContentOnlyElement, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__Element, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_8_Element_41__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree___ContentOnlyElement, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree___ContentOnlyElement, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree___ContentOnlyElement, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__Comment __pyx_vtable_4lxml_5etree__Comment;

static PyObject *__pyx_tp_new_4lxml_5etree__Comment(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__Comment *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree___ContentOnlyElement(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__Comment *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree___ContentOnlyElement*)__pyx_vtabptr_4lxml_5etree__Comment;
  return o;
}

static PyObject *__pyx_getprop_4lxml_5etree_8_Comment_tag(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_8_Comment_3tag_1__get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree__Comment[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__Comment[] = {
  {"tag", __pyx_getprop_4lxml_5etree_8_Comment_tag, 0, 0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__Comment_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__Element},
  {Py_tp_repr, (void *)__pyx_pw_4lxml_5etree_8_Comment_1__repr__},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__Element},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__Comment},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree__Comment},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__Comment},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__Comment_spec = {
  "lxml.etree._Comment",
  sizeof(struct __pyx_obj_4lxml_5etree__Comment),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__Comment_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__Comment = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_Comment", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__Comment), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__Element, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  __pyx_pw_4lxml_5etree_8_Comment_1__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__Element, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_8_Element_41__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__Comment, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__Comment, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__Comment, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__ProcessingInstruction __pyx_vtable_4lxml_5etree__ProcessingInstruction;

static PyObject *__pyx_tp_new_4lxml_5etree__ProcessingInstruction(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ProcessingInstruction *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree___ContentOnlyElement(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ProcessingInstruction *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree___ContentOnlyElement*)__pyx_vtabptr_4lxml_5etree__ProcessingInstruction;
  return o;
}

static PyObject *__pyx_getprop_4lxml_5etree_22_ProcessingInstruction_tag(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_22_ProcessingInstruction_3tag_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_22_ProcessingInstruction_target(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_22_ProcessingInstruction_6target_1__get__(o);
}

static int __pyx_setprop_4lxml_5etree_22_ProcessingInstruction_target(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_4lxml_5etree_22_ProcessingInstruction_6target_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_4lxml_5etree_22_ProcessingInstruction_attrib(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_22_ProcessingInstruction_6attrib_1__get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree__ProcessingInstruction[] = {
  {"get", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_22_ProcessingInstruction_3get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_22_ProcessingInstruction_2get},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__ProcessingInstruction[] = {
  {"tag", __pyx_getprop_4lxml_5etree_22_ProcessingInstruction_tag, 0, 0, 0},
  {"target", __pyx_getprop_4lxml_5etree_22_ProcessingInstruction_target, __pyx_setprop_4lxml_5etree_22_ProcessingInstruction_target, 0, 0},
  {"attrib", __pyx_getprop_4lxml_5etree_22_ProcessingInstruction_attrib, 0, PyDoc_STR("Returns a dict containing all pseudo-attributes that can be\n        parsed from the text content of this processing instruction.\n        Note that modifying the dict currently has no effect on the\n        XML node, although this is not guaranteed to stay this way.\n        "), 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__ProcessingInstruction_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__Element},
  {Py_tp_repr, (void *)__pyx_pw_4lxml_5etree_22_ProcessingInstruction_1__repr__},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__Element},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__ProcessingInstruction},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree__ProcessingInstruction},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__ProcessingInstruction},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__ProcessingInstruction_spec = {
  "lxml.etree._ProcessingInstruction",
  sizeof(struct __pyx_obj_4lxml_5etree__ProcessingInstruction),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__ProcessingInstruction_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__ProcessingInstruction = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_ProcessingInstruction", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ProcessingInstruction), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__Element, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  __pyx_pw_4lxml_5etree_22_ProcessingInstruction_1__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__Element, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_8_Element_41__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__ProcessingInstruction, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__ProcessingInstruction, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__ProcessingInstruction, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__Entity __pyx_vtable_4lxml_5etree__Entity;

static PyObject *__pyx_tp_new_4lxml_5etree__Entity(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__Entity *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree___ContentOnlyElement(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__Entity *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree___ContentOnlyElement*)__pyx_vtabptr_4lxml_5etree__Entity;
  return o;
}

static PyObject *__pyx_getprop_4lxml_5etree_7_Entity_tag(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_7_Entity_3tag_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_7_Entity_name(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_7_Entity_4name_1__get__(o);
}

static int __pyx_setprop_4lxml_5etree_7_Entity_name(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_4lxml_5etree_7_Entity_4name_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_4lxml_5etree_7_Entity_text(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_7_Entity_4text_1__get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree__Entity[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__Entity[] = {
  {"tag", __pyx_getprop_4lxml_5etree_7_Entity_tag, 0, 0, 0},
  {"name", __pyx_getprop_4lxml_5etree_7_Entity_name, __pyx_setprop_4lxml_5etree_7_Entity_name, 0, 0},
  {"text", __pyx_getprop_4lxml_5etree_7_Entity_text, 0, 0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__Entity_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__Element},
  {Py_tp_repr, (void *)__pyx_pw_4lxml_5etree_7_Entity_1__repr__},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__Element},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__Entity},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree__Entity},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__Entity},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__Entity_spec = {
  "lxml.etree._Entity",
  sizeof(struct __pyx_obj_4lxml_5etree__Entity),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__Entity_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__Entity = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_Entity", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__Entity), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__Element, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  __pyx_pw_4lxml_5etree_7_Entity_1__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__Element, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_8_Element_41__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__Entity, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__Entity, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__Entity, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4lxml_5etree_QName(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree_QName *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_QName *)o);
  p->text = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->localname = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->__pyx_namespace = ((PyObject*)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_QName(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_QName *p = (struct __pyx_obj_4lxml_5etree_QName *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree_QName) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  Py_CLEAR(p->text);
  Py_CLEAR(p->localname);
  Py_CLEAR(p->__pyx_namespace);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static PyObject *__pyx_getprop_4lxml_5etree_5QName_text(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_5QName_4text_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_5QName_localname(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_5QName_9localname_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_5QName_namespace(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_5QName_9namespace_1__get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree_QName[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree_QName[] = {
  {"text", __pyx_getprop_4lxml_5etree_5QName_text, 0, 0, 0},
  {"localname", __pyx_getprop_4lxml_5etree_5QName_localname, 0, 0, 0},
  {"namespace", __pyx_getprop_4lxml_5etree_5QName_namespace, 0, 0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_QName_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_QName},
  {Py_tp_hash, (void *)__pyx_pw_4lxml_5etree_5QName_5__hash__},
  {Py_tp_str, (void *)__pyx_pw_4lxml_5etree_5QName_3__str__},
  {Py_tp_doc, (void *)PyDoc_STR("QName(text_or_uri_or_element, tag=None)\n\n    QName wrapper for qualified XML names.\n\n    Pass a tag name by itself or a namespace URI and a tag name to\n    create a qualified name.  Alternatively, pass an Element to\n    extract its tag name.  ``None`` as first argument is ignored in\n    order to allow for generic 2-argument usage.\n\n    The ``text`` property holds the qualified name in\n    ``{namespace}tagname`` notation.  The ``namespace`` and\n    ``localname`` properties hold the respective parts of the tag\n    name.\n\n    You can pass QName objects wherever a tag name is expected.  Also,\n    setting Element text from a QName will resolve the namespace prefix\n    on assignment and set a qualified text value.  This is helpful in XML\n    languages like SOAP or XML-Schema that use prefixed tag names in\n    their text content.\n    ")},
  {Py_tp_richcompare, (void *)__pyx_pw_4lxml_5etree_5QName_7__richcmp__},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_QName},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree_QName},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_5QName_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_QName},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_QName_spec = {
  "lxml.etree.QName",
  sizeof(struct __pyx_obj_4lxml_5etree_QName),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE,
  __pyx_type_4lxml_5etree_QName_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_QName = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""QName", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_QName), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_QName, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  __pyx_pw_4lxml_5etree_5QName_5__hash__, /*tp_hash*/
  0, /*tp_call*/
  __pyx_pw_4lxml_5etree_5QName_3__str__, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  PyDoc_STR("QName(text_or_uri_or_element, tag=None)\n\n    QName wrapper for qualified XML names.\n\n    Pass a tag name by itself or a namespace URI and a tag name to\n    create a qualified name.  Alternatively, pass an Element to\n    extract its tag name.  ``None`` as first argument is ignored in\n    order to allow for generic 2-argument usage.\n\n    The ``text`` property holds the qualified name in\n    ``{namespace}tagname`` notation.  The ``namespace`` and\n    ``localname`` properties hold the respective parts of the tag\n    name.\n\n    You can pass QName objects wherever a tag name is expected.  Also,\n    setting Element text from a QName will resolve the namespace prefix\n    on assignment and set a qualified text value.  This is helpful in XML\n    languages like SOAP or XML-Schema that use prefixed tag names in\n    their text content.\n    "), /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  __pyx_pw_4lxml_5etree_5QName_7__richcmp__, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_QName, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree_QName, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_4lxml_5etree_5QName_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_QName, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__ElementTree __pyx_vtable_4lxml_5etree__ElementTree;

static PyObject *__pyx_tp_new_4lxml_5etree__ElementTree(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct LxmlElementTree *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct LxmlElementTree *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__ElementTree;
  p->_doc = ((struct LxmlDocument *)Py_None); Py_INCREF(Py_None);
  p->_context_node = ((struct LxmlElement *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__ElementTree(PyObject *o) {
  struct LxmlElementTree *p = (struct LxmlElementTree *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree__ElementTree) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_doc);
  Py_CLEAR(p->_context_node);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_4lxml_5etree__ElementTree(PyObject *o, visitproc v, void *a) {
  int e;
  struct LxmlElementTree *p = (struct LxmlElementTree *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->_doc) {
    e = (*v)(((PyObject *)p->_doc), a); if (e) return e;
  }
  if (p->_context_node) {
    e = (*v)(((PyObject *)p->_context_node), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__ElementTree(PyObject *o) {
  struct LxmlElementTree *p = (struct LxmlElementTree *)o;
  Py_CLEAR(p->_doc);
  Py_CLEAR(p->_context_node);
  return 0;
}

static PyObject *__pyx_getprop_4lxml_5etree_12_ElementTree_docinfo(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_12_ElementTree_7docinfo_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_12_ElementTree_parser(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_12_ElementTree_6parser_1__get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree__ElementTree[] = {
  {"parse", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_1parse, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_parse},
  {"_setroot", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_3_setroot, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_2_setroot},
  {"getroot", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_5getroot, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_4getroot},
  {"__copy__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_7__copy__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__deepcopy__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_9__deepcopy__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"write", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_11write, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_10write},
  {"getpath", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_13getpath, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_12getpath},
  {"getelementpath", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_15getelementpath, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_14getelementpath},
  {"getiterator", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_17getiterator, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_16getiterator},
  {"iter", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_19iter, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_18iter},
  {"find", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_21find, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_20find},
  {"findtext", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_23findtext, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_22findtext},
  {"findall", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_25findall, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_24findall},
  {"iterfind", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_27iterfind, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_26iterfind},
  {"xpath", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_29xpath, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_28xpath},
  {"xslt", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_31xslt, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_30xslt},
  {"relaxng", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_33relaxng, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_32relaxng},
  {"xmlschema", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_35xmlschema, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_34xmlschema},
  {"xinclude", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_37xinclude, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_36xinclude},
  {"write_c14n", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_39write_c14n, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_38write_c14n},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__ElementTree[] = {
  {"docinfo", __pyx_getprop_4lxml_5etree_12_ElementTree_docinfo, 0, PyDoc_STR("Information about the document provided by parser and DTD."), 0},
  {"parser", __pyx_getprop_4lxml_5etree_12_ElementTree_parser, 0, PyDoc_STR("The parser that was used to parse the document in this ElementTree.\n        "), 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot LxmlElementTreeType_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__ElementTree},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__ElementTree},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__ElementTree},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__ElementTree},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree__ElementTree},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__ElementTree},
  {0, 0},
};
static PyType_Spec LxmlElementTreeType_spec = {
  "lxml.etree._ElementTree",
  sizeof(struct LxmlElementTree),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  LxmlElementTreeType_slots,
};
#else

DL_EXPORT(PyTypeObject) LxmlElementTreeType = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_ElementTree", /*tp_name*/
  sizeof(struct LxmlElementTree), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ElementTree, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ElementTree, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ElementTree, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__ElementTree, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__ElementTree, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__ElementTree, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4lxml_5etree__Attrib(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__Attrib *p;
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4lxml_5etree__Attrib > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Attrib, sizeof(struct __pyx_obj_4lxml_5etree__Attrib))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_4lxml_5etree__Attrib[--__pyx_mstate_global->__pyx_freecount_4lxml_5etree__Attrib];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_4lxml_5etree__Attrib));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_4lxml_5etree__Attrib *)o);
  p->_element = ((struct LxmlElement *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_7_Attrib_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_4lxml_5etree__Attrib(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__Attrib *p = (struct __pyx_obj_4lxml_5etree__Attrib *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_element);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4lxml_5etree__Attrib < 16) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Attrib, sizeof(struct __pyx_obj_4lxml_5etree__Attrib))))
  {
    __pyx_mstate_global->__pyx_freelist_4lxml_5etree__Attrib[__pyx_mstate_global->__pyx_freecount_4lxml_5etree__Attrib++] = ((struct __pyx_obj_4lxml_5etree__Attrib *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_4lxml_5etree__Attrib(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__Attrib *p = (struct __pyx_obj_4lxml_5etree__Attrib *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->_element) {
    e = (*v)(((PyObject *)p->_element), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__Attrib(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__Attrib *p = (struct __pyx_obj_4lxml_5etree__Attrib *)o;
  Py_CLEAR(p->_element);
  return 0;
}

static PyObject *__pyx_sq_item_4lxml_5etree__Attrib(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyLong_FromSsize_t(i); if(!x) return 0;
  #if CYTHON_USE_TYPE_SLOTS || (!CYTHON_USE_TYPE_SPECS && __PYX_LIMITED_VERSION_HEX < 0x030A0000)
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  #else
  r = ((binaryfunc)PyType_GetSlot(Py_TYPE(o), Py_mp_subscript))(o, x);
  #endif
  Py_DECREF(x);
  return r;
}

static int __pyx_mp_ass_subscript_4lxml_5etree__Attrib(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_pw_4lxml_5etree_7_Attrib_3__setitem__(o, i, v);
  }
  else {
    return __pyx_pw_4lxml_5etree_7_Attrib_5__delitem__(o, i);
  }
}

static PyMethodDef __pyx_methods_4lxml_5etree__Attrib[] = {
  {"update", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_Attrib_7update, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"pop", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_Attrib_9pop, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"clear", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_Attrib_11clear, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__copy__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_Attrib_15__copy__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__deepcopy__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_Attrib_17__deepcopy__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"get", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_Attrib_25get, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"keys", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_Attrib_27keys, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"iterkeys", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_Attrib_31iterkeys, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"values", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_Attrib_33values, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"itervalues", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_Attrib_35itervalues, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"items", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_Attrib_37items, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"iteritems", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_Attrib_39iteritems, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"has_key", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_Attrib_41has_key, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__Attrib_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__Attrib},
  {Py_tp_repr, (void *)__pyx_pw_4lxml_5etree_7_Attrib_13__repr__},
  {Py_nb_bool, (void *)__pyx_pw_4lxml_5etree_7_Attrib_21__bool__},
  {Py_sq_length, (void *)__pyx_pw_4lxml_5etree_7_Attrib_23__len__},
  {Py_sq_item, (void *)__pyx_sq_item_4lxml_5etree__Attrib},
  {Py_sq_contains, (void *)__pyx_pw_4lxml_5etree_7_Attrib_43__contains__},
  {Py_mp_length, (void *)__pyx_pw_4lxml_5etree_7_Attrib_23__len__},
  {Py_mp_subscript, (void *)__pyx_pw_4lxml_5etree_7_Attrib_19__getitem__},
  {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_4lxml_5etree__Attrib},
  {Py_tp_doc, (void *)PyDoc_STR("A dict-like proxy for the ``Element.attrib`` property.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__Attrib},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__Attrib},
  {Py_tp_richcompare, (void *)__pyx_pw_4lxml_5etree_7_Attrib_45__richcmp__},
  {Py_tp_iter, (void *)__pyx_pw_4lxml_5etree_7_Attrib_29__iter__},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__Attrib},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__Attrib},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__Attrib_spec = {
  "lxml.etree._Attrib",
  sizeof(struct __pyx_obj_4lxml_5etree__Attrib),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__Attrib_slots,
};
#else

static PyNumberMethods __pyx_tp_as_number__Attrib = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  __pyx_pw_4lxml_5etree_7_Attrib_21__bool__, /*nb_bool*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  0, /*nb_int*/
  0, /*nb_long (reserved)*/
  0, /*nb_float*/
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  0, /*nb_index*/
  0, /*nb_matrix_multiply*/
  0, /*nb_inplace_matrix_multiply*/
};

static PySequenceMethods __pyx_tp_as_sequence__Attrib = {
  __pyx_pw_4lxml_5etree_7_Attrib_23__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_4lxml_5etree__Attrib, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  __pyx_pw_4lxml_5etree_7_Attrib_43__contains__, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__Attrib = {
  __pyx_pw_4lxml_5etree_7_Attrib_23__len__, /*mp_length*/
  __pyx_pw_4lxml_5etree_7_Attrib_19__getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_4lxml_5etree__Attrib, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_4lxml_5etree__Attrib = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_Attrib", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__Attrib), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__Attrib, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  __pyx_pw_4lxml_5etree_7_Attrib_13__repr__, /*tp_repr*/
  &__pyx_tp_as_number__Attrib, /*tp_as_number*/
  &__pyx_tp_as_sequence__Attrib, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__Attrib, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("A dict-like proxy for the ``Element.attrib`` property.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__Attrib, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__Attrib, /*tp_clear*/
  __pyx_pw_4lxml_5etree_7_Attrib_45__richcmp__, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_4lxml_5etree_7_Attrib_29__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__Attrib, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__Attrib, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4lxml_5etree__AttribIterator(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree__AttribIterator *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 1);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__AttribIterator *)o);
  p->_node = ((struct LxmlElement *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__AttribIterator(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__AttribIterator *p = (struct __pyx_obj_4lxml_5etree__AttribIterator *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_node);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_4lxml_5etree__AttribIterator(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__AttribIterator *p = (struct __pyx_obj_4lxml_5etree__AttribIterator *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->_node) {
    e = (*v)(((PyObject *)p->_node), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__AttribIterator(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__AttribIterator *p = (struct __pyx_obj_4lxml_5etree__AttribIterator *)o;
  Py_CLEAR(p->_node);
  return 0;
}

static PyObject *__pyx_specialmethod___pyx_pw_4lxml_5etree_15_AttribIterator_3__next__(PyObject *self, CYTHON_UNUSED PyObject *arg) {
  PyObject *res = __pyx_pw_4lxml_5etree_15_AttribIterator_3__next__(self);
  if (!res && !PyErr_Occurred()) { PyErr_SetNone(PyExc_StopIteration); }
  return res;
}

static PyMethodDef __pyx_methods_4lxml_5etree__AttribIterator[] = {
  {"__next__", (PyCFunction)__pyx_specialmethod___pyx_pw_4lxml_5etree_15_AttribIterator_3__next__, METH_NOARGS|METH_COEXIST, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__AttribIterator_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__AttribIterator},
  {Py_tp_doc, (void *)PyDoc_STR("Attribute iterator - for internal use only!\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__AttribIterator},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__AttribIterator},
  {Py_tp_iter, (void *)__pyx_pw_4lxml_5etree_15_AttribIterator_1__iter__},
  {Py_tp_iternext, (void *)__pyx_pw_4lxml_5etree_15_AttribIterator_3__next__},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__AttribIterator},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__AttribIterator},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__AttribIterator_spec = {
  "lxml.etree._AttribIterator",
  sizeof(struct __pyx_obj_4lxml_5etree__AttribIterator),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__AttribIterator_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__AttribIterator = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_AttribIterator", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__AttribIterator), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__AttribIterator, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("Attribute iterator - for internal use only!\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__AttribIterator, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__AttribIterator, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_4lxml_5etree_15_AttribIterator_1__iter__, /*tp_iter*/
  __pyx_pw_4lxml_5etree_15_AttribIterator_3__next__, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__AttribIterator, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__AttribIterator, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__ElementTagMatcher __pyx_vtable_4lxml_5etree__ElementTagMatcher;

static PyObject *__pyx_tp_new_4lxml_5etree__ElementTagMatcher(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct LxmlElementTagMatcher *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct LxmlElementTagMatcher *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__ElementTagMatcher;
  p->_pystrings = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__ElementTagMatcher(PyObject *o) {
  struct LxmlElementTagMatcher *p = (struct LxmlElementTagMatcher *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree__ElementTagMatcher) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_pystrings);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_4lxml_5etree__ElementTagMatcher(PyObject *o, visitproc v, void *a) {
  int e;
  struct LxmlElementTagMatcher *p = (struct LxmlElementTagMatcher *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->_pystrings) {
    e = (*v)(p->_pystrings, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__ElementTagMatcher(PyObject *o) {
  struct LxmlElementTagMatcher *p = (struct LxmlElementTagMatcher *)o;
  Py_CLEAR(p->_pystrings);
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot LxmlElementTagMatcherType_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__ElementTagMatcher},
  {Py_tp_doc, (void *)PyDoc_STR("\n    Dead but public. :)\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__ElementTagMatcher},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__ElementTagMatcher},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__ElementTagMatcher},
  {0, 0},
};
static PyType_Spec LxmlElementTagMatcherType_spec = {
  "lxml.etree._ElementTagMatcher",
  sizeof(struct LxmlElementTagMatcher),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  LxmlElementTagMatcherType_slots,
};
#else

DL_EXPORT(PyTypeObject) LxmlElementTagMatcherType = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_ElementTagMatcher", /*tp_name*/
  sizeof(struct LxmlElementTagMatcher), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ElementTagMatcher, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("\n    Dead but public. :)\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ElementTagMatcher, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ElementTagMatcher, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__ElementTagMatcher, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__ElementIterator __pyx_vtable_4lxml_5etree__ElementIterator;

static PyObject *__pyx_tp_new_4lxml_5etree__ElementIterator(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct LxmlElementIterator *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ElementTagMatcher(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct LxmlElementIterator *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__ElementTagMatcher*)__pyx_vtabptr_4lxml_5etree__ElementIterator;
  p->_node = ((struct LxmlElement *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__ElementIterator(PyObject *o) {
  struct LxmlElementIterator *p = (struct LxmlElementIterator *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree__ElementIterator) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_node);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_4lxml_5etree__ElementTagMatcher(o);
}

static int __pyx_tp_traverse_4lxml_5etree__ElementIterator(PyObject *o, visitproc v, void *a) {
  int e;
  struct LxmlElementIterator *p = (struct LxmlElementIterator *)o;
  e = __pyx_tp_traverse_4lxml_5etree__ElementTagMatcher(o, v, a); if (e) return e;
  if (p->_node) {
    e = (*v)(((PyObject *)p->_node), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__ElementIterator(PyObject *o) {
  struct LxmlElementIterator *p = (struct LxmlElementIterator *)o;
  __pyx_tp_clear_4lxml_5etree__ElementTagMatcher(o);
  Py_CLEAR(p->_node);
  return 0;
}

static PyObject *__pyx_specialmethod___pyx_pw_4lxml_5etree_16_ElementIterator_3__next__(PyObject *self, CYTHON_UNUSED PyObject *arg) {
  PyObject *res = __pyx_pw_4lxml_5etree_16_ElementIterator_3__next__(self);
  if (!res && !PyErr_Occurred()) { PyErr_SetNone(PyExc_StopIteration); }
  return res;
}

static PyMethodDef __pyx_methods_4lxml_5etree__ElementIterator[] = {
  {"__next__", (PyCFunction)__pyx_specialmethod___pyx_pw_4lxml_5etree_16_ElementIterator_3__next__, METH_NOARGS|METH_COEXIST, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot LxmlElementIteratorType_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__ElementIterator},
  {Py_tp_doc, (void *)PyDoc_STR("\n    Dead but public. :)\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__ElementIterator},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__ElementIterator},
  {Py_tp_iter, (void *)__pyx_pw_4lxml_5etree_16_ElementIterator_1__iter__},
  {Py_tp_iternext, (void *)__pyx_pw_4lxml_5etree_16_ElementIterator_3__next__},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__ElementIterator},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__ElementIterator},
  {0, 0},
};
static PyType_Spec LxmlElementIteratorType_spec = {
  "lxml.etree._ElementIterator",
  sizeof(struct LxmlElementIterator),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  LxmlElementIteratorType_slots,
};
#else

DL_EXPORT(PyTypeObject) LxmlElementIteratorType = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_ElementIterator", /*tp_name*/
  sizeof(struct LxmlElementIterator), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ElementIterator, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("\n    Dead but public. :)\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ElementIterator, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ElementIterator, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_4lxml_5etree_16_ElementIterator_1__iter__, /*tp_iter*/
  __pyx_pw_4lxml_5etree_16_ElementIterator_3__next__, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__ElementIterator, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__ElementIterator, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__MultiTagMatcher __pyx_vtable_4lxml_5etree__MultiTagMatcher;

static PyObject *__pyx_tp_new_4lxml_5etree__MultiTagMatcher(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__MultiTagMatcher *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 1);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__MultiTagMatcher *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__MultiTagMatcher;
  p->_py_tags = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_cached_doc = ((struct LxmlDocument *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_16_MultiTagMatcher_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_4lxml_5etree__MultiTagMatcher(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__MultiTagMatcher *p = (struct __pyx_obj_4lxml_5etree__MultiTagMatcher *)o;
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_4lxml_5etree_16_MultiTagMatcher_3__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->_py_tags);
  Py_CLEAR(p->_cached_doc);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_4lxml_5etree__MultiTagMatcher(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__MultiTagMatcher *p = (struct __pyx_obj_4lxml_5etree__MultiTagMatcher *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->_py_tags) {
    e = (*v)(p->_py_tags, a); if (e) return e;
  }
  if (p->_cached_doc) {
    e = (*v)(((PyObject *)p->_cached_doc), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__MultiTagMatcher(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__MultiTagMatcher *p = (struct __pyx_obj_4lxml_5etree__MultiTagMatcher *)o;
  Py_CLEAR(p->_py_tags);
  Py_CLEAR(p->_cached_doc);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__MultiTagMatcher[] = {
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__MultiTagMatcher_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__MultiTagMatcher},
  {Py_tp_doc, (void *)PyDoc_STR("\n    Match an xmlNode against a list of tags.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__MultiTagMatcher},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__MultiTagMatcher},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__MultiTagMatcher},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__MultiTagMatcher},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__MultiTagMatcher_spec = {
  "lxml.etree._MultiTagMatcher",
  sizeof(struct __pyx_obj_4lxml_5etree__MultiTagMatcher),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__MultiTagMatcher_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__MultiTagMatcher = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_MultiTagMatcher", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__MultiTagMatcher), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__MultiTagMatcher, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("\n    Match an xmlNode against a list of tags.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__MultiTagMatcher, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__MultiTagMatcher, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__MultiTagMatcher, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__MultiTagMatcher, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__ElementMatchIterator __pyx_vtable_4lxml_5etree__ElementMatchIterator;

static PyObject *__pyx_tp_new_4lxml_5etree__ElementMatchIterator(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ElementMatchIterator *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ElementMatchIterator *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__ElementMatchIterator;
  p->_node = ((struct LxmlElement *)Py_None); Py_INCREF(Py_None);
  p->_matcher = ((struct __pyx_obj_4lxml_5etree__MultiTagMatcher *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__ElementMatchIterator(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ElementMatchIterator *p = (struct __pyx_obj_4lxml_5etree__ElementMatchIterator *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree__ElementMatchIterator) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_node);
  Py_CLEAR(p->_matcher);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_4lxml_5etree__ElementMatchIterator(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__ElementMatchIterator *p = (struct __pyx_obj_4lxml_5etree__ElementMatchIterator *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->_node) {
    e = (*v)(((PyObject *)p->_node), a); if (e) return e;
  }
  if (p->_matcher) {
    e = (*v)(((PyObject *)p->_matcher), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__ElementMatchIterator(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ElementMatchIterator *p = (struct __pyx_obj_4lxml_5etree__ElementMatchIterator *)o;
  Py_CLEAR(p->_node);
  Py_CLEAR(p->_matcher);
  return 0;
}

static PyObject *__pyx_specialmethod___pyx_pw_4lxml_5etree_21_ElementMatchIterator_3__next__(PyObject *self, CYTHON_UNUSED PyObject *arg) {
  PyObject *res = __pyx_pw_4lxml_5etree_21_ElementMatchIterator_3__next__(self);
  if (!res && !PyErr_Occurred()) { PyErr_SetNone(PyExc_StopIteration); }
  return res;
}

static PyMethodDef __pyx_methods_4lxml_5etree__ElementMatchIterator[] = {
  {"__next__", (PyCFunction)__pyx_specialmethod___pyx_pw_4lxml_5etree_21_ElementMatchIterator_3__next__, METH_NOARGS|METH_COEXIST, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__ElementMatchIterator_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__ElementMatchIterator},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__ElementMatchIterator},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__ElementMatchIterator},
  {Py_tp_iter, (void *)__pyx_pw_4lxml_5etree_21_ElementMatchIterator_1__iter__},
  {Py_tp_iternext, (void *)__pyx_pw_4lxml_5etree_21_ElementMatchIterator_3__next__},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__ElementMatchIterator},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__ElementMatchIterator},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__ElementMatchIterator_spec = {
  "lxml.etree._ElementMatchIterator",
  sizeof(struct __pyx_obj_4lxml_5etree__ElementMatchIterator),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__ElementMatchIterator_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__ElementMatchIterator = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_ElementMatchIterator", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ElementMatchIterator), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ElementMatchIterator, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ElementMatchIterator, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ElementMatchIterator, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_4lxml_5etree_21_ElementMatchIterator_1__iter__, /*tp_iter*/
  __pyx_pw_4lxml_5etree_21_ElementMatchIterator_3__next__, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__ElementMatchIterator, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__ElementMatchIterator, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree_ElementChildIterator __pyx_vtable_4lxml_5etree_ElementChildIterator;

static PyObject *__pyx_tp_new_4lxml_5etree_ElementChildIterator(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_ElementChildIterator *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ElementMatchIterator(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_ElementChildIterator *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__ElementMatchIterator*)__pyx_vtabptr_4lxml_5etree_ElementChildIterator;
  if (unlikely(__pyx_pw_4lxml_5etree_20ElementChildIterator_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static PyMethodDef __pyx_methods_4lxml_5etree_ElementChildIterator[] = {
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_ElementChildIterator_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__ElementMatchIterator},
  {Py_tp_doc, (void *)PyDoc_STR("ElementChildIterator(self, node, tag=None, reversed=False)\n    Iterates over the children of an element.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__ElementMatchIterator},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__ElementMatchIterator},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_ElementChildIterator},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_ElementChildIterator},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_ElementChildIterator_spec = {
  "lxml.etree.ElementChildIterator",
  sizeof(struct __pyx_obj_4lxml_5etree_ElementChildIterator),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_ElementChildIterator_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_ElementChildIterator = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""ElementChildIterator", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_ElementChildIterator), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ElementMatchIterator, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("ElementChildIterator(self, node, tag=None, reversed=False)\n    Iterates over the children of an element.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ElementMatchIterator, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ElementMatchIterator, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_21_ElementMatchIterator_1__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_21_ElementMatchIterator_3__next__, /*tp_iternext*/
  #else
  0, /*tp_iternext*/
  #endif
  __pyx_methods_4lxml_5etree_ElementChildIterator, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_ElementChildIterator, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree_SiblingsIterator __pyx_vtable_4lxml_5etree_SiblingsIterator;

static PyObject *__pyx_tp_new_4lxml_5etree_SiblingsIterator(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_SiblingsIterator *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ElementMatchIterator(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_SiblingsIterator *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__ElementMatchIterator*)__pyx_vtabptr_4lxml_5etree_SiblingsIterator;
  if (unlikely(__pyx_pw_4lxml_5etree_16SiblingsIterator_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static PyMethodDef __pyx_methods_4lxml_5etree_SiblingsIterator[] = {
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_SiblingsIterator_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__ElementMatchIterator},
  {Py_tp_doc, (void *)PyDoc_STR("SiblingsIterator(self, node, tag=None, preceding=False)\n    Iterates over the siblings of an element.\n\n    You can pass the boolean keyword ``preceding`` to specify the direction.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__ElementMatchIterator},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__ElementMatchIterator},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_SiblingsIterator},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_SiblingsIterator},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_SiblingsIterator_spec = {
  "lxml.etree.SiblingsIterator",
  sizeof(struct __pyx_obj_4lxml_5etree_SiblingsIterator),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_SiblingsIterator_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_SiblingsIterator = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""SiblingsIterator", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_SiblingsIterator), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ElementMatchIterator, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("SiblingsIterator(self, node, tag=None, preceding=False)\n    Iterates over the siblings of an element.\n\n    You can pass the boolean keyword ``preceding`` to specify the direction.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ElementMatchIterator, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ElementMatchIterator, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_21_ElementMatchIterator_1__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_21_ElementMatchIterator_3__next__, /*tp_iternext*/
  #else
  0, /*tp_iternext*/
  #endif
  __pyx_methods_4lxml_5etree_SiblingsIterator, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_SiblingsIterator, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree_AncestorsIterator __pyx_vtable_4lxml_5etree_AncestorsIterator;

static PyObject *__pyx_tp_new_4lxml_5etree_AncestorsIterator(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_AncestorsIterator *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ElementMatchIterator(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_AncestorsIterator *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__ElementMatchIterator*)__pyx_vtabptr_4lxml_5etree_AncestorsIterator;
  if (unlikely(__pyx_pw_4lxml_5etree_17AncestorsIterator_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static PyMethodDef __pyx_methods_4lxml_5etree_AncestorsIterator[] = {
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_AncestorsIterator_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__ElementMatchIterator},
  {Py_tp_doc, (void *)PyDoc_STR("AncestorsIterator(self, node, tag=None)\n    Iterates over the ancestors of an element (from parent to parent).\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__ElementMatchIterator},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__ElementMatchIterator},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_AncestorsIterator},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_AncestorsIterator},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_AncestorsIterator_spec = {
  "lxml.etree.AncestorsIterator",
  sizeof(struct __pyx_obj_4lxml_5etree_AncestorsIterator),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_AncestorsIterator_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_AncestorsIterator = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""AncestorsIterator", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_AncestorsIterator), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ElementMatchIterator, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("AncestorsIterator(self, node, tag=None)\n    Iterates over the ancestors of an element (from parent to parent).\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ElementMatchIterator, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ElementMatchIterator, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_21_ElementMatchIterator_1__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_21_ElementMatchIterator_3__next__, /*tp_iternext*/
  #else
  0, /*tp_iternext*/
  #endif
  __pyx_methods_4lxml_5etree_AncestorsIterator, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_AncestorsIterator, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree_ElementDepthFirstIterator __pyx_vtable_4lxml_5etree_ElementDepthFirstIterator;

static PyObject *__pyx_tp_new_4lxml_5etree_ElementDepthFirstIterator(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree_ElementDepthFirstIterator;
  p->_next_node = ((struct LxmlElement *)Py_None); Py_INCREF(Py_None);
  p->_top_node = ((struct LxmlElement *)Py_None); Py_INCREF(Py_None);
  p->_matcher = ((struct __pyx_obj_4lxml_5etree__MultiTagMatcher *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_25ElementDepthFirstIterator_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_4lxml_5etree_ElementDepthFirstIterator(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *p = (struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree_ElementDepthFirstIterator) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_next_node);
  Py_CLEAR(p->_top_node);
  Py_CLEAR(p->_matcher);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_4lxml_5etree_ElementDepthFirstIterator(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *p = (struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->_next_node) {
    e = (*v)(((PyObject *)p->_next_node), a); if (e) return e;
  }
  if (p->_top_node) {
    e = (*v)(((PyObject *)p->_top_node), a); if (e) return e;
  }
  if (p->_matcher) {
    e = (*v)(((PyObject *)p->_matcher), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree_ElementDepthFirstIterator(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *p = (struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *)o;
  Py_CLEAR(p->_next_node);
  Py_CLEAR(p->_top_node);
  Py_CLEAR(p->_matcher);
  return 0;
}

static PyObject *__pyx_specialmethod___pyx_pw_4lxml_5etree_25ElementDepthFirstIterator_5__next__(PyObject *self, CYTHON_UNUSED PyObject *arg) {
  PyObject *res = __pyx_pw_4lxml_5etree_25ElementDepthFirstIterator_5__next__(self);
  if (!res && !PyErr_Occurred()) { PyErr_SetNone(PyExc_StopIteration); }
  return res;
}

static PyMethodDef __pyx_methods_4lxml_5etree_ElementDepthFirstIterator[] = {
  {"__next__", (PyCFunction)__pyx_specialmethod___pyx_pw_4lxml_5etree_25ElementDepthFirstIterator_5__next__, METH_NOARGS|METH_COEXIST, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_ElementDepthFirstIterator_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_ElementDepthFirstIterator},
  {Py_tp_doc, (void *)PyDoc_STR("ElementDepthFirstIterator(self, node, tag=None, inclusive=True)\n    Iterates over an element and its sub-elements in document order (depth\n    first pre-order).\n\n    Note that this also includes comments, entities and processing\n    instructions.  To filter them out, check if the ``tag`` property\n    of the returned element is a string (i.e. not None and not a\n    factory function), or pass the ``Element`` factory for the ``tag``\n    argument to receive only Elements.\n\n    If the optional ``tag`` argument is not None, the iterator returns only\n    the elements that match the respective name and namespace.\n\n    The optional boolean argument 'inclusive' defaults to True and can be set\n    to False to exclude the start element itself.\n\n    Note that the behaviour of this iterator is completely undefined if the\n    tree it traverses is modified during iteration.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_ElementDepthFirstIterator},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_ElementDepthFirstIterator},
  {Py_tp_iter, (void *)__pyx_pw_4lxml_5etree_25ElementDepthFirstIterator_3__iter__},
  {Py_tp_iternext, (void *)__pyx_pw_4lxml_5etree_25ElementDepthFirstIterator_5__next__},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_ElementDepthFirstIterator},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_ElementDepthFirstIterator},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_ElementDepthFirstIterator_spec = {
  "lxml.etree.ElementDepthFirstIterator",
  sizeof(struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_ElementDepthFirstIterator_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_ElementDepthFirstIterator = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""ElementDepthFirstIterator", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_ElementDepthFirstIterator, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("ElementDepthFirstIterator(self, node, tag=None, inclusive=True)\n    Iterates over an element and its sub-elements in document order (depth\n    first pre-order).\n\n    Note that this also includes comments, entities and processing\n    instructions.  To filter them out, check if the ``tag`` property\n    of the returned element is a string (i.e. not None and not a\n    factory function), or pass the ``Element`` factory for the ``tag``\n    argument to receive only Elements.\n\n    If the optional ``tag`` argument is not None, the iterator returns only\n    the elements that match the respective name and namespace.\n\n    The optional boolean argument 'inclusive' defaults to True and can be set\n    to False to exclude the start element itself.\n\n    Note that the behaviour of this iterator is completely undefined if the\n    tree it traverses is modified during iteration.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_ElementDepthFirstIterator, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_ElementDepthFirstIterator, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_4lxml_5etree_25ElementDepthFirstIterator_3__iter__, /*tp_iter*/
  __pyx_pw_4lxml_5etree_25ElementDepthFirstIterator_5__next__, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_ElementDepthFirstIterator, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_ElementDepthFirstIterator, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4lxml_5etree_ElementTextIterator(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_ElementTextIterator *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_ElementTextIterator *)o);
  p->_events = Py_None; Py_INCREF(Py_None);
  p->_start_element = ((struct LxmlElement *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_19ElementTextIterator_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_4lxml_5etree_ElementTextIterator(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_ElementTextIterator *p = (struct __pyx_obj_4lxml_5etree_ElementTextIterator *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree_ElementTextIterator) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_events);
  Py_CLEAR(p->_start_element);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_4lxml_5etree_ElementTextIterator(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree_ElementTextIterator *p = (struct __pyx_obj_4lxml_5etree_ElementTextIterator *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->_events) {
    e = (*v)(p->_events, a); if (e) return e;
  }
  if (p->_start_element) {
    e = (*v)(((PyObject *)p->_start_element), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree_ElementTextIterator(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_ElementTextIterator *p = (struct __pyx_obj_4lxml_5etree_ElementTextIterator *)o;
  Py_CLEAR(p->_events);
  Py_CLEAR(p->_start_element);
  return 0;
}

static PyObject *__pyx_specialmethod___pyx_pw_4lxml_5etree_19ElementTextIterator_5__next__(PyObject *self, CYTHON_UNUSED PyObject *arg) {
  PyObject *res = __pyx_pw_4lxml_5etree_19ElementTextIterator_5__next__(self);
  if (!res && !PyErr_Occurred()) { PyErr_SetNone(PyExc_StopIteration); }
  return res;
}

static PyMethodDef __pyx_methods_4lxml_5etree_ElementTextIterator[] = {
  {"__next__", (PyCFunction)__pyx_specialmethod___pyx_pw_4lxml_5etree_19ElementTextIterator_5__next__, METH_NOARGS|METH_COEXIST, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_ElementTextIterator_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_ElementTextIterator},
  {Py_tp_doc, (void *)PyDoc_STR("ElementTextIterator(self, element, tag=None, with_tail=True)\n    Iterates over the text content of a subtree.\n\n    You can pass the ``tag`` keyword argument to restrict text content to a\n    specific tag name.\n\n    You can set the ``with_tail`` keyword argument to ``False`` to skip over\n    tail text (e.g. if you know that it's only whitespace from pretty-printing).\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_ElementTextIterator},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_ElementTextIterator},
  {Py_tp_iter, (void *)__pyx_pw_4lxml_5etree_19ElementTextIterator_3__iter__},
  {Py_tp_iternext, (void *)__pyx_pw_4lxml_5etree_19ElementTextIterator_5__next__},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_ElementTextIterator},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_ElementTextIterator},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_ElementTextIterator_spec = {
  "lxml.etree.ElementTextIterator",
  sizeof(struct __pyx_obj_4lxml_5etree_ElementTextIterator),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_ElementTextIterator_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_ElementTextIterator = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""ElementTextIterator", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_ElementTextIterator), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_ElementTextIterator, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("ElementTextIterator(self, element, tag=None, with_tail=True)\n    Iterates over the text content of a subtree.\n\n    You can pass the ``tag`` keyword argument to restrict text content to a\n    specific tag name.\n\n    You can set the ``with_tail`` keyword argument to ``False`` to skip over\n    tail text (e.g. if you know that it's only whitespace from pretty-printing).\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_ElementTextIterator, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_ElementTextIterator, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_4lxml_5etree_19ElementTextIterator_3__iter__, /*tp_iter*/
  __pyx_pw_4lxml_5etree_19ElementTextIterator_5__next__, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_ElementTextIterator, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_ElementTextIterator, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4lxml_5etree_CDATA(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_CDATA *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_CDATA *)o);
  p->_utf8_data = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_5CDATA_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_4lxml_5etree_CDATA(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_CDATA *p = (struct __pyx_obj_4lxml_5etree_CDATA *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree_CDATA) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  Py_CLEAR(p->_utf8_data);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static PyMethodDef __pyx_methods_4lxml_5etree_CDATA[] = {
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_CDATA_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_CDATA},
  {Py_tp_doc, (void *)PyDoc_STR("CDATA(data)\n\n    CDATA factory.  This factory creates an opaque data object that\n    can be used to set Element text.  The usual way to use it is::\n\n        >>> el = Element('content')\n        >>> el.text = CDATA('a string')\n\n        >>> print(el.text)\n        a string\n        >>> print(tostring(el, encoding=\"unicode\"))\n        <content><![CDATA[a string]]></content>\n    ")},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_CDATA},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_CDATA},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_CDATA_spec = {
  "lxml.etree.CDATA",
  sizeof(struct __pyx_obj_4lxml_5etree_CDATA),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE,
  __pyx_type_4lxml_5etree_CDATA_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_CDATA = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""CDATA", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_CDATA), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_CDATA, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  PyDoc_STR("CDATA(data)\n\n    CDATA factory.  This factory creates an opaque data object that\n    can be used to set Element text.  The usual way to use it is::\n\n        >>> el = Element('content')\n        >>> el.text = CDATA('a string')\n\n        >>> print(el.text)\n        a string\n        >>> print(tostring(el, encoding=\"unicode\"))\n        <content><![CDATA[a string]]></content>\n    "), /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_CDATA, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_CDATA, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy __pyx_vtable_4lxml_5etree__ReadOnlyProxy;

static PyObject *__pyx_tp_new_4lxml_5etree__ReadOnlyProxy(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__ReadOnlyProxy;
  p->_source_proxy = ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)Py_None); Py_INCREF(Py_None);
  p->_dependent_proxies = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_1__cinit__(o, __pyx_mstate_global->__pyx_empty_tuple, NULL) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_4lxml_5etree__ReadOnlyProxy(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *p = (struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree__ReadOnlyProxy) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_source_proxy);
  Py_CLEAR(p->_dependent_proxies);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_4lxml_5etree__ReadOnlyProxy(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *p = (struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->_source_proxy) {
    e = (*v)(((PyObject *)p->_source_proxy), a); if (e) return e;
  }
  if (p->_dependent_proxies) {
    e = (*v)(p->_dependent_proxies, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__ReadOnlyProxy(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *p = (struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)o;
  Py_CLEAR(p->_source_proxy);
  Py_CLEAR(p->_dependent_proxies);
  return 0;
}

static PyObject *__pyx_sq_item_4lxml_5etree__ReadOnlyProxy(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyLong_FromSsize_t(i); if(!x) return 0;
  #if CYTHON_USE_TYPE_SLOTS || (!CYTHON_USE_TYPE_SPECS && __PYX_LIMITED_VERSION_HEX < 0x030A0000)
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  #else
  r = ((binaryfunc)PyType_GetSlot(Py_TYPE(o), Py_mp_subscript))(o, x);
  #endif
  Py_DECREF(x);
  return r;
}

static PyObject *__pyx_getprop_4lxml_5etree_14_ReadOnlyProxy_tag(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_3tag_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_14_ReadOnlyProxy_text(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_4text_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_14_ReadOnlyProxy_tail(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_4tail_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_14_ReadOnlyProxy_sourceline(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_10sourceline_1__get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree__ReadOnlyProxy[] = {
  {"__deepcopy__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_11__deepcopy__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_14_ReadOnlyProxy_10__deepcopy__},
  {"iterchildren", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_17iterchildren, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_14_ReadOnlyProxy_16iterchildren},
  {"getparent", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_21getparent, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_14_ReadOnlyProxy_20getparent},
  {"getnext", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_23getnext, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_14_ReadOnlyProxy_22getnext},
  {"getprevious", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_25getprevious, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_14_ReadOnlyProxy_24getprevious},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__ReadOnlyProxy[] = {
  {"tag", __pyx_getprop_4lxml_5etree_14_ReadOnlyProxy_tag, 0, PyDoc_STR("Element tag\n        "), 0},
  {"text", __pyx_getprop_4lxml_5etree_14_ReadOnlyProxy_text, 0, PyDoc_STR("Text before the first subelement. This is either a string or\n        the value None, if there was no text.\n        "), 0},
  {"tail", __pyx_getprop_4lxml_5etree_14_ReadOnlyProxy_tail, 0, PyDoc_STR("Text after this element's end tag, but before the next sibling\n        element's start tag. This is either a string or the value None, if\n        there was no text.\n        "), 0},
  {"sourceline", __pyx_getprop_4lxml_5etree_14_ReadOnlyProxy_sourceline, 0, PyDoc_STR("Original line number as found by the parser or None if unknown.\n        "), 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__ReadOnlyProxy_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__ReadOnlyProxy},
  {Py_tp_repr, (void *)__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_3__repr__},
  {Py_nb_bool, (void *)__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_9__bool__},
  {Py_sq_length, (void *)__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_7__len__},
  {Py_sq_item, (void *)__pyx_sq_item_4lxml_5etree__ReadOnlyProxy},
  {Py_mp_length, (void *)__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_7__len__},
  {Py_mp_subscript, (void *)__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_5__getitem__},
  {Py_tp_doc, (void *)PyDoc_STR("A read-only proxy class suitable for PIs/Comments (for internal use only!).")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__ReadOnlyProxy},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__ReadOnlyProxy},
  {Py_tp_iter, (void *)__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_15__iter__},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__ReadOnlyProxy},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree__ReadOnlyProxy},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__ReadOnlyProxy},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__ReadOnlyProxy_spec = {
  "lxml.etree._ReadOnlyProxy",
  sizeof(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__ReadOnlyProxy_slots,
};
#else

static PyNumberMethods __pyx_tp_as_number__ReadOnlyProxy = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_9__bool__, /*nb_bool*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  0, /*nb_int*/
  0, /*nb_long (reserved)*/
  0, /*nb_float*/
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  0, /*nb_index*/
  0, /*nb_matrix_multiply*/
  0, /*nb_inplace_matrix_multiply*/
};

static PySequenceMethods __pyx_tp_as_sequence__ReadOnlyProxy = {
  __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_7__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_4lxml_5etree__ReadOnlyProxy, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__ReadOnlyProxy = {
  __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_7__len__, /*mp_length*/
  __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_5__getitem__, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_4lxml_5etree__ReadOnlyProxy = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_ReadOnlyProxy", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ReadOnlyProxy, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_3__repr__, /*tp_repr*/
  &__pyx_tp_as_number__ReadOnlyProxy, /*tp_as_number*/
  &__pyx_tp_as_sequence__ReadOnlyProxy, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__ReadOnlyProxy, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("A read-only proxy class suitable for PIs/Comments (for internal use only!)."), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ReadOnlyProxy, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ReadOnlyProxy, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_15__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__ReadOnlyProxy, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__ReadOnlyProxy, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__ReadOnlyProxy, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyPIProxy __pyx_vtable_4lxml_5etree__ReadOnlyPIProxy;

static PyObject *__pyx_tp_new_4lxml_5etree__ReadOnlyPIProxy(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ReadOnlyPIProxy *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ReadOnlyProxy(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ReadOnlyPIProxy *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy*)__pyx_vtabptr_4lxml_5etree__ReadOnlyPIProxy;
  return o;
}

static PyObject *__pyx_getprop_4lxml_5etree_16_ReadOnlyPIProxy_target(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_16_ReadOnlyPIProxy_6target_1__get__(o);
}

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__ReadOnlyPIProxy[] = {
  {"target", __pyx_getprop_4lxml_5etree_16_ReadOnlyPIProxy_target, 0, 0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__ReadOnlyPIProxy_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__ReadOnlyProxy},
  {Py_tp_doc, (void *)PyDoc_STR("A read-only proxy for processing instructions (for internal use only!)")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__ReadOnlyProxy},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__ReadOnlyProxy},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree__ReadOnlyPIProxy},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__ReadOnlyPIProxy},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__ReadOnlyPIProxy_spec = {
  "lxml.etree._ReadOnlyPIProxy",
  sizeof(struct __pyx_obj_4lxml_5etree__ReadOnlyPIProxy),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__ReadOnlyPIProxy_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__ReadOnlyPIProxy = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_ReadOnlyPIProxy", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ReadOnlyPIProxy), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ReadOnlyProxy, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_3__repr__, /*tp_repr*/
  #else
  0, /*tp_repr*/
  #endif
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("A read-only proxy for processing instructions (for internal use only!)"), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ReadOnlyProxy, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ReadOnlyProxy, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_15__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__ReadOnlyPIProxy, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__ReadOnlyPIProxy, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyEntityProxy __pyx_vtable_4lxml_5etree__ReadOnlyEntityProxy;

static PyObject *__pyx_tp_new_4lxml_5etree__ReadOnlyEntityProxy(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ReadOnlyEntityProxy *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ReadOnlyProxy(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ReadOnlyEntityProxy *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy*)__pyx_vtabptr_4lxml_5etree__ReadOnlyEntityProxy;
  return o;
}

static PyObject *__pyx_getprop_4lxml_5etree_20_ReadOnlyEntityProxy_name(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_20_ReadOnlyEntityProxy_4name_1__get__(o);
}

static int __pyx_setprop_4lxml_5etree_20_ReadOnlyEntityProxy_name(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_4lxml_5etree_20_ReadOnlyEntityProxy_4name_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_4lxml_5etree_20_ReadOnlyEntityProxy_text(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_20_ReadOnlyEntityProxy_4text_1__get__(o);
}

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__ReadOnlyEntityProxy[] = {
  {"name", __pyx_getprop_4lxml_5etree_20_ReadOnlyEntityProxy_name, __pyx_setprop_4lxml_5etree_20_ReadOnlyEntityProxy_name, 0, 0},
  {"text", __pyx_getprop_4lxml_5etree_20_ReadOnlyEntityProxy_text, 0, 0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__ReadOnlyEntityProxy_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__ReadOnlyProxy},
  {Py_tp_doc, (void *)PyDoc_STR("A read-only proxy for entity references (for internal use only!)")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__ReadOnlyProxy},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__ReadOnlyProxy},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree__ReadOnlyEntityProxy},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__ReadOnlyEntityProxy},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__ReadOnlyEntityProxy_spec = {
  "lxml.etree._ReadOnlyEntityProxy",
  sizeof(struct __pyx_obj_4lxml_5etree__ReadOnlyEntityProxy),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__ReadOnlyEntityProxy_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__ReadOnlyEntityProxy = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_ReadOnlyEntityProxy", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ReadOnlyEntityProxy), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ReadOnlyProxy, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_3__repr__, /*tp_repr*/
  #else
  0, /*tp_repr*/
  #endif
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("A read-only proxy for entity references (for internal use only!)"), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ReadOnlyProxy, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ReadOnlyProxy, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_15__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__ReadOnlyEntityProxy, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__ReadOnlyEntityProxy, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyElementProxy __pyx_vtable_4lxml_5etree__ReadOnlyElementProxy;

static PyObject *__pyx_tp_new_4lxml_5etree__ReadOnlyElementProxy(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ReadOnlyProxy(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy*)__pyx_vtabptr_4lxml_5etree__ReadOnlyElementProxy;
  return o;
}

static PyObject *__pyx_getprop_4lxml_5etree_21_ReadOnlyElementProxy_attrib(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_21_ReadOnlyElementProxy_6attrib_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_21_ReadOnlyElementProxy_prefix(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_21_ReadOnlyElementProxy_6prefix_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_21_ReadOnlyElementProxy_nsmap(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_21_ReadOnlyElementProxy_5nsmap_1__get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree__ReadOnlyElementProxy[] = {
  {"get", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_21_ReadOnlyElementProxy_1get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy_get},
  {"keys", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_21_ReadOnlyElementProxy_3keys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy_2keys},
  {"values", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_21_ReadOnlyElementProxy_5values, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy_4values},
  {"items", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_21_ReadOnlyElementProxy_7items, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy_6items},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__ReadOnlyElementProxy[] = {
  {"attrib", __pyx_getprop_4lxml_5etree_21_ReadOnlyElementProxy_attrib, 0, 0, 0},
  {"prefix", __pyx_getprop_4lxml_5etree_21_ReadOnlyElementProxy_prefix, 0, PyDoc_STR("Namespace prefix or None.\n        "), 0},
  {"nsmap", __pyx_getprop_4lxml_5etree_21_ReadOnlyElementProxy_nsmap, 0, PyDoc_STR("Namespace prefix->URI mapping known in the context of this\n        Element.  This includes all namespace declarations of the\n        parents.\n\n        Note that changing the returned dict has no effect on the Element.\n        "), 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__ReadOnlyElementProxy_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__ReadOnlyProxy},
  {Py_tp_doc, (void *)PyDoc_STR("The main read-only Element proxy class (for internal use only!).")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__ReadOnlyProxy},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__ReadOnlyProxy},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__ReadOnlyElementProxy},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree__ReadOnlyElementProxy},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__ReadOnlyElementProxy},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__ReadOnlyElementProxy_spec = {
  "lxml.etree._ReadOnlyElementProxy",
  sizeof(struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__ReadOnlyElementProxy_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__ReadOnlyElementProxy = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_ReadOnlyElementProxy", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ReadOnlyProxy, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_3__repr__, /*tp_repr*/
  #else
  0, /*tp_repr*/
  #endif
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("The main read-only Element proxy class (for internal use only!)."), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ReadOnlyProxy, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ReadOnlyProxy, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_15__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__ReadOnlyElementProxy, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__ReadOnlyElementProxy, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__ReadOnlyElementProxy, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4lxml_5etree__OpaqueNodeWrapper(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 0);
  if (unlikely(!o)) return 0;
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__OpaqueNodeWrapper(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree__OpaqueNodeWrapper) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static PyMethodDef __pyx_methods_4lxml_5etree__OpaqueNodeWrapper[] = {
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__OpaqueNodeWrapper_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__OpaqueNodeWrapper},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__OpaqueNodeWrapper},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_18_OpaqueNodeWrapper_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__OpaqueNodeWrapper},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__OpaqueNodeWrapper_spec = {
  "lxml.etree._OpaqueNodeWrapper",
  sizeof(struct __pyx_obj_4lxml_5etree__OpaqueNodeWrapper),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE,
  __pyx_type_4lxml_5etree__OpaqueNodeWrapper_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__OpaqueNodeWrapper = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_OpaqueNodeWrapper", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__OpaqueNodeWrapper), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__OpaqueNodeWrapper, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__OpaqueNodeWrapper, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_4lxml_5etree_18_OpaqueNodeWrapper_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__OpaqueNodeWrapper, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__OpaqueDocumentWrapper __pyx_vtable_4lxml_5etree__OpaqueDocumentWrapper;

static PyObject *__pyx_tp_new_4lxml_5etree__OpaqueDocumentWrapper(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__OpaqueNodeWrapper(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__OpaqueDocumentWrapper;
  return o;
}

static PyMethodDef __pyx_methods_4lxml_5etree__OpaqueDocumentWrapper[] = {
  {"extend", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_22_OpaqueDocumentWrapper_3extend, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_22_OpaqueDocumentWrapper_2extend},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__OpaqueDocumentWrapper_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__OpaqueNodeWrapper},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__OpaqueDocumentWrapper},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__OpaqueDocumentWrapper},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__OpaqueDocumentWrapper_spec = {
  "lxml.etree._OpaqueDocumentWrapper",
  sizeof(struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER,
  __pyx_type_4lxml_5etree__OpaqueDocumentWrapper_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__OpaqueDocumentWrapper = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_OpaqueDocumentWrapper", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__OpaqueNodeWrapper, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__OpaqueDocumentWrapper, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_18_OpaqueNodeWrapper_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__OpaqueDocumentWrapper, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__ModifyContentOnlyProxy __pyx_vtable_4lxml_5etree__ModifyContentOnlyProxy;

static PyObject *__pyx_tp_new_4lxml_5etree__ModifyContentOnlyProxy(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ModifyContentOnlyProxy *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ReadOnlyProxy(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ModifyContentOnlyProxy *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy*)__pyx_vtabptr_4lxml_5etree__ModifyContentOnlyProxy;
  return o;
}

static PyObject *__pyx_getprop_4lxml_5etree_23_ModifyContentOnlyProxy_text(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_23_ModifyContentOnlyProxy_4text_1__get__(o);
}

static int __pyx_setprop_4lxml_5etree_23_ModifyContentOnlyProxy_text(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_4lxml_5etree_23_ModifyContentOnlyProxy_4text_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__ModifyContentOnlyProxy[] = {
  {"text", __pyx_getprop_4lxml_5etree_23_ModifyContentOnlyProxy_text, __pyx_setprop_4lxml_5etree_23_ModifyContentOnlyProxy_text, 0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__ModifyContentOnlyProxy_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__ReadOnlyProxy},
  {Py_tp_doc, (void *)PyDoc_STR("A read-only proxy that allows changing the text content.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__ReadOnlyProxy},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__ReadOnlyProxy},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree__ModifyContentOnlyProxy},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__ModifyContentOnlyProxy},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__ModifyContentOnlyProxy_spec = {
  "lxml.etree._ModifyContentOnlyProxy",
  sizeof(struct __pyx_obj_4lxml_5etree__ModifyContentOnlyProxy),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__ModifyContentOnlyProxy_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__ModifyContentOnlyProxy = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_ModifyContentOnlyProxy", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ModifyContentOnlyProxy), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ReadOnlyProxy, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_3__repr__, /*tp_repr*/
  #else
  0, /*tp_repr*/
  #endif
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("A read-only proxy that allows changing the text content.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ReadOnlyProxy, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ReadOnlyProxy, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_15__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__ModifyContentOnlyProxy, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__ModifyContentOnlyProxy, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__ModifyContentOnlyPIProxy __pyx_vtable_4lxml_5etree__ModifyContentOnlyPIProxy;

static PyObject *__pyx_tp_new_4lxml_5etree__ModifyContentOnlyPIProxy(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ModifyContentOnlyPIProxy *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ModifyContentOnlyProxy(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ModifyContentOnlyPIProxy *)o);
  p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy*)__pyx_vtabptr_4lxml_5etree__ModifyContentOnlyPIProxy;
  return o;
}

static PyObject *__pyx_getprop_4lxml_5etree_25_ModifyContentOnlyPIProxy_target(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_25_ModifyContentOnlyPIProxy_6target_1__get__(o);
}

static int __pyx_setprop_4lxml_5etree_25_ModifyContentOnlyPIProxy_target(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_4lxml_5etree_25_ModifyContentOnlyPIProxy_6target_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__ModifyContentOnlyPIProxy[] = {
  {"target", __pyx_getprop_4lxml_5etree_25_ModifyContentOnlyPIProxy_target, __pyx_setprop_4lxml_5etree_25_ModifyContentOnlyPIProxy_target, 0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__ModifyContentOnlyPIProxy_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__ReadOnlyProxy},
  {Py_tp_doc, (void *)PyDoc_STR("A read-only proxy that allows changing the text/target content of a\n    processing instruction.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__ReadOnlyProxy},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__ReadOnlyProxy},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree__ModifyContentOnlyPIProxy},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__ModifyContentOnlyPIProxy},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__ModifyContentOnlyPIProxy_spec = {
  "lxml.etree._ModifyContentOnlyPIProxy",
  sizeof(struct __pyx_obj_4lxml_5etree__ModifyContentOnlyPIProxy),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__ModifyContentOnlyPIProxy_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__ModifyContentOnlyPIProxy = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_ModifyContentOnlyPIProxy", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ModifyContentOnlyPIProxy), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ReadOnlyProxy, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_3__repr__, /*tp_repr*/
  #else
  0, /*tp_repr*/
  #endif
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("A read-only proxy that allows changing the text/target content of a\n    processing instruction.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ReadOnlyProxy, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ReadOnlyProxy, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_15__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__ModifyContentOnlyPIProxy, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__ModifyContentOnlyPIProxy, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__ModifyContentOnlyEntityProxy __pyx_vtable_4lxml_5etree__ModifyContentOnlyEntityProxy;

static PyObject *__pyx_tp_new_4lxml_5etree__ModifyContentOnlyEntityProxy(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ModifyContentOnlyEntityProxy *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ModifyContentOnlyProxy(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ModifyContentOnlyEntityProxy *)o);
  p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy*)__pyx_vtabptr_4lxml_5etree__ModifyContentOnlyEntityProxy;
  return o;
}

static PyObject *__pyx_getprop_4lxml_5etree_29_ModifyContentOnlyEntityProxy_name(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_29_ModifyContentOnlyEntityProxy_4name_1__get__(o);
}

static int __pyx_setprop_4lxml_5etree_29_ModifyContentOnlyEntityProxy_name(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_4lxml_5etree_29_ModifyContentOnlyEntityProxy_4name_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__ModifyContentOnlyEntityProxy[] = {
  {"name", __pyx_getprop_4lxml_5etree_29_ModifyContentOnlyEntityProxy_name, __pyx_setprop_4lxml_5etree_29_ModifyContentOnlyEntityProxy_name, 0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__ModifyContentOnlyEntityProxy_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__ReadOnlyProxy},
  {Py_tp_doc, (void *)PyDoc_STR("A read-only proxy for entity references (for internal use only!)")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__ReadOnlyProxy},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__ReadOnlyProxy},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree__ModifyContentOnlyEntityProxy},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__ModifyContentOnlyEntityProxy},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__ModifyContentOnlyEntityProxy_spec = {
  "lxml.etree._ModifyContentOnlyEntityProxy",
  sizeof(struct __pyx_obj_4lxml_5etree__ModifyContentOnlyEntityProxy),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__ModifyContentOnlyEntityProxy_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__ModifyContentOnlyEntityProxy = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_ModifyContentOnlyEntityProxy", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ModifyContentOnlyEntityProxy), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ReadOnlyProxy, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_3__repr__, /*tp_repr*/
  #else
  0, /*tp_repr*/
  #endif
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("A read-only proxy for entity references (for internal use only!)"), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ReadOnlyProxy, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ReadOnlyProxy, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_15__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__ModifyContentOnlyEntityProxy, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__ModifyContentOnlyEntityProxy, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__AppendOnlyElementProxy __pyx_vtable_4lxml_5etree__AppendOnlyElementProxy;

static PyObject *__pyx_tp_new_4lxml_5etree__AppendOnlyElementProxy(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ReadOnlyElementProxy(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *)o);
  p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy*)__pyx_vtabptr_4lxml_5etree__AppendOnlyElementProxy;
  return o;
}

static PyObject *__pyx_getprop_4lxml_5etree_23_AppendOnlyElementProxy_text(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_23_AppendOnlyElementProxy_4text_1__get__(o);
}

static int __pyx_setprop_4lxml_5etree_23_AppendOnlyElementProxy_text(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_4lxml_5etree_23_AppendOnlyElementProxy_4text_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyMethodDef __pyx_methods_4lxml_5etree__AppendOnlyElementProxy[] = {
  {"extend", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_23_AppendOnlyElementProxy_3extend, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_23_AppendOnlyElementProxy_2extend},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__AppendOnlyElementProxy[] = {
  {"text", __pyx_getprop_4lxml_5etree_23_AppendOnlyElementProxy_text, __pyx_setprop_4lxml_5etree_23_AppendOnlyElementProxy_text, PyDoc_STR("Text before the first subelement. This is either a string or the\n        value None, if there was no text.\n        "), 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__AppendOnlyElementProxy_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__ReadOnlyProxy},
  {Py_tp_doc, (void *)PyDoc_STR("A read-only element that allows adding children and changing the\n    text content (i.e. everything that adds to the subtree).\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__ReadOnlyProxy},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__ReadOnlyProxy},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__AppendOnlyElementProxy},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree__AppendOnlyElementProxy},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__AppendOnlyElementProxy},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__AppendOnlyElementProxy_spec = {
  "lxml.etree._AppendOnlyElementProxy",
  sizeof(struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__AppendOnlyElementProxy_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__AppendOnlyElementProxy = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_AppendOnlyElementProxy", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ReadOnlyProxy, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_3__repr__, /*tp_repr*/
  #else
  0, /*tp_repr*/
  #endif
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("A read-only element that allows adding children and changing the\n    text content (i.e. everything that adds to the subtree).\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ReadOnlyProxy, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ReadOnlyProxy, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_15__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__AppendOnlyElementProxy, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__AppendOnlyElementProxy, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__AppendOnlyElementProxy, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyMethodDef __pyx_methods_4lxml_5etree_ElementBase[] = {
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot LxmlElementBaseType_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__Element},
  {Py_tp_doc, (void *)PyDoc_STR("ElementBase(*children, attrib=None, nsmap=None, **_extra)\n\n    The public Element class.  All custom Element classes must inherit\n    from this one.  To create an Element, use the `Element()` factory.\n\n    BIG FAT WARNING: Subclasses *must not* override __init__ or\n    __new__ as it is absolutely undefined when these objects will be\n    created or destroyed.  All persistent state of Elements must be\n    stored in the underlying XML.  If you really need to initialize\n    the object after creation, you can implement an ``_init(self)``\n    method that will be called directly after object creation.\n\n    Subclasses of this class can be instantiated to create a new\n    Element.  By default, the tag name will be the class name and the\n    namespace will be empty.  You can modify this with the following\n    class attributes:\n\n    * TAG - the tag name, possibly containing a namespace in Clark\n      notation\n\n    * NAMESPACE - the default namespace URI, unless provided as part\n      of the TAG attribute.\n\n    * HTML - flag if the class is an HTML tag, as opposed to an XML\n      tag.  This only applies to un-namespaced tags and defaults to\n      false (i.e. XML).\n\n    * PARSER - the parser that provides the configuration for the\n      newly created document.  Providing an HTML parser here will\n      default to creating an HTML element.\n\n    In user code, the latter three are commonly inherited in class\n    hierarchies that implement a common namespace.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__Element},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_ElementBase},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_11ElementBase_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__Element},
  {0, 0},
};
static PyType_Spec LxmlElementBaseType_spec = {
  "lxml.etree.ElementBase",
  sizeof(struct LxmlElementBase),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  LxmlElementBaseType_slots,
};
#else

DL_EXPORT(PyTypeObject) LxmlElementBaseType = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""ElementBase", /*tp_name*/
  sizeof(struct LxmlElementBase), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__Element, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_8_Element_31__repr__, /*tp_repr*/
  #else
  0, /*tp_repr*/
  #endif
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("ElementBase(*children, attrib=None, nsmap=None, **_extra)\n\n    The public Element class.  All custom Element classes must inherit\n    from this one.  To create an Element, use the `Element()` factory.\n\n    BIG FAT WARNING: Subclasses *must not* override __init__ or\n    __new__ as it is absolutely undefined when these objects will be\n    created or destroyed.  All persistent state of Elements must be\n    stored in the underlying XML.  If you really need to initialize\n    the object after creation, you can implement an ``_init(self)``\n    method that will be called directly after object creation.\n\n    Subclasses of this class can be instantiated to create a new\n    Element.  By default, the tag name will be the class name and the\n    namespace will be empty.  You can modify this with the following\n    class attributes:\n\n    * TAG - the tag name, possibly containing a namespace in Clark\n      notation\n\n    * NAMESPACE - the default namespace URI, unless provided as part\n      of the TAG attribute.\n\n    * HTML - flag if the class is an HTML tag, as opposed to an XML\n      tag.  This only applies to un-namespaced tags and defaults to\n      false (i.e. XML).\n\n    * PARSER - the parser that provides the configuration for the\n      newly created document.  Providing an HTML parser here will\n      default to creating an HTML element.\n\n    In user code, the latter three are commonly inherited in class\n    hierarchies that implement a common namespace.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__Element, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_8_Element_41__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_ElementBase, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_4lxml_5etree_11ElementBase_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__Element, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree_CommentBase __pyx_vtable_4lxml_5etree_CommentBase;

static PyObject *__pyx_tp_new_4lxml_5etree_CommentBase(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_CommentBase *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__Comment(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_CommentBase *)o);
  p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree___ContentOnlyElement*)__pyx_vtabptr_4lxml_5etree_CommentBase;
  return o;
}

static PyMethodDef __pyx_methods_4lxml_5etree_CommentBase[] = {
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_CommentBase_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__Element},
  {Py_tp_doc, (void *)PyDoc_STR("All custom Comment classes must inherit from this one.\n\n    To create an XML Comment instance, use the ``Comment()`` factory.\n\n    Subclasses *must not* override __init__ or __new__ as it is\n    absolutely undefined when these objects will be created or\n    destroyed.  All persistent state of Comments must be stored in the\n    underlying XML.  If you really need to initialize the object after\n    creation, you can implement an ``_init(self)`` method that will be\n    called after object creation.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__Element},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_CommentBase},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_11CommentBase_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_CommentBase},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_CommentBase_spec = {
  "lxml.etree.CommentBase",
  sizeof(struct __pyx_obj_4lxml_5etree_CommentBase),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_CommentBase_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_CommentBase = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""CommentBase", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_CommentBase), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__Element, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_8_Comment_1__repr__, /*tp_repr*/
  #else
  0, /*tp_repr*/
  #endif
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("All custom Comment classes must inherit from this one.\n\n    To create an XML Comment instance, use the ``Comment()`` factory.\n\n    Subclasses *must not* override __init__ or __new__ as it is\n    absolutely undefined when these objects will be created or\n    destroyed.  All persistent state of Comments must be stored in the\n    underlying XML.  If you really need to initialize the object after\n    creation, you can implement an ``_init(self)`` method that will be\n    called after object creation.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__Element, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_8_Element_41__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_CommentBase, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_4lxml_5etree_11CommentBase_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_CommentBase, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree_PIBase __pyx_vtable_4lxml_5etree_PIBase;

static PyObject *__pyx_tp_new_4lxml_5etree_PIBase(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_PIBase *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ProcessingInstruction(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_PIBase *)o);
  p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree___ContentOnlyElement*)__pyx_vtabptr_4lxml_5etree_PIBase;
  return o;
}

static PyMethodDef __pyx_methods_4lxml_5etree_PIBase[] = {
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_PIBase_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__Element},
  {Py_tp_doc, (void *)PyDoc_STR("All custom Processing Instruction classes must inherit from this one.\n\n    To create an XML ProcessingInstruction instance, use the ``PI()``\n    factory.\n\n    Subclasses *must not* override __init__ or __new__ as it is\n    absolutely undefined when these objects will be created or\n    destroyed.  All persistent state of PIs must be stored in the\n    underlying XML.  If you really need to initialize the object after\n    creation, you can implement an ``_init(self)`` method that will be\n    called after object creation.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__Element},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_PIBase},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_6PIBase_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_PIBase},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_PIBase_spec = {
  "lxml.etree.PIBase",
  sizeof(struct __pyx_obj_4lxml_5etree_PIBase),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_PIBase_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_PIBase = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""PIBase", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_PIBase), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__Element, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_22_ProcessingInstruction_1__repr__, /*tp_repr*/
  #else
  0, /*tp_repr*/
  #endif
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("All custom Processing Instruction classes must inherit from this one.\n\n    To create an XML ProcessingInstruction instance, use the ``PI()``\n    factory.\n\n    Subclasses *must not* override __init__ or __new__ as it is\n    absolutely undefined when these objects will be created or\n    destroyed.  All persistent state of PIs must be stored in the\n    underlying XML.  If you really need to initialize the object after\n    creation, you can implement an ``_init(self)`` method that will be\n    called after object creation.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__Element, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_8_Element_41__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_PIBase, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_4lxml_5etree_6PIBase_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_PIBase, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree_EntityBase __pyx_vtable_4lxml_5etree_EntityBase;

static PyObject *__pyx_tp_new_4lxml_5etree_EntityBase(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_EntityBase *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__Entity(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_EntityBase *)o);
  p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree___ContentOnlyElement*)__pyx_vtabptr_4lxml_5etree_EntityBase;
  return o;
}

static PyMethodDef __pyx_methods_4lxml_5etree_EntityBase[] = {
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_EntityBase_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__Element},
  {Py_tp_doc, (void *)PyDoc_STR("All custom Entity classes must inherit from this one.\n\n    To create an XML Entity instance, use the ``Entity()`` factory.\n\n    Subclasses *must not* override __init__ or __new__ as it is\n    absolutely undefined when these objects will be created or\n    destroyed.  All persistent state of Entities must be stored in the\n    underlying XML.  If you really need to initialize the object after\n    creation, you can implement an ``_init(self)`` method that will be\n    called after object creation.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__Element},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_EntityBase},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_10EntityBase_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_EntityBase},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_EntityBase_spec = {
  "lxml.etree.EntityBase",
  sizeof(struct __pyx_obj_4lxml_5etree_EntityBase),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_EntityBase_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_EntityBase = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""EntityBase", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_EntityBase), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__Element, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_7_Entity_1__repr__, /*tp_repr*/
  #else
  0, /*tp_repr*/
  #endif
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("All custom Entity classes must inherit from this one.\n\n    To create an XML Entity instance, use the ``Entity()`` factory.\n\n    Subclasses *must not* override __init__ or __new__ as it is\n    absolutely undefined when these objects will be created or\n    destroyed.  All persistent state of Entities must be stored in the\n    underlying XML.  If you really need to initialize the object after\n    creation, you can implement an ``_init(self)`` method that will be\n    called after object creation.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__Element, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_8_Element_41__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_EntityBase, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_4lxml_5etree_10EntityBase_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_EntityBase, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4lxml_5etree_ElementClassLookup(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 0);
  if (unlikely(!o)) return 0;
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_ElementClassLookup(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree_ElementClassLookup) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot LxmlElementClassLookupType_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_ElementClassLookup},
  {Py_tp_doc, (void *)PyDoc_STR("ElementClassLookup(self)\n    Superclass of Element class lookups.\n    ")},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_ElementClassLookup},
  {0, 0},
};
static PyType_Spec LxmlElementClassLookupType_spec = {
  "lxml.etree.ElementClassLookup",
  sizeof(struct LxmlElementClassLookup),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE,
  LxmlElementClassLookupType_slots,
};
#else

DL_EXPORT(PyTypeObject) LxmlElementClassLookupType = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""ElementClassLookup", /*tp_name*/
  sizeof(struct LxmlElementClassLookup), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_ElementClassLookup, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  PyDoc_STR("ElementClassLookup(self)\n    Superclass of Element class lookups.\n    "), /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_ElementClassLookup, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree_FallbackElementClassLookup __pyx_vtable_4lxml_5etree_FallbackElementClassLookup;

static PyObject *__pyx_tp_new_4lxml_5etree_FallbackElementClassLookup(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct LxmlFallbackElementClassLookup *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree_ElementClassLookup(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct LxmlFallbackElementClassLookup *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree_FallbackElementClassLookup;
  p->fallback = ((struct LxmlElementClassLookup *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_26FallbackElementClassLookup_1__cinit__(o, __pyx_mstate_global->__pyx_empty_tuple, NULL) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_4lxml_5etree_FallbackElementClassLookup(PyObject *o) {
  struct LxmlFallbackElementClassLookup *p = (struct LxmlFallbackElementClassLookup *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree_FallbackElementClassLookup) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->fallback);
  __pyx_tp_dealloc_4lxml_5etree_ElementClassLookup(o);
}

static int __pyx_tp_traverse_4lxml_5etree_FallbackElementClassLookup(PyObject *o, visitproc v, void *a) {
  int e;
  struct LxmlFallbackElementClassLookup *p = (struct LxmlFallbackElementClassLookup *)o;
  #if !CYTHON_USE_MODULE_STATE
  e = 0;
  if (likely(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_ElementClassLookup)) {
    traverseproc traverse = __Pyx_PyType_GetSlot(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_ElementClassLookup, tp_traverse, traverseproc);
    if (traverse) { e = traverse(o, v, a); }
  } else
  #endif
  { e = __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_4lxml_5etree_FallbackElementClassLookup); }
  if (e) return e;
  {
    e = __Pyx_call_type_traverse(o, 0, v, a);
    if (e) return e;
  }
  if (p->fallback) {
    e = (*v)(((PyObject *)p->fallback), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree_FallbackElementClassLookup(PyObject *o) {
  struct LxmlFallbackElementClassLookup *p = (struct LxmlFallbackElementClassLookup *)o;
  #if !CYTHON_USE_MODULE_STATE
  if (likely(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_ElementClassLookup)) {
    inquiry clear = __Pyx_PyType_GetSlot(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_ElementClassLookup, tp_clear, inquiry);
    if (clear) clear(o);
  } else
  #endif
  { __Pyx_call_next_tp_clear(o, __pyx_tp_clear_4lxml_5etree_FallbackElementClassLookup); }
  Py_CLEAR(p->fallback);
  return 0;
}

static PyObject *__pyx_getprop_4lxml_5etree_26FallbackElementClassLookup_fallback(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_26FallbackElementClassLookup_8fallback_1__get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree_FallbackElementClassLookup[] = {
  {"set_fallback", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_26FallbackElementClassLookup_5set_fallback, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_26FallbackElementClassLookup_4set_fallback},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree_FallbackElementClassLookup[] = {
  {"fallback", __pyx_getprop_4lxml_5etree_26FallbackElementClassLookup_fallback, 0, 0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot LxmlFallbackElementClassLookupType_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_FallbackElementClassLookup},
  {Py_tp_doc, (void *)PyDoc_STR("FallbackElementClassLookup(self, fallback=None)\n\n    Superclass of Element class lookups with additional fallback.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_FallbackElementClassLookup},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_FallbackElementClassLookup},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_FallbackElementClassLookup},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree_FallbackElementClassLookup},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_26FallbackElementClassLookup_3__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_FallbackElementClassLookup},
  {0, 0},
};
static PyType_Spec LxmlFallbackElementClassLookupType_spec = {
  "lxml.etree.FallbackElementClassLookup",
  sizeof(struct LxmlFallbackElementClassLookup),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  LxmlFallbackElementClassLookupType_slots,
};
#else

DL_EXPORT(PyTypeObject) LxmlFallbackElementClassLookupType = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""FallbackElementClassLookup", /*tp_name*/
  sizeof(struct LxmlFallbackElementClassLookup), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_FallbackElementClassLookup, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("FallbackElementClassLookup(self, fallback=None)\n\n    Superclass of Element class lookups with additional fallback.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_FallbackElementClassLookup, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_FallbackElementClassLookup, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_FallbackElementClassLookup, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree_FallbackElementClassLookup, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_4lxml_5etree_26FallbackElementClassLookup_3__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_FallbackElementClassLookup, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4lxml_5etree_ElementDefaultClassLookup(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree_ElementClassLookup(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)o);
  p->element_class = Py_None; Py_INCREF(Py_None);
  p->comment_class = Py_None; Py_INCREF(Py_None);
  p->pi_class = Py_None; Py_INCREF(Py_None);
  p->entity_class = Py_None; Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_25ElementDefaultClassLookup_1__cinit__(o, __pyx_mstate_global->__pyx_empty_tuple, NULL) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_4lxml_5etree_ElementDefaultClassLookup(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *p = (struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree_ElementDefaultClassLookup) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->element_class);
  Py_CLEAR(p->comment_class);
  Py_CLEAR(p->pi_class);
  Py_CLEAR(p->entity_class);
  __pyx_tp_dealloc_4lxml_5etree_ElementClassLookup(o);
}

static int __pyx_tp_traverse_4lxml_5etree_ElementDefaultClassLookup(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *p = (struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)o;
  #if !CYTHON_USE_MODULE_STATE
  e = 0;
  if (likely(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_ElementClassLookup)) {
    traverseproc traverse = __Pyx_PyType_GetSlot(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_ElementClassLookup, tp_traverse, traverseproc);
    if (traverse) { e = traverse(o, v, a); }
  } else
  #endif
  { e = __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_4lxml_5etree_ElementDefaultClassLookup); }
  if (e) return e;
  {
    e = __Pyx_call_type_traverse(o, 0, v, a);
    if (e) return e;
  }
  if (p->element_class) {
    e = (*v)(p->element_class, a); if (e) return e;
  }
  if (p->comment_class) {
    e = (*v)(p->comment_class, a); if (e) return e;
  }
  if (p->pi_class) {
    e = (*v)(p->pi_class, a); if (e) return e;
  }
  if (p->entity_class) {
    e = (*v)(p->entity_class, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree_ElementDefaultClassLookup(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *p = (struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)o;
  #if !CYTHON_USE_MODULE_STATE
  if (likely(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_ElementClassLookup)) {
    inquiry clear = __Pyx_PyType_GetSlot(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_ElementClassLookup, tp_clear, inquiry);
    if (clear) clear(o);
  } else
  #endif
  { __Pyx_call_next_tp_clear(o, __pyx_tp_clear_4lxml_5etree_ElementDefaultClassLookup); }
  Py_CLEAR(p->element_class);
  Py_CLEAR(p->comment_class);
  Py_CLEAR(p->pi_class);
  Py_CLEAR(p->entity_class);
  return 0;
}

static PyObject *__pyx_getprop_4lxml_5etree_25ElementDefaultClassLookup_element_class(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_25ElementDefaultClassLookup_13element_class_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_25ElementDefaultClassLookup_comment_class(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_25ElementDefaultClassLookup_13comment_class_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_25ElementDefaultClassLookup_pi_class(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_25ElementDefaultClassLookup_8pi_class_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_25ElementDefaultClassLookup_entity_class(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_25ElementDefaultClassLookup_12entity_class_1__get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree_ElementDefaultClassLookup[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree_ElementDefaultClassLookup[] = {
  {"element_class", __pyx_getprop_4lxml_5etree_25ElementDefaultClassLookup_element_class, 0, 0, 0},
  {"comment_class", __pyx_getprop_4lxml_5etree_25ElementDefaultClassLookup_comment_class, 0, 0, 0},
  {"pi_class", __pyx_getprop_4lxml_5etree_25ElementDefaultClassLookup_pi_class, 0, 0, 0},
  {"entity_class", __pyx_getprop_4lxml_5etree_25ElementDefaultClassLookup_entity_class, 0, 0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_ElementDefaultClassLookup_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_ElementDefaultClassLookup},
  {Py_tp_doc, (void *)PyDoc_STR("ElementDefaultClassLookup(self, element=None, comment=None, pi=None, entity=None)\n    Element class lookup scheme that always returns the default Element\n    class.\n\n    The keyword arguments ``element``, ``comment``, ``pi`` and ``entity``\n    accept the respective Element classes.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_ElementDefaultClassLookup},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_ElementDefaultClassLookup},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_ElementDefaultClassLookup},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree_ElementDefaultClassLookup},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_25ElementDefaultClassLookup_3__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_ElementDefaultClassLookup},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_ElementDefaultClassLookup_spec = {
  "lxml.etree.ElementDefaultClassLookup",
  sizeof(struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_ElementDefaultClassLookup_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_ElementDefaultClassLookup = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""ElementDefaultClassLookup", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_ElementDefaultClassLookup, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("ElementDefaultClassLookup(self, element=None, comment=None, pi=None, entity=None)\n    Element class lookup scheme that always returns the default Element\n    class.\n\n    The keyword arguments ``element``, ``comment``, ``pi`` and ``entity``\n    accept the respective Element classes.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_ElementDefaultClassLookup, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_ElementDefaultClassLookup, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_ElementDefaultClassLookup, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree_ElementDefaultClassLookup, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_4lxml_5etree_25ElementDefaultClassLookup_3__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_ElementDefaultClassLookup, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree_AttributeBasedElementClassLookup __pyx_vtable_4lxml_5etree_AttributeBasedElementClassLookup;

static PyObject *__pyx_tp_new_4lxml_5etree_AttributeBasedElementClassLookup(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree_FallbackElementClassLookup(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree_FallbackElementClassLookup*)__pyx_vtabptr_4lxml_5etree_AttributeBasedElementClassLookup;
  p->_class_mapping = Py_None; Py_INCREF(Py_None);
  p->_pytag = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_32AttributeBasedElementClassLookup_1__cinit__(o, __pyx_mstate_global->__pyx_empty_tuple, NULL) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_4lxml_5etree_AttributeBasedElementClassLookup(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup *p = (struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree_AttributeBasedElementClassLookup) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_class_mapping);
  Py_CLEAR(p->_pytag);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_4lxml_5etree_FallbackElementClassLookup(o);
}

static int __pyx_tp_traverse_4lxml_5etree_AttributeBasedElementClassLookup(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup *p = (struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup *)o;
  e = __pyx_tp_traverse_4lxml_5etree_FallbackElementClassLookup(o, v, a); if (e) return e;
  if (p->_class_mapping) {
    e = (*v)(p->_class_mapping, a); if (e) return e;
  }
  if (p->_pytag) {
    e = (*v)(p->_pytag, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree_AttributeBasedElementClassLookup(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup *p = (struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup *)o;
  __pyx_tp_clear_4lxml_5etree_FallbackElementClassLookup(o);
  Py_CLEAR(p->_class_mapping);
  Py_CLEAR(p->_pytag);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree_AttributeBasedElementClassLookup[] = {
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_AttributeBasedElementClassLookup_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_AttributeBasedElementClassLookup},
  {Py_tp_doc, (void *)PyDoc_STR("AttributeBasedElementClassLookup(self, attribute_name, class_mapping, fallback=None)\n    Checks an attribute of an Element and looks up the value in a\n    class dictionary.\n\n    Arguments:\n      - attribute name - '{ns}name' style string\n      - class mapping  - Python dict mapping attribute values to Element classes\n      - fallback       - optional fallback lookup mechanism\n\n    A None key in the class mapping will be checked if the attribute is\n    missing.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_AttributeBasedElementClassLookup},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_AttributeBasedElementClassLookup},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_AttributeBasedElementClassLookup},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_32AttributeBasedElementClassLookup_3__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_AttributeBasedElementClassLookup},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_AttributeBasedElementClassLookup_spec = {
  "lxml.etree.AttributeBasedElementClassLookup",
  sizeof(struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_AttributeBasedElementClassLookup_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_AttributeBasedElementClassLookup = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""AttributeBasedElementClassLookup", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_AttributeBasedElementClassLookup, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("AttributeBasedElementClassLookup(self, attribute_name, class_mapping, fallback=None)\n    Checks an attribute of an Element and looks up the value in a\n    class dictionary.\n\n    Arguments:\n      - attribute name - '{ns}name' style string\n      - class mapping  - Python dict mapping attribute values to Element classes\n      - fallback       - optional fallback lookup mechanism\n\n    A None key in the class mapping will be checked if the attribute is\n    missing.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_AttributeBasedElementClassLookup, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_AttributeBasedElementClassLookup, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_AttributeBasedElementClassLookup, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_4lxml_5etree_32AttributeBasedElementClassLookup_3__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_AttributeBasedElementClassLookup, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree_ParserBasedElementClassLookup __pyx_vtable_4lxml_5etree_ParserBasedElementClassLookup;

static PyObject *__pyx_tp_new_4lxml_5etree_ParserBasedElementClassLookup(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_ParserBasedElementClassLookup *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree_FallbackElementClassLookup(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_ParserBasedElementClassLookup *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree_FallbackElementClassLookup*)__pyx_vtabptr_4lxml_5etree_ParserBasedElementClassLookup;
  if (unlikely(__pyx_pw_4lxml_5etree_29ParserBasedElementClassLookup_1__cinit__(o, __pyx_mstate_global->__pyx_empty_tuple, NULL) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static PyMethodDef __pyx_methods_4lxml_5etree_ParserBasedElementClassLookup[] = {
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_ParserBasedElementClassLookup_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_FallbackElementClassLookup},
  {Py_tp_doc, (void *)PyDoc_STR("ParserBasedElementClassLookup(self, fallback=None)\n    Element class lookup based on the XML parser.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_FallbackElementClassLookup},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_FallbackElementClassLookup},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_ParserBasedElementClassLookup},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_ParserBasedElementClassLookup},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_ParserBasedElementClassLookup_spec = {
  "lxml.etree.ParserBasedElementClassLookup",
  sizeof(struct __pyx_obj_4lxml_5etree_ParserBasedElementClassLookup),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_ParserBasedElementClassLookup_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_ParserBasedElementClassLookup = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""ParserBasedElementClassLookup", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_ParserBasedElementClassLookup), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_FallbackElementClassLookup, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("ParserBasedElementClassLookup(self, fallback=None)\n    Element class lookup based on the XML parser.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_FallbackElementClassLookup, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_FallbackElementClassLookup, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_ParserBasedElementClassLookup, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_26FallbackElementClassLookup_3__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_ParserBasedElementClassLookup, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree_CustomElementClassLookup __pyx_vtable_4lxml_5etree_CustomElementClassLookup;

static PyObject *__pyx_tp_new_4lxml_5etree_CustomElementClassLookup(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_CustomElementClassLookup *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree_FallbackElementClassLookup(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_CustomElementClassLookup *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree_FallbackElementClassLookup*)__pyx_vtabptr_4lxml_5etree_CustomElementClassLookup;
  if (unlikely(__pyx_pw_4lxml_5etree_24CustomElementClassLookup_1__cinit__(o, __pyx_mstate_global->__pyx_empty_tuple, NULL) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static PyMethodDef __pyx_methods_4lxml_5etree_CustomElementClassLookup[] = {
  {"lookup", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_24CustomElementClassLookup_3lookup, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_24CustomElementClassLookup_2lookup},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_CustomElementClassLookup_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_FallbackElementClassLookup},
  {Py_tp_doc, (void *)PyDoc_STR("CustomElementClassLookup(self, fallback=None)\n    Element class lookup based on a subclass method.\n\n    You can inherit from this class and override the method::\n\n        lookup(self, type, doc, namespace, name)\n\n    to lookup the element class for a node. Arguments of the method:\n    * type:      one of 'element', 'comment', 'PI', 'entity'\n    * doc:       document that the node is in\n    * namespace: namespace URI of the node (or None for comments/PIs/entities)\n    * name:      name of the element/entity, None for comments, target for PIs\n\n    If you return None from this method, the fallback will be called.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_FallbackElementClassLookup},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_FallbackElementClassLookup},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_CustomElementClassLookup},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_CustomElementClassLookup},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_CustomElementClassLookup_spec = {
  "lxml.etree.CustomElementClassLookup",
  sizeof(struct __pyx_obj_4lxml_5etree_CustomElementClassLookup),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_CustomElementClassLookup_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_CustomElementClassLookup = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""CustomElementClassLookup", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_CustomElementClassLookup), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_FallbackElementClassLookup, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("CustomElementClassLookup(self, fallback=None)\n    Element class lookup based on a subclass method.\n\n    You can inherit from this class and override the method::\n\n        lookup(self, type, doc, namespace, name)\n\n    to lookup the element class for a node. Arguments of the method:\n    * type:      one of 'element', 'comment', 'PI', 'entity'\n    * doc:       document that the node is in\n    * namespace: namespace URI of the node (or None for comments/PIs/entities)\n    * name:      name of the element/entity, None for comments, target for PIs\n\n    If you return None from this method, the fallback will be called.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_FallbackElementClassLookup, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_FallbackElementClassLookup, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_CustomElementClassLookup, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_26FallbackElementClassLookup_3__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_CustomElementClassLookup, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree_PythonElementClassLookup __pyx_vtable_4lxml_5etree_PythonElementClassLookup;

static PyObject *__pyx_tp_new_4lxml_5etree_PythonElementClassLookup(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_PythonElementClassLookup *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree_FallbackElementClassLookup(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_PythonElementClassLookup *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree_FallbackElementClassLookup*)__pyx_vtabptr_4lxml_5etree_PythonElementClassLookup;
  if (unlikely(__pyx_pw_4lxml_5etree_24PythonElementClassLookup_1__cinit__(o, __pyx_mstate_global->__pyx_empty_tuple, NULL) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static PyMethodDef __pyx_methods_4lxml_5etree_PythonElementClassLookup[] = {
  {"lookup", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_24PythonElementClassLookup_3lookup, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_24PythonElementClassLookup_2lookup},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_PythonElementClassLookup_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_FallbackElementClassLookup},
  {Py_tp_doc, (void *)PyDoc_STR("PythonElementClassLookup(self, fallback=None)\n    Element class lookup based on a subclass method.\n\n    This class lookup scheme allows access to the entire XML tree in\n    read-only mode.  To use it, re-implement the ``lookup(self, doc,\n    root)`` method in a subclass::\n\n        from lxml import etree, pyclasslookup\n\n        class MyElementClass(etree.ElementBase):\n            honkey = True\n\n        class MyLookup(pyclasslookup.PythonElementClassLookup):\n            def lookup(self, doc, root):\n                if root.tag == \"sometag\":\n                    return MyElementClass\n                else:\n                    for child in root:\n                        if child.tag == \"someothertag\":\n                            return MyElementClass\n                # delegate to default\n                return None\n\n    If you return None from this method, the fallback will be called.\n\n    The first argument is the opaque document instance that contains\n    the Element.  The second argument is a lightweight Element proxy\n    implementation that is only valid during the lookup.  Do not try\n    to keep a reference to it.  Once the lookup is done, the proxy\n    will be invalid.\n\n    Also, you cannot wrap such a read-only Element in an ElementTree,\n    and you must take care not to keep a reference to them outside of\n    the `lookup()` method.\n\n    Note that the API of the Element objects is not complete.  It is\n    purely read-only and does not support all features of the normal\n    `lxml.etree` API (such as XPath, extended slicing or some\n    iteration methods).\n\n    See https://lxml.de/element_classes.html\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_FallbackElementClassLookup},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_FallbackElementClassLookup},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_PythonElementClassLookup},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_PythonElementClassLookup},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_PythonElementClassLookup_spec = {
  "lxml.etree.PythonElementClassLookup",
  sizeof(struct __pyx_obj_4lxml_5etree_PythonElementClassLookup),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_PythonElementClassLookup_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_PythonElementClassLookup = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""PythonElementClassLookup", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_PythonElementClassLookup), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_FallbackElementClassLookup, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("PythonElementClassLookup(self, fallback=None)\n    Element class lookup based on a subclass method.\n\n    This class lookup scheme allows access to the entire XML tree in\n    read-only mode.  To use it, re-implement the ``lookup(self, doc,\n    root)`` method in a subclass::\n\n        from lxml import etree, pyclasslookup\n\n        class MyElementClass(etree.ElementBase):\n            honkey = True\n\n        class MyLookup(pyclasslookup.PythonElementClassLookup):\n            def lookup(self, doc, root):\n                if root.tag == \"sometag\":\n                    return MyElementClass\n                else:\n                    for child in root:\n                        if child.tag == \"someothertag\":\n                            return MyElementClass\n                # delegate to default\n                return None\n\n    If you return None from this method, the fallback will be called.\n\n    The first argument is the opaque document instance that contains\n    the Element.  The second argument is a lightweight Element proxy\n    implementation that is only valid during the lookup.  Do not try\n    to keep a reference to it.  Once the lookup is done, the proxy\n    will be invalid.\n\n    Also, you cannot wrap such a read-only Element in an ElementTree,\n    and you must take care not to keep a reference to them outside of\n    the `lookup()` method.\n\n    Note that the API of the Element objects is not complete.  It is\n    purely read-only and does not support all features of the normal\n    `lxml.etree` API (such as XPath, extended slicing or some\n    iteration methods).\n\n    See https://lxml.de/element_classes.html\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_FallbackElementClassLookup, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_FallbackElementClassLookup, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_PythonElementClassLookup, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_26FallbackElementClassLookup_3__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_PythonElementClassLookup, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_LxmlRegistryError_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_Error},
  {Py_tp_doc, (void *)PyDoc_STR("Base class of lxml registry errors.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_Error},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_Error},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_Error},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_LxmlRegistryError_spec = {
  "lxml.etree.LxmlRegistryError",
  sizeof(struct __pyx_obj_4lxml_5etree_LxmlRegistryError),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_LxmlRegistryError_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_LxmlRegistryError = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""LxmlRegistryError", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_LxmlRegistryError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_Error, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("Base class of lxml registry errors.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_Error, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_Error, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_9LxmlError_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_Error, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_NamespaceRegistryError_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_Error},
  {Py_tp_doc, (void *)PyDoc_STR("Error registering a namespace extension.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_Error},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_Error},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_Error},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_NamespaceRegistryError_spec = {
  "lxml.etree.NamespaceRegistryError",
  sizeof(struct __pyx_obj_4lxml_5etree_NamespaceRegistryError),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_NamespaceRegistryError_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_NamespaceRegistryError = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""NamespaceRegistryError", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_NamespaceRegistryError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_Error, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("Error registering a namespace extension.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_Error, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_Error, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_9LxmlError_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_Error, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__NamespaceRegistry __pyx_vtable_4lxml_5etree__NamespaceRegistry;

static PyObject *__pyx_tp_new_4lxml_5etree__NamespaceRegistry(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__NamespaceRegistry *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__NamespaceRegistry;
  p->_ns_uri = Py_None; Py_INCREF(Py_None);
  p->_ns_uri_utf = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_entries = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_18_NamespaceRegistry_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_4lxml_5etree__NamespaceRegistry(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__NamespaceRegistry *p = (struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree__NamespaceRegistry) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_ns_uri);
  Py_CLEAR(p->_ns_uri_utf);
  Py_CLEAR(p->_entries);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_4lxml_5etree__NamespaceRegistry(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__NamespaceRegistry *p = (struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->_ns_uri) {
    e = (*v)(p->_ns_uri, a); if (e) return e;
  }
  if (p->_entries) {
    e = (*v)(p->_entries, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__NamespaceRegistry(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__NamespaceRegistry *p = (struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)o;
  Py_CLEAR(p->_ns_uri);
  Py_CLEAR(p->_entries);
  return 0;
}

static PyObject *__pyx_sq_item_4lxml_5etree__NamespaceRegistry(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyLong_FromSsize_t(i); if(!x) return 0;
  #if CYTHON_USE_TYPE_SLOTS || (!CYTHON_USE_TYPE_SPECS && __PYX_LIMITED_VERSION_HEX < 0x030A0000)
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  #else
  r = ((binaryfunc)PyType_GetSlot(Py_TYPE(o), Py_mp_subscript))(o, x);
  #endif
  Py_DECREF(x);
  return r;
}

static int __pyx_mp_ass_subscript_4lxml_5etree__NamespaceRegistry(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    __Pyx_TypeName o_type_name;
    o_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(o));
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript assignment not supported by " __Pyx_FMT_TYPENAME, o_type_name);
    __Pyx_DECREF_TypeName(o_type_name);
    return -1;
  }
  else {
    return __pyx_pw_4lxml_5etree_18_NamespaceRegistry_7__delitem__(o, i);
  }
}

static PyMethodDef __pyx_methods_4lxml_5etree__NamespaceRegistry[] = {
  {"update", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_18_NamespaceRegistry_3update, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_18_NamespaceRegistry_2update},
  {"items", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_18_NamespaceRegistry_11items, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"iteritems", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_18_NamespaceRegistry_13iteritems, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"clear", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_18_NamespaceRegistry_15clear, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"_NamespaceRegistry__deco", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_18_NamespaceRegistry_19_NamespaceRegistry__deco, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__NamespaceRegistry_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__NamespaceRegistry},
  {Py_sq_item, (void *)__pyx_sq_item_4lxml_5etree__NamespaceRegistry},
  {Py_mp_subscript, (void *)__pyx_pw_4lxml_5etree_18_NamespaceRegistry_5__getitem__},
  {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_4lxml_5etree__NamespaceRegistry},
  {Py_tp_call, (void *)__pyx_pw_4lxml_5etree_18_NamespaceRegistry_17__call__},
  {Py_tp_doc, (void *)PyDoc_STR("Dictionary-like namespace registry")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__NamespaceRegistry},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__NamespaceRegistry},
  {Py_tp_iter, (void *)__pyx_pw_4lxml_5etree_18_NamespaceRegistry_9__iter__},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__NamespaceRegistry},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__NamespaceRegistry},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__NamespaceRegistry_spec = {
  "lxml.etree._NamespaceRegistry",
  sizeof(struct __pyx_obj_4lxml_5etree__NamespaceRegistry),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__NamespaceRegistry_slots,
};
#else

static PySequenceMethods __pyx_tp_as_sequence__NamespaceRegistry = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_4lxml_5etree__NamespaceRegistry, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__NamespaceRegistry = {
  0, /*mp_length*/
  __pyx_pw_4lxml_5etree_18_NamespaceRegistry_5__getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_4lxml_5etree__NamespaceRegistry, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_4lxml_5etree__NamespaceRegistry = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_NamespaceRegistry", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__NamespaceRegistry), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__NamespaceRegistry, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  &__pyx_tp_as_sequence__NamespaceRegistry, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__NamespaceRegistry, /*tp_as_mapping*/
  0, /*tp_hash*/
  __pyx_pw_4lxml_5etree_18_NamespaceRegistry_17__call__, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("Dictionary-like namespace registry"), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__NamespaceRegistry, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__NamespaceRegistry, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_4lxml_5etree_18_NamespaceRegistry_9__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__NamespaceRegistry, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__NamespaceRegistry, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__ClassNamespaceRegistry __pyx_vtable_4lxml_5etree__ClassNamespaceRegistry;

static PyObject *__pyx_tp_new_4lxml_5etree__ClassNamespaceRegistry(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ClassNamespaceRegistry *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__NamespaceRegistry(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ClassNamespaceRegistry *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__NamespaceRegistry*)__pyx_vtabptr_4lxml_5etree__ClassNamespaceRegistry;
  return o;
}

static int __pyx_mp_ass_subscript_4lxml_5etree__ClassNamespaceRegistry(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_pw_4lxml_5etree_23_ClassNamespaceRegistry_1__setitem__(o, i, v);
  }
  else {
    __Pyx_TypeName o_type_name;
    objobjargproc f = __Pyx_PyType_TryGetSubSlot(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__NamespaceRegistry, tp_as_mapping, mp_ass_subscript, objobjargproc);
    if (f)
    return f(o, i, v);
    o_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(o));
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript deletion not supported by " __Pyx_FMT_TYPENAME, o_type_name);
    __Pyx_DECREF_TypeName(o_type_name);
    return -1;
  }
}

static PyMethodDef __pyx_methods_4lxml_5etree__ClassNamespaceRegistry[] = {
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__ClassNamespaceRegistry_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__NamespaceRegistry},
  {Py_tp_repr, (void *)__pyx_pw_4lxml_5etree_23_ClassNamespaceRegistry_3__repr__},
  {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_4lxml_5etree__ClassNamespaceRegistry},
  {Py_tp_doc, (void *)PyDoc_STR("Dictionary-like registry for namespace implementation classes")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__NamespaceRegistry},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__NamespaceRegistry},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__ClassNamespaceRegistry},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__ClassNamespaceRegistry},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__ClassNamespaceRegistry_spec = {
  "lxml.etree._ClassNamespaceRegistry",
  sizeof(struct __pyx_obj_4lxml_5etree__ClassNamespaceRegistry),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__ClassNamespaceRegistry_slots,
};
#else

static PyMappingMethods __pyx_tp_as_mapping__ClassNamespaceRegistry = {
  0, /*mp_length*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_18_NamespaceRegistry_5__getitem__, /*mp_subscript*/
  #else
  0, /*mp_subscript*/
  #endif
  __pyx_mp_ass_subscript_4lxml_5etree__ClassNamespaceRegistry, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_4lxml_5etree__ClassNamespaceRegistry = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_ClassNamespaceRegistry", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ClassNamespaceRegistry), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__NamespaceRegistry, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  __pyx_pw_4lxml_5etree_23_ClassNamespaceRegistry_3__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__ClassNamespaceRegistry, /*tp_as_mapping*/
  0, /*tp_hash*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_18_NamespaceRegistry_17__call__, /*tp_call*/
  #else
  0, /*tp_call*/
  #endif
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("Dictionary-like registry for namespace implementation classes"), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__NamespaceRegistry, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__NamespaceRegistry, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_18_NamespaceRegistry_9__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__ClassNamespaceRegistry, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__ClassNamespaceRegistry, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree_ElementNamespaceClassLookup __pyx_vtable_4lxml_5etree_ElementNamespaceClassLookup;

static PyObject *__pyx_tp_new_4lxml_5etree_ElementNamespaceClassLookup(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree_FallbackElementClassLookup(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree_FallbackElementClassLookup*)__pyx_vtabptr_4lxml_5etree_ElementNamespaceClassLookup;
  p->_namespace_registries = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_27ElementNamespaceClassLookup_1__cinit__(o, __pyx_mstate_global->__pyx_empty_tuple, NULL) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_4lxml_5etree_ElementNamespaceClassLookup(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *p = (struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree_ElementNamespaceClassLookup) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_namespace_registries);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_4lxml_5etree_FallbackElementClassLookup(o);
}

static int __pyx_tp_traverse_4lxml_5etree_ElementNamespaceClassLookup(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *p = (struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *)o;
  e = __pyx_tp_traverse_4lxml_5etree_FallbackElementClassLookup(o, v, a); if (e) return e;
  if (p->_namespace_registries) {
    e = (*v)(p->_namespace_registries, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree_ElementNamespaceClassLookup(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *p = (struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *)o;
  __pyx_tp_clear_4lxml_5etree_FallbackElementClassLookup(o);
  Py_CLEAR(p->_namespace_registries);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree_ElementNamespaceClassLookup[] = {
  {"get_namespace", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_27ElementNamespaceClassLookup_5get_namespace, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_27ElementNamespaceClassLookup_4get_namespace},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_ElementNamespaceClassLookup_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_ElementNamespaceClassLookup},
  {Py_tp_doc, (void *)PyDoc_STR("ElementNamespaceClassLookup(self, fallback=None)\n\n    Element class lookup scheme that searches the Element class in the\n    Namespace registry.\n\n    Usage:\n\n    >>> lookup = ElementNamespaceClassLookup()\n    >>> ns_elements = lookup.get_namespace(\"http://schema.org/Movie\")\n\n    >>> @ns_elements\n    ... class movie(ElementBase):\n    ...     \"Element implementation for 'movie' tag (using class name) in schema namespace.\"\n\n    >>> @ns_elements(\"movie\")\n    ... class MovieElement(ElementBase):\n    ...     \"Element implementation for 'movie' tag (explicit tag name) in schema namespace.\"\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_ElementNamespaceClassLookup},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_ElementNamespaceClassLookup},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_ElementNamespaceClassLookup},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_27ElementNamespaceClassLookup_3__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_ElementNamespaceClassLookup},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_ElementNamespaceClassLookup_spec = {
  "lxml.etree.ElementNamespaceClassLookup",
  sizeof(struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_ElementNamespaceClassLookup_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_ElementNamespaceClassLookup = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""ElementNamespaceClassLookup", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_ElementNamespaceClassLookup, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("ElementNamespaceClassLookup(self, fallback=None)\n\n    Element class lookup scheme that searches the Element class in the\n    Namespace registry.\n\n    Usage:\n\n    >>> lookup = ElementNamespaceClassLookup()\n    >>> ns_elements = lookup.get_namespace(\"http://schema.org/Movie\")\n\n    >>> @ns_elements\n    ... class movie(ElementBase):\n    ...     \"Element implementation for 'movie' tag (using class name) in schema namespace.\"\n\n    >>> @ns_elements(\"movie\")\n    ... class MovieElement(ElementBase):\n    ...     \"Element implementation for 'movie' tag (explicit tag name) in schema namespace.\"\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_ElementNamespaceClassLookup, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_ElementNamespaceClassLookup, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_ElementNamespaceClassLookup, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_4lxml_5etree_27ElementNamespaceClassLookup_3__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_ElementNamespaceClassLookup, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__FunctionNamespaceRegistry __pyx_vtable_4lxml_5etree__FunctionNamespaceRegistry;

static PyObject *__pyx_tp_new_4lxml_5etree__FunctionNamespaceRegistry(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__FunctionNamespaceRegistry *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__NamespaceRegistry(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__FunctionNamespaceRegistry *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__NamespaceRegistry*)__pyx_vtabptr_4lxml_5etree__FunctionNamespaceRegistry;
  return o;
}

static int __pyx_mp_ass_subscript_4lxml_5etree__FunctionNamespaceRegistry(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_pw_4lxml_5etree_26_FunctionNamespaceRegistry_1__setitem__(o, i, v);
  }
  else {
    __Pyx_TypeName o_type_name;
    objobjargproc f = __Pyx_PyType_TryGetSubSlot(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__NamespaceRegistry, tp_as_mapping, mp_ass_subscript, objobjargproc);
    if (f)
    return f(o, i, v);
    o_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(o));
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript deletion not supported by " __Pyx_FMT_TYPENAME, o_type_name);
    __Pyx_DECREF_TypeName(o_type_name);
    return -1;
  }
}

static PyMethodDef __pyx_methods_4lxml_5etree__FunctionNamespaceRegistry[] = {
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__FunctionNamespaceRegistry_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__NamespaceRegistry},
  {Py_tp_repr, (void *)__pyx_pw_4lxml_5etree_26_FunctionNamespaceRegistry_3__repr__},
  {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_4lxml_5etree__FunctionNamespaceRegistry},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__NamespaceRegistry},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__NamespaceRegistry},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__FunctionNamespaceRegistry},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__FunctionNamespaceRegistry},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__FunctionNamespaceRegistry_spec = {
  "lxml.etree._FunctionNamespaceRegistry",
  sizeof(struct __pyx_obj_4lxml_5etree__FunctionNamespaceRegistry),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__FunctionNamespaceRegistry_slots,
};
#else

static PyMappingMethods __pyx_tp_as_mapping__FunctionNamespaceRegistry = {
  0, /*mp_length*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_18_NamespaceRegistry_5__getitem__, /*mp_subscript*/
  #else
  0, /*mp_subscript*/
  #endif
  __pyx_mp_ass_subscript_4lxml_5etree__FunctionNamespaceRegistry, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_4lxml_5etree__FunctionNamespaceRegistry = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_FunctionNamespaceRegistry", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__FunctionNamespaceRegistry), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__NamespaceRegistry, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  __pyx_pw_4lxml_5etree_26_FunctionNamespaceRegistry_3__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__FunctionNamespaceRegistry, /*tp_as_mapping*/
  0, /*tp_hash*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_18_NamespaceRegistry_17__call__, /*tp_call*/
  #else
  0, /*tp_call*/
  #endif
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__NamespaceRegistry, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__NamespaceRegistry, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_18_NamespaceRegistry_9__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__FunctionNamespaceRegistry, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__FunctionNamespaceRegistry, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__XPathFunctionNamespaceRegistry __pyx_vtable_4lxml_5etree__XPathFunctionNamespaceRegistry;

static PyObject *__pyx_tp_new_4lxml_5etree__XPathFunctionNamespaceRegistry(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__FunctionNamespaceRegistry(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *)o);
  p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__NamespaceRegistry*)__pyx_vtabptr_4lxml_5etree__XPathFunctionNamespaceRegistry;
  p->_prefix = Py_None; Py_INCREF(Py_None);
  p->_prefix_utf = ((PyObject*)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__XPathFunctionNamespaceRegistry(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *p = (struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_prefix);
  Py_CLEAR(p->_prefix_utf);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_4lxml_5etree__NamespaceRegistry(o);
}

static int __pyx_tp_traverse_4lxml_5etree__XPathFunctionNamespaceRegistry(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *p = (struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *)o;
  e = __pyx_tp_traverse_4lxml_5etree__NamespaceRegistry(o, v, a); if (e) return e;
  if (p->_prefix) {
    e = (*v)(p->_prefix, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__XPathFunctionNamespaceRegistry(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *p = (struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *)o;
  __pyx_tp_clear_4lxml_5etree__NamespaceRegistry(o);
  Py_CLEAR(p->_prefix);
  return 0;
}

static PyObject *__pyx_getprop_4lxml_5etree_31_XPathFunctionNamespaceRegistry_prefix(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_31_XPathFunctionNamespaceRegistry_6prefix_3__get__(o);
}

static int __pyx_setprop_4lxml_5etree_31_XPathFunctionNamespaceRegistry_prefix(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_4lxml_5etree_31_XPathFunctionNamespaceRegistry_6prefix_5__set__(o, v);
  }
  else {
    return __pyx_pw_4lxml_5etree_31_XPathFunctionNamespaceRegistry_6prefix_1__del__(o);
  }
}

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__XPathFunctionNamespaceRegistry[] = {
  {"prefix", __pyx_getprop_4lxml_5etree_31_XPathFunctionNamespaceRegistry_prefix, __pyx_setprop_4lxml_5etree_31_XPathFunctionNamespaceRegistry_prefix, PyDoc_STR("Namespace prefix for extension functions."), 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__XPathFunctionNamespaceRegistry_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__XPathFunctionNamespaceRegistry},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__XPathFunctionNamespaceRegistry},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__XPathFunctionNamespaceRegistry},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree__XPathFunctionNamespaceRegistry},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__XPathFunctionNamespaceRegistry},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__XPathFunctionNamespaceRegistry_spec = {
  "lxml.etree._XPathFunctionNamespaceRegistry",
  sizeof(struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__XPathFunctionNamespaceRegistry_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__XPathFunctionNamespaceRegistry = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_XPathFunctionNamespaceRegistry", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__XPathFunctionNamespaceRegistry, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_26_FunctionNamespaceRegistry_3__repr__, /*tp_repr*/
  #else
  0, /*tp_repr*/
  #endif
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_18_NamespaceRegistry_17__call__, /*tp_call*/
  #else
  0, /*tp_call*/
  #endif
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__XPathFunctionNamespaceRegistry, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__XPathFunctionNamespaceRegistry, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_18_NamespaceRegistry_9__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__XPathFunctionNamespaceRegistry, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__XPathFunctionNamespaceRegistry, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4lxml_5etree__InputDocument(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree__InputDocument *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 1);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__InputDocument *)o);
  p->_data_bytes = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_filename = Py_None; Py_INCREF(Py_None);
  p->_file = Py_None; Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_14_InputDocument_1__cinit__(o, __pyx_mstate_global->__pyx_empty_tuple, NULL) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_4lxml_5etree__InputDocument(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__InputDocument *p = (struct __pyx_obj_4lxml_5etree__InputDocument *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_data_bytes);
  Py_CLEAR(p->_filename);
  Py_CLEAR(p->_file);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_4lxml_5etree__InputDocument(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__InputDocument *p = (struct __pyx_obj_4lxml_5etree__InputDocument *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->_filename) {
    e = (*v)(p->_filename, a); if (e) return e;
  }
  if (p->_file) {
    e = (*v)(p->_file, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__InputDocument(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__InputDocument *p = (struct __pyx_obj_4lxml_5etree__InputDocument *)o;
  Py_CLEAR(p->_filename);
  Py_CLEAR(p->_file);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__InputDocument[] = {
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__InputDocument_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__InputDocument},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__InputDocument},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__InputDocument},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__InputDocument},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__InputDocument},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__InputDocument_spec = {
  "lxml.etree._InputDocument",
  sizeof(struct __pyx_obj_4lxml_5etree__InputDocument),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__InputDocument_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__InputDocument = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_InputDocument", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__InputDocument), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__InputDocument, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__InputDocument, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__InputDocument, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__InputDocument, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__InputDocument, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4lxml_5etree_Resolver(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 0);
  if (unlikely(!o)) return 0;
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_Resolver(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree_Resolver) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static PyMethodDef __pyx_methods_4lxml_5etree_Resolver[] = {
  {"resolve", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8Resolver_1resolve, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8Resolver_resolve},
  {"resolve_empty", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8Resolver_3resolve_empty, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8Resolver_2resolve_empty},
  {"resolve_string", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8Resolver_5resolve_string, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8Resolver_4resolve_string},
  {"resolve_filename", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8Resolver_7resolve_filename, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8Resolver_6resolve_filename},
  {"resolve_file", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8Resolver_9resolve_file, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8Resolver_8resolve_file},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_Resolver_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_Resolver},
  {Py_tp_doc, (void *)PyDoc_STR("This is the base class of all resolvers.")},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_Resolver},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_Resolver},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_Resolver_spec = {
  "lxml.etree.Resolver",
  sizeof(struct __pyx_obj_4lxml_5etree_Resolver),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE,
  __pyx_type_4lxml_5etree_Resolver_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_Resolver = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""Resolver", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_Resolver), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_Resolver, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  PyDoc_STR("This is the base class of all resolvers."), /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_Resolver, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_Resolver, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__ResolverRegistry __pyx_vtable_4lxml_5etree__ResolverRegistry;

static PyObject *__pyx_tp_new_4lxml_5etree__ResolverRegistry(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ResolverRegistry *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 1);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__ResolverRegistry;
  p->_resolvers = Py_None; Py_INCREF(Py_None);
  p->_default_resolver = ((struct __pyx_obj_4lxml_5etree_Resolver *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_17_ResolverRegistry_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_4lxml_5etree__ResolverRegistry(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ResolverRegistry *p = (struct __pyx_obj_4lxml_5etree__ResolverRegistry *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_resolvers);
  Py_CLEAR(p->_default_resolver);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_4lxml_5etree__ResolverRegistry(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__ResolverRegistry *p = (struct __pyx_obj_4lxml_5etree__ResolverRegistry *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->_resolvers) {
    e = (*v)(p->_resolvers, a); if (e) return e;
  }
  if (p->_default_resolver) {
    e = (*v)(((PyObject *)p->_default_resolver), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__ResolverRegistry(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ResolverRegistry *p = (struct __pyx_obj_4lxml_5etree__ResolverRegistry *)o;
  Py_CLEAR(p->_resolvers);
  Py_CLEAR(p->_default_resolver);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__ResolverRegistry[] = {
  {"add", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_17_ResolverRegistry_3add, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_17_ResolverRegistry_2add},
  {"remove", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_17_ResolverRegistry_5remove, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_17_ResolverRegistry_4remove},
  {"copy", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_17_ResolverRegistry_7copy, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_17_ResolverRegistry_6copy},
  {"resolve", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_17_ResolverRegistry_9resolve, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_17_ResolverRegistry_8resolve},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__ResolverRegistry_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__ResolverRegistry},
  {Py_tp_repr, (void *)__pyx_pw_4lxml_5etree_17_ResolverRegistry_11__repr__},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__ResolverRegistry},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__ResolverRegistry},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__ResolverRegistry},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__ResolverRegistry},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__ResolverRegistry_spec = {
  "lxml.etree._ResolverRegistry",
  sizeof(struct __pyx_obj_4lxml_5etree__ResolverRegistry),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__ResolverRegistry_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__ResolverRegistry = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_ResolverRegistry", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ResolverRegistry), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ResolverRegistry, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  __pyx_pw_4lxml_5etree_17_ResolverRegistry_11__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ResolverRegistry, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ResolverRegistry, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__ResolverRegistry, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__ResolverRegistry, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__ResolverContext __pyx_vtable_4lxml_5etree__ResolverContext;

static PyObject *__pyx_tp_new_4lxml_5etree__ResolverContext(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ResolverContext *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ExceptionContext(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ResolverContext *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext*)__pyx_vtabptr_4lxml_5etree__ResolverContext;
  p->_resolvers = ((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)Py_None); Py_INCREF(Py_None);
  p->_storage = ((struct __pyx_obj_4lxml_5etree__TempStore *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__ResolverContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ResolverContext *p = (struct __pyx_obj_4lxml_5etree__ResolverContext *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree__ResolverContext) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_resolvers);
  Py_CLEAR(p->_storage);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_4lxml_5etree__ExceptionContext(o);
}

static int __pyx_tp_traverse_4lxml_5etree__ResolverContext(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__ResolverContext *p = (struct __pyx_obj_4lxml_5etree__ResolverContext *)o;
  e = __pyx_tp_traverse_4lxml_5etree__ExceptionContext(o, v, a); if (e) return e;
  if (p->_resolvers) {
    e = (*v)(((PyObject *)p->_resolvers), a); if (e) return e;
  }
  if (p->_storage) {
    e = (*v)(((PyObject *)p->_storage), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__ResolverContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ResolverContext *p = (struct __pyx_obj_4lxml_5etree__ResolverContext *)o;
  __pyx_tp_clear_4lxml_5etree__ExceptionContext(o);
  Py_CLEAR(p->_resolvers);
  Py_CLEAR(p->_storage);
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__ResolverContext_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__ResolverContext},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__ResolverContext},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__ResolverContext},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__ResolverContext},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__ResolverContext_spec = {
  "lxml.etree._ResolverContext",
  sizeof(struct __pyx_obj_4lxml_5etree__ResolverContext),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__ResolverContext_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__ResolverContext = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_ResolverContext", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ResolverContext), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ResolverContext, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ResolverContext, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ResolverContext, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__ResolverContext, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_ParserError_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_Error},
  {Py_tp_doc, (void *)PyDoc_STR("Internal lxml parser error.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_Error},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_Error},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_Error},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_ParserError_spec = {
  "lxml.etree.ParserError",
  sizeof(struct __pyx_obj_4lxml_5etree_ParserError),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_ParserError_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_ParserError = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""ParserError", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_ParserError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_Error, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("Internal lxml parser error.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_Error, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_Error, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_9LxmlError_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_Error, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext __pyx_vtable_4lxml_5etree__ParserDictionaryContext;

static PyObject *__pyx_tp_new_4lxml_5etree__ParserDictionaryContext(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 1);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__ParserDictionaryContext;
  p->_default_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None); Py_INCREF(Py_None);
  p->_implied_parser_contexts = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_24_ParserDictionaryContext_1__cinit__(o, __pyx_mstate_global->__pyx_empty_tuple, NULL) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_4lxml_5etree__ParserDictionaryContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *p = (struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)o;
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_4lxml_5etree_24_ParserDictionaryContext_3__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->_default_parser);
  Py_CLEAR(p->_implied_parser_contexts);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_4lxml_5etree__ParserDictionaryContext(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *p = (struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->_default_parser) {
    e = (*v)(((PyObject *)p->_default_parser), a); if (e) return e;
  }
  if (p->_implied_parser_contexts) {
    e = (*v)(p->_implied_parser_contexts, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__ParserDictionaryContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *p = (struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)o;
  Py_CLEAR(p->_default_parser);
  Py_CLEAR(p->_implied_parser_contexts);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__ParserDictionaryContext[] = {
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__ParserDictionaryContext_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__ParserDictionaryContext},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__ParserDictionaryContext},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__ParserDictionaryContext},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__ParserDictionaryContext},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__ParserDictionaryContext},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__ParserDictionaryContext_spec = {
  "lxml.etree._ParserDictionaryContext",
  sizeof(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__ParserDictionaryContext_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__ParserDictionaryContext = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_ParserDictionaryContext", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ParserDictionaryContext, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ParserDictionaryContext, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ParserDictionaryContext, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__ParserDictionaryContext, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__ParserDictionaryContext, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__FileReaderContext __pyx_vtable_4lxml_5etree__FileReaderContext;

static PyObject *__pyx_tp_new_4lxml_5etree__FileReaderContext(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__FileReaderContext *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 1);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__FileReaderContext *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__FileReaderContext;
  p->_filelike = Py_None; Py_INCREF(Py_None);
  p->_encoding = Py_None; Py_INCREF(Py_None);
  p->_url = Py_None; Py_INCREF(Py_None);
  p->_bytes = Py_None; Py_INCREF(Py_None);
  p->_exc_context = ((struct __pyx_obj_4lxml_5etree__ExceptionContext *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_18_FileReaderContext_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_4lxml_5etree__FileReaderContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__FileReaderContext *p = (struct __pyx_obj_4lxml_5etree__FileReaderContext *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_filelike);
  Py_CLEAR(p->_encoding);
  Py_CLEAR(p->_url);
  Py_CLEAR(p->_bytes);
  Py_CLEAR(p->_exc_context);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_4lxml_5etree__FileReaderContext(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__FileReaderContext *p = (struct __pyx_obj_4lxml_5etree__FileReaderContext *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->_filelike) {
    e = (*v)(p->_filelike, a); if (e) return e;
  }
  if (p->_encoding) {
    e = (*v)(p->_encoding, a); if (e) return e;
  }
  if (p->_url) {
    e = (*v)(p->_url, a); if (e) return e;
  }
  if (p->_bytes) {
    e = (*v)(p->_bytes, a); if (e) return e;
  }
  if (p->_exc_context) {
    e = (*v)(((PyObject *)p->_exc_context), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__FileReaderContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__FileReaderContext *p = (struct __pyx_obj_4lxml_5etree__FileReaderContext *)o;
  Py_CLEAR(p->_filelike);
  Py_CLEAR(p->_encoding);
  Py_CLEAR(p->_url);
  Py_CLEAR(p->_bytes);
  Py_CLEAR(p->_exc_context);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__FileReaderContext[] = {
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__FileReaderContext_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__FileReaderContext},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__FileReaderContext},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__FileReaderContext},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__FileReaderContext},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__FileReaderContext},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__FileReaderContext_spec = {
  "lxml.etree._FileReaderContext",
  sizeof(struct __pyx_obj_4lxml_5etree__FileReaderContext),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__FileReaderContext_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__FileReaderContext = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_FileReaderContext", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__FileReaderContext), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__FileReaderContext, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__FileReaderContext, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__FileReaderContext, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__FileReaderContext, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__FileReaderContext, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__ParserContext __pyx_vtable_4lxml_5etree__ParserContext;

static PyObject *__pyx_tp_new_4lxml_5etree__ParserContext(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ParserContext *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ResolverContext(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ParserContext *)o);
  p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext*)__pyx_vtabptr_4lxml_5etree__ParserContext;
  p->_error_log = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)Py_None); Py_INCREF(Py_None);
  p->_validator = ((struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *)Py_None); Py_INCREF(Py_None);
  p->_doc = ((struct LxmlDocument *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_14_ParserContext_1__cinit__(o, __pyx_mstate_global->__pyx_empty_tuple, NULL) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_4lxml_5etree__ParserContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ParserContext *p = (struct __pyx_obj_4lxml_5etree__ParserContext *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree__ParserContext) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_4lxml_5etree_14_ParserContext_3__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->_error_log);
  Py_CLEAR(p->_validator);
  Py_CLEAR(p->_doc);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_4lxml_5etree__ResolverContext(o);
}

static int __pyx_tp_traverse_4lxml_5etree__ParserContext(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__ParserContext *p = (struct __pyx_obj_4lxml_5etree__ParserContext *)o;
  e = __pyx_tp_traverse_4lxml_5etree__ResolverContext(o, v, a); if (e) return e;
  if (p->_error_log) {
    e = (*v)(((PyObject *)p->_error_log), a); if (e) return e;
  }
  if (p->_validator) {
    e = (*v)(((PyObject *)p->_validator), a); if (e) return e;
  }
  if (p->_doc) {
    e = (*v)(((PyObject *)p->_doc), a); if (e) return e;
  }
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__ParserContext[] = {
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__ParserContext_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__ParserContext},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__ParserContext},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__ParserContext},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__ParserContext},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__ParserContext_spec = {
  "lxml.etree._ParserContext",
  sizeof(struct __pyx_obj_4lxml_5etree__ParserContext),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__ParserContext_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__ParserContext = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_ParserContext", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ParserContext), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ParserContext, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ParserContext, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__ParserContext, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__ParserContext, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__BaseParser __pyx_vtable_4lxml_5etree__BaseParser;

static PyObject *__pyx_tp_new_4lxml_5etree__BaseParser(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree__BaseParser *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__BaseParser *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__BaseParser;
  p->_class_lookup = ((struct LxmlElementClassLookup *)Py_None); Py_INCREF(Py_None);
  p->_resolvers = ((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)Py_None); Py_INCREF(Py_None);
  p->_parser_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)Py_None); Py_INCREF(Py_None);
  p->_push_parser_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)Py_None); Py_INCREF(Py_None);
  p->_schema = ((struct __pyx_obj_4lxml_5etree_XMLSchema *)Py_None); Py_INCREF(Py_None);
  p->_filename = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->target = Py_None; Py_INCREF(Py_None);
  p->_default_encoding = Py_None; Py_INCREF(Py_None);
  p->_events_to_collect = ((PyObject*)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__BaseParser(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__BaseParser *p = (struct __pyx_obj_4lxml_5etree__BaseParser *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree__BaseParser) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_class_lookup);
  Py_CLEAR(p->_resolvers);
  Py_CLEAR(p->_parser_context);
  Py_CLEAR(p->_push_parser_context);
  Py_CLEAR(p->_schema);
  Py_CLEAR(p->_filename);
  Py_CLEAR(p->target);
  Py_CLEAR(p->_default_encoding);
  Py_CLEAR(p->_events_to_collect);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_4lxml_5etree__BaseParser(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__BaseParser *p = (struct __pyx_obj_4lxml_5etree__BaseParser *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->_class_lookup) {
    e = (*v)(((PyObject *)p->_class_lookup), a); if (e) return e;
  }
  if (p->_resolvers) {
    e = (*v)(((PyObject *)p->_resolvers), a); if (e) return e;
  }
  if (p->_parser_context) {
    e = (*v)(((PyObject *)p->_parser_context), a); if (e) return e;
  }
  if (p->_push_parser_context) {
    e = (*v)(((PyObject *)p->_push_parser_context), a); if (e) return e;
  }
  if (p->_schema) {
    e = (*v)(((PyObject *)p->_schema), a); if (e) return e;
  }
  if (p->target) {
    e = (*v)(p->target, a); if (e) return e;
  }
  if (p->_default_encoding) {
    e = (*v)(p->_default_encoding, a); if (e) return e;
  }
  if (p->_events_to_collect) {
    e = (*v)(p->_events_to_collect, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__BaseParser(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__BaseParser *p = (struct __pyx_obj_4lxml_5etree__BaseParser *)o;
  Py_CLEAR(p->_class_lookup);
  Py_CLEAR(p->_resolvers);
  Py_CLEAR(p->_parser_context);
  Py_CLEAR(p->_push_parser_context);
  Py_CLEAR(p->_schema);
  Py_CLEAR(p->target);
  Py_CLEAR(p->_default_encoding);
  Py_CLEAR(p->_events_to_collect);
  return 0;
}

static PyObject *__pyx_getprop_4lxml_5etree_11_BaseParser_error_log(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_11_BaseParser_9error_log_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_11_BaseParser_resolvers(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_11_BaseParser_9resolvers_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_11_BaseParser_version(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_11_BaseParser_7version_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_11_BaseParser_target(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_11_BaseParser_6target_1__get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree__BaseParser[] = {
  {"set_element_class_lookup", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_11_BaseParser_3set_element_class_lookup, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_11_BaseParser_2set_element_class_lookup},
  {"copy", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_11_BaseParser_5copy, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_11_BaseParser_4copy},
  {"makeelement", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_11_BaseParser_7makeelement, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_11_BaseParser_6makeelement},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__BaseParser[] = {
  {"error_log", __pyx_getprop_4lxml_5etree_11_BaseParser_error_log, 0, PyDoc_STR("The error log of the last parser run.\n        "), 0},
  {"resolvers", __pyx_getprop_4lxml_5etree_11_BaseParser_resolvers, 0, PyDoc_STR("The custom resolver registry of this parser."), 0},
  {"version", __pyx_getprop_4lxml_5etree_11_BaseParser_version, 0, PyDoc_STR("The version of the underlying XML parser."), 0},
  {"target", __pyx_getprop_4lxml_5etree_11_BaseParser_target, 0, 0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__BaseParser_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__BaseParser},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__BaseParser},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__BaseParser},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__BaseParser},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree__BaseParser},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_11_BaseParser_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__BaseParser},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__BaseParser_spec = {
  "lxml.etree._BaseParser",
  sizeof(struct __pyx_obj_4lxml_5etree__BaseParser),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__BaseParser_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__BaseParser = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_BaseParser", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__BaseParser), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__BaseParser, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__BaseParser, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__BaseParser, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__BaseParser, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__BaseParser, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_4lxml_5etree_11_BaseParser_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__BaseParser, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__FeedParser __pyx_vtable_4lxml_5etree__FeedParser;

static PyObject *__pyx_tp_new_4lxml_5etree__FeedParser(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__FeedParser *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__BaseParser(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__FeedParser *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__BaseParser*)__pyx_vtabptr_4lxml_5etree__FeedParser;
  return o;
}

static PyObject *__pyx_getprop_4lxml_5etree_11_FeedParser_feed_error_log(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_11_FeedParser_14feed_error_log_1__get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree__FeedParser[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__FeedParser[] = {
  {"feed_error_log", __pyx_getprop_4lxml_5etree_11_FeedParser_feed_error_log, 0, PyDoc_STR("The error log of the last (or current) run of the feed parser.\n\n        Note that this is local to the feed parser and thus is\n        different from what the ``error_log`` property returns.\n        "), 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__FeedParser_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__BaseParser},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__BaseParser},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__BaseParser},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__FeedParser},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree__FeedParser},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__FeedParser},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__FeedParser_spec = {
  "lxml.etree._FeedParser",
  sizeof(struct __pyx_obj_4lxml_5etree__FeedParser),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__FeedParser_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__FeedParser = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_FeedParser", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__FeedParser), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__BaseParser, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__BaseParser, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__BaseParser, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__FeedParser, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__FeedParser, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_11_BaseParser_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__FeedParser, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree_XMLParser __pyx_vtable_4lxml_5etree_XMLParser;

static PyObject *__pyx_tp_new_4lxml_5etree_XMLParser(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_XMLParser *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__FeedParser(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_XMLParser *)o);
  p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__BaseParser*)__pyx_vtabptr_4lxml_5etree_XMLParser;
  return o;
}

static PyMethodDef __pyx_methods_4lxml_5etree_XMLParser[] = {
  {"__class_getitem__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_9XMLParser_3__class_getitem__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_XMLParser_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__BaseParser},
  {Py_tp_doc, (void *)PyDoc_STR("XMLParser(self, encoding=None, attribute_defaults=False, dtd_validation=False,                  load_dtd=False, no_network=True, decompress=False, ns_clean=False,                  recover=False, schema: XMLSchema =None, huge_tree=False,                  remove_blank_text=False, resolve_entities=True,                  remove_comments=False, remove_pis=False, strip_cdata=True,                  collect_ids=True, target=None, compact=True)\n\n    The XML parser.\n\n    Parsers can be supplied as additional argument to various parse\n    functions of the lxml API.  A default parser is always available\n    and can be replaced by a call to the global function\n    'set_default_parser'.  New parsers can be created at any time\n    without a major run-time overhead.\n\n    The keyword arguments in the constructor are mainly based on the\n    libxml2 parser configuration.  A DTD will also be loaded if DTD\n    validation or attribute default values are requested (unless you\n    additionally provide an XMLSchema from which the default\n    attributes can be read).\n\n    Available boolean keyword arguments:\n\n    - attribute_defaults - inject default attributes from DTD or XMLSchema\n    - dtd_validation     - validate against a DTD referenced by the document\n    - load_dtd           - use DTD for parsing\n    - no_network         - prevent network access for related files (default: True)\n    - decompress         - automatically decompress gzip input\n                           (default: False, changed in lxml 6.0, disabling only affects libxml2 2.15+)\n    - ns_clean           - clean up redundant namespace declarations\n    - recover            - try hard to parse through broken XML\n    - remove_blank_text  - discard blank text nodes that appear ignorable\n    - remove_comments    - discard comments\n    - remove_pis         - discard processing instructions\n    - strip_cdata        - replace CDATA sections by normal text content (default: True)\n    - compact        ""    - save memory for short text content (default: True)\n    - collect_ids        - use a hash table of XML IDs for fast access\n                           (default: True, always True with DTD validation)\n    - huge_tree          - disable security restrictions and support very deep trees\n                           and very long text content\n\n    Other keyword arguments:\n\n    - resolve_entities - replace entities by their text value: False for keeping the\n          entity references, True for resolving them, and 'internal' for resolving\n          internal definitions only (no external file/URL access).\n          The default used to be True and was changed to 'internal' in lxml 5.0.\n    - encoding - override the document encoding (note: libiconv encoding name)\n    - target   - a parser target object that will receive the parse events\n    - schema   - an XMLSchema to validate against\n\n    Note that you should avoid sharing parsers between threads.  While this is\n    not harmful, it is more efficient to use separate parsers.  This does not\n    apply to the default parser.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__BaseParser},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__BaseParser},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_XMLParser},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_9XMLParser_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_XMLParser},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_XMLParser_spec = {
  "lxml.etree.XMLParser",
  sizeof(struct __pyx_obj_4lxml_5etree_XMLParser),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_XMLParser_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_XMLParser = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""XMLParser", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_XMLParser), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__BaseParser, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("XMLParser(self, encoding=None, attribute_defaults=False, dtd_validation=False,                  load_dtd=False, no_network=True, decompress=False, ns_clean=False,                  recover=False, schema: XMLSchema =None, huge_tree=False,                  remove_blank_text=False, resolve_entities=True,                  remove_comments=False, remove_pis=False, strip_cdata=True,                  collect_ids=True, target=None, compact=True)\n\n    The XML parser.\n\n    Parsers can be supplied as additional argument to various parse\n    functions of the lxml API.  A default parser is always available\n    and can be replaced by a call to the global function\n    'set_default_parser'.  New parsers can be created at any time\n    without a major run-time overhead.\n\n    The keyword arguments in the constructor are mainly based on the\n    libxml2 parser configuration.  A DTD will also be loaded if DTD\n    validation or attribute default values are requested (unless you\n    additionally provide an XMLSchema from which the default\n    attributes can be read).\n\n    Available boolean keyword arguments:\n\n    - attribute_defaults - inject default attributes from DTD or XMLSchema\n    - dtd_validation     - validate against a DTD referenced by the document\n    - load_dtd           - use DTD for parsing\n    - no_network         - prevent network access for related files (default: True)\n    - decompress         - automatically decompress gzip input\n                           (default: False, changed in lxml 6.0, disabling only affects libxml2 2.15+)\n    - ns_clean           - clean up redundant namespace declarations\n    - recover            - try hard to parse through broken XML\n    - remove_blank_text  - discard blank text nodes that appear ignorable\n    - remove_comments    - discard comments\n    - remove_pis         - discard processing instructions\n    - strip_cdata        - replace CDATA sections by normal text content (default: True)\n    - compact        ""    - save memory for short text content (default: True)\n    - collect_ids        - use a hash table of XML IDs for fast access\n                           (default: True, always True with DTD validation)\n    - huge_tree          - disable security restrictions and support very deep trees\n                           and very long text content\n\n    Other keyword arguments:\n\n    - resolve_entities - replace entities by their text value: False for keeping the\n          entity references, True for resolving them, and 'internal' for resolving\n          internal definitions only (no external file/URL access).\n          The default used to be True and was changed to 'internal' in lxml 5.0.\n    - encoding - override the document encoding (note: libiconv encoding name)\n    - target   - a parser target object that will receive the parse events\n    - schema   - an XMLSchema to validate against\n\n    Note that you should avoid sharing parsers between threads.  While this is\n    not harmful, it is more efficient to use separate parsers.  This does not\n    apply to the default parser.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__BaseParser, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__BaseParser, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_XMLParser, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_4lxml_5etree_9XMLParser_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_XMLParser, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree_XMLPullParser __pyx_vtable_4lxml_5etree_XMLPullParser;

static PyObject *__pyx_tp_new_4lxml_5etree_XMLPullParser(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_XMLPullParser *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree_XMLParser(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_XMLPullParser *)o);
  p->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__BaseParser*)__pyx_vtabptr_4lxml_5etree_XMLPullParser;
  return o;
}

static PyMethodDef __pyx_methods_4lxml_5etree_XMLPullParser[] = {
  {"read_events", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_13XMLPullParser_3read_events, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_XMLPullParser_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__BaseParser},
  {Py_tp_doc, (void *)PyDoc_STR("XMLPullParser(self, events=None, *, tag=None, **kwargs)\n\n    XML parser that collects parse events in an iterator.\n\n    The collected events are the same as for iterparse(), but the\n    parser itself is non-blocking in the sense that it receives\n    data chunks incrementally through its .feed() method, instead\n    of reading them directly from a file(-like) object all by itself.\n\n    By default, it collects Element end events.  To change that,\n    pass any subset of the available events into the ``events``\n    argument: ``'start'``, ``'end'``, ``'start-ns'``,\n    ``'end-ns'``, ``'comment'``, ``'pi'``.\n\n    To support loading external dependencies relative to the input\n    source, you can pass the ``base_url``.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__BaseParser},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__BaseParser},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_XMLPullParser},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_13XMLPullParser_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_XMLPullParser},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_XMLPullParser_spec = {
  "lxml.etree.XMLPullParser",
  sizeof(struct __pyx_obj_4lxml_5etree_XMLPullParser),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_XMLPullParser_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_XMLPullParser = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""XMLPullParser", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_XMLPullParser), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__BaseParser, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("XMLPullParser(self, events=None, *, tag=None, **kwargs)\n\n    XML parser that collects parse events in an iterator.\n\n    The collected events are the same as for iterparse(), but the\n    parser itself is non-blocking in the sense that it receives\n    data chunks incrementally through its .feed() method, instead\n    of reading them directly from a file(-like) object all by itself.\n\n    By default, it collects Element end events.  To change that,\n    pass any subset of the available events into the ``events``\n    argument: ``'start'``, ``'end'``, ``'start-ns'``,\n    ``'end-ns'``, ``'comment'``, ``'pi'``.\n\n    To support loading external dependencies relative to the input\n    source, you can pass the ``base_url``.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__BaseParser, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__BaseParser, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_XMLPullParser, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_4lxml_5etree_13XMLPullParser_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_XMLPullParser, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree_ETCompatXMLParser __pyx_vtable_4lxml_5etree_ETCompatXMLParser;

static PyObject *__pyx_tp_new_4lxml_5etree_ETCompatXMLParser(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_ETCompatXMLParser *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree_XMLParser(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_ETCompatXMLParser *)o);
  p->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__BaseParser*)__pyx_vtabptr_4lxml_5etree_ETCompatXMLParser;
  return o;
}

static PyMethodDef __pyx_methods_4lxml_5etree_ETCompatXMLParser[] = {
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_ETCompatXMLParser_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__BaseParser},
  {Py_tp_doc, (void *)PyDoc_STR("ETCompatXMLParser(self, encoding=None, attribute_defaults=False,                  dtd_validation=False, load_dtd=False, no_network=True, decompress=False,                  ns_clean=False, recover=False, schema=None,                  huge_tree=False, remove_blank_text=False, resolve_entities=True,                  remove_comments=True, remove_pis=True, strip_cdata=True,                  target=None, compact=True)\n\n    An XML parser with an ElementTree compatible default setup.\n\n    See the XMLParser class for details.\n\n    This parser has ``remove_comments`` and ``remove_pis`` enabled by default\n    and thus ignores comments and processing instructions.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__BaseParser},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__BaseParser},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_ETCompatXMLParser},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_17ETCompatXMLParser_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_ETCompatXMLParser},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_ETCompatXMLParser_spec = {
  "lxml.etree.ETCompatXMLParser",
  sizeof(struct __pyx_obj_4lxml_5etree_ETCompatXMLParser),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_ETCompatXMLParser_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_ETCompatXMLParser = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""ETCompatXMLParser", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_ETCompatXMLParser), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__BaseParser, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("ETCompatXMLParser(self, encoding=None, attribute_defaults=False,                  dtd_validation=False, load_dtd=False, no_network=True, decompress=False,                  ns_clean=False, recover=False, schema=None,                  huge_tree=False, remove_blank_text=False, resolve_entities=True,                  remove_comments=True, remove_pis=True, strip_cdata=True,                  target=None, compact=True)\n\n    An XML parser with an ElementTree compatible default setup.\n\n    See the XMLParser class for details.\n\n    This parser has ``remove_comments`` and ``remove_pis`` enabled by default\n    and thus ignores comments and processing instructions.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__BaseParser, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__BaseParser, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_ETCompatXMLParser, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_4lxml_5etree_17ETCompatXMLParser_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_ETCompatXMLParser, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree_HTMLParser __pyx_vtable_4lxml_5etree_HTMLParser;

static PyObject *__pyx_tp_new_4lxml_5etree_HTMLParser(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_HTMLParser *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__FeedParser(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_HTMLParser *)o);
  p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__BaseParser*)__pyx_vtabptr_4lxml_5etree_HTMLParser;
  return o;
}

static PyMethodDef __pyx_methods_4lxml_5etree_HTMLParser[] = {
  {"__class_getitem__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_10HTMLParser_3__class_getitem__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_HTMLParser_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__BaseParser},
  {Py_tp_doc, (void *)PyDoc_STR("HTMLParser(self, encoding=None, remove_blank_text=False,                    remove_comments=False, remove_pis=False,                    no_network=True, decompress=False, target=None, schema: XMLSchema =None,                    recover=True, compact=True, collect_ids=True, huge_tree=False)\n\n    The HTML parser.\n\n    This parser allows reading HTML into a normal XML tree.  By\n    default, it can read broken (non well-formed) HTML, depending on\n    the capabilities of libxml2.  Use the 'recover' option to switch\n    this off.\n\n    Available boolean keyword arguments:\n\n    - recover            - try hard to parse through broken HTML (default: True)\n    - no_network         - prevent network access for related files (default: True)\n    - decompress         - automatically decompress gzip input\n                           (default: False, changed in lxml 6.0, disabling only affects libxml2 2.15+)\n    - remove_blank_text  - discard empty text nodes that are ignorable (i.e. not actual text content)\n    - remove_comments    - discard comments\n    - remove_pis         - discard processing instructions\n    - compact            - save memory for short text content (default: True)\n    - default_doctype    - add a default doctype even if it is not found in the HTML (default: True)\n    - collect_ids        - use a hash table of XML IDs for fast access (default: True)\n    - huge_tree          - disable security restrictions and support very deep trees\n                           and very long text content\n\n    Other keyword arguments:\n\n    - encoding - override the document encoding (note: libiconv encoding name)\n    - target   - a parser target object that will receive the parse events\n    - schema   - an XMLSchema to validate against\n\n    Note that you should avoid sharing parsers between threads for performance\n    reasons.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__BaseParser},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__BaseParser},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_HTMLParser},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_10HTMLParser_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_HTMLParser},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_HTMLParser_spec = {
  "lxml.etree.HTMLParser",
  sizeof(struct __pyx_obj_4lxml_5etree_HTMLParser),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_HTMLParser_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_HTMLParser = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""HTMLParser", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_HTMLParser), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__BaseParser, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("HTMLParser(self, encoding=None, remove_blank_text=False,                    remove_comments=False, remove_pis=False,                    no_network=True, decompress=False, target=None, schema: XMLSchema =None,                    recover=True, compact=True, collect_ids=True, huge_tree=False)\n\n    The HTML parser.\n\n    This parser allows reading HTML into a normal XML tree.  By\n    default, it can read broken (non well-formed) HTML, depending on\n    the capabilities of libxml2.  Use the 'recover' option to switch\n    this off.\n\n    Available boolean keyword arguments:\n\n    - recover            - try hard to parse through broken HTML (default: True)\n    - no_network         - prevent network access for related files (default: True)\n    - decompress         - automatically decompress gzip input\n                           (default: False, changed in lxml 6.0, disabling only affects libxml2 2.15+)\n    - remove_blank_text  - discard empty text nodes that are ignorable (i.e. not actual text content)\n    - remove_comments    - discard comments\n    - remove_pis         - discard processing instructions\n    - compact            - save memory for short text content (default: True)\n    - default_doctype    - add a default doctype even if it is not found in the HTML (default: True)\n    - collect_ids        - use a hash table of XML IDs for fast access (default: True)\n    - huge_tree          - disable security restrictions and support very deep trees\n                           and very long text content\n\n    Other keyword arguments:\n\n    - encoding - override the document encoding (note: libiconv encoding name)\n    - target   - a parser target object that will receive the parse events\n    - schema   - an XMLSchema to validate against\n\n    Note that you should avoid sharing parsers between threads for performance\n    reasons.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__BaseParser, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__BaseParser, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_HTMLParser, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_4lxml_5etree_10HTMLParser_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_HTMLParser, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree_HTMLPullParser __pyx_vtable_4lxml_5etree_HTMLPullParser;

static PyObject *__pyx_tp_new_4lxml_5etree_HTMLPullParser(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_HTMLPullParser *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree_HTMLParser(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_HTMLPullParser *)o);
  p->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__BaseParser*)__pyx_vtabptr_4lxml_5etree_HTMLPullParser;
  return o;
}

static PyMethodDef __pyx_methods_4lxml_5etree_HTMLPullParser[] = {
  {"read_events", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_14HTMLPullParser_3read_events, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_HTMLPullParser_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__BaseParser},
  {Py_tp_doc, (void *)PyDoc_STR("HTMLPullParser(self, events=None, *, tag=None, base_url=None, **kwargs)\n\n    HTML parser that collects parse events in an iterator.\n\n    The collected events are the same as for iterparse(), but the\n    parser itself is non-blocking in the sense that it receives\n    data chunks incrementally through its .feed() method, instead\n    of reading them directly from a file(-like) object all by itself.\n\n    By default, it collects Element end events.  To change that,\n    pass any subset of the available events into the ``events``\n    argument: ``'start'``, ``'end'``, ``'start-ns'``,\n    ``'end-ns'``, ``'comment'``, ``'pi'``.\n\n    To support loading external dependencies relative to the input\n    source, you can pass the ``base_url``.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__BaseParser},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__BaseParser},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_HTMLPullParser},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_14HTMLPullParser_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_HTMLPullParser},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_HTMLPullParser_spec = {
  "lxml.etree.HTMLPullParser",
  sizeof(struct __pyx_obj_4lxml_5etree_HTMLPullParser),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_HTMLPullParser_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_HTMLPullParser = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""HTMLPullParser", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_HTMLPullParser), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__BaseParser, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("HTMLPullParser(self, events=None, *, tag=None, base_url=None, **kwargs)\n\n    HTML parser that collects parse events in an iterator.\n\n    The collected events are the same as for iterparse(), but the\n    parser itself is non-blocking in the sense that it receives\n    data chunks incrementally through its .feed() method, instead\n    of reading them directly from a file(-like) object all by itself.\n\n    By default, it collects Element end events.  To change that,\n    pass any subset of the available events into the ``events``\n    argument: ``'start'``, ``'end'``, ``'start-ns'``,\n    ``'end-ns'``, ``'comment'``, ``'pi'``.\n\n    To support loading external dependencies relative to the input\n    source, you can pass the ``base_url``.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__BaseParser, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__BaseParser, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_HTMLPullParser, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_4lxml_5etree_14HTMLPullParser_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_HTMLPullParser, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__SaxParserTarget __pyx_vtable_4lxml_5etree__SaxParserTarget;

static PyObject *__pyx_tp_new_4lxml_5etree__SaxParserTarget(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree__SaxParserTarget *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__SaxParserTarget *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__SaxParserTarget;
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__SaxParserTarget(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree__SaxParserTarget) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__SaxParserTarget_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__SaxParserTarget},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__SaxParserTarget},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__SaxParserTarget_spec = {
  "lxml.etree._SaxParserTarget",
  sizeof(struct __pyx_obj_4lxml_5etree__SaxParserTarget),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE,
  __pyx_type_4lxml_5etree__SaxParserTarget_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__SaxParserTarget = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_SaxParserTarget", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__SaxParserTarget), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__SaxParserTarget, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__SaxParserTarget, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext __pyx_vtable_4lxml_5etree__SaxParserContext;

static PyObject *__pyx_tp_new_4lxml_5etree__SaxParserContext(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__SaxParserContext *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ParserContext(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__SaxParserContext *)o);
  p->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext*)__pyx_vtabptr_4lxml_5etree__SaxParserContext;
  p->_target = ((struct __pyx_obj_4lxml_5etree__SaxParserTarget *)Py_None); Py_INCREF(Py_None);
  p->_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None); Py_INCREF(Py_None);
  p->_ns_stack = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_node_stack = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->events_iterator = ((struct __pyx_obj_4lxml_5etree__ParseEventsIterator *)Py_None); Py_INCREF(Py_None);
  p->_root = ((struct LxmlElement *)Py_None); Py_INCREF(Py_None);
  p->_matcher = ((struct __pyx_obj_4lxml_5etree__MultiTagMatcher *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_17_SaxParserContext_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_4lxml_5etree__SaxParserContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__SaxParserContext *p = (struct __pyx_obj_4lxml_5etree__SaxParserContext *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree__SaxParserContext) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_target);
  Py_CLEAR(p->_parser);
  Py_CLEAR(p->_ns_stack);
  Py_CLEAR(p->_node_stack);
  Py_CLEAR(p->events_iterator);
  Py_CLEAR(p->_root);
  Py_CLEAR(p->_matcher);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_4lxml_5etree__ParserContext(o);
}

static int __pyx_tp_traverse_4lxml_5etree__SaxParserContext(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__SaxParserContext *p = (struct __pyx_obj_4lxml_5etree__SaxParserContext *)o;
  e = __pyx_tp_traverse_4lxml_5etree__ParserContext(o, v, a); if (e) return e;
  if (p->_target) {
    e = (*v)(((PyObject *)p->_target), a); if (e) return e;
  }
  if (p->_parser) {
    e = (*v)(((PyObject *)p->_parser), a); if (e) return e;
  }
  if (p->_ns_stack) {
    e = (*v)(p->_ns_stack, a); if (e) return e;
  }
  if (p->_node_stack) {
    e = (*v)(p->_node_stack, a); if (e) return e;
  }
  if (p->events_iterator) {
    e = (*v)(((PyObject *)p->events_iterator), a); if (e) return e;
  }
  if (p->_root) {
    e = (*v)(((PyObject *)p->_root), a); if (e) return e;
  }
  if (p->_matcher) {
    e = (*v)(((PyObject *)p->_matcher), a); if (e) return e;
  }
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__SaxParserContext[] = {
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__SaxParserContext_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__SaxParserContext},
  {Py_tp_doc, (void *)PyDoc_STR("This class maps SAX2 events to parser target events.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__SaxParserContext},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__SaxParserContext},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__SaxParserContext},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__SaxParserContext_spec = {
  "lxml.etree._SaxParserContext",
  sizeof(struct __pyx_obj_4lxml_5etree__SaxParserContext),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__SaxParserContext_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__SaxParserContext = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_SaxParserContext", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__SaxParserContext), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__SaxParserContext, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("This class maps SAX2 events to parser target events.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__SaxParserContext, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__SaxParserContext, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__SaxParserContext, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4lxml_5etree__ParseEventsIterator(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ParseEventsIterator *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 1);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ParseEventsIterator *)o);
  p->_events = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_20_ParseEventsIterator_1__cinit__(o, __pyx_mstate_global->__pyx_empty_tuple, NULL) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_4lxml_5etree__ParseEventsIterator(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ParseEventsIterator *p = (struct __pyx_obj_4lxml_5etree__ParseEventsIterator *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_events);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_4lxml_5etree__ParseEventsIterator(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__ParseEventsIterator *p = (struct __pyx_obj_4lxml_5etree__ParseEventsIterator *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->_events) {
    e = (*v)(p->_events, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__ParseEventsIterator(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ParseEventsIterator *p = (struct __pyx_obj_4lxml_5etree__ParseEventsIterator *)o;
  Py_CLEAR(p->_events);
  return 0;
}

static PyObject *__pyx_specialmethod___pyx_pw_4lxml_5etree_20_ParseEventsIterator_5__next__(PyObject *self, CYTHON_UNUSED PyObject *arg) {
  PyObject *res = __pyx_pw_4lxml_5etree_20_ParseEventsIterator_5__next__(self);
  if (!res && !PyErr_Occurred()) { PyErr_SetNone(PyExc_StopIteration); }
  return res;
}

static PyMethodDef __pyx_methods_4lxml_5etree__ParseEventsIterator[] = {
  {"__next__", (PyCFunction)__pyx_specialmethod___pyx_pw_4lxml_5etree_20_ParseEventsIterator_5__next__, METH_NOARGS|METH_COEXIST, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__ParseEventsIterator_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__ParseEventsIterator},
  {Py_tp_doc, (void *)PyDoc_STR("A reusable parse events iterator")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__ParseEventsIterator},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__ParseEventsIterator},
  {Py_tp_iter, (void *)__pyx_pw_4lxml_5etree_20_ParseEventsIterator_3__iter__},
  {Py_tp_iternext, (void *)__pyx_pw_4lxml_5etree_20_ParseEventsIterator_5__next__},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__ParseEventsIterator},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__ParseEventsIterator},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__ParseEventsIterator_spec = {
  "lxml.etree._ParseEventsIterator",
  sizeof(struct __pyx_obj_4lxml_5etree__ParseEventsIterator),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__ParseEventsIterator_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__ParseEventsIterator = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_ParseEventsIterator", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ParseEventsIterator), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ParseEventsIterator, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("A reusable parse events iterator"), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ParseEventsIterator, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ParseEventsIterator, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_4lxml_5etree_20_ParseEventsIterator_3__iter__, /*tp_iter*/
  __pyx_pw_4lxml_5etree_20_ParseEventsIterator_5__next__, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__ParseEventsIterator, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__ParseEventsIterator, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree_TreeBuilder __pyx_vtable_4lxml_5etree_TreeBuilder;

static PyObject *__pyx_tp_new_4lxml_5etree_TreeBuilder(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_TreeBuilder *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__SaxParserTarget(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_TreeBuilder *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__SaxParserTarget*)__pyx_vtabptr_4lxml_5etree_TreeBuilder;
  p->_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None); Py_INCREF(Py_None);
  p->_factory = Py_None; Py_INCREF(Py_None);
  p->_comment_factory = Py_None; Py_INCREF(Py_None);
  p->_pi_factory = Py_None; Py_INCREF(Py_None);
  p->_data = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_element_stack = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_element_stack_pop = Py_None; Py_INCREF(Py_None);
  p->_last = ((struct LxmlElement *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_TreeBuilder(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_TreeBuilder *p = (struct __pyx_obj_4lxml_5etree_TreeBuilder *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree_TreeBuilder) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_parser);
  Py_CLEAR(p->_factory);
  Py_CLEAR(p->_comment_factory);
  Py_CLEAR(p->_pi_factory);
  Py_CLEAR(p->_data);
  Py_CLEAR(p->_element_stack);
  Py_CLEAR(p->_element_stack_pop);
  Py_CLEAR(p->_last);
  __pyx_tp_dealloc_4lxml_5etree__SaxParserTarget(o);
}

static int __pyx_tp_traverse_4lxml_5etree_TreeBuilder(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree_TreeBuilder *p = (struct __pyx_obj_4lxml_5etree_TreeBuilder *)o;
  #if !CYTHON_USE_MODULE_STATE
  e = 0;
  if (likely(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__SaxParserTarget)) {
    traverseproc traverse = __Pyx_PyType_GetSlot(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__SaxParserTarget, tp_traverse, traverseproc);
    if (traverse) { e = traverse(o, v, a); }
  } else
  #endif
  { e = __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_4lxml_5etree_TreeBuilder); }
  if (e) return e;
  {
    e = __Pyx_call_type_traverse(o, 0, v, a);
    if (e) return e;
  }
  if (p->_parser) {
    e = (*v)(((PyObject *)p->_parser), a); if (e) return e;
  }
  if (p->_factory) {
    e = (*v)(p->_factory, a); if (e) return e;
  }
  if (p->_comment_factory) {
    e = (*v)(p->_comment_factory, a); if (e) return e;
  }
  if (p->_pi_factory) {
    e = (*v)(p->_pi_factory, a); if (e) return e;
  }
  if (p->_data) {
    e = (*v)(p->_data, a); if (e) return e;
  }
  if (p->_element_stack) {
    e = (*v)(p->_element_stack, a); if (e) return e;
  }
  if (p->_element_stack_pop) {
    e = (*v)(p->_element_stack_pop, a); if (e) return e;
  }
  if (p->_last) {
    e = (*v)(((PyObject *)p->_last), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree_TreeBuilder(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_TreeBuilder *p = (struct __pyx_obj_4lxml_5etree_TreeBuilder *)o;
  #if !CYTHON_USE_MODULE_STATE
  if (likely(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__SaxParserTarget)) {
    inquiry clear = __Pyx_PyType_GetSlot(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__SaxParserTarget, tp_clear, inquiry);
    if (clear) clear(o);
  } else
  #endif
  { __Pyx_call_next_tp_clear(o, __pyx_tp_clear_4lxml_5etree_TreeBuilder); }
  Py_CLEAR(p->_parser);
  Py_CLEAR(p->_factory);
  Py_CLEAR(p->_comment_factory);
  Py_CLEAR(p->_pi_factory);
  Py_CLEAR(p->_data);
  Py_CLEAR(p->_element_stack);
  Py_CLEAR(p->_element_stack_pop);
  Py_CLEAR(p->_last);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree_TreeBuilder[] = {
  {"close", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_11TreeBuilder_3close, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_11TreeBuilder_2close},
  {"data", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_11TreeBuilder_5data, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_11TreeBuilder_4data},
  {"start", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_11TreeBuilder_7start, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_11TreeBuilder_6start},
  {"end", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_11TreeBuilder_9end, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_11TreeBuilder_8end},
  {"pi", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_11TreeBuilder_11pi, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_11TreeBuilder_10pi},
  {"comment", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_11TreeBuilder_13comment, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_11TreeBuilder_12comment},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_TreeBuilder_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_TreeBuilder},
  {Py_tp_doc, (void *)PyDoc_STR("TreeBuilder(self, element_factory=None, parser=None,\n                    comment_factory=None, pi_factory=None,\n                    insert_comments=True, insert_pis=True)\n\n    Parser target that builds a tree from parse event callbacks.\n\n    The factory arguments can be used to influence the creation of\n    elements, comments and processing instructions.\n\n    By default, comments and processing instructions are inserted into\n    the tree, but they can be ignored by passing the respective flags.\n\n    The final tree is returned by the ``close()`` method.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_TreeBuilder},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_TreeBuilder},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_TreeBuilder},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_11TreeBuilder_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_TreeBuilder},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_TreeBuilder_spec = {
  "lxml.etree.TreeBuilder",
  sizeof(struct __pyx_obj_4lxml_5etree_TreeBuilder),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_TreeBuilder_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_TreeBuilder = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""TreeBuilder", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_TreeBuilder), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_TreeBuilder, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("TreeBuilder(self, element_factory=None, parser=None,\n                    comment_factory=None, pi_factory=None,\n                    insert_comments=True, insert_pis=True)\n\n    Parser target that builds a tree from parse event callbacks.\n\n    The factory arguments can be used to influence the creation of\n    elements, comments and processing instructions.\n\n    By default, comments and processing instructions are inserted into\n    the tree, but they can be ignored by passing the respective flags.\n\n    The final tree is returned by the ``close()`` method.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_TreeBuilder, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_TreeBuilder, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_TreeBuilder, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_4lxml_5etree_11TreeBuilder_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_TreeBuilder, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__PythonSaxParserTarget __pyx_vtable_4lxml_5etree__PythonSaxParserTarget;

static PyObject *__pyx_tp_new_4lxml_5etree__PythonSaxParserTarget(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__SaxParserTarget(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__SaxParserTarget*)__pyx_vtabptr_4lxml_5etree__PythonSaxParserTarget;
  p->_target_start = Py_None; Py_INCREF(Py_None);
  p->_target_end = Py_None; Py_INCREF(Py_None);
  p->_target_data = Py_None; Py_INCREF(Py_None);
  p->_target_start_ns = Py_None; Py_INCREF(Py_None);
  p->_target_end_ns = Py_None; Py_INCREF(Py_None);
  p->_target_doctype = Py_None; Py_INCREF(Py_None);
  p->_target_pi = Py_None; Py_INCREF(Py_None);
  p->_target_comment = Py_None; Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_22_PythonSaxParserTarget_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_4lxml_5etree__PythonSaxParserTarget(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *p = (struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_target_start);
  Py_CLEAR(p->_target_end);
  Py_CLEAR(p->_target_data);
  Py_CLEAR(p->_target_start_ns);
  Py_CLEAR(p->_target_end_ns);
  Py_CLEAR(p->_target_doctype);
  Py_CLEAR(p->_target_pi);
  Py_CLEAR(p->_target_comment);
  __pyx_tp_dealloc_4lxml_5etree__SaxParserTarget(o);
}

static int __pyx_tp_traverse_4lxml_5etree__PythonSaxParserTarget(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *p = (struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *)o;
  #if !CYTHON_USE_MODULE_STATE
  e = 0;
  if (likely(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__SaxParserTarget)) {
    traverseproc traverse = __Pyx_PyType_GetSlot(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__SaxParserTarget, tp_traverse, traverseproc);
    if (traverse) { e = traverse(o, v, a); }
  } else
  #endif
  { e = __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_4lxml_5etree__PythonSaxParserTarget); }
  if (e) return e;
  {
    e = __Pyx_call_type_traverse(o, 0, v, a);
    if (e) return e;
  }
  if (p->_target_start) {
    e = (*v)(p->_target_start, a); if (e) return e;
  }
  if (p->_target_end) {
    e = (*v)(p->_target_end, a); if (e) return e;
  }
  if (p->_target_data) {
    e = (*v)(p->_target_data, a); if (e) return e;
  }
  if (p->_target_start_ns) {
    e = (*v)(p->_target_start_ns, a); if (e) return e;
  }
  if (p->_target_end_ns) {
    e = (*v)(p->_target_end_ns, a); if (e) return e;
  }
  if (p->_target_doctype) {
    e = (*v)(p->_target_doctype, a); if (e) return e;
  }
  if (p->_target_pi) {
    e = (*v)(p->_target_pi, a); if (e) return e;
  }
  if (p->_target_comment) {
    e = (*v)(p->_target_comment, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__PythonSaxParserTarget(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *p = (struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *)o;
  #if !CYTHON_USE_MODULE_STATE
  if (likely(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__SaxParserTarget)) {
    inquiry clear = __Pyx_PyType_GetSlot(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__SaxParserTarget, tp_clear, inquiry);
    if (clear) clear(o);
  } else
  #endif
  { __Pyx_call_next_tp_clear(o, __pyx_tp_clear_4lxml_5etree__PythonSaxParserTarget); }
  Py_CLEAR(p->_target_start);
  Py_CLEAR(p->_target_end);
  Py_CLEAR(p->_target_data);
  Py_CLEAR(p->_target_start_ns);
  Py_CLEAR(p->_target_end_ns);
  Py_CLEAR(p->_target_doctype);
  Py_CLEAR(p->_target_pi);
  Py_CLEAR(p->_target_comment);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__PythonSaxParserTarget[] = {
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__PythonSaxParserTarget_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__PythonSaxParserTarget},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__PythonSaxParserTarget},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__PythonSaxParserTarget},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__PythonSaxParserTarget},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__PythonSaxParserTarget},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__PythonSaxParserTarget_spec = {
  "lxml.etree._PythonSaxParserTarget",
  sizeof(struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__PythonSaxParserTarget_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__PythonSaxParserTarget = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_PythonSaxParserTarget", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__PythonSaxParserTarget, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__PythonSaxParserTarget, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__PythonSaxParserTarget, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__PythonSaxParserTarget, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__PythonSaxParserTarget, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__TargetParserContext __pyx_vtable_4lxml_5etree__TargetParserContext;

static PyObject *__pyx_tp_new_4lxml_5etree__TargetParserContext(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__TargetParserContext *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__SaxParserContext(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__TargetParserContext *)o);
  p->__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext*)__pyx_vtabptr_4lxml_5etree__TargetParserContext;
  p->_python_target = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__TargetParserContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__TargetParserContext *p = (struct __pyx_obj_4lxml_5etree__TargetParserContext *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_python_target);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_4lxml_5etree__SaxParserContext(o);
}

static int __pyx_tp_traverse_4lxml_5etree__TargetParserContext(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__TargetParserContext *p = (struct __pyx_obj_4lxml_5etree__TargetParserContext *)o;
  e = __pyx_tp_traverse_4lxml_5etree__SaxParserContext(o, v, a); if (e) return e;
  if (p->_python_target) {
    e = (*v)(p->_python_target, a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__TargetParserContext_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__TargetParserContext},
  {Py_tp_doc, (void *)PyDoc_STR("This class maps SAX2 events to the ET parser target interface.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__TargetParserContext},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__TargetParserContext},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__TargetParserContext_spec = {
  "lxml.etree._TargetParserContext",
  sizeof(struct __pyx_obj_4lxml_5etree__TargetParserContext),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__TargetParserContext_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__TargetParserContext = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_TargetParserContext", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__TargetParserContext), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__TargetParserContext, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("This class maps SAX2 events to the ET parser target interface.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__TargetParserContext, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__TargetParserContext, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_SerialisationError_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_Error},
  {Py_tp_doc, (void *)PyDoc_STR("A libxml2 error that occurred during serialisation.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_Error},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_Error},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_Error},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_SerialisationError_spec = {
  "lxml.etree.SerialisationError",
  sizeof(struct __pyx_obj_4lxml_5etree_SerialisationError),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_SerialisationError_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_SerialisationError = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""SerialisationError", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_SerialisationError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_Error, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("A libxml2 error that occurred during serialisation.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_Error, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_Error, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_9LxmlError_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_Error, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__FilelikeWriter __pyx_vtable_4lxml_5etree__FilelikeWriter;

static PyObject *__pyx_tp_new_4lxml_5etree__FilelikeWriter(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__FilelikeWriter *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 1);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__FilelikeWriter *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__FilelikeWriter;
  p->_filelike = Py_None; Py_INCREF(Py_None);
  p->_close_filelike = Py_None; Py_INCREF(Py_None);
  p->_exc_context = ((struct __pyx_obj_4lxml_5etree__ExceptionContext *)Py_None); Py_INCREF(Py_None);
  p->error_log = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_15_FilelikeWriter_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_4lxml_5etree__FilelikeWriter(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__FilelikeWriter *p = (struct __pyx_obj_4lxml_5etree__FilelikeWriter *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_filelike);
  Py_CLEAR(p->_close_filelike);
  Py_CLEAR(p->_exc_context);
  Py_CLEAR(p->error_log);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_4lxml_5etree__FilelikeWriter(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__FilelikeWriter *p = (struct __pyx_obj_4lxml_5etree__FilelikeWriter *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->_filelike) {
    e = (*v)(p->_filelike, a); if (e) return e;
  }
  if (p->_close_filelike) {
    e = (*v)(p->_close_filelike, a); if (e) return e;
  }
  if (p->_exc_context) {
    e = (*v)(((PyObject *)p->_exc_context), a); if (e) return e;
  }
  if (p->error_log) {
    e = (*v)(((PyObject *)p->error_log), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__FilelikeWriter(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__FilelikeWriter *p = (struct __pyx_obj_4lxml_5etree__FilelikeWriter *)o;
  Py_CLEAR(p->_filelike);
  Py_CLEAR(p->_close_filelike);
  Py_CLEAR(p->_exc_context);
  Py_CLEAR(p->error_log);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__FilelikeWriter[] = {
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__FilelikeWriter_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__FilelikeWriter},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__FilelikeWriter},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__FilelikeWriter},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__FilelikeWriter},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__FilelikeWriter},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__FilelikeWriter_spec = {
  "lxml.etree._FilelikeWriter",
  sizeof(struct __pyx_obj_4lxml_5etree__FilelikeWriter),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__FilelikeWriter_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__FilelikeWriter = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_FilelikeWriter", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__FilelikeWriter), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__FilelikeWriter, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__FilelikeWriter, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__FilelikeWriter, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__FilelikeWriter, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__FilelikeWriter, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree_C14NWriterTarget __pyx_vtable_4lxml_5etree_C14NWriterTarget;

static PyObject *__pyx_tp_new_4lxml_5etree_C14NWriterTarget(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree_C14NWriterTarget *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_C14NWriterTarget *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree_C14NWriterTarget;
  p->_write = Py_None; Py_INCREF(Py_None);
  p->_data = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_qname_aware_tags = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_find_qname_aware_attrs = Py_None; Py_INCREF(Py_None);
  p->_declared_ns_stack = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_ns_stack = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_prefix_map = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_preserve_space = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_pending_start = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_exclude_tags = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_exclude_attrs = ((PyObject*)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_C14NWriterTarget(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_C14NWriterTarget *p = (struct __pyx_obj_4lxml_5etree_C14NWriterTarget *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree_C14NWriterTarget) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_write);
  Py_CLEAR(p->_data);
  Py_CLEAR(p->_qname_aware_tags);
  Py_CLEAR(p->_find_qname_aware_attrs);
  Py_CLEAR(p->_declared_ns_stack);
  Py_CLEAR(p->_ns_stack);
  Py_CLEAR(p->_prefix_map);
  Py_CLEAR(p->_preserve_space);
  Py_CLEAR(p->_pending_start);
  Py_CLEAR(p->_exclude_tags);
  Py_CLEAR(p->_exclude_attrs);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_4lxml_5etree_C14NWriterTarget(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree_C14NWriterTarget *p = (struct __pyx_obj_4lxml_5etree_C14NWriterTarget *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->_write) {
    e = (*v)(p->_write, a); if (e) return e;
  }
  if (p->_data) {
    e = (*v)(p->_data, a); if (e) return e;
  }
  if (p->_qname_aware_tags) {
    e = (*v)(p->_qname_aware_tags, a); if (e) return e;
  }
  if (p->_find_qname_aware_attrs) {
    e = (*v)(p->_find_qname_aware_attrs, a); if (e) return e;
  }
  if (p->_declared_ns_stack) {
    e = (*v)(p->_declared_ns_stack, a); if (e) return e;
  }
  if (p->_ns_stack) {
    e = (*v)(p->_ns_stack, a); if (e) return e;
  }
  if (p->_prefix_map) {
    e = (*v)(p->_prefix_map, a); if (e) return e;
  }
  if (p->_preserve_space) {
    e = (*v)(p->_preserve_space, a); if (e) return e;
  }
  if (p->_pending_start) {
    e = (*v)(p->_pending_start, a); if (e) return e;
  }
  if (p->_exclude_tags) {
    e = (*v)(p->_exclude_tags, a); if (e) return e;
  }
  if (p->_exclude_attrs) {
    e = (*v)(p->_exclude_attrs, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree_C14NWriterTarget(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_C14NWriterTarget *p = (struct __pyx_obj_4lxml_5etree_C14NWriterTarget *)o;
  Py_CLEAR(p->_write);
  Py_CLEAR(p->_data);
  Py_CLEAR(p->_qname_aware_tags);
  Py_CLEAR(p->_find_qname_aware_attrs);
  Py_CLEAR(p->_declared_ns_stack);
  Py_CLEAR(p->_ns_stack);
  Py_CLEAR(p->_prefix_map);
  Py_CLEAR(p->_preserve_space);
  Py_CLEAR(p->_pending_start);
  Py_CLEAR(p->_exclude_tags);
  Py_CLEAR(p->_exclude_attrs);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree_C14NWriterTarget[] = {
  {"_iter_namespaces", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_16C14NWriterTarget_3_iter_namespaces, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"data", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_16C14NWriterTarget_6data, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"start_ns", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_16C14NWriterTarget_8start_ns, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"start", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_16C14NWriterTarget_10start, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"end", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_16C14NWriterTarget_12end, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"comment", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_16C14NWriterTarget_14comment, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"pi", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_16C14NWriterTarget_16pi, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"close", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_16C14NWriterTarget_18close, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_C14NWriterTarget_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_C14NWriterTarget},
  {Py_tp_doc, (void *)PyDoc_STR("\n    Canonicalization writer target for the XMLParser.\n\n    Serialises parse events to XML C14N 2.0.\n\n    Configuration options:\n\n    - *with_comments*: set to true to include comments\n    - *strip_text*: set to true to strip whitespace before and after text content\n    - *rewrite_prefixes*: set to true to replace namespace prefixes by \"n{number}\"\n    - *qname_aware_tags*: a set of qname aware tag names in which prefixes\n                          should be replaced in text content\n    - *qname_aware_attrs*: a set of qname aware attribute names in which prefixes\n                           should be replaced in text content\n    - *exclude_attrs*: a set of attribute names that should not be serialised\n    - *exclude_tags*: a set of tag names that should not be serialised\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_C14NWriterTarget},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_C14NWriterTarget},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_C14NWriterTarget},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_16C14NWriterTarget_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_C14NWriterTarget},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_C14NWriterTarget_spec = {
  "lxml.etree.C14NWriterTarget",
  sizeof(struct __pyx_obj_4lxml_5etree_C14NWriterTarget),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_C14NWriterTarget_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_C14NWriterTarget = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""C14NWriterTarget", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_C14NWriterTarget), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_C14NWriterTarget, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("\n    Canonicalization writer target for the XMLParser.\n\n    Serialises parse events to XML C14N 2.0.\n\n    Configuration options:\n\n    - *with_comments*: set to true to include comments\n    - *strip_text*: set to true to strip whitespace before and after text content\n    - *rewrite_prefixes*: set to true to replace namespace prefixes by \"n{number}\"\n    - *qname_aware_tags*: a set of qname aware tag names in which prefixes\n                          should be replaced in text content\n    - *qname_aware_attrs*: a set of qname aware attribute names in which prefixes\n                           should be replaced in text content\n    - *exclude_attrs*: a set of attribute names that should not be serialised\n    - *exclude_tags*: a set of tag names that should not be serialised\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_C14NWriterTarget, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_C14NWriterTarget, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_C14NWriterTarget, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_4lxml_5etree_16C14NWriterTarget_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_C14NWriterTarget, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4lxml_5etree_xmlfile(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree_xmlfile *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_xmlfile *)o);
  p->output_file = Py_None; Py_INCREF(Py_None);
  p->encoding = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->writer = ((struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *)Py_None); Py_INCREF(Py_None);
  p->async_writer = ((struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_xmlfile(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_xmlfile *p = (struct __pyx_obj_4lxml_5etree_xmlfile *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree_xmlfile) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->output_file);
  Py_CLEAR(p->encoding);
  Py_CLEAR(p->writer);
  Py_CLEAR(p->async_writer);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_4lxml_5etree_xmlfile(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree_xmlfile *p = (struct __pyx_obj_4lxml_5etree_xmlfile *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->output_file) {
    e = (*v)(p->output_file, a); if (e) return e;
  }
  if (p->writer) {
    e = (*v)(((PyObject *)p->writer), a); if (e) return e;
  }
  if (p->async_writer) {
    e = (*v)(((PyObject *)p->async_writer), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree_xmlfile(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_xmlfile *p = (struct __pyx_obj_4lxml_5etree_xmlfile *)o;
  Py_CLEAR(p->output_file);
  Py_CLEAR(p->writer);
  Py_CLEAR(p->async_writer);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree_xmlfile[] = {
  {"__enter__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7xmlfile_3__enter__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__exit__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7xmlfile_5__exit__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__aenter__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7xmlfile_7__aenter__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__aexit__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7xmlfile_10__aexit__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_xmlfile_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_xmlfile},
  {Py_tp_doc, (void *)PyDoc_STR("xmlfile(self, output_file, encoding=None, compression=None, close=False, buffered=True)\n\n    A simple mechanism for incremental XML serialisation.\n\n    Usage example::\n\n         with xmlfile(\"somefile.xml\", encoding='utf-8') as xf:\n             xf.write_declaration(standalone=True)\n             xf.write_doctype('<!DOCTYPE root SYSTEM \"some.dtd\">')\n\n             # generate an element (the root element)\n             with xf.element('root'):\n                  # write a complete Element into the open root element\n                  xf.write(etree.Element('test'))\n\n                  # generate and write more Elements, e.g. through iterparse\n                  for element in generate_some_elements():\n                      # serialise generated elements into the XML file\n                      xf.write(element)\n\n                  # or write multiple Elements or strings at once\n                  xf.write(etree.Element('start'), \"text\", etree.Element('end'))\n\n    If 'output_file' is a file(-like) object, passing ``close=True`` will\n    close it when exiting the context manager.  By default, it is left\n    to the owner to do that.  When a file path is used, lxml will take care\n    of opening and closing the file itself.  Also, when a compression level\n    is set, lxml will deliberately close the file to make sure all data gets\n    compressed and written.\n\n    Setting ``buffered=False`` will flush the output after each operation,\n    such as opening or closing an ``xf.element()`` block or calling\n    ``xf.write()``.  Alternatively, calling ``xf.flush()`` can be used to\n    explicitly flush any pending output when buffering is enabled.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_xmlfile},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_xmlfile},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_xmlfile},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_7xmlfile_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_xmlfile},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_xmlfile_spec = {
  "lxml.etree.xmlfile",
  sizeof(struct __pyx_obj_4lxml_5etree_xmlfile),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_xmlfile_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_xmlfile = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""xmlfile", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_xmlfile), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_xmlfile, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("xmlfile(self, output_file, encoding=None, compression=None, close=False, buffered=True)\n\n    A simple mechanism for incremental XML serialisation.\n\n    Usage example::\n\n         with xmlfile(\"somefile.xml\", encoding='utf-8') as xf:\n             xf.write_declaration(standalone=True)\n             xf.write_doctype('<!DOCTYPE root SYSTEM \"some.dtd\">')\n\n             # generate an element (the root element)\n             with xf.element('root'):\n                  # write a complete Element into the open root element\n                  xf.write(etree.Element('test'))\n\n                  # generate and write more Elements, e.g. through iterparse\n                  for element in generate_some_elements():\n                      # serialise generated elements into the XML file\n                      xf.write(element)\n\n                  # or write multiple Elements or strings at once\n                  xf.write(etree.Element('start'), \"text\", etree.Element('end'))\n\n    If 'output_file' is a file(-like) object, passing ``close=True`` will\n    close it when exiting the context manager.  By default, it is left\n    to the owner to do that.  When a file path is used, lxml will take care\n    of opening and closing the file itself.  Also, when a compression level\n    is set, lxml will deliberately close the file to make sure all data gets\n    compressed and written.\n\n    Setting ``buffered=False`` will flush the output after each operation,\n    such as opening or closing an ``xf.element()`` block or calling\n    ``xf.write()``.  Alternatively, calling ``xf.flush()`` can be used to\n    explicitly flush any pending output when buffering is enabled.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_xmlfile, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_xmlfile, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_xmlfile, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_4lxml_5etree_7xmlfile_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_xmlfile, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyMethodDef __pyx_methods_4lxml_5etree_htmlfile[] = {
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_htmlfile_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_xmlfile},
  {Py_tp_doc, (void *)PyDoc_STR("htmlfile(self, output_file, encoding=None, compression=None, close=False, buffered=True)\n\n    A simple mechanism for incremental HTML serialisation.  Works the same as\n    xmlfile.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_xmlfile},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_xmlfile},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_htmlfile},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_8htmlfile_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_xmlfile},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_htmlfile_spec = {
  "lxml.etree.htmlfile",
  sizeof(struct __pyx_obj_4lxml_5etree_htmlfile),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_htmlfile_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_htmlfile = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""htmlfile", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_htmlfile), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_xmlfile, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("htmlfile(self, output_file, encoding=None, compression=None, close=False, buffered=True)\n\n    A simple mechanism for incremental HTML serialisation.  Works the same as\n    xmlfile.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_xmlfile, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_xmlfile, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_htmlfile, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_4lxml_5etree_8htmlfile_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_xmlfile, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__IncrementalFileWriter __pyx_vtable_4lxml_5etree__IncrementalFileWriter;

static PyObject *__pyx_tp_new_4lxml_5etree__IncrementalFileWriter(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 1);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__IncrementalFileWriter;
  p->_encoding = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_target = ((struct __pyx_obj_4lxml_5etree__FilelikeWriter *)Py_None); Py_INCREF(Py_None);
  p->_element_stack = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_22_IncrementalFileWriter_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_4lxml_5etree__IncrementalFileWriter(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *p = (struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *)o;
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_4lxml_5etree_22_IncrementalFileWriter_3__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->_encoding);
  Py_CLEAR(p->_target);
  Py_CLEAR(p->_element_stack);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_4lxml_5etree__IncrementalFileWriter(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *p = (struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->_target) {
    e = (*v)(((PyObject *)p->_target), a); if (e) return e;
  }
  if (p->_element_stack) {
    e = (*v)(p->_element_stack, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__IncrementalFileWriter(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *p = (struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *)o;
  Py_CLEAR(p->_target);
  Py_CLEAR(p->_element_stack);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__IncrementalFileWriter[] = {
  {"write_declaration", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_22_IncrementalFileWriter_5write_declaration, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_22_IncrementalFileWriter_4write_declaration},
  {"write_doctype", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_22_IncrementalFileWriter_7write_doctype, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_22_IncrementalFileWriter_6write_doctype},
  {"method", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_22_IncrementalFileWriter_9method, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_22_IncrementalFileWriter_8method},
  {"element", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_22_IncrementalFileWriter_11element, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_22_IncrementalFileWriter_10element},
  {"write", (PyCFunction)(void(*)(void))(PyCFunctionWithKeywords)__pyx_pw_4lxml_5etree_22_IncrementalFileWriter_13write, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4lxml_5etree_22_IncrementalFileWriter_12write},
  {"flush", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_22_IncrementalFileWriter_15flush, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_22_IncrementalFileWriter_14flush},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__IncrementalFileWriter_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__IncrementalFileWriter},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__IncrementalFileWriter},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__IncrementalFileWriter},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__IncrementalFileWriter},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__IncrementalFileWriter},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__IncrementalFileWriter_spec = {
  "lxml.etree._IncrementalFileWriter",
  sizeof(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__IncrementalFileWriter_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__IncrementalFileWriter = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_IncrementalFileWriter", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__IncrementalFileWriter, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__IncrementalFileWriter, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__IncrementalFileWriter, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__IncrementalFileWriter, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__IncrementalFileWriter, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__AsyncDataWriter __pyx_vtable_4lxml_5etree__AsyncDataWriter;

static PyObject *__pyx_tp_new_4lxml_5etree__AsyncDataWriter(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree__AsyncDataWriter *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 1);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__AsyncDataWriter *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__AsyncDataWriter;
  p->_data = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_16_AsyncDataWriter_1__cinit__(o, __pyx_mstate_global->__pyx_empty_tuple, NULL) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_4lxml_5etree__AsyncDataWriter(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__AsyncDataWriter *p = (struct __pyx_obj_4lxml_5etree__AsyncDataWriter *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_data);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_4lxml_5etree__AsyncDataWriter(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__AsyncDataWriter *p = (struct __pyx_obj_4lxml_5etree__AsyncDataWriter *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->_data) {
    e = (*v)(p->_data, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__AsyncDataWriter(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__AsyncDataWriter *p = (struct __pyx_obj_4lxml_5etree__AsyncDataWriter *)o;
  Py_CLEAR(p->_data);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__AsyncDataWriter[] = {
  {"write", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_16_AsyncDataWriter_3write, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"close", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_16_AsyncDataWriter_5close, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__AsyncDataWriter_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__AsyncDataWriter},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__AsyncDataWriter},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__AsyncDataWriter},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__AsyncDataWriter},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__AsyncDataWriter},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__AsyncDataWriter_spec = {
  "lxml.etree._AsyncDataWriter",
  sizeof(struct __pyx_obj_4lxml_5etree__AsyncDataWriter),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__AsyncDataWriter_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__AsyncDataWriter = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_AsyncDataWriter", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__AsyncDataWriter), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__AsyncDataWriter, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__AsyncDataWriter, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__AsyncDataWriter, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__AsyncDataWriter, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__AsyncDataWriter, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__AsyncIncrementalFileWriter __pyx_vtable_4lxml_5etree__AsyncIncrementalFileWriter;

static PyObject *__pyx_tp_new_4lxml_5etree__AsyncIncrementalFileWriter(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 1);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__AsyncIncrementalFileWriter;
  p->_writer = ((struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *)Py_None); Py_INCREF(Py_None);
  p->_buffer = ((struct __pyx_obj_4lxml_5etree__AsyncDataWriter *)Py_None); Py_INCREF(Py_None);
  p->_async_outfile = Py_None; Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_4lxml_5etree__AsyncIncrementalFileWriter(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *p = (struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_writer);
  Py_CLEAR(p->_buffer);
  Py_CLEAR(p->_async_outfile);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_4lxml_5etree__AsyncIncrementalFileWriter(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *p = (struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->_writer) {
    e = (*v)(((PyObject *)p->_writer), a); if (e) return e;
  }
  if (p->_buffer) {
    e = (*v)(((PyObject *)p->_buffer), a); if (e) return e;
  }
  if (p->_async_outfile) {
    e = (*v)(p->_async_outfile, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__AsyncIncrementalFileWriter(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *p = (struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *)o;
  Py_CLEAR(p->_writer);
  Py_CLEAR(p->_buffer);
  Py_CLEAR(p->_async_outfile);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__AsyncIncrementalFileWriter[] = {
  {"flush", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_3flush, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"write_declaration", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_6write_declaration, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"write_doctype", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_9write_doctype, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"write", (PyCFunction)(void(*)(void))(PyCFunctionWithKeywords)__pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_12write, METH_VARARGS|METH_KEYWORDS, 0},
  {"method", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_15method, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"element", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_17element, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"_close", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_19_close, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__AsyncIncrementalFileWriter_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__AsyncIncrementalFileWriter},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__AsyncIncrementalFileWriter},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__AsyncIncrementalFileWriter},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__AsyncIncrementalFileWriter},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__AsyncIncrementalFileWriter},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__AsyncIncrementalFileWriter_spec = {
  "lxml.etree._AsyncIncrementalFileWriter",
  sizeof(struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__AsyncIncrementalFileWriter_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__AsyncIncrementalFileWriter = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_AsyncIncrementalFileWriter", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__AsyncIncrementalFileWriter, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__AsyncIncrementalFileWriter, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__AsyncIncrementalFileWriter, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__AsyncIncrementalFileWriter, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__AsyncIncrementalFileWriter, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4lxml_5etree__AsyncFileWriterElement(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__AsyncFileWriterElement *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 1);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__AsyncFileWriterElement *)o);
  p->_element_writer = ((struct __pyx_obj_4lxml_5etree__FileWriterElement *)Py_None); Py_INCREF(Py_None);
  p->_writer = ((struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_23_AsyncFileWriterElement_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_4lxml_5etree__AsyncFileWriterElement(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__AsyncFileWriterElement *p = (struct __pyx_obj_4lxml_5etree__AsyncFileWriterElement *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_element_writer);
  Py_CLEAR(p->_writer);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_4lxml_5etree__AsyncFileWriterElement(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__AsyncFileWriterElement *p = (struct __pyx_obj_4lxml_5etree__AsyncFileWriterElement *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->_element_writer) {
    e = (*v)(((PyObject *)p->_element_writer), a); if (e) return e;
  }
  if (p->_writer) {
    e = (*v)(((PyObject *)p->_writer), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__AsyncFileWriterElement(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__AsyncFileWriterElement *p = (struct __pyx_obj_4lxml_5etree__AsyncFileWriterElement *)o;
  Py_CLEAR(p->_element_writer);
  Py_CLEAR(p->_writer);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__AsyncFileWriterElement[] = {
  {"__aenter__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_23_AsyncFileWriterElement_3__aenter__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__aexit__", (PyCFunction)(void(*)(void))(PyCFunctionWithKeywords)__pyx_pw_4lxml_5etree_23_AsyncFileWriterElement_6__aexit__, METH_VARARGS|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__AsyncFileWriterElement_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__AsyncFileWriterElement},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__AsyncFileWriterElement},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__AsyncFileWriterElement},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__AsyncFileWriterElement},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__AsyncFileWriterElement},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__AsyncFileWriterElement_spec = {
  "lxml.etree._AsyncFileWriterElement",
  sizeof(struct __pyx_obj_4lxml_5etree__AsyncFileWriterElement),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__AsyncFileWriterElement_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__AsyncFileWriterElement = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_AsyncFileWriterElement", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__AsyncFileWriterElement), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__AsyncFileWriterElement, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__AsyncFileWriterElement, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__AsyncFileWriterElement, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__AsyncFileWriterElement, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__AsyncFileWriterElement, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4lxml_5etree__FileWriterElement(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__FileWriterElement *p;
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4lxml_5etree__FileWriterElement > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__FileWriterElement, sizeof(struct __pyx_obj_4lxml_5etree__FileWriterElement))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_4lxml_5etree__FileWriterElement[--__pyx_mstate_global->__pyx_freecount_4lxml_5etree__FileWriterElement];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_4lxml_5etree__FileWriterElement));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_4lxml_5etree__FileWriterElement *)o);
  p->_writer = ((struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *)Py_None); Py_INCREF(Py_None);
  p->_element = Py_None; Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_18_FileWriterElement_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_4lxml_5etree__FileWriterElement(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__FileWriterElement *p = (struct __pyx_obj_4lxml_5etree__FileWriterElement *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_writer);
  Py_CLEAR(p->_element);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4lxml_5etree__FileWriterElement < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__FileWriterElement, sizeof(struct __pyx_obj_4lxml_5etree__FileWriterElement))))
  {
    __pyx_mstate_global->__pyx_freelist_4lxml_5etree__FileWriterElement[__pyx_mstate_global->__pyx_freecount_4lxml_5etree__FileWriterElement++] = ((struct __pyx_obj_4lxml_5etree__FileWriterElement *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_4lxml_5etree__FileWriterElement(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__FileWriterElement *p = (struct __pyx_obj_4lxml_5etree__FileWriterElement *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->_writer) {
    e = (*v)(((PyObject *)p->_writer), a); if (e) return e;
  }
  if (p->_element) {
    e = (*v)(p->_element, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__FileWriterElement(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__FileWriterElement *p = (struct __pyx_obj_4lxml_5etree__FileWriterElement *)o;
  Py_CLEAR(p->_writer);
  Py_CLEAR(p->_element);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__FileWriterElement[] = {
  {"__enter__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_18_FileWriterElement_3__enter__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__exit__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_18_FileWriterElement_5__exit__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__FileWriterElement_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__FileWriterElement},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__FileWriterElement},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__FileWriterElement},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__FileWriterElement},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__FileWriterElement},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__FileWriterElement_spec = {
  "lxml.etree._FileWriterElement",
  sizeof(struct __pyx_obj_4lxml_5etree__FileWriterElement),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__FileWriterElement_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__FileWriterElement = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_FileWriterElement", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__FileWriterElement), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__FileWriterElement, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__FileWriterElement, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__FileWriterElement, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__FileWriterElement, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__FileWriterElement, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4lxml_5etree__MethodChanger(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__MethodChanger *p;
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4lxml_5etree__MethodChanger > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__MethodChanger, sizeof(struct __pyx_obj_4lxml_5etree__MethodChanger))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_4lxml_5etree__MethodChanger[--__pyx_mstate_global->__pyx_freecount_4lxml_5etree__MethodChanger];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_4lxml_5etree__MethodChanger));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_4lxml_5etree__MethodChanger *)o);
  p->_writer = ((struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_14_MethodChanger_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_4lxml_5etree__MethodChanger(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__MethodChanger *p = (struct __pyx_obj_4lxml_5etree__MethodChanger *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_writer);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4lxml_5etree__MethodChanger < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__MethodChanger, sizeof(struct __pyx_obj_4lxml_5etree__MethodChanger))))
  {
    __pyx_mstate_global->__pyx_freelist_4lxml_5etree__MethodChanger[__pyx_mstate_global->__pyx_freecount_4lxml_5etree__MethodChanger++] = ((struct __pyx_obj_4lxml_5etree__MethodChanger *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_4lxml_5etree__MethodChanger(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__MethodChanger *p = (struct __pyx_obj_4lxml_5etree__MethodChanger *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->_writer) {
    e = (*v)(((PyObject *)p->_writer), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__MethodChanger(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__MethodChanger *p = (struct __pyx_obj_4lxml_5etree__MethodChanger *)o;
  Py_CLEAR(p->_writer);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__MethodChanger[] = {
  {"__enter__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_14_MethodChanger_3__enter__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__exit__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_14_MethodChanger_5__exit__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__aenter__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_14_MethodChanger_7__aenter__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__aexit__", (PyCFunction)(void(*)(void))(PyCFunctionWithKeywords)__pyx_pw_4lxml_5etree_14_MethodChanger_10__aexit__, METH_VARARGS|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__MethodChanger_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__MethodChanger},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__MethodChanger},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__MethodChanger},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__MethodChanger},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__MethodChanger},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__MethodChanger_spec = {
  "lxml.etree._MethodChanger",
  sizeof(struct __pyx_obj_4lxml_5etree__MethodChanger),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__MethodChanger_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__MethodChanger = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_MethodChanger", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__MethodChanger), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__MethodChanger, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__MethodChanger, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__MethodChanger, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__MethodChanger, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__MethodChanger, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree_iterparse __pyx_vtable_4lxml_5etree_iterparse;

static PyObject *__pyx_tp_new_4lxml_5etree_iterparse(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree_iterparse *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_iterparse *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree_iterparse;
  p->_parser = ((struct __pyx_obj_4lxml_5etree__FeedParser *)Py_None); Py_INCREF(Py_None);
  p->_tag = Py_None; Py_INCREF(Py_None);
  p->_events = Py_None; Py_INCREF(Py_None);
  p->root = Py_None; Py_INCREF(Py_None);
  p->_source = Py_None; Py_INCREF(Py_None);
  p->_filename = Py_None; Py_INCREF(Py_None);
  p->_error = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_iterparse(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_iterparse *p = (struct __pyx_obj_4lxml_5etree_iterparse *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree_iterparse) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_parser);
  Py_CLEAR(p->_tag);
  Py_CLEAR(p->_events);
  Py_CLEAR(p->root);
  Py_CLEAR(p->_source);
  Py_CLEAR(p->_filename);
  Py_CLEAR(p->_error);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_4lxml_5etree_iterparse(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree_iterparse *p = (struct __pyx_obj_4lxml_5etree_iterparse *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->_parser) {
    e = (*v)(((PyObject *)p->_parser), a); if (e) return e;
  }
  if (p->_tag) {
    e = (*v)(p->_tag, a); if (e) return e;
  }
  if (p->_events) {
    e = (*v)(p->_events, a); if (e) return e;
  }
  if (p->root) {
    e = (*v)(p->root, a); if (e) return e;
  }
  if (p->_source) {
    e = (*v)(p->_source, a); if (e) return e;
  }
  if (p->_filename) {
    e = (*v)(p->_filename, a); if (e) return e;
  }
  if (p->_error) {
    e = (*v)(p->_error, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree_iterparse(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_iterparse *p = (struct __pyx_obj_4lxml_5etree_iterparse *)o;
  Py_CLEAR(p->_parser);
  Py_CLEAR(p->_tag);
  Py_CLEAR(p->_events);
  Py_CLEAR(p->root);
  Py_CLEAR(p->_source);
  Py_CLEAR(p->_filename);
  Py_CLEAR(p->_error);
  return 0;
}

static PyObject *__pyx_getprop_4lxml_5etree_9iterparse_error_log(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_9iterparse_9error_log_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_9iterparse_resolvers(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_9iterparse_9resolvers_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_9iterparse_version(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_9iterparse_7version_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_9iterparse_root(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_9iterparse_4root_1__get__(o);
}

static PyObject *__pyx_specialmethod___pyx_pw_4lxml_5etree_9iterparse_9__next__(PyObject *self, CYTHON_UNUSED PyObject *arg) {
  PyObject *res = __pyx_pw_4lxml_5etree_9iterparse_9__next__(self);
  if (!res && !PyErr_Occurred()) { PyErr_SetNone(PyExc_StopIteration); }
  return res;
}

static PyMethodDef __pyx_methods_4lxml_5etree_iterparse[] = {
  {"set_element_class_lookup", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_9iterparse_3set_element_class_lookup, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_9iterparse_2set_element_class_lookup},
  {"makeelement", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_9iterparse_5makeelement, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_9iterparse_4makeelement},
  {"__next__", (PyCFunction)__pyx_specialmethod___pyx_pw_4lxml_5etree_9iterparse_9__next__, METH_NOARGS|METH_COEXIST, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree_iterparse[] = {
  {"error_log", __pyx_getprop_4lxml_5etree_9iterparse_error_log, 0, PyDoc_STR("The error log of the last (or current) parser run.\n        "), 0},
  {"resolvers", __pyx_getprop_4lxml_5etree_9iterparse_resolvers, 0, PyDoc_STR("The custom resolver registry of the last (or current) parser run.\n        "), 0},
  {"version", __pyx_getprop_4lxml_5etree_9iterparse_version, 0, PyDoc_STR("The version of the underlying XML parser."), 0},
  {"root", __pyx_getprop_4lxml_5etree_9iterparse_root, 0, 0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_iterparse_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_iterparse},
  {Py_tp_doc, (void *)PyDoc_STR("iterparse(self, source, events=(\"end\",), tag=None,                   attribute_defaults=False, dtd_validation=False,                   load_dtd=False, no_network=True, remove_blank_text=False,                   remove_comments=False, remove_pis=False, encoding=None,                   html=False, recover=None, huge_tree=False, schema=None)\n\n    Incremental parser.\n\n    Parses XML into a tree and generates tuples (event, element) in a\n    SAX-like fashion. ``event`` is any of 'start', 'end', 'start-ns',\n    'end-ns'.\n\n    For 'start' and 'end', ``element`` is the Element that the parser just\n    found opening or closing.  For 'start-ns', it is a tuple (prefix, URI) of\n    a new namespace declaration.  For 'end-ns', it is simply None.  Note that\n    all start and end events are guaranteed to be properly nested.\n\n    The keyword argument ``events`` specifies a sequence of event type names\n    that should be generated.  By default, only 'end' events will be\n    generated.\n\n    The additional ``tag`` argument restricts the 'start' and 'end' events to\n    those elements that match the given tag.  The ``tag`` argument can also be\n    a sequence of tags to allow matching more than one tag.  By default,\n    events are generated for all elements.  Note that the 'start-ns' and\n    'end-ns' events are not impacted by this restriction.\n\n    The other keyword arguments in the constructor are mainly based on the\n    libxml2 parser configuration.  A DTD will also be loaded if validation or\n    attribute default values are requested.\n\n    Available boolean keyword arguments:\n     - attribute_defaults: read default attributes from DTD\n     - dtd_validation: validate (if DTD is available)\n     - load_dtd: use DTD for parsing\n     - no_network: prevent network access for related files\n     - remove_blank_text: discard blank text nodes\n     - remove_comments: discard comments\n     - remove_pis: discard processing instructions\n     - strip_cdata: repla""ce CDATA sections by normal text content (default: \n       True for XML, ignored otherwise)\n     - compact: safe memory for short text content (default: True)\n     - resolve_entities: replace entities by their text value (default: True)\n     - huge_tree: disable security restrictions and support very deep trees\n                  and very long text content (only affects libxml2 2.7+)\n     - html: parse input as HTML (default: XML)\n     - recover: try hard to parse through broken input (default: True for HTML,\n                False otherwise)\n\n    Other keyword arguments:\n     - encoding: override the document encoding\n     - schema: an XMLSchema to validate against\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_iterparse},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_iterparse},
  {Py_tp_iter, (void *)__pyx_pw_4lxml_5etree_9iterparse_7__iter__},
  {Py_tp_iternext, (void *)__pyx_pw_4lxml_5etree_9iterparse_9__next__},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_iterparse},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree_iterparse},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_9iterparse_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_iterparse},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_iterparse_spec = {
  "lxml.etree.iterparse",
  sizeof(struct __pyx_obj_4lxml_5etree_iterparse),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_iterparse_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_iterparse = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""iterparse", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_iterparse), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_iterparse, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("iterparse(self, source, events=(\"end\",), tag=None,                   attribute_defaults=False, dtd_validation=False,                   load_dtd=False, no_network=True, remove_blank_text=False,                   remove_comments=False, remove_pis=False, encoding=None,                   html=False, recover=None, huge_tree=False, schema=None)\n\n    Incremental parser.\n\n    Parses XML into a tree and generates tuples (event, element) in a\n    SAX-like fashion. ``event`` is any of 'start', 'end', 'start-ns',\n    'end-ns'.\n\n    For 'start' and 'end', ``element`` is the Element that the parser just\n    found opening or closing.  For 'start-ns', it is a tuple (prefix, URI) of\n    a new namespace declaration.  For 'end-ns', it is simply None.  Note that\n    all start and end events are guaranteed to be properly nested.\n\n    The keyword argument ``events`` specifies a sequence of event type names\n    that should be generated.  By default, only 'end' events will be\n    generated.\n\n    The additional ``tag`` argument restricts the 'start' and 'end' events to\n    those elements that match the given tag.  The ``tag`` argument can also be\n    a sequence of tags to allow matching more than one tag.  By default,\n    events are generated for all elements.  Note that the 'start-ns' and\n    'end-ns' events are not impacted by this restriction.\n\n    The other keyword arguments in the constructor are mainly based on the\n    libxml2 parser configuration.  A DTD will also be loaded if validation or\n    attribute default values are requested.\n\n    Available boolean keyword arguments:\n     - attribute_defaults: read default attributes from DTD\n     - dtd_validation: validate (if DTD is available)\n     - load_dtd: use DTD for parsing\n     - no_network: prevent network access for related files\n     - remove_blank_text: discard blank text nodes\n     - remove_comments: discard comments\n     - remove_pis: discard processing instructions\n     - strip_cdata: repla""ce CDATA sections by normal text content (default: \n       True for XML, ignored otherwise)\n     - compact: safe memory for short text content (default: True)\n     - resolve_entities: replace entities by their text value (default: True)\n     - huge_tree: disable security restrictions and support very deep trees\n                  and very long text content (only affects libxml2 2.7+)\n     - html: parse input as HTML (default: XML)\n     - recover: try hard to parse through broken input (default: True for HTML,\n                False otherwise)\n\n    Other keyword arguments:\n     - encoding: override the document encoding\n     - schema: an XMLSchema to validate against\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_iterparse, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_iterparse, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_4lxml_5etree_9iterparse_7__iter__, /*tp_iter*/
  __pyx_pw_4lxml_5etree_9iterparse_9__next__, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_iterparse, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree_iterparse, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_4lxml_5etree_9iterparse_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_iterparse, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree_iterwalk __pyx_vtable_4lxml_5etree_iterwalk;

static PyObject *__pyx_tp_new_4lxml_5etree_iterwalk(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree_iterwalk *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_iterwalk *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree_iterwalk;
  p->_matcher = ((struct __pyx_obj_4lxml_5etree__MultiTagMatcher *)Py_None); Py_INCREF(Py_None);
  p->_node_stack = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_events = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_pop_event = Py_None; Py_INCREF(Py_None);
  p->_include_siblings = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_iterwalk(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_iterwalk *p = (struct __pyx_obj_4lxml_5etree_iterwalk *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree_iterwalk) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_matcher);
  Py_CLEAR(p->_node_stack);
  Py_CLEAR(p->_events);
  Py_CLEAR(p->_pop_event);
  Py_CLEAR(p->_include_siblings);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_4lxml_5etree_iterwalk(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree_iterwalk *p = (struct __pyx_obj_4lxml_5etree_iterwalk *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->_matcher) {
    e = (*v)(((PyObject *)p->_matcher), a); if (e) return e;
  }
  if (p->_node_stack) {
    e = (*v)(p->_node_stack, a); if (e) return e;
  }
  if (p->_events) {
    e = (*v)(p->_events, a); if (e) return e;
  }
  if (p->_pop_event) {
    e = (*v)(p->_pop_event, a); if (e) return e;
  }
  if (p->_include_siblings) {
    e = (*v)(p->_include_siblings, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree_iterwalk(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_iterwalk *p = (struct __pyx_obj_4lxml_5etree_iterwalk *)o;
  Py_CLEAR(p->_matcher);
  Py_CLEAR(p->_node_stack);
  Py_CLEAR(p->_events);
  Py_CLEAR(p->_pop_event);
  Py_CLEAR(p->_include_siblings);
  return 0;
}

static PyObject *__pyx_specialmethod___pyx_pw_4lxml_5etree_8iterwalk_5__next__(PyObject *self, CYTHON_UNUSED PyObject *arg) {
  PyObject *res = __pyx_pw_4lxml_5etree_8iterwalk_5__next__(self);
  if (!res && !PyErr_Occurred()) { PyErr_SetNone(PyExc_StopIteration); }
  return res;
}

static PyMethodDef __pyx_methods_4lxml_5etree_iterwalk[] = {
  {"__next__", (PyCFunction)__pyx_specialmethod___pyx_pw_4lxml_5etree_8iterwalk_5__next__, METH_NOARGS|METH_COEXIST, 0},
  {"skip_subtree", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8iterwalk_7skip_subtree, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8iterwalk_6skip_subtree},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_iterwalk_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_iterwalk},
  {Py_tp_doc, (void *)PyDoc_STR("iterwalk(self, element_or_tree, events=(\"end\",), tag=None)\n\n    A tree walker that generates events from an existing tree as if it\n    was parsing XML data with ``iterparse()``.\n\n    Just as for ``iterparse()``, the ``tag`` argument can be a single tag or a\n    sequence of tags.\n\n    After receiving a 'start' or 'start-ns' event, the children and\n    descendants of the current element can be excluded from iteration\n    by calling the ``skip_subtree()`` method.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_iterwalk},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_iterwalk},
  {Py_tp_iter, (void *)__pyx_pw_4lxml_5etree_8iterwalk_3__iter__},
  {Py_tp_iternext, (void *)__pyx_pw_4lxml_5etree_8iterwalk_5__next__},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_iterwalk},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_8iterwalk_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_iterwalk},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_iterwalk_spec = {
  "lxml.etree.iterwalk",
  sizeof(struct __pyx_obj_4lxml_5etree_iterwalk),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_iterwalk_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_iterwalk = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""iterwalk", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_iterwalk), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_iterwalk, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("iterwalk(self, element_or_tree, events=(\"end\",), tag=None)\n\n    A tree walker that generates events from an existing tree as if it\n    was parsing XML data with ``iterparse()``.\n\n    Just as for ``iterparse()``, the ``tag`` argument can be a single tag or a\n    sequence of tags.\n\n    After receiving a 'start' or 'start-ns' event, the children and\n    descendants of the current element can be excluded from iteration\n    by calling the ``skip_subtree()`` method.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_iterwalk, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_iterwalk, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_4lxml_5etree_8iterwalk_3__iter__, /*tp_iter*/
  __pyx_pw_4lxml_5etree_8iterwalk_5__next__, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_iterwalk, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_4lxml_5etree_8iterwalk_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_iterwalk, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__IDDict __pyx_vtable_4lxml_5etree__IDDict;

static PyObject *__pyx_tp_new_4lxml_5etree__IDDict(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__IDDict *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__IDDict *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__IDDict;
  p->_doc = ((struct LxmlDocument *)Py_None); Py_INCREF(Py_None);
  p->_keys = Py_None; Py_INCREF(Py_None);
  p->_items = Py_None; Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_7_IDDict_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_4lxml_5etree__IDDict(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__IDDict *p = (struct __pyx_obj_4lxml_5etree__IDDict *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree__IDDict) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_doc);
  Py_CLEAR(p->_keys);
  Py_CLEAR(p->_items);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_4lxml_5etree__IDDict(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__IDDict *p = (struct __pyx_obj_4lxml_5etree__IDDict *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->_doc) {
    e = (*v)(((PyObject *)p->_doc), a); if (e) return e;
  }
  if (p->_keys) {
    e = (*v)(p->_keys, a); if (e) return e;
  }
  if (p->_items) {
    e = (*v)(p->_items, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__IDDict(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__IDDict *p = (struct __pyx_obj_4lxml_5etree__IDDict *)o;
  Py_CLEAR(p->_doc);
  Py_CLEAR(p->_keys);
  Py_CLEAR(p->_items);
  return 0;
}

static PyObject *__pyx_sq_item_4lxml_5etree__IDDict(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyLong_FromSsize_t(i); if(!x) return 0;
  #if CYTHON_USE_TYPE_SLOTS || (!CYTHON_USE_TYPE_SPECS && __PYX_LIMITED_VERSION_HEX < 0x030A0000)
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  #else
  r = ((binaryfunc)PyType_GetSlot(Py_TYPE(o), Py_mp_subscript))(o, x);
  #endif
  Py_DECREF(x);
  return r;
}

static PyMethodDef __pyx_methods_4lxml_5etree__IDDict[] = {
  {"copy", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_IDDict_3copy, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"get", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_IDDict_7get, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"has_key", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_IDDict_11has_key, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"keys", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_IDDict_15keys, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"iterkeys", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_IDDict_19iterkeys, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"items", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_IDDict_23items, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"iteritems", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_IDDict_25iteritems, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"values", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_IDDict_27values, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"itervalues", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_IDDict_29itervalues, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__IDDict_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__IDDict},
  {Py_tp_repr, (void *)__pyx_pw_4lxml_5etree_7_IDDict_13__repr__},
  {Py_sq_length, (void *)__pyx_pw_4lxml_5etree_7_IDDict_21__len__},
  {Py_sq_item, (void *)__pyx_sq_item_4lxml_5etree__IDDict},
  {Py_sq_contains, (void *)__pyx_pw_4lxml_5etree_7_IDDict_9__contains__},
  {Py_mp_length, (void *)__pyx_pw_4lxml_5etree_7_IDDict_21__len__},
  {Py_mp_subscript, (void *)__pyx_pw_4lxml_5etree_7_IDDict_5__getitem__},
  {Py_tp_doc, (void *)PyDoc_STR("IDDict(self, etree)\n    A dictionary-like proxy class that mapps ID attributes to elements.\n\n    The dictionary must be instantiated with the root element of a parsed XML\n    document, otherwise the behaviour is undefined.  Elements and XML trees\n    that were created or modified 'by hand' are not supported.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__IDDict},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__IDDict},
  {Py_tp_iter, (void *)__pyx_pw_4lxml_5etree_7_IDDict_17__iter__},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__IDDict},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__IDDict},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__IDDict_spec = {
  "lxml.etree._IDDict",
  sizeof(struct __pyx_obj_4lxml_5etree__IDDict),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__IDDict_slots,
};
#else

static PySequenceMethods __pyx_tp_as_sequence__IDDict = {
  __pyx_pw_4lxml_5etree_7_IDDict_21__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_4lxml_5etree__IDDict, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  __pyx_pw_4lxml_5etree_7_IDDict_9__contains__, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__IDDict = {
  __pyx_pw_4lxml_5etree_7_IDDict_21__len__, /*mp_length*/
  __pyx_pw_4lxml_5etree_7_IDDict_5__getitem__, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_4lxml_5etree__IDDict = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_IDDict", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__IDDict), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__IDDict, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  __pyx_pw_4lxml_5etree_7_IDDict_13__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  &__pyx_tp_as_sequence__IDDict, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__IDDict, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("IDDict(self, etree)\n    A dictionary-like proxy class that mapps ID attributes to elements.\n\n    The dictionary must be instantiated with the root element of a parsed XML\n    document, otherwise the behaviour is undefined.  Elements and XML trees\n    that were created or modified 'by hand' are not supported.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__IDDict, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__IDDict, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_4lxml_5etree_7_IDDict_17__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__IDDict, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__IDDict, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_XIncludeError_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_Error},
  {Py_tp_doc, (void *)PyDoc_STR("Error during XInclude processing.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_Error},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_Error},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_Error},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_XIncludeError_spec = {
  "lxml.etree.XIncludeError",
  sizeof(struct __pyx_obj_4lxml_5etree_XIncludeError),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_XIncludeError_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_XIncludeError = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""XIncludeError", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_XIncludeError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_Error, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("Error during XInclude processing.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_Error, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_Error, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_9LxmlError_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_Error, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4lxml_5etree_XInclude(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree_XInclude *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_XInclude *)o);
  p->_error_log = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_XInclude(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_XInclude *p = (struct __pyx_obj_4lxml_5etree_XInclude *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree_XInclude) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_error_log);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_4lxml_5etree_XInclude(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree_XInclude *p = (struct __pyx_obj_4lxml_5etree_XInclude *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->_error_log) {
    e = (*v)(((PyObject *)p->_error_log), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree_XInclude(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_XInclude *p = (struct __pyx_obj_4lxml_5etree_XInclude *)o;
  Py_CLEAR(p->_error_log);
  return 0;
}

static PyObject *__pyx_getprop_4lxml_5etree_8XInclude_error_log(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_8XInclude_9error_log_1__get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree_XInclude[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree_XInclude[] = {
  {"error_log", __pyx_getprop_4lxml_5etree_8XInclude_error_log, 0, 0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_XInclude_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_XInclude},
  {Py_tp_call, (void *)__pyx_pw_4lxml_5etree_8XInclude_3__call__},
  {Py_tp_doc, (void *)PyDoc_STR("XInclude(self)\n    XInclude processor.\n\n    Create an instance and call it on an Element to run XInclude\n    processing.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_XInclude},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_XInclude},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_XInclude},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree_XInclude},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_8XInclude_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_XInclude},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_XInclude_spec = {
  "lxml.etree.XInclude",
  sizeof(struct __pyx_obj_4lxml_5etree_XInclude),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_XInclude_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_XInclude = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""XInclude", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_XInclude), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_XInclude, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  __pyx_pw_4lxml_5etree_8XInclude_3__call__, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("XInclude(self)\n    XInclude processor.\n\n    Create an instance and call it on an Element to run XInclude\n    processing.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_XInclude, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_XInclude, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_XInclude, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree_XInclude, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_4lxml_5etree_8XInclude_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_XInclude, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_XPathError_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_Error},
  {Py_tp_doc, (void *)PyDoc_STR("Base class of all XPath errors.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_Error},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_Error},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_Error},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_XPathError_spec = {
  "lxml.etree.XPathError",
  sizeof(struct __pyx_obj_4lxml_5etree_XPathError),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_XPathError_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_XPathError = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""XPathError", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_XPathError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_Error, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("Base class of all XPath errors.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_Error, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_Error, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_9LxmlError_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_Error, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_XPathEvalError_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_Error},
  {Py_tp_doc, (void *)PyDoc_STR("Error during XPath evaluation.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_Error},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_Error},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_Error},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_XPathEvalError_spec = {
  "lxml.etree.XPathEvalError",
  sizeof(struct __pyx_obj_4lxml_5etree_XPathEvalError),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_XPathEvalError_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_XPathEvalError = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""XPathEvalError", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_XPathEvalError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_Error, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("Error during XPath evaluation.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_Error, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_Error, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_9LxmlError_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_Error, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_XPathFunctionError_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_Error},
  {Py_tp_doc, (void *)PyDoc_STR("Internal error looking up an XPath extension function.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_Error},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_Error},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_Error},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_XPathFunctionError_spec = {
  "lxml.etree.XPathFunctionError",
  sizeof(struct __pyx_obj_4lxml_5etree_XPathFunctionError),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_XPathFunctionError_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_XPathFunctionError = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""XPathFunctionError", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_XPathFunctionError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_Error, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("Internal error looking up an XPath extension function.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_Error, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_Error, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_9LxmlError_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_Error, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_XPathResultError_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_Error},
  {Py_tp_doc, (void *)PyDoc_STR("Error handling an XPath result.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_Error},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_Error},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_Error},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_XPathResultError_spec = {
  "lxml.etree.XPathResultError",
  sizeof(struct __pyx_obj_4lxml_5etree_XPathResultError),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_XPathResultError_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_XPathResultError = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""XPathResultError", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_XPathResultError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_Error, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("Error handling an XPath result.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_Error, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_Error, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_9LxmlError_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_Error, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__ExsltRegExp __pyx_vtable_4lxml_5etree__ExsltRegExp;

static PyObject *__pyx_tp_new_4lxml_5etree__ExsltRegExp(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ExsltRegExp *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 1);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ExsltRegExp *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__ExsltRegExp;
  p->_compile_map = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_12_ExsltRegExp_1__cinit__(o, __pyx_mstate_global->__pyx_empty_tuple, NULL) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_4lxml_5etree__ExsltRegExp(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ExsltRegExp *p = (struct __pyx_obj_4lxml_5etree__ExsltRegExp *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_compile_map);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_4lxml_5etree__ExsltRegExp(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__ExsltRegExp *p = (struct __pyx_obj_4lxml_5etree__ExsltRegExp *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->_compile_map) {
    e = (*v)(p->_compile_map, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__ExsltRegExp(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ExsltRegExp *p = (struct __pyx_obj_4lxml_5etree__ExsltRegExp *)o;
  Py_CLEAR(p->_compile_map);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__ExsltRegExp[] = {
  {"test", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ExsltRegExp_3test, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"match", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ExsltRegExp_5match, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"replace", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ExsltRegExp_7replace, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__ExsltRegExp_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__ExsltRegExp},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__ExsltRegExp},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__ExsltRegExp},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__ExsltRegExp},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__ExsltRegExp},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__ExsltRegExp_spec = {
  "lxml.etree._ExsltRegExp",
  sizeof(struct __pyx_obj_4lxml_5etree__ExsltRegExp),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__ExsltRegExp_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__ExsltRegExp = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_ExsltRegExp", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ExsltRegExp), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ExsltRegExp, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ExsltRegExp, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ExsltRegExp, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__ExsltRegExp, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__ExsltRegExp, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__BaseContext __pyx_vtable_4lxml_5etree__BaseContext;

static PyObject *__pyx_tp_new_4lxml_5etree__BaseContext(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree__BaseContext *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__BaseContext *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__BaseContext;
  p->_doc = ((struct LxmlDocument *)Py_None); Py_INCREF(Py_None);
  p->_extensions = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_namespaces = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_global_namespaces = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_utf_refs = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_function_cache = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_eval_context_dict = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_temp_refs = ((struct __pyx_obj_4lxml_5etree__TempStore *)Py_None); Py_INCREF(Py_None);
  p->_temp_documents = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_exc = ((struct __pyx_obj_4lxml_5etree__ExceptionContext *)Py_None); Py_INCREF(Py_None);
  p->_error_log = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__BaseContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__BaseContext *p = (struct __pyx_obj_4lxml_5etree__BaseContext *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree__BaseContext) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_doc);
  Py_CLEAR(p->_extensions);
  Py_CLEAR(p->_namespaces);
  Py_CLEAR(p->_global_namespaces);
  Py_CLEAR(p->_utf_refs);
  Py_CLEAR(p->_function_cache);
  Py_CLEAR(p->_eval_context_dict);
  Py_CLEAR(p->_temp_refs);
  Py_CLEAR(p->_temp_documents);
  Py_CLEAR(p->_exc);
  Py_CLEAR(p->_error_log);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_4lxml_5etree__BaseContext(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__BaseContext *p = (struct __pyx_obj_4lxml_5etree__BaseContext *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->_doc) {
    e = (*v)(((PyObject *)p->_doc), a); if (e) return e;
  }
  if (p->_extensions) {
    e = (*v)(p->_extensions, a); if (e) return e;
  }
  if (p->_namespaces) {
    e = (*v)(p->_namespaces, a); if (e) return e;
  }
  if (p->_global_namespaces) {
    e = (*v)(p->_global_namespaces, a); if (e) return e;
  }
  if (p->_utf_refs) {
    e = (*v)(p->_utf_refs, a); if (e) return e;
  }
  if (p->_function_cache) {
    e = (*v)(p->_function_cache, a); if (e) return e;
  }
  if (p->_eval_context_dict) {
    e = (*v)(p->_eval_context_dict, a); if (e) return e;
  }
  if (p->_temp_refs) {
    e = (*v)(((PyObject *)p->_temp_refs), a); if (e) return e;
  }
  if (p->_temp_documents) {
    e = (*v)(p->_temp_documents, a); if (e) return e;
  }
  if (p->_exc) {
    e = (*v)(((PyObject *)p->_exc), a); if (e) return e;
  }
  if (p->_error_log) {
    e = (*v)(((PyObject *)p->_error_log), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__BaseContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__BaseContext *p = (struct __pyx_obj_4lxml_5etree__BaseContext *)o;
  Py_CLEAR(p->_doc);
  Py_CLEAR(p->_extensions);
  Py_CLEAR(p->_namespaces);
  Py_CLEAR(p->_global_namespaces);
  Py_CLEAR(p->_utf_refs);
  Py_CLEAR(p->_function_cache);
  Py_CLEAR(p->_eval_context_dict);
  Py_CLEAR(p->_temp_refs);
  Py_CLEAR(p->_temp_documents);
  Py_CLEAR(p->_exc);
  Py_CLEAR(p->_error_log);
  return 0;
}

static PyObject *__pyx_getprop_4lxml_5etree_12_BaseContext_context_node(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_12_BaseContext_12context_node_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_12_BaseContext_eval_context(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_12_BaseContext_12eval_context_1__get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree__BaseContext[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__BaseContext[] = {
  {"context_node", __pyx_getprop_4lxml_5etree_12_BaseContext_context_node, 0, 0, 0},
  {"eval_context", __pyx_getprop_4lxml_5etree_12_BaseContext_eval_context, 0, 0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__BaseContext_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__BaseContext},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__BaseContext},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__BaseContext},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__BaseContext},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree__BaseContext},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_12_BaseContext_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__BaseContext},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__BaseContext_spec = {
  "lxml.etree._BaseContext",
  sizeof(struct __pyx_obj_4lxml_5etree__BaseContext),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__BaseContext_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__BaseContext = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_BaseContext", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__BaseContext), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__BaseContext, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__BaseContext, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__BaseContext, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__BaseContext, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__BaseContext, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_4lxml_5etree_12_BaseContext_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__BaseContext, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4lxml_5etree__ElementUnicodeResult(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *p;
  PyObject *o = __Pyx_PyType_GetSlot((&PyUnicode_Type), tp_new, newfunc)(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *)o);
  p->_parent = ((struct LxmlElement *)Py_None); Py_INCREF(Py_None);
  p->attrname = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__ElementUnicodeResult(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *p = (struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree__ElementUnicodeResult) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_parent);
  Py_CLEAR(p->attrname);
  __Pyx_PyType_GetSlot((&PyUnicode_Type), tp_dealloc, destructor)(o);
}

static int __pyx_tp_traverse_4lxml_5etree__ElementUnicodeResult(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *p = (struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *)o;
  {
    traverseproc traverse = __Pyx_PyType_GetSlot((&PyUnicode_Type), tp_traverse, traverseproc);
    if (!traverse); else { e = traverse(o,v,a); if (e) return e; }
  }
  {
    e = __Pyx_call_type_traverse(o, 0, v, a);
    if (e) return e;
  }
  if (p->_parent) {
    e = (*v)(((PyObject *)p->_parent), a); if (e) return e;
  }
  if (p->attrname) {
    e = (*v)(p->attrname, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__ElementUnicodeResult(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *p = (struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *)o;
  {
    inquiry clear = __Pyx_PyType_GetSlot((&PyUnicode_Type), tp_clear, inquiry);
    if (clear) clear(o);
  }
  Py_CLEAR(p->_parent);
  Py_CLEAR(p->attrname);
  return 0;
}

static PyObject *__pyx_getprop_4lxml_5etree_21_ElementUnicodeResult_is_text(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_21_ElementUnicodeResult_7is_text_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_21_ElementUnicodeResult_is_attribute(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_21_ElementUnicodeResult_12is_attribute_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_21_ElementUnicodeResult_attrname(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_21_ElementUnicodeResult_8attrname_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_21_ElementUnicodeResult_is_tail(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_21_ElementUnicodeResult_7is_tail_1__get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree__ElementUnicodeResult[] = {
  {"getparent", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_21_ElementUnicodeResult_1getparent, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__ElementUnicodeResult[] = {
  {"is_text", __pyx_getprop_4lxml_5etree_21_ElementUnicodeResult_is_text, 0, 0, 0},
  {"is_attribute", __pyx_getprop_4lxml_5etree_21_ElementUnicodeResult_is_attribute, 0, 0, 0},
  {"attrname", __pyx_getprop_4lxml_5etree_21_ElementUnicodeResult_attrname, 0, 0, 0},
  {"is_tail", __pyx_getprop_4lxml_5etree_21_ElementUnicodeResult_is_tail, 0, 0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__ElementUnicodeResult_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__ElementUnicodeResult},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__ElementUnicodeResult},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__ElementUnicodeResult},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__ElementUnicodeResult},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree__ElementUnicodeResult},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__ElementUnicodeResult},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__ElementUnicodeResult_spec = {
  "lxml.etree._ElementUnicodeResult",
  sizeof(struct __pyx_obj_4lxml_5etree__ElementUnicodeResult),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__ElementUnicodeResult_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__ElementUnicodeResult = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_ElementUnicodeResult", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ElementUnicodeResult), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ElementUnicodeResult, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ElementUnicodeResult, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ElementUnicodeResult, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__ElementUnicodeResult, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__ElementUnicodeResult, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__ElementUnicodeResult, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__XPathContext __pyx_vtable_4lxml_5etree__XPathContext;

static PyObject *__pyx_tp_new_4lxml_5etree__XPathContext(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__XPathContext *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__BaseContext(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__XPathContext *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__BaseContext*)__pyx_vtabptr_4lxml_5etree__XPathContext;
  p->_variables = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__XPathContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__XPathContext *p = (struct __pyx_obj_4lxml_5etree__XPathContext *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_variables);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_4lxml_5etree__BaseContext(o);
}

static int __pyx_tp_traverse_4lxml_5etree__XPathContext(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__XPathContext *p = (struct __pyx_obj_4lxml_5etree__XPathContext *)o;
  e = __pyx_tp_traverse_4lxml_5etree__BaseContext(o, v, a); if (e) return e;
  if (p->_variables) {
    e = (*v)(p->_variables, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__XPathContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__XPathContext *p = (struct __pyx_obj_4lxml_5etree__XPathContext *)o;
  __pyx_tp_clear_4lxml_5etree__BaseContext(o);
  Py_CLEAR(p->_variables);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__XPathContext[] = {
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__XPathContext_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__XPathContext},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__XPathContext},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__XPathContext},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__XPathContext},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_13_XPathContext_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__XPathContext},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__XPathContext_spec = {
  "lxml.etree._XPathContext",
  sizeof(struct __pyx_obj_4lxml_5etree__XPathContext),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__XPathContext_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__XPathContext = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_XPathContext", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__XPathContext), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__XPathContext, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__XPathContext, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__XPathContext, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__XPathContext, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_4lxml_5etree_13_XPathContext_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__XPathContext, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__XPathEvaluatorBase __pyx_vtable_4lxml_5etree__XPathEvaluatorBase;

static PyObject *__pyx_tp_new_4lxml_5etree__XPathEvaluatorBase(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__XPathEvaluatorBase;
  p->_context = ((struct __pyx_obj_4lxml_5etree__XPathContext *)Py_None); Py_INCREF(Py_None);
  p->_error_log = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_19_XPathEvaluatorBase_1__cinit__(o, __pyx_mstate_global->__pyx_empty_tuple, NULL) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_4lxml_5etree__XPathEvaluatorBase(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *p = (struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree__XPathEvaluatorBase) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_4lxml_5etree_19_XPathEvaluatorBase_5__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->_context);
  Py_CLEAR(p->_error_log);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_4lxml_5etree__XPathEvaluatorBase(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *p = (struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->_context) {
    e = (*v)(((PyObject *)p->_context), a); if (e) return e;
  }
  if (p->_error_log) {
    e = (*v)(((PyObject *)p->_error_log), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__XPathEvaluatorBase(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *p = (struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)o;
  Py_CLEAR(p->_context);
  Py_CLEAR(p->_error_log);
  return 0;
}

static PyObject *__pyx_getprop_4lxml_5etree_19_XPathEvaluatorBase_error_log(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_19_XPathEvaluatorBase_9error_log_1__get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree__XPathEvaluatorBase[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__XPathEvaluatorBase[] = {
  {"error_log", __pyx_getprop_4lxml_5etree_19_XPathEvaluatorBase_error_log, 0, 0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__XPathEvaluatorBase_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__XPathEvaluatorBase},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__XPathEvaluatorBase},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__XPathEvaluatorBase},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__XPathEvaluatorBase},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree__XPathEvaluatorBase},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_19_XPathEvaluatorBase_3__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__XPathEvaluatorBase},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__XPathEvaluatorBase_spec = {
  "lxml.etree._XPathEvaluatorBase",
  sizeof(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__XPathEvaluatorBase_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__XPathEvaluatorBase = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_XPathEvaluatorBase", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__XPathEvaluatorBase, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__XPathEvaluatorBase, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__XPathEvaluatorBase, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__XPathEvaluatorBase, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__XPathEvaluatorBase, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_4lxml_5etree_19_XPathEvaluatorBase_3__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__XPathEvaluatorBase, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree_XPathElementEvaluator __pyx_vtable_4lxml_5etree_XPathElementEvaluator;

static PyObject *__pyx_tp_new_4lxml_5etree_XPathElementEvaluator(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__XPathEvaluatorBase(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__XPathEvaluatorBase*)__pyx_vtabptr_4lxml_5etree_XPathElementEvaluator;
  p->_element = ((struct LxmlElement *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_XPathElementEvaluator(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *p = (struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree_XPathElementEvaluator) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_element);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_4lxml_5etree__XPathEvaluatorBase(o);
}

static int __pyx_tp_traverse_4lxml_5etree_XPathElementEvaluator(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *p = (struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *)o;
  e = __pyx_tp_traverse_4lxml_5etree__XPathEvaluatorBase(o, v, a); if (e) return e;
  if (p->_element) {
    e = (*v)(((PyObject *)p->_element), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree_XPathElementEvaluator(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *p = (struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *)o;
  __pyx_tp_clear_4lxml_5etree__XPathEvaluatorBase(o);
  Py_CLEAR(p->_element);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree_XPathElementEvaluator[] = {
  {"register_namespace", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_21XPathElementEvaluator_3register_namespace, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_21XPathElementEvaluator_2register_namespace},
  {"register_namespaces", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_21XPathElementEvaluator_5register_namespaces, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_21XPathElementEvaluator_4register_namespaces},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_XPathElementEvaluator_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_XPathElementEvaluator},
  {Py_tp_call, (void *)__pyx_pw_4lxml_5etree_21XPathElementEvaluator_7__call__},
  {Py_tp_doc, (void *)PyDoc_STR("XPathElementEvaluator(self, element, namespaces=None, extensions=None, regexp=True, smart_strings=True)\n    Create an XPath evaluator for an element.\n\n    Absolute XPath expressions (starting with '/') will be evaluated against\n    the ElementTree as returned by getroottree().\n\n    Additional namespace declarations can be passed with the\n    'namespace' keyword argument.  EXSLT regular expression support\n    can be disabled with the 'regexp' boolean keyword (defaults to\n    True).  Smart strings will be returned for string results unless\n    you pass ``smart_strings=False``.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_XPathElementEvaluator},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_XPathElementEvaluator},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_XPathElementEvaluator},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_21XPathElementEvaluator_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_XPathElementEvaluator},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_XPathElementEvaluator_spec = {
  "lxml.etree.XPathElementEvaluator",
  sizeof(struct __pyx_obj_4lxml_5etree_XPathElementEvaluator),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_XPathElementEvaluator_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_XPathElementEvaluator = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""XPathElementEvaluator", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_XPathElementEvaluator), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_XPathElementEvaluator, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  __pyx_pw_4lxml_5etree_21XPathElementEvaluator_7__call__, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("XPathElementEvaluator(self, element, namespaces=None, extensions=None, regexp=True, smart_strings=True)\n    Create an XPath evaluator for an element.\n\n    Absolute XPath expressions (starting with '/') will be evaluated against\n    the ElementTree as returned by getroottree().\n\n    Additional namespace declarations can be passed with the\n    'namespace' keyword argument.  EXSLT regular expression support\n    can be disabled with the 'regexp' boolean keyword (defaults to\n    True).  Smart strings will be returned for string results unless\n    you pass ``smart_strings=False``.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_XPathElementEvaluator, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_XPathElementEvaluator, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_XPathElementEvaluator, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_4lxml_5etree_21XPathElementEvaluator_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_XPathElementEvaluator, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree_XPathDocumentEvaluator __pyx_vtable_4lxml_5etree_XPathDocumentEvaluator;

static PyObject *__pyx_tp_new_4lxml_5etree_XPathDocumentEvaluator(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_XPathDocumentEvaluator *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree_XPathElementEvaluator(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_XPathDocumentEvaluator *)o);
  p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__XPathEvaluatorBase*)__pyx_vtabptr_4lxml_5etree_XPathDocumentEvaluator;
  return o;
}

static PyMethodDef __pyx_methods_4lxml_5etree_XPathDocumentEvaluator[] = {
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_XPathDocumentEvaluator_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_XPathElementEvaluator},
  {Py_tp_call, (void *)__pyx_pw_4lxml_5etree_22XPathDocumentEvaluator_3__call__},
  {Py_tp_doc, (void *)PyDoc_STR("XPathDocumentEvaluator(self, etree, namespaces=None, extensions=None, regexp=True, smart_strings=True)\n    Create an XPath evaluator for an ElementTree.\n\n    Additional namespace declarations can be passed with the\n    'namespace' keyword argument.  EXSLT regular expression support\n    can be disabled with the 'regexp' boolean keyword (defaults to\n    True).  Smart strings will be returned for string results unless\n    you pass ``smart_strings=False``.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_XPathElementEvaluator},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_XPathElementEvaluator},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_XPathDocumentEvaluator},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_22XPathDocumentEvaluator_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_XPathDocumentEvaluator},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_XPathDocumentEvaluator_spec = {
  "lxml.etree.XPathDocumentEvaluator",
  sizeof(struct __pyx_obj_4lxml_5etree_XPathDocumentEvaluator),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_XPathDocumentEvaluator_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_XPathDocumentEvaluator = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""XPathDocumentEvaluator", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_XPathDocumentEvaluator), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_XPathElementEvaluator, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  __pyx_pw_4lxml_5etree_22XPathDocumentEvaluator_3__call__, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("XPathDocumentEvaluator(self, etree, namespaces=None, extensions=None, regexp=True, smart_strings=True)\n    Create an XPath evaluator for an ElementTree.\n\n    Additional namespace declarations can be passed with the\n    'namespace' keyword argument.  EXSLT regular expression support\n    can be disabled with the 'regexp' boolean keyword (defaults to\n    True).  Smart strings will be returned for string results unless\n    you pass ``smart_strings=False``.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_XPathElementEvaluator, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_XPathElementEvaluator, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_XPathDocumentEvaluator, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_4lxml_5etree_22XPathDocumentEvaluator_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_XPathDocumentEvaluator, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree_XPath __pyx_vtable_4lxml_5etree_XPath;

static PyObject *__pyx_tp_new_4lxml_5etree_XPath(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_XPath *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__XPathEvaluatorBase(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_XPath *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__XPathEvaluatorBase*)__pyx_vtabptr_4lxml_5etree_XPath;
  p->_path = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_5XPath_1__cinit__(o, __pyx_mstate_global->__pyx_empty_tuple, NULL) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_4lxml_5etree_XPath(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_XPath *p = (struct __pyx_obj_4lxml_5etree_XPath *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree_XPath) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_4lxml_5etree_5XPath_7__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->_path);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_4lxml_5etree__XPathEvaluatorBase(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_5XPath_path(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_5XPath_4path_1__get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree_XPath[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree_XPath[] = {
  {"path", __pyx_getprop_4lxml_5etree_5XPath_path, 0, PyDoc_STR("The literal XPath expression.\n        "), 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_XPath_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_XPath},
  {Py_tp_repr, (void *)__pyx_pw_4lxml_5etree_5XPath_9__repr__},
  {Py_tp_call, (void *)__pyx_pw_4lxml_5etree_5XPath_5__call__},
  {Py_tp_doc, (void *)PyDoc_STR("XPath(self, path, namespaces=None, extensions=None, regexp=True, smart_strings=True)\n    A compiled XPath expression that can be called on Elements and ElementTrees.\n\n    Besides the XPath expression, you can pass prefix-namespace\n    mappings and extension functions to the constructor through the\n    keyword arguments ``namespaces`` and ``extensions``.  EXSLT\n    regular expression support can be disabled with the 'regexp'\n    boolean keyword (defaults to True).  Smart strings will be\n    returned for string results unless you pass\n    ``smart_strings=False``.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__XPathEvaluatorBase},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__XPathEvaluatorBase},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_XPath},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree_XPath},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_5XPath_3__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_XPath},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_XPath_spec = {
  "lxml.etree.XPath",
  sizeof(struct __pyx_obj_4lxml_5etree_XPath),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_XPath_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_XPath = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""XPath", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_XPath), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_XPath, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  __pyx_pw_4lxml_5etree_5XPath_9__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  __pyx_pw_4lxml_5etree_5XPath_5__call__, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("XPath(self, path, namespaces=None, extensions=None, regexp=True, smart_strings=True)\n    A compiled XPath expression that can be called on Elements and ElementTrees.\n\n    Besides the XPath expression, you can pass prefix-namespace\n    mappings and extension functions to the constructor through the\n    keyword arguments ``namespaces`` and ``extensions``.  EXSLT\n    regular expression support can be disabled with the 'regexp'\n    boolean keyword (defaults to True).  Smart strings will be\n    returned for string results unless you pass\n    ``smart_strings=False``.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__XPathEvaluatorBase, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__XPathEvaluatorBase, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_XPath, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree_XPath, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_4lxml_5etree_5XPath_3__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_XPath, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree_ETXPath __pyx_vtable_4lxml_5etree_ETXPath;

static PyObject *__pyx_tp_new_4lxml_5etree_ETXPath(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_ETXPath *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree_XPath(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_ETXPath *)o);
  p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__XPathEvaluatorBase*)__pyx_vtabptr_4lxml_5etree_ETXPath;
  return o;
}

static PyMethodDef __pyx_methods_4lxml_5etree_ETXPath[] = {
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_ETXPath_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_XPath},
  {Py_tp_doc, (void *)PyDoc_STR("ETXPath(self, path, extensions=None, regexp=True, smart_strings=True)\n    Special XPath class that supports the ElementTree {uri} notation for namespaces.\n\n    Note that this class does not accept the ``namespace`` keyword\n    argument. All namespaces must be passed as part of the path\n    string.  Smart strings will be returned for string results unless\n    you pass ``smart_strings=False``.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__XPathEvaluatorBase},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__XPathEvaluatorBase},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_ETXPath},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_7ETXPath_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_ETXPath},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_ETXPath_spec = {
  "lxml.etree.ETXPath",
  sizeof(struct __pyx_obj_4lxml_5etree_ETXPath),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_ETXPath_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_ETXPath = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""ETXPath", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_ETXPath), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_XPath, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_5XPath_9__repr__, /*tp_repr*/
  #else
  0, /*tp_repr*/
  #endif
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_5XPath_5__call__, /*tp_call*/
  #else
  0, /*tp_call*/
  #endif
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("ETXPath(self, path, extensions=None, regexp=True, smart_strings=True)\n    Special XPath class that supports the ElementTree {uri} notation for namespaces.\n\n    Note that this class does not accept the ``namespace`` keyword\n    argument. All namespaces must be passed as part of the path\n    string.  Smart strings will be returned for string results unless\n    you pass ``smart_strings=False``.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__XPathEvaluatorBase, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__XPathEvaluatorBase, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_ETXPath, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_4lxml_5etree_7ETXPath_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_ETXPath, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_XSLTError_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_Error},
  {Py_tp_doc, (void *)PyDoc_STR("Base class of all XSLT errors.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_Error},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_Error},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_Error},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_XSLTError_spec = {
  "lxml.etree.XSLTError",
  sizeof(struct __pyx_obj_4lxml_5etree_XSLTError),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_XSLTError_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_XSLTError = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""XSLTError", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_XSLTError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_Error, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("Base class of all XSLT errors.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_Error, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_Error, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_9LxmlError_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_Error, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_XSLTParseError_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_Error},
  {Py_tp_doc, (void *)PyDoc_STR("Error parsing a stylesheet document.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_Error},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_Error},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_Error},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_XSLTParseError_spec = {
  "lxml.etree.XSLTParseError",
  sizeof(struct __pyx_obj_4lxml_5etree_XSLTParseError),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_XSLTParseError_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_XSLTParseError = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""XSLTParseError", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_XSLTParseError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_Error, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("Error parsing a stylesheet document.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_Error, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_Error, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_9LxmlError_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_Error, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_XSLTApplyError_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_Error},
  {Py_tp_doc, (void *)PyDoc_STR("Error running an XSL transformation.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_Error},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_Error},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_Error},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_XSLTApplyError_spec = {
  "lxml.etree.XSLTApplyError",
  sizeof(struct __pyx_obj_4lxml_5etree_XSLTApplyError),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_XSLTApplyError_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_XSLTApplyError = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""XSLTApplyError", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_XSLTApplyError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_Error, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("Error running an XSL transformation.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_Error, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_Error, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_9LxmlError_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_Error, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_XSLTExtensionError_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_Error},
  {Py_tp_doc, (void *)PyDoc_STR("Error registering an XSLT extension.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_Error},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_Error},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_Error},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_XSLTExtensionError_spec = {
  "lxml.etree.XSLTExtensionError",
  sizeof(struct __pyx_obj_4lxml_5etree_XSLTExtensionError),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_XSLTExtensionError_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_XSLTExtensionError = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""XSLTExtensionError", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_XSLTExtensionError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_Error, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("Error registering an XSLT extension.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_Error, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_Error, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_9LxmlError_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_Error, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__XSLTResolverContext __pyx_vtable_4lxml_5etree__XSLTResolverContext;

static PyObject *__pyx_tp_new_4lxml_5etree__XSLTResolverContext(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__XSLTResolverContext *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ResolverContext(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__XSLTResolverContext *)o);
  p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext*)__pyx_vtabptr_4lxml_5etree__XSLTResolverContext;
  p->_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__XSLTResolverContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__XSLTResolverContext *p = (struct __pyx_obj_4lxml_5etree__XSLTResolverContext *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_parser);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_4lxml_5etree__ResolverContext(o);
}

static int __pyx_tp_traverse_4lxml_5etree__XSLTResolverContext(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__XSLTResolverContext *p = (struct __pyx_obj_4lxml_5etree__XSLTResolverContext *)o;
  e = __pyx_tp_traverse_4lxml_5etree__ResolverContext(o, v, a); if (e) return e;
  if (p->_parser) {
    e = (*v)(((PyObject *)p->_parser), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__XSLTResolverContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__XSLTResolverContext *p = (struct __pyx_obj_4lxml_5etree__XSLTResolverContext *)o;
  __pyx_tp_clear_4lxml_5etree__ResolverContext(o);
  Py_CLEAR(p->_parser);
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__XSLTResolverContext_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__XSLTResolverContext},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__XSLTResolverContext},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__XSLTResolverContext},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__XSLTResolverContext},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__XSLTResolverContext_spec = {
  "lxml.etree._XSLTResolverContext",
  sizeof(struct __pyx_obj_4lxml_5etree__XSLTResolverContext),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__XSLTResolverContext_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__XSLTResolverContext = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_XSLTResolverContext", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__XSLTResolverContext), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__XSLTResolverContext, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__XSLTResolverContext, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__XSLTResolverContext, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__XSLTResolverContext, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree_XSLTAccessControl __pyx_vtable_4lxml_5etree_XSLTAccessControl;

static PyObject *__pyx_tp_new_4lxml_5etree_XSLTAccessControl(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree_XSLTAccessControl *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_XSLTAccessControl *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree_XSLTAccessControl;
  if (unlikely(__pyx_pw_4lxml_5etree_17XSLTAccessControl_1__cinit__(o, __pyx_mstate_global->__pyx_empty_tuple, NULL) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_4lxml_5etree_XSLTAccessControl(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree_XSLTAccessControl) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_4lxml_5etree_17XSLTAccessControl_5__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static PyObject *__pyx_getprop_4lxml_5etree_17XSLTAccessControl_options(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_17XSLTAccessControl_7options_1__get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree_XSLTAccessControl[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree_XSLTAccessControl[] = {
  {"options", __pyx_getprop_4lxml_5etree_17XSLTAccessControl_options, 0, PyDoc_STR("The access control configuration as a map of options."), 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_XSLTAccessControl_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_XSLTAccessControl},
  {Py_tp_repr, (void *)__pyx_pw_4lxml_5etree_17XSLTAccessControl_7__repr__},
  {Py_tp_doc, (void *)PyDoc_STR("XSLTAccessControl(self, read_file=True, write_file=True, create_dir=True, read_network=True, write_network=True)\n\n    Access control for XSLT: reading/writing files, directories and\n    network I/O.  Access to a type of resource is granted or denied by\n    passing any of the following boolean keyword arguments.  All of\n    them default to True to allow access.\n\n    - read_file\n    - write_file\n    - create_dir\n    - read_network\n    - write_network\n\n    For convenience, there is also a class member `DENY_ALL` that\n    provides an XSLTAccessControl instance that is readily configured\n    to deny everything, and a `DENY_WRITE` member that denies all\n    write access but allows read access.\n\n    See `XSLT`.\n    ")},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_XSLTAccessControl},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree_XSLTAccessControl},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_17XSLTAccessControl_3__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_XSLTAccessControl},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_XSLTAccessControl_spec = {
  "lxml.etree.XSLTAccessControl",
  sizeof(struct __pyx_obj_4lxml_5etree_XSLTAccessControl),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE,
  __pyx_type_4lxml_5etree_XSLTAccessControl_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_XSLTAccessControl = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""XSLTAccessControl", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_XSLTAccessControl), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_XSLTAccessControl, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  __pyx_pw_4lxml_5etree_17XSLTAccessControl_7__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  PyDoc_STR("XSLTAccessControl(self, read_file=True, write_file=True, create_dir=True, read_network=True, write_network=True)\n\n    Access control for XSLT: reading/writing files, directories and\n    network I/O.  Access to a type of resource is granted or denied by\n    passing any of the following boolean keyword arguments.  All of\n    them default to True to allow access.\n\n    - read_file\n    - write_file\n    - create_dir\n    - read_network\n    - write_network\n\n    For convenience, there is also a class member `DENY_ALL` that\n    provides an XSLTAccessControl instance that is readily configured\n    to deny everything, and a `DENY_WRITE` member that denies all\n    write access but allows read access.\n\n    See `XSLT`.\n    "), /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_XSLTAccessControl, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree_XSLTAccessControl, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_4lxml_5etree_17XSLTAccessControl_3__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_XSLTAccessControl, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__XSLTContext __pyx_vtable_4lxml_5etree__XSLTContext;

static PyObject *__pyx_tp_new_4lxml_5etree__XSLTContext(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__XSLTContext *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__BaseContext(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__XSLTContext *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__BaseContext*)__pyx_vtabptr_4lxml_5etree__XSLTContext;
  p->_extension_element_proxy = ((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)Py_None); Py_INCREF(Py_None);
  p->_extension_elements = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_12_XSLTContext_1__cinit__(o, __pyx_mstate_global->__pyx_empty_tuple, NULL) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_4lxml_5etree__XSLTContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__XSLTContext *p = (struct __pyx_obj_4lxml_5etree__XSLTContext *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_extension_element_proxy);
  Py_CLEAR(p->_extension_elements);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_4lxml_5etree__BaseContext(o);
}

static int __pyx_tp_traverse_4lxml_5etree__XSLTContext(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__XSLTContext *p = (struct __pyx_obj_4lxml_5etree__XSLTContext *)o;
  e = __pyx_tp_traverse_4lxml_5etree__BaseContext(o, v, a); if (e) return e;
  if (p->_extension_element_proxy) {
    e = (*v)(((PyObject *)p->_extension_element_proxy), a); if (e) return e;
  }
  if (p->_extension_elements) {
    e = (*v)(p->_extension_elements, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__XSLTContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__XSLTContext *p = (struct __pyx_obj_4lxml_5etree__XSLTContext *)o;
  __pyx_tp_clear_4lxml_5etree__BaseContext(o);
  Py_CLEAR(p->_extension_element_proxy);
  Py_CLEAR(p->_extension_elements);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__XSLTContext[] = {
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__XSLTContext_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__XSLTContext},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__XSLTContext},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__XSLTContext},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__XSLTContext},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_12_XSLTContext_3__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__XSLTContext},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__XSLTContext_spec = {
  "lxml.etree._XSLTContext",
  sizeof(struct __pyx_obj_4lxml_5etree__XSLTContext),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__XSLTContext_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__XSLTContext = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_XSLTContext", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__XSLTContext), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__XSLTContext, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__XSLTContext, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__XSLTContext, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__XSLTContext, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_4lxml_5etree_12_XSLTContext_3__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__XSLTContext, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4lxml_5etree__XSLTQuotedStringParam(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__XSLTQuotedStringParam *p;
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4lxml_5etree__XSLTQuotedStringParam > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__XSLTQuotedStringParam, sizeof(struct __pyx_obj_4lxml_5etree__XSLTQuotedStringParam))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_4lxml_5etree__XSLTQuotedStringParam[--__pyx_mstate_global->__pyx_freecount_4lxml_5etree__XSLTQuotedStringParam];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_4lxml_5etree__XSLTQuotedStringParam));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_4lxml_5etree__XSLTQuotedStringParam *)o);
  p->strval = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_22_XSLTQuotedStringParam_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_4lxml_5etree__XSLTQuotedStringParam(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__XSLTQuotedStringParam *p = (struct __pyx_obj_4lxml_5etree__XSLTQuotedStringParam *)o;
  Py_CLEAR(p->strval);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4lxml_5etree__XSLTQuotedStringParam < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__XSLTQuotedStringParam, sizeof(struct __pyx_obj_4lxml_5etree__XSLTQuotedStringParam))))
  {
    __pyx_mstate_global->__pyx_freelist_4lxml_5etree__XSLTQuotedStringParam[__pyx_mstate_global->__pyx_freecount_4lxml_5etree__XSLTQuotedStringParam++] = ((struct __pyx_obj_4lxml_5etree__XSLTQuotedStringParam *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static PyMethodDef __pyx_methods_4lxml_5etree__XSLTQuotedStringParam[] = {
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__XSLTQuotedStringParam_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__XSLTQuotedStringParam},
  {Py_tp_doc, (void *)PyDoc_STR("A wrapper class for literal XSLT string parameters that require\n    quote escaping.\n    ")},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__XSLTQuotedStringParam},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__XSLTQuotedStringParam},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__XSLTQuotedStringParam_spec = {
  "lxml.etree._XSLTQuotedStringParam",
  sizeof(struct __pyx_obj_4lxml_5etree__XSLTQuotedStringParam),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER,
  __pyx_type_4lxml_5etree__XSLTQuotedStringParam_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__XSLTQuotedStringParam = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_XSLTQuotedStringParam", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__XSLTQuotedStringParam), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__XSLTQuotedStringParam, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
  PyDoc_STR("A wrapper class for literal XSLT string parameters that require\n    quote escaping.\n    "), /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__XSLTQuotedStringParam, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__XSLTQuotedStringParam, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree_XSLT __pyx_vtable_4lxml_5etree_XSLT;

static PyObject *__pyx_tp_new_4lxml_5etree_XSLT(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree_XSLT *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_XSLT *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree_XSLT;
  p->_context = ((struct __pyx_obj_4lxml_5etree__XSLTContext *)Py_None); Py_INCREF(Py_None);
  p->_xslt_resolver_context = ((struct __pyx_obj_4lxml_5etree__XSLTResolverContext *)Py_None); Py_INCREF(Py_None);
  p->_access_control = ((struct __pyx_obj_4lxml_5etree_XSLTAccessControl *)Py_None); Py_INCREF(Py_None);
  p->_error_log = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_4XSLT_1__cinit__(o, __pyx_mstate_global->__pyx_empty_tuple, NULL) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_4lxml_5etree_XSLT(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_XSLT *p = (struct __pyx_obj_4lxml_5etree_XSLT *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree_XSLT) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_4lxml_5etree_4XSLT_5__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->_context);
  Py_CLEAR(p->_xslt_resolver_context);
  Py_CLEAR(p->_access_control);
  Py_CLEAR(p->_error_log);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_4lxml_5etree_XSLT(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree_XSLT *p = (struct __pyx_obj_4lxml_5etree_XSLT *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->_context) {
    e = (*v)(((PyObject *)p->_context), a); if (e) return e;
  }
  if (p->_xslt_resolver_context) {
    e = (*v)(((PyObject *)p->_xslt_resolver_context), a); if (e) return e;
  }
  if (p->_access_control) {
    e = (*v)(((PyObject *)p->_access_control), a); if (e) return e;
  }
  if (p->_error_log) {
    e = (*v)(((PyObject *)p->_error_log), a); if (e) return e;
  }
  return 0;
}

static PyObject *__pyx_getprop_4lxml_5etree_4XSLT_error_log(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_4XSLT_9error_log_1__get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree_XSLT[] = {
  {"strparam", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_4XSLT_7strparam, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_4XSLT_6strparam},
  {"set_global_max_depth", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_4XSLT_9set_global_max_depth, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_4XSLT_8set_global_max_depth},
  {"tostring", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_4XSLT_11tostring, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_4XSLT_10tostring},
  {"__deepcopy__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_4XSLT_13__deepcopy__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__copy__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_4XSLT_15__copy__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree_XSLT[] = {
  {"error_log", __pyx_getprop_4lxml_5etree_4XSLT_error_log, 0, PyDoc_STR("The log of errors and warnings of an XSLT execution."), 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_XSLT_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_XSLT},
  {Py_tp_call, (void *)__pyx_pw_4lxml_5etree_4XSLT_17__call__},
  {Py_tp_doc, (void *)PyDoc_STR("XSLT(self, xslt_input, extensions=None, regexp=True, access_control=None)\n\n    Turn an XSL document into an XSLT object.\n\n    Calling this object on a tree or Element will execute the XSLT::\n\n        transform = etree.XSLT(xsl_tree)\n        result = transform(xml_tree)\n\n    Keyword arguments of the constructor:\n\n    - extensions: a dict mapping ``(namespace, name)`` pairs to\n      extension functions or extension elements\n    - regexp: enable exslt regular expression support in XPath\n      (default: True)\n    - access_control: access restrictions for network or file\n      system (see `XSLTAccessControl`)\n\n    Keyword arguments of the XSLT call:\n\n    - profile_run: enable XSLT profiling and make the profile available\n      as XML document in ``result.xslt_profile`` (default: False)\n\n    Other keyword arguments of the call are passed to the stylesheet\n    as parameters.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_XSLT},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_XSLT},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree_XSLT},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_4XSLT_3__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_XSLT},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_XSLT_spec = {
  "lxml.etree.XSLT",
  sizeof(struct __pyx_obj_4lxml_5etree_XSLT),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_XSLT_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_XSLT = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""XSLT", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_XSLT), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_XSLT, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  __pyx_pw_4lxml_5etree_4XSLT_17__call__, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("XSLT(self, xslt_input, extensions=None, regexp=True, access_control=None)\n\n    Turn an XSL document into an XSLT object.\n\n    Calling this object on a tree or Element will execute the XSLT::\n\n        transform = etree.XSLT(xsl_tree)\n        result = transform(xml_tree)\n\n    Keyword arguments of the constructor:\n\n    - extensions: a dict mapping ``(namespace, name)`` pairs to\n      extension functions or extension elements\n    - regexp: enable exslt regular expression support in XPath\n      (default: True)\n    - access_control: access restrictions for network or file\n      system (see `XSLTAccessControl`)\n\n    Keyword arguments of the XSLT call:\n\n    - profile_run: enable XSLT profiling and make the profile available\n      as XML document in ``result.xslt_profile`` (default: False)\n\n    Other keyword arguments of the call are passed to the stylesheet\n    as parameters.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_XSLT, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_XSLT, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree_XSLT, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_4lxml_5etree_4XSLT_3__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_XSLT, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__XSLTResultTree __pyx_vtable_4lxml_5etree__XSLTResultTree;

static PyObject *__pyx_tp_new_4lxml_5etree__XSLTResultTree(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__XSLTResultTree *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ElementTree(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__XSLTResultTree *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__ElementTree*)__pyx_vtabptr_4lxml_5etree__XSLTResultTree;
  p->_xslt = ((struct __pyx_obj_4lxml_5etree_XSLT *)Py_None); Py_INCREF(Py_None);
  p->_profile = ((struct LxmlDocument *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__XSLTResultTree(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__XSLTResultTree *p = (struct __pyx_obj_4lxml_5etree__XSLTResultTree *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_xslt);
  Py_CLEAR(p->_profile);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_4lxml_5etree__ElementTree(o);
}

static int __pyx_tp_traverse_4lxml_5etree__XSLTResultTree(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__XSLTResultTree *p = (struct __pyx_obj_4lxml_5etree__XSLTResultTree *)o;
  e = __pyx_tp_traverse_4lxml_5etree__ElementTree(o, v, a); if (e) return e;
  if (p->_xslt) {
    e = (*v)(((PyObject *)p->_xslt), a); if (e) return e;
  }
  if (p->_profile) {
    e = (*v)(((PyObject *)p->_profile), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__XSLTResultTree(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__XSLTResultTree *p = (struct __pyx_obj_4lxml_5etree__XSLTResultTree *)o;
  __pyx_tp_clear_4lxml_5etree__ElementTree(o);
  Py_CLEAR(p->_xslt);
  Py_CLEAR(p->_profile);
  return 0;
}

static PyObject *__pyx_getprop_4lxml_5etree_15_XSLTResultTree_xslt_profile(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_15_XSLTResultTree_12xslt_profile_1__get__(o);
}

static int __pyx_setprop_4lxml_5etree_15_XSLTResultTree_xslt_profile(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    PyErr_SetString(PyExc_NotImplementedError, "__set__");
    return -1;
  }
  else {
    return __pyx_pw_4lxml_5etree_15_XSLTResultTree_12xslt_profile_3__del__(o);
  }
}

static PyMethodDef __pyx_methods_4lxml_5etree__XSLTResultTree[] = {
  {"write_output", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_15_XSLTResultTree_1write_output, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_15_XSLTResultTree_write_output},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__XSLTResultTree[] = {
  {"xslt_profile", __pyx_getprop_4lxml_5etree_15_XSLTResultTree_xslt_profile, __pyx_setprop_4lxml_5etree_15_XSLTResultTree_xslt_profile, PyDoc_STR("Return an ElementTree with profiling data for the stylesheet run.\n        "), 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
#if !CYTHON_COMPILING_IN_LIMITED_API

static PyBufferProcs __pyx_tp_as_buffer__XSLTResultTree = {
  __pyx_pw_4lxml_5etree_15_XSLTResultTree_5__getbuffer__, /*bf_getbuffer*/
  __pyx_pw_4lxml_5etree_15_XSLTResultTree_7__releasebuffer__, /*bf_releasebuffer*/
};
#endif
static PyType_Slot __pyx_type_4lxml_5etree__XSLTResultTree_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__XSLTResultTree},
  {Py_tp_str, (void *)__pyx_pw_4lxml_5etree_15_XSLTResultTree_3__str__},
  #if defined(Py_bf_getbuffer)
  {Py_bf_getbuffer, (void *)__pyx_pw_4lxml_5etree_15_XSLTResultTree_5__getbuffer__},
  #endif
  #if defined(Py_bf_releasebuffer)
  {Py_bf_releasebuffer, (void *)__pyx_pw_4lxml_5etree_15_XSLTResultTree_7__releasebuffer__},
  #endif
  {Py_tp_doc, (void *)PyDoc_STR("The result of an XSLT evaluation.\n\n    Use ``str()`` or ``bytes()`` (or ``unicode()`` in Python 2.x) to serialise to a string,\n    and the ``.write_output()`` method to write serialise to a file.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__XSLTResultTree},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__XSLTResultTree},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__XSLTResultTree},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree__XSLTResultTree},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__XSLTResultTree},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__XSLTResultTree_spec = {
  "lxml.etree._XSLTResultTree",
  sizeof(struct __pyx_obj_4lxml_5etree__XSLTResultTree),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__XSLTResultTree_slots,
};
#else

static PyBufferProcs __pyx_tp_as_buffer__XSLTResultTree = {
  __pyx_pw_4lxml_5etree_15_XSLTResultTree_5__getbuffer__, /*bf_getbuffer*/
  __pyx_pw_4lxml_5etree_15_XSLTResultTree_7__releasebuffer__, /*bf_releasebuffer*/
};

static PyTypeObject __pyx_type_4lxml_5etree__XSLTResultTree = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_XSLTResultTree", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__XSLTResultTree), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__XSLTResultTree, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  __pyx_pw_4lxml_5etree_15_XSLTResultTree_3__str__, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__XSLTResultTree, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("The result of an XSLT evaluation.\n\n    Use ``str()`` or ``bytes()`` (or ``unicode()`` in Python 2.x) to serialise to a string,\n    and the ``.write_output()`` method to write serialise to a file.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__XSLTResultTree, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__XSLTResultTree, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__XSLTResultTree, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__XSLTResultTree, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__XSLTResultTree, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__XSLTProcessingInstruction __pyx_vtable_4lxml_5etree__XSLTProcessingInstruction;

static PyObject *__pyx_tp_new_4lxml_5etree__XSLTProcessingInstruction(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__XSLTProcessingInstruction *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree_PIBase(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__XSLTProcessingInstruction *)o);
  p->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree___ContentOnlyElement*)__pyx_vtabptr_4lxml_5etree__XSLTProcessingInstruction;
  return o;
}

static PyMethodDef __pyx_methods_4lxml_5etree__XSLTProcessingInstruction[] = {
  {"parseXSL", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_26_XSLTProcessingInstruction_1parseXSL, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_26_XSLTProcessingInstruction_parseXSL},
  {"set", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_26_XSLTProcessingInstruction_3set, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_26_XSLTProcessingInstruction_2set},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__XSLTProcessingInstruction_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__Element},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__Element},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__XSLTProcessingInstruction},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__XSLTProcessingInstruction},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__XSLTProcessingInstruction_spec = {
  "lxml.etree._XSLTProcessingInstruction",
  sizeof(struct __pyx_obj_4lxml_5etree__XSLTProcessingInstruction),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__XSLTProcessingInstruction_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__XSLTProcessingInstruction = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_XSLTProcessingInstruction", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__XSLTProcessingInstruction), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__Element, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_22_ProcessingInstruction_1__repr__, /*tp_repr*/
  #else
  0, /*tp_repr*/
  #endif
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__Element, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_8_Element_41__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__XSLTProcessingInstruction, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_6PIBase_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__XSLTProcessingInstruction, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree_XSLTExtension __pyx_vtable_4lxml_5etree_XSLTExtension;

static PyObject *__pyx_tp_new_4lxml_5etree_XSLTExtension(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree_XSLTExtension *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_XSLTExtension *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree_XSLTExtension;
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_XSLTExtension(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree_XSLTExtension) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static PyMethodDef __pyx_methods_4lxml_5etree_XSLTExtension[] = {
  {"execute", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_13XSLTExtension_1execute, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_13XSLTExtension_execute},
  {"apply_templates", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_13XSLTExtension_3apply_templates, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_13XSLTExtension_2apply_templates},
  {"process_children", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_13XSLTExtension_5process_children, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_13XSLTExtension_4process_children},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_XSLTExtension_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_XSLTExtension},
  {Py_tp_doc, (void *)PyDoc_STR("Base class of an XSLT extension element.\n    ")},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_XSLTExtension},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_XSLTExtension},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_XSLTExtension_spec = {
  "lxml.etree.XSLTExtension",
  sizeof(struct __pyx_obj_4lxml_5etree_XSLTExtension),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE,
  __pyx_type_4lxml_5etree_XSLTExtension_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_XSLTExtension = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""XSLTExtension", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_XSLTExtension), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_XSLTExtension, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  PyDoc_STR("Base class of an XSLT extension element.\n    "), /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_XSLTExtension, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_XSLTExtension, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_DocumentInvalid_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_Error},
  {Py_tp_doc, (void *)PyDoc_STR("Validation error.\n\n    Raised by all document validators when their ``assertValid(tree)``\n    method fails.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_Error},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_Error},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_Error},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_DocumentInvalid_spec = {
  "lxml.etree.DocumentInvalid",
  sizeof(struct __pyx_obj_4lxml_5etree_DocumentInvalid),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_DocumentInvalid_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_DocumentInvalid = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""DocumentInvalid", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_DocumentInvalid), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_Error, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("Validation error.\n\n    Raised by all document validators when their ``assertValid(tree)``\n    method fails.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_Error, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_Error, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_9LxmlError_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_Error, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__Validator __pyx_vtable_4lxml_5etree__Validator;

static PyObject *__pyx_tp_new_4lxml_5etree__Validator(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree__Validator *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__Validator *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__Validator;
  p->_error_log = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_10_Validator_1__cinit__(o, __pyx_mstate_global->__pyx_empty_tuple, NULL) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_4lxml_5etree__Validator(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__Validator *p = (struct __pyx_obj_4lxml_5etree__Validator *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree__Validator) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_error_log);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_4lxml_5etree__Validator(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__Validator *p = (struct __pyx_obj_4lxml_5etree__Validator *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->_error_log) {
    e = (*v)(((PyObject *)p->_error_log), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__Validator(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__Validator *p = (struct __pyx_obj_4lxml_5etree__Validator *)o;
  Py_CLEAR(p->_error_log);
  return 0;
}

static PyObject *__pyx_getprop_4lxml_5etree_10_Validator_error_log(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_10_Validator_9error_log_1__get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree__Validator[] = {
  {"validate", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_10_Validator_3validate, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_10_Validator_2validate},
  {"assertValid", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_10_Validator_5assertValid, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_10_Validator_4assertValid},
  {"assert_", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_10_Validator_7assert_, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_10_Validator_6assert_},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__Validator[] = {
  {"error_log", __pyx_getprop_4lxml_5etree_10_Validator_error_log, 0, PyDoc_STR("The log of validation errors and warnings."), 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__Validator_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__Validator},
  {Py_tp_doc, (void *)PyDoc_STR("Base class for XML validators.")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__Validator},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__Validator},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__Validator},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree__Validator},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__Validator},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__Validator_spec = {
  "lxml.etree._Validator",
  sizeof(struct __pyx_obj_4lxml_5etree__Validator),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__Validator_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__Validator = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_Validator", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__Validator), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__Validator, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("Base class for XML validators."), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__Validator, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__Validator, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__Validator, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__Validator, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__Validator, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_DTDError_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_Error},
  {Py_tp_doc, (void *)PyDoc_STR("Base class for DTD errors.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_Error},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_Error},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_Error},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_DTDError_spec = {
  "lxml.etree.DTDError",
  sizeof(struct __pyx_obj_4lxml_5etree_DTDError),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_DTDError_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_DTDError = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""DTDError", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_DTDError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_Error, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("Base class for DTD errors.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_Error, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_Error, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_9LxmlError_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_Error, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_DTDParseError_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_Error},
  {Py_tp_doc, (void *)PyDoc_STR("Error while parsing a DTD.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_Error},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_Error},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_Error},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_DTDParseError_spec = {
  "lxml.etree.DTDParseError",
  sizeof(struct __pyx_obj_4lxml_5etree_DTDParseError),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_DTDParseError_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_DTDParseError = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""DTDParseError", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_DTDParseError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_Error, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("Error while parsing a DTD.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_Error, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_Error, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_9LxmlError_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_Error, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_DTDValidateError_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_Error},
  {Py_tp_doc, (void *)PyDoc_STR("Error while validating an XML document with a DTD.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_Error},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_Error},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_Error},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_DTDValidateError_spec = {
  "lxml.etree.DTDValidateError",
  sizeof(struct __pyx_obj_4lxml_5etree_DTDValidateError),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_DTDValidateError_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_DTDValidateError = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""DTDValidateError", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_DTDValidateError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_Error, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("Error while validating an XML document with a DTD.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_Error, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_Error, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_9LxmlError_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_Error, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4lxml_5etree__DTDElementContentDecl(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *p;
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4lxml_5etree__DTDElementContentDecl > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__DTDElementContentDecl, sizeof(struct __pyx_obj_4lxml_5etree__DTDElementContentDecl))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_4lxml_5etree__DTDElementContentDecl[--__pyx_mstate_global->__pyx_freecount_4lxml_5etree__DTDElementContentDecl];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_4lxml_5etree__DTDElementContentDecl));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *)o);
  p->_dtd = ((struct __pyx_obj_4lxml_5etree_DTD *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__DTDElementContentDecl(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *p = (struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_dtd);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4lxml_5etree__DTDElementContentDecl < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__DTDElementContentDecl, sizeof(struct __pyx_obj_4lxml_5etree__DTDElementContentDecl))))
  {
    __pyx_mstate_global->__pyx_freelist_4lxml_5etree__DTDElementContentDecl[__pyx_mstate_global->__pyx_freecount_4lxml_5etree__DTDElementContentDecl++] = ((struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_4lxml_5etree__DTDElementContentDecl(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *p = (struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->_dtd) {
    e = (*v)(((PyObject *)p->_dtd), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__DTDElementContentDecl(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *p = (struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *)o;
  Py_CLEAR(p->_dtd);
  return 0;
}

static PyObject *__pyx_getprop_4lxml_5etree_22_DTDElementContentDecl_name(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_22_DTDElementContentDecl_4name_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_22_DTDElementContentDecl_type(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_22_DTDElementContentDecl_4type_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_22_DTDElementContentDecl_occur(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_22_DTDElementContentDecl_5occur_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_22_DTDElementContentDecl_left(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_22_DTDElementContentDecl_4left_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_22_DTDElementContentDecl_right(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_22_DTDElementContentDecl_5right_1__get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree__DTDElementContentDecl[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__DTDElementContentDecl[] = {
  {"name", __pyx_getprop_4lxml_5etree_22_DTDElementContentDecl_name, 0, 0, 0},
  {"type", __pyx_getprop_4lxml_5etree_22_DTDElementContentDecl_type, 0, 0, 0},
  {"occur", __pyx_getprop_4lxml_5etree_22_DTDElementContentDecl_occur, 0, 0, 0},
  {"left", __pyx_getprop_4lxml_5etree_22_DTDElementContentDecl_left, 0, 0, 0},
  {"right", __pyx_getprop_4lxml_5etree_22_DTDElementContentDecl_right, 0, 0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__DTDElementContentDecl_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__DTDElementContentDecl},
  {Py_tp_repr, (void *)__pyx_pw_4lxml_5etree_22_DTDElementContentDecl_1__repr__},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__DTDElementContentDecl},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__DTDElementContentDecl},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__DTDElementContentDecl},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree__DTDElementContentDecl},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__DTDElementContentDecl},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__DTDElementContentDecl_spec = {
  "lxml.etree._DTDElementContentDecl",
  sizeof(struct __pyx_obj_4lxml_5etree__DTDElementContentDecl),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__DTDElementContentDecl_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__DTDElementContentDecl = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_DTDElementContentDecl", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__DTDElementContentDecl), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__DTDElementContentDecl, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  __pyx_pw_4lxml_5etree_22_DTDElementContentDecl_1__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__DTDElementContentDecl, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__DTDElementContentDecl, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__DTDElementContentDecl, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__DTDElementContentDecl, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__DTDElementContentDecl, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4lxml_5etree__DTDAttributeDecl(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *p;
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4lxml_5etree__DTDAttributeDecl > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__DTDAttributeDecl, sizeof(struct __pyx_obj_4lxml_5etree__DTDAttributeDecl))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_4lxml_5etree__DTDAttributeDecl[--__pyx_mstate_global->__pyx_freecount_4lxml_5etree__DTDAttributeDecl];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_4lxml_5etree__DTDAttributeDecl));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *)o);
  p->_dtd = ((struct __pyx_obj_4lxml_5etree_DTD *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__DTDAttributeDecl(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *p = (struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_dtd);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4lxml_5etree__DTDAttributeDecl < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__DTDAttributeDecl, sizeof(struct __pyx_obj_4lxml_5etree__DTDAttributeDecl))))
  {
    __pyx_mstate_global->__pyx_freelist_4lxml_5etree__DTDAttributeDecl[__pyx_mstate_global->__pyx_freecount_4lxml_5etree__DTDAttributeDecl++] = ((struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_4lxml_5etree__DTDAttributeDecl(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *p = (struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->_dtd) {
    e = (*v)(((PyObject *)p->_dtd), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__DTDAttributeDecl(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *p = (struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *)o;
  Py_CLEAR(p->_dtd);
  return 0;
}

static PyObject *__pyx_getprop_4lxml_5etree_17_DTDAttributeDecl_name(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_17_DTDAttributeDecl_4name_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_17_DTDAttributeDecl_elemname(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_17_DTDAttributeDecl_8elemname_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_17_DTDAttributeDecl_prefix(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_17_DTDAttributeDecl_6prefix_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_17_DTDAttributeDecl_type(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_17_DTDAttributeDecl_4type_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_17_DTDAttributeDecl_default(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_17_DTDAttributeDecl_7default_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_17_DTDAttributeDecl_default_value(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_17_DTDAttributeDecl_13default_value_1__get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree__DTDAttributeDecl[] = {
  {"itervalues", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_17_DTDAttributeDecl_3itervalues, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"values", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_17_DTDAttributeDecl_6values, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__DTDAttributeDecl[] = {
  {"name", __pyx_getprop_4lxml_5etree_17_DTDAttributeDecl_name, 0, 0, 0},
  {"elemname", __pyx_getprop_4lxml_5etree_17_DTDAttributeDecl_elemname, 0, 0, 0},
  {"prefix", __pyx_getprop_4lxml_5etree_17_DTDAttributeDecl_prefix, 0, 0, 0},
  {"type", __pyx_getprop_4lxml_5etree_17_DTDAttributeDecl_type, 0, 0, 0},
  {"default", __pyx_getprop_4lxml_5etree_17_DTDAttributeDecl_default, 0, 0, 0},
  {"default_value", __pyx_getprop_4lxml_5etree_17_DTDAttributeDecl_default_value, 0, 0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__DTDAttributeDecl_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__DTDAttributeDecl},
  {Py_tp_repr, (void *)__pyx_pw_4lxml_5etree_17_DTDAttributeDecl_1__repr__},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__DTDAttributeDecl},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__DTDAttributeDecl},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__DTDAttributeDecl},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree__DTDAttributeDecl},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__DTDAttributeDecl},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__DTDAttributeDecl_spec = {
  "lxml.etree._DTDAttributeDecl",
  sizeof(struct __pyx_obj_4lxml_5etree__DTDAttributeDecl),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__DTDAttributeDecl_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__DTDAttributeDecl = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_DTDAttributeDecl", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__DTDAttributeDecl), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__DTDAttributeDecl, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  __pyx_pw_4lxml_5etree_17_DTDAttributeDecl_1__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__DTDAttributeDecl, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__DTDAttributeDecl, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__DTDAttributeDecl, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__DTDAttributeDecl, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__DTDAttributeDecl, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4lxml_5etree__DTDElementDecl(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree__DTDElementDecl *p;
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4lxml_5etree__DTDElementDecl > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__DTDElementDecl, sizeof(struct __pyx_obj_4lxml_5etree__DTDElementDecl))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_4lxml_5etree__DTDElementDecl[--__pyx_mstate_global->__pyx_freecount_4lxml_5etree__DTDElementDecl];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_4lxml_5etree__DTDElementDecl));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_4lxml_5etree__DTDElementDecl *)o);
  p->_dtd = ((struct __pyx_obj_4lxml_5etree_DTD *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__DTDElementDecl(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__DTDElementDecl *p = (struct __pyx_obj_4lxml_5etree__DTDElementDecl *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_dtd);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4lxml_5etree__DTDElementDecl < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__DTDElementDecl, sizeof(struct __pyx_obj_4lxml_5etree__DTDElementDecl))))
  {
    __pyx_mstate_global->__pyx_freelist_4lxml_5etree__DTDElementDecl[__pyx_mstate_global->__pyx_freecount_4lxml_5etree__DTDElementDecl++] = ((struct __pyx_obj_4lxml_5etree__DTDElementDecl *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_4lxml_5etree__DTDElementDecl(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__DTDElementDecl *p = (struct __pyx_obj_4lxml_5etree__DTDElementDecl *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->_dtd) {
    e = (*v)(((PyObject *)p->_dtd), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__DTDElementDecl(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__DTDElementDecl *p = (struct __pyx_obj_4lxml_5etree__DTDElementDecl *)o;
  Py_CLEAR(p->_dtd);
  return 0;
}

static PyObject *__pyx_getprop_4lxml_5etree_15_DTDElementDecl_name(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_15_DTDElementDecl_4name_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_15_DTDElementDecl_prefix(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_15_DTDElementDecl_6prefix_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_15_DTDElementDecl_type(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_15_DTDElementDecl_4type_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_15_DTDElementDecl_content(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_15_DTDElementDecl_7content_1__get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree__DTDElementDecl[] = {
  {"iterattributes", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_15_DTDElementDecl_3iterattributes, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"attributes", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_15_DTDElementDecl_6attributes, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__DTDElementDecl[] = {
  {"name", __pyx_getprop_4lxml_5etree_15_DTDElementDecl_name, 0, 0, 0},
  {"prefix", __pyx_getprop_4lxml_5etree_15_DTDElementDecl_prefix, 0, 0, 0},
  {"type", __pyx_getprop_4lxml_5etree_15_DTDElementDecl_type, 0, 0, 0},
  {"content", __pyx_getprop_4lxml_5etree_15_DTDElementDecl_content, 0, 0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__DTDElementDecl_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__DTDElementDecl},
  {Py_tp_repr, (void *)__pyx_pw_4lxml_5etree_15_DTDElementDecl_1__repr__},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__DTDElementDecl},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__DTDElementDecl},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__DTDElementDecl},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree__DTDElementDecl},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__DTDElementDecl},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__DTDElementDecl_spec = {
  "lxml.etree._DTDElementDecl",
  sizeof(struct __pyx_obj_4lxml_5etree__DTDElementDecl),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__DTDElementDecl_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__DTDElementDecl = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_DTDElementDecl", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__DTDElementDecl), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__DTDElementDecl, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  __pyx_pw_4lxml_5etree_15_DTDElementDecl_1__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__DTDElementDecl, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__DTDElementDecl, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__DTDElementDecl, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__DTDElementDecl, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__DTDElementDecl, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4lxml_5etree__DTDEntityDecl(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree__DTDEntityDecl *p;
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4lxml_5etree__DTDEntityDecl > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_4lxml_5etree__DTDEntityDecl, sizeof(struct __pyx_obj_4lxml_5etree__DTDEntityDecl))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_4lxml_5etree__DTDEntityDecl[--__pyx_mstate_global->__pyx_freecount_4lxml_5etree__DTDEntityDecl];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_4lxml_5etree__DTDEntityDecl));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_4lxml_5etree__DTDEntityDecl *)o);
  p->_dtd = ((struct __pyx_obj_4lxml_5etree_DTD *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__DTDEntityDecl(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__DTDEntityDecl *p = (struct __pyx_obj_4lxml_5etree__DTDEntityDecl *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_dtd);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4lxml_5etree__DTDEntityDecl < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_4lxml_5etree__DTDEntityDecl, sizeof(struct __pyx_obj_4lxml_5etree__DTDEntityDecl))))
  {
    __pyx_mstate_global->__pyx_freelist_4lxml_5etree__DTDEntityDecl[__pyx_mstate_global->__pyx_freecount_4lxml_5etree__DTDEntityDecl++] = ((struct __pyx_obj_4lxml_5etree__DTDEntityDecl *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_4lxml_5etree__DTDEntityDecl(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__DTDEntityDecl *p = (struct __pyx_obj_4lxml_5etree__DTDEntityDecl *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->_dtd) {
    e = (*v)(((PyObject *)p->_dtd), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__DTDEntityDecl(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__DTDEntityDecl *p = (struct __pyx_obj_4lxml_5etree__DTDEntityDecl *)o;
  Py_CLEAR(p->_dtd);
  return 0;
}

static PyObject *__pyx_getprop_4lxml_5etree_14_DTDEntityDecl_name(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_14_DTDEntityDecl_4name_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_14_DTDEntityDecl_orig(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_14_DTDEntityDecl_4orig_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_14_DTDEntityDecl_content(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_14_DTDEntityDecl_7content_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_14_DTDEntityDecl_system_url(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_14_DTDEntityDecl_10system_url_1__get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree__DTDEntityDecl[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__DTDEntityDecl[] = {
  {"name", __pyx_getprop_4lxml_5etree_14_DTDEntityDecl_name, 0, 0, 0},
  {"orig", __pyx_getprop_4lxml_5etree_14_DTDEntityDecl_orig, 0, 0, 0},
  {"content", __pyx_getprop_4lxml_5etree_14_DTDEntityDecl_content, 0, 0, 0},
  {"system_url", __pyx_getprop_4lxml_5etree_14_DTDEntityDecl_system_url, 0, 0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__DTDEntityDecl_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__DTDEntityDecl},
  {Py_tp_repr, (void *)__pyx_pw_4lxml_5etree_14_DTDEntityDecl_1__repr__},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__DTDEntityDecl},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__DTDEntityDecl},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__DTDEntityDecl},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree__DTDEntityDecl},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__DTDEntityDecl},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__DTDEntityDecl_spec = {
  "lxml.etree._DTDEntityDecl",
  sizeof(struct __pyx_obj_4lxml_5etree__DTDEntityDecl),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__DTDEntityDecl_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__DTDEntityDecl = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_DTDEntityDecl", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__DTDEntityDecl), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__DTDEntityDecl, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  __pyx_pw_4lxml_5etree_14_DTDEntityDecl_1__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__DTDEntityDecl, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__DTDEntityDecl, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__DTDEntityDecl, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__DTDEntityDecl, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__DTDEntityDecl, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree_DTD __pyx_vtable_4lxml_5etree_DTD;

static PyObject *__pyx_tp_new_4lxml_5etree_DTD(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_DTD *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__Validator(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_DTD *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__Validator*)__pyx_vtabptr_4lxml_5etree_DTD;
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_DTD(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree_DTD) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_4lxml_5etree_3DTD_13__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_4lxml_5etree__Validator(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_3DTD_name(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_3DTD_4name_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_3DTD_external_id(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_3DTD_11external_id_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_3DTD_system_url(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_3DTD_10system_url_1__get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree_DTD[] = {
  {"iterelements", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_3DTD_3iterelements, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"elements", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_3DTD_6elements, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"iterentities", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_3DTD_8iterentities, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"entities", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_3DTD_11entities, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree_DTD[] = {
  {"name", __pyx_getprop_4lxml_5etree_3DTD_name, 0, 0, 0},
  {"external_id", __pyx_getprop_4lxml_5etree_3DTD_external_id, 0, 0, 0},
  {"system_url", __pyx_getprop_4lxml_5etree_3DTD_system_url, 0, 0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_DTD_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_DTD},
  {Py_tp_call, (void *)__pyx_pw_4lxml_5etree_3DTD_15__call__},
  {Py_tp_doc, (void *)PyDoc_STR("DTD(self, file=None, external_id=None)\n    A DTD validator.\n\n    Can load from filesystem directly given a filename or file-like object.\n    Alternatively, pass the keyword parameter ``external_id`` to load from a\n    catalog.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__Validator},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__Validator},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_DTD},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree_DTD},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_3DTD_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_DTD},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_DTD_spec = {
  "lxml.etree.DTD",
  sizeof(struct __pyx_obj_4lxml_5etree_DTD),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_DTD_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_DTD = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""DTD", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_DTD), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_DTD, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  __pyx_pw_4lxml_5etree_3DTD_15__call__, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("DTD(self, file=None, external_id=None)\n    A DTD validator.\n\n    Can load from filesystem directly given a filename or file-like object.\n    Alternatively, pass the keyword parameter ``external_id`` to load from a\n    catalog.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__Validator, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__Validator, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_DTD, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree_DTD, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_4lxml_5etree_3DTD_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_DTD, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_RelaxNGError_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_Error},
  {Py_tp_doc, (void *)PyDoc_STR("Base class for RelaxNG errors.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_Error},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_Error},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_Error},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_RelaxNGError_spec = {
  "lxml.etree.RelaxNGError",
  sizeof(struct __pyx_obj_4lxml_5etree_RelaxNGError),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_RelaxNGError_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_RelaxNGError = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""RelaxNGError", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_RelaxNGError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_Error, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("Base class for RelaxNG errors.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_Error, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_Error, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_9LxmlError_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_Error, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_RelaxNGParseError_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_Error},
  {Py_tp_doc, (void *)PyDoc_STR("Error while parsing an XML document as RelaxNG.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_Error},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_Error},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_Error},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_RelaxNGParseError_spec = {
  "lxml.etree.RelaxNGParseError",
  sizeof(struct __pyx_obj_4lxml_5etree_RelaxNGParseError),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_RelaxNGParseError_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_RelaxNGParseError = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""RelaxNGParseError", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_RelaxNGParseError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_Error, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("Error while parsing an XML document as RelaxNG.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_Error, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_Error, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_9LxmlError_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_Error, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_RelaxNGValidateError_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_Error},
  {Py_tp_doc, (void *)PyDoc_STR("Error while validating an XML document with a RelaxNG schema.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_Error},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_Error},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_Error},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_RelaxNGValidateError_spec = {
  "lxml.etree.RelaxNGValidateError",
  sizeof(struct __pyx_obj_4lxml_5etree_RelaxNGValidateError),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_RelaxNGValidateError_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_RelaxNGValidateError = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""RelaxNGValidateError", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_RelaxNGValidateError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_Error, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("Error while validating an XML document with a RelaxNG schema.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_Error, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_Error, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_9LxmlError_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_Error, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree_RelaxNG __pyx_vtable_4lxml_5etree_RelaxNG;

static PyObject *__pyx_tp_new_4lxml_5etree_RelaxNG(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_RelaxNG *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__Validator(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_RelaxNG *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__Validator*)__pyx_vtabptr_4lxml_5etree_RelaxNG;
  if (unlikely(__pyx_pw_4lxml_5etree_7RelaxNG_1__cinit__(o, __pyx_mstate_global->__pyx_empty_tuple, NULL) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_4lxml_5etree_RelaxNG(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree_RelaxNG) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_4lxml_5etree_7RelaxNG_5__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_4lxml_5etree__Validator(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree_RelaxNG[] = {
  {"from_rnc_string", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7RelaxNG_9from_rnc_string, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_7RelaxNG_8from_rnc_string},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_RelaxNG_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_RelaxNG},
  {Py_tp_call, (void *)__pyx_pw_4lxml_5etree_7RelaxNG_7__call__},
  {Py_tp_doc, (void *)PyDoc_STR("RelaxNG(self, etree=None, file=None)\n    Turn a document into a Relax NG validator.\n\n    Either pass a schema as Element or ElementTree, or pass a file or\n    filename through the ``file`` keyword argument.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__Validator},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__Validator},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_RelaxNG},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_7RelaxNG_3__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_RelaxNG},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_RelaxNG_spec = {
  "lxml.etree.RelaxNG",
  sizeof(struct __pyx_obj_4lxml_5etree_RelaxNG),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_RelaxNG_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_RelaxNG = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""RelaxNG", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_RelaxNG), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_RelaxNG, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  __pyx_pw_4lxml_5etree_7RelaxNG_7__call__, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("RelaxNG(self, etree=None, file=None)\n    Turn a document into a Relax NG validator.\n\n    Either pass a schema as Element or ElementTree, or pass a file or\n    filename through the ``file`` keyword argument.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__Validator, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__Validator, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_RelaxNG, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_4lxml_5etree_7RelaxNG_3__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_RelaxNG, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_XMLSchemaError_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_Error},
  {Py_tp_doc, (void *)PyDoc_STR("Base class of all XML Schema errors\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_Error},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_Error},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_Error},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_XMLSchemaError_spec = {
  "lxml.etree.XMLSchemaError",
  sizeof(struct __pyx_obj_4lxml_5etree_XMLSchemaError),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_XMLSchemaError_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_XMLSchemaError = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""XMLSchemaError", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_XMLSchemaError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_Error, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("Base class of all XML Schema errors\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_Error, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_Error, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_9LxmlError_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_Error, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_XMLSchemaParseError_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_Error},
  {Py_tp_doc, (void *)PyDoc_STR("Error while parsing an XML document as XML Schema.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_Error},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_Error},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_Error},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_XMLSchemaParseError_spec = {
  "lxml.etree.XMLSchemaParseError",
  sizeof(struct __pyx_obj_4lxml_5etree_XMLSchemaParseError),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_XMLSchemaParseError_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_XMLSchemaParseError = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""XMLSchemaParseError", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_XMLSchemaParseError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_Error, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("Error while parsing an XML document as XML Schema.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_Error, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_Error, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_9LxmlError_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_Error, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_XMLSchemaValidateError_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_Error},
  {Py_tp_doc, (void *)PyDoc_STR("Error while validating an XML document with an XML Schema.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_Error},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_Error},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_Error},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_XMLSchemaValidateError_spec = {
  "lxml.etree.XMLSchemaValidateError",
  sizeof(struct __pyx_obj_4lxml_5etree_XMLSchemaValidateError),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_XMLSchemaValidateError_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_XMLSchemaValidateError = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""XMLSchemaValidateError", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_XMLSchemaValidateError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_Error, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("Error while validating an XML document with an XML Schema.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_Error, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_Error, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_9LxmlError_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_Error, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree_XMLSchema __pyx_vtable_4lxml_5etree_XMLSchema;

static PyObject *__pyx_tp_new_4lxml_5etree_XMLSchema(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_XMLSchema *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__Validator(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_XMLSchema *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__Validator*)__pyx_vtabptr_4lxml_5etree_XMLSchema;
  p->_doc = ((struct LxmlDocument *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_9XMLSchema_1__cinit__(o, __pyx_mstate_global->__pyx_empty_tuple, NULL) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_4lxml_5etree_XMLSchema(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_XMLSchema *p = (struct __pyx_obj_4lxml_5etree_XMLSchema *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree_XMLSchema) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_4lxml_5etree_9XMLSchema_5__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->_doc);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_4lxml_5etree__Validator(o);
}

static int __pyx_tp_traverse_4lxml_5etree_XMLSchema(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree_XMLSchema *p = (struct __pyx_obj_4lxml_5etree_XMLSchema *)o;
  e = __pyx_tp_traverse_4lxml_5etree__Validator(o, v, a); if (e) return e;
  if (p->_doc) {
    e = (*v)(((PyObject *)p->_doc), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree_XMLSchema(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_XMLSchema *p = (struct __pyx_obj_4lxml_5etree_XMLSchema *)o;
  __pyx_tp_clear_4lxml_5etree__Validator(o);
  Py_CLEAR(p->_doc);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree_XMLSchema[] = {
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_XMLSchema_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_XMLSchema},
  {Py_tp_call, (void *)__pyx_pw_4lxml_5etree_9XMLSchema_7__call__},
  {Py_tp_doc, (void *)PyDoc_STR("XMLSchema(self, etree=None, file=None)\n    Turn a document into an XML Schema validator.\n\n    Either pass a schema as Element or ElementTree, or pass a file or\n    filename through the ``file`` keyword argument.\n\n    Passing the ``attribute_defaults`` boolean option will make the\n    schema insert default/fixed attributes into validated documents.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_XMLSchema},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_XMLSchema},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_XMLSchema},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_9XMLSchema_3__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_XMLSchema},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_XMLSchema_spec = {
  "lxml.etree.XMLSchema",
  sizeof(struct __pyx_obj_4lxml_5etree_XMLSchema),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_XMLSchema_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_XMLSchema = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""XMLSchema", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_XMLSchema), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_XMLSchema, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  __pyx_pw_4lxml_5etree_9XMLSchema_7__call__, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("XMLSchema(self, etree=None, file=None)\n    Turn a document into an XML Schema validator.\n\n    Either pass a schema as Element or ElementTree, or pass a file or\n    filename through the ``file`` keyword argument.\n\n    Passing the ``attribute_defaults`` boolean option will make the\n    schema insert default/fixed attributes into validated documents.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_XMLSchema, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_XMLSchema, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_XMLSchema, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_4lxml_5etree_9XMLSchema_3__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_XMLSchema, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__ParserSchemaValidationContext __pyx_vtable_4lxml_5etree__ParserSchemaValidationContext;

static PyObject *__pyx_tp_new_4lxml_5etree__ParserSchemaValidationContext(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 1);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__ParserSchemaValidationContext;
  p->_schema = ((struct __pyx_obj_4lxml_5etree_XMLSchema *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_30_ParserSchemaValidationContext_1__cinit__(o, __pyx_mstate_global->__pyx_empty_tuple, NULL) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_4lxml_5etree__ParserSchemaValidationContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *p = (struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *)o;
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_4lxml_5etree_30_ParserSchemaValidationContext_3__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->_schema);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_4lxml_5etree__ParserSchemaValidationContext(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *p = (struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->_schema) {
    e = (*v)(((PyObject *)p->_schema), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__ParserSchemaValidationContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *p = (struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *)o;
  Py_CLEAR(p->_schema);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__ParserSchemaValidationContext[] = {
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__ParserSchemaValidationContext_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__ParserSchemaValidationContext},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__ParserSchemaValidationContext},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__ParserSchemaValidationContext},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__ParserSchemaValidationContext},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__ParserSchemaValidationContext},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__ParserSchemaValidationContext_spec = {
  "lxml.etree._ParserSchemaValidationContext",
  sizeof(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__ParserSchemaValidationContext_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__ParserSchemaValidationContext = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_ParserSchemaValidationContext", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ParserSchemaValidationContext, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ParserSchemaValidationContext, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ParserSchemaValidationContext, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__ParserSchemaValidationContext, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__ParserSchemaValidationContext, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_SchematronError_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_Error},
  {Py_tp_doc, (void *)PyDoc_STR("Base class of all Schematron errors.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_Error},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_Error},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_Error},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_SchematronError_spec = {
  "lxml.etree.SchematronError",
  sizeof(struct __pyx_obj_4lxml_5etree_SchematronError),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_SchematronError_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_SchematronError = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""SchematronError", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_SchematronError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_Error, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("Base class of all Schematron errors.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_Error, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_Error, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_9LxmlError_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_Error, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_SchematronParseError_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_Error},
  {Py_tp_doc, (void *)PyDoc_STR("Error while parsing an XML document as Schematron schema.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_Error},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_Error},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_Error},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_SchematronParseError_spec = {
  "lxml.etree.SchematronParseError",
  sizeof(struct __pyx_obj_4lxml_5etree_SchematronParseError),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_SchematronParseError_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_SchematronParseError = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""SchematronParseError", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_SchematronParseError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_Error, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("Error while parsing an XML document as Schematron schema.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_Error, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_Error, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_9LxmlError_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_Error, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_SchematronValidateError_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_Error},
  {Py_tp_doc, (void *)PyDoc_STR("Error while validating an XML document with a Schematron schema.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_Error},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_Error},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_Error},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_SchematronValidateError_spec = {
  "lxml.etree.SchematronValidateError",
  sizeof(struct __pyx_obj_4lxml_5etree_SchematronValidateError),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_SchematronValidateError_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_SchematronValidateError = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""SchematronValidateError", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_SchematronValidateError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_Error, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("Error while validating an XML document with a Schematron schema.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_Error, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_Error, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_9LxmlError_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_Error, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree_Schematron __pyx_vtable_4lxml_5etree_Schematron;

static PyObject *__pyx_tp_new_4lxml_5etree_Schematron(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_Schematron *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__Validator(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_Schematron *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__Validator*)__pyx_vtabptr_4lxml_5etree_Schematron;
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_Schematron(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree_Schematron) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_4lxml_5etree_10Schematron_3__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_4lxml_5etree__Validator(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree_Schematron[] = {
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_Schematron_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_Schematron},
  {Py_tp_call, (void *)__pyx_pw_4lxml_5etree_10Schematron_5__call__},
  {Py_tp_doc, (void *)PyDoc_STR("Schematron(self, etree=None, file=None)\n    A Schematron validator.\n\n    Pass a root Element or an ElementTree to turn it into a validator.\n    Alternatively, pass a filename as keyword argument 'file' to parse from\n    the file system.\n\n    Schematron is a less well known, but very powerful schema language.  The main\n    idea is to use the capabilities of XPath to put restrictions on the structure\n    and the content of XML documents.  Here is a simple example::\n\n      >>> schematron = Schematron(XML('''\n      ... <schema xmlns=\"http://www.ascc.net/xml/schematron\" >\n      ...   <pattern name=\"id is the only permitted attribute name\">\n      ...     <rule context=\"*\">\n      ...       <report test=\"@*[not(name()='id')]\">Attribute\n      ...         <name path=\"@*[not(name()='id')]\"/> is forbidden<name/>\n      ...       </report>\n      ...     </rule>\n      ...   </pattern>\n      ... </schema>\n      ... '''))\n\n      >>> xml = XML('''\n      ... <AAA name=\"aaa\">\n      ...   <BBB id=\"bbb\"/>\n      ...   <CCC color=\"ccc\"/>\n      ... </AAA>\n      ... ''')\n\n      >>> schematron.validate(xml)\n      0\n\n      >>> xml = XML('''\n      ... <AAA id=\"aaa\">\n      ...   <BBB id=\"bbb\"/>\n      ...   <CCC/>\n      ... </AAA>\n      ... ''')\n\n      >>> schematron.validate(xml)\n      1\n\n    Schematron was added to libxml2 in version 2.6.21.  Before version 2.6.32,\n    however, Schematron lacked support for error reporting other than to stderr.\n    This version is therefore required to retrieve validation warnings and\n    errors in lxml.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__Validator},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__Validator},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_Schematron},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_10Schematron_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_Schematron},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_Schematron_spec = {
  "lxml.etree.Schematron",
  sizeof(struct __pyx_obj_4lxml_5etree_Schematron),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_Schematron_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_Schematron = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""Schematron", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_Schematron), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_Schematron, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  __pyx_pw_4lxml_5etree_10Schematron_5__call__, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("Schematron(self, etree=None, file=None)\n    A Schematron validator.\n\n    Pass a root Element or an ElementTree to turn it into a validator.\n    Alternatively, pass a filename as keyword argument 'file' to parse from\n    the file system.\n\n    Schematron is a less well known, but very powerful schema language.  The main\n    idea is to use the capabilities of XPath to put restrictions on the structure\n    and the content of XML documents.  Here is a simple example::\n\n      >>> schematron = Schematron(XML('''\n      ... <schema xmlns=\"http://www.ascc.net/xml/schematron\" >\n      ...   <pattern name=\"id is the only permitted attribute name\">\n      ...     <rule context=\"*\">\n      ...       <report test=\"@*[not(name()='id')]\">Attribute\n      ...         <name path=\"@*[not(name()='id')]\"/> is forbidden<name/>\n      ...       </report>\n      ...     </rule>\n      ...   </pattern>\n      ... </schema>\n      ... '''))\n\n      >>> xml = XML('''\n      ... <AAA name=\"aaa\">\n      ...   <BBB id=\"bbb\"/>\n      ...   <CCC color=\"ccc\"/>\n      ... </AAA>\n      ... ''')\n\n      >>> schematron.validate(xml)\n      0\n\n      >>> xml = XML('''\n      ... <AAA id=\"aaa\">\n      ...   <BBB id=\"bbb\"/>\n      ...   <CCC/>\n      ... </AAA>\n      ... ''')\n\n      >>> schematron.validate(xml)\n      1\n\n    Schematron was added to libxml2 in version 2.6.21.  Before version 2.6.32,\n    however, Schematron lacked support for error reporting other than to stderr.\n    This version is therefore required to retrieve validation warnings and\n    errors in lxml.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__Validator, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__Validator, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_Schematron, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_4lxml_5etree_10Schematron_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_Schematron, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4lxml_5etree__MemDebug(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 1);
  if (unlikely(!o)) return 0;
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__MemDebug(PyObject *o) {
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static PyMethodDef __pyx_methods_4lxml_5etree__MemDebug[] = {
  {"bytes_used", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_9_MemDebug_1bytes_used, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_9_MemDebug_bytes_used},
  {"blocks_used", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_9_MemDebug_3blocks_used, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_9_MemDebug_2blocks_used},
  {"dict_size", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_9_MemDebug_5dict_size, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_9_MemDebug_4dict_size},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__MemDebug_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__MemDebug},
  {Py_tp_doc, (void *)PyDoc_STR("Debugging support for the memory allocation in libxml2.\n    ")},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__MemDebug},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__MemDebug},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__MemDebug_spec = {
  "lxml.etree._MemDebug",
  sizeof(struct __pyx_obj_4lxml_5etree__MemDebug),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER,
  __pyx_type_4lxml_5etree__MemDebug_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__MemDebug = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_MemDebug", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__MemDebug), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__MemDebug, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
  PyDoc_STR("Debugging support for the memory allocation in libxml2.\n    "), /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__MemDebug, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__MemDebug, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct___open_utf8_file(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct___open_utf8_file > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct___open_utf8_file, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct___open_utf8_file))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_4lxml_5etree___pyx_scope_struct___open_utf8_file[--__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct___open_utf8_file];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct___open_utf8_file));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct___open_utf8_file(PyObject *o) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct___open_utf8_file *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct___open_utf8_file *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct___open_utf8_file) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_compression);
  Py_CLEAR(p->__pyx_v_f);
  Py_CLEAR(p->__pyx_v_file);
  Py_CLEAR(p->__pyx_v_zf);
  Py_CLEAR(p->__pyx_t_0);
  Py_CLEAR(p->__pyx_t_1);
  Py_CLEAR(p->__pyx_t_2);
  Py_CLEAR(p->__pyx_t_3);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct___open_utf8_file < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct___open_utf8_file, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct___open_utf8_file))))
  {
    __pyx_mstate_global->__pyx_freelist_4lxml_5etree___pyx_scope_struct___open_utf8_file[__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct___open_utf8_file++] = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct___open_utf8_file *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct___open_utf8_file(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct___open_utf8_file *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct___open_utf8_file *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_compression) {
    e = (*v)(p->__pyx_v_compression, a); if (e) return e;
  }
  if (p->__pyx_v_f) {
    e = (*v)(p->__pyx_v_f, a); if (e) return e;
  }
  if (p->__pyx_v_file) {
    e = (*v)(p->__pyx_v_file, a); if (e) return e;
  }
  if (p->__pyx_v_zf) {
    e = (*v)(p->__pyx_v_zf, a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  if (p->__pyx_t_1) {
    e = (*v)(p->__pyx_t_1, a); if (e) return e;
  }
  if (p->__pyx_t_2) {
    e = (*v)(p->__pyx_t_2, a); if (e) return e;
  }
  if (p->__pyx_t_3) {
    e = (*v)(p->__pyx_t_3, a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree___pyx_scope_struct___open_utf8_file_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct___open_utf8_file},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree___pyx_scope_struct___open_utf8_file},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct___open_utf8_file},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree___pyx_scope_struct___open_utf8_file_spec = {
  "lxml.etree.__pyx_scope_struct___open_utf8_file",
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct___open_utf8_file),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree___pyx_scope_struct___open_utf8_file_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree___pyx_scope_struct___open_utf8_file = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""__pyx_scope_struct___open_utf8_file", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct___open_utf8_file), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct___open_utf8_file, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct___open_utf8_file, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree___pyx_scope_struct___open_utf8_file, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_1__iter_namespaces(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_1__iter_namespaces > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_1__iter_namespaces, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_1__iter_namespaces))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_4lxml_5etree___pyx_scope_struct_1__iter_namespaces[--__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_1__iter_namespaces];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_1__iter_namespaces));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_1__iter_namespaces(PyObject *o) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_1__iter_namespaces *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_1__iter_namespaces *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_1__iter_namespaces) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_namespaces);
  Py_CLEAR(p->__pyx_v_ns_stack);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_t_0);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_1__iter_namespaces < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_1__iter_namespaces, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_1__iter_namespaces))))
  {
    __pyx_mstate_global->__pyx_freelist_4lxml_5etree___pyx_scope_struct_1__iter_namespaces[__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_1__iter_namespaces++] = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_1__iter_namespaces *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_1__iter_namespaces(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_1__iter_namespaces *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_1__iter_namespaces *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_namespaces) {
    e = (*v)(p->__pyx_v_namespaces, a); if (e) return e;
  }
  if (p->__pyx_v_ns_stack) {
    e = (*v)(p->__pyx_v_ns_stack, a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree___pyx_scope_struct_1__iter_namespaces_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_1__iter_namespaces},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_1__iter_namespaces},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_1__iter_namespaces},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree___pyx_scope_struct_1__iter_namespaces_spec = {
  "lxml.etree.__pyx_scope_struct_1__iter_namespaces",
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_1__iter_namespaces),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree___pyx_scope_struct_1__iter_namespaces_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree___pyx_scope_struct_1__iter_namespaces = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""__pyx_scope_struct_1__iter_namespaces", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_1__iter_namespaces), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_1__iter_namespaces, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_1__iter_namespaces, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree___pyx_scope_struct_1__iter_namespaces, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_2___aenter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_2___aenter__ > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_2___aenter__, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_2___aenter__))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_4lxml_5etree___pyx_scope_struct_2___aenter__[--__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_2___aenter__];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_2___aenter__));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_2___aenter__(PyObject *o) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_2___aenter__ *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_2___aenter__ *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_2___aenter__) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_2___aenter__ < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_2___aenter__, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_2___aenter__))))
  {
    __pyx_mstate_global->__pyx_freelist_4lxml_5etree___pyx_scope_struct_2___aenter__[__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_2___aenter__++] = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_2___aenter__ *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_2___aenter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_2___aenter__ *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_2___aenter__ *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree___pyx_scope_struct_2___aenter___slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_2___aenter__},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_2___aenter__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_2___aenter__},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree___pyx_scope_struct_2___aenter___spec = {
  "lxml.etree.__pyx_scope_struct_2___aenter__",
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_2___aenter__),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree___pyx_scope_struct_2___aenter___slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree___pyx_scope_struct_2___aenter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""__pyx_scope_struct_2___aenter__", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_2___aenter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_2___aenter__, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_2___aenter__, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree___pyx_scope_struct_2___aenter__, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_3___aexit__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_3___aexit__ > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_3___aexit__, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_3___aexit__))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_4lxml_5etree___pyx_scope_struct_3___aexit__[--__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_3___aexit__];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_3___aexit__));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_3___aexit__(PyObject *o) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_3___aexit__ *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_3___aexit__ *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_3___aexit__) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_exc_tb);
  Py_CLEAR(p->__pyx_v_exc_type);
  Py_CLEAR(p->__pyx_v_exc_val);
  Py_CLEAR(p->__pyx_v_old_writer);
  Py_CLEAR(p->__pyx_v_raise_on_error);
  Py_CLEAR(p->__pyx_v_self);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_3___aexit__ < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_3___aexit__, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_3___aexit__))))
  {
    __pyx_mstate_global->__pyx_freelist_4lxml_5etree___pyx_scope_struct_3___aexit__[__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_3___aexit__++] = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_3___aexit__ *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_3___aexit__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_3___aexit__ *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_3___aexit__ *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_exc_tb) {
    e = (*v)(p->__pyx_v_exc_tb, a); if (e) return e;
  }
  if (p->__pyx_v_exc_type) {
    e = (*v)(p->__pyx_v_exc_type, a); if (e) return e;
  }
  if (p->__pyx_v_exc_val) {
    e = (*v)(p->__pyx_v_exc_val, a); if (e) return e;
  }
  if (p->__pyx_v_old_writer) {
    e = (*v)(((PyObject *)p->__pyx_v_old_writer), a); if (e) return e;
  }
  if (p->__pyx_v_raise_on_error) {
    e = (*v)(p->__pyx_v_raise_on_error, a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree___pyx_scope_struct_3___aexit___slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_3___aexit__},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_3___aexit__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_3___aexit__},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree___pyx_scope_struct_3___aexit___spec = {
  "lxml.etree.__pyx_scope_struct_3___aexit__",
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_3___aexit__),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree___pyx_scope_struct_3___aexit___slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree___pyx_scope_struct_3___aexit__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""__pyx_scope_struct_3___aexit__", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_3___aexit__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_3___aexit__, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_3___aexit__, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree___pyx_scope_struct_3___aexit__, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_4_flush(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_4_flush > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_4_flush, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_4_flush))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_4lxml_5etree___pyx_scope_struct_4_flush[--__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_4_flush];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_4_flush));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_4_flush(PyObject *o) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_4_flush *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_4_flush *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_4_flush) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_data);
  Py_CLEAR(p->__pyx_v_self);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_4_flush < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_4_flush, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_4_flush))))
  {
    __pyx_mstate_global->__pyx_freelist_4lxml_5etree___pyx_scope_struct_4_flush[__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_4_flush++] = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_4_flush *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_4_flush(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_4_flush *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_4_flush *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree___pyx_scope_struct_4_flush_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_4_flush},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_4_flush},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_4_flush},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree___pyx_scope_struct_4_flush_spec = {
  "lxml.etree.__pyx_scope_struct_4_flush",
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_4_flush),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree___pyx_scope_struct_4_flush_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree___pyx_scope_struct_4_flush = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""__pyx_scope_struct_4_flush", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_4_flush), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_4_flush, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_4_flush, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree___pyx_scope_struct_4_flush, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_5_write_declaration(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_5_write_declaration > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_5_write_declaration, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_5_write_declaration))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_4lxml_5etree___pyx_scope_struct_5_write_declaration[--__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_5_write_declaration];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_5_write_declaration));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_5_write_declaration(PyObject *o) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_5_write_declaration *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_5_write_declaration *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_5_write_declaration) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_data);
  Py_CLEAR(p->__pyx_v_doctype);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_v_standalone);
  Py_CLEAR(p->__pyx_v_version);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_5_write_declaration < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_5_write_declaration, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_5_write_declaration))))
  {
    __pyx_mstate_global->__pyx_freelist_4lxml_5etree___pyx_scope_struct_5_write_declaration[__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_5_write_declaration++] = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_5_write_declaration *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_5_write_declaration(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_5_write_declaration *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_5_write_declaration *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_doctype) {
    e = (*v)(p->__pyx_v_doctype, a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  if (p->__pyx_v_standalone) {
    e = (*v)(p->__pyx_v_standalone, a); if (e) return e;
  }
  if (p->__pyx_v_version) {
    e = (*v)(p->__pyx_v_version, a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree___pyx_scope_struct_5_write_declaration_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_5_write_declaration},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_5_write_declaration},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_5_write_declaration},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree___pyx_scope_struct_5_write_declaration_spec = {
  "lxml.etree.__pyx_scope_struct_5_write_declaration",
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_5_write_declaration),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree___pyx_scope_struct_5_write_declaration_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree___pyx_scope_struct_5_write_declaration = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""__pyx_scope_struct_5_write_declaration", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_5_write_declaration), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_5_write_declaration, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_5_write_declaration, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree___pyx_scope_struct_5_write_declaration, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_6_write_doctype(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_6_write_doctype > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_6_write_doctype, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_6_write_doctype))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_4lxml_5etree___pyx_scope_struct_6_write_doctype[--__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_6_write_doctype];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_6_write_doctype));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_6_write_doctype(PyObject *o) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_6_write_doctype *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_6_write_doctype *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_6_write_doctype) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_data);
  Py_CLEAR(p->__pyx_v_doctype);
  Py_CLEAR(p->__pyx_v_self);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_6_write_doctype < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_6_write_doctype, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_6_write_doctype))))
  {
    __pyx_mstate_global->__pyx_freelist_4lxml_5etree___pyx_scope_struct_6_write_doctype[__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_6_write_doctype++] = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_6_write_doctype *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_6_write_doctype(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_6_write_doctype *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_6_write_doctype *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_doctype) {
    e = (*v)(p->__pyx_v_doctype, a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree___pyx_scope_struct_6_write_doctype_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_6_write_doctype},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_6_write_doctype},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_6_write_doctype},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree___pyx_scope_struct_6_write_doctype_spec = {
  "lxml.etree.__pyx_scope_struct_6_write_doctype",
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_6_write_doctype),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree___pyx_scope_struct_6_write_doctype_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree___pyx_scope_struct_6_write_doctype = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""__pyx_scope_struct_6_write_doctype", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_6_write_doctype), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_6_write_doctype, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_6_write_doctype, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree___pyx_scope_struct_6_write_doctype, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_7_write(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_7_write > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_7_write, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_7_write))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_4lxml_5etree___pyx_scope_struct_7_write[--__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_7_write];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_7_write));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_7_write(PyObject *o) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_7_write *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_7_write *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_7_write) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_args);
  Py_CLEAR(p->__pyx_v_data);
  Py_CLEAR(p->__pyx_v_method);
  Py_CLEAR(p->__pyx_v_pretty_print);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_v_with_tail);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_7_write < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_7_write, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_7_write))))
  {
    __pyx_mstate_global->__pyx_freelist_4lxml_5etree___pyx_scope_struct_7_write[__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_7_write++] = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_7_write *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_7_write(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_7_write *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_7_write *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_args) {
    e = (*v)(p->__pyx_v_args, a); if (e) return e;
  }
  if (p->__pyx_v_method) {
    e = (*v)(p->__pyx_v_method, a); if (e) return e;
  }
  if (p->__pyx_v_pretty_print) {
    e = (*v)(p->__pyx_v_pretty_print, a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  if (p->__pyx_v_with_tail) {
    e = (*v)(p->__pyx_v_with_tail, a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree___pyx_scope_struct_7_write_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_7_write},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_7_write},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_7_write},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree___pyx_scope_struct_7_write_spec = {
  "lxml.etree.__pyx_scope_struct_7_write",
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_7_write),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree___pyx_scope_struct_7_write_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree___pyx_scope_struct_7_write = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""__pyx_scope_struct_7_write", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_7_write), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_7_write, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_7_write, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree___pyx_scope_struct_7_write, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_8__close(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_8__close > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_8__close, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_8__close))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_4lxml_5etree___pyx_scope_struct_8__close[--__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_8__close];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_8__close));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_8__close(PyObject *o) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_8__close *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_8__close *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_8__close) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_data);
  Py_CLEAR(p->__pyx_v_self);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_8__close < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_8__close, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_8__close))))
  {
    __pyx_mstate_global->__pyx_freelist_4lxml_5etree___pyx_scope_struct_8__close[__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_8__close++] = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_8__close *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_8__close(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_8__close *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_8__close *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree___pyx_scope_struct_8__close_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_8__close},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_8__close},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_8__close},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree___pyx_scope_struct_8__close_spec = {
  "lxml.etree.__pyx_scope_struct_8__close",
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_8__close),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree___pyx_scope_struct_8__close_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree___pyx_scope_struct_8__close = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""__pyx_scope_struct_8__close", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_8__close), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_8__close, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_8__close, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree___pyx_scope_struct_8__close, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_9___aenter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_9___aenter__ > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_9___aenter__, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_9___aenter__))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_4lxml_5etree___pyx_scope_struct_9___aenter__[--__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_9___aenter__];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_9___aenter__));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_9___aenter__(PyObject *o) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_9___aenter__ *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_9___aenter__ *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_9___aenter__) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_data);
  Py_CLEAR(p->__pyx_v_self);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_9___aenter__ < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_9___aenter__, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_9___aenter__))))
  {
    __pyx_mstate_global->__pyx_freelist_4lxml_5etree___pyx_scope_struct_9___aenter__[__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_9___aenter__++] = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_9___aenter__ *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_9___aenter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_9___aenter__ *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_9___aenter__ *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree___pyx_scope_struct_9___aenter___slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_9___aenter__},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_9___aenter__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_9___aenter__},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree___pyx_scope_struct_9___aenter___spec = {
  "lxml.etree.__pyx_scope_struct_9___aenter__",
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_9___aenter__),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree___pyx_scope_struct_9___aenter___slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree___pyx_scope_struct_9___aenter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""__pyx_scope_struct_9___aenter__", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_9___aenter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_9___aenter__, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_9___aenter__, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree___pyx_scope_struct_9___aenter__, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_10___aexit__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_10___aexit__ > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_10___aexit__, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_10___aexit__))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_4lxml_5etree___pyx_scope_struct_10___aexit__[--__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_10___aexit__];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_10___aexit__));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_10___aexit__(PyObject *o) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_10___aexit__ *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_10___aexit__ *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_10___aexit__) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_args);
  Py_CLEAR(p->__pyx_v_data);
  Py_CLEAR(p->__pyx_v_self);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_10___aexit__ < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_10___aexit__, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_10___aexit__))))
  {
    __pyx_mstate_global->__pyx_freelist_4lxml_5etree___pyx_scope_struct_10___aexit__[__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_10___aexit__++] = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_10___aexit__ *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_10___aexit__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_10___aexit__ *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_10___aexit__ *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_args) {
    e = (*v)(p->__pyx_v_args, a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree___pyx_scope_struct_10___aexit___slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_10___aexit__},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_10___aexit__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_10___aexit__},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree___pyx_scope_struct_10___aexit___spec = {
  "lxml.etree.__pyx_scope_struct_10___aexit__",
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_10___aexit__),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree___pyx_scope_struct_10___aexit___slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree___pyx_scope_struct_10___aexit__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""__pyx_scope_struct_10___aexit__", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_10___aexit__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_10___aexit__, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_10___aexit__, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree___pyx_scope_struct_10___aexit__, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_11___aenter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_11___aenter__ > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_11___aenter__, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_11___aenter__))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_4lxml_5etree___pyx_scope_struct_11___aenter__[--__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_11___aenter__];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_11___aenter__));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_11___aenter__(PyObject *o) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_11___aenter__ *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_11___aenter__ *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_11___aenter__) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_11___aenter__ < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_11___aenter__, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_11___aenter__))))
  {
    __pyx_mstate_global->__pyx_freelist_4lxml_5etree___pyx_scope_struct_11___aenter__[__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_11___aenter__++] = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_11___aenter__ *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_11___aenter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_11___aenter__ *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_11___aenter__ *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree___pyx_scope_struct_11___aenter___slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_11___aenter__},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_11___aenter__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_11___aenter__},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree___pyx_scope_struct_11___aenter___spec = {
  "lxml.etree.__pyx_scope_struct_11___aenter__",
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_11___aenter__),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree___pyx_scope_struct_11___aenter___slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree___pyx_scope_struct_11___aenter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""__pyx_scope_struct_11___aenter__", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_11___aenter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_11___aenter__, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_11___aenter__, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree___pyx_scope_struct_11___aenter__, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_12___aexit__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_12___aexit__ > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_12___aexit__, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_12___aexit__))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_4lxml_5etree___pyx_scope_struct_12___aexit__[--__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_12___aexit__];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_12___aexit__));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_12___aexit__(PyObject *o) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_12___aexit__ *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_12___aexit__ *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_12___aexit__) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_args);
  Py_CLEAR(p->__pyx_v_self);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_12___aexit__ < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_12___aexit__, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_12___aexit__))))
  {
    __pyx_mstate_global->__pyx_freelist_4lxml_5etree___pyx_scope_struct_12___aexit__[__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_12___aexit__++] = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_12___aexit__ *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_12___aexit__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_12___aexit__ *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_12___aexit__ *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_args) {
    e = (*v)(p->__pyx_v_args, a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree___pyx_scope_struct_12___aexit___slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_12___aexit__},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_12___aexit__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_12___aexit__},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree___pyx_scope_struct_12___aexit___spec = {
  "lxml.etree.__pyx_scope_struct_12___aexit__",
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_12___aexit__),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree___pyx_scope_struct_12___aexit___slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree___pyx_scope_struct_12___aexit__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""__pyx_scope_struct_12___aexit__", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_12___aexit__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_12___aexit__, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_12___aexit__, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree___pyx_scope_struct_12___aexit__, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_13_itervalues(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_13_itervalues > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_13_itervalues, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_13_itervalues))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_4lxml_5etree___pyx_scope_struct_13_itervalues[--__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_13_itervalues];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_13_itervalues));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_13_itervalues(PyObject *o) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_13_itervalues *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_13_itervalues *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_13_itervalues) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_13_itervalues < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_13_itervalues, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_13_itervalues))))
  {
    __pyx_mstate_global->__pyx_freelist_4lxml_5etree___pyx_scope_struct_13_itervalues[__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_13_itervalues++] = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_13_itervalues *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_13_itervalues(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_13_itervalues *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_13_itervalues *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree___pyx_scope_struct_13_itervalues_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_13_itervalues},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_13_itervalues},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_13_itervalues},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree___pyx_scope_struct_13_itervalues_spec = {
  "lxml.etree.__pyx_scope_struct_13_itervalues",
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_13_itervalues),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree___pyx_scope_struct_13_itervalues_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree___pyx_scope_struct_13_itervalues = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""__pyx_scope_struct_13_itervalues", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_13_itervalues), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_13_itervalues, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_13_itervalues, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree___pyx_scope_struct_13_itervalues, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_14_iterattributes(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_14_iterattributes > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_14_iterattributes, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_14_iterattributes))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_4lxml_5etree___pyx_scope_struct_14_iterattributes[--__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_14_iterattributes];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_14_iterattributes));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_14_iterattributes(PyObject *o) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_14_iterattributes *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_14_iterattributes *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_14_iterattributes) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_node);
  Py_CLEAR(p->__pyx_v_self);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_14_iterattributes < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_14_iterattributes, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_14_iterattributes))))
  {
    __pyx_mstate_global->__pyx_freelist_4lxml_5etree___pyx_scope_struct_14_iterattributes[__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_14_iterattributes++] = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_14_iterattributes *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_14_iterattributes(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_14_iterattributes *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_14_iterattributes *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_node) {
    e = (*v)(((PyObject *)p->__pyx_v_node), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree___pyx_scope_struct_14_iterattributes_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_14_iterattributes},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_14_iterattributes},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_14_iterattributes},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree___pyx_scope_struct_14_iterattributes_spec = {
  "lxml.etree.__pyx_scope_struct_14_iterattributes",
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_14_iterattributes),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree___pyx_scope_struct_14_iterattributes_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree___pyx_scope_struct_14_iterattributes = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""__pyx_scope_struct_14_iterattributes", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_14_iterattributes), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_14_iterattributes, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_14_iterattributes, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree___pyx_scope_struct_14_iterattributes, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_15_iterelements(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_15_iterelements > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_15_iterelements, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_15_iterelements))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_4lxml_5etree___pyx_scope_struct_15_iterelements[--__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_15_iterelements];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_15_iterelements));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_15_iterelements(PyObject *o) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_15_iterelements *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_15_iterelements *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_15_iterelements) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_node);
  Py_CLEAR(p->__pyx_v_self);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_15_iterelements < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_15_iterelements, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_15_iterelements))))
  {
    __pyx_mstate_global->__pyx_freelist_4lxml_5etree___pyx_scope_struct_15_iterelements[__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_15_iterelements++] = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_15_iterelements *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_15_iterelements(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_15_iterelements *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_15_iterelements *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_node) {
    e = (*v)(((PyObject *)p->__pyx_v_node), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree___pyx_scope_struct_15_iterelements_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_15_iterelements},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_15_iterelements},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_15_iterelements},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree___pyx_scope_struct_15_iterelements_spec = {
  "lxml.etree.__pyx_scope_struct_15_iterelements",
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_15_iterelements),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree___pyx_scope_struct_15_iterelements_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree___pyx_scope_struct_15_iterelements = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""__pyx_scope_struct_15_iterelements", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_15_iterelements), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_15_iterelements, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_15_iterelements, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree___pyx_scope_struct_15_iterelements, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_16_iterentities(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_16_iterentities > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_16_iterentities, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_16_iterentities))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_4lxml_5etree___pyx_scope_struct_16_iterentities[--__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_16_iterentities];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_16_iterentities));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_16_iterentities(PyObject *o) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_16_iterentities *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_16_iterentities *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_16_iterentities) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_node);
  Py_CLEAR(p->__pyx_v_self);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_16_iterentities < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_16_iterentities, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_16_iterentities))))
  {
    __pyx_mstate_global->__pyx_freelist_4lxml_5etree___pyx_scope_struct_16_iterentities[__pyx_mstate_global->__pyx_freecount_4lxml_5etree___pyx_scope_struct_16_iterentities++] = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_16_iterentities *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_16_iterentities(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_16_iterentities *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_16_iterentities *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_node) {
    e = (*v)(((PyObject *)p->__pyx_v_node), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree___pyx_scope_struct_16_iterentities_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_16_iterentities},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_16_iterentities},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_16_iterentities},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree___pyx_scope_struct_16_iterentities_spec = {
  "lxml.etree.__pyx_scope_struct_16_iterentities",
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_16_iterentities),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree___pyx_scope_struct_16_iterentities_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree___pyx_scope_struct_16_iterentities = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""__pyx_scope_struct_16_iterentities", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_16_iterentities), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_16_iterentities, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_16_iterentities, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree___pyx_scope_struct_16_iterentities, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_array __pyx_vtable_array;

static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_array_obj *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_array_obj *)o);
  p->__pyx_vtab = __pyx_vtabptr_array;
  p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_array___cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_array(PyObject *o) {
  struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_array) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_array___dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->mode);
  Py_CLEAR(p->_format);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyLong_FromSsize_t(i); if(!x) return 0;
  #if CYTHON_USE_TYPE_SLOTS || (!CYTHON_USE_TYPE_SPECS && __PYX_LIMITED_VERSION_HEX < 0x030A0000)
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  #else
  r = ((binaryfunc)PyType_GetSlot(Py_TYPE(o), Py_mp_subscript))(o, x);
  #endif
  Py_DECREF(x);
  return r;
}

static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_array___setitem__(o, i, v);
  }
  else {
    __Pyx_TypeName o_type_name;
    o_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(o));
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript deletion not supported by " __Pyx_FMT_TYPENAME, o_type_name);
    __Pyx_DECREF_TypeName(o_type_name);
    return -1;
  }
}

static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) {
  PyObject *v = PyObject_GenericGetAttr(o, n);
  if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
    PyErr_Clear();
    v = __pyx_array___getattr__(o, n);
  }
  return v;
}

static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(o);
}

static PyMethodDef __pyx_methods_array[] = {
  {"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_array_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_array_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_array[] = {
  {"memview", __pyx_getprop___pyx_array_memview, 0, 0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
#if !CYTHON_COMPILING_IN_LIMITED_API

static PyBufferProcs __pyx_tp_as_buffer_array = {
  __pyx_array_getbuffer, /*bf_getbuffer*/
  0, /*bf_releasebuffer*/
};
#endif
static PyType_Slot __pyx_type___pyx_array_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_array},
  {Py_sq_length, (void *)__pyx_array___len__},
  {Py_sq_item, (void *)__pyx_sq_item_array},
  {Py_mp_length, (void *)__pyx_array___len__},
  {Py_mp_subscript, (void *)__pyx_array___getitem__},
  {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_array},
  {Py_tp_getattro, (void *)__pyx_tp_getattro_array},
  #if defined(Py_bf_getbuffer)
  {Py_bf_getbuffer, (void *)__pyx_array_getbuffer},
  #endif
  {Py_tp_methods, (void *)__pyx_methods_array},
  {Py_tp_getset, (void *)__pyx_getsets_array},
  {Py_tp_new, (void *)__pyx_tp_new_array},
  {0, 0},
};
static PyType_Spec __pyx_type___pyx_array_spec = {
  "lxml.etree.array",
  sizeof(struct __pyx_array_obj),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_SEQUENCE,
  __pyx_type___pyx_array_slots,
};
#else

static PySequenceMethods __pyx_tp_as_sequence_array = {
  __pyx_array___len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_array, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_array = {
  __pyx_array___len__, /*mp_length*/
  __pyx_array___getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_array = {
  __pyx_array_getbuffer, /*bf_getbuffer*/
  0, /*bf_releasebuffer*/
};

static PyTypeObject __pyx_type___pyx_array = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""array", /*tp_name*/
  sizeof(struct __pyx_array_obj), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_array, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  &__pyx_tp_as_sequence_array, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_array, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  __pyx_tp_getattro_array, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_array, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_SEQUENCE, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_array, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_array, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_array, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_MemviewEnum_obj *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_MemviewEnum_obj *)o);
  p->name = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_Enum(PyObject *o) {
  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_Enum) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->name);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->name) {
    e = (*v)(p->name, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_Enum(PyObject *o) {
  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
  Py_CLEAR(p->name);
  return 0;
}

static PyMethodDef __pyx_methods_Enum[] = {
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type___pyx_MemviewEnum_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_Enum},
  {Py_tp_repr, (void *)__pyx_MemviewEnum___repr__},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_Enum},
  {Py_tp_clear, (void *)__pyx_tp_clear_Enum},
  {Py_tp_methods, (void *)__pyx_methods_Enum},
  {Py_tp_init, (void *)__pyx_MemviewEnum___init__},
  {Py_tp_new, (void *)__pyx_tp_new_Enum},
  {0, 0},
};
static PyType_Spec __pyx_type___pyx_MemviewEnum_spec = {
  "lxml.etree.Enum",
  sizeof(struct __pyx_MemviewEnum_obj),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type___pyx_MemviewEnum_slots,
};
#else

static PyTypeObject __pyx_type___pyx_MemviewEnum = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""Enum", /*tp_name*/
  sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_Enum, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  __pyx_MemviewEnum___repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_Enum, /*tp_traverse*/
  __pyx_tp_clear_Enum, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_Enum, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_MemviewEnum___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_Enum, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview;

static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_memoryview_obj *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_memoryview_obj *)o);
  p->__pyx_vtab = __pyx_vtabptr_memoryview;
  p->obj = Py_None; Py_INCREF(Py_None);
  p->_size = Py_None; Py_INCREF(Py_None);
  p->view.obj = NULL;
  if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_memoryview(PyObject *o) {
  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_memoryview) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_memoryview___dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->obj);
  Py_CLEAR(p->_size);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->obj) {
    e = (*v)(p->obj, a); if (e) return e;
  }
  if (p->_size) {
    e = (*v)(p->_size, a); if (e) return e;
  }
  if (p->view.obj) {
    e = (*v)(p->view.obj, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_memoryview(PyObject *o) {
  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
  Py_CLEAR(p->obj);
  Py_CLEAR(p->_size);
  Py_CLEAR(p->view.obj);
  return 0;
}

static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyLong_FromSsize_t(i); if(!x) return 0;
  #if CYTHON_USE_TYPE_SLOTS || (!CYTHON_USE_TYPE_SPECS && __PYX_LIMITED_VERSION_HEX < 0x030A0000)
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  #else
  r = ((binaryfunc)PyType_GetSlot(Py_TYPE(o), Py_mp_subscript))(o, x);
  #endif
  Py_DECREF(x);
  return r;
}

static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_memoryview___setitem__(o, i, v);
  }
  else {
    __Pyx_TypeName o_type_name;
    o_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(o));
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript deletion not supported by " __Pyx_FMT_TYPENAME, o_type_name);
    __Pyx_DECREF_TypeName(o_type_name);
    return -1;
  }
}

static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(o);
}

static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(o);
}

static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(o);
}

static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(o);
}

static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(o);
}

static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(o);
}

static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(o);
}

static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(o);
}

static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(o);
}

static PyMethodDef __pyx_methods_memoryview[] = {
  {"is_c_contig", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_is_c_contig, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"is_f_contig", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_is_f_contig, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"copy", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_copy, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"copy_fortran", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_copy_fortran, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryview_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryview_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_memoryview[] = {
  {"T", __pyx_getprop___pyx_memoryview_T, 0, 0, 0},
  {"base", __pyx_getprop___pyx_memoryview_base, 0, 0, 0},
  {"shape", __pyx_getprop___pyx_memoryview_shape, 0, 0, 0},
  {"strides", __pyx_getprop___pyx_memoryview_strides, 0, 0, 0},
  {"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, 0, 0},
  {"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, 0, 0},
  {"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, 0, 0},
  {"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, 0, 0},
  {"size", __pyx_getprop___pyx_memoryview_size, 0, 0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
#if !CYTHON_COMPILING_IN_LIMITED_API

static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
  __pyx_memoryview_getbuffer, /*bf_getbuffer*/
  0, /*bf_releasebuffer*/
};
#endif
static PyType_Slot __pyx_type___pyx_memoryview_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_memoryview},
  {Py_tp_repr, (void *)__pyx_memoryview___repr__},
  {Py_sq_length, (void *)__pyx_memoryview___len__},
  {Py_sq_item, (void *)__pyx_sq_item_memoryview},
  {Py_mp_length, (void *)__pyx_memoryview___len__},
  {Py_mp_subscript, (void *)__pyx_memoryview___getitem__},
  {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_memoryview},
  {Py_tp_str, (void *)__pyx_memoryview___str__},
  #if defined(Py_bf_getbuffer)
  {Py_bf_getbuffer, (void *)__pyx_memoryview_getbuffer},
  #endif
  {Py_tp_traverse, (void *)__pyx_tp_traverse_memoryview},
  {Py_tp_clear, (void *)__pyx_tp_clear_memoryview},
  {Py_tp_methods, (void *)__pyx_methods_memoryview},
  {Py_tp_getset, (void *)__pyx_getsets_memoryview},
  {Py_tp_new, (void *)__pyx_tp_new_memoryview},
  {0, 0},
};
static PyType_Spec __pyx_type___pyx_memoryview_spec = {
  "lxml.etree.memoryview",
  sizeof(struct __pyx_memoryview_obj),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type___pyx_memoryview_slots,
};
#else

static PySequenceMethods __pyx_tp_as_sequence_memoryview = {
  __pyx_memoryview___len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_memoryview, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_memoryview = {
  __pyx_memoryview___len__, /*mp_length*/
  __pyx_memoryview___getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
  __pyx_memoryview_getbuffer, /*bf_getbuffer*/
  0, /*bf_releasebuffer*/
};

static PyTypeObject __pyx_type___pyx_memoryview = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""memoryview", /*tp_name*/
  sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_memoryview, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  __pyx_memoryview___repr__, /*tp_repr*/
  0, /*tp_as_number*/
  &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  __pyx_memoryview___str__, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_memoryview, /*tp_traverse*/
  __pyx_tp_clear_memoryview, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_memoryview, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_memoryview, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_memoryview, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice;

static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_memoryviewslice_obj *p;
  PyObject *o = __pyx_tp_new_memoryview(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_memoryviewslice_obj *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice;
  p->from_object = Py_None; Py_INCREF(Py_None);
  p->from_slice.memview = NULL;
  return o;
}

static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) {
  struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc__memoryviewslice) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_memoryviewslice___dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->from_object);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_memoryview(o);
}

static int __pyx_tp_traverse__memoryviewslice(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
  e = __pyx_tp_traverse_memoryview(o, v, a); if (e) return e;
  if (p->from_object) {
    e = (*v)(p->from_object, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear__memoryviewslice(PyObject *o) {
  struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
  __pyx_tp_clear_memoryview(o);
  Py_CLEAR(p->from_object);
  __PYX_XCLEAR_MEMVIEW(&p->from_slice, 1);
  return 0;
}

static PyMethodDef __pyx_methods__memoryviewslice[] = {
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type___pyx_memoryviewslice_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc__memoryviewslice},
  {Py_tp_doc, (void *)PyDoc_STR("Internal class for passing memoryview slices to Python")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse__memoryviewslice},
  {Py_tp_clear, (void *)__pyx_tp_clear__memoryviewslice},
  {Py_tp_methods, (void *)__pyx_methods__memoryviewslice},
  {Py_tp_new, (void *)__pyx_tp_new__memoryviewslice},
  {0, 0},
};
static PyType_Spec __pyx_type___pyx_memoryviewslice_spec = {
  "lxml.etree._memoryviewslice",
  sizeof(struct __pyx_memoryviewslice_obj),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_SEQUENCE,
  __pyx_type___pyx_memoryviewslice_slots,
};
#else

static PyTypeObject __pyx_type___pyx_memoryviewslice = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_memoryviewslice", /*tp_name*/
  sizeof(struct __pyx_memoryviewslice_obj), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc__memoryviewslice, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_memoryview___repr__, /*tp_repr*/
  #else
  0, /*tp_repr*/
  #endif
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_memoryview___str__, /*tp_str*/
  #else
  0, /*tp_str*/
  #endif
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_SEQUENCE, /*tp_flags*/
  PyDoc_STR("Internal class for passing memoryview slices to Python"), /*tp_doc*/
  __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/
  __pyx_tp_clear__memoryviewslice, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods__memoryviewslice, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new__memoryviewslice, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyMethodDef __pyx_methods[] = {
  {0, 0, 0, 0}
};
/* #### Code section: initfunc_declarations ### */
static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE void __Pyx_CleanupGlobals(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate); /*proto*/
/* #### Code section: init_module ### */

static int __Pyx_modinit_global_init_code(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
  /*--- Global init code ---*/
  __pyx_v_4lxml_5etree_os_path_abspath = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree_BytesIO = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree_StringIO = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree_OrderedDict = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__elementpath = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree_sys = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree_re = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree_partial = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree_islice = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree_ITER_EMPTY = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree_MutableMapping = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree_IMMUTABLE_EMPTY_MAPPING = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__FILENAME_ENCODING = ((PyObject*)Py_None); Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES = ((PyObject*)Py_None); Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES_ITEMS = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__check_internal_prefix = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__Error = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree___RE_XML_ENCODING = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree___REPLACE_XML_ENCODING = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree___HAS_XML_ENCODING = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree___GLOBAL_ERROR_LOG = ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)Py_None); Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree___ERROR_LEVELS = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree___ERROR_DOMAINS = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree___PARSER_ERROR_TYPES = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree___RELAXNG_ERROR_TYPES = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__PREFIX_CACHE = ((PyObject*)Py_None); Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__find_invalid_public_id_characters = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__FIND_PI_ATTRIBUTES = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree_ELEMENT_CLASS_LOOKUP_STATE = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree_DEFAULT_ELEMENT_CLASS_LOOKUP = ((struct __pyx_obj_4lxml_5etree_ParserBasedElementClassLookup *)Py_None); Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree___FUNCTION_NAMESPACE_REGISTRIES = ((PyObject*)Py_None); Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__GenericAlias = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__ParseError = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT = ((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)Py_None); Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree___DEFAULT_XML_PARSER = ((struct __pyx_obj_4lxml_5etree_XMLParser *)Py_None); Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__UNUSED = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree___DEFAULT_HTML_PARSER = ((struct __pyx_obj_4lxml_5etree_HTMLParser *)Py_None); Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree_inspect_getargspec = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree_GzipFile = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree_io_open = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree_gzip = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree_getwriter = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree_utf8_writer = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree_contextmanager = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__open_utf8_file = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__looks_like_prefix_name = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__find_id_attributes = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree_LIBXML2_XPATH_ERROR_MESSAGES = ((PyObject*)Py_None); Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__XPATH_SYNTAX_ERRORS = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__XPATH_EVAL_ERRORS = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__replace_strings = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__find_namespaces = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree_EMPTY_DICT = ((PyObject*)Py_None); Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__RE_PI_HREF = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__FIND_PI_HREF = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__REPLACE_PI_HREF = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree___findStylesheetByID = ((struct __pyx_obj_4lxml_5etree_XPath *)Py_None); Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__rnc2rng = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__check_for_default_attributes = ((struct __pyx_obj_4lxml_5etree_XPath *)Py_None); Py_INCREF(Py_None);
  __pyx_8genexpr1__pyx_v_4lxml_5etree_feature_id = Py_None; Py_INCREF(Py_None);
  __pyx_8genexpr1__pyx_v_4lxml_5etree_feature_name = Py_None; Py_INCREF(Py_None);
  __pyx_collections_abc_Sequence = Py_None; Py_INCREF(Py_None);
  generic = Py_None; Py_INCREF(Py_None);
  strided = Py_None; Py_INCREF(Py_None);
  indirect = Py_None; Py_INCREF(Py_None);
  contiguous = Py_None; Py_INCREF(Py_None);
  indirect_contiguous = Py_None; Py_INCREF(Py_None);
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_variable_export_code(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
  /*--- Variable export code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_function_export_code(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
  /*--- Function export code ---*/
  {
    __pyx_t_1 = __Pyx_ApiExport_GetApiDict(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    const char * __pyx_export_signature = __Pyx_PyBytes_AsString(__pyx_mstate_global->__pyx_kp_b_PyObject_PyObject_PyObject_PyObj);
    #if !CYTHON_ASSUME_SAFE_MACROS
    if (unlikely(!__pyx_export_signature)) __PYX_ERR(0, 1, __pyx_L1_error)
    #endif
    const char * __pyx_export_name = __pyx_export_signature + 1544;
    void (*const __pyx_export_pointers[])(void) = {(void (*)(void))&getNsTag, (void (*)(void))&getNsTagWithEmptyNs, (void (*)(void))&utf8, (void (*)(void))&lookupDefaultElementClass, (void (*)(void))&lookupNamespaceElementClass, (void (*)(void))&pyunicode, (void (*)(void))&namespacedNameFromNsName, (void (*)(void))&getAttributeValue, (void (*)(void))&iterattributes, (void (*)(void))&callLookupFallback, (void (*)(void))&namespacedName, (void (*)(void))&tailOf, (void (*)(void))&textOf, (void (*)(void))&attributeValueFromNsName, (void (*)(void))&collectAttributes, (void (*)(void))&attributeValue, (void (*)(void))&delAttribute, (void (*)(void))&setAttributeValue, (void (*)(void))&appendChildToElement, (void (*)(void))&hasChild, (void (*)(void))&hasTail, (void (*)(void))&hasText, (void (*)(void))&setNodeText, (void (*)(void))&setTailText, (void (*)(void))&delAttributeFromNsName, (void (*)(void))&tagMatches, (void (*)(void))&documentOrRaise, (void (*)(void))&rootNodeOrRaise, (void (*)(void))&makeElement, (void (*)(void))&deepcopyNodeToDocument, (void (*)(void))&elementFactory, (void (*)(void))&makeSubElement, (void (*)(void))&elementTreeFactory, (void (*)(void))&newElementTree, (void (*)(void))&adoptExternalDocument, (void (*)(void))&setElementClassLookupFunction, (void (*)(void))&appendChild, (void (*)(void))&iteratorStoreNext, (void (*)(void))&initTagMatch, (void (*)(void))&nextElement, (void (*)(void))&previousElement, (void (*)(void))&findChild, (void (*)(void))&findChildBackwards, (void (*)(void))&findChildForwards, (void (*)(void))&findOrBuildNodeNsPrefix, (void (*)(void)) NULL};
    void (*const *__pyx_export_pointer)(void) = __pyx_export_pointers;
    const char *__pyx_export_current_signature = __pyx_export_signature;
    while (*__pyx_export_pointer) {
      if (__Pyx_ExportFunction(__pyx_t_1, __pyx_export_name, *__pyx_export_pointer, __pyx_export_current_signature) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
      ++__pyx_export_pointer;
      __pyx_export_name = strchr(__pyx_export_name, '\0') + 1;
      __pyx_export_signature = strchr(__pyx_export_signature, '\0') + 1;
      if (*__pyx_export_signature != '\0') __pyx_export_current_signature = __pyx_export_signature;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
  /*--- Type init code ---*/
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)(((PyTypeObject*)PyExc_Exception))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 210, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree_Error = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_Error_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_Error)) __PYX_ERR(0, 210, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_Error_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_Error) < (0)) __PYX_ERR(0, 210, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_Error = &__pyx_type_4lxml_5etree_Error;
  #endif
  if (sizeof(struct __pyx_obj_4lxml_5etree_Error) != sizeof(PyBaseExceptionObject)) {
    if (__Pyx_validate_extern_base((((PyTypeObject*)PyExc_Exception))) < (0)) __PYX_ERR(0, 210, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree_Error->tp_base = (((PyTypeObject*)PyExc_Exception));
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_Error) < (0)) __PYX_ERR(0, 210, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_Error);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_Error->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_Error->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_Error->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_Error, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_Error) < (0)) __PYX_ERR(0, 210, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_Error); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 214, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree_LxmlError = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_LxmlError_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_LxmlError)) __PYX_ERR(0, 214, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_LxmlError_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_LxmlError) < (0)) __PYX_ERR(0, 214, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_LxmlError = &__pyx_type_4lxml_5etree_LxmlError;
  #endif
  if (sizeof(struct __pyx_obj_4lxml_5etree_LxmlError) != sizeof(PyBaseExceptionObject)) {
    if (__Pyx_validate_extern_base(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_Error) < (0)) __PYX_ERR(0, 214, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree_LxmlError->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree_Error;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_LxmlError) < (0)) __PYX_ERR(0, 214, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_LxmlError);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_LxmlError->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_LxmlError->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_LxmlError->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_LxmlError, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_LxmlError) < (0)) __PYX_ERR(0, 214, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_LxmlError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 233, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree_C14NError = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_C14NError_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_C14NError)) __PYX_ERR(0, 233, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_C14NError_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_C14NError) < (0)) __PYX_ERR(0, 233, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_C14NError = &__pyx_type_4lxml_5etree_C14NError;
  #endif
  if (sizeof(struct __pyx_obj_4lxml_5etree_C14NError) != sizeof(PyBaseExceptionObject)) {
    if (__Pyx_validate_extern_base(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_LxmlError) < (0)) __PYX_ERR(0, 233, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree_C14NError->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree_LxmlError;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_C14NError) < (0)) __PYX_ERR(0, 233, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_C14NError);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_C14NError->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_C14NError->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_C14NError->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_C14NError, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_C14NError) < (0)) __PYX_ERR(0, 233, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__TempStore = &__pyx_vtable_4lxml_5etree__TempStore;
  __pyx_vtable_4lxml_5etree__TempStore.add = (int (*)(struct __pyx_obj_4lxml_5etree__TempStore *, PyObject *))__pyx_f_4lxml_5etree_10_TempStore_add;
  __pyx_vtable_4lxml_5etree__TempStore.clear = (int (*)(struct __pyx_obj_4lxml_5etree__TempStore *))__pyx_f_4lxml_5etree_10_TempStore_clear;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree__TempStore = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__TempStore_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__TempStore)) __PYX_ERR(0, 400, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__TempStore_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__TempStore) < (0)) __PYX_ERR(0, 400, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__TempStore = &__pyx_type_4lxml_5etree__TempStore;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__TempStore) < (0)) __PYX_ERR(0, 400, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__TempStore);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__TempStore->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__TempStore->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__TempStore->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree__TempStore, __pyx_vtabptr_4lxml_5etree__TempStore) < (0)) __PYX_ERR(0, 400, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree__TempStore) < (0)) __PYX_ERR(0, 400, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__ExceptionContext = &__pyx_vtable_4lxml_5etree__ExceptionContext;
  __pyx_vtable_4lxml_5etree__ExceptionContext.clear = (int (*)(struct __pyx_obj_4lxml_5etree__ExceptionContext *))__pyx_f_4lxml_5etree_17_ExceptionContext_clear;
  __pyx_vtable_4lxml_5etree__ExceptionContext._store_raised = (void (*)(struct __pyx_obj_4lxml_5etree__ExceptionContext *))__pyx_f_4lxml_5etree_17_ExceptionContext__store_raised;
  __pyx_vtable_4lxml_5etree__ExceptionContext._store_exception = (int (*)(struct __pyx_obj_4lxml_5etree__ExceptionContext *, PyObject *))__pyx_f_4lxml_5etree_17_ExceptionContext__store_exception;
  __pyx_vtable_4lxml_5etree__ExceptionContext._has_raised = (int (*)(struct __pyx_obj_4lxml_5etree__ExceptionContext *))__pyx_f_4lxml_5etree_17_ExceptionContext__has_raised;
  __pyx_vtable_4lxml_5etree__ExceptionContext._raise_if_stored = (int (*)(struct __pyx_obj_4lxml_5etree__ExceptionContext *))__pyx_f_4lxml_5etree_17_ExceptionContext__raise_if_stored;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree__ExceptionContext = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__ExceptionContext_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__ExceptionContext)) __PYX_ERR(0, 417, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__ExceptionContext_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__ExceptionContext) < (0)) __PYX_ERR(0, 417, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__ExceptionContext = &__pyx_type_4lxml_5etree__ExceptionContext;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__ExceptionContext) < (0)) __PYX_ERR(0, 417, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__ExceptionContext);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__ExceptionContext->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__ExceptionContext->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__ExceptionContext->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree__ExceptionContext, __pyx_vtabptr_4lxml_5etree__ExceptionContext) < (0)) __PYX_ERR(0, 417, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree__ExceptionContext) < (0)) __PYX_ERR(0, 417, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__LogEntry = &__pyx_vtable_4lxml_5etree__LogEntry;
  __pyx_vtable_4lxml_5etree__LogEntry._setError = (int (*)(struct __pyx_obj_4lxml_5etree__LogEntry *, xmlError const *))__pyx_f_4lxml_5etree_9_LogEntry__setError;
  __pyx_vtable_4lxml_5etree__LogEntry._setGeneric = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__LogEntry *, int, int, int, long, PyObject *, PyObject *))__pyx_f_4lxml_5etree_9_LogEntry__setGeneric;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree__LogEntry = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__LogEntry_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__LogEntry)) __PYX_ERR(1, 36, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__LogEntry_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__LogEntry) < (0)) __PYX_ERR(1, 36, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__LogEntry = &__pyx_type_4lxml_5etree__LogEntry;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__LogEntry) < (0)) __PYX_ERR(1, 36, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__LogEntry);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__LogEntry->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__LogEntry->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__LogEntry->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree__LogEntry, __pyx_vtabptr_4lxml_5etree__LogEntry) < (0)) __PYX_ERR(1, 36, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree__LogEntry) < (0)) __PYX_ERR(1, 36, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_LogEntry, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree__LogEntry) < (0)) __PYX_ERR(1, 36, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__BaseErrorLog = &__pyx_vtable_4lxml_5etree__BaseErrorLog;
  __pyx_vtable_4lxml_5etree__BaseErrorLog.copy = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseErrorLog *, int __pyx_skip_dispatch))__pyx_f_4lxml_5etree_13_BaseErrorLog_copy;
  __pyx_vtable_4lxml_5etree__BaseErrorLog.receive = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseErrorLog *, struct __pyx_obj_4lxml_5etree__LogEntry *, int __pyx_skip_dispatch))__pyx_f_4lxml_5etree_13_BaseErrorLog_receive;
  __pyx_vtable_4lxml_5etree__BaseErrorLog._receive = (int (*)(struct __pyx_obj_4lxml_5etree__BaseErrorLog *, xmlError const *))__pyx_f_4lxml_5etree_13_BaseErrorLog__receive;
  __pyx_vtable_4lxml_5etree__BaseErrorLog._receiveGeneric = (int (*)(struct __pyx_obj_4lxml_5etree__BaseErrorLog *, int, int, int, long, PyObject *, PyObject *))__pyx_f_4lxml_5etree_13_BaseErrorLog__receiveGeneric;
  __pyx_vtable_4lxml_5etree__BaseErrorLog._buildParseException = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseErrorLog *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_13_BaseErrorLog__buildParseException;
  __pyx_vtable_4lxml_5etree__BaseErrorLog._buildExceptionMessage = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseErrorLog *, PyObject *))__pyx_f_4lxml_5etree_13_BaseErrorLog__buildExceptionMessage;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree__BaseErrorLog = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__BaseErrorLog_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__BaseErrorLog)) __PYX_ERR(1, 187, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__BaseErrorLog_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__BaseErrorLog) < (0)) __PYX_ERR(1, 187, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__BaseErrorLog = &__pyx_type_4lxml_5etree__BaseErrorLog;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__BaseErrorLog) < (0)) __PYX_ERR(1, 187, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__BaseErrorLog);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__BaseErrorLog->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__BaseErrorLog->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__BaseErrorLog->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree__BaseErrorLog, __pyx_vtabptr_4lxml_5etree__BaseErrorLog) < (0)) __PYX_ERR(1, 187, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree__BaseErrorLog) < (0)) __PYX_ERR(1, 187, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_BaseErrorLog, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree__BaseErrorLog) < (0)) __PYX_ERR(1, 187, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__ListErrorLog = &__pyx_vtable_4lxml_5etree__ListErrorLog;
  __pyx_vtable_4lxml_5etree__ListErrorLog.__pyx_base = *__pyx_vtabptr_4lxml_5etree__BaseErrorLog;
  __pyx_vtable_4lxml_5etree__ListErrorLog.__pyx_base.copy = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseErrorLog *, int __pyx_skip_dispatch))__pyx_f_4lxml_5etree_13_ListErrorLog_copy;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__BaseErrorLog); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 277, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree__ListErrorLog = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__ListErrorLog_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__ListErrorLog)) __PYX_ERR(1, 277, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__ListErrorLog_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__ListErrorLog) < (0)) __PYX_ERR(1, 277, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__ListErrorLog = &__pyx_type_4lxml_5etree__ListErrorLog;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ListErrorLog->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree__BaseErrorLog;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__ListErrorLog) < (0)) __PYX_ERR(1, 277, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__ListErrorLog);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__ListErrorLog->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__ListErrorLog->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__ListErrorLog->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree__ListErrorLog, __pyx_vtabptr_4lxml_5etree__ListErrorLog) < (0)) __PYX_ERR(1, 277, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree__ListErrorLog) < (0)) __PYX_ERR(1, 277, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_ListErrorLog, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree__ListErrorLog) < (0)) __PYX_ERR(1, 277, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__ErrorLogContext = &__pyx_vtable_4lxml_5etree__ErrorLogContext;
  __pyx_vtable_4lxml_5etree__ErrorLogContext.push_error_log = (int (*)(struct __pyx_obj_4lxml_5etree__ErrorLogContext *, struct __pyx_obj_4lxml_5etree__BaseErrorLog *))__pyx_f_4lxml_5etree_16_ErrorLogContext_push_error_log;
  __pyx_vtable_4lxml_5etree__ErrorLogContext.pop_error_log = (int (*)(struct __pyx_obj_4lxml_5etree__ErrorLogContext *))__pyx_f_4lxml_5etree_16_ErrorLogContext_pop_error_log;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree__ErrorLogContext = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__ErrorLogContext_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__ErrorLogContext)) __PYX_ERR(1, 393, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__ErrorLogContext_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__ErrorLogContext) < (0)) __PYX_ERR(1, 393, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__ErrorLogContext = &__pyx_type_4lxml_5etree__ErrorLogContext;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__ErrorLogContext) < (0)) __PYX_ERR(1, 393, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__ErrorLogContext);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__ErrorLogContext->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__ErrorLogContext->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__ErrorLogContext->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree__ErrorLogContext, __pyx_vtabptr_4lxml_5etree__ErrorLogContext) < (0)) __PYX_ERR(1, 393, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree__ErrorLogContext) < (0)) __PYX_ERR(1, 393, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__ErrorLog = &__pyx_vtable_4lxml_5etree__ErrorLog;
  __pyx_vtable_4lxml_5etree__ErrorLog.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ListErrorLog;
  __pyx_vtable_4lxml_5etree__ErrorLog.__pyx_base.__pyx_base.copy = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseErrorLog *, int __pyx_skip_dispatch))__pyx_f_4lxml_5etree_9_ErrorLog_copy;
  __pyx_vtable_4lxml_5etree__ErrorLog.__pyx_base.__pyx_base.receive = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseErrorLog *, struct __pyx_obj_4lxml_5etree__LogEntry *, int __pyx_skip_dispatch))__pyx_f_4lxml_5etree_9_ErrorLog_receive;
  __pyx_vtable_4lxml_5etree__ErrorLog.__pyx___enter__ = (int (*)(struct __pyx_obj_4lxml_5etree__ErrorLog *))__pyx_f_4lxml_5etree_9_ErrorLog___enter__;
  __pyx_vtable_4lxml_5etree__ErrorLog.connect = (int (*)(struct __pyx_obj_4lxml_5etree__ErrorLog *))__pyx_f_4lxml_5etree_9_ErrorLog_connect;
  __pyx_vtable_4lxml_5etree__ErrorLog.disconnect = (int (*)(struct __pyx_obj_4lxml_5etree__ErrorLog *))__pyx_f_4lxml_5etree_9_ErrorLog_disconnect;
  __pyx_vtable_4lxml_5etree__ErrorLog.clear = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__ErrorLog *, int __pyx_skip_dispatch))__pyx_f_4lxml_5etree_9_ErrorLog_clear;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ListErrorLog); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 432, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree__ErrorLog = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__ErrorLog_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__ErrorLog)) __PYX_ERR(1, 432, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__ErrorLog_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__ErrorLog) < (0)) __PYX_ERR(1, 432, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__ErrorLog = &__pyx_type_4lxml_5etree__ErrorLog;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ErrorLog->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ListErrorLog;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__ErrorLog) < (0)) __PYX_ERR(1, 432, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__ErrorLog);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__ErrorLog->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__ErrorLog->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__ErrorLog->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree__ErrorLog, __pyx_vtabptr_4lxml_5etree__ErrorLog) < (0)) __PYX_ERR(1, 432, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree__ErrorLog) < (0)) __PYX_ERR(1, 432, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_ErrorLog, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree__ErrorLog) < (0)) __PYX_ERR(1, 432, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__DomainErrorLog = &__pyx_vtable_4lxml_5etree__DomainErrorLog;
  __pyx_vtable_4lxml_5etree__DomainErrorLog.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ErrorLog;
  __pyx_vtable_4lxml_5etree__DomainErrorLog.__pyx_base.__pyx_base.__pyx_base.receive = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseErrorLog *, struct __pyx_obj_4lxml_5etree__LogEntry *, int __pyx_skip_dispatch))__pyx_f_4lxml_5etree_15_DomainErrorLog_receive;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ErrorLog); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 485, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree__DomainErrorLog = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__DomainErrorLog_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__DomainErrorLog)) __PYX_ERR(1, 485, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__DomainErrorLog_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__DomainErrorLog) < (0)) __PYX_ERR(1, 485, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__DomainErrorLog = &__pyx_type_4lxml_5etree__DomainErrorLog;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree__DomainErrorLog->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ErrorLog;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__DomainErrorLog) < (0)) __PYX_ERR(1, 485, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__DomainErrorLog);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__DomainErrorLog->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__DomainErrorLog->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__DomainErrorLog->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree__DomainErrorLog, __pyx_vtabptr_4lxml_5etree__DomainErrorLog) < (0)) __PYX_ERR(1, 485, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree__DomainErrorLog) < (0)) __PYX_ERR(1, 485, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_DomainErrorLog, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree__DomainErrorLog) < (0)) __PYX_ERR(1, 485, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__RotatingErrorLog = &__pyx_vtable_4lxml_5etree__RotatingErrorLog;
  __pyx_vtable_4lxml_5etree__RotatingErrorLog.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ErrorLog;
  __pyx_vtable_4lxml_5etree__RotatingErrorLog.__pyx_base.__pyx_base.__pyx_base.receive = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseErrorLog *, struct __pyx_obj_4lxml_5etree__LogEntry *, int __pyx_skip_dispatch))__pyx_f_4lxml_5etree_17_RotatingErrorLog_receive;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ErrorLog); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 494, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree__RotatingErrorLog = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__RotatingErrorLog_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__RotatingErrorLog)) __PYX_ERR(1, 494, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__RotatingErrorLog_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__RotatingErrorLog) < (0)) __PYX_ERR(1, 494, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__RotatingErrorLog = &__pyx_type_4lxml_5etree__RotatingErrorLog;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree__RotatingErrorLog->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ErrorLog;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__RotatingErrorLog) < (0)) __PYX_ERR(1, 494, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__RotatingErrorLog);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__RotatingErrorLog->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__RotatingErrorLog->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__RotatingErrorLog->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree__RotatingErrorLog, __pyx_vtabptr_4lxml_5etree__RotatingErrorLog) < (0)) __PYX_ERR(1, 494, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree__RotatingErrorLog) < (0)) __PYX_ERR(1, 494, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_RotatingErrorLog, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree__RotatingErrorLog) < (0)) __PYX_ERR(1, 494, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree_PyErrorLog = &__pyx_vtable_4lxml_5etree_PyErrorLog;
  __pyx_vtable_4lxml_5etree_PyErrorLog.__pyx_base = *__pyx_vtabptr_4lxml_5etree__BaseErrorLog;
  __pyx_vtable_4lxml_5etree_PyErrorLog.__pyx_base.copy = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseErrorLog *, int __pyx_skip_dispatch))__pyx_f_4lxml_5etree_10PyErrorLog_copy;
  __pyx_vtable_4lxml_5etree_PyErrorLog.__pyx_base.receive = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseErrorLog *, struct __pyx_obj_4lxml_5etree__LogEntry *, int __pyx_skip_dispatch))__pyx_f_4lxml_5etree_10PyErrorLog_receive;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__BaseErrorLog); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 512, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree_PyErrorLog = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_PyErrorLog_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_PyErrorLog)) __PYX_ERR(1, 512, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_PyErrorLog_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_PyErrorLog) < (0)) __PYX_ERR(1, 512, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_PyErrorLog = &__pyx_type_4lxml_5etree_PyErrorLog;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree_PyErrorLog->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree__BaseErrorLog;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_PyErrorLog) < (0)) __PYX_ERR(1, 512, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_PyErrorLog);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_PyErrorLog->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_PyErrorLog->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_PyErrorLog->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree_PyErrorLog, __pyx_vtabptr_4lxml_5etree_PyErrorLog) < (0)) __PYX_ERR(1, 512, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree_PyErrorLog) < (0)) __PYX_ERR(1, 512, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_PyErrorLog, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_PyErrorLog) < (0)) __PYX_ERR(1, 512, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__Document = &__pyx_vtable_4lxml_5etree__Document;
  __pyx_vtable_4lxml_5etree__Document.getroot = (PyObject *(*)(struct LxmlDocument *))__pyx_f_4lxml_5etree_9_Document_getroot;
  __pyx_vtable_4lxml_5etree__Document.hasdoctype = (int (*)(struct LxmlDocument *))__pyx_f_4lxml_5etree_9_Document_hasdoctype;
  __pyx_vtable_4lxml_5etree__Document.getdoctype = (PyObject *(*)(struct LxmlDocument *))__pyx_f_4lxml_5etree_9_Document_getdoctype;
  __pyx_vtable_4lxml_5etree__Document.getxmlinfo = (PyObject *(*)(struct LxmlDocument *))__pyx_f_4lxml_5etree_9_Document_getxmlinfo;
  __pyx_vtable_4lxml_5etree__Document.isstandalone = (PyObject *(*)(struct LxmlDocument *))__pyx_f_4lxml_5etree_9_Document_isstandalone;
  __pyx_vtable_4lxml_5etree__Document.buildNewPrefix = (PyObject *(*)(struct LxmlDocument *))__pyx_f_4lxml_5etree_9_Document_buildNewPrefix;
  __pyx_vtable_4lxml_5etree__Document._findOrBuildNodeNs = (xmlNs *(*)(struct LxmlDocument *, xmlNode *, const xmlChar *, const xmlChar *, int))__pyx_f_4lxml_5etree_9_Document__findOrBuildNodeNs;
  __pyx_vtable_4lxml_5etree__Document._setNodeNs = (int (*)(struct LxmlDocument *, xmlNode *, const xmlChar *))__pyx_f_4lxml_5etree_9_Document__setNodeNs;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree__Document = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &LxmlDocumentType_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__Document)) __PYX_ERR(0, 470, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&LxmlDocumentType_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__Document) < (0)) __PYX_ERR(0, 470, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__Document = &LxmlDocumentType;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__Document) < (0)) __PYX_ERR(0, 470, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__Document);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__Document->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__Document->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__Document->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree__Document, __pyx_vtabptr_4lxml_5etree__Document) < (0)) __PYX_ERR(0, 470, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree__Document) < (0)) __PYX_ERR(0, 470, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_Document, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree__Document) < (0)) __PYX_ERR(0, 470, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree_DocInfo = &__pyx_vtable_4lxml_5etree_DocInfo;
  __pyx_vtable_4lxml_5etree_DocInfo._get_c_dtd = (xmlDtd *(*)(struct __pyx_obj_4lxml_5etree_DocInfo *))__pyx_f_4lxml_5etree_7DocInfo__get_c_dtd;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree_DocInfo = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_DocInfo_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_DocInfo)) __PYX_ERR(0, 648, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_DocInfo_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_DocInfo) < (0)) __PYX_ERR(0, 648, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_DocInfo = &__pyx_type_4lxml_5etree_DocInfo;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_DocInfo) < (0)) __PYX_ERR(0, 648, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_DocInfo);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_DocInfo->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_DocInfo->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_DocInfo->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree_DocInfo, __pyx_vtabptr_4lxml_5etree_DocInfo) < (0)) __PYX_ERR(0, 648, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree_DocInfo) < (0)) __PYX_ERR(0, 648, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_DocInfo, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_DocInfo) < (0)) __PYX_ERR(0, 648, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree__Element = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &LxmlElementType_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__Element)) __PYX_ERR(0, 822, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&LxmlElementType_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__Element) < (0)) __PYX_ERR(0, 822, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__Element = &LxmlElementType;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__Element) < (0)) __PYX_ERR(0, 822, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__Element);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__Element->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__Element->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__Element->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_mstate->__pyx_ptype_4lxml_5etree__Element, "__setitem__"); if (unlikely(!wrapper)) __PYX_ERR(0, 822, __pyx_L1_error)
    if (__Pyx_IS_TYPE(wrapper, &PyWrapperDescr_Type)) {
      __pyx_wrapperbase_4lxml_5etree_8_Element_4__setitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_8_Element_4__setitem__.doc = __pyx_doc_4lxml_5etree_8_Element_4__setitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_8_Element_4__setitem__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_mstate->__pyx_ptype_4lxml_5etree__Element, "__delitem__"); if (unlikely(!wrapper)) __PYX_ERR(0, 822, __pyx_L1_error)
    if (__Pyx_IS_TYPE(wrapper, &PyWrapperDescr_Type)) {
      __pyx_wrapperbase_4lxml_5etree_8_Element_6__delitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_8_Element_6__delitem__.doc = __pyx_doc_4lxml_5etree_8_Element_6__delitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_8_Element_6__delitem__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_mstate->__pyx_ptype_4lxml_5etree__Element, "__repr__"); if (unlikely(!wrapper)) __PYX_ERR(0, 822, __pyx_L1_error)
    if (__Pyx_IS_TYPE(wrapper, &PyWrapperDescr_Type)) {
      __pyx_wrapperbase_4lxml_5etree_8_Element_30__repr__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_8_Element_30__repr__.doc = __pyx_doc_4lxml_5etree_8_Element_30__repr__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_8_Element_30__repr__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_mstate->__pyx_ptype_4lxml_5etree__Element, "__getitem__"); if (unlikely(!wrapper)) __PYX_ERR(0, 822, __pyx_L1_error)
    if (__Pyx_IS_TYPE(wrapper, &PyWrapperDescr_Type)) {
      __pyx_wrapperbase_4lxml_5etree_8_Element_32__getitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_8_Element_32__getitem__.doc = __pyx_doc_4lxml_5etree_8_Element_32__getitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_8_Element_32__getitem__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_mstate->__pyx_ptype_4lxml_5etree__Element, "__len__"); if (unlikely(!wrapper)) __PYX_ERR(0, 822, __pyx_L1_error)
    if (__Pyx_IS_TYPE(wrapper, &PyWrapperDescr_Type)) {
      __pyx_wrapperbase_4lxml_5etree_8_Element_34__len__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_8_Element_34__len__.doc = __pyx_doc_4lxml_5etree_8_Element_34__len__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_8_Element_34__len__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_mstate->__pyx_ptype_4lxml_5etree__Element, "__contains__"); if (unlikely(!wrapper)) __PYX_ERR(0, 822, __pyx_L1_error)
    if (__Pyx_IS_TYPE(wrapper, &PyWrapperDescr_Type)) {
      __pyx_wrapperbase_4lxml_5etree_8_Element_38__contains__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_8_Element_38__contains__.doc = __pyx_doc_4lxml_5etree_8_Element_38__contains__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_8_Element_38__contains__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_mstate->__pyx_ptype_4lxml_5etree__Element, "__iter__"); if (unlikely(!wrapper)) __PYX_ERR(0, 822, __pyx_L1_error)
    if (__Pyx_IS_TYPE(wrapper, &PyWrapperDescr_Type)) {
      __pyx_wrapperbase_4lxml_5etree_8_Element_40__iter__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_8_Element_40__iter__.doc = __pyx_doc_4lxml_5etree_8_Element_40__iter__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_8_Element_40__iter__;
    }
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_Element_3, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree__Element) < (0)) __PYX_ERR(0, 822, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree___ContentOnlyElement = &__pyx_vtable_4lxml_5etree___ContentOnlyElement;
  __pyx_vtable_4lxml_5etree___ContentOnlyElement._raiseImmutable = (int (*)(struct __pyx_obj_4lxml_5etree___ContentOnlyElement *))__pyx_f_4lxml_5etree_20__ContentOnlyElement__raiseImmutable;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1772, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree___ContentOnlyElement = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree___ContentOnlyElement_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree___ContentOnlyElement)) __PYX_ERR(0, 1772, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree___ContentOnlyElement_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree___ContentOnlyElement) < (0)) __PYX_ERR(0, 1772, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree___ContentOnlyElement = &__pyx_type_4lxml_5etree___ContentOnlyElement;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree___ContentOnlyElement->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree___ContentOnlyElement) < (0)) __PYX_ERR(0, 1772, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree___ContentOnlyElement);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree___ContentOnlyElement->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree___ContentOnlyElement->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree___ContentOnlyElement->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_mstate->__pyx_ptype_4lxml_5etree___ContentOnlyElement, "__setitem__"); if (unlikely(!wrapper)) __PYX_ERR(0, 1772, __pyx_L1_error)
    if (__Pyx_IS_TYPE(wrapper, &PyWrapperDescr_Type)) {
      __pyx_wrapperbase_4lxml_5etree_20__ContentOnlyElement_6__setitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_20__ContentOnlyElement_6__setitem__.doc = __pyx_doc_4lxml_5etree_20__ContentOnlyElement_6__setitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_20__ContentOnlyElement_6__setitem__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_mstate->__pyx_ptype_4lxml_5etree___ContentOnlyElement, "__getitem__"); if (unlikely(!wrapper)) __PYX_ERR(0, 1772, __pyx_L1_error)
    if (__Pyx_IS_TYPE(wrapper, &PyWrapperDescr_Type)) {
      __pyx_wrapperbase_4lxml_5etree_20__ContentOnlyElement_8__getitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_20__ContentOnlyElement_8__getitem__.doc = __pyx_doc_4lxml_5etree_20__ContentOnlyElement_8__getitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_20__ContentOnlyElement_8__getitem__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_mstate->__pyx_ptype_4lxml_5etree___ContentOnlyElement, "__len__"); if (unlikely(!wrapper)) __PYX_ERR(0, 1772, __pyx_L1_error)
    if (__Pyx_IS_TYPE(wrapper, &PyWrapperDescr_Type)) {
      __pyx_wrapperbase_4lxml_5etree_20__ContentOnlyElement_10__len__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_20__ContentOnlyElement_10__len__.doc = __pyx_doc_4lxml_5etree_20__ContentOnlyElement_10__len__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_20__ContentOnlyElement_10__len__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree___ContentOnlyElement, __pyx_vtabptr_4lxml_5etree___ContentOnlyElement) < (0)) __PYX_ERR(0, 1772, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree___ContentOnlyElement) < (0)) __PYX_ERR(0, 1772, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__Comment = &__pyx_vtable_4lxml_5etree__Comment;
  __pyx_vtable_4lxml_5etree__Comment.__pyx_base = *__pyx_vtabptr_4lxml_5etree___ContentOnlyElement;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree___ContentOnlyElement); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1840, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree__Comment = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__Comment_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__Comment)) __PYX_ERR(0, 1840, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__Comment_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__Comment) < (0)) __PYX_ERR(0, 1840, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__Comment = &__pyx_type_4lxml_5etree__Comment;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Comment->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree___ContentOnlyElement;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__Comment) < (0)) __PYX_ERR(0, 1840, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__Comment);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__Comment->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__Comment->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__Comment->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree__Comment, __pyx_vtabptr_4lxml_5etree__Comment) < (0)) __PYX_ERR(0, 1840, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree__Comment) < (0)) __PYX_ERR(0, 1840, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_Comment_2, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree__Comment) < (0)) __PYX_ERR(0, 1840, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__ProcessingInstruction = &__pyx_vtable_4lxml_5etree__ProcessingInstruction;
  __pyx_vtable_4lxml_5etree__ProcessingInstruction.__pyx_base = *__pyx_vtabptr_4lxml_5etree___ContentOnlyElement;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree___ContentOnlyElement); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1848, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree__ProcessingInstruction = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__ProcessingInstruction_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__ProcessingInstruction)) __PYX_ERR(0, 1848, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__ProcessingInstruction_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__ProcessingInstruction) < (0)) __PYX_ERR(0, 1848, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__ProcessingInstruction = &__pyx_type_4lxml_5etree__ProcessingInstruction;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ProcessingInstruction->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree___ContentOnlyElement;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__ProcessingInstruction) < (0)) __PYX_ERR(0, 1848, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__ProcessingInstruction);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__ProcessingInstruction->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__ProcessingInstruction->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__ProcessingInstruction->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree__ProcessingInstruction, __pyx_vtabptr_4lxml_5etree__ProcessingInstruction) < (0)) __PYX_ERR(0, 1848, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree__ProcessingInstruction) < (0)) __PYX_ERR(0, 1848, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_ProcessingInstruction_2, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree__ProcessingInstruction) < (0)) __PYX_ERR(0, 1848, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__Entity = &__pyx_vtable_4lxml_5etree__Entity;
  __pyx_vtable_4lxml_5etree__Entity.__pyx_base = *__pyx_vtabptr_4lxml_5etree___ContentOnlyElement;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree___ContentOnlyElement); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1898, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree__Entity = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__Entity_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__Entity)) __PYX_ERR(0, 1898, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__Entity_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__Entity) < (0)) __PYX_ERR(0, 1898, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__Entity = &__pyx_type_4lxml_5etree__Entity;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Entity->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree___ContentOnlyElement;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__Entity) < (0)) __PYX_ERR(0, 1898, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__Entity);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__Entity->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__Entity->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__Entity->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree__Entity, __pyx_vtabptr_4lxml_5etree__Entity) < (0)) __PYX_ERR(0, 1898, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree__Entity) < (0)) __PYX_ERR(0, 1898, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_Entity_2, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree__Entity) < (0)) __PYX_ERR(0, 1898, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree_QName = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_QName_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_QName)) __PYX_ERR(0, 1927, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_QName_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_QName) < (0)) __PYX_ERR(0, 1927, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_QName = &__pyx_type_4lxml_5etree_QName;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_QName) < (0)) __PYX_ERR(0, 1927, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_QName);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_QName->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_QName->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_QName->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_QName, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_QName) < (0)) __PYX_ERR(0, 1927, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__ElementTree = &__pyx_vtable_4lxml_5etree__ElementTree;
  __pyx_vtable_4lxml_5etree__ElementTree._assertHasRoot = (int (*)(struct LxmlElementTree *))__pyx_f_4lxml_5etree_12_ElementTree__assertHasRoot;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree__ElementTree = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &LxmlElementTreeType_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__ElementTree)) __PYX_ERR(0, 1996, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&LxmlElementTreeType_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__ElementTree) < (0)) __PYX_ERR(0, 1996, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__ElementTree = &LxmlElementTreeType;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__ElementTree) < (0)) __PYX_ERR(0, 1996, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__ElementTree);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__ElementTree->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__ElementTree->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__ElementTree->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree__ElementTree, __pyx_vtabptr_4lxml_5etree__ElementTree) < (0)) __PYX_ERR(0, 1996, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree__ElementTree) < (0)) __PYX_ERR(0, 1996, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_ElementTree_2, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree__ElementTree) < (0)) __PYX_ERR(0, 1996, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree__Attrib = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__Attrib_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__Attrib)) __PYX_ERR(0, 2586, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__Attrib_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__Attrib) < (0)) __PYX_ERR(0, 2586, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__Attrib = &__pyx_type_4lxml_5etree__Attrib;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__Attrib) < (0)) __PYX_ERR(0, 2586, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__Attrib);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__Attrib->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__Attrib->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__Attrib->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_Attrib, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree__Attrib) < (0)) __PYX_ERR(0, 2586, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree__AttribIterator = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__AttribIterator_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__AttribIterator)) __PYX_ERR(0, 2727, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__AttribIterator_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__AttribIterator) < (0)) __PYX_ERR(0, 2727, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__AttribIterator = &__pyx_type_4lxml_5etree__AttribIterator;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__AttribIterator) < (0)) __PYX_ERR(0, 2727, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__AttribIterator);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__AttribIterator->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__AttribIterator->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__AttribIterator->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  __pyx_vtabptr_4lxml_5etree__ElementTagMatcher = &__pyx_vtable_4lxml_5etree__ElementTagMatcher;
  __pyx_vtable_4lxml_5etree__ElementTagMatcher._initTagMatch = (PyObject *(*)(struct LxmlElementTagMatcher *, PyObject *))__pyx_f_4lxml_5etree_18_ElementTagMatcher__initTagMatch;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree__ElementTagMatcher = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &LxmlElementTagMatcherType_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__ElementTagMatcher)) __PYX_ERR(0, 2770, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&LxmlElementTagMatcherType_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__ElementTagMatcher) < (0)) __PYX_ERR(0, 2770, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__ElementTagMatcher = &LxmlElementTagMatcherType;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__ElementTagMatcher) < (0)) __PYX_ERR(0, 2770, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__ElementTagMatcher);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__ElementTagMatcher->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__ElementTagMatcher->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__ElementTagMatcher->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree__ElementTagMatcher, __pyx_vtabptr_4lxml_5etree__ElementTagMatcher) < (0)) __PYX_ERR(0, 2770, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree__ElementTagMatcher) < (0)) __PYX_ERR(0, 2770, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_ElementTagMatcher, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree__ElementTagMatcher) < (0)) __PYX_ERR(0, 2770, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__ElementIterator = &__pyx_vtable_4lxml_5etree__ElementIterator;
  __pyx_vtable_4lxml_5etree__ElementIterator.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ElementTagMatcher;
  __pyx_vtable_4lxml_5etree__ElementIterator._storeNext = (void (*)(struct LxmlElementIterator *, struct LxmlElement *))__pyx_f_4lxml_5etree_16_ElementIterator__storeNext;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ElementTagMatcher); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2801, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree__ElementIterator = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &LxmlElementIteratorType_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__ElementIterator)) __PYX_ERR(0, 2801, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&LxmlElementIteratorType_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__ElementIterator) < (0)) __PYX_ERR(0, 2801, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__ElementIterator = &LxmlElementIteratorType;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ElementIterator->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ElementTagMatcher;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__ElementIterator) < (0)) __PYX_ERR(0, 2801, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__ElementIterator);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__ElementIterator->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__ElementIterator->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__ElementIterator->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree__ElementIterator, __pyx_vtabptr_4lxml_5etree__ElementIterator) < (0)) __PYX_ERR(0, 2801, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree__ElementIterator) < (0)) __PYX_ERR(0, 2801, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_ElementIterator, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree__ElementIterator) < (0)) __PYX_ERR(0, 2801, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__MultiTagMatcher = &__pyx_vtable_4lxml_5etree__MultiTagMatcher;
  __pyx_vtable_4lxml_5etree__MultiTagMatcher.rejectsAll = (int (*)(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *))__pyx_f_4lxml_5etree_16_MultiTagMatcher_rejectsAll;
  __pyx_vtable_4lxml_5etree__MultiTagMatcher.rejectsAllAttributes = (int (*)(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *))__pyx_f_4lxml_5etree_16_MultiTagMatcher_rejectsAllAttributes;
  __pyx_vtable_4lxml_5etree__MultiTagMatcher.matchesType = (int (*)(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *, int))__pyx_f_4lxml_5etree_16_MultiTagMatcher_matchesType;
  __pyx_vtable_4lxml_5etree__MultiTagMatcher._clear = (void (*)(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *))__pyx_f_4lxml_5etree_16_MultiTagMatcher__clear;
  __pyx_vtable_4lxml_5etree__MultiTagMatcher.initTagMatch = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *, PyObject *))__pyx_f_4lxml_5etree_16_MultiTagMatcher_initTagMatch;
  __pyx_vtable_4lxml_5etree__MultiTagMatcher._storeTags = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_16_MultiTagMatcher__storeTags;
  __pyx_vtable_4lxml_5etree__MultiTagMatcher.cacheTags = (int (*)(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *, struct LxmlDocument *, struct __pyx_opt_args_4lxml_5etree_16_MultiTagMatcher_cacheTags *__pyx_optional_args))__pyx_f_4lxml_5etree_16_MultiTagMatcher_cacheTags;
  __pyx_vtable_4lxml_5etree__MultiTagMatcher.matches = (int (*)(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *, xmlNode *))__pyx_f_4lxml_5etree_16_MultiTagMatcher_matches;
  __pyx_vtable_4lxml_5etree__MultiTagMatcher.matchesNsTag = (int (*)(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *, const xmlChar *, const xmlChar *))__pyx_f_4lxml_5etree_16_MultiTagMatcher_matchesNsTag;
  __pyx_vtable_4lxml_5etree__MultiTagMatcher.matchesAttribute = (int (*)(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *, xmlAttr *))__pyx_f_4lxml_5etree_16_MultiTagMatcher_matchesAttribute;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree__MultiTagMatcher = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__MultiTagMatcher_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__MultiTagMatcher)) __PYX_ERR(0, 2836, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__MultiTagMatcher_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__MultiTagMatcher) < (0)) __PYX_ERR(0, 2836, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__MultiTagMatcher = &__pyx_type_4lxml_5etree__MultiTagMatcher;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__MultiTagMatcher) < (0)) __PYX_ERR(0, 2836, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__MultiTagMatcher);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__MultiTagMatcher->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__MultiTagMatcher->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__MultiTagMatcher->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree__MultiTagMatcher, __pyx_vtabptr_4lxml_5etree__MultiTagMatcher) < (0)) __PYX_ERR(0, 2836, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree__MultiTagMatcher) < (0)) __PYX_ERR(0, 2836, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__ElementMatchIterator = &__pyx_vtable_4lxml_5etree__ElementMatchIterator;
  __pyx_vtable_4lxml_5etree__ElementMatchIterator._initTagMatcher = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__ElementMatchIterator *, PyObject *))__pyx_f_4lxml_5etree_21_ElementMatchIterator__initTagMatcher;
  __pyx_vtable_4lxml_5etree__ElementMatchIterator._storeNext = (int (*)(struct __pyx_obj_4lxml_5etree__ElementMatchIterator *, struct LxmlElement *))__pyx_f_4lxml_5etree_21_ElementMatchIterator__storeNext;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree__ElementMatchIterator = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__ElementMatchIterator_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__ElementMatchIterator)) __PYX_ERR(0, 2977, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__ElementMatchIterator_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__ElementMatchIterator) < (0)) __PYX_ERR(0, 2977, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__ElementMatchIterator = &__pyx_type_4lxml_5etree__ElementMatchIterator;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__ElementMatchIterator) < (0)) __PYX_ERR(0, 2977, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__ElementMatchIterator);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__ElementMatchIterator->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__ElementMatchIterator->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__ElementMatchIterator->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree__ElementMatchIterator, __pyx_vtabptr_4lxml_5etree__ElementMatchIterator) < (0)) __PYX_ERR(0, 2977, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree__ElementMatchIterator) < (0)) __PYX_ERR(0, 2977, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_ElementMatchIterator, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree__ElementMatchIterator) < (0)) __PYX_ERR(0, 2977, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree_ElementChildIterator = &__pyx_vtable_4lxml_5etree_ElementChildIterator;
  __pyx_vtable_4lxml_5etree_ElementChildIterator.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ElementMatchIterator;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ElementMatchIterator); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3006, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree_ElementChildIterator = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_ElementChildIterator_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_ElementChildIterator)) __PYX_ERR(0, 3006, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_ElementChildIterator_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_ElementChildIterator) < (0)) __PYX_ERR(0, 3006, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_ElementChildIterator = &__pyx_type_4lxml_5etree_ElementChildIterator;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree_ElementChildIterator->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ElementMatchIterator;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_ElementChildIterator) < (0)) __PYX_ERR(0, 3006, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_ElementChildIterator);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_ElementChildIterator->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_ElementChildIterator->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_ElementChildIterator->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree_ElementChildIterator, __pyx_vtabptr_4lxml_5etree_ElementChildIterator) < (0)) __PYX_ERR(0, 3006, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree_ElementChildIterator) < (0)) __PYX_ERR(0, 3006, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_ElementChildIterator, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_ElementChildIterator) < (0)) __PYX_ERR(0, 3006, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree_SiblingsIterator = &__pyx_vtable_4lxml_5etree_SiblingsIterator;
  __pyx_vtable_4lxml_5etree_SiblingsIterator.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ElementMatchIterator;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ElementMatchIterator); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3026, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree_SiblingsIterator = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_SiblingsIterator_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_SiblingsIterator)) __PYX_ERR(0, 3026, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_SiblingsIterator_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_SiblingsIterator) < (0)) __PYX_ERR(0, 3026, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_SiblingsIterator = &__pyx_type_4lxml_5etree_SiblingsIterator;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree_SiblingsIterator->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ElementMatchIterator;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_SiblingsIterator) < (0)) __PYX_ERR(0, 3026, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_SiblingsIterator);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_SiblingsIterator->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_SiblingsIterator->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_SiblingsIterator->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree_SiblingsIterator, __pyx_vtabptr_4lxml_5etree_SiblingsIterator) < (0)) __PYX_ERR(0, 3026, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree_SiblingsIterator) < (0)) __PYX_ERR(0, 3026, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_SiblingsIterator, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_SiblingsIterator) < (0)) __PYX_ERR(0, 3026, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree_AncestorsIterator = &__pyx_vtable_4lxml_5etree_AncestorsIterator;
  __pyx_vtable_4lxml_5etree_AncestorsIterator.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ElementMatchIterator;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ElementMatchIterator); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3041, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree_AncestorsIterator = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_AncestorsIterator_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_AncestorsIterator)) __PYX_ERR(0, 3041, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_AncestorsIterator_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_AncestorsIterator) < (0)) __PYX_ERR(0, 3041, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_AncestorsIterator = &__pyx_type_4lxml_5etree_AncestorsIterator;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree_AncestorsIterator->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ElementMatchIterator;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_AncestorsIterator) < (0)) __PYX_ERR(0, 3041, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_AncestorsIterator);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_AncestorsIterator->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_AncestorsIterator->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_AncestorsIterator->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree_AncestorsIterator, __pyx_vtabptr_4lxml_5etree_AncestorsIterator) < (0)) __PYX_ERR(0, 3041, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree_AncestorsIterator) < (0)) __PYX_ERR(0, 3041, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_AncestorsIterator, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_AncestorsIterator) < (0)) __PYX_ERR(0, 3041, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree_ElementDepthFirstIterator = &__pyx_vtable_4lxml_5etree_ElementDepthFirstIterator;
  __pyx_vtable_4lxml_5etree_ElementDepthFirstIterator._nextNodeAnyTag = (xmlNode *(*)(struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *, xmlNode *))__pyx_f_4lxml_5etree_25ElementDepthFirstIterator__nextNodeAnyTag;
  __pyx_vtable_4lxml_5etree_ElementDepthFirstIterator._nextNodeMatchTag = (xmlNode *(*)(struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *, xmlNode *))__pyx_f_4lxml_5etree_25ElementDepthFirstIterator__nextNodeMatchTag;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree_ElementDepthFirstIterator = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_ElementDepthFirstIterator_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_ElementDepthFirstIterator)) __PYX_ERR(0, 3051, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_ElementDepthFirstIterator_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_ElementDepthFirstIterator) < (0)) __PYX_ERR(0, 3051, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_ElementDepthFirstIterator = &__pyx_type_4lxml_5etree_ElementDepthFirstIterator;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_ElementDepthFirstIterator) < (0)) __PYX_ERR(0, 3051, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_ElementDepthFirstIterator);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_ElementDepthFirstIterator->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_ElementDepthFirstIterator->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_ElementDepthFirstIterator->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree_ElementDepthFirstIterator, __pyx_vtabptr_4lxml_5etree_ElementDepthFirstIterator) < (0)) __PYX_ERR(0, 3051, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree_ElementDepthFirstIterator) < (0)) __PYX_ERR(0, 3051, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_ElementDepthFirstIterator, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_ElementDepthFirstIterator) < (0)) __PYX_ERR(0, 3051, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree_ElementTextIterator = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_ElementTextIterator_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_ElementTextIterator)) __PYX_ERR(0, 3128, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_ElementTextIterator_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_ElementTextIterator) < (0)) __PYX_ERR(0, 3128, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_ElementTextIterator = &__pyx_type_4lxml_5etree_ElementTextIterator;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_ElementTextIterator) < (0)) __PYX_ERR(0, 3128, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_ElementTextIterator);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_ElementTextIterator->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_ElementTextIterator->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_ElementTextIterator->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_ElementTextIterator, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_ElementTextIterator) < (0)) __PYX_ERR(0, 3128, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree_CDATA = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_CDATA_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_CDATA)) __PYX_ERR(0, 3271, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_CDATA_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_CDATA) < (0)) __PYX_ERR(0, 3271, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_CDATA = &__pyx_type_4lxml_5etree_CDATA;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_CDATA) < (0)) __PYX_ERR(0, 3271, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_CDATA);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_CDATA->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_CDATA->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_CDATA->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_CDATA_2, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_CDATA) < (0)) __PYX_ERR(0, 3271, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__ReadOnlyProxy = &__pyx_vtable_4lxml_5etree__ReadOnlyProxy;
  __pyx_vtable_4lxml_5etree__ReadOnlyProxy._assertNode = (int (*)(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *))__pyx_f_4lxml_5etree_14_ReadOnlyProxy__assertNode;
  __pyx_vtable_4lxml_5etree__ReadOnlyProxy._raise_unsupported_type = (int (*)(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *))__pyx_f_4lxml_5etree_14_ReadOnlyProxy__raise_unsupported_type;
  __pyx_vtable_4lxml_5etree__ReadOnlyProxy.free_after_use = (void (*)(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *))__pyx_f_4lxml_5etree_14_ReadOnlyProxy_free_after_use;
  __pyx_vtable_4lxml_5etree__ReadOnlyProxy.__pyx___copy__ = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *, int __pyx_skip_dispatch))__pyx_f_4lxml_5etree_14_ReadOnlyProxy___copy__;
  __pyx_vtable_4lxml_5etree__ReadOnlyProxy.getchildren = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *, int __pyx_skip_dispatch))__pyx_f_4lxml_5etree_14_ReadOnlyProxy_getchildren;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree__ReadOnlyProxy = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__ReadOnlyProxy_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__ReadOnlyProxy)) __PYX_ERR(9, 3, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__ReadOnlyProxy_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__ReadOnlyProxy) < (0)) __PYX_ERR(9, 3, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__ReadOnlyProxy = &__pyx_type_4lxml_5etree__ReadOnlyProxy;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__ReadOnlyProxy) < (0)) __PYX_ERR(9, 3, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__ReadOnlyProxy);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__ReadOnlyProxy->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__ReadOnlyProxy->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__ReadOnlyProxy->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_mstate->__pyx_ptype_4lxml_5etree__ReadOnlyProxy, "__getitem__"); if (unlikely(!wrapper)) __PYX_ERR(9, 3, __pyx_L1_error)
    if (__Pyx_IS_TYPE(wrapper, &PyWrapperDescr_Type)) {
      __pyx_wrapperbase_4lxml_5etree_14_ReadOnlyProxy_4__getitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_14_ReadOnlyProxy_4__getitem__.doc = __pyx_doc_4lxml_5etree_14_ReadOnlyProxy_4__getitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_14_ReadOnlyProxy_4__getitem__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_mstate->__pyx_ptype_4lxml_5etree__ReadOnlyProxy, "__len__"); if (unlikely(!wrapper)) __PYX_ERR(9, 3, __pyx_L1_error)
    if (__Pyx_IS_TYPE(wrapper, &PyWrapperDescr_Type)) {
      __pyx_wrapperbase_4lxml_5etree_14_ReadOnlyProxy_6__len__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_14_ReadOnlyProxy_6__len__.doc = __pyx_doc_4lxml_5etree_14_ReadOnlyProxy_6__len__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_14_ReadOnlyProxy_6__len__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree__ReadOnlyProxy, __pyx_vtabptr_4lxml_5etree__ReadOnlyProxy) < (0)) __PYX_ERR(9, 3, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree__ReadOnlyProxy) < (0)) __PYX_ERR(9, 3, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__ReadOnlyPIProxy = &__pyx_vtable_4lxml_5etree__ReadOnlyPIProxy;
  __pyx_vtable_4lxml_5etree__ReadOnlyPIProxy.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ReadOnlyProxy;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ReadOnlyProxy); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 246, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree__ReadOnlyPIProxy = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__ReadOnlyPIProxy_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__ReadOnlyPIProxy)) __PYX_ERR(9, 246, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__ReadOnlyPIProxy_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__ReadOnlyPIProxy) < (0)) __PYX_ERR(9, 246, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__ReadOnlyPIProxy = &__pyx_type_4lxml_5etree__ReadOnlyPIProxy;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ReadOnlyPIProxy->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ReadOnlyProxy;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__ReadOnlyPIProxy) < (0)) __PYX_ERR(9, 246, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__ReadOnlyPIProxy);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__ReadOnlyPIProxy->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__ReadOnlyPIProxy->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__ReadOnlyPIProxy->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree__ReadOnlyPIProxy, __pyx_vtabptr_4lxml_5etree__ReadOnlyPIProxy) < (0)) __PYX_ERR(9, 246, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree__ReadOnlyPIProxy) < (0)) __PYX_ERR(9, 246, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__ReadOnlyEntityProxy = &__pyx_vtable_4lxml_5etree__ReadOnlyEntityProxy;
  __pyx_vtable_4lxml_5etree__ReadOnlyEntityProxy.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ReadOnlyProxy;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ReadOnlyProxy); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 255, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree__ReadOnlyEntityProxy = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__ReadOnlyEntityProxy_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__ReadOnlyEntityProxy)) __PYX_ERR(9, 255, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__ReadOnlyEntityProxy_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__ReadOnlyEntityProxy) < (0)) __PYX_ERR(9, 255, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__ReadOnlyEntityProxy = &__pyx_type_4lxml_5etree__ReadOnlyEntityProxy;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ReadOnlyEntityProxy->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ReadOnlyProxy;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__ReadOnlyEntityProxy) < (0)) __PYX_ERR(9, 255, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__ReadOnlyEntityProxy);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__ReadOnlyEntityProxy->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__ReadOnlyEntityProxy->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__ReadOnlyEntityProxy->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree__ReadOnlyEntityProxy, __pyx_vtabptr_4lxml_5etree__ReadOnlyEntityProxy) < (0)) __PYX_ERR(9, 255, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree__ReadOnlyEntityProxy) < (0)) __PYX_ERR(9, 255, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__ReadOnlyElementProxy = &__pyx_vtable_4lxml_5etree__ReadOnlyElementProxy;
  __pyx_vtable_4lxml_5etree__ReadOnlyElementProxy.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ReadOnlyProxy;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ReadOnlyProxy); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 274, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree__ReadOnlyElementProxy = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__ReadOnlyElementProxy_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__ReadOnlyElementProxy)) __PYX_ERR(9, 274, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__ReadOnlyElementProxy_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__ReadOnlyElementProxy) < (0)) __PYX_ERR(9, 274, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__ReadOnlyElementProxy = &__pyx_type_4lxml_5etree__ReadOnlyElementProxy;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ReadOnlyElementProxy->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ReadOnlyProxy;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__ReadOnlyElementProxy) < (0)) __PYX_ERR(9, 274, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__ReadOnlyElementProxy);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__ReadOnlyElementProxy->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__ReadOnlyElementProxy->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__ReadOnlyElementProxy->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree__ReadOnlyElementProxy, __pyx_vtabptr_4lxml_5etree__ReadOnlyElementProxy) < (0)) __PYX_ERR(9, 274, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree__ReadOnlyElementProxy) < (0)) __PYX_ERR(9, 274, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree__OpaqueNodeWrapper = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__OpaqueNodeWrapper_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__OpaqueNodeWrapper)) __PYX_ERR(9, 375, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__OpaqueNodeWrapper_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__OpaqueNodeWrapper) < (0)) __PYX_ERR(9, 375, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__OpaqueNodeWrapper = &__pyx_type_4lxml_5etree__OpaqueNodeWrapper;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__OpaqueNodeWrapper) < (0)) __PYX_ERR(9, 375, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__OpaqueNodeWrapper);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__OpaqueNodeWrapper->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__OpaqueNodeWrapper->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__OpaqueNodeWrapper->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  __pyx_vtabptr_4lxml_5etree__OpaqueDocumentWrapper = &__pyx_vtable_4lxml_5etree__OpaqueDocumentWrapper;
  __pyx_vtable_4lxml_5etree__OpaqueDocumentWrapper._assertNode = (int (*)(struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper *))__pyx_f_4lxml_5etree_22_OpaqueDocumentWrapper__assertNode;
  __pyx_vtable_4lxml_5etree__OpaqueDocumentWrapper.append = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper *, PyObject *, int __pyx_skip_dispatch))__pyx_f_4lxml_5etree_22_OpaqueDocumentWrapper_append;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__OpaqueNodeWrapper); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 381, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree__OpaqueDocumentWrapper = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__OpaqueDocumentWrapper_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__OpaqueDocumentWrapper)) __PYX_ERR(9, 381, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__OpaqueDocumentWrapper_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__OpaqueDocumentWrapper) < (0)) __PYX_ERR(9, 381, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__OpaqueDocumentWrapper = &__pyx_type_4lxml_5etree__OpaqueDocumentWrapper;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree__OpaqueDocumentWrapper->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree__OpaqueNodeWrapper;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__OpaqueDocumentWrapper) < (0)) __PYX_ERR(9, 381, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__OpaqueDocumentWrapper);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__OpaqueDocumentWrapper->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__OpaqueDocumentWrapper->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__OpaqueDocumentWrapper->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree__OpaqueDocumentWrapper, __pyx_vtabptr_4lxml_5etree__OpaqueDocumentWrapper) < (0)) __PYX_ERR(9, 381, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree__OpaqueDocumentWrapper) < (0)) __PYX_ERR(9, 381, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__ModifyContentOnlyProxy = &__pyx_vtable_4lxml_5etree__ModifyContentOnlyProxy;
  __pyx_vtable_4lxml_5etree__ModifyContentOnlyProxy.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ReadOnlyProxy;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ReadOnlyProxy); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 426, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree__ModifyContentOnlyProxy = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__ModifyContentOnlyProxy_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__ModifyContentOnlyProxy)) __PYX_ERR(9, 426, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__ModifyContentOnlyProxy_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__ModifyContentOnlyProxy) < (0)) __PYX_ERR(9, 426, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__ModifyContentOnlyProxy = &__pyx_type_4lxml_5etree__ModifyContentOnlyProxy;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ModifyContentOnlyProxy->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ReadOnlyProxy;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__ModifyContentOnlyProxy) < (0)) __PYX_ERR(9, 426, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__ModifyContentOnlyProxy);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__ModifyContentOnlyProxy->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__ModifyContentOnlyProxy->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__ModifyContentOnlyProxy->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree__ModifyContentOnlyProxy, __pyx_vtabptr_4lxml_5etree__ModifyContentOnlyProxy) < (0)) __PYX_ERR(9, 426, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree__ModifyContentOnlyProxy) < (0)) __PYX_ERR(9, 426, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__ModifyContentOnlyPIProxy = &__pyx_vtable_4lxml_5etree__ModifyContentOnlyPIProxy;
  __pyx_vtable_4lxml_5etree__ModifyContentOnlyPIProxy.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ModifyContentOnlyProxy;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ModifyContentOnlyProxy); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 448, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree__ModifyContentOnlyPIProxy = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__ModifyContentOnlyPIProxy_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__ModifyContentOnlyPIProxy)) __PYX_ERR(9, 448, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__ModifyContentOnlyPIProxy_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__ModifyContentOnlyPIProxy) < (0)) __PYX_ERR(9, 448, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__ModifyContentOnlyPIProxy = &__pyx_type_4lxml_5etree__ModifyContentOnlyPIProxy;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ModifyContentOnlyPIProxy->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ModifyContentOnlyProxy;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__ModifyContentOnlyPIProxy) < (0)) __PYX_ERR(9, 448, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__ModifyContentOnlyPIProxy);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__ModifyContentOnlyPIProxy->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__ModifyContentOnlyPIProxy->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__ModifyContentOnlyPIProxy->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree__ModifyContentOnlyPIProxy, __pyx_vtabptr_4lxml_5etree__ModifyContentOnlyPIProxy) < (0)) __PYX_ERR(9, 448, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree__ModifyContentOnlyPIProxy) < (0)) __PYX_ERR(9, 448, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__ModifyContentOnlyEntityProxy = &__pyx_vtable_4lxml_5etree__ModifyContentOnlyEntityProxy;
  __pyx_vtable_4lxml_5etree__ModifyContentOnlyEntityProxy.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ModifyContentOnlyProxy;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ModifyContentOnlyProxy); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 465, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree__ModifyContentOnlyEntityProxy = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__ModifyContentOnlyEntityProxy_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__ModifyContentOnlyEntityProxy)) __PYX_ERR(9, 465, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__ModifyContentOnlyEntityProxy_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__ModifyContentOnlyEntityProxy) < (0)) __PYX_ERR(9, 465, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__ModifyContentOnlyEntityProxy = &__pyx_type_4lxml_5etree__ModifyContentOnlyEntityProxy;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ModifyContentOnlyEntityProxy->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ModifyContentOnlyProxy;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__ModifyContentOnlyEntityProxy) < (0)) __PYX_ERR(9, 465, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__ModifyContentOnlyEntityProxy);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__ModifyContentOnlyEntityProxy->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__ModifyContentOnlyEntityProxy->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__ModifyContentOnlyEntityProxy->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree__ModifyContentOnlyEntityProxy, __pyx_vtabptr_4lxml_5etree__ModifyContentOnlyEntityProxy) < (0)) __PYX_ERR(9, 465, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree__ModifyContentOnlyEntityProxy) < (0)) __PYX_ERR(9, 465, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__AppendOnlyElementProxy = &__pyx_vtable_4lxml_5etree__AppendOnlyElementProxy;
  __pyx_vtable_4lxml_5etree__AppendOnlyElementProxy.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ReadOnlyElementProxy;
  __pyx_vtable_4lxml_5etree__AppendOnlyElementProxy.append = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *, PyObject *, int __pyx_skip_dispatch))__pyx_f_4lxml_5etree_23_AppendOnlyElementProxy_append;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ReadOnlyElementProxy); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 481, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree__AppendOnlyElementProxy = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__AppendOnlyElementProxy_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__AppendOnlyElementProxy)) __PYX_ERR(9, 481, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__AppendOnlyElementProxy_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__AppendOnlyElementProxy) < (0)) __PYX_ERR(9, 481, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__AppendOnlyElementProxy = &__pyx_type_4lxml_5etree__AppendOnlyElementProxy;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree__AppendOnlyElementProxy->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ReadOnlyElementProxy;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__AppendOnlyElementProxy) < (0)) __PYX_ERR(9, 481, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__AppendOnlyElementProxy);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__AppendOnlyElementProxy->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__AppendOnlyElementProxy->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__AppendOnlyElementProxy->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree__AppendOnlyElementProxy, __pyx_vtabptr_4lxml_5etree__AppendOnlyElementProxy) < (0)) __PYX_ERR(9, 481, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree__AppendOnlyElementProxy) < (0)) __PYX_ERR(9, 481, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree_ElementBase = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &LxmlElementBaseType_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_ElementBase)) __PYX_ERR(10, 6, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&LxmlElementBaseType_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_ElementBase) < (0)) __PYX_ERR(10, 6, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_ElementBase = &LxmlElementBaseType;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree_ElementBase->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_ElementBase) < (0)) __PYX_ERR(10, 6, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_ElementBase);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_ElementBase->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_ElementBase->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_ElementBase->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_mstate->__pyx_ptype_4lxml_5etree_ElementBase, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(10, 6, __pyx_L1_error)
    if (__Pyx_IS_TYPE(wrapper, &PyWrapperDescr_Type)) {
      __pyx_wrapperbase_4lxml_5etree_11ElementBase___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_11ElementBase___init__.doc = __pyx_doc_4lxml_5etree_11ElementBase___init__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_11ElementBase___init__;
    }
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_ElementBase, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_ElementBase) < (0)) __PYX_ERR(10, 6, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree_CommentBase = &__pyx_vtable_4lxml_5etree_CommentBase;
  __pyx_vtable_4lxml_5etree_CommentBase.__pyx_base = *__pyx_vtabptr_4lxml_5etree__Comment;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Comment); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 97, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree_CommentBase = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_CommentBase_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_CommentBase)) __PYX_ERR(10, 97, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_CommentBase_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_CommentBase) < (0)) __PYX_ERR(10, 97, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_CommentBase = &__pyx_type_4lxml_5etree_CommentBase;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree_CommentBase->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Comment;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_CommentBase) < (0)) __PYX_ERR(10, 97, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_CommentBase);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_CommentBase->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_CommentBase->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_CommentBase->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree_CommentBase, __pyx_vtabptr_4lxml_5etree_CommentBase) < (0)) __PYX_ERR(10, 97, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree_CommentBase) < (0)) __PYX_ERR(10, 97, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_CommentBase, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_CommentBase) < (0)) __PYX_ERR(10, 97, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree_PIBase = &__pyx_vtable_4lxml_5etree_PIBase;
  __pyx_vtable_4lxml_5etree_PIBase.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ProcessingInstruction;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ProcessingInstruction); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 126, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree_PIBase = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_PIBase_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_PIBase)) __PYX_ERR(10, 126, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_PIBase_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_PIBase) < (0)) __PYX_ERR(10, 126, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_PIBase = &__pyx_type_4lxml_5etree_PIBase;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree_PIBase->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ProcessingInstruction;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_PIBase) < (0)) __PYX_ERR(10, 126, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_PIBase);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_PIBase->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_PIBase->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_PIBase->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree_PIBase, __pyx_vtabptr_4lxml_5etree_PIBase) < (0)) __PYX_ERR(10, 126, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree_PIBase) < (0)) __PYX_ERR(10, 126, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_PIBase, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_PIBase) < (0)) __PYX_ERR(10, 126, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree_EntityBase = &__pyx_vtable_4lxml_5etree_EntityBase;
  __pyx_vtable_4lxml_5etree_EntityBase.__pyx_base = *__pyx_vtabptr_4lxml_5etree__Entity;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Entity); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 157, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree_EntityBase = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_EntityBase_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_EntityBase)) __PYX_ERR(10, 157, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_EntityBase_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_EntityBase) < (0)) __PYX_ERR(10, 157, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_EntityBase = &__pyx_type_4lxml_5etree_EntityBase;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree_EntityBase->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Entity;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_EntityBase) < (0)) __PYX_ERR(10, 157, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_EntityBase);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_EntityBase->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_EntityBase->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_EntityBase->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree_EntityBase, __pyx_vtabptr_4lxml_5etree_EntityBase) < (0)) __PYX_ERR(10, 157, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree_EntityBase) < (0)) __PYX_ERR(10, 157, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_EntityBase, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_EntityBase) < (0)) __PYX_ERR(10, 157, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree_ElementClassLookup = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &LxmlElementClassLookupType_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_ElementClassLookup)) __PYX_ERR(10, 213, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&LxmlElementClassLookupType_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_ElementClassLookup) < (0)) __PYX_ERR(10, 213, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_ElementClassLookup = &LxmlElementClassLookupType;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_ElementClassLookup) < (0)) __PYX_ERR(10, 213, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_ElementClassLookup);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_ElementClassLookup->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_ElementClassLookup->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_ElementClassLookup->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_ElementClassLookup, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_ElementClassLookup) < (0)) __PYX_ERR(10, 213, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree_FallbackElementClassLookup = &__pyx_vtable_4lxml_5etree_FallbackElementClassLookup;
  __pyx_vtable_4lxml_5etree_FallbackElementClassLookup._setFallback = (void (*)(struct LxmlFallbackElementClassLookup *, struct LxmlElementClassLookup *))__pyx_f_4lxml_5etree_26FallbackElementClassLookup__setFallback;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_ElementClassLookup); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 221, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree_FallbackElementClassLookup = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &LxmlFallbackElementClassLookupType_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_FallbackElementClassLookup)) __PYX_ERR(10, 221, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&LxmlFallbackElementClassLookupType_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_FallbackElementClassLookup) < (0)) __PYX_ERR(10, 221, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_FallbackElementClassLookup = &LxmlFallbackElementClassLookupType;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree_FallbackElementClassLookup->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree_ElementClassLookup;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_FallbackElementClassLookup) < (0)) __PYX_ERR(10, 221, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_FallbackElementClassLookup);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_FallbackElementClassLookup->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_FallbackElementClassLookup->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_FallbackElementClassLookup->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree_FallbackElementClassLookup, __pyx_vtabptr_4lxml_5etree_FallbackElementClassLookup) < (0)) __PYX_ERR(10, 221, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree_FallbackElementClassLookup) < (0)) __PYX_ERR(10, 221, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_FallbackElementClassLookup, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_FallbackElementClassLookup) < (0)) __PYX_ERR(10, 221, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_ElementClassLookup); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 263, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree_ElementDefaultClassLookup = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_ElementDefaultClassLookup_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_ElementDefaultClassLookup)) __PYX_ERR(10, 263, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_ElementDefaultClassLookup_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_ElementDefaultClassLookup) < (0)) __PYX_ERR(10, 263, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_ElementDefaultClassLookup = &__pyx_type_4lxml_5etree_ElementDefaultClassLookup;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree_ElementDefaultClassLookup->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree_ElementClassLookup;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_ElementDefaultClassLookup) < (0)) __PYX_ERR(10, 263, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_ElementDefaultClassLookup);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_ElementDefaultClassLookup->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_ElementDefaultClassLookup->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_ElementDefaultClassLookup->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_ElementDefaultClassLookup, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_ElementDefaultClassLookup) < (0)) __PYX_ERR(10, 263, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree_AttributeBasedElementClassLookup = &__pyx_vtable_4lxml_5etree_AttributeBasedElementClassLookup;
  __pyx_vtable_4lxml_5etree_AttributeBasedElementClassLookup.__pyx_base = *__pyx_vtabptr_4lxml_5etree_FallbackElementClassLookup;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_FallbackElementClassLookup); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 342, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree_AttributeBasedElementClassLookup = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_AttributeBasedElementClassLookup_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_AttributeBasedElementClassLookup)) __PYX_ERR(10, 342, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_AttributeBasedElementClassLookup_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_AttributeBasedElementClassLookup) < (0)) __PYX_ERR(10, 342, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_AttributeBasedElementClassLookup = &__pyx_type_4lxml_5etree_AttributeBasedElementClassLookup;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree_AttributeBasedElementClassLookup->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree_FallbackElementClassLookup;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_AttributeBasedElementClassLookup) < (0)) __PYX_ERR(10, 342, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_AttributeBasedElementClassLookup);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_AttributeBasedElementClassLookup->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_AttributeBasedElementClassLookup->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_AttributeBasedElementClassLookup->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree_AttributeBasedElementClassLookup, __pyx_vtabptr_4lxml_5etree_AttributeBasedElementClassLookup) < (0)) __PYX_ERR(10, 342, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree_AttributeBasedElementClassLookup) < (0)) __PYX_ERR(10, 342, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_AttributeBasedElementClassLookup, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_AttributeBasedElementClassLookup) < (0)) __PYX_ERR(10, 342, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree_ParserBasedElementClassLookup = &__pyx_vtable_4lxml_5etree_ParserBasedElementClassLookup;
  __pyx_vtable_4lxml_5etree_ParserBasedElementClassLookup.__pyx_base = *__pyx_vtabptr_4lxml_5etree_FallbackElementClassLookup;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_FallbackElementClassLookup); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 394, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree_ParserBasedElementClassLookup = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_ParserBasedElementClassLookup_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_ParserBasedElementClassLookup)) __PYX_ERR(10, 394, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_ParserBasedElementClassLookup_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_ParserBasedElementClassLookup) < (0)) __PYX_ERR(10, 394, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_ParserBasedElementClassLookup = &__pyx_type_4lxml_5etree_ParserBasedElementClassLookup;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree_ParserBasedElementClassLookup->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree_FallbackElementClassLookup;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_ParserBasedElementClassLookup) < (0)) __PYX_ERR(10, 394, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_ParserBasedElementClassLookup);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_ParserBasedElementClassLookup->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_ParserBasedElementClassLookup->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_ParserBasedElementClassLookup->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree_ParserBasedElementClassLookup, __pyx_vtabptr_4lxml_5etree_ParserBasedElementClassLookup) < (0)) __PYX_ERR(10, 394, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree_ParserBasedElementClassLookup) < (0)) __PYX_ERR(10, 394, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_ParserBasedElementClassLookup, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_ParserBasedElementClassLookup) < (0)) __PYX_ERR(10, 394, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree_CustomElementClassLookup = &__pyx_vtable_4lxml_5etree_CustomElementClassLookup;
  __pyx_vtable_4lxml_5etree_CustomElementClassLookup.__pyx_base = *__pyx_vtabptr_4lxml_5etree_FallbackElementClassLookup;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_FallbackElementClassLookup); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 411, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree_CustomElementClassLookup = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_CustomElementClassLookup_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_CustomElementClassLookup)) __PYX_ERR(10, 411, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_CustomElementClassLookup_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_CustomElementClassLookup) < (0)) __PYX_ERR(10, 411, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_CustomElementClassLookup = &__pyx_type_4lxml_5etree_CustomElementClassLookup;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree_CustomElementClassLookup->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree_FallbackElementClassLookup;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_CustomElementClassLookup) < (0)) __PYX_ERR(10, 411, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_CustomElementClassLookup);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_CustomElementClassLookup->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_CustomElementClassLookup->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_CustomElementClassLookup->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree_CustomElementClassLookup, __pyx_vtabptr_4lxml_5etree_CustomElementClassLookup) < (0)) __PYX_ERR(10, 411, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree_CustomElementClassLookup) < (0)) __PYX_ERR(10, 411, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_CustomElementClassLookup, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_CustomElementClassLookup) < (0)) __PYX_ERR(10, 411, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree_PythonElementClassLookup = &__pyx_vtable_4lxml_5etree_PythonElementClassLookup;
  __pyx_vtable_4lxml_5etree_PythonElementClassLookup.__pyx_base = *__pyx_vtabptr_4lxml_5etree_FallbackElementClassLookup;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_FallbackElementClassLookup); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 466, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree_PythonElementClassLookup = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_PythonElementClassLookup_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_PythonElementClassLookup)) __PYX_ERR(10, 466, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_PythonElementClassLookup_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_PythonElementClassLookup) < (0)) __PYX_ERR(10, 466, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_PythonElementClassLookup = &__pyx_type_4lxml_5etree_PythonElementClassLookup;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree_PythonElementClassLookup->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree_FallbackElementClassLookup;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_PythonElementClassLookup) < (0)) __PYX_ERR(10, 466, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_PythonElementClassLookup);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_PythonElementClassLookup->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_PythonElementClassLookup->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_PythonElementClassLookup->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree_PythonElementClassLookup, __pyx_vtabptr_4lxml_5etree_PythonElementClassLookup) < (0)) __PYX_ERR(10, 466, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree_PythonElementClassLookup) < (0)) __PYX_ERR(10, 466, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_PythonElementClassLookup, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_PythonElementClassLookup) < (0)) __PYX_ERR(10, 466, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_LxmlError); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree_LxmlRegistryError = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_LxmlRegistryError_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_LxmlRegistryError)) __PYX_ERR(11, 3, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_LxmlRegistryError_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_LxmlRegistryError) < (0)) __PYX_ERR(11, 3, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_LxmlRegistryError = &__pyx_type_4lxml_5etree_LxmlRegistryError;
  #endif
  if (sizeof(struct __pyx_obj_4lxml_5etree_LxmlRegistryError) != sizeof(PyBaseExceptionObject)) {
    if (__Pyx_validate_extern_base(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_LxmlError) < (0)) __PYX_ERR(11, 3, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree_LxmlRegistryError->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree_LxmlError;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_LxmlRegistryError) < (0)) __PYX_ERR(11, 3, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_LxmlRegistryError);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_LxmlRegistryError->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_LxmlRegistryError->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_LxmlRegistryError->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_LxmlRegistryError, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_LxmlRegistryError) < (0)) __PYX_ERR(11, 3, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_LxmlRegistryError); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree_NamespaceRegistryError = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_NamespaceRegistryError_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_NamespaceRegistryError)) __PYX_ERR(11, 7, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_NamespaceRegistryError_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_NamespaceRegistryError) < (0)) __PYX_ERR(11, 7, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_NamespaceRegistryError = &__pyx_type_4lxml_5etree_NamespaceRegistryError;
  #endif
  if (sizeof(struct __pyx_obj_4lxml_5etree_NamespaceRegistryError) != sizeof(PyBaseExceptionObject)) {
    if (__Pyx_validate_extern_base(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_LxmlRegistryError) < (0)) __PYX_ERR(11, 7, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree_NamespaceRegistryError->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree_LxmlRegistryError;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_NamespaceRegistryError) < (0)) __PYX_ERR(11, 7, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_NamespaceRegistryError);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_NamespaceRegistryError->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_NamespaceRegistryError->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_NamespaceRegistryError->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_NamespaceRegistryError, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_NamespaceRegistryError) < (0)) __PYX_ERR(11, 7, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__NamespaceRegistry = &__pyx_vtable_4lxml_5etree__NamespaceRegistry;
  __pyx_vtable_4lxml_5etree__NamespaceRegistry._get = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *, PyObject *))__pyx_f_4lxml_5etree_18_NamespaceRegistry__get;
  __pyx_vtable_4lxml_5etree__NamespaceRegistry._getForString = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *, char *))__pyx_f_4lxml_5etree_18_NamespaceRegistry__getForString;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree__NamespaceRegistry = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__NamespaceRegistry_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__NamespaceRegistry)) __PYX_ERR(11, 12, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__NamespaceRegistry_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__NamespaceRegistry) < (0)) __PYX_ERR(11, 12, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__NamespaceRegistry = &__pyx_type_4lxml_5etree__NamespaceRegistry;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__NamespaceRegistry) < (0)) __PYX_ERR(11, 12, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__NamespaceRegistry);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__NamespaceRegistry->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__NamespaceRegistry->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__NamespaceRegistry->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree__NamespaceRegistry, __pyx_vtabptr_4lxml_5etree__NamespaceRegistry) < (0)) __PYX_ERR(11, 12, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree__NamespaceRegistry) < (0)) __PYX_ERR(11, 12, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__ClassNamespaceRegistry = &__pyx_vtable_4lxml_5etree__ClassNamespaceRegistry;
  __pyx_vtable_4lxml_5etree__ClassNamespaceRegistry.__pyx_base = *__pyx_vtabptr_4lxml_5etree__NamespaceRegistry;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__NamespaceRegistry); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 104, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree__ClassNamespaceRegistry = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__ClassNamespaceRegistry_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__ClassNamespaceRegistry)) __PYX_ERR(11, 104, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__ClassNamespaceRegistry_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__ClassNamespaceRegistry) < (0)) __PYX_ERR(11, 104, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__ClassNamespaceRegistry = &__pyx_type_4lxml_5etree__ClassNamespaceRegistry;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ClassNamespaceRegistry->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree__NamespaceRegistry;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__ClassNamespaceRegistry) < (0)) __PYX_ERR(11, 104, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__ClassNamespaceRegistry);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__ClassNamespaceRegistry->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__ClassNamespaceRegistry->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__ClassNamespaceRegistry->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree__ClassNamespaceRegistry, __pyx_vtabptr_4lxml_5etree__ClassNamespaceRegistry) < (0)) __PYX_ERR(11, 104, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree__ClassNamespaceRegistry) < (0)) __PYX_ERR(11, 104, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree_ElementNamespaceClassLookup = &__pyx_vtable_4lxml_5etree_ElementNamespaceClassLookup;
  __pyx_vtable_4lxml_5etree_ElementNamespaceClassLookup.__pyx_base = *__pyx_vtabptr_4lxml_5etree_FallbackElementClassLookup;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_FallbackElementClassLookup); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 120, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree_ElementNamespaceClassLookup = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_ElementNamespaceClassLookup_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_ElementNamespaceClassLookup)) __PYX_ERR(11, 120, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_ElementNamespaceClassLookup_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_ElementNamespaceClassLookup) < (0)) __PYX_ERR(11, 120, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_ElementNamespaceClassLookup = &__pyx_type_4lxml_5etree_ElementNamespaceClassLookup;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree_ElementNamespaceClassLookup->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree_FallbackElementClassLookup;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_ElementNamespaceClassLookup) < (0)) __PYX_ERR(11, 120, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_ElementNamespaceClassLookup);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_ElementNamespaceClassLookup->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_ElementNamespaceClassLookup->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_ElementNamespaceClassLookup->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree_ElementNamespaceClassLookup, __pyx_vtabptr_4lxml_5etree_ElementNamespaceClassLookup) < (0)) __PYX_ERR(11, 120, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree_ElementNamespaceClassLookup) < (0)) __PYX_ERR(11, 120, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_ElementNamespaceClassLookup, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_ElementNamespaceClassLookup) < (0)) __PYX_ERR(11, 120, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__FunctionNamespaceRegistry = &__pyx_vtable_4lxml_5etree__FunctionNamespaceRegistry;
  __pyx_vtable_4lxml_5etree__FunctionNamespaceRegistry.__pyx_base = *__pyx_vtabptr_4lxml_5etree__NamespaceRegistry;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__NamespaceRegistry); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 236, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree__FunctionNamespaceRegistry = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__FunctionNamespaceRegistry_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__FunctionNamespaceRegistry)) __PYX_ERR(11, 236, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__FunctionNamespaceRegistry_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__FunctionNamespaceRegistry) < (0)) __PYX_ERR(11, 236, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__FunctionNamespaceRegistry = &__pyx_type_4lxml_5etree__FunctionNamespaceRegistry;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree__FunctionNamespaceRegistry->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree__NamespaceRegistry;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__FunctionNamespaceRegistry) < (0)) __PYX_ERR(11, 236, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__FunctionNamespaceRegistry);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__FunctionNamespaceRegistry->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__FunctionNamespaceRegistry->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__FunctionNamespaceRegistry->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree__FunctionNamespaceRegistry, __pyx_vtabptr_4lxml_5etree__FunctionNamespaceRegistry) < (0)) __PYX_ERR(11, 236, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree__FunctionNamespaceRegistry) < (0)) __PYX_ERR(11, 236, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__XPathFunctionNamespaceRegistry = &__pyx_vtable_4lxml_5etree__XPathFunctionNamespaceRegistry;
  __pyx_vtable_4lxml_5etree__XPathFunctionNamespaceRegistry.__pyx_base = *__pyx_vtabptr_4lxml_5etree__FunctionNamespaceRegistry;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__FunctionNamespaceRegistry); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 250, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree__XPathFunctionNamespaceRegistry = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__XPathFunctionNamespaceRegistry_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__XPathFunctionNamespaceRegistry)) __PYX_ERR(11, 250, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__XPathFunctionNamespaceRegistry_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__XPathFunctionNamespaceRegistry) < (0)) __PYX_ERR(11, 250, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__XPathFunctionNamespaceRegistry = &__pyx_type_4lxml_5etree__XPathFunctionNamespaceRegistry;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree__XPathFunctionNamespaceRegistry->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree__FunctionNamespaceRegistry;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__XPathFunctionNamespaceRegistry) < (0)) __PYX_ERR(11, 250, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__XPathFunctionNamespaceRegistry);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__XPathFunctionNamespaceRegistry->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__XPathFunctionNamespaceRegistry->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__XPathFunctionNamespaceRegistry->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree__XPathFunctionNamespaceRegistry, __pyx_vtabptr_4lxml_5etree__XPathFunctionNamespaceRegistry) < (0)) __PYX_ERR(11, 250, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree__XPathFunctionNamespaceRegistry) < (0)) __PYX_ERR(11, 250, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree__InputDocument = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__InputDocument_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__InputDocument)) __PYX_ERR(12, 10, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__InputDocument_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__InputDocument) < (0)) __PYX_ERR(12, 10, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__InputDocument = &__pyx_type_4lxml_5etree__InputDocument;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__InputDocument) < (0)) __PYX_ERR(12, 10, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__InputDocument);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__InputDocument->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__InputDocument->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__InputDocument->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree_Resolver = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_Resolver_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_Resolver)) __PYX_ERR(12, 23, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_Resolver_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_Resolver) < (0)) __PYX_ERR(12, 23, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_Resolver = &__pyx_type_4lxml_5etree_Resolver;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_Resolver) < (0)) __PYX_ERR(12, 23, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_Resolver);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_Resolver->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_Resolver->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_Resolver->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_Resolver, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_Resolver) < (0)) __PYX_ERR(12, 23, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__ResolverRegistry = &__pyx_vtable_4lxml_5etree__ResolverRegistry;
  __pyx_vtable_4lxml_5etree__ResolverRegistry._copy = (struct __pyx_obj_4lxml_5etree__ResolverRegistry *(*)(struct __pyx_obj_4lxml_5etree__ResolverRegistry *))__pyx_f_4lxml_5etree_17_ResolverRegistry__copy;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree__ResolverRegistry = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__ResolverRegistry_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__ResolverRegistry)) __PYX_ERR(12, 111, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__ResolverRegistry_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__ResolverRegistry) < (0)) __PYX_ERR(12, 111, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__ResolverRegistry = &__pyx_type_4lxml_5etree__ResolverRegistry;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__ResolverRegistry) < (0)) __PYX_ERR(12, 111, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__ResolverRegistry);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__ResolverRegistry->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__ResolverRegistry->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__ResolverRegistry->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree__ResolverRegistry, __pyx_vtabptr_4lxml_5etree__ResolverRegistry) < (0)) __PYX_ERR(12, 111, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree__ResolverRegistry) < (0)) __PYX_ERR(12, 111, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__ResolverContext = &__pyx_vtable_4lxml_5etree__ResolverContext;
  __pyx_vtable_4lxml_5etree__ResolverContext.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ExceptionContext;
  __pyx_vtable_4lxml_5etree__ResolverContext.__pyx_base.clear = (int (*)(struct __pyx_obj_4lxml_5etree__ExceptionContext *))__pyx_f_4lxml_5etree_16_ResolverContext_clear;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ExceptionContext); if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 161, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree__ResolverContext = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__ResolverContext_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__ResolverContext)) __PYX_ERR(12, 161, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__ResolverContext_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__ResolverContext) < (0)) __PYX_ERR(12, 161, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__ResolverContext = &__pyx_type_4lxml_5etree__ResolverContext;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ResolverContext->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ExceptionContext;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__ResolverContext) < (0)) __PYX_ERR(12, 161, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__ResolverContext);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__ResolverContext->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__ResolverContext->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__ResolverContext->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree__ResolverContext, __pyx_vtabptr_4lxml_5etree__ResolverContext) < (0)) __PYX_ERR(12, 161, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree__ResolverContext) < (0)) __PYX_ERR(12, 161, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_LxmlError); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 42, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree_ParserError = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_ParserError_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_ParserError)) __PYX_ERR(2, 42, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_ParserError_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_ParserError) < (0)) __PYX_ERR(2, 42, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_ParserError = &__pyx_type_4lxml_5etree_ParserError;
  #endif
  if (sizeof(struct __pyx_obj_4lxml_5etree_ParserError) != sizeof(PyBaseExceptionObject)) {
    if (__Pyx_validate_extern_base(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_LxmlError) < (0)) __PYX_ERR(2, 42, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree_ParserError->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree_LxmlError;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_ParserError) < (0)) __PYX_ERR(2, 42, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_ParserError);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_ParserError->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_ParserError->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_ParserError->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_ParserError, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_ParserError) < (0)) __PYX_ERR(2, 42, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__ParserDictionaryContext = &__pyx_vtable_4lxml_5etree__ParserDictionaryContext;
  __pyx_vtable_4lxml_5etree__ParserDictionaryContext.initMainParserContext = (int (*)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *))__pyx_f_4lxml_5etree_24_ParserDictionaryContext_initMainParserContext;
  __pyx_vtable_4lxml_5etree__ParserDictionaryContext._findThreadParserContext = (struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *(*)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *))__pyx_f_4lxml_5etree_24_ParserDictionaryContext__findThreadParserContext;
  __pyx_vtable_4lxml_5etree__ParserDictionaryContext.setDefaultParser = (int (*)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, struct __pyx_obj_4lxml_5etree__BaseParser *))__pyx_f_4lxml_5etree_24_ParserDictionaryContext_setDefaultParser;
  __pyx_vtable_4lxml_5etree__ParserDictionaryContext.getDefaultParser = (struct __pyx_obj_4lxml_5etree__BaseParser *(*)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *))__pyx_f_4lxml_5etree_24_ParserDictionaryContext_getDefaultParser;
  __pyx_vtable_4lxml_5etree__ParserDictionaryContext._getThreadDict = (xmlDict *(*)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, xmlDict *))__pyx_f_4lxml_5etree_24_ParserDictionaryContext__getThreadDict;
  __pyx_vtable_4lxml_5etree__ParserDictionaryContext.initThreadDictRef = (int (*)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, xmlDict **))__pyx_f_4lxml_5etree_24_ParserDictionaryContext_initThreadDictRef;
  __pyx_vtable_4lxml_5etree__ParserDictionaryContext.initParserDict = (int (*)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, xmlParserCtxt *))__pyx_f_4lxml_5etree_24_ParserDictionaryContext_initParserDict;
  __pyx_vtable_4lxml_5etree__ParserDictionaryContext.initXPathParserDict = (int (*)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, xmlXPathContext *))__pyx_f_4lxml_5etree_24_ParserDictionaryContext_initXPathParserDict;
  __pyx_vtable_4lxml_5etree__ParserDictionaryContext.initDocDict = (int (*)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, xmlDoc *))__pyx_f_4lxml_5etree_24_ParserDictionaryContext_initDocDict;
  __pyx_vtable_4lxml_5etree__ParserDictionaryContext.findImpliedContext = (struct __pyx_obj_4lxml_5etree__ParserContext *(*)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *))__pyx_f_4lxml_5etree_24_ParserDictionaryContext_findImpliedContext;
  __pyx_vtable_4lxml_5etree__ParserDictionaryContext.pushImpliedContextFromParser = (int (*)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, struct __pyx_obj_4lxml_5etree__BaseParser *))__pyx_f_4lxml_5etree_24_ParserDictionaryContext_pushImpliedContextFromParser;
  __pyx_vtable_4lxml_5etree__ParserDictionaryContext.pushImpliedContext = (int (*)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, struct __pyx_obj_4lxml_5etree__ParserContext *))__pyx_f_4lxml_5etree_24_ParserDictionaryContext_pushImpliedContext;
  __pyx_vtable_4lxml_5etree__ParserDictionaryContext.popImpliedContext = (int (*)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *))__pyx_f_4lxml_5etree_24_ParserDictionaryContext_popImpliedContext;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree__ParserDictionaryContext = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__ParserDictionaryContext_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__ParserDictionaryContext)) __PYX_ERR(2, 47, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__ParserDictionaryContext_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__ParserDictionaryContext) < (0)) __PYX_ERR(2, 47, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__ParserDictionaryContext = &__pyx_type_4lxml_5etree__ParserDictionaryContext;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__ParserDictionaryContext) < (0)) __PYX_ERR(2, 47, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__ParserDictionaryContext);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__ParserDictionaryContext->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__ParserDictionaryContext->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__ParserDictionaryContext->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree__ParserDictionaryContext, __pyx_vtabptr_4lxml_5etree__ParserDictionaryContext) < (0)) __PYX_ERR(2, 47, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree__ParserDictionaryContext) < (0)) __PYX_ERR(2, 47, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__FileReaderContext = &__pyx_vtable_4lxml_5etree__FileReaderContext;
  __pyx_vtable_4lxml_5etree__FileReaderContext._close_file = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__FileReaderContext *))__pyx_f_4lxml_5etree_18_FileReaderContext__close_file;
  __pyx_vtable_4lxml_5etree__FileReaderContext._createParserInputBuffer = (xmlParserInputBuffer *(*)(struct __pyx_obj_4lxml_5etree__FileReaderContext *))__pyx_f_4lxml_5etree_18_FileReaderContext__createParserInputBuffer;
  __pyx_vtable_4lxml_5etree__FileReaderContext._createParserInput = (xmlParserInput *(*)(struct __pyx_obj_4lxml_5etree__FileReaderContext *, xmlParserCtxt *))__pyx_f_4lxml_5etree_18_FileReaderContext__createParserInput;
  __pyx_vtable_4lxml_5etree__FileReaderContext._readDtd = (xmlDtd *(*)(struct __pyx_obj_4lxml_5etree__FileReaderContext *))__pyx_f_4lxml_5etree_18_FileReaderContext__readDtd;
  __pyx_vtable_4lxml_5etree__FileReaderContext._readDoc = (xmlDoc *(*)(struct __pyx_obj_4lxml_5etree__FileReaderContext *, xmlParserCtxt *, int))__pyx_f_4lxml_5etree_18_FileReaderContext__readDoc;
  __pyx_vtable_4lxml_5etree__FileReaderContext.copyToBuffer = (int (*)(struct __pyx_obj_4lxml_5etree__FileReaderContext *, char *, int))__pyx_f_4lxml_5etree_18_FileReaderContext_copyToBuffer;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree__FileReaderContext = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__FileReaderContext_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__FileReaderContext)) __PYX_ERR(2, 288, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__FileReaderContext_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__FileReaderContext) < (0)) __PYX_ERR(2, 288, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__FileReaderContext = &__pyx_type_4lxml_5etree__FileReaderContext;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__FileReaderContext) < (0)) __PYX_ERR(2, 288, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__FileReaderContext);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__FileReaderContext->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__FileReaderContext->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__FileReaderContext->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree__FileReaderContext, __pyx_vtabptr_4lxml_5etree__FileReaderContext) < (0)) __PYX_ERR(2, 288, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree__FileReaderContext) < (0)) __PYX_ERR(2, 288, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__ParserContext = &__pyx_vtable_4lxml_5etree__ParserContext;
  __pyx_vtable_4lxml_5etree__ParserContext.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ResolverContext;
  __pyx_vtable_4lxml_5etree__ParserContext._copy = (struct __pyx_obj_4lxml_5etree__ParserContext *(*)(struct __pyx_obj_4lxml_5etree__ParserContext *))__pyx_f_4lxml_5etree_14_ParserContext__copy;
  __pyx_vtable_4lxml_5etree__ParserContext._initParserContext = (void (*)(struct __pyx_obj_4lxml_5etree__ParserContext *, xmlParserCtxt *))__pyx_f_4lxml_5etree_14_ParserContext__initParserContext;
  __pyx_vtable_4lxml_5etree__ParserContext._resetParserContext = (void (*)(struct __pyx_obj_4lxml_5etree__ParserContext *))__pyx_f_4lxml_5etree_14_ParserContext__resetParserContext;
  __pyx_vtable_4lxml_5etree__ParserContext.prepare = (int (*)(struct __pyx_obj_4lxml_5etree__ParserContext *, struct __pyx_opt_args_4lxml_5etree_14_ParserContext_prepare *__pyx_optional_args))__pyx_f_4lxml_5etree_14_ParserContext_prepare;
  __pyx_vtable_4lxml_5etree__ParserContext.cleanup = (int (*)(struct __pyx_obj_4lxml_5etree__ParserContext *))__pyx_f_4lxml_5etree_14_ParserContext_cleanup;
  __pyx_vtable_4lxml_5etree__ParserContext._handleParseResult = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__ParserContext *, struct __pyx_obj_4lxml_5etree__BaseParser *, xmlDoc *, PyObject *))__pyx_f_4lxml_5etree_14_ParserContext__handleParseResult;
  __pyx_vtable_4lxml_5etree__ParserContext._handleParseResultDoc = (xmlDoc *(*)(struct __pyx_obj_4lxml_5etree__ParserContext *, struct __pyx_obj_4lxml_5etree__BaseParser *, xmlDoc *, PyObject *))__pyx_f_4lxml_5etree_14_ParserContext__handleParseResultDoc;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ResolverContext); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 541, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree__ParserContext = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__ParserContext_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__ParserContext)) __PYX_ERR(2, 541, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__ParserContext_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__ParserContext) < (0)) __PYX_ERR(2, 541, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__ParserContext = &__pyx_type_4lxml_5etree__ParserContext;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ParserContext->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ResolverContext;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__ParserContext) < (0)) __PYX_ERR(2, 541, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__ParserContext);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__ParserContext->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__ParserContext->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__ParserContext->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree__ParserContext, __pyx_vtabptr_4lxml_5etree__ParserContext) < (0)) __PYX_ERR(2, 541, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree__ParserContext) < (0)) __PYX_ERR(2, 541, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__BaseParser = &__pyx_vtable_4lxml_5etree__BaseParser;
  __pyx_vtable_4lxml_5etree__BaseParser._setBaseURL = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseParser *, PyObject *))__pyx_f_4lxml_5etree_11_BaseParser__setBaseURL;
  __pyx_vtable_4lxml_5etree__BaseParser._collectEvents = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseParser *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_11_BaseParser__collectEvents;
  __pyx_vtable_4lxml_5etree__BaseParser._getParserContext = (struct __pyx_obj_4lxml_5etree__ParserContext *(*)(struct __pyx_obj_4lxml_5etree__BaseParser *))__pyx_f_4lxml_5etree_11_BaseParser__getParserContext;
  __pyx_vtable_4lxml_5etree__BaseParser._getPushParserContext = (struct __pyx_obj_4lxml_5etree__ParserContext *(*)(struct __pyx_obj_4lxml_5etree__BaseParser *))__pyx_f_4lxml_5etree_11_BaseParser__getPushParserContext;
  __pyx_vtable_4lxml_5etree__BaseParser._createContext = (struct __pyx_obj_4lxml_5etree__ParserContext *(*)(struct __pyx_obj_4lxml_5etree__BaseParser *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_11_BaseParser__createContext;
  __pyx_vtable_4lxml_5etree__BaseParser._configureSaxContext = (int (*)(struct __pyx_obj_4lxml_5etree__BaseParser *, xmlParserCtxt *))__pyx_f_4lxml_5etree_11_BaseParser__configureSaxContext;
  __pyx_vtable_4lxml_5etree__BaseParser._registerHtmlErrorHandler = (int (*)(struct __pyx_obj_4lxml_5etree__BaseParser *, xmlParserCtxt *))__pyx_f_4lxml_5etree_11_BaseParser__registerHtmlErrorHandler;
  __pyx_vtable_4lxml_5etree__BaseParser._newParserCtxt = (xmlParserCtxt *(*)(struct __pyx_obj_4lxml_5etree__BaseParser *))__pyx_f_4lxml_5etree_11_BaseParser__newParserCtxt;
  __pyx_vtable_4lxml_5etree__BaseParser._newPushParserCtxt = (xmlParserCtxt *(*)(struct __pyx_obj_4lxml_5etree__BaseParser *))__pyx_f_4lxml_5etree_11_BaseParser__newPushParserCtxt;
  __pyx_vtable_4lxml_5etree__BaseParser._copy = (struct __pyx_obj_4lxml_5etree__BaseParser *(*)(struct __pyx_obj_4lxml_5etree__BaseParser *))__pyx_f_4lxml_5etree_11_BaseParser__copy;
  __pyx_vtable_4lxml_5etree__BaseParser._parseUnicodeDoc = (xmlDoc *(*)(struct __pyx_obj_4lxml_5etree__BaseParser *, PyObject *, char *))__pyx_f_4lxml_5etree_11_BaseParser__parseUnicodeDoc;
  __pyx_vtable_4lxml_5etree__BaseParser._parseDoc = (xmlDoc *(*)(struct __pyx_obj_4lxml_5etree__BaseParser *, char const *, int, char *))__pyx_f_4lxml_5etree_11_BaseParser__parseDoc;
  __pyx_vtable_4lxml_5etree__BaseParser._parseDocFromFile = (xmlDoc *(*)(struct __pyx_obj_4lxml_5etree__BaseParser *, char *))__pyx_f_4lxml_5etree_11_BaseParser__parseDocFromFile;
  __pyx_vtable_4lxml_5etree__BaseParser._parseDocFromFilelike = (xmlDoc *(*)(struct __pyx_obj_4lxml_5etree__BaseParser *, PyObject *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_11_BaseParser__parseDocFromFilelike;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree__BaseParser = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__BaseParser_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__BaseParser)) __PYX_ERR(2, 835, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__BaseParser_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__BaseParser) < (0)) __PYX_ERR(2, 835, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__BaseParser = &__pyx_type_4lxml_5etree__BaseParser;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__BaseParser) < (0)) __PYX_ERR(2, 835, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__BaseParser);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__BaseParser->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__BaseParser->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__BaseParser->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree__BaseParser, __pyx_vtabptr_4lxml_5etree__BaseParser) < (0)) __PYX_ERR(2, 835, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree__BaseParser) < (0)) __PYX_ERR(2, 835, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__FeedParser = &__pyx_vtable_4lxml_5etree__FeedParser;
  __pyx_vtable_4lxml_5etree__FeedParser.__pyx_base = *__pyx_vtabptr_4lxml_5etree__BaseParser;
  __pyx_vtable_4lxml_5etree__FeedParser.feed = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__FeedParser *, PyObject *, int __pyx_skip_dispatch))__pyx_f_4lxml_5etree_11_FeedParser_feed;
  __pyx_vtable_4lxml_5etree__FeedParser.close = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__FeedParser *, int __pyx_skip_dispatch))__pyx_f_4lxml_5etree_11_FeedParser_close;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__BaseParser); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1349, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree__FeedParser = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__FeedParser_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__FeedParser)) __PYX_ERR(2, 1349, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__FeedParser_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__FeedParser) < (0)) __PYX_ERR(2, 1349, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__FeedParser = &__pyx_type_4lxml_5etree__FeedParser;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree__FeedParser->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree__BaseParser;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__FeedParser) < (0)) __PYX_ERR(2, 1349, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__FeedParser);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__FeedParser->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__FeedParser->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__FeedParser->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree__FeedParser, __pyx_vtabptr_4lxml_5etree__FeedParser) < (0)) __PYX_ERR(2, 1349, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree__FeedParser) < (0)) __PYX_ERR(2, 1349, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_FeedParser, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree__FeedParser) < (0)) __PYX_ERR(2, 1349, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree_XMLParser = &__pyx_vtable_4lxml_5etree_XMLParser;
  __pyx_vtable_4lxml_5etree_XMLParser.__pyx_base = *__pyx_vtabptr_4lxml_5etree__FeedParser;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__FeedParser); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1583, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree_XMLParser = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_XMLParser_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_XMLParser)) __PYX_ERR(2, 1583, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_XMLParser_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_XMLParser) < (0)) __PYX_ERR(2, 1583, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_XMLParser = &__pyx_type_4lxml_5etree_XMLParser;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XMLParser->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree__FeedParser;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_XMLParser) < (0)) __PYX_ERR(2, 1583, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_XMLParser);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_XMLParser->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_XMLParser->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_XMLParser->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree_XMLParser, __pyx_vtabptr_4lxml_5etree_XMLParser) < (0)) __PYX_ERR(2, 1583, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree_XMLParser) < (0)) __PYX_ERR(2, 1583, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_XMLParser, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_XMLParser) < (0)) __PYX_ERR(2, 1583, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree_XMLPullParser = &__pyx_vtable_4lxml_5etree_XMLPullParser;
  __pyx_vtable_4lxml_5etree_XMLPullParser.__pyx_base = *__pyx_vtabptr_4lxml_5etree_XMLParser;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XMLParser); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1687, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree_XMLPullParser = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_XMLPullParser_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_XMLPullParser)) __PYX_ERR(2, 1687, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_XMLPullParser_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_XMLPullParser) < (0)) __PYX_ERR(2, 1687, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_XMLPullParser = &__pyx_type_4lxml_5etree_XMLPullParser;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XMLPullParser->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XMLParser;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_XMLPullParser) < (0)) __PYX_ERR(2, 1687, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_XMLPullParser);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_XMLPullParser->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_XMLPullParser->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_XMLPullParser->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree_XMLPullParser, __pyx_vtabptr_4lxml_5etree_XMLPullParser) < (0)) __PYX_ERR(2, 1687, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree_XMLPullParser) < (0)) __PYX_ERR(2, 1687, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_XMLPullParser, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_XMLPullParser) < (0)) __PYX_ERR(2, 1687, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree_ETCompatXMLParser = &__pyx_vtable_4lxml_5etree_ETCompatXMLParser;
  __pyx_vtable_4lxml_5etree_ETCompatXMLParser.__pyx_base = *__pyx_vtabptr_4lxml_5etree_XMLParser;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XMLParser); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1716, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree_ETCompatXMLParser = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_ETCompatXMLParser_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_ETCompatXMLParser)) __PYX_ERR(2, 1716, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_ETCompatXMLParser_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_ETCompatXMLParser) < (0)) __PYX_ERR(2, 1716, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_ETCompatXMLParser = &__pyx_type_4lxml_5etree_ETCompatXMLParser;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree_ETCompatXMLParser->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XMLParser;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_ETCompatXMLParser) < (0)) __PYX_ERR(2, 1716, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_ETCompatXMLParser);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_ETCompatXMLParser->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_ETCompatXMLParser->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_ETCompatXMLParser->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree_ETCompatXMLParser, __pyx_vtabptr_4lxml_5etree_ETCompatXMLParser) < (0)) __PYX_ERR(2, 1716, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree_ETCompatXMLParser) < (0)) __PYX_ERR(2, 1716, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_ETCompatXMLParser, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_ETCompatXMLParser) < (0)) __PYX_ERR(2, 1716, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree_HTMLParser = &__pyx_vtable_4lxml_5etree_HTMLParser;
  __pyx_vtable_4lxml_5etree_HTMLParser.__pyx_base = *__pyx_vtabptr_4lxml_5etree__FeedParser;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__FeedParser); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1799, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree_HTMLParser = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_HTMLParser_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_HTMLParser)) __PYX_ERR(2, 1799, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_HTMLParser_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_HTMLParser) < (0)) __PYX_ERR(2, 1799, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_HTMLParser = &__pyx_type_4lxml_5etree_HTMLParser;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree_HTMLParser->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree__FeedParser;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_HTMLParser) < (0)) __PYX_ERR(2, 1799, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_HTMLParser);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_HTMLParser->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_HTMLParser->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_HTMLParser->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree_HTMLParser, __pyx_vtabptr_4lxml_5etree_HTMLParser) < (0)) __PYX_ERR(2, 1799, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree_HTMLParser) < (0)) __PYX_ERR(2, 1799, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_HTMLParser, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_HTMLParser) < (0)) __PYX_ERR(2, 1799, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree_HTMLPullParser = &__pyx_vtable_4lxml_5etree_HTMLPullParser;
  __pyx_vtable_4lxml_5etree_HTMLPullParser.__pyx_base = *__pyx_vtabptr_4lxml_5etree_HTMLParser;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_HTMLParser); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1876, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree_HTMLPullParser = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_HTMLPullParser_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_HTMLPullParser)) __PYX_ERR(2, 1876, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_HTMLPullParser_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_HTMLPullParser) < (0)) __PYX_ERR(2, 1876, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_HTMLPullParser = &__pyx_type_4lxml_5etree_HTMLPullParser;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree_HTMLPullParser->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree_HTMLParser;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_HTMLPullParser) < (0)) __PYX_ERR(2, 1876, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_HTMLPullParser);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_HTMLPullParser->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_HTMLPullParser->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_HTMLPullParser->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree_HTMLPullParser, __pyx_vtabptr_4lxml_5etree_HTMLPullParser) < (0)) __PYX_ERR(2, 1876, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree_HTMLPullParser) < (0)) __PYX_ERR(2, 1876, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_HTMLPullParser, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_HTMLPullParser) < (0)) __PYX_ERR(2, 1876, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__SaxParserTarget = &__pyx_vtable_4lxml_5etree__SaxParserTarget;
  __pyx_vtable_4lxml_5etree__SaxParserTarget._handleSaxStart = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_16_SaxParserTarget__handleSaxStart;
  __pyx_vtable_4lxml_5etree__SaxParserTarget._handleSaxEnd = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *))__pyx_f_4lxml_5etree_16_SaxParserTarget__handleSaxEnd;
  __pyx_vtable_4lxml_5etree__SaxParserTarget._handleSaxData = (int (*)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *))__pyx_f_4lxml_5etree_16_SaxParserTarget__handleSaxData;
  __pyx_vtable_4lxml_5etree__SaxParserTarget._handleSaxDoctype = (int (*)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_16_SaxParserTarget__handleSaxDoctype;
  __pyx_vtable_4lxml_5etree__SaxParserTarget._handleSaxPi = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_16_SaxParserTarget__handleSaxPi;
  __pyx_vtable_4lxml_5etree__SaxParserTarget._handleSaxComment = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *))__pyx_f_4lxml_5etree_16_SaxParserTarget__handleSaxComment;
  __pyx_vtable_4lxml_5etree__SaxParserTarget._handleSaxStartNs = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_16_SaxParserTarget__handleSaxStartNs;
  __pyx_vtable_4lxml_5etree__SaxParserTarget._handleSaxEndNs = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *))__pyx_f_4lxml_5etree_16_SaxParserTarget__handleSaxEndNs;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree__SaxParserTarget = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__SaxParserTarget_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__SaxParserTarget)) __PYX_ERR(5, 53, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__SaxParserTarget_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__SaxParserTarget) < (0)) __PYX_ERR(5, 53, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__SaxParserTarget = &__pyx_type_4lxml_5etree__SaxParserTarget;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__SaxParserTarget) < (0)) __PYX_ERR(5, 53, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__SaxParserTarget);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__SaxParserTarget->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__SaxParserTarget->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__SaxParserTarget->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree__SaxParserTarget, __pyx_vtabptr_4lxml_5etree__SaxParserTarget) < (0)) __PYX_ERR(5, 53, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree__SaxParserTarget) < (0)) __PYX_ERR(5, 53, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_SaxParserTarget, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree__SaxParserTarget) < (0)) __PYX_ERR(5, 53, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__SaxParserContext = &__pyx_vtable_4lxml_5etree__SaxParserContext;
  __pyx_vtable_4lxml_5etree__SaxParserContext.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ParserContext;
  __pyx_vtable_4lxml_5etree__SaxParserContext.__pyx_base._initParserContext = (void (*)(struct __pyx_obj_4lxml_5etree__ParserContext *, xmlParserCtxt *))__pyx_f_4lxml_5etree_17_SaxParserContext__initParserContext;
  __pyx_vtable_4lxml_5etree__SaxParserContext._setSaxParserTarget = (void (*)(struct __pyx_obj_4lxml_5etree__SaxParserContext *, struct __pyx_obj_4lxml_5etree__SaxParserTarget *))__pyx_f_4lxml_5etree_17_SaxParserContext__setSaxParserTarget;
  __pyx_vtable_4lxml_5etree__SaxParserContext._connectTarget = (void (*)(struct __pyx_obj_4lxml_5etree__SaxParserContext *, xmlParserCtxt *))__pyx_f_4lxml_5etree_17_SaxParserContext__connectTarget;
  __pyx_vtable_4lxml_5etree__SaxParserContext._connectEvents = (void (*)(struct __pyx_obj_4lxml_5etree__SaxParserContext *, xmlParserCtxt *))__pyx_f_4lxml_5etree_17_SaxParserContext__connectEvents;
  __pyx_vtable_4lxml_5etree__SaxParserContext._setEventFilter = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__SaxParserContext *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_17_SaxParserContext__setEventFilter;
  __pyx_vtable_4lxml_5etree__SaxParserContext.startDocument = (int (*)(struct __pyx_obj_4lxml_5etree__SaxParserContext *, xmlDoc *))__pyx_f_4lxml_5etree_17_SaxParserContext_startDocument;
  __pyx_vtable_4lxml_5etree__SaxParserContext.pushEvent = (int (*)(struct __pyx_obj_4lxml_5etree__SaxParserContext *, PyObject *, xmlNode *))__pyx_f_4lxml_5etree_17_SaxParserContext_pushEvent;
  __pyx_vtable_4lxml_5etree__SaxParserContext.flushEvents = (int (*)(struct __pyx_obj_4lxml_5etree__SaxParserContext *))__pyx_f_4lxml_5etree_17_SaxParserContext_flushEvents;
  __pyx_vtable_4lxml_5etree__SaxParserContext._handleSaxException = (void (*)(struct __pyx_obj_4lxml_5etree__SaxParserContext *, xmlParserCtxt *))__pyx_f_4lxml_5etree_17_SaxParserContext__handleSaxException;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ParserContext); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 75, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree__SaxParserContext = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__SaxParserContext_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__SaxParserContext)) __PYX_ERR(5, 75, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__SaxParserContext_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__SaxParserContext) < (0)) __PYX_ERR(5, 75, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__SaxParserContext = &__pyx_type_4lxml_5etree__SaxParserContext;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree__SaxParserContext->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ParserContext;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__SaxParserContext) < (0)) __PYX_ERR(5, 75, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__SaxParserContext);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__SaxParserContext->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__SaxParserContext->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__SaxParserContext->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree__SaxParserContext, __pyx_vtabptr_4lxml_5etree__SaxParserContext) < (0)) __PYX_ERR(5, 75, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree__SaxParserContext) < (0)) __PYX_ERR(5, 75, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree__ParseEventsIterator = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__ParseEventsIterator_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__ParseEventsIterator)) __PYX_ERR(5, 251, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__ParseEventsIterator_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__ParseEventsIterator) < (0)) __PYX_ERR(5, 251, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__ParseEventsIterator = &__pyx_type_4lxml_5etree__ParseEventsIterator;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__ParseEventsIterator) < (0)) __PYX_ERR(5, 251, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__ParseEventsIterator);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__ParseEventsIterator->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__ParseEventsIterator->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__ParseEventsIterator->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  __pyx_vtabptr_4lxml_5etree_TreeBuilder = &__pyx_vtable_4lxml_5etree_TreeBuilder;
  __pyx_vtable_4lxml_5etree_TreeBuilder.__pyx_base = *__pyx_vtabptr_4lxml_5etree__SaxParserTarget;
  __pyx_vtable_4lxml_5etree_TreeBuilder.__pyx_base._handleSaxStart = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_11TreeBuilder__handleSaxStart;
  __pyx_vtable_4lxml_5etree_TreeBuilder.__pyx_base._handleSaxEnd = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *))__pyx_f_4lxml_5etree_11TreeBuilder__handleSaxEnd;
  __pyx_vtable_4lxml_5etree_TreeBuilder.__pyx_base._handleSaxData = (int (*)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *))__pyx_f_4lxml_5etree_11TreeBuilder__handleSaxData;
  __pyx_vtable_4lxml_5etree_TreeBuilder.__pyx_base._handleSaxPi = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_11TreeBuilder__handleSaxPi;
  __pyx_vtable_4lxml_5etree_TreeBuilder.__pyx_base._handleSaxComment = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *))__pyx_f_4lxml_5etree_11TreeBuilder__handleSaxComment;
  __pyx_vtable_4lxml_5etree_TreeBuilder._flush = (int (*)(struct __pyx_obj_4lxml_5etree_TreeBuilder *))__pyx_f_4lxml_5etree_11TreeBuilder__flush;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__SaxParserTarget); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 708, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree_TreeBuilder = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_TreeBuilder_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_TreeBuilder)) __PYX_ERR(5, 708, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_TreeBuilder_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_TreeBuilder) < (0)) __PYX_ERR(5, 708, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_TreeBuilder = &__pyx_type_4lxml_5etree_TreeBuilder;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree_TreeBuilder->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree__SaxParserTarget;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_TreeBuilder) < (0)) __PYX_ERR(5, 708, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_TreeBuilder);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_TreeBuilder->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_TreeBuilder->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_TreeBuilder->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree_TreeBuilder, __pyx_vtabptr_4lxml_5etree_TreeBuilder) < (0)) __PYX_ERR(5, 708, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree_TreeBuilder) < (0)) __PYX_ERR(5, 708, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_TreeBuilder, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_TreeBuilder) < (0)) __PYX_ERR(5, 708, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__PythonSaxParserTarget = &__pyx_vtable_4lxml_5etree__PythonSaxParserTarget;
  __pyx_vtable_4lxml_5etree__PythonSaxParserTarget.__pyx_base = *__pyx_vtabptr_4lxml_5etree__SaxParserTarget;
  __pyx_vtable_4lxml_5etree__PythonSaxParserTarget.__pyx_base._handleSaxStart = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxStart;
  __pyx_vtable_4lxml_5etree__PythonSaxParserTarget.__pyx_base._handleSaxEnd = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *))__pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxEnd;
  __pyx_vtable_4lxml_5etree__PythonSaxParserTarget.__pyx_base._handleSaxData = (int (*)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *))__pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxData;
  __pyx_vtable_4lxml_5etree__PythonSaxParserTarget.__pyx_base._handleSaxDoctype = (int (*)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxDoctype;
  __pyx_vtable_4lxml_5etree__PythonSaxParserTarget.__pyx_base._handleSaxPi = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxPi;
  __pyx_vtable_4lxml_5etree__PythonSaxParserTarget.__pyx_base._handleSaxComment = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *))__pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxComment;
  __pyx_vtable_4lxml_5etree__PythonSaxParserTarget.__pyx_base._handleSaxStartNs = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxStartNs;
  __pyx_vtable_4lxml_5etree__PythonSaxParserTarget.__pyx_base._handleSaxEndNs = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *))__pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxEndNs;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__SaxParserTarget); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 18, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree__PythonSaxParserTarget = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__PythonSaxParserTarget_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__PythonSaxParserTarget)) __PYX_ERR(13, 18, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__PythonSaxParserTarget_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__PythonSaxParserTarget) < (0)) __PYX_ERR(13, 18, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__PythonSaxParserTarget = &__pyx_type_4lxml_5etree__PythonSaxParserTarget;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree__PythonSaxParserTarget->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree__SaxParserTarget;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__PythonSaxParserTarget) < (0)) __PYX_ERR(13, 18, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__PythonSaxParserTarget);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__PythonSaxParserTarget->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__PythonSaxParserTarget->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__PythonSaxParserTarget->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree__PythonSaxParserTarget, __pyx_vtabptr_4lxml_5etree__PythonSaxParserTarget) < (0)) __PYX_ERR(13, 18, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree__PythonSaxParserTarget) < (0)) __PYX_ERR(13, 18, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__TargetParserContext = &__pyx_vtable_4lxml_5etree__TargetParserContext;
  __pyx_vtable_4lxml_5etree__TargetParserContext.__pyx_base = *__pyx_vtabptr_4lxml_5etree__SaxParserContext;
  __pyx_vtable_4lxml_5etree__TargetParserContext.__pyx_base.__pyx_base._copy = (struct __pyx_obj_4lxml_5etree__ParserContext *(*)(struct __pyx_obj_4lxml_5etree__ParserContext *))__pyx_f_4lxml_5etree_20_TargetParserContext__copy;
  __pyx_vtable_4lxml_5etree__TargetParserContext.__pyx_base.__pyx_base._handleParseResult = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__ParserContext *, struct __pyx_obj_4lxml_5etree__BaseParser *, xmlDoc *, PyObject *))__pyx_f_4lxml_5etree_20_TargetParserContext__handleParseResult;
  __pyx_vtable_4lxml_5etree__TargetParserContext.__pyx_base.__pyx_base._handleParseResultDoc = (xmlDoc *(*)(struct __pyx_obj_4lxml_5etree__ParserContext *, struct __pyx_obj_4lxml_5etree__BaseParser *, xmlDoc *, PyObject *))__pyx_f_4lxml_5etree_20_TargetParserContext__handleParseResultDoc;
  __pyx_vtable_4lxml_5etree__TargetParserContext._setTarget = (int (*)(struct __pyx_obj_4lxml_5etree__TargetParserContext *, PyObject *))__pyx_f_4lxml_5etree_20_TargetParserContext__setTarget;
  __pyx_vtable_4lxml_5etree__TargetParserContext._cleanupTargetParserContext = (void (*)(struct __pyx_obj_4lxml_5etree__TargetParserContext *, xmlDoc *))__pyx_f_4lxml_5etree_20_TargetParserContext__cleanupTargetParserContext;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__SaxParserContext); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 120, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree__TargetParserContext = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__TargetParserContext_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__TargetParserContext)) __PYX_ERR(13, 120, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__TargetParserContext_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__TargetParserContext) < (0)) __PYX_ERR(13, 120, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__TargetParserContext = &__pyx_type_4lxml_5etree__TargetParserContext;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree__TargetParserContext->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree__SaxParserContext;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__TargetParserContext) < (0)) __PYX_ERR(13, 120, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__TargetParserContext);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__TargetParserContext->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__TargetParserContext->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__TargetParserContext->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree__TargetParserContext, __pyx_vtabptr_4lxml_5etree__TargetParserContext) < (0)) __PYX_ERR(13, 120, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree__TargetParserContext) < (0)) __PYX_ERR(13, 120, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_LxmlError); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree_SerialisationError = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_SerialisationError_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_SerialisationError)) __PYX_ERR(6, 7, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_SerialisationError_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_SerialisationError) < (0)) __PYX_ERR(6, 7, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_SerialisationError = &__pyx_type_4lxml_5etree_SerialisationError;
  #endif
  if (sizeof(struct __pyx_obj_4lxml_5etree_SerialisationError) != sizeof(PyBaseExceptionObject)) {
    if (__Pyx_validate_extern_base(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_LxmlError) < (0)) __PYX_ERR(6, 7, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree_SerialisationError->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree_LxmlError;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_SerialisationError) < (0)) __PYX_ERR(6, 7, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_SerialisationError);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_SerialisationError->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_SerialisationError->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_SerialisationError->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_SerialisationError, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_SerialisationError) < (0)) __PYX_ERR(6, 7, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__FilelikeWriter = &__pyx_vtable_4lxml_5etree__FilelikeWriter;
  __pyx_vtable_4lxml_5etree__FilelikeWriter._createOutputBuffer = (xmlOutputBuffer *(*)(struct __pyx_obj_4lxml_5etree__FilelikeWriter *, xmlCharEncodingHandler *))__pyx_f_4lxml_5etree_15_FilelikeWriter__createOutputBuffer;
  __pyx_vtable_4lxml_5etree__FilelikeWriter.write = (int (*)(struct __pyx_obj_4lxml_5etree__FilelikeWriter *, char *, int))__pyx_f_4lxml_5etree_15_FilelikeWriter_write;
  __pyx_vtable_4lxml_5etree__FilelikeWriter.close = (int (*)(struct __pyx_obj_4lxml_5etree__FilelikeWriter *))__pyx_f_4lxml_5etree_15_FilelikeWriter_close;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree__FilelikeWriter = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__FilelikeWriter_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__FilelikeWriter)) __PYX_ERR(6, 559, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__FilelikeWriter_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__FilelikeWriter) < (0)) __PYX_ERR(6, 559, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__FilelikeWriter = &__pyx_type_4lxml_5etree__FilelikeWriter;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__FilelikeWriter) < (0)) __PYX_ERR(6, 559, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__FilelikeWriter);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__FilelikeWriter->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__FilelikeWriter->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__FilelikeWriter->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree__FilelikeWriter, __pyx_vtabptr_4lxml_5etree__FilelikeWriter) < (0)) __PYX_ERR(6, 559, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree__FilelikeWriter) < (0)) __PYX_ERR(6, 559, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree_C14NWriterTarget = &__pyx_vtable_4lxml_5etree_C14NWriterTarget;
  __pyx_vtable_4lxml_5etree_C14NWriterTarget._resolve_prefix_name = (PyObject *(*)(struct __pyx_obj_4lxml_5etree_C14NWriterTarget *, PyObject *))__pyx_f_4lxml_5etree_16C14NWriterTarget__resolve_prefix_name;
  __pyx_vtable_4lxml_5etree_C14NWriterTarget._qname = (PyObject *(*)(struct __pyx_obj_4lxml_5etree_C14NWriterTarget *, PyObject *, struct __pyx_opt_args_4lxml_5etree_16C14NWriterTarget__qname *__pyx_optional_args))__pyx_f_4lxml_5etree_16C14NWriterTarget__qname;
  __pyx_vtable_4lxml_5etree_C14NWriterTarget._flush = (PyObject *(*)(struct __pyx_obj_4lxml_5etree_C14NWriterTarget *))__pyx_f_4lxml_5etree_16C14NWriterTarget__flush;
  __pyx_vtable_4lxml_5etree_C14NWriterTarget._start = (PyObject *(*)(struct __pyx_obj_4lxml_5etree_C14NWriterTarget *, PyObject *, PyObject *, PyObject *, struct __pyx_opt_args_4lxml_5etree_16C14NWriterTarget__start *__pyx_optional_args))__pyx_f_4lxml_5etree_16C14NWriterTarget__start;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree_C14NWriterTarget = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_C14NWriterTarget_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_C14NWriterTarget)) __PYX_ERR(6, 901, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_C14NWriterTarget_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_C14NWriterTarget) < (0)) __PYX_ERR(6, 901, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_C14NWriterTarget = &__pyx_type_4lxml_5etree_C14NWriterTarget;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_C14NWriterTarget) < (0)) __PYX_ERR(6, 901, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_C14NWriterTarget);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_C14NWriterTarget->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_C14NWriterTarget->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_C14NWriterTarget->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree_C14NWriterTarget, __pyx_vtabptr_4lxml_5etree_C14NWriterTarget) < (0)) __PYX_ERR(6, 901, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree_C14NWriterTarget) < (0)) __PYX_ERR(6, 901, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_C14NWriterTarget, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_C14NWriterTarget) < (0)) __PYX_ERR(6, 901, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree_xmlfile = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_xmlfile_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_xmlfile)) __PYX_ERR(6, 1259, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_xmlfile_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_xmlfile) < (0)) __PYX_ERR(6, 1259, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_xmlfile = &__pyx_type_4lxml_5etree_xmlfile;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_xmlfile) < (0)) __PYX_ERR(6, 1259, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_xmlfile);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_xmlfile->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_xmlfile->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_xmlfile->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_xmlfile, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_xmlfile) < (0)) __PYX_ERR(6, 1259, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_xmlfile); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1348, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree_htmlfile = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_htmlfile_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_htmlfile)) __PYX_ERR(6, 1348, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_htmlfile_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_htmlfile) < (0)) __PYX_ERR(6, 1348, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_htmlfile = &__pyx_type_4lxml_5etree_htmlfile;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree_htmlfile->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree_xmlfile;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_htmlfile) < (0)) __PYX_ERR(6, 1348, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_htmlfile);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_htmlfile->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_htmlfile->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_htmlfile->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_htmlfile, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_htmlfile) < (0)) __PYX_ERR(6, 1348, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__IncrementalFileWriter = &__pyx_vtable_4lxml_5etree__IncrementalFileWriter;
  __pyx_vtable_4lxml_5etree__IncrementalFileWriter._write_qname = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_22_IncrementalFileWriter__write_qname;
  __pyx_vtable_4lxml_5etree__IncrementalFileWriter._write_start_element = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *, PyObject *))__pyx_f_4lxml_5etree_22_IncrementalFileWriter__write_start_element;
  __pyx_vtable_4lxml_5etree__IncrementalFileWriter._write_attributes_and_namespaces = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *, PyObject *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_22_IncrementalFileWriter__write_attributes_and_namespaces;
  __pyx_vtable_4lxml_5etree__IncrementalFileWriter._write_attributes_list = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *, PyObject *))__pyx_f_4lxml_5etree_22_IncrementalFileWriter__write_attributes_list;
  __pyx_vtable_4lxml_5etree__IncrementalFileWriter._write_end_element = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *, PyObject *))__pyx_f_4lxml_5etree_22_IncrementalFileWriter__write_end_element;
  __pyx_vtable_4lxml_5etree__IncrementalFileWriter._find_prefix = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *, PyObject *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_22_IncrementalFileWriter__find_prefix;
  __pyx_vtable_4lxml_5etree__IncrementalFileWriter._collect_namespaces = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *, PyObject *))__pyx_f_4lxml_5etree_22_IncrementalFileWriter__collect_namespaces;
  __pyx_vtable_4lxml_5etree__IncrementalFileWriter._close = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *, int))__pyx_f_4lxml_5etree_22_IncrementalFileWriter__close;
  __pyx_vtable_4lxml_5etree__IncrementalFileWriter._handle_error = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *, int))__pyx_f_4lxml_5etree_22_IncrementalFileWriter__handle_error;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree__IncrementalFileWriter = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__IncrementalFileWriter_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__IncrementalFileWriter)) __PYX_ERR(6, 1367, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__IncrementalFileWriter_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__IncrementalFileWriter) < (0)) __PYX_ERR(6, 1367, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__IncrementalFileWriter = &__pyx_type_4lxml_5etree__IncrementalFileWriter;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__IncrementalFileWriter) < (0)) __PYX_ERR(6, 1367, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__IncrementalFileWriter);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__IncrementalFileWriter->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__IncrementalFileWriter->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__IncrementalFileWriter->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree__IncrementalFileWriter, __pyx_vtabptr_4lxml_5etree__IncrementalFileWriter) < (0)) __PYX_ERR(6, 1367, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree__IncrementalFileWriter) < (0)) __PYX_ERR(6, 1367, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__AsyncDataWriter = &__pyx_vtable_4lxml_5etree__AsyncDataWriter;
  __pyx_vtable_4lxml_5etree__AsyncDataWriter.collect = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__AsyncDataWriter *))__pyx_f_4lxml_5etree_16_AsyncDataWriter_collect;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree__AsyncDataWriter = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__AsyncDataWriter_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__AsyncDataWriter)) __PYX_ERR(6, 1680, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__AsyncDataWriter_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__AsyncDataWriter) < (0)) __PYX_ERR(6, 1680, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__AsyncDataWriter = &__pyx_type_4lxml_5etree__AsyncDataWriter;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__AsyncDataWriter) < (0)) __PYX_ERR(6, 1680, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__AsyncDataWriter);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__AsyncDataWriter->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__AsyncDataWriter->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__AsyncDataWriter->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree__AsyncDataWriter, __pyx_vtabptr_4lxml_5etree__AsyncDataWriter) < (0)) __PYX_ERR(6, 1680, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree__AsyncDataWriter) < (0)) __PYX_ERR(6, 1680, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__AsyncIncrementalFileWriter = &__pyx_vtable_4lxml_5etree__AsyncIncrementalFileWriter;
  __pyx_vtable_4lxml_5etree__AsyncIncrementalFileWriter._flush = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *))__pyx_f_4lxml_5etree_27_AsyncIncrementalFileWriter__flush;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree__AsyncIncrementalFileWriter = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__AsyncIncrementalFileWriter_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__AsyncIncrementalFileWriter)) __PYX_ERR(6, 1699, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__AsyncIncrementalFileWriter_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__AsyncIncrementalFileWriter) < (0)) __PYX_ERR(6, 1699, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__AsyncIncrementalFileWriter = &__pyx_type_4lxml_5etree__AsyncIncrementalFileWriter;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__AsyncIncrementalFileWriter) < (0)) __PYX_ERR(6, 1699, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__AsyncIncrementalFileWriter);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__AsyncIncrementalFileWriter->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__AsyncIncrementalFileWriter->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__AsyncIncrementalFileWriter->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree__AsyncIncrementalFileWriter, __pyx_vtabptr_4lxml_5etree__AsyncIncrementalFileWriter) < (0)) __PYX_ERR(6, 1699, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree__AsyncIncrementalFileWriter) < (0)) __PYX_ERR(6, 1699, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree__AsyncFileWriterElement = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__AsyncFileWriterElement_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__AsyncFileWriterElement)) __PYX_ERR(6, 1764, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__AsyncFileWriterElement_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__AsyncFileWriterElement) < (0)) __PYX_ERR(6, 1764, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__AsyncFileWriterElement = &__pyx_type_4lxml_5etree__AsyncFileWriterElement;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__AsyncFileWriterElement) < (0)) __PYX_ERR(6, 1764, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__AsyncFileWriterElement);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__AsyncFileWriterElement->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__AsyncFileWriterElement->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__AsyncFileWriterElement->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree__FileWriterElement = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__FileWriterElement_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__FileWriterElement)) __PYX_ERR(6, 1788, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__FileWriterElement_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__FileWriterElement) < (0)) __PYX_ERR(6, 1788, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__FileWriterElement = &__pyx_type_4lxml_5etree__FileWriterElement;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__FileWriterElement) < (0)) __PYX_ERR(6, 1788, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__FileWriterElement);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__FileWriterElement->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__FileWriterElement->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__FileWriterElement->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree__MethodChanger = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__MethodChanger_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__MethodChanger)) __PYX_ERR(6, 1812, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__MethodChanger_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__MethodChanger) < (0)) __PYX_ERR(6, 1812, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__MethodChanger = &__pyx_type_4lxml_5etree__MethodChanger;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__MethodChanger) < (0)) __PYX_ERR(6, 1812, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__MethodChanger);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__MethodChanger->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__MethodChanger->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__MethodChanger->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  __pyx_vtabptr_4lxml_5etree_iterparse = &__pyx_vtable_4lxml_5etree_iterparse;
  __pyx_vtable_4lxml_5etree_iterparse._close_source = (PyObject *(*)(struct __pyx_obj_4lxml_5etree_iterparse *))__pyx_f_4lxml_5etree_9iterparse__close_source;
  __pyx_vtable_4lxml_5etree_iterparse._read_more_events = (int (*)(struct __pyx_obj_4lxml_5etree_iterparse *, struct __pyx_obj_4lxml_5etree__SaxParserContext *))__pyx_f_4lxml_5etree_9iterparse__read_more_events;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree_iterparse = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_iterparse_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_iterparse)) __PYX_ERR(14, 5, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_iterparse_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_iterparse) < (0)) __PYX_ERR(14, 5, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_iterparse = &__pyx_type_4lxml_5etree_iterparse;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_iterparse) < (0)) __PYX_ERR(14, 5, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_iterparse);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_iterparse->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_iterparse->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_iterparse->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree_iterparse, __pyx_vtabptr_4lxml_5etree_iterparse) < (0)) __PYX_ERR(14, 5, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree_iterparse) < (0)) __PYX_ERR(14, 5, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_iterparse, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_iterparse) < (0)) __PYX_ERR(14, 5, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree_iterwalk = &__pyx_vtable_4lxml_5etree_iterwalk;
  __pyx_vtable_4lxml_5etree_iterwalk._process_non_elements = (xmlNode *(*)(struct __pyx_obj_4lxml_5etree_iterwalk *, struct LxmlDocument *, xmlNode *))__pyx_f_4lxml_5etree_8iterwalk__process_non_elements;
  __pyx_vtable_4lxml_5etree_iterwalk._next_event = (PyObject *(*)(struct __pyx_obj_4lxml_5etree_iterwalk *))__pyx_f_4lxml_5etree_8iterwalk__next_event;
  __pyx_vtable_4lxml_5etree_iterwalk._start_node = (int (*)(struct __pyx_obj_4lxml_5etree_iterwalk *, struct LxmlElement *))__pyx_f_4lxml_5etree_8iterwalk__start_node;
  __pyx_vtable_4lxml_5etree_iterwalk._end_node = (struct LxmlElement *(*)(struct __pyx_obj_4lxml_5etree_iterwalk *))__pyx_f_4lxml_5etree_8iterwalk__end_node;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree_iterwalk = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_iterwalk_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_iterwalk)) __PYX_ERR(14, 239, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_iterwalk_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_iterwalk) < (0)) __PYX_ERR(14, 239, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_iterwalk = &__pyx_type_4lxml_5etree_iterwalk;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_iterwalk) < (0)) __PYX_ERR(14, 239, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_iterwalk);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_iterwalk->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_iterwalk->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_iterwalk->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree_iterwalk, __pyx_vtabptr_4lxml_5etree_iterwalk) < (0)) __PYX_ERR(14, 239, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree_iterwalk) < (0)) __PYX_ERR(14, 239, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_iterwalk, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_iterwalk) < (0)) __PYX_ERR(14, 239, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__IDDict = &__pyx_vtable_4lxml_5etree__IDDict;
  __pyx_vtable_4lxml_5etree__IDDict._build_keys = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__IDDict *))__pyx_f_4lxml_5etree_7_IDDict__build_keys;
  __pyx_vtable_4lxml_5etree__IDDict._build_items = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__IDDict *))__pyx_f_4lxml_5etree_7_IDDict__build_items;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree__IDDict = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__IDDict_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__IDDict)) __PYX_ERR(15, 58, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__IDDict_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__IDDict) < (0)) __PYX_ERR(15, 58, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__IDDict = &__pyx_type_4lxml_5etree__IDDict;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__IDDict) < (0)) __PYX_ERR(15, 58, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__IDDict);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__IDDict->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__IDDict->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__IDDict->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree__IDDict, __pyx_vtabptr_4lxml_5etree__IDDict) < (0)) __PYX_ERR(15, 58, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree__IDDict) < (0)) __PYX_ERR(15, 58, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_IDDict, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree__IDDict) < (0)) __PYX_ERR(15, 58, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_LxmlError); if (unlikely(!__pyx_t_1)) __PYX_ERR(16, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree_XIncludeError = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_XIncludeError_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_XIncludeError)) __PYX_ERR(16, 6, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_XIncludeError_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_XIncludeError) < (0)) __PYX_ERR(16, 6, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_XIncludeError = &__pyx_type_4lxml_5etree_XIncludeError;
  #endif
  if (sizeof(struct __pyx_obj_4lxml_5etree_XIncludeError) != sizeof(PyBaseExceptionObject)) {
    if (__Pyx_validate_extern_base(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_LxmlError) < (0)) __PYX_ERR(16, 6, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XIncludeError->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree_LxmlError;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_XIncludeError) < (0)) __PYX_ERR(16, 6, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_XIncludeError);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_XIncludeError->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_XIncludeError->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_XIncludeError->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_XIncludeError, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_XIncludeError) < (0)) __PYX_ERR(16, 6, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree_XInclude = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_XInclude_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_XInclude)) __PYX_ERR(16, 11, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_XInclude_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_XInclude) < (0)) __PYX_ERR(16, 11, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_XInclude = &__pyx_type_4lxml_5etree_XInclude;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_XInclude) < (0)) __PYX_ERR(16, 11, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_XInclude);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_XInclude->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_XInclude->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_XInclude->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_mstate->__pyx_ptype_4lxml_5etree_XInclude, "__call__"); if (unlikely(!wrapper)) __PYX_ERR(16, 11, __pyx_L1_error)
    if (__Pyx_IS_TYPE(wrapper, &PyWrapperDescr_Type)) {
      __pyx_wrapperbase_4lxml_5etree_8XInclude_2__call__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_8XInclude_2__call__.doc = __pyx_doc_4lxml_5etree_8XInclude_2__call__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_8XInclude_2__call__;
    }
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_XInclude, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_XInclude) < (0)) __PYX_ERR(16, 11, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_LxmlError); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree_XPathError = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_XPathError_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_XPathError)) __PYX_ERR(18, 3, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_XPathError_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_XPathError) < (0)) __PYX_ERR(18, 3, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_XPathError = &__pyx_type_4lxml_5etree_XPathError;
  #endif
  if (sizeof(struct __pyx_obj_4lxml_5etree_XPathError) != sizeof(PyBaseExceptionObject)) {
    if (__Pyx_validate_extern_base(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_LxmlError) < (0)) __PYX_ERR(18, 3, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XPathError->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree_LxmlError;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_XPathError) < (0)) __PYX_ERR(18, 3, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_XPathError);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_XPathError->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_XPathError->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_XPathError->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_XPathError, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_XPathError) < (0)) __PYX_ERR(18, 3, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XPathError); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree_XPathEvalError = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_XPathEvalError_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_XPathEvalError)) __PYX_ERR(18, 7, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_XPathEvalError_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_XPathEvalError) < (0)) __PYX_ERR(18, 7, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_XPathEvalError = &__pyx_type_4lxml_5etree_XPathEvalError;
  #endif
  if (sizeof(struct __pyx_obj_4lxml_5etree_XPathEvalError) != sizeof(PyBaseExceptionObject)) {
    if (__Pyx_validate_extern_base(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XPathError) < (0)) __PYX_ERR(18, 7, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XPathEvalError->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XPathError;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_XPathEvalError) < (0)) __PYX_ERR(18, 7, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_XPathEvalError);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_XPathEvalError->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_XPathEvalError->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_XPathEvalError->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_XPathEvalError, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_XPathEvalError) < (0)) __PYX_ERR(18, 7, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XPathEvalError); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 11, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree_XPathFunctionError = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_XPathFunctionError_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_XPathFunctionError)) __PYX_ERR(18, 11, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_XPathFunctionError_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_XPathFunctionError) < (0)) __PYX_ERR(18, 11, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_XPathFunctionError = &__pyx_type_4lxml_5etree_XPathFunctionError;
  #endif
  if (sizeof(struct __pyx_obj_4lxml_5etree_XPathFunctionError) != sizeof(PyBaseExceptionObject)) {
    if (__Pyx_validate_extern_base(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XPathEvalError) < (0)) __PYX_ERR(18, 11, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XPathFunctionError->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XPathEvalError;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_XPathFunctionError) < (0)) __PYX_ERR(18, 11, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_XPathFunctionError);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_XPathFunctionError->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_XPathFunctionError->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_XPathFunctionError->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_XPathFunctionError, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_XPathFunctionError) < (0)) __PYX_ERR(18, 11, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XPathEvalError); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree_XPathResultError = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_XPathResultError_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_XPathResultError)) __PYX_ERR(18, 15, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_XPathResultError_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_XPathResultError) < (0)) __PYX_ERR(18, 15, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_XPathResultError = &__pyx_type_4lxml_5etree_XPathResultError;
  #endif
  if (sizeof(struct __pyx_obj_4lxml_5etree_XPathResultError) != sizeof(PyBaseExceptionObject)) {
    if (__Pyx_validate_extern_base(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XPathEvalError) < (0)) __PYX_ERR(18, 15, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XPathResultError->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XPathEvalError;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_XPathResultError) < (0)) __PYX_ERR(18, 15, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_XPathResultError);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_XPathResultError->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_XPathResultError->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_XPathResultError->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_XPathResultError, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_XPathResultError) < (0)) __PYX_ERR(18, 15, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__ExsltRegExp = &__pyx_vtable_4lxml_5etree__ExsltRegExp;
  __pyx_vtable_4lxml_5etree__ExsltRegExp._make_string = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__ExsltRegExp *, PyObject *))__pyx_f_4lxml_5etree_12_ExsltRegExp__make_string;
  __pyx_vtable_4lxml_5etree__ExsltRegExp._compile = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__ExsltRegExp *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_12_ExsltRegExp__compile;
  __pyx_vtable_4lxml_5etree__ExsltRegExp._register_in_context = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__ExsltRegExp *, struct __pyx_obj_4lxml_5etree__BaseContext *))__pyx_f_4lxml_5etree_12_ExsltRegExp__register_in_context;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree__ExsltRegExp = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__ExsltRegExp_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__ExsltRegExp)) __PYX_ERR(18, 452, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__ExsltRegExp_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__ExsltRegExp) < (0)) __PYX_ERR(18, 452, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__ExsltRegExp = &__pyx_type_4lxml_5etree__ExsltRegExp;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__ExsltRegExp) < (0)) __PYX_ERR(18, 452, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__ExsltRegExp);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__ExsltRegExp->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__ExsltRegExp->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__ExsltRegExp->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree__ExsltRegExp, __pyx_vtabptr_4lxml_5etree__ExsltRegExp) < (0)) __PYX_ERR(18, 452, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree__ExsltRegExp) < (0)) __PYX_ERR(18, 452, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__BaseContext = &__pyx_vtable_4lxml_5etree__BaseContext;
  __pyx_vtable_4lxml_5etree__BaseContext._copy = (struct __pyx_obj_4lxml_5etree__BaseContext *(*)(struct __pyx_obj_4lxml_5etree__BaseContext *))__pyx_f_4lxml_5etree_12_BaseContext__copy;
  __pyx_vtable_4lxml_5etree__BaseContext._to_utf = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseContext *, PyObject *))__pyx_f_4lxml_5etree_12_BaseContext__to_utf;
  __pyx_vtable_4lxml_5etree__BaseContext._set_xpath_context = (void (*)(struct __pyx_obj_4lxml_5etree__BaseContext *, xmlXPathContext *))__pyx_f_4lxml_5etree_12_BaseContext__set_xpath_context;
  __pyx_vtable_4lxml_5etree__BaseContext._register_context = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseContext *, struct LxmlDocument *))__pyx_f_4lxml_5etree_12_BaseContext__register_context;
  __pyx_vtable_4lxml_5etree__BaseContext._cleanup_context = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseContext *))__pyx_f_4lxml_5etree_12_BaseContext__cleanup_context;
  __pyx_vtable_4lxml_5etree__BaseContext._release_context = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseContext *))__pyx_f_4lxml_5etree_12_BaseContext__release_context;
  __pyx_vtable_4lxml_5etree__BaseContext.addNamespace = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseContext *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_12_BaseContext_addNamespace;
  __pyx_vtable_4lxml_5etree__BaseContext.registerNamespace = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseContext *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_12_BaseContext_registerNamespace;
  __pyx_vtable_4lxml_5etree__BaseContext.registerLocalNamespaces = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseContext *))__pyx_f_4lxml_5etree_12_BaseContext_registerLocalNamespaces;
  __pyx_vtable_4lxml_5etree__BaseContext.registerGlobalNamespaces = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseContext *))__pyx_f_4lxml_5etree_12_BaseContext_registerGlobalNamespaces;
  __pyx_vtable_4lxml_5etree__BaseContext.unregisterGlobalNamespaces = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseContext *))__pyx_f_4lxml_5etree_12_BaseContext_unregisterGlobalNamespaces;
  __pyx_vtable_4lxml_5etree__BaseContext._unregisterNamespace = (void (*)(struct __pyx_obj_4lxml_5etree__BaseContext *, PyObject *))__pyx_f_4lxml_5etree_12_BaseContext__unregisterNamespace;
  __pyx_vtable_4lxml_5etree__BaseContext._addLocalExtensionFunction = (int (*)(struct __pyx_obj_4lxml_5etree__BaseContext *, PyObject *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_12_BaseContext__addLocalExtensionFunction;
  __pyx_vtable_4lxml_5etree__BaseContext.registerGlobalFunctions = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseContext *, void *, __pyx_t_4lxml_5etree__register_function))__pyx_f_4lxml_5etree_12_BaseContext_registerGlobalFunctions;
  __pyx_vtable_4lxml_5etree__BaseContext.registerLocalFunctions = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseContext *, void *, __pyx_t_4lxml_5etree__register_function))__pyx_f_4lxml_5etree_12_BaseContext_registerLocalFunctions;
  __pyx_vtable_4lxml_5etree__BaseContext.unregisterAllFunctions = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseContext *, void *, __pyx_t_4lxml_5etree__register_function))__pyx_f_4lxml_5etree_12_BaseContext_unregisterAllFunctions;
  __pyx_vtable_4lxml_5etree__BaseContext.unregisterGlobalFunctions = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseContext *, void *, __pyx_t_4lxml_5etree__register_function))__pyx_f_4lxml_5etree_12_BaseContext_unregisterGlobalFunctions;
  __pyx_vtable_4lxml_5etree__BaseContext._find_cached_function = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseContext *, const xmlChar *, const xmlChar *))__pyx_f_4lxml_5etree_12_BaseContext__find_cached_function;
  __pyx_vtable_4lxml_5etree__BaseContext._release_temp_refs = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseContext *))__pyx_f_4lxml_5etree_12_BaseContext__release_temp_refs;
  __pyx_vtable_4lxml_5etree__BaseContext._hold = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseContext *, PyObject *))__pyx_f_4lxml_5etree_12_BaseContext__hold;
  __pyx_vtable_4lxml_5etree__BaseContext._findDocumentForNode = (struct LxmlDocument *(*)(struct __pyx_obj_4lxml_5etree__BaseContext *, xmlNode *))__pyx_f_4lxml_5etree_12_BaseContext__findDocumentForNode;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree__BaseContext = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__BaseContext_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__BaseContext)) __PYX_ERR(18, 28, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__BaseContext_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__BaseContext) < (0)) __PYX_ERR(18, 28, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__BaseContext = &__pyx_type_4lxml_5etree__BaseContext;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__BaseContext) < (0)) __PYX_ERR(18, 28, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__BaseContext);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__BaseContext->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__BaseContext->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__BaseContext->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree__BaseContext, __pyx_vtabptr_4lxml_5etree__BaseContext) < (0)) __PYX_ERR(18, 28, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree__BaseContext) < (0)) __PYX_ERR(18, 28, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)(&PyUnicode_Type)); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 720, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree__ElementUnicodeResult = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__ElementUnicodeResult_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__ElementUnicodeResult)) __PYX_ERR(18, 720, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__ElementUnicodeResult_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__ElementUnicodeResult) < (0)) __PYX_ERR(18, 720, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__ElementUnicodeResult = &__pyx_type_4lxml_5etree__ElementUnicodeResult;
  #endif
  if (sizeof(struct __pyx_obj_4lxml_5etree__ElementUnicodeResult) != sizeof(PyUnicodeObject)) {
    if (__Pyx_validate_extern_base((&PyUnicode_Type)) < (0)) __PYX_ERR(18, 720, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ElementUnicodeResult->tp_base = (&PyUnicode_Type);
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__ElementUnicodeResult) < (0)) __PYX_ERR(18, 720, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__ElementUnicodeResult);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__ElementUnicodeResult->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__ElementUnicodeResult->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__ElementUnicodeResult->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_ElementUnicodeResult, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree__ElementUnicodeResult) < (0)) __PYX_ERR(18, 720, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__XPathContext = &__pyx_vtable_4lxml_5etree__XPathContext;
  __pyx_vtable_4lxml_5etree__XPathContext.__pyx_base = *__pyx_vtabptr_4lxml_5etree__BaseContext;
  __pyx_vtable_4lxml_5etree__XPathContext.set_context = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__XPathContext *, xmlXPathContext *))__pyx_f_4lxml_5etree_13_XPathContext_set_context;
  __pyx_vtable_4lxml_5etree__XPathContext.register_context = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__XPathContext *, struct LxmlDocument *))__pyx_f_4lxml_5etree_13_XPathContext_register_context;
  __pyx_vtable_4lxml_5etree__XPathContext.unregister_context = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__XPathContext *))__pyx_f_4lxml_5etree_13_XPathContext_unregister_context;
  __pyx_vtable_4lxml_5etree__XPathContext.registerExsltFunctions = (void (*)(struct __pyx_obj_4lxml_5etree__XPathContext *))__pyx_f_4lxml_5etree_13_XPathContext_registerExsltFunctions;
  __pyx_vtable_4lxml_5etree__XPathContext.registerVariables = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__XPathContext *, PyObject *))__pyx_f_4lxml_5etree_13_XPathContext_registerVariables;
  __pyx_vtable_4lxml_5etree__XPathContext.registerVariable = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__XPathContext *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_13_XPathContext_registerVariable;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__BaseContext); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 48, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree__XPathContext = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__XPathContext_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__XPathContext)) __PYX_ERR(19, 48, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__XPathContext_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__XPathContext) < (0)) __PYX_ERR(19, 48, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__XPathContext = &__pyx_type_4lxml_5etree__XPathContext;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree__XPathContext->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree__BaseContext;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__XPathContext) < (0)) __PYX_ERR(19, 48, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__XPathContext);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__XPathContext->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__XPathContext->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__XPathContext->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree__XPathContext, __pyx_vtabptr_4lxml_5etree__XPathContext) < (0)) __PYX_ERR(19, 48, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree__XPathContext) < (0)) __PYX_ERR(19, 48, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__XPathEvaluatorBase = &__pyx_vtable_4lxml_5etree__XPathEvaluatorBase;
  __pyx_vtable_4lxml_5etree__XPathEvaluatorBase.set_context = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *, xmlXPathContext *))__pyx_f_4lxml_5etree_19_XPathEvaluatorBase_set_context;
  __pyx_vtable_4lxml_5etree__XPathEvaluatorBase._checkAbsolutePath = (int (*)(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *, char *))__pyx_f_4lxml_5etree_19_XPathEvaluatorBase__checkAbsolutePath;
  __pyx_vtable_4lxml_5etree__XPathEvaluatorBase._lock = (int (*)(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *))__pyx_f_4lxml_5etree_19_XPathEvaluatorBase__lock;
  __pyx_vtable_4lxml_5etree__XPathEvaluatorBase._unlock = (void (*)(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *))__pyx_f_4lxml_5etree_19_XPathEvaluatorBase__unlock;
  __pyx_vtable_4lxml_5etree__XPathEvaluatorBase._build_parse_error = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *))__pyx_f_4lxml_5etree_19_XPathEvaluatorBase__build_parse_error;
  __pyx_vtable_4lxml_5etree__XPathEvaluatorBase._build_eval_error = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *))__pyx_f_4lxml_5etree_19_XPathEvaluatorBase__build_eval_error;
  __pyx_vtable_4lxml_5etree__XPathEvaluatorBase._handle_result = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *, xmlXPathObject *, struct LxmlDocument *))__pyx_f_4lxml_5etree_19_XPathEvaluatorBase__handle_result;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree__XPathEvaluatorBase = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__XPathEvaluatorBase_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__XPathEvaluatorBase)) __PYX_ERR(19, 116, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__XPathEvaluatorBase_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__XPathEvaluatorBase) < (0)) __PYX_ERR(19, 116, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__XPathEvaluatorBase = &__pyx_type_4lxml_5etree__XPathEvaluatorBase;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__XPathEvaluatorBase) < (0)) __PYX_ERR(19, 116, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__XPathEvaluatorBase);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__XPathEvaluatorBase->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__XPathEvaluatorBase->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__XPathEvaluatorBase->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree__XPathEvaluatorBase, __pyx_vtabptr_4lxml_5etree__XPathEvaluatorBase) < (0)) __PYX_ERR(19, 116, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree__XPathEvaluatorBase) < (0)) __PYX_ERR(19, 116, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_XPathEvaluatorBase, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree__XPathEvaluatorBase) < (0)) __PYX_ERR(19, 116, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree_XPathElementEvaluator = &__pyx_vtable_4lxml_5etree_XPathElementEvaluator;
  __pyx_vtable_4lxml_5etree_XPathElementEvaluator.__pyx_base = *__pyx_vtabptr_4lxml_5etree__XPathEvaluatorBase;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__XPathEvaluatorBase); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 221, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree_XPathElementEvaluator = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_XPathElementEvaluator_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_XPathElementEvaluator)) __PYX_ERR(19, 221, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_XPathElementEvaluator_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_XPathElementEvaluator) < (0)) __PYX_ERR(19, 221, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_XPathElementEvaluator = &__pyx_type_4lxml_5etree_XPathElementEvaluator;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XPathElementEvaluator->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree__XPathEvaluatorBase;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_XPathElementEvaluator) < (0)) __PYX_ERR(19, 221, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_XPathElementEvaluator);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_XPathElementEvaluator->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_XPathElementEvaluator->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_XPathElementEvaluator->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_mstate->__pyx_ptype_4lxml_5etree_XPathElementEvaluator, "__call__"); if (unlikely(!wrapper)) __PYX_ERR(19, 221, __pyx_L1_error)
    if (__Pyx_IS_TYPE(wrapper, &PyWrapperDescr_Type)) {
      __pyx_wrapperbase_4lxml_5etree_21XPathElementEvaluator_6__call__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_21XPathElementEvaluator_6__call__.doc = __pyx_doc_4lxml_5etree_21XPathElementEvaluator_6__call__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_21XPathElementEvaluator_6__call__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree_XPathElementEvaluator, __pyx_vtabptr_4lxml_5etree_XPathElementEvaluator) < (0)) __PYX_ERR(19, 221, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree_XPathElementEvaluator) < (0)) __PYX_ERR(19, 221, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_XPathElementEvaluator, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_XPathElementEvaluator) < (0)) __PYX_ERR(19, 221, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree_XPathDocumentEvaluator = &__pyx_vtable_4lxml_5etree_XPathDocumentEvaluator;
  __pyx_vtable_4lxml_5etree_XPathDocumentEvaluator.__pyx_base = *__pyx_vtabptr_4lxml_5etree_XPathElementEvaluator;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XPathElementEvaluator); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 298, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree_XPathDocumentEvaluator = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_XPathDocumentEvaluator_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_XPathDocumentEvaluator)) __PYX_ERR(19, 298, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_XPathDocumentEvaluator_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_XPathDocumentEvaluator) < (0)) __PYX_ERR(19, 298, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_XPathDocumentEvaluator = &__pyx_type_4lxml_5etree_XPathDocumentEvaluator;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XPathDocumentEvaluator->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XPathElementEvaluator;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_XPathDocumentEvaluator) < (0)) __PYX_ERR(19, 298, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_XPathDocumentEvaluator);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_XPathDocumentEvaluator->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_XPathDocumentEvaluator->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_XPathDocumentEvaluator->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_mstate->__pyx_ptype_4lxml_5etree_XPathDocumentEvaluator, "__call__"); if (unlikely(!wrapper)) __PYX_ERR(19, 298, __pyx_L1_error)
    if (__Pyx_IS_TYPE(wrapper, &PyWrapperDescr_Type)) {
      __pyx_wrapperbase_4lxml_5etree_22XPathDocumentEvaluator_2__call__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_22XPathDocumentEvaluator_2__call__.doc = __pyx_doc_4lxml_5etree_22XPathDocumentEvaluator_2__call__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_22XPathDocumentEvaluator_2__call__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree_XPathDocumentEvaluator, __pyx_vtabptr_4lxml_5etree_XPathDocumentEvaluator) < (0)) __PYX_ERR(19, 298, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree_XPathDocumentEvaluator) < (0)) __PYX_ERR(19, 298, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_XPathDocumentEvaluator, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_XPathDocumentEvaluator) < (0)) __PYX_ERR(19, 298, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree_XPath = &__pyx_vtable_4lxml_5etree_XPath;
  __pyx_vtable_4lxml_5etree_XPath.__pyx_base = *__pyx_vtabptr_4lxml_5etree__XPathEvaluatorBase;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__XPathEvaluatorBase); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 377, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree_XPath = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_XPath_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_XPath)) __PYX_ERR(19, 377, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_XPath_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_XPath) < (0)) __PYX_ERR(19, 377, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_XPath = &__pyx_type_4lxml_5etree_XPath;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XPath->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree__XPathEvaluatorBase;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_XPath) < (0)) __PYX_ERR(19, 377, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_XPath);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_XPath->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_XPath->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_XPath->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_mstate->__pyx_ptype_4lxml_5etree_XPath, "__call__"); if (unlikely(!wrapper)) __PYX_ERR(19, 377, __pyx_L1_error)
    if (__Pyx_IS_TYPE(wrapper, &PyWrapperDescr_Type)) {
      __pyx_wrapperbase_4lxml_5etree_5XPath_4__call__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_5XPath_4__call__.doc = __pyx_doc_4lxml_5etree_5XPath_4__call__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_5XPath_4__call__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree_XPath, __pyx_vtabptr_4lxml_5etree_XPath) < (0)) __PYX_ERR(19, 377, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree_XPath) < (0)) __PYX_ERR(19, 377, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_XPath, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_XPath) < (0)) __PYX_ERR(19, 377, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree_ETXPath = &__pyx_vtable_4lxml_5etree_ETXPath;
  __pyx_vtable_4lxml_5etree_ETXPath.__pyx_base = *__pyx_vtabptr_4lxml_5etree_XPath;
  __pyx_vtable_4lxml_5etree_ETXPath._nsextract_path = (PyObject *(*)(struct __pyx_obj_4lxml_5etree_ETXPath *, PyObject *))__pyx_f_4lxml_5etree_7ETXPath__nsextract_path;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XPath); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 451, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree_ETXPath = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_ETXPath_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_ETXPath)) __PYX_ERR(19, 451, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_ETXPath_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_ETXPath) < (0)) __PYX_ERR(19, 451, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_ETXPath = &__pyx_type_4lxml_5etree_ETXPath;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree_ETXPath->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XPath;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_ETXPath) < (0)) __PYX_ERR(19, 451, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_ETXPath);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_ETXPath->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_ETXPath->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_ETXPath->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree_ETXPath, __pyx_vtabptr_4lxml_5etree_ETXPath) < (0)) __PYX_ERR(19, 451, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree_ETXPath) < (0)) __PYX_ERR(19, 451, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_ETXPath, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_ETXPath) < (0)) __PYX_ERR(19, 451, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_LxmlError); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTError = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_XSLTError_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTError)) __PYX_ERR(3, 5, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_XSLTError_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTError) < (0)) __PYX_ERR(3, 5, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTError = &__pyx_type_4lxml_5etree_XSLTError;
  #endif
  if (sizeof(struct __pyx_obj_4lxml_5etree_XSLTError) != sizeof(PyBaseExceptionObject)) {
    if (__Pyx_validate_extern_base(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_LxmlError) < (0)) __PYX_ERR(3, 5, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XSLTError->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree_LxmlError;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTError) < (0)) __PYX_ERR(3, 5, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTError);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTError->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTError->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTError->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_XSLTError, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTError) < (0)) __PYX_ERR(3, 5, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XSLTError); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTParseError = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_XSLTParseError_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTParseError)) __PYX_ERR(3, 9, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_XSLTParseError_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTParseError) < (0)) __PYX_ERR(3, 9, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTParseError = &__pyx_type_4lxml_5etree_XSLTParseError;
  #endif
  if (sizeof(struct __pyx_obj_4lxml_5etree_XSLTParseError) != sizeof(PyBaseExceptionObject)) {
    if (__Pyx_validate_extern_base(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XSLTError) < (0)) __PYX_ERR(3, 9, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XSLTParseError->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XSLTError;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTParseError) < (0)) __PYX_ERR(3, 9, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTParseError);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTParseError->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTParseError->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTParseError->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_XSLTParseError, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTParseError) < (0)) __PYX_ERR(3, 9, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XSLTError); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 13, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTApplyError = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_XSLTApplyError_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTApplyError)) __PYX_ERR(3, 13, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_XSLTApplyError_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTApplyError) < (0)) __PYX_ERR(3, 13, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTApplyError = &__pyx_type_4lxml_5etree_XSLTApplyError;
  #endif
  if (sizeof(struct __pyx_obj_4lxml_5etree_XSLTApplyError) != sizeof(PyBaseExceptionObject)) {
    if (__Pyx_validate_extern_base(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XSLTError) < (0)) __PYX_ERR(3, 13, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XSLTApplyError->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XSLTError;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTApplyError) < (0)) __PYX_ERR(3, 13, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTApplyError);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTApplyError->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTApplyError->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTApplyError->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_XSLTApplyError, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTApplyError) < (0)) __PYX_ERR(3, 13, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XSLTError); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 21, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTExtensionError = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_XSLTExtensionError_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTExtensionError)) __PYX_ERR(3, 21, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_XSLTExtensionError_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTExtensionError) < (0)) __PYX_ERR(3, 21, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTExtensionError = &__pyx_type_4lxml_5etree_XSLTExtensionError;
  #endif
  if (sizeof(struct __pyx_obj_4lxml_5etree_XSLTExtensionError) != sizeof(PyBaseExceptionObject)) {
    if (__Pyx_validate_extern_base(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XSLTError) < (0)) __PYX_ERR(3, 21, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XSLTExtensionError->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XSLTError;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTExtensionError) < (0)) __PYX_ERR(3, 21, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTExtensionError);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTExtensionError->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTExtensionError->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTExtensionError->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_XSLTExtensionError, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTExtensionError) < (0)) __PYX_ERR(3, 21, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__XSLTResolverContext = &__pyx_vtable_4lxml_5etree__XSLTResolverContext;
  __pyx_vtable_4lxml_5etree__XSLTResolverContext.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ResolverContext;
  __pyx_vtable_4lxml_5etree__XSLTResolverContext._copy = (struct __pyx_obj_4lxml_5etree__XSLTResolverContext *(*)(struct __pyx_obj_4lxml_5etree__XSLTResolverContext *))__pyx_f_4lxml_5etree_20_XSLTResolverContext__copy;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ResolverContext); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 46, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree__XSLTResolverContext = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__XSLTResolverContext_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__XSLTResolverContext)) __PYX_ERR(3, 46, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__XSLTResolverContext_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__XSLTResolverContext) < (0)) __PYX_ERR(3, 46, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__XSLTResolverContext = &__pyx_type_4lxml_5etree__XSLTResolverContext;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree__XSLTResolverContext->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ResolverContext;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__XSLTResolverContext) < (0)) __PYX_ERR(3, 46, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__XSLTResolverContext);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__XSLTResolverContext->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__XSLTResolverContext->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__XSLTResolverContext->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree__XSLTResolverContext, __pyx_vtabptr_4lxml_5etree__XSLTResolverContext) < (0)) __PYX_ERR(3, 46, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree__XSLTResolverContext) < (0)) __PYX_ERR(3, 46, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree_XSLTAccessControl = &__pyx_vtable_4lxml_5etree_XSLTAccessControl;
  __pyx_vtable_4lxml_5etree_XSLTAccessControl._setAccess = (PyObject *(*)(struct __pyx_obj_4lxml_5etree_XSLTAccessControl *, xsltSecurityOption, int))__pyx_f_4lxml_5etree_17XSLTAccessControl__setAccess;
  __pyx_vtable_4lxml_5etree_XSLTAccessControl._register_in_context = (void (*)(struct __pyx_obj_4lxml_5etree_XSLTAccessControl *, xsltTransformContext *))__pyx_f_4lxml_5etree_17XSLTAccessControl__register_in_context;
  __pyx_vtable_4lxml_5etree_XSLTAccessControl._optval = (PyObject *(*)(struct __pyx_obj_4lxml_5etree_XSLTAccessControl *, xsltSecurityOption))__pyx_f_4lxml_5etree_17XSLTAccessControl__optval;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTAccessControl = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_XSLTAccessControl_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTAccessControl)) __PYX_ERR(3, 170, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_XSLTAccessControl_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTAccessControl) < (0)) __PYX_ERR(3, 170, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTAccessControl = &__pyx_type_4lxml_5etree_XSLTAccessControl;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTAccessControl) < (0)) __PYX_ERR(3, 170, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTAccessControl);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTAccessControl->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTAccessControl->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTAccessControl->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTAccessControl, __pyx_vtabptr_4lxml_5etree_XSLTAccessControl) < (0)) __PYX_ERR(3, 170, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTAccessControl) < (0)) __PYX_ERR(3, 170, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_XSLTAccessControl, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTAccessControl) < (0)) __PYX_ERR(3, 170, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__XSLTContext = &__pyx_vtable_4lxml_5etree__XSLTContext;
  __pyx_vtable_4lxml_5etree__XSLTContext.__pyx_base = *__pyx_vtabptr_4lxml_5etree__BaseContext;
  __pyx_vtable_4lxml_5etree__XSLTContext.__pyx_base._copy = (struct __pyx_obj_4lxml_5etree__BaseContext *(*)(struct __pyx_obj_4lxml_5etree__BaseContext *))__pyx_f_4lxml_5etree_12_XSLTContext__copy;
  __pyx_vtable_4lxml_5etree__XSLTContext.register_context = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__XSLTContext *, xsltTransformContext *, struct LxmlDocument *))__pyx_f_4lxml_5etree_12_XSLTContext_register_context;
  __pyx_vtable_4lxml_5etree__XSLTContext.free_context = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__XSLTContext *))__pyx_f_4lxml_5etree_12_XSLTContext_free_context;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__BaseContext); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 271, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree__XSLTContext = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__XSLTContext_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__XSLTContext)) __PYX_ERR(3, 271, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__XSLTContext_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__XSLTContext) < (0)) __PYX_ERR(3, 271, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__XSLTContext = &__pyx_type_4lxml_5etree__XSLTContext;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree__XSLTContext->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree__BaseContext;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__XSLTContext) < (0)) __PYX_ERR(3, 271, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__XSLTContext);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__XSLTContext->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__XSLTContext->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__XSLTContext->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree__XSLTContext, __pyx_vtabptr_4lxml_5etree__XSLTContext) < (0)) __PYX_ERR(3, 271, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree__XSLTContext) < (0)) __PYX_ERR(3, 271, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree__XSLTQuotedStringParam = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__XSLTQuotedStringParam_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__XSLTQuotedStringParam)) __PYX_ERR(3, 323, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__XSLTQuotedStringParam_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__XSLTQuotedStringParam) < (0)) __PYX_ERR(3, 323, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__XSLTQuotedStringParam = &__pyx_type_4lxml_5etree__XSLTQuotedStringParam;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__XSLTQuotedStringParam) < (0)) __PYX_ERR(3, 323, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__XSLTQuotedStringParam);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__XSLTQuotedStringParam->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__XSLTQuotedStringParam->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__XSLTQuotedStringParam->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  __pyx_vtabptr_4lxml_5etree_XSLT = &__pyx_vtable_4lxml_5etree_XSLT;
  __pyx_vtable_4lxml_5etree_XSLT._run_transform = (xmlDoc *(*)(struct __pyx_obj_4lxml_5etree_XSLT *, xmlDoc *, const char **, struct __pyx_obj_4lxml_5etree__XSLTContext *, xsltTransformContext *))__pyx_f_4lxml_5etree_4XSLT__run_transform;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree_XSLT = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_XSLT_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_XSLT)) __PYX_ERR(3, 335, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_XSLT_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_XSLT) < (0)) __PYX_ERR(3, 335, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_XSLT = &__pyx_type_4lxml_5etree_XSLT;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_XSLT) < (0)) __PYX_ERR(3, 335, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_XSLT);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_XSLT->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_XSLT->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_XSLT->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_mstate->__pyx_ptype_4lxml_5etree_XSLT, "__call__"); if (unlikely(!wrapper)) __PYX_ERR(3, 335, __pyx_L1_error)
    if (__Pyx_IS_TYPE(wrapper, &PyWrapperDescr_Type)) {
      __pyx_wrapperbase_4lxml_5etree_4XSLT_16__call__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_4XSLT_16__call__.doc = __pyx_doc_4lxml_5etree_4XSLT_16__call__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_4XSLT_16__call__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree_XSLT, __pyx_vtabptr_4lxml_5etree_XSLT) < (0)) __PYX_ERR(3, 335, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree_XSLT) < (0)) __PYX_ERR(3, 335, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_XSLT, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_XSLT) < (0)) __PYX_ERR(3, 335, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__XSLTResultTree = &__pyx_vtable_4lxml_5etree__XSLTResultTree;
  __pyx_vtable_4lxml_5etree__XSLTResultTree.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ElementTree;
  __pyx_vtable_4lxml_5etree__XSLTResultTree._saveToStringAndSize = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__XSLTResultTree *, xmlChar **, int *))__pyx_f_4lxml_5etree_15_XSLTResultTree__saveToStringAndSize;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ElementTree); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 707, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree__XSLTResultTree = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__XSLTResultTree_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__XSLTResultTree)) __PYX_ERR(3, 707, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate->__pyx_ptype_4lxml_5etree__XSLTResultTree->tp_as_buffer = &__pyx_tp_as_buffer__XSLTResultTree;
  #elif defined(Py_bf_getbuffer) && defined(Py_bf_releasebuffer)
  /* PY_VERSION_HEX >= 0x03090000 || Py_LIMITED_API >= 0x030B0000 */
  #elif defined(_MSC_VER)
  #pragma message ("The buffer protocol is not supported in the Limited C-API < 3.11.")
  #else
  #warning "The buffer protocol is not supported in the Limited C-API < 3.11."
  #endif
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__XSLTResultTree_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__XSLTResultTree) < (0)) __PYX_ERR(3, 707, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__XSLTResultTree = &__pyx_type_4lxml_5etree__XSLTResultTree;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree__XSLTResultTree->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ElementTree;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__XSLTResultTree) < (0)) __PYX_ERR(3, 707, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__XSLTResultTree);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__XSLTResultTree->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__XSLTResultTree->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__XSLTResultTree->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree__XSLTResultTree, __pyx_vtabptr_4lxml_5etree__XSLTResultTree) < (0)) __PYX_ERR(3, 707, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree__XSLTResultTree) < (0)) __PYX_ERR(3, 707, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_XSLTResultTree, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree__XSLTResultTree) < (0)) __PYX_ERR(3, 707, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__XSLTProcessingInstruction = &__pyx_vtable_4lxml_5etree__XSLTProcessingInstruction;
  __pyx_vtable_4lxml_5etree__XSLTProcessingInstruction.__pyx_base = *__pyx_vtabptr_4lxml_5etree_PIBase;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_PIBase); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 882, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree__XSLTProcessingInstruction = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__XSLTProcessingInstruction_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__XSLTProcessingInstruction)) __PYX_ERR(3, 882, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__XSLTProcessingInstruction_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__XSLTProcessingInstruction) < (0)) __PYX_ERR(3, 882, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__XSLTProcessingInstruction = &__pyx_type_4lxml_5etree__XSLTProcessingInstruction;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree__XSLTProcessingInstruction->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree_PIBase;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__XSLTProcessingInstruction) < (0)) __PYX_ERR(3, 882, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__XSLTProcessingInstruction);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__XSLTProcessingInstruction->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__XSLTProcessingInstruction->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__XSLTProcessingInstruction->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree__XSLTProcessingInstruction, __pyx_vtabptr_4lxml_5etree__XSLTProcessingInstruction) < (0)) __PYX_ERR(3, 882, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree__XSLTProcessingInstruction) < (0)) __PYX_ERR(3, 882, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_XSLTProcessingInstruction, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree__XSLTProcessingInstruction) < (0)) __PYX_ERR(3, 882, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree_XSLTExtension = &__pyx_vtable_4lxml_5etree_XSLTExtension;
  __pyx_vtable_4lxml_5etree_XSLTExtension._collectXSLTResultContent = (PyObject *(*)(struct __pyx_obj_4lxml_5etree_XSLTExtension *, struct __pyx_obj_4lxml_5etree__XSLTContext *, xmlNode *, int, int))__pyx_f_4lxml_5etree_13XSLTExtension__collectXSLTResultContent;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTExtension = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_XSLTExtension_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTExtension)) __PYX_ERR(20, 3, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_XSLTExtension_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTExtension) < (0)) __PYX_ERR(20, 3, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTExtension = &__pyx_type_4lxml_5etree_XSLTExtension;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTExtension) < (0)) __PYX_ERR(20, 3, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTExtension);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTExtension->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTExtension->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTExtension->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTExtension, __pyx_vtabptr_4lxml_5etree_XSLTExtension) < (0)) __PYX_ERR(20, 3, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTExtension) < (0)) __PYX_ERR(20, 3, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_XSLTExtension, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_XSLTExtension) < (0)) __PYX_ERR(20, 3, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_LxmlError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3789, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree_DocumentInvalid = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_DocumentInvalid_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_DocumentInvalid)) __PYX_ERR(0, 3789, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_DocumentInvalid_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_DocumentInvalid) < (0)) __PYX_ERR(0, 3789, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_DocumentInvalid = &__pyx_type_4lxml_5etree_DocumentInvalid;
  #endif
  if (sizeof(struct __pyx_obj_4lxml_5etree_DocumentInvalid) != sizeof(PyBaseExceptionObject)) {
    if (__Pyx_validate_extern_base(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_LxmlError) < (0)) __PYX_ERR(0, 3789, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree_DocumentInvalid->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree_LxmlError;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_DocumentInvalid) < (0)) __PYX_ERR(0, 3789, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_DocumentInvalid);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_DocumentInvalid->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_DocumentInvalid->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_DocumentInvalid->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_DocumentInvalid, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_DocumentInvalid) < (0)) __PYX_ERR(0, 3789, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__Validator = &__pyx_vtable_4lxml_5etree__Validator;
  __pyx_vtable_4lxml_5etree__Validator._append_log_message = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__Validator *, int, int, int, int, PyObject *, PyObject *, int __pyx_skip_dispatch))__pyx_f_4lxml_5etree_10_Validator__append_log_message;
  __pyx_vtable_4lxml_5etree__Validator._clear_error_log = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__Validator *, int __pyx_skip_dispatch))__pyx_f_4lxml_5etree_10_Validator__clear_error_log;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree__Validator = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__Validator_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__Validator)) __PYX_ERR(0, 3797, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__Validator_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__Validator) < (0)) __PYX_ERR(0, 3797, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__Validator = &__pyx_type_4lxml_5etree__Validator;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__Validator) < (0)) __PYX_ERR(0, 3797, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__Validator);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__Validator->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__Validator->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__Validator->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree__Validator, __pyx_vtabptr_4lxml_5etree__Validator) < (0)) __PYX_ERR(0, 3797, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree__Validator) < (0)) __PYX_ERR(0, 3797, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_Validator, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree__Validator) < (0)) __PYX_ERR(0, 3797, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_LxmlError); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree_DTDError = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_DTDError_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_DTDError)) __PYX_ERR(21, 4, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_DTDError_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_DTDError) < (0)) __PYX_ERR(21, 4, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_DTDError = &__pyx_type_4lxml_5etree_DTDError;
  #endif
  if (sizeof(struct __pyx_obj_4lxml_5etree_DTDError) != sizeof(PyBaseExceptionObject)) {
    if (__Pyx_validate_extern_base(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_LxmlError) < (0)) __PYX_ERR(21, 4, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree_DTDError->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree_LxmlError;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_DTDError) < (0)) __PYX_ERR(21, 4, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_DTDError);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_DTDError->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_DTDError->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_DTDError->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_DTDError, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_DTDError) < (0)) __PYX_ERR(21, 4, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_DTDError); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree_DTDParseError = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_DTDParseError_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_DTDParseError)) __PYX_ERR(21, 8, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_DTDParseError_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_DTDParseError) < (0)) __PYX_ERR(21, 8, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_DTDParseError = &__pyx_type_4lxml_5etree_DTDParseError;
  #endif
  if (sizeof(struct __pyx_obj_4lxml_5etree_DTDParseError) != sizeof(PyBaseExceptionObject)) {
    if (__Pyx_validate_extern_base(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_DTDError) < (0)) __PYX_ERR(21, 8, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree_DTDParseError->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree_DTDError;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_DTDParseError) < (0)) __PYX_ERR(21, 8, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_DTDParseError);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_DTDParseError->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_DTDParseError->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_DTDParseError->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_DTDParseError, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_DTDParseError) < (0)) __PYX_ERR(21, 8, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_DTDError); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree_DTDValidateError = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_DTDValidateError_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_DTDValidateError)) __PYX_ERR(21, 12, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_DTDValidateError_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_DTDValidateError) < (0)) __PYX_ERR(21, 12, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_DTDValidateError = &__pyx_type_4lxml_5etree_DTDValidateError;
  #endif
  if (sizeof(struct __pyx_obj_4lxml_5etree_DTDValidateError) != sizeof(PyBaseExceptionObject)) {
    if (__Pyx_validate_extern_base(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_DTDError) < (0)) __PYX_ERR(21, 12, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree_DTDValidateError->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree_DTDError;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_DTDValidateError) < (0)) __PYX_ERR(21, 12, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_DTDValidateError);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_DTDValidateError->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_DTDValidateError->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_DTDValidateError->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_DTDValidateError, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_DTDValidateError) < (0)) __PYX_ERR(21, 12, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree__DTDElementContentDecl = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__DTDElementContentDecl_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__DTDElementContentDecl)) __PYX_ERR(21, 21, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__DTDElementContentDecl_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__DTDElementContentDecl) < (0)) __PYX_ERR(21, 21, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__DTDElementContentDecl = &__pyx_type_4lxml_5etree__DTDElementContentDecl;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__DTDElementContentDecl) < (0)) __PYX_ERR(21, 21, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__DTDElementContentDecl);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__DTDElementContentDecl->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__DTDElementContentDecl->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__DTDElementContentDecl->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree__DTDAttributeDecl = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__DTDAttributeDecl_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__DTDAttributeDecl)) __PYX_ERR(21, 91, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__DTDAttributeDecl_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__DTDAttributeDecl) < (0)) __PYX_ERR(21, 91, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__DTDAttributeDecl = &__pyx_type_4lxml_5etree__DTDAttributeDecl;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__DTDAttributeDecl) < (0)) __PYX_ERR(21, 91, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__DTDAttributeDecl);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__DTDAttributeDecl->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__DTDAttributeDecl->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__DTDAttributeDecl->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree__DTDElementDecl = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__DTDElementDecl_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__DTDElementDecl)) __PYX_ERR(21, 174, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__DTDElementDecl_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__DTDElementDecl) < (0)) __PYX_ERR(21, 174, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__DTDElementDecl = &__pyx_type_4lxml_5etree__DTDElementDecl;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__DTDElementDecl) < (0)) __PYX_ERR(21, 174, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__DTDElementDecl);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__DTDElementDecl->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__DTDElementDecl->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__DTDElementDecl->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree__DTDEntityDecl = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__DTDEntityDecl_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__DTDEntityDecl)) __PYX_ERR(21, 237, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__DTDEntityDecl_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__DTDEntityDecl) < (0)) __PYX_ERR(21, 237, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__DTDEntityDecl = &__pyx_type_4lxml_5etree__DTDEntityDecl;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__DTDEntityDecl) < (0)) __PYX_ERR(21, 237, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__DTDEntityDecl);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__DTDEntityDecl->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__DTDEntityDecl->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__DTDEntityDecl->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  __pyx_vtabptr_4lxml_5etree_DTD = &__pyx_vtable_4lxml_5etree_DTD;
  __pyx_vtable_4lxml_5etree_DTD.__pyx_base = *__pyx_vtabptr_4lxml_5etree__Validator;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Validator); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 270, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree_DTD = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_DTD_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_DTD)) __PYX_ERR(21, 270, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_DTD_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_DTD) < (0)) __PYX_ERR(21, 270, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_DTD = &__pyx_type_4lxml_5etree_DTD;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree_DTD->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Validator;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_DTD) < (0)) __PYX_ERR(21, 270, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_DTD);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_DTD->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_DTD->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_DTD->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_mstate->__pyx_ptype_4lxml_5etree_DTD, "__call__"); if (unlikely(!wrapper)) __PYX_ERR(21, 270, __pyx_L1_error)
    if (__Pyx_IS_TYPE(wrapper, &PyWrapperDescr_Type)) {
      __pyx_wrapperbase_4lxml_5etree_3DTD_14__call__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_3DTD_14__call__.doc = __pyx_doc_4lxml_5etree_3DTD_14__call__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_3DTD_14__call__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree_DTD, __pyx_vtabptr_4lxml_5etree_DTD) < (0)) __PYX_ERR(21, 270, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree_DTD) < (0)) __PYX_ERR(21, 270, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_DTD, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_DTD) < (0)) __PYX_ERR(21, 270, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_LxmlError); if (unlikely(!__pyx_t_1)) __PYX_ERR(22, 18, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree_RelaxNGError = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_RelaxNGError_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_RelaxNGError)) __PYX_ERR(22, 18, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_RelaxNGError_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_RelaxNGError) < (0)) __PYX_ERR(22, 18, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_RelaxNGError = &__pyx_type_4lxml_5etree_RelaxNGError;
  #endif
  if (sizeof(struct __pyx_obj_4lxml_5etree_RelaxNGError) != sizeof(PyBaseExceptionObject)) {
    if (__Pyx_validate_extern_base(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_LxmlError) < (0)) __PYX_ERR(22, 18, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree_RelaxNGError->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree_LxmlError;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_RelaxNGError) < (0)) __PYX_ERR(22, 18, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_RelaxNGError);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_RelaxNGError->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_RelaxNGError->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_RelaxNGError->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_RelaxNGError, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_RelaxNGError) < (0)) __PYX_ERR(22, 18, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_RelaxNGError); if (unlikely(!__pyx_t_1)) __PYX_ERR(22, 22, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree_RelaxNGParseError = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_RelaxNGParseError_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_RelaxNGParseError)) __PYX_ERR(22, 22, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_RelaxNGParseError_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_RelaxNGParseError) < (0)) __PYX_ERR(22, 22, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_RelaxNGParseError = &__pyx_type_4lxml_5etree_RelaxNGParseError;
  #endif
  if (sizeof(struct __pyx_obj_4lxml_5etree_RelaxNGParseError) != sizeof(PyBaseExceptionObject)) {
    if (__Pyx_validate_extern_base(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_RelaxNGError) < (0)) __PYX_ERR(22, 22, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree_RelaxNGParseError->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree_RelaxNGError;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_RelaxNGParseError) < (0)) __PYX_ERR(22, 22, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_RelaxNGParseError);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_RelaxNGParseError->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_RelaxNGParseError->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_RelaxNGParseError->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_RelaxNGParseError, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_RelaxNGParseError) < (0)) __PYX_ERR(22, 22, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_RelaxNGError); if (unlikely(!__pyx_t_1)) __PYX_ERR(22, 26, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree_RelaxNGValidateError = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_RelaxNGValidateError_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_RelaxNGValidateError)) __PYX_ERR(22, 26, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_RelaxNGValidateError_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_RelaxNGValidateError) < (0)) __PYX_ERR(22, 26, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_RelaxNGValidateError = &__pyx_type_4lxml_5etree_RelaxNGValidateError;
  #endif
  if (sizeof(struct __pyx_obj_4lxml_5etree_RelaxNGValidateError) != sizeof(PyBaseExceptionObject)) {
    if (__Pyx_validate_extern_base(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_RelaxNGError) < (0)) __PYX_ERR(22, 26, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree_RelaxNGValidateError->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree_RelaxNGError;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_RelaxNGValidateError) < (0)) __PYX_ERR(22, 26, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_RelaxNGValidateError);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_RelaxNGValidateError->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_RelaxNGValidateError->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_RelaxNGValidateError->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_RelaxNGValidateError, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_RelaxNGValidateError) < (0)) __PYX_ERR(22, 26, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree_RelaxNG = &__pyx_vtable_4lxml_5etree_RelaxNG;
  __pyx_vtable_4lxml_5etree_RelaxNG.__pyx_base = *__pyx_vtabptr_4lxml_5etree__Validator;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Validator); if (unlikely(!__pyx_t_1)) __PYX_ERR(22, 34, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree_RelaxNG = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_RelaxNG_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_RelaxNG)) __PYX_ERR(22, 34, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_RelaxNG_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_RelaxNG) < (0)) __PYX_ERR(22, 34, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_RelaxNG = &__pyx_type_4lxml_5etree_RelaxNG;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree_RelaxNG->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Validator;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_RelaxNG) < (0)) __PYX_ERR(22, 34, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_RelaxNG);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_RelaxNG->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_RelaxNG->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_RelaxNG->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_mstate->__pyx_ptype_4lxml_5etree_RelaxNG, "__call__"); if (unlikely(!wrapper)) __PYX_ERR(22, 34, __pyx_L1_error)
    if (__Pyx_IS_TYPE(wrapper, &PyWrapperDescr_Type)) {
      __pyx_wrapperbase_4lxml_5etree_7RelaxNG_6__call__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_7RelaxNG_6__call__.doc = __pyx_doc_4lxml_5etree_7RelaxNG_6__call__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_7RelaxNG_6__call__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree_RelaxNG, __pyx_vtabptr_4lxml_5etree_RelaxNG) < (0)) __PYX_ERR(22, 34, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree_RelaxNG) < (0)) __PYX_ERR(22, 34, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_RelaxNG, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_RelaxNG) < (0)) __PYX_ERR(22, 34, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_LxmlError); if (unlikely(!__pyx_t_1)) __PYX_ERR(23, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree_XMLSchemaError = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_XMLSchemaError_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_XMLSchemaError)) __PYX_ERR(23, 5, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_XMLSchemaError_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_XMLSchemaError) < (0)) __PYX_ERR(23, 5, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_XMLSchemaError = &__pyx_type_4lxml_5etree_XMLSchemaError;
  #endif
  if (sizeof(struct __pyx_obj_4lxml_5etree_XMLSchemaError) != sizeof(PyBaseExceptionObject)) {
    if (__Pyx_validate_extern_base(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_LxmlError) < (0)) __PYX_ERR(23, 5, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XMLSchemaError->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree_LxmlError;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_XMLSchemaError) < (0)) __PYX_ERR(23, 5, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_XMLSchemaError);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_XMLSchemaError->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_XMLSchemaError->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_XMLSchemaError->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_XMLSchemaError, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_XMLSchemaError) < (0)) __PYX_ERR(23, 5, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XMLSchemaError); if (unlikely(!__pyx_t_1)) __PYX_ERR(23, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree_XMLSchemaParseError = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_XMLSchemaParseError_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_XMLSchemaParseError)) __PYX_ERR(23, 9, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_XMLSchemaParseError_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_XMLSchemaParseError) < (0)) __PYX_ERR(23, 9, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_XMLSchemaParseError = &__pyx_type_4lxml_5etree_XMLSchemaParseError;
  #endif
  if (sizeof(struct __pyx_obj_4lxml_5etree_XMLSchemaParseError) != sizeof(PyBaseExceptionObject)) {
    if (__Pyx_validate_extern_base(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XMLSchemaError) < (0)) __PYX_ERR(23, 9, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XMLSchemaParseError->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XMLSchemaError;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_XMLSchemaParseError) < (0)) __PYX_ERR(23, 9, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_XMLSchemaParseError);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_XMLSchemaParseError->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_XMLSchemaParseError->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_XMLSchemaParseError->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_XMLSchemaParseError, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_XMLSchemaParseError) < (0)) __PYX_ERR(23, 9, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XMLSchemaError); if (unlikely(!__pyx_t_1)) __PYX_ERR(23, 13, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree_XMLSchemaValidateError = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_XMLSchemaValidateError_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_XMLSchemaValidateError)) __PYX_ERR(23, 13, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_XMLSchemaValidateError_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_XMLSchemaValidateError) < (0)) __PYX_ERR(23, 13, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_XMLSchemaValidateError = &__pyx_type_4lxml_5etree_XMLSchemaValidateError;
  #endif
  if (sizeof(struct __pyx_obj_4lxml_5etree_XMLSchemaValidateError) != sizeof(PyBaseExceptionObject)) {
    if (__Pyx_validate_extern_base(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XMLSchemaError) < (0)) __PYX_ERR(23, 13, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XMLSchemaValidateError->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XMLSchemaError;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_XMLSchemaValidateError) < (0)) __PYX_ERR(23, 13, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_XMLSchemaValidateError);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_XMLSchemaValidateError->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_XMLSchemaValidateError->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_XMLSchemaValidateError->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_XMLSchemaValidateError, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_XMLSchemaValidateError) < (0)) __PYX_ERR(23, 13, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree_XMLSchema = &__pyx_vtable_4lxml_5etree_XMLSchema;
  __pyx_vtable_4lxml_5etree_XMLSchema.__pyx_base = *__pyx_vtabptr_4lxml_5etree__Validator;
  __pyx_vtable_4lxml_5etree_XMLSchema._newSaxValidator = (struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *(*)(struct __pyx_obj_4lxml_5etree_XMLSchema *, int))__pyx_f_4lxml_5etree_9XMLSchema__newSaxValidator;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Validator); if (unlikely(!__pyx_t_1)) __PYX_ERR(23, 26, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree_XMLSchema = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_XMLSchema_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_XMLSchema)) __PYX_ERR(23, 26, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_XMLSchema_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_XMLSchema) < (0)) __PYX_ERR(23, 26, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_XMLSchema = &__pyx_type_4lxml_5etree_XMLSchema;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XMLSchema->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Validator;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_XMLSchema) < (0)) __PYX_ERR(23, 26, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_XMLSchema);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_XMLSchema->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_XMLSchema->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_XMLSchema->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_mstate->__pyx_ptype_4lxml_5etree_XMLSchema, "__call__"); if (unlikely(!wrapper)) __PYX_ERR(23, 26, __pyx_L1_error)
    if (__Pyx_IS_TYPE(wrapper, &PyWrapperDescr_Type)) {
      __pyx_wrapperbase_4lxml_5etree_9XMLSchema_6__call__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_9XMLSchema_6__call__.doc = __pyx_doc_4lxml_5etree_9XMLSchema_6__call__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_9XMLSchema_6__call__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree_XMLSchema, __pyx_vtabptr_4lxml_5etree_XMLSchema) < (0)) __PYX_ERR(23, 26, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree_XMLSchema) < (0)) __PYX_ERR(23, 26, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_XMLSchema, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_XMLSchema) < (0)) __PYX_ERR(23, 26, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__ParserSchemaValidationContext = &__pyx_vtable_4lxml_5etree__ParserSchemaValidationContext;
  __pyx_vtable_4lxml_5etree__ParserSchemaValidationContext.copy = (struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *(*)(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *))__pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_copy;
  __pyx_vtable_4lxml_5etree__ParserSchemaValidationContext.inject_default_attributes = (void (*)(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *, xmlDoc *))__pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_inject_default_attributes;
  __pyx_vtable_4lxml_5etree__ParserSchemaValidationContext.connect = (int (*)(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *, xmlParserCtxt *, struct __pyx_obj_4lxml_5etree__BaseErrorLog *))__pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_connect;
  __pyx_vtable_4lxml_5etree__ParserSchemaValidationContext.disconnect = (void (*)(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *))__pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_disconnect;
  __pyx_vtable_4lxml_5etree__ParserSchemaValidationContext.isvalid = (int (*)(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *))__pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_isvalid;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree__ParserSchemaValidationContext = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__ParserSchemaValidationContext_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__ParserSchemaValidationContext)) __PYX_ERR(23, 158, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__ParserSchemaValidationContext_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__ParserSchemaValidationContext) < (0)) __PYX_ERR(23, 158, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__ParserSchemaValidationContext = &__pyx_type_4lxml_5etree__ParserSchemaValidationContext;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__ParserSchemaValidationContext) < (0)) __PYX_ERR(23, 158, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__ParserSchemaValidationContext);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__ParserSchemaValidationContext->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__ParserSchemaValidationContext->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__ParserSchemaValidationContext->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree__ParserSchemaValidationContext, __pyx_vtabptr_4lxml_5etree__ParserSchemaValidationContext) < (0)) __PYX_ERR(23, 158, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree__ParserSchemaValidationContext) < (0)) __PYX_ERR(23, 158, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_LxmlError); if (unlikely(!__pyx_t_1)) __PYX_ERR(24, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree_SchematronError = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_SchematronError_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_SchematronError)) __PYX_ERR(24, 5, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_SchematronError_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_SchematronError) < (0)) __PYX_ERR(24, 5, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_SchematronError = &__pyx_type_4lxml_5etree_SchematronError;
  #endif
  if (sizeof(struct __pyx_obj_4lxml_5etree_SchematronError) != sizeof(PyBaseExceptionObject)) {
    if (__Pyx_validate_extern_base(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_LxmlError) < (0)) __PYX_ERR(24, 5, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree_SchematronError->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree_LxmlError;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_SchematronError) < (0)) __PYX_ERR(24, 5, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_SchematronError);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_SchematronError->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_SchematronError->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_SchematronError->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_SchematronError, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_SchematronError) < (0)) __PYX_ERR(24, 5, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_SchematronError); if (unlikely(!__pyx_t_1)) __PYX_ERR(24, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree_SchematronParseError = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_SchematronParseError_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_SchematronParseError)) __PYX_ERR(24, 9, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_SchematronParseError_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_SchematronParseError) < (0)) __PYX_ERR(24, 9, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_SchematronParseError = &__pyx_type_4lxml_5etree_SchematronParseError;
  #endif
  if (sizeof(struct __pyx_obj_4lxml_5etree_SchematronParseError) != sizeof(PyBaseExceptionObject)) {
    if (__Pyx_validate_extern_base(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_SchematronError) < (0)) __PYX_ERR(24, 9, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree_SchematronParseError->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree_SchematronError;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_SchematronParseError) < (0)) __PYX_ERR(24, 9, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_SchematronParseError);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_SchematronParseError->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_SchematronParseError->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_SchematronParseError->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_SchematronParseError, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_SchematronParseError) < (0)) __PYX_ERR(24, 9, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_SchematronError); if (unlikely(!__pyx_t_1)) __PYX_ERR(24, 13, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree_SchematronValidateError = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_SchematronValidateError_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_SchematronValidateError)) __PYX_ERR(24, 13, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_SchematronValidateError_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_SchematronValidateError) < (0)) __PYX_ERR(24, 13, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_SchematronValidateError = &__pyx_type_4lxml_5etree_SchematronValidateError;
  #endif
  if (sizeof(struct __pyx_obj_4lxml_5etree_SchematronValidateError) != sizeof(PyBaseExceptionObject)) {
    if (__Pyx_validate_extern_base(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_SchematronError) < (0)) __PYX_ERR(24, 13, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree_SchematronValidateError->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree_SchematronError;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_SchematronValidateError) < (0)) __PYX_ERR(24, 13, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_SchematronValidateError);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_SchematronValidateError->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_SchematronValidateError->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_SchematronValidateError->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_SchematronValidateError, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_SchematronValidateError) < (0)) __PYX_ERR(24, 13, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree_Schematron = &__pyx_vtable_4lxml_5etree_Schematron;
  __pyx_vtable_4lxml_5etree_Schematron.__pyx_base = *__pyx_vtabptr_4lxml_5etree__Validator;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Validator); if (unlikely(!__pyx_t_1)) __PYX_ERR(24, 21, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4lxml_5etree_Schematron = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_Schematron_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_Schematron)) __PYX_ERR(24, 21, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_Schematron_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree_Schematron) < (0)) __PYX_ERR(24, 21, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree_Schematron = &__pyx_type_4lxml_5etree_Schematron;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_4lxml_5etree_Schematron->tp_base = __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Validator;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree_Schematron) < (0)) __PYX_ERR(24, 21, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree_Schematron);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree_Schematron->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree_Schematron->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree_Schematron->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_mstate->__pyx_ptype_4lxml_5etree_Schematron, "__call__"); if (unlikely(!wrapper)) __PYX_ERR(24, 21, __pyx_L1_error)
    if (__Pyx_IS_TYPE(wrapper, &PyWrapperDescr_Type)) {
      __pyx_wrapperbase_4lxml_5etree_10Schematron_4__call__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_10Schematron_4__call__.doc = __pyx_doc_4lxml_5etree_10Schematron_4__call__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_10Schematron_4__call__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4lxml_5etree_Schematron, __pyx_vtabptr_4lxml_5etree_Schematron) < (0)) __PYX_ERR(24, 21, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4lxml_5etree_Schematron) < (0)) __PYX_ERR(24, 21, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_Schematron, (PyObject *) __pyx_mstate->__pyx_ptype_4lxml_5etree_Schematron) < (0)) __PYX_ERR(24, 21, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree__MemDebug = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__MemDebug_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__MemDebug)) __PYX_ERR(26, 1, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__MemDebug_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree__MemDebug) < (0)) __PYX_ERR(26, 1, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree__MemDebug = &__pyx_type_4lxml_5etree__MemDebug;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree__MemDebug) < (0)) __PYX_ERR(26, 1, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree__MemDebug);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree__MemDebug->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree__MemDebug->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree__MemDebug->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct___open_utf8_file = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree___pyx_scope_struct___open_utf8_file_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct___open_utf8_file)) __PYX_ERR(6, 541, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree___pyx_scope_struct___open_utf8_file_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct___open_utf8_file) < (0)) __PYX_ERR(6, 541, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct___open_utf8_file = &__pyx_type_4lxml_5etree___pyx_scope_struct___open_utf8_file;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct___open_utf8_file) < (0)) __PYX_ERR(6, 541, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct___open_utf8_file);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct___open_utf8_file->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct___open_utf8_file->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct___open_utf8_file->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_1__iter_namespaces = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree___pyx_scope_struct_1__iter_namespaces_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_1__iter_namespaces)) __PYX_ERR(6, 974, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree___pyx_scope_struct_1__iter_namespaces_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_1__iter_namespaces) < (0)) __PYX_ERR(6, 974, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_1__iter_namespaces = &__pyx_type_4lxml_5etree___pyx_scope_struct_1__iter_namespaces;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_1__iter_namespaces) < (0)) __PYX_ERR(6, 974, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_1__iter_namespaces);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_1__iter_namespaces->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_1__iter_namespaces->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_1__iter_namespaces->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_2___aenter__ = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree___pyx_scope_struct_2___aenter___spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_2___aenter__)) __PYX_ERR(6, 1328, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree___pyx_scope_struct_2___aenter___spec, __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_2___aenter__) < (0)) __PYX_ERR(6, 1328, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_2___aenter__ = &__pyx_type_4lxml_5etree___pyx_scope_struct_2___aenter__;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_2___aenter__) < (0)) __PYX_ERR(6, 1328, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_2___aenter__);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_2___aenter__->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_2___aenter__->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_2___aenter__->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_3___aexit__ = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree___pyx_scope_struct_3___aexit___spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_3___aexit__)) __PYX_ERR(6, 1339, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree___pyx_scope_struct_3___aexit___spec, __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_3___aexit__) < (0)) __PYX_ERR(6, 1339, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_3___aexit__ = &__pyx_type_4lxml_5etree___pyx_scope_struct_3___aexit__;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_3___aexit__) < (0)) __PYX_ERR(6, 1339, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_3___aexit__);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_3___aexit__->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_3___aexit__->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_3___aexit__->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_4_flush = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree___pyx_scope_struct_4_flush_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_4_flush)) __PYX_ERR(6, 1724, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree___pyx_scope_struct_4_flush_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_4_flush) < (0)) __PYX_ERR(6, 1724, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_4_flush = &__pyx_type_4lxml_5etree___pyx_scope_struct_4_flush;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_4_flush) < (0)) __PYX_ERR(6, 1724, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_4_flush);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_4_flush->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_4_flush->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_4_flush->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_5_write_declaration = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree___pyx_scope_struct_5_write_declaration_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_5_write_declaration)) __PYX_ERR(6, 1730, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree___pyx_scope_struct_5_write_declaration_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_5_write_declaration) < (0)) __PYX_ERR(6, 1730, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_5_write_declaration = &__pyx_type_4lxml_5etree___pyx_scope_struct_5_write_declaration;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_5_write_declaration) < (0)) __PYX_ERR(6, 1730, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_5_write_declaration);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_5_write_declaration->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_5_write_declaration->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_5_write_declaration->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_6_write_doctype = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree___pyx_scope_struct_6_write_doctype_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_6_write_doctype)) __PYX_ERR(6, 1736, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree___pyx_scope_struct_6_write_doctype_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_6_write_doctype) < (0)) __PYX_ERR(6, 1736, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_6_write_doctype = &__pyx_type_4lxml_5etree___pyx_scope_struct_6_write_doctype;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_6_write_doctype) < (0)) __PYX_ERR(6, 1736, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_6_write_doctype);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_6_write_doctype->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_6_write_doctype->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_6_write_doctype->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_7_write = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree___pyx_scope_struct_7_write_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_7_write)) __PYX_ERR(6, 1742, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree___pyx_scope_struct_7_write_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_7_write) < (0)) __PYX_ERR(6, 1742, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_7_write = &__pyx_type_4lxml_5etree___pyx_scope_struct_7_write;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_7_write) < (0)) __PYX_ERR(6, 1742, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_7_write);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_7_write->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_7_write->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_7_write->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_8__close = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree___pyx_scope_struct_8__close_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_8__close)) __PYX_ERR(6, 1755, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree___pyx_scope_struct_8__close_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_8__close) < (0)) __PYX_ERR(6, 1755, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_8__close = &__pyx_type_4lxml_5etree___pyx_scope_struct_8__close;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_8__close) < (0)) __PYX_ERR(6, 1755, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_8__close);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_8__close->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_8__close->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_8__close->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_9___aenter__ = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree___pyx_scope_struct_9___aenter___spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_9___aenter__)) __PYX_ERR(6, 1775, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree___pyx_scope_struct_9___aenter___spec, __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_9___aenter__) < (0)) __PYX_ERR(6, 1775, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_9___aenter__ = &__pyx_type_4lxml_5etree___pyx_scope_struct_9___aenter__;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_9___aenter__) < (0)) __PYX_ERR(6, 1775, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_9___aenter__);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_9___aenter__->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_9___aenter__->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_9___aenter__->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_10___aexit__ = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree___pyx_scope_struct_10___aexit___spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_10___aexit__)) __PYX_ERR(6, 1781, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree___pyx_scope_struct_10___aexit___spec, __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_10___aexit__) < (0)) __PYX_ERR(6, 1781, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_10___aexit__ = &__pyx_type_4lxml_5etree___pyx_scope_struct_10___aexit__;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_10___aexit__) < (0)) __PYX_ERR(6, 1781, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_10___aexit__);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_10___aexit__->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_10___aexit__->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_10___aexit__->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_11___aenter__ = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree___pyx_scope_struct_11___aenter___spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_11___aenter__)) __PYX_ERR(6, 1843, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree___pyx_scope_struct_11___aenter___spec, __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_11___aenter__) < (0)) __PYX_ERR(6, 1843, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_11___aenter__ = &__pyx_type_4lxml_5etree___pyx_scope_struct_11___aenter__;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_11___aenter__) < (0)) __PYX_ERR(6, 1843, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_11___aenter__);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_11___aenter__->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_11___aenter__->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_11___aenter__->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_12___aexit__ = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree___pyx_scope_struct_12___aexit___spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_12___aexit__)) __PYX_ERR(6, 1847, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree___pyx_scope_struct_12___aexit___spec, __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_12___aexit__) < (0)) __PYX_ERR(6, 1847, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_12___aexit__ = &__pyx_type_4lxml_5etree___pyx_scope_struct_12___aexit__;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_12___aexit__) < (0)) __PYX_ERR(6, 1847, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_12___aexit__);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_12___aexit__->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_12___aexit__->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_12___aexit__->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_13_itervalues = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree___pyx_scope_struct_13_itervalues_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_13_itervalues)) __PYX_ERR(21, 163, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree___pyx_scope_struct_13_itervalues_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_13_itervalues) < (0)) __PYX_ERR(21, 163, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_13_itervalues = &__pyx_type_4lxml_5etree___pyx_scope_struct_13_itervalues;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_13_itervalues) < (0)) __PYX_ERR(21, 163, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_13_itervalues);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_13_itervalues->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_13_itervalues->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_13_itervalues->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_14_iterattributes = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree___pyx_scope_struct_14_iterattributes_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_14_iterattributes)) __PYX_ERR(21, 223, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree___pyx_scope_struct_14_iterattributes_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_14_iterattributes) < (0)) __PYX_ERR(21, 223, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_14_iterattributes = &__pyx_type_4lxml_5etree___pyx_scope_struct_14_iterattributes;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_14_iterattributes) < (0)) __PYX_ERR(21, 223, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_14_iterattributes);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_14_iterattributes->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_14_iterattributes->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_14_iterattributes->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_15_iterelements = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree___pyx_scope_struct_15_iterelements_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_15_iterelements)) __PYX_ERR(21, 327, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree___pyx_scope_struct_15_iterelements_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_15_iterelements) < (0)) __PYX_ERR(21, 327, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_15_iterelements = &__pyx_type_4lxml_5etree___pyx_scope_struct_15_iterelements;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_15_iterelements) < (0)) __PYX_ERR(21, 327, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_15_iterelements);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_15_iterelements->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_15_iterelements->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_15_iterelements->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_16_iterentities = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree___pyx_scope_struct_16_iterentities_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_16_iterentities)) __PYX_ERR(21, 340, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree___pyx_scope_struct_16_iterentities_spec, __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_16_iterentities) < (0)) __PYX_ERR(21, 340, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_16_iterentities = &__pyx_type_4lxml_5etree___pyx_scope_struct_16_iterentities;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_16_iterentities) < (0)) __PYX_ERR(21, 340, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_16_iterentities);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_16_iterentities->tp_dictoffset && __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_16_iterentities->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4lxml_5etree___pyx_scope_struct_16_iterentities->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  __pyx_vtabptr_array = &__pyx_vtable_array;
  __pyx_vtable_array.get_memview = (PyObject *(*)(struct __pyx_array_obj *))__pyx_array_get_memview;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_array_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_array_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_array_type)) __PYX_ERR(7, 110, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate->__pyx_array_type->tp_as_buffer = &__pyx_tp_as_buffer_array;
  if (!__pyx_mstate->__pyx_array_type->tp_as_buffer->bf_releasebuffer && __pyx_mstate->__pyx_array_type->tp_base->tp_as_buffer && __pyx_mstate->__pyx_array_type->tp_base->tp_as_buffer->bf_releasebuffer) {
    __pyx_mstate->__pyx_array_type->tp_as_buffer->bf_releasebuffer = __pyx_mstate->__pyx_array_type->tp_base->tp_as_buffer->bf_releasebuffer;
  }
  #elif defined(Py_bf_getbuffer) && defined(Py_bf_releasebuffer)
  /* PY_VERSION_HEX >= 0x03090000 || Py_LIMITED_API >= 0x030B0000 */
  #elif defined(_MSC_VER)
  #pragma message ("The buffer protocol is not supported in the Limited C-API < 3.11.")
  #else
  #warning "The buffer protocol is not supported in the Limited C-API < 3.11."
  #endif
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_array_spec, __pyx_mstate->__pyx_array_type) < (0)) __PYX_ERR(7, 110, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_array_type = &__pyx_type___pyx_array;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_array_type) < (0)) __PYX_ERR(7, 110, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_array_type);
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_array_type, __pyx_vtabptr_array) < (0)) __PYX_ERR(7, 110, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_array_type) < (0)) __PYX_ERR(7, 110, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_array_type) < (0)) __PYX_ERR(7, 110, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_MemviewEnum_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_MemviewEnum_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_MemviewEnum_type)) __PYX_ERR(7, 299, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_MemviewEnum_spec, __pyx_mstate->__pyx_MemviewEnum_type) < (0)) __PYX_ERR(7, 299, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_MemviewEnum_type) < (0)) __PYX_ERR(7, 299, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_MemviewEnum_type);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_MemviewEnum_type->tp_dictoffset && __pyx_mstate->__pyx_MemviewEnum_type->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_MemviewEnum_type->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_MemviewEnum_type) < (0)) __PYX_ERR(7, 299, __pyx_L1_error)
  __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview;
  __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer;
  __pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice;
  __pyx_vtable_memoryview.setitem_slice_assignment = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_slice_assignment;
  __pyx_vtable_memoryview.setitem_slice_assign_scalar = (PyObject *(*)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_setitem_slice_assign_scalar;
  __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed;
  __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryview_convert_item_to_object;
  __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object;
  __pyx_vtable_memoryview._get_base = (PyObject *(*)(struct __pyx_memoryview_obj *))__pyx_memoryview__get_base;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_memoryview_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_memoryview_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_memoryview_type)) __PYX_ERR(7, 334, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate->__pyx_memoryview_type->tp_as_buffer = &__pyx_tp_as_buffer_memoryview;
  if (!__pyx_mstate->__pyx_memoryview_type->tp_as_buffer->bf_releasebuffer && __pyx_mstate->__pyx_memoryview_type->tp_base->tp_as_buffer && __pyx_mstate->__pyx_memoryview_type->tp_base->tp_as_buffer->bf_releasebuffer) {
    __pyx_mstate->__pyx_memoryview_type->tp_as_buffer->bf_releasebuffer = __pyx_mstate->__pyx_memoryview_type->tp_base->tp_as_buffer->bf_releasebuffer;
  }
  #elif defined(Py_bf_getbuffer) && defined(Py_bf_releasebuffer)
  /* PY_VERSION_HEX >= 0x03090000 || Py_LIMITED_API >= 0x030B0000 */
  #elif defined(_MSC_VER)
  #pragma message ("The buffer protocol is not supported in the Limited C-API < 3.11.")
  #else
  #warning "The buffer protocol is not supported in the Limited C-API < 3.11."
  #endif
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_memoryview_spec, __pyx_mstate->__pyx_memoryview_type) < (0)) __PYX_ERR(7, 334, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_memoryview_type = &__pyx_type___pyx_memoryview;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_memoryview_type) < (0)) __PYX_ERR(7, 334, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_memoryview_type);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_memoryview_type->tp_dictoffset && __pyx_mstate->__pyx_memoryview_type->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_memoryview_type->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_memoryview_type, __pyx_vtabptr_memoryview) < (0)) __PYX_ERR(7, 334, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_memoryview_type) < (0)) __PYX_ERR(7, 334, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_memoryview_type) < (0)) __PYX_ERR(7, 334, __pyx_L1_error)
  __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice;
  __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview;
  __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object;
  __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object;
  __pyx_vtable__memoryviewslice.__pyx_base._get_base = (PyObject *(*)(struct __pyx_memoryview_obj *))__pyx_memoryviewslice__get_base;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_memoryview_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 951, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_memoryviewslice_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_memoryviewslice_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_memoryviewslice_type)) __PYX_ERR(7, 951, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_memoryviewslice_spec, __pyx_mstate->__pyx_memoryviewslice_type) < (0)) __PYX_ERR(7, 951, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_memoryviewslice_type->tp_base = __pyx_mstate_global->__pyx_memoryview_type;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_memoryviewslice_type) < (0)) __PYX_ERR(7, 951, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_memoryviewslice_type);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_memoryviewslice_type->tp_dictoffset && __pyx_mstate->__pyx_memoryviewslice_type->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_memoryviewslice_type->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_memoryviewslice_type, __pyx_vtabptr__memoryviewslice) < (0)) __PYX_ERR(7, 951, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_memoryviewslice_type) < (0)) __PYX_ERR(7, 951, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_memoryviewslice_type) < (0)) __PYX_ERR(7, 951, __pyx_L1_error)
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_type_import_code(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
  /*--- Type import code ---*/
  __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(27, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_7cpython_4type_type = __Pyx_ImportType_3_2_4(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_4(PyTypeObject),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  0, 0,
  #else
  sizeof(PyHeapTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_4(PyHeapTypeObject),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_4); if (!__pyx_mstate->__pyx_ptype_7cpython_4type_type) __PYX_ERR(27, 9, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_variable_import_code(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
  /*--- Variable import code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_function_import_code(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
  /*--- Function import code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

#if CYTHON_PEP489_MULTI_PHASE_INIT
static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
static int __pyx_pymod_exec_etree(PyObject* module); /*proto*/
static PyModuleDef_Slot __pyx_moduledef_slots[] = {
  {Py_mod_create, (void*)__pyx_pymod_create},
  {Py_mod_exec, (void*)__pyx_pymod_exec_etree},
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  {Py_mod_gil, __Pyx_FREETHREADING_COMPATIBLE},
  #endif
  #if PY_VERSION_HEX >= 0x030C0000 && CYTHON_USE_MODULE_STATE
  {Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED},
  #endif
  {0, NULL}
};
#endif

#ifdef __cplusplus
namespace {
  struct PyModuleDef __pyx_moduledef =
  #else
  static struct PyModuleDef __pyx_moduledef =
  #endif
  {
      PyModuleDef_HEAD_INIT,
      "etree",
      __pyx_k_The_lxml_etree_module_implement, /* m_doc */
    #if CYTHON_USE_MODULE_STATE
      sizeof(__pyx_mstatetype), /* m_size */
    #else
      (CYTHON_PEP489_MULTI_PHASE_INIT) ? 0 : -1, /* m_size */
    #endif
      __pyx_methods /* m_methods */,
    #if CYTHON_PEP489_MULTI_PHASE_INIT
      __pyx_moduledef_slots, /* m_slots */
    #else
      NULL, /* m_reload */
    #endif
    #if CYTHON_USE_MODULE_STATE
      __pyx_m_traverse, /* m_traverse */
      __pyx_m_clear, /* m_clear */
      (freefunc)__pyx_module_cleanup /* m_free */
    #else
      NULL, /* m_traverse */
      NULL, /* m_clear */
      (freefunc)__pyx_module_cleanup /* m_free */
    #endif
  };
  #ifdef __cplusplus
} /* anonymous namespace */
#endif

/* PyModInitFuncType */
#ifndef CYTHON_NO_PYINIT_EXPORT
  #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
#else
  #ifdef __cplusplus
  #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
  #else
  #define __Pyx_PyMODINIT_FUNC PyObject *
  #endif
#endif

__Pyx_PyMODINIT_FUNC PyInit_etree(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC PyInit_etree(void)
#if CYTHON_PEP489_MULTI_PHASE_INIT
{
  return PyModuleDef_Init(&__pyx_moduledef);
}
/* ModuleCreationPEP489 */
#if CYTHON_COMPILING_IN_LIMITED_API && (__PYX_LIMITED_VERSION_HEX < 0x03090000\
      || ((defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)) && __PYX_LIMITED_VERSION_HEX < 0x030A0000))
static PY_INT64_T __Pyx_GetCurrentInterpreterId(void) {
    {
        PyObject *module = PyImport_ImportModule("_interpreters"); // 3.13+ I think
        if (!module) {
            PyErr_Clear(); // just try the 3.8-3.12 version
            module = PyImport_ImportModule("_xxsubinterpreters");
            if (!module) goto bad;
        }
        PyObject *current = PyObject_CallMethod(module, "get_current", NULL);
        Py_DECREF(module);
        if (!current) goto bad;
        if (PyTuple_Check(current)) {
            PyObject *new_current = PySequence_GetItem(current, 0);
            Py_DECREF(current);
            current = new_current;
            if (!new_current) goto bad;
        }
        long long as_c_int = PyLong_AsLongLong(current);
        Py_DECREF(current);
        return as_c_int;
    }
  bad:
    PySys_WriteStderr("__Pyx_GetCurrentInterpreterId failed. Try setting the C define CYTHON_PEP489_MULTI_PHASE_INIT=0\n");
    return -1;
}
#endif
#if !CYTHON_USE_MODULE_STATE
static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
    static PY_INT64_T main_interpreter_id = -1;
#if CYTHON_COMPILING_IN_GRAAL && defined(GRAALPY_VERSION_NUM) && GRAALPY_VERSION_NUM > 0x19000000
    PY_INT64_T current_id = GraalPyInterpreterState_GetIDFromThreadState(PyThreadState_Get());
#elif CYTHON_COMPILING_IN_GRAAL
    PY_INT64_T current_id = PyInterpreterState_GetIDFromThreadState(PyThreadState_Get());
#elif CYTHON_COMPILING_IN_LIMITED_API && (__PYX_LIMITED_VERSION_HEX < 0x03090000\
      || ((defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)) && __PYX_LIMITED_VERSION_HEX < 0x030A0000))
    PY_INT64_T current_id = __Pyx_GetCurrentInterpreterId();
#elif CYTHON_COMPILING_IN_LIMITED_API
    PY_INT64_T current_id = PyInterpreterState_GetID(PyInterpreterState_Get());
#else
    PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
#endif
    if (unlikely(current_id == -1)) {
        return -1;
    }
    if (main_interpreter_id == -1) {
        main_interpreter_id = current_id;
        return 0;
    } else if (unlikely(main_interpreter_id != current_id)) {
        PyErr_SetString(
            PyExc_ImportError,
            "Interpreter change detected - this module can only be loaded into one interpreter per process.");
        return -1;
    }
    return 0;
}
#endif
static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none)
{
    PyObject *value = PyObject_GetAttrString(spec, from_name);
    int result = 0;
    if (likely(value)) {
        if (allow_none || value != Py_None) {
            result = PyDict_SetItemString(moddict, to_name, value);
        }
        Py_DECREF(value);
    } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
        PyErr_Clear();
    } else {
        result = -1;
    }
    return result;
}
static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) {
    PyObject *module = NULL, *moddict, *modname;
    CYTHON_UNUSED_VAR(def);
    #if !CYTHON_USE_MODULE_STATE
    if (__Pyx_check_single_interpreter())
        return NULL;
    #endif
    if (__pyx_m)
        return __Pyx_NewRef(__pyx_m);
    modname = PyObject_GetAttrString(spec, "name");
    if (unlikely(!modname)) goto bad;
    module = PyModule_NewObject(modname);
    Py_DECREF(modname);
    if (unlikely(!module)) goto bad;
    moddict = PyModule_GetDict(module);
    if (unlikely(!moddict)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
    return module;
bad:
    Py_XDECREF(module);
    return NULL;
}


static CYTHON_SMALL_CODE int __pyx_pymod_exec_etree(PyObject *__pyx_pyinit_module)
#endif
{
  int stringtab_initialized = 0;
  #if CYTHON_USE_MODULE_STATE
  int pystate_addmodule_run = 0;
  #endif
  __pyx_mstatetype *__pyx_mstate = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  static PyThread_type_lock __pyx_t_7[8];
  int __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  unsigned char *__pyx_t_13;
  int __pyx_t_14;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  struct __pyx_opt_args_4lxml_5etree___unpackIntVersion __pyx_t_17;
  PyObject *__pyx_t_18 = NULL;
  PyObject *__pyx_t_19 = NULL;
  PyObject *__pyx_t_20 = NULL;
  PyObject *__pyx_t_21 = NULL;
  PyObject *__pyx_t_22 = NULL;
  PyObject *__pyx_t_23 = NULL;
  PyObject *__pyx_t_24 = NULL;
  xmlFeature __pyx_t_25;
  PyObject *__pyx_t_26 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  if (__pyx_m) {
    if (__pyx_m == __pyx_pyinit_module) return 0;
    PyErr_SetString(PyExc_RuntimeError, "Module 'etree' has already been imported. Re-initialisation is not supported.");
    return -1;
  }
  #else
  if (__pyx_m) return __Pyx_NewRef(__pyx_m);
  #endif
  /*--- Module creation code ---*/
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  __pyx_t_1 = __pyx_pyinit_module;
  Py_INCREF(__pyx_t_1);
  #else
  __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #if CYTHON_USE_MODULE_STATE
  {
    int add_module_result = __Pyx_State_AddModule(__pyx_t_1, &__pyx_moduledef);
    __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to "etree" pseudovariable */
    if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
    pystate_addmodule_run = 1;
  }
  #else
  __pyx_m = __pyx_t_1;
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  PyUnstable_Module_SetGIL(__pyx_m, Py_MOD_GIL_USED);
  #endif
  __pyx_mstate = __pyx_mstate_global;
  CYTHON_UNUSED_VAR(__pyx_t_1);
  __pyx_mstate->__pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_mstate->__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_INCREF(__pyx_mstate->__pyx_d);
  __pyx_mstate->__pyx_b = __Pyx_PyImport_AddModuleRef(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_mstate->__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_cython_runtime = __Pyx_PyImport_AddModuleRef("cython_runtime"); if (unlikely(!__pyx_mstate->__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_mstate->__pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  /* ImportRefnannyAPI */
  #if CYTHON_REFNANNY
  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
  if (!__Pyx_RefNanny) {
    PyErr_Clear();
    __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
    if (!__Pyx_RefNanny)
        Py_FatalError("failed to import 'refnanny' module");
  }
  #endif
  
__Pyx_RefNannySetupContext("PyInit_etree", 0);
  __Pyx_init_runtime_version();
  if (__Pyx_check_binary_version(__PYX_LIMITED_VERSION_HEX, __Pyx_get_runtime_version(), CYTHON_COMPILING_IN_LIMITED_API) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_mstate->__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_mstate->__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_mstate->__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Library function declarations ---*/
  /*--- Initialize various global constants etc. ---*/
  if (__Pyx_InitConstants(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  stringtab_initialized = 1;
  if (__Pyx_InitGlobals() < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__pyx_module_is_main_lxml__etree) {
    if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_name_2, __pyx_mstate_global->__pyx_n_u_main) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  }
  {
    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
    if (!PyDict_GetItemString(modules, "lxml.etree")) {
      if (unlikely((PyDict_SetItemString(modules, "lxml.etree", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
    }
  }
  /*--- Builtin init code ---*/
  if (__Pyx_InitCachedBuiltins(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Constants init code ---*/
  if (__Pyx_InitCachedConstants(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_CreateCodeObjects(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Global type/function init code ---*/
  (void)__Pyx_modinit_global_init_code(__pyx_mstate);
  (void)__Pyx_modinit_variable_export_code(__pyx_mstate);
  if (unlikely((__Pyx_modinit_function_export_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
  if (unlikely((__Pyx_modinit_type_init_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
  if (unlikely((__Pyx_modinit_type_import_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
  (void)__Pyx_modinit_variable_import_code(__pyx_mstate);
  (void)__Pyx_modinit_function_import_code(__pyx_mstate);
  /*--- Execution code ---*/

  /* "View.MemoryView":100
 * 
 * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence"
 * try:             # <<<<<<<<<<<<<<
 *     __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence
 * except:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "View.MemoryView":101
 * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence"
 * try:
 *     __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence             # <<<<<<<<<<<<<<
 * except:
 * 
*/
      __pyx_t_5 = NULL;
      __pyx_t_6 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_collections_abc};
        __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin___import__, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 101, __pyx_L2_error)
        __Pyx_GOTREF(__pyx_t_4);
      }
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_abc); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 101, __pyx_L2_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_Sequence); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 101, __pyx_L2_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XGOTREF(__pyx_collections_abc_Sequence);
      __Pyx_DECREF_SET(__pyx_collections_abc_Sequence, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_4 = 0;

      /* "View.MemoryView":100
 * 
 * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence"
 * try:             # <<<<<<<<<<<<<<
 *     __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence
 * except:
*/
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L7_try_end;
    __pyx_L2_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "View.MemoryView":102
 * try:
 *     __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence
 * except:             # <<<<<<<<<<<<<<
 * 
 *     __pyx_collections_abc_Sequence = None
*/
    /*except:*/ {
      __Pyx_ErrRestore(0,0,0);

      /* "View.MemoryView":104
 * except:
 * 
 *     __pyx_collections_abc_Sequence = None             # <<<<<<<<<<<<<<
 * 
 * 
*/
      __Pyx_INCREF(Py_None);
      __Pyx_XGOTREF(__pyx_collections_abc_Sequence);
      __Pyx_DECREF_SET(__pyx_collections_abc_Sequence, Py_None);
      __Pyx_GIVEREF(Py_None);
      goto __pyx_L3_exception_handled;
    }
    __pyx_L3_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    __pyx_L7_try_end:;
  }

  /* "View.MemoryView":239
 * 
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         count = __pyx_collections_abc_Sequence.count
 *         index = __pyx_collections_abc_Sequence.index
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_1);
    /*try:*/ {

      /* "View.MemoryView":240
 * 
 *     try:
 *         count = __pyx_collections_abc_Sequence.count             # <<<<<<<<<<<<<<
 *         index = __pyx_collections_abc_Sequence.index
 *     except:
*/
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_mstate_global->__pyx_n_u_count); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 240, __pyx_L10_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_array_type, __pyx_mstate_global->__pyx_n_u_count, __pyx_t_4) < (0)) __PYX_ERR(7, 240, __pyx_L10_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "View.MemoryView":241
 *     try:
 *         count = __pyx_collections_abc_Sequence.count
 *         index = __pyx_collections_abc_Sequence.index             # <<<<<<<<<<<<<<
 *     except:
 *         pass
*/
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_mstate_global->__pyx_n_u_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 241, __pyx_L10_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_array_type, __pyx_mstate_global->__pyx_n_u_index, __pyx_t_4) < (0)) __PYX_ERR(7, 241, __pyx_L10_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "View.MemoryView":239
 * 
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         count = __pyx_collections_abc_Sequence.count
 *         index = __pyx_collections_abc_Sequence.index
*/
    }
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L15_try_end;
    __pyx_L10_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "View.MemoryView":242
 *         count = __pyx_collections_abc_Sequence.count
 *         index = __pyx_collections_abc_Sequence.index
 *     except:             # <<<<<<<<<<<<<<
 *         pass
 * 
*/
    /*except:*/ {
      __Pyx_ErrRestore(0,0,0);
      goto __pyx_L11_exception_handled;
    }
    __pyx_L11_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1);
    __pyx_L15_try_end:;
  }

  /* "View.MemoryView":307
 *         return self.name
 * 
 * cdef generic = Enum("<strided and direct or indirect>")             # <<<<<<<<<<<<<<
 * cdef strided = Enum("<strided and direct>") # default
 * cdef indirect = Enum("<strided and indirect>")
*/
  __pyx_t_5 = NULL;
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_strided_and_direct_or_indirect};
    __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_MemviewEnum_type, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 307, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_4);
  }
  __Pyx_XGOTREF(generic);
  __Pyx_DECREF_SET(generic, ((PyObject *)__pyx_t_4));
  __Pyx_GIVEREF((PyObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "View.MemoryView":308
 * 
 * cdef generic = Enum("<strided and direct or indirect>")
 * cdef strided = Enum("<strided and direct>") # default             # <<<<<<<<<<<<<<
 * cdef indirect = Enum("<strided and indirect>")
 * 
*/
  __pyx_t_5 = NULL;
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_strided_and_direct};
    __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_MemviewEnum_type, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 308, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_4);
  }
  __Pyx_XGOTREF(strided);
  __Pyx_DECREF_SET(strided, ((PyObject *)__pyx_t_4));
  __Pyx_GIVEREF((PyObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "View.MemoryView":309
 * cdef generic = Enum("<strided and direct or indirect>")
 * cdef strided = Enum("<strided and direct>") # default
 * cdef indirect = Enum("<strided and indirect>")             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_5 = NULL;
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_strided_and_indirect};
    __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_MemviewEnum_type, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 309, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_4);
  }
  __Pyx_XGOTREF(indirect);
  __Pyx_DECREF_SET(indirect, ((PyObject *)__pyx_t_4));
  __Pyx_GIVEREF((PyObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "View.MemoryView":312
 * 
 * 
 * cdef contiguous = Enum("<contiguous and direct>")             # <<<<<<<<<<<<<<
 * cdef indirect_contiguous = Enum("<contiguous and indirect>")
 * 
*/
  __pyx_t_5 = NULL;
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_contiguous_and_direct};
    __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_MemviewEnum_type, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 312, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_4);
  }
  __Pyx_XGOTREF(contiguous);
  __Pyx_DECREF_SET(contiguous, ((PyObject *)__pyx_t_4));
  __Pyx_GIVEREF((PyObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "View.MemoryView":313
 * 
 * cdef contiguous = Enum("<contiguous and direct>")
 * cdef indirect_contiguous = Enum("<contiguous and indirect>")             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_5 = NULL;
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_contiguous_and_indirect};
    __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_MemviewEnum_type, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 313, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_4);
  }
  __Pyx_XGOTREF(indirect_contiguous);
  __Pyx_DECREF_SET(indirect_contiguous, ((PyObject *)__pyx_t_4));
  __Pyx_GIVEREF((PyObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "View.MemoryView":321
 * 
 * 
 * cdef int __pyx_memoryview_thread_locks_used = 0             # <<<<<<<<<<<<<<
 * cdef PyThread_type_lock[8] __pyx_memoryview_thread_locks = [
 *     PyThread_allocate_lock(),
*/
  __pyx_memoryview_thread_locks_used = 0;

  /* "View.MemoryView":322
 * 
 * cdef int __pyx_memoryview_thread_locks_used = 0
 * cdef PyThread_type_lock[8] __pyx_memoryview_thread_locks = [             # <<<<<<<<<<<<<<
 *     PyThread_allocate_lock(),
 *     PyThread_allocate_lock(),
*/
  __pyx_t_7[0] = PyThread_allocate_lock();
  __pyx_t_7[1] = PyThread_allocate_lock();
  __pyx_t_7[2] = PyThread_allocate_lock();
  __pyx_t_7[3] = PyThread_allocate_lock();
  __pyx_t_7[4] = PyThread_allocate_lock();
  __pyx_t_7[5] = PyThread_allocate_lock();
  __pyx_t_7[6] = PyThread_allocate_lock();
  __pyx_t_7[7] = PyThread_allocate_lock();
  memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_7, sizeof(__pyx_memoryview_thread_locks[0]) * (8));

  /* "View.MemoryView":983
 * 
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         count = __pyx_collections_abc_Sequence.count
 *         index = __pyx_collections_abc_Sequence.index
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "View.MemoryView":984
 * 
 *     try:
 *         count = __pyx_collections_abc_Sequence.count             # <<<<<<<<<<<<<<
 *         index = __pyx_collections_abc_Sequence.index
 *     except:
*/
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_mstate_global->__pyx_n_u_count); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 984, __pyx_L18_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_memoryviewslice_type, __pyx_mstate_global->__pyx_n_u_count, __pyx_t_4) < (0)) __PYX_ERR(7, 984, __pyx_L18_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "View.MemoryView":985
 *     try:
 *         count = __pyx_collections_abc_Sequence.count
 *         index = __pyx_collections_abc_Sequence.index             # <<<<<<<<<<<<<<
 *     except:
 *         pass
*/
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_mstate_global->__pyx_n_u_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 985, __pyx_L18_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_memoryviewslice_type, __pyx_mstate_global->__pyx_n_u_index, __pyx_t_4) < (0)) __PYX_ERR(7, 985, __pyx_L18_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "View.MemoryView":983
 * 
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         count = __pyx_collections_abc_Sequence.count
 *         index = __pyx_collections_abc_Sequence.index
*/
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L23_try_end;
    __pyx_L18_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "View.MemoryView":986
 *         count = __pyx_collections_abc_Sequence.count
 *         index = __pyx_collections_abc_Sequence.index
 *     except:             # <<<<<<<<<<<<<<
 *         pass
 * 
*/
    /*except:*/ {
      __Pyx_ErrRestore(0,0,0);
      goto __pyx_L19_exception_handled;
    }
    __pyx_L19_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    __pyx_L23_try_end:;
  }

  /* "View.MemoryView":989
 *         pass
 * 
 * try:             # <<<<<<<<<<<<<<
 *     if __pyx_collections_abc_Sequence:
 * 
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_1);
    /*try:*/ {

      /* "View.MemoryView":990
 * 
 * try:
 *     if __pyx_collections_abc_Sequence:             # <<<<<<<<<<<<<<
 * 
 * 
*/
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_collections_abc_Sequence); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(7, 990, __pyx_L26_error)
      if (__pyx_t_8) {

        /* "View.MemoryView":994
 * 
 * 
 *         __pyx_collections_abc_Sequence.register(_memoryviewslice)             # <<<<<<<<<<<<<<
 *         __pyx_collections_abc_Sequence.register(array)
 * except:
*/
        __pyx_t_5 = __pyx_collections_abc_Sequence;
        __Pyx_INCREF(__pyx_t_5);
        __pyx_t_6 = 0;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_5, ((PyObject *)__pyx_mstate_global->__pyx_memoryviewslice_type)};
          __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_register, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 994, __pyx_L26_error)
          __Pyx_GOTREF(__pyx_t_4);
        }
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

        /* "View.MemoryView":995
 * 
 *         __pyx_collections_abc_Sequence.register(_memoryviewslice)
 *         __pyx_collections_abc_Sequence.register(array)             # <<<<<<<<<<<<<<
 * except:
 *     pass  # ignore failure, it's a minor issue
*/
        __pyx_t_5 = __pyx_collections_abc_Sequence;
        __Pyx_INCREF(__pyx_t_5);
        __pyx_t_6 = 0;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_5, ((PyObject *)__pyx_mstate_global->__pyx_array_type)};
          __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_register, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 995, __pyx_L26_error)
          __Pyx_GOTREF(__pyx_t_4);
        }
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

        /* "View.MemoryView":990
 * 
 * try:
 *     if __pyx_collections_abc_Sequence:             # <<<<<<<<<<<<<<
 * 
 * 
*/
      }

      /* "View.MemoryView":989
 *         pass
 * 
 * try:             # <<<<<<<<<<<<<<
 *     if __pyx_collections_abc_Sequence:
 * 
*/
    }
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L31_try_end;
    __pyx_L26_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "View.MemoryView":996
 *         __pyx_collections_abc_Sequence.register(_memoryviewslice)
 *         __pyx_collections_abc_Sequence.register(array)
 * except:             # <<<<<<<<<<<<<<
 *     pass  # ignore failure, it's a minor issue
 * 
*/
    /*except:*/ {
      __Pyx_ErrRestore(0,0,0);
      goto __pyx_L27_exception_handled;
    }
    __pyx_L27_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1);
    __pyx_L31_try_end:;
  }

  /* "(tree fragment)":4
 *     int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1
 *     int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1
 * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_result
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name')
*/
  __pyx_t_4 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_mstate_global->__pyx_n_u_View_MemoryView); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Enum, __pyx_t_4) < (0)) __PYX_ERR(7, 4, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "lxml/etree.pyx":9
 * """
 * 
 * __docformat__ = "restructuredtext en"             # <<<<<<<<<<<<<<
 * 
 * __all__ = [
*/
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_docformat, __pyx_mstate_global->__pyx_kp_u_restructuredtext_en) < (0)) __PYX_ERR(0, 9, __pyx_L1_error)

  /* "lxml/etree.pyx":11
 * __docformat__ = "restructuredtext en"
 * 
 * __all__ = [             # <<<<<<<<<<<<<<
 *     'AttributeBasedElementClassLookup', 'C14NError', 'C14NWriterTarget', 'CDATA',
 *     'Comment', 'CommentBase', 'CustomElementClassLookup', 'DEBUG',
*/
  __pyx_t_4 = __Pyx_PyList_Pack(115, __pyx_mstate_global->__pyx_n_u_AttributeBasedElementClassLookup, __pyx_mstate_global->__pyx_n_u_C14NError, __pyx_mstate_global->__pyx_n_u_C14NWriterTarget, __pyx_mstate_global->__pyx_n_u_CDATA_2, __pyx_mstate_global->__pyx_n_u_Comment, __pyx_mstate_global->__pyx_n_u_CommentBase, __pyx_mstate_global->__pyx_n_u_CustomElementClassLookup, __pyx_mstate_global->__pyx_n_u_DEBUG, __pyx_mstate_global->__pyx_n_u_DTD, __pyx_mstate_global->__pyx_n_u_DTDError, __pyx_mstate_global->__pyx_n_u_DTDParseError, __pyx_mstate_global->__pyx_n_u_DTDValidateError, __pyx_mstate_global->__pyx_n_u_DocumentInvalid, __pyx_mstate_global->__pyx_n_u_ETCompatXMLParser, __pyx_mstate_global->__pyx_n_u_ETXPath, __pyx_mstate_global->__pyx_n_u_Element_2, __pyx_mstate_global->__pyx_n_u_ElementBase, __pyx_mstate_global->__pyx_n_u_ElementClassLookup, __pyx_mstate_global->__pyx_n_u_ElementDefaultClassLookup, __pyx_mstate_global->__pyx_n_u_ElementNamespaceClassLookup, __pyx_mstate_global->__pyx_n_u_ElementTree, __pyx_mstate_global->__pyx_n_u_Entity, __pyx_mstate_global->__pyx_n_u_EntityBase, __pyx_mstate_global->__pyx_n_u_Error, __pyx_mstate_global->__pyx_n_u_ErrorDomains, __pyx_mstate_global->__pyx_n_u_ErrorLevels, __pyx_mstate_global->__pyx_n_u_ErrorTypes, __pyx_mstate_global->__pyx_n_u_Extension, __pyx_mstate_global->__pyx_n_u_FallbackElementClassLookup, __pyx_mstate_global->__pyx_n_u_FunctionNamespace, __pyx_mstate_global->__pyx_n_u_HTML, __pyx_mstate_global->__pyx_n_u_HTMLParser, __pyx_mstate_global->__pyx_n_u_ICONV_COMPILED_VERSION, __pyx_mstate_global->__pyx_n_u_LIBXML_COMPILED_VERSION, __pyx_mstate_global->__pyx_n_u_LIBXML_VERSION, __pyx_mstate_global->__pyx_n_u_LIBXML_FEATURES, __pyx_mstate_global->__pyx_n_u_LIBXSLT_COMPILED_VERSION, __pyx_mstate_global->__pyx_n_u_LIBXSLT_VERSION, __pyx_mstate_global->__pyx_n_u_LXML_VERSION, __pyx_mstate_global->__pyx_n_u_LxmlError, __pyx_mstate_global->__pyx_n_u_LxmlRegistryError, __pyx_mstate_global->__pyx_n_u_LxmlSyntaxError, __pyx_mstate_global->__pyx_n_u_NamespaceRegistryError, __pyx_mstate_global->__pyx_n_u_PI, __pyx_mstate_global->__pyx_n_u_PIBase, __pyx_mstate_global->__pyx_n_u_ParseError, __pyx_mstate_global->__pyx_n_u_ParserBasedElementClassLookup, __pyx_mstate_global->__pyx_n_u_ParserError, __pyx_mstate_global->__pyx_n_u_ProcessingInstruction, __pyx_mstate_global->__pyx_n_u_PyErrorLog, __pyx_mstate_global->__pyx_n_u_PythonElementClassLookup, __pyx_mstate_global->__pyx_n_u_QName, __pyx_mstate_global->__pyx_n_u_RelaxNG, __pyx_mstate_global->__pyx_n_u_RelaxNGError, __pyx_mstate_global->__pyx_n_u_RelaxNGErrorTypes, __pyx_mstate_global->__pyx_n_u_RelaxNGParseError, __pyx_mstate_global->__pyx_n_u_RelaxNGValidateError, __pyx_mstate_global->__pyx_n_u_Resolver, __pyx_mstate_global->__pyx_n_u_Schematron, __pyx_mstate_global->__pyx_n_u_SchematronError, __pyx_mstate_global->__pyx_n_u_SchematronParseError, __pyx_mstate_global->__pyx_n_u_SchematronValidateError, __pyx_mstate_global->__pyx_n_u_SerialisationError, __pyx_mstate_global->__pyx_n_u_SubElement, __pyx_mstate_global->__pyx_n_u_TreeBuilder, __pyx_mstate_global->__pyx_n_u_XInclude, __pyx_mstate_global->__pyx_n_u_XIncludeError, __pyx_mstate_global->__pyx_n_u_XML, __pyx_mstate_global->__pyx_n_u_XMLDTDID, __pyx_mstate_global->__pyx_n_u_XMLID, __pyx_mstate_global->__pyx_n_u_XMLParser, __pyx_mstate_global->__pyx_n_u_XMLSchema, __pyx_mstate_global->__pyx_n_u_XMLSchemaError, __pyx_mstate_global->__pyx_n_u_XMLSchemaParseError, __pyx_mstate_global->__pyx_n_u_XMLSchemaValidateError, __pyx_mstate_global->__pyx_n_u_XMLSyntaxError, __pyx_mstate_global->__pyx_n_u_XMLTreeBuilder, __pyx_mstate_global->__pyx_n_u_XPath, __pyx_mstate_global->__pyx_n_u_XPathDocumentEvaluator, __pyx_mstate_global->__pyx_n_u_XPathError, __pyx_mstate_global->__pyx_n_u_XPathEvalError, __pyx_mstate_global->__pyx_n_u_XPathEvaluator, __pyx_mstate_global->__pyx_n_u_XPathFunctionError, __pyx_mstate_global->__pyx_n_u_XPathResultError, __pyx_mstate_global->__pyx_n_u_XPathSyntaxError, __pyx_mstate_global->__pyx_n_u_XSLT, __pyx_mstate_global->__pyx_n_u_XSLTAccessControl, __pyx_mstate_global->__pyx_n_u_XSLTApplyError, __pyx_mstate_global->__pyx_n_u_XSLTError, __pyx_mstate_global->__pyx_n_u_XSLTExtension, __pyx_mstate_global->__pyx_n_u_XSLTExtensionError, __pyx_mstate_global->__pyx_n_u_XSLTParseError, __pyx_mstate_global->__pyx_n_u_XSLTSaveError, __pyx_mstate_global->__pyx_n_u_canonicalize, __pyx_mstate_global->__pyx_n_u_cleanup_namespaces, __pyx_mstate_global->__pyx_n_u_clear_error_log_2, __pyx_mstate_global->__pyx_n_u_dump, __pyx_mstate_global->__pyx_n_u_fromstring, __pyx_mstate_global->__pyx_n_u_fromstringlist, __pyx_mstate_global->__pyx_n_u_get_default_parser, __pyx_mstate_global->__pyx_n_u_iselement, __pyx_mstate_global->__pyx_n_u_iterparse, __pyx_mstate_global->__pyx_n_u_iterwalk, __pyx_mstate_global->__pyx_n_u_parse, __pyx_mstate_global->__pyx_n_u_parseid, __pyx_mstate_global->__pyx_n_u_register_namespace, __pyx_mstate_global->__pyx_n_u_set_default_parser, __pyx_mstate_global->__pyx_n_u_set_element_class_lookup, __pyx_mstate_global->__pyx_n_u_strip_attributes, __pyx_mstate_global->__pyx_n_u_strip_elements, __pyx_mstate_global->__pyx_n_u_strip_tags, __pyx_mstate_global->__pyx_n_u_tostring, __pyx_mstate_global->__pyx_n_u_tostringlist, __pyx_mstate_global->__pyx_n_u_tounicode, __pyx_mstate_global->__pyx_n_u_use_global_python_log); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 11, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_all, __pyx_t_4) < (0)) __PYX_ERR(0, 11, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "lxml/etree.pyx":66
 * 
 * cdef object os_path_abspath
 * from os.path import abspath as os_path_abspath             # <<<<<<<<<<<<<<
 * 
 * cdef object BytesIO, StringIO
*/
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_abspath};
    __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_os_path, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 66, __pyx_L1_error)
  }
  __pyx_t_4 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_4);
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_abspath};
    __pyx_t_9 = 0; {
      __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_4, __pyx_imported_names[__pyx_t_9]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 66, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      switch (__pyx_t_9) {
        case 0:
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_XGOTREF(__pyx_v_4lxml_5etree_os_path_abspath);
        __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_os_path_abspath, __pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_5);
        break;
        default:;
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "lxml/etree.pyx":69
 * 
 * cdef object BytesIO, StringIO
 * from io import BytesIO, StringIO             # <<<<<<<<<<<<<<
 * 
 * cdef object OrderedDict
*/
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_BytesIO,__pyx_mstate_global->__pyx_n_u_StringIO};
    __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_io, __pyx_imported_names, 2, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __pyx_L1_error)
  }
  __pyx_t_4 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_4);
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_BytesIO,__pyx_mstate_global->__pyx_n_u_StringIO};
    for (__pyx_t_9=0; __pyx_t_9 < 2; __pyx_t_9++) {
      __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_4, __pyx_imported_names[__pyx_t_9]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 69, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      switch (__pyx_t_9) {
        case 0:
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_XGOTREF(__pyx_v_4lxml_5etree_BytesIO);
        __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_BytesIO, __pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_5);
        break;
        case 1:
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_XGOTREF(__pyx_v_4lxml_5etree_StringIO);
        __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_StringIO, __pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_5);
        break;
        default:;
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "lxml/etree.pyx":72
 * 
 * cdef object OrderedDict
 * from collections import OrderedDict             # <<<<<<<<<<<<<<
 * 
 * cdef object _elementpath
*/
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_OrderedDict};
    __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_collections, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 72, __pyx_L1_error)
  }
  __pyx_t_4 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_4);
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_OrderedDict};
    __pyx_t_9 = 0; {
      __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_4, __pyx_imported_names[__pyx_t_9]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 72, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      switch (__pyx_t_9) {
        case 0:
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_XGOTREF(__pyx_v_4lxml_5etree_OrderedDict);
        __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_OrderedDict, __pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_5);
        break;
        default:;
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "lxml/etree.pyx":75
 * 
 * cdef object _elementpath
 * from lxml import _elementpath             # <<<<<<<<<<<<<<
 * 
 * cdef object sys
*/
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_elementpath};
    __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_lxml, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 75, __pyx_L1_error)
  }
  __pyx_t_4 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_4);
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_elementpath};
    __pyx_t_9 = 0; {
      __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_4, __pyx_imported_names[__pyx_t_9]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 75, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      switch (__pyx_t_9) {
        case 0:
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_XGOTREF(__pyx_v_4lxml_5etree__elementpath);
        __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__elementpath, __pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_5);
        break;
        default:;
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "lxml/etree.pyx":78
 * 
 * cdef object sys
 * import sys             # <<<<<<<<<<<<<<
 * 
 * cdef object re
*/
  __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_sys, 0, 0, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error)
  __pyx_t_4 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree_sys);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_sys, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;

  /* "lxml/etree.pyx":81
 * 
 * cdef object re
 * import re             # <<<<<<<<<<<<<<
 * 
 * cdef object partial
*/
  __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_re, 0, 0, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 81, __pyx_L1_error)
  __pyx_t_4 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree_re);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_re, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;

  /* "lxml/etree.pyx":84
 * 
 * cdef object partial
 * from functools import partial             # <<<<<<<<<<<<<<
 * 
 * cdef object islice
*/
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_partial};
    __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_functools, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 84, __pyx_L1_error)
  }
  __pyx_t_4 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_4);
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_partial};
    __pyx_t_9 = 0; {
      __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_4, __pyx_imported_names[__pyx_t_9]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 84, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      switch (__pyx_t_9) {
        case 0:
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_XGOTREF(__pyx_v_4lxml_5etree_partial);
        __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_partial, __pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_5);
        break;
        default:;
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "lxml/etree.pyx":87
 * 
 * cdef object islice
 * from itertools import islice             # <<<<<<<<<<<<<<
 * 
 * cdef object ITER_EMPTY = iter(())
*/
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_islice};
    __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_itertools, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 87, __pyx_L1_error)
  }
  __pyx_t_4 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_4);
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_islice};
    __pyx_t_9 = 0; {
      __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_4, __pyx_imported_names[__pyx_t_9]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 87, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      switch (__pyx_t_9) {
        case 0:
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_XGOTREF(__pyx_v_4lxml_5etree_islice);
        __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_islice, __pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_5);
        break;
        default:;
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "lxml/etree.pyx":89
 * from itertools import islice
 * 
 * cdef object ITER_EMPTY = iter(())             # <<<<<<<<<<<<<<
 * 
 * cdef object MutableMapping
*/
  __pyx_t_4 = PyObject_GetIter(__pyx_mstate_global->__pyx_empty_tuple); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 89, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree_ITER_EMPTY);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_ITER_EMPTY, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;

  /* "lxml/etree.pyx":92
 * 
 * cdef object MutableMapping
 * from collections.abc import MutableMapping             # <<<<<<<<<<<<<<
 * 
 * class _ImmutableMapping(MutableMapping):
*/
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_MutableMapping};
    __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_collections_abc, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 92, __pyx_L1_error)
  }
  __pyx_t_4 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_4);
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_MutableMapping};
    __pyx_t_9 = 0; {
      __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_4, __pyx_imported_names[__pyx_t_9]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 92, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      switch (__pyx_t_9) {
        case 0:
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_XGOTREF(__pyx_v_4lxml_5etree_MutableMapping);
        __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_MutableMapping, __pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_5);
        break;
        default:;
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "lxml/etree.pyx":94
 * from collections.abc import MutableMapping
 * 
 * class _ImmutableMapping(MutableMapping):             # <<<<<<<<<<<<<<
 *     def __getitem__(self, key):
 *         raise KeyError, key
*/
  __pyx_t_4 = PyTuple_Pack(1, __pyx_v_4lxml_5etree_MutableMapping); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 94, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PEP560_update_bases(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 94, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_10 = __Pyx_CalculateMetaclass(NULL, __pyx_t_5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 94, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_11 = __Pyx_Py3MetaclassPrepare(__pyx_t_10, __pyx_t_5, __pyx_mstate_global->__pyx_n_u_ImmutableMapping, __pyx_mstate_global->__pyx_n_u_ImmutableMapping, (PyObject *) NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, (PyObject *) NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 94, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  if (__pyx_t_5 != __pyx_t_4) {
    if (unlikely((PyDict_SetItemString(__pyx_t_11, "__orig_bases__", __pyx_t_4) < 0))) __PYX_ERR(0, 94, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "lxml/etree.pyx":95
 * 
 * class _ImmutableMapping(MutableMapping):
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         raise KeyError, key
 * 
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_17_ImmutableMapping_1__getitem__, 0, __pyx_mstate_global->__pyx_n_u_ImmutableMapping___getitem, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[18])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 95, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  if (__Pyx_SetNameInClass(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_getitem, __pyx_t_4) < (0)) __PYX_ERR(0, 95, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "lxml/etree.pyx":98
 *         raise KeyError, key
 * 
 *     def __setitem__(self, key, value):             # <<<<<<<<<<<<<<
 *         raise KeyError, key
 * 
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_17_ImmutableMapping_3__setitem__, 0, __pyx_mstate_global->__pyx_n_u_ImmutableMapping___setitem, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[19])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 98, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  if (__Pyx_SetNameInClass(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_setitem, __pyx_t_4) < (0)) __PYX_ERR(0, 98, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "lxml/etree.pyx":101
 *         raise KeyError, key
 * 
 *     def __delitem__(self, key):             # <<<<<<<<<<<<<<
 *         raise KeyError, key
 * 
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_17_ImmutableMapping_5__delitem__, 0, __pyx_mstate_global->__pyx_n_u_ImmutableMapping___delitem, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[20])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 101, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  if (__Pyx_SetNameInClass(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_delitem, __pyx_t_4) < (0)) __PYX_ERR(0, 101, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "lxml/etree.pyx":104
 *         raise KeyError, key
 * 
 *     def __contains__(self, key):             # <<<<<<<<<<<<<<
 *         return False
 * 
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_17_ImmutableMapping_7__contains__, 0, __pyx_mstate_global->__pyx_n_u_ImmutableMapping___contains, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[21])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 104, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  if (__Pyx_SetNameInClass(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_contains, __pyx_t_4) < (0)) __PYX_ERR(0, 104, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "lxml/etree.pyx":107
 *         return False
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return 0
 * 
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_17_ImmutableMapping_9__len__, 0, __pyx_mstate_global->__pyx_n_u_ImmutableMapping___len, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[22])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 107, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  if (__Pyx_SetNameInClass(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_len, __pyx_t_4) < (0)) __PYX_ERR(0, 107, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "lxml/etree.pyx":110
 *         return 0
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return ITER_EMPTY
 *     iterkeys = itervalues = iteritems = __iter__
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_17_ImmutableMapping_11__iter__, 0, __pyx_mstate_global->__pyx_n_u_ImmutableMapping___iter, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[23])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 110, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  if (__Pyx_SetNameInClass(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_iter_2, __pyx_t_4) < (0)) __PYX_ERR(0, 110, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "lxml/etree.pyx":112
 *     def __iter__(self):
 *         return ITER_EMPTY
 *     iterkeys = itervalues = iteritems = __iter__             # <<<<<<<<<<<<<<
 * 
 * cdef object IMMUTABLE_EMPTY_MAPPING = _ImmutableMapping()
*/
  __pyx_t_4 = PyObject_GetItem(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_iter_2);
  if (unlikely(!__pyx_t_4)) {
    PyErr_Clear();
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_iter_2);
  }
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 112, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_iterkeys, __pyx_t_4) < (0)) __PYX_ERR(0, 112, __pyx_L1_error)
  if (__Pyx_SetNameInClass(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_itervalues, __pyx_t_4) < (0)) __PYX_ERR(0, 112, __pyx_L1_error)
  if (__Pyx_SetNameInClass(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_iteritems, __pyx_t_4) < (0)) __PYX_ERR(0, 112, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "lxml/etree.pyx":94
 * from collections.abc import MutableMapping
 * 
 * class _ImmutableMapping(MutableMapping):             # <<<<<<<<<<<<<<
 *     def __getitem__(self, key):
 *         raise KeyError, key
*/
  __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_ImmutableMapping, __pyx_t_5, __pyx_t_11, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 94, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_ImmutableMapping, __pyx_t_4) < (0)) __PYX_ERR(0, 94, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "lxml/etree.pyx":114
 *     iterkeys = itervalues = iteritems = __iter__
 * 
 * cdef object IMMUTABLE_EMPTY_MAPPING = _ImmutableMapping()             # <<<<<<<<<<<<<<
 * del _ImmutableMapping
 * 
*/
  __pyx_t_10 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_ImmutableMapping); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 114, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_10, NULL};
    __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_11, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 114, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
  }
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree_IMMUTABLE_EMPTY_MAPPING);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_IMMUTABLE_EMPTY_MAPPING, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_5 = 0;

  /* "lxml/etree.pyx":115
 * 
 * cdef object IMMUTABLE_EMPTY_MAPPING = _ImmutableMapping()
 * del _ImmutableMapping             # <<<<<<<<<<<<<<
 * 
 * 
*/
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_mstate_global->__pyx_n_u_ImmutableMapping) < (0)) __PYX_ERR(0, 115, __pyx_L1_error)

  /* "lxml/etree.pyx":133
 * 
 * # make the compiled-in debug state publicly available
 * DEBUG = __DEBUG             # <<<<<<<<<<<<<<
 * 
 * # A struct to store a cached qualified tag name+href pair.
*/
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_DEBUG, __pyx_mstate_global->__pyx_int_1) < (0)) __PYX_ERR(0, 133, __pyx_L1_error)

  /* "lxml/etree.pyx":144
 * 
 * # initialize parser (and threading)
 * xmlparser.xmlInitParser()             # <<<<<<<<<<<<<<
 * 
 * # global per-thread setup
*/
  xmlInitParser();

  /* "lxml/etree.pyx":147
 * 
 * # global per-thread setup
 * tree.xmlThrDefIndentTreeOutput(1)             # <<<<<<<<<<<<<<
 * tree.xmlThrDefLineNumbersDefaultValue(1)
 * 
*/
  (void)(xmlThrDefIndentTreeOutput(1));

  /* "lxml/etree.pyx":148
 * # global per-thread setup
 * tree.xmlThrDefIndentTreeOutput(1)
 * tree.xmlThrDefLineNumbersDefaultValue(1)             # <<<<<<<<<<<<<<
 * 
 * _initThreadLogging()
*/
  (void)(xmlThrDefLineNumbersDefaultValue(1));

  /* "lxml/etree.pyx":150
 * tree.xmlThrDefLineNumbersDefaultValue(1)
 * 
 * _initThreadLogging()             # <<<<<<<<<<<<<<
 * 
 * # filename encoding
*/
  __pyx_f_4lxml_5etree__initThreadLogging();

  /* "lxml/etree.pyx":153
 * 
 * # filename encoding
 * cdef bytes _FILENAME_ENCODING = (sys.getfilesystemencoding() or sys.getdefaultencoding() or 'ascii').encode("UTF-8")             # <<<<<<<<<<<<<<
 * cdef char* _C_FILENAME_ENCODING = _cstr(_FILENAME_ENCODING)
 * 
*/
  __pyx_t_12 = __pyx_v_4lxml_5etree_sys;
  __Pyx_INCREF(__pyx_t_12);
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_12, NULL};
    __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_getfilesystemencoding, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 153, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 153, __pyx_L1_error)
  if (!__pyx_t_8) {
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else {
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_10 = __pyx_t_4;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L35_bool_binop_done;
  }
  __pyx_t_12 = __pyx_v_4lxml_5etree_sys;
  __Pyx_INCREF(__pyx_t_12);
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_12, NULL};
    __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_getdefaultencoding, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 153, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 153, __pyx_L1_error)
  if (!__pyx_t_8) {
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else {
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_10 = __pyx_t_4;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L35_bool_binop_done;
  }
  __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_ascii);
  __pyx_t_10 = __pyx_mstate_global->__pyx_n_u_ascii;
  __pyx_L35_bool_binop_done:;
  __pyx_t_11 = __pyx_t_10;
  __Pyx_INCREF(__pyx_t_11);
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_mstate_global->__pyx_kp_u_UTF_8};
    __pyx_t_5 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 153, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
  }
  if (!(likely(PyBytes_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_5))) __PYX_ERR(0, 153, __pyx_L1_error)
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree__FILENAME_ENCODING);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__FILENAME_ENCODING, ((PyObject*)__pyx_t_5));
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_5 = 0;

  /* "lxml/etree.pyx":154
 * # filename encoding
 * cdef bytes _FILENAME_ENCODING = (sys.getfilesystemencoding() or sys.getdefaultencoding() or 'ascii').encode("UTF-8")
 * cdef char* _C_FILENAME_ENCODING = _cstr(_FILENAME_ENCODING)             # <<<<<<<<<<<<<<
 * 
 * # set up some default namespace prefixes
*/
  __pyx_t_5 = __pyx_v_4lxml_5etree__FILENAME_ENCODING;
  __Pyx_INCREF(__pyx_t_5);
  __pyx_v_4lxml_5etree__C_FILENAME_ENCODING = PyBytes_AS_STRING(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "lxml/etree.pyx":158
 * # set up some default namespace prefixes
 * cdef dict _DEFAULT_NAMESPACE_PREFIXES = {
 *     b"http://www.w3.org/XML/1998/namespace": b'xml',             # <<<<<<<<<<<<<<
 *     b"http://www.w3.org/1999/xhtml": b"html",
 *     b"http://www.w3.org/1999/XSL/Transform": b"xsl",
*/
  __pyx_t_5 = __Pyx_PyDict_NewPresized(9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 158, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_kp_b_http_www_w3_org_XML_1998_namespa, __pyx_mstate_global->__pyx_n_b_xml) < (0)) __PYX_ERR(0, 158, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_kp_b_http_www_w3_org_1999_xhtml, __pyx_mstate_global->__pyx_n_b_html) < (0)) __PYX_ERR(0, 158, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_kp_b_http_www_w3_org_1999_XSL_Transfo, __pyx_mstate_global->__pyx_n_b_xsl) < (0)) __PYX_ERR(0, 158, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_kp_b_http_www_w3_org_1999_02_22_rdf_s, __pyx_mstate_global->__pyx_n_b_rdf) < (0)) __PYX_ERR(0, 158, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_kp_b_http_schemas_xmlsoap_org_wsdl, __pyx_mstate_global->__pyx_n_b_wsdl) < (0)) __PYX_ERR(0, 158, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_kp_b_http_www_w3_org_2001_XMLSchema, __pyx_mstate_global->__pyx_n_b_xs) < (0)) __PYX_ERR(0, 158, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_kp_b_http_www_w3_org_2001_XMLSchema_i, __pyx_mstate_global->__pyx_n_b_xsi) < (0)) __PYX_ERR(0, 158, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_kp_b_http_purl_org_dc_elements_1_1, __pyx_mstate_global->__pyx_n_b_dc) < (0)) __PYX_ERR(0, 158, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_kp_b_http_codespeak_net_lxml_objectif, __pyx_mstate_global->__pyx_n_b_py) < (0)) __PYX_ERR(0, 158, __pyx_L1_error)
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES, ((PyObject*)__pyx_t_5));
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_5 = 0;

  /* "lxml/etree.pyx":174
 * # To avoid runtime encoding overhead, we keep a Unicode copy
 * # of the uri-prefix mapping as (str, str) items view.
 * cdef object _DEFAULT_NAMESPACE_PREFIXES_ITEMS = []             # <<<<<<<<<<<<<<
 * 
 * cdef _update_default_namespace_prefixes_items():
*/
  __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 174, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES_ITEMS);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES_ITEMS, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_5 = 0;

  /* "lxml/etree.pyx":184
 *     }.items()
 * 
 * _update_default_namespace_prefixes_items()             # <<<<<<<<<<<<<<
 * 
 * cdef object _check_internal_prefix = re.compile(br"ns\d+$").match
*/
  __pyx_t_5 = __pyx_f_4lxml_5etree__update_default_namespace_prefixes_items(); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 184, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "lxml/etree.pyx":186
 * _update_default_namespace_prefixes_items()
 * 
 * cdef object _check_internal_prefix = re.compile(br"ns\d+$").match             # <<<<<<<<<<<<<<
 * 
 * def register_namespace(prefix, uri):
*/
  __pyx_t_10 = __pyx_v_4lxml_5etree_re;
  __Pyx_INCREF(__pyx_t_10);
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_mstate_global->__pyx_kp_b_ns_d_2};
    __pyx_t_5 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_compile, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 186, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
  }
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_match); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 186, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree__check_internal_prefix);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__check_internal_prefix, __pyx_t_10);
  __Pyx_GIVEREF(__pyx_t_10);
  __pyx_t_10 = 0;

  /* "lxml/etree.pyx":188
 * cdef object _check_internal_prefix = re.compile(br"ns\d+$").match
 * 
 * def register_namespace(prefix, uri):             # <<<<<<<<<<<<<<
 *     """Registers a namespace prefix that newly created Elements in that
 *     namespace will use.  The registry is global, and any existing
*/
  __pyx_t_10 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_1register_namespace, 0, __pyx_mstate_global->__pyx_n_u_register_namespace, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[24])); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 188, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_10);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_register_namespace, __pyx_t_10) < (0)) __PYX_ERR(0, 188, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

  /* "lxml/etree.pyx":225
 *             self.error_log = error_log.copy()
 * 
 * cdef object _Error = Error             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_INCREF((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_Error);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree__Error);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__Error, ((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_Error));
  __Pyx_GIVEREF((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_Error);

  /* "lxml/etree.pyx":229
 * 
 * # superclass for all syntax errors
 * class LxmlSyntaxError(LxmlError, SyntaxError):             # <<<<<<<<<<<<<<
 *     """Base class for all syntax errors.
 *     """
*/
  __pyx_t_10 = PyTuple_Pack(2, ((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_LxmlError), ((PyObject *)(((PyTypeObject*)PyExc_SyntaxError)))); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 229, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_5 = __Pyx_PEP560_update_bases(__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 229, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_11 = __Pyx_CalculateMetaclass(NULL, __pyx_t_5); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 229, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_11, __pyx_t_5, __pyx_mstate_global->__pyx_n_u_LxmlSyntaxError, __pyx_mstate_global->__pyx_n_u_LxmlSyntaxError, (PyObject *) NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_kp_u_Base_class_for_all_syntax_errors); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 229, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__pyx_t_5 != __pyx_t_10) {
    if (unlikely((PyDict_SetItemString(__pyx_t_4, "__orig_bases__", __pyx_t_10) < 0))) __PYX_ERR(0, 229, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = __Pyx_Py3ClassCreate(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_LxmlSyntaxError, __pyx_t_5, __pyx_t_4, NULL, 0, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 229, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_10);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_LxmlSyntaxError, __pyx_t_10) < (0)) __PYX_ERR(0, 229, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "lxml/etree.pyx":269
 * 
 * cdef int _LIBXML_VERSION_INT
 * try:             # <<<<<<<<<<<<<<
 *     _LIBXML_VERSION_INT = int(
 *         re.match('[0-9]+', (<unsigned char*>tree.xmlParserVersion).decode("ascii")).group(0))
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "lxml/etree.pyx":271
 * try:
 *     _LIBXML_VERSION_INT = int(
 *         re.match('[0-9]+', (<unsigned char*>tree.xmlParserVersion).decode("ascii")).group(0))             # <<<<<<<<<<<<<<
 * except Exception:
 *     print("Unknown libxml2 version: " + (<unsigned char*>tree.xmlParserVersion).decode("latin1"))
*/
      __pyx_t_10 = __pyx_v_4lxml_5etree_re;
      __Pyx_INCREF(__pyx_t_10);
      __pyx_t_13 = ((unsigned char *)xmlParserVersion);
      __pyx_t_9 = __Pyx_ssize_strlen(((char const *)__pyx_t_13)); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 271, __pyx_L38_error)
      __pyx_t_12 = __Pyx_decode_c_string(((char const *)__pyx_t_13), 0, __pyx_t_9, NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 271, __pyx_L38_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_6 = 0;
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_10, __pyx_mstate_global->__pyx_kp_u_0_9, __pyx_t_12};
        __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_match, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 271, __pyx_L38_error)
        __Pyx_GOTREF(__pyx_t_4);
      }
      __pyx_t_11 = __pyx_t_4;
      __Pyx_INCREF(__pyx_t_11);
      __pyx_t_6 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_mstate_global->__pyx_int_0};
        __pyx_t_5 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_group, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 271, __pyx_L38_error)
        __Pyx_GOTREF(__pyx_t_5);
      }

      /* "lxml/etree.pyx":270
 * cdef int _LIBXML_VERSION_INT
 * try:
 *     _LIBXML_VERSION_INT = int(             # <<<<<<<<<<<<<<
 *         re.match('[0-9]+', (<unsigned char*>tree.xmlParserVersion).decode("ascii")).group(0))
 * except Exception:
*/
      __pyx_t_4 = __Pyx_PyNumber_Int(__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 270, __pyx_L38_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_14 = __Pyx_PyLong_As_int(__pyx_t_4); if (unlikely((__pyx_t_14 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 270, __pyx_L38_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_4lxml_5etree__LIBXML_VERSION_INT = __pyx_t_14;

      /* "lxml/etree.pyx":269
 * 
 * cdef int _LIBXML_VERSION_INT
 * try:             # <<<<<<<<<<<<<<
 *     _LIBXML_VERSION_INT = int(
 *         re.match('[0-9]+', (<unsigned char*>tree.xmlParserVersion).decode("ascii")).group(0))
*/
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L43_try_end;
    __pyx_L38_error:;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "lxml/etree.pyx":272
 *     _LIBXML_VERSION_INT = int(
 *         re.match('[0-9]+', (<unsigned char*>tree.xmlParserVersion).decode("ascii")).group(0))
 * except Exception:             # <<<<<<<<<<<<<<
 *     print("Unknown libxml2 version: " + (<unsigned char*>tree.xmlParserVersion).decode("latin1"))
 *     _LIBXML_VERSION_INT = 0
*/
    __pyx_t_14 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception))));
    if (__pyx_t_14) {
      __Pyx_AddTraceback("lxml.etree", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_5, &__pyx_t_11) < 0) __PYX_ERR(0, 272, __pyx_L40_except_error)
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_11);

      /* "lxml/etree.pyx":273
 *         re.match('[0-9]+', (<unsigned char*>tree.xmlParserVersion).decode("ascii")).group(0))
 * except Exception:
 *     print("Unknown libxml2 version: " + (<unsigned char*>tree.xmlParserVersion).decode("latin1"))             # <<<<<<<<<<<<<<
 *     _LIBXML_VERSION_INT = 0
 * 
*/
      __pyx_t_10 = NULL;
      __pyx_t_13 = ((unsigned char *)xmlParserVersion);
      __pyx_t_9 = __Pyx_ssize_strlen(((char const *)__pyx_t_13)); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 273, __pyx_L40_except_error)
      __pyx_t_15 = __Pyx_decode_c_string(((char const *)__pyx_t_13), 0, __pyx_t_9, NULL, NULL, PyUnicode_DecodeLatin1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 273, __pyx_L40_except_error)
      __Pyx_GOTREF(__pyx_t_15);
      __pyx_t_16 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_Unknown_libxml2_version, __pyx_t_15); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 273, __pyx_L40_except_error)
      __Pyx_GOTREF(__pyx_t_16);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __pyx_t_6 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_t_16};
        __pyx_t_12 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_print, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 273, __pyx_L40_except_error)
        __Pyx_GOTREF(__pyx_t_12);
      }
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

      /* "lxml/etree.pyx":274
 * except Exception:
 *     print("Unknown libxml2 version: " + (<unsigned char*>tree.xmlParserVersion).decode("latin1"))
 *     _LIBXML_VERSION_INT = 0             # <<<<<<<<<<<<<<
 * 
 * LIBXML_VERSION = __unpackIntVersion(_LIBXML_VERSION_INT)
*/
      __pyx_v_4lxml_5etree__LIBXML_VERSION_INT = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      goto __pyx_L39_exception_handled;
    }
    goto __pyx_L40_except_error;

    /* "lxml/etree.pyx":269
 * 
 * cdef int _LIBXML_VERSION_INT
 * try:             # <<<<<<<<<<<<<<
 *     _LIBXML_VERSION_INT = int(
 *         re.match('[0-9]+', (<unsigned char*>tree.xmlParserVersion).decode("ascii")).group(0))
*/
    __pyx_L40_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L39_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    __pyx_L43_try_end:;
  }

  /* "lxml/etree.pyx":276
 *     _LIBXML_VERSION_INT = 0
 * 
 * LIBXML_VERSION = __unpackIntVersion(_LIBXML_VERSION_INT)             # <<<<<<<<<<<<<<
 * LIBXML_COMPILED_VERSION = __unpackIntVersion(tree.LIBXML_VERSION)
 * LXML_VERSION = __unpackDottedVersion(tree.LXML_VERSION_STRING)
*/
  __pyx_t_11 = __pyx_f_4lxml_5etree___unpackIntVersion(__pyx_v_4lxml_5etree__LIBXML_VERSION_INT, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 276, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_LIBXML_VERSION, __pyx_t_11) < (0)) __PYX_ERR(0, 276, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "lxml/etree.pyx":277
 * 
 * LIBXML_VERSION = __unpackIntVersion(_LIBXML_VERSION_INT)
 * LIBXML_COMPILED_VERSION = __unpackIntVersion(tree.LIBXML_VERSION)             # <<<<<<<<<<<<<<
 * LXML_VERSION = __unpackDottedVersion(tree.LXML_VERSION_STRING)
 * 
*/
  __pyx_t_11 = __pyx_f_4lxml_5etree___unpackIntVersion(LIBXML_VERSION, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 277, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_LIBXML_COMPILED_VERSION, __pyx_t_11) < (0)) __PYX_ERR(0, 277, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "lxml/etree.pyx":278
 * LIBXML_VERSION = __unpackIntVersion(_LIBXML_VERSION_INT)
 * LIBXML_COMPILED_VERSION = __unpackIntVersion(tree.LIBXML_VERSION)
 * LXML_VERSION = __unpackDottedVersion(tree.LXML_VERSION_STRING)             # <<<<<<<<<<<<<<
 * 
 * __version__ = tree.LXML_VERSION_STRING.decode("ascii")
*/
  __pyx_t_11 = __Pyx_PyBytes_FromString(LXML_VERSION_STRING); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 278, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_5 = __pyx_f_4lxml_5etree___unpackDottedVersion(__pyx_t_11); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 278, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_LXML_VERSION, __pyx_t_5) < (0)) __PYX_ERR(0, 278, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "lxml/etree.pyx":280
 * LXML_VERSION = __unpackDottedVersion(tree.LXML_VERSION_STRING)
 * 
 * __version__ = tree.LXML_VERSION_STRING.decode("ascii")             # <<<<<<<<<<<<<<
 * 
 * cdef extern from *:
*/
  __pyx_t_9 = __Pyx_ssize_strlen(LXML_VERSION_STRING); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 280, __pyx_L1_error)
  __pyx_t_5 = __Pyx_decode_c_string(LXML_VERSION_STRING, 0, __pyx_t_9, NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 280, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_version_2, __pyx_t_5) < (0)) __PYX_ERR(0, 280, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "lxml/etree.pyx":300
 * 
 * #ZLIB_COMPILED_VERSION = __unpackIntVersion(ZLIB_HEX_VERSION, base=0x10)
 * ICONV_COMPILED_VERSION = __unpackIntVersion(LIBICONV_HEX_VERSION, base=0x100)[:2]             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_17.__pyx_n = 1;
  __pyx_t_17.base = 0x100;
  __pyx_t_5 = __pyx_f_4lxml_5etree___unpackIntVersion(__lxml_iconv_version, &__pyx_t_17); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 300, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (unlikely(__pyx_t_5 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 300, __pyx_L1_error)
  }
  __pyx_t_11 = __Pyx_PyTuple_GetSlice(__pyx_t_5, 0, 2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 300, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_ICONV_COMPILED_VERSION, __pyx_t_11) < (0)) __PYX_ERR(0, 300, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "lxml/etree.pyx":356
 *     return features
 * 
 * LIBXML_COMPILED_FEATURES = _copy_lib_features()             # <<<<<<<<<<<<<<
 * LIBXML_FEATURES = {
 *     feature_name for feature_id, feature_name in [
*/
  __pyx_t_11 = __pyx_f_4lxml_5etree__copy_lib_features(); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 356, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_LIBXML_COMPILED_FEATURES, __pyx_t_11) < (0)) __PYX_ERR(0, 356, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "lxml/etree.pyx":357
 * 
 * LIBXML_COMPILED_FEATURES = _copy_lib_features()
 * LIBXML_FEATURES = {             # <<<<<<<<<<<<<<
 *     feature_name for feature_id, feature_name in [
 *         #XML_WITH_THREAD = 1
*/
  { /* enter inner scope */
    __pyx_t_11 = PySet_New(NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 357, __pyx_L48_error)
    __Pyx_GOTREF(__pyx_t_11);

    /* "lxml/etree.pyx":367
 *         #XML_WITH_WRITER = 7
 *         #XML_WITH_SAX1 = 8
 *         (xmlparser.XML_WITH_FTP, "ftp"),  # XML_WITH_FTP = 9             # <<<<<<<<<<<<<<
 *         (xmlparser.XML_WITH_HTTP, "http"),  # XML_WITH_HTTP = 10
 *         #XML_WITH_VALID = 11
*/
    __pyx_t_5 = __Pyx_PyLong_From_xmlFeature(XML_WITH_FTP); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 367, __pyx_L48_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyTuple_Pack(2, __pyx_t_5, __pyx_mstate_global->__pyx_n_u_ftp); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 367, __pyx_L48_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "lxml/etree.pyx":368
 *         #XML_WITH_SAX1 = 8
 *         (xmlparser.XML_WITH_FTP, "ftp"),  # XML_WITH_FTP = 9
 *         (xmlparser.XML_WITH_HTTP, "http"),  # XML_WITH_HTTP = 10             # <<<<<<<<<<<<<<
 *         #XML_WITH_VALID = 11
 *         (xmlparser.XML_WITH_HTML, "html"),  # XML_WITH_HTML = 12
*/
    __pyx_t_5 = __Pyx_PyLong_From_xmlFeature(XML_WITH_HTTP); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 368, __pyx_L48_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_12 = PyTuple_Pack(2, __pyx_t_5, __pyx_mstate_global->__pyx_n_u_http); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 368, __pyx_L48_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "lxml/etree.pyx":370
 *         (xmlparser.XML_WITH_HTTP, "http"),  # XML_WITH_HTTP = 10
 *         #XML_WITH_VALID = 11
 *         (xmlparser.XML_WITH_HTML, "html"),  # XML_WITH_HTML = 12             # <<<<<<<<<<<<<<
 *         #XML_WITH_LEGACY = 13
 *         #XML_WITH_C14N = 14
*/
    __pyx_t_5 = __Pyx_PyLong_From_xmlFeature(XML_WITH_HTML); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 370, __pyx_L48_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_16 = PyTuple_Pack(2, __pyx_t_5, __pyx_mstate_global->__pyx_n_u_html); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 370, __pyx_L48_error)
    __Pyx_GOTREF(__pyx_t_16);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "lxml/etree.pyx":373
 *         #XML_WITH_LEGACY = 13
 *         #XML_WITH_C14N = 14
 *         (xmlparser.XML_WITH_CATALOG, "catalog"),  # XML_WITH_CATALOG = 15             # <<<<<<<<<<<<<<
 *         (xmlparser.XML_WITH_XPATH, "xpath"),  # XML_WITH_XPATH = 16
 *         #XML_WITH_XPTR = 17
*/
    __pyx_t_5 = __Pyx_PyLong_From_xmlFeature(XML_WITH_CATALOG); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 373, __pyx_L48_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_10 = PyTuple_Pack(2, __pyx_t_5, __pyx_mstate_global->__pyx_n_u_catalog); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 373, __pyx_L48_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "lxml/etree.pyx":374
 *         #XML_WITH_C14N = 14
 *         (xmlparser.XML_WITH_CATALOG, "catalog"),  # XML_WITH_CATALOG = 15
 *         (xmlparser.XML_WITH_XPATH, "xpath"),  # XML_WITH_XPATH = 16             # <<<<<<<<<<<<<<
 *         #XML_WITH_XPTR = 17
 *         #XML_WITH_XINCLUDE = 18
*/
    __pyx_t_5 = __Pyx_PyLong_From_xmlFeature(XML_WITH_XPATH); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 374, __pyx_L48_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_15 = PyTuple_Pack(2, __pyx_t_5, __pyx_mstate_global->__pyx_n_u_xpath); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 374, __pyx_L48_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "lxml/etree.pyx":377
 *         #XML_WITH_XPTR = 17
 *         #XML_WITH_XINCLUDE = 18
 *         (xmlparser.XML_WITH_ICONV, "iconv"),  # XML_WITH_ICONV = 19             # <<<<<<<<<<<<<<
 *         #XML_WITH_ISO8859X = 20
 *         #XML_WITH_UNICODE = 21
*/
    __pyx_t_5 = __Pyx_PyLong_From_xmlFeature(XML_WITH_ICONV); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 377, __pyx_L48_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_18 = PyTuple_Pack(2, __pyx_t_5, __pyx_mstate_global->__pyx_n_u_iconv); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 377, __pyx_L48_error)
    __Pyx_GOTREF(__pyx_t_18);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "lxml/etree.pyx":380
 *         #XML_WITH_ISO8859X = 20
 *         #XML_WITH_UNICODE = 21
 *         (xmlparser.XML_WITH_REGEXP, "regexp"),  # XML_WITH_REGEXP = 22             # <<<<<<<<<<<<<<
 *         #XML_WITH_AUTOMATA = 23
 *         #XML_WITH_EXPR = 24
*/
    __pyx_t_5 = __Pyx_PyLong_From_xmlFeature(XML_WITH_REGEXP); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 380, __pyx_L48_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_19 = PyTuple_Pack(2, __pyx_t_5, __pyx_mstate_global->__pyx_n_u_regexp); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 380, __pyx_L48_error)
    __Pyx_GOTREF(__pyx_t_19);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "lxml/etree.pyx":383
 *         #XML_WITH_AUTOMATA = 23
 *         #XML_WITH_EXPR = 24
 *         (xmlparser.XML_WITH_SCHEMAS, "xmlschema"),  # XML_WITH_SCHEMAS = 25             # <<<<<<<<<<<<<<
 *         (xmlparser.XML_WITH_SCHEMATRON, "schematron"),  # XML_WITH_SCHEMATRON = 26
 *         #XML_WITH_MODULES = 27
*/
    __pyx_t_5 = __Pyx_PyLong_From_xmlFeature(XML_WITH_SCHEMAS); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 383, __pyx_L48_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_20 = PyTuple_Pack(2, __pyx_t_5, __pyx_mstate_global->__pyx_n_u_xmlschema); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 383, __pyx_L48_error)
    __Pyx_GOTREF(__pyx_t_20);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "lxml/etree.pyx":384
 *         #XML_WITH_EXPR = 24
 *         (xmlparser.XML_WITH_SCHEMAS, "xmlschema"),  # XML_WITH_SCHEMAS = 25
 *         (xmlparser.XML_WITH_SCHEMATRON, "schematron"),  # XML_WITH_SCHEMATRON = 26             # <<<<<<<<<<<<<<
 *         #XML_WITH_MODULES = 27
 *         #XML_WITH_DEBUG = 28
*/
    __pyx_t_5 = __Pyx_PyLong_From_xmlFeature(XML_WITH_SCHEMATRON); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 384, __pyx_L48_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_21 = PyTuple_Pack(2, __pyx_t_5, __pyx_mstate_global->__pyx_n_u_schematron); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 384, __pyx_L48_error)
    __Pyx_GOTREF(__pyx_t_21);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "lxml/etree.pyx":389
 *         #XML_WITH_DEBUG_MEM = 29
 *         #XML_WITH_DEBUG_RUN = 30  # unused
 *         (xmlparser.XML_WITH_ZLIB, "zlib"),  # XML_WITH_ZLIB = 31             # <<<<<<<<<<<<<<
 *         (xmlparser.XML_WITH_ICU, "icu"),  # XML_WITH_ICU = 32
 *         (xmlparser.XML_WITH_LZMA, "lzma"),  # XML_WITH_LZMA = 33
*/
    __pyx_t_5 = __Pyx_PyLong_From_xmlFeature(XML_WITH_ZLIB); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 389, __pyx_L48_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_22 = PyTuple_Pack(2, __pyx_t_5, __pyx_mstate_global->__pyx_n_u_zlib); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 389, __pyx_L48_error)
    __Pyx_GOTREF(__pyx_t_22);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "lxml/etree.pyx":390
 *         #XML_WITH_DEBUG_RUN = 30  # unused
 *         (xmlparser.XML_WITH_ZLIB, "zlib"),  # XML_WITH_ZLIB = 31
 *         (xmlparser.XML_WITH_ICU, "icu"),  # XML_WITH_ICU = 32             # <<<<<<<<<<<<<<
 *         (xmlparser.XML_WITH_LZMA, "lzma"),  # XML_WITH_LZMA = 33
 *     ] if xmlparser.xmlHasFeature(feature_id)
*/
    __pyx_t_5 = __Pyx_PyLong_From_xmlFeature(XML_WITH_ICU); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 390, __pyx_L48_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_23 = PyTuple_Pack(2, __pyx_t_5, __pyx_mstate_global->__pyx_n_u_icu); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 390, __pyx_L48_error)
    __Pyx_GOTREF(__pyx_t_23);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "lxml/etree.pyx":391
 *         (xmlparser.XML_WITH_ZLIB, "zlib"),  # XML_WITH_ZLIB = 31
 *         (xmlparser.XML_WITH_ICU, "icu"),  # XML_WITH_ICU = 32
 *         (xmlparser.XML_WITH_LZMA, "lzma"),  # XML_WITH_LZMA = 33             # <<<<<<<<<<<<<<
 *     ] if xmlparser.xmlHasFeature(feature_id)
 * }
*/
    __pyx_t_5 = __Pyx_PyLong_From_xmlFeature(XML_WITH_LZMA); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 391, __pyx_L48_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_24 = PyTuple_Pack(2, __pyx_t_5, __pyx_mstate_global->__pyx_n_u_lzma); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 391, __pyx_L48_error)
    __Pyx_GOTREF(__pyx_t_24);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "lxml/etree.pyx":358
 * LIBXML_COMPILED_FEATURES = _copy_lib_features()
 * LIBXML_FEATURES = {
 *     feature_name for feature_id, feature_name in [             # <<<<<<<<<<<<<<
 *         #XML_WITH_THREAD = 1
 *         #XML_WITH_TREE = 2
*/
    __pyx_t_5 = PyTuple_Pack(12, __pyx_t_4, __pyx_t_12, __pyx_t_16, __pyx_t_10, __pyx_t_15, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_23, __pyx_t_24); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 358, __pyx_L48_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
    __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
    __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
    __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
    __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
    __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
    __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
    __pyx_t_24 = __pyx_t_5; __Pyx_INCREF(__pyx_t_24);
    __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    for (;;) {
      if (__pyx_t_9 >= 12) break;
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_24, __pyx_t_9));
      #else
      __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_24, __pyx_t_9);
      #endif
      ++__pyx_t_9;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 358, __pyx_L48_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (likely(__pyx_t_5 != Py_None)) {
        PyObject* sequence = __pyx_t_5;
        Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(0, 358, __pyx_L48_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_23 = PyTuple_GET_ITEM(sequence, 0);
        __Pyx_INCREF(__pyx_t_23);
        __pyx_t_22 = PyTuple_GET_ITEM(sequence, 1);
        __Pyx_INCREF(__pyx_t_22);
        #else
        __pyx_t_23 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 358, __pyx_L48_error)
        __Pyx_GOTREF(__pyx_t_23);
        __pyx_t_22 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 358, __pyx_L48_error)
        __Pyx_GOTREF(__pyx_t_22);
        #endif
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      } else {
        __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 358, __pyx_L48_error)
      }
      __Pyx_XGOTREF(__pyx_8genexpr1__pyx_v_4lxml_5etree_feature_id);
      __Pyx_DECREF_SET(__pyx_8genexpr1__pyx_v_4lxml_5etree_feature_id, __pyx_t_23);
      __Pyx_GIVEREF(__pyx_t_23);
      __pyx_t_23 = 0;
      __Pyx_XGOTREF(__pyx_8genexpr1__pyx_v_4lxml_5etree_feature_name);
      __Pyx_DECREF_SET(__pyx_8genexpr1__pyx_v_4lxml_5etree_feature_name, __pyx_t_22);
      __Pyx_GIVEREF(__pyx_t_22);
      __pyx_t_22 = 0;

      /* "lxml/etree.pyx":392
 *         (xmlparser.XML_WITH_ICU, "icu"),  # XML_WITH_ICU = 32
 *         (xmlparser.XML_WITH_LZMA, "lzma"),  # XML_WITH_LZMA = 33
 *     ] if xmlparser.xmlHasFeature(feature_id)             # <<<<<<<<<<<<<<
 * }
 * 
*/
      __pyx_t_25 = ((xmlFeature)__Pyx_PyLong_As_xmlFeature(__pyx_8genexpr1__pyx_v_4lxml_5etree_feature_id)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 392, __pyx_L48_error)
      __pyx_t_8 = xmlHasFeature(__pyx_t_25);
      if (__pyx_t_8) {

        /* "lxml/etree.pyx":358
 * LIBXML_COMPILED_FEATURES = _copy_lib_features()
 * LIBXML_FEATURES = {
 *     feature_name for feature_id, feature_name in [             # <<<<<<<<<<<<<<
 *         #XML_WITH_THREAD = 1
 *         #XML_WITH_TREE = 2
*/
        if (unlikely(PySet_Add(__pyx_t_11, (PyObject*)__pyx_8genexpr1__pyx_v_4lxml_5etree_feature_name))) __PYX_ERR(0, 358, __pyx_L48_error)

        /* "lxml/etree.pyx":392
 *         (xmlparser.XML_WITH_ICU, "icu"),  # XML_WITH_ICU = 32
 *         (xmlparser.XML_WITH_LZMA, "lzma"),  # XML_WITH_LZMA = 33
 *     ] if xmlparser.xmlHasFeature(feature_id)             # <<<<<<<<<<<<<<
 * }
 * 
*/
      }

      /* "lxml/etree.pyx":358
 * LIBXML_COMPILED_FEATURES = _copy_lib_features()
 * LIBXML_FEATURES = {
 *     feature_name for feature_id, feature_name in [             # <<<<<<<<<<<<<<
 *         #XML_WITH_THREAD = 1
 *         #XML_WITH_TREE = 2
*/
    }
    __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
    __Pyx_GOTREF(__pyx_8genexpr1__pyx_v_4lxml_5etree_feature_id);
    __Pyx_DECREF_SET(__pyx_8genexpr1__pyx_v_4lxml_5etree_feature_id, Py_None);
    __Pyx_GOTREF(__pyx_8genexpr1__pyx_v_4lxml_5etree_feature_name);
    __Pyx_DECREF_SET(__pyx_8genexpr1__pyx_v_4lxml_5etree_feature_name, Py_None);
    goto __pyx_L53_exit_scope;
    __pyx_L48_error:;
    __Pyx_GOTREF(__pyx_8genexpr1__pyx_v_4lxml_5etree_feature_id);
    __Pyx_DECREF_SET(__pyx_8genexpr1__pyx_v_4lxml_5etree_feature_id, Py_None);
    __Pyx_GOTREF(__pyx_8genexpr1__pyx_v_4lxml_5etree_feature_name);
    __Pyx_DECREF_SET(__pyx_8genexpr1__pyx_v_4lxml_5etree_feature_name, Py_None);
    goto __pyx_L1_error;
    __pyx_L53_exit_scope:;
  } /* exit inner scope */
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_LIBXML_FEATURES, __pyx_t_11) < (0)) __PYX_ERR(0, 357, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "lxml/etree.pyx":395
 * }
 * 
 * cdef bint HAS_ZLIB_COMPRESSION = xmlparser.xmlHasFeature(xmlparser.XML_WITH_ZLIB)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_v_4lxml_5etree_HAS_ZLIB_COMPRESSION = xmlHasFeature(XML_WITH_ZLIB);

  /* "src/lxml/apihelpers.pxi":665
 *     return attributes
 * 
 * cdef object __RE_XML_ENCODING = re.compile(             # <<<<<<<<<<<<<<
 *     r'^(<\?xml[^>]+)\s+encoding\s*=\s*["\'][^"\']*["\'](\s*\?>|)', re.U)
 * 
*/
  __pyx_t_24 = __pyx_v_4lxml_5etree_re;
  __Pyx_INCREF(__pyx_t_24);

  /* "src/lxml/apihelpers.pxi":666
 * 
 * cdef object __RE_XML_ENCODING = re.compile(
 *     r'^(<\?xml[^>]+)\s+encoding\s*=\s*["\'][^"\']*["\'](\s*\?>|)', re.U)             # <<<<<<<<<<<<<<
 * 
 * cdef object __REPLACE_XML_ENCODING = __RE_XML_ENCODING.sub
*/
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree_re, __pyx_mstate_global->__pyx_n_u_U); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 666, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_24, __pyx_mstate_global->__pyx_kp_u_xml_s_encoding_s_s_s, __pyx_t_5};
    __pyx_t_11 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_compile, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_11)) __PYX_ERR(4, 665, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
  }
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree___RE_XML_ENCODING);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree___RE_XML_ENCODING, __pyx_t_11);
  __Pyx_GIVEREF(__pyx_t_11);
  __pyx_t_11 = 0;

  /* "src/lxml/apihelpers.pxi":668
 *     r'^(<\?xml[^>]+)\s+encoding\s*=\s*["\'][^"\']*["\'](\s*\?>|)', re.U)
 * 
 * cdef object __REPLACE_XML_ENCODING = __RE_XML_ENCODING.sub             # <<<<<<<<<<<<<<
 * cdef object __HAS_XML_ENCODING = __RE_XML_ENCODING.match
 * 
*/
  __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree___RE_XML_ENCODING, __pyx_mstate_global->__pyx_n_u_sub); if (unlikely(!__pyx_t_11)) __PYX_ERR(4, 668, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree___REPLACE_XML_ENCODING);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree___REPLACE_XML_ENCODING, __pyx_t_11);
  __Pyx_GIVEREF(__pyx_t_11);
  __pyx_t_11 = 0;

  /* "src/lxml/apihelpers.pxi":669
 * 
 * cdef object __REPLACE_XML_ENCODING = __RE_XML_ENCODING.sub
 * cdef object __HAS_XML_ENCODING = __RE_XML_ENCODING.match             # <<<<<<<<<<<<<<
 * 
 * cdef object _stripEncodingDeclaration(object xml_string):
*/
  __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree___RE_XML_ENCODING, __pyx_mstate_global->__pyx_n_u_match); if (unlikely(!__pyx_t_11)) __PYX_ERR(4, 669, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree___HAS_XML_ENCODING);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree___HAS_XML_ENCODING, __pyx_t_11);
  __Pyx_GIVEREF(__pyx_t_11);
  __pyx_t_11 = 0;

  /* "src/lxml/xmlerror.pxi":11
 * # module level API functions
 * 
 * def clear_error_log():             # <<<<<<<<<<<<<<
 *     """clear_error_log()
 * 
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_3clear_error_log, 0, __pyx_mstate_global->__pyx_n_u_clear_error_log_2, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[25])); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 11, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_clear_error_log_2, __pyx_t_11) < (0)) __PYX_ERR(1, 11, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "src/lxml/xmlerror.pxi":194
 *         self.last_error = last_error
 * 
 *     cpdef copy(self):             # <<<<<<<<<<<<<<
 *         return _BaseErrorLog(self._first_error, self.last_error)
 * 
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_13_BaseErrorLog_3copy, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_BaseErrorLog_copy, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[26])); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 194, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__BaseErrorLog, __pyx_mstate_global->__pyx_n_u_copy, __pyx_t_11) < (0)) __PYX_ERR(1, 194, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "src/lxml/xmlerror.pxi":200
 *         return ''
 * 
 *     cpdef receive(self, _LogEntry entry):             # <<<<<<<<<<<<<<
 *         pass
 * 
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_13_BaseErrorLog_7receive, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_BaseErrorLog_receive, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[27])); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 200, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__BaseErrorLog, __pyx_mstate_global->__pyx_n_u_receive, __pyx_t_11) < (0)) __PYX_ERR(1, 200, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "src/lxml/xmlerror.pxi":290
 *         self._entries = entries
 * 
 *     cpdef copy(self):             # <<<<<<<<<<<<<<
 *         """Creates a shallow copy of this error log.  Reuses the list of
 *         entries.
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_13_ListErrorLog_3copy, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ListErrorLog_copy, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[28])); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 290, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ListErrorLog, __pyx_mstate_global->__pyx_n_u_copy, __pyx_t_11) < (0)) __PYX_ERR(1, 290, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "src/lxml/xmlerror.pxi":328
 *         return len(self._entries) > self._offset
 * 
 *     def filter_domains(self, domains):             # <<<<<<<<<<<<<<
 *         """Filter the errors by the given domains and return a new error log
 *         containing the matches.
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_13_ListErrorLog_17filter_domains, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ListErrorLog_filter_domains, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[29])); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 328, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ListErrorLog, __pyx_mstate_global->__pyx_n_u_filter_domains, __pyx_t_11) < (0)) __PYX_ERR(1, 328, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "src/lxml/xmlerror.pxi":338
 *         return _ListErrorLog(filtered, None, None)
 * 
 *     def filter_types(self, types):             # <<<<<<<<<<<<<<
 *         """filter_types(self, types)
 * 
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_13_ListErrorLog_19filter_types, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ListErrorLog_filter_types, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[30])); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 338, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ListErrorLog, __pyx_mstate_global->__pyx_n_u_filter_types, __pyx_t_11) < (0)) __PYX_ERR(1, 338, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "src/lxml/xmlerror.pxi":350
 *         return _ListErrorLog(filtered, None, None)
 * 
 *     def filter_levels(self, levels):             # <<<<<<<<<<<<<<
 *         """filter_levels(self, levels)
 * 
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_13_ListErrorLog_21filter_levels, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ListErrorLog_filter_levels, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[31])); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 350, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ListErrorLog, __pyx_mstate_global->__pyx_n_u_filter_levels, __pyx_t_11) < (0)) __PYX_ERR(1, 350, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "src/lxml/xmlerror.pxi":362
 *         return _ListErrorLog(filtered, None, None)
 * 
 *     def filter_from_level(self, level):             # <<<<<<<<<<<<<<
 *         """filter_from_level(self, level)
 * 
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_13_ListErrorLog_23filter_from_level, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ListErrorLog_filter_from_level, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[32])); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 362, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ListErrorLog, __pyx_mstate_global->__pyx_n_u_filter_from_level, __pyx_t_11) < (0)) __PYX_ERR(1, 362, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "src/lxml/xmlerror.pxi":371
 *         return _ListErrorLog(filtered, None, None)
 * 
 *     def filter_from_fatals(self):             # <<<<<<<<<<<<<<
 *         """filter_from_fatals(self)
 * 
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_13_ListErrorLog_25filter_from_fatals, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ListErrorLog_filter_from_fatals, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[33])); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 371, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ListErrorLog, __pyx_mstate_global->__pyx_n_u_filter_from_fatals, __pyx_t_11) < (0)) __PYX_ERR(1, 371, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "src/lxml/xmlerror.pxi":378
 *         return self.filter_from_level(ErrorLevels.FATAL)
 * 
 *     def filter_from_errors(self):             # <<<<<<<<<<<<<<
 *         """filter_from_errors(self)
 * 
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_13_ListErrorLog_27filter_from_errors, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ListErrorLog_filter_from_errors, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[34])); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 378, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ListErrorLog, __pyx_mstate_global->__pyx_n_u_filter_from_errors, __pyx_t_11) < (0)) __PYX_ERR(1, 378, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "src/lxml/xmlerror.pxi":385
 *         return self.filter_from_level(ErrorLevels.ERROR)
 * 
 *     def filter_from_warnings(self):             # <<<<<<<<<<<<<<
 *         """filter_from_warnings(self)
 * 
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_13_ListErrorLog_29filter_from_warnings, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ListErrorLog_filter_from_warnin, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[35])); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 385, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ListErrorLog, __pyx_mstate_global->__pyx_n_u_filter_from_warnings, __pyx_t_11) < (0)) __PYX_ERR(1, 385, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "src/lxml/xmlerror.pxi":444
 *         return self.connect()
 * 
 *     def __exit__(self, *args):             # <<<<<<<<<<<<<<
 *         #  TODO: make this a cdef function when Cython supports it
 *         self.disconnect()
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_9_ErrorLog_5__exit__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ErrorLog___exit, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[36])); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 444, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ErrorLog, __pyx_mstate_global->__pyx_n_u_exit, __pyx_t_11) < (0)) __PYX_ERR(1, 444, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "src/lxml/xmlerror.pxi":464
 *         return 0
 * 
 *     cpdef clear(self):             # <<<<<<<<<<<<<<
 *         self._first_error = None
 *         self.last_error = None
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_9_ErrorLog_7clear, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ErrorLog_clear, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[37])); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 464, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ErrorLog, __pyx_mstate_global->__pyx_n_u_clear, __pyx_t_11) < (0)) __PYX_ERR(1, 464, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "src/lxml/xmlerror.pxi":470
 *         del self._entries[:]
 * 
 *     cpdef copy(self):             # <<<<<<<<<<<<<<
 *         """Creates a shallow copy of this error log and the list of entries.
 *         """
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_9_ErrorLog_9copy, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ErrorLog_copy, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[38])); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ErrorLog, __pyx_mstate_global->__pyx_n_u_copy, __pyx_t_11) < (0)) __PYX_ERR(1, 470, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "src/lxml/xmlerror.pxi":480
 *         return iter(self._entries[self._offset:])
 * 
 *     cpdef receive(self, _LogEntry entry):             # <<<<<<<<<<<<<<
 *         if self._first_error is None and entry.level >= xmlerror.XML_ERR_ERROR:
 *             self._first_error = entry
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_9_ErrorLog_13receive, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ErrorLog_receive, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[39])); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 480, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ErrorLog, __pyx_mstate_global->__pyx_n_u_receive, __pyx_t_11) < (0)) __PYX_ERR(1, 480, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "src/lxml/xmlerror.pxi":490
 *         self._accepted_domains = tuple(domains)
 * 
 *     cpdef receive(self, _LogEntry entry):             # <<<<<<<<<<<<<<
 *         if entry.domain in self._accepted_domains:
 *             _ErrorLog.receive(self, entry)
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_15_DomainErrorLog_3receive, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_DomainErrorLog_receive, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[40])); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 490, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__DomainErrorLog, __pyx_mstate_global->__pyx_n_u_receive, __pyx_t_11) < (0)) __PYX_ERR(1, 490, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "src/lxml/xmlerror.pxi":500
 *         self._max_len = max_len
 * 
 *     cpdef receive(self, _LogEntry entry):             # <<<<<<<<<<<<<<
 *         if self._first_error is None and entry.level >= xmlerror.XML_ERR_ERROR:
 *             self._first_error = entry
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_17_RotatingErrorLog_3receive, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_RotatingErrorLog_receive, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[41])); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 500, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__RotatingErrorLog, __pyx_mstate_global->__pyx_n_u_receive, __pyx_t_11) < (0)) __PYX_ERR(1, 500, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "src/lxml/xmlerror.pxi":551
 *         self._log = logger.log
 * 
 *     cpdef copy(self):             # <<<<<<<<<<<<<<
 *         """Dummy method that returns an empty error log.
 *         """
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_10PyErrorLog_3copy, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_PyErrorLog_copy, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[42])); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 551, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_PyErrorLog, __pyx_mstate_global->__pyx_n_u_copy, __pyx_t_11) < (0)) __PYX_ERR(1, 551, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "src/lxml/xmlerror.pxi":556
 *         return _ListErrorLog([], None, None)
 * 
 *     def log(self, log_entry, message, *args):             # <<<<<<<<<<<<<<
 *         """log(self, log_entry, message, *args)
 * 
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_10PyErrorLog_5log, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_PyErrorLog_log, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[43])); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 556, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_PyErrorLog, __pyx_mstate_global->__pyx_n_u_log, __pyx_t_11) < (0)) __PYX_ERR(1, 556, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "src/lxml/xmlerror.pxi":573
 *             )
 * 
 *     cpdef receive(self, _LogEntry log_entry):             # <<<<<<<<<<<<<<
 *         """receive(self, log_entry)
 * 
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_10PyErrorLog_7receive, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_PyErrorLog_receive, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[44])); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 573, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_PyErrorLog, __pyx_mstate_global->__pyx_n_u_receive, __pyx_t_11) < (0)) __PYX_ERR(1, 573, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "src/lxml/xmlerror.pxi":589
 * # libxml2/libxslt
 * 
 * cdef _BaseErrorLog __GLOBAL_ERROR_LOG = _RotatingErrorLog(__MAX_LOG_SIZE)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_5 = NULL;
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_int_100};
    __pyx_t_11 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__RotatingErrorLog, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 589, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_11);
  }
  __Pyx_XGOTREF((PyObject *)__pyx_v_4lxml_5etree___GLOBAL_ERROR_LOG);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree___GLOBAL_ERROR_LOG, ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_t_11));
  __Pyx_GIVEREF((PyObject *)__pyx_t_11);
  __pyx_t_11 = 0;

  /* "src/lxml/xmlerror.pxi":623
 * 
 * 
 * def use_global_python_log(PyErrorLog log not None):             # <<<<<<<<<<<<<<
 *     """use_global_python_log(log)
 * 
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_5use_global_python_log, 0, __pyx_mstate_global->__pyx_n_u_use_global_python_log, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[45])); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 623, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_use_global_python_log, __pyx_t_11) < (0)) __PYX_ERR(1, 623, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "src/lxml/xmlerror.pxi":818
 * 
 * 
 * class ErrorLevels(object):             # <<<<<<<<<<<<<<
 *     """Libxml2 error levels"""
 * 
*/
  __pyx_t_11 = __Pyx_PEP560_update_bases(__pyx_mstate_global->__pyx_tuple[13]); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 818, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_5 = __Pyx_CalculateMetaclass(NULL, __pyx_t_11); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 818, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_24 = __Pyx_Py3MetaclassPrepare(__pyx_t_5, __pyx_t_11, __pyx_mstate_global->__pyx_n_u_ErrorLevels, __pyx_mstate_global->__pyx_n_u_ErrorLevels, (PyObject *) NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_kp_u_Libxml2_error_levels); if (unlikely(!__pyx_t_24)) __PYX_ERR(1, 818, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  if (__pyx_t_11 != __pyx_mstate_global->__pyx_tuple[13]) {
    if (unlikely((PyDict_SetItemString(__pyx_t_24, "__orig_bases__", __pyx_mstate_global->__pyx_tuple[13]) < 0))) __PYX_ERR(1, 818, __pyx_L1_error)
  }
  __pyx_t_22 = __Pyx_Py3ClassCreate(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_ErrorLevels, __pyx_t_11, __pyx_t_24, NULL, 0, 0); if (unlikely(!__pyx_t_22)) __PYX_ERR(1, 818, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_ErrorLevels, __pyx_t_22) < (0)) __PYX_ERR(1, 818, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "src/lxml/xmlerror.pxi":821
 *     """Libxml2 error levels"""
 * 
 * class ErrorDomains(object):             # <<<<<<<<<<<<<<
 *     """Libxml2 error domains"""
 * 
*/
  __pyx_t_11 = __Pyx_PEP560_update_bases(__pyx_mstate_global->__pyx_tuple[15]); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 821, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_5 = __Pyx_CalculateMetaclass(NULL, __pyx_t_11); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 821, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_24 = __Pyx_Py3MetaclassPrepare(__pyx_t_5, __pyx_t_11, __pyx_mstate_global->__pyx_n_u_ErrorDomains, __pyx_mstate_global->__pyx_n_u_ErrorDomains, (PyObject *) NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_kp_u_Libxml2_error_domains); if (unlikely(!__pyx_t_24)) __PYX_ERR(1, 821, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  if (__pyx_t_11 != __pyx_mstate_global->__pyx_tuple[15]) {
    if (unlikely((PyDict_SetItemString(__pyx_t_24, "__orig_bases__", __pyx_mstate_global->__pyx_tuple[15]) < 0))) __PYX_ERR(1, 821, __pyx_L1_error)
  }
  __pyx_t_22 = __Pyx_Py3ClassCreate(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_ErrorDomains, __pyx_t_11, __pyx_t_24, NULL, 0, 0); if (unlikely(!__pyx_t_22)) __PYX_ERR(1, 821, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_ErrorDomains, __pyx_t_22) < (0)) __PYX_ERR(1, 821, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "src/lxml/xmlerror.pxi":824
 *     """Libxml2 error domains"""
 * 
 * class ErrorTypes(object):             # <<<<<<<<<<<<<<
 *     """Libxml2 error types"""
 * 
*/
  __pyx_t_11 = __Pyx_PEP560_update_bases(__pyx_mstate_global->__pyx_tuple[17]); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 824, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_5 = __Pyx_CalculateMetaclass(NULL, __pyx_t_11); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 824, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_24 = __Pyx_Py3MetaclassPrepare(__pyx_t_5, __pyx_t_11, __pyx_mstate_global->__pyx_n_u_ErrorTypes, __pyx_mstate_global->__pyx_n_u_ErrorTypes, (PyObject *) NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_kp_u_Libxml2_error_types); if (unlikely(!__pyx_t_24)) __PYX_ERR(1, 824, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  if (__pyx_t_11 != __pyx_mstate_global->__pyx_tuple[17]) {
    if (unlikely((PyDict_SetItemString(__pyx_t_24, "__orig_bases__", __pyx_mstate_global->__pyx_tuple[17]) < 0))) __PYX_ERR(1, 824, __pyx_L1_error)
  }
  __pyx_t_22 = __Pyx_Py3ClassCreate(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_ErrorTypes, __pyx_t_11, __pyx_t_24, NULL, 0, 0); if (unlikely(!__pyx_t_22)) __PYX_ERR(1, 824, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_ErrorTypes, __pyx_t_22) < (0)) __PYX_ERR(1, 824, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "src/lxml/xmlerror.pxi":827
 *     """Libxml2 error types"""
 * 
 * class RelaxNGErrorTypes(object):             # <<<<<<<<<<<<<<
 *     """Libxml2 RelaxNG error types"""
 * 
*/
  __pyx_t_11 = __Pyx_PEP560_update_bases(__pyx_mstate_global->__pyx_tuple[19]); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 827, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_5 = __Pyx_CalculateMetaclass(NULL, __pyx_t_11); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 827, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_24 = __Pyx_Py3MetaclassPrepare(__pyx_t_5, __pyx_t_11, __pyx_mstate_global->__pyx_n_u_RelaxNGErrorTypes, __pyx_mstate_global->__pyx_n_u_RelaxNGErrorTypes, (PyObject *) NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_kp_u_Libxml2_RelaxNG_error_types); if (unlikely(!__pyx_t_24)) __PYX_ERR(1, 827, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  if (__pyx_t_11 != __pyx_mstate_global->__pyx_tuple[19]) {
    if (unlikely((PyDict_SetItemString(__pyx_t_24, "__orig_bases__", __pyx_mstate_global->__pyx_tuple[19]) < 0))) __PYX_ERR(1, 827, __pyx_L1_error)
  }
  __pyx_t_22 = __Pyx_Py3ClassCreate(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_RelaxNGErrorTypes, __pyx_t_11, __pyx_t_24, NULL, 0, 0); if (unlikely(!__pyx_t_22)) __PYX_ERR(1, 827, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_RelaxNGErrorTypes, __pyx_t_22) < (0)) __PYX_ERR(1, 827, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "src/lxml/xmlerror.pxi":835
 * # This section is generated by the script 'update-error-constants.py'.
 * 
 * cdef object __ERROR_LEVELS = """\             # <<<<<<<<<<<<<<
 * NONE=0
 * WARNING=1
*/
  __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_NONE_0_WARNING_1_ERROR_2_FATAL_3);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree___ERROR_LEVELS);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree___ERROR_LEVELS, __pyx_mstate_global->__pyx_kp_u_NONE_0_WARNING_1_ERROR_2_FATAL_3);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_kp_u_NONE_0_WARNING_1_ERROR_2_FATAL_3);

  /* "src/lxml/xmlerror.pxi":842
 * """
 * 
 * cdef object __ERROR_DOMAINS = """\             # <<<<<<<<<<<<<<
 * NONE=0
 * PARSER=1
*/
  __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_NONE_0_PARSER_1_TREE_2_NAMESPACE);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree___ERROR_DOMAINS);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree___ERROR_DOMAINS, __pyx_mstate_global->__pyx_kp_u_NONE_0_PARSER_1_TREE_2_NAMESPACE);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_kp_u_NONE_0_PARSER_1_TREE_2_NAMESPACE);

  /* "src/lxml/xmlerror.pxi":876
 * """
 * 
 * cdef object __PARSER_ERROR_TYPES = """\             # <<<<<<<<<<<<<<
 * ERR_OK=0
 * ERR_INTERNAL_ERROR=1
*/
  __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_ERR_OK_0_ERR_INTERNAL_ERROR_1_ER);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree___PARSER_ERROR_TYPES);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree___PARSER_ERROR_TYPES, __pyx_mstate_global->__pyx_kp_u_ERR_OK_0_ERR_INTERNAL_ERROR_1_ER);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_kp_u_ERR_OK_0_ERR_INTERNAL_ERROR_1_ER);

  /* "src/lxml/xmlerror.pxi":1622
 * """
 * 
 * cdef object __RELAXNG_ERROR_TYPES = """\             # <<<<<<<<<<<<<<
 * RELAXNG_OK=0
 * RELAXNG_ERR_MEMORY=1
*/
  __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_RELAXNG_OK_0_RELAXNG_ERR_MEMORY);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree___RELAXNG_ERROR_TYPES);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree___RELAXNG_ERROR_TYPES, __pyx_mstate_global->__pyx_kp_u_RELAXNG_OK_0_RELAXNG_ERR_MEMORY);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_kp_u_RELAXNG_OK_0_RELAXNG_ERR_MEMORY);

  /* "src/lxml/xmlerror.pxi":1666
 * # --- END: GENERATED CONSTANTS ---
 * 
 * __initErrorConstants()             # <<<<<<<<<<<<<<
*/
  __pyx_t_11 = __pyx_f_4lxml_5etree___initErrorConstants(); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 1666, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "lxml/etree.pyx":629
 *                    for i in range(26) ])
 * 
 * cdef tuple _PREFIX_CACHE = __initPrefixCache()             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_11 = __pyx_f_4lxml_5etree___initPrefixCache(); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 629, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree__PREFIX_CACHE);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__PREFIX_CACHE, ((PyObject*)__pyx_t_11));
  __Pyx_GIVEREF(__pyx_t_11);
  __pyx_t_11 = 0;

  /* "lxml/etree.pyx":644
 * 
 * 
 * cdef object _find_invalid_public_id_characters = re.compile(             # <<<<<<<<<<<<<<
 *     ur"[^\x20\x0D\x0Aa-zA-Z0-9'()+,./:=?;!*#@$_%-]+").search
 * 
*/
  __pyx_t_5 = __pyx_v_4lxml_5etree_re;
  __Pyx_INCREF(__pyx_t_5);
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_x20_x0D_x0Aa_zA_Z0_9};
    __pyx_t_11 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_compile, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 644, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
  }

  /* "lxml/etree.pyx":645
 * 
 * cdef object _find_invalid_public_id_characters = re.compile(
 *     ur"[^\x20\x0D\x0Aa-zA-Z0-9'()+,./:=?;!*#@$_%-]+").search             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_search); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 645, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree__find_invalid_public_id_characters);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__find_invalid_public_id_characters, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_5 = 0;

  /* "lxml/etree.pyx":678
 *         return  tree.xmlCreateIntSubset(c_doc, c_name, NULL, NULL)
 * 
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         """Removes DOCTYPE and internal subset from the document."""
 *         cdef xmlDoc* c_doc = self._doc._c_doc
*/
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_7DocInfo_3clear, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_DocInfo_clear, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[46])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 678, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_DocInfo, __pyx_mstate_global->__pyx_n_u_clear, __pyx_t_5) < (0)) __PYX_ERR(0, 678, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "lxml/etree.pyx":835
 *     cdef object _tag
 * 
 *     def _init(self):             # <<<<<<<<<<<<<<
 *         """_init(self)
 * 
*/
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_1_init, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Element__init, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[47])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 835, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element, __pyx_mstate_global->__pyx_n_u_init_2, __pyx_t_5) < (0)) __PYX_ERR(0, 835, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "lxml/etree.pyx":923
 *             _removeNode(self._doc, c_node)
 * 
 *     def __deepcopy__(self, memo):             # <<<<<<<<<<<<<<
 *         "__deepcopy__(self, memo)"
 *         return self.__copy__()
*/
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_9__deepcopy__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Element___deepcopy, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[48])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 923, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element, __pyx_mstate_global->__pyx_n_u_deepcopy, __pyx_t_5) < (0)) __PYX_ERR(0, 923, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "lxml/etree.pyx":927
 *         return self.__copy__()
 * 
 *     def __copy__(self):             # <<<<<<<<<<<<<<
 *         "__copy__(self)"
 *         cdef xmlDoc* c_doc
*/
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_11__copy__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Element___copy, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[49])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 927, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element, __pyx_mstate_global->__pyx_n_u_copy_2, __pyx_t_5) < (0)) __PYX_ERR(0, 927, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "lxml/etree.pyx":946
 *         return _elementFactory(new_doc, c_node)
 * 
 *     def set(self, key, value):             # <<<<<<<<<<<<<<
 *         """set(self, key, value)
 * 
*/
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_13set, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Element_set, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[50])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 946, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element, __pyx_mstate_global->__pyx_n_u_set, __pyx_t_5) < (0)) __PYX_ERR(0, 946, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "lxml/etree.pyx":956
 *         _setAttributeValue(self, key, value)
 * 
 *     def append(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         """append(self, element)
 * 
*/
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_15append, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Element_append, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[51])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 956, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element, __pyx_mstate_global->__pyx_n_u_append, __pyx_t_5) < (0)) __PYX_ERR(0, 956, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "lxml/etree.pyx":965
 *         _appendChild(self, element)
 * 
 *     def addnext(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         """addnext(self, element)
 * 
*/
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_17addnext, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Element_addnext, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[52])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 965, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element, __pyx_mstate_global->__pyx_n_u_addnext, __pyx_t_5) < (0)) __PYX_ERR(0, 965, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "lxml/etree.pyx":983
 *         _appendSibling(self, element)
 * 
 *     def addprevious(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         """addprevious(self, element)
 * 
*/
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_19addprevious, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Element_addprevious, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[53])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 983, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element, __pyx_mstate_global->__pyx_n_u_addprevious, __pyx_t_5) < (0)) __PYX_ERR(0, 983, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "lxml/etree.pyx":1002
 *         _prependSibling(self, element)
 * 
 *     def extend(self, elements):             # <<<<<<<<<<<<<<
 *         """extend(self, elements)
 * 
*/
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_21extend, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Element_extend, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[54])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1002, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element, __pyx_mstate_global->__pyx_n_u_extend, __pyx_t_5) < (0)) __PYX_ERR(0, 1002, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "lxml/etree.pyx":1015
 *             _appendChild(self, element)
 * 
 *     def clear(self, bint keep_tail=False):             # <<<<<<<<<<<<<<
 *         """clear(self, keep_tail=False)
 * 
*/
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_23clear, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Element_clear, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[55])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1015, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_mstate_global->__pyx_tuple[20]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element, __pyx_mstate_global->__pyx_n_u_clear, __pyx_t_5) < (0)) __PYX_ERR(0, 1015, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "lxml/etree.pyx":1047
 *             c_node = c_node_next
 * 
 *     def insert(self, index: int, _Element element not None):             # <<<<<<<<<<<<<<
 *         """insert(self, index, element)
 * 
*/
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1047, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_index, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 1047, __pyx_L1_error)
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_25insert, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Element_insert, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[56])); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1047, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_11, __pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element, __pyx_mstate_global->__pyx_n_u_insert, __pyx_t_11) < (0)) __PYX_ERR(0, 1047, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "lxml/etree.pyx":1070
 *         moveNodeToDocument(self._doc, c_source_doc, element._c_node)
 * 
 *     def remove(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         """remove(self, element)
 * 
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_27remove, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Element_remove, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[57])); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1070, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element, __pyx_mstate_global->__pyx_n_u_remove, __pyx_t_11) < (0)) __PYX_ERR(0, 1070, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "lxml/etree.pyx":1090
 *         moveNodeToDocument(self._doc, c_node.doc, c_node)
 * 
 *     def replace(self, _Element old_element not None,             # <<<<<<<<<<<<<<
 *                 _Element new_element not None):
 *         """replace(self, old_element, new_element)
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_29replace, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Element_replace, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[58])); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1090, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element, __pyx_mstate_global->__pyx_n_u_replace, __pyx_t_11) < (0)) __PYX_ERR(0, 1090, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "lxml/etree.pyx":1342
 *         return ElementChildIterator(self)
 * 
 *     def __reversed__(self):             # <<<<<<<<<<<<<<
 *         "__reversed__(self)"
 *         return ElementChildIterator(self, reversed=True)
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_43__reversed__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Element___reversed, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[59])); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1342, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element, __pyx_mstate_global->__pyx_n_u_reversed_2, __pyx_t_11) < (0)) __PYX_ERR(0, 1342, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "lxml/etree.pyx":1346
 *         return ElementChildIterator(self, reversed=True)
 * 
 *     def index(self, child: _Element, start: int = None, stop: int = None):             # <<<<<<<<<<<<<<
 *         """index(self, child, start=None, stop=None)
 * 
*/
  __pyx_t_11 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1346, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  if (PyDict_SetItem(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_child, __pyx_mstate_global->__pyx_n_u_Element_3) < (0)) __PYX_ERR(0, 1346, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_start, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 1346, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_stop, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 1346, __pyx_L1_error)
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_45index, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Element_index, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[60])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1346, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_mstate_global->__pyx_tuple[21]);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_5, __pyx_t_11);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element, __pyx_mstate_global->__pyx_n_u_index, __pyx_t_5) < (0)) __PYX_ERR(0, 1346, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "lxml/etree.pyx":1433
 *             raise ValueError, "list.index(x): x not in list"
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         """get(self, key, default=None)
 * 
*/
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_47get, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Element_get, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[61])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1433, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_mstate_global->__pyx_tuple[22]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element, __pyx_mstate_global->__pyx_n_u_get, __pyx_t_5) < (0)) __PYX_ERR(0, 1433, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "lxml/etree.pyx":1441
 *         return _getAttributeValue(self, key, default)
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """keys(self)
 * 
*/
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_49keys, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Element_keys, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[62])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1441, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element, __pyx_mstate_global->__pyx_n_u_keys, __pyx_t_5) < (0)) __PYX_ERR(0, 1441, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "lxml/etree.pyx":1450
 *         return _collectAttributes(self._c_node, 1)
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         """values(self)
 * 
*/
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_51values, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Element_values, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[63])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1450, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element, __pyx_mstate_global->__pyx_n_u_values, __pyx_t_5) < (0)) __PYX_ERR(0, 1450, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "lxml/etree.pyx":1459
 *         return _collectAttributes(self._c_node, 2)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """items(self)
 * 
*/
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_53items, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Element_items, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[64])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1459, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element, __pyx_mstate_global->__pyx_n_u_items, __pyx_t_5) < (0)) __PYX_ERR(0, 1459, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "lxml/etree.pyx":1468
 *         return _collectAttributes(self._c_node, 3)
 * 
 *     def getchildren(self):             # <<<<<<<<<<<<<<
 *         """getchildren(self)
 * 
*/
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_55getchildren, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Element_getchildren, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[65])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1468, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element, __pyx_mstate_global->__pyx_n_u_getchildren, __pyx_t_5) < (0)) __PYX_ERR(0, 1468, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "lxml/etree.pyx":1481
 *         return _collectChildren(self)
 * 
 *     def getparent(self):             # <<<<<<<<<<<<<<
 *         """getparent(self)
 * 
*/
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_57getparent, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Element_getparent, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[66])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1481, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element, __pyx_mstate_global->__pyx_n_u_getparent, __pyx_t_5) < (0)) __PYX_ERR(0, 1481, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "lxml/etree.pyx":1493
 *         return _elementFactory(self._doc, c_node)
 * 
 *     def getnext(self):             # <<<<<<<<<<<<<<
 *         """getnext(self)
 * 
*/
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_59getnext, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Element_getnext, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[67])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1493, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element, __pyx_mstate_global->__pyx_n_u_getnext, __pyx_t_5) < (0)) __PYX_ERR(0, 1493, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "lxml/etree.pyx":1505
 *         return _elementFactory(self._doc, c_node)
 * 
 *     def getprevious(self):             # <<<<<<<<<<<<<<
 *         """getprevious(self)
 * 
*/
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_61getprevious, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Element_getprevious, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[68])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1505, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element, __pyx_mstate_global->__pyx_n_u_getprevious, __pyx_t_5) < (0)) __PYX_ERR(0, 1505, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "lxml/etree.pyx":1517
 *         return _elementFactory(self._doc, c_node)
 * 
 *     def itersiblings(self, tag=None, *tags, preceding=False):             # <<<<<<<<<<<<<<
 *         """itersiblings(self, tag=None, *tags, preceding=False)
 * 
*/
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1517, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_preceding, Py_False) < (0)) __PYX_ERR(0, 1517, __pyx_L1_error)
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_63itersiblings, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Element_itersiblings, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[69])); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1517, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_11, __pyx_mstate_global->__pyx_tuple[22]);
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_11, __pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element, __pyx_mstate_global->__pyx_n_u_itersiblings, __pyx_t_11) < (0)) __PYX_ERR(0, 1517, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "lxml/etree.pyx":1540
 *         return SiblingsIterator(self, tags, preceding=preceding)
 * 
 *     def iterancestors(self, tag=None, *tags):             # <<<<<<<<<<<<<<
 *         """iterancestors(self, tag=None, *tags)
 * 
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_65iterancestors, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Element_iterancestors, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[70])); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1540, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_11, __pyx_mstate_global->__pyx_tuple[22]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element, __pyx_mstate_global->__pyx_n_u_iterancestors, __pyx_t_11) < (0)) __PYX_ERR(0, 1540, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "lxml/etree.pyx":1554
 *         return AncestorsIterator(self, tags)
 * 
 *     def iterdescendants(self, tag=None, *tags):             # <<<<<<<<<<<<<<
 *         """iterdescendants(self, tag=None, *tags)
 * 
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_67iterdescendants, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Element_iterdescendants, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[71])); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1554, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_11, __pyx_mstate_global->__pyx_tuple[22]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element, __pyx_mstate_global->__pyx_n_u_iterdescendants, __pyx_t_11) < (0)) __PYX_ERR(0, 1554, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "lxml/etree.pyx":1569
 *         return ElementDepthFirstIterator(self, tags, inclusive=False)
 * 
 *     def iterchildren(self, tag=None, *tags, reversed=False):             # <<<<<<<<<<<<<<
 *         """iterchildren(self, tag=None, *tags, reversed=False)
 * 
*/
  __pyx_t_11 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1569, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  if (PyDict_SetItem(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_reversed, Py_False) < (0)) __PYX_ERR(0, 1569, __pyx_L1_error)
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_69iterchildren, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Element_iterchildren, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[72])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1569, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_mstate_global->__pyx_tuple[22]);
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_5, __pyx_t_11);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element, __pyx_mstate_global->__pyx_n_u_iterchildren, __pyx_t_5) < (0)) __PYX_ERR(0, 1569, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "lxml/etree.pyx":1584
 *         return ElementChildIterator(self, tags, reversed=reversed)
 * 
 *     def getroottree(self):             # <<<<<<<<<<<<<<
 *         """getroottree(self)
 * 
*/
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_71getroottree, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Element_getroottree, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[73])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1584, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element, __pyx_mstate_global->__pyx_n_u_getroottree, __pyx_t_5) < (0)) __PYX_ERR(0, 1584, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "lxml/etree.pyx":1596
 *         return _elementTreeFactory(self._doc, None)
 * 
 *     def getiterator(self, tag=None, *tags):             # <<<<<<<<<<<<<<
 *         """getiterator(self, tag=None, *tags)
 * 
*/
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_73getiterator, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Element_getiterator, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[74])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1596, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_mstate_global->__pyx_tuple[22]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element, __pyx_mstate_global->__pyx_n_u_getiterator, __pyx_t_5) < (0)) __PYX_ERR(0, 1596, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "lxml/etree.pyx":1618
 *         return ElementDepthFirstIterator(self, tags)
 * 
 *     def iter(self, tag=None, *tags):             # <<<<<<<<<<<<<<
 *         """iter(self, tag=None, *tags)
 * 
*/
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_75iter, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Element_iter, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[75])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1618, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_mstate_global->__pyx_tuple[22]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element, __pyx_mstate_global->__pyx_n_u_iter, __pyx_t_5) < (0)) __PYX_ERR(0, 1618, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "lxml/etree.pyx":1642
 *         return ElementDepthFirstIterator(self, tags)
 * 
 *     def itertext(self, tag=None, *tags, with_tail=True):             # <<<<<<<<<<<<<<
 *         """itertext(self, tag=None, *tags, with_tail=True)
 * 
*/
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1642, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_with_tail, Py_True) < (0)) __PYX_ERR(0, 1642, __pyx_L1_error)
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_77itertext, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Element_itertext, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[76])); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1642, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_11, __pyx_mstate_global->__pyx_tuple[22]);
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_11, __pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element, __pyx_mstate_global->__pyx_n_u_itertext, __pyx_t_11) < (0)) __PYX_ERR(0, 1642, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "lxml/etree.pyx":1657
 *         return ElementTextIterator(self, tags, with_tail=with_tail)
 * 
 *     def makeelement(self, _tag, attrib=None, nsmap=None, **_extra):             # <<<<<<<<<<<<<<
 *         """makeelement(self, _tag, attrib=None, nsmap=None, **_extra)
 * 
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_79makeelement, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Element_makeelement, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[77])); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1657, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_11, __pyx_mstate_global->__pyx_tuple[21]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element, __pyx_mstate_global->__pyx_n_u_makeelement, __pyx_t_11) < (0)) __PYX_ERR(0, 1657, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "lxml/etree.pyx":1666
 *                             attrib, nsmap, _extra)
 * 
 *     def find(self, path, namespaces=None):             # <<<<<<<<<<<<<<
 *         """find(self, path, namespaces=None)
 * 
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_81find, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Element_find, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[78])); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1666, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_11, __pyx_mstate_global->__pyx_tuple[22]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element, __pyx_mstate_global->__pyx_n_u_find, __pyx_t_11) < (0)) __PYX_ERR(0, 1666, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "lxml/etree.pyx":1679
 *         return _elementpath.find(self, path, namespaces, with_prefixes=not _isHtmlDocument(self))
 * 
 *     def findtext(self, path, default=None, namespaces=None):             # <<<<<<<<<<<<<<
 *         """findtext(self, path, default=None, namespaces=None)
 * 
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_83findtext, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Element_findtext, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[79])); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1679, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_11, __pyx_mstate_global->__pyx_tuple[21]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element, __pyx_mstate_global->__pyx_n_u_findtext, __pyx_t_11) < (0)) __PYX_ERR(0, 1679, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "lxml/etree.pyx":1692
 *         return _elementpath.findtext(self, path, default, namespaces, with_prefixes=not _isHtmlDocument(self))
 * 
 *     def findall(self, path, namespaces=None):             # <<<<<<<<<<<<<<
 *         """findall(self, path, namespaces=None)
 * 
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_85findall, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Element_findall, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[80])); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1692, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_11, __pyx_mstate_global->__pyx_tuple[22]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element, __pyx_mstate_global->__pyx_n_u_findall, __pyx_t_11) < (0)) __PYX_ERR(0, 1692, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "lxml/etree.pyx":1705
 *         return _elementpath.findall(self, path, namespaces, with_prefixes=not _isHtmlDocument(self))
 * 
 *     def iterfind(self, path, namespaces=None):             # <<<<<<<<<<<<<<
 *         """iterfind(self, path, namespaces=None)
 * 
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_87iterfind, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Element_iterfind, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[81])); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1705, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_11, __pyx_mstate_global->__pyx_tuple[22]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element, __pyx_mstate_global->__pyx_n_u_iterfind, __pyx_t_11) < (0)) __PYX_ERR(0, 1705, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "lxml/etree.pyx":1718
 *         return _elementpath.iterfind(self, path, namespaces, with_prefixes=not _isHtmlDocument(self))
 * 
 *     def xpath(self, _path, *, namespaces=None, extensions=None,             # <<<<<<<<<<<<<<
 *               smart_strings=True, **_variables):
 *         """xpath(self, _path, namespaces=None, extensions=None, smart_strings=True, **_variables)
*/
  __pyx_t_11 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1718, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  if (PyDict_SetItem(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_namespaces, Py_None) < (0)) __PYX_ERR(0, 1718, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_extensions, Py_None) < (0)) __PYX_ERR(0, 1718, __pyx_L1_error)

  /* "lxml/etree.pyx":1719
 * 
 *     def xpath(self, _path, *, namespaces=None, extensions=None,
 *               smart_strings=True, **_variables):             # <<<<<<<<<<<<<<
 *         """xpath(self, _path, namespaces=None, extensions=None, smart_strings=True, **_variables)
 * 
*/
  if (PyDict_SetItem(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_smart_strings, Py_True) < (0)) __PYX_ERR(0, 1718, __pyx_L1_error)

  /* "lxml/etree.pyx":1718
 *         return _elementpath.iterfind(self, path, namespaces, with_prefixes=not _isHtmlDocument(self))
 * 
 *     def xpath(self, _path, *, namespaces=None, extensions=None,             # <<<<<<<<<<<<<<
 *               smart_strings=True, **_variables):
 *         """xpath(self, _path, namespaces=None, extensions=None, smart_strings=True, **_variables)
*/
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_89xpath, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Element_xpath, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[82])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1718, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5);
  #endif
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_5, __pyx_t_11);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element, __pyx_mstate_global->__pyx_n_u_xpath, __pyx_t_5) < (0)) __PYX_ERR(0, 1718, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "lxml/etree.pyx":1729
 *         return evaluator(_path, **_variables)
 * 
 *     def cssselect(self, expr, *, translator='xml'):             # <<<<<<<<<<<<<<
 *         """
 *         Run the CSS expression on this element and its children,
*/
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1729, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_translator, __pyx_mstate_global->__pyx_n_u_xml) < (0)) __PYX_ERR(0, 1729, __pyx_L1_error)
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_91cssselect, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Element_cssselect, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[83])); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1729, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_11, __pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element, __pyx_mstate_global->__pyx_n_u_cssselect, __pyx_t_11) < (0)) __PYX_ERR(0, 1729, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "lxml/etree.pyx":1777
 *         raise TypeError, "this element does not have children or attributes"
 * 
 *     def set(self, key, value):             # <<<<<<<<<<<<<<
 *         "set(self, key, value)"
 *         self._raiseImmutable()
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_20__ContentOnlyElement_1set, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ContentOnlyElement_set, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[84])); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1777, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree___ContentOnlyElement, __pyx_mstate_global->__pyx_n_u_set, __pyx_t_11) < (0)) __PYX_ERR(0, 1777, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "lxml/etree.pyx":1781
 *         self._raiseImmutable()
 * 
 *     def append(self, value):             # <<<<<<<<<<<<<<
 *         "append(self, value)"
 *         self._raiseImmutable()
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_20__ContentOnlyElement_3append, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ContentOnlyElement_append, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[85])); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1781, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree___ContentOnlyElement, __pyx_mstate_global->__pyx_n_u_append, __pyx_t_11) < (0)) __PYX_ERR(0, 1781, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "lxml/etree.pyx":1785
 *         self._raiseImmutable()
 * 
 *     def insert(self, index, value):             # <<<<<<<<<<<<<<
 *         "insert(self, index, value)"
 *         self._raiseImmutable()
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_20__ContentOnlyElement_5insert, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ContentOnlyElement_insert, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[86])); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1785, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree___ContentOnlyElement, __pyx_mstate_global->__pyx_n_u_insert, __pyx_t_11) < (0)) __PYX_ERR(0, 1785, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "lxml/etree.pyx":1824
 *         return 0
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         "get(self, key, default=None)"
 *         return None
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_20__ContentOnlyElement_13get, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ContentOnlyElement_get, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[87])); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1824, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_11, __pyx_mstate_global->__pyx_tuple[22]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree___ContentOnlyElement, __pyx_mstate_global->__pyx_n_u_get, __pyx_t_11) < (0)) __PYX_ERR(0, 1824, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "lxml/etree.pyx":1828
 *         return None
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         "keys(self)"
 *         return []
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_20__ContentOnlyElement_15keys, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ContentOnlyElement_keys, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[88])); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1828, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree___ContentOnlyElement, __pyx_mstate_global->__pyx_n_u_keys, __pyx_t_11) < (0)) __PYX_ERR(0, 1828, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "lxml/etree.pyx":1832
 *         return []
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         "items(self)"
 *         return []
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_20__ContentOnlyElement_17items, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ContentOnlyElement_items, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[89])); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1832, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree___ContentOnlyElement, __pyx_mstate_global->__pyx_n_u_items, __pyx_t_11) < (0)) __PYX_ERR(0, 1832, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "lxml/etree.pyx":1836
 *         return []
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         "values(self)"
 *         return []
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_20__ContentOnlyElement_19values, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ContentOnlyElement_values, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[90])); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1836, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree___ContentOnlyElement, __pyx_mstate_global->__pyx_n_u_values, __pyx_t_11) < (0)) __PYX_ERR(0, 1836, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "lxml/etree.pyx":1872
 *             return "<?%s?>" % self.target
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         """get(self, key, default=None)
 * 
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_22_ProcessingInstruction_3get, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ProcessingInstruction_get, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[91])); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1872, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_11, __pyx_mstate_global->__pyx_tuple[22]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ProcessingInstruction, __pyx_mstate_global->__pyx_n_u_get, __pyx_t_11) < (0)) __PYX_ERR(0, 1872, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "lxml/etree.pyx":1896
 *                  for attr, value1, value2 in _FIND_PI_ATTRIBUTES(' ' + self.text) }
 * 
 * cdef object _FIND_PI_ATTRIBUTES = re.compile(r'\s+(\w+)\s*=\s*(?:\'([^\']*)\'|"([^"]*)")', re.U).findall             # <<<<<<<<<<<<<<
 * 
 * cdef class _Entity(__ContentOnlyElement):
*/
  __pyx_t_5 = __pyx_v_4lxml_5etree_re;
  __Pyx_INCREF(__pyx_t_5);
  __pyx_t_24 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree_re, __pyx_mstate_global->__pyx_n_u_U); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 1896, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_s_w_s_s, __pyx_t_24};
    __pyx_t_11 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_compile, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
    if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1896, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
  }
  __pyx_t_24 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_findall); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 1896, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree__FIND_PI_ATTRIBUTES);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__FIND_PI_ATTRIBUTES, __pyx_t_24);
  __Pyx_GIVEREF(__pyx_t_24);
  __pyx_t_24 = 0;

  /* "lxml/etree.pyx":2016
 *         return 0
 * 
 *     def parse(self, source, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *         """parse(self, source, parser=None, base_url=None)
 * 
*/
  __pyx_t_24 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 2016, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  if (PyDict_SetItem(__pyx_t_24, __pyx_mstate_global->__pyx_n_u_base_url, Py_None) < (0)) __PYX_ERR(0, 2016, __pyx_L1_error)
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_12_ElementTree_1parse, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ElementTree_parse, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[92])); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2016, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_11, __pyx_mstate_global->__pyx_tuple[22]);
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_11, __pyx_t_24);
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ElementTree, __pyx_mstate_global->__pyx_n_u_parse, __pyx_t_11) < (0)) __PYX_ERR(0, 2016, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "lxml/etree.pyx":2032
 *         return self._context_node
 * 
 *     def _setroot(self, _Element root not None):             # <<<<<<<<<<<<<<
 *         """_setroot(self, root)
 * 
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_12_ElementTree_3_setroot, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ElementTree__setroot, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[93])); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2032, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ElementTree, __pyx_mstate_global->__pyx_n_u_setroot, __pyx_t_11) < (0)) __PYX_ERR(0, 2032, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "lxml/etree.pyx":2043
 *         self._doc = None
 * 
 *     def getroot(self):             # <<<<<<<<<<<<<<
 *         """getroot(self)
 * 
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_12_ElementTree_5getroot, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ElementTree_getroot, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[94])); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2043, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ElementTree, __pyx_mstate_global->__pyx_n_u_getroot, __pyx_t_11) < (0)) __PYX_ERR(0, 2043, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "lxml/etree.pyx":2050
 *         return self._context_node
 * 
 *     def __copy__(self):             # <<<<<<<<<<<<<<
 *         return _elementTreeFactory(self._doc, self._context_node)
 * 
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_12_ElementTree_7__copy__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ElementTree___copy, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[95])); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2050, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ElementTree, __pyx_mstate_global->__pyx_n_u_copy_2, __pyx_t_11) < (0)) __PYX_ERR(0, 2050, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "lxml/etree.pyx":2053
 *         return _elementTreeFactory(self._doc, self._context_node)
 * 
 *     def __deepcopy__(self, memo):             # <<<<<<<<<<<<<<
 *         cdef _Element root
 *         cdef _Document doc
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_12_ElementTree_9__deepcopy__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ElementTree___deepcopy, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[96])); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2053, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ElementTree, __pyx_mstate_global->__pyx_n_u_deepcopy, __pyx_t_11) < (0)) __PYX_ERR(0, 2053, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "lxml/etree.pyx":2093
 *         return None
 * 
 *     def write(self, file, *, encoding=None, method="xml",             # <<<<<<<<<<<<<<
 *               bint pretty_print=False, xml_declaration=None, bint with_tail=True,
 *               standalone=None, doctype=None, compression=0,
*/
  __pyx_t_11 = __Pyx_PyDict_NewPresized(13); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2093, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  if (PyDict_SetItem(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_encoding, Py_None) < (0)) __PYX_ERR(0, 2093, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_method, __pyx_mstate_global->__pyx_n_u_xml) < (0)) __PYX_ERR(0, 2093, __pyx_L1_error)

  /* "lxml/etree.pyx":2094
 * 
 *     def write(self, file, *, encoding=None, method="xml",
 *               bint pretty_print=False, xml_declaration=None, bint with_tail=True,             # <<<<<<<<<<<<<<
 *               standalone=None, doctype=None, compression=0,
 *               bint exclusive=False, inclusive_ns_prefixes=None,
*/
  if (PyDict_SetItem(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_pretty_print, Py_False) < (0)) __PYX_ERR(0, 2093, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_xml_declaration, Py_None) < (0)) __PYX_ERR(0, 2093, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_with_tail, Py_True) < (0)) __PYX_ERR(0, 2093, __pyx_L1_error)

  /* "lxml/etree.pyx":2095
 *     def write(self, file, *, encoding=None, method="xml",
 *               bint pretty_print=False, xml_declaration=None, bint with_tail=True,
 *               standalone=None, doctype=None, compression=0,             # <<<<<<<<<<<<<<
 *               bint exclusive=False, inclusive_ns_prefixes=None,
 *               bint with_comments=True, bint strip_text=False,
*/
  if (PyDict_SetItem(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_standalone, Py_None) < (0)) __PYX_ERR(0, 2093, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_doctype, Py_None) < (0)) __PYX_ERR(0, 2093, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_compression, __pyx_mstate_global->__pyx_int_0) < (0)) __PYX_ERR(0, 2093, __pyx_L1_error)

  /* "lxml/etree.pyx":2096
 *               bint pretty_print=False, xml_declaration=None, bint with_tail=True,
 *               standalone=None, doctype=None, compression=0,
 *               bint exclusive=False, inclusive_ns_prefixes=None,             # <<<<<<<<<<<<<<
 *               bint with_comments=True, bint strip_text=False,
 *               docstring=None):
*/
  if (PyDict_SetItem(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_exclusive, Py_False) < (0)) __PYX_ERR(0, 2093, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_inclusive_ns_prefixes, Py_None) < (0)) __PYX_ERR(0, 2093, __pyx_L1_error)

  /* "lxml/etree.pyx":2097
 *               standalone=None, doctype=None, compression=0,
 *               bint exclusive=False, inclusive_ns_prefixes=None,
 *               bint with_comments=True, bint strip_text=False,             # <<<<<<<<<<<<<<
 *               docstring=None):
 *         """write(self, file, encoding=None, method="xml",
*/
  if (PyDict_SetItem(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_with_comments, Py_True) < (0)) __PYX_ERR(0, 2093, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_strip_text, Py_False) < (0)) __PYX_ERR(0, 2093, __pyx_L1_error)

  /* "lxml/etree.pyx":2098
 *               bint exclusive=False, inclusive_ns_prefixes=None,
 *               bint with_comments=True, bint strip_text=False,
 *               docstring=None):             # <<<<<<<<<<<<<<
 *         """write(self, file, encoding=None, method="xml",
 *                   pretty_print=False, xml_declaration=None, with_tail=True,
*/
  if (PyDict_SetItem(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_docstring, Py_None) < (0)) __PYX_ERR(0, 2093, __pyx_L1_error)

  /* "lxml/etree.pyx":2093
 *         return None
 * 
 *     def write(self, file, *, encoding=None, method="xml",             # <<<<<<<<<<<<<<
 *               bint pretty_print=False, xml_declaration=None, bint with_tail=True,
 *               standalone=None, doctype=None, compression=0,
*/
  __pyx_t_24 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_12_ElementTree_11write, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ElementTree_write, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[97])); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 2093, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_24);
  #endif
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_24, __pyx_t_11);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ElementTree, __pyx_mstate_global->__pyx_n_u_write, __pyx_t_24) < (0)) __PYX_ERR(0, 2093, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;

  /* "lxml/etree.pyx":2203
 *                     is_standalone, compression)
 * 
 *     def getpath(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         """getpath(self, element)
 * 
*/
  __pyx_t_24 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_12_ElementTree_13getpath, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ElementTree_getpath, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[98])); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 2203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_24);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ElementTree, __pyx_mstate_global->__pyx_n_u_getpath, __pyx_t_24) < (0)) __PYX_ERR(0, 2203, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;

  /* "lxml/etree.pyx":2241
 *         return path
 * 
 *     def getelementpath(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         """getelementpath(self, element)
 * 
*/
  __pyx_t_24 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_12_ElementTree_15getelementpath, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ElementTree_getelementpath, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[99])); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 2241, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_24);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ElementTree, __pyx_mstate_global->__pyx_n_u_getelementpath, __pyx_t_24) < (0)) __PYX_ERR(0, 2241, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;

  /* "lxml/etree.pyx":2305
 *         return '/'.join(path)
 * 
 *     def getiterator(self, tag=None, *tags):             # <<<<<<<<<<<<<<
 *         """getiterator(self, *tags, tag=None)
 * 
*/
  __pyx_t_24 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_12_ElementTree_17getiterator, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ElementTree_getiterator, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[100])); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 2305, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_24);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_24, __pyx_mstate_global->__pyx_tuple[22]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ElementTree, __pyx_mstate_global->__pyx_n_u_getiterator, __pyx_t_24) < (0)) __PYX_ERR(0, 2305, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;

  /* "lxml/etree.pyx":2329
 *         return root.getiterator(*tags)
 * 
 *     def iter(self, tag=None, *tags):             # <<<<<<<<<<<<<<
 *         """iter(self, tag=None, *tags)
 * 
*/
  __pyx_t_24 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_12_ElementTree_19iter, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ElementTree_iter, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[101])); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 2329, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_24);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_24, __pyx_mstate_global->__pyx_tuple[22]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ElementTree, __pyx_mstate_global->__pyx_n_u_iter, __pyx_t_24) < (0)) __PYX_ERR(0, 2329, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;

  /* "lxml/etree.pyx":2347
 *         return root.iter(*tags)
 * 
 *     def find(self, path, namespaces=None):             # <<<<<<<<<<<<<<
 *         """find(self, path, namespaces=None)
 * 
*/
  __pyx_t_24 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_12_ElementTree_21find, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ElementTree_find, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[102])); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 2347, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_24);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_24, __pyx_mstate_global->__pyx_tuple[22]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ElementTree, __pyx_mstate_global->__pyx_n_u_find, __pyx_t_24) < (0)) __PYX_ERR(0, 2347, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;

  /* "lxml/etree.pyx":2371
 *         return root.find(path, namespaces)
 * 
 *     def findtext(self, path, default=None, namespaces=None):             # <<<<<<<<<<<<<<
 *         """findtext(self, path, default=None, namespaces=None)
 * 
*/
  __pyx_t_24 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_12_ElementTree_23findtext, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ElementTree_findtext, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[103])); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 2371, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_24);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_24, __pyx_mstate_global->__pyx_tuple[21]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ElementTree, __pyx_mstate_global->__pyx_n_u_findtext, __pyx_t_24) < (0)) __PYX_ERR(0, 2371, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;

  /* "lxml/etree.pyx":2395
 *         return root.findtext(path, default, namespaces)
 * 
 *     def findall(self, path, namespaces=None):             # <<<<<<<<<<<<<<
 *         """findall(self, path, namespaces=None)
 * 
*/
  __pyx_t_24 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_12_ElementTree_25findall, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ElementTree_findall, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[104])); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 2395, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_24);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_24, __pyx_mstate_global->__pyx_tuple[22]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ElementTree, __pyx_mstate_global->__pyx_n_u_findall, __pyx_t_24) < (0)) __PYX_ERR(0, 2395, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;

  /* "lxml/etree.pyx":2419
 *         return root.findall(path, namespaces)
 * 
 *     def iterfind(self, path, namespaces=None):             # <<<<<<<<<<<<<<
 *         """iterfind(self, path, namespaces=None)
 * 
*/
  __pyx_t_24 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_12_ElementTree_27iterfind, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ElementTree_iterfind, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[105])); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 2419, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_24);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_24, __pyx_mstate_global->__pyx_tuple[22]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ElementTree, __pyx_mstate_global->__pyx_n_u_iterfind, __pyx_t_24) < (0)) __PYX_ERR(0, 2419, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;

  /* "lxml/etree.pyx":2443
 *         return root.iterfind(path, namespaces)
 * 
 *     def xpath(self, _path, *, namespaces=None, extensions=None,             # <<<<<<<<<<<<<<
 *               smart_strings=True, **_variables):
 *         """xpath(self, _path, namespaces=None, extensions=None, smart_strings=True, **_variables)
*/
  __pyx_t_24 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 2443, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  if (PyDict_SetItem(__pyx_t_24, __pyx_mstate_global->__pyx_n_u_namespaces, Py_None) < (0)) __PYX_ERR(0, 2443, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_24, __pyx_mstate_global->__pyx_n_u_extensions, Py_None) < (0)) __PYX_ERR(0, 2443, __pyx_L1_error)

  /* "lxml/etree.pyx":2444
 * 
 *     def xpath(self, _path, *, namespaces=None, extensions=None,
 *               smart_strings=True, **_variables):             # <<<<<<<<<<<<<<
 *         """xpath(self, _path, namespaces=None, extensions=None, smart_strings=True, **_variables)
 * 
*/
  if (PyDict_SetItem(__pyx_t_24, __pyx_mstate_global->__pyx_n_u_smart_strings, Py_True) < (0)) __PYX_ERR(0, 2443, __pyx_L1_error)

  /* "lxml/etree.pyx":2443
 *         return root.iterfind(path, namespaces)
 * 
 *     def xpath(self, _path, *, namespaces=None, extensions=None,             # <<<<<<<<<<<<<<
 *               smart_strings=True, **_variables):
 *         """xpath(self, _path, namespaces=None, extensions=None, smart_strings=True, **_variables)
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_12_ElementTree_29xpath, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ElementTree_xpath, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[106])); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2443, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_11, __pyx_t_24);
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ElementTree, __pyx_mstate_global->__pyx_n_u_xpath, __pyx_t_11) < (0)) __PYX_ERR(0, 2443, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "lxml/etree.pyx":2468
 *         return evaluator(_path, **_variables)
 * 
 *     def xslt(self, _xslt, extensions=None, access_control=None, **_kw):             # <<<<<<<<<<<<<<
 *         """xslt(self, _xslt, extensions=None, access_control=None, **_kw)
 * 
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_12_ElementTree_31xslt, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ElementTree_xslt, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[107])); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2468, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_11, __pyx_mstate_global->__pyx_tuple[21]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ElementTree, __pyx_mstate_global->__pyx_n_u_xslt_3, __pyx_t_11) < (0)) __PYX_ERR(0, 2468, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "lxml/etree.pyx":2487
 *         return style(self, **_kw)
 * 
 *     def relaxng(self, relaxng):             # <<<<<<<<<<<<<<
 *         """relaxng(self, relaxng)
 * 
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_12_ElementTree_33relaxng, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ElementTree_relaxng, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[108])); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2487, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ElementTree, __pyx_mstate_global->__pyx_n_u_relaxng, __pyx_t_11) < (0)) __PYX_ERR(0, 2487, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "lxml/etree.pyx":2505
 *         return schema.validate(self)
 * 
 *     def xmlschema(self, xmlschema):             # <<<<<<<<<<<<<<
 *         """xmlschema(self, xmlschema)
 * 
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_12_ElementTree_35xmlschema, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ElementTree_xmlschema, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[109])); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2505, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ElementTree, __pyx_mstate_global->__pyx_n_u_xmlschema, __pyx_t_11) < (0)) __PYX_ERR(0, 2505, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "lxml/etree.pyx":2523
 *         return schema.validate(self)
 * 
 *     def xinclude(self):             # <<<<<<<<<<<<<<
 *         """xinclude(self)
 * 
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_12_ElementTree_37xinclude, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ElementTree_xinclude, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[110])); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2523, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ElementTree, __pyx_mstate_global->__pyx_n_u_xinclude, __pyx_t_11) < (0)) __PYX_ERR(0, 2523, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "lxml/etree.pyx":2538
 *         XInclude()(self._context_node)
 * 
 *     def write_c14n(self, file, *, bint exclusive=False, bint with_comments=True,             # <<<<<<<<<<<<<<
 *                    compression=0, inclusive_ns_prefixes=None):
 *         """write_c14n(self, file, exclusive=False, with_comments=True,
*/
  __pyx_t_11 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2538, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  if (PyDict_SetItem(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_exclusive, Py_False) < (0)) __PYX_ERR(0, 2538, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_with_comments, Py_True) < (0)) __PYX_ERR(0, 2538, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_compression, __pyx_mstate_global->__pyx_int_0) < (0)) __PYX_ERR(0, 2538, __pyx_L1_error)

  /* "lxml/etree.pyx":2539
 * 
 *     def write_c14n(self, file, *, bint exclusive=False, bint with_comments=True,
 *                    compression=0, inclusive_ns_prefixes=None):             # <<<<<<<<<<<<<<
 *         """write_c14n(self, file, exclusive=False, with_comments=True,
 *                        compression=0, inclusive_ns_prefixes=None)
*/
  if (PyDict_SetItem(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_inclusive_ns_prefixes, Py_None) < (0)) __PYX_ERR(0, 2538, __pyx_L1_error)

  /* "lxml/etree.pyx":2538
 *         XInclude()(self._context_node)
 * 
 *     def write_c14n(self, file, *, bint exclusive=False, bint with_comments=True,             # <<<<<<<<<<<<<<
 *                    compression=0, inclusive_ns_prefixes=None):
 *         """write_c14n(self, file, exclusive=False, with_comments=True,
*/
  __pyx_t_24 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_12_ElementTree_39write_c14n, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ElementTree_write_c14n, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[111])); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 2538, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_24);
  #endif
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_24, __pyx_t_11);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ElementTree, __pyx_mstate_global->__pyx_n_u_write_c14n, __pyx_t_24) < (0)) __PYX_ERR(0, 2538, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;

  /* "lxml/etree.pyx":2605
 *         _delAttribute(self._element, key)
 * 
 *     def update(self, sequence_or_dict):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         if isinstance(sequence_or_dict, (dict, _Attrib)):
*/
  __pyx_t_24 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_7_Attrib_7update, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Attrib_update, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[112])); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 2605, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_24);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Attrib, __pyx_mstate_global->__pyx_n_u_update, __pyx_t_24) < (0)) __PYX_ERR(0, 2605, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;

  /* "lxml/etree.pyx":2612
 *             _setAttributeValue(self._element, key, value)
 * 
 *     def pop(self, key, *default):             # <<<<<<<<<<<<<<
 *         if len(default) > 1:
 *             raise TypeError, f"pop expected at most 2 arguments, got {len(default)+1}"
*/
  __pyx_t_24 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_7_Attrib_9pop, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Attrib_pop, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[113])); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 2612, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_24);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Attrib, __pyx_mstate_global->__pyx_n_u_pop, __pyx_t_24) < (0)) __PYX_ERR(0, 2612, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;

  /* "lxml/etree.pyx":2625
 *         return result
 * 
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         c_attrs = self._element._c_node.properties
*/
  __pyx_t_24 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_7_Attrib_11clear, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Attrib_clear, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[114])); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 2625, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_24);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Attrib, __pyx_mstate_global->__pyx_n_u_clear, __pyx_t_24) < (0)) __PYX_ERR(0, 2625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;

  /* "lxml/etree.pyx":2637
 *         return repr(dict( _collectAttributes(self._element._c_node, 3) ))
 * 
 *     def __copy__(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return dict(_collectAttributes(self._element._c_node, 3))
*/
  __pyx_t_24 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_7_Attrib_15__copy__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Attrib___copy, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[115])); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 2637, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_24);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Attrib, __pyx_mstate_global->__pyx_n_u_copy_2, __pyx_t_24) < (0)) __PYX_ERR(0, 2637, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;

  /* "lxml/etree.pyx":2641
 *         return dict(_collectAttributes(self._element._c_node, 3))
 * 
 *     def __deepcopy__(self, memo):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return dict(_collectAttributes(self._element._c_node, 3))
*/
  __pyx_t_24 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_7_Attrib_17__deepcopy__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Attrib___deepcopy, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[116])); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 2641, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_24);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Attrib, __pyx_mstate_global->__pyx_n_u_deepcopy, __pyx_t_24) < (0)) __PYX_ERR(0, 2641, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;

  /* "lxml/etree.pyx":2671
 *         return c
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return _getAttributeValue(self._element, key, default)
*/
  __pyx_t_24 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_7_Attrib_25get, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Attrib_get, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[117])); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 2671, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_24);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_24, __pyx_mstate_global->__pyx_tuple[22]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Attrib, __pyx_mstate_global->__pyx_n_u_get, __pyx_t_24) < (0)) __PYX_ERR(0, 2671, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;

  /* "lxml/etree.pyx":2675
 *         return _getAttributeValue(self._element, key, default)
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return _collectAttributes(self._element._c_node, 1)
*/
  __pyx_t_24 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_7_Attrib_27keys, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Attrib_keys, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[118])); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 2675, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_24);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Attrib, __pyx_mstate_global->__pyx_n_u_keys, __pyx_t_24) < (0)) __PYX_ERR(0, 2675, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;

  /* "lxml/etree.pyx":2683
 *         return iter(_collectAttributes(self._element._c_node, 1))
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return iter(_collectAttributes(self._element._c_node, 1))
*/
  __pyx_t_24 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_7_Attrib_31iterkeys, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Attrib_iterkeys, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[119])); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 2683, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_24);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Attrib, __pyx_mstate_global->__pyx_n_u_iterkeys, __pyx_t_24) < (0)) __PYX_ERR(0, 2683, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;

  /* "lxml/etree.pyx":2687
 *         return iter(_collectAttributes(self._element._c_node, 1))
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return _collectAttributes(self._element._c_node, 2)
*/
  __pyx_t_24 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_7_Attrib_33values, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Attrib_values, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[120])); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 2687, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_24);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Attrib, __pyx_mstate_global->__pyx_n_u_values, __pyx_t_24) < (0)) __PYX_ERR(0, 2687, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;

  /* "lxml/etree.pyx":2691
 *         return _collectAttributes(self._element._c_node, 2)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return iter(_collectAttributes(self._element._c_node, 2))
*/
  __pyx_t_24 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_7_Attrib_35itervalues, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Attrib_itervalues, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[121])); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 2691, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_24);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Attrib, __pyx_mstate_global->__pyx_n_u_itervalues, __pyx_t_24) < (0)) __PYX_ERR(0, 2691, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;

  /* "lxml/etree.pyx":2695
 *         return iter(_collectAttributes(self._element._c_node, 2))
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return _collectAttributes(self._element._c_node, 3)
*/
  __pyx_t_24 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_7_Attrib_37items, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Attrib_items, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[122])); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 2695, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_24);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Attrib, __pyx_mstate_global->__pyx_n_u_items, __pyx_t_24) < (0)) __PYX_ERR(0, 2695, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;

  /* "lxml/etree.pyx":2699
 *         return _collectAttributes(self._element._c_node, 3)
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return iter(_collectAttributes(self._element._c_node, 3))
*/
  __pyx_t_24 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_7_Attrib_39iteritems, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Attrib_iteritems, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[123])); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 2699, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_24);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Attrib, __pyx_mstate_global->__pyx_n_u_iteritems, __pyx_t_24) < (0)) __PYX_ERR(0, 2699, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;

  /* "lxml/etree.pyx":2703
 *         return iter(_collectAttributes(self._element._c_node, 3))
 * 
 *     def has_key(self, key):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return key in self
*/
  __pyx_t_24 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_7_Attrib_41has_key, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Attrib_has_key, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[124])); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 2703, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_24);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Attrib, __pyx_mstate_global->__pyx_n_u_has_key, __pyx_t_24) < (0)) __PYX_ERR(0, 2703, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;

  /* "lxml/etree.pyx":2724
 *         return python.PyObject_RichCompare(one, other, op)
 * 
 * MutableMapping.register(_Attrib)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_11 = __pyx_v_4lxml_5etree_MutableMapping;
  __Pyx_INCREF(__pyx_t_11);
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_11, ((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Attrib)};
    __pyx_t_24 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_register, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 2724, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_24);
  }
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;

  /* "lxml/etree.pyx":3186
 * # module-level API for ElementTree
 * 
 * from abc import ABC             # <<<<<<<<<<<<<<
 * 
 * class Element(ABC):
*/
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_ABC};
    __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_abc, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3186, __pyx_L1_error)
  }
  __pyx_t_24 = __pyx_t_3;
  __Pyx_GOTREF(__pyx_t_24);
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_ABC};
    __pyx_t_9 = 0; {
      __pyx_t_11 = __Pyx_ImportFrom(__pyx_t_24, __pyx_imported_names[__pyx_t_9]); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 3186, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_9], __pyx_t_11) < (0)) __PYX_ERR(0, 3186, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;

  /* "lxml/etree.pyx":3188
 * from abc import ABC
 * 
 * class Element(ABC):             # <<<<<<<<<<<<<<
 *     """Element(_tag, attrib=None, nsmap=None, **_extra)
 * 
*/
  __Pyx_GetModuleGlobalName(__pyx_t_24, __pyx_mstate_global->__pyx_n_u_ABC); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 3188, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  __pyx_t_11 = PyTuple_Pack(1, __pyx_t_24); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 3188, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
  __pyx_t_24 = __Pyx_PEP560_update_bases(__pyx_t_11); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 3188, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  __pyx_t_5 = __Pyx_CalculateMetaclass(NULL, __pyx_t_24); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3188, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_22 = __Pyx_Py3MetaclassPrepare(__pyx_t_5, __pyx_t_24, __pyx_mstate_global->__pyx_n_u_Element_2, __pyx_mstate_global->__pyx_n_u_Element_2, (PyObject *) NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_kp_u_Element__tag_attrib_None_nsmap_N); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 3188, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  if (__pyx_t_24 != __pyx_t_11) {
    if (unlikely((PyDict_SetItemString(__pyx_t_22, "__orig_bases__", __pyx_t_11) < 0))) __PYX_ERR(0, 3188, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "lxml/etree.pyx":3208
 *     create an Element within a specific document or parser context.
 *     """
 *     def __new__(cls, _tag, attrib=None, nsmap=None, **_extra):             # <<<<<<<<<<<<<<
 *           return _makeElement(_tag, NULL, None, None, None, None,
 *                               attrib, nsmap, _extra)
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_7Element_1__new__, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_mstate_global->__pyx_n_u_Element___new, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[125])); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 3208, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_11, __pyx_mstate_global->__pyx_tuple[21]);
  if (__Pyx_SetNewInClass(__pyx_t_22, __pyx_mstate_global->__pyx_n_u_new, __pyx_t_11) < (0)) __PYX_ERR(0, 3208, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "lxml/etree.pyx":3188
 * from abc import ABC
 * 
 * class Element(ABC):             # <<<<<<<<<<<<<<
 *     """Element(_tag, attrib=None, nsmap=None, **_extra)
 * 
*/
  __pyx_t_11 = __Pyx_Py3ClassCreate(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_Element_2, __pyx_t_24, __pyx_t_22, NULL, 0, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 3188, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_Element_2, __pyx_t_11) < (0)) __PYX_ERR(0, 3188, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;

  /* "lxml/etree.pyx":3213
 * 
 * # Register _Element as a virtual subclass of Element
 * Element.register(_Element)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_5 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_22, __pyx_mstate_global->__pyx_n_u_Element_2); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 3213, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_22, __pyx_mstate_global->__pyx_n_u_register); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 3213, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, ((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element)};
    __pyx_t_24 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_11, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 3213, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_24);
  }
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;

  /* "lxml/etree.pyx":3216
 * 
 * 
 * def Comment(text=None):             # <<<<<<<<<<<<<<
 *     """Comment(text=None)
 * 
*/
  __pyx_t_24 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_7Comment, 0, __pyx_mstate_global->__pyx_n_u_Comment, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[126])); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 3216, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_24);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_24, __pyx_mstate_global->__pyx_tuple[22]);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_Comment, __pyx_t_24) < (0)) __PYX_ERR(0, 3216, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;

  /* "lxml/etree.pyx":3240
 * 
 * 
 * def ProcessingInstruction(target, text=None):             # <<<<<<<<<<<<<<
 *     """ProcessingInstruction(target, text=None)
 * 
*/
  __pyx_t_24 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_9ProcessingInstruction, 0, __pyx_mstate_global->__pyx_n_u_ProcessingInstruction, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[127])); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 3240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_24);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_24, __pyx_mstate_global->__pyx_tuple[22]);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_ProcessingInstruction, __pyx_t_24) < (0)) __PYX_ERR(0, 3240, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;

  /* "lxml/etree.pyx":3268
 *     return _elementFactory(doc, c_node)
 * 
 * PI = ProcessingInstruction             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_GetModuleGlobalName(__pyx_t_24, __pyx_mstate_global->__pyx_n_u_ProcessingInstruction); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 3268, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_PI, __pyx_t_24) < (0)) __PYX_ERR(0, 3268, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;

  /* "lxml/etree.pyx":3290
 * 
 * 
 * def Entity(name):             # <<<<<<<<<<<<<<
 *     """Entity(name)
 * 
*/
  __pyx_t_24 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_11Entity, 0, __pyx_mstate_global->__pyx_n_u_Entity, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[128])); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 3290, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_24);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_Entity, __pyx_t_24) < (0)) __PYX_ERR(0, 3290, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;

  /* "lxml/etree.pyx":3316
 * 
 * 
 * def SubElement(_Element _parent not None, _tag,             # <<<<<<<<<<<<<<
 *                attrib=None, nsmap=None, **_extra):
 *     """SubElement(_parent, _tag, attrib=None, nsmap=None, **_extra)
*/
  __pyx_t_24 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_13SubElement, 0, __pyx_mstate_global->__pyx_n_u_SubElement, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[129])); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 3316, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_24);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_24, __pyx_mstate_global->__pyx_tuple[21]);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_SubElement, __pyx_t_24) < (0)) __PYX_ERR(0, 3316, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;

  /* "lxml/etree.pyx":3325
 *     return _makeSubElement(_parent, _tag, None, None, attrib, nsmap, _extra)
 * 
 * from typing import Generic, TypeVar             # <<<<<<<<<<<<<<
 * 
 * T = TypeVar("T")
*/
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Generic,__pyx_mstate_global->__pyx_n_u_TypeVar};
    __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_typing, __pyx_imported_names, 2, NULL, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3325, __pyx_L1_error)
  }
  __pyx_t_24 = __pyx_t_3;
  __Pyx_GOTREF(__pyx_t_24);
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Generic,__pyx_mstate_global->__pyx_n_u_TypeVar};
    for (__pyx_t_9=0; __pyx_t_9 < 2; __pyx_t_9++) {
      __pyx_t_11 = __Pyx_ImportFrom(__pyx_t_24, __pyx_imported_names[__pyx_t_9]); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 3325, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_9], __pyx_t_11) < (0)) __PYX_ERR(0, 3325, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;

  /* "lxml/etree.pyx":3327
 * from typing import Generic, TypeVar
 * 
 * T = TypeVar("T")             # <<<<<<<<<<<<<<
 * 
 * class ElementTree(ABC, Generic[T]):
*/
  __pyx_t_11 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_TypeVar); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3327, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_mstate_global->__pyx_n_u_T};
    __pyx_t_24 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 3327, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_24);
  }
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_T, __pyx_t_24) < (0)) __PYX_ERR(0, 3327, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;

  /* "lxml/etree.pyx":3329
 * T = TypeVar("T")
 * 
 * class ElementTree(ABC, Generic[T]):             # <<<<<<<<<<<<<<
 *     def __new__(cls, _Element element=None, *, file=None, _BaseParser parser=None):
 *         """ElementTree(element=None, file=None, parser=None)
*/
  __Pyx_GetModuleGlobalName(__pyx_t_24, __pyx_mstate_global->__pyx_n_u_ABC); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 3329, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_Generic); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3329, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_T); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 3329, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_22 = __Pyx_PyObject_GetItem(__pyx_t_5, __pyx_t_11); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 3329, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_11 = PyTuple_Pack(2, __pyx_t_24, __pyx_t_22); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 3329, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
  __pyx_t_22 = __Pyx_PEP560_update_bases(__pyx_t_11); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 3329, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  __pyx_t_24 = __Pyx_CalculateMetaclass(NULL, __pyx_t_22); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 3329, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  __pyx_t_5 = __Pyx_Py3MetaclassPrepare(__pyx_t_24, __pyx_t_22, __pyx_mstate_global->__pyx_n_u_ElementTree, __pyx_mstate_global->__pyx_n_u_ElementTree, (PyObject *) NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, (PyObject *) NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3329, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__pyx_t_22 != __pyx_t_11) {
    if (unlikely((PyDict_SetItemString(__pyx_t_5, "__orig_bases__", __pyx_t_11) < 0))) __PYX_ERR(0, 3329, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "lxml/etree.pyx":3330
 * 
 * class ElementTree(ABC, Generic[T]):
 *     def __new__(cls, _Element element=None, *, file=None, _BaseParser parser=None):             # <<<<<<<<<<<<<<
 *         """ElementTree(element=None, file=None, parser=None)
 * 
*/
  __pyx_t_11 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 3330, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  if (PyDict_SetItem(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_file, Py_None) < (0)) __PYX_ERR(0, 3330, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_parser, Py_None) < (0)) __PYX_ERR(0, 3330, __pyx_L1_error)
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_11ElementTree_1__new__, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_mstate_global->__pyx_n_u_ElementTree___new, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[130])); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 3330, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_23, __pyx_mstate_global->__pyx_tuple[22]);
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_23, __pyx_t_11);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  if (__Pyx_SetNewInClass(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_new, __pyx_t_23) < (0)) __PYX_ERR(0, 3330, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "lxml/etree.pyx":3329
 * T = TypeVar("T")
 * 
 * class ElementTree(ABC, Generic[T]):             # <<<<<<<<<<<<<<
 *     def __new__(cls, _Element element=None, *, file=None, _BaseParser parser=None):
 *         """ElementTree(element=None, file=None, parser=None)
*/
  __pyx_t_23 = __Pyx_Py3ClassCreate(__pyx_t_24, __pyx_mstate_global->__pyx_n_u_ElementTree, __pyx_t_22, __pyx_t_5, NULL, 0, 0); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 3329, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_ElementTree, __pyx_t_23) < (0)) __PYX_ERR(0, 3329, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "lxml/etree.pyx":3356
 * 
 * # Register _ElementTree as a virtual subclass of ElementTree
 * ElementTree.register(_ElementTree)             # <<<<<<<<<<<<<<
 * 
 * # Remove "ABC" and typing helpers from module dict
*/
  __pyx_t_24 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_ElementTree); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3356, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_23 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_register); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 3356, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_24, ((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ElementTree)};
    __pyx_t_22 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_23, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0;
    __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
    if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 3356, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_22);
  }
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "lxml/etree.pyx":3359
 * 
 * # Remove "ABC" and typing helpers from module dict
 * del ABC, Generic, TypeVar, T             # <<<<<<<<<<<<<<
 * 
 * def HTML(text, _BaseParser parser=None, *, base_url=None):
*/
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_mstate_global->__pyx_n_u_ABC) < (0)) __PYX_ERR(0, 3359, __pyx_L1_error)
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_mstate_global->__pyx_n_u_Generic) < (0)) __PYX_ERR(0, 3359, __pyx_L1_error)
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_mstate_global->__pyx_n_u_TypeVar) < (0)) __PYX_ERR(0, 3359, __pyx_L1_error)
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_mstate_global->__pyx_n_u_T) < (0)) __PYX_ERR(0, 3359, __pyx_L1_error)

  /* "lxml/etree.pyx":3361
 * del ABC, Generic, TypeVar, T
 * 
 * def HTML(text, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     """HTML(text, parser=None, base_url=None)
 * 
*/
  __pyx_t_22 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 3361, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  if (PyDict_SetItem(__pyx_t_22, __pyx_mstate_global->__pyx_n_u_base_url, Py_None) < (0)) __PYX_ERR(0, 3361, __pyx_L1_error)
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_15HTML, 0, __pyx_mstate_global->__pyx_n_u_HTML, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[131])); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 3361, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_23, __pyx_mstate_global->__pyx_tuple[22]);
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_23, __pyx_t_22);
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_HTML, __pyx_t_23) < (0)) __PYX_ERR(0, 3361, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "lxml/etree.pyx":3387
 * 
 * 
 * def XML(text, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     """XML(text, parser=None, base_url=None)
 * 
*/
  __pyx_t_23 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 3387, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  if (PyDict_SetItem(__pyx_t_23, __pyx_mstate_global->__pyx_n_u_base_url, Py_None) < (0)) __PYX_ERR(0, 3387, __pyx_L1_error)
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_17XML, 0, __pyx_mstate_global->__pyx_n_u_XML, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[132])); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 3387, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_22, __pyx_mstate_global->__pyx_tuple[22]);
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_22, __pyx_t_23);
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_XML, __pyx_t_22) < (0)) __PYX_ERR(0, 3387, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "lxml/etree.pyx":3418
 * 
 * 
 * def fromstring(text, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     """fromstring(text, parser=None, base_url=None)
 * 
*/
  __pyx_t_22 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 3418, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  if (PyDict_SetItem(__pyx_t_22, __pyx_mstate_global->__pyx_n_u_base_url, Py_None) < (0)) __PYX_ERR(0, 3418, __pyx_L1_error)
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_19fromstring, 0, __pyx_mstate_global->__pyx_n_u_fromstring, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[133])); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 3418, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_23, __pyx_mstate_global->__pyx_tuple[22]);
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_23, __pyx_t_22);
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_fromstring, __pyx_t_23) < (0)) __PYX_ERR(0, 3418, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "lxml/etree.pyx":3439
 * 
 * 
 * def fromstringlist(strings, _BaseParser parser=None):             # <<<<<<<<<<<<<<
 *     """fromstringlist(strings, parser=None)
 * 
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_21fromstringlist, 0, __pyx_mstate_global->__pyx_n_u_fromstringlist, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[134])); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 3439, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_23, __pyx_mstate_global->__pyx_tuple[22]);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_fromstringlist, __pyx_t_23) < (0)) __PYX_ERR(0, 3439, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "lxml/etree.pyx":3460
 * 
 * 
 * def iselement(element):             # <<<<<<<<<<<<<<
 *     """iselement(element)
 * 
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_23iselement, 0, __pyx_mstate_global->__pyx_n_u_iselement, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[135])); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 3460, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_iselement, __pyx_t_23) < (0)) __PYX_ERR(0, 3460, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "lxml/etree.pyx":3468
 * 
 * 
 * def indent(tree, space="  ", *, Py_ssize_t level=0):             # <<<<<<<<<<<<<<
 *     """indent(tree, space="  ", level=0)
 * 
*/
  __pyx_t_23 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 3468, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  __pyx_t_22 = PyLong_FromSsize_t(((Py_ssize_t)0)); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 3468, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  if (PyDict_SetItem(__pyx_t_23, __pyx_mstate_global->__pyx_n_u_level, __pyx_t_22) < (0)) __PYX_ERR(0, 3468, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_25indent, 0, __pyx_mstate_global->__pyx_n_u_indent, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[136])); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 3468, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_22, __pyx_mstate_global->__pyx_tuple[23]);
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_22, __pyx_t_23);
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_indent, __pyx_t_22) < (0)) __PYX_ERR(0, 3468, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "lxml/etree.pyx":3519
 * 
 * 
 * def dump(_Element elem not None, *, bint pretty_print=True, bint with_tail=True):             # <<<<<<<<<<<<<<
 *     """dump(elem, pretty_print=True, with_tail=True)
 * 
*/
  __pyx_t_22 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 3519, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  __pyx_t_23 = __Pyx_PyBool_FromLong(((int)1)); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 3519, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  if (PyDict_SetItem(__pyx_t_22, __pyx_mstate_global->__pyx_n_u_pretty_print, __pyx_t_23) < (0)) __PYX_ERR(0, 3519, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
  __pyx_t_23 = __Pyx_PyBool_FromLong(((int)1)); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 3519, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  if (PyDict_SetItem(__pyx_t_22, __pyx_mstate_global->__pyx_n_u_with_tail, __pyx_t_23) < (0)) __PYX_ERR(0, 3519, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_27dump, 0, __pyx_mstate_global->__pyx_n_u_dump, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[137])); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 3519, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_23, __pyx_t_22);
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_dump, __pyx_t_23) < (0)) __PYX_ERR(0, 3519, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "lxml/etree.pyx":3531
 * 
 * 
 * def tostring(element_or_tree, *, encoding=None, method="xml",             # <<<<<<<<<<<<<<
 *              xml_declaration=None, bint pretty_print=False, bint with_tail=True,
 *              standalone=None, doctype=None,
*/
  __pyx_t_23 = __Pyx_PyDict_NewPresized(11); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 3531, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  if (PyDict_SetItem(__pyx_t_23, __pyx_mstate_global->__pyx_n_u_encoding, Py_None) < (0)) __PYX_ERR(0, 3531, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_23, __pyx_mstate_global->__pyx_n_u_method, ((PyObject*)__pyx_mstate_global->__pyx_n_u_xml)) < (0)) __PYX_ERR(0, 3531, __pyx_L1_error)

  /* "lxml/etree.pyx":3532
 * 
 * def tostring(element_or_tree, *, encoding=None, method="xml",
 *              xml_declaration=None, bint pretty_print=False, bint with_tail=True,             # <<<<<<<<<<<<<<
 *              standalone=None, doctype=None,
 *              # method='c14n'
*/
  if (PyDict_SetItem(__pyx_t_23, __pyx_mstate_global->__pyx_n_u_xml_declaration, Py_None) < (0)) __PYX_ERR(0, 3531, __pyx_L1_error)
  __pyx_t_22 = __Pyx_PyBool_FromLong(((int)0)); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 3532, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  if (PyDict_SetItem(__pyx_t_23, __pyx_mstate_global->__pyx_n_u_pretty_print, __pyx_t_22) < (0)) __PYX_ERR(0, 3531, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
  __pyx_t_22 = __Pyx_PyBool_FromLong(((int)1)); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 3532, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  if (PyDict_SetItem(__pyx_t_23, __pyx_mstate_global->__pyx_n_u_with_tail, __pyx_t_22) < (0)) __PYX_ERR(0, 3531, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "lxml/etree.pyx":3533
 * def tostring(element_or_tree, *, encoding=None, method="xml",
 *              xml_declaration=None, bint pretty_print=False, bint with_tail=True,
 *              standalone=None, doctype=None,             # <<<<<<<<<<<<<<
 *              # method='c14n'
 *              bint exclusive=False, inclusive_ns_prefixes=None,
*/
  if (PyDict_SetItem(__pyx_t_23, __pyx_mstate_global->__pyx_n_u_standalone, Py_None) < (0)) __PYX_ERR(0, 3531, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_23, __pyx_mstate_global->__pyx_n_u_doctype, Py_None) < (0)) __PYX_ERR(0, 3531, __pyx_L1_error)

  /* "lxml/etree.pyx":3535
 *              standalone=None, doctype=None,
 *              # method='c14n'
 *              bint exclusive=False, inclusive_ns_prefixes=None,             # <<<<<<<<<<<<<<
 *              # method='c14n2'
 *              bint with_comments=True, bint strip_text=False,
*/
  __pyx_t_22 = __Pyx_PyBool_FromLong(((int)0)); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 3535, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  if (PyDict_SetItem(__pyx_t_23, __pyx_mstate_global->__pyx_n_u_exclusive, __pyx_t_22) < (0)) __PYX_ERR(0, 3531, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
  if (PyDict_SetItem(__pyx_t_23, __pyx_mstate_global->__pyx_n_u_inclusive_ns_prefixes, Py_None) < (0)) __PYX_ERR(0, 3531, __pyx_L1_error)

  /* "lxml/etree.pyx":3537
 *              bint exclusive=False, inclusive_ns_prefixes=None,
 *              # method='c14n2'
 *              bint with_comments=True, bint strip_text=False,             # <<<<<<<<<<<<<<
 *              ):
 *     """tostring(element_or_tree, encoding=None, method="xml",
*/
  __pyx_t_22 = __Pyx_PyBool_FromLong(((int)1)); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 3537, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  if (PyDict_SetItem(__pyx_t_23, __pyx_mstate_global->__pyx_n_u_with_comments, __pyx_t_22) < (0)) __PYX_ERR(0, 3531, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
  __pyx_t_22 = __Pyx_PyBool_FromLong(((int)0)); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 3537, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  if (PyDict_SetItem(__pyx_t_23, __pyx_mstate_global->__pyx_n_u_strip_text, __pyx_t_22) < (0)) __PYX_ERR(0, 3531, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "lxml/etree.pyx":3531
 * 
 * 
 * def tostring(element_or_tree, *, encoding=None, method="xml",             # <<<<<<<<<<<<<<
 *              xml_declaration=None, bint pretty_print=False, bint with_tail=True,
 *              standalone=None, doctype=None,
*/
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_29tostring, 0, __pyx_mstate_global->__pyx_n_u_tostring, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[138])); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 3531, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_22, __pyx_t_23);
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_tostring, __pyx_t_22) < (0)) __PYX_ERR(0, 3531, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "lxml/etree.pyx":3644
 * 
 * 
 * def tostringlist(element_or_tree, *args, **kwargs):             # <<<<<<<<<<<<<<
 *     """tostringlist(element_or_tree, *args, **kwargs)
 * 
*/
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_31tostringlist, 0, __pyx_mstate_global->__pyx_n_u_tostringlist, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[139])); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 3644, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_tostringlist, __pyx_t_22) < (0)) __PYX_ERR(0, 3644, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "lxml/etree.pyx":3656
 * 
 * 
 * def tounicode(element_or_tree, *, method="xml", bint pretty_print=False,             # <<<<<<<<<<<<<<
 *               bint with_tail=True, doctype=None):
 *     """tounicode(element_or_tree, method="xml", pretty_print=False,
*/
  __pyx_t_22 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 3656, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  if (PyDict_SetItem(__pyx_t_22, __pyx_mstate_global->__pyx_n_u_method, ((PyObject*)__pyx_mstate_global->__pyx_n_u_xml)) < (0)) __PYX_ERR(0, 3656, __pyx_L1_error)
  __pyx_t_23 = __Pyx_PyBool_FromLong(((int)0)); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 3656, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  if (PyDict_SetItem(__pyx_t_22, __pyx_mstate_global->__pyx_n_u_pretty_print, __pyx_t_23) < (0)) __PYX_ERR(0, 3656, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "lxml/etree.pyx":3657
 * 
 * def tounicode(element_or_tree, *, method="xml", bint pretty_print=False,
 *               bint with_tail=True, doctype=None):             # <<<<<<<<<<<<<<
 *     """tounicode(element_or_tree, method="xml", pretty_print=False,
 *                   with_tail=True, doctype=None)
*/
  __pyx_t_23 = __Pyx_PyBool_FromLong(((int)1)); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 3657, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  if (PyDict_SetItem(__pyx_t_22, __pyx_mstate_global->__pyx_n_u_with_tail, __pyx_t_23) < (0)) __PYX_ERR(0, 3656, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
  if (PyDict_SetItem(__pyx_t_22, __pyx_mstate_global->__pyx_n_u_doctype, Py_None) < (0)) __PYX_ERR(0, 3656, __pyx_L1_error)

  /* "lxml/etree.pyx":3656
 * 
 * 
 * def tounicode(element_or_tree, *, method="xml", bint pretty_print=False,             # <<<<<<<<<<<<<<
 *               bint with_tail=True, doctype=None):
 *     """tounicode(element_or_tree, method="xml", pretty_print=False,
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_33tounicode, 0, __pyx_mstate_global->__pyx_n_u_tounicode, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[140])); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 3656, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_23, __pyx_t_22);
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_tounicode, __pyx_t_23) < (0)) __PYX_ERR(0, 3656, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "lxml/etree.pyx":3690
 * 
 * 
 * def parse(source, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     """parse(source, parser=None, base_url=None)
 * 
*/
  __pyx_t_23 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 3690, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  if (PyDict_SetItem(__pyx_t_23, __pyx_mstate_global->__pyx_n_u_base_url, Py_None) < (0)) __PYX_ERR(0, 3690, __pyx_L1_error)
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_35parse, 0, __pyx_mstate_global->__pyx_n_u_parse, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[141])); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 3690, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_22, __pyx_mstate_global->__pyx_tuple[22]);
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_22, __pyx_t_23);
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_parse, __pyx_t_22) < (0)) __PYX_ERR(0, 3690, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "lxml/etree.pyx":3722
 * 
 * 
 * def adopt_external_document(capsule, _BaseParser parser=None):             # <<<<<<<<<<<<<<
 *     """adopt_external_document(capsule, parser=None)
 * 
*/
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_37adopt_external_document, 0, __pyx_mstate_global->__pyx_n_u_adopt_external_document, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[142])); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 3722, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_22, __pyx_mstate_global->__pyx_tuple[22]);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_adopt_external_document, __pyx_t_22) < (0)) __PYX_ERR(0, 3722, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "src/lxml/readonlytree.pxi":160
 *         return c_node != NULL
 * 
 *     def __deepcopy__(self, memo):             # <<<<<<<<<<<<<<
 *         "__deepcopy__(self, memo)"
 *         return self.__copy__()
*/
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_14_ReadOnlyProxy_11__deepcopy__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ReadOnlyProxy___deepcopy, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[143])); if (unlikely(!__pyx_t_22)) __PYX_ERR(9, 160, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ReadOnlyProxy, __pyx_mstate_global->__pyx_n_u_deepcopy, __pyx_t_22) < (0)) __PYX_ERR(9, 160, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "src/lxml/readonlytree.pxi":164
 *         return self.__copy__()
 * 
 *     cpdef __copy__(self):             # <<<<<<<<<<<<<<
 *         "__copy__(self)"
 *         cdef xmlDoc* c_doc
*/
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_14_ReadOnlyProxy_13__copy__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ReadOnlyProxy___copy, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[144])); if (unlikely(!__pyx_t_22)) __PYX_ERR(9, 164, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ReadOnlyProxy, __pyx_mstate_global->__pyx_n_u_copy_2, __pyx_t_22) < (0)) __PYX_ERR(9, 164, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "src/lxml/readonlytree.pxi":187
 *         return iter(self.getchildren())
 * 
 *     def iterchildren(self, tag=None, *, reversed=False):             # <<<<<<<<<<<<<<
 *         """iterchildren(self, tag=None, reversed=False)
 * 
*/
  __pyx_t_22 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_22)) __PYX_ERR(9, 187, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  if (PyDict_SetItem(__pyx_t_22, __pyx_mstate_global->__pyx_n_u_reversed, Py_False) < (0)) __PYX_ERR(9, 187, __pyx_L1_error)
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_14_ReadOnlyProxy_17iterchildren, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ReadOnlyProxy_iterchildren, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[145])); if (unlikely(!__pyx_t_23)) __PYX_ERR(9, 187, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_23, __pyx_mstate_global->__pyx_tuple[22]);
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_23, __pyx_t_22);
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ReadOnlyProxy, __pyx_mstate_global->__pyx_n_u_iterchildren, __pyx_t_23) < (0)) __PYX_ERR(9, 187, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/readonlytree.pxi":199
 *         return iter(children)
 * 
 *     cpdef getchildren(self):             # <<<<<<<<<<<<<<
 *         """Returns all subelements. The elements are returned in document
 *         order.
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_14_ReadOnlyProxy_19getchildren, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ReadOnlyProxy_getchildren, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[146])); if (unlikely(!__pyx_t_23)) __PYX_ERR(9, 199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ReadOnlyProxy, __pyx_mstate_global->__pyx_n_u_getchildren, __pyx_t_23) < (0)) __PYX_ERR(9, 199, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/readonlytree.pxi":214
 *         return result
 * 
 *     def getparent(self):             # <<<<<<<<<<<<<<
 *         """Returns the parent of this element or None for the root element.
 *         """
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_14_ReadOnlyProxy_21getparent, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ReadOnlyProxy_getparent, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[147])); if (unlikely(!__pyx_t_23)) __PYX_ERR(9, 214, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ReadOnlyProxy, __pyx_mstate_global->__pyx_n_u_getparent, __pyx_t_23) < (0)) __PYX_ERR(9, 214, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/readonlytree.pxi":225
 *             return _newReadOnlyProxy(self._source_proxy, c_parent)
 * 
 *     def getnext(self):             # <<<<<<<<<<<<<<
 *         """Returns the following sibling of this element or None.
 *         """
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_14_ReadOnlyProxy_23getnext, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ReadOnlyProxy_getnext, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[148])); if (unlikely(!__pyx_t_23)) __PYX_ERR(9, 225, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ReadOnlyProxy, __pyx_mstate_global->__pyx_n_u_getnext, __pyx_t_23) < (0)) __PYX_ERR(9, 225, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/readonlytree.pxi":235
 *         return None
 * 
 *     def getprevious(self):             # <<<<<<<<<<<<<<
 *         """Returns the preceding sibling of this element or None.
 *         """
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_14_ReadOnlyProxy_25getprevious, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ReadOnlyProxy_getprevious, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[149])); if (unlikely(!__pyx_t_23)) __PYX_ERR(9, 235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ReadOnlyProxy, __pyx_mstate_global->__pyx_n_u_getprevious, __pyx_t_23) < (0)) __PYX_ERR(9, 235, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/readonlytree.pxi":304
 *         return _build_nsmap(self._c_node)
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         """Gets an element attribute.
 *         """
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_21_ReadOnlyElementProxy_1get, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ReadOnlyElementProxy_get, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[150])); if (unlikely(!__pyx_t_23)) __PYX_ERR(9, 304, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_23, __pyx_mstate_global->__pyx_tuple[22]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ReadOnlyElementProxy, __pyx_mstate_global->__pyx_n_u_get, __pyx_t_23) < (0)) __PYX_ERR(9, 304, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/readonlytree.pxi":310
 *         return _getNodeAttributeValue(self._c_node, key, default)
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """Gets a list of attribute names. The names are returned in an
 *         arbitrary order (just like for an ordinary Python dictionary).
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_21_ReadOnlyElementProxy_3keys, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ReadOnlyElementProxy_keys, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[151])); if (unlikely(!__pyx_t_23)) __PYX_ERR(9, 310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ReadOnlyElementProxy, __pyx_mstate_global->__pyx_n_u_keys, __pyx_t_23) < (0)) __PYX_ERR(9, 310, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/readonlytree.pxi":317
 *         return _collectAttributes(self._c_node, 1)
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         """Gets element attributes, as a sequence. The attributes are returned
 *         in an arbitrary order.
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_21_ReadOnlyElementProxy_5values, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ReadOnlyElementProxy_values, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[152])); if (unlikely(!__pyx_t_23)) __PYX_ERR(9, 317, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ReadOnlyElementProxy, __pyx_mstate_global->__pyx_n_u_values, __pyx_t_23) < (0)) __PYX_ERR(9, 317, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/readonlytree.pxi":324
 *         return _collectAttributes(self._c_node, 2)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """Gets element attributes, as a sequence. The attributes are returned
 *         in an arbitrary order.
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_21_ReadOnlyElementProxy_7items, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ReadOnlyElementProxy_items, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[153])); if (unlikely(!__pyx_t_23)) __PYX_ERR(9, 324, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ReadOnlyElementProxy, __pyx_mstate_global->__pyx_n_u_items, __pyx_t_23) < (0)) __PYX_ERR(9, 324, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/readonlytree.pxi":390
 *         return 0
 * 
 *     cpdef append(self, other_element):             # <<<<<<<<<<<<<<
 *         """Append a copy of an Element to the list of children.
 *         """
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_22_OpaqueDocumentWrapper_1append, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_OpaqueDocumentWrapper_append, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[154])); if (unlikely(!__pyx_t_23)) __PYX_ERR(9, 390, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__OpaqueDocumentWrapper, __pyx_mstate_global->__pyx_n_u_append, __pyx_t_23) < (0)) __PYX_ERR(9, 390, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/readonlytree.pxi":407
 *         _moveTail(c_next, c_node)
 * 
 *     def extend(self, elements):             # <<<<<<<<<<<<<<
 *         """Append a copy of all Elements from a sequence to the list of
 *         children.
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_22_OpaqueDocumentWrapper_3extend, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_OpaqueDocumentWrapper_extend, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[155])); if (unlikely(!__pyx_t_23)) __PYX_ERR(9, 407, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__OpaqueDocumentWrapper, __pyx_mstate_global->__pyx_n_u_extend, __pyx_t_23) < (0)) __PYX_ERR(9, 407, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/readonlytree.pxi":487
 *     text content (i.e. everything that adds to the subtree).
 *     """
 *     cpdef append(self, other_element):             # <<<<<<<<<<<<<<
 *         """Append a copy of an Element to the list of children.
 *         """
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_23_AppendOnlyElementProxy_1append, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AppendOnlyElementProxy_append, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[156])); if (unlikely(!__pyx_t_23)) __PYX_ERR(9, 487, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__AppendOnlyElementProxy, __pyx_mstate_global->__pyx_n_u_append, __pyx_t_23) < (0)) __PYX_ERR(9, 487, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/readonlytree.pxi":499
 *         _moveTail(c_next, c_node)
 * 
 *     def extend(self, elements):             # <<<<<<<<<<<<<<
 *         """Append a copy of all Elements from a sequence to the list of
 *         children.
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_23_AppendOnlyElementProxy_3extend, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AppendOnlyElementProxy_extend, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[157])); if (unlikely(!__pyx_t_23)) __PYX_ERR(9, 499, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__AppendOnlyElementProxy, __pyx_mstate_global->__pyx_n_u_extend, __pyx_t_23) < (0)) __PYX_ERR(9, 499, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/classlookup.pxi":248
 *             self._fallback_function = _lookupDefaultElementClass
 * 
 *     def set_fallback(self, ElementClassLookup lookup not None):             # <<<<<<<<<<<<<<
 *         """set_fallback(self, lookup)
 * 
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_26FallbackElementClassLookup_5set_fallback, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_FallbackElementClassLookup_set_f, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[158])); if (unlikely(!__pyx_t_23)) __PYX_ERR(10, 248, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_FallbackElementClassLookup, __pyx_mstate_global->__pyx_n_u_set_fallback, __pyx_t_23) < (0)) __PYX_ERR(10, 248, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/classlookup.pxi":430
 *         self._lookup_function = _custom_class_lookup
 * 
 *     def lookup(self, type, doc, namespace, name):             # <<<<<<<<<<<<<<
 *         "lookup(self, type, doc, namespace, name)"
 *         return None
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_24CustomElementClassLookup_3lookup, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_CustomElementClassLookup_lookup, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[159])); if (unlikely(!__pyx_t_23)) __PYX_ERR(10, 430, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_CustomElementClassLookup, __pyx_mstate_global->__pyx_n_u_lookup, __pyx_t_23) < (0)) __PYX_ERR(10, 430, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/classlookup.pxi":512
 *         self._lookup_function = _python_class_lookup
 * 
 *     def lookup(self, doc, element):             # <<<<<<<<<<<<<<
 *         """lookup(self, doc, element)
 * 
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_24PythonElementClassLookup_3lookup, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_PythonElementClassLookup_lookup, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[160])); if (unlikely(!__pyx_t_23)) __PYX_ERR(10, 512, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_PythonElementClassLookup, __pyx_mstate_global->__pyx_n_u_lookup, __pyx_t_23) < (0)) __PYX_ERR(10, 512, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/classlookup.pxi":549
 *     LOOKUP_ELEMENT_CLASS = function
 * 
 * def set_element_class_lookup(ElementClassLookup lookup = None):             # <<<<<<<<<<<<<<
 *     """set_element_class_lookup(lookup = None)
 * 
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_39set_element_class_lookup, 0, __pyx_mstate_global->__pyx_n_u_set_element_class_lookup, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[161])); if (unlikely(!__pyx_t_23)) __PYX_ERR(10, 549, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_23, __pyx_mstate_global->__pyx_tuple[22]);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_set_element_class_lookup, __pyx_t_23) < (0)) __PYX_ERR(10, 549, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/classlookup.pxi":578
 * # default setup: parser delegation
 * cdef ParserBasedElementClassLookup DEFAULT_ELEMENT_CLASS_LOOKUP
 * DEFAULT_ELEMENT_CLASS_LOOKUP = ParserBasedElementClassLookup()             # <<<<<<<<<<<<<<
 * 
 * set_element_class_lookup(DEFAULT_ELEMENT_CLASS_LOOKUP)
*/
  __pyx_t_22 = NULL;
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_22, NULL};
    __pyx_t_23 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_ParserBasedElementClassLookup, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
    if (unlikely(!__pyx_t_23)) __PYX_ERR(10, 578, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_23);
  }
  __Pyx_XGOTREF((PyObject *)__pyx_v_4lxml_5etree_DEFAULT_ELEMENT_CLASS_LOOKUP);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_DEFAULT_ELEMENT_CLASS_LOOKUP, ((struct __pyx_obj_4lxml_5etree_ParserBasedElementClassLookup *)__pyx_t_23));
  __Pyx_GIVEREF((PyObject *)__pyx_t_23);
  __pyx_t_23 = 0;

  /* "src/lxml/classlookup.pxi":580
 * DEFAULT_ELEMENT_CLASS_LOOKUP = ParserBasedElementClassLookup()
 * 
 * set_element_class_lookup(DEFAULT_ELEMENT_CLASS_LOOKUP)             # <<<<<<<<<<<<<<
*/
  __pyx_t_22 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_24, __pyx_mstate_global->__pyx_n_u_set_element_class_lookup); if (unlikely(!__pyx_t_24)) __PYX_ERR(10, 580, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_22, ((PyObject *)__pyx_v_4lxml_5etree_DEFAULT_ELEMENT_CLASS_LOOKUP)};
    __pyx_t_23 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_24, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
    __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
    if (unlikely(!__pyx_t_23)) __PYX_ERR(10, 580, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_23);
  }
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/nsclasses.pxi":29
 *         self._entries = {}
 * 
 *     def update(self, class_dict_iterable):             # <<<<<<<<<<<<<<
 *         """update(self, class_dict_iterable)
 * 
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_18_NamespaceRegistry_3update, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_NamespaceRegistry_update, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[162])); if (unlikely(!__pyx_t_23)) __PYX_ERR(11, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__NamespaceRegistry, __pyx_mstate_global->__pyx_n_u_update, __pyx_t_23) < (0)) __PYX_ERR(11, 29, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/nsclasses.pxi":74
 *         return iter(self._entries)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         return list(self._entries.items())
 * 
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_18_NamespaceRegistry_11items, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_NamespaceRegistry_items, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[163])); if (unlikely(!__pyx_t_23)) __PYX_ERR(11, 74, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__NamespaceRegistry, __pyx_mstate_global->__pyx_n_u_items, __pyx_t_23) < (0)) __PYX_ERR(11, 74, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/nsclasses.pxi":77
 *         return list(self._entries.items())
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         return iter(self._entries.items())
 * 
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_18_NamespaceRegistry_13iteritems, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_NamespaceRegistry_iteritems, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[164])); if (unlikely(!__pyx_t_23)) __PYX_ERR(11, 77, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__NamespaceRegistry, __pyx_mstate_global->__pyx_n_u_iteritems, __pyx_t_23) < (0)) __PYX_ERR(11, 77, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/nsclasses.pxi":80
 *         return iter(self._entries.items())
 * 
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         self._entries.clear()
 * 
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_18_NamespaceRegistry_15clear, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_NamespaceRegistry_clear, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[165])); if (unlikely(!__pyx_t_23)) __PYX_ERR(11, 80, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__NamespaceRegistry, __pyx_mstate_global->__pyx_n_u_clear, __pyx_t_23) < (0)) __PYX_ERR(11, 80, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/nsclasses.pxi":99
 *         return obj
 * 
 *     def __deco(self, name, obj):             # <<<<<<<<<<<<<<
 *         self[name] = obj
 *         return obj
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_18_NamespaceRegistry_19_NamespaceRegistry__deco, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_NamespaceRegistry___deco, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[166])); if (unlikely(!__pyx_t_23)) __PYX_ERR(11, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__NamespaceRegistry, __pyx_mstate_global->__pyx_n_u_NamespaceRegistry__deco, __pyx_t_23) < (0)) __PYX_ERR(11, 99, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/nsclasses.pxi":147
 *         self._lookup_function = _find_nselement_class
 * 
 *     def get_namespace(self, ns_uri):             # <<<<<<<<<<<<<<
 *         """get_namespace(self, ns_uri)
 * 
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_27ElementNamespaceClassLookup_5get_namespace, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ElementNamespaceClassLookup_get, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[167])); if (unlikely(!__pyx_t_23)) __PYX_ERR(11, 147, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_ElementNamespaceClassLookup, __pyx_mstate_global->__pyx_n_u_get_namespace, __pyx_t_23) < (0)) __PYX_ERR(11, 147, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/nsclasses.pxi":205
 * 
 * cdef dict __FUNCTION_NAMESPACE_REGISTRIES
 * __FUNCTION_NAMESPACE_REGISTRIES = {}             # <<<<<<<<<<<<<<
 * 
 * def FunctionNamespace(ns_uri):
*/
  __pyx_t_23 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_23)) __PYX_ERR(11, 205, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree___FUNCTION_NAMESPACE_REGISTRIES);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree___FUNCTION_NAMESPACE_REGISTRIES, ((PyObject*)__pyx_t_23));
  __Pyx_GIVEREF(__pyx_t_23);
  __pyx_t_23 = 0;

  /* "src/lxml/nsclasses.pxi":207
 * __FUNCTION_NAMESPACE_REGISTRIES = {}
 * 
 * def FunctionNamespace(ns_uri):             # <<<<<<<<<<<<<<
 *     """FunctionNamespace(ns_uri)
 * 
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_41FunctionNamespace, 0, __pyx_mstate_global->__pyx_n_u_FunctionNamespace, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[168])); if (unlikely(!__pyx_t_23)) __PYX_ERR(11, 207, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_FunctionNamespace, __pyx_t_23) < (0)) __PYX_ERR(11, 207, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/docloader.pxi":25
 * cdef class Resolver:
 *     "This is the base class of all resolvers."
 *     def resolve(self, system_url, public_id, context):             # <<<<<<<<<<<<<<
 *         """resolve(self, system_url, public_id, context)
 * 
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8Resolver_1resolve, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Resolver_resolve, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[169])); if (unlikely(!__pyx_t_23)) __PYX_ERR(12, 25, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_Resolver, __pyx_mstate_global->__pyx_n_u_resolve, __pyx_t_23) < (0)) __PYX_ERR(12, 25, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/docloader.pxi":36
 *         return None
 * 
 *     def resolve_empty(self, context):             # <<<<<<<<<<<<<<
 *         """resolve_empty(self, context)
 * 
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8Resolver_3resolve_empty, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Resolver_resolve_empty, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[170])); if (unlikely(!__pyx_t_23)) __PYX_ERR(12, 36, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_Resolver, __pyx_mstate_global->__pyx_n_u_resolve_empty, __pyx_t_23) < (0)) __PYX_ERR(12, 36, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/docloader.pxi":48
 *         return doc_ref
 * 
 *     def resolve_string(self, string, context, *, base_url=None):             # <<<<<<<<<<<<<<
 *         """resolve_string(self, string, context, base_url=None)
 * 
*/
  __pyx_t_23 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_23)) __PYX_ERR(12, 48, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  if (PyDict_SetItem(__pyx_t_23, __pyx_mstate_global->__pyx_n_u_base_url, Py_None) < (0)) __PYX_ERR(12, 48, __pyx_L1_error)
  __pyx_t_24 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8Resolver_5resolve_string, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Resolver_resolve_string, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[171])); if (unlikely(!__pyx_t_24)) __PYX_ERR(12, 48, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_24);
  #endif
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_24, __pyx_t_23);
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_Resolver, __pyx_mstate_global->__pyx_n_u_resolve_string, __pyx_t_24) < (0)) __PYX_ERR(12, 48, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;

  /* "src/lxml/docloader.pxi":69
 *         return doc_ref
 * 
 *     def resolve_filename(self, filename, context):             # <<<<<<<<<<<<<<
 *         """resolve_filename(self, filename, context)
 * 
*/
  __pyx_t_24 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8Resolver_7resolve_filename, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Resolver_resolve_filename, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[172])); if (unlikely(!__pyx_t_24)) __PYX_ERR(12, 69, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_24);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_Resolver, __pyx_mstate_global->__pyx_n_u_resolve_filename, __pyx_t_24) < (0)) __PYX_ERR(12, 69, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;

  /* "src/lxml/docloader.pxi":83
 *         return doc_ref
 * 
 *     def resolve_file(self, f, context, *, base_url=None, bint close=True):             # <<<<<<<<<<<<<<
 *         """resolve_file(self, f, context, base_url=None, close=True)
 * 
*/
  __pyx_t_24 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_24)) __PYX_ERR(12, 83, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  if (PyDict_SetItem(__pyx_t_24, __pyx_mstate_global->__pyx_n_u_base_url, Py_None) < (0)) __PYX_ERR(12, 83, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_24, __pyx_mstate_global->__pyx_n_u_close, Py_True) < (0)) __PYX_ERR(12, 83, __pyx_L1_error)
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8Resolver_9resolve_file, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Resolver_resolve_file, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[173])); if (unlikely(!__pyx_t_23)) __PYX_ERR(12, 83, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_23, __pyx_t_24);
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_Resolver, __pyx_mstate_global->__pyx_n_u_resolve_file, __pyx_t_23) < (0)) __PYX_ERR(12, 83, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/docloader.pxi":120
 *         self._default_resolver = default_resolver
 * 
 *     def add(self, Resolver resolver not None):             # <<<<<<<<<<<<<<
 *         """add(self, resolver)
 * 
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_17_ResolverRegistry_3add, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ResolverRegistry_add, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[174])); if (unlikely(!__pyx_t_23)) __PYX_ERR(12, 120, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ResolverRegistry, __pyx_mstate_global->__pyx_n_u_add, __pyx_t_23) < (0)) __PYX_ERR(12, 120, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/docloader.pxi":133
 *         self._resolvers.add(resolver)
 * 
 *     def remove(self, resolver):             # <<<<<<<<<<<<<<
 *         "remove(self, resolver)"
 *         self._resolvers.discard(resolver)
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_17_ResolverRegistry_5remove, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ResolverRegistry_remove, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[175])); if (unlikely(!__pyx_t_23)) __PYX_ERR(12, 133, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ResolverRegistry, __pyx_mstate_global->__pyx_n_u_remove, __pyx_t_23) < (0)) __PYX_ERR(12, 133, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/docloader.pxi":143
 *         return registry
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         "copy(self)"
 *         return self._copy()
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_17_ResolverRegistry_7copy, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ResolverRegistry_copy, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[176])); if (unlikely(!__pyx_t_23)) __PYX_ERR(12, 143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ResolverRegistry, __pyx_mstate_global->__pyx_n_u_copy, __pyx_t_23) < (0)) __PYX_ERR(12, 143, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/docloader.pxi":147
 *         return self._copy()
 * 
 *     def resolve(self, system_url, public_id, context):             # <<<<<<<<<<<<<<
 *         "resolve(self, system_url, public_id, context)"
 *         for resolver in self._resolvers:
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_17_ResolverRegistry_9resolve, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ResolverRegistry_resolve, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[177])); if (unlikely(!__pyx_t_23)) __PYX_ERR(12, 147, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ResolverRegistry, __pyx_mstate_global->__pyx_n_u_resolve, __pyx_t_23) < (0)) __PYX_ERR(12, 147, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/parser.pxi":7
 * 
 * cdef object _GenericAlias
 * try:             # <<<<<<<<<<<<<<
 *     from types import GenericAlias as _GenericAlias
 * except ImportError:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_1);
    /*try:*/ {

      /* "src/lxml/parser.pxi":8
 * cdef object _GenericAlias
 * try:
 *     from types import GenericAlias as _GenericAlias             # <<<<<<<<<<<<<<
 * except ImportError:
 *     # Python 3.8 - we only need this as return value from "__class_getitem__"
*/
      {
        PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_GenericAlias};
        __pyx_t_26 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_types, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_26)) __PYX_ERR(2, 8, __pyx_L54_error)
      }
      __pyx_t_23 = __pyx_t_26;
      __Pyx_GOTREF(__pyx_t_23);
      {
        PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_GenericAlias};
        __pyx_t_9 = 0; {
          __pyx_t_24 = __Pyx_ImportFrom(__pyx_t_23, __pyx_imported_names[__pyx_t_9]); if (unlikely(!__pyx_t_24)) __PYX_ERR(2, 8, __pyx_L54_error)
          __Pyx_GOTREF(__pyx_t_24);
          switch (__pyx_t_9) {
            case 0:
            __Pyx_INCREF(__pyx_t_24);
            __Pyx_XGOTREF(__pyx_v_4lxml_5etree__GenericAlias);
            __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__GenericAlias, __pyx_t_24);
            __Pyx_GIVEREF(__pyx_t_24);
            break;
            default:;
          }
          __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

      /* "src/lxml/parser.pxi":7
 * 
 * cdef object _GenericAlias
 * try:             # <<<<<<<<<<<<<<
 *     from types import GenericAlias as _GenericAlias
 * except ImportError:
*/
    }
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L59_try_end;
    __pyx_L54_error:;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
    __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
    __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
    __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
    __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
    __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
    __Pyx_XDECREF(__pyx_t_23); __pyx_t_23 = 0;
    __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "src/lxml/parser.pxi":9
 * try:
 *     from types import GenericAlias as _GenericAlias
 * except ImportError:             # <<<<<<<<<<<<<<
 *     # Python 3.8 - we only need this as return value from "__class_getitem__"
 *     def _GenericAlias(cls, item):
*/
    __pyx_t_14 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_ImportError))));
    if (__pyx_t_14) {
      __Pyx_AddTraceback("lxml.etree", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_23, &__pyx_t_24, &__pyx_t_22) < 0) __PYX_ERR(2, 9, __pyx_L56_except_error)
      __Pyx_XGOTREF(__pyx_t_23);
      __Pyx_XGOTREF(__pyx_t_24);
      __Pyx_XGOTREF(__pyx_t_22);

      /* "src/lxml/parser.pxi":11
 * except ImportError:
 *     # Python 3.8 - we only need this as return value from "__class_getitem__"
 *     def _GenericAlias(cls, item):             # <<<<<<<<<<<<<<
 *         return f"{cls.__name__}[{item.__name__}]"
 * 
*/
      __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_43_GenericAlias, 0, __pyx_mstate_global->__pyx_n_u_GenericAlias_2, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[178])); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 11, __pyx_L56_except_error)
      __Pyx_GOTREF(__pyx_t_5);
      #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
      PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5);
      #endif
      __Pyx_XGOTREF(__pyx_v_4lxml_5etree__GenericAlias);
      __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__GenericAlias, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_5);
      __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_23); __pyx_t_23 = 0;
      __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0;
      __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
      goto __pyx_L55_exception_handled;
    }
    goto __pyx_L56_except_error;

    /* "src/lxml/parser.pxi":7
 * 
 * cdef object _GenericAlias
 * try:             # <<<<<<<<<<<<<<
 *     from types import GenericAlias as _GenericAlias
 * except ImportError:
*/
    __pyx_L56_except_error:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1);
    goto __pyx_L1_error;
    __pyx_L55_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1);
    __pyx_L59_try_end:;
  }

  /* "src/lxml/parser.pxi":15
 * 
 * 
 * class ParseError(LxmlSyntaxError):             # <<<<<<<<<<<<<<
 *     """Syntax error while parsing an XML document.
 * 
*/
  __Pyx_GetModuleGlobalName(__pyx_t_22, __pyx_mstate_global->__pyx_n_u_LxmlSyntaxError); if (unlikely(!__pyx_t_22)) __PYX_ERR(2, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  __pyx_t_24 = PyTuple_Pack(1, __pyx_t_22); if (unlikely(!__pyx_t_24)) __PYX_ERR(2, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
  __pyx_t_22 = __Pyx_PEP560_update_bases(__pyx_t_24); if (unlikely(!__pyx_t_22)) __PYX_ERR(2, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  __pyx_t_23 = __Pyx_CalculateMetaclass(NULL, __pyx_t_22); if (unlikely(!__pyx_t_23)) __PYX_ERR(2, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  __pyx_t_5 = __Pyx_Py3MetaclassPrepare(__pyx_t_23, __pyx_t_22, __pyx_mstate_global->__pyx_n_u_ParseError, __pyx_mstate_global->__pyx_n_u_ParseError, (PyObject *) NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_kp_u_Syntax_error_while_parsing_an_XM); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__pyx_t_22 != __pyx_t_24) {
    if (unlikely((PyDict_SetItemString(__pyx_t_5, "__orig_bases__", __pyx_t_24) < 0))) __PYX_ERR(2, 15, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;

  /* "src/lxml/parser.pxi":20
 *     For compatibility with ElementTree 1.3 and later.
 *     """
 *     def __init__(self, message, code, line, column, filename=None):             # <<<<<<<<<<<<<<
 *         super(_ParseError, self).__init__(message)
 *         self.lineno, self.offset = (line, column - 1)
*/
  __pyx_t_24 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_10ParseError_1__init__, 0, __pyx_mstate_global->__pyx_n_u_ParseError___init, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[179])); if (unlikely(!__pyx_t_24)) __PYX_ERR(2, 20, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_24);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_24, __pyx_mstate_global->__pyx_tuple[22]);
  if (__Pyx_SetNameInClass(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_init, __pyx_t_24) < (0)) __PYX_ERR(2, 20, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;

  /* "src/lxml/parser.pxi":26
 *         self.filename = filename
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def position(self):
 *         return self.lineno, self.offset + 1
*/
  __pyx_t_11 = NULL;
  __pyx_t_21 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_10ParseError_3position, 0, __pyx_mstate_global->__pyx_n_u_ParseError_position, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[180])); if (unlikely(!__pyx_t_21)) __PYX_ERR(2, 26, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_21);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_21);
  #endif
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_t_21};
    __pyx_t_24 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_property, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
    if (unlikely(!__pyx_t_24)) __PYX_ERR(2, 26, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_24);
  }
  if (__Pyx_SetNameInClass(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_position, __pyx_t_24) < (0)) __PYX_ERR(2, 26, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;

  /* "src/lxml/parser.pxi":30
 *         return self.lineno, self.offset + 1
 * 
 *     @position.setter             # <<<<<<<<<<<<<<
 *     def position(self, new_pos):
 *         self.lineno, column = new_pos
*/
  __pyx_t_21 = NULL;
  __pyx_t_11 = PyObject_GetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_position);
  if (unlikely(!__pyx_t_11)) {
    PyErr_Clear();
    __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_position);
  }
  if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 30, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_setter); if (unlikely(!__pyx_t_20)) __PYX_ERR(2, 30, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_10ParseError_5position, 0, __pyx_mstate_global->__pyx_n_u_ParseError_position, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[181])); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 30, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_21, __pyx_t_11};
    __pyx_t_24 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_20, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
    if (unlikely(!__pyx_t_24)) __PYX_ERR(2, 30, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_24);
  }
  if (__Pyx_SetNameInClass(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_position, __pyx_t_24) < (0)) __PYX_ERR(2, 30, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;

  /* "src/lxml/parser.pxi":15
 * 
 * 
 * class ParseError(LxmlSyntaxError):             # <<<<<<<<<<<<<<
 *     """Syntax error while parsing an XML document.
 * 
*/
  __pyx_t_24 = __Pyx_Py3ClassCreate(__pyx_t_23, __pyx_mstate_global->__pyx_n_u_ParseError, __pyx_t_22, __pyx_t_5, NULL, 0, 0); if (unlikely(!__pyx_t_24)) __PYX_ERR(2, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_24);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_ParseError, __pyx_t_24) < (0)) __PYX_ERR(2, 15, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "src/lxml/parser.pxi":35
 *         self.offset = column - 1
 * 
 * cdef object _ParseError = ParseError             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_GetModuleGlobalName(__pyx_t_22, __pyx_mstate_global->__pyx_n_u_ParseError); if (unlikely(!__pyx_t_22)) __PYX_ERR(2, 35, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree__ParseError);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__ParseError, __pyx_t_22);
  __Pyx_GIVEREF(__pyx_t_22);
  __pyx_t_22 = 0;

  /* "src/lxml/parser.pxi":38
 * 
 * 
 * class XMLSyntaxError(ParseError):             # <<<<<<<<<<<<<<
 *     """Syntax error while parsing an XML document.
 *     """
*/
  __Pyx_GetModuleGlobalName(__pyx_t_22, __pyx_mstate_global->__pyx_n_u_ParseError); if (unlikely(!__pyx_t_22)) __PYX_ERR(2, 38, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  __pyx_t_23 = PyTuple_Pack(1, __pyx_t_22); if (unlikely(!__pyx_t_23)) __PYX_ERR(2, 38, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
  __pyx_t_22 = __Pyx_PEP560_update_bases(__pyx_t_23); if (unlikely(!__pyx_t_22)) __PYX_ERR(2, 38, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  __pyx_t_5 = __Pyx_CalculateMetaclass(NULL, __pyx_t_22); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 38, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_24 = __Pyx_Py3MetaclassPrepare(__pyx_t_5, __pyx_t_22, __pyx_mstate_global->__pyx_n_u_XMLSyntaxError, __pyx_mstate_global->__pyx_n_u_XMLSyntaxError, (PyObject *) NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_kp_u_Syntax_error_while_parsing_an_XM_2); if (unlikely(!__pyx_t_24)) __PYX_ERR(2, 38, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  if (__pyx_t_22 != __pyx_t_23) {
    if (unlikely((PyDict_SetItemString(__pyx_t_24, "__orig_bases__", __pyx_t_23) < 0))) __PYX_ERR(2, 38, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
  __pyx_t_23 = __Pyx_Py3ClassCreate(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_XMLSyntaxError, __pyx_t_22, __pyx_t_24, NULL, 0, 0); if (unlikely(!__pyx_t_23)) __PYX_ERR(2, 38, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_XMLSyntaxError, __pyx_t_23) < (0)) __PYX_ERR(2, 38, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "src/lxml/parser.pxi":185
 *         context._implied_parser_contexts.pop()
 * 
 * cdef _ParserDictionaryContext __GLOBAL_PARSER_CONTEXT = _ParserDictionaryContext()             # <<<<<<<<<<<<<<
 * __GLOBAL_PARSER_CONTEXT.initMainParserContext()
 * 
*/
  __pyx_t_5 = NULL;
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};
    __pyx_t_22 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ParserDictionaryContext, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_22)) __PYX_ERR(2, 185, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_22);
  }
  __Pyx_XGOTREF((PyObject *)__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, ((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)__pyx_t_22));
  __Pyx_GIVEREF((PyObject *)__pyx_t_22);
  __pyx_t_22 = 0;

  /* "src/lxml/parser.pxi":186
 * 
 * cdef _ParserDictionaryContext __GLOBAL_PARSER_CONTEXT = _ParserDictionaryContext()
 * __GLOBAL_PARSER_CONTEXT.initMainParserContext()             # <<<<<<<<<<<<<<
 * 
 * ############################################################
*/
  __pyx_t_14 = __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initMainParserContext(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(2, 186, __pyx_L1_error)

  /* "src/lxml/parser.pxi":193
 * 
 * # name of Python Py_UNICODE encoding as known to libxml2
 * cdef const_char* _PY_UNICODE_ENCODING = NULL             # <<<<<<<<<<<<<<
 * 
 * cdef int _setupPythonUnicode() except -1:
*/
  __pyx_v_4lxml_5etree__PY_UNICODE_ENCODING = NULL;

  /* "src/lxml/parser.pxi":250
 * 
 * # Python 3.12 removed support for "Py_UNICODE".
 * if python.PY_VERSION_HEX < 0x030C0000:             # <<<<<<<<<<<<<<
 *     _setupPythonUnicode()
 * 
*/
  __pyx_t_8 = (PY_VERSION_HEX < 0x030C0000);
  if (__pyx_t_8) {

    /* "src/lxml/parser.pxi":251
 * # Python 3.12 removed support for "Py_UNICODE".
 * if python.PY_VERSION_HEX < 0x030C0000:
 *     _setupPythonUnicode()             # <<<<<<<<<<<<<<
 * 
 * 
*/
    __pyx_t_14 = __pyx_f_4lxml_5etree__setupPythonUnicode(); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(2, 251, __pyx_L1_error)

    /* "src/lxml/parser.pxi":250
 * 
 * # Python 3.12 removed support for "Py_UNICODE".
 * if python.PY_VERSION_HEX < 0x030C0000:             # <<<<<<<<<<<<<<
 *     _setupPythonUnicode()
 * 
*/
  }

  /* "src/lxml/parser.pxi":281
 *     return encoding_name or None
 * 
 * _pyucs4_encoding_name = _find_PyUCS4EncodingName()             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_22 = __pyx_f_4lxml_5etree__find_PyUCS4EncodingName(); if (unlikely(!__pyx_t_22)) __PYX_ERR(2, 281, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pyucs4_encoding_name, __pyx_t_22) < (0)) __PYX_ERR(2, 281, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "src/lxml/parser.pxi":525
 * 
 * cdef xmlparser.xmlExternalEntityLoader __DEFAULT_ENTITY_LOADER
 * __DEFAULT_ENTITY_LOADER = xmlparser.xmlGetExternalEntityLoader()             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_v_4lxml_5etree___DEFAULT_ENTITY_LOADER = xmlGetExternalEntityLoader();

  /* "src/lxml/parser.pxi":1030
 *         return "libxml2 %d.%d.%d" % LIBXML_VERSION
 * 
 *     def set_element_class_lookup(self, ElementClassLookup lookup = None):             # <<<<<<<<<<<<<<
 *         """set_element_class_lookup(self, lookup = None)
 * 
*/
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_11_BaseParser_3set_element_class_lookup, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_BaseParser_set_element_class_lo, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[182])); if (unlikely(!__pyx_t_22)) __PYX_ERR(2, 1030, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_22, __pyx_mstate_global->__pyx_tuple[22]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__BaseParser, __pyx_mstate_global->__pyx_n_u_set_element_class_lookup, __pyx_t_22) < (0)) __PYX_ERR(2, 1030, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "src/lxml/parser.pxi":1057
 *         return parser
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         """copy(self)
 * 
*/
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_11_BaseParser_5copy, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_BaseParser_copy, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[183])); if (unlikely(!__pyx_t_22)) __PYX_ERR(2, 1057, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__BaseParser, __pyx_mstate_global->__pyx_n_u_copy, __pyx_t_22) < (0)) __PYX_ERR(2, 1057, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "src/lxml/parser.pxi":1064
 *         return self._copy()
 * 
 *     def makeelement(self, _tag, attrib=None, nsmap=None, **_extra):             # <<<<<<<<<<<<<<
 *         """makeelement(self, _tag, attrib=None, nsmap=None, **_extra)
 * 
*/
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_11_BaseParser_7makeelement, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_BaseParser_makeelement, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[184])); if (unlikely(!__pyx_t_22)) __PYX_ERR(2, 1064, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_22, __pyx_mstate_global->__pyx_tuple[21]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__BaseParser, __pyx_mstate_global->__pyx_n_u_makeelement, __pyx_t_22) < (0)) __PYX_ERR(2, 1064, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "src/lxml/parser.pxi":1361
 *         return self._getPushParserContext()._error_log.copy()
 * 
 *     cpdef feed(self, data):             # <<<<<<<<<<<<<<
 *         """feed(self, data)
 * 
*/
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_11_FeedParser_1feed, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_FeedParser_feed, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[185])); if (unlikely(!__pyx_t_22)) __PYX_ERR(2, 1361, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__FeedParser, __pyx_mstate_global->__pyx_n_u_feed, __pyx_t_22) < (0)) __PYX_ERR(2, 1361, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "src/lxml/parser.pxi":1485
 *                 context.cleanup()
 * 
 *     cpdef close(self):             # <<<<<<<<<<<<<<
 *         """close(self)
 * 
*/
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_11_FeedParser_3close, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_FeedParser_close, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[186])); if (unlikely(!__pyx_t_22)) __PYX_ERR(2, 1485, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__FeedParser, __pyx_mstate_global->__pyx_n_u_close, __pyx_t_22) < (0)) __PYX_ERR(2, 1485, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "src/lxml/parser.pxi":1579
 *     xmlparser.XML_PARSE_NOCDATA |
 *     xmlparser.XML_PARSE_NONET   |
 *     xmlparser.XML_PARSE_COMPACT |             # <<<<<<<<<<<<<<
 *     xmlparser.XML_PARSE_BIG_LINES
 * )
*/
  __pyx_v_4lxml_5etree__XML_DEFAULT_PARSE_OPTIONS = ((((XML_PARSE_NOENT | XML_PARSE_NOCDATA) | XML_PARSE_NONET) | XML_PARSE_COMPACT) | XML_PARSE_BIG_LINES);

  /* "src/lxml/parser.pxi":1683
 * 
 *     # Allow subscripting XMLParser in type annotions (PEP 560)
 *     def __class_getitem__(cls, item):             # <<<<<<<<<<<<<<
 *         return _GenericAlias(cls, item)
 * 
*/
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_9XMLParser_3__class_getitem__, __Pyx_CYFUNCTION_CLASSMETHOD | __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_XMLParser___class_getitem, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[187])); if (unlikely(!__pyx_t_22)) __PYX_ERR(2, 1683, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  __pyx_t_5 = __Pyx_Method_ClassMethod(__pyx_t_22); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 1683, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XMLParser, __pyx_mstate_global->__pyx_n_u_class_getitem, __pyx_t_5) < (0)) __PYX_ERR(2, 1683, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "src/lxml/parser.pxi":1712
 *         self._collectEvents(events, tag)
 * 
 *     def read_events(self):             # <<<<<<<<<<<<<<
 *         return (<_SaxParserContext?>self._getPushParserContext()).events_iterator
 * 
*/
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_13XMLPullParser_3read_events, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_XMLPullParser_read_events, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[188])); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 1712, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XMLPullParser, __pyx_mstate_global->__pyx_n_u_read_events, __pyx_t_5) < (0)) __PYX_ERR(2, 1712, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "src/lxml/parser.pxi":1758
 * 
 * # ET 1.2 compatible name
 * XMLTreeBuilder = ETCompatXMLParser             # <<<<<<<<<<<<<<
 * 
 * 
*/
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_XMLTreeBuilder, ((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_ETCompatXMLParser)) < (0)) __PYX_ERR(2, 1758, __pyx_L1_error)

  /* "src/lxml/parser.pxi":1762
 * 
 * cdef XMLParser __DEFAULT_XML_PARSER
 * __DEFAULT_XML_PARSER = XMLParser()             # <<<<<<<<<<<<<<
 * 
 * __GLOBAL_PARSER_CONTEXT.setDefaultParser(__DEFAULT_XML_PARSER)
*/
  __pyx_t_22 = NULL;
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_22, NULL};
    __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XMLParser, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 1762, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_5);
  }
  __Pyx_XGOTREF((PyObject *)__pyx_v_4lxml_5etree___DEFAULT_XML_PARSER);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree___DEFAULT_XML_PARSER, ((struct __pyx_obj_4lxml_5etree_XMLParser *)__pyx_t_5));
  __Pyx_GIVEREF((PyObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "src/lxml/parser.pxi":1764
 * __DEFAULT_XML_PARSER = XMLParser()
 * 
 * __GLOBAL_PARSER_CONTEXT.setDefaultParser(__DEFAULT_XML_PARSER)             # <<<<<<<<<<<<<<
 * 
 * def set_default_parser(_BaseParser parser=None):
*/
  __pyx_t_5 = ((PyObject *)__pyx_v_4lxml_5etree___DEFAULT_XML_PARSER);
  __Pyx_INCREF(__pyx_t_5);
  __pyx_t_14 = __pyx_f_4lxml_5etree_24_ParserDictionaryContext_setDefaultParser(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_5)); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(2, 1764, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "src/lxml/parser.pxi":1766
 * __GLOBAL_PARSER_CONTEXT.setDefaultParser(__DEFAULT_XML_PARSER)
 * 
 * def set_default_parser(_BaseParser parser=None):             # <<<<<<<<<<<<<<
 *     """set_default_parser(parser=None)
 * 
*/
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_45set_default_parser, 0, __pyx_mstate_global->__pyx_n_u_set_default_parser, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[189])); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 1766, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_mstate_global->__pyx_tuple[22]);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_set_default_parser, __pyx_t_5) < (0)) __PYX_ERR(2, 1766, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "src/lxml/parser.pxi":1782
 *     __GLOBAL_PARSER_CONTEXT.setDefaultParser(parser)
 * 
 * def get_default_parser():             # <<<<<<<<<<<<<<
 *     "get_default_parser()"
 *     return __GLOBAL_PARSER_CONTEXT.getDefaultParser()
*/
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_47get_default_parser, 0, __pyx_mstate_global->__pyx_n_u_get_default_parser, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[190])); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 1782, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_get_default_parser, __pyx_t_5) < (0)) __PYX_ERR(2, 1782, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "src/lxml/parser.pxi":1793
 * _HTML_DEFAULT_PARSE_OPTIONS = (
 *     htmlparser.HTML_PARSE_RECOVER |
 *     htmlparser.HTML_PARSE_NONET   |             # <<<<<<<<<<<<<<
 *     htmlparser.HTML_PARSE_COMPACT
 *     )
*/
  __pyx_v_4lxml_5etree__HTML_DEFAULT_PARSE_OPTIONS = ((HTML_PARSE_RECOVER | HTML_PARSE_NONET) | HTML_PARSE_COMPACT);

  /* "src/lxml/parser.pxi":1797
 *     )
 * 
 * cdef object _UNUSED = object()             # <<<<<<<<<<<<<<
 * 
 * cdef class HTMLParser(_FeedParser):
*/
  __pyx_t_22 = NULL;
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_22, NULL};
    __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_object, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 1797, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
  }
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree__UNUSED);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__UNUSED, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_5 = 0;

  /* "src/lxml/parser.pxi":1837
 *     """
 *     def __init__(self, *, encoding=None, remove_blank_text=False,
 *                  remove_comments=False, remove_pis=False, strip_cdata=_UNUSED,             # <<<<<<<<<<<<<<
 *                  no_network=True, decompress=False, target=None, XMLSchema schema=None,
 *                  recover=True, compact=True, default_doctype=True,
*/
  __Pyx_INCREF(__pyx_v_4lxml_5etree__UNUSED);
  __pyx_mstate_global->__pyx_k__30 = __pyx_v_4lxml_5etree__UNUSED;
  __Pyx_GIVEREF(__pyx_v_4lxml_5etree__UNUSED);

  /* "src/lxml/parser.pxi":1868
 * 
 *     # Allow subscripting HTMLParser in type annotions (PEP 560)
 *     def __class_getitem__(cls, item):             # <<<<<<<<<<<<<<
 *         return _GenericAlias(cls, item)
 * 
*/
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_10HTMLParser_3__class_getitem__, __Pyx_CYFUNCTION_CLASSMETHOD | __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_HTMLParser___class_getitem, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[191])); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 1868, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5);
  #endif
  __pyx_t_22 = __Pyx_Method_ClassMethod(__pyx_t_5); if (unlikely(!__pyx_t_22)) __PYX_ERR(2, 1868, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_HTMLParser, __pyx_mstate_global->__pyx_n_u_class_getitem, __pyx_t_22) < (0)) __PYX_ERR(2, 1868, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "src/lxml/parser.pxi":1873
 * 
 * cdef HTMLParser __DEFAULT_HTML_PARSER
 * __DEFAULT_HTML_PARSER = HTMLParser()             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_5 = NULL;
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};
    __pyx_t_22 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_HTMLParser, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_22)) __PYX_ERR(2, 1873, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_22);
  }
  __Pyx_XGOTREF((PyObject *)__pyx_v_4lxml_5etree___DEFAULT_HTML_PARSER);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree___DEFAULT_HTML_PARSER, ((struct __pyx_obj_4lxml_5etree_HTMLParser *)__pyx_t_22));
  __Pyx_GIVEREF((PyObject *)__pyx_t_22);
  __pyx_t_22 = 0;

  /* "src/lxml/parser.pxi":1901
 *         self._collectEvents(events, tag)
 * 
 *     def read_events(self):             # <<<<<<<<<<<<<<
 *         return (<_SaxParserContext?>self._getPushParserContext()).events_iterator
 * 
*/
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_14HTMLPullParser_3read_events, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_HTMLPullParser_read_events, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[192])); if (unlikely(!__pyx_t_22)) __PYX_ERR(2, 1901, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_HTMLPullParser, __pyx_mstate_global->__pyx_n_u_read_events, __pyx_t_22) < (0)) __PYX_ERR(2, 1901, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "src/lxml/saxparser.pxi":3
 * # SAX-like interfaces
 * 
 * class XMLSyntaxAssertionError(XMLSyntaxError, AssertionError):             # <<<<<<<<<<<<<<
 *     """
 *     An XMLSyntaxError that additionally inherits from AssertionError for
*/
  __Pyx_GetModuleGlobalName(__pyx_t_22, __pyx_mstate_global->__pyx_n_u_XMLSyntaxError); if (unlikely(!__pyx_t_22)) __PYX_ERR(5, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  __pyx_t_5 = PyTuple_Pack(2, __pyx_t_22, ((PyObject *)(((PyTypeObject*)PyExc_AssertionError)))); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
  __pyx_t_22 = __Pyx_PEP560_update_bases(__pyx_t_5); if (unlikely(!__pyx_t_22)) __PYX_ERR(5, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  __pyx_t_24 = __Pyx_CalculateMetaclass(NULL, __pyx_t_22); if (unlikely(!__pyx_t_24)) __PYX_ERR(5, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  __pyx_t_23 = __Pyx_Py3MetaclassPrepare(__pyx_t_24, __pyx_t_22, __pyx_mstate_global->__pyx_n_u_XMLSyntaxAssertionError, __pyx_mstate_global->__pyx_n_u_XMLSyntaxAssertionError, (PyObject *) NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_kp_u_An_XMLSyntaxError_that_addition); if (unlikely(!__pyx_t_23)) __PYX_ERR(5, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  if (__pyx_t_22 != __pyx_t_5) {
    if (unlikely((PyDict_SetItemString(__pyx_t_23, "__orig_bases__", __pyx_t_5) < 0))) __PYX_ERR(5, 3, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "src/lxml/saxparser.pxi":10
 *     This class may get replaced by a plain XMLSyntaxError in a future version.
 *     """
 *     def __init__(self, message):             # <<<<<<<<<<<<<<
 *         XMLSyntaxError.__init__(self, message, None, 0, 1)
 * 
*/
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_23XMLSyntaxAssertionError_1__init__, 0, __pyx_mstate_global->__pyx_n_u_XMLSyntaxAssertionError___init, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[193])); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5);
  #endif
  if (__Pyx_SetNameInClass(__pyx_t_23, __pyx_mstate_global->__pyx_n_u_init, __pyx_t_5) < (0)) __PYX_ERR(5, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "src/lxml/saxparser.pxi":3
 * # SAX-like interfaces
 * 
 * class XMLSyntaxAssertionError(XMLSyntaxError, AssertionError):             # <<<<<<<<<<<<<<
 *     """
 *     An XMLSyntaxError that additionally inherits from AssertionError for
*/
  __pyx_t_5 = __Pyx_Py3ClassCreate(__pyx_t_24, __pyx_mstate_global->__pyx_n_u_XMLSyntaxAssertionError, __pyx_t_22, __pyx_t_23, NULL, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_XMLSyntaxAssertionError, __pyx_t_5) < (0)) __PYX_ERR(5, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "src/lxml/saxparser.pxi":821
 *     # Python level event handlers
 * 
 *     def close(self):             # <<<<<<<<<<<<<<
 *         """close(self)
 * 
*/
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_11TreeBuilder_3close, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_TreeBuilder_close, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[194])); if (unlikely(!__pyx_t_22)) __PYX_ERR(5, 821, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_TreeBuilder, __pyx_mstate_global->__pyx_n_u_close, __pyx_t_22) < (0)) __PYX_ERR(5, 821, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "src/lxml/saxparser.pxi":834
 *         return self._last
 * 
 *     def data(self, data):             # <<<<<<<<<<<<<<
 *         """data(self, data)
 * 
*/
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_11TreeBuilder_5data, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_TreeBuilder_data, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[195])); if (unlikely(!__pyx_t_22)) __PYX_ERR(5, 834, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_TreeBuilder, __pyx_mstate_global->__pyx_n_u_data, __pyx_t_22) < (0)) __PYX_ERR(5, 834, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "src/lxml/saxparser.pxi":842
 *         self._handleSaxData(data)
 * 
 *     def start(self, tag, attrs, nsmap=None):             # <<<<<<<<<<<<<<
 *         """start(self, tag, attrs, nsmap=None)
 * 
*/
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_11TreeBuilder_7start, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_TreeBuilder_start, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[196])); if (unlikely(!__pyx_t_22)) __PYX_ERR(5, 842, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_22, __pyx_mstate_global->__pyx_tuple[22]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_TreeBuilder, __pyx_mstate_global->__pyx_n_u_start, __pyx_t_22) < (0)) __PYX_ERR(5, 842, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "src/lxml/saxparser.pxi":851
 *         return self._handleSaxStart(tag, attrs, nsmap)
 * 
 *     def end(self, tag):             # <<<<<<<<<<<<<<
 *         """end(self, tag)
 * 
*/
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_11TreeBuilder_9end, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_TreeBuilder_end, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[197])); if (unlikely(!__pyx_t_22)) __PYX_ERR(5, 851, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_TreeBuilder, __pyx_mstate_global->__pyx_n_u_end, __pyx_t_22) < (0)) __PYX_ERR(5, 851, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "src/lxml/saxparser.pxi":861
 *         return element
 * 
 *     def pi(self, target, data=None):             # <<<<<<<<<<<<<<
 *         """pi(self, target, data=None)
 * 
*/
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_11TreeBuilder_11pi, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_TreeBuilder_pi, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[198])); if (unlikely(!__pyx_t_22)) __PYX_ERR(5, 861, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_22, __pyx_mstate_global->__pyx_tuple[22]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_TreeBuilder, __pyx_mstate_global->__pyx_n_u_pi, __pyx_t_22) < (0)) __PYX_ERR(5, 861, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "src/lxml/saxparser.pxi":869
 *         return self._handleSaxPi(target, data)
 * 
 *     def comment(self, comment):             # <<<<<<<<<<<<<<
 *         """comment(self, comment)
 * 
*/
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_11TreeBuilder_13comment, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_TreeBuilder_comment, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[199])); if (unlikely(!__pyx_t_22)) __PYX_ERR(5, 869, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_TreeBuilder, __pyx_mstate_global->__pyx_n_u_comment, __pyx_t_22) < (0)) __PYX_ERR(5, 869, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "src/lxml/parsertarget.pxi":4
 * 
 * cdef object inspect_getargspec
 * try:             # <<<<<<<<<<<<<<
 *     from inspect import getfullargspec as inspect_getargspec
 * except ImportError:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "src/lxml/parsertarget.pxi":5
 * cdef object inspect_getargspec
 * try:
 *     from inspect import getfullargspec as inspect_getargspec             # <<<<<<<<<<<<<<
 * except ImportError:
 *     from inspect import getargspec as inspect_getargspec
*/
      {
        PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_getfullargspec};
        __pyx_t_26 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_inspect, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_26)) __PYX_ERR(13, 5, __pyx_L63_error)
      }
      __pyx_t_22 = __pyx_t_26;
      __Pyx_GOTREF(__pyx_t_22);
      {
        PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_getfullargspec};
        __pyx_t_9 = 0; {
          __pyx_t_24 = __Pyx_ImportFrom(__pyx_t_22, __pyx_imported_names[__pyx_t_9]); if (unlikely(!__pyx_t_24)) __PYX_ERR(13, 5, __pyx_L63_error)
          __Pyx_GOTREF(__pyx_t_24);
          switch (__pyx_t_9) {
            case 0:
            __Pyx_INCREF(__pyx_t_24);
            __Pyx_XGOTREF(__pyx_v_4lxml_5etree_inspect_getargspec);
            __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_inspect_getargspec, __pyx_t_24);
            __Pyx_GIVEREF(__pyx_t_24);
            break;
            default:;
          }
          __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

      /* "src/lxml/parsertarget.pxi":4
 * 
 * cdef object inspect_getargspec
 * try:             # <<<<<<<<<<<<<<
 *     from inspect import getfullargspec as inspect_getargspec
 * except ImportError:
*/
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L68_try_end;
    __pyx_L63_error:;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
    __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
    __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
    __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
    __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
    __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
    __Pyx_XDECREF(__pyx_t_23); __pyx_t_23 = 0;
    __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "src/lxml/parsertarget.pxi":6
 * try:
 *     from inspect import getfullargspec as inspect_getargspec
 * except ImportError:             # <<<<<<<<<<<<<<
 *     from inspect import getargspec as inspect_getargspec
 * 
*/
    __pyx_t_14 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_ImportError))));
    if (__pyx_t_14) {
      __Pyx_AddTraceback("lxml.etree", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_22, &__pyx_t_24, &__pyx_t_23) < 0) __PYX_ERR(13, 6, __pyx_L65_except_error)
      __Pyx_XGOTREF(__pyx_t_22);
      __Pyx_XGOTREF(__pyx_t_24);
      __Pyx_XGOTREF(__pyx_t_23);

      /* "src/lxml/parsertarget.pxi":7
 *     from inspect import getfullargspec as inspect_getargspec
 * except ImportError:
 *     from inspect import getargspec as inspect_getargspec             # <<<<<<<<<<<<<<
 * 
 * 
*/
      {
        PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_getargspec};
        __pyx_t_26 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_inspect, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_26)) __PYX_ERR(13, 7, __pyx_L65_except_error)
      }
      __pyx_t_5 = __pyx_t_26;
      __Pyx_GOTREF(__pyx_t_5);
      {
        PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_getargspec};
        __pyx_t_9 = 0; {
          __pyx_t_20 = __Pyx_ImportFrom(__pyx_t_5, __pyx_imported_names[__pyx_t_9]); if (unlikely(!__pyx_t_20)) __PYX_ERR(13, 7, __pyx_L65_except_error)
          __Pyx_GOTREF(__pyx_t_20);
          switch (__pyx_t_9) {
            case 0:
            __Pyx_INCREF(__pyx_t_20);
            __Pyx_XGOTREF(__pyx_v_4lxml_5etree_inspect_getargspec);
            __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_inspect_getargspec, __pyx_t_20);
            __Pyx_GIVEREF(__pyx_t_20);
            break;
            default:;
          }
          __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
      __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0;
      __Pyx_XDECREF(__pyx_t_23); __pyx_t_23 = 0;
      goto __pyx_L64_exception_handled;
    }
    goto __pyx_L65_except_error;

    /* "src/lxml/parsertarget.pxi":4
 * 
 * cdef object inspect_getargspec
 * try:             # <<<<<<<<<<<<<<
 *     from inspect import getfullargspec as inspect_getargspec
 * except ImportError:
*/
    __pyx_L65_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L64_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    __pyx_L68_try_end:;
  }

  /* "src/lxml/parsertarget.pxi":10
 * 
 * 
 * class _TargetParserResult(Exception):             # <<<<<<<<<<<<<<
 *     # Admittedly, this is somewhat ugly, but it's the easiest way
 *     # to push the Python level parser result through the parser
*/
  __pyx_t_23 = PyTuple_Pack(1, ((PyObject *)(((PyTypeObject*)PyExc_Exception)))); if (unlikely(!__pyx_t_23)) __PYX_ERR(13, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  __pyx_t_24 = __Pyx_PEP560_update_bases(__pyx_t_23); if (unlikely(!__pyx_t_24)) __PYX_ERR(13, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  __pyx_t_22 = __Pyx_CalculateMetaclass(NULL, __pyx_t_24); if (unlikely(!__pyx_t_22)) __PYX_ERR(13, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  __pyx_t_5 = __Pyx_Py3MetaclassPrepare(__pyx_t_22, __pyx_t_24, __pyx_mstate_global->__pyx_n_u_TargetParserResult, __pyx_mstate_global->__pyx_n_u_TargetParserResult, (PyObject *) NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, (PyObject *) NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(13, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__pyx_t_24 != __pyx_t_23) {
    if (unlikely((PyDict_SetItemString(__pyx_t_5, "__orig_bases__", __pyx_t_23) < 0))) __PYX_ERR(13, 10, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/parsertarget.pxi":14
 *     # to push the Python level parser result through the parser
 *     # machinery towards the API level functions
 *     def __init__(self, result):             # <<<<<<<<<<<<<<
 *         self.result = result
 * 
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_19_TargetParserResult_1__init__, 0, __pyx_mstate_global->__pyx_n_u_TargetParserResult___init, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[200])); if (unlikely(!__pyx_t_23)) __PYX_ERR(13, 14, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  if (__Pyx_SetNameInClass(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_init, __pyx_t_23) < (0)) __PYX_ERR(13, 14, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/parsertarget.pxi":10
 * 
 * 
 * class _TargetParserResult(Exception):             # <<<<<<<<<<<<<<
 *     # Admittedly, this is somewhat ugly, but it's the easiest way
 *     # to push the Python level parser result through the parser
*/
  __pyx_t_23 = __Pyx_Py3ClassCreate(__pyx_t_22, __pyx_mstate_global->__pyx_n_u_TargetParserResult, __pyx_t_24, __pyx_t_5, NULL, 0, 0); if (unlikely(!__pyx_t_23)) __PYX_ERR(13, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_TargetParserResult, __pyx_t_23) < (0)) __PYX_ERR(13, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;

  /* "src/lxml/serializer.pxi":4
 * 
 * cdef object GzipFile
 * from gzip import GzipFile             # <<<<<<<<<<<<<<
 * 
 * 
*/
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_GzipFile};
    __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_gzip, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 4, __pyx_L1_error)
  }
  __pyx_t_24 = __pyx_t_3;
  __Pyx_GOTREF(__pyx_t_24);
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_GzipFile};
    __pyx_t_9 = 0; {
      __pyx_t_22 = __Pyx_ImportFrom(__pyx_t_24, __pyx_imported_names[__pyx_t_9]); if (unlikely(!__pyx_t_22)) __PYX_ERR(6, 4, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_22);
      switch (__pyx_t_9) {
        case 0:
        __Pyx_INCREF(__pyx_t_22);
        __Pyx_XGOTREF(__pyx_v_4lxml_5etree_GzipFile);
        __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_GzipFile, __pyx_t_22);
        __Pyx_GIVEREF(__pyx_t_22);
        break;
        default:;
      }
      __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;

  /* "src/lxml/serializer.pxi":527
 * 
 * cdef object io_open
 * from io import open as io_open             # <<<<<<<<<<<<<<
 * 
 * cdef object gzip
*/
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_open};
    __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_io, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 527, __pyx_L1_error)
  }
  __pyx_t_24 = __pyx_t_3;
  __Pyx_GOTREF(__pyx_t_24);
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_open};
    __pyx_t_9 = 0; {
      __pyx_t_22 = __Pyx_ImportFrom(__pyx_t_24, __pyx_imported_names[__pyx_t_9]); if (unlikely(!__pyx_t_22)) __PYX_ERR(6, 527, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_22);
      switch (__pyx_t_9) {
        case 0:
        __Pyx_INCREF(__pyx_t_22);
        __Pyx_XGOTREF(__pyx_v_4lxml_5etree_io_open);
        __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_io_open, __pyx_t_22);
        __Pyx_GIVEREF(__pyx_t_22);
        break;
        default:;
      }
      __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;

  /* "src/lxml/serializer.pxi":530
 * 
 * cdef object gzip
 * import gzip             # <<<<<<<<<<<<<<
 * 
 * cdef object getwriter
*/
  __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_gzip, 0, 0, NULL, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 530, __pyx_L1_error)
  __pyx_t_24 = __pyx_t_3;
  __Pyx_GOTREF(__pyx_t_24);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree_gzip);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_gzip, __pyx_t_24);
  __Pyx_GIVEREF(__pyx_t_24);
  __pyx_t_24 = 0;

  /* "src/lxml/serializer.pxi":533
 * 
 * cdef object getwriter
 * from codecs import getwriter             # <<<<<<<<<<<<<<
 * cdef object utf8_writer = getwriter('utf8')
 * 
*/
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_getwriter};
    __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_codecs, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 533, __pyx_L1_error)
  }
  __pyx_t_24 = __pyx_t_3;
  __Pyx_GOTREF(__pyx_t_24);
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_getwriter};
    __pyx_t_9 = 0; {
      __pyx_t_22 = __Pyx_ImportFrom(__pyx_t_24, __pyx_imported_names[__pyx_t_9]); if (unlikely(!__pyx_t_22)) __PYX_ERR(6, 533, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_22);
      switch (__pyx_t_9) {
        case 0:
        __Pyx_INCREF(__pyx_t_22);
        __Pyx_XGOTREF(__pyx_v_4lxml_5etree_getwriter);
        __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_getwriter, __pyx_t_22);
        __Pyx_GIVEREF(__pyx_t_22);
        break;
        default:;
      }
      __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;

  /* "src/lxml/serializer.pxi":534
 * cdef object getwriter
 * from codecs import getwriter
 * cdef object utf8_writer = getwriter('utf8')             # <<<<<<<<<<<<<<
 * 
 * cdef object contextmanager
*/
  __pyx_t_22 = NULL;
  __Pyx_INCREF(__pyx_v_4lxml_5etree_getwriter);
  __pyx_t_5 = __pyx_v_4lxml_5etree_getwriter; 
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_22, __pyx_mstate_global->__pyx_n_u_utf8};
    __pyx_t_24 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_24)) __PYX_ERR(6, 534, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_24);
  }
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree_utf8_writer);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_utf8_writer, __pyx_t_24);
  __Pyx_GIVEREF(__pyx_t_24);
  __pyx_t_24 = 0;

  /* "src/lxml/serializer.pxi":537
 * 
 * cdef object contextmanager
 * from contextlib import contextmanager             # <<<<<<<<<<<<<<
 * 
 * cdef object _open_utf8_file
*/
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_contextmanager};
    __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_contextlib, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 537, __pyx_L1_error)
  }
  __pyx_t_24 = __pyx_t_3;
  __Pyx_GOTREF(__pyx_t_24);
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_contextmanager};
    __pyx_t_9 = 0; {
      __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_24, __pyx_imported_names[__pyx_t_9]); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 537, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      switch (__pyx_t_9) {
        case 0:
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_XGOTREF(__pyx_v_4lxml_5etree_contextmanager);
        __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_contextmanager, __pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_5);
        break;
        default:;
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;

  /* "src/lxml/serializer.pxi":541
 * cdef object _open_utf8_file
 * 
 * @contextmanager             # <<<<<<<<<<<<<<
 * def _open_utf8_file(file, compression=0):
 *     file = _getFSPathOrObject(file)
*/
  __pyx_t_5 = NULL;
  __Pyx_INCREF(__pyx_v_4lxml_5etree_contextmanager);
  __pyx_t_22 = __pyx_v_4lxml_5etree_contextmanager; 
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_49_open_utf8_file, 0, __pyx_mstate_global->__pyx_n_u_open_utf8_file, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[0])); if (unlikely(!__pyx_t_23)) __PYX_ERR(6, 541, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_23, __pyx_mstate_global->__pyx_tuple[2]);
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_23};
    __pyx_t_24 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_22, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
    __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
    if (unlikely(!__pyx_t_24)) __PYX_ERR(6, 541, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_24);
  }
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree__open_utf8_file);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__open_utf8_file, __pyx_t_24);
  __Pyx_GIVEREF(__pyx_t_24);
  __pyx_t_24 = 0;

  /* "src/lxml/serializer.pxi":831
 * # C14N 2.0
 * 
 * def canonicalize(xml_data=None, *, out=None, from_file=None, **options):             # <<<<<<<<<<<<<<
 *     """Convert XML to its C14N 2.0 serialised form.
 * 
*/
  __pyx_t_24 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_24)) __PYX_ERR(6, 831, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  if (PyDict_SetItem(__pyx_t_24, __pyx_mstate_global->__pyx_n_u_out, Py_None) < (0)) __PYX_ERR(6, 831, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_24, __pyx_mstate_global->__pyx_n_u_from_file, Py_None) < (0)) __PYX_ERR(6, 831, __pyx_L1_error)
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_52canonicalize, 0, __pyx_mstate_global->__pyx_n_u_canonicalize, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[201])); if (unlikely(!__pyx_t_22)) __PYX_ERR(6, 831, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_22, __pyx_mstate_global->__pyx_tuple[22]);
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_22, __pyx_t_24);
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_canonicalize, __pyx_t_22) < (0)) __PYX_ERR(6, 831, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "src/lxml/serializer.pxi":898
 * 
 * 
 * cdef object _looks_like_prefix_name = re.compile(r'^\w+:\w+$', re.UNICODE).match             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_24 = __pyx_v_4lxml_5etree_re;
  __Pyx_INCREF(__pyx_t_24);
  __pyx_t_23 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree_re, __pyx_mstate_global->__pyx_n_u_UNICODE); if (unlikely(!__pyx_t_23)) __PYX_ERR(6, 898, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_24, __pyx_mstate_global->__pyx_kp_u_w_w, __pyx_t_23};
    __pyx_t_22 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_compile, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0;
    __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
    if (unlikely(!__pyx_t_22)) __PYX_ERR(6, 898, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_22);
  }
  __pyx_t_23 = __Pyx_PyObject_GetAttrStr(__pyx_t_22, __pyx_mstate_global->__pyx_n_u_match); if (unlikely(!__pyx_t_23)) __PYX_ERR(6, 898, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree__looks_like_prefix_name);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__looks_like_prefix_name, __pyx_t_23);
  __Pyx_GIVEREF(__pyx_t_23);
  __pyx_t_23 = 0;

  /* "src/lxml/serializer.pxi":974
 *         self._root_done = False
 * 
 *     def _iter_namespaces(self, ns_stack):             # <<<<<<<<<<<<<<
 *         for namespaces in reversed(ns_stack):
 *             if namespaces:  # almost no element declares new namespaces
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_16C14NWriterTarget_3_iter_namespaces, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_C14NWriterTarget__iter_namespace, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[1])); if (unlikely(!__pyx_t_23)) __PYX_ERR(6, 974, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_C14NWriterTarget, __pyx_mstate_global->__pyx_n_u_iter_namespaces, __pyx_t_23) < (0)) __PYX_ERR(6, 974, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/serializer.pxi":1023
 *         raise ValueError(f'Namespace "{uri}" of name "{tag}" is not declared in scope')
 * 
 *     def data(self, data):             # <<<<<<<<<<<<<<
 *         if not self._ignored_depth:
 *             self._data.append(data)
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_16C14NWriterTarget_6data, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_C14NWriterTarget_data, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[202])); if (unlikely(!__pyx_t_23)) __PYX_ERR(6, 1023, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_C14NWriterTarget, __pyx_mstate_global->__pyx_n_u_data, __pyx_t_23) < (0)) __PYX_ERR(6, 1023, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/serializer.pxi":1041
 *             self._write(_escape_cdata_c14n(data))
 * 
 *     def start_ns(self, prefix, uri):             # <<<<<<<<<<<<<<
 *         if self._ignored_depth:
 *             return
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_16C14NWriterTarget_8start_ns, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_C14NWriterTarget_start_ns, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[203])); if (unlikely(!__pyx_t_23)) __PYX_ERR(6, 1041, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_C14NWriterTarget, __pyx_mstate_global->__pyx_n_u_start_ns_2, __pyx_t_23) < (0)) __PYX_ERR(6, 1041, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/serializer.pxi":1049
 *         self._ns_stack[-1].append((uri, prefix))
 * 
 *     def start(self, tag, attrs):             # <<<<<<<<<<<<<<
 *         if self._exclude_tags is not None and (
 *                 self._ignored_depth or tag in self._exclude_tags):
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_16C14NWriterTarget_10start, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_C14NWriterTarget_start, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[204])); if (unlikely(!__pyx_t_23)) __PYX_ERR(6, 1049, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_C14NWriterTarget, __pyx_mstate_global->__pyx_n_u_start, __pyx_t_23) < (0)) __PYX_ERR(6, 1049, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/serializer.pxi":1134
 *         self._ns_stack.append([])
 * 
 *     def end(self, tag):             # <<<<<<<<<<<<<<
 *         if self._ignored_depth:
 *             self._ignored_depth -= 1
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_16C14NWriterTarget_12end, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_C14NWriterTarget_end, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[205])); if (unlikely(!__pyx_t_23)) __PYX_ERR(6, 1134, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_C14NWriterTarget, __pyx_mstate_global->__pyx_n_u_end, __pyx_t_23) < (0)) __PYX_ERR(6, 1134, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/serializer.pxi":1146
 *         self._ns_stack.pop()
 * 
 *     def comment(self, text):             # <<<<<<<<<<<<<<
 *         if not self._with_comments:
 *             return
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_16C14NWriterTarget_14comment, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_C14NWriterTarget_comment, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[206])); if (unlikely(!__pyx_t_23)) __PYX_ERR(6, 1146, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_C14NWriterTarget, __pyx_mstate_global->__pyx_n_u_comment, __pyx_t_23) < (0)) __PYX_ERR(6, 1146, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/serializer.pxi":1159
 *             self._write('\n')
 * 
 *     def pi(self, target, data):             # <<<<<<<<<<<<<<
 *         if self._ignored_depth:
 *             return
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_16C14NWriterTarget_16pi, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_C14NWriterTarget_pi, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[207])); if (unlikely(!__pyx_t_23)) __PYX_ERR(6, 1159, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_C14NWriterTarget, __pyx_mstate_global->__pyx_n_u_pi, __pyx_t_23) < (0)) __PYX_ERR(6, 1159, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/serializer.pxi":1171
 *             self._write('\n')
 * 
 *     def close(self):             # <<<<<<<<<<<<<<
 *         return None
 * 
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_16C14NWriterTarget_18close, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_C14NWriterTarget_close, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[208])); if (unlikely(!__pyx_t_23)) __PYX_ERR(6, 1171, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_C14NWriterTarget, __pyx_mstate_global->__pyx_n_u_close, __pyx_t_23) < (0)) __PYX_ERR(6, 1171, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/serializer.pxi":1313
 *         self.method = OUTPUT_METHOD_XML
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         assert self.output_file is not None
 *         self.writer = _IncrementalFileWriter(
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_7xmlfile_3__enter__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_xmlfile___enter, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[209])); if (unlikely(!__pyx_t_23)) __PYX_ERR(6, 1313, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_xmlfile, __pyx_mstate_global->__pyx_n_u_enter, __pyx_t_23) < (0)) __PYX_ERR(6, 1313, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/serializer.pxi":1320
 *         return self.writer
 * 
 *     def __exit__(self, exc_type, exc_val, exc_tb):             # <<<<<<<<<<<<<<
 *         if self.writer is not None:
 *             old_writer, self.writer = self.writer, None
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_7xmlfile_5__exit__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_xmlfile___exit, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[210])); if (unlikely(!__pyx_t_23)) __PYX_ERR(6, 1320, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_xmlfile, __pyx_mstate_global->__pyx_n_u_exit, __pyx_t_23) < (0)) __PYX_ERR(6, 1320, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/serializer.pxi":1328
 *                 self.output_file = None
 * 
 *     async def __aenter__(self):             # <<<<<<<<<<<<<<
 *         assert self.output_file is not None
 *         if isinstance(self.output_file, basestring):
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_7xmlfile_7__aenter__, __Pyx_CYFUNCTION_CCLASS | __Pyx_CYFUNCTION_COROUTINE, __pyx_mstate_global->__pyx_n_u_xmlfile___aenter, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[3])); if (unlikely(!__pyx_t_23)) __PYX_ERR(6, 1328, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_xmlfile, __pyx_mstate_global->__pyx_n_u_aenter, __pyx_t_23) < (0)) __PYX_ERR(6, 1328, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/serializer.pxi":1339
 *         return self.async_writer
 * 
 *     async def __aexit__(self, exc_type, exc_val, exc_tb):             # <<<<<<<<<<<<<<
 *         if self.async_writer is not None:
 *             old_writer, self.async_writer = self.async_writer, None
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_7xmlfile_10__aexit__, __Pyx_CYFUNCTION_CCLASS | __Pyx_CYFUNCTION_COROUTINE, __pyx_mstate_global->__pyx_n_u_xmlfile___aexit, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[4])); if (unlikely(!__pyx_t_23)) __PYX_ERR(6, 1339, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_xmlfile, __pyx_mstate_global->__pyx_n_u_aexit, __pyx_t_23) < (0)) __PYX_ERR(6, 1339, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/serializer.pxi":1398
 *             tree.xmlOutputBufferClose(self._c_out)
 * 
 *     def write_declaration(self, version=None, standalone=None, doctype=None):             # <<<<<<<<<<<<<<
 *         """write_declaration(self, version=None, standalone=None, doctype=None)
 * 
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_22_IncrementalFileWriter_5write_declaration, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_IncrementalFileWriter_write_dec, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[211])); if (unlikely(!__pyx_t_23)) __PYX_ERR(6, 1398, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_23, __pyx_mstate_global->__pyx_tuple[3]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__IncrementalFileWriter, __pyx_mstate_global->__pyx_n_u_write_declaration, __pyx_t_23) < (0)) __PYX_ERR(6, 1398, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/serializer.pxi":1427
 *         self._handle_error(self._c_out.error)
 * 
 *     def write_doctype(self, doctype):             # <<<<<<<<<<<<<<
 *         """write_doctype(self, doctype)
 * 
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_22_IncrementalFileWriter_7write_doctype, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_IncrementalFileWriter_write_doc, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[212])); if (unlikely(!__pyx_t_23)) __PYX_ERR(6, 1427, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__IncrementalFileWriter, __pyx_mstate_global->__pyx_n_u_write_doctype, __pyx_t_23) < (0)) __PYX_ERR(6, 1427, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/serializer.pxi":1444
 *         self._handle_error(self._c_out.error)
 * 
 *     def method(self, method):             # <<<<<<<<<<<<<<
 *         """method(self, method)
 * 
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_22_IncrementalFileWriter_9method, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_IncrementalFileWriter_method, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[213])); if (unlikely(!__pyx_t_23)) __PYX_ERR(6, 1444, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__IncrementalFileWriter, __pyx_mstate_global->__pyx_n_u_method, __pyx_t_23) < (0)) __PYX_ERR(6, 1444, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/serializer.pxi":1454
 *         return _MethodChanger(self, c_method)
 * 
 *     def element(self, tag, attrib=None, nsmap=None, method=None, **_extra):             # <<<<<<<<<<<<<<
 *         """element(self, tag, attrib=None, nsmap=None, method, **_extra)
 * 
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_22_IncrementalFileWriter_11element, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_IncrementalFileWriter_element, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[214])); if (unlikely(!__pyx_t_23)) __PYX_ERR(6, 1454, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_23, __pyx_mstate_global->__pyx_tuple[3]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__IncrementalFileWriter, __pyx_mstate_global->__pyx_n_u_element, __pyx_t_23) < (0)) __PYX_ERR(6, 1454, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/serializer.pxi":1591
 *         return flat_namespaces_map, new_namespaces
 * 
 *     def write(self, *args, bint with_tail=True, bint pretty_print=False, method=None):             # <<<<<<<<<<<<<<
 *         """write(self, *args, with_tail=True, pretty_print=False, method=None)
 * 
*/
  __pyx_t_23 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_23)) __PYX_ERR(6, 1591, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  if (PyDict_SetItem(__pyx_t_23, __pyx_mstate_global->__pyx_n_u_with_tail, Py_True) < (0)) __PYX_ERR(6, 1591, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_23, __pyx_mstate_global->__pyx_n_u_pretty_print, Py_False) < (0)) __PYX_ERR(6, 1591, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_23, __pyx_mstate_global->__pyx_n_u_method, Py_None) < (0)) __PYX_ERR(6, 1591, __pyx_L1_error)
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_22_IncrementalFileWriter_13write, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_IncrementalFileWriter_write, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[215])); if (unlikely(!__pyx_t_22)) __PYX_ERR(6, 1591, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_22, __pyx_t_23);
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__IncrementalFileWriter, __pyx_mstate_global->__pyx_n_u_write, __pyx_t_22) < (0)) __PYX_ERR(6, 1591, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "src/lxml/serializer.pxi":1645
 *             self._handle_error(self._c_out.error)
 * 
 *     def flush(self):             # <<<<<<<<<<<<<<
 *         """flush(self)
 * 
*/
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_22_IncrementalFileWriter_15flush, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_IncrementalFileWriter_flush, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[216])); if (unlikely(!__pyx_t_22)) __PYX_ERR(6, 1645, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__IncrementalFileWriter, __pyx_mstate_global->__pyx_n_u_flush, __pyx_t_22) < (0)) __PYX_ERR(6, 1645, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "src/lxml/serializer.pxi":1692
 *         return data
 * 
 *     def write(self, data):             # <<<<<<<<<<<<<<
 *         self._data.append(data)
 * 
*/
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_16_AsyncDataWriter_3write, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AsyncDataWriter_write, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[217])); if (unlikely(!__pyx_t_22)) __PYX_ERR(6, 1692, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__AsyncDataWriter, __pyx_mstate_global->__pyx_n_u_write, __pyx_t_22) < (0)) __PYX_ERR(6, 1692, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "src/lxml/serializer.pxi":1695
 *         self._data.append(data)
 * 
 *     def close(self):             # <<<<<<<<<<<<<<
 *         pass
 * 
*/
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_16_AsyncDataWriter_5close, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AsyncDataWriter_close, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[218])); if (unlikely(!__pyx_t_22)) __PYX_ERR(6, 1695, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__AsyncDataWriter, __pyx_mstate_global->__pyx_n_u_close, __pyx_t_22) < (0)) __PYX_ERR(6, 1695, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "src/lxml/serializer.pxi":1724
 *         return None
 * 
 *     async def flush(self):             # <<<<<<<<<<<<<<
 *         self._writer.flush()
 *         data = self._buffer.collect()
*/
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_27_AsyncIncrementalFileWriter_3flush, __Pyx_CYFUNCTION_CCLASS | __Pyx_CYFUNCTION_COROUTINE, __pyx_mstate_global->__pyx_n_u_AsyncIncrementalFileWriter_flus, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[5])); if (unlikely(!__pyx_t_22)) __PYX_ERR(6, 1724, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__AsyncIncrementalFileWriter, __pyx_mstate_global->__pyx_n_u_flush, __pyx_t_22) < (0)) __PYX_ERR(6, 1724, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "src/lxml/serializer.pxi":1730
 *             await self._async_outfile.write(data)
 * 
 *     async def write_declaration(self, version=None, standalone=None, doctype=None):             # <<<<<<<<<<<<<<
 *         self._writer.write_declaration(version, standalone, doctype)
 *         data = self._flush()
*/
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_27_AsyncIncrementalFileWriter_6write_declaration, __Pyx_CYFUNCTION_CCLASS | __Pyx_CYFUNCTION_COROUTINE, __pyx_mstate_global->__pyx_n_u_AsyncIncrementalFileWriter_writ, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[6])); if (unlikely(!__pyx_t_22)) __PYX_ERR(6, 1730, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_22, __pyx_mstate_global->__pyx_tuple[3]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__AsyncIncrementalFileWriter, __pyx_mstate_global->__pyx_n_u_write_declaration, __pyx_t_22) < (0)) __PYX_ERR(6, 1730, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "src/lxml/serializer.pxi":1736
 *             await self._async_outfile.write(data)
 * 
 *     async def write_doctype(self, doctype):             # <<<<<<<<<<<<<<
 *         self._writer.write_doctype(doctype)
 *         data = self._flush()
*/
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_27_AsyncIncrementalFileWriter_9write_doctype, __Pyx_CYFUNCTION_CCLASS | __Pyx_CYFUNCTION_COROUTINE, __pyx_mstate_global->__pyx_n_u_AsyncIncrementalFileWriter_writ_2, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[7])); if (unlikely(!__pyx_t_22)) __PYX_ERR(6, 1736, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__AsyncIncrementalFileWriter, __pyx_mstate_global->__pyx_n_u_write_doctype, __pyx_t_22) < (0)) __PYX_ERR(6, 1736, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "src/lxml/serializer.pxi":1742
 *             await self._async_outfile.write(data)
 * 
 *     async def write(self, *args, with_tail=True, pretty_print=False, method=None):             # <<<<<<<<<<<<<<
 *         self._writer.write(*args, with_tail=with_tail, pretty_print=pretty_print, method=method)
 *         data = self._flush()
*/
  __pyx_t_22 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_22)) __PYX_ERR(6, 1742, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  if (PyDict_SetItem(__pyx_t_22, __pyx_mstate_global->__pyx_n_u_with_tail, Py_True) < (0)) __PYX_ERR(6, 1742, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_22, __pyx_mstate_global->__pyx_n_u_pretty_print, Py_False) < (0)) __PYX_ERR(6, 1742, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_22, __pyx_mstate_global->__pyx_n_u_method, Py_None) < (0)) __PYX_ERR(6, 1742, __pyx_L1_error)
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_27_AsyncIncrementalFileWriter_12write, __Pyx_CYFUNCTION_CCLASS | __Pyx_CYFUNCTION_COROUTINE, __pyx_mstate_global->__pyx_n_u_AsyncIncrementalFileWriter_writ_3, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[8])); if (unlikely(!__pyx_t_23)) __PYX_ERR(6, 1742, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_23, __pyx_t_22);
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__AsyncIncrementalFileWriter, __pyx_mstate_global->__pyx_n_u_write, __pyx_t_23) < (0)) __PYX_ERR(6, 1742, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/serializer.pxi":1748
 *             await self._async_outfile.write(data)
 * 
 *     def method(self, method):             # <<<<<<<<<<<<<<
 *         return self._writer.method(method)
 * 
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_27_AsyncIncrementalFileWriter_15method, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AsyncIncrementalFileWriter_meth, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[219])); if (unlikely(!__pyx_t_23)) __PYX_ERR(6, 1748, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__AsyncIncrementalFileWriter, __pyx_mstate_global->__pyx_n_u_method, __pyx_t_23) < (0)) __PYX_ERR(6, 1748, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/serializer.pxi":1751
 *         return self._writer.method(method)
 * 
 *     def element(self, tag, attrib=None, nsmap=None, method=None, **_extra):             # <<<<<<<<<<<<<<
 *         element_writer = self._writer.element(tag, attrib, nsmap, method, **_extra)
 *         return _AsyncFileWriterElement(element_writer, self)
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_27_AsyncIncrementalFileWriter_17element, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AsyncIncrementalFileWriter_elem, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[220])); if (unlikely(!__pyx_t_23)) __PYX_ERR(6, 1751, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_23, __pyx_mstate_global->__pyx_tuple[3]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__AsyncIncrementalFileWriter, __pyx_mstate_global->__pyx_n_u_element, __pyx_t_23) < (0)) __PYX_ERR(6, 1751, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/serializer.pxi":1755
 *         return _AsyncFileWriterElement(element_writer, self)
 * 
 *     async def _close(self, bint raise_on_error):             # <<<<<<<<<<<<<<
 *         self._writer._close(raise_on_error)
 *         data = self._buffer.collect()
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_27_AsyncIncrementalFileWriter_19_close, __Pyx_CYFUNCTION_CCLASS | __Pyx_CYFUNCTION_COROUTINE, __pyx_mstate_global->__pyx_n_u_AsyncIncrementalFileWriter__clo, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[9])); if (unlikely(!__pyx_t_23)) __PYX_ERR(6, 1755, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__AsyncIncrementalFileWriter, __pyx_mstate_global->__pyx_n_u_close_2, __pyx_t_23) < (0)) __PYX_ERR(6, 1755, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/serializer.pxi":1775
 *         self._writer = writer
 * 
 *     async def __aenter__(self):             # <<<<<<<<<<<<<<
 *         self._element_writer.__enter__()
 *         data = self._writer._flush()
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_23_AsyncFileWriterElement_3__aenter__, __Pyx_CYFUNCTION_CCLASS | __Pyx_CYFUNCTION_COROUTINE, __pyx_mstate_global->__pyx_n_u_AsyncFileWriterElement___aenter, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[10])); if (unlikely(!__pyx_t_23)) __PYX_ERR(6, 1775, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__AsyncFileWriterElement, __pyx_mstate_global->__pyx_n_u_aenter, __pyx_t_23) < (0)) __PYX_ERR(6, 1775, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/serializer.pxi":1781
 *             await self._writer._async_outfile.write(data)
 * 
 *     async def __aexit__(self, *args):             # <<<<<<<<<<<<<<
 *         self._element_writer.__exit__(*args)
 *         data = self._writer._flush()
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_23_AsyncFileWriterElement_6__aexit__, __Pyx_CYFUNCTION_CCLASS | __Pyx_CYFUNCTION_COROUTINE, __pyx_mstate_global->__pyx_n_u_AsyncFileWriterElement___aexit, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[11])); if (unlikely(!__pyx_t_23)) __PYX_ERR(6, 1781, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__AsyncFileWriterElement, __pyx_mstate_global->__pyx_n_u_aexit, __pyx_t_23) < (0)) __PYX_ERR(6, 1781, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/serializer.pxi":1803
 *         self._old_method = writer._method
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         self._writer._method = self._new_method
 *         self._writer._write_start_element(self._element)
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_18_FileWriterElement_3__enter__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_FileWriterElement___enter, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[221])); if (unlikely(!__pyx_t_23)) __PYX_ERR(6, 1803, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__FileWriterElement, __pyx_mstate_global->__pyx_n_u_enter, __pyx_t_23) < (0)) __PYX_ERR(6, 1803, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/serializer.pxi":1807
 *         self._writer._write_start_element(self._element)
 * 
 *     def __exit__(self, exc_type, exc_val, exc_tb):             # <<<<<<<<<<<<<<
 *         self._writer._write_end_element(self._element)
 *         self._writer._method = self._old_method
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_18_FileWriterElement_5__exit__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_FileWriterElement___exit, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[222])); if (unlikely(!__pyx_t_23)) __PYX_ERR(6, 1807, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__FileWriterElement, __pyx_mstate_global->__pyx_n_u_exit, __pyx_t_23) < (0)) __PYX_ERR(6, 1807, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/serializer.pxi":1829
 *         self._exited = False
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         if self._entered:
 *             raise LxmlSyntaxError("Inconsistent enter action in context manager")
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_14_MethodChanger_3__enter__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_MethodChanger___enter, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[223])); if (unlikely(!__pyx_t_23)) __PYX_ERR(6, 1829, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__MethodChanger, __pyx_mstate_global->__pyx_n_u_enter, __pyx_t_23) < (0)) __PYX_ERR(6, 1829, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/serializer.pxi":1835
 *         self._entered = True
 * 
 *     def __exit__(self, exc_type, exc_val, exc_tb):             # <<<<<<<<<<<<<<
 *         if self._exited:
 *             raise LxmlSyntaxError("Inconsistent exit action in context manager")
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_14_MethodChanger_5__exit__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_MethodChanger___exit, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[224])); if (unlikely(!__pyx_t_23)) __PYX_ERR(6, 1835, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__MethodChanger, __pyx_mstate_global->__pyx_n_u_exit, __pyx_t_23) < (0)) __PYX_ERR(6, 1835, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/serializer.pxi":1843
 *         self._exited = True
 * 
 *     async def __aenter__(self):             # <<<<<<<<<<<<<<
 *         # for your async convenience
 *         return self.__enter__()
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_14_MethodChanger_7__aenter__, __Pyx_CYFUNCTION_CCLASS | __Pyx_CYFUNCTION_COROUTINE, __pyx_mstate_global->__pyx_n_u_MethodChanger___aenter, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[12])); if (unlikely(!__pyx_t_23)) __PYX_ERR(6, 1843, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__MethodChanger, __pyx_mstate_global->__pyx_n_u_aenter, __pyx_t_23) < (0)) __PYX_ERR(6, 1843, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/serializer.pxi":1847
 *         return self.__enter__()
 * 
 *     async def __aexit__(self, *args):             # <<<<<<<<<<<<<<
 *         # for your async convenience
 *         return self.__exit__(*args)
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_14_MethodChanger_10__aexit__, __Pyx_CYFUNCTION_CCLASS | __Pyx_CYFUNCTION_COROUTINE, __pyx_mstate_global->__pyx_n_u_MethodChanger___aexit, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[13])); if (unlikely(!__pyx_t_23)) __PYX_ERR(6, 1847, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__MethodChanger, __pyx_mstate_global->__pyx_n_u_aexit, __pyx_t_23) < (0)) __PYX_ERR(6, 1847, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/iterparse.pxi":147
 *         return self._parser.version
 * 
 *     def set_element_class_lookup(self, ElementClassLookup lookup = None):             # <<<<<<<<<<<<<<
 *         """set_element_class_lookup(self, lookup = None)
 * 
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_9iterparse_3set_element_class_lookup, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_iterparse_set_element_class_look, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[225])); if (unlikely(!__pyx_t_23)) __PYX_ERR(14, 147, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_23, __pyx_mstate_global->__pyx_tuple[22]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_iterparse, __pyx_mstate_global->__pyx_n_u_set_element_class_lookup, __pyx_t_23) < (0)) __PYX_ERR(14, 147, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/iterparse.pxi":156
 *         self._parser.set_element_class_lookup(lookup)
 * 
 *     def makeelement(self, _tag, attrib=None, nsmap=None, **_extra):             # <<<<<<<<<<<<<<
 *         """makeelement(self, _tag, attrib=None, nsmap=None, **_extra)
 * 
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_9iterparse_5makeelement, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_iterparse_makeelement, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[226])); if (unlikely(!__pyx_t_23)) __PYX_ERR(14, 156, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_23, __pyx_mstate_global->__pyx_tuple[21]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_iterparse, __pyx_mstate_global->__pyx_n_u_makeelement, __pyx_t_23) < (0)) __PYX_ERR(14, 156, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/iterparse.pxi":373
 *         return self._pop_event(0)
 * 
 *     def skip_subtree(self):             # <<<<<<<<<<<<<<
 *         """Prevent descending into the current subtree.
 *         Instead, the next returned event will be the 'end' event of the current element
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8iterwalk_7skip_subtree, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_iterwalk_skip_subtree, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[227])); if (unlikely(!__pyx_t_23)) __PYX_ERR(14, 373, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_iterwalk, __pyx_mstate_global->__pyx_n_u_skip_subtree, __pyx_t_23) < (0)) __PYX_ERR(14, 373, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/xmlid.pxi":3
 * cdef object _find_id_attributes
 * 
 * def XMLID(text, parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     """XMLID(text, parser=None, base_url=None)
 * 
*/
  __pyx_t_23 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_23)) __PYX_ERR(15, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  if (PyDict_SetItem(__pyx_t_23, __pyx_mstate_global->__pyx_n_u_base_url, Py_None) < (0)) __PYX_ERR(15, 3, __pyx_L1_error)
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_54XMLID, 0, __pyx_mstate_global->__pyx_n_u_XMLID, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[228])); if (unlikely(!__pyx_t_22)) __PYX_ERR(15, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_22, __pyx_mstate_global->__pyx_tuple[22]);
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_22, __pyx_t_23);
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_XMLID, __pyx_t_22) < (0)) __PYX_ERR(15, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "src/lxml/xmlid.pxi":24
 *     return root, dic
 * 
 * def XMLDTDID(text, parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     """XMLDTDID(text, parser=None, base_url=None)
 * 
*/
  __pyx_t_22 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_22)) __PYX_ERR(15, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  if (PyDict_SetItem(__pyx_t_22, __pyx_mstate_global->__pyx_n_u_base_url, Py_None) < (0)) __PYX_ERR(15, 24, __pyx_L1_error)
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_56XMLDTDID, 0, __pyx_mstate_global->__pyx_n_u_XMLDTDID, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[229])); if (unlikely(!__pyx_t_23)) __PYX_ERR(15, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_23, __pyx_mstate_global->__pyx_tuple[22]);
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_23, __pyx_t_22);
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_XMLDTDID, __pyx_t_23) < (0)) __PYX_ERR(15, 24, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/xmlid.pxi":44
 *         return root, _IDDict(root)
 * 
 * def parseid(source, parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     """parseid(source, parser=None)
 * 
*/
  __pyx_t_23 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_23)) __PYX_ERR(15, 44, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  if (PyDict_SetItem(__pyx_t_23, __pyx_mstate_global->__pyx_n_u_base_url, Py_None) < (0)) __PYX_ERR(15, 44, __pyx_L1_error)
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_58parseid, 0, __pyx_mstate_global->__pyx_n_u_parseid, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[230])); if (unlikely(!__pyx_t_22)) __PYX_ERR(15, 44, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_22, __pyx_mstate_global->__pyx_tuple[22]);
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_22, __pyx_t_23);
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_parseid, __pyx_t_22) < (0)) __PYX_ERR(15, 44, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "src/lxml/xmlid.pxi":78
 *         self._items = None
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         return _IDDict(self._doc)
 * 
*/
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_7_IDDict_3copy, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_IDDict_copy, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[231])); if (unlikely(!__pyx_t_22)) __PYX_ERR(15, 78, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__IDDict, __pyx_mstate_global->__pyx_n_u_copy, __pyx_t_22) < (0)) __PYX_ERR(15, 78, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "src/lxml/xmlid.pxi":95
 *         return _elementFactory(self._doc, c_attr.parent)
 * 
 *     def get(self, id_name):             # <<<<<<<<<<<<<<
 *         return self[id_name]
 * 
*/
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_7_IDDict_7get, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_IDDict_get, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[232])); if (unlikely(!__pyx_t_22)) __PYX_ERR(15, 95, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__IDDict, __pyx_mstate_global->__pyx_n_u_get, __pyx_t_22) < (0)) __PYX_ERR(15, 95, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "src/lxml/xmlid.pxi":105
 *         return c_id is not NULL
 * 
 *     def has_key(self, id_name):             # <<<<<<<<<<<<<<
 *         return id_name in self
 * 
*/
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_7_IDDict_11has_key, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_IDDict_has_key, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[233])); if (unlikely(!__pyx_t_22)) __PYX_ERR(15, 105, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__IDDict, __pyx_mstate_global->__pyx_n_u_has_key, __pyx_t_22) < (0)) __PYX_ERR(15, 105, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "src/lxml/xmlid.pxi":111
 *         return repr(dict(self))
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         if self._keys is None:
 *             self._keys = self._build_keys()
*/
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_7_IDDict_15keys, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_IDDict_keys, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[234])); if (unlikely(!__pyx_t_22)) __PYX_ERR(15, 111, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__IDDict, __pyx_mstate_global->__pyx_n_u_keys, __pyx_t_22) < (0)) __PYX_ERR(15, 111, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "src/lxml/xmlid.pxi":121
 *         return iter(self._keys)
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
*/
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_7_IDDict_19iterkeys, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_IDDict_iterkeys, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[235])); if (unlikely(!__pyx_t_22)) __PYX_ERR(15, 121, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__IDDict, __pyx_mstate_global->__pyx_n_u_iterkeys, __pyx_t_22) < (0)) __PYX_ERR(15, 121, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "src/lxml/xmlid.pxi":129
 *         return len(self._keys)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         if self._items is None:
 *             self._items = self._build_items()
*/
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_7_IDDict_23items, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_IDDict_items, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[236])); if (unlikely(!__pyx_t_22)) __PYX_ERR(15, 129, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__IDDict, __pyx_mstate_global->__pyx_n_u_items, __pyx_t_22) < (0)) __PYX_ERR(15, 129, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "src/lxml/xmlid.pxi":134
 *         return self._items[:]
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         if self._items is None:
 *             self._items = self._build_items()
*/
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_7_IDDict_25iteritems, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_IDDict_iteritems, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[237])); if (unlikely(!__pyx_t_22)) __PYX_ERR(15, 134, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__IDDict, __pyx_mstate_global->__pyx_n_u_iteritems, __pyx_t_22) < (0)) __PYX_ERR(15, 134, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "src/lxml/xmlid.pxi":139
 *         return iter(self._items)
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         cdef list values = []
 *         if self._items is None:
*/
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_7_IDDict_27values, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_IDDict_values, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[238])); if (unlikely(!__pyx_t_22)) __PYX_ERR(15, 139, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__IDDict, __pyx_mstate_global->__pyx_n_u_values, __pyx_t_22) < (0)) __PYX_ERR(15, 139, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "src/lxml/xmlid.pxi":149
 *         return values
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         return iter(self.values())
 * 
*/
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_7_IDDict_29itervalues, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_IDDict_itervalues, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[239])); if (unlikely(!__pyx_t_22)) __PYX_ERR(15, 149, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__IDDict, __pyx_mstate_global->__pyx_n_u_itervalues, __pyx_t_22) < (0)) __PYX_ERR(15, 149, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "src/lxml/cleanup.pxi":3
 * # functions for tree cleanup and removing elements from subtrees
 * 
 * def cleanup_namespaces(tree_or_element, top_nsmap=None, keep_ns_prefixes=None):             # <<<<<<<<<<<<<<
 *     """cleanup_namespaces(tree_or_element, top_nsmap=None, keep_ns_prefixes=None)
 * 
*/
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_60cleanup_namespaces, 0, __pyx_mstate_global->__pyx_n_u_cleanup_namespaces, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[240])); if (unlikely(!__pyx_t_22)) __PYX_ERR(17, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_22, __pyx_mstate_global->__pyx_tuple[21]);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_cleanup_namespaces, __pyx_t_22) < (0)) __PYX_ERR(17, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "src/lxml/cleanup.pxi":33
 * 
 * 
 * def strip_attributes(tree_or_element, *attribute_names):             # <<<<<<<<<<<<<<
 *     """strip_attributes(tree_or_element, *attribute_names)
 * 
*/
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_62strip_attributes, 0, __pyx_mstate_global->__pyx_n_u_strip_attributes, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[241])); if (unlikely(!__pyx_t_22)) __PYX_ERR(17, 33, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_strip_attributes, __pyx_t_22) < (0)) __PYX_ERR(17, 33, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "src/lxml/cleanup.pxi":74
 * 
 * 
 * def strip_elements(tree_or_element, *tag_names, bint with_tail=True):             # <<<<<<<<<<<<<<
 *     """strip_elements(tree_or_element, *tag_names, with_tail=True)
 * 
*/
  __pyx_t_22 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_22)) __PYX_ERR(17, 74, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  __pyx_t_23 = __Pyx_PyBool_FromLong(((int)1)); if (unlikely(!__pyx_t_23)) __PYX_ERR(17, 74, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  if (PyDict_SetItem(__pyx_t_22, __pyx_mstate_global->__pyx_n_u_with_tail, __pyx_t_23) < (0)) __PYX_ERR(17, 74, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_64strip_elements, 0, __pyx_mstate_global->__pyx_n_u_strip_elements, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[242])); if (unlikely(!__pyx_t_23)) __PYX_ERR(17, 74, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_23, __pyx_t_22);
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_strip_elements, __pyx_t_23) < (0)) __PYX_ERR(17, 74, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/cleanup.pxi":145
 * 
 * 
 * def strip_tags(tree_or_element, *tag_names):             # <<<<<<<<<<<<<<
 *     """strip_tags(tree_or_element, *tag_names)
 * 
*/
  __pyx_t_23 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_66strip_tags, 0, __pyx_mstate_global->__pyx_n_u_strip_tags, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[243])); if (unlikely(!__pyx_t_23)) __PYX_ERR(17, 145, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_strip_tags, __pyx_t_23) < (0)) __PYX_ERR(17, 145, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;

  /* "src/lxml/extensions.pxi":366
 * 
 * cdef tuple LIBXML2_XPATH_ERROR_MESSAGES = (
 *     b"Ok",             # <<<<<<<<<<<<<<
 *     b"Number encoding",
 *     b"Unfinished literal",
*/
  __Pyx_INCREF(__pyx_mstate_global->__pyx_tuple[24]);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree_LIBXML2_XPATH_ERROR_MESSAGES);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_LIBXML2_XPATH_ERROR_MESSAGES, __pyx_mstate_global->__pyx_tuple[24]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[24]);

  /* "src/lxml/extensions.pxi":424
 * 
 * 
 * def Extension(module, function_mapping=None, *, ns=None):             # <<<<<<<<<<<<<<
 *     """Extension(module, function_mapping=None, ns=None)
 * 
*/
  __pyx_t_23 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_23)) __PYX_ERR(18, 424, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  if (PyDict_SetItem(__pyx_t_23, __pyx_mstate_global->__pyx_n_u_ns, Py_None) < (0)) __PYX_ERR(18, 424, __pyx_L1_error)
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_68Extension, 0, __pyx_mstate_global->__pyx_n_u_Extension, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[244])); if (unlikely(!__pyx_t_22)) __PYX_ERR(18, 424, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_22, __pyx_mstate_global->__pyx_tuple[22]);
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_22, __pyx_t_23);
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_Extension, __pyx_t_22) < (0)) __PYX_ERR(18, 424, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "src/lxml/extensions.pxi":496
 *         return rexp_compiled
 * 
 *     def test(self, ctxt, s, rexp, flags=''):             # <<<<<<<<<<<<<<
 *         flags = self._make_string(flags)
 *         s = self._make_string(s)
*/
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_12_ExsltRegExp_3test, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ExsltRegExp_test, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[245])); if (unlikely(!__pyx_t_22)) __PYX_ERR(18, 496, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_22, __pyx_mstate_global->__pyx_tuple[25]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ExsltRegExp, __pyx_mstate_global->__pyx_n_u_test, __pyx_t_22) < (0)) __PYX_ERR(18, 496, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "src/lxml/extensions.pxi":505
 *             return True
 * 
 *     def match(self, ctxt, s, rexp, flags=''):             # <<<<<<<<<<<<<<
 *         cdef list result_list
 *         flags = self._make_string(flags)
*/
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_12_ExsltRegExp_5match, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ExsltRegExp_match, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[246])); if (unlikely(!__pyx_t_22)) __PYX_ERR(18, 505, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_22, __pyx_mstate_global->__pyx_tuple[25]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ExsltRegExp, __pyx_mstate_global->__pyx_n_u_match, __pyx_t_22) < (0)) __PYX_ERR(18, 505, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "src/lxml/extensions.pxi":530
 *         return result_list
 * 
 *     def replace(self, ctxt, s, rexp, flags, replacement):             # <<<<<<<<<<<<<<
 *         replacement = self._make_string(replacement)
 *         flags = self._make_string(flags)
*/
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_12_ExsltRegExp_7replace, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ExsltRegExp_replace, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[247])); if (unlikely(!__pyx_t_22)) __PYX_ERR(18, 530, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ExsltRegExp, __pyx_mstate_global->__pyx_n_u_replace, __pyx_t_22) < (0)) __PYX_ERR(18, 530, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "src/lxml/extensions.pxi":726
 *     cdef readonly bint is_tail
 * 
 *     def getparent(self):             # <<<<<<<<<<<<<<
 *         return self._parent
 * 
*/
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_21_ElementUnicodeResult_1getparent, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ElementUnicodeResult_getparent, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[248])); if (unlikely(!__pyx_t_22)) __PYX_ERR(18, 726, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__ElementUnicodeResult, __pyx_mstate_global->__pyx_n_u_getparent, __pyx_t_22) < (0)) __PYX_ERR(18, 726, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "src/lxml/xpath.pxi":3
 * # XPath evaluation
 * 
 * class XPathSyntaxError(LxmlSyntaxError, XPathError):             # <<<<<<<<<<<<<<
 *     pass
 * 
*/
  __Pyx_GetModuleGlobalName(__pyx_t_22, __pyx_mstate_global->__pyx_n_u_LxmlSyntaxError); if (unlikely(!__pyx_t_22)) __PYX_ERR(19, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  __pyx_t_23 = PyTuple_Pack(2, __pyx_t_22, ((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XPathError)); if (unlikely(!__pyx_t_23)) __PYX_ERR(19, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
  __pyx_t_22 = __Pyx_PEP560_update_bases(__pyx_t_23); if (unlikely(!__pyx_t_22)) __PYX_ERR(19, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  __pyx_t_24 = __Pyx_CalculateMetaclass(NULL, __pyx_t_22); if (unlikely(!__pyx_t_24)) __PYX_ERR(19, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  __pyx_t_5 = __Pyx_Py3MetaclassPrepare(__pyx_t_24, __pyx_t_22, __pyx_mstate_global->__pyx_n_u_XPathSyntaxError, __pyx_mstate_global->__pyx_n_u_XPathSyntaxError, (PyObject *) NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, (PyObject *) NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(19, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__pyx_t_22 != __pyx_t_23) {
    if (unlikely((PyDict_SetItemString(__pyx_t_5, "__orig_bases__", __pyx_t_23) < 0))) __PYX_ERR(19, 3, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
  __pyx_t_23 = __Pyx_Py3ClassCreate(__pyx_t_24, __pyx_mstate_global->__pyx_n_u_XPathSyntaxError, __pyx_t_22, __pyx_t_5, NULL, 0, 0); if (unlikely(!__pyx_t_23)) __PYX_ERR(19, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_23);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_XPathSyntaxError, __pyx_t_23) < (0)) __PYX_ERR(19, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "src/lxml/xpath.pxi":10
 * 
 * cdef object _XPATH_SYNTAX_ERRORS = (
 *     xmlerror.XML_XPATH_NUMBER_ERROR,             # <<<<<<<<<<<<<<
 *     xmlerror.XML_XPATH_UNFINISHED_LITERAL_ERROR,
 *     xmlerror.XML_XPATH_VARIABLE_REF_ERROR,
*/
  __pyx_t_22 = __Pyx_PyLong_From_xmlParserErrors(XML_XPATH_NUMBER_ERROR); if (unlikely(!__pyx_t_22)) __PYX_ERR(19, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);

  /* "src/lxml/xpath.pxi":11
 * cdef object _XPATH_SYNTAX_ERRORS = (
 *     xmlerror.XML_XPATH_NUMBER_ERROR,
 *     xmlerror.XML_XPATH_UNFINISHED_LITERAL_ERROR,             # <<<<<<<<<<<<<<
 *     xmlerror.XML_XPATH_VARIABLE_REF_ERROR,
 *     xmlerror.XML_XPATH_INVALID_PREDICATE_ERROR,
*/
  __pyx_t_24 = __Pyx_PyLong_From_xmlParserErrors(XML_XPATH_UNFINISHED_LITERAL_ERROR); if (unlikely(!__pyx_t_24)) __PYX_ERR(19, 11, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);

  /* "src/lxml/xpath.pxi":12
 *     xmlerror.XML_XPATH_NUMBER_ERROR,
 *     xmlerror.XML_XPATH_UNFINISHED_LITERAL_ERROR,
 *     xmlerror.XML_XPATH_VARIABLE_REF_ERROR,             # <<<<<<<<<<<<<<
 *     xmlerror.XML_XPATH_INVALID_PREDICATE_ERROR,
 *     xmlerror.XML_XPATH_UNCLOSED_ERROR,
*/
  __pyx_t_5 = __Pyx_PyLong_From_xmlParserErrors(XML_XPATH_VARIABLE_REF_ERROR); if (unlikely(!__pyx_t_5)) __PYX_ERR(19, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);

  /* "src/lxml/xpath.pxi":13
 *     xmlerror.XML_XPATH_UNFINISHED_LITERAL_ERROR,
 *     xmlerror.XML_XPATH_VARIABLE_REF_ERROR,
 *     xmlerror.XML_XPATH_INVALID_PREDICATE_ERROR,             # <<<<<<<<<<<<<<
 *     xmlerror.XML_XPATH_UNCLOSED_ERROR,
 *     xmlerror.XML_XPATH_INVALID_CHAR_ERROR
*/
  __pyx_t_23 = __Pyx_PyLong_From_xmlParserErrors(XML_XPATH_INVALID_PREDICATE_ERROR); if (unlikely(!__pyx_t_23)) __PYX_ERR(19, 13, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);

  /* "src/lxml/xpath.pxi":14
 *     xmlerror.XML_XPATH_VARIABLE_REF_ERROR,
 *     xmlerror.XML_XPATH_INVALID_PREDICATE_ERROR,
 *     xmlerror.XML_XPATH_UNCLOSED_ERROR,             # <<<<<<<<<<<<<<
 *     xmlerror.XML_XPATH_INVALID_CHAR_ERROR
 * )
*/
  __pyx_t_20 = __Pyx_PyLong_From_xmlParserErrors(XML_XPATH_UNCLOSED_ERROR); if (unlikely(!__pyx_t_20)) __PYX_ERR(19, 14, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);

  /* "src/lxml/xpath.pxi":15
 *     xmlerror.XML_XPATH_INVALID_PREDICATE_ERROR,
 *     xmlerror.XML_XPATH_UNCLOSED_ERROR,
 *     xmlerror.XML_XPATH_INVALID_CHAR_ERROR             # <<<<<<<<<<<<<<
 * )
 * 
*/
  __pyx_t_11 = __Pyx_PyLong_From_xmlParserErrors(XML_XPATH_INVALID_CHAR_ERROR); if (unlikely(!__pyx_t_11)) __PYX_ERR(19, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);

  /* "src/lxml/xpath.pxi":10
 * 
 * cdef object _XPATH_SYNTAX_ERRORS = (
 *     xmlerror.XML_XPATH_NUMBER_ERROR,             # <<<<<<<<<<<<<<
 *     xmlerror.XML_XPATH_UNFINISHED_LITERAL_ERROR,
 *     xmlerror.XML_XPATH_VARIABLE_REF_ERROR,
*/
  __pyx_t_21 = PyTuple_Pack(6, __pyx_t_22, __pyx_t_24, __pyx_t_5, __pyx_t_23, __pyx_t_20, __pyx_t_11); if (unlikely(!__pyx_t_21)) __PYX_ERR(19, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_21);
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree__XPATH_SYNTAX_ERRORS);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__XPATH_SYNTAX_ERRORS, __pyx_t_21);
  __Pyx_GIVEREF(__pyx_t_21);
  __pyx_t_21 = 0;

  /* "src/lxml/xpath.pxi":19
 * 
 * cdef object _XPATH_EVAL_ERRORS = (
 *     xmlerror.XML_XPATH_UNDEF_VARIABLE_ERROR,             # <<<<<<<<<<<<<<
 *     xmlerror.XML_XPATH_UNDEF_PREFIX_ERROR,
 *     xmlerror.XML_XPATH_UNKNOWN_FUNC_ERROR,
*/
  __pyx_t_21 = __Pyx_PyLong_From_xmlParserErrors(XML_XPATH_UNDEF_VARIABLE_ERROR); if (unlikely(!__pyx_t_21)) __PYX_ERR(19, 19, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_21);

  /* "src/lxml/xpath.pxi":20
 * cdef object _XPATH_EVAL_ERRORS = (
 *     xmlerror.XML_XPATH_UNDEF_VARIABLE_ERROR,
 *     xmlerror.XML_XPATH_UNDEF_PREFIX_ERROR,             # <<<<<<<<<<<<<<
 *     xmlerror.XML_XPATH_UNKNOWN_FUNC_ERROR,
 *     xmlerror.XML_XPATH_INVALID_OPERAND,
*/
  __pyx_t_11 = __Pyx_PyLong_From_xmlParserErrors(XML_XPATH_UNDEF_PREFIX_ERROR); if (unlikely(!__pyx_t_11)) __PYX_ERR(19, 20, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);

  /* "src/lxml/xpath.pxi":21
 *     xmlerror.XML_XPATH_UNDEF_VARIABLE_ERROR,
 *     xmlerror.XML_XPATH_UNDEF_PREFIX_ERROR,
 *     xmlerror.XML_XPATH_UNKNOWN_FUNC_ERROR,             # <<<<<<<<<<<<<<
 *     xmlerror.XML_XPATH_INVALID_OPERAND,
 *     xmlerror.XML_XPATH_INVALID_TYPE,
*/
  __pyx_t_20 = __Pyx_PyLong_From_xmlParserErrors(XML_XPATH_UNKNOWN_FUNC_ERROR); if (unlikely(!__pyx_t_20)) __PYX_ERR(19, 21, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);

  /* "src/lxml/xpath.pxi":22
 *     xmlerror.XML_XPATH_UNDEF_PREFIX_ERROR,
 *     xmlerror.XML_XPATH_UNKNOWN_FUNC_ERROR,
 *     xmlerror.XML_XPATH_INVALID_OPERAND,             # <<<<<<<<<<<<<<
 *     xmlerror.XML_XPATH_INVALID_TYPE,
 *     xmlerror.XML_XPATH_INVALID_ARITY,
*/
  __pyx_t_23 = __Pyx_PyLong_From_xmlParserErrors(XML_XPATH_INVALID_OPERAND); if (unlikely(!__pyx_t_23)) __PYX_ERR(19, 22, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);

  /* "src/lxml/xpath.pxi":23
 *     xmlerror.XML_XPATH_UNKNOWN_FUNC_ERROR,
 *     xmlerror.XML_XPATH_INVALID_OPERAND,
 *     xmlerror.XML_XPATH_INVALID_TYPE,             # <<<<<<<<<<<<<<
 *     xmlerror.XML_XPATH_INVALID_ARITY,
 *     xmlerror.XML_XPATH_INVALID_CTXT_SIZE,
*/
  __pyx_t_5 = __Pyx_PyLong_From_xmlParserErrors(XML_XPATH_INVALID_TYPE); if (unlikely(!__pyx_t_5)) __PYX_ERR(19, 23, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);

  /* "src/lxml/xpath.pxi":24
 *     xmlerror.XML_XPATH_INVALID_OPERAND,
 *     xmlerror.XML_XPATH_INVALID_TYPE,
 *     xmlerror.XML_XPATH_INVALID_ARITY,             # <<<<<<<<<<<<<<
 *     xmlerror.XML_XPATH_INVALID_CTXT_SIZE,
 *     xmlerror.XML_XPATH_INVALID_CTXT_POSITION
*/
  __pyx_t_24 = __Pyx_PyLong_From_xmlParserErrors(XML_XPATH_INVALID_ARITY); if (unlikely(!__pyx_t_24)) __PYX_ERR(19, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);

  /* "src/lxml/xpath.pxi":25
 *     xmlerror.XML_XPATH_INVALID_TYPE,
 *     xmlerror.XML_XPATH_INVALID_ARITY,
 *     xmlerror.XML_XPATH_INVALID_CTXT_SIZE,             # <<<<<<<<<<<<<<
 *     xmlerror.XML_XPATH_INVALID_CTXT_POSITION
 * )
*/
  __pyx_t_22 = __Pyx_PyLong_From_xmlParserErrors(XML_XPATH_INVALID_CTXT_SIZE); if (unlikely(!__pyx_t_22)) __PYX_ERR(19, 25, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);

  /* "src/lxml/xpath.pxi":26
 *     xmlerror.XML_XPATH_INVALID_ARITY,
 *     xmlerror.XML_XPATH_INVALID_CTXT_SIZE,
 *     xmlerror.XML_XPATH_INVALID_CTXT_POSITION             # <<<<<<<<<<<<<<
 * )
 * 
*/
  __pyx_t_19 = __Pyx_PyLong_From_xmlParserErrors(XML_XPATH_INVALID_CTXT_POSITION); if (unlikely(!__pyx_t_19)) __PYX_ERR(19, 26, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_19);

  /* "src/lxml/xpath.pxi":19
 * 
 * cdef object _XPATH_EVAL_ERRORS = (
 *     xmlerror.XML_XPATH_UNDEF_VARIABLE_ERROR,             # <<<<<<<<<<<<<<
 *     xmlerror.XML_XPATH_UNDEF_PREFIX_ERROR,
 *     xmlerror.XML_XPATH_UNKNOWN_FUNC_ERROR,
*/
  __pyx_t_18 = PyTuple_Pack(8, __pyx_t_21, __pyx_t_11, __pyx_t_20, __pyx_t_23, __pyx_t_5, __pyx_t_24, __pyx_t_22, __pyx_t_19); if (unlikely(!__pyx_t_18)) __PYX_ERR(19, 19, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_18);
  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree__XPATH_EVAL_ERRORS);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__XPATH_EVAL_ERRORS, __pyx_t_18);
  __Pyx_GIVEREF(__pyx_t_18);
  __pyx_t_18 = 0;

  /* "src/lxml/xpath.pxi":251
 *         self.set_context(xpathCtxt)
 * 
 *     def register_namespace(self, prefix, uri):             # <<<<<<<<<<<<<<
 *         """Register a namespace with the XPath context.
 *         """
*/
  __pyx_t_18 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_21XPathElementEvaluator_3register_namespace, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_XPathElementEvaluator_register_n, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[249])); if (unlikely(!__pyx_t_18)) __PYX_ERR(19, 251, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_18);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_18);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XPathElementEvaluator, __pyx_mstate_global->__pyx_n_u_register_namespace, __pyx_t_18) < (0)) __PYX_ERR(19, 251, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;

  /* "src/lxml/xpath.pxi":257
 *         self._context.addNamespace(prefix, uri)
 * 
 *     def register_namespaces(self, namespaces):             # <<<<<<<<<<<<<<
 *         """Register a prefix -> uri dict.
 *         """
*/
  __pyx_t_18 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_21XPathElementEvaluator_5register_namespaces, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_XPathElementEvaluator_register_n_2, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[250])); if (unlikely(!__pyx_t_18)) __PYX_ERR(19, 257, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_18);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_18);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XPathElementEvaluator, __pyx_mstate_global->__pyx_n_u_register_namespaces, __pyx_t_18) < (0)) __PYX_ERR(19, 257, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;

  /* "src/lxml/xpath.pxi":352
 * 
 * 
 * def XPathEvaluator(etree_or_element, *, namespaces=None, extensions=None,             # <<<<<<<<<<<<<<
 *                    regexp=True, smart_strings=True):
 *     """XPathEvaluator(etree_or_element, namespaces=None, extensions=None, regexp=True, smart_strings=True)
*/
  __pyx_t_18 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_18)) __PYX_ERR(19, 352, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_18);
  if (PyDict_SetItem(__pyx_t_18, __pyx_mstate_global->__pyx_n_u_namespaces, Py_None) < (0)) __PYX_ERR(19, 352, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_18, __pyx_mstate_global->__pyx_n_u_extensions, Py_None) < (0)) __PYX_ERR(19, 352, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_18, __pyx_mstate_global->__pyx_n_u_regexp, ((PyObject*)Py_True)) < (0)) __PYX_ERR(19, 352, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_18, __pyx_mstate_global->__pyx_n_u_smart_strings, ((PyObject*)Py_True)) < (0)) __PYX_ERR(19, 352, __pyx_L1_error)
  __pyx_t_19 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_70XPathEvaluator, 0, __pyx_mstate_global->__pyx_n_u_XPathEvaluator, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[251])); if (unlikely(!__pyx_t_19)) __PYX_ERR(19, 352, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_19);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_19);
  #endif
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_19, __pyx_t_18);
  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_XPathEvaluator, __pyx_t_19) < (0)) __PYX_ERR(19, 352, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;

  /* "src/lxml/xpath.pxi":448
 * 
 * 
 * cdef object _replace_strings = re.compile(b'("[^"]*")|(\'[^\']*\')').sub             # <<<<<<<<<<<<<<
 * cdef object _find_namespaces = re.compile(b'({[^}]+})').findall
 * 
*/
  __pyx_t_18 = __pyx_v_4lxml_5etree_re;
  __Pyx_INCREF(__pyx_t_18);
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_18, __pyx_mstate_global->__pyx_kp_b__45};
    __pyx_t_19 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_compile, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
    if (unlikely(!__pyx_t_19)) __PYX_ERR(19, 448, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_19);
  }
  __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_t_19, __pyx_mstate_global->__pyx_n_u_sub); if (unlikely(!__pyx_t_18)) __PYX_ERR(19, 448, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_18);
  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree__replace_strings);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__replace_strings, __pyx_t_18);
  __Pyx_GIVEREF(__pyx_t_18);
  __pyx_t_18 = 0;

  /* "src/lxml/xpath.pxi":449
 * 
 * cdef object _replace_strings = re.compile(b'("[^"]*")|(\'[^\']*\')').sub
 * cdef object _find_namespaces = re.compile(b'({[^}]+})').findall             # <<<<<<<<<<<<<<
 * 
 * cdef class ETXPath(XPath):
*/
  __pyx_t_19 = __pyx_v_4lxml_5etree_re;
  __Pyx_INCREF(__pyx_t_19);
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_19, __pyx_mstate_global->__pyx_kp_b__46};
    __pyx_t_18 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_compile, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
    if (unlikely(!__pyx_t_18)) __PYX_ERR(19, 449, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_18);
  }
  __pyx_t_19 = __Pyx_PyObject_GetAttrStr(__pyx_t_18, __pyx_mstate_global->__pyx_n_u_findall); if (unlikely(!__pyx_t_19)) __PYX_ERR(19, 449, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_19);
  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree__find_namespaces);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__find_namespaces, __pyx_t_19);
  __Pyx_GIVEREF(__pyx_t_19);
  __pyx_t_19 = 0;

  /* "src/lxml/xslt.pxi":17
 *     """
 * 
 * class XSLTSaveError(XSLTError, SerialisationError):             # <<<<<<<<<<<<<<
 *     """Error serialising an XSLT result.
 *     """
*/
  __pyx_t_19 = PyTuple_Pack(2, ((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XSLTError), ((PyObject *)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_SerialisationError)); if (unlikely(!__pyx_t_19)) __PYX_ERR(3, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_19);
  __pyx_t_18 = __Pyx_PEP560_update_bases(__pyx_t_19); if (unlikely(!__pyx_t_18)) __PYX_ERR(3, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_18);
  __pyx_t_22 = __Pyx_CalculateMetaclass(NULL, __pyx_t_18); if (unlikely(!__pyx_t_22)) __PYX_ERR(3, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  __pyx_t_24 = __Pyx_Py3MetaclassPrepare(__pyx_t_22, __pyx_t_18, __pyx_mstate_global->__pyx_n_u_XSLTSaveError, __pyx_mstate_global->__pyx_n_u_XSLTSaveError, (PyObject *) NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_kp_u_Error_serialising_an_XSLT_result); if (unlikely(!__pyx_t_24)) __PYX_ERR(3, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  if (__pyx_t_18 != __pyx_t_19) {
    if (unlikely((PyDict_SetItemString(__pyx_t_24, "__orig_bases__", __pyx_t_19) < 0))) __PYX_ERR(3, 17, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
  __pyx_t_19 = __Pyx_Py3ClassCreate(__pyx_t_22, __pyx_mstate_global->__pyx_n_u_XSLTSaveError, __pyx_t_18, __pyx_t_24, NULL, 0, 0); if (unlikely(!__pyx_t_19)) __PYX_ERR(3, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_19);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_19);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_XSLTSaveError, __pyx_t_19) < (0)) __PYX_ERR(3, 17, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;

  /* "src/lxml/xslt.pxi":27
 * 
 * # version information
 * LIBXSLT_COMPILED_VERSION = __unpackIntVersion(xslt.LIBXSLT_VERSION)             # <<<<<<<<<<<<<<
 * LIBXSLT_VERSION = __unpackIntVersion(xslt.xsltLibxsltVersion)
 * 
*/
  __pyx_t_18 = __pyx_f_4lxml_5etree___unpackIntVersion(LIBXSLT_VERSION, NULL); if (unlikely(!__pyx_t_18)) __PYX_ERR(3, 27, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_18);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_LIBXSLT_COMPILED_VERSION, __pyx_t_18) < (0)) __PYX_ERR(3, 27, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;

  /* "src/lxml/xslt.pxi":28
 * # version information
 * LIBXSLT_COMPILED_VERSION = __unpackIntVersion(xslt.LIBXSLT_VERSION)
 * LIBXSLT_VERSION = __unpackIntVersion(xslt.xsltLibxsltVersion)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_18 = __pyx_f_4lxml_5etree___unpackIntVersion(xsltLibxsltVersion, NULL); if (unlikely(!__pyx_t_18)) __PYX_ERR(3, 28, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_18);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_LIBXSLT_VERSION, __pyx_t_18) < (0)) __PYX_ERR(3, 28, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;

  /* "src/lxml/xslt.pxi":164
 *     return c_doc
 * 
 * cdef xslt.xsltDocLoaderFunc XSLT_DOC_DEFAULT_LOADER = xslt.xsltDocDefaultLoader             # <<<<<<<<<<<<<<
 * xslt.xsltSetLoaderFunc(<xslt.xsltDocLoaderFunc>_xslt_doc_loader)
 * 
*/
  __pyx_v_4lxml_5etree_XSLT_DOC_DEFAULT_LOADER = xsltDocDefaultLoader;

  /* "src/lxml/xslt.pxi":165
 * 
 * cdef xslt.xsltDocLoaderFunc XSLT_DOC_DEFAULT_LOADER = xslt.xsltDocDefaultLoader
 * xslt.xsltSetLoaderFunc(<xslt.xsltDocLoaderFunc>_xslt_doc_loader)             # <<<<<<<<<<<<<<
 * 
 * ################################################################################
*/
  xsltSetLoaderFunc(((xsltDocLoaderFunc)__pyx_f_4lxml_5etree__xslt_doc_loader));

  /* "src/lxml/xslt.pxi":205
 *         self._setAccess(xslt.XSLT_SECPREF_WRITE_NETWORK, write_network)
 * 
 *     DENY_ALL = XSLTAccessControl(             # <<<<<<<<<<<<<<
 *         read_file=False, write_file=False, create_dir=False,
 *         read_network=False, write_network=False)
*/
  __pyx_t_22 = NULL;

  /* "src/lxml/xslt.pxi":207
 *     DENY_ALL = XSLTAccessControl(
 *         read_file=False, write_file=False, create_dir=False,
 *         read_network=False, write_network=False)             # <<<<<<<<<<<<<<
 * 
 *     DENY_WRITE = XSLTAccessControl(
*/
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 5 : 0)] = {__pyx_t_22, NULL};
    __pyx_t_24 = __Pyx_MakeVectorcallBuilderKwds(5); if (unlikely(!__pyx_t_24)) __PYX_ERR(3, 205, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_24);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_read_file, Py_False, __pyx_t_24, __pyx_callargs+1, 0) < (0)) __PYX_ERR(3, 205, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_write_file, Py_False, __pyx_t_24, __pyx_callargs+1, 1) < (0)) __PYX_ERR(3, 205, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_create_dir, Py_False, __pyx_t_24, __pyx_callargs+1, 2) < (0)) __PYX_ERR(3, 205, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_read_network, Py_False, __pyx_t_24, __pyx_callargs+1, 3) < (0)) __PYX_ERR(3, 205, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_write_network, Py_False, __pyx_t_24, __pyx_callargs+1, 4) < (0)) __PYX_ERR(3, 205, __pyx_L1_error)
    __pyx_t_18 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XSLTAccessControl, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_24);
    __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
    __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
    if (unlikely(!__pyx_t_18)) __PYX_ERR(3, 205, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_18);
  }
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XSLTAccessControl, __pyx_mstate_global->__pyx_n_u_DENY_ALL, ((PyObject *)__pyx_t_18)) < (0)) __PYX_ERR(3, 205, __pyx_L1_error)
  __Pyx_DECREF((PyObject *)__pyx_t_18); __pyx_t_18 = 0;

  /* "src/lxml/xslt.pxi":209
 *         read_network=False, write_network=False)
 * 
 *     DENY_WRITE = XSLTAccessControl(             # <<<<<<<<<<<<<<
 *         read_file=True, write_file=False, create_dir=False,
 *         read_network=True, write_network=False)
*/
  __pyx_t_24 = NULL;

  /* "src/lxml/xslt.pxi":211
 *     DENY_WRITE = XSLTAccessControl(
 *         read_file=True, write_file=False, create_dir=False,
 *         read_network=True, write_network=False)             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
*/
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 5 : 0)] = {__pyx_t_24, NULL};
    __pyx_t_22 = __Pyx_MakeVectorcallBuilderKwds(5); if (unlikely(!__pyx_t_22)) __PYX_ERR(3, 209, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_22);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_read_file, Py_True, __pyx_t_22, __pyx_callargs+1, 0) < (0)) __PYX_ERR(3, 209, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_write_file, Py_False, __pyx_t_22, __pyx_callargs+1, 1) < (0)) __PYX_ERR(3, 209, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_create_dir, Py_False, __pyx_t_22, __pyx_callargs+1, 2) < (0)) __PYX_ERR(3, 209, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_read_network, Py_True, __pyx_t_22, __pyx_callargs+1, 3) < (0)) __PYX_ERR(3, 209, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_write_network, Py_False, __pyx_t_22, __pyx_callargs+1, 4) < (0)) __PYX_ERR(3, 209, __pyx_L1_error)
    __pyx_t_18 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XSLTAccessControl, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_22);
    __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0;
    __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
    if (unlikely(!__pyx_t_18)) __PYX_ERR(3, 209, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_18);
  }
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XSLTAccessControl, __pyx_mstate_global->__pyx_n_u_DENY_WRITE, ((PyObject *)__pyx_t_18)) < (0)) __PYX_ERR(3, 209, __pyx_L1_error)
  __Pyx_DECREF((PyObject *)__pyx_t_18); __pyx_t_18 = 0;

  /* "src/lxml/xslt.pxi":269
 *         <xslt.xmlXPathFunction>_xpath_function_call)
 * 
 * cdef dict EMPTY_DICT = {}             # <<<<<<<<<<<<<<
 * 
 * @cython.final
*/
  __pyx_t_18 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_18)) __PYX_ERR(3, 269, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_18);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree_EMPTY_DICT);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_EMPTY_DICT, ((PyObject*)__pyx_t_18));
  __Pyx_GIVEREF(__pyx_t_18);
  __pyx_t_18 = 0;

  /* "src/lxml/xslt.pxi":439
 *         return self._error_log.copy()
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def strparam(strval):
 *         """strparam(strval)
*/
  __pyx_t_18 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_4XSLT_7strparam, __Pyx_CYFUNCTION_STATICMETHOD | __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_XSLT_strparam, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[252])); if (unlikely(!__pyx_t_18)) __PYX_ERR(3, 439, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_18);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_18);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XSLT, __pyx_mstate_global->__pyx_n_u_strparam, __pyx_t_18) < (0)) __PYX_ERR(3, 439, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
  __pyx_t_22 = NULL;
  __Pyx_GetNameInClass(__pyx_t_24, (PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XSLT, __pyx_mstate_global->__pyx_n_u_strparam); if (unlikely(!__pyx_t_24)) __PYX_ERR(3, 439, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_22, __pyx_t_24};
    __pyx_t_18 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_staticmethod, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
    __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
    if (unlikely(!__pyx_t_18)) __PYX_ERR(3, 439, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_18);
  }
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XSLT, __pyx_mstate_global->__pyx_n_u_strparam, __pyx_t_18) < (0)) __PYX_ERR(3, 439, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;

  /* "src/lxml/xslt.pxi":453
 *         return _XSLTQuotedStringParam(strval)
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def set_global_max_depth(int max_depth):
 *         """set_global_max_depth(max_depth)
*/
  __pyx_t_18 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_4XSLT_9set_global_max_depth, __Pyx_CYFUNCTION_STATICMETHOD | __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_XSLT_set_global_max_depth, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[253])); if (unlikely(!__pyx_t_18)) __PYX_ERR(3, 453, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_18);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_18);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XSLT, __pyx_mstate_global->__pyx_n_u_set_global_max_depth, __pyx_t_18) < (0)) __PYX_ERR(3, 453, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
  __pyx_t_24 = NULL;
  __Pyx_GetNameInClass(__pyx_t_22, (PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XSLT, __pyx_mstate_global->__pyx_n_u_set_global_max_depth); if (unlikely(!__pyx_t_22)) __PYX_ERR(3, 453, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_24, __pyx_t_22};
    __pyx_t_18 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_staticmethod, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0;
    __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
    if (unlikely(!__pyx_t_18)) __PYX_ERR(3, 453, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_18);
  }
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XSLT, __pyx_mstate_global->__pyx_n_u_set_global_max_depth, __pyx_t_18) < (0)) __PYX_ERR(3, 453, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;

  /* "src/lxml/xslt.pxi":473
 *         xslt.xsltMaxDepth = max_depth
 * 
 *     def tostring(self, _ElementTree result_tree):             # <<<<<<<<<<<<<<
 *         """tostring(self, result_tree)
 * 
*/
  __pyx_t_18 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_4XSLT_11tostring, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_XSLT_tostring, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[254])); if (unlikely(!__pyx_t_18)) __PYX_ERR(3, 473, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_18);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_18);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XSLT, __pyx_mstate_global->__pyx_n_u_tostring, __pyx_t_18) < (0)) __PYX_ERR(3, 473, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;

  /* "src/lxml/xslt.pxi":482
 *         return str(result_tree)
 * 
 *     def __deepcopy__(self, memo):             # <<<<<<<<<<<<<<
 *         return self.__copy__()
 * 
*/
  __pyx_t_18 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_4XSLT_13__deepcopy__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_XSLT___deepcopy, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[255])); if (unlikely(!__pyx_t_18)) __PYX_ERR(3, 482, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_18);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_18);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XSLT, __pyx_mstate_global->__pyx_n_u_deepcopy, __pyx_t_18) < (0)) __PYX_ERR(3, 482, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;

  /* "src/lxml/xslt.pxi":485
 *         return self.__copy__()
 * 
 *     def __copy__(self):             # <<<<<<<<<<<<<<
 *         return _copyXSLT(self)
 * 
*/
  __pyx_t_18 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_4XSLT_15__copy__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_XSLT___copy, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[256])); if (unlikely(!__pyx_t_18)) __PYX_ERR(3, 485, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_18);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_18);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XSLT, __pyx_mstate_global->__pyx_n_u_copy_2, __pyx_t_18) < (0)) __PYX_ERR(3, 485, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;

  /* "src/lxml/xslt.pxi":720
 *     cdef Py_ssize_t _buffer_refcnt
 * 
 *     def write_output(self, file, *, compression=0):             # <<<<<<<<<<<<<<
 *         """write_output(self, file, *, compression=0)
 * 
*/
  __pyx_t_18 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_18)) __PYX_ERR(3, 720, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_18);
  if (PyDict_SetItem(__pyx_t_18, __pyx_mstate_global->__pyx_n_u_compression, __pyx_mstate_global->__pyx_int_0) < (0)) __PYX_ERR(3, 720, __pyx_L1_error)
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_15_XSLTResultTree_1write_output, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_XSLTResultTree_write_output, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[257])); if (unlikely(!__pyx_t_22)) __PYX_ERR(3, 720, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_22, __pyx_t_18);
  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__XSLTResultTree, __pyx_mstate_global->__pyx_n_u_write_output, __pyx_t_22) < (0)) __PYX_ERR(3, 720, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "src/lxml/xslt.pxi":860
 * # functions like "output" and "write" are a potential security risk, but we
 * # rely on the user to configure XSLTAccessControl as needed
 * xslt.xsltRegisterAllExtras()             # <<<<<<<<<<<<<<
 * 
 * # enable EXSLT support for XSLT
*/
  xsltRegisterAllExtras();

  /* "src/lxml/xslt.pxi":863
 * 
 * # enable EXSLT support for XSLT
 * xslt.exsltRegisterAll()             # <<<<<<<<<<<<<<
 * 
 * 
*/
  exsltRegisterAll();

  /* "src/lxml/xslt.pxi":869
 * # XSLT PI support
 * 
 * cdef object _RE_PI_HREF = re.compile(r'\s+href\s*=\s*(?:\'([^\']*)\'|"([^"]*)")')             # <<<<<<<<<<<<<<
 * cdef object _FIND_PI_HREF = _RE_PI_HREF.findall
 * cdef object _REPLACE_PI_HREF = _RE_PI_HREF.sub
*/
  __pyx_t_18 = __pyx_v_4lxml_5etree_re;
  __Pyx_INCREF(__pyx_t_18);
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_18, __pyx_mstate_global->__pyx_kp_u_s_href_s_s};
    __pyx_t_22 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_compile, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
    if (unlikely(!__pyx_t_22)) __PYX_ERR(3, 869, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_22);
  }
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree__RE_PI_HREF);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__RE_PI_HREF, __pyx_t_22);
  __Pyx_GIVEREF(__pyx_t_22);
  __pyx_t_22 = 0;

  /* "src/lxml/xslt.pxi":870
 * 
 * cdef object _RE_PI_HREF = re.compile(r'\s+href\s*=\s*(?:\'([^\']*)\'|"([^"]*)")')
 * cdef object _FIND_PI_HREF = _RE_PI_HREF.findall             # <<<<<<<<<<<<<<
 * cdef object _REPLACE_PI_HREF = _RE_PI_HREF.sub
 * cdef XPath __findStylesheetByID = None
*/
  __pyx_t_22 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree__RE_PI_HREF, __pyx_mstate_global->__pyx_n_u_findall); if (unlikely(!__pyx_t_22)) __PYX_ERR(3, 870, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree__FIND_PI_HREF);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__FIND_PI_HREF, __pyx_t_22);
  __Pyx_GIVEREF(__pyx_t_22);
  __pyx_t_22 = 0;

  /* "src/lxml/xslt.pxi":871
 * cdef object _RE_PI_HREF = re.compile(r'\s+href\s*=\s*(?:\'([^\']*)\'|"([^"]*)")')
 * cdef object _FIND_PI_HREF = _RE_PI_HREF.findall
 * cdef object _REPLACE_PI_HREF = _RE_PI_HREF.sub             # <<<<<<<<<<<<<<
 * cdef XPath __findStylesheetByID = None
 * 
*/
  __pyx_t_22 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree__RE_PI_HREF, __pyx_mstate_global->__pyx_n_u_sub); if (unlikely(!__pyx_t_22)) __PYX_ERR(3, 871, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree__REPLACE_PI_HREF);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__REPLACE_PI_HREF, __pyx_t_22);
  __Pyx_GIVEREF(__pyx_t_22);
  __pyx_t_22 = 0;

  /* "src/lxml/xslt.pxi":872
 * cdef object _FIND_PI_HREF = _RE_PI_HREF.findall
 * cdef object _REPLACE_PI_HREF = _RE_PI_HREF.sub
 * cdef XPath __findStylesheetByID = None             # <<<<<<<<<<<<<<
 * 
 * cdef _findStylesheetByID(_Document doc, id):
*/
  __Pyx_INCREF(Py_None);
  __Pyx_XGOTREF((PyObject *)__pyx_v_4lxml_5etree___findStylesheetByID);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree___findStylesheetByID, ((struct __pyx_obj_4lxml_5etree_XPath *)Py_None));
  __Pyx_GIVEREF(Py_None);

  /* "src/lxml/xslt.pxi":883
 * 
 * cdef class _XSLTProcessingInstruction(PIBase):
 *     def parseXSL(self, parser=None):             # <<<<<<<<<<<<<<
 *         """parseXSL(self, parser=None)
 * 
*/
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_26_XSLTProcessingInstruction_1parseXSL, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_XSLTProcessingInstruction_parse, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[258])); if (unlikely(!__pyx_t_22)) __PYX_ERR(3, 883, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_22, __pyx_mstate_global->__pyx_tuple[22]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__XSLTProcessingInstruction, __pyx_mstate_global->__pyx_n_u_parseXSL, __pyx_t_22) < (0)) __PYX_ERR(3, 883, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "src/lxml/xslt.pxi":940
 *         return _elementTreeFactory(result_node._doc, result_node)
 * 
 *     def set(self, key, value):             # <<<<<<<<<<<<<<
 *         """set(self, key, value)
 * 
*/
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_26_XSLTProcessingInstruction_3set, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_XSLTProcessingInstruction_set, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[259])); if (unlikely(!__pyx_t_22)) __PYX_ERR(3, 940, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__XSLTProcessingInstruction, __pyx_mstate_global->__pyx_n_u_set, __pyx_t_22) < (0)) __PYX_ERR(3, 940, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "src/lxml/xsltext.pxi":6
 *     """Base class of an XSLT extension element.
 *     """
 *     def execute(self, context, self_node, input_node, output_parent):             # <<<<<<<<<<<<<<
 *         """execute(self, context, self_node, input_node, output_parent)
 *         Execute this extension element.
*/
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_13XSLTExtension_1execute, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_XSLTExtension_execute, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[260])); if (unlikely(!__pyx_t_22)) __PYX_ERR(20, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XSLTExtension, __pyx_mstate_global->__pyx_n_u_execute, __pyx_t_22) < (0)) __PYX_ERR(20, 6, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "src/lxml/xsltext.pxi":22
 *         pass
 * 
 *     def apply_templates(self, _XSLTContext context not None, node, output_parent=None,             # <<<<<<<<<<<<<<
 *                         *, elements_only=False, remove_blank_text=False):
 *         """apply_templates(self, context, node, output_parent=None, elements_only=False, remove_blank_text=False)
*/
  __pyx_t_22 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_22)) __PYX_ERR(20, 22, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);

  /* "src/lxml/xsltext.pxi":23
 * 
 *     def apply_templates(self, _XSLTContext context not None, node, output_parent=None,
 *                         *, elements_only=False, remove_blank_text=False):             # <<<<<<<<<<<<<<
 *         """apply_templates(self, context, node, output_parent=None, elements_only=False, remove_blank_text=False)
 * 
*/
  if (PyDict_SetItem(__pyx_t_22, __pyx_mstate_global->__pyx_n_u_elements_only, Py_False) < (0)) __PYX_ERR(20, 22, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_22, __pyx_mstate_global->__pyx_n_u_remove_blank_text, Py_False) < (0)) __PYX_ERR(20, 22, __pyx_L1_error)

  /* "src/lxml/xsltext.pxi":22
 *         pass
 * 
 *     def apply_templates(self, _XSLTContext context not None, node, output_parent=None,             # <<<<<<<<<<<<<<
 *                         *, elements_only=False, remove_blank_text=False):
 *         """apply_templates(self, context, node, output_parent=None, elements_only=False, remove_blank_text=False)
*/
  __pyx_t_18 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_13XSLTExtension_3apply_templates, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_XSLTExtension_apply_templates, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[261])); if (unlikely(!__pyx_t_18)) __PYX_ERR(20, 22, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_18);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_18);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_18, __pyx_mstate_global->__pyx_tuple[22]);
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_18, __pyx_t_22);
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XSLTExtension, __pyx_mstate_global->__pyx_n_u_apply_templates, __pyx_t_18) < (0)) __PYX_ERR(20, 22, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;

  /* "src/lxml/xsltext.pxi":74
 *             tree.xmlFreeNode(c_parent)
 * 
 *     def process_children(self, _XSLTContext context not None, output_parent=None,             # <<<<<<<<<<<<<<
 *                          *, elements_only=False, remove_blank_text=False):
 *         """process_children(self, context, output_parent=None, elements_only=False, remove_blank_text=False)
*/
  __pyx_t_18 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_18)) __PYX_ERR(20, 74, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_18);

  /* "src/lxml/xsltext.pxi":75
 * 
 *     def process_children(self, _XSLTContext context not None, output_parent=None,
 *                          *, elements_only=False, remove_blank_text=False):             # <<<<<<<<<<<<<<
 *         """process_children(self, context, output_parent=None, elements_only=False, remove_blank_text=False)
 * 
*/
  if (PyDict_SetItem(__pyx_t_18, __pyx_mstate_global->__pyx_n_u_elements_only, Py_False) < (0)) __PYX_ERR(20, 74, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_18, __pyx_mstate_global->__pyx_n_u_remove_blank_text, Py_False) < (0)) __PYX_ERR(20, 74, __pyx_L1_error)

  /* "src/lxml/xsltext.pxi":74
 *             tree.xmlFreeNode(c_parent)
 * 
 *     def process_children(self, _XSLTContext context not None, output_parent=None,             # <<<<<<<<<<<<<<
 *                          *, elements_only=False, remove_blank_text=False):
 *         """process_children(self, context, output_parent=None, elements_only=False, remove_blank_text=False)
*/
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_13XSLTExtension_5process_children, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_XSLTExtension_process_children, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[262])); if (unlikely(!__pyx_t_22)) __PYX_ERR(20, 74, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_22, __pyx_mstate_global->__pyx_tuple[22]);
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_22, __pyx_t_18);
  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XSLTExtension, __pyx_mstate_global->__pyx_n_u_process_children, __pyx_t_22) < (0)) __PYX_ERR(20, 74, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "lxml/etree.pyx":3803
 *         self._error_log = _ErrorLog()
 * 
 *     def validate(self, etree):             # <<<<<<<<<<<<<<
 *         """validate(self, etree)
 * 
*/
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_10_Validator_3validate, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Validator_validate, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[263])); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 3803, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Validator, __pyx_mstate_global->__pyx_n_u_validate, __pyx_t_22) < (0)) __PYX_ERR(0, 3803, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "lxml/etree.pyx":3812
 *         return self(etree)
 * 
 *     def assertValid(self, etree):             # <<<<<<<<<<<<<<
 *         """assertValid(self, etree)
 * 
*/
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_10_Validator_5assertValid, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Validator_assertValid, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[264])); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 3812, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Validator, __pyx_mstate_global->__pyx_n_u_assertValid, __pyx_t_22) < (0)) __PYX_ERR(0, 3812, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "lxml/etree.pyx":3822
 *                                   self._error_log)
 * 
 *     def assert_(self, etree):             # <<<<<<<<<<<<<<
 *         """assert_(self, etree)
 * 
*/
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_10_Validator_7assert_, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Validator_assert, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[265])); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 3822, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Validator, __pyx_mstate_global->__pyx_n_u_assert, __pyx_t_22) < (0)) __PYX_ERR(0, 3822, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "lxml/etree.pyx":3831
 *                 "Document does not comply with schema")
 * 
 *     cpdef _append_log_message(self, int domain, int type, int level, int line,             # <<<<<<<<<<<<<<
 *                               message, filename):
 *         self._error_log._receiveGeneric(domain, type, level, line, message,
*/
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_10_Validator_9_append_log_message, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Validator__append_log_message, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[266])); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 3831, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Validator, __pyx_mstate_global->__pyx_n_u_append_log_message, __pyx_t_22) < (0)) __PYX_ERR(0, 3831, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "lxml/etree.pyx":3836
 *                                         filename)
 * 
 *     cpdef _clear_error_log(self):             # <<<<<<<<<<<<<<
 *         self._error_log.clear()
 * 
*/
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_10_Validator_11_clear_error_log, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Validator__clear_error_log, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[267])); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 3836, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__Validator, __pyx_mstate_global->__pyx_n_u_clear_error_log, __pyx_t_22) < (0)) __PYX_ERR(0, 3836, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "src/lxml/dtd.pxi":163
 *        return funicodeOrNone(self._c_node.defaultValue)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         _assertValidDTDNode(self, self._c_node)
 *         cdef tree.xmlEnumeration *c_node = self._c_node.tree
*/
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_17_DTDAttributeDecl_3itervalues, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_DTDAttributeDecl_itervalues, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[14])); if (unlikely(!__pyx_t_22)) __PYX_ERR(21, 163, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__DTDAttributeDecl, __pyx_mstate_global->__pyx_n_u_itervalues, __pyx_t_22) < (0)) __PYX_ERR(21, 163, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "src/lxml/dtd.pxi":170
 *             c_node = c_node.next
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         return list(self.itervalues())
 * 
*/
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_17_DTDAttributeDecl_6values, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_DTDAttributeDecl_values, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[268])); if (unlikely(!__pyx_t_22)) __PYX_ERR(21, 170, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__DTDAttributeDecl, __pyx_mstate_global->__pyx_n_u_values, __pyx_t_22) < (0)) __PYX_ERR(21, 170, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "src/lxml/dtd.pxi":223
 *            return None
 * 
 *     def iterattributes(self):             # <<<<<<<<<<<<<<
 *         _assertValidDTDNode(self, self._c_node)
 *         cdef tree.xmlAttribute *c_node = self._c_node.attributes
*/
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_15_DTDElementDecl_3iterattributes, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_DTDElementDecl_iterattributes, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[15])); if (unlikely(!__pyx_t_22)) __PYX_ERR(21, 223, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__DTDElementDecl, __pyx_mstate_global->__pyx_n_u_iterattributes, __pyx_t_22) < (0)) __PYX_ERR(21, 223, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "src/lxml/dtd.pxi":233
 *             c_node = c_node.nexth
 * 
 *     def attributes(self):             # <<<<<<<<<<<<<<
 *         return list(self.iterattributes())
 * 
*/
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_15_DTDElementDecl_6attributes, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_DTDElementDecl_attributes, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[269])); if (unlikely(!__pyx_t_22)) __PYX_ERR(21, 233, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__DTDElementDecl, __pyx_mstate_global->__pyx_n_u_attributes, __pyx_t_22) < (0)) __PYX_ERR(21, 233, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "src/lxml/dtd.pxi":327
 *        return funicodeOrNone(self._c_dtd.SystemID)
 * 
 *     def iterelements(self):             # <<<<<<<<<<<<<<
 *         cdef tree.xmlNode *c_node = self._c_dtd.children if self._c_dtd is not NULL else NULL
 *         while c_node is not NULL:
*/
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_3DTD_3iterelements, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_DTD_iterelements, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[16])); if (unlikely(!__pyx_t_22)) __PYX_ERR(21, 327, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_DTD, __pyx_mstate_global->__pyx_n_u_iterelements, __pyx_t_22) < (0)) __PYX_ERR(21, 327, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "src/lxml/dtd.pxi":337
 *             c_node = c_node.next
 * 
 *     def elements(self):             # <<<<<<<<<<<<<<
 *         return list(self.iterelements())
 * 
*/
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_3DTD_6elements, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_DTD_elements, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[270])); if (unlikely(!__pyx_t_22)) __PYX_ERR(21, 337, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_DTD, __pyx_mstate_global->__pyx_n_u_elements, __pyx_t_22) < (0)) __PYX_ERR(21, 337, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "src/lxml/dtd.pxi":340
 *         return list(self.iterelements())
 * 
 *     def iterentities(self):             # <<<<<<<<<<<<<<
 *         cdef tree.xmlNode *c_node = self._c_dtd.children if self._c_dtd is not NULL else NULL
 *         while c_node is not NULL:
*/
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_3DTD_8iterentities, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_DTD_iterentities, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[17])); if (unlikely(!__pyx_t_22)) __PYX_ERR(21, 340, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_DTD, __pyx_mstate_global->__pyx_n_u_iterentities, __pyx_t_22) < (0)) __PYX_ERR(21, 340, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "src/lxml/dtd.pxi":350
 *             c_node = c_node.next
 * 
 *     def entities(self):             # <<<<<<<<<<<<<<
 *         return list(self.iterentities())
 * 
*/
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_3DTD_11entities, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_DTD_entities, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[271])); if (unlikely(!__pyx_t_22)) __PYX_ERR(21, 350, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_DTD, __pyx_mstate_global->__pyx_n_u_entities, __pyx_t_22) < (0)) __PYX_ERR(21, 350, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;

  /* "src/lxml/relaxng.pxi":5
 * 
 * cdef object _rnc2rng
 * try:             # <<<<<<<<<<<<<<
 *     import rnc2rng as _rnc2rng
 * except ImportError:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_1);
    /*try:*/ {

      /* "src/lxml/relaxng.pxi":6
 * cdef object _rnc2rng
 * try:
 *     import rnc2rng as _rnc2rng             # <<<<<<<<<<<<<<
 * except ImportError:
 *     _rnc2rng = None
*/
      __pyx_t_26 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_rnc2rng, 0, 0, NULL, 0); if (unlikely(!__pyx_t_26)) __PYX_ERR(22, 6, __pyx_L71_error)
      __pyx_t_22 = __pyx_t_26;
      __Pyx_GOTREF(__pyx_t_22);
      __Pyx_XGOTREF(__pyx_v_4lxml_5etree__rnc2rng);
      __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__rnc2rng, __pyx_t_22);
      __Pyx_GIVEREF(__pyx_t_22);
      __pyx_t_22 = 0;

      /* "src/lxml/relaxng.pxi":5
 * 
 * cdef object _rnc2rng
 * try:             # <<<<<<<<<<<<<<
 *     import rnc2rng as _rnc2rng
 * except ImportError:
*/
    }
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L76_try_end;
    __pyx_L71_error:;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
    __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
    __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
    __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
    __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
    __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
    __Pyx_XDECREF(__pyx_t_23); __pyx_t_23 = 0;
    __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "src/lxml/relaxng.pxi":7
 * try:
 *     import rnc2rng as _rnc2rng
 * except ImportError:             # <<<<<<<<<<<<<<
 *     _rnc2rng = None
 * 
*/
    __pyx_t_14 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_ImportError))));
    if (__pyx_t_14) {
      __Pyx_ErrRestore(0,0,0);

      /* "src/lxml/relaxng.pxi":8
 *     import rnc2rng as _rnc2rng
 * except ImportError:
 *     _rnc2rng = None             # <<<<<<<<<<<<<<
 * 
 * 
*/
      __Pyx_INCREF(Py_None);
      __Pyx_XGOTREF(__pyx_v_4lxml_5etree__rnc2rng);
      __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__rnc2rng, Py_None);
      __Pyx_GIVEREF(Py_None);
      goto __pyx_L72_exception_handled;
    }
    goto __pyx_L73_except_error;

    /* "src/lxml/relaxng.pxi":5
 * 
 * cdef object _rnc2rng
 * try:             # <<<<<<<<<<<<<<
 *     import rnc2rng as _rnc2rng
 * except ImportError:
*/
    __pyx_L73_except_error:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1);
    goto __pyx_L1_error;
    __pyx_L72_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1);
    __pyx_L76_try_end:;
  }

  /* "src/lxml/relaxng.pxi":154
 *             return False
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def from_rnc_string(cls, src, base_url=None):
 *         """Parse a RelaxNG schema in compact syntax from a text string
*/
  __pyx_t_22 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_7RelaxNG_9from_rnc_string, __Pyx_CYFUNCTION_CLASSMETHOD | __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_RelaxNG_from_rnc_string, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[272])); if (unlikely(!__pyx_t_22)) __PYX_ERR(22, 154, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_22);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_22, __pyx_mstate_global->__pyx_tuple[22]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_RelaxNG, __pyx_mstate_global->__pyx_n_u_from_rnc_string, __pyx_t_22) < (0)) __PYX_ERR(22, 154, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
  __Pyx_GetNameInClass(__pyx_t_22, (PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_RelaxNG, __pyx_mstate_global->__pyx_n_u_from_rnc_string); if (unlikely(!__pyx_t_22)) __PYX_ERR(22, 154, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  __pyx_t_18 = __Pyx_Method_ClassMethod(__pyx_t_22); if (unlikely(!__pyx_t_18)) __PYX_ERR(22, 154, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_18);
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree_RelaxNG, __pyx_mstate_global->__pyx_n_u_from_rnc_string, __pyx_t_18) < (0)) __PYX_ERR(22, 154, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;

  /* "src/lxml/xmlschema.pxi":21
 * # XMLSchema
 * 
 * cdef XPath _check_for_default_attributes = XPath(             # <<<<<<<<<<<<<<
 *     "boolean(//xs:attribute[@default or @fixed][1])",
 *     namespaces={'xs': 'http://www.w3.org/2001/XMLSchema'})
*/
  __pyx_t_22 = NULL;

  /* "src/lxml/xmlschema.pxi":23
 * cdef XPath _check_for_default_attributes = XPath(
 *     "boolean(//xs:attribute[@default or @fixed][1])",
 *     namespaces={'xs': 'http://www.w3.org/2001/XMLSchema'})             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_24 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_24)) __PYX_ERR(23, 23, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  if (PyDict_SetItem(__pyx_t_24, __pyx_mstate_global->__pyx_n_u_xs, __pyx_mstate_global->__pyx_kp_u_http_www_w3_org_2001_XMLSchema) < (0)) __PYX_ERR(23, 23, __pyx_L1_error)
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_22, __pyx_mstate_global->__pyx_kp_u_boolean_xs_attribute_default_or};
    __pyx_t_19 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_19)) __PYX_ERR(23, 21, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_19);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_namespaces, __pyx_t_24, __pyx_t_19, __pyx_callargs+2, 0) < (0)) __PYX_ERR(23, 21, __pyx_L1_error)
    __pyx_t_18 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree_XPath, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_19);
    __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
    __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
    __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
    if (unlikely(!__pyx_t_18)) __PYX_ERR(23, 21, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_18);
  }
  __Pyx_XGOTREF((PyObject *)__pyx_v_4lxml_5etree__check_for_default_attributes);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__check_for_default_attributes, ((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_t_18));
  __Pyx_GIVEREF((PyObject *)__pyx_t_18);
  __pyx_t_18 = 0;

  /* "src/lxml/debug.pxi":6
 *     """Debugging support for the memory allocation in libxml2.
 *     """
 *     def bytes_used(self):             # <<<<<<<<<<<<<<
 *         """bytes_used(self)
 * 
*/
  __pyx_t_18 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_9_MemDebug_1bytes_used, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_MemDebug_bytes_used, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[273])); if (unlikely(!__pyx_t_18)) __PYX_ERR(26, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_18);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_18);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__MemDebug, __pyx_mstate_global->__pyx_n_u_bytes_used, __pyx_t_18) < (0)) __PYX_ERR(26, 6, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;

  /* "src/lxml/debug.pxi":15
 *         return tree.xmlMemUsed()
 * 
 *     def blocks_used(self):             # <<<<<<<<<<<<<<
 *         """blocks_used(self)
 * 
*/
  __pyx_t_18 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_9_MemDebug_3blocks_used, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_MemDebug_blocks_used, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[274])); if (unlikely(!__pyx_t_18)) __PYX_ERR(26, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_18);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_18);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__MemDebug, __pyx_mstate_global->__pyx_n_u_blocks_used, __pyx_t_18) < (0)) __PYX_ERR(26, 15, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;

  /* "src/lxml/debug.pxi":24
 *         return tree.xmlMemBlocks()
 * 
 *     def dict_size(self):             # <<<<<<<<<<<<<<
 *         """dict_size(self)
 * 
*/
  __pyx_t_18 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_9_MemDebug_5dict_size, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_MemDebug_dict_size, NULL, __pyx_mstate_global->__pyx_n_u_lxml_etree, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[275])); if (unlikely(!__pyx_t_18)) __PYX_ERR(26, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_18);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_18);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4lxml_5etree__MemDebug, __pyx_mstate_global->__pyx_n_u_dict_size, __pyx_t_18) < (0)) __PYX_ERR(26, 24, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;

  /* "src/lxml/debug.pxi":36
 * 
 * 
 * memory_debugger = _MemDebug()             # <<<<<<<<<<<<<<
*/
  __pyx_t_19 = NULL;
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_19, NULL};
    __pyx_t_18 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4lxml_5etree__MemDebug, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
    if (unlikely(!__pyx_t_18)) __PYX_ERR(26, 36, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_18);
  }
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_memory_debugger, ((PyObject *)__pyx_t_18)) < (0)) __PYX_ERR(26, 36, __pyx_L1_error)
  __Pyx_DECREF((PyObject *)__pyx_t_18); __pyx_t_18 = 0;

  /* "lxml/etree.pyx":1
 * # cython: binding=True             # <<<<<<<<<<<<<<
 * # cython: auto_pickle=False
 * # cython: language_level=3
*/
  __pyx_t_18 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_18);
  if (PyDict_SetItem(__pyx_t_18, __pyx_mstate_global->__pyx_kp_u_XML_line_3387, __pyx_mstate_global->__pyx_kp_u_XML_text_parser_None_base_url_No) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_18, __pyx_mstate_global->__pyx_kp_u_FunctionNamespace_line_207, __pyx_mstate_global->__pyx_kp_u_FunctionNamespace_ns_uri_Retriev) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_test_2, __pyx_t_18) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;

  /*--- Wrapped vars code ---*/

  if (__Pyx_RegisterCleanup()) __PYX_ERR(0, 1, __pyx_L1_error)
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_XDECREF(__pyx_t_18);
  __Pyx_XDECREF(__pyx_t_19);
  __Pyx_XDECREF(__pyx_t_20);
  __Pyx_XDECREF(__pyx_t_21);
  __Pyx_XDECREF(__pyx_t_22);
  __Pyx_XDECREF(__pyx_t_23);
  __Pyx_XDECREF(__pyx_t_24);
  if (__pyx_m) {
    if (__pyx_mstate->__pyx_d && stringtab_initialized) {
      __Pyx_AddTraceback("init lxml.etree", __pyx_clineno, __pyx_lineno, __pyx_filename);
    }
    #if !CYTHON_USE_MODULE_STATE
    Py_CLEAR(__pyx_m);
    #else
    Py_DECREF(__pyx_m);
    if (pystate_addmodule_run) {
      PyObject *tp, *value, *tb;
      PyErr_Fetch(&tp, &value, &tb);
      PyState_RemoveModule(&__pyx_moduledef);
      PyErr_Restore(tp, value, tb);
    }
    #endif
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init lxml.etree");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  return (__pyx_m != NULL) ? 0 : -1;
  #else
  return __pyx_m;
  #endif
}
/* #### Code section: pystring_table ### */
/* #### Code section: cached_builtins ### */

static int __Pyx_InitCachedBuiltins(__pyx_mstatetype *__pyx_mstate) {
  CYTHON_UNUSED_VAR(__pyx_mstate);
  __pyx_builtin_print = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_print); if (!__pyx_builtin_print) __PYX_ERR(0, 273, __pyx_L1_error)
  __pyx_builtin_object = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_object); if (!__pyx_builtin_object) __PYX_ERR(1, 818, __pyx_L1_error)
  __pyx_builtin_property = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_property); if (!__pyx_builtin_property) __PYX_ERR(2, 26, __pyx_L1_error)
  __pyx_builtin_staticmethod = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_staticmethod); if (!__pyx_builtin_staticmethod) __PYX_ERR(3, 439, __pyx_L1_error)
  __pyx_builtin_super = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_super); if (!__pyx_builtin_super) __PYX_ERR(0, 219, __pyx_L1_error)
  __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_id); if (!__pyx_builtin_id) __PYX_ERR(4, 26, __pyx_L1_error)
  __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(1, 318, __pyx_L1_error)
  __pyx_builtin_NotImplemented = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_NotImplemented); if (!__pyx_builtin_NotImplemented) __PYX_ERR(0, 1992, __pyx_L1_error)
  __pyx_builtin_reversed = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_reversed); if (!__pyx_builtin_reversed) __PYX_ERR(5, 548, __pyx_L1_error)
  __pyx_builtin_open = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_open); if (!__pyx_builtin_open) __PYX_ERR(6, 644, __pyx_L1_error)
  __pyx_builtin_sorted = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_sorted); if (!__pyx_builtin_sorted) __PYX_ERR(6, 1091, __pyx_L1_error)
  __pyx_builtin___import__ = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_import); if (!__pyx_builtin___import__) __PYX_ERR(7, 101, __pyx_L1_error)
  __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(7, 409, __pyx_L1_error)

  /* Cached unbound methods */
  __pyx_mstate->__pyx_umethod_PyDict_Type_get.type = (PyObject*)&PyDict_Type;
  __pyx_mstate->__pyx_umethod_PyDict_Type_get.method_name = &__pyx_mstate->__pyx_n_u_get;
  __pyx_mstate->__pyx_umethod_PyDict_Type_items.type = (PyObject*)&PyDict_Type;
  __pyx_mstate->__pyx_umethod_PyDict_Type_items.method_name = &__pyx_mstate->__pyx_n_u_items;
  __pyx_mstate->__pyx_umethod_PyDict_Type_pop.type = (PyObject*)&PyDict_Type;
  __pyx_mstate->__pyx_umethod_PyDict_Type_pop.method_name = &__pyx_mstate->__pyx_n_u_pop;
  __pyx_mstate->__pyx_umethod_PyDict_Type_values.type = (PyObject*)&PyDict_Type;
  __pyx_mstate->__pyx_umethod_PyDict_Type_values.method_name = &__pyx_mstate->__pyx_n_u_values;
  __pyx_mstate->__pyx_umethod_PyList_Type_pop.type = (PyObject*)&PyList_Type;
  __pyx_mstate->__pyx_umethod_PyList_Type_pop.method_name = &__pyx_mstate->__pyx_n_u_pop;
  __pyx_mstate->__pyx_umethod_PySet_Type_update.type = (PyObject*)&PySet_Type;
  __pyx_mstate->__pyx_umethod_PySet_Type_update.method_name = &__pyx_mstate->__pyx_n_u_update;
  __pyx_mstate->__pyx_umethod_PyBytes_Type__replace.type = (PyObject*)(&PyBytes_Type);
  __pyx_mstate->__pyx_umethod_PyBytes_Type__replace.method_name = &__pyx_mstate->__pyx_n_u_replace;
  __pyx_mstate->__pyx_umethod_PyBytes_Type__split.type = (PyObject*)(&PyBytes_Type);
  __pyx_mstate->__pyx_umethod_PyBytes_Type__split.method_name = &__pyx_mstate->__pyx_n_u_split;
  __pyx_mstate->__pyx_umethod_PyUnicode_Type__strip.type = (PyObject*)(&PyUnicode_Type);
  __pyx_mstate->__pyx_umethod_PyUnicode_Type__strip.method_name = &__pyx_mstate->__pyx_n_u_strip;
  return 0;
  __pyx_L1_error:;
  return -1;
}
/* #### Code section: cached_constants ### */

static int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);

  /* "View.MemoryView":583
 *     def suboffsets(self):
 *         if self.view.suboffsets == NULL:
 *             return (-1,) * self.view.ndim             # <<<<<<<<<<<<<<
 * 
 *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
*/
  __pyx_mstate_global->__pyx_tuple[0] = PyTuple_New(1); if (unlikely(!__pyx_mstate_global->__pyx_tuple[0])) __PYX_ERR(7, 583, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[0]);
  __Pyx_INCREF(__pyx_mstate_global->__pyx_int_neg_1);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_neg_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_mstate_global->__pyx_tuple[0], 0, __pyx_mstate_global->__pyx_int_neg_1) != (0)) __PYX_ERR(7, 583, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[0]);

  /* "View.MemoryView":680
 *     tup = <tuple>index if isinstance(index, tuple) else (index,)
 * 
 *     result = [slice(None)] * ndim             # <<<<<<<<<<<<<<
 *     have_slices = False
 *     seen_ellipsis = False
*/
  __pyx_mstate_global->__pyx_slice[0] = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_slice[0])) __PYX_ERR(7, 680, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_slice[0]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[0]);

  /* "lxml/etree.pyx":240
 * cdef tuple __unpackDottedVersion(version):
 *     version_list = []
 *     l = (version.decode("ascii").replace('-', '.').split('.') + [0]*4)[:4]             # <<<<<<<<<<<<<<
 *     for item in l:
 *         try:
*/
  __pyx_mstate_global->__pyx_tuple[1] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_kp_u__6, __pyx_mstate_global->__pyx_kp_u__2); if (unlikely(!__pyx_mstate_global->__pyx_tuple[1])) __PYX_ERR(0, 240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[1]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[1]);
  __pyx_mstate_global->__pyx_slice[1] = PySlice_New(Py_None, __pyx_mstate_global->__pyx_int_4, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_slice[1])) __PYX_ERR(0, 240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_slice[1]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[1]);

  /* "lxml/etree.pyx":246
 *         except ValueError:
 *             if item.startswith('dev'):
 *                 count = item[3:]             # <<<<<<<<<<<<<<
 *                 item = -300
 *             elif item.startswith('alpha'):
*/
  __pyx_mstate_global->__pyx_slice[2] = PySlice_New(__pyx_mstate_global->__pyx_int_3, Py_None, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_slice[2])) __PYX_ERR(0, 246, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_slice[2]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[2]);

  /* "lxml/etree.pyx":249
 *                 item = -300
 *             elif item.startswith('alpha'):
 *                 count = item[5:]             # <<<<<<<<<<<<<<
 *                 item = -200
 *             elif item.startswith('beta'):
*/
  __pyx_mstate_global->__pyx_slice[3] = PySlice_New(__pyx_mstate_global->__pyx_int_5, Py_None, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_slice[3])) __PYX_ERR(0, 249, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_slice[3]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[3]);

  /* "lxml/etree.pyx":252
 *                 item = -200
 *             elif item.startswith('beta'):
 *                 count = item[4:]             # <<<<<<<<<<<<<<
 *                 item = -100
 *             else:
*/
  __pyx_mstate_global->__pyx_slice[4] = PySlice_New(__pyx_mstate_global->__pyx_int_4, Py_None, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_slice[4])) __PYX_ERR(0, 252, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_slice[4]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[4]);

  /* "lxml/etree.pyx":702
 *                 match = _find_invalid_public_id_characters(value)
 *                 if match:
 *                     raise ValueError, f'Invalid character(s) {match.group(0)!r} in public_id.'             # <<<<<<<<<<<<<<
 *                 value = _utf8(value)
 *                 c_value = tree.xmlStrdup(_xcstr(value))
*/
  __pyx_mstate_global->__pyx_tuple[2] = PyTuple_Pack(1, __pyx_mstate_global->__pyx_int_0); if (unlikely(!__pyx_mstate_global->__pyx_tuple[2])) __PYX_ERR(0, 702, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[2]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[2]);

  /* "lxml/etree.pyx":2161
 *                                 compression, inclusive_ns_prefixes)
 *             else:  # c14n2
 *                 with _open_utf8_file(file, compression=compression) as f:             # <<<<<<<<<<<<<<
 *                     target = C14NWriterTarget(
 *                         f.write, with_comments=with_comments, strip_text=strip_text)
*/
  __pyx_mstate_global->__pyx_tuple[3] = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_tuple[3])) __PYX_ERR(0, 2161, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[3]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[3]);

  /* "lxml/etree.pyx":2360
 *         root = self.getroot()
 *         if _isString(path):
 *             if path[:1] == "/":             # <<<<<<<<<<<<<<
 *                 path = "." + path
 *                 from warnings import warn
*/
  __pyx_mstate_global->__pyx_slice[5] = PySlice_New(Py_None, __pyx_mstate_global->__pyx_int_1, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_slice[5])) __PYX_ERR(0, 2360, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_slice[5]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[5]);

  /* "lxml/etree.pyx":3143
 *         _assertValidNode(element)
 *         if with_tail:
 *             events = ("start", "comment", "pi", "end")             # <<<<<<<<<<<<<<
 *         else:
 *             events = ("start",)
*/
  __pyx_mstate_global->__pyx_tuple[4] = PyTuple_Pack(4, __pyx_mstate_global->__pyx_n_u_start, __pyx_mstate_global->__pyx_n_u_comment, __pyx_mstate_global->__pyx_n_u_pi, __pyx_mstate_global->__pyx_n_u_end); if (unlikely(!__pyx_mstate_global->__pyx_tuple[4])) __PYX_ERR(0, 3143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[4]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[4]);

  /* "lxml/etree.pyx":3145
 *             events = ("start", "comment", "pi", "end")
 *         else:
 *             events = ("start",)             # <<<<<<<<<<<<<<
 *         self._start_element = element
 *         self._events = iterwalk(element, events=events, tag=tag)
*/
  __pyx_mstate_global->__pyx_tuple[5] = PyTuple_Pack(1, __pyx_mstate_global->__pyx_n_u_start); if (unlikely(!__pyx_mstate_global->__pyx_tuple[5])) __PYX_ERR(0, 3145, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[5]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[5]);

  /* "src/lxml/readonlytree.pxi":196
 *             children = [ el for el in children if el.tag == tag ]
 *         if reversed:
 *             children = children[::-1]             # <<<<<<<<<<<<<<
 *         return iter(children)
 * 
*/
  __pyx_mstate_global->__pyx_slice[6] = PySlice_New(Py_None, Py_None, __pyx_mstate_global->__pyx_int_neg_1); if (unlikely(!__pyx_mstate_global->__pyx_slice[6])) __PYX_ERR(9, 196, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_slice[6]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[6]);

  /* "src/lxml/parser.pxi":1708
 *         XMLParser.__init__(self, **kwargs)
 *         if events is None:
 *             events = ('end',)             # <<<<<<<<<<<<<<
 *         self._setBaseURL(base_url)
 *         self._collectEvents(events, tag)
*/
  __pyx_mstate_global->__pyx_tuple[6] = PyTuple_Pack(1, __pyx_mstate_global->__pyx_n_u_end); if (unlikely(!__pyx_mstate_global->__pyx_tuple[6])) __PYX_ERR(2, 1708, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[6]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[6]);

  /* "src/lxml/saxparser.pxi":552
 *             context._target._handleSaxEndNs(prefix_uri[0])
 *         if build_events:
 *             context.events_iterator._events.append(('end-ns', None))             # <<<<<<<<<<<<<<
 * 
 *     return 0
*/
  __pyx_mstate_global->__pyx_tuple[7] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_kp_u_end_ns, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_tuple[7])) __PYX_ERR(5, 552, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[7]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[7]);

  /* "src/lxml/serializer.pxi":876
 * 
 * cdef _tree_to_target(element, target):
 *     for event, elem in iterwalk(element, events=('start', 'end', 'start-ns', 'comment', 'pi')):             # <<<<<<<<<<<<<<
 *         text = None
 *         if event == 'start':
*/
  __pyx_mstate_global->__pyx_tuple[8] = PyTuple_Pack(5, __pyx_mstate_global->__pyx_n_u_start, __pyx_mstate_global->__pyx_n_u_end, __pyx_mstate_global->__pyx_kp_u_start_ns, __pyx_mstate_global->__pyx_n_u_comment, __pyx_mstate_global->__pyx_n_u_pi); if (unlikely(!__pyx_mstate_global->__pyx_tuple[8])) __PYX_ERR(6, 876, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[8]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[8]);

  /* "src/lxml/serializer.pxi":960
 *         # Stack with globally and newly declared namespaces as (uri, prefix) pairs.
 *         self._declared_ns_stack = [[
 *             ("http://www.w3.org/XML/1998/namespace", "xml"),             # <<<<<<<<<<<<<<
 *         ]]
 *         # Stack with user declared namespace prefixes as (uri, prefix) pairs.
*/
  __pyx_mstate_global->__pyx_tuple[9] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_kp_u_http_www_w3_org_XML_1998_namespa, __pyx_mstate_global->__pyx_n_u_xml); if (unlikely(!__pyx_mstate_global->__pyx_tuple[9])) __PYX_ERR(6, 960, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[9]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[9]);

  /* "src/lxml/serializer.pxi":980
 * 
 *     cdef _resolve_prefix_name(self, prefixed_name):
 *         prefix, name = prefixed_name.split(':', 1)             # <<<<<<<<<<<<<<
 *         for uri, p in self._iter_namespaces(self._ns_stack):
 *             if p == prefix:
*/
  __pyx_mstate_global->__pyx_tuple[10] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_kp_u__9, __pyx_mstate_global->__pyx_int_1); if (unlikely(!__pyx_mstate_global->__pyx_tuple[10])) __PYX_ERR(6, 980, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[10]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[10]);

  /* "src/lxml/serializer.pxi":988
 *     cdef _qname(self, qname, uri=None):
 *         if uri is None:
 *             uri, tag = qname[1:].rsplit('}', 1) if qname[:1] == '{' else ('', qname)             # <<<<<<<<<<<<<<
 *         else:
 *             tag = qname
*/
  __pyx_mstate_global->__pyx_slice[7] = PySlice_New(__pyx_mstate_global->__pyx_int_1, Py_None, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_slice[7])) __PYX_ERR(6, 988, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_slice[7]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[7]);
  __pyx_mstate_global->__pyx_tuple[11] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_kp_u__11, __pyx_mstate_global->__pyx_int_1); if (unlikely(!__pyx_mstate_global->__pyx_tuple[11])) __PYX_ERR(6, 988, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[11]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[11]);

  /* "src/lxml/serializer.pxi":1536
 *         if self._status != WRITER_IN_ELEMENT:
 *             raise LxmlSyntaxError("not in an element")
 *         if not self._element_stack or self._element_stack[-1][:2] != element_config[:2]:             # <<<<<<<<<<<<<<
 *             raise LxmlSyntaxError("inconsistent exit action in context manager")
 * 
*/
  __pyx_mstate_global->__pyx_slice[8] = PySlice_New(Py_None, __pyx_mstate_global->__pyx_int_2, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_slice[8])) __PYX_ERR(6, 1536, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_slice[8]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[8]);

  /* "src/lxml/serializer.pxi":1544
 *         ok_to_write = self._c_out.error == xmlerror.XML_ERR_OK
 * 
 *         name, prefix = self._element_stack.pop()[1:3]             # <<<<<<<<<<<<<<
 *         if ok_to_write:
 *             tree.xmlOutputBufferWrite(self._c_out, 2, '</')
*/
  __pyx_mstate_global->__pyx_slice[9] = PySlice_New(__pyx_mstate_global->__pyx_int_1, __pyx_mstate_global->__pyx_int_3, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_slice[9])) __PYX_ERR(6, 1544, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_slice[9]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[9]);

  /* "src/lxml/xpath.pxi":480
 *                 i += 1
 *                 namespace_defs.append(namespace_def)
 *                 namespace = namespace_def[1:-1] # remove '{}'             # <<<<<<<<<<<<<<
 *                 namespace = (<bytes>namespace).decode('utf8')
 *                 namespaces[prefix.decode('utf8')] = namespace
*/
  __pyx_mstate_global->__pyx_slice[10] = PySlice_New(__pyx_mstate_global->__pyx_int_1, __pyx_mstate_global->__pyx_int_neg_1, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_slice[10])) __PYX_ERR(19, 480, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_slice[10]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[10]);

  /* "src/lxml/relaxng.pxi":58
 *         elif file is not None:
 *             if _isString(file):
 *                 if file[-4:].lower() == '.rnc':             # <<<<<<<<<<<<<<
 *                     _require_rnc2rng()
 *                     rng_data_utf8 = _utf8(_rnc2rng.dumps(_rnc2rng.load(file)))
*/
  __pyx_mstate_global->__pyx_slice[11] = PySlice_New(__pyx_mstate_global->__pyx_int_neg_4, Py_None, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_slice[11])) __PYX_ERR(22, 58, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_slice[11]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[11]);

  /* "src/lxml/xmlerror.pxi":818
 * 
 * 
 * class ErrorLevels(object):             # <<<<<<<<<<<<<<
 *     """Libxml2 error levels"""
 * 
*/
  __pyx_mstate_global->__pyx_tuple[12] = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_mstate_global->__pyx_tuple[12])) __PYX_ERR(1, 818, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[12]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[12]);
  __pyx_mstate_global->__pyx_tuple[13] = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_mstate_global->__pyx_tuple[13])) __PYX_ERR(1, 818, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[13]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[13]);

  /* "src/lxml/xmlerror.pxi":821
 *     """Libxml2 error levels"""
 * 
 * class ErrorDomains(object):             # <<<<<<<<<<<<<<
 *     """Libxml2 error domains"""
 * 
*/
  __pyx_mstate_global->__pyx_tuple[14] = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_mstate_global->__pyx_tuple[14])) __PYX_ERR(1, 821, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[14]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[14]);
  __pyx_mstate_global->__pyx_tuple[15] = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_mstate_global->__pyx_tuple[15])) __PYX_ERR(1, 821, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[15]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[15]);

  /* "src/lxml/xmlerror.pxi":824
 *     """Libxml2 error domains"""
 * 
 * class ErrorTypes(object):             # <<<<<<<<<<<<<<
 *     """Libxml2 error types"""
 * 
*/
  __pyx_mstate_global->__pyx_tuple[16] = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_mstate_global->__pyx_tuple[16])) __PYX_ERR(1, 824, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[16]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[16]);
  __pyx_mstate_global->__pyx_tuple[17] = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_mstate_global->__pyx_tuple[17])) __PYX_ERR(1, 824, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[17]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[17]);

  /* "src/lxml/xmlerror.pxi":827
 *     """Libxml2 error types"""
 * 
 * class RelaxNGErrorTypes(object):             # <<<<<<<<<<<<<<
 *     """Libxml2 RelaxNG error types"""
 * 
*/
  __pyx_mstate_global->__pyx_tuple[18] = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_mstate_global->__pyx_tuple[18])) __PYX_ERR(1, 827, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[18]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[18]);
  __pyx_mstate_global->__pyx_tuple[19] = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_mstate_global->__pyx_tuple[19])) __PYX_ERR(1, 827, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[19]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[19]);

  /* "lxml/etree.pyx":1015
 *             _appendChild(self, element)
 * 
 *     def clear(self, bint keep_tail=False):             # <<<<<<<<<<<<<<
 *         """clear(self, keep_tail=False)
 * 
*/
  __pyx_mstate_global->__pyx_tuple[20] = PyTuple_Pack(1, Py_False); if (unlikely(!__pyx_mstate_global->__pyx_tuple[20])) __PYX_ERR(0, 1015, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[20]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[20]);

  /* "lxml/etree.pyx":1346
 *         return ElementChildIterator(self, reversed=True)
 * 
 *     def index(self, child: _Element, start: int = None, stop: int = None):             # <<<<<<<<<<<<<<
 *         """index(self, child, start=None, stop=None)
 * 
*/
  __pyx_mstate_global->__pyx_tuple[21] = PyTuple_Pack(2, Py_None, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_tuple[21])) __PYX_ERR(0, 1346, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[21]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[21]);

  /* "lxml/etree.pyx":1433
 *             raise ValueError, "list.index(x): x not in list"
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         """get(self, key, default=None)
 * 
*/
  __pyx_mstate_global->__pyx_tuple[22] = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_tuple[22])) __PYX_ERR(0, 1433, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[22]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[22]);

  /* "lxml/etree.pyx":3468
 * 
 * 
 * def indent(tree, space="  ", *, Py_ssize_t level=0):             # <<<<<<<<<<<<<<
 *     """indent(tree, space="  ", level=0)
 * 
*/
  __pyx_mstate_global->__pyx_tuple[23] = PyTuple_Pack(1, ((PyObject*)__pyx_mstate_global->__pyx_kp_u__27)); if (unlikely(!__pyx_mstate_global->__pyx_tuple[23])) __PYX_ERR(0, 3468, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[23]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[23]);

  /* "src/lxml/extensions.pxi":366
 * 
 * cdef tuple LIBXML2_XPATH_ERROR_MESSAGES = (
 *     b"Ok",             # <<<<<<<<<<<<<<
 *     b"Number encoding",
 *     b"Unfinished literal",
*/
  __pyx_mstate_global->__pyx_tuple[24] = PyTuple_Pack(26, __pyx_mstate_global->__pyx_n_b_Ok, __pyx_mstate_global->__pyx_kp_b_Number_encoding, __pyx_mstate_global->__pyx_kp_b_Unfinished_literal, __pyx_mstate_global->__pyx_kp_b_Start_of_literal, __pyx_mstate_global->__pyx_kp_b_Expected_for_variable_reference, __pyx_mstate_global->__pyx_kp_b_Undefined_variable, __pyx_mstate_global->__pyx_kp_b_Invalid_predicate, __pyx_mstate_global->__pyx_kp_b_Invalid_expression, __pyx_mstate_global->__pyx_kp_b_Missing_closing_curly_brace, __pyx_mstate_global->__pyx_kp_b_Unregistered_function, __pyx_mstate_global->__pyx_kp_b_Invalid_operand, __pyx_mstate_global->__pyx_kp_b_Invalid_type, __pyx_mstate_global->__pyx_kp_b_Invalid_number_of_arguments, __pyx_mstate_global->__pyx_kp_b_Invalid_context_size, __pyx_mstate_global->__pyx_kp_b_Invalid_context_position, __pyx_mstate_global->__pyx_kp_b_Memory_allocation_error, __pyx_mstate_global->__pyx_kp_b_Syntax_error, __pyx_mstate_global->__pyx_kp_b_Resource_error, __pyx_mstate_global->__pyx_kp_b_Sub_resource_error, __pyx_mstate_global->__pyx_kp_b_Undefined_namespace_prefix, __pyx_mstate_global->__pyx_kp_b_Encoding_error, __pyx_mstate_global->__pyx_kp_b_Char_out_of_XML_range, __pyx_mstate_global->__pyx_kp_b_Invalid_or_incomplete_context, __pyx_mstate_global->__pyx_kp_b_Stack_usage_error, __pyx_mstate_global->__pyx_kp_b_Forbidden_variable, __pyx_mstate_global->__pyx_kp_b_Unknown_error); if (unlikely(!__pyx_mstate_global->__pyx_tuple[24])) __PYX_ERR(18, 366, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[24]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[24]);

  /* "src/lxml/extensions.pxi":496
 *         return rexp_compiled
 * 
 *     def test(self, ctxt, s, rexp, flags=''):             # <<<<<<<<<<<<<<
 *         flags = self._make_string(flags)
 *         s = self._make_string(s)
*/
  __pyx_mstate_global->__pyx_tuple[25] = PyTuple_Pack(1, __pyx_mstate_global->__pyx_kp_u__8); if (unlikely(!__pyx_mstate_global->__pyx_tuple[25])) __PYX_ERR(18, 496, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[25]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[25]);
  #if CYTHON_IMMORTAL_CONSTANTS
  {
    PyObject **table = __pyx_mstate->__pyx_tuple;
    for (Py_ssize_t i=0; i<26; ++i) {
      #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
      #if PY_VERSION_HEX < 0x030E0000
      if (_Py_IsOwnedByCurrentThread(table[i]) && Py_REFCNT(table[i]) == 1)
      #else
      if (PyUnstable_Object_IsUniquelyReferenced(table[i]))
      #endif
      {
        Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL);
      }
      #else
      Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT);
      #endif
    }
  }
  #endif
  #if CYTHON_IMMORTAL_CONSTANTS
  {
    PyObject **table = __pyx_mstate->__pyx_slice;
    for (Py_ssize_t i=0; i<12; ++i) {
      #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
      #if PY_VERSION_HEX < 0x030E0000
      if (_Py_IsOwnedByCurrentThread(table[i]) && Py_REFCNT(table[i]) == 1)
      #else
      if (PyUnstable_Object_IsUniquelyReferenced(table[i]))
      #endif
      {
        Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL);
      }
      #else
      Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT);
      #endif
    }
  }
  #endif
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}
/* #### Code section: init_constants ### */

static int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate) {
  CYTHON_UNUSED_VAR(__pyx_mstate);
  {
    const struct { const unsigned int length: 15; } index[] = {{2},{6},{3},{68},{89},{209},{34},{47},{35},{38},{35},{11},{54},{47},{45},{37},{43},{51},{60},{37},{24},{23},{19},{33},{52},{44},{36},{24},{10},{47},{19},{26},{36},{41},{36},{30},{32},{27},{19802},{58},{9},{41},{545},{33},{36},{28},{27},{34},{14},{43},{25},{32},{43},{25},{15},{20},{38},{35},{22},{32},{28},{509},{21},{23},{21},{31},{55},{44},{43},{29},{33},{44},{30},{36},{32},{37},{39},{40},{22},{17},{40},{30},{23},{30},{21},{20},{21},{27},{22},{26},{45},{22},{25},{22},{16},{17},{27},{21},{20},{19},{15},{41},{293},{33},{20},{11},{13},{27},{24},{21},{21},{53},{4},{38},{179},{47},{77},{37},{42},{35},{16},{29},{9},{23},{24},{46},{28},{7},{39},{15},{18},{956},{58},{38},{32},{8},{31},{35},{60},{30},{103},{48},{65},{60},{123},{96},{33},{41},{141},{44},{33},{160},{6},{8},{5},{32},{22},{121},{25},{19},{21},{21},{26},{23},{33},{26},{34},{31},{15},{641},{50},{29},{30},{31},{16},{28},{31},{1},{1},{1},{1},{1},{2},{2},{2},{2},{1},{1},{1},{1},{1},{1},{1},{4},{2},{3},{1},{1},{2},{2},{1},{4},{3},{1},{2},{1},{1},{1},{1},{0},{1},{8},{42},{5},{5},{48},{6},{35},{46},{56},{50},{30},{55},{18},{23},{19},{17},{51},{15},{9},{45},{53},{23},{25},{9},{15},{7},{27},{49},{25},{39},{45},{10},{48},{38},{6},{6},{27},{17},{11},{35},{18},{36},{41},{54},{10},{2},{6},{6},{35},{32},{4},{7},{36},{32},{43},{36},{14},{43},{20},{23},{21},{21},{23},{28},{27},{22},{15},{20},{18},{26},{9},{30},{14},{16},{7},{5},{23},{28},{29},{4},{51},{23},{16},{24},{18},{15},{50},{16},{11},{10},{17},{4},{8},{13},{7},{11},{11},{36},{58},{21},{88},{26},{38},{8},{6},{46},{74},{45},{19},{43},{4},{9},{6},{4},{40},{5},{41},{51},{24},{20},{18},{22},{16},{18},{23},{22},{22},{19},{25},{25},{20},{22},{23},{21},{18},{18},{17},{20},{8},{20},{32},{22},{8},{26},{16},{9},{49},{27},{7},{6},{30},{37},{27},{19},{13},{14},{22},{30},{45},{5},{9},{44},{5},{5},{5},{58},{15},{6},{31},{5},{3},{5},{17},{30},{30},{22},{22},{34},{33},{34},{35},{33},{34},{45},{41},{33},{7},{16},{20},{13},{11},{15},{13},{17},{16},{18},{12},{11},{14},{14},{32},{1},{2},{13},{18},{21},{16},{23},{36},{7},{9},{16},{33},{41},{22},{24},{21},{20},{19},{22},{25},{5},{8},{11},{7},{11},{8},{27},{24},{27},{26},{25},{24},{27},{24},{31},{5},{8},{10},{3},{28},{24},{26},{30},{8},{13},{16},{12},{12},{16},{16},{7},{13},{9},{15},{15},{23},{5},{16},{21},{17},{7},{11},{20},{18},{25},{25},{16},{21},{27},{41},{18},{19},{11},{12},{21},{25},{19},{21},{17},{20},{21},{27},{24},{20},{20},{17},{21},{18},{20},{18},{23},{21},{22},{18},{17},{21},{31},{7},{8},{17},{21},{15},{21},{14},{16},{20},{15},{14},{18},{15},{13},{16},{17},{12},{20},{20},{16},{18},{20},{20},{14},{15},{14},{13},{22},{21},{24},{17},{21},{17},{13},{20},{15},{16},{12},{15},{14},{8},{6},{10},{7},{5},{12},{11},{9},{18},{15},{14},{17},{10},{18},{20},{17},{9},{5},{26},{39},{11},{17},{16},{28},{27},{17},{7},{12},{13},{15},{8},{4},{10},{28},{14},{26},{22},{7},{12},{11},{15},{13},{17},{16},{18},{12},{14},{10},{17},{30},{29},{29},{26},{25},{29},{30},{28},{29},{28},{40},{36},{2},{24},{23},{15},{14},{24},{15},{12},{13},{18},{28},{32},{32},{31},{34},{27},{26},{9},{9},{17},{15},{21},{20},{19},{25},{24},{24},{23},{14},{9},{22},{25},{24},{24},{24},{28},{25},{14},{29},{29},{11},{6},{2},{6},{10},{19},{19},{29},{24},{11},{21},{22},{26},{10},{15},{14},{18},{24},{31},{20},{5},{8},{25},{27},{26},{28},{23},{27},{26},{22},{24},{26},{27},{7},{12},{17},{17},{20},{23},{8},{21},{22},{24},{25},{16},{22},{21},{25},{23},{17},{25},{16},{10},{15},{20},{23},{8},{18},{16},{8},{10},{1},{3},{19},{28},{11},{17},{19},{16},{15},{14},{17},{7},{1},{7},{4},{10},{30},{27},{18},{22},{19},{15},{7},{21},{8},{13},{3},{8},{5},{9},{27},{13},{25},{9},{14},{19},{22},{23},{32},{14},{14},{17},{11},{11},{11},{5},{22},{21},{40},{41},{10},{14},{14},{19},{18},{16},{16},{4},{17},{14},{9},{13},{13},{18},{29},{21},{30},{14},{26},{35},{30},{15},{28},{13},{13},{17},{25},{13},{13},{1},{3},{7},{17},{14},{3},{7},{11},{23},{10},{9},{7},{15},{5},{3},{6},{19},{15},{4},{5},{7},{11},{13},{18},{6},{18},{14},{15},{10},{5},{9},{4},{8},{4},{11},{7},{8},{19},{10},{1},{4},{5},{6},{11},{7},{8},{7},{13},{14},{6},{6},{5},{5},{9},{10},{6},{8},{6},{10},{10},{6},{6},{11},{11},{10},{10},{19},{8},{6},{12},{12},{7},{12},{6},{9},{12},{7},{4},{7},{5},{5},{8},{9},{19},{17},{13},{18},{5},{16},{15},{18},{5},{6},{10},{3},{4},{6},{11},{11},{15},{6},{7},{15},{7},{7},{11},{13},{12},{7},{7},{10},{14},{4},{8},{5},{10},{9},{4},{1},{4},{6},{6},{10},{12},{7},{15},{16},{13},{11},{3},{3},{8},{9},{7},{4},{3},{7},{7},{13},{9},{7},{6},{11},{7},{14},{15},{4},{5},{2},{4},{7},{14},{15},{15},{14},{12},{8},{13},{8},{5},{13},{6},{8},{3},{6},{8},{9},{8},{6},{7},{5},{9},{11},{5},{9},{5},{16},{17},{9},{6},{11},{8},{6},{8},{7},{13},{12},{9},{7},{8},{4},{6},{10},{11},{6},{1},{8},{4},{14},{4},{8},{8},{7},{14},{18},{18},{17},{20},{13},{12},{8},{4},{7},{8},{11},{5},{5},{5},{8},{6},{7},{9},{15},{10},{14},{3},{8},{16},{13},{9},{9},{1},{3},{9},{8},{18},{13},{10},{16},{11},{18},{14},{21},{14},{11},{11},{7},{9},{7},{11},{7},{11},{12},{6},{8},{9},{5},{6},{4},{7},{4},{8},{5},{4},{8},{4},{9},{1},{5},{3},{2},{7},{5},{6},{7},{10},{9},{21},{6},{5},{8},{5},{6},{10},{6},{15},{10},{7},{3},{4},{4},{8},{12},{2},{13},{8},{13},{9},{6},{7},{4},{5},{8},{4},{8},{16},{13},{14},{12},{15},{12},{12},{8},{9},{8},{9},{21},{34},{12},{8},{9},{10},{8},{21},{4},{1},{16},{9},{3},{4},{3},{6},{1},{8},{10},{7},{5},{10},{6},{4},{6},{4},{8},{5},{3},{9},{6},{11},{7},{6},{5},{4},{14},{10},{4},{8},{11},{5},{7},{7},{9},{7},{4},{15},{7},{7},{13},{6},{5},{4},{6},{10},{15},{4},{1},{4},{8},{8},{6},{9},{10},{4},{7},{3},{7},{11},{14},{7},{4},{7},{8},{10},{4},{4},{8},{2},{8},{8},{6},{6},{5},{3},{6},{5},{6},{3},{11},{10},{4},{4},{15},{3},{7},{2},{7},{13},{3},{7},{11},{13},{4},{7},{5},{8},{13},{7},{6},{7},{4},{5},{6},{2},{10},{4},{3},{8},{9},{6},{10},{11},{8},{12},{5},{16},{11},{8},{9},{21},{12},{14},{11},{10},{19},{14},{17},{16},{12},{1},{14},{2},{6},{2},{4},{11},{9},{12},{7},{7},{10},{17},{13},{6},{8},{18},{19},{8},{7},{6},{17},{15},{10},{7},{11},{8},{7},{13},{16},{25},{12},{16},{14},{8},{9},{6},{16},{10},{11},{11},{11},{7},{8},{12},{14},{16},{4},{5},{7},{7},{4},{6},{1},{7},{6},{10},{6},{4},{9},{4},{3},{16},{3},{18},{24},{12},{20},{12},{10},{11},{8},{12},{19},{6},{5},{3},{4},{12},{13},{6},{6},{5},{5},{10},{3},{10},{10},{5},{8},{10},{12},{6},{4},{4},{15},{4},{4},{4},{6},{7},{5},{16},{11},{14},{10},{10},{8},{6},{6},{5},{3},{5},{3},{10},{3},{4},{9},{4},{4},{6},{4},{4},{8},{4},{22},{5},{9},{8},{12},{9},{10},{4},{15},{4},{9},{5},{6},{9},{7},{7},{6},{6},{5},{3},{7},{3},{21},{4},{1},{8},{5},{6},{9},{10},{7},{11},{1},{4},{8},{2},{13},{13},{9},{5},{10},{17},{13},{10},{13},{12},{6},{1},{8},{3},{8},{15},{7},{18},{17},{17},{16},{5},{9},{5},{10},{2},{3},{5},{4},{10},{2},{4},{3},{21},{14},{33},{19},{24},{20},{18},{27},{15},{29},{17},{12},{23},{27},{15},{2265},{14},{17},{16},{18},{12},{26},{18},{18},{20},{21},{1},{1},{2},{1},{1},{1},{1},{2},{1},{1},{19},{9},{1},{0},{1},{7},{42},{36},{32},{32},{43},{36},{28},{32},{41},{36},{149},{242},{129},{74},{98},{20},{35},{58},{82},{48},{52},{31},{137},{46},{89},{112},{144},{40},{13},{93},{88},{51},{55},{59},{62},{12},{87},{100},{61},{98},{101},{210},{83},{676},{135},{16},{40},{71},{32},{65},{2},{11},{110},{22},{42},{108},{149},{170},{123},{104},{43},{95},{49},{60},{36},{111},{33},{39},{94},{185},{22},{33},{18},{35},{33},{46},{58},{94},{84},{134},{24},{85},{22},{55},{73},{379},{30},{10},{17},{129},{17},{13},{27},{16},{33},{31},{19},{17},{29},{13},{27},{27},{11},{22},{9},{25},{9},{50},{15},{11},{13},{125},{62},{59},{75},{27},{51},{74},{52},{25},{13},{13},{31},{22},{95},{31},{57},{86},{45},{27},{31},{20},{14},{42},{54},{56},{56},{56},{27},{46},{158},{11},{431},{38},{43},{41},{52},{80},{19},{9},{25},{48},{7},{21},{7},{9},{9},{37},{27},{42},{19},{13},{11},{11},{13},{15},{15},{17},{15},{15},{9},{11},{13},{15},{46},{109},{37},{11},{11},{17},{16},{18},{56},{43},{30},{113},{13},{11},{11},{34},{23},{79},{416},{19},{15},{525},{163},{199},{69},{55},{46},{95},{10},{165},{56},{48},{215},{54},{33},{95},{28},{149},{55},{5},{2},{14},{54},{33},{370},{37},{16},{20},{55},{74},{402},{43},{246},{10},{33},{30},{95},{28},{30},{54},{157},{10},{22},{55},{31},{136},{89},{6},{1},{5},{1},{2},{2},{4},{5},{2},{3},{7},{6},{5},{4},{4},{3},{5},{2},{3},{3}};
    #if (CYTHON_COMPRESS_STRINGS) == 3 && __PYX_LIMITED_VERSION_HEX >= 0x030e0000 /* compression: zstd (23077 bytes) */
const char* const cstring = "(\265/\375`\361\372\335\320\002\212\314\225bM\320\206\256<\000_<\213\275\372J\177\270J_\303,\330Ba\346\312=\360\022\2776Z\032\305s\3575m\373\236\034\3206JU\202d\363]n\\\"\262B\361\310\022N\247i\332\312\362\227\016;t\254\004\240$\376\205M\360p>\223\271\021\003\270\005\327\005 \006\244oW\324Z~\2447\202^X~ {\256\336\252B\261\314\023\214\377Je\351\221\276\365F\326|AYb\030\202\340\367y\236o\333u\305\236|\211,\307t\034\305\365d\235\341\013\270\266\306\263\305\227F\0215\212!\370y^,\211%\251\262,\243\030z>,\205\252\263\\I\020\014\301\317\363`\t$G1\004?\317\227>\031U\231\246\344\210\256\242w\n\301\317\363T\225/yc\251B\311\223\032c\266\214^\014OPe\236*\236\367e\013J\262\251q5UTb\010\306\234\351\347\261V|K\2514\232-'\313i\375\274\320\263TJ!\332\216\253j%\206+\350\275X\222\243\030\202\246J\352\363|\251$\252l*\224a\245`h\266\274V\250\256i\332R\031O\230pm\245)\220u~\030\330S\345\2011l\253\005eA\226\023k]\327\224:\256\210\347\n\rW_\314\347\371\322\307\226\253\014yZ\255\243\210\341\224\206\2473\006\374^<\317{!\006\025\232\222\251\026\024\265\212j\010\262\330oE\205\256\240*>\346,[T\022C\2122O\324(\236B\231\265\005\256\254-_\ne\252x\250\271\342O\346YRQp\345\364<\370b\256\024\037\231b[\036k\226J\247W\222\243\030c\262*\326\203\350\252\256\276\002P\366\344\371\222g\225)r\024\321\020<S\025\023e}\236?UZZ\252\022K\014\205\347\275U\345K\237\252\253\2129\206\237_M\226\225\030z^-\323\223\0149\212eX\202_\351\225\276T\226\344(\202\344Gz\244/\221%9\216\342\030\252T\360\033=?\226\306\222\034E6\\\301\317\363%\261$\305p\rO\0305MA\225\363\363\302R\t\216\"\030\242Pf\013~\240\007\236\250V\352A\226\022\330RKU\365}\"\313lY\tW\320\023<Q,5\365\255\336\327\372o\305~%\351\215\253\363\024\243\002~\236\347\261%O-I?\212!\370y\336{o\236iI\246\250\2312O\326(\236P5T\201\237\347\331\023\232\246J2*\263]\255\250X\024\336\271RO\347\311j\235Zi\013\313B\341\333U\013\005\226\037y\216\237\370\205\340\367}(\013\314\367\205%9z\242\027\262\252\312\002\275\317c\275\252JWh\311\"G\2172\325\324\207)\n~\336+\311Q\214a\235\251""\024\212jA\201\351\211R[>\317\227\330\264ez\340\347\271x\223_\211-'\273\312\254\260L\026m9O\254\226\352\275L\312\256Z,\025\323\257\324s\365\252\312\226\244\252\245\025\202\347\311\363\347KZ\256*\262\\\031KS\271\262\316\220\245\302\310\234\030Z\260\374V\355\311+WLV\312\227\246\262\245\252\220\246\225\252\246\244\351\\\215$k\262\302\223\312LM\2256MO\030\2224y\244\311\223%\322t\262\254dXFr<Ujj\242T\2438\232XN\254\331\262b\262\251\311\262\232\351\372\255x\024\252\322\032U'\006\225mQ\261T\366\014Yh\313e\265\212/\254s=Y\242\311\232\250\323\311LW\253\030C\236\316\025%\202*\365\324r\246\036\352\214\361a)dW4%U*\312\232\243\210\256Z\324\323\007\246&\352\235\0364\235\255\226m\251,,\nS\002\313\317t\262-\025\326dS\226\025U\241)\361[U\253\232\236\276\317\304\362X\226\272Z\265V\377\241\324\223\nFUa(}\246\3223\305\234\355\212\266\344\3122W&\014\205\210:Yf\252j\201\237\n]W\264\245M\325\023\332r\256\236g:[L\225\367L\354\271\252\264\320\222W\222\347J\014A\031\026\365&\017]\235\336\233V\324Te\255\332\2227\245T\263-M\344x:Q\242)u\262X&\313\251\2159YZ\024\232\232/\241\t\245\002M2\354\252\345\374L,\313d\327\226U\235--\317$\303R[\316\226VUy\023KmSS\305:Y\025JQ2aP[\026\353\204\343\330<\307\262uE5\307\254\356\273\370\332\3016n,\236y\377[\243Pp\214\313\035\212E\305\035.\3231>\273\335\271\222aO*\n\204B\3277I5A;x\316\353S\010\246\343PII\350t\313\237vo\274~g/\371\215\355\337\241\254V\027\333\314\365\307\343x\346\307\363\354vm{\206w3\270,\353\356\030\246c\367u\355\037\307\\\372Uw7\362+4\307nB]\034\303\350XF\327\367\314K\317J\340\032\357h\230\\\"y\370M\214w\266\373\345\331\375\357\227a\322\354\256cq\354\347u\016\223]1\376\322uG\273'\330}u*\320\237~\014\377\332\276\211\343\032\356d\261l\323\335\361\353\225\253\374\270s_\361wUH\241_*y\244\220\020\254#\311\3617>\300E#\317%\361,\177\271\313a7\351\216m\272\370\316\361\374\325\271r\347v\356l\3431\254\233\271\337\235\345\031\226\202\364\335\370\356f\270<\313\037\276]\031\315\353\272:\223.\216o\026\217\347\363\256_w\374\277\331\305\352\373\325}\\\276\343""\231\331<\273\270\014\303n\207\2733\370}\2377.N\317V\332\354(\376\035\343\257{\2733o7\3277N\377\030\237\271\2724m\251:\022\024=\255fw\327]\014\327\257L\267\272\223xv\311\270k\307\352\267K[b\376\215\177y\376\035^\323\035L\273\035\034\337\3040-w\261\253\303\177\036\353\340\220\016F\313p\374\306\267\335}\272\226?\035\307d\270\233gs\203\3170\262\241,)e\350N\002\242PYR*\240\304\354P\342\232\250\322\215\206\222w\003r\302\201,y\341%y\335\245\344(\244O\352rSW\262a\004\313\003d\020111i\333\266M\351`\024\374&\306\347/\337\270\237\376\364\315\314\206\361;\206\335\032\226\273b\330&\231\230\274\367\037\215\3104\210\356\020\323\017\031yxx \020\3220\022\331\020\322\300!\203(\244\341\344\202\310$\3625\214|\r\026~\310\017))\371!$;\247\343<\276\277\205\n\246\357\3251\273\266\345W<\022\325\356GW%u(\204\377O{x\270\230\336\2723\245\300!\237vC\355k\323\266\361\233\267mM\3335\376g\013\370\\\241#\221\340\020\024\370\313\261]\277\337\243\373!#\\$\3132\t\226\333W\266\0230!=\230\260&&eY\372OF\222\311d\246\231\316\002\016\253 \213\272\027\226\342\245x\024\230\006\222/\372t\311\314\004\243\320\030\364Kd\330\324\232\272\024\224\021\214\276\275\227\276E':\226w$\257\313\215\347\271~K\035\312\354\306\362X\254\013\221b\\~\315\361\307e\227\004\246c\333\306\377=\277\263\267\243q}\367w\243\r\003\270\003d8\3717&&\"\272\376\337\306\335\233\222k\301\216\271\025\\17>\351JF\027:\022QJ\t\010%d\202\342aBI\351NB]'\222\200\210\007\021\223\r\031,\220*\244\\\270\200\222\342\321yx\230(\022\360\020\242y\3538\377r\014\t\211\350\307\262\235\257\\\031&\337\365\227\325l\007\337\265l\026\323\330\006\030\020c\200\001.\013sq\222\010\267MPRLPRP<:\223\307\354\341\212\305#<\206\335\356]\213X\356\237]$\242\321H~\337]\347sLw\322\"\3250\367\376n<\257:\222K\303t\253\306[dI\311\332\nu\241Q\350\377\331\315_\357\227\225\314\340vG\313j\232F\276\331\225Lr\347\265l\343\316\320\371{wpLR\337\365;\363\336n\374\273\223\022\234\224\3434=\022\275\255\035\372\365\227\347{\236\335\3705RW\224\026\205H6K\032y\210\352\274\306\225\217B\242\332""\025s\347\217\344S\366Z\337q\007;\306\327\037\327x7\273\357g\032\323\360\373>\223\367\225\276\222\364\274\220\365^\311+\311Q\014U\320\253%i\032WU\025\232V-'\360\305\363 8\236\335\3247\034\333\270\253\237\327\304\247\227\026F{t'4Ui\255\272P\312\205\031]\241\253\221\210\324\321\265\372\363;~\277J\212\377\354\246\272P\033\242\355\230\356\362z\326\275\320\2164\313\371\007I\260du\256::\306\335;v\311s\014\237\342\022\271\266\343\274D\025\3278\311\306\355PhW\253<HpL1\212\241g*\311\025U\314\213\270\232L\246\322D\232(D\023\213\242\244\372p\213,\226_ZPb5\374=\227\234\206\336PL\036}\321I|\307\257\331\355\246x\220\204\320UG\243\244\230\246O\334\031\264\324\231R\346\271C\357\332\266\363\217\216\\Q\367]\370M\273\261Nv\351\370\245I\272\023\232\331\205\305\363\214\222`:\257_x\216BGw\3107\203\267\270\374\312\363\310\343\363\020y\335Hw\347x|\237\214nD\336+\206;\022\211\364?\272\001\342\026\023\330]\223LLNl\034\237\3618\211a\356o\311\260\370\376\271\331\221\360/\343\361L\356^t\335\311b\372D\30762L~\353\227M,\263\332O\213Fc\311\023u\252\227\316S!8\206\343_\317\251\324\234\1776]cB\360\217\357\031\334\265oF\027\360\274\026uw\016w1-\317\263\331\266\335s\346\336\267K\242go\216w\261\355\316\374n\206\333\261\223\206gy\346um\270{e\272\306\273\231+\353\276\333\315\274\362\214\254#\371p=\203\307\261{\005\0330\212c\0327F2\240\243\251\353\271\253\377,r\345?\316o\226\344\313)\241\226\204\307\2449\204\"\032y\340?\306=D\246\270KII\211\357\030\267c\264\033\277\264\213\177\332$\271$\263\273\306_\3675ro\374&nEDl7\366\351\216$\246k\225\311%\3378\356v$0\027oE0Z\376_\216u$p\334\001\005\317mX\266\251o;\324\326]\310\305]\270\275\343s4\245X\347\213\332\212\337\311[W\317:S\026QE\372\264%\206+\370\235>\317\227>u\365\306U%\206`\373y\254/y%\3712\212!\370y\376D\225|I\216\"\272\n\301\317\363!\206\023h:\323\026Jm\241\360\340\271\256lY\222\336\270b\212\251\272\nYTPMU\255\017\305\340y\322$[\346(z\340\270\322\362}\236\347\375xBKr\024C\017\374\274\027\357\225\304\322#\321U\014A\320\373J\241H\206#(~\341\tz\237\347\201+""\377\225@\257$G1\004\277\226]A\317\177\250\263\364\225\344\350\305\320\373</\364`\311\373J\217\034=\361\013=\320\373>\317\363k\311\227\344\270\256b\310R\301\363%\375@\357\363\336\347\261\253\312\342Wk\311\373RV\313cU~u\226X'\314\252Z\331\024\370y\030N~-\205\024\337J\200\212\352\235\276,\311\361\204BE/\004[~\364\312\220\034=\321\013?\020\374>\317\363^\034K\221\364F1\364@\357\013C\357\363^)\004K\217\034?\321\013\331\364\004\301\357\363<\017\226\300\263$\307\225EWPT\030s\202\237\027c\372\322\307\302\256\250\316\264$G\361\013=\320\237^N\237\347K\036Y\216\"\370\245)\252\362,%_\222'S\305\\\321Q\014Y0\340\227\236/\252\347_\002\356\255\333s\020\267\032\033\003\335D\303\250X\241\225#\027\014v\\p,*v(&\276\375\373<\366\034\004\003\037\\\007\333\206\273\361\001\302\016!\202\000\004\264\032\034\006\036\010G\215&\327\361\336\276\033i\033\351\036\035\242\235T\003`b\266-\320\327\232\204\00728\364\006~\354\017H\026\354@\334H\272\207\007\201\250\366\251u\020\355\"\332+\201\3003\341\203\267\2150 \336VL\016\027\037A\002\373\350\032tS\027\251\301\343G\207\320\273\213\035\010\235\344sn-\225\361\351\230\360p\330bt\233\020\204\236Z\324(0\330E\267\0076Q\007\351\036\022;\t\020x\"h\354\032\236\035\244w\314Dv\\n\241\310\216\307)\270U\310\3305$\234\214\366Q\204\277\3618\014\334y\363\270}\233\254'\320Q5\014\007\372\247\3431M\346u\004h -\343s\363\024v\n\021\273K\315\254\301\344\\\030H\3444\001ha\316\325ej14\033\034\027\347\303\3301<\273\267\255\350 \021^\266\004\266\nz\n\001\234\213\t\017\305\007\177C@\017E\3545\266\033=\244\261\2334\026\034\217\323\340\003\004\003>\247AN\350\353\005|6j7m\203\206\200vA\313\240A\320f\020:59+\035;D\355\000\234\0056\246\202\275\002\201\307\343\003\204N\201\366\361\354\034#7\317c\207k\tj54\007\265\007\025.\033\211\376k!\265OC\311\250Ax\213\t\217\310\007\010\034Ia\307\353`\360\273w\301\305\334\314\033\214\255\004\302\356R\223P\261W\340jn\030l\0216\224\016\002\332qo.\267\217\233\310\006\353\032\372]\243P;\325\"(\330A8\321\355s\013\331.\324p\032\213\246\201\333\300\225""\243=\245\246\342T\200\354\200j\020\020x\036l\354\033\236\006`m\205\206A\273qX8\036\205\275$Tcsm\244\216\275#'A\016\nW\336\002\270\035\240\273\350!\031{FE\316\337@7O\302.\341b\007\244\223\312\211\310\231\335N7\021\333\3076\342\3309.v\032|v\\h\037\260\327\376z\331_Z{\235C\202\333`\263\321]\275\302g\377\340R\267\210[\372Q\261S\243\237\364\212\032\207\356\365\030m\343\342\243\3418\014*>(g\3524\r\204\326\240b\307E\207\325\026\300\001q*>6\221\tO\202\017\256\036\232\360\\D\354\3766\262Q\350\016j'\315\3230p\023n;f\016\312\357)\372J\315\327 T\354x=\256\221\320F\034\005\0229\257\1774\330?\264\016\237\032\r\216\314\245\271\320Np\024D\354|pehw\365\231\334\204\304\216\307\301\031\020 b\247\246\346\326&,\330\027D\354\370\032\250\366\200bW\200\300\003~\200\270\225<{\311\315\307\247K~\311\013\276K<\317\304+\231\314\360\227\331n\355I\336\304\344\205\355_\222\3073\333d\366\222I4\356I\311(\201\221\r\tp\310\340A4\nq\310\020\022!0\362\360\020\205D<(n\272Eq\341B\253\273pa\346\313t\353\356\356\274[c\326W\335\252\212\374\242=\252\323\223\252=\254[\305YO\315~\217\347\273\236\227\352\361x^\276*\005{f\266\307\363U0\377\377VT\333x\272\264{;\022\217\3073\022\211\250\263\225\352\316[p\367\216]\024\260\354\272\353\024\310y\336\241\027\322\341\325\001o\347\177\363o>}\343\222\311\332\266\375\362\355\332|\033;\247\363\374\377\032\227\325\367\014\216\347\277\265?\317\337x\374\332q^\303\370\177\345\367\376\377\377_\023\177\374\337\257}\377\337\322\320\356\354jg\367\257\343\373v\335\264\354\336\367\354\346w\rn3\323\274r,o\335\267\275\001\377\233\317\354vf\347w;\303q[\266e\333\206[;\257I\377\343d[\277^5\315\373i\360\232\376tLS\3431:\366\351\266\276\363\230\333\376;nc\035\346\371\327\364,\243\221\3314\264\\\037\340\312\177k\3134\237D3\273\262_\313\337\363\262\335\376\270\225?,\3032,\347\257,\313\371\314\307\363\026\366m\330\177}\273\275\353\024\366\177k\343\2579\206\317\264\363\353\005\313\367w\341\362M\034\337\367\215\177\032\326\376\366\206\311/;\226\303\355\227[\270\375mks\303\360\235\273\344\271""\375\360\3777\336\306`\270\355\276\257L\327\264\373\266\257]\323u\373\276-<\327\357\333\276\355\213\277x\033\253\337\367\267\355\353\275?\366[\227\213\307.W\366\177\373cZ\276kY\226\337\357\376\031\355\2723\366\354\266m\333\342v\r\273\366w\271\257\313\255q\373\306\333\026\266\2661\236\277\361M\374[\227t2\333\177\256-\366\\cP(\351\273s\213\252Z\255\333}\221\355;\316UXW\276\252\350\272\336\270+\253m\333\233\325\222\334\230\325\276b\226\352f6\317V-\212\272o\371\3276\272\202o\365\276a\\[m\321\273~\333\226\373\004\267\337\205j\323\331\215\323\267+s_1\376\345\264]OV\2135\317\224\n\232\236\351o\301\363XL\305_\031\205BQ\350oI\363\234\267m\314\226;\254\314\256\253\236\333\357\312\263\371\322\361J\373\202\3438\325\276R'\311\2769\333\377\345o\313\363|\316\366{\267\370\377\277\375\364\335\262\346\230|C\203\376\225\343W{\023\2630\227mI\261\347\211=\353W\375Q2\252\023\265\202\"\305\362\323\247\345\266\215\327u=\245&\312:}\272\225\355\024\027N\3713\n\251mI\254\212\316\355\217I\260:mO\025\225\364\004\233v~\267\267\035\267\355\314\234\371\371\374jI\263{\267-\035\273mK\"\3350(\222\331\242\337<\251\230\244\r\260\014\322\231N\006\310p\362i\023\224\007\034h\340C\n\312\010\201\224\013\032D\036\031F6\244p\310pA\003\212\210\203\005\224i\241\274\371\2500\262\241$\244\005\031\340C\004d\341\202\351\304\204D22\n\363\277\221?\215\333\362\375\376\231\375\3024\252j\202\214\300\032>\r\262\211l\030\333\235\232\t\273\313\313\005\204\311\021n\200(\320G\274\265\024\021\000\214\007\235\017\020g\001c\017@\203\202\366\251u@tT\270\n\222\306\205\002D\212\210\"\366\224\221}\204buaG\311(/Z\261D\013,\300\343:kB\306\314&\213\2201\222\355\357\220&\354g\006\306\272\300\"\302Dn\303b\207\204\220Z c\334Qr\335\316\211\310\016\347 8|\350\340\000I\010u\214\373\330\3054\"\366\316C\224qs@a\301b\346\343\001\026q[+h\220\022\020\0349\n\237\010\342\371\262:\330[\030\262\177\\t\025f\002\317\356`\007\341@x\260\343a\354\025\n\020\3142\272L\346\301>\177\264\227\005\010\034\350L\034\320\201\302B\226Qa\302\353Ea\252-\240\003\352p""\300E\000\335(X\271\302>\021O\210\310\301\210\265\221;\363\266\007\026\273E\004\013\355\025>\370\340\2223@\311\236\303\330\320\360\354&\350\023a\1770\300\007O\r\212\357\240\227>\200X.\273\213\216\002\270\013\244\235D\261{\030\2329\"\342 \200|\"\331Y\023\322S/W\213\334\220\360\340\346sP\256F\207A\316\000\245\275\202\255#E\367)\256\003\235\306\301\315\233\360\220\210\244\243+\207a\002P\343p\2415p\265<0HN\272\207G\216\001\0025\n\240\033\0007\227\010\274\277G#s\000Xo\036F\003\237q\362}\372K\030\206r^)\033\211\205\3179\345r&\316\343\360\216O\256&\002\307\214\207\220MD\001=\364\261\363\340\326\341\223\373\344pP\\\230\000\340\002\341\223\243\330\310\231\3607\260\243F\307\325\321\320\351\200\033q@\340\010\331mj\340zS\271\2655\020\027\034\025rF\\\0008\262\302\256\202{0\347\262\332I9*\"\273\310\206\013\004-\247\257d\\\250\03037,\200\003\216ED\304\231\237pr\006\374\006\032Z#\341\004\005\3271\334X\333\310\002\323\215\306\005\000T\305\310E\001\226q/\300\366\301`\302\002u\361qO@\261``\023U4\310\325\3400\274\030\253,K\310m\030\002@-Z.J6r(\376\315\234\261qIF\306\374\303A\362\300\013H\320=t\316p\247\020Z\001w\226\217\007\035\n\220t\354\324\344\310\036\274)\353\025$|0:\3521\022\344\263\000h39\302\016\201\313`\253uZ\030\342\200\017\026\271\234\305\316\307\376\001\362\354\031\007\330\322\016\005\3444\240b2|,@\267\226\355D\377\220\300\352jp'\034\313\007.\205\241\241\200\375\202\016\256\301f\2037p\365\013\267\314\330\345\t:\207\314\200\205\205cbB\216i\262\233\304\370i2\332\330\035\204\021;\000j\313\355\000\027\334#&\354.\026*FB\364\2179&\375\200\370\333\315I\"\242\246\002\226\230\360\242c\352\244c\310\036\301\302\324\201\3119\231`\023A)>\022\355\370\234\027\034L\002\203\013\313\241\266\010\226\224\213\326>\264\223#\347\305\245\210v\035\002\r\302\302\375\240b*.d\223\302\314\205\n\006;\020!3nD\317\211\234\227\220\261\023\341\306\345x\201=\3105\\:\210\203\364\260\201a^\334Xj^\202\245\226\353\002\350\025\306\010\031\267\323\206\241\262\2564\004)\334\313-\304\330A\257\016\002$\200h\"\034\034""\n\310\016\242\241\213\257\010\016\210\006\032\022\263\332K\216\304\313\351\3224B\234\303\345\243\323\224\366t\244\366 C\364\222\345\314\200!7\031\252\014\254\023\300a#\323\301\232\250a\002FK\220\223\315\324H\237C\342\342[\202[\204}\242\302&\241w\0269\030\316\005g\"\331\023\250\201'\216\271\242\221s_l\260\215\034h\307%\347#Ge\264\341\261\243\303\342w\032\212\032\353\306\301\261K\230X\014\235M}\304\224\206\001\203\016\352\001\3503\331\250\342\243\003\241\203\312\021y\260\177j\0344\210\214\010!\027\210\200\032\360cgaP+6\001p\031 \032\266\020\005\211\213\317\206\203\264n,\0020m0-M\303\226\261\326*@\220\314\320\276\032\005\023,l\271\277\3056\220\365&cC\240\000\002\202,b\201\000\265PFW\200&\2417\320'j(\014\035\"*\025\026r9\031n0\233\206\215]k\n\324\030\2009\215\003B\024\273\356+k\027\351|t\336\034\227\234S\302>\222\341\300A\211\203\035\234h-\020=X\354\013\"\032\244P\266\030\005\350\006\002\003\005$\200\373r\333\311\226W0\340q+7Z\017}l2\375F\242\346@\266#r\203m\004\2305\250\007\03479\0277s\323\260@\200C\3350f\\\332FE\216\303\206}\203\313\036\322\201sd8\027\227R\262[\344\031\271\016\216\267\203\2202\331\013\320?r\232\203\034\025\223\035\203\016SCC\034~\0033lr }\3667\005\266\217\016\r\001{GNJ\2536\341c@\273\267\034v\016\031\366\014\255\035\225\335\024\320q\321\201\345X\300\2256\220\255\245\237\324 \\\354\\`x\227\355C\240\273j*5\332\2459\230\360H|\270\360\251\270y\240\035t\261Ss\003;r\031$\267\031B\306\203\335\305i\340B7\000Z\020\035\036Xx*>\270\340N \350 \t\021!\025\020v\022\302F\262\261\203\344r\026\025\010j\034:\233\273x\365\n\030;\252&a\302\003~0\031\200\310!\215\037\033MmB\205\004\206\254\006\252\340\234\257)\240]\270\310\237Z\207\016\215\003\221A\335\036\346\314Z\204\227f\001\"\347\200\233\014\245\226\241\300$\301X\2233!b\007\335<D\200\024\354|l\035j \210\326\3021\021\304\272\205\232\232\013\006\"\317\016a\013mc\203\335\255\021\220\253\321C\016v\220M\204\266h`\001\252\2154\022\204\363`3\211\330\345\231}\006\266\303b\366\030v\247;n\242\355\245\0143^\246\255\324_\\\233""\005\375#\303\204\224\323\310\310\270\270\360jx\000\265\225\346\231dF\310\036r#\300\366rm3p\r\244\326A\373X\354\334$J\357\336D[\010E\355\203\233H\325\340\n\270\331@\330D\372\206ic\321#t\324\354\"\"\255h\220\322!\324X\032\n\232\320\303Z\014\007\214\020eh&-\202\206\302\271\330%p$p(L}\302W\203 \300\236\361a\277\010\237-\250\324RO\244\02224 \000\000 \000\0043A\020$6\225\207\304\222\031q\227s\304f\016\210\221f\"3\"\0032\na\204@\221\001\021\030\000\000\000\000\202\000/\3105\025\361\013\34439\312r\203\235\242\365\256\211\221\021o\216\210i\323\370-@I\\\217\275q\231-\306\225\242Y\225!\241:\327H)\354\276V\272\363`\010\212O\207\220_\333[\263\212\201\013\241\233\360:\3716tvT\370\203K\203?\315\006\024\236\n\226\350\305obY\346\255d\355\237\014\255\265\203\021\014\2518'D09\224\324\r\212\320%,\"K\227\025]l\357f7w\360\306\302\245\350\225\207\020\360\025&@L\324>\257'\227?J\361>\365\320kC\033\267\241Q\351\327\347\201\323\223H(\240\235\326[\314\246}l\211<\227\027R\225\301J\232?y\374&\006y\370\2521\024\353\211f\334I\357\267s\036\207\224\021X\352\367F\226p^B\263\001\250\\\243\302\005\222\231\257\250\000/;U\235w'\247i\232\251\326\213\000\352\350\375\362\300\331\307\241IE\324\325.\325\310#k8W\267\377jw\007\244*r\002+\257hO\223\336\241\303\020\353\347\2044\324\323\342U\360\036!\013#\233|<^\332\251\022\250\224\214m\312\225K[\t\354<\274\2459]D\345K\241\031\300\024mq\245\237]\366-\036\263\266\356\342\326\013\n,}\031\010\317\3758\034\271\351s;~\252\177\024\322:\347\n\023\370\212P\\;W\215>j\025!\177\323\252G\022\021\221\336\035\3366\000\002\206ah\313E\314\347\263\265\016@0\000\267\253\314\200\262\022.\2667\213\264\226U^\365D\263)\251[m\330\305L\2318Z\332Z~\255\222\022\2029\016\000\023\316\017\353~\217\267\r\244\325cG\225\360%\032(\302\237t\207\232\236\246\037\222\332\020\002$\006\221\ntQ\031\205!\373\374!|\216;G\276\201\233\002\256\356QD\242r\316\334\034\301\017(0\351\000g\033)\214\374\265\024\360D\005d\372\360\260\372\032hAw\213\332\204\343x\243\204`\334`\204\334$\355\177\242\222\370\033r\204A""\275S\262l\264j41\355\3045Y\007\315\320'\341\203\367*2\323z\251\206\375\202\361_O\217\212\n\341\317\217=\305\263\036\336\002j\225\022\245No\342\3474\263\203\202\200\014\261\027\271\355\205Y\215\327\211\326\203\240F%\270hN\376\320\324H\211\225H)\366{\243N}\230_\363x\2034\267b\271\354\256\275\3629\346\322m\307\225\223\204x\337\307\023<\204\231N\360\226{Y\345d\244\272\206\261\267\240\333jy\345\027\006\336q\370\204\232J\241\227\274\035kkX\034\247%\345\222\373\266#y\333l\324\270\"\217\237\230f\316\320\225\264?\330\275\327\207\242\341\355\272\330`7(r^\217N\204\304o\336\030\223\001\361\367\3120\t\344G\030\2747\223\201\202&\340\032\302\274\3208\004\251-\264\371g\244\343\267\024\010\247sG\324\203\005k*r\375\377\232?\032'\021\222\037S\023\216T\201\201\240\222\364\2055+\222\255Q\256c1\332\203\001\375H\027\311K\342\222\254H0\023\374~\266\335\354G\367\227\317ed\341\241\367E\034\237\227i\300\321\307jN\327\244\240\250\022\265N-S\326y\\\363\\\371\3630\354.\027/\227^\201\021n\310+`:{m\020\377\322\032\037\341\254\364x\234\354\337oXBh\222\311\237\n\371\303\024^D2\022\013(\213\315\204V\245\367\246\022t\n\267\024\255\221\037\217\247\t'd+\331\371mdx\225IdN\254\004g\306\013\332E=\325\245\376s?\215\310{W-\231 \222\227\352_\207P\177\206\270;\262\301n\364dO\366]\377\315\262\373V\325\\BH\013\274\315\236\030\322^\216\0170[\013\266\236\0247\241C\n'a\253#\002\313L\002\346\341\371{j\000\312le\317\227Z\266\337\262\013\204\361\021\305\356c\006\261\212\204J>?aq\207\325\274|\213\261\205\360\202*\357\330\030\\\026\227\356\206\023E2\013\025@\2756\024(|x\200\016\325\256\264\"\347\2342\237\304\340\312~\201Yq\254\201\233~- \335\376\343\262\030\225h>\230{\204\3270\006 \253\351(\243\014\322\372-'\005i\276G\305\342\005&\253\274\244\257\203\203\026\001\370)TC\206\233\"H\257e\356\321xr\226\275f\264h\240\202\035\246P\236\323\377p\266\002\201\374e'C\314:\320\322N\202\235\355o\336eQ\301\007\213\304\372S\366m\204,\331Q\001\236C\257\254JU\226\212\346<\236\344$M\335\035*\256\216\212r\006>'Re\271\207\027\241\006r""\217a\203}\344\017\\4\035_\352N4\334~\001\321\355\262K\210/\230a\035(\230\242n\340\247*\240\224\020G&A\034k\351\353$\0325\224}xW\361d\252m\357!a\t\016-\007v\315\230Y\242\304s\335\2315y\n2\305e\366\262\000[\213Y\350\215\222\355\257\222\372C\221\237f\310\310\016\002\242Wx\022\r\032\347N\221\2222\345\375\215\200\036\034\000\036\370\254\320X2\002+\330\346\343}\250rq+p\227\271Y\364Q\305\266\371\241xR\245\251\350\251\317\356L\236 \265\362\211\304g\026*\252+\212\261\374H\353l\\P\211\244\235J\031\224p;U\331\362\010\272\332@\007\366\354\2723gzu\222\250\245\321v\223!\303\266K\002\"\316\252\312\207x\021\343\314\225T\215n\244\024v\332+\301\371\214\232\023 \226/\304\253+\265W\\\210X0\305\221\211!\344\013\222'D\242\252$\033\2455\014\341\027\261&\246\250 \201\361\\\017R\007\244\372\311k\370\212\307\233\303k\324\370\227Y\3554I\007r\222\037\033\362a\005$B\211\350w$\214\365a&\"\007\254\362\026u6\241|\006\033\226\256`\240^\317\376\340S$\232\226H\016\322\255\300\021|k<n~\261\335\317\277\037\204\025\250\204\363\304\013\354#\372$\234\271A\300\326\321\360\316\371\303\236\251\035\214\225-\343\362o\253\023\325\021\343MY\275\360-)\202\255\335\361\335\3013\243\215\202PsT\222\331\325.K\247@\036W\0251\334\320\320\330QB\310\2130\302\211\260_\030?\032W\340\277\371M\347\341\223\340\301\322\337\0145\000\303\350\306\333\022{\223Un\345\030G\231\037\224mr\337\347\377@+\314V\233\260\314\374\340%\235\303@>\221|\201\000\027\202\310`\353\313\207\243\217\215\202\212=9\350\255\322b\344\222\241[R\225.\306\343\237+9\257\241\246\270)q\375\252\372\273\203*\331\346\232\231\nCN\t\212\275,\320\304K\023d\014~\257\241\037\342L\355M\317\344Ep\332\353\221\333(pj\177\337\032a\253=\252\024\302\2223T\237\272f\307\316\212\300)\264\000pA\337e[F\014\216\362\030}h\225\260\245^\247Cwh\375\302\262\2102Y\214\276\225w\315\224\003$D\257/F8\331\352\374o\311\305\204\262\231\240\024\377\007\257{\242\373h{\340\220\277\264\343h\312<t\336F\205\311\337sM7\001W\030\216I\021r\t%V\\\331\r\354\r\\\307\001\212a\030=/\222\210\266\004\3510a""\r\276\340\315A\250\021\347\340\256d\260\357\323\r\207:\210<0\343\272^\277x\016\035\rR\356-\265\005\302A3+\321\3529\327\2072\367\213\304o\326\023IEFH\354 *\251\272@+e\037\330\330>e\356\324\354\356\203\324e\006\240\305\253\330\350&\022\313\023\207\242\263\226&\027\327\030\347X\321\305x\2651\360\356\033\324\231\342\003\205\264*4c\341\307K\232\272%\206t\020Zy7\260\264\343p\343^Q\237\316\251\260x \203@\377\267\206qg\276\221+\253`n\271\211\351\354\376PJ\327\357\260\330\344y\357\264.\360[[f!;m\020\236\316o\361\224C\206\215\3329\217b9\243\244\374\377[\375\314\211\201\177\264(\337C\035T\325\362P\324~BkuG)Xu\310\346@\376\316\353$;\007R\026p\223h_\372D\236\0334\251-Ki\202~\316\275\0242\242\344\317|T\030W\331D\253RV\030t\251\343\031sH\217J#\304\307f>\2332\313\206\234\225\206\222\267\311\303=\322y\220\270\225\203j7\350\354\350\3708\366\222bN\315\327\230\327\370)\366\344\"\317\274\243\036\276#\354\304WXM\"\230\2400X\3365\023\037\310<\3052\310'\027!Dk\300k\206\266\277\221q\265\252\343\244\010\373\010\2400\274\230 \201{.\331\306\032Q\031\\\240\277\227#I\240*\321y\245\206ib\231\250=I\252\n_\271|\257\246w0c\375\030\347)Uj\205\035\033cX\311\215\253\326\002\270\240\344\263\254\305\021m\233\325\320]J\301\211Y\365R\236\365\241\220\275\263:G\315\377 5\253\255\010P\205\344\201\354\355\017;\010\303\t\2758\253\230^\004\010\220\325\014m~^|\205\027\016pb\254\210\364u\032\371B-\310\245\223\241\354\3422\341\203\353\006;\334\237^5\274\203\226\000)\023\234\263\352 \221\320A*`\230\227\270\020\000\235Z\273\017\341\272m\302\236\207\202`\246\000pq\t\313.d\245i\204\013_(\231/\274;Ovt-oa\\\340\314H\263\236\361d\227\223\245\213|\376\224$XY\277\360\350\"\230\262\271\022e\241;kX09a\267\214\3670\250x\277%r*\024\321\202\024\322\177><^\317C y>A\275\247\001\032\233\263\350\305\244\327\004\n\221B\361\003SVa\227\245'\231bm\252\310\026\203\031\245\213K\303\266\036\264q\225p\t\364\320K\016;\245$ \222\243\034\270\\!Y\223i\337)\331]#MIN\363`\274\302\365\317\022\202<\326\016)\246#\033`\315\226{\262\333\322nm\000""\\3\372<\3132)\242\032vT\360\221b\302\237\010\370\014\340\316P\033\352\331\345\203J\354\225AQ\343\353\226*\331V\212\256q\254P \366\221\270\3300\271#\224\030\360\374\273\370\031B\244\307\330>\230_\3234\326i\2540\313\336\357/\206h\326Y\027\370\261\314\276<%S\356\230\000\030e\265\371\240G\264\357}\030\376e\307 x3b\302{\375\013\255tI\225\3550\361\315\345\314\314\376\0323\206E2Q\355|\"\206\300\002\266k\202\243 O\001\2749\254\320\r3\307d\032\177LbNY\322\\\364 \222x0U3\206\024!\227\233\316\325\255\016\355<j\2332\334}\030,X\320\000\365%\216$\234KXI{S\013j\311G\030\336\301\246\354c\222_\272Zh\314\264S\017gj\245\344\t\340&\214Zd\221G\335\261\356wR$\231\371\315{\345\212\030\356\324\352c%\220\275_\356\226\304\010g\371l)\003=\265U\216\254Z\265E\230\207\363C\357\252\266\247\202\323\355\360\n\211\000\205\227X0\034S\337\301\016\226\253\211r\370O!bI\363\320P\223E\004\363\232M=\375\177D\026#\027`\3127\255:l\001 \037\343\224A\335\340\306\232'Y\t\213JS\321\304_\025\232\021/\267\331$\004\222\327\3118\242\236\253\263Q\270 \204\307H\360\367\016\317Y\367\320\202R\335\tO\214{5\000\333\271\323\273\347O\366\277\277\325\024\207\241\260\005u\366/B\035\231b\004Bdb\335\344AQ\372\023l\355l\204\373\314\246UG\255\275\360;4\337u\351E\330X-\222\2565^@k\202G5D\022\206\244\232\207\304y\250I\207\302&\025\250\212\022z\215OUqbs\002\244\233\332\250V\300\335\033\200\006^\315\004\347:\214\007P\317\002r\034\256\344\2076\222\325\235\305\240\300X\010\201\211\206\243\202\177\312r\324\352\304;N\231\264\202\366\356\347x|\265\265\261\335\236h&\350^6\325\377\225\007:IS'\356y\262C=\370\373Bj.Xml\\\243j2l\364\263{\177\333\226i\023\024\206\317`\214\352B\014Nf|:\314\017\372\343\213\277&3\246\363I\221\347u\004\217\001S\007*\221\035Om{A\337\2752\367X\322\336;\212;\212\352\245\001Q\263*\217\004\353\246\306\031\355n\020\3169p\255\3456\343\311\000v\r!\367\002@\376\242\307\323\301\0335\251\355\221?e;Q\006\312nk(\027\024Z\215\200u\036\210\356<`\246B\326\022\315\225V1\305gV0%\300\236\006H\000[\274Y\346e\246\312\276D\217\234\347""\\+#\177\302e\235\203y\350\321$\363f\307\014\264\361\t\220C\244-\365*\214\244G\246\220\374\316m'n$\220\313\033\273m\210\266\"eD\357\003q\275\327\201f\372\231\026@\220\315#[T\245@a\004\333\010F`x\036~\025d\352\307c\013\r~Fj\235\016\010\322\321\334\321n\334P\t\303\333\021qg\020pLO\326OqQ\216\331n\033\345\033^\370\231oW\031\022\216\364N\334\223\235\017{\347\002\336\202\034=H\320i\nSd\r\254\220h\340a\344\017\013\226\350LT\301\234\247\033\231\255\311\211\310\341s&\206\200\235\274W]\231+\217\027\221\233\255P\345\346\037O\315\314\302\326\r\022\337[\002\256KnO\225X\337p.\342\260\232\332\226\311\207\023E[\3275\220%\261\366\027;@\340\014\361\340\257\013R\206j\320\365*\020E2\003\275\303\312\343\205\001\2637\220\327T\243\260\333P\014@-n\006\035\003(\321\300P\244z\367\334\260\002\260Y3z\007\3657Ua$\035\322\003Pt_\306\360\315-a3A\203\276\3644f;v\005\323\020\365\215\210\246D\204\312\250\336]\210\237J~\252\215\2541\262\014)qN\207f\364'-yj\3229W[\211\034\325\313td\322\343\376\227\275d\322yxr\tJ\2506nZ\254\207\3177\364\264\377\371`\303Z=\230\364\347\264S\221\336N\353r\200N1\263\230\327\017\315\202\247\376\316)\226v\3350\202\262[\306\266;)\366\201\033\016MpR4V\330\0330\t\030\2113\240\346\024\375\361|\351H\330#\324\262\301R5\374\305\353o\356d\330q o\252\034G\223x\336\221N\275\237\2523\214&P\316\240\250\230\206{c;%.#\272\036\332\rc\254\312\024I\203\267\347\260L\365\014T\372\036\322P\333\352\252\331\346\352*[E\354\212\344\351W\204\033=g\006\261\357M\203\267^\250\210nGk\330\250\304\212\214\224q\314\210\027\004\376\016\001\241\277w\323\205\241g\340^\037\362?\260\344\364M?Qmy|vp\315\300\330S\213\037}1\325QQGsw\335\220\363\216G\347(\205\340\035\270\306LI\362t\3366\255\220\357.\332\254\341\231G\217\217\255`\212\312\023\273\027!\272\230G\032N\312dx\345\230\rhSrh\333\316o\363/\262\252\363\377\262\303\372\222\374\271\017\362\226\224\367\202\177\237\215\026\320\325\214E\031\237\225*\350\"\020\375\030Bo\006\r\\\0078\227X\244\205\377\265\342\"%\345\"\030\344RJ\234\353w\021\325\223\341\372At2n]\001""\343\240\271;i\377\352:\365g\334*C\027\275\260<>\367\326a\215\347+\267\356\273\305\327mk\307Y\360\212\031\331|<m\235\003aG\303\026\304zfH\r\311\230\314\251{\205\330\n\326TM\251\330\2544\234\211\2627\316:\272\024e*\030c\305\201\265\331\355m6\222yI\006\247\277w0\003\270R\323\315>\000aQ\342\337\021\335#*93\226\t\250\344\310b\356l+\265\346\306\355E\257S\017\371?\203\343\000\005\036\316\201\274 \240yMDS2\254C*\322\314I\235\177\376\353\214\351\276\0255b\270\353\316E\350\203,L\txd\177\344*\263c\363\032\036m\276p\261}8r\367j\226@bo$j\013\006\005\322\031\327.\305\231\252iRHY\336]\026\250s\302z\024\273N\212}\225f\221wJ\236\355\222\023\373\232\342B\325-\277\250m\225\205\231]\023\\\342\370M\327\023U\234V\234\376\023\300T\222vvz\036-@\267\313H\t\314\253\370\233\377\221\273\231\305$\262p-3O\360\336\014\211\275\357\005aP&j\277\024\367\374+3\021\362\211\373:\303\220D\201V\234\273\244\327\334\270\200\343\351\340\254\254\240?\036)G\246\202\236.\225%Q&j\001>\0107\215st\202<\025/S\276\014\316Xqf\371\031\3047\350\324\375I\366.\212\315\335u3\204c\200\261\350\032cg\370\307\001V2\366\230\204@P\356\311\303\227g!\026\205&\"\357\371\376T\355\346\311\215\t\355\001\022D{\243H m`\031\337Qr4E[\237\260`y\342\0336u\354\237\341}@d\202V\236\252\3558[Xja\244\253\030\203\025\317\347F,\255a\333\227\030\006\377\334\207\241\026\275\235:\017\014\364\330\253l[qP\300\274\331\205\220\232\3610\t<\271\370\032\234\311\254\\\224\300\010\300[s\237\303B6\356\333\267\215\207C\020\251\n\325\r\347\304\210\314M\235\224\377\265v\215\3529\020\nF\232\025\275\337\234\266\025\265\331\314\237\360\030zxy\275\350\311\336\025\356\2021l89V#\033\330\003w\253\025\0048k\346U\361\371\346|u\361R\032\252pq\322PW\3134\201\333\202d\327\217\347\274\356\204[\376\377\206\003D\021\354Vr\256\375B\302X\307'\254\266\363OV\305i\370\037\374\0052\256\250a\254\024\265\227.\"\303R\243.\330\330\216.RN\254A\304\246\242\234\270\322\027\254!\214ix\201\275\3173\325\017\212\201=\363\342\353\242mK\027\004\213K\007\3354\230\340\260\003,\332\256\366\226""\014\210\025*\t\202\370VTD\375\314O\330\333=!r\233\2479?S\371g(\251\036\027\335\317\364\271\207|\322\360\370\272\tO\260\244\265\324\262\304a\205\335\026 \237M\330\006\344\372\263\257n\306_\373\240\325/?Lp\333;OL\036\254\354\327\221\254\324\303\n\255\374\221\364\313Fg\007\035\313\320\234\375\377\2422\223\235\310ga\236d\035\234l7\264J\337\362\023\342\225\367\337\356\362\3127F\177q6\220I\006J\241\361\337\026'\341\312\203f\031\357\261j\316\264H\244o\341\3378\2019\177\352}\337~\345H=\235$\2263S*\033&\254\013+\253\310;~\335\3741\246v\307\031U\314\364\375:\021\364e\310\357{\"\215JtW\230\"\264\261\363\233J6\350\341\262\203\311\014\336$\237>\254\032\203\237!\t7\267\332\247Bl\376\314(\266'\t~h\3540\302\340T\363\254\200\313s\026\370\304Af@\033\320B\212E\264l\023\005\014\254\025\275as\013\307\326\370\200\034]<g\3723\037\377\217G\337A\tWS\005g\312\333\364$\267w\021$\202{X\276kM\324\250sD\331\344\022\2328\273\222\372Q\256(+\226\006\341\"\334\347)\243\003\201\2647\024\262z)R\237\272\306\325\272\346\016J\020\252\250oE\262\241\000#P\365\362>\272N#8gX\326\\\2000\275\006\204\013o5\352\027\230\234H%\014c\tE\356\275\333?i\257P\242\313\030\231\232*}\037\\\370u\037\202\027\373\355$\364`!\034j\003)\000\r\271\025r\200\307\356\253B\305Z\3207J\233I8\335I\222H\352I\321\374\315\370F\302\000\320\246\321S~=_\037\264\016\002\203\351U[P\320\275\314Kj\033\324.]i\024\270%\346\r\n\374Mf\370ptb\002yJ\2635\264\210@'\310\274NH\371C\260C\335\010#RtVcz+\271\014U\345:\357%\330\255\255\326\221`\021\211\212\213o*t\270u\336,\261)\234y\312 \233FG\315\244F\030\342S\374\024\256'M\242i\311\313C\324\024\nN.\367\2305\340\331\312\345,\271\314\036\234\021\221(\023=\344tDL\324K\257m\275P\275\221?e\037\240\343\001\272\nf\376\205\021\234\204m\316\267\\\271\253x\273\362\202\210\360\020#7{U\203\367o\241w'1\303T\200\3358\021y\307\244\231\t\362|\261^\211\200\033\"\376Z\252\024\334t\217\374\003\332\231O\231~>\236\211\361\215\224\260l\330\371\013b\357N\372i\373{\034,?\030\256w\356\002\256_\275\035\006\341\252\222\005\301\215i""\016\026\0063\327\366\303\013\226\361I; \305\220?8:&\326\017\265L\014\340\376\3431\332&}R\325\221U\003]\017\200%Z\034\200A[\232\r\006F\324\334\331\330\307Bi'\340k\017\357Lx\331\343\246\262\202\003\353:Z1\355\033\321[\273\nB\n\217\251\010\236\216\335\026\317|fz\010O?\314\301\340a\252&\245\352\252\272\356\363\004\220\365\326\222\277T\271\356<\243\215\277\333b#\342\350\005\267\204\205\222\240\375\264\310cU\024\\\306h\276v\315E,\273\265\255\317\003l\322\016w\001\325\014\300\310\017\250j@\226\253)\td\n\341\324%X\250\0147\336\312\001\004\340\020=s\021\331\034\341.\237\377-\020\031\343\231\304\026^\354d=\3755\263\215-\024\264\215:\320o=\004V|d\252\254cZ\030\361\273\001\350\020\236\357w\23555V\203\243\233\376X\321\r-V\307\021\r\371M\355\205\254\024\031\024x\320v\306\200.\n\330\237\316\007\375d\014\322ms\360\\6.7\224)!\360\225\307\2709\020\271\307\350\310M\377\371\0205o\233D\005R\243\177h\337\307\254\367M)\273V|zF\nl\375\337\330[\310.\300\267\376\032ys\236\213\017\320\336\303hPF\000\307#\240\341B\205\003\355;B\002\245\326\022-\271O1\004\310\255\205-\004\\\364\245\237\231kS\355\310C\363\3650n\016\206\332W.\036\033\360\207A`]+dyCe\364\365\311\310pZ,UP\242\004/vV\230\321\251x\374y\202.\221\227O\n<\336 \3336\273\314\244\211\235\002\225\r\311\240\314\005p\260\022\316\213\210\302\367\253\360\317\273NK\020\227\222'\3527D\374Q/q\351\202t\216\316~<\317XXI\322\371\367\361\212\314\337vH\302]\345\307\0301\205xC\263\210s+\n\237+\276(\223\204\374\332\323ERE\330\371\266\221V\224\222\364w\326\005\177\230\016)(\220|c\355\255\261\253\211t1G\223\327\272\343\273\240\221Q\214(|X\212)\374A.M\262_\227\035\231,\260g\350\254\010QxE\ra\265\002\246\306\350W\373j\244cl\360p\236\304\266c@\031\323\320\325\267\033\376L\0003%\253&(\340\242\236\322H\260 \017\363\334\376Y-I\021n3\371\032t\202`\033 \003\032\331\033\272\"\230_E\336\365<D\t\004](\2552\335\n\373\342?\203\316<.\356\370\026\t\324\240\017\361\232V:\253/7Z5\230\201\312G\003\321\260\025\266\251\022Y/\021T\000H \252*w>\326\010(\341X\374\026\025u\320""\211K4gg\301F\303\317^\273+ba~st\274\216XhO\033\315\021\331\244y\353\250&\267\224\375gB\010\242B\022\336\303\364*\326\337\243'tI _\360\033\t\221\313\270\033 \211|3\333'X\362V\264'\246A\361\243!\332KAu\361t\272*\221l\203\244\033\266\310\367\221\340\266\274X\320\203\276\272H\024\2417\373\202Z!\026(\276a\325\244D\2216_\2470\303\347i\036\001\324\3524\266lp8\332\340\356\265\343tr\353\205\323\242&c\345\013\t\376\031$eaP:>N'\337P2\034\320\220\022C\000gYx\036\207|L5\242\203\005\226+\243\330(\340_B\021\037p\n\326H\236\r\t\261uAs\024\230(\222\270\204u\365,\306\031\327\277\340\032\272EkWU\277\203G\325\2335\2600\313\364\023f\220\220\332J\342M\024\350\246\265\256\307\343FZ\266JB\035W\226\177h(i\254\377\253b\256XH\177\307\325'\352|@\266S\243\246\325\330\261)\007g\"\206\372\202\202ol\310\210\226\355\211\220\235\341yv\316\227#Lt\024\\\022\036q\031\217\261\2744\201%\341HS\201\005\2739L\346\374\246\234\027\031p\326\353\332Ro\021t\007E\376\305\325\024\337t\t\263\2700\250\354\270X\326\307y\212\0207\034\305(\350\214w]\234\226\201d\352\231\306\177\000\036\020\203<\320\250\305u\215\033\221\250 \240\364\342\345S\021\261)\235A\351\301\300\320\374x\252/H\244K)\3318\006\031:\032\257\025V\033D\247\357\227J\216\206|\031\205}\242T\205E\361\327|\216\222\344b-\"\303Tf8H\234{\235\322\323P\200%\264[j)Q\310[\222P\231s\237\214M\177\216t\021\227z\204\227\2073\020\314N\211\034WA-\212\332z\321Isk\315\245\250\345UB\312\037^\246\256\341\335b\362\245\232\261\3715\205\207R\305M\n\326\270\tO@.\240\202\357\337V\320\212$`\347\330\344\025\273\376\002P\377\365\364\003j\271@\2242[A\316+|m\020-\323\002\202g\220\275x\211\255\336\212&\310Xp'\371\267 9\375\324L\345\206\330\013\250\320\337\233\n\221d\333\307\025{\201\t\247Ic)\336\223p>G[\3014 \345X\314V=\327{\202\241\n\213cn\032-NE\344\022v\036uL\272\313\013\261\223j\242f\364\361\224\260\205\020\3439\326U\364\233\3767\364?\211\362B\322\244\276~}\261T\237\226W\027.\374\275\013\022\367\313\240-L52&\354\035\272\324\345|\034Sn2\276\240\372\231\301\017Gs\203\255I\257;\264""\315s\274\3439\032j\241\342qX\342^\366QA\214\272\300jj\200\364\034\276\212jUY\306\230R0\025\244\241\254\332\300s1\331\341\214\340\336I!\262\321G\013}\303q\3153\232Kf\373\374f\006\2519\253%:\275Ac\330\227\031\235\375\362@+\\\t4\354\034\234TM)Q\227n\323\010F\245.\"\335R\354\231\372\035s\200\021\313\025\350\342.\244\312\341\365\010\233\357\232\021j\245\r\024\204\200f\345Y\271\255\350\325\346/\357\364K\366=\342\216I|8(4+\022\003\3355\3658z\355r\177\213u\354\376\253J\3778\206C\261\314}F|e\016\350a\350\005\214+\203#\211\260\024\263\357\353Hf2-\365\013\305FB\211\013\264\023\336\010?\377!gW\275\210N\246\007G\223\n\230\235<&pC\243\002\255\273j\2637be\177 4E\210\002H\000y\373\273\210\020\003\302\321@0\007u\314\315\035$\234V<\007\373\365\\\367~s\363\215a2\227+~9\234O\367\2368\034qB'\343\360\031u\330\316\305gM(i\375\327\251\254Y\275T\004E\25616\")\370l\353\332\350\025H\216\242\305\031L\374\320[\024\"\242\334.\242\345\352\302\250H0\347\273\331b\202\306\240p'\265\216\210#a|\271\312\244\252~\255&i\316\251l\232\207W\247\231\345^\302\237CW\375x?.\32130\021\017\033\t5\275\256}\235S\t\310\306\260\345PZ\017\000\370~\231\327\351\013T\002N\214\302/3\351&\024\267o\004\254\000\301\352%\262.\267\246\250\274r\325\256g\202\022$I&\377\022\313+\353\250\352\030\307)S\004'\223\342\373-\256\177\027\207d?V\317'\000JY\350\321\033\300\266P\351\350\262\024\001\024LY\350\022\246P]n:\013\004T\354\341\315\333l\216Y\014X\005\315\374\032\203^G\303\0338\373\032\263\261|\212\220\357i\230[\307\024d\231\266\231\234\227\242\322\223\"9\263%4\200\2541Y(\210v\006KxAN\275\207\273\234\325\363\267\323\025BU\342\355\202\243\177VY\241+[\"\277Bf\3720\035\000j\365\021\372\262\260on\021\336\322\323)V\026$\3204R\270\302>W\r\264P\324\234\362\350\334\230\357\327x\002A\303\266\020:\276}\242\024\241\025\202\305\034\205\247h5\t5\365\036w\001\325\264\351/A\241\243VuLMtn\241\201\010\312\366\346G\237\232\350?\205\345\355%\334\301\001\265A+u[\302\265m\375\3022w?\306zaJp\216gZ\346E\032\363\\\007&\0318\026!\023\210\361\025\326\220""\342%\342\030\367\351\210k\230\310\331|\305\002M^<\2125\303\364\222\346\026\316vv\\@T\037$\t\010\243\355\315\241\371\"\2014c\212\337b\357j\027r\351\231\364\316AN\233\271\014B\214#;\265\2629\\\332|\254uK\272\211\213\037Ux\260\331]\274KJ1S;\362\237T\223\351\376\035 \277\r\264\267\014\323x\266\224d\310{\337\233f0\276\252\274\373\206\227A\032\372/\031*\344\217;\225\245\001\000>\230\216e\360#V\265aA\322-\tfE(\347\271\003\254%>,\324AF\322\310_\230\263A\257\000\277\235\n\303\265m\016\351\267\346\343\300q\212\213?\364\322\212\005\337/\365\303\221\336\234\02094\342\010:S\313\241|[\t\341\206\367\022q\356\367v\343K\255b\254R?1\345\005\240\243\032\367T\252\032\326\203\017 \332@Y|\246B#\340\351\221W\242a\\\271\266\356f\225\033\312\261\003$n\350\273\312\322\0277y&\212\242\324V|\216\323M\013\301\213\376\303\341\241\2011\317\370\225\222\201\025\316\367iv\325`=\2500|\327E\260m\223\372\013\3426\303\260U;\237zH\251\315y\213Hz5S\3477zQ\316{?\201_\014\320\372\273\276\311\310\326\226~\345[A\225\3254\371\371\263AO\264>\334\334\341\031r\234L\002\220\003\200(]\345\371\205\250`\300\201\\%\331\344\213N\002\345'N\023T\361-\311O\222*@Y\331]\230#\213\335\373\0062\262\034Q\353\326\357\273E\363$\365\214\315\304QXZC\025%\003\0014W\031.*\357<\355\375\264\002QjO\332\367\214\337\203\244\370\2145>\322\2362\241b\027\307\277Y]7\344\225\3016\277\020\320\215\312\027\307\027\014\3063\374\033\2339\231\031\2008@V\206|)\022k\nh\r\374\373o=8\000L\367\223\000\000\342\344\006\363\013L\211B\300\310Wb\250(u\205\263\254\260\370\304\007\262\202j]\024\311:\367\343m\241\270z\326]\374a\222\030\342\272\305\2001\324\220e[\317\241\317\377\237 \327\033\244\321\252\034\030\016\300\361}\360j\315\242\334\227\270\t\027\007\201\226KT\325\356\341\254YI\224\000\262p\372\014\314\226}\243}\372_\256^]+\277_K/b\373>\rS\346\0255\273\267\337U\200\216;\212\004Y\n]si7\340\017i@\3470\r\344\323r\024\"L\311h\301\272 \323\275\213\244\215\263\327m\220\260\254g\314\261NL\013I\220\252z\325GD\265\255\035z\\\231w^\224\317\367o\213K=\242\340\223~""\\G0\236D\033l\321\365\254SI}\201Y\265oi\372(\306Fa\206\220C\300'D\013@A\357;g\275\246\324E\322\357\237\337\023\342\265\246\341\016H\232\201\036o\217\215:\000\321\277\302z\266n9>\334\233\361\224\220\014\"'\023,hG\276\304[\202\023\326d\256D\267BSo\025YK\335\301\237l\206\3649\017:\224\322\305\204\036\240t\236d.\210\272\316\353\375\317\354\037,0\367\244\323\322\377\257\"\321\310\263Ml\177\345q\307\n)+\020\221)B\032.:\227N\032/,0\336L(\0105^\341\244\375j \260\333s\367&Q?\0336\233\250\007\263q\224\326\002\021\361\270C\347`\322\256\240aM\253\310\232/f\347T\033\312\236\217\316&M^\334&)\201\362\010\003m&J\003\305L*%\344]:\226v\226\370\022H\005e\301\271\234#-\201S\373\223\211\312</dRX\227b?4\336\326P\0108\263\031\335\005f\327\017\337\211\217h\330\r\2330<+\376\375)\300\223\277Q\247^2HB\226\320\372\004\331A\246\034\024QW\313Y\252\324\367o<\204g\252\021\177am\245\242\t@\010\346\211\237\313\225\336b^.\275\014^\2144Qd\215)\273\213\305!\204\210\355\004\r\003\022\361M\026\344]\371\301&n(\006;\020{ \361\353\036\331\2003\022\220\336M6\277;\271\277\t7zq\367\026q\260\311\020\275\260\245\373\302u\322\375rxp\273\206i\3020\023\247\206\373\231g\331\303\312\222^\324\347\211V`:\000^\0029\304U\241\037\334)?\035\272\\\300\267\302\207r\364\223\354\316\236\345$yG\256\245\242\014\325\335\177I\264\271:/\262:\354F\373_iW\006\274U\277\216>\362\263\006\204\360\202\351i\203\227Ba2M!\3609h)\303\257\022\204\273\3422\361\333s\t6\2401\356\273\377\344\303\024;\273\3259\205\306=\031\001<\035\241|\266\3751\304\230!\264#e6\235\033\363\202\310\3358*\373v\"=]\272\263\370\002\256j\204G\013\370\350s\306\273\372Y\312Q\323\210\034N\022}p\364\021\357x\353\315prU\342\006\243\177Rf\020\020\230u\325\245\337\n(r\367\330L\305:\240\001\024\2267H\370\301\022#\235\314\347g\377\324c\020\323\250\"\014q\244U\032'\271]D\243\220\177\212b\245\004\236\n\306\370\034:\212\317\3460\325'\333\321\200\325\021.C\300\274\343f\004\207mz\010\311\274d\331\202\314\360\330D1\022\n(\206\241'\034O\250J\244\233T\016\r\342\212\246@\260V\177\244""\235Qy+\374e\023U\203\241'\020\255r\365\374\246F\346\351\240!\220\022\213F\356\330N\226\026:\030;\004\324o\275,\223+\0063\020\321c\246\213\323\211\"-\276$\371\211\340?4\006#N\241\340\217\212\323\215p\211\000@\233T\335\375;K\334Qr\322\377\345~\304y:\371\201\301\303\233L\007\2457\226=\311\023\377\226\202\326q\005>\311\200\336\366}\242\266@\246\247.X_\036\316\347\330\023f\203\357\376@\026w\263\007\224<~\006\007\363G\360K\341\243\344sz\360\037fD\2346\022\010\364x\"'\301\177\033\375\n\265UY\2375\316^t\307\205\030\203\216\277L\306\207\202x\256\204+nF\361\2768\032\205\235\205XuRt\361\246\240=\n\2615\300~\303\003\000\035\267<\022\243\362gfK\376\033\260\\\010\366\306D\322\365\350\353t\373\354\272\346\3538\206\227\322\313\336\332\t\222M\370\036O\301\306\014\257%\234Ta\202\010\237\031O;S\274\251%\364G\223\024\237G@)\177r\n\333\334\254\351\351\027\327[\260X\022\316\010\243o%v\236\321j\217\033\374c(\307F\303wl\221\021K.*`\242@QD\376d\343\363\250K_\333-?d\272\312\327L\206\035\026\225\266\245\221\200\334\201z\252Y| 8&\375\262\321\231\274\315U\355a\206\237\306\005N\321\350P\001\231Tm~# y,,\337\301\330\372r(\341\310\244\277\3469\352\216Ru\2343\305\207\255\207\304\025$\026\023\320\241W\216~\235\374\037n\\\357\311rR23`\035\367\240\201\325\355c0\354\272%o\236q\327\351H\267\274\341IG\210\237\374n\020g\320\"\376\213\023\253,\244\277\273\247\332>\302\316\215\224\250m\026}\347\016\251\2572SJ\253\327G\303%i\325Q\324\240\2212\311\351\023\253\t\204l\331\227\006\321@\267\355'\005j\031i\270w\274i\326T^\215\030&(\325\345\351&I\362\256\034(\312w,\315!\242\250\034G\264\260\226S\001\231\234\313j-\030\346\3222\025\221\004F\237>\203\004\265EO\235i\277\244\213\203H\340\345z\332gJ=)Z\272O\246\034\242\007\323\347\336N\240g~\306\311\3765i\210\251\370\223n\200\333\202 \361E\020\340\261&\327\207\032@Ia^\256\2222U\003\325%a\241\272+\352\337\003\202\216\363\324z/\020\357N\236\021\034\017,Z_\217\354\274z\313\334\373\036j\r\304F_\247H\251\016\226c\272\261m)\366CP\024\342\327\366\351\244\245\360?\255\325\235c""\250Z\2061\2629k\310CC\021\037\257\233\317\363/'\360p\321=d\320\350\241L{_D(t\226\341T\323\256\007Y\243\031c\270\016\216E:<)C\210\241\3234\2518(\026<\376\356\373\331\210&_\301\016\262K\337XvK\315\311\227\301(\263\236\243\230\333\364z9\345{#\200\271y\033\270FF\232*\030k\034\373>\251\323mY\002z\002\205A~\220\304\333\256\311\006,\230s\026\034\2669\316\217%\337;6\023t\372c\2759\375D=2%\016\30382\3074s\326\351\312\371\204\225\236\342\210\301\377\335\025\275\360\265\344D\334Y\027\275/\357\005\r\026\212\336\211P\201\r`]s9\250\255\247\210\303\331K\r'O5\030\255z\005\210\005X\257\215\226s\232\335\201\320\217e\320Z?\227\254a\377\372\247\211\225}d\251\027\373\376h\251\"'8\312N\247\201\002b\202?\223\004J\000S`\014\323b:$\306\334U\313M9\036\215\236Ml\036l\267\000%\360\333\361i\354_\26476\245,\211\204\000\215\311\300\360E\222\223\331\024T\375v\302\264\243\302\002A\257\007\013t\332.H,\031\274c\325\212%1\342\001\260\334\324\361\241|\200\222\246\324G7M\374\316\301\217\317ca\267\331\314\276\320b\232\325\352\335\224\021c\213w\256\t\354\276\032\343\225\002\254\310\224\352Qm\235ZP\236\214\303\367\033\324W\234\206mjF\311\214\215\317\216\365.\204^\362\314\257\374\355\r\005\177>t\364\322=\303\007\"\274\254\256\177\322\200n\243\230\026\001\243T\303\327\374\3528\331{<@\177Y\201\364\274,{\025\224\023Tb\375\366\236\001\006[\200w\206\320\346\321|\001\3413\320q\377\253\211\035\227\266C\332\001E<\025\233k\213\217J\010\037\262\354\242\350\244\201\327\355\01070l\370Ok\025.J\276+\220v/jB\236\006\003\237\300\311\353\306\376\246+C\024f_\327%\251Y\320\316\374\377\347%Q\014\240\240\237Z\331Ca@\202\031\025\240\277\340\371\240#\232t\204\242`~@\330u\241\232\317n'\035\021I\231\274\252\252n\305[5GA\005q\372P\310\370\356\023\343\213\035\200Z\366b\211\316\234\234\202\257\307~\265\265lQ\255\270A6\232\316Ej4\013(\276\2766\031\003\3317\326\251\201I2?'1k\017l)\311\242\375\313\215f2\371\027\345\2705\35503\361\207\2143>e\234\305\332 \304U\210\205o\252A\025\204\367\365\316p(\277L\365e\365cH\007\243\262\005M\001\227""\316R\346\257\3218-\254\020V\021\270\001\260\250\010\307\240@\352\310\255\230}={?q>\341\215\032a\303\n\245\234v\275NUF5E\037\331\326\232W\375\343\266\356\307\254<\003Sg\003\316\236p\355NR.\014\024\371\243#Z\022\350\nR\234X\310g{\024/\2057\360]\275N<\0064\377I\374$\262-K3\234\322\311\353\373\036\355R\331B\272\026X0J\250(\315\211md\337\365V\357WI\006\317\036Y\014z\325\021\240e\302\321\253\336/\262\264-C4\353#\332\037\337W\201\030t\204\364\200\2077\234H\356\225#\240t\303\002\030y`\315\241\242\333Bt\371\237\252GK\035\024\360\027\036\230V\037\352\030\002\255\230\037\021w\275\316\3073r\324\234\336\366\304\256\203\225\332b\242B\235p\227*d\241)\032T\347\227\303\374\242\225j\355\344\t\037\2209\246I\017[\\~\344\335\317&\373=U\357\372\310\240\274g)c\323yg2p\330\256\265\374\202\220\003\215\237I\003#Bg\340\236\220\257F\225{\254\365(Lt\006`\301M^[=*bBH&\322I$\221\275\310d\220\rm\315afy:\302`\022\233Lq\377\010\240Wj\323\004\234$\375\360\266h\345\023/\010\235\350\336\251\205!\246\022\025\205\350x\346\025\007\261\022\2436]\240G\333\353\213\024\211\036\320<+\270\326\244\274\022f\324\201\r\2005\322\316[B\350Q\001( }\250\301\336\325\273&\375\254U9\224Y8J:\257\217h\371n\217\350\227;n\202=\315KZ|\020\270\032Dy9\254\271j\263\336\301\202\007*Aj\023\024\203>\215\310\271jV\037\225\377\344/h\004\366\007\226\351\000\017l\340\321\204\243t0\030>\300\317\225;\254]C\222~1\r\201\220\004\201IZ\241\343\333\261\2243s\212|\262\361 \250\237IBj\nAl\336H\246mQf&\201\006\324S\227\323\2620\274},\204\023\016}X\\\215n\253\364\265\003\363(\r\244\247\320\005\301\034\351\246C\316-\216\253C\"`\237\002\331e\214a\330\323L\251\336a\266\25247\234!-\306Qe\215h\210\347r\231\257\257\367g\265A:|O\226m3v\305Q\362\024\372\031KJ\267\347 \\\035\213\001\341\010w\021\343\300\226)\025\024n\354\201\n\304f\351\3410w{\211\324\3652\313Pz\034\342\n)\311\330\206\336k\206N\023\275\265D\0306\212R\332\004\017Q\345\037\000\276 -\013\023Zf\264\214K\370{\340\010+\002,=\242\t\340P?!\231\205\227 \353\371KUY\212\265\262\215\235,\010\310\302""\316\271Ei\211K\331\020\352\223mxV\271 \231\231\230\255\225\264\305@o\255\005\327O\025\324lW\234\022\331\244\353JC\020\3363\344\230\330\233\275\325\310\310>\001\355\252&\r\374\350{J\351\257\027\274\345\372\006\350\244\231&\034\\\263P\334\021r\376d~uH\030K\217\003!\3175\235\375Z\034TV\324}\013\004g\217\223\211\210\210\334)&.\177\214-\014O\363\007\201\217\312\014:j\353\307\251\031\361\025)\017\006O\364\311q\032\016s\335n\270\213\345\2346:\365\034\265g;\234\220S\254\253\314\237\220)\257nWj\222\275(\330\003\256\343\177FSH\200\376\\\240\204M\246`\341\200%\022\347\236\242\324M-\272\033\362\236\257v\371h\356Z\227\004\211\306\227'\316I\023o\335\247\301\271\241\316\360\032\022\025d2^B\005\007\256\201\357q\240\003\200 \314;\245\333\212\\\313J\334}\253m\250XK2\340.\207[\220O\247\312\226B\0208!\204\374\230FG@\260\020x(\207\253\314\317cF \r\350(q\271wD!tLzU\326\002N;\275zD\301fB\234aVuT\240\017@\233~'\353\024\343\214\"\234\361\314\204m\366 \234\240\030\261\277\371\207D\374Y\371\214\037l\315\266A\304r\256+(\204\217\244\377\251\305\007\026\355>E\267\363\256%\254\367|\241\367F\375\245\302\n\234il\016_\246)\206\0161\374Ye\266\263\340\247\177\031\030\212U\362\3265Y\013\022\"KM\266 \240|\010\t\237P>\306\326\216\000\263\266\345\014lg\325\255\215\305\0023#\366p\020\235\035\377\314\211\213h-Y\311\305K[\013\250\301:\3512\2417h]\365\r\263'\224L:\366^\317\225~\330a\306\353\262\256^\221S\351d\230\321j{56\311\0224\273\025\354\320OQ\324\326\206WP\216P;\366\"\027\031_\017}\334\322\373\303:r0.N\335\"\354\352\360\304\372\324\305\355\302\"})w\177z\232#\241l\032d\246g\354\200[\313\016\333\317i\234Z\200\340#c\370\232\343j\307|D\2335ih\372%F\005\237\253\327\212\342j\242C=\312\233<)1\006\266\2226\215q2)\215L\351\244)N\207\023\216\210\001\233\223E\370E\004@\370\235\201 n\027\032\223\032.{\005!\313\223\253|=\236\313\022Uxu&\356\022C\264\273\260Y}g\025\0104|\322\262_c3n\177\27346\037<\210\000\325w\367;\204S{e\010\302\233\330\257\327G\327D\nE\311\346\037I\245v\302\365k\341eF\333XJ\243F\207g\255(T\033\301""\352b\224\241\340\026Q:z\364\311\244\374\3171\024\0371|\261\305\273`>\360\265I\364\343Rx\344\252+\371Ii\307\327\314\253K\247?\301\333O\263\316\224p\364\257\226\366v\025\330p\226[r\355\336\037\256\233\341\240=\312}\007k\372\240\241\347\251\313\2647\233\232V\256\375\312(\334\271yB\365\213T\224\252\230\2720\204\276\300I\310\372\357qA\254s\325\232x\320Lc9\203\215=\362\351n\302\337\262\202>]\2112\342\231\203\224\311u'f\306c|.\336\347X\321\334h\304b\2765\314\263\211\362\271\2442\262\027\205<\213f\376\020\235,d(\026\"h\006\353\023\020@\014!\203\0374\207\235h(1\203f\3645\312\2040\277Wz\014\311\265\315\r\nb\037\207\246f\t\365\304\360\200{\201\0377\212\322b\004\030%\022<\351v\253W\306\353\237\016\207(U\236\024fS\372\312r~\000\217\211.\366\237S\200\035\007R\332\223@\365\372\236l\007\355='x\2222y\352 \264I|7_\03259\021\2718\0345\346\256\345o\"Si&PXX\355d\317N\306;'\232\207o!@~\240\376<\320\254\251<\265\016\261\225nl)j\245'?\241\374\0250j,\212'\010\006^[\332\356\374\2607U\346W\031QV\314[]Pft\235\362\274\204-+\223\371%\321-\315\t\2704\243\336\372\026j\024vd\177\225\333\317\303\022\205\242\206\360s\007J<\274P\376\264\252\224\0260U\310\350\265D\344i\345\231\001r\371\323\331\323\210\"D\255\247A\212\254\240\023\232H\224\2425#\026\262\367\351\003\263\356\274\250.\272iM\036A\255\233s\304\t1\361eO\321\203\315X\340Ae\312\244'\267\333^\227\210\237\222\351<&\003\245\331\324\366\251\300\325\005\217T\307\371}\362\252b\340Bz\3222\357d\274^\211\253\362\315\021\316g\250\317\323'\236w\324\033*\220\2244,\215]\212\240\217\206\356\277\255\212\333\022\244\013\212\220G\375\350\275+9\377\337\323\230;Y\375\235\353~:\356\024R\352\211!J4\316\241UF3\351#2\212\374\007\272\202?\236i\204\321\nh\215\203\243K\013~\255\245<\250\006G+\r\025%B\373\340\363\276\035\024\322\237\264~\366\207\241\326i\204\323@\206\327V\352L\244\327\362\252b\2738\014\237\333+2\302\006 \276\362_\374H\301\211\3017\325\361\3450\035\241*]\252\233B\317T>\232\340k\301rb\002\275\317\037)\306cQ\r\314\263\261$\250\004J\252I\250\253VH\270\310""\366u\304\343\214R\333\2628\212\335mc\022D\356\026\314I\257&\033\241\\\356\371M\355\271\014gS\343\246)\370\210\354\370\001\242\356\256\201M\305\302\024\3312G\006Th\305\034m\025Q9\334]\321\211\315\365\325{K\222\265`\t\205[\203\307\204\243j9\257\212c\311\376\226\332\315\\oW\265])\205\357.\177\270\034Q\371\345\326\362\227\351\277\002\261\241o\024\233d\370K\316o\225,\340\304:\307\230\222\000et\310\274Ww\2555gb\354*X\273c\177l7\241\036P\303*\2075\251\271\342W\025r\371\262\252K\243\023\"\250\266@\007\367`\026\362pR\t\302m\272=\330$\323\211\241&\202\276N\355i\261u^\236\314#\314\206\237,\000\3204\020\327\007\245\247\340\327\256\247&\3262\260\275\373\2740UY\032\000\0229\242s@\027\372\033\2460\353\0010\234M\263\313\253\254\\3\021@\024\003o\263|\010\2664pX\345\300\250qt,Z\210\t\355\"\201\375h\267T\316\001\003B\241!<W\005\363\366\315oE\306\322]\336}$\315DYRa\024\002\220D^\340a?j\n\215\302\216.\246\213B\274\n\215~\337z\215\326\177\225\231\346\360\r\025\231Ze$\233i \010\013\246\357e1*\333\220\250I\200cO'\346\345\264E\252\325Mg\345\335\020IS\240\244\027ZR\000M\202\\\261e\024\205\004j\021\242\343\t\247\260\264NX\003$\020\261@\256;\254\354Or>\303\260\235\026\3136v\375>\330\005\225\016\251\035\314\220\017y\303\304~(Va\315\232\"h\313K\241\330\233\301\024a\216\026\367+w\035\231\377\0101N\014\314\244\264\020\322\262\236\005\2400\221\242Zrq*\274\263\276t\327\r\352\366\231\216\227\220\0035\023\230+\0329\300y\rv\330\3059H\225\255\335\\\264%\2069\337\321\351\330\236\034\025u\262\266\\h\027\274\324\301sF\216\336\224D\221K\023\304U\215\350,L,\t*\003S\243\340c\344\377\240\"\000\027\2422\317h$\335\023K\346w\344:\277\201)\354\0052\035{l;\300\354\225)\251E\226\2240]\242\243\177\005\301\033uIF\263\313h^'\222\022\242\331ea*l\203\234\210\032;\250M\305\005\323#@\260\356\270\345r#\023y\332\322\205L\351\r\356\234j\235\327\024\275\222\216_I/x*\272\277)\233\2735a+4\362}k\321\273\333ux^\346e\274\276\210`\264\306\313\357\316\"\202\t\240\201\332\364h\333`M\254G\026\260<\364\367u\022DP\260\257\212uc|\302Z""\027y\361\225\317v\247\332\341\336k\240\215\206;\313z\373f\020\340\3441j4\322\033\267\323d\354R)x\274\261\311\000\210 L\312\212\204\000\021\265\312\026\215o\344\201C'i5\016Q/N\362\200\331\216\034\2403\"\256\217\225\353f\300\356\343!|\030\3377\246\032g\300\272\200Qx\270\240`\267\2137\317\367 \261\204\253\026\211c<\2367\262\030\234\305\334@\357=0\317\267\264\t\2760Y\032\251\034]\014@\"s&\301\ns\020\242\326]B\202\024~/\252I\031\344\014a#N\303\3078\324\004\242\321X\304{\263Z*\264\341%\034\307`27U\314A=\221\244\033\\\004\204a\275$\250\261\206\344\370\214\007\023\004nJ\n\036\223\201\3042\t\340\014&'\027\360\n6\303=X\221\0317\334\352?\270\336g\301\245@A\031\306\304\312\261Er\241\337\271u\373IT8xt\240\214\322Tp\223\321\363'(:\023\2000Y\250\340\016B\275\372\243\321\306n\346G\032\3630\323}:B\335\274g\360\220\215x>)\014\2245[\032\360\346\251\001o\3716\022a0\365\220\345@\343\240\032Ic\251x/\230\224\020'b\265c\373\225\301\255\204;\021Q\3120\036\252]\203\245\247\301\010o\237\214R\217\021\376&\245&\031\027s\241\036\305QT\215\253!\324\376dX\334\374a\362\334\263\254\031\032\212\312b@R@\230\205\306\220,b.\272\002\033q\241R\036\372\241y\333\350\267\245Bw\264P\017 \317#L]\231\356\355tP\373\234\345\366\250!7u\030\271W\255v\241\271\3378r\307\243\236mN\355\302\006x\177\033\003\005b\350cl\026B\315ABF\302\251\0352,L\326\320\251\306\350\214U:\321<\230\006B\010\346\207\016\036({\215\031h\256s\332\304i\021\375Qs\242tXE\035\252\243&\000\001M\026}\336\027$\273\300-ZO}<\357H\2045k>\023Q\343\366J\3071\360\200\023\002\273\3041\234\003\272\224\246\362a\2354\013\376\303\246\036T\255\244\035\336*_\034V@\272\303\240!\346\275R\277\366\000\2576\004\345\250!2\203\336\000yh\001\262\035{&\223T|\324x\2579!\230\266j\317\377\205\344\274\017$\007\336z\376\313\374\031\001\031r:\244+\020\317\376\322\334c\316\324\\\341\305\217\335#L\341pmi\306\250n\003\272m\203g\224\025\225\312\274\242\204\251F\016r\214%<\341N\3668\314b\217\212\242\343\224 FHN$M0\324y\357\251m\341\237\013\246\256\321\\\241i\014S\230\"4\314\325""\261\333\315\346\311\201\206\220\305\271\025<\337W>H\234Qx\212\343\370S\254m\244\006\210!\265\034zz\260twG]\007\367\210R\370\224\364\246q\r\361U\nW\320\205\361\351\323\361q\374\021\310\335\311\327\312\206\304\353-W\372\303\031Os\266\223\322\201@\014\004\272Bpc=I\024\311\355L\246\302\031\241\212yY-&\202\310\234\340\340\3462\376\2116\314\220\251\035\360\335$\374\3763\340\005\326\334\224!'a\244\365h\201\266\260\351\237\223\035\244\264w\"\350\222(\"\372\275\333\353\344ej\221\346\247\202\233k\300L2F\262s\315]\200\301\215K\273\026[\210\223\003\221q\211bfR\035\276\"\224\222(\237\305\345f\260M\205}$T\361\242\332\243\305\356\337&K.\033\350\360\002k&\316\325oY\263\241S;\254;\272\312(\332M\251AJ\344\210\240W?k\275\\\364\3168\244\021nZUH\t\371\213\007\344\226\277\240\360Q*\033J\2374H\n\021e\246\032.]\246\3151\216\360\272\370\301@9\035\001\177\334\036\034h\255\204\345{8:J+n\2707n\251\024a\213ng\\\270\235\230\370\266}=\302\225^\256UQ\242\3079LE\364\227\350\370A\247`\215w\274\004\270\227^\033\212\351}a8!\014\0335\014j\004\255Y\300c\235\2675\020\301.B\236\251\370\377U\313\026(W\350'\240\233\307\362\333\323{\304\341\300\355\2333\270X\273\016\200e\341\217\356\215\2744\201[7\n\346\324O\037\001*ru\002\026\231N'\364\311\324\330\3445\220O\301\004\222\333N|\377\250\362\351\3244o\244\205o\021U\235\302ta=>8\036\372\346l\307\030\202\206\017\217`:\220o\030\366\221b\353\025\033\330ZD\031@\246\366\350\230\032\351\321\254lQ\255\020\024\330K\005\020\273]\311\231\224nB|\"\267/\330\235\350\266\253\024KL\0019H#^\266\0313\275\211\\\210!?\241\341(\217r\272\277g\240K\r\007\333\354\261A\277\253\260n\270\362\201\366#\342\362QNt\207\203q\3422\263\374\22557\263Uk\022\020\301\007\215\034Y(\005\203\354\351\326#\026\"\320\322\214\323\334\207\306\224\314\226M\014R\250a\020\312+\252\343\224\374\313\267\3253l\221=\206\2366\016\252\277[1F\301%C\217+=n\331\344k]\023\2577\242\357$r\257\014\022\245\213,sQ\2420\200\324\316\214x\321J\274Dp~D\204\360I\005PQk\315\2315\205\270\222\244-\224\344\304N\207f\36586\210\252""\215\031\244\224]\236\227\241\264\362]^\0257\224\312I.\001(\\l\322\250!\242\023\353\310\264\336\320\226\016\313-i\267\016UT\006?\354\223\255$\300\237\367\265\265\331\247F\003\234\271\323\326\250\006b\215\370\302\357\354B\007\310t\324Q\235\241T]\006\276\027\t\001}\357d\371\025\307L\374\273p\230\372\341\204\226\217\240\320\361\307\201?\010\215E\206*\263BP'\224\035\2247p*\306\376\013G\035\036\246|\036\335\020\016|\013\265\322\223\215\373\356I\327\214\376\310\001\376\222\003\027Bu\376rxvEJ\270\3752\346\3665\307M\375-7\316\0244/\005\222\361\267\342\003m\013\327\224l\316\262\224\006\366]c?Hh2\331\257\340\036\314\303\371D@l\037\206\2756\2161\267{\002\202\245\233\350\356\014\337EJ\270\361\311\3727\233f\346\242.9\021\224\265\314\224\311c=\250\327\252\244\251\021\312\333\213Q\003\342V\242\262\217)\031\262[eB\21462\001\200\337\321`)\355)\250\352NcI\360\321\321\300\000|}:\327o\341\326\016uk\360\232]\364Y\377\273\237\243\274\341,}\213\367`\351]7f\031\022\204\344\327\260\366\315\006imv]\376\335\272w\232\177\3201\314\007{\252:_^\305\016]\325\307\302S\223\340\223g(\"\304o\367\212m\302\020X\212\326x\005\356x\273\344kun\267\013k\357\347\264\000\177\255O8J]\317\335>\224Xj\316Bk\027\227\"\273%\344\205\233\017\215\037{)QqH\327\375\006\212)\301\263f\327\000\203'\014\231\213h\331NWPv\251\304\351\315b\002Q\322Z\231(G\273\031\343+\335\331J\003W\304\325\211b\342\2112>\3010Z\275\220\360\200\330O\212V\322\302G\331\205\016k-\250'\372\014\017\276\341\266\330\256+6\3613\365 \262uA\014\213\203\027\244\025\257\\\004\026V<5\037\375\314\004m\226\340P\004\236\346\254*XV\371\003\303\203\354\277!\270\037\212\002\"\014\3318?\001\357\003\262TC\362\t\250\330\302\371\243\340\014[\250\361s\005\201]\221P;x\032\217wAm\237:zb\230\004+\231l\207\264T\010\271\340\313:A\325\211&\335\375V\221\326\334\253YL\233\203\246\3214\363\236\365\256\340\3326\275\373\003\030BUx!\360\236I\"e\266^\263\023\260\344\031z\202\203\307\327\274\233CQT\027\237\246\203t\3708C\031g\364\351O\266\240<\003\"'\344\322\372\332\022QY\234\034""\376G\21491b^E4\2668\020S\336\255\235\341\251\223C\262pt\007\262+.\355\333x\027\021-p\302\246du\n\010\322\212\276R\016|b\010,!d\274-G\325\257\366c\007\204\215g\221\344&\017%\372\200\2367\367PEZ5\322\351\261&\227E\247\002\373\247\317}\202\227\323/\2241\362\326\337\351\037\tj\273MJ\004c\266\315_V&W\303\304G\035\241\303HA\000\316`\227\353\357*\335\035Ajo\005`\375J\301\021\252u*xN\001\303U\314\250\201d\270\245P\370ql\302k\272GA!5|\014\301w\366\014\274F6\230\027\240\207\352\327\021 \334\230\235\222\224\364B*\320\027\251\017\307N\227U&WT\tS.r\003\017\244D=`\235\354Of\334\262\000\300\363\371\300\273Mn`\030\332\031\332\252\251\323HWN\032n\24111I2J5\035\205v\035\310T\246\347\362\021\301\374\376 f\302\237\313\034~8R\000\353\302\336\25746<pn\035Q\251p\343\013\262\352R5%sK\023\254\371\273\276\317L\346J\205aPj\325Q\335\333\000\305\317Yg\377\266t\320\032\317\366\315m\007\374\206\005\340o\017\251H\236\351\025\236\254/\271}=\032\311}B\363\261Pp~\241\222\263[O]&\201\271\336?\005L\235\221y\031])A\037]\253\310\351\030\230\177h\327\312\362\327\037TQ$\304\334\310\232z#\251u\017\026\271I\354\244\305<\347\334\247\302\216\207\014\204\335\365\342N\250\226s\034Q\276\n\355\337&\234\200\"G\237\376k\025\376v;\374\362\264o_\3032\001\366\3541\300\311E\324\3437Gu\253\326\305\356`|\262\035\023%\031\216\"\017\202\320\331\277\025\252\316qp\225\3029\230\035I\367\n\337\304X\312W\303\362M\023\255:\013*p\336\344-q\2555|\377\317!H\020\333\360m\356\235[GMH\2105$\036\201\023\310S\367d3\245\350&\342\334\344J\332\254x;~P1\016\262\021\303\2443\203\216s\332\322S\t\014?\177\314\214\351\026V\215}\242\323\215\203\266\021\352q~\225^v\324\365u\264B\016c\004.\356\337wB\216\357\213\204_M\236\207\343\364\246\236\311\350`\315\316\271\345\035!\231\364\257\242{\204{a\222\210\353\313\333\033\216\342\223\177\275\"\350'\n\250\277G)\342`@\005\254\0105W&\347\360\276\207\n\332\247\000\255Y\340\245c\210\177\212\373\ny4V\026\371\2426R \025_\304\316\205L+\346\202\310\346/Z\020u\335\366H\243\360\327\n*s\001\376\276\223wd\237X\225""\355Bdc\317Z\354B\222\370\204\366\210\303\215\2238\264\327\221\236\217\273\364\363\366\017\355\037\313\227(\256o\360\203\375\004\274\247af\273\310\207\037U\271\263q1\005\314\350\320\20120\002\030\013@\004\226\r\270\315\001\000\220=\375\r>{=\277\357)2,0\022%\313\036\264Iz\331\374\021u\030e\212\3501\2608D:\205\373F\332-\257)x*\377\234`\003\030\006\370\262\204I[tE5\200\307\234\222(\231)A\217\253\313[\3409\270\222\007_\323\033\341s\t~r'l\346\234\3644,<\371\3452\203\371xI\027@\244@s`J(\276R\377\242,{x\264B\254\230\001\306\312w\034\207\017-\325j)q\350\242\177\351\023\360\321\035\205g\210D3\t\351\022\273/\026\035\231\306\020T\264\355\202E\347\261\335\013\232+m_\256Zn\037\n4\270\277_k\304\032'7(D\232s\301\350}\341\235_8\376\000\204N\364\327\353:\330\256jZ{\010]d@l\214\320,\n4M`h(\255\2428\340\007\311\221\304\220yi!\260\375\006\010'G\363>\320\222K\362\317\314\364h\326\252\240uY\325\332\272qy\233\241\355\3431\2157\366:\201jM1g\342\316\310\345\2170\250\0333\367\341\267\336\211\202\204O\357\243<\235\237\020\223yBXYHs\363\344/\265*\034\371\346\370\275\316\0305\373\374\300\006\357\004\316~\032:\307\020\235\006:l\370~z\353\262\010\376L\313\026L'09\263\322J+!\031GL\247\233\335\014\316\351\230\252\314\004\373\351\312R\236\\'Ef\330\233\320\323\316\017\275\030\364\366\200\227\200\300\335un\006\266|\273\316\326G\211\033\204\377y\373\3655F\t\221H\335\202\257cT>.s\230\251\274\323\364\330\231\247\013\010\010\225\032\257\334\331y\266F_\205\035!a\302&T\rr\333B6\257p\000\262\006\017\360T\270A\352u \321\032H\370\213\233y:\034\345~\315\252\320\035\037`\3149\3379f\000\263%\224\244\250\234\304\363\177\220b\324*\235\377y\200\223\244\203\344\2638\324Ye\0008\021\177&\254\376\367\333<\203\216\301\007\250%L\317\264r/\245G\007\253\277(\225\034/b\037\332#o\304\367\373-M\r\007\233\"\035\212\250Z\327\r\201\225?[\206\2608\343\330Y:@~\354CrB\265\326#\270\233^\216\243\357\355\\\017\320\230\300\242o\310\353\306\005v(<\370\262m\332\251\031^\320\232c\341\001G\322e0\311\344\017\241\356a\001q\264\026\277T=\337t""\210\373y\000\013y>\016\n,\311\312\344 _\037\2336\320_\337DQL\2355a\003/\006X\255\242\334\032\355O\363\242?*\311kn^dZ$\303\324h-K\243#L\347\037:\350\341\341\023\027\222\324.\035\221R\312%^\310\362[L9\321\r\203\344\360\245d\032\250\275\252\226\331:42_\211}\371#\337\204\270E[/\266yH\025\343x\310\242uU\3763\224\330\214\344\240\343\367\267\304\264\376\360\350\000\375";
    PyObject *data = __Pyx_DecompressString(cstring, 23077, 3);
    if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error)
    const char* const bytes = __Pyx_PyBytes_AsString(data);
    #if !CYTHON_ASSUME_SAFE_MACROS
    if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) }
    #endif
    #elif (CYTHON_COMPRESS_STRINGS) == 2 /* compression: bz2 (21600 bytes) */
const char* const cstring = "BZh91AY&SY>\036\271\334\000\032\034\177\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\300@@@\304P@@@@@@@\000@\000`g\t\366\340\367\310&\370\000\006q}je\357wT\000\367\334\274\364\252\024\n&\367\314\001\220\030{\335\365\317\0161#\357\274s\331\3673l\373\036\357\273m\237l\333aa\356\367\035{\276\371\367t\217\035\274\236\346F\327\273\275\273\267\327\327Z%\316\346\307\336g\2462\2642\314\233\005\255\335\324\273\033\031\276\351\312\353\203\335\316G\330n\261\363\335\340}\031Y\341\365\237yK\335\272\366\300\250\257l\354\355\316\036\336\202m\244\2176=gf\247\334;\252\365\260:wZ=\253w].\336\356\345\266\365\244V\237w.\237L\354\356\357{\235\014\252\244M\275\003\241]^\267l\325*>\330w\307\006\352{\273\2547\274u\271\252\345\367\332\347\3373Vz\355%R\367sr\311o\260{\336s{\343\300\005\024\202\373um\333\n\323ucT\260\320P\002\367\270w\245\022\002\225$%\010@\204\323F\004\323@&\021\224\364i\240\032OI\206'\244jm\t\351\200\0056S4&L\322)\236\224\365\032b<\220h4\320\004\202\020&AO)\202i\252d\375H=M\003M\000\320\365\r\030\324\306S\324\365\000\003#\312~\224\032h\000z\200\003L\"\"I\250\004\310M\000f\246F\023\324\310\323F&\200\321\247\250\364i\244\323\323M\023m\032\003L\210\230\232h\364\206M\246\223@\223J\020\202\002h&I\345'\3522OMO%=\021\2232\r44M\006\206\214 h=@mF\201\246\2324\0324\304h\002%\020 \"`\t\344M\030\324\323jh\323T\366\245?I\344L\n1\242z\236\201\033Q\246\232\032\006\201\240\006\200\000\000$D \002\002\t\221=!\240&\032\t\246\246\004\3053j\214OS\322a\032\032d\000\000\001\240\r\000\006@*\250\240\2653/\232\317?\007*\\\n1\276J\227\323\263mI*\326\217\032vV4\372QBZ+\002\324\006\207A\364w\362\377\016\242\337\332`\362A\200 s\0357\275\356)\234d\300d+`W\t\307^\273O\030\304\233\337\263m\320\250\344(_\335\226J\264\207y\307x\007\241u]\372\360\273WS)/\307Z\274\247\2353\235:\374\320g\377\270\006\003in\306\r\372\332\010^\026PU\030D\343\340?\026\371z\226\016^fW*z\330t\234\260\207\275\236\023\207\305\277\235\303\373\375\216\343}\276\231\225a\322\347\245\023Pu\364\032\224,w<\177S\007\375{""\177\222\277)k\3630\232\201Tk\334\374\240!UT\300\254\252\374\340Z\202G\232\3260q\220\213\232\200\270\000`e\021P\325\334\027b \361\014\260\233@\230l'\220\"Y\020~]\261u\r\220\243\230\310\306H\315\2554\314\016-4\210o\032(\275\340\253\030 \327\025\355\352\253B\253U\252\325q\177\243\364QdF,\210 , \212\301F2}\020Y-\242\024\212\322)T0S\0010\014\034\204\357(\027\005\303ss\217\333\017\376\001\271\270nK\203\005\304z\334\206%\034\0010\003\003\006\303\021\016\263\2620\005\001E\222#\"\204\024\005$\210\310\"\240\261\"\002\311\005\221b\304E\"\221`\n\"H\262,X\021E\026\n\304\021\212\004\212(\"H\244RDQ\221@\021\001b\221a\024\"\204\213\021\005\025Q\005\345!\220\3559\016#\020b\014\311m\270g\000\t\001\010\300Y\006\211{x\347\275\317\322\016u\035\357o\345\373\232(Y!\0169\321\263\274:p00\362\277=iYl\304Bg\374\267\364\310TA8:'\342\353\332\370\247\366\267\243\276\261\371\276\027\215\362\272\374ou$\362\326^X.\337w\357=\315_\336\212\271j\206\207\206{\232\206\306u\271\\\017n\371\217\021\025\227\217\231\231\231\231\216\356\357\231\231\217Q\021\031\227\225\030\341\335\255\3131\2061\221\217\005`\336=\316E)Y\313\266\272\263\225\207\032\216Q\213\016\352\327V\331&\351b*\332b\362\025\303=68\20300cVM\027\267\246w\307\017kmr\355\220B\255\275\313\253\324Vf>fdff=^\025\314\314\314\303\231\231\231\231y\224\371Po\270\206\250SZw\266\266Q\247\323a{2\323\220\361t\370\331+\024\367s5\227t\370\314\312L=M]\275\335\344\3256ffdE\346f^ffff^fffffffffVffff]\346ffffffffffffeffffe\374z\314\314\314\314\322\255\266S\263M\032\251\210v\222^32\363332\3633\025W33-\346\360\342\266+\275\nuUw%Zf\261\232Zj0fDT\335S\341\312\212\214\313j\226*\322\370\r\n+T\361L\360\356\363y\2237u\226\315F\245\361\255n\3631\261\336\252\343/32\263\037\027/\016Nf^^3;\3465\013uj\240Y\225\256\346\363&d\231\231\234\314\314\314\314\300U\231\346\352\363-\351pVU\202\371k\215q\217\206\331\205\230.s\3603\221z\274\253\201\227\014\3574\272Z\\V\251\313\222\252\3554\361/e\357\036\326\342]r\260\305n\243\2349\336wQ\317hk\372\207\213}dO!\250\272\"\204 H\250BH\214r""\006C&C\244\274\274/_\032\0065\016\250\254\222AV@X\nAA`\210\261dX\262\n)\021\220\210\310\002\310\211\005\"\254R\013\"\310\244U\222,\221E\0103\245\212\014\030\010\225\220\244\273)\030\253#/|\260\000\301\2009\2036S-\366\267D\372\270\324x6\307\234i\016\036\211\n\337]\341:\006\221;\325%\270\226)\030\275\014Pq\267\354\030\361\245\256\317\311\2141\202\026#l\003(FE\010\202(\0020X#\006\010\212\242\253 \301\213\022D1\231\2629:\314\305\310\271fq\312\201\261\006E\220\220\006 (\002\300PX\260\354\210\210\2501\235\301\r\320\356\355\341\022\t#\334\330\003\025\206D\357a\206\177Br9\351\025\212\016\233\360\346\343\215!\317\336k\227\r@\340\3044\300m\277T\020g\321\006\027\201\212\005\220\2035C.\312\023v\006\014 X\003\240VIj\3142=\211\311\206\316J[\2532\354\250\306e\003\231\233\273\272d\010\204a\2530\021\205\342 \312!\246\235&\220C\003d\026P\251w\220\372\201\022\013\211Y4\032\2153\037\024A\333\252 $\017\001\341\311\004\246\330=\332\024\r!1\201\266\306\201\212\312\362\353\233F\377\257\232\315\000\246\307T\330\364q\013\202\322E\223\301*V\330\313\nk8\302\306\014\031F\215Pj\215Q\303dp\343\275\3500\342%\270\013\243\005\340EP{\373\303\302q\340rYJ\r\266\326\205\212/\204\360\200pA\301p8ou\370~\306\273\217q\024\326\301\r!60oU\252\3245F\253^;\354\030\231o\370\305\310\r\367E\267m\205\357\224\220Kp\341\244p\005\300\016\001\301-\316\232\327$\263ga\303CG\254A\251\r\265\303\0272\034\010c\254\301\020L\204\033\2431\033\206\374\252\271rA\300\016l\342\237\005\236\251\003\033W\301\251$D\021\251\250j\032\234\313\314E\226q\007\007\242A\231\232f\213\2550\253\237\3112[dl\033\034z\332\304r\300\344\033\233#\257]\273LH\334R\031\305 c\033\0160\323\340\270\007\016\241\306\245\017\346m\262_\255\277\215\3320\335\233\033S\371~\035,_RlxT\345\277%\306\253\252\016\"\342\257?Q\232\033\303Y\302\363\341\3416v\337}\321\276\326\215MF\316G\207>\377\317z36\355\215\266\345.\332\256\263O\314\273\016\034\026\374?T2\277\241\021\307\250o\245\312lowU\271\341\330\274\215\300\341\334a2Fd\201\032\343\335\310g\266\347q\366 \241\310*{D{}_""[\266\337e\037\022\360\3474\303o\366I\214\331R7\266\203I\236\320\266\261/uU^\263\277\243\021\242\237\357=\210\325\370\273_\313z\357\257\274\234\367\351\031\310\354\304\207-\212\n\2101\315\022\333,'\346b\223\t\016N0\014\252\177\3311\212\037\304r\247\277\217\316\345\277\221\367w\370\207\361;\340\347+\311\274\324\337BJKU\364i\032e\246\261Y'E\356\251;\226\342;\326z\272\254\204d\261Cb\374\373o&\">\347Om\rw\n'\342P\255\333\333\342\356\210\023wM\353\244Ij}\013\376\355q\256\340\210+\306\2273\340\177\017\327\035\233\245t\352\275\006\346{\347\364JY\354\207\256U\205\003\375\250\3534\343\331TK/\317+\233\007\313\266e\330\212do\035\316\274,\265\032\324kB\332\217\256\367\333 N\301J\311\347\376\037\341f'\305W\372^\213\372[\347\223\354\373\247p\235H\031\315\014z\276\3420\367&\323\372\346\317\270\376\306\275\367\257\361yf\350\212@0\260Q\010U5\235\212L\377\306\231\2214~\2109\023\377I\235\343m3\305i\224Z\366\353\234A\246\327L\351\334v:\027\277E\357\315\355\023\030\007\205\366\350Q\216\217\373[\215\304\365\323^\271U\336|dZ\2337gh\366\013\353\355\371d\267\355\303\2367\355\026{\247\327n\233\3747\033\347B\031\177\375\231\310\333\360-?|wt\327W\023\261\013\274\364\363\333\006C_\235?\022`f\201\021\355P\016:\377\232>q\213(\301WaW\211\340>o\314Z\356\213\276\275\037\205\306\372]=9Y\205\177\237\211\220\363\300n\027\356\360\277\334\356\356\333\020g\252\265\221\312\372\343\271\273\350~\030~\335\201\363q\310O\247\205\210\373.4S\350\270`\245\347\267\332)\272\023\023\t*\312\256\311\003\236\366\020\321\007 \013\276oc\273\315\276R\331\344_\267N\nt\233N\221\224\341.;\331A\256\032\345+\264\265\000\373\307\275l\277\237\345\006\371\365\307^W\260\220\261\267\266\206\200\215\347p<\033\340\327\252\322\367\215\247\273\257\207M\371\237F]\025\177&\350\341\"\235\230\216[\236\376\215\275\036\214\241\353wUc\325~\315\355\335\302\345\234P\335]+\2748\001\264\252\244\313\000{K\263\307\220Q\037+\252uRB\271Y\227\001\311 z\270\207\236\014\027}\312W\315\331P_\301^\306\3441\241\336\243\326C\016aw2\254:\353`\032#\260L\277""\207-b\346Q\350\205\270\005x\335.\272\033H\360\256\346QT\320#Tn\307M\3771\273\313\237y\261\342G]\212wq|<x\231o\021uq\215\343\272H4\322\017\343\332\353|\005i\234\033\2777\033\216\257\007\266X\302\3377\315\327\273\2144\375\317\262\351\266\337\300eb\274\225\270p\366\250\335\025#\315\007o\031\355%U\005\203\316\373\240\336\02575\344x-K\327\317\337\357n\010\346\313w6;\367\272\3174X\250z\033\254\022\204\035\301\226Q\331\344\274\026h\366\034\331\344wX\223,\334\324\354\345}\306u\207\346\24532bs\354\351\277\301\217od\037\340.\323WH\361\366\366\256\316#[\217y\316\274\246n\235d\271\033\3355\364\315{/\212\3415\377C#3s9@\301\304\2161k\222\367N\366\213\035\300\3567\237\335\342\206q\322\317>\264s\\\323\342\321\266\272k\262\251m\\\3751\252\001\233\345&\357\346\304\334\336\237,\375\377\265\230S3\231\177:\225\315),)\234\263\002\273,\367\255\326\250\223\210h\302#T\030f\222\005\006\250-\205A\033L\265`;\261i\300\351F\030%\007<\2655\232Q\331C&\004\311\210\024Vh\017\025G\n=\224|5N\346/M\276\306\274\354\377\203\017\027\255\247\337\366\257\227\021\022{\347\371\225\033\372\376\n\250\304\036\327\226\003_\023\r/\3255\323p\033\0202\361\034\365\336x\374<9\244Z%\242\242U\277\346K\261\022\354K\255\245\350N\314}\331\272\367U\252fJn8ui\242\212\274\374\271\202ut\347\245\216\207C&\214Y%\355\235\263\326\353\304\013\304\022\242X\271\256\313y`\246|\254Y) \225\204\255Y*\334\2278?w\243\243\347\260\005c\tM\201q\314\211y\331[\221%\024\242\205\365\233\333\010\336\353\330u\330}\372\030\367\366#\276/\260\023\0178\351\245\351\233S\251f\261[\255N\211\223\224\264\\U\033%\337\217e\365\020\250\206Z\224\363\356\264\273\254g\273\305w\316\333v?\333%\223\233\325\375\214\256\325\030\214$\027\177\r\216\222\320P\250\250K7qA\310\002\230\210&\"!\334\347\034\306\022\340\016\312\312ry\360\323\010N\322v\242\355\031\345-\254\352\370\027\212CG\313\217\010F\307~\326\016\n\005\362\341\022\365Y\016y1\375\372\324\251\\*FO\2429\005\215\2336\265\204\204\t\r\251\366n\373\005\245\222I\036\277\223\240^\207\303\334\372\365s\373\205(x\375""\275F\247Q\246\306]\317\336x \022\022) q\3727\377\326\333!9g\037\331\360\371\202b\033O\177{\362\233B<p\302\005(d\344\222\373\361\373J\255rt\007Q2{74G\343ch\035M5\310\310\306\302\315\321\310\310L\210\035C\002\236\212\363\216\220\200\214\n \206\215\371\205\004V\203\273k|\337\342\300\0263\252W\351W\324\355\327\256v\373\366*\230\233\025*3vk#\253\276\002\324\022\247_\227\007\023\016\357\t.\311O6\032uS\033\243\3171\0213\324D\333v\264#\351iF\211z\371-7v\361\240\274]\210\244J\021\022pH\372\021 \3232\035K\372\202!|l\337bt\321p<\220\277\013\364\277&\237o\032\263%u\245\232\3475\337\355\364\373m\023GX\376\230g\037\253\312\356u\366\227&\027\"\232\020\306O#>\352)\245\263\316\355`\347cv\266\365\260\242\226\342\377&\220\305\025d\252\266\213d\035\n\246\213@p\242}\241C\213\340\027\237\033\345\3345\350O\304\273\353\275\016\363\276\371\251\327\200\200\216\374\024\222#\344{\377\257w\310JIw\230\223e2\202e:A\236\241h\023\016\351\017\017C\236=\035M\255Q,\022\213\217F\354\217\342iJ\341\352\326U.\204\222\307k9\261\243\373ei\022\210)$\241\35249hX\"\314ht\006Z\211Q\264\210g:l>\200\354\266=\037>\253\347)\264\317\027\325\363\203\0226m\352\313[C$}\230\020\342\020\020\255\311\265t\036\352b\346\326\345\275j\345\3227\303[;\033:t\021\235\214\233`\326\366\217\312\377{\331K\356\367\372\r\340\337\372\313y\346a\243n\353\223V\222\375\376\244\003Mx\253i\246\032'G6\316R?\251\020\311\322IJ\036\361\315\237\317p\272\246 rd?n`5\364\356\357\231\310\342\220\345\234\314\t\200\211]/{?K\240S\213S\311W\346if\325{\275\356s\340\367\376~\272\325%\227~i\036\217Q\246s\364\320\307\026%\235Y\346uz\326f(lw\247jw\253|l\306\206\252w\212\272\032P\266\252>>\247\362~\313\352Tp[\234h\343v\025\3075yL\37191\r\027*\315\311$\221F\322I$\222I%5\305\236\n0\346\370y\273\343\\eqx\222I$\222I$\222I$\222m\240\257Nq\303\232\343\\x\234\276q\266\332M\266\222I$\222I$\225\356D\025\362\346r\371\347[\326\222I$\222I$\222I\022N\006\314oKZ\273\321%UUU]cr\347{\2767\332\356\252\252\252\252\272\334q\275\337\033\357wUUUU]o\206\335\356\373\356kuUUUU\326""\370m\336\357\276\372\335UUUUu\276\033w\273\325E\022@\037\001\366\311~\226|O\362\374\177W\364<\343n\240\340\327\n\314\336\256\347\017\333\273\273*\373\3645\212'M1\001\336\241\335\332&\363Z\313\"\361\242\231\253\037\032n\3460S3\326Vh\2522\020\276\033\262z\216U*\263\033\341\367\322\311\010\t\001\t\220Y\005 \262\n\021d\026AH;o\214[\203}\367\316\356\351\005\220X*\252\252m\276\026\341\337|o\276\330H(@H\232VU\014\306\252\252@\203T\252Y\215UT\240\374h\210> +\037\025Y\2166f0@\211\024\264\252\314i\252\251\200\t\025L\2443\032\252\251\001\000E\212cJ\031MU@\000 \371B\030\245%h\325T\004\034#\322\000\370x\223\276TS\237\273_\230\347y\374\364\224\247\236\224\373\222\311,\205;\230\251T\202D\026\027\263\364\037\263\352\366^++\257\306\206Nee\352\210\035\251e\024\240\251\024\315V\265r\300\310\261\026\252B \026d\247A\321 0\220\250\362\013\017\r\300\310!\0346.\334\244\013H,7-\033T!Ya\032 \022h\314\260\250\372+\256\023\255\014\017I\214A\2741\302\032d\021\001\204\225\372\007\307\365\207\273\331\362{\330\263}v\367\373\343\341\362\346d\252[\324L\314\274;\207g\211\313\317\2330\210\\\205\206\270\314\310\307\227\214\246w\214\273\007\031\213\025/\315:\241\371z\306{\036V\333wzvo\255'\323\211\367\356\025\005VrO\227\216m$\241\347\236n\305\013\306J\030q\337$)\210\2243\024\204\241#q\022\020\223\347\273\262P\273n\"P\212\027\021(H\244%\007\275\330\200!\214\250\210'w\027\236c`\227\350\230\010oo\032\230\374\377\275\261o)\324,2\337\330\252\366wxx\370z|/\353\316{,a|\251}B\227gwv\211\275f\263\0108\360\305\256\263\026\361\3422m\356'0\222}\377\017\343\004\r<\022\024k{p\200\220\200\221@\221UU-\022\205\332\220\224$R\022\204\235n\354\224.\324\204\241\"\220\224$\222$\204\222\023\004\234\335\233F\357\337P\003\341\220@\263e\022\312%\224\3051\222\342\301\252\314X2\023#\241\317.\251\255\345j\312\345s\232\315\253\021\277\322\375/=\327sq:vw\227gx\232\314\326`\307j\270\2467X\355\226\367\227\247\253\337\033\304\211\336rX\311v\r\033\026.\344\202I \222H$\222\t.\356\305\334\220I$\022yWv.\340\367\224\007\275\033\252\241\345P""c\353\250h\024\r\n\350@\320:\017\177\177\277\372f\203G\237#\221\334\337\317\301R\225\255\017\217\217\247\256<\353\331\353MC\352\361\234\273C\273\304\346kY\203\035\256\242\304\346F[=\346U\276MM\202A\313\325\\\212\324YD\004\242\002Q\001(\001$\222I&\355\256\205S\321$\222I$\222I5MT*\236\211%UUUw\337\033\356o\276wUUUU]\356\333m\275\336\364M\000u\253\032\314\000e\335\233\2107$\0226\033\361\000\351\357\020\003\254F\242\355\021\332\037\317\365\374}\275\235\227m\327^R\342cx\343\323\255y\364\277\nE\366\255\365\245f\316\3173w\236Y\214qb\"\355\351r\362\231jB\254\324U\003v\300\351D\363%\003@\030$\224\004\202F\331m2\332e\312\021\211\033ff\t\231\231s\320\350\013\242Z\256\210<\311\037\265\320\375\346vu\317\206\360\343\217-\351\306\236>/\341\2315/1\n\025a\335\3362\357<s\035\327*\236\256\356\353.1\251b\2715\255m,(\361\312\302\3444\001p\310(F$\202\204\220\310(F$\202\204\202H(H$\202\204\202H(H$\202\204x\367\274B\245\204*\202%Q\n\242%TD\253\211\333\333\255\367d\327\2751\366+\335Tfek\003\317\324\336\257?_\262\361\312\316K$3\303\253FVg\2631\235r\236n\256\256\2621sD\334\231\232\332EW*\025\t$\000S,Pi\226(4\313\024\032gpP\216\026(4\033\024\033\017 \241 \211\005\345\201\002c\215@\262\205\224@\262\226R\312ah\246\005\343X\260Kqr\265\031\232\356\232\323\256\372\325d\222\274ni\314hxex\272\274\363\314\267v\313\250\253iX\274\233f\231Yx\223\213G~$\003\244\023\214&\244\204\024\022I$\230\244\232I%t\333`z'b:\300\\\001Y\022\261X\326\251|\2121\206\316sV\361\270SB\035\203E\355\232\314\275\245\017\255\354\222\022j\216T\0233?\322Q\307}Y\305Q\002\252\025J\245\301\235\233\223\221_\032\352\265\325\366\336qw\255\021t\227At\027Bg\320u_\262\376\317[c\374\337\221\271..p\355\332\205;\345\234\350\325\035\niL)g|\235\215j\347Bs%*}\357,]zY?\323\346\253\267\375\177u\372\371\334Q?s\363X\340\315\006\221\274X\301\321\273\004\"\017\3427\004j\220M\023n\014\n;\362WF\257_Ch8'*\230\376\321\205}\342N\226\246\341\340\250\204\343\376Y\221$\235\003\267\375\025[MFV R\254$t+.\315\316\230s3{\317^P\010\325\036\216\210\345\277\357\372""\363\372\035{KZ\361\207\253l\246\237(o\323\250\213\327\337\372\227{2\177%\365\215.\257~\247i\320\223\335\255\2163\267\017\277^\225[\335\364\333\234\253\353\267\226\207\034l\312m6h\323\312\2773u\316*qya\337\273Y\334M\225Sp\354\264\213\0140\250:{3N\221\367dS\024\336\020\036\322wtt\264\274/\036>|c\336\252\373\213\212.\232\346\245\333MN\275Y/J\301u8p\212m\266q\025\005\021<&X\333\230\206\237\331\371\246iY\031Uk\243~B\376\315\037I\357\343%\227\333\341\t\341\340\242\305+\n\365\260>M\253\360eY\362x\323;l\372g\233\017|6y\030\252p\336\270\356\356\361\361\304\356\210\205RH$\254z8p]\335\237\247Rm\303\322\205\013U\3473$\306l\350\360\241A<y3s\265\264\356\331\365\236\302\345\327wv\353r\370\034U\351\255\260\370\331\271\232\007\225\263\344\260\034\337\262\372\274\031\306\r\325|W\3103\211\347\2006v\203\350\314L\005\364aC\242B\023\246\230\344\274\215\366:\333\003\261\037\006\022\225\016\251\031\344-\232m\025\231\237\373\264srW\307+\257\345\016\327)\246\334\241\346r\253\261~\270S\370>\217\305\356\377[\361\256\247\323\350\037O\342\247\271\332z H\317\204+\353\354\372\235\337O\334\301+\211\013\307\375\211\373^_\352\353\257\301N\305*\201P\3229.\274\032\237dQ\022\312w)\352\312yo,Gg\351$\323l\276\350..\022\336\346\366\237\034\373\245\032\256\270\356\217\375\333c\251\234\214\r\251\217\327\3147\216\377Q\273 A{h\212\217\323'A\211\303\223\362\0366\322\2715WP\246\236\t>\307\346}\2236\316_o9X@6\233\251c\003\357\213\033\313\t\017\022\031\037c@\020\304\206\2254\307\005L\007\337*\265-\205\027q\000\033$\331\013\313\222\200V\334\204\370\006\253b\260\004\264\246\003*\234\r.\334\177\037\233\214\263K\263y\343\031 \342^\004\010$4\341C\203b\274\005J\rQ\206\350\031\301\346E\353;\330\214F\204\370 !\273\003)\211.\006\254P\231\221\205\211\236\033\320\222\030\325B\3629TIC,R\215/+\242|\307\355\375\337[\242\362\352\351\353\357\370\013\224\353\202\316\316\002\227\277K\\\201\257\323_\363\255\236f\301J \025W\354\027>\377\234\200\301\225g\003\273\362\270\024\315\001\207\206<\341\220h\003D\214\336>\"\262\021\024\014UdZ""O0;\260\2034\020\26508\032F\315BCt\326\242\000\333l\036,\346\345\201r+[Y\2624\245P-L\333k\244V\335\006\350\023mY \346\207,cY\225\234\230)<\346\200\3436\203\351\3719\003\247\300k\346\260:2\027\266\342i@\204~\325fJ\022\321A\370=K\303:4\210Pu\265z\367\035\210\254\005\325t\255k\036\377X\267\013\214^r\324R\265\313\3744]\340\253\372\272\356a,\035\034\214\2727\010\260y\202\326d\005Q\242\211o\205.\242\232\351\206\200\031\262O\256\001\351\301\245\215\213\211\2449\232\276r\224\241\211\034\312\206\312*\0053\305Z\007FK\333a\004$E\372\027\031\004\014\245\203L\3234B\373\0224\200\306\320\275L\026-\263\n\326QR\321F\257i\t]\225O\215p\36108\241,B\032\234\341\200\254\001\002\303]\014\3032B\1773\275TPp\310V \3009\262\300\301jJ6U\244\010\222p\352\373\307\341\343&/\241\247\212\270\007j\037j\232#t\216(\262\005e\374\233\032\"\346\327~m\215z\354\307\330v\365\217K\350\0373\333\367\216\276Sl\221{\2715\302\310\257\305\355\243\266q\226\\\\B\016>,\026\023\337\222\304\r[\003d\302\032s\212T\206XJ\230\326d\372_\027\303\313\36531\362\260\254\004\346r\036\206\364R\037P9\013\327\327\312\035`\360d\270k\003\344.\316D\202\312!\261\270&o\333\357_\027Y\244f\310>\014\325\355$Ui\215\304\2742\301\016\253j^\\\376\016:\001\210\273\026l\002\221\325y\357\315^\027\031\275\026\230XX\271\032@l\254g\300\333\351\200\270\326\252Q2\340N\033\225\022\"%\223\020\002d\006ImXC\226\255!u C\335\313\r\003I\030\302%\026\016\021q[f*\\\003\207\020acK\366O\336\237)\342<Sq\rs\253n\275\177\217zPo\3568\311\303\277\370\355\316T\311\254u\211\254]`\365'C\314l\354\367#\217\260_\235|\025\311\350bB\035\014Fh\242\203\021\301XV|x\020\203\344\215_/\342\3058\303~\027]8\347\031^\035|\370\252\031U\351q\310\251\26677\370\366\244\254Z\203Z]E\362yN\317\026\220\330V\346\225\311j\013\211/w\326v\250\344\242\375\"\202T\262O5-'\302\250X.J\335k\\\324\377\210#uCS\240\366g\2264\232\347o\33474\354\271\264Uiv\270qET\222-\020\023\323u\035H@\027\255X\272\354\3320,lA\247\331ToB\267\032\246\254\307\030\353d\354d\226\204m\0020\026\n\n\021D6\r\204\n\223(H\316\212x""\277\217\017\213\030\260\220Fp\0012\236\364\207hI\000\262\312\222e\356-\235\241\240\333$\004TQ\226+3d\355\333\227n\304nl\241{\001\252\030C\tI3\306\201\032\211\\\311& \343\020c\026\"*\243\207\023\224\353\317\2773\237eE\367E@)\016\210L\302\277\203bz\275F\030\341\244\n\264\345\202D\010\242H\273m\316\222\037\202\303\351\266(\242\014\024\214AFF\000\214\021E{\030X0Y\020b\303\360\022\025\220A\305\262#\007s\231\r\316\325\353m\356\353\312N\240r.Q\027\265\250@\025p^~\013\266W\307B\276\254E|\214.X\030\341np\200\303\272\223\327\277\274\2243\220\\J\014f\026\323\004\3362\032x\312Gm3Lc`\242\212(\247\227qo#\273\313\033m\262\351\307\035n\256\330.\305\3160\376\213\335UAy\331\035\004\200@er\272\200\335A\260\342\343b\215\r\261a\250@\245T*\315\310\330\330\233\333Z\216\210\010\331#k\323@\204!\355\320i\366\240cqK\260\310K\315\356\017\273\327\327\344\353\000\371}o\233\330O\2477\345\360\247!\010A\355i6\003m\200\332\030\311\365\275l\377\307\364\376(\367'\031\265k\314\373f+\206d\341\240\271\326\264\374r\270\356U\010n\255i&;\343\020L\364\267\355\273\255m\377\007\352G\344&\254}\247\274\363\307\033\205u\334\000\326\312\374uok\314\325UN\037\262l\202\253\3742\307\231\265\205\230\354\305[\212e\262\373\211\t\221\311\225\270-\223\326\372\303\271;\217\204\366\037\207\343\304=\272\302pPJD\314\003\343\335\250\265;\232y\375\351\331\307`\r\300\024\240P\215\037E}Q\245\264\020\311\221(^\210a\007{\213\233W$\355\350\304\337\323m\310\375\204\014\031f\215R7\343M\026<\230&\010\206\n\030(\230!\202\034v\363\355\010\227\212\212\253\233\177\214*1\003\334\217\303C\341Q4f\r\026\022I\256\360P\3672&8f1@\312B\nl\326\262\215\367\030\301\204\366m\353~\246\352n\251\272\273\251\272\356\207\342\374\037\007\250\361\315\310m\0239\021\204T*\201\021P=U(\013o\322(\225\254NCV\335<\2769m\253.W\034S\230.g3\230s9\234\227\344.T\363\034\221\341\0346\024%\255a\265^\005\t\000(6\023`\327\274\235\375'm\315\246\000\0076b\307z d\241F{\010%3aAZ\304$\262\224\002\265\206.^\370{\242:Hx\216\263\231\014\310\207\213,\362\354;\241;\2413\346\357?+ ""\252\251\024\025\030rn\016d\rqI\267\207\"\010\221\215eS\310\275\267}\240\014\335\344\370_; 5\246\330\241P$\275}>];\321\"\240\310)\254\r\220C!\266\205\331\355XBXrU_\207\211\321\n\273\352f\200\200\373\255\010\342\267\2446\233H\261N\r\300\3449\235\223\307\3526\226$\271B\013\232Z\036\202s\214\246g\210\236\263\361\336\275\222~\027y3\361\375SJ\252\243\036\210=u<\302\177:\312>Q\215\370\322'\340p\023\350\277ZY\270\340\351\353\213\014\365\016\264\326\032\365\375\177\037\333\275o/o5\2306\371\036\377>\265\253\243\222\305\006\313\016J \020\201\212\344\214\305\232\314\314\317\355Z\236\225\253\005\223lM\255\017\265M=\371\025u\n\322\221\333\302]Q}\220\221`\276\336\240K\002\223$\263\013\340\346\247\340\2771\023P\305\244a\346\224\002\323\247\267\360\236\356\010Fze30,\266\304\313\206m\227{\252\340\025\314\0046\r\334V`K!\213\216\231\255/\340\324\265\242r8\234\335\267]V\244\2511_\031\327\244\342Ch\204\355!\322(\213#\022n\2350\261$\267\n\224\317\022I\261!\313\234\347\220\222\271hfIz\263\202lA4n\031\004q\032\307\335\362\364-\220J@\340\034\225\023\272\005\327\010\372\245\307\020<\207&\217Wg\311^$\334\233\\T\025\007m#\260\020A6\302%\222\340\215\306\340\264\212qYrt\313z\360\2159\341\032\0250\246)\207\023\202\025\204\023Br\243\020\223\220\317\242@\366\"\305\2134\224E\025H\013\0216\206D\302\326\354\215\000\342\2651\001\005\202\025\025\343\232a{\000\305\031\023\224\r|q\265\257\275\345\323`i\366\251\307\306\372\\\247\006\321\350\333\332\255\263j6\313\377R\332\261\367\240\315~S\306\014\3513W\374-w4\035\354\355x\343{d\212\3618f\353hm\354\304\000\316\010\\w\016\262$\244\2547\300\206&&\030\" \342j*\310e\206\330\014\\\"a\202m\235b~I\351v!\206,\004L\034a\311O\241\337!$\301\304\301w\232LI\001*\245\2456x\366\336\014K\0102\004u\033z#\214\320\344\242\214\237\007\177\233Y\3672\033?%\260\212\272e\025\000\017\305\220\"\0022\304}\322f<\rO~\230\025\024+\212\222\032\t\331\253\002,\316\306&\363U\034\200\342\200X\253\010\262\002\303r\371ZM\233.\200\t\207A\024\315\014\224\035\352\035Z\261H`\311k\276\342I\331\242""\025,\232q\027[\343\"\212\2144\242B\216\243u\246\223t+\017\034d'N\366\351\233\017\00756U\306{]!p\270\253\330\221\331h\211\024\351L\270V6\201J\022\267\374m\227\023\245>N\256\236'\225\360\355W\312\330t\333\245\277\246\341,M]\005\"\024P\273\225\330\0011\002g\336G\320\264S\211\t\030]\351\250L<\306f\302\254\007:\344\201U\225\n\025p\010\325\206\002Z\025-)EZ\214p\002>\214kj\242k\214;\257ST\t\261\261!\265\360\036\326\346(&\222RJ+\204-P\025\013\257W\344\253v\315^$\263\3140\240\"\370\nV \344\315\024\260\035\206lf\361L\2638b\004r\305 \242!\"\240\364\240UC\252\024E=p\201\352\365\355\356\365\346Oj\026C\231\207\343\340\205\361\375\036m\262\370\007\343\035\215{\374\274mu\201n\260b9\366o+0\023\000,\317\205\031\r\001\213U\203\203\250\261\326\302\024\261*\361\345\031T\214n\331\030\006}\367\037~n\260\0321(\0325\261\350\223\010!\"q_[mD\271\211\265\005i\\@7\336X\205\021l\000\2675\373m\354\353\363\342\226\026\303\276\340\347\231$\254\214\025\200\202\210\303L+\030\014\212\306\"\t\206\025\"1Q\326\256\031\022\032@\013\304BR2v\240\005\004\023V\304\024\024Z*\304\241\262\023!\014\367\375\177-\376]m\357\376L}+\276\315\236C\266\025\363:\301?5)t~8\346\010\352\336o/\227\035\007\274p\366\315\223\006\331\240Z\224tz\010\372\371\002\021Y${2\323\017\237E+\372\336\002\305d\367u{t\247\304{\324\251gUk\254\250\240\030\241P\n\202\207\362\374q\275\337\301\320\321:\333\017.O\226\251\0369A\222\212\356\2341pZ^JmL\032\244\240\353\030\304\014\362\330\256E\252\272\t\000\230M2K\004&t\340$\002+\224%\340\203yY\211$\016,a\022\344\347%\337\302\3524=\340\242\000\010\257\0247\360 faC&e\251\0312\217[h\240O\251\014\203\245H\230,{\313\355\000\024\227*\017\207\313\347Jx}\244\013$j\t\240'\006\303$|\324\035\300/\214\367Z\000t\272w\327\270:\266\206a8\022Y\t\004\266\361\274\375\341\234\222\017a\244\203\363\374\232\201}\204\256\230\3400\345\272\204\001\302\013\266\265\344\310a`0\242\200b\235\316\335\227)r_\032\t\tB#ve\025T\231p\017\004\332\372m\013\001\026Y\320e\000\\\204\223\324\025\343+\002r\223\004\222\241$\016\201\202\252""\r\030\013\367\301\214\210\341\262\tY*\220TNP\343\245\323\251\253SQHa\205\025\"[+\005\002\252\000\271\345\2039\2129\245I\204\n\326A\266)\021\202\205\024HV:\265[\0349L\210Ve\312\246Z\205L\262|\247I\017\252\035\276c*\212/ELP\352\276\222\375]6\210\313Rpe\364\340\376\365!\235\322#:\007<1\214l\342\324Ht<:\272<v:\010l\313\247>\200\230\232(\003 \202@\343\n\343\255/2\254\021\350\217l&e\331C\244\024\273\030\364\2312\263\202\217\266NH\n}\030\032\231\202\201\"\3601`\343I\300+\350w\227\350B\000\3101\023\246\225\016\273\322(\235.\316$\2212\230\004@\037\250\235\230\206\311\264\200[\3423\032\234 \005\234\343\221\031\030\241\007\343(\031\351x\330\310\365A\276\366V\366\242\376M\214AK\276\362\304\214@TPPb\323\177\301\235\rkY\270He1$\036z\037\013k\320\310\372\232\365S\337u\312-\354\302\263=\371\313\357\373u\301\036\253\251\352\365\001\352\027\306|\204x\206\002<\273\020\306\023\020q\364\266\334K\036\205\345}~\343l;\341\275\214\340\342\301\266\206\235,<\264I\"\024;\311B\035\032\333\\\270\344n\036\3317Od\370n\312\201\231\000\262\026\032\214'\002\034\275\320\r \260\220\345;P\327\\v\201\303+\221w\347:Ytv\303\250Iz\241BX\341\210\256\311\330\033$\352\023\222$HpZt\221%\347\232H}(\357\216\216\t\330\244\026 \034Ni%\003\310\332\277 ,\215=\274\243;\332\306I\3676.\205-\232\003\026\215\033\206(\232\222\304\261\020\261@\2166\201F\2606\"F!\021\334m\226\262\311\004nO\226!^\001\010\020G\0102\215\\;\260^\336\202\016\221\354e\212\253\223\305\347\361\314\023\253\314s\252\030\363\330C\263\005\215\333Y\362\336^D9\214\021\003]\217kS\240\324\254\303\214c\027\0050\230\302\224b2.9M\216\037\035\363\225u\327:\301s\277\\\345w\201\203\005\235\274d\026A\304Z&\362\230LqD\0006^\264\261\356f1\014\330\242\316\004o\"|\035\024\220\306t,,a\3578\331$\2214\331\342\240 \270\265\026Q\006 \n\032\346uA\n\340^\365s\371~\010A\366\004n?E=5\370\227\223g\267\352\"\263\367K!,)\037]\177FzU\036\366&_.\225\314\324\363\243\346|~:<&\2376\202\240h\016\360\203d|CDz_\007L1a\003\235\200T\361s%\014|8r\224\022)<03\305\007\2426\031c3F\322\253X""\340\334c\342;\370\207\246-XX\277\026z\347\216$\333\310n4+\005|v\206\253\203GI\274{\325\364x5m\024g\206;\220\335\217\225\361\036 \345|E\016\361\307\340\342\251&\355\022\003\227\223\216\300\261\210\020\"$\024\266\034\010q\2123}'~\2240\273\212\361-K`@\312b\251\"\213\"\262{%B\375\334\354rQ,!k\025\226\271\\J\250W\002\272b\247T\353\342\325\275\267D\031\003jX\327|\211A\007\323\307R\336\232\326\232h\227wq\033\334\020d\023@\233\312o.\360oz\21399\016B\024\024\211M\240I\212\317\017Y2\356\335\340\261\266!\356\300\356\354w\216~z\007\223~\277\343[.\340\251\333R\2062\332\035m\031\217`\024\332\334R\314\364\014R\333`\325\315\265\007\301\313\222\373w_\325\354\361r\317N\312\233\236\2711v\251\217\351\355\237\323[\032i\257\245\325\035\266\350M\216K\026$\230\316~0\220\317\213\355x\027\231\346_+\213T\003\266#\242\034\262\310\204\223\237\317Z\005\255\000\003\362\232P\266\212;4zb\022\206)\327P5Z\236\367\311\372|\216W\"\340.\344\357^s\013\321\273b\324\357\2442\264\014\216s\033?I(]%\032G\243\257\306P\373\3053I|yT\366\365\017\024}\027S\313}\213\207\334t6\333z\256\tZ\367\315U\224T\304\273\365\376\275\211\3224w\305\336E\305\002\337\024\310UT\266\262\201\337\356|\007\346\257\341\000x\247\342\374_\003\354y\036{7\024\212\276D^c\254\273\264P!\222cl@~S\ng\311FG\"\021~\305\033!\351\337\t\230[\\\035\241s\r\222\003\221\310\270T\305\336`[#\351j\241\350\006\367\226k03\264\211C3\006\352\222\002\367\316l,\026\301\034\332\250\267\2660\225w\021\223\030\306\025WRg\031\211o\025T\300\341\026\006\365\373\2305\267\330\037#@\321\373\"\360l\353\274\276\361\324\027\245\375\332Woh\322\265\363h\010!n\225\203\305\225ERBH\341\020\341\247\n\346x\351\311,\003+\014\354\225\005\314\320g\367\367\242#\217W\254\206\314\247\177\355\244R\260:\243\273\023:MGO\255^AU5\2533\201g\315b\213B\273J\177\247\331\234\205&\241\213\021\206\275q\024!\242\213T\222X`\237e\310;\242\013\"\257:\333\003\354\267;;\234\274\242\264\324\242\303@\024f$\247\023RfhieTh\222Cb\2729v\245\246e\352\262\203\ng\266E6\322\033\n\227\250).\250\005\201-\013\356!r9T""\350\032\004y\244/\247\237\266B \212\013x\342/7\r*\356e\233E\240\227m\357\211\230\213\300(j\254Q\227\311\002q\004\226u\344\315\261U>\313\313\372q\274K\013\221{.\023e\331@\021\350\246G\214\2046\207\213Q\352\215\266\207\014\301\2637\363\200w\226\233\305g\332z\220\t\010)\001AG\254\316\216\343d\031l\355\327)\3363\033p\317\016D\260\363\366\354\336\002\226+Xs\032,`\275\210Z\373\234\347\254\0265~\0034b\264C\211Q\361J\277\034\225W\237y\321\375*ZB#/\342\330T\373;\374{\317\275\375\200\037/uRG\300\373H\253y\220\021OM\305=)\031~\264\335\030g\247\035\277\177\273\241\240da\223\t\301\343\314\337\321\177<\027\361H\315m\2665v\364\363'\224\017\270\020\000]!E*(\247\226\2675\262\030\303]f\331\010\354\260_\026\317\353J\027)\350\206\334F\232\3065x\031um\337^\324_\302\222\023\217\264P\363qE_\0377N\317\036\033\234p\\\363T\007\301\225\354\251F\002\370\037\005\354\351\333\313\311>\261\033\235\323[\270\275m\352\024\225\345^~}\332#\262\250S+\334=\321w\215\260U\024\027=\236\241\352\365\2011\330w\034)\267\022\334\275.\361'\250\231\346=\332\024\372\024\355\237\255\331\323P\253\246v\010\344w9e\241\351!\303\227\020\245\210\007\353[\3606\034K\rg \266\302c~\215\274-\027\361Y\3717]!\255\370X\3365\276\373Q}\347pF\373]\007\034@\3062\312\322[\264H\202\035L+4\223\027|\214\332_P\240\335\261\206P\336\257W\366\017\240_\177\025\337\327`P\r\001\307{\301\331\303n=\3458\2252\204E\361{\346\322K-\022\316\327\312\345^u\256\321L\265\304\211\235\033\341Sx\376v\2062\216U\373@\201\014\252H\343\244'\257\347\367\374\007\312\363\341\341\241\316\252m\312\253\303^7\013u\021-W\234#\302\2765\312c\235o\300\333\033]~\217\363\276\364\023M0\004V\356\354\265\363x\256\207d\223\347\361\364\371x\033#g\236\363\261\036\217\003\214\215?\013\371\242\372^X\252IE\017\014j\372}uB\270ck\276!Yu\357\330\252`\210\302\nK\300Q\333\205\022\222\276\356l\220zu\226\253k\263\035C\260\3722\tP7\003P\314i|.\334\266\337\276\340\274r\257\307\016L3`7\231t\312\271\225\017e\244\313<YNBq\306\336\177\031\234yq\273m\036\215\330\313\2072\300q\201Q@5\n%E\236a\332)""\327\256\204\355\265\n\334\341Y\036\236=\336\256\357\253@\307\035\271\3228\366r\350\215\213\312\335\2414\233\315\255b<8G\016\332\201\033@O\006x\016|\032mG\350\204\020z`\375\231(\352y\252\226T\242\375\274b&\230\336F\251C\200\256\307\3258\\\317\210\031\003\340\360\374\235\273\033\322\324T9\243\360\315\006\326g\340\321\037\242\260>\223\301J/\341A\335m\207i\204\374\256\365\305U\353\320\337BH\201\256\375t\200\344\023=\332\3378\023\324\266\271<\020E\251?\236>;\220\005d\366\035\307a$R\247\\\216;M\023`o\035^4\363\337\006\362\233\322j\334`\362<\255)@`,\216h\215\035sl5\324\374\r\250\021\343Xt\257\306\"C\273F\254\274\372\255\212'\037\227\206W\254c\227B%^`)\217\317I;\231eQ\263\334\232\311\200\027\354\370\251\202\006\330X\256\325{:V\256z\302(oY(\351x(\360\340.\204\035\301\003\255\001\000\251\334v\017\301\001mwz\031Y\036\213`\247C\340v\237Wm7\t\3005l\361\0145\n\354\233*\316\314\013s)\013\312\201\336`B\321\227s\373\322\027\225\215\244+\356<\373i\220\014\225\302\235\300\261\003\300\243\211\233\322\231Q\340E\223C\303\260o2\025\2173\241\277X^;\2745\277\032q\r\321\214\247V\010A\364\337NI\246\0379\362LB(!w\343\373<\032\335\347\246\217hU5\360\245\2502<\2340\215Z\023\324\254}nv\034!\214c\033\357\361\275\364\355\352_}(\264$\014t\2716rc\321\313\263o\200\223\324\303\222\0075\255\202\213\024\016?\035a\014\202b~\270\244\225W\257\244\274<\000=-\024?_\217\347\235\034\362y\337x7\333\274\022\303\200\250\365\370n\001\246\331p\272\"\204\254\330vZ\007\377\256<B\352\212\346\356D4\306\275e=\315J\001\227\253\276\rd\204\245\334\373u\311\n\224TT\275\211\007\320&\206\301\212\227$\036f\2630\354\247a\3229\007%J\235\031\374y<*\262\336\300\361\256/T\215SM\244\255n\207?\270\032\r\200\331\025d\212\0022 \262\t\003\"\177\236\355=\314\235b?\215\034\361\347\207d\233dH\r\216\342*\0357\207\003\020Q\021\324\225\242\010\322\220\3632kS\347\204\262:\tX\276\014\252\345\003<\010\310P\220t\313\206O\021\307\262\344\022\251\367\007Q\024.<V\005`\254 \337\322\223b~U\212\330\236\310d/i\301:\000\310 #\026\021PX\356\007h\313;\325""\215o\"\007h^#Q\237\261\277\2661\244\240\032\215\222\315\2446\220\265\350\361\220\311V!\361\362\336\236g\213\r\223\331\230EE\365\214\303\002\027e[EC\224\320\231\n\316r\270\275L\333\352;4\2327\363\207U\006\n\002\002 \210r\236n\r\271\334\3478\245Y}\351\234Z\316NJ\003\033\2041\242 \211\301#\343\344p\301\207\201\352\313\262\273\345s\353H\234%\252\363\000\247P\373\367E\226\313$&\005vG\254\275\326\253*\340\303\276\007\037\037\350\371\177c\327\024\t\375\312\323\347CD\000\252%QU\026_\320\245Z\255G6(\014\023IT\216\021\001\243\246\031\007@\320\262\315\240\2502\033G<\300\354\020\t\205\024M\000j\310\230\211\022\303\307\271z\030\200\320\032\023Y\303A7\3150\341\333WF\256#.=\237FH\217t=)\346\371\001>zv[\340W\201\034K\222\023M\221\207^\224\241\370\020\2031\0068\213\026\332*\320\020B<'$`\343\312\301%\307\257TV\230$.\346\224\001\217\177`t9\364\013\262\337\336\237\213\313^@\212\360\366\334+\206\r\245y\014\216%\2777o\t\306~j\221\264/;\t\371\"\244\217\245QqG\037.\315\002\006'\317\333\177\237\323b\212\1777]\010\225\337\326\014\372\353\320wdf\344|\231\342}\267\274\230u\343\023P\354\031\2408\312LD\266TD\026\002\207\266e\306\014\247Q1\213\202'i\237G\243$8L\034\205\201\240\301{\315r\247\201:\374\223\244H\250\301@A\224 \233Zq\036\374\246\207%\316y\354WM\356s@`J\2208i\244\277w!\034D\357\253A\022a\370|\325\216}\210\255\t2\242\227\372Y\316&\356vK\230\306\367\302\212\022\253\014\245W:\020\221\346\257\3562\356\257S\245\322j\262\341+I\247:qqc\363 \262b\"\200:_7\234\311\227\267\257\301\326D\253m\247\312!\223\224gy\2733\252\027\034p\356\277\034\233\261(AD\204\300\364\366@\244\0261B\322\rJr\013\020\314H\304\314\3150\313\024\027$f\\\235\2357&\231\000\361\354]\306l|\304\372js<\303\344:\265\235O{#\236FD\241J\0220\360D\333\262\312U\241\016\365T\210 %*$\021A\005^re\262\031#B\007\034`\304QI\032(\025@\267\222P \033\023\264\344+\302\0100\323\004\233~\n\344J\342\327\000*\010S) P\325P\"J\250\325V\024#B\2334\262&\001\345kIU\233\tA\222\335\231\265\357G\023@\014\360\274\037\013\261\273QR\241\332\333lK3\321\236""\231\322|\266J\264.\225\014\262\002{\341CFV\025\221H\304x\347\210v\302\212)\334\340\341\3343\332A'\205\205p\177\315\346I\204\362\232<B\373\313\256\251Lm\003(\250\266F\255s\330\352R\206\267\201\332\347\235K\370wG\231:\017*n\303\247=\3333`M\244\253c\031?\275\020N\236\213\367\214-R\3351\027&{\255\265\352y\336\305-<\035Bxd\263\205+\312\035\271\3530\340\260\260\201\373\306*\257HY\207nz\356+@a\235\214\373)C\000\217/!y\001\344/\264/I\345B\227x|\215\276\035^\3242\217\315\354\365\177\217\314m\226\231\245\321\303\213L\352\362\347\031\"y\316^\373\327\231\321\177\200\326\355\275n\001m\312\346\226v\261\"[O8\312\264\356\272\367\030\335\364ub\003m\361GL\273\345D_\272y\034V\302p\260\205\345h\016\2754\033\224\245\262\234\254\324O@\242\222GFB\035\001\321\334D;\226\016\301\033\236!\325\345,o\271\351`k\005\362\234\253{\265\3277VIu\024\372$\235\3145#I\022\333\025 \202\n RJ\022\211\314\n\020@c,o\202\361\253\000e\342q\003\007=jo6t\262\200\220iWvi\254\252m\273;\360\340\003\306r#|\331a\023}+\252c\231bu\241\227\260:\025@\t\227\010$\233Co\205a9\215\252\0267\241\315M\031^T9\207\334r_wa\274(\324\246\353\0338BQ\221eD\024u\347\030\023Q\002\266H\016t\024q\253\337\023w\026\237\236\210\024 V,\343\020\271\240\270j\255\245w\305\245~\245\221\210\354\326\317Lq\021e\316\360\332C\226\324\225\273_\342$\n \252\203\213K\035\300]be\272C\017\210\353\270it\030*\3043Mq\225\305\270!Z5\265\027\007{f\230\367\237*\230U\035\304kv\301\305FrR\340l\214\214d\202G.\241\316\344+A{\330\246<+g{\304\327L\352\356\322.\277\030E\371\302HQ\370W5\022\035\201s#\rq\306\244\245S\222WDg\306\245\016\255@u\030\210\027\260\314\261\316\241@\n2nR\243\227m@\253m0L\351\235K\271_\266\271p/\274\351\177\360\324r\342\304\342#\\\312F\367\262j\363lm\342\213\214\260\241\343\223\311a<a\3038\374\360\325\344\253\303\206`E\022\243\350\316\265\355ZI\326\244w\236\235|\3720\373S\322\324&\355\326b\223\350\264\023a\027;e`\0007#\0217\342\225\206LxF\002\004\200!+\362\316v\330\302\004\255\342\335}\233o3$\006&\006\273\273\262\002t\367^\206_x\177\006\246\331""\355l\356\206\353\322\002\321\020\333F\371\223\315\322\363\363-M\275\215\271zW]\235\246\205\001\025\332\222L\242\311\210\220<\2310\311\210\247<\020J\305*\260\220A\244dA\302P\215c\177^\322\252\340\326\326\032\360\316\224\301\333\242dC>\214\334\007$\235\025\024%\001\216\376\235\345%\206b\242(E\334\\S|e\026\007\274\320\036c\344\2679\362,f\341\256\221h\236\242\211}].j\321\3060\"`\247\323NPq\231(!\312\315\346\202\314\220t\215.,\005\r04\204\200\034\024\262\227\333E\221\021\312M\250\276\273\273\201\265/$;\004P\333\275cv\367\005\233\331\215\243\265i\225Q\243S\347\230\224\227\006\213\236\227\276\200\032\262y\303\301\322a\035\266P\336\312\007\231\304\014\0108\020\243\016\236\"\017\276!\037\211^\370\275D:\202O\032\307\341-\341J\304N\211d\230\307'\237\025\261`\310\320\207\313\000}\205k\255Go.\223\253\033 O\224  \022\300\021-i\006F0U\252\203\002\004\365\2776*\314P+\032k\"\310X\243'\030\344\367z\316\357>%*\220\353\212b\264\251\033J\212\254\004\370;l0\356&\013g\337a\006K2 ,\017\017\204\367\362\356u\244ou\033Lm\265\2744\2464O\206Yq\356O\223\236\234\020}\214-\271\301]\330 \224R\001%\000&\366\250\300\005\363>\236\035\242\344w=\361\375r(|\024W\215u\320|i\344\212q\235\375\036\177\265\371\251\342Hy%Lb\250\243\023\335c\204\301\303\rd\315\346V\306\r9!{@\036?7\314|\202\371\027\314\0375\275\206\205;\344C\216#\363\025\315\267\032\0044S{si\201<\222\220\261\002\331\355\277\235\302\262\031\347\364\213R\232\377*5\241t\366\346w3f\266\017\323\211\313\030\366\035\260\264\305WL\\\370~\033\315U\303T\337\360\203\036J\236E\246\334\303\267\247\030H\177U\322\213\3571\272\365z_\013\356\310\213\037E\322\006\r-\202\230A\216PWv\361\345S\022\326\023,\310n\231W\n.g\305\344\274\221\344\221\344\036B\362\375/\313\354f\0220V@Qg\320C\350\226\n\003l=\204\224\373#\204\363Kd\330\031D\266\242\252\252\306\256%\375\207*&QU7o\202K=\002'\233\234\207\271\363\372p`\365\254;\033s\201\345x\366\262\210\221\262\315^\333+\244w:Z\317\315\212\273\024\326\320a>\235\364\271\002\330\336\034\346\367\274\3345>VL\207g\315M\2308\265[R""\225S\363\355\307b\024\3001f\322\232T\322\272]!\247I\354\371\271y\273\362)$\202\222\007V[@\362q?@2\t\013=\023\335=\246\373\314\207\242\317\254\252\213\t\277(\026\302G\371\254\252\355\351\304\326Mt\231\020BS\006\352\242\212\242\337=\300\210\253\213.u\033\376\263G\030\242\230p\241\327\206e'\333q\353n\256$\315\037\022\235\232y \362\027\220yy\036G\273\352\300\032_w\030\023Hcc\324\367#\243\232\000B\216\351\354\205\2126}\031\031\304U\364T\346\245\003\256\332f\307r9}\300pLP\244\317\254;\261\242\036\236Z|\360\245\362\210\236\3146\262\005\030v\3516\260\266\334:\361R\333N\207\322\333\033\367t,\255\205\331\253Qil\362\027\245\035\200l\333\030\t\016\207\333cJB\254\001\236\255(Y\001\344?08\221]\033v4jm\313\335\233&\003h\321\220\301\26088\n\370\330\3415\370\337\327\250(\313\244\025YEX<\232\346&\024\202b0\327\004k\2146\346\316\321\034]\003\244\343T\301\370B\004\356\374\030\006\220\246\306\003\202\244e \233\210\231\202`\222V\363\005\230\317<8\200\207mu\371uGk\240/;\026\222pF\014\342SnT\213\204\376\364%\220\261\302U\377\316\210\374\321\366q\244\330\256*h\375o\177\233&\206,TB\"\"*\202\202 \240,\021\221\214\004\021DUH\373\244\343\361\320\365\t}\035pzbi|\034&\220\3304\260#$D\204\216n\371\305\210\310\220\342)\"\222q\215p\343\361\370h \257\343\240au\345\231\356\240\215W\240\025%\220\204\340\251\332\315\t\032`\365\210c\350\204Sb\346\r\345\265X\333f\221\276\220*\250;\341\215V\352_\351\361E\262\t\350Q$\035*\340\206\370\361\267/\300)\251~\007s\351@\375d?O\235\016\260\234\244\334\352\366\362\360\245\232*\260\251\304-wJY\302.\334KB\370\306\022z\373P\355\036\321\354\343\373\372\301\034\321Y\021\t\0220\3153S\003\241\202\313E\220\254\275\374\324 \005\253\267He\341\244\325\360\005T{x\031\266]\201v\224-\t\021\r\025I\r\246y\361\247 \344\035\313\231\334\231\337\343;\024\353J\236\206J4\262\3734\366\260N\255\223\332\302\036\nf\233<\t\n\220\212\254'\024\003\212\027\0169\\\232[5\nK\357\276\356Q\333\305\246\247\3254t\354)\207\260\240\204\026\000{\370\36063\301o\223\267\266s\031;AR\nC\253\357\241\327\236L$f""YA\020X\200\254\003\350o\2051\276\3417?K;'>\212\304\260\340T\304p\263\342\204\024AX1\004V\"@\212\004X) ,\021T&\342Z\330\023\353|&\210\244\364q\356\200\346\362_\037\232\356Y\301Fe\303\016\327&bwE'\234\237\256|\236\365}\254\316\006\241\276HA\213I\021\360\360\014?!\202\355\302\231\360\315\031pb\013\373\356\272'\234P\225\252\344nEg\213\254a=@\202\311\353\207\334\232\307\255\205\362\242\263\350\370\357\177\235\252\3668\206\347#\267\225\231\233\016\377\r\273)U\200\246o\357\034\030=\301vi\200\030\213\342k\006<G\321\253\237D\207`\376sX\304\026\n\007\207\252\214\223*D\204\026\021\220\206$d]\351TZQ!V\3768\376\377\261\340\376T#\206\217\331\362\360\345\233\342\236dS\267\302\302VDQ\307\311\017\223\357\347\316|\247\224\331\026vB!\035!\007J\024\021,h^\247\007\231\201\347<\350\227\334\271>%\006\027\034\310\267\3117t\272nH\202\353_F\017Q\255\010B\013\206)g\226\247c5\256\342;\240\210E\006\">\224\242\036\344\242!\204\n\"\244\210$\010\241bH\241X\253\005\222\005ID\226\322T\201m\010-\267\030\261L*\262\014\022H\273?\264\345\262M\311#\306\206D\354\333\303\277\326\002\027&\323\033\003t\227\270\226\266\035\327g@R\300\312\341Y\222p\275\310\333aJ&\246;\321\033\002\375\303\036\030\3256\326\376\r\032\035\032\014\270\257\243F\0202\274-\236\206\301\372L\272\261R\3267#:\342U\313\353\212\341Rli\275\227N\321\002\006\2141n\323E\006\266\324a\334\301j\200\037\327`h@0\212\n*b\312\252b\221m\264\362?\261f\320\343d\223o\010\032\025\352\227\315\346=\257\362\010m\252\013\262\236\364\224\364\217\320C\016\223C9\317\251\341\331,\207\206n\013\336\034(\260k\344\232=\204\361\r\217c\003\277\034h\243\t\316Hq\213H.\316\033\020p\210\341G\tR \221\226S\017\224\267&\220+\337q\210eL\026n\304D\005\353g\235\360\034\243\251j?G\302h\363Y\277\261\354I\243\257\242\203\224E0\333c=\351\000\013f\007\260\320\244j\0345.\031\"\207}\t\247)\003^\034*\261\0233\031\201\267\024'\016\333\242\";\007\340\242\304 \233\364\3664\340\t\237\034\353X\355\355\260(\017\317k\233\363%\345\355\3018D\213\025\"\305\003\305\n\302\"1P\026+\255\372r\220\354.""owx\201{\363\240<>\177\014E\350\234\247\003\320\327/\303\273\261\277>\027\036\3060\362\272Q/\241\006\342\006\243/\202\305r\332o\276\261\003\000)\037\"_#\310\3619I\2220\202\201\"\010\230E\006\204D[\326\013\310\214[\343Q\"\0268\004\227\001\005\216\305\224\303!\356D\030VDf&(\006P\220\nf\241\246\302\346\366E\220\221\221\221\ty\277\313B\323\240\350y\336\232[\264J\276:\254\"\212+(\310L\226\231-\250\220R\305\025y\316%|\265\302U\r\3218\264}j\274\035~\373\314\340\220\267f\231\224\231-\n)r\302\014\010\221\2123\347\201\334\275\2762J\260\240\374\255Y\202\211d\260e\242\004\250\244\250r\315\000d}\321#&&\201\264~\000\341\277^\003Q\275\307\270\330Y\2356(P\332Q\275m\"\273F\004\211\263w\266\311#\001Bh=\004\360b\276jur\221\305%3h\371jXh`#2\311\025m\262Q;m\201\204\347\276\340x\234j\362\0313\372\266^\243x3\306\3311\025iCX\246\230\206\300\321&!\260\026\002\312w\316\247\235b\212\211\024a\370\2307\204<\252\233\365\365i\026\255\236\205\010\255\256\022;j\027\226p\211\202d\374.\205\010\006\330\231n^\353\234(}]S\000\3242\010\202\240\304$\021 \210\014\021\031\312\030\260\246\377\021\243>V\375rK\306\247\022s\350n\335\206=P\024\2514\306\016\321\2644\324\326\307\000Mru\262\357\370\201\263\271BE,d\250A\262\201>\013\3622\241\375\023&\034\347\323\360\300|\013\270\363\034\205c>|\216\034\221\230@\264\320\352w3\273\034\0073\336\333\215\272%\243\233\203\361v\346\"\367\024\004}'\267\373<;\036\257\214\302\371\376\030!\276)-\351A\026j\314\254\204\027RT>\202H\256\267\2379\251w\033.\003d*/*\277\213OR\304|\375W\3655\346a\322\310~)\030\214\007\017\226:n\257I\333\327\321\021\373\323^\322y\321T\201\324\232\001\241\300c\336I\334\230\341\272\003vg\267\256\333\026\236\272\027\340!\327s\035\205\300\270\230\360\224k\274pV\306rFXc\255\365,\304\243\013V\231\336\217\2664\0311\020\302\0003\310\277V\2267\207\263\020i\003\033\267\333\347\310o;\030_M\234\254\206\203\035\016Y\353\031VJ\t\203sJ\010\267\036\314qm&66\362H0\022:\351g\273l*\371\370\355;\024_^~\303\317\331\205d*ROUJF\310\224e\025(-\203`{\311\343~\310\320\301d\250""\2634\262d2\000\2463\227\210\325\221f\2040\372cWh,'Y`\335\321\226\201,AzR\204(\027\024(\2136&!r0E\250F]\332@\204\033\205\354\200\206f;\013Y\255?\026\374\027\033\352\352\355q\2561\243%|\241\330\235\260\364b\206$\243\" \252\261a\025F\330U\025\200\212#?L\366g\022d\021\022\002\202\210\310\262jf\341\370\354*\301\024T\031$R\224,c\001\010\232h\221Hl\3428cZ[A\200\262\332\"%\226\005F\014\233Z)^\232X\317!:-\013\002\264f\343\351(|E\205\253#\025\255\316)\302\tZh\213ByG\225\257*SVz\374\250\260cT\264\215\352x\236\3266\241\370g\312\236\370l]\326>n\240\310\236\2746\304\335\243\261\032\313\251\336\347:\016\025\3405B\202\302\00066\230(Tf\334\232\216\230\3761\246\333Jf\305}\356\033\275\246\205\370\365\221\333\272\342\235\020\250N\267T\370tJ\250i\347\315(\031\236\005\324\277\317&.\236\317\"\326m#\234`\312\253\333\216y\274D\335Gb\201_\252\346\306\244\017\374\203\316\362M\001]\2032O\t%\266\260\371\324C\325\030`\2079\0101\313\023~7\331FF\\QF`\320\014\335\310\226\204\345E\211H\332\262\256R\210cpCM\220(Ikw-\212\376\257'\262\227\177\307\250y\205-\231\236\025\366\230\001A/\321O\336\331^\336?\212\276\013\203\207\242\206j\210.\376\341\014\007Vx,#\261\333\017?\224\334\307\231\232g\345\n \214A\203\024\212I\026\003\021H\t&C\032\305\260\013\006\004\033\2130\014\227\005\367\304\316QK\n\226(\266IJ\302\312\\\204\017\206g\214\3434\014\254\3231\002\326\312,Eg\327_\002>\025e\355\036\223\356O/oR\264\264Z\2653,\310\213E7)\241}U\256\367%\031x\332\255,\273 \037\013\206\005\241\241\203(\010h\203D\3244\205\321 \316\027e+\027\366\032\3431\332\210\371\031#\325\245\372(~\251\317\177\334\010'\247\323\022;\371RG\250\257[\371\337\367\371,\274\226F\243\246\262H\360\356\207p{p\317\253\010\236@9\032\026\302~\300\362bSp\332\235\246v8(;\034\271\243\022\222\270\315U\262\223n)\207\253c9\315\3513\321\324S\323\302\327\227Mf\237o\200\326\3357\205\302>W\210\016\037\344\035\027\323\307\253\236i\274[\313#\326\037a\324`\354G*\273\271v\335i\260\250\321\241\210V\030`A\"\251\311+\235\2542\360\026\"\000I@dA\301yO\037q\360\234vl\277""\035\364\374\264@\024r\227(4/\030\310p\257'RB\336\333=A\360-\231s\340\373}\260\344\313;\237\362p\246\035\372\354\334\372\234\272\272u~TZW\215\200\037\213\221#]\222)\330\213^\362\214P\n\025\007\235`b\325\303N\350\033\202\033\200\206\243\014\245x\315^\003\237\035\266\246\253%\357\351dwrZk\304\320\321\346\361;o\350\362\2108\2408\325\221\242\233\300\320\307D\024\371\246\035\3243\3039I/\352\332\020\256\376G\315:\030*\362\247=\351\036}Q\305\241gy\317\225\3157\305\357\213 ,\221X\300\2646\230\017\257\02062\"E\207\203\201\3437\337:\336Z5\351\363\353\270\0036\311\274\013\200X\017Fc\030\345Ln\002N\220\257\236\243zE\333I/\206Y\365\3047Y+\231V\t2\321&\256\365T\223\307\322\216\256Z(\024\354\372]\343\204\362\275\231\035\"=\243EU\261\302\367\334\375n\035\310\361oc\361a\256J\005)\010%\031\274\271\367\357\335\026\227\217\3158\355\262\251\225\221\221\033H\221\352\351E\233cM\242\207?\034e\327\310|\274\222\032\274\367<\266\303\260N\304;\023\326{\271s@\220\206\2233\n\217$$\204\222) (\210\261\211\021Q\026W\035.0\324\314\204O\213\324g\007c=c\276K\302N\032\244Edp\240\301N\023#\203eC\207\262\031\030\2024N\021\255d\325\320\263B\216-\307[\304)\367\204\005xTlY\325\223\003\000)\245\300\034\210\322\242\233\263\tj\002\315\256\212\340\306\024B\013\311\242t<\366\002\241S\030S)'H\002\203\014\024\203\340I\216\226[N\266\217\024\3339\3012\315\014\023\255\243\n\206\031v(T\210\212\263l\350v\310`\342\354\233\346\2066\364\273s\271\031\000\245\200\345\004xHP\206\200\207\214\227\017\024\003`.\2130\240\346\354\251\2333\210\033\267\005#w\227\035R\260&\030\017-\256\006\010\354t\314\210\215n\030f\222|3\300\231i+q\243\207@\")\231\305s7\240\301\350\002b\301\005 6\3040\330\215])d\333%\324S\270p\346B\205H\331\000\271\000}\274\177\323\3346\336A>\035\276\035\334\303\202l\374%Y\354\010\214\323Bv\336\374\364\260\2134r/ea\n\230jq\244\0031vL\240\024\205\032L\225\366\243F\305\252;\256\n\025\035\3447\3168v\005\321@Q\005-cFQe\264(\206\341\235\316\250\355lm\026s#\230nzI3\211\3437\340!\217b\220\204\315vD0UW\220\275\370\306\327""\227R\326\363\314\222hX\252r*CEV\224\237T\024Q!\200\305\014\241\206NS\022 \330c|s\310N\343lw\t\034D\021\001\307\354\365v\353\307\321\307\r^\234:\347Q6\227i\375H2gs\267k\216mD\301\252\342\203\\\343^\264\227Kt\337\271\253\306\301\261\313\"\346\2240\312\013-\265\023\300*N\325HQpmK\350\317r\033\364\202\240\213Xz]\004\266\205\256d\204\245\331+\203\324\273rb\342\227\320\271\271\230\261\235m\226\324c2-\263\225\203B\301\266Qm\021\024L\256b\036\355%5\233c$\327\341C\271Nrl$\330+z\211\265\345Us\217\236\220\364\322\030\2131/\t\201\247\"\356\361\267\036:BK\344\215A\2128e3&9\307\303\311\355\3578\246\232\276v\340\263e\370\355\273o\317^X\360Q \330Y@v\240.\213\035\265-\033\033\236\t@\006\331\010G\231O\024(\203E\251\333\261G,a\227\211I\342\273\346g{E\255\345\206\336`\007\252\362\304!Cm\203ClM\202\255\216S\242\322\242Q\206\245\014\315A\214hf\316*#\307\024\254\3046\371\370e$\365\353e%r\264\341\317.\177\215u \206\2445 j\035G\304\3747%\307\023\261\335\300'#\262\005\247qC\322\036\237\020\201\274#\034'\003\030\310)\351?\262\311\355}8\250\016\247\277\251\301\323\362\003\351_p\212F$QF(|v\265\373\357\306\231\227\034dH\305\220\221HP\3301\237>\254\236\364X1\014\351\257\010]=\244F\037?g\315S\325\267\252\264W\366\031\007\256\215\0274\003\334\216\227G\235\345@\010\241\321\242\250\314\367\267#_<*\276w\310\014\274\r[\016\306X\0315n\215'\n\247\302T\3040\370\343D,\037\222r#\222H\216>\314\273\321\304Cb\2069\222\001\235\251\324t\017Bu\017Ru'?\301\233\215;\304\221\027\316\376\231E8z\025\302t(y\242\365a\215\272\222\275\026\237?\216a2\241\310\372\nP-\247\024\301\242DI\207$2\346\321\326C\211\307\005\332\204\213\"\0170\322\366i\204\274\t\267k%`+!X+\010V\006iP\356\242\365\004:\210\204-:\236\313p=Nwr]{#\253@G\241\220\235\371U!\276\303\271Yj*\263&8\"\350\246vo)X~*F\202-A\035PuH]@\350\001\320:\237)\366]\241\341\330\233\006\240\210\340\233_8Oz\375\332\271\033\022\202\275\254d\203R\377-\001H\034+\333\365@{\"\0136\013\341\357H^t\277F\037\037\001\034?`\022\366\210$m\203dI\375\254q\323\014\374W\246k\362\3228\373F""\232\323\347C\3212G\346\275I\010<\210I\306Ue\250C\362\261\333\322\250\004@\345$[\306\001\"\272\272\0249\305\347\003\2349\303\234\270\333\322S\221\225\235~\275\362O\300\270\301\262h3;q\205\025\034]\361M\215\262*\250\221Ec\2754?\207\264&\3710\031\312{\363\230@\314\230\306\3729d\033\022\206\351k\036j\374\226)b<\305\3641\212\210\257D\227\324\232i\\\250\037\231\240\033\004\306\225^1\027\336\202\373\331\270\276\3434\327\350\330\204\314\366kG!mW\250x\0258\023\200<\276\316Tw\246\357\333\356\342\331\312\271W+\224\323\244|\377\177&\326\004\323\023J\022\222\231\005\276|bF\005\002@\332\333\243\277{\"!\032\244\222P\240\341\340\253\237K\350\374\317\306~\037\217;?\347\217-\020D)\370\210\311\363\357E\346aS\r\2330\345\267\246rd\273\014\243\243z#\335)\026\356m\023\251\217$;v\320\220\273\274\320\274e\014XR,\037\344\330\315\010V\230\336\243\336D\357F\351\333:v\3762\037\276\305A\"\252 \250~\357\336?\214?\205\370\341i\024\021-\260\213\024D\026\002\243\010\242\010\242\213#\372\366a&\025\005\204XE\024\"\n\240\254\20219\263\364\217\343\306\002\244+\002\242\222\013\006\002\260B?\243{[\372\247\361e\316qC\365I\372!\342\233,\230d(\206\023\376\360?\205\212\007\367\377\030\247\370@\020P\306n\"J\305(\310\221\203\030\025\005F\t\031>\006\304DP\302\030\020\244+b\223\t,R2\030J\013\024@\302\nF\330\214\214?7\007\335}L\307\355Eq\214\346\300\370X\025\r4co\333\305\r2{P,I\373\277\223\220\377\"b\221\277ig\350j\344\231\307\322\241\227(a\225%\266i\216?\203\000\263\356}\337\344\3734\307\356lX\227\361Y\006\203\001\003\370MY\014}u\013\000\223V.\276f<\274ib\252d\nX,\230\004\231\030\017\310\241\363\376\375\237\265\366,\374\326\016\312i&\035\222O\254\343H`T8C2\177i\244\253\313\023t\016\0314nR\202f\335\206Tdfs\2110\2340\244\332\347\0268\265g\355\374A\3756>1 \375\320\r}\362\322\253\306\264\321\232\202\002\0314;GpoK(;R\245\266\016\246,3\273\304\304(.\370\230\372\377\345?\364\177\005\221`\251\200Q\177r\300\323\376\000\310[%\245\374L\377K&\267\374\\\033]\3208/\325\261\244\200,\255\201\275d#\210\364\001\023H\005\\*g\362~""\017\225\362\203\374\037\177\362\017\2265W\261\024'x\036\350\004\335i#)\177\240U\273\223Zx]\017q\004K\030\333\026\253lD\326\033m\320\260A5\t\374#\356\377]\036\2579\326\027\355\321\371\246\201\203Mi<\003\347\020\335g\363@\346\201\262e*\017\200\222\241\352\326\267\274\024\301\327\364\025\305\347\2318<\3221\331\313\n\026\031(J\010\247\346}\244\375\237\336\277\235\341\200\375\372\"&\354,\022)\373z\321\230\013)\375\363\374\303\373\022\004mZv \024M\035\223\355\232\313a\366\330\225ec\266.\352*\000w\243\020\034JZ\326\026\264\344\002k\217\366\275\225\316\372\201\301\362\371\216\002i\037\272\351\034_\242\276\350\324$\211?u\374\3100\036\371\031\336F\004\031\313\0239\346\253\231P\331\036D\262\340%\202\2172\325\320\023i\032\350{\034*\233bq\307\240\004\311\250B\204\323\242\030\241\030\341\305\006\237\023\332=K\277\036\251\250\351\344\304L\312j\377$`\346E?L\247\355\220\304~\247\334?\177\204\341\2277\341\271K\241\311m$\030u6\370\017\017\231\222\003\036e.\002\203}\341\224w\037I\261}B\350\330U\364\374\202\177\327\275dO+\334\036\224\006_\330O\324-\330\306\345\017\325\274\203\"(\352\350M~\260&\217\327\304\030\267\241\270\022\244\322\267\336xD46\267N0\017\333j\376\322\213(P\226#f\326\357h]\3647e\020A\256\304\372\337[\333%{_\214\236\330\355\033\004\230p\257@~\"D\027\367\230\013\202>\305\032\317\265w\266\006.\317\235\261\331 \232\346t}\236\210\256\375\365\013\351W\3033\236\367\231\325W\242'y\303\025\017 \344\005\247\325\365\374\321\331\363\273\275~\225'\347\366@7\3243\263\371\346y\365\235P\364<\217\374C\265W\330\311\0050\206\013D\202\272_\242\003BI\022Hn`\360\"79\033\205h\035\n\220X\355\303\265KB\355\305\306\23647\222\240\004\371\336w\242:\200\354\256\327\376\327\252\035\372dz$X\317o\017\264'HQ\231\005\207\354\335q\323\177\275\266\re/c\277\035(Y\227NT:\177\317\263p\257S}|^\266\003c\222\210\034\216\2600\366\025gN\266\205\021\330T\207\271\334\365\275_Iz\210\337\247\333\365\3700v\330~\274\030F\353\013\"~a|\007\321\351>\346\237p\332\031\2057\265\320\377n\343n\206\010\215\206\267\0011\301\335""\322\217\010\373\206\214TS|\021\246\036J\307\361\354>>\266\345N_\333\333\362f\375\332%\222\n\367\021< \016\371sLJ\244|\321\013\263\243\346\244\016~\244\025\370\355w\304\004=8s\317\343fs\321\232\235\335l\364\213\021\362\366\037\330\371\242\237\242\234\336\177\2273\000\365$\204\212|W\362\371s7\346\371\021ce#rG\010NxE\261\367\013G\223\263\225\300K\251.\203\243\351\307\321\320s\267\352Z\356\241]\302\000\373\236\312\236\311\325{^\300\366\003B\270\032\001\006\001\257d!\232\366Bd`\333\\=\201\324\225\010~\330\265\027%\336\261`AV\273]\317c\277\364\347\323\356\367=q\334\342\352\241\003\3317@~\022\310?\022\261\2606\372\241e\033\214g)M1\000\022#\352\306\333J\006\000xK\245\020AE\356\251\275\000\372\016\350\356\372\335\316\337o\310\246-OgHv\346z\352\230\206\277\304\277\211\346\037SB\314\2447\267\352{\304Z\247P\033J\"\324}F\003\256\363\272'i\251~\307k\352\000=R=C\351\021\007\247\341\242\253\273w\257_\266\300\206\211\305\353\203^\303\005\362 \254]5\304fwr\372\247\217\350\017Lx~\253\202\273\276\212\254\356_\247=j\356\304\3224\376\316\3215\375\002/}C\376/\303\302o*\333\363\317\010\347'vX\2143 D\225E\214{\311\374~\336S\335K\326\250\357k{\275\236\307\216w\262i=\255#)\032\263\360O|D\301\030+\022Na\247(\323~,\347\263\324P\377\356OY\366\252\240\302\362rq\273\217\360b\002\236\356X#\357^\346\026\021\016\225f\202G\006e\366H4\234\036\236\036\017'#\256\341\370\020E{\007\336I\311\352\344s\210\217\364=SA\245<\216|\263\331n\t\322\022B{\247\\9\316I\233\203\323@\337rzn\371;#\262\010\263^{S\215\361\001\320E\032[AV\350\237@}\356\323\233\337M\213\350\342X\370\267~\337\303\211\221\334\234\207\341\351Q\242\343\213\323#\243\344RsD\257\037\310\312\257X`>\017\324N\035\315\335\337O\013>\"\013\004w\027\013\35507\024r:5YdV\232\021B\033[A\342\027\201\277\272\233\347\002\275M\321\355\023*\360\272+0||2I\037\002M$\345\331\327\333\370&\372\356\356\220f\334\336\341po\203\241\035\242w\004\334\315>\204\351\321\215:|s\335\010\2262e\237\363\232\201\257\304x\215\263}\373G\014\033\211b\340\342\371\302 \202\3612\272\000""\371\037\t\323\016r\360\223\210\335$\337\347o\346\177\033\252p\233\336\037\233\366\363+.\326\265\331\336\346\364\376\3224\317\331\371>h\377/,\371\2603R\214\003\314\007\017\336]\3658H\374\376\215x\366>,mm9\361\306\246\353G\267\024\203\266\367d\204\223H?zAI\244<\377wd\347\353\271\337\035\270\266\222-\201\321B'CfGI\033\3677`n\204\273\221n\311\033>t\367:\032\333\006\307\276\353\027{qY\356\374\2761I\301\004\340\221\337\036\032\021\30530\345\226\013\010ln\353\233\007(\330\214?\341\275\022\304\363_\317\257\324M\227?g\341\350\212+\346E\331\330\220%]\221\332\335\255fc\316yF,\256\260\367y\230\207\217\304\226W\243\345\375<\316C\332\221\256\254j\317\266c{\030\361\271\001\205\366/\211\356gZo#\275\276\r\025\321k\316A\353\244\276%u\261\317\346\222/k\273\276.\365\265r\350\216\361<\342\213J\317\216\333\374z6\377.\367\266\333\237k\305\355\370.\227\273\330\276\035+Z1\373\276Q\3706\215\004\360r\351.\234\031\235\341#\322\3664o~\217.\201\340\320\365\212;KwC\370\320\3204\217I\r6\177\306\333\211\r\033g\337\367x\\\352\373\376\017?\002\247\204]\376\337}oQ\251\033k\331]\327e\344\352\263u\035\231\222k\352l.gE\371Z\031\206\217\324\247/\324S\317L\2458\333\033\342r\n6\276;\374\364\327\365\363kdv\177]N>_\277\310\270\357y\310\376\256E\274\207hs\273\374'\177\277}\013\352\232\276b5\212s\323KK\311\367\370=\314\275\023\311v\270,\216\017%\305zr= \314D\335\326\020-\262\333\212\177\t\363\236\350V\377\263b\220?\242$\374.\321\007\321(\257\366\300\362\031Y*X~{'\332\357\005\214\022!\357\367\203\020|j\233z\311r\235\"\323\231\220\256\242\255;G\227\253\221\306^\213Q)\3332\223\003r\267\003.\351Z\277\205][\352\327\3464J\265\273\233\337\003\363[\305=\035\335\377U\331[;\334|\006k\007Z\222\365\317\231U}\332z\330\241\263\272z\363\225\n\236\304\334\365\027z8?\267n\346\177\347\231\307\3464\350\036C'\321\267\235\235\2232o\267[\265\374R\265\230\266\242\372[\340\313\325\376\\\257\366r\362\220\367\354{T\331?\r\256:fw\207\244\027N\276 \374\301\273o\216,OL\217#\204\200)4iSDl\225\035he\027>\311\342\0102\007^\265\352\025\211o6o""\244\202\001\2024\t\322\214\253\230D\202\010\202Rh\250`id\310d\205|a\275\330 \346Ak\257{\021e\300\364\032Z\001;\336\212L\215M,\272\271\251\301\016J@X)-\002.m+\033\311\226s\002\202\026\232j\024\312\304\260z\202\306ZY\227\210\334,d\003,F`q\215j\246\027P[d\203BY\030e\010\021\010\301\037\023L\362\306\362\302\303[\032\335\352\300#\006\\\326PY\251\212\210\215\030\020\263\030\216\271\326\r\326\205\255\r[x\033\303h\215\341\227\020\266Y_\035o.\265$vV\022\r[SL\215}\334\307\027X\266\341\246&a\260\022\321\022\242\245BL\202\221\245r\034\2322\035\036W\334\366a^3\363\342\346&\335\201\026\270+58,\221\2313L\010\331E\302\305\340\323\324\026\205\214B4\r@F\244(\241t\260Fm\350)\246\026\215\335\207q\330\226K\317\250d\033\311\267\034Ze\335\256\374\341 \214\342\321\210\301\035=\n\232\014[\305tN\251owy&\244\026\014+\026\343\362P\nl*\003P9\270\257C\017\010K\343KN\346\336\356S\\\315\221\002\261\260\360\330\324\201\216\363\225\\\203\007\000m\350.\032\"#\303\326L\027\365T\311\260\234\330P\226\212\202\305\336\340W\214`8\315\206\216\333\324Rc'L\r\005\035\252\200\341eC\262QY\3255\020\226=G.\217\353K\300\027\212N\213\010v\256vB\032M\264.\263\034\313\302\236\200b\326T4n\002F}\010\200\210\r4\005\3562\326\262^\313\032\310^\014\320\200\334\305z1_\225\023\345\245\212J\260DFt\014\257U\010\321!\343\201\263\034\311\001\301Y\225\230M\020427\260\211 \241.\346<\330+Z\246F\231\323za\214\024\204\262\323\262\025\n\\A\211Q+\003\333.i\003\314\306\362\361\213\025Y\353\371\256c4\005\216\375\265{0\271\002\032\035\361\307\337w\242\200\203\242\224X\200\034\243\276\371\270D#\010\303V\225\016\010\014\020\004hx\354>f\365l\002DEG\030\250D \304\310gXll\211\255*\263\014Dq{qt\036\\Tp\377k\377\342\356H\247\n\022\007\303\327;\200";
    PyObject *data = __Pyx_DecompressString(cstring, 21600, 2);
    if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error)
    const char* const bytes = __Pyx_PyBytes_AsString(data);
    #if !CYTHON_ASSUME_SAFE_MACROS
    if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) }
    #endif
    #elif (CYTHON_COMPRESS_STRINGS) != 0 /* compression: zlib (24046 bytes) */
const char* const cstring = "x\332\305\275\313[\033\307\362?\214O\234\034\333\301\t\330\370\226\253\360%\200cct\027\216q\216\014\302V\014\010\220\360%7\035!\t\320\261\220@#\014$\347\222\245\227,\265{\265x\027z\336\225\226,Yz\251%K\376\204\374\to}\252\272{f$\201}\276\317\357\373\374\362\304h\246\252\246/\325\325u\353\236\236\373\236\237\306\356\216\377\362\355O\336_\242\305\242'WX\317\227\254B\271dy6*\371l>W(\255\332@\317\255\234g}\313\252z\226\363\236B)\227\337\311\347<\231R\316S*W=V\261@\344(\303\252V\350)\313P\276\230\235\361d\313\353\033\231ja\271\230\277\357Y*\025\262\345\\\336S\256x\242\311\311x\374\016=\357\231[\232\231\361,\357V\363\026\340\331r\251Z)\027=\331\265L%\223\255\346+\3269\017\375\027-\241\260\344n\251\232\331\211U*DX]\313T=\231\\\256P\245\346e\212\305]j\327Z\276R\250Z\236\225Jy\335\023\265\254|\0058!_)W\270\240X1O]\252\246*\371\274\347\236g9\223}\265\235\251\344,\323\314B\261P\335\365T\362\031\21381z\216\237I\255\025\210\240\230\261\250g\231]\317j\276J\004\033\305\014\365\232\032\356\311x\350\272\320\321@\202d<+[\325\255J\336\363\232\372AM\031\225\276TV\267\320\006\017\225\n\376\021U\241\230\277[,\274\"\316,\377#\237\255\032\n\315H\303\236-\341\340\035\317*=8tk\32476f\ru\220\31388\350G\037e\254\274\352\002q\302\223\301`q[=y4\326\222\226=\332ZY\311W<\257\013\371mO\256\234\227\346\345w6\312\226\224\231\313[\223\336\300\234g%C\r\316MfJ\236r\211\030\237%vU\363\324\217ey\236\207\006,\243\261,\254n\225\267,0c=\277^\256\354\216\232\247r\005+K\254\007\347\321x\246\341\322i\334\n\231b\301\312`\364\0149\352\337\360T\363;UC\350\033\035\353 f\206ZVa\265\344\251\2261\216\271\273\374\270\324\216\236\031\242\335Rv\255R.Q\363\010\277M\222\223\307#z41&\212\224d\261\264J\310\265\274ghg\2758\204\t\262R\330\361\224W\030\006)/e\326\363\326\006I\204~DX\202R3$\372\252z\341,\213\347\t-\313\227\370\021\024\233\313\323\230U\270o\272\327\212\210'\241g\273P]\363Tw7\250a\n\276\221\251\360`\355\026\363\326Z>_U\340J\336*\027_\347=K\213q\217\002Y\033\371lae\227\252#\t\201\270pa\216*\252\225L\311\342\261""\267\233(DTy\201tD\325\2414&e\024y\2020\003h\354\301\306\241\273w\207 \210yR\026\374\354\320\335\241\311\362VQT\207bS\374^B\006@\346?\215\361\250M\263B\265y*e\272*\221$?\030\234JL\246^\316\307<\3727S\004/e\004\253\371\022+\021\351\200\214i\241\352!\275\220\237JMy\204q\2441 1\371\334\224S\273\251\311(\035\233*geF\231Y\000\375\0001A\027\254\354Z~=ch\3144~M\305\346<I\306\222\022+\035C\210!\342\021\316X\236\305|\221\346\340\334\343v\032)\352d,\004$\331\265\206\355<\315o\232\347\353\371\\lq1\235x:1v\016\027\361\271Tlq.:\223\246\233\304\342\204\227\201s\211\364ll6\261\370r\302\307\367\304\327\245\331\330\\*\235LE\027S\023~706;\237z9\021h\003\316MM\004U\r\317\2423\361\251\364\223\330\213\364\344\223\350\342blz\"\344\302L\305&\r&\354\302hh\244\003:1\316 E\220\216R\215\211\351\t\357\230\013\032\237K\317/&f\022\217'\274\336vDl>\316\010_;\202\244b\302+]\244\216\304S/\235\345\007\332\340\216\032\202\235(]G\250\023\305\265Hg\347c\316\032\"\016\230\243\364q7X\225\354\033s\203\343\030\243\245G\311Xj\302\347m\253\224\006u.:\033\233\360\371\332\020\311\330l|21\223\236\215'\223\3619*\324\357(\324<\025p\000;\236\220\276/\315\321H\316D\027cS\252\364\t_\350\334\363hWDX=1\037]L:\300\021G\333\322\361d:\366B\304s\3027\336\206\241\007\251]\204\235\360\217\251\262\236\316%\236\023k\346&\023Sh\225\337\253\340\311\245\371\371\304b\212\253\3218aB2\265Hw\324I%\332\261\251\t\277\277\03539\223H\002!\034\230KB^\365|\361;G\335]N\250\0353\035\237\213'\237\000%\235\237Ia\310\242)\252\351\321R*6\341\227\316\033\200\273\270\361.HSb`\254\r\373<\236z\222XJ\245i\302,\305&\002\33664\215D\214\036\306\223\302\210\2318q\222\264\200\263\312\200\277\003eW(\314\230L\314\362lw\343\204'\363qwi!'\324&\016+\215\223\212\246\342\2119\367#\221N\234\375\240a\310L<\231r=\027\034\353@\231\307\202\302\212\331\370\013\022\007\327C\2766\204\375\210R\0063\261\331\311\004\251\313\271\266\332\002]\321\366\343\302\016R\315,7\256GC\035(\373\261\260\342\360\334T\222\364\243\353\261H\007\312~L\315\223\027Z\021\270\321\2411\255\246a(""\333p\2325\311\371\231\350$qar*\232\212\262&\017)-\311\000\367C\302\234\305X2\266\370\214\236\241\276\210\302\010\t[\222\363T\024\241\027\226\342\213 \027f$c\230\276\251\304\242\003#\274\230\233M%\236\306\346\034p% T\246\003\250\264\2444\310\006K\347\311\243\261aa\245\"\227\036\221\345\260\241^=\005m\220\364\361\261\023\244f@*9\023M>q\300\325\220/,\321\274\260\241\322\267T\364\261\264\226\0309\033MM>\231\010\207l\204\223w\341\260R5\321\271\251\350Lb.\246\246kXkAQV\302\317\260\364\355\311\313\371'1(z=\367&\"c.\343hT\\\304k$A)!\273\242\211\210\317%B\352\341\211\210t\230\233aw,\022\320\3630\375<63\223~\024\235\211\316M\002\021\324U,F\323J\370'\".\305\007\303\252te$\354D\220\364i\337c\"\342R\3733\211\304\374D\304\245\357\037%\310\204D\311\037\031ww\226Fzb\334k\006}z1\372\230y2\356c\2733I\322Af\222\224\316\304\270_{6\260\274\343\201n\335O?\215\275|\236X$\264\364\353Yl1\t\275\243\315\334\270\266fbh\024zb<\314`\342\311c5\200\343\021\206\220\251\340\006\216;\356\210\2533\244\315\236\305\310W\031\323\363\r\245\333\003\347\035\363\362\0032u\244D\357\230\317\214\201c\030\275c~\027O\027\023\2231i\253w,\340V\236.\\P\267\210\254\370\322\354\034A\244k\252\034\333<x\307\302.\343\252\373\354\035\213\264\263Hd\335;6n\317\327T\"A\243\211\032\225c\266DZ\202\332O\343\353\325\036\231\262 \321G\213K\363\251\231\227P7\250\327\353S\rRs\300\256\300k4Nbi\221\0304\023\237\215\247\010,\375\215.>f\007\224\000J\325\274L\246b\263t\033R\217\261\252\235\347.j\267\303\353\325ngw\255\351%\257\214\230\245t5\367\215\007\207\374\2571\215\200\217\303<s\241\275\032\275 ^\024\r\243\002t3\306>\032N\205\026\247\332G\243\250\0004R\304w\037\r\035\t\260\343iz6\2724\223\"\2437\326\206\261\313\rR;\3348\221\252 5\007pm\267d\236\006\251\025N\350lb*6C\320\200\013\n\006M\301\377\232\005\227P\277\264l*>=MN\"Q\020\217\247\343/\010\021b\004\014\244n\255\203GA\2220\203v\202#6\330\331\223q\001\203=F\270\311\252K\347\225\374\302\266\021L:M\363z\032F\235\000>\rp\024\350\365k\240r\234\203^\351\250\035m\304g@\027tA\r\333\275""\322\273\231DtJ\363\317+=\322\023\333\366\360\202\336\210\302\300\311\230L,B\346\t*}\232\245\362\342\3633\244\027\341\215H\207\240\257\022\223t\3535\267)`}\372\326\260\215\200~\r\324\234\367\0054d1\221\240\212|Au\257t\202\203\r\276\220\033\245\004\304\027\326`%\221A_\304@\304\374\022h\334\200\034\272)\350\227.\240j\325B\277\364\302a\360\236?!\3572\255\206\334/\275\322\272\306\3017\277\337\205A\247\t\030p\003e.\007\375A\027\030\314\364\207\\ [l\374\341\366\006\251qe\267OzJ3\236\306[\361\303?\356\200\211\230\005\244\233SK\363iv]\010\342=\367$Ez\202b\210\245\311\245\305\230\266\1774C\031\256\333A\016\001\001\025q|\016\362\020\233\204\016L\314\307\346X@\264\205\367\235[\234{<\237\216\316\275d\275\n\316\244a\202I\225.\302\220\214)<\3404A\247g\342\223)\300\2756\\\346=\0133\315N }\035He\301\t\347o\307\311\350\023&\320\216\231\203\271&DP\020\223O\022\361IWY!\027\302\024\024V\340\305X\224J\231\216\306g\210U@D\004\301\256\235\243\230q\005&\265\255\212\242A\023\037b&\026e\203\352\03534$\325\316\242\331\224y\275.\264n\211\327\347\002kkO\010\277\013\241\235:\215U\234\340\031h4\250.3\330\r))\2261o\310F\272\036\n\273\341v\347\275\0217\206\247\023\201\307\333\300\t\3073\2761G\023Rp\003\035\222\341S\254\320U\373|\216{\020\262\3542\245\277\r\243\213\0178\341\266\202 \214\356;\272\313\223\204l\364# t\277_L\306\346\035\364a\027\330\346\260/\342F(\375\010\314\270\013\343\352\267_\367[\245\016\220\260\210\315\246\346Q\225\337\353\306\245\201\264E\317\357\353|\224\246\344\322b\222\261\212\023\323\211E\212%\246bN\rE\330\200\301\306\342\217\347\364\230\000\243\370\361x1:;\033]t65\344\306h\216\370\303n\270\315\022\177\304\215\241\236KN\216P\343\032\225X\352T\005\001\305\225'\314\016%\210\001\305\016\322=3KS\366\214\010\370\334p\233C\001\277\033cs'\020\320\030=!\323\321)\314\272@\260\003\321>1\003\241\016\022\323\224p\007\3125\332\201\210\306\033\273\254\347*\260\343n,\334q\362~\307\334P\355b\007\025;\264\341\006\257\000V\334h\233\377A\305\212\271\230\250\352Gqv\310\203\212\0170233\211\347""\261)\327\344\010*n\314%\273j\362`\310\205F\366-\t\260\342\002'\275l\001\004&\342\304\2647q\334 \211[\030\371v\316\207\306\332)\270\010\035\017\022\201\267\203 \241\271\033\362u\301\311\r\260\376N\254\315\207P\300`\2231#\220\241\240\206\246\214\261Ss\\\335\202(\344 b\376\321\037\300\303mpv\023\010\036\261\341\222\321P%\252\307\306\273\243\325\323\341\261c\320\252#aow<OC\340}\335\361.\303\025\366w'B\376\n\350@w49,\263\t\236\227\341`w\n\221\340p\250;\026V\001h\007\3438c\2468\023\216\264\3015K\306\333\340\256\276D\306\332\260\252\023\021o\033\\\332\026\361\265\201U\243\"\016\226\250\331\320!\t\221\300q4r\007\022\007c\024\273\034\032\022\004\241N\002\247\016ST\016\026\261\3025\210H;\202}bB\214\267#\264\304\214\217\265c\264\254\214{\3331.\316\216\373\332\321\212\265\343\376v\204-\031\343\201v\234b\360x\260\035\241\365\340\270f\t\207\021vd\013\224\342C7]2\036q\340^N\262\241\036\037\267an\315\342\325N\253\322\033S\220\006\257\366X]\212\306\253]\3256%\342\325n\2524\377\030\257\320\253]VE\245M\207W{\254\256\321\361jwU\240F\227z\265\277\312\236T\354\305<y\352\234\031\320\356*\303\237D\223*^\364z\265\303\312\016\220]\216\366Q\355\374+r[@x\035\0105\024^\355\233v\306D^\257vO5\316\330 \257vMm\214\361\347\274\33235A\210\361\317\274\332/u\245\322\274^\355\226\002\214\006G\037%\0233\252\t\252\363\2220\324,\324n\251@\235\346\332\253\235R\n\240\346\222zx\2653\312\271\225$\000\276s/H,\237\200\317\213HZQ@\232x:\341E\272E\020sK\263\217b:\261\350E\236E\340Ks:ic\326-\014\215.TO\2356\264_\241\237E\027\343\321G3\261\264\303SB\036FW\200\000\304\320\030|P\341\265O\201\004S|\022\363\303\220\204\034\235\262\241aS\260\2543\331\230\210\301\310HM\023\211\215\035o\253\220b\306\305(\004\311\347\035kCq\234Jpo\033\234:\201\361\362y}m\210\311\024\226\017\342?\362S\376n\310\371D2\316!4\021h\326\310\222\261i\241\027,I!\0017\227\212\276\260\301!\001\233\374\235A\204\025\375\322\243.\310\210\213\377J3\031\254f\206I\027j\214\257\235\027\216|4a\275\347\3101\2119\227\250'\274~\0222\027t*6\t\250\242]\232\223""\234W4e/[\022\326'X\314\217\245\324t\004 \377\271\244\270\253\032\024\240\222\031\304\2150\2320@E+J\2750\003\240O\200\035\313\232\204\242\211\037{Lb\204)?\037\267\3050@\236m<\241\037\231\360\"'H\367\261\350$9\230\270\365\312\355\343h\234\261>\276}\024\235\232\306\235_\337\315&\261\234M\"\317\367K\311\227\270\013\362\335$|UV\367H\3531D\324\035\322x\270\235\212E\247f\236\342>\"\367\211Y\334\214\363M\354\005\333+d\353p+\0314/\022u|\373(\216z\275\322\252\370\334\374b\3421f?`~\005\203\315E\202N\356\210\201\270\225\246\305\023\270\226F\305\223Sq\246\224F\315N\307a\215\220~\343\333\231\370\034\232\350\225VQwE\326\221t\003\000j)\225HH\346\032\2517\006\2522|\322\274\271\304T\354\031n\375\352\226\365\0332n\352\366\005\244\006\0317\271\237\231D\215\276\220\272\235\205#\205\354\232\334&\347\2318\242o_\242\323\276qu\233\222\316\370\307\364\275R\264\310\247)H\022\376\003\022h\352^\320\252m/\2305~i\032\251\tT\355\227\206\315\307!lH\220\341\216\024\310c\276\225v-&\246\321\016\2774+\251i\245Y\311E$\343\221\375\302]*>KC\275\004\026\004\244Q/\204?\001n\322\\,\365<\261\370\024\346\013m\007\\\265\215\204:\206\316\005\270u\3233KI.\225[\367\234\364\023j\014p\353hv\220LH\025\334\276GK\3104\223Z\234\201\024\004\270\225\2164,\201\014\003\223\tf\277L\017\222\0162H\230\000Ai*\356H\241,%Y\256\203\212\211\261\324\022A\243\334\313\240\264\226\002\332\305\370\334\022\342\335`P\330\211$At\n\334\016\nG\243\3234~\262\341\000\300\220LH{\013\002Iu*1\231@\223)\252{\341\016\244Y\243\206`\3454\\\342#\345\016\204`\347L\260.\271n\250C{q$\004+\247)\210c\022\302\206`\334\034\320i\212L\037E\301\222\020\014\233\306pn\200C\344\020\354\231\006\263gc\373\003!\0302\027No\372\001\316\321%\327v\035BEl\324\243%R\032\306s\014\301\230iT\247\276\013y\035\3740Ir\316h\023\316\301\0216\037\246P\257\257\rC\272\204\365M\310\353w6R\377\352K\0208\230\242y\225l#\tv\222\260\252wS9X5\025#\2535\311f\003NN\310\353`\225\346.\262\325\204\211\234\323+\227\3165\004\302\220\000k\014b\352\227\351G\213\234r&\214\327``\034c\213FfH\2365\206w""\263\3105\020~\203pJ\037\tvr\362Il6\332-\000\010\303\204),\3324\235X\234\325k:\252\3020\314\231\203\344\361\"\222!*\235\301\342\030\206msPt\240\375\006\r\0037C2&\316\262\233\312n'\342\322\256-\t\272H:J\010\331\350\027\344\240&e\223I\372Q4\311O\207\rz::\311k\202v\311\021\007\016\002\247D:>+\023?L\"\255\t$\334l\253\333k\363Q\236\261\327\276\304c\3004\014{\275\355Tz\311\306D\270a\257\257\235Fn\235\305\330\014\325\223\362\021\331\267Xt\016\310@\0072F\35650\301\016\0143\002\250Pw\224a\2207\334A0\033}\221\230\204\234\001\035\351D\307\347l\364x\007\232\367\310\315\361*\235xHa\337X\007\221s9\211\010l\356\315%\224\240\t\367}>\007\306\354.R\361H\330\347wbE\364\324s6\257\272\264'\350@b\377\330\244*\3275\360>\233s\3118\204\333!\333@\333|cD[\0256\333LD83\243C\316\260o\274\023=\367\262m\365\207\350\374c\235t\234/\326xoW<f\262!\361u%\221zT>#\354\367w\020an\251\200$\354\017t\240\365\352\221\256%\330I!\032A\257\251\030\312\320q\224\314FC\026\356 \223%\032\215\357d\260\255\032\014Q'\233E\3705A`\354\030\002\325\361@'\177EI\230\002:\271\253\346\266\241\350d-g\317\014\276\223\267F\322\rM'w\325.\221v\356\006:\271+\322\034\010wA\330\262o\236\357d\253\334'm\222N\246&c\013K\344\006\330\243\027\354\344\253\314\241\366\366\006\275\307\020\272\204!\330\311e5@\301N\356.\3159;\024t\033\037\263\257Av\032\020\336\251\0138T3\341^8\030j\267\035\360Z\201\010;\365\316\023\330\375TB<@`#\016\254x?\341\340\270\243\032\275\377D\317\276\320X\027\244\352`\310\333\005g\226\254\302!_\027\264\250\000U\266\377\030\002\340\002]pf\315\235\360\301\366\376\353.\206B]\004\222\2672\020\316f\316\224R\2756\256S\274\264g\245\007,\344\264(\202\3520\223\341\261\343i4\211\323\244hK\013x\247(Q\210\207\024\225bx\270\323\004\263\312\345`\"\034v\262\214]\261g\014\2669E\001Dl\221\3142\005eKI\225uOaaW\025\037\352^\274\344\0045\347\303\341\356T\361\271\031^/w\023\333L\325^h\2279\024\036\357^\2442g\221\261\016\203i\222\201\341\210\315\314Il\027J\314'\323j\023D\332\013\274\357x\274\017x\377\361x?\360\201\343\361\001\340\203\307""\343\203\300\207\034\"\267\030\177&\3323\361\324\245\342\270\241\341\367 \364\245\275B\034yOb\356\342\370{\021\203t|\354=H\301\226q\233\355\317i\020'\243\213\366\266\246\271\244\222[\3209\034K$\275\222\261I\263\r['f\037!'\022\036w\252\313cH\354\261H.Njk\346g\216\214\007\273\343\270W\3573\006\001)&\374^\244\\j\344\275H\231[\343\216`$\tAa\207`*I#D\370\210\t\210\236\031\265\0341\021\3203\307\253\017\262x\0261\261\017\350S\251\004M\250g\261\031 \374\006aV\013\"&\310y\226~\276\230\230{\254\013\t:\013a\025\0201\321\2144DG\370\021\023\306<K\307\223\321G\324\277\350$72\342,C\245\224\"&nyfv\264\023\324kw\362I\364YLo~#\204\327Y\310\\|f&\312\343\035\361\332\335\344\355\301f\326G\274v?\225\324\211\335\210x\003\355\010\325[\257\253\267\316M\207\204\263{\355X\345\210x\035\235\326\273\214\t\352\352\262h3\200\355>\243)&}\032\361\215\271\020\306\204G|v\267U\300\023\361\331\035VAR\304g\367t\362\331$/\014\352\305\035\232j^LrP\005\336E\345\003U\360]T\020F_\310E\305\024~\321;\021_\270;\216K\217\270p&\224\223\316\216\273\2203\261\271\307\274L\"X\377\230\013K\003\323N\340u\023D_\264\023\370\332K`\353\013\033h\323\370\333\013\351B\023h/\207\302\204v\232`{9]h\332\230\210\215\034S\361\307\361T\322&q\363r\032S\212TF;\225\233\253\363\310~.\316\331h7_cl\335\315\356K&\t\270\231\253\"\032\031;\221\236\200\367$\n\214m\300w\022\005\244&\340?\211\"\000\n7kc3)\251<\330\001\346\032C\035`\277\320\207\273 T?\"]Q\\\334x\007\212\025~$8\326\005\201'\202\336.\010\3644\350\353@\004\325\364\010\372\273\242\270\270@\027\2244;\030\354\212R\310\3201H\205\016\037\213\346Z;9\022\002\270\223\033a\002\207\334\274\260cq\324\024\362\036\203D=!\3371H0,\344?\006\t\251\010\005\216\227\033\031\360P\360$\naC(t2\r\2671|<\r\267$r<>(\265\214\237D\201:\302c.\313\347\332\200\031\t\333\034\264_qUT\266\265\016\2370\325\320\210p\0337\227\000\013t\252e\246\rv\302\271\231nv\305\247&\001t\363G\273u\300D\234^\005\323\216\313:\253+\020'\0136\316\213\353:\013D\261\267\336Y8\316\253\353\330OEj\311\344\327\307y==\245\337\376I<\372\201""\334\303$\340\376sxc\\o\017\301r1A\221\271\006T\275T\224TK\242\343\310[;\250\251J8-\343HZ\003l\374\322\004\362\351\343AU\266\264\335@\003\272ly\265\306\361\032\001!\203\347\246S\330\345\222$#>\227|N\256\255\017\033\246\001\214\315\273\200^\006F''i\310}\330\037\215\333\245\305\031\265\204\r\230\377\334\223T;\3207\246\200\311X:>\017\200W\001\024\207\237$\222(\320\221t\204\233+\356\207\036p\377\230#\263\336\216\366\001\355=\026\355\007\372\370\302\003@\373]h\254\257\317P\210\351\037\033\013\264#\214\377\313\251\272\304\242#\352\003\275\333W7\201(\327\324A\034r\021Kl \361\005(\222\356\007\222x\302\366\341\223\235!\241\177\314\221wOv\206\204\3761G\332=\331\031\022\372\307\034iwx\363\274\013Mz\234d;\340\037s\244\334\273P\240\016G\302\275\013\205_J\361\237L\303\345\004\216\247\361I)\301\223(\374\272\305\241wQqm\341\223\251T\215\221wQqY\343\357\242\002\257}c\357\242\202d\372\274\357\242\n\202\352\004\236\013\307}\376\223(\024M\340\0354\334;_\360d*\341\201/\364.*\2561\374.*\346T\344]T\314\251\361wQ\201S\376\016\256s\204\033\233Bx+\215\362{O$A\357\034\351\375d \251W\317Ri\265\245\031\024\376N\nm\t\375c\216\324>\260j\361\305\365|\260\223\302\361|\250\023\353\336\256\355\037s\344\362\241]\2649\346\036F\272\242T\367\307\217A\242\343\201\261\256H\214\222#k?\337E59r\366\355h\251\327\221\262\357$\340\272\035I\345.\272\315\221\256\217uQm\216\034}\254#\331\345\037sd\352c\035\271.\377\230#C\337\216\016\001\355\346\231^\341\366\217\005\335\374r\372\235\376\261\240\367\030$\272\023\364\035\203\224\271\032\364\037\213\346\247\003\307\240\321WG\366}.!{\r\001\r\271\240\3118`\356\371\351z\267O\232\0219\201@\30658~\"\211\020\205\306\336A\204N9\262\362p\343\034F\034H\337\361\211(\256\301\337-\213\246p\201\3568\256\264k\366\2151\241\256\030)1\334\035\307\317E\334\211C$_\374c\216\014|\333\273\243\361IB\207\217\023$Y\031C\235a\357\211$\250:\354;\221\004\363\304\221\211\237}\334e\036;r\361\035x\256\302\315/\375T\350=\263\272\334\004\233y\321\245nU\330\014\214vC;\004\316\215&dd\254\315\241\223""\025\030`\274]\206\014p\233g\317\243\213\024\020<\215\317\353\225\r\377\230#\311\316\330\245\271\231\204\354b\261I\002n\022\326\326\346E\353\304\023\220\004\273\220\314'H<fb\311\244\241\262\231\030}\334\331\263\360\361\023\000lq$\326\333\271\n\354\370\261<\305\220\214\273\347'V\325\371\305r\266U&c\236ZL\314Q\304\220L\222\003;\021\260]v\201/\306\230\243\001\370\352\263\211\251%\232\273x\223s\"\200\320J\001x\223/ \024\367<\211M>\225\355\337f\351-\2102\235\010\307K\260cm\317\360>\376 <\177'T\275\223\013\217\337U\201>\356\007\250@\027\024\340A\027|>\016X\310]\272z%5\010O\335\211\320\033W\203p\321\235\010\263q,\010\347\334\211\261_\303\205[.\030{\255z\neyu\217]/v\303\003\027\260\375\276Q\020.\267\001\362;\323p\260\rD^@\206Gm@\362\0261\334g\001q\202]?\032v\324\260\030{\006P\304E\247\241\343\216:d@|c.B\r\365\032\302\224\274\304\r\247\326\006q\022<\0107\326\r\343\323\206\200\0108\020j\315Y\020A'Bo\n\024T\310\201R\007\027\001\354\350\334\023\021\t_[\3474S}\246{\344'N&\230\373\3761\033f^]\013\302\253\264+\343\350>\0107\322\036\023\274\210\030\204\337\350h\323\244\032\027\277\356]b)\225\214c\267\234\242\016\272y\251\250M\277dg\r\025\204M\240A\270\204qo\304\336\313\023\302t\322\220'\321\271\251\031\212\364C\230H\014\304\313B\244}\034\010\237 &1\235U\246#\204\251\244\313\240\346a\013j\010s\350\321\322t:\361,\2668M.\355D\0305\305\n\325\265|\205O\004L\3472\325\014\037s7\204\303\375\3228;p\310\234\306\270Q)\277.\344p`&\3168\334\330\252>P\207P\272\016\243t\236M\367[>w\307\263^\260,\034\313\207\243\357\024\341p\272\232Y\275\343\311T\253\225\302\362\304\\\271\224\277\343)Y\353\231\ru}\373v:\277S\255dF\3169\317\272\364\254d\262\325re\367\016\032\220\221S \325\311\226Q\034+hU3\245l^N34\007]\322\005N^\344\343(=\205\365\r)\n\355\241^\273J/\224\252\371\nU\221We>|\370\320\223W\270\tM5|\275\232\267\252\327G\014\005\016-\034Vd\002} \025\017\025\211\241\243\371*\361d4\255\236\036zh\236+X\272\301\372\351;\272\016)&U\331\312;\250\255\255e.wX\227\325\215\\xQ\264\312\236b\271\374\212\370\313\347:""\376]?2\272\236y\225W\265\r\217\374\035\007\237\362\023\177O\343X\315y\234\270Xi\247Y\317W\327\3129\353\216g{\255\220]\3232\200\263>3\026\3169\334\316\354z\252e.F\037\237Y2,\305)\203||\250\234\321X\310zr\372\204?\2221>\342\321>)\3215\030f\360\344DBpY\316\n5\243\245Q\331\265B1g\006\035G+\216\266\321P\013\030\307Cq\002.\266\276Q\335\365Xk\231\215\274\247\272E\222\302G\214fw\211\001\245\321L\245\222\331\025\n\222]>'3FrD\267\352@U}d\251\032'\264H\010\300[9I5\263\261Q\334\205\350\331\307Z\036\213\270\343)\026Jy\217\340s[|\016\252\353\214P\317py\253\212Z\344P\313\357G\314i\255;\033\231\352\032\216;\255\344-\313\034\034\213\303%Q\310\220\373\026S\\\303t\371\200\323(\276H\316\244p\340\346VQ\r\3164\037\227\212\303E\325P\363\371\215\322\0325\212\323(\016sN\035f\231-\226\255|\216\2418\274\226~\30194\216\346#\264\003\237\377:\275U\312\242\2249}\372\250g\230{\357\033\013\217t\340\206KV\232\370\241t\303\"\315\260B\376\265\234j\272\242h\355cL\365\314\247\021)g\013\324fuz'\250W\013\257\363%.di1\256&\375$w\014\352\245\224\337\366\2202\362\024Vp\362\2469?s7\217\223d\013Vu\324\023\355R\237L\004}\326+\311\303\226%\034\253\344W\013<a\210I\352\260N\375\264VbKVf5\177\337V>\324OCB\032\250\223\021\327\327\252\325\215\373\367\356\311\361\234\243\345\312\352\275Y\232\236\371\353#v!\177s\225\342\271\201\006Y\356\2063\355\350\350\250'\227_\301I\304\276\341\235\221\373\006\210\377*\371\352V\205\004\313\363\255\307wL\321\303\327\351I\377\365\021S\005\rq\261\220%\326u\253\"]]\243\twR=~\221\270\216>\337\252\214\304\247\224\345\330\252\212\271Y)o\225r\243\361b1\277\232)\232\303\231_\341\274U\r4zG\033\261\373|^\363\th-\242|<)\311.\316;\271#Uy\342%\022w\013\343Y\3021\267\030\326LV\037n\253f\202g=S\242\361\254\270iw\210!'\220\342,\\5\255\227Q\223\345\031\316\220\260yn\345F\342\235g\325\312\251\325[\033\033\345\n54.F\227O\324-UeV\026if\024\215nz8\341\031\223\031\027\207\371\326sc-\203\222\014\017\356\273\261Z\321\362\271\320\332 \202\206z]\242\352\362Z\355\340`Z[!t\342\365!\260'\0229\016\235=\211\314>2""\326A6\032/\311\201\262\030*\243\245=\032:\037\227\373!\rXZ\244\001e\336\270\016\372\275.\016\320CCg\013[\256\300C\227\251\354\336\367tb]\265\231s\277I\250W\362\225<\031\372\373v\325\006;l\2158\036\201%\203\251\263K\317\213\215q7\\\001\273\025\\p\014\235]\212@\301\021\330I\034\263\2541\353|\010\267\221\365\241\254\362\376H\242*\231\322\220\226\026!\266\265*\216_\356\204\252\343\2445B,)\354?DXC\365\270\264\337{f\n\313\3441\371DNHLd\260\321ZK\243\004\224+\257\323@\265\001Y\322\333`\374\354\203Y\266\217\317p\3503\365~\226\375\031u\024v\016\223\315\202?C\230\266\3118\207\343\240\306\316\361.O\0341\2147%'|\347\354U:>\335i\"\300\007!M\004\317\251\263\207C\347\224\267\215\267\275&\"X\215\233\030\347\225\265\t\307\033A\023\372\265\326\t~\2155\301\031'\034\340+\373nqd\257\336,3a\326S\222\363\023f\325$\371\014\007\361b\355\360\305\334\343y\034\300\253\256\237\341\324]\375\272\214O\326/q\254.\2149N\321\225M\032:`\303\t\271\374\302\332\"\216\303\225h\037\347\337\"r\2300\313\000\234(\3001\267\362\362\032\216\265\305\306R\n\251\024\223\220\035\341\305\344s\362\026\233\357\3344Z@,\202\342\366\310\301\335b\377\362\271Q\333\312_w\351\365\271\262\207T\273=\307<\231\327\344p\340\204\351\3219[=\301\230jG%Opxn\332\267\020\223>\007\355o\3465\351=\004\025\364\357\256\366\375H\360\266\362m\332S\234e\222\323\2152\005\002\236\273,\370\362\240\030}\023;\020\2558E\354l\252\371JTy9/~\222\375E\250\315\\\276XX\316W\310\237P\307\276\263: \242\222g>6\1777\020\t\360\247\007*yLV\313x\216y\366\035\227\267\n\305*\274S\310\360\250'\276\342\331-o\221S\"\336\304\006<L\307\003\344\316\224\210+\342\357\017\361\251\341\254\022\323\3648ysC\3528\360\302k>\032~:S\264\362\243\tx(J\237[\354\263,\213\027\305g\224S\023lG\036\201\035\223\223y\314\346%\234C\370R\331R~\005\372a\316\277WEY\205\345\"\177EA\035/\317\305\252\372\022.\033G\354R'\356g\262(^\031=\"\202\332\342\201E\3079\222\343\343\356=\243|$\372\360\210\nOH\265\037\357\205\317\3079\272\211{\212\231\354+9\314\237Z@\3672\333;\364\377\367\017\207<\363K\217f""\342\223\236\353\024\023\221\204b\330XEU\313\210\254J\2536\230E\311\300\323\022C\211ezf\014\323\244\322,m\307\266\203\230\003\343\374\346\026\r\217\245?w\200 |^T\251\372\301\021\350\031>\374>_yM\022\260\302VP\031E\362\266\024\231i^\245\274\203\317H(\323\230\317\r*\345 '\250\353\033>\307S\264\226\327\005d\265\343\353\000=\343\031\355\204N-\315\307\241\002\333)'g\347I#:\241s\211$\251\263\030\251G7T\345y\303.0\326\347y\203\306D\244\023\316[>\307]p\311\327'\324\031&\235\250dl\001\n\267\003.ux\335=E\226J\366\201\273\373\212\264\226\300\003\235\364\t\274\034\031\354\244gx\250\203\236\363B@\205;\0361\250H\307S\334\\\240\306;\236\322(\337X\227\266)\236\371\274m\274\347T\242\317\327\006M\t\270\263\363\312r\270{\2576\033)\234\233\003\256-\264\276P\033\377\355M\264>7\0270\214\322\0067\013\350\001\001\217w\n\005\340\376\261\216bd\021\312\333^\014\026b}\035\205\340\020u7+\324ye8D\275\243_,l~w\207g\242\223O\005\036\352\"\237\230=\341\356\242\200S\324]s\210\252P\010\352\254\261\234&\035\245\325\276C\335\261\235\340\244\203\320@\3479\236\264C@\375L6S\024\333\252\375-\223@kSS\0369\214V\373\333\307\2219<\367cI\\\371\0132D\352\253.\266\022\206*\314[&\332p|6$Y\315o\230\217rP\363\177\313W\312vp\224t|\003\006\231*\262\030\033J\273\352\242\224\373\240b\355i\376D\217\363S9\234\026p&2\275\243~\266kE\322\240\025I\200\3747\325\010=\261\177\035\201F\307\367D\226\313\370\000\007=Ie\014\017\215pM\271\362\026>\247\261\271UF\nb\370\372\310h\n\346\234\312\024\313@\276\371\206\204\216p.\360u#(\367Q\317\222%T\220\201!\346~>\223\343g\207K\344\366\304\223\211\021g`\265\222\317\360\307|\\\245p\003\266\013\305\"\230[!\227\231\355\014\276\360RT>5\363\0029M\251\217/\013V\3312\005\273\253\036\342\017\335\244\263*\245,\r'\371\204\273,f\222\3147\207\236\344\271\303\251/!u\270\213\204\341\252\335\030\302\225\252[\374Y$\273]\243\216\017\031\251O\244\360\347\234 uUN\3620\201I\021\332N\036<\266\273\026\177\367\010\036\334}\371$\222\225\317T\262\370\032L\266\\\201\233\204o0\255\226\312\025q\254\\\216\313\035\027""\237\310\350\346s]?\220\344\321\036[\005\316\037\244\235\n\312nQ\361%4v-\363\272P\336\252\334\321\237\344)\260[\313\215\341\360\254{\257d<\346\331\301LU\n\342\nn\225Lji\253\364\252T\336.\301K\333\331MU\266\252kw\221\255\346O(\255\330\256\3366\247\317-\252?\253\003\237\225-\316H\231\276e\212\333\231]K\347c\220[F/\335}\264D\020Ljw\250\230/q.{DbH\\\3521\200#=\344Acl\031\341\257\375,%\357\362\027\264\226R\323w#K\362\301 \344\027\313%\252\205\2101}\350^\002\332\245R\216\374\234\022\365[R\2342\210:\337\243?\332\305\023\331|\014\310\371\345\241L%\357v\372G=\363\305<\276(E>\224\3726\225\n\240+<\233W*\231U\3053*\024\211\031Gq\243K\212\335z\202(\276\340\363`\202p\304\007\032\2448\352\006:{C@[\\\265\276\327\344nAV\340\027\361R\266\270\225\313\037\253v\r\201\303{\227/_\265c\250\333\355\317\266}\274\251\355#E@K\252\326\357\217\204G\350v\030\236\356\035\225\333W\3139\313\304\342\364V\245\310\267*7\311*\300jW\233\034\310)\246\213\264g\264W\214,\032f\302\250N\373\022\037\035\363\223\0312\314\337S\313kV\n\263\315\307\315d\271\241\232\251\254\346\253#\243\366\027\321L2T\005.:e\233__\246\213\353h_\021\337t\242\250\351:\246\201L@\017\177\277\214K\341/\236\025J\3221\225\034\345FM\240s\303\327\037\340\346\341\003\210\377\275\207\017\356\361\235ZBR\324\033\324\305\3520\020\243\325\314\252A\001\240>\335Fs\200\344\013\237.\343\036\252\316\260\254g(\272[\341TP\325\363\367\277\277\320\352\365\357\177g\005\204Nq\270\310:\206\013\343E\241\277oh\252W\371\335\355r\205,\200\372\374\232\371Z\034\250\364\330u\241\303\327\327\312\333\226\004\344\022z\226+\205\325\002\202\022<\306v\257\274b\252tE\360\"\311P\217\031\016K\347i\n\3204C\034\213\265+\214\370\326\006'\313%\363\207\224W!/\037\321\033\236JM\3351r\177\007\351c5\236/P\214\311\344\024,I\303o\311g\252\324*\n\232\222G\334\306\022\355~\242]\372\031\251\210\221d*g_9fO\033\266\353\303F\270\206x9\345\270\212\200\263\027\177\332\321\277\377\353\334\304\365\353\236\353\017\037|\377\375\303oF\277\373\351\227{\267\177\277\375\257\333\036\317\320}\317\303""\007\023\327\037\334\033z0x\227\376{8|\307\363\375\310]\317}$\331\251\224|f}Y}\272\316\244\013\215lc-\327\256\364\233\314\372\306wl\0022\355\337\341\313\260r\354\374\034\237\206Pl:\266\223!\205\260\276\301\243\253>\\g\301\233SK\262V\3417R\261\3452\351\333\322\360\275{;\326}\2238\375\351o\244\3263\230\260T\362\337\330\246\376\362\223\367\227\021e\004\251'\036\2505\013<&\323\245\362\n\244cDw/\223Fz\345\311\356f\261`W\250XU\375\334\306F\276\224\273c\213\235\326]kl\377\234V\335\365\004\346\226\222\322B\325\312\027W\334\330j\205\006\037\2356\312\271,\037U\313W\363.]\226u}\304O,\240m\327U\n\35372BY\347\027\357X\351\r)\220!\362\030\000\374\231ur{\327\267\326\235\002C\255\202\371\301RF~\203\304\356\201g,[.\026\363j\201)\263\234%_\243\\\334Z/\351<\315\t\031\023\365\r<\204\020\354#g\253\372#\213\356\224\331\260\032\0016<\3445TJY_\245\264:\362\300\361\301D\366k9\371\364\260\035\254\277\276\367\320\243\306\177B_\2449\2552\221+\360\3045\003\350\230\327jS\201F\3355\212\302\236`9\230\227v\213\257\\l\3552a\034\331[\032\314\313.\010\263BY\256\330\312'>\245s49W\004\326}\321\327\216\277XDP\332D\236\027\216;2\345\205\366$$\2266\2406\204\376\235T\354/\221P\336-Y,\232\231U0\206\274q\362f\207MR_\302\025\035\250\260\35648\307\245\314\345;\036\336\213\205\376\253\236\330\013\226\272\363\006\2428@\336,\330L\004v7\333i\320\003\246kc\205\305\351=[\321\350\001\270\343\374\230(ZO\316\254\343\313\242?\257>\360>\244?\276\207\253Y\3170r\265\262T\261\312\237>\2045\344)\212F\310\0279\355/\300\256\262nu.\214H\022O/\215|\263Z\375\316\263F\254\237\320\353\253\333\333\333\243\333~^_\365\216\217\217\337#m}/\205\217J\"/\327I\203\227r\356\341#\252\034\031\375\336I@8\024\024\271g\270\360/\376\373>\224\350\313\006\311p!\233.\344F\013\357\277\270Xp..V\020u\334W\335\267W\370bzw\214k\275m\230\002\326\342H\007\220\312\036\321|\304\332\037\317#\230\202[\226\001;\226U\333q:\031\337\005e\354\017\217\207\206\346u\343\324-\"C\2650\246a\306+\366\\7\337\301d\347U&\215\225-o\344\311\236\362\264\311!\266`\253\364`\3023""\326\261\325\203\234\035\307\332\262v\361o\345F\371\177\265;C\375\261\364gL\235\334\005x\224\301X\346\366\354\350\355&\200\037\207\343/\020\177S\254~g\357\035\342h\rZ\230\267^\3500\304\371mNQ\013\243\353\231\242|)\023\013\235\306\266Zz\367\225\322\017\346\276Z\336\220\305a\305\326RYg\306\265o\257!J\231b\205X\231\351t\232\030\272\225\315\247\323\344S\261;\2014\003\325\370\032\353\317\351t\026\256K\232\334\017\2431\230\213C6C\355+\325\363\214\321.%\353VNM\362\207z\r\232u\250\247\234\245\000z\002\014^\340e%\362\210\350\232%\340:\373yN\353k\211\266q\304.\226|~7_\325\273\277<C\230\345C\216\025\\\344\002\214\226-\313\016\230\273\363qKy\333n\367\017N5;?:\215\243\234!\232(e6\343r\217\261\036\036\321\342\230_\241P\271\300\211\204-e\355\205\014$\022\031\303\313`7\213.x\310\320\022\336G\263Q\336\260\3255\315\230\3652I\236\317L\027KT\2402\033\023\337 \217\364\235k\237\217\260Sid\025\212\252O2\013\306P\303\013i\377\232s\347s&\346\356p\t-\227\267\t\361\340M3,\211\235\256'\305k\274\226\264Er\305\002\227/\251\020\016\351\t\266\254\010\n( \350fqG\311\357\200\367{\313\"\377\367\301\367\267,\362\221oY\337\375l}\213\361\375\331\272=A\377\206\277\277\377\363\320\360O\277\376<\364\313\355\221\237\207\376y\235\256\257\323\345\365\221[\326\304\255\n\021\017\377\274\375\355\310;\251\265\374\350\271\340P\314\307\231i\253\222\275\207\t}\217[,\035\031\335 v\330pr\212\333`\271\374\362\326\252\033R&!\310\344\362\0257\264\232s\335\313\206\303\215\335\035\033b,\261\213\020\021-\313\265\013Z\262Tn\331\005\025\371\357\002\222`\332\205\200\010a\246I;\\\210bf\247\344\356\223\225\331\351R\266q{\335`\372\307\266\247\035Xps\200\263)n\210U\254v\000\260\345\0200\352B\225\374\247\007\362]\360\234\313a\355\204yx\345\255\033\336\r-\255>\224\037\262\347i\375]\3264\364I:}\357\336\275\333?\251Y\377\267Bn\344\027\264\345.\342\021^\200\326:\323l9cE\306\233C*\362Yh[\273s(\207\361\345\371\004\353ab-\262\3200\204l\016'\266Lf\r1{\226\267i\302\312\361Z\343h\027\254\354\335@\277\324\367\322G\037\220\262\246p \307\244""\342\003\220\344c\313\332C\235w\324I\267\373\236!\003\002\241\353\306d)\313\262\274++\270\004\265'\216c\343\241\312qm\035\223\024c\263M\246\354\256\3302\330)\"\256\256\334\215\374J\263\371>\375\273I\223x\3077\366\363\316\330\024\375\213f\356\376\026\275\373\343\330\335\361\241\341\221o\357\214\336\273?\361\375w\203\267o\374\355f\372\326\335_\276\375\346\306\316\370w\364'\212?S\337\375:\374\340\347\357I^~\372\365\341/P\r\337\352\016*-\361\323u\322\017\244\030\240%\370z\230\200?\177\377\360\237#\017\350\251\207\177\376?\377\357\377\367\000\002\372\220\376\225\254\373\210z\213\367m\255\367\323\337\010~\237\334\226\t\317\315B\356\227QHe\364\321$\347C\243*\340\265\342H<\321E:\312\341'V\341\225\347\304\253\274\243\022\225\036\207\025\331HG\261h>EC\375\234?N>\312\326\244\003\312k\352\002\305\206M\201\352\255\303\351t\2067\272\245\323'Q\354\300\356\013A\274\224\2550\"S\264iG\323\216\252\273S\250\341=\211d\245\270e\255\235D 2u\022\205\364\325\341\035\274\007\261,\260\274\2330\312\323S\375\020[\310\353\334\005W\364}.\237\337p\303`\000*\372\206\024\252\276\\\313XirD\365-{\254\216\233J\007\200\210]\367\262\323EC\234X\362%\364\345\326\0066\t\350;y$\252U\014\342\330\234\032\342I\230\206\031\266_\217\036\305\322fc\363Ly\325u3\312\275sAH3\346\013\257\363\316\215\346\206\250s\343\271\023L\0067\255\301l\233\322bA\037\301o\211'\260\277\211k\301\205\014C\212\215R\373\375h\032\327i;\360\354$`[0\372\000*\260h=\244\213\314\372r.\363\260\203\220e\270\023*Y\223\0168Tl\007\220fe\007l\243\320\001\342\026u\207\246K\026G\352\223\213\361T|2:3\231L&\363H\370\020+TK\3544NZ]\247\323\223\342\344;4\205V!\335P\220\305nprU\311\370wG\261Lv\303\260\370uCX\307\324\"\2428I._y\275S\004\217\203\217\212|L\305\036-=\236\212\315\275\304kq\374\313\033\335\370\253\207\251)#\337S\244\002\234S\245\003g\303UU\014\265Mp;\206W\n\014\026HH'\375\262<\353\033\2659\310\334k\265g\361\265Jv\343\032\3059q|\257\361e\322C+e\365\243\264\210\216\271\365\257\332gIp\354\2324\363\325}\253\347'o\337s~\253\030\307\240\353\017\305""\312\211p\352m\255Xj\222\227\317\315rC,\305\316\256#\375\245\207\006\236\2136c\235\303ex\307\376t7\304Fum\032y]c\n\025\246\375~\026y\257\266\212\314\006\303\316\202\273\241X\340\215\212\320\005\2472\253\\\266\261u)\262\253m\025a\313@\372\230k\333\006\270\201\266!p\303K\371\355vZ\232\"p\020]\300\025r9;\000\344\301u\300\340_\272\200\324K%S\360\225\333Q\2056\276jx7\332\216F\261\222m\007t\264\224\235~\027DE\007.\230\230\323NH\326\033(\271\300;\005Y\nr\003\327\213\2627\301\r\355\350\005\334.\rPk\311\213\354{v\005\n#0\005\0256\335\366\3331\330\335\006\272}\220G\221RA\002?\237s\0029\217b\324t.Wr\014$\356)\322\307>\002+\335\246\312\365\255h\004sgQ`\007\013a \312=\324\267\316aj\027\246\016A\342\251\342\270\326\001\212\023\326.I\200\225\332\312\020f\272 \355\275RrVuL+\311\236\245\333\354\221\333\0069\356*\256\033\275\232\344&\351\350\000\200\024\371d\211E\031\322\276.\270\213U\000\350\335\256.\240\213_l\376\272\274\211g`\262\273\305q\273Qt(!\266\222n\313hnY\250c\305ba\303*X\362\326\231\375\356YZ\001\240\352\305\334\310\376y\321\375\274m>m\314\2021\010\351\264r\346m\247N\204\311\345\343u\330\017\334cg\007\025\211y\265\230_\215\355l\214\362\212\204\013b:\347\200a}<\246\223\025\274\201|\232\004p9\223}\325i5\216\3070\237V\024:=\235\227}\266$\001\366\245\212\177\034\200\025\272Lw\013it\314\323\025\307\014\352xE\351q\276D\236yV\375D\213\005r\342\3357\305\362r\246\250Y\367\370\267\302\006J\307\276({o\224}\005}\302n\257\314\247\365t\232q[\305\242\203\322\334\215\"\375\222\346\334\270\025\347\027\202\325\327\226\246\314W\357\343SS\005\322\001\362#\303\250\2561\243\325\245\216<\324\255L(\373\246\322\001`\351v\334+\tU\020'V0\361\307\370\266\300$N\353\212\257\257oU\221V\230%\365Es\250\003\300*\225\267\315\221\377\330\r\213\235\366\314\232nH\303\267n\310\202\014o\027L\2214AW\204e\227wb\000{R\354zb\330zRl\371\276\321\354{\004\2623\261\231\370#|\275\316H\310t,\232ZZ\214%\333\341Jr\024\270\215\312\201Dv\253\333C\200\353[\307#\351\231\202U5\232\307y#R\351\202\254\024\212\030*\365\356OW\034""\277\262\3169\246\023\360+\024\215\025O\300s\"\351x\364v\246Rb5\337\215B\336A\352\212\342\355\271i\002\2202\256\354\316\220o\"\024t!\273t+\273\006 \273L\3716=\233_\237\342L\3602\026\037\2544\366&9\200\210\201\333`x\177&\215\014`Z^u\232\344\035\206\025g\002\247\023!\252\276\035~\034\275\220\317\272&\206y/\312\350AW\277\322\035`\236\266\331r'\3428\2702@\235p\321E]\341\225\343p\222\363\230+W\343\366k=\351\304Ffs+\257\003\247\347\025xS\025\355SuG\212\007\225 ?\241\222\317A\275\311\373b\363q\365\326\211\211\371\354+h\035^\037s\2006\312V\001\363V\224\37019\027\365v\311\224yAJ\275W\242\342/\256\305\354\360\213\333\257\347\244\377\013(l\300\374\256\226^\373\212g\244\343\266\350B*\353/\033\343:\033~\034\\E\352\304\211\335\035\372\307fi\216:\264\230_\341\025>\375J[z\221\214ZGn\023\326\252+B\306\274+\212\355PW\214\262W\032'@\343\312\267\203\035)<7\312\351\010w`\330\365\355\200*\007\270\023\256\335`7\306\351\252\252\255\373\352\207\207\303y\315\216\230\002\330\302\246\000\256\014\204\202\215\262\216\253\224\262iY\236\240\220\247\\\244\260$\255/\314\374\301\366\262\016 s\244\003\252\334\332.p\006h\370q\367i\3360\322\001\305\342dW \242\367\016\204t'\275\310\257\305\225V\215\321i\007\230<e2\263#\323JRn\366z\273}\305\317\330\2676\203m\230\213\307I\265\033\316\365\026\204`T\354\240S\nInm<\221\334Z\326\201j*\3728-M\221f\251\010\265\023d\264\013b\333G[$'\324\007\373R\\_\027@2\203N\0202\226\316{\322p\316\333\215\202\363\216\223\221\220\264g\231\312\322\322\\\034\337F\304A:i\325y\322\375\346j4\255\224)\251\217\264Z=rbE\303\263\tg\022\033\2055I$\034\333!|\357\200\352W\336\360\272\357\250\375\346\257zA\225~:3Yz\037\251\376\345!!7\205\376\237JM\305\247\350\227\377\010\227_\034\357\227\277p:\342/\216\363\312\315\306 s\241+\224;[\216\014\310%F\200\262\203\020e\006h\031:\006l\304\301\3405\265c\014\345c\263|B\032\271eId\362\000\340\327\222\345\222\277\261\251\276eK\346-\311\251>\376\243\rbLo\203uf\001O\006\216\352]xv\306\355}\351,!\344\256\360\325k\025P\231;~2\355\276\205]e\210\216\331\354Gd""\362\330\367N^\221\373\212\177Q~7\0256\267R.2\000\247\266\030\022qs\314\025)\023\276\326\361\254\353\306~HCF\371\010\2304v\320\342}#\313\215\314\357\344\263[\325\274\033\250\366\354\247\2651\000\326\026\036nIw\303\177,F\322r\204>\201\004\3215\260\3020\316t\272oU\220!\253\273@%3*/\200\033cR\325\215mH\031\200\322W9<N\257gv\322\274\227U\020UlV\310\254\363M\265\254\364yf9\233Y\2668\243\2077\2077\340\304\251\010A\336$\346\270\221\206\213\314\225J\2379\262f\231\\y\243\232\326\273<\323z\347\220\303Q6\236q\032\231\260\264^\035O\313\333\312\231\342\306Z&S\332U:\255S\265\265\215)\351j+ce\013\005\245\314\034\032\214\337j\006\317`\301\370\246P&\315\\!H\241DO\362z\202YUH\253\315'\226\r\301\314p\337\331H\276\242\3109\263\235Ag\2605_\357\352_\316\303\2077\221\305\262\360U\272G\267P\017ik\035\253Mj[\217\035qd\221\205\305?_6\215\n\344o\032<\226K+\253\370\224\025\021\245\237\362\272>\223(\233V{\313\322X\263\247\273*\036C\354\222\305@\320\237*=\240\267g\247\365\302{6\215-=\331\264D\312Y\356h\226S\251R/_q\201\352^\256\351/\213\235\272\024\\\231\372\346\270bJ\\\211\344\246\305-\313:~\253k\344\027\361[S\322D\274\216\222\313\024\313\245|V\226\016\325\217*\313\252\2267\262i\365RP6S*\227\nY\336\325\222\315l\320d\241\037lU\247h\264\274\312/\311\t\223\264\363\250\214\213\372\341\240\216S\227\024qu\030\036\271]\227@Lm&r\350J\261\252m\266\265\343\226\344\214LE\272Z\241G\220:\223\034\031\377\225K\210f\266h!\025\316\377,\265\301<]\310Y\216\275\346m\333\316e\323\271r2\324OZ\035\344\2466\227\253\335\215N\351P\227\022\214;\222?j\213\242\222\035\365S,,\253+\265\325U\024\212\376\273E\364|\252\023q\261br\340\020\270\034\330.\341\246\374\313\231F85\223\232mzo\272J\237\350[\345bV\\[\327\035)\251\\\3765\215^Z\2060m\242\363\\\301\312f*PWY\372?\2356\177H\276\371B\336\371\347K\231{\272^\326o\362\227\007Y)<\2320i\373,\234\034oU(Xi\331\272\227\333Z\337\300?\364\035sJ\205\274zY\275\\Z)\254\352;58\372\226\344\003\211w}\313\332\275\222v,\037\351\325I\375\233\306\356/\275\363\235\235w\331pK=[\305\356EL\345\274""\236\320\330\271DJ\223\367\257[\330\335j\262\016z\221S\016\273\241\277\025\271\241\226\225HO\343X\r}A\375eA6\322\314\233\340\370\017\232\257\233\336\0160o\356\210c\226\3371J\t\227\205\322J\031\277\325e\376K\354\304/=B?\274\326\304:N\337`\237&_[\024=(s\255\023%|\022\233l\3222[\361\214\325!\357\225\217:\\\321)k\244\2429\035mz\203\211\207\177\330\212\251#\034\374\322\320\272\263b\235y\260\316\314WG\256\253[v\313\225\317rf\260\344\232\032H\022\250\026\210\364\272\020\277z#\325\362+<+Eb\tg;I\222\323k\325\365\242H\264:Z\310\234/\331\026r\332;b\335[hW\252\033i>m,m\316\034\323\032\317\3343c\364\213\356|Q.\027\255U\022\007\372\237\0342R\rP\232H- y\240g\254\354@t\255\374\322\r\254\365\006\251q<a[\326\264#\300\247KU\204\226f\367\272*\335\241\203\026\277\004\356 Y\241\270\300Y\272\350\t\307r\231J\025\230\334\200Z{u\344\004\324\212\230sa\014\005\220\371Qm$\333N\177Y\027\321\257L\332Ur'6\370\217\265\372[aC\245\370aP\361/M\316\007~-\014\025\017\027\265\035o$\254mQ\220\206*\n\005\274\226[\310n\025r$\265\340U!\207\255\306\370c\341x\234\002V/\351\242\214H\215\227d1\033\314\005\315\362\264\354M\316[rH\231,\342\251\010E~\370\225\004\376\303fT\026\366\324\362\236>aF\335n\360\031\232\330\016]\340w\026\274\364\317\247_S\340_K\014Q\241\014Mh\334)h\305\355\0224\260\303\204\027\264\376*\3606\312\202\305r\200\241\221\367\004\324\313\002\262^\240V\r\3326\024\271\226\026\335\333@\234I\233\266eE\347\006\017\347\346\016\275\312h\262\230z\225\305l\334\265w\360:V\023m\340q\033\247\234\253\225z\221\222\1771Y\354\245\033\\mg\212\257\364\357\250\365\252\260\221\306I\023$\n\377(\027J\257\250\316\r\347\230\362=\336\025\241Vr\242\355\325\366\253m\010zQ\357\244\242V(\025\241\326WX\303\210\225\007\037E\341\300\025\301\277R\031\373\235\361\017\336 ~-\322\206\360\257\331\014\024yB\313_y\232.\241-\270\227\305\3626!w\326\213\374*\2051\373\366\213\025\305\337\326\311\366\263\025M;\370\307K\225\353\262\333C~,\023\211\340\202\232\215\0037\345\320\3154\357\322\246\372\351\366u!\277\255S\032\360O3\312\201\023Wu""\035*\021\207\255\321\277-\270p\372\227\256*\345\2642otC\332\244\204\316\244\323\216\27745E\316\214\260\331RG\022\262\256v\023\320\037\374\222\243\200\037\375>\005\\b\233\232\3566\312\026\324Ki\275Z~\225/\251\037\253T\246\347\253\333\345\312+y\333\003\374\227C\244\010g\261\373HW\2301\331Wr\002'\376VW\370\334^2E\342h\360;\032\345\225\025\022>\362\245\341N\253f\340R\324\020\271wy\274\333\220\346?TB\204\355\000\305brH\204E\363\324\032\205\302+\343\225<S\300VU\305G\312Aw\\\212\232\334\300\202\257\276\244\031\240\243Y\331l\242\n\227\231\223\023\235O\177\361\212-\007\220\370\263\301\216\370Fa\243\240\275\240\rR]\033\345\r\235\237\307i\031y\250q\221y\371\313\303\203Y\200\272\371\202\217i\242\337ju7\315\257v\253?\356\200\235\356\321\207te\013\227\0334\003w\315\233]\351\215\335\255\254\0250\201\217\222\206\215\335\2354\205\017\005\310\r_\257\345)v\333Z\227;\245\376q\311\356\037_Q\341\205\354\253\"\266\001h\272\327U\t#6\271P\n\013+\312\233q\002\340\321\020\311V\246(UW*\231\002\330X\222\t\\Y\256pX@NW>\223s\344\267\370\022\375\342\013%R*\255J?x\213\335~\177\310\\\311\253W\016\000\354\2028\214:\373\323\231\005\352\222\027\252\250\354\262\332N$\271g\225\201^.fJ\257\322Pw\n\240\355\211\272%{\242\266%\250\037 \365\213\237\332\315w&\245\315\215R\331\346^;w\355\010a\213;W\355NQ\353j\364\257%\333\340\345\257\016\204\030\255B\021u\005\027I]b\372\252K\3509\271\264\354\355E]\256x\016W\362\222\271\321\352\274\"~\353FV\275\326K\377\243\221p8*\026\031\373*\307\234\244!e\227\225}\016\214\034\247\2027\247\361\217\333\303\356}~S\277\020\016'\034\221\020i\t\253\303\021;\316n9\367ut\313\023\361\312\274\232'\226q\315\234\353\365z\023\035.\324\\q\\k\021\304\033>\324\n\274\000A\256:\214\276\323\362\271\262!\026\277\221 9\001\221?\346\013\376\300\200Y\026\305\233\320\227b\327\214\257\301Y\002\275\211Wn\020\372\240\031\205\254:p\273\232\303\321\224\325\374\006\322\010\360( VHqA\211U+^\372\347\243\177~\325\022\325\036\034\271#\347\356\330\276\207\343\034\036\271\324\336\206\334a\236\253+\222[\235g""\223\204\037\375%g@\336X\330Z\266\266HG\2217+\016-\322G\364,\236\307\017OA\224\005\007@^\013\"_\270\210==\351\264\376\273S\345\224\017\215>\231\017G$V]\253\224\267\251\237\"\210:\275\247\177!\333\244\373e\027\036b\007\253\010/\031\243\321\026\321A\353\261\346Ck8`\221\363\017\267\364\3011\252\020\365\n\n\251F\032\034Y\n\336\302r.\265\n\r#}N\235\333\"m\247dlCD\203\034\014\230\253\327z\221\201\035%\361\226^g*\005(U+m\256T\346'\2356\027\333\210\257t\214\265\275\314\341\256\326A|\243\247\036\337\200\221<#\355M\217\035\373<\\\033:\344\006zE\256\224\356u\346c\305\002\357\350\375\222\344\014\351S\377\371\327.xG\374\177\365\343\330<\340\204ptk\003:(\014A\3112\2331y\253\232l\302\304 \355X;V1\215M`\372\237D\000\277\255\374V,,\337\362\005'\3272\025\375^-\336\357\344wkc\372t\0376E1\375J\344M~\035H\017\200}\340\305t\271\262\\\310\221Scp\347\314\231\273\352\rWm\340\333\341\230\376\346\330]s\242\2729\372vk}9_\341\2632\365;\230\032\005{N\363\335\334V\370x)uL\204*]#\251X\322\206$P\346L\\\032MY\274\322od\361\353\367\350\354\254z\177\027\306\227\177IRw=\313\310\332\315Ik\264\3130\277\233\220\267go\017\333\227#===]\021w<\316k\032.>E\025\364\016r>\203\007H\036\025B\036\217\273\3439\211X\324\213\207\367\301\250\327\271\332Z\340l\362;\037$\347\3528\252\3437\n\342A\007\241yW\335\335}G\251N\246t\205w\364\371d&8\236k\357\200\003E\227x!\001\317\342`\332w\262\356=\311\336\373\221nP\365\200\213!n\210\273\370\016\344\273\371\324\323uh\\\222\334\255e\377\r\301\261\303\177\334\254x\367\3651u\276[\314\336\371\334;\007\361\177\332<>\353\260{U\377%\371{\326$Lho$\317\200\327eR~\303]\275?\223\365s\327\"O\3747\222{\334\023z\363\305\177\377\244\375zH;\017\314\000\273\246J\027(\036K[\274k\257\212\311\004\204\365\036\202\363>3\t\031O\213\332h.\236\223w\301_2\231\263z\340\317\364\250\027\246\304av*J\2051\333\347\\8\212P\305\233\3521\341W\016\224\323\225\362\372\234\205+\324h^\246z\006?\251\307\235\026\353\301!\244\356\r\335m\205\365\300\013J\254\364\300\\\322O\306U\232\243&\265\352\024\265\213v\223\366\344""\362E\203\354\261:\332%\213\267\374\252R\252\254\272\331\263\226\261\030\202\213\024\265\203\177\251!x\036\374\327\327\300\361\265\263\022G\343\252Z@\254\036\275\310\234\250,\"\234\356A<\202\242\364=2Q\272z\275\002\305U\225\365\370\367\250\3311-\t\n~\302\336(\244\261\230k\232\242\224\337v\314\300\036^\366\216\251\020\325\224J\335\350\262\313^\3159'{z\nf\227\022\005%\330\256\327\203\304\255\236\004=H-\351\306\350t\265\276G>S\n1W\217h\314\311%\316Y6\210\3345\033\222\250\360&\025\360`\316\222s\256\261\273\213\317\256d\207(\211\000\013G\274\255\332\200\n\273\213\352\320>b\016^&w>\3428\306\325>S\262\375t&\033\243\275\306\245\022\335\027\2545\002\251\262\277\377\336\034\342(/\267\177\377\375\271\245R\245\363\334\335s\327\371\340\266\333w\357\336\032\032\276\316\207I\\\037\371\347\360\320O\277\016\375r{hd\370\367\237~\375\327/\337\376k\344\356}\370\316\367\357\335Sg\001a~Y\033\371\314\253Q\362\346\345\360\002I\264\025Vv\357QXB\216\242\242\314\363)\00784\210\252\337\"?\376\256\355\257Z\212f\203\234E&\311e\357\351(\360\236w\324{\317\365!\031\213_\235*g6\230t\333\312\025\357\035s\020\322\230\357\236\317w\267\222[\271+\347\203\335-Y7\376gg&1\315\216,=\234|\236\322\273\360w\3651\230\357s\232R\253g\254y\352\317@\317\207\037\267\316}V\033\254y\017O\177\322\372\344\253Z\246\266yx\372\257\177T\337x\017\317\234=\022\330Z=\323\032\032\337\357?<\375\361\233\373{\013{\031Pl\277yU\353g\232\277\376\361\333^\177\353\302\215\272\367\350\314\307o\302{wj\371\272\367\260\367\363\232\267\366\270\376\260\345\235:\210\036vA4\277\332\247\252.\356y\367b\265+\365s\215\221\246\267u\032\215\352\3539;T\317\374\371Q\317\331\333\215~\374\364\276\t\274\371Om\265\276p\330{a\357\346^\251\036=\242\213A\024\032xc\321\005\2033\207\275\237\276\251\356\371\351\242\357\362\336z\335[\247j\257\326z\353\223\365\315\303^j]}\246y\2729\275O\317\365\267\372\277\251g\352\257\033\277\354\3379(\267\226\236\265\236\255\264VV\245\2257\366\026\016\373/\034\366]m]\035i\3647n7'\233\273\007\247\017\246\337\016\036\366}\331\372""\322\327\034lz\217z\007Z\003\267\352\013\365\1774?h\216\357O\035|t@\325_k]\033md\032\233R\316\020\261\207\032v\267\3655u\n \337\233\3057\225\275\213{\217k\001b\362\005<\236i\365\\n]F\247?\353\371\360\363\332\340\241f\346M4\276\367M\242\366\26052\276\177\2318\325{ioq\257Z\373\2761\324\354o\016\357\017\022\257[\037\177Q\233\244\242z\277\256U\352\227\352\271\306p\363Fs\241\2319\034\274Y\237j\234n<mn\356S\315\275\255\336/k\013\252\200\326\347w\033\317\233\321\346\213\375\005\014'\261\334\333\362>}\353=\374:\262\177\352\317\333=g\317S\245^0\356Tm\200\236\242v?\330\263j\267jV\375Nc\231:\322K\322rt\346\312\336f\355\243Z\256u\335\327\374\226J\272J\235i\365\364\357}]?\365\347\365\236\017{[\037c\220\243\350\316k\3525q\344\2237\377\250\235j]{|\260\371\366\024\300\273{\247\366\006\210\323g\372\366>d\221:\323\277wy\257R\273L]\351\327\325\377X\267Tw\207\016.\034x\3778\365\347\005*\374\215\367\315\223\275h\353\322P}\247\261\331:=T\377g\323\373\347\271\236\263}o\376I\225N\327\277i|\324X\341\201\376\342f\375q\303\333\352\271\330\272H\343\017\036\367\276\361\277\311\274y\275\367\242\366\262\2369bA\017\356\375uo\213\371x\346S\302,\034\361\317\363Z\264\266\320:\375u\353ko\263\037\245\017\354\005\366\376I\342\313B\267\275\227\247A\254\326\375u\032\366+\324\354\213\265\251\372G\365B\303j^o\306\366/\356\263\304{\201\333!2/\212\256\222\244G[\247GZ#\367\321\264/Q\350\245\326\000d\354\233\346\307\373\336\303\333\301\346\302\341\355\010\206\354\3237\273\304\200k\365\301V\317\245\326%\264\340\213\236\017?\".\266>\271^\037\254\207\032\2375\271Lko\030BC\222@`\002\264>\375\272\346d\311y\342\324L\375\024\344p\210X\373\272\376\242A\235\002/\256\366\234\275FU\364\203\357\003\3504&\342tMM\252M\264\034#\2349\342q\331T\335\271\2607J\245\365y\352\247\352\375\016L\230\246_\256v\273\036\255\263\230\375\\\357Gk>y\263\n6Bb\356\320lSe\236\246\271\357\005\325\202\243\235W\031\021E\227\364\030\236n<n\206X\362e\024\377\240\316}\333\360\376\371U\317\207gH\371d\367\372y\036\017\267\206\241\231\270\325\277\325""\372k\303T3\n?<\375\341\373\262\253\347z}\224\004\373\023\260\345\016J\327\352L\217\303g\255\033\201f|\377%\315\361\317\276\254%\353\2374\2124\202g\211c\254\004\204\354/\265\321\3260\006\357\332\365\372H#\322\3647\263\324\256k\204?\"N\274\252]%\246\334\004\033H\212}\377\327\325\356\247o6i\336=\257\375@u\234\376\274\3659i\265?/\213\246\335\206&\005\007\301\037a\337\345\306o\373\375\177\234:b\316\265\256\373\241\251\375-?\325@ry\366\334a\357\3717\013\207\237\366A>\276\205\316\0201\021\356\241\r\343\244\363\250\005\027\367&\352\23766\233\247\216p\331\362P9M\036\363\377\3242\206\232Z\326\352\351kA\306\376\034\200\320\237\376k\353\257\237\327\374 \371\n=\251G\311&\270'\362\341\351soh\\\317\2749\323\352\273!\212\237\304\365\315\324\336\351\275\350\336Kz\2228\030\"f\235\016\240>j\354\233\365Z\260~\226f\336 \264l|/U\373\274>M\252\346\002\344\244\027\352\005?3\244\261N\243\035}\302\231]\222\321\251\372\351\372\223F\024\2351\272\300\301/\314\214\313u\232\202\3048RV\357\373\330p\343\0241\371u\363\307\375M\3269\244\t\376\213\247\321\345iR\"g\367\373k\347x\300\372\033\267\032RR\250\231\301\030\365b\366B\007\215saS\2153$\361}4\037\017\317\367\357]\253\335\254\345H8\327\032\231\343\252\240yB\372m\245\361C\223\344\345V\353\026\212\0350\306\002\005Gj^\031\352(=\302U\371\366\222\265\017\010J\325Tk>\222\213>\322e\230/}\003\304\337\201KG\243\367\310V\016\334\250\177\327\310\034\235\221\306Ek\317\352\343\215\250\251\203\231\000\341_\201\"\031 9\n\212d\375\2636N\352\346Y#\324\274F6\274\324J\275h\275Xm\255\256\265\326\n\255\323T\317\275\306\357\373\203\320r\275o\"{a\232\365\3241\374\234\277 \206\371<\234\204\022\027\021iB6[\027o\2234\364]i]\031\252o\222}\337\373\201\344\246\367B\353\002\246@\270A6OM\207`\343T\253g\230\347:\264\362\247f\372\366\221!\331\304\274\334\024\335G\023\037S\374\273z\236ZIs\0267\220\272\313\r\242\372PD4\372fio\220x\027\250\375\326\350?\374x\220\324\352i\270&\2777\007[\247Y\267}u\260)\306\r,\016\223T}\244\345\002\274\245\031wO\264\355\307]`<\0351q\006\240\332k\017""\310`n7\377qp\312\201\371\370\315w{Y0\344\213\032yU\237\327\202-\017\273+\203\254\256\n\304\305\233\373\245\267<\241\024\037\257\221\226\275Y+\220\367\264\000y\351\333\373\270F\376\020\377H+\310\320\035\366\301\273\311\311\364\232\243\252\003\265m8;J[_\304\244\372\302\250Zvv\210\273\220\215\336\257j\257\210\023d*\376I\\\037n\216\036\234b\316\203\246\013\356\217(\371\260g\277\254M\241\331dD\241\n\215\270\220H\265.~S\317\3223}\344\001\035\321\237\0249\027\275Wk\037r\347{E\227\221N`9?\257L\036w\021T\247\300\025r\014\3109\025\243r$\n\356\210\330w\263u\371\016\315\3103<\350\3709ew\236D-\322\372\034l\354%EFs\033&\360\026\225s\232:\361\345`\375s2m\367\367\027\376\354\3559\377\031j\372\224,\327\025\330\325/kKd\212\376\322\034\332\277\264O\315\370\254\365\231\277\251\346\255\227\035R\210\350\300\347$R\305\346\035\242\030\2406\036]#\253H\005\006\232\233\207}\203\255A\322\344N\222^\210,\225\301\036\3405\251\215\010\373\341\021\177\017W\366\3173=g\257\300\377\372\344M\251\366\250\266\\\377\220\246\204\237\\\275\017\244\352\337\310\267\211\036\365\221\214\037\366}^\273__j\0146\306\341]\355\177w\260\372v\341-\201I\260\251j\342,\315\364\177\363\274mn\223\320\304[K?\265~\372\265\365k\272\225\376;\211m\377W\265%0\374\341\301\265\326\017\000\273\350_\275\355W\205`\250\244\2252\031\033\037\303\341\376\224\024R\261>x$\265ap\372\372\001}M\312{@\n\0164\253\373A\222\027\322/\361\332\363\372\323\326\275G\007\304\214+\344\336M\327o\324\177l\335\233&\023\376\271\2074Y\226]\202\253\327\216\006 \367<r[\344)\235o\335}\270\237\331\337>\310\275\035j-\374\322\372\345\327\243\336\313\320\203\244\261\216\224+|\223\0143f\364\305\346\324\376\207\344\373\2321>\317\r\246!\"\344\245\346\332~\346\250\017\356\037\351a\252\0036D9\\W\265\337\365\031Y\344)\026.\023x@\352\310Q#_\351\274r\360\243\324\223\037\032\271&G9\267\341\225\036\222\367\275\r\357\000e\\\251\235\201\177\007\025\264S\337n0\254\237\334\234\241\272\3228\230y\245\346\343}\357\037\321#\333XP\260ES\247\027n-\334>\314\347\255\306dc\213\010\375""\373l\214\377EU\375\210I\376\007I\371\347zn\357\020\003\0061\351\317\3213\353\re-\2470UHZ!\211\323\324\322\013_p;\331\353\354\207O\t\243~\232\346\013l\306'\255\363\312\267\372\235\232\027\242\331\300q\n5\347\023e\247.\355-\3015:\022\353s\026\363)\320\272r\227\365\r\274\214+\010c\310)\246\232\256H\300\005\253\365GT\212\030 /\343\324\037\254\261\340\"\3003c\336}\333\3722v\260p\220}\333\377v\270\265\230l%S\216(\207<I0f\212d-\270\177\3121\036j\356]\336\373\007\330|I\342\202#\245\004\241\215\3207\335\366\000q\215\003\262\276\275Ok\233\322\206\300\233\177\223\313\370a=\325\270\324Xm\376t J\301\003+\006\317\203\313{\177\312#\325\253\352\336w4U\241O\250\256^\245\354\310~>\"C~\233\006\222&\3175\356\031\315\205\247\324\"\372\231\252\235\255_\250c\330\317\270Bjb\356\336\277\353/\305\366\007k\177E\373\325\370\tK>!\223q\372 \3126R\302\346\005x\r\227I\0103\342VN\2017Wk\0373\371\207\215\227M\216\305_\223\375?\305\252\306X\321\233\215\2742\266(h\253\001W\356\374\000\306\216\374z=?>v\267mS\207\367v\235*\334\277H\301\376\032\205(t\177\007\266\014\372\373\224\231_\030\302o\244;\214?:\303\234\"\026\237m\014P\027\316\\\332K\223\375\177\016-\216'?\200G\341\030\371\363\030\332\035.\022\323\237\035\2417fP\321\300%8\014\003\255\201\233\365\311z\225t&O\322>vA\371q\025I\211_p\006\312\027\261\370\3270\205\344b\000\r\217b\210\206;\327\274I\341\302\300>I\026?\037l\374\025R}\036#\377XeHN\351\2527\217\255D\223O\261X?\247\336\245\224\217\333\242!\235\022I\232\253\335 \353G\241{\2409\331\334TM\342\030\265\367\315\017\024\306\r:\3529\177\324Q\376\017{\3134\243\206H\224\310\021r\222\272\233B\\\243\361\372\202\014\356\000\006\322\331<\334\235\332\273Z\353o}F*\241\361\313\376\355\203\251\267\247\336\366;\014\250*BTT\257\024KB\204Xy\360Hy\247\354\265h\240\n\260\035\355q9F;{\273\365\017\352\201\272\023\016\305\365Tw\374\351\336f\267g]43\316\006\251\264\323 \344\373\014\242\213\213{\332\215\350\247\353ibr\252~\021\363S\204\217P/\331M<#\256qJDt\202e\225\372{\246u\025A\300\325f?|\2513\344\241,B\203\300\365""\353\025\256\240|\236H7\353\257Z\336'o1\265:\t\270\345\206b\340\322\341u\232i\272k\314\333\363\377\203!\203\373\210\314\0214p\267Q\272l\032\241r\004d}F\036\035\3348X8\034\344\010\270\315a:\202\324\335\254\033\216_\206\273\270\332xFQs\346\350\022\324\316c\266\260d\262z\337\304\310P\006j\377j\335\231\330_\330_\245\"\341\002`\262\036\235\367\324\3174zAu\226us\353\013\212(\232\0375\363\373\221\003/\202L\nJ\264G\270Vc3\376\224f\037\3059Gb1\\\235\371ho\025n\241\206*\t\353\333;Ks\351g\321\364\325\275P\255\377\217\250\t\215\003dri\326\353G:\255\243\244}\246j\247N&\tc\326a(\035*pg\3575\246\260\t\252U\032O\302S\2738V\210W)H\374\201\374\355\221&\273z/\331\347%\317eU\374\\e\304\006\366\022\254\377\007\332]\021)i\247f\325o\221\"\013 \332'\267\177\355\200\037\335&\326\255 \003s\330\207\020j\270\376\r+\247\201\317j\337\212\212\346\310O\371\316\377\303\322gZcp\325\310\314\276\202\203\256\312$\317\213x\260`\013\271\212o8D\025e\236\252_\245x\252\212\260\335\016\325\300\323m\036p\252;\310b\214g\220\260\272$\236.\022S1\022\363g\312\217;s\300\306\375\231\2709\312\000p5\234\234\250\355jU\027\244\251\371\001\347o/\321`P\313\341t\\\350t\355\256H\342#Dj\356\212\230ie\243\214\307&\331\037\345\255\r\036\031_m\005\036\2248\024\252\320\317\330M\272\204\370\351f\353\346\203}\350\240\017?~3L\201c\250\366%9w?\220\363|\215\\\032\223A\202\363\314\271\242\025\330-*\214\343\340\360\336`\353\"{\252\024\367\004\233\317\366Y\253MsN\254\027i\330$i\235$\265\366\021\211\317\305F\2549\200,1y\203\210\327\367^\360@|\341\020\3210=\371M\375\257\365M\323\271\016\313m\233l\334o\325\236H\352\236\211\333\3144\224\2546\324h\377\231\001N\032q\342XaY\205\252q\252\2116\204\307\371\244\031\025I\302|\355\273\326\272F\026\001\001|\324<\001?\224\003\254\213\304\261\313\260\277\210\n~'i\211p\364\177\225\343\216k\342xs\344q\231\254\334\251\332%\032\372-d5\021\275|\206|,0\253<-\251\200\327\265g,nW\021ne(\270\336!{\372\005\014\363\027_\036\016|IX\016\214E\265\322\034=[\357\327\021U\214lC\234\364]x\237\213,\326\355\304+\213\235""\312A!ey\213u\354\251\303O\021E\364\"\363\365=\253?d|>\2420\2034\"\\{6\361\254\027\304wO\325\277n\236nF]jE\317\231K\024\330\273\347\2148f\377;\363\006\031\213>\325\246\313\365M\273\211Ku\267\326S\022\001i\243\022\377\340\034\\\364\315\013\207\347%\235TI\005e\267\3613EJ\272\337Q\223\250m\270\350\031q\306\253\254\370.#c5E\316\307\347p\206\352\254\311\311\225\272Y\237j\r?\334\317\036\364\313T9O&\247_e6jq\344\314\241K3\322\240i\211i\344\306\341\035<\221T\376\315\206\242\243{\304\256\247\033NBA\305\245{G|\t\001e\267jU,\276\334d\004\375T\002\34034\320\253\373\317\016\274\207\303#\n\001\177\005\276\210b\235p\242\367Se_\264\"U~\274\n*5\007\236\356U1\201\244\256\247\242b\245P\212V\341g\312\322\301\014t\030\262\203\2032\274!3\227Y\2154\276\242p\373\376\301\363\267Q-\301\3471\275\276h\335\n77U\3005\3636\372\366\031GZ\375{_Q\331g(\230\310\361\n\034/\035\364\352e\236M\243\010\273W\256\237>\315\223\375\304\247\317\230\247\241rvj\233\222\225\234\3445\236\035$\326\232bB\216\320\217\233\360\221\261\304\326/,\230\341e\010\022\351\027\265\027\344\222\024yu\213\225\313*\202\251+\262\336\301~\373\215\272-\353\325\326\305[\220\223Fq\377[LGG+\324\310\330\276\322\031G\367\276\200'^\037t,\030\272\332\244\203\313^\307#j\305\346\005\\\001\263\302r\221\302A8\227\254\235\026Z_\301\r:\335\n`\t@OO)\311Qy\253_r|\231w\325n?C^\217<\363\217\246\221\222Y\231\r\322\306\204\310\025\314\204J\r\233!D<\310\036\260\236c\214\356\333\373\013\23112\025\255\323T\361\377BJ9hD\337\331\246+2k\034mr\255x\222\277\330\272<\202D\355a\357\327\255\257\3575^7\331\361\212\2413\222l\251R\025y\254\203\334k\335\213\036\360\n\341W5\311V\210\003|\025\276<\263\214\034p\016\353\006[\203^v\357\351\222\324\377\023\255\031\236\2202\372T'fM\030c\232\203`\267@\222\253\327\340\240\331\256\326\277B\210\357\321J\314\020\233\021*\360\222\215\013\205\222[\003\010\274\253\215qr\0322\035h?\364\016F\247\217\223\261\010\034\340\207\\p\313i\273\222\257\302\010\312\370\235\220\256\017\362\312\310\353\306\317\373_\035T\337~\337\372\361\247\326O?""\353\304\t\036Y\2255\352\205C\265\024i\347\244\246\367o\354/\264\345\244\354\347\330\261G\222\256\343\271n\271,q%\361\\\241&+\222\235\317=\331\237\334\337l\177\316#\317-J>B\022qbq\217\316|\3116\225\252\272Q\277\337Xj\016:\"\302\363\332\323cm\325/*\330m\357\324\317\245\275\237\352\247D\372^\220\2071\3258e\374*F\231|\340\317\234\276\320\2158\"\354\217\320r\352\347\312\336o\320\374H\313\3144Dch\317S]\330Y\301\250\355v\376\203LLF'\320H\231\264z\006\311\201\240\210\360F\353\006\271\234\207\347I\350\217\220\270;:O\022\364\347?N\3112l\216\275G{\211\317\244(\325r\261\2713b3Q?\205$\365\267\373\351\267\354\013\262\336\321\263X'\223\372\276\252\225\033?\355\237\342~\264\276\270\333X\220lO\301\261L\312;\n\350a\275\340b\356v\367>\340\025\225]\212S\266\330I\371\350 \373\366\342\333\250i\225D\355\354I@\216i<\220\343&@\274\376\\\371\275\317\016\374\024\240|\371\rM$\362\352\216\230X\225\355\225\247\350\356w\356\024gv\316\236S\005\"%o_9Vi]\253\311?\354\027\0166\017\257\335!y\3737\311\366\265\317\216_N\276Q\037o<i\005\036\203~\010\366K\326\223\277F\340\333\n\306`\200\337*\223s\275\376\245^\222\t\324\376\303\371(^\340\311\251\034\254\232\316m\232\277\373|\356\341\304\026\304\225b\215Qj\367URi\375\274x\376\025\273\305\217\033a\330RR\"\337\336Q\331mQV\031\262\272\257I{\2545V\232\321\346\202x\261\024z\220'\203.\235;`\347\3512\265\352.\3716\247`\004N\357\315\352\204\313\324\336yY\231\0024\3161\326T\343\203\006oI\371\220s*O\033<9\2678\315\365%B])\257\300k\224\005R\326\311}\016\327X&\\nR\247\001\273(\033\212\352\013:\274\277T\313b\376\210/\267\322|\272\277)jY\371\255\233\256\010W\255\214\236\342\334\372\033\225\257\351\343\213\013\372\242\2279>\334\370Tv\3438\363\213\027\367\036(\207\353\202s\017\204\235[0\n\370+\265zt\374\200I\363*4\311o@[ \207#\017\367\201\373\234bU\313\210^!\345\214\221&Q7v\302\342\343\272\327y{\276\276\340\274=k;\362\002\370k\315u\373\251\003+\274Q\231\023\335\006\235F\321\253\232u\265\034a\2269\305}\303:\337\215\306\217\255\360\023I\020~\372\346\337&\352>\347\242\306""\362$\266~\351\244V\347R\350-\311\016\223\205!\311\033\341Er;\2048q\335\262\275\262^3}\\Df\r[\367l\\\254\203^v?\323\370Kc\320t\023\036\343\202\243l\271\177\3254|\231\340\320\032\321\200d\316hZ\177BF\370\333F\252)\031C\222\226\247d\312\275\206\317\022\376TI\250\220FP\336\305\343\332}\n\327\224\337\360%\207\251\233]I\343{\277p@\354\375\203\242.l\2758\363\307\326\233\3117<\3276\217x\302q\022\\L[\214\267<\311\026\nc\212Ns\350rx\372\234ln\001\257N\237\177\363+o<Q\374Fp\367#G\340\247?\346@6(\211m\270\330\031\304%r\303a\214\\\356*\273y\001\223\325\271\257\004\3669A\361\277\231\227}\235\024\233\255\036\204\315\003j\255\231\332\211\335G\332Z\034q\222\244m+\221\354\025\341\335${\247$\004]\020\340e\270\251\267[\267\037\035\214\266\346\027P\335\211\342zdGe\334\007\244\037\002\234\210\366\"{P\245\030\376Q\353\233\310\376\007\373\341\203o\336\236:\274\n\243\207\014k\237\254\026\237\222\0076\341\327\366\r\250\224\362@=\335|\324\344\234L\274\226\344=4\310?\004j\257[\267\260\272y\025\276\310\347\304\223\253\310\326\346\232#\360\201\366\177{{\351m\346\355&\215\372\265@\323K6\361\354\301\345\203\315\267\347Z\213\311\243\376\3179\312]\320\315\373\013\365f\340\263\332=\036\257>Y\002:\327\034\332\277z\320\177\324/\276LWJ\321Y\2775?C\362\365\360\306P\375\337\234b\272q\2731\324\374j\377wl\237\304\246\2125\266\013\217\367\025\017\220J\273\372\005\t\362\346Q\3775I\322\260&?\034\300\262pu\337\273\037=b\311Wj\356\250s\252:\321\255\323\223\007^\250\264\363\010\3009am\2038\201\312\333\235\3564\246\233w\366W\016\272xc\254(tzkHR\341\354\206\311\306\213 9\000A2D\317\352\376z\276\341\247\256`\021\005+\032*\337\njY~%.\335gS6\000\007\201\006uHr\233^)I9\210\344\271\312\0323\347\\\340]\310N\203K{\013:\253u\201X~\021[\240\260\344\204MJ>\262pg\016\376r\240sGR`\204\302\243E\2327X\233\341\005\363\235\275\n*\346\305\253#\371\201C\025\340`B\232|a\357n\315\252\017\223\251[n\376\205\334\205\2666\177]\373g\203w\001\360\272\346\021'\200\257\363\"\343ul\253%\343=\300\233\373\016i\354\320J\2739\027\331\261\303\354""\021^^\337coo\230\204x\211t\3472t\3411\034\202\025\273\260\307A\036$\366\374E~j\301A}\225\334\243\353d*\355'TW/r\204x\n\033 \274G:Z\207aX&s\020\226\220]\255\307\360O\353\364\014\271\205\267! wz\316\372\232W`\241\357\360\0326k\244W\365+\215\217\032\031Y\364y\310\342\311\273O\274u\336,\363\260\301{\036~\253_k|\323\032\373\333\301\247o7\217D\267\210\215\030\324\033/\267\310i\341\030\222\221\220aU\030\247\327\364\n7E\207\310B~\206\215\031\3108~){P\221\316|_\037\311\354\210\276\274\227\257Ex+\234\316\376\0237\216xi}HZf\203A\275\\\373\010vU\266I]\257M\327\207D_\263d\212r\3364\311\014r\327\221\000\342!\273^\213Iy2:+\262$}\246\306\234\332\326K^\2448\207\377\013WO\245\037i\320\374\222<\346\325\034\257s\367\354M\023\316\223\243*\233.>\2478\345[R\033\207\337\252\354\205\336D\213\335d\364\230#\005\320\307[\003\237C\357\034^\222\375Gl\337^\200\341\324\322\377\265\315m\336\326\271\321\326\350\367\373\377~K\025-\264\026\026\261N6\370\347\030l\211\2217\204\024\327\340\024\311R\375{\n\036\322\032\347x_\353\233\337H\210\274\330\027\316\031\334\007Hal\032\370\177'~=\324\251?\377F\341\036\266*\235F\002\266\365E\230\\\331\263\007\375\244\177lS?\334\030t\004\007\321V\017\351Z\331N\013\013{\211\324\330e\354\245\276\210\374\235\332Ep$\027\255\273\177;8\325\352\341-\030\367\033\013\330\246}\206\003\255 \257ja)\3136\330\274\321\023\021\240\377\rg\244W\366\236P\350v\372|\353<\326c\262\365\317\032\336#\216\323\260\251\033[\035\177hd\220\n\221\025*\305\036ko\244\026\"\325\376\034\373\031\217N\177E\221\277H\251\332\351BC\210=\246g\270\030\016.\363\274\274\312\365E\021\252a'\034\030\307\033\374Z\337 \343\371i\237\336\227Z\330{MF\370\nY\315A\021\246\367\330\305\370\305\376\257o\003o\377#\233\245\310F\325&h\272\234\223\014\341\212\312\365\257\220|\177\365M}\025{\270!\316\003m)\220\002\371U\253\354A\234\227\315EO\034\313\207\027\332<\243\377H\232\277}k\256\370R\247\310)\375P\247I~k\\j\374\203\354\315\331\267W\310\355\301viT\375\341'\274u\221\342`1,\274\325\377\031\251Z\254\302\020\243\212\255\317""\330\374b4N\360#\315\002yw\337\361%\351\235m(\225\372K\035Mv\365 \361\352\202j\321w\265\"D\361C\016\244d{\320\307\275\344\237\265.\362\253\033\207\352G\372y\370\331\347o\006\377\340\327/\256\354eZWH\327\266z.\264.\320s\330\245\375\221l\213\213\326^\360*\200c\013h\347\246{\022|(\245\336\356{{\025\201\247m\211W\274A\235\347\351c\205\230\253\337h\335\n6S\344q]\3036\264E,\355\251}?z\333\203\246W\357N\260\237\310\273\032\263\024 \307Dus\226\\\254M\210\303B\262\214\330\271\364\005\264T?t\223\2277\002\177\304)y;\311M(Nzn\036]E\202\361\n\022Q\352\325\026L$\275{\347\237\262w\320\204\255\374F\216\354r\250R\030\301[^%\261|\211\272\364M\343\303F\262y\272\371d\237_\010\270\307\341\365*{\210\272\300\337\311\311\344\367}\372\354\000x\215\234\300M\307\276\014t\373<\266\217\\f\203\257\031\201d\202d\231\345\321\357\250h\232$\310T\235s\370Z\003\262\246V\345\327A\210MW\232\220\234\0015\366\303P\2752L*\022\235\340<n\277\300\256kw\337\353p\325\272\355\226\346\260\252R\357\247\242=\316\375\301\357\330\336\017\336#\036i}\302\311\242\263\207\247/1\364Gl'\377\246\276N2\353\t\267\302pX\256\r\311\223_\302\026\016B\371\\\275\366\347\257\247\336\357\345\035q\026\361\312\306\232\354\r\330\345MR\262\305\255\336o\026@\371\356\310^X\225-\340\271\326\355\373X\3438\364\320\354>\202\351$\365\365\240\025Fzj\340\313\326\227H\325]\275\306\t\352\377\360\236\316\001\331p8\350\334LdR\227\037\343E!\016\251\261\315\215\333\302F\225\335\267\317\311\201\241\250\361\360\374e\021z\366T\210\356\210\337\252y\r_\316\203\010\364\260\357\013\265Jg\357f\306N\211\363\237\250byk\263\271\342\014\253,c\276 \221<uxq\000\222\021C\037\371\177v\311uR\270\365\325()?2v\207\003Cu\2531J\016\"z\204\r\376w\032\353XB\307>;V\017\215|3B\241\334\355\267Q\235\366o\r\321\330\030\322\266\374\306\245\275\005\307\312\013\266\237\024\340mS\350\326\247\367\341\221\243\373W\254\241R\037\007\276\"\357\177\221\302}\354-Us\302\253\037{]\377\261\301{\374\036\263=Y\020\307\370\002\315\240\327HG7\275\222\243\324\217\234!_/\317\254e\207\036.\364\000""\266\036c\2430/Zr\002V\226\276\237Kr\3401\273/\374\232Pg\230\253\262jC\215\201\306\263\346\203\326\367\3630\023\347\276m}\373\020[\307[\247\341\307\017\237\244\031I\264 \225\366*\223\204v\267\233\261\375~\274%\264\371\277\340\216E\370=\243A\251\374\\{\206\020\352j\201q\335\026W^a\014\244a'\230\366\210z-\243w\177\356\355\315\267\345\326/\330\363LJ\241\267\347\303\376\275s\034\342\237%\323\n\003\205w\\\276\024_\330$\262\225YU?\310F|\320\272\370\335~\200B\351\033o\271\333\277SX\364\234U8\366j\333O\236y\363\001\351\247\323xGn\014i}y\3710\311[W|\265d]6\226~\313\262\206.\326?&\237\033\333s\271\303G\342\256\203-WE`\303XGg\247\216\207\362\362\177\241\010\203\330}\333\352\301cW\235/n!\301\302qx\264\261@,!\\\237\362\013\310\350?cg\213\035\212\005\242\207\352\226EW$e\345%\035(\376\326W\330\253\275yH\222\221\226e\006\366:\302\234g\355\356N\374\242.\273;\021\244\226)\220 Q\375?\374\206Y\311\3729\367\355\315(\177\336:\221x\225\313\342m_>@lc\267\222[Qg\256Y\331Ja\243\312GN\341\324(\274},\247\024\225,\234\025T\330\261\212\377?qR\377i";
    PyObject *data = __Pyx_DecompressString(cstring, 24046, 1);
    if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error)
    const char* const bytes = __Pyx_PyBytes_AsString(data);
    #if !CYTHON_ASSUME_SAFE_MACROS
    if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) }
    #endif
    #else /* compression: none (64497 bytes) */
const char* const bytes = ": [0-9]+[1]All dimensions preceding dimension %d must be indexed and not slicedAll strings must be XML compatible: Unicode or ASCII, no NULL bytes or control characters\n    An XMLSyntaxError that additionally inherits from AssertionError for\n    ElementTree / backwards compatibility reasons.\n\n    This class may get replaced by a plain XMLSyntaxError in a future version.\n    Argument is not a file-like objectArgument must be bytes or unicode, got '%.200s'Argument must be string or unicode.Base class for all syntax errors.\n    Buffer view does not expose stridesC14N failedCan only create a buffer that is contiguous in memory.Can only discard comments in C14N serialisationCan only strip text in C14N 2.0 serialisationCannot assign to read-only memoryviewCannot asynchronously write to a plain fileCannot change the 'xml' prefix of the XML namespaceCannot create writable memory view from read-only memoryviewCannot enable XML declaration in C14NCannot index with type 'Cannot parse stylesheetCannot resolve URI Cannot specify encoding with C14NCannot transpose memoryview with indirect dimensionsComment may not contain '--' or end with '-'Could not create I/O writer context.Could not find root node<!DOCTYPE DOCTYPE already written or cannot write it hereDTD not initialisedDimension %d is not directDocument does not comply with schemaDocument is not a valid Schematron schemaDocument is not parsable as Relax NGDocument is not valid Relax NGDocument is not valid XML SchemaDocument is not well formedERR_OK=0\nERR_INTERNAL_ERROR=1\nERR_NO_MEMORY=2\nERR_DOCUMENT_START=3\nERR_DOCUMENT_EMPTY=4\nERR_DOCUMENT_END=5\nERR_INVALID_HEX_CHARREF=6\nERR_INVALID_DEC_CHARREF=7\nERR_INVALID_CHARREF=8\nERR_INVALID_CHAR=9\nERR_CHARREF_AT_EOF=10\nERR_CHARREF_IN_PROLOG=11\nERR_CHARREF_IN_EPILOG=12\nERR_CHARREF_IN_DTD=13\nERR_ENTITYREF_AT_EOF=14\nERR_ENTITYREF_IN_PROLOG=15\nERR_ENTITYREF_IN_EPILOG=16\nERR_ENTITYREF_IN_DTD=17\nERR_PEREF_AT_EOF=18\nERR_PEREF_IN_PROLOG=19\nERR_PEREF_IN_EPILOG=20""\nERR_PEREF_IN_INT_SUBSET=21\nERR_ENTITYREF_NO_NAME=22\nERR_ENTITYREF_SEMICOL_MISSING=23\nERR_PEREF_NO_NAME=24\nERR_PEREF_SEMICOL_MISSING=25\nERR_UNDECLARED_ENTITY=26\nWAR_UNDECLARED_ENTITY=27\nERR_UNPARSED_ENTITY=28\nERR_ENTITY_IS_EXTERNAL=29\nERR_ENTITY_IS_PARAMETER=30\nERR_UNKNOWN_ENCODING=31\nERR_UNSUPPORTED_ENCODING=32\nERR_STRING_NOT_STARTED=33\nERR_STRING_NOT_CLOSED=34\nERR_NS_DECL_ERROR=35\nERR_ENTITY_NOT_STARTED=36\nERR_ENTITY_NOT_FINISHED=37\nERR_LT_IN_ATTRIBUTE=38\nERR_ATTRIBUTE_NOT_STARTED=39\nERR_ATTRIBUTE_NOT_FINISHED=40\nERR_ATTRIBUTE_WITHOUT_VALUE=41\nERR_ATTRIBUTE_REDEFINED=42\nERR_LITERAL_NOT_STARTED=43\nERR_LITERAL_NOT_FINISHED=44\nERR_COMMENT_NOT_FINISHED=45\nERR_PI_NOT_STARTED=46\nERR_PI_NOT_FINISHED=47\nERR_NOTATION_NOT_STARTED=48\nERR_NOTATION_NOT_FINISHED=49\nERR_ATTLIST_NOT_STARTED=50\nERR_ATTLIST_NOT_FINISHED=51\nERR_MIXED_NOT_STARTED=52\nERR_MIXED_NOT_FINISHED=53\nERR_ELEMCONTENT_NOT_STARTED=54\nERR_ELEMCONTENT_NOT_FINISHED=55\nERR_XMLDECL_NOT_STARTED=56\nERR_XMLDECL_NOT_FINISHED=57\nERR_CONDSEC_NOT_STARTED=58\nERR_CONDSEC_NOT_FINISHED=59\nERR_EXT_SUBSET_NOT_FINISHED=60\nERR_DOCTYPE_NOT_FINISHED=61\nERR_MISPLACED_CDATA_END=62\nERR_CDATA_NOT_FINISHED=63\nERR_RESERVED_XML_NAME=64\nERR_SPACE_REQUIRED=65\nERR_SEPARATOR_REQUIRED=66\nERR_NMTOKEN_REQUIRED=67\nERR_NAME_REQUIRED=68\nERR_PCDATA_REQUIRED=69\nERR_URI_REQUIRED=70\nERR_PUBID_REQUIRED=71\nERR_LT_REQUIRED=72\nERR_GT_REQUIRED=73\nERR_LTSLASH_REQUIRED=74\nERR_EQUAL_REQUIRED=75\nERR_TAG_NAME_MISMATCH=76\nERR_TAG_NOT_FINISHED=77\nERR_STANDALONE_VALUE=78\nERR_ENCODING_NAME=79\nERR_HYPHEN_IN_COMMENT=80\nERR_INVALID_ENCODING=81\nERR_EXT_ENTITY_STANDALONE=82\nERR_CONDSEC_INVALID=83\nERR_VALUE_REQUIRED=84\nERR_NOT_WELL_BALANCED=85\nERR_EXTRA_CONTENT=86\nERR_ENTITY_CHAR_ERROR=87\nERR_ENTITY_PE_INTERNAL=88\nERR_ENTITY_LOOP=89\nERR_ENTITY_BOUNDARY=90\nERR_INVALID_URI=91\nERR_URI_FRAGMENT=92\nWAR_CATALOG_PI=93\nERR_NO_DTD=94\nERR_CONDSEC_INVALID_KEYWORD=95\nERR_VERSION_MISSING=96\nWAR_UNKNOWN_VERSION=""97\nWAR_LANG_VALUE=98\nWAR_NS_URI=99\nWAR_NS_URI_RELATIVE=100\nERR_MISSING_ENCODING=101\nWAR_SPACE_VALUE=102\nERR_NOT_STANDALONE=103\nERR_ENTITY_PROCESSING=104\nERR_NOTATION_PROCESSING=105\nWAR_NS_COLUMN=106\nWAR_ENTITY_REDEFINED=107\nERR_UNKNOWN_VERSION=108\nERR_VERSION_MISMATCH=109\nERR_NAME_TOO_LONG=110\nERR_USER_STOP=111\nERR_COMMENT_ABRUPTLY_ENDED=112\nWAR_ENCODING_MISMATCH=113\nERR_RESOURCE_LIMIT=114\nERR_ARGUMENT=115\nERR_SYSTEM=116\nERR_REDECL_PREDEF_ENTITY=117\nERR_INT_SUBSET_NOT_FINISHED=118\nNS_ERR_XML_NAMESPACE=200\nNS_ERR_UNDEFINED_NAMESPACE=201\nNS_ERR_QNAME=202\nNS_ERR_ATTRIBUTE_REDEFINED=203\nNS_ERR_EMPTY=204\nNS_ERR_COLON=205\nDTD_ATTRIBUTE_DEFAULT=500\nDTD_ATTRIBUTE_REDEFINED=501\nDTD_ATTRIBUTE_VALUE=502\nDTD_CONTENT_ERROR=503\nDTD_CONTENT_MODEL=504\nDTD_CONTENT_NOT_DETERMINIST=505\nDTD_DIFFERENT_PREFIX=506\nDTD_ELEM_DEFAULT_NAMESPACE=507\nDTD_ELEM_NAMESPACE=508\nDTD_ELEM_REDEFINED=509\nDTD_EMPTY_NOTATION=510\nDTD_ENTITY_TYPE=511\nDTD_ID_FIXED=512\nDTD_ID_REDEFINED=513\nDTD_ID_SUBSET=514\nDTD_INVALID_CHILD=515\nDTD_INVALID_DEFAULT=516\nDTD_LOAD_ERROR=517\nDTD_MISSING_ATTRIBUTE=518\nDTD_MIXED_CORRUPT=519\nDTD_MULTIPLE_ID=520\nDTD_NO_DOC=521\nDTD_NO_DTD=522\nDTD_NO_ELEM_NAME=523\nDTD_NO_PREFIX=524\nDTD_NO_ROOT=525\nDTD_NOTATION_REDEFINED=526\nDTD_NOTATION_VALUE=527\nDTD_NOT_EMPTY=528\nDTD_NOT_PCDATA=529\nDTD_NOT_STANDALONE=530\nDTD_ROOT_NAME=531\nDTD_STANDALONE_WHITE_SPACE=532\nDTD_UNKNOWN_ATTRIBUTE=533\nDTD_UNKNOWN_ELEM=534\nDTD_UNKNOWN_ENTITY=535\nDTD_UNKNOWN_ID=536\nDTD_UNKNOWN_NOTATION=537\nDTD_STANDALONE_DEFAULTED=538\nDTD_XMLID_VALUE=539\nDTD_XMLID_TYPE=540\nDTD_DUP_TOKEN=541\nHTML_STRUCURE_ERROR=800\nHTML_UNKNOWN_TAG=801\nHTML_INCORRECTLY_OPENED_COMMENT=802\nRNGP_ANYNAME_ATTR_ANCESTOR=1000\nRNGP_ATTR_CONFLICT=1001\nRNGP_ATTRIBUTE_CHILDREN=1002\nRNGP_ATTRIBUTE_CONTENT=1003\nRNGP_ATTRIBUTE_EMPTY=1004\nRNGP_ATTRIBUTE_NOOP=1005\nRNGP_CHOICE_CONTENT=1006\nRNGP_CHOICE_EMPTY=1007\nRNGP_CREATE_FAILURE=1008\nRNGP_DATA_CONTENT=1009\nRNGP_DEF_CHOICE_AND_""INTERLEAVE=1010\nRNGP_DEFINE_CREATE_FAILED=1011\nRNGP_DEFINE_EMPTY=1012\nRNGP_DEFINE_MISSING=1013\nRNGP_DEFINE_NAME_MISSING=1014\nRNGP_ELEM_CONTENT_EMPTY=1015\nRNGP_ELEM_CONTENT_ERROR=1016\nRNGP_ELEMENT_EMPTY=1017\nRNGP_ELEMENT_CONTENT=1018\nRNGP_ELEMENT_NAME=1019\nRNGP_ELEMENT_NO_CONTENT=1020\nRNGP_ELEM_TEXT_CONFLICT=1021\nRNGP_EMPTY=1022\nRNGP_EMPTY_CONSTRUCT=1023\nRNGP_EMPTY_CONTENT=1024\nRNGP_EMPTY_NOT_EMPTY=1025\nRNGP_ERROR_TYPE_LIB=1026\nRNGP_EXCEPT_EMPTY=1027\nRNGP_EXCEPT_MISSING=1028\nRNGP_EXCEPT_MULTIPLE=1029\nRNGP_EXCEPT_NO_CONTENT=1030\nRNGP_EXTERNALREF_EMTPY=1031\nRNGP_EXTERNAL_REF_FAILURE=1032\nRNGP_EXTERNALREF_RECURSE=1033\nRNGP_FORBIDDEN_ATTRIBUTE=1034\nRNGP_FOREIGN_ELEMENT=1035\nRNGP_GRAMMAR_CONTENT=1036\nRNGP_GRAMMAR_EMPTY=1037\nRNGP_GRAMMAR_MISSING=1038\nRNGP_GRAMMAR_NO_START=1039\nRNGP_GROUP_ATTR_CONFLICT=1040\nRNGP_HREF_ERROR=1041\nRNGP_INCLUDE_EMPTY=1042\nRNGP_INCLUDE_FAILURE=1043\nRNGP_INCLUDE_RECURSE=1044\nRNGP_INTERLEAVE_ADD=1045\nRNGP_INTERLEAVE_CREATE_FAILED=1046\nRNGP_INTERLEAVE_EMPTY=1047\nRNGP_INTERLEAVE_NO_CONTENT=1048\nRNGP_INVALID_DEFINE_NAME=1049\nRNGP_INVALID_URI=1050\nRNGP_INVALID_VALUE=1051\nRNGP_MISSING_HREF=1052\nRNGP_NAME_MISSING=1053\nRNGP_NEED_COMBINE=1054\nRNGP_NOTALLOWED_NOT_EMPTY=1055\nRNGP_NSNAME_ATTR_ANCESTOR=1056\nRNGP_NSNAME_NO_NS=1057\nRNGP_PARAM_FORBIDDEN=1058\nRNGP_PARAM_NAME_MISSING=1059\nRNGP_PARENTREF_CREATE_FAILED=1060\nRNGP_PARENTREF_NAME_INVALID=1061\nRNGP_PARENTREF_NO_NAME=1062\nRNGP_PARENTREF_NO_PARENT=1063\nRNGP_PARENTREF_NOT_EMPTY=1064\nRNGP_PARSE_ERROR=1065\nRNGP_PAT_ANYNAME_EXCEPT_ANYNAME=1066\nRNGP_PAT_ATTR_ATTR=1067\nRNGP_PAT_ATTR_ELEM=1068\nRNGP_PAT_DATA_EXCEPT_ATTR=1069\nRNGP_PAT_DATA_EXCEPT_ELEM=1070\nRNGP_PAT_DATA_EXCEPT_EMPTY=1071\nRNGP_PAT_DATA_EXCEPT_GROUP=1072\nRNGP_PAT_DATA_EXCEPT_INTERLEAVE=1073\nRNGP_PAT_DATA_EXCEPT_LIST=1074\nRNGP_PAT_DATA_EXCEPT_ONEMORE=1075\nRNGP_PAT_DATA_EXCEPT_REF=1076\nRNGP_PAT_DATA_EXCEPT_TEXT=1077\nRNGP_PAT_LIST_ATTR=1078\nRNGP_PAT_LIST_ELEM=1079\nRNGP_PAT_LIST_INTER""LEAVE=1080\nRNGP_PAT_LIST_LIST=1081\nRNGP_PAT_LIST_REF=1082\nRNGP_PAT_LIST_TEXT=1083\nRNGP_PAT_NSNAME_EXCEPT_ANYNAME=1084\nRNGP_PAT_NSNAME_EXCEPT_NSNAME=1085\nRNGP_PAT_ONEMORE_GROUP_ATTR=1086\nRNGP_PAT_ONEMORE_INTERLEAVE_ATTR=1087\nRNGP_PAT_START_ATTR=1088\nRNGP_PAT_START_DATA=1089\nRNGP_PAT_START_EMPTY=1090\nRNGP_PAT_START_GROUP=1091\nRNGP_PAT_START_INTERLEAVE=1092\nRNGP_PAT_START_LIST=1093\nRNGP_PAT_START_ONEMORE=1094\nRNGP_PAT_START_TEXT=1095\nRNGP_PAT_START_VALUE=1096\nRNGP_PREFIX_UNDEFINED=1097\nRNGP_REF_CREATE_FAILED=1098\nRNGP_REF_CYCLE=1099\nRNGP_REF_NAME_INVALID=1100\nRNGP_REF_NO_DEF=1101\nRNGP_REF_NO_NAME=1102\nRNGP_REF_NOT_EMPTY=1103\nRNGP_START_CHOICE_AND_INTERLEAVE=1104\nRNGP_START_CONTENT=1105\nRNGP_START_EMPTY=1106\nRNGP_START_MISSING=1107\nRNGP_TEXT_EXPECTED=1108\nRNGP_TEXT_HAS_CHILD=1109\nRNGP_TYPE_MISSING=1110\nRNGP_TYPE_NOT_FOUND=1111\nRNGP_TYPE_VALUE=1112\nRNGP_UNKNOWN_ATTRIBUTE=1113\nRNGP_UNKNOWN_COMBINE=1114\nRNGP_UNKNOWN_CONSTRUCT=1115\nRNGP_UNKNOWN_TYPE_LIB=1116\nRNGP_URI_FRAGMENT=1117\nRNGP_URI_NOT_ABSOLUTE=1118\nRNGP_VALUE_EMPTY=1119\nRNGP_VALUE_NO_CONTENT=1120\nRNGP_XMLNS_NAME=1121\nRNGP_XML_NS=1122\nXPATH_EXPRESSION_OK=1200\nXPATH_NUMBER_ERROR=1201\nXPATH_UNFINISHED_LITERAL_ERROR=1202\nXPATH_START_LITERAL_ERROR=1203\nXPATH_VARIABLE_REF_ERROR=1204\nXPATH_UNDEF_VARIABLE_ERROR=1205\nXPATH_INVALID_PREDICATE_ERROR=1206\nXPATH_EXPR_ERROR=1207\nXPATH_UNCLOSED_ERROR=1208\nXPATH_UNKNOWN_FUNC_ERROR=1209\nXPATH_INVALID_OPERAND=1210\nXPATH_INVALID_TYPE=1211\nXPATH_INVALID_ARITY=1212\nXPATH_INVALID_CTXT_SIZE=1213\nXPATH_INVALID_CTXT_POSITION=1214\nXPATH_MEMORY_ERROR=1215\nXPTR_SYNTAX_ERROR=1216\nXPTR_RESOURCE_ERROR=1217\nXPTR_SUB_RESOURCE_ERROR=1218\nXPATH_UNDEF_PREFIX_ERROR=1219\nXPATH_ENCODING_ERROR=1220\nXPATH_INVALID_CHAR_ERROR=1221\nTREE_INVALID_HEX=1300\nTREE_INVALID_DEC=1301\nTREE_UNTERMINATED_ENTITY=1302\nTREE_NOT_UTF8=1303\nSAVE_NOT_UTF8=1400\nSAVE_CHAR_INVALID=1401\nSAVE_NO_DOCTYPE=1402\nSAVE_UNKNOWN_ENCODING=1403\nREGEXP_COMPILE_ERROR=1450""\nIO_UNKNOWN=1500\nIO_EACCES=1501\nIO_EAGAIN=1502\nIO_EBADF=1503\nIO_EBADMSG=1504\nIO_EBUSY=1505\nIO_ECANCELED=1506\nIO_ECHILD=1507\nIO_EDEADLK=1508\nIO_EDOM=1509\nIO_EEXIST=1510\nIO_EFAULT=1511\nIO_EFBIG=1512\nIO_EINPROGRESS=1513\nIO_EINTR=1514\nIO_EINVAL=1515\nIO_EIO=1516\nIO_EISDIR=1517\nIO_EMFILE=1518\nIO_EMLINK=1519\nIO_EMSGSIZE=1520\nIO_ENAMETOOLONG=1521\nIO_ENFILE=1522\nIO_ENODEV=1523\nIO_ENOENT=1524\nIO_ENOEXEC=1525\nIO_ENOLCK=1526\nIO_ENOMEM=1527\nIO_ENOSPC=1528\nIO_ENOSYS=1529\nIO_ENOTDIR=1530\nIO_ENOTEMPTY=1531\nIO_ENOTSUP=1532\nIO_ENOTTY=1533\nIO_ENXIO=1534\nIO_EPERM=1535\nIO_EPIPE=1536\nIO_ERANGE=1537\nIO_EROFS=1538\nIO_ESPIPE=1539\nIO_ESRCH=1540\nIO_ETIMEDOUT=1541\nIO_EXDEV=1542\nIO_NETWORK_ATTEMPT=1543\nIO_ENCODER=1544\nIO_FLUSH=1545\nIO_WRITE=1546\nIO_NO_INPUT=1547\nIO_BUFFER_FULL=1548\nIO_LOAD_ERROR=1549\nIO_ENOTSOCK=1550\nIO_EISCONN=1551\nIO_ECONNREFUSED=1552\nIO_ENETUNREACH=1553\nIO_EADDRINUSE=1554\nIO_EALREADY=1555\nIO_EAFNOSUPPORT=1556\nIO_UNSUPPORTED_PROTOCOL=1557\nXINCLUDE_RECURSION=1600\nXINCLUDE_PARSE_VALUE=1601\nXINCLUDE_ENTITY_DEF_MISMATCH=1602\nXINCLUDE_NO_HREF=1603\nXINCLUDE_NO_FALLBACK=1604\nXINCLUDE_HREF_URI=1605\nXINCLUDE_TEXT_FRAGMENT=1606\nXINCLUDE_TEXT_DOCUMENT=1607\nXINCLUDE_INVALID_CHAR=1608\nXINCLUDE_BUILD_FAILED=1609\nXINCLUDE_UNKNOWN_ENCODING=1610\nXINCLUDE_MULTIPLE_ROOT=1611\nXINCLUDE_XPTR_FAILED=1612\nXINCLUDE_XPTR_RESULT=1613\nXINCLUDE_INCLUDE_IN_INCLUDE=1614\nXINCLUDE_FALLBACKS_IN_INCLUDE=1615\nXINCLUDE_FALLBACK_NOT_IN_INCLUDE=1616\nXINCLUDE_DEPRECATED_NS=1617\nXINCLUDE_FRAGMENT_ID=1618\nCATALOG_MISSING_ATTR=1650\nCATALOG_ENTRY_BROKEN=1651\nCATALOG_PREFER_VALUE=1652\nCATALOG_NOT_CATALOG=1653\nCATALOG_RECURSION=1654\nSCHEMAP_PREFIX_UNDEFINED=1700\nSCHEMAP_ATTRFORMDEFAULT_VALUE=1701\nSCHEMAP_ATTRGRP_NONAME_NOREF=1702\nSCHEMAP_ATTR_NONAME_NOREF=1703\nSCHEMAP_COMPLEXTYPE_NONAME_NOREF=1704\nSCHEMAP_ELEMFORMDEFAULT_VALUE=1705\nSCHEMAP_ELEM_NONAME_NOREF=1706\nSCHEMAP_EXTENSION_NO_BASE=1707\nSCHEMAP_FACET_NO_VALUE=1708\nSCHEMAP_FA""ILED_BUILD_IMPORT=1709\nSCHEMAP_GROUP_NONAME_NOREF=1710\nSCHEMAP_IMPORT_NAMESPACE_NOT_URI=1711\nSCHEMAP_IMPORT_REDEFINE_NSNAME=1712\nSCHEMAP_IMPORT_SCHEMA_NOT_URI=1713\nSCHEMAP_INVALID_BOOLEAN=1714\nSCHEMAP_INVALID_ENUM=1715\nSCHEMAP_INVALID_FACET=1716\nSCHEMAP_INVALID_FACET_VALUE=1717\nSCHEMAP_INVALID_MAXOCCURS=1718\nSCHEMAP_INVALID_MINOCCURS=1719\nSCHEMAP_INVALID_REF_AND_SUBTYPE=1720\nSCHEMAP_INVALID_WHITE_SPACE=1721\nSCHEMAP_NOATTR_NOREF=1722\nSCHEMAP_NOTATION_NO_NAME=1723\nSCHEMAP_NOTYPE_NOREF=1724\nSCHEMAP_REF_AND_SUBTYPE=1725\nSCHEMAP_RESTRICTION_NONAME_NOREF=1726\nSCHEMAP_SIMPLETYPE_NONAME=1727\nSCHEMAP_TYPE_AND_SUBTYPE=1728\nSCHEMAP_UNKNOWN_ALL_CHILD=1729\nSCHEMAP_UNKNOWN_ANYATTRIBUTE_CHILD=1730\nSCHEMAP_UNKNOWN_ATTR_CHILD=1731\nSCHEMAP_UNKNOWN_ATTRGRP_CHILD=1732\nSCHEMAP_UNKNOWN_ATTRIBUTE_GROUP=1733\nSCHEMAP_UNKNOWN_BASE_TYPE=1734\nSCHEMAP_UNKNOWN_CHOICE_CHILD=1735\nSCHEMAP_UNKNOWN_COMPLEXCONTENT_CHILD=1736\nSCHEMAP_UNKNOWN_COMPLEXTYPE_CHILD=1737\nSCHEMAP_UNKNOWN_ELEM_CHILD=1738\nSCHEMAP_UNKNOWN_EXTENSION_CHILD=1739\nSCHEMAP_UNKNOWN_FACET_CHILD=1740\nSCHEMAP_UNKNOWN_FACET_TYPE=1741\nSCHEMAP_UNKNOWN_GROUP_CHILD=1742\nSCHEMAP_UNKNOWN_IMPORT_CHILD=1743\nSCHEMAP_UNKNOWN_LIST_CHILD=1744\nSCHEMAP_UNKNOWN_NOTATION_CHILD=1745\nSCHEMAP_UNKNOWN_PROCESSCONTENT_CHILD=1746\nSCHEMAP_UNKNOWN_REF=1747\nSCHEMAP_UNKNOWN_RESTRICTION_CHILD=1748\nSCHEMAP_UNKNOWN_SCHEMAS_CHILD=1749\nSCHEMAP_UNKNOWN_SEQUENCE_CHILD=1750\nSCHEMAP_UNKNOWN_SIMPLECONTENT_CHILD=1751\nSCHEMAP_UNKNOWN_SIMPLETYPE_CHILD=1752\nSCHEMAP_UNKNOWN_TYPE=1753\nSCHEMAP_UNKNOWN_UNION_CHILD=1754\nSCHEMAP_ELEM_DEFAULT_FIXED=1755\nSCHEMAP_REGEXP_INVALID=1756\nSCHEMAP_FAILED_LOAD=1757\nSCHEMAP_NOTHING_TO_PARSE=1758\nSCHEMAP_NOROOT=1759\nSCHEMAP_REDEFINED_GROUP=1760\nSCHEMAP_REDEFINED_TYPE=1761\nSCHEMAP_REDEFINED_ELEMENT=1762\nSCHEMAP_REDEFINED_ATTRGROUP=1763\nSCHEMAP_REDEFINED_ATTR=1764\nSCHEMAP_REDEFINED_NOTATION=1765\nSCHEMAP_FAILED_PARSE=1766\nSCHEMAP_UNKNOWN_PREFIX=1767\nSCHEMAP_DEF_AND_PREFIX=1768\nSCHEMAP_UNKNOWN_""INCLUDE_CHILD=1769\nSCHEMAP_INCLUDE_SCHEMA_NOT_URI=1770\nSCHEMAP_INCLUDE_SCHEMA_NO_URI=1771\nSCHEMAP_NOT_SCHEMA=1772\nSCHEMAP_UNKNOWN_MEMBER_TYPE=1773\nSCHEMAP_INVALID_ATTR_USE=1774\nSCHEMAP_RECURSIVE=1775\nSCHEMAP_SUPERNUMEROUS_LIST_ITEM_TYPE=1776\nSCHEMAP_INVALID_ATTR_COMBINATION=1777\nSCHEMAP_INVALID_ATTR_INLINE_COMBINATION=1778\nSCHEMAP_MISSING_SIMPLETYPE_CHILD=1779\nSCHEMAP_INVALID_ATTR_NAME=1780\nSCHEMAP_REF_AND_CONTENT=1781\nSCHEMAP_CT_PROPS_CORRECT_1=1782\nSCHEMAP_CT_PROPS_CORRECT_2=1783\nSCHEMAP_CT_PROPS_CORRECT_3=1784\nSCHEMAP_CT_PROPS_CORRECT_4=1785\nSCHEMAP_CT_PROPS_CORRECT_5=1786\nSCHEMAP_DERIVATION_OK_RESTRICTION_1=1787\nSCHEMAP_DERIVATION_OK_RESTRICTION_2_1_1=1788\nSCHEMAP_DERIVATION_OK_RESTRICTION_2_1_2=1789\nSCHEMAP_DERIVATION_OK_RESTRICTION_2_2=1790\nSCHEMAP_DERIVATION_OK_RESTRICTION_3=1791\nSCHEMAP_WILDCARD_INVALID_NS_MEMBER=1792\nSCHEMAP_INTERSECTION_NOT_EXPRESSIBLE=1793\nSCHEMAP_UNION_NOT_EXPRESSIBLE=1794\nSCHEMAP_SRC_IMPORT_3_1=1795\nSCHEMAP_SRC_IMPORT_3_2=1796\nSCHEMAP_DERIVATION_OK_RESTRICTION_4_1=1797\nSCHEMAP_DERIVATION_OK_RESTRICTION_4_2=1798\nSCHEMAP_DERIVATION_OK_RESTRICTION_4_3=1799\nSCHEMAP_COS_CT_EXTENDS_1_3=1800\nSCHEMAV_NOROOT=1801\nSCHEMAV_UNDECLAREDELEM=1802\nSCHEMAV_NOTTOPLEVEL=1803\nSCHEMAV_MISSING=1804\nSCHEMAV_WRONGELEM=1805\nSCHEMAV_NOTYPE=1806\nSCHEMAV_NOROLLBACK=1807\nSCHEMAV_ISABSTRACT=1808\nSCHEMAV_NOTEMPTY=1809\nSCHEMAV_ELEMCONT=1810\nSCHEMAV_HAVEDEFAULT=1811\nSCHEMAV_NOTNILLABLE=1812\nSCHEMAV_EXTRACONTENT=1813\nSCHEMAV_INVALIDATTR=1814\nSCHEMAV_INVALIDELEM=1815\nSCHEMAV_NOTDETERMINIST=1816\nSCHEMAV_CONSTRUCT=1817\nSCHEMAV_INTERNAL=1818\nSCHEMAV_NOTSIMPLE=1819\nSCHEMAV_ATTRUNKNOWN=1820\nSCHEMAV_ATTRINVALID=1821\nSCHEMAV_VALUE=1822\nSCHEMAV_FACET=1823\nSCHEMAV_CVC_DATATYPE_VALID_1_2_1=1824\nSCHEMAV_CVC_DATATYPE_VALID_1_2_2=1825\nSCHEMAV_CVC_DATATYPE_VALID_1_2_3=1826\nSCHEMAV_CVC_TYPE_3_1_1=1827\nSCHEMAV_CVC_TYPE_3_1_2=1828\nSCHEMAV_CVC_FACET_VALID=1829\nSCHEMAV_CVC_LENGTH_VALID=1830\nSCHEMAV_CVC_MINLENGTH_VALID=1831\nSCHE""MAV_CVC_MAXLENGTH_VALID=1832\nSCHEMAV_CVC_MININCLUSIVE_VALID=1833\nSCHEMAV_CVC_MAXINCLUSIVE_VALID=1834\nSCHEMAV_CVC_MINEXCLUSIVE_VALID=1835\nSCHEMAV_CVC_MAXEXCLUSIVE_VALID=1836\nSCHEMAV_CVC_TOTALDIGITS_VALID=1837\nSCHEMAV_CVC_FRACTIONDIGITS_VALID=1838\nSCHEMAV_CVC_PATTERN_VALID=1839\nSCHEMAV_CVC_ENUMERATION_VALID=1840\nSCHEMAV_CVC_COMPLEX_TYPE_2_1=1841\nSCHEMAV_CVC_COMPLEX_TYPE_2_2=1842\nSCHEMAV_CVC_COMPLEX_TYPE_2_3=1843\nSCHEMAV_CVC_COMPLEX_TYPE_2_4=1844\nSCHEMAV_CVC_ELT_1=1845\nSCHEMAV_CVC_ELT_2=1846\nSCHEMAV_CVC_ELT_3_1=1847\nSCHEMAV_CVC_ELT_3_2_1=1848\nSCHEMAV_CVC_ELT_3_2_2=1849\nSCHEMAV_CVC_ELT_4_1=1850\nSCHEMAV_CVC_ELT_4_2=1851\nSCHEMAV_CVC_ELT_4_3=1852\nSCHEMAV_CVC_ELT_5_1_1=1853\nSCHEMAV_CVC_ELT_5_1_2=1854\nSCHEMAV_CVC_ELT_5_2_1=1855\nSCHEMAV_CVC_ELT_5_2_2_1=1856\nSCHEMAV_CVC_ELT_5_2_2_2_1=1857\nSCHEMAV_CVC_ELT_5_2_2_2_2=1858\nSCHEMAV_CVC_ELT_6=1859\nSCHEMAV_CVC_ELT_7=1860\nSCHEMAV_CVC_ATTRIBUTE_1=1861\nSCHEMAV_CVC_ATTRIBUTE_2=1862\nSCHEMAV_CVC_ATTRIBUTE_3=1863\nSCHEMAV_CVC_ATTRIBUTE_4=1864\nSCHEMAV_CVC_COMPLEX_TYPE_3_1=1865\nSCHEMAV_CVC_COMPLEX_TYPE_3_2_1=1866\nSCHEMAV_CVC_COMPLEX_TYPE_3_2_2=1867\nSCHEMAV_CVC_COMPLEX_TYPE_4=1868\nSCHEMAV_CVC_COMPLEX_TYPE_5_1=1869\nSCHEMAV_CVC_COMPLEX_TYPE_5_2=1870\nSCHEMAV_ELEMENT_CONTENT=1871\nSCHEMAV_DOCUMENT_ELEMENT_MISSING=1872\nSCHEMAV_CVC_COMPLEX_TYPE_1=1873\nSCHEMAV_CVC_AU=1874\nSCHEMAV_CVC_TYPE_1=1875\nSCHEMAV_CVC_TYPE_2=1876\nSCHEMAV_CVC_IDC=1877\nSCHEMAV_CVC_WILDCARD=1878\nSCHEMAV_MISC=1879\nXPTR_UNKNOWN_SCHEME=1900\nXPTR_CHILDSEQ_START=1901\nXPTR_EVAL_FAILED=1902\nXPTR_EXTRA_OBJECTS=1903\nC14N_CREATE_CTXT=1950\nC14N_REQUIRES_UTF8=1951\nC14N_CREATE_STACK=1952\nC14N_INVALID_NODE=1953\nC14N_UNKNOW_NODE=1954\nC14N_RELATIVE_NAMESPACE=1955\nFTP_PASV_ANSWER=2000\nFTP_EPSV_ANSWER=2001\nFTP_ACCNT=2002\nFTP_URL_SYNTAX=2003\nHTTP_URL_SYNTAX=2020\nHTTP_USE_IP=2021\nHTTP_UNKNOWN_HOST=2022\nSCHEMAP_SRC_SIMPLE_TYPE_1=3000\nSCHEMAP_SRC_SIMPLE_TYPE_2=3001\nSCHEMAP_SRC_SIMPLE_TYPE_3=3002\nSCHEMAP_SRC_SIMPLE_TYPE_4=3003\nSCHEMAP_SR""C_RESOLVE=3004\nSCHEMAP_SRC_RESTRICTION_BASE_OR_SIMPLETYPE=3005\nSCHEMAP_SRC_LIST_ITEMTYPE_OR_SIMPLETYPE=3006\nSCHEMAP_SRC_UNION_MEMBERTYPES_OR_SIMPLETYPES=3007\nSCHEMAP_ST_PROPS_CORRECT_1=3008\nSCHEMAP_ST_PROPS_CORRECT_2=3009\nSCHEMAP_ST_PROPS_CORRECT_3=3010\nSCHEMAP_COS_ST_RESTRICTS_1_1=3011\nSCHEMAP_COS_ST_RESTRICTS_1_2=3012\nSCHEMAP_COS_ST_RESTRICTS_1_3_1=3013\nSCHEMAP_COS_ST_RESTRICTS_1_3_2=3014\nSCHEMAP_COS_ST_RESTRICTS_2_1=3015\nSCHEMAP_COS_ST_RESTRICTS_2_3_1_1=3016\nSCHEMAP_COS_ST_RESTRICTS_2_3_1_2=3017\nSCHEMAP_COS_ST_RESTRICTS_2_3_2_1=3018\nSCHEMAP_COS_ST_RESTRICTS_2_3_2_2=3019\nSCHEMAP_COS_ST_RESTRICTS_2_3_2_3=3020\nSCHEMAP_COS_ST_RESTRICTS_2_3_2_4=3021\nSCHEMAP_COS_ST_RESTRICTS_2_3_2_5=3022\nSCHEMAP_COS_ST_RESTRICTS_3_1=3023\nSCHEMAP_COS_ST_RESTRICTS_3_3_1=3024\nSCHEMAP_COS_ST_RESTRICTS_3_3_1_2=3025\nSCHEMAP_COS_ST_RESTRICTS_3_3_2_2=3026\nSCHEMAP_COS_ST_RESTRICTS_3_3_2_1=3027\nSCHEMAP_COS_ST_RESTRICTS_3_3_2_3=3028\nSCHEMAP_COS_ST_RESTRICTS_3_3_2_4=3029\nSCHEMAP_COS_ST_RESTRICTS_3_3_2_5=3030\nSCHEMAP_COS_ST_DERIVED_OK_2_1=3031\nSCHEMAP_COS_ST_DERIVED_OK_2_2=3032\nSCHEMAP_S4S_ELEM_NOT_ALLOWED=3033\nSCHEMAP_S4S_ELEM_MISSING=3034\nSCHEMAP_S4S_ATTR_NOT_ALLOWED=3035\nSCHEMAP_S4S_ATTR_MISSING=3036\nSCHEMAP_S4S_ATTR_INVALID_VALUE=3037\nSCHEMAP_SRC_ELEMENT_1=3038\nSCHEMAP_SRC_ELEMENT_2_1=3039\nSCHEMAP_SRC_ELEMENT_2_2=3040\nSCHEMAP_SRC_ELEMENT_3=3041\nSCHEMAP_P_PROPS_CORRECT_1=3042\nSCHEMAP_P_PROPS_CORRECT_2_1=3043\nSCHEMAP_P_PROPS_CORRECT_2_2=3044\nSCHEMAP_E_PROPS_CORRECT_2=3045\nSCHEMAP_E_PROPS_CORRECT_3=3046\nSCHEMAP_E_PROPS_CORRECT_4=3047\nSCHEMAP_E_PROPS_CORRECT_5=3048\nSCHEMAP_E_PROPS_CORRECT_6=3049\nSCHEMAP_SRC_INCLUDE=3050\nSCHEMAP_SRC_ATTRIBUTE_1=3051\nSCHEMAP_SRC_ATTRIBUTE_2=3052\nSCHEMAP_SRC_ATTRIBUTE_3_1=3053\nSCHEMAP_SRC_ATTRIBUTE_3_2=3054\nSCHEMAP_SRC_ATTRIBUTE_4=3055\nSCHEMAP_NO_XMLNS=3056\nSCHEMAP_NO_XSI=3057\nSCHEMAP_COS_VALID_DEFAULT_1=3058\nSCHEMAP_COS_VALID_DEFAULT_2_1=3059\nSCHEMAP_COS_VALID_DEFAULT_2_2_1=3060\nSCHEMAP_COS_VALID_DEFAULT_2_2_2=""3061\nSCHEMAP_CVC_SIMPLE_TYPE=3062\nSCHEMAP_COS_CT_EXTENDS_1_1=3063\nSCHEMAP_SRC_IMPORT_1_1=3064\nSCHEMAP_SRC_IMPORT_1_2=3065\nSCHEMAP_SRC_IMPORT_2=3066\nSCHEMAP_SRC_IMPORT_2_1=3067\nSCHEMAP_SRC_IMPORT_2_2=3068\nSCHEMAP_INTERNAL=3069\nSCHEMAP_NOT_DETERMINISTIC=3070\nSCHEMAP_SRC_ATTRIBUTE_GROUP_1=3071\nSCHEMAP_SRC_ATTRIBUTE_GROUP_2=3072\nSCHEMAP_SRC_ATTRIBUTE_GROUP_3=3073\nSCHEMAP_MG_PROPS_CORRECT_1=3074\nSCHEMAP_MG_PROPS_CORRECT_2=3075\nSCHEMAP_SRC_CT_1=3076\nSCHEMAP_DERIVATION_OK_RESTRICTION_2_1_3=3077\nSCHEMAP_AU_PROPS_CORRECT_2=3078\nSCHEMAP_A_PROPS_CORRECT_2=3079\nSCHEMAP_C_PROPS_CORRECT=3080\nSCHEMAP_SRC_REDEFINE=3081\nSCHEMAP_SRC_IMPORT=3082\nSCHEMAP_WARN_SKIP_SCHEMA=3083\nSCHEMAP_WARN_UNLOCATED_SCHEMA=3084\nSCHEMAP_WARN_ATTR_REDECL_PROH=3085\nSCHEMAP_WARN_ATTR_POINTLESS_PROH=3086\nSCHEMAP_AG_PROPS_CORRECT=3087\nSCHEMAP_COS_CT_EXTENDS_1_2=3088\nSCHEMAP_AU_PROPS_CORRECT=3089\nSCHEMAP_A_PROPS_CORRECT_3=3090\nSCHEMAP_COS_ALL_LIMITED=3091\nSCHEMATRONV_ASSERT=4000\nSCHEMATRONV_REPORT=4001\nMODULE_OPEN=4900\nMODULE_CLOSE=4901\nCHECK_FOUND_ELEMENT=5000\nCHECK_FOUND_ATTRIBUTE=5001\nCHECK_FOUND_TEXT=5002\nCHECK_FOUND_CDATA=5003\nCHECK_FOUND_ENTITYREF=5004\nCHECK_FOUND_ENTITY=5005\nCHECK_FOUND_PI=5006\nCHECK_FOUND_COMMENT=5007\nCHECK_FOUND_DOCTYPE=5008\nCHECK_FOUND_FRAGMENT=5009\nCHECK_FOUND_NOTATION=5010\nCHECK_UNKNOWN_NODE=5011\nCHECK_ENTITY_TYPE=5012\nCHECK_NO_PARENT=5013\nCHECK_NO_DOC=5014\nCHECK_NO_NAME=5015\nCHECK_NO_ELEM=5016\nCHECK_WRONG_DOC=5017\nCHECK_NO_PREV=5018\nCHECK_WRONG_PREV=5019\nCHECK_NO_NEXT=5020\nCHECK_WRONG_NEXT=5021\nCHECK_NOT_DTD=5022\nCHECK_NOT_ATTR=5023\nCHECK_NOT_ATTR_DECL=5024\nCHECK_NOT_ELEM_DECL=5025\nCHECK_NOT_ENTITY_DECL=5026\nCHECK_NOT_NS_DECL=5027\nCHECK_NO_HREF=5028\nCHECK_WRONG_PARENT=5029\nCHECK_NS_SCOPE=5030\nCHECK_NS_ANCESTOR=5031\nCHECK_NOT_UTF8=5032\nCHECK_NO_DICT=5033\nCHECK_NOT_NCNAME=5034\nCHECK_OUTSIDE_DICT=5035\nCHECK_WRONG_NAME=5036\nCHECK_NAME_NOT_NULL=5037\nI18N_NO_NAME=6000\nI18N_NO_HANDLER=6001\nI18N_EXCESS_HANDLER=6002""\nI18N_CONV_FAILED=6003\nI18N_NO_OUTPUT=6004\nBUF_OVERFLOW=7000\nEither 'xml_data' or 'from_file' must be provided as input<Element ElementTree not initialized, missing rootElement(_tag, attrib=None, nsmap=None, **_extra)\n\n    Element factory, as a class.\n\n    An instance of this class is an object implementing the\n    Element interface.\n\n    >>> element = Element(\"test\")\n    >>> type(element)\n    <class 'lxml.etree._Element'>\n    >>> isinstance(element, Element)\n    True\n    >>> issubclass(_Element, Element)\n    True\n\n    Also look at the `_Element.makeelement()` and\n    `_BaseParser.makeelement()` methods, which provide a faster way to\n    create an Element within a specific document or parser context.\n    Element class is not a type, got Element is not a child of this node.Element is not in this tree.Element is not in this treeEmpty shape tuple for cython.arrayEmpty tag nameEntity class must be subclass of EntityBaseError applying stylesheetError applying stylesheet, line Error during serialisation (out of memory?)Error in xpath expressionError reading 'Error reading file 'Error serialising an XSLT result.\n    Failed to create validation contextFile is already closedFile or filename expected, got 'FunctionNamespace (line 207)FunctionNamespace(ns_uri)\n\n    Retrieve the function namespace object associated with the given\n    URI.\n\n    Creates a new one if it does not yet exist. A function namespace\n    can only be used to register extension functions.\n\n    Usage:\n\n    >>> ns_functions = FunctionNamespace(\"http://schema.org/Movie\")\n\n    >>> @ns_functions  # uses function name\n    ... def add2(x):\n    ...     return x + 2\n\n    >>> @ns_functions(\"add3\")  # uses explicit name\n    ... def add_three(x):\n    ...     return x + 3\n    FunctionNamespace(%r)ID attribute not found.Illegal Unicode kind Illegal document provided: NULLIllegal document provided: expected XML or HTML, found Inconsistent enter action in context managerInco""nsistent exit action in context managerIndex out of bounds (axis %d)Indirect dimensions not supportedInitial indentation level must be >= 0, got Input object has no document: Input object is not an XML element: Internal error in DTD validationInternal error in Relax NG validationInternal error in Schematron validationInternal error in XML Schema validation.Invalid HTML tag name Invalid PI name 'Invalid URL, must not contain '\"' or '>'Invalid attribute dictionary: Invalid attribute name Invalid character reference: 'Invalid character(s) Invalid child type: Invalid entity name 'Invalid entity reference: 'Invalid input object: Invalid input tag of type Invalid mode, expected 'c' or 'fortran', got Invalid namespace URI Invalid namespace prefix Invalid shape in axis Invalid tag nameInvalid tag name Libxml2 RelaxNG error typesLibxml2 error domainsLibxml2 error levelsLibxml2 error types<MemoryView of Method changed outside of context managerNONE=0\nPARSER=1\nTREE=2\nNAMESPACE=3\nDTD=4\nHTML=5\nMEMORY=6\nOUTPUT=7\nIO=8\nFTP=9\nHTTP=10\nXINCLUDE=11\nXPATH=12\nXPOINTER=13\nREGEXP=14\nDATATYPE=15\nSCHEMASP=16\nSCHEMASV=17\nRELAXNGP=18\nRELAXNGV=19\nCATALOG=20\nC14N=21\nXSLT=22\nVALID=23\nCHECK=24\nWRITER=25\nMODULE=26\nI18N=27\nSCHEMATRONV=28\nBUFFER=29\nURI=30\nNONE=0\nWARNING=1\nERROR=2\nFATAL=3\nName not registered.Namespace \"Namespace(%r)No ID dictionary available.No document to serialiseNo tree or file givenNode must not be NoneNon-Element values not supported at this point - got NoneNot yet implemented result node type: Note that Cython is deliberately stricter than PEP-484 and rejects subclasses of builtin types. If you need to pass subclasses then set the 'annotation_typing' directive to False.Only elements can be the root of an ElementTreeOnly processing instructions and comments can be siblings of the root elementOut of bounds on buffer access (axis Output file needs an async .write() methodPI class must be subclass of PIBasePI lacks contentPI text must not contain"" '?>' PUBLIC \"Parameter name too longParameter value too long_ParserSchemaValidationContext not initialisedParsing requires string dataPrefix Prefix format reserved for internal usePrefix too longProxy invalidated!RELAXNG_OK=0\nRELAXNG_ERR_MEMORY=1\nRELAXNG_ERR_TYPE=2\nRELAXNG_ERR_TYPEVAL=3\nRELAXNG_ERR_DUPID=4\nRELAXNG_ERR_TYPECMP=5\nRELAXNG_ERR_NOSTATE=6\nRELAXNG_ERR_NODEFINE=7\nRELAXNG_ERR_LISTEXTRA=8\nRELAXNG_ERR_LISTEMPTY=9\nRELAXNG_ERR_INTERNODATA=10\nRELAXNG_ERR_INTERSEQ=11\nRELAXNG_ERR_INTEREXTRA=12\nRELAXNG_ERR_ELEMNAME=13\nRELAXNG_ERR_ATTRNAME=14\nRELAXNG_ERR_ELEMNONS=15\nRELAXNG_ERR_ATTRNONS=16\nRELAXNG_ERR_ELEMWRONGNS=17\nRELAXNG_ERR_ATTRWRONGNS=18\nRELAXNG_ERR_ELEMEXTRANS=19\nRELAXNG_ERR_ATTREXTRANS=20\nRELAXNG_ERR_ELEMNOTEMPTY=21\nRELAXNG_ERR_NOELEM=22\nRELAXNG_ERR_NOTELEM=23\nRELAXNG_ERR_ATTRVALID=24\nRELAXNG_ERR_CONTENTVALID=25\nRELAXNG_ERR_EXTRACONTENT=26\nRELAXNG_ERR_INVALIDATTR=27\nRELAXNG_ERR_DATAELEM=28\nRELAXNG_ERR_VALELEM=29\nRELAXNG_ERR_LISTELEM=30\nRELAXNG_ERR_DATATYPE=31\nRELAXNG_ERR_VALUE=32\nRELAXNG_ERR_LIST=33\nRELAXNG_ERR_NOGRAMMAR=34\nRELAXNG_ERR_EXTRADATA=35\nRELAXNG_ERR_LACKDATA=36\nRELAXNG_ERR_INTERNAL=37\nRELAXNG_ERR_ELEMWRONG=38\nRELAXNG_ERR_TEXTWRONG=39\nRegistered element classes must be subtypes of ElementBaseRegistered functions must be callable.RelaxNG instance not initialised SYSTEM Schema instance not initialisedSchematron instance not initialisedSerialisation to unicode must not request an XML declarationStep may not be zero (axis %d)Syntax error while parsing an XML document.\n\n    For compatibility with ElementTree 1.3 and later.\n    Syntax error while parsing an XML document.\n    System URL may not contain both single (') and double quotes (\").The 'docstring' option is deprecated. Use 'doctype' instead.The (non-ISO) Schematron feature is deprecated and will be removed from libxml2 and lxml. Use 'lxml.isoschematron' instead.The 'strip_cdata' option of HTMLParser() has never done anything and will eventually be remov""ed.This class cannot be instantiatedThis is not a supported node-set result: This search incorrectly ignores the root element, and will be fixed in a future version.  If you rely on the current behaviour, change it to This type cannot be instantiated from PythonTried to unregister unknown proxyTruth-testing of elements was a source of confusion and will always return True in future versions. Use specific 'len(elem)' or 'elem is not None' test instead.Type 'US-ASCIIUTF-8Unable to convert item to objectUndefined xpath resultUnicode strings with encoding declaration are not supported. Please use bytes input or XML fragments without declaration.Unknown libxml2 version: Unknown node type: Unknown return type: Unknown xpath result Unsupported element type: Unsupported node type: XInclude instance not initialisedXInclude processing failedXInclude processor not initialisedXML declaration already writtenXML (line 3387)XML(text, parser=None, base_url=None)\n\n    Parses an XML document or fragment from a string constant.\n    Returns the root node (or the result returned by a parser target).\n    This function can be used to embed \"XML literals\" in Python code,\n    like in\n\n       >>> root = XML(\"<root><test/></root>\")\n       >>> print(root.tag)\n       root\n\n    To override the parser with a different ``XMLParser`` you can pass it to\n    the ``parser`` keyword argument.\n\n    The ``base_url`` keyword argument allows to set the original base URL of\n    the document to support relative Paths when looking up external entities\n    (DTD, XInclude, ...).\n    XPath context is only usable during the evaluationXPath context not initialisedXPath evaluator locking failedXPath evaluator not initialisedXPath function 'XSLT context not initialisedXSLT stylesheet not initialised{}\n=\"\" \"><\077\077>&.;[]/*{*}*  ': ><=\"</'<!---->(, ?)- :add_noteambiguous reference to embedded stylesheet&amp; and argument must be a byte string or unicode string at 0xattempt to assign sequen""ce of size boolean(//xs:attribute[@default or @fixed][1])cannot add ancestor as sibling, please break cycle firstcannot append, document already has a root elementcannot append parent to itselfcannot append trailing element to complete XML documentcannot assign None' cannot be serialized.cannot parse from 'cannot serialize cannot set a maximum stylesheet traversal depth < 0collections.abc, column comment class must be subclass of CommentBasecompact syntax not supported (please install rnc2rng)<contiguous and direct><contiguous and indirect> default= default_value=disabledocument context is missingdocument-external context nodes are not supporteddouble registering proxy!either filename or external ID requiredelement class must be subclass of ElementBase elemname=empty namespace prefix is not supported in XPathempty prefix is not supported in XPathenableend-nsend tag mismatch (expected error parsing DTD, expected , expected string, CDATA or Elementextension element extensions must have non empty namesextensions must not have empty namespacesfile must be a filename, file-like or path-like object\\g<1>\\g<2>gc (got , got got differing extents in dimension got invalid input value of type &gt; href=\"http://www.w3.org/1999/XSL/Transformhttp://www.w3.org/2001/XMLSchema{http://www.w3.org/XML/1998/namespace}spacehttp://www.w3.org/XML/1998/namespace in public_id.inconsistent exit action in context managerindex out of range: input is not an Elementinternal error (tail)internal error (text)invalid DTD proxy at %sinvalid Document proxy at %sinvalid Element proxy at %sinvalid argument type invalid elementinvalid event name 'invalid node type \" is not declared in scopeisenableditemsize <= 0 for cython.arraykey not found.libxml2 %d.%d.%d, line line list index out of rangelist.index(x): x not in listlist.index(x): x not in slice&lt;lxml.etree was compiled without Schematron support.malformed PI attributesmissing end tagsmissing toplevel elementno content writtenno context nodeno de""fault __reduce__ due to non-trivial __cinit__no element found' not found not foundnot in an elementns%d object> object name= occur= of QName \"\" of name \"only XML documents have declarationsonly setting the 'href' attribute is supported on XSLT-PIsparser locking failedpassing a single string into fromstringlist() is not efficient, use fromstring() insteadpending open tags on closepop expected at most 2 arguments, got  prefix=&quot;reading file objects must return bytes objectsreading from file-like objects must return byte strings or unicode stringsreference to non-existing embedded stylesheetrestructuredtext enresult of class lookup must be subclass of .rnc<!--%s--><?%s?>&%s;\\s+href\\s*=\\s*(?:\\'([^\\']*)\\'|\"([^\"]*)\")%s=%r\\s+(\\w+)\\s*=\\s*(?:\\'([^\\']*)\\'|\"([^\"]*)\")setting default namespace is not supported in XPathsrc/lxml/classlookup.pxisrc/lxml/cleanup.pxisrc/lxml/debug.pxisrc/lxml/docloader.pxisrc/lxml/dtd.pxisrc/lxml/etree.pyxsrc/lxml/extensions.pxisrc/lxml/iterparse.pxisrc/lxml/nsclasses.pxisrc/lxml/parser.pxisrc/lxml/parsertarget.pxisrc/lxml/readonlytree.pxisrc/lxml/relaxng.pxisrc/lxml/saxparser.pxisrc/lxml/serializer.pxisrc/lxml/xmlerror.pxisrc/lxml/xmlid.pxisrc/lxml/xpath.pxisrc/lxml/xslt.pxisrc/lxml/xsltext.pxistart-ns<strided and direct><strided and direct or indirect><strided and indirect><string>string://__STRING__XSLT__///*[string(@id)]text-rootthis element does not have children or attributes to extended slice of size  (type  type=unable to allocate array data.unable to allocate shape and strides.<undecodable error message>unknown encoding: 'unknown errorunknown error unknown output method unsupported XSLT result type: unsupported element type for top-level node: utf-8^\\w+:\\w+$[^\\x20\\x0D\\x0Aa-zA-Z0-9'()+,./:=?;!*#@$_%-]+&#x9;&#xA;&#xD;^(<\\?xml[^>]+)\\s+encoding\\s*=\\s*[\"\\'][^\"\\']*[\"\\'](\\s*\\?>|)<xml>\360\237\244\252</xml>xmlns://xsl:stylesheet[@xml:id = $id].xsltABCASCIIAncestorsIterator_AppendOnlyElementProxy.append_Appe""ndOnlyElementProxy.extend_AsyncDataWriter.close_AsyncDataWriter.write_AsyncFileWriterElement.__aenter___AsyncFileWriterElement.__aexit___AsyncIncrementalFileWriter._close_AsyncIncrementalFileWriter.element_AsyncIncrementalFileWriter.flush_AsyncIncrementalFileWriter.method_AsyncIncrementalFileWriter.write_declaration_AsyncIncrementalFileWriter.write_doctype_AsyncIncrementalFileWriter.write_Attrib_Attrib.__copy___Attrib.__deepcopy___Attrib.clear_Attrib.get_Attrib.has_key_Attrib.items_Attrib.iteritems_Attrib.iterkeys_Attrib.itervalues_Attrib.keys_Attrib.pop_Attrib.update_Attrib.valuesAttributeBasedElementClassLookupBBE_BaseErrorLog_BaseErrorLog.copy_BaseErrorLog.receive_BaseParser.copy_BaseParser.makeelement_BaseParser.set_element_class_lookupBytesIOC14NErrorC14NWriterTargetC14NWriterTarget._iter_namespacesC14NWriterTarget._start.<locals>.<lambda>C14NWriterTarget.closeC14NWriterTarget.commentC14NWriterTarget.dataC14NWriterTarget.endC14NWriterTarget.piC14NWriterTarget.startC14NWriterTarget.start_nsCDATACRITICALCSSSelectorCommentCommentBase_Comment__ContentOnlyElement.append__ContentOnlyElement.get__ContentOnlyElement.insert__ContentOnlyElement.items__ContentOnlyElement.keys__ContentOnlyElement.set__ContentOnlyElement.valuesCustomElementClassLookupCustomElementClassLookup.lookupDEBUGDENY_ALLDENY_WRITEDTD_DTDAttributeDecl.itervalues_DTDAttributeDecl.values_DTDElementDecl.attributes_DTDElementDecl.iterattributesDTDErrorDTDParseErrorDTDValidateErrorDTD.elementsDTD.entitiesDTD.iterelementsDTD.iterentitiesDocInfoDocInfo.clear_DocumentDocumentInvalid_DomainErrorLog_DomainErrorLog.receiveERRORERR_INVALID_CHARERR_UNDECLARED_ENTITYETCompatXMLParserETXPathElementBaseElementChildIteratorElementClassLookupElementDefaultClassLookupElementDepthFirstIterator_ElementIterator_ElementMatchIteratorElementNamespaceClassLookupElementNamespaceClassLookup.get_namespace_ElementTagMatcherElementTextIteratorElementTree_ElementTree_ElementTree.__copy___ElementTree.__deepcopy__ElementTree.__new___E""lementTree._setroot_ElementTree.find_ElementTree.findall_ElementTree.findtext_ElementTree.getelementpath_ElementTree.getiterator_ElementTree.getpath_ElementTree.getroot_ElementTree.iter_ElementTree.iterfind_ElementTree.parse_ElementTree.relaxng_ElementTree.write_ElementTree.write_c14n_ElementTree.xinclude_ElementTree.xmlschema_ElementTree.xpath_ElementTree.xslt_ElementUnicodeResult_ElementUnicodeResult.getparentElement_Element_Element.__copy___Element.__deepcopy__Element.__new___Element.__reversed___Element._init_Element.addnext_Element.addprevious_Element.append_Element.clear_Element.cssselect_Element.extend_Element.find_Element.findall_Element.findtext_Element.get_Element.getchildren_Element.getiterator_Element.getnext_Element.getparent_Element.getprevious_Element.getroottree_Element.index_Element.insert_Element.items_Element.iter_Element.iterancestors_Element.iterchildren_Element.iterdescendants_Element.iterfind_Element.itersiblings_Element.itertext_Element.keys_Element.makeelement_Element.remove_Element.replace_Element.set_Element.values_Element.xpathEllipsisEntityEntityBase_EntityErrorErrorDomainsErrorLevels_ErrorLog_ErrorLog.__exit___ErrorLog.clear_ErrorLog.copy_ErrorLog.receiveErrorTypes_ExsltRegExp.match_ExsltRegExp.replace_ExsltRegExp.testExtensionFATALFallbackElementClassLookupFallbackElementClassLookup.set_fallback_FeedParser_FeedParser.close_FeedParser.feed_FileWriterElement.__enter___FileWriterElement.__exit__FunctionNamespaceGenericGenericAlias_GenericAlias_GlobalErrorLogGzipFileHTMLHTMLParserHTMLParser.__class_getitem__HTMLPullParserHTMLPullParser.read_eventsICONV_COMPILED_VERSION_IDDict_IDDict.copy_IDDict.get_IDDict.has_key_IDDict.items_IDDict.iteritems_IDDict.iterkeys_IDDict.itervalues_IDDict.keys_IDDict.valuesIGNORECASE_ImmutableMapping_ImmutableMapping.__contains___ImmutableMapping.__delitem___ImmutableMapping.__getitem___ImmutableMapping.__iter___ImmutableMapping.__len___ImmutableMapping.__setitem___IncrementalFileWriter.element_IncrementalFileWr""iter.flush_IncrementalFileWriter.method_IncrementalFileWriter.write_IncrementalFileWriter.write_declaration_IncrementalFileWriter.write_doctypeLELIBXML_COMPILED_FEATURESLIBXML_COMPILED_VERSIONLIBXML_FEATURESLIBXML_VERSIONLIBXSLT_COMPILED_VERSIONLIBXSLT_VERSIONLXML_VERSION_ListErrorLog_ListErrorLog.copy_ListErrorLog.filter_domains_ListErrorLog.filter_from_errors_ListErrorLog.filter_from_fatals_ListErrorLog.filter_from_level_ListErrorLog.filter_from_warnings_ListErrorLog.filter_levels_ListErrorLog.filter_types_LogEntryLxmlErrorLxmlRegistryErrorLxmlSyntaxError_MemDebug.blocks_used_MemDebug.bytes_used_MemDebug.dict_size_MethodChanger.__aenter___MethodChanger.__aexit___MethodChanger.__enter___MethodChanger.__exit__MutableMappingNAMESPACENamespaceRegistryError_NamespaceRegistry.__deco_NamespaceRegistry__deco_NamespaceRegistry.clear_NamespaceRegistry.items_NamespaceRegistry.iteritems_NamespaceRegistry.updateNotImplemented_OpaqueDocumentWrapper.append_OpaqueDocumentWrapper.extendOrderedDictPARSERPIPIBaseParseErrorParseError.__init__ParseError.positionParserBasedElementClassLookup_ParserDictionaryContextParserErrorProcessingInstruction_ProcessingInstruction_ProcessingInstruction.getPyErrorLogPyErrorLog.copyPyErrorLog.logPyErrorLog.receivePythonElementClassLookupPythonElementClassLookup.lookup__Pyx_PyDict_NextRefQNameRELAXNGV_ReadOnlyElementProxy.get_ReadOnlyElementProxy.items_ReadOnlyElementProxy.keys_ReadOnlyElementProxy.values_ReadOnlyProxy.__copy___ReadOnlyProxy.__deepcopy___ReadOnlyProxy.getchildren_ReadOnlyProxy.getnext_ReadOnlyProxy.getparent_ReadOnlyProxy.getprevious_ReadOnlyProxy.iterchildrenRelaxNGRelaxNGErrorRelaxNGErrorTypesRelaxNGParseErrorRelaxNGValidateErrorRelaxNG.from_rnc_stringResolver_ResolverRegistry.add_ResolverRegistry.copy_ResolverRegistry.remove_ResolverRegistry.resolveResolver.resolveResolver.resolve_emptyResolver.resolve_fileResolver.resolve_filenameResolver.resolve_string_RotatingErrorLog_RotatingErrorLog.receive_SaxParserTargetSchematronSchematronE""rrorSchematronParseErrorSchematronValidateErrorSequenceSerialisationErrorSiblingsIteratorStringIOSubElementTTAG_TargetParserResult_TargetParserResult.__init__TreeBuilderTreeBuilder.closeTreeBuilder.commentTreeBuilder.dataTreeBuilder.endTreeBuilder.piTreeBuilder.startTypeVarUUNICODEUTF8_Validator_Validator._append_log_message_Validator._clear_error_log_Validator.assert__Validator.assertValid_Validator.validateView.MemoryViewWARNINGWAR_UNDECLARED_ENTITYXIncludeXIncludeErrorXMLXMLDTDIDXMLIDXMLParserXMLParser.__class_getitem__XMLPullParserXMLPullParser.read_eventsXMLSchemaXMLSchemaErrorXMLSchemaParseErrorXMLSchemaValidateErrorXMLSyntaxAssertionErrorXMLSyntaxAssertionError.__init__XMLSyntaxErrorXMLTreeBuilderXPATH_LOCATIONSETXPATH_POINTXPATH_RANGEXPATH_USERSXPathXPathDocumentEvaluatorXPathElementEvaluatorXPathElementEvaluator.register_namespaceXPathElementEvaluator.register_namespacesXPathErrorXPathEvalErrorXPathEvaluator_XPathEvaluatorBaseXPathFunctionErrorXPathResultErrorXPathSyntaxErrorXSLTXSLTAccessControlXSLTApplyErrorXSLTError_XSLTErrorLogXSLTExtensionXSLTExtensionErrorXSLTExtension.apply_templatesXSLTExtension.executeXSLTExtension.process_childrenXSLTParseError_XSLTProcessingInstruction_XSLTProcessingInstruction.parseXSL_XSLTProcessingInstruction.set_XSLTResultTree_XSLTResultTree.write_outputXSLTSaveErrorXSLT.__copy__XSLT.__deepcopy__XSLT.set_global_max_depthXSLT.strparamXSLT.tostring_abcabspath_accepted_domainsaccess_controladdaddnextaddpreviousadopt_external_document__aenter____aexit____all__allocate_bufferalphaanyappend_append_log_messageapply_templatesargsasciiassert_assertValidasync_outfileasyncio.coroutinesattribattribute_defaultsattribute_nameattribute_namesattributesattrs__await__basebase_urlbetablocks_usedbstringbufferedbuild_smart_stringsbytes_usedcc14nc14n2c_attrc_attr_nextc_attrsc_bufferc_childc_compressionc_context_nodec_ctxtc_dictc_docc_dtdc_elementc_encodingc_hrefc_methodc_namec_new_nextc_new_nodec_nextc_nodec_node_copyc_node_nextc_old_nextc_old_nod""ec_old_output_parentc_parentc_pathc_source_docc_standalonec_startc_start_nodec_stopc_versioncanonicalizecapsulecastcatalogcdatachildchildren__class__class_dict_iterable__class_getitem__class_mappingcleanup_namespacesclear_clear_error_logclear_error_logcline_in_tracebackclose_closeclose_fileclscodecodecscollect_idscollectionscollections.abccolumncommentcomment_factorycompactcompilecompressioncompresslevel__contains__contentcontextcontextlibcontextmanagercopy__copy__countcreate_dircssselectctxtddata__decodecodedecompress__deepcopy__defaultdefault_doctypedefault_resolverdefault_value__delitem__devdic__dict__dict_sizediscard_docdoc__doc__doc_ref__docformat__docstringdoctypedomaindomain_namedomainsdtd_validationdtype_is_objectdumpdumpselelemelementelement_configelement_factoryelement_or_treeelement_writer_elementpathelementselements_onlyelemnameemptyenable_regexpencodeencodingendend_nsendswith__enter__entitiesentityentriesentryenumerateenumerationerrorerror_logetreeetree_or_element_etree_or_elementevaluatoreventsexc_contextexc_infoexc_tbexc_typeexc_valexclude_attrsexclude_tagsexclusiveexecute__exit__exprextendextensionsexternal_id_extraffallbackfeedfeed_error_logfilefilelikefilenamefileobjfilter_domainsfilter_from_errorsfilter_from_fatalsfilter_from_levelfilter_from_warningsfilter_levelsfilter_typesfilteredfindfindallfindtextfirst_errorfixedflagsflushfor_htmlformatfortranfrom_filefrom_rnc_stringfromstringfromstringlistftp__func__function_mappingfunction_namefunctionsfunctoolsggetgetLogger_getNameget_default_parserget_namespacegetargspec__getattribute__getchildrengetdefaultencodinggetelementpathgetfilesystemencodinggetfullargspec__getitem__getiteratorgetnextgetparentgetpathgetpreviousgetrootgetroottree__getstate__geturlgetvaluegetwritergroupgroupsgziphas_keyhrefhref_utfhrefshtmlhtmlfilehttphuge_treeiiconvicuidid_nameidrefidrefsimplied__import__inclusiveinclusive_ns_prefixesindentindex__init___init_inputinput_nodeinsertinsert_commentsinsert_pisinspectintint1int2internalint""ersectionio_is_coroutineis_ownedis_standaloneiselementisliceisspaceitemitemsitemsizeiter__iter___iter_namespacesiterancestorsiterattributesiterchildreniterdescendantsiterelementsiterentitiesiterfinditeritemsiterkeysiterparseiterparse.makeelementiterparse.set_element_class_lookupitersiblingsitertextitertoolsitervaluesiterwalkiterwalk.skip_subtreejoinkkeep_ns_prefixeskeep_tailkeykeys_kwkwargsl<lambda>last_error__len__levellevel_namelevelslinelinenoloadload_dtdloadsloglog_entryloggerlogger_namelogginglookuplowerlxmllxml.cssselectlxml.etreelzma__main__makeelementmatchmatchermatchesmax_depthmax_lenmemomemory_debuggermemviewmessage__metaclass__methodmixedmodemodule__module____mro_entries__multnname__name__name_utf_namesnamespacenamespacesndim__new__newnew_docnew_elementnew_namespacesnew_posnextnmtokennmtokensno_networknodenonenotationnsns_cleanns_stackns_urins_utfnsmapobjobjectoccuroffsetoldold_elementold_writeronceopen_open_utf8_fileoptoptionsoros.pathother_elementoutoutfileoutput_fileoutput_parentpack_parentparseparseXSLparse_optionsparseidparserpartialpath_pathpcdatapipi_factorypluspoppositionprecedingprefixprefix_utf__prepare__preservepretty_printprintprocess_childrenprofile_runpropertypublic_id_pyucs4_encoding_name__pyx_capi____pyx_checksum__pyx_state__pyx_type__pyx_unpickle_Enum__pyx_vtable__qname_aware_attrsqname_aware_tags__qualname__rraise_on_errorrbrcloserereadread_eventsread_fileread_networkreceiverecover__reduce____reduce_cython____reduce_ex__regexpregisterregister_namespaceregister_namespacesregistryrelaxngremoveremove_blank_textremove_commentsremove_pisreplacereplacementrequiredresolveresolve_emptyresolve_entitiesresolve_external_entitiesresolve_fileresolve_filenameresolve_stringresolverresolversresultresult_containerresult_docresult_listresult_noderesult_treeresultsreversed__reversed__reversed_nsmaprewrite_prefixesrexprexpcrnc2rngrng_strrootrsplitss_matchschemaschematronsearchselfself_nodesendseqsequence_or_dictsetset_default_parserset_element_class_lookups""et_fallbackset_global_max_depth__set_name__setdefault__setitem___setroot__setstate____setstate_cython__settershapesiosizeskip_subtreesmart_stringssortedsourcespacesplitsplitlinessrcstacklevelstandalonestartstart_nsstartswithstaticmethodstdoutstepstopstore_exceptionstr1str2str3stringstringsstripstrip_attributesstrip_cdatastrip_elementsstrip_tagsstrip_textstrparamstructstrvalstylesubsupersyssystem_urltag_tagtag_namestagstailtargettelltest__test__texttext_or_uri_or_elementthrowtop_nsmaptostringtostringlisttounicodetranslatortreetree_or_elementtypetype_nametypestypingundefinedunicodeunknownunpackupdateupperuriuri_utfurluse_global_python_logutf8vvalidatevaluevaluesvariables_variablesversion__version__wwarnwarningswbwith_commentswith_prefixeswith_tailwritewrite_c14nwrite_declarationwrite_doctypewrite_filewrite_networkwrite_outputwriterxxincludexmlxml_dataxml_declarationxmlfilexmlfile.__aenter__xmlfile.__aexit__xmlfile.__enter__xmlfile.__exit__xmlnsxmlschemaxpathxpath_namexsxsl_xsltxsltxslt_inputzfzlib%25Char out of XML rangeEncoding errorExpected $ for variable referenceForbidden variable\nInvalid context positionInvalid context sizeInvalid expressionInvalid number of argumentsInvalid operandInvalid or incomplete contextInvalid predicateInvalid typeMemory allocation errorMissing closing curly braceNumber encodingPyObject *(PyObject *)\000\000\000PyObject *(PyObject *, PyObject *, xmlNode *)\000\000PyObject *(const xmlChar *)\000PyObject *(const xmlChar *, const xmlChar *)\000PyObject *(struct LxmlElement *, PyObject *, PyObject *)\000PyObject *(struct LxmlElement *, int)\000PyObject *(struct LxmlFallbackElementClassLookup *, struct LxmlDocument *, xmlNode *)\000PyObject *(xmlNode *)\000\000\000PyObject *(xmlNode *, const xmlChar *, const xmlChar *)\000PyObject *(xmlNode *, int)\000PyObject *(xmlNode *, xmlAttr *)\000int (struct LxmlElement *, PyObject *)\000int (struct LxmlElement *, PyObject *, PyObject *)\000int (struct LxmlElement *, struct LxmlElement *)\000int (xmlNo""de *)\000\000\000int (xmlNode *, PyObject *)\000\000int (xmlNode *, const xmlChar *, const xmlChar *)\000\000struct LxmlDocument *(PyObject *)\000struct LxmlElement *(PyObject *)\000struct LxmlElement *(PyObject *, struct LxmlDocument *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *)\000struct LxmlElement *(struct LxmlDocument *, xmlNode *)\000\000struct LxmlElement *(struct LxmlElement *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *)\000struct LxmlElementTree *(struct LxmlElement *)\000struct LxmlElementTree *(struct LxmlElement *, PyObject *)\000struct LxmlElementTree *(xmlDoc *, PyObject *, int)\000void (_element_class_lookup_function, PyObject *)\000void (struct LxmlElement *, struct LxmlElement *)\000void (struct LxmlElementIterator *, struct LxmlElement *)\000void (struct LxmlElementTagMatcher *, PyObject *)\000xmlNode *(xmlNode *)\000\000xmlNode *(xmlNode *, Py_ssize_t)\000\000\000xmlNs *(struct LxmlDocument *, xmlNode *, const xmlChar *, const xmlChar *)\000getNsTag\000getNsTagWithEmptyNs\000utf8\000lookupDefaultElementClass\000lookupNamespaceElementClass\000pyunicode\000namespacedNameFromNsName\000getAttributeValue\000iterattributes\000callLookupFallback\000namespacedName\000tailOf\000textOf\000attributeValueFromNsName\000collectAttributes\000attributeValue\000delAttribute\000setAttributeValue\000appendChildToElement\000hasChild\000hasTail\000hasText\000setNodeText\000setTailText\000delAttributeFromNsName\000tagMatches\000documentOrRaise\000rootNodeOrRaise\000makeElement\000deepcopyNodeToDocument\000elementFactory\000makeSubElement\000elementTreeFactory\000newElementTree\000adoptExternalDocument\000setElementClassLookupFunction\000appendChild\000iteratorStoreNext\000initTagMatch\000nextElement\000previousElement\000findChild\000findChildBackwards\000findChildForwards\000findOrBuildNodeNsPrefixResource errorStack usage errorStart of literalSub resource errorSyntax errorUndefined namespace prefixUndefined variableUnfinished literal""\077\077 Unknown error \077\077\nUnregistered function\n\"?>&.;*--%'(\"[^\"]*\")|('[^']*')({[^}]+})-:file://http://codespeak.net/lxml/objectify/pytypehttp://exslt.org/regular-expressionshttp://purl.org/dc/elements/1.1/http://schemas.xmlsoap.org/wsdl/http://www.w3.org/1999/02/22-rdf-syntax-ns#http://www.w3.org/1999/XSL/Transformhttp://www.w3.org/1999/xhtmlhttp://www.w3.org/2001/XMLSchemahttp://www.w3.org/2001/XMLSchema-instancehttp://www.w3.org/XML/1998/namespace\320\0000\260\001\3604\000\005\013\320\n\032\230!\2301\330\004\016\320\016\036\230a\230q\330\004\007\200t\2101\330\010\t\340\004\016\320\016\036\230h\240a\320'9\270\021\330\004\013\210:\220Q\220a\330\004\007\200w\210k\230\021\330\010\t\340\004\007\200z\220\021\320\022#\2401\340\010\013\2107\220,\230e\2401\330\014\033\2301\230G\240>\3201D\300A\330\010\013\2107\220,\230e\2401\330\014\033\2301\230G\240>\260\036\270q\330\004\023\2201\220E\230\027\240\n\250)\2601\320\0040\260\001\360\020\000\t'\240a\360\006\000\t*\250\021\360\006\000\t\014\2104\210\177\230g\240Q\330\014\022\220$\220n\240A\340\014\022\220!\330\010\013\2104\210s\220!\330\014\022\220$\220a\330\014\017\210t\2203\220a\330\020\026\220m\2401\240A\330\010\030\230\014\240C\240q\330\014#\2401\240L\260\004\260F\270!\330\010\021\320\021&\240a\240v\250]\270,\300o\320UV\320Vf\320fg\330\010\013\2107\220#\220Q\330\021\022\330\020\030\320\030)\250\021\250*\260C\260y\300\004\300F\310!\330\020\035\320\0352\260!\2601\340\014\024\320\024%\240Q\240j\260\003\2609\270D\300\006\300a\330\014\031\320\031.\250a\250q\330\010\013\2107\220'\230\021\330\014\022\220-\320\0370\260\001\330\010\013\2102\210R\210r\220\023\220G\2304\230q\330\022%\240Q\240a\320\000\026\320\0260\260\001\360\032\000\005\033\230!\330\004\007\200z\220\021\320\022$\240A\330\010\014\210O\230>\320)9\270\026\270q\330\014\025\220R\220t\230?\250'\260\021\260(\270!\340\010\013\320\013\034\230C\230q\330\014\037\230r\240\025\240d\250(\260#\260Q\260a\330!$\240D\250\004\250K\260q\270\001\330\010\014\320\014\035\230Q""\330\014\025\220R\220t\320\033-\250W\260A\260X\270Q\330\004\013\2101\320\0041\3201K\3101\330\0378\270\001\360*\000\t\r\210O\2301\330\010\030\230\001\230\024\230Q\330\010\013\210<\220s\230%\230s\240,\250b\260\001\330\014\032\230!\340\010\027\220q\230\006\230d\320\"2\260+\270Q\330\030%\240Q\320\000\021\220\037\240\001\360\"\000\005\014\320\013\033\2301\230A\330\004\007\200v\210R\210q\330\010\016\210j\230\001\320\031G\300q\310\001\330\004\007\200y\220\001\220\024\220Q\330\010\020\220\005\220Q\220a\330\010\021\220\026\220r\230\026\230r\240\021\330\010\030\230\001\230\024\230Z\240s\250'\260\021\260(\270'\300\022\3001\200\001\360\022\000\005\014\2101\210H\220A\320\025'\240x\250q\320\004'\240|\2601\360\n\000\t\020\210|\2301\230F\240&\250\006\250f\260F\270!\330\034$\240G\2501\320\000\023\320\023#\2401\360\032\000\005\014\2103\210a\210v\220X\230Y\240a\340\004\007\200t\2105\220\007\220u\230C\230q\330\010\017\210v\220Q\340\010\017\210v\220W\230A\230Q\320\004\037\320\0371\260\021\360\n\000\t\024\2204\220|\2401\330\010\013\2104\210w\220e\2304\230t\2403\240a\330\014\027\220r\230\023\230D\240\006\240i\250s\260\"\260E\270\023\270A\330\010\013\2101\330\014\027\220x\230t\2401\330\010\017\210t\2201\220A\320\004)\320):\270!\330\034\035\360\n\000\t\025\320\024)\250\021\250&\260\013\2701\330*5\260Q\330*8\270\001\330\010\017\210y\230\001\230\031\240!\320\000\025\320\0251\260\021\360\034\000\005\006\330\010\016\320\016\"\240!\2406\250\032\2601\330\010\017\210s\220(\230!\330\004\013\320\013\"\240!\330\010\017\320\017\037\230q\320\004'\240|\2601\360\n\000\t\r\210H\220L\240\001\330\014\022\220'\230\026\230v\240X\250Q\320\004#\2401\360\030\000\t\031\230\001\230\021\330\010\021\220\024\220Q\340\010\023\2201\220F\230!\330\010\013\2104\210q\330\014\027\220q\230\006\230a\340\010\021\220\026\220q\330\010\013\2101\330\014\022\220.\240\001\330\020 \240\001\240\021\340\010\021\220\026\220q\330\010\013\2107\220$\220d\230*\240A\240Q\330\014\025\220\\\240\021\240!\330\010\016\210g\220W\230A\330\014\032""\230,\240a\240q\330\014\027\220q\230\004\230G\2401\330\014\025\220Q\320\004'\240|\2601\360\n\000\t\030\220q\230\004\230A\330\010\017\210|\2301\230F\240&\250\004\250G\2606\270\026\270q\330\034$\240G\2501\200\017\320\017+\2501\360\036\000\005\010\200w\210c\220\021\330\010\021\320\021(\320(9\270\021\330\010\013\2104\210z\230\021\230(\240!\330\014\025\220Q\330\004\005\330\010\016\320\016\"\240!\2406\250\032\2601\330\010\017\210s\220(\230!\330\004\013\320\013\"\240!\330\010\017\320\017\037\230q\320\000\"\240.\260\001\330\016#\2401\360,\000\005\010\200z\220\021\320\022#\2401\330\010\017\210y\230\001\230\032\320#4\260I\270Y\300a\330\032\035\230S\240\016\250l\270!\330\t\023\2201\320\024%\240Q\330\010\017\210y\230\002\230.\320(8\270\001\330\031\"\240)\2508\2603\260c\270\021\330\031%\240Q\340\010\016\210k\230\030\240\021\240$\240a\240q\200\001\3602\000\005\013\320\n\032\230!\2301\330\004\016\320\016\036\230a\230q\330\004\007\200t\2101\330\010\t\340\004\016\320\016\036\230h\240a\320'9\270\021\330\004\013\210:\220Q\220a\330\004\007\200w\210k\230\021\330\010\t\340\004\007\200z\220\021\320\022#\2401\340\010\013\2107\220,\230e\2401\330\014\033\2301\230G\240>\3201D\300A\330\010\013\2107\220,\230e\2401\330\014\033\2301\230G\240>\260\036\270q\330\004\017\210q\220\005\220W\230J\240a\320\004\033\320\0332\260!\360\026\000\t\014\2104\210w\220a\330\014\025\220Q\330\010\017\320\017\"\240!\2406\250\026\250z\270\021\200\001\340\004\013\320\013\"\320\"3\2601\320\0043\3203D\300A\360\034\000\t\n\330\014\r\210Q\330\017\020\330\014\022\220+\230Q\330\010\022\220.\240\001\330\010\017\210y\230\001\330\010\013\2109\220G\2301\330\014\023\220=\240\017\250q\260\001\340\014\023\220=\320 3\2601\260A\330\010\017\210\177\230a\330\010\017\210y\230\001\330\010\017\210q\320\000\020\320\020 \240\001\360\024\000\005\006\330\004\007\320\007\033\2303\230a\330\010\036\230e\2401\240A\360\006\000\005\014\2103\210a\210v\220X\230Y\240a\330\004\n\210!\330\004\010\210\010\320\020#\2401\240A\330\010\013\2101\210D\220\004""\220A\220Y\230a\330\004\013\2106\220\021\320\0044\260A\330\010\r\210Q\210m\2305\240\t\250\021\250!\330\010\014\210I\220T\230\033\240F\250'\260\022\2601\330\010\014\210H\220A\330\010\014\210L\230\001\320\004 \240\001\360\020\000\t\014\2104\210y\230\004\230D\240\004\240H\250A\330\014\023\2201\330\010\013\2104\210w\220a\330\014\025\220Q\330\010\017\320\017 \240\001\240\026\240q\320\004\"\240!\360\022\000\t\014\2104\210y\230\004\230D\240\004\240H\250A\330\014\023\2201\330\010\013\2104\210w\220a\330\014\025\220Q\330\010\017\320\017(\250\001\250\026\250v\260Z\270q\320\004\037\320\0375\260Q\360\022\000\t\014\2104\210y\230\004\230D\240\004\240H\250A\330\014\023\2201\330\010\013\2104\210w\220a\330\014\025\220Q\330\010\017\320\017#\2401\240F\250&\260\t\270\021\230\n\240!\2406\250\021\250%\250q\320\004\037\320\0376\260a\360\034\000\t\014\2101\330\014\017\210t\2209\230D\240\004\240D\250\010\260\001\330\020\027\220q\330\r\021\220\031\230$\230d\240$\240h\250a\330\014\023\2201\330\010\013\2104\210w\220a\330\014\025\220Q\330\010\017\320\017\037\230q\240\006\240f\250J\260a\320\004%\320%6\260a\360\024\000\t\r\210O\2301\330\010\017\210t\2208\2301\330\010\013\2109\220A\220Q\330\014\017\210t\2202\220S\230\003\2301\330\020\027\220t\2302\230Q\330\020\025\320\025%\240Q\330\020\024\220A\330\024\025\340./\250q\330\024#\240;\250a\340\010\017\210t\2209\230A\230V\2409\250A\320\004%\320%6\260a\360\022\000\t\014\210:\220Q\220f\230A\330\014\024\220G\2305\240\001\330\010\017\210|\2309\240A\240V\2506\260\031\270,\300n\320TX\320Xg\320gh\320hi\320\004\025\320\025/\250{\270!\360\030\000\t\014\2108\2207\230!\330\014\023\2207\230!\330\r\022\220'\230\021\330\014\r\330\020\026\220n\240A\240V\2508\2601\330\014\023\320\023*\250!\330\020\027\320\027'\240q\340\014\024\220J\230a\330\014\022\320\022\"\240!\2407\250!\340\010\017\320\017\"\240!\2405\250\001\320\000(\320(8\270\001\360\034\000\005\017\320\016\036\230a\230q\330\004\020\220\007\220q\340\004\007\200q\330\010\016\210g\220Q\340\010\032\230!\230;\240e""\2506\260\021\330\010\032\230!\2305\240\t\250\026\250q\340\004\005\330\010\013\2101\210A\210U\220!\2208\2304\230z\250\021\330\013!\240\021\340\004&\240a\240{\260!\320\004(\320(9\270\036\300q\360\n\000\t\020\210t\2208\2307\240!\360\006\000\t\014\2104\210y\230\003\2301\330\014\022\220/\240\021\240!\330\010\013\2104\210y\230\003\2301\330\014\022\220/\240\021\240!\330\010\022\220+\230Q\230a\330\010\024\220F\230!\230<\240x\250w\260j\300\001\330\010\022\220+\230Q\230a\330\010\013\210;\220c\230\021\330\014\034\230A\340\014\033\2305\320 0\260\001\330\010!\240\021\240$\240i\250{\270$\270n\310A\330\010\013\2108\2207\230!\330\014\031\230\021\230$\230i\240v\250Q\250a\330\014\020\220\013\2301\340\014\020\220\013\2301\330\010\013\2104\210t\2201\330\020%\240Q\240d\250!\330\010\014\210N\230!\2304\230w\240a\320\000(\320(9\270\021\330\023 \240\001\360\034\000\005\010\200z\220\021\320\022$\240A\330\010\017\320\017%\240Q\330\014\036\230k\250\021\330\014\027\220|\2407\250(\260.\300\001\340\010\017\320\017$\240A\330\014\036\230k\250\021\330\014\027\220|\2407\250(\260.\300\001\200A\3604\000\t\035\230D\320 0\260\013\2701\340\010\013\210:\220Q\220f\230A\330\014\017\210t\320\023&\240c\250\021\330\020\035\230Q\340\020\035\230T\240\021\330\014\030\230\005\230Q\230a\330\014\"\320\"3\2601\260A\330\014\025\220Q\330\r\027\220q\230\006\230a\330\014\031\230\021\330\014\030\230\001\330\014\034\230C\230q\240\n\250!\330\014\025\220Q\340\014\022\220+\230Q\340\010\022\220$\320\026,\250A\330\010\020\220\007\220q\330\010\020\220\001\330\010\013\2104\210t\2201\330\014\023\2208\320\0330\260\001\330\014\020\320\020(\250\001\330\014\032\230%\230q\240\004\240A\330\035!\240\033\250G\260:\270Q\360\014\000\r\032\230\021\330\014\017\210z\230\027\240\001\330\020\035\230U\240.\260\002\260'\270\025\270a\330\014\032\320\0323\2601\330\014\017\210t\2201\330\020\030\320\030*\250!\330\024\033\230;\240l\260,\270a\330\024\030\230\001\340\031+\2501\250G\2604\260q\330\020!\320!2\260!\330\024\033\230;\240l\260,\270a\330\014""\"\240!\2401\330\014\035\230Q\330\014\031\230\021\330\014\017\210q\330\020\021\330\014#\240?\260!\2601\360\010\000\t\027\220a\330\010\016\210n\230B\230b\240\005\240V\2503\250b\260\003\2601\330\014\017\210z\230\023\230A\340\020\036\230a\330\020\033\230:\240U\250!\2509\260F\270!\270;\300g\310Q\310a\330\020\032\230!\330\020!\240\021\330\020\027\220~\320%6\260a\260w\270n\310I\320U[\320[^\320^_\320_`\360\006\000\021\036\230U\320\"3\260>\300\031\320J^\320^_\330\020\027\220~\320%6\260a\260w\270k\310\021\330\020!\240\021\330\020\035\230Q\340\014\017\210q\330\020\027\320\027'\240q\250\013\2601\340\014\017\210w\220l\240!\340\020\032\230!\330\020\030\230\001\330\020\021\340\014\017\210v\220T\230\024\230U\320\"3\2604\260t\2705\300\001\340\020\024\220I\230W\240K\320/B\300!\330\024\027\220u\230F\240#\240Z\320/F\300a\330\033 \240\006\240c\250\032\2601\330\030\031\340\024\034\230A\340\010\013\2104\210u\220L\240\r\320->\270a\270w\300d\310'\320Q]\320]^\340\014\026\220a\330\014\024\220A\340\010\013\210<\220s\230$\230h\240e\2506\260\023\260D\270\005\270Q\330\014\020\320\020(\250\001\330\014\r\330\020\027\320\027*\250!\2506\260\025\260h\270a\340\020\027\220x\230q\320\004\034\230A\360\020\000\t\031\230\001\230\021\330\010\030\230\001\230\021\330\010\021\220\032\2301\230D\240\n\250!\330\010\013\2107\220#\220Q\330\014\030\230\001\230\026\230q\330\014\r\340\010\013\320\013\034\230A\230W\240J\250d\260!\330\014\022\220*\230A\230Q\330\010\027\220w\230h\240a\330\010\021\220\027\230\010\240\001\330\014\036\230a\230x\240w\250a\330\010\021\220\021\220(\230'\240\021\330\010\032\230!\2304\230w\240n\260G\2701\200A\340\010\017\320\017#\2401\240F\250)\2601\200A\360\014\000\t\024\2201\220F\230$\230i\240u\250C\250u\260G\2703\270a\330\010\017\210}\230A\230Z\240v\250Q\200A\330\010\033\2301\330\010\013\2104\210x\220s\230!\330\014\020\220\n\230$\230m\2501\330\010\014\210H\220D\230\001\330\014\032\320\032+\2501\250F\260!\330\022\034\230A\230Q\330\014\022\220'\230\021\230!\330\010\017\210q\320\004,\250A\360""\024\000\t\016\320\r#\2401\330\010\017\210{\230!\2306\240\033\250K\260q\270\001\200A\360\016\000\t\014\2101\330\014\025\220U\230!\2301\340\014\025\220Q\330\010\t\330\014\023\2204\320\027-\250Q\250a\330\017\020\330\014\027\220t\320\0331\260\021\260!\330\027.\250a\250q\330\014\023\2201\200A\200A\360\016\000\t\024\220=\240\001\200A\330\010\013\2103\210a\210y\230\002\230!\330\014\022\220+\320\035E\300Q\300c\310\021\310(\320RS\320ST\330\010\030\230\001\230\024\230Q\330\010\021\320\021#\2401\240D\250\013\2605\270\001\330\010\013\2107\220#\220Q\330\014\017\210t\2201\330\020\026\220j\240\001\330\014\025\220W\230A\230Q\340\014\031\230\021\230$\230k\250\021\330\010\017\210q\200A\360\016\000\t\014\2104\210}\230C\230q\330\014\020\220\017\230q\200A\330\010\013\2104\210~\230S\240\005\240T\250\025\250g\260[\300\001\330\014\020\320\020 \240\001\330\010\014\210I\220W\230A\230Q\200A\330\010\013\2104\210~\230S\240\005\240T\250\025\250g\260[\300\001\330\014\020\320\020 \240\001\330\010\014\210I\220W\230A\230Q\340\010\013\2103\210a\210t\220;\230b\240\004\240A\330\014\020\220\014\230A\330\014\017\210t\2209\230B\230d\240*\250C\250q\330\020\031\230\024\230Q\330\020\024\220K\230q\330\020\024\220D\230\t\240\022\2401\200A\360\010\000\t\014\2104\210\177\230g\240Q\330\014\023\2204\220~\240Y\250a\330\014\023\2205\230\007\230q\330\014\034\230A\230Q\330\014#\2401\240D\250\016\260j\300\004\300A\330\014\023\320\023&\240a\240v\250Q\330\r\021\220\026\220w\230a\330\014\033\2301\230D\240\001\330\014\030\230\013\2401\240D\250\005\250Y\260a\330\014\017\210v\220S\230\001\330\020\021\330\014\022\320\022\"\240!\2407\250$\250e\2601\330\014\023\320\023&\240a\240u\250A\360\006\000\r\024\2201\200A\360\036\000\t\031\230\001\230\021\330\010\013\2104\210\177\230g\240Q\330\014\023\2204\220q\330\014\022\220$\220a\330\r\021\220\026\220w\230a\330\014\022\220$\220a\330\014\023\2203\220h\230a\340\014\022\220,\230a\330\010\027\220q\230\001\330\010\030\230\001\230\021\330\010\013\2107\220&\230\007\230q\330\014\022\220,""\230a\340\010\020\220\014\230A\230S\240\t\250\024\250Q\330\010\025\220_\240A\240W\250A\330\010\027\220q\230\003\2309\240A\330\010\013\2107\220#\220Q\330\014\r\330\010\017\210x\220q\230\001\330\014\024\220A\220Q\330\010\017\210q\200A\330\010\013\2104\210\177\230g\240U\250!\330\020\024\320\024$\240C\240t\2503\250d\260!\330\014\020\320\020#\2401\330\014\r\330\010\013\2104\210q\330\014\020\220\007\220q\340\010\031\230\021\330\010\014\320\014\037\230w\240a\240q\340\010\013\2104\320\017\"\240'\250\025\250d\260$\260c\270\024\270Q\340\014\020\320\020#\2405\250\007\250q\330\014\r\330\010\014\210G\2201\220E\230\027\240\001\200A\330\010\013\2104\210q\330\014\020\320\020#\2401\330\014\r\330\010\013\2104\210q\330\014\020\220\007\220q\330\010\014\210G\2201\220D\230\001\230\024\230W\240A\240T\250\021\250!\330\010\014\320\014\034\230D\240\001\330\010\014\210N\230#\230Q\230d\320\"4\260C\260q\330\010\014\320\014\037\230t\2401\330\010\014\210J\220d\230!\200A\330\010\013\2104\210q\330\014\r\340\010\013\2104\210q\330\014\020\220\007\220q\330\010\014\210J\220b\230\002\230'\240\022\2405\250\001\200A\330\010\013\2104\210q\330\014\r\330\010\013\2104\210q\330\014\020\220\007\220q\230\001\330\r\021\220\034\230T\240\024\240Q\330\014\020\220\007\220q\330\010\014\210G\2201\330\014\020\220\001\220\030\230\021\320\032,\250A\250]\270*\300D\310\001\310\021\330\010\013\2104\210t\2201\330\014\020\220\007\220q\230\001\200A\360\014\000\t\014\2104\210q\330\014\022\320\022)\250\021\250!\340\010\013\2104\210w\220c\230\021\330\014\022\320\022)\250\021\250!\330\010\017\210t\2201\200A\330\010\013\2104\210q\330\014\022\220/\240\021\240!\330\010\013\2104\210x\220y\240\003\2404\240q\330\014\022\220/\240\021\240!\330\010\014\210H\220K\230t\2401\330\010\014\210K\220q\200A\330\010\013\2104\210q\330\014\022\220/\240\021\240!\330\010\014\210H\220K\230t\2401\330\010\014\210L\230\001\200A\360\014\000\t\014\2104\210s\220!\330\014\022\220!\330\020\021\330\010\013\2106\220\023\220A\330\014\025\220Q\330\r\021\220\023\220F""\230#\230T\240\023\240A\330\014\022\220,\230a\340\014\025\220Y\230a\230q\330\010\017\210t\2202\220T\230\021\330\010\013\210=\230\001\230\021\330\014\020\220\010\320\030(\250\001\250\030\260\021\340\014\020\220\010\230\005\230R\230q\200A\360\n\000\t\014\2104\210t\2201\220A\330\014\022\320\022\"\240$\240k\3201H\310\001\330\020\021\200A\360\n\000\t\014\2104\210t\2201\220A\330\014\022\220/\240\021\240$\240k\3201H\310\001\330\024\025\330\"&\240a\200A\330\010\013\2104\210t\2201\330\014\r\330\010\013\2104\210q\330\014\r\330\010\013\2104\210q\330\014\020\220\007\220q\230\001\330\r\021\220\034\230T\240\024\240Q\330\014\020\220\007\220q\330\010\014\210G\2201\220F\230!\320\033-\250Q\250a\330\010\013\2104\210t\2201\330\014\020\220\007\220q\230\001\200A\360\026\000\t\014\2104\210t\2201\330\014\022\220.\240\001\240\021\330)B\300#\300Q\330!%\240Q\340\010\022\220$\320\026,\250A\330\010\020\220\007\220q\340\010\014\320\014$\240A\330\010\013\2104\210q\330\026%\240Q\240g\250V\2603\260a\340\025#\2401\240G\2506\260\023\260A\340\010\014\210E\220\032\2304\230}\320,=\270Q\270g\300Q\330\020\032\230!\2309\240A\340\r \240\010\250\014\260A\340\010\t\330\014\025\220W\320\034/\250q\260\006\260e\2708\3001\340\014\023\2208\2301\340\010\013\210:\220Q\220h\230a\330\014\024\220K\230w\240h\250a\340\014\023\2201\200A\330\010\013\2104\210t\2201\330\014\020\220\006\220g\230Q\230a\200A\330\010\013\2104\210w\220c\230\021\330\014\020\220\t\230\024\230\\\250\021\330\010\017\210t\2206\230\021\200A\330\010\017\320\017\"\240!\2404\240w\250d\260!\200A\330\010\013\2104\210x\220s\230!\330\014\020\220\n\230$\230m\2501\330\010\017\210t\2201\220D\230\001\200A\330\010\013\2104\210x\220s\230!\330\014\020\220\n\230$\230m\2501\330\010\017\210t\2207\230!\200A\360\n\000\t\031\230\001\230\021\330\010\013\2104\210x\220v\230W\240A\330\014\022\220+\230Q\330\010\014\320\014\035\230Q\330\010\014\210H\220A\200A\330\010\013\2104\210x\220w\230a\330\014\030\230\004\230J\240d\250)\2601\330\014\035\230Y\240c\250\021\330\014\026\220g""\230Q\230a\330\014\017\210t\2201\330\020\024\220O\2401\200A\360\024\000\t\031\230\001\230\021\330\010\030\230\001\230\021\330\010\013\2104\210x\220x\230s\240%\240t\2504\250z\270\021\270$\270h\300a\330\014\017\210w\220h\230f\240G\2501\330\020\023\2207\230(\240&\250\007\250q\330\024\032\230+\240Q\330\014\023\2208\2301\330\010\027\220q\230\006\230a\200A\360\024\000\t\031\230\001\230\021\330\010\030\230\001\230\021\330\010\013\2104\210x\220x\230s\240%\240t\2504\250z\270\021\270$\270h\300a\330\014\017\210w\220h\230f\240L\3200B\300!\330\020\026\220k\240\021\330\014\023\2208\2301\330\010\026\220a\220v\230Q\200A\360\n\000\t\014\2104\210y\230\003\2301\330\014\023\2201\330\010\020\220\014\230A\230T\240\030\250\026\250t\2601\330\010\022\320\022\"\240!\2407\250!\330\010\017\210w\220h\230a\330\010\013\2105\220\007\220q\330\014\023\2201\340\010\021\220\025\220a\330\010\016\210g\220W\230E\240\024\240V\2506\260\023\260D\270\010\300\001\330\014\025\220V\2301\330\010\013\2107\220#\220Q\330\014\023\2201\330\010\017\210\177\230a\230y\250\001\200A\330\010\013\2105\220\010\230\003\2304\230q\330\025\035\230Q\230f\240A\200A\360\022\000\t\031\230\001\230\021\330\010\030\230\001\230\021\330\010\021\220\027\230\001\330\010\013\2106\220\030\230\027\240\004\240A\330\014\022\220,\230a\330\010\021\220\027\230\010\240\001\330\014\032\230!\2301\330\010\021\220\021\220(\230!\340\010\032\230!\2304\230w\240f\250F\260!\200A\360\016\000\t\031\230\001\230\021\330\010\032\230!\2306\240\025\240a\320\000$\320$<\270A\360\014\000\005\013\210(\220!\2206\230\035\240n\260J\270k\310\031\320RS\330\004\007\200t\2101\330\010\017\210q\330\004\007\200w\210f\220A\220Q\200A\360\030\000\t\014\2107\220!\320\023(\250\001\330\014\"\320\"5\260V\2701\330\010\014\210F\220(\230!\330\014\020\220\005\220S\230\005\230S\240\004\240B\240c\250\023\250E\260\024\260X\270Q\270a\330\020\024\220A\220X\230Q\200A\360\034\000\t\031\230\001\230\021\330\010\013\2107\220(\230&\240\007\240q\330\014\022\220,\230a\330\010\013\2104\210\177\230g""\240Q\330\014\023\2204\220q\330\r\021\220\026\220w\230a\330\014\023\2204\220u\230H\240A\340\014\022\220,\230a\330\010\030\230\001\230\021\330\010\013\2107\220&\230\007\230t\2401\330\014\022\220,\230a\340\010\017\210q\330\010\024\220G\2301\330\010\016\210j\230\007\230t\2401\330\014\025\220Y\230a\330\014\025\220V\2301\230A\330\014\022\320\022+\2501\250H\260A\330\014\017\210w\220c\230\021\330\020\031\320\031)\250\021\340\014\024\220A\330\014\025\220Y\230a\330\014\022\220'\230\027\240\001\330\020\023\2206\230\026\230w\240a\330\024\027\220{\240!\2408\2508\2601\330\030!\240\021\330\020\031\230\026\230q\330\014\017\210q\330\020\026\220b\230\001\230\025\230a\230u\240A\240Q\360\006\000\021\032\230\031\240!\330\020\026\220g\230W\240A\330\024\027\220v\230V\2407\250!\330\030\033\230;\240a\240x\250x\260q\330\034#\2401\330\034\035\330\024\035\230V\2401\340\014\020\220\007\220q\230\001\330\014\030\230\t\240\021\330\014\017\210z\230\023\230E\240\023\240I\250V\2607\270!\330\020\026\220l\240!\330\010\013\2104\210q\330\014\023\2201\330\010\014\210H\220A\330\010\017\210s\220%\220q\230\001\200\001\330\017\034\230A\360\014\000\005\014\210?\230!\2309\240F\250&\260\006\260h\270g\300Q\200A\340\010\014\320\014\034\230A\200A\330\010\017\210}\230A\230T\240\037\260\004\260A\200A\360\n\000\t\031\230\001\230\021\330\010\020\220\014\230A\230T\240\025\240i\250t\2601\330\010\022\320\022\"\240!\2407\250$\250e\2601\330\010\017\210w\220h\230a\330\010\013\2105\220\007\220q\330\014\023\2201\340\010\021\220\025\220a\330\010\016\210g\220W\230E\240\024\240V\2506\260\023\260D\270\010\300\001\330\014\025\220V\2301\330\010\013\2107\220#\220Q\330\014\023\2201\330\010\017\210\177\230a\230y\250\001\200A\360\006\000\t\020\210}\230A\230T\240\026\240q\200A\330\010\017\210}\230A\230U\240!\200A\360\n\000\t\031\230\001\230\021\330\010\030\230\001\230\021\330\010\024\220A\220V\2301\200A\330\010\014\210A\210X\220Q\330\010\017\210q\200A\330\010\014\320\014\034\230A\330\010\014\210N\230!\330\010\014\210K\220q\330\010\014""\210D\220\t\230\021\200A\360\006\000\t\020\210}\230A\330\014\020\220\t\230\021\230$\230a\330\014\020\220\017\230t\2401\200A\360\026\000\t\r\210D\220\001\220\033\230D\240\001\240\021\200A\330\010\020\320\020$\240D\320(>\270c\300\021\200A\360\030\000\t\r\210E\220\021\330\014\020\220\013\2301\230I\240X\250Q\330\014\026\220a\200A\330\010\014\210F\220'\230\021\230!\200A\330\010\014\210H\220K\230t\2401\330\010\014\210H\320\024)\250\021\250$\250a\200A\330\010\014\210H\320\024'\240q\250\004\250A\330\010\014\210H\220K\230t\2401\200A\330\010\014\210I\220V\2301\200A\340\010\014\210I\220Y\230a\330\010\014\210J\220g\230R\230q\200A\330\010\014\210J\220a\200A\340\010\014\210K\320\027'\240q\250\010\260\006\260g\270V\3001\330()\200A\340\010\014\210K\220q\200A\360\014\000\t\031\230\001\230\021\330\010\014\210K\220q\330\014\017\210x\220s\230!\330\020\026\220k\240\021\330\014\034\230A\230Q\330\014\030\230\001\230\026\230q\200A\360\026\000\t\r\210K\220t\2301\230A\200A\330\010\014\210K\220v\230Q\200A\340\010\014\210K\220x\230q\240\001\200A\360\n\000\t\r\210L\230\001\330\010\021\220\031\230!\2301\330\010\013\2106\220\026\220w\230a\330\014\023\320\023(\250\001\250\036\260t\270:\300W\310A\330\020\026\220l\240!\330\r\023\2206\230\034\320%7\260q\330\014\022\220+\320\035L\310A\310V\320ST\330\010\021\220\036\230q\240\010\250\016\260d\270!\330\010\021\220\026\220q\330\014\030\230\001\230\024\230Z\240q\330\010\021\220\021\220(\230!\200A\360\n\000\t\r\210L\230\001\330\010\021\220\031\230!\2301\330\010\021\220\036\230q\240\010\250\004\250H\260A\330\010\021\220\026\220q\330\014\030\230\001\230\024\230Z\240q\330\010\021\220\021\220(\230!\200A\360\010\000\t\r\210L\230\001\330\010\023\2204\220x\230q\330\010\013\2109\220C\220u\230C\230x\240{\260!\2601\330\014\023\2201\340\014\023\320\023$\240A\240T\320)9\270\021\200A\340\010\014\210L\230\004\230A\330\014\025\220X\230X\240Q\240l\260+\270Q\330\014\017\210w\220g\230Q\330\020\027\220q\330\010\013\2104\320\017\"\240#\240Q\330\014\023\2201\330\010\017\210t""\320\023%\240X\250Q\250l\270+\300Q\200A\360\010\000\t\r\210L\230\001\330\010\014\210K\220q\330\014\020\220\007\220q\230\001\200A\360\010\000\t\r\210L\230\001\330\010\021\220\034\230Q\230d\240!\330\010\013\2107\220'\230\021\330\014\023\320\023$\240A\240T\320)9\270\021\330\010\017\210q\200A\360\014\000\t\r\210L\230\001\330\010\021\220\021\330\010\021\220\024\220X\230Q\330\010\016\210g\220W\230A\330\014\023\220;\230a\230q\330\020\026\220g\230Q\320\036/\250q\260\004\3204D\300A\330\014\025\220V\2301\330\010\017\210q\200A\360\010\000\t\r\210L\230\001\330\010\021\320\021!\240\021\240$\240a\330\010\013\2107\220'\230\021\330\014\023\320\023$\240A\240T\320)9\270\021\330\010\017\210q\200A\360\010\000\t\r\210L\230\001\330\010\017\320\017!\240\021\240$\240j\260\001\200A\360\n\000\t\r\210M\230\021\230!\200A\360\014\000\t\r\210O\2301\230A\200A\360\034\000\t\r\210O\2301\330\010\021\220\031\230!\2301\330\010\017\210v\220Y\230a\230q\200A\360\030\000\t\r\210O\2301\330\010\020\220\002\220!\2204\220q\320\004$\240A\360\024\000\t\r\210O\2301\330\010\017\210t\2208\2301\330\010\013\2109\220A\220Q\330\014\017\210t\2202\220S\230\003\2301\330\020\027\220t\2302\230Q\330\020\025\320\025%\240Q\330\020\024\220A\330\024\025\340./\250q\330\024#\240;\250a\340\010\017\210t\2205\230\001\230\026\230q\200A\360\034\000\t\r\210O\2301\330\010\021\220\027\230\001\230\021\330\010\017\210v\220Y\230a\230q\200A\330\010\030\230\001\230\024\230Q\330\010\013\210:\220Q\320\026)\250\026\250q\330\014\037\320\037/\250v\260Q\330\010\014\210E\220\031\230!\330\014\036\230a\230t\240;\250e\2601\320\004/\320/A\300\021\360\n\000\t\036\230Q\330\010\t\330\014\022\220.\240\001\240\030\250\030\260\021\330\010\017\320\017&\240a\340\014\020\320\020!\320!1\260\021\340\014\020\320\020!\240\023\240H\250A\330\010\014\210H\220H\230D\240\017\250w\260j\300\001\330\010\017\210t\2201\200A\330\010\030\230\001\230\024\230Q\330\010\022\220$\220i\230x\240q\330\010\013\2101\330\014\020\220\t\230\030\240\036\250q\330\020 \240\001\240\021\200A""\330\010\030\230\001\230\024\230Q\330\010\017\320\017!\240\021\240$\240i\250z\270\021\200A\330\010\030\230\001\230\024\230Q\330\010\017\210t\2201\320\024&\240a\240t\2509\260J\270a\200A\330\010\030\230\001\230\024\230Q\330\010\017\210t\2203\220a\200A\360\030\000\t\020\320\017%\240Q\240a\200A\360\016\000\t\022\220\034\230Q\230d\240!\330\010\013\2107\220#\220Q\330\014\023\2201\330\010\017\210\177\230a\230t\2407\250!\320\004$\240A\360\022\000\t\014\210:\220Q\220f\230A\330\014\024\220G\2305\240\001\330\010\017\210|\2305\240\001\240\026\240v\250\\\270\036\300t\310?\320Z[\320[\\\200A\360\016\000\t\014\210:\220Q\220g\230Q\330\014\025\220Q\330\010\023\2201\220F\230$\230i\240u\250C\250u\260F\270#\270Q\330\010\017\210}\230A\230Z\240v\250Q\200A\360\016\000\t\014\210:\220Q\220h\230a\330\014\026\220a\330\010\023\2201\220F\230$\230i\240u\250C\250u\260G\2703\270a\330\010\017\210}\230A\230Z\240v\250Q\200A\360\n\000\t\014\210:\220Q\220i\230q\330\014\027\220q\330\010\023\2201\220F\230$\230i\240u\250C\250u\260H\270C\270q\330\010\017\210}\230A\230Z\240v\250Q\200A\360 \000\t\014\210:\220R\220q\330\014\022\220*\230A\230Q\330\014\034\230A\200A\340\010\035\230T\240\025\240a\330\010#\240:\250U\260!\330\010\013\2106\220\023\220A\330\014\r\330\014\032\230!\2301\330\014\030\230\001\230\021\200A\360\026\000\t\031\230\001\230\021\330\010\030\230\001\230\021\330\010\030\230\001\230\021\330\010\025\220[\240\001\330\010\013\210:\220X\230W\240D\250\001\330\014\022\220,\230a\330\010\025\220[\240\001\340\010\013\320\013\034\230A\230\\\250\024\250Q\330\014\022\220*\230A\230Q\340\010\025\220Z\230q\330\010\025\220Z\230q\330\010\027\220z\240\021\330\014\033\2301\230L\250\001\330\010\021\220\021\220,\230a\330\010\021\220\021\220,\230a\330\010\032\230!\2304\230w\240n\260A\340\010\032\230!\2304\230w\240j\260\006\260a\200A\360\016\000\t\024\220;\230a\320\000!\240\037\260\001\330\r#\320#<\270A\330\r\036\230a\340\r#\2401\340\r&\240a\360j\001\000\005\010\200w\210d\220(\230!\330\010\013\2109\220G\2301\330\014\022""\220*\230A\230Q\330\010\013\2101\330\014\022\220*\230A\230Q\330\010\013\2107\220#\220Q\330\014\023\220=\240\001\320!2\260+\270_\310A\340\014\022\220'\230\021\330\014\025\320\025%\240Q\330\020\033\2301\230D\240\001\330\020\036\230o\250[\270\001\330\014\033\2301\320\034-\250Q\330\014\023\2203\220i\230q\330\004\007\200t\2101\330\010\016\210j\230\001\230\021\330\004\007\200q\330\010\016\210j\230\001\230\021\330\004\007\200y\220\003\2208\2304\230y\250\007\250u\260D\270\010\300\006\300c\310\023\310A\330\010\013\2101\330\014\022\220!\330\020\021\330\010\034\230A\330\010\023\2201\330\t\031\230\023\230A\340\010\034\230I\240W\250E\260\024\260X\270V\3003\300a\330\035&\240i\250x\260q\340\010\034\230A\330\004\007\200y\220\003\2201\330\010\023\2201\330\004\007\200{\220#\220Q\330\010\031\230\021\330\t\n\330\010\034\230A\330\010\030\230\001\340\010\034\230A\330\010\030\230\001\340\004\007\200z\220\021\320\022#\2401\330\010\017\210y\230\001\230\032\320#4\260J\270i\300q\330\031,\250C\250~\270Q\330\031\032\330\t\023\2201\320\024%\240Q\330\010\017\210y\230\002\230.\320(8\270\001\330\031#\2409\250H\3204G\300q\330\031'\240{\260!\340\010\016\210k\230\037\250\014\260A\3205E\300W\310A\310Q\200A\360\010\000\t\"\240\035\250a\330\014\020\220\013\2304\230\177\250d\260!\330\010\013\210;\220d\230!\330\010\017\210q\200A\360\016\000\t\022\320\021!\240\021\240$\240a\330\010\013\2107\220#\220Q\330\014\023\2201\330\010\017\210\177\230a\230t\2407\250!\320\000\024\320\024$\240A\360\026\000\005\013\210.\230\001\230\030\240\030\250\021\330\004\013\320\013\036\230a\230u\240G\2507\260!\2601\200A\330+,\360\020\000\t\031\230\001\330\010\022\220$\220a\220x\230v\240Q\240h\250f\260A\260Q\330\010\017\210s\220!\320\023'\240q\320(8\270\n\300!\200A\330\010\026\220d\230-\240q\250\001\330\010\020\220\004\220M\240\021\240!\330\010\014\210D\220\r\230Q\230a\330\010\020\220\004\220I\230Q\230f\240D\250\003\2501\330\010\030\230\005\230T\240\023\240K\250q\330\010\017\210u\220D\230\001\230\035\240c\250\021\200A\330\010\026""\220i\230q\240\006\240i\250v\260S\270\001\200A\330\010\016\210j\230\001\200A\360\014\000\t\031\230\001\230\021\330\010\017\320\017!\240\021\240$\240j\260\001\200A\360\n\000\t\023\220$\220n\240A\240Q\330\010\017\210t\2206\230\025\230c\240\021\330\014)\250\021\250$\250f\260K\270q\300\001\330\010\017\210q\200A\330\010\017\210q\200A\360\024\000\t\031\230\001\230\021\330\010\017\320\017\037\230q\240\001\200A\340\010\017\210q\200A\360\n\000\t\020\210q\200A\360\022\000\t\020\210q\200A\360\014\000\t\022\320\021(\250\017\260q\270\001\330\010\013\2107\220#\220Q\330\014\r\330\010\023\220<\230q\240\001\200A\360\022\000\t\030\220q\230\004\230A\330\010\017\320\017\"\240!\2404\240w\250a\200A\360\016\000\t\022\220\036\230q\240\004\240A\330\010\013\2107\220#\220Q\330\014\023\2201\330\010\017\210\177\230a\230t\2407\250!\200A\330\010\017\210r\220\021\220#\220[\240\001\240\024\240Q\200A\360\016\000\t\020\210s\220!\2201\200A\360\n\000\t\020\210t\2201\200A\330\010\017\210t\2201\220A\200A\360\016\000\t\020\210t\2201\220A\200A\330\010\017\210t\2201\220D\230\013\2401\200A\330\010\017\210t\2201\220D\230\r\240Q\200A\330\010\017\210t\2201\220D\230\t\240\026\240q\200A\330\010\017\210t\2201\220D\230\007\230q\200A\330\010\017\210t\2201\220D\230\017\240q\200A\330\010\017\210t\2201\200A\340\010\017\210t\2206\230\021\200A\360\n\000\t\020\210t\2206\230\021\200A\330\010\017\210t\2208\2307\240!\2401\200A\360\014\000\t\020\210t\2208\2307\240!\330\010\023\2204\220|\2407\250#\250Z\3207H\310\001\310\021\330\010\017\210~\230Q\230f\240A\200A\360\n\000\t\020\210t\2208\2307\240!\330\010\013\2108\2203\220a\330\014\r\330\010\013\2104\210y\230\003\2301\330\014\022\220/\240\021\240!\330\010\022\220%\220q\230\001\330\010\025\220Q\220d\230)\2406\250\021\250!\330\010\014\210K\220q\330\010\013\2104\210t\2201\330\020%\240Q\240d\250!\330\010\014\210N\230!\2304\230w\240a\200A\360\n\000\t\020\210t\2208\2307\240!\330\014!\240\021\240$\240a\330\010\014\210N\230!\2304\230w\240a\200A\340\010\017\210t\2209\230A\200A\330\010""\017\210t\2209\230A\200A\340\010\017\210t\2209\230D\240\010\250\002\250!\200A\360\014\000\t\020\210t\320\023%\240Q\240a\200A\360\n\000\t\020\210t\320\023%\240Q\240k\260\021\200A\330\010\017\210t\220=\240\007\240q\330\010\014\210J\320\026,\250A\330\014\020\220\016\230d\240+\250T\260\021\330\014\020\220\010\230\004\230K\240t\2501\330\010\017\210t\2201\200A\360\006\000\t\020\210t\220<\230w\240f\250A\330\010\014\210H\220G\230:\240V\2501\330\014\020\220\t\230\035\240a\240x\250q\200A\360\006\000\t\020\210t\220<\230w\240f\250A\330\010\014\210I\220]\240!\2408\2501\200\014\210A\360\024\000\005\010\200u\210C\210q\330\010\017\210q\340\010\017\210u\220A\220Q\330\010\013\2106\220\023\220E\230\023\230D\240\t\250\021\250!\330\014\022\220*\230A\230Q\340\004\014\210J\220a\330\004\n\320\n\032\230!\2307\240!\330\004\r\210^\2301\230G\2406\250\021\250!\330\010\024\220A\220Z\230w\240a\330\004\013\210?\230!\2305\240\001\200A\330\010\017\210w\220a\220t\2301\200A\330\010\017\210x\220s\230!\200A\330\010\017\210y\230\001\230\021\200A\360\022\000\t\023\220.\240\001\330\010\017\210y\230\001\330\010\017\210}\230O\2501\250A\330\010\017\210q\200A\360\020\000\t\023\220.\240\001\330\010\017\210y\230\001\330\010\017\210q\320\000\034\230A\360\024\000\005\010\200z\220\021\220*\230G\2401\330\010\016\210j\230\001\230\021\340\004\007\200w\210c\220\021\330\010\021\320\021(\320(9\270\021\330\004\013\2106\220\021\330\004\010\210\010\220\001\330\010\014\210A\210Q\330\004\013\2106\220\026\220q\320\004*\320*B\300.\320PQ\360\020\000\t\020\210t\2208\2307\240!\330\010\023\2204\220|\2407\250#\250Z\3207H\310\001\310\021\340\010\014\210K\220q\330\014\017\210y\230\001\230\021\330\020\023\2204\220y\240\003\2401\330\024\027\220t\2309\240B\320&8\270\003\2707\300&\310\001\330\030\036\230o\250Q\250a\330\020\032\230%\230q\240\001\330\020\023\2204\220q\330\024\025\340\020\024\220F\230#\230T\240\024\240_\260B\260a\330\020\024\220I\230S\320 3\2601\330\030\033\2304\230v\320%F\300a\330\030\035\230T\240\033\250A\330\030-\250Q""\250d\260)\2703\270a\270z\310\025\310a\310q\360\006\000\0314\2601\260D\270\t\300\026\300q\310\n\320RS\340\021\033\2301\230I\240Q\330\020\023\2204\220y\240\002\240!\330\024\032\230/\250\021\250!\330\020#\2401\240D\250\n\260'\270\030\300\021\340\021\032\230!\2301\330\020\023\2204\220y\240\002\240!\330\024\032\230/\250\021\250!\330\020\"\240!\2404\240z\260\032\2708\3001\330#'\240~\260V\2701\330#*\250'\260\036\270{\310!\330\020\024\220J\230h\240h\250f\260G\2701\330\024\027\220t\2304\230q\330\030\034\230K\240q\340\021\031\230\027\240\001\330\020\026\220i\230q\330\0246\260a\260t\2701\270A\340\014\020\220\016\230a\230t\2407\250!\340\010\013\2104\210t\2201\330\020%\240Q\240d\250!\330\014\020\220\016\230a\230t\2407\250!\320\004C\3001\360\016\000\t\r\210H\320\024-\250Q\250a\320\004C\3001\360\016\000\t\r\320\014\035\230Q\320\004\033\320\033,\250F\260,\270f\300A\360\026\000\t\031\230\001\230\021\330\010\030\230\001\230\021\330\010\022\220%\220q\330\010\013\2107\220(\230'\240\024\240Q\330\014\022\220,\230a\360\006\000\t\014\2105\220\003\2205\230\005\230V\2403\240e\2503\250f\260C\260q\330\014\020\220\001\330\014\026\220g\230Q\330\014\022\220(\230'\240\021\330\020\023\220:\230Q\230a\330\024\031\230\021\330\020\032\230'\240\021\330\014\023\2201\360\006\000\t\014\2106\220\023\220A\330\014\026\220a\340\014\026\220a\330\010\013\2105\220\003\2201\330\014\025\220Q\340\014\025\220Q\330\014\017\210w\220c\230\022\2301\330\023\033\2303\230g\240U\250'\260\022\2602\260S\270\010\300\002\300!\330\020\026\220l\240!\360\006\000\t\014\2108\2202\220R\220s\230'\240\022\2401\340\014\017\210x\220r\230\021\330\020\024\220A\220Q\340\020\024\220A\220Q\330\014\033\2304\230x\240q\330\014\020\220\001\330\014\022\220-\230s\240(\250$\250b\260\002\260!\330\020\023\220:\230Q\230a\330\024\031\230\021\330\020\037\230|\2501\330\014\017\210}\230C\230q\340\020\023\2207\230\"\230B\230d\240\"\240C\240q\250\001\330\024\032\230,\240a\330\021\031\230\022\2301\330\020\026\220l\240!\360\006\000\t\023\220'\230\021\330\010""\014\210A\330\010\013\2107\220\"\220A\340\014\022\220(\230#\230U\240$\240b\250\002\250!\330\020\023\220:\230Q\230a\330\024\031\230\021\330\020\032\230'\240\021\330\014\017\210r\220\022\2201\330\020\027\220q\360\006\000\r\023\220(\230#\230Q\330\020\023\220:\230Q\230a\330\024\030\230\002\230\"\230A\330\020\032\230'\240\021\330\014\017\210x\220r\230\021\330\020\023\2202\220S\230\001\330\024\033\2301\340\020\027\220q\330\010\013\2108\2203\220b\230\003\2307\240#\240Q\330\014\022\220,\230a\340\014\022\220,\230a\320\004L\310A\330*C\3001\360,\000\t2\260\027\270\001\330\010,\250F\260!\330\010\017\210w\220k\240\027\250\006\250a\360\014\000\t\014\210>\230\027\240\001\330\014\027\220|\2401\240A\340\014\033\230>\250\021\330\020\027\220z\240\031\250&\3200@\300\017\310q\340\010\016\210j\230\001\330\014!\240\021\240!\330\014\022\220'\230\026\230u\240K\250v\260Q\330\010\016\210j\230\001\340\010\013\210>\230\027\240\001\330\014\023\2201\340\010\t\330\014\023\2204\320\0271\260\021\330\020\031\230\032\240?\260!\360\006\000\021\035\230A\230Q\320\004)\250\021\340\010\020\220\004\220M\240\021\240!\330\010\014\210D\220\r\230Q\230a\330\010\020\220\004\220I\230Q\230f\240D\250\003\2501\330\010\013\2104\210s\220!\330\014\026\220e\2308\2401\240A\330\014\017\210t\2201\330\020\027\220q\340\014\025\220U\230'\240\021\240!\330\014\017\210t\2201\330\020\027\220q\330\014\026\220b\230\006\230f\240A\330\014\023\2207\230\"\230F\240'\250\021\250!\330\010\026\220a\330\010\017\210w\220a\220q\330\010\014\210K\220q\330\014\025\320\025(\250\001\250\021\330\020\032\230\"\230E\240\021\240!\330\014\023\220:\230Q\230f\240A\330\014\020\220\010\230\001\330\014\027\220w\230a\230q\330\010\017\210q\320\004(\250\001\330\010\020\220\004\220M\240\021\240!\330\010\014\210D\220\r\230Q\230a\330\010\020\220\004\220I\230Q\230f\240D\250\003\2501\330\010\013\2105\220\007\220q\230\003\2303\230a\330\014\023\2201\340\014\023\2201\320\004)\320):\270!\330\034\035\360$\000\t\r\210O\2301\330\010\024\320\024*\250!\2506\260\033\270A\330+""6\260a\330+9\270\021\330\010\017\210y\230\001\230\031\240!\320\004%\320%:\270!\360\034\000\t\r\210O\2301\330\010\020\220\004\220A\220W\230K\240q\330\025$\240A\330\010\017\210u\220A\220X\230Q\320\004(\250\001\360\024\000\t\r\210O\2301\330\010\017\210t\2208\2301\330\010\013\2109\220A\220Q\330\014\017\210t\2202\220S\230\003\2301\330\020\027\220t\2302\230Q\330\020\025\320\025%\240Q\330\020\024\220A\330\024\025\340./\250q\330\024#\240;\250a\340\010\017\210t\2209\230A\230V\2401\320\n.\320.?\270~\310Q\320\004Q\320QR\330)B\300!\3600\000\t\020\210w\220k\240\027\250\006\250a\330\010\031\230\031\240!\2401\360\010\000\t\014\210>\230\027\240\001\330\014\027\220|\2401\240A\340\014\033\230>\250\021\330\020\027\220z\240\031\250&\3200@\300\017\310q\340\010\021\220\027\230\n\240!\330\010\017\210z\230\032\2401\330\014\037\230q\330\014\023\220<\320\037/\250q\330\010\017\210z\230\032\2401\340\010\013\210>\230\027\240\001\330\014\023\2201\340\010\t\330\014\023\2204\320\0271\260\021\330\020\031\230\032\240?\260!\360\006\000\021\035\230A\230Q\320\000%\240Q\360@\001\000\005\032\230\021\330\004\014\320\014\034\320\0347\260q\270\t\300\021\300!\330\004\n\320\n\032\230!\2307\240(\250!\330\004\013\320\013\036\230a\230u\240A\320\000\035\230Q\360,\000\005\010\200w\210c\220\025\220c\230\026\320\0371\260\023\260A\330\010&\240a\240v\250Q\340\010&\240a\240v\320-@\300\001\320\000\021\320\021#\240:\250Q\360\032\000\005\010\200y\220\003\2205\230\004\230J\240c\250\021\330\010\016\210j\230\001\230\021\340\004\n\210!\330\004\007\200t\2103\210a\330\010\016\210f\220H\230A\340\004\r\320\r\035\230Q\230c\240\032\2501\340\004\007\200y\220\007\220u\230D\240\004\240J\250a\250z\270\021\330\010\027\220q\230\n\240!\330\010\017\210s\220)\2306\240\024\240W\250J\260a\340\004\036\230i\240q\330\010\017\210q\330\010\033\2301\330\010\024\220A\360\006\000\005\010\200y\220\007\220q\330\010\016\210e\2201\220A\330\010\016\210f\220A\330\t\023\2207\230!\330\010\t\330\014\032\230!\230;\320&7\260q\330\017\020\360\006\000\005\014""\2103\210i\220v\230T\240\027\250\n\260!\320\004(\250\001\360\022\000\t\014\210:\220Q\220f\230A\330\014\024\220G\2305\240\001\330\010\017\210|\2309\240A\240V\2506\260\034\270^\3104\310\177\320^_\320_`\320\004\033\230=\250\001\330\n\021\220\034\230Q\230f\240F\250&\260\006\260f\270A\330\036&\240g\250Q\320\004:\270!\360\024\000\t\014\210:\220Q\220h\230a\330\014\026\220i\230w\240g\250Q\250a\330\r\021\220\032\2301\230H\240A\330\014\022\220+\230Q\330\010\022\220.\240\001\330\010\017\210y\230\001\330\010\017\210\177\230a\330\010\013\2109\220G\2301\330\014\023\220=\240\017\250q\260\001\330\010\017\210q\200\001\360\n\000\005\014\210:\220Q\220i\230z\250\025\250j\270\010\300\t\310\027\320PQ\320\000\"\240!\360\024\000\005\016\210U\220!\2201\330\004\024\220A\220Q\330\004\007\200v\210V\2203\220c\230\021\330\010\016\210l\320\032-\250Q\250a\340\004\007\200u\210C\210q\330\010\017\210q\340\010\017\210u\220A\220Q\330\010\013\2106\220\023\220A\330\014\022\220,\230a\340\004\014\210J\220a\330\004\n\320\n\032\230!\2307\240!\330\004\r\210Y\220a\220w\230f\240A\240Y\250f\260A\260Q\330\010\024\220A\220Z\230w\240a\330\004\013\210?\230!\2305\240\001\200\001\360*\000\005\016\210U\220!\220;\230l\250!\330\004\005\330\010\017\320\017.\250a\250q\330\013\014\330\010\023\320\0232\260!\2601\330\0232\260!\2601\330\010\017\210q\200\001\330\032\033\210!\200\001\360\032\000\005\027\220a\320\027)\250\021\320\000\022\320\022.\250a\3602\000\005\006\330\010\016\210n\230A\230X\240X\250Q\330\010\017\320\017\"\240!\2405\250\001\330\004\013\320\013\"\240!\330\010\017\320\017\037\230q\320\004\036\230a\360$\000\t\014\2104\210w\220a\330\014\025\220Q\330\010\017\320\017(\250\001\250\026\250q\320\004\036\230a\360 \000\t\031\230\001\230\021\330\010\013\2104\210x\220y\240\003\2401\330\014\022\220,\230a\330\010\020\220\r\230Q\230d\240#\320%5\260T\270\030\300\031\310'\320QR\320RS\330\010\013\2103\210a\210w\220c\230\021\330\014\022\220,\230a\330\010\020\220\005\220Q\220a\330\010\023\2204\220q\230\005\230Q\230c\240\023\240E""\250\021\250!\330\010\021\220\026\220q\230\001\340\010\013\2106\220\021\220#\220S\230\001\340\014\031\230\034\240Q\330\020\021\330\024#\2401\240D\250\010\260\006\260d\270!\330\014\017\210w\220g\230Q\330\020\021\330\024\037\320\037/\250q\340\030 \240\001\240\027\250\001\330\014\031\320\031.\250a\250z\270\021\330\014\023\320\023&\240a\240|\2601\360\010\000\t\030\220q\230\004\230A\330\010\022\220!\330\010\025\220Y\230a\230t\2408\2506\260\021\330\010\013\2107\220'\230\025\230d\240&\250\005\250S\260\004\260H\270A\330\014\032\230/\250\021\250$\250g\260V\2701\330\014\023\320\023&\240a\240{\260'\270\021\360\006\000\t\020\320\017\"\240!\2404\240w\250h\260a\260q\330\010\013\2104\210q\330\014\022\220,\230a\330\r\020\220\001\220\026\220r\230\021\330\014\022\220,\230a\330\010\026\220d\230!\2301\330\010\017\320\017\"\240!\240;\250g\260Q\320\004&\240a\360\n\000\t\014\2106\220\023\220A\330\014\024\220A\330\010\017\210t\320\023#\2401\240E\250\027\260\001\200\001\360\024\000\005\027\220a\320\027(\250\006\250a\320\004\036\230a\360\014\000\t\020\210t\220=\240\001\240\030\250\021\320\004\036\230a\360\"\000\t\020\210t\2208\2301\330\010\013\2105\220\003\2201\330\014\023\2201\330\010\013\2104\210w\220a\330\014\025\220Q\330\010\017\210t\220<\230r\240\021\200\001\360 \000\005\017\320\016\036\230a\230q\330\004\007\200t\2101\330\010\t\340\004\016\320\016\036\230h\240a\320'9\270\021\330\004\013\210:\220Q\220g\230Q\330\004\007\200w\320\016#\2401\330\010\t\330\004\025\220Q\220g\230Z\240q\320\004&\240m\2601\330 7\3207L\310A\330\031'\320'9\270\021\330\035:\270!\330!7\260q\330\030\031\360^\001\000\t\r\210O\2301\330\010\030\230\001\230\024\230Q\330\010\013\210<\220s\230%\230s\240,\250b\260\001\330\014\032\230!\360\006\000\t\014\2107\220$\220h\230a\330\014\017\210y\230\007\230q\330\020\026\220j\240\001\240\021\330\014\017\210q\330\020\026\220j\240\001\240\021\340\014\017\210w\220c\230\021\330\020\037\230q\240\006\240d\320*:\270+\300Q\330 -\250Q\340\025$\240A\240V\250<\3207G\300q\330\024\035\320\035-""\250Q\330\030\031\230\030\240\036\250\177\270k\310\021\330\024#\2401\240F\250!\330\014\r\340\010\013\2104\210q\330\014\022\220*\230A\230Q\340\010\013\320\013\033\2307\240!\330\014 \240\001\330\014\017\210y\230\003\2301\330\020\033\2301\340\020\033\2308\2406\250\021\330\r\026\220c\230\021\330\014\027\220q\330\014 \240\001\340\014\027\220x\230v\240Q\330\014 \240\t\250\021\330\020\034\230I\240X\250Q\330\010\013\210;\220c\230\021\330\014\035\230Q\330\r\016\330\014 \240\001\330\014\034\230A\340\014 \240\001\330\014\034\230A\340\010\013\210:\220W\230E\240\024\240X\250S\260\001\330\023\024\330\014\024\220E\230\021\330\020\021\330\020\021\330\014\026\220a\340\010\023\2201\220F\230$\320\036.\250j\270\t\300\021\330\024'\240s\250.\270\001\330\024#\2401\320\004\"\240,\250m\2701\330\010\031\230\024\230X\240X\250Q\250e\2608\2707\300*\310A\330\010\017\320\017&\240a\320'7\260q\320\004\"\240,\250m\2701\360\014\000\t\020\210t\2208\2307\240!\330\010\025\220Q\330\010\013\2107\220'\230\021\330\014\020\220\006\220i\230|\2501\250A\330\020\023\2205\230\007\230q\330\024\030\230\007\230y\250\001\250\021\330\024\036\230g\240R\240t\2506\260\025\260a\260q\330\010\013\2101\330\014\020\220\006\220i\230v\240Z\250q\330\020\024\220G\2309\240A\240Q\330\020\032\230'\240\022\2404\240v\250U\260!\2601\330\010\031\230\021\330\010\013\2101\330\014\020\220\010\230\006\230e\2406\250\021\330\020\023\2207\230'\240\021\330\024\035\230U\240!\2401\330\024'\240q\250\001\330\020\036\230a\230u\240A\240W\250A\330\010\014\210G\2209\230A\230Q\340\010\023\2204\220|\2407\250#\250Z\3207H\310\001\310\021\340\010\017\320\017!\240\021\240'\250\024\250V\260<\320?P\320PQ\320\n+\320+>\270n\310A\320\004\027\220q\360(\000\t\014\2104\210w\220a\330\014\025\220Q\330\010\017\320\017(\250\001\250\026\250q\320\004\037\230q\360\006\000\t\r\210L\230\001\330\010\017\320\017%\240Q\240d\250*\260E\270\021\320\004'\240q\360\024\000\t\r\210O\2301\330\010\017\210t\2208\2301\330\010\013\2109\220A\220Q\330\014\017\210t\2202\220S\230\003\2301\330""\020\027\220t\2302\230Q\330\020\025\320\025%\240Q\330\020\024\220A\330\024\025\340./\250q\330\024#\240;\250a\340\010\017\210t\2208\2301\230F\240!\320\004\037\230q\360\n\000\t\031\230\001\230\021\330\010\017\320\017!\240\021\240&\250\005\250Q\320\004\037\230q\330\010\030\230\001\230\024\230Q\330\010\017\320\017!\240\021\240$\240k\260\025\260a\320\004'\240q\360\022\000\t\014\210:\220Q\220f\230A\330\014\024\220G\2305\240\001\330\010\017\210|\2308\2401\240F\250&\260\014\270N\310$\310o\320]^\320^_\200\001\360\014\000\005\021\220\n\230%\230q\240\t\250\025\250a\250q\330\004\007\320\007\035\230Q\230a\330\010\016\210j\230\001\230\021\330\004\024\220A\220Q\330\004\024\220A\220Q\330\004\010\210\010\220\003\320\023;\2704\270{\310#\310Q\330\014\017\210{\230#\230W\240D\250\010\260\003\2601\330\010\016\210j\230\001\230\021\330\004\010\210\003\2105\220\004\220A\320\0250\260\006\260a\330\010\013\2102\210S\220\010\230\003\2302\230S\240\001\330\014\020\320\020+\2501\250A\330\004\037\230q\240\013\2501\330\004,\250A\320\004\037\230q\340\010\017\210q\320\004\037\230q\360\030\000\t\020\210t\2207\230$\230a\230u\240A\320\004\027\220q\360\026\000\t\020\210t\2208\2301\330\010\013\2105\220\003\2201\330\014\023\2201\330\010\013\2104\210w\220a\330\014\025\220Q\330\010\017\210t\2205\230\002\230!\320\000\027\220q\360\030\000\005\010\200w\210c\220\021\330\010\021\220\021\330\004\033\320\033,\250A\250Q\200\001\360\030\000\005\020\210u\220A\220Q\330\004\r\210V\2201\220A\330\004\007\200v\210Q\210c\220\023\220A\330\010\013\2104\320\017)\250\021\250'\260\022\2601\330\014\022\220,\320\036>\270a\270q\330\t\r\210_\230A\230Q\330\010\016\210l\320\0327\260q\270\001\330\004\014\210J\220a\330\004\n\320\n\032\230!\2307\240!\330\004\r\210]\230!\2307\240!\330\010\024\220A\220Z\230w\240a\330\004\013\210?\230!\2305\240\001\200\016\320\016*\250!\360(\000\005\010\200w\210c\220\021\330\010\021\320\021(\320(9\270\021\330\010\013\2104\210z\230\021\230(\240!\330\014\025\220Q\330\004\005\330\010\016\320\016\"\240!\2406""\250\032\2601\330\010\017\210s\220(\230!\330\004\013\320\013\"\240!\330\010\017\320\017\037\230qns\\d+$AASCIIOOkdchtmlmatchpyrdfreplacescriptstyletestwsdlxmlxmlnsxsxsixsl";
    PyObject *data = NULL;
    CYTHON_UNUSED_VAR(__Pyx_DecompressString);
    #endif
    PyObject **stringtab = __pyx_mstate->__pyx_string_tab;
    Py_ssize_t pos = 0;
    for (int i = 0; i < 1440; i++) {
      Py_ssize_t bytes_length = index[i].length;
      PyObject *string = PyUnicode_DecodeUTF8(bytes + pos, bytes_length, NULL);
      if (likely(string) && i >= 381) PyUnicode_InternInPlace(&string);
      if (unlikely(!string)) {
        Py_XDECREF(data);
        __PYX_ERR(0, 1, __pyx_L1_error)
      }
      stringtab[i] = string;
      pos += bytes_length;
    }
    for (int i = 1440; i < 1744; i++) {
      Py_ssize_t bytes_length = index[i].length;
      PyObject *string = PyBytes_FromStringAndSize(bytes + pos, bytes_length);
      stringtab[i] = string;
      pos += bytes_length;
      if (unlikely(!string)) {
        Py_XDECREF(data);
        __PYX_ERR(0, 1, __pyx_L1_error)
      }
    }
    Py_XDECREF(data);
    for (Py_ssize_t i = 0; i < 1744; i++) {
      if (unlikely(PyObject_Hash(stringtab[i]) == -1)) {
        __PYX_ERR(0, 1, __pyx_L1_error)
      }
    }
    #if CYTHON_IMMORTAL_CONSTANTS
    {
      PyObject **table = stringtab + 1440;
      for (Py_ssize_t i=0; i<304; ++i) {
        #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
        #if PY_VERSION_HEX < 0x030E0000
        if (_Py_IsOwnedByCurrentThread(table[i]) && Py_REFCNT(table[i]) == 1)
        #else
        if (PyUnstable_Object_IsUniquelyReferenced(table[i]))
        #endif
        {
          Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL);
        }
        #else
        Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT);
        #endif
      }
    }
    #endif
  }
  {
    PyObject **numbertab = __pyx_mstate->__pyx_number_tab + 0;
    int8_t const cint_constants_1[] = {0,-1,1,2,3,-4,4,5,-100,100};
    int16_t const cint_constants_2[] = {-200,-300};
    int32_t const cint_constants_4[] = {32768L,136983863L};
    for (int i = 0; i < 14; i++) {
      numbertab[i] = PyLong_FromLong((i < 10 ? cint_constants_1[i - 0] : (i < 12 ? cint_constants_2[i - 10] : cint_constants_4[i - 12])));
      if (unlikely(!numbertab[i])) __PYX_ERR(0, 1, __pyx_L1_error)
    }
  }
  #if CYTHON_IMMORTAL_CONSTANTS
  {
    PyObject **table = __pyx_mstate->__pyx_number_tab;
    for (Py_ssize_t i=0; i<14; ++i) {
      #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
      #if PY_VERSION_HEX < 0x030E0000
      if (_Py_IsOwnedByCurrentThread(table[i]) && Py_REFCNT(table[i]) == 1)
      #else
      if (PyUnstable_Object_IsUniquelyReferenced(table[i]))
      #endif
      {
        Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL);
      }
      #else
      Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT);
      #endif
    }
  }
  #endif
  return 0;
  __pyx_L1_error:;
  return -1;
}
/* #### Code section: init_codeobjects ### */
typedef struct {
    unsigned int argcount : 3;
    unsigned int num_posonly_args : 1;
    unsigned int num_kwonly_args : 4;
    unsigned int nlocals : 5;
    unsigned int flags : 10;
    unsigned int first_line : 12;
} __Pyx_PyCode_New_function_description;
/* NewCodeObj.proto */
static PyObject* __Pyx_PyCode_New(
        const __Pyx_PyCode_New_function_description descr,
        PyObject * const *varnames,
        PyObject *filename,
        PyObject *funcname,
        PyObject *line_table,
        PyObject *tuple_dedup_map
);


static int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate) {
  PyObject* tuple_dedup_map = PyDict_New();
  if (unlikely(!tuple_dedup_map)) return -1;
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 541};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_file, __pyx_mstate->__pyx_n_u_compression, __pyx_mstate->__pyx_n_u_zf, __pyx_mstate->__pyx_n_u_f};
    __pyx_mstate_global->__pyx_codeobj_tab[0] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_serializer_pxi, __pyx_mstate->__pyx_n_u_open_utf8_file, __pyx_mstate->__pyx_kp_b_iso88591__47, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[0])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 974};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_ns_stack, __pyx_mstate->__pyx_n_u_namespaces};
    __pyx_mstate_global->__pyx_codeobj_tab[1] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_serializer_pxi, __pyx_mstate->__pyx_n_u_iter_namespaces, __pyx_mstate->__pyx_kp_b_iso88591_A_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[1])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1092};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_n};
    __pyx_mstate_global->__pyx_codeobj_tab[2] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_serializer_pxi, __pyx_mstate->__pyx_n_u_lambda, __pyx_mstate->__pyx_kp_b_iso88591_6_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[2])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_COROUTINE), 1328};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[3] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_serializer_pxi, __pyx_mstate->__pyx_n_u_aenter, __pyx_mstate->__pyx_kp_b_iso88591__48, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[3])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_COROUTINE), 1339};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_exc_type, __pyx_mstate->__pyx_n_u_exc_val, __pyx_mstate->__pyx_n_u_exc_tb, __pyx_mstate->__pyx_n_u_old_writer, __pyx_mstate->__pyx_n_u_raise_on_error};
    __pyx_mstate_global->__pyx_codeobj_tab[4] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_serializer_pxi, __pyx_mstate->__pyx_n_u_aexit, __pyx_mstate->__pyx_kp_b_iso88591__48, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[4])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_COROUTINE), 1724};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_data};
    __pyx_mstate_global->__pyx_codeobj_tab[5] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_serializer_pxi, __pyx_mstate->__pyx_n_u_flush, __pyx_mstate->__pyx_kp_b_iso88591__48, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[5])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_COROUTINE), 1730};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_version, __pyx_mstate->__pyx_n_u_standalone, __pyx_mstate->__pyx_n_u_doctype, __pyx_mstate->__pyx_n_u_data};
    __pyx_mstate_global->__pyx_codeobj_tab[6] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_serializer_pxi, __pyx_mstate->__pyx_n_u_write_declaration, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[6])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_COROUTINE), 1736};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_doctype, __pyx_mstate->__pyx_n_u_data};
    __pyx_mstate_global->__pyx_codeobj_tab[7] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_serializer_pxi, __pyx_mstate->__pyx_n_u_write_doctype, __pyx_mstate->__pyx_kp_b_iso88591__48, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[7])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 3, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS|CO_COROUTINE), 1742};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_with_tail, __pyx_mstate->__pyx_n_u_pretty_print, __pyx_mstate->__pyx_n_u_method, __pyx_mstate->__pyx_n_u_args, __pyx_mstate->__pyx_n_u_data};
    __pyx_mstate_global->__pyx_codeobj_tab[8] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_serializer_pxi, __pyx_mstate->__pyx_n_u_write, __pyx_mstate->__pyx_kp_b_iso88591_nA, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[8])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_COROUTINE), 1755};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_raise_on_error, __pyx_mstate->__pyx_n_u_data};
    __pyx_mstate_global->__pyx_codeobj_tab[9] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_serializer_pxi, __pyx_mstate->__pyx_n_u_close_2, __pyx_mstate->__pyx_kp_b_iso88591__48, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[9])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_COROUTINE), 1775};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_data};
    __pyx_mstate_global->__pyx_codeobj_tab[10] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_serializer_pxi, __pyx_mstate->__pyx_n_u_aenter, __pyx_mstate->__pyx_kp_b_iso88591__48, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[10])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS|CO_COROUTINE), 1781};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_args, __pyx_mstate->__pyx_n_u_data};
    __pyx_mstate_global->__pyx_codeobj_tab[11] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_serializer_pxi, __pyx_mstate->__pyx_n_u_aexit, __pyx_mstate->__pyx_kp_b_iso88591__48, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[11])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_COROUTINE), 1843};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[12] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_serializer_pxi, __pyx_mstate->__pyx_n_u_aenter, __pyx_mstate->__pyx_kp_b_iso88591__48, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[12])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS|CO_COROUTINE), 1847};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_args};
    __pyx_mstate_global->__pyx_codeobj_tab[13] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_serializer_pxi, __pyx_mstate->__pyx_n_u_aexit, __pyx_mstate->__pyx_kp_b_iso88591__48, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[13])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 163};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_c_node};
    __pyx_mstate_global->__pyx_codeobj_tab[14] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_dtd_pxi, __pyx_mstate->__pyx_n_u_itervalues, __pyx_mstate->__pyx_kp_b_iso88591_A_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[14])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 223};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_c_node, __pyx_mstate->__pyx_n_u_node};
    __pyx_mstate_global->__pyx_codeobj_tab[15] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_dtd_pxi, __pyx_mstate->__pyx_n_u_iterattributes, __pyx_mstate->__pyx_kp_b_iso88591_A_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[15])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 327};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_c_node, __pyx_mstate->__pyx_n_u_node};
    __pyx_mstate_global->__pyx_codeobj_tab[16] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_dtd_pxi, __pyx_mstate->__pyx_n_u_iterelements, __pyx_mstate->__pyx_kp_b_iso88591_A_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[16])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 340};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_c_node, __pyx_mstate->__pyx_n_u_node};
    __pyx_mstate_global->__pyx_codeobj_tab[17] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_dtd_pxi, __pyx_mstate->__pyx_n_u_iterentities, __pyx_mstate->__pyx_kp_b_iso88591_A_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[17])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 95};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key};
    __pyx_mstate_global->__pyx_codeobj_tab[18] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_getitem, __pyx_mstate->__pyx_kp_b_iso88591_A_j, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[18])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 98};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[19] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_setitem, __pyx_mstate->__pyx_kp_b_iso88591_A_j, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[19])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 101};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key};
    __pyx_mstate_global->__pyx_codeobj_tab[20] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_delitem, __pyx_mstate->__pyx_kp_b_iso88591_A_j, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[20])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 104};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key};
    __pyx_mstate_global->__pyx_codeobj_tab[21] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_contains, __pyx_mstate->__pyx_kp_b_iso88591_A_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[21])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 107};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[22] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_len, __pyx_mstate->__pyx_kp_b_iso88591_A_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[22])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 110};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[23] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_iter_2, __pyx_mstate->__pyx_kp_b_iso88591_A_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[23])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 188};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_prefix, __pyx_mstate->__pyx_n_u_uri, __pyx_mstate->__pyx_n_u_prefix_utf, __pyx_mstate->__pyx_n_u_uri_utf, __pyx_mstate->__pyx_n_u_k, __pyx_mstate->__pyx_n_u_v};
    __pyx_mstate_global->__pyx_codeobj_tab[24] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_register_namespace, __pyx_mstate->__pyx_kp_b_iso88591_q_aq_Qa_j_AQ_AQ_4_Q_WD_1_j_5_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[24])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 0, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 11};
    PyObject* const varnames[] = {0};
    __pyx_mstate_global->__pyx_codeobj_tab[25] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_xmlerror_pxi, __pyx_mstate->__pyx_n_u_clear_error_log_2, __pyx_mstate->__pyx_kp_b_iso88591_a_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[25])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 194};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[26] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_xmlerror_pxi, __pyx_mstate->__pyx_n_u_copy, __pyx_mstate->__pyx_kp_b_iso88591_A_AT_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[26])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 200};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_entry};
    __pyx_mstate_global->__pyx_codeobj_tab[27] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_xmlerror_pxi, __pyx_mstate->__pyx_n_u_receive, __pyx_mstate->__pyx_kp_b_iso88591_A_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[27])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 290};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[28] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_xmlerror_pxi, __pyx_mstate->__pyx_n_u_copy, __pyx_mstate->__pyx_kp_b_iso88591_A_a_4_d_d_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[28])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 328};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_domains, __pyx_mstate->__pyx_n_u_entry, __pyx_mstate->__pyx_n_u_filtered, __pyx_mstate->__pyx_n_u_entry};
    __pyx_mstate_global->__pyx_codeobj_tab[29] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_xmlerror_pxi, __pyx_mstate->__pyx_n_u_filter_domains, __pyx_mstate->__pyx_kp_b_iso88591_A_Qiq_q_1F_iuCuHCq_AZvQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[29])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 338};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_types, __pyx_mstate->__pyx_n_u_entry, __pyx_mstate->__pyx_n_u_filtered, __pyx_mstate->__pyx_n_u_entry};
    __pyx_mstate_global->__pyx_codeobj_tab[30] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_xmlerror_pxi, __pyx_mstate->__pyx_n_u_filter_types, __pyx_mstate->__pyx_kp_b_iso88591_A_QgQ_Q_1F_iuCuF_Q_AZvQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[30])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 350};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_levels, __pyx_mstate->__pyx_n_u_entry, __pyx_mstate->__pyx_n_u_filtered, __pyx_mstate->__pyx_n_u_entry};
    __pyx_mstate_global->__pyx_codeobj_tab[31] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_xmlerror_pxi, __pyx_mstate->__pyx_n_u_filter_levels, __pyx_mstate->__pyx_kp_b_iso88591_A_Qha_a_1F_iuCuG3a_AZvQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[31])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 362};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_level, __pyx_mstate->__pyx_n_u_entry, __pyx_mstate->__pyx_n_u_filtered, __pyx_mstate->__pyx_n_u_entry};
    __pyx_mstate_global->__pyx_codeobj_tab[32] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_xmlerror_pxi, __pyx_mstate->__pyx_n_u_filter_from_level, __pyx_mstate->__pyx_kp_b_iso88591_A_1F_iuCuG3a_AZvQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[32])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 371};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[33] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_xmlerror_pxi, __pyx_mstate->__pyx_n_u_filter_from_fatals, __pyx_mstate->__pyx_kp_b_iso88591_A_t_Qk, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[33])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 378};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[34] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_xmlerror_pxi, __pyx_mstate->__pyx_n_u_filter_from_errors, __pyx_mstate->__pyx_kp_b_iso88591_A_t_Qk, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[34])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 385};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[35] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_xmlerror_pxi, __pyx_mstate->__pyx_n_u_filter_from_warnings, __pyx_mstate->__pyx_kp_b_iso88591_A_t_Qk, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[35])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS), 444};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_args};
    __pyx_mstate_global->__pyx_codeobj_tab[36] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_xmlerror_pxi, __pyx_mstate->__pyx_n_u_exit, __pyx_mstate->__pyx_kp_b_iso88591_A_Kq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[36])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 464};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[37] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_xmlerror_pxi, __pyx_mstate->__pyx_n_u_clear, __pyx_mstate->__pyx_kp_b_iso88591_A_A_N_Kq_D, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[37])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 470};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[38] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_xmlerror_pxi, __pyx_mstate->__pyx_n_u_copy, __pyx_mstate->__pyx_kp_b_iso88591_A_A_a_t1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[38])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 480};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_entry};
    __pyx_mstate_global->__pyx_codeobj_tab[39] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_xmlerror_pxi, __pyx_mstate->__pyx_n_u_receive, __pyx_mstate->__pyx_kp_b_iso88591_A_4_S_T_g_IWAQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[39])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 490};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_entry};
    __pyx_mstate_global->__pyx_codeobj_tab[40] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_xmlerror_pxi, __pyx_mstate->__pyx_n_u_receive, __pyx_mstate->__pyx_kp_b_iso88591_A_5_4q_QfA, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[40])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 500};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_entry};
    __pyx_mstate_global->__pyx_codeobj_tab[41] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_xmlerror_pxi, __pyx_mstate->__pyx_n_u_receive, __pyx_mstate->__pyx_kp_b_iso88591_A_4_S_T_g_IWAQ_3at_b_A_A_t9Bd_Cq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[41])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 551};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[42] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_xmlerror_pxi, __pyx_mstate->__pyx_n_u_copy, __pyx_mstate->__pyx_kp_b_iso88591_A_AT_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[42])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS), 556};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_log_entry, __pyx_mstate->__pyx_n_u_message, __pyx_mstate->__pyx_n_u_args};
    __pyx_mstate_global->__pyx_codeobj_tab[43] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_xmlerror_pxi, __pyx_mstate->__pyx_n_u_log, __pyx_mstate->__pyx_kp_b_iso88591_A_E_1IXQ_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[43])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 573};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_log_entry};
    __pyx_mstate_global->__pyx_codeobj_tab[44] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_xmlerror_pxi, __pyx_mstate->__pyx_n_u_receive, __pyx_mstate->__pyx_kp_b_iso88591_A_D_D, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[44])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 623};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_log};
    __pyx_mstate_global->__pyx_codeobj_tab[45] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_xmlerror_pxi, __pyx_mstate->__pyx_n_u_use_global_python_log, __pyx_mstate->__pyx_kp_b_iso88591_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[45])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 678};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_c_doc, __pyx_mstate->__pyx_n_u_c_dtd};
    __pyx_mstate_global->__pyx_codeobj_tab[46] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_clear, __pyx_mstate->__pyx_kp_b_iso88591_A_T_a_U_6_A_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[46])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 835};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[47] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_init_2, __pyx_mstate->__pyx_kp_b_iso88591_A_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[47])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 923};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_memo};
    __pyx_mstate_global->__pyx_codeobj_tab[48] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_deepcopy, __pyx_mstate->__pyx_kp_b_iso88591_A_t9A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[48])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 927};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_c_doc, __pyx_mstate->__pyx_n_u_c_node, __pyx_mstate->__pyx_n_u_new_doc, __pyx_mstate->__pyx_n_u_root};
    __pyx_mstate_global->__pyx_codeobj_tab[49] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_copy_2, __pyx_mstate->__pyx_kp_b_iso88591_A_AT_it1_7_e1_wha_5_q_1_a_gWE_V6, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[49])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 946};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[50] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_set, __pyx_mstate->__pyx_kp_b_iso88591_A_6_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[50])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 956};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_element};
    __pyx_mstate_global->__pyx_codeobj_tab[51] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_append, __pyx_mstate->__pyx_kp_b_iso88591_A_AV1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[51])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 965};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_element};
    __pyx_mstate_global->__pyx_codeobj_tab[52] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_addnext, __pyx_mstate->__pyx_kp_b_iso88591_A_4xxs_t4z_ha_whfL0B_k_81_avQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[52])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 983};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_element};
    __pyx_mstate_global->__pyx_codeobj_tab[53] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_addprevious, __pyx_mstate->__pyx_kp_b_iso88591_A_4xxs_t4z_ha_whfG1_7_q_Q_81_q_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[53])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1002};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_elements, __pyx_mstate->__pyx_n_u_element};
    __pyx_mstate_global->__pyx_codeobj_tab[54] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_extend, __pyx_mstate->__pyx_kp_b_iso88591_A_Kq_xs_k_AQ_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[54])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1015};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_keep_tail, __pyx_mstate->__pyx_n_u_c_attr, __pyx_mstate->__pyx_n_u_c_attr_next, __pyx_mstate->__pyx_n_u_c_node, __pyx_mstate->__pyx_n_u_c_node_next};
    __pyx_mstate_global->__pyx_codeobj_tab[55] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_clear, __pyx_mstate->__pyx_kp_b_iso88591_1_Q_1F_4q_q_a_q_1_q_7_d_AQ_gWA, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[55])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1047};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_index, __pyx_mstate->__pyx_n_u_element, __pyx_mstate->__pyx_n_u_c_node, __pyx_mstate->__pyx_n_u_c_next, __pyx_mstate->__pyx_n_u_c_source_doc};
    __pyx_mstate_global->__pyx_codeobj_tab[56] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_insert, __pyx_mstate->__pyx_kp_b_iso88591_A_1D_7_Q_q_AWJd_AQ_wha_axwa_4wn, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[56])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1070};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_element, __pyx_mstate->__pyx_n_u_c_node, __pyx_mstate->__pyx_n_u_c_next};
    __pyx_mstate_global->__pyx_codeobj_tab[57] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_remove, __pyx_mstate->__pyx_kp_b_iso88591_A_6_A_a_1_4wfF, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[57])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1090};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_old_element, __pyx_mstate->__pyx_n_u_new_element, __pyx_mstate->__pyx_n_u_c_old_node, __pyx_mstate->__pyx_n_u_c_old_next, __pyx_mstate->__pyx_n_u_c_new_node, __pyx_mstate->__pyx_n_u_c_new_next, __pyx_mstate->__pyx_n_u_c_source_doc};
    __pyx_mstate_global->__pyx_codeobj_tab[58] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_replace, __pyx_mstate->__pyx_kp_b_iso88591_A_XWD_a_A_Q_AQ_Zq_Zq_z_1L_a_a_4w, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[58])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1342};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[59] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_reversed_2, __pyx_mstate->__pyx_kp_b_iso88591_A_1F_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[59])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 10, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1346};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_child, __pyx_mstate->__pyx_n_u_start, __pyx_mstate->__pyx_n_u_stop, __pyx_mstate->__pyx_n_u_k, __pyx_mstate->__pyx_n_u_l, __pyx_mstate->__pyx_n_u_c_start, __pyx_mstate->__pyx_n_u_c_stop, __pyx_mstate->__pyx_n_u_c_child, __pyx_mstate->__pyx_n_u_c_start_node};
    __pyx_mstate_global->__pyx_codeobj_tab[60] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_index, __pyx_mstate->__pyx_kp_b_iso88591_F_fA_q_7_Q_a_5_5_V3e3fCq_gQ_Qa, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[60])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1433};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_default};
    __pyx_mstate_global->__pyx_codeobj_tab[61] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_get, __pyx_mstate->__pyx_kp_b_iso88591_q_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[61])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1441};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[62] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_keys, __pyx_mstate->__pyx_kp_b_iso88591_A_j_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[62])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1450};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[63] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_values, __pyx_mstate->__pyx_kp_b_iso88591_A_j_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[63])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1459};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[64] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_items, __pyx_mstate->__pyx_kp_b_iso88591_A_j_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[64])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1468};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[65] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_getchildren, __pyx_mstate->__pyx_kp_b_iso88591_A_q_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[65])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1481};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_c_node};
    __pyx_mstate_global->__pyx_codeobj_tab[66] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_getparent, __pyx_mstate->__pyx_kp_b_iso88591_A_q_A_7_Q_1_at7, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[66])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1493};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_c_node};
    __pyx_mstate_global->__pyx_codeobj_tab[67] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_getnext, __pyx_mstate->__pyx_kp_b_iso88591_A_Qd_7_Q_1_at7, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[67])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1505};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_c_node};
    __pyx_mstate_global->__pyx_codeobj_tab[68] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_getprevious, __pyx_mstate->__pyx_kp_b_iso88591_A_a_7_Q_1_at7, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[68])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 1, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS), 1517};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_tag, __pyx_mstate->__pyx_n_u_preceding, __pyx_mstate->__pyx_n_u_tags};
    __pyx_mstate_global->__pyx_codeobj_tab[69] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_itersiblings, __pyx_mstate->__pyx_kp_b_iso88591_6a_1_t9D_D_q_d_ha_1_4wa_Q_q_fJa, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[69])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS), 1540};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_tag, __pyx_mstate->__pyx_n_u_tags};
    __pyx_mstate_global->__pyx_codeobj_tab[70] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_iterancestors, __pyx_mstate->__pyx_kp_b_iso88591_4y_D_HA_1_4wa_Q_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[70])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS), 1554};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_tag, __pyx_mstate->__pyx_n_u_tags};
    __pyx_mstate_global->__pyx_codeobj_tab[71] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_iterdescendants, __pyx_mstate->__pyx_kp_b_iso88591_4y_D_HA_1_4wa_Q_vZq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[71])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 1, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS), 1569};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_tag, __pyx_mstate->__pyx_n_u_reversed, __pyx_mstate->__pyx_n_u_tags};
    __pyx_mstate_global->__pyx_codeobj_tab[72] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_iterchildren, __pyx_mstate->__pyx_kp_b_iso88591_5Q_4y_D_HA_1_4wa_Q_1F, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[72])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1584};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[73] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_getroottree, __pyx_mstate->__pyx_kp_b_iso88591_A_q_A_4wa, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[73])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS), 1596};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_tag, __pyx_mstate->__pyx_n_u_tags};
    __pyx_mstate_global->__pyx_codeobj_tab[74] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_getiterator, __pyx_mstate->__pyx_kp_b_iso88591_a_4wa_Q_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[74])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS), 1618};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_tag, __pyx_mstate->__pyx_n_u_tags};
    __pyx_mstate_global->__pyx_codeobj_tab[75] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_iter, __pyx_mstate->__pyx_kp_b_iso88591_q_4wa_Q_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[75])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 1, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS), 1642};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_tag, __pyx_mstate->__pyx_n_u_with_tail, __pyx_mstate->__pyx_n_u_tags};
    __pyx_mstate_global->__pyx_codeobj_tab[76] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_itertext, __pyx_mstate->__pyx_kp_b_iso88591_2_4wa_Q_6_z, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[76])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS), 1657};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_tag_2, __pyx_mstate->__pyx_n_u_attrib, __pyx_mstate->__pyx_n_u_nsmap, __pyx_mstate->__pyx_n_u_extra};
    __pyx_mstate_global->__pyx_codeobj_tab[77] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_makeelement, __pyx_mstate->__pyx_kp_b_iso88591_1_q_A_1F_G6_q_G1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[77])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1666};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_path, __pyx_mstate->__pyx_n_u_namespaces};
    __pyx_mstate_global->__pyx_codeobj_tab[78] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_find, __pyx_mstate->__pyx_kp_b_iso88591_A_QfA_G5_5_v_t_Z, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[78])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1679};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_path, __pyx_mstate->__pyx_n_u_default, __pyx_mstate->__pyx_n_u_namespaces};
    __pyx_mstate_global->__pyx_codeobj_tab[79] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_findtext, __pyx_mstate->__pyx_kp_b_iso88591_6a_QfA_G5_9AV6_nTXXgghhi, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[79])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1692};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_path, __pyx_mstate->__pyx_n_u_namespaces};
    __pyx_mstate_global->__pyx_codeobj_tab[80] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_findall, __pyx_mstate->__pyx_kp_b_iso88591_q_QfA_G5_81F_N_o, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[80])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1705};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_path, __pyx_mstate->__pyx_n_u_namespaces};
    __pyx_mstate_global->__pyx_codeobj_tab[81] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_iterfind, __pyx_mstate->__pyx_kp_b_iso88591_QfA_G5_9AV6_4, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[81])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 3, 7, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS), 1718};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_path_2, __pyx_mstate->__pyx_n_u_namespaces, __pyx_mstate->__pyx_n_u_extensions, __pyx_mstate->__pyx_n_u_smart_strings, __pyx_mstate->__pyx_n_u_variables_2, __pyx_mstate->__pyx_n_u_evaluator};
    __pyx_mstate_global->__pyx_codeobj_tab[82] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_xpath, __pyx_mstate->__pyx_kp_b_iso88591_1_5Q_8_y, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[82])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 1, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1729};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_expr, __pyx_mstate->__pyx_n_u_translator, __pyx_mstate->__pyx_n_u_CSSSelector};
    __pyx_mstate_global->__pyx_codeobj_tab[83] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_cssselect, __pyx_mstate->__pyx_kp_b_iso88591_A_1_6_Kq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[83])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1777};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[84] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_set, __pyx_mstate->__pyx_kp_b_iso88591_A_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[84])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1781};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[85] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_append, __pyx_mstate->__pyx_kp_b_iso88591_A_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[85])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1785};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_index, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[86] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_insert, __pyx_mstate->__pyx_kp_b_iso88591_A_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[86])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1824};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_default};
    __pyx_mstate_global->__pyx_codeobj_tab[87] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_get, __pyx_mstate->__pyx_kp_b_iso88591_q_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[87])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1828};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[88] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_keys, __pyx_mstate->__pyx_kp_b_iso88591_A_q_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[88])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1832};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[89] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_items, __pyx_mstate->__pyx_kp_b_iso88591_A_q_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[89])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1836};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[90] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_values, __pyx_mstate->__pyx_kp_b_iso88591_A_q_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[90])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1872};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_default};
    __pyx_mstate_global->__pyx_codeobj_tab[91] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_get, __pyx_mstate->__pyx_kp_b_iso88591_q_t7_auA, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[91])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 1, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2016};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_source, __pyx_mstate->__pyx_n_u_parser, __pyx_mstate->__pyx_n_u_base_url, __pyx_mstate->__pyx_n_u_doc_2, __pyx_mstate->__pyx_n_u_result_container};
    __pyx_mstate_global->__pyx_codeobj_tab[92] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_parse, __pyx_mstate->__pyx_kp_b_iso88591_A_Q_a_1_HA_HHD_wj_t1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[92])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2032};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_root};
    __pyx_mstate_global->__pyx_codeobj_tab[93] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_setroot, __pyx_mstate->__pyx_kp_b_iso88591_A_4xvWA_Q_Q_HA, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[93])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2043};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[94] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_getroot, __pyx_mstate->__pyx_kp_b_iso88591_A_t1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[94])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2050};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[95] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_copy_2, __pyx_mstate->__pyx_kp_b_iso88591_A_4wd, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[95])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2053};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_memo, __pyx_mstate->__pyx_n_u_root, __pyx_mstate->__pyx_n_u_doc_2, __pyx_mstate->__pyx_n_u_c_doc};
    __pyx_mstate_global->__pyx_codeobj_tab[96] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_deepcopy, __pyx_mstate->__pyx_kp_b_iso88591_A_4_gQ_4_Ya_5_q_AQ_1D_j_A_avQ_wa, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[96])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 13, 20, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2093};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_file, __pyx_mstate->__pyx_n_u_encoding, __pyx_mstate->__pyx_n_u_method, __pyx_mstate->__pyx_n_u_pretty_print, __pyx_mstate->__pyx_n_u_xml_declaration, __pyx_mstate->__pyx_n_u_with_tail, __pyx_mstate->__pyx_n_u_standalone, __pyx_mstate->__pyx_n_u_doctype, __pyx_mstate->__pyx_n_u_compression, __pyx_mstate->__pyx_n_u_exclusive, __pyx_mstate->__pyx_n_u_inclusive_ns_prefixes, __pyx_mstate->__pyx_n_u_with_comments, __pyx_mstate->__pyx_n_u_strip_text, __pyx_mstate->__pyx_n_u_docstring, __pyx_mstate->__pyx_n_u_write_declaration, __pyx_mstate->__pyx_n_u_is_standalone, __pyx_mstate->__pyx_n_u_f, __pyx_mstate->__pyx_n_u_target, __pyx_mstate->__pyx_n_u_warnings};
    __pyx_mstate_global->__pyx_codeobj_tab[97] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_write, __pyx_mstate->__pyx_kp_b_iso88591_m1_77LA_9_7q_O1_Q_s_s_b_7_ha_y, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[97])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 7, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2203};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_element, __pyx_mstate->__pyx_n_u_doc_2, __pyx_mstate->__pyx_n_u_root, __pyx_mstate->__pyx_n_u_c_doc, __pyx_mstate->__pyx_n_u_c_path, __pyx_mstate->__pyx_n_u_path};
    __pyx_mstate_global->__pyx_codeobj_tab[98] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_getpath, __pyx_mstate->__pyx_kp_b_iso88591_A_4_gQ_4q_a_wa_a_3ha_a_q_7_q_a_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[98])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 10, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2241};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_element, __pyx_mstate->__pyx_n_u_root, __pyx_mstate->__pyx_n_u_count, __pyx_mstate->__pyx_n_u_path, __pyx_mstate->__pyx_n_u_c_element, __pyx_mstate->__pyx_n_u_c_name, __pyx_mstate->__pyx_n_u_c_href, __pyx_mstate->__pyx_n_u_tag, __pyx_mstate->__pyx_n_u_c_node};
    __pyx_mstate_global->__pyx_codeobj_tab[99] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_getelementpath, __pyx_mstate->__pyx_kp_b_iso88591_A_7_q_a_4_gQ_4q_wa_4uHA_a_7_t1_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[99])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS), 2305};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_tag, __pyx_mstate->__pyx_n_u_tags, __pyx_mstate->__pyx_n_u_root};
    __pyx_mstate_global->__pyx_codeobj_tab[100] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_getiterator, __pyx_mstate->__pyx_kp_b_iso88591_a_t81_5_1_1_4wa_Q_t_r, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[100])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS), 2329};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_tag, __pyx_mstate->__pyx_n_u_tags, __pyx_mstate->__pyx_n_u_root};
    __pyx_mstate_global->__pyx_codeobj_tab[101] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_iter, __pyx_mstate->__pyx_kp_b_iso88591_q_t81_5_1_1_4wa_Q_t5, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[101])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2347};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_path, __pyx_mstate->__pyx_n_u_namespaces, __pyx_mstate->__pyx_n_u_root, __pyx_mstate->__pyx_n_u_warn};
    __pyx_mstate_global->__pyx_codeobj_tab[102] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_find, __pyx_mstate->__pyx_kp_b_iso88591_A_O1_t81_9AQ_t2S_1_t2Q_Q_A_q_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[102])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2371};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_path, __pyx_mstate->__pyx_n_u_default, __pyx_mstate->__pyx_n_u_namespaces, __pyx_mstate->__pyx_n_u_root, __pyx_mstate->__pyx_n_u_warn};
    __pyx_mstate_global->__pyx_codeobj_tab[103] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_findtext, __pyx_mstate->__pyx_kp_b_iso88591_6a_O1_t81_9AQ_t2S_1_t2Q_Q_A_q_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[103])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2395};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_path, __pyx_mstate->__pyx_n_u_namespaces, __pyx_mstate->__pyx_n_u_root, __pyx_mstate->__pyx_n_u_warn};
    __pyx_mstate_global->__pyx_codeobj_tab[104] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_findall, __pyx_mstate->__pyx_kp_b_iso88591_q_O1_t81_9AQ_t2S_1_t2Q_Q_A_q_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[104])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2419};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_path, __pyx_mstate->__pyx_n_u_namespaces, __pyx_mstate->__pyx_n_u_root, __pyx_mstate->__pyx_n_u_warn};
    __pyx_mstate_global->__pyx_codeobj_tab[105] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_iterfind, __pyx_mstate->__pyx_kp_b_iso88591_O1_t81_9AQ_t2S_1_t2Q_Q_A_q_a_t9, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[105])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 3, 7, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS), 2443};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_path_2, __pyx_mstate->__pyx_n_u_namespaces, __pyx_mstate->__pyx_n_u_extensions, __pyx_mstate->__pyx_n_u_smart_strings, __pyx_mstate->__pyx_n_u_variables_2, __pyx_mstate->__pyx_n_u_evaluator};
    __pyx_mstate_global->__pyx_codeobj_tab[106] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_xpath, __pyx_mstate->__pyx_kp_b_iso88591_O1_6_A_6a_9_y, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[106])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS), 2468};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_xslt, __pyx_mstate->__pyx_n_u_extensions, __pyx_mstate->__pyx_n_u_access_control, __pyx_mstate->__pyx_n_u_kw, __pyx_mstate->__pyx_n_u_style};
    __pyx_mstate_global->__pyx_codeobj_tab[107] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_xslt_3, __pyx_mstate->__pyx_kp_b_iso88591_O1_AWKq_A_uAXQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[107])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2487};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_relaxng, __pyx_mstate->__pyx_n_u_schema};
    __pyx_mstate_global->__pyx_codeobj_tab[108] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_relaxng, __pyx_mstate->__pyx_kp_b_iso88591_A_O1_vYaq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[108])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2505};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_xmlschema, __pyx_mstate->__pyx_n_u_schema};
    __pyx_mstate_global->__pyx_codeobj_tab[109] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_xmlschema, __pyx_mstate->__pyx_kp_b_iso88591_A_O1_1_vYaq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[109])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2523};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[110] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_xinclude, __pyx_mstate->__pyx_kp_b_iso88591_A_O1_4q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[110])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 4, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2538};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_file, __pyx_mstate->__pyx_n_u_exclusive, __pyx_mstate->__pyx_n_u_with_comments, __pyx_mstate->__pyx_n_u_compression, __pyx_mstate->__pyx_n_u_inclusive_ns_prefixes};
    __pyx_mstate_global->__pyx_codeobj_tab[111] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_write_c14n, __pyx_mstate->__pyx_kp_b_iso88591_11K1_8_O1_Q_s_s_b_q_d_2_Q_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[111])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2605};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_sequence_or_dict, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[112] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_update, __pyx_mstate->__pyx_kp_b_iso88591_A_Q_Q_q_vQ_E_at_e1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[112])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS), 2612};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_default, __pyx_mstate->__pyx_n_u_result};
    __pyx_mstate_global->__pyx_codeobj_tab[113] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_pop, __pyx_mstate->__pyx_kp_b_iso88591_A_3ay_EQc_RSST_Q_1D_5_7_Q_t1_j_W, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[113])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2625};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_c_attrs};
    __pyx_mstate_global->__pyx_codeobj_tab[114] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_clear, __pyx_mstate->__pyx_kp_b_iso88591_A_Q_ixq_1_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[114])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2637};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[115] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_copy_2, __pyx_mstate->__pyx_kp_b_iso88591_A_Q_t1_at9Ja, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[115])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2641};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_memo};
    __pyx_mstate_global->__pyx_codeobj_tab[116] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_deepcopy, __pyx_mstate->__pyx_kp_b_iso88591_A_Q_t1_at9Ja, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[116])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2671};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_default};
    __pyx_mstate_global->__pyx_codeobj_tab[117] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_get, __pyx_mstate->__pyx_kp_b_iso88591_q_Q_k_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[117])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2675};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[118] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_keys, __pyx_mstate->__pyx_kp_b_iso88591_A_Q_iz, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[118])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2683};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[119] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_iterkeys, __pyx_mstate->__pyx_kp_b_iso88591_A_Q_t1_at9Ja, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[119])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2687};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[120] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_values, __pyx_mstate->__pyx_kp_b_iso88591_A_Q_iz, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[120])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2691};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[121] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_itervalues, __pyx_mstate->__pyx_kp_b_iso88591_A_Q_t1_at9Ja, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[121])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2695};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[122] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_items, __pyx_mstate->__pyx_kp_b_iso88591_A_Q_iz, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[122])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2699};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[123] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_iteritems, __pyx_mstate->__pyx_kp_b_iso88591_A_Q_t1_at9Ja, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[123])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2703};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key};
    __pyx_mstate_global->__pyx_codeobj_tab[124] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_has_key, __pyx_mstate->__pyx_kp_b_iso88591_A_Q_t3a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[124])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS), 3208};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_cls, __pyx_mstate->__pyx_n_u_tag_2, __pyx_mstate->__pyx_n_u_attrib, __pyx_mstate->__pyx_n_u_nsmap, __pyx_mstate->__pyx_n_u_extra};
    __pyx_mstate_global->__pyx_codeobj_tab[125] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_new, __pyx_mstate->__pyx_kp_b_iso88591_QfF_fA_gQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[125])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3216};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_text, __pyx_mstate->__pyx_n_u_doc_2, __pyx_mstate->__pyx_n_u_c_node, __pyx_mstate->__pyx_n_u_c_doc};
    __pyx_mstate_global->__pyx_codeobj_tab[126] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_Comment, __pyx_mstate->__pyx_kp_b_iso88591_A_uCq_q_uAQ_6_E_D_AQ_Ja_7_1G6_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[126])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3240};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_target, __pyx_mstate->__pyx_n_u_text, __pyx_mstate->__pyx_n_u_doc_2, __pyx_mstate->__pyx_n_u_c_node, __pyx_mstate->__pyx_n_u_c_doc};
    __pyx_mstate_global->__pyx_codeobj_tab[127] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_ProcessingInstruction, __pyx_mstate->__pyx_kp_b_iso88591_U_1_AQ_vV3c_l_Qa_uCq_q_uAQ_6_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[127])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3290};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_name, __pyx_mstate->__pyx_n_u_doc_2, __pyx_mstate->__pyx_n_u_c_node, __pyx_mstate->__pyx_n_u_c_doc, __pyx_mstate->__pyx_n_u_name_utf, __pyx_mstate->__pyx_n_u_c_name};
    __pyx_mstate_global->__pyx_codeobj_tab[128] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_Entity, __pyx_mstate->__pyx_kp_b_iso88591_uAQ_V1A_vQc_A_4_1_aq__AQ_l_7q_J, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[128])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS), 3316};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_parent, __pyx_mstate->__pyx_n_u_tag_2, __pyx_mstate->__pyx_n_u_attrib, __pyx_mstate->__pyx_n_u_nsmap, __pyx_mstate->__pyx_n_u_extra};
    __pyx_mstate_global->__pyx_codeobj_tab[129] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_SubElement, __pyx_mstate->__pyx_kp_b_iso88591_A_9F_hgQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[129])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 2, 11, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3330};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_cls, __pyx_mstate->__pyx_n_u_element, __pyx_mstate->__pyx_n_u_file, __pyx_mstate->__pyx_n_u_parser, __pyx_mstate->__pyx_n_u_c_next, __pyx_mstate->__pyx_n_u_c_node, __pyx_mstate->__pyx_n_u_c_node_copy, __pyx_mstate->__pyx_n_u_c_doc, __pyx_mstate->__pyx_n_u_etree, __pyx_mstate->__pyx_n_u_doc_2, __pyx_mstate->__pyx_n_u_result_container};
    __pyx_mstate_global->__pyx_codeobj_tab[130] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_new, __pyx_mstate->__pyx_kp_b_iso88591_87_7_nAV81_q_Ja_7_5, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[130])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 1, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3361};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_text, __pyx_mstate->__pyx_n_u_parser, __pyx_mstate->__pyx_n_u_base_url, __pyx_mstate->__pyx_n_u_doc_2, __pyx_mstate->__pyx_n_u_result_container};
    __pyx_mstate_global->__pyx_codeobj_tab[131] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_HTML, __pyx_mstate->__pyx_kp_b_iso88591_1_wc_9_4z_Q_6_1_s_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[131])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 1, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3387};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_text, __pyx_mstate->__pyx_n_u_parser, __pyx_mstate->__pyx_n_u_base_url, __pyx_mstate->__pyx_n_u_doc_2, __pyx_mstate->__pyx_n_u_result_container};
    __pyx_mstate_global->__pyx_codeobj_tab[132] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_XML, __pyx_mstate->__pyx_kp_b_iso88591_wc_9_4z_Q_6_1_s_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[132])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 1, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3418};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_text, __pyx_mstate->__pyx_n_u_parser, __pyx_mstate->__pyx_n_u_base_url, __pyx_mstate->__pyx_n_u_doc_2, __pyx_mstate->__pyx_n_u_result_container};
    __pyx_mstate_global->__pyx_codeobj_tab[133] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_fromstring, __pyx_mstate->__pyx_kp_b_iso88591_1_6_1_s_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[133])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3439};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_strings, __pyx_mstate->__pyx_n_u_parser, __pyx_mstate->__pyx_n_u_doc_2, __pyx_mstate->__pyx_n_u_feed, __pyx_mstate->__pyx_n_u_data};
    __pyx_mstate_global->__pyx_codeobj_tab[134] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_fromstringlist, __pyx_mstate->__pyx_kp_b_iso88591_A_z_G1_j_wc_9_6_AQ_6_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[134])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3460};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_element};
    __pyx_mstate_global->__pyx_codeobj_tab[135] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_iselement, __pyx_mstate->__pyx_kp_b_iso88591_Qiz_j_PQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[135])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 1, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3468};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_tree, __pyx_mstate->__pyx_n_u_space, __pyx_mstate->__pyx_n_u_level, __pyx_mstate->__pyx_n_u_root, __pyx_mstate->__pyx_n_u_indent};
    __pyx_mstate_global->__pyx_codeobj_tab[136] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_indent, __pyx_mstate->__pyx_kp_b_iso88591_1A_vRq_j_Gq_y_Q_Qa_r_r_Zs_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[136])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 2, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3519};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_elem, __pyx_mstate->__pyx_n_u_pretty_print, __pyx_mstate->__pyx_n_u_with_tail, __pyx_mstate->__pyx_n_u_xml};
    __pyx_mstate_global->__pyx_codeobj_tab[137] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_dump, __pyx_mstate->__pyx_kp_b_iso88591_A_6_nJk_RS_t1_q_wfAQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[137])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 11, 16, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3531};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_element_or_tree, __pyx_mstate->__pyx_n_u_encoding, __pyx_mstate->__pyx_n_u_method, __pyx_mstate->__pyx_n_u_xml_declaration, __pyx_mstate->__pyx_n_u_pretty_print, __pyx_mstate->__pyx_n_u_with_tail, __pyx_mstate->__pyx_n_u_standalone, __pyx_mstate->__pyx_n_u_doctype, __pyx_mstate->__pyx_n_u_exclusive, __pyx_mstate->__pyx_n_u_inclusive_ns_prefixes, __pyx_mstate->__pyx_n_u_with_comments, __pyx_mstate->__pyx_n_u_strip_text, __pyx_mstate->__pyx_n_u_write_declaration, __pyx_mstate->__pyx_n_u_is_standalone, __pyx_mstate->__pyx_n_u_out, __pyx_mstate->__pyx_n_u_target};
    __pyx_mstate_global->__pyx_codeobj_tab[138] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_tostring, __pyx_mstate->__pyx_kp_b_iso88591_A_a_1_aj_wd_9G1_AQ_1_AQ_7_Q_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[138])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS|CO_VARKEYWORDS), 3644};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_element_or_tree, __pyx_mstate->__pyx_n_u_args, __pyx_mstate->__pyx_n_u_kwargs};
    __pyx_mstate_global->__pyx_codeobj_tab[139] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_tostringlist, __pyx_mstate->__pyx_kp_b_iso88591_1HA_xq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[139])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 4, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3656};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_element_or_tree, __pyx_mstate->__pyx_n_u_method, __pyx_mstate->__pyx_n_u_pretty_print, __pyx_mstate->__pyx_n_u_with_tail, __pyx_mstate->__pyx_n_u_doctype};
    __pyx_mstate_global->__pyx_codeobj_tab[140] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_tounicode, __pyx_mstate->__pyx_kp_b_iso88591_1_z_1_y_4IYa_S_l_1_Q_y_8_83c_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[140])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 1, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3690};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_source, __pyx_mstate->__pyx_n_u_parser, __pyx_mstate->__pyx_n_u_base_url, __pyx_mstate->__pyx_n_u_doc_2, __pyx_mstate->__pyx_n_u_result_container};
    __pyx_mstate_global->__pyx_codeobj_tab[141] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_parse, __pyx_mstate->__pyx_kp_b_iso88591_a2_nAXXQ_5_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[141])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3722};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_capsule, __pyx_mstate->__pyx_n_u_parser, __pyx_mstate->__pyx_n_u_c_doc, __pyx_mstate->__pyx_n_u_is_owned, __pyx_mstate->__pyx_n_u_doc_2};
    __pyx_mstate_global->__pyx_codeobj_tab[142] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_adopt_external_document, __pyx_mstate->__pyx_kp_b_iso88591_Q_7q_7_auA, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[142])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 160};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_memo};
    __pyx_mstate_global->__pyx_codeobj_tab[143] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_readonlytree_pxi, __pyx_mstate->__pyx_n_u_deepcopy, __pyx_mstate->__pyx_kp_b_iso88591_A_t9A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[143])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 164};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[144] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_readonlytree_pxi, __pyx_mstate->__pyx_n_u_copy_2, __pyx_mstate->__pyx_kp_b_iso88591_A_4y_1_1_AT_t1_7_wha_5_q_1_a_gWE, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[144])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 1, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 187};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_tag, __pyx_mstate->__pyx_n_u_reversed, __pyx_mstate->__pyx_n_u_children, __pyx_mstate->__pyx_n_u_el};
    __pyx_mstate_global->__pyx_codeobj_tab[145] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_readonlytree_pxi, __pyx_mstate->__pyx_n_u_iterchildren, __pyx_mstate->__pyx_kp_b_iso88591_1_4_1_4we4t3a_r_D_is_E_A_1_xt1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[145])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 199};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[146] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_readonlytree_pxi, __pyx_mstate->__pyx_n_u_getchildren, __pyx_mstate->__pyx_kp_b_iso88591_A_L_XQ_gWA_aq_gQ_q_4DA_V1_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[146])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 214};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_c_parent};
    __pyx_mstate_global->__pyx_codeobj_tab[147] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_readonlytree_pxi, __pyx_mstate->__pyx_n_u_getparent, __pyx_mstate->__pyx_kp_b_iso88591_A_L_4xq_9CuCx_1_1_AT_9, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[147])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 225};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_c_node};
    __pyx_mstate_global->__pyx_codeobj_tab[148] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_readonlytree_pxi, __pyx_mstate->__pyx_n_u_getnext, __pyx_mstate->__pyx_kp_b_iso88591_A_L_Qd_7_AT_9_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[148])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 235};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_c_node};
    __pyx_mstate_global->__pyx_codeobj_tab[149] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_readonlytree_pxi, __pyx_mstate->__pyx_n_u_getprevious, __pyx_mstate->__pyx_kp_b_iso88591_A_L_a_7_AT_9_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[149])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 304};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_default};
    __pyx_mstate_global->__pyx_codeobj_tab[150] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_readonlytree_pxi, __pyx_mstate->__pyx_n_u_get, __pyx_mstate->__pyx_kp_b_iso88591_q_L_Qd_E, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[150])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 310};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[151] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_readonlytree_pxi, __pyx_mstate->__pyx_n_u_keys, __pyx_mstate->__pyx_kp_b_iso88591_A_L_j, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[151])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 317};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[152] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_readonlytree_pxi, __pyx_mstate->__pyx_n_u_values, __pyx_mstate->__pyx_kp_b_iso88591_A_L_j, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[152])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 324};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[153] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_readonlytree_pxi, __pyx_mstate->__pyx_n_u_items, __pyx_mstate->__pyx_kp_b_iso88591_A_L_j, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[153])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 390};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_other_element};
    __pyx_mstate_global->__pyx_codeobj_tab[154] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_readonlytree_pxi, __pyx_mstate->__pyx_n_u_append, __pyx_mstate->__pyx_kp_b_iso88591_A_L_1_6_wa_t_WA_l_6_7q_LAVST_q_d, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[154])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 407};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_elements, __pyx_mstate->__pyx_n_u_element};
    __pyx_mstate_global->__pyx_codeobj_tab[155] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_readonlytree_pxi, __pyx_mstate->__pyx_n_u_extend, __pyx_mstate->__pyx_kp_b_iso88591_A_L_Kq_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[155])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 487};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_other_element};
    __pyx_mstate_global->__pyx_codeobj_tab[156] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_readonlytree_pxi, __pyx_mstate->__pyx_n_u_append, __pyx_mstate->__pyx_kp_b_iso88591_A_L_1_q_HA_q_Zq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[156])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 499};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_elements, __pyx_mstate->__pyx_n_u_element};
    __pyx_mstate_global->__pyx_codeobj_tab[157] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_readonlytree_pxi, __pyx_mstate->__pyx_n_u_extend, __pyx_mstate->__pyx_kp_b_iso88591_A_L_Kq_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[157])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 248};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_lookup};
    __pyx_mstate_global->__pyx_codeobj_tab[158] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_classlookup_pxi, __pyx_mstate->__pyx_n_u_set_fallback, __pyx_mstate->__pyx_kp_b_iso88591_A_M, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[158])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {5, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 430};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_type, __pyx_mstate->__pyx_n_u_doc_2, __pyx_mstate->__pyx_n_u_namespace, __pyx_mstate->__pyx_n_u_name};
    __pyx_mstate_global->__pyx_codeobj_tab[159] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_classlookup_pxi, __pyx_mstate->__pyx_n_u_lookup, __pyx_mstate->__pyx_kp_b_iso88591_A_q_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[159])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 512};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_doc_2, __pyx_mstate->__pyx_n_u_element};
    __pyx_mstate_global->__pyx_codeobj_tab[160] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_classlookup_pxi, __pyx_mstate->__pyx_n_u_lookup, __pyx_mstate->__pyx_kp_b_iso88591_A_q_4, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[160])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 549};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_lookup};
    __pyx_mstate_global->__pyx_codeobj_tab[161] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_classlookup_pxi, __pyx_mstate->__pyx_n_u_set_element_class_lookup, __pyx_mstate->__pyx_kp_b_iso88591_Q_wc_c_1_A_avQ_av, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[161])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 29};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_class_dict_iterable, __pyx_mstate->__pyx_n_u_name, __pyx_mstate->__pyx_n_u_item};
    __pyx_mstate_global->__pyx_codeobj_tab[162] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_nsclasses_pxi, __pyx_mstate->__pyx_n_u_update, __pyx_mstate->__pyx_kp_b_iso88591_A_7_5V1_F_S_S_Bc_E_XQa_AXQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[162])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 74};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[163] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_nsclasses_pxi, __pyx_mstate->__pyx_n_u_items, __pyx_mstate->__pyx_kp_b_iso88591_A_t1D_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[163])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 77};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[164] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_nsclasses_pxi, __pyx_mstate->__pyx_n_u_iteritems, __pyx_mstate->__pyx_kp_b_iso88591_A_t1D_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[164])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 80};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[165] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_nsclasses_pxi, __pyx_mstate->__pyx_n_u_clear, __pyx_mstate->__pyx_kp_b_iso88591_A_IV1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[165])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 99};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_name, __pyx_mstate->__pyx_n_u_obj};
    __pyx_mstate_global->__pyx_codeobj_tab[166] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_nsclasses_pxi, __pyx_mstate->__pyx_n_u_deco, __pyx_mstate->__pyx_kp_b_iso88591_A_AXQ_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[166])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 147};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_ns_uri, __pyx_mstate->__pyx_n_u_ns_utf, __pyx_mstate->__pyx_n_u_registry};
    __pyx_mstate_global->__pyx_codeobj_tab[167] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_nsclasses_pxi, __pyx_mstate->__pyx_n_u_get_namespace, __pyx_mstate->__pyx_kp_b_iso88591_A_1_U_1_Q_4_Qa_t_1_aq_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[167])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 207};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_ns_uri, __pyx_mstate->__pyx_n_u_ns_utf, __pyx_mstate->__pyx_n_u_registry};
    __pyx_mstate_global->__pyx_codeobj_tab[168] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_nsclasses_pxi, __pyx_mstate->__pyx_n_u_FunctionNamespace, __pyx_mstate->__pyx_kp_b_iso88591_U_l_aq_2_1_2_1_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[168])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 25};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_system_url, __pyx_mstate->__pyx_n_u_public_id, __pyx_mstate->__pyx_n_u_context};
    __pyx_mstate_global->__pyx_codeobj_tab[169] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_docloader_pxi, __pyx_mstate->__pyx_n_u_resolve, __pyx_mstate->__pyx_kp_b_iso88591_A_q_5, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[169])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 36};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_context, __pyx_mstate->__pyx_n_u_doc_ref};
    __pyx_mstate_global->__pyx_codeobj_tab[170] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_docloader_pxi, __pyx_mstate->__pyx_n_u_resolve_empty, __pyx_mstate->__pyx_kp_b_iso88591_A_y_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[170])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 1, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 48};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_string_2, __pyx_mstate->__pyx_n_u_context, __pyx_mstate->__pyx_n_u_base_url, __pyx_mstate->__pyx_n_u_doc_ref};
    __pyx_mstate_global->__pyx_codeobj_tab[171] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_docloader_pxi, __pyx_mstate->__pyx_n_u_resolve_string, __pyx_mstate->__pyx_kp_b_iso88591_Qha_iwgQa_1HA_Q_y_a_9G1_q_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[171])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 69};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_filename, __pyx_mstate->__pyx_n_u_context, __pyx_mstate->__pyx_n_u_doc_ref};
    __pyx_mstate_global->__pyx_codeobj_tab[172] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_docloader_pxi, __pyx_mstate->__pyx_n_u_resolve_filename, __pyx_mstate->__pyx_kp_b_iso88591_A_y_O1A_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[172])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 2, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 83};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_f, __pyx_mstate->__pyx_n_u_context, __pyx_mstate->__pyx_n_u_base_url, __pyx_mstate->__pyx_n_u_close, __pyx_mstate->__pyx_n_u_doc_ref};
    __pyx_mstate_global->__pyx_codeobj_tab[173] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_docloader_pxi, __pyx_mstate->__pyx_n_u_resolve_file, __pyx_mstate->__pyx_kp_b_iso88591_33DA_Q_Q_y_9G1_q_31A_a_y_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[173])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 120};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_resolver};
    __pyx_mstate_global->__pyx_codeobj_tab[174] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_docloader_pxi, __pyx_mstate->__pyx_n_u_add, __pyx_mstate->__pyx_kp_b_iso88591_A_Kt1A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[174])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 133};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_resolver};
    __pyx_mstate_global->__pyx_codeobj_tab[175] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_docloader_pxi, __pyx_mstate->__pyx_n_u_remove, __pyx_mstate->__pyx_kp_b_iso88591_A_Kxq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[175])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 143};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[176] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_docloader_pxi, __pyx_mstate->__pyx_n_u_copy, __pyx_mstate->__pyx_kp_b_iso88591_A_t6, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[176])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 147};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_system_url, __pyx_mstate->__pyx_n_u_public_id, __pyx_mstate->__pyx_n_u_context, __pyx_mstate->__pyx_n_u_resolver, __pyx_mstate->__pyx_n_u_result};
    __pyx_mstate_global->__pyx_codeobj_tab[177] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_docloader_pxi, __pyx_mstate->__pyx_n_u_resolve, __pyx_mstate->__pyx_kp_b_iso88591_A_L_A_XXQl_Q_wgQ_q_4_Q_1_t_XQl_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[177])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 11};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_cls, __pyx_mstate->__pyx_n_u_item};
    __pyx_mstate_global->__pyx_codeobj_tab[178] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_parser_pxi, __pyx_mstate->__pyx_n_u_GenericAlias_2, __pyx_mstate->__pyx_kp_b_iso88591_A_r_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[178])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {6, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 20};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_message, __pyx_mstate->__pyx_n_u_code, __pyx_mstate->__pyx_n_u_line_2, __pyx_mstate->__pyx_n_u_column_2, __pyx_mstate->__pyx_n_u_filename};
    __pyx_mstate_global->__pyx_codeobj_tab[179] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_parser_pxi, __pyx_mstate->__pyx_n_u_init, __pyx_mstate->__pyx_kp_b_iso88591_4A_Qm5_IT_F_1_HA_L, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[179])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 26};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[180] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_parser_pxi, __pyx_mstate->__pyx_n_u_position, __pyx_mstate->__pyx_kp_b_iso88591_A_t9D, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[180])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 30};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_new_pos, __pyx_mstate->__pyx_n_u_column_2};
    __pyx_mstate_global->__pyx_codeobj_tab[181] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_parser_pxi, __pyx_mstate->__pyx_n_u_position, __pyx_mstate->__pyx_kp_b_iso88591_A_IYa_JgRq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[181])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1030};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_lookup};
    __pyx_mstate_global->__pyx_codeobj_tab[182] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_parser_pxi, __pyx_mstate->__pyx_n_u_set_element_class_lookup, __pyx_mstate->__pyx_kp_b_iso88591_C1_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[182])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1057};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[183] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_parser_pxi, __pyx_mstate->__pyx_n_u_copy, __pyx_mstate->__pyx_kp_b_iso88591_A_t6_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[183])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS), 1064};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_tag_2, __pyx_mstate->__pyx_n_u_attrib, __pyx_mstate->__pyx_n_u_nsmap, __pyx_mstate->__pyx_n_u_extra};
    __pyx_mstate_global->__pyx_codeobj_tab[184] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_parser_pxi, __pyx_mstate->__pyx_n_u_makeelement, __pyx_mstate->__pyx_kp_b_iso88591_1_1F_fF_G1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[184])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1361};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_data};
    __pyx_mstate_global->__pyx_codeobj_tab[185] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_parser_pxi, __pyx_mstate->__pyx_n_u_feed, __pyx_mstate->__pyx_kp_b_iso88591_A4_D_0_1_QfA_t_c_Q_T_Qa_31A_Q_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[185])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1485};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[186] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_parser_pxi, __pyx_mstate->__pyx_n_u_close, __pyx_mstate->__pyx_kp_b_iso88591_A_4t1_B_Q_Q_A_q_A_4q_QgV3a_1G6_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[186])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1683};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_cls, __pyx_mstate->__pyx_n_u_item};
    __pyx_mstate_global->__pyx_codeobj_tab[187] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_parser_pxi, __pyx_mstate->__pyx_n_u_class_getitem, __pyx_mstate->__pyx_kp_b_iso88591_A_AU, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[187])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1712};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[188] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_parser_pxi, __pyx_mstate->__pyx_n_u_read_events, __pyx_mstate->__pyx_kp_b_iso88591_A_D_c, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[188])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1766};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_parser};
    __pyx_mstate_global->__pyx_codeobj_tab[189] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_parser_pxi, __pyx_mstate->__pyx_n_u_set_default_parser, __pyx_mstate->__pyx_kp_b_iso88591_q_wc_AQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[189])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 0, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1782};
    PyObject* const varnames[] = {0};
    __pyx_mstate_global->__pyx_codeobj_tab[190] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_parser_pxi, __pyx_mstate->__pyx_n_u_get_default_parser, __pyx_mstate->__pyx_kp_b_iso88591_31, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[190])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1868};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_cls, __pyx_mstate->__pyx_n_u_item};
    __pyx_mstate_global->__pyx_codeobj_tab[191] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_parser_pxi, __pyx_mstate->__pyx_n_u_class_getitem, __pyx_mstate->__pyx_kp_b_iso88591_A_AU, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[191])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1901};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[192] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_parser_pxi, __pyx_mstate->__pyx_n_u_read_events, __pyx_mstate->__pyx_kp_b_iso88591_A_D_c, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[192])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 10};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_message};
    __pyx_mstate_global->__pyx_codeobj_tab[193] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_saxparser_pxi, __pyx_mstate->__pyx_n_u_init, __pyx_mstate->__pyx_kp_b_iso88591_A_iq_ivS, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[193])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 821};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[194] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_saxparser_pxi, __pyx_mstate->__pyx_n_u_close, __pyx_mstate->__pyx_kp_b_iso88591_A_4q_4wc_t1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[194])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 834};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_data};
    __pyx_mstate_global->__pyx_codeobj_tab[195] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_saxparser_pxi, __pyx_mstate->__pyx_n_u_data, __pyx_mstate->__pyx_kp_b_iso88591_A_O1A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[195])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 842};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_tag, __pyx_mstate->__pyx_n_u_attrs, __pyx_mstate->__pyx_n_u_nsmap};
    __pyx_mstate_global->__pyx_codeobj_tab[196] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_saxparser_pxi, __pyx_mstate->__pyx_n_u_start, __pyx_mstate->__pyx_kp_b_iso88591_a_6_A_A_t_1E, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[196])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 851};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_tag, __pyx_mstate->__pyx_n_u_element};
    __pyx_mstate_global->__pyx_codeobj_tab[197] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_saxparser_pxi, __pyx_mstate->__pyx_n_u_end, __pyx_mstate->__pyx_kp_b_iso88591_A_nAQ_t6_c_fKq_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[197])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 861};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_target, __pyx_mstate->__pyx_n_u_data};
    __pyx_mstate_global->__pyx_codeobj_tab[198] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_saxparser_pxi, __pyx_mstate->__pyx_n_u_pi, __pyx_mstate->__pyx_kp_b_iso88591_a_t, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[198])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 869};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_comment};
    __pyx_mstate_global->__pyx_codeobj_tab[199] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_saxparser_pxi, __pyx_mstate->__pyx_n_u_comment, __pyx_mstate->__pyx_kp_b_iso88591_A_t_Qa, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[199])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 14};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_result};
    __pyx_mstate_global->__pyx_codeobj_tab[200] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_parsertarget_pxi, __pyx_mstate->__pyx_n_u_init, __pyx_mstate->__pyx_kp_b_iso88591_A_Ja, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[200])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 2, 7, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS), 831};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_xml_data, __pyx_mstate->__pyx_n_u_out, __pyx_mstate->__pyx_n_u_from_file, __pyx_mstate->__pyx_n_u_options, __pyx_mstate->__pyx_n_u_sio, __pyx_mstate->__pyx_n_u_target, __pyx_mstate->__pyx_n_u_parser};
    __pyx_mstate_global->__pyx_codeobj_tab[201] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_serializer_pxi, __pyx_mstate->__pyx_n_u_canonicalize, __pyx_mstate->__pyx_kp_b_iso88591_Q_y_5_Jc_j_t3a_fHA_Qc_1_y_uD_Ja, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[201])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1023};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_data};
    __pyx_mstate_global->__pyx_codeobj_tab[202] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_serializer_pxi, __pyx_mstate->__pyx_n_u_data, __pyx_mstate->__pyx_kp_b_iso88591_A_4t1_gQa, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[202])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1041};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_prefix, __pyx_mstate->__pyx_n_u_uri};
    __pyx_mstate_global->__pyx_codeobj_tab[203] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_serializer_pxi, __pyx_mstate->__pyx_n_u_start_ns_2, __pyx_mstate->__pyx_kp_b_iso88591_A_4q_4q_q_Jb_5, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[203])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1049};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_tag, __pyx_mstate->__pyx_n_u_attrs, __pyx_mstate->__pyx_n_u_new_namespaces};
    __pyx_mstate_global->__pyx_codeobj_tab[204] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_serializer_pxi, __pyx_mstate->__pyx_n_u_start, __pyx_mstate->__pyx_kp_b_iso88591_A_4_gU_Ct3d_1_4q_q_waq_4_d_c_Q_5, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[204])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1134};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_tag};
    __pyx_mstate_global->__pyx_codeobj_tab[205] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_serializer_pxi, __pyx_mstate->__pyx_n_u_end, __pyx_mstate->__pyx_kp_b_iso88591_A_4q_1_4q_q_G1D_WAT_D_N_Qd_4Cq_t, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[205])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1146};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_text};
    __pyx_mstate_global->__pyx_codeobj_tab[206] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_serializer_pxi, __pyx_mstate->__pyx_n_u_comment, __pyx_mstate->__pyx_kp_b_iso88591_A_4t1_4q_4q_q_T_Q_q_G1F_Qa_4t1_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[206])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1159};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_target, __pyx_mstate->__pyx_n_u_data};
    __pyx_mstate_global->__pyx_codeobj_tab[207] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_serializer_pxi, __pyx_mstate->__pyx_n_u_pi, __pyx_mstate->__pyx_kp_b_iso88591_A_4q_4q_q_T_Q_q_G1_A_D_4t1_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[207])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1171};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[208] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_serializer_pxi, __pyx_mstate->__pyx_n_u_close, __pyx_mstate->__pyx_kp_b_iso88591_A_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[208])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1313};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[209] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_serializer_pxi, __pyx_mstate->__pyx_n_u_enter, __pyx_mstate->__pyx_kp_b_iso88591_A_t_q_J_A_d_T_Kt1_t1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[209])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1320};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_exc_type, __pyx_mstate->__pyx_n_u_exc_val, __pyx_mstate->__pyx_n_u_exc_tb, __pyx_mstate->__pyx_n_u_old_writer, __pyx_mstate->__pyx_n_u_raise_on_error};
    __pyx_mstate_global->__pyx_codeobj_tab[210] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_serializer_pxi, __pyx_mstate->__pyx_n_u_exit, __pyx_mstate->__pyx_kp_b_iso88591_A_4xwa_Jd_1_Yc_gQa_t1_O1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[210])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1398};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_version, __pyx_mstate->__pyx_n_u_standalone, __pyx_mstate->__pyx_n_u_doctype, __pyx_mstate->__pyx_n_u_c_version, __pyx_mstate->__pyx_n_u_c_standalone};
    __pyx_mstate_global->__pyx_codeobj_tab[211] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_serializer_pxi, __pyx_mstate->__pyx_n_u_write_declaration, __pyx_mstate->__pyx_kp_b_iso88591_9_q_t87_4y_1_4y_1_Qa_F_xwj_Qa_c, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[211])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1427};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_doctype};
    __pyx_mstate_global->__pyx_codeobj_tab[212] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_serializer_pxi, __pyx_mstate->__pyx_n_u_write_doctype, __pyx_mstate->__pyx_kp_b_iso88591_A_t87_83a_4y_1_q_Qd_6_Kq_4t1_Qd, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[212])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1444};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_method, __pyx_mstate->__pyx_n_u_c_method};
    __pyx_mstate_global->__pyx_codeobj_tab[213] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_serializer_pxi, __pyx_mstate->__pyx_n_u_method, __pyx_mstate->__pyx_kp_b_iso88591_A_t87_4_7_Z7H_QfA, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[213])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {5, 0, 0, 13, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS), 1454};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_tag, __pyx_mstate->__pyx_n_u_attrib, __pyx_mstate->__pyx_n_u_nsmap, __pyx_mstate->__pyx_n_u_method, __pyx_mstate->__pyx_n_u_extra, __pyx_mstate->__pyx_n_u_attributes, __pyx_mstate->__pyx_n_u_name, __pyx_mstate->__pyx_n_u_value, __pyx_mstate->__pyx_n_u_ns, __pyx_mstate->__pyx_n_u_reversed_nsmap, __pyx_mstate->__pyx_n_u_prefix, __pyx_mstate->__pyx_n_u_c_method};
    __pyx_mstate_global->__pyx_codeobj_tab[214] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_serializer_pxi, __pyx_mstate->__pyx_n_u_element, __pyx_mstate->__pyx_kp_b_iso88591_m1_t87_Q_7_i_1A_5_q_y_gRt6_aq_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[214])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 3, 11, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS), 1591};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_with_tail, __pyx_mstate->__pyx_n_u_pretty_print, __pyx_mstate->__pyx_n_u_method, __pyx_mstate->__pyx_n_u_args, __pyx_mstate->__pyx_n_u_c_method, __pyx_mstate->__pyx_n_u_content, __pyx_mstate->__pyx_n_u_bstring, __pyx_mstate->__pyx_n_u_ns, __pyx_mstate->__pyx_n_u_name, __pyx_mstate->__pyx_n_u__28};
    __pyx_mstate_global->__pyx_codeobj_tab[215] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_serializer_pxi, __pyx_mstate->__pyx_n_u_write, __pyx_mstate->__pyx_kp_b_iso88591_B_PQ_t87_4_7_Z7H_Kq_y_4y_1_t9B, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[215])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1645};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[216] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_serializer_pxi, __pyx_mstate->__pyx_n_u_flush, __pyx_mstate->__pyx_kp_b_iso88591_A_t87_a_N_4wa, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[216])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1692};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_data};
    __pyx_mstate_global->__pyx_codeobj_tab[217] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_serializer_pxi, __pyx_mstate->__pyx_n_u_write, __pyx_mstate->__pyx_kp_b_iso88591_A_F, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[217])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1695};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[218] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_serializer_pxi, __pyx_mstate->__pyx_n_u_close, __pyx_mstate->__pyx_kp_b_iso88591_A_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[218])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1748};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_method};
    __pyx_mstate_global->__pyx_codeobj_tab[219] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_serializer_pxi, __pyx_mstate->__pyx_n_u_method, __pyx_mstate->__pyx_kp_b_iso88591_A_t87_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[219])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {5, 0, 0, 7, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS), 1751};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_tag, __pyx_mstate->__pyx_n_u_attrib, __pyx_mstate->__pyx_n_u_nsmap, __pyx_mstate->__pyx_n_u_method, __pyx_mstate->__pyx_n_u_extra, __pyx_mstate->__pyx_n_u_element_writer};
    __pyx_mstate_global->__pyx_codeobj_tab[220] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_serializer_pxi, __pyx_mstate->__pyx_n_u_element, __pyx_mstate->__pyx_kp_b_iso88591_m1_XXQe87_A_a_7q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[220])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1803};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[221] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_serializer_pxi, __pyx_mstate->__pyx_n_u_enter, __pyx_mstate->__pyx_kp_b_iso88591_A_HKt1_H_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[221])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1807};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_exc_type, __pyx_mstate->__pyx_n_u_exc_val, __pyx_mstate->__pyx_n_u_exc_tb};
    __pyx_mstate_global->__pyx_codeobj_tab[222] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_serializer_pxi, __pyx_mstate->__pyx_n_u_exit, __pyx_mstate->__pyx_kp_b_iso88591_A_H_q_A_HKt1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[222])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1829};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[223] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_serializer_pxi, __pyx_mstate->__pyx_n_u_enter, __pyx_mstate->__pyx_kp_b_iso88591_A_4q_HKt1_L, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[223])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1835};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_exc_type, __pyx_mstate->__pyx_n_u_exc_val, __pyx_mstate->__pyx_n_u_exc_tb};
    __pyx_mstate_global->__pyx_codeobj_tab[224] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_serializer_pxi, __pyx_mstate->__pyx_n_u_exit, __pyx_mstate->__pyx_kp_b_iso88591_A_4q_4xy_4q_HKt1_Kq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[224])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 147};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_lookup};
    __pyx_mstate_global->__pyx_codeobj_tab[225] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_iterparse_pxi, __pyx_mstate->__pyx_n_u_set_element_class_lookup, __pyx_mstate->__pyx_kp_b_iso88591_C1_H_Qa, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[225])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS), 156};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_tag_2, __pyx_mstate->__pyx_n_u_attrib, __pyx_mstate->__pyx_n_u_nsmap, __pyx_mstate->__pyx_n_u_extra};
    __pyx_mstate_global->__pyx_codeobj_tab[226] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_iterparse_pxi, __pyx_mstate->__pyx_n_u_makeelement, __pyx_mstate->__pyx_kp_b_iso88591_1_HL_vXQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[226])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 373};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[227] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_iterparse_pxi, __pyx_mstate->__pyx_n_u_skip_subtree, __pyx_mstate->__pyx_kp_b_iso88591_A_4_Cq_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[227])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 1, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_text, __pyx_mstate->__pyx_n_u_parser, __pyx_mstate->__pyx_n_u_base_url, __pyx_mstate->__pyx_n_u_dic, __pyx_mstate->__pyx_n_u_root, __pyx_mstate->__pyx_n_u_elem};
    __pyx_mstate_global->__pyx_codeobj_tab[228] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_xmlid_pxi, __pyx_mstate->__pyx_n_u_XMLID, __pyx_mstate->__pyx_kp_b_iso88591_3a_e1A_3avXYa_1A_1D_AYa_6, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[228])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 1, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 24};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_text, __pyx_mstate->__pyx_n_u_parser, __pyx_mstate->__pyx_n_u_base_url, __pyx_mstate->__pyx_n_u_root};
    __pyx_mstate_global->__pyx_codeobj_tab[229] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_xmlid_pxi, __pyx_mstate->__pyx_n_u_XMLDTDID, __pyx_mstate->__pyx_kp_b_iso88591_1_3avXYa_t5_uCq_vQ_vWAQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[229])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 1, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 44};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_source, __pyx_mstate->__pyx_n_u_parser, __pyx_mstate->__pyx_n_u_base_url, __pyx_mstate->__pyx_n_u_doc_2};
    __pyx_mstate_global->__pyx_codeobj_tab[230] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_xmlid_pxi, __pyx_mstate->__pyx_n_u_parseid, __pyx_mstate->__pyx_kp_b_iso88591_A_auG7_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[230])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 78};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[231] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_xmlid_pxi, __pyx_mstate->__pyx_n_u_copy, __pyx_mstate->__pyx_kp_b_iso88591_A_wat1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[231])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 95};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_id_name};
    __pyx_mstate_global->__pyx_codeobj_tab[232] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_xmlid_pxi, __pyx_mstate->__pyx_n_u_get, __pyx_mstate->__pyx_kp_b_iso88591_A_t1A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[232])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 105};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_id_name};
    __pyx_mstate_global->__pyx_codeobj_tab[233] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_xmlid_pxi, __pyx_mstate->__pyx_n_u_has_key, __pyx_mstate->__pyx_kp_b_iso88591_A_xs, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[233])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 111};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[234] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_xmlid_pxi, __pyx_mstate->__pyx_n_u_keys, __pyx_mstate->__pyx_kp_b_iso88591_A_4wc_t6, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[234])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 121};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[235] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_xmlid_pxi, __pyx_mstate->__pyx_n_u_iterkeys, __pyx_mstate->__pyx_kp_b_iso88591_A_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[235])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 129};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[236] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_xmlid_pxi, __pyx_mstate->__pyx_n_u_items, __pyx_mstate->__pyx_kp_b_iso88591_A_4xs_m1_t7, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[236])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 134};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[237] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_xmlid_pxi, __pyx_mstate->__pyx_n_u_iteritems, __pyx_mstate->__pyx_kp_b_iso88591_A_4xs_m1_t1D, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[237])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 139};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_values, __pyx_mstate->__pyx_n_u_item, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[238] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_xmlid_pxi, __pyx_mstate->__pyx_n_u_values, __pyx_mstate->__pyx_kp_b_iso88591_A_1_4xs_m1_HD_1F_AQ_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[238])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 149};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[239] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_xmlid_pxi, __pyx_mstate->__pyx_n_u_itervalues, __pyx_mstate->__pyx_kp_b_iso88591_A_t1D_q_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[239])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 7, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_tree_or_element, __pyx_mstate->__pyx_n_u_top_nsmap, __pyx_mstate->__pyx_n_u_keep_ns_prefixes, __pyx_mstate->__pyx_n_u_element, __pyx_mstate->__pyx_n_u_c_element, __pyx_mstate->__pyx_n_u_doc_2, __pyx_mstate->__pyx_n_u_prefix};
    __pyx_mstate_global->__pyx_codeobj_tab[240] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_cleanup_pxi, __pyx_mstate->__pyx_n_u_cleanup_namespaces, __pyx_mstate->__pyx_kp_b_iso88591_8_aq_q_q_gQ_e6_5_q_1AU_84z_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[240])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS), 33};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_tree_or_element, __pyx_mstate->__pyx_n_u_attribute_names, __pyx_mstate->__pyx_n_u_matcher, __pyx_mstate->__pyx_n_u_element};
    __pyx_mstate_global->__pyx_codeobj_tab[241] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_cleanup_pxi, __pyx_mstate->__pyx_n_u_strip_attributes, __pyx_mstate->__pyx_kp_b_iso88591_aq_t1_ha_9_QgQ_w_1_QgZq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[241])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 1, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS), 74};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_tree_or_element, __pyx_mstate->__pyx_n_u_with_tail, __pyx_mstate->__pyx_n_u_tag_names, __pyx_mstate->__pyx_n_u_matcher, __pyx_mstate->__pyx_n_u_doc_2, __pyx_mstate->__pyx_n_u_element};
    __pyx_mstate_global->__pyx_codeobj_tab[242] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_cleanup_pxi, __pyx_mstate->__pyx_n_u_strip_elements, __pyx_mstate->__pyx_kp_b_iso88591_0_4_1_aq_t1_ha_9_Qa_wk_z_1_7_e1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[242])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS), 145};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_tree_or_element, __pyx_mstate->__pyx_n_u_tag_names, __pyx_mstate->__pyx_n_u_matcher, __pyx_mstate->__pyx_n_u_doc_2, __pyx_mstate->__pyx_n_u_element};
    __pyx_mstate_global->__pyx_codeobj_tab[243] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_cleanup_pxi, __pyx_mstate->__pyx_n_u_strip_tags, __pyx_mstate->__pyx_kp_b_iso88591_2_1_aq_t1_ha_9_Qa_wk_z_1_7_e1_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[243])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 1, 7, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 424};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_module, __pyx_mstate->__pyx_n_u_function_mapping, __pyx_mstate->__pyx_n_u_ns, __pyx_mstate->__pyx_n_u_functions, __pyx_mstate->__pyx_n_u_function_name, __pyx_mstate->__pyx_n_u_xpath_name, __pyx_mstate->__pyx_n_u_name};
    __pyx_mstate_global->__pyx_codeobj_tab[244] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_extensions_pxi, __pyx_mstate->__pyx_n_u_Extension, __pyx_mstate->__pyx_kp_b_iso88591_0_z_A_O_9_q_Rt_Cq_r_d_Qa_D_Kq_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[244])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {5, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 496};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_ctxt, __pyx_mstate->__pyx_n_u_s_4, __pyx_mstate->__pyx_n_u_rexp, __pyx_mstate->__pyx_n_u_flags, __pyx_mstate->__pyx_n_u_rexpc};
    __pyx_mstate_global->__pyx_codeobj_tab[245] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_extensions_pxi, __pyx_mstate->__pyx_n_u_test, __pyx_mstate->__pyx_kp_b_iso88591_M_D_Qa_IQfD_1_5_q_3a_1_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[245])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {5, 0, 0, 12, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 505};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_ctxt, __pyx_mstate->__pyx_n_u_s_4, __pyx_mstate->__pyx_n_u_rexp, __pyx_mstate->__pyx_n_u_flags, __pyx_mstate->__pyx_n_u_result_list, __pyx_mstate->__pyx_n_u_rexpc, __pyx_mstate->__pyx_n_u_results, __pyx_mstate->__pyx_n_u_result, __pyx_mstate->__pyx_n_u_root, __pyx_mstate->__pyx_n_u_s_match, __pyx_mstate->__pyx_n_u_elem};
    __pyx_mstate_global->__pyx_codeobj_tab[246] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_extensions_pxi, __pyx_mstate->__pyx_n_u_match, __pyx_mstate->__pyx_kp_b_iso88591_M_D_Qa_IQfD_1_4s_e81A_t1_q_U_t1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[246])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {6, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 530};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_ctxt, __pyx_mstate->__pyx_n_u_s_4, __pyx_mstate->__pyx_n_u_rexp, __pyx_mstate->__pyx_n_u_flags, __pyx_mstate->__pyx_n_u_replacement, __pyx_mstate->__pyx_n_u_rexpc, __pyx_mstate->__pyx_n_u_count};
    __pyx_mstate_global->__pyx_codeobj_tab[247] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_extensions_pxi, __pyx_mstate->__pyx_n_u_replace, __pyx_mstate->__pyx_kp_b_iso88591_A_d_q_M_D_Qa_IQfD_1_T_Kq_uD_c, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[247])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 726};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[248] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_extensions_pxi, __pyx_mstate->__pyx_n_u_getparent, __pyx_mstate->__pyx_kp_b_iso88591_A_t1_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[248])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 251};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_prefix, __pyx_mstate->__pyx_n_u_uri};
    __pyx_mstate_global->__pyx_codeobj_tab[249] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_xpath_pxi, __pyx_mstate->__pyx_n_u_register_namespace, __pyx_mstate->__pyx_kp_b_iso88591_A_t_wfA_I_81, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[249])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 257};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_namespaces, __pyx_mstate->__pyx_n_u_prefix, __pyx_mstate->__pyx_n_u_uri};
    __pyx_mstate_global->__pyx_codeobj_tab[250] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_xpath_pxi, __pyx_mstate->__pyx_n_u_register_namespaces, __pyx_mstate->__pyx_kp_b_iso88591_A_t_wfA_HG_V1_axq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[250])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 4, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 352};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_etree_or_element, __pyx_mstate->__pyx_n_u_namespaces, __pyx_mstate->__pyx_n_u_extensions, __pyx_mstate->__pyx_n_u_regexp, __pyx_mstate->__pyx_n_u_smart_strings};
    __pyx_mstate_global->__pyx_codeobj_tab[251] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_xpath_pxi, __pyx_mstate->__pyx_n_u_XPathEvaluator, __pyx_mstate->__pyx_kp_b_iso88591_9_z_A_Q_k_7_A_k_7, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[251])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 439};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_strval};
    __pyx_mstate_global->__pyx_codeobj_tab[252] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_xslt_pxi, __pyx_mstate->__pyx_n_u_strparam, __pyx_mstate->__pyx_kp_b_iso88591_A_Qa, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[252])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 453};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_max_depth};
    __pyx_mstate_global->__pyx_codeobj_tab[253] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_xslt_pxi, __pyx_mstate->__pyx_n_u_set_global_max_depth, __pyx_mstate->__pyx_kp_b_iso88591_A_Rq_AQ_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[253])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 473};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_result_tree};
    __pyx_mstate_global->__pyx_codeobj_tab[254] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_xslt_pxi, __pyx_mstate->__pyx_n_u_tostring, __pyx_mstate->__pyx_kp_b_iso88591_A_s_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[254])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 482};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_memo};
    __pyx_mstate_global->__pyx_codeobj_tab[255] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_xslt_pxi, __pyx_mstate->__pyx_n_u_deepcopy, __pyx_mstate->__pyx_kp_b_iso88591_A_t9A_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[255])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 485};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[256] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_xslt_pxi, __pyx_mstate->__pyx_n_u_copy_2, __pyx_mstate->__pyx_kp_b_iso88591_A_y, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[256])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 1, 10, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 720};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_file, __pyx_mstate->__pyx_n_u_compression, __pyx_mstate->__pyx_n_u_writer, __pyx_mstate->__pyx_n_u_doc_2, __pyx_mstate->__pyx_n_u_r, __pyx_mstate->__pyx_n_u_rclose, __pyx_mstate->__pyx_n_u_c_compression, __pyx_mstate->__pyx_n_u_c_encoding, __pyx_mstate->__pyx_n_u_c_buffer};
    __pyx_mstate_global->__pyx_codeobj_tab[257] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_xslt_pxi, __pyx_mstate->__pyx_n_u_write_output, __pyx_mstate->__pyx_kp_b_iso88591_0_a_4_gQ_nA_4s_a_t3a_m1A_Cq_1L, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[257])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 9, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 883};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_parser, __pyx_mstate->__pyx_n_u_result_doc, __pyx_mstate->__pyx_n_u_result_node, __pyx_mstate->__pyx_n_u_href_utf, __pyx_mstate->__pyx_n_u_c_href, __pyx_mstate->__pyx_n_u_c_attr, __pyx_mstate->__pyx_n_u_hrefs, __pyx_mstate->__pyx_n_u_root};
    __pyx_mstate_global->__pyx_codeobj_tab[258] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_xslt_pxi, __pyx_mstate->__pyx_n_u_parseXSL, __pyx_mstate->__pyx_kp_b_iso88591_a_4xy_1_a_Qd_5T_QRRS_3awc_a_Qa, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[258])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 940};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_value, __pyx_mstate->__pyx_n_u_attrib, __pyx_mstate->__pyx_n_u_text};
    __pyx_mstate_global->__pyx_codeobj_tab[259] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_xslt_pxi, __pyx_mstate->__pyx_n_u_set, __pyx_mstate->__pyx_kp_b_iso88591_A_4s_6_A_Q_F_T_A_a_Yaq_t2T_Rq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[259])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {5, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 6};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_context, __pyx_mstate->__pyx_n_u_self_node, __pyx_mstate->__pyx_n_u_input_node, __pyx_mstate->__pyx_n_u_output_parent};
    __pyx_mstate_global->__pyx_codeobj_tab[260] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_xsltext_pxi, __pyx_mstate->__pyx_n_u_execute, __pyx_mstate->__pyx_kp_b_iso88591_A_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[260])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {4, 0, 2, 9, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 22};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_context, __pyx_mstate->__pyx_n_u_node, __pyx_mstate->__pyx_n_u_output_parent, __pyx_mstate->__pyx_n_u_elements_only, __pyx_mstate->__pyx_n_u_remove_blank_text, __pyx_mstate->__pyx_n_u_c_parent, __pyx_mstate->__pyx_n_u_c_node, __pyx_mstate->__pyx_n_u_c_context_node};
    __pyx_mstate_global->__pyx_codeobj_tab[261] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_xsltext_pxi, __pyx_mstate->__pyx_n_u_apply_templates, __pyx_mstate->__pyx_kp_b_iso88591_QQR_B_0_wk_a_1_1A_z_0_q_z_1_q_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[261])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 2, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 74};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_context, __pyx_mstate->__pyx_n_u_output_parent, __pyx_mstate->__pyx_n_u_elements_only, __pyx_mstate->__pyx_n_u_remove_blank_text, __pyx_mstate->__pyx_n_u_c_parent, __pyx_mstate->__pyx_n_u_c_ctxt, __pyx_mstate->__pyx_n_u_c_old_output_parent};
    __pyx_mstate_global->__pyx_codeobj_tab[262] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_xsltext_pxi, __pyx_mstate->__pyx_n_u_process_children, __pyx_mstate->__pyx_kp_b_iso88591_LA_C1_2_F_wk_a_1A_z_0_q_j_uKvQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[262])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3803};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_etree};
    __pyx_mstate_global->__pyx_codeobj_tab[263] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_validate, __pyx_mstate->__pyx_kp_b_iso88591_A_t1A_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[263])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3812};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_etree};
    __pyx_mstate_global->__pyx_codeobj_tab[264] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_assertValid, __pyx_mstate->__pyx_kp_b_iso88591_A_4t1A_k1H_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[264])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3822};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_etree};
    __pyx_mstate_global->__pyx_codeobj_tab[265] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_assert, __pyx_mstate->__pyx_kp_b_iso88591_A_4t1A_k1H, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[265])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {7, 0, 0, 7, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3831};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_domain, __pyx_mstate->__pyx_n_u_type, __pyx_mstate->__pyx_n_u_level, __pyx_mstate->__pyx_n_u_line_2, __pyx_mstate->__pyx_n_u_message, __pyx_mstate->__pyx_n_u_filename};
    __pyx_mstate_global->__pyx_codeobj_tab[266] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_append_log_message, __pyx_mstate->__pyx_kp_b_iso88591_A_K_q_gV1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[266])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3836};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[267] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_etree_pyx, __pyx_mstate->__pyx_n_u_clear_error_log, __pyx_mstate->__pyx_kp_b_iso88591_A_KvQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[267])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 170};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[268] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_dtd_pxi, __pyx_mstate->__pyx_n_u_values, __pyx_mstate->__pyx_kp_b_iso88591_A_t1D_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[268])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 233};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[269] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_dtd_pxi, __pyx_mstate->__pyx_n_u_attributes, __pyx_mstate->__pyx_kp_b_iso88591_A_t1D_q_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[269])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 337};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[270] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_dtd_pxi, __pyx_mstate->__pyx_n_u_elements, __pyx_mstate->__pyx_kp_b_iso88591_A_t1D_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[270])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 350};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[271] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_dtd_pxi, __pyx_mstate->__pyx_n_u_entities, __pyx_mstate->__pyx_kp_b_iso88591_A_t1D_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[271])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 154};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_cls, __pyx_mstate->__pyx_n_u_src, __pyx_mstate->__pyx_n_u_base_url, __pyx_mstate->__pyx_n_u_rng_str};
    __pyx_mstate_global->__pyx_codeobj_tab[272] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_relaxng_pxi, __pyx_mstate->__pyx_n_u_from_rnc_string, __pyx_mstate->__pyx_kp_b_iso88591_A_axvQhfAQ_s_q_8, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[272])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 6};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[273] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_debug_pxi, __pyx_mstate->__pyx_n_u_bytes_used, __pyx_mstate->__pyx_kp_b_iso88591_A_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[273])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 15};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[274] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_debug_pxi, __pyx_mstate->__pyx_n_u_blocks_used, __pyx_mstate->__pyx_kp_b_iso88591_A_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[274])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 24};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_c_dict};
    __pyx_mstate_global->__pyx_codeobj_tab[275] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_lxml_debug_pxi, __pyx_mstate->__pyx_n_u_dict_size, __pyx_mstate->__pyx_kp_b_iso88591_A_q_7_Q_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[275])) goto bad;
  }
  Py_DECREF(tuple_dedup_map);
  return 0;
  bad:
  Py_DECREF(tuple_dedup_map);
  return -1;
}
/* #### Code section: init_globals ### */

static int __Pyx_InitGlobals(void) {
  /* PythonCompatibility.init */
  if (likely(__Pyx_init_co_variables() == 0)); else
  
  if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)

  /* AssertionsEnabled.init */
  if (likely(__Pyx_init_assertions_enabled() == 0)); else
  
  if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)

  /* CommonTypesMetaclass.init */
  if (likely(__pyx_CommonTypesMetaclass_init(__pyx_m) == 0)); else
  
  if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)

  /* Generator.init */
  if (likely(__pyx_Generator_init(__pyx_m) == 0)); else
  
  if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)

  /* CachedMethodType.init */
  #if CYTHON_COMPILING_IN_LIMITED_API
  {
      PyObject *typesModule=NULL;
      typesModule = PyImport_ImportModule("types");
      if (typesModule) {
          __pyx_mstate_global->__Pyx_CachedMethodType = PyObject_GetAttrString(typesModule, "MethodType");
          Py_DECREF(typesModule);
      }
  } // error handling follows
  #endif
  
  if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)

  /* CythonFunctionShared.init */
  if (likely(__pyx_CyFunction_init(__pyx_m) == 0)); else
  
  if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)

  /* Coroutine.init */
  if (likely(__pyx_Coroutine_init(__pyx_m) == 0)); else
  
  if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)

  /* Coro_CheckExact.init */
  #if CYTHON_COMPILING_IN_LIMITED_API
  {
      PyObject *typesModule=NULL;
      typesModule = PyImport_ImportModule("types");
      if (typesModule) {
          __pyx_mstate_global->__Pyx_CachedCoroType = PyObject_GetAttrString(typesModule, "CoroutineType");
          Py_DECREF(typesModule);
      }
  } // error handling follows
  #endif
  
  if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)

  return 0;
  __pyx_L1_error:;
  return -1;
}
/* #### Code section: cleanup_globals ### */

static void __Pyx_CleanupGlobals(__pyx_mstatetype *__pyx_mstate) {
  CYTHON_UNUSED_VAR(__pyx_mstate);
  /* CachedMethodType.cleanup */
  #if CYTHON_COMPILING_IN_LIMITED_API
  Py_CLEAR(__pyx_mstate_global->__Pyx_CachedMethodType);
  #endif
  
/* Coro_CheckExact.cleanup */
  #if CYTHON_COMPILING_IN_LIMITED_API
  Py_CLEAR(__pyx_mstate_global->__Pyx_CachedCoroType);
  #endif
  
/* CodeObjectCache.cleanup */
  {
    struct __Pyx_CodeObjectCache *code_cache = &__pyx_mstate_global->__pyx_code_cache;
    if (code_cache->entries) {
        __Pyx_CodeObjectCacheEntry* entries = code_cache->entries;
        int i, count = code_cache->count;
        code_cache->count = 0;
        code_cache->max_count = 0;
        code_cache->entries = NULL;
        for (i=0; i<count; i++) {
            Py_DECREF(entries[i].code_object);
        }
        PyMem_Free(entries);
    }
  }
  
Py_CLEAR(__pyx_mstate->__pyx_umethod_PyDict_Type_get.method);
  Py_CLEAR(__pyx_mstate->__pyx_umethod_PyDict_Type_items.method);
  Py_CLEAR(__pyx_mstate->__pyx_umethod_PyDict_Type_pop.method);
  Py_CLEAR(__pyx_mstate->__pyx_umethod_PyDict_Type_values.method);
  Py_CLEAR(__pyx_mstate->__pyx_umethod_PyList_Type_pop.method);
  Py_CLEAR(__pyx_mstate->__pyx_umethod_PySet_Type_update.method);
  Py_CLEAR(__pyx_mstate->__pyx_umethod_PyBytes_Type__replace.method);
  Py_CLEAR(__pyx_mstate->__pyx_umethod_PyBytes_Type__split.method);
  Py_CLEAR(__pyx_mstate->__pyx_umethod_PyUnicode_Type__strip.method);
  for (size_t i=0; i<12; ++i) { Py_CLEAR(__pyx_mstate->__pyx_slice[i]); }
  for (size_t i=0; i<26; ++i) { Py_CLEAR(__pyx_mstate->__pyx_tuple[i]); }
}
/* #### Code section: cleanup_module ### */
static void __pyx_module_cleanup(CYTHON_UNUSED PyObject *self) {
  __pyx_mstatetype *__pyx_mstate;
  #if CYTHON_USE_MODULE_STATE
  if (!__Pyx_State_FindModule(&__pyx_moduledef)) return;
  #endif
  __pyx_mstate = __Pyx_PyModule_GetState(self);
  /*--- Global cleanup code ---*/
  Py_CLEAR(indirect_contiguous);
  Py_CLEAR(contiguous);
  Py_CLEAR(indirect);
  Py_CLEAR(strided);
  Py_CLEAR(generic);
  Py_CLEAR(__pyx_collections_abc_Sequence);
  Py_CLEAR(__pyx_8genexpr1__pyx_v_4lxml_5etree_feature_name);
  Py_CLEAR(__pyx_8genexpr1__pyx_v_4lxml_5etree_feature_id);
  Py_CLEAR(__pyx_v_4lxml_5etree__check_for_default_attributes);
  Py_CLEAR(__pyx_v_4lxml_5etree__rnc2rng);
  Py_CLEAR(__pyx_v_4lxml_5etree___findStylesheetByID);
  Py_CLEAR(__pyx_v_4lxml_5etree__REPLACE_PI_HREF);
  Py_CLEAR(__pyx_v_4lxml_5etree__FIND_PI_HREF);
  Py_CLEAR(__pyx_v_4lxml_5etree__RE_PI_HREF);
  Py_CLEAR(__pyx_v_4lxml_5etree_EMPTY_DICT);
  Py_CLEAR(__pyx_v_4lxml_5etree__find_namespaces);
  Py_CLEAR(__pyx_v_4lxml_5etree__replace_strings);
  Py_CLEAR(__pyx_v_4lxml_5etree__XPATH_EVAL_ERRORS);
  Py_CLEAR(__pyx_v_4lxml_5etree__XPATH_SYNTAX_ERRORS);
  Py_CLEAR(__pyx_v_4lxml_5etree_LIBXML2_XPATH_ERROR_MESSAGES);
  Py_CLEAR(__pyx_v_4lxml_5etree__find_id_attributes);
  Py_CLEAR(__pyx_v_4lxml_5etree__looks_like_prefix_name);
  Py_CLEAR(__pyx_v_4lxml_5etree__open_utf8_file);
  Py_CLEAR(__pyx_v_4lxml_5etree_contextmanager);
  Py_CLEAR(__pyx_v_4lxml_5etree_utf8_writer);
  Py_CLEAR(__pyx_v_4lxml_5etree_getwriter);
  Py_CLEAR(__pyx_v_4lxml_5etree_gzip);
  Py_CLEAR(__pyx_v_4lxml_5etree_io_open);
  Py_CLEAR(__pyx_v_4lxml_5etree_GzipFile);
  Py_CLEAR(__pyx_v_4lxml_5etree_inspect_getargspec);
  Py_CLEAR(__pyx_v_4lxml_5etree___DEFAULT_HTML_PARSER);
  Py_CLEAR(__pyx_v_4lxml_5etree__UNUSED);
  Py_CLEAR(__pyx_v_4lxml_5etree___DEFAULT_XML_PARSER);
  Py_CLEAR(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT);
  Py_CLEAR(__pyx_v_4lxml_5etree__ParseError);
  Py_CLEAR(__pyx_v_4lxml_5etree__GenericAlias);
  Py_CLEAR(__pyx_v_4lxml_5etree___FUNCTION_NAMESPACE_REGISTRIES);
  Py_CLEAR(__pyx_v_4lxml_5etree_DEFAULT_ELEMENT_CLASS_LOOKUP);
  Py_CLEAR(__pyx_v_4lxml_5etree_ELEMENT_CLASS_LOOKUP_STATE);
  Py_CLEAR(__pyx_v_4lxml_5etree__FIND_PI_ATTRIBUTES);
  Py_CLEAR(__pyx_v_4lxml_5etree__find_invalid_public_id_characters);
  Py_CLEAR(__pyx_v_4lxml_5etree__PREFIX_CACHE);
  Py_CLEAR(__pyx_v_4lxml_5etree___RELAXNG_ERROR_TYPES);
  Py_CLEAR(__pyx_v_4lxml_5etree___PARSER_ERROR_TYPES);
  Py_CLEAR(__pyx_v_4lxml_5etree___ERROR_DOMAINS);
  Py_CLEAR(__pyx_v_4lxml_5etree___ERROR_LEVELS);
  Py_CLEAR(__pyx_v_4lxml_5etree___GLOBAL_ERROR_LOG);
  Py_CLEAR(__pyx_v_4lxml_5etree___HAS_XML_ENCODING);
  Py_CLEAR(__pyx_v_4lxml_5etree___REPLACE_XML_ENCODING);
  Py_CLEAR(__pyx_v_4lxml_5etree___RE_XML_ENCODING);
  Py_CLEAR(__pyx_v_4lxml_5etree__Error);
  Py_CLEAR(__pyx_v_4lxml_5etree__check_internal_prefix);
  Py_CLEAR(__pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES_ITEMS);
  Py_CLEAR(__pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES);
  Py_CLEAR(__pyx_v_4lxml_5etree__FILENAME_ENCODING);
  Py_CLEAR(__pyx_v_4lxml_5etree_IMMUTABLE_EMPTY_MAPPING);
  Py_CLEAR(__pyx_v_4lxml_5etree_MutableMapping);
  Py_CLEAR(__pyx_v_4lxml_5etree_ITER_EMPTY);
  Py_CLEAR(__pyx_v_4lxml_5etree_islice);
  Py_CLEAR(__pyx_v_4lxml_5etree_partial);
  Py_CLEAR(__pyx_v_4lxml_5etree_re);
  Py_CLEAR(__pyx_v_4lxml_5etree_sys);
  Py_CLEAR(__pyx_v_4lxml_5etree__elementpath);
  Py_CLEAR(__pyx_v_4lxml_5etree_OrderedDict);
  Py_CLEAR(__pyx_v_4lxml_5etree_StringIO);
  Py_CLEAR(__pyx_v_4lxml_5etree_BytesIO);
  Py_CLEAR(__pyx_v_4lxml_5etree_os_path_abspath);
  __Pyx_CleanupGlobals(__pyx_mstate);
  /*--- Type import cleanup code ---*/
  Py_CLEAR(__pyx_mstate->__pyx_ptype_7cpython_4type_type);
  /*--- Builtin cleanup code ---*/
  Py_CLEAR(__pyx_builtin_print);
  Py_CLEAR(__pyx_builtin_object);
  Py_CLEAR(__pyx_builtin_property);
  Py_CLEAR(__pyx_builtin_staticmethod);
  Py_CLEAR(__pyx_builtin_super);
  Py_CLEAR(__pyx_builtin_id);
  Py_CLEAR(__pyx_builtin_enumerate);
  Py_CLEAR(__pyx_builtin_NotImplemented);
  Py_CLEAR(__pyx_builtin_reversed);
  Py_CLEAR(__pyx_builtin_open);
  Py_CLEAR(__pyx_builtin_sorted);
  /*--- Intern cleanup code ---*/
  Py_CLEAR(__pyx_mstate->__pyx_empty_tuple);
  #if CYTHON_USE_FREELISTS
  while (__pyx_mstate->__pyx_freecount_4lxml_5etree__LogEntry > 0) {
    PyObject* o = (PyObject*)__pyx_mstate->__pyx_freelist_4lxml_5etree__LogEntry[--__pyx_mstate->__pyx_freecount_4lxml_5etree__LogEntry];
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
  #endif
  #if CYTHON_USE_FREELISTS
  while (__pyx_mstate->__pyx_freecount_4lxml_5etree__Document > 0) {
    PyObject* o = (PyObject*)__pyx_mstate->__pyx_freelist_4lxml_5etree__Document[--__pyx_mstate->__pyx_freecount_4lxml_5etree__Document];
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
  #endif
  #if CYTHON_USE_FREELISTS
  while (__pyx_mstate->__pyx_freecount_4lxml_5etree__Attrib > 0) {
    PyObject* o = (PyObject*)__pyx_mstate->__pyx_freelist_4lxml_5etree__Attrib[--__pyx_mstate->__pyx_freecount_4lxml_5etree__Attrib];
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
  #endif
  #if CYTHON_USE_FREELISTS
  while (__pyx_mstate->__pyx_freecount_4lxml_5etree__FileWriterElement > 0) {
    PyObject* o = (PyObject*)__pyx_mstate->__pyx_freelist_4lxml_5etree__FileWriterElement[--__pyx_mstate->__pyx_freecount_4lxml_5etree__FileWriterElement];
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
  #endif
  #if CYTHON_USE_FREELISTS
  while (__pyx_mstate->__pyx_freecount_4lxml_5etree__MethodChanger > 0) {
    PyObject* o = (PyObject*)__pyx_mstate->__pyx_freelist_4lxml_5etree__MethodChanger[--__pyx_mstate->__pyx_freecount_4lxml_5etree__MethodChanger];
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
  #endif
  #if CYTHON_USE_FREELISTS
  while (__pyx_mstate->__pyx_freecount_4lxml_5etree__XSLTQuotedStringParam > 0) {
    PyObject* o = (PyObject*)__pyx_mstate->__pyx_freelist_4lxml_5etree__XSLTQuotedStringParam[--__pyx_mstate->__pyx_freecount_4lxml_5etree__XSLTQuotedStringParam];
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
  #endif
  #if CYTHON_USE_FREELISTS
  while (__pyx_mstate->__pyx_freecount_4lxml_5etree__DTDElementContentDecl > 0) {
    PyObject* o = (PyObject*)__pyx_mstate->__pyx_freelist_4lxml_5etree__DTDElementContentDecl[--__pyx_mstate->__pyx_freecount_4lxml_5etree__DTDElementContentDecl];
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
  #endif
  #if CYTHON_USE_FREELISTS
  while (__pyx_mstate->__pyx_freecount_4lxml_5etree__DTDAttributeDecl > 0) {
    PyObject* o = (PyObject*)__pyx_mstate->__pyx_freelist_4lxml_5etree__DTDAttributeDecl[--__pyx_mstate->__pyx_freecount_4lxml_5etree__DTDAttributeDecl];
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
  #endif
  #if CYTHON_USE_FREELISTS
  while (__pyx_mstate->__pyx_freecount_4lxml_5etree__DTDElementDecl > 0) {
    PyObject* o = (PyObject*)__pyx_mstate->__pyx_freelist_4lxml_5etree__DTDElementDecl[--__pyx_mstate->__pyx_freecount_4lxml_5etree__DTDElementDecl];
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
  #endif
  #if CYTHON_USE_FREELISTS
  while (__pyx_mstate->__pyx_freecount_4lxml_5etree__DTDEntityDecl > 0) {
    PyObject* o = (PyObject*)__pyx_mstate->__pyx_freelist_4lxml_5etree__DTDEntityDecl[--__pyx_mstate->__pyx_freecount_4lxml_5etree__DTDEntityDecl];
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
  #endif
  #if CYTHON_USE_FREELISTS
  while (__pyx_mstate->__pyx_freecount_4lxml_5etree___pyx_scope_struct___open_utf8_file > 0) {
    PyObject* o = (PyObject*)__pyx_mstate->__pyx_freelist_4lxml_5etree___pyx_scope_struct___open_utf8_file[--__pyx_mstate->__pyx_freecount_4lxml_5etree___pyx_scope_struct___open_utf8_file];
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
  #endif
  #if CYTHON_USE_FREELISTS
  while (__pyx_mstate->__pyx_freecount_4lxml_5etree___pyx_scope_struct_1__iter_namespaces > 0) {
    PyObject* o = (PyObject*)__pyx_mstate->__pyx_freelist_4lxml_5etree___pyx_scope_struct_1__iter_namespaces[--__pyx_mstate->__pyx_freecount_4lxml_5etree___pyx_scope_struct_1__iter_namespaces];
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
  #endif
  #if CYTHON_USE_FREELISTS
  while (__pyx_mstate->__pyx_freecount_4lxml_5etree___pyx_scope_struct_2___aenter__ > 0) {
    PyObject* o = (PyObject*)__pyx_mstate->__pyx_freelist_4lxml_5etree___pyx_scope_struct_2___aenter__[--__pyx_mstate->__pyx_freecount_4lxml_5etree___pyx_scope_struct_2___aenter__];
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
  #endif
  #if CYTHON_USE_FREELISTS
  while (__pyx_mstate->__pyx_freecount_4lxml_5etree___pyx_scope_struct_3___aexit__ > 0) {
    PyObject* o = (PyObject*)__pyx_mstate->__pyx_freelist_4lxml_5etree___pyx_scope_struct_3___aexit__[--__pyx_mstate->__pyx_freecount_4lxml_5etree___pyx_scope_struct_3___aexit__];
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
  #endif
  #if CYTHON_USE_FREELISTS
  while (__pyx_mstate->__pyx_freecount_4lxml_5etree___pyx_scope_struct_4_flush > 0) {
    PyObject* o = (PyObject*)__pyx_mstate->__pyx_freelist_4lxml_5etree___pyx_scope_struct_4_flush[--__pyx_mstate->__pyx_freecount_4lxml_5etree___pyx_scope_struct_4_flush];
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
  #endif
  #if CYTHON_USE_FREELISTS
  while (__pyx_mstate->__pyx_freecount_4lxml_5etree___pyx_scope_struct_5_write_declaration > 0) {
    PyObject* o = (PyObject*)__pyx_mstate->__pyx_freelist_4lxml_5etree___pyx_scope_struct_5_write_declaration[--__pyx_mstate->__pyx_freecount_4lxml_5etree___pyx_scope_struct_5_write_declaration];
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
  #endif
  #if CYTHON_USE_FREELISTS
  while (__pyx_mstate->__pyx_freecount_4lxml_5etree___pyx_scope_struct_6_write_doctype > 0) {
    PyObject* o = (PyObject*)__pyx_mstate->__pyx_freelist_4lxml_5etree___pyx_scope_struct_6_write_doctype[--__pyx_mstate->__pyx_freecount_4lxml_5etree___pyx_scope_struct_6_write_doctype];
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
  #endif
  #if CYTHON_USE_FREELISTS
  while (__pyx_mstate->__pyx_freecount_4lxml_5etree___pyx_scope_struct_7_write > 0) {
    PyObject* o = (PyObject*)__pyx_mstate->__pyx_freelist_4lxml_5etree___pyx_scope_struct_7_write[--__pyx_mstate->__pyx_freecount_4lxml_5etree___pyx_scope_struct_7_write];
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
  #endif
  #if CYTHON_USE_FREELISTS
  while (__pyx_mstate->__pyx_freecount_4lxml_5etree___pyx_scope_struct_8__close > 0) {
    PyObject* o = (PyObject*)__pyx_mstate->__pyx_freelist_4lxml_5etree___pyx_scope_struct_8__close[--__pyx_mstate->__pyx_freecount_4lxml_5etree___pyx_scope_struct_8__close];
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
  #endif
  #if CYTHON_USE_FREELISTS
  while (__pyx_mstate->__pyx_freecount_4lxml_5etree___pyx_scope_struct_9___aenter__ > 0) {
    PyObject* o = (PyObject*)__pyx_mstate->__pyx_freelist_4lxml_5etree___pyx_scope_struct_9___aenter__[--__pyx_mstate->__pyx_freecount_4lxml_5etree___pyx_scope_struct_9___aenter__];
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
  #endif
  #if CYTHON_USE_FREELISTS
  while (__pyx_mstate->__pyx_freecount_4lxml_5etree___pyx_scope_struct_10___aexit__ > 0) {
    PyObject* o = (PyObject*)__pyx_mstate->__pyx_freelist_4lxml_5etree___pyx_scope_struct_10___aexit__[--__pyx_mstate->__pyx_freecount_4lxml_5etree___pyx_scope_struct_10___aexit__];
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
  #endif
  #if CYTHON_USE_FREELISTS
  while (__pyx_mstate->__pyx_freecount_4lxml_5etree___pyx_scope_struct_11___aenter__ > 0) {
    PyObject* o = (PyObject*)__pyx_mstate->__pyx_freelist_4lxml_5etree___pyx_scope_struct_11___aenter__[--__pyx_mstate->__pyx_freecount_4lxml_5etree___pyx_scope_struct_11___aenter__];
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
  #endif
  #if CYTHON_USE_FREELISTS
  while (__pyx_mstate->__pyx_freecount_4lxml_5etree___pyx_scope_struct_12___aexit__ > 0) {
    PyObject* o = (PyObject*)__pyx_mstate->__pyx_freelist_4lxml_5etree___pyx_scope_struct_12___aexit__[--__pyx_mstate->__pyx_freecount_4lxml_5etree___pyx_scope_struct_12___aexit__];
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
  #endif
  #if CYTHON_USE_FREELISTS
  while (__pyx_mstate->__pyx_freecount_4lxml_5etree___pyx_scope_struct_13_itervalues > 0) {
    PyObject* o = (PyObject*)__pyx_mstate->__pyx_freelist_4lxml_5etree___pyx_scope_struct_13_itervalues[--__pyx_mstate->__pyx_freecount_4lxml_5etree___pyx_scope_struct_13_itervalues];
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
  #endif
  #if CYTHON_USE_FREELISTS
  while (__pyx_mstate->__pyx_freecount_4lxml_5etree___pyx_scope_struct_14_iterattributes > 0) {
    PyObject* o = (PyObject*)__pyx_mstate->__pyx_freelist_4lxml_5etree___pyx_scope_struct_14_iterattributes[--__pyx_mstate->__pyx_freecount_4lxml_5etree___pyx_scope_struct_14_iterattributes];
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
  #endif
  #if CYTHON_USE_FREELISTS
  while (__pyx_mstate->__pyx_freecount_4lxml_5etree___pyx_scope_struct_15_iterelements > 0) {
    PyObject* o = (PyObject*)__pyx_mstate->__pyx_freelist_4lxml_5etree___pyx_scope_struct_15_iterelements[--__pyx_mstate->__pyx_freecount_4lxml_5etree___pyx_scope_struct_15_iterelements];
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
  #endif
  #if CYTHON_USE_FREELISTS
  while (__pyx_mstate->__pyx_freecount_4lxml_5etree___pyx_scope_struct_16_iterentities > 0) {
    PyObject* o = (PyObject*)__pyx_mstate->__pyx_freelist_4lxml_5etree___pyx_scope_struct_16_iterentities[--__pyx_mstate->__pyx_freecount_4lxml_5etree___pyx_scope_struct_16_iterentities];
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
  #endif
  Py_CLEAR(__pyx_mstate->__pyx_cython_runtime);
  Py_CLEAR(__pyx_mstate->__pyx_b);
  Py_CLEAR(__pyx_mstate->__pyx_d);
}
/* #### Code section: main_method ### */
/* #### Code section: utility_code_pragmas ### */
#ifdef _MSC_VER
#pragma warning( push )
/* Warning 4127: conditional expression is constant
 * Cython uses constant conditional expressions to allow in inline functions to be optimized at
 * compile-time, so this warning is not useful
 */
#pragma warning( disable : 4127 )
#endif



/* #### Code section: utility_code_def ### */

/* --- Runtime support code --- */
/* Refnanny */
#if CYTHON_REFNANNY
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
    PyObject *m = NULL, *p = NULL;
    void *r = NULL;
    m = PyImport_ImportModule(modname);
    if (!m) goto end;
    p = PyObject_GetAttrString(m, "RefNannyAPI");
    if (!p) goto end;
    r = PyLong_AsVoidPtr(p);
end:
    Py_XDECREF(p);
    Py_XDECREF(m);
    return (__Pyx_RefNannyAPIStruct *)r;
}
#endif

/* PyErrExceptionMatches (used by PyObjectGetAttrStrNoError) */
#if CYTHON_FAST_THREAD_STATE
static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
    Py_ssize_t i, n;
    n = PyTuple_GET_SIZE(tuple);
    for (i=0; i<n; i++) {
        if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
    }
    for (i=0; i<n; i++) {
        if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
    }
    return 0;
}
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
    int result;
    PyObject *exc_type;
#if PY_VERSION_HEX >= 0x030C00A6
    PyObject *current_exception = tstate->current_exception;
    if (unlikely(!current_exception)) return 0;
    exc_type = (PyObject*) Py_TYPE(current_exception);
    if (exc_type == err) return 1;
#else
    exc_type = tstate->curexc_type;
    if (exc_type == err) return 1;
    if (unlikely(!exc_type)) return 0;
#endif
    #if CYTHON_AVOID_BORROWED_REFS
    Py_INCREF(exc_type);
    #endif
    if (unlikely(PyTuple_Check(err))) {
        result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
    } else {
        result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
    }
    #if CYTHON_AVOID_BORROWED_REFS
    Py_DECREF(exc_type);
    #endif
    return result;
}
#endif

/* PyErrFetchRestore (used by PyObjectGetAttrStrNoError) */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
#if PY_VERSION_HEX >= 0x030C00A6
    PyObject *tmp_value;
    assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value)));
    if (value) {
        #if CYTHON_COMPILING_IN_CPYTHON
        if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb))
        #endif
            PyException_SetTraceback(value, tb);
    }
    tmp_value = tstate->current_exception;
    tstate->current_exception = value;
    Py_XDECREF(tmp_value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
#else
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    tmp_type = tstate->curexc_type;
    tmp_value = tstate->curexc_value;
    tmp_tb = tstate->curexc_traceback;
    tstate->curexc_type = type;
    tstate->curexc_value = value;
    tstate->curexc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#endif
}
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
#if PY_VERSION_HEX >= 0x030C00A6
    PyObject* exc_value;
    exc_value = tstate->current_exception;
    tstate->current_exception = 0;
    *value = exc_value;
    *type = NULL;
    *tb = NULL;
    if (exc_value) {
        *type = (PyObject*) Py_TYPE(exc_value);
        Py_INCREF(*type);
        #if CYTHON_COMPILING_IN_CPYTHON
        *tb = ((PyBaseExceptionObject*) exc_value)->traceback;
        Py_XINCREF(*tb);
        #else
        *tb = PyException_GetTraceback(exc_value);
        #endif
    }
#else
    *type = tstate->curexc_type;
    *value = tstate->curexc_value;
    *tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
#endif
}
#endif

/* PyObjectGetAttrStr (used by PyObjectGetAttrStrNoError) */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_getattro))
        return tp->tp_getattro(obj, attr_name);
    return PyObject_GetAttr(obj, attr_name);
}
#endif

/* PyObjectGetAttrStrNoError (used by GetBuiltinName) */
#if __PYX_LIMITED_VERSION_HEX < 0x030d0000
static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
        __Pyx_PyErr_Clear();
}
#endif
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
    PyObject *result;
#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
    (void) PyObject_GetOptionalAttr(obj, attr_name, &result);
    return result;
#else
#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
        return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
    }
#endif
    result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
    if (unlikely(!result)) {
        __Pyx_PyObject_GetAttrStr_ClearAttributeError();
    }
    return result;
#endif
}

/* GetBuiltinName */
static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
    PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_mstate_global->__pyx_b, name);
    if (unlikely(!result) && !PyErr_Occurred()) {
        PyErr_Format(PyExc_NameError,
            "name '%U' is not defined", name);
    }
    return result;
}

/* TupleAndListFromArray (used by fastcall) */
#if !CYTHON_COMPILING_IN_CPYTHON && CYTHON_METH_FASTCALL
static CYTHON_INLINE PyObject *
__Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n)
{
    PyObject *res;
    Py_ssize_t i;
    if (n <= 0) {
        return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_tuple);
    }
    res = PyTuple_New(n);
    if (unlikely(res == NULL)) return NULL;
    for (i = 0; i < n; i++) {
        if (unlikely(__Pyx_PyTuple_SET_ITEM(res, i, src[i]) < (0))) {
            Py_DECREF(res);
            return NULL;
        }
        Py_INCREF(src[i]);
    }
    return res;
}
#elif CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE void __Pyx_copy_object_array(PyObject *const *CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) {
    PyObject *v;
    Py_ssize_t i;
    for (i = 0; i < length; i++) {
        v = dest[i] = src[i];
        Py_INCREF(v);
    }
}
static CYTHON_INLINE PyObject *
__Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n)
{
    PyObject *res;
    if (n <= 0) {
        return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_tuple);
    }
    res = PyTuple_New(n);
    if (unlikely(res == NULL)) return NULL;
    __Pyx_copy_object_array(src, ((PyTupleObject*)res)->ob_item, n);
    return res;
}
static CYTHON_INLINE PyObject *
__Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n)
{
    PyObject *res;
    if (n <= 0) {
        return PyList_New(0);
    }
    res = PyList_New(n);
    if (unlikely(res == NULL)) return NULL;
    __Pyx_copy_object_array(src, ((PyListObject*)res)->ob_item, n);
    return res;
}
#endif

/* BytesEquals (used by UnicodeEquals) */
static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL ||\
        !(CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS)
    return PyObject_RichCompareBool(s1, s2, equals);
#else
    if (s1 == s2) {
        return (equals == Py_EQ);
    } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
        const char *ps1, *ps2;
        Py_ssize_t length = PyBytes_GET_SIZE(s1);
        if (length != PyBytes_GET_SIZE(s2))
            return (equals == Py_NE);
        ps1 = PyBytes_AS_STRING(s1);
        ps2 = PyBytes_AS_STRING(s2);
        if (ps1[0] != ps2[0]) {
            return (equals == Py_NE);
        } else if (length == 1) {
            return (equals == Py_EQ);
        } else {
            int result;
#if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000)
            Py_hash_t hash1, hash2;
            hash1 = ((PyBytesObject*)s1)->ob_shash;
            hash2 = ((PyBytesObject*)s2)->ob_shash;
            if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
                return (equals == Py_NE);
            }
#endif
            result = memcmp(ps1, ps2, (size_t)length);
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
        return (equals == Py_NE);
    } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
        return (equals == Py_NE);
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
#endif
}

/* UnicodeEquals (used by fastcall) */
static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL
    return PyObject_RichCompareBool(s1, s2, equals);
#else
    int s1_is_unicode, s2_is_unicode;
    if (s1 == s2) {
        goto return_eq;
    }
    s1_is_unicode = PyUnicode_CheckExact(s1);
    s2_is_unicode = PyUnicode_CheckExact(s2);
    if (s1_is_unicode & s2_is_unicode) {
        Py_ssize_t length, length2;
        int kind;
        void *data1, *data2;
        #if !CYTHON_COMPILING_IN_LIMITED_API
        if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
            return -1;
        #endif
        length = __Pyx_PyUnicode_GET_LENGTH(s1);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely(length < 0)) return -1;
        #endif
        length2 = __Pyx_PyUnicode_GET_LENGTH(s2);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely(length2 < 0)) return -1;
        #endif
        if (length != length2) {
            goto return_ne;
        }
#if CYTHON_USE_UNICODE_INTERNALS
        {
            Py_hash_t hash1, hash2;
            hash1 = ((PyASCIIObject*)s1)->hash;
            hash2 = ((PyASCIIObject*)s2)->hash;
            if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
                goto return_ne;
            }
        }
#endif
        kind = __Pyx_PyUnicode_KIND(s1);
        if (kind != __Pyx_PyUnicode_KIND(s2)) {
            goto return_ne;
        }
        data1 = __Pyx_PyUnicode_DATA(s1);
        data2 = __Pyx_PyUnicode_DATA(s2);
        if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
            goto return_ne;
        } else if (length == 1) {
            goto return_eq;
        } else {
            int result = memcmp(data1, data2, (size_t)(length * kind));
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & s2_is_unicode) {
        goto return_ne;
    } else if ((s2 == Py_None) & s1_is_unicode) {
        goto return_ne;
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
return_eq:
    return (equals == Py_EQ);
return_ne:
    return (equals == Py_NE);
#endif
}

/* fastcall */
#if CYTHON_METH_FASTCALL
static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s)
{
    Py_ssize_t i, n = __Pyx_PyTuple_GET_SIZE(kwnames);
    #if !CYTHON_ASSUME_SAFE_SIZE
    if (unlikely(n == -1)) return NULL;
    #endif
    for (i = 0; i < n; i++)
    {
        PyObject *namei = __Pyx_PyTuple_GET_ITEM(kwnames, i);
        #if !CYTHON_ASSUME_SAFE_MACROS
        if (unlikely(!namei)) return NULL;
        #endif
        if (s == namei) return kwvalues[i];
    }
    for (i = 0; i < n; i++)
    {
        PyObject *namei = __Pyx_PyTuple_GET_ITEM(kwnames, i);
        #if !CYTHON_ASSUME_SAFE_MACROS
        if (unlikely(!namei)) return NULL;
        #endif
        int eq = __Pyx_PyUnicode_Equals(s, namei, Py_EQ);
        if (unlikely(eq != 0)) {
            if (unlikely(eq < 0)) return NULL;
            return kwvalues[i];
        }
    }
    return NULL;
}
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API
CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues) {
    Py_ssize_t i, nkwargs;
    PyObject *dict;
#if !CYTHON_ASSUME_SAFE_SIZE
    nkwargs = PyTuple_Size(kwnames);
    if (unlikely(nkwargs < 0)) return NULL;
#else
    nkwargs = PyTuple_GET_SIZE(kwnames);
#endif
    dict = PyDict_New();
    if (unlikely(!dict))
        return NULL;
    for (i=0; i<nkwargs; i++) {
#if !CYTHON_ASSUME_SAFE_MACROS
        PyObject *key = PyTuple_GetItem(kwnames, i);
        if (!key) goto bad;
#else
        PyObject *key = PyTuple_GET_ITEM(kwnames, i);
#endif
        if (unlikely(PyDict_SetItem(dict, key, kwvalues[i]) < 0))
            goto bad;
    }
    return dict;
bad:
    Py_DECREF(dict);
    return NULL;
}
#endif
#endif

/* PyObjectCall (used by PyObjectFastCall) */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    PyObject *result;
    ternaryfunc call = Py_TYPE(func)->tp_call;
    if (unlikely(!call))
        return PyObject_Call(func, arg, kw);
    if (unlikely(Py_EnterRecursiveCall(" while calling a Python object")))
        return NULL;
    result = (*call)(func, arg, kw);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

/* PyObjectCallMethO (used by PyObjectFastCall) */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
    PyObject *self, *result;
    PyCFunction cfunc;
    cfunc = __Pyx_CyOrPyCFunction_GET_FUNCTION(func);
    self = __Pyx_CyOrPyCFunction_GET_SELF(func);
    if (unlikely(Py_EnterRecursiveCall(" while calling a Python object")))
        return NULL;
    result = cfunc(self, arg);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

/* PyObjectFastCall (used by PyObjectCallOneArg) */
#if PY_VERSION_HEX < 0x03090000 || CYTHON_COMPILING_IN_LIMITED_API
static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject * const*args, size_t nargs, PyObject *kwargs) {
    PyObject *argstuple;
    PyObject *result = 0;
    size_t i;
    argstuple = PyTuple_New((Py_ssize_t)nargs);
    if (unlikely(!argstuple)) return NULL;
    for (i = 0; i < nargs; i++) {
        Py_INCREF(args[i]);
        if (__Pyx_PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]) != (0)) goto bad;
    }
    result = __Pyx_PyObject_Call(func, argstuple, kwargs);
  bad:
    Py_DECREF(argstuple);
    return result;
}
#endif
#if CYTHON_VECTORCALL && !CYTHON_COMPILING_IN_LIMITED_API
  #if PY_VERSION_HEX < 0x03090000
    #define __Pyx_PyVectorcall_Function(callable) _PyVectorcall_Function(callable)
  #elif CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE vectorcallfunc __Pyx_PyVectorcall_Function(PyObject *callable) {
    PyTypeObject *tp = Py_TYPE(callable);
    #if defined(__Pyx_CyFunction_USED)
    if (__Pyx_CyFunction_CheckExact(callable)) {
        return __Pyx_CyFunction_func_vectorcall(callable);
    }
    #endif
    if (!PyType_HasFeature(tp, Py_TPFLAGS_HAVE_VECTORCALL)) {
        return NULL;
    }
    assert(PyCallable_Check(callable));
    Py_ssize_t offset = tp->tp_vectorcall_offset;
    assert(offset > 0);
    vectorcallfunc ptr;
    memcpy(&ptr, (char *) callable + offset, sizeof(ptr));
    return ptr;
}
  #else
    #define __Pyx_PyVectorcall_Function(callable) PyVectorcall_Function(callable)
  #endif
#endif
static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject *const *args, size_t _nargs, PyObject *kwargs) {
    Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs);
#if CYTHON_COMPILING_IN_CPYTHON
    if (nargs == 0 && kwargs == NULL) {
        if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_NOARGS))
            return __Pyx_PyObject_CallMethO(func, NULL);
    }
    else if (nargs == 1 && kwargs == NULL) {
        if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_O))
            return __Pyx_PyObject_CallMethO(func, args[0]);
    }
#endif
    if (kwargs == NULL) {
        #if CYTHON_VECTORCALL
          #if CYTHON_COMPILING_IN_LIMITED_API
            return PyObject_Vectorcall(func, args, _nargs, NULL);
          #else
            vectorcallfunc f = __Pyx_PyVectorcall_Function(func);
            if (f) {
                return f(func, args, _nargs, NULL);
            }
          #endif
        #endif
    }
    if (nargs == 0) {
        return __Pyx_PyObject_Call(func, __pyx_mstate_global->__pyx_empty_tuple, kwargs);
    }
    #if PY_VERSION_HEX >= 0x03090000 && !CYTHON_COMPILING_IN_LIMITED_API
    return PyObject_VectorcallDict(func, args, (size_t)nargs, kwargs);
    #else
    return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs);
    #endif
}

/* PyObjectCallOneArg (used by CallUnboundCMethod0) */
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *args[2] = {NULL, arg};
    return __Pyx_PyObject_FastCall(func, args+1, 1 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
}

/* UnpackUnboundCMethod (used by CallUnboundCMethod0) */
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030C0000
static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject *args, PyObject *kwargs) {
    PyObject *result;
    PyObject *selfless_args = PyTuple_GetSlice(args, 1, PyTuple_Size(args));
    if (unlikely(!selfless_args)) return NULL;
    result = PyObject_Call(method, selfless_args, kwargs);
    Py_DECREF(selfless_args);
    return result;
}
#elif CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03090000
static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) {
        return _PyObject_Vectorcall
            (method, args ? args+1 : NULL, nargs ? nargs-1 : 0, kwnames);
}
#else
static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) {
    return
#if PY_VERSION_HEX < 0x03090000
    _PyObject_Vectorcall
#else
    PyObject_Vectorcall
#endif
        (method, args ? args+1 : NULL, nargs ? (size_t) nargs-1 : 0, kwnames);
}
#endif
static PyMethodDef __Pyx_UnboundCMethod_Def = {
     "CythonUnboundCMethod",
     __PYX_REINTERPRET_FUNCION(PyCFunction, __Pyx_SelflessCall),
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030C0000
     METH_VARARGS | METH_KEYWORDS,
#else
     METH_FASTCALL | METH_KEYWORDS,
#endif
     NULL
};
static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) {
    PyObject *method, *result=NULL;
    method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name);
    if (unlikely(!method))
        return -1;
    result = method;
#if CYTHON_COMPILING_IN_CPYTHON
    if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type)))
    {
        PyMethodDescrObject *descr = (PyMethodDescrObject*) method;
        target->func = descr->d_method->ml_meth;
        target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS);
    } else
#endif
#if CYTHON_COMPILING_IN_PYPY
#else
    if (PyCFunction_Check(method))
#endif
    {
        PyObject *self;
        int self_found;
#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY
        self = PyObject_GetAttrString(method, "__self__");
        if (!self) {
            PyErr_Clear();
        }
#else
        self = PyCFunction_GET_SELF(method);
#endif
        self_found = (self && self != Py_None);
#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY
        Py_XDECREF(self);
#endif
        if (self_found) {
            PyObject *unbound_method = PyCFunction_New(&__Pyx_UnboundCMethod_Def, method);
            if (unlikely(!unbound_method)) return -1;
            Py_DECREF(method);
            result = unbound_method;
        }
    }
#if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    if (unlikely(target->method)) {
        Py_DECREF(result);
    } else
#endif
    target->method = result;
    return 0;
}

/* CallUnboundCMethod0 */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) {
    int was_initialized = __Pyx_CachedCFunction_GetAndSetInitializing(cfunc);
    if (likely(was_initialized == 2 && cfunc->func)) {
        if (likely(cfunc->flag == METH_NOARGS))
            return __Pyx_CallCFunction(cfunc, self, NULL);
        if (likely(cfunc->flag == METH_FASTCALL))
            return __Pyx_CallCFunctionFast(cfunc, self, NULL, 0);
        if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS))
            return __Pyx_CallCFunctionFastWithKeywords(cfunc, self, NULL, 0, NULL);
        if (likely(cfunc->flag == (METH_VARARGS | METH_KEYWORDS)))
            return __Pyx_CallCFunctionWithKeywords(cfunc, self, __pyx_mstate_global->__pyx_empty_tuple, NULL);
        if (cfunc->flag == METH_VARARGS)
            return __Pyx_CallCFunction(cfunc, self, __pyx_mstate_global->__pyx_empty_tuple);
        return __Pyx__CallUnboundCMethod0(cfunc, self);
    }
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    else if (unlikely(was_initialized == 1)) {
        __Pyx_CachedCFunction tmp_cfunc = {
#ifndef __cplusplus
            0
#endif
        };
        tmp_cfunc.type = cfunc->type;
        tmp_cfunc.method_name = cfunc->method_name;
        return __Pyx__CallUnboundCMethod0(&tmp_cfunc, self);
    }
#endif
    PyObject *result = __Pyx__CallUnboundCMethod0(cfunc, self);
    __Pyx_CachedCFunction_SetFinishedInitializing(cfunc);
    return result;
}
#endif
static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) {
    PyObject *result;
    if (unlikely(!cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
    result = __Pyx_PyObject_CallOneArg(cfunc->method, self);
    return result;
}

/* py_dict_items (used by OwnedDictNext) */
static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d) {
    return __Pyx_CallUnboundCMethod0(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_items, d);
}

/* py_dict_values (used by OwnedDictNext) */
static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d) {
    return __Pyx_CallUnboundCMethod0(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_values, d);
}

/* OwnedDictNext (used by ParseKeywordsImpl) */
#if CYTHON_AVOID_BORROWED_REFS
static int __Pyx_PyDict_NextRef(PyObject *p, PyObject **ppos, PyObject **pkey, PyObject **pvalue) {
    PyObject *next = NULL;
    if (!*ppos) {
        if (pvalue) {
            PyObject *dictview = pkey ? __Pyx_PyDict_Items(p) : __Pyx_PyDict_Values(p);
            if (unlikely(!dictview)) goto bad;
            *ppos = PyObject_GetIter(dictview);
            Py_DECREF(dictview);
        } else {
            *ppos = PyObject_GetIter(p);
        }
        if (unlikely(!*ppos)) goto bad;
    }
    next = PyIter_Next(*ppos);
    if (!next) {
        if (PyErr_Occurred()) goto bad;
        return 0;
    }
    if (pkey && pvalue) {
        *pkey = __Pyx_PySequence_ITEM(next, 0);
        if (unlikely(*pkey)) goto bad;
        *pvalue = __Pyx_PySequence_ITEM(next, 1);
        if (unlikely(*pvalue)) goto bad;
        Py_DECREF(next);
    } else if (pkey) {
        *pkey = next;
    } else {
        assert(pvalue);
        *pvalue = next;
    }
    return 1;
  bad:
    Py_XDECREF(next);
#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d0000
    PyErr_FormatUnraisable("Exception ignored in __Pyx_PyDict_NextRef");
#else
    PyErr_WriteUnraisable(__pyx_mstate_global->__pyx_n_u_Pyx_PyDict_NextRef);
#endif
    if (pkey) *pkey = NULL;
    if (pvalue) *pvalue = NULL;
    return 0;
}
#else // !CYTHON_AVOID_BORROWED_REFS
static int __Pyx_PyDict_NextRef(PyObject *p, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue) {
    int result = PyDict_Next(p, ppos, pkey, pvalue);
    if (likely(result == 1)) {
        if (pkey) Py_INCREF(*pkey);
        if (pvalue) Py_INCREF(*pvalue);
    }
    return result;
}
#endif

/* RaiseDoubleKeywords (used by ParseKeywordsImpl) */
static void __Pyx_RaiseDoubleKeywordsError(
    const char* func_name,
    PyObject* kw_name)
{
    PyErr_Format(PyExc_TypeError,
        "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
}

/* CallUnboundCMethod2 */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2) {
    int was_initialized = __Pyx_CachedCFunction_GetAndSetInitializing(cfunc);
    if (likely(was_initialized == 2 && cfunc->func)) {
        PyObject *args[2] = {arg1, arg2};
        if (cfunc->flag == METH_FASTCALL) {
            return __Pyx_CallCFunctionFast(cfunc, self, args, 2);
        }
        if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS))
            return __Pyx_CallCFunctionFastWithKeywords(cfunc, self, args, 2, NULL);
    }
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    else if (unlikely(was_initialized == 1)) {
        __Pyx_CachedCFunction tmp_cfunc = {
#ifndef __cplusplus
            0
#endif
        };
        tmp_cfunc.type = cfunc->type;
        tmp_cfunc.method_name = cfunc->method_name;
        return __Pyx__CallUnboundCMethod2(&tmp_cfunc, self, arg1, arg2);
    }
#endif
    PyObject *result = __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2);
    __Pyx_CachedCFunction_SetFinishedInitializing(cfunc);
    return result;
}
#endif
static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2){
    if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
#if CYTHON_COMPILING_IN_CPYTHON
    if (cfunc->func && (cfunc->flag & METH_VARARGS)) {
        PyObject *result = NULL;
        PyObject *args = PyTuple_New(2);
        if (unlikely(!args)) return NULL;
        Py_INCREF(arg1);
        PyTuple_SET_ITEM(args, 0, arg1);
        Py_INCREF(arg2);
        PyTuple_SET_ITEM(args, 1, arg2);
        if (cfunc->flag & METH_KEYWORDS)
            result = __Pyx_CallCFunctionWithKeywords(cfunc, self, args, NULL);
        else
            result = __Pyx_CallCFunction(cfunc, self, args);
        Py_DECREF(args);
        return result;
    }
#endif
    {
        PyObject *args[4] = {NULL, self, arg1, arg2};
        return __Pyx_PyObject_FastCall(cfunc->method, args+1, 3 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
    }
}

/* ParseKeywordsImpl (used by ParseKeywords) */
static int __Pyx_ValidateDuplicatePosArgs(
    PyObject *kwds,
    PyObject ** const argnames[],
    PyObject ** const *first_kw_arg,
    const char* function_name)
{
    PyObject ** const *name = argnames;
    while (name != first_kw_arg) {
        PyObject *key = **name;
        int found = PyDict_Contains(kwds, key);
        if (unlikely(found)) {
            if (found == 1) __Pyx_RaiseDoubleKeywordsError(function_name, key);
            goto bad;
        }
        name++;
    }
    return 0;
bad:
    return -1;
}
#if CYTHON_USE_UNICODE_INTERNALS
static CYTHON_INLINE int __Pyx_UnicodeKeywordsEqual(PyObject *s1, PyObject *s2) {
    int kind;
    Py_ssize_t len = PyUnicode_GET_LENGTH(s1);
    if (len != PyUnicode_GET_LENGTH(s2)) return 0;
    kind = PyUnicode_KIND(s1);
    if (kind != PyUnicode_KIND(s2)) return 0;
    const void *data1 = PyUnicode_DATA(s1);
    const void *data2 = PyUnicode_DATA(s2);
    return (memcmp(data1, data2, (size_t) len * (size_t) kind) == 0);
}
#endif
static int __Pyx_MatchKeywordArg_str(
    PyObject *key,
    PyObject ** const argnames[],
    PyObject ** const *first_kw_arg,
    size_t *index_found,
    const char *function_name)
{
    PyObject ** const *name;
    #if CYTHON_USE_UNICODE_INTERNALS
    Py_hash_t key_hash = ((PyASCIIObject*)key)->hash;
    if (unlikely(key_hash == -1)) {
        key_hash = PyObject_Hash(key);
        if (unlikely(key_hash == -1))
            goto bad;
    }
    #endif
    name = first_kw_arg;
    while (*name) {
        PyObject *name_str = **name;
        #if CYTHON_USE_UNICODE_INTERNALS
        if (key_hash == ((PyASCIIObject*)name_str)->hash && __Pyx_UnicodeKeywordsEqual(name_str, key)) {
            *index_found = (size_t) (name - argnames);
            return 1;
        }
        #else
        #if CYTHON_ASSUME_SAFE_SIZE
        if (PyUnicode_GET_LENGTH(name_str) == PyUnicode_GET_LENGTH(key))
        #endif
        {
            int cmp = PyUnicode_Compare(name_str, key);
            if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
            if (cmp == 0) {
                *index_found = (size_t) (name - argnames);
                return 1;
            }
        }
        #endif
        name++;
    }
    name = argnames;
    while (name != first_kw_arg) {
        PyObject *name_str = **name;
        #if CYTHON_USE_UNICODE_INTERNALS
        if (unlikely(key_hash == ((PyASCIIObject*)name_str)->hash)) {
            if (__Pyx_UnicodeKeywordsEqual(name_str, key))
                goto arg_passed_twice;
        }
        #else
        #if CYTHON_ASSUME_SAFE_SIZE
        if (PyUnicode_GET_LENGTH(name_str) == PyUnicode_GET_LENGTH(key))
        #endif
        {
            if (unlikely(name_str == key)) goto arg_passed_twice;
            int cmp = PyUnicode_Compare(name_str, key);
            if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
            if (cmp == 0) goto arg_passed_twice;
        }
        #endif
        name++;
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, key);
    goto bad;
bad:
    return -1;
}
static int __Pyx_MatchKeywordArg_nostr(
    PyObject *key,
    PyObject ** const argnames[],
    PyObject ** const *first_kw_arg,
    size_t *index_found,
    const char *function_name)
{
    PyObject ** const *name;
    if (unlikely(!PyUnicode_Check(key))) goto invalid_keyword_type;
    name = first_kw_arg;
    while (*name) {
        int cmp = PyObject_RichCompareBool(**name, key, Py_EQ);
        if (cmp == 1) {
            *index_found = (size_t) (name - argnames);
            return 1;
        }
        if (unlikely(cmp == -1)) goto bad;
        name++;
    }
    name = argnames;
    while (name != first_kw_arg) {
        int cmp = PyObject_RichCompareBool(**name, key, Py_EQ);
        if (unlikely(cmp != 0)) {
            if (cmp == 1) goto arg_passed_twice;
            else goto bad;
        }
        name++;
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, key);
    goto bad;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%.200s() keywords must be strings", function_name);
    goto bad;
bad:
    return -1;
}
static CYTHON_INLINE int __Pyx_MatchKeywordArg(
    PyObject *key,
    PyObject ** const argnames[],
    PyObject ** const *first_kw_arg,
    size_t *index_found,
    const char *function_name)
{
    return likely(PyUnicode_CheckExact(key)) ?
        __Pyx_MatchKeywordArg_str(key, argnames, first_kw_arg, index_found, function_name) :
        __Pyx_MatchKeywordArg_nostr(key, argnames, first_kw_arg, index_found, function_name);
}
static void __Pyx_RejectUnknownKeyword(
    PyObject *kwds,
    PyObject ** const argnames[],
    PyObject ** const *first_kw_arg,
    const char *function_name)
{
    #if CYTHON_AVOID_BORROWED_REFS
    PyObject *pos = NULL;
    #else
    Py_ssize_t pos = 0;
    #endif
    PyObject *key = NULL;
    __Pyx_BEGIN_CRITICAL_SECTION(kwds);
    while (
        #if CYTHON_AVOID_BORROWED_REFS
        __Pyx_PyDict_NextRef(kwds, &pos, &key, NULL)
        #else
        PyDict_Next(kwds, &pos, &key, NULL)
        #endif
    ) {
        PyObject** const *name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (!*name) {
            size_t index_found = 0;
            int cmp = __Pyx_MatchKeywordArg(key, argnames, first_kw_arg, &index_found, function_name);
            if (cmp != 1) {
                if (cmp == 0) {
                    PyErr_Format(PyExc_TypeError,
                        "%s() got an unexpected keyword argument '%U'",
                        function_name, key);
                }
                #if CYTHON_AVOID_BORROWED_REFS
                Py_DECREF(key);
                #endif
                break;
            }
        }
        #if CYTHON_AVOID_BORROWED_REFS
        Py_DECREF(key);
        #endif
    }
    __Pyx_END_CRITICAL_SECTION();
    #if CYTHON_AVOID_BORROWED_REFS
    Py_XDECREF(pos);
    #endif
    assert(PyErr_Occurred());
}
static int __Pyx_ParseKeywordDict(
    PyObject *kwds,
    PyObject ** const argnames[],
    PyObject *values[],
    Py_ssize_t num_pos_args,
    Py_ssize_t num_kwargs,
    const char* function_name,
    int ignore_unknown_kwargs)
{
    PyObject** const *name;
    PyObject** const *first_kw_arg = argnames + num_pos_args;
    Py_ssize_t extracted = 0;
#if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments)
    if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return -1;
#endif
    name = first_kw_arg;
    while (*name && num_kwargs > extracted) {
        PyObject * key = **name;
        PyObject *value;
        int found = 0;
        #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
        found = PyDict_GetItemRef(kwds, key, &value);
        #else
        value = PyDict_GetItemWithError(kwds, key);
        if (value) {
            Py_INCREF(value);
            found = 1;
        } else {
            if (unlikely(PyErr_Occurred())) goto bad;
        }
        #endif
        if (found) {
            if (unlikely(found < 0)) goto bad;
            values[name-argnames] = value;
            extracted++;
        }
        name++;
    }
    if (num_kwargs > extracted) {
        if (ignore_unknown_kwargs) {
            if (unlikely(__Pyx_ValidateDuplicatePosArgs(kwds, argnames, first_kw_arg, function_name) == -1))
                goto bad;
        } else {
            __Pyx_RejectUnknownKeyword(kwds, argnames, first_kw_arg, function_name);
            goto bad;
        }
    }
    return 0;
bad:
    return -1;
}
static int __Pyx_ParseKeywordDictToDict(
    PyObject *kwds,
    PyObject ** const argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    const char* function_name)
{
    PyObject** const *name;
    PyObject** const *first_kw_arg = argnames + num_pos_args;
    Py_ssize_t len;
#if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments)
    if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return -1;
#endif
    if (PyDict_Update(kwds2, kwds) < 0) goto bad;
    name = first_kw_arg;
    while (*name) {
        PyObject *key = **name;
        PyObject *value;
#if !CYTHON_COMPILING_IN_LIMITED_API && (PY_VERSION_HEX >= 0x030d00A2 || defined(PyDict_Pop))
        int found = PyDict_Pop(kwds2, key, &value);
        if (found) {
            if (unlikely(found < 0)) goto bad;
            values[name-argnames] = value;
        }
#elif __PYX_LIMITED_VERSION_HEX >= 0x030d0000
        int found = PyDict_GetItemRef(kwds2, key, &value);
        if (found) {
            if (unlikely(found < 0)) goto bad;
            values[name-argnames] = value;
            if (unlikely(PyDict_DelItem(kwds2, key) < 0)) goto bad;
        }
#else
    #if CYTHON_COMPILING_IN_CPYTHON
        value = _PyDict_Pop(kwds2, key, kwds2);
    #else
        value = __Pyx_CallUnboundCMethod2(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_pop, kwds2, key, kwds2);
    #endif
        if (value == kwds2) {
            Py_DECREF(value);
        } else {
            if (unlikely(!value)) goto bad;
            values[name-argnames] = value;
        }
#endif
        name++;
    }
    len = PyDict_Size(kwds2);
    if (len > 0) {
        return __Pyx_ValidateDuplicatePosArgs(kwds, argnames, first_kw_arg, function_name);
    } else if (unlikely(len == -1)) {
        goto bad;
    }
    return 0;
bad:
    return -1;
}
static int __Pyx_ParseKeywordsTuple(
    PyObject *kwds,
    PyObject * const *kwvalues,
    PyObject ** const argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    Py_ssize_t num_kwargs,
    const char* function_name,
    int ignore_unknown_kwargs)
{
    PyObject *key = NULL;
    PyObject** const * name;
    PyObject** const *first_kw_arg = argnames + num_pos_args;
    for (Py_ssize_t pos = 0; pos < num_kwargs; pos++) {
#if CYTHON_AVOID_BORROWED_REFS
        key = __Pyx_PySequence_ITEM(kwds, pos);
#else
        key = __Pyx_PyTuple_GET_ITEM(kwds, pos);
#endif
#if !CYTHON_ASSUME_SAFE_MACROS
        if (unlikely(!key)) goto bad;
#endif
        name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (*name) {
            PyObject *value = kwvalues[pos];
            values[name-argnames] = __Pyx_NewRef(value);
        } else {
            size_t index_found = 0;
            int cmp = __Pyx_MatchKeywordArg(key, argnames, first_kw_arg, &index_found, function_name);
            if (cmp == 1) {
                PyObject *value = kwvalues[pos];
                values[index_found] = __Pyx_NewRef(value);
            } else {
                if (unlikely(cmp == -1)) goto bad;
                if (kwds2) {
                    PyObject *value = kwvalues[pos];
                    if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
                } else if (!ignore_unknown_kwargs) {
                    goto invalid_keyword;
                }
            }
        }
        #if CYTHON_AVOID_BORROWED_REFS
        Py_DECREF(key);
        key = NULL;
        #endif
    }
    return 0;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    goto bad;
bad:
    #if CYTHON_AVOID_BORROWED_REFS
    Py_XDECREF(key);
    #endif
    return -1;
}

/* ParseKeywords */
static int __Pyx_ParseKeywords(
    PyObject *kwds,
    PyObject * const *kwvalues,
    PyObject ** const argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    Py_ssize_t num_kwargs,
    const char* function_name,
    int ignore_unknown_kwargs)
{
    if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds)))
        return __Pyx_ParseKeywordsTuple(kwds, kwvalues, argnames, kwds2, values, num_pos_args, num_kwargs, function_name, ignore_unknown_kwargs);
    else if (kwds2)
        return __Pyx_ParseKeywordDictToDict(kwds, argnames, kwds2, values, num_pos_args, function_name);
    else
        return __Pyx_ParseKeywordDict(kwds, argnames, values, num_pos_args, num_kwargs, function_name, ignore_unknown_kwargs);
}

/* RaiseArgTupleInvalid */
static void __Pyx_RaiseArgtupleInvalid(
    const char* func_name,
    int exact,
    Py_ssize_t num_min,
    Py_ssize_t num_max,
    Py_ssize_t num_found)
{
    Py_ssize_t num_expected;
    const char *more_or_less;
    if (num_found < num_min) {
        num_expected = num_min;
        more_or_less = "at least";
    } else {
        num_expected = num_max;
        more_or_less = "at most";
    }
    if (exact) {
        more_or_less = "exactly";
    }
    PyErr_Format(PyExc_TypeError,
                 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
                 func_name, more_or_less, num_expected,
                 (num_expected == 1) ? "" : "s", num_found);
}

/* ArgTypeTestFunc (used by ArgTypeTest) */
static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
{
    __Pyx_TypeName type_name;
    __Pyx_TypeName obj_type_name;
    PyObject *extra_info = __pyx_mstate_global->__pyx_empty_unicode;
    int from_annotation_subclass = 0;
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    else if (!exact) {
        if (likely(__Pyx_TypeCheck(obj, type))) return 1;
    } else if (exact == 2) {
        if (__Pyx_TypeCheck(obj, type)) {
            from_annotation_subclass = 1;
            extra_info = __pyx_mstate_global->__pyx_kp_u_Note_that_Cython_is_deliberately;
        }
    }
    type_name = __Pyx_PyType_GetFullyQualifiedName(type);
    obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj));
    PyErr_Format(PyExc_TypeError,
        "Argument '%.200s' has incorrect type (expected " __Pyx_FMT_TYPENAME
        ", got " __Pyx_FMT_TYPENAME ")"
#if __PYX_LIMITED_VERSION_HEX < 0x030C0000
        "%s%U"
#endif
        , name, type_name, obj_type_name
#if __PYX_LIMITED_VERSION_HEX < 0x030C0000
        , (from_annotation_subclass ? ". " : ""), extra_info
#endif
        );
#if __PYX_LIMITED_VERSION_HEX >= 0x030C0000
    if (exact == 2 && from_annotation_subclass) {
        PyObject *res;
        PyObject *vargs[2];
        vargs[0] = PyErr_GetRaisedException();
        vargs[1] = extra_info;
        res = PyObject_VectorcallMethod(__pyx_mstate_global->__pyx_kp_u_add_note, vargs, 2, NULL);
        Py_XDECREF(res);
        PyErr_SetRaisedException(vargs[0]);
    }
#endif
    __Pyx_DECREF_TypeName(type_name);
    __Pyx_DECREF_TypeName(obj_type_name);
    return 0;
}

/* RaiseException */
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
    PyObject* owned_instance = NULL;
    if (tb == Py_None) {
        tb = 0;
    } else if (tb && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto bad;
    }
    if (value == Py_None)
        value = 0;
    if (PyExceptionInstance_Check(type)) {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto bad;
        }
        value = type;
        type = (PyObject*) Py_TYPE(value);
    } else if (PyExceptionClass_Check(type)) {
        PyObject *instance_class = NULL;
        if (value && PyExceptionInstance_Check(value)) {
            instance_class = (PyObject*) Py_TYPE(value);
            if (instance_class != type) {
                int is_subclass = PyObject_IsSubclass(instance_class, type);
                if (!is_subclass) {
                    instance_class = NULL;
                } else if (unlikely(is_subclass == -1)) {
                    goto bad;
                } else {
                    type = instance_class;
                }
            }
        }
        if (!instance_class) {
            PyObject *args;
            if (!value)
                args = PyTuple_New(0);
            else if (PyTuple_Check(value)) {
                Py_INCREF(value);
                args = value;
            } else
                args = PyTuple_Pack(1, value);
            if (!args)
                goto bad;
            owned_instance = PyObject_Call(type, args, NULL);
            Py_DECREF(args);
            if (!owned_instance)
                goto bad;
            value = owned_instance;
            if (!PyExceptionInstance_Check(value)) {
                PyErr_Format(PyExc_TypeError,
                             "calling %R should have returned an instance of "
                             "BaseException, not %R",
                             type, Py_TYPE(value));
                goto bad;
            }
        }
    } else {
        PyErr_SetString(PyExc_TypeError,
            "raise: exception class must be a subclass of BaseException");
        goto bad;
    }
    if (cause) {
        PyObject *fixed_cause;
        if (cause == Py_None) {
            fixed_cause = NULL;
        } else if (PyExceptionClass_Check(cause)) {
            fixed_cause = PyObject_CallObject(cause, NULL);
            if (fixed_cause == NULL)
                goto bad;
        } else if (PyExceptionInstance_Check(cause)) {
            fixed_cause = cause;
            Py_INCREF(fixed_cause);
        } else {
            PyErr_SetString(PyExc_TypeError,
                            "exception causes must derive from "
                            "BaseException");
            goto bad;
        }
        PyException_SetCause(value, fixed_cause);
    }
    PyErr_SetObject(type, value);
    if (tb) {
#if PY_VERSION_HEX >= 0x030C00A6
        PyException_SetTraceback(value, tb);
#elif CYTHON_FAST_THREAD_STATE
        PyThreadState *tstate = __Pyx_PyThreadState_Current;
        PyObject* tmp_tb = tstate->curexc_traceback;
        if (tb != tmp_tb) {
            Py_INCREF(tb);
            tstate->curexc_traceback = tb;
            Py_XDECREF(tmp_tb);
        }
#else
        PyObject *tmp_type, *tmp_value, *tmp_tb;
        PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
        Py_INCREF(tb);
        PyErr_Restore(tmp_type, tmp_value, tb);
        Py_XDECREF(tmp_tb);
#endif
    }
bad:
    Py_XDECREF(owned_instance);
    return;
}

/* PyObjectFastCallMethod */
#if !CYTHON_VECTORCALL || PY_VERSION_HEX < 0x03090000
static PyObject *__Pyx_PyObject_FastCallMethod(PyObject *name, PyObject *const *args, size_t nargsf) {
    PyObject *result;
    PyObject *attr = PyObject_GetAttr(args[0], name);
    if (unlikely(!attr))
        return NULL;
    result = __Pyx_PyObject_FastCall(attr, args+1, nargsf - 1);
    Py_DECREF(attr);
    return result;
}
#endif

/* RaiseUnexpectedTypeError */
static int
__Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj)
{
    __Pyx_TypeName obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj));
    PyErr_Format(PyExc_TypeError, "Expected %s, got " __Pyx_FMT_TYPENAME,
                 expected, obj_type_name);
    __Pyx_DECREF_TypeName(obj_type_name);
    return 0;
}

/* CIntToDigits (used by CIntToPyUnicode) */
static const char DIGIT_PAIRS_10[2*10*10+1] = {
    "00010203040506070809"
    "10111213141516171819"
    "20212223242526272829"
    "30313233343536373839"
    "40414243444546474849"
    "50515253545556575859"
    "60616263646566676869"
    "70717273747576777879"
    "80818283848586878889"
    "90919293949596979899"
};
static const char DIGIT_PAIRS_8[2*8*8+1] = {
    "0001020304050607"
    "1011121314151617"
    "2021222324252627"
    "3031323334353637"
    "4041424344454647"
    "5051525354555657"
    "6061626364656667"
    "7071727374757677"
};
static const char DIGITS_HEX[2*16+1] = {
    "0123456789abcdef"
    "0123456789ABCDEF"
};

/* BuildPyUnicode (used by COrdinalToPyUnicode) */
static PyObject* __Pyx_PyUnicode_BuildFromAscii(Py_ssize_t ulength, const char* chars, int clength,
                                                int prepend_sign, char padding_char) {
    PyObject *uval;
    Py_ssize_t uoffset = ulength - clength;
#if CYTHON_USE_UNICODE_INTERNALS
    Py_ssize_t i;
    void *udata;
    uval = PyUnicode_New(ulength, 127);
    if (unlikely(!uval)) return NULL;
    udata = PyUnicode_DATA(uval);
    if (uoffset > 0) {
        i = 0;
        if (prepend_sign) {
            __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, 0, '-');
            i++;
        }
        for (; i < uoffset; i++) {
            __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, i, padding_char);
        }
    }
    for (i=0; i < clength; i++) {
        __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, uoffset+i, chars[i]);
    }
#else
    {
        PyObject *sign = NULL, *padding = NULL;
        uval = NULL;
        if (uoffset > 0) {
            prepend_sign = !!prepend_sign;
            if (uoffset > prepend_sign) {
                padding = PyUnicode_FromOrdinal(padding_char);
                if (likely(padding) && uoffset > prepend_sign + 1) {
                    PyObject *tmp = PySequence_Repeat(padding, uoffset - prepend_sign);
                    Py_DECREF(padding);
                    padding = tmp;
                }
                if (unlikely(!padding)) goto done_or_error;
            }
            if (prepend_sign) {
                sign = PyUnicode_FromOrdinal('-');
                if (unlikely(!sign)) goto done_or_error;
            }
        }
        uval = PyUnicode_DecodeASCII(chars, clength, NULL);
        if (likely(uval) && padding) {
            PyObject *tmp = PyUnicode_Concat(padding, uval);
            Py_DECREF(uval);
            uval = tmp;
        }
        if (likely(uval) && sign) {
            PyObject *tmp = PyUnicode_Concat(sign, uval);
            Py_DECREF(uval);
            uval = tmp;
        }
done_or_error:
        Py_XDECREF(padding);
        Py_XDECREF(sign);
    }
#endif
    return uval;
}

/* COrdinalToPyUnicode (used by CIntToPyUnicode) */
static CYTHON_INLINE int __Pyx_CheckUnicodeValue(int value) {
    return value <= 1114111;
}
static PyObject* __Pyx_PyUnicode_FromOrdinal_Padded(int value, Py_ssize_t ulength, char padding_char) {
    Py_ssize_t padding_length = ulength - 1;
    if (likely((padding_length <= 250) && (value < 0xD800 || value > 0xDFFF))) {
        char chars[256];
        if (value <= 255) {
            memset(chars, padding_char, (size_t) padding_length);
            chars[ulength-1] = (char) value;
            return PyUnicode_DecodeLatin1(chars, ulength, NULL);
        }
        char *cpos = chars + sizeof(chars);
        if (value < 0x800) {
            *--cpos = (char) (0x80 | (value & 0x3f));
            value >>= 6;
            *--cpos = (char) (0xc0 | (value & 0x1f));
        } else if (value < 0x10000) {
            *--cpos = (char) (0x80 | (value & 0x3f));
            value >>= 6;
            *--cpos = (char) (0x80 | (value & 0x3f));
            value >>= 6;
            *--cpos = (char) (0xe0 | (value & 0x0f));
        } else {
            *--cpos = (char) (0x80 | (value & 0x3f));
            value >>= 6;
            *--cpos = (char) (0x80 | (value & 0x3f));
            value >>= 6;
            *--cpos = (char) (0x80 | (value & 0x3f));
            value >>= 6;
            *--cpos = (char) (0xf0 | (value & 0x07));
        }
        cpos -= padding_length;
        memset(cpos, padding_char, (size_t) padding_length);
        return PyUnicode_DecodeUTF8(cpos, chars + sizeof(chars) - cpos, NULL);
    }
    if (value <= 127 && CYTHON_USE_UNICODE_INTERNALS) {
        const char chars[1] = {(char) value};
        return __Pyx_PyUnicode_BuildFromAscii(ulength, chars, 1, 0, padding_char);
    }
    {
        PyObject *uchar, *padding_uchar, *padding, *result;
        padding_uchar = PyUnicode_FromOrdinal(padding_char);
        if (unlikely(!padding_uchar)) return NULL;
        padding = PySequence_Repeat(padding_uchar, padding_length);
        Py_DECREF(padding_uchar);
        if (unlikely(!padding)) return NULL;
        uchar = PyUnicode_FromOrdinal(value);
        if (unlikely(!uchar)) {
            Py_DECREF(padding);
            return NULL;
        }
        result = PyUnicode_Concat(padding, uchar);
        Py_DECREF(padding);
        Py_DECREF(uchar);
        return result;
    }
}

/* CIntToPyUnicode */
static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_int(int value, Py_ssize_t width, char padding_char) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const int neg_one = (int) -1, const_zero = (int) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (unlikely(!(is_unsigned || value == 0 || value > 0) ||
                    !(sizeof(value) <= 2 || value & ~ (int) 0x01fffff || __Pyx_CheckUnicodeValue((int) value)))) {
        PyErr_SetString(PyExc_OverflowError, "%c arg not in range(0x110000)");
        return NULL;
    }
    if (width <= 1) {
        return PyUnicode_FromOrdinal((int) value);
    }
    return __Pyx_PyUnicode_FromOrdinal_Padded((int) value, width, padding_char);
}
static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_int(int value, Py_ssize_t width, char padding_char, char format_char) {
    char digits[sizeof(int)*3+2];
    char *dpos, *end = digits + sizeof(int)*3+2;
    const char *hex_digits = DIGITS_HEX;
    Py_ssize_t length, ulength;
    int prepend_sign, last_one_off;
    int remaining;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const int neg_one = (int) -1, const_zero = (int) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (format_char == 'X') {
        hex_digits += 16;
        format_char = 'x';
    }
    remaining = value;
    last_one_off = 0;
    dpos = end;
    do {
        int digit_pos;
        switch (format_char) {
        case 'o':
            digit_pos = abs((int)(remaining % (8*8)));
            remaining = (int) (remaining / (8*8));
            dpos -= 2;
            memcpy(dpos, DIGIT_PAIRS_8 + digit_pos * 2, 2);
            last_one_off = (digit_pos < 8);
            break;
        case 'd':
            digit_pos = abs((int)(remaining % (10*10)));
            remaining = (int) (remaining / (10*10));
            dpos -= 2;
            memcpy(dpos, DIGIT_PAIRS_10 + digit_pos * 2, 2);
            last_one_off = (digit_pos < 10);
            break;
        case 'x':
            *(--dpos) = hex_digits[abs((int)(remaining % 16))];
            remaining = (int) (remaining / 16);
            break;
        default:
            assert(0);
            break;
        }
    } while (unlikely(remaining != 0));
    assert(!last_one_off || *dpos == '0');
    dpos += last_one_off;
    length = end - dpos;
    ulength = length;
    prepend_sign = 0;
    if (!is_unsigned && value <= neg_one) {
        if (padding_char == ' ' || width <= length + 1) {
            *(--dpos) = '-';
            ++length;
        } else {
            prepend_sign = 1;
        }
        ++ulength;
    }
    if (width > ulength) {
        ulength = width;
    }
    if (ulength == 1) {
        return PyUnicode_FromOrdinal(*dpos);
    }
    return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char);
}

/* CIntToPyUnicode */
static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const Py_ssize_t neg_one = (Py_ssize_t) -1, const_zero = (Py_ssize_t) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (unlikely(!(is_unsigned || value == 0 || value > 0) ||
                    !(sizeof(value) <= 2 || value & ~ (Py_ssize_t) 0x01fffff || __Pyx_CheckUnicodeValue((int) value)))) {
        PyErr_SetString(PyExc_OverflowError, "%c arg not in range(0x110000)");
        return NULL;
    }
    if (width <= 1) {
        return PyUnicode_FromOrdinal((int) value);
    }
    return __Pyx_PyUnicode_FromOrdinal_Padded((int) value, width, padding_char);
}
static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char, char format_char) {
    char digits[sizeof(Py_ssize_t)*3+2];
    char *dpos, *end = digits + sizeof(Py_ssize_t)*3+2;
    const char *hex_digits = DIGITS_HEX;
    Py_ssize_t length, ulength;
    int prepend_sign, last_one_off;
    Py_ssize_t remaining;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const Py_ssize_t neg_one = (Py_ssize_t) -1, const_zero = (Py_ssize_t) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (format_char == 'X') {
        hex_digits += 16;
        format_char = 'x';
    }
    remaining = value;
    last_one_off = 0;
    dpos = end;
    do {
        int digit_pos;
        switch (format_char) {
        case 'o':
            digit_pos = abs((int)(remaining % (8*8)));
            remaining = (Py_ssize_t) (remaining / (8*8));
            dpos -= 2;
            memcpy(dpos, DIGIT_PAIRS_8 + digit_pos * 2, 2);
            last_one_off = (digit_pos < 8);
            break;
        case 'd':
            digit_pos = abs((int)(remaining % (10*10)));
            remaining = (Py_ssize_t) (remaining / (10*10));
            dpos -= 2;
            memcpy(dpos, DIGIT_PAIRS_10 + digit_pos * 2, 2);
            last_one_off = (digit_pos < 10);
            break;
        case 'x':
            *(--dpos) = hex_digits[abs((int)(remaining % 16))];
            remaining = (Py_ssize_t) (remaining / 16);
            break;
        default:
            assert(0);
            break;
        }
    } while (unlikely(remaining != 0));
    assert(!last_one_off || *dpos == '0');
    dpos += last_one_off;
    length = end - dpos;
    ulength = length;
    prepend_sign = 0;
    if (!is_unsigned && value <= neg_one) {
        if (padding_char == ' ' || width <= length + 1) {
            *(--dpos) = '-';
            ++length;
        } else {
            prepend_sign = 1;
        }
        ++ulength;
    }
    if (width > ulength) {
        ulength = width;
    }
    if (ulength == 1) {
        return PyUnicode_FromOrdinal(*dpos);
    }
    return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char);
}

/* JoinPyUnicode */
static PyObject* __Pyx_PyUnicode_Join(PyObject** values, Py_ssize_t value_count, Py_ssize_t result_ulength,
                                      Py_UCS4 max_char) {
#if CYTHON_USE_UNICODE_INTERNALS && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    PyObject *result_uval;
    int result_ukind, kind_shift;
    Py_ssize_t i, char_pos;
    void *result_udata;
    if (max_char > 1114111) max_char = 1114111;
    result_uval = PyUnicode_New(result_ulength, max_char);
    if (unlikely(!result_uval)) return NULL;
    result_ukind = (max_char <= 255) ? PyUnicode_1BYTE_KIND : (max_char <= 65535) ? PyUnicode_2BYTE_KIND : PyUnicode_4BYTE_KIND;
    kind_shift = (result_ukind == PyUnicode_4BYTE_KIND) ? 2 : result_ukind - 1;
    result_udata = PyUnicode_DATA(result_uval);
    assert(kind_shift == 2 || kind_shift == 1 || kind_shift == 0);
    if (unlikely((PY_SSIZE_T_MAX >> kind_shift) - result_ulength < 0))
        goto overflow;
    char_pos = 0;
    for (i=0; i < value_count; i++) {
        int ukind;
        Py_ssize_t ulength;
        void *udata;
        PyObject *uval = values[i];
        #if !CYTHON_COMPILING_IN_LIMITED_API
        if (__Pyx_PyUnicode_READY(uval) == (-1))
            goto bad;
        #endif
        ulength = __Pyx_PyUnicode_GET_LENGTH(uval);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely(ulength < 0)) goto bad;
        #endif
        if (unlikely(!ulength))
            continue;
        if (unlikely((PY_SSIZE_T_MAX >> kind_shift) - ulength < char_pos))
            goto overflow;
        ukind = __Pyx_PyUnicode_KIND(uval);
        udata = __Pyx_PyUnicode_DATA(uval);
        if (ukind == result_ukind) {
            memcpy((char *)result_udata + (char_pos << kind_shift), udata, (size_t) (ulength << kind_shift));
        } else {
            #if PY_VERSION_HEX >= 0x030d0000
            if (unlikely(PyUnicode_CopyCharacters(result_uval, char_pos, uval, 0, ulength) < 0)) goto bad;
            #elif CYTHON_COMPILING_IN_CPYTHON || defined(_PyUnicode_FastCopyCharacters)
            _PyUnicode_FastCopyCharacters(result_uval, char_pos, uval, 0, ulength);
            #else
            Py_ssize_t j;
            for (j=0; j < ulength; j++) {
                Py_UCS4 uchar = __Pyx_PyUnicode_READ(ukind, udata, j);
                __Pyx_PyUnicode_WRITE(result_ukind, result_udata, char_pos+j, uchar);
            }
            #endif
        }
        char_pos += ulength;
    }
    return result_uval;
overflow:
    PyErr_SetString(PyExc_OverflowError, "join() result is too long for a Python string");
bad:
    Py_DECREF(result_uval);
    return NULL;
#else
    Py_ssize_t i;
    PyObject *result = NULL;
    PyObject *value_tuple = PyTuple_New(value_count);
    if (unlikely(!value_tuple)) return NULL;
    CYTHON_UNUSED_VAR(max_char);
    CYTHON_UNUSED_VAR(result_ulength);
    for (i=0; i<value_count; i++) {
        if (__Pyx_PyTuple_SET_ITEM(value_tuple, i, values[i]) != (0)) goto bad;
        Py_INCREF(values[i]);
    }
    result = PyUnicode_Join(__pyx_mstate_global->__pyx_empty_unicode, value_tuple);
bad:
    Py_DECREF(value_tuple);
    return result;
#endif
}

/* GetAttr */
static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
#if CYTHON_USE_TYPE_SLOTS
    if (likely(PyUnicode_Check(n)))
        return __Pyx_PyObject_GetAttrStr(o, n);
#endif
    return PyObject_GetAttr(o, n);
}

/* GetItemInt */
static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
    PyObject *r;
    if (unlikely(!j)) return NULL;
    r = PyObject_GetItem(o, j);
    Py_DECREF(j);
    return r;
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck, int unsafe_shared) {
    CYTHON_MAYBE_UNUSED_VAR(unsafe_shared);
#if CYTHON_ASSUME_SAFE_SIZE
    Py_ssize_t wrapped_i = i;
    if (wraparound & unlikely(i < 0)) {
        wrapped_i += PyList_GET_SIZE(o);
    }
    if ((CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS)) {
        return __Pyx_PyList_GetItemRefFast(o, wrapped_i, unsafe_shared);
    } else
    if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
        return __Pyx_NewRef(PyList_GET_ITEM(o, wrapped_i));
    }
    return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i));
#else
    (void)wraparound;
    (void)boundscheck;
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck, int unsafe_shared) {
    CYTHON_MAYBE_UNUSED_VAR(unsafe_shared);
#if CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    Py_ssize_t wrapped_i = i;
    if (wraparound & unlikely(i < 0)) {
        wrapped_i += PyTuple_GET_SIZE(o);
    }
    if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
        return __Pyx_NewRef(PyTuple_GET_ITEM(o, wrapped_i));
    }
    return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i));
#else
    (void)wraparound;
    (void)boundscheck;
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
                                                     int wraparound, int boundscheck, int unsafe_shared) {
    CYTHON_MAYBE_UNUSED_VAR(unsafe_shared);
#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
        if ((CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS)) {
            return __Pyx_PyList_GetItemRefFast(o, n, unsafe_shared);
        } else if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
            return __Pyx_NewRef(PyList_GET_ITEM(o, n));
        }
    } else
    #if !CYTHON_AVOID_BORROWED_REFS
    if (PyTuple_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
        if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
            return __Pyx_NewRef(PyTuple_GET_ITEM(o, n));
        }
    } else
    #endif
#endif
#if CYTHON_USE_TYPE_SLOTS && !CYTHON_COMPILING_IN_PYPY
    {
        PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping;
        PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence;
        if (!is_list && mm && mm->mp_subscript) {
            PyObject *r, *key = PyLong_FromSsize_t(i);
            if (unlikely(!key)) return NULL;
            r = mm->mp_subscript(o, key);
            Py_DECREF(key);
            return r;
        }
        if (is_list || likely(sm && sm->sq_item)) {
            if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) {
                Py_ssize_t l = sm->sq_length(o);
                if (likely(l >= 0)) {
                    i += l;
                } else {
                    if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                        return NULL;
                    PyErr_Clear();
                }
            }
            return sm->sq_item(o, i);
        }
    }
#else
    if (is_list || !PyMapping_Check(o)) {
        return PySequence_GetItem(o, i);
    }
#endif
    (void)wraparound;
    (void)boundscheck;
    return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i));
}

/* ObjectGetItem */
#if CYTHON_USE_TYPE_SLOTS
static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject *index) {
    PyObject *runerr = NULL;
    Py_ssize_t key_value;
    key_value = __Pyx_PyIndex_AsSsize_t(index);
    if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
        return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1, 1);
    }
    if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
        __Pyx_TypeName index_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(index));
        PyErr_Clear();
        PyErr_Format(PyExc_IndexError,
            "cannot fit '" __Pyx_FMT_TYPENAME "' into an index-sized integer", index_type_name);
        __Pyx_DECREF_TypeName(index_type_name);
    }
    return NULL;
}
static PyObject *__Pyx_PyObject_GetItem_Slow(PyObject *obj, PyObject *key) {
    __Pyx_TypeName obj_type_name;
    if (likely(PyType_Check(obj))) {
        PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(obj, __pyx_mstate_global->__pyx_n_u_class_getitem);
        if (!meth) {
            PyErr_Clear();
        } else {
            PyObject *result = __Pyx_PyObject_CallOneArg(meth, key);
            Py_DECREF(meth);
            return result;
        }
    }
    obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj));
    PyErr_Format(PyExc_TypeError,
        "'" __Pyx_FMT_TYPENAME "' object is not subscriptable", obj_type_name);
    __Pyx_DECREF_TypeName(obj_type_name);
    return NULL;
}
static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key) {
    PyTypeObject *tp = Py_TYPE(obj);
    PyMappingMethods *mm = tp->tp_as_mapping;
    PySequenceMethods *sm = tp->tp_as_sequence;
    if (likely(mm && mm->mp_subscript)) {
        return mm->mp_subscript(obj, key);
    }
    if (likely(sm && sm->sq_item)) {
        return __Pyx_PyObject_GetIndex(obj, key);
    }
    return __Pyx_PyObject_GetItem_Slow(obj, key);
}
#endif

/* RejectKeywords */
static void __Pyx_RejectKeywords(const char* function_name, PyObject *kwds) {
    PyObject *key = NULL;
    if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds))) {
        key = __Pyx_PySequence_ITEM(kwds, 0);
    } else {
#if CYTHON_AVOID_BORROWED_REFS
        PyObject *pos = NULL;
#else
        Py_ssize_t pos = 0;
#endif
#if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments)
        if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return;
#endif
        __Pyx_PyDict_NextRef(kwds, &pos, &key, NULL);
#if CYTHON_AVOID_BORROWED_REFS
        Py_XDECREF(pos);
#endif
    }
    if (likely(key)) {
        PyErr_Format(PyExc_TypeError,
            "%s() got an unexpected keyword argument '%U'",
            function_name, key);
        Py_DECREF(key);
    }
}

/* DivInt[Py_ssize_t] */
static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b, int b_is_constant) {
    Py_ssize_t q = a / b;
    Py_ssize_t r = a - q*b;
    Py_ssize_t adapt_python = (b_is_constant ?
        ((r != 0) & ((r < 0) ^ (b < 0))) :
        ((r != 0) & ((r ^ b) < 0))
    );
    return q - adapt_python;
}

/* GetAttr3 */
#if __PYX_LIMITED_VERSION_HEX < 0x030d0000
static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
        return NULL;
    __Pyx_PyErr_Clear();
    Py_INCREF(d);
    return d;
}
#endif
static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
    PyObject *r;
#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
    int res = PyObject_GetOptionalAttr(o, n, &r);
    return (res != 0) ? r : __Pyx_NewRef(d);
#else
  #if CYTHON_USE_TYPE_SLOTS
    if (likely(PyUnicode_Check(n))) {
        r = __Pyx_PyObject_GetAttrStrNoError(o, n);
        if (unlikely(!r) && likely(!PyErr_Occurred())) {
            r = __Pyx_NewRef(d);
        }
        return r;
    }
  #endif
    r = PyObject_GetAttr(o, n);
    return (likely(r)) ? r : __Pyx_GetAttr3Default(d);
#endif
}

/* PyDictVersioning (used by GetModuleGlobalName) */
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
    PyObject *dict = Py_TYPE(obj)->tp_dict;
    return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
}
static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
    PyObject **dictptr = NULL;
    Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
    if (offset) {
#if CYTHON_COMPILING_IN_CPYTHON
        dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
#else
        dictptr = _PyObject_GetDictPtr(obj);
#endif
    }
    return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
}
static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
    PyObject *dict = Py_TYPE(obj)->tp_dict;
    if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
        return 0;
    return obj_dict_version == __Pyx_get_object_dict_version(obj);
}
#endif

/* GetModuleGlobalName */
#if CYTHON_USE_DICT_VERSIONS
static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
#else
static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
#endif
{
    PyObject *result;
#if CYTHON_COMPILING_IN_LIMITED_API
    if (unlikely(!__pyx_m)) {
        if (!PyErr_Occurred())
            PyErr_SetNone(PyExc_NameError);
        return NULL;
    }
    result = PyObject_GetAttr(__pyx_m, name);
    if (likely(result)) {
        return result;
    }
    PyErr_Clear();
#elif CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
    if (unlikely(__Pyx_PyDict_GetItemRef(__pyx_mstate_global->__pyx_d, name, &result) == -1)) PyErr_Clear();
    __PYX_UPDATE_DICT_CACHE(__pyx_mstate_global->__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return result;
    }
#else
    result = _PyDict_GetItem_KnownHash(__pyx_mstate_global->__pyx_d, name, ((PyASCIIObject *) name)->hash);
    __PYX_UPDATE_DICT_CACHE(__pyx_mstate_global->__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    }
    PyErr_Clear();
#endif
    return __Pyx_GetBuiltinName(name);
}

/* RaiseTooManyValuesToUnpack */
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
    PyErr_Format(PyExc_ValueError,
                 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
}

/* RaiseNeedMoreValuesToUnpack */
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
    PyErr_Format(PyExc_ValueError,
                 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
                 index, (index == 1) ? "" : "s");
}

/* RaiseNoneIterError */
static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
}

/* ExtTypeTest */
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
    __Pyx_TypeName obj_type_name;
    __Pyx_TypeName type_name;
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (likely(__Pyx_TypeCheck(obj, type)))
        return 1;
    obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj));
    type_name = __Pyx_PyType_GetFullyQualifiedName(type);
    PyErr_Format(PyExc_TypeError,
                 "Cannot convert " __Pyx_FMT_TYPENAME " to " __Pyx_FMT_TYPENAME,
                 obj_type_name, type_name);
    __Pyx_DECREF_TypeName(obj_type_name);
    __Pyx_DECREF_TypeName(type_name);
    return 0;
}

/* GetTopmostException (used by SaveResetException) */
#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE
static _PyErr_StackItem *
__Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
{
    _PyErr_StackItem *exc_info = tstate->exc_info;
    while ((exc_info->exc_value == NULL || exc_info->exc_value == Py_None) &&
           exc_info->previous_item != NULL)
    {
        exc_info = exc_info->previous_item;
    }
    return exc_info;
}
#endif

/* SaveResetException */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
  #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4
    _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
    PyObject *exc_value = exc_info->exc_value;
    if (exc_value == NULL || exc_value == Py_None) {
        *value = NULL;
        *type = NULL;
        *tb = NULL;
    } else {
        *value = exc_value;
        Py_INCREF(*value);
        *type = (PyObject*) Py_TYPE(exc_value);
        Py_INCREF(*type);
        *tb = PyException_GetTraceback(exc_value);
    }
  #elif CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
    *type = exc_info->exc_type;
    *value = exc_info->exc_value;
    *tb = exc_info->exc_traceback;
    Py_XINCREF(*type);
    Py_XINCREF(*value);
    Py_XINCREF(*tb);
  #else
    *type = tstate->exc_type;
    *value = tstate->exc_value;
    *tb = tstate->exc_traceback;
    Py_XINCREF(*type);
    Py_XINCREF(*value);
    Py_XINCREF(*tb);
  #endif
}
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
  #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4
    _PyErr_StackItem *exc_info = tstate->exc_info;
    PyObject *tmp_value = exc_info->exc_value;
    exc_info->exc_value = value;
    Py_XDECREF(tmp_value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
  #else
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    #if CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = tstate->exc_info;
    tmp_type = exc_info->exc_type;
    tmp_value = exc_info->exc_value;
    tmp_tb = exc_info->exc_traceback;
    exc_info->exc_type = type;
    exc_info->exc_value = value;
    exc_info->exc_traceback = tb;
    #else
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = type;
    tstate->exc_value = value;
    tstate->exc_traceback = tb;
    #endif
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
  #endif
}
#endif

/* GetException */
#if CYTHON_FAST_THREAD_STATE
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
#else
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
#endif
{
    PyObject *local_type = NULL, *local_value, *local_tb = NULL;
#if CYTHON_FAST_THREAD_STATE
    PyObject *tmp_type, *tmp_value, *tmp_tb;
  #if PY_VERSION_HEX >= 0x030C0000
    local_value = tstate->current_exception;
    tstate->current_exception = 0;
  #else
    local_type = tstate->curexc_type;
    local_value = tstate->curexc_value;
    local_tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
  #endif
#elif __PYX_LIMITED_VERSION_HEX > 0x030C0000
    local_value = PyErr_GetRaisedException();
#else
    PyErr_Fetch(&local_type, &local_value, &local_tb);
#endif
#if __PYX_LIMITED_VERSION_HEX > 0x030C0000
    if (likely(local_value)) {
        local_type = (PyObject*) Py_TYPE(local_value);
        Py_INCREF(local_type);
        local_tb = PyException_GetTraceback(local_value);
    }
#else
    PyErr_NormalizeException(&local_type, &local_value, &local_tb);
#if CYTHON_FAST_THREAD_STATE
    if (unlikely(tstate->curexc_type))
#else
    if (unlikely(PyErr_Occurred()))
#endif
        goto bad;
    if (local_tb) {
        if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
            goto bad;
    }
#endif // __PYX_LIMITED_VERSION_HEX > 0x030C0000
    Py_XINCREF(local_tb);
    Py_XINCREF(local_type);
    Py_XINCREF(local_value);
    *type = local_type;
    *value = local_value;
    *tb = local_tb;
#if CYTHON_FAST_THREAD_STATE
    #if CYTHON_USE_EXC_INFO_STACK
    {
        _PyErr_StackItem *exc_info = tstate->exc_info;
      #if PY_VERSION_HEX >= 0x030B00a4
        tmp_value = exc_info->exc_value;
        exc_info->exc_value = local_value;
        tmp_type = NULL;
        tmp_tb = NULL;
        Py_XDECREF(local_type);
        Py_XDECREF(local_tb);
      #else
        tmp_type = exc_info->exc_type;
        tmp_value = exc_info->exc_value;
        tmp_tb = exc_info->exc_traceback;
        exc_info->exc_type = local_type;
        exc_info->exc_value = local_value;
        exc_info->exc_traceback = local_tb;
      #endif
    }
    #else
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = local_type;
    tstate->exc_value = local_value;
    tstate->exc_traceback = local_tb;
    #endif
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#elif __PYX_LIMITED_VERSION_HEX >= 0x030b0000
    PyErr_SetHandledException(local_value);
    Py_XDECREF(local_value);
    Py_XDECREF(local_type);
    Py_XDECREF(local_tb);
#else
    PyErr_SetExcInfo(local_type, local_value, local_tb);
#endif
    return 0;
#if __PYX_LIMITED_VERSION_HEX <= 0x030C0000
bad:
    *type = 0;
    *value = 0;
    *tb = 0;
    Py_XDECREF(local_type);
    Py_XDECREF(local_value);
    Py_XDECREF(local_tb);
    return -1;
#endif
}

/* SwapException */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
  #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4
    _PyErr_StackItem *exc_info = tstate->exc_info;
    tmp_value = exc_info->exc_value;
    exc_info->exc_value = *value;
    if (tmp_value == NULL || tmp_value == Py_None) {
        Py_XDECREF(tmp_value);
        tmp_value = NULL;
        tmp_type = NULL;
        tmp_tb = NULL;
    } else {
        tmp_type = (PyObject*) Py_TYPE(tmp_value);
        Py_INCREF(tmp_type);
        #if CYTHON_COMPILING_IN_CPYTHON
        tmp_tb = ((PyBaseExceptionObject*) tmp_value)->traceback;
        Py_XINCREF(tmp_tb);
        #else
        tmp_tb = PyException_GetTraceback(tmp_value);
        #endif
    }
  #elif CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = tstate->exc_info;
    tmp_type = exc_info->exc_type;
    tmp_value = exc_info->exc_value;
    tmp_tb = exc_info->exc_traceback;
    exc_info->exc_type = *type;
    exc_info->exc_value = *value;
    exc_info->exc_traceback = *tb;
  #else
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = *type;
    tstate->exc_value = *value;
    tstate->exc_traceback = *tb;
  #endif
    *type = tmp_type;
    *value = tmp_value;
    *tb = tmp_tb;
}
#else
static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
    PyErr_SetExcInfo(*type, *value, *tb);
    *type = tmp_type;
    *value = tmp_value;
    *tb = tmp_tb;
}
#endif

/* HasAttr (used by ImportImpl) */
#if __PYX_LIMITED_VERSION_HEX < 0x030d0000
static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
    PyObject *r;
    if (unlikely(!PyUnicode_Check(n))) {
        PyErr_SetString(PyExc_TypeError,
                        "hasattr(): attribute name must be string");
        return -1;
    }
    r = __Pyx_PyObject_GetAttrStrNoError(o, n);
    if (!r) {
        return (unlikely(PyErr_Occurred())) ? -1 : 0;
    } else {
        Py_DECREF(r);
        return 1;
    }
}
#endif

/* ImportImpl (used by Import) */
static int __Pyx__Import_GetModule(PyObject *qualname, PyObject **module) {
    PyObject *imported_module = PyImport_GetModule(qualname);
    if (unlikely(!imported_module)) {
        *module = NULL;
        if (PyErr_Occurred()) {
            return -1;
        }
        return 0;
    }
    *module = imported_module;
    return 1;
}
static int __Pyx__Import_Lookup(PyObject *qualname, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject **module) {
    PyObject *imported_module;
    PyObject *top_level_package_name;
    Py_ssize_t i;
    int status, module_found;
    Py_ssize_t dot_index;
    module_found = __Pyx__Import_GetModule(qualname, &imported_module);
    if (unlikely(!module_found || module_found == -1)) {
        *module = NULL;
        return module_found;
    }
    if (imported_names) {
        for (i = 0; i < len_imported_names; i++) {
            PyObject *imported_name = imported_names[i];
#if __PYX_LIMITED_VERSION_HEX < 0x030d0000
            int has_imported_attribute = PyObject_HasAttr(imported_module, imported_name);
#else
            int has_imported_attribute = PyObject_HasAttrWithError(imported_module, imported_name);
            if (unlikely(has_imported_attribute == -1)) goto error;
#endif
            if (!has_imported_attribute) {
                goto not_found;
            }
        }
        *module = imported_module;
        return 1;
    }
    dot_index = PyUnicode_FindChar(qualname, '.', 0, PY_SSIZE_T_MAX, 1);
    if (dot_index == -1) {
        *module = imported_module;
        return 1;
    }
    if (unlikely(dot_index == -2)) goto error;
    top_level_package_name = PyUnicode_Substring(qualname, 0, dot_index);
    if (unlikely(!top_level_package_name)) goto error;
    Py_DECREF(imported_module);
    status = __Pyx__Import_GetModule(top_level_package_name, module);
    Py_DECREF(top_level_package_name);
    return status;
error:
    Py_DECREF(imported_module);
    *module = NULL;
    return -1;
not_found:
    Py_DECREF(imported_module);
    *module = NULL;
    return 0;
}
static PyObject *__Pyx__Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, PyObject *moddict, int level) {
    PyObject *module = 0;
    PyObject *empty_dict = 0;
    PyObject *from_list = 0;
    int module_found;
    if (!qualname) {
        qualname = name;
    }
    module_found = __Pyx__Import_Lookup(qualname, imported_names, len_imported_names, &module);
    if (likely(module_found == 1)) {
        return module;
    } else if (unlikely(module_found == -1)) {
        return NULL;
    }
    empty_dict = PyDict_New();
    if (unlikely(!empty_dict))
        goto bad;
    if (imported_names) {
#if CYTHON_COMPILING_IN_CPYTHON
        from_list = __Pyx_PyList_FromArray(imported_names, len_imported_names);
        if (unlikely(!from_list))
            goto bad;
#else
        from_list = PyList_New(len_imported_names);
        if (unlikely(!from_list)) goto bad;
        for (Py_ssize_t i=0; i<len_imported_names; ++i) {
            if (PyList_SetItem(from_list, i, __Pyx_NewRef(imported_names[i])) < 0) goto bad;
        }
#endif
    }
    if (level == -1) {
        const char* package_sep = strchr(__Pyx_MODULE_NAME, '.');
        if (package_sep != (0)) {
            module = PyImport_ImportModuleLevelObject(
                name, moddict, empty_dict, from_list, 1);
            if (unlikely(!module)) {
                if (unlikely(!PyErr_ExceptionMatches(PyExc_ImportError)))
                    goto bad;
                PyErr_Clear();
            }
        }
        level = 0;
    }
    if (!module) {
        module = PyImport_ImportModuleLevelObject(
            name, moddict, empty_dict, from_list, level);
    }
bad:
    Py_XDECREF(from_list);
    Py_XDECREF(empty_dict);
    return module;
}

/* Import */
static PyObject *__Pyx_Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, int level) {
    return __Pyx__Import(name, imported_names, len_imported_names, qualname, __pyx_mstate_global->__pyx_d, level);
}

/* FastTypeChecks */
#if CYTHON_COMPILING_IN_CPYTHON
static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
    while (a) {
        a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*);
        if (a == b)
            return 1;
    }
    return b == &PyBaseObject_Type;
}
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
    PyObject *mro;
    if (a == b) return 1;
    mro = a->tp_mro;
    if (likely(mro)) {
        Py_ssize_t i, n;
        n = PyTuple_GET_SIZE(mro);
        for (i = 0; i < n; i++) {
            if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
                return 1;
        }
        return 0;
    }
    return __Pyx_InBases(a, b);
}
static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) {
    PyObject *mro;
    if (cls == a || cls == b) return 1;
    mro = cls->tp_mro;
    if (likely(mro)) {
        Py_ssize_t i, n;
        n = PyTuple_GET_SIZE(mro);
        for (i = 0; i < n; i++) {
            PyObject *base = PyTuple_GET_ITEM(mro, i);
            if (base == (PyObject *)a || base == (PyObject *)b)
                return 1;
        }
        return 0;
    }
    return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b);
}
static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
    if (exc_type1) {
        return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2);
    } else {
        return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
    }
}
static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
    Py_ssize_t i, n;
    assert(PyExceptionClass_Check(exc_type));
    n = PyTuple_GET_SIZE(tuple);
    for (i=0; i<n; i++) {
        if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
    }
    for (i=0; i<n; i++) {
        PyObject *t = PyTuple_GET_ITEM(tuple, i);
        if (likely(PyExceptionClass_Check(t))) {
            if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
        } else {
        }
    }
    return 0;
}
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
    if (likely(err == exc_type)) return 1;
    if (likely(PyExceptionClass_Check(err))) {
        if (likely(PyExceptionClass_Check(exc_type))) {
            return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
        } else if (likely(PyTuple_Check(exc_type))) {
            return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
        } else {
        }
    }
    return PyErr_GivenExceptionMatches(err, exc_type);
}
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
    assert(PyExceptionClass_Check(exc_type1));
    assert(PyExceptionClass_Check(exc_type2));
    if (likely(err == exc_type1 || err == exc_type2)) return 1;
    if (likely(PyExceptionClass_Check(err))) {
        return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
    }
    return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
}
#endif

/* PySequenceMultiply */
#if CYTHON_USE_TYPE_SLOTS
static PyObject* __Pyx_PySequence_Multiply_Generic(PyObject *seq, Py_ssize_t mul) {
    PyObject *result, *pymul = PyLong_FromSsize_t(mul);
    if (unlikely(!pymul))
        return NULL;
    result = PyNumber_Multiply(seq, pymul);
    Py_DECREF(pymul);
    return result;
}
static CYTHON_INLINE PyObject* __Pyx_PySequence_Multiply(PyObject *seq, Py_ssize_t mul) {
    PyTypeObject *type = Py_TYPE(seq);
    if (likely(type->tp_as_sequence && type->tp_as_sequence->sq_repeat)) {
        return type->tp_as_sequence->sq_repeat(seq, mul);
    } else {
        return __Pyx_PySequence_Multiply_Generic(seq, mul);
    }
}
#endif

/* PyObjectFormatAndDecref */
static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatSimpleAndDecref(PyObject* s, PyObject* f) {
    if (unlikely(!s)) return NULL;
    if (likely(PyUnicode_CheckExact(s))) return s;
    return __Pyx_PyObject_FormatAndDecref(s, f);
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatAndDecref(PyObject* s, PyObject* f) {
    PyObject *result;
    if (unlikely(!s)) return NULL;
    result = PyObject_Format(s, f);
    Py_DECREF(s);
    return result;
}

/* PyObjectFormat */
#if CYTHON_USE_UNICODE_WRITER
static PyObject* __Pyx_PyObject_Format(PyObject* obj, PyObject* format_spec) {
    int ret;
    _PyUnicodeWriter writer;
    if (likely(PyFloat_CheckExact(obj))) {
        _PyUnicodeWriter_Init(&writer);
        ret = _PyFloat_FormatAdvancedWriter(
            &writer,
            obj,
            format_spec, 0, PyUnicode_GET_LENGTH(format_spec));
    } else if (likely(PyLong_CheckExact(obj))) {
        _PyUnicodeWriter_Init(&writer);
        ret = _PyLong_FormatAdvancedWriter(
            &writer,
            obj,
            format_spec, 0, PyUnicode_GET_LENGTH(format_spec));
    } else {
        return PyObject_Format(obj, format_spec);
    }
    if (unlikely(ret == -1)) {
        _PyUnicodeWriter_Dealloc(&writer);
        return NULL;
    }
    return _PyUnicodeWriter_Finish(&writer);
}
#endif

/* SetItemInt */
static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) {
    int r;
    if (unlikely(!j)) return -1;
    r = PyObject_SetItem(o, j, v);
    Py_DECREF(j);
    return r;
}
static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list,
                                               int wraparound, int boundscheck, int unsafe_shared) {
    CYTHON_MAYBE_UNUSED_VAR(unsafe_shared);
#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE && !CYTHON_AVOID_BORROWED_REFS
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o));
        if ((CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS && !__Pyx_IS_UNIQUELY_REFERENCED(o, unsafe_shared))) {
            Py_INCREF(v);
            return PyList_SetItem(o, n, v);
        } else if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) {
            PyObject* old;
            Py_INCREF(v);
            old = PyList_GET_ITEM(o, n);
            PyList_SET_ITEM(o, n, v);
            Py_DECREF(old);
            return 0;
        }
    } else
#endif
#if CYTHON_USE_TYPE_SLOTS && !CYTHON_COMPILING_IN_PYPY
    {
        PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping;
        PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence;
        if (!is_list && mm && mm->mp_ass_subscript) {
            int r;
            PyObject *key = PyLong_FromSsize_t(i);
            if (unlikely(!key)) return -1;
            r = mm->mp_ass_subscript(o, key, v);
            Py_DECREF(key);
            return r;
        }
        if (is_list || likely(sm && sm->sq_ass_item)) {
            if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) {
                Py_ssize_t l = sm->sq_length(o);
                if (likely(l >= 0)) {
                    i += l;
                } else {
                    if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                        return -1;
                    PyErr_Clear();
                }
            }
            return sm->sq_ass_item(o, i, v);
        }
    }
#else
    if (is_list || !PyMapping_Check(o)) {
        return PySequence_SetItem(o, i, v);
    }
#endif
    (void)wraparound;
    (void)boundscheck;
    return __Pyx_SetItemInt_Generic(o, PyLong_FromSsize_t(i), v);
}

/* RaiseUnboundLocalError */
static void __Pyx_RaiseUnboundLocalError(const char *varname) {
    PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
}

/* DivInt[long] */
static CYTHON_INLINE long __Pyx_div_long(long a, long b, int b_is_constant) {
    long q = a / b;
    long r = a - q*b;
    long adapt_python = (b_is_constant ?
        ((r != 0) & ((r < 0) ^ (b < 0))) :
        ((r != 0) & ((r ^ b) < 0))
    );
    return q - adapt_python;
}

/* IterFinish (used by dict_iter) */
static CYTHON_INLINE int __Pyx_IterFinish(void) {
    PyObject* exc_type;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    exc_type = __Pyx_PyErr_CurrentExceptionType();
    if (unlikely(exc_type)) {
        if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))
            return -1;
        __Pyx_PyErr_Clear();
        return 0;
    }
    return 0;
}

/* PyObjectCallNoArg (used by PyObjectCallMethod0) */
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
    PyObject *arg[2] = {NULL, NULL};
    return __Pyx_PyObject_FastCall(func, arg + 1, 0 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
}

/* PyObjectGetMethod (used by PyObjectCallMethod0) */
#if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000)))
static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) {
    PyObject *attr;
#if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP
    __Pyx_TypeName type_name;
    PyTypeObject *tp = Py_TYPE(obj);
    PyObject *descr;
    descrgetfunc f = NULL;
    PyObject **dictptr, *dict;
    int meth_found = 0;
    assert (*method == NULL);
    if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) {
        attr = __Pyx_PyObject_GetAttrStr(obj, name);
        goto try_unpack;
    }
    if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) {
        return 0;
    }
    descr = _PyType_Lookup(tp, name);
    if (likely(descr != NULL)) {
        Py_INCREF(descr);
#if defined(Py_TPFLAGS_METHOD_DESCRIPTOR) && Py_TPFLAGS_METHOD_DESCRIPTOR
        if (__Pyx_PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_METHOD_DESCRIPTOR))
#else
        #ifdef __Pyx_CyFunction_USED
        if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr)))
        #else
        if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type)))
        #endif
#endif
        {
            meth_found = 1;
        } else {
            f = Py_TYPE(descr)->tp_descr_get;
            if (f != NULL && PyDescr_IsData(descr)) {
                attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
                Py_DECREF(descr);
                goto try_unpack;
            }
        }
    }
    dictptr = _PyObject_GetDictPtr(obj);
    if (dictptr != NULL && (dict = *dictptr) != NULL) {
        Py_INCREF(dict);
        attr = __Pyx_PyDict_GetItemStr(dict, name);
        if (attr != NULL) {
            Py_INCREF(attr);
            Py_DECREF(dict);
            Py_XDECREF(descr);
            goto try_unpack;
        }
        Py_DECREF(dict);
    }
    if (meth_found) {
        *method = descr;
        return 1;
    }
    if (f != NULL) {
        attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
        Py_DECREF(descr);
        goto try_unpack;
    }
    if (likely(descr != NULL)) {
        *method = descr;
        return 0;
    }
    type_name = __Pyx_PyType_GetFullyQualifiedName(tp);
    PyErr_Format(PyExc_AttributeError,
                 "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'",
                 type_name, name);
    __Pyx_DECREF_TypeName(type_name);
    return 0;
#else
    attr = __Pyx_PyObject_GetAttrStr(obj, name);
    goto try_unpack;
#endif
try_unpack:
#if CYTHON_UNPACK_METHODS
    if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) {
        PyObject *function = PyMethod_GET_FUNCTION(attr);
        Py_INCREF(function);
        Py_DECREF(attr);
        *method = function;
        return 1;
    }
#endif
    *method = attr;
    return 0;
}
#endif

/* PyObjectCallMethod0 (used by dict_iter) */
static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) {
#if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))
    PyObject *args[1] = {obj};
    (void) __Pyx_PyObject_CallOneArg;
    (void) __Pyx_PyObject_CallNoArg;
    return PyObject_VectorcallMethod(method_name, args, 1 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
#else
    PyObject *method = NULL, *result = NULL;
    int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
    if (likely(is_method)) {
        result = __Pyx_PyObject_CallOneArg(method, obj);
        Py_DECREF(method);
        return result;
    }
    if (unlikely(!method)) goto bad;
    result = __Pyx_PyObject_CallNoArg(method);
    Py_DECREF(method);
bad:
    return result;
#endif
}

/* UnpackItemEndCheck (used by UnpackTuple2) */
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
    if (unlikely(retval)) {
        Py_DECREF(retval);
        __Pyx_RaiseTooManyValuesError(expected);
        return -1;
    }
    return __Pyx_IterFinish();
}

/* UnpackTupleError (used by UnpackTuple2) */
static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) {
    if (t == Py_None) {
      __Pyx_RaiseNoneNotIterableError();
    } else {
      Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(t);
 #if !CYTHON_ASSUME_SAFE_SIZE
      if (unlikely(size < 0)) return;
 #endif
      if (size < index) {
        __Pyx_RaiseNeedMoreValuesError(size);
      } else {
        __Pyx_RaiseTooManyValuesError(index);
      }
    }
}

/* UnpackTuple2 (used by dict_iter) */
static CYTHON_INLINE int __Pyx_unpack_tuple2(
        PyObject* tuple, PyObject** value1, PyObject** value2, int is_tuple, int has_known_size, int decref_tuple) {
    if (likely(is_tuple || PyTuple_Check(tuple))) {
        Py_ssize_t size;
        if (has_known_size) {
            return __Pyx_unpack_tuple2_exact(tuple, value1, value2, decref_tuple);
        }
        size = __Pyx_PyTuple_GET_SIZE(tuple);
        if (likely(size == 2)) {
            return __Pyx_unpack_tuple2_exact(tuple, value1, value2, decref_tuple);
        }
        if (size >= 0) {
            __Pyx_UnpackTupleError(tuple, 2);
        }
        return -1;
    } else {
        return __Pyx_unpack_tuple2_generic(tuple, value1, value2, has_known_size, decref_tuple);
    }
}
static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
        PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2, int decref_tuple) {
    PyObject *value1 = NULL, *value2 = NULL;
#if CYTHON_AVOID_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS
    value1 = __Pyx_PySequence_ITEM(tuple, 0);  if (unlikely(!value1)) goto bad;
    value2 = __Pyx_PySequence_ITEM(tuple, 1);  if (unlikely(!value2)) goto bad;
#else
    value1 = PyTuple_GET_ITEM(tuple, 0);  Py_INCREF(value1);
    value2 = PyTuple_GET_ITEM(tuple, 1);  Py_INCREF(value2);
#endif
    if (decref_tuple) {
        Py_DECREF(tuple);
    }
    *pvalue1 = value1;
    *pvalue2 = value2;
    return 0;
#if CYTHON_AVOID_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS
bad:
    Py_XDECREF(value1);
    Py_XDECREF(value2);
    if (decref_tuple) { Py_XDECREF(tuple); }
    return -1;
#endif
}
static int __Pyx_unpack_tuple2_generic(PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2,
                                       int has_known_size, int decref_tuple) {
    Py_ssize_t index;
    PyObject *value1 = NULL, *value2 = NULL, *iter = NULL;
    iternextfunc iternext;
    iter = PyObject_GetIter(tuple);
    if (unlikely(!iter)) goto bad;
    if (decref_tuple) { Py_DECREF(tuple); tuple = NULL; }
    iternext = __Pyx_PyObject_GetIterNextFunc(iter);
    value1 = iternext(iter); if (unlikely(!value1)) { index = 0; goto unpacking_failed; }
    value2 = iternext(iter); if (unlikely(!value2)) { index = 1; goto unpacking_failed; }
    if (!has_known_size && unlikely(__Pyx_IternextUnpackEndCheck(iternext(iter), 2))) goto bad;
    Py_DECREF(iter);
    *pvalue1 = value1;
    *pvalue2 = value2;
    return 0;
unpacking_failed:
    if (!has_known_size && __Pyx_IterFinish() == 0)
        __Pyx_RaiseNeedMoreValuesError(index);
bad:
    Py_XDECREF(iter);
    Py_XDECREF(value1);
    Py_XDECREF(value2);
    if (decref_tuple) { Py_XDECREF(tuple); }
    return -1;
}

/* dict_iter */
#if CYTHON_COMPILING_IN_PYPY
#include <string.h>
#endif
static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* iterable, int is_dict, PyObject* method_name,
                                                   Py_ssize_t* p_orig_length, int* p_source_is_dict) {
    is_dict = is_dict || likely(PyDict_CheckExact(iterable));
    *p_source_is_dict = is_dict;
    if (is_dict) {
#if !CYTHON_COMPILING_IN_PYPY
        *p_orig_length = PyDict_Size(iterable);
        Py_INCREF(iterable);
        return iterable;
#else
        static PyObject *py_items = NULL, *py_keys = NULL, *py_values = NULL;
        PyObject **pp = NULL;
        if (method_name) {
            const char *name = PyUnicode_AsUTF8(method_name);
            if (strcmp(name, "iteritems") == 0) pp = &py_items;
            else if (strcmp(name, "iterkeys") == 0) pp = &py_keys;
            else if (strcmp(name, "itervalues") == 0) pp = &py_values;
            if (pp) {
                if (!*pp) {
                    *pp = PyUnicode_FromString(name + 4);
                    if (!*pp)
                        return NULL;
                }
                method_name = *pp;
            }
        }
#endif
    }
    *p_orig_length = 0;
    if (method_name) {
        PyObject* iter;
        iterable = __Pyx_PyObject_CallMethod0(iterable, method_name);
        if (!iterable)
            return NULL;
#if !CYTHON_COMPILING_IN_PYPY
        if (PyTuple_CheckExact(iterable) || PyList_CheckExact(iterable))
            return iterable;
#endif
        iter = PyObject_GetIter(iterable);
        Py_DECREF(iterable);
        return iter;
    }
    return PyObject_GetIter(iterable);
}
#if !CYTHON_AVOID_BORROWED_REFS
static CYTHON_INLINE int __Pyx_dict_iter_next_source_is_dict(
        PyObject* iter_obj, CYTHON_NCP_UNUSED Py_ssize_t orig_length, CYTHON_NCP_UNUSED Py_ssize_t* ppos,
        PyObject** pkey, PyObject** pvalue, PyObject** pitem) {
    PyObject *key, *value;
    if (unlikely(orig_length != PyDict_Size(iter_obj))) {
        PyErr_SetString(PyExc_RuntimeError, "dictionary changed size during iteration");
        return -1;
    }
    if (unlikely(!PyDict_Next(iter_obj, ppos, &key, &value))) {
        return 0;
    }
    if (pitem) {
        PyObject* tuple = PyTuple_New(2);
        if (unlikely(!tuple)) {
            return -1;
        }
        Py_INCREF(key);
        Py_INCREF(value);
        #if CYTHON_ASSUME_SAFE_MACROS
        PyTuple_SET_ITEM(tuple, 0, key);
        PyTuple_SET_ITEM(tuple, 1, value);
        #else
        if (unlikely(PyTuple_SetItem(tuple, 0, key) < 0)) {
            Py_DECREF(value);
            Py_DECREF(tuple);
            return -1;
        }
        if (unlikely(PyTuple_SetItem(tuple, 1, value) < 0)) {
            Py_DECREF(tuple);
            return -1;
        }
        #endif
        *pitem = tuple;
    } else {
        if (pkey) {
            Py_INCREF(key);
            *pkey = key;
        }
        if (pvalue) {
            Py_INCREF(value);
            *pvalue = value;
        }
    }
    return 1;
}
#endif
static CYTHON_INLINE int __Pyx_dict_iter_next(
        PyObject* iter_obj, CYTHON_NCP_UNUSED Py_ssize_t orig_length, CYTHON_NCP_UNUSED Py_ssize_t* ppos,
        PyObject** pkey, PyObject** pvalue, PyObject** pitem, int source_is_dict) {
    PyObject* next_item;
#if !CYTHON_AVOID_BORROWED_REFS
    if (source_is_dict) {
        int result;
#if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
        Py_BEGIN_CRITICAL_SECTION(iter_obj);
#endif
        result = __Pyx_dict_iter_next_source_is_dict(iter_obj, orig_length, ppos, pkey, pvalue, pitem);
#if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
        Py_END_CRITICAL_SECTION();
#endif
        return result;
    } else if (PyTuple_CheckExact(iter_obj)) {
        Py_ssize_t pos = *ppos;
        Py_ssize_t tuple_size = __Pyx_PyTuple_GET_SIZE(iter_obj);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely(tuple_size < 0)) return -1;
        #endif
        if (unlikely(pos >= tuple_size)) return 0;
        *ppos = pos + 1;
        #if CYTHON_ASSUME_SAFE_MACROS
        next_item = PyTuple_GET_ITEM(iter_obj, pos);
        #else
        next_item = PyTuple_GetItem(iter_obj, pos);
        if (unlikely(!next_item)) return -1;
        #endif
        Py_INCREF(next_item);
    } else if (PyList_CheckExact(iter_obj)) {
        Py_ssize_t pos = *ppos;
        Py_ssize_t list_size = __Pyx_PyList_GET_SIZE(iter_obj);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely(list_size < 0)) return -1;
        #endif
        if (unlikely(pos >= list_size)) return 0;
        *ppos = pos + 1;
        next_item = __Pyx_PyList_GetItemRef(iter_obj, pos);
        if (unlikely(!next_item)) return -1;
    } else
#endif
    {
        next_item = PyIter_Next(iter_obj);
        if (unlikely(!next_item)) {
            return __Pyx_IterFinish();
        }
    }
    if (pitem) {
        *pitem = next_item;
    } else if (pkey && pvalue) {
        if (__Pyx_unpack_tuple2(next_item, pkey, pvalue, source_is_dict, source_is_dict, 1))
            return -1;
    } else if (pkey) {
        *pkey = next_item;
    } else {
        *pvalue = next_item;
    }
    return 1;
}

/* decode_c_bytes (used by decode_bytes) */
static CYTHON_INLINE PyObject* __Pyx_decode_c_bytes(
         const char* cstring, Py_ssize_t length, Py_ssize_t start, Py_ssize_t stop,
         const char* encoding, const char* errors,
         PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
    if (unlikely((start < 0) | (stop < 0))) {
        if (start < 0) {
            start += length;
            if (start < 0)
                start = 0;
        }
        if (stop < 0)
            stop += length;
    }
    if (stop > length)
        stop = length;
    if (unlikely(stop <= start))
        return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_unicode);
    length = stop - start;
    cstring += start;
    if (decode_func) {
        return decode_func(cstring, length, errors);
    } else {
        return PyUnicode_Decode(cstring, length, encoding, errors);
    }
}

/* PyObjectSetAttrStr */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_setattro))
        return tp->tp_setattro(obj, attr_name, value);
    return PyObject_SetAttr(obj, attr_name, value);
}
#endif

/* SliceObject */
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj,
        Py_ssize_t cstart, Py_ssize_t cstop,
        PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
        int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
    __Pyx_TypeName obj_type_name;
#if CYTHON_USE_TYPE_SLOTS
    PyMappingMethods* mp = Py_TYPE(obj)->tp_as_mapping;
    if (likely(mp && mp->mp_subscript))
#endif
    {
        PyObject* result;
        PyObject *py_slice, *py_start, *py_stop;
        if (_py_slice) {
            py_slice = *_py_slice;
        } else {
            PyObject* owned_start = NULL;
            PyObject* owned_stop = NULL;
            if (_py_start) {
                py_start = *_py_start;
            } else {
                if (has_cstart) {
                    owned_start = py_start = PyLong_FromSsize_t(cstart);
                    if (unlikely(!py_start)) goto bad;
                } else
                    py_start = Py_None;
            }
            if (_py_stop) {
                py_stop = *_py_stop;
            } else {
                if (has_cstop) {
                    owned_stop = py_stop = PyLong_FromSsize_t(cstop);
                    if (unlikely(!py_stop)) {
                        Py_XDECREF(owned_start);
                        goto bad;
                    }
                } else
                    py_stop = Py_None;
            }
            py_slice = PySlice_New(py_start, py_stop, Py_None);
            Py_XDECREF(owned_start);
            Py_XDECREF(owned_stop);
            if (unlikely(!py_slice)) goto bad;
        }
#if CYTHON_USE_TYPE_SLOTS
        result = mp->mp_subscript(obj, py_slice);
#else
        result = PyObject_GetItem(obj, py_slice);
#endif
        if (!_py_slice) {
            Py_DECREF(py_slice);
        }
        return result;
    }
    obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj));
    PyErr_Format(PyExc_TypeError,
        "'" __Pyx_FMT_TYPENAME "' object is unsliceable", obj_type_name);
    __Pyx_DECREF_TypeName(obj_type_name);
bad:
    return NULL;
}

/* ModInt[int] */
static CYTHON_INLINE int __Pyx_mod_int(int a, int b, int b_is_constant) {
    int r = a % b;
    int adapt_python = (b_is_constant ?
        ((r != 0) & ((r < 0) ^ (b < 0))) :
        ((r != 0) & ((r ^ b) < 0))
    );
    return r + adapt_python * b;
}

/* DivInt[int] */
static CYTHON_INLINE int __Pyx_div_int(int a, int b, int b_is_constant) {
    int q = a / b;
    int r = a - q*b;
    int adapt_python = (b_is_constant ?
        ((r != 0) & ((r < 0) ^ (b < 0))) :
        ((r != 0) & ((r ^ b) < 0))
    );
    return q - adapt_python;
}

/* decode_c_string */
static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
         const char* cstring, Py_ssize_t start, Py_ssize_t stop,
         const char* encoding, const char* errors,
         PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
    Py_ssize_t length;
    if (unlikely((start < 0) | (stop < 0))) {
        size_t slen = strlen(cstring);
        if (unlikely(slen > (size_t) PY_SSIZE_T_MAX)) {
            PyErr_SetString(PyExc_OverflowError,
                            "c-string too long to convert to Python");
            return NULL;
        }
        length = (Py_ssize_t) slen;
        if (start < 0) {
            start += length;
            if (start < 0)
                start = 0;
        }
        if (stop < 0)
            stop += length;
    }
    if (unlikely(stop <= start))
        return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_unicode);
    length = stop - start;
    cstring += start;
    if (decode_func) {
        return decode_func(cstring, length, errors);
    } else {
        return PyUnicode_Decode(cstring, length, encoding, errors);
    }
}

/* SliceObject */
static CYTHON_INLINE int __Pyx_PyObject_SetSlice(PyObject* obj, PyObject* value,
        Py_ssize_t cstart, Py_ssize_t cstop,
        PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
        int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
    __Pyx_TypeName obj_type_name;
#if CYTHON_USE_TYPE_SLOTS
    PyMappingMethods* mp = Py_TYPE(obj)->tp_as_mapping;
    if (likely(mp && mp->mp_ass_subscript))
#endif
    {
        int result;
        PyObject *py_slice, *py_start, *py_stop;
        if (_py_slice) {
            py_slice = *_py_slice;
        } else {
            PyObject* owned_start = NULL;
            PyObject* owned_stop = NULL;
            if (_py_start) {
                py_start = *_py_start;
            } else {
                if (has_cstart) {
                    owned_start = py_start = PyLong_FromSsize_t(cstart);
                    if (unlikely(!py_start)) goto bad;
                } else
                    py_start = Py_None;
            }
            if (_py_stop) {
                py_stop = *_py_stop;
            } else {
                if (has_cstop) {
                    owned_stop = py_stop = PyLong_FromSsize_t(cstop);
                    if (unlikely(!py_stop)) {
                        Py_XDECREF(owned_start);
                        goto bad;
                    }
                } else
                    py_stop = Py_None;
            }
            py_slice = PySlice_New(py_start, py_stop, Py_None);
            Py_XDECREF(owned_start);
            Py_XDECREF(owned_stop);
            if (unlikely(!py_slice)) goto bad;
        }
#if CYTHON_USE_TYPE_SLOTS
        result = mp->mp_ass_subscript(obj, py_slice, value);
#else
        result = value ? PyObject_SetItem(obj, py_slice, value) : PyObject_DelItem(obj, py_slice);
#endif
        if (!_py_slice) {
            Py_DECREF(py_slice);
        }
        return result;
    }
    obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj));
    PyErr_Format(PyExc_TypeError,
        "'" __Pyx_FMT_TYPENAME "' object does not support slice %.10s",
        obj_type_name, value ? "assignment" : "deletion");
    __Pyx_DECREF_TypeName(obj_type_name);
bad:
    return -1;
}

/* WriteUnraisableException */
static void __Pyx_WriteUnraisable(const char *name, int clineno,
                                  int lineno, const char *filename,
                                  int full_traceback, int nogil) {
    PyObject *old_exc, *old_val, *old_tb;
    PyObject *ctx;
    __Pyx_PyThreadState_declare
    PyGILState_STATE state;
    if (nogil)
        state = PyGILState_Ensure();
    else state = (PyGILState_STATE)0;
    CYTHON_UNUSED_VAR(clineno);
    CYTHON_UNUSED_VAR(lineno);
    CYTHON_UNUSED_VAR(filename);
    CYTHON_MAYBE_UNUSED_VAR(nogil);
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
    if (full_traceback) {
        Py_XINCREF(old_exc);
        Py_XINCREF(old_val);
        Py_XINCREF(old_tb);
        __Pyx_ErrRestore(old_exc, old_val, old_tb);
        PyErr_PrintEx(0);
    }
    ctx = PyUnicode_FromString(name);
    __Pyx_ErrRestore(old_exc, old_val, old_tb);
    if (!ctx) {
        PyErr_WriteUnraisable(Py_None);
    } else {
        PyErr_WriteUnraisable(ctx);
        Py_DECREF(ctx);
    }
    if (nogil)
        PyGILState_Release(state);
}

/* PyLongBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_Fallback___Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, int inplace) {
    return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
}
#if CYTHON_USE_PYLONG_INTERNALS
static PyObject* __Pyx_Unpacked___Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
    CYTHON_MAYBE_UNUSED_VAR(inplace);
    CYTHON_UNUSED_VAR(zerodivision_check);
    const long b = intval;
    long a;
    const PY_LONG_LONG llb = intval;
    PY_LONG_LONG lla;
    if (unlikely(__Pyx_PyLong_IsZero(op1))) {
        return __Pyx_NewRef(op2);
    }
    const int is_positive = __Pyx_PyLong_IsPos(op1);
    const digit* digits = __Pyx_PyLong_Digits(op1);
    const Py_ssize_t size = __Pyx_PyLong_DigitCount(op1);
    if (likely(size == 1)) {
        a = (long) digits[0];
        if (!is_positive) a *= -1;
    } else {
        switch (size) {
            case 2:
                if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                    a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if (!is_positive) a *= -1;
                    goto calculate_long;
                } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                    lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                    if (!is_positive) lla *= -1;
                    goto calculate_long_long;
                }
                break;
            case 3:
                if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                    a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if (!is_positive) a *= -1;
                    goto calculate_long;
                } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                    lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                    if (!is_positive) lla *= -1;
                    goto calculate_long_long;
                }
                break;
            case 4:
                if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                    a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if (!is_positive) a *= -1;
                    goto calculate_long;
                } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                    lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                    if (!is_positive) lla *= -1;
                    goto calculate_long_long;
                }
                break;
        }
        return PyLong_Type.tp_as_number->nb_add(op1, op2);
    }
    calculate_long:
        {
            long x;
            x = a + b;
            return PyLong_FromLong(x);
        }
    calculate_long_long:
        {
            PY_LONG_LONG llx;
            llx = lla + llb;
            return PyLong_FromLongLong(llx);
        }
    
}
#endif
static PyObject* __Pyx_Float___Pyx_PyLong_AddObjC(PyObject *float_val, long intval, int zerodivision_check) {
    CYTHON_UNUSED_VAR(zerodivision_check);
    const long b = intval;
    double a = __Pyx_PyFloat_AS_DOUBLE(float_val);
        double result;
        
        result = ((double)a) + (double)b;
        return PyFloat_FromDouble(result);
}
static CYTHON_INLINE PyObject* __Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
    CYTHON_MAYBE_UNUSED_VAR(intval);
    CYTHON_UNUSED_VAR(zerodivision_check);
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        return __Pyx_Unpacked___Pyx_PyLong_AddObjC(op1, op2, intval, inplace, zerodivision_check);
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        return __Pyx_Float___Pyx_PyLong_AddObjC(op1, intval, zerodivision_check);
    }
    return __Pyx_Fallback___Pyx_PyLong_AddObjC(op1, op2, inplace);
}
#endif

/* PyLongCompare */
static CYTHON_INLINE int __Pyx_PyLong_BoolEqObjC(PyObject *op1, PyObject *op2, long intval, long inplace) {
    CYTHON_MAYBE_UNUSED_VAR(intval);
    CYTHON_UNUSED_VAR(inplace);
    if (op1 == op2) {
        return 1;
    }
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        int unequal;
        unsigned long uintval;
        Py_ssize_t size = __Pyx_PyLong_DigitCount(op1);
        const digit* digits = __Pyx_PyLong_Digits(op1);
        if (intval == 0) {
            return (__Pyx_PyLong_IsZero(op1) == 1);
        } else if (intval < 0) {
            if (__Pyx_PyLong_IsNonNeg(op1))
                return 0;
            intval = -intval;
        } else {
            if (__Pyx_PyLong_IsNeg(op1))
                return 0;
        }
        uintval = (unsigned long) intval;
#if PyLong_SHIFT * 4 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 4)) {
            unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 3 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 3)) {
            unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 2 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 2)) {
            unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 1 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 1)) {
            unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
            unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK));
        return (unequal == 0);
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = __Pyx_PyFloat_AS_DOUBLE(op1);
        return ((double)a == (double)b);
    }
    return __Pyx_PyObject_IsTrueAndDecref(
        PyObject_RichCompare(op1, op2, Py_EQ));
}

/* CIntToPyUnicode */
static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_xmlElementType(xmlElementType value, Py_ssize_t width, char padding_char) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const xmlElementType neg_one = (xmlElementType) -1, const_zero = (xmlElementType) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (unlikely(!(is_unsigned || value == 0 || value > 0) ||
                    !(sizeof(value) <= 2 || value & ~ (xmlElementType) 0x01fffff || __Pyx_CheckUnicodeValue((int) value)))) {
        PyErr_SetString(PyExc_OverflowError, "%c arg not in range(0x110000)");
        return NULL;
    }
    if (width <= 1) {
        return PyUnicode_FromOrdinal((int) value);
    }
    return __Pyx_PyUnicode_FromOrdinal_Padded((int) value, width, padding_char);
}
static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_xmlElementType(xmlElementType value, Py_ssize_t width, char padding_char, char format_char) {
    char digits[sizeof(xmlElementType)*3+2];
    char *dpos, *end = digits + sizeof(xmlElementType)*3+2;
    const char *hex_digits = DIGITS_HEX;
    Py_ssize_t length, ulength;
    int prepend_sign, last_one_off;
    xmlElementType remaining;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const xmlElementType neg_one = (xmlElementType) -1, const_zero = (xmlElementType) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (format_char == 'X') {
        hex_digits += 16;
        format_char = 'x';
    }
    remaining = value;
    last_one_off = 0;
    dpos = end;
    do {
        int digit_pos;
        switch (format_char) {
        case 'o':
            digit_pos = abs((int)(remaining % (8*8)));
            remaining = (xmlElementType) (remaining / (8*8));
            dpos -= 2;
            memcpy(dpos, DIGIT_PAIRS_8 + digit_pos * 2, 2);
            last_one_off = (digit_pos < 8);
            break;
        case 'd':
            digit_pos = abs((int)(remaining % (10*10)));
            remaining = (xmlElementType) (remaining / (10*10));
            dpos -= 2;
            memcpy(dpos, DIGIT_PAIRS_10 + digit_pos * 2, 2);
            last_one_off = (digit_pos < 10);
            break;
        case 'x':
            *(--dpos) = hex_digits[abs((int)(remaining % 16))];
            remaining = (xmlElementType) (remaining / 16);
            break;
        default:
            assert(0);
            break;
        }
    } while (unlikely(remaining != 0));
    assert(!last_one_off || *dpos == '0');
    dpos += last_one_off;
    length = end - dpos;
    ulength = length;
    prepend_sign = 0;
    if (!is_unsigned && value <= neg_one) {
        if (padding_char == ' ' || width <= length + 1) {
            *(--dpos) = '-';
            ++length;
        } else {
            prepend_sign = 1;
        }
        ++ulength;
    }
    if (width > ulength) {
        ulength = width;
    }
    if (ulength == 1) {
        return PyUnicode_FromOrdinal(*dpos);
    }
    return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char);
}

/* pyfrozenset_new (used by PySetContains) */
static CYTHON_INLINE PyObject* __Pyx_PyFrozenSet_New(PyObject* it) {
    if (it) {
        PyObject* result;
#if CYTHON_COMPILING_IN_PYPY
        PyObject* args;
        args = PyTuple_Pack(1, it);
        if (unlikely(!args))
            return NULL;
        result = PyObject_Call((PyObject*)&PyFrozenSet_Type, args, NULL);
        Py_DECREF(args);
        return result;
#else
        if (PyFrozenSet_CheckExact(it)) {
            Py_INCREF(it);
            return it;
        }
        result = PyFrozenSet_New(it);
        if (unlikely(!result))
            return NULL;
        if ((__PYX_LIMITED_VERSION_HEX >= 0x030A0000)
#if CYTHON_COMPILING_IN_LIMITED_API
            || __Pyx_get_runtime_version() >= 0x030A0000
#endif
            )
            return result;
        {
            Py_ssize_t size = __Pyx_PySet_GET_SIZE(result);
            if (likely(size > 0))
                return result;
#if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely(size < 0)) {
                Py_DECREF(result);
                return NULL;
            }
#endif
        }
        Py_DECREF(result);
#endif
    }
    return __Pyx_PyObject_CallNoArg((PyObject*) &PyFrozenSet_Type);
}

/* PySetContains */
static int __Pyx_PySet_ContainsUnhashable(PyObject *set, PyObject *key) {
    int result = -1;
    if (PySet_Check(key) && PyErr_ExceptionMatches(PyExc_TypeError)) {
        PyObject *tmpkey;
        PyErr_Clear();
        tmpkey = __Pyx_PyFrozenSet_New(key);
        if (tmpkey != NULL) {
            result = PySet_Contains(set, tmpkey);
            Py_DECREF(tmpkey);
        }
    }
    return result;
}
static CYTHON_INLINE int __Pyx_PySet_ContainsTF(PyObject* key, PyObject* set, int eq) {
    int result = PySet_Contains(set, key);
    if (unlikely(result < 0)) {
        result = __Pyx_PySet_ContainsUnhashable(set, key);
    }
    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
}

/* PyUnicode_Unicode */
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Unicode(PyObject *obj) {
    if (unlikely(obj == Py_None))
        obj = __pyx_mstate_global->__pyx_kp_u_None;
    return __Pyx_NewRef(obj);
}

/* CIntToPyUnicode */
static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_long(long value, Py_ssize_t width, char padding_char) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const long neg_one = (long) -1, const_zero = (long) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (unlikely(!(is_unsigned || value == 0 || value > 0) ||
                    !(sizeof(value) <= 2 || value & ~ (long) 0x01fffff || __Pyx_CheckUnicodeValue((int) value)))) {
        PyErr_SetString(PyExc_OverflowError, "%c arg not in range(0x110000)");
        return NULL;
    }
    if (width <= 1) {
        return PyUnicode_FromOrdinal((int) value);
    }
    return __Pyx_PyUnicode_FromOrdinal_Padded((int) value, width, padding_char);
}
static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_long(long value, Py_ssize_t width, char padding_char, char format_char) {
    char digits[sizeof(long)*3+2];
    char *dpos, *end = digits + sizeof(long)*3+2;
    const char *hex_digits = DIGITS_HEX;
    Py_ssize_t length, ulength;
    int prepend_sign, last_one_off;
    long remaining;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const long neg_one = (long) -1, const_zero = (long) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (format_char == 'X') {
        hex_digits += 16;
        format_char = 'x';
    }
    remaining = value;
    last_one_off = 0;
    dpos = end;
    do {
        int digit_pos;
        switch (format_char) {
        case 'o':
            digit_pos = abs((int)(remaining % (8*8)));
            remaining = (long) (remaining / (8*8));
            dpos -= 2;
            memcpy(dpos, DIGIT_PAIRS_8 + digit_pos * 2, 2);
            last_one_off = (digit_pos < 8);
            break;
        case 'd':
            digit_pos = abs((int)(remaining % (10*10)));
            remaining = (long) (remaining / (10*10));
            dpos -= 2;
            memcpy(dpos, DIGIT_PAIRS_10 + digit_pos * 2, 2);
            last_one_off = (digit_pos < 10);
            break;
        case 'x':
            *(--dpos) = hex_digits[abs((int)(remaining % 16))];
            remaining = (long) (remaining / 16);
            break;
        default:
            assert(0);
            break;
        }
    } while (unlikely(remaining != 0));
    assert(!last_one_off || *dpos == '0');
    dpos += last_one_off;
    length = end - dpos;
    ulength = length;
    prepend_sign = 0;
    if (!is_unsigned && value <= neg_one) {
        if (padding_char == ' ' || width <= length + 1) {
            *(--dpos) = '-';
            ++length;
        } else {
            prepend_sign = 1;
        }
        ++ulength;
    }
    if (width > ulength) {
        ulength = width;
    }
    if (ulength == 1) {
        return PyUnicode_FromOrdinal(*dpos);
    }
    return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char);
}

/* pop */
static CYTHON_INLINE PyObject* __Pyx__PyObject_Pop(PyObject* L) {
    if (__Pyx_IS_TYPE(L, &PySet_Type)) {
        return PySet_Pop(L);
    }
    return __Pyx_PyObject_CallMethod0(L, __pyx_mstate_global->__pyx_n_u_pop);
}
#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE
static CYTHON_INLINE PyObject* __Pyx_PyList_Pop(PyObject* L) {
    if (likely(PyList_GET_SIZE(L) > (((PyListObject*)L)->allocated >> 1))) {
        __Pyx_SET_SIZE(L, Py_SIZE(L) - 1);
        return PyList_GET_ITEM(L, PyList_GET_SIZE(L));
    }
    return __Pyx_CallUnboundCMethod0(&__pyx_mstate_global->__pyx_umethod_PyList_Type_pop, L);
}
#endif

/* SliceTupleAndList */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE void __Pyx_crop_slice(Py_ssize_t* _start, Py_ssize_t* _stop, Py_ssize_t* _length) {
    Py_ssize_t start = *_start, stop = *_stop, length = *_length;
    if (start < 0) {
        start += length;
        if (start < 0)
            start = 0;
    }
    if (stop < 0)
        stop += length;
    else if (stop > length)
        stop = length;
    *_length = stop - start;
    *_start = start;
    *_stop = stop;
}
static CYTHON_INLINE PyObject* __Pyx_PyTuple_GetSlice(
            PyObject* src, Py_ssize_t start, Py_ssize_t stop) {
    Py_ssize_t length = PyTuple_GET_SIZE(src);
    __Pyx_crop_slice(&start, &stop, &length);
    return __Pyx_PyTuple_FromArray(((PyTupleObject*)src)->ob_item + start, length);
}
static CYTHON_INLINE PyObject* __Pyx_PyList_GetSlice_locked(
            PyObject* src, Py_ssize_t start, Py_ssize_t stop) {
    Py_ssize_t length = PyList_GET_SIZE(src);
    __Pyx_crop_slice(&start, &stop, &length);
    if (length <= 0) {
        return PyList_New(0);
    }
    return __Pyx_PyList_FromArray(((PyListObject*)src)->ob_item + start, length);
}
static CYTHON_INLINE PyObject* __Pyx_PyList_GetSlice(
            PyObject* src, Py_ssize_t start, Py_ssize_t stop) {
    PyObject *result;
    __Pyx_BEGIN_CRITICAL_SECTION(src);
    result = __Pyx_PyList_GetSlice_locked(src, start, stop);
    __Pyx_END_CRITICAL_SECTION();
    return result;
}
#endif // CYTHON_COMPILING_IN_CPYTHON

/* pybuiltin_invalid (used by pyint_simplify) */
static void __Pyx_PyBuiltin_Invalid(PyObject *obj, const char *type_name, const char *argname) {
    __Pyx_TypeName obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj));
    if (argname) {
        PyErr_Format(PyExc_TypeError,
            "Argument '%.200s' has incorrect type (expected %.200s, got " __Pyx_FMT_TYPENAME ")",
            argname, type_name, obj_type_name
        );
    } else {
        PyErr_Format(PyExc_TypeError,
            "Expected %.200s, got " __Pyx_FMT_TYPENAME,
            type_name, obj_type_name
        );
    }
    __Pyx_DECREF_TypeName(obj_type_name);
}

/* pyint_simplify */
static CYTHON_INLINE int __Pyx_PyInt_FromNumber(PyObject **number_var, const char *argname, int accept_none) {
    PyObject *number = *number_var;
    if (likely((accept_none && number == Py_None) || PyLong_CheckExact(number))) {
        return 0;
    }
    PyObject *int_object;
    if (likely(PyNumber_Check(number))) {
        int_object = PyNumber_Long(number);
        if (unlikely(!int_object)) goto bad;
    } else {
        __Pyx_PyBuiltin_Invalid(number, "int", argname);
        goto bad;
    }
    *number_var = int_object;
    Py_DECREF(number);
    return 0;
bad:
    *number_var = NULL;
    Py_DECREF(number);
    return -1;
}

/* PyObjectVectorCallKwBuilder */
#if CYTHON_VECTORCALL
static int __Pyx_VectorcallBuilder_AddArg(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n) {
    (void)__Pyx_PyObject_FastCallDict;
    if (__Pyx_PyTuple_SET_ITEM(builder, n, key) != (0)) return -1;
    Py_INCREF(key);
    args[n] = value;
    return 0;
}
CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n) {
    (void)__Pyx_VectorcallBuilder_AddArgStr;
    if (unlikely(!PyUnicode_Check(key))) {
        PyErr_SetString(PyExc_TypeError, "keywords must be strings");
        return -1;
    }
    return __Pyx_VectorcallBuilder_AddArg(key, value, builder, args, n);
}
static int __Pyx_VectorcallBuilder_AddArgStr(const char *key, PyObject *value, PyObject *builder, PyObject **args, int n) {
    PyObject *pyKey = PyUnicode_FromString(key);
    if (!pyKey) return -1;
    return __Pyx_VectorcallBuilder_AddArg(pyKey, value, builder, args, n);
}
#else // CYTHON_VECTORCALL
CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, CYTHON_UNUSED PyObject **args, CYTHON_UNUSED int n) {
    if (unlikely(!PyUnicode_Check(key))) {
        PyErr_SetString(PyExc_TypeError, "keywords must be strings");
        return -1;
    }
    return PyDict_SetItem(builder, key, value);
}
#endif

/* PyObjectVectorCallMethodKwBuilder */
#if !CYTHON_VECTORCALL || PY_VERSION_HEX < 0x03090000
static PyObject *__Pyx_Object_VectorcallMethod_CallFromBuilder(PyObject *name, PyObject *const *args, size_t nargsf, PyObject *kwnames) {
    PyObject *result;
    PyObject *obj = PyObject_GetAttr(args[0], name);
    if (unlikely(!obj))
        return NULL;
    result = __Pyx_Object_Vectorcall_CallFromBuilder(obj, args+1, nargsf-1, kwnames);
    Py_DECREF(obj);
    return result;
}
#endif

/* ImportFrom */
static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
    PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
    if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
        const char* module_name_str = 0;
        PyObject* module_name = 0;
        PyObject* module_dot = 0;
        PyObject* full_name = 0;
        PyErr_Clear();
        module_name_str = PyModule_GetName(module);
        if (unlikely(!module_name_str)) { goto modbad; }
        module_name = PyUnicode_FromString(module_name_str);
        if (unlikely(!module_name)) { goto modbad; }
        module_dot = PyUnicode_Concat(module_name, __pyx_mstate_global->__pyx_kp_u__2);
        if (unlikely(!module_dot)) { goto modbad; }
        full_name = PyUnicode_Concat(module_dot, name);
        if (unlikely(!full_name)) { goto modbad; }
        #if (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM  < 0x07030400) ||\
                CYTHON_COMPILING_IN_GRAAL
        {
            PyObject *modules = PyImport_GetModuleDict();
            if (unlikely(!modules))
                goto modbad;
            value = PyObject_GetItem(modules, full_name);
        }
        #else
        value = PyImport_GetModule(full_name);
        #endif
      modbad:
        Py_XDECREF(full_name);
        Py_XDECREF(module_dot);
        Py_XDECREF(module_name);
    }
    if (unlikely(!value)) {
        PyErr_Format(PyExc_ImportError, "cannot import name %S", name);
    }
    return value;
}

/* tp_new */
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
static PyObject* __Pyx_tp_new_fallback(PyObject* type_obj, PyObject* args, PyObject* kwargs) {
    PyObject *new_func = NULL, *new_args = NULL, *obj;
    Py_ssize_t i, nargs = PyTuple_Size(args);
    if (unlikely(nargs < 0)) goto bad;
    new_args = PyTuple_New(nargs + 1);
    if (unlikely(!new_args)) goto bad;
    for (i = 0; i < nargs + 1; i++) {
        PyObject *item = (i == 0) ? type_obj : PyTuple_GetItem(args, i - 1);
        if (unlikely(!item)) goto bad;
        Py_INCREF(item);
        if (unlikely(PyTuple_SetItem(new_args, i, item)) < 0) goto bad;
    }
    new_func = PyObject_GetAttrString(type_obj, "__new__");
    if (unlikely(!new_func)) goto bad;
    obj = PyObject_Call(new_func, new_args, kwargs);
    Py_DECREF(new_func);
    Py_DECREF(new_args);
    return obj;
 bad:
    Py_XDECREF(new_func);
    Py_XDECREF(new_args);
    return NULL;
}
#endif
static PyObject* __Pyx_tp_new_kwargs(PyObject* type_obj, PyObject* args, PyObject* kwargs) {
    newfunc tp_new = __Pyx_PyType_TryGetSlot((PyTypeObject*)type_obj, tp_new, newfunc);
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
    if (!tp_new) return __Pyx_tp_new_fallback(type_obj, args, kwargs);
#else
    assert(tp_new != NULL);
#endif
    return tp_new((PyTypeObject*)type_obj, args, kwargs);
}

/* PyObjectLookupSpecial */
#if CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx__PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name, int with_error) {
    PyObject *res;
    PyTypeObject *tp = Py_TYPE(obj);
    res = _PyType_Lookup(tp, attr_name);
    if (likely(res)) {
        descrgetfunc f = Py_TYPE(res)->tp_descr_get;
        if (!f) {
            Py_INCREF(res);
        } else {
            res = f(res, obj, (PyObject *)tp);
        }
    } else if (with_error) {
        PyErr_SetObject(PyExc_AttributeError, attr_name);
    }
    return res;
}
#endif

/* UnicodeConcatInPlace */
# if CYTHON_COMPILING_IN_CPYTHON
static int
__Pyx_unicode_modifiable(PyObject *unicode, int unsafe_shared)
{
    if (!__Pyx_IS_UNIQUELY_REFERENCED(unicode, unsafe_shared))
        return 0;
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX > 0x030F0000
    if (PyUnstable_Unicode_GET_CACHED_HASH(unicode) != -1)
        return 0;
#endif
    if (!PyUnicode_CheckExact(unicode))
        return 0;
    if (PyUnicode_CHECK_INTERNED(unicode))
        return 0;
    return 1;
}
static CYTHON_INLINE PyObject *__Pyx_PyUnicode_ConcatInPlaceImpl(PyObject **p_left, PyObject *right, int unsafe_shared
        #if CYTHON_REFNANNY
        , void* __pyx_refnanny
        #endif
    ) {
    PyObject *left = *p_left;
    Py_ssize_t left_len, right_len, new_len;
    if (unlikely(__Pyx_PyUnicode_READY(left) == -1))
        return NULL;
    if (unlikely(__Pyx_PyUnicode_READY(right) == -1))
        return NULL;
    left_len = PyUnicode_GET_LENGTH(left);
    if (left_len == 0) {
        Py_INCREF(right);
        return right;
    }
    right_len = PyUnicode_GET_LENGTH(right);
    if (right_len == 0) {
        Py_INCREF(left);
        return left;
    }
    if (unlikely(left_len > PY_SSIZE_T_MAX - right_len)) {
        PyErr_SetString(PyExc_OverflowError,
                        "strings are too large to concat");
        return NULL;
    }
    new_len = left_len + right_len;
    if (__Pyx_unicode_modifiable(left, unsafe_shared)
            && PyUnicode_CheckExact(right)
            && PyUnicode_KIND(right) <= PyUnicode_KIND(left)
            && !(PyUnicode_IS_ASCII(left) && !PyUnicode_IS_ASCII(right))) {
        int ret;
        __Pyx_GIVEREF(*p_left);
        ret = PyUnicode_Resize(p_left, new_len);
        __Pyx_GOTREF(*p_left);
        if (unlikely(ret != 0))
            return NULL;
        #if PY_VERSION_HEX >= 0x030d0000
        if (unlikely(PyUnicode_CopyCharacters(*p_left, left_len, right, 0, right_len) < 0)) return NULL;
        #else
        _PyUnicode_FastCopyCharacters(*p_left, left_len, right, 0, right_len);
        #endif
        __Pyx_INCREF(*p_left);
        __Pyx_GIVEREF(*p_left);
        return *p_left;
    } else {
        return __Pyx_PyUnicode_Concat(left, right);
    }
  }
#endif

/* IterNextPlain (used by IterNext) */
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
static PyObject *__Pyx_GetBuiltinNext_LimitedAPI(void) {
    if (unlikely(!__pyx_mstate_global->__Pyx_GetBuiltinNext_LimitedAPI_cache))
        __pyx_mstate_global->__Pyx_GetBuiltinNext_LimitedAPI_cache = __Pyx_GetBuiltinName(__pyx_mstate_global->__pyx_n_u_next);
    return __pyx_mstate_global->__Pyx_GetBuiltinNext_LimitedAPI_cache;
}
#endif
static CYTHON_INLINE PyObject *__Pyx_PyIter_Next_Plain(PyObject *iterator) {
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
    PyObject *result;
    PyObject *next = __Pyx_GetBuiltinNext_LimitedAPI();
    if (unlikely(!next)) return NULL;
    result = PyObject_CallFunctionObjArgs(next, iterator, NULL);
    return result;
#else
    (void)__Pyx_GetBuiltinName; // only for early limited API
    iternextfunc iternext = __Pyx_PyObject_GetIterNextFunc(iterator);
    assert(iternext);
    return iternext(iterator);
#endif
}

/* IterNext */
static PyObject *__Pyx_PyIter_Next2Default(PyObject* defval) {
    PyObject* exc_type;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    exc_type = __Pyx_PyErr_CurrentExceptionType();
    if (unlikely(exc_type)) {
        if (!defval || unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))
            return NULL;
        __Pyx_PyErr_Clear();
        Py_INCREF(defval);
        return defval;
    }
    if (defval) {
        Py_INCREF(defval);
        return defval;
    }
    __Pyx_PyErr_SetNone(PyExc_StopIteration);
    return NULL;
}
static void __Pyx_PyIter_Next_ErrorNoIterator(PyObject *iterator) {
    __Pyx_TypeName iterator_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(iterator));
    PyErr_Format(PyExc_TypeError,
        __Pyx_FMT_TYPENAME " object is not an iterator", iterator_type_name);
    __Pyx_DECREF_TypeName(iterator_type_name);
}
static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject* iterator, PyObject* defval) {
    PyObject* next;
#if !CYTHON_COMPILING_IN_LIMITED_API
    iternextfunc iternext = __Pyx_PyObject_TryGetSlot(iterator, tp_iternext, iternextfunc);
    if (likely(iternext)) {
        next = iternext(iterator);
        if (likely(next))
            return next;
    #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000
        if (unlikely(iternext == &_PyObject_NextNotImplemented))
            return NULL;
    #endif
    } else if (CYTHON_USE_TYPE_SLOTS) {
        __Pyx_PyIter_Next_ErrorNoIterator(iterator);
        return NULL;
    } else
#endif
    if (unlikely(!PyIter_Check(iterator))) {
        __Pyx_PyIter_Next_ErrorNoIterator(iterator);
        return NULL;
    } else {
        next = defval ? PyIter_Next(iterator) : __Pyx_PyIter_Next_Plain(iterator);
        if (likely(next))
            return next;
    }
    return __Pyx_PyIter_Next2Default(defval);
}

/* PyObjectCall2Args (used by CallUnboundCMethod1) */
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
    PyObject *args[3] = {NULL, arg1, arg2};
    return __Pyx_PyObject_FastCall(function, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
}

/* CallUnboundCMethod1 */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg) {
    int was_initialized =  __Pyx_CachedCFunction_GetAndSetInitializing(cfunc);
    if (likely(was_initialized == 2 && cfunc->func)) {
        int flag = cfunc->flag;
        if (flag == METH_O) {
            return __Pyx_CallCFunction(cfunc, self, arg);
        } else if (flag == METH_FASTCALL) {
            return __Pyx_CallCFunctionFast(cfunc, self, &arg, 1);
        } else if (flag == (METH_FASTCALL | METH_KEYWORDS)) {
            return __Pyx_CallCFunctionFastWithKeywords(cfunc, self, &arg, 1, NULL);
        }
    }
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    else if (unlikely(was_initialized == 1)) {
        __Pyx_CachedCFunction tmp_cfunc = {
#ifndef __cplusplus
            0
#endif
        };
        tmp_cfunc.type = cfunc->type;
        tmp_cfunc.method_name = cfunc->method_name;
        return __Pyx__CallUnboundCMethod1(&tmp_cfunc, self, arg);
    }
#endif
    PyObject* result = __Pyx__CallUnboundCMethod1(cfunc, self, arg);
    __Pyx_CachedCFunction_SetFinishedInitializing(cfunc);
    return result;
}
#endif
static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg){
    PyObject *result = NULL;
    if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
#if CYTHON_COMPILING_IN_CPYTHON
    if (cfunc->func && (cfunc->flag & METH_VARARGS)) {
        PyObject *args = PyTuple_New(1);
        if (unlikely(!args)) return NULL;
        Py_INCREF(arg);
        PyTuple_SET_ITEM(args, 0, arg);
        if (cfunc->flag & METH_KEYWORDS)
            result = __Pyx_CallCFunctionWithKeywords(cfunc, self, args, NULL);
        else
            result = __Pyx_CallCFunction(cfunc, self, args);
        Py_DECREF(args);
    } else
#endif
    {
        result = __Pyx_PyObject_Call2Args(cfunc->method, self, arg);
    }
    return result;
}

/* DictGetItem */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
    PyObject *value;
    if (unlikely(__Pyx_PyDict_GetItemRef(d, key, &value) == 0)) { // no value, no error
        if (unlikely(PyTuple_Check(key))) {
            PyObject* args = PyTuple_Pack(1, key);
            if (likely(args)) {
                PyErr_SetObject(PyExc_KeyError, args);
                Py_DECREF(args);
            }
        } else {
            PyErr_SetObject(PyExc_KeyError, key);
        }
    }
    return value;
}
#endif

/* PyLongBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_Fallback___Pyx_PyLong_SubtractObjC(PyObject *op1, PyObject *op2, int inplace) {
    return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2);
}
#if CYTHON_USE_PYLONG_INTERNALS
static PyObject* __Pyx_Unpacked___Pyx_PyLong_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
    CYTHON_MAYBE_UNUSED_VAR(inplace);
    CYTHON_UNUSED_VAR(zerodivision_check);
    const long b = intval;
    long a;
    const PY_LONG_LONG llb = intval;
    PY_LONG_LONG lla;
    if (unlikely(__Pyx_PyLong_IsZero(op1))) {
        return PyLong_FromLong(-intval);
    }
    const int is_positive = __Pyx_PyLong_IsPos(op1);
    const digit* digits = __Pyx_PyLong_Digits(op1);
    const Py_ssize_t size = __Pyx_PyLong_DigitCount(op1);
    if (likely(size == 1)) {
        a = (long) digits[0];
        if (!is_positive) a *= -1;
    } else {
        switch (size) {
            case 2:
                if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                    a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if (!is_positive) a *= -1;
                    goto calculate_long;
                } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                    lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                    if (!is_positive) lla *= -1;
                    goto calculate_long_long;
                }
                break;
            case 3:
                if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                    a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if (!is_positive) a *= -1;
                    goto calculate_long;
                } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                    lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                    if (!is_positive) lla *= -1;
                    goto calculate_long_long;
                }
                break;
            case 4:
                if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                    a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if (!is_positive) a *= -1;
                    goto calculate_long;
                } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                    lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                    if (!is_positive) lla *= -1;
                    goto calculate_long_long;
                }
                break;
        }
        return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
    }
    calculate_long:
        {
            long x;
            x = a - b;
            return PyLong_FromLong(x);
        }
    calculate_long_long:
        {
            PY_LONG_LONG llx;
            llx = lla - llb;
            return PyLong_FromLongLong(llx);
        }
    
}
#endif
static PyObject* __Pyx_Float___Pyx_PyLong_SubtractObjC(PyObject *float_val, long intval, int zerodivision_check) {
    CYTHON_UNUSED_VAR(zerodivision_check);
    const long b = intval;
    double a = __Pyx_PyFloat_AS_DOUBLE(float_val);
        double result;
        
        result = ((double)a) - (double)b;
        return PyFloat_FromDouble(result);
}
static CYTHON_INLINE PyObject* __Pyx_PyLong_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
    CYTHON_MAYBE_UNUSED_VAR(intval);
    CYTHON_UNUSED_VAR(zerodivision_check);
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        return __Pyx_Unpacked___Pyx_PyLong_SubtractObjC(op1, op2, intval, inplace, zerodivision_check);
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        return __Pyx_Float___Pyx_PyLong_SubtractObjC(op1, intval, zerodivision_check);
    }
    return __Pyx_Fallback___Pyx_PyLong_SubtractObjC(op1, op2, inplace);
}
#endif

/* PyUnicode_Substring */
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Substring(
            PyObject* text, Py_ssize_t start, Py_ssize_t stop) {
    Py_ssize_t length;
    #if !CYTHON_COMPILING_IN_LIMITED_API
    if (unlikely(__Pyx_PyUnicode_READY(text) == -1)) return NULL;
    #endif
    length = __Pyx_PyUnicode_GET_LENGTH(text);
    #if !CYTHON_ASSUME_SAFE_SIZE
    if (unlikely(length < 0)) return NULL;
    #endif
    if (start < 0) {
        start += length;
        if (start < 0)
            start = 0;
    }
    if (stop < 0)
        stop += length;
    else if (stop > length)
        stop = length;
    if (stop <= start)
        return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_unicode);
    if (start == 0 && stop == length)
        return __Pyx_NewRef(text);
#if CYTHON_COMPILING_IN_LIMITED_API
    return PyUnicode_Substring(text, start, stop);
#else
    return PyUnicode_FromKindAndData(PyUnicode_KIND(text),
        PyUnicode_1BYTE_DATA(text) + start*PyUnicode_KIND(text), stop-start);
#endif
}

/* BufferIndexError */
static void __Pyx_RaiseBufferIndexError(int axis) {
  PyErr_Format(PyExc_IndexError,
     "Out of bounds on buffer access (axis %d)", axis);
}

/* pep479 */
static void __Pyx_Generator_Replace_StopIteration(int in_async_gen) {
    PyObject *exc, *val, *tb, *cur_exc, *new_exc;
    __Pyx_PyThreadState_declare
    int is_async_stopiteration = 0;
    CYTHON_MAYBE_UNUSED_VAR(in_async_gen);
    __Pyx_PyThreadState_assign
    cur_exc = __Pyx_PyErr_CurrentExceptionType();
    if (likely(!__Pyx_PyErr_GivenExceptionMatches(cur_exc, PyExc_StopIteration))) {
        if (in_async_gen && unlikely(__Pyx_PyErr_GivenExceptionMatches(cur_exc, PyExc_StopAsyncIteration))) {
            is_async_stopiteration = 1;
        } else {
            return;
        }
    }
    __Pyx_GetException(&exc, &val, &tb);
    Py_XDECREF(exc);
    Py_XDECREF(tb);
    new_exc = PyObject_CallFunction(PyExc_RuntimeError, "s",
        is_async_stopiteration ? "async generator raised StopAsyncIteration" :
        in_async_gen ? "async generator raised StopIteration" :
        "generator raised StopIteration");
    if (!new_exc) {
        Py_XDECREF(val);
        return;
    }
    PyException_SetCause(new_exc, val); // steals ref to val
    PyErr_SetObject(PyExc_RuntimeError, new_exc);
}

/* CoroutineSetYieldFrom (used by GeneratorYieldFrom) */
static void
__Pyx_Coroutine_Set_Owned_Yield_From(__pyx_CoroutineObject *gen, PyObject *yf) {
    assert (!gen->yieldfrom);
#if CYTHON_USE_AM_SEND
    assert (!gen->yieldfrom_am_send);
    #if PY_VERSION_HEX < 0x030A00F0
    if (__Pyx_PyType_HasFeature(Py_TYPE(yf), __Pyx_TPFLAGS_HAVE_AM_SEND))
    #endif
    {
        __Pyx_pyiter_sendfunc am_send;
        #if __PYX_LIMITED_VERSION_HEX >= 0x030A0000
        am_send = __Pyx_PyObject_TryGetSubSlot(yf, tp_as_async, am_send, __Pyx_pyiter_sendfunc);
        #else
        __Pyx_PyAsyncMethodsStruct* tp_as_async = (__Pyx_PyAsyncMethodsStruct*) Py_TYPE(yf)->tp_as_async;
        am_send = tp_as_async ? tp_as_async->am_send : NULL;
        #endif
        if (likely(am_send)) {
            gen->yieldfrom_am_send = am_send;
        }
    }
#endif
    gen->yieldfrom = yf;
}

/* dict_setdefault (used by FetchCommonType) */
static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value) {
    PyObject* value;
#if __PYX_LIMITED_VERSION_HEX >= 0x030F0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4)
    PyDict_SetDefaultRef(d, key, default_value, &value);
#elif CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX >= 0x030C0000
    PyObject *args[] = {d, key, default_value};
    value = PyObject_VectorcallMethod(__pyx_mstate_global->__pyx_n_u_setdefault, args, 3 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
#elif CYTHON_COMPILING_IN_LIMITED_API
    value = PyObject_CallMethodObjArgs(d, __pyx_mstate_global->__pyx_n_u_setdefault, key, default_value, NULL);
#else
    value = PyDict_SetDefault(d, key, default_value);
    if (unlikely(!value)) return NULL;
    Py_INCREF(value);
#endif
    return value;
}

/* LimitedApiGetTypeDict (used by SetItemOnTypeDict) */
#if CYTHON_COMPILING_IN_LIMITED_API
static Py_ssize_t __Pyx_GetTypeDictOffset(void) {
    PyObject *tp_dictoffset_o;
    Py_ssize_t tp_dictoffset;
    tp_dictoffset_o = PyObject_GetAttrString((PyObject*)(&PyType_Type), "__dictoffset__");
    if (unlikely(!tp_dictoffset_o)) return -1;
    tp_dictoffset = PyLong_AsSsize_t(tp_dictoffset_o);
    Py_DECREF(tp_dictoffset_o);
    if (unlikely(tp_dictoffset == 0)) {
        PyErr_SetString(
            PyExc_TypeError,
            "'type' doesn't have a dictoffset");
        return -1;
    } else if (unlikely(tp_dictoffset < 0)) {
        PyErr_SetString(
            PyExc_TypeError,
            "'type' has an unexpected negative dictoffset. "
            "Please report this as Cython bug");
        return -1;
    }
    return tp_dictoffset;
}
static PyObject *__Pyx_GetTypeDict(PyTypeObject *tp) {
    static Py_ssize_t tp_dictoffset = 0;
    if (unlikely(tp_dictoffset == 0)) {
        tp_dictoffset = __Pyx_GetTypeDictOffset();
        if (unlikely(tp_dictoffset == -1 && PyErr_Occurred())) {
            tp_dictoffset = 0; // try again next time?
            return NULL;
        }
    }
    return *(PyObject**)((char*)tp + tp_dictoffset);
}
#endif

/* SetItemOnTypeDict (used by FixUpExtensionType) */
static int __Pyx__SetItemOnTypeDict(PyTypeObject *tp, PyObject *k, PyObject *v) {
    int result;
    PyObject *tp_dict;
#if CYTHON_COMPILING_IN_LIMITED_API
    tp_dict = __Pyx_GetTypeDict(tp);
    if (unlikely(!tp_dict)) return -1;
#else
    tp_dict = tp->tp_dict;
#endif
    result = PyDict_SetItem(tp_dict, k, v);
    if (likely(!result)) {
        PyType_Modified(tp);
        if (unlikely(PyObject_HasAttr(v, __pyx_mstate_global->__pyx_n_u_set_name))) {
            PyObject *setNameResult = PyObject_CallMethodObjArgs(v, __pyx_mstate_global->__pyx_n_u_set_name,  (PyObject *) tp, k, NULL);
            if (!setNameResult) return -1;
            Py_DECREF(setNameResult);
        }
    }
    return result;
}

/* FixUpExtensionType (used by FetchCommonType) */
static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) {
#if __PYX_LIMITED_VERSION_HEX > 0x030900B1
    CYTHON_UNUSED_VAR(spec);
    CYTHON_UNUSED_VAR(type);
    CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict);
#else
    const PyType_Slot *slot = spec->slots;
    int changed = 0;
#if !CYTHON_COMPILING_IN_LIMITED_API
    while (slot && slot->slot && slot->slot != Py_tp_members)
        slot++;
    if (slot && slot->slot == Py_tp_members) {
#if !CYTHON_COMPILING_IN_CPYTHON
        const
#endif  // !CYTHON_COMPILING_IN_CPYTHON)
            PyMemberDef *memb = (PyMemberDef*) slot->pfunc;
        while (memb && memb->name) {
            if (memb->name[0] == '_' && memb->name[1] == '_') {
                if (strcmp(memb->name, "__weaklistoffset__") == 0) {
                    assert(memb->type == T_PYSSIZET);
                    assert(memb->flags == READONLY);
                    type->tp_weaklistoffset = memb->offset;
                    changed = 1;
                }
                else if (strcmp(memb->name, "__dictoffset__") == 0) {
                    assert(memb->type == T_PYSSIZET);
                    assert(memb->flags == READONLY);
                    type->tp_dictoffset = memb->offset;
                    changed = 1;
                }
#if CYTHON_METH_FASTCALL
                else if (strcmp(memb->name, "__vectorcalloffset__") == 0) {
                    assert(memb->type == T_PYSSIZET);
                    assert(memb->flags == READONLY);
                    type->tp_vectorcall_offset = memb->offset;
                    changed = 1;
                }
#endif  // CYTHON_METH_FASTCALL
#if !CYTHON_COMPILING_IN_PYPY
                else if (strcmp(memb->name, "__module__") == 0) {
                    PyObject *descr;
                    assert(memb->type == T_OBJECT);
                    assert(memb->flags == 0 || memb->flags == READONLY);
                    descr = PyDescr_NewMember(type, memb);
                    if (unlikely(!descr))
                        return -1;
                    int set_item_result = PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr);
                    Py_DECREF(descr);
                    if (unlikely(set_item_result < 0)) {
                        return -1;
                    }
                    changed = 1;
                }
#endif  // !CYTHON_COMPILING_IN_PYPY
            }
            memb++;
        }
    }
#endif  // !CYTHON_COMPILING_IN_LIMITED_API
#if !CYTHON_COMPILING_IN_PYPY
    slot = spec->slots;
    while (slot && slot->slot && slot->slot != Py_tp_getset)
        slot++;
    if (slot && slot->slot == Py_tp_getset) {
        PyGetSetDef *getset = (PyGetSetDef*) slot->pfunc;
        while (getset && getset->name) {
            if (getset->name[0] == '_' && getset->name[1] == '_' && strcmp(getset->name, "__module__") == 0) {
                PyObject *descr = PyDescr_NewGetSet(type, getset);
                if (unlikely(!descr))
                    return -1;
                #if CYTHON_COMPILING_IN_LIMITED_API
                PyObject *pyname = PyUnicode_FromString(getset->name);
                if (unlikely(!pyname)) {
                    Py_DECREF(descr);
                    return -1;
                }
                int set_item_result = __Pyx_SetItemOnTypeDict(type, pyname, descr);
                Py_DECREF(pyname);
                #else
                CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict);
                int set_item_result = PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr);
                #endif
                Py_DECREF(descr);
                if (unlikely(set_item_result < 0)) {
                    return -1;
                }
                changed = 1;
            }
            ++getset;
        }
    }
#else
    CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict);
#endif  // !CYTHON_COMPILING_IN_PYPY
    if (changed)
        PyType_Modified(type);
#endif  // PY_VERSION_HEX > 0x030900B1
    return 0;
}

/* AddModuleRef (used by FetchSharedCythonModule) */
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  static PyObject *__Pyx_PyImport_AddModuleObjectRef(PyObject *name) {
      PyObject *module_dict = PyImport_GetModuleDict();
      PyObject *m;
      if (PyMapping_GetOptionalItem(module_dict, name, &m) < 0) {
          return NULL;
      }
      if (m != NULL && PyModule_Check(m)) {
          return m;
      }
      Py_XDECREF(m);
      m = PyModule_NewObject(name);
      if (m == NULL)
          return NULL;
      if (PyDict_CheckExact(module_dict)) {
          PyObject *new_m;
          (void)PyDict_SetDefaultRef(module_dict, name, m, &new_m);
          Py_DECREF(m);
          return new_m;
      } else {
           if (PyObject_SetItem(module_dict, name, m) != 0) {
                Py_DECREF(m);
                return NULL;
            }
            return m;
      }
  }
  static PyObject *__Pyx_PyImport_AddModuleRef(const char *name) {
      PyObject *py_name = PyUnicode_FromString(name);
      if (!py_name) return NULL;
      PyObject *module = __Pyx_PyImport_AddModuleObjectRef(py_name);
      Py_DECREF(py_name);
      return module;
  }
#elif __PYX_LIMITED_VERSION_HEX >= 0x030d0000
  #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name)
#else
  static PyObject *__Pyx_PyImport_AddModuleRef(const char *name) {
      PyObject *module = PyImport_AddModule(name);
      Py_XINCREF(module);
      return module;
  }
#endif

/* FetchSharedCythonModule (used by FetchCommonType) */
static PyObject *__Pyx_FetchSharedCythonABIModule(void) {
    return __Pyx_PyImport_AddModuleRef(__PYX_ABI_MODULE_NAME);
}

/* FetchCommonType (used by CommonTypesMetaclass) */
#if __PYX_LIMITED_VERSION_HEX < 0x030C0000
static PyObject* __Pyx_PyType_FromMetaclass(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases) {
    PyObject *result = __Pyx_PyType_FromModuleAndSpec(module, spec, bases);
    if (result && metaclass) {
        PyObject *old_tp = (PyObject*)Py_TYPE(result);
    Py_INCREF((PyObject*)metaclass);
#if __PYX_LIMITED_VERSION_HEX >= 0x03090000
        Py_SET_TYPE(result, metaclass);
#else
        result->ob_type = metaclass;
#endif
        Py_DECREF(old_tp);
    }
    return result;
}
#else
#define __Pyx_PyType_FromMetaclass(me, mo, s, b) PyType_FromMetaclass(me, mo, s, b)
#endif
static int __Pyx_VerifyCachedType(PyObject *cached_type,
                               const char *name,
                               Py_ssize_t expected_basicsize) {
    Py_ssize_t basicsize;
    if (!PyType_Check(cached_type)) {
        PyErr_Format(PyExc_TypeError,
            "Shared Cython type %.200s is not a type object", name);
        return -1;
    }
    if (expected_basicsize == 0) {
        return 0; // size is inherited, nothing useful to check
    }
#if CYTHON_COMPILING_IN_LIMITED_API
    PyObject *py_basicsize;
    py_basicsize = PyObject_GetAttrString(cached_type, "__basicsize__");
    if (unlikely(!py_basicsize)) return -1;
    basicsize = PyLong_AsSsize_t(py_basicsize);
    Py_DECREF(py_basicsize);
    py_basicsize = NULL;
    if (unlikely(basicsize == (Py_ssize_t)-1) && PyErr_Occurred()) return -1;
#else
    basicsize = ((PyTypeObject*) cached_type)->tp_basicsize;
#endif
    if (basicsize != expected_basicsize) {
        PyErr_Format(PyExc_TypeError,
            "Shared Cython type %.200s has the wrong size, try recompiling",
            name);
        return -1;
    }
    return 0;
}
static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases) {
    PyObject *abi_module = NULL, *cached_type = NULL, *abi_module_dict, *new_cached_type, *py_object_name;
    int get_item_ref_result;
    const char* object_name = strrchr(spec->name, '.');
    object_name = object_name ? object_name+1 : spec->name;
    py_object_name = PyUnicode_FromString(object_name);
    if (!py_object_name) return NULL;
    abi_module = __Pyx_FetchSharedCythonABIModule();
    if (!abi_module) goto done;
    abi_module_dict = PyModule_GetDict(abi_module);
    if (!abi_module_dict) goto done;
    get_item_ref_result = __Pyx_PyDict_GetItemRef(abi_module_dict, py_object_name, &cached_type);
    if (get_item_ref_result == 1) {
        if (__Pyx_VerifyCachedType(
              cached_type,
              object_name,
              spec->basicsize) < 0) {
            goto bad;
        }
        goto done;
    } else if (unlikely(get_item_ref_result == -1)) {
        goto bad;
    }
    cached_type = __Pyx_PyType_FromMetaclass(
        metaclass,
        CYTHON_USE_MODULE_STATE ? module : abi_module,
        spec, bases);
    if (unlikely(!cached_type)) goto bad;
    if (unlikely(__Pyx_fix_up_extension_type_from_spec(spec, (PyTypeObject *) cached_type) < 0)) goto bad;
    new_cached_type = __Pyx_PyDict_SetDefault(abi_module_dict, py_object_name, cached_type);
    if (unlikely(new_cached_type != cached_type)) {
        if (unlikely(!new_cached_type)) goto bad;
        Py_DECREF(cached_type);
        cached_type = new_cached_type;
        if (__Pyx_VerifyCachedType(
                cached_type,
                object_name,
                spec->basicsize) < 0) {
            goto bad;
        }
        goto done;
    } else {
        Py_DECREF(new_cached_type);
    }
done:
    Py_XDECREF(abi_module);
    Py_DECREF(py_object_name);
    assert(cached_type == NULL || PyType_Check(cached_type));
    return (PyTypeObject *) cached_type;
bad:
    Py_XDECREF(cached_type);
    cached_type = NULL;
    goto done;
}

/* CommonTypesMetaclass (used by CoroutineBase) */
static PyObject* __pyx_CommonTypesMetaclass_get_module(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED void* context) {
    return PyUnicode_FromString(__PYX_ABI_MODULE_NAME);
}
#if __PYX_LIMITED_VERSION_HEX < 0x030A0000
static PyObject* __pyx_CommonTypesMetaclass_call(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED PyObject *args, CYTHON_UNUSED PyObject *kwds) {
    PyErr_SetString(PyExc_TypeError, "Cannot instantiate Cython internal types");
    return NULL;
}
static int __pyx_CommonTypesMetaclass_setattr(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED PyObject *attr, CYTHON_UNUSED PyObject *value) {
    PyErr_SetString(PyExc_TypeError, "Cython internal types are immutable");
    return -1;
}
#endif
static PyGetSetDef __pyx_CommonTypesMetaclass_getset[] = {
    {"__module__", __pyx_CommonTypesMetaclass_get_module, NULL, NULL, NULL},
    {0, 0, 0, 0, 0}
};
static PyType_Slot __pyx_CommonTypesMetaclass_slots[] = {
    {Py_tp_getset, (void *)__pyx_CommonTypesMetaclass_getset},
    #if __PYX_LIMITED_VERSION_HEX < 0x030A0000
    {Py_tp_call, (void*)__pyx_CommonTypesMetaclass_call},
    {Py_tp_new, (void*)__pyx_CommonTypesMetaclass_call},
    {Py_tp_setattro, (void*)__pyx_CommonTypesMetaclass_setattr},
    #endif
    {0, 0}
};
static PyType_Spec __pyx_CommonTypesMetaclass_spec = {
    __PYX_TYPE_MODULE_PREFIX "_common_types_metatype",
    0,
    0,
    Py_TPFLAGS_IMMUTABLETYPE |
    Py_TPFLAGS_DISALLOW_INSTANTIATION |
    Py_TPFLAGS_DEFAULT,
    __pyx_CommonTypesMetaclass_slots
};
static int __pyx_CommonTypesMetaclass_init(PyObject *module) {
    __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module);
    PyObject *bases = PyTuple_Pack(1, &PyType_Type);
    if (unlikely(!bases)) {
        return -1;
    }
    mstate->__pyx_CommonTypesMetaclassType = __Pyx_FetchCommonTypeFromSpec(NULL, module, &__pyx_CommonTypesMetaclass_spec, bases);
    Py_DECREF(bases);
    if (unlikely(mstate->__pyx_CommonTypesMetaclassType == NULL)) {
        return -1;
    }
    return 0;
}

/* CallTypeTraverse (used by CoroutineBase) */
#if !CYTHON_USE_TYPE_SPECS || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x03090000)
#else
static int __Pyx_call_type_traverse(PyObject *o, int always_call, visitproc visit, void *arg) {
    #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x03090000
    if (__Pyx_get_runtime_version() < 0x03090000) return 0;
    #endif
    if (!always_call) {
        PyTypeObject *base = __Pyx_PyObject_GetSlot(o, tp_base, PyTypeObject*);
        unsigned long flags = PyType_GetFlags(base);
        if (flags & Py_TPFLAGS_HEAPTYPE) {
            return 0;
        }
    }
    Py_VISIT((PyObject*)Py_TYPE(o));
    return 0;
}
#endif

/* PyObjectCallMethod1 (used by CoroutineBase) */
#if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000)))
static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
    PyObject *result = __Pyx_PyObject_CallOneArg(method, arg);
    Py_DECREF(method);
    return result;
}
#endif
static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
#if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))
    PyObject *args[2] = {obj, arg};
    (void) __Pyx_PyObject_CallOneArg;
    (void) __Pyx_PyObject_Call2Args;
    return PyObject_VectorcallMethod(method_name, args, 2 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
#else
    PyObject *method = NULL, *result;
    int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
    if (likely(is_method)) {
        result = __Pyx_PyObject_Call2Args(method, obj, arg);
        Py_DECREF(method);
        return result;
    }
    if (unlikely(!method)) return NULL;
    return __Pyx__PyObject_CallMethod1(method, arg);
#endif
}

/* ReturnWithStopIteration (used by CoroutineBase) */
static void __Pyx__ReturnWithStopIteration(PyObject* value, int async);
static CYTHON_INLINE void __Pyx_ReturnWithStopIteration(PyObject* value, int async, int iternext) {
    if (value == Py_None) {
        if (async || !iternext)
            PyErr_SetNone(async ? PyExc_StopAsyncIteration : PyExc_StopIteration);
        return;
    }
    __Pyx__ReturnWithStopIteration(value, async);
}
static void __Pyx__ReturnWithStopIteration(PyObject* value, int async) {
#if CYTHON_COMPILING_IN_CPYTHON
    __Pyx_PyThreadState_declare
#endif
    PyObject *exc;
    PyObject *exc_type = async ? PyExc_StopAsyncIteration : PyExc_StopIteration;
#if CYTHON_COMPILING_IN_CPYTHON
    if ((PY_VERSION_HEX >= (0x030C00A6)) || unlikely(PyTuple_Check(value) || PyExceptionInstance_Check(value))) {
        if (PY_VERSION_HEX >= (0x030e00A1)) {
            exc = __Pyx_PyObject_CallOneArg(exc_type, value);
        } else {
            PyObject *args_tuple = PyTuple_New(1);
            if (unlikely(!args_tuple)) return;
            Py_INCREF(value);
            PyTuple_SET_ITEM(args_tuple, 0, value);
            exc = PyObject_Call(exc_type, args_tuple, NULL);
            Py_DECREF(args_tuple);
        }
        if (unlikely(!exc)) return;
    } else {
        Py_INCREF(value);
        exc = value;
    }
    #if CYTHON_FAST_THREAD_STATE
    __Pyx_PyThreadState_assign
    #if CYTHON_USE_EXC_INFO_STACK
    if (!__pyx_tstate->exc_info->exc_value)
    #else
    if (!__pyx_tstate->exc_type)
    #endif
    {
        Py_INCREF(exc_type);
        __Pyx_ErrRestore(exc_type, exc, NULL);
        return;
    }
    #endif
#else
    exc = __Pyx_PyObject_CallOneArg(exc_type, value);
    if (unlikely(!exc)) return;
#endif
    PyErr_SetObject(exc_type, exc);
    Py_DECREF(exc);
}

/* CoroutineBase (used by Generator) */
#if !CYTHON_COMPILING_IN_LIMITED_API
#include <frameobject.h>
#if PY_VERSION_HEX >= 0x030b00a6 && !defined(PYPY_VERSION)
  #ifndef Py_BUILD_CORE
    #define Py_BUILD_CORE 1
  #endif
  #include "internal/pycore_frame.h"
#endif
#endif // CYTHON_COMPILING_IN_LIMITED_API
static CYTHON_INLINE void
__Pyx_Coroutine_Undelegate(__pyx_CoroutineObject *gen) {
#if CYTHON_USE_AM_SEND
    gen->yieldfrom_am_send = NULL;
#endif
    Py_CLEAR(gen->yieldfrom);
}
static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *__pyx_tstate, PyObject **pvalue) {
    PyObject *et, *ev, *tb;
    PyObject *value = NULL;
    CYTHON_UNUSED_VAR(__pyx_tstate);
    __Pyx_ErrFetch(&et, &ev, &tb);
    if (!et) {
        Py_XDECREF(tb);
        Py_XDECREF(ev);
        Py_INCREF(Py_None);
        *pvalue = Py_None;
        return 0;
    }
    if (likely(et == PyExc_StopIteration)) {
        if (!ev) {
            Py_INCREF(Py_None);
            value = Py_None;
        }
        else if (likely(__Pyx_IS_TYPE(ev, (PyTypeObject*)PyExc_StopIteration))) {
            #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL
            value = PyObject_GetAttr(ev, __pyx_mstate_global->__pyx_n_u_value);
            if (unlikely(!value)) goto limited_api_failure;
            #else
            value = ((PyStopIterationObject *)ev)->value;
            Py_INCREF(value);
            #endif
            Py_DECREF(ev);
        }
        else if (unlikely(PyTuple_Check(ev))) {
            Py_ssize_t tuple_size = __Pyx_PyTuple_GET_SIZE(ev);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely(tuple_size < 0)) {
                Py_XDECREF(tb);
                Py_DECREF(ev);
                Py_DECREF(et);
                return -1;
            }
            #endif
            if (tuple_size >= 1) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                value = PyTuple_GET_ITEM(ev, 0);
                Py_INCREF(value);
#elif CYTHON_ASSUME_SAFE_MACROS
                value = PySequence_ITEM(ev, 0);
#else
                value = PySequence_GetItem(ev, 0);
                if (!value) goto limited_api_failure;
#endif
            } else {
                Py_INCREF(Py_None);
                value = Py_None;
            }
            Py_DECREF(ev);
        }
        else if (!__Pyx_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration)) {
            value = ev;
        }
        if (likely(value)) {
            Py_XDECREF(tb);
            Py_DECREF(et);
            *pvalue = value;
            return 0;
        }
    } else if (!__Pyx_PyErr_GivenExceptionMatches(et, PyExc_StopIteration)) {
        __Pyx_ErrRestore(et, ev, tb);
        return -1;
    }
    PyErr_NormalizeException(&et, &ev, &tb);
    if (unlikely(!PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration))) {
        __Pyx_ErrRestore(et, ev, tb);
        return -1;
    }
    Py_XDECREF(tb);
    Py_DECREF(et);
#if CYTHON_COMPILING_IN_LIMITED_API
    value = PyObject_GetAttr(ev, __pyx_mstate_global->__pyx_n_u_value);
#else
    value = ((PyStopIterationObject *)ev)->value;
    Py_INCREF(value);
#endif
    Py_DECREF(ev);
#if CYTHON_COMPILING_IN_LIMITED_API
    if (unlikely(!value)) return -1;
#endif
    *pvalue = value;
    return 0;
#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL || !CYTHON_ASSUME_SAFE_MACROS
  limited_api_failure:
    Py_XDECREF(et);
    Py_XDECREF(tb);
    Py_XDECREF(ev);
    return -1;
#endif
}
static CYTHON_INLINE
__Pyx_PySendResult __Pyx_Coroutine_status_from_result(PyObject **retval) {
    if (*retval) {
        return PYGEN_NEXT;
    } else if (likely(__Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, retval) == 0)) {
        return PYGEN_RETURN;
    } else {
        return PYGEN_ERROR;
    }
}
static CYTHON_INLINE
void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *exc_state) {
#if PY_VERSION_HEX >= 0x030B00a4
    Py_CLEAR(exc_state->exc_value);
#else
    PyObject *t, *v, *tb;
    t = exc_state->exc_type;
    v = exc_state->exc_value;
    tb = exc_state->exc_traceback;
    exc_state->exc_type = NULL;
    exc_state->exc_value = NULL;
    exc_state->exc_traceback = NULL;
    Py_XDECREF(t);
    Py_XDECREF(v);
    Py_XDECREF(tb);
#endif
}
#define __Pyx_Coroutine_AlreadyRunningError(gen)  (__Pyx__Coroutine_AlreadyRunningError(gen), (PyObject*)NULL)
static void __Pyx__Coroutine_AlreadyRunningError(__pyx_CoroutineObject *gen) {
    const char *msg;
    CYTHON_MAYBE_UNUSED_VAR(gen);
    if ((0)) {
    #ifdef __Pyx_Coroutine_USED
    } else if (__Pyx_Coroutine_Check((PyObject*)gen)) {
        msg = "coroutine already executing";
    #endif
    #ifdef __Pyx_AsyncGen_USED
    } else if (__Pyx_AsyncGen_CheckExact((PyObject*)gen)) {
        msg = "async generator already executing";
    #endif
    } else {
        msg = "generator already executing";
    }
    PyErr_SetString(PyExc_ValueError, msg);
}
static void __Pyx_Coroutine_AlreadyTerminatedError(PyObject *gen, PyObject *value, int closing) {
    CYTHON_MAYBE_UNUSED_VAR(gen);
    CYTHON_MAYBE_UNUSED_VAR(closing);
    #ifdef __Pyx_Coroutine_USED
    if (!closing && __Pyx_Coroutine_Check(gen)) {
        PyErr_SetString(PyExc_RuntimeError, "cannot reuse already awaited coroutine");
    } else
    #endif
    if (value) {
        #ifdef __Pyx_AsyncGen_USED
        if (__Pyx_AsyncGen_CheckExact(gen))
            PyErr_SetNone(PyExc_StopAsyncIteration);
        else
        #endif
        PyErr_SetNone(PyExc_StopIteration);
    }
}
static
__Pyx_PySendResult __Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value, PyObject **result, int closing) {
    __Pyx_PyThreadState_declare
    PyThreadState *tstate;
    __Pyx_ExcInfoStruct *exc_state;
    PyObject *retval;
    assert(__Pyx_Coroutine_get_is_running(self));  // Callers should ensure is_running
    if (unlikely(self->resume_label == -1)) {
        __Pyx_Coroutine_AlreadyTerminatedError((PyObject*)self, value, closing);
        return PYGEN_ERROR;
    }
#if CYTHON_FAST_THREAD_STATE
    __Pyx_PyThreadState_assign
    tstate = __pyx_tstate;
#else
    tstate = __Pyx_PyThreadState_Current;
#endif
    exc_state = &self->gi_exc_state;
    if (exc_state->exc_value) {
        #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY
        #else
        PyObject *exc_tb;
        #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_CPYTHON
        exc_tb = PyException_GetTraceback(exc_state->exc_value);
        #elif PY_VERSION_HEX >= 0x030B00a4
        exc_tb = ((PyBaseExceptionObject*) exc_state->exc_value)->traceback;
        #else
        exc_tb = exc_state->exc_traceback;
        #endif
        if (exc_tb) {
            PyTracebackObject *tb = (PyTracebackObject *) exc_tb;
            PyFrameObject *f = tb->tb_frame;
            assert(f->f_back == NULL);
            #if PY_VERSION_HEX >= 0x030B00A1
            f->f_back = PyThreadState_GetFrame(tstate);
            #else
            Py_XINCREF(tstate->frame);
            f->f_back = tstate->frame;
            #endif
            #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_CPYTHON
            Py_DECREF(exc_tb);
            #endif
        }
        #endif
    }
#if CYTHON_USE_EXC_INFO_STACK
    exc_state->previous_item = tstate->exc_info;
    tstate->exc_info = exc_state;
#else
    if (exc_state->exc_type) {
        __Pyx_ExceptionSwap(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
    } else {
        __Pyx_Coroutine_ExceptionClear(exc_state);
        __Pyx_ExceptionSave(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
    }
#endif
    retval = self->body(self, tstate, value);
#if CYTHON_USE_EXC_INFO_STACK
    exc_state = &self->gi_exc_state;
    tstate->exc_info = exc_state->previous_item;
    exc_state->previous_item = NULL;
    __Pyx_Coroutine_ResetFrameBackpointer(exc_state);
#endif
    *result = retval;
    if (self->resume_label == -1) {
        return likely(retval) ? PYGEN_RETURN : PYGEN_ERROR;
    }
    return PYGEN_NEXT;
}
static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state) {
#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API
    CYTHON_UNUSED_VAR(exc_state);
#else
    PyObject *exc_tb;
    #if PY_VERSION_HEX >= 0x030B00a4
    if (!exc_state->exc_value) return;
    exc_tb = PyException_GetTraceback(exc_state->exc_value);
    #else
    exc_tb = exc_state->exc_traceback;
    #endif
    if (likely(exc_tb)) {
        PyTracebackObject *tb = (PyTracebackObject *) exc_tb;
        PyFrameObject *f = tb->tb_frame;
        Py_CLEAR(f->f_back);
        #if PY_VERSION_HEX >= 0x030B00a4
        Py_DECREF(exc_tb);
        #endif
    }
#endif
}
#define __Pyx_Coroutine_MethodReturnFromResult(gen, result, retval, iternext)\
    ((result) == PYGEN_NEXT ? (retval) : __Pyx__Coroutine_MethodReturnFromResult(gen, result, retval, iternext))
static PyObject *
__Pyx__Coroutine_MethodReturnFromResult(PyObject* gen, __Pyx_PySendResult result, PyObject *retval, int iternext) {
    CYTHON_MAYBE_UNUSED_VAR(gen);
    if (likely(result == PYGEN_RETURN)) {
        int is_async = 0;
        #ifdef __Pyx_AsyncGen_USED
        is_async = __Pyx_AsyncGen_CheckExact(gen);
        #endif
        __Pyx_ReturnWithStopIteration(retval, is_async, iternext);
        Py_XDECREF(retval);
    }
    return NULL;
}
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE
PyObject *__Pyx_PyGen_Send(PyGenObject *gen, PyObject *arg) {
#if PY_VERSION_HEX <= 0x030A00A1
    return _PyGen_Send(gen, arg);
#else
    PyObject *result;
    if (PyIter_Send((PyObject*)gen, arg ? arg : Py_None, &result) == PYGEN_RETURN) {
        if (PyAsyncGen_CheckExact(gen)) {
            assert(result == Py_None);
            PyErr_SetNone(PyExc_StopAsyncIteration);
        }
        else if (result == Py_None) {
            PyErr_SetNone(PyExc_StopIteration);
        }
        else {
#if PY_VERSION_HEX < 0x030d00A1
            _PyGen_SetStopIterationValue(result);
#else
            if (!PyTuple_Check(result) && !PyExceptionInstance_Check(result)) {
                PyErr_SetObject(PyExc_StopIteration, result);
            } else {
                PyObject *exc = __Pyx_PyObject_CallOneArg(PyExc_StopIteration, result);
                if (likely(exc != NULL)) {
                    PyErr_SetObject(PyExc_StopIteration, exc);
                    Py_DECREF(exc);
                }
            }
#endif
        }
        Py_DECREF(result);
        result = NULL;
    }
    return result;
#endif
}
#endif
static CYTHON_INLINE __Pyx_PySendResult
__Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject *gen, PyObject** retval) {
    __Pyx_PySendResult result;
    PyObject *val = NULL;
    assert(__Pyx_Coroutine_get_is_running(gen));
    __Pyx_Coroutine_Undelegate(gen);
    __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, &val);
    result = __Pyx_Coroutine_SendEx(gen, val, retval, 0);
    Py_XDECREF(val);
    return result;
}
#if CYTHON_USE_AM_SEND
static __Pyx_PySendResult
__Pyx_Coroutine_SendToDelegate(__pyx_CoroutineObject *gen, __Pyx_pyiter_sendfunc gen_am_send, PyObject *value, PyObject **retval) {
    PyObject *ret = NULL;
    __Pyx_PySendResult delegate_result, result;
    assert(__Pyx_Coroutine_get_is_running(gen));
    delegate_result = gen_am_send(gen->yieldfrom, value, &ret);
    if (delegate_result == PYGEN_NEXT) {
        assert (ret != NULL);
        *retval = ret;
        return PYGEN_NEXT;
    }
    assert (delegate_result != PYGEN_ERROR || ret == NULL);
    __Pyx_Coroutine_Undelegate(gen);
    result = __Pyx_Coroutine_SendEx(gen, ret, retval, 0);
    Py_XDECREF(ret);
    return result;
}
#endif
static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) {
    PyObject *retval = NULL;
    __Pyx_PySendResult result = __Pyx_Coroutine_AmSend(self, value, &retval);
    return __Pyx_Coroutine_MethodReturnFromResult(self, result, retval, 0);
}
static __Pyx_PySendResult
__Pyx_Coroutine_AmSend(PyObject *self, PyObject *value, PyObject **retval) {
    __Pyx_PySendResult result;
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
    if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) {
        *retval = __Pyx_Coroutine_AlreadyRunningError(gen);
        return PYGEN_ERROR;
    }
    #if CYTHON_USE_AM_SEND
    if (gen->yieldfrom_am_send) {
        result = __Pyx_Coroutine_SendToDelegate(gen, gen->yieldfrom_am_send, value, retval);
    } else
    #endif
    if (gen->yieldfrom) {
        PyObject *yf = gen->yieldfrom;
        PyObject *ret;
      #if !CYTHON_USE_AM_SEND
        #ifdef __Pyx_Generator_USED
        if (__Pyx_Generator_CheckExact(yf)) {
            ret = __Pyx_Coroutine_Send(yf, value);
        } else
        #endif
        #ifdef __Pyx_Coroutine_USED
        if (__Pyx_Coroutine_Check(yf)) {
            ret = __Pyx_Coroutine_Send(yf, value);
        } else
        #endif
        #ifdef __Pyx_AsyncGen_USED
        if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
            ret = __Pyx_async_gen_asend_send(yf, value);
        } else
        #endif
        #if CYTHON_COMPILING_IN_CPYTHON
        if (PyGen_CheckExact(yf)) {
            ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
        } else
        if (PyCoro_CheckExact(yf)) {
            ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
        } else
        #endif
      #endif
        {
            #if !CYTHON_COMPILING_IN_LIMITED_API || __PYX_LIMITED_VERSION_HEX >= 0x03080000
            if (value == Py_None && PyIter_Check(yf))
                ret = __Pyx_PyIter_Next_Plain(yf);
            else
            #endif
                ret = __Pyx_PyObject_CallMethod1(yf, __pyx_mstate_global->__pyx_n_u_send, value);
        }
        if (likely(ret)) {
            __Pyx_Coroutine_unset_is_running(gen);
            *retval = ret;
            return PYGEN_NEXT;
        }
        result = __Pyx_Coroutine_FinishDelegation(gen, retval);
    } else {
        result = __Pyx_Coroutine_SendEx(gen, value, retval, 0);
    }
    __Pyx_Coroutine_unset_is_running(gen);
    return result;
}
static int __Pyx_Coroutine_CloseIter(__pyx_CoroutineObject *gen, PyObject *yf) {
    __Pyx_PySendResult result;
    PyObject *retval = NULL;
    CYTHON_UNUSED_VAR(gen);
    assert(__Pyx_Coroutine_get_is_running(gen));
    #ifdef __Pyx_Generator_USED
    if (__Pyx_Generator_CheckExact(yf)) {
        result = __Pyx_Coroutine_Close(yf, &retval);
    } else
    #endif
    #ifdef __Pyx_Coroutine_USED
    if (__Pyx_Coroutine_Check(yf)) {
        result = __Pyx_Coroutine_Close(yf, &retval);
    } else
    if (__Pyx_CoroutineAwait_CheckExact(yf)) {
        result = __Pyx_CoroutineAwait_Close((__pyx_CoroutineAwaitObject*)yf);
    } else
    #endif
    #ifdef __Pyx_AsyncGen_USED
    if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
        retval = __Pyx_async_gen_asend_close(yf, NULL);
        result = PYGEN_RETURN;
    } else
    if (__pyx_PyAsyncGenAThrow_CheckExact(yf)) {
        retval = __Pyx_async_gen_athrow_close(yf, NULL);
        result = PYGEN_RETURN;
    } else
    #endif
    {
        PyObject *meth;
        result = PYGEN_RETURN;
        meth = __Pyx_PyObject_GetAttrStrNoError(yf, __pyx_mstate_global->__pyx_n_u_close);
        if (unlikely(!meth)) {
            if (unlikely(PyErr_Occurred())) {
                PyErr_WriteUnraisable(yf);
            }
        } else {
            retval = __Pyx_PyObject_CallNoArg(meth);
            Py_DECREF(meth);
            if (unlikely(!retval)) {
                result = PYGEN_ERROR;
            }
        }
    }
    Py_XDECREF(retval);
    return result == PYGEN_ERROR ? -1 : 0;
}
static PyObject *__Pyx_Generator_Next(PyObject *self) {
    __Pyx_PySendResult result;
    PyObject *retval = NULL;
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
    if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) {
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    }
    #if CYTHON_USE_AM_SEND
    if (gen->yieldfrom_am_send) {
        result = __Pyx_Coroutine_SendToDelegate(gen, gen->yieldfrom_am_send, Py_None, &retval);
    } else
    #endif
    if (gen->yieldfrom) {
        PyObject *yf = gen->yieldfrom;
        PyObject *ret;
        #ifdef __Pyx_Generator_USED
        if (__Pyx_Generator_CheckExact(yf)) {
            ret = __Pyx_Generator_Next(yf);
        } else
        #endif
        #ifdef __Pyx_Coroutine_USED
        if (__Pyx_Coroutine_CheckExact(yf)) {
            ret = __Pyx_Coroutine_Send(yf, Py_None);
        } else
        #endif
        #if CYTHON_COMPILING_IN_CPYTHON && (PY_VERSION_HEX < 0x030A00A3 || !CYTHON_USE_AM_SEND)
        if (PyGen_CheckExact(yf)) {
            ret = __Pyx_PyGen_Send((PyGenObject*)yf, NULL);
        } else
        #endif
            ret = __Pyx_PyIter_Next_Plain(yf);
        if (likely(ret)) {
            __Pyx_Coroutine_unset_is_running(gen);
            return ret;
        }
        result = __Pyx_Coroutine_FinishDelegation(gen, &retval);
    } else {
        result = __Pyx_Coroutine_SendEx(gen, Py_None, &retval, 0);
    }
    __Pyx_Coroutine_unset_is_running(gen);
    return __Pyx_Coroutine_MethodReturnFromResult(self, result, retval, 1);
}
static PyObject *__Pyx_Coroutine_Close_Method(PyObject *self, PyObject *arg) {
    PyObject *retval = NULL;
    __Pyx_PySendResult result;
    CYTHON_UNUSED_VAR(arg);
    result = __Pyx_Coroutine_Close(self, &retval);
    if (unlikely(result == PYGEN_ERROR))
        return NULL;
    Py_XDECREF(retval);
    Py_RETURN_NONE;
}
static __Pyx_PySendResult
__Pyx_Coroutine_Close(PyObject *self, PyObject **retval) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    __Pyx_PySendResult result;
    PyObject *yf;
    int err = 0;
    if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) {
        *retval = __Pyx_Coroutine_AlreadyRunningError(gen);
        return PYGEN_ERROR;
    }
    yf = gen->yieldfrom;
    if (yf) {
        Py_INCREF(yf);
        err = __Pyx_Coroutine_CloseIter(gen, yf);
        __Pyx_Coroutine_Undelegate(gen);
        Py_DECREF(yf);
    }
    if (err == 0)
        PyErr_SetNone(PyExc_GeneratorExit);
    result = __Pyx_Coroutine_SendEx(gen, NULL, retval, 1);
    if (result == PYGEN_ERROR) {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_Coroutine_unset_is_running(gen);
        if (!__Pyx_PyErr_Occurred()) {
            return PYGEN_RETURN;
        } else if (likely(__Pyx_PyErr_ExceptionMatches2(PyExc_GeneratorExit, PyExc_StopIteration))) {
            __Pyx_PyErr_Clear();
            return PYGEN_RETURN;
        }
        return PYGEN_ERROR;
    } else if (likely(result == PYGEN_RETURN && *retval == Py_None)) {
        __Pyx_Coroutine_unset_is_running(gen);
        return PYGEN_RETURN;
    } else {
        const char *msg;
        Py_DECREF(*retval);
        *retval = NULL;
        if ((0)) {
        #ifdef __Pyx_Coroutine_USED
        } else if (__Pyx_Coroutine_Check(self)) {
            msg = "coroutine ignored GeneratorExit";
        #endif
        #ifdef __Pyx_AsyncGen_USED
        } else if (__Pyx_AsyncGen_CheckExact(self)) {
            msg = "async generator ignored GeneratorExit";
        #endif
        } else {
            msg = "generator ignored GeneratorExit";
        }
        PyErr_SetString(PyExc_RuntimeError, msg);
        __Pyx_Coroutine_unset_is_running(gen);
        return PYGEN_ERROR;
    }
}
static PyObject *__Pyx__Coroutine_Throw(PyObject *self, PyObject *typ, PyObject *val, PyObject *tb,
                                        PyObject *args, int close_on_genexit) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    PyObject *yf;
    if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen)))
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    yf = gen->yieldfrom;
    if (yf) {
        __Pyx_PySendResult result;
        PyObject *ret;
        Py_INCREF(yf);
        if (__Pyx_PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit) && close_on_genexit) {
            int err = __Pyx_Coroutine_CloseIter(gen, yf);
            Py_DECREF(yf);
            __Pyx_Coroutine_Undelegate(gen);
            if (err < 0)
                goto propagate_exception;
            goto throw_here;
        }
        if (0
        #ifdef __Pyx_Generator_USED
            || __Pyx_Generator_CheckExact(yf)
        #endif
        #ifdef __Pyx_Coroutine_USED
            || __Pyx_Coroutine_Check(yf)
        #endif
            ) {
            ret = __Pyx__Coroutine_Throw(yf, typ, val, tb, args, close_on_genexit);
        #ifdef __Pyx_Coroutine_USED
        } else if (__Pyx_CoroutineAwait_CheckExact(yf)) {
            ret = __Pyx__Coroutine_Throw(((__pyx_CoroutineAwaitObject*)yf)->coroutine, typ, val, tb, args, close_on_genexit);
        #endif
        } else {
            PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(yf, __pyx_mstate_global->__pyx_n_u_throw);
            if (unlikely(!meth)) {
                Py_DECREF(yf);
                if (unlikely(PyErr_Occurred())) {
                    __Pyx_Coroutine_unset_is_running(gen);
                    return NULL;
                }
                __Pyx_Coroutine_Undelegate(gen);
                goto throw_here;
            }
            if (likely(args)) {
                ret = __Pyx_PyObject_Call(meth, args, NULL);
            } else {
                PyObject *cargs[4] = {NULL, typ, val, tb};
                ret = __Pyx_PyObject_FastCall(meth, cargs+1, 3 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
            }
            Py_DECREF(meth);
        }
        Py_DECREF(yf);
        if (ret) {
            __Pyx_Coroutine_unset_is_running(gen);
            return ret;
        }
        result = __Pyx_Coroutine_FinishDelegation(gen, &ret);
        __Pyx_Coroutine_unset_is_running(gen);
        return __Pyx_Coroutine_MethodReturnFromResult(self, result, ret, 0);
    }
throw_here:
    __Pyx_Raise(typ, val, tb, NULL);
propagate_exception:
    {
        PyObject *retval = NULL;
        __Pyx_PySendResult result = __Pyx_Coroutine_SendEx(gen, NULL, &retval, 0);
        __Pyx_Coroutine_unset_is_running(gen);
        return __Pyx_Coroutine_MethodReturnFromResult(self, result, retval, 0);
    }
}
static PyObject *__Pyx_Coroutine_Throw(PyObject *self, PyObject *args) {
    PyObject *typ;
    PyObject *val = NULL;
    PyObject *tb = NULL;
    if (unlikely(!PyArg_UnpackTuple(args, "throw", 1, 3, &typ, &val, &tb)))
        return NULL;
    return __Pyx__Coroutine_Throw(self, typ, val, tb, args, 1);
}
static CYTHON_INLINE int __Pyx_Coroutine_traverse_excstate(__Pyx_ExcInfoStruct *exc_state, visitproc visit, void *arg) {
#if PY_VERSION_HEX >= 0x030B00a4
    Py_VISIT(exc_state->exc_value);
#else
    Py_VISIT(exc_state->exc_type);
    Py_VISIT(exc_state->exc_value);
    Py_VISIT(exc_state->exc_traceback);
#endif
    return 0;
}
static int __Pyx_Coroutine_traverse(__pyx_CoroutineObject *gen, visitproc visit, void *arg) {
    {
        int e = __Pyx_call_type_traverse((PyObject*)gen, 1, visit, arg);
        if (e) return e;
    }
    Py_VISIT(gen->closure);
    Py_VISIT(gen->classobj);
    Py_VISIT(gen->yieldfrom);
    return __Pyx_Coroutine_traverse_excstate(&gen->gi_exc_state, visit, arg);
}
static int __Pyx_Coroutine_clear(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    Py_CLEAR(gen->closure);
    Py_CLEAR(gen->classobj);
    __Pyx_Coroutine_Undelegate(gen);
    __Pyx_Coroutine_ExceptionClear(&gen->gi_exc_state);
#ifdef __Pyx_AsyncGen_USED
    if (__Pyx_AsyncGen_CheckExact(self)) {
        Py_CLEAR(((__pyx_PyAsyncGenObject*)gen)->ag_finalizer);
    }
#endif
    Py_CLEAR(gen->gi_code);
    Py_CLEAR(gen->gi_frame);
    Py_CLEAR(gen->gi_name);
    Py_CLEAR(gen->gi_qualname);
    Py_CLEAR(gen->gi_modulename);
    return 0;
}
static void __Pyx_Coroutine_dealloc(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    PyObject_GC_UnTrack(gen);
    #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
    if (gen->gi_weakreflist != NULL)
    #endif
        PyObject_ClearWeakRefs(self);
    if (gen->resume_label >= 0) {
        PyObject_GC_Track(self);
#if CYTHON_USE_TP_FINALIZE
        if (unlikely(PyObject_CallFinalizerFromDealloc(self)))
#else
        {
            destructor del = __Pyx_PyObject_GetSlot(gen, tp_del, destructor);
            if (del) del(self);
        }
        if (unlikely(Py_REFCNT(self) > 0))
#endif
        {
            return;
        }
        PyObject_GC_UnTrack(self);
    }
#ifdef __Pyx_AsyncGen_USED
    if (__Pyx_AsyncGen_CheckExact(self)) {
        /* We have to handle this case for asynchronous generators
           right here, because this code has to be between UNTRACK
           and GC_Del. */
        Py_CLEAR(((__pyx_PyAsyncGenObject*)self)->ag_finalizer);
    }
#endif
    __Pyx_Coroutine_clear(self);
    __Pyx_PyHeapTypeObject_GC_Del(gen);
}
#if CYTHON_USE_TP_FINALIZE
static void __Pyx_Coroutine_del(PyObject *self) {
    PyObject *error_type, *error_value, *error_traceback;
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    __Pyx_PyThreadState_declare
    if (gen->resume_label < 0) {
        return;
    }
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&error_type, &error_value, &error_traceback);
#ifdef __Pyx_AsyncGen_USED
    if (__Pyx_AsyncGen_CheckExact(self)) {
        __pyx_PyAsyncGenObject *agen = (__pyx_PyAsyncGenObject*)self;
        PyObject *finalizer = agen->ag_finalizer;
        if (finalizer && !agen->ag_closed) {
            PyObject *res = __Pyx_PyObject_CallOneArg(finalizer, self);
            if (unlikely(!res)) {
                PyErr_WriteUnraisable(self);
            } else {
                Py_DECREF(res);
            }
            __Pyx_ErrRestore(error_type, error_value, error_traceback);
            return;
        }
    }
#endif
    if (unlikely(gen->resume_label == 0 && !error_value)) {
#ifdef __Pyx_Coroutine_USED
#ifdef __Pyx_Generator_USED
    if (!__Pyx_Generator_CheckExact(self))
#endif
        {
        PyObject_GC_UnTrack(self);
        if (unlikely(PyErr_WarnFormat(PyExc_RuntimeWarning, 1, "coroutine '%.50S' was never awaited", gen->gi_qualname) < 0))
            PyErr_WriteUnraisable(self);
        PyObject_GC_Track(self);
        }
#endif
    } else {
        PyObject *retval = NULL;
        __Pyx_PySendResult result = __Pyx_Coroutine_Close(self, &retval);
        if (result == PYGEN_ERROR) {
            PyErr_WriteUnraisable(self);
        } else {
            Py_XDECREF(retval);
        }
    }
    __Pyx_ErrRestore(error_type, error_value, error_traceback);
}
#endif
static PyObject *
__Pyx_Coroutine_get_name(__pyx_CoroutineObject *self, void *context)
{
    PyObject *name = self->gi_name;
    CYTHON_UNUSED_VAR(context);
    if (unlikely(!name)) name = Py_None;
    Py_INCREF(name);
    return name;
}
static int
__Pyx_Coroutine_set_name(__pyx_CoroutineObject *self, PyObject *value, void *context)
{
    CYTHON_UNUSED_VAR(context);
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
                        "__name__ must be set to a string object");
        return -1;
    }
    Py_INCREF(value);
    __Pyx_Py_XDECREF_SET(self->gi_name, value);
    return 0;
}
static PyObject *
__Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self, void *context)
{
    PyObject *name = self->gi_qualname;
    CYTHON_UNUSED_VAR(context);
    if (unlikely(!name)) name = Py_None;
    Py_INCREF(name);
    return name;
}
static int
__Pyx_Coroutine_set_qualname(__pyx_CoroutineObject *self, PyObject *value, void *context)
{
    CYTHON_UNUSED_VAR(context);
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
                        "__qualname__ must be set to a string object");
        return -1;
    }
    Py_INCREF(value);
    __Pyx_Py_XDECREF_SET(self->gi_qualname, value);
    return 0;
}
static PyObject *
__Pyx__Coroutine_get_frame(__pyx_CoroutineObject *self)
{
#if !CYTHON_COMPILING_IN_LIMITED_API
    PyObject *frame;
    #if PY_VERSION_HEX >= 0x030d0000
    Py_BEGIN_CRITICAL_SECTION(self);
    #endif
    frame = self->gi_frame;
    if (!frame) {
        if (unlikely(!self->gi_code)) {
            Py_RETURN_NONE;
        }
        PyObject *globals = PyDict_New();
        if (unlikely(!globals)) return NULL;
        frame = (PyObject *) PyFrame_New(
            PyThreadState_Get(),            /*PyThreadState *tstate,*/
            (PyCodeObject*) self->gi_code,  /*PyCodeObject *code,*/
            globals,                        /*PyObject *globals,*/
            0                               /*PyObject *locals*/
        );
        Py_DECREF(globals);
        if (unlikely(!frame))
            return NULL;
        if (unlikely(self->gi_frame)) {
            Py_DECREF(frame);
            frame = self->gi_frame;
        } else {
            self->gi_frame = frame;
        }
    }
    Py_INCREF(frame);
    #if PY_VERSION_HEX >= 0x030d0000
    Py_END_CRITICAL_SECTION();
    #endif
    return frame;
#else
    CYTHON_UNUSED_VAR(self);
    Py_RETURN_NONE;
#endif
}
static PyObject *
__Pyx_Coroutine_get_frame(__pyx_CoroutineObject *self, void *context) {
    CYTHON_UNUSED_VAR(context);
    PyObject *frame = self->gi_frame;
    if (frame)
        return __Pyx_NewRef(frame);
    return __Pyx__Coroutine_get_frame(self);
}
static __pyx_CoroutineObject *__Pyx__Coroutine_New(
            PyTypeObject* type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
            PyObject *name, PyObject *qualname, PyObject *module_name) {
    __pyx_CoroutineObject *gen = PyObject_GC_New(__pyx_CoroutineObject, type);
    if (unlikely(!gen))
        return NULL;
    return __Pyx__Coroutine_NewInit(gen, body, code, closure, name, qualname, module_name);
}
static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
            __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
            PyObject *name, PyObject *qualname, PyObject *module_name) {
    gen->body = body;
    gen->closure = closure;
    Py_XINCREF(closure);
    gen->is_running = 0;
    gen->resume_label = 0;
    gen->classobj = NULL;
    gen->yieldfrom = NULL;
    gen->yieldfrom_am_send = NULL;
    #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_LIMITED_API
    gen->gi_exc_state.exc_value = NULL;
    #else
    gen->gi_exc_state.exc_type = NULL;
    gen->gi_exc_state.exc_value = NULL;
    gen->gi_exc_state.exc_traceback = NULL;
    #endif
#if CYTHON_USE_EXC_INFO_STACK
    gen->gi_exc_state.previous_item = NULL;
#endif
#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
    gen->gi_weakreflist = NULL;
#endif
    Py_XINCREF(qualname);
    gen->gi_qualname = qualname;
    Py_XINCREF(name);
    gen->gi_name = name;
    Py_XINCREF(module_name);
    gen->gi_modulename = module_name;
    Py_XINCREF(code);
    gen->gi_code = code;
    gen->gi_frame = NULL;
    PyObject_GC_Track(gen);
    return gen;
}
static char __Pyx_Coroutine_test_and_set_is_running(__pyx_CoroutineObject *gen) {
    char result;
    #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
    Py_BEGIN_CRITICAL_SECTION(gen);
    #endif
    result = gen->is_running;
    gen->is_running = 1;
    #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
    Py_END_CRITICAL_SECTION();
    #endif
    return result;
}
static void __Pyx_Coroutine_unset_is_running(__pyx_CoroutineObject *gen) {
    #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
    Py_BEGIN_CRITICAL_SECTION(gen);
    #endif
    assert(gen->is_running);
    gen->is_running = 0;
    #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
    Py_END_CRITICAL_SECTION();
    #endif
}
static char __Pyx_Coroutine_get_is_running(__pyx_CoroutineObject *gen) {
    char result;
    #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
    Py_BEGIN_CRITICAL_SECTION(gen);
    #endif
    result = gen->is_running;
    #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
    Py_END_CRITICAL_SECTION();
    #endif
    return result;
}
static PyObject *__Pyx_Coroutine_get_is_running_getter(PyObject *gen, void *closure) {
    CYTHON_UNUSED_VAR(closure);
    char result = __Pyx_Coroutine_get_is_running((__pyx_CoroutineObject*)gen);
    if (result) Py_RETURN_TRUE;
    else Py_RETURN_FALSE;
}
#if __PYX_HAS_PY_AM_SEND == 2
static void __Pyx_SetBackportTypeAmSend(PyTypeObject *type, __Pyx_PyAsyncMethodsStruct *static_amsend_methods, __Pyx_pyiter_sendfunc am_send) {
    Py_ssize_t ptr_offset = (char*)(type->tp_as_async) - (char*)type;
    if (ptr_offset < 0 || ptr_offset > type->tp_basicsize) {
        return;
    }
    memcpy((void*)static_amsend_methods, (void*)(type->tp_as_async), sizeof(*type->tp_as_async));
    static_amsend_methods->am_send = am_send;
    type->tp_as_async = __Pyx_SlotTpAsAsync(static_amsend_methods);
}
#endif
static PyObject *__Pyx_Coroutine_fail_reduce_ex(PyObject *self, PyObject *arg) {
    CYTHON_UNUSED_VAR(arg);
    __Pyx_TypeName self_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE((PyObject*)self));
    PyErr_Format(PyExc_TypeError, "cannot pickle '" __Pyx_FMT_TYPENAME "' object",
                         self_type_name);
    __Pyx_DECREF_TypeName(self_type_name);
    return NULL;
}

/* Generator (used by GeneratorYieldFrom) */
static PyMethodDef __pyx_Generator_methods[] = {
    {"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O,
     PyDoc_STR("send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration.")},
    {"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS,
     PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in generator,\nreturn next yielded value or raise StopIteration.")},
    {"close", (PyCFunction) __Pyx_Coroutine_Close_Method, METH_NOARGS,
     PyDoc_STR("close() -> raise GeneratorExit inside generator.")},
    {"__reduce_ex__", (PyCFunction) __Pyx_Coroutine_fail_reduce_ex, METH_O, 0},
    {"__reduce__", (PyCFunction) __Pyx_Coroutine_fail_reduce_ex, METH_NOARGS, 0},
    {0, 0, 0, 0}
};
static PyMemberDef __pyx_Generator_memberlist[] = {
    {"gi_yieldfrom", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY,
     PyDoc_STR("object being iterated by 'yield from', or None")},
    {"gi_code", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_code), READONLY, NULL},
    {"__module__", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_modulename), 0, 0},
#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
    {"__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CoroutineObject, gi_weakreflist), READONLY, 0},
#endif
    {0, 0, 0, 0, 0}
};
static PyGetSetDef __pyx_Generator_getsets[] = {
    {"__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name,
     PyDoc_STR("name of the generator"), 0},
    {"__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname,
     PyDoc_STR("qualified name of the generator"), 0},
    {"gi_frame", (getter)__Pyx_Coroutine_get_frame, NULL,
     PyDoc_STR("Frame of the generator"), 0},
    {"gi_running", __Pyx_Coroutine_get_is_running_getter, NULL, NULL, NULL},
    {0, 0, 0, 0, 0}
};
static PyType_Slot __pyx_GeneratorType_slots[] = {
    {Py_tp_dealloc, (void *)__Pyx_Coroutine_dealloc},
    {Py_tp_traverse, (void *)__Pyx_Coroutine_traverse},
    {Py_tp_iter, (void *)PyObject_SelfIter},
    {Py_tp_iternext, (void *)__Pyx_Generator_Next},
    {Py_tp_methods, (void *)__pyx_Generator_methods},
    {Py_tp_members, (void *)__pyx_Generator_memberlist},
    {Py_tp_getset, (void *)__pyx_Generator_getsets},
    {Py_tp_getattro, (void *) PyObject_GenericGetAttr},
#if CYTHON_USE_TP_FINALIZE
    {Py_tp_finalize, (void *)__Pyx_Coroutine_del},
#endif
#if __PYX_HAS_PY_AM_SEND == 1
    {Py_am_send, (void *)__Pyx_Coroutine_AmSend},
#endif
    {0, 0},
};
static PyType_Spec __pyx_GeneratorType_spec = {
    __PYX_TYPE_MODULE_PREFIX "generator",
    sizeof(__pyx_CoroutineObject),
    0,
#if PY_VERSION_HEX >= 0x030C0000 && !CYTHON_COMPILING_IN_LIMITED_API
    Py_TPFLAGS_MANAGED_WEAKREF |
#endif
    Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_DISALLOW_INSTANTIATION |
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | __Pyx_TPFLAGS_HAVE_AM_SEND,
    __pyx_GeneratorType_slots
};
#if __PYX_HAS_PY_AM_SEND == 2
static __Pyx_PyAsyncMethodsStruct __pyx_Generator_as_async;
#endif
static int __pyx_Generator_init(PyObject *module) {
    __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module);
    mstate->__pyx_GeneratorType = __Pyx_FetchCommonTypeFromSpec(
        mstate->__pyx_CommonTypesMetaclassType, module, &__pyx_GeneratorType_spec, NULL);
    if (unlikely(!mstate->__pyx_GeneratorType)) {
        return -1;
    }
#if __PYX_HAS_PY_AM_SEND == 2
    __Pyx_SetBackportTypeAmSend(mstate->__pyx_GeneratorType, &__pyx_Generator_as_async, &__Pyx_Coroutine_AmSend);
#endif
    return 0;
}
static PyObject *__Pyx_Generator_GetInlinedResult(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
    PyObject *retval = NULL;
    if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) {
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    }
    __Pyx_PySendResult result = __Pyx_Coroutine_SendEx(gen, Py_None, &retval, 0);
    __Pyx_Coroutine_unset_is_running(gen);
    (void) result;
    assert (result == PYGEN_RETURN || result == PYGEN_ERROR);
    assert ((result == PYGEN_RETURN && retval != NULL) || (result == PYGEN_ERROR && retval == NULL));
    return retval;
}

/* GeneratorYieldFrom */
#if CYTHON_USE_TYPE_SLOTS
static void __Pyx_PyIter_CheckErrorAndDecref(PyObject *source) {
    __Pyx_TypeName source_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(source));
    PyErr_Format(PyExc_TypeError,
        "iter() returned non-iterator of type '" __Pyx_FMT_TYPENAME "'", source_type_name);
    __Pyx_DECREF_TypeName(source_type_name);
    Py_DECREF(source);
}
#endif
static CYTHON_INLINE __Pyx_PySendResult __Pyx_Generator_Yield_From(__pyx_CoroutineObject *gen, PyObject *source, PyObject **retval) {
    PyObject *source_gen;
    __Pyx_PySendResult result;
#ifdef __Pyx_Coroutine_USED
    if (__Pyx_Coroutine_Check(source)) {
        Py_INCREF(source);
        source_gen = source;
        result = __Pyx_Coroutine_AmSend(source, Py_None, retval);
    } else
#endif
    {
#if CYTHON_USE_TYPE_SLOTS
        if (likely(Py_TYPE(source)->tp_iter)) {
            source_gen = Py_TYPE(source)->tp_iter(source);
            if (unlikely(!source_gen)) {
                *retval = NULL;
                return PYGEN_ERROR;
            }
            if (unlikely(!PyIter_Check(source_gen))) {
                __Pyx_PyIter_CheckErrorAndDecref(source_gen);
                *retval = NULL;
                return PYGEN_ERROR;
            }
        } else
#endif
        {
            source_gen = PyObject_GetIter(source);
            if (unlikely(!source_gen)) {
                *retval = NULL;
                return PYGEN_ERROR;
            }
        }
        *retval = __Pyx_PyIter_Next_Plain(source_gen);
        result = __Pyx_Coroutine_status_from_result(retval);
    }
    if (likely(result == PYGEN_NEXT)) {
        __Pyx_Coroutine_Set_Owned_Yield_From(gen, source_gen);
        return PYGEN_NEXT;
    }
    Py_DECREF(source_gen);
    return result;
}

/* append */
static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
    if (likely(PyList_CheckExact(L))) {
        if (unlikely(__Pyx_PyList_Append(L, x) < 0)) return -1;
    } else {
        PyObject* retval = __Pyx_PyObject_CallMethod1(L, __pyx_mstate_global->__pyx_n_u_append, x);
        if (unlikely(!retval))
            return -1;
        Py_DECREF(retval);
    }
    return 0;
}

/* PySet_Update */
static CYTHON_INLINE int __Pyx_PySet_Update(PyObject* set, PyObject* it) {
    PyObject *retval;
    #if CYTHON_USE_TYPE_SLOTS && !CYTHON_COMPILING_IN_PYPY
    if (PyAnySet_Check(it)) {
        Py_ssize_t size = __Pyx_PySet_GET_SIZE(it);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely(size < 0)) return -1;
        #endif
        if (size == 0)
            return 0;
        retval = PySet_Type.tp_as_number->nb_inplace_or(set, it);
        if (likely(retval == set)) {
            Py_DECREF(retval);
            return 0;
        }
        if (unlikely(!retval))
            return -1;
        Py_DECREF(retval);
    }
    #endif
    retval = __Pyx_CallUnboundCMethod1(&__pyx_mstate_global->__pyx_umethod_PySet_Type_update, set, it);
    if (unlikely(!retval)) return -1;
    Py_DECREF(retval);
    return 0;
}

/* PyMethodNew (used by CythonFunctionShared) */
#if CYTHON_COMPILING_IN_LIMITED_API
static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) {
    PyObject *result;
    CYTHON_UNUSED_VAR(typ);
    if (!self)
        return __Pyx_NewRef(func);
    #if __PYX_LIMITED_VERSION_HEX >= 0x030C0000
    {
        PyObject *args[] = {func, self};
        result = PyObject_Vectorcall(__pyx_mstate_global->__Pyx_CachedMethodType, args, 2, NULL);
    }
    #else
    result = PyObject_CallFunctionObjArgs(__pyx_mstate_global->__Pyx_CachedMethodType, func, self, NULL);
    #endif
    return result;
}
#else
static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) {
    CYTHON_UNUSED_VAR(typ);
    if (!self)
        return __Pyx_NewRef(func);
    return PyMethod_New(func, self);
}
#endif

/* PyVectorcallFastCallDict (used by CythonFunctionShared) */
#if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL
static PyObject *__Pyx_PyVectorcall_FastCallDict_kw(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw)
{
    PyObject *res = NULL;
    PyObject *kwnames;
    PyObject **newargs;
    PyObject **kwvalues;
    Py_ssize_t i;
    #if CYTHON_AVOID_BORROWED_REFS
    PyObject *pos;
    #else
    Py_ssize_t pos;
    #endif
    size_t j;
    PyObject *key, *value;
    unsigned long keys_are_strings;
    #if !CYTHON_ASSUME_SAFE_SIZE
    Py_ssize_t nkw = PyDict_Size(kw);
    if (unlikely(nkw == -1)) return NULL;
    #else
    Py_ssize_t nkw = PyDict_GET_SIZE(kw);
    #endif
    newargs = (PyObject **)PyMem_Malloc((nargs + (size_t)nkw) * sizeof(args[0]));
    if (unlikely(newargs == NULL)) {
        PyErr_NoMemory();
        return NULL;
    }
    for (j = 0; j < nargs; j++) newargs[j] = args[j];
    kwnames = PyTuple_New(nkw);
    if (unlikely(kwnames == NULL)) {
        PyMem_Free(newargs);
        return NULL;
    }
    kwvalues = newargs + nargs;
    pos = 0;
    i = 0;
    keys_are_strings = Py_TPFLAGS_UNICODE_SUBCLASS;
    while (__Pyx_PyDict_NextRef(kw, &pos, &key, &value)) {
        keys_are_strings &=
        #if CYTHON_COMPILING_IN_LIMITED_API
            PyType_GetFlags(Py_TYPE(key));
        #else
            Py_TYPE(key)->tp_flags;
        #endif
        #if !CYTHON_ASSUME_SAFE_MACROS
        if (unlikely(PyTuple_SetItem(kwnames, i, key) < 0)) goto cleanup;
        #else
        PyTuple_SET_ITEM(kwnames, i, key);
        #endif
        kwvalues[i] = value;
        i++;
    }
    if (unlikely(!keys_are_strings)) {
        PyErr_SetString(PyExc_TypeError, "keywords must be strings");
        goto cleanup;
    }
    res = vc(func, newargs, nargs, kwnames);
cleanup:
    #if CYTHON_AVOID_BORROWED_REFS
    Py_DECREF(pos);
    #endif
    Py_DECREF(kwnames);
    for (i = 0; i < nkw; i++)
        Py_DECREF(kwvalues[i]);
    PyMem_Free(newargs);
    return res;
}
static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw)
{
    Py_ssize_t kw_size =
        likely(kw == NULL) ?
        0 :
#if !CYTHON_ASSUME_SAFE_SIZE
        PyDict_Size(kw);
#else
        PyDict_GET_SIZE(kw);
#endif
    if (kw_size == 0) {
        return vc(func, args, nargs, NULL);
    }
#if !CYTHON_ASSUME_SAFE_SIZE
    else if (unlikely(kw_size == -1)) {
        return NULL;
    }
#endif
    return __Pyx_PyVectorcall_FastCallDict_kw(func, vc, args, nargs, kw);
}
#endif

/* CythonFunctionShared (used by CythonFunction) */
#if CYTHON_COMPILING_IN_LIMITED_API
static CYTHON_INLINE int __Pyx__IsSameCyOrCFunctionNoMethod(PyObject *func, void (*cfunc)(void)) {
    if (__Pyx_CyFunction_Check(func)) {
        return PyCFunction_GetFunction(((__pyx_CyFunctionObject*)func)->func) == (PyCFunction) cfunc;
    } else if (PyCFunction_Check(func)) {
        return PyCFunction_GetFunction(func) == (PyCFunction) cfunc;
    }
    return 0;
}
static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void)) {
    if ((PyObject*)Py_TYPE(func) == __pyx_mstate_global->__Pyx_CachedMethodType) {
        int result;
        PyObject *newFunc = PyObject_GetAttr(func, __pyx_mstate_global->__pyx_n_u_func);
        if (unlikely(!newFunc)) {
            PyErr_Clear(); // It's only an optimization, so don't throw an error
            return 0;
        }
        result = __Pyx__IsSameCyOrCFunctionNoMethod(newFunc, cfunc);
        Py_DECREF(newFunc);
        return result;
    }
    return __Pyx__IsSameCyOrCFunctionNoMethod(func, cfunc);
}
#else
static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void)) {
    if (PyMethod_Check(func)) {
        func = PyMethod_GET_FUNCTION(func);
    }
    return __Pyx_CyOrPyCFunction_Check(func) && __Pyx_CyOrPyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc;
}
#endif
static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj) {
#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
    __Pyx_Py_XDECREF_SET(
        __Pyx_CyFunction_GetClassObj(f),
            ((classobj) ? __Pyx_NewRef(classobj) : NULL));
#else
    __Pyx_Py_XDECREF_SET(
        ((PyCMethodObject *) (f))->mm_class,
        (PyTypeObject*)((classobj) ? __Pyx_NewRef(classobj) : NULL));
#endif
}
static PyObject *
__Pyx_CyFunction_get_doc_locked(__pyx_CyFunctionObject *op)
{
    if (unlikely(op->func_doc == NULL)) {
#if CYTHON_COMPILING_IN_LIMITED_API
        op->func_doc = PyObject_GetAttrString(op->func, "__doc__");
        if (unlikely(!op->func_doc)) return NULL;
#else
        if (((PyCFunctionObject*)op)->m_ml->ml_doc) {
            op->func_doc = PyUnicode_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc);
            if (unlikely(op->func_doc == NULL))
                return NULL;
        } else {
            Py_INCREF(Py_None);
            return Py_None;
        }
#endif
    }
    Py_INCREF(op->func_doc);
    return op->func_doc;
}
static PyObject *
__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, void *closure) {
    PyObject *result;
    CYTHON_UNUSED_VAR(closure);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    result = __Pyx_CyFunction_get_doc_locked(op);
    __Pyx_END_CRITICAL_SECTION();
    return result;
}
static int
__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, void *context)
{
    CYTHON_UNUSED_VAR(context);
    if (value == NULL) {
        value = Py_None;
    }
    Py_INCREF(value);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    __Pyx_Py_XDECREF_SET(op->func_doc, value);
    __Pyx_END_CRITICAL_SECTION();
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_name_locked(__pyx_CyFunctionObject *op)
{
    if (unlikely(op->func_name == NULL)) {
#if CYTHON_COMPILING_IN_LIMITED_API
        op->func_name = PyObject_GetAttrString(op->func, "__name__");
#else
        op->func_name = PyUnicode_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name);
#endif
        if (unlikely(op->func_name == NULL))
            return NULL;
    }
    Py_INCREF(op->func_name);
    return op->func_name;
}
static PyObject *
__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, void *context)
{
    PyObject *result = NULL;
    CYTHON_UNUSED_VAR(context);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    result = __Pyx_CyFunction_get_name_locked(op);
    __Pyx_END_CRITICAL_SECTION();
    return result;
}
static int
__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, void *context)
{
    CYTHON_UNUSED_VAR(context);
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
                        "__name__ must be set to a string object");
        return -1;
    }
    Py_INCREF(value);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    __Pyx_Py_XDECREF_SET(op->func_name, value);
    __Pyx_END_CRITICAL_SECTION();
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, void *context)
{
    CYTHON_UNUSED_VAR(context);
    PyObject *result;
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    Py_INCREF(op->func_qualname);
    result = op->func_qualname;
    __Pyx_END_CRITICAL_SECTION();
    return result;
}
static int
__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, void *context)
{
    CYTHON_UNUSED_VAR(context);
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
                        "__qualname__ must be set to a string object");
        return -1;
    }
    Py_INCREF(value);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    __Pyx_Py_XDECREF_SET(op->func_qualname, value);
    __Pyx_END_CRITICAL_SECTION();
    return 0;
}
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
static PyObject *
__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, void *context)
{
    CYTHON_UNUSED_VAR(context);
    if (unlikely(op->func_dict == NULL)) {
        op->func_dict = PyDict_New();
        if (unlikely(op->func_dict == NULL))
            return NULL;
    }
    Py_INCREF(op->func_dict);
    return op->func_dict;
}
#endif
static PyObject *
__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, void *context)
{
    CYTHON_UNUSED_VAR(context);
    Py_INCREF(op->func_globals);
    return op->func_globals;
}
static PyObject *
__Pyx_CyFunction_get_closure(__pyx_CyFunctionObject *op, void *context)
{
    CYTHON_UNUSED_VAR(op);
    CYTHON_UNUSED_VAR(context);
    Py_INCREF(Py_None);
    return Py_None;
}
static PyObject *
__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, void *context)
{
    PyObject* result = (op->func_code) ? op->func_code : Py_None;
    CYTHON_UNUSED_VAR(context);
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
    int result = 0;
    PyObject *res = op->defaults_getter((PyObject *) op);
    if (unlikely(!res))
        return -1;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
    Py_INCREF(op->defaults_tuple);
    op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
    Py_INCREF(op->defaults_kwdict);
    #else
    op->defaults_tuple = __Pyx_PySequence_ITEM(res, 0);
    if (unlikely(!op->defaults_tuple)) result = -1;
    else {
        op->defaults_kwdict = __Pyx_PySequence_ITEM(res, 1);
        if (unlikely(!op->defaults_kwdict)) result = -1;
    }
    #endif
    Py_DECREF(res);
    return result;
}
static int
__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
    CYTHON_UNUSED_VAR(context);
    if (!value) {
        value = Py_None;
    } else if (unlikely(value != Py_None && !PyTuple_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
                        "__defaults__ must be set to a tuple object");
        return -1;
    }
    PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__defaults__ will not "
                 "currently affect the values used in function calls", 1);
    Py_INCREF(value);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    __Pyx_Py_XDECREF_SET(op->defaults_tuple, value);
    __Pyx_END_CRITICAL_SECTION();
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_defaults_locked(__pyx_CyFunctionObject *op) {
    PyObject* result = op->defaults_tuple;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL;
            result = op->defaults_tuple;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static PyObject *
__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, void *context) {
    PyObject* result = NULL;
    CYTHON_UNUSED_VAR(context);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    result = __Pyx_CyFunction_get_defaults_locked(op);
    __Pyx_END_CRITICAL_SECTION();
    return result;
}
static int
__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
    CYTHON_UNUSED_VAR(context);
    if (!value) {
        value = Py_None;
    } else if (unlikely(value != Py_None && !PyDict_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
                        "__kwdefaults__ must be set to a dict object");
        return -1;
    }
    PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__kwdefaults__ will not "
                 "currently affect the values used in function calls", 1);
    Py_INCREF(value);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    __Pyx_Py_XDECREF_SET(op->defaults_kwdict, value);
    __Pyx_END_CRITICAL_SECTION();
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_kwdefaults_locked(__pyx_CyFunctionObject *op) {
    PyObject* result = op->defaults_kwdict;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL;
            result = op->defaults_kwdict;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static PyObject *
__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, void *context) {
    PyObject* result;
    CYTHON_UNUSED_VAR(context);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    result = __Pyx_CyFunction_get_kwdefaults_locked(op);
    __Pyx_END_CRITICAL_SECTION();
    return result;
}
static int
__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
    CYTHON_UNUSED_VAR(context);
    if (!value || value == Py_None) {
        value = NULL;
    } else if (unlikely(!PyDict_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
                        "__annotations__ must be set to a dict object");
        return -1;
    }
    Py_XINCREF(value);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    __Pyx_Py_XDECREF_SET(op->func_annotations, value);
    __Pyx_END_CRITICAL_SECTION();
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_annotations_locked(__pyx_CyFunctionObject *op) {
    PyObject* result = op->func_annotations;
    if (unlikely(!result)) {
        result = PyDict_New();
        if (unlikely(!result)) return NULL;
        op->func_annotations = result;
    }
    Py_INCREF(result);
    return result;
}
static PyObject *
__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, void *context) {
    PyObject *result;
    CYTHON_UNUSED_VAR(context);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    result = __Pyx_CyFunction_get_annotations_locked(op);
    __Pyx_END_CRITICAL_SECTION();
    return result;
}
static PyObject *
__Pyx_CyFunction_get_is_coroutine_value(__pyx_CyFunctionObject *op) {
    int is_coroutine = op->flags & __Pyx_CYFUNCTION_COROUTINE;
    if (is_coroutine) {
        PyObject *is_coroutine_value, *module, *fromlist, *marker = __pyx_mstate_global->__pyx_n_u_is_coroutine;
        fromlist = PyList_New(1);
        if (unlikely(!fromlist)) return NULL;
        Py_INCREF(marker);
#if CYTHON_ASSUME_SAFE_MACROS
        PyList_SET_ITEM(fromlist, 0, marker);
#else
        if (unlikely(PyList_SetItem(fromlist, 0, marker) < 0)) {
            Py_DECREF(marker);
            Py_DECREF(fromlist);
            return NULL;
        }
#endif
        module = PyImport_ImportModuleLevelObject(__pyx_mstate_global->__pyx_n_u_asyncio_coroutines, NULL, NULL, fromlist, 0);
        Py_DECREF(fromlist);
        if (unlikely(!module)) goto ignore;
        is_coroutine_value = __Pyx_PyObject_GetAttrStr(module, marker);
        Py_DECREF(module);
        if (likely(is_coroutine_value)) {
            return is_coroutine_value;
        }
ignore:
        PyErr_Clear();
    }
    return __Pyx_PyBool_FromLong(is_coroutine);
}
static PyObject *
__Pyx_CyFunction_get_is_coroutine(__pyx_CyFunctionObject *op, void *context) {
    PyObject *result;
    CYTHON_UNUSED_VAR(context);
    if (op->func_is_coroutine) {
        return __Pyx_NewRef(op->func_is_coroutine);
    }
    result = __Pyx_CyFunction_get_is_coroutine_value(op);
    if (unlikely(!result))
        return NULL;
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    if (op->func_is_coroutine) {
        Py_DECREF(result);
        result = __Pyx_NewRef(op->func_is_coroutine);
    } else {
        op->func_is_coroutine = __Pyx_NewRef(result);
    }
    __Pyx_END_CRITICAL_SECTION();
    return result;
}
static void __Pyx_CyFunction_raise_argument_count_error(__pyx_CyFunctionObject *func, const char* message, Py_ssize_t size) {
#if CYTHON_COMPILING_IN_LIMITED_API
    PyObject *py_name = __Pyx_CyFunction_get_name(func, NULL);
    if (!py_name) return;
    PyErr_Format(PyExc_TypeError,
        "%.200S() %s (%" CYTHON_FORMAT_SSIZE_T "d given)",
        py_name, message, size);
    Py_DECREF(py_name);
#else
    const char* name = ((PyCFunctionObject*)func)->m_ml->ml_name;
    PyErr_Format(PyExc_TypeError,
        "%.200s() %s (%" CYTHON_FORMAT_SSIZE_T "d given)",
        name, message, size);
#endif
}
static void __Pyx_CyFunction_raise_type_error(__pyx_CyFunctionObject *func, const char* message) {
#if CYTHON_COMPILING_IN_LIMITED_API
    PyObject *py_name = __Pyx_CyFunction_get_name(func, NULL);
    if (!py_name) return;
    PyErr_Format(PyExc_TypeError,
        "%.200S() %s",
        py_name, message);
    Py_DECREF(py_name);
#else
    const char* name = ((PyCFunctionObject*)func)->m_ml->ml_name;
    PyErr_Format(PyExc_TypeError,
        "%.200s() %s",
        name, message);
#endif
}
#if CYTHON_COMPILING_IN_LIMITED_API
static PyObject *
__Pyx_CyFunction_get_module(__pyx_CyFunctionObject *op, void *context) {
    CYTHON_UNUSED_VAR(context);
    return PyObject_GetAttrString(op->func, "__module__");
}
static int
__Pyx_CyFunction_set_module(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
    CYTHON_UNUSED_VAR(context);
    return PyObject_SetAttrString(op->func, "__module__", value);
}
#endif
static PyGetSetDef __pyx_CyFunction_getsets[] = {
    {"func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {"__doc__",  (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {"func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {"__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {"__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
    {"func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)PyObject_GenericSetDict, 0, 0},
    {"__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)PyObject_GenericSetDict, 0, 0},
#else
    {"func_dict", (getter)PyObject_GenericGetDict, (setter)PyObject_GenericSetDict, 0, 0},
    {"__dict__", (getter)PyObject_GenericGetDict, (setter)PyObject_GenericSetDict, 0, 0},
#endif
    {"func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {"__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {"func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {"__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {"func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {"__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {"func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {"__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {"__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
    {"__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
    {"_is_coroutine", (getter)__Pyx_CyFunction_get_is_coroutine, 0, 0, 0},
#if CYTHON_COMPILING_IN_LIMITED_API
    {"__module__", (getter)__Pyx_CyFunction_get_module, (setter)__Pyx_CyFunction_set_module, 0, 0},
#endif
    {0, 0, 0, 0, 0}
};
static PyMemberDef __pyx_CyFunction_members[] = {
#if !CYTHON_COMPILING_IN_LIMITED_API
    {"__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), 0, 0},
#endif
#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
    {"__dictoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_dict), READONLY, 0},
#endif
#if CYTHON_METH_FASTCALL
#if CYTHON_COMPILING_IN_LIMITED_API
    {"__vectorcalloffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_vectorcall), READONLY, 0},
#else
    {"__vectorcalloffset__", T_PYSSIZET, offsetof(PyCFunctionObject, vectorcall), READONLY, 0},
#endif
#if CYTHON_COMPILING_IN_LIMITED_API
    {"__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_weakreflist), READONLY, 0},
#else
    {"__weaklistoffset__", T_PYSSIZET, offsetof(PyCFunctionObject, m_weakreflist), READONLY, 0},
#endif
#endif
    {0, 0, 0,  0, 0}
};
static PyObject *
__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, PyObject *args)
{
    PyObject *result = NULL;
    CYTHON_UNUSED_VAR(args);
    __Pyx_BEGIN_CRITICAL_SECTION(m);
    Py_INCREF(m->func_qualname);
    result = m->func_qualname;
    __Pyx_END_CRITICAL_SECTION();
    return result;
}
static PyMethodDef __pyx_CyFunction_methods[] = {
    {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
    {0, 0, 0, 0}
};
#if CYTHON_COMPILING_IN_LIMITED_API
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
#else
#define __Pyx_CyFunction_weakreflist(cyfunc) (((PyCFunctionObject*)cyfunc)->m_weakreflist)
#endif
static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname,
                                       PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
#if !CYTHON_COMPILING_IN_LIMITED_API
    PyCFunctionObject *cf = (PyCFunctionObject*) op;
#endif
    if (unlikely(op == NULL))
        return NULL;
#if CYTHON_COMPILING_IN_LIMITED_API
    op->func = PyCFunction_NewEx(ml, (PyObject*)op, module);
    if (unlikely(!op->func)) return NULL;
#endif
    op->flags = flags;
    __Pyx_CyFunction_weakreflist(op) = NULL;
#if !CYTHON_COMPILING_IN_LIMITED_API
    cf->m_ml = ml;
    cf->m_self = (PyObject *) op;
#endif
    Py_XINCREF(closure);
    op->func_closure = closure;
#if !CYTHON_COMPILING_IN_LIMITED_API
    Py_XINCREF(module);
    cf->m_module = module;
#endif
#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
    op->func_dict = NULL;
#endif
    op->func_name = NULL;
    Py_INCREF(qualname);
    op->func_qualname = qualname;
    op->func_doc = NULL;
#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
    op->func_classobj = NULL;
#else
    ((PyCMethodObject*)op)->mm_class = NULL;
#endif
    op->func_globals = globals;
    Py_INCREF(op->func_globals);
    Py_XINCREF(code);
    op->func_code = code;
    op->defaults = NULL;
    op->defaults_tuple = NULL;
    op->defaults_kwdict = NULL;
    op->defaults_getter = NULL;
    op->func_annotations = NULL;
    op->func_is_coroutine = NULL;
#if CYTHON_METH_FASTCALL
    switch (ml->ml_flags & (METH_VARARGS | METH_FASTCALL | METH_NOARGS | METH_O | METH_KEYWORDS | METH_METHOD)) {
    case METH_NOARGS:
        __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_NOARGS;
        break;
    case METH_O:
        __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_O;
        break;
    case METH_METHOD | METH_FASTCALL | METH_KEYWORDS:
        __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD;
        break;
    case METH_FASTCALL | METH_KEYWORDS:
        __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS;
        break;
    case METH_VARARGS | METH_KEYWORDS:
        __Pyx_CyFunction_func_vectorcall(op) = NULL;
        break;
    default:
        PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction");
        Py_DECREF(op);
        return NULL;
    }
#endif
    return (PyObject *) op;
}
static int
__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
{
    Py_CLEAR(m->func_closure);
#if CYTHON_COMPILING_IN_LIMITED_API
    Py_CLEAR(m->func);
#else
    Py_CLEAR(((PyCFunctionObject*)m)->m_module);
#endif
#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
    Py_CLEAR(m->func_dict);
#elif PY_VERSION_HEX < 0x030d0000
    _PyObject_ClearManagedDict((PyObject*)m);
#else
    PyObject_ClearManagedDict((PyObject*)m);
#endif
    Py_CLEAR(m->func_name);
    Py_CLEAR(m->func_qualname);
    Py_CLEAR(m->func_doc);
    Py_CLEAR(m->func_globals);
    Py_CLEAR(m->func_code);
#if !CYTHON_COMPILING_IN_LIMITED_API
#if PY_VERSION_HEX < 0x030900B1
    Py_CLEAR(__Pyx_CyFunction_GetClassObj(m));
#else
    {
        PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class;
        ((PyCMethodObject *) (m))->mm_class = NULL;
        Py_XDECREF(cls);
    }
#endif
#endif
    Py_CLEAR(m->defaults_tuple);
    Py_CLEAR(m->defaults_kwdict);
    Py_CLEAR(m->func_annotations);
    Py_CLEAR(m->func_is_coroutine);
    Py_CLEAR(m->defaults);
    return 0;
}
static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
    if (__Pyx_CyFunction_weakreflist(m) != NULL)
        PyObject_ClearWeakRefs((PyObject *) m);
    __Pyx_CyFunction_clear(m);
    __Pyx_PyHeapTypeObject_GC_Del(m);
}
static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
    PyObject_GC_UnTrack(m);
    __Pyx__CyFunction_dealloc(m);
}
static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
{
    {
        int e = __Pyx_call_type_traverse((PyObject*)m, 1, visit, arg);
        if (e) return e;
    }
    Py_VISIT(m->func_closure);
#if CYTHON_COMPILING_IN_LIMITED_API
    Py_VISIT(m->func);
#else
    Py_VISIT(((PyCFunctionObject*)m)->m_module);
#endif
#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
    Py_VISIT(m->func_dict);
#else
    {
        int e =
#if PY_VERSION_HEX < 0x030d0000
            _PyObject_VisitManagedDict
#else
            PyObject_VisitManagedDict
#endif
                ((PyObject*)m, visit, arg);
        if (e != 0) return e;
    }
#endif
    __Pyx_VISIT_CONST(m->func_name);
    __Pyx_VISIT_CONST(m->func_qualname);
    Py_VISIT(m->func_doc);
    Py_VISIT(m->func_globals);
    __Pyx_VISIT_CONST(m->func_code);
#if !CYTHON_COMPILING_IN_LIMITED_API
    Py_VISIT(__Pyx_CyFunction_GetClassObj(m));
#endif
    Py_VISIT(m->defaults_tuple);
    Py_VISIT(m->defaults_kwdict);
    Py_VISIT(m->func_is_coroutine);
    Py_VISIT(m->defaults);
    return 0;
}
static PyObject*
__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
{
    PyObject *repr;
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    repr = PyUnicode_FromFormat("<cyfunction %U at %p>",
                                op->func_qualname, (void *)op);
    __Pyx_END_CRITICAL_SECTION();
    return repr;
}
static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
#if CYTHON_COMPILING_IN_LIMITED_API
    PyObject *f = ((__pyx_CyFunctionObject*)func)->func;
    PyCFunction meth;
    int flags;
    meth = PyCFunction_GetFunction(f);
    if (unlikely(!meth)) return NULL;
    flags = PyCFunction_GetFlags(f);
    if (unlikely(flags < 0)) return NULL;
#else
    PyCFunctionObject* f = (PyCFunctionObject*)func;
    PyCFunction meth = f->m_ml->ml_meth;
    int flags = f->m_ml->ml_flags;
#endif
    Py_ssize_t size;
    switch (flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
    case METH_VARARGS:
        if (likely(kw == NULL || PyDict_Size(kw) == 0))
            return (*meth)(self, arg);
        break;
    case METH_VARARGS | METH_KEYWORDS:
        return (*(PyCFunctionWithKeywords)(void(*)(void))meth)(self, arg, kw);
    case METH_NOARGS:
        if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
#if CYTHON_ASSUME_SAFE_SIZE
            size = PyTuple_GET_SIZE(arg);
#else
            size = PyTuple_Size(arg);
            if (unlikely(size < 0)) return NULL;
#endif
            if (likely(size == 0))
                return (*meth)(self, NULL);
            __Pyx_CyFunction_raise_argument_count_error(
                (__pyx_CyFunctionObject*)func,
                "takes no arguments", size);
            return NULL;
        }
        break;
    case METH_O:
        if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
#if CYTHON_ASSUME_SAFE_SIZE
            size = PyTuple_GET_SIZE(arg);
#else
            size = PyTuple_Size(arg);
            if (unlikely(size < 0)) return NULL;
#endif
            if (likely(size == 1)) {
                PyObject *result, *arg0;
                #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                arg0 = PyTuple_GET_ITEM(arg, 0);
                #else
                arg0 = __Pyx_PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL;
                #endif
                result = (*meth)(self, arg0);
                #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
                Py_DECREF(arg0);
                #endif
                return result;
            }
            __Pyx_CyFunction_raise_argument_count_error(
                (__pyx_CyFunctionObject*)func,
                "takes exactly one argument", size);
            return NULL;
        }
        break;
    default:
        PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction");
        return NULL;
    }
    __Pyx_CyFunction_raise_type_error(
        (__pyx_CyFunctionObject*)func, "takes no keyword arguments");
    return NULL;
}
static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    PyObject *self, *result;
#if CYTHON_COMPILING_IN_LIMITED_API
    self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)func)->func);
    if (unlikely(!self) && PyErr_Occurred()) return NULL;
#else
    self = ((PyCFunctionObject*)func)->m_self;
#endif
    result = __Pyx_CyFunction_CallMethod(func, self, arg, kw);
    return result;
}
static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
    PyObject *result;
    __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
#if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL
     __pyx_vectorcallfunc vc = __Pyx_CyFunction_func_vectorcall(cyfunc);
    if (vc) {
#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE
        return __Pyx_PyVectorcall_FastCallDict(func, vc, &PyTuple_GET_ITEM(args, 0), (size_t)PyTuple_GET_SIZE(args), kw);
#else
        (void) &__Pyx_PyVectorcall_FastCallDict;
        return PyVectorcall_Call(func, args, kw);
#endif
    }
#endif
    if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
        Py_ssize_t argc;
        PyObject *new_args;
        PyObject *self;
#if CYTHON_ASSUME_SAFE_SIZE
        argc = PyTuple_GET_SIZE(args);
#else
        argc = PyTuple_Size(args);
        if (unlikely(argc < 0)) return NULL;
#endif
        new_args = PyTuple_GetSlice(args, 1, argc);
        if (unlikely(!new_args))
            return NULL;
        self = PyTuple_GetItem(args, 0);
        if (unlikely(!self)) {
            Py_DECREF(new_args);
            PyErr_Format(PyExc_TypeError,
                         "unbound method %.200S() needs an argument",
                         cyfunc->func_qualname);
            return NULL;
        }
        result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
        Py_DECREF(new_args);
    } else {
        result = __Pyx_CyFunction_Call(func, args, kw);
    }
    return result;
}
#if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL
static CYTHON_INLINE int __Pyx_CyFunction_Vectorcall_CheckArgs(__pyx_CyFunctionObject *cyfunc, Py_ssize_t nargs, PyObject *kwnames)
{
    int ret = 0;
    if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
        if (unlikely(nargs < 1)) {
            __Pyx_CyFunction_raise_type_error(
                cyfunc, "needs an argument");
            return -1;
        }
        ret = 1;
    }
    if (unlikely(kwnames) && unlikely(__Pyx_PyTuple_GET_SIZE(kwnames))) {
        __Pyx_CyFunction_raise_type_error(
            cyfunc, "takes no keyword arguments");
        return -1;
    }
    return ret;
}
static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
{
    __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
    Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
    PyObject *self;
#if CYTHON_COMPILING_IN_LIMITED_API
    PyCFunction meth = PyCFunction_GetFunction(cyfunc->func);
    if (unlikely(!meth)) return NULL;
#else
    PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth;
#endif
    switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) {
    case 1:
        self = args[0];
        args += 1;
        nargs -= 1;
        break;
    case 0:
#if CYTHON_COMPILING_IN_LIMITED_API
        self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func);
        if (unlikely(!self) && PyErr_Occurred()) return NULL;
#else
        self = ((PyCFunctionObject*)cyfunc)->m_self;
#endif
        break;
    default:
        return NULL;
    }
    if (unlikely(nargs != 0)) {
        __Pyx_CyFunction_raise_argument_count_error(
            cyfunc, "takes no arguments", nargs);
        return NULL;
    }
    return meth(self, NULL);
}
static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
{
    __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
    Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
    PyObject *self;
#if CYTHON_COMPILING_IN_LIMITED_API
    PyCFunction meth = PyCFunction_GetFunction(cyfunc->func);
    if (unlikely(!meth)) return NULL;
#else
    PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth;
#endif
    switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) {
    case 1:
        self = args[0];
        args += 1;
        nargs -= 1;
        break;
    case 0:
#if CYTHON_COMPILING_IN_LIMITED_API
        self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func);
        if (unlikely(!self) && PyErr_Occurred()) return NULL;
#else
        self = ((PyCFunctionObject*)cyfunc)->m_self;
#endif
        break;
    default:
        return NULL;
    }
    if (unlikely(nargs != 1)) {
        __Pyx_CyFunction_raise_argument_count_error(
            cyfunc, "takes exactly one argument", nargs);
        return NULL;
    }
    return meth(self, args[0]);
}
static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
{
    __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
    Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
    PyObject *self;
#if CYTHON_COMPILING_IN_LIMITED_API
    PyCFunction meth = PyCFunction_GetFunction(cyfunc->func);
    if (unlikely(!meth)) return NULL;
#else
    PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth;
#endif
    switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) {
    case 1:
        self = args[0];
        args += 1;
        nargs -= 1;
        break;
    case 0:
#if CYTHON_COMPILING_IN_LIMITED_API
        self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func);
        if (unlikely(!self) && PyErr_Occurred()) return NULL;
#else
        self = ((PyCFunctionObject*)cyfunc)->m_self;
#endif
        break;
    default:
        return NULL;
    }
    return ((__Pyx_PyCFunctionFastWithKeywords)(void(*)(void))meth)(self, args, nargs, kwnames);
}
static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
{
    __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
    PyTypeObject *cls = (PyTypeObject *) __Pyx_CyFunction_GetClassObj(cyfunc);
    Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
    PyObject *self;
#if CYTHON_COMPILING_IN_LIMITED_API
    PyCFunction meth = PyCFunction_GetFunction(cyfunc->func);
    if (unlikely(!meth)) return NULL;
#else
    PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth;
#endif
    switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) {
    case 1:
        self = args[0];
        args += 1;
        nargs -= 1;
        break;
    case 0:
#if CYTHON_COMPILING_IN_LIMITED_API
        self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func);
        if (unlikely(!self) && PyErr_Occurred()) return NULL;
#else
        self = ((PyCFunctionObject*)cyfunc)->m_self;
#endif
        break;
    default:
        return NULL;
    }
    #if PY_VERSION_HEX < 0x030e00A6
    size_t nargs_value = (size_t) nargs;
    #else
    Py_ssize_t nargs_value = nargs;
    #endif
    return ((__Pyx_PyCMethod)(void(*)(void))meth)(self, cls, args, nargs_value, kwnames);
}
#endif
static PyType_Slot __pyx_CyFunctionType_slots[] = {
    {Py_tp_dealloc, (void *)__Pyx_CyFunction_dealloc},
    {Py_tp_repr, (void *)__Pyx_CyFunction_repr},
    {Py_tp_call, (void *)__Pyx_CyFunction_CallAsMethod},
    {Py_tp_traverse, (void *)__Pyx_CyFunction_traverse},
    {Py_tp_clear, (void *)__Pyx_CyFunction_clear},
    {Py_tp_methods, (void *)__pyx_CyFunction_methods},
    {Py_tp_members, (void *)__pyx_CyFunction_members},
    {Py_tp_getset, (void *)__pyx_CyFunction_getsets},
    {Py_tp_descr_get, (void *)__Pyx_PyMethod_New},
    {0, 0},
};
static PyType_Spec __pyx_CyFunctionType_spec = {
    __PYX_TYPE_MODULE_PREFIX "cython_function_or_method",
    sizeof(__pyx_CyFunctionObject),
    0,
#ifdef Py_TPFLAGS_METHOD_DESCRIPTOR
    Py_TPFLAGS_METHOD_DESCRIPTOR |
#endif
#if CYTHON_METH_FASTCALL
#if defined(Py_TPFLAGS_HAVE_VECTORCALL)
    Py_TPFLAGS_HAVE_VECTORCALL |
#elif defined(_Py_TPFLAGS_HAVE_VECTORCALL)
    _Py_TPFLAGS_HAVE_VECTORCALL |
#endif
#endif // CYTHON_METH_FASTCALL
#if PY_VERSION_HEX >= 0x030C0000 && !CYTHON_COMPILING_IN_LIMITED_API
    Py_TPFLAGS_MANAGED_DICT |
#endif
    Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_DISALLOW_INSTANTIATION |
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE,
    __pyx_CyFunctionType_slots
};
static int __pyx_CyFunction_init(PyObject *module) {
    __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module);
    mstate->__pyx_CyFunctionType = __Pyx_FetchCommonTypeFromSpec(
        mstate->__pyx_CommonTypesMetaclassType, module, &__pyx_CyFunctionType_spec, NULL);
    if (unlikely(mstate->__pyx_CyFunctionType == NULL)) {
        return -1;
    }
    return 0;
}
static CYTHON_INLINE PyObject *__Pyx_CyFunction_InitDefaults(PyObject *func, PyTypeObject *defaults_type) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults = PyObject_CallObject((PyObject*)defaults_type, NULL); // _PyObject_New(defaults_type);
    if (unlikely(!m->defaults))
        return NULL;
    return m->defaults;
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_tuple = tuple;
    Py_INCREF(tuple);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_kwdict = dict;
    Py_INCREF(dict);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->func_annotations = dict;
    Py_INCREF(dict);
}

/* CythonFunction */
static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname,
                                      PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
    PyObject *op = __Pyx_CyFunction_Init(
        PyObject_GC_New(__pyx_CyFunctionObject, __pyx_mstate_global->__pyx_CyFunctionType),
        ml, flags, qualname, closure, module, globals, code
    );
    if (likely(op)) {
        PyObject_GC_Track(op);
    }
    return op;
}

/* unicode_iter */
static CYTHON_INLINE int __Pyx_init_unicode_iteration(
    PyObject* ustring, Py_ssize_t *length, void** data, int *kind) {
#if CYTHON_COMPILING_IN_LIMITED_API
    *kind   = 0;
    *length = PyUnicode_GetLength(ustring);
    *data   = (void*)ustring;
#else
    if (unlikely(__Pyx_PyUnicode_READY(ustring) < 0)) return -1;
    *kind   = PyUnicode_KIND(ustring);
    *length = PyUnicode_GET_LENGTH(ustring);
    *data   = PyUnicode_DATA(ustring);
#endif
    return 0;
}

/* Coroutine (used by CoroutineYieldFrom) */
static void __Pyx_CoroutineAwait_dealloc(PyObject *self) {
    PyObject_GC_UnTrack(self);
    Py_CLEAR(((__pyx_CoroutineAwaitObject*)self)->coroutine);
    __Pyx_PyHeapTypeObject_GC_Del(self);
}
static int __Pyx_CoroutineAwait_traverse(__pyx_CoroutineAwaitObject *self, visitproc visit, void *arg) {
    {
        int e = __Pyx_call_type_traverse((PyObject*)self, 1, visit, arg);
        if (e) return e;
    }
    Py_VISIT(self->coroutine);
    return 0;
}
static int __Pyx_CoroutineAwait_clear(__pyx_CoroutineAwaitObject *self) {
    Py_CLEAR(self->coroutine);
    return 0;
}
static PyObject *__Pyx_CoroutineAwait_Next(__pyx_CoroutineAwaitObject *self) {
    return __Pyx_Generator_Next(self->coroutine);
}
static PyObject *__Pyx_CoroutineAwait_Send(__pyx_CoroutineAwaitObject *self, PyObject *value) {
    return __Pyx_Coroutine_Send(self->coroutine, value);
}
#if __PYX_HAS_PY_AM_SEND
static __Pyx_PySendResult __Pyx_CoroutineAwait_AmSend(PyObject *self, PyObject *value, PyObject **retval) {
    return __Pyx_Coroutine_AmSend(((__pyx_CoroutineAwaitObject*)self)->coroutine, value, retval);
}
#endif
static PyObject *__Pyx_CoroutineAwait_Throw(__pyx_CoroutineAwaitObject *self, PyObject *args) {
    return __Pyx_Coroutine_Throw(self->coroutine, args);
}
static __Pyx_PySendResult __Pyx_CoroutineAwait_Close(__pyx_CoroutineAwaitObject *self) {
    PyObject *retval = NULL;
    __Pyx_PySendResult result = __Pyx_Coroutine_Close(self->coroutine, &retval);
    Py_XDECREF(retval);
    return result;
}
static PyObject *__Pyx_CoroutineAwait_Close_Method(__pyx_CoroutineAwaitObject *self, PyObject *arg) {
    PyObject *retval = NULL;
    __Pyx_PySendResult result;
    CYTHON_UNUSED_VAR(arg);
    result = __Pyx_Coroutine_Close(self->coroutine, &retval);
    if (unlikely(result == PYGEN_ERROR))
        return NULL;
    Py_XDECREF(retval);
    Py_RETURN_NONE;
}
static PyObject *__Pyx_CoroutineAwait_self(PyObject *self) {
    Py_INCREF(self);
    return self;
}
#if !CYTHON_COMPILING_IN_PYPY
static PyObject *__Pyx_CoroutineAwait_no_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) {
    CYTHON_UNUSED_VAR(type);
    CYTHON_UNUSED_VAR(args);
    CYTHON_UNUSED_VAR(kwargs);
    PyErr_SetString(PyExc_TypeError, "cannot instantiate type, use 'await coroutine' instead");
    return NULL;
}
#endif
static PyMethodDef __pyx_CoroutineAwait_methods[] = {
    {"send", (PyCFunction) __Pyx_CoroutineAwait_Send, METH_O,
     PyDoc_STR("send(arg) -> send 'arg' into coroutine,\nreturn next yielded value or raise StopIteration.")},
    {"throw", (PyCFunction) __Pyx_CoroutineAwait_Throw, METH_VARARGS,
     PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in coroutine,\nreturn next yielded value or raise StopIteration.")},
    {"close", (PyCFunction) __Pyx_CoroutineAwait_Close_Method, METH_NOARGS, PyDoc_STR("close() -> raise GeneratorExit inside coroutine.")},
    {"__reduce_ex__", (PyCFunction) __Pyx_Coroutine_fail_reduce_ex, METH_O, 0},
    {"__reduce__", (PyCFunction) __Pyx_Coroutine_fail_reduce_ex, METH_NOARGS, 0},
    {0, 0, 0, 0}
};
static PyType_Slot __pyx_CoroutineAwaitType_slots[] = {
    {Py_tp_dealloc, (void *)__Pyx_CoroutineAwait_dealloc},
    {Py_tp_traverse, (void *)__Pyx_CoroutineAwait_traverse},
    {Py_tp_clear, (void *)__Pyx_CoroutineAwait_clear},
#if !CYTHON_COMPILING_IN_PYPY
    {Py_tp_new, (void *)__Pyx_CoroutineAwait_no_new},
#endif
    {Py_tp_methods, (void *)__pyx_CoroutineAwait_methods},
    {Py_tp_iter, (void *)__Pyx_CoroutineAwait_self},
    {Py_tp_iternext, (void *)__Pyx_CoroutineAwait_Next},
#if __PYX_HAS_PY_AM_SEND == 1
    {Py_am_send, (void *)__Pyx_CoroutineAwait_AmSend},
#endif
    {0, 0},
};
static PyType_Spec __pyx_CoroutineAwaitType_spec = {
    __PYX_TYPE_MODULE_PREFIX "coroutine_wrapper",
    sizeof(__pyx_CoroutineAwaitObject),
    0,
    Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_DISALLOW_INSTANTIATION |
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | __Pyx_TPFLAGS_HAVE_AM_SEND,
    __pyx_CoroutineAwaitType_slots
};
#if __PYX_HAS_PY_AM_SEND == 2 // backport
static __Pyx_PyAsyncMethodsStruct __pyx_CoroutineAwait_as_async;
#endif
static CYTHON_INLINE PyObject *__Pyx__Coroutine_await(PyObject *coroutine) {
    __pyx_CoroutineAwaitObject *await = PyObject_GC_New(__pyx_CoroutineAwaitObject, __pyx_mstate_global->__pyx_CoroutineAwaitType);
    if (unlikely(!await)) return NULL;
    Py_INCREF(coroutine);
    await->coroutine = coroutine;
    PyObject_GC_Track(await);
    return (PyObject*)await;
}
static PyObject *__Pyx_Coroutine_await(PyObject *coroutine) {
    if (unlikely(!coroutine || !__Pyx_Coroutine_Check(coroutine))) {
        PyErr_SetString(PyExc_TypeError, "invalid input, expected coroutine");
        return NULL;
    }
    return __Pyx__Coroutine_await(coroutine);
}
static PyMethodDef __pyx_Coroutine_methods[] = {
    {"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O,
     PyDoc_STR("send(arg) -> send 'arg' into coroutine,\nreturn next iterated value or raise StopIteration.")},
    {"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS,
     PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in coroutine,\nreturn next iterated value or raise StopIteration.")},
    {"close", (PyCFunction) __Pyx_Coroutine_Close_Method, METH_NOARGS, PyDoc_STR("close() -> raise GeneratorExit inside coroutine.")},
    {"__reduce_ex__", (PyCFunction) __Pyx_Coroutine_fail_reduce_ex, METH_O, 0},
    {"__reduce__", (PyCFunction) __Pyx_Coroutine_fail_reduce_ex, METH_NOARGS, 0},
    {0, 0, 0, 0}
};
static PyMemberDef __pyx_Coroutine_memberlist[] = {
    {"cr_await", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY,
     PyDoc_STR("object being awaited, or None")},
    {"cr_code", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_code), READONLY, NULL},
    {"__module__", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_modulename), 0, 0},
#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
    {"__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CoroutineObject, gi_weakreflist), READONLY, 0},
#endif
    {0, 0, 0, 0, 0}
};
static PyGetSetDef __pyx_Coroutine_getsets[] = {
    {"__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name,
     PyDoc_STR("name of the coroutine"), 0},
    {"__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname,
     PyDoc_STR("qualified name of the coroutine"), 0},
    {"cr_frame", (getter)__Pyx_Coroutine_get_frame, NULL,
     PyDoc_STR("Frame of the coroutine"), 0},
    {"cr_running", __Pyx_Coroutine_get_is_running_getter, NULL, NULL, NULL},
    {0, 0, 0, 0, 0}
};
static PyType_Slot __pyx_CoroutineType_slots[] = {
    {Py_tp_dealloc, (void *)__Pyx_Coroutine_dealloc},
    {Py_am_await, (void *)&__Pyx_Coroutine_await},
    {Py_tp_traverse, (void *)__Pyx_Coroutine_traverse},
    {Py_tp_methods, (void *)__pyx_Coroutine_methods},
    {Py_tp_members, (void *)__pyx_Coroutine_memberlist},
    {Py_tp_getset, (void *)__pyx_Coroutine_getsets},
    {Py_tp_getattro, (void *) PyObject_GenericGetAttr},
#if CYTHON_USE_TP_FINALIZE
    {Py_tp_finalize, (void *)__Pyx_Coroutine_del},
#endif
#if __PYX_HAS_PY_AM_SEND == 1
    {Py_am_send, (void *)__Pyx_Coroutine_AmSend},
#endif
    {0, 0},
};
static PyType_Spec __pyx_CoroutineType_spec = {
    __PYX_TYPE_MODULE_PREFIX "coroutine",
    sizeof(__pyx_CoroutineObject),
    0,
#if PY_VERSION_HEX >= 0x030C0000 && !CYTHON_COMPILING_IN_LIMITED_API
    Py_TPFLAGS_MANAGED_WEAKREF |
#endif
    Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_DISALLOW_INSTANTIATION |
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | __Pyx_TPFLAGS_HAVE_AM_SEND,
    __pyx_CoroutineType_slots
};
#if __PYX_HAS_PY_AM_SEND == 2
static __Pyx_PyAsyncMethodsStruct __pyx_Coroutine_as_async;
#endif
static int __pyx_Coroutine_init(PyObject *module) {
    __pyx_mstatetype *mstate;
    CYTHON_MAYBE_UNUSED_VAR(module);
    mstate = __Pyx_PyModule_GetState(module);
    mstate->__pyx_CoroutineType = __Pyx_FetchCommonTypeFromSpec(
        mstate->__pyx_CommonTypesMetaclassType, module, &__pyx_CoroutineType_spec, NULL);
    if (unlikely(!mstate->__pyx_CoroutineType))
        return -1;
#if __PYX_HAS_PY_AM_SEND == 2
    __Pyx_SetBackportTypeAmSend(mstate->__pyx_CoroutineType, &__pyx_Coroutine_as_async, &__Pyx_Coroutine_AmSend);
#endif
#ifdef __Pyx_IterableCoroutine_USED
    if (unlikely(__pyx_IterableCoroutine_init(module) == -1))
        return -1;
#endif
    mstate->__pyx_CoroutineAwaitType = __Pyx_FetchCommonTypeFromSpec(NULL, module, &__pyx_CoroutineAwaitType_spec, NULL);
    if (unlikely(!mstate->__pyx_CoroutineAwaitType))
        return -1;
#if __PYX_HAS_PY_AM_SEND == 2
    __Pyx_SetBackportTypeAmSend(mstate->__pyx_CoroutineAwaitType, &__pyx_CoroutineAwait_as_async, &__Pyx_CoroutineAwait_AmSend);
#endif
    return 0;
}

/* Coro_CheckExact (used by GetAwaitIter) */
#if CYTHON_COMPILING_IN_LIMITED_API
static int __Pyx_PyCoro_CheckExact(PyObject *o) {
    return (PyObject*)Py_TYPE(o) == __pyx_mstate_global->__Pyx_CachedCoroType;
}
#endif

/* GetAwaitIter (used by CoroutineYieldFrom) */
static CYTHON_INLINE PyObject *__Pyx_Coroutine_GetAwaitableIter(PyObject *o) {
#ifdef __Pyx_Coroutine_USED
    if (__Pyx_Coroutine_Check(o)) {
        return __Pyx_NewRef(o);
    }
#endif
    return __Pyx__Coroutine_GetAwaitableIter(o);
}
static void __Pyx_Coroutine_AwaitableIterError(PyObject *source) {
#if (PY_VERSION_HEX < 0x030d0000 || defined(_PyErr_FormatFromCause)) && !CYTHON_COMPILING_IN_LIMITED_API
    __Pyx_TypeName source_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(source));
    _PyErr_FormatFromCause(PyExc_TypeError,
        "'async for' received an invalid object from __anext__: " __Pyx_FMT_TYPENAME, source_type_name);
    __Pyx_DECREF_TypeName(source_type_name);
#else
    PyObject *exc, *val, *val2, *tb;
    __Pyx_TypeName source_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(source));
    assert(PyErr_Occurred());
    PyErr_Fetch(&exc, &val, &tb);
    PyErr_NormalizeException(&exc, &val, &tb);
    if (tb != NULL) {
        PyException_SetTraceback(val, tb);
        Py_DECREF(tb);
    }
    Py_DECREF(exc);
    assert(!PyErr_Occurred());
    PyErr_Format(PyExc_TypeError,
        "'async for' received an invalid object from __anext__: " __Pyx_FMT_TYPENAME, source_type_name);
    __Pyx_DECREF_TypeName(source_type_name);
    PyErr_Fetch(&exc, &val2, &tb);
    PyErr_NormalizeException(&exc, &val2, &tb);
    Py_INCREF(val);
    PyException_SetCause(val2, val);
    PyException_SetContext(val2, val);
    PyErr_Restore(exc, val2, tb);
#endif
}
static PyObject *__Pyx__Coroutine_GetAwaitableIter(PyObject *obj) {
    PyObject *res;
    unaryfunc am_await;
    am_await = __Pyx_PyObject_TryGetSubSlot(obj, tp_as_async, am_await, unaryfunc);
    if (likely(am_await)) {
        res = (*am_await)(obj);
    } else
#if CYTHON_COMPILING_IN_CPYTHON && defined(CO_ITERABLE_COROUTINE)
#if PY_VERSION_HEX >= 0x030C00A6
    if (PyGen_CheckExact(obj) && (PyGen_GetCode((PyGenObject*)obj)->co_flags & CO_ITERABLE_COROUTINE)) {
#else
    if (PyGen_CheckExact(obj) && ((PyGenObject*)obj)->gi_code && ((PyCodeObject *)((PyGenObject*)obj)->gi_code)->co_flags & CO_ITERABLE_COROUTINE) {
#endif
        return __Pyx_NewRef(obj);
    } else
#endif
    {
#if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))
        PyObject *args[] = { obj };
        res = PyObject_VectorcallMethod(__pyx_mstate_global->__pyx_n_u_await, args, 1 |  PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
        if (unlikely(!res)) {
            if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
                PyObject *type, *value, *traceback;
                PyErr_Fetch(&type, &value, &traceback);
                int has_attr = PyObject_HasAttr(obj, __pyx_mstate_global->__pyx_n_u_await);
                PyErr_Restore(type, value, traceback);
                if (!has_attr) goto slot_error;
            }
        }
#else
        PyObject *method = NULL;
        int is_method = __Pyx_PyObject_GetMethod(obj, __pyx_mstate_global->__pyx_n_u_await, &method);
        if (likely(is_method)) {
            res = __Pyx_PyObject_CallOneArg(method, obj);
        } else if (likely(method)) {
            res = __Pyx_PyObject_CallNoArg(method);
        } else
            goto slot_error;
        Py_DECREF(method);
#endif
    }
    if (unlikely(!res)) {
        __Pyx_Coroutine_AwaitableIterError(obj);
        goto bad;
    }
    if (unlikely(!PyIter_Check(res))) {
        __Pyx_TypeName res_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(res));
        PyErr_Format(PyExc_TypeError,
            "__await__() returned non-iterator of type '" __Pyx_FMT_TYPENAME "'", res_type_name);
        __Pyx_DECREF_TypeName(res_type_name);
        Py_CLEAR(res);
    } else {
        int is_coroutine = 0;
        #ifdef __Pyx_Coroutine_USED
        is_coroutine |= __Pyx_Coroutine_Check(res);
        #endif
        is_coroutine |= __Pyx_PyCoro_CheckExact(res);
        if (unlikely(is_coroutine)) {
            /* __await__ must return an *iterator*, not
               a coroutine or another awaitable (see PEP 492) */
            PyErr_SetString(PyExc_TypeError,
                            "__await__() returned a coroutine");
            Py_CLEAR(res);
        }
    }
    return res;
slot_error:
    {
        __Pyx_TypeName obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj));
        PyErr_Format(PyExc_TypeError,
            "object " __Pyx_FMT_TYPENAME " can't be used in 'await' expression", obj_type_name);
        __Pyx_DECREF_TypeName(obj_type_name);
    }
bad:
    return NULL;
}

/* CoroutineYieldFrom */
  static __Pyx_PySendResult __Pyx_Coroutine_Yield_From_Coroutine(__pyx_CoroutineObject *gen, PyObject *source, PyObject **retval) {
      __Pyx_PySendResult result;
      if (unlikely(((__pyx_CoroutineObject*)source)->yieldfrom)) {
          PyErr_SetString(
              PyExc_RuntimeError,
              "coroutine is being awaited already");
          return PYGEN_ERROR;
      }
      result = __Pyx_Coroutine_AmSend(source, Py_None, retval);
      if (result == PYGEN_NEXT) {
          Py_INCREF(source);
          __Pyx_Coroutine_Set_Owned_Yield_From(gen, source);
      }
      return result;
  }
  static __Pyx_PySendResult __Pyx_Coroutine_Yield_From_Generic(__pyx_CoroutineObject *gen, PyObject *source, PyObject **retval) {
      __Pyx_PySendResult result;
      PyObject *source_gen = NULL;
      source_gen = __Pyx_Coroutine_GetAwaitableIter(source);
      if (unlikely(!source_gen)) return PYGEN_ERROR;
      if (__Pyx_Coroutine_Check(source_gen)) {
          result = __Pyx_Coroutine_Yield_From_Coroutine(gen, source_gen, retval);
          Py_DECREF(source_gen);
          return result;
      }
      *retval = __Pyx_PyIter_Next_Plain(source_gen);
      if (*retval) {
          __Pyx_Coroutine_Set_Owned_Yield_From(gen, source_gen);
          return PYGEN_NEXT;
      }
      result = __Pyx_Coroutine_status_from_result(retval);
      Py_XDECREF(source_gen);
      return result;
  }
  static CYTHON_INLINE __Pyx_PySendResult __Pyx_Coroutine_Yield_From(__pyx_CoroutineObject *gen, PyObject *source, PyObject **retval) {
      if (__Pyx_Coroutine_Check(source)) {
          return __Pyx_Coroutine_Yield_From_Coroutine(gen, source, retval);
      }
  #ifdef __Pyx_AsyncGen_USED
      if (__pyx_PyAsyncGenASend_CheckExact(source)) {
          *retval = __Pyx_async_gen_asend_iternext(source);
          if (*retval) {
              Py_INCREF(source);
              __Pyx_Coroutine_Set_Owned_Yield_From(gen, source);
              return PYGEN_NEXT;
          }
          return __Pyx_Coroutine_status_from_result(retval);
      }
  #endif
      return __Pyx_Coroutine_Yield_From_Generic(gen, source, retval);
  }
  
/* KeywordStringCheck */
  static int __Pyx_CheckKeywordStrings(
      const char* function_name,
      PyObject *kw)
  {
  #if CYTHON_COMPILING_IN_PYPY && !defined(PyArg_ValidateKeywordArguments)
      CYTHON_UNUSED_VAR(function_name);
      CYTHON_UNUSED_VAR(kw);
      return 0;
  #else
      if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kw))) {
  #if PY_VERSION_HEX >= 0x03090000
          CYTHON_UNUSED_VAR(function_name);
  #else
          Py_ssize_t kwsize;
          #if CYTHON_ASSUME_SAFE_SIZE
          kwsize = PyTuple_GET_SIZE(kw);
          #else
          kwsize = PyTuple_Size(kw);
          if (unlikely(kwsize < 0)) return -1;
          #endif
          for (Py_ssize_t pos = 0; pos < kwsize; pos++) {
              PyObject* key = NULL;
              #if CYTHON_ASSUME_SAFE_MACROS
              key = PyTuple_GET_ITEM(kw, pos);
              #else
              key = PyTuple_GetItem(kw, pos);
              if (unlikely(!key)) return -1;
              #endif
              if (unlikely(!PyUnicode_Check(key))) {
                  PyErr_Format(PyExc_TypeError,
                      "%.200s() keywords must be strings", function_name);
                  return -1;
              }
          }
  #endif
      } else {
          if (unlikely(!PyArg_ValidateKeywordArguments(kw))) return -1;
      }
      return 0;
  #endif
  }
  
/* dict_getitem_default */
  static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value) {
      PyObject* value;
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000
      value = PyDict_GetItemWithError(d, key);
      if (unlikely(!value)) {
          if (unlikely(PyErr_Occurred()))
              return NULL;
          value = default_value;
      }
      Py_INCREF(value);
      if ((1));
  #else
      if (PyBytes_CheckExact(key) || PyUnicode_CheckExact(key) || PyLong_CheckExact(key)) {
          value = PyDict_GetItem(d, key);
          if (unlikely(!value)) {
              value = default_value;
          }
          Py_INCREF(value);
      }
  #endif
      else {
          if (default_value == Py_None)
              value = __Pyx_CallUnboundCMethod1(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_get, d, key);
          else
              value = __Pyx_CallUnboundCMethod2(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_get, d, key, default_value);
      }
      return value;
  }
  
/* StringJoin */
  static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values) {
      (void) __Pyx_PyObject_CallMethod1;
  #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030e0000 || defined(PyBytes_Join)
      return PyBytes_Join(sep, values);
  #elif CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000 || defined(_PyBytes_Join)
      return _PyBytes_Join(sep, values);
  #else
      return __Pyx_PyObject_CallMethod1(sep, __pyx_mstate_global->__pyx_n_u_join, values);
  #endif
  }
  
/* MergeKeywords */
  static int __Pyx_MergeKeywords_dict(PyObject *kwdict, PyObject *source_dict) {
      Py_ssize_t len1, len2;
      len2 = PyDict_Size(source_dict);
      if (unlikely(len2 == -1)) return -1;
      if (len2 == 0) {
          return 0;
      }
      len1 = PyDict_Size(kwdict);
      if (unlikely(len1 == -1)) return -1;
      if (len1 > 0) {
          PyObject *key, *smaller_dict, *larger_dict;
          #if CYTHON_AVOID_BORROWED_REFS
          PyObject *ppos = NULL;
          #else
          Py_ssize_t ppos = 0;
          #endif
          int duplicates_found = 0;
          if (len1 <= len2) {
              smaller_dict = kwdict;
              larger_dict = source_dict;
          } else {
              smaller_dict = source_dict;
              larger_dict = kwdict;
          }
          __Pyx_BEGIN_CRITICAL_SECTION(smaller_dict);
          while (
              #if CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
              __Pyx_PyDict_NextRef(smaller_dict, &ppos, &key, NULL)
              #else
              PyDict_Next(smaller_dict, &ppos, &key, NULL)
              #endif
          ) {
              if (unlikely(PyDict_Contains(larger_dict, key))) {
                  __Pyx_RaiseDoubleKeywordsError("function", key);
                  #if CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
                  Py_DECREF(key);
                  #endif
                  duplicates_found = 1;
                  break;
              };
              #if CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
              Py_DECREF(key);
              #endif
          }
          __Pyx_END_CRITICAL_SECTION();
          #if CYTHON_AVOID_BORROWED_REFS
          Py_XDECREF(ppos);
          #endif
          if (unlikely(duplicates_found))
              return -1;
      }
      return PyDict_Update(kwdict, source_dict);
  }
  static int __Pyx_MergeKeywords_any(PyObject *kwdict, PyObject *source_mapping) {
      PyObject *iter, *key = NULL, *value = NULL;
      int source_is_dict, result;
      Py_ssize_t orig_length, ppos = 0;
      iter = __Pyx_dict_iterator(source_mapping, 0, __pyx_mstate_global->__pyx_n_u_items, &orig_length, &source_is_dict);
      if (unlikely(!iter)) {
          PyObject *args;
          if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError))) goto bad;
          PyErr_Clear();
          args = PyTuple_Pack(1, source_mapping);
          if (likely(args)) {
              PyObject *fallback = PyObject_Call((PyObject*)&PyDict_Type, args, NULL);
              Py_DECREF(args);
              if (likely(fallback)) {
                  result = __Pyx_MergeKeywords_dict(kwdict, fallback);
                  Py_DECREF(fallback);
                  return result;
              }
          }
          if (unlikely(!iter)) goto bad;
      }
      while (1) {
          result = __Pyx_dict_iter_next(iter, orig_length, &ppos, &key, &value, NULL, source_is_dict);
          if (unlikely(result < 0)) goto bad;
          if (!result) break;
      #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
          {
              int inserted = PyDict_SetDefaultRef(kwdict, key, value, NULL);
              if (unlikely(inserted != 0)) {
                  if (inserted == 1) __Pyx_RaiseDoubleKeywordsError("function", key);
                  result = -1;
              }
          }
      #else
          if (unlikely(PyDict_Contains(kwdict, key))) {
              __Pyx_RaiseDoubleKeywordsError("function", key);
              result = -1;
          } else {
              result = PyDict_SetItem(kwdict, key, value);
          }
      #endif
          Py_DECREF(key);
          Py_DECREF(value);
          if (unlikely(result < 0)) goto bad;
      }
      Py_XDECREF(iter);
      return 0;
  bad:
      Py_XDECREF(iter);
      return -1;
  }
  static CYTHON_INLINE int __Pyx_MergeKeywords(PyObject *kwdict, PyObject *source_mapping) {
      assert(PyDict_Check(kwdict));
      if (likely(PyDict_Check(source_mapping))) {
          return __Pyx_MergeKeywords_dict(kwdict, source_mapping);
      } else {
          return __Pyx_MergeKeywords_any(kwdict, source_mapping);
      }
  }
  
/* set_iter */
  static CYTHON_INLINE PyObject* __Pyx_set_iterator(PyObject* iterable, int is_set,
                                                    Py_ssize_t* p_orig_length, int* p_source_is_set) {
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000
      is_set = is_set || likely(PySet_CheckExact(iterable) || PyFrozenSet_CheckExact(iterable));
      *p_source_is_set = is_set;
      if (likely(is_set)) {
          *p_orig_length = PySet_Size(iterable);
          Py_INCREF(iterable);
          return iterable;
      }
  #else
      CYTHON_UNUSED_VAR(is_set);
      *p_source_is_set = 0;
  #endif
      *p_orig_length = 0;
      return PyObject_GetIter(iterable);
  }
  static CYTHON_INLINE int __Pyx_set_iter_next(
          PyObject* iter_obj, Py_ssize_t orig_length,
          Py_ssize_t* ppos, PyObject **value,
          int source_is_set) {
      if (!CYTHON_COMPILING_IN_CPYTHON || PY_VERSION_HEX >= 0x030d0000 || unlikely(!source_is_set)) {
          *value = PyIter_Next(iter_obj);
          if (unlikely(!*value)) {
              return __Pyx_IterFinish();
          }
          CYTHON_UNUSED_VAR(orig_length);
          CYTHON_UNUSED_VAR(ppos);
          return 1;
      }
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000
      if (unlikely(PySet_GET_SIZE(iter_obj) != orig_length)) {
          PyErr_SetString(
              PyExc_RuntimeError,
              "set changed size during iteration");
          return -1;
      }
      {
          Py_hash_t hash;
          int ret = _PySet_NextEntry(iter_obj, ppos, value, &hash);
          assert (ret != -1);
          if (likely(ret)) {
              Py_INCREF(*value);
              return 1;
          }
      }
  #endif
      return 0;
  }
  
/* CIntToPyUnicode */
  static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_xmlXPathObjectType(xmlXPathObjectType value, Py_ssize_t width, char padding_char) {
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic push
  #pragma GCC diagnostic ignored "-Wconversion"
  #endif
      const xmlXPathObjectType neg_one = (xmlXPathObjectType) -1, const_zero = (xmlXPathObjectType) 0;
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic pop
  #endif
      const int is_unsigned = neg_one > const_zero;
      if (unlikely(!(is_unsigned || value == 0 || value > 0) ||
                      !(sizeof(value) <= 2 || value & ~ (xmlXPathObjectType) 0x01fffff || __Pyx_CheckUnicodeValue((int) value)))) {
          PyErr_SetString(PyExc_OverflowError, "%c arg not in range(0x110000)");
          return NULL;
      }
      if (width <= 1) {
          return PyUnicode_FromOrdinal((int) value);
      }
      return __Pyx_PyUnicode_FromOrdinal_Padded((int) value, width, padding_char);
  }
  static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_xmlXPathObjectType(xmlXPathObjectType value, Py_ssize_t width, char padding_char, char format_char) {
      char digits[sizeof(xmlXPathObjectType)*3+2];
      char *dpos, *end = digits + sizeof(xmlXPathObjectType)*3+2;
      const char *hex_digits = DIGITS_HEX;
      Py_ssize_t length, ulength;
      int prepend_sign, last_one_off;
      xmlXPathObjectType remaining;
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic push
  #pragma GCC diagnostic ignored "-Wconversion"
  #endif
      const xmlXPathObjectType neg_one = (xmlXPathObjectType) -1, const_zero = (xmlXPathObjectType) 0;
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic pop
  #endif
      const int is_unsigned = neg_one > const_zero;
      if (format_char == 'X') {
          hex_digits += 16;
          format_char = 'x';
      }
      remaining = value;
      last_one_off = 0;
      dpos = end;
      do {
          int digit_pos;
          switch (format_char) {
          case 'o':
              digit_pos = abs((int)(remaining % (8*8)));
              remaining = (xmlXPathObjectType) (remaining / (8*8));
              dpos -= 2;
              memcpy(dpos, DIGIT_PAIRS_8 + digit_pos * 2, 2);
              last_one_off = (digit_pos < 8);
              break;
          case 'd':
              digit_pos = abs((int)(remaining % (10*10)));
              remaining = (xmlXPathObjectType) (remaining / (10*10));
              dpos -= 2;
              memcpy(dpos, DIGIT_PAIRS_10 + digit_pos * 2, 2);
              last_one_off = (digit_pos < 10);
              break;
          case 'x':
              *(--dpos) = hex_digits[abs((int)(remaining % 16))];
              remaining = (xmlXPathObjectType) (remaining / 16);
              break;
          default:
              assert(0);
              break;
          }
      } while (unlikely(remaining != 0));
      assert(!last_one_off || *dpos == '0');
      dpos += last_one_off;
      length = end - dpos;
      ulength = length;
      prepend_sign = 0;
      if (!is_unsigned && value <= neg_one) {
          if (padding_char == ' ' || width <= length + 1) {
              *(--dpos) = '-';
              ++length;
          } else {
              prepend_sign = 1;
          }
          ++ulength;
      }
      if (width > ulength) {
          ulength = width;
      }
      if (ulength == 1) {
          return PyUnicode_FromOrdinal(*dpos);
      }
      return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char);
  }
  
/* AllocateExtensionType */
  static PyObject *__Pyx_AllocateExtensionType(PyTypeObject *t, int is_final) {
      if (is_final || likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
          allocfunc alloc_func = __Pyx_PyType_GetSlot(t, tp_alloc, allocfunc);
          return alloc_func(t, 0);
      } else {
          newfunc tp_new = __Pyx_PyType_TryGetSlot(&PyBaseObject_Type, tp_new, newfunc);
      #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
          if (!tp_new) {
              PyObject *new_str = PyUnicode_FromString("__new__");
              if (likely(new_str)) {
                  PyObject *o = PyObject_CallMethodObjArgs((PyObject *)&PyBaseObject_Type, new_str, t, NULL);
                  Py_DECREF(new_str);
                  return o;
              } else
                  return NULL;
          } else
      #endif
          return tp_new(t, __pyx_mstate_global->__pyx_empty_tuple, 0);
      }
  }
  
/* CallNextTpTraverse */
  static int __Pyx_call_next_tp_traverse(PyObject* obj, visitproc v, void *a, traverseproc current_tp_traverse) {
      PyTypeObject* type = Py_TYPE(obj);
      traverseproc tp_traverse = NULL;
      while (type && __Pyx_PyType_GetSlot(type, tp_traverse, traverseproc) != current_tp_traverse)
          type = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*);
      while (type && (tp_traverse = __Pyx_PyType_GetSlot(type, tp_traverse, traverseproc)) == current_tp_traverse)
          type = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*);
      if (type && tp_traverse)
          return tp_traverse(obj, v, a);
      return 0;
  }
  
/* CallNextTpClear */
  static void __Pyx_call_next_tp_clear(PyObject* obj, inquiry current_tp_clear) {
      PyTypeObject* type = Py_TYPE(obj);
      inquiry tp_clear = NULL;
      while (type && __Pyx_PyType_GetSlot(type, tp_clear, inquiry) != current_tp_clear)
          type = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*);
      while (type && (tp_clear = __Pyx_PyType_GetSlot(type, tp_clear, inquiry)) == current_tp_clear)
          type = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*);
      if (type && tp_clear)
          tp_clear(obj);
  }
  
/* FunctionExport */
  static int __Pyx_ExportFunction(PyObject *api_dict, const char *name, void (*f)(void), const char *sig) {
      PyObject *cobj;
      union {
          void (*fp)(void);
          void *p;
      } tmp;
      tmp.fp = f;
      cobj = PyCapsule_New(tmp.p, sig, 0);
      if (!cobj)
          goto bad;
      if (PyDict_SetItemString(api_dict, name, cobj) < 0)
          goto bad;
      Py_DECREF(cobj);
      return 0;
  bad:
      Py_XDECREF(cobj);
      return -1;
  }
  
/* GetApiDict */
  static PyObject *__Pyx_ApiExport_GetApiDict(void) {
      PyObject *d;
      if (__Pyx_PyDict_GetItemRef(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pyx_capi, &d) == -1)
          return NULL;
      if (!d) {
          d = PyDict_New();
          if (!d)
              goto bad;
          if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_pyx_capi, d) < 0)
              goto bad;
      }
      return d;
  bad:
      Py_XDECREF(d);
      return NULL;
  }
  
/* FormatTypeName (used by ValidateExternBase) */
  #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030d0000
  static __Pyx_TypeName
  __Pyx_PyType_GetFullyQualifiedName(PyTypeObject* tp)
  {
      PyObject *module = NULL, *name = NULL, *result = NULL;
      #if __PYX_LIMITED_VERSION_HEX < 0x030b0000
      name = __Pyx_PyObject_GetAttrStr((PyObject *)tp,
                                                 __pyx_mstate_global->__pyx_n_u_qualname);
      #else
      name = PyType_GetQualName(tp);
      #endif
      if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) goto bad;
      module = __Pyx_PyObject_GetAttrStr((PyObject *)tp,
                                                 __pyx_mstate_global->__pyx_n_u_module_2);
      if (unlikely(module == NULL) || unlikely(!PyUnicode_Check(module))) goto bad;
      if (PyUnicode_CompareWithASCIIString(module, "builtins") == 0) {
          result = name;
          name = NULL;
          goto done;
      }
      result = PyUnicode_FromFormat("%U.%U", module, name);
      if (unlikely(result == NULL)) goto bad;
    done:
      Py_XDECREF(name);
      Py_XDECREF(module);
      return result;
    bad:
      PyErr_Clear();
      if (name) {
          result = name;
          name = NULL;
      } else {
          result = __Pyx_NewRef(__pyx_mstate_global->__pyx_kp_u__44);
      }
      goto done;
  }
  #endif
  
/* ValidateExternBase */
  static int __Pyx_validate_extern_base(PyTypeObject *base) {
      Py_ssize_t itemsize;
  #if CYTHON_COMPILING_IN_LIMITED_API
      PyObject *py_itemsize;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
      itemsize = ((PyTypeObject *)base)->tp_itemsize;
  #else
      py_itemsize = PyObject_GetAttrString((PyObject*)base, "__itemsize__");
      if (!py_itemsize)
          return -1;
      itemsize = PyLong_AsSsize_t(py_itemsize);
      Py_DECREF(py_itemsize);
      py_itemsize = 0;
      if (itemsize == (Py_ssize_t)-1 && PyErr_Occurred())
          return -1;
  #endif
      if (itemsize) {
          __Pyx_TypeName b_name = __Pyx_PyType_GetFullyQualifiedName(base);
          PyErr_Format(PyExc_TypeError,
                  "inheritance from PyVarObject types like '" __Pyx_FMT_TYPENAME "' not currently supported", b_name);
          __Pyx_DECREF_TypeName(b_name);
          return -1;
      }
      return 0;
  }
  
/* ValidateBasesTuple (used by PyType_Ready) */
  #if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS
  static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases) {
      Py_ssize_t i, n;
  #if CYTHON_ASSUME_SAFE_SIZE
      n = PyTuple_GET_SIZE(bases);
  #else
      n = PyTuple_Size(bases);
      if (unlikely(n < 0)) return -1;
  #endif
      for (i = 1; i < n; i++)
      {
          PyTypeObject *b;
  #if CYTHON_AVOID_BORROWED_REFS
          PyObject *b0 = PySequence_GetItem(bases, i);
          if (!b0) return -1;
  #elif CYTHON_ASSUME_SAFE_MACROS
          PyObject *b0 = PyTuple_GET_ITEM(bases, i);
  #else
          PyObject *b0 = PyTuple_GetItem(bases, i);
          if (!b0) return -1;
  #endif
          b = (PyTypeObject*) b0;
          if (!__Pyx_PyType_HasFeature(b, Py_TPFLAGS_HEAPTYPE))
          {
              __Pyx_TypeName b_name = __Pyx_PyType_GetFullyQualifiedName(b);
              PyErr_Format(PyExc_TypeError,
                  "base class '" __Pyx_FMT_TYPENAME "' is not a heap type", b_name);
              __Pyx_DECREF_TypeName(b_name);
  #if CYTHON_AVOID_BORROWED_REFS
              Py_DECREF(b0);
  #endif
              return -1;
          }
          if (dictoffset == 0)
          {
              Py_ssize_t b_dictoffset = 0;
  #if CYTHON_USE_TYPE_SLOTS
              b_dictoffset = b->tp_dictoffset;
  #else
              PyObject *py_b_dictoffset = PyObject_GetAttrString((PyObject*)b, "__dictoffset__");
              if (!py_b_dictoffset) goto dictoffset_return;
              b_dictoffset = PyLong_AsSsize_t(py_b_dictoffset);
              Py_DECREF(py_b_dictoffset);
              if (b_dictoffset == -1 && PyErr_Occurred()) goto dictoffset_return;
  #endif
              if (b_dictoffset) {
                  {
                      __Pyx_TypeName b_name = __Pyx_PyType_GetFullyQualifiedName(b);
                      PyErr_Format(PyExc_TypeError,
                          "extension type '%.200s' has no __dict__ slot, "
                          "but base type '" __Pyx_FMT_TYPENAME "' has: "
                          "either add 'cdef dict __dict__' to the extension type "
                          "or add '__slots__ = [...]' to the base type",
                          type_name, b_name);
                      __Pyx_DECREF_TypeName(b_name);
                  }
  #if !CYTHON_USE_TYPE_SLOTS
                dictoffset_return:
  #endif
  #if CYTHON_AVOID_BORROWED_REFS
                  Py_DECREF(b0);
  #endif
                  return -1;
              }
          }
  #if CYTHON_AVOID_BORROWED_REFS
          Py_DECREF(b0);
  #endif
      }
      return 0;
  }
  #endif
  
/* PyType_Ready */
  CYTHON_UNUSED static int __Pyx_PyType_HasMultipleInheritance(PyTypeObject *t) {
      while (t) {
          PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*);
          if (bases) {
              return 1;
          }
          t = __Pyx_PyType_GetSlot(t, tp_base, PyTypeObject*);
      }
      return 0;
  }
  static int __Pyx_PyType_Ready(PyTypeObject *t) {
  #if CYTHON_USE_TYPE_SPECS || !CYTHON_COMPILING_IN_CPYTHON || defined(PYSTON_MAJOR_VERSION)
      (void)__Pyx_PyObject_CallMethod0;
  #if CYTHON_USE_TYPE_SPECS
      (void)__Pyx_validate_bases_tuple;
  #endif
      return PyType_Ready(t);
  #else
      int r;
      if (!__Pyx_PyType_HasMultipleInheritance(t)) {
          return PyType_Ready(t);
      }
      PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*);
      if (bases && unlikely(__Pyx_validate_bases_tuple(t->tp_name, t->tp_dictoffset, bases) == -1))
          return -1;
  #if !defined(PYSTON_MAJOR_VERSION)
      {
          int gc_was_enabled;
      #if PY_VERSION_HEX >= 0x030A00b1
          gc_was_enabled = PyGC_Disable();
          (void)__Pyx_PyObject_CallMethod0;
      #else
          PyObject *ret, *py_status;
          PyObject *gc = NULL;
          #if (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM+0 >= 0x07030400) &&\
                  !CYTHON_COMPILING_IN_GRAAL
          gc = PyImport_GetModule(__pyx_mstate_global->__pyx_kp_u_gc);
          #endif
          if (unlikely(!gc)) gc = PyImport_Import(__pyx_mstate_global->__pyx_kp_u_gc);
          if (unlikely(!gc)) return -1;
          py_status = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_isenabled);
          if (unlikely(!py_status)) {
              Py_DECREF(gc);
              return -1;
          }
          gc_was_enabled = __Pyx_PyObject_IsTrue(py_status);
          Py_DECREF(py_status);
          if (gc_was_enabled > 0) {
              ret = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_disable);
              if (unlikely(!ret)) {
                  Py_DECREF(gc);
                  return -1;
              }
              Py_DECREF(ret);
          } else if (unlikely(gc_was_enabled == -1)) {
              Py_DECREF(gc);
              return -1;
          }
      #endif
          t->tp_flags |= Py_TPFLAGS_HEAPTYPE;
  #if PY_VERSION_HEX >= 0x030A0000
          t->tp_flags |= Py_TPFLAGS_IMMUTABLETYPE;
  #endif
  #else
          (void)__Pyx_PyObject_CallMethod0;
  #endif
      r = PyType_Ready(t);
  #if !defined(PYSTON_MAJOR_VERSION)
          t->tp_flags &= ~Py_TPFLAGS_HEAPTYPE;
      #if PY_VERSION_HEX >= 0x030A00b1
          if (gc_was_enabled)
              PyGC_Enable();
      #else
          if (gc_was_enabled) {
              PyObject *tp, *v, *tb;
              PyErr_Fetch(&tp, &v, &tb);
              ret = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_enable);
              if (likely(ret || r == -1)) {
                  Py_XDECREF(ret);
                  PyErr_Restore(tp, v, tb);
              } else {
                  Py_XDECREF(tp);
                  Py_XDECREF(v);
                  Py_XDECREF(tb);
                  r = -1;
              }
          }
          Py_DECREF(gc);
      #endif
      }
  #endif
      return r;
  #endif
  }
  
/* SetVTable */
  static int __Pyx_SetVtable(PyTypeObject *type, void *vtable) {
      PyObject *ob = PyCapsule_New(vtable, 0, 0);
      if (unlikely(!ob))
          goto bad;
  #if CYTHON_COMPILING_IN_LIMITED_API
      if (unlikely(PyObject_SetAttr((PyObject *) type, __pyx_mstate_global->__pyx_n_u_pyx_vtable, ob) < 0))
  #else
      if (unlikely(PyDict_SetItem(type->tp_dict, __pyx_mstate_global->__pyx_n_u_pyx_vtable, ob) < 0))
  #endif
          goto bad;
      Py_DECREF(ob);
      return 0;
  bad:
      Py_XDECREF(ob);
      return -1;
  }
  
/* GetVTable (used by MergeVTables) */
  static void* __Pyx_GetVtable(PyTypeObject *type) {
      void* ptr;
  #if CYTHON_COMPILING_IN_LIMITED_API
      PyObject *ob = PyObject_GetAttr((PyObject *)type, __pyx_mstate_global->__pyx_n_u_pyx_vtable);
  #else
      PyObject *ob = PyObject_GetItem(type->tp_dict, __pyx_mstate_global->__pyx_n_u_pyx_vtable);
  #endif
      if (!ob)
          goto bad;
      ptr = PyCapsule_GetPointer(ob, 0);
      if (!ptr && !PyErr_Occurred())
          PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type");
      Py_DECREF(ob);
      return ptr;
  bad:
      Py_XDECREF(ob);
      return NULL;
  }
  
/* MergeVTables */
  static int __Pyx_MergeVtables(PyTypeObject *type) {
      int i=0;
      Py_ssize_t size;
      void** base_vtables;
      __Pyx_TypeName tp_base_name = NULL;
      __Pyx_TypeName base_name = NULL;
      void* unknown = (void*)-1;
      PyObject* bases = __Pyx_PyType_GetSlot(type, tp_bases, PyObject*);
      int base_depth = 0;
      {
          PyTypeObject* base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*);
          while (base) {
              base_depth += 1;
              base = __Pyx_PyType_GetSlot(base, tp_base, PyTypeObject*);
          }
      }
      base_vtables = (void**) PyMem_Malloc(sizeof(void*) * (size_t)(base_depth + 1));
      base_vtables[0] = unknown;
  #if CYTHON_COMPILING_IN_LIMITED_API
      size = PyTuple_Size(bases);
      if (size < 0) goto other_failure;
  #else
      size = PyTuple_GET_SIZE(bases);
  #endif
      for (i = 1; i < size; i++) {
          PyObject *basei;
          void* base_vtable;
  #if CYTHON_AVOID_BORROWED_REFS
          basei = PySequence_GetItem(bases, i);
          if (unlikely(!basei)) goto other_failure;
  #elif !CYTHON_ASSUME_SAFE_MACROS
          basei = PyTuple_GetItem(bases, i);
          if (unlikely(!basei)) goto other_failure;
  #else
          basei = PyTuple_GET_ITEM(bases, i);
  #endif
          base_vtable = __Pyx_GetVtable((PyTypeObject*)basei);
  #if CYTHON_AVOID_BORROWED_REFS
          Py_DECREF(basei);
  #endif
          if (base_vtable != NULL) {
              int j;
              PyTypeObject* base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*);
              for (j = 0; j < base_depth; j++) {
                  if (base_vtables[j] == unknown) {
                      base_vtables[j] = __Pyx_GetVtable(base);
                      base_vtables[j + 1] = unknown;
                  }
                  if (base_vtables[j] == base_vtable) {
                      break;
                  } else if (base_vtables[j] == NULL) {
                      goto bad;
                  }
                  base = __Pyx_PyType_GetSlot(base, tp_base, PyTypeObject*);
              }
          }
      }
      PyErr_Clear();
      PyMem_Free(base_vtables);
      return 0;
  bad:
      {
          PyTypeObject* basei = NULL;
          PyTypeObject* tp_base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*);
          tp_base_name = __Pyx_PyType_GetFullyQualifiedName(tp_base);
  #if CYTHON_AVOID_BORROWED_REFS
          basei = (PyTypeObject*)PySequence_GetItem(bases, i);
          if (unlikely(!basei)) goto really_bad;
  #elif !CYTHON_ASSUME_SAFE_MACROS
          basei = (PyTypeObject*)PyTuple_GetItem(bases, i);
          if (unlikely(!basei)) goto really_bad;
  #else
          basei = (PyTypeObject*)PyTuple_GET_ITEM(bases, i);
  #endif
          base_name = __Pyx_PyType_GetFullyQualifiedName(basei);
  #if CYTHON_AVOID_BORROWED_REFS
          Py_DECREF(basei);
  #endif
      }
      PyErr_Format(PyExc_TypeError,
          "multiple bases have vtable conflict: '" __Pyx_FMT_TYPENAME "' and '" __Pyx_FMT_TYPENAME "'", tp_base_name, base_name);
  #if CYTHON_AVOID_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS
  really_bad: // bad has failed!
  #endif
      __Pyx_DECREF_TypeName(tp_base_name);
      __Pyx_DECREF_TypeName(base_name);
  #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_AVOID_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS
  other_failure:
  #endif
      PyMem_Free(base_vtables);
      return -1;
  }
  
/* DelItemOnTypeDict (used by SetupReduce) */
  static int __Pyx__DelItemOnTypeDict(PyTypeObject *tp, PyObject *k) {
      int result;
      PyObject *tp_dict;
  #if CYTHON_COMPILING_IN_LIMITED_API
      tp_dict = __Pyx_GetTypeDict(tp);
      if (unlikely(!tp_dict)) return -1;
  #else
      tp_dict = tp->tp_dict;
  #endif
      result = PyDict_DelItem(tp_dict, k);
      if (likely(!result)) PyType_Modified(tp);
      return result;
  }
  
/* SetupReduce */
  static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
    int ret;
    PyObject *name_attr;
    name_attr = __Pyx_PyObject_GetAttrStrNoError(meth, __pyx_mstate_global->__pyx_n_u_name_2);
    if (likely(name_attr)) {
        ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
    } else {
        ret = -1;
    }
    if (unlikely(ret < 0)) {
        PyErr_Clear();
        ret = 0;
    }
    Py_XDECREF(name_attr);
    return ret;
  }
  static int __Pyx_setup_reduce(PyObject* type_obj) {
      int ret = 0;
      PyObject *object_reduce = NULL;
      PyObject *object_getstate = NULL;
      PyObject *object_reduce_ex = NULL;
      PyObject *reduce = NULL;
      PyObject *reduce_ex = NULL;
      PyObject *reduce_cython = NULL;
      PyObject *setstate = NULL;
      PyObject *setstate_cython = NULL;
      PyObject *getstate = NULL;
  #if CYTHON_USE_PYTYPE_LOOKUP
      getstate = _PyType_Lookup((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_getstate);
  #else
      getstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_mstate_global->__pyx_n_u_getstate);
      if (!getstate && PyErr_Occurred()) {
          goto __PYX_BAD;
      }
  #endif
      if (getstate) {
  #if CYTHON_USE_PYTYPE_LOOKUP
          object_getstate = _PyType_Lookup(&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_getstate);
  #else
          object_getstate = __Pyx_PyObject_GetAttrStrNoError((PyObject*)&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_getstate);
          if (!object_getstate && PyErr_Occurred()) {
              goto __PYX_BAD;
          }
  #endif
          if (object_getstate != getstate) {
              goto __PYX_GOOD;
          }
      }
  #if CYTHON_USE_PYTYPE_LOOKUP
      object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
  #else
      object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
  #endif
      reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_mstate_global->__pyx_n_u_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD;
      if (reduce_ex == object_reduce_ex) {
  #if CYTHON_USE_PYTYPE_LOOKUP
          object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_reduce); if (!object_reduce) goto __PYX_BAD;
  #else
          object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_reduce); if (!object_reduce) goto __PYX_BAD;
  #endif
          reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_mstate_global->__pyx_n_u_reduce); if (unlikely(!reduce)) goto __PYX_BAD;
          if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_mstate_global->__pyx_n_u_reduce_cython)) {
              reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_mstate_global->__pyx_n_u_reduce_cython);
              if (likely(reduce_cython)) {
                  ret = __Pyx_SetItemOnTypeDict((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
                  ret = __Pyx_DelItemOnTypeDict((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
              } else if (reduce == object_reduce || PyErr_Occurred()) {
                  goto __PYX_BAD;
              }
              setstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_mstate_global->__pyx_n_u_setstate);
              if (!setstate) PyErr_Clear();
              if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_mstate_global->__pyx_n_u_setstate_cython)) {
                  setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_mstate_global->__pyx_n_u_setstate_cython);
                  if (likely(setstate_cython)) {
                      ret = __Pyx_SetItemOnTypeDict((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
                      ret = __Pyx_DelItemOnTypeDict((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
                  } else if (!setstate || PyErr_Occurred()) {
                      goto __PYX_BAD;
                  }
              }
              PyType_Modified((PyTypeObject*)type_obj);
          }
      }
      goto __PYX_GOOD;
  __PYX_BAD:
      if (!PyErr_Occurred()) {
          __Pyx_TypeName type_obj_name =
              __Pyx_PyType_GetFullyQualifiedName((PyTypeObject*)type_obj);
          PyErr_Format(PyExc_RuntimeError,
              "Unable to initialize pickling for " __Pyx_FMT_TYPENAME, type_obj_name);
          __Pyx_DECREF_TypeName(type_obj_name);
      }
      ret = -1;
  __PYX_GOOD:
  #if !CYTHON_USE_PYTYPE_LOOKUP
      Py_XDECREF(object_reduce);
      Py_XDECREF(object_reduce_ex);
      Py_XDECREF(object_getstate);
      Py_XDECREF(getstate);
  #endif
      Py_XDECREF(reduce);
      Py_XDECREF(reduce_ex);
      Py_XDECREF(reduce_cython);
      Py_XDECREF(setstate);
      Py_XDECREF(setstate_cython);
      return ret;
  }
  
/* TypeImport */
  #ifndef __PYX_HAVE_RT_ImportType_3_2_4
  #define __PYX_HAVE_RT_ImportType_3_2_4
  static PyTypeObject *__Pyx_ImportType_3_2_4(PyObject *module, const char *module_name, const char *class_name,
      size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_2_4 check_size)
  {
      PyObject *result = 0;
      Py_ssize_t basicsize;
      Py_ssize_t itemsize;
  #if defined(Py_LIMITED_API) || (defined(CYTHON_COMPILING_IN_LIMITED_API) && CYTHON_COMPILING_IN_LIMITED_API)
      PyObject *py_basicsize;
      PyObject *py_itemsize;
  #endif
      result = PyObject_GetAttrString(module, class_name);
      if (!result)
          goto bad;
      if (!PyType_Check(result)) {
          PyErr_Format(PyExc_TypeError,
              "%.200s.%.200s is not a type object",
              module_name, class_name);
          goto bad;
      }
  #if !( defined(Py_LIMITED_API) || (defined(CYTHON_COMPILING_IN_LIMITED_API) && CYTHON_COMPILING_IN_LIMITED_API) )
      basicsize = ((PyTypeObject *)result)->tp_basicsize;
      itemsize = ((PyTypeObject *)result)->tp_itemsize;
  #else
      if (size == 0) {
          return (PyTypeObject *)result;
      }
      py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
      if (!py_basicsize)
          goto bad;
      basicsize = PyLong_AsSsize_t(py_basicsize);
      Py_DECREF(py_basicsize);
      py_basicsize = 0;
      if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
          goto bad;
      py_itemsize = PyObject_GetAttrString(result, "__itemsize__");
      if (!py_itemsize)
          goto bad;
      itemsize = PyLong_AsSsize_t(py_itemsize);
      Py_DECREF(py_itemsize);
      py_itemsize = 0;
      if (itemsize == (Py_ssize_t)-1 && PyErr_Occurred())
          goto bad;
  #endif
      if (itemsize) {
          if (size % alignment) {
              alignment = size % alignment;
          }
          if (itemsize < (Py_ssize_t)alignment)
              itemsize = (Py_ssize_t)alignment;
      }
      if ((size_t)(basicsize + itemsize) < size) {
          PyErr_Format(PyExc_ValueError,
              "%.200s.%.200s size changed, may indicate binary incompatibility. "
              "Expected %zd from C header, got %zd from PyObject",
              module_name, class_name, size, basicsize+itemsize);
          goto bad;
      }
      if (check_size == __Pyx_ImportType_CheckSize_Error_3_2_4 &&
              ((size_t)basicsize > size || (size_t)(basicsize + itemsize) < size)) {
          PyErr_Format(PyExc_ValueError,
              "%.200s.%.200s size changed, may indicate binary incompatibility. "
              "Expected %zd from C header, got %zd-%zd from PyObject",
              module_name, class_name, size, basicsize, basicsize+itemsize);
          goto bad;
      }
      else if (check_size == __Pyx_ImportType_CheckSize_Warn_3_2_4 && (size_t)basicsize > size) {
          if (PyErr_WarnFormat(NULL, 0,
                  "%.200s.%.200s size changed, may indicate binary incompatibility. "
                  "Expected %zd from C header, got %zd from PyObject",
                  module_name, class_name, size, basicsize) < 0) {
              goto bad;
          }
      }
      return (PyTypeObject *)result;
  bad:
      Py_XDECREF(result);
      return NULL;
  }
  #endif
  
/* ListPack */
  static PyObject *__Pyx_PyList_Pack(Py_ssize_t n, ...) {
      va_list va;
      PyObject *l = PyList_New(n);
      va_start(va, n);
      if (unlikely(!l)) goto end;
      for (Py_ssize_t i=0; i<n; ++i) {
          PyObject *arg = va_arg(va, PyObject*);
          Py_INCREF(arg);
          if (__Pyx_PyList_SET_ITEM(l, i, arg) != (0)) {
              Py_CLEAR(l);
              goto end;
          }
      }
      end:
      va_end(va);
      return l;
  }
  
/* Py3UpdateBases */
  static PyObject*
  __Pyx_PEP560_update_bases(PyObject *bases)
  {
      Py_ssize_t i, j, size_bases;
      PyObject *base = NULL, *meth, *new_base, *result, *new_bases = NULL;
  #if CYTHON_ASSUME_SAFE_SIZE
      size_bases = PyTuple_GET_SIZE(bases);
  #else
      size_bases = PyTuple_Size(bases);
      if (size_bases < 0) return NULL;
  #endif
      for (i = 0; i < size_bases; i++) {
  #if CYTHON_AVOID_BORROWED_REFS
          Py_CLEAR(base);
  #endif
  #if CYTHON_ASSUME_SAFE_MACROS
          base = PyTuple_GET_ITEM(bases, i);
  #else
          base = PyTuple_GetItem(bases, i);
          if (!base) goto error;
  #endif
  #if CYTHON_AVOID_BORROWED_REFS
          Py_INCREF(base);
  #endif
          if (PyType_Check(base)) {
              if (new_bases) {
                  if (PyList_Append(new_bases, base) < 0) {
                      goto error;
                  }
              }
              continue;
          }
          meth = __Pyx_PyObject_GetAttrStrNoError(base, __pyx_mstate_global->__pyx_n_u_mro_entries);
          if (!meth && PyErr_Occurred()) {
              goto error;
          }
          if (!meth) {
              if (new_bases) {
                  if (PyList_Append(new_bases, base) < 0) {
                      goto error;
                  }
              }
              continue;
          }
          new_base = __Pyx_PyObject_CallOneArg(meth, bases);
          Py_DECREF(meth);
          if (!new_base) {
              goto error;
          }
          if (!PyTuple_Check(new_base)) {
              PyErr_SetString(PyExc_TypeError,
                              "__mro_entries__ must return a tuple");
              Py_DECREF(new_base);
              goto error;
          }
          if (!new_bases) {
              if (!(new_bases = PyList_New(i))) {
                  goto error;
              }
              for (j = 0; j < i; j++) {
                  PyObject *base_from_list;
  #if CYTHON_ASSUME_SAFE_MACROS
                  base_from_list = PyTuple_GET_ITEM(bases, j);
                  PyList_SET_ITEM(new_bases, j, base_from_list);
                  Py_INCREF(base_from_list);
  #else
                  base_from_list = PyTuple_GetItem(bases, j);
                  if (!base_from_list) goto error;
                  Py_INCREF(base_from_list);
                  if (PyList_SetItem(new_bases, j, base_from_list) < 0) goto error;
  #endif
              }
          }
  #if CYTHON_ASSUME_SAFE_SIZE
          j = PyList_GET_SIZE(new_bases);
  #else
          j = PyList_Size(new_bases);
          if (j < 0) goto error;
  #endif
          if (PyList_SetSlice(new_bases, j, j, new_base) < 0) {
              goto error;
          }
          Py_DECREF(new_base);
      }
      if (!new_bases) {
          Py_INCREF(bases);
          return bases;
      }
      result = PyList_AsTuple(new_bases);
      Py_DECREF(new_bases);
  #if CYTHON_AVOID_BORROWED_REFS
      Py_XDECREF(base);
  #endif
      return result;
  error:
      Py_XDECREF(new_bases);
  #if CYTHON_AVOID_BORROWED_REFS
      Py_XDECREF(base);
  #endif
      return NULL;
  }
  
/* CalculateMetaclass */
  static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) {
      Py_ssize_t i, nbases;
  #if CYTHON_ASSUME_SAFE_SIZE
      nbases = PyTuple_GET_SIZE(bases);
  #else
      nbases = PyTuple_Size(bases);
      if (nbases < 0) return NULL;
  #endif
      for (i=0; i < nbases; i++) {
          PyTypeObject *tmptype;
  #if CYTHON_ASSUME_SAFE_MACROS
          PyObject *tmp = PyTuple_GET_ITEM(bases, i);
  #else
          PyObject *tmp = PyTuple_GetItem(bases, i);
          if (!tmp) return NULL;
  #endif
          tmptype = Py_TYPE(tmp);
          if (!metaclass) {
              metaclass = tmptype;
              continue;
          }
          if (PyType_IsSubtype(metaclass, tmptype))
              continue;
          if (PyType_IsSubtype(tmptype, metaclass)) {
              metaclass = tmptype;
              continue;
          }
          PyErr_SetString(PyExc_TypeError,
                          "metaclass conflict: "
                          "the metaclass of a derived class "
                          "must be a (non-strict) subclass "
                          "of the metaclasses of all its bases");
          return NULL;
      }
      if (!metaclass) {
          metaclass = &PyType_Type;
      }
      Py_INCREF((PyObject*) metaclass);
      return (PyObject*) metaclass;
  }
  
/* Py3ClassCreate */
  static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name,
                                             PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) {
      PyObject *ns;
      if (metaclass) {
          PyObject *prep = __Pyx_PyObject_GetAttrStrNoError(metaclass, __pyx_mstate_global->__pyx_n_u_prepare);
          if (prep) {
              PyObject *pargs[3] = {NULL, name, bases};
              ns = __Pyx_PyObject_FastCallDict(prep, pargs+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, mkw);
              Py_DECREF(prep);
          } else {
              if (unlikely(PyErr_Occurred()))
                  return NULL;
              ns = PyDict_New();
          }
      } else {
          ns = PyDict_New();
      }
      if (unlikely(!ns))
          return NULL;
      if (unlikely(PyObject_SetItem(ns, __pyx_mstate_global->__pyx_n_u_module_2, modname) < 0)) goto bad;
      if (unlikely(PyObject_SetItem(ns, __pyx_mstate_global->__pyx_n_u_qualname, qualname) < 0)) goto bad;
      if (unlikely(doc && PyObject_SetItem(ns, __pyx_mstate_global->__pyx_n_u_doc_3, doc) < 0)) goto bad;
      return ns;
  bad:
      Py_DECREF(ns);
      return NULL;
  }
  static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases,
                                        PyObject *dict, PyObject *mkw,
                                        int calculate_metaclass, int allow_py2_metaclass) {
      PyObject *result;
      PyObject *owned_metaclass = NULL;
      PyObject *margs[4] = {NULL, name, bases, dict};
      if (allow_py2_metaclass) {
          owned_metaclass = PyObject_GetItem(dict, __pyx_mstate_global->__pyx_n_u_metaclass);
          if (owned_metaclass) {
              metaclass = owned_metaclass;
          } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) {
              PyErr_Clear();
          } else {
              return NULL;
          }
      }
      if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) {
          metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases);
          Py_XDECREF(owned_metaclass);
          if (unlikely(!metaclass))
              return NULL;
          owned_metaclass = metaclass;
      }
      result = __Pyx_PyObject_FastCallDict(metaclass, margs+1, 3 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, mkw);
      Py_XDECREF(owned_metaclass);
      return result;
  }
  
/* SetNewInClass */
  static int __Pyx_SetNewInClass(PyObject *ns, PyObject *name, PyObject *value) {
  #ifdef __Pyx_CyFunction_USED
      int ret;
      if (__Pyx_CyFunction_Check(value)) {
          PyObject *staticnew;
  #if !CYTHON_COMPILING_IN_LIMITED_API
          staticnew = PyStaticMethod_New(value);
  #else
          PyObject *builtins, *staticmethod_str, *staticmethod;
          builtins = PyEval_GetBuiltins(); // borrowed
          if (!builtins) return -1;
          staticmethod_str = PyUnicode_FromStringAndSize("staticmethod", 12);
          if (!staticmethod_str) return -1;
          staticmethod = PyObject_GetItem(builtins, staticmethod_str);
          Py_DECREF(staticmethod_str);
          if (!staticmethod) return -1;
          staticnew = PyObject_CallFunctionObjArgs(staticmethod, value, NULL);
          Py_DECREF(staticmethod);
  #endif
          if (unlikely(!staticnew)) return -1;
          ret = __Pyx_SetNameInClass(ns, name, staticnew);
          Py_DECREF(staticnew);
          return ret;
      }
  #endif
      return __Pyx_SetNameInClass(ns, name, value);
  }
  
/* ClassMethod */
  static PyObject* __Pyx_Method_ClassMethod(PyObject *method) {
  #if CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM <= 0x05080000
      if (PyObject_TypeCheck(method, &PyWrapperDescr_Type)) {
          return PyClassMethod_New(method);
      }
  #else
  #if CYTHON_COMPILING_IN_PYPY
      if (PyMethodDescr_Check(method))
  #else
      if (__Pyx_TypeCheck(method, &PyMethodDescr_Type))
  #endif
      {
  #if CYTHON_COMPILING_IN_LIMITED_API
          return PyErr_Format(
              PyExc_SystemError,
              "Cython cannot yet handle classmethod on a MethodDescriptorType (%S) in limited API mode. "
              "This is most likely a classmethod in a cdef class method with binding=False. "
              "Try setting 'binding' to True.",
              method);
  #elif CYTHON_COMPILING_IN_GRAAL && defined(GRAALPY_VERSION_NUM) && GRAALPY_VERSION_NUM > 0x19000000
          PyTypeObject *d_type = GraalPyDescrObject_GetType(method);
          return PyDescr_NewClassMethod(d_type, GraalPyMethodDescrObject_GetMethod(method));
  #elif CYTHON_COMPILING_IN_GRAAL
          PyTypeObject *d_type = PyDescrObject_GetType(method);
          return PyDescr_NewClassMethod(d_type, PyMethodDescrObject_GetMethod(method));
  #else
          PyMethodDescrObject *descr = (PyMethodDescrObject *)method;
          PyTypeObject *d_type = descr->d_common.d_type;
          return PyDescr_NewClassMethod(d_type, descr->d_method);
  #endif
      }
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
      else if (PyMethod_Check(method)) {
          return PyClassMethod_New(PyMethod_GET_FUNCTION(method));
      }
      else {
          return PyClassMethod_New(method);
      }
  #else
      {
          PyObject *func=NULL;
          PyObject *builtins, *classmethod, *classmethod_str, *result=NULL;
          if (__Pyx_TypeCheck(method, __pyx_mstate_global->__Pyx_CachedMethodType)) {
              func = PyObject_GetAttrString(method, "__func__");
              if (!func) goto bad;
          } else {
              func = method;
              Py_INCREF(func);
          }
          builtins = PyEval_GetBuiltins(); // borrowed
          if (unlikely(!builtins)) goto bad;
          classmethod_str = PyUnicode_FromString("classmethod");
          if (unlikely(!classmethod_str)) goto bad;
          classmethod = PyObject_GetItem(builtins, classmethod_str);
          Py_DECREF(classmethod_str);
          if (unlikely(!classmethod)) goto bad;
          result = PyObject_CallFunctionObjArgs(classmethod, func, NULL);
          Py_DECREF(classmethod);
          bad:
          Py_XDECREF(func);
          return result;
      }
  #endif
  }
  
/* GetNameInClass */
  static PyObject *__Pyx__GetNameInClass(PyObject *nmspace, PyObject *name) {
      PyObject *result;
      PyObject *dict;
      assert(PyType_Check(nmspace));
  #if CYTHON_USE_TYPE_SLOTS
      dict = ((PyTypeObject*)nmspace)->tp_dict;
      Py_XINCREF(dict);
  #else
      dict = PyObject_GetAttr(nmspace, __pyx_mstate_global->__pyx_n_u_dict);
  #endif
      if (likely(dict)) {
          result = PyObject_GetItem(dict, name);
          Py_DECREF(dict);
          if (result) {
              return result;
          }
      }
      PyErr_Clear();
      __Pyx_GetModuleGlobalNameUncached(result, name);
      return result;
  }
  
/* RegisterModuleCleanup */
  #if CYTHON_COMPILING_IN_PYPY
  static PyObject* __pyx_module_cleanup_atexit(PyObject *module, PyObject *unused) {
      CYTHON_UNUSED_VAR(unused);
      __pyx_module_cleanup(module);
      Py_INCREF(Py_None); return Py_None;
  }
  static int __Pyx_RegisterCleanup(void) {
      static PyMethodDef cleanup_def = {
          "__cleanup", (PyCFunction)__pyx_module_cleanup_atexit, METH_NOARGS, 0};
      PyObject *cleanup_func = 0;
      PyObject *atexit = 0;
      PyObject *reg = 0;
      PyObject *args = 0;
      PyObject *res = 0;
      int ret = -1;
      cleanup_func = PyCFunction_New(&cleanup_def, 0);
      if (!cleanup_func)
          goto bad;
      atexit = PyImport_ImportModule("atexit");
      if (!atexit)
          goto bad;
      reg = PyObject_GetAttrString(atexit, "_exithandlers");
      if (reg && PyList_Check(reg)) {
          PyObject *a, *kw;
          a = PyTuple_New(0);
          kw = PyDict_New();
          if (!a || !kw) {
              Py_XDECREF(a);
              Py_XDECREF(kw);
              goto bad;
          }
          args = PyTuple_Pack(3, cleanup_func, a, kw);
          Py_DECREF(a);
          Py_DECREF(kw);
          if (!args)
              goto bad;
          ret = PyList_Insert(reg, 0, args);
      } else {
          if (!reg)
              PyErr_Clear();
          Py_XDECREF(reg);
          reg = PyObject_GetAttrString(atexit, "register");
          if (!reg)
              goto bad;
          args = PyTuple_Pack(1, cleanup_func);
          if (!args)
              goto bad;
          res = PyObject_CallObject(reg, args);
          if (!res)
              goto bad;
          ret = 0;
      }
  bad:
      Py_XDECREF(cleanup_func);
      Py_XDECREF(atexit);
      Py_XDECREF(reg);
      Py_XDECREF(args);
      Py_XDECREF(res);
      return ret;
  }
  #endif
  
/* CLineInTraceback (used by AddTraceback) */
  #if CYTHON_CLINE_IN_TRACEBACK && CYTHON_CLINE_IN_TRACEBACK_RUNTIME
  #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
  #define __Pyx_PyProbablyModule_GetDict(o) __Pyx_XNewRef(PyModule_GetDict(o))
  #elif !CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  #define __Pyx_PyProbablyModule_GetDict(o) PyObject_GenericGetDict(o, NULL);
  #else
  PyObject* __Pyx_PyProbablyModule_GetDict(PyObject *o) {
      PyObject **dict_ptr = _PyObject_GetDictPtr(o);
      return dict_ptr ? __Pyx_XNewRef(*dict_ptr) : NULL;
  }
  #endif
  static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) {
      PyObject *use_cline = NULL;
      PyObject *ptype, *pvalue, *ptraceback;
      PyObject *cython_runtime_dict;
      CYTHON_MAYBE_UNUSED_VAR(tstate);
      if (unlikely(!__pyx_mstate_global->__pyx_cython_runtime)) {
          return c_line;
      }
      __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
      cython_runtime_dict = __Pyx_PyProbablyModule_GetDict(__pyx_mstate_global->__pyx_cython_runtime);
      if (likely(cython_runtime_dict)) {
          __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
              use_cline, cython_runtime_dict,
              __Pyx_PyDict_SetDefault(cython_runtime_dict, __pyx_mstate_global->__pyx_n_u_cline_in_traceback, Py_False))
      }
      if (use_cline == NULL || use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
          c_line = 0;
      }
      Py_XDECREF(use_cline);
      Py_XDECREF(cython_runtime_dict);
      __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
      return c_line;
  }
  #endif
  
/* CodeObjectCache (used by AddTraceback) */
  static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
      int start = 0, mid = 0, end = count - 1;
      if (end >= 0 && code_line > entries[end].code_line) {
          return count;
      }
      while (start < end) {
          mid = start + (end - start) / 2;
          if (code_line < entries[mid].code_line) {
              end = mid;
          } else if (code_line > entries[mid].code_line) {
               start = mid + 1;
          } else {
              return mid;
          }
      }
      if (code_line <= entries[mid].code_line) {
          return mid;
      } else {
          return mid + 1;
      }
  }
  static __Pyx_CachedCodeObjectType *__pyx__find_code_object(struct __Pyx_CodeObjectCache *code_cache, int code_line) {
      __Pyx_CachedCodeObjectType* code_object;
      int pos;
      if (unlikely(!code_line) || unlikely(!code_cache->entries)) {
          return NULL;
      }
      pos = __pyx_bisect_code_objects(code_cache->entries, code_cache->count, code_line);
      if (unlikely(pos >= code_cache->count) || unlikely(code_cache->entries[pos].code_line != code_line)) {
          return NULL;
      }
      code_object = code_cache->entries[pos].code_object;
      Py_INCREF(code_object);
      return code_object;
  }
  static __Pyx_CachedCodeObjectType *__pyx_find_code_object(int code_line) {
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && !CYTHON_ATOMICS
      (void)__pyx__find_code_object;
      return NULL; // Most implementation should have atomics. But otherwise, don't make it thread-safe, just miss.
  #else
      struct __Pyx_CodeObjectCache *code_cache = &__pyx_mstate_global->__pyx_code_cache;
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
      __pyx_nonatomic_int_type old_count = __pyx_atomic_incr_acq_rel(&code_cache->accessor_count);
      if (old_count < 0) {
          __pyx_atomic_decr_acq_rel(&code_cache->accessor_count);
          return NULL;
      }
  #endif
      __Pyx_CachedCodeObjectType *result = __pyx__find_code_object(code_cache, code_line);
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
      __pyx_atomic_decr_acq_rel(&code_cache->accessor_count);
  #endif
      return result;
  #endif
  }
  static void __pyx__insert_code_object(struct __Pyx_CodeObjectCache *code_cache, int code_line, __Pyx_CachedCodeObjectType* code_object)
  {
      int pos, i;
      __Pyx_CodeObjectCacheEntry* entries = code_cache->entries;
      if (unlikely(!code_line)) {
          return;
      }
      if (unlikely(!entries)) {
          entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
          if (likely(entries)) {
              code_cache->entries = entries;
              code_cache->max_count = 64;
              code_cache->count = 1;
              entries[0].code_line = code_line;
              entries[0].code_object = code_object;
              Py_INCREF(code_object);
          }
          return;
      }
      pos = __pyx_bisect_code_objects(code_cache->entries, code_cache->count, code_line);
      if ((pos < code_cache->count) && unlikely(code_cache->entries[pos].code_line == code_line)) {
          __Pyx_CachedCodeObjectType* tmp = entries[pos].code_object;
          entries[pos].code_object = code_object;
          Py_INCREF(code_object);
          Py_DECREF(tmp);
          return;
      }
      if (code_cache->count == code_cache->max_count) {
          int new_max = code_cache->max_count + 64;
          entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
              code_cache->entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
          if (unlikely(!entries)) {
              return;
          }
          code_cache->entries = entries;
          code_cache->max_count = new_max;
      }
      for (i=code_cache->count; i>pos; i--) {
          entries[i] = entries[i-1];
      }
      entries[pos].code_line = code_line;
      entries[pos].code_object = code_object;
      code_cache->count++;
      Py_INCREF(code_object);
  }
  static void __pyx_insert_code_object(int code_line, __Pyx_CachedCodeObjectType* code_object) {
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && !CYTHON_ATOMICS
      (void)__pyx__insert_code_object;
      return; // Most implementation should have atomics. But otherwise, don't make it thread-safe, just fail.
  #else
      struct __Pyx_CodeObjectCache *code_cache = &__pyx_mstate_global->__pyx_code_cache;
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
      __pyx_nonatomic_int_type expected = 0;
      if (!__pyx_atomic_int_cmp_exchange(&code_cache->accessor_count, &expected, INT_MIN)) {
          return;
      }
  #endif
      __pyx__insert_code_object(code_cache, code_line, code_object);
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
      __pyx_atomic_sub(&code_cache->accessor_count, INT_MIN);
  #endif
  #endif
  }
  
/* AddTraceback */
  #include "compile.h"
  #include "frameobject.h"
  #include "traceback.h"
  #if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION)
    #ifndef Py_BUILD_CORE
      #define Py_BUILD_CORE 1
    #endif
    #include "internal/pycore_frame.h"
  #endif
  #if CYTHON_COMPILING_IN_LIMITED_API
  static PyObject *__Pyx_PyCode_Replace_For_AddTraceback(PyObject *code, PyObject *scratch_dict,
                                                         PyObject *firstlineno, PyObject *name) {
      PyObject *replace = NULL;
      if (unlikely(PyDict_SetItemString(scratch_dict, "co_firstlineno", firstlineno))) return NULL;
      if (unlikely(PyDict_SetItemString(scratch_dict, "co_name", name))) return NULL;
      replace = PyObject_GetAttrString(code, "replace");
      if (likely(replace)) {
          PyObject *result = PyObject_Call(replace, __pyx_mstate_global->__pyx_empty_tuple, scratch_dict);
          Py_DECREF(replace);
          return result;
      }
      PyErr_Clear();
      return NULL;
  }
  static void __Pyx_AddTraceback(const char *funcname, int c_line,
                                 int py_line, const char *filename) {
      PyObject *code_object = NULL, *py_py_line = NULL, *py_funcname = NULL, *dict = NULL;
      PyObject *replace = NULL, *getframe = NULL, *frame = NULL;
      PyObject *exc_type, *exc_value, *exc_traceback;
      int success = 0;
      if (c_line) {
          c_line = __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line);
      }
      PyErr_Fetch(&exc_type, &exc_value, &exc_traceback);
      code_object = __pyx_find_code_object(c_line ? -c_line : py_line);
      if (!code_object) {
          code_object = Py_CompileString("_getframe()", filename, Py_eval_input);
          if (unlikely(!code_object)) goto bad;
          py_py_line = PyLong_FromLong(py_line);
          if (unlikely(!py_py_line)) goto bad;
          if (c_line) {
              py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
          } else {
              py_funcname = PyUnicode_FromString(funcname);
          }
          if (unlikely(!py_funcname)) goto bad;
          dict = PyDict_New();
          if (unlikely(!dict)) goto bad;
          {
              PyObject *old_code_object = code_object;
              code_object = __Pyx_PyCode_Replace_For_AddTraceback(code_object, dict, py_py_line, py_funcname);
              Py_DECREF(old_code_object);
          }
          if (unlikely(!code_object)) goto bad;
          __pyx_insert_code_object(c_line ? -c_line : py_line, code_object);
      } else {
          dict = PyDict_New();
      }
      getframe = PySys_GetObject("_getframe");
      if (unlikely(!getframe)) goto bad;
      if (unlikely(PyDict_SetItemString(dict, "_getframe", getframe))) goto bad;
      frame = PyEval_EvalCode(code_object, dict, dict);
      if (unlikely(!frame) || frame == Py_None) goto bad;
      success = 1;
    bad:
      PyErr_Restore(exc_type, exc_value, exc_traceback);
      Py_XDECREF(code_object);
      Py_XDECREF(py_py_line);
      Py_XDECREF(py_funcname);
      Py_XDECREF(dict);
      Py_XDECREF(replace);
      if (success) {
          PyTraceBack_Here(
              (struct _frame*)frame);
      }
      Py_XDECREF(frame);
  }
  #else
  static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
              const char *funcname, int c_line,
              int py_line, const char *filename) {
      PyCodeObject *py_code = NULL;
      PyObject *py_funcname = NULL;
      if (c_line) {
          py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
          if (!py_funcname) goto bad;
          funcname = PyUnicode_AsUTF8(py_funcname);
          if (!funcname) goto bad;
      }
      py_code = PyCode_NewEmpty(filename, funcname, py_line);
      Py_XDECREF(py_funcname);
      return py_code;
  bad:
      Py_XDECREF(py_funcname);
      return NULL;
  }
  static void __Pyx_AddTraceback(const char *funcname, int c_line,
                                 int py_line, const char *filename) {
      PyCodeObject *py_code = 0;
      PyFrameObject *py_frame = 0;
      PyThreadState *tstate = __Pyx_PyThreadState_Current;
      PyObject *ptype, *pvalue, *ptraceback;
      if (c_line) {
          c_line = __Pyx_CLineForTraceback(tstate, c_line);
      }
      py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
      if (!py_code) {
          __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
          py_code = __Pyx_CreateCodeObjectForTraceback(
              funcname, c_line, py_line, filename);
          if (!py_code) {
              /* If the code object creation fails, then we should clear the
                 fetched exception references and propagate the new exception */
              Py_XDECREF(ptype);
              Py_XDECREF(pvalue);
              Py_XDECREF(ptraceback);
              goto bad;
          }
          __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
          __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
      }
      py_frame = PyFrame_New(
          tstate,            /*PyThreadState *tstate,*/
          py_code,           /*PyCodeObject *code,*/
          __pyx_mstate_global->__pyx_d,    /*PyObject *globals,*/
          0                  /*PyObject *locals*/
      );
      if (!py_frame) goto bad;
      __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
      PyTraceBack_Here(py_frame);
  bad:
      Py_XDECREF(py_code);
      Py_XDECREF(py_frame);
  }
  #endif
  
/* MemviewRefcount */
  #include <stdio.h>
  #ifndef _Py_NO_RETURN
  #define _Py_NO_RETURN
  #endif
  _Py_NO_RETURN
  static void __pyx_fatalerror(const char *fmt, ...) {
      va_list vargs;
      char msg[200];
  #if PY_VERSION_HEX >= 0x030A0000 || defined(HAVE_STDARG_PROTOTYPES)
      va_start(vargs, fmt);
  #else
      va_start(vargs);
  #endif
      vsnprintf(msg, 200, fmt, vargs);
      va_end(vargs);
      Py_FatalError(msg);
  }
  static CYTHON_INLINE int
  __pyx_add_acquisition_count_locked(__pyx_atomic_int_type *acquisition_count,
                                     PyThread_type_lock lock)
  {
      int result;
      PyThread_acquire_lock(lock, 1);
      result = (*acquisition_count)++;
      PyThread_release_lock(lock);
      return result;
  }
  static CYTHON_INLINE int
  __pyx_sub_acquisition_count_locked(__pyx_atomic_int_type *acquisition_count,
                                     PyThread_type_lock lock)
  {
      int result;
      PyThread_acquire_lock(lock, 1);
      result = (*acquisition_count)--;
      PyThread_release_lock(lock);
      return result;
  }
  static CYTHON_INLINE void
  __Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno)
  {
      __pyx_nonatomic_int_type old_acquisition_count;
      struct __pyx_memoryview_obj *memview = memslice->memview;
      if (unlikely(!memview || (PyObject *) memview == Py_None)) {
          return;
      }
      old_acquisition_count = __pyx_add_acquisition_count(memview);
      if (unlikely(old_acquisition_count <= 0)) {
          if (likely(old_acquisition_count == 0)) {
              if (have_gil) {
                  Py_INCREF((PyObject *) memview);
              } else {
                  PyGILState_STATE _gilstate = PyGILState_Ensure();
                  Py_INCREF((PyObject *) memview);
                  PyGILState_Release(_gilstate);
              }
          } else {
              __pyx_fatalerror("Acquisition count is %d (line %d)",
                               old_acquisition_count+1, lineno);
          }
      }
  }
  static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice,
                                               int have_gil, int lineno) {
      __pyx_nonatomic_int_type old_acquisition_count;
      struct __pyx_memoryview_obj *memview = memslice->memview;
      if (unlikely(!memview || (PyObject *) memview == Py_None)) {
          memslice->memview = NULL;
          return;
      }
      old_acquisition_count = __pyx_sub_acquisition_count(memview);
      memslice->data = NULL;
      if (likely(old_acquisition_count > 1)) {
          memslice->memview = NULL;
      } else if (likely(old_acquisition_count == 1)) {
          if (have_gil) {
              Py_CLEAR(memslice->memview);
          } else {
              PyGILState_STATE _gilstate = PyGILState_Ensure();
              Py_CLEAR(memslice->memview);
              PyGILState_Release(_gilstate);
          }
      } else {
          __pyx_fatalerror("Acquisition count is %d (line %d)",
                           old_acquisition_count-1, lineno);
      }
  }
  
/* MemviewSliceIsContig */
  static int
  __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim)
  {
      int i, index, step, start;
      Py_ssize_t itemsize = mvs.memview->view.itemsize;
      if (order == 'F') {
          step = 1;
          start = 0;
      } else {
          step = -1;
          start = ndim - 1;
      }
      for (i = 0; i < ndim; i++) {
          index = start + step * i;
          if (mvs.suboffsets[index] >= 0 || mvs.strides[index] != itemsize)
              return 0;
          itemsize *= mvs.shape[index];
      }
      return 1;
  }
  
/* OverlappingSlices */
  static void
  __pyx_get_array_memory_extents(__Pyx_memviewslice *slice,
                                 void **out_start, void **out_end,
                                 int ndim, size_t itemsize)
  {
      char *start, *end;
      int i;
      start = end = slice->data;
      for (i = 0; i < ndim; i++) {
          Py_ssize_t stride = slice->strides[i];
          Py_ssize_t extent = slice->shape[i];
          if (extent == 0) {
              *out_start = *out_end = start;
              return;
          } else {
              if (stride > 0)
                  end += stride * (extent - 1);
              else
                  start += stride * (extent - 1);
          }
      }
      *out_start = start;
      *out_end = end + itemsize;
  }
  static int
  __pyx_slices_overlap(__Pyx_memviewslice *slice1,
                       __Pyx_memviewslice *slice2,
                       int ndim, size_t itemsize)
  {
      void *start1, *end1, *start2, *end2;
      __pyx_get_array_memory_extents(slice1, &start1, &end1, ndim, itemsize);
      __pyx_get_array_memory_extents(slice2, &start2, &end2, ndim, itemsize);
      return (start1 < end2) && (start2 < end1);
  }
  
/* MemviewSliceInit */
  static int
  __Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview,
                          int ndim,
                          __Pyx_memviewslice *memviewslice,
                          int memview_is_new_reference)
  {
      __Pyx_RefNannyDeclarations
      int i, retval=-1;
      Py_buffer *buf = &memview->view;
      __Pyx_RefNannySetupContext("init_memviewslice", 0);
      if (unlikely(memviewslice->memview || memviewslice->data)) {
          PyErr_SetString(PyExc_ValueError,
              "memviewslice is already initialized!");
          goto fail;
      }
      if (buf->strides) {
          for (i = 0; i < ndim; i++) {
              memviewslice->strides[i] = buf->strides[i];
          }
      } else {
          Py_ssize_t stride = buf->itemsize;
          for (i = ndim - 1; i >= 0; i--) {
              memviewslice->strides[i] = stride;
              stride *= buf->shape[i];
          }
      }
      for (i = 0; i < ndim; i++) {
          memviewslice->shape[i]   = buf->shape[i];
          if (buf->suboffsets) {
              memviewslice->suboffsets[i] = buf->suboffsets[i];
          } else {
              memviewslice->suboffsets[i] = -1;
          }
      }
      memviewslice->memview = memview;
      memviewslice->data = (char *)buf->buf;
      if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) {
          Py_INCREF((PyObject*)memview);
      }
      retval = 0;
      goto no_fail;
  fail:
      memviewslice->memview = 0;
      memviewslice->data = 0;
      retval = -1;
  no_fail:
      __Pyx_RefNannyFinishContext();
      return retval;
  }
  
/* CIntFromPyVerify */
  #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
      __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
  #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
      __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
  #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
      {\
          func_type value = func_value;\
          if (sizeof(target_type) < sizeof(func_type)) {\
              if (unlikely(value != (func_type) (target_type) value)) {\
                  func_type zero = 0;\
                  if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
                      return (target_type) -1;\
                  if (is_unsigned && unlikely(value < zero))\
                      goto raise_neg_overflow;\
                  else\
                      goto raise_overflow;\
              }\
          }\
          return (target_type) value;\
      }
  
/* IsLittleEndian (used by BufferFormatCheck) */
  static CYTHON_INLINE int __Pyx_Is_Little_Endian(void)
  {
    union {
      uint32_t u32;
      uint8_t u8[4];
    } S;
    S.u32 = 0x01020304;
    return S.u8[0] == 4;
  }
  
/* BufferFormatCheck (used by MemviewSliceValidateAndInit) */
  static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
                                __Pyx_BufFmt_StackElem* stack,
                                const __Pyx_TypeInfo* type) {
    stack[0].field = &ctx->root;
    stack[0].parent_offset = 0;
    ctx->root.type = type;
    ctx->root.name = "buffer dtype";
    ctx->root.offset = 0;
    ctx->head = stack;
    ctx->head->field = &ctx->root;
    ctx->fmt_offset = 0;
    ctx->head->parent_offset = 0;
    ctx->new_packmode = '@';
    ctx->enc_packmode = '@';
    ctx->new_count = 1;
    ctx->enc_count = 0;
    ctx->enc_type = 0;
    ctx->is_complex = 0;
    ctx->is_valid_array = 0;
    ctx->struct_alignment = 0;
    while (type->typegroup == 'S') {
      ++ctx->head;
      ctx->head->field = type->fields;
      ctx->head->parent_offset = 0;
      type = type->fields->type;
    }
  }
  static int __Pyx_BufFmt_ParseNumber(const char** ts) {
      int count;
      const char* t = *ts;
      if (*t < '0' || *t > '9') {
        return -1;
      } else {
          count = *t++ - '0';
          while (*t >= '0' && *t <= '9') {
              count *= 10;
              count += *t++ - '0';
          }
      }
      *ts = t;
      return count;
  }
  static int __Pyx_BufFmt_ExpectNumber(const char **ts) {
      int number = __Pyx_BufFmt_ParseNumber(ts);
      if (number == -1)
          PyErr_Format(PyExc_ValueError,\
                       "Does not understand character buffer dtype format string ('%c')", **ts);
      return number;
  }
  static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
    PyErr_Format(PyExc_ValueError,
                 "Unexpected format string character: '%c'", ch);
  }
  static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
    switch (ch) {
      case '?': return "'bool'";
      case 'c': return "'char'";
      case 'b': return "'signed char'";
      case 'B': return "'unsigned char'";
      case 'h': return "'short'";
      case 'H': return "'unsigned short'";
      case 'i': return "'int'";
      case 'I': return "'unsigned int'";
      case 'l': return "'long'";
      case 'L': return "'unsigned long'";
      case 'q': return "'long long'";
      case 'Q': return "'unsigned long long'";
      case 'f': return (is_complex ? "'complex float'" : "'float'");
      case 'd': return (is_complex ? "'complex double'" : "'double'");
      case 'g': return (is_complex ? "'complex long double'" : "'long double'");
      case 'T': return "a struct";
      case 'O': return "Python object";
      case 'P': return "a pointer";
      case 's': case 'p': return "a string";
      case 0: return "end";
      default: return "unparsable format string";
    }
  }
  static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
    switch (ch) {
      case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
      case 'h': case 'H': return 2;
      case 'i': case 'I': case 'l': case 'L': return 4;
      case 'q': case 'Q': return 8;
      case 'f': return (is_complex ? 8 : 4);
      case 'd': return (is_complex ? 16 : 8);
      case 'g': {
        PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
        return 0;
      }
      case 'O': case 'P': return sizeof(void*);
      default:
        __Pyx_BufFmt_RaiseUnexpectedChar(ch);
        return 0;
      }
  }
  static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
    switch (ch) {
      case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
      case 'h': case 'H': return sizeof(short);
      case 'i': case 'I': return sizeof(int);
      case 'l': case 'L': return sizeof(long);
      case 'q': case 'Q': return sizeof(PY_LONG_LONG);
      case 'f': return sizeof(float) * (is_complex ? 2 : 1);
      case 'd': return sizeof(double) * (is_complex ? 2 : 1);
      case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
      case 'O': case 'P': return sizeof(void*);
      default: {
        __Pyx_BufFmt_RaiseUnexpectedChar(ch);
        return 0;
      }
    }
  }
  typedef struct { char c; short x; } __Pyx_st_short;
  typedef struct { char c; int x; } __Pyx_st_int;
  typedef struct { char c; long x; } __Pyx_st_long;
  typedef struct { char c; float x; } __Pyx_st_float;
  typedef struct { char c; double x; } __Pyx_st_double;
  typedef struct { char c; long double x; } __Pyx_st_longdouble;
  typedef struct { char c; void *x; } __Pyx_st_void_p;
  typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong;
  static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, int is_complex) {
    CYTHON_UNUSED_VAR(is_complex);
    switch (ch) {
      case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
      case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
      case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
      case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
      case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG);
      case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
      case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
      case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
      case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
      default:
        __Pyx_BufFmt_RaiseUnexpectedChar(ch);
        return 0;
      }
  }
  /* These are for computing the padding at the end of the struct to align
     on the first member of the struct. This will probably the same as above,
     but we don't have any guarantees.
   */
  typedef struct { short x; char c; } __Pyx_pad_short;
  typedef struct { int x; char c; } __Pyx_pad_int;
  typedef struct { long x; char c; } __Pyx_pad_long;
  typedef struct { float x; char c; } __Pyx_pad_float;
  typedef struct { double x; char c; } __Pyx_pad_double;
  typedef struct { long double x; char c; } __Pyx_pad_longdouble;
  typedef struct { void *x; char c; } __Pyx_pad_void_p;
  typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong;
  static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, int is_complex) {
    CYTHON_UNUSED_VAR(is_complex);
    switch (ch) {
      case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
      case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short);
      case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int);
      case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long);
      case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG);
      case 'f': return sizeof(__Pyx_pad_float) - sizeof(float);
      case 'd': return sizeof(__Pyx_pad_double) - sizeof(double);
      case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double);
      case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*);
      default:
        __Pyx_BufFmt_RaiseUnexpectedChar(ch);
        return 0;
      }
  }
  static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
    switch (ch) {
      case 'c':
          return 'H';
      case 'b': case 'h': case 'i':
      case 'l': case 'q': case 's': case 'p':
          return 'I';
      case '?': case 'B': case 'H': case 'I': case 'L': case 'Q':
          return 'U';
      case 'f': case 'd': case 'g':
          return (is_complex ? 'C' : 'R');
      case 'O':
          return 'O';
      case 'P':
          return 'P';
      default: {
        __Pyx_BufFmt_RaiseUnexpectedChar(ch);
        return 0;
      }
    }
  }
  static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
    if (ctx->head == NULL || ctx->head->field == &ctx->root) {
      const char* expected;
      const char* quote;
      if (ctx->head == NULL) {
        expected = "end";
        quote = "";
      } else {
        expected = ctx->head->field->type->name;
        quote = "'";
      }
      PyErr_Format(PyExc_ValueError,
                   "Buffer dtype mismatch, expected %s%s%s but got %s",
                   quote, expected, quote,
                   __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
    } else {
      const __Pyx_StructField* field = ctx->head->field;
      const __Pyx_StructField* parent = (ctx->head - 1)->field;
      PyErr_Format(PyExc_ValueError,
                   "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
                   field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
                   parent->type->name, field->name);
    }
  }
  static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
    char group;
    size_t size, offset, arraysize = 1;
    if (ctx->enc_type == 0) return 0;
    if (ctx->head->field->type->arraysize[0]) {
      int i, ndim = 0;
      if (ctx->enc_type == 's' || ctx->enc_type == 'p') {
          ctx->is_valid_array = ctx->head->field->type->ndim == 1;
          ndim = 1;
          if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
              PyErr_Format(PyExc_ValueError,
                           "Expected a dimension of size %zu, got %zu",
                           ctx->head->field->type->arraysize[0], ctx->enc_count);
              return -1;
          }
      }
      if (!ctx->is_valid_array) {
        PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d",
                     ctx->head->field->type->ndim, ndim);
        return -1;
      }
      for (i = 0; i < ctx->head->field->type->ndim; i++) {
        arraysize *= ctx->head->field->type->arraysize[i];
      }
      ctx->is_valid_array = 0;
      ctx->enc_count = 1;
    }
    group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
    do {
      const __Pyx_StructField* field = ctx->head->field;
      const __Pyx_TypeInfo* type = field->type;
      if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') {
        size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
      } else {
        size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
      }
      if (ctx->enc_packmode == '@') {
        size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
        size_t align_mod_offset;
        if (align_at == 0) return -1;
        align_mod_offset = ctx->fmt_offset % align_at;
        if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
        if (ctx->struct_alignment == 0)
            ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
                                                                   ctx->is_complex);
      }
      if (type->size != size || type->typegroup != group) {
        if (type->typegroup == 'C' && type->fields != NULL) {
          size_t parent_offset = ctx->head->parent_offset + field->offset;
          ++ctx->head;
          ctx->head->field = type->fields;
          ctx->head->parent_offset = parent_offset;
          continue;
        }
        if ((type->typegroup == 'H' || group == 'H') && type->size == size) {
        } else {
            __Pyx_BufFmt_RaiseExpected(ctx);
            return -1;
        }
      }
      offset = ctx->head->parent_offset + field->offset;
      if (ctx->fmt_offset != offset) {
        PyErr_Format(PyExc_ValueError,
                     "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected",
                     (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
        return -1;
      }
      ctx->fmt_offset += size;
      if (arraysize)
        ctx->fmt_offset += (arraysize - 1) * size;
      --ctx->enc_count;
      while (1) {
        if (field == &ctx->root) {
          ctx->head = NULL;
          if (ctx->enc_count != 0) {
            __Pyx_BufFmt_RaiseExpected(ctx);
            return -1;
          }
          break;
        }
        ctx->head->field = ++field;
        if (field->type == NULL) {
          --ctx->head;
          field = ctx->head->field;
          continue;
        } else if (field->type->typegroup == 'S') {
          size_t parent_offset = ctx->head->parent_offset + field->offset;
          if (field->type->fields->type == NULL) continue;
          field = field->type->fields;
          ++ctx->head;
          ctx->head->field = field;
          ctx->head->parent_offset = parent_offset;
          break;
        } else {
          break;
        }
      }
    } while (ctx->enc_count);
    ctx->enc_type = 0;
    ctx->is_complex = 0;
    return 0;
  }
  static int
  __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
  {
      const char *ts = *tsp;
      int i = 0, number, ndim;
      ++ts;
      if (ctx->new_count != 1) {
          PyErr_SetString(PyExc_ValueError,
                          "Cannot handle repeated arrays in format string");
          return -1;
      }
      if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return -1;
      ndim = ctx->head->field->type->ndim;
      while (*ts && *ts != ')') {
          switch (*ts) {
              case ' ': case '\f': case '\r': case '\n': case '\t': case '\v':  continue;
              default:  break;
          }
          number = __Pyx_BufFmt_ExpectNumber(&ts);
          if (number == -1) return -1;
          if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i]) {
              PyErr_Format(PyExc_ValueError,
                          "Expected a dimension of size %zu, got %d",
                          ctx->head->field->type->arraysize[i], number);
              return -1;
          }
          if (*ts != ',' && *ts != ')') {
              PyErr_Format(PyExc_ValueError,
                                  "Expected a comma in format string, got '%c'", *ts);
              return -1;
          }
          if (*ts == ',') ts++;
          i++;
      }
      if (i != ndim) {
          PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d",
                              ctx->head->field->type->ndim, i);
          return -1;
      }
      if (!*ts) {
          PyErr_SetString(PyExc_ValueError,
                          "Unexpected end of format string, expected ')'");
          return -1;
      }
      ctx->is_valid_array = 1;
      ctx->new_count = 1;
      *tsp = ++ts;
      return 0;
  }
  static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
    int got_Z = 0;
    while (1) {
      switch(*ts) {
        case 0:
          if (ctx->enc_type != 0 && ctx->head == NULL) {
            __Pyx_BufFmt_RaiseExpected(ctx);
            return NULL;
          }
          if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
          if (ctx->head != NULL) {
            __Pyx_BufFmt_RaiseExpected(ctx);
            return NULL;
          }
          return ts;
        case ' ':
        case '\r':
        case '\n':
          ++ts;
          break;
        case '<':
          if (!__Pyx_Is_Little_Endian()) {
            PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
            return NULL;
          }
          ctx->new_packmode = '=';
          ++ts;
          break;
        case '>':
        case '!':
          if (__Pyx_Is_Little_Endian()) {
            PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
            return NULL;
          }
          ctx->new_packmode = '=';
          ++ts;
          break;
        case '=':
        case '@':
        case '^':
          ctx->new_packmode = *ts++;
          break;
        case 'T':
          {
            const char* ts_after_sub;
            size_t i, struct_count = ctx->new_count;
            size_t struct_alignment = ctx->struct_alignment;
            ctx->new_count = 1;
            ++ts;
            if (*ts != '{') {
              PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
              return NULL;
            }
            if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
            ctx->enc_type = 0;
            ctx->enc_count = 0;
            ctx->struct_alignment = 0;
            ++ts;
            ts_after_sub = ts;
            for (i = 0; i != struct_count; ++i) {
              ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
              if (!ts_after_sub) return NULL;
            }
            ts = ts_after_sub;
            if (struct_alignment) ctx->struct_alignment = struct_alignment;
          }
          break;
        case '}':
          {
            size_t alignment = ctx->struct_alignment;
            ++ts;
            if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
            ctx->enc_type = 0;
            if (alignment && ctx->fmt_offset % alignment) {
              ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
            }
          }
          return ts;
        case 'x':
          if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
          ctx->fmt_offset += ctx->new_count;
          ctx->new_count = 1;
          ctx->enc_count = 0;
          ctx->enc_type = 0;
          ctx->enc_packmode = ctx->new_packmode;
          ++ts;
          break;
        case 'Z':
          got_Z = 1;
          ++ts;
          if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
            __Pyx_BufFmt_RaiseUnexpectedChar('Z');
            return NULL;
          }
          CYTHON_FALLTHROUGH;
        case '?': case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
        case 'l': case 'L': case 'q': case 'Q':
        case 'f': case 'd': case 'g':
        case 'O': case 'p':
          if ((ctx->enc_type == *ts) && (got_Z == ctx->is_complex) &&
              (ctx->enc_packmode == ctx->new_packmode) && (!ctx->is_valid_array)) {
            ctx->enc_count += ctx->new_count;
            ctx->new_count = 1;
            got_Z = 0;
            ++ts;
            break;
          }
          CYTHON_FALLTHROUGH;
        case 's':
          if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
          ctx->enc_count = ctx->new_count;
          ctx->enc_packmode = ctx->new_packmode;
          ctx->enc_type = *ts;
          ctx->is_complex = got_Z;
          ++ts;
          ctx->new_count = 1;
          got_Z = 0;
          break;
        case ':':
          ++ts;
          while(*ts != ':') ++ts;
          ++ts;
          break;
        case '(':
          if (__pyx_buffmt_parse_array(ctx, &ts) < 0) return NULL;
          break;
        default:
          {
            int number = __Pyx_BufFmt_ExpectNumber(&ts);
            if (number == -1) return NULL;
            ctx->new_count = (size_t)number;
          }
      }
    }
  }
  
/* TypeInfoCompare (used by MemviewSliceValidateAndInit) */
    static int
    __pyx_typeinfo_cmp(const __Pyx_TypeInfo *a, const __Pyx_TypeInfo *b)
    {
        int i;
        if (!a || !b)
            return 0;
        if (a == b)
            return 1;
        if (a->size != b->size || a->typegroup != b->typegroup ||
                a->is_unsigned != b->is_unsigned || a->ndim != b->ndim) {
            if (a->typegroup == 'H' || b->typegroup == 'H') {
                return a->size == b->size;
            } else {
                return 0;
            }
        }
        if (a->ndim) {
            for (i = 0; i < a->ndim; i++)
                if (a->arraysize[i] != b->arraysize[i])
                    return 0;
        }
        if (a->typegroup == 'S') {
            if (a->flags != b->flags)
                return 0;
            if (a->fields || b->fields) {
                if (!(a->fields && b->fields))
                    return 0;
                for (i = 0; a->fields[i].type && b->fields[i].type; i++) {
                    const __Pyx_StructField *field_a = a->fields + i;
                    const __Pyx_StructField *field_b = b->fields + i;
                    if (field_a->offset != field_b->offset ||
                        !__pyx_typeinfo_cmp(field_a->type, field_b->type))
                        return 0;
                }
                return !a->fields[i].type && !b->fields[i].type;
            }
        }
        return 1;
    }
    
/* MemviewSliceValidateAndInit (used by ObjectToMemviewSlice) */
    static int
    __pyx_check_strides(Py_buffer *buf, int dim, int ndim, int spec)
    {
        if (buf->shape[dim] <= 1)
            return 1;
        if (buf->strides) {
            if (spec & __Pyx_MEMVIEW_CONTIG) {
                if (spec & (__Pyx_MEMVIEW_PTR|__Pyx_MEMVIEW_FULL)) {
                    if (unlikely(buf->strides[dim] != sizeof(void *))) {
                        PyErr_Format(PyExc_ValueError,
                                     "Buffer is not indirectly contiguous "
                                     "in dimension %d.", dim);
                        goto fail;
                    }
                } else if (unlikely(buf->strides[dim] != buf->itemsize)) {
                    PyErr_SetString(PyExc_ValueError,
                                    "Buffer and memoryview are not contiguous "
                                    "in the same dimension.");
                    goto fail;
                }
            }
            if (spec & __Pyx_MEMVIEW_FOLLOW) {
                Py_ssize_t stride = buf->strides[dim];
                if (stride < 0)
                    stride = -stride;
                if (unlikely(stride < buf->itemsize)) {
                    PyErr_SetString(PyExc_ValueError,
                                    "Buffer and memoryview are not contiguous "
                                    "in the same dimension.");
                    goto fail;
                }
            }
        } else {
            if (unlikely(spec & __Pyx_MEMVIEW_CONTIG && dim != ndim - 1)) {
                PyErr_Format(PyExc_ValueError,
                             "C-contiguous buffer is not contiguous in "
                             "dimension %d", dim);
                goto fail;
            } else if (unlikely(spec & (__Pyx_MEMVIEW_PTR))) {
                PyErr_Format(PyExc_ValueError,
                             "C-contiguous buffer is not indirect in "
                             "dimension %d", dim);
                goto fail;
            } else if (unlikely(buf->suboffsets)) {
                PyErr_SetString(PyExc_ValueError,
                                "Buffer exposes suboffsets but no strides");
                goto fail;
            }
        }
        return 1;
    fail:
        return 0;
    }
    static int
    __pyx_check_suboffsets(Py_buffer *buf, int dim, int ndim, int spec)
    {
        CYTHON_UNUSED_VAR(ndim);
        if (spec & __Pyx_MEMVIEW_DIRECT) {
            if (unlikely(buf->suboffsets && buf->suboffsets[dim] >= 0)) {
                PyErr_Format(PyExc_ValueError,
                             "Buffer not compatible with direct access "
                             "in dimension %d.", dim);
                goto fail;
            }
        }
        if (spec & __Pyx_MEMVIEW_PTR) {
            if (unlikely(!buf->suboffsets || (buf->suboffsets[dim] < 0))) {
                PyErr_Format(PyExc_ValueError,
                             "Buffer is not indirectly accessible "
                             "in dimension %d.", dim);
                goto fail;
            }
        }
        return 1;
    fail:
        return 0;
    }
    static int
    __pyx_verify_contig(Py_buffer *buf, int ndim, int c_or_f_flag)
    {
        int i;
        if (c_or_f_flag & __Pyx_IS_F_CONTIG) {
            Py_ssize_t stride = 1;
            for (i = 0; i < ndim; i++) {
                if (unlikely(stride * buf->itemsize != buf->strides[i]  &&  buf->shape[i] > 1)) {
                    PyErr_SetString(PyExc_ValueError,
                        "Buffer not fortran contiguous.");
                    goto fail;
                }
                stride = stride * buf->shape[i];
            }
        } else if (c_or_f_flag & __Pyx_IS_C_CONTIG) {
            Py_ssize_t stride = 1;
            for (i = ndim - 1; i >- 1; i--) {
                if (unlikely(stride * buf->itemsize != buf->strides[i]  &&  buf->shape[i] > 1)) {
                    PyErr_SetString(PyExc_ValueError,
                        "Buffer not C contiguous.");
                    goto fail;
                }
                stride = stride * buf->shape[i];
            }
        }
        return 1;
    fail:
        return 0;
    }
    static int __Pyx_ValidateAndInit_memviewslice(
                    int *axes_specs,
                    int c_or_f_flag,
                    int buf_flags,
                    int ndim,
                    const __Pyx_TypeInfo *dtype,
                    __Pyx_BufFmt_StackElem stack[],
                    __Pyx_memviewslice *memviewslice,
                    PyObject *original_obj)
    {
        struct __pyx_memoryview_obj *memview, *new_memview;
        __Pyx_RefNannyDeclarations
        Py_buffer *buf;
        int i, spec = 0, retval = -1;
        __Pyx_BufFmt_Context ctx;
        int from_memoryview = __pyx_memoryview_check(original_obj);
        __Pyx_RefNannySetupContext("ValidateAndInit_memviewslice", 0);
        if (from_memoryview && __pyx_typeinfo_cmp(dtype, ((struct __pyx_memoryview_obj *)
                                                                original_obj)->typeinfo)) {
            memview = (struct __pyx_memoryview_obj *) original_obj;
            new_memview = NULL;
        } else {
            memview = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
                                                original_obj, buf_flags, 0, dtype);
            new_memview = memview;
            if (unlikely(!memview))
                goto fail;
        }
        buf = &memview->view;
        if (unlikely(buf->ndim != ndim)) {
            PyErr_Format(PyExc_ValueError,
                    "Buffer has wrong number of dimensions (expected %d, got %d)",
                    ndim, buf->ndim);
            goto fail;
        }
        if (new_memview) {
            __Pyx_BufFmt_Init(&ctx, stack, dtype);
            if (unlikely(!__Pyx_BufFmt_CheckString(&ctx, buf->format))) goto fail;
        }
        if (unlikely((unsigned) buf->itemsize != dtype->size)) {
            PyErr_Format(PyExc_ValueError,
                         "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "u byte%s) "
                         "does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "u byte%s)",
                         buf->itemsize,
                         (buf->itemsize > 1) ? "s" : "",
                         dtype->name,
                         dtype->size,
                         (dtype->size > 1) ? "s" : "");
            goto fail;
        }
        if (buf->len > 0) {
            for (i = 0; i < ndim; i++) {
                spec = axes_specs[i];
                if (unlikely(!__pyx_check_strides(buf, i, ndim, spec)))
                    goto fail;
                if (unlikely(!__pyx_check_suboffsets(buf, i, ndim, spec)))
                    goto fail;
            }
            if (unlikely(buf->strides && !__pyx_verify_contig(buf, ndim, c_or_f_flag)))
                goto fail;
        }
        if (unlikely(__Pyx_init_memviewslice(memview, ndim, memviewslice,
                                             new_memview != NULL) == -1)) {
            goto fail;
        }
        retval = 0;
        goto no_fail;
    fail:
        Py_XDECREF((PyObject*)new_memview);
        retval = -1;
    no_fail:
        __Pyx_RefNannyFinishContext();
        return retval;
    }
    
/* ObjectToMemviewSlice */
    static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_char__const__(PyObject *obj, int writable_flag) {
        __Pyx_memviewslice result = __Pyx_MEMSLICE_INIT;
        __Pyx_BufFmt_StackElem stack[1];
        int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG) };
        int retcode;
        if (obj == Py_None) {
            result.memview = (struct __pyx_memoryview_obj *) Py_None;
            return result;
        }
        retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, __Pyx_IS_C_CONTIG,
                                                     (PyBUF_C_CONTIGUOUS | PyBUF_FORMAT) | writable_flag, 1,
                                                     &__Pyx_TypeInfo_unsigned_char__const__, stack,
                                                     &result, obj);
        if (unlikely(retcode == -1))
            goto __pyx_fail;
        return result;
    __pyx_fail:
        result.memview = NULL;
        result.data = NULL;
        return result;
    }
    
/* MemviewDtypeToObject */
    static CYTHON_INLINE PyObject *__pyx_memview_get_unsigned_char__const__(const char *itemp) {
        return (PyObject *) __Pyx_PyLong_From_unsigned_char(*(unsigned char const   *) itemp);
    }
    
/* UnicodeAsUCS4 */
    static void __Pyx_PyUnicode_AsPy_UCS4_error(Py_ssize_t length) {
        if (likely(length >= 0)) {
            PyErr_Format(PyExc_ValueError,
                         "only single character unicode strings can be converted to Py_UCS4, "
                         "got length %" CYTHON_FORMAT_SSIZE_T "d", length);
        }
    }
    static CYTHON_INLINE Py_UCS4 __Pyx_PyUnicode_AsPy_UCS4(PyObject* x) {
        Py_ssize_t length = __Pyx_PyUnicode_GET_LENGTH(x);
        if (unlikely(length != 1)) {
            __Pyx_PyUnicode_AsPy_UCS4_error(length);
            return (Py_UCS4)-1;
        }
        return __Pyx_PyUnicode_READ_CHAR(x, 0);
    }
    
/* MemviewSliceCopy */
    static __Pyx_memviewslice
    __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
                                     const char *mode, int ndim,
                                     size_t sizeof_dtype, int contig_flag,
                                     int dtype_is_object)
    {
        __Pyx_RefNannyDeclarations
        int i;
        __Pyx_memviewslice new_mvs = __Pyx_MEMSLICE_INIT;
        struct __pyx_memoryview_obj *from_memview = from_mvs->memview;
        Py_buffer *buf = &from_memview->view;
        PyObject *shape_tuple = NULL;
        PyObject *temp_int = NULL;
        struct __pyx_array_obj *array_obj = NULL;
        struct __pyx_memoryview_obj *memview_obj = NULL;
        __Pyx_RefNannySetupContext("__pyx_memoryview_copy_new_contig", 0);
        for (i = 0; i < ndim; i++) {
            if (unlikely(from_mvs->suboffsets[i] >= 0)) {
                PyErr_Format(PyExc_ValueError, "Cannot copy memoryview slice with "
                                               "indirect dimensions (axis %d)", i);
                goto fail;
            }
        }
        shape_tuple = PyTuple_New(ndim);
        if (unlikely(!shape_tuple)) {
            goto fail;
        }
        __Pyx_GOTREF(shape_tuple);
        for(i = 0; i < ndim; i++) {
            temp_int = PyLong_FromSsize_t(from_mvs->shape[i]);
            if(unlikely(!temp_int)) {
                goto fail;
            } else {
    #if CYTHON_ASSUME_SAFE_MACROS
                PyTuple_SET_ITEM(shape_tuple, i, temp_int);
    #else
                if (PyTuple_SetItem(shape_tuple, i, temp_int) < 0) {
                    goto fail;
                }
    #endif
                temp_int = NULL;
            }
        }
        array_obj = __pyx_array_new(shape_tuple, sizeof_dtype, buf->format, mode, NULL);
        if (unlikely(!array_obj)) {
            goto fail;
        }
        __Pyx_GOTREF(array_obj);
        memview_obj = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
                                        (PyObject *) array_obj, contig_flag,
                                        dtype_is_object,
                                        from_mvs->memview->typeinfo);
        if (unlikely(!memview_obj))
            goto fail;
        if (unlikely(__Pyx_init_memviewslice(memview_obj, ndim, &new_mvs, 1) < 0))
            goto fail;
        if (unlikely(__pyx_memoryview_copy_contents(*from_mvs, new_mvs, ndim, ndim,
                                                    dtype_is_object) < 0))
            goto fail;
        goto no_fail;
    fail:
        __Pyx_XDECREF((PyObject *) new_mvs.memview);
        new_mvs.memview = NULL;
        new_mvs.data = NULL;
    no_fail:
        __Pyx_XDECREF(shape_tuple);
        __Pyx_XDECREF(temp_int);
        __Pyx_XDECREF((PyObject *) array_obj);
        __Pyx_RefNannyFinishContext();
        return new_mvs;
    }
    
/* CIntFromPy */
    static CYTHON_INLINE int __Pyx_PyLong_As_int(PyObject *x) {
    #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
    #pragma GCC diagnostic push
    #pragma GCC diagnostic ignored "-Wconversion"
    #endif
        const int neg_one = (int) -1, const_zero = (int) 0;
    #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
    #pragma GCC diagnostic pop
    #endif
        const int is_unsigned = neg_one > const_zero;
        if (unlikely(!PyLong_Check(x))) {
            int val;
            PyObject *tmp = __Pyx_PyNumber_Long(x);
            if (!tmp) return (int) -1;
            val = __Pyx_PyLong_As_int(tmp);
            Py_DECREF(tmp);
            return val;
        }
        if (is_unsigned) {
    #if CYTHON_USE_PYLONG_INTERNALS
            if (unlikely(__Pyx_PyLong_IsNeg(x))) {
                goto raise_neg_overflow;
            } else if (__Pyx_PyLong_IsCompact(x)) {
                __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
            } else {
                const digit* digits = __Pyx_PyLong_Digits(x);
                assert(__Pyx_PyLong_DigitCount(x) > 1);
                switch (__Pyx_PyLong_DigitCount(x)) {
                    case 2:
                        if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) {
                                return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                            }
                        }
                        break;
                    case 3:
                        if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) {
                                return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                            }
                        }
                        break;
                    case 4:
                        if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) {
                                return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                            }
                        }
                        break;
                }
            }
    #endif
    #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
    #else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (int) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
    #endif
            if ((sizeof(int) <= sizeof(unsigned long))) {
                __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
            } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) {
                __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
            }
        } else {
    #if CYTHON_USE_PYLONG_INTERNALS
            if (__Pyx_PyLong_IsCompact(x)) {
                __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
            } else {
                const digit* digits = __Pyx_PyLong_Digits(x);
                assert(__Pyx_PyLong_DigitCount(x) > 1);
                switch (__Pyx_PyLong_SignedDigitCount(x)) {
                    case -2:
                        if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
                                return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                            }
                        }
                        break;
                    case 2:
                        if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
                                return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                            }
                        }
                        break;
                    case -3:
                        if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
                                return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                            }
                        }
                        break;
                    case 3:
                        if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
                                return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                            }
                        }
                        break;
                    case -4:
                        if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) {
                                return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                            }
                        }
                        break;
                    case 4:
                        if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) {
                                return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                            }
                        }
                        break;
                }
            }
    #endif
            if ((sizeof(int) <= sizeof(long))) {
                __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
            } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) {
                __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
            }
        }
        {
            int val;
            int ret = -1;
    #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
            Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
                x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
            if (unlikely(bytes_copied == -1)) {
            } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
                goto raise_overflow;
            } else {
                ret = 0;
            }
    #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
            int one = 1; int is_little = (int)*(unsigned char *)&one;
            unsigned char *bytes = (unsigned char *)&val;
            ret = _PyLong_AsByteArray((PyLongObject *)x,
                                        bytes, sizeof(val),
                                        is_little, !is_unsigned);
    #else
            PyObject *v;
            PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
            int bits, remaining_bits, is_negative = 0;
            int chunk_size = (sizeof(long) < 8) ? 30 : 62;
            if (likely(PyLong_CheckExact(x))) {
                v = __Pyx_NewRef(x);
            } else {
                v = PyNumber_Long(x);
                if (unlikely(!v)) return (int) -1;
                assert(PyLong_CheckExact(v));
            }
            {
                int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
                if (unlikely(result < 0)) {
                    Py_DECREF(v);
                    return (int) -1;
                }
                is_negative = result == 1;
            }
            if (is_unsigned && unlikely(is_negative)) {
                Py_DECREF(v);
                goto raise_neg_overflow;
            } else if (is_negative) {
                stepval = PyNumber_Invert(v);
                Py_DECREF(v);
                if (unlikely(!stepval))
                    return (int) -1;
            } else {
                stepval = v;
            }
            v = NULL;
            val = (int) 0;
            mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
            shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
            for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) {
                PyObject *tmp, *digit;
                long idigit;
                digit = PyNumber_And(stepval, mask);
                if (unlikely(!digit)) goto done;
                idigit = PyLong_AsLong(digit);
                Py_DECREF(digit);
                if (unlikely(idigit < 0)) goto done;
                val |= ((int) idigit) << bits;
                tmp = PyNumber_Rshift(stepval, shift);
                if (unlikely(!tmp)) goto done;
                Py_DECREF(stepval); stepval = tmp;
            }
            Py_DECREF(shift); shift = NULL;
            Py_DECREF(mask); mask = NULL;
            {
                long idigit = PyLong_AsLong(stepval);
                if (unlikely(idigit < 0)) goto done;
                remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1);
                if (unlikely(idigit >= (1L << remaining_bits)))
                    goto raise_overflow;
                val |= ((int) idigit) << bits;
            }
            if (!is_unsigned) {
                if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1))))
                    goto raise_overflow;
                if (is_negative)
                    val = ~val;
            }
            ret = 0;
        done:
            Py_XDECREF(shift);
            Py_XDECREF(mask);
            Py_XDECREF(stepval);
    #endif
            if (unlikely(ret))
                return (int) -1;
            return val;
        }
    raise_overflow:
        PyErr_SetString(PyExc_OverflowError,
            "value too large to convert to int");
        return (int) -1;
    raise_neg_overflow:
        PyErr_SetString(PyExc_OverflowError,
            "can't convert negative value to int");
        return (int) -1;
    }
    
/* CIntToPy */
    static CYTHON_INLINE PyObject* __Pyx_PyLong_From_xmlParserErrors(xmlParserErrors value) {
    #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
    #pragma GCC diagnostic push
    #pragma GCC diagnostic ignored "-Wconversion"
    #endif
        const xmlParserErrors neg_one = (xmlParserErrors) -1, const_zero = (xmlParserErrors) 0;
    #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
    #pragma GCC diagnostic pop
    #endif
        const int is_unsigned = neg_one > const_zero;
        if (is_unsigned) {
            if (sizeof(xmlParserErrors) < sizeof(long)) {
                return PyLong_FromLong((long) value);
            } else if (sizeof(xmlParserErrors) <= sizeof(unsigned long)) {
                return PyLong_FromUnsignedLong((unsigned long) value);
    #if !CYTHON_COMPILING_IN_PYPY
            } else if (sizeof(xmlParserErrors) <= sizeof(unsigned PY_LONG_LONG)) {
                return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
    #endif
            }
        } else {
            if (sizeof(xmlParserErrors) <= sizeof(long)) {
                return PyLong_FromLong((long) value);
            } else if (sizeof(xmlParserErrors) <= sizeof(PY_LONG_LONG)) {
                return PyLong_FromLongLong((PY_LONG_LONG) value);
            }
        }
        {
            unsigned char *bytes = (unsigned char *)&value;
    #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
            if (is_unsigned) {
                return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
            } else {
                return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
            }
    #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
            int one = 1; int little = (int)*(unsigned char *)&one;
            return _PyLong_FromByteArray(bytes, sizeof(xmlParserErrors),
                                         little, !is_unsigned);
    #else
            int one = 1; int little = (int)*(unsigned char *)&one;
            PyObject *from_bytes, *result = NULL, *kwds = NULL;
            PyObject *py_bytes = NULL, *order_str = NULL;
            from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
            if (!from_bytes) return NULL;
            py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(xmlParserErrors));
            if (!py_bytes) goto limited_bad;
            order_str = PyUnicode_FromString(little ? "little" : "big");
            if (!order_str) goto limited_bad;
            {
                PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
                if (!is_unsigned) {
                    kwds = __Pyx_MakeVectorcallBuilderKwds(1);
                    if (!kwds) goto limited_bad;
                    if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
                }
                result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
            }
            limited_bad:
            Py_XDECREF(kwds);
            Py_XDECREF(order_str);
            Py_XDECREF(py_bytes);
            Py_XDECREF(from_bytes);
            return result;
    #endif
        }
    }
    
/* CIntToPy */
    static CYTHON_INLINE PyObject* __Pyx_PyLong_From_int(int value) {
    #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
    #pragma GCC diagnostic push
    #pragma GCC diagnostic ignored "-Wconversion"
    #endif
        const int neg_one = (int) -1, const_zero = (int) 0;
    #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
    #pragma GCC diagnostic pop
    #endif
        const int is_unsigned = neg_one > const_zero;
        if (is_unsigned) {
            if (sizeof(int) < sizeof(long)) {
                return PyLong_FromLong((long) value);
            } else if (sizeof(int) <= sizeof(unsigned long)) {
                return PyLong_FromUnsignedLong((unsigned long) value);
    #if !CYTHON_COMPILING_IN_PYPY
            } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
                return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
    #endif
            }
        } else {
            if (sizeof(int) <= sizeof(long)) {
                return PyLong_FromLong((long) value);
            } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
                return PyLong_FromLongLong((PY_LONG_LONG) value);
            }
        }
        {
            unsigned char *bytes = (unsigned char *)&value;
    #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
            if (is_unsigned) {
                return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
            } else {
                return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
            }
    #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
            int one = 1; int little = (int)*(unsigned char *)&one;
            return _PyLong_FromByteArray(bytes, sizeof(int),
                                         little, !is_unsigned);
    #else
            int one = 1; int little = (int)*(unsigned char *)&one;
            PyObject *from_bytes, *result = NULL, *kwds = NULL;
            PyObject *py_bytes = NULL, *order_str = NULL;
            from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
            if (!from_bytes) return NULL;
            py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(int));
            if (!py_bytes) goto limited_bad;
            order_str = PyUnicode_FromString(little ? "little" : "big");
            if (!order_str) goto limited_bad;
            {
                PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
                if (!is_unsigned) {
                    kwds = __Pyx_MakeVectorcallBuilderKwds(1);
                    if (!kwds) goto limited_bad;
                    if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
                }
                result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
            }
            limited_bad:
            Py_XDECREF(kwds);
            Py_XDECREF(order_str);
            Py_XDECREF(py_bytes);
            Py_XDECREF(from_bytes);
            return result;
    #endif
        }
    }
    
/* CIntToPy */
    static CYTHON_INLINE PyObject* __Pyx_PyLong_From_xmlFeature(xmlFeature value) {
    #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
    #pragma GCC diagnostic push
    #pragma GCC diagnostic ignored "-Wconversion"
    #endif
        const xmlFeature neg_one = (xmlFeature) -1, const_zero = (xmlFeature) 0;
    #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
    #pragma GCC diagnostic pop
    #endif
        const int is_unsigned = neg_one > const_zero;
        if (is_unsigned) {
            if (sizeof(xmlFeature) < sizeof(long)) {
                return PyLong_FromLong((long) value);
            } else if (sizeof(xmlFeature) <= sizeof(unsigned long)) {
                return PyLong_FromUnsignedLong((unsigned long) value);
    #if !CYTHON_COMPILING_IN_PYPY
            } else if (sizeof(xmlFeature) <= sizeof(unsigned PY_LONG_LONG)) {
                return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
    #endif
            }
        } else {
            if (sizeof(xmlFeature) <= sizeof(long)) {
                return PyLong_FromLong((long) value);
            } else if (sizeof(xmlFeature) <= sizeof(PY_LONG_LONG)) {
                return PyLong_FromLongLong((PY_LONG_LONG) value);
            }
        }
        {
            unsigned char *bytes = (unsigned char *)&value;
    #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
            if (is_unsigned) {
                return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
            } else {
                return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
            }
    #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
            int one = 1; int little = (int)*(unsigned char *)&one;
            return _PyLong_FromByteArray(bytes, sizeof(xmlFeature),
                                         little, !is_unsigned);
    #else
            int one = 1; int little = (int)*(unsigned char *)&one;
            PyObject *from_bytes, *result = NULL, *kwds = NULL;
            PyObject *py_bytes = NULL, *order_str = NULL;
            from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
            if (!from_bytes) return NULL;
            py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(xmlFeature));
            if (!py_bytes) goto limited_bad;
            order_str = PyUnicode_FromString(little ? "little" : "big");
            if (!order_str) goto limited_bad;
            {
                PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
                if (!is_unsigned) {
                    kwds = __Pyx_MakeVectorcallBuilderKwds(1);
                    if (!kwds) goto limited_bad;
                    if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
                }
                result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
            }
            limited_bad:
            Py_XDECREF(kwds);
            Py_XDECREF(order_str);
            Py_XDECREF(py_bytes);
            Py_XDECREF(from_bytes);
            return result;
    #endif
        }
    }
    
/* CIntFromPy */
    static CYTHON_INLINE xmlFeature __Pyx_PyLong_As_xmlFeature(PyObject *x) {
    #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
    #pragma GCC diagnostic push
    #pragma GCC diagnostic ignored "-Wconversion"
    #endif
        const xmlFeature neg_one = (xmlFeature) -1, const_zero = (xmlFeature) 0;
    #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
    #pragma GCC diagnostic pop
    #endif
        const int is_unsigned = neg_one > const_zero;
        if (unlikely(!PyLong_Check(x))) {
            xmlFeature val;
            PyObject *tmp = __Pyx_PyNumber_Long(x);
            if (!tmp) return (xmlFeature) -1;
            val = __Pyx_PyLong_As_xmlFeature(tmp);
            Py_DECREF(tmp);
            return val;
        }
        if (is_unsigned) {
    #if CYTHON_USE_PYLONG_INTERNALS
            if (unlikely(__Pyx_PyLong_IsNeg(x))) {
                goto raise_neg_overflow;
            } else if (__Pyx_PyLong_IsCompact(x)) {
                __PYX_VERIFY_RETURN_INT(xmlFeature, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
            } else {
                const digit* digits = __Pyx_PyLong_Digits(x);
                assert(__Pyx_PyLong_DigitCount(x) > 1);
                switch (__Pyx_PyLong_DigitCount(x)) {
                    case 2:
                        if ((8 * sizeof(xmlFeature) > 1 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(xmlFeature, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(xmlFeature) >= 2 * PyLong_SHIFT)) {
                                return (xmlFeature) (((((xmlFeature)digits[1]) << PyLong_SHIFT) | (xmlFeature)digits[0]));
                            }
                        }
                        break;
                    case 3:
                        if ((8 * sizeof(xmlFeature) > 2 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(xmlFeature, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(xmlFeature) >= 3 * PyLong_SHIFT)) {
                                return (xmlFeature) (((((((xmlFeature)digits[2]) << PyLong_SHIFT) | (xmlFeature)digits[1]) << PyLong_SHIFT) | (xmlFeature)digits[0]));
                            }
                        }
                        break;
                    case 4:
                        if ((8 * sizeof(xmlFeature) > 3 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(xmlFeature, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(xmlFeature) >= 4 * PyLong_SHIFT)) {
                                return (xmlFeature) (((((((((xmlFeature)digits[3]) << PyLong_SHIFT) | (xmlFeature)digits[2]) << PyLong_SHIFT) | (xmlFeature)digits[1]) << PyLong_SHIFT) | (xmlFeature)digits[0]));
                            }
                        }
                        break;
                }
            }
    #endif
    #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
    #else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (xmlFeature) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
    #endif
            if ((sizeof(xmlFeature) <= sizeof(unsigned long))) {
                __PYX_VERIFY_RETURN_INT_EXC(xmlFeature, unsigned long, PyLong_AsUnsignedLong(x))
            } else if ((sizeof(xmlFeature) <= sizeof(unsigned PY_LONG_LONG))) {
                __PYX_VERIFY_RETURN_INT_EXC(xmlFeature, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
            }
        } else {
    #if CYTHON_USE_PYLONG_INTERNALS
            if (__Pyx_PyLong_IsCompact(x)) {
                __PYX_VERIFY_RETURN_INT(xmlFeature, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
            } else {
                const digit* digits = __Pyx_PyLong_Digits(x);
                assert(__Pyx_PyLong_DigitCount(x) > 1);
                switch (__Pyx_PyLong_SignedDigitCount(x)) {
                    case -2:
                        if ((8 * sizeof(xmlFeature) - 1 > 1 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(xmlFeature, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(xmlFeature) - 1 > 2 * PyLong_SHIFT)) {
                                return (xmlFeature) (((xmlFeature)-1)*(((((xmlFeature)digits[1]) << PyLong_SHIFT) | (xmlFeature)digits[0])));
                            }
                        }
                        break;
                    case 2:
                        if ((8 * sizeof(xmlFeature) > 1 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(xmlFeature, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(xmlFeature) - 1 > 2 * PyLong_SHIFT)) {
                                return (xmlFeature) ((((((xmlFeature)digits[1]) << PyLong_SHIFT) | (xmlFeature)digits[0])));
                            }
                        }
                        break;
                    case -3:
                        if ((8 * sizeof(xmlFeature) - 1 > 2 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(xmlFeature, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(xmlFeature) - 1 > 3 * PyLong_SHIFT)) {
                                return (xmlFeature) (((xmlFeature)-1)*(((((((xmlFeature)digits[2]) << PyLong_SHIFT) | (xmlFeature)digits[1]) << PyLong_SHIFT) | (xmlFeature)digits[0])));
                            }
                        }
                        break;
                    case 3:
                        if ((8 * sizeof(xmlFeature) > 2 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(xmlFeature, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(xmlFeature) - 1 > 3 * PyLong_SHIFT)) {
                                return (xmlFeature) ((((((((xmlFeature)digits[2]) << PyLong_SHIFT) | (xmlFeature)digits[1]) << PyLong_SHIFT) | (xmlFeature)digits[0])));
                            }
                        }
                        break;
                    case -4:
                        if ((8 * sizeof(xmlFeature) - 1 > 3 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(xmlFeature, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(xmlFeature) - 1 > 4 * PyLong_SHIFT)) {
                                return (xmlFeature) (((xmlFeature)-1)*(((((((((xmlFeature)digits[3]) << PyLong_SHIFT) | (xmlFeature)digits[2]) << PyLong_SHIFT) | (xmlFeature)digits[1]) << PyLong_SHIFT) | (xmlFeature)digits[0])));
                            }
                        }
                        break;
                    case 4:
                        if ((8 * sizeof(xmlFeature) > 3 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(xmlFeature, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(xmlFeature) - 1 > 4 * PyLong_SHIFT)) {
                                return (xmlFeature) ((((((((((xmlFeature)digits[3]) << PyLong_SHIFT) | (xmlFeature)digits[2]) << PyLong_SHIFT) | (xmlFeature)digits[1]) << PyLong_SHIFT) | (xmlFeature)digits[0])));
                            }
                        }
                        break;
                }
            }
    #endif
            if ((sizeof(xmlFeature) <= sizeof(long))) {
                __PYX_VERIFY_RETURN_INT_EXC(xmlFeature, long, PyLong_AsLong(x))
            } else if ((sizeof(xmlFeature) <= sizeof(PY_LONG_LONG))) {
                __PYX_VERIFY_RETURN_INT_EXC(xmlFeature, PY_LONG_LONG, PyLong_AsLongLong(x))
            }
        }
        {
            xmlFeature val;
            int ret = -1;
    #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
            Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
                x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
            if (unlikely(bytes_copied == -1)) {
            } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
                goto raise_overflow;
            } else {
                ret = 0;
            }
    #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
            int one = 1; int is_little = (int)*(unsigned char *)&one;
            unsigned char *bytes = (unsigned char *)&val;
            ret = _PyLong_AsByteArray((PyLongObject *)x,
                                        bytes, sizeof(val),
                                        is_little, !is_unsigned);
    #else
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() or PyLong_AsNativeBytes() not available, cannot convert large enums");
            val = (xmlFeature) -1;
    #endif
            if (unlikely(ret))
                return (xmlFeature) -1;
            return val;
        }
    raise_overflow:
        PyErr_SetString(PyExc_OverflowError,
            "value too large to convert to xmlFeature");
        return (xmlFeature) -1;
    raise_neg_overflow:
        PyErr_SetString(PyExc_OverflowError,
            "can't convert negative value to xmlFeature");
        return (xmlFeature) -1;
    }
    
/* CIntFromPy */
    static CYTHON_INLINE size_t __Pyx_PyLong_As_size_t(PyObject *x) {
    #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
    #pragma GCC diagnostic push
    #pragma GCC diagnostic ignored "-Wconversion"
    #endif
        const size_t neg_one = (size_t) -1, const_zero = (size_t) 0;
    #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
    #pragma GCC diagnostic pop
    #endif
        const int is_unsigned = neg_one > const_zero;
        if (unlikely(!PyLong_Check(x))) {
            size_t val;
            PyObject *tmp = __Pyx_PyNumber_Long(x);
            if (!tmp) return (size_t) -1;
            val = __Pyx_PyLong_As_size_t(tmp);
            Py_DECREF(tmp);
            return val;
        }
        if (is_unsigned) {
    #if CYTHON_USE_PYLONG_INTERNALS
            if (unlikely(__Pyx_PyLong_IsNeg(x))) {
                goto raise_neg_overflow;
            } else if (__Pyx_PyLong_IsCompact(x)) {
                __PYX_VERIFY_RETURN_INT(size_t, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
            } else {
                const digit* digits = __Pyx_PyLong_Digits(x);
                assert(__Pyx_PyLong_DigitCount(x) > 1);
                switch (__Pyx_PyLong_DigitCount(x)) {
                    case 2:
                        if ((8 * sizeof(size_t) > 1 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(size_t) >= 2 * PyLong_SHIFT)) {
                                return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
                            }
                        }
                        break;
                    case 3:
                        if ((8 * sizeof(size_t) > 2 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(size_t) >= 3 * PyLong_SHIFT)) {
                                return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
                            }
                        }
                        break;
                    case 4:
                        if ((8 * sizeof(size_t) > 3 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(size_t) >= 4 * PyLong_SHIFT)) {
                                return (size_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
                            }
                        }
                        break;
                }
            }
    #endif
    #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
    #else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (size_t) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
    #endif
            if ((sizeof(size_t) <= sizeof(unsigned long))) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned long, PyLong_AsUnsignedLong(x))
            } else if ((sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG))) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
            }
        } else {
    #if CYTHON_USE_PYLONG_INTERNALS
            if (__Pyx_PyLong_IsCompact(x)) {
                __PYX_VERIFY_RETURN_INT(size_t, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
            } else {
                const digit* digits = __Pyx_PyLong_Digits(x);
                assert(__Pyx_PyLong_DigitCount(x) > 1);
                switch (__Pyx_PyLong_SignedDigitCount(x)) {
                    case -2:
                        if ((8 * sizeof(size_t) - 1 > 1 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) {
                                return (size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                            }
                        }
                        break;
                    case 2:
                        if ((8 * sizeof(size_t) > 1 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) {
                                return (size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                            }
                        }
                        break;
                    case -3:
                        if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) {
                                return (size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                            }
                        }
                        break;
                    case 3:
                        if ((8 * sizeof(size_t) > 2 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) {
                                return (size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                            }
                        }
                        break;
                    case -4:
                        if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT)) {
                                return (size_t) (((size_t)-1)*(((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                            }
                        }
                        break;
                    case 4:
                        if ((8 * sizeof(size_t) > 3 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT)) {
                                return (size_t) ((((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                            }
                        }
                        break;
                }
            }
    #endif
            if ((sizeof(size_t) <= sizeof(long))) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x))
            } else if ((sizeof(size_t) <= sizeof(PY_LONG_LONG))) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x))
            }
        }
        {
            size_t val;
            int ret = -1;
    #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
            Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
                x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
            if (unlikely(bytes_copied == -1)) {
            } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
                goto raise_overflow;
            } else {
                ret = 0;
            }
    #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
            int one = 1; int is_little = (int)*(unsigned char *)&one;
            unsigned char *bytes = (unsigned char *)&val;
            ret = _PyLong_AsByteArray((PyLongObject *)x,
                                        bytes, sizeof(val),
                                        is_little, !is_unsigned);
    #else
            PyObject *v;
            PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
            int bits, remaining_bits, is_negative = 0;
            int chunk_size = (sizeof(long) < 8) ? 30 : 62;
            if (likely(PyLong_CheckExact(x))) {
                v = __Pyx_NewRef(x);
            } else {
                v = PyNumber_Long(x);
                if (unlikely(!v)) return (size_t) -1;
                assert(PyLong_CheckExact(v));
            }
            {
                int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
                if (unlikely(result < 0)) {
                    Py_DECREF(v);
                    return (size_t) -1;
                }
                is_negative = result == 1;
            }
            if (is_unsigned && unlikely(is_negative)) {
                Py_DECREF(v);
                goto raise_neg_overflow;
            } else if (is_negative) {
                stepval = PyNumber_Invert(v);
                Py_DECREF(v);
                if (unlikely(!stepval))
                    return (size_t) -1;
            } else {
                stepval = v;
            }
            v = NULL;
            val = (size_t) 0;
            mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
            shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
            for (bits = 0; bits < (int) sizeof(size_t) * 8 - chunk_size; bits += chunk_size) {
                PyObject *tmp, *digit;
                long idigit;
                digit = PyNumber_And(stepval, mask);
                if (unlikely(!digit)) goto done;
                idigit = PyLong_AsLong(digit);
                Py_DECREF(digit);
                if (unlikely(idigit < 0)) goto done;
                val |= ((size_t) idigit) << bits;
                tmp = PyNumber_Rshift(stepval, shift);
                if (unlikely(!tmp)) goto done;
                Py_DECREF(stepval); stepval = tmp;
            }
            Py_DECREF(shift); shift = NULL;
            Py_DECREF(mask); mask = NULL;
            {
                long idigit = PyLong_AsLong(stepval);
                if (unlikely(idigit < 0)) goto done;
                remaining_bits = ((int) sizeof(size_t) * 8) - bits - (is_unsigned ? 0 : 1);
                if (unlikely(idigit >= (1L << remaining_bits)))
                    goto raise_overflow;
                val |= ((size_t) idigit) << bits;
            }
            if (!is_unsigned) {
                if (unlikely(val & (((size_t) 1) << (sizeof(size_t) * 8 - 1))))
                    goto raise_overflow;
                if (is_negative)
                    val = ~val;
            }
            ret = 0;
        done:
            Py_XDECREF(shift);
            Py_XDECREF(mask);
            Py_XDECREF(stepval);
    #endif
            if (unlikely(ret))
                return (size_t) -1;
            return val;
        }
    raise_overflow:
        PyErr_SetString(PyExc_OverflowError,
            "value too large to convert to size_t");
        return (size_t) -1;
    raise_neg_overflow:
        PyErr_SetString(PyExc_OverflowError,
            "can't convert negative value to size_t");
        return (size_t) -1;
    }
    
/* CIntToPy */
    static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value) {
    #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
    #pragma GCC diagnostic push
    #pragma GCC diagnostic ignored "-Wconversion"
    #endif
        const long neg_one = (long) -1, const_zero = (long) 0;
    #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
    #pragma GCC diagnostic pop
    #endif
        const int is_unsigned = neg_one > const_zero;
        if (is_unsigned) {
            if (sizeof(long) < sizeof(long)) {
                return PyLong_FromLong((long) value);
            } else if (sizeof(long) <= sizeof(unsigned long)) {
                return PyLong_FromUnsignedLong((unsigned long) value);
    #if !CYTHON_COMPILING_IN_PYPY
            } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
                return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
    #endif
            }
        } else {
            if (sizeof(long) <= sizeof(long)) {
                return PyLong_FromLong((long) value);
            } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
                return PyLong_FromLongLong((PY_LONG_LONG) value);
            }
        }
        {
            unsigned char *bytes = (unsigned char *)&value;
    #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
            if (is_unsigned) {
                return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
            } else {
                return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
            }
    #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
            int one = 1; int little = (int)*(unsigned char *)&one;
            return _PyLong_FromByteArray(bytes, sizeof(long),
                                         little, !is_unsigned);
    #else
            int one = 1; int little = (int)*(unsigned char *)&one;
            PyObject *from_bytes, *result = NULL, *kwds = NULL;
            PyObject *py_bytes = NULL, *order_str = NULL;
            from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
            if (!from_bytes) return NULL;
            py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(long));
            if (!py_bytes) goto limited_bad;
            order_str = PyUnicode_FromString(little ? "little" : "big");
            if (!order_str) goto limited_bad;
            {
                PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
                if (!is_unsigned) {
                    kwds = __Pyx_MakeVectorcallBuilderKwds(1);
                    if (!kwds) goto limited_bad;
                    if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
                }
                result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
            }
            limited_bad:
            Py_XDECREF(kwds);
            Py_XDECREF(order_str);
            Py_XDECREF(py_bytes);
            Py_XDECREF(from_bytes);
            return result;
    #endif
        }
    }
    
/* CIntFromPy */
    static CYTHON_INLINE unsigned int __Pyx_PyLong_As_unsigned_int(PyObject *x) {
    #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
    #pragma GCC diagnostic push
    #pragma GCC diagnostic ignored "-Wconversion"
    #endif
        const unsigned int neg_one = (unsigned int) -1, const_zero = (unsigned int) 0;
    #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
    #pragma GCC diagnostic pop
    #endif
        const int is_unsigned = neg_one > const_zero;
        if (unlikely(!PyLong_Check(x))) {
            unsigned int val;
            PyObject *tmp = __Pyx_PyNumber_Long(x);
            if (!tmp) return (unsigned int) -1;
            val = __Pyx_PyLong_As_unsigned_int(tmp);
            Py_DECREF(tmp);
            return val;
        }
        if (is_unsigned) {
    #if CYTHON_USE_PYLONG_INTERNALS
            if (unlikely(__Pyx_PyLong_IsNeg(x))) {
                goto raise_neg_overflow;
            } else if (__Pyx_PyLong_IsCompact(x)) {
                __PYX_VERIFY_RETURN_INT(unsigned int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
            } else {
                const digit* digits = __Pyx_PyLong_Digits(x);
                assert(__Pyx_PyLong_DigitCount(x) > 1);
                switch (__Pyx_PyLong_DigitCount(x)) {
                    case 2:
                        if ((8 * sizeof(unsigned int) > 1 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(unsigned int) >= 2 * PyLong_SHIFT)) {
                                return (unsigned int) (((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]));
                            }
                        }
                        break;
                    case 3:
                        if ((8 * sizeof(unsigned int) > 2 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(unsigned int) >= 3 * PyLong_SHIFT)) {
                                return (unsigned int) (((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]));
                            }
                        }
                        break;
                    case 4:
                        if ((8 * sizeof(unsigned int) > 3 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(unsigned int) >= 4 * PyLong_SHIFT)) {
                                return (unsigned int) (((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]));
                            }
                        }
                        break;
                }
            }
    #endif
    #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
    #else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (unsigned int) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
    #endif
            if ((sizeof(unsigned int) <= sizeof(unsigned long))) {
                __PYX_VERIFY_RETURN_INT_EXC(unsigned int, unsigned long, PyLong_AsUnsignedLong(x))
            } else if ((sizeof(unsigned int) <= sizeof(unsigned PY_LONG_LONG))) {
                __PYX_VERIFY_RETURN_INT_EXC(unsigned int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
            }
        } else {
    #if CYTHON_USE_PYLONG_INTERNALS
            if (__Pyx_PyLong_IsCompact(x)) {
                __PYX_VERIFY_RETURN_INT(unsigned int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
            } else {
                const digit* digits = __Pyx_PyLong_Digits(x);
                assert(__Pyx_PyLong_DigitCount(x) > 1);
                switch (__Pyx_PyLong_SignedDigitCount(x)) {
                    case -2:
                        if ((8 * sizeof(unsigned int) - 1 > 1 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(unsigned int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT)) {
                                return (unsigned int) (((unsigned int)-1)*(((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
                            }
                        }
                        break;
                    case 2:
                        if ((8 * sizeof(unsigned int) > 1 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT)) {
                                return (unsigned int) ((((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
                            }
                        }
                        break;
                    case -3:
                        if ((8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(unsigned int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT)) {
                                return (unsigned int) (((unsigned int)-1)*(((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
                            }
                        }
                        break;
                    case 3:
                        if ((8 * sizeof(unsigned int) > 2 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT)) {
                                return (unsigned int) ((((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
                            }
                        }
                        break;
                    case -4:
                        if ((8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(unsigned int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(unsigned int) - 1 > 4 * PyLong_SHIFT)) {
                                return (unsigned int) (((unsigned int)-1)*(((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
                            }
                        }
                        break;
                    case 4:
                        if ((8 * sizeof(unsigned int) > 3 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(unsigned int) - 1 > 4 * PyLong_SHIFT)) {
                                return (unsigned int) ((((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
                            }
                        }
                        break;
                }
            }
    #endif
            if ((sizeof(unsigned int) <= sizeof(long))) {
                __PYX_VERIFY_RETURN_INT_EXC(unsigned int, long, PyLong_AsLong(x))
            } else if ((sizeof(unsigned int) <= sizeof(PY_LONG_LONG))) {
                __PYX_VERIFY_RETURN_INT_EXC(unsigned int, PY_LONG_LONG, PyLong_AsLongLong(x))
            }
        }
        {
            unsigned int val;
            int ret = -1;
    #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
            Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
                x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
            if (unlikely(bytes_copied == -1)) {
            } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
                goto raise_overflow;
            } else {
                ret = 0;
            }
    #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
            int one = 1; int is_little = (int)*(unsigned char *)&one;
            unsigned char *bytes = (unsigned char *)&val;
            ret = _PyLong_AsByteArray((PyLongObject *)x,
                                        bytes, sizeof(val),
                                        is_little, !is_unsigned);
    #else
            PyObject *v;
            PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
            int bits, remaining_bits, is_negative = 0;
            int chunk_size = (sizeof(long) < 8) ? 30 : 62;
            if (likely(PyLong_CheckExact(x))) {
                v = __Pyx_NewRef(x);
            } else {
                v = PyNumber_Long(x);
                if (unlikely(!v)) return (unsigned int) -1;
                assert(PyLong_CheckExact(v));
            }
            {
                int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
                if (unlikely(result < 0)) {
                    Py_DECREF(v);
                    return (unsigned int) -1;
                }
                is_negative = result == 1;
            }
            if (is_unsigned && unlikely(is_negative)) {
                Py_DECREF(v);
                goto raise_neg_overflow;
            } else if (is_negative) {
                stepval = PyNumber_Invert(v);
                Py_DECREF(v);
                if (unlikely(!stepval))
                    return (unsigned int) -1;
            } else {
                stepval = v;
            }
            v = NULL;
            val = (unsigned int) 0;
            mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
            shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
            for (bits = 0; bits < (int) sizeof(unsigned int) * 8 - chunk_size; bits += chunk_size) {
                PyObject *tmp, *digit;
                long idigit;
                digit = PyNumber_And(stepval, mask);
                if (unlikely(!digit)) goto done;
                idigit = PyLong_AsLong(digit);
                Py_DECREF(digit);
                if (unlikely(idigit < 0)) goto done;
                val |= ((unsigned int) idigit) << bits;
                tmp = PyNumber_Rshift(stepval, shift);
                if (unlikely(!tmp)) goto done;
                Py_DECREF(stepval); stepval = tmp;
            }
            Py_DECREF(shift); shift = NULL;
            Py_DECREF(mask); mask = NULL;
            {
                long idigit = PyLong_AsLong(stepval);
                if (unlikely(idigit < 0)) goto done;
                remaining_bits = ((int) sizeof(unsigned int) * 8) - bits - (is_unsigned ? 0 : 1);
                if (unlikely(idigit >= (1L << remaining_bits)))
                    goto raise_overflow;
                val |= ((unsigned int) idigit) << bits;
            }
            if (!is_unsigned) {
                if (unlikely(val & (((unsigned int) 1) << (sizeof(unsigned int) * 8 - 1))))
                    goto raise_overflow;
                if (is_negative)
                    val = ~val;
            }
            ret = 0;
        done:
            Py_XDECREF(shift);
            Py_XDECREF(mask);
            Py_XDECREF(stepval);
    #endif
            if (unlikely(ret))
                return (unsigned int) -1;
            return val;
        }
    raise_overflow:
        PyErr_SetString(PyExc_OverflowError,
            "value too large to convert to unsigned int");
        return (unsigned int) -1;
    raise_neg_overflow:
        PyErr_SetString(PyExc_OverflowError,
            "can't convert negative value to unsigned int");
        return (unsigned int) -1;
    }
    
/* CIntFromPy */
    static CYTHON_INLINE unsigned char __Pyx_PyLong_As_unsigned_char(PyObject *x) {
    #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
    #pragma GCC diagnostic push
    #pragma GCC diagnostic ignored "-Wconversion"
    #endif
        const unsigned char neg_one = (unsigned char) -1, const_zero = (unsigned char) 0;
    #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
    #pragma GCC diagnostic pop
    #endif
        const int is_unsigned = neg_one > const_zero;
        if (unlikely(!PyLong_Check(x))) {
            unsigned char val;
            PyObject *tmp = __Pyx_PyNumber_Long(x);
            if (!tmp) return (unsigned char) -1;
            val = __Pyx_PyLong_As_unsigned_char(tmp);
            Py_DECREF(tmp);
            return val;
        }
        if (is_unsigned) {
    #if CYTHON_USE_PYLONG_INTERNALS
            if (unlikely(__Pyx_PyLong_IsNeg(x))) {
                goto raise_neg_overflow;
            } else if (__Pyx_PyLong_IsCompact(x)) {
                __PYX_VERIFY_RETURN_INT(unsigned char, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
            } else {
                const digit* digits = __Pyx_PyLong_Digits(x);
                assert(__Pyx_PyLong_DigitCount(x) > 1);
                switch (__Pyx_PyLong_DigitCount(x)) {
                    case 2:
                        if ((8 * sizeof(unsigned char) > 1 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(unsigned char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(unsigned char) >= 2 * PyLong_SHIFT)) {
                                return (unsigned char) (((((unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0]));
                            }
                        }
                        break;
                    case 3:
                        if ((8 * sizeof(unsigned char) > 2 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(unsigned char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(unsigned char) >= 3 * PyLong_SHIFT)) {
                                return (unsigned char) (((((((unsigned char)digits[2]) << PyLong_SHIFT) | (unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0]));
                            }
                        }
                        break;
                    case 4:
                        if ((8 * sizeof(unsigned char) > 3 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(unsigned char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(unsigned char) >= 4 * PyLong_SHIFT)) {
                                return (unsigned char) (((((((((unsigned char)digits[3]) << PyLong_SHIFT) | (unsigned char)digits[2]) << PyLong_SHIFT) | (unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0]));
                            }
                        }
                        break;
                }
            }
    #endif
    #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
    #else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (unsigned char) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
    #endif
            if ((sizeof(unsigned char) <= sizeof(unsigned long))) {
                __PYX_VERIFY_RETURN_INT_EXC(unsigned char, unsigned long, PyLong_AsUnsignedLong(x))
            } else if ((sizeof(unsigned char) <= sizeof(unsigned PY_LONG_LONG))) {
                __PYX_VERIFY_RETURN_INT_EXC(unsigned char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
            }
        } else {
    #if CYTHON_USE_PYLONG_INTERNALS
            if (__Pyx_PyLong_IsCompact(x)) {
                __PYX_VERIFY_RETURN_INT(unsigned char, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
            } else {
                const digit* digits = __Pyx_PyLong_Digits(x);
                assert(__Pyx_PyLong_DigitCount(x) > 1);
                switch (__Pyx_PyLong_SignedDigitCount(x)) {
                    case -2:
                        if ((8 * sizeof(unsigned char) - 1 > 1 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(unsigned char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(unsigned char) - 1 > 2 * PyLong_SHIFT)) {
                                return (unsigned char) (((unsigned char)-1)*(((((unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0])));
                            }
                        }
                        break;
                    case 2:
                        if ((8 * sizeof(unsigned char) > 1 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(unsigned char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(unsigned char) - 1 > 2 * PyLong_SHIFT)) {
                                return (unsigned char) ((((((unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0])));
                            }
                        }
                        break;
                    case -3:
                        if ((8 * sizeof(unsigned char) - 1 > 2 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(unsigned char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(unsigned char) - 1 > 3 * PyLong_SHIFT)) {
                                return (unsigned char) (((unsigned char)-1)*(((((((unsigned char)digits[2]) << PyLong_SHIFT) | (unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0])));
                            }
                        }
                        break;
                    case 3:
                        if ((8 * sizeof(unsigned char) > 2 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(unsigned char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(unsigned char) - 1 > 3 * PyLong_SHIFT)) {
                                return (unsigned char) ((((((((unsigned char)digits[2]) << PyLong_SHIFT) | (unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0])));
                            }
                        }
                        break;
                    case -4:
                        if ((8 * sizeof(unsigned char) - 1 > 3 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(unsigned char, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(unsigned char) - 1 > 4 * PyLong_SHIFT)) {
                                return (unsigned char) (((unsigned char)-1)*(((((((((unsigned char)digits[3]) << PyLong_SHIFT) | (unsigned char)digits[2]) << PyLong_SHIFT) | (unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0])));
                            }
                        }
                        break;
                    case 4:
                        if ((8 * sizeof(unsigned char) > 3 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(unsigned char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(unsigned char) - 1 > 4 * PyLong_SHIFT)) {
                                return (unsigned char) ((((((((((unsigned char)digits[3]) << PyLong_SHIFT) | (unsigned char)digits[2]) << PyLong_SHIFT) | (unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0])));
                            }
                        }
                        break;
                }
            }
    #endif
            if ((sizeof(unsigned char) <= sizeof(long))) {
                __PYX_VERIFY_RETURN_INT_EXC(unsigned char, long, PyLong_AsLong(x))
            } else if ((sizeof(unsigned char) <= sizeof(PY_LONG_LONG))) {
                __PYX_VERIFY_RETURN_INT_EXC(unsigned char, PY_LONG_LONG, PyLong_AsLongLong(x))
            }
        }
        {
            unsigned char val;
            int ret = -1;
    #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
            Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
                x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
            if (unlikely(bytes_copied == -1)) {
            } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
                goto raise_overflow;
            } else {
                ret = 0;
            }
    #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
            int one = 1; int is_little = (int)*(unsigned char *)&one;
            unsigned char *bytes = (unsigned char *)&val;
            ret = _PyLong_AsByteArray((PyLongObject *)x,
                                        bytes, sizeof(val),
                                        is_little, !is_unsigned);
    #else
            PyObject *v;
            PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
            int bits, remaining_bits, is_negative = 0;
            int chunk_size = (sizeof(long) < 8) ? 30 : 62;
            if (likely(PyLong_CheckExact(x))) {
                v = __Pyx_NewRef(x);
            } else {
                v = PyNumber_Long(x);
                if (unlikely(!v)) return (unsigned char) -1;
                assert(PyLong_CheckExact(v));
            }
            {
                int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
                if (unlikely(result < 0)) {
                    Py_DECREF(v);
                    return (unsigned char) -1;
                }
                is_negative = result == 1;
            }
            if (is_unsigned && unlikely(is_negative)) {
                Py_DECREF(v);
                goto raise_neg_overflow;
            } else if (is_negative) {
                stepval = PyNumber_Invert(v);
                Py_DECREF(v);
                if (unlikely(!stepval))
                    return (unsigned char) -1;
            } else {
                stepval = v;
            }
            v = NULL;
            val = (unsigned char) 0;
            mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
            shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
            for (bits = 0; bits < (int) sizeof(unsigned char) * 8 - chunk_size; bits += chunk_size) {
                PyObject *tmp, *digit;
                long idigit;
                digit = PyNumber_And(stepval, mask);
                if (unlikely(!digit)) goto done;
                idigit = PyLong_AsLong(digit);
                Py_DECREF(digit);
                if (unlikely(idigit < 0)) goto done;
                val |= ((unsigned char) idigit) << bits;
                tmp = PyNumber_Rshift(stepval, shift);
                if (unlikely(!tmp)) goto done;
                Py_DECREF(stepval); stepval = tmp;
            }
            Py_DECREF(shift); shift = NULL;
            Py_DECREF(mask); mask = NULL;
            {
                long idigit = PyLong_AsLong(stepval);
                if (unlikely(idigit < 0)) goto done;
                remaining_bits = ((int) sizeof(unsigned char) * 8) - bits - (is_unsigned ? 0 : 1);
                if (unlikely(idigit >= (1L << remaining_bits)))
                    goto raise_overflow;
                val |= ((unsigned char) idigit) << bits;
            }
            if (!is_unsigned) {
                if (unlikely(val & (((unsigned char) 1) << (sizeof(unsigned char) * 8 - 1))))
                    goto raise_overflow;
                if (is_negative)
                    val = ~val;
            }
            ret = 0;
        done:
            Py_XDECREF(shift);
            Py_XDECREF(mask);
            Py_XDECREF(stepval);
    #endif
            if (unlikely(ret))
                return (unsigned char) -1;
            return val;
        }
    raise_overflow:
        PyErr_SetString(PyExc_OverflowError,
            "value too large to convert to unsigned char");
        return (unsigned char) -1;
    raise_neg_overflow:
        PyErr_SetString(PyExc_OverflowError,
            "can't convert negative value to unsigned char");
        return (unsigned char) -1;
    }
    
/* CIntFromPy */
    static CYTHON_INLINE unsigned short __Pyx_PyLong_As_unsigned_short(PyObject *x) {
    #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
    #pragma GCC diagnostic push
    #pragma GCC diagnostic ignored "-Wconversion"
    #endif
        const unsigned short neg_one = (unsigned short) -1, const_zero = (unsigned short) 0;
    #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
    #pragma GCC diagnostic pop
    #endif
        const int is_unsigned = neg_one > const_zero;
        if (unlikely(!PyLong_Check(x))) {
            unsigned short val;
            PyObject *tmp = __Pyx_PyNumber_Long(x);
            if (!tmp) return (unsigned short) -1;
            val = __Pyx_PyLong_As_unsigned_short(tmp);
            Py_DECREF(tmp);
            return val;
        }
        if (is_unsigned) {
    #if CYTHON_USE_PYLONG_INTERNALS
            if (unlikely(__Pyx_PyLong_IsNeg(x))) {
                goto raise_neg_overflow;
            } else if (__Pyx_PyLong_IsCompact(x)) {
                __PYX_VERIFY_RETURN_INT(unsigned short, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
            } else {
                const digit* digits = __Pyx_PyLong_Digits(x);
                assert(__Pyx_PyLong_DigitCount(x) > 1);
                switch (__Pyx_PyLong_DigitCount(x)) {
                    case 2:
                        if ((8 * sizeof(unsigned short) > 1 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(unsigned short, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(unsigned short) >= 2 * PyLong_SHIFT)) {
                                return (unsigned short) (((((unsigned short)digits[1]) << PyLong_SHIFT) | (unsigned short)digits[0]));
                            }
                        }
                        break;
                    case 3:
                        if ((8 * sizeof(unsigned short) > 2 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(unsigned short, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(unsigned short) >= 3 * PyLong_SHIFT)) {
                                return (unsigned short) (((((((unsigned short)digits[2]) << PyLong_SHIFT) | (unsigned short)digits[1]) << PyLong_SHIFT) | (unsigned short)digits[0]));
                            }
                        }
                        break;
                    case 4:
                        if ((8 * sizeof(unsigned short) > 3 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(unsigned short, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(unsigned short) >= 4 * PyLong_SHIFT)) {
                                return (unsigned short) (((((((((unsigned short)digits[3]) << PyLong_SHIFT) | (unsigned short)digits[2]) << PyLong_SHIFT) | (unsigned short)digits[1]) << PyLong_SHIFT) | (unsigned short)digits[0]));
                            }
                        }
                        break;
                }
            }
    #endif
    #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
    #else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (unsigned short) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
    #endif
            if ((sizeof(unsigned short) <= sizeof(unsigned long))) {
                __PYX_VERIFY_RETURN_INT_EXC(unsigned short, unsigned long, PyLong_AsUnsignedLong(x))
            } else if ((sizeof(unsigned short) <= sizeof(unsigned PY_LONG_LONG))) {
                __PYX_VERIFY_RETURN_INT_EXC(unsigned short, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
            }
        } else {
    #if CYTHON_USE_PYLONG_INTERNALS
            if (__Pyx_PyLong_IsCompact(x)) {
                __PYX_VERIFY_RETURN_INT(unsigned short, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
            } else {
                const digit* digits = __Pyx_PyLong_Digits(x);
                assert(__Pyx_PyLong_DigitCount(x) > 1);
                switch (__Pyx_PyLong_SignedDigitCount(x)) {
                    case -2:
                        if ((8 * sizeof(unsigned short) - 1 > 1 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(unsigned short, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(unsigned short) - 1 > 2 * PyLong_SHIFT)) {
                                return (unsigned short) (((unsigned short)-1)*(((((unsigned short)digits[1]) << PyLong_SHIFT) | (unsigned short)digits[0])));
                            }
                        }
                        break;
                    case 2:
                        if ((8 * sizeof(unsigned short) > 1 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(unsigned short, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(unsigned short) - 1 > 2 * PyLong_SHIFT)) {
                                return (unsigned short) ((((((unsigned short)digits[1]) << PyLong_SHIFT) | (unsigned short)digits[0])));
                            }
                        }
                        break;
                    case -3:
                        if ((8 * sizeof(unsigned short) - 1 > 2 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(unsigned short, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(unsigned short) - 1 > 3 * PyLong_SHIFT)) {
                                return (unsigned short) (((unsigned short)-1)*(((((((unsigned short)digits[2]) << PyLong_SHIFT) | (unsigned short)digits[1]) << PyLong_SHIFT) | (unsigned short)digits[0])));
                            }
                        }
                        break;
                    case 3:
                        if ((8 * sizeof(unsigned short) > 2 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(unsigned short, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(unsigned short) - 1 > 3 * PyLong_SHIFT)) {
                                return (unsigned short) ((((((((unsigned short)digits[2]) << PyLong_SHIFT) | (unsigned short)digits[1]) << PyLong_SHIFT) | (unsigned short)digits[0])));
                            }
                        }
                        break;
                    case -4:
                        if ((8 * sizeof(unsigned short) - 1 > 3 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(unsigned short, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(unsigned short) - 1 > 4 * PyLong_SHIFT)) {
                                return (unsigned short) (((unsigned short)-1)*(((((((((unsigned short)digits[3]) << PyLong_SHIFT) | (unsigned short)digits[2]) << PyLong_SHIFT) | (unsigned short)digits[1]) << PyLong_SHIFT) | (unsigned short)digits[0])));
                            }
                        }
                        break;
                    case 4:
                        if ((8 * sizeof(unsigned short) > 3 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(unsigned short, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(unsigned short) - 1 > 4 * PyLong_SHIFT)) {
                                return (unsigned short) ((((((((((unsigned short)digits[3]) << PyLong_SHIFT) | (unsigned short)digits[2]) << PyLong_SHIFT) | (unsigned short)digits[1]) << PyLong_SHIFT) | (unsigned short)digits[0])));
                            }
                        }
                        break;
                }
            }
    #endif
            if ((sizeof(unsigned short) <= sizeof(long))) {
                __PYX_VERIFY_RETURN_INT_EXC(unsigned short, long, PyLong_AsLong(x))
            } else if ((sizeof(unsigned short) <= sizeof(PY_LONG_LONG))) {
                __PYX_VERIFY_RETURN_INT_EXC(unsigned short, PY_LONG_LONG, PyLong_AsLongLong(x))
            }
        }
        {
            unsigned short val;
            int ret = -1;
    #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
            Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
                x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
            if (unlikely(bytes_copied == -1)) {
            } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
                goto raise_overflow;
            } else {
                ret = 0;
            }
    #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
            int one = 1; int is_little = (int)*(unsigned char *)&one;
            unsigned char *bytes = (unsigned char *)&val;
            ret = _PyLong_AsByteArray((PyLongObject *)x,
                                        bytes, sizeof(val),
                                        is_little, !is_unsigned);
    #else
            PyObject *v;
            PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
            int bits, remaining_bits, is_negative = 0;
            int chunk_size = (sizeof(long) < 8) ? 30 : 62;
            if (likely(PyLong_CheckExact(x))) {
                v = __Pyx_NewRef(x);
            } else {
                v = PyNumber_Long(x);
                if (unlikely(!v)) return (unsigned short) -1;
                assert(PyLong_CheckExact(v));
            }
            {
                int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
                if (unlikely(result < 0)) {
                    Py_DECREF(v);
                    return (unsigned short) -1;
                }
                is_negative = result == 1;
            }
            if (is_unsigned && unlikely(is_negative)) {
                Py_DECREF(v);
                goto raise_neg_overflow;
            } else if (is_negative) {
                stepval = PyNumber_Invert(v);
                Py_DECREF(v);
                if (unlikely(!stepval))
                    return (unsigned short) -1;
            } else {
                stepval = v;
            }
            v = NULL;
            val = (unsigned short) 0;
            mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
            shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
            for (bits = 0; bits < (int) sizeof(unsigned short) * 8 - chunk_size; bits += chunk_size) {
                PyObject *tmp, *digit;
                long idigit;
                digit = PyNumber_And(stepval, mask);
                if (unlikely(!digit)) goto done;
                idigit = PyLong_AsLong(digit);
                Py_DECREF(digit);
                if (unlikely(idigit < 0)) goto done;
                val |= ((unsigned short) idigit) << bits;
                tmp = PyNumber_Rshift(stepval, shift);
                if (unlikely(!tmp)) goto done;
                Py_DECREF(stepval); stepval = tmp;
            }
            Py_DECREF(shift); shift = NULL;
            Py_DECREF(mask); mask = NULL;
            {
                long idigit = PyLong_AsLong(stepval);
                if (unlikely(idigit < 0)) goto done;
                remaining_bits = ((int) sizeof(unsigned short) * 8) - bits - (is_unsigned ? 0 : 1);
                if (unlikely(idigit >= (1L << remaining_bits)))
                    goto raise_overflow;
                val |= ((unsigned short) idigit) << bits;
            }
            if (!is_unsigned) {
                if (unlikely(val & (((unsigned short) 1) << (sizeof(unsigned short) * 8 - 1))))
                    goto raise_overflow;
                if (is_negative)
                    val = ~val;
            }
            ret = 0;
        done:
            Py_XDECREF(shift);
            Py_XDECREF(mask);
            Py_XDECREF(stepval);
    #endif
            if (unlikely(ret))
                return (unsigned short) -1;
            return val;
        }
    raise_overflow:
        PyErr_SetString(PyExc_OverflowError,
            "value too large to convert to unsigned short");
        return (unsigned short) -1;
    raise_neg_overflow:
        PyErr_SetString(PyExc_OverflowError,
            "can't convert negative value to unsigned short");
        return (unsigned short) -1;
    }
    
/* CIntToPy */
    static CYTHON_INLINE PyObject* __Pyx_PyLong_From_char(char value) {
    #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
    #pragma GCC diagnostic push
    #pragma GCC diagnostic ignored "-Wconversion"
    #endif
        const char neg_one = (char) -1, const_zero = (char) 0;
    #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
    #pragma GCC diagnostic pop
    #endif
        const int is_unsigned = neg_one > const_zero;
        if (is_unsigned) {
            if (sizeof(char) < sizeof(long)) {
                return PyLong_FromLong((long) value);
            } else if (sizeof(char) <= sizeof(unsigned long)) {
                return PyLong_FromUnsignedLong((unsigned long) value);
    #if !CYTHON_COMPILING_IN_PYPY
            } else if (sizeof(char) <= sizeof(unsigned PY_LONG_LONG)) {
                return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
    #endif
            }
        } else {
            if (sizeof(char) <= sizeof(long)) {
                return PyLong_FromLong((long) value);
            } else if (sizeof(char) <= sizeof(PY_LONG_LONG)) {
                return PyLong_FromLongLong((PY_LONG_LONG) value);
            }
        }
        {
            unsigned char *bytes = (unsigned char *)&value;
    #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
            if (is_unsigned) {
                return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
            } else {
                return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
            }
    #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
            int one = 1; int little = (int)*(unsigned char *)&one;
            return _PyLong_FromByteArray(bytes, sizeof(char),
                                         little, !is_unsigned);
    #else
            int one = 1; int little = (int)*(unsigned char *)&one;
            PyObject *from_bytes, *result = NULL, *kwds = NULL;
            PyObject *py_bytes = NULL, *order_str = NULL;
            from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
            if (!from_bytes) return NULL;
            py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(char));
            if (!py_bytes) goto limited_bad;
            order_str = PyUnicode_FromString(little ? "little" : "big");
            if (!order_str) goto limited_bad;
            {
                PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
                if (!is_unsigned) {
                    kwds = __Pyx_MakeVectorcallBuilderKwds(1);
                    if (!kwds) goto limited_bad;
                    if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
                }
                result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
            }
            limited_bad:
            Py_XDECREF(kwds);
            Py_XDECREF(order_str);
            Py_XDECREF(py_bytes);
            Py_XDECREF(from_bytes);
            return result;
    #endif
        }
    }
    
/* CIntFromPy */
    static CYTHON_INLINE xmlChar __Pyx_PyLong_As_xmlChar(PyObject *x) {
    #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
    #pragma GCC diagnostic push
    #pragma GCC diagnostic ignored "-Wconversion"
    #endif
        const xmlChar neg_one = (xmlChar) -1, const_zero = (xmlChar) 0;
    #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
    #pragma GCC diagnostic pop
    #endif
        const int is_unsigned = neg_one > const_zero;
        if (unlikely(!PyLong_Check(x))) {
            xmlChar val;
            PyObject *tmp = __Pyx_PyNumber_Long(x);
            if (!tmp) return (xmlChar) -1;
            val = __Pyx_PyLong_As_xmlChar(tmp);
            Py_DECREF(tmp);
            return val;
        }
        if (is_unsigned) {
    #if CYTHON_USE_PYLONG_INTERNALS
            if (unlikely(__Pyx_PyLong_IsNeg(x))) {
                goto raise_neg_overflow;
            } else if (__Pyx_PyLong_IsCompact(x)) {
                __PYX_VERIFY_RETURN_INT(xmlChar, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
            } else {
                const digit* digits = __Pyx_PyLong_Digits(x);
                assert(__Pyx_PyLong_DigitCount(x) > 1);
                switch (__Pyx_PyLong_DigitCount(x)) {
                    case 2:
                        if ((8 * sizeof(xmlChar) > 1 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(xmlChar, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(xmlChar) >= 2 * PyLong_SHIFT)) {
                                return (xmlChar) (((((xmlChar)digits[1]) << PyLong_SHIFT) | (xmlChar)digits[0]));
                            }
                        }
                        break;
                    case 3:
                        if ((8 * sizeof(xmlChar) > 2 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(xmlChar, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(xmlChar) >= 3 * PyLong_SHIFT)) {
                                return (xmlChar) (((((((xmlChar)digits[2]) << PyLong_SHIFT) | (xmlChar)digits[1]) << PyLong_SHIFT) | (xmlChar)digits[0]));
                            }
                        }
                        break;
                    case 4:
                        if ((8 * sizeof(xmlChar) > 3 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(xmlChar, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(xmlChar) >= 4 * PyLong_SHIFT)) {
                                return (xmlChar) (((((((((xmlChar)digits[3]) << PyLong_SHIFT) | (xmlChar)digits[2]) << PyLong_SHIFT) | (xmlChar)digits[1]) << PyLong_SHIFT) | (xmlChar)digits[0]));
                            }
                        }
                        break;
                }
            }
    #endif
    #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
    #else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (xmlChar) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
    #endif
            if ((sizeof(xmlChar) <= sizeof(unsigned long))) {
                __PYX_VERIFY_RETURN_INT_EXC(xmlChar, unsigned long, PyLong_AsUnsignedLong(x))
            } else if ((sizeof(xmlChar) <= sizeof(unsigned PY_LONG_LONG))) {
                __PYX_VERIFY_RETURN_INT_EXC(xmlChar, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
            }
        } else {
    #if CYTHON_USE_PYLONG_INTERNALS
            if (__Pyx_PyLong_IsCompact(x)) {
                __PYX_VERIFY_RETURN_INT(xmlChar, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
            } else {
                const digit* digits = __Pyx_PyLong_Digits(x);
                assert(__Pyx_PyLong_DigitCount(x) > 1);
                switch (__Pyx_PyLong_SignedDigitCount(x)) {
                    case -2:
                        if ((8 * sizeof(xmlChar) - 1 > 1 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(xmlChar, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(xmlChar) - 1 > 2 * PyLong_SHIFT)) {
                                return (xmlChar) (((xmlChar)-1)*(((((xmlChar)digits[1]) << PyLong_SHIFT) | (xmlChar)digits[0])));
                            }
                        }
                        break;
                    case 2:
                        if ((8 * sizeof(xmlChar) > 1 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(xmlChar, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(xmlChar) - 1 > 2 * PyLong_SHIFT)) {
                                return (xmlChar) ((((((xmlChar)digits[1]) << PyLong_SHIFT) | (xmlChar)digits[0])));
                            }
                        }
                        break;
                    case -3:
                        if ((8 * sizeof(xmlChar) - 1 > 2 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(xmlChar, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(xmlChar) - 1 > 3 * PyLong_SHIFT)) {
                                return (xmlChar) (((xmlChar)-1)*(((((((xmlChar)digits[2]) << PyLong_SHIFT) | (xmlChar)digits[1]) << PyLong_SHIFT) | (xmlChar)digits[0])));
                            }
                        }
                        break;
                    case 3:
                        if ((8 * sizeof(xmlChar) > 2 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(xmlChar, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(xmlChar) - 1 > 3 * PyLong_SHIFT)) {
                                return (xmlChar) ((((((((xmlChar)digits[2]) << PyLong_SHIFT) | (xmlChar)digits[1]) << PyLong_SHIFT) | (xmlChar)digits[0])));
                            }
                        }
                        break;
                    case -4:
                        if ((8 * sizeof(xmlChar) - 1 > 3 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(xmlChar, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(xmlChar) - 1 > 4 * PyLong_SHIFT)) {
                                return (xmlChar) (((xmlChar)-1)*(((((((((xmlChar)digits[3]) << PyLong_SHIFT) | (xmlChar)digits[2]) << PyLong_SHIFT) | (xmlChar)digits[1]) << PyLong_SHIFT) | (xmlChar)digits[0])));
                            }
                        }
                        break;
                    case 4:
                        if ((8 * sizeof(xmlChar) > 3 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(xmlChar, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(xmlChar) - 1 > 4 * PyLong_SHIFT)) {
                                return (xmlChar) ((((((((((xmlChar)digits[3]) << PyLong_SHIFT) | (xmlChar)digits[2]) << PyLong_SHIFT) | (xmlChar)digits[1]) << PyLong_SHIFT) | (xmlChar)digits[0])));
                            }
                        }
                        break;
                }
            }
    #endif
            if ((sizeof(xmlChar) <= sizeof(long))) {
                __PYX_VERIFY_RETURN_INT_EXC(xmlChar, long, PyLong_AsLong(x))
            } else if ((sizeof(xmlChar) <= sizeof(PY_LONG_LONG))) {
                __PYX_VERIFY_RETURN_INT_EXC(xmlChar, PY_LONG_LONG, PyLong_AsLongLong(x))
            }
        }
        {
            xmlChar val;
            int ret = -1;
    #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
            Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
                x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
            if (unlikely(bytes_copied == -1)) {
            } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
                goto raise_overflow;
            } else {
                ret = 0;
            }
    #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
            int one = 1; int is_little = (int)*(unsigned char *)&one;
            unsigned char *bytes = (unsigned char *)&val;
            ret = _PyLong_AsByteArray((PyLongObject *)x,
                                        bytes, sizeof(val),
                                        is_little, !is_unsigned);
    #else
            PyObject *v;
            PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
            int bits, remaining_bits, is_negative = 0;
            int chunk_size = (sizeof(long) < 8) ? 30 : 62;
            if (likely(PyLong_CheckExact(x))) {
                v = __Pyx_NewRef(x);
            } else {
                v = PyNumber_Long(x);
                if (unlikely(!v)) return (xmlChar) -1;
                assert(PyLong_CheckExact(v));
            }
            {
                int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
                if (unlikely(result < 0)) {
                    Py_DECREF(v);
                    return (xmlChar) -1;
                }
                is_negative = result == 1;
            }
            if (is_unsigned && unlikely(is_negative)) {
                Py_DECREF(v);
                goto raise_neg_overflow;
            } else if (is_negative) {
                stepval = PyNumber_Invert(v);
                Py_DECREF(v);
                if (unlikely(!stepval))
                    return (xmlChar) -1;
            } else {
                stepval = v;
            }
            v = NULL;
            val = (xmlChar) 0;
            mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
            shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
            for (bits = 0; bits < (int) sizeof(xmlChar) * 8 - chunk_size; bits += chunk_size) {
                PyObject *tmp, *digit;
                long idigit;
                digit = PyNumber_And(stepval, mask);
                if (unlikely(!digit)) goto done;
                idigit = PyLong_AsLong(digit);
                Py_DECREF(digit);
                if (unlikely(idigit < 0)) goto done;
                val |= ((xmlChar) idigit) << bits;
                tmp = PyNumber_Rshift(stepval, shift);
                if (unlikely(!tmp)) goto done;
                Py_DECREF(stepval); stepval = tmp;
            }
            Py_DECREF(shift); shift = NULL;
            Py_DECREF(mask); mask = NULL;
            {
                long idigit = PyLong_AsLong(stepval);
                if (unlikely(idigit < 0)) goto done;
                remaining_bits = ((int) sizeof(xmlChar) * 8) - bits - (is_unsigned ? 0 : 1);
                if (unlikely(idigit >= (1L << remaining_bits)))
                    goto raise_overflow;
                val |= ((xmlChar) idigit) << bits;
            }
            if (!is_unsigned) {
                if (unlikely(val & (((xmlChar) 1) << (sizeof(xmlChar) * 8 - 1))))
                    goto raise_overflow;
                if (is_negative)
                    val = ~val;
            }
            ret = 0;
        done:
            Py_XDECREF(shift);
            Py_XDECREF(mask);
            Py_XDECREF(stepval);
    #endif
            if (unlikely(ret))
                return (xmlChar) -1;
            return val;
        }
    raise_overflow:
        PyErr_SetString(PyExc_OverflowError,
            "value too large to convert to xmlChar");
        return (xmlChar) -1;
    raise_neg_overflow:
        PyErr_SetString(PyExc_OverflowError,
            "can't convert negative value to xmlChar");
        return (xmlChar) -1;
    }
    
/* CIntToPy */
    static CYTHON_INLINE PyObject* __Pyx_PyLong_From_xmlErrorDomain(xmlErrorDomain value) {
    #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
    #pragma GCC diagnostic push
    #pragma GCC diagnostic ignored "-Wconversion"
    #endif
        const xmlErrorDomain neg_one = (xmlErrorDomain) -1, const_zero = (xmlErrorDomain) 0;
    #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
    #pragma GCC diagnostic pop
    #endif
        const int is_unsigned = neg_one > const_zero;
        if (is_unsigned) {
            if (sizeof(xmlErrorDomain) < sizeof(long)) {
                return PyLong_FromLong((long) value);
            } else if (sizeof(xmlErrorDomain) <= sizeof(unsigned long)) {
                return PyLong_FromUnsignedLong((unsigned long) value);
    #if !CYTHON_COMPILING_IN_PYPY
            } else if (sizeof(xmlErrorDomain) <= sizeof(unsigned PY_LONG_LONG)) {
                return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
    #endif
            }
        } else {
            if (sizeof(xmlErrorDomain) <= sizeof(long)) {
                return PyLong_FromLong((long) value);
            } else if (sizeof(xmlErrorDomain) <= sizeof(PY_LONG_LONG)) {
                return PyLong_FromLongLong((PY_LONG_LONG) value);
            }
        }
        {
            unsigned char *bytes = (unsigned char *)&value;
    #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
            if (is_unsigned) {
                return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
            } else {
                return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
            }
    #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
            int one = 1; int little = (int)*(unsigned char *)&one;
            return _PyLong_FromByteArray(bytes, sizeof(xmlErrorDomain),
                                         little, !is_unsigned);
    #else
            int one = 1; int little = (int)*(unsigned char *)&one;
            PyObject *from_bytes, *result = NULL, *kwds = NULL;
            PyObject *py_bytes = NULL, *order_str = NULL;
            from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
            if (!from_bytes) return NULL;
            py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(xmlErrorDomain));
            if (!py_bytes) goto limited_bad;
            order_str = PyUnicode_FromString(little ? "little" : "big");
            if (!order_str) goto limited_bad;
            {
                PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
                if (!is_unsigned) {
                    kwds = __Pyx_MakeVectorcallBuilderKwds(1);
                    if (!kwds) goto limited_bad;
                    if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
                }
                result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
            }
            limited_bad:
            Py_XDECREF(kwds);
            Py_XDECREF(order_str);
            Py_XDECREF(py_bytes);
            Py_XDECREF(from_bytes);
            return result;
    #endif
        }
    }
    
/* CIntToPy */
    static CYTHON_INLINE PyObject* __Pyx_PyLong_From_xmlErrorLevel(xmlErrorLevel value) {
    #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
    #pragma GCC diagnostic push
    #pragma GCC diagnostic ignored "-Wconversion"
    #endif
        const xmlErrorLevel neg_one = (xmlErrorLevel) -1, const_zero = (xmlErrorLevel) 0;
    #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
    #pragma GCC diagnostic pop
    #endif
        const int is_unsigned = neg_one > const_zero;
        if (is_unsigned) {
            if (sizeof(xmlErrorLevel) < sizeof(long)) {
                return PyLong_FromLong((long) value);
            } else if (sizeof(xmlErrorLevel) <= sizeof(unsigned long)) {
                return PyLong_FromUnsignedLong((unsigned long) value);
    #if !CYTHON_COMPILING_IN_PYPY
            } else if (sizeof(xmlErrorLevel) <= sizeof(unsigned PY_LONG_LONG)) {
                return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
    #endif
            }
        } else {
            if (sizeof(xmlErrorLevel) <= sizeof(long)) {
                return PyLong_FromLong((long) value);
            } else if (sizeof(xmlErrorLevel) <= sizeof(PY_LONG_LONG)) {
                return PyLong_FromLongLong((PY_LONG_LONG) value);
            }
        }
        {
            unsigned char *bytes = (unsigned char *)&value;
    #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
            if (is_unsigned) {
                return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
            } else {
                return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
            }
    #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
            int one = 1; int little = (int)*(unsigned char *)&one;
            return _PyLong_FromByteArray(bytes, sizeof(xmlErrorLevel),
                                         little, !is_unsigned);
    #else
            int one = 1; int little = (int)*(unsigned char *)&one;
            PyObject *from_bytes, *result = NULL, *kwds = NULL;
            PyObject *py_bytes = NULL, *order_str = NULL;
            from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
            if (!from_bytes) return NULL;
            py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(xmlErrorLevel));
            if (!py_bytes) goto limited_bad;
            order_str = PyUnicode_FromString(little ? "little" : "big");
            if (!order_str) goto limited_bad;
            {
                PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
                if (!is_unsigned) {
                    kwds = __Pyx_MakeVectorcallBuilderKwds(1);
                    if (!kwds) goto limited_bad;
                    if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
                }
                result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
            }
            limited_bad:
            Py_XDECREF(kwds);
            Py_XDECREF(order_str);
            Py_XDECREF(py_bytes);
            Py_XDECREF(from_bytes);
            return result;
    #endif
        }
    }
    
/* CIntToPy */
    static CYTHON_INLINE PyObject* __Pyx_PyLong_From_unsigned_char(unsigned char value) {
    #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
    #pragma GCC diagnostic push
    #pragma GCC diagnostic ignored "-Wconversion"
    #endif
        const unsigned char neg_one = (unsigned char) -1, const_zero = (unsigned char) 0;
    #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
    #pragma GCC diagnostic pop
    #endif
        const int is_unsigned = neg_one > const_zero;
        if (is_unsigned) {
            if (sizeof(unsigned char) < sizeof(long)) {
                return PyLong_FromLong((long) value);
            } else if (sizeof(unsigned char) <= sizeof(unsigned long)) {
                return PyLong_FromUnsignedLong((unsigned long) value);
    #if !CYTHON_COMPILING_IN_PYPY
            } else if (sizeof(unsigned char) <= sizeof(unsigned PY_LONG_LONG)) {
                return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
    #endif
            }
        } else {
            if (sizeof(unsigned char) <= sizeof(long)) {
                return PyLong_FromLong((long) value);
            } else if (sizeof(unsigned char) <= sizeof(PY_LONG_LONG)) {
                return PyLong_FromLongLong((PY_LONG_LONG) value);
            }
        }
        {
            unsigned char *bytes = (unsigned char *)&value;
    #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
            if (is_unsigned) {
                return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
            } else {
                return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
            }
    #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
            int one = 1; int little = (int)*(unsigned char *)&one;
            return _PyLong_FromByteArray(bytes, sizeof(unsigned char),
                                         little, !is_unsigned);
    #else
            int one = 1; int little = (int)*(unsigned char *)&one;
            PyObject *from_bytes, *result = NULL, *kwds = NULL;
            PyObject *py_bytes = NULL, *order_str = NULL;
            from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
            if (!from_bytes) return NULL;
            py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(unsigned char));
            if (!py_bytes) goto limited_bad;
            order_str = PyUnicode_FromString(little ? "little" : "big");
            if (!order_str) goto limited_bad;
            {
                PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
                if (!is_unsigned) {
                    kwds = __Pyx_MakeVectorcallBuilderKwds(1);
                    if (!kwds) goto limited_bad;
                    if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
                }
                result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
            }
            limited_bad:
            Py_XDECREF(kwds);
            Py_XDECREF(order_str);
            Py_XDECREF(py_bytes);
            Py_XDECREF(from_bytes);
            return result;
    #endif
        }
    }
    
/* BytesContains */
    static CYTHON_INLINE int __Pyx_BytesContains(PyObject* bytes, char character) {
        const Py_ssize_t length = __Pyx_PyBytes_GET_SIZE(bytes);
    #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely(length == -1)) return -1;
    #endif
        const char* char_start = __Pyx_PyBytes_AsString(bytes);
    #if !CYTHON_ASSUME_SAFE_MACROS
        if (unlikely(!char_start)) return -1;
    #endif
        return memchr(char_start, (unsigned char)character, (size_t)length) != NULL;
    }
    
/* ObjectAsUCS4 */
    static void __Pyx__PyObject_AsPy_UCS4_raise_error(long ival) {
       if (ival < 0) {
           if (!PyErr_Occurred())
               PyErr_SetString(PyExc_OverflowError,
                               "cannot convert negative value to Py_UCS4");
       } else {
           PyErr_SetString(PyExc_OverflowError,
                           "value too large to convert to Py_UCS4");
       }
    }
    static Py_UCS4 __Pyx__PyObject_AsPy_UCS4(PyObject* x) {
       long ival;
       ival = __Pyx_PyLong_As_long(x);
       if (unlikely(!__Pyx_is_valid_index(ival, 1114111 + 1))) {
           __Pyx__PyObject_AsPy_UCS4_raise_error(ival);
           return (Py_UCS4)-1;
       }
       return (Py_UCS4)ival;
    }
    
/* UpdateUnpickledDict */
    static int __Pyx__UpdateUnpickledDict(PyObject *obj, PyObject *state, Py_ssize_t index) {
        PyObject *state_dict = __Pyx_PySequence_ITEM(state, index);
        if (unlikely(!state_dict)) {
            return -1;
        }
        int non_empty = PyObject_IsTrue(state_dict);
        if (non_empty == 0) {
            Py_DECREF(state_dict);
            return 0;
        } else if (unlikely(non_empty == -1)) {
            return -1;
        }
        PyObject *dict;
        #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
        dict = PyObject_GetAttrString(obj, "__dict__");
        #else
        dict = PyObject_GenericGetDict(obj, NULL);
        #endif
        if (unlikely(!dict)) {
            Py_DECREF(state_dict);
            return -1;
        }
        int result;
        if (likely(PyDict_CheckExact(dict))) {
            result = PyDict_Update(dict, state_dict);
        } else {
            PyObject *obj_result = __Pyx_PyObject_CallMethod1(dict, __pyx_mstate_global->__pyx_n_u_update, state_dict);
            if (likely(obj_result)) {
                Py_DECREF(obj_result);
                result = 0;
            } else {
                result = -1;
            }
        }
        Py_DECREF(state_dict);
        Py_DECREF(dict);
        return result;
    }
    static int __Pyx_UpdateUnpickledDict(PyObject *obj, PyObject *state, Py_ssize_t index) {
        Py_ssize_t state_size = __Pyx_PyTuple_GET_SIZE(state);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely(state_size == -1)) return -1;
        #endif
        if (state_size <= index) {
            return 0;
        }
        return __Pyx__UpdateUnpickledDict(obj, state, index);
    }
    
/* CheckUnpickleChecksum */
    static void __Pyx_RaiseUnpickleChecksumError(long checksum, long checksum1, long checksum2, long checksum3, const char *members) {
        PyObject *pickle_module = PyImport_ImportModule("pickle");
        if (unlikely(!pickle_module)) return;
        PyObject *pickle_error = PyObject_GetAttrString(pickle_module, "PickleError");
        Py_DECREF(pickle_module);
        if (unlikely(!pickle_error)) return;
        if (checksum2 == checksum1) {
            PyErr_Format(pickle_error, "Incompatible checksums (0x%x vs (0x%x) = (%s))",
                checksum, checksum1, members);
        } else if (checksum3 == checksum2) {
            PyErr_Format(pickle_error, "Incompatible checksums (0x%x vs (0x%x, 0x%x) = (%s))",
                checksum, checksum1, checksum2, members);
        } else {
            PyErr_Format(pickle_error, "Incompatible checksums (0x%x vs (0x%x, 0x%x, 0x%x) = (%s))",
                checksum, checksum1, checksum2, checksum3, members);
        }
        Py_DECREF(pickle_error);
    }
    static int __Pyx_CheckUnpickleChecksum(long checksum, long checksum1, long checksum2, long checksum3, const char *members) {
        int found = 0;
        found |= checksum1 == checksum;
        found |= checksum2 == checksum;
        found |= checksum3 == checksum;
        if (likely(found))
            return 0;
        __Pyx_RaiseUnpickleChecksumError(checksum, checksum1, checksum2, checksum3, members);
        return -1;
    }
    
/* CIntFromPy */
    static CYTHON_INLINE long __Pyx_PyLong_As_long(PyObject *x) {
    #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
    #pragma GCC diagnostic push
    #pragma GCC diagnostic ignored "-Wconversion"
    #endif
        const long neg_one = (long) -1, const_zero = (long) 0;
    #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
    #pragma GCC diagnostic pop
    #endif
        const int is_unsigned = neg_one > const_zero;
        if (unlikely(!PyLong_Check(x))) {
            long val;
            PyObject *tmp = __Pyx_PyNumber_Long(x);
            if (!tmp) return (long) -1;
            val = __Pyx_PyLong_As_long(tmp);
            Py_DECREF(tmp);
            return val;
        }
        if (is_unsigned) {
    #if CYTHON_USE_PYLONG_INTERNALS
            if (unlikely(__Pyx_PyLong_IsNeg(x))) {
                goto raise_neg_overflow;
            } else if (__Pyx_PyLong_IsCompact(x)) {
                __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
            } else {
                const digit* digits = __Pyx_PyLong_Digits(x);
                assert(__Pyx_PyLong_DigitCount(x) > 1);
                switch (__Pyx_PyLong_DigitCount(x)) {
                    case 2:
                        if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) {
                                return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                            }
                        }
                        break;
                    case 3:
                        if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) {
                                return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                            }
                        }
                        break;
                    case 4:
                        if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) {
                                return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                            }
                        }
                        break;
                }
            }
    #endif
    #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
    #else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (long) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
    #endif
            if ((sizeof(long) <= sizeof(unsigned long))) {
                __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
            } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) {
                __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
            }
        } else {
    #if CYTHON_USE_PYLONG_INTERNALS
            if (__Pyx_PyLong_IsCompact(x)) {
                __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
            } else {
                const digit* digits = __Pyx_PyLong_Digits(x);
                assert(__Pyx_PyLong_DigitCount(x) > 1);
                switch (__Pyx_PyLong_SignedDigitCount(x)) {
                    case -2:
                        if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
                                return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                            }
                        }
                        break;
                    case 2:
                        if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
                                return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                            }
                        }
                        break;
                    case -3:
                        if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
                                return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                            }
                        }
                        break;
                    case 3:
                        if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
                                return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                            }
                        }
                        break;
                    case -4:
                        if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) {
                                return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                            }
                        }
                        break;
                    case 4:
                        if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) {
                                return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                            }
                        }
                        break;
                }
            }
    #endif
            if ((sizeof(long) <= sizeof(long))) {
                __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
            } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) {
                __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
            }
        }
        {
            long val;
            int ret = -1;
    #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
            Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
                x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
            if (unlikely(bytes_copied == -1)) {
            } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
                goto raise_overflow;
            } else {
                ret = 0;
            }
    #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
            int one = 1; int is_little = (int)*(unsigned char *)&one;
            unsigned char *bytes = (unsigned char *)&val;
            ret = _PyLong_AsByteArray((PyLongObject *)x,
                                        bytes, sizeof(val),
                                        is_little, !is_unsigned);
    #else
            PyObject *v;
            PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
            int bits, remaining_bits, is_negative = 0;
            int chunk_size = (sizeof(long) < 8) ? 30 : 62;
            if (likely(PyLong_CheckExact(x))) {
                v = __Pyx_NewRef(x);
            } else {
                v = PyNumber_Long(x);
                if (unlikely(!v)) return (long) -1;
                assert(PyLong_CheckExact(v));
            }
            {
                int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
                if (unlikely(result < 0)) {
                    Py_DECREF(v);
                    return (long) -1;
                }
                is_negative = result == 1;
            }
            if (is_unsigned && unlikely(is_negative)) {
                Py_DECREF(v);
                goto raise_neg_overflow;
            } else if (is_negative) {
                stepval = PyNumber_Invert(v);
                Py_DECREF(v);
                if (unlikely(!stepval))
                    return (long) -1;
            } else {
                stepval = v;
            }
            v = NULL;
            val = (long) 0;
            mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
            shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
            for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) {
                PyObject *tmp, *digit;
                long idigit;
                digit = PyNumber_And(stepval, mask);
                if (unlikely(!digit)) goto done;
                idigit = PyLong_AsLong(digit);
                Py_DECREF(digit);
                if (unlikely(idigit < 0)) goto done;
                val |= ((long) idigit) << bits;
                tmp = PyNumber_Rshift(stepval, shift);
                if (unlikely(!tmp)) goto done;
                Py_DECREF(stepval); stepval = tmp;
            }
            Py_DECREF(shift); shift = NULL;
            Py_DECREF(mask); mask = NULL;
            {
                long idigit = PyLong_AsLong(stepval);
                if (unlikely(idigit < 0)) goto done;
                remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1);
                if (unlikely(idigit >= (1L << remaining_bits)))
                    goto raise_overflow;
                val |= ((long) idigit) << bits;
            }
            if (!is_unsigned) {
                if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1))))
                    goto raise_overflow;
                if (is_negative)
                    val = ~val;
            }
            ret = 0;
        done:
            Py_XDECREF(shift);
            Py_XDECREF(mask);
            Py_XDECREF(stepval);
    #endif
            if (unlikely(ret))
                return (long) -1;
            return val;
        }
    raise_overflow:
        PyErr_SetString(PyExc_OverflowError,
            "value too large to convert to long");
        return (long) -1;
    raise_neg_overflow:
        PyErr_SetString(PyExc_OverflowError,
            "can't convert negative value to long");
        return (long) -1;
    }
    
/* CIntFromPy */
    static CYTHON_INLINE char __Pyx_PyLong_As_char(PyObject *x) {
    #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
    #pragma GCC diagnostic push
    #pragma GCC diagnostic ignored "-Wconversion"
    #endif
        const char neg_one = (char) -1, const_zero = (char) 0;
    #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
    #pragma GCC diagnostic pop
    #endif
        const int is_unsigned = neg_one > const_zero;
        if (unlikely(!PyLong_Check(x))) {
            char val;
            PyObject *tmp = __Pyx_PyNumber_Long(x);
            if (!tmp) return (char) -1;
            val = __Pyx_PyLong_As_char(tmp);
            Py_DECREF(tmp);
            return val;
        }
        if (is_unsigned) {
    #if CYTHON_USE_PYLONG_INTERNALS
            if (unlikely(__Pyx_PyLong_IsNeg(x))) {
                goto raise_neg_overflow;
            } else if (__Pyx_PyLong_IsCompact(x)) {
                __PYX_VERIFY_RETURN_INT(char, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
            } else {
                const digit* digits = __Pyx_PyLong_Digits(x);
                assert(__Pyx_PyLong_DigitCount(x) > 1);
                switch (__Pyx_PyLong_DigitCount(x)) {
                    case 2:
                        if ((8 * sizeof(char) > 1 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(char) >= 2 * PyLong_SHIFT)) {
                                return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
                            }
                        }
                        break;
                    case 3:
                        if ((8 * sizeof(char) > 2 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(char) >= 3 * PyLong_SHIFT)) {
                                return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
                            }
                        }
                        break;
                    case 4:
                        if ((8 * sizeof(char) > 3 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(char) >= 4 * PyLong_SHIFT)) {
                                return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
                            }
                        }
                        break;
                }
            }
    #endif
    #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
    #else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (char) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
    #endif
            if ((sizeof(char) <= sizeof(unsigned long))) {
                __PYX_VERIFY_RETURN_INT_EXC(char, unsigned long, PyLong_AsUnsignedLong(x))
            } else if ((sizeof(char) <= sizeof(unsigned PY_LONG_LONG))) {
                __PYX_VERIFY_RETURN_INT_EXC(char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
            }
        } else {
    #if CYTHON_USE_PYLONG_INTERNALS
            if (__Pyx_PyLong_IsCompact(x)) {
                __PYX_VERIFY_RETURN_INT(char, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
            } else {
                const digit* digits = __Pyx_PyLong_Digits(x);
                assert(__Pyx_PyLong_DigitCount(x) > 1);
                switch (__Pyx_PyLong_SignedDigitCount(x)) {
                    case -2:
                        if ((8 * sizeof(char) - 1 > 1 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) {
                                return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
                            }
                        }
                        break;
                    case 2:
                        if ((8 * sizeof(char) > 1 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) {
                                return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
                            }
                        }
                        break;
                    case -3:
                        if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) {
                                return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
                            }
                        }
                        break;
                    case 3:
                        if ((8 * sizeof(char) > 2 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) {
                                return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
                            }
                        }
                        break;
                    case -4:
                        if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(char) - 1 > 4 * PyLong_SHIFT)) {
                                return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
                            }
                        }
                        break;
                    case 4:
                        if ((8 * sizeof(char) > 3 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(char) - 1 > 4 * PyLong_SHIFT)) {
                                return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
                            }
                        }
                        break;
                }
            }
    #endif
            if ((sizeof(char) <= sizeof(long))) {
                __PYX_VERIFY_RETURN_INT_EXC(char, long, PyLong_AsLong(x))
            } else if ((sizeof(char) <= sizeof(PY_LONG_LONG))) {
                __PYX_VERIFY_RETURN_INT_EXC(char, PY_LONG_LONG, PyLong_AsLongLong(x))
            }
        }
        {
            char val;
            int ret = -1;
    #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
            Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
                x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
            if (unlikely(bytes_copied == -1)) {
            } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
                goto raise_overflow;
            } else {
                ret = 0;
            }
    #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
            int one = 1; int is_little = (int)*(unsigned char *)&one;
            unsigned char *bytes = (unsigned char *)&val;
            ret = _PyLong_AsByteArray((PyLongObject *)x,
                                        bytes, sizeof(val),
                                        is_little, !is_unsigned);
    #else
            PyObject *v;
            PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
            int bits, remaining_bits, is_negative = 0;
            int chunk_size = (sizeof(long) < 8) ? 30 : 62;
            if (likely(PyLong_CheckExact(x))) {
                v = __Pyx_NewRef(x);
            } else {
                v = PyNumber_Long(x);
                if (unlikely(!v)) return (char) -1;
                assert(PyLong_CheckExact(v));
            }
            {
                int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
                if (unlikely(result < 0)) {
                    Py_DECREF(v);
                    return (char) -1;
                }
                is_negative = result == 1;
            }
            if (is_unsigned && unlikely(is_negative)) {
                Py_DECREF(v);
                goto raise_neg_overflow;
            } else if (is_negative) {
                stepval = PyNumber_Invert(v);
                Py_DECREF(v);
                if (unlikely(!stepval))
                    return (char) -1;
            } else {
                stepval = v;
            }
            v = NULL;
            val = (char) 0;
            mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
            shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
            for (bits = 0; bits < (int) sizeof(char) * 8 - chunk_size; bits += chunk_size) {
                PyObject *tmp, *digit;
                long idigit;
                digit = PyNumber_And(stepval, mask);
                if (unlikely(!digit)) goto done;
                idigit = PyLong_AsLong(digit);
                Py_DECREF(digit);
                if (unlikely(idigit < 0)) goto done;
                val |= ((char) idigit) << bits;
                tmp = PyNumber_Rshift(stepval, shift);
                if (unlikely(!tmp)) goto done;
                Py_DECREF(stepval); stepval = tmp;
            }
            Py_DECREF(shift); shift = NULL;
            Py_DECREF(mask); mask = NULL;
            {
                long idigit = PyLong_AsLong(stepval);
                if (unlikely(idigit < 0)) goto done;
                remaining_bits = ((int) sizeof(char) * 8) - bits - (is_unsigned ? 0 : 1);
                if (unlikely(idigit >= (1L << remaining_bits)))
                    goto raise_overflow;
                val |= ((char) idigit) << bits;
            }
            if (!is_unsigned) {
                if (unlikely(val & (((char) 1) << (sizeof(char) * 8 - 1))))
                    goto raise_overflow;
                if (is_negative)
                    val = ~val;
            }
            ret = 0;
        done:
            Py_XDECREF(shift);
            Py_XDECREF(mask);
            Py_XDECREF(stepval);
    #endif
            if (unlikely(ret))
                return (char) -1;
            return val;
        }
    raise_overflow:
        PyErr_SetString(PyExc_OverflowError,
            "value too large to convert to char");
        return (char) -1;
    raise_neg_overflow:
        PyErr_SetString(PyExc_OverflowError,
            "can't convert negative value to char");
        return (char) -1;
    }
    
/* GetRuntimeVersion */
    #if __PYX_LIMITED_VERSION_HEX < 0x030b0000
    void __Pyx_init_runtime_version(void) {
        if (__Pyx_cached_runtime_version == 0) {
            const char* rt_version = Py_GetVersion();
            unsigned long version = 0;
            unsigned long factor = 0x01000000UL;
            unsigned int digit = 0;
            int i = 0;
            while (factor) {
                while ('0' <= rt_version[i] && rt_version[i] <= '9') {
                    digit = digit * 10 + (unsigned int) (rt_version[i] - '0');
                    ++i;
                }
                version += factor * digit;
                if (rt_version[i] != '.')
                    break;
                digit = 0;
                factor >>= 8;
                ++i;
            }
            __Pyx_cached_runtime_version = version;
        }
    }
    #endif
    static unsigned long __Pyx_get_runtime_version(void) {
    #if __PYX_LIMITED_VERSION_HEX >= 0x030b0000
        return Py_Version & ~0xFFUL;
    #else
        return __Pyx_cached_runtime_version;
    #endif
    }
    
/* CheckBinaryVersion */
    static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer) {
        const unsigned long MAJOR_MINOR = 0xFFFF0000UL;
        if ((rt_version & MAJOR_MINOR) == (ct_version & MAJOR_MINOR))
            return 0;
        if (likely(allow_newer && (rt_version & MAJOR_MINOR) > (ct_version & MAJOR_MINOR)))
            return 1;
        {
            char message[200];
            PyOS_snprintf(message, sizeof(message),
                          "compile time Python version %d.%d "
                          "of module '%.100s' "
                          "%s "
                          "runtime version %d.%d",
                           (int) (ct_version >> 24), (int) ((ct_version >> 16) & 0xFF),
                           __Pyx_MODULE_NAME,
                           (allow_newer) ? "was newer than" : "does not match",
                           (int) (rt_version >> 24), (int) ((rt_version >> 16) & 0xFF)
           );
            return PyErr_WarnEx(NULL, message, 1);
        }
    }
    
/* NewCodeObj */
    #if CYTHON_COMPILING_IN_LIMITED_API
        static PyObject* __Pyx__PyCode_New(int a, int p, int k, int l, int s, int f,
                                           PyObject *code, PyObject *c, PyObject* n, PyObject *v,
                                           PyObject *fv, PyObject *cell, PyObject* fn,
                                           PyObject *name, int fline, PyObject *lnos) {
            PyObject *exception_table = NULL;
            PyObject *types_module=NULL, *code_type=NULL, *result=NULL;
            #if __PYX_LIMITED_VERSION_HEX < 0x030b0000
            PyObject *version_info;
            PyObject *py_minor_version = NULL;
            #endif
            long minor_version = 0;
            PyObject *type, *value, *traceback;
            PyErr_Fetch(&type, &value, &traceback);
            #if __PYX_LIMITED_VERSION_HEX >= 0x030b0000
            minor_version = 11;
            #else
            if (!(version_info = PySys_GetObject("version_info"))) goto end;
            if (!(py_minor_version = PySequence_GetItem(version_info, 1))) goto end;
            minor_version = PyLong_AsLong(py_minor_version);
            Py_DECREF(py_minor_version);
            if (minor_version == -1 && PyErr_Occurred()) goto end;
            #endif
            if (!(types_module = PyImport_ImportModule("types"))) goto end;
            if (!(code_type = PyObject_GetAttrString(types_module, "CodeType"))) goto end;
            if (minor_version <= 7) {
                (void)p;
                result = PyObject_CallFunction(code_type, "iiiiiOOOOOOiOOO", a, k, l, s, f, code,
                              c, n, v, fn, name, fline, lnos, fv, cell);
            } else if (minor_version <= 10) {
                result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOiOOO", a,p, k, l, s, f, code,
                              c, n, v, fn, name, fline, lnos, fv, cell);
            } else {
                if (!(exception_table = PyBytes_FromStringAndSize(NULL, 0))) goto end;
                result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOOiOOOO", a,p, k, l, s, f, code,
                              c, n, v, fn, name, name, fline, lnos, exception_table, fv, cell);
            }
        end:
            Py_XDECREF(code_type);
            Py_XDECREF(exception_table);
            Py_XDECREF(types_module);
            if (type) {
                PyErr_Restore(type, value, traceback);
            }
            return result;
        }
    #elif PY_VERSION_HEX >= 0x030B0000
      static PyCodeObject* __Pyx__PyCode_New(int a, int p, int k, int l, int s, int f,
                                             PyObject *code, PyObject *c, PyObject* n, PyObject *v,
                                             PyObject *fv, PyObject *cell, PyObject* fn,
                                             PyObject *name, int fline, PyObject *lnos) {
        PyCodeObject *result;
        result =
          #if PY_VERSION_HEX >= 0x030C0000
            PyUnstable_Code_NewWithPosOnlyArgs
          #else
            PyCode_NewWithPosOnlyArgs
          #endif
            (a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, name, fline, lnos, __pyx_mstate_global->__pyx_empty_bytes);
        #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030c00A1
        if (likely(result))
            result->_co_firsttraceable = 0;
        #endif
        return result;
      }
    #elif !CYTHON_COMPILING_IN_PYPY
      #define __Pyx__PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
              PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
    #else
      #define __Pyx__PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
              PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
    #endif
    static PyObject* __Pyx_PyCode_New(
            const __Pyx_PyCode_New_function_description descr,
            PyObject * const *varnames,
            PyObject *filename,
            PyObject *funcname,
            PyObject *line_table,
            PyObject *tuple_dedup_map
    ) {
        PyObject *code_obj = NULL, *varnames_tuple_dedup = NULL, *code_bytes = NULL;
        Py_ssize_t var_count = (Py_ssize_t) descr.nlocals;
        PyObject *varnames_tuple = PyTuple_New(var_count);
        if (unlikely(!varnames_tuple)) return NULL;
        for (Py_ssize_t i=0; i < var_count; i++) {
            Py_INCREF(varnames[i]);
            if (__Pyx_PyTuple_SET_ITEM(varnames_tuple, i, varnames[i]) != (0)) goto done;
        }
        #if CYTHON_COMPILING_IN_LIMITED_API
        varnames_tuple_dedup = PyDict_GetItem(tuple_dedup_map, varnames_tuple);
        if (!varnames_tuple_dedup) {
            if (unlikely(PyDict_SetItem(tuple_dedup_map, varnames_tuple, varnames_tuple) < 0)) goto done;
            varnames_tuple_dedup = varnames_tuple;
        }
        #else
        varnames_tuple_dedup = PyDict_SetDefault(tuple_dedup_map, varnames_tuple, varnames_tuple);
        if (unlikely(!varnames_tuple_dedup)) goto done;
        #endif
        #if CYTHON_AVOID_BORROWED_REFS
        Py_INCREF(varnames_tuple_dedup);
        #endif
        if (__PYX_LIMITED_VERSION_HEX >= (0x030b0000) && line_table != NULL && !CYTHON_COMPILING_IN_GRAAL) {
            Py_ssize_t line_table_length = __Pyx_PyBytes_GET_SIZE(line_table);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely(line_table_length == -1)) goto done;
            #endif
            Py_ssize_t code_len = (line_table_length * 2 + 4) & ~3LL;
            code_bytes = PyBytes_FromStringAndSize(NULL, code_len);
            if (unlikely(!code_bytes)) goto done;
            char* c_code_bytes = PyBytes_AsString(code_bytes);
            if (unlikely(!c_code_bytes)) goto done;
            memset(c_code_bytes, 0, (size_t) code_len);
        }
        code_obj = (PyObject*) __Pyx__PyCode_New(
            (int) descr.argcount,
            (int) descr.num_posonly_args,
            (int) descr.num_kwonly_args,
            (int) descr.nlocals,
            0,
            (int) descr.flags,
            code_bytes ? code_bytes : __pyx_mstate_global->__pyx_empty_bytes,
            __pyx_mstate_global->__pyx_empty_tuple,
            __pyx_mstate_global->__pyx_empty_tuple,
            varnames_tuple_dedup,
            __pyx_mstate_global->__pyx_empty_tuple,
            __pyx_mstate_global->__pyx_empty_tuple,
            filename,
            funcname,
            (int) descr.first_line,
            (__PYX_LIMITED_VERSION_HEX >= (0x030b0000) && line_table) ? line_table : __pyx_mstate_global->__pyx_empty_bytes
        );
    done:
        Py_XDECREF(code_bytes);
        #if CYTHON_AVOID_BORROWED_REFS
        Py_XDECREF(varnames_tuple_dedup);
        #endif
        Py_DECREF(varnames_tuple);
        return code_obj;
    }
    
/* DecompressString */
    static PyObject *__Pyx_DecompressString(const char *s, Py_ssize_t length, int algo) {
        PyObject *module = NULL, *decompress, *compressed_bytes, *decompressed;
        const char* module_name = algo == 3 ? "compression.zstd" : algo == 2 ? "bz2" : "zlib";
        PyObject *methodname = PyUnicode_FromString("decompress");
        if (unlikely(!methodname)) return NULL;
        #if __PYX_LIMITED_VERSION_HEX >= 0x030e0000
        if (algo == 3) {
            PyObject *fromlist = Py_BuildValue("[O]", methodname);
            if (unlikely(!fromlist)) goto bad;
            module = PyImport_ImportModuleLevel("compression.zstd", NULL, NULL, fromlist, 0);
            Py_DECREF(fromlist);
        } else
        #endif
            module = PyImport_ImportModule(module_name);
        if (unlikely(!module)) goto import_failed;
        decompress = PyObject_GetAttr(module, methodname);
        if (unlikely(!decompress)) goto import_failed;
        {
            #ifdef __cplusplus
                char *memview_bytes = const_cast<char*>(s);
            #else
                #if defined(__clang__)
                  #pragma clang diagnostic push
                  #pragma clang diagnostic ignored "-Wcast-qual"
                #elif !defined(__INTEL_COMPILER) && defined(__GNUC__)
                  #pragma GCC diagnostic push
                  #pragma GCC diagnostic ignored "-Wcast-qual"
                #endif
                char *memview_bytes = (char*) s;
                #if defined(__clang__)
                  #pragma clang diagnostic pop
                #elif !defined(__INTEL_COMPILER) && defined(__GNUC__)
                  #pragma GCC diagnostic pop
                #endif
            #endif
            #if CYTHON_COMPILING_IN_LIMITED_API && !defined(PyBUF_READ)
            int memview_flags = 0x100;
            #else
            int memview_flags = PyBUF_READ;
            #endif
            compressed_bytes = PyMemoryView_FromMemory(memview_bytes, length, memview_flags);
        }
        if (unlikely(!compressed_bytes)) {
            Py_DECREF(decompress);
            goto bad;
        }
        decompressed = PyObject_CallFunctionObjArgs(decompress, compressed_bytes, NULL);
        Py_DECREF(compressed_bytes);
        Py_DECREF(decompress);
        Py_DECREF(module);
        Py_DECREF(methodname);
        return decompressed;
    import_failed:
        PyErr_Format(PyExc_ImportError,
            "Failed to import '%.20s.decompress' - cannot initialise module strings. "
            "String compression was configured with the C macro 'CYTHON_COMPRESS_STRINGS=%d'.",
            module_name, algo);
    bad:
        Py_XDECREF(module);
        Py_DECREF(methodname);
        return NULL;
    }
    
#include <string.h>
static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s) {
    size_t len = strlen(s);
    if (unlikely(len > (size_t) PY_SSIZE_T_MAX)) {
        PyErr_SetString(PyExc_OverflowError, "byte string is too long");
        return -1;
    }
    return (Py_ssize_t) len;
}
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
    Py_ssize_t len = __Pyx_ssize_strlen(c_str);
    if (unlikely(len < 0)) return NULL;
    return __Pyx_PyUnicode_FromStringAndSize(c_str, len);
}
static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char* c_str) {
    Py_ssize_t len = __Pyx_ssize_strlen(c_str);
    if (unlikely(len < 0)) return NULL;
    return PyByteArray_FromStringAndSize(c_str, len);
}
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
    Py_ssize_t ignore;
    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
}
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_UTF8
static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
    if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
#if CYTHON_COMPILING_IN_LIMITED_API
    {
        const char* result;
        Py_ssize_t unicode_length;
        CYTHON_MAYBE_UNUSED_VAR(unicode_length); // only for __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
        #if __PYX_LIMITED_VERSION_HEX < 0x030A0000
        if (unlikely(PyArg_Parse(o, "s#", &result, length) < 0)) return NULL;
        #else
        result = PyUnicode_AsUTF8AndSize(o, length);
        #endif
        #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
        unicode_length = PyUnicode_GetLength(o);
        if (unlikely(unicode_length < 0)) return NULL;
        if (unlikely(unicode_length != *length)) {
            PyUnicode_AsASCIIString(o);
            return NULL;
        }
        #endif
        return result;
    }
#else
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
    if (likely(PyUnicode_IS_ASCII(o))) {
        *length = PyUnicode_GET_LENGTH(o);
        return PyUnicode_AsUTF8(o);
    } else {
        PyUnicode_AsASCIIString(o);
        return NULL;
    }
#else
    return PyUnicode_AsUTF8AndSize(o, length);
#endif
#endif
}
#endif
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_UTF8
    if (PyUnicode_Check(o)) {
        return __Pyx_PyUnicode_AsStringAndSize(o, length);
    } else
#endif
    if (PyByteArray_Check(o)) {
#if (CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS) || (CYTHON_COMPILING_IN_PYPY && (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)))
        *length = PyByteArray_GET_SIZE(o);
        return PyByteArray_AS_STRING(o);
#else
        *length = PyByteArray_Size(o);
        if (*length == -1) return NULL;
        return PyByteArray_AsString(o);
#endif
    } else
    {
        char* result;
        int r = PyBytes_AsStringAndSize(o, &result, length);
        if (unlikely(r < 0)) {
            return NULL;
        } else {
            return result;
        }
    }
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
   int is_true = x == Py_True;
   if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
   else return PyObject_IsTrue(x);
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
    int retval;
    if (unlikely(!x)) return -1;
    retval = __Pyx_PyObject_IsTrue(x);
    Py_DECREF(x);
    return retval;
}
static PyObject* __Pyx_PyNumber_LongWrongResultType(PyObject* result) {
    __Pyx_TypeName result_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(result));
    if (PyLong_Check(result)) {
        if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
                "__int__ returned non-int (type " __Pyx_FMT_TYPENAME ").  "
                "The ability to return an instance of a strict subclass of int is deprecated, "
                "and may be removed in a future version of Python.",
                result_type_name)) {
            __Pyx_DECREF_TypeName(result_type_name);
            Py_DECREF(result);
            return NULL;
        }
        __Pyx_DECREF_TypeName(result_type_name);
        return result;
    }
    PyErr_Format(PyExc_TypeError,
                 "__int__ returned non-int (type " __Pyx_FMT_TYPENAME ")",
                 result_type_name);
    __Pyx_DECREF_TypeName(result_type_name);
    Py_DECREF(result);
    return NULL;
}
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Long(PyObject* x) {
#if CYTHON_USE_TYPE_SLOTS
  PyNumberMethods *m;
#endif
  PyObject *res = NULL;
  if (likely(PyLong_Check(x)))
      return __Pyx_NewRef(x);
#if CYTHON_USE_TYPE_SLOTS
  m = Py_TYPE(x)->tp_as_number;
  if (likely(m && m->nb_int)) {
      res = m->nb_int(x);
  }
#else
  if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
      res = PyNumber_Long(x);
  }
#endif
  if (likely(res)) {
      if (unlikely(!PyLong_CheckExact(res))) {
          return __Pyx_PyNumber_LongWrongResultType(res);
      }
  }
  else if (!PyErr_Occurred()) {
      PyErr_SetString(PyExc_TypeError,
                      "an integer is required");
  }
  return res;
}
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  Py_ssize_t ival;
  PyObject *x;
  if (likely(PyLong_CheckExact(b))) {
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(__Pyx_PyLong_IsCompact(b))) {
        return __Pyx_PyLong_CompactValue(b);
    } else {
      const digit* digits = __Pyx_PyLong_Digits(b);
      const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(b);
      switch (size) {
         case 2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case 3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case 4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
      }
    }
    #endif
    return PyLong_AsSsize_t(b);
  }
  x = PyNumber_Index(b);
  if (!x) return -1;
  ival = PyLong_AsSsize_t(x);
  Py_DECREF(x);
  return ival;
}
static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) {
  if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) {
    return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o);
  } else {
    Py_ssize_t ival;
    PyObject *x;
    x = PyNumber_Index(o);
    if (!x) return -1;
    ival = PyLong_AsLong(x);
    Py_DECREF(x);
    return ival;
  }
}
static CYTHON_INLINE PyObject *__Pyx_Owned_Py_None(int b) {
    CYTHON_UNUSED_VAR(b);
    return __Pyx_NewRef(Py_None);
}
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
  return __Pyx_NewRef(b ? Py_True: Py_False);
}
static CYTHON_INLINE PyObject * __Pyx_PyLong_FromSize_t(size_t ival) {
    return PyLong_FromSize_t(ival);
}


    /* MultiPhaseInitModuleState */
    #if CYTHON_PEP489_MULTI_PHASE_INIT && CYTHON_USE_MODULE_STATE
    #ifndef CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
    #if (CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX >= 0x030C0000)
      #define CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE 1
    #else
      #define CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE 0
    #endif
    #endif
    #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE && !CYTHON_ATOMICS
    #error "Module state with PEP489 requires atomics. Currently that's one of\
     C11, C++11, gcc atomic intrinsics or MSVC atomic intrinsics"
    #endif
    #if !CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
    #define __Pyx_ModuleStateLookup_Lock()
    #define __Pyx_ModuleStateLookup_Unlock()
    #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d0000
    static PyMutex __Pyx_ModuleStateLookup_mutex = {0};
    #define __Pyx_ModuleStateLookup_Lock() PyMutex_Lock(&__Pyx_ModuleStateLookup_mutex)
    #define __Pyx_ModuleStateLookup_Unlock() PyMutex_Unlock(&__Pyx_ModuleStateLookup_mutex)
    #elif defined(__cplusplus) && __cplusplus >= 201103L
    #include <mutex>
    static std::mutex __Pyx_ModuleStateLookup_mutex;
    #define __Pyx_ModuleStateLookup_Lock() __Pyx_ModuleStateLookup_mutex.lock()
    #define __Pyx_ModuleStateLookup_Unlock() __Pyx_ModuleStateLookup_mutex.unlock()
    #elif defined(__STDC_VERSION__) && (__STDC_VERSION__ > 201112L) && !defined(__STDC_NO_THREADS__)
    #include <threads.h>
    static mtx_t __Pyx_ModuleStateLookup_mutex;
    static once_flag __Pyx_ModuleStateLookup_mutex_once_flag = ONCE_FLAG_INIT;
    static void __Pyx_ModuleStateLookup_initialize_mutex(void) {
        mtx_init(&__Pyx_ModuleStateLookup_mutex, mtx_plain);
    }
    #define __Pyx_ModuleStateLookup_Lock()\
      call_once(&__Pyx_ModuleStateLookup_mutex_once_flag, __Pyx_ModuleStateLookup_initialize_mutex);\
      mtx_lock(&__Pyx_ModuleStateLookup_mutex)
    #define __Pyx_ModuleStateLookup_Unlock() mtx_unlock(&__Pyx_ModuleStateLookup_mutex)
    #elif defined(HAVE_PTHREAD_H)
    #include <pthread.h>
    static pthread_mutex_t __Pyx_ModuleStateLookup_mutex = PTHREAD_MUTEX_INITIALIZER;
    #define __Pyx_ModuleStateLookup_Lock() pthread_mutex_lock(&__Pyx_ModuleStateLookup_mutex)
    #define __Pyx_ModuleStateLookup_Unlock() pthread_mutex_unlock(&__Pyx_ModuleStateLookup_mutex)
    #elif defined(_WIN32)
    #include <Windows.h>  // synchapi.h on its own doesn't work
    static SRWLOCK __Pyx_ModuleStateLookup_mutex = SRWLOCK_INIT;
    #define __Pyx_ModuleStateLookup_Lock() AcquireSRWLockExclusive(&__Pyx_ModuleStateLookup_mutex)
    #define __Pyx_ModuleStateLookup_Unlock() ReleaseSRWLockExclusive(&__Pyx_ModuleStateLookup_mutex)
    #else
    #error "No suitable lock available for CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE.\
     Requires C standard >= C11, or C++ standard >= C++11,\
     or pthreads, or the Windows 32 API, or Python >= 3.13."
    #endif
    typedef struct {
        int64_t id;
        PyObject *module;
    } __Pyx_InterpreterIdAndModule;
    typedef struct {
        char interpreter_id_as_index;
        Py_ssize_t count;
        Py_ssize_t allocated;
        __Pyx_InterpreterIdAndModule table[1];
    } __Pyx_ModuleStateLookupData;
    #define __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE 32
    #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
    static __pyx_atomic_int_type __Pyx_ModuleStateLookup_read_counter = 0;
    #endif
    #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
    static __pyx_atomic_ptr_type __Pyx_ModuleStateLookup_data = 0;
    #else
    static __Pyx_ModuleStateLookupData* __Pyx_ModuleStateLookup_data = NULL;
    #endif
    static __Pyx_InterpreterIdAndModule* __Pyx_State_FindModuleStateLookupTableLowerBound(
            __Pyx_InterpreterIdAndModule* table,
            Py_ssize_t count,
            int64_t interpreterId) {
        __Pyx_InterpreterIdAndModule* begin = table;
        __Pyx_InterpreterIdAndModule* end = begin + count;
        if (begin->id == interpreterId) {
            return begin;
        }
        while ((end - begin) > __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE) {
            __Pyx_InterpreterIdAndModule* halfway = begin + (end - begin)/2;
            if (halfway->id == interpreterId) {
                return halfway;
            }
            if (halfway->id < interpreterId) {
                begin = halfway;
            } else {
                end = halfway;
            }
        }
        for (; begin < end; ++begin) {
            if (begin->id >= interpreterId) return begin;
        }
        return begin;
    }
    static PyObject *__Pyx_State_FindModule(CYTHON_UNUSED void* dummy) {
        int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get());
        if (interpreter_id == -1) return NULL;
    #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
        __Pyx_ModuleStateLookupData* data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_relaxed(&__Pyx_ModuleStateLookup_data);
        {
            __pyx_atomic_incr_acq_rel(&__Pyx_ModuleStateLookup_read_counter);
            if (likely(data)) {
                __Pyx_ModuleStateLookupData* new_data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_acquire(&__Pyx_ModuleStateLookup_data);
                if (likely(data == new_data)) {
                    goto read_finished;
                }
            }
            __pyx_atomic_decr_acq_rel(&__Pyx_ModuleStateLookup_read_counter);
            __Pyx_ModuleStateLookup_Lock();
            __pyx_atomic_incr_relaxed(&__Pyx_ModuleStateLookup_read_counter);
            data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_relaxed(&__Pyx_ModuleStateLookup_data);
            __Pyx_ModuleStateLookup_Unlock();
        }
      read_finished:;
    #else
        __Pyx_ModuleStateLookupData* data = __Pyx_ModuleStateLookup_data;
    #endif
        __Pyx_InterpreterIdAndModule* found = NULL;
        if (unlikely(!data)) goto end;
        if (data->interpreter_id_as_index) {
            if (interpreter_id < data->count) {
                found = data->table+interpreter_id;
            }
        } else {
            found = __Pyx_State_FindModuleStateLookupTableLowerBound(
                data->table, data->count, interpreter_id);
        }
      end:
        {
            PyObject *result=NULL;
            if (found && found->id == interpreter_id) {
                result = found->module;
            }
    #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
            __pyx_atomic_decr_acq_rel(&__Pyx_ModuleStateLookup_read_counter);
    #endif
            return result;
        }
    }
    #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
    static void __Pyx_ModuleStateLookup_wait_until_no_readers(void) {
        while (__pyx_atomic_load(&__Pyx_ModuleStateLookup_read_counter) != 0);
    }
    #else
    #define __Pyx_ModuleStateLookup_wait_until_no_readers()
    #endif
    static int __Pyx_State_AddModuleInterpIdAsIndex(__Pyx_ModuleStateLookupData **old_data, PyObject* module, int64_t interpreter_id) {
        Py_ssize_t to_allocate = (*old_data)->allocated;
        while (to_allocate <= interpreter_id) {
            if (to_allocate == 0) to_allocate = 1;
            else to_allocate *= 2;
        }
        __Pyx_ModuleStateLookupData *new_data = *old_data;
        if (to_allocate != (*old_data)->allocated) {
             new_data = (__Pyx_ModuleStateLookupData *)realloc(
                *old_data,
                sizeof(__Pyx_ModuleStateLookupData)+(to_allocate-1)*sizeof(__Pyx_InterpreterIdAndModule));
            if (!new_data) {
                PyErr_NoMemory();
                return -1;
            }
            for (Py_ssize_t i = new_data->allocated; i < to_allocate; ++i) {
                new_data->table[i].id = i;
                new_data->table[i].module = NULL;
            }
            new_data->allocated = to_allocate;
        }
        new_data->table[interpreter_id].module = module;
        if (new_data->count < interpreter_id+1) {
            new_data->count = interpreter_id+1;
        }
        *old_data = new_data;
        return 0;
    }
    static void __Pyx_State_ConvertFromInterpIdAsIndex(__Pyx_ModuleStateLookupData *data) {
        __Pyx_InterpreterIdAndModule *read = data->table;
        __Pyx_InterpreterIdAndModule *write = data->table;
        __Pyx_InterpreterIdAndModule *end = read + data->count;
        for (; read<end; ++read) {
            if (read->module) {
                write->id = read->id;
                write->module = read->module;
                ++write;
            }
        }
        data->count = write - data->table;
        for (; write<end; ++write) {
            write->id = 0;
            write->module = NULL;
        }
        data->interpreter_id_as_index = 0;
    }
    static int __Pyx_State_AddModule(PyObject* module, CYTHON_UNUSED void* dummy) {
        int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get());
        if (interpreter_id == -1) return -1;
        int result = 0;
        __Pyx_ModuleStateLookup_Lock();
    #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
        __Pyx_ModuleStateLookupData *old_data = (__Pyx_ModuleStateLookupData *)
                __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, 0);
    #else
        __Pyx_ModuleStateLookupData *old_data = __Pyx_ModuleStateLookup_data;
    #endif
        __Pyx_ModuleStateLookupData *new_data = old_data;
        if (!new_data) {
            new_data = (__Pyx_ModuleStateLookupData *)calloc(1, sizeof(__Pyx_ModuleStateLookupData));
            if (!new_data) {
                result = -1;
                PyErr_NoMemory();
                goto end;
            }
            new_data->allocated = 1;
            new_data->interpreter_id_as_index = 1;
        }
        __Pyx_ModuleStateLookup_wait_until_no_readers();
        if (new_data->interpreter_id_as_index) {
            if (interpreter_id < __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE) {
                result = __Pyx_State_AddModuleInterpIdAsIndex(&new_data, module, interpreter_id);
                goto end;
            }
            __Pyx_State_ConvertFromInterpIdAsIndex(new_data);
        }
        {
            Py_ssize_t insert_at = 0;
            {
                __Pyx_InterpreterIdAndModule* lower_bound = __Pyx_State_FindModuleStateLookupTableLowerBound(
                    new_data->table, new_data->count, interpreter_id);
                assert(lower_bound);
                insert_at = lower_bound - new_data->table;
                if (unlikely(insert_at < new_data->count && lower_bound->id == interpreter_id)) {
                    lower_bound->module = module;
                    goto end;  // already in table, nothing more to do
                }
            }
            if (new_data->count+1 >= new_data->allocated) {
                Py_ssize_t to_allocate = (new_data->count+1)*2;
                new_data =
                    (__Pyx_ModuleStateLookupData*)realloc(
                        new_data,
                        sizeof(__Pyx_ModuleStateLookupData) +
                        (to_allocate-1)*sizeof(__Pyx_InterpreterIdAndModule));
                if (!new_data) {
                    result = -1;
                    new_data = old_data;
                    PyErr_NoMemory();
                    goto end;
                }
                new_data->allocated = to_allocate;
            }
            ++new_data->count;
            int64_t last_id = interpreter_id;
            PyObject *last_module = module;
            for (Py_ssize_t i=insert_at; i<new_data->count; ++i) {
                int64_t current_id = new_data->table[i].id;
                new_data->table[i].id = last_id;
                last_id = current_id;
                PyObject *current_module = new_data->table[i].module;
                new_data->table[i].module = last_module;
                last_module = current_module;
            }
        }
      end:
    #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
        __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, new_data);
    #else
        __Pyx_ModuleStateLookup_data = new_data;
    #endif
        __Pyx_ModuleStateLookup_Unlock();
        return result;
    }
    static int __Pyx_State_RemoveModule(CYTHON_UNUSED void* dummy) {
        int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get());
        if (interpreter_id == -1) return -1;
        __Pyx_ModuleStateLookup_Lock();
    #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
        __Pyx_ModuleStateLookupData *data = (__Pyx_ModuleStateLookupData *)
                __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, 0);
    #else
        __Pyx_ModuleStateLookupData *data = __Pyx_ModuleStateLookup_data;
    #endif
        if (data->interpreter_id_as_index) {
            if (interpreter_id < data->count) {
                data->table[interpreter_id].module = NULL;
            }
            goto done;
        }
        {
            __Pyx_ModuleStateLookup_wait_until_no_readers();
            __Pyx_InterpreterIdAndModule* lower_bound = __Pyx_State_FindModuleStateLookupTableLowerBound(
                data->table, data->count, interpreter_id);
            if (!lower_bound) goto done;
            if (lower_bound->id != interpreter_id) goto done;
            __Pyx_InterpreterIdAndModule *end = data->table+data->count;
            for (;lower_bound<end-1; ++lower_bound) {
                lower_bound->id = (lower_bound+1)->id;
                lower_bound->module = (lower_bound+1)->module;
            }
        }
        --data->count;
        if (data->count == 0) {
            free(data);
            data = NULL;
        }
      done:
    #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
        __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, data);
    #else
        __Pyx_ModuleStateLookup_data = data;
    #endif
        __Pyx_ModuleStateLookup_Unlock();
        return 0;
    }
    #endif
    
/* #### Code section: utility_code_pragmas_end ### */
#ifdef _MSC_VER
#pragma warning( pop )
#endif



/* #### Code section: end ### */
#endif /* Py_PYTHON_H */
